This commit is contained in:
Glenn Maynard
2005-09-08 02:49:44 +00:00
parent 661c160ee0
commit 1c0ed2e85c
+20 -22
View File
@@ -19,8 +19,8 @@ RageModelGeometry::~RageModelGeometry ()
void RageModelGeometry::OptimizeBones()
{
for (unsigned i = 0; i < m_Meshes.size(); i++)
{
for (unsigned i = 0; i < m_Meshes.size(); i++)
{
msMesh& mesh = m_Meshes[i];
if( mesh.Vertices.empty() )
@@ -81,7 +81,7 @@ void RageModelGeometry::LoadMilkshapeAscii( const CString& _sPath, bool bNeedsNo
CString sLine;
int iLineNum = 0;
char szName[MS_MAX_NAME];
int nFlags, nIndex, i, j;
int nFlags, nIndex;
RageVec3ClearBounds( m_vMins, m_vMaxs );
@@ -89,28 +89,28 @@ void RageModelGeometry::LoadMilkshapeAscii( const CString& _sPath, bool bNeedsNo
{
iLineNum++;
if (!strncmp (sLine, "//", 2))
if( !strncmp(sLine, "//", 2) )
continue;
int nFrame;
if (sscanf (sLine, "Frames: %d", &nFrame) == 1)
if( sscanf(sLine, "Frames: %d", &nFrame) == 1 )
{
// ignore
// m_pRageModelGeometry->nTotalFrames = nFrame;
}
if (sscanf (sLine, "Frame: %d", &nFrame) == 1)
if( sscanf(sLine, "Frame: %d", &nFrame) == 1 )
{
// ignore
// m_pRageModelGeometry->nFrame = nFrame;
}
int nNumMeshes = 0;
if (sscanf (sLine, "Meshes: %d", &nNumMeshes) == 1)
if( sscanf(sLine, "Meshes: %d", &nNumMeshes) == 1 )
{
ASSERT( m_Meshes.empty() );
m_Meshes.resize( nNumMeshes );
for (i = 0; i < nNumMeshes; i++)
for( int i = 0; i < nNumMeshes; i++ )
{
msMesh &mesh = m_Meshes[i];
vector<RageModelVertex> &Vertices = mesh.Vertices;
@@ -120,7 +120,7 @@ void RageModelGeometry::LoadMilkshapeAscii( const CString& _sPath, bool bNeedsNo
THROW;
// mesh: name, flags, material index
if (sscanf (sLine, "\"%[^\"]\" %d %d",szName, &nFlags, &nIndex) != 3)
if( sscanf (sLine, "\"%[^\"]\" %d %d",szName, &nFlags, &nIndex) != 3 )
THROW;
strcpy( mesh.szName, szName );
@@ -136,24 +136,24 @@ void RageModelGeometry::LoadMilkshapeAscii( const CString& _sPath, bool bNeedsNo
THROW;
int nNumVertices = 0;
if (sscanf (sLine, "%d", &nNumVertices) != 1)
if( sscanf (sLine, "%d", &nNumVertices) != 1 )
THROW;
Vertices.resize( nNumVertices );
for (j = 0; j < nNumVertices; j++)
for( int j = 0; j < nNumVertices; j++ )
{
RageModelVertex &v = Vertices[j];
if( f.GetLine( sLine ) <= 0 )
THROW;
if (sscanf (sLine, "%d %f %f %f %f %f %d",
if( sscanf(sLine, "%d %f %f %f %f %f %d",
&nFlags,
&v.p[0], &v.p[1], &v.p[2],
&v.t[0], &v.t[1],
&nIndex
) != 7)
) != 7 )
{
THROW;
}
@@ -175,26 +175,24 @@ void RageModelGeometry::LoadMilkshapeAscii( const CString& _sPath, bool bNeedsNo
THROW;
int nNumNormals = 0;
if (sscanf (sLine, "%d", &nNumNormals) != 1)
if( sscanf(sLine, "%d", &nNumNormals) != 1 )
THROW;
vector<RageVector3> Normals;
Normals.resize( nNumNormals );
for (j = 0; j < nNumNormals; j++)
for( int j = 0; j < nNumNormals; j++ )
{
if( f.GetLine( sLine ) <= 0 )
THROW;
RageVector3 Normal;
if (sscanf (sLine, "%f %f %f", &Normal[0], &Normal[1], &Normal[2]) != 3)
if( sscanf(sLine, "%f %f %f", &Normal[0], &Normal[1], &Normal[2]) != 3 )
THROW;
RageVec3Normalize( (RageVector3*)&Normal, (RageVector3*)&Normal );
Normals[j] = Normal;
}
//
// triangles
//
@@ -202,24 +200,24 @@ void RageModelGeometry::LoadMilkshapeAscii( const CString& _sPath, bool bNeedsNo
THROW;
int nNumTriangles = 0;
if (sscanf (sLine, "%d", &nNumTriangles) != 1)
if( sscanf (sLine, "%d", &nNumTriangles) != 1 )
THROW;
Triangles.resize( nNumTriangles );
for (j = 0; j < nNumTriangles; j++)
for( int j = 0; j < nNumTriangles; j++ )
{
if( f.GetLine( sLine ) <= 0 )
THROW;
uint16_t nIndices[3];
uint16_t nNormalIndices[3];
if (sscanf (sLine, "%d %hd %hd %hd %hd %hd %hd %d",
if( sscanf (sLine, "%d %hd %hd %hd %hd %hd %hd %d",
&nFlags,
&nIndices[0], &nIndices[1], &nIndices[2],
&nNormalIndices[0], &nNormalIndices[1], &nNormalIndices[2],
&nIndex
) != 8)
) != 8 )
{
THROW;
}