graphics

package
v2.6.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2023 License: Apache-2.0 Imports: 7 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 +
		1 // the projection matrix

	TextureDestinationSizeUniformVariableIndex         = 0
	TextureSourceSizesUniformVariableIndex             = 1
	TextureDestinationRegionOriginUniformVariableIndex = 2
	TextureDestinationRegionSizeUniformVariableIndex   = 3
	TextureSourceOffsetsUniformVariableIndex           = 4
	TextureSourceRegionOriginUniformVariableIndex      = 5
	TextureSourceRegionSizeUniformVariableIndex        = 6
	ProjectionMatrixUniformVariableIndex               = 7

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

	// MaxVerticesCount is the maximum number of vertices for one draw call.
	// This value is 2^16 - 1 = 65535, as the index type is uint16.
	// This value cannot be exactly 2^16 == 65536 especially with WebGL 2, as 65536th vertex is not rendered correctly.
	// See https://registry.khronos.org/webgl/specs/latest/2.0/#5.18 .
	MaxVerticesCount     = math.MaxUint16
	MaxVertexFloatsCount = MaxVerticesCount * VertexFloatCount
)

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() []uint16

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

This section is empty.

Jump to

Keyboard shortcuts

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