Open Inventor Release 2024.2.0
 
Loading...
Searching...
No Matches
SoVertexProperty.h
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-2024 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
55#include <Inventor/SbVertexAttributeBinding.h>
56
57#include <Inventor/fields/SoMFUInt32.h>
58#include <Inventor/fields/SoMFVec3f.h>
59#include <Inventor/fields/SoMFVec2f.h>
60#include <Inventor/fields/SoSFBool.h>
61#include <Inventor/fields/SoSFEnum.h>
62#include <Inventor/nodes/SoNode.h>
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
251 SO_NODE_HEADER(SoVertexProperty);
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;
393 bool picks : 1;
395
400 unsigned char bits;
401
402 } m_data;
403
405 ValidityBits()
406 {
407 invalidate();
408 }
409
411 inline void reset()
412 {
413 m_data.bits = 0xFF;
414 }
415
417 inline void invalidate()
418 {
419 m_data.bits = 0;
420 }
421
423 inline bool isInvalid() const
424 {
425 return m_data.bits == 0;
426 }
427
429 inline bool isValid() const
430 {
431 return (m_data.bits&((1 << NUM_FIELDS) - 1)) == ((1 << NUM_FIELDS) - 1);
432 }
433 };
434
435 static void initClass();
436 static void exitClass();
437
438 SoSFBool override;
439
440 // set NormalElement, LazyElement and TextureElement
441 void setupElements(SoState* state);
442
443 SoColorPacker *getColorPacker2() const;
444 enum Transparent {
445 YES,
446 NO,
447 UNKNOWN
448 };
449
450 inline uint32_t getVextexTimeStamp() const
451 { return m_vertexTimeStamp; }
452
453 // check for transparency when field changes.
454 virtual void notify(SoNotList *list);
455
456 private:
457 virtual ~SoVertexProperty();
458
459 private:
460 // store whether transparent or not
461 Transparent transparent;
462 uint32_t m_vertexTimeStamp;
463 mutable SoColorPacker *m_colorPacker2;
464};
465
466
467#ifdef _MSC_VER
468#pragma warning( pop )
469#endif
470
471#endif /* _SO_VERTEX_PROPERTY */
472
@ 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
unsigned char bits
Allow to initialize/test all members in one shot.
struct SoVertexProperty::ValidityBits::Data::foo attr