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

Method LoadFaceFromMemory

src/Nazara/Renderer/Texture.cpp:750–787  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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 {

Callers

nothing calls this directly

Calls 4

ConvertMethod · 0.80
LoadFromMemoryMethod · 0.45
GetWidthMethod · 0.45
GetHeightMethod · 0.45

Tested by

no test coverage detected