private void RenderQuakeBSP(float frameTime) { Viewport leftViewport; GL.DepthMask(true); GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit); GL.Enable(EnableCap.DepthTest); GL.DepthMask(true); GL.DepthFunc(DepthFunction.Lequal); if (map == null || camera.playerMover == null) { return; } // Matrix setup leftViewMat = camera.ViewMatrix; camera.ApplyTransformations(); if (camera.HasChanges) { //camera_onchange(camera); } leftViewport = new Viewport(); leftViewport.width = this.Width; leftViewport.height = this.Height; leftViewport.x = 0.0f; leftViewport.y = 0.0f; if (drawMap) { //float time = (float)(DateTime.Now.Ticks - startTime) / 1000.0f; if (q3bsp.skybox_env != null) { //q3bsp.skybox_env.Render(frameTime, leftViewport, leftViewMat, camera.Projection); } q3bsp.Render(leftViewMat, camera.Projection, leftViewport, frameTime); } //player.RenderPlayerModels(gl, leftViewMat, leftProjMat, leftViewport); }
protected override void OnRenderFrame(FrameEventArgs e) { if (frame >= FRAMES_TO_RENDER) { return; } GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit); GL.ClearColor(System.Drawing.Color.White); GL.Enable(EnableCap.DepthTest); GL.DepthMask(true); GL.DepthFunc(DepthFunction.Lequal); GL.PointSize(6.0f); //TODO: improve current Camera implementation ActiveCamera.ApplyTransformations(); // TEST new camera implementation // TODO: steroscopic mode RenderingContext rc = new RenderingContext(); rc.View = View.CreateViewFromWindow(this); rc.Time = e.Time; rc.matricies.worldview = Matrix4.Identity; rc.matricies.projection = ActiveCamera.Projection; rc.matricies.modelview = Matrix4.Identity; rc.matricies.orientation = Quaternion.Identity; rc.cam = ActiveCamera; rc.Keyboard = this.Keyboard; // Apply the current Viewpoint Viewpoint.Apply(rc, Viewpoint.CurrentViewpoint); //this._perlin.Render(rc); ExecuteBuildTasks(rc); frame++; SwapBuffers(); }
public void Render(FrameEventArgs e) { if (reloading) { return; } _prev = DateTime.Now; GL.Disable(EnableCap.Lighting); GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit); GL.ClearColor(ClearColor.X, ClearColor.Y, ClearColor.Z, ClearColor.W); GL.Enable(EnableCap.DepthTest); GL.DepthMask(true); GL.DepthFunc(DepthFunction.Lequal); GL.PointSize(6.0f); //GL.Enable(EnableCap.Blend); ActiveCamera.ApplyTransformations(); if (scene != null && scene.SceneGraph.Loaded) { RenderingContext rc = new RenderingContext(); rc.View = View.CreateViewFromWindow(this.window); rc.Time = e.Time; rc.matricies.worldview = Matrix4.Identity; rc.matricies.projection = ActiveCamera.Projection; rc.matricies.modelview = Matrix4.Identity; rc.matricies.orientation = Quaternion.Identity; rc.cam = ActiveCamera; rc.Keyboard = this.Keyboard; // Apply the current Viewpoint Viewpoint.Apply(rc, Viewpoint.CurrentViewpoint); Engine.Runtime.Draw(scene.SceneGraph, rc); if (showCrosshair && NavigationInfo.NavigationType != NavigationType.Examine) { rc.PushMatricies(); this._crosshair.Render(rc); rc.PopMatricies(); } } else { X3DProgram.Restart(); } if (e != null) { UpdateTitle(e); } #if VSYNC_ACTIVE System.Threading.Thread.Sleep(1); #else #endif }