00001 /*================================================================================= 00002 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), *** 00003 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. *** 00004 *** *** 00005 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS *** 00006 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR *** 00007 *** WRITTEN AUTHORIZATION OF FEI S.A.S. *** 00008 *** *** 00009 *** RESTRICTED RIGHTS LEGEND *** 00010 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS *** 00011 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN *** 00012 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT *** 00013 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN *** 00014 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. *** 00015 *** *** 00016 *** COPYRIGHT (C) 1996-2019 BY FEI S.A.S, *** 00017 *** BORDEAUX, FRANCE *** 00018 *** ALL RIGHTS RESERVED *** 00019 =================================================================================*/ 00020 00021 #pragma once 00022 00023 #include <Inventor/SbLinear.h> 00024 #include <Inventor/elements/SoReplacedElement.h> 00025 #include <Inventor/errors/SoDebugError.h> 00026 00040 SoEXTENDER_Documented class SoTangentElement : public SoReplacedElement 00041 { 00042 SO_ELEMENT_HEADER( SoTangentElement ); 00043 00044 public: 00049 static void set( SoState* state, SoNode* node, int32_t numTangents, const SbVec3f* tangents ); 00050 00054 static const SoTangentElement* getInstance( SoState* state ) 00055 { 00056 return getConstElement<SoTangentElement>( state ); 00057 } 00058 00062 int32_t getNum() const 00063 { 00064 return m_numTangents; 00065 } 00066 00070 const SbVec3f& get( int index ) const 00071 { 00072 if ( index < 0 || index >= m_numTangents ) 00073 { 00074 #if defined(_DEBUG) 00075 SoDebugError::post( "SoTangentElement::get", 00076 "Index (%d) is out of range 0 - %d", 00077 index, m_numTangents - 1 ); 00078 #endif 00079 return s_defaultTangent; 00080 } 00081 return m_tangents[index]; 00082 } 00083 00087 virtual void print( FILE* fp ) const; 00088 00089 private: 00091 virtual void init( SoState* state ); 00092 00093 private: 00094 // Initializes the SoTangentElement class 00095 static void initClass(); 00096 static void exitClass(); 00097 00098 private: 00099 int32_t m_numTangents; 00100 const SbVec3f* m_tangents; 00101 00102 virtual ~SoTangentElement(); 00103 00104 private: 00109 static SbVec3f s_defaultTangent; 00110 }; 00111