- refraing from using magic numbers like 0xffffffff all over the repository, rather use UINT_MAX/SIZE_MAX ..

- minor re-formatting and refactoring at some old code spots.

git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@970 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
pull/1/head
aramis_acg 2011-04-22 21:29:18 +00:00
parent 14c6467aac
commit 6f30639d7f
40 changed files with 194 additions and 190 deletions

View File

@ -1887,7 +1887,7 @@ void Parser::ParseLV3MeshNormalListBlock(ASE::Mesh& sMesh)
// Allocate enough storage for the normals // Allocate enough storage for the normals
sMesh.mNormals.resize(sMesh.mFaces.size()*3,aiVector3D( 0.f, 0.f, 0.f )); sMesh.mNormals.resize(sMesh.mFaces.size()*3,aiVector3D( 0.f, 0.f, 0.f ));
unsigned int index, faceIdx = 0xffffffff; unsigned int index, faceIdx = UINT_MAX;
// FIXME: rewrite this and find out how to interpret the normals // FIXME: rewrite this and find out how to interpret the normals
// correctly. This is crap. // correctly. This is crap.
@ -1897,7 +1897,7 @@ void Parser::ParseLV3MeshNormalListBlock(ASE::Mesh& sMesh)
while (true) { while (true) {
if ('*' == *filePtr) { if ('*' == *filePtr) {
++filePtr; ++filePtr;
if (faceIdx != 0xffffffff && TokenMatch(filePtr,"MESH_VERTEXNORMAL",17)) { if (faceIdx != UINT_MAX && TokenMatch(filePtr,"MESH_VERTEXNORMAL",17)) {
aiVector3D vNormal; aiVector3D vNormal;
ParseLV4MeshFloatTriple(&vNormal.x,index); ParseLV4MeshFloatTriple(&vNormal.x,index);
if (faceIdx >= sMesh.mFaces.size()) if (faceIdx >= sMesh.mFaces.size())

View File

@ -71,7 +71,7 @@ struct Face
/** COB chunk header information */ /** COB chunk header information */
struct ChunkInfo struct ChunkInfo
{ {
enum {NO_SIZE=0xffffffff}; enum {NO_SIZE=UINT_MAX};
ChunkInfo () ChunkInfo ()
: id (0) : id (0)
@ -218,7 +218,7 @@ struct Material : ChunkInfo
}; };
Material() : alpha(),exp(),ior(),ka(),ks(1.f), Material() : alpha(),exp(),ior(),ka(),ks(1.f),
matnum(0xffffffff), matnum(UINT_MAX),
shader(FLAT),autofacet(FACETED), shader(FLAT),autofacet(FACETED),
autofacet_angle() autofacet_angle()
{} {}

View File

@ -429,7 +429,7 @@ struct Sampler
, mMirrorU () , mMirrorU ()
, mMirrorV () , mMirrorV ()
, mOp (aiTextureOp_Multiply) , mOp (aiTextureOp_Multiply)
, mUVId (0xffffffff) , mUVId (UINT_MAX)
, mWeighting (1.f) , mWeighting (1.f)
, mMixWithPrevious (1.f) , mMixWithPrevious (1.f)
{} {}
@ -466,7 +466,7 @@ struct Sampler
*/ */
std::string mUVChannel; std::string mUVChannel;
/** Resolved UV channel index or 0xffffffff if not known /** Resolved UV channel index or UINT_MAX if not known
*/ */
unsigned int mUVId; unsigned int mUVId;

View File

@ -948,13 +948,14 @@ void ColladaLoader::CreateAnimation( aiScene* pScene, const ColladaParser& pPars
} }
// determine which transform step is affected by this channel // determine which transform step is affected by this channel
entry.mTransformIndex = 0xffffffff; entry.mTransformIndex = SIZE_MAX;
for( size_t a = 0; a < srcNode->mTransforms.size(); ++a) for( size_t a = 0; a < srcNode->mTransforms.size(); ++a)
if( srcNode->mTransforms[a].mID == entry.mTransformId) if( srcNode->mTransforms[a].mID == entry.mTransformId)
entry.mTransformIndex = a; entry.mTransformIndex = a;
if( entry.mTransformIndex == 0xffffffff) if( entry.mTransformIndex == SIZE_MAX) {
continue; continue;
}
entry.mChannel = &(*cit); entry.mChannel = &(*cit);
entries.push_back( entry); entries.push_back( entry);
@ -1154,12 +1155,12 @@ void ColladaLoader::AddTexture ( Assimp::MaterialHelper& mat, const ColladaParse
mat.AddProperty((float*)&sampler.mWeighting , 1, mat.AddProperty((float*)&sampler.mWeighting , 1,
_AI_MATKEY_TEXBLEND_BASE, type, idx); _AI_MATKEY_TEXBLEND_BASE, type, idx);
// UV source index ... if we didn't resolve the mapping it is actually just // UV source index ... if we didn't resolve the mapping, it is actually just
// a guess but it works in most cases. We search for the frst occurence of a // a guess but it works in most cases. We search for the frst occurence of a
// number in the channel name. We assume it is the zero-based index into the // number in the channel name. We assume it is the zero-based index into the
// UV channel array of all corresponding meshes. It could also be one-based // UV channel array of all corresponding meshes. It could also be one-based
// for some exporters, but we won't care of it unless someone complains about. // for some exporters, but we won't care of it unless someone complains about.
if (sampler.mUVId != 0xffffffff) if (sampler.mUVId != UINT_MAX)
map = sampler.mUVId; map = sampler.mUVId;
else { else {
map = -1; map = -1;
@ -1289,16 +1290,6 @@ void ColladaLoader::BuildMaterials( const ColladaParser& pParser, aiScene* pScen
aiString name( matIt->first); aiString name( matIt->first);
mat->AddProperty(&name,AI_MATKEY_NAME); mat->AddProperty(&name,AI_MATKEY_NAME);
// MEGA SUPER MONSTER HACK by Alex ... It's all my fault, yes.
// We store the reference to the effect in the material and
// return ... we'll add the actual material properties later
// after we processed all meshes. During mesh processing,
// we evaluate vertex input mappings. Afterwards we should be
// able to correctly setup source UV channels for textures.
// ... moved to ColladaLoader::FillMaterials()
// *duck*
// store the material // store the material
mMaterialIndexByName[matIt->first] = newMats.size(); mMaterialIndexByName[matIt->first] = newMats.size();
newMats.push_back( std::pair<Collada::Effect*, aiMaterial*>(const_cast<Collada::Effect*>(&effect),mat) ); newMats.push_back( std::pair<Collada::Effect*, aiMaterial*>(const_cast<Collada::Effect*>(&effect),mat) );

View File

@ -1968,7 +1968,7 @@ void ColladaParser::ReadPrimitives( Mesh* pMesh, std::vector<InputChannel>& pPer
// determine number of indices coming per vertex // determine number of indices coming per vertex
// find the offset index for all per-vertex channels // find the offset index for all per-vertex channels
size_t numOffsets = 1; size_t numOffsets = 1;
size_t perVertexOffset = 0xffffffff; // invalid value size_t perVertexOffset = SIZE_MAX; // invalid value
BOOST_FOREACH( const InputChannel& channel, pPerIndexChannels) BOOST_FOREACH( const InputChannel& channel, pPerIndexChannels)
{ {
numOffsets = std::max( numOffsets, channel.mOffset+1); numOffsets = std::max( numOffsets, channel.mOffset+1);

View File

@ -98,7 +98,7 @@ inline unsigned int FindEmptyUVChannel (aiMesh* mesh)
if (!mesh->mTextureCoords[m])return m; if (!mesh->mTextureCoords[m])return m;
DefaultLogger::get()->error("Unable to compute UV coordinates, no free UV slot found"); DefaultLogger::get()->error("Unable to compute UV coordinates, no free UV slot found");
return 0xffffffff; return UINT_MAX;
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
@ -455,7 +455,7 @@ void ComputeUVMappingProcess::Execute( aiScene* pScene)
{ {
aiMesh* mesh = pScene->mMeshes[m]; aiMesh* mesh = pScene->mMeshes[m];
unsigned int outIdx; unsigned int outIdx;
if ( mesh->mMaterialIndex != i || ( outIdx = FindEmptyUVChannel(mesh) ) == 0xffffffff || if ( mesh->mMaterialIndex != i || ( outIdx = FindEmptyUVChannel(mesh) ) == UINT_MAX ||
!mesh->mNumVertices) !mesh->mNumVertices)
{ {
continue; continue;

View File

@ -108,7 +108,7 @@ size_t DefaultIOStream::FileSize() const
return 0; return 0;
} }
if (0xffffffff == cachedSize) { if (SIZE_MAX == cachedSize) {
// TODO: Is that really faster if we're already owning a handle to the file? // TODO: Is that really faster if we're already owning a handle to the file?
#if defined _WIN32 && !defined __GNUC__ #if defined _WIN32 && !defined __GNUC__

View File

@ -110,7 +110,7 @@ private:
inline DefaultIOStream::DefaultIOStream () : inline DefaultIOStream::DefaultIOStream () :
mFile (NULL), mFile (NULL),
mFilename (""), mFilename (""),
cachedSize (0xffffffff) cachedSize (SIZE_MAX)
{ {
// empty // empty
} }
@ -121,7 +121,7 @@ inline DefaultIOStream::DefaultIOStream (FILE* pFile,
const std::string &strFilename) : const std::string &strFilename) :
mFile(pFile), mFile(pFile),
mFilename(strFilename), mFilename(strFilename),
cachedSize (0xffffffff) cachedSize (SIZE_MAX)
{ {
// empty // empty
} }

View File

@ -50,6 +50,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "ParsingUtils.h" #include "ParsingUtils.h"
namespace Assimp { namespace Assimp {
inline bool IsHex(char s) {
return (s>='0' && s<='9') || (s>='a' && s<='f') || (s>='A' && s<='F');
}
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
/** File system filter /** File system filter
*/ */
@ -226,9 +230,8 @@ private:
else if (*it == '%' && in.end() - it > 2) { else if (*it == '%' && in.end() - it > 2) {
// Hex sequence in URIs // Hex sequence in URIs
uint32_t tmp; if( IsHex((&*it)[0]) && IsHex((&*it)[1]) ) {
if( 0xffffffff != (tmp = HexOctetToDecimal(&*it))) { *it = HexOctetToDecimal(&*it);
*it = (char)tmp;
it = in.erase(it+1,it+2); it = in.erase(it+1,it+2);
--it; --it;
} }

View File

@ -90,7 +90,7 @@ void UpdateMeshReferences(aiNode* node, const std::vector<unsigned int>& meshMap
for (unsigned int a = 0; a < node->mNumMeshes;++a) { for (unsigned int a = 0; a < node->mNumMeshes;++a) {
register unsigned int ref = node->mMeshes[a]; register unsigned int ref = node->mMeshes[a];
if (0xffffffff != (ref = meshMapping[ref])) { if (UINT_MAX != (ref = meshMapping[ref])) {
node->mMeshes[out++] = ref; node->mMeshes[out++] = ref;
} }
} }
@ -130,7 +130,7 @@ void FindInvalidDataProcess::Execute( aiScene* pScene)
delete pScene->mMeshes[a]; delete pScene->mMeshes[a];
AI_DEBUG_INVALIDATE_PTR(pScene->mMeshes[a]); AI_DEBUG_INVALIDATE_PTR(pScene->mMeshes[a]);
meshMapping[a] = 0xffffffff; meshMapping[a] = UINT_MAX;
continue; continue;
} }
} }

View File

@ -243,7 +243,7 @@ void IRRImporter::CopyMaterial(std::vector<aiMaterial*>& materials,
{ {
if (inmaterials.empty()) { if (inmaterials.empty()) {
// Do we have a default material? If not we need to create one // Do we have a default material? If not we need to create one
if (0xffffffff == defMatIdx) if (UINT_MAX == defMatIdx)
{ {
defMatIdx = (unsigned int)materials.size(); defMatIdx = (unsigned int)materials.size();
MaterialHelper* mat = new MaterialHelper(); MaterialHelper* mat = new MaterialHelper();
@ -1397,7 +1397,7 @@ void IRRImporter::InternReadFile( const std::string& pFile,
/* Now process our scenegraph recursively: generate final /* Now process our scenegraph recursively: generate final
* meshes and generate animation channels for all nodes. * meshes and generate animation channels for all nodes.
*/ */
unsigned int defMatIdx = 0xffffffff; unsigned int defMatIdx = UINT_MAX;
GenerateGraph(root,tempScene->mRootNode, tempScene, GenerateGraph(root,tempScene->mRootNode, tempScene,
batch, meshes, anims, attach, materials, defMatIdx); batch, meshes, anims, attach, materials, defMatIdx);

View File

@ -279,7 +279,7 @@ private:
* *
* @param materials Receives an output material * @param materials Receives an output material
* @param inmaterials List of input materials * @param inmaterials List of input materials
* @param defMatIdx Default material index - 0xffffffff if not there * @param defMatIdx Default material index - UINT_MAX if not present
* @param mesh Mesh to work on * @param mesh Mesh to work on
*/ */
void CopyMaterial(std::vector<aiMaterial*>& materials, void CopyMaterial(std::vector<aiMaterial*>& materials,

View File

@ -431,10 +431,10 @@ struct Texture
}; };
Texture() Texture()
: mClipIdx(0xffffffff) : mClipIdx(UINT_MAX)
, mStrength (1.0f) , mStrength (1.0f)
, mUVChannelIndex ("unknown") , mUVChannelIndex ("unknown")
, mRealUVIndex (0xffffffff) , mRealUVIndex (UINT_MAX)
, enabled (true) , enabled (true)
, blendType (Additive) , blendType (Additive)
, bCanUse (true) , bCanUse (true)
@ -645,7 +645,7 @@ struct Layer
PointList mTempPoints; PointList mTempPoints;
/** Lists for every point the index of another point /** Lists for every point the index of another point
that has been copied from *this* point or 0xffffffff if that has been copied from *this* point or UINT_MAX if
no copy of the point has been made */ no copy of the point has been made */
ReferrerList mPointReferrers; ReferrerList mPointReferrers;

View File

@ -91,7 +91,7 @@ bool LWOImporter::CanRead( const std::string& pFile, IOSystem* pIOHandler, bool
void LWOImporter::SetupProperties(const Importer* pImp) void LWOImporter::SetupProperties(const Importer* pImp)
{ {
configSpeedFlag = ( 0 != pImp->GetPropertyInteger(AI_CONFIG_FAVOUR_SPEED,0) ? true : false); configSpeedFlag = ( 0 != pImp->GetPropertyInteger(AI_CONFIG_FAVOUR_SPEED,0) ? true : false);
configLayerIndex = pImp->GetPropertyInteger (AI_CONFIG_IMPORT_LWO_ONE_LAYER_ONLY,0xffffffff); configLayerIndex = pImp->GetPropertyInteger (AI_CONFIG_IMPORT_LWO_ONE_LAYER_ONLY,UINT_MAX);
configLayerName = pImp->GetPropertyString (AI_CONFIG_IMPORT_LWO_ONE_LAYER_ONLY,""); configLayerName = pImp->GetPropertyString (AI_CONFIG_IMPORT_LWO_ONE_LAYER_ONLY,"");
} }
@ -181,7 +181,7 @@ void LWOImporter::InternReadFile( const std::string& pFile,
// The newer lightwave format allows the user to configure the // The newer lightwave format allows the user to configure the
// loader that just one layer is used. If this is the case // loader that just one layer is used. If this is the case
// we need to check now whether the requested layer has been found. // we need to check now whether the requested layer has been found.
if (0xffffffff != configLayerIndex && configLayerIndex > mLayers->size()) if (UINT_MAX != configLayerIndex && configLayerIndex > mLayers->size())
throw DeadlyImportError("LWO2: The requested layer was not found"); throw DeadlyImportError("LWO2: The requested layer was not found");
if (configLayerName.length() && !hasNamedLayer) { if (configLayerName.length() && !hasNamedLayer) {
@ -200,7 +200,7 @@ void LWOImporter::InternReadFile( const std::string& pFile,
apcNodes. reserve(mLayers->size()); apcNodes. reserve(mLayers->size());
apcMeshes.reserve(mLayers->size()*std::min(((unsigned int)mSurfaces->size()/2u), 1u)); apcMeshes.reserve(mLayers->size()*std::min(((unsigned int)mSurfaces->size()/2u), 1u));
unsigned int iDefaultSurface = 0xffffffff; // index of the default surface unsigned int iDefaultSurface = UINT_MAX; // index of the default surface
for (LayerList::iterator lit = mLayers->begin(), lend = mLayers->end();lit != lend;++lit) { for (LayerList::iterator lit = mLayers->begin(), lend = mLayers->end();lit != lend;++lit) {
LWO::Layer& layer = *lit; LWO::Layer& layer = *lit;
if (layer.skip) if (layer.skip)
@ -225,10 +225,10 @@ void LWOImporter::InternReadFile( const std::string& pFile,
if (idx >= mTags->size()) if (idx >= mTags->size())
{ {
DefaultLogger::get()->warn("LWO: Invalid face surface index"); DefaultLogger::get()->warn("LWO: Invalid face surface index");
idx = 0xffffffff; idx = UINT_MAX;
} }
if(0xffffffff == idx || 0xffffffff == (idx = _mMapping[idx])) { if(UINT_MAX == idx || UINT_MAX == (idx = _mMapping[idx])) {
if (0xffffffff == iDefaultSurface) { if (UINT_MAX == iDefaultSurface) {
iDefaultSurface = (unsigned int)mSurfaces->size(); iDefaultSurface = (unsigned int)mSurfaces->size();
mSurfaces->push_back(LWO::Surface()); mSurfaces->push_back(LWO::Surface());
LWO::Surface& surf = mSurfaces->back(); LWO::Surface& surf = mSurfaces->back();
@ -239,7 +239,7 @@ void LWOImporter::InternReadFile( const std::string& pFile,
} }
pSorted[idx].push_back(i); pSorted[idx].push_back(i);
} }
if (0xffffffff == iDefaultSurface) { if (UINT_MAX == iDefaultSurface) {
pSorted.erase(pSorted.end()-1); pSorted.erase(pSorted.end()-1);
} }
for (unsigned int p = 0,i = 0;i < mSurfaces->size();++i) { for (unsigned int p = 0,i = 0;i < mSurfaces->size();++i) {
@ -268,10 +268,12 @@ void LWOImporter::InternReadFile( const std::string& pFile,
unsigned int vVColorIndices[AI_MAX_NUMBER_OF_COLOR_SETS]; unsigned int vVColorIndices[AI_MAX_NUMBER_OF_COLOR_SETS];
#if _DEBUG #if _DEBUG
for (unsigned int mui = 0; mui < AI_MAX_NUMBER_OF_TEXTURECOORDS;++mui ) for (unsigned int mui = 0; mui < AI_MAX_NUMBER_OF_TEXTURECOORDS;++mui ) {
vUVChannelIndices[mui] = 0xffffffff; vUVChannelIndices[mui] = UINT_MAX;
for (unsigned int mui = 0; mui < AI_MAX_NUMBER_OF_COLOR_SETS;++mui ) }
vVColorIndices[mui] = 0xffffffff; for (unsigned int mui = 0; mui < AI_MAX_NUMBER_OF_COLOR_SETS;++mui ) {
vVColorIndices[mui] = UINT_MAX;
}
#endif #endif
FindUVChannels(_mSurfaces[i],sorted,layer,vUVChannelIndices); FindUVChannels(_mSurfaces[i],sorted,layer,vUVChannelIndices);
@ -280,8 +282,9 @@ void LWOImporter::InternReadFile( const std::string& pFile,
// allocate storage for UV and CV channels // allocate storage for UV and CV channels
aiVector3D* pvUV[AI_MAX_NUMBER_OF_TEXTURECOORDS]; aiVector3D* pvUV[AI_MAX_NUMBER_OF_TEXTURECOORDS];
for (unsigned int mui = 0; mui < AI_MAX_NUMBER_OF_TEXTURECOORDS;++mui ) { for (unsigned int mui = 0; mui < AI_MAX_NUMBER_OF_TEXTURECOORDS;++mui ) {
if (0xffffffff == vUVChannelIndices[mui]) if (UINT_MAX == vUVChannelIndices[mui]) {
break; break;
}
pvUV[mui] = mesh->mTextureCoords[mui] = new aiVector3D[mesh->mNumVertices]; pvUV[mui] = mesh->mTextureCoords[mui] = new aiVector3D[mesh->mNumVertices];
@ -294,7 +297,7 @@ void LWOImporter::InternReadFile( const std::string& pFile,
aiColor4D* pvVC[AI_MAX_NUMBER_OF_COLOR_SETS]; aiColor4D* pvVC[AI_MAX_NUMBER_OF_COLOR_SETS];
for (unsigned int mui = 0; mui < AI_MAX_NUMBER_OF_COLOR_SETS;++mui) { for (unsigned int mui = 0; mui < AI_MAX_NUMBER_OF_COLOR_SETS;++mui) {
if (0xffffffff == vVColorIndices[mui]) { if (UINT_MAX == vVColorIndices[mui]) {
break; break;
} }
pvVC[mui] = mesh->mColors[mui] = new aiColor4D[mesh->mNumVertices]; pvVC[mui] = mesh->mColors[mui] = new aiColor4D[mesh->mNumVertices];
@ -319,8 +322,9 @@ void LWOImporter::InternReadFile( const std::string& pFile,
// process UV coordinates // process UV coordinates
for (unsigned int w = 0; w < AI_MAX_NUMBER_OF_TEXTURECOORDS;++w) { for (unsigned int w = 0; w < AI_MAX_NUMBER_OF_TEXTURECOORDS;++w) {
if (0xffffffff == vUVChannelIndices[w]) if (UINT_MAX == vUVChannelIndices[w]) {
break; break;
}
aiVector3D*& pp = pvUV[w]; aiVector3D*& pp = pvUV[w];
const aiVector2D& src = ((aiVector2D*)&layer.mUVChannels[vUVChannelIndices[w]].rawData[0])[idx]; const aiVector2D& src = ((aiVector2D*)&layer.mUVChannels[vUVChannelIndices[w]].rawData[0])[idx];
pp->x = src.x; pp->x = src.x;
@ -337,8 +341,9 @@ void LWOImporter::InternReadFile( const std::string& pFile,
// process vertex colors // process vertex colors
for (unsigned int w = 0; w < AI_MAX_NUMBER_OF_COLOR_SETS;++w) { for (unsigned int w = 0; w < AI_MAX_NUMBER_OF_COLOR_SETS;++w) {
if (0xffffffff == vVColorIndices[w]) if (UINT_MAX == vVColorIndices[w]) {
break; break;
}
*pvVC[w] = ((aiColor4D*)&layer.mVColorChannels[vVColorIndices[w]].rawData[0])[idx]; *pvVC[w] = ((aiColor4D*)&layer.mVColorChannels[vVColorIndices[w]].rawData[0])[idx];
// If a RGB color map is explicitly requested delete the // If a RGB color map is explicitly requested delete the
@ -614,7 +619,7 @@ void LWOImporter::GenerateNodeGraph(std::vector<aiNode*>& apcNodes)
void LWOImporter::ResolveTags() void LWOImporter::ResolveTags()
{ {
// --- this function is used for both LWO2 and LWOB // --- this function is used for both LWO2 and LWOB
mMapping->resize(mTags->size(),0xffffffff); mMapping->resize(mTags->size(), UINT_MAX);
for (unsigned int a = 0; a < mTags->size();++a) { for (unsigned int a = 0; a < mTags->size();++a) {
const std::string& c = (*mTags)[a]; const std::string& c = (*mTags)[a];
@ -711,7 +716,7 @@ void LWOImporter::LoadLWOPoints(unsigned int length)
// initialize all point referrers with the default values // initialize all point referrers with the default values
mCurLayer->mPointReferrers.reserve ( regularSize + (regularSize>>2u) ); mCurLayer->mPointReferrers.reserve ( regularSize + (regularSize>>2u) );
mCurLayer->mPointReferrers.resize ( regularSize, 0xffffffff ); mCurLayer->mPointReferrers.resize ( regularSize, UINT_MAX );
} }
else mCurLayer->mTempPoints.resize( regularSize ); else mCurLayer->mTempPoints.resize( regularSize );
@ -897,7 +902,7 @@ inline void LWOImporter::DoRecursiveVMAPAssignment(VMapEntry* base, unsigned int
base->rawData[idx*base->dims+i]= data[i]; base->rawData[idx*base->dims+i]= data[i];
} }
if (0xffffffff != (i = refList[idx])) { if (UINT_MAX != (i = refList[idx])) {
DoRecursiveVMAPAssignment(base,numRead,i,data); DoRecursiveVMAPAssignment(base,numRead,i,data);
} }
} }
@ -905,7 +910,7 @@ inline void LWOImporter::DoRecursiveVMAPAssignment(VMapEntry* base, unsigned int
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
inline void AddToSingleLinkedList(ReferrerList& refList, unsigned int srcIdx, unsigned int destIdx) inline void AddToSingleLinkedList(ReferrerList& refList, unsigned int srcIdx, unsigned int destIdx)
{ {
if(0xffffffff == refList[srcIdx]) { if(UINT_MAX == refList[srcIdx]) {
refList[srcIdx] = destIdx; refList[srcIdx] = destIdx;
return; return;
} }
@ -1030,12 +1035,13 @@ void LWOImporter::LoadLWO2VertexMap(unsigned int length, bool perPoly)
if (tmp == srcIdx) if (tmp == srcIdx)
break; break;
} }
while ((tmp = refList[tmp]) != 0xffffffff); while ((tmp = refList[tmp]) != UINT_MAX);
if (tmp == 0xffffffff) if (tmp == UINT_MAX) {
continue; continue;
}
had = true; had = true;
refList.resize(refList.size()+1, 0xffffffff); refList.resize(refList.size()+1, UINT_MAX);
idx = (unsigned int)pointList.size(); idx = (unsigned int)pointList.size();
src.mIndices[i] = (unsigned int)pointList.size(); src.mIndices[i] = (unsigned int)pointList.size();
@ -1282,7 +1288,7 @@ void LWOImporter::LoadLWO2File()
// Continue loading this layer or ignore it? Check the layer index property // Continue loading this layer or ignore it? Check the layer index property
// NOTE: The first layer is the default layer, so the layer index is one-based now // NOTE: The first layer is the default layer, so the layer index is one-based now
if (0xffffffff != configLayerIndex && configLayerIndex != mLayers->size()-1) { if (UINT_MAX != configLayerIndex && configLayerIndex != mLayers->size()-1) {
skip = true; skip = true;
} }
else skip = false; else skip = false;

View File

@ -227,13 +227,13 @@ private:
unsigned int& faces, unsigned int& faces,
uint16_t*& cursor, uint16_t*& cursor,
const uint16_t* const end, const uint16_t* const end,
unsigned int max = 0xffffffff); unsigned int max = UINT_MAX);
void CountVertsAndFacesLWOB(unsigned int& verts, void CountVertsAndFacesLWOB(unsigned int& verts,
unsigned int& faces, unsigned int& faces,
LE_NCONST uint16_t*& cursor, LE_NCONST uint16_t*& cursor,
const uint16_t* const end, const uint16_t* const end,
unsigned int max = 0xffffffff); unsigned int max = UINT_MAX);
// ------------------------------------------------------------------- // -------------------------------------------------------------------
/** Read vertices and faces in a LWOB/LWO2 file /** Read vertices and faces in a LWOB/LWO2 file
@ -246,7 +246,7 @@ private:
void CopyFaceIndicesLWOB(LWO::FaceList::iterator& it, void CopyFaceIndicesLWOB(LWO::FaceList::iterator& it,
LE_NCONST uint16_t*& cursor, LE_NCONST uint16_t*& cursor,
const uint16_t* const end, const uint16_t* const end,
unsigned int max = 0xffffffff); unsigned int max = UINT_MAX);
// ------------------------------------------------------------------- // -------------------------------------------------------------------
/** Resolve the tag and surface lists that have been loaded. /** Resolve the tag and surface lists that have been loaded.
@ -376,7 +376,7 @@ protected:
TagList* mTags; TagList* mTags;
/** Mapping table to convert from tag to surface indices. /** Mapping table to convert from tag to surface indices.
0xffffffff indicates that a no corresponding surface is available */ UINT_MAX indicates that a no corresponding surface is available */
TagMappingTable* mMapping; TagMappingTable* mMapping;
/** Temporary surface list from the file */ /** Temporary surface list from the file */

View File

@ -120,7 +120,7 @@ bool LWOImporter::HandleTextures(MaterialHelper* pcMat, const TextureList& in, a
break; break;
case LWO::Texture::UV: case LWO::Texture::UV:
{ {
if( 0xffffffff == (*it).mRealUVIndex ) { if( UINT_MAX == (*it).mRealUVIndex ) {
// We have no UV index for this texture, so we can't display it // We have no UV index for this texture, so we can't display it
continue; continue;
} }
@ -390,7 +390,7 @@ char LWOImporter::FindUVChannels(LWO::TextureList& list,
ret = 1; ret = 1;
// got it. // got it.
if ((*it).mRealUVIndex == 0xffffffff || (*it).mRealUVIndex == next) if ((*it).mRealUVIndex == UINT_MAX || (*it).mRealUVIndex == next)
{ {
(*it).mRealUVIndex = next; (*it).mRealUVIndex = next;
} }
@ -467,7 +467,7 @@ void LWOImporter::FindUVChannels(LWO::Surface& surf,
} }
} }
if (extra < AI_MAX_NUMBER_OF_TEXTURECOORDS) { if (extra < AI_MAX_NUMBER_OF_TEXTURECOORDS) {
out[extra] = 0xffffffff; out[extra] = UINT_MAX;
} }
} }
@ -515,7 +515,7 @@ void LWOImporter::FindVCChannels(const LWO::Surface& surf, LWO::SortedRep& sorte
} }
} }
if (next != AI_MAX_NUMBER_OF_COLOR_SETS) { if (next != AI_MAX_NUMBER_OF_COLOR_SETS) {
out[next] = 0xffffffff; out[next] = UINT_MAX;
} }
} }

View File

@ -111,8 +111,8 @@ void MD2Importer::SetupProperties(const Importer* pImp)
// The // The
// AI_CONFIG_IMPORT_MD2_KEYFRAME option overrides the // AI_CONFIG_IMPORT_MD2_KEYFRAME option overrides the
// AI_CONFIG_IMPORT_GLOBAL_KEYFRAME option. // AI_CONFIG_IMPORT_GLOBAL_KEYFRAME option.
configFrameID = pImp->GetPropertyInteger(AI_CONFIG_IMPORT_MD2_KEYFRAME,0xffffffff); configFrameID = pImp->GetPropertyInteger(AI_CONFIG_IMPORT_MD2_KEYFRAME,-1);
if(0xffffffff == configFrameID){ if(static_cast<unsigned int>(-1) == configFrameID){
configFrameID = pImp->GetPropertyInteger(AI_CONFIG_IMPORT_GLOBAL_KEYFRAME,0); configFrameID = pImp->GetPropertyInteger(AI_CONFIG_IMPORT_GLOBAL_KEYFRAME,0);
} }
} }

View File

@ -431,8 +431,8 @@ void MD3Importer::SetupProperties(const Importer* pImp)
// The // The
// AI_CONFIG_IMPORT_MD3_KEYFRAME option overrides the // AI_CONFIG_IMPORT_MD3_KEYFRAME option overrides the
// AI_CONFIG_IMPORT_GLOBAL_KEYFRAME option. // AI_CONFIG_IMPORT_GLOBAL_KEYFRAME option.
configFrameID = pImp->GetPropertyInteger(AI_CONFIG_IMPORT_MD3_KEYFRAME,0xffffffff); configFrameID = pImp->GetPropertyInteger(AI_CONFIG_IMPORT_MD3_KEYFRAME,-1);
if(0xffffffff == configFrameID) { if(static_cast<unsigned int>(-1) == configFrameID) {
configFrameID = pImp->GetPropertyInteger(AI_CONFIG_IMPORT_GLOBAL_KEYFRAME,0); configFrameID = pImp->GetPropertyInteger(AI_CONFIG_IMPORT_GLOBAL_KEYFRAME,0);
} }
@ -469,7 +469,7 @@ void MD3Importer::ReadSkin(Q3Shader::SkinData& fill) const
void MD3Importer::ReadShader(Q3Shader::ShaderData& fill) const void MD3Importer::ReadShader(Q3Shader::ShaderData& fill) const
{ {
// Determine Q3 model name from given path // Determine Q3 model name from given path
std::string::size_type s = path.find_last_of("\\/",path.length()-2); const std::string::size_type s = path.find_last_of("\\/",path.length()-2);
const std::string model_file = path.substr(s+1,path.length()-(s+2)); const std::string model_file = path.substr(s+1,path.length()-(s+2));
// If no specific dir or file is given, use our default search behaviour // If no specific dir or file is given, use our default search behaviour
@ -481,7 +481,7 @@ void MD3Importer::ReadShader(Q3Shader::ShaderData& fill) const
else { else {
// If the given string specifies a file, load this file. // If the given string specifies a file, load this file.
// Otherwise it's a directory. // Otherwise it's a directory.
std::string::size_type st = configShaderFile.find_last_of('.'); const std::string::size_type st = configShaderFile.find_last_of('.');
if (st == std::string::npos) { if (st == std::string::npos) {
if(!Q3Shader::LoadShader(fill,configShaderFile + model_file + ".shader",mIOHandler)) { if(!Q3Shader::LoadShader(fill,configShaderFile + model_file + ".shader",mIOHandler)) {

View File

@ -349,7 +349,7 @@ MD5AnimParser::MD5AnimParser(SectionList& mSections)
DefaultLogger::get()->debug("MD5AnimParser begin"); DefaultLogger::get()->debug("MD5AnimParser begin");
fFrameRate = 24.0f; fFrameRate = 24.0f;
mNumAnimatedComponents = 0xffffffff; mNumAnimatedComponents = UINT_MAX;
for (SectionList::const_iterator iter = mSections.begin(), iterEnd = mSections.end();iter != iterEnd;++iter) { for (SectionList::const_iterator iter = mSections.begin(), iterEnd = mSections.end();iter != iterEnd;++iter) {
if ((*iter).mName == "hierarchy") { if ((*iter).mName == "hierarchy") {
// "sheath" 0 63 6 // "sheath" 0 63 6
@ -398,8 +398,9 @@ MD5AnimParser::MD5AnimParser(SectionList& mSections)
desc.iIndex = strtoul10((*iter).mGlobalValue.c_str()); desc.iIndex = strtoul10((*iter).mGlobalValue.c_str());
// we do already know how much storage we will presumably need // we do already know how much storage we will presumably need
if (0xffffffff != mNumAnimatedComponents) if (UINT_MAX != mNumAnimatedComponents) {
desc.mValues.reserve(mNumAnimatedComponents); desc.mValues.reserve(mNumAnimatedComponents);
}
// now read all elements (continous list of floats) // now read all elements (continous list of floats)
for (ElementList::const_iterator eit = (*iter).mElements.begin(), eitEnd = (*iter).mElements.end(); eit != eitEnd; ++eit){ for (ElementList::const_iterator eit = (*iter).mElements.begin(), eitEnd = (*iter).mElements.end(); eit != eitEnd; ++eit){
@ -418,9 +419,10 @@ MD5AnimParser::MD5AnimParser(SectionList& mSections)
mAnimatedBones.reserve(num); mAnimatedBones.reserve(num);
// try to guess the number of animated components if that element is not given // try to guess the number of animated components if that element is not given
if (0xffffffff == mNumAnimatedComponents) if (UINT_MAX == mNumAnimatedComponents) {
mNumAnimatedComponents = num * 6; mNumAnimatedComponents = num * 6;
} }
}
else if((*iter).mName == "numAnimatedComponents") { else if((*iter).mName == "numAnimatedComponents") {
mAnimatedBones.reserve( strtoul10((*iter).mGlobalValue.c_str())); mAnimatedBones.reserve( strtoul10((*iter).mGlobalValue.c_str()));
} }

View File

@ -187,10 +187,8 @@ void MDCImporter::SetupProperties(const Importer* pImp)
{ {
// The AI_CONFIG_IMPORT_MDC_KEYFRAME option overrides the // The AI_CONFIG_IMPORT_MDC_KEYFRAME option overrides the
// AI_CONFIG_IMPORT_GLOBAL_KEYFRAME option. // AI_CONFIG_IMPORT_GLOBAL_KEYFRAME option.
if(0xffffffff == (this->configFrameID = pImp->GetPropertyInteger( if(static_cast<unsigned int>(-1) == (configFrameID = pImp->GetPropertyInteger(AI_CONFIG_IMPORT_MDC_KEYFRAME,-1))){
AI_CONFIG_IMPORT_MDC_KEYFRAME,0xffffffff))) configFrameID = pImp->GetPropertyInteger(AI_CONFIG_IMPORT_GLOBAL_KEYFRAME,0);
{
this->configFrameID = pImp->GetPropertyInteger(AI_CONFIG_IMPORT_GLOBAL_KEYFRAME,0);
} }
} }
@ -251,7 +249,7 @@ void MDCImporter::InternReadFile(
pScene->mMeshes[i] = NULL; pScene->mMeshes[i] = NULL;
// now read all surfaces // now read all surfaces
unsigned int iDefaultMatIndex = 0xffffffff; unsigned int iDefaultMatIndex = UINT_MAX;
for (unsigned int i = 0, iNum = 0; i < pcHeader->ulNumSurfaces;++i) for (unsigned int i = 0, iNum = 0; i < pcHeader->ulNumSurfaces;++i)
{ {
if (!pcSurface->ulNumVertices || !pcSurface->ulNumTriangles)continue; if (!pcSurface->ulNumVertices || !pcSurface->ulNumTriangles)continue;
@ -276,7 +274,7 @@ void MDCImporter::InternReadFile(
::strlen(pcShader->ucName),sizeof(pcShader->ucName)) )); ::strlen(pcShader->ucName),sizeof(pcShader->ucName)) ));
} }
// need to create a default material // need to create a default material
else if (0xffffffff == iDefaultMatIndex) else if (UINT_MAX == iDefaultMatIndex)
{ {
pcMesh->mMaterialIndex = iDefaultMatIndex = (unsigned int)aszShaders.size(); pcMesh->mMaterialIndex = iDefaultMatIndex = (unsigned int)aszShaders.size();
aszShaders.push_back(std::string()); aszShaders.push_back(std::string());

View File

@ -101,12 +101,12 @@ bool MDLImporter::CanRead( const std::string& pFile, IOSystem* pIOHandler, bool
// Setup configuration properties // Setup configuration properties
void MDLImporter::SetupProperties(const Importer* pImp) void MDLImporter::SetupProperties(const Importer* pImp)
{ {
configFrameID = pImp->GetPropertyInteger(AI_CONFIG_IMPORT_MDL_KEYFRAME,0xffffffff); configFrameID = pImp->GetPropertyInteger(AI_CONFIG_IMPORT_MDL_KEYFRAME,-1);
// The // The
// AI_CONFIG_IMPORT_MDL_KEYFRAME option overrides the // AI_CONFIG_IMPORT_MDL_KEYFRAME option overrides the
// AI_CONFIG_IMPORT_GLOBAL_KEYFRAME option. // AI_CONFIG_IMPORT_GLOBAL_KEYFRAME option.
if(0xffffffff == configFrameID) { if(static_cast<unsigned int>(-1) == configFrameID) {
configFrameID = pImp->GetPropertyInteger(AI_CONFIG_IMPORT_GLOBAL_KEYFRAME,0); configFrameID = pImp->GetPropertyInteger(AI_CONFIG_IMPORT_GLOBAL_KEYFRAME,0);
} }
@ -356,8 +356,8 @@ void MDLImporter::InternReadFile_Quake1( )
else else
{ {
szCurrent += sizeof(uint32_t); szCurrent += sizeof(uint32_t);
unsigned int iSkip = i ? 0xffffffff : 0; unsigned int iSkip = i ? UINT_MAX : 0;
this->CreateTexture_3DGS_MDL4(szCurrent,pcSkin->group,&iSkip); CreateTexture_3DGS_MDL4(szCurrent,pcSkin->group,&iSkip);
szCurrent += iSkip; szCurrent += iSkip;
} }
} }
@ -552,7 +552,7 @@ void MDLImporter::InternReadFile_3DGS_MDL345( )
pcSkin = (BE_NCONST MDL::Skin*)szCurrent; pcSkin = (BE_NCONST MDL::Skin*)szCurrent;
AI_SWAP4( pcSkin->group); AI_SWAP4( pcSkin->group);
// create one output image // create one output image
unsigned int iSkip = i ? 0xffffffff : 0; unsigned int iSkip = i ? UINT_MAX : 0;
if (5 <= iGSFileVersion) if (5 <= iGSFileVersion)
{ {
// MDL5 format could contain MIPmaps // MDL5 format could contain MIPmaps
@ -1240,14 +1240,14 @@ void MDLImporter::SortByMaterials_3DGS_MDL7(
if (iMatIndex >= iNumMaterials) { if (iMatIndex >= iNumMaterials) {
// sometimes MED writes -1, but normally only if there is only // sometimes MED writes -1, but normally only if there is only
// one skin assigned. No warning in this case // one skin assigned. No warning in this case
if(0xffffffff != iMatIndex) if(UINT_MAX != iMatIndex)
DefaultLogger::get()->warn("Index overflow in MDL7 material list [#1]"); DefaultLogger::get()->warn("Index overflow in MDL7 material list [#1]");
iMatIndex = iNumMaterials-1; iMatIndex = iNumMaterials-1;
} }
unsigned int iMatIndex2 = groupData.pcFaces[iFace].iMatIndex[1]; unsigned int iMatIndex2 = groupData.pcFaces[iFace].iMatIndex[1];
unsigned int iNum = iMatIndex; unsigned int iNum = iMatIndex;
if (0xffffffff != iMatIndex2 && iMatIndex != iMatIndex2) { if (UINT_MAX != iMatIndex2 && iMatIndex != iMatIndex2) {
if (iMatIndex2 >= iNumMaterials) { if (iMatIndex2 >= iNumMaterials) {
// sometimes MED writes -1, but normally only if there is only // sometimes MED writes -1, but normally only if there is only
// one skin assigned. No warning in this case // one skin assigned. No warning in this case
@ -1447,7 +1447,7 @@ void MDLImporter::InternReadFile_3DGS_MDL7( )
groupData.vPositions.resize(iNumVertices); groupData.vPositions.resize(iNumVertices);
groupData.vNormals.resize(iNumVertices); groupData.vNormals.resize(iNumVertices);
if (sharedData.apcOutBones)groupData.aiBones.resize(iNumVertices,0xffffffff); if (sharedData.apcOutBones)groupData.aiBones.resize(iNumVertices,UINT_MAX);
// it is also possible that there are 0 UV coordinate sets // it is also possible that there are 0 UV coordinate sets
if (groupInfo.pcGroup->num_stpts){ if (groupInfo.pcGroup->num_stpts){
@ -1847,7 +1847,7 @@ void MDLImporter::GenerateOutputMeshes_3DGS_MDL7(
// iterate through all face indices // iterate through all face indices
for (unsigned int c = 0; c < 3;++c) { for (unsigned int c = 0; c < 3;++c) {
unsigned int iBone = groupData.aiBones[ oldFace.mIndices[c] ]; unsigned int iBone = groupData.aiBones[ oldFace.mIndices[c] ];
if (0xffffffff != iBone) { if (UINT_MAX != iBone) {
if (iBone >= iNumOutBones) { if (iBone >= iNumOutBones) {
DefaultLogger::get()->error("Bone index overflow. " DefaultLogger::get()->error("Bone index overflow. "
"The bone index of a vertex exceeds the allowed range. "); "The bone index of a vertex exceeds the allowed range. ");

View File

@ -298,7 +298,7 @@ protected:
* \param iType type of the texture data. No DDS or external * \param iType type of the texture data. No DDS or external
* \param piSkip Receive the number of bytes to skip * \param piSkip Receive the number of bytes to skip
* \param pcNew Must point to fully initialized data. Width and * \param pcNew Must point to fully initialized data. Width and
* height must be set. If pcNew->pcData is set to 0xffffffff, * height must be set. If pcNew->pcData is set to UINT_MAX,
* piSkip will receive the size of the texture, in bytes, but no * piSkip will receive the size of the texture, in bytes, but no
* color data will be read. * color data will be read.
*/ */

View File

@ -49,6 +49,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "MDLDefaultColorMap.h" #include "MDLDefaultColorMap.h"
using namespace Assimp; using namespace Assimp;
static aiTexel* const bad_texel = reinterpret_cast<aiTexel*>(SIZE_MAX);
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Find a suitable pallette file or take teh default one // Find a suitable pallette file or take teh default one
@ -177,14 +178,14 @@ void MDLImporter::CreateTexture_3DGS_MDL4(const unsigned char* szData,
return; return;
} }
bool bNoRead = *piSkip == 0xffffffff; const bool bNoRead = *piSkip == UINT_MAX;
// allocate a new texture object // allocate a new texture object
aiTexture* pcNew = new aiTexture(); aiTexture* pcNew = new aiTexture();
pcNew->mWidth = pcHeader->skinwidth; pcNew->mWidth = pcHeader->skinwidth;
pcNew->mHeight = pcHeader->skinheight; pcNew->mHeight = pcHeader->skinheight;
if (bNoRead)pcNew->pcData = (aiTexel*)0xffffffff; if (bNoRead)pcNew->pcData = bad_texel;
ParseTextureColorData(szData,iType,piSkip,pcNew); ParseTextureColorData(szData,iType,piSkip,pcNew);
// store the texture // store the texture
@ -221,9 +222,12 @@ void MDLImporter::ParseTextureColorData(const unsigned char* szData,
unsigned int* piSkip, unsigned int* piSkip,
aiTexture* pcNew) aiTexture* pcNew)
{ {
const bool do_read = bad_texel != pcNew->pcData;
// allocate storage for the texture image // allocate storage for the texture image
if ((aiTexel*)0xffffffff != pcNew->pcData) if (do_read) {
pcNew->pcData = new aiTexel[pcNew->mWidth * pcNew->mHeight]; pcNew->pcData = new aiTexel[pcNew->mWidth * pcNew->mHeight];
}
// R5G6B5 format (with or without MIPs) // R5G6B5 format (with or without MIPs)
// **************************************************************** // ****************************************************************
@ -233,7 +237,7 @@ void MDLImporter::ParseTextureColorData(const unsigned char* szData,
// copy texture data // copy texture data
unsigned int i; unsigned int i;
if ((aiTexel*)0xffffffff != pcNew->pcData) if (do_read)
{ {
for (i = 0; i < pcNew->mWidth*pcNew->mHeight;++i) for (i = 0; i < pcNew->mWidth*pcNew->mHeight;++i)
{ {
@ -264,7 +268,7 @@ void MDLImporter::ParseTextureColorData(const unsigned char* szData,
// copy texture data // copy texture data
unsigned int i; unsigned int i;
if ((aiTexel*)0xffffffff != pcNew->pcData) if (do_read)
{ {
for (i = 0; i < pcNew->mWidth*pcNew->mHeight;++i) for (i = 0; i < pcNew->mWidth*pcNew->mHeight;++i)
{ {
@ -295,7 +299,7 @@ void MDLImporter::ParseTextureColorData(const unsigned char* szData,
// copy texture data // copy texture data
unsigned int i; unsigned int i;
if ((aiTexel*)0xffffffff != pcNew->pcData) if (do_read)
{ {
for (i = 0; i < pcNew->mWidth*pcNew->mHeight;++i) for (i = 0; i < pcNew->mWidth*pcNew->mHeight;++i)
{ {
@ -326,7 +330,7 @@ void MDLImporter::ParseTextureColorData(const unsigned char* szData,
// copy texture data // copy texture data
unsigned int i; unsigned int i;
if ((aiTexel*)0xffffffff != pcNew->pcData) if (do_read)
{ {
for (i = 0; i < pcNew->mWidth*pcNew->mHeight;++i) for (i = 0; i < pcNew->mWidth*pcNew->mHeight;++i)
{ {
@ -355,11 +359,11 @@ void MDLImporter::ParseTextureColorData(const unsigned char* szData,
// copy texture data // copy texture data
unsigned int i; unsigned int i;
if ((aiTexel*)0xffffffff != pcNew->pcData) if (do_read)
{ {
const unsigned char* szColorMap; const unsigned char* szColorMap;
this->SearchPalette(&szColorMap); SearchPalette(&szColorMap);
for (i = 0; i < pcNew->mWidth*pcNew->mHeight;++i) for (i = 0; i < pcNew->mWidth*pcNew->mHeight;++i)
{ {
@ -388,7 +392,7 @@ void MDLImporter::CreateTexture_3DGS_MDL5(const unsigned char* szData,
unsigned int* piSkip) unsigned int* piSkip)
{ {
ai_assert(NULL != piSkip); ai_assert(NULL != piSkip);
bool bNoRead = *piSkip == 0xffffffff; bool bNoRead = *piSkip == UINT_MAX;
// allocate a new texture object // allocate a new texture object
aiTexture* pcNew = new aiTexture(); aiTexture* pcNew = new aiTexture();
@ -404,12 +408,14 @@ void MDLImporter::CreateTexture_3DGS_MDL5(const unsigned char* szData,
AI_SWAP4(pcNew->mHeight); AI_SWAP4(pcNew->mHeight);
szData += sizeof(uint32_t); szData += sizeof(uint32_t);
if (bNoRead)pcNew->pcData = (aiTexel*)0xffffffff; if (bNoRead) {
pcNew->pcData = bad_texel;
}
// this should not occur - at least the docs say it shouldn't // this should not occur - at least the docs say it shouldn't.
// however, you can easily try out what MED does if you have // however, one can easily try out what MED does if you have
// a model with a DDS texture and export it to MDL5 ... // a model with a DDS texture and export it to MDL5 ...
// yes, you're right. It embedds the DDS texture ... :cry: // yeah, it embedds the DDS file.
if (6 == iType) if (6 == iType)
{ {
// this is a compressed texture in DDS format // this is a compressed texture in DDS format
@ -418,8 +424,7 @@ void MDLImporter::CreateTexture_3DGS_MDL5(const unsigned char* szData,
if (!bNoRead) if (!bNoRead)
{ {
// place a hint and let the application know that it's // place a hint and let the application know that this is a DDS file
// a DDS file
pcNew->mHeight = 0; pcNew->mHeight = 0;
pcNew->achFormatHint[0] = 'd'; pcNew->achFormatHint[0] = 'd';
pcNew->achFormatHint[1] = 'd'; pcNew->achFormatHint[1] = 'd';
@ -433,8 +438,7 @@ void MDLImporter::CreateTexture_3DGS_MDL5(const unsigned char* szData,
else else
{ {
// parse the color data of the texture // parse the color data of the texture
ParseTextureColorData(szData,iType, ParseTextureColorData(szData,iType,piSkip,pcNew);
piSkip,pcNew);
} }
*piSkip += sizeof(uint32_t) * 2; *piSkip += sizeof(uint32_t) * 2;
@ -565,7 +569,7 @@ void MDLImporter::ParseSkinLump_3DGS_MDL7(
pcNew->mHeight = iHeight; pcNew->mHeight = iHeight;
unsigned int iSkip = 0; unsigned int iSkip = 0;
this->ParseTextureColorData(szCurrent,iMasked,&iSkip,pcNew); ParseTextureColorData(szCurrent,iMasked,&iSkip,pcNew);
// skip length of texture data // skip length of texture data
szCurrent += iSkip; szCurrent += iSkip;
@ -576,7 +580,7 @@ void MDLImporter::ParseSkinLump_3DGS_MDL7(
// texture instead of material colors ... posssible they have // texture instead of material colors ... posssible they have
// been converted to MDL7 from other formats, such as MDL5 // been converted to MDL7 from other formats, such as MDL5
aiColor4D clrTexture; aiColor4D clrTexture;
if (pcNew)clrTexture = this->ReplaceTextureWithColor(pcNew); if (pcNew)clrTexture = ReplaceTextureWithColor(pcNew);
else clrTexture.r = get_qnan(); else clrTexture.r = get_qnan();
// check whether a material definition is contained in the skin // check whether a material definition is contained in the skin
@ -637,9 +641,9 @@ void MDLImporter::ParseSkinLump_3DGS_MDL7(
#undef COLOR_MULITPLY_RGB #undef COLOR_MULITPLY_RGB
// FIX: Take the opacity from the ambient color // FIX: Take the opacity from the ambient color.
// the doc says something else, but it is fact that MED exports the // The doc say something else, but it is fact that MED exports the
// opacity like this .... ARRRGGHH! // opacity like this .... oh well.
clrTemp.r = pcMatIn->Ambient.a; clrTemp.r = pcMatIn->Ambient.a;
AI_SWAP4(clrTemp.r); AI_SWAP4(clrTemp.r);
if (is_not_qnan(clrTexture.r)) { if (is_not_qnan(clrTexture.r)) {
@ -670,7 +674,7 @@ void MDLImporter::ParseSkinLump_3DGS_MDL7(
pcNew = NULL; pcNew = NULL;
} }
// if an ASCII effect description (HLSL?) is contained in the file, // If an ASCII effect description (HLSL?) is contained in the file,
// we can simply ignore it ... // we can simply ignore it ...
if (iType & AI_MDL7_SKINTYPE_MATERIAL_ASCDEF) if (iType & AI_MDL7_SKINTYPE_MATERIAL_ASCDEF)
{ {
@ -683,7 +687,7 @@ void MDLImporter::ParseSkinLump_3DGS_MDL7(
// If an embedded texture has been loaded setup the corresponding // If an embedded texture has been loaded setup the corresponding
// data structures in the aiScene instance // data structures in the aiScene instance
if (pcNew && this->pScene->mNumTextures <= 999) if (pcNew && pScene->mNumTextures <= 999)
{ {
// place this as diffuse texture // place this as diffuse texture
@ -698,21 +702,22 @@ void MDLImporter::ParseSkinLump_3DGS_MDL7(
pcMatOut->AddProperty(&szFile,AI_MATKEY_TEXTURE_DIFFUSE(0)); pcMatOut->AddProperty(&szFile,AI_MATKEY_TEXTURE_DIFFUSE(0));
// store the texture // store the texture
if (!this->pScene->mNumTextures) if (!pScene->mNumTextures)
{ {
this->pScene->mNumTextures = 1; pScene->mNumTextures = 1;
this->pScene->mTextures = new aiTexture*[1]; pScene->mTextures = new aiTexture*[1];
this->pScene->mTextures[0] = pcNew; pScene->mTextures[0] = pcNew;
} }
else else
{ {
aiTexture** pc = this->pScene->mTextures; aiTexture** pc = pScene->mTextures;
this->pScene->mTextures = new aiTexture*[this->pScene->mNumTextures+1]; pScene->mTextures = new aiTexture*[pScene->mNumTextures+1];
for (unsigned int i = 0; i < this->pScene->mNumTextures;++i) for (unsigned int i = 0; i < pScene->mNumTextures;++i) {
this->pScene->mTextures[i] = pc[i]; pScene->mTextures[i] = pc[i];
}
this->pScene->mTextures[this->pScene->mNumTextures] = pcNew; pScene->mTextures[pScene->mNumTextures] = pcNew;
this->pScene->mNumTextures++; pScene->mNumTextures++;
delete[] pc; delete[] pc;
} }
} }
@ -730,7 +735,7 @@ void MDLImporter::SkipSkinLump_3DGS_MDL7(
unsigned int iHeight) unsigned int iHeight)
{ {
// get the type of the skin // get the type of the skin
unsigned int iMasked = (unsigned int)(iType & 0xF); const unsigned int iMasked = (unsigned int)(iType & 0xF);
if (0x6 == iMasked) if (0x6 == iMasked)
{ {
@ -745,15 +750,15 @@ void MDLImporter::SkipSkinLump_3DGS_MDL7(
{ {
if (iMasked || !iType || (iType && iWidth && iHeight)) if (iMasked || !iType || (iType && iWidth && iHeight))
{ {
// ParseTextureColorData(..., aiTexture::pcData == 0xffffffff) will simply // ParseTextureColorData(..., aiTexture::pcData == bad_texel) will simply
// return the size of the color data in bytes in iSkip // return the size of the color data in bytes in iSkip
unsigned int iSkip = 0; unsigned int iSkip = 0;
aiTexture tex; aiTexture tex;
tex.pcData = reinterpret_cast<aiTexel*>(0xffffffff); tex.pcData = bad_texel;
tex.mHeight = iHeight; tex.mHeight = iHeight;
tex.mWidth = iWidth; tex.mWidth = iWidth;
this->ParseTextureColorData(szCurrent,iMasked,&iSkip,&tex); ParseTextureColorData(szCurrent,iMasked,&iSkip,&tex);
// FIX: Important, otherwise the destructor will crash // FIX: Important, otherwise the destructor will crash
tex.pcData = NULL; tex.pcData = NULL;

View File

@ -227,7 +227,7 @@ void MS3DImporter::InternReadFile( const std::string& pFile,
v.bone_id[0] = stream.GetI1(); v.bone_id[0] = stream.GetI1();
v.ref_cnt = stream.GetI1(); v.ref_cnt = stream.GetI1();
v.bone_id[1] = v.bone_id[2] = v.bone_id[3] = 0xffffffff; v.bone_id[1] = v.bone_id[2] = v.bone_id[3] = UINT_MAX;
v.weights[1] = v.weights[2] = v.weights[3] = 0.f; v.weights[1] = v.weights[2] = v.weights[3] = 0.f;
v.weights[0] = 1.f; v.weights[0] = 1.f;
} }
@ -279,7 +279,7 @@ void MS3DImporter::InternReadFile( const std::string& pFile,
t.triangles[i] = stream.GetI2(); t.triangles[i] = stream.GetI2();
} }
t.mat = stream.GetI1(); t.mat = stream.GetI1();
if (t.mat == 0xffffffff) { if (t.mat == UINT_MAX) {
need_default = true; need_default = true;
} }
} }
@ -402,7 +402,7 @@ void MS3DImporter::InternReadFile( const std::string& pFile,
for (unsigned int i = 0; i < groups.size(); ++i) { for (unsigned int i = 0; i < groups.size(); ++i) {
TempGroup& g = groups[i]; TempGroup& g = groups[i];
if (g.mat == 0xffffffff) { if (g.mat == UINT_MAX) {
g.mat = materials.size()-1; g.mat = materials.size()-1;
} }
} }
@ -491,7 +491,7 @@ void MS3DImporter::InternReadFile( const std::string& pFile,
const TempVertex& v = vertices[t.indices[i]]; const TempVertex& v = vertices[t.indices[i]];
for(unsigned int a = 0; a < 4; ++a) { for(unsigned int a = 0; a < 4; ++a) {
if (v.bone_id[a] != 0xffffffff) { if (v.bone_id[a] != UINT_MAX) {
if (v.bone_id[a] >= joints.size()) { if (v.bone_id[a] >= joints.size()) {
throw DeadlyImportError("MS3D: Encountered invalid bone index, file is malformed"); throw DeadlyImportError("MS3D: Encountered invalid bone index, file is malformed");
} }
@ -533,7 +533,7 @@ void MS3DImporter::InternReadFile( const std::string& pFile,
const TempVertex& v = vertices[t.indices[i]]; const TempVertex& v = vertices[t.indices[i]];
for(unsigned int a = 0; a < 4; ++a) { for(unsigned int a = 0; a < 4; ++a) {
const unsigned int bone = v.bone_id[a]; const unsigned int bone = v.bone_id[a];
if(bone==0xffffffff){ if(bone==UINT_MAX){
continue; continue;
} }

View File

@ -71,8 +71,8 @@ aiReturn aiGetMaterialProperty(const aiMaterial* pMat,
if (prop /* just for safety ... */ if (prop /* just for safety ... */
&& 0 == strcmp( prop->mKey.data, pKey ) && 0 == strcmp( prop->mKey.data, pKey )
&& (0xffffffff == type || prop->mSemantic == type) /* 0xffffffff is a wildcard, but this is undocumented :-) */ && (UINT_MAX == type || prop->mSemantic == type) /* UINT_MAX is a wildcard, but this is undocumented :-) */
&& (0xffffffff == index || prop->mIndex == index)) && (UINT_MAX == index || prop->mIndex == index))
{ {
*pPropOut = pMat->mProperties[i]; *pPropOut = pMat->mProperties[i];
return AI_SUCCESS; return AI_SUCCESS;
@ -469,7 +469,7 @@ aiReturn MaterialHelper::AddBinaryProperty (const void* pInput,
ai_assert (0 != pSizeInBytes); ai_assert (0 != pSizeInBytes);
// first search the list whether there is already an entry with this key // first search the list whether there is already an entry with this key
unsigned int iOutIndex = 0xffffffff; unsigned int iOutIndex = UINT_MAX;
for (unsigned int i = 0; i < mNumProperties;++i) { for (unsigned int i = 0; i < mNumProperties;++i) {
aiMaterialProperty* prop = mProperties[i]; aiMaterialProperty* prop = mProperties[i];
@ -497,7 +497,7 @@ aiReturn MaterialHelper::AddBinaryProperty (const void* pInput,
ai_assert ( MAXLEN > pcNew->mKey.length); ai_assert ( MAXLEN > pcNew->mKey.length);
strcpy( pcNew->mKey.data, pKey ); strcpy( pcNew->mKey.data, pKey );
if (0xffffffff != iOutIndex) { if (UINT_MAX != iOutIndex) {
mProperties[iOutIndex] = pcNew; mProperties[iOutIndex] = pcNew;
return AI_SUCCESS; return AI_SUCCESS;
} }

View File

@ -353,7 +353,7 @@ void PretransformVertices::BuildWCSMeshes(std::vector<aiMesh*>& out, aiMesh** in
unsigned int numIn, aiNode* node) unsigned int numIn, aiNode* node)
{ {
// NOTE: // NOTE:
// aiMesh::mNumBones store original source mesh, or 0xffffffff if not a copy // aiMesh::mNumBones store original source mesh, or UINT_MAX if not a copy
// aiMesh::mBones store reference to abs. transform we multiplied with // aiMesh::mBones store reference to abs. transform we multiplied with
// process meshes // process meshes
@ -364,7 +364,7 @@ void PretransformVertices::BuildWCSMeshes(std::vector<aiMesh*>& out, aiMesh** in
if (!mesh->mBones || *reinterpret_cast<aiMatrix4x4*>(mesh->mBones) == node->mTransformation) { if (!mesh->mBones || *reinterpret_cast<aiMatrix4x4*>(mesh->mBones) == node->mTransformation) {
// yes, we can. // yes, we can.
mesh->mBones = reinterpret_cast<aiBone**> (&node->mTransformation); mesh->mBones = reinterpret_cast<aiBone**> (&node->mTransformation);
mesh->mNumBones = 0xffffffff; mesh->mNumBones = UINT_MAX;
} }
else { else {

View File

@ -225,7 +225,7 @@ void Q3DImporter::InternReadFile( const std::string& pFile,
if (!i && !a) if (!i && !a)
mesh.prevUVIdx = vec.uvindices[a]; mesh.prevUVIdx = vec.uvindices[a];
else if (vec.uvindices[a] != mesh.prevUVIdx) else if (vec.uvindices[a] != mesh.prevUVIdx)
mesh.prevUVIdx = 0xffffffff; mesh.prevUVIdx = UINT_MAX;
} }
} }
} }

View File

@ -94,7 +94,7 @@ private:
Material() Material()
: diffuse (0.6f,0.6f,0.6f) : diffuse (0.6f,0.6f,0.6f)
, transparency (0.f) , transparency (0.f)
, texIdx (0xffffffff) , texIdx (UINT_MAX)
{} {}
aiString name; aiString name;

View File

@ -86,16 +86,15 @@ void SMDImporter::SetupProperties(const Importer* pImp)
// The // The
// AI_CONFIG_IMPORT_SMD_KEYFRAME option overrides the // AI_CONFIG_IMPORT_SMD_KEYFRAME option overrides the
// AI_CONFIG_IMPORT_GLOBAL_KEYFRAME option. // AI_CONFIG_IMPORT_GLOBAL_KEYFRAME option.
configFrameID = pImp->GetPropertyInteger(AI_CONFIG_IMPORT_SMD_KEYFRAME,0xffffffff); configFrameID = pImp->GetPropertyInteger(AI_CONFIG_IMPORT_SMD_KEYFRAME,-1);
if(0xffffffff == configFrameID) { if(static_cast<unsigned int>(-1) == configFrameID) {
configFrameID = pImp->GetPropertyInteger(AI_CONFIG_IMPORT_GLOBAL_KEYFRAME,0); configFrameID = pImp->GetPropertyInteger(AI_CONFIG_IMPORT_GLOBAL_KEYFRAME,0);
} }
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Imports the given file into the given scene structure. // Imports the given file into the given scene structure.
void SMDImporter::InternReadFile( void SMDImporter::InternReadFile( const std::string& pFile, aiScene* pScene, IOSystem* pIOHandler)
const std::string& pFile, aiScene* pScene, IOSystem* pIOHandler)
{ {
boost::scoped_ptr<IOStream> file( pIOHandler->Open( pFile, "rb")); boost::scoped_ptr<IOStream> file( pIOHandler->Open( pFile, "rb"));
@ -254,7 +253,7 @@ void SMDImporter::CreateOutputMeshes()
iFace = asTriangles.begin(); iFace = asTriangles.begin();
iFace != asTriangles.end();++iFace,++iNum) iFace != asTriangles.end();++iFace,++iNum)
{ {
if (0xffffffff == (*iFace).iTexture)aaiFaces[(*iFace).iTexture].push_back( 0 ); if (UINT_MAX == (*iFace).iTexture)aaiFaces[(*iFace).iTexture].push_back( 0 );
else if ((*iFace).iTexture >= aszTextures.size()) else if ((*iFace).iTexture >= aszTextures.size())
{ {
DefaultLogger::get()->error("[SMD/VTA] Material index overflow in face"); DefaultLogger::get()->error("[SMD/VTA] Material index overflow in face");
@ -354,7 +353,7 @@ void SMDImporter::CreateOutputMeshes()
// that the parent of a vertex is 0xffffffff (if the corresponding // that the parent of a vertex is 0xffffffff (if the corresponding
// entry in the file was unreadable) // entry in the file was unreadable)
// ****************************************************************** // ******************************************************************
if (fSum < 0.975f && face.avVertices[iVert].iParentNode != 0xffffffff) if (fSum < 0.975f && face.avVertices[iVert].iParentNode != UINT_MAX)
{ {
if (face.avVertices[iVert].iParentNode >= asBones.size()) if (face.avVertices[iVert].iParentNode >= asBones.size())
{ {

View File

@ -69,7 +69,7 @@ namespace SMD {
*/ */
struct Vertex struct Vertex
{ {
Vertex() : iParentNode(0xffffffff) Vertex() : iParentNode(UINT_MAX)
{} {}
//! Vertex position, normal and texture coordinate //! Vertex position, normal and texture coordinate
@ -106,7 +106,7 @@ struct Face
struct Bone struct Bone
{ {
//! Default constructor //! Default constructor
Bone() : iParent(0xffffffff), bIsUsed(false) Bone() : iParent(UINT_MAX), bIsUsed(false)
{ {
} }

View File

@ -243,17 +243,17 @@ void SceneCombiner::MergeScenes(aiScene** _dest, aiScene* master,
ai_assert(NULL != _dest); ai_assert(NULL != _dest);
// if _dest points to NULL allocate a new scene. Otherwise clear the old and reuse it // if _dest points to NULL allocate a new scene. Otherwise clear the old and reuse it
if (srcList.empty()) if (srcList.empty()) {
{ if (*_dest) {
if (*_dest)
{
(*_dest)->~aiScene(); (*_dest)->~aiScene();
SceneCombiner::CopySceneFlat(_dest,master); SceneCombiner::CopySceneFlat(_dest,master);
} }
else *_dest = master; else *_dest = master;
return; return;
} }
if (*_dest)(*_dest)->~aiScene(); if (*_dest) {
(*_dest)->~aiScene();
}
else *_dest = new aiScene(); else *_dest = new aiScene();
aiScene* dest = *_dest; aiScene* dest = *_dest;
@ -265,22 +265,24 @@ void SceneCombiner::MergeScenes(aiScene** _dest, aiScene* master,
} }
// this helper array specifies which scenes are duplicates of others // this helper array specifies which scenes are duplicates of others
std::vector<unsigned int> duplicates(src.size(),0xffffffff); std::vector<unsigned int> duplicates(src.size(),UINT_MAX);
// this helper array is used as lookup table several times // this helper array is used as lookup table several times
std::vector<unsigned int> offset(src.size()); std::vector<unsigned int> offset(src.size());
// Find duplicate scenes // Find duplicate scenes
for (unsigned int i = 0; i < src.size();++i) for (unsigned int i = 0; i < src.size();++i) {
{ if (duplicates[i] != i && duplicates[i] != UINT_MAX) {
if (duplicates[i] != i && duplicates[i] != 0xffffffff)continue; continue;
}
duplicates[i] = i; duplicates[i] = i;
for ( unsigned int a = i+1; a < src.size(); ++a) for ( unsigned int a = i+1; a < src.size(); ++a) {
{ if (src[i].scene == src[a].scene) {
if (src[i].scene == src[a].scene)
duplicates[a] = i; duplicates[a] = i;
} }
} }
}
// Generate unique names for all named stuff? // Generate unique names for all named stuff?
if (flags & AI_INT_MERGE_SCENE_GEN_UNIQUE_NAMES) if (flags & AI_INT_MERGE_SCENE_GEN_UNIQUE_NAMES)

View File

@ -76,7 +76,7 @@ struct NodeAttachmentInfo
: node (NULL) : node (NULL)
, attachToNode (NULL) , attachToNode (NULL)
, resolved (false) , resolved (false)
, src_idx (0xffffffff) , src_idx (SIZE_MAX)
{} {}
NodeAttachmentInfo(aiNode* _scene, aiNode* _attachToNode,size_t idx) NodeAttachmentInfo(aiNode* _scene, aiNode* _attachToNode,size_t idx)

View File

@ -70,11 +70,11 @@ void ScenePreprocessor::ProcessScene ()
// Check whether there are meshes with at least one set of uv coordinates ... add a dummy texture for them // Check whether there are meshes with at least one set of uv coordinates ... add a dummy texture for them
// meshes without texture coordinates receive a boring gray default material. // meshes without texture coordinates receive a boring gray default material.
unsigned int mat0 = 0xffffffff, mat1 = 0xffffffff; unsigned int mat0 = UINT_MAX, mat1 = UINT_MAX;
for (unsigned int i = 0; i < scene->mNumMeshes;++i) { for (unsigned int i = 0; i < scene->mNumMeshes;++i) {
if (scene->mMeshes[i]->mTextureCoords[0]) { if (scene->mMeshes[i]->mTextureCoords[0]) {
if (mat0 == 0xffffffff) { if (mat0 == UINT_MAX) {
scene->mMaterials[scene->mNumMaterials] = helper = new MaterialHelper(); scene->mMaterials[scene->mNumMaterials] = helper = new MaterialHelper();
name.Set("$texture.png"); name.Set("$texture.png");
@ -88,9 +88,8 @@ void ScenePreprocessor::ProcessScene ()
} }
scene->mMeshes[i]->mMaterialIndex = mat0; scene->mMeshes[i]->mMaterialIndex = mat0;
} }
else else {
{ if (mat1 == UINT_MAX) {
if (mat1 == 0xffffffff) {
scene->mMaterials[scene->mNumMaterials] = helper = new MaterialHelper(); scene->mMaterials[scene->mNumMaterials] = helper = new MaterialHelper();
aiColor3D clr(0.6f,0.6f,0.6f); aiColor3D clr(0.6f,0.6f,0.6f);

View File

@ -61,8 +61,8 @@ struct FaceWithSmoothingGroup
//! Indices. .3ds is using uint16. However, after //! Indices. .3ds is using uint16. However, after
//! an unique vrtex set has been generated it might //! an unique vrtex set has been generated,
//! be an index becomes > 2^16 //! individual index values might exceed 2^16
uint32_t mIndices[3]; uint32_t mIndices[3];
//! specifies to which smoothing group the face belongs to //! specifies to which smoothing group the face belongs to

View File

@ -92,7 +92,7 @@ void UpdateNodes(const std::vector<unsigned int>& replaceMeshIndex, aiNode* node
unsigned int add = node->mMeshes[m]<<2; unsigned int add = node->mMeshes[m]<<2;
for (unsigned int i = 0; i < 4;++i) for (unsigned int i = 0; i < 4;++i)
{ {
if (0xffffffff != replaceMeshIndex[add+i])++newSize; if (UINT_MAX != replaceMeshIndex[add+i])++newSize;
} }
} }
if (!newSize) if (!newSize)
@ -112,7 +112,7 @@ void UpdateNodes(const std::vector<unsigned int>& replaceMeshIndex, aiNode* node
unsigned int add = node->mMeshes[m]<<2; unsigned int add = node->mMeshes[m]<<2;
for (unsigned int i = 0; i < 4;++i) for (unsigned int i = 0; i < 4;++i)
{ {
if (0xffffffff != replaceMeshIndex[add+i]) if (UINT_MAX != replaceMeshIndex[add+i])
*newMeshes++ = replaceMeshIndex[add+i]; *newMeshes++ = replaceMeshIndex[add+i];
} }
} }
@ -147,7 +147,7 @@ void SortByPTypeProcess::Execute( aiScene* pScene)
bool bAnyChanges = false; bool bAnyChanges = false;
std::vector<unsigned int> replaceMeshIndex(pScene->mNumMeshes*4,0xffffffff); std::vector<unsigned int> replaceMeshIndex(pScene->mNumMeshes*4,UINT_MAX);
std::vector<unsigned int>::iterator meshIdx = replaceMeshIndex.begin(); std::vector<unsigned int>::iterator meshIdx = replaceMeshIndex.begin();
for (unsigned int i = 0; i < pScene->mNumMeshes;++i) for (unsigned int i = 0; i < pScene->mNumMeshes;++i)
{ {

View File

@ -310,7 +310,7 @@ void SpatialSort::FindIdenticalPositions( const aiVector3D& pPosition,
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
unsigned int SpatialSort::GenerateMappingTable(std::vector<unsigned int>& fill,float pRadius) const unsigned int SpatialSort::GenerateMappingTable(std::vector<unsigned int>& fill,float pRadius) const
{ {
fill.resize(mPositions.size(),0xffffffff); fill.resize(mPositions.size(),UINT_MAX);
float dist, maxDist; float dist, maxDist;
unsigned int t=0; unsigned int t=0;

View File

@ -401,7 +401,7 @@ void StandardShapes::MakeCone(float height,float radius1,
std::swap(radius2,radius1); std::swap(radius2,radius1);
halfHeight = -halfHeight; halfHeight = -halfHeight;
} }
else old = 0xffffffff; else old = SIZE_MAX;
// Use a large epsilon to check whether the cone is pointy // Use a large epsilon to check whether the cone is pointy
if (radius1 < (radius2-radius1)*10e-3f)radius1 = 0.f; if (radius1 < (radius2-radius1)*10e-3f)radius1 = 0.f;
@ -460,12 +460,12 @@ void StandardShapes::MakeCone(float height,float radius1,
} }
// Need to flip face order? // Need to flip face order?
if (0xffffffff != old ) if ( SIZE_MAX != old ) {
{ for (size_t s = old; s < positions.size();s += 3) {
for (size_t s = old; s < positions.size();s += 3)
std::swap(positions[s],positions[s+1]); std::swap(positions[s],positions[s+1]);
} }
} }
}
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Build a circle // Build a circle

View File

@ -248,11 +248,11 @@ public:
/** Setup a temporary read limit /** Setup a temporary read limit
* *
* @param limit Maximum number of bytes to be read from * @param limit Maximum number of bytes to be read from
* the beginning of the file. Passing 0xffffffff * the beginning of the file. Specifying UINT_MAX
* resets the limit to the original end of the stream. */ * resets the limit to the original end of the stream. */
void SetReadLimit(unsigned int _limit) { void SetReadLimit(unsigned int _limit) {
if (0xffffffff == _limit) { if (UINT_MAX == _limit) {
limit = end; limit = end;
return; return;
} }

View File

@ -92,8 +92,8 @@ void UnrealImporter::SetupProperties(const Importer* pImp)
// The // The
// AI_CONFIG_IMPORT_UNREAL_KEYFRAME option overrides the // AI_CONFIG_IMPORT_UNREAL_KEYFRAME option overrides the
// AI_CONFIG_IMPORT_GLOBAL_KEYFRAME option. // AI_CONFIG_IMPORT_GLOBAL_KEYFRAME option.
configFrameID = pImp->GetPropertyInteger(AI_CONFIG_IMPORT_UNREAL_KEYFRAME,0xffffffff); configFrameID = pImp->GetPropertyInteger(AI_CONFIG_IMPORT_UNREAL_KEYFRAME,-1);
if(0xffffffff == configFrameID) { if(static_cast<unsigned int>(-1) == configFrameID) {
configFrameID = pImp->GetPropertyInteger(AI_CONFIG_IMPORT_GLOBAL_KEYFRAME,0); configFrameID = pImp->GetPropertyInteger(AI_CONFIG_IMPORT_GLOBAL_KEYFRAME,0);
} }

View File

@ -111,11 +111,11 @@ inline unsigned int strtoul16( const char* in, const char** out=0)
// ------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------
// Convert just one hex digit // Convert just one hex digit
// Return value is 0xffffffff if the input is not hex // Return value is UINT_MAX if the input character is not a hex digit.
// ------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------
inline unsigned int HexDigitToDecimal(char in) inline unsigned int HexDigitToDecimal(char in)
{ {
unsigned int out = 0xffffffff; unsigned int out = UINT_MAX;
if (in >= '0' && in <= '9') if (in >= '0' && in <= '9')
out = in - '0'; out = in - '0';
@ -125,13 +125,12 @@ inline unsigned int HexDigitToDecimal(char in)
else if (in >= 'A' && in <= 'F') else if (in >= 'A' && in <= 'F')
out = 10u + in - 'A'; out = 10u + in - 'A';
// return value is 0xffffffff if the input is not a hex digit // return value is UINT_MAX if the input is not a hex digit
return out; return out;
} }
// ------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------
// Convert a hex-encoded octet (2 characters processed) // Convert a hex-encoded octet (2 characters, i.e. df or 1a).
// Return value is 0xffffffff if the input is not hex
// ------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------
inline uint8_t HexOctetToDecimal(const char* in) inline uint8_t HexOctetToDecimal(const char* in)
{ {