texture

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2019 License: Unlicense Imports: 6 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Atlas

type Atlas struct {
	Colour2D
}

Atlas A texture atlas implementation.

func NewAtlas

func NewAtlas(width int, height int) *Atlas

NewAtlas

func (*Atlas) Format

func (atlas *Atlas) Format() uint32

Format returns colour format For now always RGBA

func (*Atlas) PackTextures

func (atlas *Atlas) PackTextures(textures []ITexture, padding int) ([]shape.Rect, error)

PackTextures

type Colour2D

type Colour2D struct {
	Texture2D
	// contains filtered or unexported fields
}

Colour2D is a material defined by raw/computed colour data, rather than loaded vtf data

func NewError

func NewError(name string) *Colour2D

NewError returns new Error material

func (*Colour2D) Format

func (error *Colour2D) Format() uint32

Format returns colour format

func (*Colour2D) PixelDataForFrame

func (error *Colour2D) PixelDataForFrame(frame int) []byte

PixelDataForFrame returns raw colour data for specific animation frame

func (*Colour2D) Thumbnail

func (error *Colour2D) Thumbnail() []byte

Thumbnail return a low resolution version of the image

type Cubemap

type Cubemap struct {
	Texture2D
	Faces []ITexture
}

Cubemap is a 6-sided edgeless texture that can be mapped to a cube, Used mainly for pre-computed reflections

func NewCubemap

func NewCubemap(materials []ITexture) *Cubemap

NewCubemap returns a new cubemap material

func (*Cubemap) Format

func (material *Cubemap) Format() uint32

Format get material format Same format for all faces assumed

func (*Cubemap) Height

func (material *Cubemap) Height() int

Height Get material height. Must have exactly 6 faces, and all faces are assumed the same size

func (*Cubemap) Width

func (material *Cubemap) Width() int

Width Get material width. Must have exactly 6 faces, and all faces are assumed the same size

type ITexture

type ITexture interface {
	Width() int
	Height() int
	Format() uint32
	PixelDataForFrame(int) []byte
	FilePath() string
	Thumbnail() []byte
}

ITexture Interface for a GPU texture

type Lightmap

type Lightmap struct {
	Colour2D
}

Lightmap is a material used for lighting a face

func LightmapFromColorRGBExp32

func LightmapFromColorRGBExp32(width int, height int, colorMaps []common.ColorRGBExponent32) *Lightmap

LightmapFromColorRGBExp32 creates a lightmap from BSP stored colour data

type Texture2D

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

Texture2D is a generic GPU material struct

func NewTexture2D

func NewTexture2D(filePath string, vtf *vtf.Vtf, width int, height int) *Texture2D

NewTexture2D returns a new texture from Vtf

func (*Texture2D) FilePath

func (tex *Texture2D) FilePath() string

FilePath Get the filepath this data was loaded from

func (*Texture2D) Format

func (tex *Texture2D) Format() uint32

Format returns this materials colour format

func (*Texture2D) Height

func (tex *Texture2D) Height() int

Height returns materials height

func (*Texture2D) PixelDataForFrame

func (tex *Texture2D) PixelDataForFrame(frame int) []byte

PixelDataForFrame get raw colour data for this frame

func (*Texture2D) Thumbnail

func (tex *Texture2D) Thumbnail() []byte

Thumbnail returns a small thumbnail image of a material

func (*Texture2D) Width

func (tex *Texture2D) Width() int

Width returns materials width

Jump to

Keyboard shortcuts

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