Package net.mtrop.doom.bsp.data
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
Modifier and TypeFieldDescriptionprotected int
This Seg's angle.static final int
Binary angle.static final int
Binary angle.static final int
Binary angle.static final int
Binary angle.protected int
This Seg's direction.static final int
Direction along linedef (opposite).static final int
Direction along linedef (same).static final int
Byte length of this object.protected int
This Seg's linedef index.protected int
This Seg's offset along linedef.protected int
This Seg's end vertex index reference.protected int
This Seg's start vertex index reference. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
getAngle()
int
int
int
int
int
void
readBytes
(InputStream in) Reads from anInputStream
and sets this object's fields.void
setAngle
(int val) Sets this Seg's binary angle.void
setDirection
(int val) Sets this Seg's directionality.void
setLinedefIndex
(int val) Sets this Seg's linedef index.void
setOffset
(int val) Sets this Seg's linedef offset (distance along line until start of seg).void
setVertexEndIndex
(int val) Sets this Seg's end vertex index reference.void
setVertexStartIndex
(int val) Sets this Seg's start vertex index reference.void
writeBytes
(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_LINEDEF
toDIRECTION_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:BinaryObject
Reads from anInputStream
and 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:
readBytes
in interfaceBinaryObject
- Parameters:
in
- theInputStream
to read from.- Throws:
IOException
- if a read error occurs.
-
writeBytes
Description copied from interface:BinaryObject
Writes this object to anOutputStream
.- Specified by:
writeBytes
in interfaceBinaryObject
- Parameters:
out
- theOutputStream
to write to.- Throws:
IOException
- if a write error occurs.
-