Beispiel #1
0
        /// <summary>
        /// Draws the primitive model, using a basicEffect shader with default
        /// lighting. Unlike the other Draw overload where you specify a custom
        /// basicEffect, this method sets important renderstates to sensible values
        /// for 3D model rendering, so you do not need to set these states before
        /// you call it.
        /// </summary>
        public void Draw(Matrix world, Color color, Camera camera, Vector3 light1Position, Vector3 light2Position, Texture2D texture, Options options, float colorIntensity = 1f)
        {
            basicEffect.World      = world;
            basicEffect.View       = camera.ViewMatrix;
            basicEffect.Projection = camera.ProjectionMatrix;

            BasicEffectHelper.SetNormalBasicEffect(basicEffect, light1Position, light2Position, color, null, options);

            // Draw the model, using basicEffect.
            Draw(basicEffect);
        }
Beispiel #2
0
        public override void Draw(GameTime gameTime, Matrix world, Camera camera, Vector3 light1Position, Vector3 light2Position)
        {
            base.Draw(gameTime, world, camera, light1Position, light2Position);
            foreach (ModelMesh mesh in Model.Meshes)
            {
                foreach (BasicEffect basicEffect in mesh.Effects)
                {
                    basicEffect.World      = GetWorldMatrix(world);
                    basicEffect.View       = camera.ViewMatrix;
                    basicEffect.Projection = camera.ProjectionMatrix;

                    BasicEffectHelper.SetNormalBasicEffect(basicEffect, light1Position, light2Position, Color, Texture, Options);
                }
                mesh.Draw();
            }
        }