Skip to content

Commit

Permalink
clean; add example code for split views of different rendering styles…
Browse files Browse the repository at this point in the history
… for the same object/scene
  • Loading branch information
LiangliangNan committed Jan 29, 2024
1 parent 0ff53cb commit 2641a75
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 11 deletions.
12 changes: 12 additions & 0 deletions applications/Mapple/paint_canvas.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1878,6 +1878,18 @@ void PaintCanvas::showCoordinatesUnderMouse(bool b) {


void PaintCanvas::draw() {
// To have split views of different rendering styles for the same object/scene.
//glEnable(GL_SCISSOR_TEST);
//int scissor[4];
//glGetIntegerv(GL_SCISSOR_BOX, scissor);
//glScissor(scissor[0], scissor[1], scissor[2] * 0.5f, scissor[3]);
//current_model()->renderer()->get_lines_drawable("edges")->set_visible(false);
//Viewer::draw();
//glScissor(scissor[2] * 0.5f, scissor[1], scissor[2] * 0.5f, scissor[3]);
//current_model()->renderer()->get_lines_drawable("edges")->set_visible(true);
//Viewer::draw();
//glScissor(scissor[0], scissor[1], scissor[2], scissor[3]);

if (models_.empty())
return;

Expand Down
21 changes: 11 additions & 10 deletions easy3d/viewer/viewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1729,16 +1729,17 @@ namespace easy3d {


void Viewer::draw() const {
// glEnable(GL_SCISSOR_TEST);
// int scissor[4];
// glGetIntegerv(GL_SCISSOR_BOX, scissor);
// glScissor(scissor[0], scissor[1], scissor[2] * 0.5f, scissor[3]);
// current_model()->renderer()->get_lines_drawable("edges")->set_visible(false);
// draw();
// glScissor(scissor[2] * 0.5f, scissor[1], scissor[2] * 0.5f, scissor[3]);
// current_model()->renderer()->get_lines_drawable("edges")->set_visible(true);
// draw();
// glScissor(scissor[0], scissor[1], scissor[2], scissor[3]);
// To have split views of different rendering styles for the same object/scene.
//glEnable(GL_SCISSOR_TEST);
//int scissor[4];
//glGetIntegerv(GL_SCISSOR_BOX, scissor);
//glScissor(scissor[0], scissor[1], scissor[2] * 0.5f, scissor[3]);
//current_model()->renderer()->get_lines_drawable("edges")->set_visible(false);
//Viewer::draw();
//glScissor(scissor[2] * 0.5f, scissor[1], scissor[2] * 0.5f, scissor[3]);
//current_model()->renderer()->get_lines_drawable("edges")->set_visible(true);
//Viewer::draw();
//glScissor(scissor[0], scissor[1], scissor[2], scissor[3]);

for (const auto m : models_) {
if (!m->renderer()->is_visible())
Expand Down
12 changes: 12 additions & 0 deletions tutorials/Tutorial_203_Viewer_wxWidgets/viewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -789,6 +789,18 @@ namespace easy3d {


void Viewer::draw() const {
// To have split views of different rendering styles for the same object/scene.
//glEnable(GL_SCISSOR_TEST);
//int scissor[4];
//glGetIntegerv(GL_SCISSOR_BOX, scissor);
//glScissor(scissor[0], scissor[1], scissor[2] * 0.5f, scissor[3]);
//current_model()->renderer()->get_lines_drawable("edges")->set_visible(false);
//Viewer::draw();
//glScissor(scissor[2] * 0.5f, scissor[1], scissor[2] * 0.5f, scissor[3]);
//current_model()->renderer()->get_lines_drawable("edges")->set_visible(true);
//Viewer::draw();
//glScissor(scissor[0], scissor[1], scissor[2], scissor[3]);

for (const auto m : models_) {
if (!m->renderer()->is_visible())
continue;
Expand Down
12 changes: 12 additions & 0 deletions tutorials/Tutorial_204_Viewer_Qt/viewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -984,6 +984,18 @@ namespace easy3d {


void Viewer::draw() {
// To have split views of different rendering styles for the same object/scene.
//glEnable(GL_SCISSOR_TEST);
//int scissor[4];
//glGetIntegerv(GL_SCISSOR_BOX, scissor);
//glScissor(scissor[0], scissor[1], scissor[2] * 0.5f, scissor[3]);
//current_model()->renderer()->get_lines_drawable("edges")->set_visible(false);
//Viewer::draw();
//glScissor(scissor[2] * 0.5f, scissor[1], scissor[2] * 0.5f, scissor[3]);
//current_model()->renderer()->get_lines_drawable("edges")->set_visible(true);
//Viewer::draw();
//glScissor(scissor[0], scissor[1], scissor[2], scissor[3]);

easy3d_debug_log_gl_error

for (const auto m: models_) {
Expand Down
2 changes: 1 addition & 1 deletion tutorials/Tutorial_307_CrossSection/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
get_filename_component(example ${CMAKE_CURRENT_SOURCE_DIR} NAME)
set(dependencies 3rd_imgui easy3d::core easy3d::renderer easy3d::viewer easy3d::util)
set(dependencies easy3d::core easy3d::renderer easy3d::viewer easy3d::util)

set(${example}_files
main.cpp
Expand Down

0 comments on commit 2641a75

Please sign in to comment.