-
Notifications
You must be signed in to change notification settings - Fork 0
Point Cloud Manager
The section called core is "a must to have" if you want to use any of the other sections. It creates a GUI window and handles all events suchlike, mouse, keyboard and touch. Inside this class you will find a Camera
object which you can handle and perform movements in the screen.
Type | Code |
---|---|
Header | #include "core.h" |
Returns | Member |
---|---|
void |
camera_isometric_view() |
const Algebraica::mat4f& |
camera_matrix_perspective() |
const Algebraica::mat4f& |
camera_matrix_perspective_view() |
const Algebraica::mat4f& |
camera_matrix_static_perspective_view() |
const Algebraica::mat4f& |
camera_matrix_view() |
const Algebraica::vec3f& |
camera_position(const float pitch = 0.0f, const float yaw = 0.0f, const float roll = 0.0f ) |
void |
camera_rotate(const float pitch = 0.0f, const float yaw = 0.0f, const float roll = 0.0f ) |
void |
camera_set_position(const float x = -12.0f, const float y = 0.0f, const float z = 5.0f ) |
void |
camera_set_target(const float x = 0.0f, const float y = 0.0f, const float z = 0.0f ) |
void |
camera_set_up(const float x = 0.0f, const float y = 0.0f, const float z = 1.0f ) |
void |
camera_set_zoom(const float zoom = 1.0f ) |
void |
camera_top_view() |
void |
camera_translate(const float x = 0.0f, const float y = 0.0f, const float z = 0.0f ) |
int |
execute(const bool infinite_loop = true ) |
int |
execute(const bool infinite_loop = true, const int width, const int height, const std::string title = "Torero",
const bool full_screen = true, const bool maximized = false ) |
const Algebraica::mat4f* |
fixed_frame() |
void |
full_screen(const bool make_full = true ) |
const GLfloat |
max_anisotropic_filtering() |
void |
maximize_window(const bool maximized = true ) |
void |
message_handler(const std::string text, const Visualizer::Message message_type ) |
void |
minimize_window(const bool minimized = true ) |
const Algebraica::mat4f* |
navigation_frame() |
void |
process_pending_events() |
void |
redraw_screen() |
void |
restart_viewport() |
void |
set_window_position(const int x, const int y ) |
void |
set_window_size(const int width, const int height ) |
void |
set_window_title(const std::string title ) |
void |
swap_buffers() |
const Algebraica::mat4f* |
vehicle_frame() |
void |
wait_for_events() |
void |
wait_for_events(const double timeout ) |
bool |
window_closing() |
bool |
window_visibility() |
Type | Name |
---|---|
boost::signals2::signal* |
signal_updated_camera() |
boost::signals2::signal* |
signal_updated_screen() |
boost::signals2::signal* |
syncronize(Visualizer::Order object ) |
To change the window title (which appears at the bar in the top side of the window) use:
void set_window_title(const std::string title);
Arguments
Type | Name | Description |
---|---|---|
[std::string ] |
title | The UTF-8 encoded window title. |
Errors
This will return error if the window was not created properly.
This function changes the size of the window, use negative values to equalize window and monitor width or/and height. For full screen windows, the specified size becomes the new resolution of the window. The window is resized to fit the resolution of the set video mode.
void set_window_size(const int width, const int height);
Arguments
Type | Name | Description |
---|---|---|
[const int ] |
width | Size in pixels of the window. Use any negative value to set the window's width equal to the monitor's resolution. |
[const int ] |
height | Size in pixels of the window. Use any negative value to set the window's height equal to the monitor's resolution. |
Errors
This will return error if the window was not created properly.
Changes the window's position in screen, The origin of the coordinate system is at the top-left corner of the monitor.
void set_window_position(const int x, const int y);
Arguments
Type | Name | Description |
---|---|---|
[const int ] |
x | Position from the left side of the monitor in pixels. |
[const int ] |
y | Position from the top side of the monitor in pixels |
Errors
This will return error if the window was not created properly.
Maximizes to fit all the monitor or resizes back the window to its defined width and height.
void maximize_window(const bool maximized = true);
Arguments
Type | Name | Description |
---|---|---|
[const bool ] |
maximized | Set this to true to maximize or false to restore the window size back to width and height . |
Errors
This will return error if the window was not created properly.
Minimizes the window or resizes it back to its defined width and height.
void minimize_window(const bool minimized = true);
Arguments
Type | Name | Description |
---|---|---|
[const bool ] |
minimized | Set this to true to minimize or false to restore the window size back to width and height . |
Errors
This will return error if the window was not created properly.
Makes the window full screen or resizes back the window to its defined width and height. This will hide the title and launcher bar.
void full_screen(const bool make_full = true);
Arguments
Type | Name | Description |
---|---|---|
[const bool ] |
make_full | Set this to true to make full screen or false to restore the window size back to width and height . |
Errors
This will return error if the window was not created properly.
Redraws the whole window's screen, if you have updated data that have not been drawn in screen you could call this function. *Note: try to call this function only when is really needed because is a big performance consumer, a better practice is to draw every element separately.
void redraw_screen();
Errors
This will return error if the window was not created properly.
This function restarts the screen viewport to its original aspect radio; defined when you defined the window's width and height or uses its pre-defined values.
void restart_viewport();
Errors
This will return error if the window was not created properly.
The next four functions are very useful and give the program enough time to redraw the screen, if you are using an infinite loop to execute your program, then, you will need to call swap_buffers()
and one of other functions at least 30 times per second to have a fluid animation.
This function restarts the screen viewport to its original aspect radio; defined when you defined the window's width and height or uses its pre-defined values.
void swap_buffers();
Errors
This will return error if the window was not created properly.
Waits until an event is triggered (mouse, keyboard, etc). This will pause the program's execution until an event is triggered.
void wait_for_events();
Errors
This will return error if the window was not created properly.
Waits until an event is triggered (mouse, keyboard, etc) or until the timeout (in seconds) has passed. This will pause the program's execution until an event is triggered or the time is over.
void wait_for_events(const double timeout);
Arguments
Type | Name | Description |
---|---|---|
[const double ] |
timeout | Waiting time in seconds, use decimals for more precision. |
Errors
This will return error if the window was not created properly.
This function processes all pending events suchlike screen drawing without any waiting.
void process_pending_events();
Errors
This will return error if the window was not created properly.
This function returns the window's visibility; true
if is not minimized or false
if is minimized.
void window_visibility();
Returns
[bool
] | true
if is not minimized or false
if is minimized.
Errors
This will return error if the window was not created properly.
This function returns if the window is closing (which may not close the program execution), if you are utilizing an infinite loop, this function will be very useful to break that loop and also close the program.
void window_closing();
Returns
[bool
] | Returns true
if is closed/closing or false
if is open.
Errors
This will return error if the window was not created properly.
This is the main function; it will open a new window with predefined properties or properties defined by the user suchlike, width, height, title, etc. If infinite_loop = true
then, it will maintain the window open until a close event is triggered.
int execute(const bool infinite_loop = true);
Arguments
Type | Name | Description |
---|---|---|
[const bool ] |
infinite_loop | if set to true it will maintain the window open until close event. |
Errors
This will return the type of error if the window was not created properly; EXIT_SUCCESS
, GLFW_NOT_LOADED
, WINDOW_NOT_LOADED
, GLAD_NOT_LOADED
or EXISTING_WINDOW
.
Width and height represent the window resolution, if full_screen
is true
then, your screen resolution will change, to have the native resolution of your system, set width and height to zero, also, if width and height is equal to zero and full_screen
is false
then, width and height will change to initial values: 1500 and 800 respectively.
int execute(const bool infinite_loop = true, const int width, const int height,
const std::string title = "Torero", const bool full_screen = true,
const bool maximized = false
Arguments
Type | Name | Description |
---|---|---|
[const bool ] |
infinite_loop | if set to true it will maintain the window open until close event. |
[const int ] |
width | Window's width in pixels. |
[const int ] |
height | Window's height in pixels. |
[const std::string ] |
title | The UTF-8 encoded window's title. |
[const bool ] |
full_screen | if set to true it will make the window full screen. |
[const bool ] |
maximized | if set to true it will maximize the window, ignored if full_screen = true . |
Errors
This will return the type of error if the window was not created properly; EXIT_SUCCESS
, GLFW_NOT_LOADED
, WINDOW_NOT_LOADED
, GLAD_NOT_LOADED
or EXISTING_WINDOW
.
This functions return the maximum anisotropic filtering than your computer could handle, it is very useful when defining your own textures.
int max_anisotropic_filtering();
Returns
[const bool
] | Returns the maximum anisotropic filtering value or 8.0f if is bigger.
Errors
This will return error if the window was not created properly.
Changes the position of the camera, note that is only the location of the camera, the point that the camera is aiming will not be modified.
void camera_set_position(const float x = -12.0f, const float y = 0.0f, const float z = 5.0f);
Arguments
Type | Name | Description |
---|---|---|
[const float ] |
x | Position in meters in the X axis. |
[const float ] |
y | Position in meters in the Y axis. |
[const float ] |
z | Position in meters in the Z axis. |
Errors
This will return error if the window was not created properly.
This specifies the point which the camera is looking.
void camera_set_target(const float x = 0.0f, const float y = 0.0f, const float z = 0.0f);
Arguments
Type | Name | Description |
---|---|---|
[const float ] |
x | Position in meters in the X axis. |
[const float ] |
y | Position in meters in the Y axis. |
[const float ] |
z | Position in meters in the Z axis. |
Errors
This will return error if the window was not created properly.
Changes the rotation of the camera, changes the upward side of the camera. You must introduce the coordinates of a normalized vector, this vector represents the camera orientation, by default is pointing up parallel to Y axis.
void camera_set_up(const float x = 0.0f, const float y = 0.0f, const float z = 1.0f);
Arguments
Type | Name | Description |
---|---|---|
[const float ] |
x | Position in meters in the X axis, must be normalized. |
[const float ] |
y | Position in meters in the Y axis, must be normalized. |
[const float ] |
z | Position in meters in the Z axis, must be normalized. |
Errors
This will return error if the window was not created properly.
Multiplies the Camera position by a rotation matrix using euler angles (the center is the camera target's position), the angles are in RADIANS.
void camera_rotate(const float pitch = 0.0f, const float yaw = 0.0f, const float roll = 0.0f);
Arguments
Type | Name | Description |
---|---|---|
[const float ] |
pitch | Pitch angle in radians. |
[const float ] |
yaw | Yaw angle in radians. |
[const float ] |
roll | Roll angle in radians. |
Errors
This will return error if the window was not created properly.
Multiplies the Camera position by a translation matrix (the center is the camera target's position).
void camera_translate(const float x = 0.0f, const float y = 0.0f, const float z = 0.0f);
Arguments
Type | Name | Description |
---|---|---|
[const float ] |
x | Distance in X axis to translate. |
[const float ] |
y | Distance in Y axis to translate. |
[const float ] |
z | Distance in Z axis to translate. |
Errors
This will return error if the window was not created properly.
This changes the scenary zoom, maximum = 0.05 : minimum = 15. The smaller the zoom factor is, the closer to the target the camera position becomes.
void camera_set_zoom(const float zoom = 1.0f);
Arguments
Type | Name | Description |
---|---|---|
[const float ] |
zoom | Zoom factor, if zoom = 0.05 then, the camera position vector is multiplied for 0.05 |
Errors
This will return error if the window was not created properly.
Changes the view to Top view.
void camera_top_view();
Errors
This will return error if the window was not created properly.
Changes the view to Isometric view.
void camera_isometric_view();
Errors
This will return error if the window was not created properly.
Returns the view transformation matrix, this matrix is calculated using look at matrix transformation with the camera as parameter.
const Algebraica::mat4f &camera_matrix_view();
Returns
[const Algebraica::mat4f&
] | Returns the 4x4 transformation matrix of the camera.
Errors
This will return error if the window was not created properly.
Returns the perspective transformation matrix, this matrix is calculated using perspective matrix transformation with window's width and height as parameters to get the aspect radio. A near plane with value NEAR_PLANE
, far plane with value FAR_PLANE
and field of view with value FIELD_OF_VIEW
.
const Algebraica::mat4f &camera_matrix_perspective();
Returns
[const Algebraica::mat4f&
] | Returns the 4x4 view projection matrix (perspective view).
Errors
This will return error if the window was not created properly.
Returns the multiplied matrix between perspective and view transformation matrices.
const Algebraica::mat4f &camera_matrix_perspective_view();
Returns
[const Algebraica::mat4f&
] | Returns the resulting 4x4 matrix of the projection and camera matrices multiplication.
Errors
This will return error if the window was not created properly.
Returns the non-translated multiplied matrix between perspective and view transformation matrices. *Note: this matrix only contains the rotations of pv_matrix and not translations.
const Algebraica::mat4f &camera_matrix_static_perspective_view();
Returns
[const Algebraica::mat4f&
] | Returns the resulting 4x4 matrix of the projection and camera matrices multiplication WITHOUT translation (only rotation).
Errors
This will return error if the window was not created properly.
This function returns a 3D vector with the camera position in X, Y and Z.
const Algebraica::vec3f &camera_position();
Returns
[const Algebraica::vec3f&
] | 3D vector with camera position.
Errors
This will return error if the window was not created properly.
This function returns the address to the fixed frame transformation matrix, its origins is the Latitude and Longitude 0° (see coordinate system for more information).
const Algebraica::mat4f *fixed_frame();
Returns
[const Algebraica::mat4f *const
] | Address to the fixed frame transformation matrix.
Errors
This will return error if the window was not created properly.
This function returns the address to the vehicle frame transformation matrix, its origins is at the center of the rear wheel axis (see coordinate system for more information).
const Algebraica::mat4f *vehicle_frame();
Returns
[const Algebraica::mat4f *const
] | Address to the vehicle frame transformation matrix.
Errors
This will return error if the window was not created properly.
This function returns the address to the navigation frame transformation matrix, its origins is at the center of the rear wheel axis but it does NOT rotate (see coordinate system for more information).
const Algebraica::mat4f *navigation_frame();
Returns
[const Algebraica::mat4f *const
] | Address to the navigation frame transformation matrix.
Errors
This will return error if the window was not created properly.
This signal is triggered every time the camera is modified, for example: rotation, translation, zoom, etc. You can obtain the address to this signal by using the following function, to manage such connection is recommended to use boost::signals2::connection
to connect or disconnect it from your own functions.
boost::signals2::signal<void ()> *signal_updated_camera();
Errors
This will return error if the window was not created properly.
This signal is triggered every time the OpenGL screen is redrawn; every time you see a change in the window's screen this signal will be triggered. You can obtain the address to this signal by using the following function, to manage such connection is recommended to use boost::signals2::connection
to connect or disconnect it from your own functions.
boost::signals2::signal<void ()> *signal_updated_screen();
Errors
This will return error if the window was not created properly.
This functions returns a signal using the enumerator Visualizer::Order
, use it to connect it to your own functions. This signal is triggered when the class manager with name equal to this enumerator is drawn in screen.
boost::signals2::signal<void ()> *signal_updated_camera();
Arguments
Type | Name | Description |
---|---|---|
[enum Visualizer::Order ] |
object | Class manager name. |
Errors
This will return error if the window was not created properly.
- Introduction
- Installation guide
- Coordinate systems
-
Core
- List of all public members
- List of all public signals
- Window management
-
Camera management
- Setting camera position
- Setting camera target position
- Setting camera upwards direction
- Rotating the camera
- Translating the camera
- Setting camera's zoom
- Change view to top view
- Change view to isometric view
- Obtaining the view transformation matrix
- Obtaining the perspective transformation matrix
- Obtaining the multiplied matrix between perspective and view matrices
- Obtaining the non-translated multiplied matrix between perspective and view matrices
- Obtaining the camera position
- Scene's frame matrices
- Public signals