Debian Codegraph @

3rdparty/osgXR/src/Settings.cpp

raw symbols SCIP
1 // SPDX-License-Identifier: LGPL-2.1-only
2 // Copyright (C) 2021 James Hogan <[email protected]>
3
4 #include <osgXR/Settings>
5
6 #include <openxr/openxr.h>
7
8 #include "OpenXR/Instance.h"
9
10 using namespace osgXR;
11
12 Settings::Settings() :
13 _appName("osgXR"),
14 _appVersion(1),
15 _validationLayer(false),
16 _depthInfo(false),
17 _visibilityMask(true),
18 _formFactor(HEAD_MOUNTED_DISPLAY),
19 _preferredEnvBlendModeMask(0),
20 _allowedEnvBlendModeMask(0),
21 _vrMode(VRMODE_AUTOMATIC),
22 _swapchainMode(SWAPCHAIN_AUTOMATIC),
23 _preferredRGBEncodingMask(0),
24 _allowedRGBEncodingMask(0),
25 _preferredDepthEncodingMask(0),
26 _allowedDepthEncodingMask(0),
27 _rgbBits(-1),
28 _alphaBits(-1),
29 _depthBits(-1),
30 _stencilBits(-1),
31 _unitsPerMeter(1.0f)
32 {
33 }
34
35 Settings::~Settings()
36 {
37 }
38
39 Settings *Settings::instance()
40 {
41 static osg::ref_ptr<Settings> settings = new Settings();
42 return settings;
43 }
44
45 unsigned int Settings::_diff(const Settings &other) const
46 {
47 unsigned int ret = DIFF_NONE;
48 if (_appName != other._appName ||
49 _appVersion != other._appVersion)
50 ret |= DIFF_APP_INFO;
51 if (_validationLayer != other._validationLayer)
52 ret |= DIFF_VALIDATION_LAYER;
53 if (_depthInfo != other._depthInfo)
54 ret |= DIFF_DEPTH_INFO;
55 if (_visibilityMask != other._visibilityMask)
56 ret |= DIFF_VISIBILITY_MASK;
57 if (_formFactor != other._formFactor)
58 ret |= DIFF_FORM_FACTOR;
59 if (_preferredEnvBlendModeMask != other._preferredEnvBlendModeMask ||
60 _allowedEnvBlendModeMask != other._allowedEnvBlendModeMask)
61 ret |= DIFF_BLEND_MODE;
62 if (_vrMode != other._vrMode)
63 ret |= DIFF_VR_MODE;
64 if (_swapchainMode != other._swapchainMode)
65 ret |= DIFF_SWAPCHAIN_MODE;
66 if (_preferredRGBEncodingMask != other._preferredRGBEncodingMask ||
67 _allowedRGBEncodingMask != other._allowedRGBEncodingMask)
68 ret |= DIFF_RGB_ENCODING;
69 if (_preferredDepthEncodingMask != other._preferredDepthEncodingMask ||
70 _allowedDepthEncodingMask != other._allowedDepthEncodingMask)
71 ret |= DIFF_DEPTH_ENCODING;
72 if (_rgbBits != other._rgbBits)
73 ret |= DIFF_RGB_BITS;
74 if (_alphaBits != other._alphaBits)
75 ret |= DIFF_ALPHA_BITS;
76 if (_depthBits != other._depthBits)
77 ret |= DIFF_DEPTH_BITS;
78 if (_stencilBits != other._stencilBits)
79 ret |= DIFF_STENCIL_BITS;
80 if (_mirrorSettings != other._mirrorSettings)
81 ret |= DIFF_MIRROR;
82 if (_unitsPerMeter != other._unitsPerMeter)
83 ret |= DIFF_SCALE;
84 return ret;
85 }