Documentation ¶
Index ¶
- Variables
- type ConeSpawner
- func (cone *ConeSpawner) CreateRenderable() *fizzle.Renderable
- func (cone *ConeSpawner) DrawSpawnVolume(r renderer.Renderer, shader *fizzle.RenderShader, projection mgl.Mat4, ...)
- func (cone *ConeSpawner) GetLocation() mgl.Vec3
- func (cone *ConeSpawner) GetName() string
- func (cone *ConeSpawner) NewParticle() (p Particle)
- func (cone *ConeSpawner) SetOwner(e *Emitter)
- type CubeSpawner
- func (cube *CubeSpawner) CreateRenderable() *fizzle.Renderable
- func (cube *CubeSpawner) DrawSpawnVolume(r renderer.Renderer, shader *fizzle.RenderShader, projection mgl.Mat4, ...)
- func (cube *CubeSpawner) GetLocation() mgl.Vec3
- func (cube *CubeSpawner) GetName() string
- func (cube *CubeSpawner) NewParticle() (p Particle)
- func (cube *CubeSpawner) SetOwner(e *Emitter)
- type Emitter
- type EmitterProperties
- type Particle
- type ParticleSpawner
- type System
Constants ¶
This section is empty.
Variables ¶
var ( // VertShader330 is the GLSL vertex shader program for the basic particle emitter. VertShader330 = `` /* 224-byte string literal not displayed */ // FragShader330 is the GLSL fragment shader program for the asic bparticle emitter. FragShader330 = `` /* 161-byte string literal not displayed */ )
Functions ¶
This section is empty.
Types ¶
type ConeSpawner ¶
type ConeSpawner struct { BottomRadius float32 TopRadius float32 Length float32 Owner *Emitter // contains filtered or unexported fields }
ConeSpawner is a particle spawner that creates particles within the volume of a cone as specified by the settings in the struct.
func NewConeSpawner ¶
func NewConeSpawner(owner *Emitter, br, tr, cl float32) *ConeSpawner
NewConeSpawner creates a new cone shaped particle spawner.
func (*ConeSpawner) CreateRenderable ¶
func (cone *ConeSpawner) CreateRenderable() *fizzle.Renderable
CreateRenderable creates a cached renderable for the spawner that represents the spawning volume for particles.
func (*ConeSpawner) DrawSpawnVolume ¶
func (cone *ConeSpawner) DrawSpawnVolume(r renderer.Renderer, shader *fizzle.RenderShader, projection mgl.Mat4, view mgl.Mat4, camera fizzle.Camera)
DrawSpawnVolume renders a visual representation of the particle spawning volume.
func (*ConeSpawner) GetLocation ¶
func (cone *ConeSpawner) GetLocation() mgl.Vec3
GetLocation returns the location in world space for the cone spawner.
func (*ConeSpawner) GetName ¶
func (cone *ConeSpawner) GetName() string
GetName returns a user friendly name for the spawner
func (*ConeSpawner) NewParticle ¶
func (cone *ConeSpawner) NewParticle() (p Particle)
NewParticle creates a new particle that fits within the volume of a cone section.
func (*ConeSpawner) SetOwner ¶
func (cone *ConeSpawner) SetOwner(e *Emitter)
SetOwner sets the owning emitter for the spawner
type CubeSpawner ¶
type CubeSpawner struct { BottomLeft mgl.Vec3 TopRight mgl.Vec3 Owner *Emitter // contains filtered or unexported fields }
CubeSpawner is a particle spawner that creates particles within the volume of a cube as specified by the settings in the struct.
func NewCubeSpawner ¶
func NewCubeSpawner(owner *Emitter, bl, tr mgl.Vec3) *CubeSpawner
NewCubeSpawner creates a new cube shaped particle spawner.
func (*CubeSpawner) CreateRenderable ¶
func (cube *CubeSpawner) CreateRenderable() *fizzle.Renderable
CreateRenderable creates a cached renderable for the spawner that represents the spawning volume for particles.
func (*CubeSpawner) DrawSpawnVolume ¶
func (cube *CubeSpawner) DrawSpawnVolume(r renderer.Renderer, shader *fizzle.RenderShader, projection mgl.Mat4, view mgl.Mat4, camera fizzle.Camera)
DrawSpawnVolume renders a visual representation of the particle spawning volume.
func (*CubeSpawner) GetLocation ¶
func (cube *CubeSpawner) GetLocation() mgl.Vec3
GetLocation returns the location in world space for the spawner.
func (*CubeSpawner) GetName ¶
func (cube *CubeSpawner) GetName() string
GetName returns a user friendly name for the spawner
func (*CubeSpawner) NewParticle ¶
func (cube *CubeSpawner) NewParticle() (p Particle)
NewParticle creates a new particle that fits within the volume of a cone section.
func (*CubeSpawner) SetOwner ¶
func (cube *CubeSpawner) SetOwner(e *Emitter)
SetOwner sets the owning emitter for the spawner
type Emitter ¶
type Emitter struct { Owner *System Particles []Particle Texture graphics.Texture Shader graphics.Program Properties EmitterProperties Spawner ParticleSpawner // contains filtered or unexported fields }
Emitter is a particle emmiter object that will keep track of all of the particles created by the emitter and update them accordingly.
func (*Emitter) GetLocation ¶
GetLocation returns the emitter location in world space.
func (*Emitter) LoadTexture ¶
LoadTexture will load the Properties.TextureFilepath and create an OpenGL texture with it.
type EmitterProperties ¶
type EmitterProperties struct { TextureFilepath string MaxParticles uint SpawnRate uint // particles per second Velocity mgl.Vec3 // should be normalized Speed float32 Acceleration mgl.Vec3 TTL float64 // in seconds Origin mgl.Vec3 // relative to Emitter.Owner.Origin Rotation mgl.Quat Color mgl.Vec4 Size float32 }
EmitterProperties describes the behavior of an Emitter object and is it's own type to facilitate sharing of parameter defaults and serialization.
type Particle ¶
type Particle struct { Size float32 Color mgl.Vec4 Location mgl.Vec3 Velocity mgl.Vec3 // should be normalized Speed float32 Acceleration mgl.Vec3 EndTime float64 StartTime float64 }
Particle is an individual particle in an Emitter.
type ParticleSpawner ¶
type ParticleSpawner interface { // NewParticle creates a new particle for the emitter NewParticle() Particle // DrawSpawnVolume draws an object on screen, probably a wireframe object, representing the spawn volume DrawSpawnVolume(r renderer.Renderer, shader *fizzle.RenderShader, projection mgl.Mat4, view mgl.Mat4, camera fizzle.Camera) // GetLocation returns the location of the spawner GetLocation() mgl.Vec3 // GetName returns a user friendly name for the spawner GetName() string // SetOwner sets the owning emitter for the spawner SetOwner(e *Emitter) // CreateRenderable creates a cached renderable for the spawner that represents // the spawning volume for particles. CreateRenderable() *fizzle.Renderable }
ParticleSpawner is a type of interface for objects that are able to spawn particles for a particle emitter.
type System ¶
type System struct { Emitters []*Emitter Origin mgl.Vec3 IsActive bool IsEmitting bool // contains filtered or unexported fields }
System is a particle system master collection that keeps track of all of the particle emitters and updates them accordingly.
func NewSystem ¶
func NewSystem(gfx graphics.GraphicsProvider) *System
NewSystem creates a new particle system.
func (*System) GetTransform ¶
GetTransform returns the transform matrix for the system as a whole.
func (*System) NewEmitter ¶
func (s *System) NewEmitter(optProps *EmitterProperties) *Emitter
NewEmitter is it creates a new particle emitter and keeps track of it for updating. An optional set of emitter properties can be specified.