par shapes work
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit

This commit is contained in:
austin 2024-09-07 14:03:26 -04:00
parent df3010f38a
commit 09341af70c
8 changed files with 93 additions and 12 deletions

View File

@ -1,3 +1,3 @@
#maven.buildNumber.plugin properties file
#Wed Sep 04 09:33:29 EDT 2024
buildNumber=320
#Sat Sep 07 08:28:40 EDT 2024
buildNumber=324

14
pom.xml
View File

@ -125,6 +125,20 @@
<version>${lwjgl.version}</version>
<classifier>${lwjgl.natives}</classifier>
</dependency>
<!--par_shapes-->
<!--License: MIT-->
<dependency>
<groupId>org.lwjgl</groupId>
<artifactId>lwjgl-par</artifactId>
<version>${lwjgl.version}</version>
</dependency>
<dependency>
<groupId>org.lwjgl</groupId>
<artifactId>lwjgl-par</artifactId>
<version>${lwjgl.version}</version>
<classifier>${lwjgl.natives}</classifier>
</dependency>
<!--JOML-->
<!--License: MIT-->

View File

@ -602,13 +602,9 @@ public class Globals {
//init fluid shader program
FluidChunkModelGeneration.fluidChunkShaderProgram = ShaderProgram.loadSpecificShader("/Shaders/entities/fluid2/fluid2.vs", "/Shaders/entities/fluid2/fluid2.fs");
//init models
assetManager.addModelPathToQueue("Models/basic/geometry/unitsphere.glb");
assetManager.addModelPathToQueue("Models/basic/geometry/unitsphere.fbx");
assetManager.addModelPathToQueue("Models/basic/geometry/unitsphere_1.fbx");
assetManager.addModelPathToQueue("Models/basic/geometry/unitsphere_grey.fbx");
assetManager.registerModelToSpecificString(RenderUtils.createUnitsphere(), AssetDataStrings.UNITSPHERE);
assetManager.registerModelToSpecificString(RenderUtils.createUnitCylinder(), AssetDataStrings.UNITCYLINDER);
assetManager.addModelPathToQueue("Models/basic/geometry/SmallCube.fbx");
assetManager.addModelPathToQueue("Models/basic/geometry/unitcylinder.fbx");
assetManager.addModelPathToQueue("Models/basic/geometry/unitcylinder.glb");
assetManager.addModelPathToQueue("Models/basic/geometry/unitcapsule.glb");
assetManager.addModelPathToQueue("Models/basic/geometry/unitplane.fbx");
assetManager.addModelPathToQueue("Models/basic/geometry/unitcube.fbx");

View File

@ -8,4 +8,12 @@ public class AssetDataStrings {
public static final String ASSET_STRING_SKYBOX_BASIC = "skyboxBasic";
public static final String BITMAP_CHARACTER_MODEL = "bitmapCharacterModel";
public static final String LEAVES_MODEL = "leaves";
/**
* The basic geometry of the engine
*/
public static final String UNITSPHERE = "unitSphere";
public static final String UNITCYLINDER = "unitCylinder";
}

View File

@ -11,6 +11,7 @@ import electrosphere.client.targeting.crosshair.Crosshair;
import electrosphere.client.terrain.cells.DrawCellManager;
import electrosphere.controls.ControlHandler;
import electrosphere.engine.Globals;
import electrosphere.engine.assetmanager.AssetDataStrings;
import electrosphere.engine.signal.Signal.SignalType;
import electrosphere.engine.threads.LabeledThread.ThreadLabel;
import electrosphere.entity.DrawableUtils;
@ -244,7 +245,7 @@ public class ClientLoading {
//player's cursor
Globals.playerCursor = EntityCreationUtils.createClientSpatialEntity();
EntityCreationUtils.makeEntityDrawable(Globals.playerCursor, "Models/basic/geometry/unitsphere_1.fbx");
EntityCreationUtils.makeEntityDrawable(Globals.playerCursor, AssetDataStrings.UNITSPHERE);
DrawableUtils.makeEntityTransparent(Globals.playerCursor);
EntityUtils.getScale(Globals.playerCursor).set(30f);
}

View File

@ -20,6 +20,8 @@ import org.lwjgl.BufferUtils;
import static org.lwjgl.opengl.GL11.GL_FLOAT;
import org.lwjgl.opengl.GL40;
import org.lwjgl.util.par.ParShapes;
import org.lwjgl.util.par.ParShapesMesh;
/**
* Utilities to assist with rendering
@ -339,6 +341,64 @@ public class RenderUtils {
return rVal;
}
/**
* Generates a unit sphere model
* @return The model
*/
public static Model createUnitsphere(){
Model model = new Model();
Mesh sphereMesh = new Mesh("sphere");
sphereMesh.generateVAO();
//buffer coords
ParShapesMesh data = ParShapes.par_shapes_create_parametric_sphere(10, 5);
int numPoints = data.npoints();
FloatBuffer verts = data.points(numPoints * 3);
sphereMesh.bufferVertices(verts, 3);
FloatBuffer texCoords = data.tcoords(numPoints * 3);
sphereMesh.bufferTextureCoords(texCoords, 2);
//setup extra structures
Material mat = new Material();
mat.set_diffuse("Textures/color/transparent_teal.png");
sphereMesh.setMaterial(mat);
sphereMesh.setShader(ShaderProgram.smart_assemble_shader(false, true));
GL40.glBindVertexArray(0);
sphereMesh.setParent(model);
model.getMeshes().add(sphereMesh);
return model;
}
/**
* Creates a unit cylinder model
* @return The model
*/
public static Model createUnitCylinder(){
Model model = new Model();
Mesh sphereMesh = new Mesh("cylinder");
sphereMesh.generateVAO();
//buffer coords
ParShapesMesh data = ParShapes.par_shapes_create_cylinder(10, 2);
int numPoints = data.npoints();
FloatBuffer verts = data.points(numPoints * 3);
sphereMesh.bufferVertices(verts, 3);
FloatBuffer texCoords = data.tcoords(numPoints * 2);
sphereMesh.bufferTextureCoords(texCoords, 2);
//setup extra structures
Material mat = new Material();
mat.set_diffuse("Textures/color/transparent_teal.png");
sphereMesh.setMaterial(mat);
sphereMesh.setShader(ShaderProgram.smart_assemble_shader(false, true));
GL40.glBindVertexArray(0);
sphereMesh.setParent(model);
model.getMeshes().add(sphereMesh);
return model;
}
@Deprecated
public static Model createBitmapDisplay(){

View File

@ -7,6 +7,7 @@ import org.joml.Vector3f;
import org.lwjgl.opengl.GL40;
import electrosphere.engine.Globals;
import electrosphere.engine.assetmanager.AssetDataStrings;
import electrosphere.entity.Entity;
import electrosphere.entity.EntityUtils;
import electrosphere.entity.types.camera.CameraEntityUtils;
@ -68,7 +69,7 @@ public class DebugBonesPipeline implements RenderPipeline {
//Get target data
//
Actor targetActor = EntityUtils.getActor(targetEntity);
Model boneModel = Globals.assetManager.fetchModel("Models/basic/geometry/unitcylinder.fbx");
Model boneModel = Globals.assetManager.fetchModel(AssetDataStrings.UNITCYLINDER);
boneModel.getMaterials().get(0).set_diffuse(Globals.textureDiffuseDefault);
for(Bone bone : targetActor.getBoneValues()){
Vector3d bonePos = MathBones.getBoneWorldPosition(targetEntity, bone.boneID);

View File

@ -13,6 +13,7 @@ import org.ode4j.ode.DSphere;
import electrosphere.collision.PhysicsUtils;
import electrosphere.collision.collidable.Collidable;
import electrosphere.engine.Globals;
import electrosphere.engine.assetmanager.AssetDataStrings;
import electrosphere.entity.Entity;
import electrosphere.entity.EntityDataStrings;
import electrosphere.entity.EntityUtils;
@ -78,7 +79,7 @@ public class DebugContentPipeline implements RenderPipeline {
if(geom instanceof DSphere){
DSphere sphereView = (DSphere)geom;
HitboxState shapeStatus = hitboxState.getShapeStatus(geom);
if((hitboxModel = Globals.assetManager.fetchModel("Models/basic/geometry/unitsphere.glb")) != null){
if((hitboxModel = Globals.assetManager.fetchModel(AssetDataStrings.UNITSPHERE)) != null){
//set color based on collision status, type, etc
Texture texture = Globals.assetManager.fetchTexture(getHitboxColor(shapeStatus,shapeStatus.getHitboxData()));
if(texture != null){
@ -133,7 +134,7 @@ public class DebugContentPipeline implements RenderPipeline {
if(geom instanceof DSphere){
DSphere sphereView = (DSphere)geom;
HitboxState shapeStatus = hitboxState.getShapeStatus(geom);
if((hitboxModel = Globals.assetManager.fetchModel("Models/basic/geometry/unitsphere.glb")) != null){
if((hitboxModel = Globals.assetManager.fetchModel(AssetDataStrings.UNITSPHERE)) != null){
//set color based on collision status, type, etc
Texture texture = Globals.assetManager.fetchTexture(getHitboxColor(shapeStatus,shapeStatus.getHitboxData()));
if(texture != null){