render pathing nodes
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
4b1efb2bcf
commit
5c82c0fc93
BIN
assets/Models/engine/waypoint.glb
Normal file
BIN
assets/Models/engine/waypoint.glb
Normal file
Binary file not shown.
@ -1,3 +1,3 @@
|
|||||||
#maven.buildNumber.plugin properties file
|
#maven.buildNumber.plugin properties file
|
||||||
#Wed May 28 21:00:17 EDT 2025
|
#Fri May 30 13:38:53 EDT 2025
|
||||||
buildNumber=643
|
buildNumber=644
|
||||||
|
|||||||
@ -2075,6 +2075,7 @@ Sprinting/physics work
|
|||||||
Reorganizing macro classes
|
Reorganizing macro classes
|
||||||
Start work on macro pathfinding storage
|
Start work on macro pathfinding storage
|
||||||
Town constructs nav graph of road nodes
|
Town constructs nav graph of road nodes
|
||||||
|
Render pathing nodes (still needs some work)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -103,4 +103,9 @@ public class AssetDataStrings {
|
|||||||
public static final String INTERACT_SFX_BLOCK_PICKUP = "Audio/interact/Grab Cloth High A.wav";
|
public static final String INTERACT_SFX_BLOCK_PICKUP = "Audio/interact/Grab Cloth High A.wav";
|
||||||
public static final String INTERACT_SFX_BLOCK_PLACE = "Audio/interact/High Five A.wav";
|
public static final String INTERACT_SFX_BLOCK_PLACE = "Audio/interact/High Five A.wav";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Debug geometry of the engine
|
||||||
|
*/
|
||||||
|
public static final String MODEL_WAYPOINT = "Models/engine/waypoint.glb";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -125,4 +125,21 @@ public class DrawableUtils {
|
|||||||
Globals.clientState.clientScene.registerEntityToTag(entity, EntityTags.DRAW_CAST_SHADOW);
|
Globals.clientState.clientScene.registerEntityToTag(entity, EntityTags.DRAW_CAST_SHADOW);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Makes an entity drawable with a model at a given path
|
||||||
|
* @param entity The entity
|
||||||
|
* @param path The path to the model
|
||||||
|
*/
|
||||||
|
public static void makeEntityDrawable(Entity entity, String path){
|
||||||
|
entity.putData(EntityDataStrings.DATA_STRING_ACTOR, ActorUtils.createActorFromModelPath(path));
|
||||||
|
entity.putData(EntityDataStrings.DATA_STRING_POSITION, new Vector3d(0,0,0));
|
||||||
|
entity.putData(EntityDataStrings.DATA_STRING_ROTATION, new Quaterniond().identity());
|
||||||
|
entity.putData(EntityDataStrings.DATA_STRING_SCALE, new Vector3f(1,1,1));
|
||||||
|
entity.putData(EntityDataStrings.DATA_STRING_DRAW, true);
|
||||||
|
entity.putData(EntityDataStrings.DRAW_SOLID_PASS, true);
|
||||||
|
Globals.clientState.clientScene.registerEntityToTag(entity, EntityTags.DRAWABLE);
|
||||||
|
Globals.clientState.clientScene.registerEntityToTag(entity, EntityTags.DRAW_VOLUMETIC_SOLIDS_PASS);
|
||||||
|
Globals.clientState.clientScene.registerEntityToTag(entity, EntityTags.DRAW_CAST_SHADOW);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,7 +7,7 @@ import org.joml.AABBd;
|
|||||||
import org.joml.Matrix4d;
|
import org.joml.Matrix4d;
|
||||||
import org.joml.Quaterniond;
|
import org.joml.Quaterniond;
|
||||||
import org.joml.Vector3d;
|
import org.joml.Vector3d;
|
||||||
import org.lwjgl.opengl.GL40;
|
import org.lwjgl.opengl.GL45;
|
||||||
import org.ode4j.ode.DAABBC;
|
import org.ode4j.ode.DAABBC;
|
||||||
import org.ode4j.ode.DCapsule;
|
import org.ode4j.ode.DCapsule;
|
||||||
import org.ode4j.ode.DGeom;
|
import org.ode4j.ode.DGeom;
|
||||||
@ -51,6 +51,7 @@ import electrosphere.server.datacell.utils.EntityLookupUtils;
|
|||||||
import electrosphere.server.macro.MacroData;
|
import electrosphere.server.macro.MacroData;
|
||||||
import electrosphere.server.macro.civilization.road.Road;
|
import electrosphere.server.macro.civilization.road.Road;
|
||||||
import electrosphere.server.macro.region.MacroRegion;
|
import electrosphere.server.macro.region.MacroRegion;
|
||||||
|
import electrosphere.server.macro.spatial.path.MacroPathNode;
|
||||||
import electrosphere.server.macro.structure.VirtualStructure;
|
import electrosphere.server.macro.structure.VirtualStructure;
|
||||||
import electrosphere.util.math.SpatialMathUtils;
|
import electrosphere.util.math.SpatialMathUtils;
|
||||||
import electrosphere.util.math.region.RegionPrism;
|
import electrosphere.util.math.region.RegionPrism;
|
||||||
@ -68,6 +69,11 @@ public class DebugContentPipeline implements RenderPipeline {
|
|||||||
*/
|
*/
|
||||||
private List<Entity> farmPlotEntities = new LinkedList<Entity>();
|
private List<Entity> farmPlotEntities = new LinkedList<Entity>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Renderables for macro nav graph entities
|
||||||
|
*/
|
||||||
|
private List<Entity> macroNavEntities = new LinkedList<Entity>();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(OpenGLState openGLState, RenderPipelineState renderPipelineState) {
|
public void render(OpenGLState openGLState, RenderPipelineState renderPipelineState) {
|
||||||
Globals.profiler.beginCpuSample("DebugContentPipeline.render");
|
Globals.profiler.beginCpuSample("DebugContentPipeline.render");
|
||||||
@ -75,8 +81,8 @@ public class DebugContentPipeline implements RenderPipeline {
|
|||||||
//bind screen fbo
|
//bind screen fbo
|
||||||
RenderingEngine.screenFramebuffer.bind(openGLState);
|
RenderingEngine.screenFramebuffer.bind(openGLState);
|
||||||
openGLState.glDepthTest(true);
|
openGLState.glDepthTest(true);
|
||||||
openGLState.glDepthFunc(GL40.GL_LESS);
|
openGLState.glDepthFunc(GL45.GL_LESS);
|
||||||
GL40.glDepthMask(true);
|
GL45.glDepthMask(true);
|
||||||
openGLState.glViewport(Globals.gameConfigCurrent.getSettings().getRenderResolutionX(), Globals.gameConfigCurrent.getSettings().getRenderResolutionY());
|
openGLState.glViewport(Globals.gameConfigCurrent.getSettings().getRenderResolutionX(), Globals.gameConfigCurrent.getSettings().getRenderResolutionY());
|
||||||
|
|
||||||
///
|
///
|
||||||
@ -242,6 +248,41 @@ public class DebugContentPipeline implements RenderPipeline {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(this.macroNavEntities.isEmpty()){
|
||||||
|
MacroData macroData = Globals.serverState.realmManager.first().getMacroData();
|
||||||
|
List<MacroPathNode> pathNodes = macroData.getPathCache().getNodes();
|
||||||
|
if(pathNodes.size() > 0){
|
||||||
|
for(MacroPathNode pathNode : pathNodes){
|
||||||
|
Entity pathDebugEnt = EntityCreationUtils.createClientSpatialEntity();
|
||||||
|
DrawableUtils.makeEntityDrawable(pathDebugEnt, AssetDataStrings.MODEL_WAYPOINT);
|
||||||
|
EntityUtils.getPosition(pathDebugEnt).set(pathNode.getPosition());
|
||||||
|
EntityUtils.getScale(pathDebugEnt).set(1);
|
||||||
|
this.macroNavEntities.add(pathDebugEnt);
|
||||||
|
//draw paths between nodes
|
||||||
|
List<MacroPathNode> neighbors = pathNode.getNeighborNodes(macroData.getPathCache());
|
||||||
|
for(MacroPathNode neighbor : neighbors){
|
||||||
|
if(neighbor.getId() < pathNode.getId()){
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
//render connections between points
|
||||||
|
MacroData macroData = Globals.serverState.realmManager.first().getMacroData();
|
||||||
|
List<MacroPathNode> pathNodes = macroData.getPathCache().getNodes();
|
||||||
|
if(pathNodes.size() > 0){
|
||||||
|
for(MacroPathNode pathNode : pathNodes){
|
||||||
|
//draw paths between nodes
|
||||||
|
List<MacroPathNode> neighbors = pathNode.getNeighborNodes(macroData.getPathCache());
|
||||||
|
for(MacroPathNode neighbor : neighbors){
|
||||||
|
if(neighbor.getId() < pathNode.getId()){
|
||||||
|
DebugContentPipeline.renderTube(openGLState, renderPipelineState, modelTransformMatrix, pathNode.getPosition(), neighbor.getPosition(), 1, AssetDataStrings.TEXTURE_YELLOW_TRANSPARENT);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if(!this.farmPlotEntities.isEmpty()){
|
if(!this.farmPlotEntities.isEmpty()){
|
||||||
for(Entity entity : this.farmPlotEntities){
|
for(Entity entity : this.farmPlotEntities){
|
||||||
@ -249,6 +290,12 @@ public class DebugContentPipeline implements RenderPipeline {
|
|||||||
}
|
}
|
||||||
this.farmPlotEntities.clear();
|
this.farmPlotEntities.clear();
|
||||||
}
|
}
|
||||||
|
if(!this.macroNavEntities.isEmpty()){
|
||||||
|
for(Entity entity : this.macroNavEntities){
|
||||||
|
ClientEntityUtils.destroyEntity(entity);
|
||||||
|
}
|
||||||
|
this.macroNavEntities.clear();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|||||||
@ -199,7 +199,7 @@ public class MacroPathNode {
|
|||||||
* @return The list of node ids
|
* @return The list of node ids
|
||||||
*/
|
*/
|
||||||
public List<MacroPathNode> getNeighborNodes(MacroPathCache cache) {
|
public List<MacroPathNode> getNeighborNodes(MacroPathCache cache) {
|
||||||
return this.neighborNodes.stream().map((Long id) -> cache.getNodeById(objectId)).collect(Collectors.toList());
|
return this.neighborNodes.stream().map((Long neighborId) -> cache.getNodeById(neighborId)).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user