diff --git a/assets/Data/audio/surface.json b/assets/Data/audio/surface.json index 9ff1c419..0623acf1 100644 --- a/assets/Data/audio/surface.json +++ b/assets/Data/audio/surface.json @@ -123,7 +123,7 @@ ] }, { - "voxelTypeIds" : [4], + "voxelTypeIds" : [4,6], "footstepRegularBareAudioPaths" : [ "Audio/movement/surface/stone/Bare Step Stone Medium A.wav", "Audio/movement/surface/stone/Bare Step Stone Medium B.wav", diff --git a/assets/Data/entity/creatures/human.json b/assets/Data/entity/creatures/human.json index 24d5b43e..6cbaa57e 100644 --- a/assets/Data/entity/creatures/human.json +++ b/assets/Data/entity/creatures/human.json @@ -552,7 +552,7 @@ "idleData": { "animation": { "nameFirstPerson" : "BindPose", - "nameThirdPerson" : "Idle", + "nameThirdPerson" : "Idle1", "priorityCategory" : "IDLE" } }, diff --git a/assets/Data/entity/creatures/skeleton.json b/assets/Data/entity/creatures/skeleton.json index 6204cea2..19a47a1b 100644 --- a/assets/Data/entity/creatures/skeleton.json +++ b/assets/Data/entity/creatures/skeleton.json @@ -436,7 +436,7 @@ "idleData": { "animation": { "nameFirstPerson" : "Idle", - "nameThirdPerson" : "Idle", + "nameThirdPerson" : "Idle1", "priorityCategory" : "IDLE" } }, diff --git a/assets/Data/game/voxelTypes.json b/assets/Data/game/voxelTypes.json index 77981a1e..f1949ce6 100644 --- a/assets/Data/game/voxelTypes.json +++ b/assets/Data/game/voxelTypes.json @@ -31,6 +31,11 @@ "id" : 5, "name" : "snow", "texture" : "/Textures/Ground/snow1_256.jpg" + }, + { + "id" : 6, + "name" : "stone", + "texture" : "/Textures/Ground/cliff1_256.png" } ] } \ No newline at end of file diff --git a/assets/Models/creatures/person2/person2_1.glb b/assets/Models/creatures/person2/person2_1.glb index 0e9ccdfb..fabb090e 100644 Binary files a/assets/Models/creatures/person2/person2_1.glb and b/assets/Models/creatures/person2/person2_1.glb differ diff --git a/assets/Models/creatures/skeleton/skeleton1.glb b/assets/Models/creatures/skeleton/skeleton1.glb index 575f87ea..3970cd84 100644 Binary files a/assets/Models/creatures/skeleton/skeleton1.glb and b/assets/Models/creatures/skeleton/skeleton1.glb differ diff --git a/assets/Shaders/entities/skysphere/skysphere.fs b/assets/Shaders/entities/skysphere/skysphere.fs index 7e03e86f..98fc124c 100644 --- a/assets/Shaders/entities/skysphere/skysphere.fs +++ b/assets/Shaders/entities/skysphere/skysphere.fs @@ -1,50 +1,39 @@ -#version 330 core +#version 450 core + + +/** +Bind points for different SSBOs +*/ +#define DIRECT_LIGHT_SSBO_BIND_POINT 3 + +/** +transparency +*/ +#define SMALL_EPSILON 0.001 + +/** +The direct global light +*/ +struct DirectLight { + vec3 direction; + vec3 color; +}; + + out vec4 FragColor; +layout(std430, binding = DIRECT_LIGHT_SSBO_BIND_POINT) restrict buffer dirLightSSBO { + DirectLight directLight; +}; + struct Material { sampler2D diffuse; sampler2D specular; float shininess; }; -struct DirLight { - vec3 direction; - - vec3 ambient; - vec3 diffuse; - vec3 specular; -}; - -struct PointLight { - vec3 position; - - float constant; - float linear; - float quadratic; - - vec3 ambient; - vec3 diffuse; - vec3 specular; -}; - -struct SpotLight { - vec3 position; - vec3 direction; - float cutOff; - float outerCutOff; - - float constant; - float linear; - float quadratic; - - vec3 ambient; - vec3 diffuse; - vec3 specular; -}; - -#define NR_POINT_LIGHTS 10 in vec3 FragPos; in vec3 Normal; @@ -52,9 +41,6 @@ in vec2 TexCoord; in vec4 FragPosLightSpace; uniform vec3 viewPos; -uniform DirLight dirLight; -uniform PointLight pointLights[NR_POINT_LIGHTS]; -uniform SpotLight spotLight; uniform Material material; //texture stuff @@ -65,6 +51,9 @@ uniform int hasTransparency; //light depth map uniform sampler2D shadowMap; +// function prototypes +float calcLightIntensityTotal(vec3 normal); + void main(){ if(hasTransparency == 1){ @@ -72,5 +61,29 @@ void main(){ discard; } } - FragColor = texture(material.diffuse, TexCoord); + vec4 textureColor = texture(material.diffuse, TexCoord); + + //grab light intensity + vec3 norm = normalize(Normal); + vec3 lightIntensity = vec3(calcLightIntensityTotal(norm)); + + //calculate final color + vec3 finalColor = textureColor.rgb * lightIntensity; + FragColor = vec4(finalColor, textureColor.a); +} + +float calcLightIntensityAmbient(){ + //calculate average of ambient light + float avg = (directLight.color.x + directLight.color.y + directLight.color.z)/3.0; + return avg; +} + +// +float calcLightIntensityTotal(vec3 normal){ + //ambient intensity + float ambientLightIntensity = calcLightIntensityAmbient(); + + //sum + float total = ambientLightIntensity; + return total; } \ No newline at end of file diff --git a/assets/Shaders/entities/skysphere/skysphere.vs b/assets/Shaders/entities/skysphere/skysphere.vs index 705dcba4..bf0f47ec 100644 --- a/assets/Shaders/entities/skysphere/skysphere.vs +++ b/assets/Shaders/entities/skysphere/skysphere.vs @@ -21,6 +21,7 @@ uniform mat4 lightSpaceMatrix; //output buffers out vec3 Normal; out vec3 FragPos; +out vec3 ViewFragPos; out vec2 TexCoord; out vec4 FragPosLightSpace; @@ -35,6 +36,7 @@ void main() { //push frag, normal, and texture positions to fragment shader FragPos = vec3(model * FinalVertex); + ViewFragPos = vec3(view * model * FinalVertex); Normal = mat3(transpose(inverse(model))) * aNormal; TexCoord = aTex; diff --git a/assets/Shaders/instanced/colorshift/colorshift.fs b/assets/Shaders/instanced/colorshift/colorshift.fs index e7c72dba..529fb343 100644 --- a/assets/Shaders/instanced/colorshift/colorshift.fs +++ b/assets/Shaders/instanced/colorshift/colorshift.fs @@ -85,15 +85,10 @@ in vec3 colorShiftValue; uniform vec3 viewPos; -// uniform DirLight dirLight; -// uniform PointLight pointLights[NR_POINT_LIGHTS]; -// uniform SpotLight spotLight; uniform Material material; //texture stuff -// uniform sampler2D ourTexture; uniform int hasTransparency; -// uniform sampler2D specularTexture; //light depth map uniform sampler2D shadowMap; diff --git a/assets/Textures/Ground/cliff1_256.png b/assets/Textures/Ground/cliff1_256.png new file mode 100644 index 00000000..e1b32a4e Binary files /dev/null and b/assets/Textures/Ground/cliff1_256.png differ diff --git a/docs/src/progress/currenttarget.md b/docs/src/progress/currenttarget.md index 6e95f104..d5185f34 100644 --- a/docs/src/progress/currenttarget.md +++ b/docs/src/progress/currenttarget.md @@ -16,14 +16,24 @@ + feedback driven requirements Item/Equip overhaul (again) - Add punching/unarmed combat + - Implement gadgets + - Trap + - Bear + - Freeze + - Flame + - Bomb (to be thrown) + - Regular (Deals damage, ignites) + - Air (high push coeff) + - Flash (dazes) + - Sleep (puts enemies to sleep) + - Smoke (creates LOS blockers) + - Decoy (creates a decoy) + - Torch + - Throwable potions Fix ui scaling on abnormal monitors - Better skybox - - Fix transparency calculations for far-out objects Crouching Model clothing, hair for the human particles, light on sword collision - Looking angle leverages rotators to swing sword at angle (ie if you look up you swing your sword into the sky) - Come up with a title for the game and create a title menu for it (ideally with some animation and music) Objectives - PVP arena mode initially? - Spawn player at start of a dungeon diff --git a/docs/src/progress/renderertodo.md b/docs/src/progress/renderertodo.md index 559c79bb..fe5759b0 100644 --- a/docs/src/progress/renderertodo.md +++ b/docs/src/progress/renderertodo.md @@ -841,6 +841,9 @@ Tree model debug menu (09/24/2024) Make voxel selection panel have better spacing +Partially fix idle animations for human + skeleton +Directional lighting color control +Skysphere affected by directional lighting # TODO @@ -1012,6 +1015,12 @@ Weather tracking - Keeps track at macro level of temperature - Keeps track at macro level of precipitation +Environmental Audio Service + - Tracks characteristics about surroundings to determine looping audio to play + - Voxels nearby + - Major entity types nearby + - Biomes + Color Palette Generator diff --git a/src/main/java/electrosphere/client/ui/menu/ingame/MenuGeneratorsLevelEditor.java b/src/main/java/electrosphere/client/ui/menu/ingame/MenuGeneratorsLevelEditor.java index 1295d753..ea34aa51 100644 --- a/src/main/java/electrosphere/client/ui/menu/ingame/MenuGeneratorsLevelEditor.java +++ b/src/main/java/electrosphere/client/ui/menu/ingame/MenuGeneratorsLevelEditor.java @@ -425,6 +425,45 @@ public class MenuGeneratorsLevelEditor { directionalLight.setDirection(direction); })); scrollable.addChild(zDiv); + + Div rDiv = Div.createDiv(); + rDiv.setMaxHeight(50); + rDiv.setFlexDirection(YogaFlexDirection.Row); + rDiv.addChild(Label.createLabel("R: ")); + rDiv.addChild(Slider.createSlider((ValueChangeEvent event) -> { + LightManager lightManager = Globals.renderingEngine.getLightManager(); + DirectionalLight directionalLight = lightManager.getDirectionalLight(); + Vector3f color = directionalLight.getColor(); + color.x = event.getAsFloat() * 2 - 1; + directionalLight.setColor(color); + })); + scrollable.addChild(rDiv); + + Div gDiv = Div.createDiv(); + gDiv.setMaxHeight(50); + gDiv.setFlexDirection(YogaFlexDirection.Row); + gDiv.addChild(Label.createLabel("G: ")); + gDiv.addChild(Slider.createSlider((ValueChangeEvent event) -> { + LightManager lightManager = Globals.renderingEngine.getLightManager(); + DirectionalLight directionalLight = lightManager.getDirectionalLight(); + Vector3f color = directionalLight.getColor(); + color.y = event.getAsFloat() * 2 - 1; + directionalLight.setColor(color); + })); + scrollable.addChild(gDiv); + + Div bDiv = Div.createDiv(); + bDiv.setMaxHeight(50); + bDiv.setFlexDirection(YogaFlexDirection.Row); + bDiv.addChild(Label.createLabel("B: ")); + bDiv.addChild(Slider.createSlider((ValueChangeEvent event) -> { + LightManager lightManager = Globals.renderingEngine.getLightManager(); + DirectionalLight directionalLight = lightManager.getDirectionalLight(); + Vector3f color = directionalLight.getColor(); + color.z = event.getAsFloat() * 2 - 1; + directionalLight.setColor(color); + })); + scrollable.addChild(bDiv); Globals.signalSystem.post(SignalType.YOGA_APPLY,mainSidePanel); diff --git a/src/main/java/electrosphere/renderer/anim/Animation.java b/src/main/java/electrosphere/renderer/anim/Animation.java index 46edef68..4a2b9dcc 100644 --- a/src/main/java/electrosphere/renderer/anim/Animation.java +++ b/src/main/java/electrosphere/renderer/anim/Animation.java @@ -23,7 +23,6 @@ public class Animation { //common animations public static final String ANIMATION_MOVEMENT_STARTUP = "WalkStart"; public static final String ANIMATION_MOVEMENT_MOVE = "Walk"; - public static final String ANIMATION_IDLE_1 = "Idle1"; public static final String ANIMATION_SWING_PRIMARY = "SwingWeapon"; public static final String ANIMATION_SPRINT_STARTUP = "RunStart"; public static final String ANIMATION_SPRINT = "Run"; diff --git a/src/test/java/electrosphere/menu/WindowUtilsTests.java b/src/test/java/electrosphere/client/ui/menu/WindowUtilsTests.java similarity index 99% rename from src/test/java/electrosphere/menu/WindowUtilsTests.java rename to src/test/java/electrosphere/client/ui/menu/WindowUtilsTests.java index 61fc9ba0..ad2f97a6 100644 --- a/src/test/java/electrosphere/menu/WindowUtilsTests.java +++ b/src/test/java/electrosphere/client/ui/menu/WindowUtilsTests.java @@ -1,4 +1,4 @@ -package electrosphere.menu; +package electrosphere.client.ui.menu; import static org.junit.jupiter.api.Assertions.*;