Exporter: fix some review findings.
parent
a46b481985
commit
2193a93875
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2011, assimp team
|
||||
Copyright (c) 2006-2016, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
@ -52,16 +52,16 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <map>
|
||||
|
||||
namespace Assimp {
|
||||
|
||||
class ExporterPimpl;
|
||||
class IOSystem;
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
/** CPP-API: The Exporter class forms an C++ interface to the export functionality
|
||||
* of the Open Asset Import Library. Note that the export interface is available
|
||||
* only if Assimp has been built with ASSIMP_BUILD_NO_EXPORT not defined.
|
||||
*
|
||||
* The interface is modelled after the importer interface and mostly
|
||||
* The interface is modeled after the importer interface and mostly
|
||||
* symmetric. The same rules for threading etc. apply.
|
||||
*
|
||||
* In a nutshell, there are two export interfaces: #Export, which writes the
|
||||
|
@ -74,17 +74,10 @@ namespace Assimp {
|
|||
* #ExportToBlob is especially useful if you intend to work
|
||||
* with the data in-memory.
|
||||
*/
|
||||
|
||||
class ASSIMP_API ExportProperties;
|
||||
|
||||
class ASSIMP_API Exporter
|
||||
// TODO: causes good ol' base class has no dll interface warning
|
||||
//#ifdef __cplusplus
|
||||
// : public boost::noncopyable
|
||||
//#endif // __cplusplus
|
||||
{
|
||||
class ASSIMP_API Exporter {
|
||||
public:
|
||||
|
||||
/** Function pointer type of a Export worker function */
|
||||
typedef void (*fpExportFunc)(const char*, IOSystem*, const aiScene*, const ExportProperties*);
|
||||
|
||||
|
@ -97,7 +90,7 @@ public:
|
|||
// Worker function to do the actual exporting
|
||||
fpExportFunc mExportFunction;
|
||||
|
||||
// Postprocessing steps to be executed PRIOR to invoking mExportFunction
|
||||
// Post-processing steps to be executed PRIOR to invoking mExportFunction
|
||||
unsigned int mEnforcePP;
|
||||
|
||||
// Constructor to fill all entries
|
||||
|
@ -122,14 +115,10 @@ public:
|
|||
|
||||
|
||||
public:
|
||||
|
||||
|
||||
Exporter();
|
||||
~Exporter();
|
||||
|
||||
public:
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
/** Supplies a custom IO handler to the exporter to use to open and
|
||||
* access files.
|
||||
|
@ -163,8 +152,6 @@ public:
|
|||
* @return true by default */
|
||||
bool IsDefaultIOHandler() const;
|
||||
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
/** Exports the given scene to a chosen file format. Returns the exported
|
||||
* data as a binary blob which you can write into a file or something.
|
||||
|
@ -184,8 +171,7 @@ public:
|
|||
* @note Use aiCopyScene() to get a modifiable copy of a previously
|
||||
* imported scene. */
|
||||
const aiExportDataBlob* ExportToBlob( const aiScene* pScene, const char* pFormatId, unsigned int pPreprocessing = 0u, const ExportProperties* pProperties = NULL);
|
||||
inline const aiExportDataBlob* ExportToBlob( const aiScene* pScene, const std::string& pFormatId, unsigned int pPreprocessing = 0u, const ExportProperties* pProperties = NULL);
|
||||
|
||||
const aiExportDataBlob* ExportToBlob( const aiScene* pScene, const std::string& pFormatId, unsigned int pPreprocessing = 0u, const ExportProperties* pProperties = NULL);
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
/** Convenience function to export directly to a file. Use
|
||||
|
@ -213,16 +199,15 @@ public:
|
|||
* triangulate data so they would run the step even if it wasn't requested.
|
||||
*
|
||||
* If assimp detects that the input scene was directly taken from the importer side of
|
||||
* the library (i.e. not copied using aiCopyScene and potetially modified afterwards),
|
||||
* any postprocessing steps already applied to the scene will not be applied again, unless
|
||||
* they show non-idempotent behaviour (#aiProcess_MakeLeftHanded, #aiProcess_FlipUVs and
|
||||
* the library (i.e. not copied using aiCopyScene and potentially modified afterwards),
|
||||
* any post-processing steps already applied to the scene will not be applied again, unless
|
||||
* they show non-idempotent behavior (#aiProcess_MakeLeftHanded, #aiProcess_FlipUVs and
|
||||
* #aiProcess_FlipWindingOrder).
|
||||
* @return AI_SUCCESS if everything was fine.
|
||||
* @note Use aiCopyScene() to get a modifiable copy of a previously
|
||||
* imported scene.*/
|
||||
aiReturn Export( const aiScene* pScene, const char* pFormatId, const char* pPath, unsigned int pPreprocessing = 0u, const ExportProperties* pProperties = NULL);
|
||||
inline aiReturn Export( const aiScene* pScene, const std::string& pFormatId, const std::string& pPath, unsigned int pPreprocessing = 0u, const ExportProperties* pProperties = NULL);
|
||||
|
||||
aiReturn Export( const aiScene* pScene, const std::string& pFormatId, const std::string& pPath, unsigned int pPreprocessing = 0u, const ExportProperties* pProperties = NULL);
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
/** Returns an error description of an error that occurred in #Export
|
||||
|
@ -236,30 +221,26 @@ public:
|
|||
* following methods is called: #Export, #ExportToBlob, #FreeBlob */
|
||||
const char* GetErrorString() const;
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
/** Return the blob obtained from the last call to #ExportToBlob */
|
||||
const aiExportDataBlob* GetBlob() const;
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
/** Orphan the blob from the last call to #ExportToBlob. This means
|
||||
* the caller takes ownership and is thus responsible for calling
|
||||
* the C API function #aiReleaseExportBlob to release it. */
|
||||
const aiExportDataBlob* GetOrphanedBlob() const;
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
/** Frees the current blob.
|
||||
*
|
||||
* The function does nothing if no blob has previously been
|
||||
* previously produced via #ExportToBlob. #FreeBlob is called
|
||||
* automatically by the destructor. The only reason to call
|
||||
* it manually would be to reclain as much storage as possible
|
||||
* it manually would be to reclaim as much storage as possible
|
||||
* without giving up the #Exporter instance yet. */
|
||||
void FreeBlob( );
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
/** Returns the number of export file formats available in the current
|
||||
* Assimp build. Use #Exporter::GetExportFormatDescription to
|
||||
|
@ -270,13 +251,12 @@ public:
|
|||
**/
|
||||
size_t GetExportFormatCount() const;
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
/** Returns a description of the nth export file format. Use #
|
||||
* #Exporter::GetExportFormatCount to learn how many export
|
||||
* formats are supported.
|
||||
*
|
||||
* The returned pointer is of static storage duration iff the
|
||||
* The returned pointer is of static storage duration if the
|
||||
* pIndex pertains to a built-in exporter (i.e. one not registered
|
||||
* via #RegistrerExporter). It is restricted to the life-time of the
|
||||
* #Exporter instance otherwise.
|
||||
|
@ -287,7 +267,6 @@ public:
|
|||
* NULL if pIndex is out of range. */
|
||||
const aiExportFormatDesc* GetExportFormatDescription( size_t pIndex ) const;
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
/** Register a custom exporter. Custom export formats are limited to
|
||||
* to the current #Exporter instance and do not affect the
|
||||
|
@ -301,11 +280,10 @@ public:
|
|||
* occupied by another format. */
|
||||
aiReturn RegisterExporter(const ExportFormatEntry& desc);
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
/** Remove an export format previously registered with #RegisterExporter
|
||||
* from the #Exporter instance (this can also be used to drop
|
||||
* builtin exporters because those are implicitly registered
|
||||
* built-in exporters because those are implicitly registered
|
||||
* using #RegisterExporter).
|
||||
* @param id Format id to be unregistered, this refers to the
|
||||
* 'id' field of #aiExportFormatDesc.
|
||||
|
@ -313,14 +291,11 @@ public:
|
|||
* has no effect.*/
|
||||
void UnregisterExporter(const char* id);
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
// Just because we don't want you to know how we're hacking around.
|
||||
ExporterPimpl* pimpl;
|
||||
};
|
||||
|
||||
|
||||
class ASSIMP_API ExportProperties
|
||||
{
|
||||
public:
|
||||
|
@ -335,11 +310,9 @@ public:
|
|||
typedef std::map<KeyType, aiMatrix4x4> MatrixPropertyMap;
|
||||
|
||||
public:
|
||||
|
||||
/** Standard constructor
|
||||
* @see ExportProperties()
|
||||
*/
|
||||
|
||||
ExportProperties();
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
|
@ -487,19 +460,24 @@ protected:
|
|||
MatrixPropertyMap mMatrixProperties;
|
||||
};
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
inline const aiExportDataBlob* Exporter :: ExportToBlob( const aiScene* pScene, const std::string& pFormatId,unsigned int pPreprocessing, const ExportProperties* pProperties)
|
||||
inline
|
||||
const aiExportDataBlob* Exporter::ExportToBlob( const aiScene* pScene, const std::string& pFormatId,
|
||||
unsigned int pPreprocessing, const ExportProperties* pProperties)
|
||||
{
|
||||
return ExportToBlob(pScene,pFormatId.c_str(),pPreprocessing, pProperties);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
inline aiReturn Exporter :: Export( const aiScene* pScene, const std::string& pFormatId, const std::string& pPath, unsigned int pPreprocessing, const ExportProperties* pProperties)
|
||||
inline
|
||||
aiReturn Exporter :: Export( const aiScene* pScene, const std::string& pFormatId,
|
||||
const std::string& pPath, unsigned int pPreprocessing,
|
||||
const ExportProperties* pProperties)
|
||||
{
|
||||
return Export(pScene,pFormatId.c_str(),pPath.c_str(),pPreprocessing, pProperties);
|
||||
}
|
||||
|
||||
} // namespace Assimp
|
||||
|
||||
#endif // ASSIMP_BUILD_NO_EXPORT
|
||||
#endif // AI_EXPORT_HPP_INC
|
||||
|
|
Loading…
Reference in New Issue