All pastes #637001 Raw Edit

Anonymous

public text v1 · immutable
#637001 ·published 2007-07-28 13:02 UTC
rendered paste body
        protected override void Draw(GameTime gameTime)
        {
            graphics.GraphicsDevice.Clear(Color.TransparentBlack);


            scene.Render(graphics.GraphicsDevice, gameTime, camera);





            graphics.GraphicsDevice.SetRenderTarget(0, renderTarget);

            graphics.GraphicsDevice.Clear(Color.TransparentBlack);

            Matrix[] transforms = new Matrix[soldierModel.Bones.Count];
            float aspectRatio = graphics.GraphicsDevice.Viewport.Width / graphics.GraphicsDevice.Viewport.Height;
            soldierModel.CopyAbsoluteBoneTransformsTo(transforms);
            Matrix projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.ToRadians(45.0f), aspectRatio, 1.0f, 10000.0f);
            Matrix view = Matrix.CreateLookAt(new Vector3(0.0f, 50.0f, 800f), Vector3.Zero, Vector3.Up);

            Matrix MyWorldRotation = Matrix.CreateRotationX(MathHelper.ToRadians(30));

            foreach (ModelMesh mesh in soldierModel.Meshes)
            {
                foreach (BasicEffect effect in mesh.Effects)
                {
                    effect.EnableDefaultLighting();

                    effect.View = view;
                    effect.Projection = projection;
                    effect.World = MyWorldRotation * transforms[mesh.ParentBone.Index] * Matrix.CreateTranslation(new Vector3(0, 100, 0));
                }
                mesh.Draw();
            }




            graphics.GraphicsDevice.ResolveRenderTarget(0);
            graphics.GraphicsDevice.SetRenderTarget(0, null);

            resolveTexture = renderTarget.GetTexture();

            batch.Begin(SpriteBlendMode.AlphaBlend);
            batch.Draw(resolveTexture, camera.GetOffset(new Vector2(100, 100)), null, Color.White, 0, Vector2.Zero, new Vector2(0.5f, 0.5f), SpriteEffects.None, 0);
            batch.End();

            base.Draw(gameTime);
        }