Draw Modes
Overview
The HOOPS Web Viewer component supports several different ways to draw the scene called “Draw Modes”. Only one of them can be active at a given time. To activate a specific draw mode call the setDrawMode() function on the view object:
hwv.view.setDrawMode(Communicator.DrawMode.Shaded);
The following draw modes are currently supported:
Gooch
HiddenLine
Shaded
Toon
Wireframe
WireframeOnShaded
XRay
Visit the DrawMode entry in our API Reference Manual for more details.
Selecting one of those draw modes renders the scene with either faces and lines turned on, faces only or lines only. It is an easy way to turn off visibility of faces and lines for the whole model. Alternatively you can also use the functions view.setLineVisibility() and view.setFaceVisibility() to control this behavior. The code below turns on Wireframe mode meaning that only the lines in the model are displayed:
hwv.view.setDrawMode(Communicator.DrawMode.Wireframe);
Wireframe draw mode on
Hard edge detection
A hard edge detection algorithm is enabled by default. This new algorithm will cause hidden line mode to look different than previous versions. A new set of functions have been added to the View class to control this new behavior.
setHardEdgesEnabled(), getHardEdgesEnabled()
setHardEdgeColor(), getHardEdgeColor()
setHardEdgeOpacity(), getHardEdgeOpacity()
setHardEdgeThreshold(), getHardEdgeThreshold()
setHardEdgeThresholdRampWidth(), getHardEdgeThresholdRampWidth()
Default - hard edges on:
Hard edges off
X-ray
The purpose of X-ray mode is to make it easy to identify selected elements in a complex scene by turning the whole model except for the selected elements transparent. In the below example the selected part is inside the model and would normally just be displayed as an outline. With X-ray mode however the selected part is fully displayed without completely hiding the rest of the model.
X-ray mode on
Below are the API functions to control various aspects of X-ray mode:
view.setXRayColor()
view.setXRayOpacity()
view.setXRayTransparencyMode()
As an example, let’s change the opacity of the unselected lines to fully opaque:
hwv.view.setXRayOpacity(1, Communicator.ElementType.Lines);
X-ray mode on with opaque unselected lines