public static void ForceVertRGBA(bool Opaque) { int addresscount; if (Opaque) { addresscount = GeoLayouts.OpaqueModels.Length; } else { addresscount = GeoLayouts.AlphaModels.Length; } for (int i = 0; i < addresscount; i++) { if (Opaque) { ForceVertRGBAJump(GeoLayouts.OpaqueModels[i], true); } else { ForceVertRGBAJump(GeoLayouts.AlphaModels[i], false); } InitialiseModelLoad(Rectangle.Empty, new GLControl()); //init without rendering GeoLayouts.ParseGeoLayout(ROMManager.SM64ROM, LevelScripts.getGeoAddress(Renderer.LevelArea), false); } }
public static void LayerSwap(byte layer1, byte layer2, uint LevelArea) { for (uint i = 0; i < GeoLayouts.ExtDLPointers[layer1].Length; i++) { UInt32 Addr = GeoLayouts.ExtDLPointers[1][i] + 1; ROMManager.SM64ROM.changeByte(Addr, layer2); if (debug) { Console.Write("Wrote 0x" + layer2.ToString("x1") + " to ROM addr 0x" + Addr.ToString("x8") + " (GeoLayout LayerSwap)\n"); } GeoLayouts.ParseGeoLayout(ROMManager.SM64ROM, LevelScripts.getGeoAddress(LevelArea), false); } }
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.0000001f, 1.0f); GL.MatrixMode(MatrixMode.Projection); GL.LoadMatrix(ref projection); InitialiseView(); GL.Scale(0.000001, 0.000001, 0.000001); if (ROMManager.ReadytoLoad) { GL.PolygonMode(MaterialFace.FrontAndBack, PolygonMode.Fill); GL.Scale(0.01, 0.01, 0.01); GeoLayouts.ParseGeoLayout(ROMManager.SM64ROM, LevelScripts.getGeoAddress(LevelArea), 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 (ROMManager.ReadytoLoad && ROMManager.SM64ROM != null) { GL.Scale(GameScale); if (!ObjectView) { GeoLayouts.ParseGeoLayout(ROMManager.SM64ROM, LevelScripts.getGeoAddress(LevelArea), false); } else { GeoLayouts.ParseGeoLayout(ROMManager.SM64ROM, LevelScripts.ObjectGeoOffsets[SelectedSegment][SelectedObject], false); } if (EdgesOption) { GL.Disable(EnableCap.CullFace); F3D.RenderEdges = true; GL.PolygonMode(MaterialFace.FrontAndBack, PolygonMode.Line); if (!ObjectView) { GeoLayouts.ParseGeoLayout(ROMManager.SM64ROM, LevelScripts.getGeoAddress(LevelArea), false); } else { GeoLayouts.ParseGeoLayout(ROMManager.SM64ROM, LevelScripts.ObjectGeoOffsets[SelectedSegment][SelectedObject], false); } F3D.RenderEdges = false; } } 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(); }