Documentation ¶
Index ¶
- Constants
- Variables
- func Encode(value interface{}) error
- type Binary
- type BodyDefinition
- type BodyInstance
- type CollisionBox
- type CollisionMesh
- type CollisionSphere
- type CollisionTriangle
- type CubeTexture
- type CubeTextureSide
- type Decodable
- type Encodable
- type FilterMode
- type IndexLayout
- type Material
- type MaterialType
- type MeshDefinition
- type MeshFragment
- type MeshInstance
- type MeshTopology
- type Model
- type Node
- type ReflectDecoder
- type ReflectEncoder
- type Registry
- type RegistryLocator
- type Resource
- type Scene
- type TexelFormat
- type TextureFlag
- type TwoDTexture
- type VertexLayout
- type WrapMode
Constants ¶
const UnspecifiedNodeIndex = int32(-1)
const UnspecifiedOffset = int32(-1)
Variables ¶
var ErrNotFound = fmt.Errorf("not found")
ErrNotFound indicates that the specified content is not available.
Functions ¶
Types ¶
type BodyDefinition ¶ added in v0.8.0
type BodyDefinition struct { Name string IsStatic bool Mass float32 MomentOfInertia [3][3]float32 RestitutionCoefficient float32 DragFactor float32 AngularDragFactor float32 CollisionBoxes []CollisionBox CollisionSpheres []CollisionSphere CollisionMeshes []CollisionMesh }
type BodyInstance ¶ added in v0.8.0
type CollisionBox ¶ added in v0.8.0
type CollisionMesh ¶ added in v0.8.0
type CollisionMesh struct { Translation [3]float32 Rotation [4]float32 Triangles []CollisionTriangle }
type CollisionSphere ¶ added in v0.8.0
type CollisionTriangle ¶ added in v0.8.0
type CubeTexture ¶
type CubeTexture struct { Dimension uint16 Filtering FilterMode Format TexelFormat Flags TextureFlag FrontSide CubeTextureSide BackSide CubeTextureSide LeftSide CubeTextureSide RightSide CubeTextureSide TopSide CubeTextureSide BottomSide CubeTextureSide }
func (*CubeTexture) DecodeFrom ¶
func (t *CubeTexture) DecodeFrom(in io.Reader) error
type CubeTextureSide ¶
type CubeTextureSide struct {
Data []byte
}
type FilterMode ¶
type FilterMode uint8
const ( FilterModeNearest FilterMode = iota FilterModeLinear FilterModeAnisotropic )
type IndexLayout ¶ added in v0.8.0
type IndexLayout uint8
const ( IndexLayoutUint16 IndexLayout = iota IndexLayoutUint32 )
type MaterialType ¶ added in v0.8.0
type MaterialType uint8
const ( MaterialTypePBR MaterialType = iota MaterialTypeAlbedo )
type MeshDefinition ¶ added in v0.8.0
type MeshDefinition struct { Name string VertexData []byte VertexLayout VertexLayout IndexData []byte IndexLayout IndexLayout Fragments []MeshFragment }
type MeshFragment ¶ added in v0.8.0
type MeshFragment struct { Topology MeshTopology IndexOffset int32 IndexCount uint32 MaterialIndex int32 }
type MeshInstance ¶ added in v0.8.0
type MeshTopology ¶ added in v0.8.0
type MeshTopology uint8
const ( MeshTopologyPoints MeshTopology = iota MeshTopologyLineStrip MeshTopologyLineLoop MeshTopologyLines MeshTopologyTriangleStrip MeshTopologyTriangleFan MeshTopologyTriangles )
type Model ¶ added in v0.8.0
type Model struct { Nodes []Node Materials []Material MeshDefinitions []MeshDefinition MeshInstances []MeshInstance BodyDefinitions []BodyDefinition BodyInstances []BodyInstance }
type ReflectDecoder ¶ added in v0.8.0
type ReflectDecoder struct {
// contains filtered or unexported fields
}
func NewReflectDecoder ¶ added in v0.8.0
func NewReflectDecoder(in io.Reader) *ReflectDecoder
func (*ReflectDecoder) Decode ¶ added in v0.8.0
func (d *ReflectDecoder) Decode(target interface{}) error
type ReflectEncoder ¶ added in v0.8.0
type ReflectEncoder struct {
// contains filtered or unexported fields
}
func NewReflectEncoder ¶ added in v0.8.0
func NewReflectEncoder(out io.Writer) *ReflectEncoder
type Registry ¶
type Registry interface { Resources() []Resource ResourceByID(id string) Resource ResourceByName(name string) Resource ResourcesByName(name string) []Resource CreateResource(kind, name string) Resource // CreateIDResource is deprecated and available only due to the old // pack mechanism. CreateIDResource(id, kind, name string) Resource Save() error }
Registry represents a managment interface for assets.
func NewDirRegistry ¶
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 NewWebRegistry ¶
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.
type RegistryLocator ¶ added in v0.8.0
type RegistryLocator struct {
// contains filtered or unexported fields
}
RegistryLocator is an implementation of ReadLocator that uses a Registry to access resources.
func NewRegistryLocator ¶ added in v0.8.0
func NewRegistryLocator(registry Registry) *RegistryLocator
NewRegistryLocator returns a new *FileLocator that is configured to access resources located on the local filesystem.
func (*RegistryLocator) ReadResource ¶ added in v0.8.0
func (l *RegistryLocator) ReadResource(path string) (io.ReadCloser, error)
type Resource ¶
type Resource interface { ID() string Kind() string Name() string SetName(name string) Dependants() []Resource Dependencies() []Resource AddDependency(resource Resource) RemoveDependency(resource Resource) ReadPreview() (image.Image, error) WritePreview(image.Image) error DeletePreview() error ReadContent(target Decodable) error WriteContent(source Encodable) error DeleteContent() error Delete() }
Resource represents the generic aspects of an asset.
type TexelFormat ¶
type TexelFormat uint8
const ( TexelFormatR8 TexelFormat = iota TexelFormatR16 TexelFormatR16F TexelFormatR32F TexelFormatRG8 TexelFormatRG16 TexelFormatRG16F TexelFormatRG32F TexelFormatRGB8 TexelFormatRGB16 TexelFormatRGB16F TexelFormatRGB32F TexelFormatRGBA8 TexelFormatRGBA16 TexelFormatRGBA16F TexelFormatRGBA32F TexelFormatDepth16F TexelFormatDepth32F )
type TextureFlag ¶ added in v0.8.0
type TextureFlag uint8
const ( TextureFlagMipmapping TextureFlag = 1 << iota TextureFlagLinear TextureFlagNone TextureFlag = 0 )
func (TextureFlag) Has ¶ added in v0.8.0
func (f TextureFlag) Has(flag TextureFlag) bool
type TwoDTexture ¶
type TwoDTexture struct { Width uint16 Height uint16 Wrapping WrapMode Filtering FilterMode Format TexelFormat Flags TextureFlag Data []byte }
func (*TwoDTexture) DecodeFrom ¶
func (t *TwoDTexture) DecodeFrom(in io.Reader) error