documentation, bug fixes
All checks were successful
studiorailgun/Renderer/pipeline/head This commit looks good

This commit is contained in:
austin 2024-04-17 19:34:25 -04:00
parent 788a71d1e1
commit 597a969151
31 changed files with 169 additions and 58 deletions

View File

@ -334,7 +334,7 @@
"maxHealth" : 100, "maxHealth" : 100,
"onDamageIFrames" : 30 "onDamageIFrames" : 30
}, },
"modelPath" : "Models/baseman5.glb" "modelPath" : "Models/person2_1.glb"
} }
], ],
"files" : [] "files" : []

View File

@ -22,28 +22,6 @@
} }
] ]
}, },
{
"path" : "Models/proceduralTree1/proceduralTrunk1.fbx",
"meshes" : [
{
"meshName" : "Cube",
"rotation" : [-0.7071068, 0.0, 0.0, 0.7071068],
"offset" : [0.0, 0.0, 0.0],
"scale" : [1.0, 1.0, 1.0]
}
]
},
{
"path" : "Models/proceduralTree2/proceduralTree2.fbx",
"meshes" : [
{
"meshName" : "Trunk",
"rotation" : [-0.7071068, 0.0, 0.0, 0.7071068],
"offset" : [0.0, 0.0, 0.0],
"scale" : [1.0, 1.0, 1.0]
}
]
},
{ {
"path" : "Models/proceduralTree2/proceduralTree2v2.fbx", "path" : "Models/proceduralTree2/proceduralTree2v2.fbx",
"meshes" : [ "meshes" : [
@ -51,7 +29,30 @@
"meshName" : "Trunk", "meshName" : "Trunk",
"rotation" : [-0.7071068, 0.0, 0.0, 0.7071068], "rotation" : [-0.7071068, 0.0, 0.0, 0.7071068],
"offset" : [0.0, 0.0, 0.0], "offset" : [0.0, 0.0, 0.0],
"scale" : [1.0, 1.0, 1.0] "scale" : [100.0, 100.0, 100.0]
}
]
},
{
"path" : "Models/foliageBlockTemplate1Test1.fbx",
"meshes" : [
{
"meshName" : "Plane",
"rotation" : [-0.7071068, 0.0, 0.0, 0.7071068],
"offset" : [0.0, 0.0, 0.0],
"scale" : [100.0, 100.0, 100.0]
},
{
"meshName" : "Plane.001",
"rotation" : [-0.7071068, 0.0, 0.0, 0.7071068],
"offset" : [0.0, 0.0, 0.0],
"scale" : [100.0, 100.0, 100.0]
},
{
"meshName" : "Plane.002",
"rotation" : [-0.7071068, 0.0, 0.0, 0.7071068],
"offset" : [0.0, 0.0, 0.0],
"scale" : [100.0, 100.0, 100.0]
} }
] ]
}, },
@ -65,6 +66,16 @@
"meshes" : [ "meshes" : [
] ]
}, },
{
"path" : "Models/person2_1.glb",
"globalTransform": {
"rotation" : [0,0,0,1],
"offset" : [0.0, 0.0, 0.0],
"scale" : [0.6, 0.6, 0.6]
},
"meshes" : [
]
},
{ {
"path" : "Models/grass2.fbx", "path" : "Models/grass2.fbx",
"globalTransform": { "globalTransform": {
@ -77,7 +88,7 @@
"meshName" : "Plane", "meshName" : "Plane",
"rotation" : [-0.7071068, 0.0, 0.0, 0.7071068], "rotation" : [-0.7071068, 0.0, 0.0, 0.7071068],
"offset" : [0.0, 0.0, 0.0], "offset" : [0.0, 0.0, 0.0],
"scale" : [1.0, 1.0, 1.0] "scale" : [100.0, 100.0, 100.0]
} }
] ]
} }

BIN
assets/Models/person2_1.glb Normal file

Binary file not shown.

BIN
assets/Models/shorts.glb Normal file

Binary file not shown.

View File

@ -1,3 +1,3 @@
#maven.buildNumber.plugin properties file #maven.buildNumber.plugin properties file
#Sat Apr 13 21:46:23 EDT 2024 #Sun Apr 14 15:53:43 EDT 2024
buildNumber=96 buildNumber=98

View File

@ -0,0 +1,68 @@
@page BasicClothingGuide Basic Clothing Guide
## High Level Overview
The idea of this page is to track notes about creating simple clothing items that work with existing creature models.
## Setting Up The File
Create a new blender file.
Link the armature from the existing creature model.
![](/docs/src/images/blender/basicClothing/clothingLinkOption.png)
![](/docs/src/images/blender/basicClothing/clothingSelectLinkArmature.png)
Append the relevant meshes from the existing creature model.
![](/docs/src/images/blender/basicClothing/clothingAppend.png)
![](/docs/src/images/blender/basicClothing/clothingSelectRightMeshImport.png)
Clean up the existing mesh
![](/docs/src/images/blender/basicClothing/clothingDeletingVertices.png)
You can use the circle select mode to significantly speed up selection of vertices to delete
![](/docs/src/images/blender/basicClothing/clothingSwitchToAreaSelect.png)
## Attach Armature
Add the armature modifier to the mesh you have created
![](/docs/src/images/blender/basicClothing/clothingAddArmatureModifier.png)
Select the dropper icon for Object
![](/docs/src/images/blender/basicClothing/clothingArmatureModifierSelectArmatureEyedrop.png)
And click on the armature object in the tree view in the top right
![](/docs/src/images/blender/basicClothing/clothingClickOnArmature.png)
You can validate that it added the modifier correctly by selecting the bones, going into pose mode, and setting the pose to watch the mesh move.
![](/docs/src/images/blender/basicClothing/clothingTestWithPose.png)
## Solidify Modifier
Add the solidify modifier to make the clothing have depth
![](/docs/src/images/blender/basicClothing/clothingSolidifyModifier.png)
![](/docs/src/images/blender/basicClothing/clothingSolidifyModifierApply.png)

View File

@ -2,3 +2,4 @@
[TOC] [TOC]
- @subpage WeavingMeshes - @subpage WeavingMeshes
- @subpage BasicClothingGuide

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 133 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 93 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 106 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 184 KiB

View File

@ -218,6 +218,7 @@ Terrain editing UI
(04/13/2024) (04/13/2024)
UI Work UI Work
- Level editor ability to destroy an entity on server, have it also destroy on client, AND not persist on save - Level editor ability to destroy an entity on server, have it also destroy on client, AND not persist on save
- Environment controls (not persisting in save yet)
# TODO # TODO

View File

@ -63,7 +63,11 @@ import electrosphere.logger.LoggerInterface;
*/ */
public class CollisionEngine { public class CollisionEngine {
//step interval time size
public static final float ENGINE_STEP_SIZE = 0.01f; public static final float ENGINE_STEP_SIZE = 0.01f;
//gravity constant
public static final float GRAVITY_MAGNITUDE = 9.8f;
//world data that the collision engine leverages for position correction and the like //world data that the collision engine leverages for position correction and the like
CollisionWorldData collisionWorldData; CollisionWorldData collisionWorldData;
@ -88,13 +92,10 @@ public class CollisionEngine {
//callbacks for collision check //callbacks for collision check
RayCastCallback rayCastCallback = new RayCastCallback(); RayCastCallback rayCastCallback = new RayCastCallback();
//physics damping
static final float linearDamping = 0.02f;
public CollisionEngine(){ public CollisionEngine(){
world = OdeHelper.createWorld(); world = OdeHelper.createWorld();
space = OdeHelper.createBHVSpace(Collidable.TYPE_STATIC_BIT); space = OdeHelper.createBHVSpace(Collidable.TYPE_STATIC_BIT);
world.setGravity(0,-3,0); world.setGravity(0,-GRAVITY_MAGNITUDE,0);
contactgroup = OdeHelper.createJointGroup(); contactgroup = OdeHelper.createJointGroup();
} }

View File

@ -24,6 +24,7 @@ import static org.lwjgl.glfw.GLFW.GLFW_KEY_E;
import static org.lwjgl.glfw.GLFW.GLFW_KEY_ENTER; import static org.lwjgl.glfw.GLFW.GLFW_KEY_ENTER;
import static org.lwjgl.glfw.GLFW.GLFW_KEY_ESCAPE; import static org.lwjgl.glfw.GLFW.GLFW_KEY_ESCAPE;
import static org.lwjgl.glfw.GLFW.GLFW_KEY_F; import static org.lwjgl.glfw.GLFW.GLFW_KEY_F;
import static org.lwjgl.glfw.GLFW.GLFW_KEY_F2;
import static org.lwjgl.glfw.GLFW.GLFW_KEY_F24; import static org.lwjgl.glfw.GLFW.GLFW_KEY_F24;
import static org.lwjgl.glfw.GLFW.GLFW_KEY_G; import static org.lwjgl.glfw.GLFW.GLFW_KEY_G;
import static org.lwjgl.glfw.GLFW.GLFW_KEY_H; import static org.lwjgl.glfw.GLFW.GLFW_KEY_H;
@ -94,9 +95,9 @@ import electrosphere.entity.types.creature.CreatureUtils;
import electrosphere.logger.LoggerInterface; import electrosphere.logger.LoggerInterface;
import electrosphere.menu.WindowStrings; import electrosphere.menu.WindowStrings;
import electrosphere.menu.WindowUtils; import electrosphere.menu.WindowUtils;
import electrosphere.menu.debug.ImGuiWindowMacros;
import electrosphere.menu.ingame.MenuGeneratorsInGame; import electrosphere.menu.ingame.MenuGeneratorsInGame;
import electrosphere.menu.ingame.MenuGeneratorsInventory; import electrosphere.menu.ingame.MenuGeneratorsInventory;
import electrosphere.menu.mainmenu.MenuGeneratorsDebug;
import electrosphere.renderer.ui.elements.Window; import electrosphere.renderer.ui.elements.Window;
import electrosphere.renderer.ui.events.ClickEvent; import electrosphere.renderer.ui.events.ClickEvent;
import electrosphere.renderer.ui.events.KeyboardEvent; import electrosphere.renderer.ui.events.KeyboardEvent;
@ -378,7 +379,7 @@ public class ControlHandler {
Debug controls Debug controls
*/ */
handler.addControl(DATA_STRING_INPUT_CODE_DEBUG_SPAWN_ITEM, new Control(ControlType.KEY,GLFW_KEY_Q)); handler.addControl(DATA_STRING_INPUT_CODE_DEBUG_SPAWN_ITEM, new Control(ControlType.KEY,GLFW_KEY_Q));
handler.addControl(DEBUG_OPEN_DEBUG_MENU, new Control(ControlType.KEY, GLFW_KEY_O)); handler.addControl(DEBUG_OPEN_DEBUG_MENU, new Control(ControlType.KEY, GLFW_KEY_F2));
/* /*
return return
@ -980,7 +981,9 @@ public class ControlHandler {
Vector3d eyePos = new Vector3d(CameraEntityUtils.getCameraEye(camera)); Vector3d eyePos = new Vector3d(CameraEntityUtils.getCameraEye(camera));
Vector3d centerPos = new Vector3d(CameraEntityUtils.getCameraCenter(camera)); Vector3d centerPos = new Vector3d(CameraEntityUtils.getCameraCenter(camera));
Vector3d cursorPos = collisionEngine.rayCastPosition(new Vector3d(centerPos), new Vector3d(eyePos).mul(-1.0), 5.0); Vector3d cursorPos = collisionEngine.rayCastPosition(new Vector3d(centerPos), new Vector3d(eyePos).mul(-1.0), 5.0);
TerrainEditing.editTerrain(cursorPos, 1.1f, 2, 0.01f); if(Globals.clientSelectedVoxelType != null){
TerrainEditing.editTerrain(cursorPos, 1.1f, Globals.clientSelectedVoxelType.getId(), 0.1f);
}
} }
}}); }});
controls.get(INPUT_CODE_PLACE_TERRAIN).setOnRepeat(new ControlMethod(){public void execute(){ controls.get(INPUT_CODE_PLACE_TERRAIN).setOnRepeat(new ControlMethod(){public void execute(){
@ -993,7 +996,9 @@ public class ControlHandler {
Vector3d eyePos = new Vector3d(CameraEntityUtils.getCameraEye(camera)); Vector3d eyePos = new Vector3d(CameraEntityUtils.getCameraEye(camera));
Vector3d centerPos = new Vector3d(CameraEntityUtils.getCameraCenter(camera)); Vector3d centerPos = new Vector3d(CameraEntityUtils.getCameraCenter(camera));
Vector3d cursorPos = collisionEngine.rayCastPosition(new Vector3d(centerPos), new Vector3d(eyePos).mul(-1.0), 5.0); Vector3d cursorPos = collisionEngine.rayCastPosition(new Vector3d(centerPos), new Vector3d(eyePos).mul(-1.0), 5.0);
TerrainEditing.editTerrain(cursorPos, 1.1f, 2, 0.01f); if(Globals.clientSelectedVoxelType != null){
TerrainEditing.editTerrain(cursorPos, 1.1f, Globals.clientSelectedVoxelType.getId(), 0.1f);
}
} }
}}); }});
controls.get(INPUT_CODE_PLACE_TERRAIN).setRepeatTimeout(0.2f * Main.targetFrameRate); controls.get(INPUT_CODE_PLACE_TERRAIN).setRepeatTimeout(0.2f * Main.targetFrameRate);
@ -1049,14 +1054,7 @@ public class ControlHandler {
alwaysOnDebugControlList.add(controls.get(DEBUG_OPEN_DEBUG_MENU)); alwaysOnDebugControlList.add(controls.get(DEBUG_OPEN_DEBUG_MENU));
controls.get(DEBUG_OPEN_DEBUG_MENU).setOnPress(new ControlMethod(){public void execute(){ controls.get(DEBUG_OPEN_DEBUG_MENU).setOnPress(new ControlMethod(){public void execute(){
LoggerInterface.loggerEngine.INFO("open debug menu"); LoggerInterface.loggerEngine.INFO("open debug menu");
// Window mainMenuWindow = new Window(0, 0, Globals.WINDOW_WIDTH, Globals.WINDOW_HEIGHT); ImGuiWindowMacros.toggleMainDebugMenu();
Window mainMenuInGame = MenuGeneratorsDebug.createTopLevelDebugMenu();
// mainMenuWindow.addChild(mainMenuInGame);
Globals.elementManager.registerWindow(WindowStrings.WINDOW_DEBUG, mainMenuInGame);
WindowUtils.recursiveSetVisible(Globals.elementManager.getWindow(WindowStrings.WINDOW_DEBUG), true);
Globals.elementManager.focusFirstElement();
Globals.controlHandler.setHandlerState(ControlsState.IN_GAME_MAIN_MENU);
Globals.controlHandler.showMouse();
//play sound effect //play sound effect
Globals.virtualAudioSourceManager.createVirtualAudioSource("/Audio/openMenu.ogg", VirtualAudioSourceType.UI, false); Globals.virtualAudioSourceManager.createVirtualAudioSource("/Audio/openMenu.ogg", VirtualAudioSourceType.UI, false);
}}); }});

View File

@ -450,6 +450,10 @@ public class Globals {
//game config //game config
gameConfigDefault = electrosphere.game.data.Config.loadDefaultConfig(); gameConfigDefault = electrosphere.game.data.Config.loadDefaultConfig();
gameConfigCurrent = gameConfigDefault; gameConfigCurrent = gameConfigDefault;
//
//Values that depend on the loaded config
Globals.clientSelectedVoxelType = (VoxelType)gameConfigCurrent.getVoxelData().getTypes().toArray()[1];
//player manager //player manager
playerManager = new PlayerManager(); playerManager = new PlayerManager();
//behavior tree tracking service //behavior tree tracking service

View File

@ -146,9 +146,9 @@ 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/tank1.fbx"); // Globals.assetManager.addModelPathToQueue("/Models/baseman9.glb");
// Globals.assetManager.loadAssetsInQueue(); // Globals.assetManager.loadAssetsInQueue();
// Model model = Globals.assetManager.fetchModel("/Models/tank1.fbx"); // Model model = Globals.assetManager.fetchModel("/Models/baseman9.glb");
// // for(electrosphere.renderer.anim.Animation anim : model.animations){ // // for(electrosphere.renderer.anim.Animation anim : model.animations){
// // if(anim.name.equals("Armature|Idle1")){ // // if(anim.name.equals("Armature|Idle1")){
// // System.out.println(anim.duration); // // System.out.println(anim.duration);
@ -161,7 +161,8 @@ public class Main {
// // break; // // break;
// // } // // }
// // } // // }
// model.animations.get(0).fullDescribeAnimation(); // model.describeHighLevel();
// // model.animations.get(0).fullDescribeAnimation();
// // model.describeHighLevel(); // // model.describeHighLevel();
// System.exit(0); // System.exit(0);
// } // }

View File

@ -28,8 +28,7 @@ import org.ode4j.ode.DBody;
import org.ode4j.ode.DWorld; import org.ode4j.ode.DWorld;
/** /**
* * Manages all assets loaded into the engine including initially loading and destructing
* @author amaterasu
*/ */
public class AssetManager { public class AssetManager {

View File

@ -226,7 +226,7 @@ public class ClientLoading {
Entity cursorTracker = EntityCreationUtils.createClientSpatialEntity(); Entity cursorTracker = EntityCreationUtils.createClientSpatialEntity();
EntityCreationUtils.makeEntityDrawable(cursorTracker, "Models/unitsphere_1.fbx"); EntityCreationUtils.makeEntityDrawable(cursorTracker, "Models/unitsphere_1.fbx");
EntityUtils.getScale(cursorTracker).set(0.3f); EntityUtils.getScale(cursorTracker).set(30f);
Globals.clientSceneWrapper.getScene().registerBehaviorTree(new BehaviorTree() { Globals.clientSceneWrapper.getScene().registerBehaviorTree(new BehaviorTree() {
@Override @Override
public void simulate(float deltaTime) { public void simulate(float deltaTime) {

View File

@ -215,22 +215,22 @@ public class ServerGroundMovementTree implements BehaviorTree {
case SETFACING: case SETFACING:
break; break;
case MOVEUPDATE: { case MOVEUPDATE: {
if(updateTime > lastUpdateTime){ if(updateTime >= lastUpdateTime){
lastUpdateTime = updateTime; lastUpdateTime = updateTime;
switch(message.gettreeState()){ switch(message.gettreeState()){
case 0: case 0:
state = MovementTreeState.STARTUP; state = MovementTreeState.STARTUP;
// System.out.println("Set state STARTUP"); // System.out.println("Set state STARTUP");
GravityUtils.serverAttemptActivateGravity(parent); GravityUtils.serverAttemptActivateGravity(parent);
break; break;
case 1: case 1:
state = MovementTreeState.MOVE; state = MovementTreeState.MOVE;
// System.out.println("Set state MOVE"); // System.out.println("Set state MOVE");
GravityUtils.serverAttemptActivateGravity(parent); GravityUtils.serverAttemptActivateGravity(parent);
break; break;
case 2: case 2:
state = MovementTreeState.SLOWDOWN; state = MovementTreeState.SLOWDOWN;
// System.out.println("Set state SLOWDOWN"); // System.out.println("Set state SLOWDOWN");
GravityUtils.serverAttemptActivateGravity(parent); GravityUtils.serverAttemptActivateGravity(parent);
break; break;
case 3: case 3:

View File

@ -241,4 +241,11 @@ public class ImGuiWindowMacros {
RenderingEngine.addImGuiWindow(mainDebugWindow); RenderingEngine.addImGuiWindow(mainDebugWindow);
} }
/**
* Toggles the open state of the menu
*/
public static void toggleMainDebugMenu(){
mainDebugWindow.setOpen(!mainDebugWindow.isOpen());
}
} }

View File

@ -47,6 +47,9 @@ public class MenuGeneratorsLevelEditor {
//width of the side panel //width of the side panel
static final int SIDE_PANEL_WIDTH = 500; static final int SIDE_PANEL_WIDTH = 500;
//is the voxel selection window open
static boolean voxelWindowOpen = false;
/** /**
* Creates the level editor side panel top view * Creates the level editor side panel top view
@ -106,7 +109,13 @@ public class MenuGeneratorsLevelEditor {
//select voxel button //select voxel button
scrollable.addChild(Button.createButton("Select Voxel Type", new ClickEventCallback() {public boolean execute(ClickEvent event){ scrollable.addChild(Button.createButton("Select Voxel Type", new ClickEventCallback() {public boolean execute(ClickEvent event){
WindowUtils.replaceWindow(WindowStrings.VOXEL_TYPE_SELECTION,MenuGeneratorsTerrainEditing.createVoxelTypeSelectionPanel()); if(voxelWindowOpen){
voxelWindowOpen = false;
WindowUtils.closeWindow(WindowStrings.VOXEL_TYPE_SELECTION);
} else {
voxelWindowOpen = true;
WindowUtils.replaceWindow(WindowStrings.VOXEL_TYPE_SELECTION,MenuGeneratorsTerrainEditing.createVoxelTypeSelectionPanel());
}
return false; return false;
}})); }}));

View File

@ -81,6 +81,14 @@ public class ImGuiWindow {
this.open.set(open); this.open.set(open);
} }
/**
* Gets whether the window is open or not
* @return true if open, false otherwise
*/
public boolean isOpen(){
return this.open.get();
}
/** /**
* An optional callback for the window that lets you directly call imgui functions * An optional callback for the window that lets you directly call imgui functions

View File

@ -475,10 +475,13 @@ public class GriddedDataCellManager implements DataCellManager, VoxelCellManager
//update terrain //update terrain
serverTerrainManager.deformTerrainAtLocationToValue(worldPosition, voxelPosition, weight, type); serverTerrainManager.deformTerrainAtLocationToValue(worldPosition, voxelPosition, weight, type);
//broadcast update to terrain //broadcast update to terrain
groundDataCells.get(getServerDataCellKey(worldPosition)).broadcastNetworkMessage(TerrainMessage.constructUpdateVoxelMessage( ServerDataCell cell = groundDataCells.get(getServerDataCellKey(worldPosition));
worldPosition.x, worldPosition.y, worldPosition.z, if(cell != null){
voxelPosition.x, voxelPosition.y, voxelPosition.z, cell.broadcastNetworkMessage(TerrainMessage.constructUpdateVoxelMessage(
weight, type)); worldPosition.x, worldPosition.y, worldPosition.z,
voxelPosition.x, voxelPosition.y, voxelPosition.z,
weight, type));
}
terrainEditLock.release(); terrainEditLock.release();
} }