#include <plugin.h>
Public Member Functions | |
| Plugin () | |
| virtual | ~Plugin () |
| virtual void | onPluginLoad () |
| virtual void | onObjectAdd () |
| virtual void | onSceneClear () |
| virtual void | preFrame () |
| virtual void | postFrame () |
| virtual void | keyPressEvent (QKeyEvent *) |
| virtual void | keyReleaseEvent (QKeyEvent *) |
| virtual void | mouseMoveEvent (QMouseEvent *) |
| virtual void | mousePressEvent (QMouseEvent *) |
| virtual void | mouseReleaseEvent (QMouseEvent *) |
| virtual void | wheelEvent (QWheelEvent *) |
| virtual bool | paintGL () |
| virtual bool | drawScene () |
| virtual bool | drawObject (int) |
| Scene * | scene () |
| Camera * | camera () |
| Plugin * | drawPlugin () |
| GLWidget * | glwidget () |
| void | setWidget (GLWidget *glwidget) |
| void | setDrawPlugin (Plugin *drawPlugin) |
| void | setArgs (const string &str) |
| string | args () const |
/class Plugin /brief The Plugin class is the base class for all plugins.
All plugins you will have to implement must derive from this class.
All methods have a default implementation (do nothing), so each plugin can override only those methods needed to provide the intended functionality.
An Effect Plugin might override preFrame() and postFrame() methods to modify the OpenGL state before and after the scene is rendered (for example, to load shaders or to enable alphablending) and to draw additional content (for example, the frame rate).
A Draw Plugin might override the drawScene() method, which is in charge of drawing all the objects forming the scene by issuing OpenGL rendering commands.
An Action Plugin might override user input methods such as keyPressEvent(), mouseMoveEvent() to allow for some interaction: camera control, object selection...
A Render Plugin should override paintGL(). The main purpose is to implement techniques requiring multiple rendering passes, for example, shadow mapping.
|
inline |
Constructs a basic plugin.
|
inlinevirtual |
Destroys the plugin.
|
inline |
Returns a pointer to the Camera.
|
inlinevirtual |
Draws the i-th object in the scene
|
inline |
Returns a pointer to a plugin implementing drawScene(). If no such a plugin has been loaded, returns null.
|
inlinevirtual |
This method is intended to be involked by any plugin willing to draw the scene. For example, a plugin overriding paintGL(). If you override drawScene(), you must always return true so that the application knows the scene has been drawn successfully. The GLWidget class keeps track of the plugin overriding this method. Using legacy code, a minimal implementation could be:
|
inline |
Returns a pointer to the GLWidget.
|
inlinevirtual |
See the QOpenGLWidget reference.
|
inlinevirtual |
See the QOpenGLWidget reference.
|
inlinevirtual |
See the QOpenGLWidget reference.
|
inlinevirtual |
See the QOpenGLWidget reference.
|
inlinevirtual |
See the QOpenGLWidget reference.
|
inlinevirtual |
This method is called everytime a new object is added to the scene. This allows your plugin to execute some code everytime the scene has changed.
|
inlinevirtual |
This method is called right after the plugin has been loaded by the application. A valid OpenGL context allways exists when this method is invoked. This method usually has code for initializing the plugin: compile shaders, load textures, setup timers... The scene might contain some objects but it could also be empty.
|
inlinevirtual |
This method is called everytime the scene is cleared (all objects are removed). This allows your plugin to execute some code everytime the scene has been cleared.
|
inlinevirtual |
This method is invoked by GLWidget::paintGL(). It is responsible of painting everything whenever the widget needs to be painted. A minimal implementation should call glClear and then invoke the drawScene() method of the current Draw Plugin :
If you override paintGL(), you must always return true so that the application knows it has been repainted successfully.
|
inlinevirtual |
This method is called in GLWidget::paintGL() after drawing the scene. This allows your plugin to execute some code to be executed right after the scene is rendered. A typical use would be to unbind a shader, or drawing additional primitives (for example, the frame rate or a wireframe box around the selected object).
|
inlinevirtual |
This method is called in GLWidget::paintGL() before drawing the scene. This allows your plugin to execute some code to be executed right before the scene is rendered. A typical use would be to bind a shader affecting the whole scene. Notice that glClear() is likely to be called after all preFrame() methods have been executed, so you should not draw anything here. For drawing additional primitives override the postFrame() method instead.
|
inline |
Returns a pointer to the Scene.
|
inlinevirtual |
See the QOpenGLWidget reference.