Merge branch 'master' of https://github.com/prusa3d/Slic3r
This commit is contained in:
commit
3a412a3a82
10 changed files with 127 additions and 72 deletions
|
@ -49,6 +49,10 @@ foreach (_cache_var ${_cache_vars})
|
|||
endif ()
|
||||
endforeach()
|
||||
|
||||
if (SLIC3R_GUI)
|
||||
add_definitions(-DSLIC3R_GUI)
|
||||
endif ()
|
||||
|
||||
if (MSVC)
|
||||
if (SLIC3R_MSVC_COMPILE_PARALLEL)
|
||||
add_compile_options(/MP)
|
||||
|
|
|
@ -2,30 +2,21 @@
|
|||
|
||||
const vec3 ZERO = vec3(0.0, 0.0, 0.0);
|
||||
|
||||
varying vec3 clipping_planes_dots;
|
||||
|
||||
// x = tainted, y = specular;
|
||||
varying vec2 intensity;
|
||||
|
||||
varying vec3 delta_box_min;
|
||||
varying vec3 delta_box_max;
|
||||
|
||||
varying vec3 world_pos;
|
||||
|
||||
uniform vec4 uniform_color;
|
||||
|
||||
// x = min z, y = max z;
|
||||
uniform vec2 z_range;
|
||||
|
||||
// clipping plane (general orientation):
|
||||
uniform vec4 clipping_plane;
|
||||
|
||||
void main()
|
||||
{
|
||||
if ((world_pos.z < z_range.x) || (z_range.y < world_pos.z))
|
||||
if (any(lessThan(clipping_planes_dots, ZERO)))
|
||||
discard;
|
||||
|
||||
if (world_pos.x*clipping_plane.x + world_pos.y*clipping_plane.y + world_pos.z*clipping_plane.z + clipping_plane.w < 0.0 )
|
||||
discard;
|
||||
|
||||
// if the fragment is outside the print volume -> use darker color
|
||||
vec3 color = (any(lessThan(delta_box_min, ZERO)) || any(greaterThan(delta_box_max, ZERO))) ? mix(uniform_color.rgb, ZERO, 0.3333) : uniform_color.rgb;
|
||||
gl_FragColor = vec4(vec3(intensity.y, intensity.y, intensity.y) + color * intensity.x, uniform_color.a);
|
||||
|
|
|
@ -28,13 +28,18 @@ struct PrintBoxDetection
|
|||
|
||||
uniform PrintBoxDetection print_box;
|
||||
|
||||
// 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;
|
||||
|
||||
// x = tainted, y = specular;
|
||||
varying vec2 intensity;
|
||||
|
||||
varying vec3 delta_box_min;
|
||||
varying vec3 delta_box_max;
|
||||
|
||||
varying vec3 world_pos;
|
||||
varying vec3 clipping_planes_dots;
|
||||
|
||||
void main()
|
||||
{
|
||||
|
@ -66,8 +71,11 @@ void main()
|
|||
{
|
||||
delta_box_min = ZERO;
|
||||
delta_box_max = ZERO;
|
||||
}
|
||||
}
|
||||
|
||||
gl_Position = ftransform();
|
||||
world_pos = vec3(print_box.volume_world_matrix * gl_Vertex);
|
||||
}
|
||||
// Point in homogenous coordinates.
|
||||
vec4 world_pos = print_box.volume_world_matrix * gl_Vertex;
|
||||
// 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);
|
||||
}
|
||||
|
|
|
@ -3117,6 +3117,13 @@ CLIMiscConfigDef::CLIMiscConfigDef()
|
|||
def->label = L("Logging level");
|
||||
def->tooltip = L("Messages with severity lower or eqal to the loglevel will be printed out. 0:trace, 1:debug, 2:info, 3:warning, 4:error, 5:fatal");
|
||||
def->min = 0;
|
||||
|
||||
#ifdef _MSC_VER
|
||||
def = this->add("sw_renderer", coBool);
|
||||
def->label = L("Render with a software renderer");
|
||||
def->tooltip = L("Render with a software renderer. The bundled MESA software renderer is loaded instead of the default OpenGL driver.");
|
||||
def->min = 0;
|
||||
#endif /* _MSC_VER */
|
||||
}
|
||||
|
||||
const CLIActionsConfigDef cli_actions_config_def;
|
||||
|
|
|
@ -1572,10 +1572,8 @@ public:
|
|||
auto hit = bridge_mesh_intersect(headjp, n, r);
|
||||
|
||||
if(std::isinf(hit.distance())) ground_head_indices.emplace_back(i);
|
||||
else {
|
||||
if(m_cfg.ground_facing_only) head.invalidate();
|
||||
m_iheads_onmodel.emplace_back(std::make_pair(i, hit));
|
||||
}
|
||||
else if(m_cfg.ground_facing_only) head.invalidate();
|
||||
else m_iheads_onmodel.emplace_back(std::make_pair(i, hit));
|
||||
}
|
||||
|
||||
// We want to search for clusters of points that are far enough
|
||||
|
@ -1872,7 +1870,7 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
void cascade_pillars() {
|
||||
void interconnect_pillars() {
|
||||
// Now comes the algorithm that connects pillars with each other.
|
||||
// Ideally every pillar should be connected with at least one of its
|
||||
// neighbors if that neighbor is within max_pillar_link_distance
|
||||
|
@ -2121,7 +2119,7 @@ bool SLASupportTree::generate(const std::vector<SupportPoint> &support_points,
|
|||
|
||||
std::bind(&Algorithm::routing_to_model, &alg),
|
||||
|
||||
std::bind(&Algorithm::cascade_pillars, &alg),
|
||||
std::bind(&Algorithm::interconnect_pillars, &alg),
|
||||
|
||||
std::bind(&Algorithm::routing_headless, &alg),
|
||||
|
||||
|
@ -2150,16 +2148,16 @@ bool SLASupportTree::generate(const std::vector<SupportPoint> &support_points,
|
|||
// Let's define a simple automaton that will run our program.
|
||||
auto progress = [&ctl, &pc] () {
|
||||
static const std::array<std::string, NUM_STEPS> stepstr {
|
||||
L("Starting"),
|
||||
L("Filtering"),
|
||||
L("Generate pinheads"),
|
||||
L("Classification"),
|
||||
L("Routing to ground"),
|
||||
L("Routing supports to model surface"),
|
||||
L("Cascading pillars"),
|
||||
L("Processing small holes"),
|
||||
L("Done"),
|
||||
L("Abort")
|
||||
"Starting",
|
||||
"Filtering",
|
||||
"Generate pinheads",
|
||||
"Classification",
|
||||
"Routing to ground",
|
||||
"Routing supports to model surface",
|
||||
"Interconnecting pillars",
|
||||
"Processing small holes",
|
||||
"Done",
|
||||
"Abort"
|
||||
};
|
||||
|
||||
static const std::array<unsigned, NUM_STEPS> stepstate {
|
||||
|
|
|
@ -6,10 +6,12 @@
|
|||
#define NOMINMAX
|
||||
#include <Windows.h>
|
||||
#include <wchar.h>
|
||||
// Let the NVIDIA and AMD know we want to use their graphics card
|
||||
// on a dual graphics card system.
|
||||
__declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001;
|
||||
__declspec(dllexport) int AmdPowerXpressRequestHighPerformance = 1;
|
||||
#ifdef SLIC3R_GUI
|
||||
// Let the NVIDIA and AMD know we want to use their graphics card
|
||||
// on a dual graphics card system.
|
||||
__declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001;
|
||||
__declspec(dllexport) int AmdPowerXpressRequestHighPerformance = 1;
|
||||
#endif /* SLIC3R_GUI */
|
||||
#endif /* WIN32 */
|
||||
|
||||
#include <cstdio>
|
||||
|
@ -448,7 +450,7 @@ int CLI::run(int argc, char **argv)
|
|||
}
|
||||
|
||||
if (start_gui) {
|
||||
#if 1
|
||||
#ifdef SLIC3R_GUI
|
||||
// #ifdef USE_WX
|
||||
GUI::GUI_App *gui = new GUI::GUI_App();
|
||||
// gui->autosave = m_config.opt_string("autosave");
|
||||
|
@ -477,12 +479,12 @@ int CLI::run(int argc, char **argv)
|
|||
gui->mainframe->load_config(m_extra_config);
|
||||
});
|
||||
return wxEntry(argc, argv);
|
||||
#else
|
||||
#else /* SLIC3R_GUI */
|
||||
// No GUI support. Just print out a help.
|
||||
this->print_help(false);
|
||||
// If started without a parameter, consider it to be OK, otherwise report an error code (no action etc).
|
||||
return (argc == 0) ? 0 : 1;
|
||||
#endif
|
||||
#endif /* SLIC3R_GUI */
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -563,7 +565,13 @@ bool CLI::setup(int argc, char **argv)
|
|||
void CLI::print_help(bool include_print_options, PrinterTechnology printer_technology) const
|
||||
{
|
||||
boost::nowide::cout
|
||||
<< "Slic3r Prusa Edition " << SLIC3R_BUILD << std::endl
|
||||
<< "Slic3r Prusa Edition " << SLIC3R_BUILD
|
||||
#ifdef SLIC3R_GUI
|
||||
<< " (with GUI support)"
|
||||
#else /* SLIC3R_GUI */
|
||||
<< " (without GUI support)"
|
||||
#endif /* SLIC3R_GUI */
|
||||
<< std::endl
|
||||
<< "https://github.com/prusa3d/Slic3r" << std::endl << std::endl
|
||||
<< "Usage: slic3r [ ACTIONS ] [ TRANSFORM ] [ OPTIONS ] [ file.stl ... ]" << std::endl
|
||||
<< std::endl
|
||||
|
|
|
@ -61,19 +61,22 @@ ObjectList::ObjectList(wxWindow* parent) :
|
|||
{
|
||||
// Fill CATEGORY_ICON
|
||||
{
|
||||
// Note: `this` isn't passed to create_scaled_bitmap() here because of bugs in the widget,
|
||||
// see note in PresetBundle::load_compatible_bitmaps()
|
||||
|
||||
// ptFFF
|
||||
CATEGORY_ICON[L("Layers and Perimeters")] = create_scaled_bitmap(this, "layers");
|
||||
CATEGORY_ICON[L("Infill")] = create_scaled_bitmap(this, "infill");
|
||||
CATEGORY_ICON[L("Support material")] = create_scaled_bitmap(this, "support");
|
||||
CATEGORY_ICON[L("Speed")] = create_scaled_bitmap(this, "time");
|
||||
CATEGORY_ICON[L("Extruders")] = create_scaled_bitmap(this, "funnel");
|
||||
CATEGORY_ICON[L("Extrusion Width")] = create_scaled_bitmap(this, "funnel");
|
||||
// CATEGORY_ICON[L("Skirt and brim")] = create_scaled_bitmap(this, "skirt+brim");
|
||||
// CATEGORY_ICON[L("Speed > Acceleration")] = create_scaled_bitmap(this, "time");
|
||||
CATEGORY_ICON[L("Advanced")] = create_scaled_bitmap(this, "wrench");
|
||||
// ptSLA
|
||||
CATEGORY_ICON[L("Supports")] = create_scaled_bitmap(this, "sla_supports");
|
||||
CATEGORY_ICON[L("Pad")] = create_scaled_bitmap(this, "brick.png");
|
||||
CATEGORY_ICON[L("Layers and Perimeters")] = create_scaled_bitmap(nullptr, "layers");
|
||||
CATEGORY_ICON[L("Infill")] = create_scaled_bitmap(nullptr, "infill");
|
||||
CATEGORY_ICON[L("Support material")] = create_scaled_bitmap(nullptr, "support");
|
||||
CATEGORY_ICON[L("Speed")] = create_scaled_bitmap(nullptr, "time");
|
||||
CATEGORY_ICON[L("Extruders")] = create_scaled_bitmap(nullptr, "funnel");
|
||||
CATEGORY_ICON[L("Extrusion Width")] = create_scaled_bitmap(nullptr, "funnel");
|
||||
// CATEGORY_ICON[L("Skirt and brim")] = create_scaled_bitmap(nullptr, "skirt+brim");
|
||||
// CATEGORY_ICON[L("Speed > Acceleration")] = create_scaled_bitmap(nullptr, "time");
|
||||
CATEGORY_ICON[L("Advanced")] = create_scaled_bitmap(nullptr, "wrench");
|
||||
// ptSLA
|
||||
CATEGORY_ICON[L("Supports")] = create_scaled_bitmap(nullptr, "sla_supports");
|
||||
CATEGORY_ICON[L("Pad")] = create_scaled_bitmap(nullptr, "brick.png");
|
||||
}
|
||||
|
||||
// create control
|
||||
|
@ -392,10 +395,10 @@ void ObjectList::update_name_in_model(const wxDataViewItem& item) const
|
|||
|
||||
void ObjectList::init_icons()
|
||||
{
|
||||
m_bmp_modifiermesh = create_scaled_bitmap(this, "add_modifier");
|
||||
m_bmp_solidmesh = create_scaled_bitmap(this, "add_part");
|
||||
m_bmp_support_enforcer = create_scaled_bitmap(this, "support_enforcer");
|
||||
m_bmp_support_blocker = create_scaled_bitmap(this, "support_blocker");
|
||||
m_bmp_modifiermesh = create_scaled_bitmap(nullptr, "add_modifier");
|
||||
m_bmp_solidmesh = create_scaled_bitmap(nullptr, "add_part");
|
||||
m_bmp_support_enforcer = create_scaled_bitmap(nullptr, "support_enforcer");
|
||||
m_bmp_support_blocker = create_scaled_bitmap(nullptr, "support_blocker");
|
||||
|
||||
|
||||
m_bmp_vector.reserve(4); // bitmaps for different types of parts
|
||||
|
@ -406,13 +409,13 @@ void ObjectList::init_icons()
|
|||
m_objects_model->SetVolumeBitmaps(m_bmp_vector);
|
||||
|
||||
// init icon for manifold warning
|
||||
m_bmp_manifold_warning = create_scaled_bitmap(this, "exclamation_mark_.png");
|
||||
m_bmp_manifold_warning = create_scaled_bitmap(nullptr, "exclamation_mark_.png");
|
||||
|
||||
// init bitmap for "Split to sub-objects" context menu
|
||||
m_bmp_split = create_scaled_bitmap(this, "split_parts_SMALL");
|
||||
m_bmp_split = create_scaled_bitmap(nullptr, "split_parts_SMALL");
|
||||
|
||||
// init bitmap for "Add Settings" context menu
|
||||
m_bmp_cog = create_scaled_bitmap(this, "cog");
|
||||
m_bmp_cog = create_scaled_bitmap(nullptr, "cog");
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -801,12 +801,16 @@ bool PresetCollection::delete_current_preset()
|
|||
|
||||
void PresetCollection::load_bitmap_default(wxWindow *window, const std::string &file_name)
|
||||
{
|
||||
*m_bitmap_main_frame = create_scaled_bitmap(window, file_name);
|
||||
// XXX: See note in PresetBundle::load_compatible_bitmaps()
|
||||
(void)window;
|
||||
*m_bitmap_main_frame = create_scaled_bitmap(nullptr, file_name);
|
||||
}
|
||||
|
||||
void PresetCollection::load_bitmap_add(wxWindow *window, const std::string &file_name)
|
||||
{
|
||||
*m_bitmap_add = create_scaled_bitmap(window, file_name);
|
||||
// XXX: See note in PresetBundle::load_compatible_bitmaps()
|
||||
(void)window;
|
||||
*m_bitmap_add = create_scaled_bitmap(nullptr, file_name);
|
||||
}
|
||||
|
||||
const Preset* PresetCollection::get_selected_preset_parent() const
|
||||
|
|
|
@ -398,10 +398,17 @@ void PresetBundle::export_selections(AppConfig &config)
|
|||
|
||||
void PresetBundle::load_compatible_bitmaps(wxWindow *window)
|
||||
{
|
||||
*m_bitmapCompatible = create_scaled_bitmap(window, "flag_green");
|
||||
*m_bitmapIncompatible = create_scaled_bitmap(window, "flag_red");
|
||||
*m_bitmapLock = create_scaled_bitmap(window, "lock_closed");
|
||||
*m_bitmapLockOpen = create_scaled_bitmap(window, "sys_unlock.png");
|
||||
// We don't actually pass the window pointer here and instead generate
|
||||
// a low DPI bitmap, because the wxBitmapComboBox and wxDataViewCtrl don't support
|
||||
// high DPI bitmaps very well, they compute their dimensions wrong.
|
||||
// TODO: Update this when fixed in wxWidgets
|
||||
// See also PresetCollection::load_bitmap_default() and PresetCollection::load_bitmap_add()
|
||||
|
||||
(void)window;
|
||||
*m_bitmapCompatible = create_scaled_bitmap(nullptr, "flag_green");
|
||||
*m_bitmapIncompatible = create_scaled_bitmap(nullptr, "flag_red");
|
||||
*m_bitmapLock = create_scaled_bitmap(nullptr, "lock_closed");
|
||||
*m_bitmapLockOpen = create_scaled_bitmap(nullptr, "sys_unlock.png");
|
||||
|
||||
prints .set_bitmap_compatible(m_bitmapCompatible);
|
||||
filaments .set_bitmap_compatible(m_bitmapCompatible);
|
||||
|
|
|
@ -6,14 +6,20 @@
|
|||
#include <Windows.h>
|
||||
#include <shellapi.h>
|
||||
#include <wchar.h>
|
||||
// Let the NVIDIA and AMD know we want to use their graphics card
|
||||
// on a dual graphics card system.
|
||||
__declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001;
|
||||
__declspec(dllexport) int AmdPowerXpressRequestHighPerformance = 1;
|
||||
|
||||
#ifdef SLIC3R_GUI
|
||||
// Let the NVIDIA and AMD know we want to use their graphics card
|
||||
// on a dual graphics card system.
|
||||
__declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001;
|
||||
__declspec(dllexport) int AmdPowerXpressRequestHighPerformance = 1;
|
||||
#endif /* SLIC3R_GUI */
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <GL/GL.h>
|
||||
|
||||
#ifdef SLIC3R_GUI
|
||||
#include <GL/GL.h>
|
||||
#endif /* SLIC3R_GUI */
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
@ -23,6 +29,7 @@ __declspec(dllexport) int AmdPowerXpressRequestHighPerformance = 1;
|
|||
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef SLIC3R_GUI
|
||||
class OpenGLVersionCheck
|
||||
{
|
||||
public:
|
||||
|
@ -188,6 +195,7 @@ protected:
|
|||
};
|
||||
|
||||
bool OpenGLVersionCheck::message_pump_exit = false;
|
||||
#endif /* SLIC3R_GUI */
|
||||
|
||||
extern "C" {
|
||||
typedef int (__stdcall *Slic3rMainFunc)(int argc, wchar_t **argv);
|
||||
|
@ -206,18 +214,33 @@ int wmain(int argc, wchar_t **argv)
|
|||
|
||||
std::vector<wchar_t*> argv_extended;
|
||||
argv_extended.emplace_back(argv[0]);
|
||||
|
||||
#ifdef SLIC3R_GUI
|
||||
// Here one may push some additional parameters based on the wrapper type.
|
||||
for (int i = 1; i < argc; ++ i)
|
||||
bool force_mesa = false;
|
||||
#endif /* SLIC3R_GUI */
|
||||
for (int i = 1; i < argc; ++ i) {
|
||||
#ifdef SLIC3R_GUI
|
||||
if (wcscmp(argv[i], L"--sw-renderer") == 0)
|
||||
force_mesa = true;
|
||||
else if (wcscmp(argv[i], L"--no-sw-renderer") == 0)
|
||||
force_mesa = false;
|
||||
#endif /* SLIC3R_GUI */
|
||||
argv_extended.emplace_back(argv[i]);
|
||||
}
|
||||
argv_extended.emplace_back(nullptr);
|
||||
|
||||
#ifdef SLIC3R_GUI
|
||||
OpenGLVersionCheck opengl_version_check;
|
||||
bool load_mesa =
|
||||
// Forced from the command line.
|
||||
force_mesa ||
|
||||
// Running over a rempote desktop, and the RemoteFX is not enabled, therefore Windows will only provide SW OpenGL 1.1 context.
|
||||
// In that case, use Mesa.
|
||||
::GetSystemMetrics(SM_REMOTESESSION) ||
|
||||
// Try to load the default OpenGL driver and test its context version.
|
||||
! opengl_version_check.load_opengl_dll() || ! opengl_version_check.is_version_greater_or_equal_to(2, 0);
|
||||
#endif /* SLIC3R_GUI */
|
||||
|
||||
wchar_t path_to_exe[MAX_PATH + 1] = { 0 };
|
||||
::GetModuleFileNameW(nullptr, path_to_exe, MAX_PATH);
|
||||
|
@ -228,6 +251,7 @@ int wmain(int argc, wchar_t **argv)
|
|||
_wsplitpath(path_to_exe, drive, dir, fname, ext);
|
||||
_wmakepath(path_to_exe, drive, dir, nullptr, nullptr);
|
||||
|
||||
#ifdef SLIC3R_GUI
|
||||
// https://wiki.qt.io/Cross_compiling_Mesa_for_Windows
|
||||
// http://download.qt.io/development_releases/prebuilt/llvmpipe/windows/
|
||||
if (load_mesa) {
|
||||
|
@ -252,6 +276,7 @@ int wmain(int argc, wchar_t **argv)
|
|||
printf("slic3r.dll was not loaded\n");
|
||||
return -1;
|
||||
}
|
||||
#endif /* SLIC3R_GUI */
|
||||
|
||||
// resolve function address here
|
||||
slic3r_main = (Slic3rMainFunc)GetProcAddress(hInstance_Slic3r,
|
||||
|
@ -267,5 +292,5 @@ int wmain(int argc, wchar_t **argv)
|
|||
return -1;
|
||||
}
|
||||
// argc minus the trailing nullptr of the argv
|
||||
return slic3r_main(argv_extended.size() - 1, argv_extended.data());
|
||||
return slic3r_main((int)argv_extended.size() - 1, argv_extended.data());
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue