projects
/
demo
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
buffer allocation
[demo]
/
gl_shaders
/
default.v.glsl
diff --git
a/gl_shaders/default.v.glsl
b/gl_shaders/default.v.glsl
index
59db728
..
76aae8a
100644
(file)
--- a/
gl_shaders/default.v.glsl
+++ b/
gl_shaders/default.v.glsl
@@
-2,29
+2,32
@@
//#extension GL_ARB_separate_shader_objects : enable
uniform mat4 mview;
//#extension GL_ARB_separate_shader_objects : enable
uniform mat4 mview;
-uniform mat4 mproj;
+uniform mat4 mmviewproj;
+uniform mat4 mmod;
varying vec3 pos;
varying vec3 pos;
-varying vec3 normal;
-varying vec3 ldir;
-varying vec3 tex_coord;
+// varying vec3 normal;
+// varying vec3 ldir;
+varying vec2 tex_coord;
+varying vec3 world_normal;
-const vec3 lpos = vec3(0.0, 100.0, 0.0);
+const vec3 lpos = vec3(-10.0, 100.0, 10.0);
/* attributes */
layout(location = 1) in vec3 attr_pos;
layout(location = 2) in vec3 attr_normal;
/* attributes */
layout(location = 1) in vec3 attr_pos;
layout(location = 2) in vec3 attr_normal;
-layout(location = 3) in vec3 attr_tex;
+layout(location = 3) in vec2 attr_tex;
void main()
{
void main()
{
- mat4 modelview_projection_matrix = mproj * mview;
- gl_Position = modelview_projection_matrix * vec4(attr_pos, 1.0);
+ gl_Position = mmviewproj * vec4(attr_pos, 1.0);
pos = (mview * vec4(attr_pos, 1.0)).xyz;
pos = (mview * vec4(attr_pos, 1.0)).xyz;
- ldir = (mview * vec4(lpos, 1.0)).xyz;
+ // ldir = (mview * vec4(lpos, 1.0)).xyz;
- mat3 normal_matrix = mat3(mview);
- normal = normal_matrix * attr_normal;
+ // mat3 normal_matrix = mat3(mview);
+ // normal = normal_matrix * attr_normal;
tex_coord = attr_tex;
tex_coord = attr_tex;
-}
+
+ world_normal = (mmod * vec4(attr_normal, 1.0)).xyz;
+}
\ No newline at end of file