mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-24 07:03:56 -06:00
WIP OpenGL 4.1 core profile. CURA-3273
This commit is contained in:
parent
aa923321f8
commit
e31a695061
4 changed files with 219 additions and 0 deletions
|
@ -48,6 +48,59 @@ fragment =
|
|||
gl_FragColor.a = u_opacity;
|
||||
}
|
||||
|
||||
vertex41core =
|
||||
#version 410
|
||||
uniform highp mat4 u_modelMatrix;
|
||||
uniform highp mat4 u_viewProjectionMatrix;
|
||||
uniform highp mat4 u_normalMatrix;
|
||||
|
||||
in highp vec4 a_vertex;
|
||||
in highp vec4 a_normal;
|
||||
in highp vec2 a_uvs;
|
||||
|
||||
out highp vec3 v_vertex;
|
||||
out highp vec3 v_normal;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 world_space_vert = u_modelMatrix * a_vertex;
|
||||
gl_Position = u_viewProjectionMatrix * world_space_vert;
|
||||
|
||||
v_vertex = world_space_vert.xyz;
|
||||
v_normal = (u_normalMatrix * normalize(a_normal)).xyz;
|
||||
}
|
||||
|
||||
fragment41core =
|
||||
#version 410
|
||||
uniform mediump vec4 u_ambientColor;
|
||||
uniform mediump vec4 u_diffuseColor;
|
||||
uniform highp vec3 u_lightPosition;
|
||||
|
||||
uniform mediump float u_opacity;
|
||||
|
||||
in highp vec3 v_vertex;
|
||||
in highp vec3 v_normal;
|
||||
|
||||
out vec4 frag_color;
|
||||
|
||||
void main()
|
||||
{
|
||||
mediump vec4 finalColor = vec4(0.0);
|
||||
|
||||
/* Ambient Component */
|
||||
finalColor += u_ambientColor;
|
||||
|
||||
highp vec3 normal = normalize(v_normal);
|
||||
highp vec3 lightDir = normalize(u_lightPosition - v_vertex);
|
||||
|
||||
/* Diffuse Component */
|
||||
highp float NdotL = clamp(abs(dot(normal, lightDir)), 0.0, 1.0);
|
||||
finalColor += (NdotL * u_diffuseColor);
|
||||
|
||||
frag_color = finalColor;
|
||||
frag_color.a = u_opacity;
|
||||
}
|
||||
|
||||
[defaults]
|
||||
u_ambientColor = [0.1, 0.1, 0.1, 1.0]
|
||||
u_diffuseColor = [0.4, 0.4, 0.4, 1.0]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue