mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-31 15:32:45 +00:00
move water normal to vfs
This commit is contained in:
parent
22c62a8c38
commit
897ee702d1
@ -768,7 +768,7 @@ void OMW::Engine::prepareEngine()
|
||||
// Create the world
|
||||
mWorld = std::make_unique<MWWorld::World>(mViewer, rootNode, mResourceSystem.get(), mWorkQueue.get(), *mUnrefQueue,
|
||||
mFileCollections, mContentFiles, mGroundcoverFiles, mEncoder.get(), mActivationDistanceOverride, mCellName,
|
||||
mStartupScript, mResDir, mCfgMgr.getUserDataPath());
|
||||
mStartupScript, mCfgMgr.getUserDataPath());
|
||||
mWorld->setupPlayer();
|
||||
mWorld->setRandomSeed(mRandomSeed);
|
||||
mEnvironment.setWorld(*mWorld);
|
||||
|
@ -337,8 +337,8 @@ namespace MWRender
|
||||
|
||||
RenderingManager::RenderingManager(osgViewer::Viewer* viewer, osg::ref_ptr<osg::Group> rootNode,
|
||||
Resource::ResourceSystem* resourceSystem, SceneUtil::WorkQueue* workQueue,
|
||||
const std::filesystem::path& resourcePath, DetourNavigator::Navigator& navigator,
|
||||
const MWWorld::GroundcoverStore& groundcoverStore, SceneUtil::UnrefQueue& unrefQueue)
|
||||
DetourNavigator::Navigator& navigator, const MWWorld::GroundcoverStore& groundcoverStore,
|
||||
SceneUtil::UnrefQueue& unrefQueue)
|
||||
: mSkyBlending(Settings::Manager::getBool("sky blending", "Fog"))
|
||||
, mViewer(viewer)
|
||||
, mRootNode(rootNode)
|
||||
@ -551,8 +551,8 @@ namespace MWRender
|
||||
resourceSystem->getSceneManager()->setSupportsNormalsRT(mPostProcessor->getSupportsNormalsRT());
|
||||
|
||||
// water goes after terrain for correct waterculling order
|
||||
mWater = std::make_unique<Water>(sceneRoot->getParent(0), sceneRoot, mResourceSystem,
|
||||
mViewer->getIncrementalCompileOperation(), resourcePath);
|
||||
mWater = std::make_unique<Water>(
|
||||
sceneRoot->getParent(0), sceneRoot, mResourceSystem, mViewer->getIncrementalCompileOperation());
|
||||
|
||||
mCamera = std::make_unique<Camera>(mViewer->getCamera());
|
||||
|
||||
|
@ -108,8 +108,8 @@ namespace MWRender
|
||||
public:
|
||||
RenderingManager(osgViewer::Viewer* viewer, osg::ref_ptr<osg::Group> rootNode,
|
||||
Resource::ResourceSystem* resourceSystem, SceneUtil::WorkQueue* workQueue,
|
||||
const std::filesystem::path& resourcePath, DetourNavigator::Navigator& navigator,
|
||||
const MWWorld::GroundcoverStore& groundcoverStore, SceneUtil::UnrefQueue& unrefQueue);
|
||||
DetourNavigator::Navigator& navigator, const MWWorld::GroundcoverStore& groundcoverStore,
|
||||
SceneUtil::UnrefQueue& unrefQueue);
|
||||
~RenderingManager();
|
||||
|
||||
osgUtil::IncrementalCompileOperation* getIncrementalCompileOperation();
|
||||
|
@ -1,7 +1,5 @@
|
||||
#include "water.hpp"
|
||||
|
||||
#include <iomanip>
|
||||
|
||||
#include <osg/ClipNode>
|
||||
#include <osg/Depth>
|
||||
#include <osg/Fog>
|
||||
@ -12,15 +10,9 @@
|
||||
#include <osg/PositionAttitudeTransform>
|
||||
#include <osg/ViewportIndexed>
|
||||
|
||||
#include <osgDB/ReadFile>
|
||||
|
||||
#include <fstream>
|
||||
|
||||
#include <osgUtil/CullVisitor>
|
||||
#include <osgUtil/IncrementalCompileOperation>
|
||||
|
||||
#include <components/debug/debuglog.hpp>
|
||||
|
||||
#include <components/resource/imagemanager.hpp>
|
||||
#include <components/resource/resourcesystem.hpp>
|
||||
#include <components/resource/scenemanager.hpp>
|
||||
@ -235,26 +227,6 @@ namespace MWRender
|
||||
float mRainIntensity;
|
||||
};
|
||||
|
||||
osg::ref_ptr<osg::Image> readPngImage(const std::filesystem::path& file)
|
||||
{
|
||||
std::ifstream inStream;
|
||||
inStream.open(file, std::ios_base::in | std::ios_base::binary);
|
||||
if (inStream.fail())
|
||||
Log(Debug::Error) << "Error: Failed to open " << file;
|
||||
osgDB::ReaderWriter* reader = osgDB::Registry::instance()->getReaderWriterForExtension("png");
|
||||
if (!reader)
|
||||
{
|
||||
Log(Debug::Error) << "Error: Failed to read " << file << ", no png readerwriter found";
|
||||
return osg::ref_ptr<osg::Image>();
|
||||
}
|
||||
osgDB::ReaderWriter::ReadResult result = reader->readImage(inStream);
|
||||
if (!result.success())
|
||||
Log(Debug::Error) << "Error: Failed to read " << file << ": " << result.message() << " code "
|
||||
<< result.status();
|
||||
|
||||
return result.getImage();
|
||||
}
|
||||
|
||||
class Refraction : public SceneUtil::RTTNode
|
||||
{
|
||||
public:
|
||||
@ -453,12 +425,11 @@ namespace MWRender
|
||||
};
|
||||
|
||||
Water::Water(osg::Group* parent, osg::Group* sceneRoot, Resource::ResourceSystem* resourceSystem,
|
||||
osgUtil::IncrementalCompileOperation* ico, const std::filesystem::path& resourcePath)
|
||||
osgUtil::IncrementalCompileOperation* ico)
|
||||
: mRainIntensityUpdater(nullptr)
|
||||
, mParent(parent)
|
||||
, mSceneRoot(sceneRoot)
|
||||
, mResourceSystem(resourceSystem)
|
||||
, mResourcePath(resourcePath)
|
||||
, mEnabled(true)
|
||||
, mToggled(true)
|
||||
, mTop(0)
|
||||
@ -709,8 +680,7 @@ namespace MWRender
|
||||
osg::ref_ptr<osg::Program> program = shaderMgr.getProgram(vertexShader, fragmentShader);
|
||||
|
||||
osg::ref_ptr<osg::Texture2D> normalMap(
|
||||
new osg::Texture2D(readPngImage(mResourcePath / "shaders" / "water_nm.png")));
|
||||
|
||||
new osg::Texture2D(mResourceSystem->getImageManager()->getImage("textures/omw/water_nm.png")));
|
||||
if (normalMap->getImage())
|
||||
normalMap->getImage()->flipVertical();
|
||||
normalMap->setWrap(osg::Texture::WRAP_S, osg::Texture::REPEAT);
|
||||
|
@ -65,8 +65,6 @@ namespace MWRender
|
||||
osg::ref_ptr<Refraction> mRefraction;
|
||||
osg::ref_ptr<Reflection> mReflection;
|
||||
|
||||
const std::filesystem::path mResourcePath;
|
||||
|
||||
bool mEnabled;
|
||||
bool mToggled;
|
||||
float mTop;
|
||||
@ -89,7 +87,7 @@ namespace MWRender
|
||||
|
||||
public:
|
||||
Water(osg::Group* parent, osg::Group* sceneRoot, Resource::ResourceSystem* resourceSystem,
|
||||
osgUtil::IncrementalCompileOperation* ico, const std::filesystem::path& resourcePath);
|
||||
osgUtil::IncrementalCompileOperation* ico);
|
||||
~Water();
|
||||
|
||||
void setCullCallback(osg::Callback* callback);
|
||||
|
@ -157,8 +157,7 @@ namespace MWWorld
|
||||
SceneUtil::WorkQueue* workQueue, SceneUtil::UnrefQueue& unrefQueue, const Files::Collections& fileCollections,
|
||||
const std::vector<std::string>& contentFiles, const std::vector<std::string>& groundcoverFiles,
|
||||
ToUTF8::Utf8Encoder* encoder, int activationDistanceOverride, const std::string& startCell,
|
||||
const std::string& startupScript, const std::filesystem::path& resourcePath,
|
||||
const std::filesystem::path& userDataPath)
|
||||
const std::string& startupScript, const std::filesystem::path& userDataPath)
|
||||
: mResourceSystem(resourceSystem)
|
||||
, mLocalScripts(mStore)
|
||||
, mWorldModel(mStore, mReaders)
|
||||
@ -215,7 +214,7 @@ namespace MWWorld
|
||||
}
|
||||
|
||||
mRendering = std::make_unique<MWRender::RenderingManager>(
|
||||
viewer, rootNode, resourceSystem, workQueue, resourcePath, *mNavigator, mGroundcoverStore, unrefQueue);
|
||||
viewer, rootNode, resourceSystem, workQueue, *mNavigator, mGroundcoverStore, unrefQueue);
|
||||
mProjectileManager = std::make_unique<ProjectileManager>(
|
||||
mRendering->getLightRoot()->asGroup(), resourceSystem, mRendering.get(), mPhysics.get());
|
||||
mRendering->preloadCommonAssets();
|
||||
|
@ -201,7 +201,7 @@ namespace MWWorld
|
||||
const Files::Collections& fileCollections, const std::vector<std::string>& contentFiles,
|
||||
const std::vector<std::string>& groundcoverFiles, ToUTF8::Utf8Encoder* encoder,
|
||||
int activationDistanceOverride, const std::string& startCell, const std::string& startupScript,
|
||||
const std::filesystem::path& resourcePath, const std::filesystem::path& userDataPath);
|
||||
const std::filesystem::path& userDataPath);
|
||||
|
||||
virtual ~World();
|
||||
|
||||
|
@ -9,6 +9,7 @@ set(BUILTIN_DATA_FILES
|
||||
textures/omw_menu_scroll_right.dds
|
||||
textures/omw_menu_scroll_center_h.dds
|
||||
textures/omw_menu_scroll_center_v.dds
|
||||
textures/omw/water_nm.png
|
||||
|
||||
fonts/DejaVuFontLicense.txt
|
||||
fonts/DejaVuLGCSansMono.ttf
|
||||
|
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 24 KiB |
@ -11,7 +11,6 @@ set(SHADER_FILES
|
||||
groundcover_fragment.glsl
|
||||
water_vertex.glsl
|
||||
water_fragment.glsl
|
||||
water_nm.png
|
||||
alpha.glsl
|
||||
depth.glsl
|
||||
objects_vertex.glsl
|
||||
|
Loading…
x
Reference in New Issue
Block a user