在3ds max sdk中创建RGB888格式的位图

时间:2014-09-01 06:16:40

标签: bitmap rgb 3dsmax rgba 3ds

我正在创建一个位图并将其设置为对象的漫反射贴图。 我使用Bitmap和BitmapInfo类从图像缓冲区创建位图。位图保存到文件中,此bitmapInfo用于设置对象的漫反射贴图。 但是我需要支持没有alpha的RGB888格式。 现在我只支持RGBA8888格式。

如何在3ds max sdk中仅使用RGB通道创建位图?

目前使用的代码段如下所示。

//creating BitmapInfo 
BitmapInfo bi;
bi.SetType( BMM_TRUE_32 );
bi.SetFlags( MAP_HAS_ALPHA );
bi.SetWidth( (WORD)width);
bi.SetHeight( (WORD)height);
bi.SetCustomFlag( 0 );
bi.SetPath(filename);

Bitmap cust_bmap;
cust_bmap = TheManager->Create(&bi);

for(int i=0;i<height;i++)
{
std::vector<BMM_Color_fl> pixelscheck( width );
//fill pixelscheck for each row 
cust_bmap->PutPixels( 0, i, width , &pixelscheck[0] )
}

FILE* file = _wfopen(filename,_T("wb"));
if (!file)
{
return ;
}

cust_bmap->OpenOutput(&bi);`enter code here`

cust_bmap->Write(&bi, BMM_SINGLEFRAME);
cust_bmap->Close(&bi);
fclose(file);

//apply it to BitmapTex
bitmaptex->SetMap(bi.GetAsset());

0 个答案:

没有答案