2008-08-07 22:27:17 +00:00
|
|
|
/*
|
|
|
|
---------------------------------------------------------------------------
|
|
|
|
Open Asset Import Library (ASSIMP)
|
|
|
|
---------------------------------------------------------------------------
|
|
|
|
|
2010-04-10 15:30:22 +00:00
|
|
|
Copyright (c) 2006-2010, ASSIMP Development Team
|
2008-08-07 22:27:17 +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.
|
|
|
|
|
|
|
|
* 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.
|
|
|
|
---------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
|
2009-02-15 20:29:07 +00:00
|
|
|
/** @file LWOLoader.cpp
|
|
|
|
* @brief Implementation of the LWO importer class
|
|
|
|
*/
|
2008-08-07 22:27:17 +00:00
|
|
|
|
2008-10-13 16:45:48 +00:00
|
|
|
#include "AssimpPCH.h"
|
2009-01-18 23:48:25 +00:00
|
|
|
#ifndef ASSIMP_BUILD_NO_LWO_IMPORTER
|
2008-08-07 22:27:17 +00:00
|
|
|
|
2008-09-27 16:46:05 +00:00
|
|
|
// internal headers
|
|
|
|
#include "LWOLoader.h"
|
|
|
|
#include "StringComparison.h"
|
|
|
|
#include "SGSpatialSort.h"
|
|
|
|
#include "ByteSwap.h"
|
|
|
|
#include "ProcessHelper.h"
|
2009-03-15 00:40:30 +00:00
|
|
|
#include "ConvertToLHProcess.h"
|
2008-09-27 16:46:05 +00:00
|
|
|
|
2008-08-07 22:27:17 +00:00
|
|
|
using namespace Assimp;
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
// Constructor to be privately used by Importer
|
|
|
|
LWOImporter::LWOImporter()
|
2009-01-18 23:48:25 +00:00
|
|
|
{}
|
2008-08-07 22:27:17 +00:00
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
// Destructor, private as well
|
|
|
|
LWOImporter::~LWOImporter()
|
2009-01-18 23:48:25 +00:00
|
|
|
{}
|
2008-08-07 22:27:17 +00:00
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
// Returns whether the class can handle the format of the given file.
|
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 LWOImporter::CanRead( const std::string& pFile, IOSystem* pIOHandler, bool checkSig) const
|
2008-08-07 22:27:17 +00:00
|
|
|
{
|
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
|
|
|
const std::string extension = GetExtension(pFile);
|
|
|
|
if (extension == "lwo" || extension == "lxo")
|
|
|
|
return true;
|
|
|
|
|
|
|
|
// if check for extension is not enough, check for the magic tokens
|
|
|
|
if (!extension.length() || checkSig) {
|
|
|
|
uint32_t tokens[3];
|
|
|
|
tokens[0] = AI_LWO_FOURCC_LWOB;
|
|
|
|
tokens[1] = AI_LWO_FOURCC_LWO2;
|
|
|
|
tokens[2] = AI_LWO_FOURCC_LXOB;
|
|
|
|
return CheckMagicToken(pIOHandler,pFile,tokens,3,8);
|
|
|
|
}
|
|
|
|
return false;
|
2008-08-07 22:27:17 +00:00
|
|
|
}
|
2008-09-20 15:55:51 +00:00
|
|
|
|
2008-08-07 22:27:17 +00:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2008-08-13 15:45:57 +00:00
|
|
|
// Setup configuration properties
|
|
|
|
void LWOImporter::SetupProperties(const Importer* pImp)
|
|
|
|
{
|
2008-10-27 00:36:26 +00:00
|
|
|
configSpeedFlag = ( 0 != pImp->GetPropertyInteger(AI_CONFIG_FAVOUR_SPEED,0) ? true : false);
|
2011-04-22 21:29:18 +00:00
|
|
|
configLayerIndex = pImp->GetPropertyInteger (AI_CONFIG_IMPORT_LWO_ONE_LAYER_ONLY,UINT_MAX);
|
2008-10-27 00:36:26 +00:00
|
|
|
configLayerName = pImp->GetPropertyString (AI_CONFIG_IMPORT_LWO_ONE_LAYER_ONLY,"");
|
2008-08-13 15:45:57 +00:00
|
|
|
}
|
2008-09-20 15:55:51 +00:00
|
|
|
|
2008-08-13 15:45:57 +00:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2008-08-07 22:27:17 +00:00
|
|
|
// Imports the given file into the given scene structure.
|
|
|
|
void LWOImporter::InternReadFile( const std::string& pFile,
|
|
|
|
aiScene* pScene,
|
|
|
|
IOSystem* pIOHandler)
|
|
|
|
{
|
|
|
|
boost::scoped_ptr<IOStream> file( pIOHandler->Open( pFile, "rb"));
|
|
|
|
|
|
|
|
// Check whether we can read from the file
|
|
|
|
if( file.get() == NULL)
|
2010-03-18 17:00:12 +00:00
|
|
|
throw DeadlyImportError( "Failed to open LWO file " + pFile + ".");
|
2008-08-07 22:27:17 +00:00
|
|
|
|
|
|
|
if((this->fileSize = (unsigned int)file->FileSize()) < 12)
|
2010-03-18 17:00:12 +00:00
|
|
|
throw DeadlyImportError("LWO: The file is too small to contain the IFF header");
|
2008-08-07 22:27:17 +00:00
|
|
|
|
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
|
|
|
// Allocate storage and copy the contents of the file to a memory buffer
|
2008-08-07 22:27:17 +00:00
|
|
|
std::vector< uint8_t > mBuffer(fileSize);
|
|
|
|
file->Read( &mBuffer[0], 1, fileSize);
|
|
|
|
this->pScene = pScene;
|
|
|
|
|
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
|
|
|
// Determine the type of the file
|
2008-08-07 22:27:17 +00:00
|
|
|
uint32_t fileType;
|
|
|
|
const char* sz = IFF::ReadHeader(&mBuffer[0],fileType);
|
2010-03-18 17:00:12 +00:00
|
|
|
if (sz)throw DeadlyImportError(sz);
|
2008-08-07 22:27:17 +00:00
|
|
|
|
|
|
|
mFileBuffer = &mBuffer[0] + 12;
|
|
|
|
fileSize -= 12;
|
|
|
|
|
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
|
|
|
// Initialize some members with their default values
|
|
|
|
hasNamedLayer = false;
|
|
|
|
|
|
|
|
// Create temporary storage on the stack but store pointers to it in the class
|
2008-08-15 23:23:28 +00:00
|
|
|
// instance. Therefore everything will be destructed properly if an exception
|
|
|
|
// is thrown and we needn't take care of that.
|
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
|
|
|
LayerList _mLayers;
|
|
|
|
SurfaceList _mSurfaces;
|
|
|
|
TagList _mTags;
|
2008-08-10 23:58:21 +00:00
|
|
|
TagMappingTable _mMapping;
|
|
|
|
|
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
|
|
|
mLayers = &_mLayers;
|
|
|
|
mTags = &_mTags;
|
|
|
|
mMapping = &_mMapping;
|
|
|
|
mSurfaces = &_mSurfaces;
|
|
|
|
|
|
|
|
// Allocate a default layer (layer indices are 1-based from now)
|
2008-08-15 23:23:28 +00:00
|
|
|
mLayers->push_back(Layer());
|
|
|
|
mCurLayer = &mLayers->back();
|
|
|
|
mCurLayer->mName = "<LWODefault>";
|
2011-12-07 06:22:02 +00:00
|
|
|
mCurLayer->mIndex = -1;
|
2008-08-15 23:23:28 +00:00
|
|
|
|
2008-08-10 23:58:21 +00:00
|
|
|
// old lightwave file format (prior to v6)
|
2009-03-26 22:05:56 +00:00
|
|
|
if (AI_LWO_FOURCC_LWOB == fileType) {
|
2008-11-04 20:41:11 +00:00
|
|
|
DefaultLogger::get()->info("LWO file format: LWOB (<= LightWave 5.5)");
|
|
|
|
|
2008-08-13 15:45:57 +00:00
|
|
|
mIsLWO2 = false;
|
2010-03-18 17:20:49 +00:00
|
|
|
mIsLXOB = false;
|
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
|
|
|
LoadLWOBFile();
|
2008-08-13 15:45:57 +00:00
|
|
|
}
|
2008-11-16 21:56:45 +00:00
|
|
|
// New lightwave format
|
2009-03-26 22:05:56 +00:00
|
|
|
else if (AI_LWO_FOURCC_LWO2 == fileType) {
|
2010-03-18 17:20:49 +00:00
|
|
|
mIsLXOB = false;
|
2008-11-04 20:41:11 +00:00
|
|
|
DefaultLogger::get()->info("LWO file format: LWO2 (>= LightWave 6)");
|
2008-11-16 21:56:45 +00:00
|
|
|
}
|
|
|
|
// MODO file format
|
2009-03-26 22:05:56 +00:00
|
|
|
else if (AI_LWO_FOURCC_LXOB == fileType) {
|
2010-03-18 17:20:49 +00:00
|
|
|
mIsLXOB = true;
|
2008-11-16 21:56:45 +00:00
|
|
|
DefaultLogger::get()->info("LWO file format: LXOB (Modo)");
|
|
|
|
}
|
|
|
|
// we don't know this format
|
|
|
|
else
|
|
|
|
{
|
|
|
|
char szBuff[5];
|
|
|
|
szBuff[0] = (char)(fileType >> 24u);
|
|
|
|
szBuff[1] = (char)(fileType >> 16u);
|
|
|
|
szBuff[2] = (char)(fileType >> 8u);
|
|
|
|
szBuff[3] = (char)(fileType);
|
2010-03-18 17:25:11 +00:00
|
|
|
szBuff[4] = '\0';
|
2010-03-18 17:00:12 +00:00
|
|
|
throw DeadlyImportError(std::string("Unknown LWO sub format: ") + szBuff);
|
2008-11-16 21:56:45 +00:00
|
|
|
}
|
2008-11-04 20:41:11 +00:00
|
|
|
|
2009-03-26 22:05:56 +00:00
|
|
|
if (AI_LWO_FOURCC_LWOB != fileType) {
|
2008-08-13 15:45:57 +00:00
|
|
|
mIsLWO2 = true;
|
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
|
|
|
LoadLWO2File();
|
|
|
|
|
|
|
|
// The newer lightwave format allows the user to configure the
|
|
|
|
// loader that just one layer is used. If this is the case
|
|
|
|
// we need to check now whether the requested layer has been found.
|
2011-12-07 01:28:45 +00:00
|
|
|
if (UINT_MAX != configLayerIndex) {
|
|
|
|
unsigned int layerCount = 0;
|
|
|
|
for(std::list<LWO::Layer>::iterator itLayers=mLayers->begin(); itLayers!=mLayers->end(); itLayers++)
|
|
|
|
if (!itLayers->skip)
|
|
|
|
layerCount++;
|
|
|
|
if (layerCount!=1)
|
|
|
|
throw DeadlyImportError("LWO2: The requested layer was not found");
|
|
|
|
}
|
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
|
|
|
|
2009-03-26 22:05:56 +00:00
|
|
|
if (configLayerName.length() && !hasNamedLayer) {
|
2010-03-18 17:00:12 +00:00
|
|
|
throw DeadlyImportError("LWO2: Unable to find the requested layer: "
|
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
|
|
|
+ configLayerName);
|
|
|
|
}
|
2008-08-13 15:45:57 +00:00
|
|
|
}
|
2008-08-10 23:58:21 +00:00
|
|
|
|
2008-09-20 15:55:51 +00:00
|
|
|
// now, as we have loaded all data, we can resolve cross-referenced tags and clips
|
2008-08-10 23:58:21 +00:00
|
|
|
ResolveTags();
|
2008-09-20 15:55:51 +00:00
|
|
|
ResolveClips();
|
2008-08-07 22:27:17 +00:00
|
|
|
|
2008-08-15 23:23:28 +00:00
|
|
|
// now process all layers and build meshes and nodes
|
|
|
|
std::vector<aiMesh*> apcMeshes;
|
2011-12-07 06:22:02 +00:00
|
|
|
std::map<uint16_t, aiNode*> apcNodes;
|
|
|
|
|
2008-08-28 17:35:36 +00:00
|
|
|
apcMeshes.reserve(mLayers->size()*std::min(((unsigned int)mSurfaces->size()/2u), 1u));
|
2008-08-07 22:27:17 +00:00
|
|
|
|
2011-04-22 21:29:18 +00:00
|
|
|
unsigned int iDefaultSurface = UINT_MAX; // index of the default surface
|
2009-03-26 22:05:56 +00:00
|
|
|
for (LayerList::iterator lit = mLayers->begin(), lend = mLayers->end();lit != lend;++lit) {
|
2008-09-20 15:55:51 +00:00
|
|
|
LWO::Layer& layer = *lit;
|
2009-03-26 22:05:56 +00:00
|
|
|
if (layer.skip)
|
|
|
|
continue;
|
2008-08-15 23:23:28 +00:00
|
|
|
|
|
|
|
// I don't know whether there could be dummy layers, but it would be possible
|
2008-08-28 17:35:36 +00:00
|
|
|
const unsigned int meshStart = (unsigned int)apcMeshes.size();
|
2009-03-26 22:05:56 +00:00
|
|
|
if (!layer.mFaces.empty() && !layer.mTempPoints.empty()) {
|
|
|
|
|
2008-08-15 23:23:28 +00:00
|
|
|
// now sort all faces by the surfaces assigned to them
|
|
|
|
std::vector<SortedRep> pSorted(mSurfaces->size()+1);
|
|
|
|
|
|
|
|
unsigned int i = 0;
|
2009-03-26 22:05:56 +00:00
|
|
|
for (FaceList::iterator it = layer.mFaces.begin(), end = layer.mFaces.end();it != end;++it,++i) {
|
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
|
|
|
// Check whether we support this face's type
|
2010-03-19 23:35:29 +00:00
|
|
|
if ((*it).type != AI_LWO_FACE && (*it).type != AI_LWO_PTCH &&
|
|
|
|
(*it).type != AI_LWO_BONE && (*it).type != AI_LWO_SUBD) {
|
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
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2008-08-15 23:23:28 +00:00
|
|
|
unsigned int idx = (*it).surfaceIndex;
|
|
|
|
if (idx >= mTags->size())
|
|
|
|
{
|
|
|
|
DefaultLogger::get()->warn("LWO: Invalid face surface index");
|
2011-04-22 21:29:18 +00:00
|
|
|
idx = UINT_MAX;
|
2008-08-15 23:23:28 +00:00
|
|
|
}
|
2011-04-22 21:29:18 +00:00
|
|
|
if(UINT_MAX == idx || UINT_MAX == (idx = _mMapping[idx])) {
|
|
|
|
if (UINT_MAX == iDefaultSurface) {
|
2008-08-28 17:35:36 +00:00
|
|
|
iDefaultSurface = (unsigned int)mSurfaces->size();
|
2008-08-15 23:23:28 +00:00
|
|
|
mSurfaces->push_back(LWO::Surface());
|
|
|
|
LWO::Surface& surf = mSurfaces->back();
|
|
|
|
surf.mColor.r = surf.mColor.g = surf.mColor.b = 0.6f;
|
2009-02-15 20:29:07 +00:00
|
|
|
surf.mName = "LWODefaultSurface";
|
2008-08-15 23:23:28 +00:00
|
|
|
}
|
|
|
|
idx = iDefaultSurface;
|
|
|
|
}
|
|
|
|
pSorted[idx].push_back(i);
|
2008-08-07 22:27:17 +00:00
|
|
|
}
|
2011-04-22 21:29:18 +00:00
|
|
|
if (UINT_MAX == iDefaultSurface) {
|
2009-03-26 22:05:56 +00:00
|
|
|
pSorted.erase(pSorted.end()-1);
|
|
|
|
}
|
|
|
|
for (unsigned int p = 0,i = 0;i < mSurfaces->size();++i) {
|
2008-08-15 23:23:28 +00:00
|
|
|
SortedRep& sorted = pSorted[i];
|
2009-03-26 22:05:56 +00:00
|
|
|
if (sorted.empty())
|
|
|
|
continue;
|
2008-08-07 22:27:17 +00:00
|
|
|
|
2008-08-15 23:23:28 +00:00
|
|
|
// generate the mesh
|
|
|
|
aiMesh* mesh = new aiMesh();
|
|
|
|
apcMeshes.push_back(mesh);
|
2008-08-28 17:35:36 +00:00
|
|
|
mesh->mNumFaces = (unsigned int)sorted.size();
|
2008-08-07 22:27:17 +00:00
|
|
|
|
2008-09-20 15:55:51 +00:00
|
|
|
// count the number of vertices
|
|
|
|
SortedRep::const_iterator it = sorted.begin(), end = sorted.end();
|
2009-03-26 22:05:56 +00:00
|
|
|
for (;it != end;++it) {
|
2008-08-15 23:23:28 +00:00
|
|
|
mesh->mNumVertices += layer.mFaces[*it].mNumIndices;
|
|
|
|
}
|
|
|
|
|
2008-11-16 21:56:45 +00:00
|
|
|
aiVector3D *nrm = NULL, * pv = mesh->mVertices = new aiVector3D[mesh->mNumVertices];
|
2008-08-15 23:23:28 +00:00
|
|
|
aiFace* pf = mesh->mFaces = new aiFace[mesh->mNumFaces];
|
|
|
|
mesh->mMaterialIndex = i;
|
|
|
|
|
2008-09-08 16:48:21 +00:00
|
|
|
// find out which vertex color channels and which texture coordinate
|
|
|
|
// channels are really required by the material attached to this mesh
|
|
|
|
unsigned int vUVChannelIndices[AI_MAX_NUMBER_OF_TEXTURECOORDS];
|
|
|
|
unsigned int vVColorIndices[AI_MAX_NUMBER_OF_COLOR_SETS];
|
|
|
|
|
|
|
|
#if _DEBUG
|
2011-04-22 21:29:18 +00:00
|
|
|
for (unsigned int mui = 0; mui < AI_MAX_NUMBER_OF_TEXTURECOORDS;++mui ) {
|
|
|
|
vUVChannelIndices[mui] = UINT_MAX;
|
|
|
|
}
|
|
|
|
for (unsigned int mui = 0; mui < AI_MAX_NUMBER_OF_COLOR_SETS;++mui ) {
|
|
|
|
vVColorIndices[mui] = UINT_MAX;
|
|
|
|
}
|
2008-09-08 16:48:21 +00:00
|
|
|
#endif
|
|
|
|
|
2009-04-20 16:49:46 +00:00
|
|
|
FindUVChannels(_mSurfaces[i],sorted,layer,vUVChannelIndices);
|
|
|
|
FindVCChannels(_mSurfaces[i],sorted,layer,vVColorIndices);
|
2008-09-08 16:48:21 +00:00
|
|
|
|
|
|
|
// allocate storage for UV and CV channels
|
|
|
|
aiVector3D* pvUV[AI_MAX_NUMBER_OF_TEXTURECOORDS];
|
2009-03-26 22:05:56 +00:00
|
|
|
for (unsigned int mui = 0; mui < AI_MAX_NUMBER_OF_TEXTURECOORDS;++mui ) {
|
2011-04-22 21:29:18 +00:00
|
|
|
if (UINT_MAX == vUVChannelIndices[mui]) {
|
2009-03-26 22:05:56 +00:00
|
|
|
break;
|
2011-04-22 21:29:18 +00:00
|
|
|
}
|
2009-03-26 22:05:56 +00:00
|
|
|
|
2008-09-08 16:48:21 +00:00
|
|
|
pvUV[mui] = mesh->mTextureCoords[mui] = new aiVector3D[mesh->mNumVertices];
|
|
|
|
|
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
|
|
|
// LightWave doesn't support more than 2 UV components (?)
|
2008-09-08 16:48:21 +00:00
|
|
|
mesh->mNumUVComponents[0] = 2;
|
|
|
|
}
|
2008-11-16 21:56:45 +00:00
|
|
|
|
|
|
|
if (layer.mNormals.name.length())
|
|
|
|
nrm = mesh->mNormals = new aiVector3D[mesh->mNumVertices];
|
2008-09-08 16:48:21 +00:00
|
|
|
|
|
|
|
aiColor4D* pvVC[AI_MAX_NUMBER_OF_COLOR_SETS];
|
2009-03-26 22:05:56 +00:00
|
|
|
for (unsigned int mui = 0; mui < AI_MAX_NUMBER_OF_COLOR_SETS;++mui) {
|
2011-04-22 21:29:18 +00:00
|
|
|
if (UINT_MAX == vVColorIndices[mui]) {
|
2011-02-03 13:22:38 +00:00
|
|
|
break;
|
|
|
|
}
|
2008-09-08 16:48:21 +00:00
|
|
|
pvVC[mui] = mesh->mColors[mui] = new aiColor4D[mesh->mNumVertices];
|
|
|
|
}
|
|
|
|
|
2008-09-20 15:55:51 +00:00
|
|
|
// we would not need this extra array, but the code is much cleaner if we use it
|
|
|
|
std::vector<unsigned int>& smoothingGroups = layer.mPointReferrers;
|
|
|
|
smoothingGroups.erase (smoothingGroups.begin(),smoothingGroups.end());
|
|
|
|
smoothingGroups.resize(mesh->mNumFaces,0);
|
|
|
|
|
2008-08-15 23:23:28 +00:00
|
|
|
// now convert all faces
|
|
|
|
unsigned int vert = 0;
|
2008-09-20 15:55:51 +00:00
|
|
|
std::vector<unsigned int>::iterator outIt = smoothingGroups.begin();
|
2009-03-15 00:40:30 +00:00
|
|
|
for (it = sorted.begin(); it != end;++it,++outIt) {
|
2008-08-15 23:23:28 +00:00
|
|
|
const LWO::Face& face = layer.mFaces[*it];
|
2008-09-20 15:55:51 +00:00
|
|
|
*outIt = face.smoothGroup;
|
2008-08-15 23:23:28 +00:00
|
|
|
|
|
|
|
// copy all vertices
|
2009-03-15 00:40:30 +00:00
|
|
|
for (unsigned int q = 0; q < face.mNumIndices;++q,++vert) {
|
2008-09-08 16:48:21 +00:00
|
|
|
register unsigned int idx = face.mIndices[q];
|
2009-03-26 22:05:56 +00:00
|
|
|
*pv++ = layer.mTempPoints[idx] /*- layer.mPivot*/;
|
2008-09-08 16:48:21 +00:00
|
|
|
|
|
|
|
// process UV coordinates
|
2009-03-15 00:40:30 +00:00
|
|
|
for (unsigned int w = 0; w < AI_MAX_NUMBER_OF_TEXTURECOORDS;++w) {
|
2011-04-22 21:29:18 +00:00
|
|
|
if (UINT_MAX == vUVChannelIndices[w]) {
|
2009-03-15 00:40:30 +00:00
|
|
|
break;
|
2011-04-22 21:29:18 +00:00
|
|
|
}
|
2008-09-20 15:55:51 +00:00
|
|
|
aiVector3D*& pp = pvUV[w];
|
|
|
|
const aiVector2D& src = ((aiVector2D*)&layer.mUVChannels[vUVChannelIndices[w]].rawData[0])[idx];
|
|
|
|
pp->x = src.x;
|
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
|
|
|
pp->y = src.y;
|
2008-09-20 15:55:51 +00:00
|
|
|
pp++;
|
2008-09-08 16:48:21 +00:00
|
|
|
}
|
|
|
|
|
2008-11-16 21:56:45 +00:00
|
|
|
// process normals (MODO extension)
|
2009-02-15 20:29:07 +00:00
|
|
|
if (nrm) {
|
2009-03-26 22:05:56 +00:00
|
|
|
*nrm = ((aiVector3D*)&layer.mNormals.rawData[0])[idx];
|
|
|
|
nrm->z *= -1.f;
|
|
|
|
++nrm;
|
2008-11-16 21:56:45 +00:00
|
|
|
}
|
|
|
|
|
2008-09-08 16:48:21 +00:00
|
|
|
// process vertex colors
|
2009-03-15 00:40:30 +00:00
|
|
|
for (unsigned int w = 0; w < AI_MAX_NUMBER_OF_COLOR_SETS;++w) {
|
2011-04-22 21:29:18 +00:00
|
|
|
if (UINT_MAX == vVColorIndices[w]) {
|
2009-03-15 00:40:30 +00:00
|
|
|
break;
|
2011-04-22 21:29:18 +00:00
|
|
|
}
|
2008-11-16 21:56:45 +00:00
|
|
|
*pvVC[w] = ((aiColor4D*)&layer.mVColorChannels[vVColorIndices[w]].rawData[0])[idx];
|
|
|
|
|
|
|
|
// If a RGB color map is explicitly requested delete the
|
|
|
|
// alpha channel - it could theoretically be != 1.
|
|
|
|
if(_mSurfaces[i].mVCMapType == AI_LWO_RGB)
|
|
|
|
pvVC[w]->a = 1.f;
|
|
|
|
|
|
|
|
pvVC[w]++;
|
2008-09-08 16:48:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#if 0
|
2009-05-05 14:32:01 +00:00
|
|
|
// process vertex weights. We can't properly reconstruct the whole skeleton for now,
|
|
|
|
// but we can create dummy bones for all weight channels which we have.
|
2008-09-08 16:48:21 +00:00
|
|
|
for (unsigned int w = 0; w < layer.mWeightChannels.size();++w)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
#endif
|
2009-05-05 14:32:01 +00:00
|
|
|
|
2009-03-15 00:40:30 +00:00
|
|
|
face.mIndices[q] = vert;
|
2008-08-15 23:23:28 +00:00
|
|
|
}
|
|
|
|
pf->mIndices = face.mIndices;
|
|
|
|
pf->mNumIndices = face.mNumIndices;
|
2009-03-26 22:05:56 +00:00
|
|
|
unsigned int** p = (unsigned int**)&face.mIndices;*p = NULL; // HACK: make sure it won't be deleted
|
2008-08-15 23:23:28 +00:00
|
|
|
pf++;
|
|
|
|
}
|
2008-09-20 15:55:51 +00:00
|
|
|
|
2009-03-26 22:05:56 +00:00
|
|
|
if (!mesh->mNormals) {
|
2008-11-16 21:56:45 +00:00
|
|
|
// Compute normal vectors for the mesh - we can't use our GenSmoothNormal-
|
|
|
|
// Step here since it wouldn't handle smoothing groups correctly for LWO.
|
2009-03-26 22:05:56 +00:00
|
|
|
// So we use a separate implementation.
|
2008-11-16 21:56:45 +00:00
|
|
|
ComputeNormals(mesh,smoothingGroups,_mSurfaces[i]);
|
|
|
|
}
|
|
|
|
else DefaultLogger::get()->debug("LWO2: No need to compute normals, they're already there");
|
2008-08-15 23:23:28 +00:00
|
|
|
++p;
|
|
|
|
}
|
2008-08-10 23:58:21 +00:00
|
|
|
}
|
2008-08-07 22:27:17 +00:00
|
|
|
|
2009-03-26 22:05:56 +00:00
|
|
|
// Generate nodes to render the mesh. Store the source layer in the mParent member of the nodes
|
|
|
|
unsigned int num = apcMeshes.size() - meshStart;
|
|
|
|
if (layer.mName != "<LWODefault>" || num > 0) {
|
|
|
|
aiNode* pcNode = new aiNode();
|
2011-12-07 06:22:02 +00:00
|
|
|
apcNodes[layer.mIndex] = pcNode;
|
2009-03-26 22:05:56 +00:00
|
|
|
pcNode->mName.Set(layer.mName);
|
|
|
|
pcNode->mParent = (aiNode*)&layer;
|
|
|
|
pcNode->mNumMeshes = num;
|
|
|
|
|
|
|
|
if (pcNode->mNumMeshes) {
|
|
|
|
pcNode->mMeshes = new unsigned int[pcNode->mNumMeshes];
|
|
|
|
for (unsigned int p = 0; p < pcNode->mNumMeshes;++p)
|
|
|
|
pcNode->mMeshes[p] = p + meshStart;
|
|
|
|
}
|
|
|
|
}
|
2008-08-15 23:23:28 +00:00
|
|
|
}
|
2008-09-13 09:01:24 +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
|
|
|
if (apcNodes.empty() || apcMeshes.empty())
|
2010-03-18 17:00:12 +00:00
|
|
|
throw DeadlyImportError("LWO: No meshes loaded");
|
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-11-16 21:56:45 +00:00
|
|
|
// The RemoveRedundantMaterials step will clean this up later
|
2008-09-13 09:01:24 +00:00
|
|
|
pScene->mMaterials = new aiMaterial*[pScene->mNumMaterials = (unsigned int)mSurfaces->size()];
|
2009-03-26 22:05:56 +00:00
|
|
|
for (unsigned int mat = 0; mat < pScene->mNumMaterials;++mat) {
|
2011-08-22 20:22:51 +00:00
|
|
|
aiMaterial* pcMat = new aiMaterial();
|
2008-09-13 09:01:24 +00:00
|
|
|
pScene->mMaterials[mat] = pcMat;
|
|
|
|
ConvertMaterial((*mSurfaces)[mat],pcMat);
|
|
|
|
}
|
|
|
|
|
2008-08-15 23:23:28 +00:00
|
|
|
// copy the meshes to the output structure
|
2009-03-26 22:05:56 +00:00
|
|
|
pScene->mMeshes = new aiMesh*[ pScene->mNumMeshes = (unsigned int)apcMeshes.size() ];
|
|
|
|
::memcpy(pScene->mMeshes,&apcMeshes[0],pScene->mNumMeshes*sizeof(void*));
|
|
|
|
|
2008-09-13 11:11:51 +00:00
|
|
|
// generate the final node graph
|
|
|
|
GenerateNodeGraph(apcNodes);
|
2008-08-15 23:23:28 +00:00
|
|
|
}
|
2008-08-07 22:27:17 +00:00
|
|
|
|
2008-08-15 23:23:28 +00:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2008-09-20 15:55:51 +00:00
|
|
|
void LWOImporter::ComputeNormals(aiMesh* mesh, const std::vector<unsigned int>& smoothingGroups,
|
|
|
|
const LWO::Surface& surface)
|
2008-08-15 23:23:28 +00:00
|
|
|
{
|
2009-02-15 20:29:07 +00:00
|
|
|
// Allocate output storage
|
2008-09-20 15:55:51 +00:00
|
|
|
mesh->mNormals = new aiVector3D[mesh->mNumVertices];
|
|
|
|
|
|
|
|
// First generate per-face normals
|
|
|
|
aiVector3D* out;
|
|
|
|
std::vector<aiVector3D> faceNormals;
|
|
|
|
|
2009-02-15 20:29:07 +00:00
|
|
|
// ... in some cases that's already enough
|
2008-09-20 15:55:51 +00:00
|
|
|
if (!surface.mMaximumSmoothAngle)
|
|
|
|
out = mesh->mNormals;
|
2009-02-15 20:29:07 +00:00
|
|
|
else {
|
2008-09-20 15:55:51 +00:00
|
|
|
faceNormals.resize(mesh->mNumVertices);
|
|
|
|
out = &faceNormals[0];
|
|
|
|
}
|
|
|
|
|
|
|
|
aiFace* begin = mesh->mFaces, *const end = mesh->mFaces+mesh->mNumFaces;
|
2009-02-15 20:29:07 +00:00
|
|
|
for (; begin != end; ++begin) {
|
2008-09-20 15:55:51 +00:00
|
|
|
aiFace& face = *begin;
|
|
|
|
|
|
|
|
// LWO doc: "the normal is defined as the cross product of the first and last edges"
|
|
|
|
aiVector3D* pV1 = mesh->mVertices + face.mIndices[0];
|
|
|
|
aiVector3D* pV2 = mesh->mVertices + face.mIndices[1];
|
|
|
|
aiVector3D* pV3 = mesh->mVertices + face.mIndices[face.mNumIndices-1];
|
|
|
|
|
2009-04-02 15:16:01 +00:00
|
|
|
aiVector3D vNor = ((*pV2 - *pV1) ^(*pV3 - *pV1)).Normalize();
|
2008-09-20 15:55:51 +00:00
|
|
|
for (unsigned int i = 0; i < face.mNumIndices;++i)
|
|
|
|
out[face.mIndices[i]] = vNor;
|
|
|
|
}
|
|
|
|
if (!surface.mMaximumSmoothAngle)return;
|
2008-09-27 16:46:05 +00:00
|
|
|
const float posEpsilon = ComputePositionEpsilon(mesh);
|
2008-09-13 11:11:51 +00:00
|
|
|
|
2009-02-15 20:29:07 +00:00
|
|
|
// Now generate the spatial sort tree
|
2008-09-20 15:55:51 +00:00
|
|
|
SGSpatialSort sSort;
|
|
|
|
std::vector<unsigned int>::const_iterator it = smoothingGroups.begin();
|
|
|
|
for( begin = mesh->mFaces; begin != end; ++begin, ++it)
|
|
|
|
{
|
|
|
|
aiFace& face = *begin;
|
|
|
|
for (unsigned int i = 0; i < face.mNumIndices;++i)
|
|
|
|
{
|
|
|
|
register unsigned int tt = face.mIndices[i];
|
|
|
|
sSort.Add(mesh->mVertices[tt],tt,*it);
|
|
|
|
}
|
|
|
|
}
|
2009-02-15 20:29:07 +00:00
|
|
|
// Sort everything - this takes O(nlogn) time
|
2008-09-20 15:55:51 +00:00
|
|
|
sSort.Prepare();
|
2008-09-27 16:46:05 +00:00
|
|
|
std::vector<unsigned int> poResult;
|
|
|
|
poResult.reserve(20);
|
2008-09-20 15:55:51 +00:00
|
|
|
|
2009-02-15 20:29:07 +00:00
|
|
|
// Generate vertex normals. We have O(logn) for the binary lookup, which we need
|
2008-09-20 15:55:51 +00:00
|
|
|
// for n elements, thus the EXPECTED complexity is O(nlogn)
|
2009-02-15 20:29:07 +00:00
|
|
|
if (surface.mMaximumSmoothAngle < 3.f && !configSpeedFlag) {
|
2008-09-30 20:20:56 +00:00
|
|
|
const float fLimit = cos(surface.mMaximumSmoothAngle);
|
2008-09-20 15:55:51 +00:00
|
|
|
|
2009-02-15 20:29:07 +00:00
|
|
|
for( begin = mesh->mFaces, it = smoothingGroups.begin(); begin != end; ++begin, ++it) {
|
|
|
|
const aiFace& face = *begin;
|
2008-09-30 20:20:56 +00:00
|
|
|
unsigned int* beginIdx = face.mIndices, *const endIdx = face.mIndices+face.mNumIndices;
|
|
|
|
for (; beginIdx != endIdx; ++beginIdx)
|
|
|
|
{
|
|
|
|
register unsigned int idx = *beginIdx;
|
2009-02-15 20:29:07 +00:00
|
|
|
sSort.FindPositions(mesh->mVertices[idx],*it,posEpsilon,poResult,true);
|
2008-09-30 20:20:56 +00:00
|
|
|
std::vector<unsigned int>::const_iterator a, end = poResult.end();
|
2008-09-20 15:55:51 +00:00
|
|
|
|
2008-09-30 20:20:56 +00:00
|
|
|
aiVector3D vNormals;
|
2009-02-15 20:29:07 +00:00
|
|
|
for (a = poResult.begin();a != end;++a) {
|
2008-09-30 20:20:56 +00:00
|
|
|
const aiVector3D& v = faceNormals[*a];
|
2009-02-15 20:29:07 +00:00
|
|
|
if (v * faceNormals[idx] < fLimit)
|
|
|
|
continue;
|
2008-09-30 20:20:56 +00:00
|
|
|
vNormals += v;
|
|
|
|
}
|
2009-02-15 20:29:07 +00:00
|
|
|
mesh->mNormals[idx] = vNormals.Normalize();
|
2008-09-20 15:55:51 +00:00
|
|
|
}
|
2008-09-30 20:20:56 +00:00
|
|
|
}
|
|
|
|
}
|
2009-02-15 20:29:07 +00:00
|
|
|
// faster code path in case there is no smooth angle
|
|
|
|
else {
|
2008-09-30 20:20:56 +00:00
|
|
|
std::vector<bool> vertexDone(mesh->mNumVertices,false);
|
2009-02-15 20:29:07 +00:00
|
|
|
for( begin = mesh->mFaces, it = smoothingGroups.begin(); begin != end; ++begin, ++it) {
|
|
|
|
const aiFace& face = *begin;
|
2008-09-30 20:20:56 +00:00
|
|
|
unsigned int* beginIdx = face.mIndices, *const endIdx = face.mIndices+face.mNumIndices;
|
|
|
|
for (; beginIdx != endIdx; ++beginIdx)
|
2008-09-27 16:46:05 +00:00
|
|
|
{
|
2008-09-30 20:20:56 +00:00
|
|
|
register unsigned int idx = *beginIdx;
|
2009-02-15 20:29:07 +00:00
|
|
|
if (vertexDone[idx])
|
|
|
|
continue;
|
|
|
|
sSort.FindPositions(mesh->mVertices[idx],*it,posEpsilon,poResult,true);
|
2008-09-30 20:20:56 +00:00
|
|
|
std::vector<unsigned int>::const_iterator a, end = poResult.end();
|
|
|
|
|
|
|
|
aiVector3D vNormals;
|
2009-02-15 20:29:07 +00:00
|
|
|
for (a = poResult.begin();a != end;++a) {
|
2008-09-30 20:20:56 +00:00
|
|
|
const aiVector3D& v = faceNormals[*a];
|
|
|
|
vNormals += v;
|
|
|
|
}
|
|
|
|
vNormals.Normalize();
|
2009-02-15 20:29:07 +00:00
|
|
|
for (a = poResult.begin();a != end;++a) {
|
2008-09-30 20:20:56 +00:00
|
|
|
mesh->mNormals[*a] = vNormals;
|
|
|
|
vertexDone[*a] = true;
|
|
|
|
}
|
2008-09-27 16:46:05 +00:00
|
|
|
}
|
2008-09-20 15:55:51 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-12-07 06:22:02 +00:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
void LWOImporter::GenerateNodeGraph(std::map<uint16_t,aiNode*>& apcNodes)
|
|
|
|
{
|
|
|
|
// now generate the final nodegraph - generate a root node and attach children
|
|
|
|
aiNode* root = pScene->mRootNode = new aiNode();
|
|
|
|
root->mName.Set("<LWORoot>");
|
|
|
|
|
|
|
|
//Set parent of all children, inserting pivots
|
|
|
|
std::cout << "Set parent of all children" << std::endl;
|
|
|
|
std::map<uint16_t, aiNode*> mapPivot;
|
|
|
|
for (std::map<uint16_t,aiNode*>::iterator itapcNodes = apcNodes.begin(); itapcNodes != apcNodes.end(); ++itapcNodes) {
|
|
|
|
|
|
|
|
//Get the parent index
|
|
|
|
LWO::Layer* nodeLayer = (LWO::Layer*)(itapcNodes->second->mParent);
|
|
|
|
uint16_t parentIndex = nodeLayer->mParent;
|
|
|
|
|
|
|
|
//Create pivot node, store it into the pivot map, and set the parent as the pivot
|
|
|
|
aiNode* pivotNode = new aiNode();
|
|
|
|
pivotNode->mName.Set("Pivot-"+std::string(itapcNodes->second->mName.data));
|
|
|
|
mapPivot[-(itapcNodes->first+2)] = pivotNode;
|
|
|
|
itapcNodes->second->mParent = pivotNode;
|
|
|
|
|
|
|
|
//Look for the parent node to attach the pivot to
|
|
|
|
if (apcNodes.find(parentIndex) != apcNodes.end()) {
|
|
|
|
pivotNode->mParent = apcNodes[parentIndex];
|
|
|
|
} else {
|
|
|
|
//If not, attach to the root node
|
|
|
|
pivotNode->mParent = root;
|
|
|
|
}
|
|
|
|
|
|
|
|
//Set the node and the pivot node transformation
|
|
|
|
itapcNodes->second->mTransformation.a4 = -nodeLayer->mPivot.x;
|
|
|
|
itapcNodes->second->mTransformation.b4 = -nodeLayer->mPivot.y;
|
|
|
|
itapcNodes->second->mTransformation.c4 = -nodeLayer->mPivot.z;
|
|
|
|
pivotNode->mTransformation.a4 = nodeLayer->mPivot.x;
|
|
|
|
pivotNode->mTransformation.b4 = nodeLayer->mPivot.y;
|
|
|
|
pivotNode->mTransformation.c4 = nodeLayer->mPivot.z;
|
|
|
|
}
|
|
|
|
|
|
|
|
//Merge pivot map into node map
|
|
|
|
std::cout << "Merge pivot map into node map" << std::endl;
|
|
|
|
for (std::map<uint16_t, aiNode*>::iterator itMapPivot = mapPivot.begin(); itMapPivot != mapPivot.end(); ++itMapPivot) {
|
|
|
|
apcNodes[itMapPivot->first] = itMapPivot->second;
|
|
|
|
}
|
|
|
|
|
|
|
|
//Set children of all parents
|
|
|
|
apcNodes[-1] = root;
|
|
|
|
for (std::map<uint16_t,aiNode*>::iterator itMapParentNodes = apcNodes.begin(); itMapParentNodes != apcNodes.end(); ++itMapParentNodes) {
|
|
|
|
for (std::map<uint16_t,aiNode*>::iterator itMapChildNodes = apcNodes.begin(); itMapChildNodes != apcNodes.end(); ++itMapChildNodes) {
|
|
|
|
if ((itMapParentNodes->first != itMapChildNodes->first) && (itMapParentNodes->second == itMapChildNodes->second->mParent)) {
|
|
|
|
++(itMapParentNodes->second->mNumChildren);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (itMapParentNodes->second->mNumChildren) {
|
|
|
|
itMapParentNodes->second->mChildren = new aiNode* [ itMapParentNodes->second->mNumChildren ];
|
|
|
|
uint16_t p = 0;
|
|
|
|
for (std::map<uint16_t,aiNode*>::iterator itMapChildNodes = apcNodes.begin(); itMapChildNodes != apcNodes.end(); ++itMapChildNodes) {
|
|
|
|
if ((itMapParentNodes->first != itMapChildNodes->first) && (itMapParentNodes->second == itMapChildNodes->second->mParent)) {
|
|
|
|
itMapParentNodes->second->mChildren[p++] = itMapChildNodes->second;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!pScene->mRootNode->mNumChildren)
|
|
|
|
throw DeadlyImportError("LWO: Unable to build a valid node graph");
|
|
|
|
|
|
|
|
// Remove a single root node with no meshes assigned to it ...
|
|
|
|
if (1 == pScene->mRootNode->mNumChildren) {
|
|
|
|
aiNode* pc = pScene->mRootNode->mChildren[0];
|
|
|
|
pc->mParent = pScene->mRootNode->mChildren[0] = NULL;
|
|
|
|
delete pScene->mRootNode;
|
|
|
|
pScene->mRootNode = pc;
|
|
|
|
}
|
|
|
|
|
|
|
|
// convert the whole stuff to RH with CCW winding
|
|
|
|
MakeLeftHandedProcess maker;
|
|
|
|
maker.Execute(pScene);
|
|
|
|
|
|
|
|
FlipWindingOrderProcess flipper;
|
|
|
|
flipper.Execute(pScene);
|
|
|
|
}
|
|
|
|
|
2008-08-10 23:58:21 +00:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
void LWOImporter::ResolveTags()
|
|
|
|
{
|
2008-09-08 16:48:21 +00:00
|
|
|
// --- this function is used for both LWO2 and LWOB
|
2011-04-22 21:29:18 +00:00
|
|
|
mMapping->resize(mTags->size(), UINT_MAX);
|
2009-05-05 14:32:01 +00:00
|
|
|
for (unsigned int a = 0; a < mTags->size();++a) {
|
|
|
|
|
2009-02-15 20:29:07 +00:00
|
|
|
const std::string& c = (*mTags)[a];
|
2009-05-05 14:32:01 +00:00
|
|
|
for (unsigned int i = 0; i < mSurfaces->size();++i) {
|
|
|
|
|
2008-08-13 15:45:57 +00:00
|
|
|
const std::string& d = (*mSurfaces)[i].mName;
|
2009-05-05 14:32:01 +00:00
|
|
|
if (!ASSIMP_stricmp(c,d)) {
|
|
|
|
|
2008-08-10 23:58:21 +00:00
|
|
|
(*mMapping)[a] = i;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2008-08-12 01:50:16 +00:00
|
|
|
|
2008-08-10 23:58:21 +00:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2008-09-20 15:55:51 +00:00
|
|
|
void LWOImporter::ResolveClips()
|
2008-08-10 23:58:21 +00:00
|
|
|
{
|
2009-05-05 14:32:01 +00:00
|
|
|
for( unsigned int i = 0; i < mClips.size();++i) {
|
|
|
|
|
2008-09-20 15:55:51 +00:00
|
|
|
Clip& clip = mClips[i];
|
2009-05-05 14:32:01 +00:00
|
|
|
if (Clip::REF == clip.type) {
|
|
|
|
|
|
|
|
if (clip.clipRef >= mClips.size()) {
|
2008-09-20 15:55:51 +00:00
|
|
|
DefaultLogger::get()->error("LWO2: Clip referrer index is out of range");
|
|
|
|
clip.clipRef = 0;
|
|
|
|
}
|
2009-05-05 14:32:01 +00:00
|
|
|
|
2008-09-20 15:55:51 +00:00
|
|
|
Clip& dest = mClips[clip.clipRef];
|
2009-05-05 14:32:01 +00:00
|
|
|
if (Clip::REF == dest.type) {
|
2008-09-20 15:55:51 +00:00
|
|
|
DefaultLogger::get()->error("LWO2: Clip references another clip reference");
|
|
|
|
clip.type = Clip::UNSUPPORTED;
|
|
|
|
}
|
2009-05-05 14:32:01 +00:00
|
|
|
|
|
|
|
else {
|
2008-09-20 15:55:51 +00:00
|
|
|
clip.path = dest.path;
|
|
|
|
clip.type = dest.type;
|
|
|
|
}
|
2008-08-10 23:58:21 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2008-08-12 01:50:16 +00:00
|
|
|
|
2008-08-10 23:58:21 +00:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
void LWOImporter::AdjustTexturePath(std::string& out)
|
|
|
|
{
|
2008-09-08 16:48:21 +00:00
|
|
|
// --- this function is used for both LWO2 and LWOB
|
2009-05-05 14:32:01 +00:00
|
|
|
if (!mIsLWO2 && ::strstr(out.c_str(), "(sequence)")) {
|
|
|
|
|
2008-08-10 23:58:21 +00:00
|
|
|
// remove the (sequence) and append 000
|
2008-09-20 15:55:51 +00:00
|
|
|
DefaultLogger::get()->info("LWOB: Sequence of animated texture found. It will be ignored");
|
2008-08-10 23:58:21 +00:00
|
|
|
out = out.substr(0,out.length()-10) + "000";
|
|
|
|
}
|
|
|
|
|
2009-05-05 14:32:01 +00:00
|
|
|
// format: drive:path/file - we just need to insert a slash after the drive
|
2008-09-20 15:55:51 +00:00
|
|
|
std::string::size_type n = out.find_first_of(':');
|
2009-05-05 14:32:01 +00:00
|
|
|
if (std::string::npos != n) {
|
2008-09-20 15:55:51 +00:00
|
|
|
out.insert(n+1,"/");
|
2008-09-08 16:48:21 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-08-10 23:58:21 +00:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
void LWOImporter::LoadLWOTags(unsigned int size)
|
|
|
|
{
|
2008-09-08 16:48:21 +00:00
|
|
|
// --- this function is used for both LWO2 and LWOB
|
|
|
|
|
2008-08-10 23:58:21 +00:00
|
|
|
const char* szCur = (const char*)mFileBuffer, *szLast = szCur;
|
|
|
|
const char* const szEnd = szLast+size;
|
|
|
|
while (szCur < szEnd)
|
|
|
|
{
|
2008-08-13 15:45:57 +00:00
|
|
|
if (!(*szCur))
|
2008-08-10 23:58:21 +00:00
|
|
|
{
|
2009-02-15 20:29:07 +00:00
|
|
|
const size_t len = (size_t)(szCur-szLast);
|
|
|
|
// FIX: skip empty-sized tags
|
|
|
|
if (len)
|
|
|
|
mTags->push_back(std::string(szLast,len));
|
|
|
|
szCur += (len&0x1 ? 1 : 2);
|
2008-08-10 23:58:21 +00:00
|
|
|
szLast = szCur;
|
|
|
|
}
|
2008-08-13 15:45:57 +00:00
|
|
|
szCur++;
|
2008-08-07 22:27:17 +00:00
|
|
|
}
|
|
|
|
}
|
2008-08-12 01:50:16 +00:00
|
|
|
|
2008-08-15 23:23:28 +00:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
void LWOImporter::LoadLWOPoints(unsigned int length)
|
|
|
|
{
|
2008-09-20 15:55:51 +00:00
|
|
|
// --- this function is used for both LWO2 and LWOB but for
|
|
|
|
// LWO2 we need to allocate 25% more storage - it could be we'll
|
|
|
|
// need to duplicate some points later.
|
|
|
|
register unsigned int regularSize = (unsigned int)mCurLayer->mTempPoints.size() + length / 12;
|
|
|
|
if (mIsLWO2)
|
|
|
|
{
|
|
|
|
mCurLayer->mTempPoints.reserve ( regularSize + (regularSize>>2u) );
|
|
|
|
mCurLayer->mTempPoints.resize ( regularSize );
|
|
|
|
|
|
|
|
// initialize all point referrers with the default values
|
|
|
|
mCurLayer->mPointReferrers.reserve ( regularSize + (regularSize>>2u) );
|
2011-04-22 21:29:18 +00:00
|
|
|
mCurLayer->mPointReferrers.resize ( regularSize, UINT_MAX );
|
2008-09-20 15:55:51 +00:00
|
|
|
}
|
|
|
|
else mCurLayer->mTempPoints.resize( regularSize );
|
2008-08-15 23:23:28 +00:00
|
|
|
|
|
|
|
// perform endianess conversions
|
|
|
|
#ifndef AI_BUILD_BIG_ENDIAN
|
|
|
|
for (unsigned int i = 0; i < length>>2;++i)
|
|
|
|
ByteSwap::Swap4( mFileBuffer + (i << 2));
|
|
|
|
#endif
|
|
|
|
::memcpy(&mCurLayer->mTempPoints[0],mFileBuffer,length);
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2008-09-13 11:11:51 +00:00
|
|
|
void LWOImporter::LoadLWO2Polygons(unsigned int length)
|
2008-08-15 23:23:28 +00:00
|
|
|
{
|
2008-09-20 15:55:51 +00:00
|
|
|
LE_NCONST uint16_t* const end = (LE_NCONST uint16_t*)(mFileBuffer+length);
|
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
|
|
|
const uint32_t type = GetU4();
|
2008-09-13 09:01:24 +00:00
|
|
|
|
2008-11-16 21:56:45 +00:00
|
|
|
// Determine the type of the polygons
|
|
|
|
switch (type)
|
2008-09-13 11:11:51 +00:00
|
|
|
{
|
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
|
|
|
// read unsupported stuff too (although we wont process it)
|
|
|
|
case AI_LWO_MBAL:
|
|
|
|
DefaultLogger::get()->warn("LWO2: Encountered unsupported primitive chunk (METABALL)");
|
|
|
|
break;
|
|
|
|
case AI_LWO_CURV:
|
|
|
|
DefaultLogger::get()->warn("LWO2: Encountered unsupported primitive chunk (SPLINE)");;
|
|
|
|
break;
|
|
|
|
|
|
|
|
// These are ok with no restrictions
|
2008-11-16 21:56:45 +00:00
|
|
|
case AI_LWO_PTCH:
|
|
|
|
case AI_LWO_FACE:
|
2010-03-18 17:20:49 +00:00
|
|
|
case AI_LWO_BONE:
|
|
|
|
case AI_LWO_SUBD:
|
2008-11-16 21:56:45 +00:00
|
|
|
break;
|
|
|
|
default:
|
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
|
|
|
|
|
|
|
// hm!? wtf is this? ok ...
|
2009-05-05 14:32:01 +00:00
|
|
|
DefaultLogger::get()->error("LWO2: Ignoring unknown polygon type.");
|
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
|
|
|
break;
|
2008-09-08 16:48:21 +00:00
|
|
|
}
|
|
|
|
|
2008-08-15 23:23:28 +00:00
|
|
|
// first find out how many faces and vertices we'll finally need
|
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
|
|
|
uint16_t* cursor= (uint16_t*)mFileBuffer;
|
2008-08-15 23:23:28 +00:00
|
|
|
|
|
|
|
unsigned int iNumFaces = 0,iNumVertices = 0;
|
2008-09-13 11:11:51 +00:00
|
|
|
CountVertsAndFacesLWO2(iNumVertices,iNumFaces,cursor,end);
|
2008-08-15 23:23:28 +00:00
|
|
|
|
|
|
|
// allocate the output array and copy face indices
|
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
|
|
|
if (iNumFaces) {
|
2008-10-28 23:18:06 +00:00
|
|
|
cursor = (uint16_t*)mFileBuffer;
|
2008-09-08 16:48:21 +00:00
|
|
|
|
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
|
|
|
mCurLayer->mFaces.resize(iNumFaces,LWO::Face(type));
|
2008-08-15 23:23:28 +00:00
|
|
|
FaceList::iterator it = mCurLayer->mFaces.begin();
|
2008-09-13 11:11:51 +00:00
|
|
|
CopyFaceIndicesLWO2(it,cursor,end);
|
2008-08-15 23:23:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-08-07 22:27:17 +00:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2008-09-08 16:48:21 +00:00
|
|
|
void LWOImporter::CountVertsAndFacesLWO2(unsigned int& verts, unsigned int& faces,
|
2008-10-28 23:18:06 +00:00
|
|
|
uint16_t*& cursor, const uint16_t* const end, unsigned int max)
|
2008-08-07 22:27:17 +00:00
|
|
|
{
|
2008-09-08 16:48:21 +00:00
|
|
|
while (cursor < end && max--)
|
2008-08-07 22:27:17 +00:00
|
|
|
{
|
2008-09-13 11:11:51 +00:00
|
|
|
AI_LSWAP2P(cursor);
|
2008-09-08 16:48:21 +00:00
|
|
|
uint16_t numIndices = *cursor++;
|
|
|
|
numIndices &= 0x03FF;
|
|
|
|
verts += numIndices;++faces;
|
|
|
|
|
|
|
|
for(uint16_t i = 0; i < numIndices; i++)
|
|
|
|
ReadVSizedIntLWO2((uint8_t*&)cursor);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
void LWOImporter::CopyFaceIndicesLWO2(FaceList::iterator& it,
|
2008-10-28 23:18:06 +00:00
|
|
|
uint16_t*& cursor,
|
2008-09-13 11:11:51 +00:00
|
|
|
const uint16_t* const end)
|
2008-09-08 16:48:21 +00:00
|
|
|
{
|
2009-05-05 14:32:01 +00:00
|
|
|
while (cursor < end) {
|
|
|
|
|
|
|
|
LWO::Face& face = *it++;;
|
|
|
|
if((face.mNumIndices = (*cursor++) & 0x03FF)) /* byte swapping has already been done */ {
|
2008-09-08 16:48:21 +00:00
|
|
|
face.mIndices = new unsigned int[face.mNumIndices];
|
|
|
|
for(unsigned int i = 0; i < face.mNumIndices; i++)
|
2008-08-15 23:23:28 +00:00
|
|
|
{
|
2008-09-08 16:48:21 +00:00
|
|
|
face.mIndices[i] = ReadVSizedIntLWO2((uint8_t*&)cursor) + mCurLayer->mPointIDXOfs;
|
|
|
|
if(face.mIndices[i] > mCurLayer->mTempPoints.size())
|
|
|
|
{
|
2009-05-05 14:32:01 +00:00
|
|
|
DefaultLogger::get()->warn("LWO2: Failure evaluating face record, index is out of range");
|
2008-09-08 16:48:21 +00:00
|
|
|
face.mIndices[i] = (unsigned int)mCurLayer->mTempPoints.size()-1;
|
|
|
|
}
|
2008-08-15 23:23:28 +00:00
|
|
|
}
|
2008-09-08 16:48:21 +00:00
|
|
|
}
|
2010-03-18 17:00:12 +00:00
|
|
|
else throw DeadlyImportError("LWO2: Encountered invalid face record with zero indices");
|
2008-09-08 16:48:21 +00:00
|
|
|
}
|
|
|
|
}
|
2008-08-07 22:27:17 +00:00
|
|
|
|
2008-09-08 16:48:21 +00:00
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
void LWOImporter::LoadLWO2PolygonTags(unsigned int length)
|
|
|
|
{
|
2008-09-20 15:55:51 +00:00
|
|
|
LE_NCONST uint8_t* const end = mFileBuffer+length;
|
|
|
|
|
|
|
|
AI_LWO_VALIDATE_CHUNK_LENGTH(length,PTAG,4);
|
|
|
|
uint32_t type = GetU4();
|
2008-09-08 16:48:21 +00:00
|
|
|
|
|
|
|
if (type != AI_LWO_SURF && type != AI_LWO_SMGP)
|
|
|
|
return;
|
|
|
|
|
2009-05-05 14:32:01 +00:00
|
|
|
while (mFileBuffer < end) {
|
|
|
|
|
2008-09-08 16:48:21 +00:00
|
|
|
unsigned int i = ReadVSizedIntLWO2(mFileBuffer) + mCurLayer->mFaceIDXOfs;
|
2008-09-20 15:55:51 +00:00
|
|
|
unsigned int j = GetU2();
|
2008-09-08 16:48:21 +00:00
|
|
|
|
2009-05-05 14:32:01 +00:00
|
|
|
if (i >= mCurLayer->mFaces.size()) {
|
2008-09-20 15:55:51 +00:00
|
|
|
DefaultLogger::get()->warn("LWO2: face index in PTAG is out of range");
|
2008-09-08 16:48:21 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2009-05-05 14:32:01 +00:00
|
|
|
switch (type) {
|
|
|
|
|
2008-08-15 23:23:28 +00:00
|
|
|
case AI_LWO_SURF:
|
2008-09-08 16:48:21 +00:00
|
|
|
mCurLayer->mFaces[i].surfaceIndex = j;
|
|
|
|
break;
|
2009-05-05 14:32:01 +00:00
|
|
|
case AI_LWO_SMGP: /* is that really used? */
|
2008-09-08 16:48:21 +00:00
|
|
|
mCurLayer->mFaces[i].smoothGroup = j;
|
|
|
|
break;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-09-20 15:55:51 +00:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
template <class T>
|
|
|
|
VMapEntry* FindEntry(std::vector< T >& list,const std::string& name, bool perPoly)
|
|
|
|
{
|
2009-03-26 22:05:56 +00:00
|
|
|
for (typename std::vector< T >::iterator it = list.begin(), end = list.end();it != end; ++it) {
|
2009-05-05 14:32:01 +00:00
|
|
|
if ((*it).name == name) {
|
|
|
|
if (!perPoly) {
|
2008-09-20 15:55:51 +00:00
|
|
|
DefaultLogger::get()->warn("LWO2: Found two VMAP sections with equal names");
|
|
|
|
}
|
|
|
|
return &(*it);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
list.push_back( T() );
|
|
|
|
VMapEntry* p = &list.back();
|
|
|
|
p->name = name;
|
|
|
|
return p;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
template <class T>
|
2008-11-16 21:56:45 +00:00
|
|
|
inline void CreateNewEntry(T& chan, unsigned int srcIdx)
|
|
|
|
{
|
2009-05-05 14:32:01 +00:00
|
|
|
if (!chan.name.length())
|
|
|
|
return;
|
2008-11-16 21:56:45 +00:00
|
|
|
|
|
|
|
chan.abAssigned[srcIdx] = true;
|
|
|
|
chan.abAssigned.resize(chan.abAssigned.size()+1,false);
|
|
|
|
|
|
|
|
for (unsigned int a = 0; a < chan.dims;++a)
|
|
|
|
chan.rawData.push_back(chan.rawData[srcIdx*chan.dims+a]);
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
template <class T>
|
|
|
|
inline void CreateNewEntry(std::vector< T >& list, unsigned int srcIdx)
|
2008-09-20 15:55:51 +00:00
|
|
|
{
|
2009-03-26 22:05:56 +00:00
|
|
|
for (typename std::vector< T >::iterator it = list.begin(), end = list.end();it != end;++it) {
|
2008-11-16 21:56:45 +00:00
|
|
|
CreateNewEntry( *it, srcIdx );
|
2008-09-20 15:55:51 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2009-02-15 20:29:07 +00:00
|
|
|
inline void LWOImporter::DoRecursiveVMAPAssignment(VMapEntry* base, unsigned int numRead,
|
2008-09-20 15:55:51 +00:00
|
|
|
unsigned int idx, float* data)
|
|
|
|
{
|
|
|
|
ai_assert(NULL != data);
|
|
|
|
LWO::ReferrerList& refList = mCurLayer->mPointReferrers;
|
|
|
|
unsigned int i;
|
|
|
|
|
|
|
|
base->abAssigned[idx] = true;
|
2009-05-05 14:32:01 +00:00
|
|
|
for (i = 0; i < numRead;++i) {
|
2008-09-20 15:55:51 +00:00
|
|
|
base->rawData[idx*base->dims+i]= data[i];
|
2009-05-05 14:32:01 +00:00
|
|
|
}
|
2008-09-20 15:55:51 +00:00
|
|
|
|
2011-04-22 21:29:18 +00:00
|
|
|
if (UINT_MAX != (i = refList[idx])) {
|
2008-09-20 15:55:51 +00:00
|
|
|
DoRecursiveVMAPAssignment(base,numRead,i,data);
|
2009-05-05 14:32:01 +00:00
|
|
|
}
|
2008-09-20 15:55:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2009-02-15 20:29:07 +00:00
|
|
|
inline void AddToSingleLinkedList(ReferrerList& refList, unsigned int srcIdx, unsigned int destIdx)
|
2008-09-20 15:55:51 +00:00
|
|
|
{
|
2011-04-22 21:29:18 +00:00
|
|
|
if(UINT_MAX == refList[srcIdx]) {
|
2008-09-20 15:55:51 +00:00
|
|
|
refList[srcIdx] = destIdx;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
AddToSingleLinkedList(refList,refList[srcIdx],destIdx);
|
|
|
|
}
|
|
|
|
|
2008-09-08 16:48:21 +00:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
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
|
|
|
// Load LWO2 vertex map
|
2008-09-08 16:48:21 +00:00
|
|
|
void LWOImporter::LoadLWO2VertexMap(unsigned int length, bool perPoly)
|
|
|
|
{
|
2008-09-20 15:55:51 +00:00
|
|
|
LE_NCONST uint8_t* const end = mFileBuffer+length;
|
|
|
|
|
|
|
|
AI_LWO_VALIDATE_CHUNK_LENGTH(length,VMAP,6);
|
|
|
|
unsigned int type = GetU4();
|
|
|
|
unsigned int dims = GetU2();
|
2008-09-08 16:48:21 +00:00
|
|
|
|
|
|
|
VMapEntry* base;
|
|
|
|
|
2008-09-20 15:55:51 +00:00
|
|
|
// read the name of the vertex map
|
|
|
|
std::string name;
|
|
|
|
GetS0(name,length);
|
|
|
|
|
2008-09-08 16:48:21 +00:00
|
|
|
switch (type)
|
|
|
|
{
|
|
|
|
case AI_LWO_TXUV:
|
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
|
|
|
if (dims != 2) {
|
2009-05-05 14:32:01 +00:00
|
|
|
DefaultLogger::get()->warn("LWO2: Skipping UV channel \'"
|
|
|
|
+ name + "\' with !2 components");
|
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
|
|
|
return;
|
2008-08-15 23:23:28 +00:00
|
|
|
}
|
2008-09-20 15:55:51 +00:00
|
|
|
base = FindEntry(mCurLayer->mUVChannels,name,perPoly);
|
|
|
|
break;
|
2008-09-08 16:48:21 +00:00
|
|
|
case AI_LWO_WGHT:
|
2009-05-05 14:32:01 +00:00
|
|
|
case AI_LWO_MNVW:
|
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
|
|
|
if (dims != 1) {
|
2009-05-05 14:32:01 +00:00
|
|
|
DefaultLogger::get()->warn("LWO2: Skipping Weight Channel \'"
|
|
|
|
+ name + "\' with !1 components");
|
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
|
|
|
return;
|
2008-09-08 16:48:21 +00:00
|
|
|
}
|
2009-05-05 14:32:01 +00:00
|
|
|
base = FindEntry((type == AI_LWO_WGHT ? mCurLayer->mWeightChannels
|
|
|
|
: mCurLayer->mSWeightChannels),name,perPoly);
|
2008-09-20 15:55:51 +00:00
|
|
|
break;
|
2008-09-08 16:48:21 +00:00
|
|
|
case AI_LWO_RGB:
|
|
|
|
case AI_LWO_RGBA:
|
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
|
|
|
if (dims != 3 && dims != 4) {
|
2009-05-05 14:32:01 +00:00
|
|
|
DefaultLogger::get()->warn("LWO2: Skipping Color Map \'"
|
|
|
|
+ name + "\' with a dimension > 4 or < 3");
|
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
|
|
|
return;
|
2008-09-08 16:48:21 +00:00
|
|
|
}
|
2008-09-20 15:55:51 +00:00
|
|
|
base = FindEntry(mCurLayer->mVColorChannels,name,perPoly);
|
|
|
|
break;
|
2008-11-16 21:56:45 +00:00
|
|
|
|
|
|
|
case AI_LWO_MODO_NORM:
|
|
|
|
/* This is a non-standard extension chunk used by Luxology's MODO.
|
|
|
|
* It stores per-vertex normals. This VMAP exists just once, has
|
|
|
|
* 3 dimensions and is btw extremely beautiful.
|
|
|
|
*/
|
|
|
|
if (name != "vert_normals" || dims != 3 || mCurLayer->mNormals.name.length())
|
|
|
|
return;
|
|
|
|
|
2009-05-05 14:32:01 +00:00
|
|
|
DefaultLogger::get()->info("Processing non-standard extension: MODO VMAP.NORM.vert_normals");
|
2008-11-16 21:56:45 +00:00
|
|
|
|
|
|
|
mCurLayer->mNormals.name = name;
|
|
|
|
base = & mCurLayer->mNormals;
|
|
|
|
break;
|
|
|
|
|
2009-05-05 14:32:01 +00:00
|
|
|
case AI_LWO_PICK: /* these VMAPs are just silently dropped */
|
|
|
|
case AI_LWO_MORF:
|
|
|
|
case AI_LWO_SPOT:
|
|
|
|
return;
|
|
|
|
|
2008-11-16 21:56:45 +00:00
|
|
|
default:
|
2010-03-08 20:21:30 +00:00
|
|
|
if (name == "APS.Level") {
|
|
|
|
// XXX handle this (seems to be subdivision-related).
|
|
|
|
}
|
2009-05-05 14:32:01 +00:00
|
|
|
DefaultLogger::get()->warn("LWO2: Skipping unknown VMAP/VMAD channel \'" + name + "\'");
|
2008-11-16 21:56:45 +00:00
|
|
|
return;
|
2008-09-08 16:48:21 +00:00
|
|
|
};
|
2008-09-20 15:55:51 +00:00
|
|
|
base->Allocate((unsigned int)mCurLayer->mTempPoints.size());
|
2008-09-08 16:48:21 +00:00
|
|
|
|
|
|
|
// now read all entries in the map
|
|
|
|
type = std::min(dims,base->dims);
|
2009-05-05 14:32:01 +00:00
|
|
|
const unsigned int diff = (dims - type)<<2u;
|
2008-09-08 16:48:21 +00:00
|
|
|
|
2008-09-20 15:55:51 +00:00
|
|
|
LWO::FaceList& list = mCurLayer->mFaces;
|
|
|
|
LWO::PointList& pointList = mCurLayer->mTempPoints;
|
|
|
|
LWO::ReferrerList& refList = mCurLayer->mPointReferrers;
|
|
|
|
|
|
|
|
float temp[4];
|
|
|
|
|
2008-09-27 16:46:05 +00:00
|
|
|
const unsigned int numPoints = (unsigned int)pointList.size();
|
|
|
|
const unsigned int numFaces = (unsigned int)list.size();
|
|
|
|
|
2009-05-05 14:32:01 +00:00
|
|
|
while (mFileBuffer < end) {
|
|
|
|
|
2008-09-08 16:48:21 +00:00
|
|
|
unsigned int idx = ReadVSizedIntLWO2(mFileBuffer) + mCurLayer->mPointIDXOfs;
|
2009-03-26 22:05:56 +00:00
|
|
|
if (idx >= numPoints) {
|
2009-05-05 14:32:01 +00:00
|
|
|
DefaultLogger::get()->warn("LWO2: Failure evaluating VMAP/VMAD entry \'" + name + "\', vertex index is out of range");
|
|
|
|
mFileBuffer += base->dims<<2u;
|
|
|
|
continue;
|
2008-09-08 16:48:21 +00:00
|
|
|
}
|
2009-03-26 22:05:56 +00:00
|
|
|
if (perPoly) {
|
2008-09-20 15:55:51 +00:00
|
|
|
unsigned int polyIdx = ReadVSizedIntLWO2(mFileBuffer) + mCurLayer->mFaceIDXOfs;
|
2009-03-26 22:05:56 +00:00
|
|
|
if (base->abAssigned[idx]) {
|
2008-09-20 15:55:51 +00:00
|
|
|
// we have already a VMAP entry for this vertex - thus
|
|
|
|
// we need to duplicate the corresponding polygon.
|
2009-03-26 22:05:56 +00:00
|
|
|
if (polyIdx >= numFaces) {
|
2009-05-05 14:32:01 +00:00
|
|
|
DefaultLogger::get()->warn("LWO2: Failure evaluating VMAD entry \'" + name + "\', polygon index is out of range");
|
|
|
|
mFileBuffer += base->dims<<2u;
|
2008-11-16 21:56:45 +00:00
|
|
|
continue;
|
2008-09-20 15:55:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
LWO::Face& src = list[polyIdx];
|
|
|
|
|
2008-11-16 21:56:45 +00:00
|
|
|
// generate a new unique vertex for the corresponding index - but only
|
|
|
|
// if we can find the index in the face
|
2009-05-05 14:32:01 +00:00
|
|
|
bool had = false;
|
2009-03-26 22:05:56 +00:00
|
|
|
for (unsigned int i = 0; i < src.mNumIndices;++i) {
|
2009-05-05 14:32:01 +00:00
|
|
|
|
|
|
|
unsigned int srcIdx = src.mIndices[i], tmp = idx;
|
|
|
|
do {
|
|
|
|
if (tmp == srcIdx)
|
|
|
|
break;
|
|
|
|
}
|
2011-04-22 21:29:18 +00:00
|
|
|
while ((tmp = refList[tmp]) != UINT_MAX);
|
|
|
|
if (tmp == UINT_MAX) {
|
2009-03-26 22:05:56 +00:00
|
|
|
continue;
|
2011-04-22 21:29:18 +00:00
|
|
|
}
|
2008-11-16 21:56:45 +00:00
|
|
|
|
2009-05-05 14:32:01 +00:00
|
|
|
had = true;
|
2011-04-22 21:29:18 +00:00
|
|
|
refList.resize(refList.size()+1, UINT_MAX);
|
2008-11-16 21:56:45 +00:00
|
|
|
|
|
|
|
idx = (unsigned int)pointList.size();
|
2008-09-27 16:46:05 +00:00
|
|
|
src.mIndices[i] = (unsigned int)pointList.size();
|
2008-09-20 15:55:51 +00:00
|
|
|
|
|
|
|
// store the index of the new vertex in the old vertex
|
|
|
|
// so we get a single linked list we can traverse in
|
|
|
|
// only one direction
|
2008-09-27 16:46:05 +00:00
|
|
|
AddToSingleLinkedList(refList,srcIdx,src.mIndices[i]);
|
2008-09-20 15:55:51 +00:00
|
|
|
pointList.push_back(pointList[srcIdx]);
|
|
|
|
|
|
|
|
CreateNewEntry(mCurLayer->mVColorChannels, srcIdx );
|
|
|
|
CreateNewEntry(mCurLayer->mUVChannels, srcIdx );
|
|
|
|
CreateNewEntry(mCurLayer->mWeightChannels, srcIdx );
|
2009-05-05 14:32:01 +00:00
|
|
|
CreateNewEntry(mCurLayer->mSWeightChannels, srcIdx );
|
|
|
|
CreateNewEntry(mCurLayer->mNormals, srcIdx );
|
|
|
|
}
|
|
|
|
if (!had) {
|
|
|
|
DefaultLogger::get()->warn("LWO2: Failure evaluating VMAD entry \'" + name + "\', vertex index wasn't found in that polygon");
|
|
|
|
ai_assert(had);
|
2008-09-20 15:55:51 +00:00
|
|
|
}
|
|
|
|
}
|
2008-09-08 16:48:21 +00:00
|
|
|
}
|
2008-09-20 15:55:51 +00:00
|
|
|
for (unsigned int l = 0; l < type;++l)
|
|
|
|
temp[l] = GetF4();
|
|
|
|
|
|
|
|
DoRecursiveVMAPAssignment(base,type,idx, temp);
|
2008-09-08 16:48:21 +00:00
|
|
|
mFileBuffer += diff;
|
2008-08-15 23:23:28 +00:00
|
|
|
}
|
|
|
|
}
|
2008-09-08 16:48:21 +00:00
|
|
|
|
2008-09-20 15:55:51 +00:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
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
|
|
|
// Load LWO2 clip
|
2008-09-20 15:55:51 +00:00
|
|
|
void LWOImporter::LoadLWO2Clip(unsigned int length)
|
|
|
|
{
|
|
|
|
AI_LWO_VALIDATE_CHUNK_LENGTH(length,CLIP,10);
|
|
|
|
|
|
|
|
mClips.push_back(LWO::Clip());
|
|
|
|
LWO::Clip& clip = mClips.back();
|
|
|
|
|
|
|
|
// first - get the index of the clip
|
|
|
|
clip.idx = GetU4();
|
|
|
|
|
2008-10-28 23:18:06 +00:00
|
|
|
IFF::SubChunkHeader* const head = IFF::LoadSubChunk(mFileBuffer);
|
2008-09-20 15:55:51 +00:00
|
|
|
switch (head->type)
|
|
|
|
{
|
|
|
|
case AI_LWO_STIL:
|
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
|
|
|
AI_LWO_VALIDATE_CHUNK_LENGTH(head->length,STIL,1);
|
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
|
|
|
|
|
|
|
// "Normal" texture
|
2008-09-20 15:55:51 +00:00
|
|
|
GetS0(clip.path,head->length);
|
|
|
|
clip.type = Clip::STILL;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case AI_LWO_ISEQ:
|
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
|
|
|
AI_LWO_VALIDATE_CHUNK_LENGTH(head->length,ISEQ,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
|
|
|
// Image sequence. We'll later take the first.
|
2008-09-20 15:55:51 +00:00
|
|
|
{
|
|
|
|
uint8_t digits = GetU1(); mFileBuffer++;
|
|
|
|
int16_t offset = GetU2(); mFileBuffer+=4;
|
|
|
|
int16_t start = GetU2(); mFileBuffer+=4;
|
|
|
|
|
2011-04-03 15:12:05 +00:00
|
|
|
std::string s;
|
|
|
|
std::ostringstream ss;
|
2008-10-28 23:18:06 +00:00
|
|
|
GetS0(s,head->length);
|
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
|
|
|
|
|
|
|
head->length -= (unsigned int)s.length()+1;
|
2008-09-20 15:55:51 +00:00
|
|
|
ss << s;
|
|
|
|
ss << std::setw(digits) << offset + start;
|
|
|
|
GetS0(s,head->length);
|
|
|
|
ss << s;
|
|
|
|
clip.path = ss.str();
|
|
|
|
clip.type = Clip::SEQ;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case AI_LWO_STCC:
|
|
|
|
DefaultLogger::get()->warn("LWO2: Color shifted images are not supported");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case AI_LWO_ANIM:
|
|
|
|
DefaultLogger::get()->warn("LWO2: Animated textures are not supported");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case AI_LWO_XREF:
|
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
|
|
|
AI_LWO_VALIDATE_CHUNK_LENGTH(head->length,XREF,4);
|
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
|
|
|
|
|
|
|
// Just a cross-reference to another CLIp
|
2008-09-20 15:55:51 +00:00
|
|
|
clip.type = Clip::REF;
|
|
|
|
clip.clipRef = GetU4();
|
|
|
|
break;
|
|
|
|
|
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
|
|
|
case AI_LWO_NEGA:
|
|
|
|
AI_LWO_VALIDATE_CHUNK_LENGTH(head->length,NEGA,2);
|
|
|
|
clip.negate = (0 != GetU2());
|
|
|
|
break;
|
|
|
|
|
2008-09-20 15:55:51 +00:00
|
|
|
default:
|
|
|
|
DefaultLogger::get()->warn("LWO2: Encountered unknown CLIP subchunk");
|
|
|
|
}
|
|
|
|
}
|
2008-09-08 16:48:21 +00:00
|
|
|
|
2008-08-15 23:23:28 +00:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
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
|
|
|
// Load envelope description
|
|
|
|
void LWOImporter::LoadLWO2Envelope(unsigned int length)
|
|
|
|
{
|
|
|
|
LE_NCONST uint8_t* const end = mFileBuffer + length;
|
|
|
|
AI_LWO_VALIDATE_CHUNK_LENGTH(length,ENVL,4);
|
|
|
|
|
|
|
|
mEnvelopes.push_back(LWO::Envelope());
|
|
|
|
LWO::Envelope& envelope = mEnvelopes.back();
|
|
|
|
|
|
|
|
// Get the index of the envelope
|
|
|
|
envelope.index = ReadVSizedIntLWO2(mFileBuffer);
|
|
|
|
|
2010-03-18 17:20:49 +00:00
|
|
|
// It looks like there might be an extra U4 right after the index,
|
|
|
|
// at least in modo (LXOB) files: we'll ignore it if it's zero,
|
|
|
|
// otherwise it represents the start of a subchunk, so we backtrack.
|
|
|
|
if (mIsLXOB)
|
|
|
|
{
|
|
|
|
uint32_t extra = GetU4();
|
|
|
|
if (extra)
|
|
|
|
{
|
|
|
|
mFileBuffer -= 4;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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
|
|
|
// ... and read all subchunks
|
|
|
|
while (true)
|
|
|
|
{
|
|
|
|
if (mFileBuffer + 6 >= end)break;
|
|
|
|
LE_NCONST IFF::SubChunkHeader* const head = IFF::LoadSubChunk(mFileBuffer);
|
|
|
|
|
|
|
|
if (mFileBuffer + head->length > end)
|
2010-03-18 17:00:12 +00:00
|
|
|
throw DeadlyImportError("LWO2: Invalid envelope chunk length");
|
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
|
|
|
|
|
|
|
uint8_t* const next = mFileBuffer+head->length;
|
|
|
|
switch (head->type)
|
|
|
|
{
|
|
|
|
// Type & representation of the envelope
|
|
|
|
case AI_LWO_TYPE:
|
|
|
|
AI_LWO_VALIDATE_CHUNK_LENGTH(head->length,TYPE,2);
|
|
|
|
mFileBuffer++; // skip user format
|
|
|
|
|
|
|
|
// Determine type of envelope
|
|
|
|
envelope.type = (LWO::EnvelopeType)*mFileBuffer;
|
|
|
|
++mFileBuffer;
|
|
|
|
break;
|
|
|
|
|
|
|
|
// precondition
|
|
|
|
case AI_LWO_PRE:
|
|
|
|
AI_LWO_VALIDATE_CHUNK_LENGTH(head->length,PRE,2);
|
|
|
|
envelope.pre = (LWO::PrePostBehaviour)GetU2();
|
|
|
|
break;
|
|
|
|
|
|
|
|
// postcondition
|
|
|
|
case AI_LWO_POST:
|
|
|
|
AI_LWO_VALIDATE_CHUNK_LENGTH(head->length,POST,2);
|
|
|
|
envelope.post = (LWO::PrePostBehaviour)GetU2();
|
|
|
|
break;
|
|
|
|
|
|
|
|
// keyframe
|
|
|
|
case AI_LWO_KEY:
|
|
|
|
{
|
|
|
|
AI_LWO_VALIDATE_CHUNK_LENGTH(head->length,KEY,8);
|
|
|
|
|
|
|
|
envelope.keys.push_back(LWO::Key());
|
|
|
|
LWO::Key& key = envelope.keys.back();
|
|
|
|
|
|
|
|
key.time = GetF4();
|
|
|
|
key.value = GetF4();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
// interval interpolation
|
|
|
|
case AI_LWO_SPAN:
|
|
|
|
{
|
|
|
|
AI_LWO_VALIDATE_CHUNK_LENGTH(head->length,SPAN,4);
|
|
|
|
if (envelope.keys.size()<2)
|
|
|
|
DefaultLogger::get()->warn("LWO2: Unexpected SPAN chunk");
|
|
|
|
else {
|
|
|
|
LWO::Key& key = envelope.keys.back();
|
|
|
|
switch (GetU4())
|
|
|
|
{
|
|
|
|
case AI_LWO_STEP:
|
|
|
|
key.inter = LWO::IT_STEP;break;
|
|
|
|
case AI_LWO_LINE:
|
|
|
|
key.inter = LWO::IT_LINE;break;
|
|
|
|
case AI_LWO_TCB:
|
|
|
|
key.inter = LWO::IT_TCB;break;
|
|
|
|
case AI_LWO_HERM:
|
|
|
|
key.inter = LWO::IT_HERM;break;
|
|
|
|
case AI_LWO_BEZI:
|
|
|
|
key.inter = LWO::IT_BEZI;break;
|
|
|
|
case AI_LWO_BEZ2:
|
|
|
|
key.inter = LWO::IT_BEZ2;break;
|
|
|
|
default:
|
|
|
|
DefaultLogger::get()->warn("LWO2: Unknown interval interpolation mode");
|
|
|
|
};
|
|
|
|
|
|
|
|
// todo ... read params
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
default:
|
|
|
|
DefaultLogger::get()->warn("LWO2: Encountered unknown ENVL subchunk");
|
|
|
|
}
|
|
|
|
// regardless how much we did actually read, go to the next chunk
|
|
|
|
mFileBuffer = next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
// Load file - master function
|
2008-08-15 23:23:28 +00:00
|
|
|
void LWOImporter::LoadLWO2File()
|
|
|
|
{
|
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
|
|
|
bool skip = false;
|
|
|
|
|
2008-08-15 23:23:28 +00:00
|
|
|
LE_NCONST uint8_t* const end = mFileBuffer + fileSize;
|
|
|
|
while (true)
|
|
|
|
{
|
|
|
|
if (mFileBuffer + sizeof(IFF::ChunkHeader) > end)break;
|
2008-10-28 23:18:06 +00:00
|
|
|
IFF::ChunkHeader* const head = IFF::LoadChunk(mFileBuffer);
|
2008-09-20 15:55:51 +00:00
|
|
|
|
2008-08-15 23:23:28 +00:00
|
|
|
if (mFileBuffer + head->length > end)
|
|
|
|
{
|
2010-03-18 17:00:12 +00:00
|
|
|
throw DeadlyImportError("LWO2: Chunk length points behind the file");
|
2008-08-15 23:23:28 +00:00
|
|
|
break;
|
|
|
|
}
|
2008-10-28 23:18:06 +00:00
|
|
|
uint8_t* const next = mFileBuffer+head->length;
|
2008-08-15 23:23:28 +00:00
|
|
|
unsigned int iUnnamed = 0;
|
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-15 23:23:28 +00:00
|
|
|
switch (head->type)
|
|
|
|
{
|
|
|
|
// new layer
|
|
|
|
case AI_LWO_LAYR:
|
|
|
|
{
|
|
|
|
// add a new layer to the list ....
|
|
|
|
mLayers->push_back ( LWO::Layer() );
|
|
|
|
LWO::Layer& layer = mLayers->back();
|
|
|
|
mCurLayer = &layer;
|
2008-08-07 22:27:17 +00:00
|
|
|
|
2009-03-26 22:05:56 +00:00
|
|
|
AI_LWO_VALIDATE_CHUNK_LENGTH(head->length,LAYR,16);
|
|
|
|
|
2011-12-07 01:28:45 +00:00
|
|
|
// layer index.
|
|
|
|
layer.mIndex = GetU2();
|
|
|
|
|
2009-03-26 22:05:56 +00:00
|
|
|
// Continue loading this layer or ignore it? Check the layer index property
|
2011-12-07 01:28:45 +00:00
|
|
|
if (UINT_MAX != configLayerIndex && (configLayerIndex-1) != layer.mIndex) {
|
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
|
|
|
skip = true;
|
|
|
|
}
|
|
|
|
else skip = false;
|
|
|
|
|
2009-03-26 22:05:56 +00:00
|
|
|
// pivot point
|
|
|
|
mFileBuffer += 2; /* unknown */
|
2008-09-20 15:55:51 +00:00
|
|
|
mCurLayer->mPivot.x = GetF4();
|
|
|
|
mCurLayer->mPivot.y = GetF4();
|
|
|
|
mCurLayer->mPivot.z = GetF4();
|
|
|
|
GetS0(layer.mName,head->length-16);
|
2008-08-15 23:23:28 +00:00
|
|
|
|
|
|
|
// if the name is empty, generate a default name
|
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
|
|
|
if (layer.mName.empty()) {
|
2008-08-15 23:23:28 +00:00
|
|
|
char buffer[128]; // should be sufficiently large
|
|
|
|
::sprintf(buffer,"Layer_%i", iUnnamed++);
|
|
|
|
layer.mName = buffer;
|
2008-08-07 22:27:17 +00:00
|
|
|
}
|
2008-08-15 23:23:28 +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
|
|
|
// load this layer or ignore it? Check the layer name property
|
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
|
|
|
if (configLayerName.length() && configLayerName != layer.mName) {
|
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
|
|
|
skip = true;
|
|
|
|
}
|
|
|
|
else hasNamedLayer = true;
|
|
|
|
|
2009-03-26 22:05:56 +00:00
|
|
|
// optional: parent of this layer
|
2008-08-15 23:23:28 +00:00
|
|
|
if (mFileBuffer + 2 <= next)
|
2008-09-20 15:55:51 +00:00
|
|
|
layer.mParent = GetU2();
|
2011-12-07 06:22:02 +00:00
|
|
|
else layer.mParent = -1;
|
2008-08-15 23:23:28 +00:00
|
|
|
|
2011-12-01 12:24:33 +00:00
|
|
|
// Set layer skip parameter
|
|
|
|
layer.skip = skip;
|
|
|
|
|
2008-08-15 23:23:28 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
// vertex list
|
|
|
|
case AI_LWO_PNTS:
|
|
|
|
{
|
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
|
|
|
if (skip)
|
|
|
|
break;
|
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-09-08 16:48:21 +00:00
|
|
|
unsigned int old = (unsigned int)mCurLayer->mTempPoints.size();
|
|
|
|
LoadLWOPoints(head->length);
|
|
|
|
mCurLayer->mPointIDXOfs = old;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
// vertex tags
|
2008-09-20 15:55:51 +00:00
|
|
|
case AI_LWO_VMAD:
|
|
|
|
if (mCurLayer->mFaces.empty())
|
|
|
|
{
|
|
|
|
DefaultLogger::get()->warn("LWO2: Unexpected VMAD chunk");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
// --- intentionally no break here
|
2008-09-08 16:48:21 +00:00
|
|
|
case AI_LWO_VMAP:
|
|
|
|
{
|
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
|
|
|
if (skip)
|
|
|
|
break;
|
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-09-08 16:48:21 +00:00
|
|
|
if (mCurLayer->mTempPoints.empty())
|
2008-09-20 15:55:51 +00:00
|
|
|
DefaultLogger::get()->warn("LWO2: Unexpected VMAP chunk");
|
2008-09-08 16:48:21 +00:00
|
|
|
else LoadLWO2VertexMap(head->length,head->type == AI_LWO_VMAD);
|
2008-08-15 23:23:28 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
// face list
|
|
|
|
case AI_LWO_POLS:
|
|
|
|
{
|
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
|
|
|
if (skip)
|
|
|
|
break;
|
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-09-08 16:48:21 +00:00
|
|
|
unsigned int old = (unsigned int)mCurLayer->mFaces.size();
|
2008-09-13 11:11:51 +00:00
|
|
|
LoadLWO2Polygons(head->length);
|
2008-09-08 16:48:21 +00:00
|
|
|
mCurLayer->mFaceIDXOfs = old;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
// polygon tags
|
|
|
|
case AI_LWO_PTAG:
|
|
|
|
{
|
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
|
|
|
if (skip)
|
|
|
|
break;
|
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-09-08 16:48:21 +00:00
|
|
|
if (mCurLayer->mFaces.empty())
|
|
|
|
DefaultLogger::get()->warn("LWO2: Unexpected PTAG");
|
|
|
|
else LoadLWO2PolygonTags(head->length);
|
2008-08-07 22:27:17 +00:00
|
|
|
break;
|
|
|
|
}
|
2008-08-10 23:58:21 +00:00
|
|
|
// list of tags
|
2008-09-13 11:11:51 +00:00
|
|
|
case AI_LWO_TAGS:
|
2008-08-10 23:58:21 +00:00
|
|
|
{
|
2008-08-15 23:23:28 +00:00
|
|
|
if (!mTags->empty())
|
2008-09-08 16:48:21 +00:00
|
|
|
DefaultLogger::get()->warn("LWO2: SRFS chunk encountered twice");
|
2008-08-15 23:23:28 +00:00
|
|
|
else LoadLWOTags(head->length);
|
2008-08-10 23:58:21 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2008-08-07 22:27:17 +00:00
|
|
|
// surface chunk
|
|
|
|
case AI_LWO_SURF:
|
|
|
|
{
|
2008-09-13 11:11:51 +00:00
|
|
|
LoadLWO2Surface(head->length);
|
2008-08-07 22:27:17 +00:00
|
|
|
break;
|
|
|
|
}
|
2008-09-20 15:55:51 +00:00
|
|
|
|
|
|
|
// clip chunk
|
|
|
|
case AI_LWO_CLIP:
|
|
|
|
{
|
|
|
|
LoadLWO2Clip(head->length);
|
|
|
|
break;
|
|
|
|
}
|
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
|
|
|
|
|
|
|
// envelope chunk
|
|
|
|
case AI_LWO_ENVL:
|
|
|
|
{
|
|
|
|
LoadLWO2Envelope(head->length);
|
|
|
|
break;
|
|
|
|
}
|
2008-08-07 22:27:17 +00:00
|
|
|
}
|
2008-08-10 23:58:21 +00:00
|
|
|
mFileBuffer = next;
|
2008-08-07 22:27:17 +00:00
|
|
|
}
|
2008-09-12 20:25:11 +00:00
|
|
|
}
|
2009-01-18 23:48:25 +00:00
|
|
|
|
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
|
|
|
#endif // !! ASSIMP_BUILD_NO_LWO_IMPORTER
|