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 : Gavin Bell (MMM yyyy) 00025 **=======================================================================*/ 00026 /*======================================================================= 00027 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), *** 00028 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. *** 00029 *** *** 00030 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS *** 00031 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR *** 00032 *** WRITTEN AUTHORIZATION OF FEI S.A.S. *** 00033 *** *** 00034 *** RESTRICTED RIGHTS LEGEND *** 00035 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS *** 00036 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN *** 00037 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT *** 00038 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN *** 00039 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. *** 00040 *** *** 00041 *** COPYRIGHT (C) 1996-2020 BY FEI S.A.S, *** 00042 *** BORDEAUX, FRANCE *** 00043 *** ALL RIGHTS RESERVED *** 00044 **=======================================================================*/ 00045 /*======================================================================= 00046 ** Modified by : VSG (MMM YYYY) 00047 **=======================================================================*/ 00048 00049 00050 #ifndef _SO_VRMLINTERP_ 00051 #define _SO_VRMLINTERP_ 00052 00053 #include <Inventor/fields/SoFieldContainer.h> 00054 #include <Inventor/VRMLnodes/SoVRMLSubInterpolator.h> 00055 #include <Inventor/nodes/SoNode.h> 00056 #include <Inventor/SoLists.h> 00057 #include <Inventor/SbString.h> 00058 #include <Inventor/SoType.h> 00059 #include <Inventor/VRMLnodes/SoVRMLNode.h> 00060 00061 00062 #if defined(OIV_IGNORE_VRML_DEPRECATED) 00063 #include <SoDeprecationRules.h> 00064 #pragma push_macro("SoDEPRECATED_CLASS") 00065 #pragma push_macro("SoDEPRECATED_TYPEDEF") 00066 #undef SoDEPRECATED_CLASS 00067 #undef SoDEPRECATED_TYPEDEF 00068 #define SoDEPRECATED_CLASS(x,y) 00069 #define SoDEPRECATED_TYPEDEF(x,y) 00070 #endif 00071 00073 // 00074 // Class: SoVRMLInterpolator 00075 // 00076 // Base SoVRMLInterpolator class (abstract). 00077 // 00079 00080 00081 class SoFieldData; 00082 class SoVRMLInterpList; 00083 class SoVRMLInterpOutput; 00084 class SoVRMLInterpOutputList; 00085 class SoVRMLInterpOutputData; 00086 class SoField; 00087 class SoOutput; 00088 class SoInput; 00089 class SoDEPRECATED SoVRMLInterpolator : public SoVRMLNode { 00126 00127 SO_NODE_ABSTRACT_HEADER(SoVRMLInterpolator); 00128 00129 public: 00130 00131 00138 virtual int getOutputs(SoVRMLInterpOutputList &list) const; 00139 00144 SoVRMLInterpOutput * getOutput(const SbName &outputName) const; 00145 00155 SbBool getOutputName(const SoVRMLInterpOutput *output, 00156 SbName &outputName) const; 00157 00161 void evaluateWrapper(SoVRMLInterpOutput *interp); 00162 00167 SoVRMLInterpolator * copy() const; 00168 00175 static SoVRMLInterpolator * getByName(const SbName &name); 00176 00184 static int getByName(const SbName &name, SoVRMLInterpList &list); 00185 00186 00187 private: 00188 00189 virtual const SoVRMLInterpOutputData * getOutputData() const = 0; 00190 00191 // Propagates modification notification through an instance. 00192 virtual void notify(SoNotList *list); 00193 00194 // Initializes base engine class 00195 static void initClass(); 00196 static void exitClass(); 00197 00198 // Initialize ALL Inventor engine classes 00199 static void initClasses(); 00200 static void exitClasses(); 00201 00202 // Writes instance to SoOutput. (Used only for last stage of writing) 00203 //virtual void writeInstance(SoOutput *out); 00204 00205 // Copies an instance that is encountered through a field connection 00206 virtual SoFieldContainer * copyThroughConnection() const; 00207 00208 // Recursive procedure that determines if this engine should be 00209 // copied during a copy operation, or just referenced as is 00210 SbBool shouldCopy() const; 00211 00212 // A very annoying double notification occurs with engines 00213 // that enable their outputs during inputChanged; this flag 00214 // prevents that: 00215 SbBool isNotifying() const { return notifying; } 00216 SbBool needsEvaluation; // Dirty bit 00217 SbBool notifying; 00218 00219 private: 00220 00221 // User-written evaluation engine. 00222 virtual void evaluate(SoVRMLInterpOutput *interp) = 0; 00223 static const SoFieldData **getInputDataPtr(); 00224 static const SoVRMLInterpOutputData **getOutputDataPtr(); 00225 00226 // Constructor, destructor 00227 SoVRMLInterpolator(); 00228 virtual ~SoVRMLInterpolator(); 00229 00230 // Reads stuff into instance. Returns FALSE on error 00231 virtual SbBool readInstance(SoInput *in, unsigned short flags); 00232 00233 // This is called whenever the value of an input is changed. The 00234 // default method does nothing. Subclasses can override this to 00235 // detect when a specific field is changed. 00236 virtual void inputChanged(SoField *whichField); 00237 00238 // Write output type information for engines that are not built-in. 00239 void writeOutputTypes(SoOutput *out); 00240 00241 private: 00242 static SoFieldData *inputData; 00243 static SoVRMLInterpOutputData *outputData; 00244 static const SoFieldData **parentInputData; 00245 static const SoVRMLInterpOutputData **parentOutputData; 00246 00247 friend class SoVRMLInterpOutput; 00248 00249 }; 00250 00252 // 00253 // Class: SoVRMLInterpOutput 00254 // 00255 // Engine outputs. They are lists of fields to be written into, 00256 // and a pointer back to the containing engine. 00257 // 00259 class SoDEPRECATED SoVRMLInterpOutput { 00284 00285 public: 00289 SoType getConnectionType() const; 00290 00295 int getForwardConnections(SoFieldList &list) const; 00296 00301 void enable(SbBool flag); 00305 SbBool isEnabled() const { return enabled; } 00306 00310 SoVRMLInterpolator * getContainer() const { return container; } 00311 00312 private: 00313 SoVRMLInterpOutput(); 00314 00315 virtual ~SoVRMLInterpOutput(); 00316 00317 SbBool read(SoInput *in, const SbName &outName, 00318 SoFieldContainer *object ); 00319 void setContainer(SoVRMLInterpolator *eng) { container = eng; } 00320 00321 // Adds/removes connection to field 00322 void addConnection(SoField *); 00323 void removeConnection(SoField *); 00324 00325 // Number of connections this output currently has 00326 int getNumConnections() const 00327 { return connections.getLength(); } 00328 00329 // Returns the fields this output is writing into 00330 SoField * operator[](int i) const 00331 { return connections.get(i); } 00332 00333 // Before evaluating (which is done with the regular field API), 00334 // we must disable notification on all the fields we're about to 00335 // write into. After evaluating, the bits are restored: 00336 void prepareToWrite() const; 00337 void doneWriting() const; 00338 00339 private: 00340 SbBool enabled; 00341 SoFieldList connections; 00342 SoVRMLInterpolator *container; 00343 }; 00344 00345 00346 00347 00348 #if defined(OIV_IGNORE_VRML_DEPRECATED) 00349 #pragma pop_macro("SoDEPRECATED_TYPEDEF") 00350 #pragma pop_macro("SoDEPRECATED_CLASS") 00351 #endif 00352 00353 #endif /* _SO_VRMLINTERP_ */ 00354