home *** CD-ROM | disk | FTP | other *** search
/ gondwana.ecr.mu.oz.au/pub/ / Graphics.tar / Graphics / fermiVogle.tar.Z / fermiVogle.tar / devel / examples / xview / lcube.c < prev    next >
Encoding:
C/C++ Source or Header  |  1996-03-12  |  1.6 KB  |  89 lines

  1.  
  2. #include <stdio.h>
  3. #include "vogle.h"
  4.  
  5. #define    CUBE_SIZE    200.0
  6. #define    TRANS        25.0
  7. #define    SCAL        0.1
  8. #define FACE        1
  9. #define FILLED        4
  10. #define HATCHED        8
  11. #define OUTLINE        10
  12.  
  13. extern float    tdir;
  14. extern float    scal;
  15. extern int    but, nplanes;
  16. int    i, n;
  17.  
  18. setup_lcube()
  19. {
  20.     window(-800.0, 800.0, -800.0, 800.0, -800.0, 800.0);
  21.     lookat(0.0, 0.0, 1500.0, 0.0, 0.0, 0.0, 0.0);
  22.  
  23.     makecube(FILLED);
  24.     makecube(HATCHED);
  25.     makecube(OUTLINE);
  26.  
  27.     backbuffer();
  28.  
  29.     hatchang(45.0);
  30.     hatchpitch(40.0);
  31.  
  32. }
  33.  
  34. makecube(obj)
  35.     int    obj;
  36. {
  37.     polyfill(0);
  38.     polyhatch(0);
  39.  
  40.     if (obj == FILLED)
  41.         polyfill(1);
  42.     else if (obj == HATCHED)
  43.         polyhatch(1);
  44.  
  45.     makeobj(obj);
  46.         pushmatrix();
  47.             translate(0.0, 0.0, CUBE_SIZE);
  48.             color(RED);
  49.             rect(-CUBE_SIZE, -CUBE_SIZE, CUBE_SIZE, CUBE_SIZE);
  50.         popmatrix();
  51.  
  52.         pushmatrix();
  53.             translate(CUBE_SIZE, 0.0, 0.0);
  54.             rotate(90.0, 'y');
  55.             color(GREEN);
  56.             rect(-CUBE_SIZE, -CUBE_SIZE, CUBE_SIZE, CUBE_SIZE);
  57.         popmatrix();
  58.  
  59.         pushmatrix();
  60.             translate(0.0, 0.0, -CUBE_SIZE);
  61.             rotate(180.0, 'y');
  62.             color(BLUE);
  63.             rect(-CUBE_SIZE, -CUBE_SIZE, CUBE_SIZE, CUBE_SIZE);
  64.         popmatrix();
  65.  
  66.         pushmatrix();
  67.             translate(-CUBE_SIZE, 0.0, 0.0);
  68.             rotate(-90.0, 'y');
  69.             color(CYAN);
  70.             rect(-CUBE_SIZE, -CUBE_SIZE, CUBE_SIZE, CUBE_SIZE);
  71.         popmatrix();
  72.  
  73.         pushmatrix();
  74.             translate(0.0, CUBE_SIZE, 0.0);
  75.             rotate(-90.0, 'x');
  76.             color(MAGENTA);
  77.             rect(-CUBE_SIZE, -CUBE_SIZE, CUBE_SIZE, CUBE_SIZE);
  78.         popmatrix();
  79.  
  80.         pushmatrix();
  81.             translate(0.0, -CUBE_SIZE, 0.0);
  82.             rotate(90.0, 'x');
  83.             color(YELLOW);
  84.             rect(-CUBE_SIZE, -CUBE_SIZE, CUBE_SIZE, CUBE_SIZE);
  85.         popmatrix();
  86.  
  87.     closeobj();
  88. }
  89.