diff --git a/assets/Shaders/terrain/terrain.fs b/assets/Shaders/terrain/terrain.fs index 4d88050b..64853af6 100644 --- a/assets/Shaders/terrain/terrain.fs +++ b/assets/Shaders/terrain/terrain.fs @@ -50,7 +50,7 @@ in vec3 FragPos; in vec3 Normal; in vec2 TexCoord; in vec4 FragPosLightSpace; -in vec4 groundTexIndices; +flat in ivec4 groundTexIndices; uniform vec3 viewPos; uniform DirLight dirLight; @@ -76,7 +76,9 @@ uniform sampler2D groundTextures1; uniform sampler2D groundTextures2; uniform sampler2D groundTextures3; uniform sampler2D groundTextures4; +//fifth texture unit is for shadow map uniform sampler2D groundTextures5; +//this is for bindable ground textures uniform sampler2D groundTextures[10]; // function prototypes @@ -99,10 +101,10 @@ void main(){ // sampler2DArray text = groundTextures; // sampler2D test = groundTextures1; - vec4 texColor1 = texture(groundTextures[int(groundTexIndices.x * 2)], TexCoord); - vec4 texColor2 = texture(groundTextures[int(groundTexIndices.y * 2)], TexCoord); - vec4 texColor3 = texture(groundTextures[int(groundTexIndices.z * 2)], TexCoord); - vec4 texColor4 = texture(groundTextures[int(groundTexIndices.w * 2)], TexCoord); + vec4 texColor1 = texture(groundTextures[groundTexIndices.x * 2], TexCoord); + vec4 texColor2 = texture(groundTextures[groundTexIndices.y * 2], TexCoord); + vec4 texColor3 = texture(groundTextures[groundTexIndices.z * 2], TexCoord); + vec4 texColor4 = texture(groundTextures[groundTexIndices.w * 2], TexCoord); vec3 finalTexColor = blendedTextureColor(TexCoord, texColor1, texColor2, texColor3, texColor4); // vec4 tex2 = texture(groundTextures[int(groundTexIndices.y)], TexCoord); // vec4 tex3 = texture2D(groundTextures[int(groundTexIndex.z * 2)], texPos); diff --git a/assets/Shaders/terrain/terrain.vs b/assets/Shaders/terrain/terrain.vs index d07fbb70..57b506b3 100644 --- a/assets/Shaders/terrain/terrain.vs +++ b/assets/Shaders/terrain/terrain.vs @@ -24,7 +24,7 @@ out vec3 Normal; out vec3 FragPos; out vec2 TexCoord; out vec4 FragPosLightSpace; -out vec4 groundTexIndices; +flat out ivec4 groundTexIndices; @@ -41,7 +41,7 @@ void main() { TexCoord = aTex; //push texure indices to fragment shader - groundTexIndices = groundTexIndices; + groundTexIndices = aGroundTexIndices; //shadow map stuff FragPosLightSpace = lightSpaceMatrix * vec4(FragPos, 1.0); diff --git a/assets/Textures/Ground/Grass1.png b/assets/Textures/Ground/Grass1.png new file mode 100644 index 00000000..1aa1c33a Binary files /dev/null and b/assets/Textures/Ground/Grass1.png differ diff --git a/pom.xml b/pom.xml index e90573c0..9ceda742 100644 --- a/pom.xml +++ b/pom.xml @@ -144,6 +144,14 @@ 1.1.0 + + + org.xerial + sqlite-jdbc + 3.36.0.3 + + + diff --git a/src/main/java/electrosphere/game/client/cells/DrawCell.java b/src/main/java/electrosphere/game/client/cells/DrawCell.java index 4d00a025..530a215e 100644 --- a/src/main/java/electrosphere/game/client/cells/DrawCell.java +++ b/src/main/java/electrosphere/game/client/cells/DrawCell.java @@ -43,8 +43,8 @@ public class DrawCell { static Texture groundTextureFour; static { - groundTextureOne = new Texture("/Textures/Ground/Dirt1.png"); - groundTextureTwo = new Texture("/Textures/wheat1.png"); + groundTextureOne = new Texture("/Textures/Ground/Grass1.png"); + groundTextureTwo = new Texture("/Textures/Ground/Dirt1.png"); groundTextureThree = new Texture("/Textures/Ground/Dirt1.png"); groundTextureFour = new Texture("/Textures/Ground/Dirt1.png"); } diff --git a/src/main/java/electrosphere/renderer/Mesh.java b/src/main/java/electrosphere/renderer/Mesh.java index d3bfb2b2..fec15827 100644 --- a/src/main/java/electrosphere/renderer/Mesh.java +++ b/src/main/java/electrosphere/renderer/Mesh.java @@ -772,12 +772,14 @@ public class Mesh { if(useTextureList){ int i = 0; - glUniform1i(glGetUniformLocation(Globals.renderingEngine.getActiveShader().shaderProgram, "groundTextures"),4); +// glUniform1i(glGetUniformLocation(Globals.renderingEngine.getActiveShader().shaderProgram, "groundTextures"), 5); for(Texture texture : textureList){ -// glUniform1i(glGetUniformLocation(Globals.renderingEngine.getActiveShader().shaderProgram, "groundTextures[" + 4+i*2 + "]"),4+i*2); - texture.bind(4+i*2); +// System.out.println("groundTextures[" + i*2 + "]" + "=>" + (5+i*2)); + texture.bind(5+i*2); + glUniform1i(glGetUniformLocation(Globals.renderingEngine.getActiveShader().shaderProgram, "groundTextures[" + i*2 + "]"),5+i*2); i++; } +// glActiveTexture(GL_TEXTURE0); }