예제 #1
0
        protected bool CreateTextureParameter( FBXImporter.Material _Material, string _PropertyName, Scene.Materials.MaterialParameters _MaterialParameters, string _ParameterName, string _OpacityPropertyName )
        {
            FBXImporter.ObjectProperty	Property = _Material.FindProperty( _PropertyName );
            if ( Property == null )
                return false;	// No such property...
            if ( Property.Textures.Length == 0 )
                return false;	// That property has no texture...

            // Check for opacity
            string	OpacityTextureRelativeFileName = null;
            if ( _OpacityPropertyName != null )
            {
                FBXImporter.ObjectProperty	OpacityProperty = _Material.FindProperty( _OpacityPropertyName );
                if ( OpacityProperty != null && OpacityProperty.Textures.Length != 0 )
                    OpacityTextureRelativeFileName = OpacityProperty.Textures[0].RelativeFileName;
            }

            // Create the parameter with that texture
            Scene.Materials.Texture2D	Tex = m_Scene.CreateTexture( Property.Textures[0].RelativeFileName, OpacityTextureRelativeFileName, Property.Textures[0].UseMipMap );
            _MaterialParameters.CreateParameter( _ParameterName, Scene.Materials.MaterialParameters.PARAMETER_TYPE.TEXTURE2D ).AsTexture2D.Value = Tex;

            return true;
        }