Open Inventor Reference
|
Abstract base class for all shape nodes. More...
#include <Inventor/nodes/SoShape.h>
Public Types | |
enum | TriangleShape { TRIANGLE_STRIP, TRIANGLE_FAN, TRIANGLES, POLYGON } |
This type is used by the triangle shape generation methods (beginShape, etc.) More... | |
Public Member Functions | |
virtual SbBool | affectsState () const |
Overrides default method on SoNode. | |
virtual void | getBoundingBox (SoGetBoundingBoxAction *action) |
Implements bounding box method using virtual computeBBox() method. | |
virtual void | GLRender (SoGLRenderAction *action) |
Implements rendering by rendering each primitive generated by subclass. | |
virtual void | rayPick (SoRayPickAction *action) |
Implements picking along a ray by intersecting the ray with each primitive generated by subclass. | |
virtual void | callback (SoCallbackAction *action) |
Implements primitive generation for all shapes. | |
virtual void | computeBBox (SoAction *action, SbBox3f &box, SbVec3f ¢er)=0 |
Computes bounding box for subclass using information in the given action (which may not necessarily be an SoGetBoundingBoxAction). | |
Static Public Member Functions | |
static void | initClass () |
Initializes base node class. | |
static void | getScreenSize (SoState *state, const SbBox3f &boundingBox, SbVec2s &rectSize) |
This can be used by subclasses when the complexity type is SCREEN_SPACE to determine how many window pixels are covered by the shape. | |
Protected Member Functions | |
SoShape () | |
Constructor. | |
virtual void | generatePrimitives (SoAction *action)=0 |
This method MUST be defined by each subclass to generate primitives (triangles, line segments, points) that represent the shape. | |
virtual SbBool | shouldGLRender (SoGLRenderAction *action) |
Returns TRUE if the shape should be rendered. | |
SbBool | shouldRayPick (SoRayPickAction *action) |
Returns TRUE if the shape may be picked. | |
void | beginSolidShape (SoGLRenderAction *action) |
These can be used by solid shapes to indicate so during rendering. | |
void | endSolidShape (SoGLRenderAction *action) |
void | computeObjectSpaceRay (SoRayPickAction *action) |
Computes a picking ray in the object space of the shape instance. | |
void | computeObjectSpaceRay (SoRayPickAction *action, const SbMatrix &matrix) |
virtual SoDetail * | createTriangleDetail (SoRayPickAction *action, const SoPrimitiveVertex *v1, const SoPrimitiveVertex *v2, const SoPrimitiveVertex *v3, SoPickedPoint *pp) |
These methods are called during picking to create details representing extra info about a pick intersection. | |
virtual SoDetail * | createLineSegmentDetail (SoRayPickAction *action, const SoPrimitiveVertex *v1, const SoPrimitiveVertex *v2, SoPickedPoint *pp) |
virtual SoDetail * | createPointDetail (SoRayPickAction *action, const SoPrimitiveVertex *v, SoPickedPoint *pp) |
void | invokeTriangleCallbacks (SoAction *action, const SoPrimitiveVertex *v1, const SoPrimitiveVertex *v2, const SoPrimitiveVertex *v3) |
These methods invoke whatever callbacks are registered with the primitive generation procedures. | |
void | invokeLineSegmentCallbacks (SoAction *action, const SoPrimitiveVertex *v1, const SoPrimitiveVertex *v2) |
void | invokePointCallbacks (SoAction *action, const SoPrimitiveVertex *v) |
void | beginShape (SoAction *action, TriangleShape shapeType, SoFaceDetail *faceDetail=NULL) |
These methods can be used by subclasses to generate triangles more easily when those triangles are part of a larger structure, such as a triangle strip, triangle fan, or triangulated polygon, according to the TriangleShape enumerated type. | |
void | shapeVertex (const SoPrimitiveVertex *v) |
void | endShape () |
virtual | ~SoShape () |
void | GLRenderBoundingBox (SoGLRenderAction *action) |
Applies GLRender action to the bounding box surrounding the shape. |
This node is the abstract base class for all shape (geometry) nodes. All classes derived from SoShape draw geometry during render traversal.
SoShape::SoShape | ( | ) | [protected] |
virtual SoShape::~SoShape | ( | ) | [protected, virtual] |
void SoShape::beginShape | ( | SoAction * | action, |
TriangleShape | shapeType, | ||
SoFaceDetail * | faceDetail = NULL |
||
) | [protected] |
The sequence of calls is similar to GL's: begin a shape, send vertices of that shape, then end the shape.
If the face detail passed to beginShape() is NULL (the default), the details in the vertices will be used as is. Note that some vertices may be copied into local storage; the detail pointers are copied as well, so the details themselves should be consistent for the duration of the shape generation.
If the face detail passed to beginShape() is non-NULL, the details in the vertices are assumed to be SoPointDetails. Each vertex of each triangle generated will contain a pointer to the face detail, which will be filled with three copies of the point details from the relevant vertices. Since copies of the point details are made, the storage for each point detail passed to shapeVertex() can be re-used by the caller.
void SoShape::beginSolidShape | ( | SoGLRenderAction * | action | ) | [protected] |
They take care of setting up shape hints in the state. Calls to these two methods should bracket the rendering code.
virtual void SoShape::callback | ( | SoCallbackAction * | action | ) | [virtual] |
Calls the generatePrimitives for the shape.
Reimplemented from SoNode.
virtual void SoShape::computeBBox | ( | SoAction * | action, |
SbBox3f & | box, | ||
SbVec3f & | center | ||
) | [pure virtual] |
This is used by getBoundingBox() and when rendering or picking a shape with bounding-box complexity. Subclasses must define this method.
Implemented in SoAsciiText, SoCone, SoCube, SoCylinder, SoFaceSet, SoIndexedNurbsCurve, SoIndexedNurbsSurface, SoIndexedShape, SoLineSet, SoNurbsCurve, SoNurbsSurface, SoPointSet, SoQuadMesh, SoSphere, SoText2, SoText3, and SoTriangleStripSet.
void SoShape::computeObjectSpaceRay | ( | SoRayPickAction * | action | ) | [protected] |
The picking ray is stored in the SoRayPickAction for later access by the subclass. The second form takes a matrix to concatenate with the current transformation matrix. It can be used, for example, if a shape has sizing or positioning info built into it.
void SoShape::computeObjectSpaceRay | ( | SoRayPickAction * | action, |
const SbMatrix & | matrix | ||
) | [protected] |
virtual SoDetail* SoShape::createLineSegmentDetail | ( | SoRayPickAction * | action, |
const SoPrimitiveVertex * | v1, | ||
const SoPrimitiveVertex * | v2, | ||
SoPickedPoint * | pp | ||
) | [protected, virtual] |
Reimplemented in SoIndexedLineSet, and SoLineSet.
virtual SoDetail* SoShape::createPointDetail | ( | SoRayPickAction * | action, |
const SoPrimitiveVertex * | v, | ||
SoPickedPoint * | pp | ||
) | [protected, virtual] |
Reimplemented in SoPointSet.
virtual SoDetail* SoShape::createTriangleDetail | ( | SoRayPickAction * | action, |
const SoPrimitiveVertex * | v1, | ||
const SoPrimitiveVertex * | v2, | ||
const SoPrimitiveVertex * | v3, | ||
SoPickedPoint * | pp | ||
) | [protected, virtual] |
The default methods implemented in SoShape return NULL. Subclasses can override these methods to set up specific detail instances that contain the extra info. Subclasses can get whatever information they need from the SoPickedPoint, and can set information in it as well.
Reimplemented in SoCube, SoFaceSet, SoIndexedFaceSet, SoIndexedTriangleSet, SoIndexedTriangleStripSet, SoQuadMesh, and SoTriangleStripSet.
void SoShape::endShape | ( | ) | [protected] |
void SoShape::endSolidShape | ( | SoGLRenderAction * | action | ) | [protected] |
virtual void SoShape::generatePrimitives | ( | SoAction * | action | ) | [protected, pure virtual] |
Implemented in SoAsciiText, SoCone, SoCube, SoCylinder, SoFaceSet, SoIndexedFaceSet, SoIndexedLineSet, SoIndexedNurbsCurve, SoIndexedNurbsSurface, SoIndexedTriangleSet, SoIndexedTriangleStripSet, SoLineSet, SoNurbsCurve, SoNurbsSurface, SoPointSet, SoQuadMesh, SoSphere, SoText2, SoText3, and SoTriangleStripSet.
virtual void SoShape::getBoundingBox | ( | SoGetBoundingBoxAction * | action | ) | [virtual] |
Subclasses should not need to override this.
Reimplemented from SoNode.
Reimplemented in SoIndexedLineSet, SoIndexedNurbsCurve, SoLineSet, SoNurbsCurve, and SoPointSet.
static void SoShape::getScreenSize | ( | SoState * | state, |
const SbBox3f & | boundingBox, | ||
SbVec2s & | rectSize | ||
) | [static] |
It returns in rectSize the number of pixels in the window rectangle that covers the given 3D bounding box.
virtual void SoShape::GLRender | ( | SoGLRenderAction * | action | ) | [virtual] |
May be overridden in subclass.
Reimplemented from SoNode.
Reimplemented in SoAsciiText, SoCone, SoCube, SoCylinder, SoFaceSet, SoIndexedFaceSet, SoIndexedLineSet, SoIndexedNurbsCurve, SoIndexedNurbsSurface, SoIndexedTriangleSet, SoIndexedTriangleStripSet, SoLineSet, SoNurbsCurve, SoNurbsSurface, SoPointSet, SoQuadMesh, SoSphere, SoText2, SoText3, and SoTriangleStripSet.
void SoShape::GLRenderBoundingBox | ( | SoGLRenderAction * | action | ) | [protected] |
This is used to render shapes when BOUNDING_BOX complexity is on.
static void SoShape::initClass | ( | ) | [static] |
Reimplemented from SoNode.
Reimplemented in SoAsciiText, SoCone, SoCube, SoCylinder, SoFaceSet, SoIndexedFaceSet, SoIndexedLineSet, SoIndexedNurbsCurve, SoIndexedNurbsSurface, SoIndexedShape, SoIndexedTriangleSet, SoIndexedTriangleStripSet, SoLineSet, SoNonIndexedShape, SoNurbsCurve, SoNurbsSurface, SoPointSet, SoQuadMesh, SoSphere, SoText2, SoText3, SoTriangleStripSet, and SoVertexShape.
void SoShape::invokeLineSegmentCallbacks | ( | SoAction * | action, |
const SoPrimitiveVertex * | v1, | ||
const SoPrimitiveVertex * | v2 | ||
) | [protected] |
void SoShape::invokePointCallbacks | ( | SoAction * | action, |
const SoPrimitiveVertex * | v | ||
) | [protected] |
void SoShape::invokeTriangleCallbacks | ( | SoAction * | action, |
const SoPrimitiveVertex * | v1, | ||
const SoPrimitiveVertex * | v2, | ||
const SoPrimitiveVertex * | v3 | ||
) | [protected] |
If primitives are being generated for picking or rendering purposes, the appropriate SoShape methods are called. If primitives are being generated for the SoCallbackAction, the callbacks registered with the action are called.
virtual void SoShape::rayPick | ( | SoRayPickAction * | action | ) | [virtual] |
May be overridden in subclass.
Reimplemented from SoNode.
Reimplemented in SoAsciiText, SoCone, SoCube, SoCylinder, SoIndexedNurbsCurve, SoIndexedNurbsSurface, SoNurbsCurve, SoNurbsSurface, SoSphere, SoText2, and SoText3.
void SoShape::shapeVertex | ( | const SoPrimitiveVertex * | v | ) | [protected] |
virtual SbBool SoShape::shouldGLRender | ( | SoGLRenderAction * | action | ) | [protected, virtual] |
Subclasses can call this in their rendering methods to determine whether to continue.
Reimplemented in SoVertexShape.
SbBool SoShape::shouldRayPick | ( | SoRayPickAction * | action | ) | [protected] |
Subclasses can call this in their picking methods to determine whether to continue.