Package WildMagic.LibGraphics.SceneGraph
Class BoundingVolume
- java.lang.Object
-
- WildMagic.LibGraphics.ObjectSystem.GraphicsObject
-
- WildMagic.LibGraphics.SceneGraph.BoundingVolume
-
- All Implemented Interfaces:
java.io.Serializable,StreamInterface
public abstract class BoundingVolume extends GraphicsObject implements StreamInterface, java.io.Serializable
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classBoundingVolume.BVTyperun-time type information
-
Field Summary
Fields Modifier and Type Field Description private static longserialVersionUID
-
Constructor Summary
Constructors Constructor Description BoundingVolume()streaming constructor.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract voidComputeFromData(Vector3f[] pkVertices)Compute a bounding volume that contains all the points.abstract voidComputeFromData(VertexBuffer pkVBuffer)Compute a bounding volume that contains all the points.abstract booleanContains(Vector3f rkPoint)test for containment of a pointabstract voidCopyFrom(BoundingVolume pkInput)Make a copy of the bounding volume.abstract BoundingVolume.BVTypeGetBVType()Get the type of BoundingVolume.abstract Vector3fGetCenter()all bounding volumes must define a center and radiusintGetDiskUsed(StreamVersion rkVersion)Returns the size of this object and it's children on disk for the current StreamVersion parameter.abstract floatGetRadius()all bounding volumes must define a center and radiusabstract voidGrowToContain(BoundingVolume pkInput)Change the current bounding volume so that it contains the input bounding volume as well as its old bounding volume.voidLink(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.voidLoad(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.booleanRegister(Stream rkStream)Registers this object with the input Stream parameter.voidSave(Stream rkStream)Write this object and all it's children to the Stream.StringTreeSaveStrings(java.lang.String acTitle)Write this object into a StringTree for the scene-graph visualization.abstract voidSetCenter(Vector3f rkCenter)all bounding volumes must define a center and radiusabstract voidSetRadius(float fRadius)all bounding volumes must define a center and radiusabstract booleanTestIntersection(Vector3f rkOrigin, Vector3f rkDirection, float fTMin, float fTMax)Test for intersection of linear component and bound (points of intersection not computed).abstract booleanTestIntersection(BoundingVolume pkInput)Test for intersection of the two bounds.abstract voidTransformBy(Transformation rkTransform, BoundingVolume pkResult)Transform the bounding volume (model-to-world conversion).abstract intWhichSide(Plane3f rkPlane)Determine if the bounding volume is one side of the plane, the other side, or straddles the plane.-
Methods inherited from class WildMagic.LibGraphics.ObjectSystem.GraphicsObject
dispose, GetAllObjectsByName, GetID, GetName, GetNextID, GetObjectByID, GetObjectByIDBase, GetObjectByName, GetObjectByNameBase, SetName
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
-
Method Detail
-
ComputeFromData
public abstract void ComputeFromData(Vector3f[] pkVertices)
Compute a bounding volume that contains all the points.- Parameters:
pkVertices- array of points.
-
ComputeFromData
public abstract void ComputeFromData(VertexBuffer pkVBuffer)
Compute a bounding volume that contains all the points.- Parameters:
pkVBuffer- VertexBuffer containing points.
-
Contains
public abstract boolean Contains(Vector3f rkPoint)
test for containment of a point- Parameters:
rkPoint- point to test.- Returns:
- true if contained in this volume..
-
CopyFrom
public abstract void CopyFrom(BoundingVolume pkInput)
Make a copy of the bounding volume.- Parameters:
pkInput- bounding volume to copy into this.
-
GetBVType
public abstract BoundingVolume.BVType GetBVType()
Get the type of BoundingVolume.
-
GetCenter
public abstract Vector3f GetCenter()
all bounding volumes must define a center and radius- Returns:
- center of bounding volume.
-
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:
GetDiskUsedin interfaceStreamInterface- Overrides:
GetDiskUsedin classGraphicsObject- Parameters:
rkVersion- the current version of the Stream file being created.- Returns:
- the size of this object on disk.
-
GetRadius
public abstract float GetRadius()
all bounding volumes must define a center and radius- Returns:
- radius of bounding volume.
-
GrowToContain
public abstract void GrowToContain(BoundingVolume pkInput)
Change the current bounding volume so that it contains the input bounding volume as well as its old bounding volume.- Parameters:
pkInput- bounding volume to grow and contain with.
-
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:
Linkin interfaceStreamInterface- Overrides:
Linkin classGraphicsObject- 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:
Loadin interfaceStreamInterface- Overrides:
Loadin classGraphicsObject- 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.
-
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:
Registerin interfaceStreamInterface- Overrides:
Registerin classGraphicsObject- 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:
Savein interfaceStreamInterface- Overrides:
Savein classGraphicsObject- 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:
SaveStringsin interfaceStreamInterface- Overrides:
SaveStringsin classGraphicsObject- Parameters:
acTitle- the header for this object in the StringTree.- Returns:
- StringTree containing a String-based representation of this object and it's children.
-
SetCenter
public abstract void SetCenter(Vector3f rkCenter)
all bounding volumes must define a center and radius- Parameters:
rkCenter- center of bounding volume.
-
SetRadius
public abstract void SetRadius(float fRadius)
all bounding volumes must define a center and radius- Parameters:
fRadius- radius of bounding volume.
-
TestIntersection
public abstract boolean TestIntersection(BoundingVolume pkInput)
Test for intersection of the two bounds.- Parameters:
pkInput- BoundingVolume.- Returns:
- true if intersects.
-
TestIntersection
public abstract boolean TestIntersection(Vector3f rkOrigin, Vector3f rkDirection, float fTMin, float fTMax)
Test for intersection of linear component and bound (points of intersection not computed). The linear component is parameterized by P + t*D, where P is a point on the component and D is a unit-length direction. The interval [tmin,tmax] is line: tmin = -Mathf::MAX_REAL, tmax = Mathf::MAX_REAL ray: tmin = 0.0f, tmax = Mathf::MAX_REAL segment: tmin = 0.0f, tmax > 0.0f- Parameters:
rkOrigin- origin of point.rkDirection- unit-length direction.fTMin- min value for parameter t.fTMax- miax value for parameter t.- Returns:
- true if intersects.
-
TransformBy
public abstract void TransformBy(Transformation rkTransform, BoundingVolume pkResult)
Transform the bounding volume (model-to-world conversion).- Parameters:
rkTransform- transformationpkResult- updated bounding volume.
-
WhichSide
public abstract int WhichSide(Plane3f rkPlane)
Determine if the bounding volume is one side of the plane, the other side, or straddles the plane. If it is on the positive side (the side to which the normal points), the return value is +1. If it is on the negative side, the return value is -1. If it straddles the plane, the return value is 0.- Parameters:
rkPlane- plane to test against bounding volume.- Returns:
- positive side: +1; negative side: -1; straddle: 0.
-
-