mirror of
https://github.com/orange-cpp/omath.git
synced 2026-08-08 14:02:06 +00:00
Compare commits
7 Commits
945f80241c
..
v5.5.1
| Author | SHA1 | Date | |
|---|---|---|---|
| 335096d0c8 | |||
| 9f4cc99790 | |||
| f2ff761823 | |||
| 4cd5e8f829 | |||
| eac3adba2a | |||
| 4e413d977a | |||
| d4c86dacc7 |
@@ -245,72 +245,37 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
./out/Debug/unit_tests.exe
|
./out/Debug/unit_tests.exe
|
||||||
|
|
||||||
- name: Process Coverage (llvm-profdata & llvm-cov)
|
- name: Process and render coverage
|
||||||
if: ${{ matrix.triplet == 'x64-windows' }}
|
if: ${{ matrix.triplet == 'x64-windows' }}
|
||||||
shell: pwsh
|
shell: pwsh
|
||||||
run: |
|
run: |
|
||||||
$BUILD_DIR = "cmake-build/build/${{ matrix.preset }}"
|
$buildDir = "cmake-build/build/${{ matrix.preset }}"
|
||||||
$EXE_PATH = "./out/Debug/unit_tests.exe"
|
$exePath = "./out/Debug/unit_tests.exe"
|
||||||
|
$profile = "$buildDir/unit_tests.profdata"
|
||||||
# 1. Merge raw profile data (essential step)
|
$htmlDir = "$buildDir/coverage-html"
|
||||||
|
|
||||||
& "C:/Program Files/LLVM/bin/llvm-profdata.exe" merge `
|
& "C:/Program Files/LLVM/bin/llvm-profdata.exe" merge `
|
||||||
-sparse "$BUILD_DIR/unit_tests.profraw" `
|
-sparse "$buildDir/unit_tests.profraw" `
|
||||||
-o "$BUILD_DIR/unit_tests.profdata"
|
-o $profile
|
||||||
|
|
||||||
# 2. Export to LCOV format
|
if ($LASTEXITCODE -ne 0) {
|
||||||
# NOTE: We explicitly ignore vcpkg_installed and system headers
|
exit $LASTEXITCODE
|
||||||
& "C:/Program Files/LLVM/bin/llvm-cov.exe" export "$EXE_PATH" `
|
|
||||||
-instr-profile="$BUILD_DIR/unit_tests.profdata" `
|
|
||||||
-format=lcov `
|
|
||||||
-ignore-filename-regex="vcpkg_installed|external|tests" `
|
|
||||||
> "$BUILD_DIR/lcov.info"
|
|
||||||
|
|
||||||
if (Test-Path "$BUILD_DIR/lcov.info") {
|
|
||||||
Write-Host "✅ LCOV info created at $BUILD_DIR/lcov.info"
|
|
||||||
} else {
|
|
||||||
Write-Error "Failed to create LCOV info"
|
|
||||||
exit 1
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- name: Install LCOV (for genhtml)
|
& "C:/Program Files/LLVM/bin/llvm-cov.exe" show $exePath `
|
||||||
if: ${{ matrix.triplet == 'x64-windows' }}
|
"-instr-profile=$profile" `
|
||||||
run: choco install lcov -y
|
"-format=html" `
|
||||||
|
"-output-dir=$htmlDir" `
|
||||||
|
"-ignore-filename-regex=vcpkg_installed|external|tests" `
|
||||||
|
"-show-branches=count"
|
||||||
|
|
||||||
- name: Generate HTML Report
|
if ($LASTEXITCODE -ne 0) {
|
||||||
if: ${{ matrix.triplet == 'x64-windows' }}
|
exit $LASTEXITCODE
|
||||||
shell: bash
|
}
|
||||||
run: |
|
|
||||||
BUILD_DIR="cmake-build/build/${{ matrix.preset }}"
|
|
||||||
LCOV_INFO="${BUILD_DIR}/lcov.info"
|
|
||||||
HTML_DIR="${BUILD_DIR}/coverage-html"
|
|
||||||
|
|
||||||
# Fix paths for genhtml (Perl hates backslashes)
|
if (-not (Test-Path "$htmlDir/index.html")) {
|
||||||
sed -i 's|\\|/|g' "${LCOV_INFO}"
|
throw "LLVM coverage report was not generated"
|
||||||
|
}
|
||||||
# Locate genhtml provided by 'choco install lcov'
|
|
||||||
# It is typically in ProgramData/chocolatey/lib/lcov/tools/bin
|
|
||||||
GENHTML=$(find /c/ProgramData/chocolatey -name genhtml -print -quit)
|
|
||||||
|
|
||||||
if [ -z "$GENHTML" ]; then
|
|
||||||
echo "Error: genhtml executable not found"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Using genhtml: $GENHTML"
|
|
||||||
mkdir -p "$HTML_DIR"
|
|
||||||
|
|
||||||
# Run genhtml
|
|
||||||
# Added --demangle-cpp if your version supports it, otherwise remove it
|
|
||||||
perl "$GENHTML" \
|
|
||||||
"${LCOV_INFO}" \
|
|
||||||
--output-directory "$HTML_DIR" \
|
|
||||||
--title "OMath Coverage Report" \
|
|
||||||
--legend \
|
|
||||||
--show-details \
|
|
||||||
--branch-coverage \
|
|
||||||
--ignore-errors source
|
|
||||||
|
|
||||||
echo "✅ LCOV HTML report generated at $HTML_DIR"
|
|
||||||
|
|
||||||
- name: Upload Coverage (HTML Report)
|
- name: Upload Coverage (HTML Report)
|
||||||
if: ${{ matrix.triplet == 'x64-windows' }}
|
if: ${{ matrix.triplet == 'x64-windows' }}
|
||||||
|
|||||||
@@ -6,6 +6,17 @@ if (@OMATH_IMGUI_INTEGRATION@)
|
|||||||
find_dependency(imgui CONFIG)
|
find_dependency(imgui CONFIG)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if (@OMATH_ENABLE_LUA@)
|
||||||
|
find_dependency(Lua)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (@OMATH_ENABLE_HOOKING@)
|
||||||
|
find_dependency(safetyhook CONFIG)
|
||||||
|
if (NOT WIN32 AND (UNIX AND NOT APPLE))
|
||||||
|
find_dependency(OpenGL)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
# Load the targets for the omath library
|
# Load the targets for the omath library
|
||||||
include("${CMAKE_CURRENT_LIST_DIR}/omathTargets.cmake")
|
include("${CMAKE_CURRENT_LIST_DIR}/omathTargets.cmake")
|
||||||
check_required_components(omath)
|
check_required_components(omath)
|
||||||
|
|||||||
@@ -161,6 +161,12 @@ namespace imgui_desktop::gui
|
|||||||
ImGuiColorEditFlags_NoInputs);
|
ImGuiColorEditFlags_NoInputs);
|
||||||
ImGui::ColorEdit4("Gradient right##lbl", reinterpret_cast<float*>(&m_label_gradient_right),
|
ImGui::ColorEdit4("Gradient right##lbl", reinterpret_cast<float*>(&m_label_gradient_right),
|
||||||
ImGuiColorEditFlags_NoInputs);
|
ImGuiColorEditFlags_NoInputs);
|
||||||
|
if (m_animate_gradients)
|
||||||
|
{
|
||||||
|
int direction = static_cast<int>(m_label_gradient_direction);
|
||||||
|
if (ImGui::Combo("Direction##lbl", &direction, "Right to left\0Left to right\0"))
|
||||||
|
m_label_gradient_direction = static_cast<omath::hud::GradientDirection>(direction);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ImGui::SliderFloat("Offset##lbl", &m_label_offset, 0.f, 15.f);
|
ImGui::SliderFloat("Offset##lbl", &m_label_offset, 0.f, 15.f);
|
||||||
ImGui::Checkbox("Right##lbl", &m_show_right_labels);
|
ImGui::Checkbox("Right##lbl", &m_show_right_labels);
|
||||||
@@ -309,7 +315,8 @@ namespace imgui_desktop::gui
|
|||||||
const Paint centered_label_color =
|
const Paint centered_label_color =
|
||||||
m_gradient_label ? Paint{omath::hud::Gradient{m_label_gradient_left, m_label_gradient_right,
|
m_gradient_label ? Paint{omath::hud::Gradient{m_label_gradient_left, m_label_gradient_right,
|
||||||
m_label_gradient_right, m_label_gradient_left,
|
m_label_gradient_right, m_label_gradient_left,
|
||||||
m_animate_gradients}}
|
m_animate_gradients, 4.f, 0.7f,
|
||||||
|
m_label_gradient_direction}}
|
||||||
: Paint{omath::Color::from_rgba(255, 255, 255, 255)};
|
: Paint{omath::Color::from_rgba(255, 255, 255, 255)};
|
||||||
|
|
||||||
auto outline_helper = [](const bool is_outline) -> Outlined
|
auto outline_helper = [](const bool is_outline) -> Outlined
|
||||||
|
|||||||
@@ -68,6 +68,7 @@ namespace imgui_desktop::gui
|
|||||||
omath::Color m_label_gradient_right{1.f, 0.2f, 0.7f, 1.f};
|
omath::Color m_label_gradient_right{1.f, 0.2f, 0.7f, 1.f};
|
||||||
bool m_outlined = true;
|
bool m_outlined = true;
|
||||||
bool m_gradient_label = true;
|
bool m_gradient_label = true;
|
||||||
|
omath::hud::GradientDirection m_label_gradient_direction = omath::hud::GradientDirection::RightToLeft;
|
||||||
bool m_show_right_labels = true, m_show_left_labels = true;
|
bool m_show_right_labels = true, m_show_left_labels = true;
|
||||||
bool m_show_top_labels = true, m_show_bottom_labels = true;
|
bool m_show_top_labels = true, m_show_bottom_labels = true;
|
||||||
bool m_show_centered_top = true, m_show_centered_bottom = true;
|
bool m_show_centered_top = true, m_show_centered_bottom = true;
|
||||||
|
|||||||
@@ -3,6 +3,12 @@
|
|||||||
|
|
||||||
namespace omath::hud
|
namespace omath::hud
|
||||||
{
|
{
|
||||||
|
enum class GradientDirection
|
||||||
|
{
|
||||||
|
RightToLeft,
|
||||||
|
LeftToRight,
|
||||||
|
};
|
||||||
|
|
||||||
struct Gradient
|
struct Gradient
|
||||||
{
|
{
|
||||||
Color top_left;
|
Color top_left;
|
||||||
@@ -12,5 +18,6 @@ namespace omath::hud
|
|||||||
bool animated = false;
|
bool animated = false;
|
||||||
float animation_speed = 4.f;
|
float animation_speed = 4.f;
|
||||||
float animation_spread = 0.7f;
|
float animation_spread = 0.7f;
|
||||||
|
GradientDirection direction = GradientDirection::RightToLeft;
|
||||||
};
|
};
|
||||||
} // namespace omath::hud
|
} // namespace omath::hud
|
||||||
|
|||||||
@@ -54,9 +54,6 @@ namespace omath
|
|||||||
return {value, Length - 1};
|
return {value, Length - 1};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
template<std::size_t N>
|
|
||||||
ConstevalPattern(const char (&)[N]) -> ConstevalPattern<N>;
|
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
static std::span<std::byte>::iterator scan_for_pattern(const std::span<std::byte>& range,
|
static std::span<std::byte>::iterator scan_for_pattern(const std::span<std::byte>& range,
|
||||||
const std::string_view& pattern);
|
const std::string_view& pattern);
|
||||||
|
|||||||
@@ -103,6 +103,7 @@ namespace omath::hud
|
|||||||
if (gradient.animated)
|
if (gradient.animated)
|
||||||
{
|
{
|
||||||
const float animation_offset = static_cast<float>(ImGui::GetTime()) * gradient.animation_speed;
|
const float animation_offset = static_cast<float>(ImGui::GetTime()) * gradient.animation_speed;
|
||||||
|
const float direction = gradient.direction == GradientDirection::RightToLeft ? 1.f : -1.f;
|
||||||
float cursor_x = position.x;
|
float cursor_x = position.x;
|
||||||
const char* glyph_start = text.data();
|
const char* glyph_start = text.data();
|
||||||
const char* const text_end = text.data() + text.size();
|
const char* const text_end = text.data() + text.size();
|
||||||
@@ -117,7 +118,9 @@ namespace omath::hud
|
|||||||
|
|
||||||
const char* const glyph_end = glyph_start + glyph_size;
|
const char* const glyph_end = glyph_start + glyph_size;
|
||||||
const float blend =
|
const float blend =
|
||||||
(std::sin(animation_offset + static_cast<float>(glyph_index) * gradient.animation_spread) + 1.f)
|
(std::sin(animation_offset + direction * static_cast<float>(glyph_index)
|
||||||
|
* gradient.animation_spread)
|
||||||
|
+ 1.f)
|
||||||
* 0.5f;
|
* 0.5f;
|
||||||
const auto color = gradient.top_left.value() * (1.f - blend) + gradient.top_right.value() * blend;
|
const auto color = gradient.top_left.value() * (1.f - blend) + gradient.top_right.value() * blend;
|
||||||
draw_list->AddText({cursor_x, position.y}, Color{color}.to_im_color(), glyph_start, glyph_end);
|
draw_list->AddText({cursor_x, position.y}, Color{color}.to_im_color(), glyph_start, glyph_end);
|
||||||
|
|||||||
Reference in New Issue
Block a user