Vixen
02b45cc4
csharp
public sealed class SceneContent

A compiled entity hierarchy: the runtime form of an authored scene or prefab.

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

Remarks

This is the shape the authoring format is compiled *into*, and the two are shaped by opposite forces. A .vxscene nests its entities, spells its numbers out and is built to be read by a person and merged by git. This is flat, positional and binary, and is built to be turned into a world in one pass — see SceneSerializer for the other half of the bargain.

Entities are stored in the order they must be created: a parent before anything that hangs from it. Parents holds an index rather than an identity, so rebuilding the hierarchy is an array read per entity and needs no map — which is what makes a load linear in the number of entities rather than a walk of a tree.

The transform is three columns of this rather than a component anybody can name. Every entity in a scene has one, so it costs nothing to make it universal and it removes the case where a file says two different things about where an entity is — see SceneComponentRegistry.

Fields and properties (8)

  • public int Count

    How many entities it makes.

  • public int[] Parents

    Each entity's parent, as an index into these tables, or -1 for a root.

  • public Vector3[] Positions

    Each entity's local position.

  • public Quaternion[] Rotations

    Each entity's local rotation.

  • public Vector3[] Scales

    Each entity's local scale.

  • public string[] Names

    What each entity is called, or empty when the build stripped the names.

  • public Guid[] Ids

    Each entity's authored identity, or empty when the build stripped them.

  • public SceneBlock[] Blocks

    Its entities, grouped by what they carry.

Methods (4)

  • public string NameOf(int index)

    What each entity is called, or the empty string when the names were stripped.

  • public IReadOnlyList<Entity> Instantiate(World world, Span<Entity> created, SceneHandle scene = default(SceneHandle))

    Creates every entity, with its components, its transform and its place in the tree.

  • public static SceneContent Capture(World world, IReadOnlyList<Entity> roots, IReadOnlyDictionary<Entity, string>? names = null, IReadOnlyDictionary<Entity, Guid>? ids = null)

    Compiles a subtree of a live world into content.

  • public void Validate()

    Checks that the tables agree with each other before anything is created.

Used by (16)

  • ArenaThirdPersonShooter
  • PrefabAssetVixen.Engine
  • SceneAssetVixen.Engine
  • SceneAssetTestsVixen.Engine.Tests
  • TypeRegistrationVixen.Engine
  • VixenApplicationVixen.App.Hosting
  • Vixen_Engine_Scenes_PrefabAssetSerializerVixen.Engine
  • Vixen_Engine_Scenes_SceneAssetSerializerVixen.Engine
  • Vixen_Engine_Scenes_SceneContentSerializerVixen.Engine
  • CompiledSceneTestsVixen.Editor.AssetEditors.Tests
  • CompiledSceneViewVixen.Editor.AssetEditors
  • SceneCompilerVixen.Editor.Assets
  • SceneImporterVixen.Editor.Assets
  • SceneImporterTestsVixen.Editor.Assets.Tests
  • SceneRenderComponentTestsVixen.Editor.Assets.Tests
  • StartupSceneTestsVixen.App.Tests