コード例 #1
0
        public void Draw(GameTime gameTime, Camera.Camera camera, States.Level level)
        {
            //Set the technique we will use
            effect.CurrentTechnique = effect.Techniques["Waves"];

            //Set the parameters of the effects
            effect.Parameters["waveTexture"].SetValue(texture);
            effect.Parameters["World"].SetValue(level.World);
            effect.Parameters["View"].SetValue(camera.viewMatrix);
            effect.Parameters["Projection"].SetValue(camera.projectionMatrix);
            effect.Parameters["time"].SetValue(time);
            effect.Parameters["alpha"].SetValue((float)alpha);

            //Apply the technique
            effect.CurrentTechnique.Passes[0].Apply();

            //Draw the vertices
            game.GraphicsDevice.DrawUserPrimitives(PrimitiveType.TriangleStrip, vertices, 0, 2);
        }
コード例 #2
0
        public override void Draw(GameTime gameTime)
        {
            graphicsDevice.BlendState = BlendState.AlphaBlend;

            // Set our effect to use the specified texture and camera matrices.
            level = (States.Level)game.Services.GetService(typeof(States.Level));

            effect.Texture    = texture;
            effect.World      = level.World;
            effect.View       = level.Cam.viewMatrix;
            effect.Projection = level.Cam.projectionMatrix;

            // Draw the quad.
            effect.CurrentTechnique.Passes[0].Apply();
            graphicsDevice.DrawUserPrimitives(PrimitiveType.TriangleStrip, vertices, 0, 2);

            graphicsDevice.BlendState = BlendState.Opaque;

            base.Draw(gameTime);
        }
コード例 #3
0
        public override void Draw(GameTime gameTime)
        {
            graphicsDevice.BlendState = BlendState.AlphaBlend;

            // Set our effect to use the specified texture and camera matrices.
            level = (States.Level)game.Services.GetService(typeof(States.Level));

            effect.Texture = texture;
            effect.World = level.World;
            effect.View = level.Cam.viewMatrix;
            effect.Projection = level.Cam.projectionMatrix;

            // Draw the quad.
            effect.CurrentTechnique.Passes[0].Apply();
            graphicsDevice.DrawUserPrimitives(PrimitiveType.TriangleStrip, vertices, 0, 2);

            graphicsDevice.BlendState = BlendState.Opaque;

            base.Draw(gameTime);
        }
コード例 #4
0
        public VerticalBillBoard(Vector3 origin, float height, Vector2 size, Texture2D texture, int xRowTextures, int yRowTextures, GraphicsDevice graphicsDevice, ContentManager content, Game1 game)
            : base(game)
        {
            this.origin         = origin;
            this.size           = size;
            this.texture        = texture;
            this.xRowTextures   = xRowTextures;
            this.yRowTextures   = yRowTextures;
            this.graphicsDevice = graphicsDevice;
            this.content        = content;
            this.game           = game;

            camera = (Camera.Camera)game.Services.GetService(typeof(Camera.Camera));
            level  = (States.Level)game.Services.GetService(typeof(States.Level));

            bbEffect = game.Assets.Load <Effect>("bbeffect");

            //Calculates were the corner vectors of the quad are qoing to be
            CalcVertices();

            FillVertices();
        }
コード例 #5
0
        public VerticalBillBoard(Vector3 origin, float height, Vector2 size, Texture2D texture, int xRowTextures, int yRowTextures, GraphicsDevice graphicsDevice, ContentManager content, Game1 game)
            : base(game)
        {
            this.origin = origin;
            this.size = size;
            this.texture = texture;
            this.xRowTextures = xRowTextures;
            this.yRowTextures = yRowTextures;
            this.graphicsDevice = graphicsDevice;
            this.content = content;
            this.game = game;

            camera = (Camera.Camera)game.Services.GetService(typeof(Camera.Camera));
            level = (States.Level)game.Services.GetService(typeof(States.Level));

            bbEffect = game.Assets.Load<Effect>("bbeffect");

            //Calculates were the corner vectors of the quad are qoing to be
            CalcVertices();

            FillVertices();
        }
コード例 #6
0
        public HorizontalBillboarding(Vector3 origin, float height, Vector2 size, Texture2D texture, int xRowTextures, int yRowTextures, GraphicsDevice graphicsDevice, ContentManager content, Game game)
            : base(game)
        {
            this.origin         = origin;
            this.size           = size;
            this.texture        = texture;
            this.xRowTextures   = xRowTextures;
            this.yRowTextures   = yRowTextures;
            this.graphicsDevice = graphicsDevice;
            this.content        = content;
            this.game           = game;

            vertices = new VertexPositionNormalTexture[4];

            camera = (Camera.Camera)game.Services.GetService(typeof(Camera.Camera));
            level  = (States.Level)game.Services.GetService(typeof(States.Level));

            effect = new AlphaTestEffect(graphicsDevice);

            //Calculates were the corner vectors of the quad are qoing to be
            CalcVertices();

            FillVertices();
        }
コード例 #7
0
        public HorizontalBillboarding(Vector3 origin, float height, Vector2 size, Texture2D texture, int xRowTextures, int yRowTextures, GraphicsDevice graphicsDevice, ContentManager content, Game game)
            : base(game)
        {
            this.origin = origin;
            this.size = size;
            this.texture = texture;
            this.xRowTextures = xRowTextures;
            this.yRowTextures = yRowTextures;
            this.graphicsDevice = graphicsDevice;
            this.content = content;
            this.game = game;

            vertices = new VertexPositionNormalTexture[4];

            camera = (Camera.Camera)game.Services.GetService(typeof(Camera.Camera));
            level = (States.Level)game.Services.GetService(typeof(States.Level));

            effect = new AlphaTestEffect(graphicsDevice);

            //Calculates were the corner vectors of the quad are qoing to be
            CalcVertices();

            FillVertices();
        }