resource

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2020 License: MIT Imports: 11 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const CubeTextureTypeName = TypeName("cube_texture")
View Source
const LevelTypeName = TypeName("level")
View Source
const MeshTypeName = TypeName("mesh")
View Source
const ModelTypeName = TypeName("model")
View Source
const PBRTypeName = TypeName("pbr")
View Source
const ProgramTypeName = TypeName("program")
View Source
const TwoDTextureTypeName = TypeName("twod_texture")

Variables

This section is empty.

Functions

func BuildGeometryFragmentShader

func BuildGeometryFragmentShader(spec PBRGeometrySpec) string

func BuildGeometryVertexShader

func BuildGeometryVertexShader(spec PBRGeometrySpec) string

func InjectCubeTexture

func InjectCubeTexture(target **CubeTexture) func(value interface{})

func InjectLevel

func InjectLevel(target **Level) func(value interface{})

func InjectMesh

func InjectMesh(target **Mesh) func(value interface{})

func InjectModel

func InjectModel(target **Model) func(value interface{})

func InjectProgram

func InjectProgram(target **Program) func(value interface{})

func InjectShader

func InjectShader(target **Shader) func(value interface{})

func InjectTwoDTexture

func InjectTwoDTexture(target **TwoDTexture) func(value interface{})

func ReleaseMesh

func ReleaseMesh(registry *Registry, gfxWorker *async.Worker, mesh *Mesh) error

Types

type CubeTexture

type CubeTexture struct {
	Name       string
	GFXTexture *graphics.CubeTexture
}

type CubeTextureOperator

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

func NewCubeTextureOperator

func NewCubeTextureOperator(locator Locator, gfxWorker *async.Worker) *CubeTextureOperator

func (*CubeTextureOperator) Allocate

func (o *CubeTextureOperator) Allocate(registry *Registry, name string) (interface{}, error)

func (*CubeTextureOperator) Release

func (o *CubeTextureOperator) Release(registry *Registry, resource interface{}) error

type Entity

type Entity struct {
	Model  *Model
	Matrix sprec.Mat4
}

type FileLocator

type FileLocator struct{}

func (FileLocator) Open

func (FileLocator) Open(segments ...string) (io.ReadCloser, error)

type Level

type Level struct {
	Name                     string
	SkyboxTexture            *CubeTexture
	AmbientReflectionTexture *CubeTexture
	AmbientRefractionTexture *CubeTexture
	CollisionMeshes          []shape.Placement
	StaticMeshes             []*Mesh
	StaticEntities           []*Entity
}

type LevelOperator

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

func NewLevelOperator

func NewLevelOperator(locator Locator, gfxWorker *async.Worker) *LevelOperator

func (*LevelOperator) Allocate

func (o *LevelOperator) Allocate(registry *Registry, name string) (interface{}, error)

func (*LevelOperator) Release

func (o *LevelOperator) Release(registry *Registry, res interface{}) error

type Locator

type Locator interface {
	Open(segments ...string) (io.ReadCloser, error)
}

type Material

type Material struct {
	Shader           *Shader
	BackfaceCulling  bool
	Metalness        float32
	MetalnessTexture *TwoDTexture
	Roughness        float32
	RoughnessTexture *TwoDTexture
	AlbedoColor      sprec.Vec4
	AlbedoTexture    *TwoDTexture
	NormalScale      float32
	NormalTexture    *TwoDTexture
}

type Mesh

type Mesh struct {
	Name           string
	GFXVertexArray *graphics.VertexArray
	SubMeshes      []SubMesh
}

func AllocateMesh

func AllocateMesh(registry *Registry, name string, gfxWorker *async.Worker, meshAsset *asset.Mesh) (*Mesh, error)

type MeshOperator

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

func NewMeshOperator

func NewMeshOperator(locator Locator, gfxWorker *async.Worker) *MeshOperator

func (*MeshOperator) Allocate

func (o *MeshOperator) Allocate(registry *Registry, name string) (interface{}, error)

func (*MeshOperator) Release

func (o *MeshOperator) Release(registry *Registry, resource interface{}) error

type Model

type Model struct {
	Name  string
	Nodes []*Node
	// contains filtered or unexported fields
}

func (Model) FindNode

func (m Model) FindNode(name string) (*Node, bool)

type ModelOperator

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

func NewModelOperator

func NewModelOperator(locator Locator, gfxWorker *async.Worker) *ModelOperator

func (*ModelOperator) Allocate

func (o *ModelOperator) Allocate(registry *Registry, name string) (interface{}, error)

func (*ModelOperator) Release

func (o *ModelOperator) Release(registry *Registry, resource interface{}) error

type Node

type Node struct {
	Name     string
	Matrix   sprec.Mat4
	Mesh     *Mesh
	Parent   *Node
	Children []*Node
}

func (Node) FindNode

func (n Node) FindNode(name string) (*Node, bool)

type Operator

type Operator interface {
	Allocate(registry *Registry, name string) (interface{}, error)
	Release(registry *Registry, resource interface{}) error
}

type PBRGeometrySpec

type PBRGeometrySpec struct {
	UsesAlbedoTexture bool
	UsesTexCoord0     bool
}

type PBRShaderOperator

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

func NewPBRShaderOperator

func NewPBRShaderOperator(gfxWorker *async.Worker) *PBRShaderOperator

func (*PBRShaderOperator) Allocate

func (o *PBRShaderOperator) Allocate(info ShaderInfo) (*Shader, error)

func (*PBRShaderOperator) Release

func (o *PBRShaderOperator) Release(shader *Shader) error

type Program

type Program struct {
	Name       string
	GFXProgram *graphics.Program
}

type ProgramOperator

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

func NewProgramOperator

func NewProgramOperator(locator Locator, gfxWorker *async.Worker) *ProgramOperator

func (*ProgramOperator) Allocate

func (o *ProgramOperator) Allocate(registry *Registry, name string) (interface{}, error)

func (*ProgramOperator) Release

func (o *ProgramOperator) Release(registry *Registry, resource interface{}) error

type Reference

type Reference struct {
	Count           int
	LoadOperation   async.Outcome
	UnloadOperation async.Outcome
	Value           interface{}
}

TODO: Make private

type Registry

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

func NewRegistry

func NewRegistry(locator Locator, gfxWorker *async.Worker) *Registry

func (*Registry) CreateShader

func (r *Registry) CreateShader(typeName TypeName, info ShaderInfo) async.Outcome

func (*Registry) Load

func (r *Registry) Load(typeName TypeName, name string) async.Outcome

func (*Registry) LoadCubeTexture

func (r *Registry) LoadCubeTexture(name string) async.Outcome

func (*Registry) LoadLevel

func (r *Registry) LoadLevel(name string) async.Outcome

func (*Registry) LoadMesh

func (r *Registry) LoadMesh(name string) async.Outcome

func (*Registry) LoadModel

func (r *Registry) LoadModel(name string) async.Outcome

func (*Registry) LoadProgram

func (r *Registry) LoadProgram(name string) async.Outcome

func (*Registry) LoadTwoDTexture

func (r *Registry) LoadTwoDTexture(name string) async.Outcome

func (*Registry) Register

func (r *Registry) Register(typeName TypeName, operator Operator)

func (*Registry) RegisterShader

func (r *Registry) RegisterShader(typeName TypeName, operator ShaderOperator)

func (*Registry) ReleaseShader

func (r *Registry) ReleaseShader(typeName TypeName, shader *Shader) async.Outcome

func (*Registry) Unload

func (r *Registry) Unload(typeName TypeName, name string) async.Outcome

func (*Registry) UnloadCubeTexture

func (r *Registry) UnloadCubeTexture(texture *CubeTexture) async.Outcome

func (*Registry) UnloadLevel

func (r *Registry) UnloadLevel(texture *Level) async.Outcome

func (*Registry) UnloadMesh

func (r *Registry) UnloadMesh(texture *Mesh) async.Outcome

func (*Registry) UnloadModel

func (r *Registry) UnloadModel(texture *Model) async.Outcome

func (*Registry) UnloadProgram

func (r *Registry) UnloadProgram(program *Program) async.Outcome

func (*Registry) UnloadTwoDTexture

func (r *Registry) UnloadTwoDTexture(texture *TwoDTexture) async.Outcome

type Shader

type Shader struct {
	Type            TypeName
	Info            ShaderInfo
	GeometryProgram *graphics.Program
	ForwardProgram  *graphics.Program
}

type ShaderInfo

type ShaderInfo struct {
	HasMetalnessTexture bool
	HasRoughnessTexture bool
	HasAlbedoTexture    bool
	HasNormalTexture    bool
}

type ShaderOperator

type ShaderOperator interface {
	Allocate(info ShaderInfo) (*Shader, error)
	Release(shader *Shader) error
}

type ShaderType

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

func (*ShaderType) Create

func (t *ShaderType) Create(info ShaderInfo) async.Outcome

func (*ShaderType) Release

func (t *ShaderType) Release(info ShaderInfo) async.Outcome

type SubMesh

type SubMesh struct {
	Primitive   graphics.RenderPrimitive
	IndexOffset int
	IndexCount  int32
	Material    *Material
}

type TwoDTexture

type TwoDTexture struct {
	Name       string
	GFXTexture *graphics.TwoDTexture
}

type TwoDTextureOperator

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

func NewTwoDTextureOperator

func NewTwoDTextureOperator(locator Locator, gfxWorker *async.Worker) *TwoDTextureOperator

func (*TwoDTextureOperator) Allocate

func (o *TwoDTextureOperator) Allocate(registry *Registry, name string) (interface{}, error)

func (*TwoDTextureOperator) Release

func (o *TwoDTextureOperator) Release(registry *Registry, resource interface{}) error

type Type

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

func (*Type) Load

func (t *Type) Load(name string) async.Outcome

func (*Type) Unload

func (t *Type) Unload(name string) async.Outcome

type TypeName

type TypeName string

Jump to

Keyboard shortcuts

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