SubSection() public method

public SubSection ( string name ) : TdfParser.Section,
name string
return TdfParser.Section,
Beispiel #1
0
        List <MapTextureStage> LoadTextureStages(string sm3directory, TdfParser.Section terrainsection)
        {
            int numstages = terrainsection.GetIntValue("numtexturestages");
            List <MapTextureStage> stages = new List <MapTextureStage>();

            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;
                ITexture texture = LoadTexture(sm3directory, terrainsection, texturename, out tilesize);
                if (operation == "blend")
                {
                    ITexture blendtexture = LoadTextureAsAlpha(sm3directory, terrainsection, blendertexturename);
                    stages.Add(new MapTextureStage(MapTextureStage.OperationType.Blend, tilesize, texture, blendtexture));
                }
                else // todo: add other operations
                {
                    stages.Add(new MapTextureStage(MapTextureStage.OperationType.Replace, tilesize, texture));
                }
            }
            Terrain.GetInstance().texturestages = stages;
            return(stages);
        }
Beispiel #2
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);
        }
Beispiel #3
0
        ITexture LoadTextureAsAlpha(string sm3directory, TdfParser.Section terrainsection, string texturesectionname)
        {
            TdfParser.Section texturesection = terrainsection.SubSection(texturesectionname);
            string            texturename    = Path.Combine(sm3directory, texturesection.GetStringValue("file"));

            LogFile.GetInstance().WriteLine(texturename);
            return(GlTexture.FromAlphamapFile(texturename));
        }
Beispiel #4
0
        ITexture LoadTexture(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.GetInstance().WriteLine(texturename);
            tilesize = texturesection.GetIntValue("tilesize");
            return(GlTexture.FromFile(texturename));
        }
Beispiel #5
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);
        }
Beispiel #6
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);
        }