public void Draw(RenderContext renderContext, float opacity) { if (opacity <= 0) { return; } if (renderContext.gl != null) { InitBuffer(); foreach (TimeSeriesLineVertexBuffer buffer in buffers) { LineShaderNormalDates.Use(renderContext, buffer.VertexBuffer, Color.FromArgb(255, 255, 255, 255), zBuffer, (float)JNow, TimeSeries ? (float)Decay : 0); renderContext.gl.drawArrays(GL.TRIANGLE_FAN, 0, buffer.Count); } } }
public void DrawLines(RenderContext renderContext, float opacity) { if (linePoints.Count < 2 || opacity <= 0) { return; } if (renderContext.gl == null) { //todo draw with HTML5 } else { InitLineBuffer(); foreach (TimeSeriesLineVertexBuffer lineBuffer in lineBuffers) { LineShaderNormalDates.Use(renderContext, lineBuffer.VertexBuffer, Color.FromArgb(255, 255, 255, 255), zBuffer, (float)JNow, TimeSeries ? (float)Decay : 0); renderContext.gl.drawArrays(GL.LINES, 0, lineBuffer.Count); } } }
public void Draw(RenderContext renderContext, float opacity, CullMode cull) { if (trianglePoints.Count < 1 && !dataToDraw) { return; } //renderContext.DepthStencilMode = DepthBuffered ? (WriteZbuffer ? DepthStencilMode.ZReadWrite : DepthStencilMode.ZReadOnly) : DepthStencilMode.Off; //renderContext.devContext.InputAssembler.PrimitiveTopology = SharpDX.Direct3D.PrimitiveTopology.TriangleList; //switch (cull) //{ // case CullMode.Clockwise: // renderContext.setRasterizerState(TriangleCullMode.CullClockwise); // break; // case CullMode.CounterClockwise: // renderContext.setRasterizerState(TriangleCullMode.CullCounterClockwise); // break; // case CullMode.None: // renderContext.setRasterizerState(TriangleCullMode.Off); // break; // default: // break; //} //if (AutoTime) //{ // DateTime baseDate = new DateTime(2010, 1, 1, 12, 00, 00); // LineShaderNormalDates.Constants.JNow = (float)(SpaceTimeController.JNow - SpaceTimeController.UtcToJulian(baseDate)); //} //else //{ // LineShaderNormalDates.Constants.JNow = (float)JNow; //} //LineShaderNormalDates.Constants.Sky = 0; //LineShaderNormalDates.Constants.ShowFarSide = ShowFarSide ? 1 : 0; //if (TimeSeries) //{ // LineShaderNormalDates.Constants.Decay = (float)Decay; //} //else //{ // LineShaderNormalDates.Constants.Decay = 0; //} //LineShaderNormalDates.Constants.Opacity = opacity; //LineShaderNormalDates.Constants.CameraPosition = new SharpDX.Vector4(Vector3d.TransformCoordinate(renderContext.CameraPosition, Matrix3d.Invert(renderContext.World)).Vector311, 1); //SharpDX.Matrix mat = (renderContext.World * renderContext.View * renderContext.Projection).Matrix11; //mat.Transpose(); //LineShaderNormalDates.Constants.WorldViewProjection = mat; //LineShaderNormalDates.Use(renderContext.devContext); //foreach (TimeSeriesLineVertexBuffer vertBuffer in triangleBuffers) //{ // renderContext.SetVertexBuffer(vertBuffer); // renderContext.devContext.Draw(vertBuffer.Count, 0); //} if (renderContext.gl == null) { //todo implement HTML5 version } else { InitTriangleBuffer(); foreach (TimeSeriesLineVertexBuffer triBuffer in triangleBuffers) { LineShaderNormalDates.Use(renderContext, triBuffer.VertexBuffer, Color.FromArgb(255, 255, 255, 255), DepthBuffered, (float)JNow, TimeSeries ? (float)Decay : 0); renderContext.gl.drawArrays(GL.TRIANGLES, 0, triBuffer.Count); } } }
public void DrawLines(RenderContext renderContext, float opacity) { if (linePoints.Count < 2 || opacity <= 0) { return; } if (renderContext.gl == null) { //todo draw with HTML5 } else { InitLineBuffer(); //Matrix3d savedWorld = renderContext.World; //Matrix3d savedView = renderContext.View; //if (localCenter != Vector3d.Empty) //{ // usingLocalCenter = true; // Vector3d temp = localCenter; // if (UseNonRotatingFrame) // { // renderContext.World = Matrix3d.Translation(temp) * renderContext.WorldBaseNonRotating * Matrix3d.Translation(-renderContext.CameraPosition); // } // else // { // renderContext.World = Matrix3d.Translation(temp) * renderContext.WorldBase * Matrix3d.Translation(-renderContext.CameraPosition); // } // renderContext.View = Matrix3d.Translation(renderContext.CameraPosition) * renderContext.ViewBase; //} //DateTime baseDate = new DateTime(2010, 1, 1, 12, 00, 00); //renderContext.devContext.InputAssembler.PrimitiveTopology = SharpDX.Direct3D.PrimitiveTopology.LineList; //LineShaderNormalDates11.Constants.JNow = (float)(SpaceTimeController.JNow - SpaceTimeController.UtcToJulian(baseDate)); //LineShaderNormalDates11.Constants.Sky = Sky ? 1 : 0; //LineShaderNormalDates11.Constants.ShowFarSide = ShowFarSide ? 1 : 0; //if (TimeSeries) //{ // LineShaderNormalDates11.Constants.Decay = (float)Decay; //} //else //{ // LineShaderNormalDates11.Constants.Decay = 0; //} //LineShaderNormalDates11.Constants.Opacity = opacity; //LineShaderNormalDates11.Constants.CameraPosition = new SharpDX.Vector4(Vector3d.TransformCoordinate(renderContext.CameraPosition, Matrix3d.Invert(renderContext.World)).Vector311, 1); //SharpDX.Matrix mat = (renderContext.World * renderContext.View * renderContext.Projection).Matrix11; //mat.Transpose(); //LineShaderNormalDates11.Constants.WorldViewProjection = mat; //LineShaderNormalDates11.Use(renderContext.devContext); //renderContext.DepthStencilMode = DepthBuffered ? DepthStencilMode.ZReadWrite : DepthStencilMode.Off; foreach (TimeSeriesLineVertexBuffer lineBuffer in lineBuffers) { LineShaderNormalDates.Use(renderContext, lineBuffer.VertexBuffer, Color.FromArgb(255, 255, 255, 255), zBuffer, (float)JNow, TimeSeries ? (float)Decay : 0); renderContext.gl.drawArrays(GL.LINES, 0, lineBuffer.Count); } //renderContext.DepthStencilMode = DepthStencilMode.ZReadWrite; //if (usingLocalCenter) //{ // renderContext.World = savedWorld; // renderContext.View = savedView; //} } }