first person camera
All checks were successful
studiorailgun/Renderer/pipeline/head This commit looks good

This commit is contained in:
austin 2024-05-07 22:13:08 -04:00
parent ac12b3f5a8
commit baf7bf976d
5 changed files with 32 additions and 5 deletions

View File

@ -266,6 +266,13 @@ Clean up data
- Tree Model Paths
(05/07/2024)
Ground Texture Atlas system
- Refactor to block main thread only when creating the actual texture object (load buffered image separately)
First Person Camera
# TODO
Character movement in particular feels off
@ -292,9 +299,6 @@ Data Cleanup
Clean up Material class
- fix storing textures in the mat class ( pain :c )
Ground Texture Atlas system
- Refactor to block main thread only when creating the actual texture object (load buffered image separately)
More Debug menus
- Screen that shows the overall status of draw cell manager
- Screen that shows the overall status of fluid cell manager

View File

@ -19,6 +19,7 @@ import org.ode4j.ode.DRay;
import org.ode4j.ode.OdeHelper;
import electrosphere.collision.collidable.Collidable;
import electrosphere.engine.Globals;
import electrosphere.entity.Entity;
public class RayCastCallback implements DNearCallback {
@ -82,7 +83,8 @@ void RayCallback(void *Data, dGeomID Geometry1, dGeomID Geometry2) {
(o2 instanceof DRay && rayCastData.collidableTypeMask.contains(collidable1.getType()))
)
) ||
rayCastData.collidableTypeMask == null
rayCastData.collidableTypeMask == null &&
collidable2 != null && collidable2.getParent() != Globals.playerEntity //don't self cast -- should work on both server and client
){
//calculate collisions
int numc = OdeHelper.collide(o1,o2,MAX_CONTACTS,contacts.getGeomBuffer());

View File

@ -221,6 +221,9 @@ public class ControlHandler {
boolean shouldRecaptureScreen = false;
//controls whether the camera is first or third person
boolean cameraIsThirdPerson = false;
/*
Mouse event parsing related stuff
@ -1641,6 +1644,14 @@ public class ControlHandler {
public boolean shouldRecapture(){
return this.shouldRecaptureScreen;
}
/**
* Checks if the camera is third person
* @return true if third person, false if first person
*/
public boolean cameraIsThirdPerson(){
return cameraIsThirdPerson;
}
}

View File

@ -176,7 +176,11 @@ public class ClientLoading {
Player Camera
*/
Globals.playerCamera = CameraEntityUtils.spawnPlayerEntityTrackingCameraEntity(new Vector3f(1,0,1), new Vector3f(0,0,1));
if(Globals.controlHandler.cameraIsThirdPerson()){
Globals.playerCamera = CameraEntityUtils.spawnPlayerEntityTrackingCameraEntity(new Vector3f(1,0,1), new Vector3f(0,0,1));
} else {
Globals.playerCamera = CameraEntityUtils.spawnPlayerEntityTrackingCameraFirstPersonEntity(new Vector3f(1,0,1), new Vector3f(0,0,1));
}

View File

@ -6,6 +6,7 @@ import org.joml.Vector3d;
import electrosphere.engine.Globals;
import electrosphere.entity.ClientEntityUtils;
import electrosphere.entity.Entity;
import electrosphere.entity.EntityDataStrings;
import electrosphere.entity.EntityUtils;
import electrosphere.entity.state.attack.ClientAttackTree;
import electrosphere.entity.state.attack.ServerAttackTree;
@ -106,6 +107,11 @@ public class EntityProtocol {
if(Globals.clientPlayer != null && message.getpropertyValue() == Globals.clientPlayer.getId()){
Globals.clientCharacterID = message.getentityID();
Globals.playerEntity = target;
if(Globals.controlHandler.cameraIsThirdPerson()){
Globals.playerEntity.putData(EntityDataStrings.DATA_STRING_DRAW, true);
} else {
Globals.playerEntity.putData(EntityDataStrings.DATA_STRING_DRAW, false);
}
}
}
}