home *** CD-ROM | disk | FTP | other *** search
/ gondwana.ecr.mu.oz.au/pub/ / Graphics.tar / Graphics / voglw.zip / scale.c < prev    next >
C/C++ Source or Header  |  1997-02-13  |  921b  |  50 lines

  1. #include "vogl.h"
  2.  
  3. /*
  4.  * scale
  5.  * 
  6.  * Set up a scale matrix and premultiply it and 
  7.  * the top matrix on the stack.
  8.  *
  9.  */
  10. void
  11. scale(x, y, z)
  12.     float     x, y, z;
  13. {
  14.     Token    *tok;
  15.  
  16.     if (!vdevice.initialised)
  17.         verror("scale: vogl not initialised");
  18.  
  19.     if (vdevice.inobject) {
  20.         tok = newtokens(4);
  21.  
  22.         tok[0].i = SCALE;
  23.         tok[1].f = x;
  24.         tok[2].f = y;
  25.         tok[3].f = z;
  26.  
  27.         return;
  28.     }
  29.  
  30.     /*
  31.      * Do the operations directly on the top matrix of
  32.      * the stack to speed things up.
  33.      */
  34.  
  35.     vdevice.transmat->m[0][0] *= x;
  36.     vdevice.transmat->m[0][1] *= x;
  37.     vdevice.transmat->m[0][2] *= x;
  38.     vdevice.transmat->m[0][3] *= x;
  39.  
  40.     vdevice.transmat->m[1][0] *= y;
  41.     vdevice.transmat->m[1][1] *= y;
  42.     vdevice.transmat->m[1][2] *= y;
  43.     vdevice.transmat->m[1][3] *= y;
  44.  
  45.     vdevice.transmat->m[2][0] *= z;
  46.     vdevice.transmat->m[2][1] *= z;
  47.     vdevice.transmat->m[2][2] *= z;
  48.     vdevice.transmat->m[2][3] *= z;
  49. }
  50.