Aviatrix3D
2.1.0

org.j3d.aviatrix3d
Class Raster

java.lang.Object
  extended by org.j3d.aviatrix3d.SceneGraphObject
      extended by org.j3d.aviatrix3d.NodeComponent
          extended by org.j3d.aviatrix3d.Raster
All Implemented Interfaces:
java.lang.Comparable, LeafPickTarget, PickableObject, PickTarget, GeometryRenderable, Renderable
Direct Known Subclasses:
BitmapRaster, ByteRaster, ImageRaster

public abstract class Raster
extends NodeComponent
implements PickableObject, LeafPickTarget, GeometryRenderable

Raster is an abstract class that specifies 2D pixel data required by a Pixmap node.

Raster may take one of two forms: Single byte bitmaps and multibyte images. When doing line intersections, rasters will only return true if the start point is within the bounds of the raster and the direction is along the -Z axis.

Coordinate System

Rasters use OpenGL's coordinate system that defines the position as the lower left corner of the object. Width extends to the right, height is upwards. Rasters are always rendered in screen space coordinates - 2D integer pixel locations. Fractional values don't exist.

Note that OpenGL treats raster objects differently to polygonal data. If the origin is outside of the current clip bounds, the entire object is not shown on screen, even if part of its bounds lie inside the current viewport.

Internationalisation Resource Names

Version:
$Revision: 2.6 $
Author:
Justin Couch

Field Summary
protected  BoundingVolume bounds
          Bounding volume set by the user
protected  boolean implicitBounds
          Was the bounds automatically calculated?
protected  InternalNodeUpdateListener internalUpdater
          Update handler for the external code.
protected static BoundingVoid INVALID_BOUNDS
          Sharable version of the null bounds object for those that need it
protected  int lastParentList
          Index to the next place to add items in the nodeList
protected  Node[] parentList
          Listing of all the parents of this node
protected  int pickFlags
          Flag indicating if this object is pickable currently
protected  boolean validAlpha
          Flag indicating current object has alpha values actually set
 
Fields inherited from class org.j3d.aviatrix3d.NodeComponent
lastParent, liveCount
 
Fields inherited from class org.j3d.aviatrix3d.SceneGraphObject
alive, LISTENER_SET_TIMING_ERR_PROP, updateHandler
 
Fields inherited from interface org.j3d.aviatrix3d.picking.PickableObject
COLLIDABLE_OBJECT, GENERAL_OBJECT, PROXIMITY_OBJECT, VISIBLE_OBJECT
 
Fields inherited from interface org.j3d.aviatrix3d.picking.PickTarget
CUSTOM_PICK_TYPE, GROUP_PICK_TYPE, LEAF_PICK_TYPE, SINGLE_PICK_TYPE
 
Constructor Summary
Raster()
          The default constructor initialised the base values.
 
Method Summary
protected  void addParent(Node p)
          Add a parent to this node.
 void boundsChanged(NodeUpdateListener l)
          Notify the node that you have updates to the node that might alter its bounds.
 boolean checkPickMask(int mask)
          Check the given pick mask against the node's internal pick mask representation.
 BoundingVolume getBounds()
          Get the currently set bounds for this object.
 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.
 boolean hasTransparency()
          Check to see if this geometry has anything that could be interpreted as an alpha value.
protected  boolean isVisible()
          Check to see if this geometry is making the geometry visible or not.
protected  void markBoundsDirty()
          Mark this node as having dirty bounds due to it's geometry having changed.
 void pickBatch(PickRequest[] reqs, int numRequests)
          Check for all intersections against this geometry to see if there is an intersection with the given set of requests.
 boolean pickLineRay(float[] origin, float[] direction, boolean findAny, float[] dataOut, int dataOutFlags)
          Check for all intersections against this geometry using a line ray and return the exact distance away of the closest picking point.
 boolean pickLineSegment(float[] start, float[] end, boolean findAny, float[] dataOut, int dataOutFlags)
          Check for all intersections against this geometry using a line segment and return the exact distance away of the closest picking point.
 void pickSingle(PickRequest req)
          Check for all intersections against this geometry to see if there is an intersection with the given set of requests.
protected abstract  void recomputeBounds()
          Internal method to recalculate the implicit bounds of this Node.
protected  void removeParent(Node p)
          Remove a parent from this shared group.
 void setBounds(BoundingVolume b)
          Set the bounds to the given explicit value.
 void setPickMask(int state)
          Set the node as being pickable currently using the given bit mask.
protected  void updateBounds()
          Update this node's bounds and then call the parent to update it's bounds.
 
Methods inherited from class org.j3d.aviatrix3d.NodeComponent
addParent, getParents, numParents, removeParent
 
Methods inherited from class org.j3d.aviatrix3d.SceneGraphObject
checkForCyclicChild, checkForCyclicParent, dataChanged, getAppUpdateWriteTimingMessage, getBoundsWriteTimingMessage, getDataWriteTimingMessage, getUserData, isLive, setLive, setUpdateHandler, setUserData
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.j3d.aviatrix3d.rendering.GeometryRenderable
render
 
Methods inherited from interface org.j3d.aviatrix3d.rendering.Renderable
equals
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Field Detail

INVALID_BOUNDS

protected static final BoundingVoid INVALID_BOUNDS
Sharable version of the null bounds object for those that need it


parentList

protected Node[] parentList
Listing of all the parents of this node


lastParentList

protected int lastParentList
Index to the next place to add items in the nodeList


internalUpdater

protected InternalNodeUpdateListener internalUpdater
Update handler for the external code. Not created until needed.


bounds

protected BoundingVolume bounds
Bounding volume set by the user


implicitBounds

protected boolean implicitBounds
Was the bounds automatically calculated?


pickFlags

protected int pickFlags
Flag indicating if this object is pickable currently


validAlpha

protected boolean validAlpha
Flag indicating current object has alpha values actually set

Constructor Detail

Raster

public Raster()
The default constructor initialised the base values.

By default the values are:
implicitBounds: true;
pickable: true;
validAlpha: false

Method Detail

addParent

protected void addParent(Node p)
                  throws AlreadyParentedException,
                         InvalidNodeTypeException
Add a parent to this node.

Parameters:
p - The new parent instance to add to the list
Throws:
AlreadyParentedException - There is a valid parent already set
InvalidNodeTypeException - Not a group node

removeParent

protected void removeParent(Node p)
Remove a parent from this shared group. Since setParent() cannot be used to remove a parent from the graph, you'll need to use this method to remove the parent.

Parameters:
p - The new parent instance to remove from the list

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 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 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

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

pickLineSegment

public boolean pickLineSegment(float[] start,
                               float[] end,
                               boolean findAny,
                               float[] dataOut,
                               int dataOutFlags)
                        throws NotPickableException
Check for all intersections against this geometry using a line segment and return the exact distance away of the closest picking point. Default implementation always returns false indicating that nothing was found. Derived classes should override and provide a real implementation.

Specified by:
pickLineSegment in interface LeafPickTarget
Parameters:
start - The start point of the segment
end - The end point of the segment
findAny - True if it only has to find a single intersection and can exit as soon as it finds the first intersection. False if it must find the closest polygon
dataOut - An array to put the data in for the intersection. Exact format is described by the flags
dataOutFlags - A set of derived-class specific flags describing what data should be included in the output array
Returns:
True if an intersection was found according to the input request
Throws:
NotPickableException - This object has been marked as non pickable, but you decided to try to call the method anyway

pickLineRay

public boolean pickLineRay(float[] origin,
                           float[] direction,
                           boolean findAny,
                           float[] dataOut,
                           int dataOutFlags)
                    throws NotPickableException
Check for all intersections against this geometry using a line ray and return the exact distance away of the closest picking point. Default implementation always returns false indicating that nothing was found. Derived classes should override and provide a real implementation.

Specified by:
pickLineRay in interface LeafPickTarget
Parameters:
origin - The start point of the ray
direction - The direction vector of the ray
findAny - True if it only has to find a single intersection and can exit as soon as it finds the first intersection. False if it must find the closest polygon
dataOut - An array to put the data in for the intersection. Exact format is described by the flags
dataOutFlags - A set of derived-class specific flags describing what data should be included in the output array
Returns:
True if an intersection was found according to the input request
Throws:
NotPickableException - This object has been marked as non pickable, but you decided to try to call the method anyway

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

recomputeBounds

protected abstract void recomputeBounds()
Internal method to recalculate the implicit bounds of this Node. By default the bounds are a point sphere, so derived classes should override this method with something better.


updateBounds

protected void updateBounds()
Update this node's bounds and then call the parent to update it's bounds. Used to propogate bounds changes from the leaves of the tree to the root. A node implementation may decide when and where to tell the parent(s)s that updates are ready.


markBoundsDirty

protected void markBoundsDirty()
Mark this node as having dirty bounds due to it's geometry having changed.


isVisible

protected boolean isVisible()
Check to see if this geometry is making the geometry visible or not. The default implementation always makes it visible, but derived classes may choose not to. For example, there are no valid vertices defined for a set of triangles.

Returns:
true when the geometry is visible

hasTransparency

public boolean hasTransparency()
Check to see if this geometry has anything that could be interpreted as an alpha value. For example a Raster with RGBA values or vertex geometry with 4-component colours for the vertices.

Specified by:
hasTransparency in interface GeometryRenderable
Returns:
true if there is any form of transparency

boundsChanged

public void boundsChanged(NodeUpdateListener l)
                   throws InvalidListenerSetTimingException
Notify the node that you have updates to the node that might alter its bounds.

Parameters:
l - The change requestor
Throws:
InvalidListenerSetTimingException - If called when the node is not live or if called during one of the bounds/data changed callbacks

setBounds

public void setBounds(BoundingVolume b)
               throws InvalidWriteTimingException
Set the bounds to the given explicit value. When set, auto computation of the bounds of this node is turned off. A value of null can be used to clear the current explicit bounds and return to auto computation.

Parameters:
b - The new bounds to use or null to clear
Throws:
InvalidWriteTimingException - An attempt was made to write outside of the NodeUpdateListener callback method

getBounds

public BoundingVolume getBounds()
Get the currently set bounds for this object. If no explicit bounds have been set, then an implicit set of bounds is returned based on the current scene graph state.

Returns:
The current bounds of this object

Aviatrix3D
2.1.0

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