Open Inventor Release 2023.2.3
 
Loading...
Searching...
No Matches
SoVertexProperty.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 : Alan Norton (MMM yyyy)
25** Modified by : Gavin Bell (MMM yyyy)
26**=======================================================================*/
27/*=======================================================================
28 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), ***
29 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. ***
30 *** ***
31 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS ***
32 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR ***
33 *** WRITTEN AUTHORIZATION OF FEI S.A.S. ***
34 *** ***
35 *** RESTRICTED RIGHTS LEGEND ***
36 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS ***
37 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN ***
38 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT ***
39 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN ***
40 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. ***
41 *** ***
42 *** COPYRIGHT (C) 1996-2020 BY FEI S.A.S, ***
43 *** BORDEAUX, FRANCE ***
44 *** ALL RIGHTS RESERVED ***
45**=======================================================================*/
46/*=======================================================================
47** Modified by : VSG (MMM YYYY)
48**=======================================================================*/
49
50
51
52#ifndef _SO_VERTEX_PROPERTY
53#define _SO_VERTEX_PROPERTY
54
56
63
64#ifdef _MSC_VER
65#pragma warning( push )
66#pragma warning(disable:4251)
67#endif
68
69class SoColorPacker;
70
72//
73// Class: SoVertexProperty
74//
75// SoNode class that manages arrays of data for GLVertex Array Extension.
76// Data arrays include: vertices, normals, tangents, colors, texture coordinates.
77// Also has NormalBinding, TangentBinding and MaterialBinding fields
78//
80
82namespace inventor
83{
84 namespace cache
85 {
86 class VertexProperty;
87 }
88}
249class SoVertexProperty : public SoNode {
250
252
253 public:
254
267
272
277
283
289
296
301
307
341
346
351 inline virtual void setOverride(const SbBool state)
352 { override.setValue(state); }
353
357 inline virtual SbBool isOverride() const
358 { return override.getValue(); }
359
360 private:
361 virtual void doAction(SoAction *action);
362 virtual void GLRender(SoGLRenderAction *action);
363 virtual void getBoundingBox(SoGetBoundingBoxAction *action);
364 virtual void callback(SoCallbackAction *action);
365 virtual void pick(SoPickAction *action);
366 virtual void getPrimitiveCount(SoGetPrimitiveCountAction *action);
367
368 SbBool isTransparent();
369
370 private:
371
375 class ValidityBits
376 {
377 public:
379 enum { NUM_FIELDS = 6 };
380
381 union Data
382 {
383
384 struct foo
385 {
386 bool coordinates : 1;
387 bool normals : 1;
388 bool tangents : 1;
389 bool colors : 1;
391 bool attributes : 1;
392 bool indices : 1;
394
399 unsigned char bits;
400
401 } m_data;
402
404 ValidityBits()
405 {
406 invalidate();
407 }
408
410 inline void reset()
411 {
412 m_data.bits = 0xFF;
413 }
414
416 inline void invalidate()
417 {
418 m_data.bits = 0;
419 }
420
422 inline bool isInvalid() const
423 {
424 return m_data.bits == 0;
425 }
426
428 inline bool isValid() const
429 {
430 return (m_data.bits&((1 << NUM_FIELDS) - 1)) == ((1 << NUM_FIELDS) - 1);
431 }
432 };
433
434 static void initClass();
435 static void exitClass();
436
437 SoSFBool override;
438
439 // set NormalElement, LazyElement and TextureElement
440 void setupElements(SoState* state);
441
442 SoColorPacker *getColorPacker2() const;
443 enum Transparent {
444 YES,
445 NO,
446 UNKNOWN
447 };
448
449 inline uint32_t getVextexTimeStamp() const
450 { return m_vertexTimeStamp; }
451
452 // check for transparency when field changes.
453 virtual void notify(SoNotList *list);
454
455 private:
456 virtual ~SoVertexProperty();
457
458 private:
459 // store whether transparent or not
460 Transparent transparent;
461 uint32_t m_vertexTimeStamp;
462 mutable SoColorPacker *m_colorPacker2;
463};
464
465
466#ifdef _MSC_VER
467#pragma warning( pop )
468#endif
469
470#endif /* _SO_VERTEX_PROPERTY */
471
#define SO_NODE_HEADER(className)
Definition SoSubNode.h:151
@ PER_FACE
One attribute for each face of object.
@ PER_FACE_INDEXED
One attribute for each face, indexed.
@ PER_PART_INDEXED
One attribute for each part, indexed.
@ PER_VERTEX_INDEXED
One attribute for each vertex, indexed.
@ OVERALL
Whole object has same attribute.
@ PER_PART
One attribute for each part of object.
@ PER_VERTEX
One attribute for each vertex.
Abstract base class for all actions.
Definition SoAction.h:132
Performs a generic traversal of a scene graph or path.
Stores packed colors.
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 uint32_t integers.
Definition SoMFUInt32.h:90
Multiple-value field containing any number of two-dimensional vectors.
Definition SoMFVec2f.h:89
Multiple-value field containing any number of three-dimensional vectors.
Definition SoMFVec3f.h:181
Abstract base class for all database nodes.
Definition SoNode.h:145
Abstract base class for picking objects in a scene.
Field containing a single Boolean value.
Definition SoSFBool.h:79
Field containing an enumerated value.
Definition SoSFEnum.h:89
Traversal state.
Definition SoState.h:74
Vertex property node.
SoSFEnum materialBinding
Material binding.
SoMFVec3f tangent
Tangent vector(s).
SoMFVec3f normal
Normal vector(s).
virtual SbBool isOverride() const
Returns the state of the override field.
SoSFEnum normalBinding
Normal binding.
SoSFEnum tangentBinding
Tangent binding.
virtual void setOverride(const SbBool state)
Set the state of the override field.
SoVertexProperty()
Creates an SoVertexProperty node with default settings.
SoMFUInt32 orderedRGBA
Packed color(s), including transparencies.
SoMFVec3f texCoord3
3D texture coordinate(s).
SoMFVec3f vertex
Vertex coordinate(s).
SoMFVec2f texCoord
2D texture coordinate(s).
SoSFBool forceSending
Forces the texture coordinates to be sent to the GPU even if no texture is bound.
@ PER_VERTEX
One material/normal/tangent for each vertex of object.
@ PER_PART_INDEXED
One material/normal/tangent for each part, indexed.
@ PER_FACE_INDEXED
One material/normal/tangent for each face, indexed.
@ PER_FACE
One material/normal/tangent for each face of object.
@ PER_PART
One material/normal/tangent for each part of object.
@ PER_VERTEX_INDEXED
One material/normal/tangent for each vertex, indexed.
@ OVERALL
Whole object has same material/normal/tangent.
int SbBool
Boolean type.
Definition SbBase.h:87
void reset()
unsigned char bits
Allow to initialize/test all members in one shot.
struct SoVertexProperty::ValidityBits::Data::foo attr