コード例 #1
0
ファイル: Orbit.cs プロジェクト: china-vo/wwt-windows-client
        // Draw an ellipse with the specified semi-major axis and eccentricity. The orbit is drawn over a single period,
        // fading from full brightness at the given eccentric anomaly.
        //
        // In order to match exactly the position at which a planet is drawn, the planet's position at the current time
        // must be passed as a parameter. positionNow is in the current coordinate system of the render context, not the
        // translated and rotated system of the orbital plane.
        public static void DrawEllipse(RenderContext11 renderContext, double semiMajorAxis, double eccentricity, double eccentricAnomaly, Color color, Matrix3d worldMatrix, Vector3d positionNow)
        {
            if (ellipseShader == null)
            {
                ellipseShader = new EllipseShader11();
            }

            if (ellipseVertexBuffer == null)
            {
                ellipseVertexBuffer = CreateEllipseVertexBuffer( 500);
            }

            Matrix3d savedWorld = renderContext.World;
            renderContext.World = worldMatrix;

            renderContext.devContext.InputAssembler.PrimitiveTopology = SharpDX.Direct3D.PrimitiveTopology.LineStrip;

            renderContext.SetVertexBuffer(ellipseVertexBuffer);

            ellipseShader.UseShader(renderContext, semiMajorAxis, eccentricity, eccentricAnomaly, new SharpDX.Color(color.R, color.G, color.B, color.A), savedWorld, positionNow);

            renderContext.devContext.Draw(ellipseVertexBuffer.Count, 0);

            renderContext.World = savedWorld;
        }
コード例 #2
0
 static void initialize()
 {
     instance = new EllipseShader11();
     instance.CompileShader(RenderContext11.VertexProfile, RenderContext11.PixelProfile);
     contantBuffer = new SharpDX.Direct3D11.Buffer(RenderContext11.PrepDevice, Utilities.SizeOf<EllipseShaderConstants>(), ResourceUsage.Default, BindFlags.ConstantBuffer, CpuAccessFlags.None, ResourceOptionFlags.None, 0);
 }
コード例 #3
0
        // This version of DrawEllipse works without a 'head' point
        public static void DrawEllipse(RenderContext11 renderContext, double semiMajorAxis, double eccentricity, double eccentricAnomaly, Color color, Matrix3d worldMatrix)
        {
            if (ellipseShader == null)
            {
                ellipseShader = new EllipseShader11();
            }

            if (ellipseWithoutStartPointVertexBuffer == null)
            {
                ellipseWithoutStartPointVertexBuffer = CreateEllipseVertexBufferWithoutStartPoint(360);
            }

            var savedWorld = renderContext.World;
            renderContext.World = worldMatrix;

            renderContext.devContext.InputAssembler.PrimitiveTopology = PrimitiveTopology.LineStrip;

            renderContext.SetVertexBuffer(ellipseWithoutStartPointVertexBuffer);

            ellipseShader.UseShader(renderContext, semiMajorAxis, eccentricity, eccentricAnomaly, new SharpDX.Color(color.R, color.G, color.B, color.A), savedWorld, new Vector3d(0.0, 0.0, 0.0));

            renderContext.devContext.Draw(ellipseWithoutStartPointVertexBuffer.Count, 0);

            renderContext.World = savedWorld;
        }