| 1167 | } |
| 1168 | |
| 1169 | bool Image::LoadFaceFromStream(CubemapFace face, Stream& stream, const ImageParams& params) |
| 1170 | { |
| 1171 | NazaraAssert(IsValid() && IsCubemap(), "Texture must be a valid cubemap"); |
| 1172 | |
| 1173 | Image image; |
| 1174 | if (!image.LoadFromStream(stream, params)) |
| 1175 | { |
| 1176 | NazaraError("Failed to load image"); |
| 1177 | return false; |
| 1178 | } |
| 1179 | |
| 1180 | if (!image.Convert(GetFormat())) |
| 1181 | { |
| 1182 | NazaraError("Failed to convert image to texture format"); |
| 1183 | return false; |
| 1184 | } |
| 1185 | |
| 1186 | unsigned int faceSize = GetWidth(); |
| 1187 | if (image.GetWidth() != faceSize || image.GetHeight() != faceSize) |
| 1188 | { |
| 1189 | NazaraError("Image size must match texture face size"); |
| 1190 | return false; |
| 1191 | } |
| 1192 | |
| 1193 | Copy(image, Rectui(0, 0, faceSize, faceSize), Vector3ui(0, 0, face)); |
| 1194 | return true; |
| 1195 | } |
| 1196 | |
| 1197 | bool Image::SaveToFile(const String& filePath, const ImageParams& params) |
| 1198 | { |
nothing calls this directly
no test coverage detected