コード例 #1
0
ファイル: Game1.cs プロジェクト: duaneking/Tychaia
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            occludingSpriteBatch = new OccludingSpriteBatch(GraphicsDevice);

            /*mySpriteBatch.Effect = new SpriteEffect(this.Content.Load<Effect>("SpriteEffect"));
             * mergingSpriteBatch = new MySpriteBatch(GraphicsDevice);
             * Effect directDepth = this.Content.Load<Effect>("DirectDepthEffect");
             * directDepth.Parameters["DepthTexture"].SetValue(this.gradient);
             * directDepth.CurrentTechnique.Passes[0].Apply();
             * mergingSpriteBatch.Effect = new SpriteEffect(directDepth);*/

            // TODO: use this.Content to load your game content here
            gradient     = this.Content.Load <Texture2D>("Gradient");
            personDepth  = this.Content.Load <Texture2D>("PersonDepth");
            personSprite = this.Content.Load <Texture2D>("PersonSprite");
            occludingSpriteBatch.DepthTexture = gradient;

            /*effect = this.Content.Load<Effect>("Effect1");
             * effect.Parameters["ColorScreenTexture"].SetValue(this.screenColorBuffer);
             * effect.Parameters["ColorWorldTexture"].SetValue(this.screenDepthBuffer);
             * effect.Parameters["DepthScreenTexture"].SetValue(this.worldColorBuffer);
             * effect.Parameters["DepthWorldTexture"].SetValue(this.worldDepthBuffer);
             * effect.CurrentTechnique.Passes[0].Apply();*/
        }
コード例 #2
0
        protected override void PreBegin(GameContext context)
        {
            // Process a single texture block if the FPS is higher than 30.
            //if (context.GameTime.ElapsedGameTime.Milliseconds < 100)
            //{
            ChunkProvider.ProcessSingle();
            ChunkRenderer.ProcessSingle(context.GameTime, context);
            //}

            // Ensure we have an occluding sprite batch.
            if (FilteredFeatures.IsEnabled(Feature.IsometricOcclusion))
            {
                if (this.m_OccludingSpriteBatch == null)
                {
                    this.m_OccludingSpriteBatch = new OccludingSpriteBatch(context.Graphics.GraphicsDevice);
                }
                this.m_OccludingSpriteBatch.Begin(true);
            }
            else
            {
                context.Graphics.GraphicsDevice.Clear(ClearOptions.DepthBuffer | ClearOptions.Target, Color.Black, 1f, 0);
            }
        }
コード例 #3
0
ファイル: Game1.cs プロジェクト: TreeSeed/Tychaia
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            occludingSpriteBatch = new OccludingSpriteBatch(GraphicsDevice);
            /*mySpriteBatch.Effect = new SpriteEffect(this.Content.Load<Effect>("SpriteEffect"));
            mergingSpriteBatch = new MySpriteBatch(GraphicsDevice);
            Effect directDepth = this.Content.Load<Effect>("DirectDepthEffect");
            directDepth.Parameters["DepthTexture"].SetValue(this.gradient);
            directDepth.CurrentTechnique.Passes[0].Apply();
            mergingSpriteBatch.Effect = new SpriteEffect(directDepth);*/

            // TODO: use this.Content to load your game content here
            gradient = this.Content.Load<Texture2D>("Gradient");
            personDepth = this.Content.Load<Texture2D>("PersonDepth");
            personSprite = this.Content.Load<Texture2D>("PersonSprite");
            occludingSpriteBatch.DepthTexture = gradient;
            /*effect = this.Content.Load<Effect>("Effect1");
            effect.Parameters["ColorScreenTexture"].SetValue(this.screenColorBuffer);
            effect.Parameters["ColorWorldTexture"].SetValue(this.screenDepthBuffer);
            effect.Parameters["DepthScreenTexture"].SetValue(this.worldColorBuffer);
            effect.Parameters["DepthWorldTexture"].SetValue(this.worldDepthBuffer);
            effect.CurrentTechnique.Passes[0].Apply();*/
        }