POV switching
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit
This commit is contained in:
parent
570086c2cc
commit
58c5ac0512
@ -339,7 +339,7 @@
|
|||||||
"name" : "Jump"
|
"name" : "Jump"
|
||||||
},
|
},
|
||||||
"animationFirstPersonAttack" : {
|
"animationFirstPersonAttack" : {
|
||||||
"name" : "Jump"
|
"name" : "Sword1HSlash1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -364,7 +364,7 @@
|
|||||||
"name" : "Jump"
|
"name" : "Jump"
|
||||||
},
|
},
|
||||||
"animationFirstPersonAttack" : {
|
"animationFirstPersonAttack" : {
|
||||||
"name" : "Jump"
|
"name" : "Sword1HSlash2"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@ -447,6 +447,10 @@ Overflow handling
|
|||||||
AI scaffolding
|
AI scaffolding
|
||||||
Attacker ai tree
|
Attacker ai tree
|
||||||
|
|
||||||
|
(07/24/2024)
|
||||||
|
2 Hand katana
|
||||||
|
Switching between first and third person
|
||||||
|
|
||||||
|
|
||||||
# TODO
|
# TODO
|
||||||
|
|
||||||
|
|||||||
@ -92,6 +92,7 @@ import electrosphere.entity.state.movement.SprintTree;
|
|||||||
import electrosphere.entity.state.movement.groundmove.ClientGroundMovementTree;
|
import electrosphere.entity.state.movement.groundmove.ClientGroundMovementTree;
|
||||||
import electrosphere.entity.state.movement.groundmove.ClientGroundMovementTree.MovementRelativeFacing;
|
import electrosphere.entity.state.movement.groundmove.ClientGroundMovementTree.MovementRelativeFacing;
|
||||||
import electrosphere.entity.state.movement.groundmove.ClientGroundMovementTree.MovementTreeState;
|
import electrosphere.entity.state.movement.groundmove.ClientGroundMovementTree.MovementTreeState;
|
||||||
|
import electrosphere.entity.types.attach.AttachUtils;
|
||||||
import electrosphere.entity.types.camera.CameraEntityUtils;
|
import electrosphere.entity.types.camera.CameraEntityUtils;
|
||||||
import electrosphere.entity.types.creature.CreatureUtils;
|
import electrosphere.entity.types.creature.CreatureUtils;
|
||||||
import electrosphere.logger.LoggerInterface;
|
import electrosphere.logger.LoggerInterface;
|
||||||
@ -1857,6 +1858,19 @@ public class ControlHandler {
|
|||||||
public boolean cameraIsThirdPerson(){
|
public boolean cameraIsThirdPerson(){
|
||||||
return cameraIsThirdPerson;
|
return cameraIsThirdPerson;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the 1st/3rd person status of the camera
|
||||||
|
* @param isThirdPerson True for 3rd person, false for 1st person
|
||||||
|
*/
|
||||||
|
public void setIsThirdPerson(boolean isThirdPerson){
|
||||||
|
this.cameraIsThirdPerson = isThirdPerson;
|
||||||
|
CameraEntityUtils.initCamera();
|
||||||
|
ClientEquipState playerEquipState = ClientEquipState.getClientEquipState(Globals.playerEntity);
|
||||||
|
if(playerEquipState != null){
|
||||||
|
playerEquipState.evaluatePlayerAttachments();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -163,27 +163,27 @@ public class Main {
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
//uncomment to test loading a model into engine
|
//uncomment to test loading a model into engine
|
||||||
// if(1==1){
|
// if(1==1){
|
||||||
// Globals.assetManager.addModelPathToQueue("/Models/creatures/viewmodel.glb");
|
// Globals.assetManager.addModelPathToQueue("/Models/creatures/viewmodel.glb");
|
||||||
// Globals.assetManager.loadAssetsInQueue();
|
// Globals.assetManager.loadAssetsInQueue();
|
||||||
// electrosphere.renderer.model.Model model = Globals.assetManager.fetchModel("/Models/creatures/viewmodel.glb");
|
// electrosphere.renderer.model.Model model = Globals.assetManager.fetchModel("/Models/creatures/viewmodel.glb");
|
||||||
// // for(electrosphere.renderer.anim.Animation anim : model.getAnimations()){
|
// // for(electrosphere.renderer.anim.Animation anim : model.getAnimations()){
|
||||||
// // if(anim.name.equals("Armature|Idle1")){
|
// // if(anim.name.equals("Armature|Idle1")){
|
||||||
// // System.out.println(anim.duration);
|
// // System.out.println(anim.duration);
|
||||||
// // for(electrosphere.renderer.anim.AnimChannel channel : anim.channels){
|
// // for(electrosphere.renderer.anim.AnimChannel channel : anim.channels){
|
||||||
// // if(channel.getNodeID().equals("Torso")){
|
// // if(channel.getNodeID().equals("Torso")){
|
||||||
// // channel.fullDescribeChannel();
|
// // channel.fullDescribeChannel();
|
||||||
// // }
|
// // }
|
||||||
// // // System.out.println("CHannel: " + channel.getNodeID());
|
// // // System.out.println("CHannel: " + channel.getNodeID());
|
||||||
// // }
|
// // }
|
||||||
// // break;
|
// // break;
|
||||||
// // }
|
// // }
|
||||||
// // }
|
// // }
|
||||||
// model.describeHighLevel();
|
// model.describeHighLevel();
|
||||||
// // model.animations.get(0).fullDescribeAnimation();
|
// // model.animations.get(0).fullDescribeAnimation();
|
||||||
// // model.describeHighLevel();
|
// // model.describeHighLevel();
|
||||||
// System.exit(0);
|
// System.exit(0);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
//create the audio context
|
//create the audio context
|
||||||
if(Globals.RUN_CLIENT && !Globals.HEADLESS && Globals.RUN_AUDIO){
|
if(Globals.RUN_CLIENT && !Globals.HEADLESS && Globals.RUN_AUDIO){
|
||||||
|
|||||||
@ -26,7 +26,6 @@ import electrosphere.menu.mainmenu.MenuGeneratorsMultiplayer;
|
|||||||
import electrosphere.net.NetUtils;
|
import electrosphere.net.NetUtils;
|
||||||
import electrosphere.net.client.ClientNetworking;
|
import electrosphere.net.client.ClientNetworking;
|
||||||
import electrosphere.renderer.ui.elements.Window;
|
import electrosphere.renderer.ui.elements.Window;
|
||||||
import electrosphere.util.MathUtils;
|
|
||||||
|
|
||||||
public class ClientLoading {
|
public class ClientLoading {
|
||||||
|
|
||||||
@ -161,11 +160,7 @@ public class ClientLoading {
|
|||||||
Player Camera
|
Player Camera
|
||||||
|
|
||||||
*/
|
*/
|
||||||
if(Globals.controlHandler.cameraIsThirdPerson()){
|
CameraEntityUtils.initCamera();
|
||||||
Globals.playerCamera = CameraEntityUtils.spawnPlayerEntityTrackingCameraEntity(new Vector3f(1,0,1), MathUtils.getOriginVectorf());
|
|
||||||
} else {
|
|
||||||
Globals.playerCamera = CameraEntityUtils.spawnPlayerEntityTrackingCameraFirstPersonEntity(new Vector3f(1,0,1), MathUtils.getOriginVectorf());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@ -22,6 +22,7 @@ import electrosphere.entity.types.creature.CreatureUtils;
|
|||||||
import electrosphere.entity.types.item.ItemUtils;
|
import electrosphere.entity.types.item.ItemUtils;
|
||||||
import electrosphere.game.data.creature.type.equip.EquipPoint;
|
import electrosphere.game.data.creature.type.equip.EquipPoint;
|
||||||
import electrosphere.game.data.item.type.EquipWhitelist;
|
import electrosphere.game.data.item.type.EquipWhitelist;
|
||||||
|
import electrosphere.logger.LoggerInterface;
|
||||||
import electrosphere.net.parser.net.message.InventoryMessage;
|
import electrosphere.net.parser.net.message.InventoryMessage;
|
||||||
import electrosphere.net.parser.net.message.NetworkMessage;
|
import electrosphere.net.parser.net.message.NetworkMessage;
|
||||||
import electrosphere.net.synchronization.annotation.SynchronizedBehaviorTree;
|
import electrosphere.net.synchronization.annotation.SynchronizedBehaviorTree;
|
||||||
@ -326,6 +327,33 @@ public class ClientEquipState implements BehaviorTree {
|
|||||||
return equipMap.containsKey(point);
|
return equipMap.containsKey(point);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if the player has any attached entities, and if so, makes sure they're attached to the right model
|
||||||
|
* This should be used when we change the camera of the player (IE from first to third person or vice versa)
|
||||||
|
*/
|
||||||
|
public void evaluatePlayerAttachments(){
|
||||||
|
if(this.parent != Globals.playerEntity){
|
||||||
|
LoggerInterface.loggerEngine.ERROR(new IllegalStateException("Re-evaluating client attachments on non-player entity! This should only be called for the player's entity!"));
|
||||||
|
}
|
||||||
|
if(Globals.controlHandler.cameraIsThirdPerson()){
|
||||||
|
for(String occupiedPoint : this.getEquippedPoints()){
|
||||||
|
EquipPoint point = this.getEquipPoint(occupiedPoint);
|
||||||
|
Entity toEquip = this.equipMap.get(point.getEquipPointId());
|
||||||
|
AttachUtils.clientDetatchEntityFromEntityAtBone(Globals.firstPersonEntity, toEquip);
|
||||||
|
AttachUtils.clientAttachEntityToEntityAtBone(Globals.playerEntity, toEquip, point.getBone(), AttachUtils.getEquipPointRotationOffset(point.getOffsetRotation()));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for(String occupiedPoint : this.getEquippedPoints()){
|
||||||
|
EquipPoint point = this.getEquipPoint(occupiedPoint);
|
||||||
|
Entity toEquip = this.equipMap.get(point.getEquipPointId());
|
||||||
|
AttachUtils.clientDetatchEntityFromEntityAtBone(Globals.playerEntity, toEquip);
|
||||||
|
AttachUtils.clientAttachEntityToEntityAtBone(Globals.firstPersonEntity, toEquip, point.getFirstPersonBone(), AttachUtils.getEquipPointRotationOffset(point.getOffsetRotation()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void simulate(float deltaTime) {
|
public void simulate(float deltaTime) {
|
||||||
}
|
}
|
||||||
|
|||||||
@ -281,7 +281,6 @@ public class AttachUtils {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -439,8 +438,10 @@ public class AttachUtils {
|
|||||||
* Detatches an entity on the server
|
* Detatches an entity on the server
|
||||||
* @param parent The parent entity
|
* @param parent The parent entity
|
||||||
* @param toAttach The attached entity
|
* @param toAttach The attached entity
|
||||||
|
* @return The bone the entity was attached to
|
||||||
*/
|
*/
|
||||||
public static void serverDetatchEntityFromEntityAtBone(Entity parent, Entity toAttach){
|
public static String serverDetatchEntityFromEntityAtBone(Entity parent, Entity toAttach){
|
||||||
|
String bone = getTargetBone(toAttach);
|
||||||
ServerEntityTagUtils.removeTagFromEntity(toAttach, EntityTags.BONE_ATTACHED);
|
ServerEntityTagUtils.removeTagFromEntity(toAttach, EntityTags.BONE_ATTACHED);
|
||||||
toAttach.removeData(EntityDataStrings.ATTACH_ENTITY_IS_ATTACHED);
|
toAttach.removeData(EntityDataStrings.ATTACH_ENTITY_IS_ATTACHED);
|
||||||
toAttach.removeData(EntityDataStrings.ATTACH_PARENT);
|
toAttach.removeData(EntityDataStrings.ATTACH_PARENT);
|
||||||
@ -448,14 +449,17 @@ public class AttachUtils {
|
|||||||
if(parent.containsKey(EntityDataStrings.ATTACH_CHILDREN_LIST)){
|
if(parent.containsKey(EntityDataStrings.ATTACH_CHILDREN_LIST)){
|
||||||
getChildrenList(parent).remove(toAttach);
|
getChildrenList(parent).remove(toAttach);
|
||||||
}
|
}
|
||||||
|
return bone;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Detatches an entity on the client
|
* Detatches an entity on the client
|
||||||
* @param parent The parent entity
|
* @param parent The parent entity
|
||||||
* @param toAttach The attached entity
|
* @param toAttach The attached entity
|
||||||
|
* @return The bone the entity was attached to
|
||||||
*/
|
*/
|
||||||
public static void clientDetatchEntityFromEntityAtBone(Entity parent, Entity toAttach){
|
public static String clientDetatchEntityFromEntityAtBone(Entity parent, Entity toAttach){
|
||||||
|
String bone = getTargetBone(toAttach);
|
||||||
Globals.clientSceneWrapper.getScene().removeEntityFromTag(toAttach, EntityTags.BONE_ATTACHED);
|
Globals.clientSceneWrapper.getScene().removeEntityFromTag(toAttach, EntityTags.BONE_ATTACHED);
|
||||||
toAttach.removeData(EntityDataStrings.ATTACH_ENTITY_IS_ATTACHED);
|
toAttach.removeData(EntityDataStrings.ATTACH_ENTITY_IS_ATTACHED);
|
||||||
toAttach.removeData(EntityDataStrings.ATTACH_PARENT);
|
toAttach.removeData(EntityDataStrings.ATTACH_PARENT);
|
||||||
@ -463,6 +467,7 @@ public class AttachUtils {
|
|||||||
if(parent.containsKey(EntityDataStrings.ATTACH_CHILDREN_LIST)){
|
if(parent.containsKey(EntityDataStrings.ATTACH_CHILDREN_LIST)){
|
||||||
getChildrenList(parent).remove(toAttach);
|
getChildrenList(parent).remove(toAttach);
|
||||||
}
|
}
|
||||||
|
return bone;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -6,6 +6,7 @@ import electrosphere.entity.EntityCreationUtils;
|
|||||||
import electrosphere.entity.EntityDataStrings;
|
import electrosphere.entity.EntityDataStrings;
|
||||||
import electrosphere.entity.EntityUtils;
|
import electrosphere.entity.EntityUtils;
|
||||||
import electrosphere.entity.btree.BehaviorTree;
|
import electrosphere.entity.btree.BehaviorTree;
|
||||||
|
import electrosphere.util.MathUtils;
|
||||||
|
|
||||||
import org.joml.Matrix4f;
|
import org.joml.Matrix4f;
|
||||||
import org.joml.Quaternionf;
|
import org.joml.Quaternionf;
|
||||||
@ -105,6 +106,22 @@ public class CameraEntityUtils {
|
|||||||
Globals.clientScene.registerBehaviorTree(entityTrackingTree);
|
Globals.clientScene.registerBehaviorTree(entityTrackingTree);
|
||||||
return rVal;
|
return rVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes the camera
|
||||||
|
*/
|
||||||
|
public static void initCamera(){
|
||||||
|
//destroy if it already exists
|
||||||
|
if(Globals.playerCamera != null){
|
||||||
|
Globals.clientSceneWrapper.getScene().deregisterEntity(Globals.playerCamera);
|
||||||
|
}
|
||||||
|
//create
|
||||||
|
if(Globals.controlHandler.cameraIsThirdPerson()){
|
||||||
|
Globals.playerCamera = CameraEntityUtils.spawnPlayerEntityTrackingCameraEntity(new Vector3f(1,0,1), MathUtils.getOriginVectorf());
|
||||||
|
} else {
|
||||||
|
Globals.playerCamera = CameraEntityUtils.spawnPlayerEntityTrackingCameraFirstPersonEntity(new Vector3f(1,0,1), MathUtils.getOriginVectorf());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static Entity getOrbitalCameraTarget(Entity camera){
|
public static Entity getOrbitalCameraTarget(Entity camera){
|
||||||
return (Entity)camera.getData(EntityDataStrings.DATA_STRING_CAMERA_ORBIT_TARGET);
|
return (Entity)camera.getData(EntityDataStrings.DATA_STRING_CAMERA_ORBIT_TARGET);
|
||||||
|
|||||||
@ -221,6 +221,9 @@ public class ImGuiWindowMacros {
|
|||||||
if(ImGui.button("Toggle Player Camera Lock")){
|
if(ImGui.button("Toggle Player Camera Lock")){
|
||||||
Globals.cameraHandler.setTrackPlayerEntity(!Globals.cameraHandler.getTrackPlayerEntity());
|
Globals.cameraHandler.setTrackPlayerEntity(!Globals.cameraHandler.getTrackPlayerEntity());
|
||||||
}
|
}
|
||||||
|
if(ImGui.button("Toggle 1st/3rd Person")){
|
||||||
|
Globals.controlHandler.setIsThirdPerson(!Globals.controlHandler.cameraIsThirdPerson());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
playerEntityWindow.setOpen(false);
|
playerEntityWindow.setOpen(false);
|
||||||
|
|||||||
@ -8,7 +8,6 @@ import electrosphere.entity.ClientEntityUtils;
|
|||||||
import electrosphere.entity.Entity;
|
import electrosphere.entity.Entity;
|
||||||
import electrosphere.entity.EntityCreationUtils;
|
import electrosphere.entity.EntityCreationUtils;
|
||||||
import electrosphere.entity.EntityDataStrings;
|
import electrosphere.entity.EntityDataStrings;
|
||||||
import electrosphere.entity.EntityTags;
|
|
||||||
import electrosphere.entity.EntityUtils;
|
import electrosphere.entity.EntityUtils;
|
||||||
import electrosphere.entity.state.attack.ClientAttackTree;
|
import electrosphere.entity.state.attack.ClientAttackTree;
|
||||||
import electrosphere.entity.state.client.firstPerson.FirstPersonTree;
|
import electrosphere.entity.state.client.firstPerson.FirstPersonTree;
|
||||||
@ -160,15 +159,10 @@ public class EntityProtocol {
|
|||||||
if(Globals.clientPlayer != null && message.getpropertyValue() == Globals.clientPlayer.getId()){
|
if(Globals.clientPlayer != null && message.getpropertyValue() == Globals.clientPlayer.getId()){
|
||||||
Globals.clientCharacterID = message.getentityID();
|
Globals.clientCharacterID = message.getentityID();
|
||||||
Globals.playerEntity = target;
|
Globals.playerEntity = target;
|
||||||
if(Globals.controlHandler.cameraIsThirdPerson()){
|
if(viewModelData != null && viewModelData.getFirstPersonModelPath() != null){
|
||||||
Globals.playerEntity.putData(EntityDataStrings.DATA_STRING_DRAW, true);
|
Globals.firstPersonEntity = EntityCreationUtils.createClientSpatialEntity();
|
||||||
} else {
|
EntityCreationUtils.makeEntityDrawable(Globals.firstPersonEntity, viewModelData.getFirstPersonModelPath());
|
||||||
Globals.playerEntity.putData(EntityDataStrings.DATA_STRING_DRAW, false);
|
FirstPersonTree.attachTree(Globals.firstPersonEntity, viewModelData.getHeightFromOrigin(), viewModelData.getCameraViewDirOffsetY(), viewModelData.getCameraViewDirOffsetZ());
|
||||||
if(viewModelData != null && viewModelData.getFirstPersonModelPath() != null){
|
|
||||||
Globals.firstPersonEntity = EntityCreationUtils.createClientSpatialEntity();
|
|
||||||
EntityCreationUtils.makeEntityDrawable(Globals.firstPersonEntity, viewModelData.getFirstPersonModelPath());
|
|
||||||
FirstPersonTree.attachTree(Globals.firstPersonEntity, viewModelData.getHeightFromOrigin(), viewModelData.getCameraViewDirOffsetY(), viewModelData.getCameraViewDirOffsetZ());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -72,7 +72,11 @@ public class ClientSynchronizationManager {
|
|||||||
} break;
|
} break;
|
||||||
}
|
}
|
||||||
} else if(Globals.clientSceneWrapper.getEntityFromServerId(message.getentityId()) == null){
|
} else if(Globals.clientSceneWrapper.getEntityFromServerId(message.getentityId()) == null){
|
||||||
LoggerInterface.loggerNetworking.WARNING("Client received synchronization packet for entity that no longer exists on client!");
|
String errorMessage =
|
||||||
|
"Client received synchronization packet for entity that does not exists on client!\n" +
|
||||||
|
"Entity id in network message: " + message.getentityId()
|
||||||
|
;
|
||||||
|
LoggerInterface.loggerNetworking.ERROR(new IllegalStateException(errorMessage));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for(SynchronizationMessage message : messagesToClear){
|
for(SynchronizationMessage message : messagesToClear){
|
||||||
|
|||||||
@ -247,7 +247,16 @@ public class MainContentPipeline implements RenderPipeline {
|
|||||||
* @return True if in blacklist, false otherwise
|
* @return True if in blacklist, false otherwise
|
||||||
*/
|
*/
|
||||||
static boolean entityBlacklist(Entity entity){
|
static boolean entityBlacklist(Entity entity){
|
||||||
return entity == Globals.firstPersonEntity;
|
return
|
||||||
|
//don't draw first person view in this pipeline ever
|
||||||
|
entity == Globals.firstPersonEntity ||
|
||||||
|
|
||||||
|
//don't draw third person view if camera is first person
|
||||||
|
(
|
||||||
|
!Globals.controlHandler.cameraIsThirdPerson() &&
|
||||||
|
entity == Globals.playerEntity
|
||||||
|
)
|
||||||
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -65,11 +65,7 @@ public class NormalsForOutlinePipeline implements RenderPipeline {
|
|||||||
|
|
||||||
for(Entity currentEntity : Globals.clientScene.getEntitiesWithTag(EntityTags.DRAWABLE)){
|
for(Entity currentEntity : Globals.clientScene.getEntitiesWithTag(EntityTags.DRAWABLE)){
|
||||||
Vector3d position = EntityUtils.getPosition(currentEntity);
|
Vector3d position = EntityUtils.getPosition(currentEntity);
|
||||||
if(
|
if(shouldDraw(currentEntity)){
|
||||||
(boolean)currentEntity.getData(EntityDataStrings.DATA_STRING_DRAW) &&
|
|
||||||
currentEntity.getData(EntityDataStrings.DRAW_SOLID_PASS) != null &&
|
|
||||||
currentEntity.getData(EntityDataStrings.DRAW_OUTLINE) != null
|
|
||||||
){
|
|
||||||
//fetch actor
|
//fetch actor
|
||||||
Actor currentActor = EntityUtils.getActor(currentEntity);
|
Actor currentActor = EntityUtils.getActor(currentEntity);
|
||||||
//calculate camera-modified vector3f
|
//calculate camera-modified vector3f
|
||||||
@ -87,5 +83,41 @@ public class NormalsForOutlinePipeline implements RenderPipeline {
|
|||||||
|
|
||||||
Globals.profiler.endCpuSample();
|
Globals.profiler.endCpuSample();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if the entity should be drawn
|
||||||
|
* @param entity The entity
|
||||||
|
* @return true if should draw, false otherwise
|
||||||
|
*/
|
||||||
|
static boolean shouldDraw(Entity entity){
|
||||||
|
return
|
||||||
|
(
|
||||||
|
(boolean)entity.getData(EntityDataStrings.DATA_STRING_DRAW) &&
|
||||||
|
entity.getData(EntityDataStrings.DRAW_SOLID_PASS) != null &&
|
||||||
|
entity.getData(EntityDataStrings.DRAW_OUTLINE) != null
|
||||||
|
) &&
|
||||||
|
(
|
||||||
|
!entityBlacklist(entity)
|
||||||
|
)
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks whether the entity is on the blacklist for drawing in main pipeline or not
|
||||||
|
* @param entity The entity
|
||||||
|
* @return True if in blacklist, false otherwise
|
||||||
|
*/
|
||||||
|
static boolean entityBlacklist(Entity entity){
|
||||||
|
return
|
||||||
|
//don't draw first person view in this pipeline ever
|
||||||
|
entity == Globals.firstPersonEntity ||
|
||||||
|
|
||||||
|
//don't draw third person view if camera is first person
|
||||||
|
(
|
||||||
|
!Globals.controlHandler.cameraIsThirdPerson() &&
|
||||||
|
entity == Globals.playerEntity
|
||||||
|
)
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user