mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-15 09:55:53 +08:00
Port of 1a2ba70fcf59ed063668ba91cdd600cf0e729928 to OpenGL ES
This commit is contained in:
parent
5b11cb0de6
commit
30224e8ae5
@ -27,7 +27,7 @@ struct SlopeDetection
|
|||||||
|
|
||||||
uniform mat4 view_model_matrix;
|
uniform mat4 view_model_matrix;
|
||||||
uniform mat4 projection_matrix;
|
uniform mat4 projection_matrix;
|
||||||
uniform mat3 normal_matrix;
|
uniform mat3 view_normal_matrix;
|
||||||
uniform mat4 volume_world_matrix;
|
uniform mat4 volume_world_matrix;
|
||||||
uniform SlopeDetection slope;
|
uniform SlopeDetection slope;
|
||||||
|
|
||||||
@ -51,7 +51,7 @@ varying vec3 eye_normal;
|
|||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
// First transform the normal into camera space and normalize the result.
|
// First transform the normal into camera space and normalize the result.
|
||||||
eye_normal = normalize(normal_matrix * v_normal);
|
eye_normal = normalize(view_normal_matrix * v_normal);
|
||||||
|
|
||||||
// Compute the cos of the angle between the normal and lights direction. The light is directional so the direction is constant for every vertex.
|
// Compute the cos of the angle between the normal and lights direction. The light is directional so the direction is constant for every vertex.
|
||||||
// Since these two are normalized the cosine is the dot product. We also need to clamp the result to the [0,1] range.
|
// Since these two are normalized the cosine is the dot product. We also need to clamp the result to the [0,1] range.
|
||||||
|
@ -16,7 +16,7 @@ const vec3 LIGHT_FRONT_DIR = vec3(0.6985074, 0.1397015, 0.6985074);
|
|||||||
|
|
||||||
uniform mat4 view_model_matrix;
|
uniform mat4 view_model_matrix;
|
||||||
uniform mat4 projection_matrix;
|
uniform mat4 projection_matrix;
|
||||||
uniform mat3 normal_matrix;
|
uniform mat3 view_normal_matrix;
|
||||||
|
|
||||||
attribute vec3 v_position;
|
attribute vec3 v_position;
|
||||||
attribute vec3 v_normal;
|
attribute vec3 v_normal;
|
||||||
@ -27,7 +27,7 @@ varying vec2 intensity;
|
|||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
// First transform the normal into camera space and normalize the result.
|
// First transform the normal into camera space and normalize the result.
|
||||||
vec3 normal = normalize(normal_matrix * v_normal);
|
vec3 normal = normalize(view_normal_matrix * v_normal);
|
||||||
|
|
||||||
// Compute the cos of the angle between the normal and lights direction. The light is directional so the direction is constant for every vertex.
|
// Compute the cos of the angle between the normal and lights direction. The light is directional so the direction is constant for every vertex.
|
||||||
// Since these two are normalized the cosine is the dot product. We also need to clamp the result to the [0,1] range.
|
// Since these two are normalized the cosine is the dot product. We also need to clamp the result to the [0,1] range.
|
||||||
|
@ -16,7 +16,7 @@ const vec3 LIGHT_FRONT_DIR = vec3(0.6985074, 0.1397015, 0.6985074);
|
|||||||
|
|
||||||
uniform mat4 view_model_matrix;
|
uniform mat4 view_model_matrix;
|
||||||
uniform mat4 projection_matrix;
|
uniform mat4 projection_matrix;
|
||||||
uniform mat3 normal_matrix;
|
uniform mat3 view_normal_matrix;
|
||||||
|
|
||||||
// vertex attributes
|
// vertex attributes
|
||||||
attribute vec3 v_position;
|
attribute vec3 v_position;
|
||||||
@ -31,7 +31,7 @@ varying vec2 intensity;
|
|||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
// First transform the normal into camera space and normalize the result.
|
// First transform the normal into camera space and normalize the result.
|
||||||
vec3 eye_normal = normalize(normal_matrix * v_normal);
|
vec3 eye_normal = normalize(view_normal_matrix * v_normal);
|
||||||
|
|
||||||
// Compute the cos of the angle between the normal and lights direction. The light is directional so the direction is constant for every vertex.
|
// Compute the cos of the angle between the normal and lights direction. The light is directional so the direction is constant for every vertex.
|
||||||
// Since these two are normalized the cosine is the dot product. We also need to clamp the result to the [0,1] range.
|
// Since these two are normalized the cosine is the dot product. We also need to clamp the result to the [0,1] range.
|
||||||
|
@ -25,7 +25,7 @@ uniform vec4 uniform_color;
|
|||||||
uniform bool volume_mirrored;
|
uniform bool volume_mirrored;
|
||||||
|
|
||||||
uniform mat4 view_model_matrix;
|
uniform mat4 view_model_matrix;
|
||||||
uniform mat3 normal_matrix;
|
uniform mat3 view_normal_matrix;
|
||||||
|
|
||||||
varying vec3 clipping_planes_dots;
|
varying vec3 clipping_planes_dots;
|
||||||
varying vec4 model_pos;
|
varying vec4 model_pos;
|
||||||
@ -46,7 +46,7 @@ void main()
|
|||||||
triangle_normal = -triangle_normal;
|
triangle_normal = -triangle_normal;
|
||||||
|
|
||||||
// First transform the normal into camera space and normalize the result.
|
// First transform the normal into camera space and normalize the result.
|
||||||
vec3 eye_normal = normalize(normal_matrix * triangle_normal);
|
vec3 eye_normal = normalize(view_normal_matrix * triangle_normal);
|
||||||
|
|
||||||
// Compute the cos of the angle between the normal and lights direction. The light is directional so the direction is constant for every vertex.
|
// Compute the cos of the angle between the normal and lights direction. The light is directional so the direction is constant for every vertex.
|
||||||
// Since these two are normalized the cosine is the dot product. We also need to clamp the result to the [0,1] range.
|
// Since these two are normalized the cosine is the dot product. We also need to clamp the result to the [0,1] range.
|
||||||
|
@ -16,7 +16,7 @@ const vec3 LIGHT_FRONT_DIR = vec3(0.6985074, 0.1397015, 0.6985074);
|
|||||||
|
|
||||||
uniform mat4 view_model_matrix;
|
uniform mat4 view_model_matrix;
|
||||||
uniform mat4 projection_matrix;
|
uniform mat4 projection_matrix;
|
||||||
uniform mat3 normal_matrix;
|
uniform mat3 view_normal_matrix;
|
||||||
|
|
||||||
attribute vec3 v_position;
|
attribute vec3 v_position;
|
||||||
attribute vec3 v_normal;
|
attribute vec3 v_normal;
|
||||||
@ -28,7 +28,7 @@ varying vec3 world_position;
|
|||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
// First transform the normal into camera space and normalize the result.
|
// First transform the normal into camera space and normalize the result.
|
||||||
vec3 normal = normalize(normal_matrix * v_normal);
|
vec3 normal = normalize(view_normal_matrix * v_normal);
|
||||||
|
|
||||||
// Compute the cos of the angle between the normal and lights direction. The light is directional so the direction is constant for every vertex.
|
// Compute the cos of the angle between the normal and lights direction. The light is directional so the direction is constant for every vertex.
|
||||||
// Since these two are normalized the cosine is the dot product. We also need to clamp the result to the [0,1] range.
|
// Since these two are normalized the cosine is the dot product. We also need to clamp the result to the [0,1] range.
|
||||||
|
@ -16,7 +16,7 @@ const vec3 LIGHT_FRONT_DIR = vec3(0.6985074, 0.1397015, 0.6985074);
|
|||||||
|
|
||||||
uniform mat4 view_model_matrix;
|
uniform mat4 view_model_matrix;
|
||||||
uniform mat4 projection_matrix;
|
uniform mat4 projection_matrix;
|
||||||
uniform mat3 normal_matrix;
|
uniform mat3 view_normal_matrix;
|
||||||
uniform mat4 volume_world_matrix;
|
uniform mat4 volume_world_matrix;
|
||||||
uniform float object_max_z;
|
uniform float object_max_z;
|
||||||
|
|
||||||
@ -38,7 +38,7 @@ void main()
|
|||||||
// =====================================================
|
// =====================================================
|
||||||
|
|
||||||
// First transform the normal into camera space and normalize the result.
|
// First transform the normal into camera space and normalize the result.
|
||||||
vec3 normal = (object_max_z > 0.0) ? vec3(0.0, 0.0, 1.0) : normalize(normal_matrix * v_normal);
|
vec3 normal = (object_max_z > 0.0) ? vec3(0.0, 0.0, 1.0) : normalize(view_normal_matrix * v_normal);
|
||||||
|
|
||||||
// Compute the cos of the angle between the normal and lights direction. The light is directional so the direction is constant for every vertex.
|
// Compute the cos of the angle between the normal and lights direction. The light is directional so the direction is constant for every vertex.
|
||||||
// Since these two are normalized the cosine is the dot product. We also need to clamp the result to the [0,1] range.
|
// Since these two are normalized the cosine is the dot product. We also need to clamp the result to the [0,1] range.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user