material albedo
All checks were successful
studiorailgun/Renderer/pipeline/head This commit looks good
All checks were successful
studiorailgun/Renderer/pipeline/head This commit looks good
This commit is contained in:
parent
8f8e3165bf
commit
636c0b1537
@ -45,7 +45,7 @@ void main(){
|
||||
);
|
||||
|
||||
//calculate final color
|
||||
vec3 finalColor = light;
|
||||
vec3 finalColor = material.albedo * light;
|
||||
|
||||
//this final calculation is for transparency
|
||||
FragColor = vec4(finalColor, texture(material.diffuse, TexCoord).a);
|
||||
|
||||
@ -54,7 +54,7 @@ void main(){
|
||||
);
|
||||
|
||||
//calculate final color
|
||||
vec4 finalColor = vec4(light,textureColor.a);
|
||||
vec4 finalColor = vec4(material.albedo * light,textureColor.a);
|
||||
|
||||
//calculate weight function
|
||||
float weight = clamp(pow(min(1.0, finalColor.a * 10.0) + 0.01, 3.0) * 1e8 *
|
||||
|
||||
@ -22,4 +22,9 @@ struct Material {
|
||||
* The reflectivity value
|
||||
*/
|
||||
float reflectivity;
|
||||
|
||||
/**
|
||||
* The albedo of the material
|
||||
*/
|
||||
vec3 albedo;
|
||||
};
|
||||
|
||||
@ -1903,6 +1903,7 @@ Materials read some properties from assimp data
|
||||
OpenGLState VAO caching
|
||||
Ambient light sent in dedicated variable to shader
|
||||
Major lighting shader organization rework
|
||||
Material albedo work
|
||||
|
||||
|
||||
|
||||
|
||||
@ -16,7 +16,6 @@ public class SynchronizationProtocol implements ClientProtocolTemplate<Synchroni
|
||||
|
||||
@Override
|
||||
public void handleSyncMessage(SynchronizationMessage message) {
|
||||
Globals.profiler.beginCpuSample("SynchronizationProtocol.handleSynchronizationMessage");
|
||||
switch(message.getMessageSubtype()){
|
||||
case CLIENTREQUESTBTREEACTION:
|
||||
case UPDATECLIENTSTATE:
|
||||
@ -33,7 +32,6 @@ public class SynchronizationProtocol implements ClientProtocolTemplate<Synchroni
|
||||
case LOADSCENE:
|
||||
throw new UnsupportedOperationException("Received synchronization message on the client of unsupported type: " + message.getMessageSubtype());
|
||||
}
|
||||
Globals.profiler.endCpuSample();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -6,6 +6,7 @@ import electrosphere.renderer.OpenGLState;
|
||||
import electrosphere.renderer.texture.Texture;
|
||||
import electrosphere.util.FileUtils;
|
||||
|
||||
import org.joml.Vector3f;
|
||||
import org.lwjgl.PointerBuffer;
|
||||
import org.lwjgl.assimp.AIMaterial;
|
||||
import org.lwjgl.assimp.AIMaterialProperty;
|
||||
@ -78,6 +79,11 @@ public class Material {
|
||||
* The reflectivity value
|
||||
*/
|
||||
private double reflectivity = Material.DEFAULT_REFLECTIVITY;
|
||||
|
||||
/**
|
||||
* The albedo of the model
|
||||
*/
|
||||
private Vector3f albedo = new Vector3f(1);
|
||||
|
||||
/**
|
||||
* A material that contains textures
|
||||
@ -280,6 +286,22 @@ public class Material {
|
||||
public void setSpecular(String t){
|
||||
specular = t;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the albedo of the material
|
||||
* @param albedo The albedo
|
||||
*/
|
||||
public void setAlbedo(Vector3f albedo){
|
||||
this.albedo.set(albedo);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the albedo of the material
|
||||
* @return The albedo
|
||||
*/
|
||||
public Vector3f getAlbedo(){
|
||||
return this.albedo;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the texture pointer
|
||||
@ -354,6 +376,8 @@ public class Material {
|
||||
Globals.renderingEngine.checkError();
|
||||
openGLState.getActiveShader().setUniform(openGLState, "material.reflectivity", (float)this.reflectivity);
|
||||
Globals.renderingEngine.checkError();
|
||||
openGLState.getActiveShader().setUniform(openGLState, "material.albedo", this.albedo);
|
||||
Globals.renderingEngine.checkError();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Loading…
Reference in New Issue
Block a user