Skip to content

Commit

Permalink
Merge branch 'OGRECave:master' into RenderingThread
Browse files Browse the repository at this point in the history
  • Loading branch information
andre-caldas authored Feb 10, 2025
2 parents 2a4993e + 0322866 commit a02e2f1
Show file tree
Hide file tree
Showing 87 changed files with 481 additions and 598 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pip-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Expand Down
8 changes: 4 additions & 4 deletions CMake/Dependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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})
Expand Down
8 changes: 2 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 "")
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
4 changes: 4 additions & 0 deletions Components/Bites/include/OgreBites.i
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@
%include stdint.i
%import "Ogre.i"

#ifndef SWIGPYTHON
%import "OgreOverlay.i"
#endif

#define _OgreBitesExport

%include "OgreSGTechniqueResolverListener.h"
Expand Down
17 changes: 9 additions & 8 deletions Components/Csharp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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)
Expand All @@ -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})

Expand Down
17 changes: 9 additions & 8 deletions Components/Java/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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)
Expand All @@ -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})

Expand Down
12 changes: 6 additions & 6 deletions Components/Overlay/include/ImGui.i
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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
Expand All @@ -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 };
Expand Down
12 changes: 12 additions & 0 deletions Components/Overlay/include/OgreOverlay.i
Original file line number Diff line number Diff line change
Expand Up @@ -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<Ogre::OverlayElement> {
typedef pointer_category category;
static const char* type_name() { return "Ogre::OverlayElement"; }
};
}
%}
#endif
%template(OverlayElementMap) std::map<std::string, Ogre::OverlayElement*>;
%include "OgreOverlayManager.h"
SHARED_PTR(OverlaySystem);
%include "OgreOverlaySystem.h"
Expand Down
15 changes: 7 additions & 8 deletions Components/Overlay/src/OgreFont.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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)
Expand Down
49 changes: 14 additions & 35 deletions Components/Overlay/src/OgreTextAreaOverlayElement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand All @@ -328,73 +328,52 @@ 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;
//-------------------------------------------------------------------------------------

//-------------------------------------------------------------------------------------
// 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();
Expand Down
Loading

0 comments on commit a02e2f1

Please sign in to comment.