Open Inventor Release 2023.2.3
 
Loading...
Searching...
No Matches
SoQuadMesh.h
Go to the documentation of this file.
1/*=======================================================================
2 * Copyright 1991-1996, Silicon Graphics, Inc.
3 * ALL RIGHTS RESERVED
4 *
5 * UNPUBLISHED -- Rights reserved under the copyright laws of the United
6 * States. Use of a copyright notice is precautionary only and does not
7 * imply publication or disclosure.
8 *
9 * U.S. GOVERNMENT RESTRICTED RIGHTS LEGEND:
10 * Use, duplication or disclosure by the Government is subject to restrictions
11 * as set forth in FAR 52.227.19(c)(2) or subparagraph (c)(1)(ii) of the Rights
12 * in Technical Data and Computer Software clause at DFARS 252.227-7013 and/or
13 * in similar or successor clauses in the FAR, or the DOD or NASA FAR
14 * Supplement. Contractor/manufacturer is Silicon Graphics, Inc.,
15 * 2011 N. Shoreline Blvd. Mountain View, CA 94039-7311.
16 *
17 * THE CONTENT OF THIS WORK CONTAINS CONFIDENTIAL AND PROPRIETARY
18 * INFORMATION OF SILICON GRAPHICS, INC. ANY DUPLICATION, MODIFICATION,
19 * DISTRIBUTION, OR DISCLOSURE IN ANY FORM, IN WHOLE, OR IN PART, IS STRICTLY
20 * PROHIBITED WITHOUT THE PRIOR EXPRESS WRITTEN PERMISSION OF SILICON
21 * GRAPHICS, INC.
22**=======================================================================*/
23/*=======================================================================
24** Author : Paul S. Strauss (MMM yyyy)
25**=======================================================================*/
26/*=======================================================================
27 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), ***
28 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. ***
29 *** ***
30 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS ***
31 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR ***
32 *** WRITTEN AUTHORIZATION OF FEI S.A.S. ***
33 *** ***
34 *** RESTRICTED RIGHTS LEGEND ***
35 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS ***
36 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN ***
37 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT ***
38 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN ***
39 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. ***
40 *** ***
41 *** COPYRIGHT (C) 1996-2019 BY FEI S.A.S, ***
42 *** BORDEAUX, FRANCE ***
43 *** ALL RIGHTS RESERVED ***
44**=======================================================================*/
45/*=======================================================================
46** Modified by : VSG (MMM YYYY)
47**=======================================================================*/
48
49
50#ifndef _SO_QUAD_MESH_
51#define _SO_QUAD_MESH_
52
55#include <Inventor/SbPImpl.h>
56
58
59
60//
61// Class: SoQuadMesh
62//
63// Shape node with implicit quadrilateral connectivity. The number of
64// vertices in each row and column of the quadMesh is given by the
65// verticesPerRow and verticesPerColumn fields. The current
66// coordinates are taken in order (starting at startIndex) to form
67// the rows of the quadMesh; i.e., the first verticesPerColumn vertices
68// form the first row of the quadMesh, the next verticesPerColumn
69// vertices form the next row, and so on. It is an error if there are
70// not enough coordinates. If materials or normals are bound to
71// vertices, they will begin at startIndex, as well; otherwise, they
72// will start at index 0.
73//
75
159{
161 SO_PIMPL_PUBLIC_HEADER(SoQuadMesh)
162
163public:
164 // Fields
173
178
179private:
181 virtual void GLRender( SoGLRenderAction* action );
182
183 // Generates default normals using the given normal bundle.
184 // Returns TRUE.
185 virtual void generateDefaultNormals( SoState* state,
186 const SbVec3f* coords,
187 int numCoords,
188 SoNormalBundle* nb,
189 SbBool storeRef = FALSE );
190
192 virtual void shouldGenerateTangents( SoGLRenderAction* /*action*/, const SoShapeStyleElement* /*shapeStyle*/ ) {}
193
195 virtual void getPrimitiveCount( SoGetPrimitiveCountAction* action );
196
197private:
198 int getNumRows() const; // returns the number of Rows
199 int getNumCols() const; // returns the number of Columns
200 int getNumQuads() const; // returns the number of Quads
201 int getNumMeshVerts() const; // returns the number of vertices of the Quad Mesh
202
203 // Generic version of Generate default normals
204 void generateDefaultNormals_QuadMesh( SoState* state, const SbVec3f* vecPQuadCoord[], SbVec3f normals[] );
205
206 //Typedef of pointer to method on QuadMesh;
207 //This will be used to simplify declaration and initialization.
208 typedef void (SoQuadMesh::*PMQM)( SoGLRenderAction* );
209
210 static void initClass();
211 static void exitClass();
212
213 // return num vertices
214 virtual int getNumVert( SoState* state = NULL );
215
216 // Blow vpCache when vertexProperty field changes:
217 virtual void notify( SoNotList* list );
218
219 //return number of primitives
220 virtual int getNumPrim( SoState* state = NULL );
221
222private:
223
224 // This enum is used to indicate the current material or normal binding
225 enum Binding {
226 OVERALL,
227 PER_ROW,
228 PER_QUAD,
229 PER_VERTEX
230 };
231 // Generates triangles representing rows
232 virtual void generatePrimitives( SoAction* action );
233
234 //Approx number of primitives
235 virtual void countPrim( SoState* state = NULL );
236
237 // render function
238 void doRendering( SoGLRenderAction* action, const SoShapeStyleElement* shapeStyle );
239
240 // Overrides standard method to create an SoFaceDetail instance
241 virtual SoDetail* createTriangleDetail( SoRayPickAction* action,
242 const SoPrimitiveVertex* v1,
243 const SoPrimitiveVertex* v2,
244 const SoPrimitiveVertex* v3,
245 SoPickedPoint* pp );
246
247 virtual ~SoQuadMesh();
248
249private:
250
251 // Returns current normal binding from action's state
252 Binding getNormalBinding( SoAction* action, SoNormalBundle* nb );
253};
254
255#endif /* _SO_QUAD_MESH_ */
256
#define FALSE
Possible value of SbBool.
Definition SbBase.h:75
SO_PIMPL_PUBLIC_DECLARATION(SoFileDataAdapter)
SoNormalBindingElement::Binding getNormalBinding() const
#define SO_NODE_HEADER(className)
Definition SoSubNode.h:151
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...
Abstract base class for all non-indexed vertex-based shapes.
Represents point on surface of picked object.
Represents a vertex of a generated primitive.
Quadrilateral mesh shape node.
Definition SoQuadMesh.h:159
SoSFInt32 verticesPerColumn
Number of vertices per column.
Definition SoQuadMesh.h:168
SoSFInt32 verticesPerRow
Number of vertices per row.
Definition SoQuadMesh.h:172
SoQuadMesh()
Creates a quadrilateral mesh node with default settings.
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
void notify(SoNotList *list)