public static void RenderColourBuffer(Rectangle ClientRectangle, int Width, int Height, GLControl RenderPanel) { GL.Viewport(ClientRectangle.X, ClientRectangle.Y, RenderPanel.Width, RenderPanel.Height); projection = cam.GetViewMatrix() * Matrix4.CreatePerspectiveFieldOfView(1.0f, Width / (float)Height, 0.00000001f, 0.001f); GL.MatrixMode(MatrixMode.Projection); GL.LoadMatrix(ref projection); InitialiseView(); GL.Scale(WorldScale); if (BinManager.ReadytoLoad) { GL.PolygonMode(MaterialFace.FrontAndBack, PolygonMode.Fill); GL.Scale(GameScale); F3DEX.ParseF3DEXDL(BinManager.MainBin, 0, true); if (BinManager.AlphaBin != null) { F3DEX.ParseF3DEXDL(BinManager.AlphaBin, 1, true); } } //RenderPanel.SwapBuffers(); //We don't want people to see the vertex selection colour map so don't invalidate here! }
public static void Render(Rectangle ClientRectangle, int Width, int Height, GLControl RenderPanel) { TriCount = 0; VertexCount = 0; GL.Viewport(ClientRectangle.X, ClientRectangle.Y, RenderPanel.Width, RenderPanel.Height); projection = cam.GetViewMatrix() * Matrix4.CreatePerspectiveFieldOfView(1.0f, Width / (float)Height, 0.00000001f, 0.001f); GL.MatrixMode(MatrixMode.Projection); GL.LoadMatrix(ref projection); InitialiseView(); if (WireFrameMode) { GL.PolygonMode(MaterialFace.FrontAndBack, PolygonMode.Line); } else { GL.PolygonMode(MaterialFace.FrontAndBack, PolygonMode.Fill); } GL.Scale(WorldScale); if (BinManager.ReadytoLoad && BinManager.MainBin != null) { GL.Scale(GameScale); F3DEX.ParseF3DEXDL(BinManager.MainBin, 0, false); if (BinManager.AlphaBin != null) { F3DEX.ParseF3DEXDL(BinManager.AlphaBin, 1, false); } if (EdgesOption) { GL.Disable(EnableCap.CullFace); GL.DepthRange(0.0001, 0.9999f); F3DEX.RenderEdges = true; GL.PolygonMode(MaterialFace.FrontAndBack, PolygonMode.Line); F3DEX.ParseF3DEXDL(BinManager.MainBin, 0, false); if (BinManager.AlphaBin != null) { F3DEX.ParseF3DEXDL(BinManager.AlphaBin, 1, false); } F3DEX.RenderEdges = false; GL.DepthRange(0, 1f); } } else //Rotate cubes for fun idle :) { if (CubeSampleRotate >= Math.PI * 1.5) { CubeSampleRotate = Math.PI / 2; CubeSampleColour = new Color4(0f, 0f, 1f, 1f); } if (CubeSampleScale >= Math.PI * 2) { CubeSampleScale = 0; } GL.Scale(1 + 0.25 * Math.Sin(CubeSampleScale), Math.Sin(CubeSampleScale), Math.Sin(CubeSampleScale)); float rotation = 90 * (float)Math.Sin(CubeSampleRotate); CubeRealRotation = rotation; float newcolour = Math.Abs(rotation); GL.Rotate(rotation, 1, 0, 0); CubeSampleColour.R = (newcolour) / 45; CubeSampleColour.G = (newcolour) / 45; DrawCube(); GL.Rotate(rotation, 1, 0, 0); CubeSampleColour.R = (newcolour) / 45; CubeSampleColour.G = (newcolour) / 45; DrawCube(); GL.Rotate(rotation, 1, 0, 0); CubeSampleColour.R = (newcolour) / 45; CubeSampleColour.G = (newcolour) / 45; DrawCube(); GL.Rotate(rotation, 1, 0, 0); CubeSampleColour.R = (newcolour) / 45; CubeSampleColour.G = (newcolour) / 45; DrawCube(); KeyboardState state = Keyboard.GetState(); CubeSampleScale += 0.015; CubeSampleRotate += 0.015; } RenderPanel.SwapBuffers(); }