|
Maya 1.0
|
A core widget for displaying objects. More...
#include <maya.h>
Public Slots | |
| void | paintGL () |
| Renders the scene. | |
| virtual void | mousePressEvent (QMouseEvent *) |
| Process mouse click events. | |
| virtual void | mouseReleaseEvent (QMouseEvent *) |
| Process the mouse release events. | |
| virtual void | mouseDoubleClickEvent (QMouseEvent *) |
| Process the mouse double click events. | |
| virtual void | mouseMoveEvent (QMouseEvent *) |
| Overloaded function to capture the mouse events. | |
| virtual void | wheelEvent (QWheelEvent *) |
| Overloaded function to capture the wheel events. | |
| virtual void | keyPressEvent (QKeyEvent *) |
| Key events. | |
| virtual void | keyReleaseEvent (QKeyEvent *) |
| This function has been overloaded mainly to enable and disable the display of the tool on the screen. | |
Public Member Functions | |
| MayaWidget (QWidget *=nullptr) | |
| Create a widget for real time rendering. | |
| ~MayaWidget () | |
| Release allocated resources. | |
| void | SetCamera (const Camera &) |
| Set the viewing camera. | |
| QVector< Camera > | GetCameras () const |
| Return the set of cameras. | |
| Camera | GetCamera () const |
| Get the camera. | |
| void | AddCamera () |
| Add the current camera to the set of reference cameras. | |
| void | DeleteCamera () |
| Remove the current camera from the set. | |
| void | ChangeCamera () |
| Charge une nouvelle position de la camera. | |
| void | SetPlanes (const double &, const double &) |
| Set the near and far planes. | |
| void | SetPlane (const Box2 &, const double &, const double &) |
| Change the parameter of the plane. | |
| void | SetLight (const Vector &) |
| Change the light position. | |
| void | SetAnchor (const Vector &) |
| Modify the anchor position. | |
| Ray | ConvertPixelToRay (const QPoint &) const |
| Convert a pixel on the screen of the viewport into a ray. | |
| Ray | ConvertPixelToRay (const QPoint &, int, int, int) const |
| Convert a pixel on the screen of the viewport into a ray, with anti-aliasing. | |
| void | SetWorld (const MayaGeometryAll &) |
| Set the geometry instances to be rendered. | |
| void | AppendWorld (const MayaGeometryAll &) |
| Append objects or instances to be rendered. | |
| void | ReplaceInWorld (const MayaGeometryAll &) |
| Replace instances to be rendered. | |
| void | ReplaceMaterialInWorld (MayaGeometryAll &) |
| Replace material of all instances. | |
| void | ClearWorld () |
| Clear all objects in the scene. | |
| void | SaveScreen (int=1280, int=720) |
| Capture the rendering viewport and save it to disk. | |
| void | SaveScreen (int, int, const QString &) |
| Capture the rendering viewport and save it to disk. | |
Static Public Member Functions | |
| static void GLAPIENTRY | OpenGLDebugMessageCallback (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *message, const void *=nullptr) |
| Custom callback for OpenGL message. | |
Static Public Attributes | |
| static bool | Verbose = true |
| Static flag for verbose output in the console (useful for OpenGL debugging) | |
| static GLenum | GLVerboseLevel = GL_DEBUG_SEVERITY_MEDIUM |
| OpenGL verbosity level. Everything below is ignored. | |
Protected Member Functions | |
| void | initializeGL () |
| Set up the rendering state. | |
| void | resizeGL (int, int) |
| Set up the OpenGL view port and matrix mode according to the size of the window. | |
| virtual void | UpdateAnchor (QMouseEvent *) |
| Update the position of the Anchor on the intersection between the ray (mouse direction and the plane). | |
| virtual void | RenderAnchor () |
| Render the focus point. | |
| virtual void | RenderLight () |
| Render the Light position. | |
| void | RenderBackGround () |
| Render the Background. | |
| void | RenderForeGround (QElapsedTimer) |
| Render the foreground. | |
| virtual void | InitGPU () |
| Initialize GPU information (camera, textures, shaders). | |
| void | InitProgram () |
| Initialize the program shader. | |
| void | InitCamera () |
| Initialize camera transforms. | |
| virtual void | InitAnchorShape () |
| Initialize anchor shape. | |
| virtual void | InitLightShape () |
| Initialize light shape. | |
| virtual void | InitSphereShape () |
| Initialize transparent sphere. | |
| void | InitTerrainTextures () |
| Initialize the terrain texture. | |
| void | InitEnvTextures () |
| Initialize skybox (envmap) textures. | |
| void | InitLight () |
| Set up the OpenGL Light rendering state. | |
| void | updateGPU () |
| Update the GPU parameters information (light, camera). | |
Protected Attributes | |
| MayaGpuAll | gpuall |
| Instances for storing the objects on the GPU. | |
| MayaGpuSet | anchor |
| Internal instance for drawing the anchor point. | |
| MayaGpuSet | lightshape |
| Light shape. | |
| MayaGpuSet | sphereshape |
| Transparent sphere. | |
| Camera | camera |
| Current camera. | |
| int | y0 |
| Reference mouse coordinates. | |
| bool | useCamera |
| Boolean flags. | |
| MayaPlane | plane |
| Horizontal plane. | |
| Vector | ancre = Vector::Null |
| Focus point. | |
| Vector | light |
| Light point. | |
| GpuParameter | gpuparam |
| Set of parameters defining the way objects are rendered. | |
| MayaShader * | gpubackground = nullptr |
| Program used to draw background;. | |
| GLuint | backgroundVAO |
| VAO used when drawing the background. | |
| MayaCameraSet | cameras |
| Set of cameras. | |
A core widget for displaying objects.
This class implements a widget for displaying geometric objects.
| MayaWidget::MayaWidget | ( | QWidget * | parent = nullptr | ) |
Create a widget for real time rendering.
| parent | Parent widget. |
References camera, gpuall, gpubackground, light, Vector::Null, and useCamera.
| void MayaWidget::AppendWorld | ( | const MayaGeometryAll & | mga | ) |
| Ray MayaWidget::ConvertPixelToRay | ( | const QPoint & | pixel | ) | const |
Convert a pixel on the screen of the viewport into a ray.
This function relies on the camera model to compute the ray.
| pixel | The pixel coordinates. |
References camera.
Referenced by UpdateAnchor().
| Ray MayaWidget::ConvertPixelToRay | ( | const QPoint & | pixel, |
| int | a, | ||
| int | x, | ||
| int | y ) const |
Convert a pixel on the screen of the viewport into a ray, with anti-aliasing.
| pixel | The pixel coordinates |
| a | Anti-aliasing. |
| x,y | Integer coordinates of the sub-pixel. |
References camera.
|
protected |
|
virtualslot |
Key events.
Left and right keys: move sideway.
Up and down keys: move back and forth.
L : show light A : show anchor P : show plane
| e | Key events. |
References AddCamera(), camera, ChangeCamera(), DeleteCamera(), SaveScreen(), and useCamera.
|
virtualslot |
This function has been overloaded mainly to enable and disable the display of the tool on the screen.
| e | Key events. |
|
virtualslot |
|
virtualslot |
Overloaded function to capture the mouse events.
This function implements controls.
| e | Mouse move events. |
References camera, UpdateAnchor(), and y0.
|
virtualslot |
|
virtualslot |
Process the mouse release events.
| e | Events. |
|
static |
Custom callback for OpenGL message.
| source | |
| type | |
| id | |
| severity | |
| length | |
| message | |
| userParam |
References GLVerboseLevel.
Referenced by initializeGL().
|
slot |
Renders the scene.
The s for drawing the scene are performed here.
References camera, gpuall, gpuparam, plane, RenderAnchor(), RenderBackGround(), RenderForeGround(), RenderLight(), and updateGPU().
|
protected |
Render the foreground.
| t | Time. |
References camera, MayaStatistics::GetInstances(), MayaStatistics::GetInstancesTriangles(), MayaStatistics::GetInstancesVertices(), MayaStatistics::GetObjects(), MayaStatistics::GetObjectsTriangles(), MayaStatistics::GetObjectsVertices(), gpuall, and useCamera.
Referenced by paintGL().
| void MayaWidget::ReplaceInWorld | ( | const MayaGeometryAll & | mga | ) |
| void MayaWidget::ReplaceMaterialInWorld | ( | MayaGeometryAll & | mga | ) |
|
protected |
Set up the OpenGL view port and matrix mode according to the size of the window.
| w,h | Width and height of the window. |
References camera, and Math::RadianToDegree().
| void MayaWidget::SaveScreen | ( | int | w, |
| int | h, | ||
| const QString & | url ) |
Capture the rendering viewport and save it to disk.
| w | width of the image |
| h | height of the image |
| url | url and name of the exported file |
| void MayaWidget::SetAnchor | ( | const Vector & | v | ) |
Modify the anchor position.
Tha anchor is not rendered if is out of the plane.
| v | Position of the anchor |
References ancre.
Referenced by UpdateAnchor().
| void MayaWidget::SetCamera | ( | const Camera & | c | ) |
| void MayaWidget::SetLight | ( | const Vector & | p | ) |
| void MayaWidget::SetPlane | ( | const Box2 & | box, |
| const double & | h, | ||
| const double & | l ) |
Change the parameter of the plane.
It updates the MayaWidget view.
| box | Rectangle. |
| h | Height of the plane. |
| l | Space between lines. |
References plane.
| void MayaWidget::SetPlanes | ( | const double & | n, |
| const double & | f ) |
Set the near and far planes.
This function modifies the current camera. It updates the MayaWidget view.
| n,f | Near and far planes distance. |
References camera.
| void MayaWidget::SetWorld | ( | const MayaGeometryAll & | mga | ) |
Set the geometry instances to be rendered.
| mga | Set of geometry instances. |
References gpuall.
|
protectedvirtual |
Update the position of the Anchor on the intersection between the ray (mouse direction and the plane).
| e | Mouse event. |
References ConvertPixelToRay(), plane, and SetAnchor().
Referenced by mouseMoveEvent().
|
virtualslot |
|
static |
Static flag for verbose output in the console (useful for OpenGL debugging)
< Static flag for verbose output in the console (useful for OpenGL debugging)
OpenGL verbosity level. Everything below is ignored.
Referenced by initializeGL().