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

2D plane that plays an animation by cycling through a sprite sheet texture More...

#include <imageSequenceLabel.h>

Inheritance diagram for copakond::ImageSequenceLabel:
copakond::Mesh copakond::Geometry copakond::ImageLabel

Public Member Functions

 ImageSequenceLabel (const std::string &imageSequencePath, int fps, int totalFrames, int imagesPerWidth, int imagesPerHeight)
 ImageSequenceLabel (const std::string &imageSequencePath, int fps, int totalFrames, int imagesPerWidth, int imagesPerHeight, std::shared_ptr< Material > material)
 ~ImageSequenceLabel () override
void init (GLuint shader) override
 Initializes OpenGL buffers (VAO, VBO) for the mesh.
void draw (float deltaTime) override
 Advances animation timer and triggers geometry regeneration if frame changes.
void pause ()
void unpause ()
void setFrame (int frame)
Public Member Functions inherited from copakond::Mesh
 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
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 _generateGeometry ()
 Recalculates UV mapping to display the current frame from the sprite sheet.
Protected Member Functions inherited from copakond::Mesh
void _SetId ()

Protected Attributes

int _frame = 0
float _frameTime = 0.0f
bool _paused = false
int _fps
int _totalFrames
int _imagesPerWidth
int _imagesPerHeight
std::vector< float > _uvs
std::vector< float > _normals
GLuint _vboUvs = 0
Protected Attributes inherited from copakond::Mesh
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

Additional Inherited Members

Static Protected Attributes inherited from copakond::Mesh
static int globalMeshCounter = 0

Detailed Description

2D plane that plays an animation by cycling through a sprite sheet texture

Constructor & Destructor Documentation

◆ ImageSequenceLabel() [1/2]

copakond::ImageSequenceLabel::ImageSequenceLabel ( const std::string & imageSequencePath,
int fps,
int totalFrames,
int imagesPerWidth,
int imagesPerHeight )

◆ ImageSequenceLabel() [2/2]

copakond::ImageSequenceLabel::ImageSequenceLabel ( const std::string & imageSequencePath,
int fps,
int totalFrames,
int imagesPerWidth,
int imagesPerHeight,
std::shared_ptr< Material > material )

◆ ~ImageSequenceLabel()

copakond::ImageSequenceLabel::~ImageSequenceLabel ( )
override

Member Function Documentation

◆ _generateGeometry()

void copakond::ImageSequenceLabel::_generateGeometry ( )
protected

Recalculates UV mapping to display the current frame from the sprite sheet.

◆ draw()

void copakond::ImageSequenceLabel::draw ( float deltaTime)
overridevirtual

Advances animation timer and triggers geometry regeneration if frame changes.

Reimplemented from copakond::Mesh.

◆ init()

void copakond::ImageSequenceLabel::init ( GLuint shader)
overridevirtual

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

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

Reimplemented from copakond::Mesh.

◆ pause()

void copakond::ImageSequenceLabel::pause ( )
inline

◆ setFrame()

void copakond::ImageSequenceLabel::setFrame ( int frame)
inline

◆ unpause()

void copakond::ImageSequenceLabel::unpause ( )
inline

Member Data Documentation

◆ _fps

int copakond::ImageSequenceLabel::_fps
protected

◆ _frame

int copakond::ImageSequenceLabel::_frame = 0
protected

Current animation frame index

◆ _frameTime

float copakond::ImageSequenceLabel::_frameTime = 0.0f
protected

Accumulated time since the last frame change

◆ _imagesPerHeight

int copakond::ImageSequenceLabel::_imagesPerHeight
protected

Rows in the sprite sheet

◆ _imagesPerWidth

int copakond::ImageSequenceLabel::_imagesPerWidth
protected

Columns in the sprite sheet

◆ _normals

std::vector<float> copakond::ImageSequenceLabel::_normals
protected

◆ _paused

bool copakond::ImageSequenceLabel::_paused = false
protected

◆ _totalFrames

int copakond::ImageSequenceLabel::_totalFrames
protected

◆ _uvs

std::vector<float> copakond::ImageSequenceLabel::_uvs
protected

◆ _vboUvs

GLuint copakond::ImageSequenceLabel::_vboUvs = 0
protected

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