1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-31 06:45:35 +00:00

\#5534 remove OSG 3.4 support and require at least 3.6.5 support

This commit is contained in:
Bret Curtis 2022-08-01 11:34:43 +02:00
parent 0a16d54865
commit 231d60995b
8 changed files with 84 additions and 199 deletions

View file

@ -407,10 +407,7 @@ if(NOT HAVE_STDINT_H)
endif() endif()
if(OPENMW_USE_SYSTEM_OSG) if(OPENMW_USE_SYSTEM_OSG)
find_package(OpenSceneGraph 3.4.0 REQUIRED ${USED_OSG_COMPONENTS}) find_package(OpenSceneGraph 3.6.5 REQUIRED ${USED_OSG_COMPONENTS})
if (${OPENSCENEGRAPH_VERSION} VERSION_GREATER 3.6.2 AND ${OPENSCENEGRAPH_VERSION} VERSION_LESS 3.6.5)
message(FATAL_ERROR "OpenSceneGraph version ${OPENSCENEGRAPH_VERSION} has critical regressions which cause crashes. Please upgrade to 3.6.5 or later. We strongly recommend using the tip of the official 'OpenSceneGraph-3.6' branch or the tip of '3.6' OpenMW/osg (OSGoS).")
endif()
if(OSG_STATIC) if(OSG_STATIC)
find_package(OSGPlugins REQUIRED COMPONENTS ${USED_OSG_PLUGINS}) find_package(OSGPlugins REQUIRED COMPONENTS ${USED_OSG_PLUGINS})

View file

@ -12,7 +12,6 @@
#include <osgViewer/ViewerEventHandlers> #include <osgViewer/ViewerEventHandlers>
#include <osg/LightModel> #include <osg/LightModel>
#include <osg/Material> #include <osg/Material>
#include <osg/Version>
#include <components/debug/debuglog.hpp> #include <components/debug/debuglog.hpp>
#include <components/resource/scenemanager.hpp> #include <components/resource/scenemanager.hpp>
@ -97,14 +96,6 @@ RenderWidget::~RenderWidget()
try try
{ {
CompositeViewer::get().removeView(mView); CompositeViewer::get().removeView(mView);
#if OSG_VERSION_LESS_THAN(3,6,5)
// before OSG 3.6.4, the default font was a static object, and if it wasn't attached to the scene when a graphics context was destroyed, it's program wouldn't be released.
// 3.6.4 moved it into the object cache, which meant it usually got released, but not here.
// 3.6.5 improved cleanup with osgViewer::CompositeViewer::removeView so it more reliably released associated state for objects in the object cache.
osg::ref_ptr<osg::GraphicsContext> graphicsContext = mView->getCamera()->getGraphicsContext();
osgText::Font::getDefaultFont()->releaseGLObjects(graphicsContext->getState());
#endif
} }
catch(const std::exception& e) catch(const std::exception& e)
{ {
@ -146,9 +137,7 @@ CompositeViewer::CompositeViewer()
// https://gitlab.com/OpenMW/openmw/-/issues/5481 // https://gitlab.com/OpenMW/openmw/-/issues/5481
setThreadingModel(osgViewer::ViewerBase::SingleThreaded); setThreadingModel(osgViewer::ViewerBase::SingleThreaded);
#if OSG_VERSION_GREATER_OR_EQUAL(3,5,5)
setUseConfigureAffinity(false); setUseConfigureAffinity(false);
#endif
// disable the default setting of viewer.done() by pressing Escape. // disable the default setting of viewer.done() by pressing Escape.
setKeyEventSetsDone(0); setKeyEventSetsDone(0);

View file

@ -1032,10 +1032,8 @@ void OMW::Engine::go()
mViewer = new osgViewer::Viewer; mViewer = new osgViewer::Viewer;
mViewer->setReleaseContextAtEndOfFrameHint(false); mViewer->setReleaseContextAtEndOfFrameHint(false);
#if OSG_VERSION_GREATER_OR_EQUAL(3,5,5)
// Do not try to outsmart the OS thread scheduler (see bug #4785). // Do not try to outsmart the OS thread scheduler (see bug #4785).
mViewer->setUseConfigureAffinity(false); mViewer->setUseConfigureAffinity(false);
#endif
mEnvironment.setFrameRateLimit(Settings::Manager::getFloat("framerate limit", "Video")); mEnvironment.setFrameRateLimit(Settings::Manager::getFloat("framerate limit", "Video"));

View file

@ -1,12 +1,10 @@
#include "loadingscreen.hpp" #include "loadingscreen.hpp"
#include <array> #include <array>
#include <condition_variable>
#include <osgViewer/Viewer> #include <osgViewer/Viewer>
#include <osg/Texture2D> #include <osg/Texture2D>
#include <osg/Version>
#include <MyGUI_ScrollBar.h> #include <MyGUI_ScrollBar.h>
#include <MyGUI_Gui.h> #include <MyGUI_Gui.h>
@ -305,12 +303,8 @@ namespace MWGui
mCopyFramebufferToTextureCallback = new CopyFramebufferToTextureCallback(mTexture); mCopyFramebufferToTextureCallback = new CopyFramebufferToTextureCallback(mTexture);
} }
#if OSG_VERSION_GREATER_OR_EQUAL(3, 5, 10)
mViewer->getCamera()->removeInitialDrawCallback(mCopyFramebufferToTextureCallback); mViewer->getCamera()->removeInitialDrawCallback(mCopyFramebufferToTextureCallback);
mViewer->getCamera()->addInitialDrawCallback(mCopyFramebufferToTextureCallback); mViewer->getCamera()->addInitialDrawCallback(mCopyFramebufferToTextureCallback);
#else
mViewer->getCamera()->setInitialDrawCallback(mCopyFramebufferToTextureCallback);
#endif
mCopyFramebufferToTextureCallback->reset(); mCopyFramebufferToTextureCallback->reset();
mSplashImage->setBackgroundImage(""); mSplashImage->setBackgroundImage("");

View file

@ -12,7 +12,6 @@
#include <osg/ColorMask> #include <osg/ColorMask>
#include <osg/BlendFunc> #include <osg/BlendFunc>
#include <osg/AlphaFunc> #include <osg/AlphaFunc>
#include <osg/Version>
#include <osg/observer_ptr> #include <osg/observer_ptr>
#include <osg/PositionAttitudeTransform> #include <osg/PositionAttitudeTransform>
@ -855,12 +854,8 @@ namespace MWRender
osg::ref_ptr<osg::OcclusionQueryNode> oqn = new osg::OcclusionQueryNode; osg::ref_ptr<osg::OcclusionQueryNode> oqn = new osg::OcclusionQueryNode;
oqn->setQueriesEnabled(true); oqn->setQueriesEnabled(true);
#if OSG_VERSION_GREATER_OR_EQUAL(3, 6, 5)
// With OSG 3.6.5, the method of providing user defined query geometry has been completely replaced // With OSG 3.6.5, the method of providing user defined query geometry has been completely replaced
osg::ref_ptr<osg::QueryGeometry> queryGeom = new osg::QueryGeometry(oqn->getName()); osg::ref_ptr<osg::QueryGeometry> queryGeom = new osg::QueryGeometry(oqn->getName());
#else
osg::ref_ptr<osg::QueryGeometry> queryGeom = oqn->getQueryGeometry();
#endif
// Make it fast! A DYNAMIC query geometry means we can't break frame until the flare is rendered (which is rendered after all the other geometry, // Make it fast! A DYNAMIC query geometry means we can't break frame until the flare is rendered (which is rendered after all the other geometry,
// so that would be pretty bad). STATIC should be safe, since our node's local bounds are static, thus computeBounds() which modifies the queryGeometry // so that would be pretty bad). STATIC should be safe, since our node's local bounds are static, thus computeBounds() which modifies the queryGeometry
@ -881,9 +876,7 @@ namespace MWRender
// Still need a proper bounding sphere. // Still need a proper bounding sphere.
oqn->setInitialBound(queryGeom->getBound()); oqn->setInitialBound(queryGeom->getBound());
#if OSG_VERSION_GREATER_OR_EQUAL(3, 6, 5)
oqn->setQueryGeometry(queryGeom.release()); oqn->setQueryGeometry(queryGeom.release());
#endif
osg::StateSet* queryStateSet = new osg::StateSet; osg::StateSet* queryStateSet = new osg::StateSet;
if (queryVisible) if (queryVisible)

View file

@ -1,70 +0,0 @@
version: "{build}"
branches:
only:
- master
- /openmw-.*$/
- appveyor
environment:
matrix:
- msvc: 2017
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
- msvc: 2019
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
platform:
- x64
configuration:
# - Debug
- Release
# - RelWithDebInfo
# We want the git revision for versioning,
# so shallow clones don't work.
clone_depth: 1
cache:
- C:\projects\openmw\deps\Bullet-2.89-msvc2017-win64-double.7z
- C:\projects\openmw\deps\MyGUI-3.4.1-msvc2017-win64.7z
- C:\projects\openmw\deps\MyGUI-3.4.1-msvc2019-win64.7z
- C:\projects\openmw\deps\OSGoS-3.6.5-b02abe2-msvc2017-win64.7z
- C:\projects\openmw\deps\OSGoS-3.6.5-b02abe2-msvc2019-win64.7z
- C:\projects\openmw\deps\ffmpeg-4.2.2-dev-win64.zip
- C:\projects\openmw\deps\ffmpeg-4.2.2-win64.zip
- C:\projects\openmw\deps\OpenAL-Soft-1.20.1.zip
- C:\projects\openmw\deps\SDL2-2.0.18.zip
clone_folder: C:\projects\openmw
install:
- set PATH=C:\Program Files\Git\mingw64\bin;%PATH%
before_build:
- cmd: git submodule update --init --recursive
- cmd: sh %APPVEYOR_BUILD_FOLDER%\CI\before_script.msvc.sh -c %configuration% -p %PLATFORM% -v %msvc% -V -i %APPVEYOR_BUILD_FOLDER%\install
build_script:
- cmd: if %PLATFORM%==x64 set build=MSVC%msvc%_64
- cmd: msbuild %build%\OpenMW.sln /t:Build /p:Configuration=%configuration% /m:2 /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
- cmd: cmake --install %build% --config %configuration%
after_build:
- cmd: if %PLATFORM%==x64 7z a OpenMW_MSVC%msvc%_%platform%_%appveyor_pull_request_number%_%appveyor_pull_request_head_commit%.zip %APPVEYOR_BUILD_FOLDER%\install -xr"!*.pdb"
#- cmd: if %PLATFORM%==x64 7z a OpenMW_MSVC%msvc%_%platform%_%appveyor_pull_request_number%_%appveyor_pull_request_head_commit%_pdb.zip %APPVEYOR_BUILD_FOLDER%\MSVC%msvc%_64\%configuration%\*.pdb
test: off
#notifications:
# - provider: Email
# to:
# -
# on_build_failure: true
# on_build_status_changed: true
artifacts:
- path: OpenMW_MSVC%msvc%_%platform%_%appveyor_pull_request_number%_%appveyor_pull_request_head_commit%.zip
name: OpenMW_MSVC%msvc%_%platform%_%appveyor_pull_request_number%_%appveyor_pull_request_head_commit%
#- path: OpenMW_MSVC%msvc%_%platform%_%appveyor_pull_request_number%_%appveyor_pull_request_head_commit%_pdb.zip
# name: OpenMW_MSVC%msvc%_%platform%_%appveyor_pull_request_number%_%appveyor_pull_request_head_commit%_pdb

View file

@ -8,7 +8,6 @@
#include <osg/BufferObject> #include <osg/BufferObject>
#include <osg/BufferIndexBinding> #include <osg/BufferIndexBinding>
#include <osg/Endian> #include <osg/Endian>
#include <osg/Version>
#include <osg/ValueObject> #include <osg/ValueObject>
#include <osgUtil/CullVisitor> #include <osgUtil/CullVisitor>
@ -77,9 +76,9 @@ namespace SceneUtil
namespace namespace
{ {
const std::unordered_map<std::string, LightingMethod> lightingMethodSettingMap = { const std::unordered_map<std::string, LightingMethod> lightingMethodSettingMap = {
{"legacy", LightingMethod::FFP}, {"legacy", LightingMethod::FFP},
{"shaders compatibility", LightingMethod::PerObjectUniform}, {"shaders compatibility", LightingMethod::PerObjectUniform},
{"shaders", LightingMethod::SingleUBO}, {"shaders", LightingMethod::SingleUBO},
}; };
} }
@ -101,10 +100,10 @@ namespace SceneUtil
}; };
LightBuffer(int count) LightBuffer(int count)
: mData(new osg::FloatArray(3*4*count)) : mData(new osg::FloatArray(3*4*count))
, mEndian(osg::getCpuByteOrder()) , mEndian(osg::getCpuByteOrder())
, mCount(count) , mCount(count)
, mCachedSunPos(osg::Vec4()) , mCachedSunPos(osg::Vec4())
{ {
} }
@ -199,40 +198,40 @@ namespace SceneUtil
private: private:
class Offsets class Offsets
{ {
public: public:
Offsets() Offsets()
: mStride(12) : mStride(12)
{ {
mValues[Diffuse] = 0; mValues[Diffuse] = 0;
mValues[Ambient] = 1; mValues[Ambient] = 1;
mValues[Specular] = 2; mValues[Specular] = 2;
mValues[DiffuseSign] = 3; mValues[DiffuseSign] = 3;
mValues[Position] = 4; mValues[Position] = 4;
mValues[AttenuationRadius] = 8; mValues[AttenuationRadius] = 8;
} }
Offsets(int offsetColors, int offsetPosition, int offsetAttenuationRadius, int stride) Offsets(int offsetColors, int offsetPosition, int offsetAttenuationRadius, int stride)
: mStride((offsetAttenuationRadius + sizeof(GLfloat) * osg::Vec4::num_components + stride) / 4) : mStride((offsetAttenuationRadius + sizeof(GLfloat) * osg::Vec4::num_components + stride) / 4)
{ {
constexpr auto sizeofFloat = sizeof(GLfloat); constexpr auto sizeofFloat = sizeof(GLfloat);
const auto diffuseOffset = offsetColors / sizeofFloat; const auto diffuseOffset = offsetColors / sizeofFloat;
mValues[Diffuse] = diffuseOffset; mValues[Diffuse] = diffuseOffset;
mValues[Ambient] = diffuseOffset + 1; mValues[Ambient] = diffuseOffset + 1;
mValues[Specular] = diffuseOffset + 2; mValues[Specular] = diffuseOffset + 2;
mValues[DiffuseSign] = diffuseOffset + 3; mValues[DiffuseSign] = diffuseOffset + 3;
mValues[Position] = offsetPosition / sizeofFloat; mValues[Position] = offsetPosition / sizeofFloat;
mValues[AttenuationRadius] = offsetAttenuationRadius / sizeofFloat; mValues[AttenuationRadius] = offsetAttenuationRadius / sizeofFloat;
} }
int get(int index, LayoutOffset slot) const int get(int index, LayoutOffset slot) const
{ {
return mStride * index + mValues[slot]; return mStride * index + mValues[slot];
} }
private: private:
int mStride; int mStride;
std::array<int, 6> mValues; std::array<int, 6> mValues;
}; };
void configureLayout(const Offsets& offsets, int size) void configureLayout(const Offsets& offsets, int size)
@ -276,11 +275,11 @@ namespace SceneUtil
auto method = lightManager->getLightingMethod(); auto method = lightManager->getLightingMethod();
switch (method) switch (method)
{ {
case LightingMethod::FFP: case LightingMethod::FFP:
{ {
break; break;
} }
case LightingMethod::PerObjectUniform: case LightingMethod::PerObjectUniform:
{ {
osg::Matrixf lightMat; osg::Matrixf lightMat;
configurePosition(lightMat, light->getPosition()); configurePosition(lightMat, light->getPosition());
@ -291,7 +290,7 @@ namespace SceneUtil
stateset->addUniform(lightManager->generateLightBufferUniform(lightMat), mode); stateset->addUniform(lightManager->generateLightBufferUniform(lightMat), mode);
break; break;
} }
case LightingMethod::SingleUBO: case LightingMethod::SingleUBO:
{ {
osg::ref_ptr<LightBuffer> buffer = new LightBuffer(lightManager->getMaxLightsInScene()); osg::ref_ptr<LightBuffer> buffer = new LightBuffer(lightManager->getMaxLightsInScene());
@ -302,11 +301,7 @@ namespace SceneUtil
osg::ref_ptr<osg::UniformBufferObject> ubo = new osg::UniformBufferObject; osg::ref_ptr<osg::UniformBufferObject> ubo = new osg::UniformBufferObject;
buffer->getData()->setBufferObject(ubo); buffer->getData()->setBufferObject(ubo);
#if OSG_VERSION_GREATER_OR_EQUAL(3,5,7)
osg::ref_ptr<osg::UniformBufferBinding> ubb = new osg::UniformBufferBinding(static_cast<int>(Resource::SceneManager::UBOBinding::LightBuffer), buffer->getData(), 0, buffer->getData()->getTotalDataSize()); osg::ref_ptr<osg::UniformBufferBinding> ubb = new osg::UniformBufferBinding(static_cast<int>(Resource::SceneManager::UBOBinding::LightBuffer), buffer->getData(), 0, buffer->getData()->getTotalDataSize());
#else
osg::ref_ptr<osg::UniformBufferBinding> ubb = new osg::UniformBufferBinding(static_cast<int>(Resource::SceneManager::UBOBinding::LightBuffer), ubo, 0, buffer->getData()->getTotalDataSize());
#endif
stateset->setAttributeAndModes(ubb, mode); stateset->setAttributeAndModes(ubb, mode);
break; break;
@ -321,7 +316,7 @@ namespace SceneUtil
DisableLight(int index) : mIndex(index) {} DisableLight(int index) : mIndex(index) {}
DisableLight(const DisableLight& copy,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY) DisableLight(const DisableLight& copy,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY)
: osg::StateAttribute(copy,copyop), mIndex(copy.mIndex) {} : osg::StateAttribute(copy,copyop), mIndex(copy.mIndex) {}
META_StateAttribute(SceneUtil, DisableLight, osg::StateAttribute::LIGHT) META_StateAttribute(SceneUtil, DisableLight, osg::StateAttribute::LIGHT)
@ -364,7 +359,7 @@ namespace SceneUtil
FFPLightStateAttribute(size_t index, const std::vector<osg::ref_ptr<osg::Light>>& lights) : mIndex(index), mLights(lights) {} FFPLightStateAttribute(size_t index, const std::vector<osg::ref_ptr<osg::Light>>& lights) : mIndex(index), mLights(lights) {}
FFPLightStateAttribute(const FFPLightStateAttribute& copy,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY) FFPLightStateAttribute(const FFPLightStateAttribute& copy,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY)
: osg::StateAttribute(copy,copyop), mIndex(copy.mIndex), mLights(copy.mLights) {} : osg::StateAttribute(copy,copyop), mIndex(copy.mIndex), mLights(copy.mLights) {}
unsigned int getMember() const override unsigned int getMember() const override
{ {
@ -562,11 +557,11 @@ namespace SceneUtil
{ {
public: public:
CollectLightCallback() CollectLightCallback()
: mLightManager(nullptr) { } : mLightManager(nullptr) { }
CollectLightCallback(const CollectLightCallback& copy, const osg::CopyOp& copyop) CollectLightCallback(const CollectLightCallback& copy, const osg::CopyOp& copyop)
: NodeCallback<CollectLightCallback>(copy, copyop) : NodeCallback<CollectLightCallback>(copy, copyop)
, mLightManager(nullptr) { } , mLightManager(nullptr) { }
META_Object(SceneUtil, CollectLightCallback) META_Object(SceneUtil, CollectLightCallback)
@ -614,11 +609,7 @@ namespace SceneUtil
for (size_t i = 0; i < mStateSet.size(); ++i) for (size_t i = 0; i < mStateSet.size(); ++i)
{ {
auto& buffer = lightManager->getUBOManager()->getLightBuffer(i); auto& buffer = lightManager->getUBOManager()->getLightBuffer(i);
#if OSG_VERSION_GREATER_OR_EQUAL(3,5,7)
osg::ref_ptr<osg::UniformBufferBinding> ubb = new osg::UniformBufferBinding(static_cast<int>(Resource::SceneManager::UBOBinding::LightBuffer), buffer->getData(), 0, buffer->getData()->getTotalDataSize()); osg::ref_ptr<osg::UniformBufferBinding> ubb = new osg::UniformBufferBinding(static_cast<int>(Resource::SceneManager::UBOBinding::LightBuffer), buffer->getData(), 0, buffer->getData()->getTotalDataSize());
#else
osg::ref_ptr<osg::UniformBufferBinding> ubb = new osg::UniformBufferBinding(static_cast<int>(Resource::SceneManager::UBOBinding::LightBuffer), buffer->getData()->getBufferObject(), 0, buffer->getData()->getTotalDataSize());
#endif
mStateSet[i]->setAttributeAndModes(ubb, osg::StateAttribute::ON); mStateSet[i]->setAttributeAndModes(ubb, osg::StateAttribute::ON);
} }
} }
@ -667,10 +658,10 @@ namespace SceneUtil
}; };
UBOManager::UBOManager(int lightCount) UBOManager::UBOManager(int lightCount)
: mDummyProgram(new osg::Program) : mDummyProgram(new osg::Program)
, mInitLayout(false) , mInitLayout(false)
, mDirty({ true, true }) , mDirty({ true, true })
, mTemplate(new LightBuffer(lightCount)) , mTemplate(new LightBuffer(lightCount))
{ {
static const std::string dummyVertSource = generateDummyShader(lightCount); static const std::string dummyVertSource = generateDummyShader(lightCount);
@ -768,9 +759,9 @@ namespace SceneUtil
ext->glGetActiveUniformsiv(handle, index.size(), index.data(), GL_UNIFORM_ARRAY_STRIDE, &stride); ext->glGetActiveUniformsiv(handle, index.size(), index.data(), GL_UNIFORM_ARRAY_STRIDE, &stride);
std::array<const char*, 3> names = { std::array<const char*, 3> names = {
"LightBuffer[0].packedColors", "LightBuffer[0].packedColors",
"LightBuffer[0].position", "LightBuffer[0].position",
"LightBuffer[0].attenuation", "LightBuffer[0].attenuation",
}; };
std::vector<unsigned int> indices(names.size()); std::vector<unsigned int> indices(names.size());
std::vector<int> offsets(names.size()); std::vector<int> offsets(names.size());
@ -801,12 +792,12 @@ namespace SceneUtil
} }
LightManager::LightManager(bool ffp) LightManager::LightManager(bool ffp)
: mStartLight(0) : mStartLight(0)
, mLightingMask(~0u) , mLightingMask(~0u)
, mSun(nullptr) , mSun(nullptr)
, mPointLightRadiusMultiplier(1.f) , mPointLightRadiusMultiplier(1.f)
, mPointLightFadeEnd(0.f) , mPointLightFadeEnd(0.f)
, mPointLightFadeStart(0.f) , mPointLightFadeStart(0.f)
{ {
osg::GLExtensions* exts = osg::GLExtensions::Get(0, false); osg::GLExtensions* exts = osg::GLExtensions::Get(0, false);
bool supportsUBO = exts && exts->isUniformBufferObjectSupported; bool supportsUBO = exts && exts->isUniformBufferObjectSupported;
@ -854,16 +845,16 @@ namespace SceneUtil
} }
LightManager::LightManager(const LightManager &copy, const osg::CopyOp &copyop) LightManager::LightManager(const LightManager &copy, const osg::CopyOp &copyop)
: osg::Group(copy, copyop) : osg::Group(copy, copyop)
, mStartLight(copy.mStartLight) , mStartLight(copy.mStartLight)
, mLightingMask(copy.mLightingMask) , mLightingMask(copy.mLightingMask)
, mSun(copy.mSun) , mSun(copy.mSun)
, mLightingMethod(copy.mLightingMethod) , mLightingMethod(copy.mLightingMethod)
, mPointLightRadiusMultiplier(copy.mPointLightRadiusMultiplier) , mPointLightRadiusMultiplier(copy.mPointLightRadiusMultiplier)
, mPointLightFadeEnd(copy.mPointLightFadeEnd) , mPointLightFadeEnd(copy.mPointLightFadeEnd)
, mPointLightFadeStart(copy.mPointLightFadeStart) , mPointLightFadeStart(copy.mPointLightFadeStart)
, mMaxLights(copy.mMaxLights) , mMaxLights(copy.mMaxLights)
, mPPLightBuffer(copy.mPPLightBuffer) , mPPLightBuffer(copy.mPPLightBuffer)
{ {
} }
@ -980,15 +971,15 @@ namespace SceneUtil
mLightingMethod = method; mLightingMethod = method;
switch (method) switch (method)
{ {
case LightingMethod::FFP: case LightingMethod::FFP:
mStateSetGenerator = std::make_unique<StateSetGeneratorFFP>(); mStateSetGenerator = std::make_unique<StateSetGeneratorFFP>();
break; break;
case LightingMethod::SingleUBO: case LightingMethod::SingleUBO:
mStateSetGenerator = std::make_unique<StateSetGeneratorSingleUBO>(); mStateSetGenerator = std::make_unique<StateSetGeneratorSingleUBO>();
break; break;
case LightingMethod::PerObjectUniform: case LightingMethod::PerObjectUniform:
mStateSetGenerator = std::make_unique<StateSetGeneratorPerObjectUniform>(); mStateSetGenerator = std::make_unique<StateSetGeneratorPerObjectUniform>();
break; break;
} }
mStateSetGenerator->mLightManager = this; mStateSetGenerator->mLightManager = this;
} }
@ -1219,19 +1210,19 @@ namespace SceneUtil
} }
LightSource::LightSource() LightSource::LightSource()
: mRadius(0.f) : mRadius(0.f)
, mActorFade(1.f) , mActorFade(1.f)
, mLastAppliedFrame(0) , mLastAppliedFrame(0)
{ {
setUpdateCallback(new CollectLightCallback); setUpdateCallback(new CollectLightCallback);
mId = sLightId++; mId = sLightId++;
} }
LightSource::LightSource(const LightSource &copy, const osg::CopyOp &copyop) LightSource::LightSource(const LightSource &copy, const osg::CopyOp &copyop)
: osg::Node(copy, copyop) : osg::Node(copy, copyop)
, mRadius(copy.mRadius) , mRadius(copy.mRadius)
, mActorFade(copy.mActorFade) , mActorFade(copy.mActorFade)
, mLastAppliedFrame(copy.mLastAppliedFrame) , mLastAppliedFrame(copy.mLastAppliedFrame)
{ {
mId = sLightId++; mId = sLightId++;

View file

@ -1,6 +1,5 @@
#include "sdlcursormanager.hpp" #include "sdlcursormanager.hpp"
#include <cassert>
#include <stdexcept> #include <stdexcept>
#include <cstdlib> #include <cstdlib>
@ -13,14 +12,13 @@
#include <osg/Geometry> #include <osg/Geometry>
#include <osg/Texture2D> #include <osg/Texture2D>
#include <osg/TexMat> #include <osg/TexMat>
#include <osg/Version>
#include <osgViewer/GraphicsWindow> #include <osgViewer/GraphicsWindow>
#include <components/debug/debuglog.hpp> #include <components/debug/debuglog.hpp>
#include "imagetosurface.hpp" #include "imagetosurface.hpp"
#if defined(OSG_LIBRARY_STATIC) && (!defined(ANDROID) || OSG_VERSION_GREATER_THAN(3, 6, 5)) #if defined(OSG_LIBRARY_STATIC) && !defined(ANDROID)
// Sets the default windowing system interface according to the OS. // Sets the default windowing system interface according to the OS.
// Necessary for OpenSceneGraph to do some things, like decompression. // Necessary for OpenSceneGraph to do some things, like decompression.
USE_GRAPHICSWINDOW() USE_GRAPHICSWINDOW()
@ -28,12 +26,7 @@ USE_GRAPHICSWINDOW()
namespace CursorDecompression namespace CursorDecompression
{ {
// macOS builds use the OSG fork that includes DXTC commit
#if OSG_VERSION_GREATER_OR_EQUAL(3, 5, 8) || defined(__APPLE__)
static const bool DXTCSupported = true; static const bool DXTCSupported = true;
#else
static const bool DXTCSupported = false;
#endif
class MyGraphicsContext { class MyGraphicsContext {
public: public: