-----------------------------------------------------------------------
| 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 | } |
nothing calls this directly
no test coverage detected