asset

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: May 14, 2022 License: MIT Imports: 13 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = fmt.Errorf("not found")

ErrNotFound indicates that the specified content is not available.

Functions

This section is empty.

Types

type CubeTexture

type CubeTexture struct {
	Dimension  uint16
	MagFilter  FilterMode
	MinFilter  FilterMode
	Format     TexelFormat
	FrontSide  CubeTextureSide
	BackSide   CubeTextureSide
	LeftSide   CubeTextureSide
	RightSide  CubeTextureSide
	TopSide    CubeTextureSide
	BottomSide CubeTextureSide
}

func (*CubeTexture) DecodeFrom

func (t *CubeTexture) DecodeFrom(in io.Reader) error

func (*CubeTexture) EncodeTo

func (t *CubeTexture) EncodeTo(out io.Writer) error

type CubeTextureSide

type CubeTextureSide struct {
	Data []byte
}

type Decodable

type Decodable interface {
	DecodeFrom(in io.Reader) error
}

Decodable represents an asset that can be deserialized.

type Dependency

type Dependency struct {
	SourceGUID string
	TargetGUID string
}

Dependency describes the dependency of a source asset to a target asset.

type DirRegistry

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

DirRegistry is an implementation of Registry that stores content on the local filesystem.

func NewDirRegistry

func NewDirRegistry(dir string) (*DirRegistry, error)

NewDirRegistry creates a Registry implementation that stores content on the filesystem. The provided dir parameter needs to point to the project root. A special assets directory will be created inside if one is not available already.

func (*DirRegistry) DeleteContent

func (r *DirRegistry) DeleteContent(guid string) error

func (*DirRegistry) DeletePreview

func (r *DirRegistry) DeletePreview(guid string) error

func (*DirRegistry) ReadContent

func (r *DirRegistry) ReadContent(guid string, target Decodable) error

func (*DirRegistry) ReadDependencies

func (r *DirRegistry) ReadDependencies() ([]Dependency, error)

func (*DirRegistry) ReadPreview

func (r *DirRegistry) ReadPreview(guid string) (image.Image, error)

func (*DirRegistry) ReadResources

func (r *DirRegistry) ReadResources() ([]Resource, error)

func (*DirRegistry) WriteContent

func (r *DirRegistry) WriteContent(guid string, target Encodable) error

func (*DirRegistry) WriteDependencies

func (r *DirRegistry) WriteDependencies(dependencies []Dependency) error

func (*DirRegistry) WritePreview

func (r *DirRegistry) WritePreview(guid string, img image.Image) error

func (*DirRegistry) WriteResources

func (r *DirRegistry) WriteResources(resources []Resource) error

type Encodable

type Encodable interface {
	EncodeTo(out io.Writer) error
}

Encodable represents an asset that can be serialized.

type FilterMode

type FilterMode uint8
const (
	FilterModeUnspecified FilterMode = iota
	FilterModeNearest
	FilterModeLinear
	FilterModeNearestMipmapNearest
	FilterModeNearestMipmapLinear
	FilterModeLinearMipmapNearest
	FilterModeLinearMipmapLinear
)

type Registry

type Registry interface {
	ReadResources() ([]Resource, error)
	WriteResources(resources []Resource) error

	ReadDependencies() ([]Dependency, error)
	WriteDependencies(dependencies []Dependency) error

	ReadPreview(guid string) (image.Image, error)
	WritePreview(guid string, img image.Image) error
	DeletePreview(guid string) error

	ReadContent(guid string, target Decodable) error
	WriteContent(guid string, target Encodable) error
	DeleteContent(guid string) error
}

Registry represents a managment interface for assets.

type Resource

type Resource struct {
	GUID string
	Kind string
	Name string
}

Resource represents the generic aspects of an asset.

type TexelFormat

type TexelFormat uint32
const (
	TexelFormatUnspecified TexelFormat = iota
	TexelFormatR8
	TexelFormatR16
	TexelFormatR32F
	TexelFormatRG8
	TexelFormatRG16
	TexelFormatRG32F
	TexelFormatRGB8
	TexelFormatRGB16
	TexelFormatRGB32F
	TexelFormatRGBA8
	TexelFormatRGBA16
	TexelFormatRGBA32F
	TexelFormatDepth32F
)

type TwoDTexture

type TwoDTexture struct {
	Width     uint16
	Height    uint16
	WrapModeS WrapMode
	WrapModeT WrapMode
	MagFilter FilterMode
	MinFilter FilterMode
	Format    TexelFormat
	Data      []byte
}

func (*TwoDTexture) DecodeFrom

func (t *TwoDTexture) DecodeFrom(in io.Reader) error

func (*TwoDTexture) EncodeTo

func (t *TwoDTexture) EncodeTo(out io.Writer) error

type WebRegistry

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

WebRegistry is an implementation of Registry that reads content from the web.

func NewWebRegistry

func NewWebRegistry(assetsURL string) *WebRegistry

NewWebRegistry creates a Registry implementation that reads content from the web. The provided assetsURL parameter needs to point to the web location of the assets.

This registry does not support write or delete operations.

func (*WebRegistry) DeleteContent

func (r *WebRegistry) DeleteContent(guid string) error

func (*WebRegistry) DeletePreview

func (r *WebRegistry) DeletePreview(guid string) error

func (*WebRegistry) ReadContent

func (r *WebRegistry) ReadContent(guid string, target Decodable) error

func (*WebRegistry) ReadDependencies

func (r *WebRegistry) ReadDependencies() ([]Dependency, error)

func (*WebRegistry) ReadPreview

func (r *WebRegistry) ReadPreview(guid string) (image.Image, error)

func (*WebRegistry) ReadResources

func (r *WebRegistry) ReadResources() ([]Resource, error)

func (*WebRegistry) WriteContent

func (r *WebRegistry) WriteContent(guid string, target Encodable) error

func (*WebRegistry) WriteDependencies

func (r *WebRegistry) WriteDependencies(dependencies []Dependency) error

func (*WebRegistry) WritePreview

func (r *WebRegistry) WritePreview(guid string, img image.Image) error

func (*WebRegistry) WriteResources

func (r *WebRegistry) WriteResources(resources []Resource) error

type WrapMode

type WrapMode uint8
const (
	WrapModeUnspecified WrapMode = iota
	WrapModeRepeat
	WrapModeMirroredRepeat
	WrapModeClampToEdge
	WrapModeMirroredClampToEdge
)

Jump to

Keyboard shortcuts

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