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
FieldsModifier and TypeFieldDescriptionstatic final intByte length of this object.protected intThis Subsector's BSP Segment count.protected intThis Subsector's starting segment index. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintintvoidreadBytes(InputStream in) Reads from anInputStreamand sets this object's fields.voidsetSegCount(int segCount) Sets the amount of BSPSegments pointed to by this subsector.voidsetSegStartIndex(int segStartIndex) Sets the starting offset index of this subsector's BSPSegments in the Segs lump.voidwriteBytes(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: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.
-