diff --git a/tutorials/Tutorial_203_Viewer_wxWidgets/application.h b/tutorials/Tutorial_203_Viewer_wxWidgets/application.h index 2d72112a..2bb81a3a 100644 --- a/tutorials/Tutorial_203_Viewer_wxWidgets/application.h +++ b/tutorials/Tutorial_203_Viewer_wxWidgets/application.h @@ -31,7 +31,6 @@ namespace easy3d { - class AppImpl; class Application { public: explicit Application(const std::string &title = "Untitled", int width = 800, int height = 600); diff --git a/tutorials/Tutorial_406_CollisionDetection/main.cpp b/tutorials/Tutorial_406_CollisionDetection/main.cpp index 6a292e3c..2ea36a95 100644 --- a/tutorials/Tutorial_406_CollisionDetection/main.cpp +++ b/tutorials/Tutorial_406_CollisionDetection/main.cpp @@ -35,7 +35,7 @@ int main(int argc, char **argv) { // initialize Easy3D. initialize(); - CollisionViewer viewer(EXAMPLE_TITLE); + TutorialCollisionDetection viewer(EXAMPLE_TITLE); // run the viewer return viewer.run(); diff --git a/tutorials/Tutorial_406_CollisionDetection/viewer.cpp b/tutorials/Tutorial_406_CollisionDetection/viewer.cpp index 215b816f..eef9e7df 100644 --- a/tutorials/Tutorial_406_CollisionDetection/viewer.cpp +++ b/tutorials/Tutorial_406_CollisionDetection/viewer.cpp @@ -35,7 +35,7 @@ using namespace easy3d; -CollisionViewer::CollisionViewer(const std::string &title) +TutorialCollisionDetection::TutorialCollisionDetection(const std::string &title) : Viewer(title) , model0_color_(0.8f, 1.0f, 0.8f) , model1_color_(0.8f, 0.8f, 1.0f) @@ -48,9 +48,11 @@ CollisionViewer::CollisionViewer(const std::string &title) // use the manipulator to transform the first model (visualization only and geometry is not changed) mesh0->set_manipulator(new Manipulator(mesh0)); + // the first mesh is colored by a "face_color" property mesh0->add_face_property("face_color", model0_color_); mesh0->renderer()->get_triangles_drawable("faces")->set_coloring(easy3d::State::COLOR_PROPERTY, easy3d::State::FACE, "face_color"); + // the second mesh is also colored by a "face_color" property mesh1->add_face_property("face_color", model1_color_); mesh1->renderer()->get_triangles_drawable("faces")->set_coloring(easy3d::State::COLOR_PROPERTY, easy3d::State::FACE, "face_color"); @@ -69,7 +71,7 @@ CollisionViewer::CollisionViewer(const std::string &title) }); } else - LOG(WARNING) << "not all two meshe models have been loaded"; + LOG(WARNING) << "not all the two meshes have been loaded"; usage_string_ = "--------------------- Collision Viewer usage ----------------------\n" @@ -83,13 +85,13 @@ CollisionViewer::CollisionViewer(const std::string &title) } -CollisionViewer::~CollisionViewer() { +TutorialCollisionDetection::~TutorialCollisionDetection() { timer_.stop(); delete collider_; } -bool CollisionViewer::mouse_drag_event(int x, int y, int dx, int dy, int button, int modifiers) { +bool TutorialCollisionDetection::mouse_drag_event(int x, int y, int dx, int dy, int button, int modifiers) { if (collider_ && models().size() == 2 && modifiers == MODIF_ALT && timer_.is_paused()) { auto manipulator = models_[0]->manipulator(); if (button == BUTTON_LEFT) @@ -107,7 +109,7 @@ bool CollisionViewer::mouse_drag_event(int x, int y, int dx, int dy, int button, } -bool CollisionViewer::key_press_event(int key, int modifiers) { +bool TutorialCollisionDetection::key_press_event(int key, int modifiers) { if (key == KEY_SPACE) { if (timer_.is_paused()) timer_.resume(); @@ -120,12 +122,12 @@ bool CollisionViewer::key_press_event(int key, int modifiers) { } -void CollisionViewer::detect() { +void TutorialCollisionDetection::detect() { const auto pairs = collider_->detect(models_[0]->manipulator()->matrix(), mat4::identity()); //std::cout << pairs.size() << " pairs of intersecting faces" << std::endl; // mark the intersecting faces red - // Note: The following code is for visualizing the intersecting faces, and the code is not optimized. + // Note: The following code is for visualizing the intersecting faces and is not optimized. // Ideas for better performance: // (1) update only the color buffer; // (2) use a shader storage buffer to transfer the *status* of the faces to the fragment shader. diff --git a/tutorials/Tutorial_406_CollisionDetection/viewer.h b/tutorials/Tutorial_406_CollisionDetection/viewer.h index 80c43807..e1cb4547 100644 --- a/tutorials/Tutorial_406_CollisionDetection/viewer.h +++ b/tutorials/Tutorial_406_CollisionDetection/viewer.h @@ -24,8 +24,8 @@ * along with this program. If not, see . ********************************************************************/ -#ifndef EASY3D_TUTORIAL_COLLISION_DETECTION_VIEWER_H -#define EASY3D_TUTORIAL_COLLISION_DETECTION_VIEWER_H +#ifndef EASY3D_TUTORIAL_COLLISION_DETECTION_H +#define EASY3D_TUTORIAL_COLLISION_DETECTION_H #include #include @@ -37,10 +37,10 @@ namespace easy3d { class Collider; } -class CollisionViewer : public easy3d::Viewer { +class TutorialCollisionDetection : public easy3d::Viewer { public: - explicit CollisionViewer(const std::string &title); - ~CollisionViewer() override; + explicit TutorialCollisionDetection(const std::string &title); + ~TutorialCollisionDetection() override; private: bool mouse_drag_event(int x, int y, int dx, int dy, int button, int modifiers) override; @@ -58,4 +58,4 @@ class CollisionViewer : public easy3d::Viewer { }; -#endif // EASY3D_TUTORIAL_COLLISION_DETECTION_VIEWER_H +#endif // EASY3D_TUTORIAL_COLLISION_DETECTION_H diff --git a/tutorials/Tutorial_702_Cloud_SurfaceReconstruction/main.cpp b/tutorials/Tutorial_702_Cloud_SurfaceReconstruction/main.cpp index 23c962ab..48855beb 100644 --- a/tutorials/Tutorial_702_Cloud_SurfaceReconstruction/main.cpp +++ b/tutorials/Tutorial_702_Cloud_SurfaceReconstruction/main.cpp @@ -48,7 +48,7 @@ bool reconstruction(Viewer* viewer, Model* model) { if (!normals) { std::cerr << "Poisson surface reconstruction method requires normal information." << " Please provide normal information. Alternatively, you can use the " - << " Tutorial_601_PointCloud_NormalEstimation for normal estimation" << std::endl; + << " Tutorial_701_Cloud_NormalEstimation for normal estimation" << std::endl; return false; }