Debian Codegraph @

3rdparty/osgXR/src/OpenXR/DepthInfo.h

raw symbols SCIP
1 // SPDX-License-Identifier: LGPL-2.1-only
2 // Copyright (C) 2021 James Hogan <[email protected]>
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 // Represents depth information for a view
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 // Mutators
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 // Accessors
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 } // osgXR::OpenXR
77
78 } // osgXR
79
80 #endif