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 : Paul Isaacs (MMM yyyy) 00025 ** Modified by : Thad Beier (MMM yyyy) 00026 **=======================================================================*/ 00027 /*======================================================================= 00028 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), *** 00029 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. *** 00030 *** *** 00031 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS *** 00032 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR *** 00033 *** WRITTEN AUTHORIZATION OF FEI S.A.S. *** 00034 *** *** 00035 *** RESTRICTED RIGHTS LEGEND *** 00036 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS *** 00037 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN *** 00038 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT *** 00039 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN *** 00040 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. *** 00041 *** *** 00042 *** COPYRIGHT (C) 1996-2019 BY FEI S.A.S, *** 00043 *** BORDEAUX, FRANCE *** 00044 *** ALL RIGHTS RESERVED *** 00045 **=======================================================================*/ 00046 /*======================================================================= 00047 ** Modified by : VSG (MMM YYYY) 00048 **=======================================================================*/ 00049 00050 00051 #ifndef _SO_SEPARATOR_KIT_ 00052 #define _SO_SEPARATOR_KIT_ 00053 00054 #include <Inventor/nodes/SoSeparator.h> 00055 #include <Inventor/nodekits/SoBaseKit.h> 00056 #include <Inventor/fields/SoSFEnum.h> 00057 #include <Inventor/sensors/SoFieldSensor.h> 00058 00060 // Class: SoSeparatorKit 00061 // 00062 // NOTE TO DEVELOPERS: 00063 // For info about the structure of SoSeparatorKit: 00064 // [1] compile: /usr/share/src/Inventor/samples/ivNodeKitStructure 00065 // [2] type: ivNodeKitStructure SoSeparatorKit. 00066 // [3] The program prints a diagram of the scene graph and a table with 00067 // information about each part. 00068 // 00069 // New nodes in this subclass are: 00070 // callbackList, topSeparator, pickStyle, appearance, 00071 // transform, texture2Transform, 00072 // childList 00073 // 00074 // A parent node that manages a collection of child nodes 00075 // into a unit with the following structure: 00076 // 00077 // this 00078 // ------------------| 00079 // | "topSeparator" 00080 // "callbackList" | 00081 // --------------------------------------------------------------- 00082 // | | | | | | 00083 // "pickStyle" | "units" "transform" | | 00084 // "appearance" "texture2Transform" | 00085 // | 00086 // | 00087 // "childList" 00088 // 00090 00217 class SoSeparatorKit : public SoBaseKit { 00218 00219 SO_KIT_HEADER(SoSeparatorKit); 00220 00221 // defines fields for the new parts in the catalog 00222 SO_KIT_CATALOG_ENTRY_HEADER(topSeparator); 00223 SO_KIT_CATALOG_ENTRY_HEADER(pickStyle); 00224 SO_KIT_CATALOG_ENTRY_HEADER(appearance); 00225 SO_KIT_CATALOG_ENTRY_HEADER(units); 00226 SO_KIT_CATALOG_ENTRY_HEADER(transform); 00227 SO_KIT_CATALOG_ENTRY_HEADER(texture2Transform); 00228 SO_KIT_CATALOG_ENTRY_HEADER(childList); 00229 00230 public: 00231 00233 enum CacheEnabled 00234 { 00238 OFF, 00242 ON, 00246 AUTO 00247 }; 00248 00249 // Fields 00250 #if 1 SoDEPRECATED 00256 SoSFEnum renderCaching; 00257 #endif 00264 SoSFEnum boundingBoxCaching; 00265 00270 SoSFEnum renderCulling; 00275 SoSFEnum pickCulling; 00276 00280 SoSeparatorKit(); 00281 00282 // Overrides default method on SoNode 00283 virtual SbBool affectsState() const; 00284 00285 private: 00286 static void initClass(); 00287 static void exitClass(); 00288 00289 private: 00290 // Copies the contents of the given nodekit into this instance 00291 virtual void copyContents(const SoFieldContainer *fromFC, SbBool copyConnections); 00292 00293 // detach/attach any sensors, callbacks, and/or field connections. 00294 // Called by: start/end of SoBaseKit::readInstance 00295 // and on new copy by: start/end of SoBaseKit::copy. 00296 // Classes that redefine must call setUpConnections(TRUE,TRUE) 00297 // at end of constructor. 00298 // Returns the state of the node when this was called. 00299 virtual SbBool setUpConnections( SbBool onOff, SbBool doItAlways = FALSE ); 00300 00301 // Called by the SoBaseKit::write() method. Calls setDefault(TRUE) 00302 // on the topSeparator. Note that this may be overriden later by basekit 00303 // if, for example, topSeparator lies on a path that is being written out. 00304 virtual void setDefaultOnNonWritingFields(); 00305 00306 // This sensor will watch the topSeparator part. If the part changes to a 00307 // new node, then the fields of the old part will be disconnected and 00308 // the fields of the new part will be connected. 00309 // Connections are made from/to the boundingBoxCaching, 00310 // renderCulling and pickCulling fields. This way, the SoSeparatorKit 00311 // can be treated from the outside just like a regular SoSeparator node. 00312 // Setting the fields will affect caching and culling, even though the 00313 // topSeparator takes care of it. 00314 // oldTopSep keeps track of the part for comparison. 00315 SoFieldSensor *fieldSensor; 00316 static void fieldSensorCB( void *, SoSensor *); 00317 SoSeparator *oldTopSep; 00318 00319 void connectSeparatorFields( SoSeparator *dest, SbBool onOff ); 00320 00321 private: 00322 virtual ~SoSeparatorKit(); 00323 00324 }; 00325 #endif /* _SO_SEPARATOR_KIT_ */ 00326 00327