das中的资源槽

存储在 das+ecs 中更方便。

不过,我们可以使用 daBfg.resource_slot 模块在 ecs 之外存储 NodeHandleWithSlotsAccess

遗憾的是,NodeHandleWithSlotsAccess 无法存储在本地 das 变量中,因为 das 不会调用本地类型的析构函数。 如果真的需要在 ecs 外部存储句柄,就必须在堆中存储句柄,或在 cpp 端绑定存储句柄。

对于 ecs 内的节点,热重载也会自动工作。

require daBfg.resource_slot

some_cpp_binding <| $(var handle : NodeHandleWithSlotsAccess &)
  some_struct.handle <- root() |> registerAccess("node_name", [[SlotActions update <- [{auto Update("slot_name", "texture_name", 100)}] ]]) <| @(slots_state; var registry : Registry)

    return <- @ <|
      // some render code

Constants

DEFAULT_READ_PRIORITY = 2147483647

|variable-resource_slot-DEFAULT_READ_PRIORITY|

Create

Create fields are

slot

string

resource

string

|structure-resource_slot-Create|

Update

Update fields are

slot

string

resource

string

priority

int

|structure-resource_slot-Update|

Read

Read fields are

slot

string

priority

int

|structure-resource_slot-Read|

SlotActions

SlotActions fields are

create

array< resource_slot::Create >

update

array< resource_slot::Update >

read

array< resource_slot::Read >

|structure-resource_slot-SlotActions|

Register access

registerAccess(self: NameSpace; name: string const; slot_decl: SlotActions const; declaration_callback: lambda<(slots_state:ResourceSlotCore::State const;var reg:daBfg::Registry -const):lambda<void>>)

registerAccess returns ResourceSlotCore::NodeHandleWithSlotsAccess

argument

argument type

self

daBfg::NameSpace

name

string const

slot_decl

resource_slot::SlotActions const

declaration_callback

lambda<(slots_state: ResourceSlotCore::State const;reg: daBfg::Registry ):lambda<>>

|function-resource_slot-registerAccess|