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-2020 BY FEI S.A.S, *** 00017 *** BORDEAUX, FRANCE *** 00018 *** ALL RIGHTS RESERVED *** 00019 **=======================================================================*/ 00020 /*======================================================================= 00021 ** Author : David Beilloin (Aug 2013) 00022 **=======================================================================*/ 00023 00024 00025 #ifndef _SO_INSTANCE_PARAMETER_H_ 00026 #define _SO_INSTANCE_PARAMETER_H_ 00027 00028 #include <Inventor/SbBasic.h> 00029 #include <Inventor/nodes/SoNode.h> 00030 00031 #include <Inventor/nodes/SoShaderParameter.h> 00032 00033 #include <Inventor/fields/SoSFBufferObject.h> 00034 #include <Inventor/fields/SoSFInt32.h> 00035 #include <Inventor/fields/SoSFUInt32.h> 00036 #include <Inventor/fields/SoSFBool.h> 00037 #include <Inventor/fields/SoSFEnum.h> 00038 00039 00081 class SoInstanceParameter : public SoVertexShaderParameterBufferObject 00082 { 00083 SO_NODE_HEADER(SoInstanceParameter); 00084 00085 public: 00086 00090 SoInstanceParameter(); 00091 00097 SoSFUInt32 divisor; 00098 00132 enum PredefinedParameters 00133 { 00134 TRANSLATION = 0, 00135 ROTATION, 00136 SCALE, 00137 VISIBILITY, 00138 COLOR, 00139 NUM_PREDEFINED_PARAMETERS 00140 }; 00141 00181 static SoInstanceParameter* createPredefinedParameter( SoInstanceParameter::PredefinedParameters paramKey, 00182 const SoBufferObject* values, uint32_t divisor = 1 ); 00183 00185 static SbString getPredefinedParameterName( SoInstanceParameter::PredefinedParameters paramKey ); 00186 00188 void setPredefinedParameterName( SoInstanceParameter::PredefinedParameters paramKey ); 00189 00190 private: 00192 static void initClass(); 00193 00195 static void exitClass(); 00196 00198 virtual void notify(SoNotList *list); 00199 00200 // Attrib divisor is set by a field 00201 virtual unsigned int getVertexAttribDivisor() { return divisor.getValue(); } 00202 00203 private: 00204 // Destructor 00205 virtual ~SoInstanceParameter(); 00206 00207 }; 00208 00209 /*----------------------------------------------------------------------------*/ 00210 00211 #endif /* _SO_INSTANCE_PARAMETER_H_ */ 00212 00213