2h katana
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit

This commit is contained in:
austin 2024-07-24 12:49:44 -04:00
parent 9c53027bf0
commit 570086c2cc
16 changed files with 337 additions and 121 deletions

View File

@ -367,6 +367,30 @@
"name" : "Jump" "name" : "Jump"
} }
}, },
{
"attackMoveId" : "Sword2HSlash1",
"type" : "MELEE_WEAPON_SWING_TWO_HAND",
"attackAnimationName" : "SwordR2HSlash",
"windupFrames" : 2,
"attackFrames" : 5,
"cooldownFrames" : 28,
"firesProjectile" : false,
"nextAttackMoveWindowStart" : 10,
"nextAttackMoveWindowEnd" : 18,
"driftGoal" : 0.03,
"driftFrameStart" : 1,
"driftFrameEnd" : 10,
"initialMove" : true,
"animationFirstPersonWindup" : {
"name" : "HoldItemR2H"
},
"animationFirstPersonHold" : {
"name" : "HoldItemR2H"
},
"animationFirstPersonAttack" : {
"name" : "SwordR2HSlash"
}
},
{ {
"attackMoveId" : "Bow2HFire", "attackMoveId" : "Bow2HFire",
"type" : "RANGED_WEAPON_BOW_TWO_HAND", "type" : "RANGED_WEAPON_BOW_TWO_HAND",

View File

@ -27,6 +27,59 @@
} }
] ]
}, },
"equipData": {
"equipClass" : "weapon"
},
"tokens" : [
"GRAVITY",
"BLENDER_TRANSFORM",
"MELEE",
"TARGETABLE",
"OUTLINE"
],
"idleAnim" : "Sword|Idle",
"collidable": {
"type" : "CUBE",
"dimension1" : 0.03,
"dimension2" : 0.03,
"dimension3" : 0.2,
"rotX": 0,
"rotY": 0,
"rotZ": 0,
"rotW": 1,
"offsetX" : 0.0,
"offsetY" : 0.05,
"offsetZ" : 0.0
},
"iconPath" : "Textures/icons/itemIconWeapon.png"
},
{
"itemId" : "Katana2H",
"modelPath" : "Models/items/weapons/katana1alt.fbx",
"weaponData" : {
"weaponClass" : "sword2h",
"damage" : 10,
"hitboxes" : [
{
"type": "hit_connected",
"bone": "Blade1",
"radius": 0.04
},
{
"type": "hit_connected",
"bone": "Blade2",
"radius": 0.04
},
{
"type": "hit_connected",
"bone": "Blade3",
"radius": 0.04
}
]
},
"equipData": {
"equipClass" : "weapon"
},
"tokens" : [ "tokens" : [
"GRAVITY", "GRAVITY",
"BLENDER_TRANSFORM", "BLENDER_TRANSFORM",
@ -34,7 +87,6 @@
"TARGETABLE", "TARGETABLE",
"OUTLINE" "OUTLINE"
], ],
"equipClass" : "weapon",
"idleAnim" : "Sword|Idle", "idleAnim" : "Sword|Idle",
"collidable": { "collidable": {
"type" : "CUBE", "type" : "CUBE",
@ -59,13 +111,15 @@
"damage" : 10, "damage" : 10,
"projectileModel" : "Models/arrow1.fbx" "projectileModel" : "Models/arrow1.fbx"
}, },
"equipData": {
"equipClass" : "weapon"
},
"tokens" : [ "tokens" : [
"GRAVITY", "GRAVITY",
"RANGED", "RANGED",
"TARGETABLE", "TARGETABLE",
"OUTLINE" "OUTLINE"
], ],
"equipClass" : "weapon",
"collidable": { "collidable": {
"type" : "CUBE", "type" : "CUBE",
"dimension1" : 0.1, "dimension1" : 0.1,
@ -85,11 +139,25 @@
{ {
"itemId" : "shorts1", "itemId" : "shorts1",
"modelPath": "Models/items/itemEntityShorts.fbx", "modelPath": "Models/items/itemEntityShorts.fbx",
"equipData": {
"equipClass" : "clothing",
"equipWhitelist" : [
{
"creatureId" : "human",
"model" : "Models/creatures/person2/clothing/shorts1.fbx",
"meshList" : [
"ClothingItem"
],
"meshMaskList" : [
"Shorts"
]
}
]
},
"tokens" : [ "tokens" : [
"GRAVITY", "GRAVITY",
"TARGETABLE" "TARGETABLE"
], ],
"equipClass" : "clothing",
"collidable": { "collidable": {
"type" : "CUBE", "type" : "CUBE",
"dimension1" : 0.1, "dimension1" : 0.1,
@ -103,24 +171,25 @@
"offsetY" : 0.05, "offsetY" : 0.05,
"offsetZ" : 0 "offsetZ" : 0
}, },
"iconPath" : "Textures/icons/itemIconItemGeneric.png", "iconPath" : "Textures/icons/itemIconItemGeneric.png"
"equipWhitelist" : [
{
"creatureId" : "human",
"model" : "Models/creatures/person2/clothing/shorts1.fbx",
"meshList" : [
"ClothingItem"
],
"meshMaskList" : [
"Shorts"
]
}
]
}, },
{ {
"itemId" : "hairshort1", "itemId" : "hairshort1",
"modelPath": "Models/itemEntityShorts.fbx", "modelPath": "Models/itemEntityShorts.fbx",
"equipData": {
"equipClass" : "trait",
"equipWhitelist" : [
{
"creatureId" : "human",
"model" : "Models/hairshort1.fbx",
"meshList" : [
"Hair"
],
"meshMaskList" : []
}
]
},
"tokens" : [ "tokens" : [
"GRAVITY", "GRAVITY",
"ARMOR", "ARMOR",
@ -140,17 +209,7 @@
"offsetY" : 0.05, "offsetY" : 0.05,
"offsetZ" : 0 "offsetZ" : 0
}, },
"iconPath" : "Textures/icons/itemIconItemGeneric.png", "iconPath" : "Textures/icons/itemIconItemGeneric.png"
"equipWhitelist" : [
{
"creatureId" : "human",
"model" : "Models/hairshort1.fbx",
"meshList" : [
"Hair"
],
"meshMaskList" : []
}
]
}, },
{ {
@ -161,7 +220,21 @@
"ARMOR", "ARMOR",
"TARGETABLE" "TARGETABLE"
], ],
"equipClass" : "clothing", "equipData": {
"equipClass" : "clothing",
"equipWhitelist" : [
{
"creatureId" : "human",
"model" : "Models/boots1.glb",
"meshList" : [
"BootLeft",
"BootRight"
],
"meshMaskList" : [
]
}
]
},
"collidable": { "collidable": {
"type" : "CUBE", "type" : "CUBE",
"dimension1" : 0.1, "dimension1" : 0.1,
@ -175,19 +248,7 @@
"offsetY" : 0.05, "offsetY" : 0.05,
"offsetZ" : 0 "offsetZ" : 0
}, },
"iconPath" : "Textures/icons/itemIconItemGeneric.png", "iconPath" : "Textures/icons/itemIconItemGeneric.png"
"equipWhitelist" : [
{
"creatureId" : "human",
"model" : "Models/boots1.glb",
"meshList" : [
"BootLeft",
"BootRight"
],
"meshMaskList" : [
]
}
]
}, },
{ {
@ -198,7 +259,22 @@
"ARMOR", "ARMOR",
"TARGETABLE" "TARGETABLE"
], ],
"equipClass" : "clothing", "equipData": {
"equipClass" : "clothing",
"equipWhitelist" : [
{
"creatureId" : "human",
"model" : "Models/shirt1.fbx",
"meshList" : [
"ClothingItem"
],
"meshMaskList" : [
"ShoulderLeft",
"ShoulderRight"
]
}
]
},
"collidable": { "collidable": {
"type" : "CUBE", "type" : "CUBE",
"dimension1" : 0.1, "dimension1" : 0.1,
@ -212,20 +288,7 @@
"offsetY" : 0.05, "offsetY" : 0.05,
"offsetZ" : 0 "offsetZ" : 0
}, },
"iconPath" : "Textures/icons/itemIconItemGeneric.png", "iconPath" : "Textures/icons/itemIconItemGeneric.png"
"equipWhitelist" : [
{
"creatureId" : "human",
"model" : "Models/shirt1.fbx",
"meshList" : [
"ClothingItem"
],
"meshMaskList" : [
"ShoulderLeft",
"ShoulderRight"
]
}
]
} }

View File

@ -443,6 +443,10 @@ Word element
Text Wrap handling Text Wrap handling
Overflow handling Overflow handling
(07/21/2024)
AI scaffolding
Attacker ai tree
# TODO # TODO

View File

@ -249,7 +249,7 @@ public class ControlHandler {
boolean shouldRecaptureScreen = false; boolean shouldRecaptureScreen = false;
//controls whether the camera is first or third person //controls whether the camera is first or third person
boolean cameraIsThirdPerson = true; boolean cameraIsThirdPerson = false;
//The list of window strings that would block main game controls //The list of window strings that would block main game controls
static String[] controlBlockingWindows = new String[]{ static String[] controlBlockingWindows = new String[]{

View File

@ -164,10 +164,10 @@ 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/baseman9.glb"); // Globals.assetManager.addModelPathToQueue("/Models/creatures/viewmodel.glb");
// Globals.assetManager.loadAssetsInQueue(); // Globals.assetManager.loadAssetsInQueue();
// Model model = Globals.assetManager.fetchModel("/Models/baseman9.glb"); // electrosphere.renderer.model.Model model = Globals.assetManager.fetchModel("/Models/creatures/viewmodel.glb");
// // for(electrosphere.renderer.anim.Animation anim : model.animations){ // // 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){

View File

@ -202,6 +202,7 @@ public class EntityDataStrings {
public static final String ATTACK_MOVE_TYPE_ACTIVE = "attackMoveTypeActive"; public static final String ATTACK_MOVE_TYPE_ACTIVE = "attackMoveTypeActive";
public static final String ATTACK_MOVE_TYPE_MELEE_SWING_ONE_HAND = "MELEE_WEAPON_SWING_ONE_HAND"; public static final String ATTACK_MOVE_TYPE_MELEE_SWING_ONE_HAND = "MELEE_WEAPON_SWING_ONE_HAND";
public static final String ATTACK_MOVE_TYPE_MELEE_SWING_TWO_HAND = "MELEE_WEAPON_SWING_TWO_HAND";
public static final String ATTACK_MOVE_TYPE_BOW_TWO_HAND = "RANGED_WEAPON_BOW_TWO_HAND"; public static final String ATTACK_MOVE_TYPE_BOW_TWO_HAND = "RANGED_WEAPON_BOW_TWO_HAND";
/** /**

View File

@ -266,20 +266,24 @@ public class ClientAttackTree implements BehaviorTree {
} }
//activate hitboxes //activate hitboxes
List<Entity> attachedEntities = AttachUtils.getChildrenList(parent); List<Entity> attachedEntities = AttachUtils.getChildrenList(parent);
for(Entity currentAttached : attachedEntities){ if(attachedEntities != null){
if(HitboxCollectionState.hasHitboxState(currentAttached)){ for(Entity currentAttached : attachedEntities){
HitboxCollectionState currentState = HitboxCollectionState.getHitboxState(currentAttached); if(HitboxCollectionState.hasHitboxState(currentAttached)){
currentState.setActive(true); HitboxCollectionState currentState = HitboxCollectionState.getHitboxState(currentAttached);
currentState.setActive(true);
}
} }
} }
} break; } break;
case COOLDOWN: { case COOLDOWN: {
//deactive hitboxes //deactive hitboxes
List<Entity> attachedEntities = AttachUtils.getChildrenList(parent); List<Entity> attachedEntities = AttachUtils.getChildrenList(parent);
for(Entity currentAttached : attachedEntities){ if(attachedEntities != null){
if(HitboxCollectionState.hasHitboxState(currentAttached)){ for(Entity currentAttached : attachedEntities){
HitboxCollectionState currentState = HitboxCollectionState.getHitboxState(currentAttached); if(HitboxCollectionState.hasHitboxState(currentAttached)){
currentState.setActive(false); HitboxCollectionState currentState = HitboxCollectionState.getHitboxState(currentAttached);
currentState.setActive(false);
}
} }
} }
if(currentMove != null && frameCurrent > currentMove.getWindupFrames() + currentMove.getAttackFrames() + currentMove.getCooldownFrames()){ if(currentMove != null && frameCurrent > currentMove.getWindupFrames() + currentMove.getAttackFrames() + currentMove.getCooldownFrames()){
@ -317,6 +321,9 @@ public class ClientAttackTree implements BehaviorTree {
case "sword1h": case "sword1h":
rVal = EntityDataStrings.ATTACK_MOVE_TYPE_MELEE_SWING_ONE_HAND; rVal = EntityDataStrings.ATTACK_MOVE_TYPE_MELEE_SWING_ONE_HAND;
break; break;
case "sword2h":
rVal = EntityDataStrings.ATTACK_MOVE_TYPE_MELEE_SWING_TWO_HAND;
break;
case "bow2h": case "bow2h":
rVal = EntityDataStrings.ATTACK_MOVE_TYPE_BOW_TWO_HAND; rVal = EntityDataStrings.ATTACK_MOVE_TYPE_BOW_TWO_HAND;
break; break;

View File

@ -381,6 +381,9 @@ public class ServerAttackTree implements BehaviorTree {
case "sword1h": case "sword1h":
rVal = EntityDataStrings.ATTACK_MOVE_TYPE_MELEE_SWING_ONE_HAND; rVal = EntityDataStrings.ATTACK_MOVE_TYPE_MELEE_SWING_ONE_HAND;
break; break;
case "sword2h":
rVal = EntityDataStrings.ATTACK_MOVE_TYPE_MELEE_SWING_TWO_HAND;
break;
case "bow2h": case "bow2h":
rVal = EntityDataStrings.ATTACK_MOVE_TYPE_BOW_TWO_HAND; rVal = EntityDataStrings.ATTACK_MOVE_TYPE_BOW_TWO_HAND;
break; break;

View File

@ -109,6 +109,14 @@ public class FirstPersonTree implements BehaviorTree {
this.currentAnimation = animationName; this.currentAnimation = animationName;
} }
/**
* Gets the animation currently playing
* @return The name of the animation
*/
public String getCurrentAnimation(){
return currentAnimation;
}
/** /**
* If the entity has a first person tree, plays the provided animation * If the entity has a first person tree, plays the provided animation
* @param entity The entity * @param entity The entity

View File

@ -18,6 +18,7 @@ import electrosphere.entity.state.gravity.ClientGravityTree;
import electrosphere.entity.state.gravity.ServerGravityTree; import electrosphere.entity.state.gravity.ServerGravityTree;
import electrosphere.entity.state.hitbox.HitboxCollectionState; import electrosphere.entity.state.hitbox.HitboxCollectionState;
import electrosphere.game.data.collidable.CollidableTemplate; import electrosphere.game.data.collidable.CollidableTemplate;
import electrosphere.game.data.item.type.EquipData;
import electrosphere.game.data.item.type.EquipWhitelist; import electrosphere.game.data.item.type.EquipWhitelist;
import electrosphere.game.data.item.type.Item; import electrosphere.game.data.item.type.Item;
import electrosphere.game.data.item.type.WeaponData; import electrosphere.game.data.item.type.WeaponData;
@ -79,9 +80,6 @@ public class ItemUtils {
break; break;
} }
} }
if(item.getEquipWhitelist() != null){
rVal.putData(EntityDataStrings.ITEM_EQUIP_WHITELIST, item.getEquipWhitelist());
}
if(item.getIdleAnim() != null){ if(item.getIdleAnim() != null){
rVal.putData(EntityDataStrings.ANIM_IDLE,item.getIdleAnim()); rVal.putData(EntityDataStrings.ANIM_IDLE,item.getIdleAnim());
} }
@ -90,8 +88,20 @@ public class ItemUtils {
} else { } else {
rVal.putData(EntityDataStrings.ITEM_ICON,genericItemIconPath); rVal.putData(EntityDataStrings.ITEM_ICON,genericItemIconPath);
} }
if(item.getEquipClass() != null){
rVal.putData(EntityDataStrings.ITEM_EQUIP_CLASS,item.getEquipClass()); //
//
// Equip data
//
//
if(item.getEquipData() != null){
EquipData equipData = item.getEquipData();
if(equipData.getEquipWhitelist() != null){
rVal.putData(EntityDataStrings.ITEM_EQUIP_WHITELIST, equipData.getEquipWhitelist());
}
if(equipData.getEquipClass() != null){
rVal.putData(EntityDataStrings.ITEM_EQUIP_CLASS,equipData.getEquipClass());
}
} }
rVal.putData(EntityDataStrings.DRAW_CAST_SHADOW, true); rVal.putData(EntityDataStrings.DRAW_CAST_SHADOW, true);
EntityUtils.setEntityType(rVal, ENTITY_TYPE_ITEM); EntityUtils.setEntityType(rVal, ENTITY_TYPE_ITEM);
@ -152,9 +162,6 @@ public class ItemUtils {
break; break;
} }
} }
if(item.getEquipWhitelist() != null){
rVal.putData(EntityDataStrings.ITEM_EQUIP_WHITELIST, item.getEquipWhitelist());
}
if(item.getIdleAnim() != null){ if(item.getIdleAnim() != null){
rVal.putData(EntityDataStrings.ANIM_IDLE,item.getIdleAnim()); rVal.putData(EntityDataStrings.ANIM_IDLE,item.getIdleAnim());
} }
@ -163,8 +170,19 @@ public class ItemUtils {
} else { } else {
rVal.putData(EntityDataStrings.ITEM_ICON,genericItemIconPath); rVal.putData(EntityDataStrings.ITEM_ICON,genericItemIconPath);
} }
if(item.getEquipClass() != null){ //
rVal.putData(EntityDataStrings.ITEM_EQUIP_CLASS,item.getEquipClass()); //
// Equip data
//
//
if(item.getEquipData() != null){
EquipData equipData = item.getEquipData();
if(equipData.getEquipWhitelist() != null){
rVal.putData(EntityDataStrings.ITEM_EQUIP_WHITELIST, equipData.getEquipWhitelist());
}
if(equipData.getEquipClass() != null){
rVal.putData(EntityDataStrings.ITEM_EQUIP_CLASS,equipData.getEquipClass());
}
} }
rVal.putData(EntityDataStrings.DRAW_CAST_SHADOW, true); rVal.putData(EntityDataStrings.DRAW_CAST_SHADOW, true);
EntityUtils.setEntityType(rVal, ENTITY_TYPE_ITEM); EntityUtils.setEntityType(rVal, ENTITY_TYPE_ITEM);

View File

@ -7,10 +7,20 @@ import java.util.Map;
import electrosphere.logger.LoggerInterface; import electrosphere.logger.LoggerInterface;
/**
* Resolves attack move ids to lists of chains of attacks
*/
public class AttackMoveResolver { public class AttackMoveResolver {
/**
* The map of attack move id -> attack move object chain
*/
Map<String,List<AttackMove>> attackMovesetMap = new HashMap<String,List<AttackMove>>(); Map<String,List<AttackMove>> attackMovesetMap = new HashMap<String,List<AttackMove>>();
/**
* Constructor
* @param movelist The raw list of attack moves
*/
public AttackMoveResolver(List<AttackMove> movelist){ public AttackMoveResolver(List<AttackMove> movelist){
//get all moves //get all moves
for(AttackMove move : movelist){ for(AttackMove move : movelist){
@ -24,16 +34,27 @@ public class AttackMoveResolver {
} }
} }
//reorder //reorder
for(List<AttackMove> toOrder : attackMovesetMap.values()){ for(String attackTypeKey : attackMovesetMap.keySet()){
reorderMoveset(toOrder); List<AttackMove> currentKeyList = attackMovesetMap.get(attackTypeKey);
reorderMoveset(attackTypeKey, currentKeyList);
} }
} }
/**
* Gets a chain of attack moves based on the attack type
* @param attackType The type of attack (IE "Sword2HSlash1")
* @return The chain of attack moves if it exists, null otherwise
*/
public List<AttackMove> getMoveset(String attackType){ public List<AttackMove> getMoveset(String attackType){
return attackMovesetMap.get(attackType); return attackMovesetMap.get(attackType);
} }
void reorderMoveset(List<AttackMove> finalMovelist){ /**
* Reorders the attack moveset list
* @param attackTypeKey The current attack type key (IE "Sword2HSlash1")
* @param finalMovelist The moveset list
*/
void reorderMoveset(String attackTypeKey, List<AttackMove> finalMovelist){
AttackMove currentMove = null; AttackMove currentMove = null;
//solve for initial move //solve for initial move
for(AttackMove move : finalMovelist){ for(AttackMove move : finalMovelist){
@ -67,7 +88,11 @@ public class AttackMoveResolver {
finalMovelist.add(move); finalMovelist.add(move);
} }
} else { } else {
LoggerInterface.loggerEngine.WARNING("FAILED TO LOAD INITIAL MOVE IN AttackMoveResolver"); String message = "FAILED TO LOAD INITIAL MOVE IN AttackMoveResolver\n" +
"The attack move type is: " + attackTypeKey + "\n" +
"This is commonly caused by having your initial move in the attack chain in data not having the field \"initialMove\" set to true!"
;
LoggerInterface.loggerEngine.ERROR(new IllegalArgumentException(message));
} }
} }

View File

@ -0,0 +1,43 @@
package electrosphere.game.data.item.type;
import java.util.List;
/**
* Data about how this item is equipped (ie, where is it equipped, what slots does it take, who can equip it, etc)
*/
public class EquipData {
//the equip whitelist for this item (what creatures can equip this item?)
List<EquipWhitelist> equipWhitelist;
//the class of item
String equipClass;
//The list of slots that this item takes up when it is equipped
List<String> equipSlots;
/**
* the equip whitelist for this item (what creatures can equip this item?)
* @return
*/
public List<EquipWhitelist> getEquipWhitelist(){
return equipWhitelist;
}
/**
* the class of item
* @return
*/
public String getEquipClass(){
return equipClass;
}
/**
* Gets the list of equip slot ids that are taken up when equipping this item
* @return The list of equip slot ids
*/
public List<String> getEquipSlots(){
return equipSlots;
}
}

View File

@ -17,16 +17,14 @@ public class Item {
List<String> tokens; List<String> tokens;
//the collidable data for the item //the collidable data for the item
CollidableTemplate collidable; CollidableTemplate collidable;
//the equip whitelist for this item (what creatures can equip this item?)
List<EquipWhitelist> equipWhitelist;
//the idle animation for the item //the idle animation for the item
String idleAnim; String idleAnim;
//the path for the icon texture for this item //the path for the icon texture for this item
String iconPath; String iconPath;
//the class of item
String equipClass;
//weapon data for this item if it is an item //weapon data for this item if it is an item
WeaponData weaponData; WeaponData weaponData;
//The data defining how this item is equipped
EquipData equipData;
/** /**
* the id of the item * the id of the item
@ -59,14 +57,6 @@ public class Item {
return collidable; return collidable;
} }
/**
* the equip whitelist for this item (what creatures can equip this item?)
* @return
*/
public List<EquipWhitelist> getEquipWhitelist(){
return equipWhitelist;
}
/** /**
* the idle animation for the item * the idle animation for the item
* @return * @return
@ -83,14 +73,6 @@ public class Item {
return iconPath; return iconPath;
} }
/**
* the class of item
* @return
*/
public String getEquipClass(){
return equipClass;
}
/** /**
* weapon data for this item if it is an item * weapon data for this item if it is an item
* @return * @return
@ -98,5 +80,13 @@ public class Item {
public WeaponData getWeaponData(){ public WeaponData getWeaponData(){
return weaponData; return weaponData;
} }
/**
* Gets the equip data for the item type
* @return The equip data
*/
public EquipData getEquipData(){
return equipData;
}
} }

View File

@ -168,7 +168,6 @@ public class EntityProtocol {
Globals.firstPersonEntity = EntityCreationUtils.createClientSpatialEntity(); Globals.firstPersonEntity = EntityCreationUtils.createClientSpatialEntity();
EntityCreationUtils.makeEntityDrawable(Globals.firstPersonEntity, viewModelData.getFirstPersonModelPath()); EntityCreationUtils.makeEntityDrawable(Globals.firstPersonEntity, viewModelData.getFirstPersonModelPath());
FirstPersonTree.attachTree(Globals.firstPersonEntity, viewModelData.getHeightFromOrigin(), viewModelData.getCameraViewDirOffsetY(), viewModelData.getCameraViewDirOffsetZ()); FirstPersonTree.attachTree(Globals.firstPersonEntity, viewModelData.getHeightFromOrigin(), viewModelData.getCameraViewDirOffsetY(), viewModelData.getCameraViewDirOffsetZ());
Globals.clientSceneWrapper.getScene().removeEntityFromTag(Globals.firstPersonEntity,EntityTags.DRAWABLE);
} }
} }
} }

View File

@ -70,10 +70,7 @@ public class MainContentPipeline 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(shouldDrawSolidPass(currentEntity)){
(boolean)currentEntity.getData(EntityDataStrings.DATA_STRING_DRAW) &&
currentEntity.getData(EntityDataStrings.DRAW_SOLID_PASS) != null
){
//fetch actor //fetch actor
Actor currentActor = EntityUtils.getActor(currentEntity); Actor currentActor = EntityUtils.getActor(currentEntity);
//calculate camera-modified vector3f //calculate camera-modified vector3f
@ -91,10 +88,7 @@ public class MainContentPipeline implements RenderPipeline {
Globals.clientFoliageManager.draw(); Globals.clientFoliageManager.draw();
for(Entity currentEntity : Globals.clientScene.getEntitiesWithTag(EntityTags.DRAW_INSTANCED)){ for(Entity currentEntity : Globals.clientScene.getEntitiesWithTag(EntityTags.DRAW_INSTANCED)){
Vector3d position = EntityUtils.getPosition(currentEntity); Vector3d position = EntityUtils.getPosition(currentEntity);
if( if(shouldDrawSolidPass(currentEntity)){
currentEntity.getData(EntityDataStrings.DATA_STRING_DRAW) != null &&
currentEntity.getData(EntityDataStrings.DRAW_SOLID_PASS) != null
){
//fetch actor //fetch actor
InstancedActor currentActor = InstancedActor.getInstancedActor(currentEntity); InstancedActor currentActor = InstancedActor.getInstancedActor(currentEntity);
//if the shader attribute for model matrix exists, calculate the model matrix and apply //if the shader attribute for model matrix exists, calculate the model matrix and apply
@ -156,10 +150,7 @@ public class MainContentPipeline 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(shouldDrawTransparentPass(currentEntity)){
(boolean)currentEntity.getData(EntityDataStrings.DATA_STRING_DRAW) &&
currentEntity.getData(EntityDataStrings.DRAW_TRANSPARENT_PASS) != null
){
//fetch actor //fetch actor
Actor currentActor = EntityUtils.getActor(currentEntity); Actor currentActor = EntityUtils.getActor(currentEntity);
//calculate camera-modified vector3f //calculate camera-modified vector3f
@ -176,10 +167,7 @@ public class MainContentPipeline implements RenderPipeline {
} }
for(Entity currentEntity : Globals.clientScene.getEntitiesWithTag(EntityTags.DRAW_INSTANCED)){ for(Entity currentEntity : Globals.clientScene.getEntitiesWithTag(EntityTags.DRAW_INSTANCED)){
Vector3d position = EntityUtils.getPosition(currentEntity); Vector3d position = EntityUtils.getPosition(currentEntity);
if( if(shouldDrawTransparentPass(currentEntity)){
currentEntity.getData(EntityDataStrings.DATA_STRING_DRAW) != null &&
currentEntity.getData(EntityDataStrings.DRAW_TRANSPARENT_PASS) != null
){
//fetch actor //fetch actor
InstancedActor currentActor = InstancedActor.getInstancedActor(currentEntity); InstancedActor currentActor = InstancedActor.getInstancedActor(currentEntity);
//if the shader attribute for model matrix exists, calculate the model matrix and apply //if the shader attribute for model matrix exists, calculate the model matrix and apply
@ -218,5 +206,48 @@ public class MainContentPipeline 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 shouldDrawSolidPass(Entity entity){
return
(
(boolean)entity.getData(EntityDataStrings.DATA_STRING_DRAW) &&
entity.getData(EntityDataStrings.DRAW_SOLID_PASS) != null
) &&
(
!entityBlacklist(entity)
)
;
}
/**
* Checks if the entity should be drawn
* @param entity The entity
* @return true if should draw, false otherwise
*/
static boolean shouldDrawTransparentPass(Entity entity){
return
(
(boolean)entity.getData(EntityDataStrings.DATA_STRING_DRAW) &&
entity.getData(EntityDataStrings.DRAW_TRANSPARENT_PASS) != 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 entity == Globals.firstPersonEntity;
}
} }

View File

@ -42,9 +42,9 @@ public class PlayerCharacterCreation {
realm.getServerWorldData().convertRealToChunkSpace(Globals.spawnPoint.z) realm.getServerWorldData().convertRealToChunkSpace(Globals.spawnPoint.z)
)); ));
realm.getDataCellManager().addPlayerToRealm(playerObject); realm.getDataCellManager().addPlayerToRealm(playerObject);
//set controller id //parse network messages on client if running
if(playerObject == Globals.clientPlayer){ if(playerObject == Globals.clientPlayer){
Globals.playerEntity = newPlayerEntity; Globals.clientConnection.parseMessages();
} }
} }