2008-08-13 15:45:57 +00:00
|
|
|
|
/*
|
|
|
|
|
---------------------------------------------------------------------------
|
2012-02-03 03:38:30 +00:00
|
|
|
|
Open Asset Import Library (assimp)
|
2008-08-13 15:45:57 +00:00
|
|
|
|
---------------------------------------------------------------------------
|
|
|
|
|
|
2012-02-03 03:38:30 +00:00
|
|
|
|
Copyright (c) 2006-2012, assimp team
|
2008-08-13 15:45:57 +00:00
|
|
|
|
|
|
|
|
|
All rights reserved.
|
|
|
|
|
|
|
|
|
|
Redistribution and use of this software in source and binary forms,
|
|
|
|
|
with or without modification, are permitted provided that the following
|
|
|
|
|
conditions are met:
|
|
|
|
|
|
|
|
|
|
* Redistributions of source code must retain the above
|
|
|
|
|
copyright notice, this list of conditions and the
|
|
|
|
|
following disclaimer.
|
|
|
|
|
|
|
|
|
|
* Redistributions in binary form must reproduce the above
|
|
|
|
|
copyright notice, this list of conditions and the
|
|
|
|
|
following disclaimer in the documentation and/or other
|
|
|
|
|
materials provided with the distribution.
|
|
|
|
|
|
2012-02-03 03:38:30 +00:00
|
|
|
|
* Neither the name of the assimp team, nor the names of its
|
2008-08-13 15:45:57 +00:00
|
|
|
|
contributors may be used to endorse or promote products
|
|
|
|
|
derived from this software without specific prior
|
2012-02-03 03:38:30 +00:00
|
|
|
|
written permission of the assimp team.
|
2008-08-13 15:45:57 +00:00
|
|
|
|
|
|
|
|
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
|
|
|
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
|
|
|
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
|
|
|
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
|
|
|
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
|
|
|
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
|
|
|
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
|
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
|
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
|
|
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
|
---------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/** @file Implementation of the material oart of the LWO importer class */
|
|
|
|
|
|
2008-10-13 16:45:48 +00:00
|
|
|
|
|
|
|
|
|
#include "AssimpPCH.h"
|
2009-01-18 23:48:25 +00:00
|
|
|
|
#ifndef ASSIMP_BUILD_NO_LWO_IMPORTER
|
2008-10-13 16:45:48 +00:00
|
|
|
|
|
2008-08-13 15:45:57 +00:00
|
|
|
|
// internal headers
|
|
|
|
|
#include "LWOLoader.h"
|
|
|
|
|
#include "ByteSwap.h"
|
|
|
|
|
|
|
|
|
|
using namespace Assimp;
|
|
|
|
|
|
2008-09-20 15:55:51 +00:00
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
|
template <class T>
|
|
|
|
|
T lerp(const T& one, const T& two, float val)
|
|
|
|
|
{
|
|
|
|
|
return one + (two-one)*val;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2008-11-16 21:56:45 +00:00
|
|
|
|
// Convert a lightwave mapping mode to our's
|
2008-09-20 15:55:51 +00:00
|
|
|
|
inline aiTextureMapMode GetMapMode(LWO::Texture::Wrap in)
|
|
|
|
|
{
|
|
|
|
|
switch (in)
|
|
|
|
|
{
|
|
|
|
|
case LWO::Texture::REPEAT:
|
|
|
|
|
return aiTextureMapMode_Wrap;
|
2008-11-16 21:56:45 +00:00
|
|
|
|
|
2008-09-20 15:55:51 +00:00
|
|
|
|
case LWO::Texture::MIRROR:
|
|
|
|
|
return aiTextureMapMode_Mirror;
|
2008-11-16 21:56:45 +00:00
|
|
|
|
|
2008-09-20 15:55:51 +00:00
|
|
|
|
case LWO::Texture::RESET:
|
|
|
|
|
DefaultLogger::get()->warn("LWO2: Unsupported texture map mode: RESET");
|
2008-11-16 21:56:45 +00:00
|
|
|
|
|
2008-10-31 19:32:00 +00:00
|
|
|
|
// fall though here
|
2008-09-20 15:55:51 +00:00
|
|
|
|
case LWO::Texture::EDGE:
|
|
|
|
|
return aiTextureMapMode_Clamp;
|
|
|
|
|
}
|
|
|
|
|
return (aiTextureMapMode)0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2011-08-22 20:22:51 +00:00
|
|
|
|
bool LWOImporter::HandleTextures(aiMaterial* pcMat, const TextureList& in, aiTextureType type)
|
2008-09-20 15:55:51 +00:00
|
|
|
|
{
|
2008-11-16 21:56:45 +00:00
|
|
|
|
ai_assert(NULL != pcMat);
|
2008-09-20 15:55:51 +00:00
|
|
|
|
|
|
|
|
|
unsigned int cur = 0, temp = 0;
|
|
|
|
|
aiString s;
|
|
|
|
|
bool ret = false;
|
|
|
|
|
|
2009-03-26 22:05:56 +00:00
|
|
|
|
for (TextureList::const_iterator it = in.begin(), end = in.end();it != end;++it) {
|
|
|
|
|
if (!(*it).enabled || !(*it).bCanUse)
|
|
|
|
|
continue;
|
2008-09-20 15:55:51 +00:00
|
|
|
|
ret = true;
|
|
|
|
|
|
2008-11-16 21:56:45 +00:00
|
|
|
|
// Convert lightwave's mapping modes to ours. We let them
|
|
|
|
|
// as they are, the GenUVcoords step will compute UV
|
|
|
|
|
// channels if they're not there.
|
|
|
|
|
|
|
|
|
|
aiTextureMapping mapping;
|
|
|
|
|
switch ((*it).mapMode)
|
|
|
|
|
{
|
|
|
|
|
case LWO::Texture::Planar:
|
|
|
|
|
mapping = aiTextureMapping_PLANE;
|
|
|
|
|
break;
|
|
|
|
|
case LWO::Texture::Cylindrical:
|
|
|
|
|
mapping = aiTextureMapping_CYLINDER;
|
|
|
|
|
break;
|
|
|
|
|
case LWO::Texture::Spherical:
|
|
|
|
|
mapping = aiTextureMapping_SPHERE;
|
|
|
|
|
break;
|
|
|
|
|
case LWO::Texture::Cubic:
|
|
|
|
|
mapping = aiTextureMapping_BOX;
|
|
|
|
|
break;
|
|
|
|
|
case LWO::Texture::FrontProjection:
|
|
|
|
|
DefaultLogger::get()->error("LWO2: Unsupported texture mapping: FrontProjection");
|
|
|
|
|
mapping = aiTextureMapping_OTHER;
|
|
|
|
|
break;
|
|
|
|
|
case LWO::Texture::UV:
|
|
|
|
|
{
|
2011-04-22 21:29:18 +00:00
|
|
|
|
if( UINT_MAX == (*it).mRealUVIndex ) {
|
2008-11-16 21:56:45 +00:00
|
|
|
|
// We have no UV index for this texture, so we can't display it
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// add the UV source index
|
|
|
|
|
temp = (*it).mRealUVIndex;
|
|
|
|
|
pcMat->AddProperty<int>((int*)&temp,1,AI_MATKEY_UVWSRC(type,cur));
|
|
|
|
|
|
|
|
|
|
mapping = aiTextureMapping_UV;
|
|
|
|
|
}
|
|
|
|
|
break;
|
2010-03-23 18:22:45 +00:00
|
|
|
|
default:
|
|
|
|
|
ai_assert(false);
|
2008-11-16 21:56:45 +00:00
|
|
|
|
};
|
|
|
|
|
|
2009-03-15 00:40:30 +00:00
|
|
|
|
if (mapping != aiTextureMapping_UV) {
|
2009-02-11 20:56:05 +00:00
|
|
|
|
// Setup the main axis
|
|
|
|
|
aiVector3D v;
|
2009-03-15 00:40:30 +00:00
|
|
|
|
switch ((*it).majorAxis) {
|
2009-02-11 20:56:05 +00:00
|
|
|
|
case Texture::AXIS_X:
|
|
|
|
|
v = aiVector3D(1.f,0.f,0.f);
|
|
|
|
|
break;
|
|
|
|
|
case Texture::AXIS_Y:
|
|
|
|
|
v = aiVector3D(0.f,1.f,0.f);
|
|
|
|
|
break;
|
|
|
|
|
default: // case Texture::AXIS_Z:
|
|
|
|
|
v = aiVector3D(0.f,0.f,1.f);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pcMat->AddProperty(&v,1,AI_MATKEY_TEXMAP_AXIS(type,cur));
|
2008-11-26 22:03:14 +00:00
|
|
|
|
|
|
|
|
|
// Setup UV scalings for cylindric and spherical projections
|
2009-03-15 00:40:30 +00:00
|
|
|
|
if (mapping == aiTextureMapping_CYLINDER || mapping == aiTextureMapping_SPHERE) {
|
2008-11-26 22:03:14 +00:00
|
|
|
|
aiUVTransform trafo;
|
|
|
|
|
trafo.mScaling.x = (*it).wrapAmountW;
|
|
|
|
|
trafo.mScaling.y = (*it).wrapAmountH;
|
2008-11-28 23:02:27 +00:00
|
|
|
|
|
2010-03-13 12:59:50 +00:00
|
|
|
|
BOOST_STATIC_ASSERT(sizeof(aiUVTransform)/sizeof(float) == 5);
|
2010-04-11 23:03:30 +00:00
|
|
|
|
pcMat->AddProperty(&trafo,1,AI_MATKEY_UVTRANSFORM(type,cur));
|
2008-11-26 22:03:14 +00:00
|
|
|
|
}
|
2008-11-16 21:56:45 +00:00
|
|
|
|
DefaultLogger::get()->debug("LWO2: Setting up non-UV mapping");
|
|
|
|
|
}
|
|
|
|
|
|
2008-09-20 15:55:51 +00:00
|
|
|
|
// The older LWOB format does not use indirect references to clips.
|
|
|
|
|
// The file name of a texture is directly specified in the tex chunk.
|
2009-03-26 22:05:56 +00:00
|
|
|
|
if (mIsLWO2) {
|
2013-09-18 12:27:56 +00:00
|
|
|
|
// find the corresponding clip (take the last one if multiple
|
|
|
|
|
// share the same index)
|
|
|
|
|
ClipList::iterator end = mClips.end(), candidate = end;
|
2008-09-20 15:55:51 +00:00
|
|
|
|
temp = (*it).mClipIdx;
|
2013-09-18 12:27:56 +00:00
|
|
|
|
for (ClipList::iterator clip = mClips.begin(); clip != end; ++clip) {
|
|
|
|
|
if ((*clip).idx == temp) {
|
|
|
|
|
candidate = clip;
|
|
|
|
|
}
|
2009-02-11 20:56:05 +00:00
|
|
|
|
|
2008-09-20 15:55:51 +00:00
|
|
|
|
}
|
2013-09-18 12:27:56 +00:00
|
|
|
|
if (candidate == end) {
|
2008-09-20 15:55:51 +00:00
|
|
|
|
DefaultLogger::get()->error("LWO2: Clip index is out of bounds");
|
|
|
|
|
temp = 0;
|
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
|
|
|
|
|
2013-09-18 12:27:56 +00:00
|
|
|
|
// fixme: apparently some LWO files shipping with Doom3 don't
|
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
|
|
|
|
// have clips at all ... check whether that's true or whether
|
|
|
|
|
// it's a bug in the loader.
|
|
|
|
|
|
|
|
|
|
s.Set("$texture.png");
|
|
|
|
|
|
|
|
|
|
//continue;
|
2008-09-20 15:55:51 +00:00
|
|
|
|
}
|
General
- Added format auto-detection to most loaders
- Simplified BaseImporter::CanRead() with some utility methods
- improved fast_atof -> no overruns anymore. Fuck you, irrlicht.
- added assimp_cmd tool to allow command line model processing. Mainly adebugging tool for internal purposes, but others might find it useful, too.
- vc8/vc9: revision number is now written to DLL version header
- mkutil: some batch scripts to simplify tagging & building of release versions
- some API cleanup
- fixing some doxygen markup (+now explicit use of @file <filename>)
- Icon for assimp_view and assimp_cmd
3DS
- Normal vectors are not anymore inverted in some cases
- Improved pivot handling
- Improved handling of x-flipped meshes
Collada
- fixed a minor bug (visual_scene element)
LWS
- WIP implementation. No animations yet, some bugs and crashes.
- Animation system remains disabled, WIP code
- many test files for LWS, but most of them test the anim support, which is, read above, currently disabled.
STL
- fixing a log warning which appears for every model
- added binary&ascii test spider, exported from truespace
MD3
- Cleaning up output tags for automatically joined player models.
IRR
- Fixing coordinate system issues.
- Instance handling improved.
- Some of the reported crashes not yet fixed.
PretransformVertices
- Numerous performance improvements.
- Added config option to preserve the hierarchy during the step.
RemoveRedundantMaterials
- Added config option to specify a list of materials which are kept in every case.
UNREAL
- Added support for the old unreal data format (*.a,*.d,*.uc)
- tested only with exports from Milkshape
- more Unreal stuff to come soon
git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@356 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
2009-03-05 22:32:13 +00:00
|
|
|
|
else {
|
2013-09-18 12:27:56 +00:00
|
|
|
|
if (Clip::UNSUPPORTED == (*candidate).type) {
|
General
- Added format auto-detection to most loaders
- Simplified BaseImporter::CanRead() with some utility methods
- improved fast_atof -> no overruns anymore. Fuck you, irrlicht.
- added assimp_cmd tool to allow command line model processing. Mainly adebugging tool for internal purposes, but others might find it useful, too.
- vc8/vc9: revision number is now written to DLL version header
- mkutil: some batch scripts to simplify tagging & building of release versions
- some API cleanup
- fixing some doxygen markup (+now explicit use of @file <filename>)
- Icon for assimp_view and assimp_cmd
3DS
- Normal vectors are not anymore inverted in some cases
- Improved pivot handling
- Improved handling of x-flipped meshes
Collada
- fixed a minor bug (visual_scene element)
LWS
- WIP implementation. No animations yet, some bugs and crashes.
- Animation system remains disabled, WIP code
- many test files for LWS, but most of them test the anim support, which is, read above, currently disabled.
STL
- fixing a log warning which appears for every model
- added binary&ascii test spider, exported from truespace
MD3
- Cleaning up output tags for automatically joined player models.
IRR
- Fixing coordinate system issues.
- Instance handling improved.
- Some of the reported crashes not yet fixed.
PretransformVertices
- Numerous performance improvements.
- Added config option to preserve the hierarchy during the step.
RemoveRedundantMaterials
- Added config option to specify a list of materials which are kept in every case.
UNREAL
- Added support for the old unreal data format (*.a,*.d,*.uc)
- tested only with exports from Milkshape
- more Unreal stuff to come soon
git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@356 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
2009-03-05 22:32:13 +00:00
|
|
|
|
DefaultLogger::get()->error("LWO2: Clip type is not supported");
|
|
|
|
|
continue;
|
|
|
|
|
}
|
2013-09-18 12:27:56 +00:00
|
|
|
|
AdjustTexturePath((*candidate).path);
|
|
|
|
|
s.Set((*candidate).path);
|
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
|
|
|
|
|
|
|
|
|
// Additional image settings
|
|
|
|
|
int flags = 0;
|
2013-09-18 12:27:56 +00:00
|
|
|
|
if ((*candidate).negate) {
|
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
|
|
|
|
flags |= aiTextureFlags_Invert;
|
|
|
|
|
}
|
|
|
|
|
pcMat->AddProperty(&flags,1,AI_MATKEY_TEXFLAGS(type,cur));
|
2008-09-20 15:55:51 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
std::string ss = (*it).mFileName;
|
2009-02-11 20:56:05 +00:00
|
|
|
|
if (!ss.length()) {
|
2008-09-20 15:55:51 +00:00
|
|
|
|
DefaultLogger::get()->error("LWOB: Empty file name");
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
AdjustTexturePath(ss);
|
|
|
|
|
s.Set(ss);
|
|
|
|
|
}
|
2008-11-16 21:56:45 +00:00
|
|
|
|
pcMat->AddProperty(&s,AI_MATKEY_TEXTURE(type,cur));
|
2008-09-20 15:55:51 +00:00
|
|
|
|
|
|
|
|
|
// add the blend factor
|
2008-11-16 21:56:45 +00:00
|
|
|
|
pcMat->AddProperty<float>(&(*it).mStrength,1,AI_MATKEY_TEXBLEND(type,cur));
|
2008-09-20 15:55:51 +00:00
|
|
|
|
|
|
|
|
|
// add the blend operation
|
|
|
|
|
switch ((*it).blendType)
|
|
|
|
|
{
|
|
|
|
|
case LWO::Texture::Normal:
|
|
|
|
|
case LWO::Texture::Multiply:
|
|
|
|
|
temp = (unsigned int)aiTextureOp_Multiply;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case LWO::Texture::Subtractive:
|
|
|
|
|
case LWO::Texture::Difference:
|
|
|
|
|
temp = (unsigned int)aiTextureOp_Subtract;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case LWO::Texture::Divide:
|
|
|
|
|
temp = (unsigned int)aiTextureOp_Divide;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case LWO::Texture::Additive:
|
|
|
|
|
temp = (unsigned int)aiTextureOp_Add;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
temp = (unsigned int)aiTextureOp_Multiply;
|
|
|
|
|
DefaultLogger::get()->warn("LWO2: Unsupported texture blend mode: alpha or displacement");
|
|
|
|
|
|
|
|
|
|
}
|
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
|
|
|
|
// Setup texture operation
|
2008-11-16 21:56:45 +00:00
|
|
|
|
pcMat->AddProperty<int>((int*)&temp,1,AI_MATKEY_TEXOP(type,cur));
|
2008-09-20 15:55:51 +00:00
|
|
|
|
|
2008-11-16 21:56:45 +00:00
|
|
|
|
// setup the mapping mode
|
|
|
|
|
pcMat->AddProperty<int>((int*)&mapping,1,AI_MATKEY_MAPPING(type,cur));
|
2008-09-20 15:55:51 +00:00
|
|
|
|
|
|
|
|
|
// add the u-wrapping
|
|
|
|
|
temp = (unsigned int)GetMapMode((*it).wrapModeWidth);
|
2008-11-16 21:56:45 +00:00
|
|
|
|
pcMat->AddProperty<int>((int*)&temp,1,AI_MATKEY_MAPPINGMODE_U(type,cur));
|
2008-09-20 15:55:51 +00:00
|
|
|
|
|
|
|
|
|
// add the v-wrapping
|
|
|
|
|
temp = (unsigned int)GetMapMode((*it).wrapModeHeight);
|
2008-11-16 21:56:45 +00:00
|
|
|
|
pcMat->AddProperty<int>((int*)&temp,1,AI_MATKEY_MAPPINGMODE_V(type,cur));
|
2008-09-20 15:55:51 +00:00
|
|
|
|
|
|
|
|
|
++cur;
|
|
|
|
|
}
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
2008-08-13 23:46:46 +00:00
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2011-08-22 20:22:51 +00:00
|
|
|
|
void LWOImporter::ConvertMaterial(const LWO::Surface& surf,aiMaterial* pcMat)
|
2008-08-13 23:46:46 +00:00
|
|
|
|
{
|
|
|
|
|
// copy the name of the surface
|
|
|
|
|
aiString st;
|
|
|
|
|
st.Set(surf.mName);
|
|
|
|
|
pcMat->AddProperty(&st,AI_MATKEY_NAME);
|
|
|
|
|
|
General
- Added format auto-detection to most loaders
- Simplified BaseImporter::CanRead() with some utility methods
- improved fast_atof -> no overruns anymore. Fuck you, irrlicht.
- added assimp_cmd tool to allow command line model processing. Mainly adebugging tool for internal purposes, but others might find it useful, too.
- vc8/vc9: revision number is now written to DLL version header
- mkutil: some batch scripts to simplify tagging & building of release versions
- some API cleanup
- fixing some doxygen markup (+now explicit use of @file <filename>)
- Icon for assimp_view and assimp_cmd
3DS
- Normal vectors are not anymore inverted in some cases
- Improved pivot handling
- Improved handling of x-flipped meshes
Collada
- fixed a minor bug (visual_scene element)
LWS
- WIP implementation. No animations yet, some bugs and crashes.
- Animation system remains disabled, WIP code
- many test files for LWS, but most of them test the anim support, which is, read above, currently disabled.
STL
- fixing a log warning which appears for every model
- added binary&ascii test spider, exported from truespace
MD3
- Cleaning up output tags for automatically joined player models.
IRR
- Fixing coordinate system issues.
- Instance handling improved.
- Some of the reported crashes not yet fixed.
PretransformVertices
- Numerous performance improvements.
- Added config option to preserve the hierarchy during the step.
RemoveRedundantMaterials
- Added config option to specify a list of materials which are kept in every case.
UNREAL
- Added support for the old unreal data format (*.a,*.d,*.uc)
- tested only with exports from Milkshape
- more Unreal stuff to come soon
git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@356 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
2009-03-05 22:32:13 +00:00
|
|
|
|
const int i = surf.bDoubleSided ? 1 : 0;
|
|
|
|
|
pcMat->AddProperty(&i,1,AI_MATKEY_TWOSIDED);
|
2008-09-20 15:55:51 +00:00
|
|
|
|
|
|
|
|
|
// add the refraction index and the bump intensity
|
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
|
|
|
|
pcMat->AddProperty(&surf.mIOR,1,AI_MATKEY_REFRACTI);
|
|
|
|
|
pcMat->AddProperty(&surf.mBumpIntensity,1,AI_MATKEY_BUMPSCALING);
|
2008-08-13 23:46:46 +00:00
|
|
|
|
|
2008-09-20 15:55:51 +00:00
|
|
|
|
aiShadingMode m;
|
2008-08-13 23:46:46 +00:00
|
|
|
|
if (surf.mSpecularValue && surf.mGlossiness)
|
|
|
|
|
{
|
|
|
|
|
float fGloss;
|
2009-03-26 22:05:56 +00:00
|
|
|
|
if (mIsLWO2) {
|
2008-09-20 15:55:51 +00:00
|
|
|
|
fGloss = pow( surf.mGlossiness*10.0f+2.0f, 2.0f);
|
|
|
|
|
}
|
2008-08-13 23:46:46 +00:00
|
|
|
|
else
|
|
|
|
|
{
|
2009-04-20 16:49:46 +00:00
|
|
|
|
if (16.0f >= surf.mGlossiness)
|
|
|
|
|
fGloss = 6.0f;
|
|
|
|
|
else if (64.0f >= surf.mGlossiness)
|
|
|
|
|
fGloss = 20.0f;
|
|
|
|
|
else if (256.0f >= surf.mGlossiness)
|
|
|
|
|
fGloss = 50.0f;
|
2008-08-13 23:46:46 +00:00
|
|
|
|
else fGloss = 80.0f;
|
|
|
|
|
}
|
|
|
|
|
|
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
|
|
|
|
pcMat->AddProperty(&surf.mSpecularValue,1,AI_MATKEY_SHININESS_STRENGTH);
|
|
|
|
|
pcMat->AddProperty(&fGloss,1,AI_MATKEY_SHININESS);
|
2008-09-20 15:55:51 +00:00
|
|
|
|
m = aiShadingMode_Phong;
|
2008-08-13 23:46:46 +00:00
|
|
|
|
}
|
2008-09-20 15:55:51 +00:00
|
|
|
|
else m = aiShadingMode_Gouraud;
|
2008-08-13 23:46:46 +00:00
|
|
|
|
|
|
|
|
|
// specular color
|
2008-09-20 15:55:51 +00:00
|
|
|
|
aiColor3D clr = lerp( aiColor3D(1.f,1.f,1.f), surf.mColor, surf.mColorHighlights );
|
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
|
|
|
|
pcMat->AddProperty(&clr,1,AI_MATKEY_COLOR_SPECULAR);
|
|
|
|
|
pcMat->AddProperty(&surf.mSpecularValue,1,AI_MATKEY_SHININESS_STRENGTH);
|
2008-08-13 23:46:46 +00:00
|
|
|
|
|
|
|
|
|
// emissive color
|
2009-04-20 16:49:46 +00:00
|
|
|
|
// luminosity is not really the same but it affects the surface in a similar way. Some scaling looks good.
|
2008-08-13 23:46:46 +00:00
|
|
|
|
clr.g = clr.b = clr.r = surf.mLuminosity*0.8f;
|
|
|
|
|
pcMat->AddProperty<aiColor3D>(&clr,1,AI_MATKEY_COLOR_EMISSIVE);
|
|
|
|
|
|
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
|
|
|
|
// opacity ... either additive or default-blended, please
|
2009-04-20 16:49:46 +00:00
|
|
|
|
if (0.f != surf.mAdditiveTransparency) {
|
|
|
|
|
|
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 int add = aiBlendMode_Additive;
|
|
|
|
|
pcMat->AddProperty(&surf.mAdditiveTransparency,1,AI_MATKEY_OPACITY);
|
|
|
|
|
pcMat->AddProperty(&add,1,AI_MATKEY_BLEND_FUNC);
|
|
|
|
|
}
|
2009-04-20 16:49:46 +00:00
|
|
|
|
|
|
|
|
|
else if (10e10f != surf.mTransparency) {
|
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 int def = aiBlendMode_Default;
|
|
|
|
|
const float f = 1.0f-surf.mTransparency;
|
|
|
|
|
pcMat->AddProperty(&f,1,AI_MATKEY_OPACITY);
|
|
|
|
|
pcMat->AddProperty(&def,1,AI_MATKEY_BLEND_FUNC);
|
2008-11-16 21:56:45 +00:00
|
|
|
|
}
|
General
- Added format auto-detection to most loaders
- Simplified BaseImporter::CanRead() with some utility methods
- improved fast_atof -> no overruns anymore. Fuck you, irrlicht.
- added assimp_cmd tool to allow command line model processing. Mainly adebugging tool for internal purposes, but others might find it useful, too.
- vc8/vc9: revision number is now written to DLL version header
- mkutil: some batch scripts to simplify tagging & building of release versions
- some API cleanup
- fixing some doxygen markup (+now explicit use of @file <filename>)
- Icon for assimp_view and assimp_cmd
3DS
- Normal vectors are not anymore inverted in some cases
- Improved pivot handling
- Improved handling of x-flipped meshes
Collada
- fixed a minor bug (visual_scene element)
LWS
- WIP implementation. No animations yet, some bugs and crashes.
- Animation system remains disabled, WIP code
- many test files for LWS, but most of them test the anim support, which is, read above, currently disabled.
STL
- fixing a log warning which appears for every model
- added binary&ascii test spider, exported from truespace
MD3
- Cleaning up output tags for automatically joined player models.
IRR
- Fixing coordinate system issues.
- Instance handling improved.
- Some of the reported crashes not yet fixed.
PretransformVertices
- Numerous performance improvements.
- Added config option to preserve the hierarchy during the step.
RemoveRedundantMaterials
- Added config option to specify a list of materials which are kept in every case.
UNREAL
- Added support for the old unreal data format (*.a,*.d,*.uc)
- tested only with exports from Milkshape
- more Unreal stuff to come soon
git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@356 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
2009-03-05 22:32:13 +00:00
|
|
|
|
|
2008-08-13 23:46:46 +00:00
|
|
|
|
|
2008-09-20 15:55:51 +00:00
|
|
|
|
// ADD TEXTURES to the material
|
|
|
|
|
// TODO: find out how we can handle COLOR textures correctly...
|
2008-11-16 21:56:45 +00:00
|
|
|
|
bool b = HandleTextures(pcMat,surf.mColorTextures,aiTextureType_DIFFUSE);
|
|
|
|
|
b = (b || HandleTextures(pcMat,surf.mDiffuseTextures,aiTextureType_DIFFUSE));
|
|
|
|
|
HandleTextures(pcMat,surf.mSpecularTextures,aiTextureType_SPECULAR);
|
|
|
|
|
HandleTextures(pcMat,surf.mGlossinessTextures,aiTextureType_SHININESS);
|
|
|
|
|
HandleTextures(pcMat,surf.mBumpTextures,aiTextureType_HEIGHT);
|
|
|
|
|
HandleTextures(pcMat,surf.mOpacityTextures,aiTextureType_OPACITY);
|
2009-02-11 20:56:05 +00:00
|
|
|
|
HandleTextures(pcMat,surf.mReflectionTextures,aiTextureType_REFLECTION);
|
2008-09-20 15:55:51 +00:00
|
|
|
|
|
2009-04-20 16:49:46 +00:00
|
|
|
|
// Now we need to know which shader to use .. iterate through the shader list of
|
|
|
|
|
// the surface and search for a name which we know ...
|
|
|
|
|
for (ShaderList::const_iterator it = surf.mShaders.begin(), end = surf.mShaders.end();it != end;++it) {
|
2008-11-16 21:56:45 +00:00
|
|
|
|
//if (!(*it).enabled)continue;
|
2009-04-20 16:49:46 +00:00
|
|
|
|
|
General
- Added format auto-detection to most loaders
- Simplified BaseImporter::CanRead() with some utility methods
- improved fast_atof -> no overruns anymore. Fuck you, irrlicht.
- added assimp_cmd tool to allow command line model processing. Mainly adebugging tool for internal purposes, but others might find it useful, too.
- vc8/vc9: revision number is now written to DLL version header
- mkutil: some batch scripts to simplify tagging & building of release versions
- some API cleanup
- fixing some doxygen markup (+now explicit use of @file <filename>)
- Icon for assimp_view and assimp_cmd
3DS
- Normal vectors are not anymore inverted in some cases
- Improved pivot handling
- Improved handling of x-flipped meshes
Collada
- fixed a minor bug (visual_scene element)
LWS
- WIP implementation. No animations yet, some bugs and crashes.
- Animation system remains disabled, WIP code
- many test files for LWS, but most of them test the anim support, which is, read above, currently disabled.
STL
- fixing a log warning which appears for every model
- added binary&ascii test spider, exported from truespace
MD3
- Cleaning up output tags for automatically joined player models.
IRR
- Fixing coordinate system issues.
- Instance handling improved.
- Some of the reported crashes not yet fixed.
PretransformVertices
- Numerous performance improvements.
- Added config option to preserve the hierarchy during the step.
RemoveRedundantMaterials
- Added config option to specify a list of materials which are kept in every case.
UNREAL
- Added support for the old unreal data format (*.a,*.d,*.uc)
- tested only with exports from Milkshape
- more Unreal stuff to come soon
git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@356 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
2009-03-05 22:32:13 +00:00
|
|
|
|
if ((*it).functionName == "LW_SuperCelShader" || (*it).functionName == "AH_CelShader") {
|
2009-04-20 16:49:46 +00:00
|
|
|
|
DefaultLogger::get()->info("LWO2: Mapping LW_SuperCelShader/AH_CelShader to aiShadingMode_Toon");
|
2008-10-31 19:32:00 +00:00
|
|
|
|
|
2008-09-20 15:55:51 +00:00
|
|
|
|
m = aiShadingMode_Toon;
|
|
|
|
|
break;
|
|
|
|
|
}
|
General
- Added format auto-detection to most loaders
- Simplified BaseImporter::CanRead() with some utility methods
- improved fast_atof -> no overruns anymore. Fuck you, irrlicht.
- added assimp_cmd tool to allow command line model processing. Mainly adebugging tool for internal purposes, but others might find it useful, too.
- vc8/vc9: revision number is now written to DLL version header
- mkutil: some batch scripts to simplify tagging & building of release versions
- some API cleanup
- fixing some doxygen markup (+now explicit use of @file <filename>)
- Icon for assimp_view and assimp_cmd
3DS
- Normal vectors are not anymore inverted in some cases
- Improved pivot handling
- Improved handling of x-flipped meshes
Collada
- fixed a minor bug (visual_scene element)
LWS
- WIP implementation. No animations yet, some bugs and crashes.
- Animation system remains disabled, WIP code
- many test files for LWS, but most of them test the anim support, which is, read above, currently disabled.
STL
- fixing a log warning which appears for every model
- added binary&ascii test spider, exported from truespace
MD3
- Cleaning up output tags for automatically joined player models.
IRR
- Fixing coordinate system issues.
- Instance handling improved.
- Some of the reported crashes not yet fixed.
PretransformVertices
- Numerous performance improvements.
- Added config option to preserve the hierarchy during the step.
RemoveRedundantMaterials
- Added config option to specify a list of materials which are kept in every case.
UNREAL
- Added support for the old unreal data format (*.a,*.d,*.uc)
- tested only with exports from Milkshape
- more Unreal stuff to come soon
git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@356 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
2009-03-05 22:32:13 +00:00
|
|
|
|
else if ((*it).functionName == "LW_RealFresnel" || (*it).functionName == "LW_FastFresnel") {
|
2009-04-20 16:49:46 +00:00
|
|
|
|
DefaultLogger::get()->info("LWO2: Mapping LW_RealFresnel/LW_FastFresnel to aiShadingMode_Fresnel");
|
2008-10-31 19:32:00 +00:00
|
|
|
|
|
2008-09-20 15:55:51 +00:00
|
|
|
|
m = aiShadingMode_Fresnel;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
DefaultLogger::get()->warn("LWO2: Unknown surface shader: " + (*it).functionName);
|
|
|
|
|
}
|
|
|
|
|
}
|
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 (surf.mMaximumSmoothAngle <= 0.0f)
|
|
|
|
|
m = aiShadingMode_Flat;
|
2008-09-20 15:55:51 +00:00
|
|
|
|
pcMat->AddProperty((int*)&m,1,AI_MATKEY_SHADING_MODEL);
|
|
|
|
|
|
|
|
|
|
// (the diffuse value is just a scaling factor)
|
|
|
|
|
// If a diffuse texture is set, we set this value to 1.0
|
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
|
|
|
|
clr = (b && false ? aiColor3D(1.f,1.f,1.f) : surf.mColor);
|
2008-09-20 15:55:51 +00:00
|
|
|
|
clr.r *= surf.mDiffuseValue;
|
|
|
|
|
clr.g *= surf.mDiffuseValue;
|
|
|
|
|
clr.b *= surf.mDiffuseValue;
|
|
|
|
|
pcMat->AddProperty<aiColor3D>(&clr,1,AI_MATKEY_COLOR_DIFFUSE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2009-04-20 16:49:46 +00:00
|
|
|
|
char LWOImporter::FindUVChannels(LWO::TextureList& list,
|
2011-06-09 14:29:32 +00:00
|
|
|
|
LWO::Layer& /*layer*/,LWO::UVChannel& uv, unsigned int next)
|
2008-09-20 15:55:51 +00:00
|
|
|
|
{
|
2009-04-20 16:49:46 +00:00
|
|
|
|
char ret = 0;
|
2009-04-15 16:24:58 +00:00
|
|
|
|
for (TextureList::iterator it = list.begin(), end = list.end();it != end;++it) {
|
|
|
|
|
|
2008-11-16 21:56:45 +00:00
|
|
|
|
// Ignore textures with non-UV mappings for the moment.
|
2009-04-15 16:24:58 +00:00
|
|
|
|
if (!(*it).enabled || !(*it).bCanUse || (*it).mapMode != LWO::Texture::UV) {
|
2008-09-20 15:55:51 +00:00
|
|
|
|
continue;
|
|
|
|
|
}
|
2009-04-20 16:49:46 +00:00
|
|
|
|
|
|
|
|
|
if ((*it).mUVChannelIndex == uv.name) {
|
|
|
|
|
ret = 1;
|
|
|
|
|
|
|
|
|
|
// got it.
|
2011-04-22 21:29:18 +00:00
|
|
|
|
if ((*it).mRealUVIndex == UINT_MAX || (*it).mRealUVIndex == next)
|
2009-04-20 16:49:46 +00:00
|
|
|
|
{
|
|
|
|
|
(*it).mRealUVIndex = next;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
// channel mismatch. need to duplicate the material.
|
|
|
|
|
DefaultLogger::get()->warn("LWO: Channel mismatch, would need to duplicate surface [design bug]");
|
2009-04-15 16:24:58 +00:00
|
|
|
|
|
2009-04-20 16:49:46 +00:00
|
|
|
|
// TODO
|
2008-09-20 15:55:51 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2009-04-20 16:49:46 +00:00
|
|
|
|
return ret;
|
2008-08-13 23:46:46 +00:00
|
|
|
|
}
|
|
|
|
|
|
2008-08-13 15:45:57 +00:00
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2009-04-20 16:49:46 +00:00
|
|
|
|
void LWOImporter::FindUVChannels(LWO::Surface& surf,
|
|
|
|
|
LWO::SortedRep& sorted,LWO::Layer& layer,
|
2008-09-08 16:48:21 +00:00
|
|
|
|
unsigned int out[AI_MAX_NUMBER_OF_TEXTURECOORDS])
|
2008-08-13 15:45:57 +00:00
|
|
|
|
{
|
2009-04-20 16:49:46 +00:00
|
|
|
|
unsigned int next = 0, extra = 0, num_extra = 0;
|
|
|
|
|
|
|
|
|
|
// Check whether we have an UV entry != 0 for one of the faces in 'sorted'
|
|
|
|
|
for (unsigned int i = 0; i < layer.mUVChannels.size();++i) {
|
|
|
|
|
LWO::UVChannel& uv = layer.mUVChannels[i];
|
|
|
|
|
|
|
|
|
|
for (LWO::SortedRep::const_iterator it = sorted.begin(); it != sorted.end(); ++it) {
|
|
|
|
|
|
|
|
|
|
LWO::Face& face = layer.mFaces[*it];
|
|
|
|
|
|
|
|
|
|
for (unsigned int n = 0; n < face.mNumIndices; ++n) {
|
|
|
|
|
unsigned int idx = face.mIndices[n];
|
|
|
|
|
|
|
|
|
|
if (uv.abAssigned[idx] && ((aiVector2D*)&uv.rawData[0])[idx] != aiVector2D()) {
|
|
|
|
|
|
2011-02-03 13:22:38 +00:00
|
|
|
|
if (extra >= AI_MAX_NUMBER_OF_TEXTURECOORDS) {
|
2009-04-20 16:49:46 +00:00
|
|
|
|
|
|
|
|
|
DefaultLogger::get()->error("LWO: Maximum number of UV channels for "
|
|
|
|
|
"this mesh reached. Skipping channel \'" + uv.name + "\'");
|
2008-09-20 15:55:51 +00:00
|
|
|
|
|
2009-04-20 16:49:46 +00:00
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
// Search through all textures assigned to 'surf' and look for this UV channel
|
|
|
|
|
char had = 0;
|
|
|
|
|
had |= FindUVChannels(surf.mColorTextures,layer,uv,next);
|
|
|
|
|
had |= FindUVChannels(surf.mDiffuseTextures,layer,uv,next);
|
|
|
|
|
had |= FindUVChannels(surf.mSpecularTextures,layer,uv,next);
|
|
|
|
|
had |= FindUVChannels(surf.mGlossinessTextures,layer,uv,next);
|
|
|
|
|
had |= FindUVChannels(surf.mOpacityTextures,layer,uv,next);
|
|
|
|
|
had |= FindUVChannels(surf.mBumpTextures,layer,uv,next);
|
|
|
|
|
had |= FindUVChannels(surf.mReflectionTextures,layer,uv,next);
|
|
|
|
|
|
2011-02-03 13:22:38 +00:00
|
|
|
|
// We have a texture referencing this UV channel so we have to take special care
|
|
|
|
|
// and are willing to drop unreferenced channels in favour of it.
|
2009-04-20 16:49:46 +00:00
|
|
|
|
if (had != 0) {
|
|
|
|
|
if (num_extra) {
|
|
|
|
|
|
|
|
|
|
for (unsigned int a = next; a < std::min( extra, AI_MAX_NUMBER_OF_TEXTURECOORDS-1u ); ++a) {
|
|
|
|
|
out[a+1] = out[a];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
++extra;
|
|
|
|
|
out[next++] = i;
|
|
|
|
|
}
|
2011-02-03 13:22:38 +00:00
|
|
|
|
// B<>h ... seems not to be used at all. Push to end if enough space is available.
|
2009-04-20 16:49:46 +00:00
|
|
|
|
else {
|
|
|
|
|
out[extra++] = i;
|
|
|
|
|
++num_extra;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
it = sorted.end()-1;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2011-02-03 13:22:38 +00:00
|
|
|
|
if (extra < AI_MAX_NUMBER_OF_TEXTURECOORDS) {
|
2011-04-22 21:29:18 +00:00
|
|
|
|
out[extra] = UINT_MAX;
|
2009-04-20 16:49:46 +00:00
|
|
|
|
}
|
2008-09-08 16:48:21 +00:00
|
|
|
|
}
|
2008-08-13 15:45:57 +00:00
|
|
|
|
|
2008-09-08 16:48:21 +00:00
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2009-04-20 16:49:46 +00:00
|
|
|
|
void LWOImporter::FindVCChannels(const LWO::Surface& surf, LWO::SortedRep& sorted, const LWO::Layer& layer,
|
2008-09-08 16:48:21 +00:00
|
|
|
|
unsigned int out[AI_MAX_NUMBER_OF_COLOR_SETS])
|
|
|
|
|
{
|
2009-04-20 16:49:46 +00:00
|
|
|
|
unsigned int next = 0;
|
|
|
|
|
|
|
|
|
|
// Check whether we have an vc entry != 0 for one of the faces in 'sorted'
|
|
|
|
|
for (unsigned int i = 0; i < layer.mVColorChannels.size();++i) {
|
|
|
|
|
const LWO::VColorChannel& vc = layer.mVColorChannels[i];
|
|
|
|
|
|
|
|
|
|
if (surf.mVCMap == vc.name) {
|
|
|
|
|
// The vertex color map is explicitely requested by the surface so we need to take special care of it
|
|
|
|
|
for (unsigned int a = 0; a < std::min(next,AI_MAX_NUMBER_OF_COLOR_SETS-1u); ++a) {
|
|
|
|
|
out[a+1] = out[a];
|
2008-09-20 15:55:51 +00:00
|
|
|
|
}
|
2009-04-20 16:49:46 +00:00
|
|
|
|
out[0] = i;
|
|
|
|
|
++next;
|
2008-09-20 15:55:51 +00:00
|
|
|
|
}
|
2009-04-20 16:49:46 +00:00
|
|
|
|
else {
|
|
|
|
|
|
|
|
|
|
for (LWO::SortedRep::iterator it = sorted.begin(); it != sorted.end(); ++it) {
|
|
|
|
|
const LWO::Face& face = layer.mFaces[*it];
|
|
|
|
|
|
|
|
|
|
for (unsigned int n = 0; n < face.mNumIndices; ++n) {
|
|
|
|
|
unsigned int idx = face.mIndices[n];
|
|
|
|
|
|
|
|
|
|
if (vc.abAssigned[idx] && ((aiColor4D*)&vc.rawData[0])[idx] != aiColor4D(0.f,0.f,0.f,1.f)) {
|
|
|
|
|
if (next >= AI_MAX_NUMBER_OF_COLOR_SETS) {
|
|
|
|
|
|
|
|
|
|
DefaultLogger::get()->error("LWO: Maximum number of vertex color channels for "
|
|
|
|
|
"this mesh reached. Skipping channel \'" + vc.name + "\'");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
out[next++] = i;
|
|
|
|
|
}
|
|
|
|
|
it = sorted.end()-1;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (next != AI_MAX_NUMBER_OF_COLOR_SETS) {
|
2011-04-22 21:29:18 +00:00
|
|
|
|
out[next] = UINT_MAX;
|
2008-09-20 15:55:51 +00:00
|
|
|
|
}
|
2008-08-13 15:45:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
|
void LWOImporter::LoadLWO2ImageMap(unsigned int size, LWO::Texture& tex )
|
|
|
|
|
{
|
2008-09-20 15:55:51 +00:00
|
|
|
|
LE_NCONST uint8_t* const end = mFileBuffer + size;
|
|
|
|
|
while (true)
|
|
|
|
|
{
|
|
|
|
|
if (mFileBuffer + 6 >= end)break;
|
2014-09-05 03:49:48 +00:00
|
|
|
|
LE_NCONST IFF::SubChunkHeader head = IFF::LoadSubChunk(mFileBuffer);
|
2008-09-20 15:55:51 +00:00
|
|
|
|
|
2014-09-05 03:49:48 +00:00
|
|
|
|
if (mFileBuffer + head.length > end)
|
2010-03-18 17:00:12 +00:00
|
|
|
|
throw DeadlyImportError("LWO2: Invalid SURF.BLOCK chunk length");
|
2008-09-20 15:55:51 +00:00
|
|
|
|
|
2014-09-05 03:49:48 +00:00
|
|
|
|
uint8_t* const next = mFileBuffer+head.length;
|
|
|
|
|
switch (head.type)
|
2008-09-20 15:55:51 +00:00
|
|
|
|
{
|
|
|
|
|
case AI_LWO_PROJ:
|
2008-11-16 21:56:45 +00:00
|
|
|
|
tex.mapMode = (Texture::MappingMode)GetU2();
|
|
|
|
|
break;
|
|
|
|
|
case AI_LWO_WRAP:
|
2008-09-20 15:55:51 +00:00
|
|
|
|
tex.wrapModeWidth = (Texture::Wrap)GetU2();
|
|
|
|
|
tex.wrapModeHeight = (Texture::Wrap)GetU2();
|
|
|
|
|
break;
|
|
|
|
|
case AI_LWO_AXIS:
|
|
|
|
|
tex.majorAxis = (Texture::Axes)GetU2();
|
|
|
|
|
break;
|
|
|
|
|
case AI_LWO_IMAG:
|
|
|
|
|
tex.mClipIdx = GetU2();
|
|
|
|
|
break;
|
|
|
|
|
case AI_LWO_VMAP:
|
2014-09-05 03:49:48 +00:00
|
|
|
|
GetS0(tex.mUVChannelIndex,head.length);
|
2008-09-20 15:55:51 +00:00
|
|
|
|
break;
|
|
|
|
|
case AI_LWO_WRPH:
|
|
|
|
|
tex.wrapAmountH = GetF4();
|
|
|
|
|
break;
|
|
|
|
|
case AI_LWO_WRPW:
|
|
|
|
|
tex.wrapAmountW = GetF4();
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
mFileBuffer = next;
|
|
|
|
|
}
|
2008-08-13 15:45:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2011-06-09 14:29:32 +00:00
|
|
|
|
void LWOImporter::LoadLWO2Procedural(unsigned int /*size*/, LWO::Texture& tex )
|
2008-08-13 15:45:57 +00:00
|
|
|
|
{
|
2008-09-10 14:39:35 +00:00
|
|
|
|
// --- not supported at the moment
|
2008-09-20 15:55:51 +00:00
|
|
|
|
DefaultLogger::get()->error("LWO2: Found procedural texture, this is not supported");
|
|
|
|
|
tex.bCanUse = false;
|
2008-08-13 15:45:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2011-06-09 14:29:32 +00:00
|
|
|
|
void LWOImporter::LoadLWO2Gradient(unsigned int /*size*/, LWO::Texture& tex )
|
2008-08-13 15:45:57 +00:00
|
|
|
|
{
|
2008-09-10 14:39:35 +00:00
|
|
|
|
// --- not supported at the moment
|
2008-09-20 15:55:51 +00:00
|
|
|
|
DefaultLogger::get()->error("LWO2: Found gradient texture, this is not supported");
|
|
|
|
|
tex.bCanUse = false;
|
2008-08-13 15:45:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
|
void LWOImporter::LoadLWO2TextureHeader(unsigned int size, LWO::Texture& tex )
|
|
|
|
|
{
|
2008-09-20 15:55:51 +00:00
|
|
|
|
LE_NCONST uint8_t* const end = mFileBuffer + size;
|
|
|
|
|
|
|
|
|
|
// get the ordinal string
|
|
|
|
|
GetS0( tex.ordinal, size);
|
|
|
|
|
|
|
|
|
|
// we could crash later if this is an empty string ...
|
|
|
|
|
if (!tex.ordinal.length())
|
|
|
|
|
{
|
|
|
|
|
DefaultLogger::get()->error("LWO2: Ill-formed SURF.BLOK ordinal string");
|
|
|
|
|
tex.ordinal = "\x00";
|
|
|
|
|
}
|
|
|
|
|
while (true)
|
|
|
|
|
{
|
|
|
|
|
if (mFileBuffer + 6 >= end)break;
|
2014-09-05 03:49:48 +00:00
|
|
|
|
const IFF::SubChunkHeader head = IFF::LoadSubChunk(mFileBuffer);
|
2008-09-20 15:55:51 +00:00
|
|
|
|
|
2014-09-05 03:49:48 +00:00
|
|
|
|
if (mFileBuffer + head.length > end)
|
2010-03-18 17:00:12 +00:00
|
|
|
|
throw DeadlyImportError("LWO2: Invalid texture header chunk length");
|
2008-09-20 15:55:51 +00:00
|
|
|
|
|
2014-09-05 03:49:48 +00:00
|
|
|
|
uint8_t* const next = mFileBuffer+head.length;
|
|
|
|
|
switch (head.type)
|
2008-09-20 15:55:51 +00:00
|
|
|
|
{
|
|
|
|
|
case AI_LWO_CHAN:
|
|
|
|
|
tex.type = GetU4();
|
|
|
|
|
break;
|
|
|
|
|
case AI_LWO_ENAB:
|
|
|
|
|
tex.enabled = GetU2() ? true : false;
|
|
|
|
|
break;
|
|
|
|
|
case AI_LWO_OPAC:
|
|
|
|
|
tex.blendType = (Texture::BlendType)GetU2();
|
|
|
|
|
tex.mStrength = GetF4();
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
mFileBuffer = next;
|
|
|
|
|
}
|
2008-08-13 15:45:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2008-09-20 15:55:51 +00:00
|
|
|
|
void LWOImporter::LoadLWO2TextureBlock(LE_NCONST IFF::SubChunkHeader* head, unsigned int size )
|
2008-08-13 15:45:57 +00:00
|
|
|
|
{
|
2008-09-20 15:55:51 +00:00
|
|
|
|
ai_assert(!mSurfaces->empty());
|
|
|
|
|
LWO::Surface& surf = mSurfaces->back();
|
|
|
|
|
LWO::Texture tex;
|
2008-08-13 15:45:57 +00:00
|
|
|
|
|
2008-09-20 15:55:51 +00:00
|
|
|
|
// load the texture header
|
|
|
|
|
LoadLWO2TextureHeader(head->length,tex);
|
|
|
|
|
size -= head->length + 6;
|
2008-08-13 15:45:57 +00:00
|
|
|
|
|
|
|
|
|
// now get the exact type of the texture
|
2008-09-20 15:55:51 +00:00
|
|
|
|
switch (head->type)
|
|
|
|
|
{
|
|
|
|
|
case AI_LWO_PROC:
|
|
|
|
|
LoadLWO2Procedural(size,tex);
|
|
|
|
|
break;
|
|
|
|
|
case AI_LWO_GRAD:
|
|
|
|
|
LoadLWO2Gradient(size,tex);
|
|
|
|
|
break;
|
|
|
|
|
case AI_LWO_IMAP:
|
|
|
|
|
LoadLWO2ImageMap(size,tex);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// get the destination channel
|
|
|
|
|
TextureList* listRef = NULL;
|
|
|
|
|
switch (tex.type)
|
|
|
|
|
{
|
|
|
|
|
case AI_LWO_COLR:
|
|
|
|
|
listRef = &surf.mColorTextures;break;
|
|
|
|
|
case AI_LWO_DIFF:
|
|
|
|
|
listRef = &surf.mDiffuseTextures;break;
|
|
|
|
|
case AI_LWO_SPEC:
|
|
|
|
|
listRef = &surf.mSpecularTextures;break;
|
|
|
|
|
case AI_LWO_GLOS:
|
|
|
|
|
listRef = &surf.mGlossinessTextures;break;
|
|
|
|
|
case AI_LWO_BUMP:
|
|
|
|
|
listRef = &surf.mBumpTextures;break;
|
|
|
|
|
case AI_LWO_TRAN:
|
|
|
|
|
listRef = &surf.mOpacityTextures;break;
|
2009-02-11 20:56:05 +00:00
|
|
|
|
case AI_LWO_REFL:
|
|
|
|
|
listRef = &surf.mReflectionTextures;break;
|
2008-09-20 15:55:51 +00:00
|
|
|
|
default:
|
|
|
|
|
DefaultLogger::get()->warn("LWO2: Encountered unknown texture type");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// now attach the texture to the parent surface - sort by ordinal string
|
2009-03-26 22:05:56 +00:00
|
|
|
|
for (TextureList::iterator it = listRef->begin();it != listRef->end(); ++it) {
|
|
|
|
|
if (::strcmp(tex.ordinal.c_str(),(*it).ordinal.c_str()) < 0) {
|
2008-09-20 15:55:51 +00:00
|
|
|
|
listRef->insert(it,tex);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
listRef->push_back(tex);
|
2008-08-13 15:45:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2011-06-09 14:29:32 +00:00
|
|
|
|
void LWOImporter::LoadLWO2ShaderBlock(LE_NCONST IFF::SubChunkHeader* /*head*/, unsigned int size )
|
2008-08-13 15:45:57 +00:00
|
|
|
|
{
|
|
|
|
|
LE_NCONST uint8_t* const end = mFileBuffer + size;
|
|
|
|
|
|
2008-09-20 15:55:51 +00:00
|
|
|
|
ai_assert(!mSurfaces->empty());
|
2008-08-13 15:45:57 +00:00
|
|
|
|
LWO::Surface& surf = mSurfaces->back();
|
2008-09-20 15:55:51 +00:00
|
|
|
|
LWO::Shader shader;
|
|
|
|
|
|
|
|
|
|
// get the ordinal string
|
|
|
|
|
GetS0( shader.ordinal, size);
|
|
|
|
|
|
|
|
|
|
// we could crash later if this is an empty string ...
|
|
|
|
|
if (!shader.ordinal.length())
|
|
|
|
|
{
|
|
|
|
|
DefaultLogger::get()->error("LWO2: Ill-formed SURF.BLOK ordinal string");
|
|
|
|
|
shader.ordinal = "\x00";
|
|
|
|
|
}
|
2008-08-13 15:45:57 +00:00
|
|
|
|
|
2008-09-20 15:55:51 +00:00
|
|
|
|
// read the header
|
2008-08-13 15:45:57 +00:00
|
|
|
|
while (true)
|
|
|
|
|
{
|
2008-09-13 09:01:24 +00:00
|
|
|
|
if (mFileBuffer + 6 >= end)break;
|
2014-09-05 03:49:48 +00:00
|
|
|
|
const IFF::SubChunkHeader head = IFF::LoadSubChunk(mFileBuffer);
|
2008-09-20 15:55:51 +00:00
|
|
|
|
|
2014-09-05 03:49:48 +00:00
|
|
|
|
if (mFileBuffer + head.length > end)
|
2010-03-18 17:00:12 +00:00
|
|
|
|
throw DeadlyImportError("LWO2: Invalid shader header chunk length");
|
2008-09-20 15:55:51 +00:00
|
|
|
|
|
2014-09-05 03:49:48 +00:00
|
|
|
|
uint8_t* const next = mFileBuffer+head.length;
|
|
|
|
|
switch (head.type)
|
2008-09-20 15:55:51 +00:00
|
|
|
|
{
|
|
|
|
|
case AI_LWO_ENAB:
|
|
|
|
|
shader.enabled = GetU2() ? true : false;
|
2008-10-31 19:32:00 +00:00
|
|
|
|
break;
|
2008-09-20 15:55:51 +00:00
|
|
|
|
|
|
|
|
|
case AI_LWO_FUNC:
|
2014-09-05 03:49:48 +00:00
|
|
|
|
GetS0( shader.functionName, head.length );
|
2008-09-20 15:55:51 +00:00
|
|
|
|
}
|
|
|
|
|
mFileBuffer = next;
|
|
|
|
|
}
|
2008-08-13 15:45:57 +00:00
|
|
|
|
|
2008-09-20 15:55:51 +00:00
|
|
|
|
// now attach the shader to the parent surface - sort by ordinal string
|
2009-03-26 22:05:56 +00:00
|
|
|
|
for (ShaderList::iterator it = surf.mShaders.begin();it != surf.mShaders.end(); ++it) {
|
2009-02-11 20:56:05 +00:00
|
|
|
|
if (::strcmp(shader.ordinal.c_str(),(*it).ordinal.c_str()) < 0) {
|
2008-09-20 15:55:51 +00:00
|
|
|
|
surf.mShaders.insert(it,shader);
|
|
|
|
|
return;
|
2008-08-13 15:45:57 +00:00
|
|
|
|
}
|
2008-09-20 15:55:51 +00:00
|
|
|
|
}
|
|
|
|
|
surf.mShaders.push_back(shader);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
|
void LWOImporter::LoadLWO2Surface(unsigned int size)
|
|
|
|
|
{
|
|
|
|
|
LE_NCONST uint8_t* const end = mFileBuffer + size;
|
|
|
|
|
|
|
|
|
|
mSurfaces->push_back( LWO::Surface () );
|
|
|
|
|
LWO::Surface& surf = mSurfaces->back();
|
|
|
|
|
|
|
|
|
|
GetS0(surf.mName,size);
|
|
|
|
|
|
|
|
|
|
// check whether this surface was derived from any other surface
|
|
|
|
|
std::string derived;
|
|
|
|
|
GetS0(derived,(unsigned int)(end - mFileBuffer));
|
2009-03-26 22:05:56 +00:00
|
|
|
|
if (derived.length()) {
|
2008-09-20 15:55:51 +00:00
|
|
|
|
// yes, find this surface
|
2009-03-26 22:05:56 +00:00
|
|
|
|
for (SurfaceList::iterator it = mSurfaces->begin(), end = mSurfaces->end()-1; it != end; ++it) {
|
2009-02-15 20:29:07 +00:00
|
|
|
|
if ((*it).mName == derived) {
|
2008-09-20 15:55:51 +00:00
|
|
|
|
// we have it ...
|
|
|
|
|
surf = *it;
|
2009-03-26 22:05:56 +00:00
|
|
|
|
derived.clear();break;
|
2008-09-20 15:55:51 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2009-03-26 22:05:56 +00:00
|
|
|
|
if (derived.size())
|
2008-09-20 15:55:51 +00:00
|
|
|
|
DefaultLogger::get()->warn("LWO2: Unable to find source surface: " + derived);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
while (true)
|
|
|
|
|
{
|
2009-03-26 22:05:56 +00:00
|
|
|
|
if (mFileBuffer + 6 >= end)
|
|
|
|
|
break;
|
2014-09-05 03:49:48 +00:00
|
|
|
|
const IFF::SubChunkHeader head = IFF::LoadSubChunk(mFileBuffer);
|
2008-09-20 15:55:51 +00:00
|
|
|
|
|
2014-09-05 03:49:48 +00:00
|
|
|
|
if (mFileBuffer + head.length > end)
|
2010-03-18 17:00:12 +00:00
|
|
|
|
throw DeadlyImportError("LWO2: Invalid surface chunk length");
|
2008-09-20 15:55:51 +00:00
|
|
|
|
|
2014-09-05 03:49:48 +00:00
|
|
|
|
uint8_t* const next = mFileBuffer+head.length;
|
|
|
|
|
switch (head.type)
|
2008-08-13 15:45:57 +00:00
|
|
|
|
{
|
|
|
|
|
// diffuse color
|
|
|
|
|
case AI_LWO_COLR:
|
|
|
|
|
{
|
2014-09-05 03:49:48 +00:00
|
|
|
|
AI_LWO_VALIDATE_CHUNK_LENGTH(head.length,COLR,12);
|
2008-09-20 15:55:51 +00:00
|
|
|
|
surf.mColor.r = GetF4();
|
|
|
|
|
surf.mColor.g = GetF4();
|
|
|
|
|
surf.mColor.b = GetF4();
|
2008-08-13 15:45:57 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
// diffuse strength ... hopefully
|
|
|
|
|
case AI_LWO_DIFF:
|
|
|
|
|
{
|
2014-09-05 03:49:48 +00:00
|
|
|
|
AI_LWO_VALIDATE_CHUNK_LENGTH(head.length,DIFF,4);
|
2008-09-20 15:55:51 +00:00
|
|
|
|
surf.mDiffuseValue = GetF4();
|
2008-08-13 15:45:57 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
// specular strength ... hopefully
|
|
|
|
|
case AI_LWO_SPEC:
|
|
|
|
|
{
|
2014-09-05 03:49:48 +00:00
|
|
|
|
AI_LWO_VALIDATE_CHUNK_LENGTH(head.length,SPEC,4);
|
2008-09-20 15:55:51 +00:00
|
|
|
|
surf.mSpecularValue = GetF4();
|
2008-08-13 15:45:57 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
// transparency
|
|
|
|
|
case AI_LWO_TRAN:
|
|
|
|
|
{
|
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
|
|
|
|
// transparency explicitly disabled?
|
|
|
|
|
if (surf.mTransparency == 10e10f)
|
|
|
|
|
break;
|
2008-11-16 21:56:45 +00:00
|
|
|
|
|
2014-09-05 03:49:48 +00:00
|
|
|
|
AI_LWO_VALIDATE_CHUNK_LENGTH(head.length,TRAN,4);
|
2008-09-20 15:55:51 +00:00
|
|
|
|
surf.mTransparency = GetF4();
|
2008-08-13 15:45:57 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
General
- Added format auto-detection to most loaders
- Simplified BaseImporter::CanRead() with some utility methods
- improved fast_atof -> no overruns anymore. Fuck you, irrlicht.
- added assimp_cmd tool to allow command line model processing. Mainly adebugging tool for internal purposes, but others might find it useful, too.
- vc8/vc9: revision number is now written to DLL version header
- mkutil: some batch scripts to simplify tagging & building of release versions
- some API cleanup
- fixing some doxygen markup (+now explicit use of @file <filename>)
- Icon for assimp_view and assimp_cmd
3DS
- Normal vectors are not anymore inverted in some cases
- Improved pivot handling
- Improved handling of x-flipped meshes
Collada
- fixed a minor bug (visual_scene element)
LWS
- WIP implementation. No animations yet, some bugs and crashes.
- Animation system remains disabled, WIP code
- many test files for LWS, but most of them test the anim support, which is, read above, currently disabled.
STL
- fixing a log warning which appears for every model
- added binary&ascii test spider, exported from truespace
MD3
- Cleaning up output tags for automatically joined player models.
IRR
- Fixing coordinate system issues.
- Instance handling improved.
- Some of the reported crashes not yet fixed.
PretransformVertices
- Numerous performance improvements.
- Added config option to preserve the hierarchy during the step.
RemoveRedundantMaterials
- Added config option to specify a list of materials which are kept in every case.
UNREAL
- Added support for the old unreal data format (*.a,*.d,*.uc)
- tested only with exports from Milkshape
- more Unreal stuff to come soon
git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@356 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
2009-03-05 22:32:13 +00:00
|
|
|
|
// additive transparency
|
|
|
|
|
case AI_LWO_ADTR:
|
|
|
|
|
{
|
2014-09-05 03:49:48 +00:00
|
|
|
|
AI_LWO_VALIDATE_CHUNK_LENGTH(head.length,ADTR,4);
|
General
- Added format auto-detection to most loaders
- Simplified BaseImporter::CanRead() with some utility methods
- improved fast_atof -> no overruns anymore. Fuck you, irrlicht.
- added assimp_cmd tool to allow command line model processing. Mainly adebugging tool for internal purposes, but others might find it useful, too.
- vc8/vc9: revision number is now written to DLL version header
- mkutil: some batch scripts to simplify tagging & building of release versions
- some API cleanup
- fixing some doxygen markup (+now explicit use of @file <filename>)
- Icon for assimp_view and assimp_cmd
3DS
- Normal vectors are not anymore inverted in some cases
- Improved pivot handling
- Improved handling of x-flipped meshes
Collada
- fixed a minor bug (visual_scene element)
LWS
- WIP implementation. No animations yet, some bugs and crashes.
- Animation system remains disabled, WIP code
- many test files for LWS, but most of them test the anim support, which is, read above, currently disabled.
STL
- fixing a log warning which appears for every model
- added binary&ascii test spider, exported from truespace
MD3
- Cleaning up output tags for automatically joined player models.
IRR
- Fixing coordinate system issues.
- Instance handling improved.
- Some of the reported crashes not yet fixed.
PretransformVertices
- Numerous performance improvements.
- Added config option to preserve the hierarchy during the step.
RemoveRedundantMaterials
- Added config option to specify a list of materials which are kept in every case.
UNREAL
- Added support for the old unreal data format (*.a,*.d,*.uc)
- tested only with exports from Milkshape
- more Unreal stuff to come soon
git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@356 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
2009-03-05 22:32:13 +00:00
|
|
|
|
surf.mAdditiveTransparency = GetF4();
|
|
|
|
|
break;
|
|
|
|
|
}
|
2008-11-16 21:56:45 +00:00
|
|
|
|
// wireframe mode
|
|
|
|
|
case AI_LWO_LINE:
|
|
|
|
|
{
|
2014-09-05 03:49:48 +00:00
|
|
|
|
AI_LWO_VALIDATE_CHUNK_LENGTH(head.length,LINE,2);
|
2008-11-16 21:56:45 +00:00
|
|
|
|
if (GetU2() & 0x1)
|
|
|
|
|
surf.mWireframe = true;
|
|
|
|
|
break;
|
|
|
|
|
}
|
2008-08-13 15:45:57 +00:00
|
|
|
|
// glossiness
|
|
|
|
|
case AI_LWO_GLOS:
|
|
|
|
|
{
|
2014-09-05 03:49:48 +00:00
|
|
|
|
AI_LWO_VALIDATE_CHUNK_LENGTH(head.length,GLOS,4);
|
2008-09-20 15:55:51 +00:00
|
|
|
|
surf.mGlossiness = GetF4();
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
// bump intensity
|
|
|
|
|
case AI_LWO_BUMP:
|
|
|
|
|
{
|
2014-09-05 03:49:48 +00:00
|
|
|
|
AI_LWO_VALIDATE_CHUNK_LENGTH(head.length,BUMP,4);
|
2008-09-20 15:55:51 +00:00
|
|
|
|
surf.mBumpIntensity = GetF4();
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
// color highlights
|
|
|
|
|
case AI_LWO_CLRH:
|
|
|
|
|
{
|
2014-09-05 03:49:48 +00:00
|
|
|
|
AI_LWO_VALIDATE_CHUNK_LENGTH(head.length,CLRH,4);
|
2008-09-20 15:55:51 +00:00
|
|
|
|
surf.mColorHighlights = GetF4();
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
// index of refraction
|
|
|
|
|
case AI_LWO_RIND:
|
|
|
|
|
{
|
2014-09-05 03:49:48 +00:00
|
|
|
|
AI_LWO_VALIDATE_CHUNK_LENGTH(head.length,RIND,4);
|
2008-09-20 15:55:51 +00:00
|
|
|
|
surf.mIOR = GetF4();
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
// polygon sidedness
|
|
|
|
|
case AI_LWO_SIDE:
|
|
|
|
|
{
|
2014-09-05 03:49:48 +00:00
|
|
|
|
AI_LWO_VALIDATE_CHUNK_LENGTH(head.length,SIDE,2);
|
2008-09-20 15:55:51 +00:00
|
|
|
|
surf.bDoubleSided = (3 == GetU2());
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
// maximum smoothing angle
|
|
|
|
|
case AI_LWO_SMAN:
|
|
|
|
|
{
|
2014-09-05 03:49:48 +00:00
|
|
|
|
AI_LWO_VALIDATE_CHUNK_LENGTH(head.length,SMAN,4);
|
General
- Added format auto-detection to most loaders
- Simplified BaseImporter::CanRead() with some utility methods
- improved fast_atof -> no overruns anymore. Fuck you, irrlicht.
- added assimp_cmd tool to allow command line model processing. Mainly adebugging tool for internal purposes, but others might find it useful, too.
- vc8/vc9: revision number is now written to DLL version header
- mkutil: some batch scripts to simplify tagging & building of release versions
- some API cleanup
- fixing some doxygen markup (+now explicit use of @file <filename>)
- Icon for assimp_view and assimp_cmd
3DS
- Normal vectors are not anymore inverted in some cases
- Improved pivot handling
- Improved handling of x-flipped meshes
Collada
- fixed a minor bug (visual_scene element)
LWS
- WIP implementation. No animations yet, some bugs and crashes.
- Animation system remains disabled, WIP code
- many test files for LWS, but most of them test the anim support, which is, read above, currently disabled.
STL
- fixing a log warning which appears for every model
- added binary&ascii test spider, exported from truespace
MD3
- Cleaning up output tags for automatically joined player models.
IRR
- Fixing coordinate system issues.
- Instance handling improved.
- Some of the reported crashes not yet fixed.
PretransformVertices
- Numerous performance improvements.
- Added config option to preserve the hierarchy during the step.
RemoveRedundantMaterials
- Added config option to specify a list of materials which are kept in every case.
UNREAL
- Added support for the old unreal data format (*.a,*.d,*.uc)
- tested only with exports from Milkshape
- more Unreal stuff to come soon
git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@356 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
2009-03-05 22:32:13 +00:00
|
|
|
|
surf.mMaximumSmoothAngle = fabs( GetF4() );
|
2008-08-13 15:45:57 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
2008-11-16 21:56:45 +00:00
|
|
|
|
// vertex color channel to be applied to the surface
|
|
|
|
|
case AI_LWO_VCOL:
|
|
|
|
|
{
|
2014-09-05 03:49:48 +00:00
|
|
|
|
AI_LWO_VALIDATE_CHUNK_LENGTH(head.length,VCOL,12);
|
2008-11-16 21:56:45 +00:00
|
|
|
|
surf.mDiffuseValue *= GetF4(); // strength
|
|
|
|
|
ReadVSizedIntLWO2(mFileBuffer); // skip envelope
|
|
|
|
|
surf.mVCMapType = GetU4(); // type of the channel
|
|
|
|
|
|
|
|
|
|
// name of the channel
|
|
|
|
|
GetS0(surf.mVCMap, (unsigned int) (next - mFileBuffer ));
|
|
|
|
|
break;
|
|
|
|
|
}
|
2008-08-13 15:45:57 +00:00
|
|
|
|
// surface bock entry
|
|
|
|
|
case AI_LWO_BLOK:
|
|
|
|
|
{
|
2014-09-05 03:49:48 +00:00
|
|
|
|
AI_LWO_VALIDATE_CHUNK_LENGTH(head.length,BLOK,4);
|
|
|
|
|
IFF::SubChunkHeader head2 = IFF::LoadSubChunk(mFileBuffer);
|
2008-08-13 15:45:57 +00:00
|
|
|
|
|
2014-09-05 03:49:48 +00:00
|
|
|
|
switch (head2.type)
|
2008-08-13 15:45:57 +00:00
|
|
|
|
{
|
|
|
|
|
case AI_LWO_PROC:
|
|
|
|
|
case AI_LWO_GRAD:
|
2008-09-20 15:55:51 +00:00
|
|
|
|
case AI_LWO_IMAP:
|
2014-09-05 03:49:48 +00:00
|
|
|
|
LoadLWO2TextureBlock(&head2, head.length);
|
2008-09-20 15:55:51 +00:00
|
|
|
|
break;
|
|
|
|
|
case AI_LWO_SHDR:
|
2014-09-05 03:49:48 +00:00
|
|
|
|
LoadLWO2ShaderBlock(&head2, head.length);
|
2008-08-13 15:45:57 +00:00
|
|
|
|
break;
|
2008-09-20 15:55:51 +00:00
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
DefaultLogger::get()->warn("LWO2: Found an unsupported surface BLOK");
|
2008-08-13 15:45:57 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
mFileBuffer = next;
|
|
|
|
|
}
|
|
|
|
|
}
|
2009-01-18 23:48:25 +00:00
|
|
|
|
|
|
|
|
|
#endif // !! ASSIMP_BUILD_NO_X_IMPORTER
|