Package WildMagic.LibGraphics.Sorting
Class BspNode
- java.lang.Object
-
- WildMagic.LibGraphics.ObjectSystem.GraphicsObject
-
- WildMagic.LibGraphics.SceneGraph.Spatial
-
- WildMagic.LibGraphics.SceneGraph.Node
-
- WildMagic.LibGraphics.Sorting.BspNode
-
- All Implemented Interfaces:
java.io.Serializable
,NameIdInterface
,StreamInterface
public class BspNode extends Node implements StreamInterface, java.io.Serializable
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class WildMagic.LibGraphics.SceneGraph.Spatial
Spatial.CullingMode
-
-
Field Summary
Fields Modifier and Type Field Description protected Plane3f
m_kModelPlane
ModelPlaneprotected Plane3f
m_kWorldPlane
WorldPlaneprivate static long
serialVersionUID
-
Fields inherited from class WildMagic.LibGraphics.SceneGraph.Spatial
Culling, Local, m_iStartEffect, m_kEffects, m_kGlobalStates, m_kLights, m_pkParent, World, WorldBound, WorldBoundIsCurrent, WorldIsCurrent
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Spatial
AttachCoplanarChild(Spatial pkChild)
These methods should be used instead of the attach/detach methods in the Node base class.Spatial
AttachNegativeChild(Spatial pkChild)
These methods should be used instead of the attach/detach methods in the Node base class.Spatial
AttachPositiveChild(Spatial pkChild)
These methods should be used instead of the attach/detach methods in the Node base class.Spatial
DetachCoplanarChild()
These methods should be used instead of the attach/detach methods in the Node base class.Spatial
DetachNegativeChild()
These methods should be used instead of the attach/detach methods in the Node base class.Spatial
DetachPositiveChild()
These methods should be used instead of the attach/detach methods in the Node base class.void
dispose()
Delete memorySpatial
GetContainingNode(Vector3f rkPoint)
determine the portion of the scene that contains the pointSpatial
GetCoplanarChild()
Returns the coplanar subtreeint
GetDiskUsed(StreamVersion rkVersion)
Returns the size of this object and it's children on disk for the current StreamVersion parameter.Plane3f
GetModelPlane()
plane accessSpatial
GetNegativeChild()
Returns the negative subtreeSpatial
GetPositiveChild()
Returns the positive subtreeprotected void
GetVisibleSet(Culler rkCuller, boolean bNoCull)
cullingPlane3f
GetWorldPlane()
plane accessvoid
Link(Stream rkStream, Stream.Link pkLink)
Copies this objects children objects from the input Stream's HashTable, based on the LinkID of the child stored in the pkLink parameter.void
Load(Stream rkStream, Stream.Link pkLink)
Loads this object from the input parameter rkStream, using the input Stream.Link to store the IDs of children objects of this object for linking after all objects are loaded from the Stream.Plane3f
ModelPlane()
plane accessboolean
Register(Stream rkStream)
Registers this object with the input Stream parameter.void
Save(Stream rkStream)
Write this object and all it's children to the Stream.StringTree
SaveStrings(java.lang.String acTitle)
Write this object into a StringTree for the scene-graph visualization.protected void
UpdateWorldData(double dAppTime)
geometric updates-
Methods inherited from class WildMagic.LibGraphics.SceneGraph.Node
AttachChild, DetachAllChildren, DetachChild, DetachChildAt, GetAllObjectsByName, GetChild, GetObjectByID, GetObjectByName, GetQuantity, SetChild, UpdateState, UpdateWorldBound
-
Methods inherited from class WildMagic.LibGraphics.SceneGraph.Spatial
AttachEffect, AttachGlobalState, AttachLight, DetachAllEffects, DetachAllGlobalStates, DetachAllLights, DetachEffect, DetachGlobalState, DetachLight, GetEffect, GetEffectQuantity, GetGlobalState, GetGlobalState, GetGlobalStateQuantity, GetLight, GetLightQuantity, GetParent, GetStartEffect, OnGetVisibleSet, PopState, PropagateBoundToRoot, PropagateStateFromRoot, PushState, SetParent, SetStartEffect, UpdateBS, UpdateGS, UpdateGS, UpdateRS, UpdateRS
-
Methods inherited from class WildMagic.LibGraphics.ObjectSystem.GraphicsObject
GetID, GetName, GetNextID, GetObjectByIDBase, GetObjectByNameBase, SetName
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
m_kModelPlane
protected Plane3f m_kModelPlane
ModelPlane
-
m_kWorldPlane
protected Plane3f m_kWorldPlane
WorldPlane
-
-
Constructor Detail
-
BspNode
public BspNode()
Construction and destruction. The base class Node has *three* children and is not allowed to grow. The first and last children (indices 0 and 2) are the "positive" and "negative" children of the binary tree. The positive child corresponds to the positive side of the separating plane. The negative child corresponds to the negative side of the separating plane. The middle child slot is where additional geometry may be attached such as the triangles that are coplanar with the separating plane.
-
BspNode
public BspNode(Plane3f rkModelPlane)
Construction and destruction. The base class Node has *three* children and is not allowed to grow. The first and last children (indices 0 and 2) are the "positive" and "negative" children of the binary tree. The positive child corresponds to the positive side of the separating plane. The negative child corresponds to the negative side of the separating plane. The middle child slot is where additional geometry may be attached such as the triangles that are coplanar with the separating plane.- Parameters:
rkModelPlane
- the space partitioning plane.
-
-
Method Detail
-
AttachCoplanarChild
public Spatial AttachCoplanarChild(Spatial pkChild)
These methods should be used instead of the attach/detach methods in the Node base class.- Parameters:
pkChild
- the child to attach on the "coplanar" side.- Returns:
- The parent tree with the attached child.
-
AttachNegativeChild
public Spatial AttachNegativeChild(Spatial pkChild)
These methods should be used instead of the attach/detach methods in the Node base class.- Parameters:
pkChild
- the child to attach on the "negative" side.- Returns:
- The parent tree with the attached child.
-
AttachPositiveChild
public Spatial AttachPositiveChild(Spatial pkChild)
These methods should be used instead of the attach/detach methods in the Node base class.- Parameters:
pkChild
- the child to attach on the "positive" side.- Returns:
- The parent tree with the attached child.
-
DetachCoplanarChild
public Spatial DetachCoplanarChild()
These methods should be used instead of the attach/detach methods in the Node base class.- Returns:
- The parent tree with the coplanar child detached.
-
DetachNegativeChild
public Spatial DetachNegativeChild()
These methods should be used instead of the attach/detach methods in the Node base class.- Returns:
- The parent tree with the negative child detached.
-
DetachPositiveChild
public Spatial DetachPositiveChild()
These methods should be used instead of the attach/detach methods in the Node base class.- Returns:
- The parent tree with the positive child detached.
-
GetContainingNode
public Spatial GetContainingNode(Vector3f rkPoint)
determine the portion of the scene that contains the point- Parameters:
rkPoint
- the point to locate in the scene- Returns:
- the subtree containing the point.
-
GetCoplanarChild
public Spatial GetCoplanarChild()
Returns the coplanar subtree- Returns:
- coplanar child.
-
GetDiskUsed
public int GetDiskUsed(StreamVersion rkVersion)
Returns the size of this object and it's children on disk for the current StreamVersion parameter.- Specified by:
GetDiskUsed
in interfaceStreamInterface
- Overrides:
GetDiskUsed
in classNode
- Parameters:
rkVersion
- the current version of the Stream file being created.- Returns:
- the size of this object on disk.
-
GetModelPlane
public Plane3f GetModelPlane()
plane access- Returns:
- the ModelPlane
-
GetNegativeChild
public Spatial GetNegativeChild()
Returns the negative subtree- Returns:
- negative child.
-
GetPositiveChild
public Spatial GetPositiveChild()
Returns the positive subtree- Returns:
- positive child.
-
GetWorldPlane
public Plane3f GetWorldPlane()
plane access- Returns:
- the WorldPlane
-
Link
public void Link(Stream rkStream, Stream.Link pkLink)
Copies this objects children objects from the input Stream's HashTable, based on the LinkID of the child stored in the pkLink parameter.- Specified by:
Link
in interfaceStreamInterface
- Overrides:
Link
in classNode
- Parameters:
rkStream
- the Stream where the child objects are stored.pkLink
- the Link class from which the child object IDs are read.
-
Load
public void Load(Stream rkStream, Stream.Link pkLink)
Loads this object from the input parameter rkStream, using the input Stream.Link to store the IDs of children objects of this object for linking after all objects are loaded from the Stream.- Specified by:
Load
in interfaceStreamInterface
- Overrides:
Load
in classNode
- Parameters:
rkStream
- the Stream from which this object is being read.pkLink
- the Link class for storing the IDs of this object's children objects.
-
ModelPlane
public Plane3f ModelPlane()
plane access- Returns:
- the ModelPlane
-
Register
public boolean Register(Stream rkStream)
Registers this object with the input Stream parameter. All objects streamed to disk are registered with the Stream so that a unique list of objects is maintained.- Specified by:
Register
in interfaceStreamInterface
- Overrides:
Register
in classNode
- Parameters:
rkStream
- the Stream where the child objects are stored.- Returns:
- true if this object is registered, false if the object has already been registered.
-
Save
public void Save(Stream rkStream)
Write this object and all it's children to the Stream.- Specified by:
Save
in interfaceStreamInterface
- Overrides:
Save
in classNode
- Parameters:
rkStream
- the Stream where the child objects are stored.
-
SaveStrings
public StringTree SaveStrings(java.lang.String acTitle)
Write this object into a StringTree for the scene-graph visualization.- Specified by:
SaveStrings
in interfaceStreamInterface
- Overrides:
SaveStrings
in classNode
- Parameters:
acTitle
- the header for this object in the StringTree.- Returns:
- StringTree containing a String-based representation of this object and it's children.
-
GetVisibleSet
protected void GetVisibleSet(Culler rkCuller, boolean bNoCull)
culling- Overrides:
GetVisibleSet
in classNode
- Parameters:
rkCuller
- the culling objectbNoCull
- culling flag on/off
-
UpdateWorldData
protected void UpdateWorldData(double dAppTime)
geometric updates- Overrides:
UpdateWorldData
in classNode
- Parameters:
dAppTime
- application time
-
-