aramis_acg 2010-03-18 17:20:49 +00:00
parent 762a7df46a
commit 50264941dd
4 changed files with 24 additions and 5 deletions

View File

@ -118,6 +118,7 @@ namespace LWO {
#define AI_LWO_PTCH AI_IFF_FOURCC('P','T','C','H') #define AI_LWO_PTCH AI_IFF_FOURCC('P','T','C','H')
#define AI_LWO_MBAL AI_IFF_FOURCC('M','B','A','L') #define AI_LWO_MBAL AI_IFF_FOURCC('M','B','A','L')
#define AI_LWO_BONE AI_IFF_FOURCC('B','O','N','E') #define AI_LWO_BONE AI_IFF_FOURCC('B','O','N','E')
#define AI_LWO_SUBD AI_IFF_FOURCC('S','U','B','D')
/* polygon tags */ /* polygon tags */
#define AI_LWO_SURF AI_IFF_FOURCC('S','U','R','F') #define AI_LWO_SURF AI_IFF_FOURCC('S','U','R','F')

View File

@ -149,15 +149,17 @@ void LWOImporter::InternReadFile( const std::string& pFile,
DefaultLogger::get()->info("LWO file format: LWOB (<= LightWave 5.5)"); DefaultLogger::get()->info("LWO file format: LWOB (<= LightWave 5.5)");
mIsLWO2 = false; mIsLWO2 = false;
mIsLXOB = false;
LoadLWOBFile(); LoadLWOBFile();
} }
// New lightwave format // New lightwave format
else if (AI_LWO_FOURCC_LWO2 == fileType) { else if (AI_LWO_FOURCC_LWO2 == fileType) {
mIsLXOB = false;
DefaultLogger::get()->info("LWO file format: LWO2 (>= LightWave 6)"); DefaultLogger::get()->info("LWO file format: LWO2 (>= LightWave 6)");
} }
// MODO file format // MODO file format
else if (AI_LWO_FOURCC_LXOB == fileType) { else if (AI_LWO_FOURCC_LXOB == fileType) {
mIsLXOB = true;
DefaultLogger::get()->info("LWO file format: LXOB (Modo)"); DefaultLogger::get()->info("LWO file format: LXOB (Modo)");
} }
// we don't know this format // we don't know this format
@ -727,9 +729,6 @@ void LWOImporter::LoadLWO2Polygons(unsigned int length)
switch (type) switch (type)
{ {
// read unsupported stuff too (although we wont process it) // read unsupported stuff too (although we wont process it)
case AI_LWO_BONE:
DefaultLogger::get()->warn("LWO2: Encountered unsupported primitive chunk (BONE)");
break;
case AI_LWO_MBAL: case AI_LWO_MBAL:
DefaultLogger::get()->warn("LWO2: Encountered unsupported primitive chunk (METABALL)"); DefaultLogger::get()->warn("LWO2: Encountered unsupported primitive chunk (METABALL)");
break; break;
@ -740,6 +739,8 @@ void LWOImporter::LoadLWO2Polygons(unsigned int length)
// These are ok with no restrictions // These are ok with no restrictions
case AI_LWO_PTCH: case AI_LWO_PTCH:
case AI_LWO_FACE: case AI_LWO_FACE:
case AI_LWO_BONE:
case AI_LWO_SUBD:
break; break;
default: default:
@ -1144,6 +1145,18 @@ void LWOImporter::LoadLWO2Envelope(unsigned int length)
// Get the index of the envelope // Get the index of the envelope
envelope.index = ReadVSizedIntLWO2(mFileBuffer); envelope.index = ReadVSizedIntLWO2(mFileBuffer);
// It looks like there might be an extra U4 right after the index,
// at least in modo (LXOB) files: we'll ignore it if it's zero,
// otherwise it represents the start of a subchunk, so we backtrack.
if (mIsLXOB)
{
uint32_t extra = GetU4();
if (extra)
{
mFileBuffer -= 4;
}
}
// ... and read all subchunks // ... and read all subchunks
while (true) while (true)
{ {

View File

@ -363,6 +363,9 @@ protected:
/** true if the file is a LWO2 file*/ /** true if the file is a LWO2 file*/
bool mIsLWO2; bool mIsLWO2;
/** true if the file is a LXOB file*/
bool mIsLXOB;
/** Temporary list of layers from the file */ /** Temporary list of layers from the file */
LayerList* mLayers; LayerList* mLayers;

View File

@ -19,7 +19,8 @@
* for internal or external distribution as long as this notice * for internal or external distribution as long as this notice
* remains attached. * remains attached.
*/ */
#ifndef CONVERTUTF_H
#define CONVERTUTF_H
/* --------------------------------------------------------------------- /* ---------------------------------------------------------------------
Conversions between UTF32, UTF-16, and UTF-8. Header file. Conversions between UTF32, UTF-16, and UTF-8. Header file.
@ -147,3 +148,4 @@ Boolean isLegalUTF8Sequence(const UTF8 *source, const UTF8 *sourceEnd);
#endif #endif
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */
#endif // CONVERTUTF_H