Working on ground texturing still
This commit is contained in:
parent
26064dc198
commit
95829bb847
@ -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);
|
||||
|
||||
@ -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);
|
||||
|
||||
BIN
assets/Textures/Ground/Grass1.png
Normal file
BIN
assets/Textures/Ground/Grass1.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.7 MiB |
8
pom.xml
8
pom.xml
@ -144,6 +144,14 @@
|
||||
<version>1.1.0</version>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/org.xerial/sqlite-jdbc -->
|
||||
<dependency>
|
||||
<groupId>org.xerial</groupId>
|
||||
<artifactId>sqlite-jdbc</artifactId>
|
||||
<version>3.36.0.3</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
||||
<profiles>
|
||||
|
||||
@ -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");
|
||||
}
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user