2008-10-27 00:36:26 +00:00
|
|
|
/*
|
|
|
|
---------------------------------------------------------------------------
|
|
|
|
Open Asset Import Library (ASSIMP)
|
|
|
|
---------------------------------------------------------------------------
|
|
|
|
|
2010-04-10 15:30:22 +00:00
|
|
|
Copyright (c) 2006-2010, ASSIMP Development Team
|
2008-10-27 00:36:26 +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.
|
|
|
|
---------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
|
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
|
|
|
/** @file IRRLoader.cpp
|
|
|
|
* @brief Implementation of the Irr importer class
|
|
|
|
*/
|
2008-10-27 00:36:26 +00:00
|
|
|
|
|
|
|
#include "AssimpPCH.h"
|
|
|
|
|
|
|
|
#include "IRRLoader.h"
|
|
|
|
#include "ParsingUtils.h"
|
|
|
|
#include "fast_atof.h"
|
2008-11-02 16:58:31 +00:00
|
|
|
#include "GenericProperty.h"
|
2008-10-27 00:36:26 +00:00
|
|
|
|
2008-11-02 16:58:31 +00:00
|
|
|
#include "SceneCombiner.h"
|
2008-10-27 00:36:26 +00:00
|
|
|
#include "StandardShapes.h"
|
|
|
|
|
2008-11-26 13:17:39 +00:00
|
|
|
|
|
|
|
// We need boost::common_factor to compute the lcm/gcd of a number
|
2010-03-03 21:48:23 +00:00
|
|
|
#include <boost/math/common_factor_rt.hpp>
|
2008-11-26 13:17:39 +00:00
|
|
|
|
2008-10-27 00:36:26 +00:00
|
|
|
using namespace Assimp;
|
2009-03-03 15:43:26 +00:00
|
|
|
using namespace irr;
|
|
|
|
using namespace irr::io;
|
2008-10-27 00:36:26 +00:00
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
// Constructor to be privately used by Importer
|
|
|
|
IRRImporter::IRRImporter()
|
2009-03-15 00:40:30 +00:00
|
|
|
{}
|
2008-10-27 00:36:26 +00:00
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
// Destructor, private as well
|
|
|
|
IRRImporter::~IRRImporter()
|
2009-03-15 00:40:30 +00:00
|
|
|
{}
|
2008-10-27 00:36:26 +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 IRRImporter::CanRead( const std::string& pFile, IOSystem* pIOHandler, bool checkSig) const
|
2008-10-27 00:36:26 +00:00
|
|
|
{
|
|
|
|
/* NOTE: A simple check for the file extension is not enough
|
|
|
|
* here. Irrmesh and irr are easy, but xml is too generic
|
|
|
|
* and could be collada, too. So we need to open the file and
|
|
|
|
* search for typical tokens.
|
|
|
|
*/
|
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 == "irr")return true;
|
|
|
|
else if (extension == "xml" || checkSig)
|
2008-10-27 00:36:26 +00:00
|
|
|
{
|
2009-01-10 17:58:06 +00:00
|
|
|
/* If CanRead() is called in order to check whether we
|
|
|
|
* support a specific file extension in general pIOHandler
|
|
|
|
* might be NULL and it's our duty to return true here.
|
2008-10-27 00:36:26 +00:00
|
|
|
*/
|
|
|
|
if (!pIOHandler)return true;
|
|
|
|
const char* tokens[] = {"irr_scene"};
|
|
|
|
return SearchFileHeaderForToken(pIOHandler,pFile,tokens,1);
|
|
|
|
}
|
|
|
|
return 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
|
|
|
// ------------------------------------------------------------------------------------------------
|
2010-03-02 17:38:01 +00:00
|
|
|
void IRRImporter::GetExtensionList(std::set<std::string>& extensions)
|
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
|
|
|
{
|
2010-03-02 17:38:01 +00:00
|
|
|
extensions.insert("irr");
|
|
|
|
extensions.insert("xml");
|
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
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
void IRRImporter::SetupProperties(const Importer* pImp)
|
|
|
|
{
|
|
|
|
// read the output frame rate of all node animation channels
|
|
|
|
fps = pImp->GetPropertyInteger(AI_CONFIG_IMPORT_IRR_ANIM_FPS,100);
|
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 (fps < 10.) {
|
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
|
|
|
DefaultLogger::get()->error("IRR: Invalid FPS configuration");
|
|
|
|
fps = 100;
|
|
|
|
}
|
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_CONFIG_FAVOUR_SPEED
|
|
|
|
configSpeedFlag = (0 != pImp->GetPropertyInteger(AI_CONFIG_FAVOUR_SPEED,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
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
// Build a mesh tha consists of a single squad (a side of a skybox)
|
|
|
|
aiMesh* IRRImporter::BuildSingleQuadMesh(const SkyboxVertex& v1,
|
|
|
|
const SkyboxVertex& v2,
|
|
|
|
const SkyboxVertex& v3,
|
|
|
|
const SkyboxVertex& v4)
|
|
|
|
{
|
|
|
|
// allocate and prepare the mesh
|
|
|
|
aiMesh* out = new aiMesh();
|
|
|
|
|
|
|
|
out->mPrimitiveTypes = aiPrimitiveType_POLYGON;
|
|
|
|
out->mNumFaces = 1;
|
|
|
|
|
|
|
|
// build the face
|
|
|
|
out->mFaces = new aiFace[1];
|
|
|
|
aiFace& face = out->mFaces[0];
|
|
|
|
|
|
|
|
face.mNumIndices = 4;
|
|
|
|
face.mIndices = new unsigned int[4];
|
|
|
|
for (unsigned int i = 0; i < 4;++i)
|
|
|
|
face.mIndices[i] = i;
|
|
|
|
|
|
|
|
out->mNumVertices = 4;
|
|
|
|
|
|
|
|
// copy vertex positions
|
|
|
|
aiVector3D* vec = out->mVertices = new aiVector3D[4];
|
|
|
|
*vec++ = v1.position;
|
|
|
|
*vec++ = v2.position;
|
|
|
|
*vec++ = v3.position;
|
|
|
|
*vec = v4.position;
|
|
|
|
|
|
|
|
// copy vertex normals
|
|
|
|
vec = out->mNormals = new aiVector3D[4];
|
|
|
|
*vec++ = v1.normal;
|
|
|
|
*vec++ = v2.normal;
|
|
|
|
*vec++ = v3.normal;
|
|
|
|
*vec = v4.normal;
|
|
|
|
|
|
|
|
// copy texture coordinates
|
2008-11-26 13:17:39 +00:00
|
|
|
vec = out->mTextureCoords[0] = new aiVector3D[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
|
|
|
*vec++ = v1.uv;
|
|
|
|
*vec++ = v2.uv;
|
|
|
|
*vec++ = v3.uv;
|
|
|
|
*vec = v4.uv;
|
|
|
|
return out;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
void IRRImporter::BuildSkybox(std::vector<aiMesh*>& meshes, std::vector<aiMaterial*> materials)
|
|
|
|
{
|
2009-03-15 00:40:30 +00:00
|
|
|
// Update the material of the skybox - replace the name and disable shading for skyboxes.
|
|
|
|
for (unsigned int i = 0; i < 6;++i) {
|
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
|
|
|
MaterialHelper* out = ( MaterialHelper* ) (*(materials.end()-(6-i)));
|
|
|
|
|
|
|
|
aiString s;
|
|
|
|
s.length = ::sprintf( s.data, "SkyboxSide_%i",i );
|
|
|
|
out->AddProperty(&s,AI_MATKEY_NAME);
|
|
|
|
|
|
|
|
int shading = aiShadingMode_NoShading;
|
|
|
|
out->AddProperty(&shading,1,AI_MATKEY_SHADING_MODEL);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Skyboxes are much more difficult. They are represented
|
|
|
|
// by six single planes with different textures, so we'll
|
|
|
|
// need to build six meshes.
|
|
|
|
|
|
|
|
const float l = 10.f; // the size used by Irrlicht
|
|
|
|
|
|
|
|
// FRONT SIDE
|
|
|
|
meshes.push_back( BuildSingleQuadMesh(
|
|
|
|
SkyboxVertex(-l,-l,-l, 0, 0, 1, 1.f,1.f),
|
|
|
|
SkyboxVertex( l,-l,-l, 0, 0, 1, 0.f,1.f),
|
|
|
|
SkyboxVertex( l, l,-l, 0, 0, 1, 0.f,0.f),
|
|
|
|
SkyboxVertex(-l, l,-l, 0, 0, 1, 1.f,0.f)) );
|
|
|
|
meshes.back()->mMaterialIndex = materials.size()-6u;
|
|
|
|
|
|
|
|
// LEFT SIDE
|
|
|
|
meshes.push_back( BuildSingleQuadMesh(
|
|
|
|
SkyboxVertex( l,-l,-l, -1, 0, 0, 1.f,1.f),
|
|
|
|
SkyboxVertex( l,-l, l, -1, 0, 0, 0.f,1.f),
|
|
|
|
SkyboxVertex( l, l, l, -1, 0, 0, 0.f,0.f),
|
|
|
|
SkyboxVertex( l, l,-l, -1, 0, 0, 1.f,0.f)) );
|
|
|
|
meshes.back()->mMaterialIndex = materials.size()-5u;
|
|
|
|
|
|
|
|
// BACK SIDE
|
|
|
|
meshes.push_back( BuildSingleQuadMesh(
|
|
|
|
SkyboxVertex( l,-l, l, 0, 0, -1, 1.f,1.f),
|
|
|
|
SkyboxVertex(-l,-l, l, 0, 0, -1, 0.f,1.f),
|
|
|
|
SkyboxVertex(-l, l, l, 0, 0, -1, 0.f,0.f),
|
|
|
|
SkyboxVertex( l, l, l, 0, 0, -1, 1.f,0.f)) );
|
|
|
|
meshes.back()->mMaterialIndex = materials.size()-4u;
|
|
|
|
|
|
|
|
// RIGHT SIDE
|
|
|
|
meshes.push_back( BuildSingleQuadMesh(
|
|
|
|
SkyboxVertex(-l,-l, l, 1, 0, 0, 1.f,1.f),
|
|
|
|
SkyboxVertex(-l,-l,-l, 1, 0, 0, 0.f,1.f),
|
|
|
|
SkyboxVertex(-l, l,-l, 1, 0, 0, 0.f,0.f),
|
|
|
|
SkyboxVertex(-l, l, l, 1, 0, 0, 1.f,0.f)) );
|
|
|
|
meshes.back()->mMaterialIndex = materials.size()-3u;
|
|
|
|
|
|
|
|
// TOP SIDE
|
|
|
|
meshes.push_back( BuildSingleQuadMesh(
|
|
|
|
SkyboxVertex( l, l,-l, 0, -1, 0, 1.f,1.f),
|
|
|
|
SkyboxVertex( l, l, l, 0, -1, 0, 0.f,1.f),
|
|
|
|
SkyboxVertex(-l, l, l, 0, -1, 0, 0.f,0.f),
|
|
|
|
SkyboxVertex(-l, l,-l, 0, -1, 0, 1.f,0.f)) );
|
|
|
|
meshes.back()->mMaterialIndex = materials.size()-2u;
|
|
|
|
|
|
|
|
// BOTTOM SIDE
|
|
|
|
meshes.push_back( BuildSingleQuadMesh(
|
|
|
|
SkyboxVertex( l,-l, l, 0, 1, 0, 0.f,0.f),
|
|
|
|
SkyboxVertex( l,-l,-l, 0, 1, 0, 1.f,0.f),
|
|
|
|
SkyboxVertex(-l,-l,-l, 0, 1, 0, 1.f,1.f),
|
2008-11-26 13:17:39 +00:00
|
|
|
SkyboxVertex(-l,-l, l, 0, 1, 0, 0.f,1.f)) );
|
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
|
|
|
meshes.back()->mMaterialIndex = materials.size()-1u;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2008-11-26 13:17:39 +00:00
|
|
|
void IRRImporter::CopyMaterial(std::vector<aiMaterial*>& materials,
|
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
|
|
|
std::vector< std::pair<aiMaterial*, unsigned int> >& inmaterials,
|
|
|
|
unsigned int& defMatIdx,
|
|
|
|
aiMesh* mesh)
|
|
|
|
{
|
2009-03-15 00:40:30 +00:00
|
|
|
if (inmaterials.empty()) {
|
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
|
|
|
// Do we have a default material? If not we need to create one
|
2011-04-22 21:29:18 +00:00
|
|
|
if (UINT_MAX == defMatIdx)
|
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
|
|
|
{
|
|
|
|
defMatIdx = (unsigned int)materials.size();
|
|
|
|
MaterialHelper* mat = new MaterialHelper();
|
|
|
|
|
|
|
|
aiString s;
|
|
|
|
s.Set(AI_DEFAULT_MATERIAL_NAME);
|
|
|
|
mat->AddProperty(&s,AI_MATKEY_NAME);
|
|
|
|
|
|
|
|
aiColor3D c(0.6f,0.6f,0.6f);
|
|
|
|
mat->AddProperty(&c,1,AI_MATKEY_COLOR_DIFFUSE);
|
|
|
|
}
|
|
|
|
mesh->mMaterialIndex = defMatIdx;
|
|
|
|
return;
|
|
|
|
}
|
2009-03-15 00:40:30 +00:00
|
|
|
else if (inmaterials.size() > 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
|
|
|
DefaultLogger::get()->info("IRR: Skipping additional materials");
|
|
|
|
}
|
|
|
|
|
|
|
|
mesh->mMaterialIndex = (unsigned int)materials.size();
|
|
|
|
materials.push_back(inmaterials[0].first);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
inline int ClampSpline(int idx, int size)
|
|
|
|
{
|
|
|
|
return ( idx<0 ? size+idx : ( idx>=size ? idx-size : idx ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
inline void FindSuitableMultiple(int& angle)
|
|
|
|
{
|
|
|
|
if (angle < 3)angle = 3;
|
|
|
|
else if (angle < 10) angle = 10;
|
|
|
|
else if (angle < 20) angle = 20;
|
|
|
|
else if (angle < 30) angle = 30;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2008-11-26 13:17:39 +00:00
|
|
|
void IRRImporter::ComputeAnimations(Node* root, aiNode* real, std::vector<aiNodeAnim*>& anims)
|
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-26 13:17:39 +00:00
|
|
|
ai_assert(NULL != root && NULL != real);
|
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
|
|
|
|
2010-02-06 23:52:41 +00:00
|
|
|
// XXX totally WIP - doesn't produce proper results, need to evaluate
|
|
|
|
// whether there's any use for Irrlicht's proprietary scene format
|
|
|
|
// outside Irrlicht ...
|
|
|
|
|
2009-03-15 00:40:30 +00:00
|
|
|
if (root->animators.empty()) {
|
|
|
|
return;
|
|
|
|
}
|
2008-11-26 13:17:39 +00:00
|
|
|
unsigned int total = 0;
|
2009-03-15 00:40:30 +00:00
|
|
|
for (std::list<Animator>::iterator it = root->animators.begin();it != root->animators.end(); ++it) {
|
|
|
|
if ((*it).type == Animator::UNKNOWN || (*it).type == Animator::OTHER) {
|
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
|
|
|
DefaultLogger::get()->warn("IRR: Skipping unknown or unsupported animator");
|
|
|
|
continue;
|
|
|
|
}
|
2008-11-26 13:17:39 +00:00
|
|
|
++total;
|
|
|
|
}
|
|
|
|
if (!total)return;
|
2009-03-15 00:40:30 +00:00
|
|
|
else if (1 == total) {
|
|
|
|
DefaultLogger::get()->warn("IRR: Adding dummy nodes to simulate multiple animators");
|
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-26 13:17:39 +00:00
|
|
|
// NOTE: 1 tick == i millisecond
|
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-26 13:17:39 +00:00
|
|
|
unsigned int cur = 0;
|
|
|
|
for (std::list<Animator>::iterator it = root->animators.begin();
|
|
|
|
it != root->animators.end(); ++it)
|
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-26 13:17:39 +00:00
|
|
|
if ((*it).type == Animator::UNKNOWN || (*it).type == Animator::OTHER)continue;
|
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-26 13:17:39 +00:00
|
|
|
Animator& in = *it ;
|
|
|
|
aiNodeAnim* anim = new aiNodeAnim();
|
|
|
|
|
2009-03-15 00:40:30 +00:00
|
|
|
if (cur != total-1) {
|
2008-11-26 13:17:39 +00:00
|
|
|
// Build a new name - a prefix instead of a suffix because it is
|
|
|
|
// easier to check against
|
|
|
|
anim->mNodeName.length = ::sprintf(anim->mNodeName.data,
|
|
|
|
"$INST_DUMMY_%i_%s",total-1,
|
|
|
|
(root->name.length() ? root->name.c_str() : ""));
|
|
|
|
|
|
|
|
// we'll also need to insert a dummy in the node hierarchy.
|
|
|
|
aiNode* dummy = new aiNode();
|
|
|
|
|
|
|
|
for (unsigned int i = 0; i < real->mParent->mNumChildren;++i)
|
|
|
|
if (real->mParent->mChildren[i] == real)
|
|
|
|
real->mParent->mChildren[i] = dummy;
|
|
|
|
|
|
|
|
dummy->mParent = real->mParent;
|
|
|
|
dummy->mName = anim->mNodeName;
|
|
|
|
|
|
|
|
dummy->mNumChildren = 1;
|
|
|
|
dummy->mChildren = new aiNode*[dummy->mNumChildren];
|
|
|
|
dummy->mChildren[0] = real;
|
|
|
|
|
|
|
|
// the transformation matrix of the dummy node is the identity
|
|
|
|
|
|
|
|
real->mParent = dummy;
|
|
|
|
}
|
|
|
|
else anim->mNodeName.Set(root->name);
|
|
|
|
++cur;
|
|
|
|
|
2009-03-15 00:40:30 +00:00
|
|
|
switch (in.type) {
|
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
|
|
|
case Animator::ROTATION:
|
|
|
|
{
|
|
|
|
// -----------------------------------------------------
|
|
|
|
// find out how long a full rotation will take
|
|
|
|
// This is the least common multiple of 360.f and all
|
|
|
|
// three euler angles. Although we'll surely find a
|
|
|
|
// possible multiple (haha) it could be somewhat large
|
|
|
|
// for our purposes. So we need to modify the angles
|
|
|
|
// here in order to get good results.
|
|
|
|
// -----------------------------------------------------
|
|
|
|
int angles[3];
|
2008-11-26 13:17:39 +00:00
|
|
|
angles[0] = (int)(in.direction.x*100);
|
|
|
|
angles[1] = (int)(in.direction.y*100);
|
|
|
|
angles[2] = (int)(in.direction.z*100);
|
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
|
|
|
|
|
|
|
angles[0] %= 360;
|
|
|
|
angles[1] %= 360;
|
|
|
|
angles[2] %= 360;
|
|
|
|
|
2008-11-26 13:17:39 +00:00
|
|
|
if ((angles[0]*angles[1]) && (angles[1]*angles[2]))
|
|
|
|
{
|
|
|
|
FindSuitableMultiple(angles[0]);
|
|
|
|
FindSuitableMultiple(angles[1]);
|
|
|
|
FindSuitableMultiple(angles[2]);
|
|
|
|
}
|
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
|
|
|
|
|
|
|
int lcm = 360;
|
|
|
|
|
|
|
|
if (angles[0])
|
|
|
|
lcm = boost::math::lcm(lcm,angles[0]);
|
|
|
|
|
|
|
|
if (angles[1])
|
|
|
|
lcm = boost::math::lcm(lcm,angles[1]);
|
|
|
|
|
|
|
|
if (angles[2])
|
|
|
|
lcm = boost::math::lcm(lcm,angles[2]);
|
|
|
|
|
|
|
|
if (360 == lcm)
|
|
|
|
break;
|
|
|
|
|
2009-03-06 12:37:08 +00:00
|
|
|
#if 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
|
|
|
// This can be a division through zero, but we don't care
|
|
|
|
float f1 = (float)lcm / angles[0];
|
|
|
|
float f2 = (float)lcm / angles[1];
|
|
|
|
float f3 = (float)lcm / angles[2];
|
2009-03-06 12:37:08 +00:00
|
|
|
#endif
|
|
|
|
|
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
|
|
|
// find out how many time units we'll need for the finest
|
|
|
|
// track (in seconds) - this defines the number of output
|
|
|
|
// keys (fps * seconds)
|
2010-02-06 23:52:41 +00:00
|
|
|
float max = 0.f;
|
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 (angles[0])
|
|
|
|
max = (float)lcm / angles[0];
|
|
|
|
if (angles[1])
|
|
|
|
max = std::max(max, (float)lcm / angles[1]);
|
|
|
|
if (angles[2])
|
|
|
|
max = std::max(max, (float)lcm / angles[2]);
|
|
|
|
|
2008-11-26 13:17:39 +00:00
|
|
|
anim->mNumRotationKeys = (unsigned int)(max*fps);
|
|
|
|
anim->mRotationKeys = new aiQuatKey[anim->mNumRotationKeys];
|
|
|
|
|
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
|
|
|
// begin with a zero angle
|
|
|
|
aiVector3D angle;
|
2008-11-26 13:17:39 +00:00
|
|
|
for (unsigned int i = 0; i < anim->mNumRotationKeys;++i)
|
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-26 13:17:39 +00:00
|
|
|
// build the quaternion for the given euler angles
|
|
|
|
aiQuatKey& q = anim->mRotationKeys[i];
|
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-26 13:17:39 +00:00
|
|
|
q.mValue = aiQuaternion(angle.x, angle.y, angle.z);
|
|
|
|
q.mTime = (double)i;
|
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
|
|
|
|
|
|
|
// increase the angle
|
2008-11-26 13:17:39 +00:00
|
|
|
angle += in.direction;
|
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
|
|
|
}
|
|
|
|
|
|
|
|
// This animation is repeated and repeated ...
|
2009-03-06 12:37:08 +00:00
|
|
|
anim->mPostState = anim->mPreState = aiAnimBehaviour_REPEAT;
|
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
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case Animator::FLY_CIRCLE:
|
|
|
|
{
|
2008-11-26 13:17:39 +00:00
|
|
|
// -----------------------------------------------------
|
|
|
|
// Find out how much time we'll need to perform a
|
|
|
|
// full circle.
|
|
|
|
// -----------------------------------------------------
|
|
|
|
const double seconds = (1. / in.speed) / 1000.;
|
|
|
|
const double tdelta = 1000. / fps;
|
|
|
|
|
|
|
|
anim->mNumPositionKeys = (unsigned int) (fps * seconds);
|
|
|
|
anim->mPositionKeys = new aiVectorKey[anim->mNumPositionKeys];
|
|
|
|
|
|
|
|
// from Irrlicht, what else should we do than copying it?
|
|
|
|
aiVector3D vecU,vecV;
|
2009-03-15 00:40:30 +00:00
|
|
|
if (in.direction.y) {
|
2008-11-26 13:17:39 +00:00
|
|
|
vecV = aiVector3D(50,0,0) ^ in.direction;
|
|
|
|
}
|
|
|
|
else vecV = aiVector3D(0,50,00) ^ in.direction;
|
|
|
|
vecV.Normalize();
|
|
|
|
vecU = (vecV ^ in.direction).Normalize();
|
|
|
|
|
|
|
|
// build the output keys
|
2009-03-15 00:40:30 +00:00
|
|
|
for (unsigned int i = 0; i < anim->mNumPositionKeys;++i) {
|
2008-11-26 13:17:39 +00:00
|
|
|
aiVectorKey& key = anim->mPositionKeys[i];
|
|
|
|
key.mTime = i * tdelta;
|
|
|
|
|
|
|
|
const float t = (float) ( in.speed * key.mTime );
|
|
|
|
key.mValue = in.circleCenter + in.circleRadius * ((vecU*::cos(t)) + (vecV*::sin(t)));
|
|
|
|
}
|
2009-03-06 12:37:08 +00:00
|
|
|
|
|
|
|
// This animation is repeated and repeated ...
|
|
|
|
anim->mPostState = anim->mPreState = aiAnimBehaviour_REPEAT;
|
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
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case Animator::FLY_STRAIGHT:
|
|
|
|
{
|
2009-03-06 12:37:08 +00:00
|
|
|
anim->mPostState = anim->mPreState = (in.loop ? aiAnimBehaviour_REPEAT : aiAnimBehaviour_CONSTANT);
|
2008-11-26 13:17:39 +00:00
|
|
|
const double seconds = in.timeForWay / 1000.;
|
|
|
|
const double tdelta = 1000. / fps;
|
|
|
|
|
|
|
|
anim->mNumPositionKeys = (unsigned int) (fps * seconds);
|
|
|
|
anim->mPositionKeys = new aiVectorKey[anim->mNumPositionKeys];
|
|
|
|
|
|
|
|
aiVector3D diff = in.direction - in.circleCenter;
|
|
|
|
const float lengthOfWay = diff.Length();
|
|
|
|
diff.Normalize();
|
|
|
|
|
|
|
|
const double timeFactor = lengthOfWay / in.timeForWay;
|
|
|
|
|
|
|
|
// build the output keys
|
2009-03-15 00:40:30 +00:00
|
|
|
for (unsigned int i = 0; i < anim->mNumPositionKeys;++i) {
|
2008-11-26 13:17:39 +00:00
|
|
|
aiVectorKey& key = anim->mPositionKeys[i];
|
|
|
|
key.mTime = i * tdelta;
|
|
|
|
key.mValue = in.circleCenter + diff * float(timeFactor * key.mTime);
|
|
|
|
}
|
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
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case Animator::FOLLOW_SPLINE:
|
|
|
|
{
|
2009-03-06 12:37:08 +00:00
|
|
|
// repeat outside the defined time range
|
|
|
|
anim->mPostState = anim->mPreState = aiAnimBehaviour_REPEAT;
|
2008-11-26 13:17:39 +00:00
|
|
|
const int size = (int)in.splineKeys.size();
|
2009-03-15 00:40:30 +00:00
|
|
|
if (!size) {
|
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
|
|
|
// We have no point in the spline. That's bad. Really bad.
|
|
|
|
DefaultLogger::get()->warn("IRR: Spline animators with no points defined");
|
2008-11-26 13:17:39 +00:00
|
|
|
|
|
|
|
delete anim;anim = NULL;
|
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
|
|
|
break;
|
|
|
|
}
|
2009-03-15 00:40:30 +00:00
|
|
|
else if (size == 1) {
|
2008-11-26 13:17:39 +00:00
|
|
|
// We have just one point in the spline so we don't need the full calculation
|
|
|
|
anim->mNumPositionKeys = 1;
|
|
|
|
anim->mPositionKeys = new aiVectorKey[anim->mNumPositionKeys];
|
|
|
|
|
|
|
|
anim->mPositionKeys[0].mValue = in.splineKeys[0].mValue;
|
|
|
|
anim->mPositionKeys[0].mTime = 0.f;
|
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
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
unsigned int ticksPerFull = 15;
|
2008-11-26 13:17:39 +00:00
|
|
|
anim->mNumPositionKeys = (unsigned int) ( ticksPerFull * fps );
|
|
|
|
anim->mPositionKeys = new aiVectorKey[anim->mNumPositionKeys];
|
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-26 13:17:39 +00:00
|
|
|
for (unsigned int i = 0; i < anim->mNumPositionKeys;++i)
|
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-26 13:17:39 +00:00
|
|
|
aiVectorKey& key = anim->mPositionKeys[i];
|
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-26 13:17:39 +00:00
|
|
|
const float dt = (i * in.speed * 0.001f );
|
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
|
|
|
const float u = dt - floor(dt);
|
|
|
|
const int idx = (int)floor(dt) % size;
|
|
|
|
|
|
|
|
// get the 4 current points to evaluate the spline
|
2008-11-26 13:17:39 +00:00
|
|
|
const aiVector3D& p0 = in.splineKeys[ ClampSpline( idx - 1, size ) ].mValue;
|
|
|
|
const aiVector3D& p1 = in.splineKeys[ ClampSpline( idx + 0, size ) ].mValue;
|
|
|
|
const aiVector3D& p2 = in.splineKeys[ ClampSpline( idx + 1, size ) ].mValue;
|
|
|
|
const aiVector3D& p3 = in.splineKeys[ ClampSpline( idx + 2, size ) ].mValue;
|
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
|
|
|
|
|
|
|
// compute polynomials
|
|
|
|
const float u2 = u*u;
|
|
|
|
const float u3 = u2*2;
|
|
|
|
|
|
|
|
const float h1 = 2.0f * u3 - 3.0f * u2 + 1.0f;
|
|
|
|
const float h2 = -2.0f * u3 + 3.0f * u3;
|
|
|
|
const float h3 = u3 - 2.0f * u3;
|
|
|
|
const float h4 = u3 - u2;
|
|
|
|
|
|
|
|
// compute the spline tangents
|
2008-11-26 13:17:39 +00:00
|
|
|
const aiVector3D t1 = ( p2 - p0 ) * in.tightness;
|
|
|
|
aiVector3D t2 = ( p3 - p1 ) * in.tightness;
|
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
|
|
|
|
|
|
|
// and use them to get the interpolated point
|
|
|
|
t2 = (h1 * p1 + p2 * h2 + t1 * h3 + h4 * t2);
|
|
|
|
|
|
|
|
// build a simple translation matrix from it
|
2008-11-26 13:17:39 +00:00
|
|
|
key.mValue = t2.x;
|
|
|
|
key.mTime = (double) i;
|
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
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2010-02-06 23:52:41 +00:00
|
|
|
default:
|
|
|
|
// UNKNOWN , OTHER
|
|
|
|
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
|
|
|
};
|
2009-03-15 00:40:30 +00:00
|
|
|
if (anim) {
|
2008-11-26 13:17:39 +00:00
|
|
|
anims.push_back(anim);
|
|
|
|
++total;
|
|
|
|
}
|
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-26 13:17:39 +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
|
|
|
|
2008-11-26 13:17:39 +00:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
// This function is maybe more generic than we'd need it here
|
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
|
|
|
void SetupMapping (MaterialHelper* mat, aiTextureMapping mode, const aiVector3D& axis = aiVector3D(0.f,0.f,-1.f))
|
2008-11-26 13:17:39 +00:00
|
|
|
{
|
|
|
|
// Check whether there are texture properties defined - setup
|
|
|
|
// the desired texture mapping mode for all of them and ignore
|
|
|
|
// all UV settings we might encounter. WE HAVE NO UVS!
|
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-26 13:17:39 +00:00
|
|
|
std::vector<aiMaterialProperty*> p;
|
|
|
|
p.reserve(mat->mNumProperties+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
|
|
|
|
2008-11-26 13:17:39 +00:00
|
|
|
for (unsigned int i = 0; i < mat->mNumProperties;++i)
|
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-26 13:17:39 +00:00
|
|
|
aiMaterialProperty* prop = mat->mProperties[i];
|
2009-03-15 00:40:30 +00:00
|
|
|
if (!::strcmp( prop->mKey.data, "$tex.file")) {
|
2008-11-26 13:17:39 +00:00
|
|
|
// Setup the mapping key
|
|
|
|
aiMaterialProperty* m = new aiMaterialProperty();
|
|
|
|
m->mKey.Set("$tex.mapping");
|
|
|
|
m->mIndex = prop->mIndex;
|
|
|
|
m->mSemantic = prop->mSemantic;
|
|
|
|
m->mType = aiPTI_Integer;
|
|
|
|
|
|
|
|
m->mDataLength = 4;
|
|
|
|
m->mData = new char[4];
|
|
|
|
*((int*)m->mData) = mode;
|
|
|
|
|
|
|
|
p.push_back(prop);
|
|
|
|
p.push_back(m);
|
|
|
|
|
|
|
|
// Setup the mapping axis
|
2009-03-15 00:40:30 +00:00
|
|
|
if (mode == aiTextureMapping_CYLINDER || mode == aiTextureMapping_PLANE || mode == aiTextureMapping_SPHERE) {
|
2008-11-26 13:17:39 +00:00
|
|
|
m = new aiMaterialProperty();
|
|
|
|
m->mKey.Set("$tex.mapaxis");
|
|
|
|
m->mIndex = prop->mIndex;
|
|
|
|
m->mSemantic = prop->mSemantic;
|
2009-02-11 20:56:05 +00:00
|
|
|
m->mType = aiPTI_Float;
|
2008-11-26 13:17:39 +00:00
|
|
|
|
2009-02-11 20:56:05 +00:00
|
|
|
m->mDataLength = 12;
|
|
|
|
m->mData = new char[12];
|
|
|
|
*((aiVector3D*)m->mData) = axis;
|
2008-11-26 13:17:39 +00:00
|
|
|
p.push_back(m);
|
|
|
|
}
|
|
|
|
}
|
2009-02-11 20:56:05 +00:00
|
|
|
else if (! ::strcmp( prop->mKey.data, "$tex.uvwsrc")) {
|
2008-11-26 13:17:39 +00:00
|
|
|
delete mat->mProperties[i];
|
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-26 13:17:39 +00:00
|
|
|
else p.push_back(prop);
|
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-26 13:17:39 +00:00
|
|
|
if (p.empty())return;
|
|
|
|
|
|
|
|
// rebuild the output array
|
2009-02-11 20:56:05 +00:00
|
|
|
if (p.size() > mat->mNumAllocated) {
|
2008-11-26 13:17:39 +00:00
|
|
|
delete[] mat->mProperties;
|
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
|
|
|
mat->mProperties = new aiMaterialProperty*[p.size()*2];
|
|
|
|
|
|
|
|
mat->mNumAllocated = p.size()*2;
|
2008-11-26 13:17:39 +00:00
|
|
|
}
|
|
|
|
mat->mNumProperties = (unsigned int)p.size();
|
|
|
|
::memcpy(mat->mProperties,&p[0],sizeof(void*)*mat->mNumProperties);
|
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-02 22:30:37 +00:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
void IRRImporter::GenerateGraph(Node* root,aiNode* rootOut ,aiScene* scene,
|
|
|
|
BatchLoader& batch,
|
|
|
|
std::vector<aiMesh*>& meshes,
|
|
|
|
std::vector<aiNodeAnim*>& anims,
|
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
|
|
|
std::vector<AttachmentInfo>& attach,
|
2008-11-26 13:17:39 +00:00
|
|
|
std::vector<aiMaterial*>& materials,
|
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
|
|
|
unsigned int& defMatIdx)
|
2008-11-02 22:30:37 +00:00
|
|
|
{
|
|
|
|
unsigned int oldMeshSize = (unsigned int)meshes.size();
|
2009-03-06 12:37:08 +00:00
|
|
|
//unsigned int meshTrafoAssign = 0;
|
2008-11-02 22:30:37 +00:00
|
|
|
|
|
|
|
// Now determine the type of the node
|
|
|
|
switch (root->type)
|
|
|
|
{
|
|
|
|
case Node::ANIMMESH:
|
|
|
|
case Node::MESH:
|
|
|
|
{
|
2008-11-26 13:17:39 +00:00
|
|
|
if (!root->meshPath.length())
|
|
|
|
break;
|
|
|
|
|
|
|
|
// Get the loaded mesh from the scene and add it to
|
2008-11-02 22:30:37 +00:00
|
|
|
// the list of all scenes to be attached to the
|
|
|
|
// graph we're currently building
|
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
|
|
|
aiScene* scene = batch.GetImport(root->id);
|
2009-03-15 00:40:30 +00:00
|
|
|
if (!scene) {
|
|
|
|
DefaultLogger::get()->error("IRR: Unable to load external file: " + root->meshPath);
|
2008-11-02 22:30:37 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
attach.push_back(AttachmentInfo(scene,rootOut));
|
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
|
|
|
|
2008-11-26 13:17:39 +00:00
|
|
|
// Now combine the material we've loaded for this mesh
|
|
|
|
// with the real materials we got from the file. As we
|
2008-11-04 20:41:11 +00:00
|
|
|
// don't execute any pp-steps on the file, the numbers
|
|
|
|
// should be equal. If they are not, we can impossibly
|
|
|
|
// do this ...
|
2009-03-15 00:40:30 +00:00
|
|
|
if (root->materials.size() != (unsigned int)scene->mNumMaterials) {
|
2008-11-04 20:41:11 +00:00
|
|
|
DefaultLogger::get()->warn("IRR: Failed to match imported materials "
|
|
|
|
"with the materials found in the IRR scene file");
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
2009-03-15 00:40:30 +00:00
|
|
|
for (unsigned int i = 0; i < scene->mNumMaterials;++i) {
|
2008-11-26 13:17:39 +00:00
|
|
|
// Delete the old material, we don't need it anymore
|
2008-11-04 20:41:11 +00:00
|
|
|
delete scene->mMaterials[i];
|
|
|
|
|
|
|
|
std::pair<aiMaterial*, unsigned int>& src = root->materials[i];
|
|
|
|
scene->mMaterials[i] = src.first;
|
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
|
|
|
}
|
|
|
|
|
|
|
|
// NOTE: Each mesh should have exactly one material assigned,
|
|
|
|
// but we do it in a separate loop if this behaviour changes
|
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
|
|
|
// in future.
|
2009-03-15 00:40:30 +00:00
|
|
|
for (unsigned int i = 0; i < scene->mNumMeshes;++i) {
|
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
|
|
|
// Process material flags
|
|
|
|
aiMesh* mesh = scene->mMeshes[i];
|
|
|
|
|
|
|
|
|
|
|
|
// If "trans_vertex_alpha" mode is enabled, search all vertex colors
|
|
|
|
// and check whether they have a common alpha value. This is quite
|
|
|
|
// often the case so we can simply extract it to a shared oacity
|
|
|
|
// value.
|
2009-03-15 00:40:30 +00:00
|
|
|
std::pair<aiMaterial*, unsigned int>& src = root->materials[mesh->mMaterialIndex];
|
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
|
|
|
MaterialHelper* mat = (MaterialHelper*)src.first;
|
2009-03-15 00:40:30 +00:00
|
|
|
|
2008-11-26 13:17:39 +00:00
|
|
|
if (mesh->HasVertexColors(0) && src.second & AI_IRRMESH_MAT_trans_vertex_alpha)
|
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 bdo = true;
|
2009-03-15 00:40:30 +00:00
|
|
|
for (unsigned int a = 1; a < mesh->mNumVertices;++a) {
|
|
|
|
|
|
|
|
if (mesh->mColors[0][a].a != mesh->mColors[0][a-1].a) {
|
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
|
|
|
bdo = false;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2009-03-15 00:40:30 +00:00
|
|
|
if (bdo) {
|
|
|
|
DefaultLogger::get()->info("IRR: Replacing mesh vertex alpha with common opacity");
|
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
|
|
|
|
|
|
|
for (unsigned int a = 0; a < mesh->mNumVertices;++a)
|
|
|
|
mesh->mColors[0][a].a = 1.f;
|
|
|
|
|
|
|
|
mat->AddProperty(& mesh->mColors[0][0].a, 1, AI_MATKEY_OPACITY);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// If we have a second texture coordinate set and a second texture
|
2008-11-26 13:17:39 +00:00
|
|
|
// (either lightmap, normalmap, 2layered material) we need to
|
|
|
|
// setup the correct UV index for it. The texture can either
|
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
|
|
|
// be diffuse (lightmap & 2layer) or a normal map (normal & parallax)
|
2009-03-15 00:40:30 +00:00
|
|
|
if (mesh->HasTextureCoords(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
|
|
|
int idx = 1;
|
2009-02-11 20:56:05 +00:00
|
|
|
if (src.second & (AI_IRRMESH_MAT_solid_2layer | AI_IRRMESH_MAT_lightmap)) {
|
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
|
|
|
mat->AddProperty(&idx,1,AI_MATKEY_UVWSRC_DIFFUSE(0));
|
|
|
|
}
|
2009-02-11 20:56:05 +00:00
|
|
|
else if (src.second & AI_IRRMESH_MAT_normalmap_solid) {
|
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
|
|
|
mat->AddProperty(&idx,1,AI_MATKEY_UVWSRC_NORMALS(0));
|
|
|
|
}
|
|
|
|
}
|
2008-11-04 20:41:11 +00:00
|
|
|
}
|
2008-11-02 22:30:37 +00:00
|
|
|
}
|
|
|
|
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-11-02 22:30:37 +00:00
|
|
|
case Node::LIGHT:
|
|
|
|
case Node::CAMERA:
|
|
|
|
|
|
|
|
// We're already finished with lights and cameras
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case Node::SPHERE:
|
|
|
|
{
|
2008-11-26 13:17:39 +00:00
|
|
|
// Generate the sphere model. Our input parameter to
|
2008-11-02 22:30:37 +00:00
|
|
|
// the sphere generation algorithm is the number of
|
|
|
|
// subdivisions of each triangle - but here we have
|
|
|
|
// the number of poylgons on a specific axis. Just
|
2008-11-26 13:17:39 +00:00
|
|
|
// use some hardcoded limits to approximate this ...
|
2008-11-02 22:30:37 +00:00
|
|
|
unsigned int mul = root->spherePolyCountX*root->spherePolyCountY;
|
|
|
|
if (mul < 100)mul = 2;
|
|
|
|
else if (mul < 300)mul = 3;
|
|
|
|
else mul = 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
|
|
|
meshes.push_back(StandardShapes::MakeMesh(mul,
|
|
|
|
&StandardShapes::MakeSphere));
|
2008-11-02 22:30:37 +00:00
|
|
|
|
|
|
|
// Adjust scaling
|
2008-11-26 13:17:39 +00:00
|
|
|
root->scaling *= root->sphereRadius/2;
|
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
|
|
|
|
|
|
|
// Copy one output material
|
|
|
|
CopyMaterial(materials, root->materials, defMatIdx, meshes.back());
|
2008-11-26 13:17:39 +00:00
|
|
|
|
|
|
|
// Now adjust this output material - if there is a first texture
|
|
|
|
// set, setup spherical UV mapping around the Y axis.
|
2009-02-11 20:56:05 +00:00
|
|
|
SetupMapping ( (MaterialHelper*) materials.back(), aiTextureMapping_SPHERE);
|
2008-11-02 22:30:37 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case Node::CUBE:
|
|
|
|
{
|
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
|
|
|
// Generate an unit cube first
|
|
|
|
meshes.push_back(StandardShapes::MakeMesh(
|
|
|
|
&StandardShapes::MakeHexahedron));
|
2008-11-02 22:30:37 +00:00
|
|
|
|
|
|
|
// Adjust scaling
|
|
|
|
root->scaling *= root->sphereRadius;
|
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
|
|
|
|
|
|
|
// Copy one output material
|
|
|
|
CopyMaterial(materials, root->materials, defMatIdx, meshes.back());
|
2008-11-26 13:17:39 +00:00
|
|
|
|
|
|
|
// Now adjust this output material - if there is a first texture
|
|
|
|
// set, setup cubic UV mapping
|
|
|
|
SetupMapping ( (MaterialHelper*) materials.back(), aiTextureMapping_BOX );
|
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
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case Node::SKYBOX:
|
|
|
|
{
|
|
|
|
// A skybox is defined by six materials
|
2009-03-15 00:40:30 +00:00
|
|
|
if (root->materials.size() < 6) {
|
|
|
|
DefaultLogger::get()->error("IRR: There should be six materials for a skybox");
|
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
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
// copy those materials and generate 6 meshes for our new skybox
|
|
|
|
materials.reserve(materials.size() + 6);
|
|
|
|
for (unsigned int i = 0; i < 6;++i)
|
|
|
|
materials.insert(materials.end(),root->materials[i].first);
|
|
|
|
|
|
|
|
BuildSkybox(meshes,materials);
|
|
|
|
|
|
|
|
// *************************************************************
|
|
|
|
// Skyboxes will require a different code path for rendering,
|
|
|
|
// so there must be a way for the user to add special support
|
|
|
|
// for IRR skyboxes. We add a 'IRR.SkyBox_' prefix to the node.
|
|
|
|
// *************************************************************
|
|
|
|
root->name = "IRR.SkyBox_" + root->name;
|
|
|
|
DefaultLogger::get()->info("IRR: Loading skybox, this will "
|
|
|
|
"require special handling to be displayed correctly");
|
2008-11-02 22:30:37 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case Node::TERRAIN:
|
|
|
|
{
|
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
|
|
|
// to support terrains, we'd need to have a texture decoder
|
|
|
|
DefaultLogger::get()->error("IRR: Unsupported node - TERRAIN");
|
2008-11-02 22:30:37 +00:00
|
|
|
}
|
|
|
|
break;
|
2010-02-06 23:52:41 +00:00
|
|
|
default:
|
|
|
|
// DUMMY
|
|
|
|
break;
|
2008-11-02 22:30:37 +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
|
|
|
// Check whether we added a mesh (or more than one ...). In this case
|
|
|
|
// we'll also need to attach it to the node
|
2009-03-15 00:40:30 +00:00
|
|
|
if (oldMeshSize != (unsigned int) meshes.size()) {
|
|
|
|
|
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
|
|
|
rootOut->mNumMeshes = (unsigned int)meshes.size() - oldMeshSize;
|
|
|
|
rootOut->mMeshes = new unsigned int[rootOut->mNumMeshes];
|
|
|
|
|
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
|
|
|
for (unsigned int a = 0; a < rootOut->mNumMeshes;++a) {
|
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
|
|
|
rootOut->mMeshes[a] = oldMeshSize+a;
|
|
|
|
}
|
2008-11-02 22:30:37 +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
|
|
|
// Setup the name of this node
|
|
|
|
rootOut->mName.Set(root->name);
|
|
|
|
|
2008-11-02 22:30:37 +00:00
|
|
|
// Now compute the final local transformation matrix of the
|
|
|
|
// node from the given translation, rotation and scaling values.
|
|
|
|
// (the rotation is given in Euler angles, XYZ order)
|
2009-03-15 00:40:30 +00:00
|
|
|
//std::swap((float&)root->rotation.z,(float&)root->rotation.y);
|
2008-11-28 23:02:27 +00:00
|
|
|
rootOut->mTransformation.FromEulerAnglesXYZ(AI_DEG_TO_RAD(root->rotation) );
|
2008-11-02 22:30:37 +00:00
|
|
|
|
|
|
|
// apply scaling
|
|
|
|
aiMatrix4x4& mat = rootOut->mTransformation;
|
|
|
|
mat.a1 *= root->scaling.x;
|
|
|
|
mat.b1 *= root->scaling.x;
|
|
|
|
mat.c1 *= root->scaling.x;
|
2009-03-15 00:40:30 +00:00
|
|
|
mat.a2 *= root->scaling.y;
|
|
|
|
mat.b2 *= root->scaling.y;
|
|
|
|
mat.c2 *= root->scaling.y;
|
|
|
|
mat.a3 *= root->scaling.z;
|
|
|
|
mat.b3 *= root->scaling.z;
|
|
|
|
mat.c3 *= root->scaling.z;
|
2008-11-02 22:30:37 +00:00
|
|
|
|
|
|
|
// apply translation
|
2008-11-26 13:17:39 +00:00
|
|
|
mat.a4 += root->position.x;
|
2009-03-15 00:40:30 +00:00
|
|
|
mat.b4 += root->position.y;
|
|
|
|
mat.c4 += root->position.z;
|
2008-11-02 22:30:37 +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
|
|
|
// now compute animations for the node
|
2008-11-26 13:17:39 +00:00
|
|
|
ComputeAnimations(root,rootOut, anims);
|
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-02 22:30:37 +00:00
|
|
|
// Add all children recursively. First allocate enough storage
|
|
|
|
// for them, then call us again
|
|
|
|
rootOut->mNumChildren = (unsigned int)root->children.size();
|
2009-03-15 00:40:30 +00:00
|
|
|
if (rootOut->mNumChildren) {
|
|
|
|
|
2008-11-02 22:30:37 +00:00
|
|
|
rootOut->mChildren = new aiNode*[rootOut->mNumChildren];
|
2009-03-15 00:40:30 +00:00
|
|
|
for (unsigned int i = 0; i < rootOut->mNumChildren;++i) {
|
|
|
|
|
2008-11-02 22:30:37 +00:00
|
|
|
aiNode* node = rootOut->mChildren[i] = new aiNode();
|
|
|
|
node->mParent = rootOut;
|
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
|
|
|
GenerateGraph(root->children[i],node,scene,batch,meshes,
|
|
|
|
anims,attach,materials,defMatIdx);
|
2008-11-02 22:30:37 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-10-27 00:36:26 +00:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
// Imports the given file into the given scene structure.
|
|
|
|
void IRRImporter::InternReadFile( const std::string& pFile,
|
|
|
|
aiScene* pScene, IOSystem* pIOHandler)
|
|
|
|
{
|
|
|
|
boost::scoped_ptr<IOStream> file( pIOHandler->Open( pFile));
|
|
|
|
|
|
|
|
// 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 IRR file " + pFile + "");
|
2008-10-27 00:36:26 +00:00
|
|
|
|
|
|
|
// Construct the irrXML parser
|
|
|
|
CIrrXML_IOStreamReader st(file.get());
|
|
|
|
reader = createIrrXMLReader((IFileReadCallBack*) &st);
|
|
|
|
|
|
|
|
// The root node of the scene
|
|
|
|
Node* root = new Node(Node::DUMMY);
|
|
|
|
root->parent = NULL;
|
2008-11-26 13:17:39 +00:00
|
|
|
root->name = "<IRRSceneRoot>";
|
2008-10-27 00:36:26 +00:00
|
|
|
|
|
|
|
// Current node parent
|
|
|
|
Node* curParent = root;
|
|
|
|
|
|
|
|
// Scenegraph node we're currently working on
|
|
|
|
Node* curNode = NULL;
|
|
|
|
|
|
|
|
// List of output cameras
|
|
|
|
std::vector<aiCamera*> cameras;
|
|
|
|
|
|
|
|
// List of output lights
|
|
|
|
std::vector<aiLight*> lights;
|
|
|
|
|
2008-11-02 22:30:37 +00:00
|
|
|
// Batch loader used to load external models
|
2008-10-27 00:36:26 +00:00
|
|
|
BatchLoader batch(pIOHandler);
|
2009-04-10 21:59:22 +00:00
|
|
|
// batch.SetBasePath(pFile);
|
2008-10-27 00:36:26 +00:00
|
|
|
|
|
|
|
cameras.reserve(5);
|
|
|
|
lights.reserve(5);
|
|
|
|
|
2008-11-02 16:58:31 +00:00
|
|
|
bool inMaterials = false, inAnimator = 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
|
|
|
unsigned int guessedAnimCnt = 0, guessedMeshCnt = 0, guessedMatCnt = 0;
|
2008-10-27 00:36:26 +00:00
|
|
|
|
|
|
|
// Parse the XML file
|
2009-03-15 00:40:30 +00:00
|
|
|
while (reader->read()) {
|
|
|
|
switch (reader->getNodeType()) {
|
2008-10-27 00:36:26 +00:00
|
|
|
case EXN_ELEMENT:
|
|
|
|
|
2009-03-15 00:40:30 +00:00
|
|
|
if (!ASSIMP_stricmp(reader->getNodeName(),"node")) {
|
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-10-27 00:36:26 +00:00
|
|
|
/* What we're going to do with the node depends
|
|
|
|
* on its type:
|
|
|
|
*
|
|
|
|
* "mesh" - Load a mesh from an external file
|
|
|
|
* "cube" - Generate a cube
|
|
|
|
* "skybox" - Generate a skybox
|
|
|
|
* "light" - A light source
|
|
|
|
* "sphere" - Generate a sphere mesh
|
|
|
|
* "animatedMesh" - Load an animated mesh from an external file
|
|
|
|
* and join its animation channels with ours.
|
|
|
|
* "empty" - A dummy node
|
|
|
|
* "camera" - A camera
|
2008-11-26 13:17:39 +00:00
|
|
|
* "terrain" - a terrain node (data comes from a heightmap)
|
|
|
|
* "billboard", ""
|
2008-10-27 00:36:26 +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
|
|
|
* Each of these nodes can be animated and all can have multiple
|
|
|
|
* materials assigned (except lights, cameras and dummies, of course).
|
2008-10-27 00:36:26 +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
|
|
|
// ***********************************************************************
|
2008-10-27 00:36:26 +00:00
|
|
|
const char* sz = reader->getAttributeValueSafe("type");
|
|
|
|
Node* nd;
|
2009-03-15 00:40:30 +00:00
|
|
|
if (!ASSIMP_stricmp(sz,"mesh") || !ASSIMP_stricmp(sz,"octTree")) {
|
2008-11-26 13:17:39 +00:00
|
|
|
// OctTree's and meshes are treated equally
|
2008-10-27 00:36:26 +00:00
|
|
|
nd = new Node(Node::MESH);
|
|
|
|
}
|
2009-03-15 00:40:30 +00:00
|
|
|
else if (!ASSIMP_stricmp(sz,"cube")) {
|
2008-10-27 00:36:26 +00:00
|
|
|
nd = new Node(Node::CUBE);
|
2008-11-02 16:58:31 +00:00
|
|
|
++guessedMeshCnt;
|
|
|
|
// meshes.push_back(StandardShapes::MakeMesh(&StandardShapes::MakeHexahedron));
|
2008-10-27 00:36:26 +00:00
|
|
|
}
|
2009-03-15 00:40:30 +00:00
|
|
|
else if (!ASSIMP_stricmp(sz,"skybox")) {
|
2008-10-27 00:36:26 +00:00
|
|
|
nd = new Node(Node::SKYBOX);
|
2008-11-26 13:17:39 +00:00
|
|
|
guessedMeshCnt += 6;
|
2008-10-27 00:36:26 +00:00
|
|
|
}
|
2009-03-15 00:40:30 +00:00
|
|
|
else if (!ASSIMP_stricmp(sz,"camera")) {
|
2008-10-27 00:36:26 +00:00
|
|
|
nd = new Node(Node::CAMERA);
|
|
|
|
|
|
|
|
// Setup a temporary name for the camera
|
|
|
|
aiCamera* cam = new aiCamera();
|
|
|
|
cam->mName.Set( nd->name );
|
|
|
|
cameras.push_back(cam);
|
|
|
|
}
|
2009-03-15 00:40:30 +00:00
|
|
|
else if (!ASSIMP_stricmp(sz,"light")) {
|
2008-10-27 00:36:26 +00:00
|
|
|
nd = new Node(Node::LIGHT);
|
|
|
|
|
|
|
|
// Setup a temporary name for the light
|
|
|
|
aiLight* cam = new aiLight();
|
|
|
|
cam->mName.Set( nd->name );
|
|
|
|
lights.push_back(cam);
|
|
|
|
}
|
2009-03-15 00:40:30 +00:00
|
|
|
else if (!ASSIMP_stricmp(sz,"sphere")) {
|
2008-10-27 00:36:26 +00:00
|
|
|
nd = new Node(Node::SPHERE);
|
2008-11-02 16:58:31 +00:00
|
|
|
++guessedMeshCnt;
|
2008-10-27 00:36:26 +00:00
|
|
|
}
|
2009-03-15 00:40:30 +00:00
|
|
|
else if (!ASSIMP_stricmp(sz,"animatedMesh")) {
|
2008-10-27 00:36:26 +00:00
|
|
|
nd = new Node(Node::ANIMMESH);
|
|
|
|
}
|
2009-03-15 00:40:30 +00:00
|
|
|
else if (!ASSIMP_stricmp(sz,"empty")) {
|
2008-10-27 00:36:26 +00:00
|
|
|
nd = new Node(Node::DUMMY);
|
|
|
|
}
|
2009-03-15 00:40:30 +00:00
|
|
|
else if (!ASSIMP_stricmp(sz,"terrain")) {
|
2008-11-26 13:17:39 +00:00
|
|
|
nd = new Node(Node::TERRAIN);
|
|
|
|
}
|
2009-03-15 00:40:30 +00:00
|
|
|
else if (!ASSIMP_stricmp(sz,"billBoard")) {
|
2008-11-26 13:17:39 +00:00
|
|
|
// We don't support billboards, so ignore them
|
|
|
|
DefaultLogger::get()->error("IRR: Billboards are not supported by Assimp");
|
|
|
|
nd = new Node(Node::DUMMY);
|
|
|
|
}
|
2009-03-15 00:40:30 +00:00
|
|
|
else {
|
2008-10-27 00:36:26 +00:00
|
|
|
DefaultLogger::get()->warn("IRR: Found unknown node: " + std::string(sz));
|
|
|
|
|
|
|
|
/* We skip the contents of nodes we don't know.
|
|
|
|
* We parse the transformation and all animators
|
|
|
|
* and skip the rest.
|
|
|
|
*/
|
|
|
|
nd = new Node(Node::DUMMY);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Attach the newly created node to the scenegraph
|
|
|
|
*/
|
|
|
|
curNode = nd;
|
|
|
|
nd->parent = curParent;
|
|
|
|
curParent->children.push_back(nd);
|
|
|
|
}
|
2009-03-15 00:40:30 +00:00
|
|
|
else if (!ASSIMP_stricmp(reader->getNodeName(),"materials")) {
|
2008-10-27 00:36:26 +00:00
|
|
|
inMaterials = true;
|
|
|
|
}
|
2009-03-15 00:40:30 +00:00
|
|
|
else if (!ASSIMP_stricmp(reader->getNodeName(),"animators")) {
|
2008-11-02 16:58:31 +00:00
|
|
|
inAnimator = true;
|
|
|
|
}
|
2009-03-15 00:40:30 +00:00
|
|
|
else if (!ASSIMP_stricmp(reader->getNodeName(),"attributes")) {
|
2008-10-27 00:36:26 +00:00
|
|
|
/* We should have a valid node here
|
2008-11-26 13:17:39 +00:00
|
|
|
* FIX: no ... the scene root node is also contained in an attributes block
|
2008-10-27 00:36:26 +00:00
|
|
|
*/
|
2009-03-15 00:40:30 +00:00
|
|
|
if (!curNode) {
|
2008-11-26 13:17:39 +00:00
|
|
|
#if 0
|
2008-10-27 00:36:26 +00:00
|
|
|
DefaultLogger::get()->error("IRR: Encountered <attributes> element, but "
|
|
|
|
"there is no node active");
|
2008-11-26 13:17:39 +00:00
|
|
|
#endif
|
2008-10-27 00:36:26 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2008-11-02 16:58:31 +00:00
|
|
|
Animator* curAnim = NULL;
|
|
|
|
|
2008-11-26 13:17:39 +00:00
|
|
|
// Materials can occur for nearly any type of node
|
2009-03-15 00:40:30 +00:00
|
|
|
if (inMaterials && curNode->type != Node::DUMMY) {
|
2008-10-27 00:36:26 +00:00
|
|
|
/* This is a material description - parse it!
|
|
|
|
*/
|
|
|
|
curNode->materials.push_back(std::pair< aiMaterial*, unsigned int > () );
|
|
|
|
std::pair< aiMaterial*, unsigned int >& p = curNode->materials.back();
|
|
|
|
|
|
|
|
p.first = ParseMaterial(p.second);
|
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
|
|
|
|
|
|
|
++guessedMatCnt;
|
2008-10-27 00:36:26 +00:00
|
|
|
continue;
|
|
|
|
}
|
2009-03-15 00:40:30 +00:00
|
|
|
else if (inAnimator) {
|
2008-11-02 16:58:31 +00:00
|
|
|
/* This is an animation path - add a new animator
|
|
|
|
* to the list.
|
|
|
|
*/
|
|
|
|
curNode->animators.push_back(Animator());
|
|
|
|
curAnim = & curNode->animators.back();
|
|
|
|
|
|
|
|
++guessedAnimCnt;
|
|
|
|
}
|
2008-10-27 00:36:26 +00:00
|
|
|
|
|
|
|
/* Parse all elements in the attributes block
|
|
|
|
* and process them.
|
|
|
|
*/
|
2009-03-15 00:40:30 +00:00
|
|
|
while (reader->read()) {
|
|
|
|
if (reader->getNodeType() == EXN_ELEMENT) {
|
|
|
|
if (!ASSIMP_stricmp(reader->getNodeName(),"vector3d")) {
|
2008-10-27 00:36:26 +00:00
|
|
|
VectorProperty prop;
|
|
|
|
ReadVectorProperty(prop);
|
|
|
|
|
2009-03-15 00:40:30 +00:00
|
|
|
if (inAnimator) {
|
|
|
|
if (curAnim->type == Animator::ROTATION && prop.name == "Rotation") {
|
2008-11-02 16:58:31 +00:00
|
|
|
// We store the rotation euler angles in 'direction'
|
|
|
|
curAnim->direction = prop.value;
|
|
|
|
}
|
2009-03-15 00:40:30 +00:00
|
|
|
else if (curAnim->type == Animator::FOLLOW_SPLINE) {
|
2008-11-02 16:58:31 +00:00
|
|
|
// Check whether the vector follows the PointN naming scheme,
|
|
|
|
// here N is the ONE-based index of the point
|
2009-03-15 00:40:30 +00:00
|
|
|
if (prop.name.length() >= 6 && prop.name.substr(0,5) == "Point") {
|
2008-11-02 16:58:31 +00:00
|
|
|
// Add a new key to the list
|
|
|
|
curAnim->splineKeys.push_back(aiVectorKey());
|
|
|
|
aiVectorKey& key = curAnim->splineKeys.back();
|
|
|
|
|
|
|
|
// and parse its properties
|
|
|
|
key.mValue = prop.value;
|
2011-03-23 14:26:19 +00:00
|
|
|
key.mTime = strtoul10(&prop.name[5]);
|
2008-11-02 16:58:31 +00:00
|
|
|
}
|
|
|
|
}
|
2009-03-15 00:40:30 +00:00
|
|
|
else if (curAnim->type == Animator::FLY_CIRCLE) {
|
|
|
|
if (prop.name == "Center") {
|
2008-11-02 16:58:31 +00:00
|
|
|
curAnim->circleCenter = prop.value;
|
|
|
|
}
|
2009-03-15 00:40:30 +00:00
|
|
|
else if (prop.name == "Direction") {
|
2008-11-02 16:58:31 +00:00
|
|
|
curAnim->direction = prop.value;
|
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-15 00:40:30 +00:00
|
|
|
// From Irrlicht's source - a workaround for backward compatibility with Irrlicht 1.1
|
|
|
|
if (curAnim->direction == aiVector3D()) {
|
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
|
|
|
curAnim->direction = aiVector3D(0.f,1.f,0.f);
|
|
|
|
}
|
|
|
|
else curAnim->direction.Normalize();
|
2008-11-02 16:58:31 +00:00
|
|
|
}
|
|
|
|
}
|
2009-03-15 00:40:30 +00:00
|
|
|
else if (curAnim->type == Animator::FLY_STRAIGHT) {
|
|
|
|
if (prop.name == "Start") {
|
2008-11-02 16:58:31 +00:00
|
|
|
// We reuse the field here
|
|
|
|
curAnim->circleCenter = prop.value;
|
|
|
|
}
|
2009-03-15 00:40:30 +00:00
|
|
|
else if (prop.name == "End") {
|
2008-11-02 16:58:31 +00:00
|
|
|
// We reuse the field here
|
|
|
|
curAnim->direction = prop.value;
|
|
|
|
}
|
|
|
|
}
|
2008-10-27 00:36:26 +00:00
|
|
|
}
|
2009-03-15 00:40:30 +00:00
|
|
|
else {
|
|
|
|
if (prop.name == "Position") {
|
2008-11-02 16:58:31 +00:00
|
|
|
curNode->position = prop.value;
|
|
|
|
}
|
2009-03-15 00:40:30 +00:00
|
|
|
else if (prop.name == "Rotation") {
|
2008-11-02 16:58:31 +00:00
|
|
|
curNode->rotation = prop.value;
|
2008-10-27 00:36:26 +00:00
|
|
|
}
|
2009-03-15 00:40:30 +00:00
|
|
|
else if (prop.name == "Scale") {
|
2008-11-02 16:58:31 +00:00
|
|
|
curNode->scaling = prop.value;
|
2008-10-27 00:36:26 +00:00
|
|
|
}
|
2008-11-02 16:58:31 +00:00
|
|
|
else if (Node::CAMERA == curNode->type)
|
|
|
|
{
|
|
|
|
aiCamera* cam = cameras.back();
|
2009-03-15 00:40:30 +00:00
|
|
|
if (prop.name == "Target") {
|
2008-11-02 16:58:31 +00:00
|
|
|
cam->mLookAt = prop.value;
|
|
|
|
}
|
2009-03-15 00:40:30 +00:00
|
|
|
else if (prop.name == "UpVector") {
|
2008-11-02 16:58:31 +00:00
|
|
|
cam->mUp = prop.value;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2009-03-15 00:40:30 +00:00
|
|
|
else if (!ASSIMP_stricmp(reader->getNodeName(),"bool")) {
|
2008-11-02 16:58:31 +00:00
|
|
|
BoolProperty prop;
|
|
|
|
ReadBoolProperty(prop);
|
|
|
|
|
2009-03-15 00:40:30 +00:00
|
|
|
if (inAnimator && curAnim->type == Animator::FLY_CIRCLE && prop.name == "Loop") {
|
2008-11-02 16:58:31 +00:00
|
|
|
curAnim->loop = prop.value;
|
2008-10-27 00:36:26 +00:00
|
|
|
}
|
|
|
|
}
|
2009-03-15 00:40:30 +00:00
|
|
|
else if (!ASSIMP_stricmp(reader->getNodeName(),"float")) {
|
2008-10-27 00:36:26 +00:00
|
|
|
FloatProperty prop;
|
|
|
|
ReadFloatProperty(prop);
|
|
|
|
|
2009-03-15 00:40:30 +00:00
|
|
|
if (inAnimator) {
|
2008-11-02 16:58:31 +00:00
|
|
|
// The speed property exists for several animators
|
2009-03-15 00:40:30 +00:00
|
|
|
if (prop.name == "Speed") {
|
2008-11-02 16:58:31 +00:00
|
|
|
curAnim->speed = prop.value;
|
|
|
|
}
|
2009-03-15 00:40:30 +00:00
|
|
|
else if (curAnim->type == Animator::FLY_CIRCLE && prop.name == "Radius") {
|
2008-11-02 16:58:31 +00:00
|
|
|
curAnim->circleRadius = prop.value;
|
|
|
|
}
|
2009-03-15 00:40:30 +00:00
|
|
|
else if (curAnim->type == Animator::FOLLOW_SPLINE && prop.name == "Tightness") {
|
2008-11-02 22:30:37 +00:00
|
|
|
curAnim->tightness = prop.value;
|
|
|
|
}
|
2008-10-27 00:36:26 +00:00
|
|
|
}
|
2009-03-15 00:40:30 +00:00
|
|
|
else {
|
|
|
|
if (prop.name == "FramesPerSecond" && Node::ANIMMESH == curNode->type) {
|
2008-11-02 16:58:31 +00:00
|
|
|
curNode->framesPerSecond = prop.value;
|
2008-10-27 00:36:26 +00:00
|
|
|
}
|
2009-03-15 00:40:30 +00:00
|
|
|
else if (Node::CAMERA == curNode->type) {
|
2008-11-02 16:58:31 +00:00
|
|
|
/* This is the vertical, not the horizontal FOV.
|
|
|
|
* We need to compute the right FOV from the
|
|
|
|
* screen aspect which we don't know yet.
|
|
|
|
*/
|
2009-03-15 00:40:30 +00:00
|
|
|
if (prop.name == "Fovy") {
|
2008-11-02 16:58:31 +00:00
|
|
|
cameras.back()->mHorizontalFOV = prop.value;
|
|
|
|
}
|
2009-03-15 00:40:30 +00:00
|
|
|
else if (prop.name == "Aspect") {
|
2008-11-02 16:58:31 +00:00
|
|
|
cameras.back()->mAspect = prop.value;
|
|
|
|
}
|
2009-03-15 00:40:30 +00:00
|
|
|
else if (prop.name == "ZNear") {
|
2008-11-02 16:58:31 +00:00
|
|
|
cameras.back()->mClipPlaneNear = prop.value;
|
|
|
|
}
|
2009-03-15 00:40:30 +00:00
|
|
|
else if (prop.name == "ZFar") {
|
2008-11-02 16:58:31 +00:00
|
|
|
cameras.back()->mClipPlaneFar = prop.value;
|
|
|
|
}
|
|
|
|
}
|
2009-03-15 00:40:30 +00:00
|
|
|
else if (Node::LIGHT == curNode->type) {
|
2008-11-02 16:58:31 +00:00
|
|
|
/* Additional light information
|
2008-11-26 13:17:39 +00:00
|
|
|
*/
|
2009-03-15 00:40:30 +00:00
|
|
|
if (prop.name == "Attenuation") {
|
2008-11-02 16:58:31 +00:00
|
|
|
lights.back()->mAttenuationLinear = prop.value;
|
|
|
|
}
|
2009-03-15 00:40:30 +00:00
|
|
|
else if (prop.name == "OuterCone") {
|
2008-11-02 16:58:31 +00:00
|
|
|
lights.back()->mAngleOuterCone = AI_DEG_TO_RAD( prop.value );
|
|
|
|
}
|
2009-03-15 00:40:30 +00:00
|
|
|
else if (prop.name == "InnerCone") {
|
2008-11-02 16:58:31 +00:00
|
|
|
lights.back()->mAngleInnerCone = AI_DEG_TO_RAD( prop.value );
|
|
|
|
}
|
|
|
|
}
|
2008-11-02 22:30:37 +00:00
|
|
|
// radius of the sphere to be generated -
|
|
|
|
// or alternatively, size of the cube
|
2010-02-06 23:52:41 +00:00
|
|
|
else if ((Node::SPHERE == curNode->type && prop.name == "Radius")
|
|
|
|
|| (Node::CUBE == curNode->type && prop.name == "Size" )) {
|
2009-03-15 00:40:30 +00:00
|
|
|
|
|
|
|
curNode->sphereRadius = prop.value;
|
2008-10-27 00:36:26 +00:00
|
|
|
}
|
2008-11-02 16:58:31 +00:00
|
|
|
}
|
|
|
|
}
|
2009-03-15 00:40:30 +00:00
|
|
|
else if (!ASSIMP_stricmp(reader->getNodeName(),"int")) {
|
2008-11-02 16:58:31 +00:00
|
|
|
IntProperty prop;
|
|
|
|
ReadIntProperty(prop);
|
|
|
|
|
2009-03-15 00:40:30 +00:00
|
|
|
if (inAnimator) {
|
|
|
|
if (curAnim->type == Animator::FLY_STRAIGHT && prop.name == "TimeForWay") {
|
2008-11-02 16:58:31 +00:00
|
|
|
curAnim->timeForWay = prop.value;
|
2008-10-27 00:36:26 +00:00
|
|
|
}
|
2008-11-02 16:58:31 +00:00
|
|
|
}
|
2009-03-15 00:40:30 +00:00
|
|
|
else {
|
2008-11-02 16:58:31 +00:00
|
|
|
// sphere polgon numbers in each direction
|
2009-03-15 00:40:30 +00:00
|
|
|
if (Node::SPHERE == curNode->type) {
|
|
|
|
|
|
|
|
if (prop.name == "PolyCountX") {
|
2008-11-02 16:58:31 +00:00
|
|
|
curNode->spherePolyCountX = prop.value;
|
|
|
|
}
|
2009-03-15 00:40:30 +00:00
|
|
|
else if (prop.name == "PolyCountY") {
|
2008-11-02 16:58:31 +00:00
|
|
|
curNode->spherePolyCountY = prop.value;
|
|
|
|
}
|
2008-10-27 00:36:26 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2009-03-15 00:40:30 +00:00
|
|
|
else if (!ASSIMP_stricmp(reader->getNodeName(),"string") ||!ASSIMP_stricmp(reader->getNodeName(),"enum")) {
|
2008-10-27 00:36:26 +00:00
|
|
|
StringProperty prop;
|
|
|
|
ReadStringProperty(prop);
|
2009-03-15 00:40:30 +00:00
|
|
|
if (prop.value.length()) {
|
|
|
|
if (prop.name == "Name") {
|
2008-10-27 00:36:26 +00:00
|
|
|
curNode->name = prop.value;
|
|
|
|
|
|
|
|
/* If we're either a camera or a light source
|
|
|
|
* we need to update the name in the aiLight/
|
|
|
|
* aiCamera structure, too.
|
|
|
|
*/
|
2009-03-15 00:40:30 +00:00
|
|
|
if (Node::CAMERA == curNode->type) {
|
2008-10-27 00:36:26 +00:00
|
|
|
cameras.back()->mName.Set(prop.value);
|
|
|
|
}
|
2009-03-15 00:40:30 +00:00
|
|
|
else if (Node::LIGHT == curNode->type) {
|
2008-10-27 00:36:26 +00:00
|
|
|
lights.back()->mName.Set(prop.value);
|
|
|
|
}
|
|
|
|
}
|
2008-11-02 16:58:31 +00:00
|
|
|
else if (Node::LIGHT == curNode->type && "LightType" == prop.name)
|
|
|
|
{
|
2008-11-26 13:17:39 +00:00
|
|
|
if (prop.value == "Spot")
|
|
|
|
lights.back()->mType = aiLightSource_SPOT;
|
|
|
|
else if (prop.value == "Point")
|
|
|
|
lights.back()->mType = aiLightSource_POINT;
|
|
|
|
else if (prop.value == "Directional")
|
|
|
|
lights.back()->mType = aiLightSource_DIRECTIONAL;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// We won't pass the validation with aiLightSourceType_UNDEFINED,
|
|
|
|
// so we remove the light and replace it with a silly dummy node
|
|
|
|
delete lights.back();
|
|
|
|
lights.pop_back();
|
|
|
|
curNode->type = Node::DUMMY;
|
|
|
|
|
|
|
|
DefaultLogger::get()->error("Ignoring light of unknown type: " + prop.value);
|
|
|
|
}
|
2008-11-02 16:58:31 +00:00
|
|
|
}
|
2010-02-06 23:52:41 +00:00
|
|
|
else if ((prop.name == "Mesh" && Node::MESH == curNode->type) ||
|
2008-10-27 00:36:26 +00:00
|
|
|
Node::ANIMMESH == curNode->type)
|
|
|
|
{
|
|
|
|
/* This is the file name of the mesh - either
|
2008-11-02 16:58:31 +00:00
|
|
|
* animated or not. We need to make sure we setup
|
|
|
|
* the correct postprocessing settings here.
|
|
|
|
*/
|
|
|
|
unsigned int pp = 0;
|
|
|
|
BatchLoader::PropertyMap map;
|
|
|
|
|
2009-03-15 00:40:30 +00:00
|
|
|
/* If the mesh is a static one remove all animations from the impor data
|
2008-10-27 00:36:26 +00:00
|
|
|
*/
|
2009-03-15 00:40:30 +00:00
|
|
|
if (Node::ANIMMESH != curNode->type) {
|
2008-11-02 16:58:31 +00:00
|
|
|
pp |= aiProcess_RemoveComponent;
|
|
|
|
SetGenericProperty<int>(map.ints,AI_CONFIG_PP_RVC_FLAGS,
|
|
|
|
aiComponent_ANIMATIONS | aiComponent_BONEWEIGHTS);
|
|
|
|
}
|
|
|
|
|
2008-11-26 13:17:39 +00:00
|
|
|
/* TODO: maybe implement the protection against recursive
|
|
|
|
* loading calls directly in BatchLoader? The current
|
|
|
|
* implementation is not absolutely safe. A LWS and an IRR
|
|
|
|
* file referencing each other *could* cause the system to
|
|
|
|
* recurse forever.
|
|
|
|
*/
|
|
|
|
|
2009-03-15 00:40:30 +00:00
|
|
|
const std::string extension = GetExtension(prop.value);
|
|
|
|
if ("irr" == extension) {
|
|
|
|
DefaultLogger::get()->error("IRR: Can't load another IRR file recursively");
|
2008-11-26 13:17:39 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-03-15 00:40:30 +00:00
|
|
|
curNode->id = batch.AddLoadRequest(prop.value,pp,&map);
|
|
|
|
curNode->meshPath = prop.value;
|
2008-11-26 13:17:39 +00:00
|
|
|
}
|
2008-11-02 22:30:37 +00:00
|
|
|
}
|
|
|
|
else if (inAnimator && prop.name == "Type")
|
|
|
|
{
|
|
|
|
// type of the animator
|
2009-03-15 00:40:30 +00:00
|
|
|
if (prop.value == "rotation") {
|
2008-11-02 22:30:37 +00:00
|
|
|
curAnim->type = Animator::ROTATION;
|
|
|
|
}
|
2009-03-15 00:40:30 +00:00
|
|
|
else if (prop.value == "flyCircle") {
|
2008-11-02 22:30:37 +00:00
|
|
|
curAnim->type = Animator::FLY_CIRCLE;
|
|
|
|
}
|
2009-03-15 00:40:30 +00:00
|
|
|
else if (prop.value == "flyStraight") {
|
2008-11-02 22:30:37 +00:00
|
|
|
curAnim->type = Animator::FLY_CIRCLE;
|
|
|
|
}
|
2009-03-15 00:40:30 +00:00
|
|
|
else if (prop.value == "followSpline") {
|
2008-11-02 22:30:37 +00:00
|
|
|
curAnim->type = Animator::FOLLOW_SPLINE;
|
|
|
|
}
|
2009-03-15 00:40:30 +00:00
|
|
|
else {
|
2008-11-02 22:30:37 +00:00
|
|
|
DefaultLogger::get()->warn("IRR: Ignoring unknown animator: "
|
|
|
|
+ prop.value);
|
|
|
|
|
|
|
|
curAnim->type = Animator::UNKNOWN;
|
|
|
|
}
|
2008-10-27 00:36:26 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2009-03-15 00:40:30 +00:00
|
|
|
else if (reader->getNodeType() == EXN_ELEMENT_END && !ASSIMP_stricmp(reader->getNodeName(),"attributes")) {
|
2008-10-27 00:36:26 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case EXN_ELEMENT_END:
|
|
|
|
|
2008-11-02 16:58:31 +00:00
|
|
|
// If we reached the end of a node, we need to continue processing its parent
|
2009-03-15 00:40:30 +00:00
|
|
|
if (!ASSIMP_stricmp(reader->getNodeName(),"node")) {
|
|
|
|
if (!curNode) {
|
2008-10-27 00:36:26 +00:00
|
|
|
// currently is no node set. We need to go
|
|
|
|
// back in the node hierarchy
|
2009-03-15 00:40:30 +00:00
|
|
|
if (!curParent) {
|
2008-10-27 00:36:26 +00:00
|
|
|
curParent = root;
|
|
|
|
DefaultLogger::get()->error("IRR: Too many closing <node> elements");
|
|
|
|
}
|
2008-11-26 13:17:39 +00:00
|
|
|
else curParent = curParent->parent;
|
2008-10-27 00:36:26 +00:00
|
|
|
}
|
|
|
|
else curNode = NULL;
|
|
|
|
}
|
2008-11-02 16:58:31 +00:00
|
|
|
// clear all flags
|
2009-03-15 00:40:30 +00:00
|
|
|
else if (!ASSIMP_stricmp(reader->getNodeName(),"materials")) {
|
2008-10-27 00:36:26 +00:00
|
|
|
inMaterials = false;
|
|
|
|
}
|
2009-03-15 00:40:30 +00:00
|
|
|
else if (!ASSIMP_stricmp(reader->getNodeName(),"animators")) {
|
2008-11-02 16:58:31 +00:00
|
|
|
inAnimator = false;
|
|
|
|
}
|
2008-10-27 00:36:26 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
// GCC complains that not all enumeration values are handled
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Now iterate through all cameras and compute their final (horizontal) FOV
|
|
|
|
*/
|
2009-03-15 00:40:30 +00:00
|
|
|
for (std::vector<aiCamera*>::iterator it = cameras.begin(), end = cameras.end();it != end; ++it) {
|
2008-10-27 00:36:26 +00:00
|
|
|
aiCamera* cam = *it;
|
2009-03-15 00:40:30 +00:00
|
|
|
|
|
|
|
// screen aspect could be missing
|
|
|
|
if (cam->mAspect) {
|
2008-10-27 00:36:26 +00:00
|
|
|
cam->mHorizontalFOV *= cam->mAspect;
|
|
|
|
}
|
|
|
|
else DefaultLogger::get()->warn("IRR: Camera aspect is not given, can't compute horizontal FOV");
|
|
|
|
}
|
2008-11-02 16:58:31 +00:00
|
|
|
|
2008-11-26 13:17:39 +00:00
|
|
|
batch.LoadAll();
|
|
|
|
|
2008-11-02 16:58:31 +00:00
|
|
|
/* Allocate a tempoary scene data structure
|
|
|
|
*/
|
|
|
|
aiScene* tempScene = new aiScene();
|
|
|
|
tempScene->mRootNode = new aiNode();
|
|
|
|
tempScene->mRootNode->mName.Set("<IRRRoot>");
|
|
|
|
|
|
|
|
/* Copy the cameras to the output array
|
|
|
|
*/
|
2009-03-15 00:40:30 +00:00
|
|
|
if (!cameras.empty()) {
|
2008-11-26 13:17:39 +00:00
|
|
|
tempScene->mNumCameras = (unsigned int)cameras.size();
|
|
|
|
tempScene->mCameras = new aiCamera*[tempScene->mNumCameras];
|
|
|
|
::memcpy(tempScene->mCameras,&cameras[0],sizeof(void*)*tempScene->mNumCameras);
|
|
|
|
}
|
2008-11-02 16:58:31 +00:00
|
|
|
|
|
|
|
/* Copy the light sources to the output array
|
|
|
|
*/
|
2009-03-15 00:40:30 +00:00
|
|
|
if (!lights.empty()) {
|
2008-11-26 13:17:39 +00:00
|
|
|
tempScene->mNumLights = (unsigned int)lights.size();
|
|
|
|
tempScene->mLights = new aiLight*[tempScene->mNumLights];
|
|
|
|
::memcpy(tempScene->mLights,&lights[0],sizeof(void*)*tempScene->mNumLights);
|
|
|
|
}
|
2008-11-02 16:58:31 +00:00
|
|
|
|
|
|
|
// temporary data
|
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
|
|
|
std::vector< aiNodeAnim*> anims;
|
|
|
|
std::vector< aiMaterial*> materials;
|
|
|
|
std::vector< AttachmentInfo > attach;
|
|
|
|
std::vector<aiMesh*> meshes;
|
2008-11-02 16:58:31 +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
|
|
|
// try to guess how much storage we'll need
|
|
|
|
anims.reserve (guessedAnimCnt + (guessedAnimCnt >> 2));
|
|
|
|
meshes.reserve (guessedMeshCnt + (guessedMeshCnt >> 2));
|
|
|
|
materials.reserve (guessedMatCnt + (guessedMatCnt >> 2));
|
2008-11-02 16:58:31 +00:00
|
|
|
|
|
|
|
/* Now process our scenegraph recursively: generate final
|
|
|
|
* meshes and generate animation channels for all nodes.
|
|
|
|
*/
|
2011-04-22 21:29:18 +00:00
|
|
|
unsigned int defMatIdx = UINT_MAX;
|
2008-11-02 22:30:37 +00:00
|
|
|
GenerateGraph(root,tempScene->mRootNode, tempScene,
|
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
|
|
|
batch, meshes, anims, attach, materials, defMatIdx);
|
2008-11-02 16:58:31 +00:00
|
|
|
|
|
|
|
if (!anims.empty())
|
|
|
|
{
|
|
|
|
tempScene->mNumAnimations = 1;
|
|
|
|
tempScene->mAnimations = new aiAnimation*[tempScene->mNumAnimations];
|
|
|
|
aiAnimation* an = tempScene->mAnimations[0] = new aiAnimation();
|
|
|
|
|
|
|
|
// ***********************************************************
|
|
|
|
// This is only the global animation channel of the scene.
|
|
|
|
// If there are animated models, they will have separate
|
|
|
|
// animation channels in the scene. To display IRR scenes
|
|
|
|
// correctly, users will need to combine the global anim
|
|
|
|
// channel with all the local animations they want to play
|
|
|
|
// ***********************************************************
|
|
|
|
an->mName.Set("Irr_GlobalAnimChannel");
|
|
|
|
|
|
|
|
// copy all node animation channels to the global channel
|
|
|
|
an->mNumChannels = (unsigned int)anims.size();
|
|
|
|
an->mChannels = new aiNodeAnim*[an->mNumChannels];
|
|
|
|
::memcpy(an->mChannels, & anims [0], sizeof(void*)*an->mNumChannels);
|
|
|
|
}
|
2009-03-15 00:40:30 +00:00
|
|
|
if (!meshes.empty()) {
|
2008-11-02 22:30:37 +00:00
|
|
|
// copy all meshes to the temporary scene
|
|
|
|
tempScene->mNumMeshes = (unsigned int)meshes.size();
|
|
|
|
tempScene->mMeshes = new aiMesh*[tempScene->mNumMeshes];
|
2008-11-26 13:17:39 +00:00
|
|
|
::memcpy(tempScene->mMeshes,&meshes[0],tempScene->mNumMeshes*
|
|
|
|
sizeof(void*));
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Copy all materials to the output array
|
|
|
|
*/
|
2009-03-15 00:40:30 +00:00
|
|
|
if (!materials.empty()) {
|
2008-11-26 13:17:39 +00:00
|
|
|
tempScene->mNumMaterials = (unsigned int)materials.size();
|
|
|
|
tempScene->mMaterials = new aiMaterial*[tempScene->mNumMaterials];
|
|
|
|
::memcpy(tempScene->mMaterials,&materials[0],sizeof(void*)*
|
|
|
|
tempScene->mNumMaterials);
|
2008-11-02 22:30:37 +00:00
|
|
|
}
|
2008-11-02 16:58:31 +00:00
|
|
|
|
|
|
|
/* Now merge all sub scenes and attach them to the correct
|
|
|
|
* attachment points in the scenegraph.
|
|
|
|
*/
|
2008-11-26 13:17:39 +00:00
|
|
|
SceneCombiner::MergeScenes(&pScene,tempScene,attach,
|
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_INT_MERGE_SCENE_GEN_UNIQUE_NAMES | (!configSpeedFlag ? (
|
|
|
|
AI_INT_MERGE_SCENE_GEN_UNIQUE_NAMES_IF_NECESSARY | AI_INT_MERGE_SCENE_GEN_UNIQUE_MATNAMES) : 0));
|
2008-11-26 13:17:39 +00:00
|
|
|
|
|
|
|
|
|
|
|
/* If we have no meshes | no materials now set the INCOMPLETE
|
|
|
|
* scene flag. This is necessary if we failed to load all
|
|
|
|
* models from external files
|
|
|
|
*/
|
2009-03-15 00:40:30 +00:00
|
|
|
if (!pScene->mNumMeshes || !pScene->mNumMaterials) {
|
2008-11-26 13:17:39 +00:00
|
|
|
DefaultLogger::get()->warn("IRR: No meshes loaded, setting AI_SCENE_FLAGS_INCOMPLETE");
|
|
|
|
pScene->mFlags |= AI_SCENE_FLAGS_INCOMPLETE;
|
|
|
|
}
|
|
|
|
|
2008-11-02 22:30:37 +00:00
|
|
|
/* Finished ... everything destructs automatically and all
|
|
|
|
* temporary scenes have already been deleted by MergeScenes()
|
|
|
|
*/
|
2008-11-26 13:17:39 +00:00
|
|
|
return;
|
2008-10-27 00:36:26 +00:00
|
|
|
}
|