Move Vectormath main
C++20 game and graphics mathematics
Loading...
Searching...
No Matches
move-vectormath

move-vectormath is Move's C++20 game and graphics math library. The current API lives in mv::math and provides arithmetic vectors, invariant-bearing semantic values, transforms, matrices, geometry, spatial queries, culling, and explicit graphics-convention helpers.

The generated API reference is published by version: use the development documentation for main, or the documentation index to select a release tag.

Use the API

Include the full public surface:

or focused capability headers such as:

Example:

using namespace mv::math;
const auto direction = Direction3f::TryFrom(target - position);
if (!direction)
{
return;
}
const Point3f world = TransformPoint(localToWorld, local);
const auto bounds = Obb3f::TryFromCenterHalfExtents(
world, Vec3f(1.0F, 2.0F, 1.0F), rotation);

Fallible construction is deliberate: normalized directions, normals, finite geometry, singular inverses, projective homogeneous division, and invalid camera bases do not silently manufacture fallback values.

Conventions

  • +X is right, +Y is up, and +Z is the conventional forward axis.
  • Matrices use row-vector application: value * matrix.
  • Composition functions read in application order: Compose(first, second) applies first, then second.
  • Angle arguments use Radians<T> or Degrees<T> rather than untyped scalars.
  • Projection construction requires explicit handedness, clip-depth range, and forward/reverse depth direction.
  • Point3, Direction3, and Normal3 are different semantic values.
  • Packed CPU storage and exact GPU transfer layouts are explicit types rather than accidental properties of compute vectors.

See CONVENTIONS.md and the organized API-v2 design archive.

CMake

The canonical target for new consumers is mv::math:

add_subdirectory(path/to/move-vectormath)
target_link_libraries(your_target PRIVATE mv::math)

The target publishes the C++20 requirement, public include directory, and the pinned RTM dependency. FetchContent and CPM can add the repository in the same way before linking mv::math.

XMake

The repository owns a first-class header-only XMake target:

includes("path/to/move-vectormath")
target("your-game")
add_deps("move-vectormath")

The upstream project pins the official rtm v2.3.1 package and installs the complete public include tree. A package repository can delegate installation to this project and expose it through add_requires("move-vectormath").

Validate the XMake consumption surface with:

xmake f -c --build_tests=y -m release -y
xmake build
xmake test -v

The force_scalar XMake option publishes MV_MATH_FORCE_SCALAR=1 when a portable scalar build is required.

An opt-in C++20 named module exports the same API:

includes("path/to/move-vectormath")
target("your-game")
add_deps("move-vectormath-module")
import mv.math;

Configure it with --build_modules=y. XMake compiles the BMI locally for the active compiler and flags; installation publishes the module source and metadata, never a nonportable precompiled BMI. The headers remain the canonical implementation and an equal public consumption surface.

The named module is continuously verified with Clang and MSVC and locally verified with GCC 16. GCC 14 remains supported through headers, but its experimental named-module implementation is not part of the module support contract.

Verification

The CMake suite exercises GCC, Clang, AppleClang, and MSVC; scalar and RTM backends; sanitizers; generated-code fixtures; shader transfer layouts; and a downstream consumer. XMake has independent RTM and forced-scalar header consumer tests plus direct and downstream named-module consumers on the supported module compilers. Runtime benchmarks live in the separate vectormathbench repository and are diagnostic rather than noisy hosted-runner regression gates.

License

This repository is licensed under the MIT license. See LICENSE.md.