2006-07-18 23:21:48 +08:00
|
|
|
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
2003-01-22 00:45:36 +08:00
|
|
|
*
|
|
|
|
* This library is open source and may be redistributed and/or modified under
|
|
|
|
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
|
|
|
* (at your option) any later version. The full license is in LICENSE file
|
|
|
|
* included with this distribution, and on the openscenegraph.org website.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* OpenSceneGraph Public License for more details.
|
|
|
|
*/
|
2002-01-29 20:52:04 +08:00
|
|
|
|
|
|
|
#ifndef OSG_COPYOP
|
|
|
|
#define OSG_COPYOP 1
|
|
|
|
|
2002-01-30 04:25:45 +08:00
|
|
|
#include <osg/Export>
|
|
|
|
|
2002-01-29 20:52:04 +08:00
|
|
|
namespace osg {
|
|
|
|
|
|
|
|
class Referenced;
|
|
|
|
class Object;
|
|
|
|
class Image;
|
2002-08-28 23:28:11 +08:00
|
|
|
class Texture;
|
2002-01-29 20:52:04 +08:00
|
|
|
class StateSet;
|
|
|
|
class StateAttribute;
|
2009-10-22 18:33:16 +08:00
|
|
|
class StateAttributeCallback;
|
2005-04-23 06:45:39 +08:00
|
|
|
class Uniform;
|
2002-01-29 20:52:04 +08:00
|
|
|
class Node;
|
|
|
|
class Drawable;
|
2002-07-26 05:50:08 +08:00
|
|
|
class Array;
|
2002-09-20 22:51:59 +08:00
|
|
|
class PrimitiveSet;
|
2002-10-30 21:27:15 +08:00
|
|
|
class Shape;
|
2009-06-18 18:01:39 +08:00
|
|
|
class NodeCallback;
|
2002-01-29 20:52:04 +08:00
|
|
|
|
2009-10-22 18:33:16 +08:00
|
|
|
|
2004-08-31 22:49:33 +08:00
|
|
|
/** Copy Op(erator) used to control whether shallow or deep copy is used
|
2002-01-29 20:52:04 +08:00
|
|
|
* during copy construction and clone operation.*/
|
2005-04-12 01:14:17 +08:00
|
|
|
class OSG_EXPORT CopyOp
|
2002-01-29 20:52:04 +08:00
|
|
|
{
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
enum Options
|
|
|
|
{
|
2005-11-18 01:44:48 +08:00
|
|
|
SHALLOW_COPY = 0,
|
2008-04-16 23:23:12 +08:00
|
|
|
DEEP_COPY_OBJECTS = 1<<0,
|
|
|
|
DEEP_COPY_NODES = 1<<1,
|
|
|
|
DEEP_COPY_DRAWABLES = 1<<2,
|
|
|
|
DEEP_COPY_STATESETS = 1<<3,
|
|
|
|
DEEP_COPY_STATEATTRIBUTES = 1<<4,
|
|
|
|
DEEP_COPY_TEXTURES = 1<<5,
|
|
|
|
DEEP_COPY_IMAGES = 1<<6,
|
|
|
|
DEEP_COPY_ARRAYS = 1<<7,
|
|
|
|
DEEP_COPY_PRIMITIVES = 1<<8,
|
|
|
|
DEEP_COPY_SHAPES = 1<<9,
|
|
|
|
DEEP_COPY_UNIFORMS = 1<<10,
|
2009-10-22 18:33:16 +08:00
|
|
|
DEEP_COPY_CALLBACKS = 1<<11,
|
2008-12-19 20:46:21 +08:00
|
|
|
DEEP_COPY_ALL = 0x7FFFFFFF
|
2002-01-29 20:52:04 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
typedef unsigned int CopyFlags;
|
|
|
|
|
|
|
|
inline CopyOp(CopyFlags flags=SHALLOW_COPY):_flags(flags) {}
|
|
|
|
virtual ~CopyOp() {}
|
|
|
|
|
2010-10-28 22:01:47 +08:00
|
|
|
void setCopyFlags(CopyFlags flags) { _flags = flags; }
|
|
|
|
CopyFlags getCopyFlags() const { return _flags; }
|
|
|
|
|
2002-01-29 20:52:04 +08:00
|
|
|
virtual Referenced* operator() (const Referenced* ref) const;
|
|
|
|
virtual Object* operator() (const Object* obj) const;
|
|
|
|
virtual Node* operator() (const Node* node) const;
|
|
|
|
virtual Drawable* operator() (const Drawable* drawable) const;
|
|
|
|
virtual StateSet* operator() (const StateSet* stateset) const;
|
|
|
|
virtual StateAttribute* operator() (const StateAttribute* attr) const;
|
2002-08-28 23:28:11 +08:00
|
|
|
virtual Texture* operator() (const Texture* text) const;
|
2002-01-29 20:52:04 +08:00
|
|
|
virtual Image* operator() (const Image* image) const;
|
2002-09-20 22:51:59 +08:00
|
|
|
virtual Array* operator() (const Array* array) const;
|
|
|
|
virtual PrimitiveSet* operator() (const PrimitiveSet* primitives) const;
|
2005-11-18 01:44:48 +08:00
|
|
|
virtual Shape* operator() (const Shape* shape) const;
|
|
|
|
virtual Uniform* operator() (const Uniform* shape) const;
|
2009-06-18 18:01:39 +08:00
|
|
|
virtual NodeCallback* operator() (const NodeCallback* nodecallback) const;
|
2009-10-22 18:33:16 +08:00
|
|
|
virtual StateAttributeCallback* operator() (const StateAttributeCallback* stateattributecallback) const;
|
2002-01-29 20:52:04 +08:00
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
CopyFlags _flags;
|
|
|
|
};
|
|
|
|
|
2002-02-03 20:33:41 +08:00
|
|
|
}
|
2002-01-29 20:52:04 +08:00
|
|
|
|
|
|
|
#endif
|