| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
#ifndef OSGXR_OPENXR_DEPTH_INFO |
| 5 |
#define OSGXR_OPENXR_DEPTH_INFO 1 |
| 6 |
|
| 7 |
#include <osg/Matrixd> |
| 8 |
|
| 9 |
namespace osgXR { |
| 10 |
|
| 11 |
namespace OpenXR { |
| 12 |
|
| 13 |
|
| 14 |
class DepthInfo |
| 15 |
{ |
| 16 |
public: |
| 17 |
|
| 18 |
DepthInfo() : |
| 19 |
_minDepth(0), |
| 20 |
_maxDepth(1), |
| 21 |
_nearZ(1), |
| 22 |
_farZ(10) |
| 23 |
{ |
| 24 |
} |
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
void setDepthRange(float minDepth, float maxDepth) |
| 29 |
{ |
| 30 |
_minDepth = minDepth; |
| 31 |
_maxDepth = maxDepth; |
| 32 |
} |
| 33 |
|
| 34 |
void setZRange(float nearZ, float farZ) |
| 35 |
{ |
| 36 |
_nearZ = nearZ; |
| 37 |
_farZ = farZ; |
| 38 |
} |
| 39 |
|
| 40 |
void setZRangeFromProjection(const osg::Matrixd &proj) |
| 41 |
{ |
| 42 |
float left, right, bottom, top; |
| 43 |
proj.getFrustum(left, right, bottom, top, _nearZ, _farZ); |
| 44 |
} |
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
float getMinDepth() const |
| 49 |
{ |
| 50 |
return _minDepth; |
| 51 |
} |
| 52 |
|
| 53 |
float getMaxDepth() const |
| 54 |
{ |
| 55 |
return _maxDepth; |
| 56 |
} |
| 57 |
|
| 58 |
float getNearZ() const |
| 59 |
{ |
| 60 |
return _nearZ; |
| 61 |
} |
| 62 |
|
| 63 |
float getFarZ() const |
| 64 |
{ |
| 65 |
return _farZ; |
| 66 |
} |
| 67 |
|
| 68 |
protected: |
| 69 |
|
| 70 |
float _minDepth; |
| 71 |
float _maxDepth; |
| 72 |
float _nearZ; |
| 73 |
float _farZ; |
| 74 |
}; |
| 75 |
|
| 76 |
} |
| 77 |
|
| 78 |
} |
| 79 |
|
| 80 |
#endif |