00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #ifndef _SO_RENDER_LIST_HH
00031 #define _SO_RENDER_LIST_HH
00032
00033 #include <Inventor/nodes/SoSeparator.h>
00034 #include <Inventor/actions/SoCallbackAction.h>
00035 #include <Inventor/SbBox.h>
00036 #include <Inventor/SbColor.h>
00037 #include <Inventor/fields/SoSFBool.h>
00038 #include <Inventor/fields/SoSFUInt32.h>
00039
00040 #ifndef HIDDEN_FROM_DOC
00041
00042 class SoState;
00043 class SoGLCacheList;
00044 class SoNodeSensor;
00045 class SoSearchAction;
00046 class SoComplexity;
00047
00048 SoDEPRECATED_CLASS(9800, "SoRenderList node and SoRenderObject class have been deprecated and will be removed in next major version.") SoRenderObject {
00049
00050 public:
00051
00052 SoRenderObject(const SoPath *p);
00053 virtual ~SoRenderObject();
00054
00055
00056 virtual void invalidate();
00057
00058
00059 virtual SoPath *getPath(void) { return path; };
00060
00061
00062 const SbBox3f& getBox(void) { return bbox; };
00063
00064
00065 SbBool isTranslucent;
00066
00067 SbBool isOccluder;
00068
00069
00070
00071
00072
00073
00074 float getDecimation() { return decimation; };
00075 void setDecimation(float value) { decimation = value; };
00076
00077 void setIndex(int i) { index = i; };
00078 SbBool hasIndex(void) { return (index == -1 ? FALSE : TRUE); };
00079 int getIndex(void) { return index; };
00080 void resetIndex(void) { index = -1; };
00081
00082 private:
00083
00084
00085
00086 SoPath *path;
00087 SoGLCacheList *pathCache;
00088 SoPrimitiveCountCache *primCountCache;
00089
00090
00091 SbBox3f bbox;
00092
00093 float decimation;
00094
00095 friend class SoRenderList;
00096
00097 int index;
00098
00099 int m_numRenderCaches;
00100 };
00101
00102
00103 SoDEPRECATED_CLASS(9800, "SoRenderList node and SoRenderObjectList class have been deprecated and will be removed in next major version.") SoRenderObjectList : public SbPList{
00104
00105 public:
00106
00107 void append(SoRenderObject *string)
00108 { ((SbPList *) this)->append((void *) string); }
00109
00110 int find(SoRenderObject *string)
00111 { return ((SbPList *) this)->find((void *) string); }
00112
00113 void insert(SoRenderObject *string, int addBefore)
00114 { ((SbPList *) this)->insert((void *) string, addBefore); }
00115
00116 SoRenderObject *&operator [](int i) const
00117 { return ( (SoRenderObject *&) ( (*(const SbPList *) this) [i] ) ); }
00118 };
00119
00120 #endif // HIDDEN_FROM_DOC
00121 class SoDEPRECATED SoRenderList : public SoSeparator{
00168
00169 SO_NODE_HEADER(SoRenderList);
00170
00171 public:
00175 SoRenderList();
00176
00180 SoRenderList(int numChildren);
00181
00185 void addRenderObjectType(SoType t);
00186
00190 void removeRenderObjectType(SoType t);
00191
00195 int getNumRenderObjectTypes() const
00196 { return types.getLength(); }
00197
00201 SoType getRenderObjectType(int i) const
00202 { return types[i]; }
00203
00207 virtual void notify(SoNotList *list);
00208
00212 void addRenderObjectName(SbName n);
00213
00217 void removeRenderObjectName(SbName n);
00218
00222 int getNumRenderObjectNames() const
00223 { return names.getLength(); }
00224
00228 const SbName &getRenderObjectName(int i) const;
00229
00233 void removeAllRenderObjectNames();
00234
00244 SoSFBool isHead;
00245
00246 private:
00247 static void initClass();
00248 static void exitClass();
00249
00250 private:
00251
00252
00253 SoPath *getPathFromRenderObject (SoRenderObject *obj)
00254 {
00255 if(obj->hasIndex())return obj->path->copy(obj->getIndex());
00256 else return obj->path;
00257 };
00258
00259
00260
00261 void renderObject(SoGLRenderAction *action, SoRenderObject *);
00262 void traverseRenderObject(SoAction *action, SoRenderObject *);
00263 void primitiveCountRenderObject(SoGetPrimitiveCountAction *action,
00264 SoRenderObject *);
00265
00266
00267 void traverseRenderObjectAsBox(SoAction *action, SoRenderObject *);
00268
00269
00270 void traverseRenderObjectDecimated(SoAction *action,
00271 SoRenderObject *,
00272 float decimationPercentage);
00273
00274
00275 virtual SoRenderObject *createRenderObject(const SoPath *p);
00276 virtual void removingRenderObject(SoRenderObject *);
00277 virtual void renderObjectChanged(SoRenderObject *);
00278 virtual void ourFieldChanged(SoField *);
00279
00280
00281 virtual ~SoRenderList();
00282
00283
00284 SoRenderObjectList shapes;
00285
00286
00287
00288
00289 SoCallbackAction *shapeSearchAction;
00290
00291
00292 float getDecimationValue(SoState *state);
00293
00294
00295
00296 void detachChangeSensor();
00297 void attachChangeSensor();
00298
00299
00300
00301
00302
00303 virtual SbBool lookingForNode(SoType t, const SoNode *n);
00304
00305
00306 SoSearchAction *searchForRenderList;
00307 SoRenderList* coworker;
00308 SbBool searchForACoworker;
00309
00310 enum SortType {
00311 BUBBLE,
00312 MERGE
00313 };
00314
00315
00316
00317 void sortObjects(SoState* state,
00318 SoRenderObjectList &vobject,
00319 int firstIndex,
00320 int lastIndex,
00321 SbBool backToFront=TRUE,
00322 SortType type = SoRenderList::MERGE);
00323
00324
00325 void checkForAttribute(SoRenderObject*);
00326
00327
00328 SbBool sortTransparentObjs;
00329
00330
00331 SbBool manageTransparency;
00332
00333
00334 private:
00335
00336 void commonConstructor();
00337
00338
00339 SoComplexity *boxComplexity;
00340
00341
00342 SbIntList pathsAffected;
00343 void markAffected(int whichPath);
00344
00345
00346 void callAffectedPathsCallbacks();
00347
00348
00349 SoTypeList types;
00350 SbPList names;
00351
00352
00353 int indexIntoShapes;
00354 SoRenderObject* mergePath(const SoPath *path, int where);
00355 SoRenderObject* addRenderObject(const SoPath *p, int where);
00356 void removeRenderObject(int where);
00357 void renderObjectChanged(int where);
00358
00359
00360 SoSearchAction *pathSearchAction;
00361 void findAffectedPaths(SoNode *node);
00362 void findContainingPaths(SoNode *node, int start);
00363 int findTruncatedPaths();
00364
00365
00366 void saveRelationship(SoNode* changedNode,
00367 const SbIntList &affectedPaths);
00368 SbBool haveRelationship(SoNode *changedNode,
00369 SbIntList &affectedPaths);
00370 void clearRelationships();
00371 SbPList relateNodes, relatePaths;
00372
00373
00374
00375 SoNodeSensor *childChangeSensor;
00376 SbPList sensorList;
00377 static void childSensorCB(void *data, SoSensor *sensor)
00378 { ((SoRenderList*)data)->childChange( (SoNodeSensor*) sensor); };
00379 void childChange(SoNodeSensor *sensor);
00380 static void tailSensorCB(void *data, SoSensor *sensor)
00381 { ((SoRenderList*)data)->tailChange( (SoNodeSensor*) sensor); };
00382 void tailChange(SoNodeSensor *sensor);
00383
00384
00385 static SoCallbackAction::Response foundRenderObjectCB(void *userData,
00386 SoCallbackAction *action,
00387 const SoNode *);
00388
00389 static SoCallbackAction::Response afterFoundingRenderObjectCB(void *userData,
00390 SoCallbackAction *action,
00391 const SoNode *);
00392
00393
00394 SbBool doNotCreateRenderObject;
00395 SoRenderObject* objectToCheck;
00396
00397 void mergeSort(float *A, int firstIndex, int lastIndex, SoRenderObjectList &obj,SbBool);
00398 void mergeBtoF(float *A, int f, int m, int l, SoRenderObjectList &obj);
00399 void mergeFtoB(float *A, int f, int m, int l, SoRenderObjectList &obj);
00400
00401 void bubbleSort(float *A, int firstIndex, int lastIndex,SoRenderObjectList &obj,SbBool);
00402 void bubbleBtoF(float *A, int firstIndex, int lastIndex, SoRenderObjectList &obj);
00403 void bubbleFtoB(float *A, int firstIndex, int lastIndex, SoRenderObjectList &obj);
00404
00405
00406 SoState *currentState;
00407 };
00408
00409 #endif
00410
00411