// pass a pointer to a heightmap // when rendered, x pos will be multiplied by xscale, and y points by yscale public RenderableHeightMap(TerrainView terrainview, TerrainModel terrainmodel, int xscale, int yscale ) { this.terrainmodel = terrainmodel; this.terrainview = terrainview; this.heightmap = terrainmodel.Map; width = heightmap.GetLength(0) - 1; height = heightmap.GetLength(1) - 1; this.xscale = xscale; this.yscale = yscale; //maptexturestageviews = terrainview.maptexturestageviews; maptexturestagemodels = terrainmodel.texturestages; // foreach (MapTextureStageView maptexturestageview in maptexturestageviews) // { // viewbymodel.Add( maptexturestageview.maptexturestagemodel, maptexturestageview ); //} CacheChunkTextureStageUsage(); normalsperquad = new Vector3[width, height]; terrain_HeightmapInPlaceEdited(0, 0, width - 1, height - 1); RendererFactory.GetInstance().WriteNextFrameEvent += new WriteNextFrameCallback(Render); terrainmodel.HeightmapInPlaceEdited += new TerrainModel.HeightmapInPlaceEditedHandler(terrain_HeightmapInPlaceEdited); terrainmodel.TerrainModified += new TerrainModel.TerrainModifiedHandler(terrain_TerrainModified); terrainmodel.BlendmapInPlaceEdited += new TerrainModel.BlendmapInPlaceEditedHandler(terrain_BlendmapInPlaceEdited); }
public WorldModel(NetReplicationController netreplicationcontroller) { this.netreplicationcontroller = netreplicationcontroller; entities = new List <Entity>(); netreplicationcontroller.RegisterReplicatedObjectController(this, typeof(Entity)); terrainmodel = new TerrainModel(); }
public TerrainView(TerrainModel terrainmodel) { LogFile.WriteLine("TerrainView( " + terrainmodel + ")"); this.terrainmodel = terrainmodel; terrainmodel.TerrainModified += new TerrainModel.TerrainModifiedHandler(terrainmodel_TerrainModified); GraphicsHelperGl g = new GraphicsHelperGl(); g.CheckError(); foreach (MapTextureStageModel maptexturestagemodel in terrainmodel.texturestages) { LogFile.WriteLine("create maptexturestageview for " + maptexturestagemodel); mapviewbymapmodel.Add(maptexturestagemodel, new MapTextureStageView(maptexturestagemodel)); } g.CheckError(); renderableheightmap = new RenderableHeightMap(this, terrainmodel, 1, 1); //renderableallfeatures = new RenderableAllFeatures(this); // water must be last, otherwise you cant see through it ;-) renderablewater = new RenderableWater(new Vector3(), new Vector2(terrainmodel.HeightMapWidth, terrainmodel.HeightMapHeight)); // minimap last, covers everything else //renderableminimap = new RenderableMinimap(this, renderableheightmap); }
public void ApplyBrush(IBrushShape brushshape, int brushsize, double brushcentre_x, double brushcentre_y, bool israising, double milliseconds) { TerrainModel terrain = MetaverseClient.GetInstance().worldstorage.terrainmodel; double[,] mesh = terrain.Map; int x = (int)(brushcentre_x); int y = (int)(brushcentre_y); double timemultiplier = milliseconds * speed; int meshsize = mesh.GetUpperBound(0) + 1; for (int i = -brushsize; i <= brushsize; i++) { for (int j = -brushsize; j <= brushsize; j++) { int thisx = x + i; int thisy = y + j; if (thisx >= 0 && thisy >= 0 && thisx < meshsize && thisy < meshsize) { double brushshapecontribution = brushshape.GetStrength((double)i / brushsize, (double)j / brushsize); if (brushshapecontribution > 0) { mesh[thisx, thisy] = mesh[thisx, thisy] + (mesh[x, y] - mesh[thisx, thisy]) * brushshapecontribution * timemultiplier / 50; } } } } terrain.OnHeightMapInPlaceEdited(x - brushsize, y - brushsize, x + brushsize, y + brushsize); }
// pass a pointer to a heightmap // when rendered, x pos will be multiplied by xscale, and y points by yscale public RenderableHeightMap(TerrainView terrainview, TerrainModel terrainmodel, int xscale, int yscale) { this.terrainmodel = terrainmodel; this.terrainview = terrainview; this.heightmap = terrainmodel.Map; width = heightmap.GetLength(0) - 1; height = heightmap.GetLength(1) - 1; this.xscale = xscale; this.yscale = yscale; //maptexturestageviews = terrainview.maptexturestageviews; maptexturestagemodels = terrainmodel.texturestages; // foreach (MapTextureStageView maptexturestageview in maptexturestageviews) // { // viewbymodel.Add( maptexturestageview.maptexturestagemodel, maptexturestageview ); //} CacheChunkTextureStageUsage(); normalsperquad = new Vector3[width, height]; terrain_HeightmapInPlaceEdited(0, 0, width - 1, height - 1); RendererFactory.GetInstance().WriteNextFrameEvent += new WriteNextFrameCallback(Render); terrainmodel.HeightmapInPlaceEdited += new TerrainModel.HeightmapInPlaceEditedHandler(terrain_HeightmapInPlaceEdited); terrainmodel.TerrainModified += new TerrainModel.TerrainModifiedHandler(terrain_TerrainModified); terrainmodel.BlendmapInPlaceEdited += new TerrainModel.BlendmapInPlaceEditedHandler(terrain_BlendmapInPlaceEdited); }
void GetDimensions() { TerrainModel terrain = MetaverseClient.GetInstance().worldstorage.terrainmodel; windowwidth = RendererFactory.GetInstance().WindowWidth; windowheight = RendererFactory.GetInstance().WindowHeight; mapwidth = terrain.MapWidth; mapheight = terrain.MapHeight; double mapheightwidthratio = terrain.MapHeight / terrain.MapWidth; minimapwidth = 0; minimapheight = 0; if (mapheightwidthratio > 1) { minimapheight = minimapsize; minimapwidth = (int)(minimapsize / mapheightwidthratio); } else { minimapwidth = minimapsize; minimapheight = (int)(minimapsize * mapheightwidthratio); } }
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); }
void terrainmodel_TerrainModified() { TerrainModel terrainmodel = MetaverseClient.GetInstance().worldstorage.terrainmodel; WorldBoundingBoxMin = new Vector3(0, 0, terrainmodel.MinHeight); WorldBoundingBoxMax = new Vector3(terrainmodel.MapWidth, terrainmodel.MapHeight, terrainmodel.MaxHeight); LogFile.WriteLine("PlayerMovement, new boundingbox " + WorldBoundingBoxMin + " < (x,y,z0 < " + WorldBoundingBoxMax); }
public RenderableMinimap(TerrainModel parent, RenderableHeightMap renderableheightmap) // note could upgrade this to use Isomething later, but Terrain works for now { this.parent = parent; this.renderableheightmap = renderableheightmap; Gl.glGenTextures(1, out minimaptexture); RendererSdl.GetInstance().WriteNextFrameEvent += new WriteNextFrameCallback(RenderableMinimap_WriteNextFrameEvent); }
// note could upgrade this to use Isomething later, but Terrain works for now public RenderableMinimap(TerrainModel parent, RenderableHeightMap renderableheightmap ) { this.parent = parent; this.renderableheightmap = renderableheightmap; Gl.glGenTextures(1, out minimaptexture); RendererSdl.GetInstance().WriteNextFrameEvent += new WriteNextFrameCallback(RenderableMinimap_WriteNextFrameEvent); }
void NewHeightMap(int heightmapwidth, int heightmapheight) { TerrainModel terrain = MetaverseClient.GetInstance().worldstorage.terrainmodel; terrain.HeightMapWidth = heightmapwidth; terrain.HeightMapHeight = heightmapheight; terrain.Map = new double[terrain.HeightMapWidth, terrain.HeightMapHeight]; terrain.HeightmapFilename = ""; terrain.OnTerrainModified(); }
public void Render(Vector3 intersectpos) { double radius = CurrentEditBrush.GetInstance().BrushSize; double displayradius = radius; TerrainModel terrain = MetaverseClient.GetInstance().worldstorage.terrainmodel; int numsegments = 16; // list four corner of square, in order List <Vector2> corners = new List <Vector2>(); corners.Add(new Vector2(-1, -1)); corners.Add(new Vector2(-1, 1)); corners.Add(new Vector2(1, 1)); corners.Add(new Vector2(1, -1)); Gl.glBegin(Gl.GL_LINE_LOOP); for (int i = 0; i < 4; i++) { Vector2 startcorner = corners[i]; Vector2 endcorner = corners[(i + 1) % 4]; double startx = intersectpos.x + startcorner.x * displayradius; double starty = intersectpos.y + startcorner.y * displayradius; startx = Math.Max(0, startx); startx = Math.Min(startx, terrain.MapWidth); starty = Math.Max(0, starty); starty = Math.Min(starty, terrain.MapHeight); double endx = intersectpos.x + endcorner.x * displayradius; double endy = intersectpos.y + endcorner.y * displayradius; endx = Math.Max(0, endx); endx = Math.Min(endx, terrain.MapWidth); endy = Math.Max(0, endy); endy = Math.Min(endy, terrain.MapHeight); for (int segment = 0; segment < numsegments; segment++) { double x = startx + (endx - startx) * segment / numsegments; double y = starty + (endy - starty) * segment / numsegments; double z = MetaverseClient.GetInstance().worldstorage.terrainmodel.Map[(int)(x), (int)(y)]; z = Math.Max(0.1, z); // make sure visible over sea Gl.glVertex3d(x, y, z); } } Gl.glEnd(); }
public void Render(Vector3 intersectpos) { double radius = CurrentEditBrush.GetInstance().BrushSize; int segments = 32; double anglestep = Math.PI * 2 / segments; TerrainModel terrain = MetaverseClient.GetInstance().worldstorage.terrainmodel; double x, y, z; // outer radius double displayradius = radius; Gl.glBegin(Gl.GL_LINE_LOOP); for (double angle = 0; angle < Math.PI * 2; angle += anglestep) { x = intersectpos.x + displayradius * Math.Sin(angle); y = intersectpos.y + displayradius * Math.Cos(angle); x = Math.Max(0, x); x = Math.Min(x, terrain.MapWidth); y = Math.Max(0, y); y = Math.Min(y, terrain.MapHeight); z = terrain.Map[(int)(x), (int)(y)]; z = Math.Max(0.1, z); // make sure visible over sea Gl.glVertex3d(x, y, z); } Gl.glEnd(); // core radius displayradius = coresizevalue / 100 * radius; Gl.glBegin(Gl.GL_LINE_LOOP); for (double angle = 0; angle < Math.PI * 2; angle += anglestep) { x = intersectpos.x + displayradius * Math.Sin(angle); y = intersectpos.y + displayradius * Math.Cos(angle); x = Math.Max(0, x); x = Math.Min(x, terrain.MapWidth); y = Math.Max(0, y); y = Math.Min(y, terrain.MapHeight); z = terrain.Map[(int)(x), (int)(y)]; z = Math.Max(0.1, z); // make sure visible over sea Gl.glVertex3d(x, y, z); } Gl.glEnd(); }
/// <summary> /// Return current mouse intersect point to x-y plane on map, in display coordinates /// </summary> /// <returns></returns> public static Vector3 GetIntersectPoint() { // intersect mousevector with x-z plane. TerrainModel terrain = MetaverseClient.GetInstance().worldstorage.terrainmodel; Vector3 mousevector = GraphicsHelperFactory.GetInstance().GetMouseVector( Camera.GetInstance().CameraPos, Camera.GetInstance().CameraRot, MouseCache.GetInstance().MouseX, MouseCache.GetInstance().MouseY); Vector3 camerapos = Camera.GetInstance().CameraPos; int width = terrain.HeightMapWidth; int height = terrain.HeightMapHeight; //Vector3 planenormal = mvMath.ZAxis; mousevector.Normalize(); if (mousevector.z < -0.0005) { //Vector3 intersectionpoint = camerapos + mousevector * (Vector3.DotProduct(camerapos, planenormal) + 0) / // (Vector3.DotProduct(mousevector, planenormal)); Vector3 intersectpoint = camerapos - mousevector * (camerapos.z / mousevector.z); //Console.WriteLine("intersection: " + intersectionpoint.ToString()); double heightmapx = intersectpoint.x; double heightmapy = intersectpoint.y; if (heightmapx >= 0 && heightmapy >= 0 && heightmapx < width && heightmapy < height) { intersectpoint.z = terrain.Map[(int)heightmapx, (int)heightmapy]; return(intersectpoint); } else { return(null); } } else { // Console.WriteLine("no intersection"); return(null); } }
void MainUIWindow_TerrainModified() { LogFile.WriteLine("MainUIWindow_TerrainModified() >>>"); terrain = MetaverseClient.GetInstance().worldstorage.terrainmodel; heightmapfilename.Text = terrain.HeightmapFilename; string[] stagenames = new string[terrain.texturestages.Count]; bool currenttexturestagevalid = false; string oldtexturestagecombotext = texturestagecombo.Entry.Text; for (int i = 0; i < terrain.texturestages.Count; i++) { string maptexturestagename = "texstage" + (i + 1); stagenames[i] = maptexturestagename; if (oldtexturestagecombotext == maptexturestagename) { currenttexturestagevalid = true; } } LogFile.WriteLine("stage names: " + String.Join(",", stagenames)); settingtexturestagecomboentry = true; texturestagecombo.PopdownStrings = stagenames; if (!currenttexturestagevalid) { LogFile.WriteLine("resetting currenttexturestage"); texturestagecombo.Entry.Text = stagenames[0]; on_texturestage_changed(null, null); //blendtexturefilename.Text = ""; //texturefilenamelbl.Text = ""; //operationcombo.Entry.Text = ""; } else { texturestagecombo.Entry.Text = oldtexturestagecombotext; on_texturestage_changed(null, null); } settingtexturestagecomboentry = false; LogFile.WriteLine("MainUIWindow_TerrainModified() <<<"); }
void LoadHeightMap(string sm3directory, TdfParser.Section terrainsection) { TerrainModel terrainmodel = MetaverseClient.GetInstance().worldstorage.terrainmodel; string filename = Path.Combine(sm3directory, terrainsection.GetStringValue("heightmap")); double heightoffset = terrainsection.GetDoubleValue("heightoffset"); double heightscale = terrainsection.GetDoubleValue("heightscale"); LogFile.WriteLine("heightoffset: " + heightoffset + " heightscale " + heightscale); terrainmodel.MinHeight = heightoffset; terrainmodel.MaxHeight = heightoffset + heightscale; // I guess??? ImageWrapper image = new ImageWrapper(filename); //Bitmap bitmap = DevIL.DevIL.LoadBitmap(filename); int width = image.Width; int height = image.Height; terrainmodel.HeightMapWidth = width; terrainmodel.HeightMapHeight = height; terrainmodel.Map = new double[width, height]; LogFile.WriteLine("loaded bitmap " + width + " x " + height); double minheight = terrainmodel.MinHeight; double maxheight = terrainmodel.MaxHeight; double heightmultiplier = (maxheight - minheight) / 255; LogFile.WriteLine("heightmultiplier: " + heightmultiplier + " minheight: " + minheight); for (int i = 0; i < width; i++) { for (int j = 0; j < height; j++) { terrainmodel.Map[i, j] = (float)(minheight + heightmultiplier * image.GetBlue(i, j)); } } terrain.HeightmapFilename = filename; }
public TerrainView( TerrainModel terrainmodel ) { LogFile.WriteLine( "TerrainView( " + terrainmodel + ")" ); this.terrainmodel = terrainmodel; terrainmodel.TerrainModified += new TerrainModel.TerrainModifiedHandler( terrainmodel_TerrainModified ); GraphicsHelperGl g = new GraphicsHelperGl(); g.CheckError(); foreach (MapTextureStageModel maptexturestagemodel in terrainmodel.texturestages) { LogFile.WriteLine( "create maptexturestageview for " + maptexturestagemodel ); mapviewbymapmodel.Add( maptexturestagemodel, new MapTextureStageView( maptexturestagemodel ) ); } g.CheckError(); renderableheightmap = new RenderableHeightMap( this, terrainmodel, 1, 1 ); //renderableallfeatures = new RenderableAllFeatures(this); // water must be last, otherwise you cant see through it ;-) renderablewater = new RenderableWater(new Vector3(), new Vector2(terrainmodel.HeightMapWidth , terrainmodel.HeightMapHeight )); // minimap last, covers everything else //renderableminimap = new RenderableMinimap(this, renderableheightmap); }
// note to self: move this to subscriber? void DrawMinimap() { TerrainModel terrain = MetaverseClient.GetInstance().worldstorage.terrainmodel; if (DateTime.Now.Subtract(LastMinimapUpdate).TotalMilliseconds > 1000) //if( true ) { List <RendererPass> rendererpasses = new List <RendererPass>(); bool multipass = true; // force multipass for now for simplicity int maxtexels = RendererSdl.GetInstance().MaxTexelUnits; if (multipass) { for (int i = 0; i < terrain.texturestages.Count; i++) { MapTextureStageModel maptexturestage = terrain.texturestages[i]; int numtexturestagesrequired = maptexturestage.NumTextureStagesRequired; if (numtexturestagesrequired > 0) // exclude Nops { RendererPass rendererpass = new RendererPass(maxtexels); for (int j = 0; j < maptexturestage.NumTextureStagesRequired; j++) { rendererpass.AddStage(new RendererTextureStage(maptexturestage, j, true, mapwidth, mapheight)); } rendererpasses.Add(rendererpass); } } } GraphicsHelperGl g = new GraphicsHelperGl(); //g.ApplyOrtho(windowwidth, windowheight, RendererSdl.GetInstance().OuterWindowWidth, RendererSdl.GetInstance().OuterWindowHeight); g.EnableBlendSrcAlpha(); Gl.glDepthFunc(Gl.GL_LEQUAL); int chunkwidth = minimapwidth / numchunks; int chunkheight = minimapheight / numchunks; float[] ambientLight = new float[] { 0.4f, 0.4f, 0.4f, 1.0f }; float[] diffuseLight = new float[] { 0.6f, 0.6f, 0.6f, 1.0f }; float[] specularLight = new float[] { 0.2f, 0.2f, 0.2f, 1.0f }; float[] position = new float[] { -1.0f, 0.2f, -0.4f, 1.0f }; Gl.glLightfv(Gl.GL_LIGHT0, Gl.GL_AMBIENT, ambientLight); Gl.glLightfv(Gl.GL_LIGHT0, Gl.GL_DIFFUSE, diffuseLight); Gl.glLightfv(Gl.GL_LIGHT0, Gl.GL_SPECULAR, specularLight); Gl.glLightfv(Gl.GL_LIGHT0, Gl.GL_POSITION, position); foreach (RendererPass rendererpass in rendererpasses) { rendererpass.Apply(); for (int x = 0; x + chunkwidth < minimapwidth; x += chunkwidth) { for (int y = 0; y + chunkheight < minimapheight; y += chunkheight) { Gl.glBegin(Gl.GL_QUADS); //double ul = 0; //double ur = mapwidth * Terrain.SquareSize; //double vt = 0; //double vb = mapheight * Terrain.SquareSize; double ul = (double)x / minimapwidth * mapwidth; double ur = (double)(x + chunkwidth) / minimapwidth * mapwidth; double vt = (double)y / minimapheight * mapheight; double vb = (double)(y + chunkheight) / minimapheight * mapheight; double xl = minimapx + x; double xr = minimapx + x + minimapwidth / (double)numchunks; double yt = minimapy + y; double yb = minimapy + y + minimapheight / (double)numchunks; Gl.glTexCoord2d(ul, vt); Gl.glMultiTexCoord2dARB(Gl.GL_TEXTURE1_ARB, ul, vt); g.Normal(renderableheightmap.GetNormal(x * mapwidth / minimapwidth, y * mapheight / minimapheight)); //g.Normal(renderableheightmap.normalsperquad[, ]); Gl.glVertex2d(xl, yt); Gl.glTexCoord2d(ul, vb); Gl.glMultiTexCoord2dARB(Gl.GL_TEXTURE1_ARB, ul, vb); g.Normal(renderableheightmap.GetNormal(x * mapwidth / minimapwidth, (y + chunkheight) * mapheight / minimapheight)); //g.Normal( renderableheightmap.normalsperquad[x * mapwidth / minimapwidth, (y + 1) * mapheight / minimapheight ] ); Gl.glVertex2d(xl, yb); Gl.glTexCoord2d(ur, vb); Gl.glMultiTexCoord2dARB(Gl.GL_TEXTURE1_ARB, ur, vb); g.Normal(renderableheightmap.GetNormal((x + chunkwidth) * mapwidth / minimapwidth, (y + chunkheight) * mapheight / minimapheight)); //g.Normal(renderableheightmap.normalsperquad[(x + 1) * mapwidth / minimapwidth, (y + 1) * mapheight / minimapheight]); Gl.glVertex2d(xr, yb); Gl.glTexCoord2d(ur, vt); Gl.glMultiTexCoord2dARB(Gl.GL_TEXTURE1_ARB, ur, vt); g.Normal(renderableheightmap.GetNormal((x + chunkwidth) * mapwidth / minimapwidth, y * mapheight / minimapheight)); //g.Normal(renderableheightmap.normalsperquad[(x + 1) * mapwidth / minimapwidth, y * mapheight / minimapheight]); Gl.glVertex2d(xr, yt); Gl.glEnd(); } } } g.ActiveTexture(0); Gl.glBindTexture(Gl.GL_TEXTURE_2D, minimaptexture); Gl.glCopyTexImage2D(Gl.GL_TEXTURE_2D, 0, Gl.GL_RGBA8, minimapx, RendererSdl.GetInstance().WindowHeight - minimapy - minimapsize, minimapsize, minimapsize, 0); Gl.glTexParameteri(Gl.GL_TEXTURE_2D, Gl.GL_TEXTURE_MIN_FILTER, Gl.GL_NEAREST); LastMinimapUpdate = DateTime.Now; // g.RemoveOrtho(); g.ActiveTexture(1); g.DisableTexture2d(); g.SetTextureScale(1); g.ActiveTexture(0); g.SetTextureScale(1); g.EnableModulate(); Gl.glDisable(Gl.GL_BLEND); } else { GraphicsHelperGl g = new GraphicsHelperGl(); //Gl.glMatrixMode(Gl.GL_PROJECTION); //Gl.glPushMatrix(); //Gl.glLoadIdentity(); //Gl.glOrtho(0, windowwidth, windowheight - RendererSdl.GetInstance().OuterWindowHeight, 0, -1, 1); // we'll just draw the minimap directly onto our display //Gl.glOrtho(0, windowwidth, windowheight, windowheight - RendererSdl.GetInstance().OuterWindowHeight, -1, 1); // we'll just draw the minimap directly onto our display //Gl.glMatrixMode(Gl.GL_MODELVIEW); //Gl.glPushMatrix(); //Gl.glLoadIdentity(); g.ActiveTexture(0); g.EnableTexture2d(); Gl.glBindTexture(Gl.GL_TEXTURE_2D, minimaptexture); //Gl.glBindTexture(Gl.GL_TEXTURE_2D, (terrain.texturestages[0].texture as GlTexture).GlReference); Gl.glDisable(Gl.GL_LIGHTING); Gl.glBegin(Gl.GL_QUADS); Gl.glTexCoord2d(0, 1); Gl.glVertex2i(minimapx, minimapy); Gl.glTexCoord2d(0, 1 - minimapwidth / (double)minimapsize); Gl.glVertex2i(minimapx, minimapy + minimapheight); Gl.glTexCoord2d(minimapwidth / (double)minimapsize, 1 - minimapheight / (double)minimapsize); Gl.glVertex2i(minimapx + minimapwidth, minimapy + minimapheight); Gl.glTexCoord2d(minimapwidth / (double)minimapsize, 1); Gl.glVertex2i(minimapx + minimapwidth, minimapy); Gl.glEnd(); Gl.glEnable(Gl.GL_LIGHTING); //Gl.glMatrixMode(Gl.GL_PROJECTION); //Gl.glPopMatrix(); //Gl.glMatrixMode(Gl.GL_MODELVIEW); //Gl.glPopMatrix(); } }
public WorldModel( NetReplicationController netreplicationcontroller ) { this.netreplicationcontroller = netreplicationcontroller; entities = new List<Entity>(); netreplicationcontroller.RegisterReplicatedObjectController(this, typeof(Entity)); terrainmodel = new TerrainModel(); }
public Sm3Persistence() { terrain = MetaverseClient.GetInstance().worldstorage.terrainmodel; }
void MainUIWindow_TerrainModified() { LogFile.WriteLine("MainUIWindow_TerrainModified() >>>"); terrain = MetaverseClient.GetInstance().worldstorage.terrainmodel; heightmapfilename.Text = terrain.HeightmapFilename; string[] stagenames = new string[terrain.texturestages.Count]; bool currenttexturestagevalid = false; string oldtexturestagecombotext = texturestagecombo.Entry.Text; for (int i = 0; i < terrain.texturestages.Count; i++) { string maptexturestagename = "texstage" + (i + 1); stagenames[i] = maptexturestagename; if( oldtexturestagecombotext == maptexturestagename ) { currenttexturestagevalid = true; } } LogFile.WriteLine("stage names: " + String.Join(",", stagenames)); settingtexturestagecomboentry = true; texturestagecombo.PopdownStrings = stagenames; if (!currenttexturestagevalid) { LogFile.WriteLine("resetting currenttexturestage"); texturestagecombo.Entry.Text = stagenames[0]; on_texturestage_changed(null, null); //blendtexturefilename.Text = ""; //texturefilenamelbl.Text = ""; //operationcombo.Entry.Text = ""; } else { texturestagecombo.Entry.Text = oldtexturestagecombotext; on_texturestage_changed(null, null); } settingtexturestagecomboentry = false; LogFile.WriteLine("MainUIWindow_TerrainModified() <<<"); }