ソースを参照

Update shader_basic_pbr example to work on web

changed to GLSL_VERSION            100
update glsl100 shader
set float  precision  to highp
removed keyword  in
change for loop tu use constant value  gives an error
pull/4516/head
devdad 1年前
コミット
33d14c3832
2個のファイルの変更9行の追加9行の削除
  1. +8
    -8
      examples/shaders/resources/shaders/glsl100/pbr.fs
  2. +1
    -1
      examples/shaders/shaders_basic_pbr.c

+ 8
- 8
examples/shaders/resources/shaders/glsl100/pbr.fs ファイルの表示

@ -1,6 +1,6 @@
#version 100 #version 100
precision mediump float;
precision highp float;
#define MAX_LIGHTS 4 #define MAX_LIGHTS 4
#define LIGHT_DIRECTIONAL 0 #define LIGHT_DIRECTIONAL 0
@ -17,12 +17,12 @@ struct Light {
}; };
// Input vertex attributes (from vertex shader) // 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 // Input uniform values
@ -113,7 +113,7 @@ vec3 pbr(){
vec3 baseRefl = mix(vec3(0.04),albedo.rgb,metallic); vec3 baseRefl = mix(vec3(0.04),albedo.rgb,metallic);
vec3 Lo = vec3(0.0); // acumulate lighting lum vec3 Lo = vec3(0.0); // acumulate lighting lum
for(int i=0;i<err">numOfLights;++i){
for(int i=0;i<mi">4;++i){
vec3 L = normalize(lights[i].position - fragPosition); // calc light vector vec3 L = normalize(lights[i].position - fragPosition); // calc light vector
vec3 H = normalize(V + L); // calc halfway bisecting vector vec3 H = normalize(V + L); // calc halfway bisecting vector

+ 1
- 1
examples/shaders/shaders_basic_pbr.c ファイルの表示

@ -22,7 +22,7 @@
#if defined(PLATFORM_DESKTOP) #if defined(PLATFORM_DESKTOP)
#define GLSL_VERSION 330 #define GLSL_VERSION 330
#else // PLATFORM_ANDROID, PLATFORM_WEB #else // PLATFORM_ANDROID, PLATFORM_WEB
#define GLSL_VERSION 120
#define GLSL_VERSION 100
#endif #endif
#include <stdlib.h> // Required for: NULL #include <stdlib.h> // Required for: NULL

読み込み中…
キャンセル
保存