Ejemplo n.º 1
0
        public void RenderAll(Camera renderCamera, DwarfTime gameTime, GraphicsDevice graphicsDevice, Shader effect, Matrix worldMatrix, Texture2D tilemap)
        {
            effect.SelfIlluminationTexture  = ChunkData.IllumMap;
            effect.MainTexture              = tilemap;
            effect.SunlightGradient         = ChunkData.SunMap;
            effect.AmbientOcclusionGradient = ChunkData.AmbientMap;
            effect.TorchlightGradient       = ChunkData.TorchMap;
            effect.LightRampTint            = Color.White;
            effect.VertexColorTint          = Color.White;
            effect.SelfIlluminationEnabled  = true;
            effect.EnableShadows            = false;

            BoundingFrustum cameraFrustrum = renderCamera.GetFrustrum();

            foreach (EffectPass pass in effect.CurrentTechnique.Passes)
            {
                pass.Apply();
                foreach (var chunk in ChunkData.GetChunkEnumerator())
                {
                    if (cameraFrustrum.Intersects(chunk.GetBoundingBox()))
                    {
                        chunk.Render(Graphics);
                    }
                }
            }
            effect.SelfIlluminationEnabled = false;
        }
Ejemplo n.º 2
0
 public void RenderForMinimap(Camera renderCamera, DwarfTime gameTime, GraphicsDevice graphicsDevice, Shader effect, Matrix worldMatrix, Texture2D tilemap)
 {
     effect.SelfIlluminationTexture  = AssetManager.GetContentTexture(ContentPaths.Terrain.terrain_illumination);
     effect.MainTexture              = tilemap;
     effect.SunlightGradient         = AssetManager.GetContentTexture(ContentPaths.Gradients.sungradient);
     effect.AmbientOcclusionGradient = AssetManager.GetContentTexture(ContentPaths.Gradients.ambientgradient);
     effect.TorchlightGradient       = AssetManager.GetContentTexture(ContentPaths.Gradients.torchgradient);
     effect.LightRamp               = Color.White;
     effect.VertexColorTint         = Color.White;
     effect.SelfIlluminationEnabled = true;
     effect.EnableShadows           = false;
     foreach (EffectPass pass in effect.CurrentTechnique.Passes)
     {
         pass.Apply();
         foreach (var chunk in ChunkData.GetChunkEnumerator())
         {
             chunk.Render(GameState.Game.GraphicsDevice);
         }
     }
     effect.SelfIlluminationEnabled = false;
 }
Ejemplo n.º 3
0
        public void UpdateBounds()
        {
            var boundingBoxes = chunkData.GetChunkEnumerator().Select(c => c.GetBoundingBox());

            Bounds = MathFunctions.GetBoundingBox(boundingBoxes);
        }