コード例 #1
0
ファイル: PointMesh.cs プロジェクト: geoffreylhart/Zenith
        public override void DrawDebug(GraphicsDevice graphicsDevice, Matrix world, Matrix view, Matrix projection)
        {
            Effect effect = GlobalContent.PointsShader;

            effect.Parameters["WVP"].SetValue(world * view * projection);
            effect.Parameters["PointSize"].SetValue(new Vector2(10f / graphicsDevice.Viewport.Width, 10f / graphicsDevice.Viewport.Height));
            buffer.Draw(PrimitiveType.TriangleList, graphicsDevice, effect);
        }
コード例 #2
0
        public override void Draw(GraphicsDevice graphicsDevice, Matrix world, Matrix view, Matrix projection)
        {
            BasicEffect effect = new BasicEffect(graphicsDevice);

            effect.World                          = world;
            effect.View                           = view;
            effect.Projection                     = projection;
            effect.DiffuseColor                   = new Vector3(1, 1, 1);
            effect.AmbientLightColor              = new Vector3(0.1f, 0.1f, 0.1f);
            effect.LightingEnabled                = true;
            effect.DirectionalLight0.Enabled      = true;
            effect.DirectionalLight0.DiffuseColor = new Vector3(0.9f, 0.9f, 0.9f);
            var direction = new Vector3(2, -2, 10);

            direction.Normalize();
            effect.DirectionalLight0.Direction = direction;
            buffer.Draw(PrimitiveType.TriangleList, graphicsDevice, effect);
        }
コード例 #3
0
ファイル: PlaneGrid.cs プロジェクト: geoffreylhart/Zenith
        public override void DrawDebug(GraphicsDevice graphics, Matrix world, Matrix view, Matrix projection)
        {
            BasicEffect effect = new BasicEffect(graphics);

            effect.World              = world;
            effect.View               = view;
            effect.Projection         = projection;
            effect.VertexColorEnabled = true;
            buffer.Draw(PrimitiveType.LineList, graphics, effect);
        }
コード例 #4
0
ファイル: BoxOutline.cs プロジェクト: geoffreylhart/Zenith
 public override void DrawDebug(GraphicsDevice graphics, Matrix world, Matrix view, Matrix projection)
 {
     if (boundingBox.Min == boundingBox.Max)
     {
         BasicEffect effect = new BasicEffect(graphics);
         effect.World              = Matrix.CreateTranslation(boundingBox.Min) * world;
         effect.View               = view;
         effect.Projection         = projection;
         effect.VertexColorEnabled = true;
         effect.DiffuseColor       = boxColor.ToVector3();
         emptyBuffer.Draw(PrimitiveType.LineList, graphics, effect);
     }
     else
     {
         BasicEffect effect = new BasicEffect(graphics);
         effect.World              = Matrix.CreateScale(boundingBox.Max - boundingBox.Min) * Matrix.CreateTranslation(boundingBox.Min) * world;
         effect.View               = view;
         effect.Projection         = projection;
         effect.VertexColorEnabled = true;
         effect.DiffuseColor       = boxColor.ToVector3();
         boxBuffer.Draw(PrimitiveType.LineList, graphics, effect);
     }
 }