A 3D model. It can be loaded from a WavefrontFile or GlbFile. It can also be constructed procedurally by code, by inserting values to the appropriate member variables.
More...
#include <Model.hpp>
|
|
| Model () |
| | Default constructor.
|
| |
| | Model (File &file, const std::string &meshName="") |
| | Constructor.
|
| |
| | Model (File &&file, const std::string &meshName="") |
| | Constructor (rvalue file - helps for declaring the file on the fly when using gcc)
|
| |
| uint64_t | getNumPoses () |
| | Get the number of animation poses in the current animation.
|
| |
| size_t | getNumAnimations () |
| | Get the number of available animations.
|
| |
| void | setAnimation (uint32_t animationIdx) |
| | Set the current animation.
|
| |
| Mat4 | getTransform (uint32_t animationIdx, uint64_t currentPose, float seconds=0.0f) |
| | Get a transform of the model.
|
| |
| Mat4 | getJointTransform (size_t jointIdx, uint32_t animationIdx, uint64_t currentPose, float seconds=0.0f) |
| | Get a joint transform, also calculating the transorms of the parent joints in the same tree and the animations, if any exist.
|
| |
|
Vec3 | getOriginalScale () |
| | Get the Model's original scale (usually the one read from the file the Model was loaded from.
|
| |
| void | saveBinary (const std::string &binaryFilePath) |
| | Save model data in binary format.
|
| |
|
template<class Archive > |
| void | serialize (Archive &archive) |
| |
|
|
Material | material |
| | The material of the model.
|
| |
|
Vec3 | scale = Vec3(1.0f, 1.0f, 1.0f) |
| | Use this to scale the model and not origScale.
|
| |
|
std::shared_ptr< Image > | defaultTextureImage |
| | Image found in the file the model was loaded from (empty image if not - check the size). It can be used to generate a texture for the model, but other textures can also be used.
|
| |
|
std::vector< float > | vertexData |
| | The vertex data. This is an array, which is to be treated as a 4 column table, holding the x, y, z values in each column. The fourth column is there to assist in matrix operations.
|
| |
|
uint32_t | vertexDataByteSize = 0 |
| | Size of the vertex data, in bytes.
|
| |
|
std::vector< uint16_t > | indexData |
| | 3 column table. Each element refers to a "row" in the vertex data table. Each "row" in the index data table forms a triangle.
|
| |
|
uint32_t | indexDataByteSize = 0 |
| | Size of the index data, in bytes.
|
| |
|
std::vector< float > | normalsData |
| | Array, to be treated as a 3 column table. Each "row" contains the x, y and z components of the vector representing the normal of a vertex. The position of the "row" in the array is the same as the position of the corresponding vertex "row" in the vertexData array.
|
| |
|
uint32_t | normalsDataByteSize = 0 |
| | Size of the normals data, in bytes.
|
| |
|
std::vector< float > | textureCoordsData |
| | Array, to be treated as a 2 column table. Each "row" contains the x and y components of the pixel coordinates on the model's texture image for the vertex in the corresponding "row" of the vertex data "table".
|
| |
|
uint32_t | textureCoordsDataByteSize = 0 |
| | Size of the texture coordinates data, in bytes.
|
| |
|
std::vector< uint8_t > | jointData |
| | Array, to be treated as a 4 column table. Each "row" potentially contains up to 4 joints that can influence each vertex.
|
| |
|
uint32_t | jointDataByteSize = 0 |
| | Size of the joint data, in bytes.
|
| |
|
std::vector< float > | weightData |
| | Array, to be treated as a 4 column table. Each "row" contains the weights by which each of the corresponding joints affect each vertex.
|
| |
|
uint32_t | weightDataByteSize = 0 |
| | Size of the weight data, in bytes.
|
| |
|
std::vector< Joint > | joints |
| | The model's joints.
|
| |
|
std::vector< Animation > | animations |
| | Animations of the model (there are also joint animations)
|
| |
|
bool | noShadow = false |
| | Should the model produce a shadow?
|
| |
|
|
static const uint32_t | MAX_JOINTS_SUPPORTED = 32 |
| | Maximum number of supported joints.
|
| |
|
|
class | GlbFile |
| |
|
class | Renderer |
| |
A 3D model. It can be loaded from a WavefrontFile or GlbFile. It can also be constructed procedurally by code, by inserting values to the appropriate member variables.
◆ Model() [1/2]
| small3d::Model::Model |
( |
File & | file, |
|
|
const std::string & | meshName = "" ) |
|
explicit |
Constructor.
- Parameters
-
| file | The file parsing object from which to load the model |
| meshName | The name of the model mesh in the file |
◆ Model() [2/2]
| small3d::Model::Model |
( |
File && | file, |
|
|
const std::string & | meshName = "" ) |
|
explicit |
Constructor (rvalue file - helps for declaring the file on the fly when using gcc)
- Parameters
-
| file | The file parsing object from which to load the model |
| meshName | The name of the model mesh in the file |
◆ getJointTransform()
| Mat4 small3d::Model::getJointTransform |
( |
size_t | jointIdx, |
|
|
uint32_t | animationIdx, |
|
|
uint64_t | currentPose, |
|
|
float | seconds = 0.0f ) |
Get a joint transform, also calculating the transorms of the parent joints in the same tree and the animations, if any exist.
- Parameters
-
| jointIdx | The index of the joint in the list of joints |
| animationIdx | The index of the animation to use |
| currentPose | The pose of the animation to calculate the joint transformation for. |
| seconds | The animation moment (in seconds) - mostly used internally |
- Returns
- The transform
◆ getNumAnimations()
| size_t small3d::Model::getNumAnimations |
( |
| ) |
|
Get the number of available animations.
- Returns
- The number of animations
◆ getNumPoses()
| uint64_t small3d::Model::getNumPoses |
( |
| ) |
|
Get the number of animation poses in the current animation.
- Returns
- The number of animation poses
◆ getTransform()
| Mat4 small3d::Model::getTransform |
( |
uint32_t | animationIdx, |
|
|
uint64_t | currentPose, |
|
|
float | seconds = 0.0f ) |
Get a transform of the model.
- Parameters
-
| animationIdx | The index of the animation to use |
| currentPose | The pose of the animation to calculate the joint transformation for. |
| seconds | The animation moment (in seconds) - mostly used internally |
- Returns
- The transform
◆ saveBinary()
| void small3d::Model::saveBinary |
( |
const std::string & | binaryFilePath | ) |
|
Save model data in binary format.
- Parameters
-
| binaryFilePath | Path of file to save binary data to. |
◆ setAnimation()
| void small3d::Model::setAnimation |
( |
uint32_t | animationIdx | ) |
|
Set the current animation.
- Parameters
-
| animationIdx | The index of the current animation |
The documentation for this class was generated from the following files: