fix first person rendering not sending lighting
All checks were successful
studiorailgun/Renderer/pipeline/head This commit looks good

This commit is contained in:
austin 2024-08-16 16:46:06 -04:00
parent c8fc089607
commit 72bbbca989
13 changed files with 31 additions and 14 deletions

View File

@ -1,5 +1,7 @@
#version 330 core
//FragmentShader.fs
#define NR_POINT_LIGHTS 10
out vec4 FragColor;

View File

@ -1,5 +1,7 @@
#version 330 core
//celShading.fs
#define NR_POINT_LIGHTS 10
out vec4 FragColor;

View File

@ -1,5 +1,7 @@
#version 330 core
//foliage.fs
#define NR_POINT_LIGHTS 10
out vec4 FragColor;

View File

@ -1,5 +1,7 @@
#version 330 core
//colorshift.fs
#define NR_POINT_LIGHTS 10
#define SMALL_EPSILON 0.0001

View File

@ -1,5 +1,7 @@
#version 330 core
//generic.fs
#define NR_POINT_LIGHTS 10
#define SMALL_EPSILON 0.0001

View File

@ -1,5 +1,7 @@
#version 330 core
//proceduraltree.fs
#define NR_POINT_LIGHTS 10
out vec4 FragColor;

View File

@ -1,3 +1,3 @@
#maven.buildNumber.plugin properties file
#Fri Aug 16 16:06:50 EDT 2024
buildNumber=254
#Fri Aug 16 16:31:44 EDT 2024
buildNumber=256

View File

@ -19,7 +19,6 @@
Ticketed randomizer node for BTs to more heavily weight attacking and waiting
+ bug fixes
Fix broken rendering pipeline when creating new level
Fix AI tracking deleted entity
Fix being unable to jump sometimes (usually when pick up sword)
Fix server ground movement tree playing animation over falling animation

View File

@ -596,6 +596,7 @@ Fix attack animation mayyybe caching on non-local clients ??
Fix sword double-swing
Fix physics freakout for vertically aligned entities
Fix AI components not resetting on turning off ai manager
Fix broken rendering pipeline when creating new level
# TODO

View File

@ -15,6 +15,9 @@ import electrosphere.renderer.shader.ShaderProgram;
*/
public class OpenGLState {
//tracks whether caching should be used or not (to deduplicate opengl calls)
private static final boolean DISABLE_CACHING = false;
//the max texture allowed by the current environment
int MAX_TEXTURE_WIDTH = 0;
@ -71,7 +74,7 @@ public class OpenGLState {
* @param y the height
*/
public void glViewport(int x, int y){
if(x != viewport.x || y != viewport.y){
if(DISABLE_CACHING || x != viewport.x || y != viewport.y){
viewport.x = x;
viewport.y = y;
GL40.glViewport(0, 0, viewport.x, viewport.y);
@ -106,7 +109,7 @@ public class OpenGLState {
* @param depthFunction The depth function
*/
public void glDepthFunc(int depthFunction){
if(this.depthFunction != depthFunction){
if(DISABLE_CACHING || this.depthFunction != depthFunction){
this.depthFunction = depthFunction;
GL40.glDepthFunc(this.depthFunction);
}
@ -117,7 +120,7 @@ public class OpenGLState {
* @param texture The active texture
*/
public void glActiveTexture(int texture){
if(this.activeTexture != texture){
if(DISABLE_CACHING || this.activeTexture != texture){
this.activeTexture = texture;
GL40.glActiveTexture(this.activeTexture);
}
@ -139,7 +142,7 @@ public class OpenGLState {
* @param textureType the type of texture (2d, 3d, etc)
*/
public void glBindTextureUnit(int textureUnit, int texturePointer, int textureType){
if(!unitToPointerMap.containsKey(textureUnit) || unitToPointerMap.get(textureUnit)!=texturePointer){
if(DISABLE_CACHING || !unitToPointerMap.containsKey(textureUnit) || unitToPointerMap.get(textureUnit)!=texturePointer){
unitToPointerMap.put(textureUnit,texturePointer);
this.glActiveTexture(textureUnit);
GL40.glBindTexture(textureType,texturePointer);
@ -152,7 +155,7 @@ public class OpenGLState {
* @param framebufferPointer the pointer to the framebuffer
*/
public void glBindFramebuffer(int framebufferType, int framebufferPointer){
if(this.framebufferType != framebufferType || this.framebufferPointer != framebufferPointer){
if(DISABLE_CACHING || this.framebufferType != framebufferType || this.framebufferPointer != framebufferPointer){
this.framebufferType = framebufferType;
this.framebufferPointer = framebufferPointer;
GL40.glBindFramebuffer(this.framebufferType,this.framebufferPointer);
@ -173,7 +176,7 @@ public class OpenGLState {
* @param program The shader program to bind
*/
public void setActiveShader(RenderPipelineState renderPipelineState, ShaderProgram program){
if(program != activeShader){
if(DISABLE_CACHING || program != activeShader){
activeShader = program;
GL40.glUseProgram(activeShader.getShaderId());
renderPipelineState.setCurrentShaderPointer(activeShader.getShaderId());
@ -229,7 +232,7 @@ public class OpenGLState {
* @param dfactor The destination factor
*/
public void glBlendFunci(int drawBufferIndex, int sfactor, int dfactor){
if(this.blendFuncMap.containsKey(drawBufferIndex)){
if(!DISABLE_CACHING && this.blendFuncMap.containsKey(drawBufferIndex)){
int[] funcs = this.blendFuncMap.get(drawBufferIndex);
int sFactorCurr = funcs[0];
int dFactorCurr = funcs[1];

View File

@ -37,7 +37,7 @@ public class FirstPersonItemsPipeline implements RenderPipeline {
//setup opengl state
renderPipelineState.setUseBones(true);
renderPipelineState.setUseLight(false);
renderPipelineState.setUseLight(true);
renderPipelineState.setUseMaterial(true);
renderPipelineState.setUseMeshShader(true);
renderPipelineState.setUseShadowMap(false);

View File

@ -34,8 +34,6 @@ public class MainContentNoOITPipeline implements RenderPipeline {
openGLState.glBlend(true);
openGLState.glBlendFunci(0, GL40.GL_ONE, GL40.GL_ONE);
openGLState.glBlendFunci(1, GL40.GL_ZERO, GL40.GL_ONE_MINUS_SRC_COLOR);
GL40.glBlendFunci(0, GL40.GL_ONE, GL40.GL_ONE);
GL40.glBlendFunci(1, GL40.GL_ZERO, GL40.GL_ONE_MINUS_SRC_COLOR);
GL40.glBlendEquation(GL40.GL_FUNC_ADD);
///

View File

@ -45,6 +45,10 @@ import electrosphere.util.FileUtils;
* A shader program
*/
public class ShaderProgram {
//tracks whether caching should be used or not (to deduplicate opengl calls)
private static final boolean DISABLE_CACHING = false;
//
//Program stuff
//
@ -742,7 +746,7 @@ public class ShaderProgram {
* @param value the value
*/
public void setUniform(int uniformLocation, Object value){
if(!uniformMap.containsKey(uniformLocation) || !uniformMap.get(uniformLocation).equals(value)){
if(DISABLE_CACHING || !uniformMap.containsKey(uniformLocation) || !uniformMap.get(uniformLocation).equals(value)){
uniformMap.put(uniformLocation,value);
if(value instanceof Matrix4f){
Matrix4f currentUniform = (Matrix4f)value;