Пример #1
0
        public void Draw(EffectTechnique technique)
        {
            if (vertices.Count > 0)
            {
                UniversalEffect effect = RendererAssetPool.UniversalEffect;
                if (technique == null)
                {
                    effect.CurrentTechnique = this.Technique;
                }
                else
                {
                    effect.CurrentTechnique = technique;
                }

                Ready();
                effect.Begin();
                foreach (EffectPass pass in effect.CurrentTechnique.Passes)//TODO1 remove this when shading i
                {
                    pass.Begin();
                    GraphicsDevice device = GraphicOptions.graphics.GraphicsDevice;
                    device.VertexDeclaration = vertDeclaration;
                    device.Vertices[0].SetSource(vertexBuffer, 0, VertexPositionColorTexture.SizeInBytes);
                    device.DrawUserPrimitives <VertexPositionColorTexture>(
                        PrimitiveType.LineList, vertices.ToArray(), 0, 2);
                    pass.End();
                }
                effect.End();
            }
        }
Пример #2
0
        /// <summary>
        /// Draws all vertices in the vertex buffer.
        /// </summary>
        ///
        public override void Draw(EffectTechnique technique)
        {
            UniversalEffect effect = RendererAssetPool.UniversalEffect;

            if (technique == effect.Techniques.UseDefault)
            {
                effect.CurrentTechnique = RendererAssetPool.UniversalEffect.Techniques.Colored;
            }
            else
            {
                effect.CurrentTechnique = technique;
            }

            effect.ColorParameters.TransparencyEnabled = this.TransparencyEnabled && GraphicOptions.TransparentWalls;

            effect.Begin();
            foreach (EffectPass pass in effect.CurrentTechnique.Passes)//TODO1 remove this when shading i
            {
                pass.Begin();
                GraphicsDevice device = GraphicOptions.graphics.GraphicsDevice;
                device.VertexDeclaration = vertDeclaration;
                device.Vertices[0].SetSource(vertexBuffer, 0, VertexPositionColor.SizeInBytes);
                device.DrawUserPrimitives <VertexPositionColor>(
                    PrimitiveType.TriangleStrip, vertices.ToArray(), 0, 2);
                pass.End();
            }
            effect.End();
        }