Package net.mtrop.doom.bsp.data
Class BSPSubsector
java.lang.Object
net.mtrop.doom.bsp.data.BSPSubsector
- All Implemented Interfaces:
BinaryObject
4-byte BSP Subsector information that lists all of the BSP segment indices for a sector.
These are essentially the mappings of Nodes to other nodes.
- 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 TypeFieldDescriptionstatic final int
Byte length of this object.protected int
This Subsector's BSP Segment count.protected int
This Subsector's starting segment index. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
int
void
readBytes
(InputStream in) Reads from anInputStream
and sets this object's fields.void
setSegCount
(int segCount) Sets the amount of BSPSegments pointed to by this subsector.void
setSegStartIndex
(int segStartIndex) Sets the starting offset index of this subsector's BSPSegments in the Segs lump.void
writeBytes
(OutputStream out) Writes this object to anOutputStream
.
-
Field Details
-
LENGTH
public static final int LENGTHByte length of this object.- See Also:
-
segCount
protected int segCountThis Subsector's BSP Segment count. -
segStartIndex
protected int segStartIndexThis Subsector's starting segment index.
-
-
Constructor Details
-
BSPSubsector
public BSPSubsector()Creates a new BSP Subsector.
-
-
Method Details
-
getSegCount
public int getSegCount()- Returns:
- the amount of BSPSegments pointed to by this subsector.
-
setSegCount
public void setSegCount(int segCount) Sets the amount of BSPSegments pointed to by this subsector.- Parameters:
segCount
- the amount of segments.- Throws:
IllegalArgumentException
- if the provided value is outside the range 0 to 65535.
-
getSegStartIndex
public int getSegStartIndex()- Returns:
- the starting offset index of this subsector's BSPSegments in the Segs lump.
-
setSegStartIndex
public void setSegStartIndex(int segStartIndex) Sets the starting offset index of this subsector's BSPSegments in the Segs lump.- Parameters:
segStartIndex
- the starting index.- 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.
-