2008-05-09 17:24:28 +00:00
|
|
|
/*
|
2012-02-03 03:38:30 +00:00
|
|
|
Open Asset Import Library (assimp)
|
2008-05-09 17:24:28 +00:00
|
|
|
----------------------------------------------------------------------
|
|
|
|
|
2012-02-03 03:38:30 +00:00
|
|
|
Copyright (c) 2006-2012, assimp team
|
2008-05-09 17:24:28 +00:00
|
|
|
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.
|
|
|
|
|
2012-02-03 03:38:30 +00:00
|
|
|
* Neither the name of the assimp team, nor the names of its
|
2008-05-09 17:24:28 +00:00
|
|
|
contributors may be used to endorse or promote products
|
|
|
|
derived from this software without specific prior
|
2012-02-03 03:38:30 +00:00
|
|
|
written permission of the assimp team.
|
2008-05-09 17:24:28 +00:00
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
----------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
2009-01-20 21:41:17 +00:00
|
|
|
/** @file MDLLoader.h
|
|
|
|
* @brief Declaration of the loader for MDL files
|
|
|
|
*/
|
2008-05-09 17:24:28 +00:00
|
|
|
|
|
|
|
#ifndef AI_MDLLOADER_H_INCLUDED
|
|
|
|
#define AI_MDLLOADER_H_INCLUDED
|
|
|
|
|
|
|
|
#include "BaseImporter.h"
|
|
|
|
|
|
|
|
struct aiNode;
|
|
|
|
#include "MDLFileData.h"
|
2008-05-30 23:01:25 +00:00
|
|
|
#include "HalfLifeFileData.h"
|
2008-05-09 17:24:28 +00:00
|
|
|
|
2008-08-28 17:35:36 +00:00
|
|
|
namespace Assimp {
|
2011-08-22 20:22:51 +00:00
|
|
|
|
2008-05-09 17:24:28 +00:00
|
|
|
|
|
|
|
using namespace MDL;
|
|
|
|
|
2009-01-20 21:41:17 +00:00
|
|
|
// --------------------------------------------------------------------------------------
|
|
|
|
// Include file/line information in debug builds
|
|
|
|
#ifdef ASSIMP_BUILD_DEBUG
|
|
|
|
# define VALIDATE_FILE_SIZE(msg) SizeCheck(msg,__FILE__,__LINE__)
|
|
|
|
#else
|
|
|
|
# define VALIDATE_FILE_SIZE(msg) SizeCheck(msg)
|
2008-06-22 10:09:26 +00:00
|
|
|
#endif
|
|
|
|
|
2009-01-20 21:41:17 +00:00
|
|
|
// --------------------------------------------------------------------------------------
|
|
|
|
/** @brief Class to load MDL files.
|
|
|
|
*
|
|
|
|
* Several subformats exist:
|
|
|
|
* <ul>
|
|
|
|
* <li>Quake I</li>
|
|
|
|
* <li>3D Game Studio MDL3, MDL4</li>
|
|
|
|
* <li>3D Game Studio MDL5</li>
|
|
|
|
* <li>3D Game Studio MDL7</li>
|
|
|
|
* <li>Halflife 2</li>
|
|
|
|
* </ul>
|
|
|
|
* These formats are partially identical and it would be possible to load
|
|
|
|
* them all with a single 1000-line function-beast. However, it has been
|
2011-08-20 22:00:33 +00:00
|
|
|
* split into several code paths to make the code easier to read and maintain.
|
2008-05-09 17:24:28 +00:00
|
|
|
*/
|
|
|
|
class MDLImporter : public BaseImporter
|
|
|
|
{
|
2011-08-01 20:58:31 +00:00
|
|
|
public:
|
2008-05-09 17:24:28 +00:00
|
|
|
MDLImporter();
|
|
|
|
~MDLImporter();
|
|
|
|
|
2011-08-01 20:58:31 +00:00
|
|
|
|
2008-05-09 17:24:28 +00:00
|
|
|
public:
|
|
|
|
|
|
|
|
// -------------------------------------------------------------------
|
|
|
|
/** Returns whether the class can handle the format of the given file.
|
|
|
|
* See BaseImporter::CanRead() for details. */
|
General
- Added format auto-detection to most loaders
- Simplified BaseImporter::CanRead() with some utility methods
- improved fast_atof -> no overruns anymore. Fuck you, irrlicht.
- added assimp_cmd tool to allow command line model processing. Mainly adebugging tool for internal purposes, but others might find it useful, too.
- vc8/vc9: revision number is now written to DLL version header
- mkutil: some batch scripts to simplify tagging & building of release versions
- some API cleanup
- fixing some doxygen markup (+now explicit use of @file <filename>)
- Icon for assimp_view and assimp_cmd
3DS
- Normal vectors are not anymore inverted in some cases
- Improved pivot handling
- Improved handling of x-flipped meshes
Collada
- fixed a minor bug (visual_scene element)
LWS
- WIP implementation. No animations yet, some bugs and crashes.
- Animation system remains disabled, WIP code
- many test files for LWS, but most of them test the anim support, which is, read above, currently disabled.
STL
- fixing a log warning which appears for every model
- added binary&ascii test spider, exported from truespace
MD3
- Cleaning up output tags for automatically joined player models.
IRR
- Fixing coordinate system issues.
- Instance handling improved.
- Some of the reported crashes not yet fixed.
PretransformVertices
- Numerous performance improvements.
- Added config option to preserve the hierarchy during the step.
RemoveRedundantMaterials
- Added config option to specify a list of materials which are kept in every case.
UNREAL
- Added support for the old unreal data format (*.a,*.d,*.uc)
- tested only with exports from Milkshape
- more Unreal stuff to come soon
git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@356 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
2009-03-05 22:32:13 +00:00
|
|
|
bool CanRead( const std::string& pFile, IOSystem* pIOHandler,
|
|
|
|
bool checkSig) const;
|
2008-05-09 17:24:28 +00:00
|
|
|
|
2008-08-09 22:39:57 +00:00
|
|
|
|
|
|
|
// -------------------------------------------------------------------
|
|
|
|
/** Called prior to ReadFile().
|
|
|
|
* The function is a request to the importer to update its configuration
|
|
|
|
* basing on the Importer's configuration property list.
|
|
|
|
*/
|
|
|
|
void SetupProperties(const Importer* pImp);
|
|
|
|
|
2008-05-09 17:24:28 +00:00
|
|
|
protected:
|
|
|
|
|
|
|
|
|
|
|
|
// -------------------------------------------------------------------
|
|
|
|
/** Called by Importer::GetExtensionList() for each loaded importer.
|
|
|
|
* See BaseImporter::GetExtensionList() for details
|
|
|
|
*/
|
2010-03-02 17:38:01 +00:00
|
|
|
void GetExtensionList(std::set<std::string>& extensions);
|
2008-05-09 17:24:28 +00:00
|
|
|
|
|
|
|
// -------------------------------------------------------------------
|
|
|
|
/** Imports the given file into the given scene structure.
|
|
|
|
* See BaseImporter::InternReadFile() for details
|
|
|
|
*/
|
|
|
|
void InternReadFile( const std::string& pFile, aiScene* pScene,
|
|
|
|
IOSystem* pIOHandler);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
// -------------------------------------------------------------------
|
2008-06-22 10:09:26 +00:00
|
|
|
/** Import a quake 1 MDL file (IDPO)
|
2008-05-09 17:24:28 +00:00
|
|
|
*/
|
|
|
|
void InternReadFile_Quake1( );
|
|
|
|
|
|
|
|
// -------------------------------------------------------------------
|
2008-06-22 10:09:26 +00:00
|
|
|
/** Import a GameStudio A4/A5 file (MDL 3,4,5)
|
2008-05-09 17:24:28 +00:00
|
|
|
*/
|
2008-06-22 10:09:26 +00:00
|
|
|
void InternReadFile_3DGS_MDL345( );
|
2008-05-09 17:24:28 +00:00
|
|
|
|
|
|
|
// -------------------------------------------------------------------
|
2008-06-22 10:09:26 +00:00
|
|
|
/** Import a GameStudio A7 file (MDL 7)
|
2008-05-09 17:24:28 +00:00
|
|
|
*/
|
2008-06-22 10:09:26 +00:00
|
|
|
void InternReadFile_3DGS_MDL7( );
|
2008-05-09 17:24:28 +00:00
|
|
|
|
2008-05-22 10:20:31 +00:00
|
|
|
// -------------------------------------------------------------------
|
2008-06-22 10:09:26 +00:00
|
|
|
/** Import a CS:S/HL2 MDL file (not fully implemented)
|
2008-05-22 10:20:31 +00:00
|
|
|
*/
|
|
|
|
void InternReadFile_HL2( );
|
|
|
|
|
2008-05-09 17:24:28 +00:00
|
|
|
// -------------------------------------------------------------------
|
2008-06-22 10:09:26 +00:00
|
|
|
/** Check whether a given position is inside the valid range
|
2010-03-19 20:26:43 +00:00
|
|
|
* Throw a DeadlyImportError if it is not
|
2008-06-22 10:09:26 +00:00
|
|
|
* \param szPos Cursor position
|
|
|
|
* \param szFile Name of the source file from which the function was called
|
|
|
|
* \param iLine Source code line from which the function was called
|
2008-05-09 17:24:28 +00:00
|
|
|
*/
|
2008-06-22 10:09:26 +00:00
|
|
|
void SizeCheck(const void* szPos);
|
|
|
|
void SizeCheck(const void* szPos, const char* szFile, unsigned int iLine);
|
|
|
|
|
2008-05-09 17:24:28 +00:00
|
|
|
|
2008-06-22 10:09:26 +00:00
|
|
|
// -------------------------------------------------------------------
|
|
|
|
/** Validate the header data structure of a game studio MDL7 file
|
|
|
|
* \param pcHeader Input header to be validated
|
|
|
|
*/
|
|
|
|
void ValidateHeader_3DGS_MDL7(const MDL::Header_MDL7* pcHeader);
|
|
|
|
|
|
|
|
// -------------------------------------------------------------------
|
|
|
|
/** Validate the header data structure of a Quake 1 model
|
|
|
|
* \param pcHeader Input header to be validated
|
|
|
|
*/
|
|
|
|
void ValidateHeader_Quake1(const MDL::Header* pcHeader);
|
|
|
|
|
|
|
|
|
|
|
|
// -------------------------------------------------------------------
|
|
|
|
/** Try to load a palette from the current directory (colormap.lmp)
|
|
|
|
* If it is not found the default palette of Quake1 is returned
|
|
|
|
*/
|
|
|
|
void SearchPalette(const unsigned char** pszColorMap);
|
|
|
|
|
|
|
|
// -------------------------------------------------------------------
|
|
|
|
/** Free a palette created with a previous call to SearchPalette()
|
|
|
|
*/
|
|
|
|
void FreePalette(const unsigned char* pszColorMap);
|
|
|
|
|
|
|
|
|
|
|
|
// -------------------------------------------------------------------
|
|
|
|
/** Load a paletized texture from the file and convert it to 32bpp
|
|
|
|
*/
|
|
|
|
void CreateTextureARGB8_3DGS_MDL3(const unsigned char* szData);
|
2008-05-09 17:24:28 +00:00
|
|
|
|
|
|
|
// -------------------------------------------------------------------
|
|
|
|
/** Used to load textures from MDL3/4
|
|
|
|
* \param szData Input data
|
|
|
|
* \param iType Color data type
|
2008-06-22 10:09:26 +00:00
|
|
|
* \param piSkip Receive: Size to skip, in bytes
|
2008-05-09 17:24:28 +00:00
|
|
|
*/
|
2008-06-22 10:09:26 +00:00
|
|
|
void CreateTexture_3DGS_MDL4(const unsigned char* szData,
|
2008-05-09 17:24:28 +00:00
|
|
|
unsigned int iType,
|
|
|
|
unsigned int* piSkip);
|
|
|
|
|
2009-01-20 21:41:17 +00:00
|
|
|
|
2008-05-09 17:24:28 +00:00
|
|
|
// -------------------------------------------------------------------
|
|
|
|
/** Used to load textures from MDL5
|
|
|
|
* \param szData Input data
|
|
|
|
* \param iType Color data type
|
2008-06-22 10:09:26 +00:00
|
|
|
* \param piSkip Receive: Size to skip, in bytes
|
2008-05-09 17:24:28 +00:00
|
|
|
*/
|
2008-06-22 10:09:26 +00:00
|
|
|
void CreateTexture_3DGS_MDL5(const unsigned char* szData,
|
2008-05-09 17:24:28 +00:00
|
|
|
unsigned int iType,
|
|
|
|
unsigned int* piSkip);
|
|
|
|
|
2008-06-22 10:09:26 +00:00
|
|
|
|
|
|
|
// -------------------------------------------------------------------
|
|
|
|
/** Checks whether a texture can be replaced with a single color
|
|
|
|
* This is useful for all file formats before MDL7 (all those
|
|
|
|
* that are not containing material colors separate from textures).
|
|
|
|
* MED seems to write dummy 8x8 monochrome images instead.
|
|
|
|
* \param pcTexture Input texture
|
|
|
|
* \return aiColor.r is set to qnan if the function fails and no
|
|
|
|
* color can be found.
|
|
|
|
*/
|
|
|
|
aiColor4D ReplaceTextureWithColor(const aiTexture* pcTexture);
|
|
|
|
|
|
|
|
|
|
|
|
// -------------------------------------------------------------------
|
|
|
|
/** Converts the absolute texture coordinates in MDL5 files to
|
|
|
|
* relative in a range between 0 and 1
|
|
|
|
*/
|
|
|
|
void CalculateUVCoordinates_MDL5();
|
|
|
|
|
2009-01-20 21:41:17 +00:00
|
|
|
|
2008-06-22 10:09:26 +00:00
|
|
|
// -------------------------------------------------------------------
|
|
|
|
/** Read an UV coordinate from the file. If the file format is not
|
|
|
|
* MDL5, the function calculates relative texture coordinates
|
|
|
|
* \param vOut Receives the output UV coord
|
|
|
|
* \param pcSrc UV coordinate buffer
|
|
|
|
* \param UV coordinate index
|
|
|
|
*/
|
|
|
|
void ImportUVCoordinate_3DGS_MDL345( aiVector3D& vOut,
|
|
|
|
const MDL::TexCoord_MDL3* pcSrc,
|
|
|
|
unsigned int iIndex);
|
|
|
|
|
2008-05-09 17:24:28 +00:00
|
|
|
// -------------------------------------------------------------------
|
2008-06-22 10:09:26 +00:00
|
|
|
/** Setup the material properties for Quake and MDL<7 models.
|
|
|
|
* These formats don't support more than one material per mesh,
|
|
|
|
* therefore the method processes only ONE skin and removes
|
|
|
|
* all others.
|
|
|
|
*/
|
|
|
|
void SetupMaterialProperties_3DGS_MDL5_Quake1( );
|
|
|
|
|
|
|
|
|
|
|
|
// -------------------------------------------------------------------
|
|
|
|
/** Parse a skin lump in a MDL7/HMP7 file with all of its features
|
|
|
|
* variant 1: Current cursor position is the beginning of the skin header
|
2008-05-09 17:24:28 +00:00
|
|
|
* \param szCurrent Current data pointer
|
|
|
|
* \param szCurrentOut Output data pointer
|
|
|
|
* \param pcMats Material list for this group. To be filled ...
|
|
|
|
*/
|
2008-06-22 10:09:26 +00:00
|
|
|
void ParseSkinLump_3DGS_MDL7(
|
2008-05-09 17:24:28 +00:00
|
|
|
const unsigned char* szCurrent,
|
|
|
|
const unsigned char** szCurrentOut,
|
2011-08-22 20:22:51 +00:00
|
|
|
std::vector<aiMaterial*>& pcMats);
|
2008-05-09 17:24:28 +00:00
|
|
|
|
2008-06-22 10:09:26 +00:00
|
|
|
// -------------------------------------------------------------------
|
|
|
|
/** Parse a skin lump in a MDL7/HMP7 file with all of its features
|
|
|
|
* variant 2: Current cursor position is the beginning of the skin data
|
|
|
|
* \param szCurrent Current data pointer
|
|
|
|
* \param szCurrentOut Output data pointer
|
|
|
|
* \param pcMatOut Output material
|
|
|
|
* \param iType header.typ
|
|
|
|
* \param iWidth header.width
|
|
|
|
* \param iHeight header.height
|
|
|
|
*/
|
|
|
|
void ParseSkinLump_3DGS_MDL7(
|
|
|
|
const unsigned char* szCurrent,
|
|
|
|
const unsigned char** szCurrentOut,
|
2011-08-22 20:22:51 +00:00
|
|
|
aiMaterial* pcMatOut,
|
2008-06-22 10:09:26 +00:00
|
|
|
unsigned int iType,
|
|
|
|
unsigned int iWidth,
|
|
|
|
unsigned int iHeight);
|
|
|
|
|
|
|
|
// -------------------------------------------------------------------
|
|
|
|
/** Skip a skin lump in a MDL7/HMP7 file
|
|
|
|
* \param szCurrent Current data pointer
|
|
|
|
* \param szCurrentOut Output data pointer. Points to the byte just
|
|
|
|
* behind the last byte of the skin.
|
|
|
|
* \param iType header.typ
|
|
|
|
* \param iWidth header.width
|
|
|
|
* \param iHeight header.height
|
|
|
|
*/
|
|
|
|
void SkipSkinLump_3DGS_MDL7(const unsigned char* szCurrent,
|
|
|
|
const unsigned char** szCurrentOut,
|
|
|
|
unsigned int iType,
|
|
|
|
unsigned int iWidth,
|
|
|
|
unsigned int iHeight);
|
|
|
|
|
2008-05-09 17:24:28 +00:00
|
|
|
// -------------------------------------------------------------------
|
|
|
|
/** Parse texture color data for MDL5, MDL6 and MDL7 formats
|
|
|
|
* \param szData Current data pointer
|
|
|
|
* \param iType type of the texture data. No DDS or external
|
|
|
|
* \param piSkip Receive the number of bytes to skip
|
|
|
|
* \param pcNew Must point to fully initialized data. Width and
|
2011-04-22 21:29:18 +00:00
|
|
|
* height must be set. If pcNew->pcData is set to UINT_MAX,
|
2008-06-22 10:09:26 +00:00
|
|
|
* piSkip will receive the size of the texture, in bytes, but no
|
|
|
|
* color data will be read.
|
2008-05-09 17:24:28 +00:00
|
|
|
*/
|
|
|
|
void ParseTextureColorData(const unsigned char* szData,
|
|
|
|
unsigned int iType,
|
|
|
|
unsigned int* piSkip,
|
|
|
|
aiTexture* pcNew);
|
|
|
|
|
|
|
|
// -------------------------------------------------------------------
|
|
|
|
/** Join two materials / skins. Setup UV source ... etc
|
|
|
|
* \param pcMat1 First input material
|
|
|
|
* \param pcMat2 Second input material
|
|
|
|
* \param pcMatOut Output material instance to be filled. Must be empty
|
|
|
|
*/
|
2011-08-22 20:22:51 +00:00
|
|
|
void JoinSkins_3DGS_MDL7(aiMaterial* pcMat1,
|
|
|
|
aiMaterial* pcMat2,
|
|
|
|
aiMaterial* pcMatOut);
|
2008-05-09 17:24:28 +00:00
|
|
|
|
|
|
|
// -------------------------------------------------------------------
|
2008-06-22 10:09:26 +00:00
|
|
|
/** Add a bone transformation key to an animation
|
|
|
|
* \param iTrafo Index of the transformation (always==frame index?)
|
|
|
|
* No need to validate this index, it is always valid.
|
|
|
|
* \param pcBoneTransforms Bone transformation for this index
|
|
|
|
* \param apcOutBones Output bones array
|
2008-05-09 17:24:28 +00:00
|
|
|
*/
|
2008-06-22 10:09:26 +00:00
|
|
|
void AddAnimationBoneTrafoKey_3DGS_MDL7(unsigned int iTrafo,
|
|
|
|
const MDL::BoneTransform_MDL7* pcBoneTransforms,
|
|
|
|
MDL::IntBone_MDL7** apcBonesOut);
|
2008-05-09 17:24:28 +00:00
|
|
|
|
2008-06-22 10:09:26 +00:00
|
|
|
// -------------------------------------------------------------------
|
|
|
|
/** Load the bone list of a MDL7 file
|
|
|
|
* \return If the bones could be loaded successfully, a valid
|
|
|
|
* array containing pointers to a temporary bone
|
|
|
|
* representation. NULL if the bones could not be loaded.
|
|
|
|
*/
|
|
|
|
MDL::IntBone_MDL7** LoadBones_3DGS_MDL7();
|
|
|
|
|
|
|
|
// -------------------------------------------------------------------
|
|
|
|
/** Load bone transformation keyframes from a file chunk
|
|
|
|
* \param groupInfo -> doc of data structure
|
|
|
|
* \param frame -> doc of data structure
|
|
|
|
* \param shared -> doc of data structure
|
|
|
|
*/
|
|
|
|
void ParseBoneTrafoKeys_3DGS_MDL7(
|
|
|
|
const MDL::IntGroupInfo_MDL7& groupInfo,
|
|
|
|
IntFrameInfo_MDL7& frame,
|
|
|
|
MDL::IntSharedData_MDL7& shared);
|
2008-05-09 17:24:28 +00:00
|
|
|
|
2008-06-03 21:50:53 +00:00
|
|
|
// -------------------------------------------------------------------
|
|
|
|
/** Calculate absolute bone animation matrices for each bone
|
|
|
|
* \param apcOutBones Output bones array
|
|
|
|
*/
|
2008-11-02 22:21:07 +00:00
|
|
|
void CalcAbsBoneMatrices_3DGS_MDL7(MDL::IntBone_MDL7** apcOutBones);
|
2008-06-03 21:50:53 +00:00
|
|
|
|
2008-05-09 17:24:28 +00:00
|
|
|
// -------------------------------------------------------------------
|
2008-06-22 10:09:26 +00:00
|
|
|
/** Add all bones to the nodegraph (as children of the root node)
|
|
|
|
* \param apcBonesOut List of bones
|
|
|
|
* \param pcParent Parent node. New nodes will be added to this node
|
|
|
|
* \param iParentIndex Index of the parent bone
|
2008-05-09 17:24:28 +00:00
|
|
|
*/
|
2008-06-22 10:09:26 +00:00
|
|
|
void AddBonesToNodeGraph_3DGS_MDL7(const MDL::IntBone_MDL7** apcBonesOut,
|
|
|
|
aiNode* pcParent,uint16_t iParentIndex);
|
2008-05-09 17:24:28 +00:00
|
|
|
|
|
|
|
// -------------------------------------------------------------------
|
2008-06-22 10:09:26 +00:00
|
|
|
/** Build output animations
|
|
|
|
* \param apcBonesOut List of bones
|
2008-05-09 17:24:28 +00:00
|
|
|
*/
|
2008-06-22 10:09:26 +00:00
|
|
|
void BuildOutputAnims_3DGS_MDL7(const MDL::IntBone_MDL7** apcBonesOut);
|
|
|
|
|
|
|
|
// -------------------------------------------------------------------
|
|
|
|
/** Handles materials that are just referencing another material
|
|
|
|
* There is no test file for this feature, but Conitec's doc
|
|
|
|
* say it is used.
|
|
|
|
*/
|
|
|
|
void HandleMaterialReferences_3DGS_MDL7();
|
|
|
|
|
|
|
|
// -------------------------------------------------------------------
|
|
|
|
/** Copies only the material that are referenced by at least one
|
|
|
|
* mesh to the final output material list. All other materials
|
|
|
|
* will be discarded.
|
|
|
|
* \param shared -> doc of data structure
|
|
|
|
*/
|
|
|
|
void CopyMaterials_3DGS_MDL7(MDL::IntSharedData_MDL7 &shared);
|
|
|
|
|
|
|
|
// -------------------------------------------------------------------
|
|
|
|
/** Process the frame section at the end of a group
|
|
|
|
* \param groupInfo -> doc of data structure
|
|
|
|
* \param shared -> doc of data structure
|
|
|
|
* \param szCurrent Pointer to the start of the frame section
|
|
|
|
* \param szCurrentOut Receives a pointer to the first byte of the
|
|
|
|
* next data section.
|
|
|
|
* \return false to read no further groups (a small workaround for
|
|
|
|
* some tiny and unsolved problems ... )
|
|
|
|
*/
|
|
|
|
bool ProcessFrames_3DGS_MDL7(const MDL::IntGroupInfo_MDL7& groupInfo,
|
2008-08-06 23:01:38 +00:00
|
|
|
MDL::IntGroupData_MDL7& groupData,
|
2008-06-22 10:09:26 +00:00
|
|
|
MDL::IntSharedData_MDL7& shared,
|
|
|
|
const unsigned char* szCurrent,
|
|
|
|
const unsigned char** szCurrentOut);
|
|
|
|
|
|
|
|
// -------------------------------------------------------------------
|
|
|
|
/** Sort all faces by their materials. If the mesh is using
|
|
|
|
* multiple materials per face (that are blended together) the function
|
|
|
|
* might create new materials.
|
|
|
|
* \param groupInfo -> doc of data structure
|
|
|
|
* \param groupData -> doc of data structure
|
2011-08-20 22:00:33 +00:00
|
|
|
* \param splitGroupData -> doc of data structure
|
2008-06-22 10:09:26 +00:00
|
|
|
*/
|
|
|
|
void SortByMaterials_3DGS_MDL7(
|
|
|
|
const MDL::IntGroupInfo_MDL7& groupInfo,
|
|
|
|
MDL::IntGroupData_MDL7& groupData,
|
2011-08-20 22:01:46 +00:00
|
|
|
MDL::IntSplitGroupData_MDL7& splitGroupData);
|
2008-06-22 10:09:26 +00:00
|
|
|
|
|
|
|
// -------------------------------------------------------------------
|
|
|
|
/** Read all faces and vertices from a MDL7 group. The function fills
|
|
|
|
* preallocated memory buffers.
|
|
|
|
* \param groupInfo -> doc of data structure
|
|
|
|
* \param groupData -> doc of data structure
|
|
|
|
*/
|
|
|
|
void ReadFaces_3DGS_MDL7(const MDL::IntGroupInfo_MDL7& groupInfo,
|
|
|
|
MDL::IntGroupData_MDL7& groupData);
|
|
|
|
|
|
|
|
// -------------------------------------------------------------------
|
|
|
|
/** Generate the final output meshes for a7 models
|
|
|
|
* \param groupData -> doc of data structure
|
2011-08-20 22:00:33 +00:00
|
|
|
* \param splitGroupData -> doc of data structure
|
2008-06-22 10:09:26 +00:00
|
|
|
*/
|
|
|
|
void GenerateOutputMeshes_3DGS_MDL7(
|
|
|
|
MDL::IntGroupData_MDL7& groupData,
|
2011-08-20 22:01:46 +00:00
|
|
|
MDL::IntSplitGroupData_MDL7& splitGroupData);
|
2008-05-09 17:24:28 +00:00
|
|
|
|
2008-06-22 10:09:26 +00:00
|
|
|
protected:
|
2008-05-09 17:24:28 +00:00
|
|
|
|
2008-08-06 23:01:38 +00:00
|
|
|
/** Configuration option: frame to be loaded */
|
|
|
|
unsigned int configFrameID;
|
|
|
|
|
2008-08-28 17:35:36 +00:00
|
|
|
/** Configuration option: palette to be used to decode palletized images*/
|
|
|
|
std::string configPalette;
|
|
|
|
|
2008-05-09 17:24:28 +00:00
|
|
|
/** Buffer to hold the loaded file */
|
|
|
|
unsigned char* mBuffer;
|
2008-11-02 22:21:07 +00:00
|
|
|
|
2009-01-20 21:41:17 +00:00
|
|
|
/** For GameStudio MDL files: The number in the magic word, either 3,4 or 5
|
2008-06-22 10:09:26 +00:00
|
|
|
* (MDL7 doesn't need this, the format has a separate loader) */
|
2008-05-09 17:24:28 +00:00
|
|
|
unsigned int iGSFileVersion;
|
|
|
|
|
2008-08-28 17:35:36 +00:00
|
|
|
/** Output I/O handler. used to load external lmp files */
|
2008-05-09 17:24:28 +00:00
|
|
|
IOSystem* pIOHandler;
|
|
|
|
|
2008-08-28 17:35:36 +00:00
|
|
|
/** Output scene to be filled */
|
2008-05-09 17:24:28 +00:00
|
|
|
aiScene* pScene;
|
2008-06-22 10:09:26 +00:00
|
|
|
|
2008-08-28 17:35:36 +00:00
|
|
|
/** Size of the input file in bytes */
|
2008-06-22 10:09:26 +00:00
|
|
|
unsigned int iFileSize;
|
2008-05-09 17:24:28 +00:00
|
|
|
};
|
|
|
|
|
2008-08-17 15:04:10 +00:00
|
|
|
} // end of namespace Assimp
|
|
|
|
|
|
|
|
#endif // AI_3DSIMPORTER_H_INC
|