dlugolecki.net.pl
Dziennik
Polecane
Software
projects
/
familia.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
5c23c0f
)
Use position calculate method in rendering individual.
author
Rafał Długołęcki
<rafal@dlugolecki.net.pl>
Fri, 23 Jan 2015 20:27:05 +0000
(21:27 +0100)
committer
Rafał Długołęcki
<rafal@dlugolecki.net.pl>
Fri, 23 Jan 2015 20:27:05 +0000
(21:27 +0100)
src/ui/drawing_area.c
patch
|
blob
|
history
diff --git
a/src/ui/drawing_area.c
b/src/ui/drawing_area.c
index ee915e941ac47f683f9139c146f3b40375d8c562..8eefe5fc8015349391173c79f18e67c201f21c85 100644
(file)
--- a/
src/ui/drawing_area.c
+++ b/
src/ui/drawing_area.c
@@
-5,6
+5,7
@@
#include "../debug.h"
#include "drawing_area.h"
#include "../debug.h"
#include "drawing_area.h"
+#include "../math/3d.h"
#include "../graphics/constants.h"
#include "../graphics/individual.h"
#include "../graphics/family.h"
#include "../graphics/constants.h"
#include "../graphics/individual.h"
#include "../graphics/family.h"
@@
-26,6
+27,8
@@
gboolean drawing_area_draw(GtkWidget *widget, cairo_t *cr, gpointer user_data)
unsigned int i;
unsigned int individuals_no;
unsigned int families_no;
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)) {
/*** OpenGL BEGIN ***/
if (!gtk_widget_begin_gl (widget)) {
@@
-38,17
+41,29
@@
gboolean drawing_area_draw(GtkWidget *widget, cairo_t *cr, gpointer user_data)
gluLookAt (camera_pos_x, camera_pos_y, camera_pos_z, 0.0, 0.0, -100.0, 0.0, 1.0, 0.0);
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++) {
for (i = 0; i < individuals_no; i++) {
+ pos = calculate_individual_position(storage->individuals[i]);
+
glPushMatrix ();
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 ();
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 ();
for (i = 0; i < families_no; i++) {
glPushMatrix ();