mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-17 10:32:20 +00:00
FIX: enable wireframe in paint tool
Jira: STUDIO-3996 The buffer data submitted when the wireframe function is closed is half less than the buffer data submitted when the wireframe function is open Change-Id: I92542190a5a45f562ec89d7c41fef3cdf1c26418 (cherry picked from commit b95650954f8bdb0cf81a2063efba4b2fced13a2f)
This commit is contained in:
@@ -19,12 +19,13 @@ const float EPSILON = 0.0001;
|
||||
//BBS: add grey and orange
|
||||
//const vec3 GREY = vec3(0.9, 0.9, 0.9);
|
||||
const vec3 ORANGE = vec3(0.8, 0.4, 0.0);
|
||||
|
||||
const vec3 LightRed = vec3(0.78, 0.0, 0.0);
|
||||
const vec3 LightBlue = vec3(0.73, 1.0, 1.0);
|
||||
uniform vec4 uniform_color;
|
||||
|
||||
varying vec3 clipping_planes_dots;
|
||||
varying vec4 model_pos;
|
||||
|
||||
varying vec4 world_pos;
|
||||
uniform bool volume_mirrored;
|
||||
|
||||
struct SlopeDetection
|
||||
@@ -65,19 +66,24 @@ void main()
|
||||
float alpha = uniform_color.a;
|
||||
|
||||
vec3 triangle_normal = normalize(cross(dFdx(model_pos.xyz), dFdy(model_pos.xyz)));
|
||||
#ifdef FLIP_TRIANGLE_NORMALS
|
||||
triangle_normal = -triangle_normal;
|
||||
#endif
|
||||
|
||||
vec3 transformed_normal = normalize(slope.volume_world_normal_matrix * triangle_normal);
|
||||
if (slope.actived && transformed_normal.z < slope.normal_z - EPSILON) {
|
||||
//color = vec3(0.7, 0.7, 1.0);
|
||||
color = color * 0.5 + ORANGE * 0.5;
|
||||
alpha = 1.0;
|
||||
}
|
||||
|
||||
if (volume_mirrored)
|
||||
{
|
||||
triangle_normal = -triangle_normal;
|
||||
}
|
||||
vec3 transformed_normal = normalize(slope.volume_world_normal_matrix * triangle_normal);
|
||||
|
||||
if (slope.actived) {
|
||||
if(world_pos.z<0.1&&world_pos.z>-0.1)
|
||||
{
|
||||
color = LightBlue;
|
||||
alpha = 1.0;
|
||||
}
|
||||
else if( transformed_normal.z < slope.normal_z - EPSILON)
|
||||
{
|
||||
color = color * 0.7 + LightRed * 0.3;
|
||||
alpha = 1.0;
|
||||
}
|
||||
}
|
||||
|
||||
// First transform the normal into camera space and normalize the result.
|
||||
vec3 eye_normal = normalize(gl_NormalMatrix * triangle_normal);
|
||||
|
||||
@@ -13,7 +13,7 @@ uniform vec4 clipping_plane;
|
||||
|
||||
varying vec3 clipping_planes_dots;
|
||||
varying vec4 model_pos;
|
||||
|
||||
varying vec4 world_pos;
|
||||
varying vec3 barycentric_coordinates;
|
||||
|
||||
struct SlopeDetection
|
||||
@@ -29,13 +29,13 @@ void main()
|
||||
model_pos = vec4(v_position, 1.0);
|
||||
// Point in homogenous coordinates.
|
||||
//vec4 world_pos = volume_world_matrix * gl_Vertex;
|
||||
vec4 world_pos = volume_world_matrix * model_pos;
|
||||
world_pos = volume_world_matrix * model_pos;
|
||||
|
||||
//gl_Position = ftransform();
|
||||
gl_Position = gl_ModelViewProjectionMatrix * vec4(v_position.x, v_position.y, v_position.z, 1.0);
|
||||
// Fill in the scalars for fragment shader clipping. Fragments with any of these components lower than zero are discarded.
|
||||
clipping_planes_dots = vec3(dot(world_pos, clipping_plane), world_pos.z - z_range.x, z_range.y - world_pos.z);
|
||||
|
||||
|
||||
//compute the Barycentric Coordinates
|
||||
//int vertexMod3 = gl_VertexID % 3;
|
||||
//barycentric_coordinates = vec3(float(vertexMod3 == 0), float(vertexMod3 == 1), float(vertexMod3 == 2));
|
||||
|
||||
Reference in New Issue
Block a user