当前位置: 首页>>代码示例>>C++>>正文


C++ BitmapInfo类代码示例

本文整理汇总了C++中BitmapInfo的典型用法代码示例。如果您正苦于以下问题:C++ BitmapInfo类的具体用法?C++ BitmapInfo怎么用?C++ BitmapInfo使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了BitmapInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: DispEvalFunc

Bitmap *Gradient::BuildBitmap(int size) {
	float u,v;
	BitmapInfo bi;
	bi.SetName(GetString(IDS_RB_GRADTEMP));
	bi.SetWidth(size);
	bi.SetHeight(size);
	bi.SetType(BMM_TRUE_32);
	Bitmap *bm = TheManager->Create(&bi);
	if (bm==NULL) return NULL;
	PixelBuf l64(size);
	float d = 1.0f/float(size);
	v = 1.0f - 0.5f*d;
	for (int y=0; y<size; y++) {
		BMM_Color_64 *p64=l64.Ptr();
		u = 0.0f;
		for (int x=0; x<size; x++, p64++) {
			AColor c = DispEvalFunc(u,v);
			p64->r = FlToWord(c.r); 
			p64->g = FlToWord(c.g); 
			p64->b = FlToWord(c.b);
			p64->a = 0xffff; 
			u += d;
			}
		bm->PutPixels(0,y, size, l64.Ptr()); 
		v -= d;
		}
	return bm;
	}
开发者ID:2asoft,项目名称:xray,代码行数:28,代码来源:gradient.cpp

示例2: BuildBitmap

Bitmap* UVtex::BuildBitmap(int size) {
	float u,v;
	BitmapInfo bi;
	bi.SetName(_T("uvTexTemp"));
	bi.SetWidth(size);
	bi.SetHeight(size);
	bi.SetType(BMM_TRUE_32);
	Bitmap *bm = TheManager->Create(&bi);
	if (bm==NULL) return NULL;
	PixelBuf l64(size);
	float d = 1.0f/float(size);
	v = 0.0f;
	for (int y=0; y<size; y++) {
		BMM_Color_64 *p64=l64.Ptr();
		u = 0.0f;
		for (int x=0; x<size; x++, p64++) {
			Color c = EvalUVtex( Point3(u,(1.0f-v),0.0f) );
			p64->r = FlToWord(c.r);
			p64->g = FlToWord(c.g);
			p64->b = FlToWord(c.b);
			p64->a = 0xffff;
			u += d;
		}
		bm->PutPixels(0,y, size, l64.Ptr());
		v += d;
	}
	return bm;
}
开发者ID:johnburnett,项目名称:UVWtoRGB,代码行数:28,代码来源:UVtex.cpp

示例3: DispEvalFunc

Bitmap *Gradient::BuildBitmap(int size) {
	float u,v;
	BitmapInfo bi;
	static MaxSDK::AssetManagement::AssetUser bitMapAssetUser;
	if (bitMapAssetUser.GetId() == MaxSDK::AssetManagement::kInvalidId)
		bitMapAssetUser = MaxSDK::AssetManagement::IAssetManager::GetInstance()->GetAsset(GetString(IDS_RB_GRADTEMP), MaxSDK::AssetManagement::kBitmapAsset);
	bi.SetAsset(bitMapAssetUser);
	bi.SetWidth(size);
	bi.SetHeight(size);
	bi.SetType(BMM_TRUE_32);
	Bitmap *bm = TheManager->Create(&bi);
	if (bm==NULL) return NULL;
	PixelBuf l64(size);
	float d = 1.0f/float(size);
	v = 1.0f - 0.5f*d;
	for (int y=0; y<size; y++) {
		BMM_Color_64 *p64=l64.Ptr();
		u = 0.0f;
		for (int x=0; x<size; x++, p64++) {
			AColor c = DispEvalFunc(u,v);
			p64->r = FlToWord(c.r); 
			p64->g = FlToWord(c.g); 
			p64->b = FlToWord(c.b);
			p64->a = 0xffff; 
			u += d;
			}
		bm->PutPixels(0,y, size, l64.Ptr()); 
		v -= d;
		}
	return bm;
	}
开发者ID:artemeliy,项目名称:inf4715,代码行数:31,代码来源:gradient.cpp

示例4: ProcessImageIOError

BMMRES
BitmapIO_CIN::GetImageInfoDlg(HWND hWnd, BitmapInfo* bmi, const TCHAR* fname)
{
    BitmapInfo  bInfo;
    if (!bmi) {
        assert(FALSE);
        return ProcessImageIOError(bmi, GetResIDCaption(IDS_CIN_Internal_Error));
    }

	bInfo.Copy(bmi);

    if (fname)
		bInfo.SetName(fname);

    BMMRES bmmResult = GetImageInfo(&bInfo);
    if (bmmResult != BMMRES_SUCCESS) {
        return bmmResult;
    }

#ifdef BASIC_INFO_DLG
    DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_CIN_BASIC_INFO),
                   hWnd, (DLGPROC) CIN_ImageInfoDialogProc, (LPARAM) this);
#else
    DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_CIN_INFO),
                   hWnd, (DLGPROC) CIN_ImageInfoDialogProc, (LPARAM) this);
#endif

    return BMMRES_SUCCESS;
}
开发者ID:2asoft,项目名称:xray,代码行数:29,代码来源:cin.cpp

示例5: Update

    /// Called to update the controls of the dialog
    virtual void    Update( TimeValue t, Interval &valid, IParamMap2 *map )
    {
        ICustButton     *bmSelectBtn;
        IParamBlock2    *pblock;
        int             i;
        long            buttons[ 6 ] = { IDC_FRONT_NAME, IDC_BACK_NAME, IDC_LEFT_NAME, IDC_RIGHT_NAME, IDC_TOP_NAME, IDC_BOTTOM_NAME };
        BitmapInfo      bi;


        ParamMap2UserDlgProc::Update( t, valid, map );

        pblock = map->GetParamBlock();
        for( i = plStaticEnvLayer::kBmpFrontBitmap; i <= plStaticEnvLayer::kBmpBottomBitmap; i++ )
        {
            bmSelectBtn = GetICustButton( GetDlgItem( map->GetHWnd(), buttons[ i ] ) );
            PBBitmap *pbbm = pblock->GetBitmap( i, t );
            if( pbbm )
                bmSelectBtn->SetText( (TCHAR *)pbbm->bi.Filename() );
            else
                bmSelectBtn->SetText( _T( "None" ) );
            ReleaseICustButton( bmSelectBtn );
        }

        plStaticEnvLayer *layer = (plStaticEnvLayer *)map->GetParamBlock()->GetOwner();
        bi.SetName( layer->GetBaseFilename( t ) );
        SetDlgItemText( map->GetHWnd(), IDC_BASE_FILENAME, bi.Filename() );
        map->Enable( plStaticEnvLayer::kBmpGenerateFaces, ( bi.Name() == NULL || bi.Name()[ 0 ] == 0 ) ? FALSE : TRUE );

        bmSelectBtn = GetICustButton( GetDlgItem( map->GetHWnd(), IDC_GENERATE_FACES ) );
        bmSelectBtn->SetText( _T( "Generate From Node" ) );
        ReleaseICustButton( bmSelectBtn );

        i = pblock->GetInt( plStaticEnvLayer::kBmpTextureSize, t );
        pblock->SetValue( plStaticEnvLayer::kBmpLastTextureSize, t, i );
    }
开发者ID:MareinK,项目名称:Plasma,代码行数:36,代码来源:plStaticEnvLayerBitmapPB.cpp

示例6: c

Bitmap *PainterTextureSample::BuildBitmap(int size) 
	{
	float u,v;
	BitmapInfo bi;
	bi.SetName(_T("checkerTemp"));
	bi.SetWidth(size);
	bi.SetHeight(size);
	bi.SetType(BMM_TRUE_32);
	if (bm == NULL)
		{
		bm = TheManager->Create(&bi);
		if (bm==NULL) return NULL;
		PixelBuf l64(size);
		float d = 1.0f/float(size);
		v = 1.0f - 0.5f*d;
		for (int y=0; y<size; y++) {
			BMM_Color_64 *p64=l64.Ptr();
			u = 0.0f;
			for (int x=0; x<size; x++, p64++) {
				AColor c(0.0f,0.0f,0.0f) ;
				p64->r = FlToWord(c.r); 
				p64->g = FlToWord(c.g); 
				p64->b = FlToWord(c.b);
				p64->a = 0xffff; 
				u += d;
				}
			bm->PutPixels(0,y, size, l64.Ptr()); 
			v -= d;
			}
		}
	width = size;
	return bm;
	}
开发者ID:2asoft,项目名称:xray,代码行数:33,代码来源:PainterTextureSample.cpp

示例7: hsGuardBegin

//
// Create Bitmap
//
plMipmap *plBitmapCreator::ICreateBitmap(plBitmapData *bd)
{
    hsGuardBegin("hsConverterUtils::CreateBitmap");

    // Load the bitmap
    BitmapInfo bi;
    bi.SetName(bd->fileName.AsString().c_str());

#if 0 // This isn't really an issue since the textures are packed -Colin
    const int kMaxFileNameLength = 30;
    if (strlen(bi.Filename()) > kMaxFileNameLength)
    {
        // Allow to continue, But make it painful
        char errStr[256];
        sprintf(errStr, "File name longer than %d, won't burn to CD (%s)", kMaxFileNameLength, bi.Filename());//bitmapTex->GetName());
        MessageBox(GetActiveWindow(), errStr, bd->fileName, MB_OK|MB_ICONEXCLAMATION);  
    }
#endif

    bool notMipped = (bd->texFlags & plMipmap::kForceOneMipLevel) != 0;
    float sigma = bd->sig;
    
    // Load the bitmap
    Bitmap *bm = TheManager->Load(&bi);
    if (!bm)
    {
        // FIXME
        /*
        if (fErrorMsg->Set(!(fWarned & kWarnedNoMoreBitmapLoadErr), 
            "Error loading bitmap", pathName).CheckAskOrCancel())
        {
            fWarned |= kWarnedNoMoreBitmapLoadErr;
        }
        */
        return nil;
    }
    BitmapStorage *storage = bm->Storage();
    BitmapInfo *bInfo = &storage->bi;

    ICheckOutBitmap(bInfo, bm, bd->fileName);

    //
    // Create a plMipmap 
    //
    plMipmap *hBitmap = new plMipmap;
    if( (bm->Width() ^ (bm->Width() & -bm->Width()))
        ||(bm->Height() ^ (bm->Height() & -bm->Height())) )
    {
        IResampBitmap(bm, *hBitmap);
    }
    else if( ((bm->Width() >> 3) > bm->Height())||((bm->Height() >> 3) > bm->Width()) )
    {
        IResampBitmap(bm, *hBitmap);
    }
    else
    {
开发者ID:Mirphak,项目名称:Plasma,代码行数:59,代码来源:plBitmapCreator.cpp

示例8:

void	ViewFile::View( HWND	hWnd ) {
	
	int idx;
	DWORD caps;
	BitmapInfo bi;
	Bitmap *map = NULL;
	TCHAR buf[256];

	LoadString(hInst, IDS_DB_VIEW_FILE, buf, _countof(buf));
	
	if (!TheManager->SelectFileInputEx(&bi, hWnd, buf, TRUE))
	   return;

	if	(bi.Name()[0])
		idx = TheManager->ioList.ResolveDevice(&bi);
	else
		idx = TheManager->ioList.FindDevice(bi.Device());

	if (idx == -1)
		goto error;

	caps = TheManager->ioList.GetDeviceCapabilities(bi.Device());
	TCHAR title[MAX_PATH];

	if	(caps & BMMIO_EXTENSION)
		_tcscpy(title,bi.Filename());
	else
		_tcscpy(title,bi.Device());

	if	(caps & BMMIO_OWN_VIEWER) {
		BitmapIO	*IO =	TheManager->ioList.CreateDevInstance(bi.Device());
		if(IO) {
			BOOL succeeded = IO->ShowImage(hWnd,&bi);
			delete IO;
			if(!succeeded)
				goto normal_view;
		}
	} else {
		normal_view:
		SetCursor(LoadCursor(NULL,IDC_WAIT));
		map = TheManager->Load(&bi);
		if	(map)	{
			map->Display(title, BMM_CN, TRUE, FALSE);
		} else {
			error:
			TCHAR text[128];
			TCHAR tmp[128];
			LoadString(hInst, IDS_DB_NO_VIEW, tmp, _countof(tmp));
			wsprintf(text,tmp,bi.Name());
			LoadString(hInst, IDS_DB_VIEW_ERROR, tmp, _countof(tmp));
			MessageBox(hWnd,text,tmp,MB_OK);
		}
		SetCursor(LoadCursor(NULL,IDC_ARROW));
	}
	
}
开发者ID:innovatelogic,项目名称:ilogic-vm,代码行数:56,代码来源:viewfile.cpp

示例9: adoptArrayPtr

bool SharedBitmap::to16bit()
{
    if (m_locked)
        return false;
    if (is16bit())
        return true;

    BitmapInfo newBmpInfo = BitmapInfo::create(m_bmpInfo.size(), BitmapInfo::BitCount16);

    int width = newBmpInfo.width();
    int paddedWidth = newBmpInfo.paddedWidth();
    int bufferSize = paddedWidth * newBmpInfo.height();
    OwnArrayPtr<unsigned> newPixelData = adoptArrayPtr(new unsigned[bufferSize / 2]);
    void* newPixels = newPixelData.get();

    if (!newPixels)
        return false;

    unsigned short* p16 = static_cast<unsigned short*>(newPixels);
    const unsigned* p32 = static_cast<const unsigned*>(m_pixels);

    bool skips = paddedWidth != width;

    const unsigned short* p16end = p16 + bufferSize;
    while (p16 < p16end) {
        for (unsigned short* p16lineEnd = p16 + width; p16 < p16lineEnd; )
            *p16++ = convert32To16(*p32++);

        if (skips)
            *p16++ = 0;
    }

    if (m_hbitmap)
        m_hbitmap = nullptr;
    else
        m_pixelData = newPixelData.release();

    m_pixels = newPixels;
    m_bmpInfo = newBmpInfo;

    setHasAlpha(false);
    return true;
}
开发者ID:3163504123,项目名称:phantomjs,代码行数:43,代码来源:SharedBitmap.cpp

示例10: RenderFrame

void UtilTest::RenderFrame()
{
    int res;

    // Create a blank bitmap
    static Bitmap *bm = NULL;
    if (!bm) {
        BitmapInfo bi;
        bi.SetWidth(320);
        bi.SetHeight(200);
        bi.SetType(BMM_TRUE_64);
        bi.SetFlags(MAP_HAS_ALPHA);
        bi.SetAspect(1.0f);
        bm = TheManager->Create(&bi);
    }

    // Get the active viewport to render

    // Display the bitmap
    bm->Display(_T("Test"));

    // Open up the renderer, render a frame and close it.
    res = ip->OpenCurRenderer(NULL,ip->GetActiveViewExp().ToPointer());
    res = ip->CurRendererRenderFrame(
              ip->GetTime(),bm);
    ip->CloseCurRenderer();

    // We're done with the viewport.

}
开发者ID:innovatelogic,项目名称:ilogic-vm,代码行数:30,代码来源:utiltest.cpp

示例11: ICalcFrame

int plLayerTex::ICalcFrame(TimeValue t)
{
    PBBitmap *pbbm = fBitmapPB->GetBitmap(kBmpBitmap);
    if (!pbbm || !pbbm->bi)
        return 0;
    BitmapInfo *bi = pbbm->bi;

    TimeValue tm, dur, td;
    int frameStart = bi->FirstFrame();
    int frameEnd = bi->LastFrame();
    int tpf = GetTicksPerFrame();
    tm = TimeValue(float(t - startTime) * pbRate);
    dur = (fend-fstart+1)*GetTicksPerFrame();

    switch (endCond)
    {
    case END_HOLD:
        if (tm <= 0)
            return frameStart;
        if (tm >= dur)
            return frameEnd;
        return tm/tpf;

    case END_PINGPONG:
        if (((tm >= 0) && ((tm / dur) & 1)) || ((tm < 0) && !(tm / dur)))
        {
            td = modt(tm, dur);
            return frameStart + frameEnd - td / tpf;
        }
    // else fall through
    case END_LOOP:
        td = modt(tm, dur);
        return td / tpf;
    }

    return 0;
}
开发者ID:MareinK,项目名称:Plasma,代码行数:37,代码来源:plLayerTex.cpp

示例12: AllocMap

int PlateMap::AllocMap(int w, int h) {
	if ( bm && w==bm->Width() && h==bm->Height())
		return 1;
	BitmapInfo bi;
	if (bm) bm->DeleteThis();
	bi.SetName(_T(""));
	bi.SetWidth(w);
	bi.SetHeight(h);
	bi.SetType(BMM_TRUE_32);
	bi.SetCustomFlag(BMM_CUSTOM_GAMMA);
	bi.SetCustomGamma(1.0f);

	bm = TheManager->Create(&bi);

//	bm->CreateChannels(BMM_CHAN_Z); 
	return 1;
	}
开发者ID:artemeliy,项目名称:inf4715,代码行数:17,代码来源:plate.cpp

示例13: GetCOREInterface

void    plStaticEnvLayer::RenderCubicMap( INode *node )
{
    int         res, size;
    BOOL        success = 0;
    TSTR        fname, fullname;
    Bitmap      *bm = NULL;
    TSTR        path, filename, ext, thisFilename;
    BitmapInfo  biOutFile;

    static TCHAR    suffixes[ 6 ][ 4 ] = { "_FR", "_BK", "_LF", "_RT", "_UP", "_DN" };


    Interface *ip = GetCOREInterface();
    size = fBitmapPB->GetInt( kBmpTextureSize, ip->GetTime() );
    if( size <= 0 ) 
    {
        return;
    }

    thisFilename = fBitmapPB->GetStr( kBmpBaseFilename, ip->GetTime() );
    if( thisFilename.isNull() )
    {
        return;
    }

    SplitFilename( thisFilename, &path, &filename, &ext );

    BOOL    wasHid = node->IsNodeHidden();
    node->Hide( TRUE );

    // Create a blank bitmap
    biOutFile.SetWidth( size );
    biOutFile.SetHeight( size );
    biOutFile.SetType( BMM_TRUE_64 );
    biOutFile.SetAspect( 1.0f );
    biOutFile.SetCurrentFrame( 0 );
    bm = TheManager->Create( &biOutFile );

    Matrix3 nodeTM = node->GetNodeTM( ip->GetTime() );
    Matrix3 tm; 
    INode *root = ip->GetRootNode();        
    bm->Display( GetString( IDS_CUBIC_RENDER_TITLE ) );

    /// Set up rendering contexts
    ViewParams vp;
    vp.projType = PROJ_PERSPECTIVE;
    vp.hither = .001f;
    vp.yon = 1.0e30f;
    vp.fov = M_PI/2.0f;
    if( fBitmapPB->GetInt( kBmpUseMAXAtmosphere ) )
    {
        vp.nearRange = 0;
        vp.farRange = fBitmapPB->GetFloat( kBmpFarDistance );
    }
    else
    {
        vp.nearRange = vp.farRange = 1.0e30f;
    }
    BOOL    saveUseEnvMap = ip->GetUseEnvironmentMap();
    ip->SetUseEnvironmentMap( false );

    res = ip->OpenCurRenderer( &vp ); 
    for( int i = 0; i < 6; i++ )
    {
        tm = IGetViewTM( i );
        tm.PreTranslate( -nodeTM.GetTrans() ); 
        vp.affineTM = tm;

        // Construct filename
        thisFilename.printf( _T( "%s\\%s%s%s" ), path, filename, suffixes[ i ], ext );

        res = ip->CurRendererRenderFrame( ip->GetTime(), bm, NULL, 1.0f, &vp );
        if( !res ) 
            goto fail;

        if( !IWriteBM( &biOutFile, bm, thisFilename ) ) 
            goto fail;
    }

    success = 1;
fail:
    ip->CloseCurRenderer(); 
    ip->SetUseEnvironmentMap( saveUseEnvMap );

    bm->DeleteThis();
    node->Hide( wasHid );
    if( success )
    {
        for(int i = 0; i < 6; i++ )
        {
            BitmapInfo  bi;
            thisFilename.printf( _T( "%s\\%s%s%s" ), path, filename, suffixes[ i ], ext );
            bi.SetName( thisFilename );

            PBBitmap    pbBitmap( bi );
            fBitmapPB->SetValue( kBmpFrontBitmap + i, ip->GetTime(), &pbBitmap );
        }
        fBitmapPB->GetMap()->UpdateUI( ip->GetTime() );
    }
}
开发者ID:Asteral,项目名称:Plasma,代码行数:100,代码来源:plStaticEnvLayer.cpp

示例14: GetPBBitmap

BOOL plPlasmaMAXLayer::HandleBitmapSelection(int index /* = 0 */)
{
    static ICustButton* bmSelectBtn;

    PBBitmap *pbbm = GetPBBitmap( index );

#ifdef MAXASS_AVAILABLE
    MaxAssInterface* maxAssInterface = GetMaxAssInterface();
#endif
    
    // If the control key is held, we want to get rid of this texture
    if ((GetKeyState(VK_CONTROL) & 0x8000) && pbbm != nil)
    {
        char msg[512];
        sprintf(msg, "Are you sure you want to change this bitmap from %s to (none)?", pbbm->bi.Name());
        if (hsMessageBox(msg, "Remove texture?", hsMessageBoxYesNo) == hsMBoxYes)
        {
            SetBitmap(nil, index);
            return TRUE;
        }
        return FALSE;
    }
    // if we have the assetman plug-in, then try to use it, unless shift is held down
#ifdef MAXASS_AVAILABLE
    else if(maxAssInterface && !(GetKeyState(VK_SHIFT) & 0x8000))
    {
        jvUniqueId assetId;
        GetBitmapAssetId(assetId, index);

        char filename[MAX_PATH];
        if (maxAssInterface->OpenBitmapDlg(assetId, filename, sizeof(filename)))
        {
            SetBitmapAssetId(assetId, index);

            BitmapInfo bi;
            bi.SetName(filename);
            SetBitmap(&bi, index);
            return TRUE;
        }
    }
#endif
    else
    {
        BitmapInfo bi;
        if( pbbm != NULL )
            bi.SetName( pbbm->bi.Name() );

        BOOL selectedNewBitmap = TheManager->SelectFileInput(&bi,
                                                            GetCOREInterface()->GetMAXHWnd(),
                                                            _T("Select Bitmap Image File"));
        if (selectedNewBitmap)
        {
#ifdef MAXASS_AVAILABLE
            // Set the assetId to empty so our new, unmanaged texture will take
            jvUniqueId emptyId;
            SetBitmapAssetId(emptyId, index);
#endif

            SetBitmap(&bi, index);
            return TRUE;
        }
    }

    return FALSE;
}
开发者ID:Drakesinger,项目名称:Plasma,代码行数:65,代码来源:plPlasmaMAXLayer.cpp

示例15: hsGuardBegin

plLayerInterface    *plLayerConverter::IConvertStaticEnvLayer( plPlasmaMAXLayer *layer, 
                                                                plMaxNode *maxNode, uint32_t blendFlags, 
                                                                bool preserveUVOffset, bool upperLayer )
{
    hsGuardBegin( "plLayerConverter::IConvertStaticEnvLayer" );

    IParamBlock2        *bitmapPB;
    plLocation          loc;

    loc = maxNode->GetLocation();
    bitmapPB = layer->GetParamBlockByID( plStaticEnvLayer::kBlkBitmap );
    
    if( !bitmapPB )
    {
        fErrorMsg->Set( !bitmapPB, "Plasma Layer Error", "Bitmap paramblock for Plasma Layer not found" ).Show();
        fErrorMsg->Set();
        return nil;
    }

    // Get a new layer to play with
    plLayer *plasmaLayer = ICreateLayer( plString::FromUtf8( layer->GetName() ), upperLayer, loc );

    // Get the texture info
    PBBitmap *pbbm = bitmapPB->GetBitmap( plStaticEnvLayer::kBmpFrontBitmap + 0 );
    BitmapInfo *bi = nil;
    if( pbbm )
        bi = &pbbm->bi;

    // If the texture had bad info, assert and return the empty layer
    if (!bi || !bi->Name() || !strcmp(bi->Name(), ""))
    {
        // Or don't assert since it can get annoying when you are using someone
        // elses file and don't have all the textures.
        return (plLayerInterface *)plasmaLayer;
    }

    // Setup the texture creation parameters
    plBitmapData bd;
    bd.fileName = bi->Name();

    // Create texture and add it to list if unique
    int32_t texFlags = 0;

    // Texture Alpha/Color
    if( bitmapPB->GetInt( plStaticEnvLayer::kBmpInvertColor ) )
        plasmaLayer->SetBlendFlags( plasmaLayer->GetBlendFlags() | hsGMatState::kBlendInvertColor );
    if( bitmapPB->GetInt( plStaticEnvLayer::kBmpDiscardColor ) )
        plasmaLayer->SetBlendFlags( plasmaLayer->GetBlendFlags() | hsGMatState::kBlendNoTexColor );
    if( bitmapPB->GetInt( kBmpDiscardAlpha ) )
        plasmaLayer->SetBlendFlags( plasmaLayer->GetBlendFlags() | hsGMatState::kBlendNoTexAlpha );
    if( bitmapPB->GetInt( plStaticEnvLayer::kBmpInvertAlpha ) )
        bd.invertAlpha = true;

    // Texture quality
    if( bitmapPB->GetInt( plStaticEnvLayer::kBmpNonCompressed ) )
        texFlags |= plBitmap::kForceNonCompressed;

    switch( bitmapPB->GetInt( plStaticEnvLayer::kBmpScaling ) )
    {
        case plStaticEnvLayer::kScalingHalf: texFlags |= plBitmap::kHalfSize;  break;
        case plStaticEnvLayer::kScalingNone: texFlags |= plBitmap::kNoMaxSize; break;
    }

    bd.texFlags = texFlags;
    bd.isStaticCubicEnvMap = true;
    for( int i = 0; i < 6; i++ )
    {
        PBBitmap *face = bitmapPB->GetBitmap( plStaticEnvLayer::kBmpFrontBitmap + i );
        if( !face )
            return (plLayerInterface *)plasmaLayer;
        bd.faceNames[ i ] = face->bi.Name();
    }

    // Get detail parameters
    if( bitmapPB->GetInt( plStaticEnvLayer::kBmpUseDetail ) )
    {                                           // TODO: be smarter
        if( blendFlags & hsGMatState::kBlendAdd )
            bd.createFlags = plMipmap::kCreateDetailAdd;
        else if( blendFlags & hsGMatState::kBlendMult )
            bd.createFlags = plMipmap::kCreateDetailMult;
        else
            bd.createFlags = plMipmap::kCreateDetailAlpha;

        bd.detailDropoffStart = float( bitmapPB->GetInt( plStaticEnvLayer::kBmpDetailStartSize ) ) / 100.f;
        bd.detailDropoffStop = float( bitmapPB->GetInt( plStaticEnvLayer::kBmpDetailStopSize ) ) / 100.f;
        bd.detailMax = float( bitmapPB->GetInt( plStaticEnvLayer::kBmpDetailStartOpac ) ) / 100.f;
        bd.detailMin = float( bitmapPB->GetInt( plStaticEnvLayer::kBmpDetailStopOpac ) ) / 100.f;
    }

    /// Since we're a cubic environMap, we don't care about the UV transform nor the uvwSrc
    plasmaLayer->SetUVWSrc( 0 );
    plasmaLayer->SetUVWSrc( plasmaLayer->GetUVWSrc() | plLayerInterface::kUVWReflect );

    // Create the texture.  If it works, assign it to the layer
    if( ( plasmaLayer = IAssignTexture( &bd, maxNode, plasmaLayer, upperLayer ) ) == nil )
        return nil;

    // Tag this layer as reflective cubic environmentmapping
    if( bitmapPB->GetInt(plStaticEnvLayer::kBmpRefract) )
        plasmaLayer->SetMiscFlags( plasmaLayer->GetMiscFlags() | hsGMatState::kMiscUseRefractionXform );
//.........这里部分代码省略.........
开发者ID:v1nc3ntm,项目名称:Plasma,代码行数:101,代码来源:plLayerConverter.cpp


注:本文中的BitmapInfo类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。