OpenMotionLab/MotionGPT
118
1#version 330 core2 3// Vertex Attributes4layout(location = 0) in vec3 position;5#ifdef NORMAL_LOC6layout(location = NORMAL_LOC) in vec3 normal;7#endif8#ifdef TANGENT_LOC9layout(location = TANGENT_LOC) in vec4 tangent;10#endif11#ifdef TEXCOORD_0_LOC12layout(location = TEXCOORD_0_LOC) in vec2 texcoord_0;13#endif14#ifdef TEXCOORD_1_LOC15layout(location = TEXCOORD_1_LOC) in vec2 texcoord_1;16#endif17#ifdef COLOR_0_LOC18layout(location = COLOR_0_LOC) in vec4 color_0;19#endif20#ifdef JOINTS_0_LOC21layout(location = JOINTS_0_LOC) in vec4 joints_0;22#endif23#ifdef WEIGHTS_0_LOC24layout(location = WEIGHTS_0_LOC) in vec4 weights_0;25#endif26layout(location = INST_M_LOC) in mat4 inst_m;27 28// Uniforms29uniform mat4 M;30uniform mat4 V;31uniform mat4 P;32 33// Outputs34out vec3 frag_position;35#ifdef NORMAL_LOC36out vec3 frag_normal;37#endif38#ifdef HAS_NORMAL_TEX39#ifdef TANGENT_LOC40#ifdef NORMAL_LOC41out mat3 tbn;42#endif43#endif44#endif45#ifdef TEXCOORD_0_LOC46out vec2 uv_0;47#endif48#ifdef TEXCOORD_1_LOC49out vec2 uv_1;50#endif51#ifdef COLOR_0_LOC52out vec4 color_multiplier;53#endif54 55 56void main()57{58 gl_Position = P * V * M * inst_m * vec4(position, 1);59 frag_position = vec3(M * inst_m * vec4(position, 1.0));60 61 mat4 N = transpose(inverse(M * inst_m));62 63#ifdef NORMAL_LOC64 frag_normal = normalize(vec3(N * vec4(normal, 0.0)));65#endif66 67#ifdef HAS_NORMAL_TEX68#ifdef TANGENT_LOC69#ifdef NORMAL_LOC70 vec3 normal_w = normalize(vec3(N * vec4(normal, 0.0)));71 vec3 tangent_w = normalize(vec3(N * vec4(tangent.xyz, 0.0)));72 vec3 bitangent_w = cross(normal_w, tangent_w) * tangent.w;73 tbn = mat3(tangent_w, bitangent_w, normal_w);74#endif75#endif76#endif77#ifdef TEXCOORD_0_LOC78 uv_0 = texcoord_0;79#endif80#ifdef TEXCOORD_1_LOC81 uv_1 = texcoord_1;82#endif83#ifdef COLOR_0_LOC84 color_multiplier = color_0;85#endif86}87 