26 #ifdef G4VIS_BUILD_OI_DRIVER
36 #include <HEPVis/nodes/SoMarkerSet.h>
38 #include <Inventor/errors/SoDebugError.h>
39 #include <Inventor/misc/SoState.h>
40 #include <Inventor/actions/SoGLRenderAction.h>
41 #include <Inventor/nodes/SoPointSet.h>
43 #include <Inventor/elements/SoCoordinateElement.h>
44 #include <Inventor/elements/SoCacheElement.h>
45 #include <Inventor/elements/SoLazyElement.h>
47 #include <HEPVis/SbGL.h>
48 #include <HEPVis/actions/SoGL2PSAction.h>
50 static void drawMarker(SoAction*,
int);
51 static GLubyte* getBitmap(
int,
int,
char []);
75 static char plus_5_5[] = {
82 static char asterisk_5_5[] = {
89 static char cross_5_5[] = {
96 static char star_5_5[] = {
103 static char circle_line_5_5[] = {
110 static char circle_filled_5_5[] = {
117 static char triangle_up_line_5_5[] = {
124 static char triangle_up_filled_5_5[] = {
131 static char triangle_down_line_5_5[] = {
138 static char triangle_down_filled_5_5[] = {
145 static char david_star_line_5_5[] = {
152 static char david_star_filled_5_5[] = {
159 static char swiss_cross_line_5_5[] = {
166 static char swiss_cross_filled_5_5[] = {
173 static char diamond_line_5_5[] = {
180 static char diamond_filled_5_5[] = {
187 static char square_line_5_5[] = {
194 static char square_filled_5_5[] = {
204 static char plus_7_7[] = {
213 static char asterisk_7_7[] = {
222 static char cross_7_7[] = {
231 static char star_7_7[] = {
240 static char circle_line_7_7[] = {
249 static char circle_filled_7_7[] = {
258 static char triangle_up_line_7_7[] = {
267 static char triangle_up_filled_7_7[] = {
276 static char triangle_down_line_7_7[] = {
285 static char triangle_down_filled_7_7[] = {
294 static char david_star_line_7_7[] = {
303 static char david_star_filled_7_7[] = {
312 static char swiss_cross_line_7_7[] = {
321 static char swiss_cross_filled_7_7[] = {
330 static char diamond_line_7_7[] = {
339 static char diamond_filled_7_7[] = {
348 static char square_line_7_7[] = {
357 static char square_filled_7_7[] = {
370 static char plus_9_9[] = {
381 static char asterisk_9_9[] = {
392 static char cross_9_9[] = {
403 static char star_9_9[] = {
414 static char circle_line_9_9[] = {
425 static char circle_filled_9_9[] = {
436 static char triangle_up_line_9_9[] = {
447 static char triangle_up_filled_9_9[] = {
458 static char triangle_down_line_9_9[] = {
469 static char triangle_down_filled_9_9[] = {
480 static char david_star_line_9_9[] = {
491 static char david_star_filled_9_9[] = {
502 static char swiss_cross_line_9_9[] = {
513 static char swiss_cross_filled_9_9[] = {
524 static char diamond_line_9_9[] = {
535 static char diamond_filled_9_9[] = {
546 static char square_line_9_9[] = {
557 static char square_filled_9_9[] = {
569 static char* sFigures[54] = {
576 triangle_up_line_5_5,
577 triangle_up_filled_5_5,
578 triangle_down_line_5_5,
579 triangle_down_filled_5_5,
581 david_star_filled_5_5,
582 swiss_cross_line_5_5,
583 swiss_cross_filled_5_5,
594 triangle_up_line_7_7,
595 triangle_up_filled_7_7,
596 triangle_down_line_7_7,
597 triangle_down_filled_7_7,
599 david_star_filled_7_7,
600 swiss_cross_line_7_7,
601 swiss_cross_filled_7_7,
612 triangle_up_line_9_9,
613 triangle_up_filled_9_9,
614 triangle_down_line_9_9,
615 triangle_down_filled_9_9,
617 david_star_filled_9_9,
618 swiss_cross_line_9_9,
619 swiss_cross_filled_9_9,
626 SO_NODE_SOURCE(HEPVis_SoMarkerSet)
628 void HEPVis_SoMarkerSet::initClass (
633 SO_NODE_INIT_CLASS(HEPVis_SoMarkerSet,SoPointSet,
"PointSet");
636 HEPVis_SoMarkerSet::HEPVis_SoMarkerSet (
641 SO_NODE_CONSTRUCTOR(HEPVis_SoMarkerSet);
643 SO_NODE_ADD_FIELD(markerIndex,(CROSS_5_5));
646 HEPVis_SoMarkerSet::~HEPVis_SoMarkerSet (
653 void HEPVis_SoMarkerSet::GLRender (
654 SoGLRenderAction* aAction
659 SoState* state = aAction->getState();
661 const SoCoordinateElement* coordinateElement =
662 SoCoordinateElement::getInstance(state);
663 if(coordinateElement==NULL)
return;
665 if(aAction->isOfType(SoGL2PSAction::getClassTypeId())) {
666 SoCacheElement::invalidate(state);
669 const SbColor& color = SoLazyElement::getDiffuse(aAction->getState(),0);
671 color.getValue(red,green,blue);
673 int mark = markerIndex[0];
675 int starti = startIndex.getValue();
676 int pointn = numPoints.getValue();
679 glPushAttrib( (GLbitfield)(GL_CURRENT_BIT | GL_ENABLE_BIT));
680 glDisable(GL_LIGHTING);
681 glColor3f(red,green,blue);
685 glDisable(GL_DEPTH_TEST);
688 glPixelStorei(GL_UNPACK_ALIGNMENT,1);
689 for(pointi=starti;pointi<pointn;pointi++){
690 const SbVec3f& vec = coordinateElement->get3(pointi);
691 glRasterPos3f(vec[0],vec[1],vec[2]);
699 drawMarker(aAction,mark);
713 GLfloat xorig = 0,yorig = 0;
714 GLfloat xmove = 0,ymove = 0;
716 if((aStyle>=0)&&(aStyle<18)) {
719 GLubyte* bitmap = getBitmap(w,h,sFigures[aStyle]);
720 glBitmap(w,h,xorig,yorig,0.,0.,bitmap);
722 }
else if((aStyle>=18)&&(aStyle<36)) {
725 GLubyte* bitmap = getBitmap(w,h,sFigures[aStyle]);
726 glBitmap(w,h,xorig,yorig,0.,0.,bitmap);
728 }
else if((aStyle>=36)&&(aStyle<54)) {
731 GLubyte* bitmap = getBitmap(w,h,sFigures[aStyle]);
732 glBitmap(w,h,xorig,yorig,0.,0.,bitmap);
738 if(aAction->isOfType(SoGL2PSAction::getClassTypeId())) {
739 ((SoGL2PSAction*)aAction)->addBitmap(w,h,xorig,yorig,xmove,ymove);
753 GLubyte* bitmap =
new GLubyte[aW * aH + 1];
756 unsigned char byte = 0;
757 for (
int row = 0; row < aH; row++ ){
758 for (
int col = 0; col < aW; col++){
759 unsigned char c = aFigure[ichar];
764 byte += (1<<(7-ibit));
771 bitmap[index] = byte;
782 bitmap[index] = byte;
const G4double w[NPOINTSGL]