-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Gsoc2024 basic viewer glfw tgrillon #8444
base: master
Are you sure you want to change the base?
Gsoc2024 basic viewer glfw tgrillon #8444
Conversation
- Object rotation using quaternions - Object translation (with keys and mouse) - Zoom in/out - Reset camera (lctrl + r) - Center camera (right double click)
(new) Installation/cmake/modules/CGAL_setupCGAL_GLFWDependencies.cmake : - setup dependancies and target for GLFW (with glad and stb_image) -> work in progress - build GLFW GLAD libs and link them to the target (modif) Installation/lib/cmake/CGAL/CGALConfig.cmake : - creation of new targets : CGAL_Basic_viewer_Qt and CGAL_Basic_viewer_GLFW
…/cgal-public-dev into gsoc2024-basic_viewer_glfw-tgrillon
This commit add the free-fly type camera which can be toggle pressing [LCTRL+V]. - [left mouse button] : rotate the camera orientation - [scroll] : zoom - [UP DOWN LEFT RIGHT] : move up/down/left/right - [LSHIFT+UP LSHIFT+DOWN] : move forward/backward Here some additional fixtures : - Fixing the FOV modification. Now the FOV can be increased/decreased using [LCTRL+SCROLL] - Smooth camera translation/rotation/zoom, smooth factors can be inc/dec : - ['+/-' numpad] : inc/dec rotation smooth factor - [LCTRL+'+/-' numpad] : inc/dec translation smooth factor - [LCTRL+scroll] : inc/dec zoom smooth factor - Align camera orientation to nearest axis [mouse double left click] - All change can be reset [LCTRL+R]
- Improvement of align-to-nearest-axis system - Rework of Line_renderer to avoid multiple calls to glDraw function - Now, we use Line_renderer to render the clipping plane Things that need to be done : - Rework the load_scene method to only reload the required buffers, not all of them.
A class Clipping_plane is used to manage the computation of rotation and translation and to return the 4x4 transformation matrix used as Model in ModelViewProjection Matrix. The implementation that follows is similar to the camera's transformation implementation. Clipping plane interactions : - Rotate using [LCTRL+LEFT MOUSE BUTTON] - Translate using [LCTRL+RIGHT MOUSE BUTTON] - Translate along camera forward direction using [LCTRL+MOUSE WHEEL] - Translate along clipping plane normal vector using [LCTRL+SCROLL]
- Save keyframe using [LALT+F1] - Run/Stop the animation using [F1] Still work to be done.
However this controller can be triggered and used only if you are using the orbiter-type camera.
+ Refactoring of Input.h file + New file 'key_code.h' is use to define key code macros based on glfw3.h file : I chose to use the same key codes as glfw because lots of them are based on ASCII code which ease int/char conversion. + The right key mapping can be achieved by setting a keyboard layout with set_keyboard_layout(Keyboard Layout: AZERTY). + upgrade of 'Terminal Help' with sections and application state informations like FPS, translation/rotation speed, light color...
- Remove key_code.h because it's useless. We direclty use CGLFW macros for key codes. + Shortcuts modifications to match Basic viewer Qt's ones + Adding position/direction/center to basic viewer setter methods, allowing user to set camera position/orientation and focus point.
…he camera orientation by providing forward direction and up angle
…llon/cgal into gsoc2024-basic_viewer_glfw-tgrillon
We have to remove the files of |
The idea is maybe to ship these files in cgal to simplify user life avoiding installing many external libraries; this is maybe possible because the files are small. Of course, this will be discussed and validated with Laurent, Sébastien, ... |
#ifndef CGAL_BASIC_VIEWER_QT_H | ||
#define CGAL_BASIC_VIEWER_QT_H |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you not mind, our guidelines recommend CGAL_QT_BASIC_VIEWER
(to follow the order of "words" in the header file path.
Summary of Changes
GLFW Basic viewer
Features
The main addition of this pull request is a new basic viewer based on GLFW. Its purpose is to provide the same features as the Qt viewer while using a lighter API.
Here is a summary of the main features that both viewers offer:
Camera features
up
,right
andforward
axis).Clipping plane features
CLIPPING_PLANE_OFF
: Disables the clipping plane.CLIPPING_PLANE_SOLID_HALF_TRANSPARENT_HALF
: Renders half of the clipped object as solid and half as transparent.CLIPPING_PLANE_SOLID_HALF_WIRE_HALF
: Renders half of the clipped object as solid and half with wireframe.CLIPPING_PLANE_SOLID_HALF_ONLY
: Only renders the positive side of the clipped object.up
andright
axis).Scene features
edges
/vertices
/faces
/lines
/rays
/mesh triangles
.Feature only in GLFW viewer
make_screenshot(...)
: Takes a screenshot of the scene without displaying the window. Setters are available to tweak scene parameters (check <week 5: 15 July - 21 July> on the wiki page). An example of this feature is provided here.Check out the wiki page where some of these features are presented.
Documentation
A file that provide documentation for public methods of the basic viewer class has been added in
Basic_viewer/doc/Basic_viewer/CGAL/GLFW
.Project structure
All GLFW viewer components are located in
Basic_viewer/include/CGAL/GLFW
, with the following folders/files:internal
: Headers where classes used by the viewer are declared and implemented, such asCamera
,ClippingPlane
,Input
, etc.vendor
: Contains the dependencies described in the next section.Basic_viewer_impl.h
: Contains the implementations of the basic viewer methods (this file is included inBasic_viewer.h
).Basic_viewer.h
: Basic viewer class declaration.bv_settings.h
: Settings file containing tweakable viewer parameters such as window height and width, window samples, size of vertices/edges, etc.Dependencies and build system
Here are the libraries used for this viewer:
The two viewers requires
CGAL_Qt6
orCGAL_GLFW
depending on which basic viewer the user wants to use. If both components are used, the Qt viewer will be the default. The viewers are only available if the macrosCGAL_USE_BASIC_VIEWER
/CGAL_USE_BASIC_VIEWER_QT
(Qt viewer) orCGAL_USE_BASIC_VIEWER_GLFW
(GLFW viewer) are defined.The file CGAL_SetupCGAL_GLFWDependencies.cmake was added to manage GLFW/GLAD compilation and library linkage.
In CGALConfig.cmake, two new targets are generated:
CGAL::CGAL_Basic_viewer_Qt
: target to which the Qt library will be linked.CGAL::CGAL_Basic_viewer_GLFW
: target to which the GLFW/GLAD libraries will be linked.Note: Previously, only one target was defined for the Qt viewer:
CGAL::CGAL_Basic_viewer
. This target has not been removed yet. For the Qt viewer, both ofCGAL::CGAL_Basic_viewer_Qt
andCGAL::CGAL_Basic_viewer
work.CGAL::CGAL_Basic_viewer
/CGAL::CGAL_Basic_viewer_Qt
will link withCGAL_Qt6
and add the definitionCGAL_USE_BASIC_VIEWER
/CGAL_USE_BASIC_VIEWER_QT
.CGAL::CGAL_Basic_viewer_GLFW
will link withCGAL_GLFW
and add the definitionCGAL_USE_BASIC_VIEWER_GLFW
.Qt viewer fixes
Some fixes and improvements have been made to the Qt viewer:
glLineWidth
method).TODO
CGAL::CGAL_Basic_viewer
target andCGAL_USE_BASIC_VIEWER
(?) (for @lrineau)