bool CEngine::OnAcquire(HWND Hw){ if(!Dev.Acquire(Hw,1024,768)) return false; if(!Ver.Acquire(100)) return false; if(!Tex.Acquire(256,256)) return false; Tex.Fill(CRect(0,0,256,256),CColor(255,0,255)); CTextureMap Map; Map.Acquire(256,256,8,8); CLoadResult R=lrOk; while(R!=lrNoSpace) { int Ran=rand()%3; switch(Ran) { case 0: R=LoadBGR("C:\\tex1.bgr",Map); break; case 1: R=LoadBGR("C:\\tex2.bgr",Map); break; case 2: R=LoadBGR("C:\\tex3.bgr",Map); break; } if(R==lrFileFailed) return false; } if(!Tex.SaveBGR("C:\\texture.bgr")) return false; return true;}
The texture is filled with pink before the images are loaded for the purposes of confirming this all works okay. The 7x6 images create a small wastage since the smallest cell size is 8x8, but the texture mapper can be configured to any cell size so this wastage could be reduced if needed, at the expense of a larger array and longer search times.
I've just implemented it as a bool array for now since it is a temporary object that is destroyed once the initialisation is finished. I can see an argument for implementing it with a bit for each cell, but I'm not going to bother about that at the moment.
The next step is to write some kind of function that will open and load my multiple image .spr files and figure out a nice tidy way of returning and storing the tu and tv co-ordinates for each image.
But, good progress anyway.
And actually, you just reminded me that its probably prudent to test NxM textures instead of just NxN's in such a system. Hrrh.