|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.threed.jpct.OcTree
This is a basic octree implementation. An octree is a structure for spatial
subdivision. In jPCT, an octree can be constructed from any Mesh/Object3D and
assigned to any Object3D if no portal rendering is in use. It's not possible
to combine portals and octrees in jPCT, so you have to decide which way to
go. Octrees are more suitable for terrain rendering while portals are better
for indoor scenes. An Object3D will use an octree for rendering if one has
been assigned to it. There is no need to enable it explicitly.
The octree may be used for collision detection too. This HAS to be enabled
explicitly, because it's disabled by default. An octree is NOT useful in
every situation and may even hurt performance when used in the wrong places.
Object3D.setOcTree(com.threed.jpct.OcTree)
,
Serialized FormField Summary | |
static boolean |
COLLISION_DONT_USE
Don't use this octree to speed up collision detection |
static boolean |
COLLISION_USE
Use this octree to speed up collision detection |
static int |
MODE_NORMAL
Builds the octree in the "normal" way |
static int |
MODE_OPTIMIZED
Tries to build a more optimized octree. |
static boolean |
RENDERING_DONT_USE
Don't use this octree to speed up rendering |
static boolean |
RENDERING_USE
Use this octree to speed up rendering |
Constructor Summary | |
OcTree(Mesh mesh,
int maxPoly,
int mode)
Builds a new octree from an Object3D. |
|
OcTree(Mesh mesh,
int maxPoly,
int maxDepth,
int mode)
Builds a new octree from an Object3D. |
|
OcTree(Object3D obj,
int maxPoly,
int mode)
Builds a new octree from an Object3D. |
|
OcTree(Object3D obj,
int maxPoly,
int maxDepth,
int mode)
Builds a new octree from an Object3D. |
Method Summary | |
boolean |
getCollisionUse()
Gets the collision detection setting for this octree. |
java.util.Vector |
getFilledLeafs()
|
float |
getRadiusMultiplier()
Returns the current radius multiplier for this octree. |
boolean |
getRenderingUse()
Gets the rendering usage setting for this octree. |
boolean |
isOfOrderZero()
If the root-node is the only node in the tree, the tree is of order zero. |
void |
setCollisionUse(boolean useIt)
Sets the octree to be used for collision detection. |
void |
setRadiusMultiplier(float mul)
Sets the radius multiplier that will be used for the sphere-polygon collision detection. |
void |
setRenderingUse(boolean useIt)
Sets the octree to be used for rendering. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int MODE_NORMAL
public static final int MODE_OPTIMIZED
public static final boolean COLLISION_USE
public static final boolean COLLISION_DONT_USE
public static final boolean RENDERING_USE
public static final boolean RENDERING_DONT_USE
Constructor Detail |
public OcTree(Mesh mesh, int maxPoly, int mode)
mesh
- the mesh from which the octree should be constructedmaxPoly
- the maximum number of polygons a single node may contain. The
smaller this number is, the more complex the octree gets. It
depends on the object and its usage which number will be the
best.mode
- the mode that should be used to construct the objectMODE_NORMAL
,
MODE_OPTIMIZED
,
Object3D.setOcTree(com.threed.jpct.OcTree)
public OcTree(Mesh mesh, int maxPoly, int maxDepth, int mode)
mesh
- the mesh from which the octree should be constructedmaxPoly
- the maximum number of polygons a single node may contain. The
smaller this number is, the more complex the octree gets. It
depends on the object and its usage which number will be the
best.maxDepth
- the maximum depth of the tree. The recursion will end at this
depth regardless of the number of polygons in the node.mode
- the mode that should be used to construct the objectMODE_NORMAL
,
MODE_OPTIMIZED
,
Object3D.setOcTree(com.threed.jpct.OcTree)
public OcTree(Object3D obj, int maxPoly, int mode)
obj
- the object from which's mesh the octree should be constructedmaxPoly
- the maximum number of polygons a single node may contain. The
smaller this number is, the more complex the octree gets. It
depends on the object and its usage which number will be the
best.mode
- the mode that should be used to construct the objectMODE_NORMAL
,
MODE_OPTIMIZED
,
Object3D.setOcTree(com.threed.jpct.OcTree)
public OcTree(Object3D obj, int maxPoly, int maxDepth, int mode)
obj
- the object from which's mesh the octree should be constructedmaxPoly
- the maximum number of polygons a single node may contain. The
smaller this number is, the more complex the octree gets. It
depends on the object and its usage which number will be the
best.maxDepth
- the maximum depth of the tree. The recursion will end at this
depth regardless of the number of polygons in the node.mode
- the mode that should be used to construct the objectMODE_NORMAL
,
MODE_OPTIMIZED
,
Object3D.setOcTree(com.threed.jpct.OcTree)
Method Detail |
public java.util.Vector getFilledLeafs()
public void setCollisionUse(boolean useIt)
useIt
- use it for collision detection...or not...COLLISION_USE
,
COLLISION_DONT_USE
public void setRenderingUse(boolean useIt)
useIt
- use it for rendering...or not...RENDERING_USE
,
RENDERING_DONT_USE
public boolean getCollisionUse()
COLLISION_USE
,
COLLISION_DONT_USE
public boolean getRenderingUse()
RENDERING_USE
,
RENDERING_DONT_USE
public void setRadiusMultiplier(float mul)
mul
- the multiplierpublic float getRadiusMultiplier()
public boolean isOfOrderZero()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |