2008-09-08 16:48:21 +00:00
|
|
|
/*
|
|
|
|
---------------------------------------------------------------------------
|
2012-02-03 03:38:30 +00:00
|
|
|
Open Asset Import Library (assimp)
|
2008-09-08 16:48:21 +00:00
|
|
|
---------------------------------------------------------------------------
|
|
|
|
|
2012-02-03 03:38:30 +00:00
|
|
|
Copyright (c) 2006-2012, assimp team
|
2008-09-08 16:48:21 +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-09-08 16:48:21 +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-09-08 16:48:21 +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 LWO importer class for the older LWOB
|
|
|
|
file formats, including materials */
|
|
|
|
|
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-11-16 21:56:45 +00:00
|
|
|
// Internal headers
|
2008-09-08 16:48:21 +00:00
|
|
|
#include "LWOLoader.h"
|
|
|
|
using namespace Assimp;
|
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
void LWOImporter::LoadLWOBFile()
|
|
|
|
{
|
|
|
|
LE_NCONST uint8_t* const end = mFileBuffer + fileSize;
|
2009-10-10 12:32:23 +00:00
|
|
|
bool running = true;
|
|
|
|
while (running)
|
2008-09-08 16:48:21 +00:00
|
|
|
{
|
|
|
|
if (mFileBuffer + sizeof(IFF::ChunkHeader) > end)break;
|
2014-09-05 03:49:48 +00:00
|
|
|
const IFF::ChunkHeader head = IFF::LoadChunk(mFileBuffer);
|
2008-09-20 15:55:51 +00:00
|
|
|
|
2014-09-05 03:49:48 +00:00
|
|
|
if (mFileBuffer + head.length > end)
|
2008-09-08 16:48:21 +00:00
|
|
|
{
|
2010-03-18 17:00:12 +00:00
|
|
|
throw DeadlyImportError("LWOB: Invalid chunk length");
|
2008-09-08 16:48:21 +00:00
|
|
|
break;
|
|
|
|
}
|
2014-09-05 03:49:48 +00:00
|
|
|
uint8_t* const next = mFileBuffer+head.length;
|
|
|
|
switch (head.type)
|
2008-09-08 16:48:21 +00:00
|
|
|
{
|
|
|
|
// vertex list
|
|
|
|
case AI_LWO_PNTS:
|
|
|
|
{
|
|
|
|
if (!mCurLayer->mTempPoints.empty())
|
|
|
|
DefaultLogger::get()->warn("LWO: PNTS chunk encountered twice");
|
2014-09-05 03:49:48 +00:00
|
|
|
else LoadLWOPoints(head.length);
|
2008-09-08 16:48:21 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
// face list
|
|
|
|
case AI_LWO_POLS:
|
|
|
|
{
|
2014-09-05 03:49:48 +00:00
|
|
|
|
2008-09-08 16:48:21 +00:00
|
|
|
if (!mCurLayer->mFaces.empty())
|
|
|
|
DefaultLogger::get()->warn("LWO: POLS chunk encountered twice");
|
2014-09-05 03:49:48 +00:00
|
|
|
else LoadLWOBPolygons(head.length);
|
2008-09-08 16:48:21 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
// list of tags
|
|
|
|
case AI_LWO_SRFS:
|
|
|
|
{
|
|
|
|
if (!mTags->empty())
|
|
|
|
DefaultLogger::get()->warn("LWO: SRFS chunk encountered twice");
|
2014-09-05 03:49:48 +00:00
|
|
|
else LoadLWOTags(head.length);
|
2008-09-08 16:48:21 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
// surface chunk
|
|
|
|
case AI_LWO_SURF:
|
|
|
|
{
|
2014-09-05 03:49:48 +00:00
|
|
|
LoadLWOBSurface(head.length);
|
2008-09-08 16:48:21 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
mFileBuffer = next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-09-13 11:11:51 +00:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
void LWOImporter::LoadLWOBPolygons(unsigned int length)
|
|
|
|
{
|
|
|
|
// first find out how many faces and vertices we'll finally need
|
|
|
|
LE_NCONST uint16_t* const end = (LE_NCONST uint16_t*)(mFileBuffer+length);
|
|
|
|
LE_NCONST uint16_t* cursor = (LE_NCONST uint16_t*)mFileBuffer;
|
|
|
|
|
|
|
|
// perform endianess conversions
|
|
|
|
#ifndef AI_BUILD_BIG_ENDIAN
|
|
|
|
while (cursor < end)ByteSwap::Swap2(cursor++);
|
|
|
|
cursor = (LE_NCONST uint16_t*)mFileBuffer;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
unsigned int iNumFaces = 0,iNumVertices = 0;
|
|
|
|
CountVertsAndFacesLWOB(iNumVertices,iNumFaces,cursor,end);
|
|
|
|
|
|
|
|
// allocate the output array and copy face indices
|
|
|
|
if (iNumFaces)
|
|
|
|
{
|
|
|
|
cursor = (LE_NCONST uint16_t*)mFileBuffer;
|
|
|
|
|
|
|
|
mCurLayer->mFaces.resize(iNumFaces);
|
|
|
|
FaceList::iterator it = mCurLayer->mFaces.begin();
|
|
|
|
CopyFaceIndicesLWOB(it,cursor,end);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-09-08 16:48:21 +00:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
void LWOImporter::CountVertsAndFacesLWOB(unsigned int& verts, unsigned int& faces,
|
|
|
|
LE_NCONST uint16_t*& cursor, const uint16_t* const end, unsigned int max)
|
|
|
|
{
|
|
|
|
while (cursor < end && max--)
|
|
|
|
{
|
2014-09-05 03:49:48 +00:00
|
|
|
uint16_t numIndices;
|
2015-01-27 21:47:22 +00:00
|
|
|
// must have 2 shorts left for numIndices and surface
|
|
|
|
if (end - cursor < 2) {
|
|
|
|
throw DeadlyImportError("LWOB: Unexpected end of file");
|
|
|
|
}
|
2014-09-05 03:49:48 +00:00
|
|
|
::memcpy(&numIndices, cursor++, 2);
|
2015-01-27 21:47:22 +00:00
|
|
|
// must have enough left for indices and surface
|
|
|
|
if (end - cursor < (1 + numIndices)) {
|
|
|
|
throw DeadlyImportError("LWOB: Unexpected end of file");
|
|
|
|
}
|
2014-09-05 03:49:48 +00:00
|
|
|
verts += numIndices;
|
|
|
|
faces++;
|
2008-09-08 16:48:21 +00:00
|
|
|
cursor += numIndices;
|
2014-09-05 03:49:48 +00:00
|
|
|
int16_t surface;
|
|
|
|
::memcpy(&surface, cursor++, 2);
|
2008-09-08 16:48:21 +00:00
|
|
|
if (surface < 0)
|
|
|
|
{
|
|
|
|
// there are detail polygons
|
2014-09-05 03:49:48 +00:00
|
|
|
::memcpy(&numIndices, cursor++, 2);
|
2008-09-08 16:48:21 +00:00
|
|
|
CountVertsAndFacesLWOB(verts,faces,cursor,end,numIndices);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
void LWOImporter::CopyFaceIndicesLWOB(FaceList::iterator& it,
|
|
|
|
LE_NCONST uint16_t*& cursor,
|
|
|
|
const uint16_t* const end,
|
|
|
|
unsigned int max)
|
|
|
|
{
|
|
|
|
while (cursor < end && max--)
|
|
|
|
{
|
|
|
|
LWO::Face& face = *it;++it;
|
2014-09-05 03:49:48 +00:00
|
|
|
uint16_t numIndices;
|
|
|
|
::memcpy(&numIndices, cursor++, 2);
|
|
|
|
face.mNumIndices = numIndices;
|
|
|
|
if(face.mNumIndices)
|
2008-09-08 16:48:21 +00:00
|
|
|
{
|
2014-09-05 03:49:48 +00:00
|
|
|
if (cursor + face.mNumIndices >= end)
|
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
2008-09-08 16:48:21 +00:00
|
|
|
face.mIndices = new unsigned int[face.mNumIndices];
|
|
|
|
for (unsigned int i = 0; i < face.mNumIndices;++i)
|
|
|
|
{
|
2014-09-05 03:49:48 +00:00
|
|
|
unsigned int & mi = face.mIndices[i];
|
|
|
|
uint16_t index;
|
|
|
|
::memcpy(&index, cursor++, 2);
|
|
|
|
mi = index;
|
2008-09-08 16:48:21 +00:00
|
|
|
if (mi > mCurLayer->mTempPoints.size())
|
|
|
|
{
|
|
|
|
DefaultLogger::get()->warn("LWOB: face index is out of range");
|
|
|
|
mi = (unsigned int)mCurLayer->mTempPoints.size()-1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else DefaultLogger::get()->warn("LWOB: Face has 0 indices");
|
2014-09-05 03:49:48 +00:00
|
|
|
int16_t surface;
|
|
|
|
::memcpy(&surface, cursor++, 2);
|
2008-09-08 16:48:21 +00:00
|
|
|
if (surface < 0)
|
|
|
|
{
|
|
|
|
surface = -surface;
|
|
|
|
|
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
|
|
|
// there are detail polygons.
|
2014-09-05 03:49:48 +00:00
|
|
|
uint16_t numPolygons;
|
|
|
|
::memcpy(&numPolygons, cursor++, 2);
|
|
|
|
if (cursor < end)
|
|
|
|
{
|
|
|
|
CopyFaceIndicesLWOB(it,cursor,end,numPolygons);
|
|
|
|
}
|
2008-09-08 16:48:21 +00:00
|
|
|
}
|
|
|
|
face.surfaceIndex = surface-1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-09-27 16:46:05 +00:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
LWO::Texture* LWOImporter::SetupNewTextureLWOB(LWO::TextureList& list,unsigned int size)
|
|
|
|
{
|
|
|
|
list.push_back(LWO::Texture());
|
|
|
|
LWO::Texture* tex = &list.back();
|
|
|
|
|
|
|
|
std::string type;
|
|
|
|
GetS0(type,size);
|
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 char* s = type.c_str();
|
|
|
|
|
|
|
|
if(strstr(s, "Image Map"))
|
|
|
|
{
|
|
|
|
// Determine mapping type
|
|
|
|
if(strstr(s, "Planar"))
|
|
|
|
tex->mapMode = LWO::Texture::Planar;
|
|
|
|
else if(strstr(s, "Cylindrical"))
|
|
|
|
tex->mapMode = LWO::Texture::Cylindrical;
|
|
|
|
else if(strstr(s, "Spherical"))
|
|
|
|
tex->mapMode = LWO::Texture::Spherical;
|
|
|
|
else if(strstr(s, "Cubic"))
|
|
|
|
tex->mapMode = LWO::Texture::Cubic;
|
|
|
|
else if(strstr(s, "Front"))
|
|
|
|
tex->mapMode = LWO::Texture::FrontProjection;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// procedural or gradient, not supported
|
|
|
|
DefaultLogger::get()->error("LWOB: Unsupported legacy texture: " + type);
|
|
|
|
}
|
2008-09-27 16:46:05 +00:00
|
|
|
|
|
|
|
return tex;
|
|
|
|
}
|
|
|
|
|
2008-09-08 16:48:21 +00:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
void LWOImporter::LoadLWOBSurface(unsigned int size)
|
|
|
|
{
|
|
|
|
LE_NCONST uint8_t* const end = mFileBuffer + size;
|
|
|
|
|
|
|
|
mSurfaces->push_back( LWO::Surface () );
|
|
|
|
LWO::Surface& surf = mSurfaces->back();
|
|
|
|
LWO::Texture* pTex = NULL;
|
|
|
|
|
2008-09-20 15:55:51 +00:00
|
|
|
GetS0(surf.mName,size);
|
2009-10-10 12:32:23 +00:00
|
|
|
bool runnning = true;
|
|
|
|
while (runnning) {
|
2009-03-26 22:05:56 +00:00
|
|
|
if (mFileBuffer + 6 >= end)
|
|
|
|
break;
|
2008-09-20 15:55:51 +00:00
|
|
|
|
2014-09-05 03:49:48 +00:00
|
|
|
IFF::SubChunkHeader head = IFF::LoadSubChunk(mFileBuffer);
|
2009-03-26 22:05:56 +00:00
|
|
|
|
|
|
|
/* A single test file (sonycam.lwo) seems to have invalid surface chunks.
|
|
|
|
* I'm assuming it's the fault of a single, unknown exporter so there are
|
|
|
|
* probably THOUSANDS of them. Here's a dirty workaround:
|
|
|
|
*
|
|
|
|
* We don't break if the chunk limit is exceeded. Instead, we're computing
|
|
|
|
* how much storage is actually left and work with this value from now on.
|
|
|
|
*/
|
2014-09-05 03:49:48 +00:00
|
|
|
if (mFileBuffer + head.length > end) {
|
2009-03-26 22:05:56 +00:00
|
|
|
DefaultLogger::get()->error("LWOB: Invalid surface chunk length. Trying to continue.");
|
2014-09-05 03:49:48 +00:00
|
|
|
head.length = (uint16_t) (end - mFileBuffer);
|
2009-03-26 22:05:56 +00:00
|
|
|
}
|
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-08 16:48:21 +00:00
|
|
|
{
|
|
|
|
// diffuse color
|
|
|
|
case AI_LWO_COLR:
|
|
|
|
{
|
2014-09-05 03:49:48 +00:00
|
|
|
AI_LWO_VALIDATE_CHUNK_LENGTH(head.length,COLR,3);
|
2008-09-20 15:55:51 +00:00
|
|
|
surf.mColor.r = GetU1() / 255.0f;
|
|
|
|
surf.mColor.g = GetU1() / 255.0f;
|
|
|
|
surf.mColor.b = GetU1() / 255.0f;
|
2008-09-08 16:48:21 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
// diffuse strength ...
|
|
|
|
case AI_LWO_DIFF:
|
|
|
|
{
|
2014-09-05 03:49:48 +00:00
|
|
|
AI_LWO_VALIDATE_CHUNK_LENGTH(head.length,DIFF,2);
|
2008-09-20 15:55:51 +00:00
|
|
|
surf.mDiffuseValue = GetU2() / 255.0f;
|
2008-09-08 16:48:21 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
// specular strength ...
|
|
|
|
case AI_LWO_SPEC:
|
|
|
|
{
|
2014-09-05 03:49:48 +00:00
|
|
|
AI_LWO_VALIDATE_CHUNK_LENGTH(head.length,SPEC,2);
|
2008-09-20 15:55:51 +00:00
|
|
|
surf.mSpecularValue = GetU2() / 255.0f;
|
2008-09-08 16:48:21 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
// luminosity ...
|
|
|
|
case AI_LWO_LUMI:
|
|
|
|
{
|
2014-09-05 03:49:48 +00:00
|
|
|
AI_LWO_VALIDATE_CHUNK_LENGTH(head.length,LUMI,2);
|
2008-09-20 15:55:51 +00:00
|
|
|
surf.mLuminosity = GetU2() / 255.0f;
|
2008-09-08 16:48:21 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
// transparency
|
|
|
|
case AI_LWO_TRAN:
|
|
|
|
{
|
2014-09-05 03:49:48 +00:00
|
|
|
AI_LWO_VALIDATE_CHUNK_LENGTH(head.length,TRAN,2);
|
2008-09-20 15:55:51 +00:00
|
|
|
surf.mTransparency = GetU2() / 255.0f;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
// surface flags
|
|
|
|
case AI_LWO_FLAG:
|
|
|
|
{
|
2014-09-05 03:49:48 +00:00
|
|
|
AI_LWO_VALIDATE_CHUNK_LENGTH(head.length,FLAG,2);
|
2008-09-20 15:55:51 +00:00
|
|
|
uint16_t flag = GetU2();
|
|
|
|
if (flag & 0x4 ) surf.mMaximumSmoothAngle = 1.56207f;
|
|
|
|
if (flag & 0x8 ) surf.mColorHighlights = 1.f;
|
|
|
|
if (flag & 0x100) surf.bDoubleSided = true;
|
|
|
|
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);
|
2014-09-22 22:42:32 +00:00
|
|
|
surf.mMaximumSmoothAngle = std::fabs( GetF4() );
|
2008-09-08 16:48:21 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
// glossiness
|
|
|
|
case AI_LWO_GLOS:
|
|
|
|
{
|
2014-09-05 03:49:48 +00:00
|
|
|
AI_LWO_VALIDATE_CHUNK_LENGTH(head.length,GLOS,2);
|
2008-09-20 15:55:51 +00:00
|
|
|
surf.mGlossiness = (float)GetU2();
|
2008-09-08 16:48:21 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
// color texture
|
|
|
|
case AI_LWO_CTEX:
|
|
|
|
{
|
2008-09-27 16:46:05 +00:00
|
|
|
pTex = SetupNewTextureLWOB(surf.mColorTextures,
|
2014-09-05 03:49:48 +00:00
|
|
|
head.length);
|
2008-09-08 16:48:21 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
// diffuse texture
|
|
|
|
case AI_LWO_DTEX:
|
|
|
|
{
|
2008-09-27 16:46:05 +00:00
|
|
|
pTex = SetupNewTextureLWOB(surf.mDiffuseTextures,
|
2014-09-05 03:49:48 +00:00
|
|
|
head.length);
|
2008-09-08 16:48:21 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
// specular texture
|
|
|
|
case AI_LWO_STEX:
|
|
|
|
{
|
2008-09-27 16:46:05 +00:00
|
|
|
pTex = SetupNewTextureLWOB(surf.mSpecularTextures,
|
2014-09-05 03:49:48 +00:00
|
|
|
head.length);
|
2008-09-08 16:48:21 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
// bump texture
|
|
|
|
case AI_LWO_BTEX:
|
|
|
|
{
|
2008-09-27 16:46:05 +00:00
|
|
|
pTex = SetupNewTextureLWOB(surf.mBumpTextures,
|
2014-09-05 03:49:48 +00:00
|
|
|
head.length);
|
2008-09-08 16:48:21 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
// transparency texture
|
|
|
|
case AI_LWO_TTEX:
|
|
|
|
{
|
2008-09-27 16:46:05 +00:00
|
|
|
pTex = SetupNewTextureLWOB(surf.mOpacityTextures,
|
2014-09-05 03:49:48 +00:00
|
|
|
head.length);
|
2008-09-08 16:48:21 +00:00
|
|
|
break;
|
|
|
|
}
|
2008-09-27 16:46:05 +00:00
|
|
|
// texture path
|
2008-09-08 16:48:21 +00:00
|
|
|
case AI_LWO_TIMG:
|
|
|
|
{
|
2009-03-26 22:05:56 +00:00
|
|
|
if (pTex) {
|
2014-09-05 03:49:48 +00:00
|
|
|
GetS0(pTex->mFileName,head.length);
|
2008-09-08 16:48:21 +00:00
|
|
|
}
|
General
- Added format auto-detection to most loaders
- Simplified BaseImporter::CanRead() with some utility methods
- improved fast_atof -> no overruns anymore. Fuck you, irrlicht.
- added assimp_cmd tool to allow command line model processing. Mainly adebugging tool for internal purposes, but others might find it useful, too.
- vc8/vc9: revision number is now written to DLL version header
- mkutil: some batch scripts to simplify tagging & building of release versions
- some API cleanup
- fixing some doxygen markup (+now explicit use of @file <filename>)
- Icon for assimp_view and assimp_cmd
3DS
- Normal vectors are not anymore inverted in some cases
- Improved pivot handling
- Improved handling of x-flipped meshes
Collada
- fixed a minor bug (visual_scene element)
LWS
- WIP implementation. No animations yet, some bugs and crashes.
- Animation system remains disabled, WIP code
- many test files for LWS, but most of them test the anim support, which is, read above, currently disabled.
STL
- fixing a log warning which appears for every model
- added binary&ascii test spider, exported from truespace
MD3
- Cleaning up output tags for automatically joined player models.
IRR
- Fixing coordinate system issues.
- Instance handling improved.
- Some of the reported crashes not yet fixed.
PretransformVertices
- Numerous performance improvements.
- Added config option to preserve the hierarchy during the step.
RemoveRedundantMaterials
- Added config option to specify a list of materials which are kept in every case.
UNREAL
- Added support for the old unreal data format (*.a,*.d,*.uc)
- tested only with exports from Milkshape
- more Unreal stuff to come soon
git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@356 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
2009-03-05 22:32:13 +00:00
|
|
|
else DefaultLogger::get()->warn("LWOB: Unexpected TIMG chunk");
|
2008-09-08 16:48:21 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
// texture strength
|
|
|
|
case AI_LWO_TVAL:
|
|
|
|
{
|
2014-09-05 03:49:48 +00:00
|
|
|
AI_LWO_VALIDATE_CHUNK_LENGTH(head.length,TVAL,1);
|
2009-03-26 22:05:56 +00:00
|
|
|
if (pTex) {
|
|
|
|
pTex->mStrength = (float)GetU1()/ 255.f;
|
|
|
|
}
|
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 DefaultLogger::get()->warn("LWOB: Unexpected TVAL chunk");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
// texture flags
|
|
|
|
case AI_LWO_TFLG:
|
|
|
|
{
|
2014-09-05 03:49:48 +00:00
|
|
|
AI_LWO_VALIDATE_CHUNK_LENGTH(head.length,TFLG,2);
|
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 (pTex)
|
|
|
|
{
|
|
|
|
const uint16_t s = GetU2();
|
|
|
|
if (s & 1)
|
|
|
|
pTex->majorAxis = LWO::Texture::AXIS_X;
|
|
|
|
else if (s & 2)
|
|
|
|
pTex->majorAxis = LWO::Texture::AXIS_Y;
|
|
|
|
else if (s & 4)
|
|
|
|
pTex->majorAxis = LWO::Texture::AXIS_Z;
|
|
|
|
|
|
|
|
if (s & 16)
|
|
|
|
DefaultLogger::get()->warn("LWOB: Ignoring \'negate\' flag on texture");
|
|
|
|
}
|
|
|
|
else DefaultLogger::get()->warn("LWOB: Unexpected TFLG chunk");
|
2008-09-08 16:48:21 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
mFileBuffer = next;
|
|
|
|
}
|
2008-09-12 20:25:11 +00:00
|
|
|
}
|
2009-01-18 23:48:25 +00:00
|
|
|
|
|
|
|
#endif // !! ASSIMP_BUILD_NO_LWO_IMPORTER
|