Open Inventor Release 2024.2.1
 
Loading...
Searching...
No Matches
SoIndexedQuadMesh.h
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-2019 BY FEI S.A.S, ***
17 *** BORDEAUX, FRANCE ***
18 *** ALL RIGHTS RESERVED ***
19**=======================================================================*/
20/*=======================================================================
21** Author : Thierry Dufour (Nov 2002)
22**=======================================================================*/
23
24#ifndef _SO_INDEXED_QUAD_MESH_
25#define _SO_INDEXED_QUAD_MESH_
26
27#include <Inventor/fields/SoSFInt32.h>
28#include <Inventor/nodes/SoIndexedShape.h>
29#include <Inventor/SbPImpl.h>
30
31SO_PIMPL_PUBLIC_DECLARATION(SoIndexedQuadMesh)
32
33
34//
35// Class: SoIndexedQuadMesh
36//
37// Shape node with implicit quadrilateral connectivity. The number of
38// vertices in each row and column of the quadMesh is given by the
39// verticesPerRow and verticesPerColumn fields. The current
40// coordinates are taken in order (starting at startIndex) to form
41// the rows of the quadMesh; i.e., the first verticesPerColumn vertices
42// form the first row of the quadMesh, the next verticesPerColumn
43// vertices form the next row, and so on. It is an error if there are
44// not enough coordinates. If materials or normals are bound to
45// vertices, they will begin at startIndex, as well; otherwise, they
46// will start at index 0.
47//
49
137{
138 SO_NODE_HEADER(SoIndexedQuadMesh);
139 SO_PIMPL_PUBLIC_HEADER(SoIndexedQuadMesh)
140
141public:
142 // Fields
151
156
157private:
158 // Implement actions
159 virtual void GLRender( SoGLRenderAction* action );
160
161 // Generates default normals using the given normal bundle.
162 // Returns TRUE.
163 virtual void generateDefaultNormals( SoState* state,
164 const SbVec3f* coords,
165 int numCoords,
166 SoNormalBundle* nb,
167 SbBool storeRef = FALSE );
168
170 virtual void shouldGenerateTangents( SoGLRenderAction* /*action*/, const SoShapeStyleElement* /*shapeStyle*/ ) {}
171
172 virtual void getPrimitiveCount( SoGetPrimitiveCountAction* action );
173
174private:
175 int getNumRows() const; // returns the number of Rows
176 int getNumCols() const; // returns the number of Columns
177 int getNumQuads() const; // returns the number of Quads
178 int getNumMeshVerts() const; // returns the number of vertices of the Quad Mesh
179
180
181 // Generic version of Generate default normals
182 void generateDefaultNormals_QuadMesh( SoState* state, const SbVec3f* vecPQuadCoord[], SbVec3f normals[] );
183
184 static void initClass();
185 static void exitClass();
186
187 // Blow vpCache when vertexProperty field changes:
188 virtual void notify( SoNotList* list );
189
190 //return number of primitives
191 virtual int getNumPrim( SoState* state = NULL );
192
193private:
194 // This enum is used to indicate the current material or normal binding
195 enum Binding {
196 OVERALL,
197 PER_ROW, PER_ROW_INDEXED,
198 PER_QUAD, PER_QUAD_INDEXED,
199 PER_VERTEX, PER_VERTEX_INDEXED
200 };
201 // Generates triangles representing rows
202 virtual void generatePrimitives( SoAction* action );
203
204 // Overrides standard method to create an SoFaceDetail instance
205 virtual SoDetail* createTriangleDetail( SoRayPickAction* action,
206 const SoPrimitiveVertex* v1,
207 const SoPrimitiveVertex* v2,
208 const SoPrimitiveVertex* v3,
209 SoPickedPoint* pp );
210
211 virtual void callSetupIndices( SoState* state, const SoShapeStyleElement* shapeStyle, uint32_t useTexCoordsAnyway );
212
213 //Approx number of primitives
214 virtual void countPrim( SoState* state = NULL );
215
216 // render function
217 void doRendering( SoGLRenderAction* action, const SoShapeStyleElement* shapeStyle );
218
219 virtual ~SoIndexedQuadMesh();
220
221private :
222
223 // Returns current normal binding from action's state
224 SoIndexedQuadMesh::Binding getNormalBinding( SoAction* action, SoNormalBundle* nb );
225};
226
227
228#endif /* _SO_INDEXED_QUAD_MESH_ */
229
230
3D vector class.
Definition SbVec.h:932
Abstract base class for all actions.
Definition SoAction.h:132
Base class for describing detail information about a shape node.
Definition SoDetail.h:99
Renders a scene graph using Open Inventor's Render Engine.
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Counts number of...
Indexed quadrilateral mesh shape node.
SoSFInt32 verticesPerRow
Number of vertices per row.
SoIndexedQuadMesh()
Creates an indexed quadrilateral mesh node with default settings.
SoSFInt32 verticesPerColumn
Number of vertices per column.
Abstract base class for all indexed vertex-based shapes.
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 int32_t integer.
Definition SoSFInt32.h:80
Stores some information used by shapes.
Traversal state.
Definition SoState.h:74
int SbBool
Boolean type.
Definition SbBase.h:87