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 ); }
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))); }
public bool Contains(ref Vector2 point) { return(AABB.Contains(ref point)); }
public bool Contains(ref Vector2 vector) { return(_aabb.Contains(vector)); }