vertex

package
v0.0.0-...-8e5a076 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2024 License: GPL-2.0 Imports: 15 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 VertexFormat](vertices []V) vec3.T

func Min

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

Types

type Args

type Args interface{}

type CullMode

type CullMode core1_0.CullModeFlags

func (CullMode) String

func (c CullMode) String() string

type GeneratedMesh

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

func NewGenerated

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

type IndexFormat

type IndexFormat 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

	// Bounds returns a bounding sphere containing the mesh, centered at the given origin.
	Bounds(vec3.T) shape.Sphere

	Positions() iter.Seq[vec3.T]
	Triangles() iter.Seq[Triangle]

	// Self-referential
	LoadMesh(fs.Filesystem) Mesh
}

func ScreenQuad

func ScreenQuad(key string) Mesh

Full-screen quad helper

type MutableMesh

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

func NewLines

func NewLines[T VertexFormat, K IndexFormat](key string, vertices []T, indices []K) MutableMesh[T, K]

func NewMesh

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

func NewTriangles

func NewTriangles[V VertexFormat, I IndexFormat](key string, vertices []V, indices []I) MutableMesh[V, I]

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 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 Vertex

type Vertex struct {
	P vec3.T  `vtx:"position,float,3"`
	N vec3.T  `vtx:"normal,float,3"`
	T vec2.T  `vtx:"tex,float,2"`
	C color.T `vtx:"color,float,4"`
	// contains filtered or unexported fields
}

Standard vertex format

func C

func C(p vec3.T, n vec3.T, c color.T) Vertex

C defines a vertex with a position and color

func New

func New(p vec3.T, n vec3.T, t vec2.T, c color.T) Vertex

New creates a new vertex with position, normal, texture coordinates and color

func P

func P(p vec3.T) Vertex

P defines a vertex with a position

func T

func T(p vec3.T, n vec3.T, t vec2.T) Vertex

T defines a vertex with a position, normal and texture coordinates

func (Vertex) Position

func (v Vertex) Position() vec3.T

type VertexFormat

type VertexFormat interface {
	Position() vec3.T
}

Jump to

Keyboard shortcuts

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