Пример #1
0
        public void Draw(Camera camera)
        {
            _lineEffect.World = camera.WorldMatrix;
            _lineEffect.View = camera.ViewMatrix;
            _lineEffect.Projection = camera.ProjectionMatrix;

            _lineEffect.CurrentTechnique.Passes[0].Apply();
            _graphics.DrawUserPrimitives(PrimitiveType.LineList, _lineVertices, 0, _lineVertices.Length / 2);
        }
Пример #2
0
        public void Draw(Camera camera)
        {
            if (Enabled)
            {
                _graphics.DepthStencilState = DepthStencilState.Default;

                _effect.View = camera.ViewMatrix;
                _effect.Projection = camera.ProjectionMatrix;

                _effect.CurrentTechnique.Passes[0].Apply();
                _graphics.DrawUserPrimitives(PrimitiveType.LineList, _vertexData, 0, _nrOfLines);
            }
        }
Пример #3
0
        public void Load()
        {
            _dottedLine = Engine.ContentLoader.GetLoadedTexture("DottedLine");

            _camera = new Camera(GraphicsDevice.Viewport.AspectRatio, new Vector3(6f, 6f, 6f), Vector3.Zero);
            _snapGrid = new SnapGrid(GraphicsDevice, 10);
            _controlAxis = new ControlAxis();
            _spriteBatch = new SpriteBatch(GraphicsDevice);

            const float scale = 0.13f;
            Cube cube = new Cube();
            for (int i = 0; i < cube.VertexData.Length; i++)
            {
                Utils.VerticesOfControlVertex[i] = new VertexPositionColor(cube.VertexData[i].Position * scale, Color.White);
            }

            Engine.ActiveControlAxis = _controlAxis;
            Engine.ActiveCamera = _camera;
            Engine.SpriteBatch = _spriteBatch;
        }
Пример #4
0
        /// <summary>
        /// Initializes the control.
        /// </summary>
        protected override void Initialize()
        {
            Camera = new Camera(GraphicsDevice.Viewport.AspectRatio, new Vector3(0f, 500f, 50f), Vector3.Zero);

            _grid = new GridComponent(GraphicsDevice, 8);
            _controlAxis = new ControlAxis(GraphicsDevice);

            // Start the animation timer.
            timer = Stopwatch.StartNew();

            // Hook the idle event to constantly redraw our animation.
            Application.Idle += delegate { Invalidate(); };
        }
Пример #5
0
        public void Draw(Camera camera)
        {
            Engine.ActiveGraphicsDevice.DepthStencilState = DepthStencilState.Default;
            Engine.ActiveGraphicsDevice.RasterizerState = RasterizerState.CullNone;

            _basicEffect.World = camera.WorldMatrix;
            _basicEffect.View = camera.ViewMatrix;
            _basicEffect.Projection = camera.ProjectionMatrix;

            _basicEffect.DiffuseColor = Color.White.ToVector3();

            _basicEffect.CurrentTechnique.Passes[0].Apply();

            if (_primitiveCount > 0)
                Engine.ActiveGraphicsDevice.DrawUserPrimitives(_primitiveType, _vertexData, 0, _primitiveCount);

            if (Engine.EntitySelectionPool.Contains(this))
            {
                switch (Engine.ActiveSubObjectMode)
                {
                    case SubObjectMode.Vertex:
                        DrawConrtolVertices();
                        break;
                    case SubObjectMode.Edge:
                        DrawControlEdges();
                        break;
                    case SubObjectMode.Triangle:
                        DrawControlTriangles();
                        break;
                }
                DrawSelectionBox();
            }

            if (Engine.ActiveDrawMode == DrawMode.WithEdges &&
                Engine.ActiveSubObjectMode != SubObjectMode.Edge)
                DrawControlEdges();
        }
Пример #6
0
 public static void Draw(Camera camera)
 {
     foreach (SceneEntity entity in SceneEntities)
         entity.Draw(camera);
 }