Changeset 5272


Ignore:
Timestamp:
May 2, 2008, 2:41:50 PM (16 years ago)
Author:
jack
Message:

Added vector module.

Location:
anuga_work/development/anugavis
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • anuga_work/development/anugavis/configure.ac

    r5269 r5272  
    1515AX_CHECK_GLU
    1616AM_PATH_SDL([1.2.12], [], [AC_MSG_ERROR([SDL is required to build.])])
    17 AC_SUBST([SDL_LIBPATH])
    1817AC_SEARCH_LIBS([nc_open], [netcdf], [],
    1918               [AC_MSG_ERROR([Can't link the NetCDF library. (LDFLAGS?)])])
  • anuga_work/development/anugavis/src/Makefile.am

    r5267 r5272  
    1515                        netcdf_util.c \
    1616                        netcdf_util.h \
     17                        vector.c \
     18                        vector.h \
    1719                        xfunctions.c \
    1820                        xfunctions.h
     
    2325anugavis_simple_SOURCES = anugavis_simple.c
    2426anugavis_simple_CFLAGS = @SDL_CFLAGS@ @GLU_CFLAGS@
    25 anugavis_simple_LDADD = libanugavis.a @SDL_LIBS@ @GLU_LIBS@
     27anugavis_simple_LDADD = libanugavis.a -lm @SDL_LIBS@ @GLU_LIBS@
  • anuga_work/development/anugavis/src/height_quantity.c

    r5271 r5272  
    2020#include "height_quantity.h"
    2121#include "netcdf_util.h"
     22#include "vector.h"
    2223#include "xfunctions.h"
    2324
     
    2728  unsigned int vertex;
    2829  int vertIndex;
    29   int x[3];
    30   int y[3];
    31   int z[3];
     30  vector vs[3];
     31  vector v1;
     32  vector v2;
     33  vector normal;
    3234  float *heights = xmalloc(sizeof(float)
    3335                           * anugavis.number_of_points
     
    4749      for(vertex = 0 ; vertex < 3 ; vertex++){ /* Calculate normal */
    4850        vertIndex = anugavis.volumes[vol*anugavis.number_of_vertices + vertex];
    49         x[vertex] = anugavis.x[vertIndex];
    50         y[vertex] = anugavis.y[vertIndex];
    51         z[vertex] = heights[frame * anugavis.number_of_timesteps + vertIndex];
     51        vs[vertex][0] = anugavis.x[vertIndex];
     52        vs[vertex][1] = anugavis.y[vertIndex];
     53        vs[vertex][2] = heights[frame*anugavis.number_of_timesteps + vertIndex];
    5254      }
    53       glNormal3f((y[1] - y[0]) * (z[2] - z[0]) - (z[1] - z[0]) * (y[2] - y[0]),
    54                  (z[1] - z[0]) * (x[2] - x[0]) - (x[1] - x[0]) * (z[2] - z[0]),
    55                  (x[1] - x[0]) * (y[2] - y[0]) - (y[1] - y[0]) * (x[2] - x[0]));
     55      vsub(vs[1], vs[0], v1);
     56      vsub(vs[2], vs[0], v2);
     57      vcross(v1, v2, normal);
     58      /* FIXME: Need to ensure that normal is pointing upward. */
     59      glNormal3fv(normal);
    5660      for(vertex = 0 ; vertex < anugavis.number_of_vertices ; vertex++){
    5761        vertIndex = anugavis.volumes[vol*anugavis.number_of_vertices + vertex];
Note: See TracChangeset for help on using the changeset viewer.