1
0
Fork 0

osgXR: Update to 0.5.0

Update 3rdparty/osgXR to version 0.5.0, which primarily gets us build
fixes for Windows. Unfortunately one of them requires an API breakage to
avoid some apparent preprocessor namespace pollution on Windows, which
will require minor source modification in FlightGear (left to the next
commit). The ABI is unchanged so binary compatibility is unaffected.
This commit is contained in:
James Hogan 2022-08-19 22:32:58 +01:00
parent 60ff405efc
commit 6c812a3dfd
No known key found for this signature in database
GPG key ID: 35CEE4862B1023F2
7 changed files with 38 additions and 15 deletions

View file

@ -1,3 +1,21 @@
Version 0.5.0
-------------
Highlights:
* Windows build fixes.
Changed APIs (source incompatible, binary compatible):
* Renamed Settings::BlendMode enumerations to fix windows build:
* Settings::OPAQUE -> Settings::BLEND\_MODE\_OPAQUE.
* Settings::ADDITIVE -> Settings::BLEND\_MODE\_ADDITIVE.
* Settings::ALPHA\_BLEND -> Settings::BLEND\_MODE\_ALPHA\_BLEND.
Bug fixes:
* Swapchain: Use weak\_ptr::lock() to avoid exception.
Behind the scenes:
* XRState: Use OSG defs for GL texture formats.
Version 0.3.9
-------------

View file

@ -2,8 +2,8 @@
cmake_minimum_required(VERSION 3.11)
set(osgXR_MAJOR_VERSION 0)
set(osgXR_MINOR_VERSION 3)
set(osgXR_PATCH_VERSION 9)
set(osgXR_MINOR_VERSION 5)
set(osgXR_PATCH_VERSION 0)
set(osgXR_SOVERSION 6)
set(osgXR_VERSION "${osgXR_MAJOR_VERSION}.${osgXR_MINOR_VERSION}.${osgXR_PATCH_VERSION}")

View file

@ -41,7 +41,7 @@ Getting Started
To import osgXR into a CMake based project, you can use the included CMake
module, adding something like this to your CMakeLists.txt:
```cmake
find_package(osgXR 0.3.8 REQUIRED)
find_package(osgXR 0.5.0 REQUIRED)
target_link_libraries(target
..

View file

@ -163,11 +163,11 @@ class OSGXR_EXPORT Settings : public osg::Referenced
{
// Matches XrEnvironmentBlendMode
/// Display layers with no view of physical world behind.
OPAQUE = 1,
BLEND_MODE_OPAQUE = 1,
/// Additively blend layers with view of physical world behind.
ADDITIVE = 2,
BLEND_MODE_ADDITIVE = 2,
/// Alpha blend layers with view of physical world behind.
ALPHA_BLEND = 3,
BLEND_MODE_ALPHA_BLEND = 3,
} BlendMode;
/**
* Specify a preferred environment blend mode.

View file

@ -31,7 +31,7 @@ class InitialDrawCallback : public osg::Camera::DrawCallback
void operator()(osg::RenderInfo& renderInfo) const override
{
auto swapchain = (std::shared_ptr<Swapchain::Private>)(_swapchain);
auto swapchain = _swapchain.lock();
if (swapchain)
swapchain->initialDrawCallback(renderInfo);
}
@ -51,14 +51,14 @@ class PreDrawCallback : public osg::Camera::DrawCallback
~PreDrawCallback()
{
auto swapchain = (std::shared_ptr<Swapchain::Private>)(_swapchain);
auto swapchain = _swapchain.lock();
if (swapchain)
swapchain->decNumDrawPasses();
}
void operator()(osg::RenderInfo& renderInfo) const override
{
auto swapchain = (std::shared_ptr<Swapchain::Private>)(_swapchain);
auto swapchain = _swapchain.lock();
if (swapchain)
swapchain->preDrawCallback(renderInfo);
}
@ -77,7 +77,7 @@ class PostDrawCallback : public osg::Camera::DrawCallback
void operator()(osg::RenderInfo& renderInfo) const override
{
auto swapchain = (std::shared_ptr<Swapchain::Private>)(_swapchain);
auto swapchain = _swapchain.lock();
if (swapchain)
swapchain->postDrawCallback(renderInfo);
}

View file

@ -19,6 +19,7 @@
#include <osg/Notify>
#include <osg/MatrixTransform>
#include <osg/RenderInfo>
#include <osg/Texture>
#include <osg/View>
#include <osgUtil/SceneView>
@ -32,6 +33,10 @@
#include <cmath>
#include <sstream>
#ifndef GL_DEPTH32F_STENCIL8
#define GL_DEPTH32F_STENCIL8 0x8cad
#endif
using namespace osgXR;
XRState::XRState(Settings *settings, Manager *manager) :
@ -1310,11 +1315,11 @@ int64_t XRState::chooseRGBAFormat(unsigned int bestRGBBits,
thisAlphaBits = 8;
goto handleRGBA;
// Linear floating point RGB(A)
case GL_RGB16F:
case GL_RGB16F_ARB:
thisRGBBits = 16 * 3;
thisEncoding = Settings::ENCODING_FLOAT;
goto handleRGBA;
case GL_RGBA16F:
case GL_RGBA16F_ARB:
thisRGBBits = 16 * 3;
thisEncoding = Settings::ENCODING_FLOAT;
thisAlphaBits = 16;
@ -1382,7 +1387,7 @@ GLenum XRState::chooseFallbackDepthFormat(unsigned int bestDepthBits,
return bestStencilBits ? GL_DEPTH32F_STENCIL8
: GL_DEPTH_COMPONENT32F;
else if (bestStencilBits)
return GL_DEPTH24_STENCIL8;
return GL_DEPTH24_STENCIL8_EXT;
else if (bestDepthBits > 16)
return GL_DEPTH_COMPONENT24;
else
@ -1427,7 +1432,7 @@ int64_t XRState::chooseDepthFormat(unsigned int bestDepthBits,
thisDepthBits = 24;
goto handleDepth;
#if 0 // crashes nvidia (495.46, with monado)
case GL_DEPTH24_STENCIL8:
case GL_DEPTH24_STENCIL8_EXT:
thisDepthBits = 24;
thisStencilBits = 8;
goto handleDepth;

View file

@ -77,7 +77,7 @@ void osgXR::setupViewerDefaults(osgViewer::Viewer *viewer,
settings->setApp(appName, appVersion);
settings->setFormFactor(Settings::HEAD_MOUNTED_DISPLAY);
settings->preferEnvBlendMode(Settings::OPAQUE);
settings->preferEnvBlendMode(Settings::BLEND_MODE_OPAQUE);
if (unitsPerMeter > 0.0f)
settings->setUnitsPerMeter(unitsPerMeter);
settings->setVRMode(vrMode);