Commit 8772a2cd authored by hybrid's avatar hybrid

Changed .x loader to use u32.

Added profiling option to Makefile.
Removed some debug code.
Fixed ogre mesh loader using relative paths.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@945 dfc29bdd-3216-0410-991c-e03cc46cb475
parent e8783205
...@@ -26,7 +26,7 @@ inline void recalculateNormalsT_Flat(VTXTYPE* v, int vtxcnt, ...@@ -26,7 +26,7 @@ inline void recalculateNormalsT_Flat(VTXTYPE* v, int vtxcnt,
{ {
for (int i=0; i<idxcnt; i+=3) for (int i=0; i<idxcnt; i+=3)
{ {
core::plane3d<f32> p(v[idx[i+0]].Pos, v[idx[i+1]].Pos, v[idx[i+2]].Pos); const core::plane3d<f32> p(v[idx[i+0]].Pos, v[idx[i+1]].Pos, v[idx[i+2]].Pos);
v[idx[i+0]].Normal = p.Normal; v[idx[i+0]].Normal = p.Normal;
v[idx[i+1]].Normal = p.Normal; v[idx[i+1]].Normal = p.Normal;
v[idx[i+2]].Normal = p.Normal; v[idx[i+2]].Normal = p.Normal;
...@@ -46,7 +46,7 @@ inline void recalculateNormalsT_Smooth(VTXTYPE* v, int vtxcnt, ...@@ -46,7 +46,7 @@ inline void recalculateNormalsT_Smooth(VTXTYPE* v, int vtxcnt,
for ( i=0; i<idxcnt; i+=3) for ( i=0; i<idxcnt; i+=3)
{ {
core::plane3d<f32> p(v[idx[i+0]].Pos, v[idx[i+1]].Pos, v[idx[i+2]].Pos); const core::plane3d<f32> p(v[idx[i+0]].Pos, v[idx[i+1]].Pos, v[idx[i+2]].Pos);
v[idx[i+0]].Normal += p.Normal; v[idx[i+0]].Normal += p.Normal;
v[idx[i+1]].Normal += p.Normal; v[idx[i+1]].Normal += p.Normal;
v[idx[i+2]].Normal += p.Normal; v[idx[i+2]].Normal += p.Normal;
...@@ -69,9 +69,9 @@ inline void makePlanarMappingT(VERTEXTYPE *v, ...@@ -69,9 +69,9 @@ inline void makePlanarMappingT(VERTEXTYPE *v,
for (int i=0; i<idxcnt; i+=3) for (int i=0; i<idxcnt; i+=3)
{ {
core::plane3d<f32> p(v[idx[i+0]].Pos, v[idx[i+1]].Pos, v[idx[i+2]].Pos); core::plane3d<f32> p(v[idx[i+0]].Pos, v[idx[i+1]].Pos, v[idx[i+2]].Pos);
p.Normal.X = (f32)(fabs(p.Normal.X)); p.Normal.X = fabsf(p.Normal.X);
p.Normal.Y = (f32)(fabs(p.Normal.Y)); p.Normal.Y = fabsf(p.Normal.Y);
p.Normal.Z = (f32)(fabs(p.Normal.Z)); p.Normal.Z = fabsf(p.Normal.Z);
// calculate planar mapping worldspace coordinates // calculate planar mapping worldspace coordinates
if (p.Normal.X > p.Normal.Y && p.Normal.X > p.Normal.Z) if (p.Normal.X > p.Normal.Y && p.Normal.X > p.Normal.Z)
...@@ -668,7 +668,6 @@ IMesh* CMeshManipulator::createMeshWelded(IMesh *mesh, f32 tolerance) const ...@@ -668,7 +668,6 @@ IMesh* CMeshManipulator::createMeshWelded(IMesh *mesh, f32 tolerance) const
(v[i].Color == v[j].Color) ) (v[i].Color == v[j].Color) )
{ {
redirects[i] = redirects[j]; redirects[i] = redirects[j];
u32 p = redirects[j];
found = true; found = true;
break; break;
} }
...@@ -713,7 +712,6 @@ IMesh* CMeshManipulator::createMeshWelded(IMesh *mesh, f32 tolerance) const ...@@ -713,7 +712,6 @@ IMesh* CMeshManipulator::createMeshWelded(IMesh *mesh, f32 tolerance) const
(v[i].Color == v[j].Color) ) (v[i].Color == v[j].Color) )
{ {
redirects[i] = redirects[j]; redirects[i] = redirects[j];
u32 p = redirects[j];
found = true; found = true;
break; break;
} }
...@@ -758,7 +756,6 @@ IMesh* CMeshManipulator::createMeshWelded(IMesh *mesh, f32 tolerance) const ...@@ -758,7 +756,6 @@ IMesh* CMeshManipulator::createMeshWelded(IMesh *mesh, f32 tolerance) const
(v[i].Color == v[j].Color) ) (v[i].Color == v[j].Color) )
{ {
redirects[i] = redirects[j]; redirects[i] = redirects[j];
u32 p = redirects[j];
found = true; found = true;
break; break;
} }
......
...@@ -214,6 +214,9 @@ void CNullDriver::setMaterial(const SMaterial& material) ...@@ -214,6 +214,9 @@ void CNullDriver::setMaterial(const SMaterial& material)
//! memory. //! memory.
void CNullDriver::removeTexture(ITexture* texture) void CNullDriver::removeTexture(ITexture* texture)
{ {
if (!texture)
return;
for (u32 i=0; i<Textures.size(); ++i) for (u32 i=0; i<Textures.size(); ++i)
if (Textures[i].Surface == texture) if (Textures[i].Surface == texture)
{ {
...@@ -252,8 +255,8 @@ s32 CNullDriver::getTextureCount() ...@@ -252,8 +255,8 @@ s32 CNullDriver::getTextureCount()
void CNullDriver::renameTexture(ITexture* texture, const c8* newName) void CNullDriver::renameTexture(ITexture* texture, const c8* newName)
{ {
// we can do a const_cast here safely, the name of the ITexture interface // we can do a const_cast here safely, the name of the ITexture interface
// is only readonly to prevent the user changing the textures name without invoking // is just readonly to prevent the user changing the texture name without invoking
// this method, because the texures will need resorting afterwards // this method, because the textures will need resorting afterwards
core::stringc& name = const_cast<core::stringc&>(texture->getName()); core::stringc& name = const_cast<core::stringc&>(texture->getName());
name = newName; name = newName;
......
...@@ -377,10 +377,14 @@ void COgreMeshFileLoader::composeMeshBufferMaterial(scene::IMeshBuffer* mb, cons ...@@ -377,10 +377,14 @@ void COgreMeshFileLoader::composeMeshBufferMaterial(scene::IMeshBuffer* mb, cons
if (!material.Textures[0]) if (!material.Textures[0])
{ {
// retry with relative path // retry with relative path
core::stringc relative = CurrentlyLoadingFromPath; core::stringc relative = Materials[k].Techniques[0].Passes[0].Texture.Filename;
relative += '/'; s32 idx = relative.findLast('\\');
relative += Materials[k].Techniques[0].Passes[0].Texture.Filename; if (idx != -1)
material.Textures[0] = Driver->getTexture(relative.c_str()); relative = relative.subString(idx+1, relative.size()-idx-1);
idx = relative.findLast('/');
if (idx != -1)
relative = relative.subString(idx+1, relative.size()-idx-1);
material.Textures[0] = Driver->getTexture((CurrentlyLoadingFromPath+"/"+relative).c_str());
} }
} }
break; break;
...@@ -517,8 +521,8 @@ scene::SMeshBufferLightMap* COgreMeshFileLoader::composeMeshBufferLightMap(const ...@@ -517,8 +521,8 @@ scene::SMeshBufferLightMap* COgreMeshFileLoader::composeMeshBufferLightMap(const
u32 ePos=geom.Elements[i].Offset; u32 ePos=geom.Elements[i].Offset;
for (s32 k=0; k<geom.NumVertex; ++k) for (s32 k=0; k<geom.NumVertex; ++k)
{ {
mb->Vertices[k].TCoords.set( geom.Buffers[j].Data[ePos] ,geom.Buffers[j].Data[ePos+1]); mb->Vertices[k].TCoords.set(geom.Buffers[j].Data[ePos], geom.Buffers[j].Data[ePos+1]);
mb->Vertices[k].TCoords2.set(geom.Buffers[j].Data[ePos+2],geom.Buffers[j].Data[ePos+3]); mb->Vertices[k].TCoords2.set(geom.Buffers[j].Data[ePos+2], geom.Buffers[j].Data[ePos+3]);
ePos += eSize; ePos += eSize;
} }
......
...@@ -1486,18 +1486,6 @@ const quake3::SShader * CQ3LevelMesh::getShader ( const c8 * filename, s32 fileN ...@@ -1486,18 +1486,6 @@ const quake3::SShader * CQ3LevelMesh::getShader ( const c8 * filename, s32 fileN
if ( index >= 0 ) if ( index >= 0 )
return 0; return 0;
#if 0
core::stringc message;
message = loadFile + " for " + core::stringc ( filename );
os::Printer::log("Q3: Loading shader file ", message.c_str(), ELL_INFORMATION);
io::IReadFile *file = FileSystem->createAndOpenFile ( loadFile.c_str () );
if ( 0 == file )
{
os::Printer::log("Q3: could not load shader ", loadFile.c_str(), ELL_INFORMATION);
return 0;
}
#endif
if ( !FileSystem->existFile ( loadFile.c_str () ) ) if ( !FileSystem->existFile ( loadFile.c_str () ) )
return 0; return 0;
......
...@@ -1116,23 +1116,6 @@ namespace scene ...@@ -1116,23 +1116,6 @@ namespace scene
delete [] TerrainData.Patches; delete [] TerrainData.Patches;
TerrainData.Patches = new SPatch[TerrainData.PatchCount * TerrainData.PatchCount]; TerrainData.Patches = new SPatch[TerrainData.PatchCount * TerrainData.PatchCount];
#if 0
gui::IGUIFont* font = SceneManager->getGUIEnvironment()->getFont("../../media/bigfont.png");
font->setKerning ( -2 );
for( s32 j = 0; j < TerrainData.PatchCount * TerrainData.PatchCount; ++j )
{
const core::stringw buf(j);
TerrainData.Patches[j].DebugText = SceneManager->addTextSceneNode (
font,
buf.c_str(),
0xFFFFFFFF,
0
);
}
#endif
} }
//! used to calculate the internal STerrainData structure both at creation and after scaling/position calls. //! used to calculate the internal STerrainData structure both at creation and after scaling/position calls.
...@@ -1323,10 +1306,10 @@ namespace scene ...@@ -1323,10 +1306,10 @@ namespace scene
// set possible new scale // set possible new scale
if (core::equals(tcoordScale1, 0)) if (core::equals(tcoordScale1, 0.f))
tcoordScale1 = 1.0f; tcoordScale1 = 1.0f;
if (core::equals(tcoordScale2, 0)) if (core::equals(tcoordScale2, 0.f))
tcoordScale2 = 1.0f; tcoordScale2 = 1.0f;
if (!core::equals(tcoordScale1, TCoordScale1) || if (!core::equals(tcoordScale1, TCoordScale1) ||
......
...@@ -596,8 +596,8 @@ bool CXMeshFileLoader::parseDataObjectTransformationMatrix(core::matrix4 &mat) ...@@ -596,8 +596,8 @@ bool CXMeshFileLoader::parseDataObjectTransformationMatrix(core::matrix4 &mat)
return false; return false;
} }
for (s32 i=0; i<4; ++i) for (u32 i=0; i<4; ++i)
for (s32 j=0; j<4; ++j) for (u32 j=0; j<4; ++j)
mat(i,j)=readFloat(); mat(i,j)=readFloat();
if (!checkForTwoFollowingSemicolons()) if (!checkForTwoFollowingSemicolons())
...@@ -632,19 +632,17 @@ bool CXMeshFileLoader::parseDataObjectMesh(SXMesh &mesh) ...@@ -632,19 +632,17 @@ bool CXMeshFileLoader::parseDataObjectMesh(SXMesh &mesh)
} }
// read vertex count // read vertex count
s32 nVertices = readInt(); const u32 nVertices = readInt();
// read vertices // read vertices
mesh.Vertices.set_used(nVertices); //luke: change mesh.Vertices.set_used(nVertices); //luke: change
for (s32 nums=0; nums<nVertices; ++nums)
mesh.Vertices[nums].Color=0xFFFFFFFF;
for (s32 n=0; n<nVertices; ++n) for (u32 n=0; n<nVertices; ++n)
{ {
readVector3(mesh.Vertices[n].Pos); readVector3(mesh.Vertices[n].Pos);
mesh.Vertices[n].Color=0xFFFFFFFF;
} }
if (!checkForTwoFollowingSemicolons()) if (!checkForTwoFollowingSemicolons())
{ {
os::Printer::log("No finishing semicolon in Mesh Vertex Array found in x file", ELL_WARNING); os::Printer::log("No finishing semicolon in Mesh Vertex Array found in x file", ELL_WARNING);
...@@ -652,17 +650,17 @@ bool CXMeshFileLoader::parseDataObjectMesh(SXMesh &mesh) ...@@ -652,17 +650,17 @@ bool CXMeshFileLoader::parseDataObjectMesh(SXMesh &mesh)
} }
// read faces // read faces
s32 nFaces = readInt(); const u32 nFaces = readInt();
mesh.Indices.set_used(nFaces * 3); mesh.Indices.set_used(nFaces * 3);
mesh.IndexCountPerFace.set_used(nFaces); mesh.IndexCountPerFace.set_used(nFaces);
core::array<s32> polygonfaces; core::array<u32> polygonfaces;
s32 currentIndex = 0; u32 currentIndex = 0;
for (s32 k=0; k<nFaces; ++k) for (u32 k=0; k<nFaces; ++k)
{ {
s32 fcnt = readInt(); const u32 fcnt = readInt();
if (fcnt != 3) if (fcnt != 3)
{ {
...@@ -674,14 +672,14 @@ bool CXMeshFileLoader::parseDataObjectMesh(SXMesh &mesh) ...@@ -674,14 +672,14 @@ bool CXMeshFileLoader::parseDataObjectMesh(SXMesh &mesh)
// read face indices // read face indices
polygonfaces.set_used(fcnt); polygonfaces.set_used(fcnt);
s32 triangles = (fcnt-2); u32 triangles = (fcnt-2);
mesh.Indices.set_used(mesh.Indices.size() + ((triangles*3)-3)); mesh.Indices.set_used(mesh.Indices.size() + ((triangles*3)-3));
mesh.IndexCountPerFace[k] = triangles * 3; mesh.IndexCountPerFace[k] = triangles * 3;
for (s32 f=0; f<fcnt; ++f) for (u32 f=0; f<fcnt; ++f)
polygonfaces[f] = readInt(); polygonfaces[f] = readInt();
for (s32 jk=0; jk<triangles; ++jk) for (u32 jk=0; jk<triangles; ++jk)
{ {
mesh.Indices[currentIndex++] = polygonfaces[0]; mesh.Indices[currentIndex++] = polygonfaces[0];
mesh.Indices[currentIndex++] = polygonfaces[jk+1]; mesh.Indices[currentIndex++] = polygonfaces[jk+1];
...@@ -829,10 +827,10 @@ bool CXMeshFileLoader::parseDataObjectSkinWeights(SXMesh &mesh) ...@@ -829,10 +827,10 @@ bool CXMeshFileLoader::parseDataObjectSkinWeights(SXMesh &mesh)
} }
// read vertex weights // read vertex weights
const s32 nWeights = readInt(); const u32 nWeights = readInt();
// read vertex indices // read vertex indices
s32 i; u32 i;
const u32 jointStart = joint->Weights.size(); const u32 jointStart = joint->Weights.size();
joint->Weights.reallocate(jointStart+nWeights); joint->Weights.reallocate(jointStart+nWeights);
...@@ -921,13 +919,12 @@ bool CXMeshFileLoader::parseDataObjectMeshNormals(SXMesh &mesh) ...@@ -921,13 +919,12 @@ bool CXMeshFileLoader::parseDataObjectMeshNormals(SXMesh &mesh)
} }
// read count // read count
s32 nNormals; const u32 nNormals = readInt();
nNormals = readInt();
core::array<core::vector3df> normals; core::array<core::vector3df> normals;
normals.set_used(nNormals); normals.set_used(nNormals);
// read normals // read normals
for (s32 i=0; i<nNormals; ++i) for (u32 i=0; i<nNormals; ++i)
readVector3(normals[i]); readVector3(normals[i]);
if (!checkForTwoFollowingSemicolons()) if (!checkForTwoFollowingSemicolons())
...@@ -936,23 +933,19 @@ bool CXMeshFileLoader::parseDataObjectMeshNormals(SXMesh &mesh) ...@@ -936,23 +933,19 @@ bool CXMeshFileLoader::parseDataObjectMeshNormals(SXMesh &mesh)
return false; return false;
} }
core::array<s32> normalIndices; core::array<u32> normalIndices;
normalIndices.set_used(mesh.Indices.size());
s32 triangulatedIndexCount=mesh.Indices.size();
// read face normal indices // read face normal indices
s32 nFNormals = readInt(); const u32 nFNormals = readInt();
normalIndices.set_used(triangulatedIndexCount);
s32 normalidx = 0; u32 normalidx = 0;
core::array<s32> polygonfaces; core::array<u32> polygonfaces;
polygonfaces.reallocate(32); for (u32 k=0; k<nFNormals; ++k)
for (s32 k=0; k<nFNormals; ++k)
{ {
s32 fcnt = readInt(); const u32 fcnt = readInt();
s32 triangles = fcnt - 2; u32 triangles = fcnt - 2;
s32 indexcount = triangles * 3; u32 indexcount = triangles * 3;
if (indexcount != mesh.IndexCountPerFace[k]) if (indexcount != mesh.IndexCountPerFace[k])
{ {
...@@ -963,21 +956,20 @@ bool CXMeshFileLoader::parseDataObjectMeshNormals(SXMesh &mesh) ...@@ -963,21 +956,20 @@ bool CXMeshFileLoader::parseDataObjectMeshNormals(SXMesh &mesh)
if (indexcount == 3) if (indexcount == 3)
{ {
// default, only one triangle in this face // default, only one triangle in this face
for (s32 h=0; h<3; ++h) for (u32 h=0; h<3; ++h)
{ {
s32 normalnum = readInt(); const u32 normalnum = readInt();
mesh.Vertices[mesh.Indices[normalidx++]].Normal.set(normals[normalnum]); mesh.Vertices[mesh.Indices[normalidx++]].Normal.set(normals[normalnum]);
} }
} }
else else
{ {
// multiple triangles in this face
polygonfaces.set_used(fcnt); polygonfaces.set_used(fcnt);
// multiple triangles in this face
for (s32 h=0; h<fcnt; ++h) for (u32 h=0; h<fcnt; ++h)
polygonfaces[h] = readInt(); polygonfaces[h] = readInt();
for (s32 jk=0; jk<triangles; ++jk) for (u32 jk=0; jk<triangles; ++jk)
{ {
mesh.Vertices[mesh.Indices[normalidx++]].Normal.set(normals[polygonfaces[0]]); mesh.Vertices[mesh.Indices[normalidx++]].Normal.set(normals[polygonfaces[0]]);
mesh.Vertices[mesh.Indices[normalidx++]].Normal.set(normals[polygonfaces[jk+1]]); mesh.Vertices[mesh.Indices[normalidx++]].Normal.set(normals[polygonfaces[jk+1]]);
...@@ -1014,9 +1006,8 @@ bool CXMeshFileLoader::parseDataObjectMeshTextureCoords(SXMesh &mesh) ...@@ -1014,9 +1006,8 @@ bool CXMeshFileLoader::parseDataObjectMeshTextureCoords(SXMesh &mesh)
return false; return false;
} }
s32 nCoords; const u32 nCoords = readInt();
nCoords = readInt(); for (u32 i=0; i<nCoords; ++i)
for (s32 i=0; i<nCoords; ++i)
readVector2(mesh.Vertices[i].TCoords); readVector2(mesh.Vertices[i].TCoords);
if (!checkForTwoFollowingSemicolons()) if (!checkForTwoFollowingSemicolons())
...@@ -1094,9 +1085,9 @@ bool CXMeshFileLoader::parseDataObjectMeshMaterialList(SXMesh &mesh) ...@@ -1094,9 +1085,9 @@ bool CXMeshFileLoader::parseDataObjectMeshMaterialList(SXMesh &mesh)
mesh.Materials.reallocate(readInt()); mesh.Materials.reallocate(readInt());
// read non triangulated face material index count // read non triangulated face material index count
const s32 nFaceIndices = readInt(); const u32 nFaceIndices = readInt();
if (nFaceIndices != (s32)mesh.IndexCountPerFace.size()) if (nFaceIndices != mesh.IndexCountPerFace.size())
{ {
os::Printer::log("Index count per face not equal to face material index count in x file.", ELL_WARNING); os::Printer::log("Index count per face not equal to face material index count in x file.", ELL_WARNING);
return false; return false;
...@@ -1104,13 +1095,13 @@ bool CXMeshFileLoader::parseDataObjectMeshMaterialList(SXMesh &mesh) ...@@ -1104,13 +1095,13 @@ bool CXMeshFileLoader::parseDataObjectMeshMaterialList(SXMesh &mesh)
// read non triangulated face indices and create triangulated ones // read non triangulated face indices and create triangulated ones
mesh.FaceMaterialIndices.set_used( mesh.Indices.size() / 3); mesh.FaceMaterialIndices.set_used( mesh.Indices.size() / 3);
s32 triangulatedindex = -1; u32 triangulatedindex = 0;
for (s32 tfi=0; tfi<nFaceIndices; ++tfi) for (u32 tfi=0; tfi<nFaceIndices; ++tfi)
{ {
const s32 ind = readInt(); const u32 ind = readInt();
const s32 fc = mesh.IndexCountPerFace[tfi]/3; const u32 fc = mesh.IndexCountPerFace[tfi]/3;
for (s32 k=0; k<fc; ++k) for (u32 k=0; k<fc; ++k)
mesh.FaceMaterialIndices[++triangulatedindex] = ind; mesh.FaceMaterialIndices[triangulatedindex++] = ind;
} }
// in version 03.02, the face indices end with two semicolons. // in version 03.02, the face indices end with two semicolons.
...@@ -1437,26 +1428,26 @@ bool CXMeshFileLoader::parseDataObjectAnimationKey(ISkinnedMesh::SJoint *joint) ...@@ -1437,26 +1428,26 @@ bool CXMeshFileLoader::parseDataObjectAnimationKey(ISkinnedMesh::SJoint *joint)
// read key type // read key type
s32 keyType = readInt(); const u32 keyType = readInt();
if ((u32)keyType > 4) if (keyType > 4)
{ {
os::Printer::log("Unknown key type found in Animation Key in x file", ELL_WARNING); os::Printer::log("Unknown key type found in Animation Key in x file", ELL_WARNING);
return false; return false;
} }
// read number of keys // read number of keys
const s32 numberOfKeys = readInt(); const u32 numberOfKeys = readInt();
// eat the semicolon after the "0". if there are keys present, readInt() // eat the semicolon after the "0". if there are keys present, readInt()
// does this for us. If there aren't, we need to do it explicitly // does this for us. If there aren't, we need to do it explicitly
if (numberOfKeys == 0) if (numberOfKeys == 0)
checkForOneFollowingSemicolons(); checkForOneFollowingSemicolons();
for (s32 i=0; i<numberOfKeys; ++i) for (u32 i=0; i<numberOfKeys; ++i)
{ {
// read time // read time
const s32 time = readInt(); const u32 time = readInt();
// read keys // read keys
switch(keyType) switch(keyType)
...@@ -1538,8 +1529,8 @@ bool CXMeshFileLoader::parseDataObjectAnimationKey(ISkinnedMesh::SJoint *joint) ...@@ -1538,8 +1529,8 @@ bool CXMeshFileLoader::parseDataObjectAnimationKey(ISkinnedMesh::SJoint *joint)
// read matrix // read matrix
core::matrix4 Matrix; core::matrix4 Matrix;
for (s32 m=0; m<4; ++m) for (u32 m=0; m<4; ++m)
for (s32 n=0; n<4; ++n) for (u32 n=0; n<4; ++n)
Matrix(m,n) = readFloat(); Matrix(m,n) = readFloat();
...@@ -1632,7 +1623,7 @@ bool CXMeshFileLoader::parseUnknownDataObject() ...@@ -1632,7 +1623,7 @@ bool CXMeshFileLoader::parseUnknownDataObject()
break; break;
} }
s32 counter = 1; u32 counter = 1;
// parse until closing delimiter // parse until closing delimiter
...@@ -1677,7 +1668,7 @@ bool CXMeshFileLoader::checkForTwoFollowingSemicolons() ...@@ -1677,7 +1668,7 @@ bool CXMeshFileLoader::checkForTwoFollowingSemicolons()
if (BinaryFormat) if (BinaryFormat)
return true; return true;
for (s32 k=0; k<2; ++k) for (u32 k=0; k<2; ++k)
{ {
if (getNextToken() != ";") if (getNextToken() != ";")
return false; return false;
...@@ -1718,7 +1709,7 @@ core::stringc CXMeshFileLoader::getNextToken() ...@@ -1718,7 +1709,7 @@ core::stringc CXMeshFileLoader::getNextToken()
// and (correctly) skip over other tokens. // and (correctly) skip over other tokens.
s16 tok = readBinWord(); s16 tok = readBinWord();
s32 len; u32 len;
// standalone tokens // standalone tokens
switch (tok) { switch (tok) {
...@@ -1948,7 +1939,7 @@ u32 CXMeshFileLoader::readBinDWord() ...@@ -1948,7 +1939,7 @@ u32 CXMeshFileLoader::readBinDWord()
} }
s32 CXMeshFileLoader::readInt() u32 CXMeshFileLoader::readInt()
{ {
if (BinaryFormat) if (BinaryFormat)
{ {
...@@ -1965,10 +1956,8 @@ s32 CXMeshFileLoader::readInt() ...@@ -1965,10 +1956,8 @@ s32 CXMeshFileLoader::readInt()
} }
else else
{ {
f32 ftmp;
findNextNoneWhiteSpaceNumber(); findNextNoneWhiteSpaceNumber();
P = core::fast_atof_move(P, ftmp); return core::strtol10(P, &P);
return core::floor32(ftmp);
} }
} }
......
...@@ -57,11 +57,11 @@ public: ...@@ -57,11 +57,11 @@ public:
core::stringc Name; core::stringc Name;
s32 MaxSkinWeightsPerVertex; u32 MaxSkinWeightsPerVertex;
s32 MaxSkinWeightsPerFace; u32 MaxSkinWeightsPerFace;
s32 BoneCount; u32 BoneCount;
core::array< s32 > IndexCountPerFace; // default 3, but could be more core::array< u32 > IndexCountPerFace; // default 3, but could be more
core::array<scene::SSkinMeshBuffer*> Buffers; core::array<scene::SSkinMeshBuffer*> Buffers;
...@@ -150,7 +150,7 @@ private: ...@@ -150,7 +150,7 @@ private:
u16 readBinWord(); u16 readBinWord();
u32 readBinDWord(); u32 readBinDWord();
s32 readInt(); u32 readInt();
f32 readFloat(); f32 readFloat();
bool readVector2(core::vector2df& vec); bool readVector2(core::vector2df& vec);
bool readVector3(core::vector3df& vec); bool readVector3(core::vector3df& vec);
...@@ -170,7 +170,7 @@ private: ...@@ -170,7 +170,7 @@ private:
u32 MinorVersion; u32 MinorVersion;
bool BinaryFormat; bool BinaryFormat;
// counter for number arrays in binary format // counter for number arrays in binary format
s32 BinaryNumCount; u32 BinaryNumCount;
c8* Buffer; c8* Buffer;
const c8* P; const c8* P;
......
...@@ -47,6 +47,9 @@ CXXFLAGS += -g -D_DEBUG ...@@ -47,6 +47,9 @@ CXXFLAGS += -g -D_DEBUG
else else
CXXFLAGS += -fexpensive-optimizations -O3 CXXFLAGS += -fexpensive-optimizations -O3
endif endif
ifdef PROFILE
CXXFLAGS += -pg
endif
CFLAGS := -fexpensive-optimizations -O3 -DPNG_NO_MMX_CODE -DPNG_NO_MNG_FEATURES CFLAGS := -fexpensive-optimizations -O3 -DPNG_NO_MMX_CODE -DPNG_NO_MNG_FEATURES
#Linux specific options #Linux specific options
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment