Example #1
0
 public virtual void Draw(GraphicsDevice graphicsDevice, EngineCamera forCamera)
 {
     foreach (PlanePrimitive boundary in boundaries)
         boundary.Draw(graphicsDevice, forCamera);
     foreach (EngineModel model in models)
         model.Draw(forCamera);
     testCube.Draw(graphicsDevice, forCamera);
 }
        public override void Initialize()
        {
            base.Initialize();

            if (Camera == null)
            {
                Camera = new EngineCamera(GraphicsDevice);
            }
        }
Example #3
0
 public override void Draw(GraphicsDevice graphicsDevice, EngineCamera forCamera)
 {
     if (_vertexBuffer == null)
         _vertexBuffer = new VertexBuffer(graphicsDevice, VertexPositionColorTexture.SizeInBytes *
             _vertice.Length, BufferUsage.WriteOnly);
     _vertexBuffer.SetData(_vertice);
     graphicsDevice.Vertices[0].SetSource(_vertexBuffer, 0, VertexPositionColorTexture.SizeInBytes);
     graphicsDevice.VertexDeclaration = new VertexDeclaration(graphicsDevice,
         VertexPositionColorTexture.VertexElements);
     graphicsDevice.DrawPrimitives(PrimitiveType.TriangleList, 0, 2);
 }
Example #4
0
        public void Draw(EngineCamera forCamera)
        {
            if (!Visible)
                return;

            Matrix[] transformations = new Matrix[model.Bones.Count];
            Matrix objectMatrix = Matrix.CreateScale(scale) *
                Matrix.CreateRotationX(rotation.X) *
                Matrix.CreateRotationY(rotation.Y) *
                Matrix.CreateRotationZ(rotation.Z) *
                Matrix.CreateTranslation(position);
            model.CopyAbsoluteBoneTransformsTo(transformations);
            foreach (ModelMesh mesh in model.Meshes)
            {
                foreach (BasicEffect effect in mesh.Effects)
                {
                    effect.EnableDefaultLighting();
                    effect.PreferPerPixelLighting = true;
                    effect.World = objectMatrix;
                    effect.View = forCamera.ViewMatrix;
                    effect.Projection = forCamera.ProjectionMatrix;
                }
                mesh.Draw();
            }
        }
Example #5
0
 public EnginePlayer(EngineCamera camera)
     : base()
 {
     AttachedObjects.Add(camera);
 }