home *** CD-ROM | disk | FTP | other *** search
/ Late Night VRML 2.0 with Java CD-ROM / code.zip / Ch13 / quake / Frame.java < prev    next >
Text File  |  1997-01-14  |  1KB  |  36 lines

  1. // Simple frame from an MDL file
  2.  
  3. // Written by Bernie Roehl, November 1996
  4.  
  5. package quake;
  6.  
  7. import java.io.*;
  8.  
  9. public class Frame {
  10.         protected Trivertex min, max;
  11.         protected String name;
  12.         protected Trivertex vertices[];
  13.  
  14.         public Trivertex getMin() { return min; }
  15.         public Trivertex getMax() { return max; }
  16.         public String getName() { return name; }
  17.         public Trivertex getVertex(int n)  { return vertices[n]; }
  18.  
  19.         public Frame(ByteFlipInputStream input, int nverts)
  20.                 throws IOException {
  21.                 byte[] buffer = new byte[16];
  22.                 min = new Trivertex(input);
  23.                 max = new Trivertex(input);
  24.                 input.read(buffer);
  25.                 name = new String(buffer, 0);
  26.                 int zerobyte = name.indexOf(0);
  27.                 if (zerobyte >= 0)
  28.                         name = name.substring(0, zerobyte);
  29.                 vertices = new Trivertex[nverts];
  30.                 for (int i = 0; i < nverts; ++i)
  31.                         vertices[i] = new Trivertex(input);
  32.         }
  33.  
  34. }
  35.  
  36.