GetStringValue() public method

public GetStringValue ( string name ) : string
name string
return string
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 3
0
        void LoadHeightMap(string sm3directory, TdfParser.Section terrainsection)
        {
            string filename     = Path.Combine(sm3directory, terrainsection.GetStringValue("heightmap"));
            double heightoffset = terrainsection.GetDoubleValue("heightoffset");
            double heightscale  = terrainsection.GetDoubleValue("heightscale");

            LogFile.GetInstance().WriteLine("heightoffset: " + heightoffset + " heightscale " + heightscale);
            Terrain.GetInstance().MinHeight = heightoffset;
            Terrain.GetInstance().MaxHeight = heightoffset + heightscale; // I guess???

            Image image = new Image(filename);
            //Bitmap bitmap = DevIL.DevIL.LoadBitmap(filename);
            int width  = image.Width;
            int height = image.Height;

            Terrain.GetInstance().HeightMapWidth  = width;
            Terrain.GetInstance().HeightMapHeight = height;
            Terrain.GetInstance().Map             = new double[width, height];
            LogFile.GetInstance().WriteLine("loaded bitmap " + width + " x " + height);
            double minheight        = Terrain.GetInstance().MinHeight;
            double maxheight        = Terrain.GetInstance().MaxHeight;
            double heightmultiplier = (maxheight - minheight) / 255;

            LogFile.GetInstance().WriteLine("heightmultiplier: " + heightmultiplier + " minheight: " + minheight);
            for (int i = 0; i < width; i++)
            {
                for (int j = 0; j < height; j++)
                {
                    Terrain.GetInstance().Map[i, j] =
                        (float)(minheight + heightmultiplier *
                                image.GetBlue(i, j));
                }
            }
            terrain.HeightmapFilename = filename;
        }
Ejemplo n.º 4
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));
        }
Ejemplo n.º 5
0
        public bool LoadMod(string modfile)
        {
            this.modfilename = modfile;
            TdfParser parser1 = TdfParser.FromFile(modfile);

            if (parser1 != null)
            {
                TdfParser.Section section1 = parser1.RootSection.SubSection(@"AI\VALUES");
                if (section1 != null)
                {
                    foreach (string text1 in section1.Values.Keys)
                    {
                        string text2 = text1;
                        text2 = text2.ToLower();
                        text2 = text2.Trim();
                        this.units.Add(text2);
                        this.values[text2] = section1.GetDoubleValue(text1);
                    }
                }
                section1 = parser1.RootSection.SubSection(@"AI\NAMES");
                if (section1 != null)
                {
                    foreach (string text3 in section1.Values.Keys)
                    {
                        string text4 = text3;
                        text4 = text4.ToLower();
                        text4 = text4.Trim();
                        this.human_names[text4] = section1.GetStringValue(text3);
                    }
                }
                section1 = parser1.RootSection.SubSection(@"AI\DESCRIPTIONS");
                if (section1 != null)
                {
                    foreach (string text5 in section1.Values.Keys)
                    {
                        string text6 = text5;
                        text6 = text6.ToLower();
                        text6 = text6.Trim();
                        this.descriptions[text6] = section1.GetStringValue(text5);
                    }
                }
                this.units.Sort();
            }
            return(false);
        }
Ejemplo n.º 6
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));
        }
Ejemplo n.º 7
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);
        }
Ejemplo n.º 8
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);
        }