Add shaders files for shader based lighting (ops)
This commit is contained in:
@@ -264,13 +264,13 @@ public class GLProxy
|
||||
try
|
||||
{
|
||||
// get the shaders from the resource folder
|
||||
// vertexShader = LodShader.loadShader(GL20.GL_VERTEX_SHADER, "shaders" + File.separator + "standard.vert", false);
|
||||
// fragmentShader = LodShader.loadShader(GL20.GL_FRAGMENT_SHADER, "shaders" + File.separator + "flat_shaded.frag", false);
|
||||
vertexShader = LodShader.loadShader(GL20.GL_VERTEX_SHADER, "shaders/standard.vert", false);
|
||||
fragmentShader = LodShader.loadShader(GL20.GL_FRAGMENT_SHADER, "shaders/flat_shaded.frag", false);
|
||||
|
||||
// this can be used when testing shaders,
|
||||
// since we can't hot swap the files in the resource folder
|
||||
vertexShader = LodShader.loadShader(GL20.GL_VERTEX_SHADER, "C:/Users/James Seibel/Desktop/shaders/standard.vert", true);
|
||||
fragmentShader = LodShader.loadShader(GL20.GL_FRAGMENT_SHADER, "C:/Users/James Seibel/Desktop/shaders/flat_shaded.frag", true);
|
||||
// vertexShader = LodShader.loadShader(GL20.GL_VERTEX_SHADER, "C:/Users/James Seibel/Desktop/shaders/standard.vert", true);
|
||||
// fragmentShader = LodShader.loadShader(GL20.GL_FRAGMENT_SHADER, "C:/Users/James Seibel/Desktop/shaders/flat_shaded.frag", true);
|
||||
|
||||
|
||||
// create the shaders
|
||||
|
||||
@@ -2,13 +2,12 @@
|
||||
|
||||
in vec4 vertexColor;
|
||||
in vec4 vertexWorldPos;
|
||||
//in vec2 textureCoord;
|
||||
|
||||
|
||||
|
||||
out vec4 fragColor;
|
||||
|
||||
|
||||
//uniform sampler2D texImage;
|
||||
uniform vec3 cameraPos;
|
||||
|
||||
uniform bool fogEnabled;
|
||||
|
||||
@@ -2,30 +2,46 @@
|
||||
|
||||
in vec3 vPosition;
|
||||
in vec4 color;
|
||||
|
||||
in float blockSkyLight;
|
||||
in float blockLight;
|
||||
|
||||
out vec4 vertexColor;
|
||||
out vec4 vertexWorldPos;
|
||||
//out vec2 textureCoord;
|
||||
out float depth;
|
||||
|
||||
|
||||
uniform mat4 modelViewMatrix;
|
||||
uniform mat4 projectionMatrix;
|
||||
|
||||
uniform int worldSkyLight;
|
||||
uniform sampler2D lightMap;
|
||||
|
||||
|
||||
/**
|
||||
* Vertex Shader
|
||||
*
|
||||
* author: James Seibel
|
||||
* version: 11-26-2021
|
||||
* version: 12-8-2021
|
||||
*/
|
||||
void main()
|
||||
{
|
||||
|
||||
// just skylight
|
||||
// good for sanity checks; but will cause OpenGL errors since we are binding unused data
|
||||
// vertexColor = vec4(color.xyz * worldSkyLight / 16.0, color.w);
|
||||
|
||||
float blockLightTex = blockLight / 16.0;
|
||||
float skyLightTex = worldSkyLight / 16.0;
|
||||
|
||||
// we don't really need alpha in the lightmap
|
||||
// vertexColor = color * vec4(texture(lightMap, vec2(blockLightTex, skyLightTex)).xyz, 1);
|
||||
vertexColor = color * texture(lightMap, vec2(blockLightTex, skyLightTex));
|
||||
|
||||
|
||||
|
||||
// TODO: add a simple white texture to support Optifine shaders
|
||||
//textureCoord = textureCoord;
|
||||
|
||||
vertexColor = color;
|
||||
vertexWorldPos = vec4(vPosition, 1);
|
||||
|
||||
// the vPosition needs to be converted to a vec4 so it can be multiplied
|
||||
|
||||
Reference in New Issue
Block a user