Class BSPSegment
java.lang.Object
net.mtrop.doom.bsp.data.BSPSegment
- All Implemented Interfaces:
BinaryObject
12-byte BSP Segment information for a BSP tree in Doom.
- Author:
- Matthew Tropiano
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.mtrop.doom.object.BinaryObject
BinaryObject.InlineScanner<BO extends BinaryObject>, BinaryObject.Reflect, BinaryObject.Scanner<BO extends BinaryObject>, BinaryObject.Shared, BinaryObject.Transformer<BO extends BinaryObject> -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected intThis Seg's angle.static final intBinary angle.static final intBinary angle.static final intBinary angle.static final intBinary angle.protected intThis Seg's direction.static final intDirection along linedef (opposite).static final intDirection along linedef (same).static final intByte length of this object.protected intThis Seg's linedef index.protected intThis Seg's offset along linedef.protected intThis Seg's end vertex index reference.protected intThis Seg's start vertex index reference. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintgetAngle()intintintintintvoidreadBytes(InputStream in) Reads from anInputStreamand sets this object's fields.voidsetAngle(int val) Sets this Seg's binary angle.voidsetDirection(int val) Sets this Seg's directionality.voidsetLinedefIndex(int val) Sets this Seg's linedef index.voidsetOffset(int val) Sets this Seg's linedef offset (distance along line until start of seg).voidsetVertexEndIndex(int val) Sets this Seg's end vertex index reference.voidsetVertexStartIndex(int val) Sets this Seg's start vertex index reference.voidwriteBytes(OutputStream out) Writes this object to anOutputStream.
-
Field Details
-
LENGTH
public static final int LENGTHByte length of this object.- See Also:
-
DIRECTION_SAME_AS_LINEDEF
public static final int DIRECTION_SAME_AS_LINEDEFDirection along linedef (same).- See Also:
-
DIRECTION_OPPOSITE_LINEDEF
public static final int DIRECTION_OPPOSITE_LINEDEFDirection along linedef (opposite).- See Also:
-
ANGLE_EAST
public static final int ANGLE_EASTBinary angle.- See Also:
-
ANGLE_NORTH
public static final int ANGLE_NORTHBinary angle.- See Also:
-
ANGLE_SOUTH
public static final int ANGLE_SOUTHBinary angle.- See Also:
-
ANGLE_WEST
public static final int ANGLE_WESTBinary angle.- See Also:
-
vertexStartIndex
protected int vertexStartIndexThis Seg's start vertex index reference. -
vertexEndIndex
protected int vertexEndIndexThis Seg's end vertex index reference. -
angle
protected int angleThis Seg's angle. -
linedefIndex
protected int linedefIndexThis Seg's linedef index. -
direction
protected int directionThis Seg's direction. -
offset
protected int offsetThis Seg's offset along linedef.
-
-
Constructor Details
-
BSPSegment
public BSPSegment()Creates a new BSP Segment.
-
-
Method Details
-
getVertexStartIndex
public int getVertexStartIndex()- Returns:
- this Seg's start vertex index reference.
-
setVertexStartIndex
public void setVertexStartIndex(int val) Sets this Seg's start vertex index reference.- Parameters:
val- the new starting vertex reference.- Throws:
IllegalArgumentException- if the provided value is outside the range 0 to 65535.
-
getVertexEndIndex
public int getVertexEndIndex()- Returns:
- this Seg's end vertex index reference.
-
setVertexEndIndex
public void setVertexEndIndex(int val) Sets this Seg's end vertex index reference.- Parameters:
val- the new ending vertex reference.- Throws:
IllegalArgumentException- if the provided value is outside the range 0 to 65535.
-
getAngle
public int getAngle()- Returns:
- this Seg's angle in degrees.
-
setAngle
public void setAngle(int val) Sets this Seg's binary angle.- Parameters:
val- the new binary angle.- Throws:
IllegalArgumentException- if the provided value is outside the range -32768 to 32767.
-
getLinedefIndex
public int getLinedefIndex()- Returns:
- this Seg's linedef index.
-
setLinedefIndex
public void setLinedefIndex(int val) Sets this Seg's linedef index.- Parameters:
val- the new linedef index.- Throws:
IllegalArgumentException- if the provided value is outside the range -32768 to 32767.
-
getDirection
public int getDirection()- Returns:
- this Seg's direction.
-
setDirection
public void setDirection(int val) Sets this Seg's directionality.- Parameters:
val- the new directionality.- Throws:
IllegalArgumentException- if the provided value is neitherDIRECTION_OPPOSITE_LINEDEFtoDIRECTION_SAME_AS_LINEDEF.
-
getOffset
public int getOffset()- Returns:
- this Seg's linedef offset.
-
setOffset
public void setOffset(int val) Sets this Seg's linedef offset (distance along line until start of seg).- Parameters:
val- the linedef offset.- Throws:
IllegalArgumentException- if the provided value is outside the range 0 to 65535.
-
readBytes
Description copied from interface:BinaryObjectReads from anInputStreamand sets this object's fields. Only reads the amount of bytes that it takes to read a single instance of the object. Note that not every object may have a consistent length!- Specified by:
readBytesin interfaceBinaryObject- Parameters:
in- theInputStreamto read from.- Throws:
IOException- if a read error occurs.
-
writeBytes
Description copied from interface:BinaryObjectWrites this object to anOutputStream.- Specified by:
writeBytesin interfaceBinaryObject- Parameters:
out- theOutputStreamto write to.- Throws:
IOException- if a write error occurs.
-