Vixen
02b45cc4
csharp
public interface ISceneComponentBinder

Reads and writes one component type as part of a compiled scene.

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

Remarks

The join between three things that each know a different half of the job: the ECS knows the component's dense id and how to put a value on an entity, the binary serializer knows how to turn the value into bytes, and the compiled scene knows only a name. This is what turns a name back into a write into a chunk.

A binder is not generic and the implementation is. A scene's blocks are walked with the component types known only from strings, so the walk has to hold these behind a common shape; closing the generic at registration keeps every read and write statically bound and boxes nothing — which is the same trade DataSerializer`1 makes and for the same reason.

Fields and properties (4)

  • string Name

    The name a compiled scene carries — the component's [DataContract] alias.

  • Type ComponentType

    The CLR type.

  • ComponentTypeId TypeId

    Its dense id, which is what an archetype is built from.

  • bool IsTag

    Whether it is a data-free tag, and so has no bytes in a column at all.

Methods (7)

  • void Read(ref SerializationReader reader, World world, Entity entity)

    Reads one value out of a column and writes it onto an entity.

  • void Write(ref SerializationWriter writer, World world, Entity entity)

    Writes one entity's value into a column.

  • void WriteValue(ref SerializationWriter writer, object value)

    Writes a value that is not on an entity into a column.

  • object ValueOn(World world, Entity entity)

    Reads an entity's value as an object.

  • void AddTo(World world, Entity entity, object value)

    Puts a value on an entity, adding the component if it is not there.

  • bool Has(World world, Entity entity)

    Whether an entity carries this component.

  • bool RemoveFrom(World world, Entity entity)

    Takes the component off an entity.

Used by (16)

  • ComponentRegistrationTestsVixen.Engine.Tests
  • ContractColumnVixen.Engine
  • LightExtractionTestsVixen.Rendering.Tests
  • PhysicsSceneComponentTestsVixen.Physics.Tests
  • SceneBehaviorRegistryVixen.Engine
  • SceneComponentBinderVixen.Engine
  • SceneComponentRegistryVixen.Engine
  • SceneContentVixen.Engine
  • WorldSerializerVixen.Engine
  • AuthoredComponentVixen.Editor.Assets
  • EditorApplicationVixen.Editor.App
  • RegisteredVixen.Editor.App
  • SceneCloneVixen.Editor.SceneView
  • SceneCompilerVixen.Editor.Assets
  • SceneComponentBridgeVixen.Editor.SceneView
  • SceneSerializerVixen.Editor.SceneView