engine/EngineModel.c
/*	Calculate the normals for MD2 models.
*/
Calculate the normals for MD2 models.
Calculate the normals for MD2 models .
void Model_CalculateMD2Normals(model_t *model, MD2_t *md2)
{
#if 0
	MD2Frame_t *frame;
	MD2Triangle_t *triangles;
	MD2TriangleVertex_t *vertices;
	int i; 
	frame = (MD2Frame_t*)((uint8_t*)md2 + md2->ofs_frames + md2->framesize);
	vertices = &frame->verts[0];
	triangles = (MD2Triangle_t*)((uint8_t*)md2 + md2->ofs_tris);
	for (i = 0; i < md2->numtris; i++, triangles++)
	{
		MathVector_t normalVector = Model_GenerateNormal3f(
			vertices[triangles[i].index_xyz[0]].v[0] * frame->scale[0] + frame->translate[0],
			vertices[triangles[i].index_xyz[0]].v[1] * frame->scale[1] + frame->translate[1],
			vertices[triangles[i].index_xyz[0]].v[2] * frame->scale[2] + frame->translate[2],
			vertices[triangles[i].index_xyz[1]].v[0] * frame->scale[0] + frame->translate[0],
			vertices[triangles[i].index_xyz[1]].v[1] * frame->scale[1] + frame->translate[1],
			vertices[triangles[i].index_xyz[1]].v[2] * frame->scale[2] + frame->translate[2],
			vertices[triangles[i].index_xyz[2]].v[0] * frame->scale[0] + frame->translate[0],
			vertices[triangles[i].index_xyz[2]].v[1] * frame->scale[1] + frame->translate[1],
			vertices[triangles[i].index_xyz[2]].v[2] * frame->scale[2] + frame->translate[2]);
		MathVector3f_t normal;
		Math_MVToVector(normalVector, normal);
		Math_VectorCopy(normal, model->object.ovVertices[v].mvNormal);
	}
#endif
}
void Model_CalculateMD2Normals ( model_t * model , MD2_t * md2 ) { #if 0 MD2Frame_t * frame ; MD2Triangle_t * triangles ; MD2TriangleVertex_t * vertices ; int i ; frame = ( MD2Frame_t * ) ( ( uint8_t * ) md2 + md2 -> ofs_frames + md2 -> framesize ) ; vertices = & frame -> verts [ 0 ] ; triangles = ( MD2Triangle_t * ) ( ( uint8_t * ) md2 + md2 -> ofs_tris ) ; for ( i = 0 ; i < md2 -> numtris ; i ++ , triangles ++ ) { MathVector_t normalVector = Model_GenerateNormal3f ( vertices [ triangles [ i ] . index_xyz [ 0 ] ] . v [ 0 ] * frame -> scale [ 0 ] + frame -> translate [ 0 ] , vertices [ triangles [ i ] . index_xyz [ 0 ] ] . v [ 1 ] * frame -> scale [ 1 ] + frame -> translate [ 1 ] , vertices [ triangles [ i ] . index_xyz [ 0 ] ] . v [ 2 ] * frame -> scale [ 2 ] + frame -> translate [ 2 ] , vertices [ triangles [ i ] . index_xyz [ 1 ] ] . v [ 0 ] * frame -> scale [ 0 ] + frame -> translate [ 0 ] , vertices [ triangles [ i ] . index_xyz [ 1 ] ] . v [ 1 ] * frame -> scale [ 1 ] + frame -> translate [ 1 ] , vertices [ triangles [ i ] . index_xyz [ 1 ] ] . v [ 2 ] * frame -> scale [ 2 ] + frame -> translate [ 2 ] , vertices [ triangles [ i ] . index_xyz [ 2 ] ] . v [ 0 ] * frame -> scale [ 0 ] + frame -> translate [ 0 ] , vertices [ triangles [ i ] . index_xyz [ 2 ] ] . v [ 1 ] * frame -> scale [ 1 ] + frame -> translate [ 1 ] , vertices [ triangles [ i ] . index_xyz [ 2 ] ] . v [ 2 ] * frame -> scale [ 2 ] + frame -> translate [ 2 ] ) ; MathVector3f_t normal ; Math_MVToVector ( normalVector , normal ) ; Math_VectorCopy ( normal , model -> object . ovVertices [ v ] . mvNormal ) ; } #endif }
Calculate the normals for MD2 models.
Calculate the normals for MD2 models .
//, j, v; // X Y Z