graphics

package
v2.7.2 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ShaderImageCount = 4

	// PreservedUniformVariablesCount represents the number of preserved uniform variables.
	// Any shaders in Ebitengine must have these uniform variables.
	PreservedUniformVariablesCount = 1 +
		1 +
		1 +
		1 +
		1 +
		1 +
		1 // the projection matrix

	ProjectionMatrixUniformVariableIndex = 6

	PreservedUniformUint32Count = 2 +
		2*ShaderImageCount +
		2 +
		2 +
		2*ShaderImageCount +
		2*ShaderImageCount +
		16 // the projection matrix
)
View Source
const (
	VertexFloatCount = 8
)

Variables

This section is empty.

Functions

func CompileShader added in v2.3.0

func CompileShader(src []byte) (*shaderir.Program, error)

func InternalImageSize

func InternalImageSize(x int) int

InternalImageSize returns a nearest appropriate size as an internal image.

func QuadIndices

func QuadIndices() []uint32

func QuadVertices

func QuadVertices(dst []float32, sx0, sy0, sx1, sy1 float32, a, b, c, d, tx, ty float32, cr, cg, cb, ca float32)

QuadVertices sets a float32 slice for a quadrangle. QuadVertices sets a slice that never overlaps with other slices returned this function, and users can do optimization based on this fact.

Types

type ManagedBytes added in v2.7.0

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

ManagedBytes is a managed byte slice. The internal byte alice are managed in a pool. ManagedBytes is useful when its lifetime is explicit, as the underlying byte slice can be reused for another ManagedBytes later. This can reduce allocations and GCs.

func NewManagedBytes added in v2.7.0

func NewManagedBytes(size int, f func([]byte)) *ManagedBytes

NewManagedBytes returns a managed byte slice initialized by the given constructor f.

The byte slice is not zero-cleared at the constructor.

func (*ManagedBytes) Clone added in v2.7.0

func (m *ManagedBytes) Clone() *ManagedBytes

Clone creates a new ManagedBytes with the same content.

func (*ManagedBytes) GetAndRelease added in v2.7.0

func (m *ManagedBytes) GetAndRelease() ([]byte, func())

GetAndRelease returns the raw byte slice and a finalizer. A finalizer should be called when you can ensure that the slice is no longer used, e.g. when a graphics command using this slice is sent and executed.

After GetAndRelease is called, the underlying byte slice is no longer available.

func (*ManagedBytes) Len added in v2.7.0

func (m *ManagedBytes) Len() int

Len returns the length of the slice.

func (*ManagedBytes) Read added in v2.7.0

func (m *ManagedBytes) Read(dst []byte, from, to int)

Read reads the byte slice's content to dst.

Jump to

Keyboard shortcuts

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