Fry3DX/engine/shaders/skinned.vert
Nexoniarz f3e8eca87b Fry3DX 0.4: an easy 3D modeller
Shapes with live settings, shape editing, knife and hole tools, drawing
shapes onto other objects, combining objects (add / subtract / overlap),
copies, thickness, painting with stickers and layers, a Layout tab, a
Print tab with checks, packed .fry files with autosave, export to GLB,
glTF, FBX, OBJ, 3MF, STL and PLY, folders in Layers, its own crash
screen, and a website for GitHub Pages in docs/.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NMSrd5oe1GpUD7E6d825KP
2026-10-19 21:18:35 +02:00

21 lines
701 B
GLSL

#version 460
#include "model.glsl"
layout(location = 0) out vec3 v_normal;
layout(location = 1) out vec2 v_uv;
layout(location = 2) out vec2 v_lightmapUv;
layout(location = 3) out vec3 v_world;
void main() {
Vertex vx = VERTEX(VERTEX_ID);
uvec2 sk = SKIN(VERTEX_ID);
vec4 w = unpackUnorm4x8(sk.y);
mat4 m = JOINT(sk.x & 0xFFu) * w.x + JOINT((sk.x >> 8) & 0xFFu) * w.y
+ JOINT((sk.x >> 16) & 0xFFu) * w.z + JOINT(sk.x >> 24) * w.w;
vec4 world = m * vec4(vx.px, vx.py, vx.pz, 1.0);
v_normal = normalize(mat3(m) * vec3(vx.nx, vx.ny, vx.nz));
v_uv = vec2(vx.u, vx.v);
v_lightmapUv = vec2(0.0);
v_world = world.xyz;
gl_Position = pc.viewProj * world;
}