home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / general / modelers / geomview / source.lha / Geomview / src / lib / pointlist / ptlVect.c < prev   
Encoding:
C/C++ Source or Header  |  1993-01-12  |  1.6 KB  |  67 lines

  1. #include "ooglutil.h"
  2. #include "geom.h"
  3. #include "vectP.h"
  4. #include "pointlistP.h"
  5.  
  6. void *vect_PointList_get(int sel, Geom *geom, va_list args);
  7. void *vect_PointList_fillin(int sel, Geom *geom, va_list args);
  8. void *vect_PointList_set(int sel, Geom *geom, va_list args);
  9. void *vect_PointList_length(int sel, Geom *geom, va_list args);
  10.  
  11. #define MAX_METHODS 4
  12.  
  13. static SpecFunc methods[] = {
  14.   "PointList_get", vect_PointList_get,
  15.   "PointList_fillin", vect_PointList_fillin,
  16.   "PointList_set", vect_PointList_set,
  17.   "PointList_length", vect_PointList_length
  18. };
  19.  
  20. static char msg[] = "ptlVect.c";
  21.  
  22. ptlVect_init() {
  23.   pointlist_initspec(methods, MAX_METHODS, GeomClassLookup("vect"));
  24. }
  25.  
  26. void *vect_PointList_get(int sel, Geom *geom, va_list args) {
  27.   Vect *v = (Vect *)geom;
  28.   HPoint3 *plist;
  29.   float **t;
  30.  
  31.   plist = OOGLNewNE(HPoint3, v->nvert, msg);
  32.   t = va_arg(args, float **);
  33.   return GeomCall(GeomMethodSel("PointList_fillin"), geom, t, 0, plist);
  34. }
  35.  
  36. void *vect_PointList_fillin(int sel, Geom *geom, va_list args) {
  37.   Vect *v = (Vect *)geom;
  38.   float **t;
  39.   HPoint3 *plist;
  40.  
  41.   t = va_arg(args, float **);
  42.   va_arg(args, int);
  43.   plist = va_arg(args, HPoint3 *);
  44.   bcopy(v->p, plist, v->nvert * sizeof(HPoint3));
  45.   HPt3TransformN(t, plist, plist, v->nvert);
  46.   return((void *)plist);
  47. }
  48.  
  49. void *vect_PointList_set(int sel, Geom *geom, va_list args) {
  50.   Vect *v = (Vect *)geom;
  51.   HPoint3 *plist;
  52.   
  53.   va_arg(args, int);
  54.   plist = va_arg(args, HPoint3 *);
  55.   bcopy(plist, v->p, v->nvert * sizeof(HPoint3));
  56.   return((void *)v);
  57. }
  58.  
  59.  
  60. void *vect_PointList_length(int sel, Geom *geom, va_list args) {
  61.   Vect *v = (Vect *)geom;
  62.   
  63.   return((void *)v->nvert);
  64. }
  65.  
  66.  
  67.