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-2014 BY FEI S.A.S, *** 00017 *** BORDEAUX, FRANCE *** 00018 *** ALL RIGHTS RESERVED *** 00019 **=======================================================================*/ 00020 /*======================================================================= 00021 ** Author : VSG (MMM YYYY) 00022 **=======================================================================*/ 00023 00024 #ifndef _SO_MF_UNIFORM_SHADER_PARAMETER_ 00025 #define _SO_MF_UNIFORM_SHADER_PARAMETER_ 00026 00027 #include <Inventor/fields/SoSubField.h> 00028 #include <Inventor/nodes/SoShaderParameter.h> 00029 00071 class SoMFUniformShaderParameter : public SoMField { 00072 00073 SO_MFIELD_REQUIRED_HEADER(SoMFUniformShaderParameter); 00074 SO_MFIELD_CONSTRUCTOR_HEADER(SoMFUniformShaderParameter); 00075 SO_MFIELD_VALUE_HEADER(SoMFUniformShaderParameter, SoUniformShaderParameter *, SoUniformShaderParameter *); 00076 SO_MFIELD_SETVALUESPOINTER_HEADER(SoUniformShaderParameter *); 00077 00083 void addShaderParameter(SoUniformShaderParameter *shaderParameter); 00084 00090 void insertShaderParameter(SoUniformShaderParameter *shaderParameter, int newUniformShaderParameterIndex); 00091 00096 SoUniformShaderParameter *getShaderParameter(int index) const; 00097 00101 int findShaderParameter(const SoUniformShaderParameter *shaderParameter) const; 00102 00106 SoUniformShaderParameter* findUniformParameterByName(const SbString& name); 00107 00111 int getNumShaderParameters() const; 00112 00119 void removeShaderParameter(int index); 00120 00126 void removeShaderParameter(SoUniformShaderParameter *shaderParameter) 00127 { removeShaderParameter(findShaderParameter(shaderParameter)); } 00128 00134 void removeShaderParameter(const SbString& name); 00135 00141 void removeAllShaderParameters(); 00142 00147 void replaceShaderParameter(int index, SoUniformShaderParameter *newUniformShaderParameter); 00148 00152 void replaceShaderParameter(SoUniformShaderParameter *oldUniformShaderParameter, 00153 SoUniformShaderParameter *newUniformShaderParameter) 00154 { replaceShaderParameter(findShaderParameter(oldUniformShaderParameter), newUniformShaderParameter); } 00155 00166 SoUniformShaderParameter** startEditing(); 00167 00169 void finishEditing(); 00170 00171 private: 00172 static void initClass(); 00173 static void exitClass(); 00174 00175 // Update a copied field to use the copy of each uniform shader parameter if there is one 00176 virtual void fixCopy(SbBool copyConnections); 00177 00178 // Override this to also check the stored uniform shader parameters 00179 virtual SbBool referencesCopy() const; 00180 00181 private: 00182 // Override this to maintain write-references in uniform shader parameters 00183 virtual void countWriteRefs(SoOutput *out) const; 00184 00185 // Changes value in field without doing other notification stuff. 00186 // Keeps track of references and auditors. 00187 void setVal(int index, SoUniformShaderParameter *newValue); 00188 00192 static bool hasGivenName(SbString name, const SoShaderParameter* param); 00193 00194 SoUniformShaderParameter** m_oldValues; 00195 int m_oldNum; 00196 }; 00197 00198 #endif /* _SO_MF_UNIFORM_SHADER_PARAMETER_ */ 00199 00200