Class BSPSubsector

java.lang.Object
net.mtrop.doom.bsp.data.BSPSubsector
All Implemented Interfaces:
BinaryObject

public class BSPSubsector extends Object implements 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
  • Field Details

    • LENGTH

      public static final int LENGTH
      Byte length of this object.
      See Also:
    • segCount

      protected int segCount
      This Subsector's BSP Segment count.
    • segStartIndex

      protected int segStartIndex
      This 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

      public void readBytes(InputStream in) throws IOException
      Description copied from interface: BinaryObject
      Reads from an InputStream 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 interface BinaryObject
      Parameters:
      in - the InputStream to read from.
      Throws:
      IOException - if a read error occurs.
    • writeBytes

      public void writeBytes(OutputStream out) throws IOException
      Description copied from interface: BinaryObject
      Writes this object to an OutputStream.
      Specified by:
      writeBytes in interface BinaryObject
      Parameters:
      out - the OutputStream to write to.
      Throws:
      IOException - if a write error occurs.