diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml index a2bec0b6c49..019d4c5b908 100644 --- a/.github/workflows/ci-build.yml +++ b/.github/workflows/ci-build.yml @@ -78,7 +78,7 @@ jobs: env: CLOUDSMITH_API_KEY: ${{ secrets.CLOUDSMITH_API_KEY }} macos: - runs-on: macos-12 + runs-on: macos-13 steps: - name: Install Dependencies run: brew update && brew install sdl2 pugixml @@ -92,7 +92,7 @@ jobs: - name: Test run: build/bin/Debug/Test_Ogre.app/Contents/MacOS/Test_Ogre --gtest_filter=-UseCustomCapabilitiesTests* ios: - runs-on: macos-12 + runs-on: macos-13 steps: - uses: actions/checkout@v4 - name: Build diff --git a/.github/workflows/pip-build.yml b/.github/workflows/pip-build.yml index 38a8f089df7..1a28e2d4cc1 100644 --- a/.github/workflows/pip-build.yml +++ b/.github/workflows/pip-build.yml @@ -53,7 +53,7 @@ jobs: VULKAN_SDK: C:\VulkanSDK\1.3.275.0 SKBUILD_BUILD_OPTIONS: -j4 macos: - runs-on: macos-12 + runs-on: macos-13 strategy: matrix: pyver: ['3.10', '3.12'] diff --git a/CMake/Dependencies.cmake b/CMake/Dependencies.cmake index 21590f443e3..dd74419720e 100644 --- a/CMake/Dependencies.cmake +++ b/CMake/Dependencies.cmake @@ -128,16 +128,16 @@ if(OGRE_BUILD_DEPENDENCIES AND NOT EXISTS ${OGREDEPS_PATH}) if(MSVC OR MINGW OR SKBUILD) # other platforms dont need this message(STATUS "Building SDL2") file(DOWNLOAD - https://libsdl.org/release/SDL2-2.30.4.tar.gz - ${PROJECT_BINARY_DIR}/SDL2-2.30.4.tar.gz) + https://libsdl.org/release/SDL2-2.30.11.tar.gz + ${PROJECT_BINARY_DIR}/SDL2-2.30.11.tar.gz) execute_process(COMMAND ${CMAKE_COMMAND} - -E tar xf SDL2-2.30.4.tar.gz WORKING_DIRECTORY ${PROJECT_BINARY_DIR}) + -E tar xf SDL2-2.30.11.tar.gz WORKING_DIRECTORY ${PROJECT_BINARY_DIR}) execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${PROJECT_BINARY_DIR}/SDL2-build) execute_process(COMMAND ${BUILD_COMMAND_COMMON} -DSDL_STATIC=FALSE -DCMAKE_INSTALL_LIBDIR=lib - ${PROJECT_BINARY_DIR}/SDL2-2.30.4 + ${PROJECT_BINARY_DIR}/SDL2-2.30.11 WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/SDL2-build) execute_process(COMMAND ${CMAKE_COMMAND} --build ${PROJECT_BINARY_DIR}/SDL2-build ${BUILD_COMMAND_OPTS}) diff --git a/CMakeLists.txt b/CMakeLists.txt index c5d23d7ee8b..b0b9541c450 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -63,7 +63,7 @@ if (APPLE AND NOT ANDROID AND NOT EMSCRIPTEN AND NOT ANDROID_PLATFORM) add_definitions(-D__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES=0) endif () -project(OGRE VERSION 14.3.1) +project(OGRE VERSION 14.4.0) # extra version info set(OGRE_VERSION_SUFFIX "") @@ -182,10 +182,6 @@ if (MINGW) # the atomic primitives set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=i686") endif () - # disable this optimisation because it breaks release builds (reason unknown) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-tree-slp-vectorize") - # Ignore some really annoying warnings which also happen in dependencies - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-error=cast-qual -Wno-unused-local-typedefs") endif () include(GenerateExportHeader) @@ -372,7 +368,7 @@ cmake_dependent_option(OGRE_CONFIG_FILESYSTEM_UNICODE "paths expected to be in U cmake_dependent_option(OGRE_INSTALL_SAMPLES "Install Ogre demos." TRUE "OGRE_BUILD_SAMPLES" FALSE) option(OGRE_INSTALL_TOOLS "Install Ogre tools." TRUE) option(OGRE_INSTALL_DOCS "Install documentation." TRUE) -cmake_dependent_option(OGRE_INSTALL_PDB "Install debug pdb files" TRUE "MSVC" FALSE) +cmake_dependent_option(OGRE_INSTALL_PDB "Install debug pdb files" TRUE "MSVC;NOT OGRE_STATIC" FALSE) option(OGRE_PROFILING "Enable internal instrumentation." FALSE) set(OGRE_PROFILING_REMOTERY_PATH "" CACHE PATH "set this to Remotery/lib to use Remotery instead of the buildin profiler") cmake_dependent_option(OGRE_CONFIG_STATIC_LINK_CRT "Statically link the MS CRT dlls (msvcrt)" FALSE "MSVC" FALSE) diff --git a/Components/Bites/include/OgreBites.i b/Components/Bites/include/OgreBites.i index 05abd20f0f7..a52bb6facbf 100644 --- a/Components/Bites/include/OgreBites.i +++ b/Components/Bites/include/OgreBites.i @@ -22,6 +22,10 @@ %include stdint.i %import "Ogre.i" +#ifndef SWIGPYTHON +%import "OgreOverlay.i" +#endif + #define _OgreBitesExport %include "OgreSGTechniqueResolverListener.h" diff --git a/Components/Csharp/CMakeLists.txt b/Components/Csharp/CMakeLists.txt index 36d4e1e3442..6e3b32816c4 100644 --- a/Components/Csharp/CMakeLists.txt +++ b/Components/Csharp/CMakeLists.txt @@ -52,7 +52,15 @@ if(OGRE_BUILD_COMPONENT_TERRAIN) list(APPEND SWIG_COMPONENT_LIBRARIES "OgreTerrain") endif() +if(OGRE_BUILD_COMPONENT_BULLET) + include_directories("${BULLET_INCLUDE_DIRS}") + set_source_files_properties(../Bullet/include/OgreBullet.i PROPERTIES CPLUSPLUS ON) + list(APPEND SWIG_INPUT_MODULES ../Bullet/include/OgreBullet.i) + list(APPEND SWIG_COMPONENT_LIBRARIES "OgreBullet") +endif() + if(OGRE_BUILD_COMPONENT_OVERLAY) + include_directories("${PROJECT_SOURCE_DIR}/Components/Overlay/include") set_source_files_properties(../Overlay/include/OgreOverlay.i PROPERTIES CPLUSPLUS ON) list(APPEND SWIG_INPUT_MODULES ../Overlay/include/OgreOverlay.i) list(APPEND SWIG_COMPONENT_LIBRARIES "OgreOverlay") @@ -62,7 +70,7 @@ if(OGRE_BUILD_COMPONENT_OVERLAY_IMGUI) include_directories("${IMGUI_DIR}") list(APPEND CMAKE_SWIG_FLAGS -DHAVE_IMGUI -DIMGUI_DISABLE_OBSOLETE_FUNCTIONS) set_source_files_properties(../Overlay/include/ImGui.i PROPERTIES CPLUSPLUS ON) - list(APPEND SWIG_INPUT_MODULE ../Overlay/include/ImGui.i) + list(APPEND SWIG_INPUT_MODULES ../Overlay/include/ImGui.i) endif() if(OGRE_BUILD_COMPONENT_BITES) @@ -71,13 +79,6 @@ if(OGRE_BUILD_COMPONENT_BITES) list(APPEND SWIG_COMPONENT_LIBRARIES "OgreBites") endif() -if(OGRE_BUILD_COMPONENT_BULLET) - include_directories("${BULLET_INCLUDE_DIRS}") - set_source_files_properties(../Bullet/include/OgreBullet.i PROPERTIES CPLUSPLUS ON) - list(APPEND SWIG_INPUT_MODULES ../Bullet/include/OgreBullet.i) - list(APPEND SWIG_COMPONENT_LIBRARIES "OgreBullet") -endif() - swig_add_library(libOgre LANGUAGE csharp SOURCES ${SWIG_INPUT_MODULES}) SWIG_LINK_LIBRARIES(libOgre ${SWIG_COMPONENT_LIBRARIES}) diff --git a/Components/Java/CMakeLists.txt b/Components/Java/CMakeLists.txt index baa72dcddc1..be3363c24cd 100644 --- a/Components/Java/CMakeLists.txt +++ b/Components/Java/CMakeLists.txt @@ -63,7 +63,15 @@ if(OGRE_BUILD_COMPONENT_TERRAIN) list(APPEND SWIG_COMPONENT_LIBRARIES "OgreTerrain") endif() +if(OGRE_BUILD_COMPONENT_BULLET) + include_directories("${BULLET_INCLUDE_DIRS}") + set_source_files_properties(../Bullet/include/OgreBullet.i PROPERTIES CPLUSPLUS ON) + list(APPEND SWIG_INPUT_MODULES ../Bullet/include/OgreBullet.i) + list(APPEND SWIG_COMPONENT_LIBRARIES "OgreBullet") +endif() + if(OGRE_BUILD_COMPONENT_OVERLAY) + include_directories("${PROJECT_SOURCE_DIR}/Components/Overlay/include") set_source_files_properties(../Overlay/include/OgreOverlay.i PROPERTIES CPLUSPLUS ON) list(APPEND SWIG_INPUT_MODULES ../Overlay/include/OgreOverlay.i) list(APPEND SWIG_COMPONENT_LIBRARIES "OgreOverlay") @@ -73,7 +81,7 @@ if(OGRE_BUILD_COMPONENT_OVERLAY_IMGUI) include_directories("${IMGUI_DIR}") list(APPEND CMAKE_SWIG_FLAGS -DHAVE_IMGUI -DIMGUI_DISABLE_OBSOLETE_FUNCTIONS) set_source_files_properties(../Overlay/include/ImGui.i PROPERTIES CPLUSPLUS ON) - list(APPEND SWIG_INPUT_MODULE ../Overlay/include/ImGui.i) + list(APPEND SWIG_INPUT_MODULES ../Overlay/include/ImGui.i) endif() if(OGRE_BUILD_COMPONENT_BITES) @@ -87,13 +95,6 @@ if(OGRE_BUILD_COMPONENT_BITES) list(APPEND SWIG_COMPONENT_LIBRARIES "OgreBites") endif() -if(OGRE_BUILD_COMPONENT_BULLET) - include_directories("${BULLET_INCLUDE_DIRS}") - set_source_files_properties(../Bullet/include/OgreBullet.i PROPERTIES CPLUSPLUS ON) - list(APPEND SWIG_INPUT_MODULES ../Bullet/include/OgreBullet.i) - list(APPEND SWIG_COMPONENT_LIBRARIES "OgreBullet") -endif() - swig_add_library(OgreJNI LANGUAGE java SOURCES ${SWIG_INPUT_MODULES}) swig_link_libraries(OgreJNI ${SWIG_COMPONENT_LIBRARIES} ${JNI_LIBRARIES}) diff --git a/Components/Overlay/include/ImGui.i b/Components/Overlay/include/ImGui.i index 046e2a9fc71..33dcdd67e4d 100644 --- a/Components/Overlay/include/ImGui.i +++ b/Components/Overlay/include/ImGui.i @@ -20,10 +20,13 @@ %ignore ImGui::TreeNodeExV; %ignore ImGui::SetTooltipV; %ignore ImGui::SetItemTooltipV; -%ignore ImGuiTextBuffer::appendfv; %ignore ImGui::DebugLogV; %ignore ImGuiSelectionBasicStorage; +// not needed in high level languages +%ignore ImGuiTextBuffer; + +#ifdef SWIGPYTHON %typemap(in) ImTextureID { size_t argp; int res = SWIG_AsVal_size_t($input, &argp); @@ -46,10 +49,9 @@ } } -#ifdef SWIGPYTHON // match the signature of the by value variants %typemap(argout) float[4], float[3], float[2] { - $result = SWIG_Python_AppendOutput($result, SWIG_NewPointerObj($1, $descriptor(ImVec4*), 0)); + $result = SWIG_AppendOutput($result, SWIG_NewPointerObj($1, $descriptor(ImVec4*), 0)); } // for PlotHistogram, PlotLines @@ -73,18 +75,16 @@ %typecheck(SWIG_TYPECHECK_STRING) (const float* values, int values_count) { $1 = true; // actual check in the typemap } -#endif %typecheck(SWIG_TYPECHECK_STRING) float[4], float[3], float[2] { $1 = true; // actual check in the typemap } -#ifdef SWIGPYTHON %rename("__version__") "IMGUI_VERSION"; -#endif // strip duplicate namespace for ImGuiSomething_FlagName flags %rename("%(strip:[ImGui])s", regextarget=1) "^ImGui.+_.+"; +#endif %apply bool* INOUT { bool* p_open }; %apply bool* INOUT { bool* v }; diff --git a/Components/Overlay/include/OgreOverlay.i b/Components/Overlay/include/OgreOverlay.i index e82cf452aa0..135c1df9e5c 100644 --- a/Components/Overlay/include/OgreOverlay.i +++ b/Components/Overlay/include/OgreOverlay.i @@ -76,6 +76,18 @@ SHARED_PTR(OverlayContainer); #endif %ignore Ogre::OverlayManager::getTemplateIterator; %ignore Ogre::OverlayManager::getOverlayIterator; +#ifdef SWIGPYTHON +%{ + // this is a workaround for the following map + namespace swig { + template<> struct traits { + typedef pointer_category category; + static const char* type_name() { return "Ogre::OverlayElement"; } + }; + } +%} +#endif +%template(OverlayElementMap) std::map; %include "OgreOverlayManager.h" SHARED_PTR(OverlaySystem); %include "OgreOverlaySystem.h" diff --git a/Components/Overlay/src/OgreFont.cpp b/Components/Overlay/src/OgreFont.cpp index 97511dd34a7..a60e1959b69 100644 --- a/Components/Overlay/src/OgreFont.cpp +++ b/Components/Overlay/src/OgreFont.cpp @@ -429,8 +429,6 @@ namespace Ogre } finalWidth = roundUpSize; - Real textureAspect = (Real)finalWidth / (Real)finalHeight; - Image img(PF_BYTE_LA, finalWidth, finalHeight); // Reset content (transparent) img.setTo(ColourValue::ZERO); @@ -518,12 +516,13 @@ namespace Ogre } } - UVRect uvs((Real)l / (Real)finalWidth, // u1 - (Real)m / (Real)finalHeight, // v1 - (Real)(l + width) / (Real)finalWidth, // u2 - (m + max_height) / (Real)finalHeight); // v2 - this->setGlyphInfo({cp, uvs, float(textureAspect * uvs.width() / uvs.height()), - float(x_bearing) / max_height, float(advance) / max_height}); + UVRect uvs((Real)l / (Real)img.getWidth(), // u1 + (Real)m / (Real)img.getHeight(), // v1 + (Real)(l + width) / (Real)img.getWidth(), // u2 + (m + max_height) / (Real)img.getHeight()); // v2 + + float font_height = max_height; + setGlyphInfo({cp, uvs, width / font_height, x_bearing / font_height, advance / font_height}); // Advance a column if(width) diff --git a/Components/Overlay/src/OgreTextAreaOverlayElement.cpp b/Components/Overlay/src/OgreTextAreaOverlayElement.cpp index 09f199a05cb..10ee572fa83 100644 --- a/Components/Overlay/src/OgreTextAreaOverlayElement.cpp +++ b/Components/Overlay/src/OgreTextAreaOverlayElement.cpp @@ -315,7 +315,7 @@ namespace Ogre { } const auto& glyphInfo = mFont->getGlyphInfo(character); - Real horiz_height = glyphInfo.aspectRatio * mViewportAspectCoef ; + float width = glyphInfo.aspectRatio * mViewportAspectCoef * mCharHeight * 2.0f; const Font::UVRect& uvRect = glyphInfo.uvRect; if(uvRect.isNull()) @@ -328,33 +328,25 @@ namespace Ogre { } left += glyphInfo.bearing * mCharHeight * 2 * mViewportAspectCoef; + FloatRect pos(left, top, left + width, top - mCharHeight * 2); // each vert is (x, y, z, u, v) //------------------------------------------------------------------------------------- // First tri - // - // Upper left - *pVert++ = left; - *pVert++ = top; + *pVert++ = pos.left; + *pVert++ = pos.top; *pVert++ = -1.0; *pVert++ = uvRect.left; *pVert++ = uvRect.top; - top -= mCharHeight * 2.0f; - - // Bottom left - *pVert++ = left; - *pVert++ = top; + *pVert++ = pos.left; + *pVert++ = pos.bottom; *pVert++ = -1.0; *pVert++ = uvRect.left; *pVert++ = uvRect.bottom; - top += mCharHeight * 2.0f; - left += horiz_height * mCharHeight * 2.0f; - - // Top right - *pVert++ = left; - *pVert++ = top; + *pVert++ = pos.right; + *pVert++ = pos.top; *pVert++ = -1.0; *pVert++ = uvRect.right; *pVert++ = uvRect.top; @@ -362,39 +354,26 @@ namespace Ogre { //------------------------------------------------------------------------------------- // Second tri - // - // Top right (again) - *pVert++ = left; - *pVert++ = top; + *pVert++ = pos.right; + *pVert++ = pos.top; *pVert++ = -1.0; *pVert++ = uvRect.right; *pVert++ = uvRect.top; - top -= mCharHeight * 2.0f; - left -= horiz_height * mCharHeight * 2.0f; - - // Bottom left (again) - *pVert++ = left; - *pVert++ = top; + *pVert++ = pos.left; + *pVert++ = pos.bottom; *pVert++ = -1.0; *pVert++ = uvRect.left; *pVert++ = uvRect.bottom; - left += horiz_height * mCharHeight * 2.0f; - - // Bottom right - *pVert++ = left; - *pVert++ = top; + *pVert++ = pos.right; + *pVert++ = pos.bottom; *pVert++ = -1.0; *pVert++ = uvRect.right; *pVert++ = uvRect.bottom; //------------------------------------------------------------------------------------- - // Go back up with top - top += mCharHeight * 2.0f; - // advance - left -= horiz_height * mCharHeight * 2.0f; left += (glyphInfo.advance - glyphInfo.bearing) * mCharHeight * 2.0f * mViewportAspectCoef; float currentWidth = (left + 1)/2 - _getDerivedLeft(); diff --git a/Components/RTShaderSystem/include/OgreShaderFunction.h b/Components/RTShaderSystem/include/OgreShaderFunction.h index 465284622ce..aca1a66e3f4 100644 --- a/Components/RTShaderSystem/include/OgreShaderFunction.h +++ b/Components/RTShaderSystem/include/OgreShaderFunction.h @@ -118,14 +118,14 @@ class _OgreRTSSExport Function : public RTShaderSystemAlloc // Interface. public: /// @deprecated - ParameterPtr resolveInputParameter(Parameter::Semantic semantic, int index, const Parameter::Content content, GpuConstantType type); + ParameterPtr resolveInputParameter(Parameter::Semantic semantic, int index, int content, GpuConstantType type); /** Resolve input parameter of this function @param content The content of the parameter. @param type The type of the desired parameter. @return parameter instance in case of that resolve operation succeeded. */ - ParameterPtr resolveInputParameter(Parameter::Content content, GpuConstantType type = GCT_UNKNOWN) + ParameterPtr resolveInputParameter(int content, GpuConstantType type = GCT_UNKNOWN) { return resolveInputParameter(Parameter::SPS_UNKNOWN, 0, content, type); } @@ -143,20 +143,20 @@ class _OgreRTSSExport Function : public RTShaderSystemAlloc * @param type The type of the desired parameter. * @return parameter or NULL if not found */ - ParameterPtr getInputParameter(Parameter::Content content, GpuConstantType type = GCT_UNKNOWN) + ParameterPtr getInputParameter(int content, GpuConstantType type = GCT_UNKNOWN) { return _getParameterByContent(mInputParameters, content, type); } /// @deprecated - ParameterPtr resolveOutputParameter(Parameter::Semantic semantic, int index, const Parameter::Content content, GpuConstantType type); + ParameterPtr resolveOutputParameter(Parameter::Semantic semantic, int index, int content, GpuConstantType type); /** Resolve output parameter of this function @param content The content of the parameter. @param type The type of the desired parameter. @return parameter instance in case of that resolve operation succeeded. */ - ParameterPtr resolveOutputParameter(Parameter::Content content, GpuConstantType type = GCT_UNKNOWN) + ParameterPtr resolveOutputParameter(int content, GpuConstantType type = GCT_UNKNOWN) { return resolveOutputParameter(Parameter::SPS_UNKNOWN, 0, content, type); } @@ -167,7 +167,7 @@ class _OgreRTSSExport Function : public RTShaderSystemAlloc * @param type The type of the desired parameter. * @return parameter or NULL if not found */ - ParameterPtr getOutputParameter(Parameter::Content content, GpuConstantType type = GCT_UNKNOWN) + ParameterPtr getOutputParameter(int content, GpuConstantType type = GCT_UNKNOWN) { return _getParameterByContent(mOutputParameters, content, type); } @@ -189,7 +189,7 @@ class _OgreRTSSExport Function : public RTShaderSystemAlloc @param type The type of the desired parameter. @return parameter instance in case of that resolve operation succeeded. */ - ParameterPtr resolveLocalParameter(Parameter::Content content, GpuConstantType type = GCT_UNKNOWN); + ParameterPtr resolveLocalParameter(int content, GpuConstantType type = GCT_UNKNOWN); ParameterPtr resolveLocalStructParameter(const String& type, const String& name); @@ -199,7 +199,7 @@ class _OgreRTSSExport Function : public RTShaderSystemAlloc * @param content * @return parameter or NULL if not found */ - ParameterPtr getLocalParameter(Parameter::Content content) + ParameterPtr getLocalParameter(int content) { return _getParameterByContent(mLocalParameters, content, GCT_UNKNOWN); } @@ -261,7 +261,7 @@ class _OgreRTSSExport Function : public RTShaderSystemAlloc static ParameterPtr _getParameterByName(const ShaderParameterList& parameterList, const String& name); static ParameterPtr _getParameterBySemantic(const ShaderParameterList& parameterList, const Parameter::Semantic semantic, int index); - static ParameterPtr _getParameterByContent(const ShaderParameterList& parameterList, const Parameter::Content content, GpuConstantType type); + static ParameterPtr _getParameterByContent(const ShaderParameterList& parameterList, int content, GpuConstantType type); /** Class destructor */ ~Function(); diff --git a/Components/RTShaderSystem/include/OgreShaderParameter.h b/Components/RTShaderSystem/include/OgreShaderParameter.h index 6a59fc36244..9498e4cb279 100644 --- a/Components/RTShaderSystem/include/OgreShaderParameter.h +++ b/Components/RTShaderSystem/include/OgreShaderParameter.h @@ -198,9 +198,8 @@ class _OgreRTSSExport Parameter : public RTShaderSystemAlloc @param content The content of this parameter. @param size */ - Parameter(GpuConstantType type, const String& name, - const Semantic& semantic, int index, - const Content& content, size_t size = 0); + Parameter(GpuConstantType type, const String& name, const Semantic& semantic, int index, int content, + size_t size = 0); /** Class destructor */ virtual ~Parameter() {}; @@ -226,7 +225,7 @@ class _OgreRTSSExport Parameter : public RTShaderSystemAlloc int getIndex() const { return mIndex; } /** Return the content of this parameter. */ - Content getContent() const { return mContent; } + int getContent() const { return mContent; } /** Returns true if this instance is a ConstParameter otherwise false. */ virtual bool isConstParameter() const { return false; } @@ -273,7 +272,7 @@ class _OgreRTSSExport Parameter : public RTShaderSystemAlloc // Index of this parameter. int mIndex; // The content of this parameter. - Content mContent; + int mContent; // Number of elements in the parameter (for arrays) size_t mSize; @@ -301,7 +300,7 @@ class _OgreRTSSExport UniformParameter : public Parameter */ UniformParameter(GpuConstantType type, const String& name, const Semantic& semantic, int index, - const Content& content, + int content, uint16 variability, size_t size); /** Class constructor. @@ -551,7 +550,7 @@ class _OgreRTSSExport ParameterFactory // Interface. public: - static ParameterPtr createInPosition(int index, Parameter::Content content = Parameter::SPC_POSITION_OBJECT_SPACE); + static ParameterPtr createInPosition(int index, int content = Parameter::SPC_POSITION_OBJECT_SPACE); static ParameterPtr createOutPosition(int index); static ParameterPtr createInNormal(int index); @@ -565,8 +564,8 @@ class _OgreRTSSExport ParameterFactory static ParameterPtr createInColor(int index); static ParameterPtr createOutColor(int index); - static ParameterPtr createInTexcoord(GpuConstantType type, int index, Parameter::Content content); - static ParameterPtr createOutTexcoord(GpuConstantType type, int index, Parameter::Content content); + static ParameterPtr createInTexcoord(GpuConstantType type, int index, int content); + static ParameterPtr createOutTexcoord(GpuConstantType type, int index, int content); static ParameterPtr createConstParam(const Vector2& val); static ParameterPtr createConstParam(const Vector3& val); diff --git a/Components/RTShaderSystem/src/OgreShaderCookTorranceLighting.cpp b/Components/RTShaderSystem/src/OgreShaderCookTorranceLighting.cpp index 0ccefd2cbc1..acc42a693a3 100644 --- a/Components/RTShaderSystem/src/OgreShaderCookTorranceLighting.cpp +++ b/Components/RTShaderSystem/src/OgreShaderCookTorranceLighting.cpp @@ -116,7 +116,7 @@ bool CookTorranceLighting::createCpuSubPrograms(ProgramSet* programSet) fstage.mul(In(diffuse).xyz(), In(outDiffuse).xyz(), baseColor); fstage.assign(Vector3(0), Out(outDiffuse).xyz()); - fstage.assign(In(diffuse).w(), Out(outDiffuse).w()); // forward alpha + fstage.mul(In(diffuse).w(), In(outDiffuse).w(), Out(outDiffuse).w()); // forward alpha fstage.callFunction("PBR_MakeParams", {In(baseColor), In(mrparams), InOut(pixelParams)}); diff --git a/Components/RTShaderSystem/src/OgreShaderExIntegratedPSSM3.cpp b/Components/RTShaderSystem/src/OgreShaderExIntegratedPSSM3.cpp index 28de672896e..ca49831d736 100644 --- a/Components/RTShaderSystem/src/OgreShaderExIntegratedPSSM3.cpp +++ b/Components/RTShaderSystem/src/OgreShaderExIntegratedPSSM3.cpp @@ -231,7 +231,7 @@ bool IntegratedPSSM3::resolveParameters(ProgramSet* programSet) for (auto& p : mShadowTextureParamsList) { p.mWorldViewProjMatrix = vsProgram->resolveParameter(GpuProgramParameters::ACT_TEXTURE_WORLDVIEWPROJ_MATRIX, lightIndex); - p.mVSOutLightPosition = vsMain->resolveOutputParameter(Parameter::Content(Parameter::SPC_POSITION_LIGHT_SPACE0 + lightIndex)); + p.mVSOutLightPosition = vsMain->resolveOutputParameter(Parameter::SPC_POSITION_LIGHT_SPACE0 + lightIndex); p.mPSInLightPosition = psMain->resolveInputParameter(p.mVSOutLightPosition); auto stype = mUseTextureCompare ? GCT_SAMPLER2DSHADOW : GCT_SAMPLER2D; p.mTextureSampler = psProgram->resolveParameter(stype, "shadow_map", p.mTextureSamplerIndex); diff --git a/Components/RTShaderSystem/src/OgreShaderExNormalMapLighting.cpp b/Components/RTShaderSystem/src/OgreShaderExNormalMapLighting.cpp index 07356238572..92e53654b43 100644 --- a/Components/RTShaderSystem/src/OgreShaderExNormalMapLighting.cpp +++ b/Components/RTShaderSystem/src/OgreShaderExNormalMapLighting.cpp @@ -68,10 +68,10 @@ bool NormalMapLighting::createCpuSubPrograms(ProgramSet* programSet) psProgram->addPreprocessorDefines("POM_LAYER_COUNT=32"); // Resolve texture coordinates. - auto vsInTexcoord = vsMain->resolveInputParameter( - Parameter::Content(Parameter::SPC_TEXTURE_COORDINATE0 + mVSTexCoordSetIndex), GCT_FLOAT2); - auto vsOutTexcoord = vsMain->resolveOutputParameter( - Parameter::Content(Parameter::SPC_TEXTURE_COORDINATE0 + mVSTexCoordSetIndex), GCT_FLOAT2); + auto vsInTexcoord = + vsMain->resolveInputParameter(Parameter::SPC_TEXTURE_COORDINATE0 + mVSTexCoordSetIndex, GCT_FLOAT2); + auto vsOutTexcoord = + vsMain->resolveOutputParameter(Parameter::SPC_TEXTURE_COORDINATE0 + mVSTexCoordSetIndex, GCT_FLOAT2); auto psInTexcoord = psMain->resolveInputParameter(vsOutTexcoord); // Resolve normal. diff --git a/Components/RTShaderSystem/src/OgreShaderFFPTexturing.cpp b/Components/RTShaderSystem/src/OgreShaderFFPTexturing.cpp index 0df7b818899..efbdd8a0a46 100644 --- a/Components/RTShaderSystem/src/OgreShaderFFPTexturing.cpp +++ b/Components/RTShaderSystem/src/OgreShaderFFPTexturing.cpp @@ -132,7 +132,7 @@ bool FFPTexturing::resolveFunctionsParams(TextureUnitParams* textureUnitParams, Program* psProgram = programSet->getCpuProgram(GPT_FRAGMENT_PROGRAM); Function* vsMain = vsProgram->getEntryPointFunction(); Function* psMain = psProgram->getEntryPointFunction(); - Parameter::Content texCoordContent = Parameter::SPC_UNKNOWN; + int texCoordContent = Parameter::SPC_UNKNOWN; switch (textureUnitParams->mTexCoordCalcMethod) { @@ -143,15 +143,14 @@ bool FFPTexturing::resolveFunctionsParams(TextureUnitParams* textureUnitParams, break; if (textureUnitParams->mTextureMatrix.get() == NULL) - texCoordContent = Parameter::Content(Parameter::SPC_TEXTURE_COORDINATE0 + textureUnitParams->mTextureUnitState->getTextureCoordSet()); + texCoordContent = Parameter::SPC_TEXTURE_COORDINATE0 + textureUnitParams->mTextureUnitState->getTextureCoordSet(); // assume already resolved if(vsMain->getOutputParameter(texCoordContent, textureUnitParams->mVSInTextureCoordinateType)) break; textureUnitParams->mVSInputTexCoord = vsMain->resolveInputParameter( - Parameter::Content(Parameter::SPC_TEXTURE_COORDINATE0 + - textureUnitParams->mTextureUnitState->getTextureCoordSet()), + Parameter::SPC_TEXTURE_COORDINATE0 + textureUnitParams->mTextureUnitState->getTextureCoordSet(), textureUnitParams->mVSInTextureCoordinateType); break; diff --git a/Components/RTShaderSystem/src/OgreShaderFFPTransform.cpp b/Components/RTShaderSystem/src/OgreShaderFFPTransform.cpp index a77685ac9fc..1e307724d4b 100644 --- a/Components/RTShaderSystem/src/OgreShaderFFPTransform.cpp +++ b/Components/RTShaderSystem/src/OgreShaderFFPTransform.cpp @@ -96,8 +96,8 @@ bool FFPTransform::createCpuSubPrograms(ProgramSet* programSet) vsProgram->setUseColumnMajorMatrices(false); } - auto wMatrix = vsEntry->resolveInputParameter( - Parameter::Content(Parameter::SPC_TEXTURE_COORDINATE0 + mInstancingTexCoordIndex), GCT_MATRIX_3X4); + auto wMatrix = vsEntry->resolveInputParameter(Parameter::SPC_TEXTURE_COORDINATE0 + mInstancingTexCoordIndex, + GCT_MATRIX_3X4); stage.callFunction(FFP_FUNC_TRANSFORM, wMatrix, positionIn, Out(positionIn).xyz()); if(mDoLightCalculations) diff --git a/Components/RTShaderSystem/src/OgreShaderFunction.cpp b/Components/RTShaderSystem/src/OgreShaderFunction.cpp index dcae4b7eb86..38bced0ad5f 100644 --- a/Components/RTShaderSystem/src/OgreShaderFunction.cpp +++ b/Components/RTShaderSystem/src/OgreShaderFunction.cpp @@ -30,7 +30,7 @@ THE SOFTWARE. namespace Ogre { namespace RTShader { -static GpuConstantType typeFromContent(Parameter::Content content) +static GpuConstantType typeFromContent(int content) { switch (content) { @@ -72,7 +72,7 @@ static GpuConstantType typeFromContent(Parameter::Content content) } } -static Parameter::Semantic semanticFromContent(Parameter::Content content, bool isVSOut = false) +static Parameter::Semantic semanticFromContent(int content, bool isVSOut = false) { switch (content) { @@ -109,7 +109,7 @@ static Parameter::Semantic semanticFromContent(Parameter::Content content, bool } /// fixed index for texcoords, next free semantic slot else -static int indexFromContent(Parameter::Content content) +static int indexFromContent(int content) { int c = int(content); if(c < Parameter::SPC_TEXTURE_COORDINATE0 || c > Parameter::SPC_TEXTURE_COORDINATE7) @@ -225,7 +225,7 @@ static String getParameterName(const char* prefix, Parameter::Semantic semantic, //----------------------------------------------------------------------------- ParameterPtr Function::resolveInputParameter(Parameter::Semantic semantic, int index, - const Parameter::Content content, + int content, GpuConstantType type) { if(type == GCT_UNKNOWN) @@ -286,7 +286,7 @@ ParameterPtr Function::resolveInputParameter(Parameter::Semantic semantic, //----------------------------------------------------------------------------- ParameterPtr Function::resolveOutputParameter(Parameter::Semantic semantic, int index, - Parameter::Content content, + int content, GpuConstantType type) { if(type == GCT_UNKNOWN) @@ -400,7 +400,7 @@ ParameterPtr Function::resolveLocalStructParameter(const String& type, const Str } //----------------------------------------------------------------------------- -ParameterPtr Function::resolveLocalParameter(const Parameter::Content content, GpuConstantType type) +ParameterPtr Function::resolveLocalParameter(int content, GpuConstantType type) { ParameterPtr param; @@ -534,7 +534,7 @@ ParameterPtr Function::_getParameterBySemantic(const ShaderParameterList& parame } //----------------------------------------------------------------------------- -ParameterPtr Function::_getParameterByContent(const ShaderParameterList& parameterList, const Parameter::Content content, GpuConstantType type) +ParameterPtr Function::_getParameterByContent(const ShaderParameterList& parameterList, int content, GpuConstantType type) { if(type == GCT_UNKNOWN) type = typeFromContent(content); diff --git a/Components/RTShaderSystem/src/OgreShaderParameter.cpp b/Components/RTShaderSystem/src/OgreShaderParameter.cpp index 18a137ec0cc..36909a5a239 100644 --- a/Components/RTShaderSystem/src/OgreShaderParameter.cpp +++ b/Components/RTShaderSystem/src/OgreShaderParameter.cpp @@ -167,7 +167,7 @@ Parameter::Parameter() : mName(""), mType(GCT_UNKNOWN), mSemantic(SPS_UNKNOWN), //----------------------------------------------------------------------- Parameter::Parameter(GpuConstantType type, const String& name, const Semantic& semantic, int index, - const Content& content, size_t size) : + int content, size_t size) : mName(name), mType(type), mSemantic(semantic), mIndex(index), mContent(content), mSize(size), mUsed(false), mIsHighP(false) { } @@ -175,7 +175,7 @@ Parameter::Parameter(GpuConstantType type, const String& name, //----------------------------------------------------------------------- UniformParameter::UniformParameter(GpuConstantType type, const String& name, const Semantic& semantic, int index, - const Content& content, + int content, uint16 variability, size_t size) : Parameter(type, name, semantic, index, content, size) { mIsAutoConstantReal = false; @@ -330,7 +330,7 @@ void UniformParameter::bind(GpuProgramParametersSharedPtr paramsPtr) } //----------------------------------------------------------------------- -ParameterPtr ParameterFactory::createInPosition(int index, Parameter::Content content) +ParameterPtr ParameterFactory::createInPosition(int index, int content) { return std::make_shared(GCT_FLOAT4, "iPos_" + StringConverter::toString(index), Parameter::SPS_POSITION, index, @@ -430,7 +430,7 @@ ParameterPtr ParameterFactory::createOutColor(int index) } //----------------------------------------------------------------------- -ParameterPtr ParameterFactory::createInTexcoord(GpuConstantType type, int index, Parameter::Content content) +ParameterPtr ParameterFactory::createInTexcoord(GpuConstantType type, int index, int content) { switch (type) { @@ -473,7 +473,7 @@ ParameterPtr ParameterFactory::createInTexcoord(GpuConstantType type, int index, } //----------------------------------------------------------------------- -ParameterPtr ParameterFactory::createOutTexcoord(GpuConstantType type, int index, Parameter::Content content) +ParameterPtr ParameterFactory::createOutTexcoord(GpuConstantType type, int index, int content) { switch (type) { diff --git a/Docs/src/high-level-programs.md b/Docs/src/high-level-programs.md index 3e64735d88b..34ed3cc89a7 100644 --- a/Docs/src/high-level-programs.md +++ b/Docs/src/high-level-programs.md @@ -329,7 +329,10 @@ Set the optimisation level, which can be one of ’default’, ’none’, ’0 -# Assembler Shaders +# Assembler Shaders {#Assembler-Shaders} + +You can specify assembly shaders directly as the syntax code of the program, if you compiled them ahead of time. +Alternatively, you can use the syntax code to specify the @c target of a high-level shader, which will be compiled on-the-fly to the specified syntax. The current supported syntaxes are: @@ -348,19 +351,24 @@ SPIRV variant exposed by ARB_gl_spirv These is are the DirectX vertex shader assembler syntaxes. +@note on D3D11 the following targets will alias to @c vs_4_0 levels so you can use them for both D3D9 and D3D11. +- @c vs_2_0 to @c vs_4_0_level_9_1 +- @c vs_2_a to @c vs_4_0_level_9_3 +- @c vs_3_0 to @c vs_4_0 +
arbvp1
This is the OpenGL standard assembler format for vertex programs. It’s roughly equivalent to DirectX vs\_1\_1.
vp*
-These are nVidia-specific OpenGL vertex shader syntax which is a superset of vs_1_1_, that have otherwise no equivalent in OpenGL. +These are nVidia-specific OpenGL vertex shader syntax which is a superset of vs_1_1, that have otherwise no equivalent in OpenGL.
ps_*
DirectX pixel shader (i.e. fragment program) assembler syntax. -@note for ATI 8500, 9000, 9100, 9200 hardware, these profiles can also be used in OpenGL. The ATI 8500 to 9200 do not support arbfp1 but do support atifs extension in OpenGL which is very similar in function to ps\_1\_4 in DirectX. Ogre has a built in ps\_1\_x to atifs compiler that is automatically invoked when ps\_1\_x is used in OpenGL on ATI hardware. +@note for ATI 8500, 9000, 9100, 9200 hardware, these profiles can also be used in OpenGL. The ATI 8500 to 9200 do not support arbfp1 but do support atifs extension in OpenGL which is very similar in function to ps\_1\_4 in DirectX. %Ogre has a built in ps\_1\_x to atifs compiler that is automatically invoked when ps\_1\_x is used in OpenGL on ATI hardware.
arbfp1
@@ -386,7 +394,7 @@ You can get a definitive list of the syntaxes supported by the current card by c ## Specifying Named Constants {#Specifying-Named-Constants-for-Assembler-Shaders} -Assembler shaders don’t have named constants (also called uniform parameters) because the language does not support them - however if you for example decided to precompile your shaders from a high-level language down to assembler for performance or obscurity, you might still want to use the named parameters. Well, you actually can - GpuNamedConstants which contains the named parameter mappings has a ’save’ method which you can use to write this data to disk, where you can reference it later using the manual\_named\_constants directive inside your assembler program declaration, e.g. +Assembler shaders don’t have named constants (also called uniform parameters) because the language does not support them - however if you for example decided to precompile your shaders from a high-level language down to assembler for performance or obscurity, you might still want to use the named parameters. Well, you actually can - Ogre::GpuNamedConstants which contains the named parameter mappings has a ’save’ method which you can use to write this data to disk, where you can reference it later using the @c manual_named_constants directive inside your assembler program declaration, e.g. ```cpp vertex_program myVertexProgram spirv diff --git a/OgreMain/include/Ogre.i b/OgreMain/include/Ogre.i index d6e9b7370ca..665bccc6ef8 100644 --- a/OgreMain/include/Ogre.i +++ b/OgreMain/include/Ogre.i @@ -589,6 +589,15 @@ SHARED_PTR(StringInterface); %include "OgreResource.h" SHARED_PTR(Texture); %ignore Ogre::Texture::setTreatLuminanceAsAlpha; + + #ifdef SWIGCSHARP + // correct out IntPtr for void* pData output parameter + %typemap(imtype, out="global::System.IntPtr") void *pData "out global::System.IntPtr" + %typemap(cstype, out="$csclassname") void *pData "out global::System.IntPtr" + %typemap(csin) void *pData "out $csinput" + %typecheck(SWIG_TYPECHECK_INT64_PTR) void *pData "" + #endif + %include "OgreTexture.h" SHARED_PTR(GpuProgram); %ignore Ogre::GpuProgram::setAdjacencyInfoRequired; diff --git a/OgreMain/include/OgreCamera.h b/OgreMain/include/OgreCamera.h index 9eb263680e1..c073dc01d16 100644 --- a/OgreMain/include/OgreCamera.h +++ b/OgreMain/include/OgreCamera.h @@ -397,19 +397,19 @@ namespace Ogre { /** Internal method to notify camera of the visible faces in the last render. */ - void _notifyRenderedFaces(unsigned int numfaces); + void _notifyRenderedFaces(unsigned int numfaces) { mVisFacesLastRender = numfaces; } /** Internal method to notify camera of the visible batches in the last render. */ - void _notifyRenderedBatches(unsigned int numbatches); + void _notifyRenderedBatches(unsigned int numbatches) { mVisBatchesLastRender = numbatches; } /** Internal method to retrieve the number of visible faces in the last render. */ - unsigned int _getNumRenderedFaces(void) const; + unsigned int _getNumRenderedFaces(void) const { return mVisFacesLastRender; } /** Internal method to retrieve the number of visible batches in the last render. */ - unsigned int _getNumRenderedBatches(void) const; + unsigned int _getNumRenderedBatches(void) const { return mVisBatchesLastRender; } /** Gets the derived orientation of the camera, including any rotation inherited from a node attachment and reflection matrix. */ diff --git a/OgreMain/include/OgreHardwarePixelBuffer.h b/OgreMain/include/OgreHardwarePixelBuffer.h index 0f43c5d4ff0..59a9a5d79c9 100644 --- a/OgreMain/include/OgreHardwarePixelBuffer.h +++ b/OgreMain/include/OgreHardwarePixelBuffer.h @@ -180,7 +180,7 @@ namespace Ogre { @return A pointer to the render target. This pointer has the lifespan of this PixelBuffer. */ - RenderTexture *getRenderTarget(size_t slice=0); + RenderTexture *getRenderTarget(size_t slice=0) const; /// Gets the width of this buffer uint32 getWidth() const { return mWidth; } diff --git a/OgreMain/include/OgreRenderSystem.h b/OgreMain/include/OgreRenderSystem.h index 6488b1b046d..9ae0292242e 100644 --- a/OgreMain/include/OgreRenderSystem.h +++ b/OgreMain/include/OgreRenderSystem.h @@ -716,13 +716,13 @@ namespace Ogre virtual void _setDepthClamp(bool enable) {} /** The RenderSystem will keep a count of tris rendered, this resets the count. */ - virtual void _beginGeometryCount(void); + void _beginGeometryCount(void); /** Reports the number of tris rendered since the last _beginGeometryCount call. */ - virtual unsigned int _getFaceCount(void) const; + unsigned int _getFaceCount(void) const { return static_cast(mFaceCount); } /** Reports the number of batches rendered since the last _beginGeometryCount call. */ - virtual unsigned int _getBatchCount(void) const; + unsigned int _getBatchCount(void) const { return static_cast(mBatchCount); } /** Reports the number of vertices passed to the renderer since the last _beginGeometryCount call. */ - virtual unsigned int _getVertexCount(void) const; + unsigned int _getVertexCount(void) const { return static_cast(mVertexCount); } /// @deprecated use ColourValue::getAsBYTE() OGRE_DEPRECATED static void convertColourValue(const ColourValue& colour, uint32* pDest) diff --git a/OgreMain/include/OgreRenderTarget.h b/OgreMain/include/OgreRenderTarget.h index 14cf8fbfc72..fe3be22c715 100644 --- a/OgreMain/include/OgreRenderTarget.h +++ b/OgreMain/include/OgreRenderTarget.h @@ -90,13 +90,13 @@ namespace Ogre { virtual ~RenderTarget(); /// Retrieve target's name. - virtual const String& getName(void) const; + const String& getName(void) const { return mName; } /// Retrieve information about the render target. void getMetrics(unsigned int& width, unsigned int& height); - virtual uint32 getWidth(void) const; - virtual uint32 getHeight(void) const; + uint32 getWidth(void) const { return mWidth; } + uint32 getHeight(void) const { return mHeight; } /** * Sets the pool ID this RenderTarget should query from. Default value is POOL_DEFAULT. @@ -107,20 +107,20 @@ namespace Ogre { void setDepthBufferPool( uint16 poolId ); //Returns the pool ID this RenderTarget should query from. @see DepthBuffer - uint16 getDepthBufferPool() const; + uint16 getDepthBufferPool() const { return mDepthBufferPoolId; } - DepthBuffer* getDepthBuffer() const; + DepthBuffer* getDepthBuffer() const { return mDepthBuffer; } //Returns false if couldn't attach virtual bool attachDepthBuffer( DepthBuffer *depthBuffer ); - virtual void detachDepthBuffer(); + void detachDepthBuffer(); /** Detaches DepthBuffer without notifying it from the detach. Useful when called from the DepthBuffer while it iterates through attached RenderTargets (@see DepthBuffer::_setPoolId()) */ - virtual void _detachDepthBuffer(); + virtual void _detachDepthBuffer() { mDepthBuffer = 0; } /** Tells the target to update it's contents. @@ -144,7 +144,7 @@ namespace Ogre { queued commands complete. Or, you might do this if you want custom control over your windows, such as for externally created windows. */ - virtual void update(bool swapBuffers = true); + void update(bool swapBuffers = true); /** Swaps the frame buffers to display the next frame. For targets that are double-buffered so that no @@ -170,38 +170,38 @@ namespace Ogre { viewports i.e. picture-in-picture). Higher Z-orders are on top of lower ones. The actual number is irrelevant, only the relative Z-order matters (you can leave gaps in the numbering) @param - left The relative position of the left of the viewport on the target, as a value between 0 and 1. - @param - top The relative position of the top of the viewport on the target, as a value between 0 and 1. - @param - width The relative width of the viewport on the target, as a value between 0 and 1. - @param - height The relative height of the viewport on the target, as a value between 0 and 1. + rect The relative position of the viewport on the target, as a value between 0 and 1. */ - virtual Viewport* addViewport(Camera* cam, int ZOrder = 0, float left = 0.0f, float top = 0.0f , - float width = 1.0f, float height = 1.0f); + Viewport* addViewport(Camera* cam, int ZOrder = 0, FloatRect rect = {0.0f, 0.0f, 1.0f, 1.0f}); + + /// @overload + Viewport* addViewport(Camera* cam, int ZOrder, float left, float top = 0.0f, float width = 1.0f, + float height = 1.0f) + { + return addViewport(cam, ZOrder, {left, top, left + width, top + height}); + } /** Returns the number of viewports attached to this target.*/ - virtual unsigned short getNumViewports(void) const; + unsigned short getNumViewports(void) const { return static_cast(mViewportList.size()); } /** Retrieves a pointer to the viewport with the given index. */ - virtual Viewport* getViewport(unsigned short index); + Viewport* getViewport(unsigned short index); /** Retrieves a pointer to the viewport with the given Z-order. @remarks throws if not found. */ - virtual Viewport* getViewportByZOrder(int ZOrder); + Viewport* getViewportByZOrder(int ZOrder); /** Returns true if and only if a viewport exists at the given Z-order. */ - virtual bool hasViewportWithZOrder(int ZOrder); + bool hasViewportWithZOrder(int ZOrder); /** Removes a viewport at a given Z-order. */ - virtual void removeViewport(int ZOrder); + void removeViewport(int ZOrder); /** Removes all viewports on this target. */ - virtual void removeAllViewports(void); + void removeAllViewports(void); /** Retrieves details of current rendering performance. */ const FrameStats& getStatistics(void) const { @@ -256,13 +256,13 @@ namespace Ogre { 'normal' system rendering. @par NB this should not be used for frame-based scene updates, use Root::addFrameListener for that. */ - virtual void addListener(RenderTargetListener* listener); + void addListener(RenderTargetListener* listener); /** same as addListener, but force the position in the vector, so we can control the call order */ - virtual void insertListener(RenderTargetListener* listener, const unsigned int pos = 0); + void insertListener(RenderTargetListener* listener, const unsigned int pos = 0); /** Removes a RenderTargetListener previously registered using addListener. */ - virtual void removeListener(RenderTargetListener* listener); + void removeListener(RenderTargetListener* listener); /** Removes all listeners from this instance. */ - virtual void removeAllListeners(void); + void removeAllListeners(void); /** Sets the priority of this render target in relation to the others. @@ -271,17 +271,17 @@ namespace Ogre { at the time the render target is attached to the render system, changes afterwards will not affect the ordering. */ - virtual void setPriority( uchar priority ) { mPriority = priority; } + void setPriority( uchar priority ) { mPriority = priority; } /** Gets the priority of a render target. */ - virtual uchar getPriority() const { return mPriority; } + uchar getPriority() const { return mPriority; } /** Used to retrieve or set the active state of the render target. */ - virtual bool isActive() const; + virtual bool isActive() const { return mActive; } /** Used to set the active state of the render target. */ - virtual void setActive( bool state ); + void setActive( bool state ) { mActive = state; } /** Sets whether this target should be automatically updated if Ogre's rendering loop or Root::_updateAllRenderTargets is being used. @@ -294,11 +294,11 @@ namespace Ogre { loop or when Root::_updateAllRenderTargets is called. If false, the target is only updated when its update() method is called explicitly. */ - virtual void setAutoUpdated(bool autoupdate); + void setAutoUpdated(bool autoupdate) { mAutoUpdate = autoupdate; } /** Gets whether this target is automatically updated if Ogre's rendering loop or Root::_updateAllRenderTargets is being used. */ - virtual bool isAutoUpdated(void) const; + bool isAutoUpdated(void) const { return mAutoUpdate; } /** Copies the current contents of the render target to a pixelbox. @remarks See suggestPixelFormat for a tip as to the best pixel format to @@ -326,14 +326,14 @@ namespace Ogre { /** Writes the current contents of the render target to the (PREFIX)(time-stamp)(SUFFIX) file. @return the name of the file used.*/ - virtual String writeContentsToTimestampedFile(const String& filenamePrefix, const String& filenameSuffix); + String writeContentsToTimestampedFile(const String& filenamePrefix, const String& filenameSuffix); virtual bool requiresTextureFlipping() const = 0; /** Utility method to notify a render target that a camera has been removed, in case it was referring to it as a viewer. */ - virtual void _notifyCameraRemoved(const Camera* cam); + void _notifyCameraRemoved(const Camera* cam); /** Indicates whether this target is the primary window. The primary window is special in that it is destroyed when @@ -341,10 +341,10 @@ namespace Ogre { This is the case because it holds the context for vertex, index buffers and textures. */ - virtual bool isPrimary(void) const; + virtual bool isPrimary(void) const { return false; } /** Indicates whether stereo is currently enabled for this target. Default is false. */ - virtual bool isStereoEnabled(void) const; + virtual bool isStereoEnabled(void) const { return mStereoEnabled; } /** Indicates whether on rendering, linear colour space is converted to sRGB gamma colour space. This is the exact opposite conversion of @@ -353,14 +353,14 @@ namespace Ogre { enabled through the 'gamma' creation misc parameter. For textures, it is enabled through the hwGamma parameter to the create call. */ - virtual bool isHardwareGammaEnabled() const { return mHwGamma; } + bool isHardwareGammaEnabled() const { return mHwGamma; } /** Indicates whether multisampling is performed on rendering and at what level. */ - virtual uint getFSAA() const { return mFSAA; } + uint getFSAA() const { return mFSAA; } /// RenderSystem specific FSAA option. See @ref RenderSystem::_createRenderWindow for details. - virtual const String& getFSAAHint() const { return mFSAAHint; } + const String& getFSAAHint() const { return mFSAAHint; } /** Set the level of multisample AA to be used if hardware support it. This option will be ignored if the hardware does not support it @@ -404,7 +404,10 @@ namespace Ogre { @param zorder The zorder of the viewport to update. @param updateStatistics Whether you want to update statistics or not. */ - virtual void _updateViewport(int zorder, bool updateStatistics = true); + void _updateViewport(int zorder, bool updateStatistics = true) + { + _updateViewport(getViewportByZOrder(zorder), updateStatistics); + } /** Method for manual management of rendering - renders the given viewport (even if it is not autoupdated) @@ -424,7 +427,7 @@ namespace Ogre { @param updateStatistics Whether you want to update statistics or not. @see _beginUpdate() */ - virtual void _updateAutoUpdatedViewports(bool updateStatistics = true); + void _updateAutoUpdatedViewports(bool updateStatistics = true); /** Method for manual management of rendering - finishes statistics calculation and fires 'postRenderTargetUpdate'. diff --git a/OgreMain/include/OgreRenderTexture.h b/OgreMain/include/OgreRenderTexture.h index 0aa0fe89174..89eedd4ef3f 100644 --- a/OgreMain/include/OgreRenderTexture.h +++ b/OgreMain/include/OgreRenderTexture.h @@ -80,8 +80,7 @@ namespace Ogre - Not all bound surfaces have the same size - Not all bound surfaces have the same internal format */ - - virtual void bindSurface(size_t attachment, RenderTexture *target); + void bindSurface(size_t attachment, RenderTexture *target); /** Unbind attachment. */ diff --git a/OgreMain/include/OgreTexture.h b/OgreMain/include/OgreTexture.h index a2b90783fee..fd450cdcec7 100644 --- a/OgreMain/include/OgreTexture.h +++ b/OgreMain/include/OgreTexture.h @@ -146,6 +146,12 @@ namespace Ogre { */ TextureType getTextureType(void) const { return mTextureType; } + /** D3D11 only: set a shared surface to use for this texture before loading + * + * Useful for WPF interop + */ + virtual void _setD3D11Surface(void* surface) {} + /** Gets the number of mipmaps to be used for this texture. */ uint32 getNumMipmaps(void) const {return mNumMipmaps;} @@ -394,7 +400,7 @@ namespace Ogre { @remarks The buffer is invalidated when the resource is unloaded or destroyed. Do not use it after the lifetime of the containing texture. */ - virtual const HardwarePixelBufferSharedPtr& getBuffer(size_t face=0, size_t mipmap=0); + virtual const HardwarePixelBufferSharedPtr& getBuffer(size_t face=0, size_t mipmap=0) const; /** Populate an Image with the contents of this texture. diff --git a/OgreMain/include/OgreTextureManager.h b/OgreMain/include/OgreTextureManager.h index a0ed4f40934..4a91d2df9dd 100644 --- a/OgreMain/include/OgreTextureManager.h +++ b/OgreMain/include/OgreTextureManager.h @@ -435,7 +435,7 @@ namespace Ogre { : Texture(creator, name, handle, group) { } - const HardwarePixelBufferSharedPtr& getBuffer(size_t, size_t) override + const HardwarePixelBufferSharedPtr& getBuffer(size_t, size_t) const override { static HardwarePixelBufferSharedPtr nullBuffer; return nullBuffer; diff --git a/OgreMain/include/OgreViewport.h b/OgreMain/include/OgreViewport.h index 5d97732192b..6355742ff72 100644 --- a/OgreMain/include/OgreViewport.h +++ b/OgreMain/include/OgreViewport.h @@ -87,7 +87,13 @@ namespace Ogre { Relative Z-order on the target. Lower = further to the front. */ - Viewport(Camera* camera, RenderTarget* target, float left, float top, float width, float height, int ZOrder); + Viewport(Camera* camera, RenderTarget* target, float left, float top, float width, float height, int ZOrder) + : Viewport(camera, target, {left, top, left + width, top + height}, ZOrder) + { + } + + /// @overload + Viewport(Camera* camera, RenderTarget* target, FloatRect relRect, int ZOrder); /** Default destructor. */ @@ -134,43 +140,17 @@ namespace Ogre { /** Gets the Z-Order of this viewport. */ int getZOrder(void) const { return mZOrder; } - /** Gets one of the relative dimensions of the viewport, - a value between 0.0 and 1.0. - */ - float getLeft(void) const { return mRelRect.left; } - /** Gets one of the relative dimensions of the viewport, a value - between 0.0 and 1.0. - */ + /// @name Relative dimensions + /// These methods return the relative dimensions of the viewport, which are + /// expressed as a value between 0.0 and 1.0. + /// @{ + float getLeft(void) const { return mRelRect.left; } float getTop(void) const { return mRelRect.top; } - - /** Gets one of the relative dimensions of the viewport, a value - between 0.0 and 1.0. - */ float getWidth(void) const { return mRelRect.width(); } - /** Gets one of the relative dimensions of the viewport, a value - between 0.0 and 1.0. - */ float getHeight(void) const { return mRelRect.height(); } - /** Gets one of the actual dimensions of the viewport, a value in - pixels. - */ - - int getActualLeft(void) const { return mActRect.left; } - /** Gets one of the actual dimensions of the viewport, a value in - pixels. - */ - - int getActualTop(void) const { return mActRect.top; } - /** Gets one of the actual dimensions of the viewport, a value in - pixels. - */ - int getActualWidth(void) const { return mActRect.width(); } - /** Gets one of the actual dimensions of the viewport, a value in - pixels. - */ - - int getActualHeight(void) const { return mActRect.height(); } + FloatRect getDimensions(void) const { return mRelRect; } + /// @} /** Sets the dimensions (after creation). @param @@ -187,6 +167,16 @@ namespace Ogre { */ void setDimensions(float left, float top, float width, float height); + /// @name Actual dimensions + /// These methods return the actual dimensions of the viewport in pixels. + /// @{ + int getActualLeft(void) const { return mActRect.left; } + int getActualTop(void) const { return mActRect.top; } + int getActualWidth(void) const { return mActRect.width(); } + int getActualHeight(void) const { return mActRect.height(); } + Rect getActualDimensions() const { return mActRect; } + /// @} + /** Sets the initial background colour of the viewport (before rendering). */ @@ -255,10 +245,6 @@ namespace Ogre { const String& getMaterialScheme(void) const { return mMaterialSchemeName; } - /** Access to actual dimensions (based on target size). - */ - Rect getActualDimensions() const { return mActRect; } - /// @deprecated OGRE_DEPRECATED void getActualDimensions(int& left, int& top, int& width, int& height) const; diff --git a/OgreMain/src/OgreCamera.cpp b/OgreMain/src/OgreCamera.cpp index d896233fccb..5ba29dafbeb 100644 --- a/OgreMain/src/OgreCamera.cpp +++ b/OgreMain/src/OgreCamera.cpp @@ -541,28 +541,6 @@ namespace Ogre { return o; } //----------------------------------------------------------------------- - void Camera::_notifyRenderedFaces(unsigned int numfaces) - { - mVisFacesLastRender = numfaces; - } - - //----------------------------------------------------------------------- - void Camera::_notifyRenderedBatches(unsigned int numbatches) - { - mVisBatchesLastRender = numbatches; - } - - //----------------------------------------------------------------------- - unsigned int Camera::_getNumRenderedFaces(void) const - { - return mVisFacesLastRender; - } - //----------------------------------------------------------------------- - unsigned int Camera::_getNumRenderedBatches(void) const - { - return mVisBatchesLastRender; - } - //----------------------------------------------------------------------- const Quaternion& Camera::getDerivedOrientation(void) const { updateView(); diff --git a/OgreMain/src/OgreHardwarePixelBuffer.cpp b/OgreMain/src/OgreHardwarePixelBuffer.cpp index 3d25d3f3b2c..3787842de7a 100644 --- a/OgreMain/src/OgreHardwarePixelBuffer.cpp +++ b/OgreMain/src/OgreHardwarePixelBuffer.cpp @@ -177,7 +177,7 @@ namespace Ogre } //----------------------------------------------------------------------------- - RenderTexture *HardwarePixelBuffer::getRenderTarget(size_t zoffset) + RenderTexture *HardwarePixelBuffer::getRenderTarget(size_t zoffset) const { assert(mUsage & TU_RENDERTARGET); return mSliceTRT.at(zoffset); diff --git a/OgreMain/src/OgreRenderSystem.cpp b/OgreMain/src/OgreRenderSystem.cpp index 9349be8653b..0cba970704f 100644 --- a/OgreMain/src/OgreRenderSystem.cpp +++ b/OgreMain/src/OgreRenderSystem.cpp @@ -606,22 +606,6 @@ namespace Ogre { void RenderSystem::_beginGeometryCount(void) { mBatchCount = mFaceCount = mVertexCount = 0; - - } - //----------------------------------------------------------------------- - unsigned int RenderSystem::_getFaceCount(void) const - { - return static_cast< unsigned int >( mFaceCount ); - } - //----------------------------------------------------------------------- - unsigned int RenderSystem::_getBatchCount(void) const - { - return static_cast< unsigned int >( mBatchCount ); - } - //----------------------------------------------------------------------- - unsigned int RenderSystem::_getVertexCount(void) const - { - return static_cast< unsigned int >( mVertexCount ); } //----------------------------------------------------------------------- void RenderSystem::_render(const RenderOperation& op) diff --git a/OgreMain/src/OgreRenderTarget.cpp b/OgreMain/src/OgreRenderTarget.cpp index e2755c1de02..baae9c7ac27 100644 --- a/OgreMain/src/OgreRenderTarget.cpp +++ b/OgreMain/src/OgreRenderTarget.cpp @@ -76,26 +76,11 @@ namespace Ogre { } - const String& RenderTarget::getName(void) const - { - return mName; - } - - void RenderTarget::getMetrics(unsigned int& width, unsigned int& height) { width = mWidth; height = mHeight; } - - unsigned int RenderTarget::getWidth(void) const - { - return mWidth; - } - unsigned int RenderTarget::getHeight(void) const - { - return mHeight; - } //----------------------------------------------------------------------- void RenderTarget::setDepthBufferPool( uint16 poolId ) { @@ -106,16 +91,6 @@ namespace Ogre { } } //----------------------------------------------------------------------- - uint16 RenderTarget::getDepthBufferPool() const - { - return mDepthBufferPoolId; - } - //----------------------------------------------------------------------- - DepthBuffer* RenderTarget::getDepthBuffer() const - { - return mDepthBuffer; - } - //----------------------------------------------------------------------- bool RenderTarget::attachDepthBuffer( DepthBuffer *depthBuffer ) { bool retVal = false; @@ -135,14 +110,9 @@ namespace Ogre { if( mDepthBuffer ) { mDepthBuffer->_notifyRenderTargetDetached( this ); - mDepthBuffer = 0; + _detachDepthBuffer(); } } - //----------------------------------------------------------------------- - void RenderTarget::_detachDepthBuffer() - { - mDepthBuffer = 0; - } void RenderTarget::updateImpl(void) { @@ -199,22 +169,7 @@ namespace Ogre { fireViewportPostUpdate(viewport); } - void RenderTarget::_updateViewport(int zorder, bool updateStatistics) - { - ViewportList::iterator it = mViewportList.find(zorder); - if (it != mViewportList.end()) - { - _updateViewport((*it).second,updateStatistics); - } - else - { - OGRE_EXCEPT(Exception::ERR_ITEM_NOT_FOUND,"No viewport with given zorder : " - + StringConverter::toString(zorder), "RenderTarget::_updateViewport"); - } - } - - Viewport* RenderTarget::addViewport(Camera* cam, int ZOrder, float left, float top , - float width , float height) + Viewport* RenderTarget::addViewport(Camera* cam, int ZOrder, FloatRect rect) { // Check no existing viewport with this Z-order ViewportList::iterator it = mViewportList.find(ZOrder); @@ -229,7 +184,7 @@ namespace Ogre { } // Add viewport to list // Order based on Z-order - Viewport* vp = OGRE_NEW Viewport(cam, this, left, top, width, height, ZOrder); + Viewport* vp = OGRE_NEW Viewport(cam, this, rect, ZOrder); mViewportList.emplace(ZOrder, vp); @@ -371,12 +326,6 @@ namespace Ogre { } } //----------------------------------------------------------------------- - unsigned short RenderTarget::getNumViewports(void) const - { - return (unsigned short)mViewportList.size(); - - } - //----------------------------------------------------------------------- Viewport* RenderTarget::getViewport(unsigned short index) { assert (index < mViewportList.size() && "Index out of bounds"); @@ -404,16 +353,6 @@ namespace Ogre { return i != mViewportList.end(); } //----------------------------------------------------------------------- - bool RenderTarget::isActive() const - { - return mActive; - } - //----------------------------------------------------------------------- - void RenderTarget::setActive( bool state ) - { - mActive = state; - } - //----------------------------------------------------------------------- void RenderTarget::fireViewportPreUpdate(Viewport* vp) { RenderTargetViewportEvent evt; @@ -504,27 +443,6 @@ namespace Ogre { } } //----------------------------------------------------------------------- - void RenderTarget::setAutoUpdated(bool autoup) - { - mAutoUpdate = autoup; - } - //----------------------------------------------------------------------- - bool RenderTarget::isAutoUpdated(void) const - { - return mAutoUpdate; - } - //----------------------------------------------------------------------- - bool RenderTarget::isPrimary(void) const - { - // RenderWindow will override and return true for the primary window - return false; - } - //----------------------------------------------------------------------- - bool RenderTarget::isStereoEnabled(void) const - { - return mStereoEnabled; - } - //----------------------------------------------------------------------- void RenderTarget::update(bool swap) { GpuEventScope profileScope(mName); diff --git a/OgreMain/src/OgreRoot.cpp b/OgreMain/src/OgreRoot.cpp index 7100c333e70..8d759fa42fb 100644 --- a/OgreMain/src/OgreRoot.cpp +++ b/OgreMain/src/OgreRoot.cpp @@ -305,14 +305,12 @@ namespace Ogre { of << "Render System=" << std::endl; } - for (auto *rs : getAvailableRenderers()) + for (const auto& r : getAvailableRenderers()) { of << std::endl; - of << "[" << rs->getName() << "]" << std::endl; - const ConfigOptionMap& opts = rs->getConfigOptions(); - for (ConfigOptionMap::const_iterator pOpt = opts.begin(); pOpt != opts.end(); ++pOpt) - { - of << pOpt->first << "=" << pOpt->second.currentValue << std::endl; + of << "[" << r->getName() << "]" << std::endl; + for (const auto& o : r->getConfigOptions()) { + of << o.first << "=" << o.second.currentValue << std::endl; } } diff --git a/OgreMain/src/OgreTexture.cpp b/OgreMain/src/OgreTexture.cpp index 7468105aded..17eedd41829 100644 --- a/OgreMain/src/OgreTexture.cpp +++ b/OgreMain/src/OgreTexture.cpp @@ -376,7 +376,7 @@ namespace Ogre { } } } - const HardwarePixelBufferSharedPtr& Texture::getBuffer(size_t face, size_t mipmap) + const HardwarePixelBufferSharedPtr& Texture::getBuffer(size_t face, size_t mipmap) const { OgreAssert(face < getNumFaces(), "out of range"); OgreAssert(mipmap <= mNumMipmaps, "out of range"); @@ -394,7 +394,7 @@ namespace Ogre { for (uint32 face = 0; face < getNumFaces(); ++face) { - for (uint32 mip = 0; mip < numMips; ++mip) + for (uint32 mip = 0; mip <= numMips; ++mip) { getBuffer(face, mip)->blitToMemory(destImage.getPixelBox(face, mip)); } diff --git a/OgreMain/src/OgreViewport.cpp b/OgreMain/src/OgreViewport.cpp index ea73bda4741..baa8f42eafd 100644 --- a/OgreMain/src/OgreViewport.cpp +++ b/OgreMain/src/OgreViewport.cpp @@ -30,10 +30,10 @@ THE SOFTWARE. namespace Ogre { //--------------------------------------------------------------------- - Viewport::Viewport(Camera* cam, RenderTarget* target, float left, float top, float width, float height, int ZOrder) + Viewport::Viewport(Camera* cam, RenderTarget* target, FloatRect relRect, int ZOrder) : mCamera(cam) , mTarget(target) - , mRelRect(left, top, left + width, top + height) + , mRelRect(relRect) // Actual dimensions will update later , mZOrder(ZOrder) , mBackColour(ColourValue::Black) diff --git a/PlugIns/GLSLang/CMakeLists.txt b/PlugIns/GLSLang/CMakeLists.txt index bfe03d9b8ac..17844605ccd 100644 --- a/PlugIns/GLSLang/CMakeLists.txt +++ b/PlugIns/GLSLang/CMakeLists.txt @@ -19,7 +19,11 @@ elseif(DEFINED ENV{VULKAN_SDK}) target_link_directories(Plugin_GLSLangProgramManager PUBLIC $ENV{VULKAN_SDK}/lib) target_link_libraries(Plugin_GLSLangProgramManager PUBLIC OgreMain shaderc_combined) else() - set(GLSLANG_LIBS glslang OSDependent SPIRV SPIRV-Tools-opt SPIRV-Tools) + set(GLSLANG_LIBS glslang SPIRV SPIRV-Tools-opt SPIRV-Tools) + find_library(GLSLANG_OSDependent OSDependent) + if(GLSLANG_OSDependent) + set(GLSLANG_LIBS ${GLSLANG_LIBS} ${GLSLANG_OSDependent}) + endif() find_library(GLSLANG_HLSL HLSL) if(GLSLANG_HLSL) set(GLSLANG_LIBS ${GLSLANG_LIBS} ${GLSLANG_HLSL}) diff --git a/README.md b/README.md index f283422736e..631b02ea895 100644 --- a/README.md +++ b/README.md @@ -57,7 +57,7 @@ For an exhaustive list, see the [features page](http://www.ogre3d.org/about/feat ## Who is using it? **Open Source** -- [Stunt Rally - 3D Racing Game with Track Editor](https://stuntrally.tuxfamily.org/) +- [Stunt Rally 2.x - 3D Racing Game with Track Editor](https://github.com/stuntrally/stuntrally/) - [Rigs of Rods - Soft Body Physics Simulator](https://rigsofrods.org/) - [Gazebo - Robot simulation](http://gazebosim.org/) - [OpenCV OVIS visualization module](https://docs.opencv.org/master/d2/d17/group__ovis.html) diff --git a/RenderSystems/Direct3D11/include/OgreD3D11Texture.h b/RenderSystems/Direct3D11/include/OgreD3D11Texture.h index 4a3bd9fe49d..c9cc52b4f63 100644 --- a/RenderSystems/Direct3D11/include/OgreD3D11Texture.h +++ b/RenderSystems/Direct3D11/include/OgreD3D11Texture.h @@ -94,6 +94,8 @@ namespace Ogre { void _create1DTex(); /// internal method, create a blank normal 2D texture void _create2DTex(); + /// internal method to create a normal 2D texture with an already existing surface + void _createShared2DTex(); /// internal method, create a blank cube texture void _create3DTex(); @@ -108,6 +110,8 @@ namespace Ogre { /// mipmap level. This method must be called after the D3D texture object was created void _createSurfaceList(void); + void _setD3D11Surface(void* surface) override; + void notifyDeviceLost(D3D11Device* device); void notifyDeviceRestored(D3D11Device* device); @@ -128,6 +132,8 @@ namespace Ogre { D3D11_SHADER_RESOURCE_VIEW_DESC mSRVDesc; bool mAutoMipMapGeneration; + + void* mSurface = NULL; }; /// RenderTexture implementation for D3D11 diff --git a/RenderSystems/Direct3D11/src/OgreD3D11HLSLProgram.cpp b/RenderSystems/Direct3D11/src/OgreD3D11HLSLProgram.cpp index 81873bd2a0e..f9bf41dedc5 100644 --- a/RenderSystems/Direct3D11/src/OgreD3D11HLSLProgram.cpp +++ b/RenderSystems/Direct3D11/src/OgreD3D11HLSLProgram.cpp @@ -317,7 +317,7 @@ namespace Ogre { mEntryPoint.c_str(), // [in] Name of the shader-entrypoint function where shader execution begins. target, // [in] A string that specifies the shader model; can be any profile in shader model 4 or higher. compileFlags, // [in] Effect compile flags - no D3DCOMPILE_ENABLE_BACKWARDS_COMPATIBILITY at the first try... - NULL, // [in] Effect compile flags + 0, // [in] Effect compile flags pMicroCode.GetAddressOf(),// [out] A pointer to an ID3DBlob Interface which contains the compiled shader, as well as any embedded debug and symbol-table information. errors.GetAddressOf() // [out] A pointer to an ID3DBlob Interface which contains a listing of errors and warnings that occurred during compilation. These errors and warnings are identical to the the debug output from a debugger. ); diff --git a/RenderSystems/Direct3D11/src/OgreD3D11MultiRenderTarget.cpp b/RenderSystems/Direct3D11/src/OgreD3D11MultiRenderTarget.cpp index d672abb0645..30e35a6cacc 100644 --- a/RenderSystems/Direct3D11/src/OgreD3D11MultiRenderTarget.cpp +++ b/RenderSystems/Direct3D11/src/OgreD3D11MultiRenderTarget.cpp @@ -66,10 +66,7 @@ namespace Ogre if(mRenderTargets[y]->getWidth() != target->getWidth() || mRenderTargets[y]->getHeight() != target->getHeight()) { - OGRE_EXCEPT(Exception::ERR_INVALIDPARAMS, - "MultiRenderTarget surfaces are not of same size", - "D3D11MultiRenderTarget::bindSurface" - ); + OGRE_EXCEPT(Exception::ERR_INVALIDPARAMS, "MultiRenderTarget surfaces are not of same size"); } } diff --git a/RenderSystems/Direct3D11/src/OgreD3D11RenderSystem.cpp b/RenderSystems/Direct3D11/src/OgreD3D11RenderSystem.cpp index 30ea7235d40..815b34c2061 100644 --- a/RenderSystems/Direct3D11/src/OgreD3D11RenderSystem.cpp +++ b/RenderSystems/Direct3D11/src/OgreD3D11RenderSystem.cpp @@ -2518,7 +2518,7 @@ namespace Ogre { 4, 0 }, // MSAA 4x { 2, 0 }, // MSAA 2x { 1, 0 }, // MSAA 1x - { NULL }, + { 0 }, }; // Find matching AA mode diff --git a/RenderSystems/Direct3D11/src/OgreD3D11RenderWindow.cpp b/RenderSystems/Direct3D11/src/OgreD3D11RenderWindow.cpp index 6c8108b239e..f49c6f3503d 100644 --- a/RenderSystems/Direct3D11/src/OgreD3D11RenderWindow.cpp +++ b/RenderSystems/Direct3D11/src/OgreD3D11RenderWindow.cpp @@ -812,7 +812,7 @@ namespace Ogre _createSwapChain(); _createSizeDependedD3DResources(); - mDevice.GetDXGIFactory()->MakeWindowAssociation(mHWnd, NULL); + mDevice.GetDXGIFactory()->MakeWindowAssociation(mHWnd, 0); setHidden(mHidden); D3D11RenderSystem* rsys = static_cast(Root::getSingleton().getRenderSystem()); @@ -834,7 +834,7 @@ namespace Ogre void D3D11RenderWindowHwnd::notifyDeviceRestored(D3D11Device* device) { D3D11RenderWindowSwapChainBased::notifyDeviceRestored(device); - mDevice.GetDXGIFactory()->MakeWindowAssociation(mHWnd, NULL); + mDevice.GetDXGIFactory()->MakeWindowAssociation(mHWnd, 0); } //--------------------------------------------------------------------- HRESULT D3D11RenderWindowHwnd::_createSwapChainImpl(IDXGIDeviceN* pDXGIDevice) diff --git a/RenderSystems/Direct3D11/src/OgreD3D11Texture.cpp b/RenderSystems/Direct3D11/src/OgreD3D11Texture.cpp index f4635e9fdde..2100bf38ddc 100644 --- a/RenderSystems/Direct3D11/src/OgreD3D11Texture.cpp +++ b/RenderSystems/Direct3D11/src/OgreD3D11Texture.cpp @@ -233,6 +233,11 @@ namespace Ogre //--------------------------------------------------------------------- void D3D11Texture::_create2DTex() { + if (mSurface) + { + _createShared2DTex(); + return; + } // we must have those defined here assert(mSrcWidth > 0 || mSrcHeight > 0); @@ -304,6 +309,89 @@ namespace Ogre _create2DResourceView(); } //---------------------------------------------------------------------------- + void D3D11Texture::_createShared2DTex() + { + HRESULT hr = S_OK; + + IUnknown* pUnk = (IUnknown*)mSurface; + + IDXGIResource* pDXGIResource; + hr = pUnk->QueryInterface(__uuidof(IDXGIResource), (void**)&pDXGIResource); + if (FAILED(hr)) + { + this->unloadImpl(); + OGRE_EXCEPT_EX(Exception::ERR_RENDERINGAPI_ERROR, hr, + "Error creating texture\nError Description: Failed to query IDXGIResource interface from " + "the provided object.", + "D3D11Texture::_create2DTex"); + } + + HANDLE sharedHandle; + hr = pDXGIResource->GetSharedHandle(&sharedHandle); + if (FAILED(hr)) + { + this->unloadImpl(); + OGRE_EXCEPT_EX(Exception::ERR_RENDERINGAPI_ERROR, hr, + "Error creating texture\nError Description: Failed to retrieve the shared handle from " + "IDXGIResource. Ensure the resource was " + "created with the D3D11_RESOURCE_MISC_SHARED flag.", + "D3D11Texture::_create2DTex"); + } + + pDXGIResource->Release(); + + IUnknown* tempResource11; + hr = mDevice->OpenSharedResource(sharedHandle, __uuidof(ID3D11Resource), (void**)(&tempResource11)); + if (FAILED(hr)) + { + this->unloadImpl(); + OGRE_EXCEPT_EX(Exception::ERR_RENDERINGAPI_ERROR, hr, + "Error creating texture\nError Description: Failed to open shared resource using the shared " + "handle. Ensure the handle is " + "valid and the device supports shared resources.", + "D3D11Texture::_create2DTex"); + } + + ID3D11Texture2D* pOutputResource; + hr = tempResource11->QueryInterface(__uuidof(ID3D11Texture2D), (void**)(&pOutputResource)); + if (FAILED(hr)) + { + this->unloadImpl(); + OGRE_EXCEPT_EX(Exception::ERR_RENDERINGAPI_ERROR, hr, + "Error creating texture\nError Description: Failed to query ID3D11Texture2D interface from " + "the shared resource. Ensure the " + "resource is of the correct type.", + "D3D11Texture::_create2DTex"); + } + tempResource11->Release(); + + mp2DTex = pOutputResource; + + D3D11_TEXTURE2D_DESC desc; + mp2DTex->GetDesc(&desc); + + D3D11_RENDER_TARGET_VIEW_DESC rtDesc; + rtDesc.Format = DXGI_FORMAT_B8G8R8A8_UNORM; + rtDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2D; + rtDesc.Texture2D.MipSlice = 0; + + ComPtr renderTargetView; + hr = mDevice->CreateRenderTargetView(mp2DTex.Get(), nullptr, renderTargetView.GetAddressOf()); + if (FAILED(hr)) + { + this->unloadImpl(); + OGRE_EXCEPT_EX(Exception::ERR_RENDERINGAPI_ERROR, hr, + "Error creating texture\nError Description: Failed to create ID3D11RenderTargetView. Verify " + "that the texture is valid, " + "properly initialized, and compatible with RenderTargetView creation.", + "D3D11Texture::_create2DTex"); + } + + _queryInterface(mp2DTex, &mpTex); + + _create2DResourceView(); + } + //---------------------------------------------------------------------------- void D3D11Texture::_create2DResourceView() { // set final tex. attributes from tex. description @@ -506,6 +594,8 @@ namespace Ogre } } //--------------------------------------------------------------------- + void D3D11Texture ::_setD3D11Surface(void* surface) { mSurface = surface; } + //--------------------------------------------------------------------- // D3D11RenderTexture //--------------------------------------------------------------------- void D3D11RenderTexture::rebind( D3D11HardwarePixelBuffer *buffer ) diff --git a/RenderSystems/Direct3D9/src/OgreD3D9GpuProgram.cpp b/RenderSystems/Direct3D9/src/OgreD3D9GpuProgram.cpp index 1db0c8b70a3..06ff36aa2c9 100644 --- a/RenderSystems/Direct3D9/src/OgreD3D9GpuProgram.cpp +++ b/RenderSystems/Direct3D9/src/OgreD3D9GpuProgram.cpp @@ -148,7 +148,7 @@ namespace Ogre { // find & load source code DataStreamPtr stream = ResourceGroupManager::getSingleton().openResource( - mFilename, mGroup, true, this); + mFilename, mGroup, this); mSource = stream->getAsString(); } diff --git a/RenderSystems/Direct3D9/src/OgreD3D9MultiRenderTarget.cpp b/RenderSystems/Direct3D9/src/OgreD3D9MultiRenderTarget.cpp index 4a6e4fdfc79..a41ce7caf91 100755 --- a/RenderSystems/Direct3D9/src/OgreD3D9MultiRenderTarget.cpp +++ b/RenderSystems/Direct3D9/src/OgreD3D9MultiRenderTarget.cpp @@ -70,21 +70,15 @@ namespace Ogre if (mRenderTargets[y]->getWidth() != buffer->getWidth() || mRenderTargets[y]->getHeight() != buffer->getHeight()) { - OGRE_EXCEPT( - Exception::ERR_INVALIDPARAMS, - "MultiRenderTarget surfaces are not of same size", - "D3D9MultiRenderTarget::bindSurface"); + OGRE_EXCEPT(Exception::ERR_INVALIDPARAMS, "MultiRenderTarget surfaces are not of same size"); } if (Root::getSingleton().getRenderSystem()->getCapabilities()->hasCapability(RSC_MRT_SAME_BIT_DEPTHS) && (PixelUtil::getNumElemBits(mRenderTargets[y]->getFormat()) != PixelUtil::getNumElemBits(buffer->getFormat()))) { - OGRE_EXCEPT( - Exception::ERR_INVALIDPARAMS, - "MultiRenderTarget surfaces are not of same bit depth and hardware requires it", - "D3D9MultiRenderTarget::bindSurface" - ); + OGRE_EXCEPT(Exception::ERR_INVALIDPARAMS, + "MultiRenderTarget surfaces are not of same bit depth and hardware requires it"); } } diff --git a/RenderSystems/GL/include/OgreGLFBOMultiRenderTarget.h b/RenderSystems/GL/include/OgreGLFBOMultiRenderTarget.h index 115f9dec2d8..54cb742fe27 100644 --- a/RenderSystems/GL/include/OgreGLFBOMultiRenderTarget.h +++ b/RenderSystems/GL/include/OgreGLFBOMultiRenderTarget.h @@ -48,7 +48,6 @@ namespace Ogre { /// Override so we can attach the depth buffer to the FBO bool attachDepthBuffer( DepthBuffer *depthBuffer ) override; - void detachDepthBuffer() override; void _detachDepthBuffer() override; private: void bindSurfaceImpl(size_t attachment, RenderTexture *target) override; diff --git a/RenderSystems/GL/include/OgreGLFBORenderTexture.h b/RenderSystems/GL/include/OgreGLFBORenderTexture.h index b7cf7f3a310..ff5b94c7851 100644 --- a/RenderSystems/GL/include/OgreGLFBORenderTexture.h +++ b/RenderSystems/GL/include/OgreGLFBORenderTexture.h @@ -53,7 +53,6 @@ namespace Ogre { /// Override so we can attach the depth buffer to the FBO bool attachDepthBuffer( DepthBuffer *depthBuffer ) override; - void detachDepthBuffer() override; void _detachDepthBuffer() override; GLContext* getContext() const override { return mFB.getContext(); } diff --git a/RenderSystems/GL/src/OgreGLFBOMultiRenderTarget.cpp b/RenderSystems/GL/src/OgreGLFBOMultiRenderTarget.cpp index 6d7ae6bbc98..6982ce3cbd9 100755 --- a/RenderSystems/GL/src/OgreGLFBOMultiRenderTarget.cpp +++ b/RenderSystems/GL/src/OgreGLFBOMultiRenderTarget.cpp @@ -83,12 +83,6 @@ namespace Ogre { return result; } //----------------------------------------------------------------------------- - void GLFBOMultiRenderTarget::detachDepthBuffer() - { - fbo.detachDepthBuffer(); - MultiRenderTarget::detachDepthBuffer(); - } - //----------------------------------------------------------------------------- void GLFBOMultiRenderTarget::_detachDepthBuffer() { fbo.detachDepthBuffer(); diff --git a/RenderSystems/GL/src/OgreGLFBORenderTexture.cpp b/RenderSystems/GL/src/OgreGLFBORenderTexture.cpp index 30ff221434b..f559646cab7 100644 --- a/RenderSystems/GL/src/OgreGLFBORenderTexture.cpp +++ b/RenderSystems/GL/src/OgreGLFBORenderTexture.cpp @@ -83,12 +83,6 @@ namespace Ogre { return result; } //----------------------------------------------------------------------------- - void GLFBORenderTexture::detachDepthBuffer() - { - mFB.detachDepthBuffer(); - GLRenderTexture::detachDepthBuffer(); - } - //----------------------------------------------------------------------------- void GLFBORenderTexture::_detachDepthBuffer() { mFB.detachDepthBuffer(); diff --git a/RenderSystems/GL3Plus/include/OgreGL3PlusFBOMultiRenderTarget.h b/RenderSystems/GL3Plus/include/OgreGL3PlusFBOMultiRenderTarget.h index e98968aabe1..6329c0cc483 100644 --- a/RenderSystems/GL3Plus/include/OgreGL3PlusFBOMultiRenderTarget.h +++ b/RenderSystems/GL3Plus/include/OgreGL3PlusFBOMultiRenderTarget.h @@ -51,7 +51,6 @@ namespace Ogre { /// Override so we can attach the depth buffer to the FBO bool attachDepthBuffer( DepthBuffer *depthBuffer ) override; - void detachDepthBuffer() override; void _detachDepthBuffer() override; private: void bindSurfaceImpl(size_t attachment, RenderTexture *target) override; diff --git a/RenderSystems/GL3Plus/include/OgreGL3PlusFBORenderTexture.h b/RenderSystems/GL3Plus/include/OgreGL3PlusFBORenderTexture.h index ea9a03636f2..3ec95d73e9b 100644 --- a/RenderSystems/GL3Plus/include/OgreGL3PlusFBORenderTexture.h +++ b/RenderSystems/GL3Plus/include/OgreGL3PlusFBORenderTexture.h @@ -51,7 +51,6 @@ namespace Ogre { /// Override so we can attach the depth buffer to the FBO bool attachDepthBuffer( DepthBuffer *depthBuffer ) override; - void detachDepthBuffer() override; void _detachDepthBuffer() override; GLContext* getContext() const override { return mFB.getContext(); } diff --git a/RenderSystems/GL3Plus/src/OgreGL3PlusFBOMultiRenderTarget.cpp b/RenderSystems/GL3Plus/src/OgreGL3PlusFBOMultiRenderTarget.cpp index 64af8cc112e..aec5d30ea8e 100644 --- a/RenderSystems/GL3Plus/src/OgreGL3PlusFBOMultiRenderTarget.cpp +++ b/RenderSystems/GL3Plus/src/OgreGL3PlusFBOMultiRenderTarget.cpp @@ -82,12 +82,6 @@ namespace Ogre { return result; } - void GL3PlusFBOMultiRenderTarget::detachDepthBuffer() - { - fbo.detachDepthBuffer(); - MultiRenderTarget::detachDepthBuffer(); - } - void GL3PlusFBOMultiRenderTarget::_detachDepthBuffer() { fbo.detachDepthBuffer(); diff --git a/RenderSystems/GL3Plus/src/OgreGL3PlusFBORenderTexture.cpp b/RenderSystems/GL3Plus/src/OgreGL3PlusFBORenderTexture.cpp index 0f9c7d53c92..fdcec860628 100644 --- a/RenderSystems/GL3Plus/src/OgreGL3PlusFBORenderTexture.cpp +++ b/RenderSystems/GL3Plus/src/OgreGL3PlusFBORenderTexture.cpp @@ -85,12 +85,6 @@ namespace Ogre { return result; } - void GL3PlusFBORenderTexture::detachDepthBuffer() - { - mFB.detachDepthBuffer(); - GLRenderTexture::detachDepthBuffer(); - } - void GL3PlusFBORenderTexture::_detachDepthBuffer() { mFB.detachDepthBuffer(); diff --git a/RenderSystems/GL3Plus/src/OgreGL3PlusTextureBuffer.cpp b/RenderSystems/GL3Plus/src/OgreGL3PlusTextureBuffer.cpp index 1c5d590f41f..6973db40bd2 100644 --- a/RenderSystems/GL3Plus/src/OgreGL3PlusTextureBuffer.cpp +++ b/RenderSystems/GL3Plus/src/OgreGL3PlusTextureBuffer.cpp @@ -469,7 +469,7 @@ namespace Ogre { mTextureID, mLevel)); break; case GL_TEXTURE_CUBE_MAP: - OGRE_CHECK_GL_ERROR(glFramebufferTexture2D(which, GL_COLOR_ATTACHMENT0, + OGRE_CHECK_GL_ERROR(glFramebufferTexture2D(which, attachment, mFaceTarget, mTextureID, mLevel)); break; case GL_TEXTURE_3D: diff --git a/RenderSystems/GLES2/include/OgreGLES2FBOMultiRenderTarget.h b/RenderSystems/GLES2/include/OgreGLES2FBOMultiRenderTarget.h index f3f7dce81ce..9fc31f2e86d 100644 --- a/RenderSystems/GLES2/include/OgreGLES2FBOMultiRenderTarget.h +++ b/RenderSystems/GLES2/include/OgreGLES2FBOMultiRenderTarget.h @@ -51,7 +51,6 @@ namespace Ogre { /// Override so we can attach the depth buffer to the FBO bool attachDepthBuffer( DepthBuffer *depthBuffer ) override; - void detachDepthBuffer() override; void _detachDepthBuffer() override; private: void bindSurfaceImpl(size_t attachment, RenderTexture *target) override; diff --git a/RenderSystems/GLES2/include/OgreGLES2FBORenderTexture.h b/RenderSystems/GLES2/include/OgreGLES2FBORenderTexture.h index cc8bc96db5c..3667daa8c02 100644 --- a/RenderSystems/GLES2/include/OgreGLES2FBORenderTexture.h +++ b/RenderSystems/GLES2/include/OgreGLES2FBORenderTexture.h @@ -51,7 +51,6 @@ namespace Ogre { /// Override so we can attach the depth buffer to the FBO bool attachDepthBuffer( DepthBuffer *depthBuffer ) override; - void detachDepthBuffer() override; void _detachDepthBuffer() override; GLContext* getContext() const override { return mFB.getContext(); } diff --git a/RenderSystems/GLES2/src/OgreGLES2FBOMultiRenderTarget.cpp b/RenderSystems/GLES2/src/OgreGLES2FBOMultiRenderTarget.cpp index 6525046bc0e..1884e900c9d 100644 --- a/RenderSystems/GLES2/src/OgreGLES2FBOMultiRenderTarget.cpp +++ b/RenderSystems/GLES2/src/OgreGLES2FBOMultiRenderTarget.cpp @@ -82,12 +82,6 @@ namespace Ogre { return result; } //----------------------------------------------------------------------------- - void GLES2FBOMultiRenderTarget::detachDepthBuffer() - { - fbo.detachDepthBuffer(); - MultiRenderTarget::detachDepthBuffer(); - } - //----------------------------------------------------------------------------- void GLES2FBOMultiRenderTarget::_detachDepthBuffer() { fbo.detachDepthBuffer(); diff --git a/RenderSystems/GLES2/src/OgreGLES2FBORenderTexture.cpp b/RenderSystems/GLES2/src/OgreGLES2FBORenderTexture.cpp index 6888f06bd1b..b7f3961f17b 100644 --- a/RenderSystems/GLES2/src/OgreGLES2FBORenderTexture.cpp +++ b/RenderSystems/GLES2/src/OgreGLES2FBORenderTexture.cpp @@ -97,12 +97,6 @@ namespace Ogre { return result; } //----------------------------------------------------------------------------- - void GLES2FBORenderTexture::detachDepthBuffer() - { - mFB.detachDepthBuffer(); - GLRenderTexture::detachDepthBuffer(); - } - //----------------------------------------------------------------------------- void GLES2FBORenderTexture::_detachDepthBuffer() { mFB.detachDepthBuffer(); diff --git a/RenderSystems/GLSupport/include/OSX/OgreOSXCocoaContext.h b/RenderSystems/GLSupport/include/OSX/OgreOSXCocoaContext.h index 00e3f7eba05..56abadc20f1 100644 --- a/RenderSystems/GLSupport/include/OSX/OgreOSXCocoaContext.h +++ b/RenderSystems/GLSupport/include/OSX/OgreOSXCocoaContext.h @@ -43,17 +43,17 @@ namespace Ogre { virtual ~CocoaContext(); /** See GLContext */ - virtual void setCurrent(); + void setCurrent() override; /** * This is called before another context is made current. By default, * nothing is done here. */ - virtual void endCurrent(); + void endCurrent() override; /** Create a new context based on the same window/pbuffer as this context - mostly useful for additional threads. @note The caller is responsible for deleting the returned context. */ - virtual GLContext* clone() const; + GLContext* clone() const override; /** Grab the NSOpenGLContext if it exists */ NSOpenGLContext* getContext(); diff --git a/RenderSystems/GLSupport/include/OSX/OgreOSXCocoaWindow.h b/RenderSystems/GLSupport/include/OSX/OgreOSXCocoaWindow.h index 3ddeb923779..36d245b24fe 100644 --- a/RenderSystems/GLSupport/include/OSX/OgreOSXCocoaWindow.h +++ b/RenderSystems/GLSupport/include/OSX/OgreOSXCocoaWindow.h @@ -69,39 +69,35 @@ namespace Ogre { NSView* ogreView() const { return mView; } NSWindow* ogreWindow() const { return mWindow; } NSOpenGLContext* nsopenGLContext() const { return mGLContext; } - GLContext* getContext() const { return mContext; } + GLContext* getContext() const override { return mContext; } void createWithView(OgreGLView *view); /** @copydoc see RenderWindow::getViewPointToPixelScale */ - float getViewPointToPixelScale(); + float getViewPointToPixelScale() override; /** Overridden - see RenderWindow */ void create(const String& name, unsigned int widthPt, unsigned int heightPt, - bool fullScreen, const NameValuePairList *miscParams); + bool fullScreen, const NameValuePairList *miscParams) override; /** Overridden - see RenderWindow */ - void destroy(void); + void destroy(void) override; /** @copydoc see RenderWindow::setHidden */ - void setHidden(bool hidden); + void setHidden(bool hidden) override; /** @copydoc see RenderWindow::setVSyncEnabled */ - void setVSyncEnabled(bool vsync); + void setVSyncEnabled(bool vsync) override; /** Overridden - see RenderWindow */ - void reposition(int leftPt, int topPt); + void reposition(int leftPt, int topPt) override; /** Overridden - see RenderWindow */ - void resize(unsigned int widthPt, unsigned int heightPt); + void resize(unsigned int widthPt, unsigned int heightPt) override; /** Overridden - see RenderWindow */ - void swapBuffers(); + void swapBuffers() override; /** Overridden - see RenderWindow */ - virtual void setFullscreen(bool fullScreen, unsigned int widthPt, unsigned int heightPt); + void setFullscreen(bool fullScreen, unsigned int widthPt, unsigned int heightPt) override; /** Overridden - see RenderWindow */ - virtual unsigned int getWidth(void) const; - /** Overridden - see RenderWindow */ - virtual unsigned int getHeight(void) const; - /** Overridden - see RenderWindow */ - void windowMovedOrResized(void); + void windowMovedOrResized(void) override; void windowHasResized(void); void createNewWindow(unsigned int width, unsigned int height, String title); void createWindowFromExternal(NSView *viewRef); - void getCustomAttribute( const String& name, void* pData ); + void getCustomAttribute( const String& name, void* pData ) override; }; } diff --git a/RenderSystems/GLSupport/include/OSX/OgreOSXGLSupport.h b/RenderSystems/GLSupport/include/OSX/OgreOSXGLSupport.h index 3426d41a123..05865b9f0c8 100644 --- a/RenderSystems/GLSupport/include/OSX/OgreOSXGLSupport.h +++ b/RenderSystems/GLSupport/include/OSX/OgreOSXGLSupport.h @@ -41,26 +41,26 @@ class OSXGLSupport : public GLNativeSupport OSXGLSupport(int profile) : GLNativeSupport(profile) {} ~OSXGLSupport() {} - ConfigOptionMap getConfigOptions(); + ConfigOptionMap getConfigOptions() override; /// @copydoc RenderSystem::createRenderWindow - virtual RenderWindow* newWindow( const String &name, unsigned int width, unsigned int height, - bool fullScreen, const NameValuePairList *miscParams = 0 ); + RenderWindow* newWindow( const String &name, unsigned int width, unsigned int height, + bool fullScreen, const NameValuePairList *miscParams = 0 ) override; /** * Start anything special */ - void start(); + void start() override; /** * Stop anything special */ - void stop(); + void stop() override; /** * Get the address of a function */ - void* getProcAddress( const char *name ) const; + void* getProcAddress( const char *name ) const override; // Core Foundation Array callback function for sorting, must be static for the function ptr static CFComparisonResult _compareModes (const void *val1, const void *val2, void *context); diff --git a/RenderSystems/GLSupport/src/OSX/OgreOSXCocoaWindow.mm b/RenderSystems/GLSupport/src/OSX/OgreOSXCocoaWindow.mm index 269a2a177ed..1e45bfaef1e 100644 --- a/RenderSystems/GLSupport/src/OSX/OgreOSXCocoaWindow.mm +++ b/RenderSystems/GLSupport/src/OSX/OgreOSXCocoaWindow.mm @@ -407,24 +407,6 @@ - (BOOL)acceptsFirstResponder LogManager::getSingleton().logMessage(ss.str()); } - unsigned int CocoaWindow::getWidth() const - { - // keep mWidth in sync with reality - OgreAssertDbg(mView == nil || int(mWidth) == _getPixelFromPoint([mView frame].size.width), - "Window dimension mismatch. Did you call windowMovedOrResized?"); - - return mWidth; - } - - unsigned int CocoaWindow::getHeight() const - { - // keep mHeight in sync with reality - OgreAssertDbg(mView == nil || int(mHeight) == _getPixelFromPoint([mView frame].size.height), - "Window dimension mismatch. Did you call windowMovedOrResized?"); - - return mHeight; - } - void CocoaWindow::destroy(void) { if(!mIsFullScreen) diff --git a/RenderSystems/Metal/include/OgreMetalDepthBuffer.h b/RenderSystems/Metal/include/OgreMetalDepthBuffer.h index 0586fa851fc..e9e57707e72 100644 --- a/RenderSystems/Metal/include/OgreMetalDepthBuffer.h +++ b/RenderSystems/Metal/include/OgreMetalDepthBuffer.h @@ -53,7 +53,7 @@ namespace Ogre virtual ~MetalDepthBuffer(); /// @copydoc DepthBuffer::isCompatible - virtual bool isCompatible( RenderTarget *renderTarget) const; + bool isCompatible( RenderTarget *renderTarget) const override; MetalDevice* getOwnerDevice(void) const { return mDevice; } diff --git a/RenderSystems/Metal/include/OgreMetalHardwareBufferManager.h b/RenderSystems/Metal/include/OgreMetalHardwareBufferManager.h index 420f6e5deff..590c2bffab0 100644 --- a/RenderSystems/Metal/include/OgreMetalHardwareBufferManager.h +++ b/RenderSystems/Metal/include/OgreMetalHardwareBufferManager.h @@ -47,13 +47,13 @@ namespace Ogre { void _notifyDeviceStalled(void); /// Creates a vertex buffer - virtual HardwareVertexBufferSharedPtr createVertexBuffer( size_t vertexSize, size_t numVerts, + HardwareVertexBufferSharedPtr createVertexBuffer( size_t vertexSize, size_t numVerts, HardwareBuffer::Usage usage, - bool useShadowBuffer = false ); + bool useShadowBuffer = false ) override; /// Create an index buffer - virtual HardwareIndexBufferSharedPtr createIndexBuffer( + HardwareIndexBufferSharedPtr createIndexBuffer( HardwareIndexBuffer::IndexType itype, size_t numIndexes, - HardwareBuffer::Usage usage, bool useShadowBuffer = false ); + HardwareBuffer::Usage usage, bool useShadowBuffer = false ) override; }; } diff --git a/RenderSystems/Metal/include/OgreMetalHardwarePixelBuffer.h b/RenderSystems/Metal/include/OgreMetalHardwarePixelBuffer.h index 33527faf0c4..fe4fda233a6 100644 --- a/RenderSystems/Metal/include/OgreMetalHardwarePixelBuffer.h +++ b/RenderSystems/Metal/include/OgreMetalHardwarePixelBuffer.h @@ -39,10 +39,10 @@ namespace Ogre { { protected: /// Lock a box - PixelBox lockImpl(const Box &lockBox, LockOptions options); + PixelBox lockImpl(const Box &lockBox, LockOptions options) override; /// Unlock a box - void unlockImpl(void); + void unlockImpl(void) override; // Internal buffer; either on-card or in system memory, freed/allocated on demand // depending on buffer usage @@ -68,10 +68,10 @@ namespace Ogre { HardwareBuffer::Usage usage ); /// @copydoc HardwarePixelBuffer::blitFromMemory - void blitFromMemory(const PixelBox &src, const Box &dstBox); + void blitFromMemory(const PixelBox &src, const Box &dstBox) override; /// @copydoc HardwarePixelBuffer::blitToMemory - void blitToMemory(const Box &srcBox, const PixelBox &dst); + void blitToMemory(const Box &srcBox, const PixelBox &dst) override; virtual ~MetalHardwarePixelBuffer(); @@ -94,16 +94,16 @@ namespace Ogre { bool writeGamma, uint fsaa ); virtual ~MetalTextureBuffer(); - virtual void bindToFramebuffer(uint32 attachment, size_t zoffset); + void bindToFramebuffer(uint32 attachment, size_t zoffset) override; /// Upload a box of pixels to this buffer on the card - virtual void upload(const PixelBox &data, const Box &dest); + void upload(const PixelBox &data, const Box &dest) override; /// Download a box of pixels from the card - virtual void download(const PixelBox &data); + void download(const PixelBox &data) override; /// Hardware implementation of blitFromMemory - virtual void blitFromMemory(const PixelBox &src_orig, const Box &dstBox); + void blitFromMemory(const PixelBox &src_orig, const Box &dstBox) override; /// Lock a box // PixelBox lockImpl(const Box &lockBox, LockOptions options) { return PixelBox(); } @@ -113,7 +113,7 @@ namespace Ogre { /// @copydoc HardwarePixelBuffer::blit void blit( const HardwarePixelBufferSharedPtr &src, - const Box &srcBox, const Box &dstBox ); + const Box &srcBox, const Box &dstBox ) override; // Blitting implementation void blitFromTexture( MetalTextureBuffer *src, const Box &srcBox, const Box &dstBox ); diff --git a/RenderSystems/Metal/include/OgreMetalMultiRenderTarget.h b/RenderSystems/Metal/include/OgreMetalMultiRenderTarget.h index a3cd746ce14..90f717541a7 100644 --- a/RenderSystems/Metal/include/OgreMetalMultiRenderTarget.h +++ b/RenderSystems/Metal/include/OgreMetalMultiRenderTarget.h @@ -45,12 +45,12 @@ namespace Ogre virtual ~MetalMultiRenderTarget(); // MultiRenderTarget overloads. - virtual void bindSurfaceImpl( size_t attachment, RenderTexture *target ); - virtual void unbindSurfaceImpl( size_t attachment ); + void bindSurfaceImpl( size_t attachment, RenderTexture *target ) override; + void unbindSurfaceImpl( size_t attachment ) override; // RenderTarget overloads. - virtual bool requiresTextureFlipping() const { return false; } - virtual void getCustomAttribute( const String& name, void *pData ); + bool requiresTextureFlipping() const override { return false; } + void getCustomAttribute( const String& name, void *pData ) override; }; } diff --git a/RenderSystems/Metal/include/OgreMetalPlugin.h b/RenderSystems/Metal/include/OgreMetalPlugin.h index f59509b77be..b793e0dcd88 100644 --- a/RenderSystems/Metal/include/OgreMetalPlugin.h +++ b/RenderSystems/Metal/include/OgreMetalPlugin.h @@ -42,19 +42,19 @@ namespace Ogre /// @copydoc Plugin::getName - const String& getName() const; + const String& getName() const override; /// @copydoc Plugin::install - void install(); + void install() override; /// @copydoc Plugin::initialise - void initialise(); + void initialise() override; /// @copydoc Plugin::shutdown - void shutdown(); + void shutdown() override; /// @copydoc Plugin::uninstall - void uninstall(); + void uninstall() override; protected: MetalRenderSystem* mRenderSystem; }; diff --git a/RenderSystems/Metal/include/OgreMetalProgram.h b/RenderSystems/Metal/include/OgreMetalProgram.h index e53450a528a..82ad1c6cb70 100644 --- a/RenderSystems/Metal/include/OgreMetalProgram.h +++ b/RenderSystems/Metal/include/OgreMetalProgram.h @@ -60,8 +60,8 @@ namespace Ogre class CmdShaderReflectionPairHint : public ParamCommand { public: - String doGet(const void* target) const; - void doSet(void* target, const String& val); + String doGet(const void* target) const override; + void doSet(void* target, const String& val) override; }; MetalProgram( ResourceManager* creator, const String& name, ResourceHandle handle, @@ -82,9 +82,9 @@ namespace Ogre const String& getShaderReflectionPairHint(void) const { return mShaderReflectionPairHint; } /// Overridden from GpuProgram - const String& getLanguage(void) const; + const String& getLanguage(void) const override; /// Overridden from GpuProgram - GpuProgramParametersSharedPtr createParameters(void); + GpuProgramParametersSharedPtr createParameters(void) override; /// Retrieve the Metal function object id getMetalFunction(void) const { return mFunction; } @@ -106,13 +106,13 @@ namespace Ogre /** Internal load implementation, must be implemented by subclasses. */ - void loadFromSource(void); + void loadFromSource(void) override; /// noop - void createLowLevelImpl(void) {} + void createLowLevelImpl(void) override {} /// shortcut as we there is no low-level separation here - GpuProgram* _getBindingDelegate(void) { return this; } + GpuProgram* _getBindingDelegate(void) override { return this; } /// Internal unload implementation, must be implemented by subclasses - void unloadHighLevelImpl(void); + void unloadHighLevelImpl(void) override; /// Populate the passed parameters with name->index map, must be overridden void buildConstantDefinitions(void) override; diff --git a/RenderSystems/Metal/include/OgreMetalProgramFactory.h b/RenderSystems/Metal/include/OgreMetalProgramFactory.h index 6c41732e434..6873f4862b9 100644 --- a/RenderSystems/Metal/include/OgreMetalProgramFactory.h +++ b/RenderSystems/Metal/include/OgreMetalProgramFactory.h @@ -48,11 +48,11 @@ namespace Ogre MetalProgramFactory( MetalDevice *device ); virtual ~MetalProgramFactory(void); /// Get the name of the language this factory creates programs for - const String& getLanguage(void) const; + const String& getLanguage(void) const override; /// Create an instance of MetalProgram GpuProgram* create(ResourceManager* creator, const String& name, ResourceHandle handle, - const String& group, bool isManual, ManualResourceLoader* loader); + const String& group, bool isManual, ManualResourceLoader* loader) override; }; } diff --git a/RenderSystems/Metal/include/OgreMetalRenderSystem.h b/RenderSystems/Metal/include/OgreMetalRenderSystem.h index e244c148553..e2e97d70794 100644 --- a/RenderSystems/Metal/include/OgreMetalRenderSystem.h +++ b/RenderSystems/Metal/include/OgreMetalRenderSystem.h @@ -90,31 +90,31 @@ namespace Ogre std::unique_ptr mAutoParamsBuffer; public: const GpuProgramParametersPtr& getFixedFunctionParams(TrackVertexColourType tracking, - FogMode fog); - void applyFixedFunctionParams(const GpuProgramParametersPtr& params, uint16 mask); + FogMode fog) override; + void applyFixedFunctionParams(const GpuProgramParametersPtr& params, uint16 mask) override; MetalRenderSystem(); virtual ~MetalRenderSystem(); - virtual void shutdown(void); + void shutdown(void) override; - virtual const String& getName(void) const; - virtual void setConfigOption(const String &name, const String &value) {} + const String& getName(void) const override; + void setConfigOption(const String &name, const String &value) override {} - virtual HardwareOcclusionQuery* createHardwareOcclusionQuery(void); + HardwareOcclusionQuery* createHardwareOcclusionQuery(void) override; - virtual RenderSystemCapabilities* createRenderSystemCapabilities(void) const; + RenderSystemCapabilities* createRenderSystemCapabilities(void) const override; - virtual RenderWindow* _createRenderWindow( const String &name, + RenderWindow* _createRenderWindow( const String &name, unsigned int width, unsigned int height, bool fullScreen, - const NameValuePairList *miscParams = 0); + const NameValuePairList *miscParams = 0) override; - virtual MultiRenderTarget* createMultiRenderTarget(const String & name); + MultiRenderTarget* createMultiRenderTarget(const String & name) override; - virtual void _setTexture(size_t unit, bool enabled, const TexturePtr& texPtr); + void _setTexture(size_t unit, bool enabled, const TexturePtr& texPtr) override; - virtual DepthBuffer* _createDepthBufferFor( RenderTarget *renderTarget); + DepthBuffer* _createDepthBufferFor( RenderTarget *renderTarget) override; void setStencilState(const StencilState& state) override; @@ -122,51 +122,51 @@ namespace Ogre virtual void _waitForTailFrameToFinish(void); virtual bool _willTailFrameStall(void); - virtual void _beginFrame(void); - virtual void _endFrame(void); + void _beginFrame(void) override; + void _endFrame(void) override; - void setScissorTest(bool enabled, const Rect& rect); + void setScissorTest(bool enabled, const Rect& rect) override; - virtual void _setViewport(Viewport *vp); + void _setViewport(Viewport *vp) override; - void setColourBlendState(const ColourBlendState& state); + void setColourBlendState(const ColourBlendState& state) override; - void _setSampler( size_t texUnit, Sampler& s); - void _setDepthClamp(bool enable); - void _setDepthBufferParams(bool depthTest = true, bool depthWrite = true, CompareFunction depthFunction = CMPF_LESS_EQUAL); + void _setSampler( size_t texUnit, Sampler& s) override; + void _setDepthClamp(bool enable) override; + void _setDepthBufferParams(bool depthTest = true, bool depthWrite = true, CompareFunction depthFunction = CMPF_LESS_EQUAL) override; - void _setCullingMode(CullingMode mode); - void _setDepthBias(float constantBias, float slopeScaleBias = 0.0f); + void _setCullingMode(CullingMode mode) override; + void _setDepthBias(float constantBias, float slopeScaleBias = 0.0f) override; - virtual void _convertProjectionMatrix( const Matrix4& matrix, Matrix4& dest, - bool forGpuProgram = false); - void _setPolygonMode(PolygonMode level); - void _setAlphaRejectSettings(CompareFunction func, unsigned char value, bool alphaToCoverage); - virtual void _render( const RenderOperation &op ); + void _convertProjectionMatrix( const Matrix4& matrix, Matrix4& dest, + bool forGpuProgram = false) override; + void _setPolygonMode(PolygonMode level) override; + void _setAlphaRejectSettings(CompareFunction func, unsigned char value, bool alphaToCoverage) override; + void _render( const RenderOperation &op ) override; - void bindGpuProgram(GpuProgram* prg); - virtual void bindGpuProgramParameters(GpuProgramType gptype, - const GpuProgramParametersPtr& params, uint16 variabilityMask); - virtual void clearFrameBuffer(unsigned int buffers, + void bindGpuProgram(GpuProgram* prg) override; + void bindGpuProgramParameters(GpuProgramType gptype, + const GpuProgramParametersPtr& params, uint16 variabilityMask) override; + void clearFrameBuffer(unsigned int buffers, const ColourValue& colour = ColourValue::Black, - float depth = 1.0f, unsigned short stencil = 0); + float depth = 1.0f, unsigned short stencil = 0) override; - virtual Real getMinimumDepthInputValue(void); - virtual Real getMaximumDepthInputValue(void); + Real getMinimumDepthInputValue(void) override; + Real getMaximumDepthInputValue(void) override; - virtual void _setRenderTarget(RenderTarget *target); + void _setRenderTarget(RenderTarget *target) override; - virtual void beginProfileEvent( const String &eventName ); - virtual void endProfileEvent( void ); - virtual void markProfileEvent( const String &event ); + void beginProfileEvent( const String &eventName ) override; + void endProfileEvent( void ) override; + void markProfileEvent( const String &event ) override; virtual void initGPUProfiling(void); virtual void deinitGPUProfiling(void); virtual void beginGPUSampleProfile( const String &name, uint32 *hashCache ); virtual void endGPUSampleProfile( const String &name ); - virtual void initialiseFromRenderSystemCapabilities( RenderSystemCapabilities* caps, - RenderTarget* primary ); + void initialiseFromRenderSystemCapabilities( RenderSystemCapabilities* caps, + RenderTarget* primary ) override; MetalDevice* getActiveDevice(void) { return mActiveDevice; } diff --git a/RenderSystems/Metal/include/OgreMetalRenderTexture.h b/RenderSystems/Metal/include/OgreMetalRenderTexture.h index 5ccbee78edb..b0180ccf062 100644 --- a/RenderSystems/Metal/include/OgreMetalRenderTexture.h +++ b/RenderSystems/Metal/include/OgreMetalRenderTexture.h @@ -48,11 +48,11 @@ namespace Ogre uint32 fsaa, uint32 mip, bool hwGamma ); virtual ~MetalRenderTexture(); - virtual void swapBuffers(void); + void swapBuffers(void) override; // RenderTarget overloads. - virtual bool requiresTextureFlipping() const { return false; } - virtual void getCustomAttribute( const String& name, void* pData ); + bool requiresTextureFlipping() const override { return false; } + void getCustomAttribute( const String& name, void* pData ) override; }; } diff --git a/RenderSystems/Metal/include/OgreMetalRenderWindow.h b/RenderSystems/Metal/include/OgreMetalRenderWindow.h index 03f6a3a9d09..91e4117e656 100644 --- a/RenderSystems/Metal/include/OgreMetalRenderWindow.h +++ b/RenderSystems/Metal/include/OgreMetalRenderWindow.h @@ -57,23 +57,23 @@ namespace Ogre MetalRenderWindow( MetalDevice *ownerDevice, MetalRenderSystem *renderSystem ); virtual ~MetalRenderWindow(); - virtual void swapBuffers(void); - virtual void windowMovedOrResized(void); + void swapBuffers(void) override; + void windowMovedOrResized(void) override; - virtual bool nextDrawable(void); + bool nextDrawable(void) override; - virtual void create( const String& name, unsigned int width, unsigned int height, - bool fullScreen, const NameValuePairList *miscParams ); - virtual void destroy(void); + void create( const String& name, unsigned int width, unsigned int height, + bool fullScreen, const NameValuePairList *miscParams ) override; + void destroy(void) override; - virtual void resize( unsigned int width, unsigned int height ); - virtual void reposition( int left, int top ); + void resize( unsigned int width, unsigned int height ) override; + void reposition( int left, int top ) override; // RenderTarget overloads. - virtual void copyContentsToMemory(const Box& src, const PixelBox &dst, FrameBuffer buffer) {} - virtual bool requiresTextureFlipping() const { return false; } + void copyContentsToMemory(const Box& src, const PixelBox &dst, FrameBuffer buffer) override {} + bool requiresTextureFlipping() const override { return false; } - virtual void getCustomAttribute( const String& name, void* pData ); + void getCustomAttribute( const String& name, void* pData ) override; PixelFormat suggestPixelFormat() const override { return mFormat; } diff --git a/RenderSystems/Metal/include/OgreMetalTexture.h b/RenderSystems/Metal/include/OgreMetalTexture.h index c91250cd569..10e82455bf9 100644 --- a/RenderSystems/Metal/include/OgreMetalTexture.h +++ b/RenderSystems/Metal/include/OgreMetalTexture.h @@ -51,8 +51,8 @@ namespace Ogre void createMetalTexResource(void); void createSurfaceList(void); - virtual void createInternalResourcesImpl(void); - virtual void freeInternalResourcesImpl(void); + void createInternalResourcesImpl(void) override; + void freeInternalResourcesImpl(void) override; public: MetalTexture( ResourceManager* creator, const String& name, ResourceHandle handle, diff --git a/RenderSystems/Metal/include/OgreMetalTextureManager.h b/RenderSystems/Metal/include/OgreMetalTextureManager.h index 3bc858e35e1..ab7a083cdd0 100644 --- a/RenderSystems/Metal/include/OgreMetalTextureManager.h +++ b/RenderSystems/Metal/include/OgreMetalTextureManager.h @@ -51,17 +51,17 @@ namespace Ogre MetalDevice *mDevice; /// @copydoc ResourceManager::createImpl - virtual Resource* createImpl(const String& name, ResourceHandle handle, + Resource* createImpl(const String& name, ResourceHandle handle, const String& group, bool isManual, ManualResourceLoader* loader, - const NameValuePairList* createParams); + const NameValuePairList* createParams) override; - SamplerPtr _createSamplerImpl(); + SamplerPtr _createSamplerImpl() override; public: MetalTextureManager( MetalDevice *device ); virtual ~MetalTextureManager(); /// @copydoc TextureManager::getNativeFormat - virtual PixelFormat getNativeFormat(TextureType ttype, PixelFormat format, int usage); + PixelFormat getNativeFormat(TextureType ttype, PixelFormat format, int usage) override; }; } diff --git a/RenderSystems/Metal/src/OgreMetalMultiRenderTarget.mm b/RenderSystems/Metal/src/OgreMetalMultiRenderTarget.mm index bd2e677ea20..89b1bf15c8a 100644 --- a/RenderSystems/Metal/src/OgreMetalMultiRenderTarget.mm +++ b/RenderSystems/Metal/src/OgreMetalMultiRenderTarget.mm @@ -62,9 +62,7 @@ of this software and associated documentation files (the "Software"), to deal if( mWidth != target->getWidth() && mHeight != target->getHeight() && mFSAA != target->getFSAA() ) { - OGRE_EXCEPT( Exception::ERR_INVALIDPARAMS, - "MultiRenderTarget surfaces are not of same size", - "MetalMultiRenderTarget::bindSurface" ); + OGRE_EXCEPT(Exception::ERR_INVALIDPARAMS, "MultiRenderTarget surfaces are not of same size"); } } diff --git a/Samples/Common/include/Sample.h b/Samples/Common/include/Sample.h index 91664781629..898f0bdee92 100644 --- a/Samples/Common/include/Sample.h +++ b/Samples/Common/include/Sample.h @@ -67,12 +67,12 @@ namespace OgreBites } }; -#ifdef OGRE_BUILD_COMPONENT_RTSHADERSYSTEM - Sample() : mShaderGenerator(0) -#else Sample() -#endif { +#ifdef OGRE_BUILD_COMPONENT_RTSHADERSYSTEM + mShaderGenerator = Ogre::RTShader::ShaderGenerator::getSingletonPtr(); +#endif + mRoot = Ogre::Root::getSingletonPtr(); mWindow = 0; mSceneMgr = 0; @@ -283,11 +283,6 @@ namespace OgreBites bool mContentSetup; // whether or not scene was created #ifdef OGRE_BUILD_COMPONENT_RTSHADERSYSTEM Ogre::RTShader::ShaderGenerator* mShaderGenerator; // The Shader generator instance. - public: - void setShaderGenerator(Ogre::RTShader::ShaderGenerator* shaderGenerator) - { - mShaderGenerator = shaderGenerator; - } #endif private: // VisualTest fields diff --git a/Samples/Common/include/SampleContext.h b/Samples/Common/include/SampleContext.h index 590fe54d840..635cedf0992 100644 --- a/Samples/Common/include/SampleContext.h +++ b/Samples/Common/include/SampleContext.h @@ -100,9 +100,6 @@ namespace OgreBites // test system capabilities against sample requirements s->testCapabilities(mRoot->getRenderSystem()->getCapabilities()); -#ifdef OGRE_BUILD_COMPONENT_RTSHADERSYSTEM - s->setShaderGenerator(mShaderGenerator); -#endif s->_setup(this); // start new sample } diff --git a/Samples/Csharp/winforms.cs b/Samples/Csharp/winforms.cs index b2d8aafb34f..b60e7f3a938 100644 --- a/Samples/Csharp/winforms.cs +++ b/Samples/Csharp/winforms.cs @@ -35,7 +35,7 @@ private void Closing(object sender, System.ComponentModel.CancelEventArgs e) getRoot().queueEndRendering(); } - public override NativeWindowPair createWindow(string title, uint w, uint h, NameValuePairList miscParams) + public override NativeWindowPair createWindow(string title, uint w, uint h, NameValueMap miscParams) { miscParams["externalWindowHandle"] = form.Handle.ToString(); diff --git a/Samples/Emscripten/Context.cpp b/Samples/Emscripten/Context.cpp index 8e459d43815..a76c79498ee 100755 --- a/Samples/Emscripten/Context.cpp +++ b/Samples/Emscripten/Context.cpp @@ -223,6 +223,5 @@ void Context::setup() { addInputListener(this); mCurrentSample = new Sample_Character(); - mCurrentSample->setShaderGenerator(mShaderGenerator); mCurrentSample->_setup(this); } diff --git a/Samples/Media/materials/scripts/gaussiansplat.material b/Samples/Media/materials/scripts/gaussiansplat.material index 3051c30ea5c..1b1cb9930bc 100644 --- a/Samples/Media/materials/scripts/gaussiansplat.material +++ b/Samples/Media/materials/scripts/gaussiansplat.material @@ -12,7 +12,7 @@ vertex_program gsplatting_vp glsl glsles glslang } } -fragment_program gsplatting_fp glsl150 glsles glslang +fragment_program gsplatting_fp glsl glsles glslang { source gsplat.frag } diff --git a/Samples/ShaderSystem/src/OgreShaderExInstancedViewports.cpp b/Samples/ShaderSystem/src/OgreShaderExInstancedViewports.cpp index ebf5b418529..c6715648f2f 100644 --- a/Samples/ShaderSystem/src/OgreShaderExInstancedViewports.cpp +++ b/Samples/ShaderSystem/src/OgreShaderExInstancedViewports.cpp @@ -103,7 +103,7 @@ bool ShaderExInstancedViewports::resolveParameters(ProgramSet* programSet) mVSOriginalOutPositionProjectiveSpace = vsMain->resolveOutputParameter(Parameter::SPC_POSITION_PROJECTIVE_SPACE); -#define SPC_POSITION_PROJECTIVE_SPACE_AS_TEXCORD ((Parameter::Content)(Parameter::SPC_CUSTOM_CONTENT_BEGIN + 1)) +#define SPC_POSITION_PROJECTIVE_SPACE_AS_TEXCORD (Parameter::SPC_CUSTOM_CONTENT_BEGIN + 1) mVSOutPositionProjectiveSpace = vsMain->resolveOutputParameter(SPC_POSITION_PROJECTIVE_SPACE_AS_TEXCORD, GCT_FLOAT4); diff --git a/Samples/ShaderSystem/src/OgreShaderExTextureAtlasSampler.cpp b/Samples/ShaderSystem/src/OgreShaderExTextureAtlasSampler.cpp index f79ec0dfd57..e601127ccb3 100644 --- a/Samples/ShaderSystem/src/OgreShaderExTextureAtlasSampler.cpp +++ b/Samples/ShaderSystem/src/OgreShaderExTextureAtlasSampler.cpp @@ -92,7 +92,7 @@ bool TextureAtlasSampler::resolveParameters(ProgramSet* programSet) // // Define vertex shader parameters used to find the position of the textures in the atlas // - Parameter::Content indexContent = (Parameter::Content)((int)Parameter::SPC_TEXTURE_COORDINATE0 + mAtlasTexcoordPos); + int indexContent = Parameter::SPC_TEXTURE_COORDINATE0 + mAtlasTexcoordPos; GpuConstantType indexType = GCT_FLOAT4; mVSInpTextureTableIndex = vsMain->resolveInputParameter(indexContent, indexType); @@ -173,7 +173,7 @@ bool TextureAtlasSampler::addFunctionInvocations(ProgramSet* programSet) if (mIsAtlasTextureUnits[j] == true) { //Find the texture coordinates texel and sampler from the original FFPTexturing - ParameterPtr texcoord = psMain->getInputParameter((Parameter::Content)(Parameter::SPC_TEXTURE_COORDINATE0 + j), GCT_FLOAT2); + ParameterPtr texcoord = psMain->getInputParameter(Parameter::SPC_TEXTURE_COORDINATE0 + j, GCT_FLOAT2); ParameterPtr texel = psMain->getLocalParameter(c_ParamTexel + StringConverter::toString(j)); UniformParameterPtr sampler = psProgram->getParameterByType(GCT_SAMPLER2D, j); diff --git a/Tests/OgreMain/include/RootWithoutRenderSystemFixture.h b/Tests/OgreMain/include/RootWithoutRenderSystemFixture.h index bb59789b2e8..207253d6e76 100644 --- a/Tests/OgreMain/include/RootWithoutRenderSystemFixture.h +++ b/Tests/OgreMain/include/RootWithoutRenderSystemFixture.h @@ -36,9 +36,9 @@ THE SOFTWARE. class RootWithoutRenderSystemFixture : public ::testing::Test { public: - Ogre::Root* mRoot; - Ogre::HardwareBufferManager* mHBM; - Ogre::FileSystemLayer* mFSLayer; + std::unique_ptr mHBM; + std::unique_ptr mFSLayer; + std::shared_ptr mRoot; void SetUp() override; void TearDown() override; }; diff --git a/Tests/OgreMain/src/RootWithoutRenderSystemFixture.cpp b/Tests/OgreMain/src/RootWithoutRenderSystemFixture.cpp index f51bc4a158d..4cc12e0d819 100644 --- a/Tests/OgreMain/src/RootWithoutRenderSystemFixture.cpp +++ b/Tests/OgreMain/src/RootWithoutRenderSystemFixture.cpp @@ -12,9 +12,9 @@ using namespace Ogre; void RootWithoutRenderSystemFixture::SetUp() { - mFSLayer = new FileSystemLayer(OGRE_VERSION_NAME); - mRoot = new Root(""); - mHBM = new DefaultHardwareBufferManager; + mRoot.reset(new Root("")); + mFSLayer.reset(new FileSystemLayer(OGRE_VERSION_NAME)); + mHBM.reset(new DefaultHardwareBufferManager); MaterialManager::getSingleton().initialise(); @@ -25,15 +25,13 @@ void RootWithoutRenderSystemFixture::SetUp() cf.load(resourcesPath); // Go through all sections & settings in the file String secName, typeName, archName; - ConfigFile::SettingsBySection_::const_iterator seci; - for(seci = cf.getSettingsBySection().begin(); seci != cf.getSettingsBySection().end(); ++seci) { - secName = seci->first; - const ConfigFile::SettingsMultiMap& settings = seci->second; - ConfigFile::SettingsMultiMap::const_iterator i; - for (i = settings.begin(); i != settings.end(); ++i) + for(const auto& e : cf.getSettingsBySection()) { + secName = e.first; + const ConfigFile::SettingsMultiMap& settings = e.second; + for (const auto& s : settings) { - typeName = i->first; - archName = i->second; + typeName = s.first; + archName = s.second; ResourceGroupManager::getSingleton().addResourceLocation(archName, typeName, secName); } } @@ -41,7 +39,5 @@ void RootWithoutRenderSystemFixture::SetUp() void RootWithoutRenderSystemFixture::TearDown() { - delete mRoot; - delete mHBM; - delete mFSLayer; + } diff --git a/Tests/VisualTests/Common/include/ImageValidator.h b/Tests/VisualTests/Common/include/ImageValidator.h index e3194cc8bd0..5377ab46b04 100644 --- a/Tests/VisualTests/Common/include/ImageValidator.h +++ b/Tests/VisualTests/Common/include/ImageValidator.h @@ -31,12 +31,6 @@ THE SOFTWARE. #include "Ogre.h" -#if OGRE_DOUBLE_PRECISION == 1 -#define WITH_FLOAT_SUFFIX(x) x -#else -#define WITH_FLOAT_SUFFIX(x) x##f -#endif - /** Some functionality for comparing images */ /* Results of comparing two test images */ @@ -57,7 +51,6 @@ struct ComparisonResult }; typedef std::vector ComparisonResultVector; -typedef Ogre::SharedPtr ComparisonResultVectorPtr; /** Simple object for doing image comparison between two image sets */ class ImageValidator @@ -115,7 +108,7 @@ class ImageValidator out.incorrectPixels = 0; Ogre::ColourValue disparity = Ogre::ColourValue(0,0,0); - Ogre::Real ssim = 0.0; + float ssim = 0.0; int width = img1.getWidth(); int height = img1.getHeight(); @@ -189,8 +182,7 @@ class ImageValidator if(out.incorrectPixels != 0) { // average and clamp to [-1,1] - out.ssim = std::max(WITH_FLOAT_SUFFIX(-1.0), - std::min(WITH_FLOAT_SUFFIX(1.0), ssim/(width*height/WITH_FLOAT_SUFFIX(64.)))); + out.ssim = Ogre::Math::Clamp(ssim/(width*height/64.f), -1.f, 1.f); // average the raw deviance value to get MSE out.mseChannels = disparity / (width*height);