Documentation ¶
Overview ¶
Package asseet provides data transfer objects for the game's asset types.
Index ¶
- Constants
- Variables
- type AmbientLight
- type Animation
- type AnimationBinding
- type AnimationKeyframe
- type Armature
- type Body
- type BodyDefinition
- type BodyMaterial
- type Camera
- type CollisionBox
- type CollisionMesh
- type CollisionSphere
- type CollisionTriangle
- type Comparison
- type CullMode
- type DirectionalLight
- type FaceOrientation
- type FilterMode
- type FoVMode
- type Formatter
- type Fragment
- type Geometry
- type IndexBuffer
- type IndexLayout
- type Joint
- type Material
- type MaterialBinding
- type MaterialPass
- type Mesh
- type MeshDefinition
- type MipmapLayer
- type Model
- type ModelInstance
- type Node
- type NodeMask
- type PointLight
- type PropertyBinding
- type Registry
- type Resource
- func (r *Resource) Delete() error
- func (r *Resource) Dependants() []*Resource
- func (r *Resource) Dependencies() []*Resource
- func (r *Resource) ID() string
- func (r *Resource) Name() string
- func (r *Resource) OpenContent() (Model, error)
- func (r *Resource) Preview() image.Image
- func (r *Resource) Registry() *Registry
- func (r *Resource) SaveContent(content Model) error
- func (r *Resource) SetName(name string) error
- func (r *Resource) SetPreview(preview image.Image) error
- func (r *Resource) SetSourceDigest(digest string) error
- func (r *Resource) SourceDigest() string
- type Shader
- type ShaderType
- type Sky
- type SpotLight
- type Storage
- type TexelFormat
- type Texture
- type TextureBinding
- type TextureFlag
- type TextureLayer
- type Topology
- type VertexAttribute
- type VertexAttributeFormat
- type VertexBuffer
- type VertexLayout
- type WrapMode
Constants ¶
const (
UnspecifiedArmatureIndex = int32(-1)
)
const (
UnspecifiedBufferIndex = int32(-1)
)
const (
UnspecifiedNodeIndex = int32(-1)
)
Variables ¶
var ErrNotFound = fs.ErrNotExist
ErrNotFound indicates that the specified content is not available.
Functions ¶
This section is empty.
Types ¶
type AmbientLight ¶ added in v0.19.0
type AmbientLight struct { // NodeIndex is the index of the node that is associated with the light. NodeIndex uint32 // ReflectionTextureIndex is the index of the cube texture that is used // for reflection mapping. ReflectionTextureIndex uint32 // RefractionTextureIndex is the index of the cube texture that is used // for refraction mapping. RefractionTextureIndex uint32 // CastShadow specifies whether a SSAO-type technique should be applied. CastShadow bool }
AmbientLight represents a light source that emits light in all directions from all points in space.
type Animation ¶ added in v0.9.0
type Animation struct { // Name identifies this animation. Name string // StartTime is the timestamp in seconds at which this animation starts. StartTime float64 // EndTime is the timestamp in seconds at which this animation ends. EndTime float64 // Bindings is a list of keyframes that are applied to the scene. Bindings []AnimationBinding }
Animation represents a sequence of keyframes that can be applied to a scene to animate it.
type AnimationBinding ¶ added in v0.9.0
type AnimationBinding struct { // NodeName is the name of the node that this binding applies to. NodeName string // TranslationKeyframes is a list of keyframes that animate the translation // of the node. TranslationKeyframes []AnimationKeyframe[dprec.Vec3] // RotationKeyframes is a list of keyframes that animate the rotation // of the node. RotationKeyframes []AnimationKeyframe[dprec.Quat] // ScaleKeyframes is a list of keyframes that animate the scale // of the node. ScaleKeyframes []AnimationKeyframe[dprec.Vec3] }
AnimationBinding represents a set of keyframes that are applied to a specific node in the scene.
type AnimationKeyframe ¶ added in v0.19.0
type AnimationKeyframe[T any] struct { // Timestamp is the time in seconds at which this keyframe is applied. Timestamp float64 // Value is the value that is applied at the given timestamp. Value T }
AnimationKeyframe represents a single keyframe in an animation.
type Armature ¶ added in v0.9.0
type Armature struct { // Joints is the collection of joints that make up the armature. Joints []Joint }
Armature represents the definition of a skeleton.
type Body ¶ added in v0.19.0
type Body struct { // NodeIndex is the index of the node that this body is attached to. NodeIndex uint32 // BodyDefinitionIndex is the index of the body definition that this // body uses. BodyDefinitionIndex uint32 }
Body represents a physical body.
type BodyDefinition ¶ added in v0.8.0
type BodyDefinition struct { // MaterialIndex is the index of the material that this body uses. MaterialIndex uint32 // Mass is the mass of the body. Mass float64 // MomentOfInertia is the moment of inertia of the body represented // as 3x3 tensor. MomentOfInertia dprec.Mat3 // DragFactor is the linear drag factor of the body. DragFactor float64 // AngularDragFactor is the angular drag factor of the body. AngularDragFactor float64 // CollisionBoxes is a list of collision boxes that define the // collision shape of the body. CollisionBoxes []CollisionBox // CollisionSpheres is a list of collision spheres that define the // collision shape of the body. CollisionSpheres []CollisionSphere // CollisionMeshes is a list of collision meshes that define the // collision shape of the body. CollisionMeshes []CollisionMesh }
BodyDefinition represents the physical properties of a body.
type BodyMaterial ¶ added in v0.19.0
type BodyMaterial struct { // FrictionCoefficient is the coefficient of friction of this material. // Lower values mean more slippery surfaces. FrictionCoefficient float64 // RestitutionCoefficient is the coefficient of restitution of this material. // Higher values mean more bouncy surfaces. RestitutionCoefficient float64 }
BodyMaterial represents a physical material.
type Camera ¶ added in v0.19.0
type Camera struct { // NodeIndex is the index of the node that is used by this camera. NodeIndex uint32 // FoVMode determines how the camera field of view is calculated // in the horizontal and vertical directions. FoVMode FoVMode // FoVAngle is the field of view angle of the camera. FoVAngle sprec.Angle // Near is the distance to the near clipping plane. Near float32 // Far is the distance to the far clipping plane. Far float32 // Exposure is the exposure value of the camera. Exposure float32 }
Camera represents a camera that is part of a model.
type CollisionBox ¶ added in v0.8.0
type CollisionBox struct { // Translation is the position of the box. Translation dprec.Vec3 // Rotation is the orientation of the box. Rotation dprec.Quat // Width is the width of the box. Width float64 // Height is the height of the box. Height float64 // Length is the length of the box. Length float64 }
CollisionBox represents a box-shaped collision volume.
type CollisionMesh ¶ added in v0.8.0
type CollisionMesh struct { // Translation is the position of the mesh. Translation dprec.Vec3 // Rotation is the orientation of the mesh. Rotation dprec.Quat // Triangles is a list of triangles that define the collision shape Triangles []CollisionTriangle }
CollisionMesh represents a mesh-shaped collision volume.
type CollisionSphere ¶ added in v0.8.0
type CollisionSphere struct { // Translation is the position of the sphere. Translation dprec.Vec3 // Radius is the radius of the sphere. Radius float64 }
CollisionSphere represents a sphere-shaped collision volume.
type CollisionTriangle ¶ added in v0.8.0
type CollisionTriangle struct { // A is the first vertex of the triangle. A dprec.Vec3 // B is the second vertex of the triangle. B dprec.Vec3 // C is the third vertex of the triangle. C dprec.Vec3 }
CollisionTriangle represents a triangle-shaped collision surface.
Ordering of the vertices determines the normal direction.
type Comparison ¶ added in v0.19.0
type Comparison uint8
Comparison specifies the comparison function.
const ( // ComparisonNever specifies that the comparison should never pass. ComparisonNever Comparison = iota // ComparisonLess specifies that the comparison should pass if the source // value is less than the destination value. ComparisonLess // ComparisonEqual specifies that the comparison should pass if the source // value is equal to the destination value. ComparisonEqual // ComparisonLessOrEqual specifies that the comparison should pass if the // source value is less than or equal to the destination value. ComparisonLessOrEqual // ComparisonGreater specifies that the comparison should pass if the source // value is greater than the destination value. ComparisonGreater // ComparisonNotEqual specifies that the comparison should pass if the // source value is not equal to the destination value. ComparisonNotEqual // ComparisonGreaterOrEqual specifies that the comparison should pass if the // source value is greater than or equal to the destination value. ComparisonGreaterOrEqual // ComparisonAlways specifies that the comparison should always pass. ComparisonAlways )
type CullMode ¶ added in v0.19.0
type CullMode uint8
CullMode specifies the culling mode.
const ( // CullModeNone specifies that no culling should be performed. CullModeNone CullMode = iota // CullModeFront specifies that front-facing primitives should be culled. CullModeFront // CullModeBack specifies that back-facing primitives should be culled. CullModeBack // CullModeFrontAndBack specifies that all oriented primitives should be // culled. CullModeFrontAndBack )
type DirectionalLight ¶ added in v0.19.0
type DirectionalLight struct { // NodeIndex is the index of the node that is associated with the light. NodeIndex uint32 // EmitColor is the linear color of the light that is emitted. EmitColor dprec.Vec3 // CastShadow specifies whether the light should cast shadows. CastShadow bool }
DirectionalLight represents a light source that emits light in a single direction from infinitely away in space.
type FaceOrientation ¶ added in v0.19.0
type FaceOrientation uint8
FaceOrientation specifies the front face orientation.
const ( // FaceOrientationCCW specifies that counter-clockwise primitives are // front-facing. FaceOrientationCCW FaceOrientation = iota // FaceOrientationCW specifies that clockwise primitives are front-facing. FaceOrientationCW )
type FilterMode ¶
type FilterMode uint8
FilterMode is an enumeration of the supported texture filtering modes.
const ( // FilterModeNearest indicates that the nearest texel should be // used for sampling. FilterModeNearest FilterMode = iota // FilterModeLinear indicates that the linear interpolation of // the nearest texels should be used for sampling. FilterModeLinear // FilterModeAnisotropic indicates that the anisotropic filtering // should be used for sampling. FilterModeAnisotropic )
type FoVMode ¶ added in v0.19.0
type FoVMode uint8
FoVMode determines how the camera field of view is calculated in the horizontal and vertical directions.
type Formatter ¶ added in v0.19.0
type Formatter interface { // Encode writes the specified value to the specified writer. Encode(out io.Writer, value any) error // Decode reads the specified value from the specified reader. Decode(in io.Reader, target any) error }
Formatter represents an interface for formatting assets into storage format.
func NewBlobFormatter ¶ added in v0.19.0
func NewBlobFormatter() Formatter
NewBlobFormatter creates a new Formatter that formats assets in binary format.
func NewJSONFormatter ¶ added in v0.19.0
func NewJSONFormatter() Formatter
NewJSONFormatter creates a new Formatter that formats assets in JSON format.
type Fragment ¶ added in v0.19.0
type Fragment struct { // Name is the name of the fragment, often a hint to the material. Name string // Topology specifies the way that the vertices of the fragment are // connected. Topology Topology // IndexByteOffset specifies the byte offset within the IndexBuffer // where the indices of the fragment start. IndexByteOffset uint32 // IndexCount specifies the number of indices that are used to draw the // fragment. IndexCount uint32 }
Fragment represents a portion of a mesh that is drawn with a specific material and topology.
type Geometry ¶ added in v0.19.0
type Geometry struct { // VertexBuffers is the collection of buffers that contain the vertex data. VertexBuffers []VertexBuffer // VertexLayout describes how the vertex data is positioned within the // VertexBuffers. VertexLayout VertexLayout // IndexBuffer is the buffer that contains the index data. IndexBuffer IndexBuffer // Fragments is the collection of fragments that make up the geometry. Fragments []Fragment // BoundingSphereRadius is the radius of the sphere that encompasses the // entire geometry. BoundingSphereRadius float64 // MinDistance is the minimum distance to the camera after which the geometry // should be drawn. MinDistance float64 // MaxDistance is the maximum distance to the camera before which the geometry // should be drawn. MaxDistance float64 }
Geometry represents a collection of vertex and index data that can be used to render a mesh.
type IndexBuffer ¶ added in v0.19.0
type IndexBuffer struct { // IndexLayout specifies the data type that is used to represent individual // indices. IndexLayout IndexLayout // Data is the raw byte data that represents the indices. Data []byte }
IndexBuffer represents a buffer of index data.
type IndexLayout ¶ added in v0.8.0
type IndexLayout uint8
IndexLayout represents the way that the indices of a mesh are stored.
const ( IndexLayoutUint16 IndexLayout = iota IndexLayoutUint32 )
type Joint ¶ added in v0.9.0
type Joint struct { // NodeIndex is the index of the node that is associated with the joint. NodeIndex uint32 // InverseBindMatrix is the matrix that transforms the joint from its // local space to the space of the mesh. InverseBindMatrix sprec.Mat4 }
Joint represents a single joint in an armature.
type Material ¶ added in v0.8.0
type Material struct { // Name is the name of the material. Name string // Textures is a list of textures that will be bound to the material. Textures []TextureBinding // Properties is a list of properties that will be passed to the shader. Properties []PropertyBinding // GeometryPasses specifies a list of geometry passes to be applied. GeometryPasses []MaterialPass // ShadowPasses specifies a list of shadow passes to be applied. ShadowPasses []MaterialPass // ForwardPasses specifies a list of forward passes to be applied. ForwardPasses []MaterialPass // SkyPasses specifies a list of sky passes to be applied, // applicable only to sky materials. SkyPasses []MaterialPass // PostprocessingPasses specifies a list of postprocessing passes to // be applied. Applicable only to postprocessing materials. PostprocessingPasses []MaterialPass }
Material represents a material that can be applied to a mesh.
type MaterialBinding ¶ added in v0.19.0
type MaterialBinding struct { // FragmentIndex is the index of the fragment that is bound to the material. FragmentIndex uint32 // MaterialIndex is the index of the material that is bound to the fragment. MaterialIndex uint32 }
MaterialBinding represents the binding of a material to a geometry fragment.
type MaterialPass ¶ added in v0.19.0
type MaterialPass struct { // Layer controls the render ordering of this pass. Lower values will be // rendered first. Having too many layers can affect performance. Layer int32 // Culling specifies the culling mode. Culling CullMode // FrontFace specifies the front face orientation. FrontFace FaceOrientation // DepthTest specifies whether depth testing should be enabled. DepthTest bool // DepthWrite specifies whether depth writing should be enabled. DepthWrite bool // DepthComparison specifies the depth comparison function. DepthComparison Comparison // Blending specifies whether blending should be enabled. Blending bool // ShaderIndex is the index of the shader to be used. ShaderIndex uint32 }
MaterialPass represents a pass that is applied during material rendering.
type Mesh ¶ added in v0.19.0
type Mesh struct { // NodeIndex is the index of the node that is used by this mesh. NodeIndex uint32 // MeshDefinitionIndex is the index of the mesh definition that is used by // this mesh. MeshDefinitionIndex uint32 // ArmatureIndex is the index of the armature that is used by this mesh. // // If the mesh does not use an armature, this value is set to // UnspecifiedArmatureIndex. ArmatureIndex int32 }
Mesh represents an instance of a mesh definition.
type MeshDefinition ¶ added in v0.8.0
type MeshDefinition struct { // GeometryIndex is the index of the geometry that is used by this mesh. GeometryIndex uint32 // MaterialBindings is the collection of material bindings that are used by // this mesh. MaterialBindings []MaterialBinding }
MeshDefinition represents the definition of a mesh. It extends the Geometry definition by adding material bindings.
type MipmapLayer ¶ added in v0.21.0
type MipmapLayer struct { Width uint32 Height uint32 Depth uint32 Layers []TextureLayer }
type Model ¶ added in v0.8.0
type Model struct { // Nodes is the collection of nodes that are part of the scene. Nodes []Node // Animations is the collection of animations that are part of the scene. Animations []Animation // Armatures is the collection of armatures that are part of the scene. Armatures []Armature // Cameras is the collection of cameras that are part of the scene. Cameras []Camera // Shaders is the collection of custom shaders that are are to be used. Shaders []Shader // Textures is the collection of textures that are part of the scene. Textures []Texture // Materials is the collection of materials that are part of the scene. Materials []Material // Geometries is the collection of geometries that are part of the scene. Geometries []Geometry // MeshDefinitions is the collection of mesh definitions that are part of // the scene. MeshDefinitions []MeshDefinition // Meshes is the collection of mesh instances that are part of the scene. Meshes []Mesh // BodyMaterials is the collection of body materials that are part of the // scene. BodyMaterials []BodyMaterial // BodyDefinitions is the collection of body definitions that are part of // the scene. BodyDefinitions []BodyDefinition // Bodies is the collection of body instances that are part of the scene. Bodies []Body // AmbientLights is the collection of ambient lights that are part of the // scene. AmbientLights []AmbientLight // PointLights is the collection of point lights that are part of the scene. PointLights []PointLight // SpotLights is the collection of spot lights that are part of the scene. SpotLights []SpotLight // DirectionalLights is the collection of directional lights that are part // of the scene. DirectionalLights []DirectionalLight // Skies is the collection of skies that are part of the scene. Skies []Sky // ModelDefinitions is the collection of external scene definitions that // are used by the scene. ModelDefinitions []string // ModelInstances is the instantiation of external scene definitions within // this scene. ModelInstances []ModelInstance }
Model represents a virtual world that is composed of various visual and logical elements.
type ModelInstance ¶ added in v0.9.0
type ModelInstance struct { // ModelDefinitionIndex is the index of the scene definition that is used // by this scene instance. ModelDefinitionIndex uint32 // NodeIndex is the index of the node that is used by this scene instance. NodeIndex uint32 }
ModelInstance represents the instantiation of an external scene definition within a scene.
type Node ¶ added in v0.8.0
type Node struct { // Name is the name of the node. Name string // ParentIndex is the index of the parent node. // // If the node does not have a parent, this value is set to // UnspecifiedNodeIndex. ParentIndex int32 // Translation is the translation of the node. Translation dprec.Vec3 // Rotation is the rotation of the node. Rotation dprec.Quat // Scale is the scale of the node. Scale dprec.Vec3 // Mask is the mask that specifies the behavior of the node. Mask NodeMask }
Node represents a single node in a model.
type NodeMask ¶ added in v0.19.0
type NodeMask uint32
NodeMask specifies the behavior of a node.
const ( // NodeMaskNone specifies that the node has no special behavior. NodeMaskNone NodeMask = 0 // NodeMaskStationary specifies that the node is stationary and should not // be moved. The engine may optimize the node away. NodeMaskStationary NodeMask = 1 << iota // NodeMaskInseparable specifies that the node is inseparable from its // parent. NodeMaskInseparable )
type PointLight ¶ added in v0.19.0
type PointLight struct { // NodeIndex is the index of the node that is associated with the light. NodeIndex uint32 // EmitColor is the linear color of the light that is emitted. EmitColor dprec.Vec3 // EmitDistance is the distance at which the light intensity reaches zero. EmitDistance float64 // CastShadow specifies whether the light should cast shadows. CastShadow bool }
PointLight represents a light source that emits light in all directions from a single point in space.
type PropertyBinding ¶ added in v0.19.0
type PropertyBinding struct { // BindingName is the name of the binding in the shader. BindingName string // Data is the data to be bound. Data []byte }
PropertyBinding represents a binding of a uniform property to a shader.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry represents a managment interface for assets.
func NewRegistry ¶ added in v0.19.0
NewRegistry creates a new Registry that stores its as specified by the provided storage and formatter.
func (*Registry) CreateResource ¶ added in v0.8.0
CreateResource creates a new resource with the specified name.
func (*Registry) Reload ¶ added in v0.19.0
Reload reloads the registry from the storage.
Existing Resource handles should not be used.
func (*Registry) ResourceByID ¶ added in v0.8.0
ResourceByID returns the resource with the specified ID. If no resource with the specified ID exists, nil is returned.
func (*Registry) ResourceByName ¶ added in v0.8.0
ResourceByName returns the resource with the specified name. If no resource with the specified name exists, nil is returned.
type Resource ¶
type Resource struct {
// contains filtered or unexported fields
}
Resource represents the generic aspects of an asset.
func (*Resource) Dependants ¶ added in v0.8.0
Dependants returns a list of resources that depend on this resource.
func (*Resource) Dependencies ¶ added in v0.8.0
Dependencies returns a list of resources that this resource depends on.
func (*Resource) OpenContent ¶ added in v0.19.0
OpenContent returns the content of the resource.
func (*Resource) Registry ¶ added in v0.19.0
Registry returns the registry that manages the resource.
func (*Resource) SaveContent ¶ added in v0.19.0
SaveContent saves the content of the resource.
func (*Resource) SetName ¶ added in v0.8.0
SetName changes the name of the resource. Two resources cannot have the same name.
func (*Resource) SetPreview ¶ added in v0.19.0
SetPreview changes the preview image of the resource.
func (*Resource) SetSourceDigest ¶ added in v0.19.0
SetSourceDigest changes the digest of the source content of the resource.
func (*Resource) SourceDigest ¶ added in v0.19.0
SourceDigest returns the digest of the source content of the resource.
type Shader ¶ added in v0.19.0
type Shader struct { // ShaderType specifies the type of the shader. ShaderType ShaderType // SourceCode is the source code of the shader. SourceCode string }
Shader represents a shader program that can be used to render a mesh.
type ShaderType ¶ added in v0.19.0
type ShaderType uint8
ShaderType specifies the type of a shader.
const ( // ShaderTypeGeometry is a shader that is used during a geometry pass. ShaderTypeGeometry ShaderType = iota // ShaderTypeShadow is a shader that is used during a shadow pass. ShaderTypeShadow // ShaderTypeForward is a shader that is used during a forward pass. ShaderTypeForward // ShaderTypeSky is a shader that is used to render the sky. ShaderTypeSky // ShaderTypePostprocess is a shader that is used during a post-processing // pass. ShaderTypePostprocess )
type Sky ¶ added in v0.19.0
type Sky struct { // NodeIndex is the index of the node that the sky is attached to. NodeIndex uint32 // MaterialIndex is the index of the material that will be used to render the // sky. MaterialIndex uint32 }
Sky represents the background of the scene.
type SpotLight ¶ added in v0.19.0
type SpotLight struct { // NodeIndex is the index of the node that is associated with the light. NodeIndex uint32 // EmitColor is the linear color of the light that is emitted. EmitColor dprec.Vec3 // EmitDistance is the distance at which the light intensity reaches zero. EmitDistance float64 // EmitAngleOuter is the angle at which the light intensity reaches zero. EmitAngleOuter dprec.Angle // EmitAngleInner is the angle at which the light intensity starts to // decline until it reaches the outer angle. EmitAngleInner dprec.Angle // CastShadow specifies whether the light should cast shadows. CastShadow bool }
SpotLight represents a light source that emits light in a single, conical direction.
type Storage ¶ added in v0.19.0
type Storage interface { // OpenRegistryRead opens a reader for the registry data. OpenRegistryRead() (io.ReadCloser, error) // OpenRegistryWrite opens a writer for the registry data. OpenRegistryWrite() (io.WriteCloser, error) // OpenPreviewRead opens a reader for the data of the specified resource. OpenContentRead(id string) (io.ReadCloser, error) // OpenPreviewWrite opens a writer for the data of the specified resource. OpenContentWrite(id string) (io.WriteCloser, error) // DeleteContent removes the data of the specified resource. DeleteContent(id string) error }
Storage represents a storage interface for assets.
func NewFSStorage ¶ added in v0.19.0
NewFSStorage creates a new storage that uses the file system.
func NewWebStorage ¶ added in v0.19.0
NewWebStorage creates a new storage that uses the web.
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 Texture ¶ added in v0.19.0
type Texture struct { Format TexelFormat Flags TextureFlag MipmapLayers []MipmapLayer }
type TextureBinding ¶ added in v0.19.0
type TextureBinding struct { // BindingName is the name of the binding in the shader. BindingName string // TextureIndex is the index of the texture to be bound. TextureIndex uint32 // Wrapping specifies the texture wrapping mode. Wrapping WrapMode // Filtering specifies the texture filtering mode. Filtering FilterMode // Mipmapping specifies whether mipmapping should be applied. Mipmapping bool }
TextureBinding represents a binding of a texture to a shader.
type TextureFlag ¶ added in v0.8.0
type TextureFlag uint8
const ( TextureFlagNone TextureFlag = 0 TextureFlagMipmapping TextureFlag = 1 << iota TextureFlagLinearSpace TextureFlag2D TextureFlag2DArray TextureFlag3D TextureFlagCubeMap )
func (TextureFlag) Has ¶ added in v0.8.0
func (f TextureFlag) Has(flag TextureFlag) bool
type TextureLayer ¶ added in v0.19.0
type TextureLayer struct {
Data []byte
}
type Topology ¶ added in v0.19.0
type Topology uint8
Topology represents the way that the vertices of a mesh are connected.
type VertexAttribute ¶ added in v0.19.0
type VertexAttribute struct { // BufferIndex specifies the index of the VertexBuffer that contains the // attribute data. // // If this value is set to UnspecifiedBufferIndex, it means that the // attribute is not present. BufferIndex int32 // ByteOffset specifies the byte offset within the VertexBuffer where the // attribute data starts. ByteOffset uint32 // Format specifies the format of the attribute data. Format VertexAttributeFormat }
VertexAttribute represents a single attribute of a vertex.
type VertexAttributeFormat ¶ added in v0.19.0
type VertexAttributeFormat uint8
VertexAttributeFormat represents the format of a vertex attribute.
const ( VertexAttributeFormatRGBA32F VertexAttributeFormat = iota VertexAttributeFormatRGB32F VertexAttributeFormatRG32F VertexAttributeFormatR32F VertexAttributeFormatRGBA16F VertexAttributeFormatRGB16F VertexAttributeFormatRG16F VertexAttributeFormatR16F VertexAttributeFormatRGBA16S VertexAttributeFormatRGB16S VertexAttributeFormatRG16S VertexAttributeFormatR16S VertexAttributeFormatRGBA16SN VertexAttributeFormatRGB16SN VertexAttributeFormatRG16SN VertexAttributeFormatR16SN VertexAttributeFormatRGBA16U VertexAttributeFormatRGB16U VertexAttributeFormatRG16U VertexAttributeFormatR16U VertexAttributeFormatRGBA16UN VertexAttributeFormatRGB16UN VertexAttributeFormatRG16UN VertexAttributeFormatR16UN VertexAttributeFormatRGBA8S VertexAttributeFormatRGB8S VertexAttributeFormatRG8S VertexAttributeFormatR8S VertexAttributeFormatRGBA8SN VertexAttributeFormatRGB8SN VertexAttributeFormatRG8SN VertexAttributeFormatR8SN VertexAttributeFormatRGBA8U VertexAttributeFormatRGB8U VertexAttributeFormatRG8U VertexAttributeFormatR8U VertexAttributeFormatRGBA8UN VertexAttributeFormatRGB8UN VertexAttributeFormatRG8UN VertexAttributeFormatR8UN VertexAttributeFormatRGBA8IU VertexAttributeFormatRGB8IU VertexAttributeFormatRG8IU VertexAttributeFormatR8IU )
type VertexBuffer ¶ added in v0.19.0
type VertexBuffer struct { // Stride is the number of bytes that each vertex occupies within this buffer. Stride uint32 // Data is the raw byte data that represents the vertices. Data []byte }
VertexBuffer represents a buffer of vertex data.
type VertexLayout ¶ added in v0.8.0
type VertexLayout struct { // Coord specifies the layout of the vertex coordinate attribute. Coord VertexAttribute // Normal specifies the layout of the vertex normal attribute. Normal VertexAttribute // Tangent specifies the layout of the vertex tangent attribute. Tangent VertexAttribute // TexCoord specifies the layout of the vertex texture coordinate attribute. TexCoord VertexAttribute // Color specifies the layout of the vertex color attribute. Color VertexAttribute // Weights specifies the layout of the vertex weights attribute. Weights VertexAttribute // Joints specifies the layout of the vertex joints attribute. Joints VertexAttribute }
VertexLayout describes how vertex data is positioned within the VertexData buffers.
type WrapMode ¶
type WrapMode uint8
WrapMode is an enumeration of the supported texture wrapping modes.
const ( // WrapModeClamp indicates that the texture coordinates should // be clamped to the range [0, 1]. WrapModeClamp WrapMode = iota // WrapModeRepeat indicates that the texture coordinates should // be repeated. WrapModeRepeat // WrapModeMirroredRepeat indicates that the texture coordinates // should be repeated with mirroring. WrapModeMirroredRepeat )