diff options
author | taw27 <taw27@bf6ca9ba-c028-0410-8290-897cf20841d1> | 2007-10-23 16:25:02 +0000 |
---|---|---|
committer | taw27 <taw27@bf6ca9ba-c028-0410-8290-897cf20841d1> | 2007-10-23 16:25:02 +0000 |
commit | ddba8388c2d3ed199d401a6b29a0c3f7a7fc9806 (patch) | |
tree | 8f01b5bd586dbd073b650e5efd51bf43ef661a9b | |
parent | 6f1015eee069822dd30578c89038dc567564a82f (diff) |
Perhaps a slightly better interpretation of "indexing lines"
Don't display unit cell if indexing lines are turned on.
git-svn-id: svn://cook.msm.cam.ac.uk:745/diff-tomo/dtr@170 bf6ca9ba-c028-0410-8290-897cf20841d1
-rw-r--r-- | src/displaywindow.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/src/displaywindow.c b/src/displaywindow.c index bcbeece..a6810d4 100644 --- a/src/displaywindow.c +++ b/src/displaywindow.c @@ -322,8 +322,8 @@ static void displaywindow_gl_prepare(DisplayWindow *dw) { int max_ind; signed int h, k, l; - max_ind = 2; - dw->gl_line_num_vertices = 3*2*((2*max_ind+1)*(2*max_ind+1)); + max_ind = 10; + dw->gl_line_num_vertices = 3*2*((2*1+1)*(2*1+1)); if ( dw->gl_use_buffers ) { glGenBuffersARB(1, &dw->gl_line_vertex_buffer); @@ -331,9 +331,11 @@ static void displaywindow_gl_prepare(DisplayWindow *dw) { reflection = ctx->reflectionlist->reflections; vertices = malloc(3*dw->gl_line_num_vertices*sizeof(GLfloat)); + i=0; + /* Lines parallel to a */ - for ( k=-max_ind; k<=max_ind; k++ ) { - for ( l=-max_ind; l<=max_ind; l++ ) { + for ( k=-1; k<=1; k++ ) { + for ( l=-1; l<=1; l++ ) { vertices[3*i + 0] = (ctx->cell->a.x*(-max_ind) + ctx->cell->b.x*k + ctx->cell->c.x*l)/1e9; vertices[3*i + 1] = (ctx->cell->a.y*(-max_ind) + ctx->cell->b.y*k + ctx->cell->c.y*l)/1e9; vertices[3*i + 2] = (ctx->cell->a.z*(-max_ind) + ctx->cell->b.z*k + ctx->cell->c.z*l)/1e9; @@ -345,8 +347,8 @@ static void displaywindow_gl_prepare(DisplayWindow *dw) { } } /* Lines parallel to b */ - for ( h=-max_ind; h<=max_ind; h++ ) { - for ( l=-max_ind; l<=max_ind; l++ ) { + for ( h=-1; h<=1; h++ ) { + for ( l=-1; l<=1; l++ ) { vertices[3*i + 0] = (ctx->cell->a.x*h + ctx->cell->b.x*(-max_ind) + ctx->cell->c.x*l)/1e9; vertices[3*i + 1] = (ctx->cell->a.y*h + ctx->cell->b.y*(-max_ind) + ctx->cell->c.y*l)/1e9; vertices[3*i + 2] = (ctx->cell->a.z*h + ctx->cell->b.z*(-max_ind) + ctx->cell->c.z*l)/1e9; @@ -358,8 +360,8 @@ static void displaywindow_gl_prepare(DisplayWindow *dw) { } } /* Lines parallel to c */ - for ( h=-max_ind; h<=max_ind; h++ ) { - for ( k=-max_ind; k<=max_ind; k++ ) { + for ( h=-1; h<=1; h++ ) { + for ( k=-1; k<=1; k++ ) { vertices[3*i + 0] = (ctx->cell->a.x*h + ctx->cell->b.x*k + ctx->cell->c.x*(-max_ind))/1e9; vertices[3*i + 1] = (ctx->cell->a.y*h + ctx->cell->b.y*k + ctx->cell->c.y*(-max_ind))/1e9; vertices[3*i + 2] = (ctx->cell->a.z*h + ctx->cell->b.z*k + ctx->cell->c.z*(-max_ind))/1e9; @@ -531,7 +533,7 @@ static void displaywindow_gl_prepare(DisplayWindow *dw) { }; /* Draw the reciprocal unit cell if one is available */ - if ( ctx->cell ) { + if ( ctx->cell && !dw->lines ) { glBegin(GL_LINE_STRIP); glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION, red); glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, black); |