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
00128 class SoMarker : public SoNode
00129 {
00130 SO_NODE_HEADER(SoMarker);
00131
00132 public:
00133
00135 enum MarkerType {
00137 CROSS_5_5,
00139 PLUS_5_5,
00141 MINUS_5_5,
00143 SLASH_5_5,
00145 BACKSLASH_5_5,
00147 BAR_5_5,
00149 STAR_5_5,
00151 Y_5_5,
00153 LIGHTNING_5_5,
00155 WELL_5_5,
00156
00158 CIRCLE_LINE_5_5,
00160 SQUARE_LINE_5_5,
00162 DIAMOND_LINE_5_5,
00164 TRIANGLE_LINE_5_5,
00166 RHOMBUS_LINE_5_5,
00168 HOURGLASS_LINE_5_5,
00170 SATELLITE_LINE_5_5,
00172 PINE_TREE_LINE_5_5,
00174 CAUTION_LINE_5_5,
00176 SHIP_LINE_5_5,
00177
00179 CIRCLE_FILLED_5_5,
00181 SQUARE_FILLED_5_5,
00183 DIAMOND_FILLED_5_5,
00185 TRIANGLE_FILLED_5_5,
00187 RHOMBUS_FILLED_5_5,
00189 HOURGLASS_FILLED_5_5,
00191 SATELLITE_FILLED_5_5,
00193 PINE_TREE_FILLED_5_5,
00195 CAUTION_FILLED_5_5,
00197 SHIP_FILLED_5_5,
00198
00200 CROSS_7_7,
00202 PLUS_7_7,
00204 MINUS_7_7,
00206 SLASH_7_7,
00208 BACKSLASH_7_7,
00210 BAR_7_7,
00212 STAR_7_7,
00214 Y_7_7,
00216 LIGHTNING_7_7,
00218 WELL_7_7,
00219
00221 CIRCLE_LINE_7_7,
00223 SQUARE_LINE_7_7,
00225 DIAMOND_LINE_7_7,
00227 TRIANGLE_LINE_7_7,
00229 RHOMBUS_LINE_7_7,
00231 HOURGLASS_LINE_7_7,
00233 SATELLITE_LINE_7_7,
00235 PINE_TREE_LINE_7_7,
00237 CAUTION_LINE_7_7,
00239 SHIP_LINE_7_7,
00240
00242 CIRCLE_FILLED_7_7,
00244 SQUARE_FILLED_7_7,
00246 DIAMOND_FILLED_7_7,
00248 TRIANGLE_FILLED_7_7,
00250 RHOMBUS_FILLED_7_7,
00252 HOURGLASS_FILLED_7_7,
00254 SATELLITE_FILLED_7_7,
00256 PINE_TREE_FILLED_7_7,
00258 CAUTION_FILLED_7_7,
00260 SHIP_FILLED_7_7,
00261
00263 CROSS_9_9,
00265 PLUS_9_9,
00267 MINUS_9_9,
00269 SLASH_9_9,
00271 BACKSLASH_9_9,
00273 BAR_9_9,
00275 STAR_9_9,
00277 Y_9_9,
00279 LIGHTNING_9_9,
00281 WELL_9_9,
00282
00284 CIRCLE_LINE_9_9,
00286 SQUARE_LINE_9_9,
00288 DIAMOND_LINE_9_9,
00290 TRIANGLE_LINE_9_9,
00292 RHOMBUS_LINE_9_9,
00294 HOURGLASS_LINE_9_9,
00296 SATELLITE_LINE_9_9,
00298 PINE_TREE_LINE_9_9,
00300 CAUTION_LINE_9_9,
00302 SHIP_LINE_9_9,
00303
00305 CIRCLE_FILLED_9_9,
00307 SQUARE_FILLED_9_9,
00309 DIAMOND_FILLED_9_9,
00311 TRIANGLE_FILLED_9_9,
00313 RHOMBUS_FILLED_9_9,
00315 HOURGLASS_FILLED_9_9,
00317 SATELLITE_FILLED_9_9,
00319 PINE_TREE_FILLED_9_9,
00321 CAUTION_FILLED_9_9,
00323 SHIP_FILLED_9_9
00324 };
00325
00329 SoMarker();
00330
00334 SoMFUByte bitmap;
00335
00339 SoMFUInt32 orderedRGBA;
00340
00346 SoSFBool upToDown;
00347
00352 SoSFBool isLSBFirst;
00353
00357 SoSFVec2s size;
00358
00362 SoSFInt32 index;
00363
00364 private:
00365
00366 static void initClass();
00367 static void exitClass();
00368
00369 void render( SoState* state, int index = 0);
00370 virtual void notify( SoNotList* list );
00371 virtual SbBool readInstance(SoInput *in, unsigned short flags);
00372
00376 int getMarkerIndex()
00377 { return m_markerIndex; }
00378
00382 void setMarkerIndex( const int tindex )
00383 { m_markerIndex = tindex; }
00384
00388 static int getNumDefinedMarkers();
00389
00393 static int getMaxIndexDefinedMarker();
00394
00398 static void addMarker(int markerIndex,
00399 const SbVec2s &size,
00400 const unsigned char *bytes,
00401 const uint32_t *orderedRGBA,
00402 SbBool isLSBFirst = TRUE,
00403 SbBool isUpToDown = TRUE);
00407 static void addMarker(int markerIndex, SoMarker* marker );
00408
00412 static SbBool removeMarker(int markerIndex);
00413
00414 static SoMarker* getMarkerDesc( int markerInd );
00415
00416 static SbBool isMarkerBitSet(int markerIndex, int bitNumber) ;
00417
00418
00419 static void updateListInstanciedMarkerSet();
00420 static void addMarkerSetDependency(SoNode* );
00421 static void removeMarkerSetDependency(SoNode* );
00422
00423 private:
00427 virtual ~SoMarker();
00428
00429 SbBool useDL;
00430
00431 private:
00432
00433
00434 int m_markerIndex;
00435
00436
00437 SoGLObjectCache* m_objCache;
00438
00439
00440 static SbPList m_markerHashTab[MARKER_HASH_TAB_SIZE];
00441
00442
00443 static void createListOfPreDefinedMarkers();
00444 static void destroyListOfPreDefinedMarkers();
00445 static bool m_isBuildingPredefinedMarkers;
00446
00447
00448 static inline int getMarkerHashTabIndex(int markerIndex);
00449
00450
00451 static SbPList m_listInstanciedMarkerSet;
00452
00453 void setPredefined(bool b);
00454
00455 bool m_predefined;
00456 bool m_prevUpToDown;
00457
00458
00459 static int s_cachedCurrentMarkerIndex;
00460 };
00461
00462 #endif // !_SO_MARKER_H_
00463
00464
00465