mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-12 01:07:57 -06:00
Merge branch 'master' of https://github.com/prusa3d/PrusaSlicer into et_perspective_camera
This commit is contained in:
commit
541f58c656
10 changed files with 54 additions and 44 deletions
|
@ -240,17 +240,34 @@ if(NOT WIN32)
|
||||||
set(MINIMUM_BOOST_VERSION "1.64.0")
|
set(MINIMUM_BOOST_VERSION "1.64.0")
|
||||||
endif()
|
endif()
|
||||||
find_package(Boost ${MINIMUM_BOOST_VERSION} REQUIRED COMPONENTS system filesystem thread log locale regex)
|
find_package(Boost ${MINIMUM_BOOST_VERSION} REQUIRED COMPONENTS system filesystem thread log locale regex)
|
||||||
if(Boost_FOUND)
|
|
||||||
# message("Boost include dir: ${Boost_INCLUDE_DIRS}")
|
add_library(boost_libs INTERFACE)
|
||||||
# message("Boost library dirs: ${Boost_LIBRARY_DIRS}")
|
add_library(boost_headeronly INTERFACE)
|
||||||
# message("Boost libraries: ${Boost_LIBRARIES}")
|
|
||||||
if (APPLE)
|
if (APPLE)
|
||||||
# BOOST_ASIO_DISABLE_KQUEUE : prevents a Boost ASIO bug on OS X: https://svn.boost.org/trac/boost/ticket/5339
|
# BOOST_ASIO_DISABLE_KQUEUE : prevents a Boost ASIO bug on OS X: https://svn.boost.org/trac/boost/ticket/5339
|
||||||
add_definitions(-DBOOST_ASIO_DISABLE_KQUEUE)
|
target_compile_definitions(boost_headeronly INTERFACE BOOST_ASIO_DISABLE_KQUEUE)
|
||||||
endif()
|
endif()
|
||||||
if(NOT SLIC3R_STATIC)
|
|
||||||
add_definitions(-DBOOST_LOG_DYN_LINK)
|
if(NOT SLIC3R_STATIC)
|
||||||
endif()
|
target_compile_definitions(boost_headeronly INTERFACE BOOST_LOG_DYN_LINK)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(TARGET Boost::system)
|
||||||
|
message(STATUS "Boost::boost exists")
|
||||||
|
target_link_libraries(boost_headeronly INTERFACE Boost::boost)
|
||||||
|
target_link_libraries(boost_libs INTERFACE
|
||||||
|
boost_headeronly # includes the custom compile definitions as well
|
||||||
|
Boost::system
|
||||||
|
Boost::filesystem
|
||||||
|
Boost::thread
|
||||||
|
Boost::log
|
||||||
|
Boost::locale
|
||||||
|
Boost::regex
|
||||||
|
)
|
||||||
|
else()
|
||||||
|
target_include_directories(boost_headeronly INTERFACE ${Boost_INCLUDE_DIRS})
|
||||||
|
target_link_libraries(boost_libs INTERFACE boost_headeronly ${Boost_LIBRARIES})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Find and configure intel-tbb
|
# Find and configure intel-tbb
|
||||||
|
|
|
@ -15,6 +15,7 @@ const vec3 LIGHT_FRONT_DIR = vec3(0.6985074, 0.1397015, 0.6985074);
|
||||||
#define INTENSITY_AMBIENT 0.3
|
#define INTENSITY_AMBIENT 0.3
|
||||||
|
|
||||||
uniform mat4 volume_world_matrix;
|
uniform mat4 volume_world_matrix;
|
||||||
|
uniform float object_max_z;
|
||||||
|
|
||||||
// x = tainted, y = specular;
|
// x = tainted, y = specular;
|
||||||
varying vec2 intensity;
|
varying vec2 intensity;
|
||||||
|
@ -42,6 +43,12 @@ void main()
|
||||||
intensity.x += NdotL * LIGHT_FRONT_DIFFUSE;
|
intensity.x += NdotL * LIGHT_FRONT_DIFFUSE;
|
||||||
|
|
||||||
// Scaled to widths of the Z texture.
|
// Scaled to widths of the Z texture.
|
||||||
|
if (object_max_z > 0.0)
|
||||||
|
// when rendering the overlay
|
||||||
|
object_z = object_max_z * gl_MultiTexCoord0.y;
|
||||||
|
else
|
||||||
|
// when rendering the volumes
|
||||||
object_z = (volume_world_matrix * gl_Vertex).z;
|
object_z = (volume_world_matrix * gl_Vertex).z;
|
||||||
|
|
||||||
gl_Position = ftransform();
|
gl_Position = ftransform();
|
||||||
}
|
}
|
||||||
|
|
|
@ -139,7 +139,7 @@ if (MSVC)
|
||||||
target_compile_definitions(PrusaSlicer_app_gui PRIVATE -DSLIC3R_WRAPPER_NOCONSOLE)
|
target_compile_definitions(PrusaSlicer_app_gui PRIVATE -DSLIC3R_WRAPPER_NOCONSOLE)
|
||||||
add_dependencies(PrusaSlicer_app_gui PrusaSlicer)
|
add_dependencies(PrusaSlicer_app_gui PrusaSlicer)
|
||||||
set_target_properties(PrusaSlicer_app_gui PROPERTIES OUTPUT_NAME "prusa-slicer")
|
set_target_properties(PrusaSlicer_app_gui PROPERTIES OUTPUT_NAME "prusa-slicer")
|
||||||
target_include_directories(PrusaSlicer_app_gui SYSTEM PUBLIC ${Boost_INCLUDE_DIRS})
|
target_link_libraries(PrusaSlicer_app_gui PRIVATE boost_headeronly)
|
||||||
|
|
||||||
add_executable(PrusaSlicer_app_console PrusaSlicer_app_msvc.cpp ${CMAKE_CURRENT_BINARY_DIR}/PrusaSlicer.rc)
|
add_executable(PrusaSlicer_app_console PrusaSlicer_app_msvc.cpp ${CMAKE_CURRENT_BINARY_DIR}/PrusaSlicer.rc)
|
||||||
# Generate debug symbols even in release mode.
|
# Generate debug symbols even in release mode.
|
||||||
|
@ -147,7 +147,7 @@ if (MSVC)
|
||||||
target_compile_definitions(PrusaSlicer_app_console PRIVATE -DSLIC3R_WRAPPER_CONSOLE)
|
target_compile_definitions(PrusaSlicer_app_console PRIVATE -DSLIC3R_WRAPPER_CONSOLE)
|
||||||
add_dependencies(PrusaSlicer_app_console PrusaSlicer)
|
add_dependencies(PrusaSlicer_app_console PrusaSlicer)
|
||||||
set_target_properties(PrusaSlicer_app_console PROPERTIES OUTPUT_NAME "prusa-slicer-console")
|
set_target_properties(PrusaSlicer_app_console PROPERTIES OUTPUT_NAME "prusa-slicer-console")
|
||||||
target_include_directories(PrusaSlicer_app_console SYSTEM PUBLIC ${Boost_INCLUDE_DIRS})
|
target_link_libraries(PrusaSlicer_app_console PRIVATE boost_headeronly)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
# Link the resources dir to where Slic3r GUI expects it
|
# Link the resources dir to where Slic3r GUI expects it
|
||||||
|
|
|
@ -11,4 +11,4 @@ add_library(admesh STATIC
|
||||||
util.cpp
|
util.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
target_include_directories(admesh SYSTEM PRIVATE ${Boost_INCLUDE_DIRS})
|
target_link_libraries(admesh PRIVATE boost_headeronly)
|
||||||
|
|
|
@ -19,6 +19,6 @@ add_library(nowide STATIC
|
||||||
nowide/windows.hpp
|
nowide/windows.hpp
|
||||||
)
|
)
|
||||||
|
|
||||||
target_include_directories(nowide SYSTEM PUBLIC ${Boost_INCLUDE_DIRS})
|
target_link_libraries(nowide PUBLIC boost_headeronly)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -56,12 +56,12 @@ endif()
|
||||||
|
|
||||||
# Clipper backend is not enough on its own, it still needs some functions
|
# Clipper backend is not enough on its own, it still needs some functions
|
||||||
# from Boost geometry
|
# from Boost geometry
|
||||||
if(NOT Boost_INCLUDE_DIRS_FOUND)
|
if(NOT Boost_FOUND)
|
||||||
find_package(Boost 1.58 REQUIRED)
|
find_package(Boost 1.58 REQUIRED)
|
||||||
# TODO automatic download of boost geometry headers
|
# TODO automatic download of boost geometry headers
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
target_include_directories(clipperBackend SYSTEM INTERFACE ${Boost_INCLUDE_DIRS} )
|
target_link_libraries(clipperBackend INTERFACE Boost::boost )
|
||||||
#target_sources(ClipperBackend INTERFACE
|
#target_sources(ClipperBackend INTERFACE
|
||||||
# ${CMAKE_CURRENT_SOURCE_DIR}/geometries.hpp
|
# ${CMAKE_CURRENT_SOURCE_DIR}/geometries.hpp
|
||||||
# ${CMAKE_CURRENT_SOURCE_DIR}/clipper_polygon.hpp
|
# ${CMAKE_CURRENT_SOURCE_DIR}/clipper_polygon.hpp
|
||||||
|
|
|
@ -182,13 +182,12 @@ if (SLIC3R_PCH AND NOT SLIC3R_SYNTAXONLY)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
target_compile_definitions(libslic3r PUBLIC -DUSE_TBB)
|
target_compile_definitions(libslic3r PUBLIC -DUSE_TBB)
|
||||||
target_include_directories(libslic3r SYSTEM PUBLIC ${Boost_INCLUDE_DIRS})
|
|
||||||
target_include_directories(libslic3r PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ${LIBNEST2D_INCLUDES} PUBLIC ${CMAKE_CURRENT_BINARY_DIR})
|
target_include_directories(libslic3r PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ${LIBNEST2D_INCLUDES} PUBLIC ${CMAKE_CURRENT_BINARY_DIR})
|
||||||
target_link_libraries(libslic3r
|
target_link_libraries(libslic3r
|
||||||
libnest2d
|
libnest2d
|
||||||
admesh
|
admesh
|
||||||
miniz
|
miniz
|
||||||
${Boost_LIBRARIES}
|
boost_libs
|
||||||
clipper
|
clipper
|
||||||
nowide
|
nowide
|
||||||
${EXPAT_LIBRARIES}
|
${EXPAT_LIBRARIES}
|
||||||
|
|
|
@ -63,11 +63,6 @@ static const float GROUND_Z = -0.02f;
|
||||||
static const float GIZMO_RESET_BUTTON_HEIGHT = 22.0f;
|
static const float GIZMO_RESET_BUTTON_HEIGHT = 22.0f;
|
||||||
static const float GIZMO_RESET_BUTTON_WIDTH = 70.f;
|
static const float GIZMO_RESET_BUTTON_WIDTH = 70.f;
|
||||||
|
|
||||||
static const float UNIT_MATRIX[] = { 1.0f, 0.0f, 0.0f, 0.0f,
|
|
||||||
0.0f, 1.0f, 0.0f, 0.0f,
|
|
||||||
0.0f, 0.0f, 1.0f, 0.0f,
|
|
||||||
0.0f, 0.0f, 0.0f, 1.0f };
|
|
||||||
|
|
||||||
static const float DEFAULT_BG_DARK_COLOR[3] = { 0.478f, 0.478f, 0.478f };
|
static const float DEFAULT_BG_DARK_COLOR[3] = { 0.478f, 0.478f, 0.478f };
|
||||||
static const float DEFAULT_BG_LIGHT_COLOR[3] = { 0.753f, 0.753f, 0.753f };
|
static const float DEFAULT_BG_LIGHT_COLOR[3] = { 0.753f, 0.753f, 0.753f };
|
||||||
static const float ERROR_BG_DARK_COLOR[3] = { 0.478f, 0.192f, 0.039f };
|
static const float ERROR_BG_DARK_COLOR[3] = { 0.478f, 0.192f, 0.039f };
|
||||||
|
@ -440,8 +435,7 @@ void GLCanvas3D::LayersEditing::_render_active_object_annotations(const GLCanvas
|
||||||
m_shader.set_uniform("z_texture_row_to_normalized", 1.0f / (float)m_layers_texture.height);
|
m_shader.set_uniform("z_texture_row_to_normalized", 1.0f / (float)m_layers_texture.height);
|
||||||
m_shader.set_uniform("z_cursor", m_object_max_z * this->get_cursor_z_relative(canvas));
|
m_shader.set_uniform("z_cursor", m_object_max_z * this->get_cursor_z_relative(canvas));
|
||||||
m_shader.set_uniform("z_cursor_band_width", band_width);
|
m_shader.set_uniform("z_cursor_band_width", band_width);
|
||||||
// The shader requires the original model coordinates when rendering to the texture, so we pass it the unit matrix
|
m_shader.set_uniform("object_max_z", m_object_max_z);
|
||||||
m_shader.set_uniform("volume_world_matrix", UNIT_MATRIX);
|
|
||||||
|
|
||||||
glsafe(::glPixelStorei(GL_UNPACK_ALIGNMENT, 1));
|
glsafe(::glPixelStorei(GL_UNPACK_ALIGNMENT, 1));
|
||||||
glsafe(::glBindTexture(GL_TEXTURE_2D, m_z_texture_id));
|
glsafe(::glBindTexture(GL_TEXTURE_2D, m_z_texture_id));
|
||||||
|
@ -454,10 +448,10 @@ void GLCanvas3D::LayersEditing::_render_active_object_annotations(const GLCanvas
|
||||||
|
|
||||||
::glBegin(GL_QUADS);
|
::glBegin(GL_QUADS);
|
||||||
::glNormal3f(0.0f, 0.0f, 1.0f);
|
::glNormal3f(0.0f, 0.0f, 1.0f);
|
||||||
::glVertex3f(l, b, 0.0f);
|
::glTexCoord2f(0.0f, 0.0f); ::glVertex2f(l, b);
|
||||||
::glVertex3f(r, b, 0.0f);
|
::glTexCoord2f(1.0f, 0.0f); ::glVertex2f(r, b);
|
||||||
::glVertex3f(r, t, m_object_max_z);
|
::glTexCoord2f(1.0f, 1.0f); ::glVertex2f(r, t);
|
||||||
::glVertex3f(l, t, m_object_max_z);
|
::glTexCoord2f(0.0f, 1.0f); ::glVertex2f(l, t);
|
||||||
glsafe(::glEnd());
|
glsafe(::glEnd());
|
||||||
glsafe(::glBindTexture(GL_TEXTURE_2D, 0));
|
glsafe(::glBindTexture(GL_TEXTURE_2D, 0));
|
||||||
|
|
||||||
|
@ -510,6 +504,7 @@ void GLCanvas3D::LayersEditing::render_volumes(const GLCanvas3D& canvas, const G
|
||||||
GLint z_cursor_id = ::glGetUniformLocation(shader_id, "z_cursor");
|
GLint z_cursor_id = ::glGetUniformLocation(shader_id, "z_cursor");
|
||||||
GLint z_cursor_band_width_id = ::glGetUniformLocation(shader_id, "z_cursor_band_width");
|
GLint z_cursor_band_width_id = ::glGetUniformLocation(shader_id, "z_cursor_band_width");
|
||||||
GLint world_matrix_id = ::glGetUniformLocation(shader_id, "volume_world_matrix");
|
GLint world_matrix_id = ::glGetUniformLocation(shader_id, "volume_world_matrix");
|
||||||
|
GLint object_max_z_id = ::glGetUniformLocation(shader_id, "object_max_z");
|
||||||
glcheck();
|
glcheck();
|
||||||
|
|
||||||
if (z_to_texture_row_id != -1 && z_texture_row_to_normalized_id != -1 && z_cursor_id != -1 && z_cursor_band_width_id != -1 && world_matrix_id != -1)
|
if (z_to_texture_row_id != -1 && z_texture_row_to_normalized_id != -1 && z_cursor_id != -1 && z_cursor_band_width_id != -1 && world_matrix_id != -1)
|
||||||
|
@ -536,7 +531,10 @@ void GLCanvas3D::LayersEditing::render_volumes(const GLCanvas3D& canvas, const G
|
||||||
// Render the object using the layer editing shader and texture.
|
// Render the object using the layer editing shader and texture.
|
||||||
if (! glvolume->is_active || glvolume->composite_id.object_id != this->last_object_id || glvolume->is_modifier)
|
if (! glvolume->is_active || glvolume->composite_id.object_id != this->last_object_id || glvolume->is_modifier)
|
||||||
continue;
|
continue;
|
||||||
|
if (world_matrix_id != -1)
|
||||||
glsafe(::glUniformMatrix4fv(world_matrix_id, 1, GL_FALSE, (const GLfloat*)glvolume->world_matrix().cast<float>().data()));
|
glsafe(::glUniformMatrix4fv(world_matrix_id, 1, GL_FALSE, (const GLfloat*)glvolume->world_matrix().cast<float>().data()));
|
||||||
|
if (object_max_z_id != -1)
|
||||||
|
glsafe(::glUniform1f(object_max_z_id, GLfloat(0)));
|
||||||
glvolume->render();
|
glvolume->render();
|
||||||
}
|
}
|
||||||
// Revert back to the previous shader.
|
// Revert back to the previous shader.
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
class wxTimer;
|
class wxTimer;
|
||||||
class wxGauge;
|
class wxGauge;
|
||||||
|
|
|
@ -119,8 +119,6 @@ target_include_directories(XS PRIVATE src ${LIBDIR}/libslic3r)
|
||||||
target_compile_definitions(XS PRIVATE -DSLIC3RXS)
|
target_compile_definitions(XS PRIVATE -DSLIC3RXS)
|
||||||
set_target_properties(XS PROPERTIES PREFIX "") # Prevent cmake from generating libXS.so instead of XS.so
|
set_target_properties(XS PROPERTIES PREFIX "") # Prevent cmake from generating libXS.so instead of XS.so
|
||||||
|
|
||||||
target_link_libraries(XS ${Boost_LIBRARIES})
|
|
||||||
|
|
||||||
if (APPLE)
|
if (APPLE)
|
||||||
# -liconv: boost links to libiconv by default
|
# -liconv: boost links to libiconv by default
|
||||||
target_link_libraries(XS "-liconv -framework IOKit" "-framework CoreFoundation" -lc++)
|
target_link_libraries(XS "-liconv -framework IOKit" "-framework CoreFoundation" -lc++)
|
||||||
|
@ -156,12 +154,6 @@ if (WIN32)
|
||||||
target_link_libraries(XS ${PERL_LIBRARY})
|
target_link_libraries(XS ${PERL_LIBRARY})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
target_link_libraries(XS ${Boost_LIBRARIES})
|
|
||||||
target_link_libraries(XS ${TBB_LIBRARIES})
|
|
||||||
# target_link_libraries(XS ${wxWidgets_LIBRARIES})
|
|
||||||
target_link_libraries(XS ${EXPAT_LIBRARIES})
|
|
||||||
# target_link_libraries(XS ${GLEW_LIBRARIES})
|
|
||||||
|
|
||||||
# Install the XS.pm and XS.{so,dll,bundle} into the local-lib directory.
|
# Install the XS.pm and XS.{so,dll,bundle} into the local-lib directory.
|
||||||
set(PERL_LOCAL_LIB_DIR "../../local-lib/lib/perl5/${PerlEmbed_ARCHNAME}")
|
set(PERL_LOCAL_LIB_DIR "../../local-lib/lib/perl5/${PerlEmbed_ARCHNAME}")
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
|
@ -181,10 +173,6 @@ if(APPLE)
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(SLIC3R_PROFILE)
|
|
||||||
target_link_libraries(Shiny)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if (MSVC)
|
if (MSVC)
|
||||||
# Here we associate some additional properties with the MSVC project to enable compilation and debugging out of the box.
|
# Here we associate some additional properties with the MSVC project to enable compilation and debugging out of the box.
|
||||||
get_filename_component(PROPS_PERL_BIN_PATH "${PERL_EXECUTABLE}" DIRECTORY)
|
get_filename_component(PROPS_PERL_BIN_PATH "${PERL_EXECUTABLE}" DIRECTORY)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue