mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-15 02:25:32 -04:00
Only apply fog when exactly intersecting with the block.
This commit is contained in:
parent
95bc4a3c03
commit
c52534923f
@ -49,7 +49,7 @@ namespace ClassicalSharp {
|
||||
legXRot = -(float)(Math.Cos( walkTime ) * swing * legMax);
|
||||
armZRot = -idleZRot;
|
||||
|
||||
bobYOffset = (float)(Math.Abs( Math.Cos( walkTime ) ) * swing * (3/16f));
|
||||
bobYOffset = (float)(Math.Abs( Math.Cos( walkTime ) ) * swing * (2.5f/16f));
|
||||
tilt = (float)Math.Cos( walkTime ) * swing * (0.15f * Utils.Deg2Rad);
|
||||
if( Model is PlayerModel )
|
||||
CalcHumanAnim( idleXRot, idleZRot );
|
||||
|
@ -122,13 +122,21 @@ namespace ClassicalSharp.Renderers {
|
||||
void ResetFog() {
|
||||
if( map.IsNotLoaded ) return;
|
||||
FastColour adjFogCol = FastColour.White;
|
||||
Block headBlock = game.LocalPlayer.BlockAtHead;
|
||||
BlockInfo info = game.BlockInfo;
|
||||
BoundingBox pBounds = game.LocalPlayer.CollisionBounds;
|
||||
|
||||
if( info.FogDensity[(byte)headBlock] != 0 ) {
|
||||
Vector3I headCoords = Vector3I.Floor( game.LocalPlayer.EyePosition );
|
||||
Vector3 pos = (Vector3)headCoords;
|
||||
byte headBlock = game.Map.SafeGetBlock( headCoords );
|
||||
BoundingBox blockBB = new BoundingBox( pos + game.BlockInfo.MinBB[headBlock],
|
||||
pos + game.BlockInfo.MaxBB[headBlock] );
|
||||
BoundingBox localBB = game.LocalPlayer.CollisionBounds;
|
||||
bool intersecting = blockBB.Intersects( localBB );
|
||||
|
||||
if( intersecting && info.FogDensity[headBlock] != 0 ) {
|
||||
graphics.SetFogMode( Fog.Exp );
|
||||
graphics.SetFogDensity( info.FogDensity[(byte)headBlock] );
|
||||
adjFogCol = info.FogColour[(byte)headBlock];
|
||||
graphics.SetFogDensity( info.FogDensity[headBlock] );
|
||||
adjFogCol = info.FogColour[headBlock];
|
||||
} else {
|
||||
// Blend fog and sky together
|
||||
float blend = (float)BlendFactor( game.ViewDistance );
|
||||
|
Loading…
x
Reference in New Issue
Block a user