mirror of https://github.com/bjornbytes/lovr.git
Fix view vector;
This commit is contained in:
parent
2c115ce66e
commit
30ea8995d2
|
@ -119,7 +119,8 @@ const char* lovrUnlitFragmentShader = ""
|
|||
"}";
|
||||
|
||||
const char* lovrStandardVertexShader = ""
|
||||
"out vec3 vViewPosition; \n"
|
||||
"out vec3 vWorldPosition; \n"
|
||||
"out vec3 vCameraPosition; \n"
|
||||
"#ifdef FLAG_normalTexture \n"
|
||||
"out mat3 vTangentMatrix; \n"
|
||||
"#else \n"
|
||||
|
@ -127,7 +128,8 @@ const char* lovrStandardVertexShader = ""
|
|||
"#endif \n"
|
||||
|
||||
"vec4 position(mat4 projection, mat4 transform, vec4 vertex) { \n"
|
||||
" vViewPosition = vec3(transform * vertex); \n"
|
||||
" vWorldPosition = vec3(lovrModel * vertex); \n"
|
||||
" vCameraPosition = -lovrView[3].xyz * mat3(lovrView); \n"
|
||||
"#ifdef FLAG_normalTexture \n"
|
||||
" vec3 normal = normalize(mat3(lovrModel) * lovrNormal); // TODO non-uniform scale \n"
|
||||
" vec3 tangent = normalize(mat3(lovrModel) * lovrTangent.xyz); \n"
|
||||
|
@ -141,7 +143,8 @@ const char* lovrStandardVertexShader = ""
|
|||
|
||||
const char* lovrStandardFragmentShader = ""
|
||||
"#define PI 3.14159265358979 \n"
|
||||
"in vec3 vViewPosition; \n"
|
||||
"in vec3 vWorldPosition; \n"
|
||||
"in vec3 vCameraPosition; \n"
|
||||
"#ifdef FLAG_normalTexture \n"
|
||||
"in mat3 vTangentMatrix; \n"
|
||||
"#else \n"
|
||||
|
@ -219,7 +222,7 @@ const char* lovrStandardFragmentShader = ""
|
|||
"#else \n"
|
||||
" vec3 N = normalize(vNormal); \n"
|
||||
"#endif \n"
|
||||
" vec3 V = normalize(-vViewPosition); \n"
|
||||
" vec3 V = normalize(vCameraPosition - vWorldPosition); \n"
|
||||
" vec3 L = normalize(-lovrLightDirection); \n"
|
||||
" vec3 H = normalize(V + L); \n"
|
||||
" vec3 R = normalize(reflect(-V, N)); \n"
|
||||
|
|
Loading…
Reference in New Issue