Skip to content

package vfx

import "kaijuengine.com/rendering/vfx"

Functions

EditorReflectionOptions

func EditorReflectionOptions(name string) []string

RegisterPathFunc

func RegisterPathFunc(name string, fn func(t float64) matrix.Vec3)

Types

Emitter

struct

type Emitter struct {
    Config EmitterConfig

    // Has unexported fields.
}

Emitter.Activate

func (e *Emitter) Activate()

Emitter.Deactivate

func (e *Emitter) Deactivate()

Emitter.Destroy

func (e *Emitter) Destroy()

Emitter.ForceReloadConfig

func (e *Emitter) ForceReloadConfig(host *engine.Host)

Emitter.Initialize

func (e *Emitter) Initialize(host *engine.Host, config EmitterConfig)

Emitter.IsValid

func (e *Emitter) IsValid() bool

Emitter.ReloadConfig

func (e *Emitter) ReloadConfig(host *engine.Host)

EmitterConfig

struct

type EmitterConfig struct {
    Texture          content_id.Texture
    SpawnRate        float64
    ParticleLifeSpan float32
    LifeSpan         float64
    Offset           matrix.Vec3
    // SpawnArea is the half-extents of a box (centered on Offset) over which each
    // particle's spawn position is scattered UNIFORMLY. Zero = all particles spawn at a
    // single point (the classic fountain/cone look). Use a large area for volumetric
    // effects like rain/snow so drops fill space instead of firing from one point.
    SpawnArea matrix.Vec3
    // Size is the per-particle scale. Zero defaults to (1,1,1). Use small values for
    // fine particles (rain drops, dust).
    Size            matrix.Vec3
    DirectionMin    matrix.Vec3
    DirectionMax    matrix.Vec3
    VelocityMinMax  matrix.Vec2
    OpacityMinMax   matrix.Vec2
    Color           matrix.Color
    PathFuncName    string                      `options:"PathFuncName"`
    PathFunc        func(t float64) matrix.Vec3 `visible:"hidden" json:"-"`
    PathFuncOffset  float64
    PathFuncScale   float32
    PathFuncSpeed   float32
    FadeOutOverLife bool
    Burst           bool
    Repeat          bool
}

Particle

struct

type Particle struct {
    Transform       particleTransformation
    Velocity        particleTransformation
    OpacityVelocity float32
    LifeSpan        float32
}

ParticleSystem

struct

type ParticleSystem struct {
    Emitters []Emitter
    // Has unexported fields.
}

ParticleSystem.Activate

func (p *ParticleSystem) Activate()

ParticleSystem.AddEmitter

func (p *ParticleSystem) AddEmitter(cfg EmitterConfig) *Emitter

ParticleSystem.Clear

func (p *ParticleSystem) Clear()

ParticleSystem.Deactivate

func (p *ParticleSystem) Deactivate()

ParticleSystem.Destroy

func (p *ParticleSystem) Destroy()

ParticleSystem.Initialize

func (p *ParticleSystem) Initialize(host *engine.Host, entity *engine.Entity, spec ParticleSystemSpec)

ParticleSystem.IsValid

func (p *ParticleSystem) IsValid() bool

ParticleSystem.LoadSpec

func (p *ParticleSystem) LoadSpec(host *engine.Host, spec ParticleSystemSpec)

ParticleSystem.RemoveEmitter

func (p *ParticleSystem) RemoveEmitter(idx int)

ParticleSystemSpec

[]EmitterConfig

type ParticleSystemSpec []EmitterConfig

LoadSpec

func LoadSpec(host *engine.Host, id string) (ParticleSystemSpec, error)