Commit 71a1e46d authored by hybrid's avatar hybrid

Fixed some warnings and indentation.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@926 dfc29bdd-3216-0410-991c-e03cc46cb475
parent e2f8a703
......@@ -69,3 +69,4 @@ namespace scene
} // end namespace
#endif
......@@ -197,9 +197,9 @@ inline u32 getVertexPitchFromType(E_VERTEX_TYPE vertexType)
return sizeof(video::S3DVertex2TCoords);
case video::EVT_TANGENTS:
return sizeof(video::S3DVertexTangents);
}
default:
return sizeof(video::S3DVertex);
}
}
......
#include "CColladaMeshWriter.h"
#include "os.h"
#include "IFileSystem.h"
#include "IXMLWriter.h"
#include "IMesh.h"
#include "IAttributes.h"
......@@ -12,7 +13,7 @@ namespace scene
CColladaMeshWriter::CColladaMeshWriter(irr::video::IVideoDriver* driver,
irr::io::IFileSystem* fs)
: VideoDriver(driver), FileSystem(fs)
: FileSystem(fs), VideoDriver(driver), Writer(0)
{
if (VideoDriver)
VideoDriver->grab();
......@@ -88,7 +89,8 @@ bool CColladaMeshWriter::writeMesh(io::IWriteFile* file, scene::IMesh* mesh, s32
Writer->writeElement(L"library", false, L"type", L"MATERIAL");
Writer->writeLineBreak();
for (int i=0; i<(int)mesh->getMeshBufferCount(); ++i)
u32 i;
for (i=0; i<mesh->getMeshBufferCount(); ++i)
{
core::stringw strMat = "mat";
strMat += i;
......@@ -103,8 +105,8 @@ bool CColladaMeshWriter::writeMesh(io::IWriteFile* file, scene::IMesh* mesh, s32
irr::io::IAttributes* attributes = VideoDriver->createAttributesFromMaterial(
mesh->getMeshBuffer(i)->getMaterial());
int count = attributes->getAttributeCount();
for (int attridx=0; attridx<count; ++attridx)
s32 count = attributes->getAttributeCount();
for (s32 attridx=0; attridx<count; ++attridx)
{
core::stringw str = attributes->getAttributeName(attridx);
......@@ -145,11 +147,11 @@ bool CColladaMeshWriter::writeMesh(io::IWriteFile* file, scene::IMesh* mesh, s32
// - count amount of second texture coordinates
// - check for the need of tangents (TODO)
int totalVertexCount = 0;
int totalTCoords2Count = 0;
u32 totalVertexCount = 0;
u32 totalTCoords2Count = 0;
bool needsTangents = false; // TODO: tangents not supported here yet
for (int i=0; i<(int)mesh->getMeshBufferCount(); ++i)
for (i=0; i<mesh->getMeshBufferCount(); ++i)
{
totalVertexCount += mesh->getMeshBuffer(i)->getVertexCount();
......@@ -172,11 +174,11 @@ bool CColladaMeshWriter::writeMesh(io::IWriteFile* file, scene::IMesh* mesh, s32
L"type", L"float", L"count", vertexCountStr.c_str());
Writer->writeLineBreak();
for (int i=0; i<(int)mesh->getMeshBufferCount(); ++i)
for (i=0; i<mesh->getMeshBufferCount(); ++i)
{
scene::IMeshBuffer* buffer = mesh->getMeshBuffer(i);
video::E_VERTEX_TYPE vtxType = buffer->getVertexType();
int vertexCount = buffer->getVertexCount();
u32 vertexCount = buffer->getVertexCount();
globalIndices[i].PosStartIndex = 0;
......@@ -190,7 +192,7 @@ bool CColladaMeshWriter::writeMesh(io::IWriteFile* file, scene::IMesh* mesh, s32
case video::EVT_STANDARD:
{
video::S3DVertex* vtx = (video::S3DVertex*)buffer->getVertices();
for (int j=0; j<vertexCount; ++j)
for (u32 j=0; j<vertexCount; ++j)
{
core::stringw str;
str += vtx[j].Pos.X;
......@@ -207,7 +209,7 @@ bool CColladaMeshWriter::writeMesh(io::IWriteFile* file, scene::IMesh* mesh, s32
case video::EVT_2TCOORDS:
{
video::S3DVertex2TCoords* vtx = (video::S3DVertex2TCoords*)buffer->getVertices();
for (int j=0; j<vertexCount; ++j)
for (u32 j=0; j<vertexCount; ++j)
{
core::stringw str;
str += vtx[j].Pos.X;
......@@ -224,7 +226,7 @@ bool CColladaMeshWriter::writeMesh(io::IWriteFile* file, scene::IMesh* mesh, s32
case video::EVT_TANGENTS:
{
video::S3DVertexTangents* vtx = (video::S3DVertexTangents*)buffer->getVertices();
for (int j=0; j<vertexCount; ++j)
for (u32 j=0; j<vertexCount; ++j)
{
core::stringw str;
str += vtx[j].Pos.X;
......@@ -279,11 +281,11 @@ bool CColladaMeshWriter::writeMesh(io::IWriteFile* file, scene::IMesh* mesh, s32
L"type", L"float", L"count", vertexCountStr.c_str());
Writer->writeLineBreak();
for (int i=0; i<(int)mesh->getMeshBufferCount(); ++i)
for (i=0; i<mesh->getMeshBufferCount(); ++i)
{
scene::IMeshBuffer* buffer = mesh->getMeshBuffer(i);
video::E_VERTEX_TYPE vtxType = buffer->getVertexType();
int vertexCount = buffer->getVertexCount();
u32 vertexCount = buffer->getVertexCount();
globalIndices[i].TCoord0StartIndex = 0;
......@@ -297,7 +299,7 @@ bool CColladaMeshWriter::writeMesh(io::IWriteFile* file, scene::IMesh* mesh, s32
case video::EVT_STANDARD:
{
video::S3DVertex* vtx = (video::S3DVertex*)buffer->getVertices();
for (int j=0; j<vertexCount; ++j)
for (u32 j=0; j<vertexCount; ++j)
{
core::stringw str;
str += vtx[j].TCoords.X;
......@@ -312,7 +314,7 @@ bool CColladaMeshWriter::writeMesh(io::IWriteFile* file, scene::IMesh* mesh, s32
case video::EVT_2TCOORDS:
{
video::S3DVertex2TCoords* vtx = (video::S3DVertex2TCoords*)buffer->getVertices();
for (int j=0; j<vertexCount; ++j)
for (u32 j=0; j<vertexCount; ++j)
{
core::stringw str;
str += vtx[j].TCoords.X;
......@@ -327,7 +329,7 @@ bool CColladaMeshWriter::writeMesh(io::IWriteFile* file, scene::IMesh* mesh, s32
case video::EVT_TANGENTS:
{
video::S3DVertexTangents* vtx = (video::S3DVertexTangents*)buffer->getVertices();
for (int j=0; j<vertexCount; ++j)
for (u32 j=0; j<vertexCount; ++j)
{
core::stringw str;
str += vtx[j].TCoords.X;
......@@ -378,11 +380,11 @@ bool CColladaMeshWriter::writeMesh(io::IWriteFile* file, scene::IMesh* mesh, s32
L"type", L"float", L"count", vertexCountStr.c_str());
Writer->writeLineBreak();
for (int i=0; i<(int)mesh->getMeshBufferCount(); ++i)
for (i=0; i<mesh->getMeshBufferCount(); ++i)
{
scene::IMeshBuffer* buffer = mesh->getMeshBuffer(i);
video::E_VERTEX_TYPE vtxType = buffer->getVertexType();
int vertexCount = buffer->getVertexCount();
u32 vertexCount = buffer->getVertexCount();
globalIndices[i].NormalStartIndex = 0;
......@@ -396,7 +398,7 @@ bool CColladaMeshWriter::writeMesh(io::IWriteFile* file, scene::IMesh* mesh, s32
case video::EVT_STANDARD:
{
video::S3DVertex* vtx = (video::S3DVertex*)buffer->getVertices();
for (int j=0; j<vertexCount; ++j)
for (u32 j=0; j<vertexCount; ++j)
{
core::stringw str;
str += vtx[j].Normal.X;
......@@ -413,7 +415,7 @@ bool CColladaMeshWriter::writeMesh(io::IWriteFile* file, scene::IMesh* mesh, s32
case video::EVT_2TCOORDS:
{
video::S3DVertex2TCoords* vtx = (video::S3DVertex2TCoords*)buffer->getVertices();
for (int j=0; j<vertexCount; ++j)
for (u32 j=0; j<vertexCount; ++j)
{
core::stringw str;
str += vtx[j].Normal.X;
......@@ -430,7 +432,7 @@ bool CColladaMeshWriter::writeMesh(io::IWriteFile* file, scene::IMesh* mesh, s32
case video::EVT_TANGENTS:
{
video::S3DVertexTangents* vtx = (video::S3DVertexTangents*)buffer->getVertices();
for (int j=0; j<vertexCount; ++j)
for (u32 j=0; j<vertexCount; ++j)
{
core::stringw str;
str += vtx[j].Normal.X;
......@@ -487,11 +489,11 @@ bool CColladaMeshWriter::writeMesh(io::IWriteFile* file, scene::IMesh* mesh, s32
L"type", L"float", L"count", vertexCountStr.c_str());
Writer->writeLineBreak();
for (int i=0; i<(int)mesh->getMeshBufferCount(); ++i)
for (i=0; i<mesh->getMeshBufferCount(); ++i)
{
scene::IMeshBuffer* buffer = mesh->getMeshBuffer(i);
video::E_VERTEX_TYPE vtxType = buffer->getVertexType();
int vertexCount = buffer->getVertexCount();
u32 vertexCount = buffer->getVertexCount();
if (hasSecondTextureCoordinates(vtxType))
{
......@@ -507,7 +509,7 @@ bool CColladaMeshWriter::writeMesh(io::IWriteFile* file, scene::IMesh* mesh, s32
case video::EVT_2TCOORDS:
{
video::S3DVertex2TCoords* vtx = (video::S3DVertex2TCoords*)buffer->getVertices();
for (int j=0; j<vertexCount; ++j)
for (u32 j=0; j<vertexCount; ++j)
{
core::stringw str;
str += vtx[j].TCoords2.X;
......@@ -567,11 +569,11 @@ bool CColladaMeshWriter::writeMesh(io::IWriteFile* file, scene::IMesh* mesh, s32
// write polygons
for (int i=0; i<(int)mesh->getMeshBufferCount(); ++i)
for (i=0; i<mesh->getMeshBufferCount(); ++i)
{
scene::IMeshBuffer* buffer = mesh->getMeshBuffer(i);
int polyCount = buffer->getIndexCount() / 3;
u32 polyCount = buffer->getIndexCount() / 3;
core::stringw strPolyCount = polyCount;
core::stringw strMat = "#mat";
strMat += i;
......@@ -596,50 +598,50 @@ bool CColladaMeshWriter::writeMesh(io::IWriteFile* file, scene::IMesh* mesh, s32
// write indices now
int posIdx = globalIndices[i].PosStartIndex;
int tCoordIdx = globalIndices[i].TCoord0StartIndex;
int normalIdx = globalIndices[i].NormalStartIndex;
int tCoord2Idx = globalIndices[i].TCoord1StartIndex;
s32 posIdx = globalIndices[i].PosStartIndex;
s32 tCoordIdx = globalIndices[i].TCoord0StartIndex;
s32 normalIdx = globalIndices[i].NormalStartIndex;
s32 tCoord2Idx = globalIndices[i].TCoord1StartIndex;
for (int p=0; p<polyCount; ++p)
for (u32 p=0; p<polyCount; ++p)
{
Writer->writeElement(L"p", false);
core::stringw strP;
strP += (int)(buffer->getIndices()[(p*3) + 0]) + posIdx;
strP += buffer->getIndices()[(p*3) + 0] + posIdx;
strP += " ";
strP += (int)(buffer->getIndices()[(p*3) + 0]) + tCoordIdx;
strP += buffer->getIndices()[(p*3) + 0] + tCoordIdx;
strP += " ";
strP += (int)(buffer->getIndices()[(p*3) + 0]) + normalIdx;
strP += buffer->getIndices()[(p*3) + 0] + normalIdx;
strP += " ";
if (has2ndTexCoords)
{
strP += (int)(buffer->getIndices()[(p*3) + 0]) + tCoord2Idx;
strP += buffer->getIndices()[(p*3) + 0] + tCoord2Idx;
strP += " ";
}
strP += (int)(buffer->getIndices()[(p*3) + 1]) + posIdx;
strP += buffer->getIndices()[(p*3) + 1] + posIdx;
strP += " ";
strP += (int)(buffer->getIndices()[(p*3) + 1]) + tCoordIdx;
strP += buffer->getIndices()[(p*3) + 1] + tCoordIdx;
strP += " ";
strP += (int)(buffer->getIndices()[(p*3) + 1]) + normalIdx;
strP += buffer->getIndices()[(p*3) + 1] + normalIdx;
strP += " ";
if (has2ndTexCoords)
{
strP += (int)(buffer->getIndices()[(p*3) + 1]) + tCoord2Idx;
strP += buffer->getIndices()[(p*3) + 1] + tCoord2Idx;
strP += " ";
}
strP += (int)(buffer->getIndices()[(p*3) + 2]) + posIdx;
strP += buffer->getIndices()[(p*3) + 2] + posIdx;
strP += " ";
strP += (int)(buffer->getIndices()[(p*3) + 2]) + tCoordIdx;
strP += buffer->getIndices()[(p*3) + 2] + tCoordIdx;
strP += " ";
strP += (int)(buffer->getIndices()[(p*3) + 2]) + normalIdx;
strP += buffer->getIndices()[(p*3) + 2] + normalIdx;
if (has2ndTexCoords)
{
strP += " ";
strP += (int)(buffer->getIndices()[(p*3) + 2]) + tCoord2Idx;
strP += buffer->getIndices()[(p*3) + 2] + tCoord2Idx;
}
Writer->writeText(strP.c_str());
......
......@@ -4,13 +4,13 @@
#include "IMeshWriter.h"
#include "S3DVertex.h"
#include "IVideoDriver.h"
#include "IFileSystem.h"
namespace irr
{
namespace io
{
class IXMLWriter;
class IFileSystem;
}
namespace scene
{
......@@ -37,27 +37,21 @@ protected:
struct SComponentGlobalStartPos
{
SComponentGlobalStartPos()
{
PosStartIndex = -1;
PosLastIndex = -1;
NormalStartIndex = -1;
NormalLastIndex = -1;
TCoord0LastIndex = -1;
TCoord0LastIndex = -1;
TCoord1LastIndex = -1;
TCoord1LastIndex = -1;
}
SComponentGlobalStartPos() : PosStartIndex(-1), PosLastIndex(-1),
NormalStartIndex(-1), NormalLastIndex(-1),
TCoord0StartIndex(-1), TCoord0LastIndex(-1),
TCoord1StartIndex(-1), TCoord1LastIndex(-1)
{ }
s32 PosStartIndex;
s32 PosLastIndex;
s32 TCoord0StartIndex;
s32 TCoord0LastIndex;
s32 NormalStartIndex;
s32 NormalLastIndex;
s32 TCoord0StartIndex;
s32 TCoord0LastIndex;
s32 TCoord1StartIndex;
s32 TCoord1LastIndex;
};
......@@ -72,3 +66,4 @@ protected:
} // end namespace
#endif
......@@ -12,7 +12,7 @@ namespace scene
CIrrMeshWriter::CIrrMeshWriter(irr::video::IVideoDriver* driver,
irr::io::IFileSystem* fs)
: VideoDriver(driver), FileSystem(fs)
: FileSystem(fs), VideoDriver(driver), Writer(0)
{
if (VideoDriver)
VideoDriver->grab();
......
......@@ -43,3 +43,4 @@ protected:
} // end namespace
#endif
......@@ -19,7 +19,7 @@ VERSION = 1.4alpha
#
#List of object files, separated based on engine architecture
IRRMESHOBJ = CSkinnedMesh.o CBSPMeshFileLoader.o CMD2MeshFileLoader.o CMD3MeshFileLoader.o CMS3DMeshFileLoader.o CB3DMeshFileLoader.o CBoneSceneNode.o CBSPMeshFileLoader.o C3DSMeshFileLoader.o COgreMeshFileLoader.o COBJMeshFileLoader.o CAnimatedMeshMD2.o CAnimatedMeshMD3.o CMD3MeshFileLoader.o CAnimatedMeshSceneNode.o CColladaFileLoader.o CCSMLoader.o CDMFLoader.o CLMTSMeshFileLoader.o CMeshSceneNode.o CMY3DMeshFileLoader.o COCTLoader.o CQ3LevelMesh.o CXMeshFileLoader.o CQuake3ShaderSceneNode.o
IRRMESHOBJ = CSkinnedMesh.o CBSPMeshFileLoader.o CMD2MeshFileLoader.o CMD3MeshFileLoader.o CMS3DMeshFileLoader.o CB3DMeshFileLoader.o CBoneSceneNode.o CBSPMeshFileLoader.o C3DSMeshFileLoader.o COgreMeshFileLoader.o COBJMeshFileLoader.o CAnimatedMeshMD2.o CAnimatedMeshMD3.o CMD3MeshFileLoader.o CAnimatedMeshSceneNode.o CColladaFileLoader.o CCSMLoader.o CDMFLoader.o CLMTSMeshFileLoader.o CMeshSceneNode.o CMY3DMeshFileLoader.o COCTLoader.o CQ3LevelMesh.o CXMeshFileLoader.o CQuake3ShaderSceneNode.o CColladaMeshWriter.o CIrrMeshWriter.o
IRROBJ = CBillboardSceneNode.o CCameraFPSSceneNode.o CCameraMayaSceneNode.o CCameraSceneNode.o CDummyTransformationSceneNode.o CEmptySceneNode.o CGeometryCreator.o CLightSceneNode.o CMeshManipulator.o CMetaTriangleSelector.o COctTreeSceneNode.o COctTreeTriangleSelector.o CSceneCollisionManager.o CSceneManager.o CShadowVolumeSceneNode.o CSkyBoxSceneNode.o CSkyDomeSceneNode.o CTerrainSceneNode.o CTerrainTriangleSelector.o CCubeSceneNode.o CSphereSceneNode.o CTextSceneNode.o CTriangleBBSelector.o CTriangleSelector.o CWaterSurfaceSceneNode.o CMeshCache.o CDefaultSceneNodeAnimatorFactory.o CDefaultSceneNodeFactory.o
IRRPARTICLEOBJ = CParticleAnimatedMeshSceneNodeEmitter.o CParticleBoxEmitter.o CParticleCylinderEmitter.o CParticleMeshEmitter.o CParticlePointEmitter.o CParticleRingEmitter.o CParticleSphereEmitter.o CParticleAttractionAffector.o CParticleFadeOutAffector.o CParticleGravityAffector.o CParticleRotationAffector.o CParticleSystemSceneNode.o
IRRANIMOBJ = CSceneNodeAnimatorCollisionResponse.o CSceneNodeAnimatorDelete.o CSceneNodeAnimatorFlyCircle.o CSceneNodeAnimatorFlyStraight.o CSceneNodeAnimatorFollowSpline.o CSceneNodeAnimatorRotation.o CSceneNodeAnimatorTexture.o
......
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