예제 #1
0
        void UpdateFog()
        {
            if( map.IsNotLoaded ) return;
            FastColour adjFogCol = FastColour.White;
            BlockInfo info = game.BlockInfo;

            Vector3 pos = game.CurrentCameraPos;
            Vector3I coords = Vector3I.Floor( pos );
            byte block = game.World.SafeGetBlock( coords );
            AABB blockBB = new AABB(
                (Vector3)coords + info.MinBB[block],
                (Vector3)coords + info.MaxBB[block] );

            if( blockBB.Contains( pos ) && info.FogDensity[block] != 0 ) {
                graphics.SetFogMode( Fog.Exp );
                graphics.SetFogDensity( info.FogDensity[block] );
                adjFogCol = info.FogColour[block];
            } else {
                // Blend fog and sky together
                float blend = (float)BlendFactor( game.ViewDistance );
                adjFogCol = FastColour.Lerp( map.Env.FogCol, map.Env.SkyCol, blend );
                graphics.SetFogMode( Fog.Linear );
                graphics.SetFogEnd( game.ViewDistance );
            }
            graphics.ClearColour( adjFogCol );
            graphics.SetFogColour( adjFogCol );
        }
예제 #2
0
        public static void Contains_float3_nonzero_extents()
        {
            var  extents = new float3(0.5f, 0.5f, 0.5f);
            AABB aabb    = new AABB {
                Extents = extents
            };

            TestUtils.IsTrue(aabb.Contains(float3.zero));
            TestUtils.IsTrue(aabb.Contains(new float3(0.5f, 0.0f, 0.0f)));
            TestUtils.IsTrue(aabb.Contains(new float3(-0.5f, 0.0f, 0.0f)));
            TestUtils.IsTrue(aabb.Contains(new float3(0.0f, 0.5f, 0.0f)));
            TestUtils.IsTrue(aabb.Contains(new float3(0.0f, -0.5f, 0.0f)));
            TestUtils.IsTrue(aabb.Contains(new float3(0.0f, 0.0f, 0.5f)));
            TestUtils.IsTrue(aabb.Contains(new float3(0.0f, 0.0f, -0.5f)));

            TestUtils.IsFalse(aabb.Contains(new float3(0.6f, 0.0f, 0.0f)));
            TestUtils.IsFalse(aabb.Contains(new float3(-0.6f, 0.0f, 0.0f)));
            TestUtils.IsFalse(aabb.Contains(new float3(0.0f, 0.6f, 0.0f)));
            TestUtils.IsFalse(aabb.Contains(new float3(0.0f, -0.6f, 0.0f)));
            TestUtils.IsFalse(aabb.Contains(new float3(0.0f, 0.0f, 0.6f)));
            TestUtils.IsFalse(aabb.Contains(new float3(0.0f, 0.0f, -0.6f)));
        }
예제 #3
0
 public bool Contains(ref Vector2 point)
 {
     return(AABB.Contains(ref point));
 }
예제 #4
0
 public bool Contains(ref Vector2 vector)
 {
     return(_aabb.Contains(vector));
 }