Nebula
Loading...
Searching...
No Matches
Particles::ParticleContext Class Reference

#include <particlecontext.h>

Inherits Graphics::GraphicsContext.

Classes

struct  ParticleJobOutput
 
struct  ParticleRuntime
 
struct  ParticleSystemRuntime
 

Public Types

enum  PlayMode { RestartIfPlaying , IgnoreIfPlaying }
 

Public Member Functions

 ParticleContext ()
 constructor
 
virtual ~ParticleContext ()
 destrucotr
 
- Public Member Functions inherited from Graphics::GraphicsContext
 GraphicsContext ()
 constructor
 
virtual ~GraphicsContext ()
 destructor
 

Static Public Member Functions

static void Create ()
 create particle context
 
static void Setup (const Graphics::GraphicsEntityId id)
 setup particle context on model
 
static void ShowParticle (const Graphics::GraphicsEntityId id)
 show particle based on index fetched from GetParticleId
 
static void HideParticle (const Graphics::GraphicsEntityId id)
 hide particle
 
static void Play (const Graphics::GraphicsEntityId id, const PlayMode mode)
 start playing particle
 
static void Stop (const Graphics::GraphicsEntityId id)
 stop playing a particle
 
static void UpdateParticles (const Graphics::FrameContext &ctx)
 start particle updating when frame starts
 
static void OnPrepareView (const Ptr< Graphics::View > &view, const Graphics::FrameContext &ctx)
 prepare particles for current view
 
static void WaitForParticleUpdates (const Graphics::FrameContext &ctx)
 stop particle updating when frame ends
 
static CoreGraphics::BufferId GetParticleIndexBuffer ()
 get the shared particle index buffer
 
static CoreGraphics::BufferId GetParticleVertexBuffer ()
 get the shared vertex buffer
 
static CoreGraphics::VertexLayoutId GetParticleVertexLayout ()
 get the shared vertex layout
 
static CoreGraphics::PrimitiveGroupGetParticlePrimitiveGroup ()
 get the shared primitive group
 
static void OnRenderDebug (uint32_t flags)
 debug rendering
 

Static Public Attributes

static CoreGraphics::MeshId DefaultEmitterMesh
 
static Threading::AtomicCounter ConstantUpdateCounter = 0
 
static Threading::Event totalCompletionEvent
 

Private Types

enum  { ParticleSystems , ModelId , Runtime , ModelContextId }
 
typedef Ids::IdAllocator< Util::Array< ParticleSystemRuntime >, Graphics::ContextEntityId, ParticleRuntime, Graphics::GraphicsEntityIdParticleContextAllocator
 

Private Member Functions

 __DeclareContext ()
 

Static Private Member Functions

static void EmitParticles (ParticleRuntime &rt, ParticleSystemRuntime &srt, Models::ParticleSystemNode *node, float stepTime)
 internal function for emitting new particles
 
static void EmitParticle (ParticleRuntime &rt, ParticleSystemRuntime &srt, const Particles::EmitterAttrs &attrs, const Particles::EmitterMesh &mesh, const Particles::EnvelopeSampleBuffer &buffer, IndexT sampleIndex, float initialAge)
 internal function for emitting single particle
 
static void RunParticleStep (ParticleRuntime &rt, ParticleSystemRuntime &srt, float stepTime, bool generateVtxList)
 internal function to emit a job for updating particles
 
static Graphics::ContextEntityId Alloc ()
 allocate a new slice for this context
 
static void Dealloc (Graphics::ContextEntityId id)
 deallocate a slice
 

Static Private Attributes

static ParticleContextAllocator particleContextAllocator
 

Additional Inherited Members

- Static Protected Member Functions inherited from Graphics::GraphicsContext
static void InternalRegisterEntity (const Graphics::GraphicsEntityId id, Graphics::GraphicsContextState &&state)
 
static void InternalDeregisterEntity (const Graphics::GraphicsEntityId id, Graphics::GraphicsContextState &&state)
 
template<class ID_ALLOCATOR >
static void InternalDefragment (ID_ALLOCATOR &allocator, Graphics::GraphicsContextState &&state)
 

Member Typedef Documentation

◆ ParticleContextAllocator

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
private
Enumerator
ParticleSystems 
ModelId 
Runtime 
ModelContextId 

◆ PlayMode

Enumerator
RestartIfPlaying 
IgnoreIfPlaying 

Constructor & Destructor Documentation

◆ ParticleContext()

Particles::ParticleContext::ParticleContext ( )

constructor

◆ ~ParticleContext()

Particles::ParticleContext::~ParticleContext ( )
virtual

destrucotr

Member Function Documentation

◆ __DeclareContext()

Particles::ParticleContext::__DeclareContext ( )
private

◆ Alloc()

Graphics::ContextEntityId Particles::ParticleContext::Alloc ( )
inlinestaticprivate

allocate a new slice for this context

◆ Create()

void Particles::ParticleContext::Create ( )
static

create particle context

◆ Dealloc()

void Particles::ParticleContext::Dealloc ( Graphics::ContextEntityId id)
inlinestaticprivate

deallocate a slice

◆ EmitParticle()

void Particles::ParticleContext::EmitParticle ( ParticleRuntime & rt,
ParticleSystemRuntime & srt,
const Particles::EmitterAttrs & attrs,
const Particles::EmitterMesh & mesh,
const Particles::EnvelopeSampleBuffer & buffer,
IndexT sampleIndex,
float initialAge )
staticprivate

internal function for emitting single particle

◆ EmitParticles()

void Particles::ParticleContext::EmitParticles ( ParticleRuntime & rt,
ParticleSystemRuntime & srt,
Models::ParticleSystemNode * node,
float stepTime )
staticprivate

internal function for emitting new particles

◆ GetParticleIndexBuffer()

CoreGraphics::BufferId Particles::ParticleContext::GetParticleIndexBuffer ( )
static

get the shared particle index buffer

◆ GetParticlePrimitiveGroup()

CoreGraphics::PrimitiveGroup & Particles::ParticleContext::GetParticlePrimitiveGroup ( )
static

get the shared primitive group

◆ GetParticleVertexBuffer()

CoreGraphics::BufferId Particles::ParticleContext::GetParticleVertexBuffer ( )
static

get the shared vertex buffer

◆ GetParticleVertexLayout()

CoreGraphics::VertexLayoutId Particles::ParticleContext::GetParticleVertexLayout ( )
static

get the shared vertex layout

◆ HideParticle()

void Particles::ParticleContext::HideParticle ( const Graphics::GraphicsEntityId id)
static

hide particle

◆ OnPrepareView()

void Particles::ParticleContext::OnPrepareView ( const Ptr< Graphics::View > & view,
const Graphics::FrameContext & ctx )
static

prepare particles for current view

◆ OnRenderDebug()

void Particles::ParticleContext::OnRenderDebug ( uint32_t flags)
static

debug rendering

◆ Play()

void Particles::ParticleContext::Play ( const Graphics::GraphicsEntityId id,
const PlayMode mode )
static

start playing particle

◆ RunParticleStep()

void Particles::ParticleContext::RunParticleStep ( ParticleRuntime & rt,
ParticleSystemRuntime & srt,
float stepTime,
bool generateVtxList )
staticprivate

internal function to emit a job for updating particles

◆ Setup()

void Particles::ParticleContext::Setup ( const Graphics::GraphicsEntityId id)
static

setup particle context on model

◆ ShowParticle()

void Particles::ParticleContext::ShowParticle ( const Graphics::GraphicsEntityId id)
static

show particle based on index fetched from GetParticleId

◆ Stop()

void Particles::ParticleContext::Stop ( const Graphics::GraphicsEntityId id)
static

stop playing a particle

◆ UpdateParticles()

void Particles::ParticleContext::UpdateParticles ( const Graphics::FrameContext & ctx)
static

start particle updating when frame starts

◆ WaitForParticleUpdates()

void Particles::ParticleContext::WaitForParticleUpdates ( const Graphics::FrameContext & ctx)
static

stop particle updating when frame ends

Member Data Documentation

◆ ConstantUpdateCounter

Threading::AtomicCounter Particles::ParticleContext::ConstantUpdateCounter = 0
static

◆ DefaultEmitterMesh

CoreGraphics::MeshId Particles::ParticleContext::DefaultEmitterMesh
static

◆ particleContextAllocator

ParticleContext::ParticleContextAllocator Particles::ParticleContext::particleContextAllocator
staticprivate

◆ totalCompletionEvent

Threading::Event Particles::ParticleContext::totalCompletionEvent
static

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