File include/fgc.h changed (mode: 100644) (index 1834285..f3608b6) |
... |
... |
FGCMesh fgcLoadMesh( |
314 |
314 |
FGCIndex *indices, |
FGCIndex *indices, |
315 |
315 |
bool streaming ); |
bool streaming ); |
316 |
316 |
|
|
|
317 |
|
void fgcNormalizeVertices( size_t nvertices, FGCVertex *vertices ); |
|
318 |
|
|
317 |
319 |
FGCMesh fgcLoadOBJ( const char* filePath ); |
FGCMesh fgcLoadOBJ( const char* filePath ); |
318 |
320 |
|
|
319 |
321 |
void fgcFreeMesh( FGCMesh *mesh ); |
void fgcFreeMesh( FGCMesh *mesh ); |
|
... |
... |
FGCMesh fgcLoadMesh( |
968 |
970 |
return mesh; |
return mesh; |
969 |
971 |
} |
} |
970 |
972 |
|
|
|
973 |
|
void fgcNormalizeVertices( size_t nvertices, FGCVertex *vertices ){ |
|
974 |
|
for( size_t i = 0; i < nvertices; i++ ){ |
|
975 |
|
GLfloat *n = vertices[i].normal; |
|
976 |
|
GLfloat l = sqrt( n[0] * n[0] + n[1] * n[1] + n[2] * n[2] ); |
|
977 |
|
if( l != 0.0f && l != 1.0f ){ |
|
978 |
|
vertices[i].normal[0] /= l; |
|
979 |
|
vertices[i].normal[1] /= l; |
|
980 |
|
vertices[i].normal[2] /= l; |
|
981 |
|
} |
|
982 |
|
} |
|
983 |
|
} |
|
984 |
|
|
971 |
985 |
FGCMesh fgcLoadOBJ( const char* filePath ){ |
FGCMesh fgcLoadOBJ( const char* filePath ){ |
972 |
986 |
if( fgcVerbose ) printf( "OBJ MESH\n" ); |
if( fgcVerbose ) printf( "OBJ MESH\n" ); |
973 |
987 |
|
|
|
... |
... |
FGCMesh fgcLoadOBJ( const char* filePath ){ |
1085 |
1099 |
Index i[3] = { a, b, c }; |
Index i[3] = { a, b, c }; |
1086 |
1100 |
inds.insert( std::end( inds ), std::begin( i ), std::end( i ) ); |
inds.insert( std::end( inds ), std::begin( i ), std::end( i ) ); |
1087 |
1101 |
} |
} |
1088 |
|
|
|
1089 |
|
normalizeVertices( verts ); |
|
1090 |
1102 |
*/ |
*/ |
1091 |
|
|
|
1092 |
1103 |
// TODO: Use actual counts. |
// TODO: Use actual counts. |
|
1104 |
|
fgcNormalizeVertices( (size_t)1, verts ); |
|
1105 |
|
|
1093 |
1106 |
if( fgcVerbose ){ |
if( fgcVerbose ){ |
1094 |
1107 |
printf( "Vertices: %lu\n", (size_t)1 ); |
printf( "Vertices: %lu\n", (size_t)1 ); |
1095 |
1108 |
printf( "Indices: %lu\n", (size_t)1 ); |
printf( "Indices: %lu\n", (size_t)1 ); |