review findings.

pull/3196/head
Kim Kulling 2020-04-29 20:33:37 +02:00
parent 2273160f2c
commit fd555a1349
3 changed files with 48 additions and 50 deletions

View File

@ -5,8 +5,6 @@ Open Asset Import Library (assimp)
Copyright (c) 2006-2020, assimp team Copyright (c) 2006-2020, assimp team
All rights reserved. All rights reserved.
Redistribution and use of this software in source and binary forms, Redistribution and use of this software in source and binary forms,

View File

@ -5,8 +5,6 @@ Open Asset Import Library (assimp)
Copyright (c) 2006-2020, assimp team Copyright (c) 2006-2020, assimp team
All rights reserved. All rights reserved.
Redistribution and use of this software in source and binary forms, Redistribution and use of this software in source and binary forms,

View File

@ -47,42 +47,42 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define AI_EXPORT_H_INC #define AI_EXPORT_H_INC
#ifdef __GNUC__ #ifdef __GNUC__
# pragma GCC system_header #pragma GCC system_header
#endif #endif
#ifndef ASSIMP_BUILD_NO_EXPORT #ifndef ASSIMP_BUILD_NO_EXPORT
// Public ASSIMP data structures
#include <assimp/types.h> #include <assimp/types.h>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
struct aiScene; // aiScene.h struct aiScene;
struct aiFileIO; // aiFileIO.h struct aiFileIO;
// -------------------------------------------------------------------------------- // --------------------------------------------------------------------------------
/** Describes an file format which Assimp can export to. Use #aiGetExportFormatCount() to /**
* learn how many export formats the current Assimp build supports and #aiGetExportFormatDescription() * @brief Describes an file format which Assimp can export to.
* to retrieve a description of an export format option. *
*/ * Use #aiGetExportFormatCount() to learn how many export-formats are supported by
struct aiExportFormatDesc * the current Assimp-build and #aiGetExportFormatDescription() to retrieve the
{ * description of the export format option.
*/
struct aiExportFormatDesc {
/// a short string ID to uniquely identify the export format. Use this ID string to /// a short string ID to uniquely identify the export format. Use this ID string to
/// specify which file format you want to export to when calling #aiExportScene(). /// specify which file format you want to export to when calling #aiExportScene().
/// Example: "dae" or "obj" /// Example: "dae" or "obj"
const char* id; const char *id;
/// A short description of the file format to present to users. Useful if you want /// A short description of the file format to present to users. Useful if you want
/// to allow the user to select an export format. /// to allow the user to select an export format.
const char* description; const char *description;
/// Recommended file extension for the exported file in lower case. /// Recommended file extension for the exported file in lower case.
const char* fileExtension; const char *fileExtension;
}; };
// -------------------------------------------------------------------------------- // --------------------------------------------------------------------------------
/** Returns the number of export file formats available in the current Assimp build. /** Returns the number of export file formats available in the current Assimp build.
* Use aiGetExportFormatDescription() to retrieve infos of a specific export format. * Use aiGetExportFormatDescription() to retrieve infos of a specific export format.
@ -97,14 +97,14 @@ ASSIMP_API size_t aiGetExportFormatCount(void);
* 0 to #aiGetExportFormatCount() * 0 to #aiGetExportFormatCount()
* @return A description of that specific export format. NULL if pIndex is out of range. * @return A description of that specific export format. NULL if pIndex is out of range.
*/ */
ASSIMP_API const C_STRUCT aiExportFormatDesc* aiGetExportFormatDescription( size_t pIndex); ASSIMP_API const C_STRUCT aiExportFormatDesc *aiGetExportFormatDescription(size_t pIndex);
// -------------------------------------------------------------------------------- // --------------------------------------------------------------------------------
/** Release a description of the nth export file format. Must be returned by /** Release a description of the nth export file format. Must be returned by
* aiGetExportFormatDescription * aiGetExportFormatDescription
* @param desc Pointer to the description * @param desc Pointer to the description
*/ */
ASSIMP_API void aiReleaseExportFormatDescription( const C_STRUCT aiExportFormatDesc *desc ); ASSIMP_API void aiReleaseExportFormatDescription(const C_STRUCT aiExportFormatDesc *desc);
// -------------------------------------------------------------------------------- // --------------------------------------------------------------------------------
/** Create a modifiable copy of a scene. /** Create a modifiable copy of a scene.
@ -115,13 +115,12 @@ ASSIMP_API void aiReleaseExportFormatDescription( const C_STRUCT aiExportFormatD
* @param pOut Receives a modifyable copy of the scene. Use aiFreeScene() to * @param pOut Receives a modifyable copy of the scene. Use aiFreeScene() to
* delete it again. * delete it again.
*/ */
ASSIMP_API void aiCopyScene(const C_STRUCT aiScene* pIn, ASSIMP_API void aiCopyScene(const C_STRUCT aiScene *pIn,
C_STRUCT aiScene** pOut); C_STRUCT aiScene **pOut);
// -------------------------------------------------------------------------------- // --------------------------------------------------------------------------------
/** Frees a scene copy created using aiCopyScene() */ /** Frees a scene copy created using aiCopyScene() */
ASSIMP_API void aiFreeScene(const C_STRUCT aiScene* pIn); ASSIMP_API void aiFreeScene(const C_STRUCT aiScene *pIn);
// -------------------------------------------------------------------------------- // --------------------------------------------------------------------------------
/** Exports the given scene to a chosen file format and writes the result file(s) to disk. /** Exports the given scene to a chosen file format and writes the result file(s) to disk.
@ -154,19 +153,18 @@ ASSIMP_API void aiFreeScene(const C_STRUCT aiScene* pIn);
* triangulate data so they would run the step anyway. * triangulate data so they would run the step anyway.
* *
* If assimp detects that the input scene was directly taken from the importer side of * 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), * the library (i.e. not copied using aiCopyScene and potentially modified afterwards),
* any postprocessing steps already applied to the scene will not be applied again, unless * any post-processing steps already applied to the scene will not be applied again, unless
* they show non-idempotent behaviour (#aiProcess_MakeLeftHanded, #aiProcess_FlipUVs and * they show non-idempotent behavior (#aiProcess_MakeLeftHanded, #aiProcess_FlipUVs and
* #aiProcess_FlipWindingOrder). * #aiProcess_FlipWindingOrder).
* @return a status code indicating the result of the export * @return a status code indicating the result of the export
* @note Use aiCopyScene() to get a modifiable copy of a previously * @note Use aiCopyScene() to get a modifiable copy of a previously
* imported scene. * imported scene.
*/ */
ASSIMP_API aiReturn aiExportScene( const C_STRUCT aiScene* pScene, ASSIMP_API aiReturn aiExportScene(const C_STRUCT aiScene *pScene,
const char* pFormatId, const char *pFormatId,
const char* pFileName, const char *pFileName,
unsigned int pPreprocessing); unsigned int pPreprocessing);
// -------------------------------------------------------------------------------- // --------------------------------------------------------------------------------
/** Exports the given scene to a chosen file format using custom IO logic supplied by you. /** Exports the given scene to a chosen file format using custom IO logic supplied by you.
@ -183,11 +181,11 @@ ASSIMP_API aiReturn aiExportScene( const C_STRUCT aiScene* pScene,
* @note Use aiCopyScene() to get a modifiable copy of a previously * @note Use aiCopyScene() to get a modifiable copy of a previously
* imported scene. * imported scene.
*/ */
ASSIMP_API aiReturn aiExportSceneEx( const C_STRUCT aiScene* pScene, ASSIMP_API aiReturn aiExportSceneEx(const C_STRUCT aiScene *pScene,
const char* pFormatId, const char *pFormatId,
const char* pFileName, const char *pFileName,
C_STRUCT aiFileIO* pIO, C_STRUCT aiFileIO *pIO,
unsigned int pPreprocessing ); unsigned int pPreprocessing);
// -------------------------------------------------------------------------------- // --------------------------------------------------------------------------------
/** Describes a blob of exported scene data. Use #aiExportSceneToBlob() to create a blob containing an /** Describes a blob of exported scene data. Use #aiExportSceneToBlob() to create a blob containing an
@ -199,13 +197,12 @@ ASSIMP_API aiReturn aiExportSceneEx( const C_STRUCT aiScene* pScene,
* This is used when exporters write more than one output file for a given #aiScene. See the remarks for * This is used when exporters write more than one output file for a given #aiScene. See the remarks for
* #aiExportDataBlob::name for more information. * #aiExportDataBlob::name for more information.
*/ */
struct aiExportDataBlob struct aiExportDataBlob {
{
/// Size of the data in bytes /// Size of the data in bytes
size_t size; size_t size;
/// The data. /// The data.
void* data; void *data;
/** Name of the blob. An empty string always /** Name of the blob. An empty string always
indicates the first (and primary) blob, indicates the first (and primary) blob,
@ -222,18 +219,23 @@ struct aiExportDataBlob
C_STRUCT aiString name; C_STRUCT aiString name;
/** Pointer to the next blob in the chain or NULL if there is none. */ /** Pointer to the next blob in the chain or NULL if there is none. */
C_STRUCT aiExportDataBlob * next; C_STRUCT aiExportDataBlob *next;
#ifdef __cplusplus #ifdef __cplusplus
/// Default constructor /// Default constructor
aiExportDataBlob() { size = 0; data = next = NULL; } aiExportDataBlob() {
size = 0;
data = next = nullptr;
}
/// Releases the data /// Releases the data
~aiExportDataBlob() { delete [] static_cast<unsigned char*>( data ); delete next; } ~aiExportDataBlob() {
delete[] static_cast<unsigned char *>(data);
delete next;
}
aiExportDataBlob(const aiExportDataBlob &) = delete;
aiExportDataBlob &operator=(const aiExportDataBlob &) = delete;
private:
// no copying
aiExportDataBlob(const aiExportDataBlob& );
aiExportDataBlob& operator= (const aiExportDataBlob& );
#endif // __cplusplus #endif // __cplusplus
}; };
@ -247,15 +249,15 @@ private:
* @param pPreprocessing Please see the documentation for #aiExportScene * @param pPreprocessing Please see the documentation for #aiExportScene
* @return the exported data or NULL in case of error * @return the exported data or NULL in case of error
*/ */
ASSIMP_API const C_STRUCT aiExportDataBlob* aiExportSceneToBlob( const C_STRUCT aiScene* pScene, const char* pFormatId, ASSIMP_API const C_STRUCT aiExportDataBlob *aiExportSceneToBlob(const C_STRUCT aiScene *pScene, const char *pFormatId,
unsigned int pPreprocessing ); unsigned int pPreprocessing);
// -------------------------------------------------------------------------------- // --------------------------------------------------------------------------------
/** Releases the memory associated with the given exported data. Use this function to free a data blob /** Releases the memory associated with the given exported data. Use this function to free a data blob
* returned by aiExportScene(). * returned by aiExportScene().
* @param pData the data blob returned by #aiExportSceneToBlob * @param pData the data blob returned by #aiExportSceneToBlob
*/ */
ASSIMP_API void aiReleaseExportBlob( const C_STRUCT aiExportDataBlob* pData ); ASSIMP_API void aiReleaseExportBlob(const C_STRUCT aiExportDataBlob *pData);
#ifdef __cplusplus #ifdef __cplusplus
} }