Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

osg::GradientBackground Class Reference
[Backgrounds]

Background clearing with a color gradient. See Background for a description. More...

#include <OSGGradientBackground.h>

Inheritance diagram for osg::GradientBackground:

osg::GradientBackgroundBase osg::Background osg::BackgroundBase osg::AttachmentContainer osg::FieldContainer List of all members.

Public Types

typedef GradientBackgroundPtr Ptr
enum  { ColorFieldId = Inherited::NextFieldId, PositionFieldId = ColorFieldId + 1, NextFieldId = PositionFieldId + 1 }

Public Member Functions

your_category
*void clear (DrawActionBase *, Viewport *)
void addLine (Color3f color, Real32 position)
void clearLines (void)
transformation
*virtual void changed (BitVector whichField, UInt32 origin)
dump
*virtual void dump (UInt32 uiIndent=0, const BitVector bvFlags=0) const
FieldContainer Get
*virtual FieldContainerTypegetType (void)
virtual const FieldContainerTypegetType (void) const
virtual UInt32 getContainerSize (void) const
Binary Access
*virtual UInt32 getBinSize (const BitVector &whichField)
virtual void copyToBin (BinaryDataHandler &pMem, const BitVector &whichField)
virtual void copyFromBin (BinaryDataHandler &pMem, const BitVector &whichField)
Copy
*virtual FieldContainerPtr shallowCopy (void) const

Static Public Member Functions

Class Get
*static const char * getClassname (void)
Class Get
*static FieldContainerTypegetClassType (void)
 access the type of the class
static UInt32 getClassTypeId (void)
 access the numerical type of the class
Construction
*static GradientBackgroundPtr create (void)
 create a new instance of the class
static GradientBackgroundPtr createEmpty (void)
 create an empty new instance of the class, do not copy the prototype

Static Public Attributes

static const osg::BitVector LineFieldMask
static const osg::BitVector ColorFieldMask
static const osg::BitVector PositionFieldMask
static const osg::BitVector MTInfluenceMask
static const BitVector AttachmentsFieldMask
static const BitVector NextFieldMask

Protected Member Functions

Constructors
GradientBackground (void)
 GradientBackground (const GradientBackground &source)
Destructors
*virtual ~GradientBackground (void)
Field Get
*MFColor3fgetMFColor (void)
 Get the GradientBackground::_mfColor field.
MFReal32getMFPosition (void)
 Get the GradientBackground::_mfPosition field.
Color3fgetColor (UInt32 index)
 Get the value of the index element the GradientBackground::_mfColor field.
MFColor3fgetColor (void)
 Get the GradientBackground::_mfColor field.
const MFColor3fgetColor (void) const
 Get the GradientBackground::_mfColor field.
Real32getPosition (UInt32 index)
 Get the value of the index element the GradientBackground::_mfPosition field.
MFReal32getPosition (void)
 Get the GradientBackground::_mfPosition field.
const MFReal32getPosition (void) const
 Get the GradientBackground::_mfPosition field.
Sync
*void executeSyncImpl (GradientBackgroundBase *pOther, const BitVector &whichField)
virtual void executeSync (FieldContainer &other, const BitVector &whichField)

Protected Attributes

Fields
*MFColor3f _mfColor
MFReal32 _mfPosition

Private Types

typedef GradientBackgroundBase Inherited

Private Member Functions

void operator= (const GradientBackground &source)

Static Private Member Functions

static void initMethod (void)

Friends

class FieldContainer
class GradientBackgroundBase

Detailed Description

A background showing a vertical color gradient, see Gradient Background.

The colors (_mfColor) and positions (_mfPosition) correspond to each other, so both have to have the same number of elements. The addColor() method should be used for defining the gradient, as it ensures that constarint.

Definition at line 59 of file OSGGradientBackground.h.


Member Typedef Documentation

typedef GradientBackgroundBase osg::GradientBackground::Inherited [private]
 

Reimplemented from osg::GradientBackgroundBase.

Definition at line 123 of file OSGGradientBackground.h.

typedef GradientBackgroundPtr osg::GradientBackgroundBase::Ptr [inherited]
 

Reimplemented from osg::BackgroundBase.

Definition at line 91 of file OSGGradientBackgroundBase.h.


Member Enumeration Documentation

anonymous enum [inherited]
 

Enumerator:
ColorFieldId 
PositionFieldId 
NextFieldId 

Reimplemented from osg::AttachmentContainer.

Definition at line 93 of file OSGGradientBackgroundBase.h.

00094     {
00095         ColorFieldId    = Inherited::NextFieldId,
00096         PositionFieldId = ColorFieldId    + 1,
00097         NextFieldId     = PositionFieldId + 1
00098     };


Constructor & Destructor Documentation

GradientBackground::GradientBackground void   )  [protected]
 

Definition at line 101 of file OSGGradientBackground.cpp.

00101                                            :
00102     Inherited()
00103 {
00104 }

GradientBackground::GradientBackground const GradientBackground source  )  [protected]
 

Definition at line 106 of file OSGGradientBackground.cpp.

00106                                                                        :
00107     Inherited(source)
00108 {
00109 }

GradientBackground::~GradientBackground void   )  [protected, virtual]
 

Definition at line 111 of file OSGGradientBackground.cpp.

00112 {
00113 }


Member Function Documentation

* static const char* osg::GradientBackground::getClassname void   )  [inline, static]
 

Reimplemented from osg::Background.

Definition at line 71 of file OSGGradientBackground.h.

00071 { return "GradientBackground"; };

void GradientBackground::clear DrawActionBase ,
Viewport
[virtual]
 

Implements osg::Background.

Definition at line 122 of file OSGGradientBackground.cpp.

References osg::GradientBackgroundBase::_mfColor, osg::GradientBackgroundBase::_mfPosition, g1, osg::Color3< ValueTypeT >::getValuesRGB(), GLboolean, and osg::MField< FieldTypeT, fieldNameSpace >::size().

00123 {
00124 
00125     if(_mfPosition.size() < 2)
00126     {
00127         if(_mfPosition.size() == 1)
00128         {
00129             Color3f col = _mfColor[0];
00130             Real32 r, g, b;
00131             col.getValuesRGB(r, g, b);
00132             glClearColor(r, g, b, 1);
00133             glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
00134         }
00135         else
00136         {
00137             glClearColor(0, 0, 0, 1);
00138             glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
00139         }
00140     }
00141     else
00142     {
00143         GLboolean light = glIsEnabled(GL_LIGHTING);
00144         if(light)  
00145             glDisable(GL_LIGHTING);
00146 
00147         GLint fill[2];
00148         glGetIntegerv(GL_POLYGON_MODE, fill);
00149         glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
00150 
00151         GLboolean depth = glIsEnabled(GL_DEPTH_TEST);
00152         glDisable(GL_DEPTH_TEST);
00153 
00154         GLboolean colmat = glIsEnabled(GL_COLOR_MATERIAL);
00155         glDisable(GL_COLOR_MATERIAL);
00156 
00157         glMatrixMode(GL_MODELVIEW);
00158         glPushMatrix();
00159         glLoadIdentity();
00160 
00161         glMatrixMode(GL_PROJECTION);
00162         glPushMatrix();
00163         glLoadIdentity();
00164         glOrtho(0, 1, 0, 1, 0, 1);
00165 
00166         Real32 r1, g1, b1;
00167         UInt32 size = _mfPosition.size();
00168 
00169         glBegin(GL_QUAD_STRIP);
00170         
00171         Real32 pos = _mfPosition[0];
00172         if(pos > 0) 
00173         {
00174             glColor3f(0.0, 0.0, 0.0);
00175             glVertex3f(0, 0, 0);
00176             glVertex3f(1, 0, 0);
00177         }
00178 
00179         for(UInt32 i = 0; i < size; i++)
00180         {
00181             pos = _mfPosition[i];
00182 
00183             Color3f col1 = _mfColor[i];
00184             col1.getValuesRGB(r1, g1, b1);
00185 
00186             glColor3f(r1, g1, b1);
00187             glVertex3f(0, pos, 0);
00188             glVertex3f(1, pos, 0);
00189         }
00190 
00191         if(pos < 1) 
00192         {
00193             glColor3f(0.0, 0.0, 0.0);
00194             glVertex3f(0, 1, 0);
00195             glVertex3f(1, 1, 0);
00196         }
00197         
00198         glEnd();
00199 
00200         glPopMatrix();
00201         glMatrixMode(GL_MODELVIEW);
00202         glPopMatrix();
00203 
00204         if(depth == GL_TRUE)    
00205             glEnable(GL_DEPTH_TEST);
00206         if(light == GL_TRUE)    
00207             glEnable(GL_LIGHTING);
00208         if(colmat == GL_TRUE)   
00209             glEnable(GL_COLOR_MATERIAL);
00210         glPolygonMode(GL_FRONT, fill[0]);
00211         glPolygonMode(GL_BACK , fill[1]);
00212 
00213         glClear(GL_DEPTH_BUFFER_BIT);
00214     }
00215 }

void osg::GradientBackground::addLine Color3f  color,
Real32  position
[inline]
 

Definition at line 47 of file OSGGradientBackground.inl.

References osg::GradientBackgroundBase::_mfColor, osg::GradientBackgroundBase::_mfPosition, and osg::MField< FieldTypeT, fieldNameSpace >::push_back().

00048 {
00049     _mfColor.push_back(col);
00050     _mfPosition.push_back(pos);
00051 }

void osg::GradientBackground::clearLines void   )  [inline]
 

Definition at line 53 of file OSGGradientBackground.inl.

References osg::GradientBackgroundBase::_mfColor, osg::GradientBackgroundBase::_mfPosition, and osg::MField< FieldTypeT, fieldNameSpace >::clear().

00054 {
00055     _mfColor.clear();
00056     _mfPosition.clear();
00057 }

void GradientBackground::changed BitVector  whichField,
UInt32  origin
[virtual]
 

Reimplemented from osg::Background.

Definition at line 115 of file OSGGradientBackground.cpp.

References osg::Background::changed().

00116 {
00117     Inherited::changed(whichField, origin);
00118 }

void GradientBackground::dump UInt32  uiIndent = 0,
const BitVector  bvFlags = 0
const [virtual]
 

Reimplemented from osg::Background.

Definition at line 219 of file OSGGradientBackground.cpp.

References SLOG.

00221 {
00222     SLOG << "Dump GradientBackground NI" << std::endl;
00223 }

void GradientBackground::initMethod void   )  [static, private]
 

Reimplemented from osg::Background.

Definition at line 91 of file OSGGradientBackground.cpp.

00092 {
00093 }

void osg::GradientBackground::operator= const GradientBackground source  )  [private]
 

osg::FieldContainerType & osg::GradientBackgroundBase::getClassType void   )  [inline, static, inherited]
 

Reimplemented from osg::BackgroundBase.

Definition at line 58 of file OSGGradientBackgroundBase.inl.

References osg::GradientBackgroundBase::_type.

Referenced by osg::GradientBackgroundBase::create().

00059 {
00060     return _type; 
00061 } 

osg::UInt32 osg::GradientBackgroundBase::getClassTypeId void   )  [inline, static, inherited]
 

Reimplemented from osg::BackgroundBase.

Definition at line 65 of file OSGGradientBackgroundBase.inl.

References osg::GradientBackgroundBase::_type, and osg::TypeBase::getId().

00066 {
00067     return _type.getId(); 
00068 } 

FieldContainerType & GradientBackgroundBase::getType void   )  [virtual, inherited]
 

Reimplemented from osg::BackgroundBase.

Definition at line 117 of file OSGGradientBackgroundBase.cpp.

References osg::GradientBackgroundBase::_type.

00118 {
00119     return _type; 
00120 } 

const FieldContainerType & GradientBackgroundBase::getType void   )  const [virtual, inherited]
 

Reimplemented from osg::BackgroundBase.

Definition at line 122 of file OSGGradientBackgroundBase.cpp.

References osg::GradientBackgroundBase::_type.

00123 {
00124     return _type;
00125 } 

UInt32 GradientBackgroundBase::getContainerSize void   )  const [virtual, inherited]
 

Reimplemented from osg::BackgroundBase.

Definition at line 137 of file OSGGradientBackgroundBase.cpp.

00138 { 
00139     return sizeof(GradientBackground); 
00140 }

UInt32 GradientBackgroundBase::getBinSize const BitVector whichField  )  [virtual, inherited]
 

Reimplemented from osg::BackgroundBase.

Definition at line 203 of file OSGGradientBackgroundBase.cpp.

References osg::GradientBackgroundBase::_mfColor, osg::GradientBackgroundBase::_mfPosition, osg::GradientBackgroundBase::ColorFieldMask, osg::MField< FieldTypeT, fieldNameSpace >::getBinSize(), osg::BackgroundBase::getBinSize(), osg::FieldBits::NoField, and osg::GradientBackgroundBase::PositionFieldMask.

00204 {
00205     UInt32 returnValue = Inherited::getBinSize(whichField);
00206 
00207     if(FieldBits::NoField != (ColorFieldMask & whichField))
00208     {
00209         returnValue += _mfColor.getBinSize();
00210     }
00211 
00212     if(FieldBits::NoField != (PositionFieldMask & whichField))
00213     {
00214         returnValue += _mfPosition.getBinSize();
00215     }
00216 
00217 
00218     return returnValue;
00219 }

void GradientBackgroundBase::copyToBin BinaryDataHandler pMem,
const BitVector whichField
[virtual, inherited]
 

Reimplemented from osg::BackgroundBase.

Definition at line 221 of file OSGGradientBackgroundBase.cpp.

References osg::GradientBackgroundBase::_mfColor, osg::GradientBackgroundBase::_mfPosition, osg::GradientBackgroundBase::ColorFieldMask, osg::MField< FieldTypeT, fieldNameSpace >::copyToBin(), osg::BackgroundBase::copyToBin(), osg::FieldBits::NoField, and osg::GradientBackgroundBase::PositionFieldMask.

00223 {
00224     Inherited::copyToBin(pMem, whichField);
00225 
00226     if(FieldBits::NoField != (ColorFieldMask & whichField))
00227     {
00228         _mfColor.copyToBin(pMem);
00229     }
00230 
00231     if(FieldBits::NoField != (PositionFieldMask & whichField))
00232     {
00233         _mfPosition.copyToBin(pMem);
00234     }
00235 
00236 
00237 }

void GradientBackgroundBase::copyFromBin BinaryDataHandler pMem,
const BitVector whichField
[virtual, inherited]
 

Reimplemented from osg::BackgroundBase.

Definition at line 239 of file OSGGradientBackgroundBase.cpp.

References osg::GradientBackgroundBase::_mfColor, osg::GradientBackgroundBase::_mfPosition, osg::GradientBackgroundBase::ColorFieldMask, osg::MField< FieldTypeT, fieldNameSpace >::copyFromBin(), osg::BackgroundBase::copyFromBin(), osg::FieldBits::NoField, and osg::GradientBackgroundBase::PositionFieldMask.

00241 {
00242     Inherited::copyFromBin(pMem, whichField);
00243 
00244     if(FieldBits::NoField != (ColorFieldMask & whichField))
00245     {
00246         _mfColor.copyFromBin(pMem);
00247     }
00248 
00249     if(FieldBits::NoField != (PositionFieldMask & whichField))
00250     {
00251         _mfPosition.copyFromBin(pMem);
00252     }
00253 
00254 
00255 }

GradientBackgroundPtr osg::GradientBackgroundBase::create void   )  [inline, static, inherited]
 

Definition at line 72 of file OSGGradientBackgroundBase.inl.

References osg::AttachmentContainerPtr::dcast(), osg::GradientBackgroundBase::getClassType(), osg::FieldContainerType::getPrototype(), osg::NullFC, and osg::GradientBackgroundBase::shallowCopy().

00073 {
00074     GradientBackgroundPtr fc; 
00075 
00076     if(getClassType().getPrototype() != OSG::NullFC) 
00077     {
00078         fc = GradientBackgroundPtr::dcast(
00079             getClassType().getPrototype()-> shallowCopy()); 
00080     }
00081     
00082     return fc; 
00083 }

GradientBackgroundPtr osg::GradientBackgroundBase::createEmpty void   )  [inline, static, inherited]
 

Definition at line 87 of file OSGGradientBackgroundBase.inl.

References osg::FieldContainer::newPtr().

00088 { 
00089     GradientBackgroundPtr returnValue; 
00090     
00091     newPtr(returnValue); 
00092 
00093     return returnValue; 
00094 }

FieldContainerPtr GradientBackgroundBase::shallowCopy void   )  const [virtual, inherited]
 

Implements osg::FieldContainer.

Definition at line 128 of file OSGGradientBackgroundBase.cpp.

References osg::FieldContainer::newPtr().

Referenced by osg::GradientBackgroundBase::create().

00129 { 
00130     GradientBackgroundPtr returnValue; 
00131 
00132     newPtr(returnValue, dynamic_cast<const GradientBackground *>(this)); 
00133 
00134     return returnValue; 
00135 }

MFColor3f * osg::GradientBackgroundBase::getMFColor void   )  [inline, protected, inherited]
 

Definition at line 101 of file OSGGradientBackgroundBase.inl.

References osg::GradientBackgroundBase::_mfColor.

00102 {
00103     return &_mfColor;
00104 }

MFReal32 * osg::GradientBackgroundBase::getMFPosition void   )  [inline, protected, inherited]
 

Definition at line 108 of file OSGGradientBackgroundBase.inl.

References osg::GradientBackgroundBase::_mfPosition.

00109 {
00110     return &_mfPosition;
00111 }

Color3f & osg::GradientBackgroundBase::getColor UInt32  index  )  [inline, protected, inherited]
 

Definition at line 117 of file OSGGradientBackgroundBase.inl.

References osg::GradientBackgroundBase::_mfColor.

00118 {
00119     return _mfColor[index];
00120 }

MFColor3f & osg::GradientBackgroundBase::getColor void   )  [inline, protected, inherited]
 

Definition at line 124 of file OSGGradientBackgroundBase.inl.

References osg::GradientBackgroundBase::_mfColor.

00125 {
00126     return _mfColor;
00127 }

const MFColor3f & osg::GradientBackgroundBase::getColor void   )  const [inline, protected, inherited]
 

Definition at line 131 of file OSGGradientBackgroundBase.inl.

References osg::GradientBackgroundBase::_mfColor.

00132 {
00133     return _mfColor;
00134 }

Real32 & osg::GradientBackgroundBase::getPosition UInt32  index  )  [inline, protected, inherited]
 

Definition at line 138 of file OSGGradientBackgroundBase.inl.

References osg::GradientBackgroundBase::_mfPosition.

00139 {
00140     return _mfPosition[index];
00141 }

MFReal32 & osg::GradientBackgroundBase::getPosition void   )  [inline, protected, inherited]
 

Definition at line 145 of file OSGGradientBackgroundBase.inl.

References osg::GradientBackgroundBase::_mfPosition.

00146 {
00147     return _mfPosition;
00148 }

const MFReal32 & osg::GradientBackgroundBase::getPosition void   )  const [inline, protected, inherited]
 

Definition at line 152 of file OSGGradientBackgroundBase.inl.

References osg::GradientBackgroundBase::_mfPosition.

00153 {
00154     return _mfPosition;
00155 }

void GradientBackgroundBase::executeSyncImpl GradientBackgroundBase pOther,
const BitVector whichField
[protected, inherited]
 

Definition at line 258 of file OSGGradientBackgroundBase.cpp.

References osg::GradientBackgroundBase::_mfColor, osg::GradientBackgroundBase::_mfPosition, osg::GradientBackgroundBase::ColorFieldMask, osg::BackgroundBase::executeSyncImpl(), osg::FieldBits::NoField, osg::GradientBackgroundBase::PositionFieldMask, and osg::MField< FieldTypeT, fieldNameSpace >::syncWith().

Referenced by osg::GradientBackgroundBase::executeSync().

00260 {
00261 
00262     Inherited::executeSyncImpl(pOther, whichField);
00263 
00264     if(FieldBits::NoField != (ColorFieldMask & whichField))
00265         _mfColor.syncWith(pOther->_mfColor);
00266 
00267     if(FieldBits::NoField != (PositionFieldMask & whichField))
00268         _mfPosition.syncWith(pOther->_mfPosition);
00269 
00270 
00271 }

void BackgroundBase::executeSyncImpl BackgroundBase pOther,
const BitVector whichField
[protected, inherited]
 

Definition at line 182 of file OSGBackgroundBase.cpp.

References osg::AttachmentContainer::executeSyncImpl().

Referenced by osg::BackgroundBase::executeSync(), osg::TextureBackgroundBase::executeSyncImpl(), osg::SolidBackgroundBase::executeSyncImpl(), osg::SkyBackgroundBase::executeSyncImpl(), osg::PolygonBackgroundBase::executeSyncImpl(), osg::PassiveBackgroundBase::executeSyncImpl(), osg::ImageBackgroundBase::executeSyncImpl(), osg::GradientBackgroundBase::executeSyncImpl(), and osg::DepthClearBackgroundBase::executeSyncImpl().

00184 {
00185 
00186     Inherited::executeSyncImpl(pOther, whichField);
00187 
00188 
00189 }

void AttachmentContainer::executeSyncImpl AttachmentContainer pOther,
const BitVector whichField
[protected, inherited]
 

Definition at line 316 of file OSGAttachmentContainer.cpp.

References osg::AttachmentContainer::_attachmentMap, osg::AttachmentContainer::AttachmentsFieldMask, osg::FieldContainer::executeSyncImpl(), osg::FieldBits::NoField, and osg::SField< FieldTypeT, fieldNameSpace >::syncWith().

Referenced by osg::AttachmentContainer::executeSync(), osg::WindowBase::executeSyncImpl(), osg::ViewportBase::executeSyncImpl(), osg::ShaderParameterBase::executeSyncImpl(), osg::Node::executeSyncImpl(), osg::NodeCore::executeSyncImpl(), osg::MaterialBase::executeSyncImpl(), osg::ImageComposerBase::executeSyncImpl(), osg::ImageBase::executeSyncImpl(), osg::ForegroundBase::executeSyncImpl(), osg::DisplayCalibrationBase::executeSyncImpl(), osg::CameraBase::executeSyncImpl(), and osg::BackgroundBase::executeSyncImpl().

00319 {
00320     Inherited::executeSyncImpl(pOther, whichField);
00321 
00322     if (FieldBits::NoField != (AttachmentsFieldMask & whichField))
00323     {
00324         _attachmentMap.syncWith(pOther->_attachmentMap);
00325     }
00326 }

void osg::FieldContainer::executeSyncImpl FieldContainer pOther,
const BitVector whichField
[inline, protected, inherited]
 

Definition at line 333 of file OSGFieldContainerImpl.inl.

Referenced by osg::StateBase::executeSyncImpl(), osg::DVRShaderBase::executeSyncImpl(), osg::DVRClipGeometryBase::executeSyncImpl(), osg::AttachmentContainer::executeSyncImpl(), and osg::Attachment::executeSyncImpl().

00335 {
00336 }

void GradientBackgroundBase::executeSync FieldContainer other,
const BitVector whichField
[protected, virtual, inherited]
 

Reimplemented from osg::BackgroundBase.

Definition at line 144 of file OSGGradientBackgroundBase.cpp.

References osg::GradientBackgroundBase::executeSyncImpl().

00146 {
00147     this->executeSyncImpl((GradientBackgroundBase *) &other, whichField);
00148 }

void AttachmentContainer::addAttachment const AttachmentPtr fieldContainerP,
UInt16  binding = 0
[inherited]
 

Definition at line 84 of file OSGAttachmentContainer.cpp.

References osg::addRefCP(), osg::beginEditCP(), osg::endEditCP(), osg::NullFC, and osg::subRefCP().

Referenced by osg::AttachmentContainer::AttachmentContainer(), osg::Node::onCreate(), and osg::Image::setAttachmentField().

00086 {
00087     UInt32 key;
00088 
00089     if(fieldContainerP == NullFC)
00090         return;
00091 
00092     key = (UInt32 (fieldContainerP->getGroupId()) << 16) | binding;
00093 
00094     addRefCP(fieldContainerP);
00095 
00096     beginEditCP(fieldContainerP, Attachment::ParentsFieldMask);
00097     {
00098         fieldContainerP->addParent(getPtr());
00099     }
00100     endEditCP  (fieldContainerP, Attachment::ParentsFieldMask);
00101 
00102     AttachmentMap::iterator fcI = _attachmentMap.getValue().find(key);
00103 
00104     if(fcI != _attachmentMap.getValue().end())
00105     {
00106         beginEditCP((*fcI).second, Attachment::ParentsFieldMask);
00107         {
00108             (*fcI).second->subParent(getPtr());
00109         }
00110         endEditCP  ((*fcI).second, Attachment::ParentsFieldMask);
00111 
00112         subRefCP((*fcI).second);
00113 
00114         (*fcI).second = fieldContainerP;
00115     }
00116     else
00117     {
00118         _attachmentMap.getValue()[key] = fieldContainerP;
00119     }
00120 }

void AttachmentContainer::subAttachment const AttachmentPtr fieldContainerP,
UInt16  binding = 0
[inherited]
 

Definition at line 122 of file OSGAttachmentContainer.cpp.

References osg::AttachmentContainer::_attachmentMap, osg::beginEditCP(), osg::endEditCP(), osg::AttachmentContainer::getPtr(), osg::SField< FieldTypeT, fieldNameSpace >::getValue(), osg::NullFC, osg::Attachment::ParentsFieldMask, and osg::subRefCP().

00124 {
00125     UInt32 key;
00126 
00127     AttachmentMap::iterator fcI;
00128 
00129     if(fieldContainerP == NullFC)
00130         return;
00131 
00132     key = (UInt32(fieldContainerP->getGroupId()) << 16) | binding;
00133 
00134     fcI = _attachmentMap.getValue().find(key);
00135 
00136     if(fcI != _attachmentMap.getValue().end())
00137     {
00138         beginEditCP(fieldContainerP, Attachment::ParentsFieldMask);
00139         {
00140             (*fcI).second->subParent(getPtr());
00141         }
00142         endEditCP  (fieldContainerP, Attachment::ParentsFieldMask);
00143 
00144         subRefCP((*fcI).second);
00145 
00146         _attachmentMap.getValue().erase(fcI);
00147     }
00148 }

AttachmentPtr AttachmentContainer::findAttachment UInt32  groupId,
UInt16  binding = 0
[inherited]
 

Definition at line 150 of file OSGAttachmentContainer.cpp.

References osg::AttachmentContainer::_attachmentMap, osg::SField< FieldTypeT, fieldNameSpace >::getValue(), and osg::NullFC.

Referenced by osg::Image::findAttachmentField(), and osg::Image::setAttachmentField().

00152 {
00153     UInt32 key = (UInt32(groupId) << 16) | binding;
00154 
00155     AttachmentMap::iterator fcI = _attachmentMap.getValue().find(key);
00156 
00157     if(fcI == _attachmentMap.getValue().end())
00158     {
00159         return NullFC;
00160     }
00161     else
00162     {
00163         return (*fcI).second;
00164     }
00165 }

AttachmentPtr osg::AttachmentContainer::findAttachment const FieldContainerType type,
UInt16  binding = 0
[inline, inherited]
 

Definition at line 57 of file OSGAttachmentContainerImpl.inl.

00060 {
00061     return findAttachment(type.getGroupId(), binding);
00062 }

SFAttachmentMap * AttachmentContainer::getSFAttachments void   )  [inherited]