Class AbstractScene

java.lang.Object
dev.engine.core.scene.AbstractScene
Direct Known Subclasses:
FlatScene, HierarchicalScene

public abstract class AbstractScene extends Object
Base class for all scene implementations. Manages entities and their components. Emits transactions when components change.

Uses TransactionBus for thread-safe transaction delivery between the logic thread (which emits) and render thread (which drains).

  • Field Details

    • RENDERER_SUBSCRIBER

      public static final Object RENDERER_SUBSCRIBER
      Well-known subscriber key for the renderer.
    • transactions

      protected final TransactionBus transactions
    • entityMap

      protected final Map<Handle<EntityTag>, Entity> entityMap
  • Constructor Details

    • AbstractScene

      protected AbstractScene()
  • Method Details

    • createEntity

      public abstract Entity createEntity()
    • destroyEntity

      public abstract void destroyEntity(Handle<EntityTag> entity)
    • getWorldTransform

      public abstract Mat4 getWorldTransform(Handle<EntityTag> entity)
    • setLocalTransform

      public void setLocalTransform(Handle<EntityTag> entity, Mat4 transform)
    • setLocalTransform

      public void setLocalTransform(Entity entity, Mat4 transform)
      Convenience overload accepting Entity directly.
    • getLocalTransform

      public Mat4 getLocalTransform(Handle<EntityTag> entity)
    • getLocalTransform

      public Mat4 getLocalTransform(Entity entity)
      Convenience overload accepting Entity directly.
    • getWorldTransform

      public Mat4 getWorldTransform(Entity entity)
      Convenience overload accepting Entity directly.
    • destroyEntity

      public void destroyEntity(Entity entity)
      Convenience: destroy by Entity reference.
    • setMaterialProperty

      public <T> void setMaterialProperty(Handle<EntityTag> entity, PropertyKey<MaterialData, T> key, T value)
    • setMaterialProperty

      public <T> void setMaterialProperty(Entity entity, PropertyKey<MaterialData, T> key, T value)
      Convenience overload accepting Entity directly.
    • setMaterialProperties

      public void setMaterialProperties(Entity entity, PropertyMap<MaterialData> props)
      Sets all material properties at once via a PropertyMap.
    • setMesh

      public void setMesh(Handle<EntityTag> entity, Handle<MeshTag> mesh)
      Legacy: assign a mesh handle to an entity.
    • setMesh

      public void setMesh(Entity entity, Handle<MeshTag> mesh)
      Legacy: assign a mesh handle to an entity by Entity reference.
    • setMaterial

      public void setMaterial(Handle<EntityTag> entity, Handle<MaterialTag> material)
      Legacy: assign a material handle to an entity.
    • setMaterial

      public void setMaterial(Entity entity, Handle<MaterialTag> material)
      Legacy: assign a material handle to an entity by Entity reference.
    • entity

      public Entity entity(Handle<EntityTag> handle)
    • query

      public List<Entity> query(Class<? extends Component>... types)
    • transactionBus

      public TransactionBus transactionBus()
      Returns the transaction bus for additional subscriber registration.
    • drainTransactions

      protected List<Transaction> drainTransactions()