mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-10-09 16:51:12 +00:00
Code review items (raistlin7447): 1. PrintObject::slice() zeroes m_belt_min_z, m_belt_global_z_offset and m_belt_global_xy_correction before slicing. They were only written in belt mode, so a project switched to a normal printer, or whose tilt axis was set to None, kept the old offsets and shifted the adaptive infill octree and the organic support layers by them. 2. TreeModelVolumes shifts the support blockers into the raft-offset index space; a test now pins the index the blocker lands on. 3. The final-alignment clamp in libnest2d is opt-in (NfpPConfig::clamp_to_bin) and arrange sets it for belt printers only. Printers with an off-centre best_object_pos keep their alignment; a flat-bed test pins that. 4. The preview's belt view follows the loaded G-code, not the selected printer: GCodeProcessor carries the file's belt keys (and, for a belt file, its bed) into export_config_for_render(), and GCodeViewer enables the belt view from the header tilt. 5. belt_shift_layer_grid() also shifts the cached belt floor and the global Z offset, so a support-only or brim-only change after the purge-prism snap matches a fresh slice. 6. update_print_fff_config() resets raft_layers and draft_shield on a belt printer instead of only greying out the fields Print::validate() rejects. 7. GCodeWriter takes a first-layer point test instead of the FirstLayerPlane; GCode installs one that measures from the belt surface, like its extrusions, so the first-layer travel speed and the second-layer temperature change no longer depend on the gcode_remap_* convention. 8. belt_brim_clip_leading_edge() is exported and called by both the generator and the test. 9. Both phong.vs shaders use slope.up_direction for the overhang highlight. The pre-slice and G-code axis remaps are gated on belt_printer through BeltTransformPipeline::axis_remap_enabled(), so belt keys left in a profile cannot change a non-belt print. Tests requested in the review: belt-only keys at non-default values leave non-belt G-code unchanged; switching a sliced project from belt to non-belt (and tilt axis None) matches a fresh slice; a support-only change on a belt purge print matches a fresh slice; non-belt start G-code moves keep the first-layer Z in the processor; the belt brim's segment count catches a band emitted twice. The belt-to-non-belt test exposed an unrelated gap: invalidate_step(posSlice) re-invalidated posSupportMaterial but not posSimplifySupportPath, so after any re-slice the regenerated support paths were exported unsimplified. posSimplifySupportPath is now in that list. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
67 lines
2.1 KiB
GLSL
67 lines
2.1 KiB
GLSL
#version 110
|
|
|
|
const vec3 ZERO = vec3(0.0, 0.0, 0.0);
|
|
|
|
struct SlopeDetection
|
|
{
|
|
bool actived;
|
|
float normal_z;
|
|
mat3 volume_world_normal_matrix;
|
|
vec3 up_direction;
|
|
};
|
|
|
|
uniform mat4 view_model_matrix;
|
|
uniform mat4 projection_matrix;
|
|
uniform mat3 view_normal_matrix;
|
|
uniform mat4 volume_world_matrix;
|
|
uniform SlopeDetection slope;
|
|
uniform bool is_outline;
|
|
uniform vec2 screen_size;
|
|
|
|
// Clipping plane, x = min z, y = max z. Used by the FFF and SLA previews to clip with a top / bottom plane.
|
|
uniform vec2 z_range;
|
|
// Clipping plane - general orientation. Used by the SLA gizmo.
|
|
uniform vec4 clipping_plane;
|
|
// Color clip plane - general orientation. Used by the cut gizmo.
|
|
uniform vec4 color_clip_plane;
|
|
|
|
attribute vec3 v_position;
|
|
attribute vec3 v_normal;
|
|
|
|
varying vec3 clipping_planes_dots;
|
|
varying float color_clip_plane_dot;
|
|
|
|
varying vec4 world_pos;
|
|
varying float world_normal_z;
|
|
varying vec3 eye_normal;
|
|
varying vec3 eye_position;
|
|
|
|
void main()
|
|
{
|
|
// First transform the normal into camera space and normalize the result.
|
|
eye_normal = normalize(view_normal_matrix * v_normal);
|
|
|
|
vec4 position = view_model_matrix * vec4(v_position, 1.0);
|
|
eye_position = position.xyz;
|
|
|
|
// Point in homogenous coordinates.
|
|
world_pos = volume_world_matrix * vec4(v_position, 1.0);
|
|
|
|
// dot product of world normal with up direction, used for slope shading
|
|
world_normal_z = slope.actived ? dot(normalize(slope.volume_world_normal_matrix * v_normal), slope.up_direction) : 0.0;
|
|
|
|
gl_Position = projection_matrix * position;
|
|
if (is_outline) {
|
|
vec3 n = normalize((view_normal_matrix * v_normal).xyz);
|
|
vec2 dir = normalize(n.xy);
|
|
if (dot(dir, dir) > 0.0) {
|
|
//set outline thickness
|
|
float px = 3.0;
|
|
gl_Position.xy += dir * (px * 2.0 / screen_size) * gl_Position.w;
|
|
}
|
|
}
|
|
// 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);
|
|
color_clip_plane_dot = dot(world_pos, color_clip_plane);
|
|
}
|