entity graphics refactor
All checks were successful
studiorailgun/Renderer/pipeline/head This commit looks good

This commit is contained in:
austin 2024-09-22 14:42:08 -04:00
parent 9782e2c6b5
commit cd0452a77c
18 changed files with 193 additions and 81 deletions

View File

@ -547,14 +547,18 @@
"z": 0.0 "z": 0.0
} }
}, },
"idleData": { "graphicsTemplate": {
"animation": { "model": {
"nameFirstPerson" : "BindPose", "idleData": {
"nameThirdPerson" : "Idle", "animation": {
"priorityCategory" : "IDLE" "nameFirstPerson" : "BindPose",
"nameThirdPerson" : "Idle",
"priorityCategory" : "IDLE"
}
},
"path" : "Models/creatures/person2/person2_1.glb"
} }
}, },
"modelPath" : "Models/creatures/person2/person2_1.glb",
"viewModelData" : { "viewModelData" : {
"heightFromOrigin" : 1.3, "heightFromOrigin" : 1.3,
"cameraViewDirOffsetY" : -0.3, "cameraViewDirOffsetY" : -0.3,

View File

@ -431,14 +431,18 @@
"z": 0.0 "z": 0.0
} }
}, },
"idleData": { "graphicsTemplate": {
"animation": { "model": {
"nameFirstPerson" : "Idle", "idleData": {
"nameThirdPerson" : "Idle", "animation": {
"priorityCategory" : "IDLE" "nameFirstPerson" : "Idle",
"nameThirdPerson" : "Idle",
"priorityCategory" : "IDLE"
}
},
"path" : "Models/creatures/skeleton/skeleton1.glb"
} }
}, },
"modelPath" : "Models/creatures/skeleton/skeleton1.glb",
"viewModelData" : { "viewModelData" : {
"heightFromOrigin" : 1.3, "heightFromOrigin" : 1.3,
"cameraViewDirOffsetY" : -0.3, "cameraViewDirOffsetY" : -0.3,

View File

@ -11,7 +11,11 @@
"growthModel": { "growthModel": {
"growthRate" : 0.001 "growthRate" : 0.001
}, },
"modelPath" : "Models/foliage/grass2.fbx" "graphicsTemplate": {
"model": {
"path" : "Models/foliage/grass2.fbx"
}
}
}, },
{ {
"id" : "oak", "id" : "oak",

View File

@ -54,7 +54,6 @@
}, },
{ {
"id" : "Katana2H", "id" : "Katana2H",
"modelPath" : "Models/items/weapons/katana1alt.glb",
"weaponData" : { "weaponData" : {
"weaponClass" : "sword2h", "weaponClass" : "sword2h",
"damage" : 10, "damage" : 10,
@ -114,7 +113,17 @@
"TARGETABLE", "TARGETABLE",
"OUTLINE" "OUTLINE"
], ],
"idleAnim" : "Idle", "graphicsTemplate": {
"model": {
"idleData": {
"animation": {
"nameThirdPerson" : "Idle",
"priorityCategory" : "IDLE"
}
},
"path" : "Models/items/weapons/katana1alt.glb"
}
},
"collidable": { "collidable": {
"type" : "CUBE", "type" : "CUBE",
"dimension1" : 0.04, "dimension1" : 0.04,
@ -320,7 +329,6 @@
{ {
"id" : "terrainTool", "id" : "terrainTool",
"modelPath": "Models/basic/geometry/unitvector.glb",
"tokens" : [ "tokens" : [
"GRAVITY", "GRAVITY",
"TARGETABLE" "TARGETABLE"
@ -328,6 +336,11 @@
"equipData": { "equipData": {
"equipClass" : "tool" "equipClass" : "tool"
}, },
"graphicsTemplate": {
"model": {
"path" : "Models/basic/geometry/unitvector.glb"
}
},
"clientSidePrimary": "OPEN_VOXEL", "clientSidePrimary": "OPEN_VOXEL",
"collidable": { "collidable": {
"type" : "CUBE", "type" : "CUBE",

View File

@ -29,7 +29,11 @@
"tokens": [ "tokens": [
"GRAVITY" "GRAVITY"
], ],
"modelPath" : "Models/objects/crate2.glb" "graphicsTemplate": {
"model": {
"path" : "Models/objects/crate2.glb"
}
}
} }
], ],

View File

@ -48,7 +48,11 @@
"z": 0.0 "z": 0.0
} }
}, },
"modelPath" : "Models/objects/furniture/torch1.glb", "graphicsTemplate": {
"model": {
"path" : "Models/objects/furniture/torch1.glb"
}
},
"tokens": [ "tokens": [
] ]
} }

View File

@ -3,7 +3,11 @@
{ {
"id" : "spawnPoint", "id" : "spawnPoint",
"modelPath" : "Models/gameobj/token.glb", "graphicsTemplate": {
"model": {
"path" : "Models/gameobj/token.glb"
}
},
"tokens": [ "tokens": [
"SPAWNPOINT" "SPAWNPOINT"
] ]

View File

@ -836,13 +836,11 @@ Autodisabling implementation
Fix static friction coeff causing player to slide on shallow slopes Fix static friction coeff causing player to slide on shallow slopes
- Turns out it needed auto disabling logic - Turns out it needed auto disabling logic
Change timescale for test Change timescale for test
Refactor graphics entity definitions to be under dedicated object
# TODO # TODO
IMMEDIATE SCALING ISSUES
- Always enforce opengl interface across all opengl calls jesus christ the bone uniform bug was impossible
Ability to fully reload game engine state without exiting client Ability to fully reload game engine state without exiting client
- Back out to main menu and load a new level without any values persisting - Back out to main menu and load a new level without any values persisting
- Receive a teleport packet from server and flush all game state before requesting state from server again - Receive a teleport packet from server and flush all game state before requesting state from server again
@ -872,6 +870,7 @@ Rearchitecting
- Main render is a ui element (that we can have multiple of) - Main render is a ui element (that we can have multiple of)
- Shader handling updates to allow for library based shader compilation - Shader handling updates to allow for library based shader compilation
- Also allow injecting consts from the engine itself (ie max lights is dynamically injected, that way never have to worry about .glsl and .java not aligning) - Also allow injecting consts from the engine itself (ie max lights is dynamically injected, that way never have to worry about .glsl and .java not aligning)
- Cache busting for particle atlas cache
Code cleanup Code cleanup
- Rename "BehaviorTree" to be "Component" (what it actually is) - Rename "BehaviorTree" to be "Component" (what it actually is)

View File

@ -155,7 +155,7 @@ public class FoliageCell {
//queue ambient foliage models //queue ambient foliage models
for(FoliageType foliageType : Globals.gameConfigCurrent.getFoliageMap().getFoliageList()){ for(FoliageType foliageType : Globals.gameConfigCurrent.getFoliageMap().getFoliageList()){
if(foliageType.getTokens().contains(FoliageType.TOKEN_AMBIENT)){ if(foliageType.getTokens().contains(FoliageType.TOKEN_AMBIENT)){
Globals.assetManager.addModelPathToQueue(foliageType.getModelPath()); Globals.assetManager.addModelPathToQueue(foliageType.getGraphicsTemplate().getModel().getPath());
Globals.assetManager.addShaderToQueue(vertexPath, fragmentPath); Globals.assetManager.addShaderToQueue(vertexPath, fragmentPath);
} }
} }
@ -246,7 +246,7 @@ public class FoliageCell {
//create entity //create entity
Entity grassEntity = EntityCreationUtils.createClientSpatialEntity(); Entity grassEntity = EntityCreationUtils.createClientSpatialEntity();
TextureInstancedActor.attachTextureInstancedActor(grassEntity, foliageType.getModelPath(), vertexPath, fragmentPath, dataTexture, drawCount); TextureInstancedActor.attachTextureInstancedActor(grassEntity, foliageType.getGraphicsTemplate().getModel().getPath(), vertexPath, fragmentPath, dataTexture, drawCount);
EntityUtils.getPosition(grassEntity).set(realPosition); EntityUtils.getPosition(grassEntity).set(realPosition);
EntityUtils.getRotation(grassEntity).set(0,0,0,1); EntityUtils.getRotation(grassEntity).set(0,0,0,1);
EntityUtils.getScale(grassEntity).set(1,1,1); EntityUtils.getScale(grassEntity).set(1,1,1);

View File

@ -166,7 +166,7 @@ public class ClientEquipState implements BehaviorTree {
//make sure it's visible //make sure it's visible
if(EntityUtils.getActor(toEquip) == null){ if(EntityUtils.getActor(toEquip) == null){
Item itemData = Globals.gameConfigCurrent.getItemMap().getItem(ItemUtils.getType(toEquip)); Item itemData = Globals.gameConfigCurrent.getItemMap().getItem(ItemUtils.getType(toEquip));
EntityCreationUtils.makeEntityDrawable(toEquip, itemData.getModelPath()); EntityCreationUtils.makeEntityDrawable(toEquip, itemData.getGraphicsTemplate().getModel().getPath());
if(itemData.getIdleAnim() != null){ if(itemData.getIdleAnim() != null){
toEquip.putData(EntityDataStrings.ANIM_IDLE,itemData.getIdleAnim()); toEquip.putData(EntityDataStrings.ANIM_IDLE,itemData.getIdleAnim());
} }

View File

@ -1,7 +1,6 @@
package electrosphere.entity.state.idle; package electrosphere.entity.state.idle;
import electrosphere.net.parser.net.message.SynchronizationMessage;
import electrosphere.entity.state.client.firstPerson.FirstPersonTree; import electrosphere.entity.state.client.firstPerson.FirstPersonTree;
import electrosphere.entity.state.movement.groundmove.ClientGroundMovementTree; import electrosphere.entity.state.movement.groundmove.ClientGroundMovementTree;
import electrosphere.entity.state.movement.groundmove.ClientGroundMovementTree.MovementTreeState; import electrosphere.entity.state.movement.groundmove.ClientGroundMovementTree.MovementTreeState;
@ -49,7 +48,7 @@ public class ClientIdleTree implements BehaviorTree {
//check if this is a creature, if so add its idle data //check if this is a creature, if so add its idle data
CreatureData creatureType = Globals.gameConfigCurrent.getCreatureTypeLoader().getType(CreatureUtils.getType(parent)); CreatureData creatureType = Globals.gameConfigCurrent.getCreatureTypeLoader().getType(CreatureUtils.getType(parent));
if(creatureType != null){ if(creatureType != null){
idleData = creatureType.getIdleData(); idleData = creatureType.getGraphicsTemplate().getModel().getIdleData();
} }
//TODO: if object, check if object has idle data and add accordingly //TODO: if object, check if object has idle data and add accordingly
} }
@ -93,7 +92,9 @@ public class ClientIdleTree implements BehaviorTree {
entityActor.playAnimation(idleData.getAnimation(),true); entityActor.playAnimation(idleData.getAnimation(),true);
entityActor.incrementAnimationTime(0.0001); entityActor.incrementAnimationTime(0.0001);
} }
FirstPersonTree.conditionallyPlayAnimation(parent, idleData.getAnimation()); if(idleData != null){
FirstPersonTree.conditionallyPlayAnimation(parent, idleData.getAnimation());
}
} }
break; break;
case NOT_IDLE: case NOT_IDLE:

View File

@ -68,6 +68,7 @@ import electrosphere.game.data.creature.type.rotator.RotatorConstraint;
import electrosphere.game.data.creature.type.rotator.RotatorItem; import electrosphere.game.data.creature.type.rotator.RotatorItem;
import electrosphere.game.data.creature.type.rotator.RotatorSystem; import electrosphere.game.data.creature.type.rotator.RotatorSystem;
import electrosphere.game.data.foliage.type.FoliageType; import electrosphere.game.data.foliage.type.FoliageType;
import electrosphere.game.data.graphics.GraphicsTemplate;
import electrosphere.game.data.item.type.Item; import electrosphere.game.data.item.type.Item;
import electrosphere.net.parser.net.message.EntityMessage; import electrosphere.net.parser.net.message.EntityMessage;
import electrosphere.net.parser.net.message.NetworkMessage; import electrosphere.net.parser.net.message.NetworkMessage;
@ -110,9 +111,9 @@ public class CommonEntityUtils {
for(String token : rawType.getTokens()){ for(String token : rawType.getTokens()){
switch(token){ switch(token){
case "GENERATE_COLLISION_OBJECT": { case "GENERATE_COLLISION_OBJECT": {
Globals.assetManager.addCollisionMeshToQueue(new PhysicsMeshQueueItem(Globals.clientSceneWrapper.getCollisionEngine(),rawType.getModelPath())); Globals.assetManager.addCollisionMeshToQueue(new PhysicsMeshQueueItem(Globals.clientSceneWrapper.getCollisionEngine(),rawType.getGraphicsTemplate().getModel().getPath()));
Globals.clientSceneWrapper.getScene().registerBehaviorTree(new BehaviorTree() {public void simulate(float deltaTime) { Globals.clientSceneWrapper.getScene().registerBehaviorTree(new BehaviorTree() {public void simulate(float deltaTime) {
DBody collisionObject = Globals.assetManager.fetchCollisionObject(Globals.clientSceneWrapper.getCollisionEngine(),rawType.getModelPath()); DBody collisionObject = Globals.assetManager.fetchCollisionObject(Globals.clientSceneWrapper.getCollisionEngine(),rawType.getGraphicsTemplate().getModel().getPath());
if(collisionObject != null){ if(collisionObject != null){
Globals.clientSceneWrapper.getScene().deregisterBehaviorTree(this); Globals.clientSceneWrapper.getScene().deregisterBehaviorTree(this);
CollisionObjUtils.clientAttachCollisionObjectToEntity(entity, collisionObject, 0, Collidable.TYPE_OBJECT); CollisionObjUtils.clientAttachCollisionObjectToEntity(entity, collisionObject, 0, Collidable.TYPE_OBJECT);
@ -120,9 +121,9 @@ public class CommonEntityUtils {
}}); }});
} break; } break;
case "GENERATE_COLLISION_TERRAIN": { case "GENERATE_COLLISION_TERRAIN": {
Globals.assetManager.addCollisionMeshToQueue(new PhysicsMeshQueueItem(Globals.clientSceneWrapper.getCollisionEngine(),rawType.getModelPath())); Globals.assetManager.addCollisionMeshToQueue(new PhysicsMeshQueueItem(Globals.clientSceneWrapper.getCollisionEngine(),rawType.getGraphicsTemplate().getModel().getPath()));
Globals.clientSceneWrapper.getScene().registerBehaviorTree(new BehaviorTree() {public void simulate(float deltaTime) { Globals.clientSceneWrapper.getScene().registerBehaviorTree(new BehaviorTree() {public void simulate(float deltaTime) {
DBody collisionObject = Globals.assetManager.fetchCollisionObject(Globals.clientSceneWrapper.getCollisionEngine(),rawType.getModelPath()); DBody collisionObject = Globals.assetManager.fetchCollisionObject(Globals.clientSceneWrapper.getCollisionEngine(),rawType.getGraphicsTemplate().getModel().getPath());
if(collisionObject != null){ if(collisionObject != null){
Globals.clientSceneWrapper.getScene().deregisterBehaviorTree(this); Globals.clientSceneWrapper.getScene().deregisterBehaviorTree(this);
CollisionObjUtils.clientAttachCollisionObjectToEntity(entity, collisionObject, 0, Collidable.TYPE_TERRAIN); CollisionObjUtils.clientAttachCollisionObjectToEntity(entity, collisionObject, 0, Collidable.TYPE_TERRAIN);
@ -140,9 +141,18 @@ public class CommonEntityUtils {
//Drawable stuff //Drawable stuff
// //
// //
if(rawType.getModelPath() != null && EntityUtils.getActor(entity) == null && generateDrawable == true){ if(rawType.getGraphicsTemplate() != null){
EntityCreationUtils.makeEntityDrawable(entity, rawType.getModelPath()); GraphicsTemplate graphicsTemplate = rawType.getGraphicsTemplate();
entity.putData(EntityDataStrings.DRAW_CAST_SHADOW, true); if(graphicsTemplate.getModel() != null && graphicsTemplate.getModel().getPath() != null && EntityUtils.getActor(entity) == null && generateDrawable == true){
EntityCreationUtils.makeEntityDrawable(entity, graphicsTemplate.getModel().getPath());
entity.putData(EntityDataStrings.DRAW_CAST_SHADOW, true);
}
//idle tree & generic stuff all creatures have
if(graphicsTemplate.getModel() != null && graphicsTemplate.getModel().getIdleData() != null){
ClientIdleTree idleTree = new ClientIdleTree(entity);
entity.putData(EntityDataStrings.TREE_IDLE, idleTree);
Globals.clientScene.registerBehaviorTree(idleTree);
}
} }
Actor creatureActor = EntityUtils.getActor(entity); Actor creatureActor = EntityUtils.getActor(entity);
@ -362,12 +372,6 @@ public class CommonEntityUtils {
ClientLifeTree.attachTree(entity,rawType.getHealthSystem()); ClientLifeTree.attachTree(entity,rawType.getHealthSystem());
Globals.clientScene.registerEntityToTag(entity, EntityTags.LIFE_STATE); Globals.clientScene.registerEntityToTag(entity, EntityTags.LIFE_STATE);
} }
//idle tree & generic stuff all creatures have
if(rawType.getIdleData() != null){
ClientIdleTree idleTree = new ClientIdleTree(entity);
entity.putData(EntityDataStrings.TREE_IDLE, idleTree);
Globals.clientScene.registerBehaviorTree(idleTree);
}
return entity; return entity;
} }
@ -400,9 +404,9 @@ public class CommonEntityUtils {
for(String token : rawType.getTokens()){ for(String token : rawType.getTokens()){
switch(token){ switch(token){
case "GENERATE_COLLISION_OBJECT": { case "GENERATE_COLLISION_OBJECT": {
Globals.assetManager.addCollisionMeshToQueue(new PhysicsMeshQueueItem(realm.getCollisionEngine(),rawType.getModelPath())); Globals.assetManager.addCollisionMeshToQueue(new PhysicsMeshQueueItem(realm.getCollisionEngine(),rawType.getGraphicsTemplate().getModel().getPath()));
ServerBehaviorTreeUtils.attachBTreeToEntity(entity, new BehaviorTree() {public void simulate(float deltaTime) { ServerBehaviorTreeUtils.attachBTreeToEntity(entity, new BehaviorTree() {public void simulate(float deltaTime) {
DBody collisionObject = Globals.assetManager.fetchCollisionObject(realm.getCollisionEngine(),rawType.getModelPath()); DBody collisionObject = Globals.assetManager.fetchCollisionObject(realm.getCollisionEngine(),rawType.getGraphicsTemplate().getModel().getPath());
if(collisionObject != null){ if(collisionObject != null){
ServerBehaviorTreeUtils.detatchBTreeFromEntity(entity, this); ServerBehaviorTreeUtils.detatchBTreeFromEntity(entity, this);
CollisionObjUtils.serverAttachCollisionObjectToEntity(entity, collisionObject, 0, Collidable.TYPE_OBJECT); CollisionObjUtils.serverAttachCollisionObjectToEntity(entity, collisionObject, 0, Collidable.TYPE_OBJECT);
@ -410,9 +414,9 @@ public class CommonEntityUtils {
}}); }});
} break; } break;
case "GENERATE_COLLISION_TERRAIN": { case "GENERATE_COLLISION_TERRAIN": {
Globals.assetManager.addCollisionMeshToQueue(new PhysicsMeshQueueItem(realm.getCollisionEngine(),rawType.getModelPath())); Globals.assetManager.addCollisionMeshToQueue(new PhysicsMeshQueueItem(realm.getCollisionEngine(),rawType.getGraphicsTemplate().getModel().getPath()));
ServerBehaviorTreeUtils.attachBTreeToEntity(entity, new BehaviorTree() {public void simulate(float deltaTime) { ServerBehaviorTreeUtils.attachBTreeToEntity(entity, new BehaviorTree() {public void simulate(float deltaTime) {
DBody collisionObject = Globals.assetManager.fetchCollisionObject(realm.getCollisionEngine(),rawType.getModelPath()); DBody collisionObject = Globals.assetManager.fetchCollisionObject(realm.getCollisionEngine(),rawType.getGraphicsTemplate().getModel().getPath());
if(collisionObject != null){ if(collisionObject != null){
ServerBehaviorTreeUtils.detatchBTreeFromEntity(entity, this); ServerBehaviorTreeUtils.detatchBTreeFromEntity(entity, this);
CollisionObjUtils.serverAttachCollisionObjectToEntity(entity, collisionObject, 0, Collidable.TYPE_TERRAIN); CollisionObjUtils.serverAttachCollisionObjectToEntity(entity, collisionObject, 0, Collidable.TYPE_TERRAIN);
@ -430,8 +434,16 @@ public class CommonEntityUtils {
//Posing stuff //Posing stuff
// //
// //
if(rawType.getModelPath() != null && EntityUtils.getPoseActor(entity) == null && generateDrawable == true){ if(rawType.getGraphicsTemplate() != null){
EntityCreationUtils.makeEntityPoseable(entity, rawType.getModelPath()); GraphicsTemplate graphicsTemplate = rawType.getGraphicsTemplate();
if(graphicsTemplate.getModel() != null && graphicsTemplate.getModel().getPath() != null && EntityUtils.getPoseActor(entity) == null && generateDrawable == true){
EntityCreationUtils.makeEntityPoseable(entity, graphicsTemplate.getModel().getPath());
entity.putData(EntityDataStrings.DRAW_CAST_SHADOW, true);
}
//idle tree & generic stuff all creatures have
if(graphicsTemplate.getModel() != null && graphicsTemplate.getModel().getIdleData() != null){
ServerIdleTree.attachTree(entity, graphicsTemplate.getModel().getIdleData());
}
} }
PoseActor creatureActor = EntityUtils.getPoseActor(entity); PoseActor creatureActor = EntityUtils.getPoseActor(entity);
// //
@ -659,10 +671,6 @@ public class CommonEntityUtils {
ServerLifeTree.attachTree(entity, rawType.getHealthSystem()); ServerLifeTree.attachTree(entity, rawType.getHealthSystem());
ServerEntityTagUtils.attachTagToEntity(entity, EntityTags.LIFE_STATE); ServerEntityTagUtils.attachTagToEntity(entity, EntityTags.LIFE_STATE);
} }
//idle tree & generic stuff all creatures have
if(rawType.getIdleData() != null){
ServerIdleTree.attachTree(entity, rawType.getIdleData());
}
return entity; return entity;

View File

@ -39,7 +39,6 @@ public class FoliageUtils {
rVal = ProceduralTree.clientGenerateProceduralTree(type, 0); rVal = ProceduralTree.clientGenerateProceduralTree(type, 0);
} else { } else {
rVal = EntityCreationUtils.createClientSpatialEntity(); rVal = EntityCreationUtils.createClientSpatialEntity();
EntityCreationUtils.makeEntityDrawable(rVal, rawType.getModelPath());
} }
// //
// //

View File

@ -6,7 +6,6 @@ import electrosphere.game.data.collidable.CollidableTemplate;
import electrosphere.game.data.collidable.HitboxData; import electrosphere.game.data.collidable.HitboxData;
import electrosphere.game.data.common.light.PointLightDescription; import electrosphere.game.data.common.light.PointLightDescription;
import electrosphere.game.data.creature.type.HealthSystem; import electrosphere.game.data.creature.type.HealthSystem;
import electrosphere.game.data.creature.type.IdleData;
import electrosphere.game.data.creature.type.LookAtSystem; import electrosphere.game.data.creature.type.LookAtSystem;
import electrosphere.game.data.creature.type.ViewModelData; import electrosphere.game.data.creature.type.ViewModelData;
import electrosphere.game.data.creature.type.ai.AITreeData; import electrosphere.game.data.creature.type.ai.AITreeData;
@ -78,21 +77,11 @@ public class CommonEntityType {
*/ */
LookAtSystem lookAtSystem; LookAtSystem lookAtSystem;
/**
* The model path for this creature
*/
String modelPath;
/** /**
* The view model data for this creature * The view model data for this creature
*/ */
ViewModelData viewModelData; ViewModelData viewModelData;
/**
* The idle data for this creature
*/
IdleData idleData;
/** /**
* The block system for this creature * The block system for this creature
*/ */
@ -167,14 +156,6 @@ public class CommonEntityType {
return tokens; return tokens;
} }
/**
* Gets the path for the model for this creature
* @return The model path
*/
public String getModelPath() {
return modelPath;
}
/** /**
* Gets the list of data of movement types available to this creature * Gets the list of data of movement types available to this creature
* @return The list of movement type data * @return The list of movement type data
@ -255,14 +236,6 @@ public class CommonEntityType {
return viewModelData; return viewModelData;
} }
/**
* Gets the idle data for this creature type (ie animation data)
* @return The idle data
*/
public IdleData getIdleData(){
return idleData;
}
/** /**
* Gets the block system data for this creature type * Gets the block system data for this creature type
* @return The block system data * @return The block system data

View File

@ -13,6 +13,16 @@ public class GraphicsTemplate {
//??? TODO: investigate //??? TODO: investigate
Map<String,ShaderSet> shaderMap; Map<String,ShaderSet> shaderMap;
/**
* The procedural model definition
*/
ProceduralModel proceduralModel;
/**
* The non-procedural model definition
*/
NonproceduralModel model;
public List<String> getShaderOverrideMeshList(){ public List<String> getShaderOverrideMeshList(){
return shaderOverrideMeshList; return shaderOverrideMeshList;
} }
@ -21,6 +31,30 @@ public class GraphicsTemplate {
return shaderMap; return shaderMap;
} }
public void setShaderOverrideMeshList(List<String> shaderOverrideMeshList) {
this.shaderOverrideMeshList = shaderOverrideMeshList;
}
public void setShaderMap(Map<String, ShaderSet> shaderMap) {
this.shaderMap = shaderMap;
}
public ProceduralModel getProceduralModel() {
return proceduralModel;
}
public void setProceduralModel(ProceduralModel proceduralModel) {
this.proceduralModel = proceduralModel;
}
public NonproceduralModel getModel() {
return model;
}
public void setModel(NonproceduralModel model) {
this.model = model;
}
} }

View File

@ -0,0 +1,38 @@
package electrosphere.game.data.graphics;
import electrosphere.game.data.creature.type.IdleData;
/**
* A non-procedural model
*/
public class NonproceduralModel {
/**
* The path to the model
*/
String path;
/**
* The idle data for the model
*/
IdleData idleData;
public String getPath() {
return path;
}
public void setPath(String path) {
this.path = path;
}
public IdleData getIdleData() {
return idleData;
}
public void setIdleData(IdleData idleData) {
this.idleData = idleData;
}
}

View File

@ -0,0 +1,23 @@
package electrosphere.game.data.graphics;
import electrosphere.game.data.foliage.type.TreeModel;
/**
* A procedurally-generated model
*/
public class ProceduralModel {
/**
* Model for generating a procedural tree
*/
TreeModel treeModel;
/**
* Gets the procedural tree model
* @return The procedural tree model if it exists, null otherwise
*/
public TreeModel getTreeModel(){
return treeModel;
}
}

View File

@ -54,9 +54,9 @@ public class CharacterCustomizer {
Globals.viewMatrix = CameraEntityUtils.getCameraViewMatrix(Globals.playerCamera); Globals.viewMatrix = CameraEntityUtils.getCameraViewMatrix(Globals.playerCamera);
//create actor panel //create actor panel
Actor characterActor = ActorUtils.createActorFromModelPath(selectedRaceType.getModelPath()); Actor characterActor = ActorUtils.createActorFromModelPath(selectedRaceType.getGraphicsTemplate().getModel().getPath());
ActorPanel actorPanel = ActorPanel.create(characterActor); ActorPanel actorPanel = ActorPanel.create(characterActor);
actorPanel.setAnimation(selectedRaceType.getIdleData().getAnimation().getNameThirdPerson()); actorPanel.setAnimation(selectedRaceType.getGraphicsTemplate().getModel().getIdleData().getAnimation().getNameThirdPerson());
actorPanel.setPosition(new Vector3f(0,-0.5f,-0.6f)); actorPanel.setPosition(new Vector3f(0,-0.5f,-0.6f));
actorPanel.setScale(new Vector3f(1.0f)); actorPanel.setScale(new Vector3f(1.0f));