GPU Particles
self:set_layer
ClientDraws this emitter only into a rendertarget instead of the main view
Syntax
local status = self:set_layer(
rendertarget = nil
)Only the rendertarget sees the emitter.
- Rendertarget — the emitter is drawn into its own 3D view, which mirrors the main camera.
- Main view —
nildraws the emitter into the main view again. - Destroying — call
self:set_layer()before destroying the rendertarget.
Parameters
| Type | Name | Description |
|---|---|---|
rendertarget | rendertarget | Rendertarget that draws this emitter Omitting this argument restores the main view |
Returns
| Type | Name | Description |
|---|---|---|
bool | status | true on successful execution, false otherwise |
Examples
local ring = particle.gpu.create()
local shader = core.shader.create("ring.gdshader", core.shader.shader_mode.SPATIAL)
local buffer = core.rendertarget.create({960, 540}, true, true)
ring:set_material(shader)
ring:set_layer(buffer) -- nothing is seen on screen, the ring pixels end up in `buffer`