GPU Splatting
1.0
A deffered render that draws the surface of point cloud data.
|
The main class of the renderer - the action is here! More...
#include <Vis2Application.h>
Inherits GLFWApplication.
Public Member Functions | |
Vis2Application (int width, int height, int ctx_major, int ctx_minor) | |
Creates a new instance with the given parameters. More... | |
void | init () override |
Initializes all the OpenGL buffers and loads the bunny-model. More... | |
void | update () override |
Does nothing so far. | |
void | render () override |
Renders the scene. More... | |
void | resize (int width, int height) override |
Reallocates the textures to fit the new screen size. | |
void | initUI () override |
Initializes the AntTweakBar. | |
void | renderUI () override |
Renders the AntTweakBar. | |
void | loadModel (const std::string model_path) |
Loads the specified model. More... | |
void | setModel (Models model) |
Sets the active model. | |
Models | getModel () |
Returns the active model. | |
Public Member Functions inherited from GLFWApplication | |
GLFWApplication (int width, int height, int ctx_major, int ctx_minor) | |
Creates a new instance with the given parameters. More... | |
void | run () |
This method starts the update-render-loop and returns if the window has been closed. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from GLFWApplication | |
GLFWwindow * | getWindow () |
Returns the GLFW-window-handle. | |
int | getWidth () |
Returns the width of the window. | |
int | getHeight () |
Returns the height of the window. | |
float | getFrameTime () |
Returns the duration of the last frame in seconds. | |
float | getAbsTime () |
double | getMouseX () |
Returns the X-position of the mouse in the window. | |
double | getMouseY () |
Returns the Y-position of the mouse in the window. | |
double | getMouseDx () |
Returns the difference in X-position of the mouse since last frame. | |
double | getMouseDy () |
Returns the difference in Y-position of the mouse since last frame. | |
The main class of the renderer - the action is here!
This class inherits from GLFWApplication and implements all its hooks. This is the heart of the renderer - it is capeable of loading and rendering point cloud data.
Vis2Application::Vis2Application | ( | int | width, |
int | height, | ||
int | ctx_major, | ||
int | ctx_minor | ||
) |
Creates a new instance with the given parameters.
width | the initial width of the window |
height | the initial height of the window |
ctx_major | the requested major version of OpenGL |
ctx_minor | the requested minor version of OpenGL |
|
overridevirtual |
Initializes all the OpenGL buffers and loads the bunny-model.
Creates all the buffers needed for storing our point-cloud.
It will also create all the textures needed and attach them to the appropriate Framebuffers.
Finally all shaders are compiled and linked to programs. Then it is time to load the default model - the bunny.
Implements GLFWApplication.
void Vis2Application::loadModel | ( | const std::string | model_path | ) |
Loads the specified model.
Reads the vertex-data from the file and stores it in memory. It then computes an KD-Tree for the positions.
For each point the 8 closest neighbours are queried and used to compute the eigenvectors and eigenvalues of the current point. With this information at hand one can compute the splat-axes.
Finally all the data is written to the array-buffer of the model.
|
overridevirtual |
Renders the scene.
First the view and model matrix are computed.
In the first pass(Depth-Pass) all points are rendered into the attached depth-buffer. This is necessary to prevent Vertices that are behind the surface from beeing rendered and create a weird transperency-effect.
In the second Pass(Attribute-Pass) all vertices that are visible will be drawn onto the G-Buffer that consists of 3 textures for color, normals and the accumulated weight. This pass will only use a custom depth-test, because it blends ovelapping splats together.
In the third and final pass(Shading-Pass) the scene is drawn onto a full-screen-quad. It uses the accumulated values from the previous pass to compute shading of the object. We uses the phong-lighting model for our program.
Implements GLFWApplication.