Exemplo n.º 1
0
        public override void Draw(GameTime gameTime)
        {
            Game.GraphicsDevice.RenderState.CullMode = CullMode.None;

            CheckerEffect.setProjectionMatrix(cam.ProjectionMatrix);
            CheckerEffect.setViewInverseMatrix(Matrix.Invert(cam.ViewMatrix));
            CheckerEffect.setViewMatrix(cam.ViewMatrix);
            CheckerEffect.setWorldInverseTransposeMatrix(Matrix.Transpose(Matrix.Invert(World * cam.WorldMatrix)));
            CheckerEffect.setWorldMatrix(World * cam.WorldMatrix);
            CheckerEffect.setWorldViewProjectionMatrix(World * cam.WorldMatrix * cam.ViewMatrix * cam.ProjectionMatrix);
            checkerEffect.setWorldViewMatrix(World * cam.WorldMatrix * cam.ViewMatrix);

            Game.GraphicsDevice.Vertices[0].SetSource(vertexBuffer, 0, VertexPositionNormalTexture.SizeInBytes);
            Game.GraphicsDevice.VertexDeclaration = vertexDeclaration;
            CheckerEffect.Effect.Begin();
            foreach (EffectPass pass in CheckerEffect.Effect.CurrentTechnique.Passes)
            {
                pass.Begin();
                Game.GraphicsDevice.DrawPrimitives(PrimitiveType.TriangleList, 0, 12);
                pass.End();
            }
            CheckerEffect.Effect.End();

            base.Draw(gameTime);
        }