Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update shaders_basic_pbr example to work on web #4516

Merged
merged 10 commits into from
Nov 20, 2024
16 changes: 8 additions & 8 deletions examples/shaders/resources/shaders/glsl100/pbr.fs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#version 100

precision mediump float;
precision highp float;

#define MAX_LIGHTS 4
#define LIGHT_DIRECTIONAL 0
Expand All @@ -17,12 +17,12 @@ struct Light {
};

// Input vertex attributes (from vertex shader)
varying in vec3 fragPosition;
varying in vec2 fragTexCoord;
varying in vec4 fragColor;
varying in vec3 fragNormal;
varying in vec4 shadowPos;
varying in mat3 TBN;
varying vec3 fragPosition;
varying vec2 fragTexCoord;
varying vec4 fragColor;
varying vec3 fragNormal;
varying vec4 shadowPos;
varying mat3 TBN;


// Input uniform values
Expand Down Expand Up @@ -113,7 +113,7 @@ vec3 pbr(){
vec3 baseRefl = mix(vec3(0.04),albedo.rgb,metallic);
vec3 Lo = vec3(0.0); // acumulate lighting lum

for(int i=0;i<numOfLights;++i){
for(int i=0;i<4;++i){

vec3 L = normalize(lights[i].position - fragPosition); // calc light vector
vec3 H = normalize(V + L); // calc halfway bisecting vector
Expand Down
2 changes: 1 addition & 1 deletion examples/shaders/shaders_basic_pbr.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#if defined(PLATFORM_DESKTOP)
#define GLSL_VERSION 330
#else // PLATFORM_ANDROID, PLATFORM_WEB
#define GLSL_VERSION 120
#define GLSL_VERSION 100
#endif

#include <stdlib.h> // Required for: NULL
Expand Down
Loading