/usr/include/osg/DisplaySettings is in libopenscenegraph-3.4-dev 3.4.0+dfsg1-4+b3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 | /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
#ifndef OSG_DisplaySettings
#define OSG_DisplaySettings 1
#include <osg/Referenced>
#include <osg/Matrixd>
#include <osg/ref_ptr>
#include <string>
#include <vector>
namespace osg {
// forward declare
class ArgumentParser;
class ApplicationUsage;
/** DisplaySettings class for encapsulating what visuals are required and
* have been set up, and the status of stereo viewing.*/
class OSG_EXPORT DisplaySettings : public osg::Referenced
{
public:
/** Maintain a DisplaySettings singleton for objects to query at runtime.*/
static ref_ptr<DisplaySettings>& instance();
DisplaySettings():
Referenced(true)
{
setDefaults();
readEnvironmentalVariables();
}
DisplaySettings(ArgumentParser& arguments):
Referenced(true)
{
setDefaults();
readEnvironmentalVariables();
readCommandLine(arguments);
}
DisplaySettings(const DisplaySettings& vs);
DisplaySettings& operator = (const DisplaySettings& vs);
void setDisplaySettings(const DisplaySettings& vs);
void merge(const DisplaySettings& vs);
void setDefaults();
/** read the environmental variables.*/
void readEnvironmentalVariables();
/** read the commandline arguments.*/
void readCommandLine(ArgumentParser& arguments);
enum DisplayType
{
MONITOR,
POWERWALL,
REALITY_CENTER,
HEAD_MOUNTED_DISPLAY
};
void setDisplayType(DisplayType type) { _displayType = type; }
DisplayType getDisplayType() const { return _displayType; }
void setStereo(bool on) { _stereo = on; }
bool getStereo() const { return _stereo; }
enum StereoMode
{
QUAD_BUFFER,
ANAGLYPHIC,
HORIZONTAL_SPLIT,
VERTICAL_SPLIT,
LEFT_EYE,
RIGHT_EYE,
HORIZONTAL_INTERLACE,
VERTICAL_INTERLACE,
CHECKERBOARD
};
void setStereoMode(StereoMode mode) { _stereoMode = mode; }
StereoMode getStereoMode() const { return _stereoMode; }
void setEyeSeparation(float eyeSeparation) { _eyeSeparation = eyeSeparation; }
float getEyeSeparation() const { return _eyeSeparation; }
enum SplitStereoHorizontalEyeMapping
{
LEFT_EYE_LEFT_VIEWPORT,
LEFT_EYE_RIGHT_VIEWPORT
};
void setSplitStereoHorizontalEyeMapping(SplitStereoHorizontalEyeMapping m) { _splitStereoHorizontalEyeMapping = m; }
SplitStereoHorizontalEyeMapping getSplitStereoHorizontalEyeMapping() const { return _splitStereoHorizontalEyeMapping; }
void setSplitStereoHorizontalSeparation(int s) { _splitStereoHorizontalSeparation = s; }
int getSplitStereoHorizontalSeparation() const { return _splitStereoHorizontalSeparation; }
enum SplitStereoVerticalEyeMapping
{
LEFT_EYE_TOP_VIEWPORT,
LEFT_EYE_BOTTOM_VIEWPORT
};
void setSplitStereoVerticalEyeMapping(SplitStereoVerticalEyeMapping m) { _splitStereoVerticalEyeMapping = m; }
SplitStereoVerticalEyeMapping getSplitStereoVerticalEyeMapping() const { return _splitStereoVerticalEyeMapping; }
void setSplitStereoVerticalSeparation(int s) { _splitStereoVerticalSeparation = s; }
int getSplitStereoVerticalSeparation() const { return _splitStereoVerticalSeparation; }
void setSplitStereoAutoAdjustAspectRatio(bool flag) { _splitStereoAutoAdjustAspectRatio=flag; }
bool getSplitStereoAutoAdjustAspectRatio() const { return _splitStereoAutoAdjustAspectRatio; }
void setScreenWidth(float width) { _screenWidth = width; }
float getScreenWidth() const { return _screenWidth; }
void setScreenHeight(float height) { _screenHeight = height; }
float getScreenHeight() const { return _screenHeight; }
void setScreenDistance(float distance) { _screenDistance = distance; }
float getScreenDistance() const { return _screenDistance; }
void setDoubleBuffer(bool flag) { _doubleBuffer = flag; }
bool getDoubleBuffer() const { return _doubleBuffer; }
void setRGB(bool flag) { _RGB = flag; }
bool getRGB() const { return _RGB; }
void setDepthBuffer(bool flag) { _depthBuffer = flag; }
bool getDepthBuffer() const { return _depthBuffer; }
void setMinimumNumAlphaBits(unsigned int bits) { _minimumNumberAlphaBits = bits; }
unsigned int getMinimumNumAlphaBits() const { return _minimumNumberAlphaBits; }
bool getAlphaBuffer() const { return _minimumNumberAlphaBits!=0; }
void setMinimumNumStencilBits(unsigned int bits) { _minimumNumberStencilBits = bits; }
unsigned int getMinimumNumStencilBits() const { return _minimumNumberStencilBits; }
bool getStencilBuffer() const { return _minimumNumberStencilBits!=0; }
void setMinimumNumAccumBits(unsigned int red, unsigned int green, unsigned int blue, unsigned int alpha);
unsigned int getMinimumNumAccumRedBits() const { return _minimumNumberAccumRedBits; }
unsigned int getMinimumNumAccumGreenBits() const { return _minimumNumberAccumGreenBits; }
unsigned int getMinimumNumAccumBlueBits() const { return _minimumNumberAccumBlueBits; }
unsigned int getMinimumNumAccumAlphaBits() const { return _minimumNumberAccumAlphaBits; }
bool getAccumBuffer() const { return (_minimumNumberAccumRedBits+_minimumNumberAccumGreenBits+_minimumNumberAccumBlueBits+_minimumNumberAccumAlphaBits)!=0; }
void setMaxNumberOfGraphicsContexts(unsigned int num);
unsigned int getMaxNumberOfGraphicsContexts() const;
void setNumMultiSamples(unsigned int samples) { _numMultiSamples = samples; }
unsigned int getNumMultiSamples() const { return _numMultiSamples; }
bool getMultiSamples() const { return _numMultiSamples!=0; }
void setCompileContextsHint(bool useCompileContexts) { _compileContextsHint = useCompileContexts; }
bool getCompileContextsHint() const { return _compileContextsHint; }
void setSerializeDrawDispatch(bool serializeDrawDispatch) { _serializeDrawDispatch = serializeDrawDispatch; }
bool getSerializeDrawDispatch() const { return _serializeDrawDispatch; }
void setUseSceneViewForStereoHint(bool hint) { _useSceneViewForStereoHint = hint; }
bool getUseSceneViewForStereoHint() const { return _useSceneViewForStereoHint; }
/** Set the hint for the total number of threads in the DatbasePager set up, inclusive of the number of http dedicated threads.*/
void setNumOfDatabaseThreadsHint(unsigned int numThreads) { _numDatabaseThreadsHint = numThreads; }
/** Get the hint for total number of threads in the DatbasePager set up, inclusive of the number of http dedicated threads.*/
unsigned int getNumOfDatabaseThreadsHint() const { return _numDatabaseThreadsHint; }
/** Set the hint for number of threads in the DatbasePager to dedicate to reading http requests.*/
void setNumOfHttpDatabaseThreadsHint(unsigned int numThreads) { _numHttpDatabaseThreadsHint = numThreads; }
/** Get the hint for number of threads in the DatbasePager dedicated to reading http requests.*/
unsigned int getNumOfHttpDatabaseThreadsHint() const { return _numHttpDatabaseThreadsHint; }
void setApplication(const std::string& application) { _application = application; }
const std::string& getApplication() { return _application; }
void setMaxTexturePoolSize(unsigned int size) { _maxTexturePoolSize = size; }
unsigned int getMaxTexturePoolSize() const { return _maxTexturePoolSize; }
void setMaxBufferObjectPoolSize(unsigned int size) { _maxBufferObjectPoolSize = size; }
unsigned int getMaxBufferObjectPoolSize() const { return _maxBufferObjectPoolSize; }
/**
Methods used to set and get defaults for Cameras implicit buffer attachments.
For more info: See description of Camera::setImplicitBufferAttachment method
DisplaySettings implicit buffer attachment selection defaults to: DEPTH and COLOR
for both primary (Render) FBO and secondary Multisample (Resolve) FBO
ie: IMPLICIT_DEPTH_BUFFER_ATTACHMENT | IMPLICIT_COLOR_BUFFER_ATTACHMENT
**/
enum ImplicitBufferAttachment
{
IMPLICIT_DEPTH_BUFFER_ATTACHMENT = (1 << 0),
IMPLICIT_STENCIL_BUFFER_ATTACHMENT = (1 << 1),
IMPLICIT_COLOR_BUFFER_ATTACHMENT = (1 << 2),
DEFAULT_IMPLICIT_BUFFER_ATTACHMENT = IMPLICIT_COLOR_BUFFER_ATTACHMENT | IMPLICIT_DEPTH_BUFFER_ATTACHMENT
};
typedef int ImplicitBufferAttachmentMask;
void setImplicitBufferAttachmentMask(ImplicitBufferAttachmentMask renderMask = DisplaySettings::DEFAULT_IMPLICIT_BUFFER_ATTACHMENT, ImplicitBufferAttachmentMask resolveMask = DisplaySettings::DEFAULT_IMPLICIT_BUFFER_ATTACHMENT )
{
_implicitBufferAttachmentRenderMask = renderMask;
_implicitBufferAttachmentResolveMask = resolveMask;
}
void setImplicitBufferAttachmentRenderMask(ImplicitBufferAttachmentMask implicitBufferAttachmentRenderMask)
{
_implicitBufferAttachmentRenderMask = implicitBufferAttachmentRenderMask;
}
void setImplicitBufferAttachmentResolveMask(ImplicitBufferAttachmentMask implicitBufferAttachmentResolveMask)
{
_implicitBufferAttachmentResolveMask = implicitBufferAttachmentResolveMask;
}
/** Get mask selecting default implicit buffer attachments for Cameras primary FBOs. */
ImplicitBufferAttachmentMask getImplicitBufferAttachmentRenderMask() const { return _implicitBufferAttachmentRenderMask; }
/** Get mask selecting default implicit buffer attachments for Cameras secondary MULTISAMPLE FBOs. */
ImplicitBufferAttachmentMask getImplicitBufferAttachmentResolveMask() const { return _implicitBufferAttachmentResolveMask;}
enum SwapMethod
{
SWAP_DEFAULT, // Leave swap method at default returned by choose Pixel Format.
SWAP_EXCHANGE, // Flip front / back buffer.
SWAP_COPY, // Copy back to front buffer.
SWAP_UNDEFINED // Move back to front buffer leaving contents of back buffer undefined.
};
/** Select preferred swap method */
void setSwapMethod( SwapMethod swapMethod ) { _swapMethod = swapMethod; }
/** Get preferred swap method */
SwapMethod getSwapMethod( void ) { return _swapMethod; }
/** Set whether Arb Sync should be used to manage the swaps buffers, 0 disables the use of the sync, greater than zero enables sync based on number of frames specified.*/
void setSyncSwapBuffers(unsigned int numFrames=0) { _syncSwapBuffers = numFrames; }
/** Set whether Arb Sync should be used to manage the swaps buffers.*/
unsigned int getSyncSwapBuffers() const { return _syncSwapBuffers; }
/** Set the hint of which OpenGL version to attempt to create a graphics context for.*/
void setGLContextVersion(const std::string& version) { _glContextVersion = version; }
/** Get the hint of which OpenGL version to attempt to create a graphics context for.*/
const std::string getGLContextVersion() const { return _glContextVersion; }
/** Set the hint of the flags to use in when creating graphic contexts.*/
void setGLContextFlags(unsigned int flags) { _glContextFlags = flags; }
/** Get the hint of the flags to use in when creating graphic contexts.*/
unsigned int getGLContextFlags() const { return _glContextFlags; }
/** Set the hint of the profile mask to use in when creating graphic contexts.*/
void setGLContextProfileMask(unsigned int mask) { _glContextProfileMask = mask; }
/** Get the hint of the profile mask to use in when creating graphic contexts.*/
unsigned int getGLContextProfileMask() const { return _glContextProfileMask; }
/** Set the NvOptimusEnablement value. Default can be set using OSG_NvOptimusEnablement env var.*/
void setNvOptimusEnablement(int value);
/** Get the NvOptimusEnablement value. */
int getNvOptimusEnablement() const;
void setKeystoneHint(bool enabled) { _keystoneHint = enabled; }
bool getKeystoneHint() const { return _keystoneHint; }
typedef std::vector<std::string> FileNames;
void setKeystoneFileNames(const FileNames& filenames) { _keystoneFileNames = filenames; }
FileNames& getKeystoneFileNames() { return _keystoneFileNames; }
const FileNames& getKeystoneFileNames() const { return _keystoneFileNames; }
typedef std::vector< osg::ref_ptr<osg::Object> > Objects;
void setKeystones(const Objects& objects) { _keystones = objects; }
Objects& getKeystones() { return _keystones; }
const Objects& getKeystones() const { return _keystones; }
enum OSXMenubarBehavior {
MENUBAR_AUTO_HIDE,
MENUBAR_FORCE_HIDE,
MENUBAR_FORCE_SHOW
};
OSXMenubarBehavior getOSXMenubarBehavior() const { return _OSXMenubarBehavior; }
void setOSXMenubarBehavior(OSXMenubarBehavior hint) { _OSXMenubarBehavior = hint; }
/** helper function for computing the left eye projection matrix.*/
virtual osg::Matrixd computeLeftEyeProjectionImplementation(const osg::Matrixd& projection) const;
/** helper function for computing the left eye view matrix.*/
virtual osg::Matrixd computeLeftEyeViewImplementation(const osg::Matrixd& view, double eyeSeperationScale=1.0) const;
/** helper function for computing the right eye view matrix.*/
virtual osg::Matrixd computeRightEyeProjectionImplementation(const osg::Matrixd& projection) const;
/** helper function for computing the right eye view matrix.*/
virtual osg::Matrixd computeRightEyeViewImplementation(const osg::Matrixd& view, double eyeSeperationScale=1.0) const;
protected:
virtual ~DisplaySettings();
DisplayType _displayType;
bool _stereo;
StereoMode _stereoMode;
float _eyeSeparation;
float _screenWidth;
float _screenHeight;
float _screenDistance;
SplitStereoHorizontalEyeMapping _splitStereoHorizontalEyeMapping;
int _splitStereoHorizontalSeparation;
SplitStereoVerticalEyeMapping _splitStereoVerticalEyeMapping;
int _splitStereoVerticalSeparation;
bool _splitStereoAutoAdjustAspectRatio;
bool _doubleBuffer;
bool _RGB;
bool _depthBuffer;
unsigned int _minimumNumberAlphaBits;
unsigned int _minimumNumberStencilBits;
unsigned int _minimumNumberAccumRedBits;
unsigned int _minimumNumberAccumGreenBits;
unsigned int _minimumNumberAccumBlueBits;
unsigned int _minimumNumberAccumAlphaBits;
unsigned int _maxNumOfGraphicsContexts;
unsigned int _numMultiSamples;
bool _compileContextsHint;
bool _serializeDrawDispatch;
bool _useSceneViewForStereoHint;
unsigned int _numDatabaseThreadsHint;
unsigned int _numHttpDatabaseThreadsHint;
std::string _application;
unsigned int _maxTexturePoolSize;
unsigned int _maxBufferObjectPoolSize;
ImplicitBufferAttachmentMask _implicitBufferAttachmentRenderMask;
ImplicitBufferAttachmentMask _implicitBufferAttachmentResolveMask;
std::string _glContextVersion;
unsigned int _glContextFlags;
unsigned int _glContextProfileMask;
SwapMethod _swapMethod;
unsigned int _syncSwapBuffers;
bool _keystoneHint;
FileNames _keystoneFileNames;
Objects _keystones;
OSXMenubarBehavior _OSXMenubarBehavior;
};
}
# endif
|