Open Inventor Release 2023.2.3
 
Loading...
Searching...
No Matches
SoBufferedShape.h
Go to the documentation of this file.
1/*=======================================================================
2 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), ***
3 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. ***
4 *** ***
5 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS ***
6 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR ***
7 *** WRITTEN AUTHORIZATION OF FEI S.A.S. ***
8 *** ***
9 *** RESTRICTED RIGHTS LEGEND ***
10 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS ***
11 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN ***
12 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT ***
13 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN ***
14 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. ***
15 *** ***
16 *** COPYRIGHT (C) 1996-2022 BY FEI S.A.S, ***
17 *** BORDEAUX, FRANCE ***
18 *** ALL RIGHTS RESERVED ***
19**=======================================================================*/
20/*=======================================================================
21** Author : VSG (MMM YYYY)
22**=======================================================================*/
23#if !defined SOBUFFEREDSHAPE_H
24#define SOBUFFEREDSHAPE_H
25
34
37
39
41
42#include <Inventor/SbPImpl.h>
43
44
46class SoAction;
47
49
50
402{
404 SO_PIMPL_PUBLIC_HEADER(SoBufferedShape)
405
406 // ----------------------- Public usage --------------------------------------
407
408public:
409
454
458 enum Usage
459 {
468 DYNAMIC
469 };
470
475
490
506
514
528
534
553
561
567
573
585
591
599
605
617
623
631
639
645
653
659
671
677
683
691
697
709
715
721
722private:
728 virtual void GLRender(SoGLRenderAction *action );
729
735 virtual void getBoundingBox( SoGetBoundingBoxAction *action );
736
740 virtual void computeBBox( SoAction *action, SbBox3f &box, SbVec3f &center );
741
745 virtual void computeBBox(SoAction *action, SbXfBox3d &box, SbVec3d &center);
746
752 virtual void rayPick(SoRayPickAction *action );
753
759 virtual void getPrimitiveCount(SoGetPrimitiveCountAction *action );
760
761// ----------------------- Private usage -------------------------------------
762// INTERNAL
763private:
764
766 static void initClass();
767
769 static void exitClass();
770
771 void notify( SoNotList* list );
772
773 int getNumPrim( SoState* state = NULL );
774
775 // ----------------------- Protected usage -------------------------------------
776
777private:
778
780 virtual ~SoBufferedShape();
781
782 virtual SbBool shouldCheckShapeHints();
783
784 virtual SbBool shouldGLRender( SoGLRenderAction *action, SbBool isPointsOrLines = FALSE );
785
795 virtual SbBool isLightingUsable( const void* normalBufferPtr );
796
800 virtual SbBool isTransparent(SoState* state) const;
801
802 virtual void generatePrimitives( SoAction *action );
803
804
810 virtual void GLRenderBoundingBox( SoGLRenderAction *action );
811
812 // Overrides standard method to create an SoFaceDetail instance
813 virtual SoDetail* createTriangleDetail( SoRayPickAction *action,
814 const SoPrimitiveVertex *v1,
815 const SoPrimitiveVertex *v2,
816 const SoPrimitiveVertex *v3,
817 SoPickedPoint *pp );
818
819 virtual SoDetail* createLineSegmentDetail( SoRayPickAction *action,
820 const SoPrimitiveVertex *v1,
821 const SoPrimitiveVertex *v2,
822 SoPickedPoint *pp );
823
824 virtual SoDetail* createPointDetail( SoRayPickAction *action,
825 const SoPrimitiveVertex *v,
826 SoPickedPoint *pp );
827
828 //Transforms the polygons into lines before rendering them.
829 //It can be used if :
830 //- shapeStyle = TRIANGLE, TRIANGLE_STRIP, TRIANGLE_FAN, TRIANGLES, QUAD_STRIP, QUADS or POLYGON
831 //- SoDrawStyle::style = LINES
832 // ----------------------- Private usage -------------------------------------
833private:
835 void commonConstructor();
836
840 unsigned int computeSmallestBatchSize(const SoNodeList* vertexAttribsList, unsigned int numInstances);
841
842 //In some cases primitives need to be transformed to POINTS to have a correct rendering
843 //with POINTS as drawStyle.
844 bool arePointsNeededAsPrimitives( SoDrawStyleElement::Style drawStyle ) const;
845
846 template< class T > void computeBBoxTemplate_POINTS( SoAction *action, SbBox3f &box, SbVec3f &center );
847
848 template< class T > void computeBBoxTemplate( SoAction *action, SbBox3f &box, SbVec3f &center, const SbVec2d &psize );
849
850 template< class T > void computeBBoxTemplateSP( SoAction *action, SbBox3f &box, SbVec3f &center, const SbVec2d &psize );
851
852 template< class T, int MODE > void computeBBoxTemplate_( SoAction *, SbBox3f &box, SbVec3f &center, const SbVec2d &pSize );
853
854 //A GL context must exist to use this method.
855 bool isRenderExtraDataNeededInCurrentContext() const;
856
857 //A GL context must exist to use this method.
858 bool isRenderExtraDataNeededByGraphicCardInCurrentContext() const;
859
860 //For some shapeType values, the render extra data process must be launched ( without considering
861 //OIV_SHAPES_PRIMITIVES_OPTIM ) in order to have a correct rendering with LINES as drawStyle.
862 bool isRenderExtraDataNeededByShapeType() const;
863
864 //Some graphic cards has bad performance when glPolygonMode is used to render the
865 //shape with LINES as draw style.
866 //
867 //Returns true if the polygons must be transformed in lines before rendering them.
868 static bool isRenderExtraDataNeededByGraphicCard( const SbString& graphicCardName );
869};
870
871//------------------------------------------------------------------------------
872
873#endif // SOBUFFEREDSHAPE_H
874
#define FALSE
Possible value of SbBool.
Definition SbBase.h:75
SO_PIMPL_PUBLIC_DECLARATION(SoFileDataAdapter)
#define SO_NODE_HEADER(className)
Definition SoSubNode.h:151
3D box class.
Definition SbBox.h:649
Class for smart character strings.
Definition SbString.h:202
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> 2D vector class ...
Definition SbVec.h:314
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> 3D vector class ...
Definition SbVec.h:1214
3D vector class.
Definition SbVec.h:932
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> 3D box with an a...
Definition SbBox.h:1513
Abstract base class for all actions.
Definition SoAction.h:132
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Node to render g...
Usage
This enum is used to set the shapeUsage field.
@ STATIC
The shape is static, its buffers are never modified or modified infrequently.
SoSFEnum shapeUsage
Defines the usage of the shape.
SoSFEnum colorComponentsType
SbDataType::DataType type for the color values.
SoSFEnum vertexComponentsType
SbDataType::DataType for vertices.
SoSFShort vertexComponentsCount
Number of components in each vertex.
SoMFEnum texCoordsComponentsType
SbDataType::DataType type for the texture coordinates.
SoMFInt32 numVertices
Total number of vertices/indices or number of vertices/indices to be used per primitive.
SoMFInt32 texCoordsComponentsCount
Number of components in each texture coordinate.
SoSFBufferObject normalBuffer
Buffer object that contains the (optional) normal vectors.
SoMFBufferObject texCoordsBuffer
Buffer objects that contains the (optional) texture coordinates.
SoSFEnum normalComponentsType
SbDataType::DataType type for the normal vectors.
Type
Type of shape that will be rendered.
@ POINTS
Draws each vertex as a single point.
@ QUAD_STRIP
Draws a strip of connected quadrilaterals.
@ TRIANGLE_STRIP
Draws a strip of connected triangles.
@ LINE_LOOP
Like LINE_STRIP, but an extra line segment is drawn connecting the last vertex to the first vertex.
@ TRIANGLES
Draws unconnected triangles.
@ TRIANGLE_FAN
Draws a fan of triangles.
@ QUADS
Draws unconnected quadrilaterals.
@ LINE_STRIP
Connects all the vertices to form a polyline.
@ LINES
Connects each pair of vertices with a line.
SoSFInt32 primitiveRestartValue
Index value for the primitive restart feature.
SoSFBufferObject vertexBuffer
Buffer object that contains the vertex data.
SoBufferedShape()
Default constructor.
SoSFBufferObject colorBuffer
Buffer object that contains the (optional) color values.
SoSFShort vertexStride
Stride in bytes between the first component of two consecutive vertices.
SoSFInt32 colorStride
Stride in bytes between the first component of two consecutive colors.
SoSFEnum shapeType
Shape type to render.
SoSFInt32 indexOffset
Offset in bytes to the first index in the buffer.
SoSFBool primitiveRestartEnabled
Enable/disable the primitive restart feature.
SoSFInt32 normalOffset
Offset in bytes to the first normal vector in the buffer.
SoSFInt32 vertexOffset
Offset in bytes to the first vertex within the buffer.
SoSFBufferObject indexBuffer
Buffer object that contains the (optional) indices.
SoSFInt32 colorComponentsCount
Number of components in each color value.
SoSFInt32 colorOffset
Offset in bytes to the first color value in the buffer.
SoSFShort normalStride
Stride in bytes between the first component of two consecutive normals.
SoMFInt32 texCoordsStride
Stride in bytes between the first component of two consecutive texture coordinates.
SoSFBool useNormalsGenerator
Indicates if the node should use the internal normal vector generator if no normals are defined.
SoSFEnum indexType
SbDataType::DataType type for the indices.
SoMFInt32 texCoordsOffset
Offset in bytes to the first texture coordinate in the buffer.
Base class for describing detail information about a shape node.
Definition SoDetail.h:99
Style
These are the available draw styles.
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> OpenGL buffer ob...
Renders a scene graph using Open Inventor's Render Engine.
Computes bounding box of a scene.
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Counts number of...
Multiple-value field containing any number of buffer objects.
Multiple-value field containing any number of enumerated type values.
Definition SoMFEnum.h:95
Multiple-value field containing any number of int32_t integers.
Definition SoMFInt32.h:88
Maintains a list of pointers to nodes.
Definition SoNodeList.h:74
Represents point on surface of picked object.
Represents a vertex of a generated primitive.
Intersects objects with a ray cast into scene.
Field containing a single Boolean value.
Definition SoSFBool.h:79
Field containing an enumerated value.
Definition SoSFEnum.h:89
Field containing a int32_t integer.
Definition SoSFInt32.h:80
Field containing a short integer.
Definition SoSFShort.h:81
Abstract base class for all shape nodes.
Definition SoShape.h:115
Traversal state.
Definition SoState.h:74
int SbBool
Boolean type.
Definition SbBase.h:87
void notify(SoNotList *list)