MCPcopy Create free account
hub / github.com/NazaraEngine/NazaraEngine / LoadFaceFromStream

Method LoadFaceFromStream

src/Nazara/Renderer/Texture.cpp:789–827  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

787 }
788
789 bool Texture::LoadFaceFromStream(CubemapFace face, Stream& stream, const ImageParams& params)
790 {
791 #if NAZARA_RENDERER_SAFE
792 if (!m_impl)
793 {
794 NazaraError("Texture must be valid");
795 return false;
796 }
797
798 if (m_impl->type != ImageType_Cubemap)
799 {
800 NazaraError("Texture must be a cubemap");
801 return false;
802 }
803 #endif
804
805 Image image;
806 if (!image.LoadFromStream(stream, params))
807 {
808 NazaraError("Failed to load image");
809 return false;
810 }
811
812 if (!image.Convert(m_impl->format))
813 {
814 NazaraError("Failed to convert image to texture format");
815 return false;
816 }
817
818 unsigned int faceSize = m_impl->width;
819
820 if (image.GetWidth() != faceSize || image.GetHeight() != faceSize)
821 {
822 NazaraError("Image size must match texture face size");
823 return false;
824 }
825
826 return Update(image, Rectui(0, 0, faceSize, faceSize), face);
827 }
828
829 bool Texture::SaveToFile(const String& filePath, const ImageParams& params)
830 {

Callers

nothing calls this directly

Calls 4

ConvertMethod · 0.80
LoadFromStreamMethod · 0.45
GetWidthMethod · 0.45
GetHeightMethod · 0.45

Tested by

no test coverage detected