Vixen
02b45cc4
csharp
public static class MathScalars

How a vector, a rotation and a colour read in any of Vixen's YAML documents.

No guide page documents this yet — the page shows what the code says about itself.

Remarks

One scalar, not a mapping. A transform written as nested x/y/z keys is fifteen lines per entity and a diff nobody can scan; position: 1 2 3 is one line and reads as the thing it is. The same argument doc 08 makes for a reference being a prefixed scalar rather than a three-key flow mapping.

⚠ This is why the format needs converters at all. The YAML binder builds a value from a described type's members, and Vixen.Core.Mathematics carries the serialisation generator but not the reflection one — its types have binary serializers and no TypeDescriptor. Registering a converter is the narrow fix; the wide one is making the mathematics assembly depend on the type registry, which is a cost every shipping game would pay for a decision the editor's file format wanted.

Here rather than in the scene format, because a material is the second document to want them. SceneScalars owned these for as long as a scene was the only file holding a Vector3; a .vxmat's feature list holds one too, and it is read by the runtime, which cannot reference an editor assembly. Two registrations of one type would be two spellings of a colour resolved by whichever assembly happened to load second — so there is one, and it sits below both.

⚠ Still an explicit call rather than a module initializer, which is the property SceneScalars was careful about and this keeps: the converter table is process-wide, so registering on load would mean that merely referencing this assembly changed how every other document in the process reads a vector.

⚠ Round-trip precision, so "R" and not a fixed number of places. A file saved, reopened and saved again has to produce the same bytes — a format that quietly rounded would make every open-and-close a diff, and every scene a merge conflict with itself.

Methods (1)

  • public static void Register()

    Registers them, once.

Used by (9)

  • FrameDocumentTestsThirdPersonShooter.Frame.Tests
  • CompositorAssetTestsVixen.Rendering.Tests
  • CompositorImporterVixen.Editor.Assets
  • HarnessPlanImporterVixen.Editor.Assets
  • MaterialImporterVixen.Editor.Assets
  • MoveSetImporterVixen.Editor.Assets
  • ProxyShapeSetImporterVixen.Editor.Assets
  • SceneScalarsVixen.Editor.Core
  • ShapeVocabularyImporterVixen.Editor.Assets