我正在创建一个位图并将其设置为对象的漫反射图。我使用 Bitmap 和 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());