mesh

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: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Deserialize

func Deserialize(dec object.Decoder) (object.Component, error)

Types

type Data

type Data[V vertex.Vertex, I vertex.Index] struct {
	Vertices []V
	Indices  []I
}

type Dynamic

type Dynamic[V vertex.Vertex, I vertex.Index] struct {
	*Static
	// contains filtered or unexported fields
}

func NewDynamic

func NewDynamic[V vertex.Vertex, I vertex.Index](name string, mat *material.Def, fn Generator[V, I]) *Dynamic[V, I]

func (*Dynamic[V, I]) Name

func (m *Dynamic[V, I]) Name() string

func (*Dynamic[V, I]) Refresh

func (m *Dynamic[V, I]) Refresh()

func (*Dynamic[V, I]) RefreshSync

func (m *Dynamic[V, I]) RefreshSync()

func (*Dynamic[V, I]) Update

func (m *Dynamic[V, I]) Update(scene object.Component, dt float32)

type Generator

type Generator[V vertex.Vertex, I vertex.Index] func() Data[V, I]

type Mesh

type Mesh interface {
	object.Component

	Primitive() vertex.Primitive
	CastShadows() bool
	Material() *material.Def
	MaterialID() material.ID

	Texture(texture.Slot) texture.Ref

	// Bounding sphere used for view frustum culling
	BoundingSphere() shape.Sphere

	// returns the VertexData property
	// this is kinda ugly - but other components might need to subscribe to changes ?
	Mesh() *object.Property[vertex.Mesh]
}

type MeshState

type MeshState struct {
	object.ComponentState
	Primitive vertex.Primitive
	Material  material.Def
	TexSlots  map[texture.Slot]texture.Ref
}

type Static

type Static struct {
	object.Component

	VertexData object.Property[vertex.Mesh]
	// contains filtered or unexported fields
}

mesh base

func New

func New(mat *material.Def) *Static

New creates a new mesh component

func NewLines

func NewLines() *Static

NewLines creates a new line mesh component

func NewPrimitiveMesh

func NewPrimitiveMesh(primitive vertex.Primitive, mat *material.Def) *Static

NewPrimitiveMesh creates a new mesh composed of a given GL primitive

func (*Static) BoundingSphere

func (m *Static) BoundingSphere() shape.Sphere

func (*Static) CastShadows

func (m *Static) CastShadows() bool

func (*Static) Material

func (m *Static) Material() *material.Def

func (*Static) MaterialID

func (m *Static) MaterialID() material.ID

func (*Static) Mesh

func (m *Static) Mesh() *object.Property[vertex.Mesh]

func (*Static) Name

func (m *Static) Name() string

func (*Static) Primitive

func (m *Static) Primitive() vertex.Primitive

func (*Static) Serialize

func (m *Static) Serialize(enc object.Encoder) error

func (*Static) SetShadows

func (m *Static) SetShadows(shadows bool)

func (*Static) SetTexture

func (m *Static) SetTexture(slot texture.Slot, ref texture.Ref)

func (*Static) Texture

func (m *Static) Texture(slot texture.Slot) texture.Ref

Jump to

Keyboard shortcuts

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