| 1139 | } |
| 1140 | |
| 1141 | bool Image::LoadFaceFromMemory(CubemapFace face, const void* data, std::size_t size, const ImageParams& params) |
| 1142 | { |
| 1143 | NazaraAssert(IsValid() && IsCubemap(), "Texture must be a valid cubemap"); |
| 1144 | |
| 1145 | Image image; |
| 1146 | if (!image.LoadFromMemory(data, size, params)) |
| 1147 | { |
| 1148 | NazaraError("Failed to load image"); |
| 1149 | return false; |
| 1150 | } |
| 1151 | |
| 1152 | if (!image.Convert(GetFormat())) |
| 1153 | { |
| 1154 | NazaraError("Failed to convert image to texture format"); |
| 1155 | return false; |
| 1156 | } |
| 1157 | |
| 1158 | unsigned int faceSize = GetWidth(); |
| 1159 | if (image.GetWidth() != faceSize || image.GetHeight() != faceSize) |
| 1160 | { |
| 1161 | NazaraError("Image size must match texture face size"); |
| 1162 | return false; |
| 1163 | } |
| 1164 | |
| 1165 | Copy(image, Rectui(0, 0, faceSize, faceSize), Vector3ui(0, 0, face)); |
| 1166 | return true; |
| 1167 | } |
| 1168 | |
| 1169 | bool Image::LoadFaceFromStream(CubemapFace face, Stream& stream, const ImageParams& params) |
| 1170 | { |
nothing calls this directly
no test coverage detected