COGS
Computer Graphics Structures library
cogs::Importer Class Reference

Universal file importer for COGS structures. More...

Public Member Functions

 Importer (const std::string &filename)
 
 Importer (const Importer &other)=delete
 
 Importer (const Importer &&other)=delete
 
Importer & operator= (const Importer &other)=delete
 
Importer & operator= (const Importer &&other)=delete
 
bool LoadFile (const std::string &filename)
 Loads the file. When the file is COGS file, it remains open. Returns success.
 
void CloseFile ()
 When loaded file was in COGS file format, closes it. Otherwise, does nothing.
 
size_t GetPointCloudCount () const
 Returns number of point clouds contained in a loaded file.
 
bool GetPointCloud (cogs::PointCloud &out_cloud, size_t id=0) const
 Requests point cloud structure from the loaded file. More...
 
size_t GetScanCount () const
 Returns number of scans contained in a loaded file.
 
bool GetScan (cogs::Scan &out_scan, size_t id=0) const
 Requests scan structure from the loaded file. More...
 
size_t GetMeshCount () const
 Returns number of meshes contained in a loaded file.
 
bool GetMesh (cogs::Mesh &out_meshmodel, size_t id=0) const
 Requests mesh structure from the loaded file. More...
 
std::vector< cogs::Mesh > GetAllMeshes () const
 Returns all meshes from the loaded file.
 
std::vector< std::string > GetMeshNames () const
 Returns names of all loaded meshes. Not supported by cogs files.
 
bool GetMeshByName (const std::string &name, cogs::Mesh &out_meshmodel) const
 Finds and requests mesh structure from the loaded file. More...
 
uint32_t GetSkeletonCount () const
 Returns number of skeletons contained in a loaded file.
 
bool GetSkeleton (cogs::Skeleton &out_skeleton, size_t id=0) const
 Requests skeleton structure from the loaded file. More...
 
std::vector< std::string > GetSkeletonNames () const
 Returns names of all loaded skeletons. Not supported by cogs files.
 
bool GetSkeletonByName (const std::string &name, cogs::Skeleton &out_skeleton) const
 Finds and requests mesh structure from the loaded file. More...
 
bool GetArmature (cogs::Armature &out_armature) const
 Requests armature structure from the loaded file. More...
 
bool GetAllSkeletonActions (std::vector< cogs::SkeletonAction > &out_actions) const
 Requests all skeleton actions from the loaded file. More...
 
bool GetAllSkeletonActions (const std::string &skeleton_name, std::vector< cogs::SkeletonAction > &out_actions) const
 Requests all skeleton actions from the loaded file, compatible with specific skeleton. More...
 
bool GetSkeletonActionByName (const std::string &skeleton_name, const std::string &action_name, cogs::SkeletonAction &out_action) const
 Requests a skeleton action from the loaded file, compatible with specific skeleton. More...
 

Detailed Description

Universal file importer for COGS structures.

Supports all COGS file extensions which can be found in File Extensions.

Internally uses Assimp library which supports common data formats found in http://assimp.sourceforge.net/main_features_formats.html. However, compatibility is not guaranteed for all file formats.

Assimp import was tested on the following file formats:

  • Wavefront (.obj)
  • Autodesk Filmbox (.fbx)
  • COLLADA (.dae)
  • Biovision Hierarchy (.bvh)

Member Function Documentation

◆ GetAllSkeletonActions() [1/2]

bool cogs::Importer::GetAllSkeletonActions ( std::vector< cogs::SkeletonAction > &  out_actions) const

Requests all skeleton actions from the loaded file.

Parameters
out_actionsArray in which output should be stored.
Returns
Whether load finished successfully, and output is valid.

◆ GetAllSkeletonActions() [2/2]

bool cogs::Importer::GetAllSkeletonActions ( const std::string &  skeleton_name,
std::vector< cogs::SkeletonAction > &  out_actions 
) const

Requests all skeleton actions from the loaded file, compatible with specific skeleton.

Parameters
skeleton_nameName of skeleton object, actions should be compatible with.
out_actionsArray in which output should be stored.
Returns
Whether load finished successfully, and output is valid.

◆ GetArmature()

bool cogs::Importer::GetArmature ( cogs::Armature &  out_armature) const

Requests armature structure from the loaded file.

Parameters
out_armatureObject, to which should data be loaded.
idIndex of object in the file when there are more of the same type.
Returns
Whether load finished successfully, and output is valid.

◆ GetMesh()

bool cogs::Importer::GetMesh ( cogs::Mesh &  out_meshmodel,
size_t  id = 0 
) const

Requests mesh structure from the loaded file.

Parameters
out_meshmodelObject, to which should data be loaded.
idIndex of object in the file when there are more of the same type.
Returns
Whether load finished successfully, and output is valid.

◆ GetMeshByName()

bool cogs::Importer::GetMeshByName ( const std::string &  name,
cogs::Mesh &  out_meshmodel 
) const

Finds and requests mesh structure from the loaded file.

Parameters
out_meshmodelObject, to which should data be loaded.
nameName identifier of an object.
Returns
Whether load finished successfully, and output is valid.

◆ GetPointCloud()

bool cogs::Importer::GetPointCloud ( cogs::PointCloud &  out_cloud,
size_t  id = 0 
) const

Requests point cloud structure from the loaded file.

Parameters
out_cloudObject, to which should data be loaded.
idIndex of object in the file when there are more of the same type.
Returns
Whether load finished successfully, and output is valid.

◆ GetScan()

bool cogs::Importer::GetScan ( cogs::Scan &  out_scan,
size_t  id = 0 
) const

Requests scan structure from the loaded file.

Parameters
out_scanObject, to which should data be loaded.
idIndex of object in the file when there are more of the same type.
Returns
Whether load finished successfully, and output is valid.

◆ GetSkeleton()

bool cogs::Importer::GetSkeleton ( cogs::Skeleton &  out_skeleton,
size_t  id = 0 
) const

Requests skeleton structure from the loaded file.

Parameters
out_skeletonObject, to which should data be loaded.
idIndex of object in the file when there are more of the same type.
Returns
Whether load finished successfully, and output is valid.

◆ GetSkeletonActionByName()

bool cogs::Importer::GetSkeletonActionByName ( const std::string &  skeleton_name,
const std::string &  action_name,
cogs::SkeletonAction &  out_action 
) const

Requests a skeleton action from the loaded file, compatible with specific skeleton.

Parameters
skeleton_nameName of skeleton object, actions should be compatible with.
action_nameName of the requested action.
out_actionsObject, to which should data be loaded.
Returns
Whether load finished successfully, and output is valid.

◆ GetSkeletonByName()

bool cogs::Importer::GetSkeletonByName ( const std::string &  name,
cogs::Skeleton &  out_skeleton 
) const

Finds and requests mesh structure from the loaded file.

Parameters
out_skeletonObject, to which should data be loaded.
nameName identifier of an object to find.
Returns
Whether load finished successfully, and output is valid.