vertex

package
v0.0.0-...-124f97e Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2023 License: GPL-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

Variables

This section is empty.

Functions

func IndexType

func IndexType(size int) core1_0.IndexType

func Max

func Max[V Vertex](vertices []V) vec3.T

func Min

func Min[V Vertex](vertices []V) vec3.T

Types

type Args

type Args interface{}

type C

type C struct {
	P vec3.T `vtx:"position,float,3"`
	N vec3.T `vtx:"normal,float,3"`
	C vec4.T `vtx:"color_0,float,4"`
}

C - Colored Vertex

func (C) Position

func (v C) Position() vec3.T

type CullMode

type CullMode core1_0.CullModeFlags

func (CullMode) String

func (c CullMode) String() string

type GeneratedMesh

type GeneratedMesh[A Args, V Vertex, I Index] interface {
	Mesh
	Update(A)
}

func NewGenerated

func NewGenerated[A Args, V Vertex, I Index](key string, args A, generator func(A) (V, I)) GeneratedMesh[A, V, I]

type Index

type Index interface {
	uint8 | uint16 | uint32
}

type Mesh

type Mesh interface {
	Key() string
	Version() int
	Primitive() Primitive
	Pointers() Pointers
	VertexCount() int
	VertexData() any
	VertexSize() int
	IndexCount() int
	IndexData() any
	IndexSize() int
	Min() vec3.T
	Max() vec3.T

	Positions(func(vec3.T))
	Triangles(iter func(Triangle))
}

func CollisionMesh

func CollisionMesh(mesh Mesh) Mesh

func ScreenQuad

func ScreenQuad(key string) Mesh

Full-screen quad helper

type MutableMesh

type MutableMesh[V Vertex, I Index] interface {
	Mesh
	Vertices() []V
	Indices() []I
	Update(vertices []V, indices []I)
}

func NewLines

func NewLines[T Vertex, K Index](key string, vertices []T, indices []K) MutableMesh[T, K]

func NewMesh

func NewMesh[V Vertex, I Index](key string, primitive Primitive, vertices []V, indices []I) MutableMesh[V, I]

func NewTriangles

func NewTriangles[V Vertex, I Index](key string, vertices []V, indices []I) MutableMesh[V, I]

type P

type P struct {
	vec3.T `vtx:"position,float,3"`
}

P - Position only vertex

func (P) Position

func (v P) Position() vec3.T

type Pointer

type Pointer struct {
	Name        string
	Binding     int
	Source      types.Type
	Destination types.Type
	Elements    int
	Stride      int
	Offset      int
	Normalize   bool
}

func (*Pointer) Bind

func (p *Pointer) Bind(binding int, kind types.Type)

type Pointers

type Pointers []Pointer

func ParsePointers

func ParsePointers(data interface{}) Pointers

func (Pointers) BufferString

func (ps Pointers) BufferString() string

func (Pointers) Stride

func (ps Pointers) Stride() int

type Primitive

type Primitive core1_0.PrimitiveTopology

type T

type T struct {
	P vec3.T `vtx:"position,float,3"`
	N vec3.T `vtx:"normal,float,3"`
	T vec2.T `vtx:"texcoord_0,float,2"`
}

T - Textured Vertex

func (T) Position

func (v T) Position() vec3.T

type Tag

type Tag struct {
	Name      string
	Type      string
	Count     int
	Normalize bool
}

func ParseTag

func ParseTag(tag string) (Tag, error)

type Triangle

type Triangle struct {
	A, B, C vec3.T
}

func (*Triangle) Normal

func (t *Triangle) Normal() vec3.T

type UI

type UI struct {
	P vec3.T  `vtx:"position,float,3"`
	C color.T `vtx:"color_0,float,4"`
	T vec2.T  `vtx:"texcoord_0,float,2"`
}

func (UI) Position

func (v UI) Position() vec3.T

type Vertex

type Vertex interface {
	Position() vec3.T
}

Jump to

Keyboard shortcuts

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