public GetIntValue ( int defaultvalue, string name ) : int | ||
defaultvalue | int | |
name | string | |
return | int |
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); }
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); }
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)); }
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); }