| 994 | |
| 995 | |
| 996 | void Image::MultiSurfaceCreateAltCubemapPicture(const teList<tLayer> layers[tFaceIndex::tFaceIndex_NumFaces]) |
| 997 | { |
| 998 | tAssert(!layers[0].IsEmpty()); |
| 999 | int w = layers[0].First()->Width; |
| 1000 | int h = layers[0].First()->Height; |
| 1001 | AltPicture.Set(w*4, h*3, tPixel4b::transparent); |
| 1002 | |
| 1003 | // Cubemaps sides use a left-hand coordinate system with +Z facing the front and +Y up. We want the front (+Z) |
| 1004 | // to be the first image because it makes the most sense from a viewing perspective. In the tImage the sides |
| 1005 | // are loaded in the +X,-X,+Y,-Y,+Z,-Z order. We display in +Z,-Z,+X,-X,+Y,-Y order. |
| 1006 | const int numFaces = tFaceIndex_NumFaces; |
| 1007 | struct FaceInfo { int Face; int OriginX; int OriginY; }; |
| 1008 | FaceInfo faceInfo[numFaces] = |
| 1009 | { |
| 1010 | { tFaceIndex_PosZ, w, h }, |
| 1011 | { tFaceIndex_NegZ, 3*w, h }, |
| 1012 | { tFaceIndex_PosX, 2*w, h }, |
| 1013 | { tFaceIndex_NegX, 0, h }, |
| 1014 | { tFaceIndex_PosY, w, 2*h }, |
| 1015 | { tFaceIndex_NegY, w, 0 } |
| 1016 | }; |
| 1017 | |
| 1018 | for (int f = 0; f < int(tFaceIndex_NumFaces); f++) |
| 1019 | { |
| 1020 | int face = faceInfo[f].Face; |
| 1021 | int originX = faceInfo[f].OriginX; |
| 1022 | int originY = faceInfo[f].OriginY; |
| 1023 | |
| 1024 | tLayer* topMip = layers[face].First(); |
| 1025 | tAssert(topMip->PixelFormat == tPixelFormat::R8G8B8A8); |
| 1026 | for (int y = 0; y < topMip->Height; y++) |
| 1027 | for (int x = 0; x < topMip->Width; x++) |
| 1028 | AltPicture.SetPixel(originX + x, originY + y, topMip->GetPixel(x, y)); |
| 1029 | } |
| 1030 | AltPictureTyp = AltPictureType::CubemapTLayout; |
| 1031 | } |
| 1032 | |
| 1033 | |
| 1034 | void Image::MultiSurfaceCreateAltMipmapPicture(const teList<tLayer>& layers) |