diff --git a/assets/Config/settings.json b/assets/Config/settings.json index 655d4b85..702cac18 100644 --- a/assets/Config/settings.json +++ b/assets/Config/settings.json @@ -2,8 +2,8 @@ "gameplayGenerateWorld" : false, "gameplayPhysicsCellRadius" : 2, - "displayWidth" : 2560, - "displayHeight" : 1600, + "displayWidth" : 1920, + "displayHeight" : 1080, "graphicsFOV" : 90.0, diff --git a/assets/Shaders/terrain/terrain.fs b/assets/Shaders/terrain/terrain.fs index d5fc1f5e..4d88050b 100644 --- a/assets/Shaders/terrain/terrain.fs +++ b/assets/Shaders/terrain/terrain.fs @@ -118,7 +118,7 @@ void main(){ //} //result += CalcSpotLight(spotLight, norm, FragPos, viewDir); - FragColor = vec4(result, texture(material.diffuse, TexCoord).a);//texture(ourTexture, TexCoord);//vec4(result, 1.0); + FragColor = vec4(result, 1);//texture(ourTexture, TexCoord);//vec4(result, 1.0); } // calculates the color when using a directional light. @@ -233,5 +233,5 @@ vec3 blendedTextureColor(vec2 texPos, vec4 tex1, vec4 tex2, vec4 tex3, vec4 tex4 // float percentTex2 = (texPos.x - 0) * (texPos.y - 1); // float percentTex3 = (texPos.x - 1) * (texPos.y - 0); // float percentTex4 = (texPos.x - 0) * (texPos.y - 0); - return vec3(0,0,0);//mix(mix(tex1,tex2,texPos.x),mix(tex3,tex4,texPos.x),texPos.y).rgb; + return mix(mix(tex1,tex2,texPos.x),mix(tex3,tex4,texPos.x),texPos.y).rgb; } \ No newline at end of file diff --git a/src/main/java/electrosphere/game/client/cells/DrawCell.java b/src/main/java/electrosphere/game/client/cells/DrawCell.java index 8ec023ea..4d00a025 100644 --- a/src/main/java/electrosphere/game/client/cells/DrawCell.java +++ b/src/main/java/electrosphere/game/client/cells/DrawCell.java @@ -10,9 +10,11 @@ import electrosphere.game.collision.collidable.Collidable; import electrosphere.game.terrain.processing.TerrainInterpolator; import electrosphere.logger.LoggerInterface; import electrosphere.main.Globals; +import electrosphere.renderer.Mesh; import electrosphere.renderer.Model; import electrosphere.renderer.ModelUtils; import electrosphere.renderer.ShaderProgram; +import electrosphere.renderer.texture.Texture; import electrosphere.util.Utilities; import org.joml.Quaternionf; import org.joml.Vector3f; @@ -35,7 +37,17 @@ public class DrawCell { CollisionObject physicsObject; + static Texture groundTextureOne; + static Texture groundTextureTwo; + static Texture groundTextureThree; + static Texture groundTextureFour; + static { + groundTextureOne = new Texture("/Textures/Ground/Dirt1.png"); + groundTextureTwo = new Texture("/Textures/wheat1.png"); + groundTextureThree = new Texture("/Textures/Ground/Dirt1.png"); + groundTextureFour = new Texture("/Textures/Ground/Dirt1.png"); + } DrawCell(){ @@ -52,12 +64,7 @@ public class DrawCell { * ITS NOT EVEN UP TO DATE! * 06/13/2021 * - * @param drawArray - * @param drawWidth - * @param cellX - * @param cellY - * @param cellWidth - * @param program + * //@param drawArray */ public static DrawCell generateTerrainCell( int cellX, @@ -84,6 +91,12 @@ public class DrawCell { Globals.entityManager.deregisterEntity(modelEntity); } Model terrainModel = ModelUtils.createTerrainModelPrecomputedShader(heightmap, program, stride); + Mesh terrainMesh = terrainModel.meshes.get(0); + terrainMesh.useTextureList = true; + terrainMesh.textureList.add(groundTextureOne); + terrainMesh.textureList.add(groundTextureTwo); + terrainMesh.textureList.add(groundTextureThree); + terrainMesh.textureList.add(groundTextureFour); String terrainModelPath = Globals.assetManager.registerModel(terrainModel); modelEntity = EntityUtils.spawnDrawableEntity(terrainModelPath); modelEntity.putData(EntityDataStrings.TERRAIN_IS_TERRAIN, true); diff --git a/src/main/java/electrosphere/game/client/cells/DrawCellManager.java b/src/main/java/electrosphere/game/client/cells/DrawCellManager.java index 5f68d7dd..8574db94 100644 --- a/src/main/java/electrosphere/game/client/cells/DrawCellManager.java +++ b/src/main/java/electrosphere/game/client/cells/DrawCellManager.java @@ -94,7 +94,7 @@ public class DrawCellManager { cellX = discreteX; cellY = discreteY; - program = Globals.defaultMeshShader; + program = Globals.terrainShaderProgram; drawRadius = Globals.userSettings.getGraphicsPerformanceLODChunkRadius(); drawStepdownInterval = Globals.userSettings.getGameplayPhysicsCellRadius(); diff --git a/src/main/java/electrosphere/renderer/Mesh.java b/src/main/java/electrosphere/renderer/Mesh.java index 0ed60c05..d3bfb2b2 100644 --- a/src/main/java/electrosphere/renderer/Mesh.java +++ b/src/main/java/electrosphere/renderer/Mesh.java @@ -73,7 +73,7 @@ public class Mesh { boolean hasBones = true; public boolean hasTextureCoords = true; - public List textureList; + public List textureList = new ArrayList(); public boolean useTextureList; public String textureListArrayUniformName; @@ -758,11 +758,7 @@ public class Mesh { } } - if(useTextureList){ - for(Texture texture : textureList){ - - } - } + @@ -774,6 +770,16 @@ public class Mesh { glUniform1i(glGetUniformLocation(Globals.renderingEngine.getActiveShader().shaderProgram, "shadowMap"), 3); } + if(useTextureList){ + int i = 0; + glUniform1i(glGetUniformLocation(Globals.renderingEngine.getActiveShader().shaderProgram, "groundTextures"),4); + for(Texture texture : textureList){ +// glUniform1i(glGetUniformLocation(Globals.renderingEngine.getActiveShader().shaderProgram, "groundTextures[" + 4+i*2 + "]"),4+i*2); + texture.bind(4+i*2); + i++; + } + } + if(setBones){ //