projects
/
carveJwlIkooP6JGAAIwe30JlM.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
refactor model things
[carveJwlIkooP6JGAAIwe30JlM.git]
/
shaders
/
standard.h
diff --git
a/shaders/standard.h
b/shaders/standard.h
index 59aa1d95b85c6d088d19a51a550241866428436d..cf98fb0765d652ea5be57e6b44efb6bf386fe7ab 100644
(file)
--- a/
shaders/standard.h
+++ b/
shaders/standard.h
@@
-7,35
+7,40
@@
static struct vg_shader _shader_standard = {
.link = shader_standard_link,
.vs =
{
.link = shader_standard_link,
.vs =
{
-.orig_file = "../shaders/standard.vs",
+.orig_file = "../
../
shaders/standard.vs",
.static_src =
"layout (location=0) in vec3 a_co;\n"
"layout (location=1) in vec3 a_norm;\n"
.static_src =
"layout (location=0) in vec3 a_co;\n"
"layout (location=1) in vec3 a_norm;\n"
-"layout (location=2) in vec4 a_colour;\n"
-"layout (location=3) in vec2 a_uv;\n"
+"layout (location=2) in vec2 a_uv;\n"
+"layout (location=3) in vec4 a_colour;\n"
+"layout (location=4) in vec4 a_weights;\n"
+"layout (location=5) in ivec4 a_groups;\n"
"\n"
"#line 2 0 \n"
"\n"
"\n"
"#line 2 0 \n"
"\n"
-"uniform mat4 uPv;\n"
"uniform mat4x3 uMdl;\n"
"uniform mat4x3 uMdl;\n"
+"uniform mat4 uPv;\n"
"\n"
"out vec4 aColour;\n"
"out vec2 aUv;\n"
"out vec3 aNorm;\n"
"out vec3 aCo;\n"
"\n"
"out vec4 aColour;\n"
"out vec2 aUv;\n"
"out vec3 aNorm;\n"
"out vec3 aCo;\n"
+"out vec3 aWorldCo;\n"
"\n"
"void main()\n"
"{\n"
"\n"
"void main()\n"
"{\n"
-" gl_Position = uPv * vec4( uMdl * vec4(a_co,1.0), 1.0 );\n"
+" vec3 world_pos = uMdl * vec4(a_co,1.0);\n"
+" gl_Position = uPv * vec4( world_pos, 1.0 );\n"
" aColour = a_colour;\n"
" aUv = a_uv;\n"
" aNorm = mat3(uMdl) * a_norm;\n"
" aCo = a_co;\n"
" aColour = a_colour;\n"
" aUv = a_uv;\n"
" aNorm = mat3(uMdl) * a_norm;\n"
" aCo = a_co;\n"
+" aWorldCo = world_pos;\n"
"}\n"
""},
.fs =
{
"}\n"
""},
.fs =
{
-.orig_file = "../shaders/standard.fs",
+.orig_file = "../
../
shaders/standard.fs",
.static_src =
"out vec4 FragColor;\n"
"\n"
.static_src =
"out vec4 FragColor;\n"
"\n"
@@
-60,16
+65,16
@@
static struct vg_shader _shader_standard = {
""},
};
""},
};
-static GLuint _uniform_standard_uPv;
static GLuint _uniform_standard_uMdl;
static GLuint _uniform_standard_uMdl;
+static GLuint _uniform_standard_uPv;
static GLuint _uniform_standard_uTexMain;
static GLuint _uniform_standard_uColour;
static GLuint _uniform_standard_uTexMain;
static GLuint _uniform_standard_uColour;
-static void shader_standard_uPv(m4x4f m){
- glUniformMatrix4fv( _uniform_standard_uPv, 1, GL_FALSE, (float *)m );
-}
static void shader_standard_uMdl(m4x3f m){
glUniformMatrix4x3fv( _uniform_standard_uMdl, 1, GL_FALSE, (float *)m );
}
static void shader_standard_uMdl(m4x3f m){
glUniformMatrix4x3fv( _uniform_standard_uMdl, 1, GL_FALSE, (float *)m );
}
+static void shader_standard_uPv(m4x4f m){
+ glUniformMatrix4fv( _uniform_standard_uPv, 1, GL_FALSE, (float *)m );
+}
static void shader_standard_uTexMain(int i){
glUniform1i( _uniform_standard_uTexMain, i );
}
static void shader_standard_uTexMain(int i){
glUniform1i( _uniform_standard_uTexMain, i );
}
@@
-81,8
+86,8
@@
static void shader_standard_register(void){
}
static void shader_standard_use(void){ glUseProgram(_shader_standard.id); }
static void shader_standard_link(void){
}
static void shader_standard_use(void){ glUseProgram(_shader_standard.id); }
static void shader_standard_link(void){
- _uniform_standard_uPv = glGetUniformLocation( _shader_standard.id, "uPv" );
_uniform_standard_uMdl = glGetUniformLocation( _shader_standard.id, "uMdl" );
_uniform_standard_uMdl = glGetUniformLocation( _shader_standard.id, "uMdl" );
+ _uniform_standard_uPv = glGetUniformLocation( _shader_standard.id, "uPv" );
_uniform_standard_uTexMain = glGetUniformLocation( _shader_standard.id, "uTexMain" );
_uniform_standard_uColour = glGetUniformLocation( _shader_standard.id, "uColour" );
}
_uniform_standard_uTexMain = glGetUniformLocation( _shader_standard.id, "uTexMain" );
_uniform_standard_uColour = glGetUniformLocation( _shader_standard.id, "uColour" );
}