Ejemplo n.º 1
0
Style::Style(const Style& rhs, const osg::CopyOp& op) :
_name    ( rhs._name ),
_symbols ( rhs._symbols ),
_origType( rhs._origType ),
_origData( rhs._origData ),
_uri     ( rhs._uri )
{
    if ( op.getCopyFlags() == osg::CopyOp::SHALLOW_COPY )
    {
        _symbols = rhs._symbols;
    }
    else
    {
        _symbols.clear();
        copySymbols(rhs);
    }
}
Ejemplo n.º 2
0
Image::Image(const Image& si, const osg::CopyOp& co):
osg::Image(si, co),
_surface(si._surface) {
	// If the user wants to do a full copy...
	if(co.getCopyFlags() & osg::CopyOp::DEEP_COPY_IMAGES) {
		_surface = cairo_image_surface_create_for_data(
			_data,
			si.getSurfaceFormat(),
			si.getSurfaceWidth(),
			si.getSurfaceHeight(),
			si.getSurfaceStride()
		);
	}

	// Otherwise, bump the reference count.
	else cairo_surface_reference(_surface);
}
Ejemplo n.º 3
0
TexturePlaneNode::TexturePlaneNode( const TexturePlaneNode& node, const osg::CopyOp& co )
    : osg::Node( node, co )
    , _center( node._center )
    , _width( node._width )
    , _textureBrickSize( node._textureBrickSize )
    , _needsUpdate( true )
    , _disperseFactor( node._disperseFactor )
    , _useShaders( node._useShaders )
{
    if ( node._texture )
    {
        if ( co.getCopyFlags()==osg::CopyOp::DEEP_COPY_ALL )
	    _texture = static_cast<LayeredTexture*>(node._texture->clone( co ) );
	else
	    _texture = node._texture;
    }

    setNumChildrenRequiringUpdateTraversal(getNumChildrenRequiringUpdateTraversal()+1);
}
Ejemplo n.º 4
0
Program::Program(const Program& rhs, const osg::CopyOp& copyop):
    osg::StateAttribute(rhs, copyop)
{

    if ((copyop.getCopyFlags()&osg::CopyOp::DEEP_COPY_STATEATTRIBUTES)!=0)
    {
        for( unsigned int shaderIndex=0; shaderIndex < rhs.getNumShaders(); ++shaderIndex )
        {
            addShader( new osg::Shader( *rhs.getShader( shaderIndex ), copyop ) );
        }
    }
    else
    {
        for( unsigned int shaderIndex=0; shaderIndex < rhs.getNumShaders(); ++shaderIndex )
        {
            addShader( const_cast<osg::Shader*>(rhs.getShader( shaderIndex )) );
        }
    }

    const osg::Program::AttribBindingList &abl = rhs.getAttribBindingList();
    for( osg::Program::AttribBindingList::const_iterator attribute = abl.begin(); attribute != abl.end(); ++attribute )
    {
        addBindAttribLocation( attribute->first, attribute->second );
    }

    const osg::Program::FragDataBindingList &fdl = rhs.getFragDataBindingList();
    for( osg::Program::FragDataBindingList::const_iterator fragdata = fdl.begin(); fragdata != fdl.end(); ++fragdata )
    {
        addBindFragDataLocation( fragdata->first, fragdata->second );
    }

    _geometryVerticesOut = rhs._geometryVerticesOut;
    _geometryInputType = rhs._geometryInputType;
    _geometryOutputType = rhs._geometryOutputType;

    _numGroupsX = rhs._numGroupsX;
    _numGroupsY = rhs._numGroupsY;
    _numGroupsZ = rhs._numGroupsZ;

    _feedbackmode=rhs._feedbackmode;
    _feedbackout=rhs._feedbackout;
}