Imported D bindings into port/dAssimp.
git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@455 67173fc5-114c-0410-ac8e-9d2fd5bffc1fpull/1/head
parent
33011627a0
commit
746fb7549c
|
@ -0,0 +1,11 @@
|
|||
D bindings for the Assimp library (http://assimp.sf.net).
|
||||
---
|
||||
|
||||
These bindings provide access to Assimp's C API. They were directly created
|
||||
from the C header files.
|
||||
|
||||
You should be able to create sufficient DDoc documentation for the bindings
|
||||
using your favourite build tool (such as Rebuild). Please refer to the main
|
||||
(Doxygen-generated) documentation for general topics.
|
||||
|
||||
Please contact <klickverbot@gmail.com> for any bindings-specific issues.
|
|
@ -0,0 +1,236 @@
|
|||
/*
|
||||
---------------------------------------------------------------------------
|
||||
Open Asset Import Library (ASSIMP)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2009, ASSIMP Development Team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
with or without modification, are permitted provided that the following
|
||||
conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
* Neither the name of the ASSIMP team, nor the names of its
|
||||
contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior
|
||||
written permission of the ASSIMP Development Team.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
* The data structures which are used to store the imported animation data.
|
||||
*/
|
||||
module assimp.animation;
|
||||
|
||||
import assimp.math;
|
||||
import assimp.types;
|
||||
|
||||
extern ( C ) {
|
||||
/**
|
||||
* A time-value pair specifying a certain 3D vector for the given time.
|
||||
*/
|
||||
struct aiVectorKey {
|
||||
/**
|
||||
* The time of this key.
|
||||
*/
|
||||
double mTime;
|
||||
|
||||
/**
|
||||
* The value of this key.
|
||||
*/
|
||||
aiVector3D mValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* A time-value pair specifying a rotation for the given time. For joint
|
||||
* animations, the rotation is usually expressed using a quaternion.
|
||||
*/
|
||||
struct aiQuatKey {
|
||||
/**
|
||||
* The time of this key.
|
||||
*/
|
||||
double mTime;
|
||||
|
||||
/**
|
||||
* The value of this key.
|
||||
*/
|
||||
aiQuaternion mValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines how an animation channel behaves outside the defined time
|
||||
* range. This corresponds to <code>aiNodeAnim.mPreState</code> and
|
||||
* <code>aiNodeAnim.mPostState</code>.
|
||||
*/
|
||||
enum aiAnimBehaviour : uint {
|
||||
/**
|
||||
* The value from the default node transformation is used.
|
||||
*/
|
||||
DEFAULT = 0x0,
|
||||
|
||||
/**
|
||||
* The nearest key value is used without interpolation.
|
||||
*/
|
||||
CONSTANT = 0x1,
|
||||
|
||||
/**
|
||||
* The value of the nearest two keys is linearly extrapolated for the
|
||||
* current time value.
|
||||
*/
|
||||
LINEAR = 0x2,
|
||||
|
||||
/**
|
||||
* The animation is repeated.
|
||||
*
|
||||
* If the animation key go from n to m and the current time is t, use the
|
||||
* value at (t-n) % (|m-n|).
|
||||
*/
|
||||
REPEAT = 0x3
|
||||
}
|
||||
|
||||
/**
|
||||
* Describes the animation of a single node. The name specifies the
|
||||
* bone/node which is affected by this animation channel. The keyframes
|
||||
* are given in three separate series of values, one each for position,
|
||||
* rotation and scaling. The transformation matrix computed from these
|
||||
* values replaces the node's original transformation matrix at a
|
||||
* specific time. The order in which the transformations are applied is –
|
||||
* as usual – scaling, rotation, translation.
|
||||
*
|
||||
* Note: All keys are returned in their correct, chronological order.
|
||||
* Duplicate keys don't pass the validation step. Most likely there will
|
||||
* be no negative time values, but they are not forbidden (so you should
|
||||
* be able to handle them).
|
||||
*/
|
||||
struct aiNodeAnim {
|
||||
/**
|
||||
* The name of the node affected by this animation. The node must exist
|
||||
* and it must be unique.
|
||||
*/
|
||||
aiString mNodeName;
|
||||
|
||||
/**
|
||||
* The number of position keys.
|
||||
*/
|
||||
uint mNumPositionKeys;
|
||||
|
||||
/**
|
||||
* The position keys of this animation channel. Positions are specified
|
||||
* as 3D vectors. The array is <code>mNumPositionKeys</code> in size.
|
||||
*
|
||||
* If there are position keys, there will also be at least one scaling
|
||||
* and one rotation key.
|
||||
*/
|
||||
aiVectorKey* mPositionKeys;
|
||||
|
||||
/**
|
||||
* The number of rotation keys.
|
||||
*/
|
||||
uint mNumRotationKeys;
|
||||
|
||||
/**
|
||||
* The rotation keys of this animation channel. Rotations are given as
|
||||
* quaternions. The array is <code>mNumRotationKeys</code> in size.
|
||||
*
|
||||
* If there are rotation keys, there will also be at least one scaling
|
||||
* and one position key.
|
||||
*/
|
||||
aiQuatKey* mRotationKeys;
|
||||
|
||||
|
||||
/**
|
||||
* The number of scaling keys.
|
||||
*/
|
||||
uint mNumScalingKeys;
|
||||
|
||||
/**
|
||||
* The scaling keys of this animation channel. Scalings are specified as
|
||||
* 3D vectors. The array is <code>mNumScalingKeys</code> in size.
|
||||
*
|
||||
* If there are scaling keys, there will also be at least one position
|
||||
* and one rotation key.
|
||||
*/
|
||||
aiVectorKey* mScalingKeys;
|
||||
|
||||
|
||||
/**
|
||||
* Defines how the animation behaves before the first key is encountered.
|
||||
*
|
||||
* The default value is <code>aiAnimBehaviour.DEFAULT</code> (the original
|
||||
* transformation matrix of the affected node is used).
|
||||
*/
|
||||
aiAnimBehaviour mPreState;
|
||||
|
||||
/**
|
||||
* Defines how the animation behaves after the last key was processed.
|
||||
*
|
||||
* The default value is <code>aiAnimBehaviour.DEFAULT</code> (the original
|
||||
* transformation matrix of the affected node is used).
|
||||
*/
|
||||
aiAnimBehaviour mPostState;
|
||||
}
|
||||
|
||||
/**
|
||||
* An animation consists of keyframe data for a number of nodes.
|
||||
*
|
||||
* For each node affected by the animation, a separate series of data is
|
||||
* given.
|
||||
*/
|
||||
struct aiAnimation {
|
||||
/**
|
||||
* The name of the animation.
|
||||
*
|
||||
* If the modeling package this data was
|
||||
* exported from does support only a single animation channel, this
|
||||
* name is usually empty (length is zero).
|
||||
*/
|
||||
aiString mName;
|
||||
|
||||
/**
|
||||
* Duration of the animation in ticks.
|
||||
*/
|
||||
double mDuration;
|
||||
|
||||
/**
|
||||
* Ticks per second. 0 if not specified in the imported file.
|
||||
*/
|
||||
double mTicksPerSecond;
|
||||
|
||||
/**
|
||||
* The number of bone animation channels.
|
||||
*
|
||||
* Each channel affects a single node.
|
||||
*/
|
||||
uint mNumChannels;
|
||||
|
||||
/**
|
||||
* The node animation channels. The array is <code>mNumChannels</code>
|
||||
* in size.
|
||||
*
|
||||
* Each channel affects a single node.
|
||||
*/
|
||||
aiNodeAnim** mChannels;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,670 @@
|
|||
/*
|
||||
---------------------------------------------------------------------------
|
||||
Open Asset Import Library (ASSIMP)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2009, ASSIMP Development Team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
with or without modification, are permitted provided that the following
|
||||
conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
* Neither the name of the ASSIMP team, nor the names of its
|
||||
contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior
|
||||
written permission of the ASSIMP Development Team.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
* The C-style interface to the Open Asset import library.
|
||||
*
|
||||
* All functions of the C API have been collected in this module as function
|
||||
* pointers, which are set by the dynamic library loader
|
||||
* (<code>assimp.loader</code>).
|
||||
*/
|
||||
module assimp.api;
|
||||
|
||||
import assimp.fileIO;
|
||||
import assimp.material;
|
||||
import assimp.math;
|
||||
import assimp.scene;
|
||||
import assimp.types;
|
||||
|
||||
extern ( C ) {
|
||||
/**
|
||||
* Reads the given file and returns its content.
|
||||
*
|
||||
* If the call succeeds, the imported data is returned in an <code>aiScene</code>
|
||||
* structure. The data is intended to be read-only, it stays property of the
|
||||
* Assimp library and will be stable until <code>aiReleaseImport()</code> is
|
||||
* called. After you're done with it, call <code>aiReleaseImport()</code> to
|
||||
* free the resources associated with this file.
|
||||
*
|
||||
* If an error is encountered, null is returned instead. Call
|
||||
* <code>aiGetErrorString()</code> to retrieve a human-readable error
|
||||
* description.
|
||||
*
|
||||
* Params:
|
||||
* pFile = Path and filename of the file to be imported,
|
||||
* expected to be a null-terminated C-string. null is not a valid value.
|
||||
* pFlags = Optional post processing steps to be executed after a
|
||||
* successful import. Provide a bitwise combination of the
|
||||
* <code>aiPostProcessSteps</code> flags. If you wish to inspect the
|
||||
* imported scene first in order to fine-tune your post-processing
|
||||
* setup, consider to use <code>aiApplyPostProcessing()</code>.
|
||||
*
|
||||
* Returns:
|
||||
* A pointer to the imported data, null if the import failed.
|
||||
*/
|
||||
aiScene* function( char* pFile, uint pFile ) aiImportFile;
|
||||
|
||||
/**
|
||||
* Reads the given file using user-defined I/O functions and returns its
|
||||
* content.
|
||||
*
|
||||
* If the call succeeds, the imported data is returned in an <code>aiScene</code>
|
||||
* structure. The data is intended to be read-only, it stays property of the
|
||||
* Assimp library and will be stable until <code>aiReleaseImport()</code> is
|
||||
* called. After you're done with it, call <code>aiReleaseImport()</code> to
|
||||
* free the resources associated with this file.
|
||||
*
|
||||
* If an error is encountered, null is returned instead. Call
|
||||
* <code>aiGetErrorString()</code> to retrieve a human-readable error
|
||||
* description.
|
||||
*
|
||||
* Params:
|
||||
* pFile = Path and filename of the file to be imported,
|
||||
* expected to be a null-terminated C-string. null is not a valid value.
|
||||
* pFlags = Optional post processing steps to be executed after a
|
||||
* successful import. Provide a bitwise combination of the
|
||||
* <code>aiPostProcessSteps</code> flags. If you wish to inspect the
|
||||
* imported scene first in order to fine-tune your post-processing
|
||||
* setup, consider to use <code>aiApplyPostProcessing()</code>.
|
||||
* pFS = An aiFileIO which will be used to open the model file itself
|
||||
* and any other files the loader needs to open.
|
||||
*
|
||||
* Returns:
|
||||
* A pointer to the imported data, null if the import failed.
|
||||
*/
|
||||
aiScene* function( char* pFile, uint pFlags, aiFileIO* pFS ) aiImportFileEx;
|
||||
|
||||
/**
|
||||
* Reads the scene from the given memory buffer.
|
||||
*
|
||||
* Reads the given file using user-defined I/O functions and returns its
|
||||
* content.
|
||||
*
|
||||
* If the call succeeds, the imported data is returned in an <code>aiScene</code>
|
||||
* structure. The data is intended to be read-only, it stays property of the
|
||||
* Assimp library and will be stable until <code>aiReleaseImport()</code> is
|
||||
* called. After you're done with it, call <code>aiReleaseImport()</code> to
|
||||
* free the resources associated with this file.
|
||||
*
|
||||
* If an error is encountered, null is returned instead. Call
|
||||
* <code>aiGetErrorString()</code> to retrieve a human-readable error
|
||||
* description.
|
||||
*
|
||||
* Params:
|
||||
* pBuffer = Pointer to the scene data.
|
||||
* pLength = Size of pBuffer in bytes.
|
||||
* pFlags = Optional post processing steps to be executed after a
|
||||
* successful import. Provide a bitwise combination of the
|
||||
* <code>aiPostProcessSteps</code> flags. If you wish to inspect the
|
||||
* imported scene first in order to fine-tune your post-processing
|
||||
* setup, consider to use <code>aiApplyPostProcessing()</code>.
|
||||
* pHint = An additional hint to the library. If this is a non empty
|
||||
* string, the library looks for a loader to support the file
|
||||
* extension specified and passes the file to the first matching
|
||||
* loader. If this loader is unable to complete the request, the
|
||||
* library continues and tries to determine the file format on its
|
||||
* own, a task that may or may not be successful.
|
||||
*
|
||||
* Returns:
|
||||
* A pointer to the imported data, null if the import failed.
|
||||
*
|
||||
* Note:
|
||||
* This is a straightforward way to decode models from memory buffers,
|
||||
* but it doesn't handle model formats spreading their data across
|
||||
* multiple files or even directories. Examples include OBJ or MD3, which
|
||||
* outsource parts of their material stuff into external scripts. If you
|
||||
* need the full functionality, provide a custom IOSystem to make Assimp
|
||||
* find these files.
|
||||
*/
|
||||
aiScene* function(
|
||||
char* pBuffer,
|
||||
uint pLength,
|
||||
uint pFlags,
|
||||
char* pHint
|
||||
) aiImportFileFromMemory;
|
||||
|
||||
/**
|
||||
* Apply post-processing to an already-imported scene.
|
||||
*
|
||||
* This is strictly equivalent to calling <code>aiImportFile()</code> or
|
||||
* <code>aiImportFileEx()</code> with the same flags. However, you can use
|
||||
* this separate function to inspect the imported scene first to fine-tune
|
||||
* your post-processing setup.
|
||||
*
|
||||
* Params:
|
||||
* pScene = Scene to work on.
|
||||
* pFlags = Provide a bitwise combination of the
|
||||
* <code>aiPostProcessSteps</code> flags.
|
||||
*
|
||||
* Returns:
|
||||
* A pointer to the post-processed data. Post processing is done in-place,
|
||||
* meaning this is still the same <code>aiScene</code> which you passed
|
||||
* for pScene. However, if post-processing failed, the scene could now be
|
||||
* null. That's quite a rare case, post processing steps are not really
|
||||
* designed to fail. To be exact, <code>aiProcess.ValidateDS</code> is
|
||||
* currently the only post processing step which can actually cause the
|
||||
* scene to be reset to null.
|
||||
*/
|
||||
aiScene* function( aiScene* pScene, uint pFlags ) aiApplyPostProcessing;
|
||||
|
||||
/**
|
||||
* Get one of the predefined log streams. This is the quick'n'easy solution
|
||||
* to access Assimp's log system. Attaching a log stream can slightly reduce
|
||||
* Assimp's overall import performance.
|
||||
*
|
||||
* Examples:
|
||||
* ---
|
||||
* aiLogStream stream = aiGetPredefinedLogStream(
|
||||
* aiDefaultLogStream.FILE, "assimp.log.txt" );
|
||||
* if ( stream.callback !is null ) {
|
||||
* aiAttachLogStream( &stream );
|
||||
* }
|
||||
* ---
|
||||
*
|
||||
* Params:
|
||||
* pStreams = The log stream destination.
|
||||
* file = Solely for the <code>aiDefaultLogStream.FILE</code> flag:
|
||||
* specifies the file to write to. Pass null for all other flags.
|
||||
*
|
||||
* Returns:
|
||||
* The log stream, null if something went wrong.
|
||||
*/
|
||||
aiLogStream function( aiDefaultLogStream pStreams, char* file ) aiGetPredefinedLogStream;
|
||||
|
||||
/**
|
||||
* Attach a custom log stream to the libraries' logging system.
|
||||
*
|
||||
* Attaching a log stream can slightly reduce Assimp's overall import
|
||||
* performance. Multiple log-streams can be attached.
|
||||
*
|
||||
* Params:
|
||||
* stream = Describes the new log stream.
|
||||
*
|
||||
* Note: To ensure proper destruction of the logging system, you need to
|
||||
* manually call <code>aiDetachLogStream()</code> on every single log
|
||||
* stream you attach. Alternatively, <code>aiDetachAllLogStreams()</code>
|
||||
* is provided.
|
||||
*/
|
||||
void function( aiLogStream* stream ) aiAttachLogStream;
|
||||
|
||||
/**
|
||||
* Enable verbose logging.
|
||||
*
|
||||
* Verbose logging includes debug-related stuff and detailed import
|
||||
* statistics. This can have severe impact on import performance and memory
|
||||
* consumption. However, it might be useful to find out why a file is not
|
||||
* read correctly.
|
||||
*
|
||||
* Param:
|
||||
* d = Whether verbose logging should be enabled.
|
||||
*/
|
||||
void function( aiBool d ) aiEnableVerboseLogging;
|
||||
|
||||
/**
|
||||
* Detach a custom log stream from the libraries' logging system.
|
||||
*
|
||||
* This is the counterpart of #aiAttachPredefinedLogStream. If you attached a stream,
|
||||
* don't forget to detach it again.
|
||||
*
|
||||
* Params:
|
||||
* stream = The log stream to be detached.
|
||||
*
|
||||
* Returns:
|
||||
* <code>aiReturn.SUCCESS</code> if the log stream has been detached
|
||||
* successfully.
|
||||
*
|
||||
* See: <code>aiDetachAllLogStreams</code>
|
||||
*/
|
||||
aiReturn function( aiLogStream* stream ) aiDetachLogStream;
|
||||
|
||||
/**
|
||||
* Detach all active log streams from the libraries' logging system.
|
||||
*
|
||||
* This ensures that the logging system is terminated properly and all
|
||||
* resources allocated by it are actually freed. If you attached a stream,
|
||||
* don't forget to detach it again.
|
||||
*
|
||||
* See: <code>aiAttachLogStream</code>, <code>aiDetachLogStream</code>
|
||||
*/
|
||||
void function() aiDetachAllLogStreams;
|
||||
|
||||
/**
|
||||
* Releases all resources associated with the given import process.
|
||||
*
|
||||
* Call this function after you're done with the imported data.
|
||||
*
|
||||
* Params:
|
||||
* pScene = The imported data to release. null is a valid value.
|
||||
*/
|
||||
void function( aiScene* pScene ) aiReleaseImport;
|
||||
|
||||
/**
|
||||
* Returns the error text of the last failed import process.
|
||||
*
|
||||
* Returns:
|
||||
* A textual description of the error that occurred at the last importing
|
||||
* process. null if there was no error. There can't be an error if you
|
||||
* got a non-null <code>aiScene</code> from
|
||||
* <code>aiImportFile()/aiImportFileEx()/aiApplyPostProcessing()</code>.
|
||||
*/
|
||||
char* function() aiGetErrorString;
|
||||
|
||||
/**
|
||||
* Returns whether a given file extension is supported by this Assimp build.
|
||||
*
|
||||
* Params:
|
||||
* szExtension = Extension for which to query support. Must include a
|
||||
* leading dot '.'. Example: ".3ds", ".md3"
|
||||
*
|
||||
* Returns:
|
||||
* <code>TRUE</code> if the file extension is supported.
|
||||
*/
|
||||
aiBool function( char* szExtension ) aiIsExtensionSupported;
|
||||
|
||||
/**
|
||||
* Gets a list of all file extensions supported by ASSIMP.
|
||||
*
|
||||
* Format of the list: "*.3ds;*.obj;*.dae".
|
||||
*
|
||||
* If a file extension is contained in the list this does, of course, not
|
||||
* mean that Assimp is able to load all files with this extension.
|
||||
*
|
||||
* Params:
|
||||
* szOut = String to receive the extension list. null is not a valid
|
||||
* parameter.
|
||||
*/
|
||||
void function( aiString* szOut ) aiGetExtensionList;
|
||||
|
||||
/**
|
||||
* Gets the storage required by an imported asset
|
||||
*
|
||||
* Params:
|
||||
* pIn = Asset to query storage size for.
|
||||
* info = Data structure to be filled.
|
||||
*/
|
||||
void function( aiScene* pIn, aiMemoryInfo* info ) aiGetMemoryRequirements;
|
||||
|
||||
/**
|
||||
* Sets an integer property.
|
||||
*
|
||||
* Properties are always shared by all imports. It is not possible to
|
||||
* specify them per import.
|
||||
*
|
||||
* Params:
|
||||
* szName = Name of the configuration property to be set. All supported
|
||||
* public properties are defined in the <code>config</code> module.
|
||||
* value = New value for the property.
|
||||
*/
|
||||
void function( char* szName, int value ) aiSetImportPropertyInteger;
|
||||
|
||||
/**
|
||||
* Sets a floating-point property.
|
||||
*
|
||||
* Properties are always shared by all imports. It is not possible to
|
||||
* specify them per import.
|
||||
*
|
||||
* Params:
|
||||
* szName = Name of the configuration property to be set. All supported
|
||||
* public properties are defined in the <code>config</code> module.
|
||||
* value = New value for the property.
|
||||
*/
|
||||
void function( char* szName, float value ) aiSetImportPropertyFloat;
|
||||
|
||||
/**
|
||||
* Sets a string property.
|
||||
*
|
||||
* Properties are always shared by all imports. It is not possible to
|
||||
* specify them per import.
|
||||
*
|
||||
* Params:
|
||||
* szName = Name of the configuration property to be set. All supported
|
||||
* public properties are defined in the <code>config</code> module.
|
||||
* st = New value for the property.
|
||||
*/
|
||||
void function( char* szName, aiString* st ) aiSetImportPropertyString;
|
||||
|
||||
|
||||
/*
|
||||
* Mathematical helper functions.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Constructs a quaternion from a 3x3 rotation matrix.
|
||||
*
|
||||
* Params:
|
||||
* quat = Receives the output quaternion.
|
||||
* mat = Matrix to 'quaternionize'.
|
||||
*/
|
||||
void function( aiQuaternion* quat, aiMatrix3x3* mat ) aiCreateQuaternionFromMatrix;
|
||||
|
||||
/**
|
||||
* Decomposes a transformation matrix into its rotational, translational and
|
||||
* scaling components.
|
||||
*
|
||||
* Params:
|
||||
* mat = Matrix to decompose.
|
||||
* scaling = Receives the scaling component.
|
||||
* rotation = Receives the rotational component.
|
||||
* position = Receives the translational component.
|
||||
*/
|
||||
void function(
|
||||
aiMatrix4x4* mat,
|
||||
aiVector3D* scaling,
|
||||
aiQuaternion* rotation,
|
||||
aiVector3D* position
|
||||
) aiDecomposeMatrix;
|
||||
|
||||
/**
|
||||
* Transposes a 4x4 matrix (in-place).
|
||||
*
|
||||
* Params:
|
||||
* mat = The matrix to be transposed.
|
||||
*/
|
||||
void function( aiMatrix4x4* mat ) aiTransposeMatrix4;
|
||||
|
||||
/**
|
||||
* Transposes a 3x3 matrix (in-place).
|
||||
*
|
||||
* Params:
|
||||
* mat = The matrix to be transposed.
|
||||
*/
|
||||
void function( aiMatrix3x3* mat ) aiTransposeMatrix3;
|
||||
|
||||
/**
|
||||
* Transforms a vector by a 3x3 matrix (in-place).
|
||||
*
|
||||
* Params:
|
||||
* vec = Vector to be transformed.
|
||||
* mat = Matrix to transform the vector with.
|
||||
*/
|
||||
void function( aiVector3D* vec, aiMatrix3x3* mat ) aiTransformVecByMatrix3;
|
||||
|
||||
/**
|
||||
* Transforms a vector by a 4x4 matrix (in-place).
|
||||
*
|
||||
* Params:
|
||||
* vec = Vector to be transformed.
|
||||
* mat = Matrix to transform the vector with.
|
||||
*/
|
||||
void function( aiVector3D* vec, aiMatrix4x4* mat ) aiTransformVecByMatrix4;
|
||||
|
||||
/**
|
||||
* Multiplies two 4x4 matrices.
|
||||
*
|
||||
* Params:
|
||||
* dst = First factor, receives result.
|
||||
* src = Matrix to be multiplied with 'dst'.
|
||||
*/
|
||||
void function( aiMatrix4x4* dst, aiMatrix4x4* src ) aiMultiplyMatrix4;
|
||||
|
||||
/**
|
||||
* Multiplies two 3x3 matrices.
|
||||
*
|
||||
* Params:
|
||||
* dst = First factor, receives result.
|
||||
* src = Matrix to be multiplied with 'dst'.
|
||||
*/
|
||||
void function( aiMatrix3x3* dst, aiMatrix3x3* src ) aiMultiplyMatrix3;
|
||||
|
||||
/**
|
||||
* Constructs a 3x3 identity matrix.
|
||||
*
|
||||
* Params:
|
||||
* mat = Matrix to receive its personal identity.
|
||||
*/
|
||||
void function( aiMatrix3x3* mat ) aiIdentityMatrix3;
|
||||
|
||||
/**
|
||||
* Constructs a 4x4 identity matrix.
|
||||
*
|
||||
* Params:
|
||||
* mat = Matrix to receive its personal identity.
|
||||
*/
|
||||
void function( aiMatrix4x4* mat ) aiIdentityMatrix4;
|
||||
|
||||
|
||||
/*
|
||||
* Material system functions.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Retrieves a material property with a specific key from the material.
|
||||
*
|
||||
* Params:
|
||||
* pMat = Pointer to the input material. May not be null.
|
||||
* pKey = Key to search for. One of the <code>AI_MATKEY_XXX</code>
|
||||
* constants.
|
||||
* type = Specifies the <code>aiTextureType</code> of the texture to be
|
||||
* retrieved, 0 for non-texture properties.
|
||||
* index = Index of the texture to be retrieved,
|
||||
* 0 for non-texture properties.
|
||||
* pPropOut = Pointer to receive a pointer to a valid
|
||||
* <code>aiMaterialProperty</code> structure or null if the key has
|
||||
* not been found.
|
||||
*/
|
||||
aiReturn function(
|
||||
aiMaterial* pMat,
|
||||
char* pKey,
|
||||
aiTextureType type,
|
||||
uint index,
|
||||
aiMaterialProperty** pPropOut
|
||||
) aiGetMaterialProperty;
|
||||
|
||||
/**
|
||||
* Retrieves a single float value or an array of float values from the
|
||||
* material.
|
||||
*
|
||||
* Examples:
|
||||
* ---
|
||||
* const FLOATS_IN_UV_TRANSFORM = ( aiUVTransform.sizeof / float.sizeof );
|
||||
* uint valuesRead = FLOATS_IN_UV_TRANSFORM;
|
||||
* bool success =
|
||||
* ( aiGetMaterialFloatArray( &material, AI_MATKEY_UVTRANSFORM,
|
||||
* aiTextureType.DIFFUSE, 0, cast( float* ) &trafo, &valuesRead ) ==
|
||||
* aiReturn.SUCCESS ) &&
|
||||
* ( valuesRead == FLOATS_IN_UV_TRANSFORM );
|
||||
* ---
|
||||
*
|
||||
* Params:
|
||||
* pMat = Pointer to the input material. May not be null.
|
||||
* pKey = Key to search for. One of the AI_MATKEY_XXX constants.
|
||||
* type = Specifies the <code>aiTextureType</code> of the texture to be
|
||||
* retrieved, 0 for non-texture properties.
|
||||
* index = Index of the texture to be retrieved,
|
||||
* 0 for non-texture properties.
|
||||
* pOut = Pointer to a buffer to receive the result.
|
||||
* pMax = Specifies the size of the given buffer in floats. Receives the
|
||||
* number of values (not bytes!) read. null to read a scalar property.
|
||||
*
|
||||
* Returns:
|
||||
* Specifies whether the key has been found. If not, the output arrays
|
||||
* remains unmodified and pMax is set to 0.
|
||||
*/
|
||||
aiReturn function(
|
||||
aiMaterial* pMat,
|
||||
char* pKey,
|
||||
uint type,
|
||||
uint index,
|
||||
float* pOut,
|
||||
uint* pMax = null
|
||||
) aiGetMaterialFloatArray;
|
||||
|
||||
/**
|
||||
* Convenience alias for <code>aiGetMaterialFloatArray()</code>.
|
||||
*/
|
||||
alias aiGetMaterialFloatArray aiGetMaterialFloat;
|
||||
|
||||
/**
|
||||
* Retrieves a single integer value or an array of integer values from the
|
||||
* material.
|
||||
*
|
||||
* See: <code>aiGetMaterialFloatArray()</code>
|
||||
*/
|
||||
aiReturn function(
|
||||
aiMaterial* pMat,
|
||||
char* pKey,
|
||||
uint type,
|
||||
uint index,
|
||||
int* pOut,
|
||||
uint* pMax = null
|
||||
) aiGetMaterialIntegerArray;
|
||||
|
||||
/**
|
||||
* Convenience alias for <code>aiGetMaterialIntegerArray()</code>.
|
||||
*/
|
||||
alias aiGetMaterialIntegerArray aiGetMaterialInteger;
|
||||
|
||||
/**
|
||||
* Retrieves a color value from the material.
|
||||
*
|
||||
* See: <code>aiGetMaterialFloatArray()</code>
|
||||
*/
|
||||
aiReturn function(
|
||||
aiMaterial* pMat,
|
||||
char* pKey,
|
||||
uint type,
|
||||
uint index,
|
||||
aiColor4D* pOut
|
||||
) aiGetMaterialColor;
|
||||
|
||||
/**
|
||||
* Retrieves a string value from the material.
|
||||
*
|
||||
* See: <code>aiGetMaterialFloatArray()</code>
|
||||
*/
|
||||
aiReturn function(
|
||||
aiMaterial* pMat,
|
||||
char* pKey,
|
||||
uint type,
|
||||
uint index,
|
||||
aiString* pOut
|
||||
) aiGetMaterialString;
|
||||
|
||||
/**
|
||||
* Helper function for retrieving a texture from the material.
|
||||
*
|
||||
* This function is provided just for convenience. You could also read the
|
||||
* texture by reading all of its properties manually. This function bundles
|
||||
* all of them in a huge function-monster.
|
||||
*
|
||||
* Params:
|
||||
* mat = Pointer to the input material. May not be null.
|
||||
* type = Specifies the <code>aiTextureType</code> of the texture to be
|
||||
* retrieved.
|
||||
* index = Index of the texture to be retrieved.
|
||||
* path = Receives the output path. null is not a valid value.
|
||||
* mapping = Recieves the texture mapping mode to be used.
|
||||
* Pass null if you are not interested in this information.
|
||||
* uvindex = For UV-mapped textures: receives the index of the UV source
|
||||
* channel. Unmodified otherwise. Pass null if you are not interested
|
||||
* in this information.
|
||||
* blend = Receives the blend factor for the texture.
|
||||
* Pass null if you are not interested in this information.
|
||||
* op = Receives the texture blend operation to be perform between this
|
||||
* texture and the previous texture. Pass null if you are not
|
||||
* interested in this information.
|
||||
* mapmode = Receives the mapping modes to be used for the texture. Pass
|
||||
* a pointer to an array of two aiTextureMapMode's (one for each axis,
|
||||
* UV order) or null if you are not interested in this information.
|
||||
*
|
||||
* Returns:
|
||||
* <code>aiReturn.SUCCESS</code> on success, something else otherwise.
|
||||
*/
|
||||
aiReturn function(
|
||||
aiMaterial* mat,
|
||||
aiTextureType type,
|
||||
uint index,
|
||||
aiString* path,
|
||||
aiTextureMapping* mapping = null,
|
||||
uint* uvindex = null,
|
||||
float* blend = null,
|
||||
aiTextureOp* op = null,
|
||||
aiTextureMapMode* mapmode = null
|
||||
) aiGetMaterialTexture;
|
||||
|
||||
|
||||
/*
|
||||
* Versioning functions.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Returns a string with legal copyright and licensing information about
|
||||
* Assimp.
|
||||
*
|
||||
* The string may include multiple lines.
|
||||
*
|
||||
* Returns:
|
||||
* Pointer to static string.
|
||||
*/
|
||||
char* function() aiGetLegalString;
|
||||
|
||||
/**
|
||||
* Returns the current minor version number of the Assimp library.
|
||||
*
|
||||
* Returns:
|
||||
* Minor version of the Assimp library.
|
||||
*/
|
||||
uint function() aiGetVersionMinor;
|
||||
|
||||
/**
|
||||
* Returns the current major version number of the Assimp library.
|
||||
*
|
||||
* Returns:
|
||||
* Major version of the Assimp library.
|
||||
*/
|
||||
uint function() aiGetVersionMajor;
|
||||
|
||||
/**
|
||||
* Returns the repository revision of the Assimp library.
|
||||
*
|
||||
* Returns:
|
||||
* SVN Repository revision number of the Assimp library.
|
||||
*/
|
||||
uint function() aiGetVersionRevision;
|
||||
|
||||
/**
|
||||
* Returns the flags Assimp was compiled with.
|
||||
*
|
||||
* Returns:
|
||||
* Any bitwise combination of the ASSIMP_CFLAGS_xxx constants.
|
||||
*/
|
||||
uint function() aiGetCompileFlags;
|
||||
}
|
|
@ -0,0 +1,63 @@
|
|||
/*
|
||||
---------------------------------------------------------------------------
|
||||
Open Asset Import Library (ASSIMP)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2009, ASSIMP Development Team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
with or without modification, are permitted provided that the following
|
||||
conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
* Neither the name of the ASSIMP team, nor the names of its
|
||||
contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior
|
||||
written permission of the ASSIMP Development Team.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
* Include-all module provided for convenience.
|
||||
*/
|
||||
module assimp.assimp;
|
||||
|
||||
public {
|
||||
import assimp.animation;
|
||||
import assimp.api;
|
||||
import assimp.camera;
|
||||
import assimp.config;
|
||||
import assimp.fileIO;
|
||||
import assimp.light;
|
||||
import assimp.loader;
|
||||
import assimp.material;
|
||||
import assimp.math;
|
||||
import assimp.mesh;
|
||||
import assimp.postprocess;
|
||||
import assimp.scene;
|
||||
import assimp.texture;
|
||||
import assimp.types;
|
||||
import assimp.versionInfo;
|
||||
}
|
|
@ -0,0 +1,182 @@
|
|||
/*
|
||||
---------------------------------------------------------------------------
|
||||
Open Asset Import Library (ASSIMP)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2009, ASSIMP Development Team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
with or without modification, are permitted provided that the following
|
||||
conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
* Neither the name of the ASSIMP team, nor the names of its
|
||||
contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior
|
||||
written permission of the ASSIMP Development Team.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
* Contains the data structure which is used to store the imported information
|
||||
* about the virtual cameras in the scene.
|
||||
*/
|
||||
module assimp.camera;
|
||||
|
||||
import assimp.math;
|
||||
import assimp.types;
|
||||
|
||||
extern ( C ) {
|
||||
/**
|
||||
* Helper structure to describe a virtual camera.
|
||||
*
|
||||
* Cameras have a representation in the node graph and can be animated.
|
||||
* An important aspect is that the camera itself is also part of the
|
||||
* scenegraph. This means, any values such as the look-at vector are not
|
||||
* absolute, they're <em>relative</em> to the coordinate system defined
|
||||
* by the node which corresponds to the camera. This allows for camera
|
||||
* animations. Static cameras parameters like the look-at or up vectors are
|
||||
* usually specified directly in the class members, but beware, they could
|
||||
* also be encoded in the node transformation. The following (pseudo)code
|
||||
* sample shows how to do it.
|
||||
*
|
||||
* Examples:
|
||||
* ---
|
||||
* // Get the camera matrix for a camera at a specific time
|
||||
* // if the node hierarchy for the camera does not contain
|
||||
* // at least one animated node this is a static computation
|
||||
* get-camera-matrix (node sceneRoot, camera cam) : matrix
|
||||
* {
|
||||
* node cnd = find-node-for-camera(cam)
|
||||
* matrix cmt = identity()
|
||||
*
|
||||
* // as usual - get the absolute camera transformation for this frame
|
||||
* for each node nd in hierarchy from sceneRoot to cnd
|
||||
* matrix cur
|
||||
* if (is-animated(nd))
|
||||
* cur = eval-animation(nd)
|
||||
* else cur = nd->mTransformation;
|
||||
* cmt = mult-matrices( cmt, cur )
|
||||
* end for
|
||||
*
|
||||
* // now multiply with the camera's own local transform
|
||||
* cam = mult-matrices (cam, get-camera-matrix(cmt) )
|
||||
* }
|
||||
* ---
|
||||
*
|
||||
* Note: Some file formats (such as 3DS, ASE) export a "target point" – the
|
||||
* point the camera is looking at (it can even be animated). Assimp
|
||||
* writes the target point as a subnode of the camera's main node, called
|
||||
* "<camName>.Target". However, this is just additional information; the
|
||||
* transformation applied to the main camera node already makes the
|
||||
* camera face the right direction.
|
||||
*/
|
||||
struct aiCamera {
|
||||
/**
|
||||
* The name of the camera.
|
||||
*
|
||||
* There must be a node in the scenegraph with the same name. This node
|
||||
* specifies the position of the camera in the scene hierarchy and can
|
||||
* be animated.
|
||||
*/
|
||||
aiString mName;
|
||||
|
||||
|
||||
/**
|
||||
* Position of the camera relative to the coordinate space defined by the
|
||||
* corresponding node.
|
||||
*
|
||||
* The default value is 0|0|0.
|
||||
*/
|
||||
aiVector3D mPosition;
|
||||
|
||||
/**
|
||||
* Up vector of the camera coordinate system relative to the
|
||||
* coordinate space defined by the corresponding node.
|
||||
*
|
||||
* The right vector of the camera coordinate system is the cross
|
||||
* product of the up and lookAt vectors.
|
||||
*
|
||||
* The default value is 0|1|0. The vector may be normalized, but it
|
||||
* needn't.
|
||||
*/
|
||||
aiVector3D mUp;
|
||||
|
||||
/**
|
||||
* Look-at vector of the camera coordinate system relative to the
|
||||
* coordinate space defined by the corresponding node.
|
||||
*
|
||||
* This is the viewing direction of the user.
|
||||
*
|
||||
* The default value is 0|0|1. The vector may be normalized, but it
|
||||
* needn't.
|
||||
*/
|
||||
aiVector3D mLookAt;
|
||||
|
||||
|
||||
/**
|
||||
* Half horizontal field of view angle, in radians.
|
||||
*
|
||||
* The field of view angle is the angle between the center line of the
|
||||
* screen and the left or right border.
|
||||
*
|
||||
* The default value is PI/4.
|
||||
*/
|
||||
float mHorizontalFOV;
|
||||
|
||||
/**
|
||||
* Distance of the near clipping plane from the camera.
|
||||
*
|
||||
* The value may not be 0.f (for arithmetic reasons to prevent
|
||||
* a division through zero).
|
||||
*
|
||||
* The default value is 0.1f.
|
||||
*/
|
||||
float mClipPlaneNear;
|
||||
|
||||
/**
|
||||
* Distance of the far clipping plane from the camera.
|
||||
*
|
||||
* The far clipping plane must, of course, be further away than the
|
||||
* near clipping plane. The ratio between the near and the far plane
|
||||
* should not be too large (between 1000-10000 should be ok) to avoid
|
||||
* floating-point inaccuracies which could lead to z-fighting.
|
||||
*
|
||||
* The default value is 1000.f.
|
||||
*/
|
||||
float mClipPlaneFar;
|
||||
|
||||
/**
|
||||
* Screen aspect ratio.
|
||||
*
|
||||
* This is the ration between the width and the height of the
|
||||
* screen. Typical values are 4/3, 1/2 or 1/1. This value is
|
||||
* 0 if the aspect ratio is not defined in the source file.
|
||||
*
|
||||
* 0 is also the default value.
|
||||
*/
|
||||
float mAspect;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,626 @@
|
|||
/*
|
||||
---------------------------------------------------------------------------
|
||||
Open Asset Import Library (ASSIMP)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2009, ASSIMP Development Team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
with or without modification, are permitted provided that the following
|
||||
conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
* Neither the name of the ASSIMP team, nor the names of its
|
||||
contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior
|
||||
written permission of the ASSIMP Development Team.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
* Defines constants for configurable properties for the library.
|
||||
*
|
||||
* These are set via <code>aiSetImportPropertyInteger()</code>,
|
||||
* <code>aiSetImportPropertyFloat()</code> and
|
||||
* <code>aiSetImportPropertyString()</code>.
|
||||
*/
|
||||
module assimp.config;
|
||||
|
||||
extern ( C ) {
|
||||
/*
|
||||
* Post processing settings.
|
||||
*
|
||||
* Various options to fine-tune the behavior of a specific post processing step.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Specifies the maximum angle that may be between two vertex tangents that
|
||||
* their tangents and bitangents are smoothed.
|
||||
*
|
||||
* This applies to the <code>CalcTangentSpace</code> step. The angle is
|
||||
* specified in degrees, so 180 corresponds to PI radians.
|
||||
*
|
||||
* The default value is 45, the maximum value is 175.
|
||||
*
|
||||
* Property type: float.
|
||||
*/
|
||||
const char* AI_CONFIG_PP_CT_MAX_SMOOTHING_ANGLE = "PP_CT_MAX_SMOOTHING_ANGLE";
|
||||
|
||||
/**
|
||||
* Specifies the maximum angle that may be between two face normals at the
|
||||
* same vertex position that their are smoothed together. Sometimes referred
|
||||
* to as 'crease angle'.
|
||||
*
|
||||
* This applies to the <code>GenSmoothNormals</code> step. The angle is
|
||||
* specified in degrees, so 180 corresponds to PI radians.
|
||||
*
|
||||
* The default value is 175 degrees (all vertex normals are smoothed), the
|
||||
* maximum value is 175, too.
|
||||
*
|
||||
* Property type: float.
|
||||
*
|
||||
* Warning:
|
||||
* Setting this option may cause a severe loss of performance. The
|
||||
* performance is unaffected if the <code>AI_CONFIG_FAVOUR_SPEED</code>
|
||||
* flag is set but the output quality may be reduced.
|
||||
*/
|
||||
const char* AI_CONFIG_PP_GSN_MAX_SMOOTHING_ANGLE = "PP_GSN_MAX_SMOOTHING_ANGLE";
|
||||
|
||||
/**
|
||||
* Sets the colormap (= palette) to be used to decode embedded textures in
|
||||
* MDL (Quake or 3DGS) files.
|
||||
*
|
||||
* This must be a valid path to a file. The file is 768 (256*3) bytes large
|
||||
* and contains RGB triplets for each of the 256 palette entries. The
|
||||
* default value is colormap.lmp. If the file is not found, a default
|
||||
* palette (from Quake 1) is used.
|
||||
*
|
||||
* Property type: string.
|
||||
*/
|
||||
const char* AI_CONFIG_IMPORT_MDL_COLORMAP = "IMPORT_MDL_COLORMAP";
|
||||
|
||||
/**
|
||||
* Configures the <code>RemoveRedundantMaterials</code> step to keep
|
||||
* materials matching a name in a given list.
|
||||
*
|
||||
* This is a list of 1 to n strings, ' ' serves as delimiter character.
|
||||
* Identifiers containing whitespaces must be enclosed in <em>single</em>
|
||||
* quotation marks. For example: <code>
|
||||
* "keep-me and_me_to anotherMaterialToBeKept \'name with whitespace\'"</code>.
|
||||
* Linefeeds, tabs or carriage returns are treated as whitespace.
|
||||
*
|
||||
* If a material matches on of these names, it will not be modified or
|
||||
* removed by the postprocessing step nor will other materials be replaced
|
||||
* by a reference to it.
|
||||
*
|
||||
* This option might be useful if you are using some magic material names
|
||||
* to pass additional semantics through the content pipeline. This ensures
|
||||
* they won't be optimized away, but a general optimization is still
|
||||
* performed for materials not contained in the list.
|
||||
*
|
||||
* Default value: n/a
|
||||
*
|
||||
* Property type: string.
|
||||
*
|
||||
* Note: Material names are case sensitive.
|
||||
*/
|
||||
const char* AI_CONFIG_PP_RRM_EXCLUDE_LIST = "PP_RRM_EXCLUDE_LIST";
|
||||
|
||||
/**
|
||||
* Configures the <code>PretransformVertices</code> step to keep the scene
|
||||
* hierarchy. Meshes are moved to worldspace, but no optimization is
|
||||
* performed (means: meshes are not joined. The total number of meshes won't
|
||||
* change).
|
||||
*
|
||||
* This option could be of use for you if the scene hierarchy contains
|
||||
* important additional information which you want to interpret.
|
||||
* For rendering, you can still render all meshes in the scene without
|
||||
* any transformations.
|
||||
*
|
||||
* Default value: false.
|
||||
*
|
||||
* Property type: integer (0: false; !0: true).
|
||||
*/
|
||||
const char* AI_CONFIG_PP_PTV_KEEP_HIERARCHY = "PP_PTV_KEEP_HIERARCHY";
|
||||
|
||||
/**
|
||||
* Configures the <code>FindDegenerates</code> step to remove degenerated
|
||||
* primitives from the import – immediately.
|
||||
*
|
||||
* The default behaviour converts degenerated triangles to lines and
|
||||
* degenerated lines to points. See the documentation to the
|
||||
* <code>FindDegenerates</code> step for a detailed example of the various
|
||||
* ways to get rid of these lines and points if you don't want them.
|
||||
*
|
||||
* Default value: false.
|
||||
*
|
||||
* Property type: integer (0: false; !0: true).
|
||||
*/
|
||||
const char* AI_CONFIG_PP_FD_REMOVE = "PP_FD_REMOVE";
|
||||
|
||||
/**
|
||||
* Configures the <code>OptimizeGraph</code> step to preserve nodes matching
|
||||
* a name in a given list.
|
||||
*
|
||||
* This is a list of 1 to n strings, ' ' serves as delimiter character.
|
||||
* Identifiers containing whitespaces must be enclosed in <em>single</em>
|
||||
* quotation marks. For example: <code>
|
||||
* "keep-me and_me_to anotherMaterialToBeKept \'name with whitespace\'"</code>.
|
||||
* Linefeeds, tabs or carriage returns are treated as whitespace.
|
||||
*
|
||||
* If a node matches on of these names, it will not be modified or
|
||||
* removed by the postprocessing step.
|
||||
*
|
||||
* This option might be useful if you are using some magic node names
|
||||
* to pass additional semantics through the content pipeline. This ensures
|
||||
* they won't be optimized away, but a general optimization is still
|
||||
* performed for nodes not contained in the list.
|
||||
*
|
||||
* Default value: n/a
|
||||
*
|
||||
* Property type: string.
|
||||
*
|
||||
* Note: Node names are case sensitive.
|
||||
*/
|
||||
const char* AI_CONFIG_PP_OG_EXCLUDE_LIST = "PP_OG_EXCLUDE_LIST";
|
||||
|
||||
/**
|
||||
* Sets the maximum number of triangles in a mesh.
|
||||
*
|
||||
* This is used by the <code>SplitLargeMeshes</code> step to determine
|
||||
* whether a mesh must be split or not.
|
||||
*
|
||||
* Default value: AI_SLM_DEFAULT_MAX_TRIANGLES.
|
||||
*
|
||||
* Property type: integer.
|
||||
*/
|
||||
const char* AI_CONFIG_PP_SLM_TRIANGLE_LIMIT = "PP_SLM_TRIANGLE_LIMIT";
|
||||
|
||||
/**
|
||||
* The default value for the AI_CONFIG_PP_SLM_TRIANGLE_LIMIT setting.
|
||||
*/
|
||||
const AI_SLM_DEFAULT_MAX_TRIANGLES = 1000000;
|
||||
|
||||
/**
|
||||
* Sets the maximum number of vertices in a mesh.
|
||||
*
|
||||
* This is used by the <code>SplitLargeMeshes</code> step to determine
|
||||
* whether a mesh must be split or not.
|
||||
*
|
||||
* Default value: AI_SLM_DEFAULT_MAX_VERTICES
|
||||
*
|
||||
* Property type: integer.
|
||||
*/
|
||||
const char* AI_CONFIG_PP_SLM_VERTEX_LIMIT = "PP_SLM_VERTEX_LIMIT";
|
||||
|
||||
/**
|
||||
* The default value for the AI_CONFIG_PP_SLM_VERTEX_LIMIT setting.
|
||||
*/
|
||||
const AI_SLM_DEFAULT_MAX_VERTICES = 1000000;
|
||||
|
||||
/**
|
||||
* Sets the maximum number of bones affecting a single vertex.
|
||||
*
|
||||
* This is used by the <code>LimitBoneWeights</code> step.
|
||||
*
|
||||
* Default value: AI_LBW_MAX_WEIGHTS
|
||||
*
|
||||
* Property type: integer.
|
||||
*/
|
||||
const char* AI_CONFIG_PP_LBW_MAX_WEIGHTS = "PP_LBW_MAX_WEIGHTS";
|
||||
|
||||
/**
|
||||
* The default value for the AI_CONFIG_PP_LBW_MAX_WEIGHTS setting.
|
||||
*/
|
||||
const AI_LMW_MAX_WEIGHTS = 0x4;
|
||||
|
||||
/**
|
||||
* Sets the size of the post-transform vertex cache to optimize the
|
||||
* vertices for. This configures the <code>ImproveCacheLocality</code> step.
|
||||
*
|
||||
* The size is given in vertices. Of course you can't know how the vertex
|
||||
* format will exactly look like after the import returns, but you can still
|
||||
* guess what your meshes will probably have.
|
||||
*
|
||||
* The default value results in slight performance improvements for most
|
||||
* nVidia/AMD cards since 2002.
|
||||
*
|
||||
* Default value: PP_ICL_PTCACHE_SIZE
|
||||
*
|
||||
* Property type: integer.
|
||||
*/
|
||||
const char* AI_CONFIG_PP_ICL_PTCACHE_SIZE = "PP_ICL_PTCACHE_SIZE";
|
||||
|
||||
/**
|
||||
* The default value for the AI_CONFIG_PP_ICL_PTCACHE_SIZE config option.
|
||||
*/
|
||||
const PP_ICL_PTCACHE_SIZE = 12;
|
||||
|
||||
/**
|
||||
* Components of the <code>aiScene</code> and <code>aiMesh</code> data
|
||||
* structures that can be excluded from the import by using the
|
||||
* <code>RemoveComponent</code> step.
|
||||
*
|
||||
* See the documentation to <code>RemoveComponent</code> for more details.
|
||||
*/
|
||||
enum aiComponent : uint {
|
||||
/**
|
||||
* Normal vectors.
|
||||
*/
|
||||
NORMALS = 0x2,
|
||||
|
||||
/**
|
||||
* Tangents and bitangents.
|
||||
*/
|
||||
TANGENTS_AND_BITANGENTS = 0x4,
|
||||
|
||||
/**
|
||||
* <em>All</em> color sets.
|
||||
*
|
||||
* Use aiComponent_COLORSn( N ) to specify the N'th set.
|
||||
*/
|
||||
COLORS = 0x8,
|
||||
|
||||
/**
|
||||
* <em>All</em> texture UV coordinate sets.
|
||||
*
|
||||
* Use aiComponent_TEXCOORDn( N ) to specify the N'th set.
|
||||
*/
|
||||
TEXCOORDS = 0x10,
|
||||
|
||||
/**
|
||||
* Bone weights from all meshes.
|
||||
*
|
||||
* The corresponding scenegraph nodes are <em>not</em> removed. Use the
|
||||
* <code>OptimizeGraph</code> step to do this.
|
||||
*/
|
||||
BONEWEIGHTS = 0x20,
|
||||
|
||||
/**
|
||||
* Node animations (<code>aiScene.mAnimations</code>).
|
||||
*
|
||||
* The corresponding scenegraph nodes are <em>not</em> removed. Use the
|
||||
* <code>OptimizeGraph</code> step to do this.
|
||||
*/
|
||||
ANIMATIONS = 0x40,
|
||||
|
||||
/**
|
||||
* Embedded textures (<code>aiScene.mTextures</code>).
|
||||
*/
|
||||
TEXTURES = 0x80,
|
||||
|
||||
/**
|
||||
* Light sources (<code>aiScene.mLights</code>).
|
||||
*
|
||||
* The corresponding scenegraph nodes are <em>not</em> removed. Use the
|
||||
* <code>OptimizeGraph</code> step to do this.
|
||||
*/
|
||||
LIGHTS = 0x100,
|
||||
|
||||
/**
|
||||
* Cameras (<code>aiScene.mCameras</code>).
|
||||
*
|
||||
* The corresponding scenegraph nodes are <em>not</em> removed. Use the
|
||||
* <code>OptimizeGraph</code> step to do this.
|
||||
*/
|
||||
CAMERAS = 0x200,
|
||||
|
||||
/**
|
||||
* Meshes (<code>aiScene.mMeshes</code>).
|
||||
*/
|
||||
MESHES = 0x400,
|
||||
|
||||
/** Materials.
|
||||
*
|
||||
* One default material will be generated, so
|
||||
* <code>aiScene.mNumMaterials</code> will be 1.
|
||||
*/
|
||||
MATERIALS = 0x800
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies a certain color channel to remove.
|
||||
*/
|
||||
uint aiComponent_COLORSn( uint n ) { return 1u << ( n + 20u ); }
|
||||
|
||||
/**
|
||||
* Specifies a certain UV coordinate channel to remove.
|
||||
*/
|
||||
uint aiComponent_TEXCOORDSn( uint n ) { return 1u << ( n + 25u ); }
|
||||
|
||||
/**
|
||||
* Input parameter to the <code>RemoveComponent</code> step:
|
||||
* Specifies the parts of the data structure to be removed.
|
||||
*
|
||||
* See the documentation to this step for further details.
|
||||
*
|
||||
* Default value: 0
|
||||
*
|
||||
* Property type: integer (bitwise combination of <code>aiComponent</code>
|
||||
* flags).
|
||||
*
|
||||
* Note: If no valid mesh is remaining after the step has been executed, the
|
||||
* import <em>fails</em>, because there is no data to work on anymore.
|
||||
*/
|
||||
const char* AI_CONFIG_PP_RVC_FLAGS = "PP_RVC_FLAGS";
|
||||
|
||||
/**
|
||||
* Input parameter to the <code>SortByPType</code> step:
|
||||
* Specifies which primitive types are removed by the step.
|
||||
*
|
||||
* This is a bitwise combination of the <code>aiPrimitiveType</code> flags.
|
||||
* Specifying all of them is illegal, of course. A typical use would be to
|
||||
* exclude all line and point meshes from the import.
|
||||
*
|
||||
* Default value: 0
|
||||
*
|
||||
* Property type: integer.
|
||||
*/
|
||||
const char* AI_CONFIG_PP_SBP_REMOVE = "PP_SBP_REMOVE";
|
||||
|
||||
|
||||
/**
|
||||
* The <code>TransformUVCoords</code> step evaluates UV scalings.
|
||||
*/
|
||||
const AI_UVTRAFO_SCALING = 0x1;
|
||||
|
||||
/**
|
||||
* The <code>TransformUVCoords</code> step evaluates UV rotations.
|
||||
*/
|
||||
const AI_UVTRAFO_ROTATION = 0x2;
|
||||
|
||||
/**
|
||||
* The <code>TransformUVCoords</code> step evaluates UV translation.
|
||||
*/
|
||||
const AI_UVTRAFO_TRANSLATION = 0x4;
|
||||
|
||||
/**
|
||||
* The <code>TransformUVCoords</code> step evaluates all UV translations.
|
||||
*/
|
||||
const AI_UVTRAFO_ALL =
|
||||
AI_UVTRAFO_SCALING
|
||||
| AI_UVTRAFO_ROTATION
|
||||
| AI_UVTRAFO_TRANSLATION;
|
||||
|
||||
/**
|
||||
* Input parameter to the <code>TransformUVCoords</code> step: Specifies
|
||||
* which UV transformations are evaluated.
|
||||
*
|
||||
* Default value: AI_UVTRAFO_ALL.
|
||||
*
|
||||
* Property type: integer (bitwise combination of the
|
||||
* <code>AI_UVTRAFO_XXX<code> flag).
|
||||
*/
|
||||
const char* AI_CONFIG_PP_TUV_EVALUATE = "PP_TUV_EVALUATE";
|
||||
|
||||
/**
|
||||
* A hint to assimp to favour speed against import quality.
|
||||
*
|
||||
* Enabling this option may result in faster loading, but it needn't.
|
||||
* It represents just a hint to loaders and post-processing steps to use
|
||||
* faster code paths, if possible.
|
||||
*
|
||||
* Default value: false.
|
||||
*
|
||||
* Property type: integer (0: false; !0: true).
|
||||
*/
|
||||
const char* AI_CONFIG_FAVOUR_SPEED = "FAVOUR_SPEED";
|
||||
|
||||
|
||||
/*
|
||||
* Importer settings.
|
||||
*
|
||||
* Various stuff to fine-tune the behaviour of a specific importer plugin.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Set the vertex animation keyframe to be imported.
|
||||
*
|
||||
* Assimp does not support vertex keyframes (only bone animation is
|
||||
* supported). The library reads only one frame of models with vertex
|
||||
* animations.
|
||||
*
|
||||
* Default value: 0 (first frame).
|
||||
*
|
||||
* Property type: integer.
|
||||
*
|
||||
* Note: This option applies to all importers. However, it is also possible
|
||||
* to override the global setting for a specific loader. You can use the
|
||||
* AI_CONFIG_IMPORT_XXX_KEYFRAME options (where XXX is a placeholder for
|
||||
* the file format for which you want to override the global setting).
|
||||
*/
|
||||
const char* AI_CONFIG_IMPORT_GLOBAL_KEYFRAME = "IMPORT_GLOBAL_KEYFRAME";
|
||||
|
||||
const char* AI_CONFIG_IMPORT_MD3_KEYFRAME = "IMPORT_MD3_KEYFRAME";
|
||||
const char* AI_CONFIG_IMPORT_MD2_KEYFRAME = "IMPORT_MD2_KEYFRAME";
|
||||
const char* AI_CONFIG_IMPORT_MDL_KEYFRAME = "IMPORT_MDL_KEYFRAME";
|
||||
const char* AI_CONFIG_IMPORT_MDC_KEYFRAME = "IMPORT_MDC_KEYFRAME";
|
||||
const char* AI_CONFIG_IMPORT_SMD_KEYFRAME = "IMPORT_SMD_KEYFRAME";
|
||||
const char* AI_CONFIG_IMPORT_UNREAL_KEYFRAME = "IMPORT_UNREAL_KEYFRAME";
|
||||
|
||||
|
||||
/**
|
||||
* Configures the AC loader to collect all surfaces which have the
|
||||
* "Backface cull" flag set in separate meshes.
|
||||
*
|
||||
* Default value: true.
|
||||
*
|
||||
* Property type: integer (0: false; !0: true).
|
||||
*/
|
||||
const char* AI_CONFIG_IMPORT_AC_SEPARATE_BFCULL = "IMPORT_AC_SEPARATE_BFCULL";
|
||||
|
||||
/**
|
||||
* Configures the UNREAL 3D loader to separate faces with different surface
|
||||
* flags (e.g. two-sided vs. single-sided).
|
||||
*
|
||||
* Default value: true.
|
||||
*
|
||||
* Property type: integer (0: false; !0: true).
|
||||
*/
|
||||
const char* AI_CONFIG_IMPORT_UNREAL_HANDLE_FLAGS = "UNREAL_HANDLE_FLAGS";
|
||||
|
||||
/**
|
||||
* Configures the terragen import plugin to compute uv's for terrains, if
|
||||
* not given. Furthermore, a default texture is assigned.
|
||||
*
|
||||
* UV coordinates for terrains are so simple to compute that you'll usually
|
||||
* want to compute them on your own, if you need them. This option is intended
|
||||
* for model viewers which want to offer an easy way to apply textures to
|
||||
* terrains.
|
||||
*
|
||||
* Default value: false.
|
||||
*
|
||||
* Property type: integer (0: false; !0: true).
|
||||
*/
|
||||
const char* AI_CONFIG_IMPORT_TER_MAKE_UVS = "IMPORT_TER_MAKE_UVS";
|
||||
|
||||
/**
|
||||
* Configures the ASE loader to always reconstruct normal vectors basing on
|
||||
* the smoothing groups loaded from the file.
|
||||
*
|
||||
* Many ASE files have invalid normals (they're not orthonormal).
|
||||
*
|
||||
* Default value: true.
|
||||
*
|
||||
* Property type: integer (0: false; !0: true).
|
||||
*/
|
||||
const char* AI_CONFIG_IMPORT_ASE_RECONSTRUCT_NORMALS = "IMPORT_ASE_RECONSTRUCT_NORMALS";
|
||||
|
||||
/**
|
||||
* Configures the M3D loader to process multi-part player models.
|
||||
*
|
||||
* These models usually consist of three files, <code>lower.md3</code>,
|
||||
* <code>upper.md3</code> and <code>head.md3</code>. If this property is set
|
||||
* to true, Assimp will try to load and combine all three files if one of
|
||||
* them is loaded.
|
||||
*
|
||||
* Default value: true.
|
||||
*
|
||||
* Property type: integer (0: false; !0: true).
|
||||
*/
|
||||
const char* AI_CONFIG_IMPORT_MD3_HANDLE_MULTIPART = "IMPORT_MD3_HANDLE_MULTIPART";
|
||||
|
||||
/**
|
||||
* Tells the MD3 loader which skin files to load.
|
||||
*
|
||||
* When loading MD3 files, Assimp checks whether a file
|
||||
* <code><md3_file_name>_<skin_name>.skin</code> is existing. These files
|
||||
* are used by Quake 3 to be able to assign different skins (e.g. red and
|
||||
* blue team) to models. 'default', 'red', 'blue' are typical skin names.
|
||||
*
|
||||
* Default value: "default".
|
||||
*
|
||||
* Property type: string.
|
||||
*/
|
||||
const char* AI_CONFIG_IMPORT_MD3_SKIN_NAME = "IMPORT_MD3_SKIN_NAME";
|
||||
|
||||
/**
|
||||
* Specify the Quake 3 shader file to be used for a particular MD3 file.
|
||||
* This can also be a search path.
|
||||
*
|
||||
* By default Assimp's behaviour is as follows: If a MD3 file
|
||||
* <code>[any_path]/models/[any_q3_subdir]/[model_name]/[file_name].md3</code>
|
||||
* is loaded, the library tries to locate the corresponding shader file in
|
||||
* <code>[any_path]/scripts/[model_name].shader</code>. This property
|
||||
* overrides this behaviour. It can either specify a full path to the shader
|
||||
* to be loaded or alternatively the path (relative or absolute) to the
|
||||
* directory where the shaders for all MD3s to be loaded reside. Assimp
|
||||
* attempts to open <code>[dir]/[model_name].shader</code> first,
|
||||
* <code>[dir]/[file_name].shader</code> is the fallback file. Note that
|
||||
* <code>[dir]</code> should have a terminal (back)slash.
|
||||
*
|
||||
* Default value: n/a.
|
||||
*
|
||||
* Property type: string.
|
||||
*/
|
||||
const char* AI_CONFIG_IMPORT_MD3_SHADER_SRC = "IMPORT_MD3_SHADER_SRC";
|
||||
|
||||
/**
|
||||
* Configures the LWO loader to load just one layer from the model.
|
||||
*
|
||||
* LWO files consist of layers and in some cases it could be useful to load
|
||||
* only one of them. This property can be either a string – which specifies
|
||||
* the name of the layer – or an integer – the index of the layer. If the
|
||||
* property is not set the whole LWO model is loaded. Loading fails if the
|
||||
* requested layer is not available. The layer index is zero-based and the
|
||||
* layer name may not be empty.
|
||||
*
|
||||
* Default value: all layers are loaded.
|
||||
*
|
||||
* Property type: integer/string.
|
||||
*/
|
||||
const char* AI_CONFIG_IMPORT_LWO_ONE_LAYER_ONLY = "IMPORT_LWO_ONE_LAYER_ONLY";
|
||||
|
||||
/**
|
||||
* Configures the MD5 loader to not load the MD5ANIM file for a MD5MESH file
|
||||
* automatically.
|
||||
*
|
||||
* The default strategy is to look for a file with the same name but the
|
||||
* MD5ANIM extension in the same directory. If it is found, it is loaded
|
||||
* and combined with the MD5MESH file. This configuration option can be
|
||||
* used to disable this behaviour.
|
||||
*
|
||||
* Default value: false.
|
||||
*
|
||||
* Property type: integer (0: false; !0: true).
|
||||
*/
|
||||
const char* AI_CONFIG_IMPORT_MD5_NO_ANIM_AUTOLOAD = "IMPORT_MD5_NO_ANIM_AUTOLOAD";
|
||||
|
||||
/**
|
||||
* Defines the begin of the time range for which the LWS loader evaluates
|
||||
* animations and computes <code>aiNodeAnim</code>s.
|
||||
*
|
||||
* Assimp provides full conversion of LightWave's envelope system, including
|
||||
* pre and post conditions. The loader computes linearly subsampled animation
|
||||
* chanels with the frame rate given in the LWS file. This property defines
|
||||
* the start time. Note: animation channels are only generated if a node
|
||||
* has at least one envelope with more tan one key assigned. This property.
|
||||
* is given in frames, '0' is the first frame. By default, if this property
|
||||
* is not set, the importer takes the animation start from the input LWS
|
||||
* file ('FirstFrame' line).
|
||||
*
|
||||
* Default value: read from file.
|
||||
*
|
||||
* Property type: integer.
|
||||
*
|
||||
* See: <code>AI_CONFIG_IMPORT_LWS_ANIM_END</code> – end of the imported
|
||||
* time range
|
||||
*/
|
||||
const char* AI_CONFIG_IMPORT_LWS_ANIM_START = "IMPORT_LWS_ANIM_START";
|
||||
const char* AI_CONFIG_IMPORT_LWS_ANIM_END = "IMPORT_LWS_ANIM_END";
|
||||
|
||||
/**
|
||||
* Defines the output frame rate of the IRR loader.
|
||||
*
|
||||
* IRR animations are difficult to convert for Assimp and there will always
|
||||
* be a loss of quality. This setting defines how many keys per second are
|
||||
* returned by the converter.
|
||||
*
|
||||
* Default value: 100.
|
||||
*
|
||||
* Property type: integer.
|
||||
*/
|
||||
const char* AI_CONFIG_IMPORT_IRR_ANIM_FPS = "IMPORT_IRR_ANIM_FPS";
|
||||
}
|
|
@ -0,0 +1,140 @@
|
|||
/*
|
||||
---------------------------------------------------------------------------
|
||||
Open Asset Import Library (ASSIMP)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2009, ASSIMP Development Team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
with or without modification, are permitted provided that the following
|
||||
conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
* Neither the name of the ASSIMP team, nor the names of its
|
||||
contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior
|
||||
written permission of the ASSIMP Development Team.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
* The data structures necessary to use Assimip with a custom IO system.
|
||||
*/
|
||||
module assimp.fileIO;
|
||||
|
||||
import assimp.types;
|
||||
|
||||
extern ( C ) {
|
||||
// aiFile callbacks
|
||||
alias size_t function( aiFile*, char*, size_t, size_t ) aiFileWriteProc;
|
||||
alias size_t function( aiFile*, char*, size_t, size_t ) aiFileReadProc;
|
||||
alias size_t function( aiFile* ) aiFileTellProc;
|
||||
alias void function( aiFile* ) aiFileFlushProc;
|
||||
alias aiReturn function( aiFile*, size_t, aiOrigin ) aiFileSeek;
|
||||
|
||||
// aiFileIO callbacks
|
||||
alias aiFile* function( aiFileIO*, char*, char* ) aiFileOpenProc;
|
||||
alias void function( aiFileIO*, aiFile* ) aiFileCloseProc;
|
||||
|
||||
/**
|
||||
* Represents user-defined data.
|
||||
*/
|
||||
alias char* aiUserData;
|
||||
|
||||
/**
|
||||
* Defines Assimp's way of accessing files.
|
||||
*
|
||||
* Provided are functions to open and close files. Supply a custom structure
|
||||
* to the import function. If you don't, a default implementation is used.
|
||||
* Use this to enable reading from other sources, such as ZIPs or memory
|
||||
* locations.
|
||||
*/
|
||||
struct aiFileIO {
|
||||
/**
|
||||
* Function used to open a new file
|
||||
*/
|
||||
aiFileOpenProc OpenProc;
|
||||
|
||||
/**
|
||||
* Function used to close an existing file
|
||||
*/
|
||||
aiFileCloseProc CloseProc;
|
||||
|
||||
/**
|
||||
* User-defined, opaque data.
|
||||
*/
|
||||
aiUserData UserData;
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a read/write file.
|
||||
*
|
||||
* Actually, it's a data structure to wrap a set of <code>fXXXX</code>
|
||||
* (e.g <code>fopen()</code>) replacement functions.
|
||||
*
|
||||
* The default implementation of the functions utilizes the <code>fXXX</code>
|
||||
* functions from the CRT. However, you can supply a custom implementation
|
||||
* to Assimp by passing a custom <code>aiFileIO</code>. Use this to enable
|
||||
* reading from other sources such as ZIP archives or memory locations.
|
||||
*/
|
||||
struct aiFile {
|
||||
/**
|
||||
* Callback to read from a file.
|
||||
*/
|
||||
aiFileReadProc ReadProc;
|
||||
|
||||
/**
|
||||
* Callback to write to a file.
|
||||
*/
|
||||
aiFileWriteProc WriteProc;
|
||||
|
||||
/**
|
||||
* Callback to retrieve the current position of the file cursor
|
||||
* (<code>ftell()</code>).
|
||||
*/
|
||||
aiFileTellProc TellProc;
|
||||
|
||||
/**
|
||||
* Callback to retrieve the size of the file, in bytes.
|
||||
*/
|
||||
aiFileTellProc FileSizeProc;
|
||||
|
||||
/**
|
||||
* Callback to set the current position of the file cursor
|
||||
* (<code>fseek()</code>).
|
||||
*/
|
||||
aiFileSeek SeekProc;
|
||||
|
||||
/**
|
||||
* Callback to flush the file contents.
|
||||
*/
|
||||
aiFileFlushProc FlushProc;
|
||||
|
||||
/**
|
||||
* User-defined, opaque data.
|
||||
*/
|
||||
aiUserData UserData;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,215 @@
|
|||
/*
|
||||
---------------------------------------------------------------------------
|
||||
Open Asset Import Library (ASSIMP)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2009, ASSIMP Development Team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
with or without modification, are permitted provided that the following
|
||||
conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
* Neither the name of the ASSIMP team, nor the names of its
|
||||
contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior
|
||||
written permission of the ASSIMP Development Team.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
* Contains the data structures which are used to store the imported information
|
||||
* about the light sources in the scene.
|
||||
*/
|
||||
module assimp.light;
|
||||
|
||||
import assimp.math;
|
||||
import assimp.types;
|
||||
|
||||
extern ( C ) {
|
||||
/**
|
||||
* Enumerates all supported types of light sources.
|
||||
*/
|
||||
enum aiLightSourceType : uint {
|
||||
UNDEFINED = 0x0,
|
||||
|
||||
/**
|
||||
* A directional light source has a well-defined direction but is
|
||||
* infinitely far away. That's quite a good approximation for sun light.
|
||||
*/
|
||||
DIRECTIONAL = 0x1,
|
||||
|
||||
/**
|
||||
* A point light source has a well-defined position in space but no
|
||||
* direction – it emits light in all directions. A normal bulb is a point
|
||||
* light.
|
||||
*/
|
||||
POINT = 0x2,
|
||||
|
||||
/**
|
||||
* A spot light source emits light in a specific angle. It has a position
|
||||
* and a direction it is pointing to. A good example for a spot light is
|
||||
* a light spot in sport arenas.
|
||||
*/
|
||||
SPOT = 0x3
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper structure to describe a light source.
|
||||
*
|
||||
* Assimp supports multiple sorts of light sources, including directional,
|
||||
* point and spot lights. All of them are defined with just a single
|
||||
* structure and distinguished by their parameters.
|
||||
*
|
||||
* Note: Some file formats (such as 3DS, ASE) export a "target point" – the
|
||||
* point a spot light is looking at (it can even be animated). Assimp
|
||||
* writes the target point as a subnode of a spotlights's main node, called
|
||||
* <code>[spotName].Target</code>. However, this is just additional
|
||||
* information then, the transformation tracks of the main node make the
|
||||
* spot light already point in the right direction.
|
||||
*/
|
||||
struct aiLight {
|
||||
/**
|
||||
* The name of the light source.
|
||||
*
|
||||
* There must be a node in the scenegraph with the same name. This node
|
||||
* specifies the position of the light in the scenehierarchy and can be
|
||||
* animated.
|
||||
*/
|
||||
aiString mName;
|
||||
|
||||
/**
|
||||
* The type of the light source.
|
||||
*
|
||||
* <code>aiLightSource.UNDEFINED</code> is not a valid value for this
|
||||
* member.
|
||||
*/
|
||||
aiLightSourceType mType;
|
||||
|
||||
/**
|
||||
* Position of the light source in space. Relative to the transformation
|
||||
* of the node corresponding to the light.
|
||||
*
|
||||
* The position is undefined for directional lights.
|
||||
*/
|
||||
aiVector3D mPosition;
|
||||
|
||||
/**
|
||||
* Direction of the light source in space. Relative to the transformation
|
||||
* of the node corresponding to the light.
|
||||
*
|
||||
* The direction is undefined for point lights. The vector may be
|
||||
* normalized, but it needn't.
|
||||
*/
|
||||
aiVector3D mDirection;
|
||||
|
||||
/**
|
||||
* Constant light attenuation factor.
|
||||
*
|
||||
* The intensity of the light source at a given distance
|
||||
* <code>d</code> from the light's position is
|
||||
* <code>1/( att0 + att1 * d + att2 * d * d )</code>. This member
|
||||
* corresponds to the <code>att0</code> variable in the equation.
|
||||
*
|
||||
* Naturally undefined for directional lights.
|
||||
*/
|
||||
float mAttenuationConstant;
|
||||
|
||||
/**
|
||||
* Linear light attenuation factor.
|
||||
*
|
||||
* The intensity of the light source at a given distance
|
||||
* <code>d</code> from the light's position is
|
||||
* <code>1/( att0 + att1 * d + att2 * d * d )</code>. This member
|
||||
* corresponds to the <code>att1</code> variable in the equation.
|
||||
*
|
||||
* Naturally undefined for directional lights.
|
||||
*/
|
||||
float mAttenuationLinear;
|
||||
|
||||
/**
|
||||
* Quadratic light attenuation factor.
|
||||
*
|
||||
* The intensity of the light source at a given distance
|
||||
* <code>d</code> from the light's position is
|
||||
* <code>1/( att0 + att1 * d + att2 * d * d )</code>. This member
|
||||
* corresponds to the <code>att2</code> variable in the equation.
|
||||
*
|
||||
* Naturally undefined for directional lights.
|
||||
*/
|
||||
float mAttenuationQuadratic;
|
||||
|
||||
/**
|
||||
* Diffuse color of the light source
|
||||
*
|
||||
* The diffuse light color is multiplied with the diffuse material color
|
||||
* to obtain the final color that contributes to the diffuse shading term.
|
||||
*/
|
||||
aiColor3D mColorDiffuse;
|
||||
|
||||
/**
|
||||
* Specular color of the light source
|
||||
*
|
||||
* The specular light color is multiplied with the specular material
|
||||
* color to obtain the final color that contributes to the specular
|
||||
* shading term.
|
||||
*/
|
||||
aiColor3D mColorSpecular;
|
||||
|
||||
/**
|
||||
* Ambient color of the light source
|
||||
*
|
||||
* The ambient light color is multiplied with the ambient material color
|
||||
* to obtain the final color that contributes to the ambient shading term.
|
||||
*
|
||||
* Most renderers will ignore this value it, is just a remaining of the
|
||||
* fixed-function pipeline that is still supported by quite many file
|
||||
* formats.
|
||||
*/
|
||||
aiColor3D mColorAmbient;
|
||||
|
||||
/**
|
||||
* Inner angle of a spot light's light cone.
|
||||
*
|
||||
* The spot light has maximum influence on objects inside this angle. The
|
||||
* angle is given in radians. It is 2PI for point lights and undefined
|
||||
* for directional lights.
|
||||
*/
|
||||
float mAngleInnerCone;
|
||||
|
||||
/**
|
||||
* Outer angle of a spot light's light cone.
|
||||
*
|
||||
* The spot light does not affect objects outside this angle. The angle
|
||||
* is given in radians. It is 2PI for point lights and undefined for
|
||||
* directional lights. The outer angle must be greater than or equal to
|
||||
* the inner angle.
|
||||
*
|
||||
* It is assumed that the application uses a smooth interpolation between
|
||||
* the inner and the outer cone of the spot light.
|
||||
*/
|
||||
float mAngleOuterCone;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,203 @@
|
|||
/*
|
||||
---------------------------------------------------------------------------
|
||||
Open Asset Import Library (ASSIMP)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2009, ASSIMP Development Team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
with or without modification, are permitted provided that the following
|
||||
conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
* Neither the name of the ASSIMP team, nor the names of its
|
||||
contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior
|
||||
written permission of the ASSIMP Development Team.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
* Provides facilities for dynamically loading the Assimp library.
|
||||
*
|
||||
* Currently requires Tango, but there is no reason why Phobos could not be
|
||||
* supported too.
|
||||
*/
|
||||
module assimp.loader;
|
||||
|
||||
import assimp.api;
|
||||
import tango.io.Stdout;
|
||||
import tango.sys.SharedLib;
|
||||
|
||||
const uint ASSIMP_BINDINGS_MAJOR = 0;
|
||||
const uint ASSIMP_BINDINGS_MINOR = 5;
|
||||
|
||||
/**
|
||||
* Loader class for dynamically loading the Assimp library.
|
||||
*
|
||||
* The library is »reference-counted«, meaning that the library is not
|
||||
* unloaded on a call to <code>unload()</code> if there are still other
|
||||
* references to it.
|
||||
*/
|
||||
struct Assimp {
|
||||
public:
|
||||
/**
|
||||
* Loads the library if it is not already loaded and increases the
|
||||
* reference counter.
|
||||
*
|
||||
* The library file (<code>libassimp.so</code> on POSIX systems,
|
||||
* <code>Assimp32.dll</code> on Win32) is loaded via Tango's SharedLib
|
||||
* class.
|
||||
*/
|
||||
static void load() {
|
||||
if ( m_sRefCount == 0 ) {
|
||||
version ( Posix ) {
|
||||
m_sLibrary = SharedLib.load( "libassimp.so" );
|
||||
}
|
||||
version ( Win32 ) {
|
||||
m_sLibrary = SharedLib.load( "Assimp32.dll" );
|
||||
}
|
||||
|
||||
// Versioning
|
||||
bind( aiGetLegalString )( "aiGetLegalString" );
|
||||
bind( aiGetVersionMinor )( "aiGetVersionMinor" );
|
||||
bind( aiGetVersionMajor )( "aiGetVersionMajor" );
|
||||
bind( aiGetVersionRevision )( "aiGetVersionRevision" );
|
||||
bind( aiGetCompileFlags )( "aiGetCompileFlags" );
|
||||
|
||||
// Check for version mismatch between the external, dynamically loaded
|
||||
// library and the version the bindings were created against.
|
||||
uint libMajor = aiGetVersionMajor();
|
||||
uint libMinor = aiGetVersionMinor();
|
||||
|
||||
if ( ( libMajor < ASSIMP_BINDINGS_MAJOR ) ||
|
||||
( libMinor < ASSIMP_BINDINGS_MINOR ) ) {
|
||||
Stdout.format(
|
||||
"WARNING: Assimp version too old (loaded library: {}.{}, " ~
|
||||
"bindings: {}.{})!",
|
||||
libMajor,
|
||||
libMinor,
|
||||
ASSIMP_BINDINGS_MAJOR,
|
||||
ASSIMP_BINDINGS_MINOR
|
||||
).newline;
|
||||
}
|
||||
|
||||
if ( libMajor > ASSIMP_BINDINGS_MAJOR ) {
|
||||
Stdout.format(
|
||||
"WARNING: Assimp version too new (loaded library: {}.{}, " ~
|
||||
"bindings: {}.{})!",
|
||||
libMajor,
|
||||
libMinor,
|
||||
ASSIMP_BINDINGS_MAJOR,
|
||||
ASSIMP_BINDINGS_MINOR
|
||||
).newline;
|
||||
}
|
||||
|
||||
// General API
|
||||
bind( aiImportFile )( "aiImportFile" );
|
||||
bind( aiImportFileEx )( "aiImportFileEx" );
|
||||
bind( aiImportFileFromMemory )( "aiImportFileFromMemory" );
|
||||
bind( aiApplyPostProcessing )( "aiApplyPostProcessing" );
|
||||
bind( aiGetPredefinedLogStream )( "aiGetPredefinedLogStream" );
|
||||
bind( aiAttachLogStream )( "aiAttachLogStream" );
|
||||
bind( aiEnableVerboseLogging )( "aiEnableVerboseLogging" );
|
||||
bind( aiDetachLogStream )( "aiDetachLogStream" );
|
||||
bind( aiDetachAllLogStreams )( "aiDetachAllLogStreams" );
|
||||
bind( aiReleaseImport )( "aiReleaseImport" );
|
||||
bind( aiGetErrorString )( "aiGetErrorString" );
|
||||
bind( aiIsExtensionSupported )( "aiIsExtensionSupported" );
|
||||
bind( aiGetExtensionList )( "aiGetExtensionList" );
|
||||
bind( aiGetMemoryRequirements )( "aiGetMemoryRequirements" );
|
||||
bind( aiSetImportPropertyInteger )( "aiSetImportPropertyInteger" );
|
||||
bind( aiSetImportPropertyFloat )( "aiSetImportPropertyFloat" );
|
||||
bind( aiSetImportPropertyString )( "aiSetImportPropertyString" );
|
||||
|
||||
// Mathematical functions
|
||||
bind( aiCreateQuaternionFromMatrix )( "aiCreateQuaternionFromMatrix" );
|
||||
bind( aiDecomposeMatrix )( "aiDecomposeMatrix" );
|
||||
bind( aiTransposeMatrix4 )( "aiTransposeMatrix4" );
|
||||
bind( aiTransposeMatrix3 )( "aiTransposeMatrix3" );
|
||||
bind( aiTransformVecByMatrix3 )( "aiTransformVecByMatrix3" );
|
||||
bind( aiTransformVecByMatrix4 )( "aiTransformVecByMatrix4" );
|
||||
bind( aiMultiplyMatrix4 )( "aiMultiplyMatrix4" );
|
||||
bind( aiMultiplyMatrix3 )( "aiMultiplyMatrix3" );
|
||||
bind( aiIdentityMatrix3 )( "aiIdentityMatrix3" );
|
||||
bind( aiIdentityMatrix4 )( "aiIdentityMatrix4" );
|
||||
|
||||
// Material system
|
||||
//bind( aiGetMaterialProperty )( "aiGetMaterialProperty" );
|
||||
bind( aiGetMaterialFloatArray )( "aiGetMaterialFloatArray" );
|
||||
bind( aiGetMaterialIntegerArray )( "aiGetMaterialIntegerArray" );
|
||||
bind( aiGetMaterialColor )( "aiGetMaterialColor" );
|
||||
bind( aiGetMaterialString )( "aiGetMaterialString" );
|
||||
bind( aiGetMaterialTexture )( "aiGetMaterialTexture" );
|
||||
}
|
||||
++m_sRefCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Decreases the reference counter and unloads the library if this was the
|
||||
* last reference.
|
||||
*/
|
||||
static void unload() {
|
||||
assert( m_sRefCount > 0 );
|
||||
--m_sRefCount;
|
||||
|
||||
if ( m_sRefCount == 0 ) {
|
||||
m_sLibrary.unload();
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
// The binding magic is heavily inspired by the Derelict loading code.
|
||||
struct Binder {
|
||||
public:
|
||||
static Binder opCall( void** functionPointerAddress ) {
|
||||
Binder binder;
|
||||
binder.m_functionPointerAddress = functionPointerAddress;
|
||||
return binder;
|
||||
}
|
||||
|
||||
void opCall( char* name ) {
|
||||
*m_functionPointerAddress = m_sLibrary.getSymbol( name );
|
||||
}
|
||||
|
||||
private:
|
||||
void** m_functionPointerAddress;
|
||||
}
|
||||
|
||||
template bind( Function ) {
|
||||
static Binder bind( inout Function a ) {
|
||||
Binder binder = Binder( cast( void** ) &a );
|
||||
return binder;
|
||||
}
|
||||
}
|
||||
|
||||
/// Current number of references to the library.
|
||||
static uint m_sRefCount;
|
||||
|
||||
/// Library handle.
|
||||
static SharedLib m_sLibrary;
|
||||
}
|
|
@ -0,0 +1,640 @@
|
|||
/*
|
||||
---------------------------------------------------------------------------
|
||||
Open Asset Import Library (ASSIMP)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2009, ASSIMP Development Team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
with or without modification, are permitted provided that the following
|
||||
conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
* Neither the name of the ASSIMP team, nor the names of its
|
||||
contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior
|
||||
written permission of the ASSIMP Development Team.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
* Contains the material system which stores the imported material information.
|
||||
*/
|
||||
module assimp.material;
|
||||
|
||||
import assimp.math;
|
||||
import assimp.types;
|
||||
|
||||
extern ( C ) {
|
||||
/**
|
||||
* Default material names for meshes without UV coordinates.
|
||||
*/
|
||||
const char* AI_DEFAULT_MATERIAL_NAME = "aiDefaultMat";
|
||||
|
||||
/**
|
||||
* Default material names for meshes with UV coordinates.
|
||||
*/
|
||||
const char* AI_DEFAULT_TEXTURED_MATERIAL_NAME = "TexturedDefaultMaterial";
|
||||
|
||||
/**
|
||||
* Defines how the Nth texture of a specific type is combined with the
|
||||
* result of all previous layers.
|
||||
*
|
||||
* Example (left: key, right: value):
|
||||
* <pre> DiffColor0 - gray
|
||||
* DiffTextureOp0 - aiTextureOpMultiply
|
||||
* DiffTexture0 - tex1.png
|
||||
* DiffTextureOp0 - aiTextureOpAdd
|
||||
* DiffTexture1 - tex2.png</pre>
|
||||
* Written as equation, the final diffuse term for a specific pixel would be:
|
||||
* <pre>diffFinal = DiffColor0 * sampleTex( DiffTexture0, UV0 ) +
|
||||
* sampleTex( DiffTexture1, UV0 ) * diffContrib;</pre>
|
||||
* where <code>diffContrib</code> is the intensity of the incoming light for
|
||||
* that pixel.
|
||||
*/
|
||||
enum aiTextureOp : uint {
|
||||
/**
|
||||
* <code>T = T1 * T2</code>
|
||||
*/
|
||||
Multiply = 0x0,
|
||||
|
||||
/**
|
||||
* <code>T = T1 + T2</code>
|
||||
*/
|
||||
Add = 0x1,
|
||||
|
||||
/**
|
||||
* <code>T = T1 - T2</code>
|
||||
*/
|
||||
Subtract = 0x2,
|
||||
|
||||
/**
|
||||
* <code>T = T1 / T2</code>
|
||||
*/
|
||||
Divide = 0x3,
|
||||
|
||||
/**
|
||||
* <code>T = ( T1 + T2 ) - ( T1 * T2 )</code>
|
||||
*/
|
||||
SmoothAdd = 0x4,
|
||||
|
||||
/**
|
||||
* <code>T = T1 + ( T2 - 0.5 )</code>
|
||||
*/
|
||||
SignedAdd = 0x5
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines how UV coordinates outside the <code>[0..1]</code> range are
|
||||
* handled.
|
||||
*
|
||||
* Commonly refered to as 'wrapping mode'.
|
||||
*/
|
||||
enum aiTextureMapMode : uint {
|
||||
/**
|
||||
* A texture coordinate <code>u | v</code> is translated to
|
||||
* <code>(u%1) | (v%1)</code>.
|
||||
*/
|
||||
Wrap = 0x0,
|
||||
|
||||
/**
|
||||
* Texture coordinates are clamped to the nearest valid value.
|
||||
*/
|
||||
Clamp = 0x1,
|
||||
|
||||
/**
|
||||
* If the texture coordinates for a pixel are outside
|
||||
* <code>[0..1]</code>, the texture is not applied to that pixel.
|
||||
*/
|
||||
Decal = 0x3,
|
||||
|
||||
/**
|
||||
* A texture coordinate <code>u | v</code> becomes
|
||||
* <code>(u%1) | (v%1)</code> if <code>(u-(u%1))%2</code> is
|
||||
* zero and <code>(1-(u%1)) | (1-(v%1))</code> otherwise.
|
||||
*/
|
||||
Mirror = 0x2
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines how the mapping coords for a texture are generated.
|
||||
*
|
||||
* Real-time applications typically require full UV coordinates, so the use of
|
||||
* the <code>aiProcess.GenUVCoords</code> step is highly recommended. It
|
||||
* generates proper UV channels for non-UV mapped objects, as long as an
|
||||
* accurate description how the mapping should look like (e.g spherical) is
|
||||
* given. See the <code>AI_MATKEY_MAPPING</code> property for more details.
|
||||
*/
|
||||
enum aiTextureMapping : uint {
|
||||
/**
|
||||
* The mapping coordinates are taken from an UV channel.
|
||||
*
|
||||
* The <code>AI_MATKEY_UVSRC</code> key specifies from which (remember,
|
||||
* meshes can have more than one UV channel).
|
||||
*/
|
||||
UV = 0x0,
|
||||
|
||||
/**
|
||||
* Spherical mapping.
|
||||
*/
|
||||
SPHERE = 0x1,
|
||||
|
||||
/**
|
||||
* Cylindrical mapping.
|
||||
*/
|
||||
CYLINDER = 0x2,
|
||||
|
||||
/**
|
||||
* Cubic mapping.
|
||||
*/
|
||||
BOX = 0x3,
|
||||
|
||||
/**
|
||||
* Planar mapping.
|
||||
*/
|
||||
PLANE = 0x4,
|
||||
|
||||
/**
|
||||
* Undefined mapping.
|
||||
*/
|
||||
OTHER = 0x5
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines the purpose of a texture
|
||||
*
|
||||
* This is a very difficult topic. Different 3D packages support different
|
||||
* kinds of textures. For very common texture types, such as bumpmaps, the
|
||||
* rendering results depend on implementation details in the rendering
|
||||
* pipelines of these applications. Assimp loads all texture references from
|
||||
* the model file and tries to determine which of the predefined texture
|
||||
* types below is the best choice to match the original use of the texture
|
||||
* as closely as possible.
|
||||
*
|
||||
* In content pipelines you'll usually define how textures have to be
|
||||
* handled, and the artists working on models have to conform to this
|
||||
* specification, regardless which 3D tool they're using.
|
||||
*/
|
||||
enum aiTextureType : uint {
|
||||
/**
|
||||
* No texture, but the value to be used for
|
||||
* <code>aiMaterialProperty.mSemantic</code> for all material properties
|
||||
* <em>not</em> related to textures.
|
||||
*/
|
||||
NONE = 0x0,
|
||||
|
||||
/**
|
||||
* The texture is combined with the result of the diffuse lighting
|
||||
* equation.
|
||||
*/
|
||||
DIFFUSE = 0x1,
|
||||
|
||||
/**
|
||||
* The texture is combined with the result of the specular lighting
|
||||
* equation.
|
||||
*/
|
||||
SPECULAR = 0x2,
|
||||
|
||||
/**
|
||||
* The texture is combined with the result of the ambient lighting
|
||||
* equation.
|
||||
*/
|
||||
AMBIENT = 0x3,
|
||||
|
||||
/**
|
||||
* The texture is added to the result of the lighting calculation. It
|
||||
* isn't influenced by incoming light.
|
||||
*/
|
||||
EMISSIVE = 0x4,
|
||||
|
||||
/**
|
||||
* The texture is a height map.
|
||||
*
|
||||
* By convention, higher grey-scale values stand for higher elevations
|
||||
* from the base height.
|
||||
*/
|
||||
HEIGHT = 0x5,
|
||||
|
||||
/**
|
||||
* The texture is a (tangent space) normal-map.
|
||||
*
|
||||
* Again, there are several conventions for tangent-space normal maps.
|
||||
* Assimp does (intentionally) not differenciate here.
|
||||
*/
|
||||
NORMALS = 0x6,
|
||||
|
||||
/**
|
||||
* The texture defines the glossiness of the material.
|
||||
*
|
||||
* The glossiness is in fact the exponent of the specular (phong)
|
||||
* lighting equation. Usually there is a conversion function defined to
|
||||
* map the linear color values in the texture to a suitable exponent.
|
||||
*/
|
||||
SHININESS = 0x7,
|
||||
|
||||
/**
|
||||
* The texture defines per-pixel opacity.
|
||||
*
|
||||
* Usually white means opaque and black means transparent.
|
||||
*/
|
||||
OPACITY = 0x8,
|
||||
|
||||
/**
|
||||
* Displacement texture.
|
||||
*
|
||||
* The exact purpose and format is application-dependent. Higher color
|
||||
* values stand for higher vertex displacements.
|
||||
*/
|
||||
DISPLACEMENT = 0x9,
|
||||
|
||||
/**
|
||||
* Lightmap or ambient occlusion texture.
|
||||
*
|
||||
* Both lightmaps and dedicated ambient occlusion maps are covered by
|
||||
* this material property. The texture contains a scaling value for the
|
||||
* final color value of a pixel. Its intensity is not affected by
|
||||
* incoming light.
|
||||
*/
|
||||
LIGHTMAP = 0xA,
|
||||
|
||||
/**
|
||||
* Reflection texture.
|
||||
*
|
||||
* Contains the color of a perfect mirror reflection. Rarely used, almost
|
||||
* never for real-time applications.
|
||||
*/
|
||||
REFLECTION = 0xB,
|
||||
|
||||
/**
|
||||
* Unknown texture.
|
||||
*
|
||||
* A texture reference that does not match any of the definitions above is
|
||||
* considered to be 'unknown'. It is still imported, but is excluded from
|
||||
* any further postprocessing.
|
||||
*/
|
||||
UNKNOWN = 0xC
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines all shading models supported by the library
|
||||
*
|
||||
* The list of shading modes has been taken from Blender. See Blender
|
||||
* documentation for more information. The API does not distinguish between
|
||||
* "specular" and "diffuse" shaders (thus the specular term for diffuse
|
||||
* shading models like Oren-Nayar remains undefined).
|
||||
*
|
||||
* Again, this value is just a hint. Assimp tries to select the shader whose
|
||||
* most common implementation matches the original rendering results of the
|
||||
* 3D modeller which wrote a particular model as closely as possible.
|
||||
*/
|
||||
enum aiShadingMode : uint {
|
||||
/**
|
||||
* Flat shading.
|
||||
*
|
||||
* Shading is done on per-face base diffuse only. Also known as
|
||||
* »faceted shading«.
|
||||
*/
|
||||
Flat = 0x1,
|
||||
|
||||
/**
|
||||
* Simple Gouraud shading.
|
||||
*/
|
||||
Gouraud = 0x2,
|
||||
|
||||
/**
|
||||
* Phong-Shading.
|
||||
*/
|
||||
Phong = 0x3,
|
||||
|
||||
/**
|
||||
* Phong-Blinn-Shading.
|
||||
*/
|
||||
Blinn = 0x4,
|
||||
|
||||
/**
|
||||
* Per-pixel toon shading.
|
||||
*
|
||||
* Often referred to as »comic shading«.
|
||||
*/
|
||||
Toon = 0x5,
|
||||
|
||||
/**
|
||||
* Per-pixel Oren-Nayar shading.
|
||||
*
|
||||
* Extension to standard Lambertian shading, taking the roughness of the
|
||||
* material into account.
|
||||
*/
|
||||
OrenNayar = 0x6,
|
||||
|
||||
/**
|
||||
* Per-pixel Minnaert shading.
|
||||
*
|
||||
* Extension to standard Lambertian shading, taking the "darkness" of the
|
||||
* material into account.
|
||||
*/
|
||||
Minnaert = 0x7,
|
||||
|
||||
/**
|
||||
* Per-pixel Cook-Torrance shading.
|
||||
*
|
||||
* Special shader for metallic surfaces.
|
||||
*/
|
||||
CookTorrance = 0x8,
|
||||
|
||||
/**
|
||||
* No shading at all.
|
||||
*
|
||||
* Constant light influence of 1.
|
||||
*/
|
||||
NoShading = 0x9,
|
||||
|
||||
/**
|
||||
* Fresnel shading.
|
||||
*/
|
||||
Fresnel = 0xa
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines some mixed flags for a particular texture.
|
||||
*
|
||||
* Usually you'll instruct your cg artists how textures have to look like
|
||||
* and how they will be processed in your application. However, if you use
|
||||
* Assimp for completely generic loading purposes you might also need to
|
||||
* process these flags in order to display as many 'unknown' 3D models as
|
||||
* possible correctly.
|
||||
*
|
||||
* This corresponds to the <code>AI_MATKEY_TEXFLAGS</code> property.
|
||||
*/
|
||||
enum aiTextureFlags : uint {
|
||||
/**
|
||||
* The texture's color values have to be inverted (i.e. <code>1-n</code>
|
||||
* component-wise).
|
||||
*/
|
||||
Invert = 0x1,
|
||||
|
||||
/**
|
||||
* Explicit request to the application to process the alpha channel of the
|
||||
* texture.
|
||||
*
|
||||
* Mutually exclusive with <code>IgnoreAlpha</code>. These flags are
|
||||
* set if the library can say for sure that the alpha channel is used/is
|
||||
* not used. If the model format does not define this, it is left to the
|
||||
* application to decide whether the texture alpha channel – if any – is
|
||||
* evaluated or not.
|
||||
*/
|
||||
UseAlpha = 0x2,
|
||||
|
||||
/**
|
||||
* Explicit request to the application to ignore the alpha channel of the
|
||||
* texture.
|
||||
*
|
||||
* Mutually exclusive with <code>UseAlpha</code>.
|
||||
*/
|
||||
IgnoreAlpha = 0x4
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Defines alpha-blend flags.
|
||||
*
|
||||
* If you're familiar with OpenGL or D3D, these flags aren't new to you.
|
||||
* They define how the final color value of a pixel is computed, based on
|
||||
* the previous color at that pixel and the new color value from the
|
||||
* material.
|
||||
*
|
||||
* The basic blending formula is
|
||||
* <code>SourceColor * SourceBlend + DestColor * DestBlend</code>,
|
||||
* where <code>DestColor</code> is the previous color in the framebuffer at
|
||||
* this position and <code>SourceColor</code> is the material color before
|
||||
* the transparency calculation.
|
||||
*
|
||||
* This corresponds to the <code>AI_MATKEY_BLEND_FUNC</code> property.
|
||||
*/
|
||||
enum aiBlendMode :uint {
|
||||
/**
|
||||
* Formula:
|
||||
* <code>SourceColor * SourceAlpha + DestColor * (1 - SourceAlpha)</code>
|
||||
*/
|
||||
Default = 0x0,
|
||||
|
||||
/**
|
||||
* Additive blending.
|
||||
*
|
||||
* Formula: <code>SourceColor*1 + DestColor*1</code>
|
||||
*/
|
||||
Additive = 0x1
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines how an UV channel is transformed.
|
||||
*
|
||||
* This is just a helper structure for the <code>AI_MATKEY_UVTRANSFORM</code>
|
||||
* key. See its documentation for more details.
|
||||
*/
|
||||
struct aiUVTransform {
|
||||
align ( 1 ) :
|
||||
/**
|
||||
* Translation on the u and v axes.
|
||||
*
|
||||
* The default value is (0|0).
|
||||
*/
|
||||
aiVector2D mTranslation;
|
||||
|
||||
/**
|
||||
* Scaling on the u and v axes.
|
||||
*
|
||||
* The default value is (1|1).
|
||||
*/
|
||||
aiVector2D mScaling;
|
||||
|
||||
/**
|
||||
* Rotation - in counter-clockwise direction.
|
||||
*
|
||||
* The rotation angle is specified in radians. The rotation center is
|
||||
* 0.5|0.5. The default value is 0.
|
||||
*/
|
||||
float mRotation;
|
||||
}
|
||||
|
||||
/**
|
||||
* A very primitive RTTI system to store the data type of a material
|
||||
* property.
|
||||
*/
|
||||
enum aiPropertyTypeInfo : uint {
|
||||
/**
|
||||
* Array of single-precision (32 bit) floats.
|
||||
*
|
||||
* It is possible to use <code>aiGetMaterialInteger[Array]()</code> to
|
||||
* query properties stored in floating-point format. The material system
|
||||
* performs the type conversion automatically.
|
||||
*/
|
||||
Float = 0x1,
|
||||
|
||||
/**
|
||||
* aiString property.
|
||||
*
|
||||
* Arrays of strings aren't possible, <code>aiGetMaterialString()</code>
|
||||
* must be used to query a string property.
|
||||
*/
|
||||
String = 0x3,
|
||||
|
||||
/**
|
||||
* Array of (32 bit) integers.
|
||||
*
|
||||
* It is possible to use <code>aiGetMaterialFloat[Array]()</code> to
|
||||
* query properties stored in integer format. The material system
|
||||
* performs the type conversion automatically.
|
||||
*/
|
||||
Integer = 0x4,
|
||||
|
||||
/**
|
||||
* Simple binary buffer, content undefined. Not convertible to anything.
|
||||
*/
|
||||
Buffer = 0x5
|
||||
}
|
||||
|
||||
/**
|
||||
* Data structure for a single material property.
|
||||
*
|
||||
* As an user, you'll probably never need to deal with this data structure.
|
||||
* Just use the provided <code>aiGetMaterialXXX()</code> functions to query
|
||||
* material properties easily. Processing them manually is faster, but it is
|
||||
* not the recommended way. It isn't worth the effort.
|
||||
*
|
||||
* Material property names follow a simple scheme:
|
||||
*
|
||||
* <code>$[name]</code>: A public property, there must be a corresponding
|
||||
* AI_MATKEY_XXX constant.
|
||||
*
|
||||
* <code>?[name]</code>: Also public, but ignored by the
|
||||
* <code>aiProcess.RemoveRedundantMaterials</code> post-processing step.
|
||||
*
|
||||
* <code>~[name]</code>: A temporary property for internal use.
|
||||
*/
|
||||
struct aiMaterialProperty {
|
||||
/**
|
||||
* Specifies the name of the property (key).
|
||||
*
|
||||
* Keys are generally case insensitive.
|
||||
*/
|
||||
aiString mKey;
|
||||
|
||||
/**
|
||||
* For texture properties, this specifies the exact usage semantic.
|
||||
*
|
||||
* For non-texture properties, this member is always 0 (or rather
|
||||
* <code>aiTextureType.NONE</code>).
|
||||
*/
|
||||
uint mSemantic;
|
||||
|
||||
/**
|
||||
* For texture properties, this specifies the index of the texture.
|
||||
*
|
||||
* For non-texture properties, this member is always 0.
|
||||
*/
|
||||
uint mIndex;
|
||||
|
||||
/**
|
||||
* Size of the buffer <code>mData</code> is pointing to (in bytes).
|
||||
*
|
||||
* This value may not be 0.
|
||||
*/
|
||||
uint mDataLength;
|
||||
|
||||
/**
|
||||
* Type information for the property.
|
||||
*
|
||||
* Defines the data layout inside the data buffer. This is used by the
|
||||
* library internally to perform debug checks and to utilize proper type
|
||||
* conversions.
|
||||
*/
|
||||
aiPropertyTypeInfo mType;
|
||||
|
||||
/**
|
||||
* Binary buffer to hold the property's value.
|
||||
*
|
||||
* The size of the buffer is always <code>mDataLength</code>.
|
||||
*/
|
||||
char* mData;
|
||||
}
|
||||
|
||||
/**
|
||||
* Data structure for a material
|
||||
*
|
||||
* Material data is stored using a key-value structure. A single key-value
|
||||
* pair is called a <em>material property</em>. The properties can be
|
||||
* queried using the <code>aiMaterialGetXXX</code> family of functions. The
|
||||
* library defines a set of standard keys (AI_MATKEY_XXX).
|
||||
*/
|
||||
struct aiMaterial {
|
||||
/**
|
||||
* List of all material properties loaded.
|
||||
*/
|
||||
aiMaterialProperty** mProperties;
|
||||
|
||||
/**
|
||||
* Number of properties loaded.
|
||||
*/
|
||||
uint mNumProperties;
|
||||
uint mNumAllocated; /// ditto
|
||||
}
|
||||
|
||||
/**
|
||||
* Standard material property keys. Always pass 0 for texture type and index
|
||||
* when querying these keys.
|
||||
*/
|
||||
const char* AI_MATKEY_NAME = "?mat.name";
|
||||
const char* AI_MATKEY_TWOSIDED = "$mat.twosided"; /// ditto
|
||||
const char* AI_MATKEY_SHADING_MODEL = "$mat.shadingm"; /// ditto
|
||||
const char* AI_MATKEY_ENABLE_WIREFRAME = "$mat.wireframe"; /// ditto
|
||||
const char* AI_MATKEY_BLEND_FUNC = "$mat.blend"; /// ditto
|
||||
const char* AI_MATKEY_OPACITY = "$mat.opacity"; /// ditto
|
||||
const char* AI_MATKEY_BUMPSCALING = "$mat.bumpscaling"; /// ditto
|
||||
const char* AI_MATKEY_SHININESS = "$mat.shininess"; /// ditto
|
||||
const char* AI_MATKEY_SHININESS_STRENGTH = "$mat.shinpercent"; /// ditto
|
||||
const char* AI_MATKEY_REFRACTI = "$mat.refracti"; /// ditto
|
||||
const char* AI_MATKEY_COLOR_DIFFUSE = "$clr.diffuse"; /// ditto
|
||||
const char* AI_MATKEY_COLOR_AMBIENT = "$clr.ambient"; /// ditto
|
||||
const char* AI_MATKEY_COLOR_SPECULAR = "$clr.specular"; /// ditto
|
||||
const char* AI_MATKEY_COLOR_EMISSIVE = "$clr.emissive"; /// ditto
|
||||
const char* AI_MATKEY_COLOR_TRANSPARENT = "$clr.transparent"; /// ditto
|
||||
const char* AI_MATKEY_COLOR_REFLECTIVE = "$clr.reflective"; /// ditto
|
||||
const char* AI_MATKEY_GLOBAL_BACKGROUND_IMAGE = "?bg.global"; /// ditto
|
||||
|
||||
/**
|
||||
* Texture material property keys. Do not forget to specify texture type and
|
||||
* index for these keys.
|
||||
*/
|
||||
const char* AI_MATKEY_TEXTURE = "$tex.file";
|
||||
const char* AI_MATKEY_UVWSRC = "$tex.uvwsrc"; /// ditto
|
||||
const char* AI_MATKEY_TEXOP = "$tex.op"; /// ditto
|
||||
const char* AI_MATKEY_MAPPING = "$tex.mapping"; /// ditto
|
||||
const char* AI_MATKEY_TEXBLEND = "$tex.blend"; /// ditto
|
||||
const char* AI_MATKEY_MAPPINGMODE_U = "$tex.mapmodeu"; /// ditto
|
||||
const char* AI_MATKEY_MAPPINGMODE_V = "$tex.mapmodev"; /// ditto
|
||||
const char* AI_MATKEY_TEXMAP_AXIS = "$tex.mapaxis"; /// ditto
|
||||
const char* AI_MATKEY_UVTRANSFORM = "$tex.uvtrafo"; /// ditto
|
||||
const char* AI_MATKEY_TEXFLAGS = "$tex.flags"; /// ditto
|
||||
}
|
|
@ -0,0 +1,155 @@
|
|||
/*
|
||||
---------------------------------------------------------------------------
|
||||
Open Asset Import Library (ASSIMP)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2009, ASSIMP Development Team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
with or without modification, are permitted provided that the following
|
||||
conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
* Neither the name of the ASSIMP team, nor the names of its
|
||||
contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior
|
||||
written permission of the ASSIMP Development Team.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
* Mathematical structures in which the imported data is stored.
|
||||
*/
|
||||
module assimp.math;
|
||||
|
||||
extern( C ) {
|
||||
/**
|
||||
* Represents a two-dimensional vector.
|
||||
*/
|
||||
struct aiVector2D {
|
||||
align ( 1 ):
|
||||
float x, y;
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a three-dimensional vector.
|
||||
*/
|
||||
struct aiVector3D {
|
||||
align ( 1 ):
|
||||
float x, y, z;
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a quaternion.
|
||||
*/
|
||||
struct aiQuaternion {
|
||||
float w, x, y, z;
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a row-major 3x3 matrix
|
||||
*
|
||||
* There is much confusion about matrix layouts (colum vs. row order). This
|
||||
* is <em>always</em> a row-major matrix, even when using the
|
||||
* <code>ConvertToLeftHanded</code> post processing step.
|
||||
*/
|
||||
struct aiMatrix3x3 {
|
||||
float a1, a2, a3;
|
||||
float b1, b2, b3;
|
||||
float c1, c2, c3;
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a row-major 3x3 matrix
|
||||
*
|
||||
* There is much confusion about matrix layouts (colum vs. row order). This
|
||||
* is <em>always</em> a row-major matrix, even when using the
|
||||
* <code>ConvertToLeftHanded</code> post processing step.
|
||||
*/
|
||||
struct aiMatrix4x4 {
|
||||
align ( 1 ):
|
||||
float a1, a2, a3, a4;
|
||||
float b1, b2, b3, b4;
|
||||
float c1, c2, c3, c4;
|
||||
float d1, d2, d3, d4;
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a plane in a three-dimensional, euclidean space
|
||||
*/
|
||||
struct aiPlane {
|
||||
align ( 1 ):
|
||||
/**
|
||||
* Coefficients of the plane equation (<code>ax + by + cz = d</code>).
|
||||
*/
|
||||
float a;
|
||||
float b; /// ditto
|
||||
float c; /// ditto
|
||||
float d; /// ditto
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a ray.
|
||||
*/
|
||||
struct aiRay {
|
||||
align ( 1 ):
|
||||
/**
|
||||
* Origin of the ray.
|
||||
*/
|
||||
aiVector3D pos;
|
||||
|
||||
/**
|
||||
* Direction of the ray.
|
||||
*/
|
||||
aiVector3D dir;
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a color in RGB space.
|
||||
*/
|
||||
struct aiColor3D {
|
||||
align ( 1 ):
|
||||
/**
|
||||
* Red, green and blue values.
|
||||
*/
|
||||
float r;
|
||||
float g; /// ditto
|
||||
float b; /// ditto
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a color in RGB space including an alpha component.
|
||||
*/
|
||||
struct aiColor4D {
|
||||
align ( 1 ):
|
||||
/**
|
||||
* Red, green, blue and alpha values.
|
||||
*/
|
||||
float r;
|
||||
float g; /// ditto
|
||||
float b; /// ditto
|
||||
float a; /// ditto
|
||||
}
|
||||
}
|
|
@ -0,0 +1,367 @@
|
|||
/*
|
||||
---------------------------------------------------------------------------
|
||||
Open Asset Import Library (ASSIMP)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2009, ASSIMP Development Team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
with or without modification, are permitted provided that the following
|
||||
conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
* Neither the name of the ASSIMP team, nor the names of its
|
||||
contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior
|
||||
written permission of the ASSIMP Development Team.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
* Contains the data structures in which the imported geometry is returned by
|
||||
* Assimp.
|
||||
*/
|
||||
module assimp.mesh;
|
||||
|
||||
import assimp.math;
|
||||
import assimp.types;
|
||||
|
||||
extern ( C ) {
|
||||
/**
|
||||
* A single face in a mesh, referring to multiple vertices.
|
||||
*
|
||||
* If <code>mNumIndices</code> is 3, we call the face <em>triangle</em>, for
|
||||
* for <code>mNumIndices > 3</code> it's called <em>polygon</em>.
|
||||
*
|
||||
* <code>aiMesh.mPrimitiveTypes</code> can be queried to quickly examine
|
||||
* which types of primitive are actually present in a mesh. The
|
||||
* <code>aiProcess.SortByPType</code> flag post-processing step splits
|
||||
* meshes containing different primitive types (e.g. lines and triangles) in
|
||||
* several "clean" submeshes.
|
||||
*
|
||||
* Furthermore, there is a configuration option
|
||||
* (<code>AI_CONFIG_PP_SBP_REMOVE</code>) to force <code>SortByPType</code>
|
||||
* to completely remove specific kinds of primitives from the imported scene.
|
||||
* In many cases you'll probably want to set this setting to
|
||||
* <code>aiPrimitiveType.LINE | aiPrimitiveType.POINT</code>. Together with
|
||||
* the <code>aiProcess.Triangulate</code> flag you can then be sure that
|
||||
* <code>mNumIndices</code> is always 3.
|
||||
*/
|
||||
struct aiFace {
|
||||
/**
|
||||
* Number of indices defining this face (3 for a triangle, >3 for a
|
||||
* polygon).
|
||||
*/
|
||||
uint mNumIndices;
|
||||
|
||||
/**
|
||||
* Array of the indicies defining the face.
|
||||
*
|
||||
* The size is given in <code>mNumIndices</code>.
|
||||
*/
|
||||
uint* mIndices;
|
||||
}
|
||||
|
||||
/**
|
||||
* A single influence of a bone on a vertex.
|
||||
*/
|
||||
struct aiVertexWeight {
|
||||
/**
|
||||
* Index of the vertex which is influenced by the bone.
|
||||
*/
|
||||
uint mVertexId;
|
||||
|
||||
/**
|
||||
* The strength of the influence in the range <code>[0..1]</code>.
|
||||
*
|
||||
* The influence from all bones at one vertex sums up to 1.
|
||||
*/
|
||||
float mWeight;
|
||||
}
|
||||
|
||||
/**
|
||||
* A single bone of a mesh.
|
||||
*
|
||||
* A bone has a name by which it can be found in the frame hierarchy and by
|
||||
* which it can be addressed by animations. In addition it has a number of
|
||||
* influences on vertices.
|
||||
*/
|
||||
struct aiBone {
|
||||
/**
|
||||
* The name of the bone.
|
||||
*/
|
||||
aiString mName;
|
||||
|
||||
/**
|
||||
* The number of vertices affected by this bone.
|
||||
*/
|
||||
uint mNumWeights;
|
||||
|
||||
/**
|
||||
* The vertices affected by this bone.
|
||||
*
|
||||
* This array is <code>mNumWeights</code> entries in size.
|
||||
*/
|
||||
aiVertexWeight* mWeights;
|
||||
|
||||
/**
|
||||
* Matrix that transforms from mesh space to bone space (in the bind
|
||||
* pose).
|
||||
*/
|
||||
aiMatrix4x4 mOffsetMatrix;
|
||||
}
|
||||
|
||||
/**
|
||||
* Maximum number of vertex color sets per mesh.
|
||||
*
|
||||
* Normally: Diffuse, specular, ambient and emissive. However, one could use
|
||||
* the vertex color sets for any other purpose, too.
|
||||
*
|
||||
* Note: Some internal structures expect (and assert) this value to be at
|
||||
* least 4. For the moment it is absolutely safe to assume that this will
|
||||
* not change.
|
||||
*/
|
||||
const uint AI_MAX_NUMBER_OF_COLOR_SETS = 0x4;
|
||||
|
||||
/**
|
||||
* Maximum number of texture coord sets (UV(W) channels) per mesh
|
||||
*
|
||||
* The material system uses the <code>AI_MATKEY_UVWSRC_XXX</code> keys to
|
||||
* specify which UVW channel serves as data source for a texture.
|
||||
*
|
||||
* Note: Some internal structures expect (and assert) this value to be at
|
||||
* least 4. For the moment it is absolutely safe to assume that this will
|
||||
* not change.
|
||||
*/
|
||||
const uint AI_MAX_NUMBER_OF_TEXTURECOORDS = 0x4;
|
||||
|
||||
/**
|
||||
* Enumerates the types of geometric primitives supported by Assimp.
|
||||
*
|
||||
* See: <code>aiFace</code>, <code>aiProcess.SortByPType</code>,
|
||||
* <code>aiProcess.Triangulate</code>,
|
||||
* <code>AI_CONFIG_PP_SBP_REMOVE</code>.
|
||||
*/
|
||||
enum aiPrimitiveType : uint {
|
||||
/** A point primitive.
|
||||
*
|
||||
* This is just a single vertex in the virtual world,
|
||||
* <code>aiFace</code> contains just one index for such a primitive.
|
||||
*/
|
||||
POINT = 0x1,
|
||||
|
||||
/** A line primitive.
|
||||
*
|
||||
* This is a line defined through a start and an end position.
|
||||
* <code>aiFace</code> contains exactly two indices for such a primitive.
|
||||
*/
|
||||
LINE = 0x2,
|
||||
|
||||
/** A triangular primitive.
|
||||
*
|
||||
* A triangle consists of three indices.
|
||||
*/
|
||||
TRIANGLE = 0x4,
|
||||
|
||||
/** A higher-level polygon with more than 3 edges.
|
||||
*
|
||||
* A triangle is a polygon, but in this context, polygon means
|
||||
* "all polygons that are not triangles". The <code>Triangulate</code>
|
||||
* post processing step is provided for your convinience, it splits all
|
||||
* polygons in triangles (which are much easier to handle).
|
||||
*/
|
||||
POLYGON = 0x8
|
||||
}
|
||||
|
||||
// Note: The AI_PRIMITIVE_TYPE_FOR_N_INDICES(n) macro from the C headers is
|
||||
// missing since there is probably not much use for it when just reading
|
||||
// scene files.
|
||||
|
||||
/**
|
||||
* A mesh represents a geometry or model with a single material.
|
||||
*
|
||||
* It usually consists of a number of vertices and a series
|
||||
* primitives/faces referencing the vertices. In addition there might be a
|
||||
* series of bones, each of them addressing a number of vertices with a
|
||||
* certain weight. Vertex data is presented in channels with each channel
|
||||
* containing a single per-vertex information such as a set of texture
|
||||
* coords or a normal vector. If a data pointer is non-null, the
|
||||
* corresponding data stream is present.
|
||||
*
|
||||
* A mesh uses only a single material which is referenced by a material ID.
|
||||
*
|
||||
* Note: The <code>mPositions</code> member is usually not optional.
|
||||
* However, vertex positions <em>could</em> be missing if the
|
||||
* <code>AI_SCENE_FLAGS_INCOMPLETE</code> flag is set in
|
||||
* <code>aiScene.mFlags</code>.
|
||||
*/
|
||||
struct aiMesh {
|
||||
/**
|
||||
* Bitwise combination of <code>aiPrimitiveType</code> members.
|
||||
*
|
||||
* This specifies which types of primitives are present in the mesh.
|
||||
* The <code>SortByPrimitiveType</code> post processing step can be used
|
||||
* to make sure the output meshes consist of one primitive type each.
|
||||
*/
|
||||
uint mPrimitiveTypes;
|
||||
|
||||
/**
|
||||
* The number of vertices in this mesh.
|
||||
*
|
||||
* This is also the size of all of the per-vertex data arrays.
|
||||
*/
|
||||
uint mNumVertices;
|
||||
|
||||
/**
|
||||
* The number of primitives (triangles, polygons, lines) in this mesh.
|
||||
* This is also the size of the <code>mFaces</code> array.
|
||||
*/
|
||||
uint mNumFaces;
|
||||
|
||||
/**
|
||||
* Vertex positions.
|
||||
*
|
||||
* This array is always present in a mesh. The array is
|
||||
* <code>mNumVertices</code> in size.
|
||||
*/
|
||||
aiVector3D* mVertices;
|
||||
|
||||
/**
|
||||
* Vertex normals.
|
||||
*
|
||||
* The array contains normalized vectors, null if not present.
|
||||
* The array is <code>mNumVertices</code> in size.
|
||||
*
|
||||
* Normals are undefined for point and line primitives. A mesh
|
||||
* consisting of points and lines only may not have normal vectors.
|
||||
* Meshes with mixed primitive types (i.e. lines and triangles) may have
|
||||
* normals, but the normals for vertices that are only referenced by
|
||||
* point or line primitives are undefined and set to <code>QNAN</code>.
|
||||
*
|
||||
* Note: Normal vectors computed by Assimp are always unit-length.
|
||||
* However, this needn't apply for normals that have been taken
|
||||
* directly from the model file.
|
||||
*/
|
||||
aiVector3D* mNormals;
|
||||
|
||||
/**
|
||||
* Vertex tangents.
|
||||
*
|
||||
* The tangent of a vertex points in the direction of the positive x
|
||||
* texture axis. The array contains normalized vectors, null if
|
||||
* not present. The array is <code>mNumVertices</code> in size.
|
||||
*
|
||||
* A mesh consisting of points and lines only may not have normal
|
||||
* vectors. Meshes with mixed primitive types (i.e. lines and triangles)
|
||||
* may have normals, but the normals for vertices that are only
|
||||
* referenced by point or line primitives are undefined and set to
|
||||
* <code>QNAN</code>.
|
||||
*
|
||||
* Note: If the mesh contains tangents, it automatically also contains
|
||||
* bitangents (the bitangent is just the cross product of tangent and
|
||||
* normal vectors).
|
||||
*/
|
||||
aiVector3D* mTangents;
|
||||
|
||||
/**
|
||||
* Vertex bitangents.
|
||||
*
|
||||
* The bitangent of a vertex points in the direction of the positive Y
|
||||
* texture axis. The array contains normalized vectors, null if not
|
||||
* present. The array is <code>mNumVertices</code> in size.
|
||||
*
|
||||
* Note: If the mesh contains tangents, it automatically also contains
|
||||
* bitangents.
|
||||
*/
|
||||
aiVector3D* mBitangents;
|
||||
|
||||
/**
|
||||
* Vertex color sets.
|
||||
*
|
||||
* A mesh may contain 0 to <code>AI_MAX_NUMBER_OF_COLOR_SETS</code>
|
||||
* vertex colors per vertex. null if not present.
|
||||
*
|
||||
* Each array is <code>mNumVertices</code> in size if present.
|
||||
*/
|
||||
aiColor4D* mColors[ AI_MAX_NUMBER_OF_COLOR_SETS ];
|
||||
|
||||
/**
|
||||
* Vertex texture coords, also known as UV channels.
|
||||
* A mesh may contain 0 to <code>AI_MAX_NUMBER_OF_TEXTURECOORDS</code>
|
||||
* per vertex. null if not present.
|
||||
*
|
||||
* Each array is <code>mNumVertices</code> in size.
|
||||
*/
|
||||
aiVector3D* mTextureCoords[ AI_MAX_NUMBER_OF_TEXTURECOORDS ];
|
||||
|
||||
/**
|
||||
* Specifies the number of components for a given UV channel.
|
||||
*
|
||||
* Up to three channels are supported (UVW, for accessing volume or cube
|
||||
* maps). If the value is 2 for a given channel <code>n</code>, the
|
||||
* component <code>p.z</code> of <code>mTextureCoords[n][p]</code> is set
|
||||
* to 0. If the value is 1 for a given channel, <code>p.y</code> is set
|
||||
* to 0, too. If this value is 0, 2 should be assumed.
|
||||
*
|
||||
* Note: 4D coords are not supported.
|
||||
*/
|
||||
uint mNumUVComponents[ AI_MAX_NUMBER_OF_TEXTURECOORDS ];
|
||||
|
||||
/**
|
||||
* The faces the mesh is contstructed from.
|
||||
*
|
||||
* Each face referrs to a number of vertices by their indices.
|
||||
* This array is always present in a mesh, its size is given
|
||||
* in <code>mNumFaces</code>. If the
|
||||
* <code>AI_SCENE_FLAGS_NON_VERBOSE_FORMAT</code> is <em>not</em> set,
|
||||
* each face references an unique set of vertices.
|
||||
*/
|
||||
aiFace* mFaces;
|
||||
|
||||
/**
|
||||
* The number of bones this mesh contains.
|
||||
*
|
||||
* Can be 0, in which case the <code>mBones</code> array is null.
|
||||
*/
|
||||
uint mNumBones;
|
||||
|
||||
/**
|
||||
* The bones of this mesh.
|
||||
*
|
||||
* A bone consists of a name by which it can be found in the frame
|
||||
* hierarchy and a set of vertex weights.
|
||||
*/
|
||||
aiBone** mBones;
|
||||
|
||||
/**
|
||||
* The material used by this mesh.
|
||||
*
|
||||
* A mesh does use only a single material. If an imported model uses
|
||||
* multiple materials, the import splits up the mesh. Use this value as
|
||||
* index into the scene's material list.
|
||||
*/
|
||||
uint mMaterialIndex;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,588 @@
|
|||
/*
|
||||
---------------------------------------------------------------------------
|
||||
Open Asset Import Library (ASSIMP)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2009, ASSIMP Development Team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
with or without modification, are permitted provided that the following
|
||||
conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
* Neither the name of the ASSIMP team, nor the names of its
|
||||
contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior
|
||||
written permission of the ASSIMP Development Team.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
* Definitions for import post processing steps.
|
||||
*/
|
||||
module assimp.postprocess;
|
||||
|
||||
extern ( C ) {
|
||||
/**
|
||||
* Defines the flags for all possible post processing steps.
|
||||
*
|
||||
* See: <code>aiImportFile</code>, <code>aiImportFileEx</code>
|
||||
*/
|
||||
enum aiPostProcessSteps {
|
||||
/**
|
||||
* Calculates the tangents and bitangents for the imported meshes.
|
||||
*
|
||||
* Does nothing if a mesh does not have normals. You might want this post
|
||||
* processing step to be executed if you plan to use tangent space
|
||||
* calculations such as normal mapping applied to the meshes. There is a
|
||||
* config setting, <code>AI_CONFIG_PP_CT_MAX_SMOOTHING_ANGLE</code>,
|
||||
* which allows you to specify a maximum smoothing angle for the
|
||||
* algorithm. However, usually you will want to use the default value.
|
||||
*/
|
||||
CalcTangentSpace = 0x1,
|
||||
|
||||
/**
|
||||
* Identifies and joins identical vertex data sets within all imported
|
||||
* meshes.
|
||||
*
|
||||
* After this step is run each mesh does contain only unique vertices
|
||||
* anymore, so a vertex is possibly used by multiple faces. You usually
|
||||
* want to use this post processing step. If your application deals with
|
||||
* indexed geometry, this step is compulsory or you will just waste
|
||||
* rendering time. <em>If this flag is not specified</em>, no vertices
|
||||
* are referenced by more than one face and <em>no index buffer is
|
||||
* required</em> for rendering.
|
||||
*/
|
||||
JoinIdenticalVertices = 0x2,
|
||||
|
||||
/**
|
||||
* Converts all the imported data to a left-handed coordinate space.
|
||||
*
|
||||
* By default the data is returned in a right-handed coordinate space
|
||||
* which for example OpenGL prefers. In this space, +X points to the
|
||||
* right, +Z points towards the viewer and and +Y points upwards. In the
|
||||
* DirectX coordinate space +X points to the right, +Y points upwards and
|
||||
* +Z points away from the viewer.
|
||||
*
|
||||
* You will probably want to consider this flag if you use Direct3D for
|
||||
* rendering. The <code>ConvertToLeftHanded</code> flag supersedes this
|
||||
* setting and bundles all conversions typically required for D3D-based
|
||||
* applications.
|
||||
*/
|
||||
MakeLeftHanded = 0x4,
|
||||
|
||||
/**
|
||||
* Triangulates all faces of all meshes.
|
||||
*
|
||||
* By default the imported mesh data might contain faces with more than 3
|
||||
* indices. For rendering you'll usually want all faces to be triangles.
|
||||
* This post processing step splits up all higher faces to triangles.
|
||||
* Line and point primitives are <em>not</em> modified!.
|
||||
*
|
||||
* If you want »triangles only« with no other kinds of primitives,
|
||||
* specify both <code>Triangulate</code> and <code>SortByPType</code> and
|
||||
* ignore all point and line meshes when you process Assimp's output.
|
||||
*/
|
||||
Triangulate = 0x8,
|
||||
|
||||
/**
|
||||
* Removes some parts of the data structure (animations, materials, light
|
||||
* sources, cameras, textures, vertex components).
|
||||
*
|
||||
* The components to be removed are specified in a separate configuration
|
||||
* option, <code>AI_CONFIG_PP_RVC_FLAGS</code>. This is quite useful if
|
||||
* you don't need all parts of the output structure. Especially vertex
|
||||
* colors are rarely used today.
|
||||
*
|
||||
* Calling this step to remove unrequired stuff from the pipeline as
|
||||
* early as possible results in an increased performance and a better
|
||||
* optimized output data structure.
|
||||
*
|
||||
* This step is also useful if you want to force Assimp to recompute
|
||||
* normals or tangents since the corresponding steps don't recompute them
|
||||
* if they have already been loaded from the source asset.
|
||||
*
|
||||
* This flag is a poor one, mainly because its purpose is usually
|
||||
* misunderstood. Consider the following case: a 3d model has been exported
|
||||
* from a CAD app, it has per-face vertex colors. Because of the vertex
|
||||
* colors (which are not even used by most apps),
|
||||
* <code>JoinIdenticalVertices</code> cannot join vertices at the same
|
||||
* position. By using this step, unneeded components are excluded as
|
||||
* early as possible thus opening more room for internal optimzations.
|
||||
*/
|
||||
RemoveComponent = 0x10,
|
||||
|
||||
/**
|
||||
* Generates normals for all faces of all meshes.
|
||||
*
|
||||
* This is ignored if normals are already there at the time where this
|
||||
* flag is evaluated. Model importers try to load them from the source
|
||||
* file, so they are usually already there. Face normals are shared
|
||||
* between all points of a single face, so a single point can have
|
||||
* multiple normals, which, in other words, enforces the library to
|
||||
* duplicate vertices in some cases. <code>JoinIdenticalVertices</code>
|
||||
* is <em>useless</em> then.
|
||||
*
|
||||
* This flag may not be specified together with
|
||||
* <code>GenSmoothNormals</code>.
|
||||
*/
|
||||
GenNormals = 0x20,
|
||||
|
||||
/**
|
||||
* Generates smooth normals for all vertices in the mesh.
|
||||
*
|
||||
* This is ignored if normals are already there at the time where this
|
||||
* flag is evaluated. Model importers try to load them from the source file, so
|
||||
* they are usually already there.
|
||||
*
|
||||
* There is a configuration option,
|
||||
* <code>AI_CONFIG_PP_GSN_MAX_SMOOTHING_ANGLE</code> which allows you to
|
||||
* specify an angle maximum for the normal smoothing algorithm. Normals
|
||||
* exceeding this limit are not smoothed, resulting in a »hard« seam
|
||||
* between two faces. Using a decent angle here (e.g. 80°) results in
|
||||
* very good visual appearance.
|
||||
*/
|
||||
GenSmoothNormals = 0x40,
|
||||
|
||||
/**
|
||||
* Splits large meshes into smaller submeshes.
|
||||
*
|
||||
* This is quite useful for realtime rendering where the number of triangles
|
||||
* which can be maximally processed in a single draw-call is usually limited
|
||||
* by the video driver/hardware. The maximum vertex buffer is usually limited,
|
||||
* too. Both requirements can be met with this step: you may specify both a
|
||||
* triangle and vertex limit for a single mesh.
|
||||
*
|
||||
* The split limits can (and should!) be set through the
|
||||
* <code>AI_CONFIG_PP_SLM_VERTEX_LIMIT</code> and
|
||||
* <code>AI_CONFIG_PP_SLM_TRIANGLE_LIMIT</code> settings. The default
|
||||
* values are <code>AI_SLM_DEFAULT_MAX_VERTICES</code> and
|
||||
* <code>AI_SLM_DEFAULT_MAX_TRIANGLES</code>.
|
||||
*
|
||||
* Note that splitting is generally a time-consuming task, but not if
|
||||
* there's nothing to split. The use of this step is recommended for most
|
||||
* users.
|
||||
*/
|
||||
SplitLargeMeshes = 0x80,
|
||||
|
||||
/**
|
||||
* Removes the node graph and pre-transforms all vertices with the local
|
||||
* transformation matrices of their nodes.
|
||||
*
|
||||
* The output scene does still contain nodes, however, there is only a
|
||||
* root node with children, each one referencing only one mesh, each
|
||||
* mesh referencing one material. For rendering, you can simply render
|
||||
* all meshes in order, you don't need to pay attention to local
|
||||
* transformations and the node hierarchy. Animations are removed during
|
||||
* this step.
|
||||
*
|
||||
* This step is intended for applications that have no scenegraph.
|
||||
* The step <em>can</em> cause some problems: if e.g. a mesh of the asset
|
||||
* contains normals and another, using the same material index, does not,
|
||||
* they will be brought together, but the first meshes's part of the
|
||||
* normal list will be zeroed.
|
||||
*/
|
||||
PreTransformVertices = 0x100,
|
||||
|
||||
/**
|
||||
* Limits the number of bones simultaneously affecting a single vertex to
|
||||
* a maximum value.
|
||||
*
|
||||
* If any vertex is affected by more than that number of bones, the least
|
||||
* important vertex weights are removed and the remaining vertex weights
|
||||
* are renormalized so that the weights still sum up to 1.
|
||||
*
|
||||
* The default bone weight limit is 4 (<code>AI_LMW_MAX_WEIGHTS</code>),
|
||||
* but you can use the <code>#AI_CONFIG_PP_LBW_MAX_WEIGHTS</code> setting
|
||||
* to supply your own limit to the post processing step.
|
||||
*
|
||||
* If you intend to perform the skinning in hardware, this post processing
|
||||
* step might be of interest for you.
|
||||
*/
|
||||
LimitBoneWeights = 0x200,
|
||||
|
||||
/**
|
||||
* Validates the imported scene data structure.
|
||||
*
|
||||
* This makes sure that all indices are valid, all animations and
|
||||
* bones are linked correctly, all material references are correct, etc.
|
||||
*
|
||||
* It is recommended to capture Assimp's log output if you use this flag,
|
||||
* so you can easily find ot what's actually wrong if a file fails the
|
||||
* validation. The validator is quite rude and will find <em>all</em>
|
||||
* inconsistencies in the data structure.
|
||||
*
|
||||
* Plugin developers are recommended to use it to debug their loaders.
|
||||
*
|
||||
* There are two types of validation failures:
|
||||
* <ul>
|
||||
* <li>Error: There's something wrong with the imported data. Further
|
||||
* postprocessing is not possible and the data is not usable at all.
|
||||
* The import fails, see <code>aiGetErrorString()</code> for the
|
||||
* error message.</li>
|
||||
* <li>Warning: There are some minor issues (e.g. 1000000 animation
|
||||
* keyframes with the same time), but further postprocessing and use
|
||||
* of the data structure is still safe. Warning details are written
|
||||
* to the log file, <code>AI_SCENE_FLAGS_VALIDATION_WARNING</code> is
|
||||
* set in <code>aiScene::mFlags</code></li>
|
||||
* </ul>
|
||||
*
|
||||
* This post-processing step is not time-consuming. It's use is not
|
||||
* compulsory, but recommended.
|
||||
*/
|
||||
ValidateDataStructure = 0x400,
|
||||
|
||||
/**
|
||||
* Reorders triangles for better vertex cache locality.
|
||||
*
|
||||
* The step tries to improve the ACMR (average post-transform vertex cache
|
||||
* miss ratio) for all meshes. The implementation runs in O(n) and is
|
||||
* roughly based on the 'tipsify' algorithm (see
|
||||
* <tt>http://www.cs.princeton.edu/gfx/pubs/Sander_2007_%3ETR/tipsy.pdf</tt>).
|
||||
*
|
||||
* If you intend to render huge models in hardware, this step might
|
||||
* be of interest for you. The <code>AI_CONFIG_PP_ICL_PTCACHE_SIZE</code>
|
||||
* config setting can be used to fine-tune the cache optimization.
|
||||
*/
|
||||
ImproveCacheLocality = 0x800,
|
||||
|
||||
/**
|
||||
* Searches for redundant/unreferenced materials and removes them.
|
||||
*
|
||||
* This is especially useful in combination with the
|
||||
* <code>PretransformVertices</code> and <code>OptimizeMeshes</code>
|
||||
* flags. Both join small meshes with equal characteristics, but they
|
||||
* can't do their work if two meshes have different materials. Because
|
||||
* several material settings are always lost during Assimp's import
|
||||
* filters, (and because many exporters don't check for redundant
|
||||
* materials), huge models often have materials which are are defined
|
||||
* several times with exactly the same settings.
|
||||
*
|
||||
* Several material settings not contributing to the final appearance of
|
||||
* a surface are ignored in all comparisons; the material name is one of
|
||||
* them. So, if you are passing additional information through the
|
||||
* content pipeline (probably using »magic« material names), don't
|
||||
* specify this flag. Alternatively take a look at the
|
||||
* <code>AI_CONFIG_PP_RRM_EXCLUDE_LIST</code> setting.
|
||||
*/
|
||||
RemoveRedundantMaterials = 0x1000,
|
||||
|
||||
/**
|
||||
* This step tries to determine which meshes have normal vectors that are
|
||||
* acing inwards.
|
||||
*
|
||||
* The algorithm is simple but effective: The bounding box of all
|
||||
* vertices and their normals is compared against the volume of the
|
||||
* bounding box of all vertices without their normals. This works well
|
||||
* for most objects, problems might occur with planar surfaces. However,
|
||||
* the step tries to filter such cases.
|
||||
*
|
||||
* The step inverts all in-facing normals. Generally it is recommended to
|
||||
* enable this step, although the result is not always correct.
|
||||
*/
|
||||
FixInfacingNormals = 0x2000,
|
||||
|
||||
/**
|
||||
* This step splits meshes with more than one primitive type in
|
||||
* homogeneous submeshes.
|
||||
*
|
||||
* The step is executed after the triangulation step. After the step
|
||||
* returns, just one bit is set in <code>aiMesh.mPrimitiveTypes</code>.
|
||||
* This is especially useful for real-time rendering where point and line
|
||||
* primitives are often ignored or rendered separately.
|
||||
*
|
||||
* You can use the <code>AI_CONFIG_PP_SBP_REMOVE</code> option to
|
||||
* specify which primitive types you need. This can be used to easily
|
||||
* exclude lines and points, which are rarely used, from the import.
|
||||
*/
|
||||
SortByPType = 0x8000,
|
||||
|
||||
/**
|
||||
* This step searches all meshes for degenerated primitives and converts
|
||||
* them to proper lines or points.
|
||||
*
|
||||
* A face is »degenerated« if one or more of its points are identical.
|
||||
* To have the degenerated stuff not only detected and collapsed but also
|
||||
* removed, try one of the following procedures:
|
||||
*
|
||||
* <b>1.</b> (if you support lines and points for rendering but don't
|
||||
* want the degenerates)
|
||||
* <ul>
|
||||
* <li>Specify the <code>FindDegenerates</code> flag.</li>
|
||||
* <li>Set the <code>AI_CONFIG_PP_FD_REMOVE</code> option to 1. This will
|
||||
* cause the step to remove degenerated triangles from the import
|
||||
* as soon as they're detected. They won't pass any further
|
||||
* pipeline steps.</li>
|
||||
* </ul>
|
||||
*
|
||||
* <b>2.</b>(if you don't support lines and points at all ...)
|
||||
* <ul>
|
||||
* <li>Specify the <code>FindDegenerates</code> flag.</li>
|
||||
* <li>Specify the <code>SortByPType</code> flag. This moves line and
|
||||
* point primitives to separate meshes.</li>
|
||||
* <li>Set the <code>AI_CONFIG_PP_SBP_REMOVE</codet> option to
|
||||
* <code>aiPrimitiveType_POINTS | aiPrimitiveType_LINES</code>
|
||||
* to cause SortByPType to reject point and line meshes from the
|
||||
* scene.</li>
|
||||
* </ul>
|
||||
*
|
||||
* Note: Degenerated polygons are not necessarily bad and that's why
|
||||
* they're not removed by default. There are several file formats
|
||||
* which don't support lines or points. Some exporters bypass the
|
||||
* format specification and write them as degenerated triangle
|
||||
* instead.
|
||||
*/
|
||||
FindDegenerates = 0x10000,
|
||||
|
||||
/**
|
||||
* This step searches all meshes for invalid data, such as zeroed normal
|
||||
* vectors or invalid UV coords and removes them.
|
||||
*
|
||||
* This is especially useful for normals. If they are invalid, and the
|
||||
* step recognizes this, they will be removed and can later be computed
|
||||
* by one of the other steps.
|
||||
*
|
||||
* The step will also remove meshes that are infinitely small.
|
||||
*/
|
||||
FindInvalidData = 0x20000,
|
||||
|
||||
/**
|
||||
* This step converts non-UV mappings (such as spherical or cylindrical
|
||||
* mapping) to proper texture coordinate channels.
|
||||
*
|
||||
* Most applications will support UV mapping only, so you will probably
|
||||
* want to specify this step in every case. Note tha Assimp is not always
|
||||
* able to match the original mapping implementation of the 3d app which
|
||||
* produced a model perfectly. It's always better to let the father app
|
||||
* compute the UV channels, at least 3ds max, maja, blender, lightwave,
|
||||
* modo, ... are able to achieve this.
|
||||
*
|
||||
* Note: If this step is not requested, you'll need to process the
|
||||
* <code>AI_MATKEY_MAPPING</code> material property in order to
|
||||
* display all assets properly.
|
||||
*/
|
||||
GenUVCoords = 0x40000,
|
||||
|
||||
/**
|
||||
* This step applies per-texture UV transformations and bakes them to
|
||||
* stand-alone vtexture coordinate channelss.
|
||||
*
|
||||
* UV transformations are specified per-texture – see the
|
||||
* <code>AI_MATKEY_UVTRANSFORM</code> material key for more information.
|
||||
* This step processes all textures with transformed input UV coordinates
|
||||
* and generates new (pretransformed) UV channel which replace the old
|
||||
* channel. Most applications won't support UV transformations, so you
|
||||
* will probably want to specify this step.
|
||||
*
|
||||
* Note: UV transformations are usually implemented in realtime apps by
|
||||
* transforming texture coordinates at vertex shader stage with a 3x3
|
||||
* (homogenous) transformation matrix.
|
||||
*/
|
||||
TransformUVCoords = 0x80000,
|
||||
|
||||
/**
|
||||
* This step searches for duplicate meshes and replaces duplicates with
|
||||
* references to the first mesh.
|
||||
*
|
||||
* This step takes a while, don't use it if you have no time. Its main
|
||||
* purpose is to workaround the limitation that many export file formats
|
||||
* don't support instanced meshes, so exporters need to duplicate meshes.
|
||||
* This step removes the duplicates again. Please note that Assimp does
|
||||
* currently not support per-node material assignment to meshes, which
|
||||
* means that identical meshes with differnent materials are currently
|
||||
* <em>not</em> joined, although this is planned for future versions.
|
||||
*/
|
||||
FindInstances = 0x100000,
|
||||
|
||||
/**
|
||||
* A postprocessing step to reduce the number of meshes.
|
||||
*
|
||||
* In fact, it will reduce the number of drawcalls.
|
||||
*
|
||||
* This is a very effective optimization and is recommended to be used
|
||||
* together with <code>OptimizeGraph</code>, if possible. The flag is
|
||||
* fully compatible with both <code>SplitLargeMeshes</code> and
|
||||
* <code>SortByPType</code>.
|
||||
*/
|
||||
OptimizeMeshes = 0x200000,
|
||||
|
||||
/**
|
||||
* A postprocessing step to optimize the scene hierarchy.
|
||||
*
|
||||
* Nodes with no animations, bones, lights or cameras assigned are
|
||||
* collapsed and joined.
|
||||
*
|
||||
* Node names can be lost during this step. If you use special tag nodes
|
||||
* to pass additional information through your content pipeline, use the
|
||||
* <code>AI_CONFIG_PP_OG_EXCLUDE_LIST</code> setting to specify a list of
|
||||
* node names you want to be kept. Nodes matching one of the names in
|
||||
* this list won't be touched or modified.
|
||||
*
|
||||
* Use this flag with caution. Most simple files will be collapsed to a
|
||||
* single node, complex hierarchies are usually completely lost. That's
|
||||
* note the right choice for editor environments, but probably a very
|
||||
* effective optimization if you just want to get the model data, convert
|
||||
* it to your own format and render it as fast as possible.
|
||||
*
|
||||
* This flag is designed to be used with <code>OptimizeMeshes</code> for
|
||||
* best results.
|
||||
*
|
||||
* Note: »Crappy« scenes with thousands of extremely small meshes packed
|
||||
* in deeply nested nodes exist for almost all file formats.
|
||||
* <code>OptimizeMeshes</code> in combination with
|
||||
* <code>OptimizeGraph</code> usually fixes them all and makes them
|
||||
* renderable.
|
||||
*/
|
||||
OptimizeGraph = 0x400000,
|
||||
|
||||
/** This step flips all UV coordinates along the y-axis and adjusts
|
||||
* material settings and bitangents accordingly.
|
||||
*
|
||||
* Output UV coordinate system:
|
||||
* <pre> 0y|0y ---------- 1x|0y
|
||||
* | |
|
||||
* | |
|
||||
* | |
|
||||
* 0x|1y ---------- 1x|1y</pre>
|
||||
* You'll probably want to consider this flag if you use Direct3D for
|
||||
* rendering. The <code>AI_PROCESS_CONVERT_TO_LEFT_HANDED</code> flag
|
||||
* supersedes this setting and bundles all conversions typically required
|
||||
* for D3D-based applications.
|
||||
*/
|
||||
FlipUVs = 0x800000,
|
||||
|
||||
/**
|
||||
* This step adjusts the output face winding order to be clockwise.
|
||||
*
|
||||
* The default face winding order is counter clockwise.
|
||||
*
|
||||
* Output face order:
|
||||
* <pre> x2
|
||||
*
|
||||
* x0
|
||||
* x1</pre>
|
||||
*/
|
||||
FlipWindingOrder = 0x1000000
|
||||
}
|
||||
|
||||
/**
|
||||
* Abbrevation for convenience.
|
||||
*/
|
||||
alias aiPostProcessSteps aiProcess;
|
||||
|
||||
/**
|
||||
* Shortcut flag for Direct3D-based applications.
|
||||
*
|
||||
* Combines the <code>MakeLeftHanded</code>, <code>FlipUVs</code> and
|
||||
* <code>FlipWindingOrder</code> flags. The output data matches Direct3D's
|
||||
* conventions: left-handed geometry, upper-left origin for UV coordinates
|
||||
* and clockwise face order, suitable for CCW culling.
|
||||
*/
|
||||
const aiPostProcessSteps AI_PROCESS_CONVERT_TO_LEFT_HANDED =
|
||||
aiProcess.MakeLeftHanded |
|
||||
aiProcess.FlipUVs |
|
||||
aiProcess.FlipWindingOrder;
|
||||
|
||||
/**
|
||||
* Default postprocess configuration optimizing the data for real-time rendering.
|
||||
*
|
||||
* Applications would want to use this preset to load models on end-user
|
||||
* PCs, maybe for direct use in game.
|
||||
*
|
||||
* If you're using DirectX, don't forget to combine this value with
|
||||
* the <code>ConvertToLeftHanded</code> step. If you don't support UV
|
||||
* transformations in your application, apply the
|
||||
* <code>TransformUVCoords</code> step, too.
|
||||
*
|
||||
* Note: Please take the time to read the doc for the steps enabled by this
|
||||
* preset. Some of them offer further configurable properties, some of
|
||||
* them might not be of use for you so it might be better to not specify
|
||||
* them.
|
||||
*/
|
||||
const aiPostProcessSteps AI_PROCESS_PRESET_TARGET_REALTIME_FAST =
|
||||
aiProcess.CalcTangentSpace |
|
||||
aiProcess.GenNormals |
|
||||
aiProcess.JoinIdenticalVertices |
|
||||
aiProcess.Triangulate |
|
||||
aiProcess.GenUVCoords |
|
||||
aiProcess.SortByPType;
|
||||
|
||||
/**
|
||||
* Default postprocess configuration optimizing the data for real-time
|
||||
* rendering.
|
||||
*
|
||||
* Unlike <code>AI_PROCESS_PRESET_TARGET_REALTIME_FAST</code>, this
|
||||
* configuration performs some extra optimizations to improve rendering
|
||||
* speed and to minimize memory usage. It could be a good choice for a
|
||||
* level editor environment where import speed is not so important.
|
||||
*
|
||||
* If you're using DirectX, don't forget to combine this value with
|
||||
* the <code>ConvertToLeftHanded</code> step. If you don't support UV
|
||||
* transformations in your application, apply the
|
||||
* <code>TransformUVCoords</code> step, too.
|
||||
*
|
||||
* Note: Please take the time to read the doc for the steps enabled by this
|
||||
* preset. Some of them offer further configurable properties, some of
|
||||
* them might not be of use for you so it might be better to not specify
|
||||
* them.
|
||||
*/
|
||||
const aiPostProcessSteps AI_PROCESS_PRESET_TARGET_REALTIME_QUALITY =
|
||||
aiProcess.CalcTangentSpace |
|
||||
aiProcess.GenSmoothNormals |
|
||||
aiProcess.JoinIdenticalVertices |
|
||||
aiProcess.ImproveCacheLocality |
|
||||
aiProcess.LimitBoneWeights |
|
||||
aiProcess.RemoveRedundantMaterials |
|
||||
aiProcess.SplitLargeMeshes |
|
||||
aiProcess.Triangulate |
|
||||
aiProcess.GenUVCoords |
|
||||
aiProcess.SortByPType |
|
||||
aiProcess.FindDegenerates |
|
||||
aiProcess.FindInvalidData;
|
||||
|
||||
/**
|
||||
* Default postprocess configuration optimizing the data for real-time
|
||||
* rendering.
|
||||
*
|
||||
* This preset enables almost every optimization step to achieve perfectly
|
||||
* optimized data. It's your choice for level editor environments where
|
||||
* import speed is not important.
|
||||
*
|
||||
* If you're using DirectX, don't forget to combine this value with
|
||||
* the <code>ConvertToLeftHanded</code> step. If you don't support UV
|
||||
* transformations in your application, apply the
|
||||
* <code>TransformUVCoords</code> step, too.
|
||||
*
|
||||
* Note: Please take the time to read the doc for the steps enabled by this
|
||||
* preset. Some of them offer further configurable properties, some of
|
||||
* them might not be of use for you so it might be better to not specify
|
||||
* them.
|
||||
*/
|
||||
const aiPostProcessSteps AI_PROCESS_PRESET_TARGET_REALTIME_MAX_QUALITY =
|
||||
AI_PROCESS_PRESET_TARGET_REALTIME_QUALITY |
|
||||
aiProcess.FindInstances |
|
||||
aiProcess.ValidateDataStructure |
|
||||
aiProcess.OptimizeMeshes;
|
||||
}
|
|
@ -0,0 +1,306 @@
|
|||
/*
|
||||
---------------------------------------------------------------------------
|
||||
Open Asset Import Library (ASSIMP)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2009, ASSIMP Development Team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
with or without modification, are permitted provided that the following
|
||||
conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
* Neither the name of the ASSIMP team, nor the names of its
|
||||
contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior
|
||||
written permission of the ASSIMP Development Team.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
* Contains the data structures which store the hierarchy fo the imported data.
|
||||
*/
|
||||
module assimp.scene;
|
||||
|
||||
import assimp.animation;
|
||||
import assimp.camera;
|
||||
import assimp.light;
|
||||
import assimp.math;
|
||||
import assimp.mesh;
|
||||
import assimp.material;
|
||||
import assimp.texture;
|
||||
import assimp.types;
|
||||
|
||||
extern ( C ) {
|
||||
/**
|
||||
* A node in the imported hierarchy.
|
||||
*
|
||||
* Each node has name, a parent node (except for the root node), a
|
||||
* transformation relative to its parent and possibly several child nodes.
|
||||
* Simple file formats don't support hierarchical structures, for these
|
||||
* formats the imported scene does consist of only a single root node with
|
||||
* no childs.
|
||||
*/
|
||||
struct aiNode {
|
||||
/**
|
||||
* The name of the node.
|
||||
*
|
||||
* The name might be empty (length of zero) but all nodes which need to
|
||||
* be accessed afterwards by bones or animations are usually named.
|
||||
* Multiple nodes may have the same name, but nodes which are accessed
|
||||
* by bones (see <code>aiBone</code> and <code>aiMesh.mBones</code>)
|
||||
* <em>must</em> be unique.
|
||||
*
|
||||
* Cameras and lights are assigned to a specific node name – if there are
|
||||
* multiple nodes with this name, they are assigned to each of them.
|
||||
*
|
||||
* There are no limitations regarding the characters contained in this
|
||||
* string. You should be able to handle stuff like whitespace, tabs,
|
||||
* linefeeds, quotation marks, ampersands, …
|
||||
*/
|
||||
aiString mName;
|
||||
|
||||
/**
|
||||
* The transformation relative to the node's parent.
|
||||
*/
|
||||
aiMatrix4x4 mTransformation;
|
||||
|
||||
/**
|
||||
* Parent node.
|
||||
*
|
||||
* null if this node is the root node.
|
||||
*/
|
||||
aiNode* mParent;
|
||||
|
||||
/**
|
||||
* The number of child nodes of this node.
|
||||
*/
|
||||
uint mNumChildren;
|
||||
|
||||
/**
|
||||
* The child nodes of this node.
|
||||
*
|
||||
* null if <code>mNumChildren</code> is 0.
|
||||
*/
|
||||
aiNode** mChildren;
|
||||
|
||||
/**
|
||||
* The number of meshes of this node.
|
||||
*/
|
||||
int mNumMeshes;
|
||||
|
||||
/**
|
||||
* The meshes of this node.
|
||||
*
|
||||
* Each entry is an index for <code>aiScene.mMeshes</code>.
|
||||
*/
|
||||
uint* mMeshes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Flags which are combinated in <code>aiScene.mFlags</code> to store
|
||||
* auxiliary information about the imported scene.
|
||||
*/
|
||||
enum aiSceneFlags : uint {
|
||||
/**
|
||||
* Specifies that the scene data structure that was imported is not
|
||||
* complete.
|
||||
*
|
||||
* This flag bypasses some internal validations and allows the import of
|
||||
* animation skeletons, material libraries or camera animation paths
|
||||
* using Assimp. Most applications won't support such data.
|
||||
*/
|
||||
INCOMPLETE = 0x1,
|
||||
|
||||
/**
|
||||
* This flag is set by the validation post-processing step
|
||||
* (<code>aiProcess.ValidateDS</code>) if the validation was successful.
|
||||
*
|
||||
* In a validated scene you can be sure that any cross references in the
|
||||
* data structure (e.g. vertex indices) are valid.
|
||||
*/
|
||||
VALIDATED = 0x2,
|
||||
|
||||
/**
|
||||
* This flag is set by the validation post-processing step
|
||||
* (<code>aiProcess.ValidateDS</code>) if the validation is successful
|
||||
* but some issues have been found.
|
||||
*
|
||||
* This can for example mean that a texture that does not exist is
|
||||
* referenced by a material or that the bone weights for a vertex don't
|
||||
* sum to 1. In most cases you should still be able to use the import.
|
||||
*
|
||||
* This flag could be useful for applications which don't capture
|
||||
* Assimp's log output.
|
||||
*/
|
||||
VALIDATION_WARNING = 0x4,
|
||||
|
||||
/**
|
||||
* This flag is currently only set by the
|
||||
* <code>aiProcess.JoinIdenticalVertices</code> post-processing step. It
|
||||
* indicates that the vertices of the output meshes aren't in the
|
||||
* internal verbose format anymore. In the verbose format all vertices
|
||||
* are unique, no vertex is ever referenced by more than one face.
|
||||
*/
|
||||
NON_VERBOSE_FORMAT = 0x8,
|
||||
|
||||
/**
|
||||
* Denotes pure height-map terrain data. Pure terrains usually consist of
|
||||
* quads, sometimes triangles, in a regular grid. The x,y coordinates of
|
||||
* all vertex positions refer to the x,y coordinates on the terrain
|
||||
* height map, the z-axis stores the elevation at a specific point.
|
||||
*
|
||||
* TER (Terragen) and HMP (3D Game Studio) are height map formats.
|
||||
*
|
||||
* Note: Assimp is probably not the best choice for loading <em>huge</em>
|
||||
* terrains – fully triangulated data takes extremely much storage
|
||||
* space and should be avoided as long as possible (typically you will
|
||||
* perform the triangulation when you actually need to render it).
|
||||
*/
|
||||
FLAGS_TERRAIN = 0x10
|
||||
}
|
||||
|
||||
/**
|
||||
* The root structure of the imported data.
|
||||
*
|
||||
* Everything that was imported from the given file can be accessed from here.
|
||||
* Objects of this class are generally maintained and owned by Assimp, not
|
||||
* by the caller. You shouldn't want to instance it, nor should you ever try to
|
||||
* delete a given scene on your own.
|
||||
*/
|
||||
struct aiScene {
|
||||
/**
|
||||
* Any combination of the <code>aiSceneFlags</code>. By default, this
|
||||
* value is 0, no flags are set.
|
||||
*
|
||||
* Most applications will want to reject all scenes with the
|
||||
* <code>aiSceneFlags.INCOMPLETE</code> bit set.
|
||||
*/
|
||||
uint mFlags;
|
||||
|
||||
/**
|
||||
* The root node of the hierarchy.
|
||||
*
|
||||
* There will always be at least the root node if the import was
|
||||
* successful (and no special flags have been set). Presence of further
|
||||
* nodes depends on the format and contents of the imported file.
|
||||
*/
|
||||
aiNode* mRootNode;
|
||||
|
||||
/**
|
||||
* The number of meshes in the scene.
|
||||
*/
|
||||
uint mNumMeshes;
|
||||
|
||||
/**
|
||||
* The array of meshes.
|
||||
*
|
||||
* Use the indices given in the <code>aiNode</code> structure to access
|
||||
* this array. The array is <code>mNumMeshes</code> in size.
|
||||
*
|
||||
* If the <code>aiSceneFlags.INCOMPLETE</code> flag is not set, there
|
||||
* will always be at least one mesh.
|
||||
*/
|
||||
aiMesh** mMeshes;
|
||||
|
||||
/**
|
||||
* The number of materials in the scene.
|
||||
*/
|
||||
uint mNumMaterials;
|
||||
|
||||
/**
|
||||
* The array of meshes.
|
||||
*
|
||||
* Use the indices given in the <code>aiMesh</code> structure to access
|
||||
* this array. The array is <code>mNumMaterials</code> in size.
|
||||
*
|
||||
* If the <code>aiSceneFlags.INCOMPLETE</code> flag is not set, there
|
||||
* will always be at least one material.
|
||||
*/
|
||||
aiMaterial** mMaterials;
|
||||
|
||||
/**
|
||||
* The number of animations in the scene.
|
||||
*/
|
||||
uint mNumAnimations;
|
||||
|
||||
/**
|
||||
* The array of animations.
|
||||
*
|
||||
* All animations imported from the given file are listed here. The array
|
||||
* is <code>mNumAnimations</code> in size.
|
||||
*/
|
||||
aiAnimation** mAnimations;
|
||||
|
||||
/**
|
||||
* The number of textures embedded into the file.
|
||||
*/
|
||||
uint mNumTextures;
|
||||
|
||||
/**
|
||||
* The array of embedded textures.
|
||||
*
|
||||
* Not many file formats embed their textures into the file. An example
|
||||
* is Quake's <code>MDL</code> format (which is also used by some
|
||||
* GameStudio versions).
|
||||
*/
|
||||
aiTexture** mTextures;
|
||||
|
||||
/**
|
||||
* The number of light sources in the scene.
|
||||
*
|
||||
* Light sources are fully optional, in most cases this attribute will be
|
||||
* 0.
|
||||
*/
|
||||
uint mNumLights;
|
||||
|
||||
/**
|
||||
* The array of light sources.
|
||||
*
|
||||
* All light sources imported from the given file are listed here. The
|
||||
* array is <code>mNumLights</code> in size.
|
||||
*/
|
||||
aiLight** mLights;
|
||||
|
||||
/**
|
||||
* The number of cameras in the scene.
|
||||
*
|
||||
* Cameras are fully optional, in most cases this attribute
|
||||
* will be 0.
|
||||
*/
|
||||
uint mNumCameras;
|
||||
|
||||
/**
|
||||
* The array of cameras.
|
||||
*
|
||||
* All cameras imported from the given file are listed here. The array is
|
||||
* <code>mNumCameras</code> in size.
|
||||
*
|
||||
* The first camera in the array (if existing) is the default camera view
|
||||
* at the scene.
|
||||
*/
|
||||
aiCamera** mCameras;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,122 @@
|
|||
/*
|
||||
---------------------------------------------------------------------------
|
||||
Open Asset Import Library (ASSIMP)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2009, ASSIMP Development Team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
with or without modification, are permitted provided that the following
|
||||
conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
* Neither the name of the ASSIMP team, nor the names of its
|
||||
contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior
|
||||
written permission of the ASSIMP Development Team.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
* Contains helper structures to handle textures in Assimp.
|
||||
*
|
||||
* Used for file formats which embed their textures into the model file.
|
||||
* Supported are both normal textures, which are stored as uncompressed pixels,
|
||||
* and "compressed" textures, which are stored in a file format such as PNG or
|
||||
* TGA.
|
||||
*/
|
||||
module assimp.texture;
|
||||
|
||||
extern ( C ) {
|
||||
/**
|
||||
* Helper structure to represent a texel in a ARGB8888 format.
|
||||
*
|
||||
* Used by aiTexture.
|
||||
*/
|
||||
struct aiTexel {
|
||||
align ( 1 ):
|
||||
ubyte b, g, r, a;
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper structure to describe an embedded texture.
|
||||
*
|
||||
* Usually textures are contained in external files but some file formats
|
||||
* embed them directly in the model file. There are two types of
|
||||
* embedded textures:
|
||||
*
|
||||
* <em>1. Uncompressed textures</em>: The color data is given in an
|
||||
* uncompressed format.
|
||||
*
|
||||
* <em>2. Compressed textures</em> stored in a file format like PNG or JPEG.
|
||||
* The raw file bytes are given so the application must utilize an image
|
||||
* decoder (e.g. DevIL) to get access to the actual color data.
|
||||
*/
|
||||
struct aiTexture {
|
||||
/**
|
||||
* Width of the texture, in pixels.
|
||||
*
|
||||
* If <code>mHeight</code> is zero the texture is compressed in a format
|
||||
* like JPEG. In this case, this value specifies the size of the memory
|
||||
* area <code>pcData</code> is pointing to, in bytes.
|
||||
*/
|
||||
uint mWidth;
|
||||
|
||||
/**
|
||||
* Height of the texture, in pixels.
|
||||
*
|
||||
* If this value is zero, <code>pcData</code> points to an compressed
|
||||
* texture in any format (e.g. JPEG).
|
||||
*/
|
||||
uint mHeight;
|
||||
|
||||
/**
|
||||
* A hint from the loader to make it easier for applications to determine
|
||||
* the type of embedded compressed textures.
|
||||
*
|
||||
* If <code>mHeight</code> is not 0, this member is undefined. Otherwise
|
||||
* it is set set to '\0\0\0\0' if the loader has no additional
|
||||
* information about the texture file format used, or the file extension
|
||||
* of the format without a trailing dot. If there are multiple file
|
||||
* extensions for a format, the shortest extension is chosen (JPEG maps
|
||||
* to 'jpg', not to 'jpeg'). E.g. 'dds\0', 'pcx\0', 'jpg\0'. All
|
||||
* characters are lower-case. The fourth byte will always be '\0'.
|
||||
*/
|
||||
char achFormatHint[4];
|
||||
|
||||
/**
|
||||
* Data of the texture.
|
||||
*
|
||||
* Points to an array of <code>mWidth * mHeight</code>
|
||||
* <code>aiTexel</code>s. The format of the texture data is always
|
||||
* ARGB8888 to make the implementation for user of the library as easy as
|
||||
* possible.
|
||||
*
|
||||
* If <code>mHeight</code> is 0, this is a pointer to a memory buffer of
|
||||
* size <code>mWidth</code> containing the compressed texture data.
|
||||
*/
|
||||
aiTexel* pcData;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,232 @@
|
|||
/*
|
||||
---------------------------------------------------------------------------
|
||||
Open Asset Import Library (ASSIMP)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2009, ASSIMP Development Team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
with or without modification, are permitted provided that the following
|
||||
conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
* Neither the name of the ASSIMP team, nor the names of its
|
||||
contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior
|
||||
written permission of the ASSIMP Development Team.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
* Contains miscellaneous types used in Assimp's C API.
|
||||
*/
|
||||
module assimp.types;
|
||||
|
||||
extern ( C ) {
|
||||
/**
|
||||
* Our own C boolean type.
|
||||
*/
|
||||
enum aiBool : int {
|
||||
FALSE = 0,
|
||||
TRUE = 1
|
||||
}
|
||||
|
||||
/**
|
||||
* Type definition for log stream callback function pointers.
|
||||
*/
|
||||
alias void function( char* message, char* user ) aiLogStreamCallback;
|
||||
|
||||
/**
|
||||
* Represents a log stream. A log stream receives all log messages and
|
||||
* streams them somewhere.
|
||||
*
|
||||
* See: <code>aiGetPredefinedLogStream</code>,
|
||||
* <code>aiAttachLogStream</code> and <code>aiDetachLogStream</code>.
|
||||
*/
|
||||
struct aiLogStream {
|
||||
/**
|
||||
* Callback function to be called when a new message arrives.
|
||||
*/
|
||||
aiLogStreamCallback callback;
|
||||
|
||||
/**
|
||||
* User data to be passed to the callback.
|
||||
*/
|
||||
char* user;
|
||||
}
|
||||
|
||||
/**
|
||||
* Maximum dimension for <code>aiString</code>s.
|
||||
*
|
||||
* Assimp strings are zero terminated.
|
||||
*/
|
||||
const size_t MAXLEN = 1024;
|
||||
|
||||
/**
|
||||
* Represents a string, zero byte terminated.
|
||||
*
|
||||
* The length of such a string is limited to <code>MAXLEN</code> characters
|
||||
* (excluding the terminal \0).
|
||||
*
|
||||
* To access an aiString from D you might want to use something like the
|
||||
* following piece of code:
|
||||
* ---
|
||||
* char[] importAiString( aiString* s ) {
|
||||
* return s.data[ 0 .. s.length ];
|
||||
* }
|
||||
* ---
|
||||
*/
|
||||
struct aiString {
|
||||
/**
|
||||
* Length of the string (excluding the terminal \0).
|
||||
*/
|
||||
size_t length;
|
||||
|
||||
/**
|
||||
* String buffer.
|
||||
*
|
||||
* Size limit is <code>MAXLEN</code>.
|
||||
*/
|
||||
char data[ MAXLEN ];
|
||||
}
|
||||
|
||||
/**
|
||||
* Standard return type for some library functions.
|
||||
*/
|
||||
enum aiReturn : uint {
|
||||
/**
|
||||
* Indicates that a function was successful.
|
||||
*/
|
||||
SUCCESS = 0x0,
|
||||
|
||||
/**
|
||||
* Indicates that a function failed.
|
||||
*/
|
||||
FAILURE = -0x1,
|
||||
|
||||
/**
|
||||
* Indicates that not enough memory was available to perform the
|
||||
* requested operation.
|
||||
*/
|
||||
OUTOFMEMORY = -0x3
|
||||
}
|
||||
|
||||
/**
|
||||
* Seek origins (for the virtual file system API).
|
||||
*/
|
||||
enum aiOrigin : uint {
|
||||
/**
|
||||
* Beginning of the file.
|
||||
*/
|
||||
SET = 0x0,
|
||||
|
||||
/**
|
||||
* Current position of the file pointer.
|
||||
*/
|
||||
CUR = 0x1,
|
||||
|
||||
/**
|
||||
* End of the file.
|
||||
*
|
||||
* Offsets must be negative.
|
||||
*/
|
||||
END = 0x2
|
||||
}
|
||||
|
||||
/**
|
||||
* Enumerates predefined log streaming destinations.
|
||||
*
|
||||
* Logging to these streams can be enabled with a single call to
|
||||
* <code>aiAttachPredefinedLogStream()</code>.
|
||||
*/
|
||||
enum aiDefaultLogStream :uint {
|
||||
/**
|
||||
* Stream the log to a file.
|
||||
*/
|
||||
FILE = 0x1,
|
||||
|
||||
/**
|
||||
* Stream the log to standard output.
|
||||
*/
|
||||
STDOUT = 0x2,
|
||||
|
||||
/**
|
||||
* Stream the log to standard error.
|
||||
*/
|
||||
STDERR = 0x4,
|
||||
|
||||
/**
|
||||
* MSVC only: Stream the log the the debugger (this relies on
|
||||
* <code>OutputDebugString</code> from the Win32 SDK).
|
||||
*/
|
||||
DEBUGGER = 0x8
|
||||
}
|
||||
|
||||
/**
|
||||
* Stores the memory requirements for different components (e.g. meshes,
|
||||
* materials, animations) of an import. All sizes are in bytes.
|
||||
*/
|
||||
struct aiMemoryInfo {
|
||||
/**
|
||||
* Storage allocated for texture data.
|
||||
*/
|
||||
uint textures;
|
||||
|
||||
/**
|
||||
* Storage allocated for material data.
|
||||
*/
|
||||
uint materials;
|
||||
|
||||
/**
|
||||
* Storage allocated for mesh data.
|
||||
*/
|
||||
uint meshes;
|
||||
|
||||
/**
|
||||
* Storage allocated for node data.
|
||||
*/
|
||||
uint nodes;
|
||||
|
||||
/**
|
||||
* Storage allocated for animation data.
|
||||
*/
|
||||
uint animations;
|
||||
|
||||
/**
|
||||
* Storage allocated for camera data.
|
||||
*/
|
||||
uint cameras;
|
||||
|
||||
/**
|
||||
* Storage allocated for light data.
|
||||
*/
|
||||
uint lights;
|
||||
|
||||
/**
|
||||
* Total storage allocated for the full import.
|
||||
*/
|
||||
uint total;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,72 @@
|
|||
/*
|
||||
---------------------------------------------------------------------------
|
||||
Open Asset Import Library (ASSIMP)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2009, ASSIMP Development Team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
with or without modification, are permitted provided that the following
|
||||
conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
* Neither the name of the ASSIMP team, nor the names of its
|
||||
contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior
|
||||
written permission of the ASSIMP Development Team.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
* Flags returned by <code>aiGetCompileFlags()</code>.
|
||||
*/
|
||||
module assimp.versionInfo;
|
||||
|
||||
extern ( C ) {
|
||||
/**
|
||||
* Assimp was compiled as a shared object (Windows: DLL).
|
||||
*/
|
||||
const uint ASSIMP_CFLAGS_SHARED = 0x1;
|
||||
|
||||
/**
|
||||
* Assimp was compiled against STLport.
|
||||
*/
|
||||
const uint ASSIMP_CFLAGS_STLPORT = 0x2;
|
||||
|
||||
/**
|
||||
* Assimp was compiled as a debug build.
|
||||
*/
|
||||
const uint ASSIMP_CFLAGS_DEBUG = 0x4;
|
||||
|
||||
/**
|
||||
* Assimp was compiled with ASSIMP_BUILD_BOOST_WORKAROUND defined.
|
||||
*/
|
||||
const uint ASSIMP_CFLAGS_NOBOOST = 0x8;
|
||||
|
||||
/**
|
||||
* Assimp was compiled with ASSIMP_BUILD_SINGLETHREADED defined.
|
||||
*/
|
||||
const uint ASSIMP_CFLAGS_SINGLETHREADED = 0x10;
|
||||
}
|
Loading…
Reference in New Issue