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_INDEXED_MARKER_SET_
00026 #define _SO_INDEXED_MARKER_SET_
00027
00028 #include <Inventor/nodes/SoIndexedPointSet.h>
00029 #include <Inventor/nodes/SoMarkerSet.h>
00030 #include <Inventor/fields/SoMFInt32.h>
00031 #include <Inventor/nodes/SoPointSet.h>
00032 #include <Inventor/fields/SoSFFloat.h>
00033 #include <Inventor/fields/SoMFFloat.h>
00034 #include <Inventor/caches/SoCache.h>
00035
00036 class SbThreadMutex;
00037 class SoMarker;
00038 class SoMarkerSizeCache;
00039
00040
00041
00146 class SoIndexedMarkerSet : public SoIndexedPointSet {
00147 SO_NODE_HEADER(SoIndexedMarkerSet) ;
00148
00149 public:
00158 SoMFInt32 markerIndex ;
00159
00171 SoMFFloat markerScale;
00172
00181 SoSFFloat markerGlobalScale;
00182
00186 SoIndexedMarkerSet() ;
00187
00189 enum MarkerType {
00191 CROSS_5_5,
00193 PLUS_5_5,
00195 MINUS_5_5,
00197 SLASH_5_5,
00199 BACKSLASH_5_5,
00201 BAR_5_5,
00203 STAR_5_5,
00205 Y_5_5,
00207 LIGHTNING_5_5,
00209 WELL_5_5,
00210
00212 CIRCLE_LINE_5_5,
00214 SQUARE_LINE_5_5,
00216 DIAMOND_LINE_5_5,
00218 TRIANGLE_LINE_5_5,
00220 RHOMBUS_LINE_5_5,
00222 HOURGLASS_LINE_5_5,
00224 SATELLITE_LINE_5_5,
00226 PINE_TREE_LINE_5_5,
00228 CAUTION_LINE_5_5,
00230 SHIP_LINE_5_5,
00231
00233 CIRCLE_FILLED_5_5,
00235 SQUARE_FILLED_5_5,
00237 DIAMOND_FILLED_5_5,
00239 TRIANGLE_FILLED_5_5,
00241 RHOMBUS_FILLED_5_5,
00243 HOURGLASS_FILLED_5_5,
00245 SATELLITE_FILLED_5_5,
00247 PINE_TREE_FILLED_5_5,
00249 CAUTION_FILLED_5_5,
00251 SHIP_FILLED_5_5,
00252
00254 CROSS_7_7,
00256 PLUS_7_7,
00258 MINUS_7_7,
00260 SLASH_7_7,
00262 BACKSLASH_7_7,
00264 BAR_7_7,
00266 STAR_7_7,
00268 Y_7_7,
00270 LIGHTNING_7_7,
00272 WELL_7_7,
00273
00275 CIRCLE_LINE_7_7,
00277 SQUARE_LINE_7_7,
00279 DIAMOND_LINE_7_7,
00281 TRIANGLE_LINE_7_7,
00283 RHOMBUS_LINE_7_7,
00285 HOURGLASS_LINE_7_7,
00287 SATELLITE_LINE_7_7,
00289 PINE_TREE_LINE_7_7,
00291 CAUTION_LINE_7_7,
00293 SHIP_LINE_7_7,
00294
00296 CIRCLE_FILLED_7_7,
00298 SQUARE_FILLED_7_7,
00300 DIAMOND_FILLED_7_7,
00302 TRIANGLE_FILLED_7_7,
00304 RHOMBUS_FILLED_7_7,
00306 HOURGLASS_FILLED_7_7,
00308 SATELLITE_FILLED_7_7,
00310 PINE_TREE_FILLED_7_7,
00312 CAUTION_FILLED_7_7,
00314 SHIP_FILLED_7_7,
00315
00317 CROSS_9_9,
00319 PLUS_9_9,
00321 MINUS_9_9,
00323 SLASH_9_9,
00325 BACKSLASH_9_9,
00327 BAR_9_9,
00329 STAR_9_9,
00331 Y_9_9,
00333 LIGHTNING_9_9,
00335 WELL_9_9,
00336
00338 CIRCLE_LINE_9_9,
00340 SQUARE_LINE_9_9,
00342 DIAMOND_LINE_9_9,
00344 TRIANGLE_LINE_9_9,
00346 RHOMBUS_LINE_9_9,
00348 HOURGLASS_LINE_9_9,
00350 SATELLITE_LINE_9_9,
00352 PINE_TREE_LINE_9_9,
00354 CAUTION_LINE_9_9,
00356 SHIP_LINE_9_9,
00357
00359 CIRCLE_FILLED_9_9,
00361 SQUARE_FILLED_9_9,
00363 DIAMOND_FILLED_9_9,
00365 TRIANGLE_FILLED_9_9,
00367 RHOMBUS_FILLED_9_9,
00369 HOURGLASS_FILLED_9_9,
00371 SATELLITE_FILLED_9_9,
00373 PINE_TREE_FILLED_9_9,
00375 CAUTION_FILLED_9_9,
00377 SHIP_FILLED_9_9
00378 };
00379
00383 static int getNumDefinedMarkers();
00384
00400 static void addMarker(int markerIndex, const SbVec2s &size, const unsigned char *bytes,
00401 SbBool isLSBFirst = TRUE, SbBool isUpToDown = TRUE);
00402
00420 static void addMarker(int markerIndex, const SbVec2s &size,
00421 const unsigned char *bytes,
00422 const uint32_t *orderedRGBA,
00423 SbBool isLSBFirst = TRUE, SbBool isUpToDown = TRUE);
00424
00429 static void addMarker(int markerIndex, SoMarker* marker );
00430
00438 static SbBool getMarker(int markerIndex,
00439 SbVec2s &size,
00440 const unsigned char *&bytes,
00441 SbBool &isLSBFirst);
00442
00451 static SbBool getMarker(int markerIndex,
00452 SbVec2s &size,
00453 const unsigned char *&bytes,
00454 const uint32_t *&orderedRGBA,
00455 SbBool &isLSBFirst);
00456
00461 static SoMarker* getMarker( int markerIndex );
00462
00467 static SbBool removeMarker(int markerIndex);
00468
00469 private:
00470 virtual void GLRender(SoGLRenderAction *action);
00471 virtual void getPrimitiveCount(SoGetPrimitiveCountAction *action);
00472
00473
00474 virtual void computeBBox( SoAction *action, SbBox3f &box, SbVec3f ¢er );
00475
00476 private:
00477 static void initClass();
00478 static void exitClass();
00479
00480 static SbBool isMarkerBitSet(int markerIndex, int bitNumber);
00481
00482 SoINTERNAL private:
00483 virtual ~SoIndexedMarkerSet();
00484
00485
00486 virtual void generatePrimitives(SoAction *action);
00487 virtual void invokePointCallbacks_(SoAction *action, const SoPrimitiveVertex *v, const uint32_t index);
00488
00489 virtual void notify(SoNotList *list);
00490
00491 virtual SbBool isRenderingPointsOrLines(SoGLRenderAction *action);
00492 private:
00493
00495 SoMarkerSet* getMarkerSet(SoState* state);
00496
00498 bool isCacheValid( SoState *state, SoCache* cache ) const;
00499
00500 SbThreadMutex* m_mutex;
00501
00506 SoRef<SoMarkerSet> m_markerSet;
00507
00509 SoCache* m_markerSetCache;
00510
00511
00512 SoRayPickAction* m_currentPickAction;
00513 SoMarkerSizeCache* m_markerSizeCache;
00514 };
00515
00516
00517 inline SbBool
00518 SoIndexedMarkerSet::isRenderingPointsOrLines(SoGLRenderAction *)
00519 {
00520 return TRUE;
00521 }
00522
00523 #endif
00524
00525
00526