![]() |
Number5
Visualisierung 2 Project - Florian Schober (0828151, f.schober@live.com), Andreas Walch (0926780, walch.andreas89@gmail.com)
|
#include <SimpleMesh.hpp>
Public Member Functions | |
template<typename t_fnc > | |
SimpleMesh (Application *app, string const &name, t_fnc fnc) | |
~SimpleMesh () | |
void | drawAllInstances (DrawArgs &args, Shader *shader) |
SimpleMeshInstance * | createInstance (bool pickable=true) |
void | unregisterInstance (SimpleMeshInstance *obj) |
Private Member Functions | |
void | create () |
Private Attributes | |
Application * | m_app |
string | m_name |
vector< vec3 > | m_positions |
vector< vec2 > | m_uvs |
vector< vec3 > | m_normals |
vector< uint > | m_indices |
GLuint | m_positionsBuffer |
GLuint | m_uvBuffer |
GLuint | m_normalsBuffer |
GLuint | m_indicesBuffer |
GLuint | m_vao |
set< SimpleMeshInstance * > | m_instances |
SimpleMesh represents a simple mesh that consists of positions, normals, uvs, indices. It manages a list of its instances. Only registered instances will be drawn. All instances will be created, accessed, rendered and destructed by this object.
Definition at line 74 of file SimpleMesh.hpp.
|
inline |
Constructs a SimpleMesh-object.
app | The global application |
name | The name of the mesh |
fnc | A function that takes pointers to a vector of positions, normals, uvs and indicses and fills them |
Definition at line 101 of file SimpleMesh.hpp.
~SimpleMesh | ( | ) |
Destructs the objects
Definition at line 84 of file SimpleMesh.cpp.
|
private |
Creates all OpenGL resoures from the temporary vectors.
Definition at line 37 of file SimpleMesh.cpp.
SimpleMeshInstance * createInstance | ( | bool | pickable = true | ) |
Creates an instance of this object and returns it.
pickable | If pickable is true this object will be drawn into the id-buffer to make it visible to the picker. |
Definition at line 105 of file SimpleMesh.cpp.
Draws all managed instances of this object.
args | The DrawArgs that should be used for this rendering |
shader | The shader that should be used for this rendering |
Definition at line 92 of file SimpleMesh.cpp.
void unregisterInstance | ( | SimpleMeshInstance * | obj | ) |
Unregisteres an instance. This is usually called by the instances destructor. To destruct an instance just call delete on it.
obj | The instance which should no longer be managed |
Definition at line 114 of file SimpleMesh.cpp.
|
private |
The global appliaction
Definition at line 76 of file SimpleMesh.hpp.
|
private |
A vector containing the indices of all vertices
Definition at line 83 of file SimpleMesh.hpp.
|
private |
A OpenGL-buffer containing the indices of all vertices
Definition at line 88 of file SimpleMesh.hpp.
|
private |
All instances managed by this object
Definition at line 91 of file SimpleMesh.hpp.
|
private |
The name of the mesh
Definition at line 78 of file SimpleMesh.hpp.
|
private |
A vector containing the normals of all vertices
Definition at line 82 of file SimpleMesh.hpp.
|
private |
A OpenGL-buffer containing the normals of all vertices
Definition at line 87 of file SimpleMesh.hpp.
|
private |
A vector containing the positions of all vertices
Definition at line 80 of file SimpleMesh.hpp.
|
private |
A OpenGL-buffer containing the positions of all vertices
Definition at line 85 of file SimpleMesh.hpp.
|
private |
A OpenGL-buffer containing the uvs of all vertices
Definition at line 86 of file SimpleMesh.hpp.
|
private |
A vector containing the uvs of all vertices
Definition at line 81 of file SimpleMesh.hpp.
|
private |
The OpenGL-VAO for this mesh
Definition at line 89 of file SimpleMesh.hpp.