From b0f2b6c899aa3afd148fc3956c3c90a3b5847b94 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Fri, 8 Jan 2010 16:42:06 +0100 Subject: Scale everything for protein crystallography --- src/displaywindow.c | 8 +++--- src/glbits.c | 76 ++++++++++++++++++++++++++--------------------------- 2 files changed, 42 insertions(+), 42 deletions(-) diff --git a/src/displaywindow.c b/src/displaywindow.c index b3643ac..37b0052 100644 --- a/src/displaywindow.c +++ b/src/displaywindow.c @@ -82,9 +82,9 @@ static gint displaywindow_gl_motion_notify(GtkWidget *widget, if ( event->state & GDK_CONTROL_MASK ) { /* Control-click changes 'zoom' */ - dw->distance += event->y - dw->y_start; - if ( dw->distance < 1.0 ) dw->distance = 1.0; - if ( dw->distance > 310.0 ) dw->distance = 310.0; + dw->distance += (event->y - dw->y_start)/10.0; + if ( dw->distance < 0.1 ) dw->distance = 0.1; + if ( dw->distance > 31.0 ) dw->distance = 31.0; if ( dw->view == DW_ORTHO ) { glbits_set_ortho(dw, w, h); } else { @@ -720,7 +720,7 @@ DisplayWindow *displaywindow_open(ControlContext *ctx) dw->gl_use_shaders = 1; dw->view = DW_ORTHO; dw->mode = DW_MAPPED; - dw->distance = 150; + dw->distance = 15.0; dw->x_pos = 0; dw->y_pos = 0; dw->view_quat[0] = 0.0; diff --git a/src/glbits.c b/src/glbits.c index 86b710e..480c042 100644 --- a/src/glbits.c +++ b/src/glbits.c @@ -365,50 +365,50 @@ void glbits_prepare(DisplayWindow *dw) { gluSphere(quad, 10, 32, 32); #endif - /* Bounding cube: 100 nm^-1 side length */ + /* Bounding cube: 1 nm^-1 side length */ if ( dw->cube ) { glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, black); glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION, blue); glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, black); glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, 0.0); glBegin(GL_LINE_LOOP); - glNormal3f(50.0, 50.0, 50.0); - glVertex3f(50.0, 50.0, 50.0); - glNormal3f(-50.0, 50.0, 50.0); - glVertex3f(-50.0, 50.0, 50.0); - glNormal3f(-50.0, -50.0, 50.0); - glVertex3f(-50.0, -50.0, 50.0); - glNormal3f(50.0, -50.0, 50.0); - glVertex3f(50.0, -50.0, 50.0); + glNormal3f(0.5, 0.5, 0.5); + glVertex3f(0.5, 0.5, 0.5); + glNormal3f(-0.5, 0.5, 0.5); + glVertex3f(-0.5, 0.5, 0.5); + glNormal3f(-0.5, -0.5, 0.5); + glVertex3f(-0.5, -0.5, 0.5); + glNormal3f(0.5, -0.5, 0.5); + glVertex3f(0.5, -0.5, 0.5); glEnd(); glBegin(GL_LINE_LOOP); - glNormal3f(50.0, 50.0, -50.0); - glVertex3f(50.0, 50.0, -50.0); - glNormal3f(-50.0, 50.0, -50.0); - glVertex3f(-50.0, 50.0, -50.0); - glNormal3f(-50.0, -50.0, -50.0); - glVertex3f(-50.0, -50.0, -50.0); - glNormal3f(50.0, -50.0, -50.0); - glVertex3f(50.0, -50.0, -50.0); + glNormal3f(0.5, 0.5, -0.5); + glVertex3f(0.5, 0.5, -0.5); + glNormal3f(-0.5, 0.5, -0.5); + glVertex3f(-0.5, 0.5, -0.5); + glNormal3f(-0.5, -0.5, -0.5); + glVertex3f(-0.5, -0.5, -0.5); + glNormal3f(0.5, -0.5, -0.5); + glVertex3f(0.5, -0.5, -0.5); glEnd(); glBegin(GL_LINES); - glNormal3f(50.0, 50.0, 50.0); - glVertex3f(50.0, 50.0, 50.0); - glNormal3f(50.0, 50.0, -50.0); - glVertex3f(50.0, 50.0, -50.0); - glNormal3f(-50.0, 50.0, 50.0); - glVertex3f(-50.0, 50.0, 50.0); - glNormal3f(-50.0, 50.0, -50.0); - glVertex3f(-50.0, 50.0, -50.0); - glNormal3f(-50.0, -50.0, 50.0); - glVertex3f(-50.0, -50.0, 50.0); - glNormal3f(-50.0, -50.0, -50.0); - glVertex3f(-50.0, -50.0, -50.0); - glNormal3f(50.0, -50.0, 50.0); - glVertex3f(50.0, -50.0, 50.0); - glNormal3f(50.0, -50.0, -50.0); - glVertex3f(50.0, -50.0, -50.0); + glNormal3f(0.5, 0.5, 0.5); + glVertex3f(0.5, 0.5, 0.5); + glNormal3f(0.5, 0.5, -0.5); + glVertex3f(0.5, 0.5, -0.5); + glNormal3f(-0.5, 0.5, 0.5); + glVertex3f(-0.5, 0.5, 0.5); + glNormal3f(-0.5, 0.5, -0.5); + glVertex3f(-0.5, 0.5, -0.5); + glNormal3f(-0.5, -0.5, 0.5); + glVertex3f(-0.5, -0.5, 0.5); + glNormal3f(-0.5, -0.5, -0.5); + glVertex3f(-0.5, -0.5, -0.5); + glNormal3f(0.5, -0.5, 0.5); + glVertex3f(0.5, -0.5, 0.5); + glNormal3f(0.5, -0.5, -0.5); + glVertex3f(0.5, -0.5, -0.5); glEnd(); } @@ -419,7 +419,7 @@ void glbits_prepare(DisplayWindow *dw) { glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION, red); glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, 0.0); glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, black); - glScalef(10.0, 1.0, 1.0); + glScalef(0.1, 0.01, 0.01); DRAW_POINTER_LINE glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, black); glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION, black); @@ -430,7 +430,7 @@ void glbits_prepare(DisplayWindow *dw) { glPushMatrix(); glRotatef(90.0, 0.0, 0.0, 1.0); - glScalef(10.0, 1.0, 1.0); + glScalef(0.1, 0.01, 0.01); glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, black); glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION, green); glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, 0.0); @@ -445,7 +445,7 @@ void glbits_prepare(DisplayWindow *dw) { glPushMatrix(); glRotatef(-90.0, 0.0, 1.0, 0.0); - glScalef(10.0, 1.0, 1.0); + glScalef(0.1, 0.01, 0.01); glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, black); glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION, bblue); glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, 0.0); @@ -732,10 +732,10 @@ gint glbits_expose(GtkWidget *widget, GdkEventExpose *event, DisplayWindow *dw) /* Draw the "measured" reflections */ if ( dw->gl_ref_num_vertices ) { - GLfloat att[] = {1.0, 1.0, 0.0}; + GLfloat att[] = {0.1, 0.1, 0.0}; glPointParameterfv(GL_POINT_DISTANCE_ATTENUATION, att); - glPointSize(20.0); + glPointSize(2.0); glEnable(GL_POINT_SMOOTH); glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION, black); -- cgit v1.2.3