Aviatrix3D
2.1.0

org.j3d.renderer.aviatrix3d.nodes
Class LODGroup

java.lang.Object
  extended by org.j3d.aviatrix3d.SceneGraphObject
      extended by org.j3d.aviatrix3d.Node
          extended by org.j3d.aviatrix3d.BaseNode
              extended by org.j3d.aviatrix3d.BaseGroup
                  extended by org.j3d.renderer.aviatrix3d.nodes.LODGroup
All Implemented Interfaces:
CustomPickTarget, PickableObject, PickTarget, Cullable, CustomCullable, TransformHierarchy

public class LODGroup
extends BaseGroup
implements CustomCullable, CustomPickTarget, PickableObject

A grouping node structure that controls which children are being rendered based on distance from the user.

Each child of LODGroup should have a value. The value can be interpreted as measure of the the maximum distance between the child and the eye point for the child to be visible. If distanceMode is true the value is interpreted as the distance, if false (the default) the value is the size of characteristic details in the child. The distance is then computed automatically for when the characteristic details should become visible. The children should be added in a most detailed to least detailed order, with monothonically increasing values.

When in distance mode, a center offset can be applied. This allows you to have the LOD offset from the center of the geometry, if needed. If this is the default value, then the center of the combined bounds of all children is used to determine the range.

When setting up the node, you need to have one less range value than the number of children currently supplied. If not, then beyond the last set range value, we will automatically choose the last child as the one to be displayed.

Version:
1.0
Author:
Rune Aasgaard, (c) SINTEF, Justin Couch

Field Summary
 
Fields inherited from class org.j3d.aviatrix3d.BaseGroup
childList, dirtyBoundsCount, lastChild, wkVec1, wkVec2
 
Fields inherited from class org.j3d.aviatrix3d.Node
bounds, implicitBounds, INVALID_BOUNDS, parent
 
Fields inherited from class org.j3d.aviatrix3d.SceneGraphObject
alive, LISTENER_SET_TIMING_ERR_PROP, updateHandler
 
Fields inherited from interface org.j3d.aviatrix3d.picking.PickTarget
CUSTOM_PICK_TYPE, GROUP_PICK_TYPE, LEAF_PICK_TYPE, SINGLE_PICK_TYPE
 
Fields inherited from interface org.j3d.aviatrix3d.picking.PickableObject
COLLIDABLE_OBJECT, GENERAL_OBJECT, PROXIMITY_OBJECT, VISIBLE_OBJECT
 
Constructor Summary
LODGroup()
          Create a new LOD implementation that uses distance as the determining visual factor.
LODGroup(boolean distanceMode)
          Construct a LOD group that is selectable whether is uses distance or smallest visual cue.
 
Method Summary
 void addChild(Node newChild)
          Appends the specified child node to this group node's list of children
 boolean checkPickMask(int mask)
          Check the given pick mask against the node's internal pick mask representation.
 void cullChildren(CullInstructions output, javax.vecmath.Matrix4f vworldTx, javax.vecmath.Matrix4f viewTransform, javax.vecmath.Vector4f[] frustumPlanes, float angularRes)
          Check this node for children to traverse.
 void getCenter(float[] center)
          Get the current center location.
 BoundingVolume getPickableBounds()
          Get the bounds of this picking target so that testing can be performed on the object.
 int getPickMask()
          Get the current pickable state mask of this object.
 int getPickTargetType()
          Return the type constant that represents the type of pick target this is.
 float getRange(int idx)
          Get the range set at the given child index.
 boolean isDistanceMode()
          Find out which of the two modes are being used by this LOD.
 void pickBatch(PickRequest[] reqs, int numRequests)
          Check for all intersections against this geometry and it's children to see if there is an intersection with the given set of requests.
 void pickChildren(PickInstructions output, javax.vecmath.Matrix4f vworldTx, PickRequest request)
          This node is being subjected to picking, so process the provided data and return the instructions on the list of available children and any transformation information to the system.
 void pickSingle(PickRequest req)
          Check for all intersections against this geometry and it's children to see if there is an intersection with the given set of requests.
 void removeAllChildren()
          Removes all children from the group.
 void removeChild(int idx)
          Remove the child at the specified index from the group.
 void setCenter(float[] center)
          Set the center that the LOD would use to determine distance from when using distance mode.
 void setPickMask(int state)
          Set the node as being pickable currently using the given bit mask.
 void setRange(int idx, float value)
          Set the range at the given child index.
 
Methods inherited from class org.j3d.aviatrix3d.BaseGroup
checkForCyclicChild, getAllChildren, getChild, indexOfChild, markBoundsDirty, numChildren, recomputeBounds, removeChild, requestBoundsUpdate, setBounds, setChild, setLive, setUpdateHandler, updateBounds
 
Methods inherited from class org.j3d.aviatrix3d.BaseNode
checkForCyclicChild, checkForCyclicParent, clearUpdateHandler, removeParent, setLive, setParent, setUpdateHandler
 
Methods inherited from class org.j3d.aviatrix3d.Node
boundsChanged, checkForCyclicParent, getBounds, getParent, removeParent, setParent, updateParentBounds
 
Methods inherited from class org.j3d.aviatrix3d.SceneGraphObject
dataChanged, getAppUpdateWriteTimingMessage, getBoundsWriteTimingMessage, getDataWriteTimingMessage, getUserData, isLive, setUserData
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LODGroup

public LODGroup()
Create a new LOD implementation that uses distance as the determining visual factor.


LODGroup

public LODGroup(boolean distanceMode)
Construct a LOD group that is selectable whether is uses distance or smallest visual cue.

Parameters:
distanceMode - true if this should use user distance, false for visual size
Method Detail

cullChildren

public void cullChildren(CullInstructions output,
                         javax.vecmath.Matrix4f vworldTx,
                         javax.vecmath.Matrix4f viewTransform,
                         javax.vecmath.Vector4f[] frustumPlanes,
                         float angularRes)
Check this node for children to traverse. The angular resolution is defined as Field Of View (in radians) / viewport width in pixels.

Specified by:
cullChildren in interface CustomCullable
Parameters:
output - Fill in the child information here
vworldTx - The transformation from the root of the scene to this node according to the current traversal path
viewTransform - The transformation from the root of the scene graph to the active viewpoint
frustumPlanes - Listing of frustum planes in the order: right, left, bottom, top, far, near
angularRes - Angular resolution of the screen, or 0 if not calculable from the available data.

pickChildren

public void pickChildren(PickInstructions output,
                         javax.vecmath.Matrix4f vworldTx,
                         PickRequest request)
This node is being subjected to picking, so process the provided data and return the instructions on the list of available children and any transformation information to the system.

Specified by:
pickChildren in interface CustomPickTarget
Parameters:
output - Fill in the results of the picking evaluation here
vworldTx - The transformation from the root of the scene to this node according to the current traversal path
request - The picking request made of this object

getPickTargetType

public final int getPickTargetType()
Return the type constant that represents the type of pick target this is. Used to provided optimised picking implementations.

Specified by:
getPickTargetType in interface PickTarget
Returns:
One of the _PICK_TYPE constants

checkPickMask

public boolean checkPickMask(int mask)
Check the given pick mask against the node's internal pick mask representation. If there is a match in one or more bitfields then this will return true, allowing picking to continue to process for this target.

Specified by:
checkPickMask in interface PickTarget
Parameters:
mask - The bit mask to check against
Returns:
true if the mask has an overlapping set of bitfields

getPickableBounds

public BoundingVolume getPickableBounds()
Get the bounds of this picking target so that testing can be performed on the object.

Specified by:
getPickableBounds in interface PickTarget
Returns:
A representation of the volume representing the pickable objects

setPickMask

public void setPickMask(int state)
Set the node as being pickable currently using the given bit mask. A mask of 0 will completely disable picking.

Specified by:
setPickMask in interface PickableObject
Parameters:
state - A bit mask of available options to pick for

getPickMask

public int getPickMask()
Get the current pickable state mask of this object. A value of zero means it is completely unpickable.

Specified by:
getPickMask in interface PickableObject
Returns:
A bit mask of available options to pick for

pickBatch

public void pickBatch(PickRequest[] reqs,
                      int numRequests)
               throws NotPickableException,
                      InvalidPickTimingException
Check for all intersections against this geometry and it's children to see if there is an intersection with the given set of requests.

Specified by:
pickBatch in interface PickableObject
Parameters:
reqs - The list of picks to be made, starting at this object
numRequests - The number of valid pick requests to process
Throws:
NotPickableException - This object has been marked as non pickable, but you decided to try to call the method anyway
InvalidPickTimingException - An attempt was made to pick outside of the ApplicationUpdateObserver callback method

pickSingle

public void pickSingle(PickRequest req)
                throws NotPickableException,
                       InvalidPickTimingException
Check for all intersections against this geometry and it's children to see if there is an intersection with the given set of requests.

Specified by:
pickSingle in interface PickableObject
Parameters:
req - The details of the pick to be made
Throws:
NotPickableException - This object has been marked as non pickable, but you decided to try to call the method anyway
InvalidPickTimingException - An attempt was made to pick outside of the ApplicationUpdateObserver callback method

addChild

public void addChild(Node newChild)
              throws AlreadyParentedException,
                     InvalidWriteTimingException
Appends the specified child node to this group node's list of children

Overrides:
addChild in class BaseGroup
Parameters:
newChild - The child to add
Throws:
AlreadyParentedException - There is a valid parent already set
InvalidWriteTimingException - An attempt was made to write outside of the NodeUpdateListener bounds changed callback method

removeChild

public void removeChild(int idx)
                 throws InvalidWriteTimingException
Remove the child at the specified index from the group.

Overrides:
removeChild in class BaseGroup
Parameters:
idx - The index of the child to remove
Throws:
IndexOfBoundsException - When the idx is invalid
InvalidWriteTimingException - An attempt was made to write outside of the NodeUpdateListener bounds changed callback method

removeAllChildren

public void removeAllChildren()
                       throws InvalidWriteTimingException
Removes all children from the group.

Overrides:
removeAllChildren in class BaseGroup
Throws:
InvalidWriteTimingException - An attempt was made to write outside of the NodeUpdateListener callback method

getRange

public float getRange(int idx)
Get the range set at the given child index.

Parameters:
idx - The range index to get the value from
Throws:
java.lang.IndexOutOfBoundsException - The index is negative or past the last child

setRange

public void setRange(int idx,
                     float value)
              throws InvalidWriteTimingException,
                     java.lang.IndexOutOfBoundsException,
                     java.lang.IllegalArgumentException
Set the range at the given child index. The value at this index is required to be monotonically increasing relative to the previous and next index.

Parameters:
idx - The range index to get the value from
Throws:
InvalidWriteTimingException - An attempt was made to write outside of the NodeUpdateListener data callback method
java.lang.IndexOutOfBoundsException - The index is negative or past the last child
java.lang.IllegalArgumentException - The value is not monotonically increasing

getCenter

public void getCenter(float[] center)
Get the current center location. If this LOD is not using distance mode, the request is ignored and the given array returns unchanged.

Parameters:
center - The array to copy the center value into

setCenter

public void setCenter(float[] center)
               throws InvalidWriteTimingException
Set the center that the LOD would use to determine distance from when using distance mode. This request is ignored when the mode is not working on distance.

Parameters:
center - The value of the center to use
Throws:
InvalidWriteTimingException - An attempt was made to write outside of the NodeUpdateListener data callback method

isDistanceMode

public boolean isDistanceMode()
Find out which of the two modes are being used by this LOD.


Aviatrix3D
2.1.0

Latest Info from http://aviatrix3d.j3d.org/
Copyright © 2003 - 2009 j3d.org