public void Render(Rectangle ClientRectangle, int Width, int Height, GLControl RenderPanel) { GL.Viewport(ClientRectangle.X, ClientRectangle.Y, ClientRectangle.Width, ClientRectangle.Height); Matrix4 projection = cam.GetViewMatrix() * Matrix4.CreatePerspectiveFieldOfView(1.0f, Width / (float)Height, 1f, 1000.0f); GL.MatrixMode(MatrixMode.Projection); GL.LoadMatrix(ref projection); InitialiseView(); GL.PolygonMode(MaterialFace.FrontAndBack, PolygonMode.Fill); GL.Enable(EnableCap.DepthTest); GL.Enable(EnableCap.Blend); GL.BlendFunc(BlendingFactor.SrcAlpha, BlendingFactor.OneMinusSrcAlpha); GL.Enable(EnableCap.ColorMaterial); GL.Enable(EnableCap.Normalize); GL.ShadeModel(ShadingModel.Smooth); GL.Enable(EnableCap.Lighting); GL.Enable(EnableCap.Light0); Vector3 lookat = new Vector3(); lookat.X = (float)(Math.Cos((float)cam.Orientation.X) * Math.Cos((float)cam.Orientation.Y)); lookat.Y = (float)Math.Sin((float)cam.Orientation.Y); lookat.Z = (float)(Math.Sin((float)cam.Orientation.X) * Math.Cos((float)cam.Orientation.Y)); GL.Light(LightName.Light0, LightParameter.Position, new float[] { Math.Abs(lookat.X), Math.Abs(lookat.Y), Math.Abs(lookat.Z), 0.0f }); ParseF3D parse = new ParseF3D(lines); if (!textured) { GL.Disable(EnableCap.Texture2D); } else { GL.Enable(EnableCap.Texture2D); } GL.Begin(BeginMode.Triangles); if (!seq) { foreach (int torenderitems in torender) { GL.Begin(BeginMode.Triangles); parse.ParseDL(torenderitems, GBIc, LUTc); GL.End(); } } else { parse.ParseDL(0, GBIc, LUTc); } GL.End(); RenderPanel.SwapBuffers(); }
public void Init() { inited = true; lutmanager.dldata = lines; lutmanager.curFile = fileName; lutmanager.fbpath = LakiTool.MISC.Game.gamePath; lutmanager.initF3D(); LUTc = lutmanager.luts; parser = new ParseF3D(F3DUtils.getF3DCommandsFromLines(lines), lutmanager.jumpContainer); labelsearchers = F3DUtils.getLabelSearchersFromLabelContainer(new Labels.LabelContainer(Labels.Utils.LabelUtil.getLabelListFromModelFile(fileName)), lines); GL.Enable(EnableCap.Texture2D); displayListGenerated = false; }