Toast Engine
Loading...
Searching...
No Matches
example::DebrisSimulation Class Reference

Debris particles integrated on the async compute queue. More...

#include <debris_simulation.hpp>

Inheritance diagram for example::DebrisSimulation:
Collaboration diagram for example::DebrisSimulation:

Public Member Functions

void spawn (std::span< const glm::vec4 > positions, std::span< const glm::vec4 > velocities)
 Physics thread before the first step.
void step (float dt)
 Physics thread. Returns right away.
auto readPositions (std::span< glm::vec4 > out) -> bool
 Physics thread. Newest finished positions and false until one exists.
auto positionsId () const -> BufferId
 For the render pass. xyz position w radius.
Public Member Functions inherited from renderer::AsyncComputeTask
 AsyncComputeTask (const AsyncComputeTask &)=delete
auto operator= (const AsyncComputeTask &) -> AsyncComputeTask &=delete
 AsyncComputeTask (AsyncComputeTask &&)=delete
auto operator= (AsyncComputeTask &&) -> AsyncComputeTask &=delete
auto acquireForFrame (vk::CommandBuffer cmd, uint32_t frame_index, sync::Usage next) -> FrameView
auto read (BufferId id, std::span< std::byte > out) -> bool
 Newest finished CPU copy of a ring buffer added with cpu_readback and false until one exists.
template<typename T>
auto read (BufferId id, std::span< T > out) -> bool
auto finishedStep () const -> uint64_t
 Steps finished so far.
auto isReady () const -> bool

Static Public Attributes

static constexpr uint32_t k_max_particles = 65536

Additional Inherited Members

Public Types inherited from renderer::AsyncComputeTask
enum class  Copy : uint8_t { current , previous }
 Which copy of a ring buffer a binding sees during a step. More...
using BufferId = uint32_t
Protected Member Functions inherited from renderer::AsyncComputeTask
 AsyncComputeTask (Config config)
auto addRingBuffer (vk::DeviceSize size, bool cpu_readback=false) -> BufferId
 Constructor only.
auto addPersistentBuffer (vk::DeviceSize size) -> BufferId
auto addHostBuffer (vk::DeviceSize size) -> BufferId
void bind (uint32_t binding, BufferId id, Copy copy=Copy::current)
void bindExternal (uint32_t set, uint32_t binding, std::function< vk::Buffer()> source)
void setAcquireUsage (BufferId id, sync::Usage usage)
void upload (BufferId id, std::span< const std::byte > data)
 Owner thread, blocks until the copy landed gpu side.
template<typename T>
void upload (BufferId id, std::span< const T > data)
auto step (const std::function< void(StepContext &)> &record, std::string_view debug_name={}, std::shared_ptr< const void > keep_alive={}) -> uint64_t
 Owner thread.

Detailed Description

Debris particles integrated on the async compute queue.


The documentation for this class was generated from the following files: