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 #ifndef _SO_MARKER_H_
00026 #define _SO_MARKER_H_
00027
00028 #include <Inventor/nodes/SoNode.h>
00029 #include <Inventor/fields/SoMFUInt32.h>
00030 #include <Inventor/fields/SoSFBool.h>
00031 #include <Inventor/fields/SoMFUByte.h>
00032 #include <Inventor/fields/SoSFVec2s.h>
00033 #include <Inventor/fields/SoSFInt32.h>
00034
00035 class SoState;
00036 class SoGLObjectCache;
00037
00038 #define MARKER_HASH_TAB_SIZE 151
00039
00129 class SoMarker : public SoNode
00130 {
00131 SO_NODE_HEADER(SoMarker);
00132
00133 public:
00134
00136 enum MarkerType {
00138 CROSS_5_5,
00140 PLUS_5_5,
00142 MINUS_5_5,
00144 SLASH_5_5,
00146 BACKSLASH_5_5,
00148 BAR_5_5,
00150 STAR_5_5,
00152 Y_5_5,
00154 LIGHTNING_5_5,
00156 WELL_5_5,
00157
00159 CIRCLE_LINE_5_5,
00161 SQUARE_LINE_5_5,
00163 DIAMOND_LINE_5_5,
00165 TRIANGLE_LINE_5_5,
00167 RHOMBUS_LINE_5_5,
00169 HOURGLASS_LINE_5_5,
00171 SATELLITE_LINE_5_5,
00173 PINE_TREE_LINE_5_5,
00175 CAUTION_LINE_5_5,
00177 SHIP_LINE_5_5,
00178
00180 CIRCLE_FILLED_5_5,
00182 SQUARE_FILLED_5_5,
00184 DIAMOND_FILLED_5_5,
00186 TRIANGLE_FILLED_5_5,
00188 RHOMBUS_FILLED_5_5,
00190 HOURGLASS_FILLED_5_5,
00192 SATELLITE_FILLED_5_5,
00194 PINE_TREE_FILLED_5_5,
00196 CAUTION_FILLED_5_5,
00198 SHIP_FILLED_5_5,
00199
00201 CROSS_7_7,
00203 PLUS_7_7,
00205 MINUS_7_7,
00207 SLASH_7_7,
00209 BACKSLASH_7_7,
00211 BAR_7_7,
00213 STAR_7_7,
00215 Y_7_7,
00217 LIGHTNING_7_7,
00219 WELL_7_7,
00220
00222 CIRCLE_LINE_7_7,
00224 SQUARE_LINE_7_7,
00226 DIAMOND_LINE_7_7,
00228 TRIANGLE_LINE_7_7,
00230 RHOMBUS_LINE_7_7,
00232 HOURGLASS_LINE_7_7,
00234 SATELLITE_LINE_7_7,
00236 PINE_TREE_LINE_7_7,
00238 CAUTION_LINE_7_7,
00240 SHIP_LINE_7_7,
00241
00243 CIRCLE_FILLED_7_7,
00245 SQUARE_FILLED_7_7,
00247 DIAMOND_FILLED_7_7,
00249 TRIANGLE_FILLED_7_7,
00251 RHOMBUS_FILLED_7_7,
00253 HOURGLASS_FILLED_7_7,
00255 SATELLITE_FILLED_7_7,
00257 PINE_TREE_FILLED_7_7,
00259 CAUTION_FILLED_7_7,
00261 SHIP_FILLED_7_7,
00262
00264 CROSS_9_9,
00266 PLUS_9_9,
00268 MINUS_9_9,
00270 SLASH_9_9,
00272 BACKSLASH_9_9,
00274 BAR_9_9,
00276 STAR_9_9,
00278 Y_9_9,
00280 LIGHTNING_9_9,
00282 WELL_9_9,
00283
00285 CIRCLE_LINE_9_9,
00287 SQUARE_LINE_9_9,
00289 DIAMOND_LINE_9_9,
00291 TRIANGLE_LINE_9_9,
00293 RHOMBUS_LINE_9_9,
00295 HOURGLASS_LINE_9_9,
00297 SATELLITE_LINE_9_9,
00299 PINE_TREE_LINE_9_9,
00301 CAUTION_LINE_9_9,
00303 SHIP_LINE_9_9,
00304
00306 CIRCLE_FILLED_9_9,
00308 SQUARE_FILLED_9_9,
00310 DIAMOND_FILLED_9_9,
00312 TRIANGLE_FILLED_9_9,
00314 RHOMBUS_FILLED_9_9,
00316 HOURGLASS_FILLED_9_9,
00318 SATELLITE_FILLED_9_9,
00320 PINE_TREE_FILLED_9_9,
00322 CAUTION_FILLED_9_9,
00324 SHIP_FILLED_9_9
00325 };
00326
00330 SoMarker();
00331
00339 SoMFUByte bitmap;
00340
00344 SoMFUInt32 orderedRGBA;
00345
00351 SoSFBool upToDown;
00352
00357 SoSFBool isLSBFirst;
00358
00362 SoSFVec2s size;
00363
00367 SoSFInt32 index;
00368
00369 private:
00370
00371 static void initClass();
00372 static void exitClass();
00373
00374 virtual void notify( SoNotList* list );
00375
00379 int getMarkerIndex()
00380 { return m_markerIndex; }
00381
00385 void setMarkerIndex( const int tindex )
00386 { m_markerIndex = tindex; }
00387
00391 static int getNumDefinedMarkers();
00392
00396 static int getMaxIndexDefinedMarker();
00397
00401 static void addMarker(int markerIndex,
00402 const SbVec2s &size,
00403 const unsigned char *bytes,
00404 const uint32_t *orderedRGBA,
00405 SbBool isLSBFirst = TRUE,
00406 SbBool isUpToDown = TRUE);
00410 static void addMarker(int markerIndex, SoMarker* marker );
00411
00415 static SbBool removeMarker(int markerIndex);
00416
00417 static SoMarker* getMarkerDesc( int markerInd );
00418
00419 static SbBool isMarkerBitSet(int markerIndex, int bitNumber) ;
00420
00421
00422 static void updateListInstanciedMarkerSet();
00423 static void addMarkerSetDependency(SoNode* );
00424 static void removeMarkerSetDependency(SoNode* );
00425
00426 private:
00430 virtual ~SoMarker();
00431
00432 SbBool useDL;
00433
00434 virtual SbBool readInstance(SoInput *in, unsigned short flags);
00435
00436 private:
00437
00438
00439 int m_markerIndex;
00440
00441
00442 SoGLObjectCache* m_objCache;
00443
00444
00445 static SbPList m_markerHashTab[MARKER_HASH_TAB_SIZE];
00446
00447
00448 static void createListOfPreDefinedMarkers();
00449 static void destroyListOfPreDefinedMarkers();
00450 static bool m_isBuildingPredefinedMarkers;
00451
00452
00453 static inline int getMarkerHashTabIndex(int markerIndex);
00454
00455
00456 static SbPList m_listInstanciedMarkerSet;
00457
00458 void setPredefined(bool b);
00459
00460 bool m_predefined;
00461 bool m_prevUpToDown;
00462
00463
00464 static int s_cachedCurrentMarkerIndex;
00465 };
00466
00467 #endif // !_SO_MARKER_H_
00468
00469
00470