mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-23 20:57:12 -04:00
Core: Allow building up to 16 chunks per frame.
This commit is contained in:
parent
d1d31e8db1
commit
d24a929267
@ -40,10 +40,10 @@ namespace ClassicalSharp.Gui.Widgets {
|
||||
public Anchor VerticalAnchor;
|
||||
|
||||
/// <summary> Horizontal offset from the reference point in pixels. </summary>
|
||||
public int XOffset = 0;
|
||||
public int XOffset;
|
||||
|
||||
/// <summary> Vertical offset from the reference point in pixels. </summary>
|
||||
public int YOffset = 0;
|
||||
public int YOffset;
|
||||
|
||||
/// <summary> Width and height of widget in pixels. </summary>
|
||||
public Size Size { get { return new Size( Width, Height ); } }
|
||||
|
@ -32,16 +32,6 @@ namespace ClassicalSharp.Commands {
|
||||
return arg;
|
||||
}
|
||||
|
||||
bool MoveNext() {
|
||||
if( curOffset >= rawInput.Length ) return false;
|
||||
int next = rawInput.IndexOf( ' ', curOffset );
|
||||
if( next == -1 ) {
|
||||
next = rawInput.Length;
|
||||
}
|
||||
curOffset = next + 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
public CommandReader( string input ) {
|
||||
rawInput = input.TrimEnd( ' ' );
|
||||
curOffset = 1; // skip start / for the ocmmand
|
||||
|
@ -164,15 +164,15 @@ namespace ClassicalSharp.Entities {
|
||||
if( hacks.FlyingUp || jumping ) entity.Velocity.Y += yVel;
|
||||
if( hacks.FlyingDown ) entity.Velocity.Y -= yVel;
|
||||
}
|
||||
Move( xMoving, zMoving, factor, drag, gravity, yMul );
|
||||
Move( drag, gravity, yMul );
|
||||
}
|
||||
|
||||
void MoveNormal( float xMoving, float zMoving, float factor, Vector3 drag, float gravity, float yMul ) {
|
||||
AdjHeadingVelocity( zMoving, xMoving, factor );
|
||||
Move( xMoving, zMoving, factor, drag, gravity, yMul );
|
||||
Move( drag, gravity, yMul );
|
||||
}
|
||||
|
||||
void Move( float xMoving, float zMoving, float factor, Vector3 drag, float gravity, float yMul ) {
|
||||
void Move( Vector3 drag, float gravity, float yMul ) {
|
||||
entity.Velocity.Y *= yMul;
|
||||
if( !hacks.Noclip )
|
||||
collisions.MoveAndWallSlide();
|
||||
|
@ -324,14 +324,14 @@ namespace ClassicalSharp.Renderers {
|
||||
public void UpdateChunks( double delta ) {
|
||||
int chunkUpdates = 0;
|
||||
chunksTarget += delta < targetTime ? 1 : -1; // build more chunks if 30 FPS or over, otherwise slowdown.
|
||||
Utils.Clamp( ref chunksTarget, 4, 12 );
|
||||
Utils.Clamp( ref chunksTarget, 4, 16 );
|
||||
|
||||
LocalPlayer p = game.LocalPlayer;
|
||||
Vector3 cameraPos = game.CurrentCameraPos;
|
||||
bool samePos = cameraPos == lastCamPos && p.HeadYawDegrees == lastYaw
|
||||
&& p.PitchDegrees == lastPitch;
|
||||
renderer.renderCount = samePos ? UpdateChunksStill( delta, ref chunkUpdates ) :
|
||||
UpdateChunksAndVisibility( delta, ref chunkUpdates );
|
||||
renderer.renderCount = samePos ? UpdateChunksStill( ref chunkUpdates ) :
|
||||
UpdateChunksAndVisibility( ref chunkUpdates );
|
||||
|
||||
lastCamPos = cameraPos;
|
||||
lastYaw = p.HeadYawDegrees; lastPitch = p.PitchDegrees;
|
||||
@ -341,7 +341,7 @@ namespace ClassicalSharp.Renderers {
|
||||
Vector3 lastCamPos;
|
||||
float lastYaw, lastPitch;
|
||||
|
||||
int UpdateChunksAndVisibility( double deltaTime, ref int chunkUpdates ) {
|
||||
int UpdateChunksAndVisibility( ref int chunkUpdates ) {
|
||||
ChunkInfo[] chunks = renderer.chunks, render = renderer.renderChunks;
|
||||
int j = 0;
|
||||
int viewDistSqr = AdjustViewDist( game.ViewDistance );
|
||||
@ -367,7 +367,7 @@ namespace ClassicalSharp.Renderers {
|
||||
return j;
|
||||
}
|
||||
|
||||
int UpdateChunksStill( double deltaTime, ref int chunkUpdates ) {
|
||||
int UpdateChunksStill( ref int chunkUpdates ) {
|
||||
ChunkInfo[] chunks = renderer.chunks, render = renderer.renderChunks;
|
||||
int j = 0;
|
||||
int viewDistSqr = AdjustViewDist( game.ViewDistance );
|
||||
|
Loading…
x
Reference in New Issue
Block a user