2026-07-22 04:52:09 +01:00
|
|
|
# CultMath for Unity
|
|
|
|
|
|
|
|
|
|
This is CultMath's Unity 2021.3-compatible Git-UPM surface. It contains the
|
2026-09-14 13:30:00 +02:00
|
|
|
precompiled `CultMath.dll`, portable symbols, the numeric
|
CultMath: Phacelle port moves into MPL-2.0 files; prune cut pinned by boundary points
MPL-2.0 is file-level and the Phacelle port sat inside MIT files. phacelle and
CultPhasor now live in math.Phacelle.cs and CultPhasor.cs, and cultmath_phacelle
in CultMath.Phacelle.hlsl (included by CultMath.hlsl, both tracked copies), each
with the MPL header and Johansen / Luke Mitchell attribution. math stays one
partial class, so math.phacelle is called exactly as before. The GameCult.Math
package declares MIT AND MPL-2.0 and packs THIRD-PARTY-NOTICES.md and the new
include; the Unity LICENSE.md points at CultLib; build-unity-package.ps1
requires the new include.
The random sweeps never met a cell whose box bound sits just under the 2.25 cut
while its weight is still nonzero, so cuts of 2.245, 2.24 and 2.2 survived.
Six hard-coded points (found by an offline search) sit next to such cells; the
C# pruned-vs-unpruned test and the HLSL mirror test both use them, with a
witness check that re-derives the property from the hash.
Docs: the prune keeps about 45 of 64 cells (14 is the nonzero-weight count),
the support radius is 1.49998 (d^2 = 2.24995), normalization's range and
saturation, W = 0 only for adversarial hashes, and the support-edge gradient
seam size.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-09-30 00:34:27 +02:00
|
|
|
`Shaders/CultMath.hlsl` mirror (with its `CultMath.Phacelle.hlsl` include), and the `CultMath.UnityBridge` assembly.
|
2026-09-14 13:30:00 +02:00
|
|
|
|
|
|
|
|
`CultMath.UnityBridge` is the only C# source Unity compiles here. It holds the
|
|
|
|
|
UnityEngine conversions the engine-free core cannot declare: `ToCultMath()` on
|
|
|
|
|
`Vector2/3/4`, `Vector2Int/3Int`, `Quaternion`, and `Color`; `ToUnity()` on
|
|
|
|
|
`float2/3/4`, `int2/3`, and `quaternion`; `ToColor()` on `float4`. C# only
|
|
|
|
|
admits conversion operators on the source or target type, so these are
|
|
|
|
|
extension methods rather than implicit casts. Import `CultMath.UnityBridge` to
|
|
|
|
|
use them.
|
2026-07-22 04:52:09 +01:00
|
|
|
|
|
|
|
|
Unity does not compile CultMath's repository source tree. That source uses the
|
|
|
|
|
current C# language and remains owned by the normal .NET project. The package
|
2026-07-22 05:07:32 +01:00
|
|
|
imports only the tracked auto-referenced precompiled assembly, so consumers do
|
|
|
|
|
not need `csc.rsp` language overrides or an asmdef propagation shim.
|
2026-07-22 04:52:09 +01:00
|
|
|
|
|
|
|
|
Build and inspect the package from the repository root:
|
|
|
|
|
|
|
|
|
|
```powershell
|
|
|
|
|
.\scripts\build-unity-package.ps1
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
The builder fresh-builds CultMath for `netstandard2.1`, verifies the tracked
|
|
|
|
|
DLL/PDB and stable Unity metadata, and stages an inspectable package under
|
|
|
|
|
`artifacts/unity/org.gamecult.cultmath`.
|
|
|
|
|
|
|
|
|
|
Consume the repository package with:
|
|
|
|
|
|
|
|
|
|
```json
|
2026-08-26 17:35:51 +02:00
|
|
|
"org.gamecult.cultmath": "https://github.com/GameCult/CultLib.git?path=/packages/cultmath/unity/org.gamecult.cultmath"
|
2026-07-22 04:52:09 +01:00
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Production consumers should pin that URL to a commit or release tag.
|