| None. |
|
Returns 1 when the active graphics device supports the GPU particle path. The result is 0 before Graphics3D, after graphics shutdown, or when the DX12 device is unavailable. This query does not allocate an emitter or particle pool and does not clear ParticleError. Support does not guarantee that a requested capacity fits the current memory budget: always check the result of CreateGPUParticleEmitter as well. The example displays capability before and after graphics initialization. See also: CreateGPUParticleEmitter, ParticleError, ParticleBackend. |
; GPUParticlesSupported Example
; -----------------------------
; Before Graphics3D there is no device, so support reads 0
before_graphics=GPUParticlesSupported()
Graphics3D 640,480,0,2
SetBuffer BackBuffer()
If GPUParticlesSupported()=0 Then RuntimeError "GPU particles are unavailable."
camera=CreateCamera()
PositionEntity camera,0,1,-5
CameraClsColor camera,10,15,30
emitter=CreateGPUParticleEmitter(10000)
If emitter=0 Then RuntimeError ParticleError$()
; Preset 1 is a fire fountain
ParticlePreset emitter,1
; A fixed timer keeps the simulation stepping at 60 updates per second
timer=CreateTimer(60)
paused=False
While Not KeyDown(1)
; P pauses the simulation, Space adds a burst, R clears all particles
If KeyHit(25)
paused=Not paused
PauseParticles emitter,paused
EndIf
If KeyHit(57) Then EmitParticles emitter,100
If KeyHit(19) Then ClearParticles emitter
; Arrow keys move the camera
If KeyDown(200) Then MoveEntity camera,0,0,0.1
If KeyDown(208) Then MoveEntity camera,0,0,-0.1
If KeyDown(203) Then TurnEntity camera,0,1,0
If KeyDown(205) Then TurnEntity camera,0,-1,0
ticks=WaitTimer(timer)
If ticks>15 Then ticks=15
For tick=1 To ticks
UpdateWorld
Next
RenderWorld
Color 255,255,255
Text 0,0,"Arrow keys: move camera P: pause Space: burst R: clear Esc: exit"
Text 0,20,"GPUParticlesSupported() before Graphics3D: "+before_graphics+" now: "+GPUParticlesSupported()
Text 0,40,"Support does not guarantee capacity - always check the constructor too"
Flip
Wend
FreeTimer timer
FreeEntity emitter
End