Number5
Visualisierung 2 Project - Florian Schober (0828151, f.schober@live.com), Andreas Walch (0926780, walch.andreas89@gmail.com)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Private Member Functions | Private Attributes | List of all members
SimpleMesh Class Reference

#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)
 
SimpleMeshInstancecreateInstance (bool pickable=true)
 
void unregisterInstance (SimpleMeshInstance *obj)
 

Private Member Functions

void create ()
 

Private Attributes

Applicationm_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
 

Detailed Description

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.

Constructor & Destructor Documentation

SimpleMesh ( Application app,
string const &  name,
t_fnc  fnc 
)
inline

Constructs a SimpleMesh-object.

Parameters
appThe global application
nameThe name of the mesh
fncA 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.

Member Function Documentation

void create ( )
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.

Parameters
pickableIf pickable is true this object will be drawn into the id-buffer to make it visible to the picker.
Returns
The created instance.

Definition at line 105 of file SimpleMesh.cpp.

void drawAllInstances ( DrawArgs args,
Shader shader 
)

Draws all managed instances of this object.

Parameters
argsThe DrawArgs that should be used for this rendering
shaderThe 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.

Parameters
objThe instance which should no longer be managed

Definition at line 114 of file SimpleMesh.cpp.

Member Data Documentation

Application* m_app
private

The global appliaction

Definition at line 76 of file SimpleMesh.hpp.

vector<uint> m_indices
private

A vector containing the indices of all vertices

Definition at line 83 of file SimpleMesh.hpp.

GLuint m_indicesBuffer
private

A OpenGL-buffer containing the indices of all vertices

Definition at line 88 of file SimpleMesh.hpp.

set<SimpleMeshInstance*> m_instances
private

All instances managed by this object

Definition at line 91 of file SimpleMesh.hpp.

string m_name
private

The name of the mesh

Definition at line 78 of file SimpleMesh.hpp.

vector<vec3> m_normals
private

A vector containing the normals of all vertices

Definition at line 82 of file SimpleMesh.hpp.

GLuint m_normalsBuffer
private

A OpenGL-buffer containing the normals of all vertices

Definition at line 87 of file SimpleMesh.hpp.

vector<vec3> m_positions
private

A vector containing the positions of all vertices

Definition at line 80 of file SimpleMesh.hpp.

GLuint m_positionsBuffer
private

A OpenGL-buffer containing the positions of all vertices

Definition at line 85 of file SimpleMesh.hpp.

GLuint m_uvBuffer
private

A OpenGL-buffer containing the uvs of all vertices

Definition at line 86 of file SimpleMesh.hpp.

vector<vec2> m_uvs
private

A vector containing the uvs of all vertices

Definition at line 81 of file SimpleMesh.hpp.

GLuint m_vao
private

The OpenGL-VAO for this mesh

Definition at line 89 of file SimpleMesh.hpp.


The documentation for this class was generated from the following files: