mirror of
https://github.com/PixelGuys/Cubyz.git
synced 2025-08-03 03:06:55 -04:00
parent
73d50720b4
commit
1a1a503033
@ -26,6 +26,8 @@ layout(location = 7) uniform float sizeScale;
|
||||
layout(location = 8) uniform float reflectionMapSize;
|
||||
layout(location = 9) uniform float contrast;
|
||||
|
||||
layout(location = 10) uniform vec2 glDepthRange;
|
||||
|
||||
const float[6] normalVariations = float[6](
|
||||
1.0,
|
||||
0.80,
|
||||
@ -175,9 +177,7 @@ void mainItemDrop() {
|
||||
vec3 modifiedCameraSpacePos = cameraSpacePos*(1 + total_tMax*sizeScale*length(direction)/length(cameraSpacePos));
|
||||
vec4 projection = projectionMatrix*vec4(modifiedCameraSpacePos, 1);
|
||||
float depth = projection.z/projection.w;
|
||||
gl_FragDepth = ((gl_DepthRange.diff * depth) + gl_DepthRange.near + gl_DepthRange.far)/2.0;
|
||||
|
||||
|
||||
gl_FragDepth = (((glDepthRange.y - glDepthRange.x) * depth) + glDepthRange.x + glDepthRange.y)/2.0;
|
||||
|
||||
fragColor = decodeColor(block);
|
||||
fragColor.a = 1; // No transparency supported!
|
||||
|
@ -553,6 +553,7 @@ pub const ItemDropRenderer = struct { // MARK: ItemDropRenderer
|
||||
block: c_int,
|
||||
reflectionMapSize: c_int,
|
||||
contrast: c_int,
|
||||
glDepthRange: c_int,
|
||||
} = undefined;
|
||||
|
||||
var itemModelSSBO: graphics.SSBO = undefined;
|
||||
@ -682,6 +683,9 @@ pub const ItemDropRenderer = struct { // MARK: ItemDropRenderer
|
||||
c.glUniform3fv(itemUniforms.ambientLight, 1, @ptrCast(&ambientLight));
|
||||
c.glUniformMatrix4fv(itemUniforms.viewMatrix, 1, c.GL_TRUE, @ptrCast(&viewMatrix));
|
||||
c.glUniform1f(itemUniforms.contrast, 0.12);
|
||||
var depthRange: [2]f32 = undefined;
|
||||
c.glGetFloatv(c.GL_DEPTH_RANGE, &depthRange);
|
||||
c.glUniform2fv(itemUniforms.glDepthRange, 1, &depthRange);
|
||||
}
|
||||
|
||||
fn bindLightUniform(light: [6]u8, ambientLight: Vec3f) void {
|
||||
|
Loading…
x
Reference in New Issue
Block a user