aboutsummaryrefslogtreecommitdiff
path: root/src/displaywindow.c
diff options
context:
space:
mode:
authorgfb21 <gfb21@bf6ca9ba-c028-0410-8290-897cf20841d1>2007-03-06 00:11:26 +0000
committergfb21 <gfb21@bf6ca9ba-c028-0410-8290-897cf20841d1>2007-03-06 00:11:26 +0000
commit28cb0b8065ac4576ef1cb0315ef274d2791f8500 (patch)
treeeccc7065c4d52c0a3682a3098048da0801163d78 /src/displaywindow.c
parent76cd15aa8de3f6c78960314ed5e40849be8fd081 (diff)
OctTree fixed. Now to find a use for it.
git-svn-id: svn://cook.msm.cam.ac.uk:745/diff-tomo/dtr@12 bf6ca9ba-c028-0410-8290-897cf20841d1
Diffstat (limited to 'src/displaywindow.c')
-rw-r--r--src/displaywindow.c46
1 files changed, 44 insertions, 2 deletions
diff --git a/src/displaywindow.c b/src/displaywindow.c
index 8f5cd7f..1ed6493 100644
--- a/src/displaywindow.c
+++ b/src/displaywindow.c
@@ -25,6 +25,7 @@
#include "trackball.h"
#include "reflections.h"
#include "main.h"
+#include "structure.h"
enum {
DW_ORTHO,
@@ -42,6 +43,28 @@ GLfloat displaywindow_distance = 150;
GLfloat displaywindow_x_pos = 0;
GLfloat displaywindow_y_pos = 0;
+OctTree *o;
+OctTreeLinkedList *ol;
+
+void disp_oct_stack(OctTree *o) {
+ int i;
+ for (i=0;i<8;i++) {
+ if (o->child[i] != NULL) {
+ glVertex3f(o->ox/1e9,o->oy/1e9,o->oz/1e9);
+ glVertex3f(o->child[i]->ox/1e9,o->child[i]->oy/1e9,o->child[i]->oz/1e9);
+ disp_oct_stack(o->child[i]);
+ }
+ }
+}
+
+void disp_oct_list(OctTreeLinkedList *ol) {
+ OctTree *o;
+ do {
+ o=ol->o;
+ glVertex3f(o->ox/1e9, o->oy/1e9, o->oz/1e9);
+ } while((ol=ol->next)!=NULL);
+}
+
void error_report(const char *message) {
GtkWidget *window;
@@ -238,7 +261,7 @@ static gint displaywindow_gl_motion_notify(GtkWidget *widget, GdkEventMotion *ev
}
static gint displaywindow_gl_expose(GtkWidget *widget, GdkEventExpose *event, ControlContext *ctx) {
-
+
GdkGLContext *glcontext = gtk_widget_get_gl_context(widget);
GdkGLDrawable *gldrawable = gtk_widget_get_gl_drawable(widget);
GLfloat light0_position[] = { 0.0, 0.0, 100.0, 0.0 };
@@ -424,13 +447,27 @@ static gint displaywindow_gl_expose(GtkWidget *widget, GdkEventExpose *event, Co
}
/* Zero plane */
+ /*
glBegin(GL_QUADS);
glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, yellow_glass);
glVertex3f(50, 50, 0.0);
glVertex3f(50, -50, 0.0);
glVertex3f(-50, -50, 0.0);
glVertex3f(-50, 50, 0.0);
- glEnd();
+ glEnd();
+ */
+
+ //octtree bit - temporary
+ glBegin(GL_LINES);
+ glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, blue);
+
+ disp_oct_stack(o);
+ glEnd();
+ glBegin(GL_POINTS);
+ glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, red);
+ disp_oct_list(ol);
+ glEnd();
+
if ( gdk_gl_drawable_is_double_buffered(gldrawable) ) {
gdk_gl_drawable_swap_buffers(gldrawable);
@@ -501,6 +538,11 @@ void displaywindow_open(ControlContext *ctx) {
const char *filename;
char *title;
GdkGLConfig *glconfig;
+
+ o = gen_octtree(ctx->reflectionctx,15);
+ print_octtree(o);
+ int count=0;
+ ol = find_sparse_trees(o,3,1,&count);
filename = basename(ctx->filename);
title = malloc(10+strlen(filename));