mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-08-06 21:44:08 -06:00
GCodeViewer -> Pass vertex normal to shaders for toolpaths
This commit is contained in:
parent
d41781f674
commit
69de5c8c9f
13 changed files with 431 additions and 265 deletions
21
resources/shaders/toolpaths.vs
Normal file
21
resources/shaders/toolpaths.vs
Normal file
|
@ -0,0 +1,21 @@
|
|||
#version 110
|
||||
|
||||
varying vec3 eye_position;
|
||||
varying vec3 eye_normal;
|
||||
|
||||
vec3 world_normal()
|
||||
{
|
||||
// the world normal is always parallel to the world XY plane
|
||||
// the x component is stored into gl_Vertex.w
|
||||
float x = gl_Vertex.w;
|
||||
float y = sqrt(1.0 - x * x);
|
||||
return vec3(x, y, 0.0);
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 world_position = vec4(gl_Vertex.xyz, 1.0);
|
||||
gl_Position = gl_ModelViewProjectionMatrix * world_position;
|
||||
eye_position = (gl_ModelViewMatrix * world_position).xyz;
|
||||
eye_normal = gl_NormalMatrix * world_normal();
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue