Hi Björn,
I understand your problem.
You can find excerpts from the OpenSG source concerning side-effects of
set-methods in FieldContainers with Base-classes
(and the script used for rough extraction).
There are different types of side effects in set-methods (sorted by
occurences):
(1) modification of reference counts (FresnelMaterial::setImage,
CubeTextureChunk::setPosZImage/::setPosXImage/::setNegXImage/..,
TextureChunk::setImage,
Geometry::setTypes/::setLengths/::setPositions/../::setMaterial,
Particles::setPositions/../::setMaterial, Slices::setMaterial,
MaterialGroup::setMaterial, DVRVolume::setAppearance/..,
DVRVolumeTexture::setImage)
(2) legacy methods mapping to a sequence of field set-methods
(TileCameraDecorator::setSize/::setFullSize, Viewport::setSize,
Window::setSize,
DirectionaLight::setDirection, Light::setAmbient/../::setSpecular,
PointLight::setPosition/..,
SpotLight::setSpotDirection/::setSpotCutOffDeg)
(3) important set-methods (OSGNode.cpp, field Core, Parent)
An approach for (3) would be to have some special cases when accessing
field containers.
For example Node.
The set-methods in (2) can be safely ignored as they are not accessible
in your application and have to be mapped to a
corresponding sequence of set-methods in your application/script.
The set-methods in (1) are critical. You have to devise a special
mechanism for reference counts here,
e.g. separate cases where the old value is subrefed and the new value is
addrefed.
I am not sure if these problems can be solved completely generic (e.g.
by changed-method)?!
Hope it helps,
Christoph
Björn Harmen Gerth wrote:
Hello,
in my application I'm using generic field access
methods in a similar fashion as in OSG::deepClone
(OSGNode.cpp), i.e. for any kind of FieldContainer
field I'm accessing it through S- and
MFFieldContainerPtr.
Now I noticed that the generic access does not work
correctly with FCs where the set-method of a certain
field has side-effects.
Take Node and its core field as an example:
Node::setCore() performs an addRefCP() on the new
core, a subRefCP on the old core and adjusts their
parents list accordingly.
Generic access: Node is an FC and its "Core" field is
derived from SFFieldContainerPtr.
sfield.setValue(newCorePtr) then sets the new core of
that field, but it does not handle ref counting or the
parents lists. :-(
I suppose deepClone does a similar mistake, only that
it performs an addRefCP EVERY TIME (line 788).
That seems to be wrong to me too. Again, take Node and
its core as an example: Node should perform an
addRefCP on its core, but the core should not addRefCP
each of its parents.
(I admit that I haven't checked deepClone well enough,
so sorry if the claim in this paragraph is wrong.)
One solution that comes to mind is moving all side
effects into the changed-method of each
FieldContainer, since that is called after each
endEditCP. That solution has two weaknesses:
1) In the Node-core-example, the new core could be
addRefCP'd and its parent list updated in changed.
However, the Ptr of the old core is not known anymore,
so it can't be updated.
2) What if endEditCP is not called? I'm not calling
endEditCP when I'm changing internal (i.e.
thread-local or cluster-local) fields of an FC (is
that wrong?).
I hope this problem can be solved, otherwise an
important part of my application code can be moved to
Ablage P.
Björn
Image/OSGImage.cpp%.inl
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
/*------------------------------ set object data --------------------------*/
/*! method to set the image data. Use the doCopy parameter to specify, whether
the method should copy or link the pixel data.
*/
bool Image::set(UInt32 pF,
Int32 w, Int32 h,
Int32 d, Int32 mmS, Int32 fS,
Time fD, const UChar8 *da, Int32 t, bool allocMem,
Int32 sS)
{
--
/*! method to set the image from another image object.
Use the doCopy parameter to specify, whether
the method should copy or link the pixel data.
*/
bool Image::set(ImagePtr image)
{
this->set(image->getPixelFormat(),
image->getWidth(),
image->getHeight(),
image->getDepth(),
--
}
/*! method to set only the image pixel data, all parameter (e. pixelFormat
width,height and depth) stay the same
*/
bool Image::setData(const UChar8 *da)
{
if(da)
{
createData(da);
}
else
{
FWARNING(("Image::setData(Null) call\n"));
}
return (da ? true : false);
}
--
}
/*! method to update just a subregion of the image data
all paramter (e. pixelFormat,width,height,depth) stay the same
*/
bool Image::setSubData ( Int32 offX, Int32 offY, Int32 offZ,
Int32 srcW, Int32 srcH, Int32 srcD,
const UInt8 *src )
{
UChar8 *dest = getData();
UInt64 lineSize;
FDEBUG(( "Image::setSubData (%d %d %d) - (%d %d %d) - src %p\n",
offX, offY, offZ, srcW, srcH, srcD, src ));
if (hasCompressedData())
{
FFATAL (("Invalid Image::setSubData for compressed image\n"));
return false;
}
if(!src || !dest)
{
FFATAL(("Invalid data pointer in Image::setSubData\n"));
return false;
}
// determine the area to actually copy
UInt32 xMin = osgMax(0,offX);
--
return 0;
}
/*! set a single string attachment for the given key/data pair
*/
void Image::setAttachmentField ( const std::string &key,
const std::string &data)
{
ImageGenericAttPtr att=ImageGenericAttPtr::dcast(
findAttachment(
ImageGenericAtt::getClassType().getGroupId()));
Material/OSGChunkMaterial.cpp%.inl
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Material/OSGFresnelMaterial.cpp%.inl
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
#include "OSGConfig.h"
OSG_BEGIN_NAMESPACE
inline
void FresnelMaterial::setImage(ImagePtr &pImage)
{
addRefCP(pImage);
subRefCP(_sfImage.getValue());
Material/OSGMaterial.cpp%.inl
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Material/OSGPhongMaterial.cpp%.inl
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Material/OSGSimpleMaterial.cpp%.inl
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Material/OSGSimpleTexturedMaterial.cpp%.inl
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
State/OSGBlendChunk.cpp%.inl
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
State/OSGClipPlaneChunk.cpp%.inl
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
State/OSGCubeTextureChunk.cpp%.inl
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
{
return &CubeTextureChunk::_class;
}
inline
void CubeTextureChunk::setPosZImage(ImagePtr &pImage)
{
addRefCP(pImage);
subRefCP(_sfPosZImage.getValue());
_sfPosZImage.setValue(pImage);
}
inline
void CubeTextureChunk::setPosXImage(ImagePtr &pImage)
{
addRefCP(pImage);
subRefCP(_sfPosXImage.getValue());
_sfPosXImage.setValue(pImage);
}
inline
void CubeTextureChunk::setNegXImage(ImagePtr &pImage)
{
addRefCP(pImage);
subRefCP(_sfNegXImage.getValue());
_sfNegXImage.setValue(pImage);
}
inline
void CubeTextureChunk::setPosYImage(ImagePtr &pImage)
{
addRefCP(pImage);
subRefCP(_sfPosYImage.getValue());
_sfPosYImage.setValue(pImage);
}
inline
void CubeTextureChunk::setNegYImage(ImagePtr &pImage)
{
addRefCP(pImage);
subRefCP(_sfNegYImage.getValue());
State/OSGFragmentProgramChunk.cpp%.inl
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
State/OSGLightChunk.cpp%.inl
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
State/OSGLineChunk.cpp%.inl
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
State/OSGMaterialChunk.cpp%.inl
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
State/OSGPointChunk.cpp%.inl
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
State/OSGPolygonChunk.cpp%.inl
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
State/OSGProgramChunk.cpp%.inl
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
return bad;
}
/*! Set parameter value, create it if not set yet.
*/
bool ProgramChunk::setParameter(Int16 index, const Vec4f& value)
{
if(index < 0)
return true;
if(getParamValues().size() <= UInt16(index))
{
return getParameter(findParameter(name.c_str()));
}
inline
bool ProgramChunk::setParameter(const char *name, const Vec4f& value)
{
return setParameter(findParameter(name), value);
}
inline
bool ProgramChunk::setParameter(const std::string &name, const Vec4f &value)
{
return setParameter(findParameter(name.c_str()), value);
}
inline
State/OSGRegisterCombinersChunk.cpp%.inl
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
/*! \class osg::RegisterCombinersChunk
See \ref PageSystemRegisterCombinersChunk for a description.
This chunk wraps nVidia's register combiners. The
osg::RegisterCombinersChunk::setCombinerRGB and
osg::RegisterCombinersChunk::setCombinerAlpha convenience functions should be
used,
which set up all the parameters for a single combiner's RGB or alpha part.
osg::RegisterCombinersChunk::setFinalCombiner sets all parameters for the
final combiner. The constants are set by
osg::RegisterCombinersChunk::setConstantColors(Color4f &color0, Color4f
&color1) for the gloabl constants and
osg::RegisterCombinersChunk::setConstantColors(UInt16 which, Color4f &color0,
Color4f &color1) for the per-combiner constants (if supported). To reset a
combiner one or all of the combiners use
osg::RegisterCombinersChunk::clearCombiners or
osg::RegisterCombinersChunk::clearCombiner.
--
getVariableArgb ()[which * 3] = unused;
getVariableAalpha()[which * 3] = unused;
}
void RegisterCombinersChunk::setCombinerRGB(UInt16 which,
GLenum ainput, GLenum amapping, GLenum acompusage,
GLenum binput, GLenum bmapping, GLenum bcompusage,
GLenum cinput, GLenum cmapping, GLenum ccompusage,
GLenum dinput, GLenum dmapping, GLenum dcompusage,
GLenum outputAB, GLenum outputCD, GLenum outputSum,
--
getDotABrgb ()[which] = dotAB;
getDotCDrgb ()[which] = dotCD;
getMuxSumrgb ()[which] = muxSum;
}
void RegisterCombinersChunk::setCombinerAlpha(UInt16 which,
GLenum ainput, GLenum amapping, GLenum acompusage,
GLenum binput, GLenum bmapping, GLenum bcompusage,
GLenum cinput, GLenum cmapping, GLenum ccompusage,
GLenum dinput, GLenum dmapping, GLenum dcompusage,
GLenum outputAB, GLenum outputCD, GLenum outputSum,
--
getScalealpha ()[which] = scale;
getBiasalpha ()[which] = bias;
getMuxSumalpha ()[which] = muxSum;
}
void RegisterCombinersChunk::setFinalCombiner(
GLenum ainput, GLenum amapping, GLenum acompusage,
GLenum binput, GLenum bmapping, GLenum bcompusage,
GLenum cinput, GLenum cmapping, GLenum ccompusage,
GLenum dinput, GLenum dmapping, GLenum dcompusage,
GLenum einput, GLenum emapping, GLenum ecompusage,
--
getVariableG()[0] = ginput;
getVariableG()[1] = gmapping;
getVariableG()[2] = gcompusage;
}
void RegisterCombinersChunk::setConstantColors(
Color4f &color0, Color4f &color1)
{
RegisterCombinersChunkPtr tmpPtr(*this);
beginEditCP(tmpPtr, PerStageConstantsFieldMask);
--
getColor1() = color1;
endEditCP(tmpPtr, PerStageConstantsFieldMask);
}
void RegisterCombinersChunk::setCombinerColors(UInt16 which,
Color4f &color0, Color4f &color1)
{
RegisterCombinersChunkPtr tmpPtr(*this);
beginEditCP(tmpPtr, PerStageConstantsFieldMask);
State/OSGState.cpp%.inl
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
State/OSGStateChunk.cpp%.inl
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
State/OSGTexGenChunk.cpp%.inl
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
State/OSGTextureChunk.cpp%.inl
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
{
return &TextureChunk::_class;
}
inline
void TextureChunk::setImage(ImagePtr &pImage)
{
addRefCP(pImage);
subRefCP(_sfImage.getValue());
--
#endif
return false;
}
inline
void TextureChunk::setShaderOffsetMatrix(Real32 m11, Real32 m12,
Real32 m21, Real32 m22)
{
getShaderOffsetMatrix().resize(4);
getShaderOffsetMatrix()[0] = m11;
State/OSGTextureTransformChunk.cpp%.inl
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
State/OSGTransformChunk.cpp%.inl
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
State/OSGVertexProgramChunk.cpp%.inl
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Statistics/OSGGraphicStatisticsForeground.cpp%.inl
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Statistics/OSGSimpleStatisticsForeground.cpp%.inl
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Statistics/OSGStatisticsForeground.cpp%.inl
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Window/OSGBackground.cpp%.inl
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Window/OSGCamera.cpp%.inl
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
/*-------------------------- your_category---------------------------------*/
/*! Setup OpenGL for rendering, call all the necessary commands to start
rendering with this camera.
*/
void Camera::setup( DrawActionBase *OSG_CHECK_ARG(action),
const Viewport &port )
{
Matrix m, t;
// set the projection
--
glLoadMatrixf( m.getValues() );
}
/*! Setup OpenGL projection for rendering.
*/
void Camera::setupProjection( DrawActionBase *OSG_CHECK_ARG(action),
const Viewport &port )
{
Matrix m, t;
// set the projection
--
UInt32 OSG_CHECK_ARG(width ),
UInt32 OSG_CHECK_ARG(height))
{
if (getBeacon() == NullFC)
{
SWARNING << "Camera::setup: no beacon!" << std::endl;
return;
}
getBeacon()->getToWorld(result);
result.invert();
Window/OSGCameraDecorator.cpp%.inl
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Window/OSGColorBufferViewport.cpp%.inl
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Window/OSGDepthClearBackground.cpp%.inl
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Window/OSGFileGrabForeground.cpp%.inl
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Window/OSGForeground.cpp%.inl
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Window/OSGGrabForeground.cpp%.inl
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
/*----------------------- constructors & destructors ----------------------*/
GrabForeground::GrabForeground(void) :
Inherited()
{
Inherited::setActive(false);
}
GrabForeground::GrabForeground(const GrabForeground &source) :
Inherited(source)
{
Window/OSGGradientBackground.cpp%.inl
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Window/OSGImageBackground.cpp%.inl
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Window/OSGImageForeground.cpp%.inl
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Window/OSGMatrixCamera.cpp%.inl
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Window/OSGMatrixCameraDecorator.cpp%.inl
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Window/OSGPassiveBackground.cpp%.inl
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Window/OSGPassiveViewport.cpp%.inl
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Window/OSGPassiveWindow.cpp%.inl
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Window/OSGPerspectiveCamera.cpp%.inl
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Window/OSGPolygonForeground.cpp%.inl
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Window/OSGProjectionCameraDecorator.cpp%.inl
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Window/OSGShearedStereoCameraDecorator.cpp%.inl
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Window/OSGSkyBackground.cpp%.inl
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Window/OSGSolidBackground.cpp%.inl
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Window/OSGStereoBufferViewport.cpp%.inl
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Window/OSGStereoCameraDecorator.cpp%.inl
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Window/OSGTextureBackground.cpp%.inl
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Window/OSGTextureGrabBackground.cpp%.inl
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Window/OSGTextureGrabForeground.cpp%.inl
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Window/OSGTileCameraDecorator.cpp%.inl
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
/*! Set all the size-related Fields at once.
Does not call begin/endEdit internally!
*/
void TileCameraDecorator::setSize( Real32 left, Real32 bottom, Real32 right,
Real32 top )
{
_sfLeft.setValue( left );
_sfRight.setValue( right );
_sfBottom.setValue( bottom );
OSG_BEGIN_NAMESPACE
/*------------------------------ access -----------------------------------*/
inline void TileCameraDecorator::setFullSize( UInt32 width, UInt32 height )
{
setFullWidth( width );
setFullHeight( height );
}
Window/OSGViewport.cpp%.inl
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
/*! Set all of the size-related fields of the viewport.
Does not call begin/endEdit internally!
*/
inline void Viewport::setSize( Real32 left, Real32 bottom, Real32 right,
Real32 top )
{
_sfLeft.setValue( left );
_sfRight.setValue( right );
_sfBottom.setValue( bottom );
Window/OSGWindow.cpp%.inl
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
whenever a new Window is opened.
Don't call it directly, call the Window System-specific init() method
instead.
*/
void OSG::Window::setupGL( void )
{
glPixelStorei( GL_UNPACK_ALIGNMENT, 1 );
glPixelStorei( GL_PACK_ALIGNMENT, 1 );
glDepthFunc( GL_LEQUAL );
/*------------------------------- size ----------------------------------*/
/*! Set the width and height of the Window. Only use if you really know what
you're doing. In most cases resize() is a better choice.
*/
inline void Window::setSize(UInt16 width, UInt16 height)
{
setHeight(height);
setWidth(width);
}
--
/*! Set the library name where to find OpenGL extension functions. This has
to be called before the first extension function is accessed, and it's
safe to call it before osgInit().
*/
inline void Window::setGLLibraryName(const Char8 *s)
{
_glLibraryName = s;
}
/*! Find the id of a registered extension. Return -1 if extension not
--
inline const std::vector<std::string> &Window::getIgnoredExtensions(void)
{
return _ignoredExtensions;
}
inline void Window::setGLObjectId(UInt32 id, UInt32 id2)
{
if(id < _ids.size())
{
_ids[id] = id2;
}
--
{
_ids.resize(_glObjects.size());
if(id < _ids.size())
_ids[id] = id2;
else
SWARNING << "Window::setGLObjectId: id (" << id << ") is not
valid!" << std::endl;
}
}
inline UInt32 Window::getGLObjectId(UInt32 id)
{
--
inline Window::GLObjectFunctor& Window::GLObject::getFunctor(void)
{
return _functor;
};
inline void Window::GLObject::setFunctor(GLObjectFunctor funct)
{
_functor = funct;
};
inline UInt32 Window::GLObject::getLastValidate(void)
{
return _lastValidate;
}
inline void Window::GLObject::setLastValidate(UInt32 val)
{
_lastValidate = val;
}
inline UInt32 Window::GLObject::getRefCounter(void)
Action/RenderAction/OSGRenderAction.cpp%.inl
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
/*! \brief prototype access
* after setting the prototype all new DrawActions are clones of it
*/
void RenderAction::setPrototype(RenderAction *pPrototype)
{
_pPrototype = pPrototype;
}
RenderAction *RenderAction::getPrototype(void)
--
/*---------------------------- properties ---------------------------------*/
// rendering state handling
void RenderAction::setMaterial(Material *pMaterial)
{
_pMaterial = pMaterial;
}
void RenderAction::dropGeometry(Geometry *pGeo)
--
pRoot = pRoot->getBrother();
}
}
void RenderAction::setSortTrans(bool bVal)
{
_bSortTrans = bVal;
}
bool RenderAction::getSortTrans(void)
{
return _bSortTrans;
}
void RenderAction::setZWriteTrans(bool bVal)
{
_bZWriteTrans = bVal;
}
bool RenderAction::getZWriteTrans(void)
{
return _bZWriteTrans;
}
void RenderAction::setLocalLights(bool bVal)
{
_bLocalLights = bVal;
}
bool RenderAction::getLocalLights(void)
{
return _bLocalLights;
}
void RenderAction::setCorrectTwoSidedLighting(bool bVal)
{
_bCorrectTwoSidedLighting = bVal;
}
bool RenderAction::getCorrectTwoSidedLighting(void)
Cluster/Window/Base/OSGClusterWindow.cpp%.inl
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
_connectionFP = saveFP;
return result;
}
void ClusterWindow::setConnectionCB(connectioncbfp fp)
{
_connectionFP = fp;
}
void ClusterWindow::render(RenderActionBase *action)
--
}
/*-------------------------------------------------------------------------*/
/* statistics */
void ClusterWindow::setStatistics(StatCollector *statistics)
{
_statistics = statistics;
if(getNetwork()->getAspect())
getNetwork()->getAspect()->setStatistics(statistics);
}
Cluster/Window/Base/OSGImageComposer.cpp%.inl
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
/*----------------------------- setup ------------------------------------*/
/*! initialize the composer
*/
void ImageComposer::setup(bool isClient,
UInt32 clusterId,
WindowPtr localWindow,
ClusterWindowPtr clusterWindow)
{
_isClient = isClient;
Cluster/Window/MultiDisplay/OSGMultiDisplayWindow.cpp%.inl
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Cluster/Window/SortFirst/OSGSortFirstWindow.cpp%.inl
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Cluster/Window/SortLast/OSGSepiaComposer.cpp%.inl
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Cluster/Window/SortLast/OSGSortLastWindow.cpp%.inl
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
// recourse
splitDrawables(dst1,groups1,cut);
splitDrawables(dst2,groups2,cut);
}
void SortLastWindow::setupNodes(UInt32 groupId)
{
UInt32 v;
NodePtr root;
UInt32 p;
UInt32 nI,gnI,gI,group;
NodeCores/Drawables/Base/OSGDrawable.cpp%.inl
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
NodeCores/Drawables/Base/OSGMaterialDrawable.cpp%.inl
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
NodeCores/Drawables/Geometry/OSGGeometry.cpp%.inl
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
}
/*------------------------------ access -----------------------------------*/
inline
void Geometry::setTypes(const GeoPTypesPtr &value)
{
GeometryPtr thisP = getPtr();
addRefCP(value);
--
_sfTypes.setValue(value);
}
inline
void Geometry::setLengths(const GeoPLengthsPtr &value)
{
GeometryPtr thisP = getPtr();
addRefCP(value);
--
_sfLengths.setValue(value);
}
inline
void Geometry::setPositions(const GeoPositionsPtr &value)
{
GeometryPtr thisP = getPtr();
addRefCP(value);
--
_sfPositions.setValue(value);
}
inline
void Geometry::setNormals(const GeoNormalsPtr &value)
{
GeometryPtr thisP = getPtr();
addRefCP(value);
--
_sfNormals.setValue(value);
}
inline
void Geometry::setColors(const GeoColorsPtr &value)
{
GeometryPtr thisP = getPtr();
addRefCP(value);
--
_sfColors.setValue(value);
}
inline
void Geometry::setSecondaryColors(const GeoColorsPtr &value)
{
GeometryPtr thisP = getPtr();
addRefCP(value);
--
_sfSecondaryColors.setValue(value);
}
inline
void Geometry::setTexCoords(const GeoTexCoordsPtr &value)
{
GeometryPtr thisP = getPtr();
addRefCP(value);
--
_sfTexCoords.setValue(value);
}
inline
void Geometry::setTexCoords1(const GeoTexCoordsPtr &value)
{
GeometryPtr thisP = getPtr();
addRefCP(value);
--
_sfTexCoords1.setValue(value);
}
inline
void Geometry::setTexCoords2(const GeoTexCoordsPtr &value)
{
GeometryPtr thisP = getPtr();
addRefCP(value);
--
_sfTexCoords2.setValue(value);
}
inline
void Geometry::setTexCoords3(const GeoTexCoordsPtr &value)
{
GeometryPtr thisP = getPtr();
addRefCP(value);
--
_sfTexCoords3.setValue(value);
}
inline
void Geometry::setIndices(const GeoIndicesPtr &value)
{
GeometryPtr thisP = getPtr();
addRefCP(value);
--
_sfIndices.setValue(value);
}
inline
void Geometry::setMaterial(const MaterialPtr &value)
{
setRefdCP(_sfMaterial.getValue(), value);
}
NodeCores/Drawables/Misc/OSGSlices.cpp%.inl
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
#include <OSGConfig.h>
OSG_BEGIN_NAMESPACE
inline
void Slices::setMaterial(const MaterialPtr &value)
{
setRefdCP(_sfMaterial.getValue(), value);
}
OSG_END_NAMESPACE
NodeCores/Drawables/Nurbs/OSGFatBorderChunk.cpp%.inl
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
NodeCores/Drawables/Nurbs/OSGSurface.cpp%.inl
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
NodeCores/Drawables/Particles/OSGParticles.cpp%.inl
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
OSG_BEGIN_NAMESPACE
/*------------------------------ access -----------------------------------*/
inline
void Particles::setPositions(const GeoPositionsPtr &value)
{
ParticlesPtr thisP(*this);
addRefCP(value);
--
_sfPositions.setValue(value);
}
inline
void Particles::setSecPositions(const GeoPositionsPtr &value)
{
ParticlesPtr thisP(*this);
addRefCP(value);
--
_sfSecPositions.setValue(value);
}
inline
void Particles::setColors(const GeoColorsPtr &value)
{
ParticlesPtr thisP(*this);
addRefCP(value);
--
_sfColors.setValue(value);
}
inline
void Particles::setNormals(const GeoNormalsPtr &value)
{
ParticlesPtr thisP(*this);
addRefCP(value);
--
_sfNormals.setValue(value);
}
inline
void Particles::setMaterial(const MaterialPtr &value)
{
setRefdCP(_sfMaterial.getValue(), value);
}
OSG_END_NAMESPACE
NodeCores/Drawables/VolRen/OSGDVRAppearance.cpp%.inl
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
NodeCores/Drawables/VolRen/OSGDVRClipGeometry.cpp%.inl
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
for (UInt32 j = 0; j < 3; j++)
_mfTriangles[i].edgeCut[j] = false;
}
}
void DVRClipGeometry::setReferencePlane(const Plane &referencePlane)
{
UInt32 numVertices = _mfVertices.size();
for(UInt32 i = 0; i < numVertices; i++)
_mfVertices[i].calculatePlaneDistanceTransformed(referencePlane);
--
activeTriangles[activeTrianglesCount] = tri;
activeTrianglesCount++;
}
bool DVRClipGeometry::setNumAddPerVertexAttr(
UInt32 additionalPerVertexAttributes)
{
UInt32 numTriangles = _mfTriangles.size();
// update triangles
NodeCores/Drawables/VolRen/OSGDVRClipObjects.cpp%.inl
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
_mfClipObjects[i]->initialize(volumeToWorld);
}
//! Set the reference plane used in clipping
// deprecated -> remove
void DVRClipObjects::setReferencePlane(const Plane &referencePlane)
{
for(UInt32 i = 0; i < _mfClipObjects.size(); i++)
_mfClipObjects[i]->setReferencePlane(referencePlane);
}
NodeCores/Drawables/VolRen/OSGDVRGeometry.cpp%.inl
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
NodeCores/Drawables/VolRen/OSGDVRIsoShader.cpp%.inl
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
NodeCores/Drawables/VolRen/OSGDVRIsoSurface.cpp%.inl
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
NodeCores/Drawables/VolRen/OSGDVRLookupTable.cpp%.inl
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
uiIndent += 4;
indentLog(uiIndent, PLOG);
for(i = 0; i < _mfData.size(); i++)
{
PLOG << std::setw(9) << std::left << (int) _mfData[i] << " ";
if((i + 1) % getChannel() == 0)
{
PLOG << std::endl; indentLog(uiIndent, PLOG);
}
--
indentLog(uiIndent, PLOG);
for(i = 0; i < _mfDataR.size(); i++)
{
PLOG << std::setw(9) << std::left <<_mfDataR[i] << " ";
if((i + 1) % col == 0)
{
PLOG << std::endl; indentLog(uiIndent, PLOG);
}
--
indentLog(uiIndent, PLOG);
for(i = 0; i < _mfDataG.size(); i++)
{
PLOG << std::setw(9) << std::left << _mfDataG[i] << " ";
if((i + 1) % col == 0)
{
PLOG << std::endl; indentLog(uiIndent, PLOG);
}
--
indentLog(uiIndent, PLOG);
for(i = 0; i < _mfDataB.size(); i++)
{
PLOG << std::setw(9) << std::left << _mfDataB[i] << " ";
if((i + 1) % col == 0)
{
PLOG << std::endl; indentLog(uiIndent, PLOG);
}
--
indentLog(uiIndent, PLOG);
for(i = 0; i < _mfDataA.size(); i++)
{
PLOG << std::setw(9) << std::left << _mfDataA[i] << " ";
if((i + 1) % col == 0)
{
PLOG << std::endl; indentLog(uiIndent, PLOG);
}
#include <OSGConfig.h>
OSG_BEGIN_NAMESPACE
inline
void DVRLookupTable::setTouched(const bool &value)
{
//!! This is very tricky:
//!! It prevents the common constructor from beeing called when
//!! loading the FC from an osg file
--
//!! FC hasn't otherwise been initialized
if(_mfDataR.size() == 0)
commonConstructor();
DVRLookupTableBase::setTouched( value );
}
OSG_END_NAMESPACE
#define OSGDVRLOOKUPTABLE_INLINE_CVSID "@(#)$Id: $"
NodeCores/Drawables/VolRen/OSGDVRMtexLUTShader.cpp%.inl
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
NodeCores/Drawables/VolRen/OSGDVRShader.cpp%.inl
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
NodeCores/Drawables/VolRen/OSGDVRSimpleLUTShader.cpp%.inl
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
GLenum,
GLboolean,
GLboolean,
GLboolean);
void DVRSimpleLUTShader::setupAlphaCorrectionRegisterCombiners(
DrawActionBase *action)
{
Window *win = action->getWindow();
if(!win->hasExtension(_nvRegisterCombiners))
NodeCores/Drawables/VolRen/OSGDVRSimpleShader.cpp%.inl
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
NodeCores/Drawables/VolRen/OSGDVRVolume.cpp%.inl
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
/*------------------------------ access -----------------------------------*/
inline
void DVRVolume::setAppearance(const DVRAppearancePtr &value)
{
SINFO << "DVRVolume::setAppearance this: " << this << std::endl;
// SINFO << "setRefdCP(" << _sfAppearance.getValue()
// << ", " << value << std::endl;
setRefdCP(_sfAppearance.getValue(), value);
}
inline
void DVRVolume::setGeometry(const DVRGeometryPtr &value)
{
SINFO << "DVRVolume::setGeometry this: " << this << std::endl;
// SINFO << "setRefdCP(" << _sfGeometry.getValue() << ", "
// << value << std::endl;
setRefdCP(_sfGeometry.getValue(), value);
}
inline
void DVRVolume::setShader(const DVRShaderPtr &value)
{
SINFO << "DVRVolume::setShader this: " << this << std::endl;
// SINFO << "setRefdCP(" << _sfShader.getValue() << ", "
// << value << std::endl;
setRefdCP(_sfShader.getValue(), value);
}
inline
void DVRVolume::setRenderMaterial(const MaterialPtr &value)
{
SINFO << "DVRVolume::setRenderMaterial this: "
<< this
<< std::endl;
SINFO << "setRefdCP("
<< _sfRenderMaterial.getValue() << ", "
--
setRefdCP(_sfRenderMaterial.getValue(), value);
}
inline
void DVRVolume::setTextureStorage(const ChunkMaterialPtr &value)
{
SINFO << "DVRVolume::setTextureStorage this: "
<< this << std::endl;
SINFO << "setRefdCP("
<< _sfTextureStorage.getValue() << ", "
<< value << std::endl;
NodeCores/Drawables/VolRen/OSGDVRVolumeTexture.cpp%.inl
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
\*-------------------------------------------------------------------------*/
/*------------------------------ access -----------------------------------*/
inline
void DVRVolumeTexture::setImage(const ImagePtr &value)
{
setRefdCP(_sfImage.getValue(), value);
}
OSG_END_NAMESPACE
NodeCores/Groups/Base/OSGGroup.cpp%.inl
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
NodeCores/Groups/Light/OSGDirectionalLight.cpp%.inl
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
/*-------------------------------------------------------------------------*/
/* Set */
void DirectionalLight::setDirection(Real32 rX, Real32 rY, Real32 rZ)
{
_sfDirection.getValue().setValues(rX, rY, rZ);
}
/*-------------------------------------------------------------------------*/
#include "OSGConfig.h"
OSG_BEGIN_NAMESPACE
inline
void DirectionalLight::setDirection(const Vec3f &value)
{
Inherited::setDirection(value);
}
OSG_END_NAMESPACE
#define OSGDIRECTIONALLIGHT_INLINE_CVSID "@(#)$Id: $"
NodeCores/Groups/Light/OSGLight.cpp%.inl
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
/*-------------------------------------------------------------------------*/
/* Set */
void Light::setAmbient(Real32 rRed,
Real32 rGreen,
Real32 rBlue,
Real32 rAlpha)
{
_sfAmbient.getValue().setValuesRGBA(rRed, rGreen, rBlue, rAlpha);
}
void Light::setDiffuse(Real32 rRed,
Real32 rGreen,
Real32 rBlue,
Real32 rAlpha)
{
_sfDiffuse.getValue().setValuesRGBA(rRed, rGreen, rBlue, rAlpha);
}
void Light::setSpecular(Real32 rRed,
Real32 rGreen,
Real32 rBlue,
Real32 rAlpha)
{
_sfSpecular.getValue().setValuesRGBA(rRed, rGreen, rBlue, rAlpha);
#include "OSGConfig.h"
OSG_BEGIN_NAMESPACE
inline
void Light::setAmbient(const Color4f &col)
{
Inherited::setAmbient(col);
}
inline
void Light::setDiffuse(const Color4f &col)
{
Inherited::setDiffuse(col);
}
inline
void Light::setSpecular(const Color4f &col)
{
Inherited::setSpecular(col);
}
OSG_END_NAMESPACE
#define OSGLIGHT_INLINE_CVSID "@(#)$Id: $"
NodeCores/Groups/Light/OSGPointLight.cpp%.inl
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
"NPointLights", "number of point light sources");
/*-------------------------------------------------------------------------*/
/* Set */
void PointLight::setPosition(Real32 rX, Real32 rY, Real32 rZ)
{
_sfPosition.getValue().setValues(rX, rY, rZ);
}
void PointLight::setAttenuation(Real32 rConstant,
Real32 rLinear,
Real32 rQuadratic)
{
_sfConstantAttenuation .setValue(rConstant );
_sfLinearAttenuation .setValue(rLinear );
#include "OSGConfig.h"
OSG_BEGIN_NAMESPACE
inline
void PointLight::setPosition(const Pnt3f &pos)
{
Inherited::setPosition(pos);
}
OSG_END_NAMESPACE
#define OSGPOINTLIGHT_INLINE_CVSID "@(#)$Id: $"
NodeCores/Groups/Light/OSGSpotLight.cpp%.inl
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
#include "OSGConfig.h"
OSG_BEGIN_NAMESPACE
inline
void SpotLight::setSpotDirection(Real32 rX, Real32 rY, Real32 rZ)
{
_sfDirection.getValue().setValues(rX, rY, rZ);
}
inline
void SpotLight::setSpotCutOffDeg(Real32 angle)
{
_sfSpotCutOff.setValue(osgdegree2rad(angle));
}
inline
NodeCores/Groups/Misc/OSGBillboard.cpp%.inl
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
NodeCores/Groups/Misc/OSGComponentTransform.cpp%.inl
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
NodeCores/Groups/Misc/OSGDistanceLOD.cpp%.inl
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
NodeCores/Groups/Misc/OSGInline.cpp%.inl
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
NodeCores/Groups/Misc/OSGInverseTransform.cpp%.inl
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
NodeCores/Groups/Misc/OSGMaterialGroup.cpp%.inl
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
#include "OSGConfig.h"
OSG_BEGIN_NAMESPACE
inline
void MaterialGroup::setMaterial(const MaterialPtr &value)
{
addRefCP(value);
subRefCP(_sfMaterial.getValue());
NodeCores/Groups/Misc/OSGProxyGroup.cpp%.inl
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
NodeCores/Groups/Misc/OSGSwitch.cpp%.inl
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
NodeCores/Groups/Misc/OSGTransform.cpp%.inl
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
#!/bin/sh
for file in $1; do
if test -e ${file%.cpp}Base.cpp;
then echo
echo ${file}%.inl
echo :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
grep -5 "::set" $file;
grep -5 "::set" ${file%.cpp}.inl
fi
done