diff options
| author | tech kaczynski <tk@techkaczynski.dev> | 2026-11-04 05:56:35 +1000 |
|---|---|---|
| committer | tech kaczynski <tk@techkaczynski.dev> | 2026-11-04 05:56:35 +1000 |
| commit | ea84213ece95e3ef8ff7f0095cee73ee6bdd0f9a (patch) | |
| tree | 32a502e72438ba0c6b6fa00dbd9dbdf3603fe7e3 /res/sdr/mdl_skinned_vtx_lit.vs | |
| parent | e5560f69e11051a85c1d54780a59a4fbd83d8ed9 (diff) | |
added convex hull and trimesh colliders. Fixed physics edit mode bugs. Added debug drawing for all supported collision types.
Diffstat (limited to 'res/sdr/mdl_skinned_vtx_lit.vs')
| -rw-r--r-- | res/sdr/mdl_skinned_vtx_lit.vs | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/res/sdr/mdl_skinned_vtx_lit.vs b/res/sdr/mdl_skinned_vtx_lit.vs new file mode 100644 index 0000000..a6da15e --- /dev/null +++ b/res/sdr/mdl_skinned_vtx_lit.vs @@ -0,0 +1,59 @@ +#version 330 + +in vec3 vertexPosition; +in vec2 vertexTexCoord; +in vec3 vertexNormal; +in vec4 vertexColor; + +uniform mat4 mvp; +uniform mat4 matNormal; + +uniform vec3 sun_direction; +uniform vec3 sun_colour; +uniform float sun_intensity; + +uniform vec3 moon_direction; +uniform vec3 moon_colour; +uniform float moon_intensity; + +uniform vec3 ambient_colour; +uniform float ambient_intensity; + +uniform vec2 uv_tiling; +uniform vec2 uv_offset; + +out vec2 frag_texcoord; +out vec4 frag_colour; +out vec3 frag_lighting; +out vec3 frag_normal; + +in vec4 vertexBoneIndices; +in vec4 vertexBoneWeights; + +uniform mat4 boneMatrices[64]; + +void main() { + mat4 skin = + vertexBoneWeights.x * boneMatrices[int(vertexBoneIndices.x)] + + vertexBoneWeights.y * boneMatrices[int(vertexBoneIndices.y)] + + vertexBoneWeights.z * boneMatrices[int(vertexBoneIndices.z)] + + vertexBoneWeights.w * boneMatrices[int(vertexBoneIndices.w)]; + + vec4 position = skin * vec4(vertexPosition, 1.0); + vec3 normal = (skin * vec4(vertexNormal, 0.0)).xyz; + vec3 world_normal = normalize((matNormal * vec4(normal, 0.0)).xyz); + + float sun_diffuse = max(dot(world_normal, sun_direction), 0.0); + float moon_diffuse = max(dot(world_normal, moon_direction), 0.0); + + vec3 ambient_light = ambient_colour * ambient_intensity; + vec3 sun_light = sun_colour * sun_intensity * sun_diffuse; + vec3 moon_light = moon_colour * moon_intensity * moon_diffuse; + + frag_lighting = ambient_light + sun_light + moon_light; + frag_texcoord = vertexTexCoord * uv_tiling + uv_offset; + frag_colour = vertexColor; + frag_normal = world_normal; + + gl_Position = mvp * position; +} |
