1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-20 05:53:50 +00:00

Merge branch 'sky-dehardcode' into 'master'

De-hardcode references to mesh files used by the sky.

See merge request OpenMW/openmw!704
This commit is contained in:
psi29a 2021-04-08 16:32:39 +00:00
commit a16387df61
2 changed files with 43 additions and 16 deletions

View file

@ -45,6 +45,9 @@
#include <components/sceneutil/visitor.hpp> #include <components/sceneutil/visitor.hpp>
#include <components/sceneutil/shadow.hpp> #include <components/sceneutil/shadow.hpp>
#include <components/settings/settings.hpp>
#include <components/misc/stringops.hpp>
#include <components/nifosg/particle.hpp> #include <components/nifosg/particle.hpp>
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
@ -1164,7 +1167,7 @@ void SkyManager::create()
{ {
assert(!mCreated); assert(!mCreated);
mAtmosphereDay = mSceneManager->getInstance("meshes/sky_atmosphere.nif", mEarlyRenderBinRoot); mAtmosphereDay = mSceneManager->getInstance(Settings::Manager::getString("skyatmosphere", "Models"), mEarlyRenderBinRoot);
ModVertexAlphaVisitor modAtmosphere(0); ModVertexAlphaVisitor modAtmosphere(0);
mAtmosphereDay->accept(modAtmosphere); mAtmosphereDay->accept(modAtmosphere);
@ -1176,10 +1179,10 @@ void SkyManager::create()
mEarlyRenderBinRoot->addChild(mAtmosphereNightNode); mEarlyRenderBinRoot->addChild(mAtmosphereNightNode);
osg::ref_ptr<osg::Node> atmosphereNight; osg::ref_ptr<osg::Node> atmosphereNight;
if (mSceneManager->getVFS()->exists("meshes/sky_night_02.nif")) if (mSceneManager->getVFS()->exists(Settings::Manager::getString("skynight02", "Models")))
atmosphereNight = mSceneManager->getInstance("meshes/sky_night_02.nif", mAtmosphereNightNode); atmosphereNight = mSceneManager->getInstance(Settings::Manager::getString("skynight02", "Models"), mAtmosphereNightNode);
else else
atmosphereNight = mSceneManager->getInstance("meshes/sky_night_01.nif", mAtmosphereNightNode); atmosphereNight = mSceneManager->getInstance(Settings::Manager::getString("skynight01", "Models"), mAtmosphereNightNode);
atmosphereNight->getOrCreateStateSet()->setAttributeAndModes(createAlphaTrackingUnlitMaterial(), osg::StateAttribute::ON|osg::StateAttribute::OVERRIDE); atmosphereNight->getOrCreateStateSet()->setAttributeAndModes(createAlphaTrackingUnlitMaterial(), osg::StateAttribute::ON|osg::StateAttribute::OVERRIDE);
ModVertexAlphaVisitor modStars(2); ModVertexAlphaVisitor modStars(2);
atmosphereNight->accept(modStars); atmosphereNight->accept(modStars);
@ -1193,14 +1196,14 @@ void SkyManager::create()
mCloudNode = new osg::PositionAttitudeTransform; mCloudNode = new osg::PositionAttitudeTransform;
mEarlyRenderBinRoot->addChild(mCloudNode); mEarlyRenderBinRoot->addChild(mCloudNode);
mCloudMesh = mSceneManager->getInstance("meshes/sky_clouds_01.nif", mCloudNode); mCloudMesh = mSceneManager->getInstance(Settings::Manager::getString("skyclouds", "Models"), mCloudNode);
ModVertexAlphaVisitor modClouds(1); ModVertexAlphaVisitor modClouds(1);
mCloudMesh->accept(modClouds); mCloudMesh->accept(modClouds);
mCloudUpdater = new CloudUpdater; mCloudUpdater = new CloudUpdater;
mCloudUpdater->setOpacity(1.f); mCloudUpdater->setOpacity(1.f);
mCloudMesh->addUpdateCallback(mCloudUpdater); mCloudMesh->addUpdateCallback(mCloudUpdater);
mCloudMesh2 = mSceneManager->getInstance("meshes/sky_clouds_01.nif", mCloudNode); mCloudMesh2 = mSceneManager->getInstance(Settings::Manager::getString("skyclouds", "Models"), mCloudNode);
mCloudMesh2->accept(modClouds); mCloudMesh2->accept(modClouds);
mCloudUpdater2 = new CloudUpdater; mCloudUpdater2 = new CloudUpdater;
mCloudUpdater2->setOpacity(0.f); mCloudUpdater2->setOpacity(0.f);
@ -1597,7 +1600,7 @@ void SkyManager::update(float duration)
if (mParticleNode) if (mParticleNode)
{ {
// Morrowind deliberately rotates the blizzard mesh, so so should we. // Morrowind deliberately rotates the blizzard mesh, so so should we.
if (mCurrentParticleEffect == "meshes\\blizzard.nif") if (mCurrentParticleEffect == Settings::Manager::getString("weatherblizzard", "Models"))
quat.makeRotate(osg::Vec3f(-1,0,0), mStormDirection); quat.makeRotate(osg::Vec3f(-1,0,0), mStormDirection);
mParticleNode->setAttitude(quat); mParticleNode->setAttitude(quat);
} }
@ -1897,16 +1900,16 @@ void SkyManager::setWaterHeight(float height)
void SkyManager::listAssetsToPreload(std::vector<std::string>& models, std::vector<std::string>& textures) void SkyManager::listAssetsToPreload(std::vector<std::string>& models, std::vector<std::string>& textures)
{ {
models.emplace_back("meshes/sky_atmosphere.nif"); models.emplace_back(Settings::Manager::getString("skyatmosphere", "Models"));
if (mSceneManager->getVFS()->exists("meshes/sky_night_02.nif")) if (mSceneManager->getVFS()->exists(Settings::Manager::getString("skynight02", "Models")))
models.emplace_back("meshes/sky_night_02.nif"); models.emplace_back(Settings::Manager::getString("skynight02", "Models"));
models.emplace_back("meshes/sky_night_01.nif"); models.emplace_back(Settings::Manager::getString("skynight01", "Models"));
models.emplace_back("meshes/sky_clouds_01.nif"); models.emplace_back(Settings::Manager::getString("skyclouds", "Models"));
models.emplace_back("meshes\\ashcloud.nif"); models.emplace_back(Settings::Manager::getString("weatherashcloud", "Models"));
models.emplace_back("meshes\\blightcloud.nif"); models.emplace_back(Settings::Manager::getString("weatherblightcloud", "Models"));
models.emplace_back("meshes\\snow.nif"); models.emplace_back(Settings::Manager::getString("weathersnow", "Models"));
models.emplace_back("meshes\\blizzard.nif"); models.emplace_back(Settings::Manager::getString("weatherblizzard", "Models"));
textures.emplace_back("textures/tx_mooncircle_full_s.dds"); textures.emplace_back("textures/tx_mooncircle_full_s.dds");
textures.emplace_back("textures/tx_mooncircle_full_m.dds"); textures.emplace_back("textures/tx_mooncircle_full_m.dds");

View file

@ -1005,6 +1005,30 @@ xbaseanimfemalekf = meshes/xbase_anim_female.kf
# File to load xargonianswimkna animations from # File to load xargonianswimkna animations from
xargonianswimknakf = meshes/xargonian_swimkna.kf xargonianswimknakf = meshes/xargonian_swimkna.kf
# Sky atmosphere mesh
skyatmosphere = meshes/sky_atmosphere.nif
# Sky clouds mesh
skyclouds = meshes/sky_clouds_01.nif
# Sky stars mesh 01
skynight01 = meshes/sky_night_01.nif
# Sky stars mesh 02
skynight02 = meshes/sky_night_02.nif
# Ash clouds weather effect
weatherashcloud = meshes/ashcloud.nif
# Blight clouds weather effect
weatherblightcloud = meshes/blightcloud.nif
# Snow falling weather effect
weathersnow = meshes/snow.nif
# Blizzard weather effect
weatherblizzard = meshes/blizzard.nif
[Groundcover] [Groundcover]
# enable separate groundcover handling # enable separate groundcover handling