OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
3DScene.hpp File Reference
#include "libslic3r/libslic3r.h"
#include "libslic3r/Point.hpp"
#include "libslic3r/Line.hpp"
#include "libslic3r/TriangleMesh.hpp"
#include "libslic3r/Utils.hpp"
#include "libslic3r/Geometry.hpp"
#include "libslic3r/PrintConfig.hpp"
#include "libslic3r/Color.hpp"
#include "libslic3r/ObjectID.hpp"
#include "GLModel.hpp"
#include "GLShader.hpp"
#include "MeshUtils.hpp"
#include <array>
#include <cstddef>
#include <cmath>
#include <functional>
#include <map>
#include "libslic3r/BoundingBox.hpp"
#include <memory>
#include <optional>
#include <vector>
#include <string>
#include <utility>
Include dependency graph for 3DScene.hpp:

Go to the source code of this file.

Classes

struct  Slic3r::ObjectFilamentInfo
struct  Slic3r::ObjectFilamentResults
class  Slic3r::GLVolume
class  Slic3r::GLVolume::SinkingContours
struct  Slic3r::GLVolume::CompositeID
class  Slic3r::GLWipeTowerVolume
class  Slic3r::GLVolumeCollection
struct  Slic3r::GLVolumeCollection::PrintVolume
struct  Slic3r::GLVolumeCollection::Slope
struct  Slic3r::_3DScene
struct  Slic3r::GLVolume.__unnamed0__

Namespaces

namespace  Slic3r
 |/ Copyright (c) Prusa Research 2020 - 2023 Enrico Turri @enricoturri1966 |/ |/ PrusaSlicer is released under the terms of the AGPLv3 or higher |/
namespace  Slic3r::GUI

Macros

#define HAS_GLSAFE
#define glsafe(cmd)
#define glcheck()

Typedefs

using Slic3r::GLVolumePtrs = std::vector<GLVolume*>
typedef std::pair< GLVolume *, std::pair< unsigned int, double > > Slic3r::GLVolumeWithIdAndZ
typedef std::vector< GLVolumeWithIdAndZ > Slic3r::GLVolumeWithIdAndZList

Functions

void glAssertRecentCallImpl (const char *file_name, unsigned int line, const char *function_name)
void glAssertRecentCall ()
Slic3r::ColorRGBA adjust_color_for_rendering (const Slic3r::ColorRGBA &colors)
ColorRGBA Slic3r::color_from_model_volume (const ModelVolume &model_volume)
GLVolumeWithIdAndZList Slic3r::volumes_to_render (const GLVolumePtrs &volumes, GLVolumeCollection::ERenderType type, const Transform3d &view_matrix, std::function< bool(const GLVolume &)> filter_func)

Variables

float FullyTransparentMaterialThreshold
float FullTransparentModdifiedToFixAlpha

Class Documentation

◆ Slic3r::ObjectFilamentInfo

struct Slic3r::ObjectFilamentInfo
Collaboration diagram for Slic3r::ObjectFilamentInfo:
Class Members
vector< int > auto_filaments
map< int, int > manual_filaments
ModelObject * object { nullptr }

◆ Slic3r::ObjectFilamentResults

struct Slic3r::ObjectFilamentResults
Collaboration diagram for Slic3r::ObjectFilamentResults:
Class Members
map< int, int > filament_maps
vector< int > filaments
FilamentMapMode mode
vector< ObjectFilamentInfo > object_filaments
vector< ModelObject * > partly_outside_objects

◆ Slic3r::GLVolumeCollection::PrintVolume

struct Slic3r::GLVolumeCollection::PrintVolume
Collaboration diagram for Slic3r::GLVolumeCollection::PrintVolume:
Class Members
array< float, 4 > data
int type { 0 }
array< float, 2 > zs

◆ Slic3r::GLVolumeCollection::Slope

struct Slic3r::GLVolumeCollection::Slope
Class Members
bool active { false }
bool isGlobalActive {false}
float normal_z

◆ Slic3r::GLVolume.__unnamed0__

struct Slic3r::GLVolume.__unnamed0__
Class Members
bool depth_bias: 1
bool disabled: 1
bool force_native_color: 1
bool force_neutral_color: 1
bool force_sinking_contours: 1
bool force_transparent: 1
bool is_active: 1
bool is_extrusion_path: 1
bool is_modifier: 1
bool is_outside: 1
bool is_wipe_tower: 1
bool on_hidden_plate: 1
bool partly_inside: 1
bool picking: 1
bool printable: 1
bool selected: 1
bool shader_outside_printer_detection_enabled: 1
bool slice_error: 1
bool visible: 1
bool zoom_to_volumes: 1

Macro Definition Documentation

◆ glcheck

#define glcheck ( )
Value:
do { glAssertRecentCallImpl(__FILE__, __LINE__, __FUNCTION__); } while (false)
void glAssertRecentCallImpl(const char *file_name, unsigned int line, const char *function_name)
Definition 3DScene.cpp:74

◆ glsafe

#define glsafe ( cmd)
Value:
do { cmd; glAssertRecentCallImpl(__FILE__, __LINE__, __FUNCTION__); } while (false)

◆ HAS_GLSAFE

#define HAS_GLSAFE

Function Documentation

◆ adjust_color_for_rendering()

Slic3r::ColorRGBA adjust_color_for_rendering ( const Slic3r::ColorRGBA & colors)
extern
113{
114 // a clear color keeps its hue, at the least opacity that still shows it
115 const float alpha = std::max(colors.a(), FullyTransparentMaterialThreshold);
116 if (colors.r() < FULL_BLACK_THRESHOLD && colors.g() < FULL_BLACK_THRESHOLD && colors.b() < FULL_BLACK_THRESHOLD) {
117 // black, lifted so that the shading shows, the more the more translucent: a dark translucent
118 // surface shows nothing through itself
119 const float grey = FULL_BLACK_THRESHOLD + 0.3f * (1.0f - alpha);
120 return {grey, grey, grey, alpha};
121 }
122 return {colors.r(), colors.g(), colors.b(), alpha};
123}
float FULL_BLACK_THRESHOLD
Definition 3DScene.cpp:107
float FullyTransparentMaterialThreshold
Definition 3DScene.cpp:101
float a() const
Definition Color.hpp:108
float b() const
Definition Color.hpp:107
float r() const
Definition Color.hpp:105
float g() const
Definition Color.hpp:106

References Slic3r::ColorRGBA::a(), Slic3r::ColorRGBA::b(), FULL_BLACK_THRESHOLD, FullyTransparentMaterialThreshold, Slic3r::ColorRGBA::g(), and Slic3r::ColorRGBA::r().

Referenced by Slic3r::GUI::SelectMachineDialog::adjust_color_for_render(), Slic3r::GUI::SyncAmsInfoDialog::adjust_color_for_render(), libvgcode::convert_filament_colors(), Slic3r::GLWipeTowerVolume::render(), Slic3r::GUI::TriangleSelectorPatch::render(), Slic3r::GUI::GCodeViewer::render_all_plates_stats(), Slic3r::GUI::GLGizmoTextureDisplacement::render_painted_colors(), Slic3r::GUI::GLCanvas3D::render_thumbnail_internal(), Slic3r::GLVolume::set_render_color(), and Slic3r::GLVolume::simple_render().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ glAssertRecentCall()

void glAssertRecentCall ( )
inline
37{ glAssertRecentCallImpl(__FILE__, __LINE__, __FUNCTION__); }
void glAssertRecentCallImpl(const char *file_name, unsigned int line, const char *function_name)
Definition 3DScene.cpp:74

References glAssertRecentCallImpl().

Here is the call graph for this function:

◆ glAssertRecentCallImpl()

void glAssertRecentCallImpl ( const char * file_name,
unsigned int line,
const char * function_name )
extern
75{
76#if defined(NDEBUG)
77 // In release mode, only show OpenGL errors if sufficiently high loglevel.
79 return;
80#endif // NDEBUG
81
82 GLenum err = glGetError();
83 if (err == GL_NO_ERROR)
84 return;
85 const char* sErr = 0;
86 switch (err) {
87 case GL_INVALID_ENUM: sErr = "Invalid Enum"; break;
88 case GL_INVALID_VALUE: sErr = "Invalid Value"; break;
89 // be aware that GL_INVALID_OPERATION is generated if glGetError is executed between the execution of glBegin and the corresponding execution of glEnd
90 case GL_INVALID_OPERATION: sErr = "Invalid Operation"; break;
91 case GL_STACK_OVERFLOW: sErr = "Stack Overflow"; break;
92 case GL_STACK_UNDERFLOW: sErr = "Stack Underflow"; break;
93 case GL_OUT_OF_MEMORY: sErr = "Out Of Memory"; break;
94 default: sErr = "Unknown"; break;
95 }
96 BOOST_LOG_TRIVIAL(error) << "OpenGL error in " << file_name << ":" << line << ", function " << function_name << "() : " << (int)err << " - " << sErr;
97 assert(false);
98}
#define GL_INVALID_VALUE
Definition gl.h:904
#define glGetError
Definition gl.h:3849
#define GL_INVALID_OPERATION
Definition gl.h:903
#define GL_STACK_OVERFLOW
Definition gl.h:1630
unsigned int GLenum
Definition gl.h:2054
#define GL_NO_ERROR
Definition gl.h:1217
#define GL_OUT_OF_MEMORY
Definition gl.h:1251
#define GL_INVALID_ENUM
Definition gl.h:899
#define GL_STACK_UNDERFLOW
Definition gl.h:1631
unsigned get_logging_level()
Definition utils.cpp:221

References Slic3r::get_logging_level(), GL_INVALID_ENUM, GL_INVALID_OPERATION, GL_INVALID_VALUE, GL_NO_ERROR, GL_OUT_OF_MEMORY, GL_STACK_OVERFLOW, GL_STACK_UNDERFLOW, and glGetError.

Referenced by glAssertRecentCall().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ FullTransparentModdifiedToFixAlpha

float FullTransparentModdifiedToFixAlpha
extern

◆ FullyTransparentMaterialThreshold

float FullyTransparentMaterialThreshold
extern