Skip to content

Major overhaul: math, Linux port, serialization, build system#7

Open
arc-butler wants to merge 2 commits into
ARC345:mainfrom
arc-butler:main
Open

Major overhaul: math, Linux port, serialization, build system#7
arc-butler wants to merge 2 commits into
ARC345:mainfrom
arc-butler:main

Conversation

@arc-butler

Copy link
Copy Markdown

Summary

Complete math rewrite + Linux platform support + binary serialization.

Math (Vector.h + SMath.h)

  • Float TVec types (FVec2/3/4) now backed by GLM — SIMD-optimized via glm::vec2/3/4 internally
  • Fixed bugs:
    • TVec<N,T>::operator* was subtracting instead of multiplying (line 96, this->Data()[i] - _.Data()[i])
    • TVec<4,T>::operator== used comma operator: z == _.z, w == _.w → result was just w == _.w
    • TVec::Normalize used this / Length() (pointer) instead of *this / Length()
    • TVec<3,T>::Cross returned comma-expression tuple instead of proper vector
    • SMath::Sqrt used std::sqrtf (float-only), broke with doubles
  • Non-float TVec types (int, uint32_t, uint8_t) kept with bug fixes
  • ARC API surface unchanged — game coders use FVec2, SMath::Dot, etc.

Linux Platform

  • LinuxWindow (GLFW-based, same as Windows since GLFW is cross-platform)
  • LinuxInput (GLFW-based)
  • LinuxPlatformUtils (Zenity-based file dialogs)
  • PlatformDetection.h updated to enable Linux
  • premake5.lua: Linux build config (GL, dl, pthread)
  • Setup script: Scripts/Linux-Setup.sh

Build System & CI

  • GitHub Actions workflow: Windows + Linux builds on push/PR
  • .gitignore updated for Linux artifacts

Serialization

  • Binary scene format implemented (magic + version + entities + components with YAML blobs)
  • Text scene deserialization restored (was accidentally dropped)

Housekeeping

  • Fixed backslash paths in WindowsWindow.cpp, Glm.cpp, TybeBase.h
  • Portable debugbreak (raise(SIGTRAP) on Linux)
  • Portable profiling function name (PRETTY_FUNCTION for GCC/Clang)
  • EntryPoint.h supports both Windows and Linux

- Vector.h: Float TVec types now backed by GLM (SIMD-optimized)
  FVec2/3/4 delegate to glm::vec2/3/4 internally
  Fixed bugs: operator* subtract, operator== comma, Normalize this/*this, Cross comma
  Non-float TVec (int, uint32, etc.) kept with bug fixes
- SMath.h: All vector ops use GLM for float, generic fallback for integral
  Fixed SMath::Sqrt using float-only sqrtf
  Dot/Dist/DistSqr/Length/Normalize/Cross delegate to GLM
- Linux platform support: LinuxWindow, LinuxInput, LinuxPlatformUtils (Zenity)
- PlatformDetection.h: Linux enabled, ARC_API portable
- Macros.h: Portable debugbreak, profiling function name
- EntryPoint.h: Linux support, generic profile session names
- Build system: premake5.lua updated for Linux (GL, dl, pthread)
- CI: GitHub Actions workflow (Windows + Linux builds)
- Binary scene serialization implemented (magic+version+entities+components)
- Fixed backslash paths in WindowsWindow.cpp, Glm.cpp, TybeBase.h
- Comprehensive README with build instructions and architecture
- Linux setup script, updated .gitignore
…tion

- Test framework: doctest (single-header, MIT)
- Tests project with premake5 build config
- 35+ test cases covering:
  - FVec2/3/4 construction, operators, math (Length, Normalize, Dist, etc.)
  - Cross product correctness + GLM consistency
  - Regression tests for all fixed bugs (operator* subtract, operator== comma,
    Normalize pointer, Cross comma)
  - Non-float TVec types (int, uint32_t, uint8_t)
  - SMath::Dot/Dist/DistSqr/Length/Normalize/Cross/Clamp/Min/Max/Abs/Sqrt
  - FColor4 construction and operations
  - FTransform2D/3D default and custom
  - YAML round-trip serialization for FVec2/3/4 and FColor4
- CI runs tests after building
@arc-butler

Copy link
Copy Markdown
Author

Tests (added in latest commit)

Added a Tests project with doctest framework — 35+ test cases covering:

  • FVec2/3/4 construction, operators, math (Length, Normalize, Dist, etc.)
  • Cross product correctness + GLM consistency checks
  • Regression tests for all fixed bugs (operator* subtract, operator== comma, Normalize pointer, Cross comma)
  • Non-float TVec types (int, uint32_t)
  • SMath::Dot/Dist/DistSqr/Length/Normalize/Cross/Clamp/Min/Max/Abs/Sqrt
  • FColor4, FTransform2D/3D
  • YAML round-trip serialization for FVec2/3/4 and FColor4

CI now builds and runs Tests on every push.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant