public void Render(IFrameRenderData _frameData) { this.lineBuffer.ClearLines(); Vector4[] box = new Vector4[4]; this.lineBuffer.SetColour(new Vector4(0f, 1f, 0f, 0.5f)); foreach (var patch in tilePatches) { box[0] = new Vector4(0f, 0f, 0f, 1f); box[1] = new Vector4(1f, 0f, 0f, 1f); box[2] = new Vector4(0f, 0f, 1f, 1f); box[3] = new Vector4(1f, 0f, 1f, 1f); switch (patch.LOD) { case -4: this.lineBuffer.SetColour(new Vector4(0.4f, 0f, 0f, 0.5f)); break; case -3: this.lineBuffer.SetColour(new Vector4(0.6f, 0f, 0f, 0.5f)); break; case -2: this.lineBuffer.SetColour(new Vector4(0.8f, 0f, 0f, 0.5f)); break; case -1: this.lineBuffer.SetColour(new Vector4(1.0f, 0f, 0f, 0.5f)); break; case 0: this.lineBuffer.SetColour(new Vector4(1.0f, 0.5f, 0f, 0.5f)); break; case 1: this.lineBuffer.SetColour(new Vector4(1.0f, 0.8f, 0f, 0.5f)); break; case 2: this.lineBuffer.SetColour(new Vector4(1.0f, 1.0f, 0f, 0.5f)); break; case 3: this.lineBuffer.SetColour(new Vector4(0.5f, 1.0f, 0f, 0.5f)); break; case 4: this.lineBuffer.SetColour(new Vector4(0.0f, 1.0f, 0f, 0.5f)); break; } for (int i = 0; i < 4; i++) { box[i].X *= patch.Scale; box[i].Z *= patch.Scale; box[i].X += patch.Offset.X; box[i].Z += patch.Offset.Y; box[i].X *= (float)patch.Tile.Width; box[i].Z *= (float)patch.Tile.Height; box[i] = Vector4.Transform(box[i], patch.TileModelMatrix); } lineBuffer.MoveTo(box[0].TopDown()); lineBuffer.LineTo(box[1].TopDown()); lineBuffer.LineTo(box[3].TopDown()); lineBuffer.LineTo(box[2].TopDown()); lineBuffer.LineTo(box[0].TopDown()); } DebugRenderFrustum(viewFrustum); this.lineBuffer.Render(lineBufferModel, overlayModelview, overlayProjection); }
public void Render(IFrameRenderData frameData) { var cam = Camera; if (cam == null) return; var renderdata = frameData as FrameData; if (renderdata == null) return; /* if (cam.HasChanged()) { alpha = 1.0f; cam.ResetChanged(); } else { alpha *= 0.98f; if (alpha < 0.05f) alpha = 0.05f; }*/ alpha = 1.0f; postProcess.BindForWriting(); Matrix4 invProjectionView = Matrix4.Invert(Matrix4.Mult(cam.View, cam.Projection)); GL.Disable(EnableCap.CullFace); GL.Enable(EnableCap.DepthTest); //GL.Enable(EnableCap.Blend); //GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha); this.program .UseProgram() .SetUniform("inverse_projectionview_matrix", invProjectionView) .SetUniform("eyePos", cam.Eye) .SetUniform("iGlobalTime", (float)renderdata.Elapsed.TotalSeconds) .SetUniform("alpha", alpha) .SetUniform("wheel", Wheel) .SetUniform("showTraceDepth", ShowTraceDepth ? 1.0f : 0.0f); this.vertexVBO.Bind(this.program.VariableLocation("vertex")); this.indexVBO.Bind(); GL.DrawElements(BeginMode.Triangles, this.indexVBO.Length, DrawElementsType.UnsignedInt, 0); postProcess.UnbindFromWriting(); postProcess.Render(cam.HasChanged()); cam.ResetChanged(); }
public void Render(IFrameRenderData frameData) { throw new NotImplementedException(); }
public void Render(IFrameRenderData frameData) { if (currentTexture < 0) return; if (currentTexture >= this.Textures.Count) { throw new IndexOutOfRangeException(string.Format("currentTexture ({0})", currentTexture)); }; var texture = this.Textures[currentTexture]; if (texture == null || texture.Texture == null) { throw new InvalidOperationException("empty/null textureinfo"); } GL.Disable(EnableCap.CullFace); //GL.CullFace(CullFaceMode.Back); GL.Disable(EnableCap.DepthTest); GL.Disable(EnableCap.Blend); texture.Texture.Bind(TextureUnit.Texture0); program .UseProgram() .SetUniform("transform", transform) .SetUniform("tex", 0) .SetUniform("renderMode", (int)texture.RenderMode) .SetUniform("scale", texture.Scale); this.vertexVBO.Bind(program.VariableLocation("vertex")); this.texcoordVBO.Bind(program.VariableLocation("in_texcoord")); this.indexVBO.Bind(); GL.DrawElements(BeginMode.Triangles, this.indexVBO.Length, DrawElementsType.UnsignedInt, 0); this.RenderText(); }