PGR Copakond OpenGL Engine - Bowling
Loading...
Searching...
No Matches
copakond::Mesh Class Reference

Base drawable 3D object containing geometry and material data. More...

#include <mesh.h>

Inheritance diagram for copakond::Mesh:
copakond::Geometry copakond::CollisionShape copakond::ImageMoving copakond::ImageSequenceLabel copakond::ObjMesh copakond::Skybox copakond::TextLabel copakond::CollisionBox copakond::CollisionSphere copakond::ImageLabel copakond::RigidBody copakond::CollisionPin copakond::RigidSphere

Public Member Functions

 Mesh ()
 Mesh (const glm::vec3 &position)
 Mesh (const glm::vec3 &position, const glm::vec3 &rotation)
 Mesh (const glm::vec3 &position, const glm::vec3 &rotation, const glm::vec3 &scale)
virtual ~Mesh ()
void setVertices (const std::vector< float > &vertices)
void setMaterial (const std::shared_ptr< Material > &material)
 Applies a material to the entire mesh and all its submeshes.
const std::vector< SubMesh > & getSubMeshes () const
std::shared_ptr< MaterialgetMaterial ()
GLuint getVao () const
GLsizei getNumVertices () const
virtual void init (GLuint shader)
 Initializes OpenGL buffers (VAO, VBO) for the mesh.
virtual void draw (float deltaTime)
int getId () const
void setVertexWave (bool isVertexWave)
bool isVertexWave () const
void hide ()
void show ()
void setVisible (bool visible)
bool isVisible () const
Public Member Functions inherited from copakond::Geometry
 Geometry ()
 Geometry (const glm::vec3 &position)
 Geometry (const glm::vec3 &position, const glm::vec3 &rotation)
 Geometry (const glm::vec3 &position, const glm::vec3 &rotation, const glm::vec3 &scale)
virtual ~Geometry ()
virtual void setPosition (const glm::vec3 &position)
virtual void setRotation (const glm::vec3 &rotation)
virtual void setScale (const glm::vec3 &scale)
virtual void setRotationDegrees (const glm::vec3 &rotationDegrees)
glm::mat4 getRotationXMatrix () const
glm::mat4 getRotationYMatrix () const
glm::mat4 getRotationZMatrix () const
glm::mat4 getPositionMatrix () const
glm::mat4 getRotationMatrix () const
glm::mat4 getScaleMatrix () const
glm::mat4 getModelMatrix () const
 Calculates local transformation matrix.
glm::mat4 getWorldPositionMatrix () const
glm::mat4 getWorldRotationMatrix () const
glm::mat4 getWorldScaleMatrix () const
glm::mat4 getWorldModelMatrix () const
 Calculates global transformation matrix by multiplying all ancestor matrices.
glm::vec3 getPosition () const
glm::vec3 getRotation () const
glm::vec3 getScale () const
glm::vec3 getRotationDegrees () const
glm::vec3 getWorldPosition () const
glm::vec3 getWorldRotation () const
glm::vec3 getWorldScale () const
glm::vec3 & position ()
glm::vec3 & rotation ()
glm::vec3 & scale ()
glm::vec3 worldPosition () const
glm::vec3 worldRotation () const
glm::vec3 worldScale () const
bool setParent (Geometry *newParent)
 Attaches this object to a new parent in the scene graph.
GeometrygetParent () const
std::vector< Geometry * > getChildren () const

Protected Member Functions

void _SetId ()

Protected Attributes

int id
int _isVertexWave = false
bool _visible = true
GLuint _shaderProgram = 0
GLuint _vboVertices = 0
GLuint _vboNormals = 0
GLuint _vao = 0
GLsizei _numVertices = 0
std::vector< float > _vertices = std::vector<float>()
std::shared_ptr< Material_material = std::make_shared<Material>()
std::vector< SubMesh_subMeshes
Protected Attributes inherited from copakond::Geometry
Geometryparent = nullptr
std::vector< Geometry * > children
glm::vec3 _position
glm::vec3 _rotation
glm::vec3 _scale

Static Protected Attributes

static int globalMeshCounter = 0

Detailed Description

Base drawable 3D object containing geometry and material data.

Constructor & Destructor Documentation

◆ Mesh() [1/4]

copakond::Mesh::Mesh ( )

◆ Mesh() [2/4]

copakond::Mesh::Mesh ( const glm::vec3 & position)

◆ Mesh() [3/4]

copakond::Mesh::Mesh ( const glm::vec3 & position,
const glm::vec3 & rotation )

◆ Mesh() [4/4]

copakond::Mesh::Mesh ( const glm::vec3 & position,
const glm::vec3 & rotation,
const glm::vec3 & scale )

◆ ~Mesh()

copakond::Mesh::~Mesh ( )
virtual

Member Function Documentation

◆ _SetId()

void copakond::Mesh::_SetId ( )
protected

◆ draw()

void copakond::Mesh::draw ( float deltaTime)
virtual

◆ getId()

int copakond::Mesh::getId ( ) const
inline

◆ getMaterial()

std::shared_ptr< Material > copakond::Mesh::getMaterial ( )

◆ getNumVertices()

GLsizei copakond::Mesh::getNumVertices ( ) const
inline

◆ getSubMeshes()

const std::vector< SubMesh > & copakond::Mesh::getSubMeshes ( ) const
inline

◆ getVao()

GLuint copakond::Mesh::getVao ( ) const
inline

◆ hide()

void copakond::Mesh::hide ( )
inline

◆ init()

void copakond::Mesh::init ( GLuint shader)
virtual

Initializes OpenGL buffers (VAO, VBO) for the mesh.

Parameters
shaderThe compiled shader program ID used to get attribute locations.

Reimplemented in copakond::CollisionBox, copakond::CollisionSphere, copakond::ImageMoving, copakond::ImageSequenceLabel, copakond::ObjMesh, and copakond::TextLabel.

◆ isVertexWave()

bool copakond::Mesh::isVertexWave ( ) const
inline

◆ isVisible()

bool copakond::Mesh::isVisible ( ) const
inline

◆ setMaterial()

void copakond::Mesh::setMaterial ( const std::shared_ptr< Material > & material)

Applies a material to the entire mesh and all its submeshes.

◆ setVertexWave()

void copakond::Mesh::setVertexWave ( bool isVertexWave)
inline

◆ setVertices()

void copakond::Mesh::setVertices ( const std::vector< float > & vertices)

◆ setVisible()

void copakond::Mesh::setVisible ( bool visible)
inline

◆ show()

void copakond::Mesh::show ( )
inline

Member Data Documentation

◆ _isVertexWave

int copakond::Mesh::_isVertexWave = false
protected

Flag for procedural vertex animation in shader

◆ _material

std::shared_ptr<Material> copakond::Mesh::_material = std::make_shared<Material>()
protected

◆ _numVertices

GLsizei copakond::Mesh::_numVertices = 0
protected

◆ _shaderProgram

GLuint copakond::Mesh::_shaderProgram = 0
protected

◆ _subMeshes

std::vector<SubMesh> copakond::Mesh::_subMeshes
protected

◆ _vao

GLuint copakond::Mesh::_vao = 0
protected

◆ _vboNormals

GLuint copakond::Mesh::_vboNormals = 0
protected

◆ _vboVertices

GLuint copakond::Mesh::_vboVertices = 0
protected

◆ _vertices

std::vector<float> copakond::Mesh::_vertices = std::vector<float>()
protected

◆ _visible

bool copakond::Mesh::_visible = true
protected

◆ globalMeshCounter

int copakond::Mesh::globalMeshCounter = 0
staticprotected

Used to generate unique IDs for stencil buffer picking

◆ id

int copakond::Mesh::id
protected

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