Fix error handling in get_normalized_scale_factor()

This commit is contained in:
hasufell 2014-05-10 22:58:51 +02:00
parent 1fa87f9fbf
commit 4c8bb37e56
No known key found for this signature in database
GPG Key ID: 220CD1C5BDEED020

View File

@ -85,17 +85,22 @@ HE_vert *find_center(HE_obj const * const obj)
* to the size of 1. * to the size of 1.
* *
* @param obj the object we want to scale * @param obj the object we want to scale
* @return the corresponding scale factor * @return the corresponding scale factor, -1 on error
*/ */
float get_normalized_scale_factor(HE_obj const * const obj) float get_normalized_scale_factor(HE_obj const * const obj)
{ {
float max = obj->vertices[0].x + float max;
obj->vertices[0].y + obj->vertices[0].z; float min;
float min = obj->vertices[0].x +
obj->vertices[0].y + obj->vertices[0].z;
uint32_t i; uint32_t i;
if (!obj)
return -1;
max = obj->vertices[0].x +
obj->vertices[0].y + obj->vertices[0].z;
min = obj->vertices[0].x +
obj->vertices[0].y + obj->vertices[0].z;
for (i = 0; i < obj->vc; i++) { for (i = 0; i < obj->vc; i++) {
if ((obj->vertices[i].x + if ((obj->vertices[i].x +
obj->vertices[i].y + obj->vertices[i].y +