OpenSceneGraph/include/osgTerrain/Layer
2007-03-27 19:27:36 +00:00

129 lines
3.1 KiB
C++

/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* 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.
*/
#ifndef OSGTERRAIN_LAYER
#define OSGTERRAIN_LAYER 1
#include <osg/Image>
#include <osg/Shape>
#include <osg/Array>
#include <osgTerrain/Locator>
namespace osgTerrain {
class OSGTERRAIN_EXPORT Layer : public osg::Object
{
public:
Layer();
/** Copy constructor using CopyOp to manage deep vs shallow copy.*/
Layer(const Layer&,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY);
META_Object(osgTerrain, Layer);
void setLocator(Locator* locator) { _locator = locator; }
Locator* getLocator() { return _locator.get(); }
const Locator* getLocator() const { return _locator.get(); }
virtual osg::BoundingSphere computeBound() const;
protected:
virtual ~Layer();
osg::ref_ptr<Locator> _locator;
};
class OSGTERRAIN_EXPORT ImageLayer : public Layer
{
public:
ImageLayer();
/** Copy constructor using CopyOp to manage deep vs shallow copy.*/
ImageLayer(const ImageLayer& imageLayer,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY);
void setImage(osg::Image* image);
osg::Image* getImage() { return _image.get(); }
const osg::Image* getImage() const { return _image.get(); }
protected:
virtual ~ImageLayer() {}
osg::ref_ptr<osg::Image> _image;
};
class OSGTERRAIN_EXPORT HeightFieldLayer : public Layer
{
public:
HeightFieldLayer();
/** Copy constructor using CopyOp to manage deep vs shallow copy.*/
HeightFieldLayer(const HeightFieldLayer& hfLayer,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY);
void setHeightField(osg::HeightField* hf);
osg::HeightField* getHeightField() { return _heightField.get(); }
const osg::HeightField* getHeightField() const { return _heightField.get(); }
protected:
virtual ~HeightFieldLayer() {}
osg::ref_ptr<osg::HeightField> _heightField;
};
class OSGTERRAIN_EXPORT ArrayLayer : public Layer
{
public:
ArrayLayer();
/** Copy constructor using CopyOp to manage deep vs shallow copy.*/
ArrayLayer(const ArrayLayer&,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY);
void setArray(osg::Array* array);
osg::Array* getArray() { return _array.get(); }
const osg::Array* getArray() const { return _array.get(); }
protected:
virtual ~ArrayLayer() {}
osg::ref_ptr<osg::Array> _array;
};
}
#endif