示例#1
0
        public override void Render(GraphicsPipeline gPipeline)
        {
            // set scale
            gPipeline.BeginScene();

            base.Render(gPipeline);

            if (shape.IsIndexed)
            {
                for (int i = 0; i < shape.Indices.Length; i++)
                {
                    gDevice.Indices = shape.Indices[i];
                    int vIdx = shape.IndexVRefs[i];
                    gDevice.VertexFormat = shape.VertexFormats[vIdx];
                    gDevice.SetStreamSource(0, shape.Vertices[vIdx], 0);
                    gDevice.DrawIndexedPrimitives(shape.PrimTypes[i], 0, 0, shape.VertexCount[vIdx], 0, shape.PrimitiveCounts[i]);
                }
            }
            else
            {
                for (int i = 0; i < shape.Vertices.Length; i++)
                {
                    gDevice.VertexFormat = shape.VertexFormats[i];
                    gDevice.SetStreamSource(0, shape.Vertices[i], 0);
                    gDevice.DrawPrimitives(shape.PrimTypes[i], 0, shape.PrimitiveCounts[i]);
                }
            }

            gPipeline.EndScene();
        }
        public override void Render(GraphicsPipeline gPipeline)
        {
            gDevice.RenderState.ZBufferEnable = false;

            gDevice.VertexFormat = CustomVertex.PositionColored.Format;
            gDevice.SetStreamSource(0, vBuffer, 0);
            for (int i = 0; i < 3; i++)
            {
                gDevice.DrawPrimitives(PrimitiveType.LineStrip, (detailCount + 1) * i, detailCount);
            }

            gDevice.RenderState.ZBufferEnable = true;
        }
示例#3
0
        public override void Render(GraphicsPipeline gPipeline)
        {
            // set scale
            gPipeline.BeginScene();

            base.Render(gPipeline);

            if (shape.IsIndexed)
            {
                for (int i = 0; i < shape.Indices.Length; i++)
                {
                    gDevice.Indices = shape.Indices[i];
                    int vIdx = shape.IndexVRefs[i];
                    gDevice.VertexFormat = shape.VertexFormats[vIdx];
                    gDevice.SetStreamSource(0, shape.Vertices[vIdx], 0);
                    gDevice.DrawIndexedPrimitives(shape.PrimTypes[i], 0, 0, shape.VertexCount[vIdx], 0, shape.PrimitiveCounts[i]);
                }
            }
            else
            {
                for (int i = 0; i < shape.Vertices.Length; i++)
                {
                    gDevice.VertexFormat = shape.VertexFormats[i];
                    gDevice.SetStreamSource(0, shape.Vertices[i], 0);
                    gDevice.DrawPrimitives(shape.PrimTypes[i], 0, shape.PrimitiveCounts[i]);
                }
            }

            gPipeline.EndScene();
        }
 public abstract void PostRender(GraphicsPipeline gPipeline);
示例#5
0
 public abstract void PostRender(GraphicsPipeline gPipeline);
        public override void Render(GraphicsPipeline gPipeline)
        {
            gDevice.RenderState.Lighting = false;
            gPipeline.BeginScene();

            // just draw bounding box for now
            //NuGenRenderCore.Rendering.BoundingBox.DrawWireframe(gDevice, bBox, Color.DarkRed.ToArgb());

            // draw geometry
            if (geom != null)
            {
                geom.UseDiffuseTexture = ((GeometryVisLayer)devIf.LocalSettings["GeometryVisLayer.Diffuse"]).Enabled;

                ShaderInterface shader = null;
                /*if ((bool)devIf.LocalSettings["GeometryVis.HeightShadingEnabled"])
                {
                    shader = hClrShader;
                    shader.Effect.SetValue("MinHeight", -0.5f);
                    shader.Effect.SetValue("HeightScale", 1f);
                    shader.Effect.SetValue("HeightClr", ColorValue.FromColor((Color)devIf.LocalSettings["GeometryVis.HeightShadingClr"]));
                }
                else if (((GeometryVisLayer)devIf.LocalSettings["GeometryVisLayer.Overlay"]).Enabled)
                {
                    shader = defaultShader;
                    shader.Effect.SetValue("OverlayTexture", overlayTexRz.Texture);
                }*/
                shader = sm3Shader;

                if (shader != null)
                {
                    gPipeline.ShaderIf = shader;
                    gPipeline.ShaderEnabled = true;

                    /*shader.Effect.Begin(FX.None);
                    shader.Effect.BeginPass(0);*/

                    geom.Render(gPipeline);

                    /*shader.Effect.EndPass();
                    shader.Effect.End();*/

                    gPipeline.ShaderEnabled = false;
                }
                else
                {
                    geom.Render(gPipeline);
                }

                //gDevice.SetTexture(1, null);
            }

            /*gDevice.VertexFormat = CustomVertex.PositionColored.Format;
            gDevice.DrawUserPrimitives(PrimitiveType.TriangleStrip, 2, clipBottomSideQuad);*/

            gPipeline.EndScene();
        }
示例#7
0
 public abstract void RenderSceneFrame(GraphicsPipeline gPipeline, int width, int height);
示例#8
0
 public override void Render(GraphicsPipeline gPipeline)
 {
     gDevice.VertexFormat = CustomVertex.PositionColored.Format;
     gDevice.DrawUserPrimitives(PrimitiveType.LineList, 1, ray);
 }
示例#9
0
        public override void Render(GraphicsPipeline gPipeline)
        {
            gPipeline.BeginScene();

            gDevice.RenderState.ZBufferEnable = false;

            gDevice.VertexFormat = CustomVertex.PositionColored.Format;
            gDevice.SetStreamSource(0, vBuffer, 0);
            gDevice.DrawPrimitives(PrimitiveType.LineList, 0, 3);

            if (Selected)
            {
                // just draw yellow line over selected axis
                gDevice.SetStreamSource(0, selectionVBuffer, 0);
                gDevice.DrawPrimitives(PrimitiveType.LineList, InternalSelectedValue - 1, 1);

                // TODO: draw triangular tube on that axis
                /*gDevice.Indices = selectionIBuffer;
                gDevice.SetStreamSource(0, selectionVBuffers[InternalSelectedValue - 1], 0);
                gDevice.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0, 6, 0, 6);*/
            }

            gDevice.RenderState.ZBufferEnable = true;

            gPipeline.EndScene();
        }
        protected virtual void InitializeEnvironment(CommonDeviceInterface cdi, HashTableSettings localSettings)
        {
            // Get device settings
            if (outCaps == null)
                outCaps = GraphicsDeviceCaps.GetDefaultAdapterCaps(outProfile.RecommendedVariations[0]);
            // find first recommended settings with full match
            bool fullMatch = false;
            outSettings = GraphicsDeviceSettings.CreateFromRequirements(outProfile.RecommendedVariation,
                                                                        outCaps, outProfile.MinReqs,
                                                                        out fullMatch);

            // Set up the presentation parameters
            presentParams.Windowed = outProfile.RecommendedVariations[0].Windowed;
            presentParams.SwapEffect = SwapEffect.Discard;
            presentParams.AutoDepthStencilFormat = outSettings.DepthFormat;
            presentParams.EnableAutoDepthStencil = (outSettings.DepthFormat != DepthFormat.Unknown);
            presentParams.MultiSample = outSettings.MultiSample;

            CreateDevice();

            devIf = new DeviceInterface(gDevice, cdi, localSettings);

            gPipeline = new GraphicsPipeline(gDevice);
        }