| 1 | #ifndef _OF_DEPTHPARTITIONNODE_ |
|---|
| 2 | #define _OF_DEPTHPARTITIONNODE_ |
|---|
| 3 | |
|---|
| 4 | #include "DistanceAccumulator.h" |
|---|
| 5 | #include <osg/Camera> |
|---|
| 6 | |
|---|
| 7 | #define CURRENT_CLASS DepthPartitionNode |
|---|
| 8 | |
|---|
| 9 | |
|---|
| 10 | |
|---|
| 11 | |
|---|
| 12 | |
|---|
| 13 | |
|---|
| 14 | |
|---|
| 15 | |
|---|
| 16 | class CURRENT_CLASS : public osg::Group |
|---|
| 17 | { |
|---|
| 18 | public: |
|---|
| 19 | CURRENT_CLASS(); |
|---|
| 20 | CURRENT_CLASS(const CURRENT_CLASS& dpn, |
|---|
| 21 | const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY); |
|---|
| 22 | |
|---|
| 23 | META_Node( OpenFrames, CURRENT_CLASS ); |
|---|
| 24 | |
|---|
| 25 | |
|---|
| 26 | |
|---|
| 27 | void setActive(bool active); |
|---|
| 28 | inline bool getActive() const { return _active; } |
|---|
| 29 | |
|---|
| 30 | |
|---|
| 31 | |
|---|
| 32 | void setClearColorBuffer(bool clear); |
|---|
| 33 | inline bool getClearColorBuffer() const { return _clearColorBuffer; } |
|---|
| 34 | |
|---|
| 35 | |
|---|
| 36 | void setRenderOrder(osg::Camera::RenderOrder order); |
|---|
| 37 | inline osg::Camera::RenderOrder getRenderOrder() const |
|---|
| 38 | { return _renderOrder; } |
|---|
| 39 | |
|---|
| 40 | |
|---|
| 41 | |
|---|
| 42 | void setMaxTraversalDepth(unsigned int depth) |
|---|
| 43 | { _distAccumulator->setMaxDepth(depth); } |
|---|
| 44 | |
|---|
| 45 | inline unsigned int getMaxTraversalDepth() const |
|---|
| 46 | { return _distAccumulator->getMaxDepth(); } |
|---|
| 47 | |
|---|
| 48 | |
|---|
| 49 | virtual void traverse(osg::NodeVisitor &nv); |
|---|
| 50 | |
|---|
| 51 | |
|---|
| 52 | |
|---|
| 53 | virtual bool addChild(osg::Node *child); |
|---|
| 54 | virtual bool insertChild(unsigned int index, osg::Node *child); |
|---|
| 55 | virtual bool removeChildren(unsigned int pos, unsigned int numRemove = 1); |
|---|
| 56 | virtual bool setChild(unsigned int i, osg::Node *node); |
|---|
| 57 | |
|---|
| 58 | protected: |
|---|
| 59 | typedef std::vector< osg::ref_ptr<osg::Camera> > CameraList; |
|---|
| 60 | |
|---|
| 61 | ~CURRENT_CLASS(); |
|---|
| 62 | |
|---|
| 63 | void init(); |
|---|
| 64 | |
|---|
| 65 | |
|---|
| 66 | osg::Camera* createOrReuseCamera(const osg::Matrix& proj, |
|---|
| 67 | double znear, double zfar, |
|---|
| 68 | const unsigned int &camNum); |
|---|
| 69 | |
|---|
| 70 | bool _active; |
|---|
| 71 | |
|---|
| 72 | |
|---|
| 73 | osg::ref_ptr<DistanceAccumulator> _distAccumulator; |
|---|
| 74 | |
|---|
| 75 | osg::Camera::RenderOrder _renderOrder; |
|---|
| 76 | bool _clearColorBuffer; |
|---|
| 77 | |
|---|
| 78 | |
|---|
| 79 | |
|---|
| 80 | CameraList _cameraList; |
|---|
| 81 | unsigned int _numCameras; |
|---|
| 82 | }; |
|---|
| 83 | #undef CURRENT_CLASS |
|---|
| 84 | |
|---|
| 85 | #endif |
|---|