23 void Print(
const char* fmt, ...);
27 #define RELEASE(x) if (x) { x->Release(); x=NULL; }
33 : video(v), texture(0)
35 d3d = video->Direct3D();
36 d3ddevice = video->D3DDevice();
38 for (
int i = 0; i < 6; i++) {
54 if (!d3ddevice)
return false;
56 if (faces[face_index] == bmp && last_modified[face_index] >= bmp->
LastModified())
63 hr = d3ddevice->CreateCubeTexture(bmp->
Width(),
71 if (FAILED(hr) || !texture) {
72 VideoDX9Error(
"LoadTexture - could not create cube texture", hr);
78 D3DLOCKED_RECT locked_rect;
79 D3DCUBEMAP_FACES face = (D3DCUBEMAP_FACES) face_index;
80 hr = texture->LockRect(face, 0, &locked_rect, 0, 0);
83 VideoDX9Error(
"LoadTexture - could not lock texture surface", hr);
89 for (
int i = 0; i < bmp->
Height(); i++) {
91 BYTE* dst = (BYTE*) locked_rect.pBits + i * locked_rect.Pitch;
93 CopyMemory(dst, src, bmp->
Width() *
sizeof(
Color));
97 texture->UnlockRect(face, 0);
99 faces[face_index] = bmp;
107 IDirect3DCubeTexture9*
112 for (
int i = 0; i < 6; i++) {
113 if (faces[i] && last_modified[i] < faces[i]->LastModified()) {