Example #1
0
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;
	}
Example #2
0
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;
	}
Example #3
0
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;
}
Example #4
0
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;
	}