示例#1
0
        private void DrawReflections(BoundingFrustum viewFrustum)
        {
            if (level.WaterHeight != Level.WATER_DISABLED_HEIGHT &&
                level.Water.TransparencyRatio > 0.0f)
            {
                graphicsDevice.SetRenderTarget(reflectionRT);
                graphicsDevice.Clear(Color.Black);

                BoundingFrustum reflViewFrustum = new BoundingFrustum(SharedEffectParameters.xReflectionViewMatrix
                                                                      * SharedEffectParameters.xReflectionProjectionMatrix);

                if (level.Type == LevelType.Outdoor)
                {
                    terrainRenderer.DrawReflection(level.Terrain);
                }

                // Draw mesh reflections
                foreach (Mesh mesh in level.MeshList)
                {
                    if (reflViewFrustum.Intersects(mesh.AABB))
                    {
                        meshRenderer.DrawMeshReflection(mesh, reflViewFrustum, level.WaterHeight);
                    }
                }

                // Draw target reflections
                foreach (ShootingTarget target in level.ShootingTargetList)
                {
                    target.DrawReflection(meshRenderer, reflViewFrustum, level.WaterHeight);
                }

                level.Sky.DrawCloudsReflection();
            }
        }
示例#2
0
 public void DrawReflection(MeshRenderer meshRenderer, BoundingFrustum lightViewFrustum,
                            float reflectionPlaneHeight)
 {
     // Draw the target mesh shadow
     meshRenderer.DrawMeshReflection(targetMesh, lightViewFrustum, reflectionPlaneHeight);
 }