Class SoHaloHighlightRenderAction
SoHaloHighlightRenderAction
is a render action which renders the specified scene graph, then renders a "halo" highlight around each selected object. See the images below for examples of this highlight technique. Halo highlighting works with all kinds of shapes including VolumeViz and MeshVizXLM. However, if a selected object does not write to the depth buffer for any reason, it will not be highlighted.
Selected objects are specified by the first selection node (SoSelection
or SoExtSelection
) node in the scene to which this action is applied. If there is no selection node in the scene graph, then no objects will be highlighted.
The application must explicitly tell Open Inventor to use a highlight render action in place of the default SoGLRenderAction
in the SoSceneManager
class using the setGLRenderAction() method. The viewer classes provide a convenience setGLRenderAction() method that calls SoSceneManager
(see e.g.
invalid reference
SoWinRenderArea
For convenience, the viewer classes also provide the redrawOnSelectionChange() method. This method attaches a sensor to the specified selection node and automatically schedules a redraw if the set of selected objects is modified.
Here is an example of an SoAlgebraicCone
highlighted with an SoHaloHighlightRenderAction
:
Here are parameters that can be adjusted:
- The halo color: see
setHaloColor()
- The halo width: see
setHaloWidth()
- The halo attenuation factor: see
setHaloSmoothFactor()
- Whether or not the halo can be seen through scene objects: see
setHaloAlwaysVisible()
NOTES
- The rendering of the halo uses the depth buffer of the selected shapes as its boundary.
- Increasing the halo width value decreases performance.
- When multiple objects are selected, they are highlighted as one unique shape, i.e. the halo is done on the union of their depth buffer. This is illustrated on the following image:
2 selected objects are highlighted as one EXAMPLE Here is an example of how a halo highlight can be specified for a particular selection node and render area:
// Viewer ViewerExaminer viewer = new ViewerExaminer(); // Set the highlight render action final RenderArea area = viewer.getRenderArea(); area.setGLRenderAction( new SoHaloHighlightRenderAction() ); // Scene graph SoSelection selectionNode = new SoSelection(); // Request automatic redraw when selection changes selectionNode.addChangeCallback(new SoSelectionClassCB() { public void invoke(SoSelection s) { area.scheduleRedraw(); } }); . . . viewer.setSceneGraph( selectionNode );
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class com.openinventor.inventor.actions.SoGLRenderAction
SoGLRenderAction.AbortCodes, SoGLRenderAction.AutoCacheModes, SoGLRenderAction.FastEditSavePolicies, SoGLRenderAction.InvalidateCacheModes, SoGLRenderAction.TransparencyTypes
Nested classes/interfaces inherited from class com.openinventor.inventor.actions.SoAction
SoAction.AppliedCodes, SoAction.DistribModes, SoAction.PathCodes, SoAction.PathIndices
Nested classes/interfaces inherited from class com.openinventor.inventor.Inventor
Inventor.ConstructorCommand
-
Field Summary
Fields inherited from class com.openinventor.inventor.Inventor
VERBOSE_LEVEL, ZeroHandle
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
enableElement
(Class<? extends Inventor> t, int stkIndex) SeesetHaloColor()
float
int
SeesetHaloWidth()
boolean
void
setHaloAlwaysVisible
(boolean alwaysVisible) Defines whether or not the halo can be seen through objects that are placed in front of selected shapes.void
setHaloColor
(SbColor color) Defines the color of the highlight.void
setHaloSmoothFactor
(float smoothFactor) Defines the amount of alpha attenuation of the halo contour.void
setHaloWidth
(int width) Defines the width of the halo in pixels.Methods inherited from class com.openinventor.inventor.actions.SoHighlightRenderAction
isVisible, setVisible
Methods inherited from class com.openinventor.inventor.actions.SoGLRenderAction
abortNow, enableDepthPeeling3D, generateCacheContext, getCache, getCacheContext, getCurPass, getDecimationPercentage, getDecimationType, getDelayedObjDepthWrite, getDepthPeelingPass, getFastEditSavePolicy, getFrameCounter, getInvalidateCacheMode, getLogicalViewportRegion, getNumPasses, getRenderingIsRemote, getSortedLayersNumPasses, getTransparencyType, getUpdateArea, getViewportRegion, handleTransparency, handleTransparency, handleTransparency, isAlphaTest, isDoingDepthPeeling, isPassUpdate, isSmoothing, isSortedLayersSupported, isSortedLayersSupported, isUsedCacheContext, resetFrameCounter, resetFrameCounter, setAlphaTest, setCache, setCacheContext, setDecimationValue, setDecimationValue, setDelayedObjDepthWrite, setFastEditSavePolicy, setFastEditSavePolicy, setInvalidateCacheMode, setLogicalViewportRegion, setNumPasses, setPassCallback, setPassCallback, setPassUpdate, setRenderingIsRemote, setSmoothing, setSortedLayersNumPasses, setTransparencyType, setUpdateArea, setViewportRegion, shouldAutoCache
Methods inherited from class com.openinventor.inventor.actions.SoAction
apply, apply, clearApplyResult, forwardTraversal, forwardTraversal, getContinueActionInBranchFlag, getCurPath, getDistribMode, getNodeAppliedTo, getOriginalPathListAppliedTo, getPathAppliedTo, getPathCode, getPathListAppliedTo, getPipeId, getSceneManager, getState, getWhatAppliedTo, hasTerminated, invalidateState, isBeingApplied, isLastPathListAppliedTo, isUsingAlternateRep, nullAction, postDelayedTraversal, preDelayedTraversal, resetContinueActionInBranchFlag, setPipeId, setSceneManager, setUpState, stopActionInBranch, traverse, useAlternateRep
Methods inherited from class com.openinventor.inventor.Inventor
dispose, getNativeResourceHandle
-
Constructor Details
-
SoHaloHighlightRenderAction
public SoHaloHighlightRenderAction() -
SoHaloHighlightRenderAction
-
-
Method Details
-
setHaloColor
Defines the color of the highlight. Default is red (1,0,0).Here are examples of halo highlighting with different colors:
Red Green Blue -
setHaloSmoothFactor
public void setHaloSmoothFactor(float smoothFactor) Defines the amount of alpha attenuation of the halo contour. Default is 0. The value will be clamped between 0 and 1.The following images shows an example of halo highlighting with different values for the smooth factor:
smoothFactor = 0 smoothFactor = 0.33 smoothFactor = 0.66 smoothFactor = 1 -
getHaloColor
SeesetHaloColor()
-
setHaloAlwaysVisible
public void setHaloAlwaysVisible(boolean alwaysVisible) Defines whether or not the halo can be seen through objects that are placed in front of selected shapes. Default is false.The following images shows an example of halo highlighting with alwaysVisible set to false and true:
alwaysVisible = false alwaysVisible = true -
isHaloAlwaysVisible
public boolean isHaloAlwaysVisible() -
getHaloSmoothFactor
public float getHaloSmoothFactor() -
setHaloWidth
public void setHaloWidth(int width) Defines the width of the halo in pixels. Default is 3.Only values greater or equal to 1 are accepted. If a value of 0 or lower is given, the effective value will be clamped to 1.
The following images shows an example of halo highlighting with different values for the halo width:
width = 1 width = 3 width = 7 width = 15 -
getHaloWidth
public int getHaloWidth()SeesetHaloWidth()
-
enableElement
-