Skip to content

Commit

Permalink
make RNR only create ShaderCache when ShaderGenerator initializes
Browse files Browse the repository at this point in the history
  • Loading branch information
floralrainfall committed Jul 20, 2023
1 parent 65ef33c commit 72853fe
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
6 changes: 6 additions & 0 deletions Projects/Client/Common/Source/OgreWidget.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include <OgreWidget.hpp>
#include <QApplication>
#include <filesystem>

#include <OGRE/Bites/OgreSGTechniqueResolverListener.h>
#include <OGRE/OgreDefaultDebugDrawer.h>
Expand Down Expand Up @@ -71,6 +72,11 @@ namespace RNR
if(Ogre::RTShader::ShaderGenerator::initialize())
{
ogreShaderGen = Ogre::RTShader::ShaderGenerator::getSingletonPtr();

if (!std::filesystem::is_directory("ShaderCache") || !std::filesystem::exists("ShaderCache")) {
std::filesystem::create_directory("ShaderCache");
}

ogreShaderGen->setShaderCachePath("ShaderCache/");
ogreShaderGen->addSceneManager(ogreSceneManager);

Expand Down
4 changes: 0 additions & 4 deletions Projects/Client/Player/Source/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@

int main(int argc, char** argv)
{
if (!std::filesystem::is_directory("ShaderCache") || !std::filesystem::exists("ShaderCache")) {
std::filesystem::create_directory("ShaderCache");
}

QApplication app(argc, argv);
MainWindow window = MainWindow();

Expand Down
4 changes: 0 additions & 4 deletions Projects/Client/Studio/Source/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@

int main(int argc, char** argv)
{
if (!std::filesystem::is_directory("ShaderCache") || !std::filesystem::exists("ShaderCache")) {
std::filesystem::create_directory("ShaderCache");
}

QSurfaceFormat format;
format.setSwapBehavior(QSurfaceFormat::DoubleBuffer);

Expand Down

0 comments on commit 72853fe

Please sign in to comment.