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_SET_
00026 #define _SO_MARKER_SET_
00027
00028 #include <Inventor/nodes/SoPointSet.h>
00029 #include <Inventor/fields/SoMFInt32.h>
00030 #include <Inventor/fields/SoSFFloat.h>
00031 #include <Inventor/fields/SoMFFloat.h>
00032
00034 class SbThreadMutex;
00035 class SoMarker;
00036
00037 namespace markerset {
00038 class SoMarkerSetRenderer;
00039 }
00040 class SoMarkerSizeCache;
00043
00044
00144 class SoMarkerSet : public SoPointSet {
00145 SO_NODE_HEADER(SoMarkerSet) ;
00146
00147 public:
00174 SoMFInt32 markerIndex;
00175
00188 SoMFFloat markerScale;
00189
00199 SoSFFloat markerGlobalScale;
00200
00204 SoMarkerSet() ;
00205
00207 enum MarkerType {
00209 CROSS_5_5,
00211 PLUS_5_5,
00213 MINUS_5_5,
00215 SLASH_5_5,
00217 BACKSLASH_5_5,
00219 BAR_5_5,
00221 STAR_5_5,
00223 Y_5_5,
00225 LIGHTNING_5_5,
00227 WELL_5_5,
00228
00230 CIRCLE_LINE_5_5,
00232 SQUARE_LINE_5_5,
00234 DIAMOND_LINE_5_5,
00236 TRIANGLE_LINE_5_5,
00238 RHOMBUS_LINE_5_5,
00240 HOURGLASS_LINE_5_5,
00242 SATELLITE_LINE_5_5,
00244 PINE_TREE_LINE_5_5,
00246 CAUTION_LINE_5_5,
00248 SHIP_LINE_5_5,
00249
00251 CIRCLE_FILLED_5_5,
00253 SQUARE_FILLED_5_5,
00255 DIAMOND_FILLED_5_5,
00257 TRIANGLE_FILLED_5_5,
00259 RHOMBUS_FILLED_5_5,
00261 HOURGLASS_FILLED_5_5,
00263 SATELLITE_FILLED_5_5,
00265 PINE_TREE_FILLED_5_5,
00267 CAUTION_FILLED_5_5,
00269 SHIP_FILLED_5_5,
00270
00272 CROSS_7_7,
00274 PLUS_7_7,
00276 MINUS_7_7,
00278 SLASH_7_7,
00280 BACKSLASH_7_7,
00282 BAR_7_7,
00284 STAR_7_7,
00286 Y_7_7,
00288 LIGHTNING_7_7,
00290 WELL_7_7,
00291
00293 CIRCLE_LINE_7_7,
00295 SQUARE_LINE_7_7,
00297 DIAMOND_LINE_7_7,
00299 TRIANGLE_LINE_7_7,
00301 RHOMBUS_LINE_7_7,
00303 HOURGLASS_LINE_7_7,
00305 SATELLITE_LINE_7_7,
00307 PINE_TREE_LINE_7_7,
00309 CAUTION_LINE_7_7,
00311 SHIP_LINE_7_7,
00312
00314 CIRCLE_FILLED_7_7,
00316 SQUARE_FILLED_7_7,
00318 DIAMOND_FILLED_7_7,
00320 TRIANGLE_FILLED_7_7,
00322 RHOMBUS_FILLED_7_7,
00324 HOURGLASS_FILLED_7_7,
00326 SATELLITE_FILLED_7_7,
00328 PINE_TREE_FILLED_7_7,
00330 CAUTION_FILLED_7_7,
00332 SHIP_FILLED_7_7,
00333
00335 CROSS_9_9,
00337 PLUS_9_9,
00339 MINUS_9_9,
00341 SLASH_9_9,
00343 BACKSLASH_9_9,
00345 BAR_9_9,
00347 STAR_9_9,
00349 Y_9_9,
00351 LIGHTNING_9_9,
00353 WELL_9_9,
00354
00356 CIRCLE_LINE_9_9,
00358 SQUARE_LINE_9_9,
00360 DIAMOND_LINE_9_9,
00362 TRIANGLE_LINE_9_9,
00364 RHOMBUS_LINE_9_9,
00366 HOURGLASS_LINE_9_9,
00368 SATELLITE_LINE_9_9,
00370 PINE_TREE_LINE_9_9,
00372 CAUTION_LINE_9_9,
00374 SHIP_LINE_9_9,
00375
00377 CIRCLE_FILLED_9_9,
00379 SQUARE_FILLED_9_9,
00381 DIAMOND_FILLED_9_9,
00383 TRIANGLE_FILLED_9_9,
00385 RHOMBUS_FILLED_9_9,
00387 HOURGLASS_FILLED_9_9,
00389 SATELLITE_FILLED_9_9,
00391 PINE_TREE_FILLED_9_9,
00393 CAUTION_FILLED_9_9,
00395 SHIP_FILLED_9_9
00396 };
00397
00401 static int getNumDefinedMarkers();
00402
00418 static void addMarker(int markerIndex, const SbVec2s &size, const unsigned char *bytes,
00419 SbBool isLSBFirst = TRUE, SbBool isUpToDown = TRUE);
00420
00438 static void addMarker(int markerIndex, const SbVec2s &size,
00439 const unsigned char *bytes,
00440 const uint32_t *orderedRGBA,
00441 SbBool isLSBFirst = TRUE, SbBool isUpToDown = TRUE);
00442
00447 static void addMarker(int markerIndex, SoMarker* marker );
00448
00456 static SbBool getMarker(int markerIndex,
00457 SbVec2s &size,
00458 const unsigned char *&bytes,
00459 SbBool &isLSBFirst);
00460
00469 static SbBool getMarker(int markerIndex,
00470 SbVec2s &size,
00471 const unsigned char *&bytes,
00472 const uint32_t *&orderedRGBA,
00473 SbBool &isLSBFirst);
00474
00479 static SoMarker* getMarker( int markerIndex );
00480
00485 static SbBool removeMarker(int markerIndex);
00486
00487 private:
00488
00489 virtual void generatePrimitives(SoAction *action);
00490
00491
00492 virtual ~SoMarkerSet();
00493
00494 private:
00495 virtual void GLRender(SoGLRenderAction *action);
00496 virtual void getPrimitiveCount(SoGetPrimitiveCountAction *action);
00497
00498
00499 virtual void computeBBox( SoAction *action, SbBox3f &box, SbVec3f ¢er );
00500
00501 static SbBool isMarkerBitSet(int markerIndex, int bitNumber);
00502
00503 private:
00504 static void initClass();
00505 static void exitClass();
00506
00507
00508 virtual void notify(SoNotList *list);
00509
00510 private:
00511
00513 markerset::SoMarkerSetRenderer* m_MarkerSetShaderRenderer;
00514
00516 void updateRenderer(markerset::SoMarkerSetRenderer* renderer, SoNotList* list);
00517
00519 markerset::SoMarkerSetRenderer* chooseRenderer(SoState* state);
00520
00521
00522 SoRayPickAction* m_currentPickAction;
00523 SoMarkerSizeCache* m_markerSizeCache;
00524 };
00525
00526 #endif // !_SO_MARKER_SET_
00527
00528
00529