Documentation
¶
Index ¶
- Variables
- func Context() gl.Context
- func Duration(d time.Duration) func(*Animator)
- func ExpDecay(t float64) float64
- func ExpDrive(t float64) float64
- func Interp(fn func(float64) float64) func(*Animator)
- func MustOpen(name string) fs.File
- func MustReadAll(filename string) []byte
- func Ntou(n float32) float32
- func Quat(angle float32, axis f32.Vec3) f32.Vec4
- func QuatConj(a f32.Vec4) f32.Vec4
- func QuatMul(a, b f32.Vec4) f32.Vec4
- func QuatRot3f(r f32.Vec4, x, y, z float32) f32.Vec3
- func RGBA(c color.Color) (r, g, b, a float32)
- func RotateBy(angle float32, axis f32.Vec3) func(Transformer)
- func RotateTo(angle float32, axis f32.Vec3) func(Transformer)
- func ScaleBy(v f32.Vec3) func(Transformer)
- func ScaleTo(v f32.Vec3) func(Transformer)
- func ShearBy(v f32.Vec3) func(Transformer)
- func ShearTo(v f32.Vec3) func(Transformer)
- func TextureFilter(min, mag int) func(*Texture)
- func TextureWrap(s, t int) func(*Texture)
- func To(t Transform) func(Transformer)
- func TranslateBy(v f32.Vec3) func(Transformer)
- func TranslateTo(v f32.Vec3) func(Transformer)
- func Uton(u float32) float32
- func With(glctx gl.Context3) gl.Context3
- type A2fv
- type A3fv
- type A4fv
- type Animator
- func (a *Animator) Apply(options ...func(*Animator))
- func (a *Animator) Cancel()
- func (a *Animator) Done()
- func (a *Animator) Duration(d time.Duration)
- func (a *Animator) Interp(fn func(float64) float64)
- func (a *Animator) Pt() Transform
- func (a *Animator) RotateBy(angle float32, axis f32.Vec3)
- func (a *Animator) RotateTo(angle float32, axis f32.Vec3)
- func (a *Animator) ScaleBy(v f32.Vec3)
- func (a *Animator) ScaleTo(v f32.Vec3)
- func (a *Animator) ShearBy(v f32.Vec3)
- func (a *Animator) ShearTo(v f32.Vec3)
- func (a *Animator) Stage(epoch time.Time, transforms ...func(Transformer))
- func (a *Animator) Step(now time.Time) (ok bool)
- func (a *Animator) To(t Transform)
- func (a *Animator) TranslateBy(v f32.Vec3)
- func (a *Animator) TranslateTo(v f32.Vec3)
- type FPS
- type FloatBuffer
- type FragAsset
- type FragSrc
- type FrameBuffer
- type Program
- func (prg Program) Attrib(name string) gl.Attrib
- func (prg *Program) Build(vsrc VertSrc, fsrc FragSrc) error
- func (prg *Program) BuildAssets(vtag VertAsset, ftag FragAsset) error
- func (prg Program) Delete()
- func (prg *Program) Install(vsrc VertSrc, fsrc FragSrc) error
- func (prg *Program) MustBuild(vsrc VertSrc, fsrc FragSrc)
- func (prg *Program) MustBuildAssets(vtag VertAsset, ftag FragAsset)
- func (prg Program) Uniform(name string) gl.Uniform
- func (prg Program) Unmarshal(dst interface{})
- func (prg Program) Use()
- type Sampler
- type Side
- type T
- type Texture
- func (tex Texture) At(x, y int) color.Color
- func (tex Texture) Bind()
- func (tex Texture) Bounds() image.Rectangle
- func (tex Texture) ColorModel() color.Model
- func (tex *Texture) Create(options ...func(*Texture))
- func (tex *Texture) Delete()
- func (tex *Texture) DrawSrc(src *image.RGBA)
- func (tex Texture) GenerateMipmap()
- func (tex Texture) Unbind()
- func (tex *Texture) Upload(src *image.RGBA)
- type Transform
- func (a Transform) Eval16fv() (m f32.Mat4)
- func (a Transform) Lerp(b Transform, t float32) Transform
- func (a Transform) Lerp4(b Transform, t, u, v, w float32) Transform
- func (a *Transform) RotateBy(angle float32, axis f32.Vec3)
- func (a *Transform) RotateTo(angle float32, axis f32.Vec3)
- func (a *Transform) ScaleBy(v f32.Vec3)
- func (a *Transform) ScaleTo(v f32.Vec3)
- func (a *Transform) ShearBy(v f32.Vec3)
- func (a *Transform) ShearTo(v f32.Vec3)
- func (a *Transform) To(b Transform)
- func (a *Transform) TranslateBy(v f32.Vec3)
- func (a *Transform) TranslateTo(v f32.Vec3)
- type Transformer
- type U16fv
- func (u U16fv) Animator(options ...func(*Animator)) *Animator
- func (u *U16fv) Inv2f(nx, ny float32) (float32, float32)
- func (u *U16fv) Ortho(l, r float32, b, t float32, n, f float32)
- func (u U16fv) Stage(epoch time.Time, transforms ...func(Transformer))
- func (u U16fv) Step(now time.Time) (ok bool)
- func (u U16fv) String() string
- func (u U16fv) Transform(transforms ...func(Transformer))
- func (u *U16fv) Update()
- type U1f
- type U1i
- type U2fv
- type U2i
- type U3fv
- type U3i
- type U4fv
- type U4i
- type U9fv
- type UintBuffer
- type Uniform
- type VertAsset
- type VertSrc
- type VertexArray
- func (vert *VertexArray) Bind()
- func (vert *VertexArray) Create(usage gl.Enum, size int, floats []float32)
- func (vert VertexArray) Delete()
- func (vert VertexArray) Draw(mode gl.Enum)
- func (vert *VertexArray) StepSize(size, stride, offset int)
- func (vert VertexArray) Unbind()
- func (vert *VertexArray) Update(floats []float32)
- type VertexElement
- func (vert *VertexElement) Bind()
- func (vert *VertexElement) Create(usage gl.Enum, size int, offset int, floats []float32, uints []uint32)
- func (vert VertexElement) Delete()
- func (vert VertexElement) Draw(mode gl.Enum)
- func (vert *VertexElement) StepSize(size, stride, offset int)
- func (vert VertexElement) Unbind()
- func (vert *VertexElement) Update(floats []float32, uints []uint32)
Constants ¶
This section is empty.
Variables ¶
var ( FilterNearest = TextureFilter(gl.NEAREST, gl.NEAREST) FilterLinear = TextureFilter(gl.LINEAR, gl.LINEAR) WrapClamp = TextureWrap(gl.CLAMP_TO_EDGE, gl.CLAMP_TO_EDGE) WrapRepeat = TextureWrap(gl.REPEAT, gl.REPEAT) )
var (
Assets embed.FS
)
var DefaultAnimatorDuration = 1000 * time.Millisecond
var ErrNotZero = errors.New("Metric distance not zero")
Functions ¶
func MustReadAll ¶
MustReadAll reads the file named by filename from assets and returns the contents or panics on error.
func ScaleBy ¶
func ScaleBy(v f32.Vec3) func(Transformer)
func ScaleTo ¶
func ScaleTo(v f32.Vec3) func(Transformer)
func ShearBy ¶
func ShearBy(v f32.Vec3) func(Transformer)
func ShearTo ¶
func ShearTo(v f32.Vec3) func(Transformer)
func TextureFilter ¶
func TextureWrap ¶
func To ¶
func To(t Transform) func(Transformer)
func TranslateBy ¶
func TranslateBy(v f32.Vec3) func(Transformer)
func TranslateTo ¶
func TranslateTo(v f32.Vec3) func(Transformer)
Types ¶
type Animator ¶
type Animator struct {
// contains filtered or unexported fields
}
func NewAnimator ¶
func (*Animator) Stage ¶
func (a *Animator) Stage(epoch time.Time, transforms ...func(Transformer))
TODO this cancels anything in progress but doesn't allow independent transforms to continue e.g. trigger 1s rotate, 0.5 seconds elapse, trigger 1s translate, 0.5 second elapse and rotate finishes, 0.5 seconds elapse and translate finishes what's actually desireable here? I think I'd want things to finish independently which suggests a different kind of layout
func (*Animator) TranslateBy ¶
func (*Animator) TranslateTo ¶
type FloatBuffer ¶
func (*FloatBuffer) Bind ¶
func (buf *FloatBuffer) Bind()
func (FloatBuffer) Delete ¶
func (buf FloatBuffer) Delete()
func (FloatBuffer) Draw ¶
func (buf FloatBuffer) Draw(mode gl.Enum)
func (FloatBuffer) Unbind ¶
func (buf FloatBuffer) Unbind()
func (*FloatBuffer) Update ¶
func (buf *FloatBuffer) Update(data []float32)
type FragAsset ¶
type FragAsset string
FragAsset is a filename in assets containing fragment shader source code.
type FrameBuffer ¶
type FrameBuffer struct { gl.Framebuffer // contains filtered or unexported fields }
func (*FrameBuffer) Attach ¶
func (buf *FrameBuffer) Attach()
func (*FrameBuffer) Create ¶
func (buf *FrameBuffer) Create(options ...func(*Texture))
func (*FrameBuffer) Delete ¶
func (buf *FrameBuffer) Delete()
func (*FrameBuffer) Detach ¶
func (buf *FrameBuffer) Detach()
func (*FrameBuffer) RGBA ¶
func (buf *FrameBuffer) RGBA() *image.RGBA
func (*FrameBuffer) Update ¶
func (buf *FrameBuffer) Update(width, height int)
type Program ¶
Program identifies a compiled shader program. The bool Program.Init can be used to check if valid.
func (*Program) BuildAssets ¶
BuildAssets is a helper that wraps Program.Build with asset file contents of filenames vtag and ftag.
func (Program) Delete ¶
func (prg Program) Delete()
Delete frees the memory and invalidates the name associated with the program.
func (*Program) MustBuildAssets ¶
MustBuildAssets is a helper that wraps Program.BuildAssets and panics on error.
type Texture ¶
func (Texture) ColorModel ¶
func (Texture) GenerateMipmap ¶
func (tex Texture) GenerateMipmap()
type Transform ¶
TODO this is essentially type Sheet, but should vectors be tucked behind Transform type ???
func TransformIdent ¶
func TransformIdent() (a Transform)
func (*Transform) TranslateBy ¶
func (*Transform) TranslateTo ¶
type Transformer ¶
type U16fv ¶
type U16fv struct {
// contains filtered or unexported fields
}
func (U16fv) Stage ¶
func (u U16fv) Stage(epoch time.Time, transforms ...func(Transformer))
func (U16fv) Transform ¶
func (u U16fv) Transform(transforms ...func(Transformer))
type U1f ¶
type U1f struct {
// contains filtered or unexported fields
}
func (U1f) Stage ¶
func (u U1f) Stage(epoch time.Time, transforms ...func(Transformer))
func (U1f) Transform ¶
func (u U1f) Transform(transforms ...func(Transformer))
type UintBuffer ¶
func (*UintBuffer) Bind ¶
func (buf *UintBuffer) Bind()
func (UintBuffer) Delete ¶
func (buf UintBuffer) Delete()
func (UintBuffer) Draw ¶
func (buf UintBuffer) Draw(mode gl.Enum)
func (UintBuffer) Unbind ¶
func (buf UintBuffer) Unbind()
func (*UintBuffer) Update ¶
func (buf *UintBuffer) Update(data []uint32)
type Uniform ¶
type Uniform interface { // Animator allows setting additional options. Animator(options ...func(*Animator)) *Animator // Transform applies given transforms instantly. Transform(transforms ...func(Transformer)) // Stage transforms to occur the next time Step is called. // Previously staged transforms or animations in progress // are cancelled with each call. Stage(epoch time.Time, transforms ...func(Transformer)) // Step through staged transforms, returning true if work // was performed. The first false result returned performs // work to animate to final destination; subsequent calls // do not perform any work. Step(now time.Time) (ok bool) }
type VertAsset ¶
type VertAsset string
VertAsset is a filename in assets containing vertex shader source code.
type VertexArray ¶
abstraction for drawing point data
func (*VertexArray) Bind ¶
func (vert *VertexArray) Bind()
func (*VertexArray) Create ¶
func (vert *VertexArray) Create(usage gl.Enum, size int, floats []float32)
TODO deprecate
should change uses as follows basically:
// x, y, z, u, v obj.Vert.Floats.Create(gl.STATIC_DRAW, []float32{ -1, -1, -1, 1, 1, -1, +1, -1, 1, 0, +1, +1, -1, 0, 0, +1, -1, -1, 0, 1, }) obj.Vert.Uints.Create(gl.STATIC_DRAW, []uint32{0, 1, 2, 0, 2, 3}) obj.Vert.StepSize(3, 5, 0) obj.Vert.Bind() obj.TexCoord.Floats = obj.Vert.Floats obj.TexCoord.StepSize(2, 5, 3) obj.TexCoord.Bind()
func (VertexArray) Delete ¶
func (vert VertexArray) Delete()
func (VertexArray) Draw ¶
func (vert VertexArray) Draw(mode gl.Enum)
func (*VertexArray) StepSize ¶
func (vert *VertexArray) StepSize(size, stride, offset int)
func (VertexArray) Unbind ¶
func (vert VertexArray) Unbind()
type VertexElement ¶
type VertexElement struct { gl.Attrib Floats FloatBuffer Uints UintBuffer Size int Stride int Offset int }
abstraction for drawing indexed point data
func (*VertexElement) Bind ¶
func (vert *VertexElement) Bind()
func (*VertexElement) Create ¶
func (vert *VertexElement) Create(usage gl.Enum, size int, offset int, floats []float32, uints []uint32)
TODO deprecate
func (VertexElement) Delete ¶
func (vert VertexElement) Delete()
func (VertexElement) Draw ¶
func (vert VertexElement) Draw(mode gl.Enum)
func (*VertexElement) StepSize ¶
func (vert *VertexElement) StepSize(size, stride, offset int)
func (VertexElement) Unbind ¶
func (vert VertexElement) Unbind()
func (*VertexElement) Update ¶
func (vert *VertexElement) Update(floats []float32, uints []uint32)
TODO deprecate