Documentation ¶
Index ¶
- Variables
- func DirectionalLightFromNode(node *hierarchy.Node) *graphics.DirectionalLight
- func PointLightFromNode(node *hierarchy.Node) *graphics.PointLight
- func SpotLightFromNode(node *hierarchy.Node) *graphics.SpotLight
- type AdjustedAnimation
- func (a *AdjustedAnimation) Length() float64
- func (a *AdjustedAnimation) NodeTransform(name string) NodeTransform
- func (a *AdjustedAnimation) Position() float64
- func (a *AdjustedAnimation) SetPosition(position float64)
- func (a *AdjustedAnimation) SetSpeed(speed float64)
- func (a *AdjustedAnimation) Source() AnimationSource
- func (a *AdjustedAnimation) Speed() float64
- type AmbientLightInfo
- type AmbientLightNodeTarget
- type Animation
- func (a *Animation) BindingTransform(name string, timestamp float64) NodeTransform
- func (a *Animation) EndTime() float64
- func (a *Animation) Length() float64
- func (a *Animation) Loop() bool
- func (a *Animation) Name() string
- func (a *Animation) Playback() *AnimationPlayback
- func (a *Animation) StartTime() float64
- type AnimationBindingDefinitionInfo
- type AnimationDefinition
- type AnimationDefinitionInfo
- type AnimationInfo
- type AnimationMask
- type AnimationNodeSource
- type AnimationPlayback
- func (p *AnimationPlayback) Length() float64
- func (p *AnimationPlayback) Loop() bool
- func (p *AnimationPlayback) NodeTransform(name string) NodeTransform
- func (p *AnimationPlayback) Position() float64
- func (p *AnimationPlayback) SetLoop(loop bool) *AnimationPlayback
- func (p *AnimationPlayback) SetPosition(position float64)
- type AnimationSource
- type BodyNodeSource
- type BoneNodeTarget
- type CameraNodeTarget
- type Controller
- func (c *Controller) Engine() *Engine
- func (c *Controller) OnCreate(window app.Window)
- func (c *Controller) OnDestroy(window app.Window)
- func (c *Controller) OnFramebufferResize(window app.Window, width, height int)
- func (c *Controller) OnRender(window app.Window)
- func (c *Controller) Registry() *asset.Registry
- func (c *Controller) UseECSOptions(opts ...ecs.Option)
- func (c *Controller) UseGraphicsOptions(opts ...graphics.Option)
- func (c *Controller) UsePhysicsOptions(opts ...physics.Option)
- type DirectionalLightInfo
- type DirectionalLightNodeTarget
- type Engine
- func (e *Engine) ActiveScene() *Scene
- func (e *Engine) Create()
- func (e *Engine) CreateAnimationDefinition(info AnimationDefinitionInfo) *AnimationDefinition
- func (e *Engine) CreateResourceSet() *ResourceSet
- func (e *Engine) CreateScene() *Scene
- func (e *Engine) Destroy()
- func (e *Engine) ECS() *ecs.Engine
- func (e *Engine) GFXWorker() Worker
- func (e *Engine) Graphics() *graphics.Engine
- func (e *Engine) IOWorker() Worker
- func (e *Engine) Physics() *physics.Engine
- func (e *Engine) Registry() *asset.Registry
- func (e *Engine) Render(framebuffer render.Framebuffer, viewport graphics.Viewport)
- func (e *Engine) ResetDeltaTime()
- func (e *Engine) SetActiveScene(scene *Scene)
- func (e *Engine) Update()
- type EngineOption
- func WithECS(ecsEngine *ecs.Engine) EngineOption
- func WithGFXWorker(worker Worker) EngineOption
- func WithGraphics(gfxEngine *graphics.Engine) EngineOption
- func WithIOWorker(worker Worker) EngineOption
- func WithPhysics(physicsEngine *physics.Engine) EngineOption
- func WithRegistry(registry *asset.Registry) EngineOption
- type Keyframe
- type KeyframeList
- type MeshNodeTarget
- type Model
- func (m *Model) AnimatedNodes() []*hierarchy.Node
- func (m *Model) Animations() []*Animation
- func (m *Model) BindAnimationSource(source AnimationSource)
- func (m *Model) BodyInstances() []physics.Body
- func (m *Model) FindAnimation(name string) *Animation
- func (m *Model) FindNode(name string) *hierarchy.Node
- func (m *Model) Root() *hierarchy.Node
- type ModelDefinition
- type ModelInfo
- type NodeTransform
- type PairAnimationBlending
- func (n *PairAnimationBlending) Factor() float64
- func (n *PairAnimationBlending) First() AnimationSource
- func (n *PairAnimationBlending) Length() float64
- func (n *PairAnimationBlending) NodeTransform(name string) NodeTransform
- func (n *PairAnimationBlending) Position() float64
- func (n *PairAnimationBlending) Second() AnimationSource
- func (n *PairAnimationBlending) SetFactor(factor float64)
- func (n *PairAnimationBlending) SetFirst(first AnimationSource)
- func (n *PairAnimationBlending) SetPosition(position float64)
- func (n *PairAnimationBlending) SetSecond(second AnimationSource)
- func (n *PairAnimationBlending) SetSynchronized(synchronized bool)
- func (n *PairAnimationBlending) Synchronized() bool
- type PointLightInfo
- type PointLightNodeTarget
- type ResourceSet
- type Scene
- func (s *Scene) CreateAmbientLight(info AmbientLightInfo) *hierarchy.Node
- func (s *Scene) CreateAnimation(info AnimationInfo) *Animation
- func (s *Scene) CreateDirectionalLight(info DirectionalLightInfo) *hierarchy.Node
- func (s *Scene) CreateModel(info ModelInfo) *Model
- func (s *Scene) CreateNode() *hierarchy.Node
- func (s *Scene) CreatePointLight(info PointLightInfo) *hierarchy.Node
- func (s *Scene) CreateSpotLight(info SpotLightInfo) *hierarchy.Node
- func (s *Scene) Delete()
- func (s *Scene) ECS() *ecs.Scene
- func (s *Scene) Freeze()
- func (s *Scene) Graphics() *graphics.Scene
- func (s *Scene) IsFrozen() bool
- func (s *Scene) Physics() *physics.Scene
- func (s *Scene) PlayAnimationTree(tree AnimationSource)
- func (s *Scene) Render(framebuffer render.Framebuffer, viewport graphics.Viewport)
- func (s *Scene) Root() *hierarchy.Node
- func (s *Scene) StopAnimationTree(tree AnimationSource)
- func (s *Scene) SubscribePostAnimation(callback timestep.UpdateCallback) *timestep.UpdateSubscription
- func (s *Scene) SubscribePostNode(callback timestep.UpdateCallback) *timestep.UpdateSubscription
- func (s *Scene) SubscribePostPhysics(callback timestep.UpdateCallback) *timestep.UpdateSubscription
- func (s *Scene) SubscribePostUpdate(callback timestep.UpdateCallback) *timestep.UpdateSubscription
- func (s *Scene) SubscribePreAnimation(callback timestep.UpdateCallback) *timestep.UpdateSubscription
- func (s *Scene) SubscribePreNode(callback timestep.UpdateCallback) *timestep.UpdateSubscription
- func (s *Scene) SubscribePrePhysics(callback timestep.UpdateCallback) *timestep.UpdateSubscription
- func (s *Scene) SubscribePreUpdate(callback timestep.UpdateCallback) *timestep.UpdateSubscription
- func (s *Scene) Unfreeze()
- func (s *Scene) Update(elapsedTime time.Duration)
- type SkyNodeTarget
- type SpotLightInfo
- type SpotLightNodeTarget
- type Worker
- type WorkerFunc
Constants ¶
This section is empty.
Variables ¶
var ErrNotFound = errors.New("resource not found")
ErrNotFound indicates that a resource was not found.
Functions ¶
func DirectionalLightFromNode ¶ added in v0.19.0
func DirectionalLightFromNode(node *hierarchy.Node) *graphics.DirectionalLight
func PointLightFromNode ¶ added in v0.21.0
func PointLightFromNode(node *hierarchy.Node) *graphics.PointLight
Types ¶
type AdjustedAnimation ¶ added in v0.19.1
type AdjustedAnimation struct {
// contains filtered or unexported fields
}
AdjustedAnimation is a decorator for an animation source that allows adjusting the playback speed.
func NewAdjustedAnimation ¶ added in v0.19.1
func NewAdjustedAnimation(delegate AnimationSource) *AdjustedAnimation
NewAdjustedAnimation creates a new adjusted animation source with the specified delegate.
func (*AdjustedAnimation) Length ¶ added in v0.19.1
func (a *AdjustedAnimation) Length() float64
Length returns the length of the animation in seconds.
func (*AdjustedAnimation) NodeTransform ¶ added in v0.19.1
func (a *AdjustedAnimation) NodeTransform(name string) NodeTransform
NodeTransform returns the transformation of the node with the specified name at the current time position.
func (*AdjustedAnimation) Position ¶ added in v0.19.1
func (a *AdjustedAnimation) Position() float64
Position returns the current position of the animation in seconds.
func (*AdjustedAnimation) SetPosition ¶ added in v0.19.1
func (a *AdjustedAnimation) SetPosition(position float64)
SetPosition sets the current position of the animation in seconds.
func (*AdjustedAnimation) SetSpeed ¶ added in v0.19.1
func (a *AdjustedAnimation) SetSpeed(speed float64)
SetSpeed sets the playback speed of the animation.
func (*AdjustedAnimation) Source ¶ added in v0.19.1
func (a *AdjustedAnimation) Source() AnimationSource
Source returns the underlying animation source.
func (*AdjustedAnimation) Speed ¶ added in v0.19.1
func (a *AdjustedAnimation) Speed() float64
Speed returns the current playback speed of the animation. A value of 1.0 means that the animation is played at normal speed.
type AmbientLightInfo ¶ added in v0.19.0
type AmbientLightInfo struct { ReflectionTexture render.Texture RefractionTexture render.Texture OuterRadius opt.T[float64] InnerRadius opt.T[float64] CastShadow opt.T[bool] }
AmbientLightInfo contains the information required to create an ambient light.
type AmbientLightNodeTarget ¶ added in v0.19.0
type AmbientLightNodeTarget struct {
Light *graphics.AmbientLight
}
func (AmbientLightNodeTarget) ApplyFrom ¶ added in v0.19.0
func (t AmbientLightNodeTarget) ApplyFrom(node *hierarchy.Node)
func (AmbientLightNodeTarget) Release ¶ added in v0.19.0
func (t AmbientLightNodeTarget) Release()
type Animation ¶ added in v0.9.0
type Animation struct {
// contains filtered or unexported fields
}
Animation represents an instantiation of a keyframe animation.
func (*Animation) BindingTransform ¶ added in v0.19.0
func (a *Animation) BindingTransform(name string, timestamp float64) NodeTransform
BindingTransform returns the transformation of the node with the specified name at the specified time position.
func (*Animation) EndTime ¶ added in v0.9.0
EndTime returns the time (in seconds) at which the animation ends.
func (*Animation) Playback ¶ added in v0.19.1
func (a *Animation) Playback() *AnimationPlayback
Playback creates a new AnimationPlayback that plays back the animation.
type AnimationBindingDefinitionInfo ¶ added in v0.9.0
type AnimationBindingDefinitionInfo struct { // NodeName is the name of the node that is affected by the animation. NodeName string // TranslationKeyframes is a list of keyframes that define the translation // of the node. TranslationKeyframes KeyframeList[dprec.Vec3] // RotationKeyframes is a list of keyframes that define the rotation of the // node. RotationKeyframes KeyframeList[dprec.Quat] // ScaleKeyframes is a list of keyframes that define the scale of the node. ScaleKeyframes KeyframeList[dprec.Vec3] }
AnimationBindingDefinitionInfo contains the information required to define an animation node binding.
type AnimationDefinition ¶ added in v0.9.0
type AnimationDefinition struct {
// contains filtered or unexported fields
}
AnimationDefinition represents a definition of an animation.
func (*AnimationDefinition) EndTime ¶ added in v0.19.1
func (d *AnimationDefinition) EndTime() float64
EndTime returns the time (in seconds) at which the animation ends.
func (*AnimationDefinition) Loop ¶ added in v0.19.1
func (d *AnimationDefinition) Loop() bool
Loop returns whether the animation should loop.
func (*AnimationDefinition) Name ¶ added in v0.19.0
func (d *AnimationDefinition) Name() string
Name returns the name of the animation.
func (*AnimationDefinition) NodeNames ¶ added in v0.19.1
func (d *AnimationDefinition) NodeNames() []string
NodeNames returns the names of the nodes that are animated by the animation.
func (*AnimationDefinition) StartTime ¶ added in v0.19.1
func (d *AnimationDefinition) StartTime() float64
StartTime returns the time (in seconds) at which the animation starts.
type AnimationDefinitionInfo ¶ added in v0.9.0
type AnimationDefinitionInfo struct { // Name is the name of the animation. Name string // StartTime is the time (in seconds) at which the animation starts. StartTime float64 // EndTime is the time (in seconds) at which the animation ends. EndTime float64 // Loop specifies whether the animation should loop. Loop bool // Bindings is a list of node bindings that are affected by the animation. Bindings []AnimationBindingDefinitionInfo }
AnimationDefinitionInfo contains the information required to define an animation.
type AnimationInfo ¶ added in v0.9.0
type AnimationInfo struct { // Definition is the definition of the animation. Definition *AnimationDefinition // ClipStart, if specified, overrides the start time of the animation. ClipStart opt.T[float64] // ClipEnd, if specified, overrides the end time of the animation. ClipEnd opt.T[float64] // Loop, if specified, overrides the loop setting of the animation. Loop opt.T[bool] }
AnimationInfo represents an instantiation of an animation instance.
type AnimationMask ¶ added in v0.19.1
type AnimationMask struct { AnimationSource // contains filtered or unexported fields }
AnimationMask is an animation source that picks specific bones from another animation source.
func NewAnimationMask ¶ added in v0.19.1
func NewAnimationMask(delegate AnimationSource, selection filter.Func[string]) *AnimationMask
NewAnimationMask creates a new AnimationSource that picks specific bones from the specified AnimationSource.
func (*AnimationMask) NodeTransform ¶ added in v0.19.1
func (m *AnimationMask) NodeTransform(name string) NodeTransform
NodeTransform returns the transformation of the node with the specified name at the current time position.
type AnimationNodeSource ¶ added in v0.19.0
type AnimationNodeSource struct {
Source AnimationSource
}
func (AnimationNodeSource) ApplyTo ¶ added in v0.19.0
func (s AnimationNodeSource) ApplyTo(node *hierarchy.Node)
func (AnimationNodeSource) Release ¶ added in v0.19.0
func (s AnimationNodeSource) Release()
type AnimationPlayback ¶ added in v0.19.1
type AnimationPlayback struct {
// contains filtered or unexported fields
}
AnimationPlayback represents an animation source that plays back an animation.
func NewAnimationPlayback ¶ added in v0.19.1
func NewAnimationPlayback(animation *Animation) *AnimationPlayback
NewAnimationPlayback creates a new AnimationSource using the specified Animation.
func (*AnimationPlayback) Length ¶ added in v0.19.1
func (p *AnimationPlayback) Length() float64
Length returns the length of the animation in seconds.
func (*AnimationPlayback) Loop ¶ added in v0.19.1
func (p *AnimationPlayback) Loop() bool
Loop returns whether the animation should loop.
func (*AnimationPlayback) NodeTransform ¶ added in v0.19.1
func (p *AnimationPlayback) NodeTransform(name string) NodeTransform
NodeTransform returns the transformation of the node with the specified name at the current time position.
func (*AnimationPlayback) Position ¶ added in v0.19.1
func (p *AnimationPlayback) Position() float64
Position returns the current position of the animation in seconds.
func (*AnimationPlayback) SetLoop ¶ added in v0.19.1
func (p *AnimationPlayback) SetLoop(loop bool) *AnimationPlayback
SetLoop sets whether the animation should loop.
func (*AnimationPlayback) SetPosition ¶ added in v0.19.1
func (p *AnimationPlayback) SetPosition(position float64)
SetPosition sets the current position of the animation in seconds.
type AnimationSource ¶ added in v0.19.0
type AnimationSource interface { // Length returns the length of the animation in seconds. Length() float64 // Position returns the current position of the animation in seconds. Position() float64 // SetPosition sets the current position of the animation in seconds. SetPosition(position float64) // NodeTransform returns the transformation of the node with the // specified name at the current time position. NodeTransform(name string) NodeTransform }
AnimationSource represents a source of animation data.
type BodyNodeSource ¶ added in v0.14.0
func (BodyNodeSource) ApplyTo ¶ added in v0.14.0
func (s BodyNodeSource) ApplyTo(node *hierarchy.Node)
func (BodyNodeSource) Release ¶ added in v0.19.0
func (s BodyNodeSource) Release()
type BoneNodeTarget ¶ added in v0.14.0
func (BoneNodeTarget) ApplyFrom ¶ added in v0.14.0
func (t BoneNodeTarget) ApplyFrom(node *hierarchy.Node)
func (BoneNodeTarget) Release ¶ added in v0.19.0
func (t BoneNodeTarget) Release()
type CameraNodeTarget ¶ added in v0.14.0
func (CameraNodeTarget) ApplyFrom ¶ added in v0.14.0
func (t CameraNodeTarget) ApplyFrom(node *hierarchy.Node)
func (CameraNodeTarget) Release ¶ added in v0.19.0
func (t CameraNodeTarget) Release()
type Controller ¶
type Controller struct { app.NopController // contains filtered or unexported fields }
Controller is an implementation of the app.Controller interface which initializes a game engine and manages its lifecycle. Furthermore, it ensures that the game engine is updated and rendered on each frame.
func NewController ¶ added in v0.9.0
func NewController(registry *asset.Registry, shaders graphics.ShaderCollection, shaderBuilder graphics.ShaderBuilder) *Controller
NewController creates a new game controller that manages the lifecycle of a game engine. The controller will use the provided asset registry to load and manage assets. The provided shader collection will be used to render the game. The provided shader builder will be used to create new shaders when needed.
func (*Controller) Engine ¶ added in v0.9.0
func (c *Controller) Engine() *Engine
Engine returns the game engine that is managed by the controller.
This method should only be called after the controller has been initialized by the app framework.
func (*Controller) OnCreate ¶ added in v0.9.0
func (c *Controller) OnCreate(window app.Window)
func (*Controller) OnDestroy ¶ added in v0.9.0
func (c *Controller) OnDestroy(window app.Window)
func (*Controller) OnFramebufferResize ¶ added in v0.12.0
func (c *Controller) OnFramebufferResize(window app.Window, width, height int)
func (*Controller) OnRender ¶ added in v0.9.0
func (c *Controller) OnRender(window app.Window)
func (*Controller) Registry ¶ added in v0.19.0
func (c *Controller) Registry() *asset.Registry
Registry returns the asset registry to be used by the game.
func (*Controller) UseECSOptions ¶ added in v0.20.0
func (c *Controller) UseECSOptions(opts ...ecs.Option)
UseECSOptions allows to specify options that will be used when initializing the ECS engine. This method should be called before the controller is initialized by the app framework.
func (*Controller) UseGraphicsOptions ¶ added in v0.20.0
func (c *Controller) UseGraphicsOptions(opts ...graphics.Option)
UseGraphicsOptions allows to specify options that will be used when initializing the graphics engine. This method should be called before the controller is initialized by the app framework.
func (*Controller) UsePhysicsOptions ¶ added in v0.20.0
func (c *Controller) UsePhysicsOptions(opts ...physics.Option)
UsePhysicsOptions allows to specify options that will be used when initializing the physics engine. This method should be called before the controller is initialized by the app framework.
type DirectionalLightInfo ¶ added in v0.19.0
DirectionalLightInfo contains the information required to create a directional light.
type DirectionalLightNodeTarget ¶ added in v0.14.0
type DirectionalLightNodeTarget struct { Light *graphics.DirectionalLight UseOnlyParentPosition bool }
func (DirectionalLightNodeTarget) ApplyFrom ¶ added in v0.14.0
func (t DirectionalLightNodeTarget) ApplyFrom(node *hierarchy.Node)
func (DirectionalLightNodeTarget) Release ¶ added in v0.19.0
func (t DirectionalLightNodeTarget) Release()
type Engine ¶ added in v0.9.0
type Engine struct {
// contains filtered or unexported fields
}
func NewEngine ¶ added in v0.9.0
func NewEngine(opts ...EngineOption) *Engine
func (*Engine) ActiveScene ¶ added in v0.9.0
func (*Engine) CreateAnimationDefinition ¶ added in v0.9.0
func (e *Engine) CreateAnimationDefinition(info AnimationDefinitionInfo) *AnimationDefinition
func (*Engine) CreateResourceSet ¶ added in v0.9.0
func (e *Engine) CreateResourceSet() *ResourceSet
func (*Engine) CreateScene ¶ added in v0.9.0
func (*Engine) Render ¶ added in v0.9.0
func (e *Engine) Render(framebuffer render.Framebuffer, viewport graphics.Viewport)
func (*Engine) ResetDeltaTime ¶ added in v0.9.0
func (e *Engine) ResetDeltaTime()
func (*Engine) SetActiveScene ¶ added in v0.9.0
type EngineOption ¶ added in v0.9.0
type EngineOption func(e *Engine)
func WithECS ¶ added in v0.9.0
func WithECS(ecsEngine *ecs.Engine) EngineOption
func WithGFXWorker ¶ added in v0.9.0
func WithGFXWorker(worker Worker) EngineOption
func WithGraphics ¶ added in v0.9.0
func WithGraphics(gfxEngine *graphics.Engine) EngineOption
func WithIOWorker ¶ added in v0.9.0
func WithIOWorker(worker Worker) EngineOption
func WithPhysics ¶ added in v0.9.0
func WithPhysics(physicsEngine *physics.Engine) EngineOption
func WithRegistry ¶ added in v0.9.0
func WithRegistry(registry *asset.Registry) EngineOption
type KeyframeList ¶ added in v0.9.0
KeyframeList is a list of keyframes.
type MeshNodeTarget ¶ added in v0.14.0
func (MeshNodeTarget) ApplyFrom ¶ added in v0.14.0
func (t MeshNodeTarget) ApplyFrom(node *hierarchy.Node)
func (MeshNodeTarget) Release ¶ added in v0.19.0
func (t MeshNodeTarget) Release()
type Model ¶ added in v0.9.0
type Model struct {
// contains filtered or unexported fields
}
func (*Model) AnimatedNodes ¶ added in v0.19.0
func (*Model) Animations ¶ added in v0.9.0
func (*Model) BindAnimationSource ¶ added in v0.19.0
func (m *Model) BindAnimationSource(source AnimationSource)
func (*Model) BodyInstances ¶ added in v0.9.0
func (*Model) FindAnimation ¶ added in v0.9.0
type ModelDefinition ¶ added in v0.9.0
type ModelDefinition struct {
// contains filtered or unexported fields
}
func (*ModelDefinition) AnimatedNodeNames ¶ added in v0.19.0
func (d *ModelDefinition) AnimatedNodeNames() []string
func (*ModelDefinition) Animations ¶ added in v0.19.0
func (d *ModelDefinition) Animations() []*AnimationDefinition
func (*ModelDefinition) FindAnimation ¶ added in v0.9.0
func (d *ModelDefinition) FindAnimation(name string) *AnimationDefinition
func (*ModelDefinition) FindBlob ¶ added in v0.22.0
func (m *ModelDefinition) FindBlob(name string) []byte
type ModelInfo ¶ added in v0.9.0
type ModelInfo struct { // Name specifies the name of this instance. This should not be // confused with the name of the definition. Name string // RootNode specifies the name of the root node of the model to use, in which // case a wrapper root node will not be created. The selected root node will // be renamed to Name if it is specified. RootNode opt.T[string] // Definition specifies the template from which this instance will // be created. Definition *ModelDefinition // Position is used to specify a location for the model instance. Position opt.T[dprec.Vec3] // Rotation is used to specify a rotation for the model instance. Rotation opt.T[dprec.Quat] // Scale is used to specify a scale for the model instance. Scale opt.T[dprec.Vec3] // IsDynamic determines whether the model can be repositioned once // placed in the Scene. // (i.e. whether it should be added to the scene hierarchy) IsDynamic bool }
ModelInfo contains the information necessary to place a Model instance into a Scene.
type NodeTransform ¶ added in v0.19.0
type NodeTransform struct { // Translation, if specified, indicates the translation of the node. Translation opt.T[dprec.Vec3] // Rotation, if specified, indicates the rotation of the node. Rotation opt.T[dprec.Quat] // Scale, if specified, indicates the scale of the node. Scale opt.T[dprec.Vec3] }
NodeTransform represents the transformation of a node.
func BlendNodeTransforms ¶ added in v0.19.1
func BlendNodeTransforms(first, second NodeTransform, factor float64) NodeTransform
BlendNodeTransforms blends two node transformations using the specified factor. A factor of 0.0 means that the first transformation is used, a factor of 1.0 means that the second transformation is used.
type PairAnimationBlending ¶ added in v0.19.1
type PairAnimationBlending struct {
// contains filtered or unexported fields
}
PairAnimationBlending represents an animation source that blends two animation sources. The blending factor is determined by the factor field of the node.
func NewPairAnimationBlending ¶ added in v0.19.1
func NewPairAnimationBlending(first, second AnimationSource) *PairAnimationBlending
NewPairAnimationBlending creates a new pair animation blending node with the specified sources.
func (*PairAnimationBlending) Factor ¶ added in v0.19.1
func (n *PairAnimationBlending) Factor() float64
Factor returns the blending factor of the node. A value of 0.0 means that the first source is used, a value of 1.0 means that the second source is used. The value is clamped to the range [0.0, 1.0].
func (*PairAnimationBlending) First ¶ added in v0.19.1
func (n *PairAnimationBlending) First() AnimationSource
First returns the first source of the node.
func (*PairAnimationBlending) Length ¶ added in v0.19.1
func (n *PairAnimationBlending) Length() float64
Length returns the length of the animation in seconds.
func (*PairAnimationBlending) NodeTransform ¶ added in v0.19.1
func (n *PairAnimationBlending) NodeTransform(name string) NodeTransform
NodeTransform returns the transformation of the node with the specified name. The transformation is a blend of the transformations of the two sources of the node.
func (*PairAnimationBlending) Position ¶ added in v0.19.1
func (n *PairAnimationBlending) Position() float64
Position returns the current position of the animation in seconds.
func (*PairAnimationBlending) Second ¶ added in v0.19.1
func (n *PairAnimationBlending) Second() AnimationSource
Second returns the second source of the node.
func (*PairAnimationBlending) SetFactor ¶ added in v0.19.1
func (n *PairAnimationBlending) SetFactor(factor float64)
SetFactor sets the blending factor of the node. The value is clamped to the range [0.0, 1.0].
func (*PairAnimationBlending) SetFirst ¶ added in v0.19.1
func (n *PairAnimationBlending) SetFirst(first AnimationSource)
SetFirst sets the first source of the node.
func (*PairAnimationBlending) SetPosition ¶ added in v0.19.1
func (n *PairAnimationBlending) SetPosition(position float64)
SetPosition sets the current position of the animation in seconds.
func (*PairAnimationBlending) SetSecond ¶ added in v0.19.1
func (n *PairAnimationBlending) SetSecond(second AnimationSource)
SetSecond sets the second source of the node.
func (*PairAnimationBlending) SetSynchronized ¶ added in v0.19.1
func (n *PairAnimationBlending) SetSynchronized(synchronized bool)
SetSynchronized sets whether the two sources of the node are synchronized.
func (*PairAnimationBlending) Synchronized ¶ added in v0.19.1
func (n *PairAnimationBlending) Synchronized() bool
Synchronized returns whether the two sources of the node are synchronized.
type PointLightInfo ¶ added in v0.19.0
type PointLightInfo struct { EmitColor opt.T[dprec.Vec3] EmitDistance opt.T[float64] CastShadow opt.T[bool] }
PointLightInfo contains the information required to create a point light.
type PointLightNodeTarget ¶ added in v0.14.0
type PointLightNodeTarget struct {
Light *graphics.PointLight
}
func (PointLightNodeTarget) ApplyFrom ¶ added in v0.14.0
func (t PointLightNodeTarget) ApplyFrom(node *hierarchy.Node)
func (PointLightNodeTarget) Release ¶ added in v0.19.0
func (t PointLightNodeTarget) Release()
type ResourceSet ¶ added in v0.9.0
type ResourceSet struct {
// contains filtered or unexported fields
}
ResourceSet is a collection of resources that are managed together.
func (*ResourceSet) CreateResourceSet ¶ added in v0.9.0
func (s *ResourceSet) CreateResourceSet() *ResourceSet
CreateResourceSet creates a new ResourceSet that inherits resources from the current one. Opening a resource in the new resource set will first check if the current one has it.
func (*ResourceSet) Delete ¶ added in v0.9.0
func (s *ResourceSet) Delete()
Delete schedules all resources managed by this ResourceSet for deletion. After this method returns, the resources are not guaranteed to have been released.
func (*ResourceSet) OpenModelByID ¶ added in v0.19.0
func (s *ResourceSet) OpenModelByID(id string) async.Promise[*ModelDefinition]
OpenModelByID loads a model definition by its ID.
func (*ResourceSet) OpenModelByName ¶ added in v0.9.0
func (s *ResourceSet) OpenModelByName(name string) async.Promise[*ModelDefinition]
OpenModelByName loads a model definition by its name.
type Scene ¶ added in v0.9.0
type Scene struct {
// contains filtered or unexported fields
}
Scene is the main container for all game objects and systems.
func (*Scene) CreateAmbientLight ¶ added in v0.19.0
func (s *Scene) CreateAmbientLight(info AmbientLightInfo) *hierarchy.Node
CreateAmbientLight creates a new ambient light and appends it to the root of the scene.
func (*Scene) CreateAnimation ¶ added in v0.9.0
func (s *Scene) CreateAnimation(info AnimationInfo) *Animation
CreateAnimation creates a new animation based on the provided information.
func (*Scene) CreateDirectionalLight ¶ added in v0.19.0
func (s *Scene) CreateDirectionalLight(info DirectionalLightInfo) *hierarchy.Node
CreateDirectionalLight creates a new directional light and appends it to the root of the scene.
func (*Scene) CreateModel ¶ added in v0.9.0
TODO: Return the node instead and have the Model be a target?
func (*Scene) CreateNode ¶ added in v0.19.0
CreateNode creates a new node and appends it to the root of the scene.
func (*Scene) CreatePointLight ¶ added in v0.19.0
func (s *Scene) CreatePointLight(info PointLightInfo) *hierarchy.Node
CreatePointLight creates a new point light and appends it to the root of the scene.
func (*Scene) CreateSpotLight ¶ added in v0.19.0
func (s *Scene) CreateSpotLight(info SpotLightInfo) *hierarchy.Node
CreateSpotLight creates a new spot light and appends it to the root of the scene.
func (*Scene) Delete ¶ added in v0.9.0
func (s *Scene) Delete()
Delete removes all resources associated with the scene.
func (*Scene) Freeze ¶ added in v0.10.0
func (s *Scene) Freeze()
Freeze stops the scene from updating any of its systems.
func (*Scene) Graphics ¶ added in v0.9.0
Graphics returns the graphics scene associated with the scene.
func (*Scene) IsFrozen ¶ added in v0.10.0
IsFrozen returns whether the scene is currently frozen. A frozen scene will not update any of its systems.
func (*Scene) Physics ¶ added in v0.9.0
Physics returns the physics scene associated with the scene.
func (*Scene) PlayAnimationTree ¶ added in v0.19.1
func (s *Scene) PlayAnimationTree(tree AnimationSource)
PlayAnimationTree adds the provided animation tree to the scene.
func (*Scene) Render ¶ added in v0.10.0
func (s *Scene) Render(framebuffer render.Framebuffer, viewport graphics.Viewport)
Render draws the scene to the provided viewport.
func (*Scene) StopAnimationTree ¶ added in v0.19.1
func (s *Scene) StopAnimationTree(tree AnimationSource)
StopAnimationTree removes the provided animation tree from the scene.
func (*Scene) SubscribePostAnimation ¶ added in v0.14.0
func (s *Scene) SubscribePostAnimation(callback timestep.UpdateCallback) *timestep.UpdateSubscription
SubscribePostAnimation adds a callback to be executed after the animations are updated.
func (*Scene) SubscribePostNode ¶ added in v0.14.0
func (s *Scene) SubscribePostNode(callback timestep.UpdateCallback) *timestep.UpdateSubscription
SubscribePostNode adds a callback to be executed after the nodes are updated.
func (*Scene) SubscribePostPhysics ¶ added in v0.14.0
func (s *Scene) SubscribePostPhysics(callback timestep.UpdateCallback) *timestep.UpdateSubscription
SubscribePostPhysics adds a callback to be executed after the physics scene updates.
func (*Scene) SubscribePostUpdate ¶ added in v0.14.0
func (s *Scene) SubscribePostUpdate(callback timestep.UpdateCallback) *timestep.UpdateSubscription
SubscribePostUpdate adds a callback to be executed after the scene updates.
func (*Scene) SubscribePreAnimation ¶ added in v0.14.0
func (s *Scene) SubscribePreAnimation(callback timestep.UpdateCallback) *timestep.UpdateSubscription
SubscribePreAnimation adds a callback to be executed before the animations are updated.
func (*Scene) SubscribePreNode ¶ added in v0.14.0
func (s *Scene) SubscribePreNode(callback timestep.UpdateCallback) *timestep.UpdateSubscription
SubscribePreNode adds a callback to be executed before the nodes are updated.
func (*Scene) SubscribePrePhysics ¶ added in v0.14.0
func (s *Scene) SubscribePrePhysics(callback timestep.UpdateCallback) *timestep.UpdateSubscription
SubscribePrePhysics adds a callback to be executed before the physics scene updates.
func (*Scene) SubscribePreUpdate ¶ added in v0.14.0
func (s *Scene) SubscribePreUpdate(callback timestep.UpdateCallback) *timestep.UpdateSubscription
SubscribePreUpdate adds a callback to be executed before the scene updates.
type SkyNodeTarget ¶ added in v0.19.0
func (SkyNodeTarget) ApplyFrom ¶ added in v0.19.0
func (t SkyNodeTarget) ApplyFrom(node *hierarchy.Node)
func (SkyNodeTarget) Release ¶ added in v0.19.0
func (t SkyNodeTarget) Release()
type SpotLightInfo ¶ added in v0.19.0
type SpotLightInfo struct { EmitColor opt.T[dprec.Vec3] EmitDistance opt.T[float64] EmitOuterConeAngle opt.T[dprec.Angle] EmitInnerConeAngle opt.T[dprec.Angle] CastShadow opt.T[bool] }
SpotLightInfo contains the information required to create a spot light.
type SpotLightNodeTarget ¶ added in v0.14.0
func (SpotLightNodeTarget) ApplyFrom ¶ added in v0.14.0
func (t SpotLightNodeTarget) ApplyFrom(node *hierarchy.Node)
func (SpotLightNodeTarget) Release ¶ added in v0.19.0
func (t SpotLightNodeTarget) Release()
type WorkerFunc ¶ added in v0.9.0
type WorkerFunc func(fn func())
func (WorkerFunc) Schedule ¶ added in v0.9.0
func (f WorkerFunc) Schedule(fn func())
Source Files ¶
- animation.go
- animation_adjust.go
- animation_keyframe.go
- animation_mask.go
- animation_pair.go
- animation_playback.go
- animation_source.go
- binding.go
- controller.go
- engine.go
- light.go
- model.go
- resource.go
- resource_blob.go
- resource_common.go
- resource_hierarchy.go
- resource_light.go
- resource_material.go
- resource_mesh.go
- resource_model.go
- resource_physics.go
- resource_shader.go
- resource_sky.go
- resource_texture.go
- scene.go
- worker.go
Directories ¶
Path | Synopsis |
---|---|
Package asseet provides data transfer objects for the game's asset types.
|
Package asseet provides data transfer objects for the game's asset types. |
lsl
Package lsl provides a simple interface to the Lacking Shader Language.
|
Package lsl provides a simple interface to the Lacking Shader Language. |
Package hierarchy provides the means to represent a hierarchy of 3D objects.
|
Package hierarchy provides the means to represent a hierarchy of 3D objects. |