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

Method writeTextureUnit

OgreMain/src/OgreMaterialSerializer.cpp:754–1064  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

752 }
753 //-----------------------------------------------------------------------
754 void MaterialSerializer::writeTextureUnit( const TextureUnitState *pTex )
755 {
756 bool skipWriting = false;
757
758 // Fire pre-write event.
759 fireTextureUnitStateEvent( MSE_PRE_WRITE, skipWriting, pTex );
760 if( skipWriting )
761 return;
762
763 LogManager::getSingleton().logMessage( "MaterialSerializer : parsing texture layer.",
764 LML_NORMAL );
765 mBuffer += "\n";
766 writeAttribute( 3, "texture_unit" );
767 // only write out name if its not equal to the default name
768 if( pTex->getName() !=
769 StringConverter::toString( pTex->getParent()->getTextureUnitStateIndex( pTex ) ) )
770 writeValue( quoteWord( pTex->getName() ) );
771
772 beginSection( 3 );
773 {
774 // Fire write begin event.
775 fireTextureUnitStateEvent( MSE_WRITE_BEGIN, skipWriting, pTex );
776
777 // texture_alias
778 if( !pTex->getTextureNameAlias().empty() )
779 {
780 writeAttribute( 4, "texture_alias" );
781 writeValue( quoteWord( pTex->getTextureNameAlias() ) );
782 }
783
784 // texture name
785 if( pTex->getNumFrames() == 1 && !pTex->getTextureName().empty() && !pTex->isCubic() )
786 {
787 writeAttribute( 4, "texture" );
788 writeValue( quoteWord( pTex->getTextureName() ) );
789
790 switch( pTex->getTextureType() )
791 {
792 case TextureTypes::Type1D:
793 writeValue( "1d" );
794 break;
795 case TextureTypes::Type2D:
796 // nothing, this is the default
797 break;
798 case TextureTypes::Type3D:
799 writeValue( "3d" );
800 break;
801 case TextureTypes::TypeCube:
802 // nothing, deal with this as cubic_texture since it copes with all variants
803 break;
804 default:
805 break;
806 };
807
808 if( pTex->getNumMipmaps() != 1u )
809 {
810 writeValue( StringConverter::toString( pTex->getNumMipmaps() ) );
811 }

Callers

nothing calls this directly

Calls 15

writeAttributeFunction · 0.85
writeValueFunction · 0.85
quoteWordFunction · 0.85
convertTexAddressModeFunction · 0.85
endSectionFunction · 0.85
getTextureNameMethod · 0.80
isCubicMethod · 0.80
getIsAlphaMethod · 0.80
getAnimationDurationMethod · 0.80

Tested by

no test coverage detected