Wrath of Zeus
Made by Torchlight Games for CSE 125 SP24
Loading...
Searching...
No Matches
Public Member Functions
Model Class Reference

#include <model.hpp>

Inheritance diagram for Model:
Renderable

Public Member Functions

 Model (const std::string &filepath, bool flip_uvs)
 
void draw (Shader *shader, glm::vec3 camPos, bool fill) override
 
void draw (Shader *shader, glm::vec3 camPos, bool fill, glm::vec3 color)
 
void translateAbsolute (const glm::vec3 &new_pos) override
 
void translateRelative (const glm::vec3 &delta) override
 
virtual void scaleAbsolute (const float &new_factor) override
 
virtual void scaleAbsolute (const glm::vec3 &scale) override
 
void scaleRelative (const float &new_factor) override
 
void scaleRelative (const glm::vec3 &scale) override
 
void rotateAbsolute (const glm::vec3 &dir, bool is_player=false, const glm::vec3 &axis=glm::vec3(0.0f, 1.0f, 0.0f)) override
 Rotates the item along the specified axis. If no axis is specified, then assumes a rotation on the y-axis. This will not stack upon previous rotations. More...
 
void rotateAbsolute (const float &angle, const glm::vec3 &axis=glm::vec3(0.0f, 1.0f, 0.0f)) override
 Rotates the item along the specified axis. If no axis is specified, then assumes a rotation on the y-axis. This will not stack upon previous rotations. More...
 
void rotateRelative (const glm::vec3 &dir, const glm::vec3 &axis=glm::vec3(0.0f, 1.0f, 0.0f)) override
 Rotates the item along the specified axis. If no axis is specified, then assumes a rotation on the y-axis. This will stack upon previous rotations. More...
 
void clear () override
 
void clearScale () override
 
void clearPosition () override
 
glm::vec3 getDimensions ()
 
void setDimensions (const glm::vec3 &dimensions)
 
void overrideSolidColor (std::optional< glm::vec3 > color)
 
auto & getBoneInfoMap ()
 
int & getBoneCount ()
 
- Public Member Functions inherited from Renderable
 Renderable ()
 
virtual void draw (Shader *shader, glm::vec3 camPos, bool fill)=0
 
virtual void translateAbsolute (const glm::vec3 &new_pos)
 
virtual void translateRelative (const glm::vec3 &delta)
 
virtual void scaleAbsolute (const float &new_factor)
 
virtual void scaleAbsolute (const glm::vec3 &scale)
 
virtual void scaleRelative (const float &new_factor)
 
virtual void scaleRelative (const glm::vec3 &scale)
 
virtual void rotateAbsolute (const glm::vec3 &dir, bool is_player=false, const glm::vec3 &axis=glm::vec3(0.0f, 1.0f, 0.0f))
 Rotates the item along the specified axis. If no axis is specified, then assumes a rotation on the y-axis. This will not stack upon previous rotations. More...
 
virtual void rotateAbsolute (const float &angle, const glm::vec3 &axis=glm::vec3(0.0f, 1.0f, 0.0f))
 Rotates the item along the specified axis. If no axis is specified, then assumes a rotation on the y-axis. This will not stack upon previous rotations. More...
 
virtual void rotateRelative (const glm::vec3 &dir, const glm::vec3 &axis=glm::vec3(0.0f, 1.0f, 0.0f))
 Rotates the item along the specified axis. If no axis is specified, then assumes a rotation on the y-axis. This will stack upon previous rotations. More...
 
glm::mat4 getModelMat ()
 
virtual void clear ()
 
virtual void clearScale ()
 
virtual void clearPosition ()
 

Constructor & Destructor Documentation

◆ Model()

Model::Model ( const std::string &  filepath,
bool  flip_uvs 
)
explicit

Loads Model from a given filename. Can be of format .obj, .blend or any of the formats that assimp supports

See also
https://assimp-docs.readthedocs.io/en/latest/about/introduction.html?highlight=obj#introduction
Parameters
Filepathto model file.

Member Function Documentation

◆ clear()

void Model::clear ( )
overridevirtual

Clear transformations and reset the model matrix to the identity.

Reimplemented from Renderable.

◆ clearPosition()

void Model::clearPosition ( )
overridevirtual

Reset translation to position (0, 0, 0)

Reimplemented from Renderable.

◆ clearScale()

void Model::clearScale ( )
overridevirtual

Reset scale factors in each dimension to 1.0

Reimplemented from Renderable.

◆ draw() [1/2]

void Model::draw ( Shader shader,
glm::vec3  camPos,
bool  fill 
)
overridevirtual

Draws all the meshes of a given model

Parameters
Shaderto use while drawing all the meshes of the model

Implements Renderable.

◆ draw() [2/2]

void Model::draw ( Shader shader,
glm::vec3  camPos,
bool  fill,
glm::vec3  color 
)

Draws all the meshes of a given model

Parameters
Shaderto use while drawing all the meshes of the model

◆ getBoneCount()

int & Model::getBoneCount ( )
inline

◆ getBoneInfoMap()

auto & Model::getBoneInfoMap ( )
inline

◆ getDimensions()

glm::vec3 Model::getDimensions ( )

Queries the dimensions of a bounding box around the model.

Returns
a vec3 where each dimension represents the size in that dimension

◆ overrideSolidColor()

void Model::overrideSolidColor ( std::optional< glm::vec3 >  color)

◆ rotateAbsolute() [1/2]

void Model::rotateAbsolute ( const float &  angle,
const glm::vec3 &  axis = glm::vec3(0.0f, 1.0f, 0.0f) 
)
overridevirtual

Rotates the item along the specified axis. If no axis is specified, then assumes a rotation on the y-axis. This will not stack upon previous rotations.

Parameters
angleThe angle of rotation
axisThe axis of rotation

Reimplemented from Renderable.

◆ rotateAbsolute() [2/2]

void Model::rotateAbsolute ( const glm::vec3 &  dir,
bool  is_player = false,
const glm::vec3 &  axis = glm::vec3(0.0f, 1.0f, 0.0f) 
)
overridevirtual

Rotates the item along the specified axis. If no axis is specified, then assumes a rotation on the y-axis. This will not stack upon previous rotations.

Parameters
angleThe angle of rotation
axisThe axis of rotation

Reimplemented from Renderable.

◆ rotateRelative()

void Model::rotateRelative ( const glm::vec3 &  dir,
const glm::vec3 &  axis = glm::vec3(0.0f, 1.0f, 0.0f) 
)
overridevirtual

Rotates the item along the specified axis. If no axis is specified, then assumes a rotation on the y-axis. This will stack upon previous rotations.

Parameters
angleThe angle of rotation
axisThe axis of rotation

Reimplemented from Renderable.

◆ scaleAbsolute() [1/2]

void Model::scaleAbsolute ( const float &  new_factor)
overridevirtual

Scale the Model across all axes (x,y,z) by a factor. This will not stack up on top of any previous scaling.

Parameters
new_factordescribes how much to scale the model by. Ex: setting it to 0.5 will cut the model's rendered size
in half.

Reimplemented from Renderable.

◆ scaleAbsolute() [2/2]

void Model::scaleAbsolute ( const glm::vec3 &  scale)
overridevirtual

Scale the item across all axes (x,y,z) by the scale factor in each axis. This will not stack up on top of any previous scaling.

Parameters
thescale vector describes how much to independently scale the item in each axis (x, y, z)

Reimplemented from Renderable.

◆ scaleRelative() [1/2]

void Model::scaleRelative ( const float &  new_factor)
overridevirtual

Scale the Model across all axes (x,y,z) by a factor. This will stack up on top of any previous scaling.

Parameters
new_factordescribes how much to scale the model by. Ex: setting it to 0.5 will cut the model's rendered size
in half.

Reimplemented from Renderable.

◆ scaleRelative() [2/2]

void Model::scaleRelative ( const glm::vec3 &  scale)
overridevirtual

Scale the item across all axes (x,y,z) by the scale factor in each axis. This will stack up on top of any previous scaling.

Parameters
thescale vector describes how much to independently scale the model in each axis (x, y, z)

Reimplemented from Renderable.

◆ setDimensions()

void Model::setDimensions ( const glm::vec3 &  dimensions)

Set dimensions by scaling the model accordingly

Parameters
avec3 where each dimension represents the size in that dimension

◆ translateAbsolute()

void Model::translateAbsolute ( const glm::vec3 &  new_pos)
overridevirtual

Sets the position of the Model to the given x,y,z values

Parameters
vectorof x, y, z of the model's new position

Reimplemented from Renderable.

◆ translateRelative()

void Model::translateRelative ( const glm::vec3 &  delta)
overridevirtual

Updates the position of the Model relative to it's previous position

Parameters
vectorof x, y, z of the change in the Model's position

Reimplemented from Renderable.


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