From 9db672321f6ad6ad42d71393d178fed24463ccd8 Mon Sep 17 00:00:00 2001 From: austin Date: Wed, 20 Nov 2024 21:44:19 -0500 Subject: [PATCH] Light fixes --- assets/Data/entity/creatures/human.json | 16 ---------------- assets/Data/entity/creatures/skeleton.json | 16 ---------------- assets/Shaders/core/light/cull.comp | 6 +++++- buildNumber.properties | 4 ++-- docs/src/progress/renderertodo.md | 2 ++ .../renderer/light/LightManager.java | 1 + 6 files changed, 10 insertions(+), 35 deletions(-) diff --git a/assets/Data/entity/creatures/human.json b/assets/Data/entity/creatures/human.json index f6d5a337..c9b0b5e3 100644 --- a/assets/Data/entity/creatures/human.json +++ b/assets/Data/entity/creatures/human.json @@ -572,22 +572,6 @@ "maxHealth" : 100, "onDamageIFrames" : 30 }, - "pointLight" : { - "const": 1.0, - "linear": 0.9, - "quadratic": 0.9, - "radius": 3.0, - "color": { - "x": 0.3, - "y": 0.3, - "z": 0.3 - }, - "offset": { - "x": 0.0, - "y": 0.0, - "z": 0.0 - } - }, "graphicsTemplate": { "model": { "idleData": { diff --git a/assets/Data/entity/creatures/skeleton.json b/assets/Data/entity/creatures/skeleton.json index ba2b8a71..218ec81f 100644 --- a/assets/Data/entity/creatures/skeleton.json +++ b/assets/Data/entity/creatures/skeleton.json @@ -456,22 +456,6 @@ "maxHealth" : 60, "onDamageIFrames" : 30 }, - "pointLight" : { - "const": 1.0, - "linear": 0.9, - "quadratic": 0.9, - "radius": 3.0, - "color": { - "x": 0.3, - "y": 0.3, - "z": 0.3 - }, - "offset": { - "x": 0.0, - "y": 0.0, - "z": 0.0 - } - }, "graphicsTemplate": { "model": { "idleData": { diff --git a/assets/Shaders/core/light/cull.comp b/assets/Shaders/core/light/cull.comp index 8851ce09..34ce4708 100644 --- a/assets/Shaders/core/light/cull.comp +++ b/assets/Shaders/core/light/cull.comp @@ -46,11 +46,15 @@ layout(std430, binding = POINT_LIGHT_SSBO_BIND_POINT) restrict buffer lightSSBO uniform mat4 viewMatrix; +/** + * Number of lights in the scene + */ +uniform int lightCount; + bool testSphereAABB(uint i, Cluster c); // each invocation of main() is a thread processing a cluster void main() { - uint lightCount = pointLight.length(); uint index = gl_WorkGroupID.x * CULL_LOCAL_SIZE + gl_LocalInvocationID.x; Cluster cluster = clusters[index]; diff --git a/buildNumber.properties b/buildNumber.properties index 7813d687..6c48ef73 100644 --- a/buildNumber.properties +++ b/buildNumber.properties @@ -1,3 +1,3 @@ #maven.buildNumber.plugin properties file -#Wed Nov 20 16:01:40 EST 2024 -buildNumber=398 +#Wed Nov 20 21:32:04 EST 2024 +buildNumber=399 diff --git a/docs/src/progress/renderertodo.md b/docs/src/progress/renderertodo.md index 9b7d11e2..3d0ba987 100644 --- a/docs/src/progress/renderertodo.md +++ b/docs/src/progress/renderertodo.md @@ -1105,6 +1105,8 @@ Fix server terrain generation lock spinning on loading terrain from disk Fix crosshair NPE when camera undefined Fix ray casting entity filtering bug Fix ClientTerrainManager concurrent editing bug +Fix point lights not being cleared from buffer after deletion +Remove point lights from skeleton + human # TODO diff --git a/src/main/java/electrosphere/renderer/light/LightManager.java b/src/main/java/electrosphere/renderer/light/LightManager.java index 84d54071..1004da2c 100644 --- a/src/main/java/electrosphere/renderer/light/LightManager.java +++ b/src/main/java/electrosphere/renderer/light/LightManager.java @@ -214,6 +214,7 @@ public class LightManager { ComputeShader lightCull = Globals.assetManager.fetchComputeShader(AssetDataStrings.COMPUTE_LIGHT_CULL); openGLState.setActiveShader(renderPipelineState, lightCull); lightCull.setUniform(openGLState, "viewMatrix", Globals.viewMatrix); + lightCull.setUniform(openGLState, "lightCount", this.entityPointLightMap.values().size()); int dispatchLocal = (LIGHT_CLUSTER_WIDTH_X * LIGHT_CLUSTER_WIDTH_Y * LIGHT_CLUSTER_WIDTH_Z) / CULL_LOCAL_SIZE; lightCull.dispatch(dispatchLocal, ComputeShader.DEFAULT_LOCAL_SIZE, ComputeShader.DEFAULT_LOCAL_SIZE);