summaryrefslogtreecommitdiffhomepage
path: root/Magic2/l3ds.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Magic2/l3ds.cpp')
-rw-r--r--Magic2/l3ds.cpp60
1 files changed, 30 insertions, 30 deletions
diff --git a/Magic2/l3ds.cpp b/Magic2/l3ds.cpp
index 3cbdcfa..3f9ed47 100644
--- a/Magic2/l3ds.cpp
+++ b/Magic2/l3ds.cpp
@@ -15,12 +15,12 @@
//-------------------------------------------------------
// generic stuff
//-------------------------------------------------------
-
+
typedef unsigned long ulong;
#define SEEK_START 1900
#define SEEK_CURSOR 1901
-
+
// common chunks
// colors
#define COLOR_F 0x0010
@@ -40,7 +40,7 @@ typedef unsigned long ulong;
// keyframer chunk ids
#define KFDATA 0xB000 // the keyframer section
#define KFHDR 0xB00A
-#define OBJECT_NODE_TAG 0xB002
+#define OBJECT_NODE_TAG 0xB002
#define NODE_HDR 0xB010
#define PIVOT 0xB013
#define POS_TRACK_TAG 0xB020
@@ -446,7 +446,7 @@ void LMesh::SetTriangleArraySize(uint value)
const LVector4& LMesh::GetVertex(uint index)
{
- return m_vertices[index];
+ return m_vertices[index];
}
const LVector3& LMesh::GetNormal(uint index)
@@ -494,7 +494,7 @@ void LMesh::SetTangent(const LVector3 &vec, uint index)
{
if (index >= m_vertices.size())
return;
- m_tangents[index] = vec;
+ m_tangents[index] = vec;
}
void LMesh::SetBinormal(const LVector3 &vec, uint index)
@@ -520,11 +520,11 @@ LTriangle2 LMesh::GetTriangle2(uint index)
f.vertexNormals[0] = GetNormal(t.a);
f.vertexNormals[1] = GetNormal(t.b);
f.vertexNormals[2] = GetNormal(t.c);
-
+
f.textureCoords[0] = GetUV(t.a);
f.textureCoords[1] = GetUV(t.b);
f.textureCoords[2] = GetUV(t.c);
-
+
LVector3 a, b;
a = SubtractVectors(_4to3(f.vertices[1]), _4to3(f.vertices[0]));
@@ -535,7 +535,7 @@ LTriangle2 LMesh::GetTriangle2(uint index)
f.faceNormal = NormalizeVector(f.faceNormal);
f.materialId = m_tris[index].materialId;
-
+
return f;
}
@@ -581,10 +581,10 @@ void LMesh::CalcNormals(bool useSmoothingGroups)
k = m_tris[i].c;
array[k].push_back(i);
- }
+ }
LVector3 temp;
-
+
if (!useSmoothingGroups)
{
// now calculate the normals without using smoothing groups
@@ -608,7 +608,7 @@ void LMesh::CalcNormals(bool useSmoothingGroups)
// I'm assuming a triangle can only belong to one smoothing group at a time!
std::vector<ulong> smGroups;
std::vector< std::vector <uint> > smList;
-
+
uint loop_size = m_vertices.size();
for (i=0; i<loop_size; i++)
@@ -655,7 +655,7 @@ void LMesh::CalcNormals(bool useSmoothingGroups)
m_uv.push_back(m_uv[i]);
m_tangents.push_back(m_tangents[i]);
m_binormals.push_back(m_binormals[i]);
-
+
uint t = m_vertices.size()-1;
for (uint h=0; h<smList[j].size(); h++)
{
@@ -668,7 +668,7 @@ void LMesh::CalcNormals(bool useSmoothingGroups)
}
}
}
-
+
// now rebuild a face list for each vertex, since the old one is invalidated
for (i=0; i<array.size(); i++)
array[i].clear();
@@ -684,7 +684,7 @@ void LMesh::CalcNormals(bool useSmoothingGroups)
k = m_tris[i].c;
array[k].push_back(i);
- }
+ }
// now compute the normals
for (i=0; i<m_vertices.size(); i++)
@@ -702,7 +702,7 @@ void LMesh::CalcNormals(bool useSmoothingGroups)
}
}
-
+
// copy m_tris to m_triangles
for (i=0; i<m_triangles.size(); i++)
{
@@ -710,7 +710,7 @@ void LMesh::CalcNormals(bool useSmoothingGroups)
m_triangles[i].b = m_tris[i].b;
m_triangles[i].c = m_tris[i].c;
}
-
+
}
void LMesh::CalcTextureSpace()
@@ -727,7 +727,7 @@ void LMesh::CalcTextureSpace()
v1.x = m_vertices[m_tris[i].b].x - m_vertices[m_tris[i].a].x;
v1.y = m_uv[m_tris[i].b].x - m_uv[m_tris[i].a].x;
v1.z = m_uv[m_tris[i].b].y - m_uv[m_tris[i].a].y;
-
+
v2.x = m_vertices[m_tris[i].c].x - m_vertices[m_tris[i].a].x;
v2.y = m_uv[m_tris[i].c].x - m_uv[m_tris[i].a].x;
v2.z = m_uv[m_tris[i].c].y - m_uv[m_tris[i].a].y;
@@ -777,7 +777,7 @@ void LMesh::CalcTextureSpace()
k = m_tris[i].c;
array[k].push_back(i);
- }
+ }
// now average the tangents and compute the binormals as (tangent X normal)
for (int i=0; i<(int)m_vertices.size(); i++)
@@ -798,7 +798,7 @@ void LMesh::CalcTextureSpace()
}
m_tangents[i] = NormalizeVector(v1);
//m_binormals[i] = NormalizeVector(v2);
-
+
m_binormals[i] = NormalizeVector(CrossProduct(m_tangents[i], m_normals[i]));
}
}
@@ -926,7 +926,7 @@ void LLight::SetFalloff(float value)
{
m_falloff = value;
}
-
+
float LLight::GetFalloff()
{
return m_falloff;
@@ -939,7 +939,7 @@ float LLight::GetFalloff()
LImporter::LImporter()
{
Clear();
-}
+}
LImporter::~LImporter()
{
@@ -1010,7 +1010,7 @@ void LImporter::Clear()
void LImporter::SetOptimizationLevel(LOptimizationLevel value)
{
- m_optLevel = value;
+ m_optLevel = value;
}
LOptimizationLevel LImporter::GetOptimizationLevel()
@@ -1029,7 +1029,7 @@ L3DS::L3DS()
m_bufferSize = 0;
m_pos = 0;
m_eof = false;
-}
+}
L3DS::L3DS(const char *filename)
: LImporter()
@@ -1094,7 +1094,7 @@ short L3DS::ReadShort()
m_eof = true;
return 0;
}
-
+
int L3DS::ReadInt()
{
if ((m_buffer!=0) && (m_bufferSize != 0) && ((m_pos+4)<m_bufferSize))
@@ -1308,7 +1308,7 @@ bool L3DS::Read3DS()
SkipChunk(obj);
}
}
-
+
// read the keyframer data here to find out correct object orientation
LChunk keyframer;
@@ -1318,7 +1318,7 @@ bool L3DS::Read3DS()
objtrack.id = OBJECT_NODE_TAG;
GotoChunk(mainchunk);
- if (FindChunk(keyframer, mainchunk))
+ if (FindChunk(keyframer, mainchunk))
{ // keyframer chunk is present
GotoChunk(keyframer);
while (FindChunk(objtrack, keyframer))
@@ -1452,8 +1452,8 @@ void L3DS::ReadMesh(const LChunk &parent)
void L3DS::ReadFaceList(const LChunk &chunk, LMesh &mesh)
{
- // variables
- unsigned short count, t;
+ // variables
+ unsigned short count, t;
uint i;
LTri tri;
LChunk ch;
@@ -1601,7 +1601,7 @@ void L3DS::ReadMaterial(const LChunk &parent)
strcpy(mat.GetReflectionMap().mapName, "auto");
break;
}
-
+
SkipChunk(chunk);
chunk = ReadChunk();
}
@@ -1656,7 +1656,7 @@ void L3DS::ReadKeyframeData(const LChunk &parent)
char str[20];
LMesh *mesh;
-
+
GotoChunk(parent);
if (!FindChunk(node_hdr, parent))
return;