GetEmissionVolume

This function returns the emitter's emission volume, the area in which a particle may spawn.

Syntax

Returns

This function returns a Vec3 containing the emitter's emission volume.

Example

#include "Leadwerks.h"

using namespace Leadwerks;

int main(int argc, const char *argv[])
{
Leadwerks::Window* window = Leadwerks::Window::Create();
Context* context = Context::Create(window);
World* world = World::Create();
Camera* camera = Camera::Create();
camera->SetRotation(35, 0, 0);
camera->Move(0, 0, -3);
Light* light = DirectionalLight::Create();
light->SetRotation(35, 35, 0);

//Create an emitter
Emitter* emitter = Emitter::Create(100);
float sz = 1.0;
emitter->SetEmissionVolume(sz, sz, sz);

while (true)
{
if (window->Closed() || window->KeyDown(Key::Escape)) return false;

Leadwerks::Leadwerks::Time::Update();
world->Update();
world->Render();

if (window->KeyDown(Key::Up))
{
sz = sz + 0.05;
emitter->SetEmissionVolume(sz, sz, sz);
}
else if (window->KeyDown(Key::Down))
{
sz = sz - 0.05;
sz = max(sz, 0.0f);
emitter->SetEmissionVolume(sz, sz, sz);
}

context->SetBlendMode(Blend::Alpha);
context->DrawText("Emission volume: " + emitter->GetEmissionVolume().ToString(), 0, 0);

context->Sync();
}
}