| 748 | } |
| 749 | |
| 750 | bool Texture::LoadFaceFromMemory(CubemapFace face, const void* data, std::size_t size, const ImageParams& params) |
| 751 | { |
| 752 | #if NAZARA_RENDERER_SAFE |
| 753 | if (!m_impl) |
| 754 | { |
| 755 | NazaraError("Texture must be valid"); |
| 756 | return false; |
| 757 | } |
| 758 | |
| 759 | if (m_impl->type != ImageType_Cubemap) |
| 760 | { |
| 761 | NazaraError("Texture must be a cubemap"); |
| 762 | return false; |
| 763 | } |
| 764 | #endif |
| 765 | |
| 766 | Image image; |
| 767 | if (!image.LoadFromMemory(data, size, params)) |
| 768 | { |
| 769 | NazaraError("Failed to load image"); |
| 770 | return false; |
| 771 | } |
| 772 | |
| 773 | if (!image.Convert(m_impl->format)) |
| 774 | { |
| 775 | NazaraError("Failed to convert image to texture format"); |
| 776 | return false; |
| 777 | } |
| 778 | |
| 779 | unsigned int faceSize = m_impl->width; |
| 780 | if (image.GetWidth() != faceSize || image.GetHeight() != faceSize) |
| 781 | { |
| 782 | NazaraError("Image size must match texture face size"); |
| 783 | return false; |
| 784 | } |
| 785 | |
| 786 | return Update(image, Rectui(0, 0, faceSize, faceSize), face); |
| 787 | } |
| 788 | |
| 789 | bool Texture::LoadFaceFromStream(CubemapFace face, Stream& stream, const ImageParams& params) |
| 790 | { |
nothing calls this directly
no test coverage detected