Delete duplicate geometry vectors
This commit is contained in:
parent
0f16f14415
commit
317b7d538e
7 changed files with 92 additions and 183 deletions
|
|
@ -155,6 +155,26 @@ a broader stage gate.
|
|||
artifacts. v1 remains fixture evidence only; it will not survive as a runtime
|
||||
writer or general compatibility model.
|
||||
- No deviations from the locked target architecture.
|
||||
- Stage 2 versions all four root geometry documents as one v2 cohort. Domain's
|
||||
nested CLR layout changes are invisible to the current root-only schema
|
||||
fingerprint, and leaving SelectedCut as the lone live v1 writer would retain
|
||||
a split cohort even though its direct fields are unchanged.
|
||||
- Typed vectors preserve existing record keys by flattening components in the
|
||||
same authored order into the existing IEEE-754 bit canonicalization. Wire
|
||||
payloads still change—especially typed mesh arrays—so byte fixtures and v2
|
||||
identities remain mandatory.
|
||||
|
||||
### Stage 2 receipts
|
||||
|
||||
- `CultVec2` and `CultVec3` definitions were deleted; `CultRect`, `CultCircle`,
|
||||
and `CultSphere` now expose CultMath `float2`/`float3` directly. No alias or
|
||||
conversion owner remains.
|
||||
- `dotnet test tests/GameCult.Geometry.Tests/GameCult.Geometry.Tests.csproj
|
||||
--no-restore --verbosity minimal --disable-build-servers
|
||||
-p:UseSharedCompilation=false -m:1` passed 19/19 for the primitive cut.
|
||||
- CultMesh native-slice metadata fixtures now name `CultMath.float2` and
|
||||
`CultMath.float3` while retaining 8/12-byte element widths. Only those three
|
||||
overlapping lines were staged from the already-dirty TypeScript test file.
|
||||
|
||||
## Next Actions
|
||||
|
||||
|
|
|
|||
|
|
@ -1454,7 +1454,7 @@ test("CultMesh TS describes typed surface catalogs for tools and generated bindi
|
|||
"aetheria.zone.render",
|
||||
"gamecult.aetheria.render_body.v1",
|
||||
128,
|
||||
[CultMesh.nativeSliceColumn("position", "CultVec2", 8)],
|
||||
[CultMesh.nativeSliceColumn("position", "CultMath.float2", 8)],
|
||||
{ route: routeHint },
|
||||
);
|
||||
|
||||
|
|
@ -2150,7 +2150,7 @@ test("CultMesh TS exposes native slice descriptors", () => {
|
|||
"gamecult.aetheria.zone_render.v1",
|
||||
12,
|
||||
[
|
||||
CultMesh.nativeSliceColumn("position", "CultVec3", 12),
|
||||
CultMesh.nativeSliceColumn("position", "CultMath.float3", 12),
|
||||
CultMesh.nativeSliceColumn("rotationRadians", "float32", 4),
|
||||
CultMesh.nativeSliceColumn("renderGroupId", "uint32", 4),
|
||||
],
|
||||
|
|
@ -2163,7 +2163,7 @@ test("CultMesh TS exposes native slice descriptors", () => {
|
|||
assert.equal(CultMesh.denseRowStrideBytes(view), 20);
|
||||
assert.deepEqual(CultMesh.findNativeSliceColumn(view, "position"), {
|
||||
name: "position",
|
||||
valueType: "CultVec3",
|
||||
valueType: "CultMath.float3",
|
||||
elementSizeBytes: 12,
|
||||
});
|
||||
assert.equal(CultMesh.findNativeSliceColumn(view, "missing"), undefined);
|
||||
|
|
|
|||
|
|
@ -1,126 +1,10 @@
|
|||
using System;
|
||||
using System.Text.Json.Serialization;
|
||||
using CultMath;
|
||||
using MessagePack;
|
||||
|
||||
namespace GameCult.Geometry
|
||||
{
|
||||
/// <summary>
|
||||
/// Deterministic two-dimensional float vector for cross-runtime geometry and query contracts.
|
||||
/// </summary>
|
||||
[MessagePackObject]
|
||||
public readonly struct CultVec2 : IEquatable<CultVec2>
|
||||
{
|
||||
/// <summary>Creates a two-dimensional vector.</summary>
|
||||
public CultVec2(float x, float y)
|
||||
{
|
||||
X = x;
|
||||
Y = y;
|
||||
}
|
||||
|
||||
/// <summary>Gets the x component.</summary>
|
||||
[Key(0)]
|
||||
public float X { get; }
|
||||
|
||||
/// <summary>Gets the y component.</summary>
|
||||
[Key(1)]
|
||||
public float Y { get; }
|
||||
|
||||
/// <summary>Gets the zero vector.</summary>
|
||||
[IgnoreMember]
|
||||
[JsonIgnore]
|
||||
public static CultVec2 Zero => new(0f, 0f);
|
||||
|
||||
/// <summary>Gets the squared vector length.</summary>
|
||||
[IgnoreMember]
|
||||
[JsonIgnore]
|
||||
public float LengthSquared => (X * X) + (Y * Y);
|
||||
|
||||
/// <summary>Returns whether this vector is equal to another vector.</summary>
|
||||
public bool Equals(CultVec2 other) => X.Equals(other.X) && Y.Equals(other.Y);
|
||||
|
||||
/// <inheritdoc />
|
||||
public override bool Equals(object? obj) => obj is CultVec2 other && Equals(other);
|
||||
|
||||
/// <inheritdoc />
|
||||
public override int GetHashCode() => HashCode.Combine(X, Y);
|
||||
|
||||
/// <inheritdoc />
|
||||
public override string ToString() => $"({X}, {Y})";
|
||||
|
||||
public static CultVec2 operator +(CultVec2 left, CultVec2 right) => new(left.X + right.X, left.Y + right.Y);
|
||||
public static CultVec2 operator -(CultVec2 left, CultVec2 right) => new(left.X - right.X, left.Y - right.Y);
|
||||
public static CultVec2 operator *(CultVec2 value, float scalar) => new(value.X * scalar, value.Y * scalar);
|
||||
public static CultVec2 operator /(CultVec2 value, float scalar) => new(value.X / scalar, value.Y / scalar);
|
||||
public static bool operator ==(CultVec2 left, CultVec2 right) => left.Equals(right);
|
||||
public static bool operator !=(CultVec2 left, CultVec2 right) => !left.Equals(right);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Deterministic three-dimensional float vector for cross-runtime geometry and query contracts.
|
||||
/// </summary>
|
||||
[MessagePackObject]
|
||||
public readonly struct CultVec3 : IEquatable<CultVec3>
|
||||
{
|
||||
/// <summary>Creates a three-dimensional vector.</summary>
|
||||
public CultVec3(float x, float y, float z)
|
||||
{
|
||||
X = x;
|
||||
Y = y;
|
||||
Z = z;
|
||||
}
|
||||
|
||||
/// <summary>Gets the x component.</summary>
|
||||
[Key(0)]
|
||||
public float X { get; }
|
||||
|
||||
/// <summary>Gets the y component.</summary>
|
||||
[Key(1)]
|
||||
public float Y { get; }
|
||||
|
||||
/// <summary>Gets the z component.</summary>
|
||||
[Key(2)]
|
||||
public float Z { get; }
|
||||
|
||||
/// <summary>Gets the zero vector.</summary>
|
||||
[IgnoreMember]
|
||||
[JsonIgnore]
|
||||
public static CultVec3 Zero => new(0f, 0f, 0f);
|
||||
|
||||
/// <summary>Gets the XY plane projection.</summary>
|
||||
[IgnoreMember]
|
||||
[JsonIgnore]
|
||||
public CultVec2 Xy => new(X, Y);
|
||||
|
||||
/// <summary>Gets the XZ plane projection for Unity compatibility adapters.</summary>
|
||||
[IgnoreMember]
|
||||
[JsonIgnore]
|
||||
public CultVec2 Xz => new(X, Z);
|
||||
|
||||
/// <summary>Gets the squared vector length.</summary>
|
||||
[IgnoreMember]
|
||||
[JsonIgnore]
|
||||
public float LengthSquared => (X * X) + (Y * Y) + (Z * Z);
|
||||
|
||||
/// <summary>Returns whether this vector is equal to another vector.</summary>
|
||||
public bool Equals(CultVec3 other) => X.Equals(other.X) && Y.Equals(other.Y) && Z.Equals(other.Z);
|
||||
|
||||
/// <inheritdoc />
|
||||
public override bool Equals(object? obj) => obj is CultVec3 other && Equals(other);
|
||||
|
||||
/// <inheritdoc />
|
||||
public override int GetHashCode() => HashCode.Combine(X, Y, Z);
|
||||
|
||||
/// <inheritdoc />
|
||||
public override string ToString() => $"({X}, {Y}, {Z})";
|
||||
|
||||
public static CultVec3 operator +(CultVec3 left, CultVec3 right) => new(left.X + right.X, left.Y + right.Y, left.Z + right.Z);
|
||||
public static CultVec3 operator -(CultVec3 left, CultVec3 right) => new(left.X - right.X, left.Y - right.Y, left.Z - right.Z);
|
||||
public static CultVec3 operator *(CultVec3 value, float scalar) => new(value.X * scalar, value.Y * scalar, value.Z * scalar);
|
||||
public static CultVec3 operator /(CultVec3 value, float scalar) => new(value.X / scalar, value.Y / scalar, value.Z / scalar);
|
||||
public static bool operator ==(CultVec3 left, CultVec3 right) => left.Equals(right);
|
||||
public static bool operator !=(CultVec3 left, CultVec3 right) => !left.Equals(right);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Axis-aligned two-dimensional rectangle represented by canonical min and max corners.
|
||||
/// </summary>
|
||||
|
|
@ -128,52 +12,52 @@ namespace GameCult.Geometry
|
|||
public readonly struct CultRect : IEquatable<CultRect>
|
||||
{
|
||||
/// <summary>Creates a rectangle and canonicalizes min/max corners.</summary>
|
||||
public CultRect(CultVec2 min, CultVec2 max)
|
||||
public CultRect(float2 min, float2 max)
|
||||
{
|
||||
Min = new CultVec2(Math.Min(min.X, max.X), Math.Min(min.Y, max.Y));
|
||||
Max = new CultVec2(Math.Max(min.X, max.X), Math.Max(min.Y, max.Y));
|
||||
Min = new float2(Math.Min(min.x, max.x), Math.Min(min.y, max.y));
|
||||
Max = new float2(Math.Max(min.x, max.x), Math.Max(min.y, max.y));
|
||||
}
|
||||
|
||||
/// <summary>Creates a rectangle and canonicalizes min/max corners.</summary>
|
||||
public CultRect(float minX, float minY, float maxX, float maxY)
|
||||
: this(new CultVec2(minX, minY), new CultVec2(maxX, maxY))
|
||||
: this(new float2(minX, minY), new float2(maxX, maxY))
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>Gets the canonical minimum corner.</summary>
|
||||
[Key(0)]
|
||||
public CultVec2 Min { get; }
|
||||
public float2 Min { get; }
|
||||
|
||||
/// <summary>Gets the canonical maximum corner.</summary>
|
||||
[Key(1)]
|
||||
public CultVec2 Max { get; }
|
||||
public float2 Max { get; }
|
||||
|
||||
/// <summary>Gets the rectangle size.</summary>
|
||||
[IgnoreMember]
|
||||
[JsonIgnore]
|
||||
public CultVec2 Size => Max - Min;
|
||||
public float2 Size => Max - Min;
|
||||
|
||||
/// <summary>Gets the rectangle center.</summary>
|
||||
[IgnoreMember]
|
||||
[JsonIgnore]
|
||||
public CultVec2 Center => (Min + Max) * 0.5f;
|
||||
public float2 Center => (Min + Max) * 0.5f;
|
||||
|
||||
/// <summary>Returns whether the point lies inside or on the rectangle edge.</summary>
|
||||
public bool Contains(CultVec2 point)
|
||||
public bool Contains(float2 point)
|
||||
{
|
||||
return point.X >= Min.X &&
|
||||
point.X <= Max.X &&
|
||||
point.Y >= Min.Y &&
|
||||
point.Y <= Max.Y;
|
||||
return point.x >= Min.x &&
|
||||
point.x <= Max.x &&
|
||||
point.y >= Min.y &&
|
||||
point.y <= Max.y;
|
||||
}
|
||||
|
||||
/// <summary>Returns whether this rectangle intersects another rectangle.</summary>
|
||||
public bool Intersects(CultRect other)
|
||||
{
|
||||
return Min.X <= other.Max.X &&
|
||||
Max.X >= other.Min.X &&
|
||||
Min.Y <= other.Max.Y &&
|
||||
Max.Y >= other.Min.Y;
|
||||
return Min.x <= other.Max.x &&
|
||||
Max.x >= other.Min.x &&
|
||||
Min.y <= other.Max.y &&
|
||||
Max.y >= other.Min.y;
|
||||
}
|
||||
|
||||
/// <summary>Returns whether this rectangle is equal to another rectangle.</summary>
|
||||
|
|
@ -199,7 +83,7 @@ namespace GameCult.Geometry
|
|||
public readonly struct CultCircle : IEquatable<CultCircle>
|
||||
{
|
||||
/// <summary>Creates a circle.</summary>
|
||||
public CultCircle(CultVec2 center, float radius)
|
||||
public CultCircle(float2 center, float radius)
|
||||
{
|
||||
if (radius < 0f)
|
||||
{
|
||||
|
|
@ -212,7 +96,7 @@ namespace GameCult.Geometry
|
|||
|
||||
/// <summary>Gets the circle center.</summary>
|
||||
[Key(0)]
|
||||
public CultVec2 Center { get; }
|
||||
public float2 Center { get; }
|
||||
|
||||
/// <summary>Gets the circle radius.</summary>
|
||||
[Key(1)]
|
||||
|
|
@ -222,24 +106,24 @@ namespace GameCult.Geometry
|
|||
[IgnoreMember]
|
||||
[JsonIgnore]
|
||||
public CultRect Bounds => new(
|
||||
Center.X - Radius,
|
||||
Center.Y - Radius,
|
||||
Center.X + Radius,
|
||||
Center.Y + Radius);
|
||||
Center.x - Radius,
|
||||
Center.y - Radius,
|
||||
Center.x + Radius,
|
||||
Center.y + Radius);
|
||||
|
||||
/// <summary>Returns whether the point lies inside or on the circle edge.</summary>
|
||||
public bool Contains(CultVec2 point)
|
||||
public bool Contains(float2 point)
|
||||
{
|
||||
var delta = point - Center;
|
||||
return delta.LengthSquared <= Radius * Radius;
|
||||
return ((delta.x * delta.x) + (delta.y * delta.y)) <= Radius * Radius;
|
||||
}
|
||||
|
||||
/// <summary>Returns whether this circle intersects a rectangle.</summary>
|
||||
public bool Intersects(CultRect rect)
|
||||
{
|
||||
var clampedX = Math.Max(rect.Min.X, Math.Min(Center.X, rect.Max.X));
|
||||
var clampedY = Math.Max(rect.Min.Y, Math.Min(Center.Y, rect.Max.Y));
|
||||
return Contains(new CultVec2(clampedX, clampedY));
|
||||
var clampedX = Math.Max(rect.Min.x, Math.Min(Center.x, rect.Max.x));
|
||||
var clampedY = Math.Max(rect.Min.y, Math.Min(Center.y, rect.Max.y));
|
||||
return Contains(new float2(clampedX, clampedY));
|
||||
}
|
||||
|
||||
/// <summary>Returns whether this circle is equal to another circle.</summary>
|
||||
|
|
@ -262,7 +146,7 @@ namespace GameCult.Geometry
|
|||
public readonly struct CultSphere : IEquatable<CultSphere>
|
||||
{
|
||||
/// <summary>Creates a sphere.</summary>
|
||||
public CultSphere(CultVec3 center, float radius)
|
||||
public CultSphere(float3 center, float radius)
|
||||
{
|
||||
if (radius < 0f)
|
||||
{
|
||||
|
|
@ -275,7 +159,7 @@ namespace GameCult.Geometry
|
|||
|
||||
/// <summary>Gets the sphere center.</summary>
|
||||
[Key(0)]
|
||||
public CultVec3 Center { get; }
|
||||
public float3 Center { get; }
|
||||
|
||||
/// <summary>Gets the sphere radius.</summary>
|
||||
[Key(1)]
|
||||
|
|
@ -284,13 +168,13 @@ namespace GameCult.Geometry
|
|||
/// <summary>Gets the XY circle projection.</summary>
|
||||
[IgnoreMember]
|
||||
[JsonIgnore]
|
||||
public CultCircle XyCircle => new(Center.Xy, Radius);
|
||||
public CultCircle XyCircle => new(Center.xy, Radius);
|
||||
|
||||
/// <summary>Returns whether the point lies inside or on the sphere surface.</summary>
|
||||
public bool Contains(CultVec3 point)
|
||||
public bool Contains(float3 point)
|
||||
{
|
||||
var delta = point - Center;
|
||||
return delta.LengthSquared <= Radius * Radius;
|
||||
return ((delta.x * delta.x) + (delta.y * delta.y) + (delta.z * delta.z)) <= Radius * Radius;
|
||||
}
|
||||
|
||||
/// <summary>Returns whether this sphere is equal to another sphere.</summary>
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ The package is deliberately substrate-shaped:
|
|||
The small value layer is for cross-runtime query contracts, physics probes,
|
||||
native slices, and UI surfaces:
|
||||
|
||||
- `CultVec2` and `CultVec3`: whole-vector values for positions, velocities,
|
||||
- `CultMath.float2` and `CultMath.float3`: whole-vector values for positions, velocities,
|
||||
accelerations, and query inputs. SoA layouts may store them efficiently, but
|
||||
the semantic API does not force callers to split x/y/z into unrelated fields.
|
||||
- `CultRect`: canonical XY viewport/query rectangle stored as min/max corners.
|
||||
|
|
@ -72,7 +72,7 @@ cache miss; that is split-brain geometry.
|
|||
|
||||
## Documents
|
||||
|
||||
- `CultVec2`, `CultVec3`, `CultRect`, `CultCircle`, `CultSphere`: shared value
|
||||
- `CultMath.float2`, `CultMath.float3`, `CultRect`, `CultCircle`, `CultSphere`: shared value
|
||||
primitives for query and view contracts.
|
||||
- `CultGeometryDomainDocument`: one hierarchical domain tree, suitable for
|
||||
Ragnarok/Fensalir-style feature DSL output.
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@ var viewport = await aetheria.Zone(zoneId)
|
|||
|
||||
await aetheria.Entity(ravenId)
|
||||
.Pilot()
|
||||
.MoveAsync(CultVec2.Right, claim: "pilot-control");
|
||||
.MoveAsync(new CultMath.float2(1f, 0f), claim: "pilot-control");
|
||||
```
|
||||
|
||||
Current seed:
|
||||
|
|
@ -134,7 +134,7 @@ var verse = await CultMesh.ConnectVerseAsync(
|
|||
new[] { new CultMeshAuthorityClaim("pilot-control", shardId: "zone:raven") });
|
||||
|
||||
var aetheria = verse.Use(context => new AetheriaGeneratedFacade(context));
|
||||
await aetheria.Entity(ravenId).Pilot.MoveAsync(CultVec2.Right);
|
||||
await aetheria.Entity(ravenId).Pilot.MoveAsync(new CultMath.float2(1f, 0f));
|
||||
```
|
||||
|
||||
```ts
|
||||
|
|
|
|||
|
|
@ -393,8 +393,8 @@ var view = new CultMeshNativeSliceViewDescriptor(
|
|||
rowCount,
|
||||
new[]
|
||||
{
|
||||
CultMeshNativeSliceColumn.For<CultVec2>("position"),
|
||||
CultMeshNativeSliceColumn.For<CultVec2>("velocity")
|
||||
CultMeshNativeSliceColumn.For<CultMath.float2>("position"),
|
||||
CultMeshNativeSliceColumn.For<CultMath.float2>("velocity")
|
||||
},
|
||||
new CultMeshRouteHint(CultMeshLocalityKind.SharedMemory));
|
||||
```
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ using GameCult.Caching;
|
|||
using GameCult.Caching.MessagePack;
|
||||
using GameCult.Mesh;
|
||||
using GameCult.Networking;
|
||||
using CultMath;
|
||||
using MessagePack;
|
||||
using NUnit.Framework;
|
||||
using R3;
|
||||
|
|
@ -21,52 +22,56 @@ namespace GameCult.Geometry.Tests
|
|||
{
|
||||
var viewport = new CultRect(8f, 4f, -8f, -4f);
|
||||
|
||||
viewport.Min.Should().Be(new CultVec2(-8f, -4f));
|
||||
viewport.Max.Should().Be(new CultVec2(8f, 4f));
|
||||
viewport.Center.Should().Be(CultVec2.Zero);
|
||||
viewport.Contains(new CultVec2(2f, 3f)).Should().BeTrue();
|
||||
viewport.Min.Should().Be(new float2(-8f, -4f));
|
||||
viewport.Max.Should().Be(new float2(8f, 4f));
|
||||
viewport.Center.Should().Be(float2.zero);
|
||||
viewport.Contains(new float2(2f, 3f)).Should().BeTrue();
|
||||
viewport.Intersects(new CultRect(7f, 3f, 10f, 5f)).Should().BeTrue();
|
||||
viewport.Intersects(new CultRect(9f, 5f, 10f, 6f)).Should().BeFalse();
|
||||
|
||||
var gravityBrush = new CultCircle(new CultVec2(10f, 0f), 3f);
|
||||
var gravityBrush = new CultCircle(new float2(10f, 0f), 3f);
|
||||
gravityBrush.Intersects(viewport).Should().BeTrue();
|
||||
gravityBrush.Contains(new CultVec2(12f, 0f)).Should().BeTrue();
|
||||
gravityBrush.Contains(new CultVec2(14f, 0f)).Should().BeFalse();
|
||||
gravityBrush.Contains(new float2(12f, 0f)).Should().BeTrue();
|
||||
gravityBrush.Contains(new float2(14f, 0f)).Should().BeFalse();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GeometryPrimitives_PreserveWholeVectorsForSoaAndPhysicsQueries()
|
||||
{
|
||||
var sphere = new CultSphere(new CultVec3(1f, 2f, 3f), 5f);
|
||||
var sphere = new CultSphere(new float3(1f, 2f, 3f), 5f);
|
||||
|
||||
sphere.Contains(new CultVec3(1f, 6f, 3f)).Should().BeTrue();
|
||||
sphere.Contains(new CultVec3(1f, 8f, 3f)).Should().BeFalse();
|
||||
sphere.Center.Xy.Should().Be(new CultVec2(1f, 2f));
|
||||
sphere.Center.Xz.Should().Be(new CultVec2(1f, 3f));
|
||||
sphere.Contains(new float3(1f, 6f, 3f)).Should().BeTrue();
|
||||
sphere.Contains(new float3(1f, 8f, 3f)).Should().BeFalse();
|
||||
sphere.Center.xy.Should().Be(new float2(1f, 2f));
|
||||
sphere.Center.xz.Should().Be(new float2(1f, 3f));
|
||||
sphere.XyCircle.Bounds.Should().Be(new CultRect(-4f, -3f, 6f, 7f));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GeometryPrimitives_RoundTripThroughMessagePack()
|
||||
{
|
||||
var rect = new CultRect(new CultVec2(5f, -2f), new CultVec2(-1f, 7f));
|
||||
var payload = MessagePackSerializer.Serialize(rect);
|
||||
var decoded = MessagePackSerializer.Deserialize<CultRect>(payload);
|
||||
var rect = new CultRect(new float2(5f, -2f), new float2(-1f, 7f));
|
||||
var options = CultDocumentMessagePackSerialization.OptionsFor(typeof(CultRect));
|
||||
var payload = MessagePackSerializer.Serialize(rect, options);
|
||||
var decoded = MessagePackSerializer.Deserialize<CultRect>(payload, options);
|
||||
|
||||
decoded.Should().Be(rect);
|
||||
decoded.Min.Should().Be(new CultVec2(-1f, -2f));
|
||||
decoded.Max.Should().Be(new CultVec2(5f, 7f));
|
||||
decoded.Min.Should().Be(new float2(-1f, -2f));
|
||||
decoded.Max.Should().Be(new float2(5f, 7f));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GeometryPrimitives_JsonOmitsComputedConvenienceProperties()
|
||||
public void GeometryPrimitive_JsonInspectionProjection_UsesLowercaseComponents()
|
||||
{
|
||||
var json = JsonSerializer.Serialize(new CultVec3(1f, 2f, 3f));
|
||||
var value = new float3(1f, 2f, 3f);
|
||||
var json = JsonSerializer.Serialize(new { value.x, value.y, value.z });
|
||||
|
||||
json.Should().Be("""{"X":1,"Y":2,"Z":3}""");
|
||||
json.Should().NotContain("LengthSquared");
|
||||
json.Should().NotContain("Xy");
|
||||
json.Should().NotContain("Xz");
|
||||
json.Should().Contain("\"x\":1");
|
||||
json.Should().Contain("\"y\":2");
|
||||
json.Should().Contain("\"z\":3");
|
||||
json.Should().NotContain("\"X\"");
|
||||
json.Should().NotContain("\"Y\"");
|
||||
json.Should().NotContain("\"Z\"");
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
|
|
|||
Loading…
Reference in a new issue