home *** CD-ROM | disk | FTP | other *** search
/ Late Night VRML 2.0 with Java CD-ROM / code.zip / Ch13 / quake / Triangle.java < prev    next >
Text File  |  1996-11-17  |  846b  |  31 lines

  1. // Triangle class for processing MDL files
  2.  
  3. // Written by Bernie Roehl, November 1996
  4.  
  5. package quake;
  6.  
  7. import java.io.*;
  8.  
  9. public class Triangle {
  10.         protected boolean facesfront;
  11.         protected int[] points = new int[3];   // indices into vertex array
  12.  
  13.         public boolean isFrontFacing() { return facesfront; }
  14.  
  15.         public String toString() {
  16.                 return points[0] + " " + points[1] + " " + points[2];
  17.         }
  18.  
  19.         public int getPoint(int n) { return points[n]; }
  20.  
  21.         public Triangle(ByteFlipInputStream input) throws IOException {
  22.                 facesfront = (input.readFlippedInt() == 0) ? false : true;
  23.                 points[0] = input.readFlippedInt();
  24.                 points[1] = input.readFlippedInt();
  25.                 points[2] = input.readFlippedInt();
  26.         }
  27.  
  28. }
  29.  
  30.  
  31.