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 : 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 00073 class SoMFUniformShaderParameter : public SoMField { 00074 00075 SO_MFIELD_REQUIRED_HEADER(SoMFUniformShaderParameter); 00076 SO_MFIELD_CONSTRUCTOR_HEADER(SoMFUniformShaderParameter); 00077 SO_MFIELD_VALUE_HEADER(SoMFUniformShaderParameter, SoUniformShaderParameter *, SoUniformShaderParameter *); 00078 SO_MFIELD_SETVALUESPOINTER_HEADER(SoUniformShaderParameter *); 00079 00085 void addShaderParameter(SoUniformShaderParameter *shaderParameter); 00086 00092 void insertShaderParameter(SoUniformShaderParameter *shaderParameter, int newUniformShaderParameterIndex); 00093 00098 SoUniformShaderParameter *getShaderParameter(int index) const; 00099 00103 int findShaderParameter(const SoUniformShaderParameter *shaderParameter) const; 00104 00108 SoUniformShaderParameter* findUniformParameterByName(const SbString& name); 00109 00113 int getNumShaderParameters() const; 00114 00121 void removeShaderParameter(int index); 00122 00128 void removeShaderParameter(SoUniformShaderParameter *shaderParameter) 00129 { removeShaderParameter(findShaderParameter(shaderParameter)); } 00130 00136 void removeShaderParameter(const SbString& name); 00137 00143 void removeAllShaderParameters(); 00144 00149 void replaceShaderParameter(int index, SoUniformShaderParameter *newUniformShaderParameter); 00150 00154 void replaceShaderParameter(SoUniformShaderParameter *oldUniformShaderParameter, 00155 SoUniformShaderParameter *newUniformShaderParameter) 00156 { replaceShaderParameter(findShaderParameter(oldUniformShaderParameter), newUniformShaderParameter); } 00157 00168 SoUniformShaderParameter** startEditing(); 00169 00171 void finishEditing(); 00172 00173 private: 00174 static void initClass(); 00175 static void exitClass(); 00176 00177 // Update a copied field to use the copy of each uniform shader parameter if there is one 00178 virtual void fixCopy(SbBool copyConnections); 00179 00180 // Override this to also check the stored uniform shader parameters 00181 virtual SbBool referencesCopy() const; 00182 00183 // Set the property and propagate it to the nodes belonging to this field 00184 virtual void setSameValueNotificationEnabled(SbBool value); 00185 00186 private: 00187 // Override this to maintain write-references in uniform shader parameters 00188 virtual void countWriteRefs(SoOutput *out) const; 00189 00190 // Changes value in field without doing other notification stuff. 00191 // Keeps track of references and auditors. 00192 void setVal(int index, SoUniformShaderParameter *newValue); 00193 00197 static bool hasGivenName(SbString name, const SoShaderParameter* param); 00198 00199 SoUniformShaderParameter** m_oldValues; 00200 int m_oldNum; 00201 }; 00202 00203 #endif /* _SO_MF_UNIFORM_SHADER_PARAMETER_ */ 00204 00205