Ejemplo n.º 1
0
        MaterialTextures ConfigureTextureProperties(SiTexturingProperty ntp)
        {
            var tp = new MaterialTextures();

            if (ntp.TextureCount < 1)
            {
                return(tp);
            }
            if (ntp.BaseTexture != null)
            {
                var src = (SiSourceTexture)_file.Blocks[ntp.BaseTexture.Source.Value]; tp.MainFilePath = src.FilePath;
            }
            if (ntp.DarkTexture != null)
            {
                var src = (SiSourceTexture)_file.Blocks[ntp.DarkTexture.Source.Value]; tp.DarkFilePath = src.FilePath;
            }
            if (ntp.DetailTexture != null)
            {
                var src = (SiSourceTexture)_file.Blocks[ntp.DetailTexture.Source.Value]; tp.DetailFilePath = src.FilePath;
            }
            if (ntp.GlossTexture != null)
            {
                var src = (SiSourceTexture)_file.Blocks[ntp.GlossTexture.Source.Value]; tp.GlossFilePath = src.FilePath;
            }
            if (ntp.GlowTexture != null)
            {
                var src = (SiSourceTexture)_file.Blocks[ntp.GlowTexture.Source.Value]; tp.GlowFilePath = src.FilePath;
            }
            if (ntp.BumpMapTexture != null)
            {
                var src = (SiSourceTexture)_file.Blocks[ntp.BumpMapTexture.Source.Value]; tp.BumpFilePath = src.FilePath;
            }
            return(tp);
        }
Ejemplo n.º 2
0
        MaterialProps SiAVObjectPropertiesToMaterialProperties(SiAVObject obj)
        {
            // Find relevant properties.
            SiTexturingProperty texturingProperty = null;

            foreach (var propRef in obj.Properties)
            {
                var prop = _file.Blocks[propRef.Value];
                if (prop is SiTexturingProperty)
                {
                    texturingProperty = (SiTexturingProperty)prop;
                }
            }

            // Create the material properties.
            var mp = new MaterialProps();

            // Apply textures.
            if (texturingProperty != null)
            {
                mp.Textures = ConfigureTextureProperties(texturingProperty);
            }
            return(mp);
        }