Texture

package
v0.0.0-...-9749107 Latest Latest
Warning

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

Go to latest
Published: May 4, 2020 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadGray

func LoadGray(filename string) (*image.Gray, error)

Types

type CubeMap

type CubeMap struct {
	Texture
}

func ImportCubeMap

func ImportCubeMap(files []string, textureType Type) (*CubeMap, error)

func NewCubeMapFromRGBAs

func NewCubeMapFromRGBAs(images []*image.RGBA, textureType Type) (*CubeMap, error)

func (*CubeMap) UnmarshalYAML

func (cubeMap *CubeMap) UnmarshalYAML(value *yaml.Node) error

type ITexture

type ITexture interface {
	GetID() uint32
	GetUnit() *Unit
	GetType() Type
	GetTarget() uint32

	Bind() error
	Unbind()

	SetWrapMode(mode WrapMode)
	GenerateMipMap(lodBias float32)
}

type Texture

type Texture struct {
	ID     uint32
	Target uint32
	Type   Type
	Unit   *Unit
}

func (*Texture) Bind

func (texture *Texture) Bind() error

func (*Texture) GenerateMipMap

func (texture *Texture) GenerateMipMap(lodBias float32)

func (*Texture) GetID

func (texture *Texture) GetID() uint32

func (*Texture) GetTarget

func (texture *Texture) GetTarget() uint32

func (*Texture) GetType

func (texture *Texture) GetType() Type

func (*Texture) GetUnit

func (texture *Texture) GetUnit() *Unit

func (*Texture) SetWrapMode

func (texture *Texture) SetWrapMode(mode WrapMode)

func (*Texture) Unbind

func (texture *Texture) Unbind()

type Texture2D

type Texture2D struct {
	Texture
}

func ImportTexture

func ImportTexture(filename string, textureType Type) (*Texture2D, error)

func NewTextureFromRGBA

func NewTextureFromRGBA(img *image.RGBA, textureType Type) (*Texture2D, error)

func (*Texture2D) UnmarshalYAML

func (texture *Texture2D) UnmarshalYAML(value *yaml.Node) error

type Type

type Type string
const (
	DiffuseTexture  Type = "diffuse"
	SpecularTexture Type = "specular"
	EmissiveTexture Type = "emissive"
	NormalsTexture  Type = "normals"
)
const (
	SkyboxTexture Type = "skybox"
)

type Unit

type Unit struct {
	ID      uint32
	Texture ITexture
}

func (*Unit) Activate

func (unit *Unit) Activate()

type UnitManager

type UnitManager []*Unit

func (*UnitManager) FindUnit

func (man *UnitManager) FindUnit(texture ITexture) (*Unit, error)

type WrapMode

type WrapMode int32
const (
	Repeat         WrapMode = gl.REPEAT
	MirroredRepeat WrapMode = gl.MIRRORED_REPEAT
	ClampToEdge    WrapMode = gl.CLAMP_TO_EDGE
	ClampToBorder  WrapMode = gl.CLAMP_TO_BORDER
)

Jump to

Keyboard shortcuts

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