diff --git a/CMakeLists.txt b/CMakeLists.txt index a588695..6b71101 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,9 +6,9 @@ set(CMAKE_MODULE_PATH "${opendf_SOURCE_DIR}/cmake" "${CMAKE_MODULE_PATH}") include(CheckCXXCompilerFlag) -check_cxx_compiler_flag(-std=c++11 HAVE_STD_CXX11) -if(HAVE_STD_CXX11) - set(CMAKE_CXX_FLAGS "-std=c++11 ${CMAKE_CXX_FLAGS}") +check_cxx_compiler_flag(-std=c++17 HAVE_STD_CXX17) +if(HAVE_STD_CXX17) + set(CMAKE_CXX_FLAGS "-std=c++17 ${CMAKE_CXX_FLAGS}") endif() if(MSVC) diff --git a/src/bsatool/bsatool.cpp b/src/bsatool/bsatool.cpp index 3acf695..9700089 100644 --- a/src/bsatool/bsatool.cpp +++ b/src/bsatool/bsatool.cpp @@ -8,6 +8,7 @@ #include #include #include +#include #include "components/archives/bsaarchive.hpp" diff --git a/src/components/archives/bsaarchive.cpp b/src/components/archives/bsaarchive.cpp index c6334c9..42e1e4e 100644 --- a/src/components/archives/bsaarchive.cpp +++ b/src/components/archives/bsaarchive.cpp @@ -3,6 +3,7 @@ #include #include +#include namespace Archives diff --git a/src/components/dfosg/meshloader.cpp b/src/components/dfosg/meshloader.cpp index e7eea58..78ed9b4 100644 --- a/src/components/dfosg/meshloader.cpp +++ b/src/components/dfosg/meshloader.cpp @@ -2,6 +2,7 @@ #include "meshloader.hpp" #include +#include #include #include diff --git a/src/components/dfosg/meshloader.hpp b/src/components/dfosg/meshloader.hpp index e8955a8..990e2be 100644 --- a/src/components/dfosg/meshloader.hpp +++ b/src/components/dfosg/meshloader.hpp @@ -4,6 +4,8 @@ #include #include #include +#include +#include namespace osg diff --git a/src/components/dfosg/texloader.cpp b/src/components/dfosg/texloader.cpp index 56eb90c..f7265ec 100644 --- a/src/components/dfosg/texloader.cpp +++ b/src/components/dfosg/texloader.cpp @@ -4,6 +4,7 @@ #include #include #include +#include #include diff --git a/src/components/mygui_osg/datamanager.cpp b/src/components/mygui_osg/datamanager.cpp index a32bcd7..2321fc1 100644 --- a/src/components/mygui_osg/datamanager.cpp +++ b/src/components/mygui_osg/datamanager.cpp @@ -56,7 +56,7 @@ class DataStream : public MyGUI::IDataStream { namespace MyGUI_OSG { -MyGUI::IDataStream *DataManager::getData(const std::string &_name) +MyGUI::IDataStream *DataManager::getData(const std::string &_name) const { VFS::IStreamPtr stream = VFS::Manager::get().open(_name.c_str()); if(!stream) return nullptr; @@ -68,12 +68,12 @@ void DataManager::freeData(MyGUI::IDataStream *_data) delete _data; } -bool DataManager::isDataExist(const std::string &_name) +bool DataManager::isDataExist(const std::string &_name) const { return VFS::Manager::get().exists(_name.c_str()); } -const MyGUI::VectorString &DataManager::getDataListNames(const std::string &_pattern) +const MyGUI::VectorString &DataManager::getDataListNames(const std::string &_pattern) const { static MyGUI::VectorString namelist; @@ -84,7 +84,7 @@ const MyGUI::VectorString &DataManager::getDataListNames(const std::string &_pat return namelist; } -const std::string &DataManager::getDataPath(const std::string &_name) +const std::string &DataManager::getDataPath(const std::string &_name) const { static std::string path; diff --git a/src/components/mygui_osg/datamanager.h b/src/components/mygui_osg/datamanager.h index bd39965..39d91c5 100644 --- a/src/components/mygui_osg/datamanager.h +++ b/src/components/mygui_osg/datamanager.h @@ -11,32 +11,35 @@ namespace MyGUI_OSG class DataManager : public MyGUI::DataManager { public: + DataManager() {}; + virtual ~DataManager() {}; + /** Get data stream from specified resource name. @param _name Resource name (usually file name). */ - virtual MyGUI::IDataStream* getData(const std::string &_name) final; + virtual MyGUI::IDataStream* getData(const std::string& _name) const; /** Free data stream. @param _data Data stream. */ - virtual void freeData(MyGUI::IDataStream *_data) final; + virtual void freeData(MyGUI::IDataStream* _data); /** Is data with specified name exist. @param _name Resource name. */ - virtual bool isDataExist(const std::string &_name) final; + virtual bool isDataExist(const std::string& _name) const; /** Get all data names with names that matches pattern. @param _pattern Pattern to match (for example "*.layout"). */ - virtual const MyGUI::VectorString &getDataListNames(const std::string &_pattern) final; + virtual const MyGUI::VectorString& getDataListNames(const std::string& _pattern) const; /** Get full path to data. @param _name Resource name. @return Return full path to specified data. For example getDataPath("My.layout") might return "C:\path\to\project\data\My.layout" */ - virtual const std::string &getDataPath(const std::string &_name) final; + virtual const std::string& getDataPath(const std::string& _name) const; }; } // namespace MyGUI_OSG diff --git a/src/components/mygui_osg/diagnostic.h b/src/components/mygui_osg/diagnostic.h index 8f5984e..d225c18 100644 --- a/src/components/mygui_osg/diagnostic.h +++ b/src/components/mygui_osg/diagnostic.h @@ -15,7 +15,6 @@ #define MYGUI_PLATFORM_EXCEPT(dest) do { \ MYGUI_PLATFORM_LOG(Critical, dest); \ - MYGUI_DBG_BREAK;\ std::ostringstream stream; \ stream << dest << "\n"; \ MYGUI_BASE_EXCEPT(stream.str().c_str(), "MyGUI"); \ @@ -25,7 +24,6 @@ if ( ! (exp) ) \ { \ MYGUI_PLATFORM_LOG(Critical, dest); \ - MYGUI_DBG_BREAK;\ std::ostringstream stream; \ stream << dest << "\n"; \ MYGUI_BASE_EXCEPT(stream.str().c_str(), "MyGUI"); \ diff --git a/src/components/mygui_osg/rendermanager.h b/src/components/mygui_osg/rendermanager.h index 8100085..53e6551 100644 --- a/src/components/mygui_osg/rendermanager.h +++ b/src/components/mygui_osg/rendermanager.h @@ -57,7 +57,7 @@ class RenderManager : public MyGUI::RenderManager, public MyGUI::IRenderTarget virtual const MyGUI::IntSize& getViewSize() const { return mViewSize; } /** @see RenderManager::getVertexFormat */ - virtual MyGUI::VertexColourType getVertexFormat() { return mVertexFormat; } + virtual MyGUI::VertexColourType getVertexFormat() const { return mVertexFormat; } /** @see RenderManager::isFormatSupported */ virtual bool isFormatSupported(MyGUI::PixelFormat format, MyGUI::TextureUsage usage); @@ -82,11 +82,18 @@ class RenderManager : public MyGUI::RenderManager, public MyGUI::IRenderTarget /** @see IRenderTarget::doRender */ virtual void doRender(MyGUI::IVertexBuffer *buffer, MyGUI::ITexture *texture, size_t count); /** @see IRenderTarget::getInfo */ - virtual const MyGUI::RenderTargetInfo& getInfo() { return mInfo; } + virtual const MyGUI::RenderTargetInfo& getInfo() const { return mInfo; } /*internal:*/ void drawFrame(osg::RenderInfo &renderInfo); - void setViewSize(int width, int height); + virtual void setViewSize(int width, int height); + + + // Fake + virtual void registerShader( + const std::string& _shaderName, + const std::string& _vertexProgramFile, + const std::string& _fragmentProgramFile) {}; }; } // namespace MyGUI_OSG diff --git a/src/components/mygui_osg/texture.cpp b/src/components/mygui_osg/texture.cpp index 6771524..2b624f7 100644 --- a/src/components/mygui_osg/texture.cpp +++ b/src/components/mygui_osg/texture.cpp @@ -133,7 +133,7 @@ void Texture::saveToFile(const std::string &fname) } -int Texture::getWidth() +int Texture::getWidth() const { if(!mTexture.valid()) return 0; @@ -142,7 +142,7 @@ int Texture::getWidth() return mTexture->getTextureWidth(); } -int Texture::getHeight() +int Texture::getHeight() const { if(!mTexture.valid()) return 0; @@ -182,7 +182,7 @@ void Texture::unlock() mLockedImage = nullptr; } -bool Texture::isLocked() +bool Texture::isLocked() const { return mLockedImage.valid(); } diff --git a/src/components/mygui_osg/texture.h b/src/components/mygui_osg/texture.h index 8cbc4d4..32f25d3 100644 --- a/src/components/mygui_osg/texture.h +++ b/src/components/mygui_osg/texture.h @@ -1,6 +1,7 @@ #ifndef COMPONENTS_MYGUI_OSG_TEXTURE_H #define COMPONENTS_MYGUI_OSG_TEXTURE_H +#include #include #include @@ -37,19 +38,22 @@ class Texture : public MyGUI::ITexture { virtual void* lock(MyGUI::TextureUsage access); virtual void unlock(); - virtual bool isLocked(); + virtual bool isLocked() const; - virtual int getWidth(); - virtual int getHeight(); + virtual int getWidth() const; + virtual int getHeight() const; - virtual MyGUI::PixelFormat getFormat() { return mFormat; } - virtual MyGUI::TextureUsage getUsage() { return mUsage; } - virtual size_t getNumElemBytes() { return mNumElemBytes; } + virtual MyGUI::PixelFormat getFormat() const { return mFormat; } + virtual MyGUI::TextureUsage getUsage() const { return mUsage; } + virtual size_t getNumElemBytes() const { return mNumElemBytes; } virtual MyGUI::IRenderTarget *getRenderTarget(); /*internal:*/ osg::Texture2D *getTexture() const { return mTexture.get(); } + + //fake + virtual void setShader(const std::string& _shaderName) {}; }; } // namespace MyGUI_OSG diff --git a/src/components/mygui_osg/vertexbuffer.cpp b/src/components/mygui_osg/vertexbuffer.cpp index 233c787..d1fb38d 100644 --- a/src/components/mygui_osg/vertexbuffer.cpp +++ b/src/components/mygui_osg/vertexbuffer.cpp @@ -33,7 +33,7 @@ void VertexBuffer::setVertexCount(size_t count) create(); } -size_t VertexBuffer::getVertexCount() +size_t VertexBuffer::getVertexCount() const { return mNeedVertexCount; } diff --git a/src/components/mygui_osg/vertexbuffer.h b/src/components/mygui_osg/vertexbuffer.h index f7d8c60..38e35a1 100644 --- a/src/components/mygui_osg/vertexbuffer.h +++ b/src/components/mygui_osg/vertexbuffer.h @@ -2,6 +2,7 @@ #define COMPONENTS_MYGUI_OSG_VERTEXBUFFER_H #include +#include #include @@ -27,7 +28,7 @@ class VertexBuffer : public MyGUI::IVertexBuffer { virtual ~VertexBuffer(); virtual void setVertexCount(size_t count); - virtual size_t getVertexCount(); + virtual size_t getVertexCount() const; virtual MyGUI::Vertex *lock(); virtual void unlock(); diff --git a/src/components/resource/meshmanager.hpp b/src/components/resource/meshmanager.hpp index ed8e338..30daf60 100644 --- a/src/components/resource/meshmanager.hpp +++ b/src/components/resource/meshmanager.hpp @@ -2,6 +2,8 @@ #define COMPONENTS_RESOURCE_MESHMANAGER_HPP #include +#include + #include diff --git a/src/components/resource/texturemanager.hpp b/src/components/resource/texturemanager.hpp index b029084..b4e4427 100644 --- a/src/components/resource/texturemanager.hpp +++ b/src/components/resource/texturemanager.hpp @@ -5,6 +5,7 @@ #include #include #include +#include #include #include diff --git a/src/components/sdlutil/graphicswindow.cpp b/src/components/sdlutil/graphicswindow.cpp index 75eac9d..28092f4 100644 --- a/src/components/sdlutil/graphicswindow.cpp +++ b/src/components/sdlutil/graphicswindow.cpp @@ -307,9 +307,6 @@ class SDL2WindowingSystemInterface : public osg::GraphicsContext::WindowingSyste }; // declare C entry point for static compilation. -extern "C" void graphicswindow_SDL2(void) -{ - osg::GraphicsContext::setWindowingSystemInterface(new SDL2WindowingSystemInterface); -} +REGISTER_WINDOWINGSYSTEMINTERFACE(SDL2, SDL2WindowingSystemInterface); }