Toast Engine
Loading...
Searching...
No Matches
toast::_detail Namespace Reference

Member-robber pattern used by the generated reflection code. More...

Classes

struct  Accessor
struct  ControlBox
 Reference-count control block embedded inside the Node allocation. More...
struct  Defer
struct  ExecuteOptions
class  ItemRunner
struct  NodeCluster
struct  Robber
struct  TickSchedule
struct  WaveJob
struct  WorldTestAccess

Typedefs

using Interactions = std::unordered_map<Box<Node>, std::vector<Box<Node>>>
 For a node, the nodes whose scripts it calls or is called by, see Node::interactsWith().

Enumerations

enum  : uint8_t { k_message_outside = 40 , k_message_misaligned = 41 }

Functions

void TOAST_API callNodeScripts (Node *node, std::string_view name, std::span< const std::any > args) noexcept
void TOAST_API setNodeScriptVar (Node *node, std::string_view name, const std::any &value) noexcept
auto TOAST_API getNodeScriptVar (const Node *node, std::string_view name) noexcept -> std::any
template<typename R = void, typename... Args>
auto callMethodChain (const NodeInfo *info, void *obj, std::string_view method_name, const Args &... args) -> R
auto toVoxel (glm::vec3 pos) noexcept -> glm::ivec3
auto toId (int id) noexcept -> uint8_t
template<typename T>
auto assetOfType (const assets::Handle< T > &handle, std::string_view type) -> const T *
auto instantiateModel (const assets::VoxelModel &model) -> std::unique_ptr< voxel::Volume >
auto planWave (const TickSchedule::Wave &wave, TickFunctionList func, const Interactions *interactions=nullptr) -> std::vector< WaveJob >
 Splits a wave into the jobs that run it in parallel.
void runJobs (const std::vector< WaveJob > &jobs, size_t item_count, ItemRunner run_item, const ExecuteOptions &options={})
 Runs the jobs of a plan in parallel and returns once every item has run.

Variables

template<typename Tag, typename Tag::type Ptr>
Robber< Tag, Ptr > Robber< Tag, Ptr >::instance
constexpr std::string_view asset_uri = "asset://"
constexpr std::string_view artwork_uri = "artwork://"
constexpr std::string_view node_uri = "node://"
std::string assets_path
std::string artworks_path

Detailed Description

Member-robber pattern used by the generated reflection code.

A Robber<Tag,Ptr> static instance runs at startup and writes the private member pointer Ptr into the public Accessor<Tag>::member. This is the only standards-conforming way to obtain a pointer-to-private-member at compile time without modifying the Node class header.

Note
This namespace is an implementation detail; user code should never reference it directly

Enumeration Type Documentation

◆ anonymous enum

anonymous enum : uint8_t

Inspector message ids the procedural pieces use

Function Documentation

◆ assetOfType()

template<typename T>
auto toast::_detail::assetOfType ( const assets::Handle< T > & handle,
std::string_view type ) -> const T *
nodiscard

The loaded asset when it is really of type, null otherwise

Here is the caller graph for this function:

◆ instantiateModel()

auto toast::_detail::instantiateModel ( const assets::VoxelModel & model) -> std::unique_ptr< voxel::Volume >
inlinenodiscard

Loads a model into the procedural pool

Here is the caller graph for this function:

◆ planWave()

TOAST_API auto toast::_detail::planWave ( const TickSchedule::Wave & wave,
TickFunctionList func,
const Interactions * interactions = nullptr ) -> std::vector< WaveJob >

Splits a wave into the jobs that run it in parallel.

Everything that runs Lua on the same interpreter ends up in one job

A cluster that spans interpreters ties them together into one job

Here is the caller graph for this function:

◆ runJobs()

TOAST_API void toast::_detail::runJobs ( const std::vector< WaveJob > & jobs,
size_t item_count,
ItemRunner run_item,
const ExecuteOptions & options = {} )

Runs the jobs of a plan in parallel and returns once every item has run.

Parameters
item_countHow many items the plan has, every item in exactly one job
Here is the caller graph for this function:

◆ toId()

auto toast::_detail::toId ( int id) -> uint8_t
inlinenodiscardnoexcept

Clamps a script id to a palette id

Here is the caller graph for this function:

◆ toVoxel()

auto toast::_detail::toVoxel ( glm::vec3 pos) -> glm::ivec3
inlinenodiscardnoexcept

Snaps a position to the voxel it falls in

Here is the caller graph for this function: