Пример #1
0
        List<MapTextureStageModel> LoadTextureStages(string sm3directory, TdfParser.Section terrainsection)
        {
            int numstages = terrainsection.GetIntValue("numtexturestages");
            List<MapTextureStageModel> stages = new List<MapTextureStageModel>();
            TerrainModel terrainmodel = MetaverseClient.GetInstance().worldstorage.terrainmodel;
            for (int i = 0; i < numstages; i++)
            {
                TdfParser.Section texstagesection = terrainsection.SubSection("texstage" + i);
                string texturename = texstagesection.GetStringValue("source");
                string blendertexturename = texstagesection.GetStringValue("blender");
                string operation = texstagesection.GetStringValue("operation").ToLower();

                int tilesize;
                ImageWrapper splattexture = LoadSplatTexture( sm3directory, terrainsection, texturename, out tilesize );
                if (operation == "blend")
                {
                    ImageWrapper blendtexture = LoadBlendTexture( sm3directory, terrainsection, blendertexturename);
                    stages.Add( new MapTextureStageModel(MapTextureStageModel.OperationType.Blend, tilesize, splattexture, blendtexture) );
                }
                else // todo: add other operations
                {
                    stages.Add( new MapTextureStageModel(MapTextureStageModel.OperationType.Replace, tilesize, splattexture ) );
                }
            }
            terrainmodel.texturestages = stages;
            return stages;
        }
Пример #2
0
 ImageWrapper LoadBlendTexture( string sm3directory, TdfParser.Section terrainsection, string texturesectionname )
 {
     TdfParser.Section texturesection = terrainsection.SubSection(texturesectionname);
     string texturename = Path.Combine( sm3directory, texturesection.GetStringValue("file") );
     LogFile.WriteLine(texturename);
     return new ImageWrapper( texturename );
     //return GlTexture.FromAlphamapFile(texturename);
 }
Пример #3
0
 ImageWrapper LoadSplatTexture( string sm3directory, TdfParser.Section terrainsection, string texturesectionname, out int tilesize )
 {
     TdfParser.Section texturesection = terrainsection.SubSection(texturesectionname);
     string texturename = Path.Combine( sm3directory, texturesection.GetStringValue("file") );
     LogFile.WriteLine(texturename);
     tilesize = texturesection.GetIntValue("tilesize");
     ImageWrapper splattexture = new ImageWrapper( texturename );
     return splattexture;
     //return GlTexture.FromFile(texturename);
 }