Skip to content

Commit

Permalink
Use texture instead of texture2D for MacOS.
Browse files Browse the repository at this point in the history
  • Loading branch information
fnuecke committed Feb 13, 2022
1 parent f0a06c8 commit 5d0bd81
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/main/resources/assets/oc2/shaders/core/projectors.fsh
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,11 @@ bool getProjectorColor(vec3 worldPos, vec3 worldNormal,

vec4 projectorUvPrediv = CLIP_TO_TEX * projectorClipPosPrediv;
vec2 projectorUv = projectorUvPrediv.xy / projectorUvPrediv.w;
float projectorDepth = texture2D(projectorDepthSampler, projectorUv).r;
float projectorDepth = texture(projectorDepthSampler, projectorUv).r;
float projectorClipDepth = projectorDepth * 2 - 1;

if (projectorClipPos.z <= projectorClipDepth + DEPTH_BIAS) {
vec3 projectorColor = texture2D(projectorColorSampler, vec2(projectorUv.s, 1 - projectorUv.t)).rgb;
vec3 projectorColor = texture(projectorColorSampler, vec2(projectorUv.s, 1 - projectorUv.t)).rgb;
float dotAttenuation = clamp((d - DOT_EPSILON) / (1 - DOT_EPSILON), 0, 1);
float distanceAttenuation = clamp(1 - (linearDepth - START_FADE_DISTANCE) / (MAX_DISTANCE - START_FADE_DISTANCE), 0, 1);
result = projectorColor * dotAttenuation * distanceAttenuation;
Expand All @@ -98,7 +98,7 @@ bool getProjectorColor(vec3 worldPos, vec3 worldNormal,
}

void main() {
float depth = texture2D(MainCameraDepth, texCoord).r;
float depth = texture(MainCameraDepth, texCoord).r;

// Check for no hit, for early exit.
if (depth >= 1) {
Expand Down

0 comments on commit 5d0bd81

Please sign in to comment.