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-2020 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 #include <Inventor/SbRenderCaching.h> 00059 00061 // Class: SoSeparatorKit 00062 // 00063 // NOTE TO DEVELOPERS: 00064 // For info about the structure of SoSeparatorKit: 00065 // [1] compile: /usr/share/src/Inventor/samples/ivNodeKitStructure 00066 // [2] type: ivNodeKitStructure SoSeparatorKit. 00067 // [3] The program prints a diagram of the scene graph and a table with 00068 // information about each part. 00069 // 00070 // New nodes in this subclass are: 00071 // callbackList, topSeparator, pickStyle, appearance, 00072 // transform, texture2Transform, 00073 // childList 00074 // 00075 // A parent node that manages a collection of child nodes 00076 // into a unit with the following structure: 00077 // 00078 // this 00079 // ------------------| 00080 // | "topSeparator" 00081 // "callbackList" | 00082 // --------------------------------------------------------------- 00083 // | | | | | | 00084 // "pickStyle" | "units" "transform" | | 00085 // "appearance" "texture2Transform" | 00086 // | 00087 // | 00088 // "childList" 00089 // 00091 00220 class SoSeparatorKit : public SoBaseKit { 00221 00222 SO_KIT_HEADER(SoSeparatorKit); 00223 00224 // defines fields for the new parts in the catalog 00225 SO_KIT_CATALOG_ENTRY_HEADER(topSeparator); 00226 SO_KIT_CATALOG_ENTRY_HEADER(pickStyle); 00227 SO_KIT_CATALOG_ENTRY_HEADER(appearance); 00228 SO_KIT_CATALOG_ENTRY_HEADER(units); 00229 SO_KIT_CATALOG_ENTRY_HEADER(transform); 00230 SO_KIT_CATALOG_ENTRY_HEADER(texture2Transform); 00231 SO_KIT_CATALOG_ENTRY_HEADER(childList); 00232 00233 public: 00234 00236 enum CacheEnabled 00237 { 00241 OFF = SO_RENDERCACHING_OFF, 00245 ON = SO_RENDERCACHING_ON, 00249 AUTO = SO_RENDERCACHING_AUTO 00250 }; 00251 00252 // Fields 00257 SoSFEnum renderCaching; 00263 SoSFEnum boundingBoxCaching; 00269 SoSFEnum renderCulling; 00274 SoSFEnum pickCulling; 00275 00279 SoSeparatorKit(); 00280 00281 // Overrides default method on SoNode 00282 virtual SbBool affectsState() const; 00283 00284 private: 00285 static void initClass(); 00286 static void exitClass(); 00287 00288 private: 00289 // Copies the contents of the given nodekit into this instance 00290 virtual void copyContents(const SoFieldContainer *fromFC, SbBool copyConnections); 00291 00292 // detach/attach any sensors, callbacks, and/or field connections. 00293 // Called by: start/end of SoBaseKit::readInstance 00294 // and on new copy by: start/end of SoBaseKit::copy. 00295 // Classes that redefine must call setUpConnections(TRUE,TRUE) 00296 // at end of constructor. 00297 // Returns the state of the node when this was called. 00298 virtual SbBool setUpConnections( SbBool onOff, SbBool doItAlways = FALSE ); 00299 00300 // Called by the SoBaseKit::write() method. Calls setDefault(TRUE) 00301 // on the topSeparator. Note that this may be overriden later by basekit 00302 // if, for example, topSeparator lies on a path that is being written out. 00303 virtual void setDefaultOnNonWritingFields(); 00304 00305 // This sensor will watch the topSeparator part. If the part changes to a 00306 // new node, then the fields of the old part will be disconnected and 00307 // the fields of the new part will be connected. 00308 // Connections are made from/to the renderCaching, boundingBoxCaching, 00309 // renderCulling and pickCulling fields. This way, the SoSeparatorKit 00310 // can be treated from the outside just like a regular SoSeparator node. 00311 // Setting the fields will affect caching and culling, even though the 00312 // topSeparator takes care of it. 00313 // oldTopSep keeps track of the part for comparison. 00314 SoFieldSensor *fieldSensor; 00315 static void fieldSensorCB( void *, SoSensor *); 00316 SoSeparator *oldTopSep; 00317 00318 void connectSeparatorFields( SoSeparator *dest, SbBool onOff ); 00319 00320 private: 00321 virtual ~SoSeparatorKit(); 00322 00323 }; 00324 #endif /* _SO_SEPARATOR_KIT_ */ 00325 00326