2002-07-17 04:07:32 +08:00
|
|
|
//C++ header - Open Scene Graph - Copyright (C) 1998-2002 Robert Osfield
|
2001-12-19 08:38:23 +08:00
|
|
|
//Distributed under the terms of the GNU Library General Public License (LGPL)
|
|
|
|
//as published by the Free Software Foundation.
|
|
|
|
|
2001-12-22 06:48:19 +08:00
|
|
|
#ifndef OSG_DisplaySettings
|
|
|
|
#define OSG_DisplaySettings 1
|
2001-12-19 08:38:23 +08:00
|
|
|
|
|
|
|
#include <osg/Referenced>
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
namespace osg {
|
|
|
|
|
2001-12-22 06:48:19 +08:00
|
|
|
/** DisplaySettings class for encapsulating what visuals are required and
|
2001-12-19 08:38:23 +08:00
|
|
|
* have been set up, and the status of stereo viewing.*/
|
2001-12-22 06:48:19 +08:00
|
|
|
class SG_EXPORT DisplaySettings : public osg::Referenced
|
2001-12-19 08:38:23 +08:00
|
|
|
{
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
2002-02-28 08:11:31 +08:00
|
|
|
/** Maintain a DisplaySettings singleton for objects to querry at runtime.*/
|
|
|
|
static DisplaySettings* instance();
|
|
|
|
|
|
|
|
|
2001-12-22 06:48:19 +08:00
|
|
|
DisplaySettings()
|
2001-12-19 08:38:23 +08:00
|
|
|
{
|
|
|
|
setDefaults();
|
|
|
|
readEnvironmentalVariables();
|
|
|
|
}
|
|
|
|
|
2001-12-22 06:48:19 +08:00
|
|
|
DisplaySettings(std::vector<std::string>& commandLine)
|
2001-12-19 08:38:23 +08:00
|
|
|
{
|
|
|
|
setDefaults();
|
|
|
|
readEnvironmentalVariables();
|
|
|
|
readCommandLine(commandLine);
|
|
|
|
}
|
|
|
|
|
2001-12-22 06:48:19 +08:00
|
|
|
DisplaySettings(const DisplaySettings& vs);
|
2001-12-19 08:38:23 +08:00
|
|
|
|
2001-12-22 06:48:19 +08:00
|
|
|
virtual ~DisplaySettings();
|
2001-12-19 08:38:23 +08:00
|
|
|
|
2002-02-28 08:11:31 +08:00
|
|
|
|
|
|
|
|
2001-12-22 06:48:19 +08:00
|
|
|
DisplaySettings& operator = (const DisplaySettings& vs);
|
2002-02-28 08:11:31 +08:00
|
|
|
|
2001-12-19 08:38:23 +08:00
|
|
|
|
2001-12-22 06:48:19 +08:00
|
|
|
void merge(const DisplaySettings& vs);
|
2001-12-19 08:38:23 +08:00
|
|
|
|
|
|
|
void setDefaults();
|
|
|
|
|
|
|
|
void readEnvironmentalVariables();
|
|
|
|
|
|
|
|
/** read the command line string list, removing any matched control sequences.*/
|
|
|
|
void readCommandLine(std::vector<std::string>& commandLine);
|
|
|
|
|
|
|
|
|
|
|
|
|
2002-09-02 20:31:35 +08:00
|
|
|
void setStereo(bool on) { _stereo = on; }
|
|
|
|
bool getStereo() const { return _stereo; }
|
2001-12-19 08:38:23 +08:00
|
|
|
|
|
|
|
enum StereoMode
|
|
|
|
{
|
|
|
|
QUAD_BUFFER,
|
|
|
|
ANAGLYPHIC,
|
|
|
|
HORIZONTAL_SPLIT,
|
|
|
|
VERTICAL_SPLIT
|
|
|
|
};
|
|
|
|
|
2002-09-02 20:31:35 +08:00
|
|
|
void setStereoMode(StereoMode mode) { _stereoMode = mode; }
|
|
|
|
StereoMode getStereoMode() const { return _stereoMode; }
|
2001-12-19 08:38:23 +08:00
|
|
|
|
2002-09-02 20:31:35 +08:00
|
|
|
void setEyeSeparation(float eyeSeparation) { _eyeSeparation = eyeSeparation; }
|
|
|
|
float getEyeSeparation() const { return _eyeSeparation; }
|
2001-12-19 08:38:23 +08:00
|
|
|
|
2002-09-02 20:31:35 +08:00
|
|
|
void setScreenDistance(float distance) { _screenDistance = distance; }
|
|
|
|
float getScreenDistance() const { return _screenDistance; }
|
2001-12-19 08:38:23 +08:00
|
|
|
|
2002-04-15 06:21:59 +08:00
|
|
|
enum SplitStereoHorizontalEyeMapping
|
|
|
|
{
|
|
|
|
LEFT_EYE_LEFT_VIEWPORT,
|
|
|
|
LEFT_EYE_RIGHT_VIEWPORT
|
|
|
|
};
|
|
|
|
|
|
|
|
void setSplitStereoHorizontalEyeMapping(SplitStereoHorizontalEyeMapping m) { _splitStereoHorizontalEyeMapping = m; }
|
|
|
|
SplitStereoHorizontalEyeMapping getSplitStereoHorizontalEyeMapping() const { return _splitStereoHorizontalEyeMapping; }
|
|
|
|
|
2002-09-02 20:31:35 +08:00
|
|
|
void setSplitStereoHorizontalSeparation(int s) { _splitStereoHorizontalSeparation = s; }
|
|
|
|
int getSplitStereoHorizontalSeparation() const { return _splitStereoHorizontalSeparation; }
|
2002-04-15 06:21:59 +08:00
|
|
|
|
|
|
|
enum SplitStereoVerticalEyeMapping
|
|
|
|
{
|
|
|
|
LEFT_EYE_TOP_VIEWPORT,
|
2002-05-27 14:37:51 +08:00
|
|
|
LEFT_EYE_BOTTOM_VIEWPORT
|
2002-04-15 06:21:59 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
void setSplitStereoVerticalEyeMapping(SplitStereoVerticalEyeMapping m) { _splitStereoVerticalEyeMapping = m; }
|
|
|
|
SplitStereoVerticalEyeMapping getSplitStereoVerticalEyeMapping() const { return _splitStereoVerticalEyeMapping; }
|
|
|
|
|
2002-09-02 20:31:35 +08:00
|
|
|
void setSplitStereoVerticalSeparation(int s) { _splitStereoVerticalSeparation = s; }
|
|
|
|
int getSplitStereoVerticalSeparation() const { return _splitStereoVerticalSeparation; }
|
2002-04-15 06:21:59 +08:00
|
|
|
|
2001-12-19 08:38:23 +08:00
|
|
|
|
2002-09-02 20:31:35 +08:00
|
|
|
void setScreenHeight(float height) { _screenHeight = height; }
|
|
|
|
float getScreenHeight() const { return _screenHeight; }
|
2001-12-22 06:48:19 +08:00
|
|
|
|
2001-12-19 08:38:23 +08:00
|
|
|
|
2002-09-02 20:31:35 +08:00
|
|
|
void setDoubleBuffer(bool flag) { _doubleBuffer = flag; }
|
|
|
|
bool getDoubleBuffer() const { return _doubleBuffer; }
|
2001-12-19 08:38:23 +08:00
|
|
|
|
|
|
|
|
2002-09-02 20:31:35 +08:00
|
|
|
void setRGB(bool flag) { _RGB = flag; }
|
|
|
|
bool getRGB() const { return _RGB; }
|
2001-12-19 08:38:23 +08:00
|
|
|
|
|
|
|
|
2002-09-02 20:31:35 +08:00
|
|
|
void setDepthBuffer(bool flag) { _depthBuffer = flag; }
|
|
|
|
bool getDepthBuffer() const { return _depthBuffer; }
|
2001-12-19 08:38:23 +08:00
|
|
|
|
|
|
|
|
2002-09-02 20:31:35 +08:00
|
|
|
void setMinimumNumAlphaBits(unsigned int bits) { _minimumNumberAlphaBits = bits; }
|
|
|
|
unsigned int getMinimumNumAlphaBits() const { return _minimumNumberAlphaBits; }
|
|
|
|
bool getAlphaBuffer() const { return _minimumNumberAlphaBits!=0; }
|
2001-12-19 08:38:23 +08:00
|
|
|
|
|
|
|
|
2002-09-02 20:31:35 +08:00
|
|
|
void setMinimumNumStencilBits(unsigned int bits) { _minimumNumberStencilBits = bits; }
|
|
|
|
unsigned int getMinimumNumStencilBits() const { return _minimumNumberStencilBits; }
|
|
|
|
bool getStencilBuffer() const { return _minimumNumberStencilBits!=0; }
|
2001-12-19 08:38:23 +08:00
|
|
|
|
2002-02-28 08:11:31 +08:00
|
|
|
|
2002-09-04 18:49:17 +08:00
|
|
|
void setMaxNumberOfGraphicsContexts(unsigned int num) { _maxNumOfGraphicsContexts = num; }
|
|
|
|
unsigned int getMaxNumberOfGraphicsContexts() const { return _maxNumOfGraphicsContexts; }
|
2002-02-28 08:11:31 +08:00
|
|
|
|
|
|
|
|
2001-12-19 08:38:23 +08:00
|
|
|
protected:
|
|
|
|
|
2001-12-22 06:48:19 +08:00
|
|
|
void copy(const DisplaySettings& vs);
|
2001-12-19 08:38:23 +08:00
|
|
|
|
2002-04-15 06:21:59 +08:00
|
|
|
bool _stereo;
|
|
|
|
StereoMode _stereoMode;
|
2002-08-29 11:22:27 +08:00
|
|
|
float _eyeSeparation;
|
2002-04-15 06:21:59 +08:00
|
|
|
float _screenDistance;
|
|
|
|
float _screenHeight;
|
|
|
|
|
|
|
|
SplitStereoHorizontalEyeMapping _splitStereoHorizontalEyeMapping;
|
2002-08-29 11:22:27 +08:00
|
|
|
int _splitStereoHorizontalSeparation;
|
2002-04-15 06:21:59 +08:00
|
|
|
SplitStereoVerticalEyeMapping _splitStereoVerticalEyeMapping;
|
2002-08-29 11:22:27 +08:00
|
|
|
int _splitStereoVerticalSeparation;
|
2001-12-19 08:38:23 +08:00
|
|
|
|
2002-04-15 06:21:59 +08:00
|
|
|
bool _doubleBuffer;
|
|
|
|
bool _RGB;
|
|
|
|
bool _depthBuffer;
|
|
|
|
unsigned int _minimumNumberAlphaBits;
|
|
|
|
unsigned int _minimumNumberStencilBits;
|
2001-12-19 08:38:23 +08:00
|
|
|
|
2002-09-04 18:49:17 +08:00
|
|
|
unsigned int _maxNumOfGraphicsContexts;
|
2001-12-19 08:38:23 +08:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
# endif
|