loops

package
v0.0.0-...-198d64f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 5, 2022 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckGLForErrors

func CheckGLForErrors()

func Smoothstep

func Smoothstep(t float64) float64

Types

type Buffer

type Buffer struct {
	Buffer uint32
}

func NewBuffer

func NewBuffer() *Buffer

func (*Buffer) Bind

func (self *Buffer) Bind(bufferType uint32)

type Circle

type Circle struct {
	// contains filtered or unexported fields
}

func NewCircle

func NewCircle(radius float32, parts int) Circle

func (Circle) DrawMode

func (self Circle) DrawMode() uint32

func (Circle) Verts

func (self Circle) Verts() []float32

type DrawFunc

type DrawFunc func(float64, *Graphics)

type Graphics

type Graphics struct {
	*LoopWindow
	// contains filtered or unexported fields
}

func NewGraphics

func NewGraphics(window *LoopWindow) *Graphics

func (*Graphics) Disable3d

func (self *Graphics) Disable3d()

func (*Graphics) DisableWireframe

func (self *Graphics) DisableWireframe()

func (*Graphics) Draw

func (self *Graphics) Draw(mode uint32, verts []float32)

func (*Graphics) Draw3d

func (self *Graphics) Draw3d(mode uint32, verts []float32, indexes []byte)

func (*Graphics) DrawColored

func (self *Graphics) DrawColored(mode uint32, verts []float32)

v = [ [x,y,r,g,b,a], ... ]

func (*Graphics) DrawRect

func (self *Graphics) DrawRect(x, y, w, h float32)

func (*Graphics) DrawShape

func (self *Graphics) DrawShape(shape Shape)

func (*Graphics) Enable3d

func (self *Graphics) Enable3d()

func (*Graphics) EnableWireframe

func (self *Graphics) EnableWireframe()

func (*Graphics) SetColor

func (self *Graphics) SetColor(c color.RGBA)

func (*Graphics) SetMat

func (self *Graphics) SetMat(mat Mat4)

func (*Graphics) SetViewMat

func (self *Graphics) SetViewMat(mat Mat4)

type LoadFunc

type LoadFunc func()

type LoopWindow

type LoopWindow struct {
	Width  int
	Height int
	Update UpdateFunc
	Draw   DrawFunc
	Load   LoadFunc
	Window *glfw.Window
	Title  string
	Speed  float64
}

func NewLoopWindow

func NewLoopWindow() *LoopWindow

func (*LoopWindow) KeyCallback

func (self *LoopWindow) KeyCallback(w *glfw.Window, key glfw.Key, scancode int, action glfw.Action, mods glfw.ModifierKey)

func (*LoopWindow) Record

func (self *LoopWindow) Record(graphics *Graphics)

func (*LoopWindow) Run

func (self *LoopWindow) Run()

func (*LoopWindow) Screenshot

func (self *LoopWindow) Screenshot(fname string)

type Mat4

type Mat4 [16]float32

func NewIdentityMat4

func NewIdentityMat4() Mat4

func NewPerspectiveMatrix

func NewPerspectiveMatrix(fovy, aspect, zNear, zFar float64) Mat4

fov: field of view in degrees aspect: width/height

func NewRotate2DMatrix

func NewRotate2DMatrix(theta float32) Mat4

func NewRotateMatrix

func NewRotateMatrix(theta, x, y, z float32) Mat4

func NewScaleMatrix

func NewScaleMatrix(sx, sy, sz float32) Mat4

func NewTranslateMatrix

func NewTranslateMatrix(tx, ty, tz float32) Mat4

func (Mat4) Mul

func (self Mat4) Mul(other Mat4) Mat4

func (Mat4) Print

func (self Mat4) Print()

func (Mat4) Rotate

func (self Mat4) Rotate(theta float32) Mat4

func (Mat4) Rotate3d

func (self Mat4) Rotate3d(theta, x, y, z float32) Mat4

func (Mat4) Scale

func (self Mat4) Scale(sx, sy, sz float32) Mat4

func (Mat4) Translate

func (self Mat4) Translate(tx, ty, tz float32) Mat4

func (Mat4) TranslateVec3

func (self Mat4) TranslateVec3(v Vec3) Mat4

func (Mat4) Transpose

func (self Mat4) Transpose() Mat4

type Program

type Program struct {
	Program uint32
}

func NewProgram

func NewProgram(shaders ...ShaderSource) Program

func (*Program) GetAttribLocation

func (self *Program) GetAttribLocation(name string) int32

func (*Program) GetUniformLocation

func (self *Program) GetUniformLocation(name string) int32

func (*Program) Use

func (self *Program) Use()

type ProgramSource

type ProgramSource struct {
	ShaderSources []ShaderSource
}

type Rectangle

type Rectangle [4 * 6]float32

func NewRectangle

func NewRectangle(w, h float32) Rectangle

func (Rectangle) DrawMode

func (self Rectangle) DrawMode() uint32

func (Rectangle) Verts

func (self Rectangle) Verts() []float32

type ShaderSource

type ShaderSource struct {
	Type   uint32
	Source string
}

type Shape

type Shape interface {
	Verts() []float32
	DrawMode() uint32
}

type SmoothPalette

type SmoothPalette struct {
	Colors []color.RGBA
}

func (*SmoothPalette) Color

func (self *SmoothPalette) Color(t float64) color.RGBA

type UpdateFunc

type UpdateFunc func(float64)

type Vec2

type Vec2 [2]float32

func NewVec2

func NewVec2(x, y float32) Vec2

func NewVec2FromAngle

func NewVec2FromAngle(deg float32) Vec2

func (Vec2) Add

func (self Vec2) Add(other Vec2) Vec2

func (Vec2) Length

func (self Vec2) Length() float32

func (Vec2) Normalize

func (self Vec2) Normalize() Vec2

func (Vec2) Print

func (self Vec2) Print()

func (Vec2) Rotate

func (self Vec2) Rotate(rads float32) Vec2

func (Vec2) RotateAngle

func (self Vec2) RotateAngle(deg float32) Vec2

func (Vec2) Scale

func (self Vec2) Scale(s float32) Vec2

func (Vec2) Sub

func (self Vec2) Sub(other Vec2) Vec2

type Vec3

type Vec3 [3]float32

func NewVec3

func NewVec3(x, y, z float32) Vec3

func (Vec3) Add

func (self Vec3) Add(other Vec3) Vec3

func (Vec3) Length

func (self Vec3) Length() float32

func (Vec3) Normalize

func (self Vec3) Normalize() Vec3

func (Vec3) Scale

func (self Vec3) Scale(s float32) Vec3

type VertexArray

type VertexArray struct {
	VertexArray uint32
}

func NewVertexArray

func NewVertexArray() *VertexArray

func (*VertexArray) Bind

func (self *VertexArray) Bind()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL