2008-08-08 23:58:40 +00:00
|
|
|
/*
|
|
|
|
Open Asset Import Library (ASSIMP)
|
|
|
|
----------------------------------------------------------------------
|
|
|
|
|
|
|
|
Copyright (c) 2006-2008, 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.
|
|
|
|
|
|
|
|
----------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
|
|
|
|
/** @file Defines the helper data structures for importing MDR files */
|
|
|
|
#ifndef AI_MDRFILEHELPER_H_INC
|
|
|
|
#define AI_MDRFILEHELPER_H_INC
|
|
|
|
|
|
|
|
#include "../include/aiTypes.h"
|
|
|
|
#include "../include/aiMesh.h"
|
|
|
|
#include "../include/aiAnim.h"
|
|
|
|
|
2008-09-12 20:25:11 +00:00
|
|
|
#include "./../include/Compiler/pushpack1.h"
|
2008-08-08 23:58:40 +00:00
|
|
|
|
|
|
|
namespace Assimp {
|
|
|
|
namespace MDR {
|
|
|
|
|
2008-09-12 20:25:11 +00:00
|
|
|
// to make it easier for ourselfes, we test the magic word against both "endianesses"
|
|
|
|
#define MDR_MAKE(string) ((uint32_t)((string[0] << 24) + (string[1] << 16) + (string[2] << 8) + string[3]))
|
|
|
|
|
|
|
|
#define AI_MDR_MAGIC_NUMBER_BE MDR_MAKE("RDM5")
|
|
|
|
#define AI_MDR_MAGIC_NUMBER_LE MDR_MAKE("5MDR")
|
2008-08-08 23:58:40 +00:00
|
|
|
|
ASE: Added WIP support for *SMOOTHSKINMESH elements in ASE/ASC files. Fixes in the ASE loader. Fixed animation parsing. Temporary implementation of target lights and cameras, including animations.
3DS: Fixed transformation problems (Pivot points), added WIP animation support. No target animation yet (cameras, spot lights). Not yet fully tested, but static models that worked before should still work now, except all look correct now :-) (some problems with very large models remaining)
Further work on the IRR and IRRMESH loaders. IRR still WIP, IRRMESH more stable now.
Work on the LWo loader. Added support for the "one-layer-only" mode. Hierarchy bug still unfixed, UV coords bug still unfixed.
Further work on the FindInvalidDataprocess. Improved validation for normals, no false positives anymore.
Further work on the MDR loader, still WIP.
Moved DeterminePType-Step to ScenePreprocessor.
aiAnimation::mDuration is optional now, ScenePreprocessor computes it automatically if set to -1.
Fixes in the SMD loader. Still crashes on some files.
Updated animation documentation.
git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@236 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
2008-11-09 23:17:19 +00:00
|
|
|
// common limitations for MDR - not validated for the moment
|
2008-08-08 23:58:40 +00:00
|
|
|
#define AI_MDR_VERSION 2
|
|
|
|
#define AI_MDR_MAXQPATH 64
|
|
|
|
#define AI_MDR_MAX_BONES 128
|
|
|
|
|
ASE: Added WIP support for *SMOOTHSKINMESH elements in ASE/ASC files. Fixes in the ASE loader. Fixed animation parsing. Temporary implementation of target lights and cameras, including animations.
3DS: Fixed transformation problems (Pivot points), added WIP animation support. No target animation yet (cameras, spot lights). Not yet fully tested, but static models that worked before should still work now, except all look correct now :-) (some problems with very large models remaining)
Further work on the IRR and IRRMESH loaders. IRR still WIP, IRRMESH more stable now.
Work on the LWo loader. Added support for the "one-layer-only" mode. Hierarchy bug still unfixed, UV coords bug still unfixed.
Further work on the FindInvalidDataprocess. Improved validation for normals, no false positives anymore.
Further work on the MDR loader, still WIP.
Moved DeterminePType-Step to ScenePreprocessor.
aiAnimation::mDuration is optional now, ScenePreprocessor computes it automatically if set to -1.
Fixes in the SMD loader. Still crashes on some files.
Updated animation documentation.
git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@236 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
2008-11-09 23:17:19 +00:00
|
|
|
|
2008-08-08 23:58:40 +00:00
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
/** \brief Data structure for a vertex weight in a MDR file
|
|
|
|
*/
|
|
|
|
struct Weight
|
|
|
|
{
|
|
|
|
//! these are indexes into the boneReferences
|
|
|
|
//! not the global per-frame bone list
|
|
|
|
uint32_t boneIndex;
|
|
|
|
|
|
|
|
//! weight of this bone
|
|
|
|
float boneWeight;
|
|
|
|
|
|
|
|
//! offset of this bone
|
|
|
|
aiVector3D offset;
|
|
|
|
} PACK_STRUCT;
|
|
|
|
|
|
|
|
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
/** \brief Data structure for a vertex in a MDR file
|
|
|
|
*/
|
|
|
|
struct Vertex
|
|
|
|
{
|
|
|
|
aiVector3D normal;
|
|
|
|
aiVector2D texCoords;
|
|
|
|
uint32_t numWeights;
|
|
|
|
} PACK_STRUCT;
|
|
|
|
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
/** \brief Data structure for a triangle in a MDR file
|
|
|
|
*/
|
|
|
|
struct Triangle
|
|
|
|
{
|
|
|
|
uint32_t indexes[3];
|
|
|
|
} PACK_STRUCT;
|
|
|
|
|
|
|
|
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
/** \brief Data structure for a surface in a MDR file
|
|
|
|
*/
|
|
|
|
struct Surface
|
|
|
|
{
|
|
|
|
uint32_t ident;
|
|
|
|
|
|
|
|
char name[AI_MDR_MAXQPATH]; // polyset name
|
|
|
|
char shader[AI_MDR_MAXQPATH];
|
|
|
|
uint32_t shaderIndex;
|
|
|
|
|
|
|
|
int32_t ofsHeader; // this will be a negative number
|
|
|
|
|
|
|
|
uint32_t numVerts;
|
|
|
|
uint32_t ofsVerts;
|
|
|
|
|
|
|
|
uint32_t numTriangles;
|
|
|
|
uint32_t ofsTriangles;
|
|
|
|
|
|
|
|
// Bone references are a set of ints representing all the bones
|
|
|
|
// present in any vertex weights for this surface. This is
|
|
|
|
// needed because a model may have surfaces that need to be
|
|
|
|
// drawn at different sort times, and we don't want to have
|
|
|
|
// to re-interpolate all the bones for each surface.
|
|
|
|
uint32_t numBoneReferences;
|
|
|
|
uint32_t ofsBoneReferences;
|
|
|
|
|
|
|
|
uint32_t ofsEnd; // next surface follows
|
|
|
|
} PACK_STRUCT;
|
|
|
|
|
|
|
|
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
/** \brief Data structure for a bone in a MDR file
|
|
|
|
*/
|
|
|
|
struct Bone
|
|
|
|
{
|
|
|
|
float matrix[3][4];
|
|
|
|
} PACK_STRUCT;
|
|
|
|
|
|
|
|
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
/** \brief Data structure for a frame in a MDR file
|
|
|
|
*/
|
|
|
|
struct Frame {
|
2008-09-16 16:17:32 +00:00
|
|
|
aiVector3D bounds0,bounds1; // bounds of all surfaces of all LOD's for this frame
|
|
|
|
aiVector3D localOrigin; // midpoint of bounds, used for sphere cull
|
|
|
|
float radius; // dist from localOrigin to corner
|
2008-08-08 23:58:40 +00:00
|
|
|
char name[16];
|
ASE: Added WIP support for *SMOOTHSKINMESH elements in ASE/ASC files. Fixes in the ASE loader. Fixed animation parsing. Temporary implementation of target lights and cameras, including animations.
3DS: Fixed transformation problems (Pivot points), added WIP animation support. No target animation yet (cameras, spot lights). Not yet fully tested, but static models that worked before should still work now, except all look correct now :-) (some problems with very large models remaining)
Further work on the IRR and IRRMESH loaders. IRR still WIP, IRRMESH more stable now.
Work on the LWo loader. Added support for the "one-layer-only" mode. Hierarchy bug still unfixed, UV coords bug still unfixed.
Further work on the FindInvalidDataprocess. Improved validation for normals, no false positives anymore.
Further work on the MDR loader, still WIP.
Moved DeterminePType-Step to ScenePreprocessor.
aiAnimation::mDuration is optional now, ScenePreprocessor computes it automatically if set to -1.
Fixes in the SMD loader. Still crashes on some files.
Updated animation documentation.
git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@236 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
2008-11-09 23:17:19 +00:00
|
|
|
|
|
|
|
// bones follow here
|
|
|
|
|
2008-08-08 23:58:40 +00:00
|
|
|
} PACK_STRUCT;
|
|
|
|
|
|
|
|
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
/** \brief Data structure for a compressed bone in a MDR file
|
|
|
|
*/
|
|
|
|
struct CompBone
|
|
|
|
{
|
|
|
|
unsigned char Comp[24]; // MC_COMP_BYTES is in MatComp.h, but don't want to couple
|
|
|
|
} PACK_STRUCT;
|
|
|
|
|
|
|
|
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
/** \brief Data structure for a compressed frame in a MDR file
|
|
|
|
*/
|
|
|
|
struct CompFrame
|
|
|
|
{
|
2008-09-16 16:17:32 +00:00
|
|
|
aiVector3D bounds0,bounds1; // bounds of all surfaces of all LOD's for this frame
|
2008-08-08 23:58:40 +00:00
|
|
|
aiVector3D localOrigin; // midpoint of bounds, used for sphere cull
|
ASE: Added WIP support for *SMOOTHSKINMESH elements in ASE/ASC files. Fixes in the ASE loader. Fixed animation parsing. Temporary implementation of target lights and cameras, including animations.
3DS: Fixed transformation problems (Pivot points), added WIP animation support. No target animation yet (cameras, spot lights). Not yet fully tested, but static models that worked before should still work now, except all look correct now :-) (some problems with very large models remaining)
Further work on the IRR and IRRMESH loaders. IRR still WIP, IRRMESH more stable now.
Work on the LWo loader. Added support for the "one-layer-only" mode. Hierarchy bug still unfixed, UV coords bug still unfixed.
Further work on the FindInvalidDataprocess. Improved validation for normals, no false positives anymore.
Further work on the MDR loader, still WIP.
Moved DeterminePType-Step to ScenePreprocessor.
aiAnimation::mDuration is optional now, ScenePreprocessor computes it automatically if set to -1.
Fixes in the SMD loader. Still crashes on some files.
Updated animation documentation.
git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@236 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
2008-11-09 23:17:19 +00:00
|
|
|
float radius; // dist from localOrigin to corner
|
2008-08-08 23:58:40 +00:00
|
|
|
} PACK_STRUCT;
|
|
|
|
|
|
|
|
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
/** \brief Data structure for a LOD in a MDR file
|
|
|
|
*/
|
|
|
|
struct LOD
|
|
|
|
{
|
|
|
|
uint32_t numSurfaces;
|
|
|
|
uint32_t ofsSurfaces; // first surface, others follow
|
|
|
|
uint32_t ofsEnd; // next lod follows
|
|
|
|
} ;
|
|
|
|
|
|
|
|
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
/** \brief Data structure for a tag (= attachment) in a MDR file
|
|
|
|
*/
|
|
|
|
struct Tag
|
|
|
|
{
|
|
|
|
uint32_t boneIndex;
|
|
|
|
char name[32];
|
|
|
|
} PACK_STRUCT;
|
|
|
|
|
|
|
|
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
/** \brief Header data structure for a MDR file
|
|
|
|
*/
|
|
|
|
struct Header
|
|
|
|
{
|
ASE: Added WIP support for *SMOOTHSKINMESH elements in ASE/ASC files. Fixes in the ASE loader. Fixed animation parsing. Temporary implementation of target lights and cameras, including animations.
3DS: Fixed transformation problems (Pivot points), added WIP animation support. No target animation yet (cameras, spot lights). Not yet fully tested, but static models that worked before should still work now, except all look correct now :-) (some problems with very large models remaining)
Further work on the IRR and IRRMESH loaders. IRR still WIP, IRRMESH more stable now.
Work on the LWo loader. Added support for the "one-layer-only" mode. Hierarchy bug still unfixed, UV coords bug still unfixed.
Further work on the FindInvalidDataprocess. Improved validation for normals, no false positives anymore.
Further work on the MDR loader, still WIP.
Moved DeterminePType-Step to ScenePreprocessor.
aiAnimation::mDuration is optional now, ScenePreprocessor computes it automatically if set to -1.
Fixes in the SMD loader. Still crashes on some files.
Updated animation documentation.
git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@236 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
2008-11-09 23:17:19 +00:00
|
|
|
int32_t ident;
|
|
|
|
int32_t version;
|
2008-08-08 23:58:40 +00:00
|
|
|
|
|
|
|
char name[AI_MDR_MAXQPATH];
|
|
|
|
|
|
|
|
// frames and bones are shared by all levels of detail
|
ASE: Added WIP support for *SMOOTHSKINMESH elements in ASE/ASC files. Fixes in the ASE loader. Fixed animation parsing. Temporary implementation of target lights and cameras, including animations.
3DS: Fixed transformation problems (Pivot points), added WIP animation support. No target animation yet (cameras, spot lights). Not yet fully tested, but static models that worked before should still work now, except all look correct now :-) (some problems with very large models remaining)
Further work on the IRR and IRRMESH loaders. IRR still WIP, IRRMESH more stable now.
Work on the LWo loader. Added support for the "one-layer-only" mode. Hierarchy bug still unfixed, UV coords bug still unfixed.
Further work on the FindInvalidDataprocess. Improved validation for normals, no false positives anymore.
Further work on the MDR loader, still WIP.
Moved DeterminePType-Step to ScenePreprocessor.
aiAnimation::mDuration is optional now, ScenePreprocessor computes it automatically if set to -1.
Fixes in the SMD loader. Still crashes on some files.
Updated animation documentation.
git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@236 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
2008-11-09 23:17:19 +00:00
|
|
|
int32_t numFrames;
|
|
|
|
int32_t numBones;
|
|
|
|
int32_t ofsFrames;
|
2008-08-08 23:58:40 +00:00
|
|
|
|
|
|
|
// each level of detail has completely separate sets of surfaces
|
ASE: Added WIP support for *SMOOTHSKINMESH elements in ASE/ASC files. Fixes in the ASE loader. Fixed animation parsing. Temporary implementation of target lights and cameras, including animations.
3DS: Fixed transformation problems (Pivot points), added WIP animation support. No target animation yet (cameras, spot lights). Not yet fully tested, but static models that worked before should still work now, except all look correct now :-) (some problems with very large models remaining)
Further work on the IRR and IRRMESH loaders. IRR still WIP, IRRMESH more stable now.
Work on the LWo loader. Added support for the "one-layer-only" mode. Hierarchy bug still unfixed, UV coords bug still unfixed.
Further work on the FindInvalidDataprocess. Improved validation for normals, no false positives anymore.
Further work on the MDR loader, still WIP.
Moved DeterminePType-Step to ScenePreprocessor.
aiAnimation::mDuration is optional now, ScenePreprocessor computes it automatically if set to -1.
Fixes in the SMD loader. Still crashes on some files.
Updated animation documentation.
git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@236 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
2008-11-09 23:17:19 +00:00
|
|
|
int32_t numLODs;
|
|
|
|
int32_t ofsLODs;
|
2008-08-08 23:58:40 +00:00
|
|
|
|
ASE: Added WIP support for *SMOOTHSKINMESH elements in ASE/ASC files. Fixes in the ASE loader. Fixed animation parsing. Temporary implementation of target lights and cameras, including animations.
3DS: Fixed transformation problems (Pivot points), added WIP animation support. No target animation yet (cameras, spot lights). Not yet fully tested, but static models that worked before should still work now, except all look correct now :-) (some problems with very large models remaining)
Further work on the IRR and IRRMESH loaders. IRR still WIP, IRRMESH more stable now.
Work on the LWo loader. Added support for the "one-layer-only" mode. Hierarchy bug still unfixed, UV coords bug still unfixed.
Further work on the FindInvalidDataprocess. Improved validation for normals, no false positives anymore.
Further work on the MDR loader, still WIP.
Moved DeterminePType-Step to ScenePreprocessor.
aiAnimation::mDuration is optional now, ScenePreprocessor computes it automatically if set to -1.
Fixes in the SMD loader. Still crashes on some files.
Updated animation documentation.
git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@236 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
2008-11-09 23:17:19 +00:00
|
|
|
int32_t numTags;
|
|
|
|
int32_t ofsTags;
|
2008-08-08 23:58:40 +00:00
|
|
|
|
ASE: Added WIP support for *SMOOTHSKINMESH elements in ASE/ASC files. Fixes in the ASE loader. Fixed animation parsing. Temporary implementation of target lights and cameras, including animations.
3DS: Fixed transformation problems (Pivot points), added WIP animation support. No target animation yet (cameras, spot lights). Not yet fully tested, but static models that worked before should still work now, except all look correct now :-) (some problems with very large models remaining)
Further work on the IRR and IRRMESH loaders. IRR still WIP, IRRMESH more stable now.
Work on the LWo loader. Added support for the "one-layer-only" mode. Hierarchy bug still unfixed, UV coords bug still unfixed.
Further work on the FindInvalidDataprocess. Improved validation for normals, no false positives anymore.
Further work on the MDR loader, still WIP.
Moved DeterminePType-Step to ScenePreprocessor.
aiAnimation::mDuration is optional now, ScenePreprocessor computes it automatically if set to -1.
Fixes in the SMD loader. Still crashes on some files.
Updated animation documentation.
git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@236 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
2008-11-09 23:17:19 +00:00
|
|
|
int32_t ofsEnd;
|
2008-08-08 23:58:40 +00:00
|
|
|
} PACK_STRUCT;
|
|
|
|
|
|
|
|
|
2008-09-12 20:25:11 +00:00
|
|
|
#include "./../include/Compiler/poppack1.h"
|
2008-08-08 23:58:40 +00:00
|
|
|
|
2008-09-16 16:17:32 +00:00
|
|
|
}}
|
2008-08-08 23:58:40 +00:00
|
|
|
|
2008-09-12 20:25:11 +00:00
|
|
|
#endif // !! AI_MDRFILEHELPER_H_INC
|