CMS 3D CMS Logo

VisDetTextureTwig Class Reference

#include <VisReco/VisDetector/interface/VisDetTextureTwig.h>

Inheritance diagram for VisDetTextureTwig:

IgSimpleTwig IgCompoundTwig IgTwig IgRepresentable

List of all members.

Public Member Functions

virtual void twigChanged (void)
virtual void update (IgRZRep *rep)
virtual void update (IgRPhiRep *rep)
virtual void update (Ig3DRep *rep)
 VisDetTextureTwig (IgState *state, IgTwig *parent, std::string name, std::string fileName1="", std::string fileName2="", std::string fileName3="")
 ~VisDetTextureTwig (void)

Private Attributes

bool m_done3D
bool m_doneRPhi
bool m_doneRZ
std::string m_fileName1
std::string m_fileName2
std::string m_fileName3
std::string m_name
VisTexture m_texture


Detailed Description

Definition at line 22 of file VisDetTextureTwig.h.


Constructor & Destructor Documentation

VisDetTextureTwig::VisDetTextureTwig ( IgState state,
IgTwig parent,
std::string  name,
std::string  fileName1 = "",
std::string  fileName2 = "",
std::string  fileName3 = "" 
)

Definition at line 35 of file VisDetTextureTwig.cc.

References m_fileName1, m_fileName2, m_fileName3, m_texture, and VisActiveConfigurable< T >::value().

00038     : IgSimpleTwig (parent, name, true, false, true),
00039       m_name (name),
00040       m_fileName1 (fileName1),
00041       m_fileName2 (fileName2),
00042       m_fileName3 (fileName3),
00043       m_done3D (false),
00044       m_doneRPhi (false),
00045       m_doneRZ (false),
00046       m_texture (state, lat::CreateCallback (this, &VisDetTextureTwig::twigChanged))
00047 {
00048     std::string tname = m_texture.value ();
00049     m_fileName1 = tname + ".3d.tga";
00050     m_fileName2 = tname + ".rphi.tga";
00051     m_fileName3 = tname + ".rz.tga";    
00052 }

VisDetTextureTwig::~VisDetTextureTwig ( void   ) 

Definition at line 59 of file VisDetTextureTwig.cc.

00060 {}


Member Function Documentation

void VisDetTextureTwig::twigChanged ( void   )  [virtual]

Definition at line 55 of file VisDetTextureTwig.cc.

References IgRepSet::invalidate(), and IgTwig::SELF_MASK.

00056 { IgRepSet::invalidate (this, SELF_MASK); }

void VisDetTextureTwig::update ( IgRZRep rep  )  [virtual]

Definition at line 172 of file VisDetTextureTwig.cc.

References Ig3DBaseRep::clear(), m_fileName3, and Ig3DBaseRep::node().

00173 {
00174     IgQtLock ();
00175     rep->clear ();
00176     SoSeparator *sep = new SoSeparator;
00177 
00178     SoTexture2* skin = new SoTexture2;
00179     skin->model.setValue (SoTexture2::DECAL);
00180     skin->filename.setValue (SbString (m_fileName3.c_str ()));
00181     sep->addChild (skin);
00182 
00183     // Define the square's spatial coordinates
00184     SoCoordinate3 *coord = new SoCoordinate3;
00185     sep->addChild(coord);
00186     coord->point.set1Value(0, SbVec3f(-10, -8, -12));
00187     coord->point.set1Value(1, SbVec3f(-10,  8, -12));
00188     coord->point.set1Value(2, SbVec3f(-10,  8,  12));
00189     coord->point.set1Value(3, SbVec3f(-10, -8,  12));
00190 
00191     // Define the square's normal
00192     SoNormal *normal = new SoNormal;
00193     sep->addChild(normal);
00194     normal->vector.set1Value(0, SbVec3f(0, 0, 1));
00195     
00196     // Define the square's texture coordinates
00197     SoTextureCoordinate2 *texCoord = new SoTextureCoordinate2;
00198     sep->addChild(texCoord);
00199 // //     texCoord->point.set1Value(0, SbVec2f(0, 0));
00200 // //     texCoord->point.set1Value(1, SbVec2f(1, 0));
00201 // //     texCoord->point.set1Value(2, SbVec2f(1, 1));
00202 // //     texCoord->point.set1Value(3, SbVec2f(0, 1));
00203 //     texCoord->point.set1Value(0, SbVec2f(1, 0));
00204 //     texCoord->point.set1Value(1, SbVec2f(1, 1));
00205 //     texCoord->point.set1Value(2, SbVec2f(0, 1));
00206 //     texCoord->point.set1Value(3, SbVec2f(0, 0));
00207     texCoord->point.set1Value(0, SbVec2f(1, 1));
00208     texCoord->point.set1Value(1, SbVec2f(0, 1));
00209     texCoord->point.set1Value(2, SbVec2f(0, 0));
00210     texCoord->point.set1Value(3, SbVec2f(1, 0));
00211     
00212     // Define normal and texture coordinate bindings
00213     SoNormalBinding *nBind = new SoNormalBinding;
00214     SoTextureCoordinateBinding *tBind =
00215         new SoTextureCoordinateBinding;
00216     sep->addChild(nBind);
00217     sep->addChild(tBind);
00218     nBind->value.setValue(SoNormalBinding::OVERALL);
00219     tBind->value.setValue 
00220         (SoTextureCoordinateBinding::PER_VERTEX);
00221 
00222     // Define a FaceSet
00223     SoFaceSet *myFaceSet = new SoFaceSet;
00224     sep->addChild(myFaceSet);
00225     myFaceSet->numVertices.set1Value(0, 4);
00226     rep->node ()->addChild (sep);
00227 }

void VisDetTextureTwig::update ( IgRPhiRep rep  )  [virtual]

Definition at line 122 of file VisDetTextureTwig.cc.

References Ig3DBaseRep::clear(), m_fileName2, and Ig3DBaseRep::node().

00123 {
00124     IgQtLock ();
00125     rep->clear ();
00126 
00127     SoSeparator *sep = new SoSeparator;
00128     SoTexture2* skin = new SoTexture2;
00129     skin->model.setValue (SoTexture2::DECAL);
00130     skin->filename.setValue (SbString (m_fileName2.c_str ()));
00131     sep->addChild (skin);
00132 
00133     // Define the square's spatial coordinates
00134     SoCoordinate3 *coord = new SoCoordinate3;
00135     sep->addChild(coord);
00136     coord->point.set1Value(0, SbVec3f(-8, -7.5, -10));
00137     coord->point.set1Value(1, SbVec3f( 8, -7.5, -10));
00138     coord->point.set1Value(2, SbVec3f( 8,  7.5, -10));
00139     coord->point.set1Value(3, SbVec3f(-8,  7.5, -10));
00140 
00141     // Define the square's normal
00142     SoNormal *normal = new SoNormal;
00143     sep->addChild(normal);
00144     normal->vector.set1Value(0, SbVec3f(0, 0, 1));
00145     
00146     // Define the square's texture coordinates
00147     SoTextureCoordinate2 *texCoord = new SoTextureCoordinate2;
00148     sep->addChild(texCoord);
00149     texCoord->point.set1Value(0, SbVec2f(1, 1));
00150     texCoord->point.set1Value(1, SbVec2f(0, 1));
00151     texCoord->point.set1Value(2, SbVec2f(0, 0));
00152     texCoord->point.set1Value(3, SbVec2f(1, 0));
00153     
00154     // Define normal and texture coordinate bindings
00155     SoNormalBinding *nBind = new SoNormalBinding;
00156     SoTextureCoordinateBinding *tBind =
00157         new SoTextureCoordinateBinding;
00158     sep->addChild(nBind);
00159     sep->addChild(tBind);
00160     nBind->value.setValue(SoNormalBinding::OVERALL);
00161     tBind->value.setValue 
00162         (SoTextureCoordinateBinding::PER_VERTEX);
00163 
00164     // Define a FaceSet
00165     SoFaceSet *myFaceSet = new SoFaceSet;
00166     sep->addChild(myFaceSet);
00167     myFaceSet->numVertices.set1Value(0, 4);
00168     rep->node ()->addChild (sep);
00169 }

void VisDetTextureTwig::update ( Ig3DRep rep  )  [virtual]

Definition at line 63 of file VisDetTextureTwig.cc.

References Ig3DBaseRep::clear(), m_fileName1, and Ig3DBaseRep::node().

00064 {
00065     IgQtLock ();
00066     rep->clear ();
00067 
00068     SoSeparator *sep = new SoSeparator;
00069 
00070     SoTexture2* skin = new SoTexture2;
00071     skin->model.setValue (SoTexture2::DECAL);
00072     skin->filename.setValue (SbString (m_fileName1.c_str ()));
00073     sep->addChild (skin);
00074 
00075     // Define the square's spatial coordinates
00076     SoCoordinate3 *coord = new SoCoordinate3;
00077     sep->addChild(coord);
00078     coord->point.set1Value(0, SbVec3f(-8, -8, 0));
00079     coord->point.set1Value(1, SbVec3f( 8, -8, 0));
00080     coord->point.set1Value(2, SbVec3f( 8,  8, 0));
00081     coord->point.set1Value(3, SbVec3f(-8,  8, 0));
00082 
00083     // Define the square's normal
00084     SoNormal *normal = new SoNormal;
00085     sep->addChild(normal);
00086     normal->vector.set1Value(0, SbVec3f(0, 0, 1));
00087     
00088     // Define the square's texture coordinates
00089     SoTextureCoordinate2 *texCoord = new SoTextureCoordinate2;
00090     sep->addChild(texCoord);
00091 // //     texCoord->point.set1Value(0, SbVec2f(0, 0));
00092 // //     texCoord->point.set1Value(1, SbVec2f(1, 0));
00093 // //     texCoord->point.set1Value(2, SbVec2f(1, 1));
00094 // //     texCoord->point.set1Value(3, SbVec2f(0, 1));
00095 //     texCoord->point.set1Value(0, SbVec2f(1, 0));
00096 //     texCoord->point.set1Value(1, SbVec2f(1, 1));
00097 //     texCoord->point.set1Value(2, SbVec2f(0, 1));
00098 //     texCoord->point.set1Value(3, SbVec2f(0, 0));
00099     texCoord->point.set1Value(0, SbVec2f(1, 1));
00100     texCoord->point.set1Value(1, SbVec2f(0, 1));
00101     texCoord->point.set1Value(2, SbVec2f(0, 0));
00102     texCoord->point.set1Value(3, SbVec2f(1, 0));
00103     
00104     // Define normal and texture coordinate bindings
00105     SoNormalBinding *nBind = new SoNormalBinding;
00106     SoTextureCoordinateBinding *tBind =
00107         new SoTextureCoordinateBinding;
00108     sep->addChild(nBind);
00109     sep->addChild(tBind);
00110     nBind->value.setValue(SoNormalBinding::OVERALL);
00111     tBind->value.setValue 
00112         (SoTextureCoordinateBinding::PER_VERTEX);
00113 
00114     // Define a FaceSet
00115     SoFaceSet *myFaceSet = new SoFaceSet;
00116     sep->addChild(myFaceSet);
00117     myFaceSet->numVertices.set1Value(0, 4);
00118     rep->node ()->addChild (sep);
00119 }


Member Data Documentation

bool VisDetTextureTwig::m_done3D [private]

Definition at line 43 of file VisDetTextureTwig.h.

bool VisDetTextureTwig::m_doneRPhi [private]

Definition at line 44 of file VisDetTextureTwig.h.

bool VisDetTextureTwig::m_doneRZ [private]

Definition at line 45 of file VisDetTextureTwig.h.

std::string VisDetTextureTwig::m_fileName1 [private]

Definition at line 40 of file VisDetTextureTwig.h.

Referenced by update(), and VisDetTextureTwig().

std::string VisDetTextureTwig::m_fileName2 [private]

Definition at line 41 of file VisDetTextureTwig.h.

Referenced by update(), and VisDetTextureTwig().

std::string VisDetTextureTwig::m_fileName3 [private]

Definition at line 42 of file VisDetTextureTwig.h.

Referenced by update(), and VisDetTextureTwig().

std::string VisDetTextureTwig::m_name [private]

Reimplemented from IgSimpleTwig.

Definition at line 39 of file VisDetTextureTwig.h.

VisTexture VisDetTextureTwig::m_texture [private]

Definition at line 46 of file VisDetTextureTwig.h.

Referenced by VisDetTextureTwig().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:35:17 2009 for CMSSW by  doxygen 1.5.4