Open Inventor Release 2023.2.3
 
Loading...
Searching...
No Matches
PoMesh.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-2014 BY FEI S.A.S, ***
17 *** BORDEAUX, FRANCE ***
18 *** ALL RIGHTS RESERVED ***
19**=======================================================================*/
20/*=======================================================================
21** Author : VSG (MMM YYYY)
22**=======================================================================*/
23
24#ifndef _PO_MESH_
25#define _PO_MESH_
26
41
46
47#include <Inventor/STL/vector>
48
49#ifdef _WIN32
50#pragma warning(push)
51#pragma warning(disable:4251)
52#endif
53
54class PbMesh;
55class PbDataMapping;
56class PiContouringLines;
57class PiContouringFilled;
58class PiTextureContouring;
59class PoCellFilter;
60
110class PoMesh : public Po3DdataMaster {
111
113
114 public:
115
116 /* Fields */
117
126
139
146
157
158
159
220
227
235
247
248
249 /* Set Methods */
250
254 void setMesh(PbMesh *mesh);
255
260 void setDataMapping( PbDataMapping *data_mapping);
261
266 void setModuleDataMapping( PbDataMapping *mod_data_mapping);
267
273 void setIsovaluesList(PbIsovaluesList *isovalues_list);
274
275
276
277 /* Get Methods */
278
282 const PbMesh * getMesh() const;
283
288
294
299
300 /*----------------------------------------------------------------------------*/
301
302
303 private:
304 static void initClass() ;
305 static void exitClass() ;
306
307 const PoCellFilter* getCellFilter() const;
308
309 void push_back_value(float v) {
310 if (m_numValues == m_allocPointValues) {
311 m_allocPointValues *= 2;
312 m_pointValues = (float *)realloc(m_pointValues, m_allocPointValues*sizeof(float));
313 }
314 m_pointValues[m_numValues] = v;
315 m_numValues++;
316 }
317 void push_back_coord_index(int32_t id) {
318 m_coordIndexArray.push_back(id);
319 }
320 void push_back_cell_index(int32_t id) {
321 m_cellIndexArray.push_back(id); //add(id);
322 }
323
324 void update_coord_index(SoIndexedShape *shape) {
325 SoMFInt32 *coord_index = &(shape->coordIndex);
326 if (m_coordIndexArray.size() == 0)
327 coord_index->setNum(0);
328 else
329 coord_index->setValuesPointer((int)m_coordIndexArray.size(),&*(m_coordIndexArray.begin()));
330 }
331
335 virtual size_t getMemorySize();
336
340 static size_t getClassMemorySize();
341
342
343 private:
344 // Constructor
345 PoMesh() ;
346 // Destructor
347 virtual ~PoMesh() ;
348
349 void clearOivNodes();
350 virtual SbBool setUpConnections(SbBool onOff, SbBool doItAlways = FALSE) ;
351 virtual void basicObjectChange(PbBase *basicObj);
352 virtual void setDefaultOnNonWritingFields();
353 virtual void addElementsAllCaches() ;
354 virtual void preRebuild();
355 virtual void postRebuild() ;
356 virtual void insertDefaultShapeHints();
357
358 // list of isovalues
359 int TAllocAdjIsovalues;
360 int TAdjNumIsovalues;
361 float *TAdjIsovalues;
362 int TIsovalAdj;
363
364 void adjustIsovalList (int num_v0, const float* v0,
365 int num_v1, const float* v1,
366 int num_v2, const float* v2 );
367 void adjustIsoval (int num_values, const float *values, float &iso_value);
368 void adjustIsovalMultiple (int num_v0, const float* v0,
369 int num_v1, const float* v1,
370 int num_v2, const float* v2,
371 float &iso_value);
372
373
374 SbVec3f *newSbVec3f(int numVec3f) ;
375
376 // Coordinates
377 SoCoordinate3 *meshCoordinates;
378
379 // Material
380 SoMaterial *meshMaterial;
381 SoMaterialBinding *m_materialBinding;
382 SbBool m_meshMaterialJustAllocated;
383
384 // shape
385 SoShape *m_shape;
386
387 // normals
388 SoNormal *m_normal;
389 SoNormalBinding *m_normalBinding;
390
391 // Textures data for texture contouring
392 SoTextureCoordinate2 *m_meshTexCoordinates ;
393 SbBool m_meshTexCoordinatesJustAllocated;
394 SoTexture2 *m_meshTexture ;
395 SoTextureCoordinateBinding *m_textureBinding;
396
397 SoGroup *groupNode;
398 SoShapeHints *shapeHints;
399
400
401 PiTextureContouring *m_textureContouring ;
402 PiContouringFilled *contouringFilled;
403 PiContouringLines *contouringLines;
404
405 // default dataMapping (linear)
406 PbLinearDataMapping defDataMapping;
407
408 static int m_numPoints;
409 static int m_allocPoints;
410 static float (*m_points)[3];
411 static int m_numValues;
412 static int m_allocPointValues;
413 static float *m_pointValues;
414
415 std::vector< int > m_coordIndexArray;
416 std::vector< int > m_cellIndexArray;
417
418 const PbDataMapping *dataMapping; // data mapping used by rebuild()
419 const PbDataMapping *m_moduleDataMapping; // module data mapping used by rebuild()
420 const PbIsovaluesList *isovaluesList; // isovalues list used by rebuild()
421
422 const PbMesh *m_mesh; // mesh used by derived Po classes
423 ColoringType m_coloringType; // coloringType used by derived Po classes
424 SbBool m_isVertexBinding; // TRUE if PER_VERTEX, FALSE if PER_FACE binding
425 const float *m_mappedValues; // dataset used to map color onto shape
426 std::vector< int > m_cellIds; // cell ids used for per_cell data
427
428 void addDataMappingInCache();
429 void addIsovaluesListInCache(SbBool alwaysAdd=FALSE);
430
431 void mapColor(int num_val=0, const float *from_values=NULL,
432 SbBool newMat=TRUE);
433 void computeNormal(SoIndexedShape *shape, SoCoordinate3 *coord);
434
435 // some member giving info about the last built
436 uint32_t m_geometryId; // State of the geometry used by the last rebuilt
437 uint32_t m_topologyId; // State of the topology used by the last rebuilt
438 int m_mappedDataSetIndex; // index of data set used for color map at last built
439 uint32_t m_mappedDataSetId; // State of the data set used by the last rebuilt
440 uint64_t m_cellFilterId; // State of the filter used by the last rebuilt
441 uint32_t m_dataFilterId; // State of the data set used by the last cell filter
442 uint32_t m_dataMappingId; // State of the PoDataMapping used by the last rebuilt
443 int m_isoDataSetIndex; // index of data set used for color map at last built
444 uint32_t m_isoDataSetId; // State of the data set used by the last rebuilt
445 float m_isovalueId; // Last isovalue used by the last isosurf/cross section built
446 ColoringType m_previousColoringType; // coloringType used by the previous built
447
448 /*----------------------------------------------------------------------------*/
449 private:
450 PbMesh *m_meshSet; // mesh set by the setMesh method
451 PbDataMapping *m_dataMappingSet;
452 PbDataMapping *m_moduleDataMappingSet;
453 PbIsovaluesList *m_isovaluesListSet;
454
455 // Sensors
456 FieldSensorList m_fieldSensorList ;
457
458 // List of fields defined in this class
459 SoFieldList m_fieldList ;
460
461 // Array of Vec3f
462 SbVec3f *arraySbVec3f;
463 int arrayLenSbVec3f;
464
465 // default isovalues list
466 PbIsovaluesList defIsovaluesList;
467} ;
468
469/*----------------------------------------------------------------------------*/
470#ifdef _WIN32
471#pragma warning(pop)
472#endif
473
474#endif /* _PO_MESH_ */
475
#define TRUE
Possible value of SbBool.
Definition SbBase.h:77
#define FALSE
Possible value of SbBool.
Definition SbBase.h:75
#define SO_KIT_HEADER(className)
Definition SoSubKit.h:91
<a href="IconLegend.html"><img src="extMV.gif" alt="MeshViz" border="0"></a> Abstract class for all b...
Definition PbBase.h:49
<a href="IconLegend.html"><img src="extMV.gif" alt="MeshViz" border="0"></a> Abstract class for data ...
<a href="IconLegend.html"><img src="extMV.gif" alt="MeshViz" border="0"></a> Class to define a list o...
<a href="IconLegend.html"><img src="extMV.gif" alt="MeshViz" border="0"></a> Class to define linear d...
<a href="IconLegend.html"><img src="extMV.gif" alt="MeshViz" border="0"></a> Defines an abstract mesh...
Definition PbMesh.h:84
<a href="IconLegend.html"><img src="extMV.gif" alt="MeshViz" border="0"></a> Base class for all 3Ddat...
<a href="IconLegend.html"><img src="extMV.gif" alt="MeshViz" border="0"></a> Interface class defining...
<a href="IconLegend.html"><img src="extMV.gif" alt="MeshViz" border="0"></a> Base class for all mesh ...
Definition PoMesh.h:110
SoSFBool smoothTextureContouring
If set to true and combined with COLOR_TEXTURE_CONTOURING coloring type, the texture used for colorin...
Definition PoMesh.h:234
SoSFFloat creaseAngle
Indicates the minimum angle (in radians) between two adjacent face normals required to form a sharp c...
Definition PoMesh.h:246
ColoringType
Coloring type.
Definition PoMesh.h:150
@ COLOR_MAPPING
Definition PoMesh.h:153
@ COLOR_CONTOURING
Definition PoMesh.h:154
@ COLOR_AVERAGE
Definition PoMesh.h:152
@ COLOR_INHERITED
Definition PoMesh.h:151
@ COLOR_TEXTURE_CONTOURING
Definition PoMesh.h:155
SoSFInt32 vecsIndex
Defines the index of the set of vectors for all representations which need a vector at each mesh node...
Definition PoMesh.h:145
SoSFInt32 valuesIndexForCellFilter
Specifies the index of the set of values used to filter cells for this mesh representation.
Definition PoMesh.h:138
SoSFEnum coloringType
Defines the type of method used to color each mesh element, mesh edge or mesh contour line of a repre...
Definition PoMesh.h:219
void setIsovaluesList(PbIsovaluesList *isovalues_list)
Sets a reference to a PbIsovaluesList object to define a list of isovalues.
const PbIsovaluesList * getIsovaluesList() const
Returns the current PbIsovaluesList object.
void setMesh(PbMesh *mesh)
Sets a reference to a PbMesh object.
const PbDataMapping * getDataMapping() const
Returns the current PbDataMapping object.
const PbDataMapping * getModuleDataMapping() const
Returns the current PbDataMapping object for the association color-vectors module.
const PbMesh * getMesh() const
Gets the current PbMesh object.
SoSFInt32 valuesIndex
Defines the index of the set of values for the coloring.
Definition PoMesh.h:125
void setDataMapping(PbDataMapping *data_mapping)
Sets a reference to a PbDataMapping object for the association color-value.
SoSFNode moduleDataMapping
Field used to do coloring according the module of the vectors.
Definition PoMesh.h:226
void setModuleDataMapping(PbDataMapping *mod_data_mapping)
Sets a reference to a PbDataMapping object for the association color-vectors module.
3D vector class.
Definition SbVec.h:932
Coordinate point node.
Maintains a list of pointers to fields.
Definition SoFieldList.h:72
Base class for all group nodes.
Definition SoGroup.h:122
Abstract base class for all indexed vertex-based shapes.
SoMFInt32 coordIndex
The indices of the coordinates that the shape uses as its vertices.
Multiple-value field containing any number of int32_t integers.
Definition SoMFInt32.h:88
void setValuesPointer(int num, const int32_t *userData)
Sets the field to contain the num values stored in userData array.
void setNum(int num)
Forces this field to have exactly num values, inserting or deleting values as necessary.
Node that specifies how multiple materials are bound to shapes.
Surface material definition node.
Definition SoMaterial.h:186
Node that specifies how multiple surface normals are bound to shapes.
Node that defines surface normals for shapes.
Definition SoNormal.h:101
Field containing a single Boolean value.
Definition SoSFBool.h:79
Field containing an enumerated value.
Definition SoSFEnum.h:89
Field containing a floating-point value.
Definition SoSFFloat.h:78
Field containing a int32_t integer.
Definition SoSFInt32.h:80
Field containing a a node.
Definition SoSFNode.h:97
Node that provides hints about shapes.
Abstract base class for all shape nodes.
Definition SoShape.h:115
2D texture mapping node.
Definition SoTexture2.h:261
2D texture coordinate node.
Node that specifies how texture coordinates are bound to shapes.
int SbBool
Boolean type.
Definition SbBase.h:87