Geant4 11.2.2
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
SoStyleCache Class Reference

#include <SoStyleCache.h>

+ Inheritance diagram for SoStyleCache:

Public Member Functions

 SoStyleCache ()
 
SoMaterial * getMaterial (const SbColor &, float=0)
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
 
SoMaterial * getMaterial (float, float, float, float=0)
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
 
SoDrawStyle * getLineStyle (unsigned short=0xFFFF, float=0)
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
 
SoLightModel * getLightModelPhong ()
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
 
SoLightModel * getLightModelBaseColor ()
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
 
SoResetTransform * getResetTransform ()
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
 

Protected Member Functions

 ~SoStyleCache ()
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
 

Detailed Description

Definition at line 43 of file SoStyleCache.h.

Constructor & Destructor Documentation

◆ SoStyleCache()

SoStyleCache::SoStyleCache ( )

Definition at line 42 of file SoStyleCache.cc.

44:fMaterials(0)
45,fLineStyles(0)
46,fLightModels(0)
47,fResetTransform(0)
48//////////////////////////////////////////////////////////////////////////////
49//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
50{
51 fMaterials = new SoGroup;
52 addChild(fMaterials);
53 fLineStyles = new SoGroup;
54 addChild(fLineStyles);
55 fLightModels = new SoGroup;
56 addChild(fLightModels);
57 fResetTransform = new SoResetTransform;
58 addChild(fResetTransform);
59}

Referenced by SoStyleCache().

◆ ~SoStyleCache()

SoStyleCache::~SoStyleCache ( )
protected

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Definition at line 61 of file SoStyleCache.cc.

65{
66}

Referenced by ~SoStyleCache().

Member Function Documentation

◆ getLightModelBaseColor()

SoLightModel * SoStyleCache::getLightModelBaseColor ( )

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Definition at line 191 of file SoStyleCache.cc.

195{
196 SoLightModel* lightModel = new SoLightModel;
197 lightModel->model.setValue(SoLightModel::BASE_COLOR);
198 fLightModels->addChild(lightModel);
199 return lightModel;
200}

Referenced by getLightModelBaseColor().

◆ getLightModelPhong()

SoLightModel * SoStyleCache::getLightModelPhong ( )

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Definition at line 180 of file SoStyleCache.cc.

184{
185 SoLightModel* lightModel = new SoLightModel;
186 lightModel->model.setValue(SoLightModel::PHONG);
187 fLightModels->addChild(lightModel);
188 return lightModel;
189}

Referenced by getLightModelPhong().

◆ getLineStyle()

SoDrawStyle * SoStyleCache::getLineStyle ( unsigned short aPattern = 0xFFFF,
float aWidth = 0 )

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Definition at line 156 of file SoStyleCache.cc.

162{
163 int number = fLineStyles->getNumChildren();
164 for(int index=0;index<number;index++) {
165 SoDrawStyle* drawStyle = (SoDrawStyle*)fLineStyles->getChild(index);
166 if( (drawStyle->style.getValue()==SoDrawStyle::LINES) &&
167 (drawStyle->lineWidth.getValue()==aWidth) &&
168 (drawStyle->linePattern.getValue()==aPattern) ) {
169 return drawStyle;
170 }
171 }
172 SoDrawStyle* drawStyle = new SoDrawStyle;
173 drawStyle->style.setValue(SoDrawStyle::LINES);
174 drawStyle->lineWidth.setValue(aWidth);
175 drawStyle->linePattern.setValue(aPattern);
176 fLineStyles->addChild(drawStyle);
177 return drawStyle;
178}

Referenced by getLineStyle().

◆ getMaterial() [1/2]

SoMaterial * SoStyleCache::getMaterial ( const SbColor & aRGB,
float aTransparency = 0 )

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Definition at line 68 of file SoStyleCache.cc.

74{
75 int number = fMaterials->getNumChildren();
76 for(int index=0;index<number;index++) {
77 SoMaterial* material = (SoMaterial*)fMaterials->getChild(index);
78 if( (material->diffuseColor[0]==aRGB) &&
79 (material->transparency[0]==aTransparency) ) {
80 return material;
81 }
82 }
83 SoMaterial* material = new SoMaterial;
84 material->diffuseColor.setValue(aRGB);
85 material->transparency.setValue(aTransparency);
86 fMaterials->addChild(material);
87 return material;
88}

Referenced by getMaterial(), and getMaterial().

◆ getMaterial() [2/2]

SoMaterial * SoStyleCache::getMaterial ( float aRed,
float aGreen,
float aBlue,
float aTransparency = 0 )

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Definition at line 90 of file SoStyleCache.cc.

98{
99 SbColor aRGB(aRed,aGreen,aBlue);
100 int number = fMaterials->getNumChildren();
101 for(int index=0;index<number;index++) {
102 SoMaterial* material = (SoMaterial*)fMaterials->getChild(index);
103 if( (material->diffuseColor[0]==aRGB) &&
104 (material->transparency[0]==aTransparency) ) {
105 return material;
106 }
107 }
108 SoMaterial* material = new SoMaterial;
109 material->diffuseColor.setValue(aRGB);
110 material->transparency.setValue(aTransparency);
111 fMaterials->addChild(material);
112 return material;
113}

◆ getResetTransform()

SoResetTransform * SoStyleCache::getResetTransform ( )

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Definition at line 202 of file SoStyleCache.cc.

206{
207 return fResetTransform;
208}

Referenced by getResetTransform().


The documentation for this class was generated from the following files: