#include "../debug.h"
#include "drawing_area.h"
+#include "../math/3d.h"
#include "../graphics/constants.h"
#include "../graphics/individual.h"
#include "../graphics/family.h"
unsigned int i;
unsigned int individuals_no;
unsigned int families_no;
+ struct familia_storage * storage;
+ struct position * pos;
/*** OpenGL BEGIN ***/
if (!gtk_widget_begin_gl (widget)) {
gluLookAt (camera_pos_x, camera_pos_y, camera_pos_z, 0.0, 0.0, -100.0, 0.0, 1.0, 0.0);
- individuals_no = familia_storage_get_current()->individuals_no;
+ storage = familia_storage_get_current();
+ individuals_no = storage->individuals_no;
for (i = 0; i < individuals_no; i++) {
+ pos = calculate_individual_position(storage->individuals[i]);
+
glPushMatrix ();
- glTranslatef(i * (GR_IND_RADIUS + 1), 0, -10);
+ glTranslatef(
+ (pos != NULL) ? pos->x : 0,
+ (pos != NULL) ? pos->y : 0,
+ (pos != NULL) ? pos->z : -10
+ );
glColor3f (1.0, 1.0, 1.0);
graphics_render_individual();
glPopMatrix ();
+
+ if (pos != NULL) {
+ free(pos);
+ pos = NULL;
+ }
}
- families_no = familia_storage_get_current()->families_no;
+ families_no = storage->families_no;
for (i = 0; i < families_no; i++) {
glPushMatrix ();