00001 /*======================================================================= 00002 * Copyright 1991-1996, Silicon Graphics, Inc. 00003 * ALL RIGHTS RESERVED 00004 * 00005 * UNPUBLISHED -- Rights reserved under the copyright laws of the United 00006 * States. Use of a copyright notice is precautionary only and does not 00007 * imply publication or disclosure. 00008 * 00009 * U.S. GOVERNMENT RESTRICTED RIGHTS LEGEND: 00010 * Use, duplication or disclosure by the Government is subject to restrictions 00011 * as set forth in FAR 52.227.19(c)(2) or subparagraph (c)(1)(ii) of the Rights 00012 * in Technical Data and Computer Software clause at DFARS 252.227-7013 and/or 00013 * in similar or successor clauses in the FAR, or the DOD or NASA FAR 00014 * Supplement. Contractor/manufacturer is Silicon Graphics, Inc., 00015 * 2011 N. Shoreline Blvd. Mountain View, CA 94039-7311. 00016 * 00017 * THE CONTENT OF THIS WORK CONTAINS CONFIDENTIAL AND PROPRIETARY 00018 * INFORMATION OF SILICON GRAPHICS, INC. ANY DUPLICATION, MODIFICATION, 00019 * DISTRIBUTION, OR DISCLOSURE IN ANY FORM, IN WHOLE, OR IN PART, IS STRICTLY 00020 * PROHIBITED WITHOUT THE PRIOR EXPRESS WRITTEN PERMISSION OF SILICON 00021 * GRAPHICS, INC. 00022 **=======================================================================*/ 00023 /*======================================================================= 00024 ** Author : Alan Norton (MMM yyyy) 00025 ** Modified by : Gavin Bell (MMM yyyy) 00026 **=======================================================================*/ 00027 /*======================================================================= 00028 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), *** 00029 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. *** 00030 *** *** 00031 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS *** 00032 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR *** 00033 *** WRITTEN AUTHORIZATION OF FEI S.A.S. *** 00034 *** *** 00035 *** RESTRICTED RIGHTS LEGEND *** 00036 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS *** 00037 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN *** 00038 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT *** 00039 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN *** 00040 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. *** 00041 *** *** 00042 *** COPYRIGHT (C) 1996-2020 BY FEI S.A.S, *** 00043 *** BORDEAUX, FRANCE *** 00044 *** ALL RIGHTS RESERVED *** 00045 **=======================================================================*/ 00046 /*======================================================================= 00047 ** Modified by : VSG (MMM YYYY) 00048 **=======================================================================*/ 00049 00050 00051 00052 #ifndef _SO_VERTEX_PROPERTY 00053 #define _SO_VERTEX_PROPERTY 00054 00055 #include <Inventor/SbVertexAttributeBinding.h> 00056 00057 #include <Inventor/fields/SoMFUInt32.h> 00058 #include <Inventor/fields/SoMFVec3f.h> 00059 #include <Inventor/fields/SoMFVec2f.h> 00060 #include <Inventor/fields/SoSFBool.h> 00061 #include <Inventor/fields/SoSFEnum.h> 00062 #include <Inventor/nodes/SoNode.h> 00063 00064 #ifdef _MSC_VER 00065 #pragma warning( push ) 00066 #pragma warning(disable:4251) 00067 #endif 00068 00069 class SoColorPacker; 00070 00072 // 00073 // Class: SoVertexProperty 00074 // 00075 // SoNode class that manages arrays of data for GLVertex Array Extension. 00076 // Data arrays include: vertices, normals, tangents, colors, texture coordinates. 00077 // Also has NormalBinding, TangentBinding and MaterialBinding fields 00078 // 00080 00082 namespace inventor 00083 { 00084 namespace cache 00085 { 00086 class VertexProperty; 00087 } 00088 } 00249 class SoVertexProperty : public SoNode { 00250 00251 SO_NODE_HEADER(SoVertexProperty); 00252 00253 public: 00254 00258 SoMFVec3f vertex; 00262 SoMFVec2f texCoord; 00266 SoMFVec3f texCoord3; 00267 00271 SoSFBool forceSending; 00272 00276 SoMFVec3f normal; 00277 00282 SoMFVec3f tangent; 00283 00288 SoSFEnum normalBinding; 00289 00295 SoSFEnum tangentBinding; 00296 00300 SoMFUInt32 orderedRGBA; 00301 00306 SoSFEnum materialBinding; 00307 00311 enum Binding { 00315 OVERALL = SbVertexAttributeBinding::OVERALL, 00319 PER_PART = SbVertexAttributeBinding::PER_PART, 00323 PER_PART_INDEXED = SbVertexAttributeBinding::PER_PART_INDEXED, 00327 PER_FACE = SbVertexAttributeBinding::PER_FACE, 00331 PER_FACE_INDEXED = SbVertexAttributeBinding::PER_FACE_INDEXED, 00335 PER_VERTEX = SbVertexAttributeBinding::PER_VERTEX, 00339 PER_VERTEX_INDEXED = SbVertexAttributeBinding::PER_VERTEX_INDEXED 00340 }; 00341 00345 SoVertexProperty(); 00346 00351 inline virtual void setOverride(const SbBool state) 00352 { override.setValue(state); } 00353 00357 inline virtual SbBool isOverride() const 00358 { return override.getValue(); } 00359 00360 private: 00361 virtual void doAction(SoAction *action); 00362 virtual void GLRender(SoGLRenderAction *action); 00363 virtual void getBoundingBox(SoGetBoundingBoxAction *action); 00364 virtual void callback(SoCallbackAction *action); 00365 virtual void pick(SoPickAction *action); 00366 virtual void getPrimitiveCount(SoGetPrimitiveCountAction *action); 00367 00368 SbBool isTransparent(); 00369 00370 private: 00371 00375 class ValidityBits 00376 { 00377 public: 00379 enum { NUM_FIELDS = 6 }; 00380 00381 union Data 00382 { 00383 00384 struct foo 00385 { 00386 bool coordinates : 1; 00387 bool normals : 1; 00388 bool tangents : 1; 00389 bool colors : 1; 00390 bool textureCoords : 1; 00391 bool attributes : 1; 00392 bool indices : 1; 00393 } attr; 00394 00399 unsigned char bits; 00400 00401 } m_data; 00402 00404 ValidityBits() 00405 { 00406 invalidate(); 00407 } 00408 00410 inline void reset() 00411 { 00412 m_data.bits = 0xFF; 00413 } 00414 00416 inline void invalidate() 00417 { 00418 m_data.bits = 0; 00419 } 00420 00422 inline bool isInvalid() const 00423 { 00424 return m_data.bits == 0; 00425 } 00426 00428 inline bool isValid() const 00429 { 00430 return (m_data.bits&((1 << NUM_FIELDS) - 1)) == ((1 << NUM_FIELDS) - 1); 00431 } 00432 }; 00433 00434 static void initClass(); 00435 static void exitClass(); 00436 00437 SoSFBool override; 00438 00439 // set NormalElement, LazyElement and TextureElement 00440 void setupElements(SoState* state); 00441 00442 SoColorPacker *getColorPacker2() const; 00443 enum Transparent { 00444 YES, 00445 NO, 00446 UNKNOWN 00447 }; 00448 00449 inline uint32_t getVextexTimeStamp() const 00450 { return m_vertexTimeStamp; } 00451 00452 // check for transparency when field changes. 00453 virtual void notify(SoNotList *list); 00454 00455 private: 00456 virtual ~SoVertexProperty(); 00457 00458 private: 00459 // store whether transparent or not 00460 Transparent transparent; 00461 uint32_t m_vertexTimeStamp; 00462 mutable SoColorPacker *m_colorPacker2; 00463 }; 00464 00465 00466 #ifdef _MSC_VER 00467 #pragma warning( pop ) 00468 #endif 00469 00470 #endif /* _SO_VERTEX_PROPERTY */ 00471 00472