#include <Iguana/Inventor/interface/IgSoGL2PSAction.h>
Public Member Functions | |
IgSoGL2PSAction (const SbViewportRegion &) | |
Static Public Member Functions | |
static void | initClass (void) |
Private Member Functions | |
SO_ACTION_HEADER (IgSoGL2PSAction) | |
Static Private Member Functions | |
static void | indexedLineSet (SoAction *self, SoNode *node) |
static void | lineSet (SoAction *self, SoNode *node) |
static void | markerSet (SoAction *self, SoNode *node) |
static void | pointSet (SoAction *self, SoNode *node) |
static void | separatorSet (SoAction *self, SoNode *node) |
static void | text2 (SoAction *self, SoNode *node) |
Definition at line 23 of file IgSoGL2PSAction.h.
IgSoGL2PSAction::IgSoGL2PSAction | ( | const SbViewportRegion & | region | ) |
Definition at line 46 of file IgSoGL2PSAction.cc.
00047 :SoGLRenderAction (region) 00048 { 00049 SO_ACTION_CONSTRUCTOR (IgSoGL2PSAction); 00050 }
void IgSoGL2PSAction::indexedLineSet | ( | SoAction * | self, | |
SoNode * | node | |||
) | [static, private] |
Definition at line 53 of file IgSoGL2PSAction.cc.
References GL2PS_LINE_STIPPLE, gl2psDisable(), gl2psEnable(), gl2psLineWidth(), and value.
00054 { 00055 GLfloat value; 00056 glGetFloatv (GL_LINE_WIDTH, &value); 00057 gl2psLineWidth (value); 00058 GLint pat; 00059 glGetIntegerv (GL_LINE_STIPPLE_PATTERN, &pat); 00060 if (pat == 0xffff) 00061 gl2psDisable (GL2PS_LINE_STIPPLE); 00062 else 00063 gl2psEnable (GL2PS_LINE_STIPPLE); 00064 node->GLRender ((IgSoGL2PSAction *)self); 00065 }
Definition at line 35 of file IgSoGL2PSAction.cc.
Referenced by initNodes(), and initShapes().
00036 { 00037 SO_ACTION_INIT_CLASS (IgSoGL2PSAction, SoGLRenderAction); 00038 SO_ACTION_ADD_METHOD (SoIndexedLineSet, indexedLineSet); 00039 SO_ACTION_ADD_METHOD (SoLineSet, lineSet); 00040 SO_ACTION_ADD_METHOD (SoPointSet, pointSet); 00041 SO_ACTION_ADD_METHOD (SoText2, text2); 00042 SO_ACTION_ADD_METHOD (SoMarkerSet, markerSet); 00043 SO_ACTION_ADD_METHOD (SoSeparator, separatorSet); 00044 }
void IgSoGL2PSAction::lineSet | ( | SoAction * | self, | |
SoNode * | node | |||
) | [static, private] |
Definition at line 68 of file IgSoGL2PSAction.cc.
References gl2psLineWidth(), and value.
00069 { 00070 GLfloat value; 00071 glGetFloatv (GL_LINE_WIDTH, &value); 00072 gl2psLineWidth (value); 00073 node->GLRender ((IgSoGL2PSAction *)self); 00074 }
void IgSoGL2PSAction::markerSet | ( | SoAction * | self, | |
SoNode * | node | |||
) | [static, private] |
Definition at line 159 of file IgSoGL2PSAction.cc.
References gl2psDrawImageMap(), NULL, size, and state.
00160 { 00161 SoMarkerSet *markerSet = (SoMarkerSet*) node; 00162 SoState *state = self->getState (); 00163 state->push (); 00164 00165 SoVertexProperty *vernode = static_cast<SoVertexProperty *>( 00166 markerSet->vertexProperty.getValue ()); 00167 int starti = 0; 00168 int pointn = vernode->vertex.getNum (); 00169 00170 const SbVec3f *position = vernode->vertex.getValues (starti); 00171 00172 SbColor color; 00173 int totalMarkers = markerSet->markerIndex.getNum (); 00174 int totalColors = vernode->orderedRGBA.getNum (); 00175 00176 if (totalColors > 0) 00177 { 00178 float transparency; 00179 color.setPackedValue (*(vernode->orderedRGBA.getValues (starti)), 00180 transparency); 00181 } 00182 else 00183 { 00184 const SoCoordinateElement *coordinateElement = 00185 SoCoordinateElement::getInstance (state); 00186 if (coordinateElement == NULL) return; 00187 00188 color = SoLazyElement::getDiffuse (state, 0); 00189 } 00190 glPushAttrib ((GLbitfield)(GL_CURRENT_BIT | GL_ENABLE_BIT)); 00191 glDisable (GL_LIGHTING); 00192 glColor3fv (color.getValue ()); 00193 glPixelStorei (GL_UNPACK_ALIGNMENT, 1); 00194 00195 while (starti < pointn) 00196 { 00197 SbBool isLSBFirst; 00198 SbVec2s size; 00199 const unsigned char *image; 00200 00201 if ((totalColors > 0) && (starti < totalColors)) 00202 { 00203 SbColor color1; 00204 float transparency; 00205 color1.setPackedValue (*(vernode->orderedRGBA.getValues (starti)), 00206 transparency); 00207 if (color1 != color) 00208 { 00209 color = color1; 00210 glPixelStorei (GL_UNPACK_ALIGNMENT, 4); 00211 glColor3fv (color.getValue ()); 00212 glPixelStorei (GL_UNPACK_ALIGNMENT, 1); 00213 } 00214 } 00215 00216 if (starti < totalMarkers) 00217 markerSet->getMarker (markerSet->markerIndex [starti], size, image, isLSBFirst); 00218 else 00219 markerSet->getMarker (markerSet->markerIndex [totalMarkers - 1], size, image, isLSBFirst); 00220 00221 gl2psDrawImageMap (size [0], size [1], 00222 position->getValue (), image); 00223 ++position; ++starti; 00224 } 00225 00226 glPixelStorei (GL_UNPACK_ALIGNMENT, 4); 00227 glPopAttrib (); 00228 state->pop (); 00229 }
void IgSoGL2PSAction::pointSet | ( | SoAction * | self, | |
SoNode * | node | |||
) | [static, private] |
Definition at line 77 of file IgSoGL2PSAction.cc.
References gl2psPointSize(), and value.
00078 { 00079 GLfloat value; 00080 glGetFloatv (GL_POINT_SIZE, &value); 00081 gl2psPointSize (value); 00082 node->GLRender ((IgSoGL2PSAction *)self); 00083 }
void IgSoGL2PSAction::separatorSet | ( | SoAction * | self, | |
SoNode * | node | |||
) | [static, private] |
IgSoGL2PSAction::SO_ACTION_HEADER | ( | IgSoGL2PSAction | ) | [private] |
void IgSoGL2PSAction::text2 | ( | SoAction * | self, | |
SoNode * | node | |||
) | [static, private] |
Definition at line 86 of file IgSoGL2PSAction.cc.
References alignment, f, DBSPlugin::get(), GL2PS_TEXT_C, GL2PS_TEXT_CL, GL2PS_TEXT_CR, gl2psTextOpt(), i, and state.
00087 { 00088 SoText2 *text = (SoText2 *) node; 00089 SoState * state = self->getState (); 00090 state->push (); 00091 00092 SbName fontName = SoFontNameElement::get(state); 00093 if (fontName == SoFontNameElement::getDefault ()) 00094 fontName = "Courier"; 00095 00096 int fontSize = static_cast<short>(SoFontSizeElement::get (state)); 00097 int alignment = GL2PS_TEXT_C; 00098 switch (text->justification.getValue ()) 00099 { 00100 case 1: 00101 alignment = GL2PS_TEXT_CL; 00102 break; 00103 case 2: 00104 alignment = GL2PS_TEXT_CR; 00105 break; 00106 case 3: 00107 alignment = GL2PS_TEXT_C; 00108 default: 00109 break; 00110 } 00111 00112 SbVec3f nilpoint (0.0f, 0.0f, 0.0f); 00113 SbColor color = SoLazyElement::getDiffuse (state, 0); 00114 00115 const SbMatrix & mat = SoModelMatrixElement::get (state); 00116 const SbMatrix & projmatrix = (mat * SoViewingMatrixElement::get (state) * 00117 SoProjectionMatrixElement::get (state)); 00118 const SbViewportRegion & vp = SoViewportRegionElement::get (state); 00119 SbVec2s vpsize = vp.getViewportSizePixels (); 00120 00121 projmatrix.multVecMatrix (nilpoint, nilpoint); 00122 nilpoint [0] = (nilpoint [0] + 1.0f) * 0.5f * vpsize [0]; 00123 nilpoint [1] = (nilpoint [1] + 1.0f) * 0.5f * vpsize [1]; 00124 00125 // Set new state. 00126 glPushAttrib ((GLbitfield)(GL_CURRENT_BIT | GL_ENABLE_BIT)); 00127 glDisable (GL_LIGHTING); 00128 glColor3fv (color.getValue ()); 00129 glMatrixMode (GL_MODELVIEW); 00130 glPushMatrix (); 00131 glLoadIdentity (); 00132 glMatrixMode (GL_PROJECTION); 00133 glPushMatrix (); 00134 glLoadIdentity (); 00135 glOrtho (0, vpsize [0], 0, vpsize [1], -1.0f, 1.0f); 00136 glPixelStorei (GL_UNPACK_ALIGNMENT, 1); 00137 00138 const int nrlines = text->string.getNum (); 00139 for (int i = 0; i < nrlines; ++i) 00140 { 00141 SbString str = text->string [i]; 00142 glRasterPos3f (nilpoint [0], nilpoint [1], -nilpoint [2]); 00143 00144 gl2psTextOpt (str.getString (), 00145 fontName.getString (), fontSize, 00146 alignment, 0.F); 00147 nilpoint [1] -= (fontSize * text->spacing.getValue ()); 00148 } 00149 glPixelStorei (GL_UNPACK_ALIGNMENT, 4); 00150 glMatrixMode (GL_PROJECTION); 00151 glPopMatrix (); 00152 glMatrixMode (GL_MODELVIEW); 00153 glPopMatrix (); 00154 glPopAttrib (); 00155 state->pop (); 00156 }