Assimp  v4.1. (December 2018)
Assimp::ColladaExporter Class Reference

Helper class to export a given scene to a Collada file. More...

Classes

struct  Material
 
struct  Property
 
struct  Surface
 

Public Member Functions

 ColladaExporter (const aiScene *pScene, IOSystem *pIOSystem, const std::string &path, const std::string &file)
 Constructor for a specific scene to export. More...
 
void ReadMaterialSurface (Surface &poSurface, const aiMaterial *pSrcMat, aiTextureType pTexture, const char *pKey, size_t pType, size_t pIndex)
 Dammit C++ - y u no compile two-pass? No I have to add all methods below the struct definitions Reads a single surface entry from the given material keys. More...
 
void WriteFloatEntry (const Property &pProperty, const std::string &pTypeName)
 Writes a scalar property. More...
 
void WriteImageEntry (const Surface &pSurface, const std::string &pNameAdd)
 Writes an image entry for the given surface. More...
 
void WriteTextureColorEntry (const Surface &pSurface, const std::string &pTypeName, const std::string &pImageName)
 Writes a color-or-texture entry into an effect definition. More...
 
void WriteTextureParamEntry (const Surface &pSurface, const std::string &pTypeName, const std::string &pMatName)
 Writes the two parameters necessary for referencing a texture in an effect entry. More...
 
virtual ~ColladaExporter ()
 Destructor. More...
 

Public Attributes

std::string endstr
 current line end string for simple stream insertion More...
 
std::vector< Materialmaterials
 
const std::string mFile
 Name of the file (without extension) where the scene will be exported. More...
 
IOSystemmIOSystem
 The IOSystem for output. More...
 
std::stringstream mOutput
 Stringstream to write all output into. More...
 
const std::string mPath
 Path of the directory where the scene will be exported. More...
 
const aiScenemScene
 The scene to be written. More...
 
bool mSceneOwned
 
std::string startstr
 current line start string, contains the current indentation for simple stream insertion More...
 
std::map< unsigned int, std::string > textures
 

Protected Types

enum  FloatDataType {
  FloatType_Vector , FloatType_TexCoord2 , FloatType_TexCoord3 , FloatType_Color ,
  FloatType_Mat4x4 , FloatType_Weight , FloatType_Time
}
 

Protected Member Functions

std::string GetMeshId (size_t pIndex) const
 Creates a mesh ID for the given mesh. More...
 
void PopTag ()
 Leaves an element, decreasing the indentation. More...
 
void PushTag ()
 Enters a new xml element, which increases the indentation. More...
 
void WriteAmbienttLight (const aiLight *const light)
 
void WriteAnimationLibrary (size_t pIndex)
 
void WriteAnimationsLibrary ()
 
void WriteCamera (size_t pIndex)
 
void WriteCamerasLibrary ()
 Writes the cameras library. More...
 
void WriteController (size_t pIndex)
 Writes a skin controller of the given mesh. More...
 
void WriteControllerLibrary ()
 Writes the controller library. More...
 
void WriteDirectionalLight (const aiLight *const light)
 
void WriteFile ()
 Starts writing the contents. More...
 
void WriteFloatArray (const std::string &pIdString, FloatDataType pType, const ai_real *pData, size_t pElementCount)
 Writes a float array of the given type. More...
 
void WriteGeometry (size_t pIndex)
 Writes the given mesh. More...
 
void WriteGeometryLibrary ()
 Writes the geometry library. More...
 
void WriteHeader ()
 Writes the asset header. More...
 
void WriteLight (size_t pIndex)
 
void WriteLightsLibrary ()
 Writes the cameras library. More...
 
void WriteMaterials ()
 Writes the material setup. More...
 
void WriteNode (const aiScene *scene, aiNode *pNode)
 Recursively writes the given node. More...
 
void WritePointLight (const aiLight *const light)
 
void WriteSceneLibrary ()
 Writes the scene library. More...
 
void WriteSpotLight (const aiLight *const light)
 
void WriteTextures ()
 Writes the embedded textures. More...
 

Protected Attributes

std::string mFoundSkeletonRootNodeID = "skeleton_root"
 

Detailed Description

Helper class to export a given scene to a Collada file.

Just for my personal comfort when implementing it.

Member Enumeration Documentation

◆ FloatDataType

Enumerator
FloatType_Vector 
FloatType_TexCoord2 
FloatType_TexCoord3 
FloatType_Color 
FloatType_Mat4x4 
FloatType_Weight 
FloatType_Time 

Constructor & Destructor Documentation

◆ ColladaExporter()

ColladaExporter::ColladaExporter ( const aiScene pScene,
IOSystem pIOSystem,
const std::string &  path,
const std::string &  file 
)

Constructor for a specific scene to export.

◆ ~ColladaExporter()

ColladaExporter::~ColladaExporter ( )
virtual

Destructor.

Member Function Documentation

◆ GetMeshId()

std::string Assimp::ColladaExporter::GetMeshId ( size_t  pIndex) const
inlineprotected

Creates a mesh ID for the given mesh.

◆ PopTag()

void Assimp::ColladaExporter::PopTag ( )
inlineprotected

Leaves an element, decreasing the indentation.

◆ PushTag()

void Assimp::ColladaExporter::PushTag ( )
inlineprotected

Enters a new xml element, which increases the indentation.

◆ ReadMaterialSurface()

void ColladaExporter::ReadMaterialSurface ( Surface poSurface,
const aiMaterial pSrcMat,
aiTextureType  pTexture,
const char *  pKey,
size_t  pType,
size_t  pIndex 
)

Dammit C++ - y u no compile two-pass? No I have to add all methods below the struct definitions Reads a single surface entry from the given material keys.

◆ WriteAmbienttLight()

void ColladaExporter::WriteAmbienttLight ( const aiLight *const  light)
protected

◆ WriteAnimationLibrary()

void ColladaExporter::WriteAnimationLibrary ( size_t  pIndex)
protected

◆ WriteAnimationsLibrary()

void ColladaExporter::WriteAnimationsLibrary ( )
protected

◆ WriteCamera()

void ColladaExporter::WriteCamera ( size_t  pIndex)
protected

◆ WriteCamerasLibrary()

void ColladaExporter::WriteCamerasLibrary ( )
protected

Writes the cameras library.

◆ WriteController()

void ColladaExporter::WriteController ( size_t  pIndex)
protected

Writes a skin controller of the given mesh.

◆ WriteControllerLibrary()

void ColladaExporter::WriteControllerLibrary ( )
protected

Writes the controller library.

◆ WriteDirectionalLight()

void ColladaExporter::WriteDirectionalLight ( const aiLight *const  light)
protected

◆ WriteFile()

void ColladaExporter::WriteFile ( )
protected

Starts writing the contents.

◆ WriteFloatArray()

void ColladaExporter::WriteFloatArray ( const std::string &  pIdString,
FloatDataType  pType,
const ai_real pData,
size_t  pElementCount 
)
protected

Writes a float array of the given type.

◆ WriteFloatEntry()

void ColladaExporter::WriteFloatEntry ( const Property pProperty,
const std::string &  pTypeName 
)

Writes a scalar property.

◆ WriteGeometry()

void ColladaExporter::WriteGeometry ( size_t  pIndex)
protected

Writes the given mesh.

◆ WriteGeometryLibrary()

void ColladaExporter::WriteGeometryLibrary ( )
protected

Writes the geometry library.

◆ WriteHeader()

void ColladaExporter::WriteHeader ( )
protected

Writes the asset header.

◆ WriteImageEntry()

void ColladaExporter::WriteImageEntry ( const Surface pSurface,
const std::string &  pNameAdd 
)

Writes an image entry for the given surface.

◆ WriteLight()

void ColladaExporter::WriteLight ( size_t  pIndex)
protected

◆ WriteLightsLibrary()

void ColladaExporter::WriteLightsLibrary ( )
protected

Writes the cameras library.

◆ WriteMaterials()

void ColladaExporter::WriteMaterials ( )
protected

Writes the material setup.

collect all materials from the scene

◆ WriteNode()

void ColladaExporter::WriteNode ( const aiScene scene,
aiNode pNode 
)
protected

Recursively writes the given node.

◆ WritePointLight()

void ColladaExporter::WritePointLight ( const aiLight *const  light)
protected

◆ WriteSceneLibrary()

void ColladaExporter::WriteSceneLibrary ( )
protected

Writes the scene library.

◆ WriteSpotLight()

void ColladaExporter::WriteSpotLight ( const aiLight *const  light)
protected

◆ WriteTextureColorEntry()

void ColladaExporter::WriteTextureColorEntry ( const Surface pSurface,
const std::string &  pTypeName,
const std::string &  pImageName 
)

Writes a color-or-texture entry into an effect definition.

◆ WriteTextureParamEntry()

void ColladaExporter::WriteTextureParamEntry ( const Surface pSurface,
const std::string &  pTypeName,
const std::string &  pMatName 
)

Writes the two parameters necessary for referencing a texture in an effect entry.

◆ WriteTextures()

void ColladaExporter::WriteTextures ( )
protected

Writes the embedded textures.

Member Data Documentation

◆ endstr

std::string Assimp::ColladaExporter::endstr

current line end string for simple stream insertion

◆ materials

std::vector<Material> Assimp::ColladaExporter::materials

◆ mFile

const std::string Assimp::ColladaExporter::mFile

Name of the file (without extension) where the scene will be exported.

◆ mFoundSkeletonRootNodeID

std::string Assimp::ColladaExporter::mFoundSkeletonRootNodeID = "skeleton_root"
protected

◆ mIOSystem

IOSystem* Assimp::ColladaExporter::mIOSystem

The IOSystem for output.

◆ mOutput

std::stringstream Assimp::ColladaExporter::mOutput

Stringstream to write all output into.

◆ mPath

const std::string Assimp::ColladaExporter::mPath

Path of the directory where the scene will be exported.

◆ mScene

const aiScene* Assimp::ColladaExporter::mScene

The scene to be written.

◆ mSceneOwned

bool Assimp::ColladaExporter::mSceneOwned

◆ startstr

std::string Assimp::ColladaExporter::startstr

current line start string, contains the current indentation for simple stream insertion

◆ textures

std::map<unsigned int, std::string> Assimp::ColladaExporter::textures

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