Rehti MMORPG  1.0.0
Rehti MMORPG is a free and open source MMORPG game.
Assimp.hpp File Reference
#include <assimp/Importer.hpp>
#include <assimp/postprocess.h>
#include <assimp/scene.h>
#include <map>
#include <vector>
#include "AssetTypes.hpp"
Include dependency graph for Assimp.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

bool loadOBJFile (const std::string &path, std::vector< Vertex > &vertices, std::vector< uint32_t > &faces, const float scalingFactor=1.0f)
 Loads the object from the given path. More...
 
bool loadOBJTile (std::vector< Vertex > &vertices, std::vector< uint32_t > &faces)
 Loads a double sided tile object. More...
 
bool loadGlTFFile (const std::string &path, std::vector< CharacterVertex > &vertices, std::vector< uint32_t > &indices, std::array< Animation, ANIMATION_TYPE_COUNT > &animations, std::vector< BoneNode > &bones, std::vector< glm::mat4 > &transformations)
 Loads the object from the given path. More...
 
size_t loadAnimations (const aiScene *scene, const std::map< std::string, uint32_t > nameToIndex, std::array< Animation, ANIMATION_TYPE_COUNT > &animations)
 Loads animations from the given scene. More...
 
size_t fillSkeleton (aiNode *rootNode, std::vector< BoneNode > &boneList, std::vector< glm::mat4 > &transformations, std::map< std::string, uint32_t > &nameToIndex)
 Fills the given vectors with hierarchy and bone data. More...
 
Vertex aiVector3DToVertex (const aiVector3D &vector)
 Convert aiVector3D to Vertex. More...
 
std::vector< VertexaiVector3DVectorToVertexVector (const std::vector< aiVector3D > &vectors)
 Convert vector of aiVector3D to vector of Vertex. More...
 
std::vector< uint32_t > aiFaceToFace (const aiFace &face)
 Convert aiFace to RehtiGraphics Face. More...
 
std::vector< uint32_t > aiFaceVectorToFaceVector (const std::vector< aiFace > &faces)
 Convert vector of aiFace to vector of RehtiGraphics Faces. More...
 
glm::mat4 aiMatrix4x4ToGlm (const aiMatrix4x4 &matrix)
 Convert aiMatrix4x4 to glm::mat4. More...
 
glm::quat aiQuaternionToGlm (const aiQuaternion &quaternion)
 Convert aiQuaternion to glm::quat. More...
 
glm::vec3 aiVector3DToGlm (const aiVector3D &vector)
 Convert aiVector3D to glm::vec3. More...
 
void debugCharacterVertices (const std::vector< CharacterVertex > &vertices)
 Prints out faulty vertices. More...
 

Function Documentation

◆ aiFaceToFace()

std::vector<uint32_t> aiFaceToFace ( const aiFace &  face)

Convert aiFace to RehtiGraphics Face.

Returns
RehtiGraphics Face
Here is the caller graph for this function:

◆ aiFaceVectorToFaceVector()

std::vector<uint32_t> aiFaceVectorToFaceVector ( const std::vector< aiFace > &  faces)

Convert vector of aiFace to vector of RehtiGraphics Faces.

Returns
Vector of RehtiGraphics Faces
Here is the call graph for this function:

◆ aiMatrix4x4ToGlm()

glm::mat4 aiMatrix4x4ToGlm ( const aiMatrix4x4 &  matrix)

Convert aiMatrix4x4 to glm::mat4.

Returns
glm::mat4
Here is the caller graph for this function:

◆ aiQuaternionToGlm()

glm::quat aiQuaternionToGlm ( const aiQuaternion &  quaternion)

Convert aiQuaternion to glm::quat.

Returns
glm::quat
Here is the caller graph for this function:

◆ aiVector3DToGlm()

glm::vec3 aiVector3DToGlm ( const aiVector3D &  vector)

Convert aiVector3D to glm::vec3.

Returns
glm::vec3
Here is the caller graph for this function:

◆ aiVector3DToVertex()

Vertex aiVector3DToVertex ( const aiVector3D &  vector)

Convert aiVector3D to Vertex.

Returns
Vertex
Here is the caller graph for this function:

◆ aiVector3DVectorToVertexVector()

std::vector<Vertex> aiVector3DVectorToVertexVector ( const std::vector< aiVector3D > &  vectors)

Convert vector of aiVector3D to vector of Vertex.

Returns
Vector of Vertex
Here is the call graph for this function:

◆ debugCharacterVertices()

void debugCharacterVertices ( const std::vector< CharacterVertex > &  vertices)

Prints out faulty vertices.

Parameters
verticesto check
Here is the caller graph for this function:

◆ fillSkeleton()

size_t fillSkeleton ( aiNode *  rootNode,
std::vector< BoneNode > &  boneList,
std::vector< glm::mat4 > &  transformations,
std::map< std::string, uint32_t > &  nameToIndex 
)

Fills the given vectors with hierarchy and bone data.

Parameters
rootNodeis the root node of the hierarchy.
boneListis the list of bones.
transformationsis the list of transformations.
nameToIndexis the map of bone names to their indices.
Returns
The number of bones.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ loadAnimations()

size_t loadAnimations ( const aiScene *  scene,
const std::map< std::string, uint32_t >  nameToIndex,
std::array< Animation, ANIMATION_TYPE_COUNT > &  animations 
)

Loads animations from the given scene.

Parameters
sceneto load animations from.
nameToIndexmap of bone names to their indices.
animationsarray to fill with animations.
Returns
boolean indicating success
Here is the call graph for this function:
Here is the caller graph for this function:

◆ loadGlTFFile()

bool loadGlTFFile ( const std::string &  path,
std::vector< CharacterVertex > &  vertices,
std::vector< uint32_t > &  indices,
std::array< Animation, ANIMATION_TYPE_COUNT > &  animations,
std::vector< BoneNode > &  bones,
std::vector< glm::mat4 > &  transformations 
)

Loads the object from the given path.

Parameters
pathto the object file.
verticesEmpty vector of float that will be filled with the vertices.
indicesEmpty vector of unsigned int that will be filled with the indices.
animationsEmpty array of Animation that will be filled with the animations.
bonesEmpty vector of BoneNode that will be filled with the bones.
transformationsEmpty vector of glm::mat4 that will be filled with the transformations of the bind pose bones.
Returns
True if the object was loaded successfully, false otherwise.
Parameters
pathto the object file.
verticesEmpty vector of float that will be filled with the vertices.
indicesEmpty vector of unsigned int that will be filled with the indices.
animationsEmpty array of Animation that will be filled with the animations.
bonesEmpty vector of BoneNode that will be filled with the bones.
Returns
True if the object was loaded successfully, false otherwise.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ loadOBJFile()

bool loadOBJFile ( const std::string &  path,
std::vector< Vertex > &  vertices,
std::vector< uint32_t > &  faces,
const float  scalingFactor = 1.0f 
)

Loads the object from the given path.

Parameters
pathto the object file.
verticesEmpty vector of float that will be filled with the vertices.
indicesEmpty vector of unsigned int that will be filled with the indices.
scalingFactorThe scaling factor for the vertices
Returns
True if the object was loaded successfully, false otherwise
Here is the call graph for this function:
Here is the caller graph for this function:

◆ loadOBJTile()

bool loadOBJTile ( std::vector< Vertex > &  vertices,
std::vector< uint32_t > &  faces 
)

Loads a double sided tile object.

Parameters
verticesto be filled.
facesto be filled.
Returns
boolean indicating success (always true)
Here is the caller graph for this function: