Class SoShapeHints
- java.lang.Object
-
- com.openinventor.inventor.Inventor
-
- com.openinventor.inventor.misc.SoBase
-
- com.openinventor.inventor.fields.SoFieldContainer
-
- com.openinventor.inventor.nodes.SoNode
-
- com.openinventor.inventor.nodes.SoShapeHints
-
- All Implemented Interfaces:
SafeDisposable
public class SoShapeHints extends SoNode
Node that provides hints about shapes. By default, Open Inventor assumes very little about the shapes it renders. You can use theSoShapeHints
node to indicate that vertex-based shapes (those derived fromSoVertexShape
) are solid, contain ordered vertices, or contain convex faces. For fastest rendering, specify SOLID, COUNTERCLOCKWISE, CONVEX shapes.These hints allow Open Inventor to optimize certain rendering features. Optimizations that may be performed include enabling back-face culling and disabling two-sided lighting. For example, if an object is solid and has ordered vertices, Open Inventor turns on backface culling and turns off two-sided lighting. If the object is not solid but has ordered vertices, it turns off backface culling and turns on two-sided lighting. In all other cases, both backface culling and two-sided lighting are off.
Summary:-
Two-sided lighting: enabled if not solid and has ordered vertices.
SetvertexOrdering
to COUNTERCLOCKWISE (usually) or CLOCKWISE. -
Backface culling: enabled if solid and has ordered vertices.
SetshapeType
to SOLID.
Note: Two-sided lighting is automatically enabled for VolumeViz "slice" primitives, such as
SoOrthoSlice
andSoVolumeSkin
.This node allows the creation of polygons with holes. See the
windingType
field description,SoIndexedFaceSet
, andSoFaceSet
for details.The
SoShapeHints
node also affects how default normals are generated. When a node derived fromSoVertexShape
has to generate default normals, it uses thecreaseAngle
field to determine which edges should be smooth-shaded and which ones should have a sharp crease. The crease angle is the angle between surface normals on adjacent polygons. For example, a crease angle of .5 radians means that an edge between two adjacent polygonal faces will be smooth shaded if the normals to the two faces form an angle that is less than .5 radians (about 30 degrees). Otherwise, it will be faceted.creaseAngle = 0 creaseAngle = 0.5 creaseAngle = PI Normal averaging creaseAngle
is 0 (the default), producing one normal per facet. However, if a vertex is shared by two (or more) faces that should be faceted, the result of normal generation will be multiple normal vectors (one for each face) associated with that vertex. This is in conflict with using OpenGL Vertex Buffer Objects (VBO), which usually provide the best performance. VBO rendering only allows per-vertex (not per-face) normal vectors and only one normal vector per vertex. Some high-level shapes, likeSoIndexedFaceSet
, will automatically reorganize the geometry data to produce the requested appearance and still use VBOs for rendering. Lower level shapes likeSoBufferedShape
will ignore the creaseAngle field and compute normals using a crease angle of Pi in order to use VBOs for rendering. AcreaseAngle
of Pi produces one averaged normal per vertex.See
SoVertexShape
for more information about Vertex Buffer Objects and shape rendering.File format/default:
ShapeHints {
vertexOrdering UNKNOWN_ORDERING shapeType UNKNOWN_SHAPE_TYPE faceType CONVEX windingType NO_WINDING_TYPE creaseAngle 0 neighborTolerance 1e-6 useVBO true Action behavior:
SoGLRenderAction
,SoCallbackAction
,SoRayPickAction
,SoGetBoundingBoxAction
Sets the state to contain the hints; sets up optimizations based on the hints. Sets:SoShapeHintsElement
,SoCreaseAngleElement
,SoNeighborToleranceElement
- See Also:
SoVertexShape
,SoIndexedFaceSet
,SoFaceSet
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SoShapeHints.FaceTypes
Hints about faces of shape: if all faces are known to be convex or not.static class
SoShapeHints.ShapeTypes
Hints about entire shape: if shape is known to be a solid object, as opposed to a surface.static class
SoShapeHints.VertexOrderings
Hints about ordering of face vertices: if ordering of all vertices of all faces is known to be consistent when viewed from "outside" shape or not.static class
SoShapeHints.WindingTypes
Winding type possible values.-
Nested classes/interfaces inherited from class com.openinventor.inventor.nodes.SoNode
SoNode.RenderModes
-
Nested classes/interfaces inherited from class com.openinventor.inventor.Inventor
Inventor.ConstructorCommand
-
-
Field Summary
Fields Modifier and Type Field Description SoSFFloat
creaseAngle
Indicates the minimum angle (in radians) between two adjacent face normals required to form a sharp crease at the edge when normal vectors are computed automatically by Open Inventor.SoSFEnum<SoShapeHints.FaceTypes>
faceType
Indicates whether each face is convex.SoSFFloat
neighborTolerance
Specifies the tolerance value to use when default normals are computed.SoSFEnum<SoShapeHints.ShapeTypes>
shapeType
Indicates whether the shape is known to enclose a volume (SOLID) or not.SoSFBool
useVBO
This field controls whether subsequent shapes in the scene graph can use OpenGL Vertex Buffer Objects (VBO) to speed up rendering.SoSFEnum<SoShapeHints.VertexOrderings>
vertexOrdering
Indicates how the vertices of faces are ordered.SoSFEnum<SoShapeHints.WindingTypes>
windingType
Indicates the winding rule used to define holes in a polygon.-
Fields inherited from class com.openinventor.inventor.Inventor
VERBOSE_LEVEL, ZeroHandle
-
-
Constructor Summary
Constructors Constructor Description SoShapeHints()
Creates a shape hints node with default settings.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static boolean
isVBOSupported()
Indicates if Vertex Buffer Object (VBO) is supported by your graphics board.-
Methods inherited from class com.openinventor.inventor.nodes.SoNode
affectsState, callback, copy, copy, distribute, doAction, getAlternateRep, getBoundingBox, getByName, getMatrix, getPrimitiveCount, getRenderEngineMode, getRenderUnitID, GLRender, GLRenderBelowPath, GLRenderInPath, GLRenderOffPath, grabEventsCleanup, grabEventsSetup, handleEvent, isBoundingBoxIgnoring, isOverride, pick, rayPick, search, setOverride, touch, write
-
Methods inherited from class com.openinventor.inventor.fields.SoFieldContainer
copyFieldValues, copyFieldValues, enableNotify, fieldsAreEqual, get, getAllFields, getEventIn, getEventOut, getField, getFieldName, hasDefaultValues, isNotifyEnabled, set, setToDefaults
-
Methods inherited from class com.openinventor.inventor.misc.SoBase
dispose, getName, isDisposable, isSynchronizable, setName, setSynchronizable
-
Methods inherited from class com.openinventor.inventor.Inventor
getNativeResourceHandle
-
-
-
-
Field Detail
-
vertexOrdering
public final SoSFEnum<SoShapeHints.VertexOrderings> vertexOrdering
Indicates how the vertices of faces are ordered. CLOCKWISE ordering means that the vertices of each face form a clockwise loop around the face, when viewed from the outside (the side toward which the normal points). Use enumVertexOrdering
. Default is UNKNOWN_ORDERING.
-
shapeType
public final SoSFEnum<SoShapeHints.ShapeTypes> shapeType
Indicates whether the shape is known to enclose a volume (SOLID) or not. If the inside (the side away from the surface normal) of any part of the shape is visible, the shape is not solid. Use enumShapeType
. Default is UNKNOWN_SHAPE_TYPE.
-
faceType
public final SoSFEnum<SoShapeHints.FaceTypes> faceType
Indicates whether each face is convex. Because the penalty for non-convex faces is very steep (faces must be triangulated expensively), the default assumes all faces are convex. Therefore, shapes with concave faces may not be displayed correctly unless this hint is set to UNKNOWN_FACE_TYPE. Use enumFaceType
. Default is CONVEX.
-
windingType
public final SoSFEnum<SoShapeHints.WindingTypes> windingType
Indicates the winding rule used to define holes in a polygon. It is used bySoIndexedFaceSet
andSoFaceSet
to determine which parts of the polygon are on the interior and which are on the exterior and should not be filled. By default this field value is NO_WINDING_TYPE, that is, no winding rules are used, so there are no holes. Use enumWindingType
.For a single contour, the winding number of a point is the signed number of revolutions we make around that point while traveling once around the contour (where a counterclockwise revolution is positive and a clockwise revolution is negative). When there are several contours, the individual winding numbers are summed. This procedure associates a signed integer value with each point in the plane. Note that the winding number is the same for all points in a single region.
The following figure shows three sets of contours and winding numbers for points inside those contours. In the left set, all three contours are counterclockwise, so each nested interior region adds one to the winding number. For the middle set, the two interior contours are drawn clockwise, so the winding number decreases and actually becomes negative.
NOTE: In LINES drawing style (see
SoDrawStyle
), ifwindingType
is not NO_WINDING_TYPE, or iffaceType
is UNKNOWN_FACE_TYPE, the edges of the tessellated triangles will be drawn.- Since:
- Open Inventor 4.0
-
useVBO
public final SoSFBool useVBO
This field controls whether subsequent shapes in the scene graph can use OpenGL Vertex Buffer Objects (VBO) to speed up rendering. Default is true (since Open Inventor 8.1). The default value can be set using the OIV_FORCE_USE_VBO environment variable (seeSoPreferences
).In most cases there is no reason to set this field. Open Inventor will automatically choose the best rendering strategy. For example, VBOs generally provide the best performance for large shapes (many vertices), but not necessarily for small shapes. In specific cases it may be useful to influence these decisions using this field and/or the related environment variables including OIV_MIN_VERTEX_VBO and OIV_MIN_VERTEX_VAVBO_NOCACHE. See
SoVertexShape
for more discussion about shape rendering strategy.- Since:
- Open Inventor 5.0
-
creaseAngle
public final SoSFFloat creaseAngle
Indicates the minimum angle (in radians) between two adjacent face normals required to form a sharp crease at the edge when normal vectors are computed automatically by Open Inventor. It has no effect when normal vectors are explicitly provided by the application.
-
neighborTolerance
public final SoSFFloat neighborTolerance
Specifies the tolerance value to use when default normals are computed. The default is 1e-6.Specifically it determines which (other) points in the shape are close enough to influence the normal at each vertex. Setting a smaller tolerance value will select a smaller number of points and can reduce the time required for computing normals on very large, very dense geometry.
If the OIV_NORMGEN_TOLERANCE environment variable is set, the default is 1/OIV_NORMGEN_TOLERANCE.
- Since:
- Open Inventor 8.0
-
-