Documentation
¶
Index ¶
- Constants
- Variables
- func AffineTransformEqualToTransform(t1, t2 *AffineTransform) bool
- func AffineTransformInvert(t *AffineTransform, out *AffineTransform)
- func AffineTransformInvertTo(t, to *AffineTransform)
- func AffineTransformMultiply(t1 *AffineTransform, t2 *AffineTransform, out *AffineTransform)
- func AffineTransformMultiplyFrom(tA, tB *AffineTransform)
- func AffineTransformMultiplyTo(tA, tB *AffineTransform)
- func AffineTransformRotate(t *AffineTransform, out *AffineTransform, anAngle float64)
- func AffineTransformScale(t *AffineTransform, out *AffineTransform, sx, sy float64)
- func AffineTransformTranslate(t *AffineTransform, out *AffineTransform, tx, ty float64)
- func CompApplyAffineTransformTo(x, y float64, out *Vector3, t *AffineTransform)
- func Distance(x1, y1, z1, x2, y2, z2 float64) float64
- func DistanceSquared(x1, y1, z1, x2, y2, z2 float64) float64
- func Dot(x1, y1, z1, x2, y2, z2 float64) float64
- func DrawRect(x, y float64, w, h int, centered bool, color color.RGBA, pixels *image.RGBA)
- func Length(x, y, z float64) float64
- func LengthSquared(x, y, z float64) float64
- func Lerp(x1, y1, y float64) float64
- func LinearEasing(timePosition, startValue, deltaValue, duration float64) float64
- func Multiply(a, b, out *Matrix4)
- func MultiplyIntoA(a, b *Matrix4)
- type AffineTransform
- func (at *AffineTransform) ApplyTo(point *Vector3, out *Vector3)
- func (at *AffineTransform) ApplyToVector(point *Vector3, out *Vector3)
- func (at *AffineTransform) AsScale(sx, sy float64) *AffineTransform
- func (at *AffineTransform) AsTranslate(tx, ty float64) *AffineTransform
- func (at *AffineTransform) Invert()
- func (at *AffineTransform) Multiply(t1, t2 *AffineTransform)
- func (at *AffineTransform) PreMultiply(t *AffineTransform)
- func (at *AffineTransform) Rotate(angle float64)
- func (at *AffineTransform) Scale(sx, sy float64)
- func (at *AffineTransform) Set(a, b, c, d, tx, ty float64)
- func (at *AffineTransform) SetToRotate(angle float64)
- func (at *AffineTransform) SetToScale(sx, sy float64)
- func (at *AffineTransform) SetToTranslate(tx, ty float64)
- func (at *AffineTransform) SetWithAT(t *AffineTransform)
- func (at *AffineTransform) Skew(x, y float64)
- func (v AffineTransform) String() string
- func (at *AffineTransform) ToIdentity()
- func (at *AffineTransform) Translate(x, y float64)
- func (at *AffineTransform) Transpose()
- type AffineTransformPool
- type BaseNode
- func (n *BaseNode) Initialize()
- func (n *BaseNode) IsVisible() bool
- func (n *BaseNode) Name() string
- func (n *BaseNode) Position() *Vector3
- func (n *BaseNode) Render(context *RenderContext)
- func (n *BaseNode) Rotation() float64
- func (n *BaseNode) Scale() *Vector3
- func (n *BaseNode) SetColor(color color.RGBA)
- func (n *BaseNode) SetInvisible()
- func (n *BaseNode) SetName(s string)
- func (n *BaseNode) SetPosition(v *Vector3)
- func (n *BaseNode) SetPositionBy2Comp(x, y float64)
- func (n *BaseNode) SetRotation(angle float64)
- func (n *BaseNode) SetRotationByDegree(angle float64)
- func (n *BaseNode) SetScale(v *Vector3)
- func (n *BaseNode) SetScaleUniform(s float64)
- func (n *BaseNode) SetVisible()
- func (n BaseNode) String() string
- func (n *BaseNode) Update(dt float64)
- type Drawer
- type DynaText
- type Element
- type Engine
- func (v *Engine) Close()
- func (v *Engine) Configure()
- func (v *Engine) GetRoot() IGroupNode
- func (v *Engine) Initialize(title string)
- func (v *Engine) Quit()
- func (v *Engine) Run()
- func (v *Engine) SetFont(fontPath string, size int) error
- func (v *Engine) SetRoot(n *GroupNode)
- func (v *Engine) Start(game Game)
- type Font
- type Game
- type GroupNode
- type IGroupNode
- type INode
- type Matrix4
- func (m *Matrix4) C(i int) float64
- func (m *Matrix4) Clone() *Matrix4
- func (m *Matrix4) GetScale(out *Vector3)
- func (m *Matrix4) GetTranslation(out *Vector3)
- func (m *Matrix4) Multiply(a, b *Matrix4)
- func (m *Matrix4) PostMultiply(b *Matrix4)
- func (m *Matrix4) PostScale(sx, sy, sz float64) *Matrix4
- func (m *Matrix4) PostTranslate(tx, ty, tz float64) *Matrix4
- func (m *Matrix4) PreMultiply(b *Matrix4)
- func (m *Matrix4) RotateBy(angle float64) *Matrix4
- func (m *Matrix4) ScaleBy(v *Vector3) *Matrix4
- func (m *Matrix4) Set(src *Matrix4) *Matrix4
- func (m *Matrix4) SetRotation(angle float64) *Matrix4
- func (m *Matrix4) SetScale(v *Vector3) *Matrix4
- func (m *Matrix4) SetScale2Comp(sx, sy float64) *Matrix4
- func (m *Matrix4) SetScale3Comp(sx, sy, sz float64) *Matrix4
- func (m *Matrix4) SetToOrtho(left, right, bottom, top, near, far float64) *Matrix4
- func (m *Matrix4) SetTranslate3Comp(x, y, z float64) *Matrix4
- func (m *Matrix4) SetTranslateByVector(v *Vector3) *Matrix4
- func (m Matrix4) String() string
- func (m *Matrix4) ToIdentity()
- func (m *Matrix4) TranslateBy(v *Vector3) *Matrix4
- func (m *Matrix4) TranslateBy2Comps(x, y float64) *Matrix4
- func (m *Matrix4) TranslateBy3Comps(x, y, z float64) *Matrix4
- type Particle
- type ParticleSystem
- type RectangleNode
- type RenderContext
- func (c *RenderContext) DrawPolygon(vertices []*Vector3, color color.RGBA)
- func (c *RenderContext) RenderContext() *gg.Context
- func (c *RenderContext) Restore()
- func (c *RenderContext) Save()
- func (c *RenderContext) Set(at *AffineTransform)
- func (c *RenderContext) Transform(at *AffineTransform)
- func (c *RenderContext) TransformContext() *AffineTransform
- type RenderParticle
- type Stack
- type Text
- type TriggerParticle
- type Vector3
- func (v *Vector3) Add(src *Vector3) *Vector3
- func (v *Vector3) Add2Components(x, y float64) *Vector3
- func (v *Vector3) Clone() *Vector3
- func (v *Vector3) Cross(o *Vector3) *Vector3
- func (v *Vector3) Distance(src *Vector3) float64
- func (v *Vector3) DistanceSquared(src *Vector3) float64
- func (v *Vector3) DivScalar(scale float64)
- func (v *Vector3) Dot(o *Vector3) float64
- func (v *Vector3) DotByComponent(x, y, z float64) float64
- func (v *Vector3) EqEpsilon(other *Vector3) bool
- func (v *Vector3) Equal(other *Vector3) bool
- func (v *Vector3) Length() float64
- func (v *Vector3) LengthSquared() float64
- func (v *Vector3) Mul(m *Matrix4) *Vector3
- func (v *Vector3) MulAdd(src *Vector3, scalar float64) *Vector3
- func (v *Vector3) Normalize()
- func (v *Vector3) ScaleBy(s float64) *Vector3
- func (v *Vector3) ScaleBy2Components(sx, sy float64) *Vector3
- func (v *Vector3) Set(source *Vector3)
- func (v *Vector3) Set2Components(x, y float64)
- func (v *Vector3) Set3Components(x, y, z float64)
- func (v Vector3) String() string
- func (v *Vector3) Sub(src *Vector3) *Vector3
- func (v *Vector3) Sub2Components(x, y float64) *Vector3
- type VectorPool
Constants ¶
const ( // Epsilon = 0.00001 Epsilon = 0.00001 // ~32 bits // DegreeToRadians converts to radians, for example, 45.0 * DegreeToRadians = radians DegreeToRadians = math.Pi / 180.0 )
const ( // M00 XX: Typically the unrotated X component for scaling, also the cosine of the // angle when rotated on the Y and/or Z axis. On // Vector3 multiplication this value is multiplied with the source X component // and added to the target X component. M00 = 0 // M01 XY: Typically the negative sine of the angle when rotated on the Z axis. // On Vector3 multiplication this value is multiplied // with the source Y component and added to the target X component. M01 = 4 // M02 XZ: Typically the sine of the angle when rotated on the Y axis. // On Vector3 multiplication this value is multiplied with the // source Z component and added to the target X component. M02 = 8 // M03 XW: Typically the translation of the X component. // On Vector3 multiplication this value is added to the target X component. M03 = 12 // M10 YX: Typically the sine of the angle when rotated on the Z axis. // On Vector3 multiplication this value is multiplied with the // source X component and added to the target Y component. M10 = 1 // M11 YY: Typically the unrotated Y component for scaling, also the cosine // of the angle when rotated on the X and/or Z axis. On // Vector3 multiplication this value is multiplied with the source Y // component and added to the target Y component. M11 = 5 // M12 YZ: Typically the negative sine of the angle when rotated on the X axis. // On Vector3 multiplication this value is multiplied // with the source Z component and added to the target Y component. M12 = 9 // M13 YW: Typically the translation of the Y component. // On Vector3 multiplication this value is added to the target Y component. M13 = 13 // M20 ZX: Typically the negative sine of the angle when rotated on the Y axis. // On Vector3 multiplication this value is multiplied // with the source X component and added to the target Z component. M20 = 2 // M21 ZY: Typical the sine of the angle when rotated on the X axis. // On Vector3 multiplication this value is multiplied with the // source Y component and added to the target Z component. M21 = 6 // M22 ZZ: Typically the unrotated Z component for scaling, also the cosine of the // angle when rotated on the X and/or Y axis. // On Vector3 multiplication this value is multiplied with the source Z component // and added to the target Z component. M22 = 10 // M23 ZW: Typically the translation of the Z component. // On Vector3 multiplication this value is added to the target Z component. M23 = 14 // M30 WX: Typically the value zero. On Vector3 multiplication this value is ignored. M30 = 3 // M31 WY: Typically the value zero. On Vector3 multiplication this value is ignored. M31 = 7 // M32 WZ: Typically the value zero. On Vector3 multiplication this value is ignored. M32 = 11 // M33 WW: Typically the value one. On Vector3 multiplication this value is ignored. M33 = 15 )
const (
MaxTranformedVertices = 100
)
Variables ¶
var AffinePool = NewAffineTransformPool(100)
AffinePool is a pool of transforms
var VectorsPool = NewVectorPool(100)
VectorsPool is a pool of transforms
Functions ¶
func AffineTransformEqualToTransform ¶
func AffineTransformEqualToTransform(t1, t2 *AffineTransform) bool
Return true if `t1' and `t2' are equal, false otherwise.
func AffineTransformInvert ¶
func AffineTransformInvert(t *AffineTransform, out *AffineTransform)
func AffineTransformInvertTo ¶
func AffineTransformInvertTo(t, to *AffineTransform)
*
- Invert [t] to [to].
func AffineTransformMultiply ¶
func AffineTransformMultiply(t1 *AffineTransform, t2 *AffineTransform, out *AffineTransform)
*
- Concatenate `t2' to `t1' and return the result: t' = t1 * t2
- returns a [Poolable]ed AffineTransform.
func AffineTransformMultiplyFrom ¶
func AffineTransformMultiplyFrom(tA, tB *AffineTransform)
*
- Multiply [tA] x [tB] and place in [tA]
- A pre-multiply *
- http://www-evasion.imag.fr/~Francois.Faure/doc/inventorMentor/sgi_html/ch09.html
func AffineTransformMultiplyTo ¶
func AffineTransformMultiplyTo(tA, tB *AffineTransform)
*
- Multiply [tA] x [tB] and place in [tB]
func AffineTransformRotate ¶
func AffineTransformRotate(t *AffineTransform, out *AffineTransform, anAngle float64)
*
- Rotation is just a matter of perspective. A CW rotation can be seen as
- CCW depending on what you are talking about rotating. For example,
- if the coordinate system is thought as rotating CCW then objects are
- seen as rotating CW. And that is what the 2x2 matrix below represents
- with Canvas2D.
- |cos -sin| object appears to rotate CW.
- |sin cos| *
- In the matrix below the object appears to rotate CCW.
- |cos sin|
- |-sin cos| *
- |a c| |cos -sin|
- |b d| x |sin cos| *
func AffineTransformScale ¶
func AffineTransformScale(t *AffineTransform, out *AffineTransform, sx, sy float64)
func AffineTransformTranslate ¶
func AffineTransformTranslate(t *AffineTransform, out *AffineTransform, tx, ty float64)
func CompApplyAffineTransformTo ¶
func CompApplyAffineTransformTo(x, y float64, out *Vector3, t *AffineTransform)
func DistanceSquared ¶
DistanceSquared finds the euclidean distance between the two specified vectors squared
func LengthSquared ¶
LengthSquared returns the euclidean length squared
func LinearEasing ¶
LinearEasing is a basic linear lerp t,b,c,d timePosition ranges from 0 to duration
func Multiply ¶
func Multiply(a, b, out *Matrix4)
Multiply multiplies a * b and places result into 'out', (i.e. out = a * b)
func MultiplyIntoA ¶
func MultiplyIntoA(a, b *Matrix4)
MultiplyIntoA multiplies a * b and places result into 'a', (i.e. a = a * b)
Types ¶
type AffineTransform ¶
type AffineTransform struct {
// contains filtered or unexported fields
}
*
- A minified affine transform.
- column major (form used by this class)
- x' |a c tx| |x|
- y' = |b d ty| |y|
- 1 |0 0 1| |1|
- or
- Row major
- |a b 0|
- |x' y' 1| = |x y 1| x |c d 0|
- |tx ty 1| *
func NewAffineTransform ¶
func NewAffineTransform() *AffineTransform
func (*AffineTransform) ApplyTo ¶
func (at *AffineTransform) ApplyTo(point *Vector3, out *Vector3)
func (*AffineTransform) ApplyToVector ¶
func (at *AffineTransform) ApplyToVector(point *Vector3, out *Vector3)
func (*AffineTransform) AsScale ¶
func (at *AffineTransform) AsScale(sx, sy float64) *AffineTransform
func (*AffineTransform) AsTranslate ¶
func (at *AffineTransform) AsTranslate(tx, ty float64) *AffineTransform
func (*AffineTransform) Invert ¶
func (at *AffineTransform) Invert()
func (*AffineTransform) Multiply ¶
func (at *AffineTransform) Multiply(t1, t2 *AffineTransform)
func (*AffineTransform) PreMultiply ¶
func (at *AffineTransform) PreMultiply(t *AffineTransform)
*
- A pre multiply order.
func (*AffineTransform) Rotate ¶
func (at *AffineTransform) Rotate(angle float64)
*
- Concatinate a rotation (radians) onto this transform. *
- Rotation is just a matter of perspective. A CW rotation can be seen as
- CCW depending on what you are talking about rotating. For example,
- if the coordinate system is thought as rotating CCW then objects are
- seen as rotating CW, and that is what the 2x2 matrix below represents
- with Canvas2D. It is also the frame of reference we use.
- |cos -sin| object appears to rotate CW.
- |sin cos| *
- In the matrix below the object appears to rotate CCW.
- |cos sin|
- |-sin cos| *
- |a c| |cos -sin|
- |b d| x |sin cos| *
func (*AffineTransform) Scale ¶
func (at *AffineTransform) Scale(sx, sy float64)
/ Concatenate scale
func (*AffineTransform) Set ¶
func (at *AffineTransform) Set(a, b, c, d, tx, ty float64)
func (*AffineTransform) SetToRotate ¶
func (at *AffineTransform) SetToRotate(angle float64)
If Y axis is downward (default for SDL and Image) then: +angle yields a CW rotation -angle yeilds a CCW rotation.
else -angle yields a CW rotation +angle yeilds a CCW rotation.
func (*AffineTransform) SetToScale ¶
func (at *AffineTransform) SetToScale(sx, sy float64)
func (*AffineTransform) SetToTranslate ¶
func (at *AffineTransform) SetToTranslate(tx, ty float64)
func (*AffineTransform) SetWithAT ¶
func (at *AffineTransform) SetWithAT(t *AffineTransform)
func (*AffineTransform) Skew ¶
func (at *AffineTransform) Skew(x, y float64)
*
- A minified affine transform.
- |a c tx|
- |b d ty|
- |0 0 1| *
- |- y -|
- |x - -|
- |0 0 1|
/ Concatenate skew/shear / [x] and [y] are in radians
func (AffineTransform) String ¶
func (v AffineTransform) String() string
*
- |a c tx| |cos -sin|
- |b d ty| |sin cos|
func (*AffineTransform) ToIdentity ¶
func (at *AffineTransform) ToIdentity()
---------------------------------------------------------- Methods ----------------------------------------------------------
func (*AffineTransform) Translate ¶
func (at *AffineTransform) Translate(x, y float64)
/ Concatenate translation
func (*AffineTransform) Transpose ¶
func (at *AffineTransform) Transpose()
*
- Converts either from or to pre or post multiplication.
- a c
- b d
- to
- a b
- c d
type AffineTransformPool ¶
type AffineTransformPool []*AffineTransform
AffineTransformPool is a pool of AffineTransforms
func NewAffineTransformPool ¶
func NewAffineTransformPool(count int) AffineTransformPool
NewAffineTransformPool creates and adds transforms to the pool
func (*AffineTransformPool) Add ¶
func (q *AffineTransformPool) Add(count int)
Add populates the pool with a fixed size
func (*AffineTransformPool) IsEmpty ¶
func (q *AffineTransformPool) IsEmpty() bool
IsEmpty is true if pool is empty
func (*AffineTransformPool) Pop ¶
func (q *AffineTransformPool) Pop() (n *AffineTransform)
Pop pulls a transform from the pool.
func (*AffineTransformPool) Push ¶
func (q *AffineTransformPool) Push(n *AffineTransform)
Push puts a transform into the pool
type BaseNode ¶
func (*BaseNode) Initialize ¶
func (n *BaseNode) Initialize()
func (*BaseNode) SetInvisible ¶
func (n *BaseNode) SetInvisible()
func (*BaseNode) SetPosition ¶
func (*BaseNode) SetPositionBy2Comp ¶
func (*BaseNode) SetRotation ¶
+angle yields CW rotation
func (*BaseNode) SetRotationByDegree ¶
+angle yields CW rotation
func (*BaseNode) SetScaleUniform ¶
func (*BaseNode) SetVisible ¶
func (n *BaseNode) SetVisible()
type Drawer ¶
type Drawer func(*RenderContext)
type DynaText ¶
type DynaText struct { Color sdl.Color X int32 Y int32 Width int32 Height int32 // contains filtered or unexported fields }
DynaText represents dynamically changing text. The text is broken down into characters and each character is rendered using an existing character atlas. This is a base class for dynamic text.
func NewDynaText ¶
NewDynaText creates a Text object.
type Engine ¶
type Engine struct { Width int32 Height int32 ClearColor color.RGBA // contains filtered or unexported fields }
Engine is the GUI and shell
func (*Engine) Close ¶
func (v *Engine) Close()
Close releases resources and shutsdown the engine. Be sure to setup a "defer x.Close()"
func (*Engine) GetRoot ¶
func (v *Engine) GetRoot() IGroupNode
func (*Engine) Initialize ¶
func (*Engine) Quit ¶
func (v *Engine) Quit()
Quit stops the engine from running, effectively shutting it down.
func (*Engine) Run ¶
func (v *Engine) Run()
Run starts the polling event loop. This must run on the main thread.
type Font ¶
type Font struct {
// contains filtered or unexported fields
}
Font wraps the SDL TTF fonts.
type GroupNode ¶
type GroupNode struct { BaseNode // is-a // contains filtered or unexported fields }
GroupNode is a collection of nodes
func (*GroupNode) Draw ¶
func (gn *GroupNode) Draw(context *RenderContext)
func (*GroupNode) Render ¶
func (gn *GroupNode) Render(context *RenderContext)
type IGroupNode ¶
type IGroupNode interface { INode Add(n INode) // Last node added is render underneath Remove(n INode) Find(n INode) (f int, fno INode) }
func NewGroupNode ¶
func NewGroupNode(parent IGroupNode, autoAdd bool) IGroupNode
type INode ¶
type INode interface { Update(dt float64) Render(context *RenderContext) Position() *Vector3 SetPosition(*Vector3) SetPositionBy2Comp(x, y float64) Scale() *Vector3 SetScale(*Vector3) SetScaleUniform(float64) Rotation() float64 SetRotation(float64) SetRotationByDegree(float64) SetInvisible() SetVisible() IsVisible() bool SetColor(color.RGBA) Name() string SetName(string) String() string // contains filtered or unexported methods }
Node is the base node.
func NewRectangleNode ¶
func NewRectangleNode(parent IGroupNode, centered, autoAdd bool) INode
type Matrix4 ¶
type Matrix4 struct { // Rotation is in radians Rotation float64 Scale Vector3 // contains filtered or unexported fields }
Matrix4 represents a column major opengl array.
func NewMatrix4 ¶
func NewMatrix4() *Matrix4
NewMatrix4 creates a Matrix4 initialized to an identity matrix
func (*Matrix4) GetTranslation ¶
GetTranslation returns the translational components in 'out' Vector3 field.
func (*Matrix4) Multiply ¶
Multiply multiplies a * b and places result into this matrix, (i.e. this = a * b)
func (*Matrix4) PostMultiply ¶
PostMultiply postmultiplies 'b' matrix with 'this' and places the result into 'this' matrix. (i.e. this = this * b)
func (*Matrix4) PostTranslate ¶
PostTranslate postmultiplies this matrix by a translation matrix. Postmultiplication is also used by OpenGL ES.
func (*Matrix4) PreMultiply ¶
PreMultiply premultiplies 'b' matrix with 'this' and places the result into 'this' matrix. (i.e. this = b * this)
func (*Matrix4) RotateBy ¶
RotateBy postmultiplies this matrix with a (counter-clockwise) rotation matrix whose angle is specified in radians.
func (*Matrix4) SetRotation ¶
SetRotation set a rotation matrix about Z axis. 'angle' is specified in radians.
[ M00 M01 _ _ ] [ M10 M11 _ _ ] [ _ _ _ _ ] [ _ _ _ _ ]
func (*Matrix4) SetScale ¶
SetScale sets the scale components of an identity matrix and captures scale values into Scale property.
func (*Matrix4) SetScale2Comp ¶
SetScale2Comp sets the scale components of an identity matrix and captures scale values into Scale property where Z component = 1.0.
func (*Matrix4) SetScale3Comp ¶
SetScale3Comp sets the scale components of an identity matrix and captures scale values into Scale property.
func (*Matrix4) SetToOrtho ¶
SetToOrtho sets the matrix for a 2d ortho graphic projection
func (*Matrix4) SetTranslate3Comp ¶
SetTranslate3Comp sets the translational component to the matrix in the 4th column. The other columns are unmodified.
func (*Matrix4) SetTranslateByVector ¶
SetTranslateByVector sets the translational component to the matrix in the 4th column. The other columns are unmodified.
func (*Matrix4) ToIdentity ¶
func (m *Matrix4) ToIdentity()
ToIdentity set this matrix to the identity matrix
func (*Matrix4) TranslateBy ¶
TranslateBy adds a translational component to the matrix in the 4th column. The other columns are unmodified.
func (*Matrix4) TranslateBy2Comps ¶
TranslateBy2Comps adds a translational component to the matrix in the 4th column. Z is unmodified. The other columns are unmodified.
func (*Matrix4) TranslateBy3Comps ¶
TranslateBy3Comps adds a translational component to the matrix in the 4th column. The other columns are unmodified.
type Particle ¶
type Particle struct { Position *Vector3 Velocity *Vector3 // How long a particle lives after activation. Duration float64 // Colors are lerped StartColor, EndColor color.RGBA RenderColor color.RGBA IsAlive bool // contains filtered or unexported fields }
Particle is a single particle
func NewParticle ¶
func NewParticle() *Particle
NewParticle creates a new particle at 0,0 and white.
type ParticleSystem ¶
type ParticleSystem struct {
// contains filtered or unexported fields
}
ParticleSystem is a bunch of particles.
func NewParticleSystem ¶
func NewParticleSystem(count int, renderer RenderParticle, triggerer TriggerParticle) *ParticleSystem
NewParticleSystem creates a particle system
func (*ParticleSystem) Initialize ¶
func (ps *ParticleSystem) Initialize(count int)
Initialize creates particles
func (*ParticleSystem) Render ¶
func (ps *ParticleSystem) Render(pixels *image.RGBA)
Render draws a particle using the "renderer" callback.
func (*ParticleSystem) TriggerParticle ¶
func (ps *ParticleSystem) TriggerParticle()
TriggerParticle activates a single particle
func (*ParticleSystem) Update ¶
func (ps *ParticleSystem) Update(dt float64)
Update processes all particles.
type RectangleNode ¶
type RectangleNode struct { BaseNode // is-a // contains filtered or unexported fields }
func (*RectangleNode) Draw ¶
func (n *RectangleNode) Draw(context *RenderContext)
func (*RectangleNode) Render ¶
func (n *RectangleNode) Render(context *RenderContext)
func (*RectangleNode) Update ¶
func (n *RectangleNode) Update(dt float64)
type RenderContext ¶
type RenderContext struct {
// contains filtered or unexported fields
}
RenderContext is a rendering context
func NewRenderContext ¶
func NewRenderContext(image *image.RGBA) *RenderContext
func (*RenderContext) DrawPolygon ¶
func (c *RenderContext) DrawPolygon(vertices []*Vector3, color color.RGBA)
func (*RenderContext) RenderContext ¶
func (c *RenderContext) RenderContext() *gg.Context
func (*RenderContext) Restore ¶
func (c *RenderContext) Restore()
func (*RenderContext) Save ¶
func (c *RenderContext) Save()
func (*RenderContext) Set ¶
func (c *RenderContext) Set(at *AffineTransform)
func (*RenderContext) Transform ¶
func (c *RenderContext) Transform(at *AffineTransform)
func (*RenderContext) TransformContext ¶
func (c *RenderContext) TransformContext() *AffineTransform
type RenderParticle ¶
RenderParticle implemented by developer to render a single particle.
type Stack ¶
type Stack struct {
// contains filtered or unexported fields
}
type Text ¶
Text represents a text texture for rendering.
type TriggerParticle ¶
type TriggerParticle func(particle *Particle, system *ParticleSystem)
TriggerParticle activates a particle defined by developer.
type Vector3 ¶
type Vector3 struct {
X, Y, Z float64
}
Vector3 contains base components
func CompApplyAffineTransform ¶
func CompApplyAffineTransform(x, y float64, t *AffineTransform) *Vector3
func NewVector3 ¶
func NewVector3() *Vector3
NewVector3 creates a Vector3 initialized to 0.0, 0.0, 0.0
func NewVector3With2Components ¶
NewVector3With2Components creates a Vector3 initialized with x,y and z = 0.0
func NewVector3With3Components ¶
NewVector3With3Components creates a Vector3 initialized with x,y,z
func PointApplyAffineTransform ¶
func PointApplyAffineTransform(point *Vector3, t *AffineTransform) *Vector3
func (*Vector3) Add2Components ¶
Add2Components adds x and y to this vector
func (*Vector3) Cross ¶
Cross sets this vector to the cross product between it and the other vector.
func (*Vector3) DistanceSquared ¶
DistanceSquared finds the euclidean distance between the two specified vectors squared
func (*Vector3) DotByComponent ¶
DotByComponent returns the product between the two vectors
func (*Vector3) LengthSquared ¶
LengthSquared returns the euclidean length squared
func (*Vector3) Mul ¶
Mul left-multiplies the vector by the given matrix, assuming the fourth (w) component of the vector is 1.
func (*Vector3) ScaleBy2Components ¶
ScaleBy2Components scales this vector by sx and sy
func (*Vector3) Set2Components ¶
Set2Components modifies x,y only
func (*Vector3) Set3Components ¶
Set3Components modifies x,y,z
func (*Vector3) Sub2Components ¶
Sub2Components subtracts x and y to this vector
type VectorPool ¶
type VectorPool []*Vector3
VectorPool is a pool of vectors
func NewVectorPool ¶
func NewVectorPool(count int) VectorPool
NewVectorPool creates and adds vectors to the pool
func (*VectorPool) Add ¶
func (q *VectorPool) Add(count int)
Add populates the pool with a fixed size
func (*VectorPool) Pop ¶
func (q *VectorPool) Pop() (n *Vector3)
Pop pulls a transform from the pool.