MCPcopy Create free account
hub / github.com/OGRECave/ogre / writeTextureUnit

Method writeTextureUnit

OgreMain/src/OgreMaterialSerializer.cpp:822–1125  ·  view source on GitHub ↗

-----------------------------------------------------------------------

Source from the content-addressed store, hash-verified

820 }
821 //-----------------------------------------------------------------------
822 void MaterialSerializer::writeTextureUnit(const TextureUnitState *pTex)
823 {
824 bool skipWriting = false;
825
826 // Fire pre-write event.
827 fireTextureUnitStateEvent(MSE_PRE_WRITE, skipWriting, pTex);
828 if (skipWriting)
829 return;
830
831 LogManager::getSingleton().logMessage("MaterialSerializer : parsing texture layer.", LML_NORMAL);
832 mBuffer += "\n";
833 writeAttribute(3, "texture_unit");
834 // only write out name if its not equal to the default name
835 if (pTex->getName() != StringConverter::toString(pTex->getParent()->getTextureUnitStateIndex(pTex)))
836 writeValue(quoteWord(pTex->getName()));
837
838 beginSection(3);
839 {
840 // Fire write begin event.
841 fireTextureUnitStateEvent(MSE_WRITE_BEGIN, skipWriting, pTex);
842
843 OGRE_IGNORE_DEPRECATED_BEGIN
844 // texture_alias
845 if (!pTex->getTextureNameAlias().empty() && pTex->getTextureNameAlias() != pTex->getName())
846 {
847 writeAttribute(4, "texture_alias");
848 writeValue(quoteWord(pTex->getTextureNameAlias()));
849 }
850 OGRE_IGNORE_DEPRECATED_END
851
852 //texture name
853 if (pTex->getNumFrames() == 1 && !pTex->getTextureName().empty())
854 {
855 writeAttribute(4, "texture");
856 writeValue(quoteWord(pTex->getTextureName()));
857
858 switch (pTex->getTextureType())
859 {
860 case TEX_TYPE_1D:
861 writeValue("1d");
862 break;
863 case TEX_TYPE_2D:
864 // nothing, this is the default
865 break;
866 case TEX_TYPE_2D_ARRAY:
867 writeValue("2darray");
868 break;
869 case TEX_TYPE_3D:
870 writeValue("3d");
871 break;
872 case TEX_TYPE_CUBE_MAP:
873 writeValue("cubic");
874 break;
875 default:
876 break;
877 };
878
879 if (uint32(pTex->getNumMipmaps()) != TextureManager::getSingleton().getDefaultNumMipmaps())

Callers

nothing calls this directly

Calls 15

writeAttributeFunction · 0.85
writeValueFunction · 0.85
quoteWordFunction · 0.85
convertTexAddressModeFunction · 0.85
endSectionFunction · 0.85
getNumFramesMethod · 0.80
getTextureTypeMethod · 0.80
getNumMipmapsMethod · 0.80
getDesiredFormatMethod · 0.80
getAnimationDurationMethod · 0.80
getTextureCoordSetMethod · 0.80

Tested by

no test coverage detected