2017-03-03 17:26:40 +00:00
|
|
|
#ifndef OPENMW_COMPONENTS_TERRAIN_DRAWABLE_H
|
|
|
|
#define OPENMW_COMPONENTS_TERRAIN_DRAWABLE_H
|
|
|
|
|
|
|
|
#include <osg/Geometry>
|
|
|
|
|
2019-08-10 13:37:00 +00:00
|
|
|
namespace osg
|
|
|
|
{
|
|
|
|
class ClusterCullingCallback;
|
|
|
|
}
|
|
|
|
|
2017-03-03 17:26:40 +00:00
|
|
|
namespace osgUtil
|
|
|
|
{
|
|
|
|
class CullVisitor;
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace SceneUtil
|
|
|
|
{
|
|
|
|
class LightListCallback;
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace Terrain
|
|
|
|
{
|
|
|
|
|
2019-02-20 13:37:00 +00:00
|
|
|
class CompositeMap;
|
|
|
|
class CompositeMapRenderer;
|
|
|
|
|
2017-03-03 17:26:40 +00:00
|
|
|
/**
|
|
|
|
* Subclass of Geometry that supports built in multi-pass rendering and built in LightListCallback.
|
|
|
|
*/
|
|
|
|
class TerrainDrawable : public osg::Geometry
|
|
|
|
{
|
|
|
|
public:
|
2020-10-16 18:18:54 +00:00
|
|
|
osg::Object* cloneType() const override { return new TerrainDrawable(); }
|
|
|
|
osg::Object* clone(const osg::CopyOp& copyop) const override { return new TerrainDrawable(*this, copyop); }
|
|
|
|
bool isSameKindAs(const osg::Object* obj) const override
|
|
|
|
{
|
|
|
|
return dynamic_cast<const TerrainDrawable*>(obj) != nullptr;
|
|
|
|
}
|
|
|
|
const char* className() const override { return "TerrainDrawable"; }
|
|
|
|
const char* libraryName() const override { return "Terrain"; }
|
2017-03-03 17:26:40 +00:00
|
|
|
|
2020-04-23 09:12:10 +00:00
|
|
|
TerrainDrawable();
|
|
|
|
~TerrainDrawable(); // has to be defined in the cpp file because we only forward declared some members.
|
2017-03-03 17:26:40 +00:00
|
|
|
TerrainDrawable(const TerrainDrawable& copy, const osg::CopyOp& copyop);
|
|
|
|
|
2020-10-16 18:18:54 +00:00
|
|
|
void accept(osg::NodeVisitor& nv) override;
|
2017-03-03 17:26:40 +00:00
|
|
|
void cull(osgUtil::CullVisitor* cv);
|
|
|
|
|
|
|
|
typedef std::vector<osg::ref_ptr<osg::StateSet>> PassVector;
|
|
|
|
void setPasses(const PassVector& passes);
|
2021-09-27 19:32:18 +00:00
|
|
|
const PassVector& getPasses() const { return mPasses; }
|
2017-03-03 17:26:40 +00:00
|
|
|
|
2017-03-12 22:17:50 +00:00
|
|
|
void setLightListCallback(SceneUtil::LightListCallback* lightListCallback);
|
|
|
|
|
2019-08-10 13:37:00 +00:00
|
|
|
void createClusterCullingCallback();
|
|
|
|
|
2020-10-16 18:18:54 +00:00
|
|
|
void compileGLObjects(osg::RenderInfo& renderInfo) const override;
|
2017-03-03 17:26:40 +00:00
|
|
|
|
2020-04-23 09:12:10 +00:00
|
|
|
void setupWaterBoundingBox(float waterheight, float margin);
|
|
|
|
const osg::BoundingBox& getWaterBoundingBox() const { return mWaterBoundingBox; }
|
|
|
|
|
2019-02-20 13:37:00 +00:00
|
|
|
void setCompositeMap(CompositeMap* map) { mCompositeMap = map; }
|
2021-09-27 19:32:18 +00:00
|
|
|
CompositeMap* getCompositeMap() { return mCompositeMap; }
|
2019-02-20 13:37:00 +00:00
|
|
|
void setCompositeMapRenderer(CompositeMapRenderer* renderer) { mCompositeMapRenderer = renderer; }
|
|
|
|
|
2017-03-03 17:26:40 +00:00
|
|
|
private:
|
2020-04-23 09:12:10 +00:00
|
|
|
osg::BoundingBox mWaterBoundingBox;
|
2017-03-03 17:26:40 +00:00
|
|
|
PassVector mPasses;
|
|
|
|
|
2019-08-10 13:37:00 +00:00
|
|
|
osg::ref_ptr<osg::ClusterCullingCallback> mClusterCullingCallback;
|
|
|
|
|
2017-03-03 17:26:40 +00:00
|
|
|
osg::ref_ptr<SceneUtil::LightListCallback> mLightListCallback;
|
2019-02-20 13:37:00 +00:00
|
|
|
osg::ref_ptr<CompositeMap> mCompositeMap;
|
|
|
|
osg::ref_ptr<CompositeMapRenderer> mCompositeMapRenderer;
|
2017-03-03 17:26:40 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|