ComputerGraphik TU WIEN
Public Member Functions | Static Public Member Functions | Private Types | Private Attributes | List of all members
Model Class Reference

Encapsulates a graphical object model in the GPU. More...

#include <model.hpp>

Public Member Functions

 Model (const std::vector< float > &positions, const std::vector< unsigned int > &indices, const std::vector< unsigned int > &adjacentIndices, const std::vector< float > &normals, const std::vector< float > &uvs, Texture *texture=0)
 
 ~Model ()
 
GLuint getPosition () const
 
GLuint getNormals () const
 
GLuint getIndices () const
 
GLuint getIndicesAdj () const
 
GLuint getUVs () const
 
size_t getIndexCount () const
 
size_t getIndexAdjCount () const
 
TexturegetTexture () const
 
float getShininess () const
 
glm::vec4 getDiffuse () const
 
glm::vec4 getAmbient () const
 
glm::vec4 getSpecular () const
 
void setShininess (float val)
 
void setTexture (Texture *val)
 
void setDiffuse (const glm::vec4 &val)
 
void setAmbient (const glm::vec4 &val)
 
void setSpecular (const glm::vec4 &val)
 

Static Public Member Functions

static void getTerrainModel (size_t width, size_t height, size_t bitPerPixel, float cellSize, std::vector< unsigned char > &data, std::vector< float > &heights, std::vector< float > &positions, std::vector< unsigned int > &indices, std::vector< float > &normals, std::vector< float > &uvs)
 
static void getCubeModel (std::vector< float > &positions, std::vector< unsigned int > &indices, std::vector< float > &normals, std::vector< float > &uvs)
 
static void getQuadModel (std::vector< float > &positions, std::vector< unsigned int > &indices, std::vector< float > &uvs, float width, float height)
 
static void getSphereModel (std::vector< float > &positions, std::vector< unsigned int > &indices, std::vector< float > &normals, std::vector< float > &uvs)
 
static void loadModels (const std::string &modelPath, std::vector< std::unique_ptr< Model > > &models)
 

Private Types

enum  {
  VBO_POSITIONS = 0, VBO_NORMALS = 1, VBO_INDICES = 2, VBO_UVS = 3,
  VBO_ADJ_INDICES = 4, VBO_COUNT = 5
}
 

Private Attributes

GLuint vbo [VBO_COUNT]
 
size_t indexCount
 
size_t indexAdjCount
 
Texturetexture
 
float shininess
 
glm::vec4 diffuse
 
glm::vec4 ambient
 
glm::vec4 specular
 

Detailed Description

Encapsulates a graphical object model in the GPU.

Member Enumeration Documentation

anonymous enum
private
Enumerator
VBO_POSITIONS 
VBO_NORMALS 
VBO_INDICES 
VBO_UVS 
VBO_ADJ_INDICES 
VBO_COUNT 

Constructor & Destructor Documentation

Model::Model ( const std::vector< float > &  positions,
const std::vector< unsigned int > &  indices,
const std::vector< unsigned int > &  adjacentIndices,
const std::vector< float > &  normals,
const std::vector< float > &  uvs,
Texture texture = 0 
)
Model::~Model ( )

Member Function Documentation

glm::vec4 Model::getAmbient ( ) const
inline
void Model::getCubeModel ( std::vector< float > &  positions,
std::vector< unsigned int > &  indices,
std::vector< float > &  normals,
std::vector< float > &  uvs 
)
static
glm::vec4 Model::getDiffuse ( ) const
inline
size_t Model::getIndexAdjCount ( ) const
inline
size_t Model::getIndexCount ( ) const
inline
GLuint Model::getIndices ( ) const
inline
GLuint Model::getIndicesAdj ( ) const
inline
GLuint Model::getNormals ( ) const
inline
GLuint Model::getPosition ( ) const
inline
void Model::getQuadModel ( std::vector< float > &  positions,
std::vector< unsigned int > &  indices,
std::vector< float > &  uvs,
float  width,
float  height 
)
static
float Model::getShininess ( ) const
inline
glm::vec4 Model::getSpecular ( ) const
inline
void Model::getSphereModel ( std::vector< float > &  positions,
std::vector< unsigned int > &  indices,
std::vector< float > &  normals,
std::vector< float > &  uvs 
)
static
void Model::getTerrainModel ( size_t  width,
size_t  height,
size_t  bitPerPixel,
float  cellSize,
std::vector< unsigned char > &  data,
std::vector< float > &  heights,
std::vector< float > &  positions,
std::vector< unsigned int > &  indices,
std::vector< float > &  normals,
std::vector< float > &  uvs 
)
static
Texture* Model::getTexture ( ) const
inline
GLuint Model::getUVs ( ) const
inline
void Model::loadModels ( const std::string &  modelPath,
std::vector< std::unique_ptr< Model > > &  models 
)
static
void Model::setAmbient ( const glm::vec4 &  val)
inline
void Model::setDiffuse ( const glm::vec4 &  val)
inline
void Model::setShininess ( float  val)
inline
void Model::setSpecular ( const glm::vec4 &  val)
inline
void Model::setTexture ( Texture val)
inline

Member Data Documentation

glm::vec4 Model::ambient
private
glm::vec4 Model::diffuse
private
size_t Model::indexAdjCount
private
size_t Model::indexCount
private
float Model::shininess
private
glm::vec4 Model::specular
private
Texture* Model::texture
private
GLuint Model::vbo[VBO_COUNT]
private

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