home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Late Night VRML 2.0 with Java CD-ROM
/
code.zip
/
Ch13
/
quake
/
FrameGroup.java
< prev
next >
Wrap
Text File
|
1996-11-17
|
2KB
|
48 lines
// Frame from an MDL file
// Written by Bernie Roehl, November 1996
package quake;
import java.io.*;
public class FrameGroup {
protected int nsubframes;
protected Trivertex min, max;
protected float[] times;
protected Frame[] subframes;
public int getNumberOfSubFrames() { return nsubframes; }
public Trivertex getMin() { return min; }
public Trivertex getMax() { return max; }
public float getTime(int n) { return times[n]; }
public Frame getSubFrame(int n) { return subframes[n]; }
public FrameGroup(ByteFlipInputStream input, int nverts)
throws IOException {
int type = input.readFlippedInt();
if (type == 0) {
nsubframes = 1;
times = new float[1];
times[0] = 0;
subframes = new Frame[1];
subframes[0] = new Frame(input, nverts);
min = subframes[0].getMin();
max = subframes[0].getMax();
}
else {
nsubframes = input.readInt();
min = new Trivertex(input);
max = new Trivertex(input);
times = new float[nsubframes];
for (int i = 0; i < nsubframes; ++i)
times[i] = input.readFlippedFloat();
subframes = new Frame[nsubframes];
for (int i = 0; i < nsubframes; ++i)
subframes[i] = new Frame(input, nverts);
}
}
}