GetEmissionShape

This function returns the emitter's emission shape

Syntax

Returns

This function returns an integer that represents an emissions shape: Cube = 0 Sphere = 1 Cylinder = 2 Tube = 3 Torus = 4 Cone = 5

Example

--Create a window
window = Window:Create()
context = Context:Create(window)
world = World:Create()
camera = Camera:Create()
camera:Move(0,0,-3)
local light = DirectionalLight:Create()
light:SetRotation(35,35,0)

local emissionshape = 0

--Create an emitter
emitter = Emitter:Create(1000)
emitter:SetVelocity(0,0,0,0)
emitter:SetVelocity(0,0,0,1)
emitter:SetEmissionShape(emissionshape)

while true do

if window:Closed() or window:KeyHit(Key.Escape) then return false end

Time:Update()
world:Update()
world:Render()

if (window:KeyHit(Key.Up) and emissionshape < 5) then
emissionshape = emissionshape +1
emitter:SetEmissionShape(emissionshape)
elseif (window:KeyHit(Key.Down) and emissionshape > 0) then
emissionshape = emissionshape - 1
emitter:SetEmissionShape(emissionshape)
end

context:SetBlendMode(Blend.Alpha)
if (emitter:GetEmissionShape() == 0) then
context:DrawText("Emission Shape: Cube" ,2,2)
elseif (emitter:GetEmissionShape() == 1) then
context:DrawText("Emission Shape: Sphere" ,2,2)
elseif (emitter:GetEmissionShape() == 2) then
context:DrawText("Emission Shape: Cylinder" ,2,2)
elseif (emitter:GetEmissionShape() == 3) then
context:DrawText("Emission Shape: Tube" ,2,2)
elseif (emitter:GetEmissionShape() == 4) then
context:DrawText("Emission Shape: Torus" ,2,2)
elseif (emitter:GetEmissionShape() == 5) then
context:DrawText("Emission Shape: Cone" ,2,2)
end

context:Sync()
end