assets

package
v0.23.2 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: MIT Imports: 12 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Textures     = make(map[uint32]Texture)
	TexturePaths = make(map[string]uint32)
)

Functions

func AddTextureToCache added in v0.12.10

func AddTextureToCache(t Texture)

Types

type ColorFormat

type ColorFormat int
const (
	ColorFormat_Unknown ColorFormat = iota
	ColorFormat_RGBA8
)

type Cubemap added in v0.14.0

type Cubemap struct {
	// These only exists for textures loaded from disk
	RightPath string
	LeftPath  string
	TopPath   string
	BotPath   string
	FrontPath string
	BackPath  string
	TexID     uint32
}

func LoadCubemapTextures added in v0.14.0

func LoadCubemapTextures(rightTex, leftTex, topTex, botTex, frontTex, backTex string, loadOptions *TextureLoadOptions) (Cubemap, error)

LoadCubemapTextures only supports the 'TextureIsSrgba' option

type Texture

type Texture struct {
	// Path only exists for textures loaded from disk
	Path string

	TexID uint32

	// Width is the width of the texture in pixels (pixels per row).
	// Note that the number of bytes constituting a row is MORE than this (e.g. for RGBA8, bytesPerRow=width*4, since we have 4 bytes per pixel)
	Width int32

	// Height is the height of the texture in pixels (pixels per column).
	// Note that the number of bytes constituting a column is MORE than this (e.g. for RGBA8, bytesPerColumn=height*4, since we have 4 bytes per pixel)
	Height int32

	// Pixels usually stored in RGBA format
	Pixels []byte
}

func GetTextureFromCacheID added in v0.12.10

func GetTextureFromCacheID(texID uint32) (Texture, bool)

func GetTextureFromCachePath added in v0.12.10

func GetTextureFromCachePath(path string) (Texture, bool)

func LoadTextureInMemPngImg added in v0.14.0

func LoadTextureInMemPngImg(img image.Image, loadOptions *TextureLoadOptions) (Texture, error)

func LoadTextureJpeg added in v0.14.0

func LoadTextureJpeg(file string, loadOptions *TextureLoadOptions) (Texture, error)

func LoadTexturePNG added in v0.12.12

func LoadTexturePNG(file string, loadOptions *TextureLoadOptions) (Texture, error)

type TextureLoadOptions added in v0.12.10

type TextureLoadOptions struct {
	TryLoadFromCache bool
	WriteToCache     bool
	GenMipMaps       bool
	KeepPixelsInMem  bool
	NoSrgba          bool
}

Jump to

Keyboard shortcuts

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