Class BSPNode
java.lang.Object
net.mtrop.doom.bsp.data.BSPNode
- All Implemented Interfaces:
BinaryObject
This contains the BSP tree information for a single 28-byte node in the tree.
- 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 intLeaf node value.protected int[]This node's left bounding box coordinates.protected intThis node's left child index or subsector index.static final intByte length of this object.protected intThis node's partition line's change in X to the end of the line.protected intThis node's partition line's change in Y to the end of the line.protected intThis node's partition line's X-coordinate.protected intThis node's partition line's Y-coordinate.protected int[]This node's right bounding box coordinates.protected intThis node's right child index or subsector index. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanint[]intintintintintbooleanint[]intvoidreadBytes(InputStream in) Reads from anInputStreamand sets this object's fields.voidsetLeftRect(int top, int bottom, int left, int right) Sets this node's left bounding box coordinates (top, bottom, left, right).voidsetLeftSubsectorIndex(int val) Sets this node's left subsector index.voidsetPartitionDeltaX(int val) Sets this node's partition line's change in X to the end of the line.voidsetPartitionDeltaY(int val) Sets this node's partition line's change in Y to the end of the line.voidsetPartitionLineX(int val) Sets this node's partition line's X-coordinate.voidsetPartitionLineY(int val) Sets this node's partition line's Y-coordinate.voidsetRightRect(int top, int bottom, int left, int right) Sets this node's right bounding box coordinates (top, bottom, left, right).voidsetRightSubsectorIndex(int val) Sets this node's right subsector index.voidwriteBytes(OutputStream out) Writes this object to anOutputStream.
-
Field Details
-
LENGTH
public static final int LENGTHByte length of this object.- See Also:
-
LEAF_NODE_INDEX
public static final int LEAF_NODE_INDEXLeaf node value.- See Also:
-
partitionLineX
protected int partitionLineXThis node's partition line's X-coordinate. -
partitionLineY
protected int partitionLineYThis node's partition line's Y-coordinate. -
partitionDeltaX
protected int partitionDeltaXThis node's partition line's change in X to the end of the line. -
partitionDeltaY
protected int partitionDeltaYThis node's partition line's change in Y to the end of the line. -
rightRect
protected int[] rightRectThis node's right bounding box coordinates. -
leftRect
protected int[] leftRectThis node's left bounding box coordinates. -
rightSubsectorIndex
protected int rightSubsectorIndexThis node's right child index or subsector index. -
leftSubsectorIndex
protected int leftSubsectorIndexThis node's left child index or subsector index.
-
-
Constructor Details
-
BSPNode
public BSPNode()Creates a new BSP Node.
-
-
Method Details
-
getPartitionLineX
public int getPartitionLineX()- Returns:
- this node's partition line's X-coordinate.
-
setPartitionLineX
public void setPartitionLineX(int val) Sets this node's partition line's X-coordinate.- Parameters:
val- the new partition line x-coordinate.- Throws:
IllegalArgumentException- if the value is outside the range -32768 to 32767.
-
getPartitionLineY
public int getPartitionLineY()- Returns:
- this node's partition line's Y-coordinate.
-
setPartitionLineY
public void setPartitionLineY(int val) Sets this node's partition line's Y-coordinate.- Parameters:
val- the new partition line y-coordinate.- Throws:
IllegalArgumentException- if the value is outside the range -32768 to 32767.
-
getPartitionDeltaX
public int getPartitionDeltaX()- Returns:
- this node's partition line's change in X to the end of the line.
-
setPartitionDeltaX
public void setPartitionDeltaX(int val) Sets this node's partition line's change in X to the end of the line.- Parameters:
val- the new partition line delta X.- Throws:
IllegalArgumentException- if the value is outside the range -32768 to 32767.
-
getPartitionDeltaY
public int getPartitionDeltaY()- Returns:
- this node's partition line's change in Y to the end of the line.
-
setPartitionDeltaY
public void setPartitionDeltaY(int val) Sets this node's partition line's change in Y to the end of the line.- Parameters:
val- the new partition line delta Y.- Throws:
IllegalArgumentException- if the value is outside the range -32768 to 32767.
-
getRightRect
public int[] getRightRect()- Returns:
- this node's right bounding box coordinates (top, bottom, left, right).
-
setRightRect
public void setRightRect(int top, int bottom, int left, int right) Sets this node's right bounding box coordinates (top, bottom, left, right).- Parameters:
top- the top of the box.bottom- the bottom of the box.left- the left side of the box.right- the right side of the box.- Throws:
IllegalArgumentException- if any of the values are outside the range -32768 to 32767.
-
getLeftRect
public int[] getLeftRect()- Returns:
- this node's left bounding box coordinates (top, bottom, left, right).
-
setLeftRect
public void setLeftRect(int top, int bottom, int left, int right) Sets this node's left bounding box coordinates (top, bottom, left, right).- Parameters:
top- the top of the box.bottom- the bottom of the box.left- the left side of the box.right- the right side of the box.- Throws:
IllegalArgumentException- if any of the values are outside the range -32768 to 32767.
-
getRightChildIsLeaf
public boolean getRightChildIsLeaf()- Returns:
- true, if this node's right node is a leaf, false if not.
-
getRightSubsectorIndex
public int getRightSubsectorIndex()- Returns:
- this node's right subsector index.
-
setRightSubsectorIndex
public void setRightSubsectorIndex(int val) Sets this node's right subsector index.- Parameters:
val- the new right subsector index.- Throws:
IllegalArgumentException- if the value is outside the range 0 to 32767, or isn'tLEAF_NODE_INDEX.
-
getLeftSubsectorIndex
public int getLeftSubsectorIndex()- Returns:
- this node's left subsector index.
-
getLeftChildIsLeaf
public boolean getLeftChildIsLeaf()- Returns:
- true, if this node's left node is a leaf, false if not.
-
setLeftSubsectorIndex
public void setLeftSubsectorIndex(int val) Sets this node's left subsector index.- Parameters:
val- the new left subsector index.- Throws:
IllegalArgumentException- if the value is outside the range 0 to 32767, or isn'tLEAF_NODE_INDEX.
-
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.
-