27#include <easy3d/renderer/camera.h>
28#include <easy3d/util/resource.h>
29#include <easy3d/util/initializer.h>
30#include <easy3d/util/timer.h>
37int test_cross_section(
int duration) {
38 CrossSection viewer(
"CrossSection");
39 viewer.camera()->setViewDirection(
vec3(-1, 1, -1));
41 const std::string file_name = resource::directory() +
"/data/bunny.ply";
42 if (!viewer.add_model(file_name)) {
43 LOG(ERROR) <<
"failed to load model. Please make sure the file exists and format is correct.";
47 viewer.set_usage(
"testing cross section...");
A light-weight implementation of the timer mechanism.
Definition: timer.h:49
The built-in Easy3D viewer.
Definition: viewer.h:61
Definition: collider.cpp:182
28#include <easy3d/renderer/clipping_plane.h>
29#include <easy3d/renderer/manipulated_frame.h>
30#include <easy3d/renderer/manipulator.h>
35 CrossSection::CrossSection(
const std::string &title) : Viewer(title) {
40 CrossSection::~CrossSection() {
45 void CrossSection::post_draw() {
52 bool CrossSection::mouse_drag_event(
int x,
int y,
int dx,
int dy,
int button,
int modifiers) {
55 if (pressed_button_ == BUTTON_LEFT)
56 frame->
action_rotate(x, y, dx, dy, camera_, ManipulatedFrame::NONE);
57 else if (pressed_button_ == BUTTON_RIGHT)
58 frame->action_translate(x, y, dx, dy, camera_, ManipulatedFrame::NONE);
60 return Viewer::mouse_drag_event(x, y, dx, dy, button, modifiers);
static ClippingPlane * instance()
Definition: clipping_plane.cpp:61
virtual Manipulator * manipulator()
returns the manipulator attached to the clipping plane.
Definition: clipping_plane.h:106
void draw(Camera *cam) const
draws the clipping plane itself.
Definition: clipping_plane.cpp:132
void set_enabled(bool b)
enables/disables the clipping plane.
Definition: clipping_plane.h:56
virtual void action_rotate(int mouse_x, int mouse_y, int mouse_dx, int mouse_dy, Camera *camera, ScreenAxis axis)
Definition: manipulated_frame.cpp:113
ManipulatedFrame * frame()
Returns the manipulated frame.
Definition: manipulator.h:73