コード例 #1
0
        public void Draw(Effect effect, Transformations transformations, Vector3 position, float scale)
        {
            device.DepthStencilState = DepthStencilState.Default;
            device.RasterizerState   = RasterizerState.CullCounterClockwise;
            device.BlendState        = BlendState.Opaque;

            effect.Parameters["xWorld"].SetValue(Matrix.CreateScale(scale) * Matrix.CreateTranslation(position));
            effect.Parameters["xView"].SetValue(transformations.View);
            effect.Parameters["xProjection"].SetValue(transformations.Projection);
            effect.CurrentTechnique.Passes[0].Apply();

            device.Indices = indexBuffer;
            device.SetVertexBuffer(vertexBuffer);
            device.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0, vertices.Length, 0, 12);
        }
コード例 #2
0
        public void Draw(Transformations transformations)
        {
            Effect effect = GameEngine.GetInstance().ResourceManager.GetEffect("regulareffect");

            device.DepthStencilState = DepthStencilState.Default;
            device.RasterizerState   = RasterizerState.CullCounterClockwise;
            device.BlendState        = BlendState.Opaque;

            effect.Parameters["xWorld"].SetValue(transformations.World);
            effect.Parameters["xView"].SetValue(transformations.View);
            effect.Parameters["xProjection"].SetValue(transformations.Projection);
            effect.CurrentTechnique.Passes[0].Apply();

            device.Indices = indexBuffer;
            device.SetVertexBuffer(vertexBuffer);
            device.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0, vertices.Length, 0, 12);
        }