viewport camera lockdown
All checks were successful
studiorailgun/Renderer/pipeline/head This commit looks good

This commit is contained in:
austin 2024-09-05 00:21:21 -04:00
parent f78c8b6633
commit d2a8acf027
2 changed files with 90 additions and 76 deletions

View File

@ -41,6 +41,9 @@ public class CameraHandler {
//if set to true, the camera will track the player's entity //if set to true, the camera will track the player's entity
boolean trackPlayerEntity = true; boolean trackPlayerEntity = true;
//sets whether the camera handler should update the player's camera or not
boolean update = true;
/** /**
* Handles a mouse event * Handles a mouse event
* @param event The mouse event * @param event The mouse event
@ -75,6 +78,7 @@ public class CameraHandler {
*/ */
public void updateGlobalCamera(){ public void updateGlobalCamera(){
Globals.profiler.beginCpuSample("updateGlobalCamera"); Globals.profiler.beginCpuSample("updateGlobalCamera");
if(update){
if(Globals.playerCamera != null){ if(Globals.playerCamera != null){
cameraSpeed = 2.5f * (float)Globals.timekeeper.getMostRecentRawFrametime(); cameraSpeed = 2.5f * (float)Globals.timekeeper.getMostRecentRawFrametime();
@ -158,6 +162,7 @@ public class CameraHandler {
//update the cursor on client side //update the cursor on client side
updatePlayerCursor(); updatePlayerCursor();
} }
}
Globals.profiler.endCpuSample(); Globals.profiler.endCpuSample();
} }
@ -209,6 +214,14 @@ public class CameraHandler {
return trackPlayerEntity; return trackPlayerEntity;
} }
/**
* Sets whether the camera should update with player input or not
* @param update true to update with input, false otherwise
*/
public void setUpdate(boolean update){
this.update = update;
}

View File

@ -112,6 +112,7 @@ public class ClientLoading {
//init camera //init camera
Globals.playerCamera = CameraEntityUtils.spawnBasicCameraEntity(new Vector3f(0,0,0), new Vector3f(-1,0,0)); Globals.playerCamera = CameraEntityUtils.spawnBasicCameraEntity(new Vector3f(0,0,0), new Vector3f(-1,0,0));
Globals.cameraHandler.setTrackPlayerEntity(false); Globals.cameraHandler.setTrackPlayerEntity(false);
Globals.cameraHandler.setUpdate(false);
//initialize the "real" objects simulation //initialize the "real" objects simulation
initClientSimulation(); initClientSimulation();
//init foliage manager //init foliage manager