| 1111 | } |
| 1112 | |
| 1113 | bool Image::LoadFaceFromFile(CubemapFace face, const String& filePath, const ImageParams& params) |
| 1114 | { |
| 1115 | NazaraAssert(IsValid() && IsCubemap(), "Texture must be a valid cubemap"); |
| 1116 | |
| 1117 | Image image; |
| 1118 | if (!image.LoadFromFile(filePath, params)) |
| 1119 | { |
| 1120 | NazaraError("Failed to load image"); |
| 1121 | return false; |
| 1122 | } |
| 1123 | |
| 1124 | if (!image.Convert(GetFormat())) |
| 1125 | { |
| 1126 | NazaraError("Failed to convert image to texture format"); |
| 1127 | return false; |
| 1128 | } |
| 1129 | |
| 1130 | unsigned int faceSize = GetWidth(); |
| 1131 | if (image.GetWidth() != faceSize || image.GetHeight() != faceSize) |
| 1132 | { |
| 1133 | NazaraError("Image size must match texture face size"); |
| 1134 | return false; |
| 1135 | } |
| 1136 | |
| 1137 | Copy(image, Rectui(0, 0, faceSize, faceSize), Vector3ui(0, 0, face)); |
| 1138 | return true; |
| 1139 | } |
| 1140 | |
| 1141 | bool Image::LoadFaceFromMemory(CubemapFace face, const void* data, std::size_t size, const ImageParams& params) |
| 1142 | { |
no test coverage detected