mesh color uniform
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit
This commit is contained in:
parent
678e5b9c88
commit
ccd10c9665
@ -19,7 +19,7 @@ uniform Material material;
|
||||
/**
|
||||
The color to apply to the model
|
||||
*/
|
||||
uniform vec3 color;
|
||||
uniform vec4 color;
|
||||
|
||||
/**
|
||||
The output
|
||||
|
||||
@ -2066,6 +2066,7 @@ Error report on window.java
|
||||
Delete ActorShaderMask
|
||||
Fix string carousels
|
||||
Fix sprint animation data
|
||||
Color uniform on meshes
|
||||
|
||||
|
||||
|
||||
|
||||
@ -100,7 +100,7 @@ public class Actor {
|
||||
/**
|
||||
* the model path of the model backing the actor
|
||||
*/
|
||||
private String baseModelPath;
|
||||
private final String baseModelPath;
|
||||
|
||||
/**
|
||||
* Path to the low res model
|
||||
|
||||
@ -25,6 +25,7 @@ import org.joml.Sphered;
|
||||
import org.joml.Vector3d;
|
||||
import org.joml.Vector3f;
|
||||
import org.joml.Vector3i;
|
||||
import org.joml.Vector4d;
|
||||
import org.joml.Vector4f;
|
||||
|
||||
import org.lwjgl.opengl.GL45;
|
||||
@ -174,6 +175,11 @@ public class Mesh {
|
||||
*/
|
||||
private Material material;
|
||||
|
||||
/**
|
||||
* The color to apply to the mesh
|
||||
*/
|
||||
private Vector4d color = new Vector4d(1);
|
||||
|
||||
/**
|
||||
* the bounding sphere for this mesh
|
||||
*/
|
||||
@ -582,6 +588,7 @@ public class Mesh {
|
||||
Globals.profiler.beginAggregateCpuSample("Buffer standard uniforms");
|
||||
//buffer model/view/proj matrices
|
||||
try(MemoryStack stack = MemoryStack.stackPush()){
|
||||
openGLState.getActiveShader().setUniform(openGLState, "color", this.color);
|
||||
openGLState.getActiveShader().setUniform(openGLState, "model", parent.getModelMatrix());
|
||||
openGLState.getActiveShader().setUniform(openGLState, "viewPos", CameraEntityUtils.getCameraEye(Globals.clientState.playerCamera));
|
||||
drawVec3f.set((float)parent.getWorldPos().x,(float)parent.getWorldPos().y,(float)parent.getWorldPos().z);
|
||||
|
||||
@ -9,6 +9,7 @@ import org.joml.Vector2i;
|
||||
import org.joml.Vector3d;
|
||||
import org.joml.Vector3f;
|
||||
import org.joml.Vector3i;
|
||||
import org.joml.Vector4d;
|
||||
import org.joml.Vector4f;
|
||||
import org.lwjgl.opengl.GL40;
|
||||
|
||||
@ -91,6 +92,22 @@ public class ShaderUtils {
|
||||
uniformMap.put(uniformLocation,new Matrix4d(currentUniform)); //create new matrix4f to break pointer-matching with equals on cache check
|
||||
}
|
||||
|
||||
//
|
||||
//vector4d
|
||||
} else if(value instanceof Vector4d){
|
||||
Vector4d currentUniform = (Vector4d)value;
|
||||
float4Arr[0] = (float)currentUniform.x;
|
||||
float4Arr[1] = (float)currentUniform.y;
|
||||
float4Arr[2] = (float)currentUniform.z;
|
||||
float4Arr[3] = (float)currentUniform.w;
|
||||
GL40.glUniform4fv(uniformLocation, float4Arr);
|
||||
Globals.renderingEngine.checkError();
|
||||
if(uniformMap.containsKey(uniformLocation)){
|
||||
((Vector4d)uniformMap.get(uniformLocation)).set(currentUniform);
|
||||
} else {
|
||||
uniformMap.put(uniformLocation,new Vector4d(currentUniform)); //create new vector3f to break pointer-matching with equals on cache check
|
||||
}
|
||||
|
||||
//
|
||||
//vector4f
|
||||
} else if(value instanceof Vector4f){
|
||||
|
||||
Loading…
Reference in New Issue
Block a user