model

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2021 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Body

type Body []Model

func (Body) Draw

func (b Body) Draw(g Globals)

func (Body) Inspect

func (b Body) Inspect() Summary

func (Body) Realize

func (b Body) Realize(cleanup func(func())) error

func (Body) Tick

func (b Body) Tick(delta, runtime time.Duration) bool

func (Body) With

func (b Body) With(x ...mesh.Transform) Model

type Globals

type Globals struct {
	Flatland mgl32.Mat4
	World    World
	Lights   Lights
}

type Heading

type Heading struct {
	Vertical, Horizontal float64
	RadPerSec            struct {
		V, H float64
	}
}

func (*Heading) Orientation

func (h *Heading) Orientation() *Orientation

func (*Heading) SetDeg

func (h *Heading) SetDeg(v mgl32.Vec2) *Heading

func (*Heading) Update

func (h *Heading) Update(delta time.Duration, mV, mH Movement)

type Light

type Light struct {
	Position mgl32.Vec3
	Ambient  mgl32.Vec3
	Diffuse  mgl32.Vec3
	Specular mgl32.Vec3
}

type Lights

type Lights []Light

func (Lights) Ambient

func (l Lights) Ambient() []mgl32.Vec3

func (Lights) Diffuse

func (l Lights) Diffuse() []mgl32.Vec3

func (Lights) Position

func (l Lights) Position() []mgl32.Vec3

func (Lights) Specular

func (l Lights) Specular() []mgl32.Vec3

type Mesh

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

func Cube

func Cube(pretty bool) *Mesh

func Cylinder

func Cylinder(pretty bool) *Mesh

func Extrude

func Extrude(profile []mesh.Vec, path mesh.Vec, color mesh.ExtrudeColor) *Mesh

func Illuminati

func Illuminati() *Mesh

func NewMesh

func NewMesh(opt MeshOptions) *Mesh

func NewShape

func NewShape(desc string, shape geom.Shape) *Mesh

func Revolve

func Revolve(profile []mesh.Vec, axis mesh.Vec, resolution int, color mesh.RevolveColor) *Mesh

func Sphere

func Sphere(pretty bool) *Mesh

func Torus

func Torus(r1, r2 float32, pretty bool) *Mesh

func (*Mesh) Draw

func (m *Mesh) Draw(g Globals)

func (*Mesh) DrawTriangles

func (m *Mesh) DrawTriangles()

func (*Mesh) Inspect

func (m *Mesh) Inspect() Summary

func (*Mesh) Realize

func (m *Mesh) Realize(cleanup func(func())) error

func (*Mesh) Setup

func (m *Mesh) Setup(g Globals)

func (*Mesh) Teardown

func (m *Mesh) Teardown()

func (*Mesh) Tick

func (m *Mesh) Tick(delta, runtime time.Duration) bool

func (*Mesh) With

func (m *Mesh) With(x ...mesh.Transform) Model

type MeshBinder

type MeshBinder func(position, normal, color glu.VertexAttrib) (vao glu.VertexArray, err error)

type MeshOptions

type MeshOptions struct {
	Description string
	NoCull      bool
	Vertex      []mesh.Vec
	Normal      []mesh.Vec
	Color       []mesh.Vec
	Index       []mesh.TriI
}

type Model

type Model interface {
	Realize(func(func())) error
	Tick(delta, runtime time.Duration) bool
	With(...mesh.Transform) Model
	Draw(g Globals)

	Inspect() Summary
}

type Movement

type Movement int
const (
	Forward  Movement = +1
	None     Movement = 0
	Backward Movement = -1
)

type Orientation

type Orientation struct {
	Look, Right, Up mgl32.Vec3
}

type Position

type Position struct {
	MovePerSec float64
	Value      mgl32.Vec3
	View       mgl32.Mat4
}

func (*Position) Update

func (p *Position) Update(delta time.Duration, mRight, mUp, mLook Movement, o *Orientation)

type Skybox

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

func (*Skybox) Draw

func (m *Skybox) Draw(g Globals)

func (*Skybox) Inspect

func (m *Skybox) Inspect() Summary

func (*Skybox) Realize

func (m *Skybox) Realize(cleanup func(func())) error

func (*Skybox) Tick

func (m *Skybox) Tick(delta, runtime time.Duration) bool

func (*Skybox) With

func (m *Skybox) With(x ...mesh.Transform) Model

type Summary

type Summary struct {
	Description     string
	VertexCount     int
	TriangleCount   int
	Transformations []mesh.Transform

	Within []Summary
}

func (Summary) String

func (s Summary) String() string

type Text

type Text struct {
	Font  font.Face
	Value string
	Color mgl32.Vec4
	Pos   mgl32.Vec2
	Size  float32
	// contains filtered or unexported fields
}

func (*Text) Draw

func (m *Text) Draw(g Globals)

func (*Text) Inspect

func (m *Text) Inspect() Summary

func (*Text) Realize

func (m *Text) Realize(cleanup func(func())) error

func (*Text) Tick

func (m *Text) Tick(delta, runtime time.Duration) bool

func (*Text) With

func (m *Text) With(x ...mesh.Transform) Model

type World

type World struct {
	Projection, View mgl32.Mat4
	Camera           mgl32.Vec3
}

Jump to

Keyboard shortcuts

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