CMS 3D CMS Logo

IgSoQuad.cc

Go to the documentation of this file.
00001 //<<<<<< INCLUDES                                                       >>>>>>
00002 
00003 #include "Iguana/Inventor/interface/IgSoQuad.h"
00004 #include "Inventor/nodes/SoVertexProperty.h"
00005 #include "Inventor/nodes/SoFaceSet.h"
00006 
00007 //<<<<<< PRIVATE DEFINES                                                >>>>>>
00008 //<<<<<< PRIVATE CONSTANTS                                              >>>>>>
00009 //<<<<<< PRIVATE TYPES                                                  >>>>>>
00010 //<<<<<< PRIVATE VARIABLE DEFINITIONS                                   >>>>>>
00011 //<<<<<< PUBLIC VARIABLE DEFINITIONS                                    >>>>>>
00012 //<<<<<< CLASS STRUCTURE INITIALIZATION                                 >>>>>>
00013 
00014 SO_KIT_SOURCE (IgSoQuad);
00015 
00016 //<<<<<< PRIVATE FUNCTION DEFINITIONS                                   >>>>>>
00017 //<<<<<< PUBLIC FUNCTION DEFINITIONS                                    >>>>>>
00018 //<<<<<< MEMBER FUNCTION DEFINITIONS                                    >>>>>>
00019 
00020 void
00021 IgSoQuad::initClass (void)
00022 { SO_KIT_INIT_CLASS (IgSoQuad, IgSoShapeKit, "IgSoShapeKit"); }
00023 
00024 IgSoQuad::IgSoQuad (void)
00025 {
00026     SO_KIT_CONSTRUCTOR (IgSoQuad);
00027     SO_KIT_ADD_FIELD (llCornerOffset, (-0.5f, -0.5f));
00028     SO_KIT_ADD_FIELD (lrCornerOffset, (0.5f, -0.5f));
00029     SO_KIT_ADD_FIELD (urCornerOffset, (0.5f, 0.5f));
00030     SO_KIT_ADD_FIELD (ulCornerOffset, (-0.5f, 0.5f));
00031     SO_KIT_ADD_CATALOG_ENTRY (face, SoFaceSet, FALSE, separator,\x0, TRUE);
00032     SO_KIT_INIT_INSTANCE ();
00033     setUpConnections (true, true);
00034 }
00035 
00036 void
00037 IgSoQuad::refresh (void)
00038 {
00039     SoFaceSet           *face = new SoFaceSet;
00040     SoVertexProperty    *vtx = new SoVertexProperty;
00041     SbVec2f             ll = llCornerOffset.getValue ();
00042     SbVec2f             lr = lrCornerOffset.getValue ();
00043     SbVec2f             ul = ulCornerOffset.getValue ();
00044     SbVec2f             ur = urCornerOffset.getValue ();
00045 
00046     vtx->vertex.set1Value (0, SbVec3f (ll [0], ll [1], 0));
00047     vtx->vertex.set1Value (1, SbVec3f (ul [0], ul [1], 0));
00048     vtx->vertex.set1Value (2, SbVec3f (ur [0], ur [1], 0));
00049     vtx->vertex.set1Value (3, SbVec3f (lr [0], lr [1], 0));
00050     vtx->normal = SbVec3f (0, 0, 1);
00051     vtx->normalBinding = SoVertexProperty::OVERALL;
00052 
00053     face->numVertices = 4;
00054     face->vertexProperty = vtx;
00055 
00056     setPart ("face", face);
00057 }

Generated on Tue Jun 9 17:38:47 2009 for CMSSW by  doxygen 1.5.4