Documentation
¶
Overview ¶
Package hierarchy provides the means to represent a hierarchy of 3D objects.
Index ¶
- Variables
- func DefaultTransformFunc(scene *Scene, node NodeID) dprec.Mat4
- type Binding
- type BindingObject
- type BindingSet
- type DeleteCallback
- type DeleteSubscription
- type DeleteSubscriptionSet
- type InterpolationBinding
- type InterpolationBindingSet
- type InterpolationCallback
- type InterpolationSubscription
- type InterpolationSubscriptionSet
- type Node
- func (n Node) AbsoluteMatrix() dprec.Mat4
- func (n Node) AppendChild(child Node, preserveWorldTransform bool)
- func (n Node) AppendSibling(sibling Node, preserveWorldTransform bool)
- func (n Node) BaseMatrix() dprec.Mat4
- func (n Node) Delete()
- func (n Node) Detach(preserveWorldTransform bool)
- func (n Node) FindNode(name string) Node
- func (n Node) FirstChild() Node
- func (n Node) HasParent() bool
- func (n Node) ID() NodeID
- func (n Node) InitializeMatrix(matrix dprec.Mat4)
- func (n Node) InitializePosition(position dprec.Vec3)
- func (n Node) InitializeRotation(rotation dprec.Quat)
- func (n Node) InitializeScale(scale dprec.Vec3)
- func (n Node) InterpolatedAbsoluteMatrix(alpha float64) dprec.Mat4
- func (n Node) IsAncestorOf(descendant Node) bool
- func (n Node) IsIndependent() bool
- func (n Node) IsNil() bool
- func (n Node) IsValid() bool
- func (n Node) IsVisible() bool
- func (n Node) LastChild() Node
- func (n Node) LeftSibling() Node
- func (n Node) Matrix() dprec.Mat4
- func (n Node) Name() string
- func (n Node) Parent() Node
- func (n Node) Position() dprec.Vec3
- func (n Node) PrependChild(child Node, preserveWorldTransform bool)
- func (n Node) PrependSibling(sibling Node, preserveWorldTransform bool)
- func (n Node) ResetDelta(recursive bool)
- func (n Node) RightSibling() Node
- func (n Node) Rotation() dprec.Quat
- func (n Node) Scale() dprec.Vec3
- func (n Node) SetAbsoluteMatrix(matrix dprec.Mat4)
- func (n Node) SetIndependent(independent bool)
- func (n Node) SetMatrix(matrix dprec.Mat4)
- func (n Node) SetName(name string)
- func (n Node) SetPosition(position dprec.Vec3)
- func (n Node) SetRotation(rotation dprec.Quat)
- func (n Node) SetScale(scale dprec.Vec3)
- func (n Node) SetTransformFunc(transformFunc TransformFunc)
- func (n Node) SetVisible(visible bool)
- func (n Node) TransformFunc() TransformFunc
- func (n Node) TreeIter() iter.Seq[Node]
- func (n Node) Visit(visitor func(Node) bool)
- type NodeID
- type Scene
- func (s *Scene) AppendNodeChild(parentID, childID NodeID, preserveWorldTransform bool)
- func (s *Scene) AppendNodeSibling(currentID, siblingID NodeID, preserveWorldTransform bool)
- func (s *Scene) ApplyNodeToInterpolation(id NodeID, fraction float64, recursive bool)
- func (s *Scene) ApplyNodeToTarget(id NodeID, recursive bool)
- func (s *Scene) ApplyNodesToInterpolations(fraction float64)
- func (s *Scene) ApplyNodesToTargets()
- func (s *Scene) ApplySourceToTarget(rootID NodeID, recursive bool)
- func (s *Scene) ApplySourcesToNodes()
- func (s *Scene) CreateNode() NodeID
- func (s *Scene) DeleteNode(id NodeID)
- func (s *Scene) DetachNode(id NodeID, preserveWorldTransform bool)
- func (s *Scene) FindNode(name string) NodeID
- func (s *Scene) FindSubtreeNode(rootID NodeID, name string) NodeID
- func (s *Scene) InitializeNodeMatrix(id NodeID, matrix dprec.Mat4)
- func (s *Scene) InitializeNodePosition(id NodeID, position dprec.Vec3)
- func (s *Scene) InitializeNodeRotation(id NodeID, rotation dprec.Quat)
- func (s *Scene) InitializeNodeScale(id NodeID, scale dprec.Vec3)
- func (s *Scene) IsNodeChain(rootID, leafID NodeID) bool
- func (s *Scene) IsNodeIndependent(id NodeID) bool
- func (s *Scene) IsNodeVisible(id NodeID) bool
- func (s *Scene) IsValidNode(id NodeID) bool
- func (s *Scene) NodeAbsoluteMatrix(id NodeID) dprec.Mat4
- func (s *Scene) NodeBaseMatrix(id NodeID) dprec.Mat4
- func (s *Scene) NodeFirstChild(id NodeID) NodeID
- func (s *Scene) NodeHasParent(id NodeID) bool
- func (s *Scene) NodeInterpolatedAbsoluteMatrix(id NodeID, fraction float64) dprec.Mat4
- func (s *Scene) NodeLastChild(id NodeID) NodeID
- func (s *Scene) NodeLeftSibling(id NodeID) NodeID
- func (s *Scene) NodeMatrix(id NodeID) dprec.Mat4
- func (s *Scene) NodeName(id NodeID) string
- func (s *Scene) NodeParent(id NodeID) NodeID
- func (s *Scene) NodePosition(id NodeID) dprec.Vec3
- func (s *Scene) NodeRightSibling(id NodeID) NodeID
- func (s *Scene) NodeRotation(id NodeID) dprec.Quat
- func (s *Scene) NodeScale(id NodeID) dprec.Vec3
- func (s *Scene) NodeTransformFunc(id NodeID) TransformFunc
- func (s *Scene) NodesIter() iter.Seq[NodeID]
- func (s *Scene) PrependNodeChild(parentID, childID NodeID, preserveWorldTransform bool)
- func (s *Scene) PrependNodeSibling(currentID, siblingID NodeID, preserveWorldTransform bool)
- func (s *Scene) ResetDelta()
- func (s *Scene) ResetNodeDelta(id NodeID, recursive bool)
- func (s *Scene) RootNodesIter() iter.Seq[NodeID]
- func (s *Scene) SetNodeAbsoluteMatrix(id NodeID, matrix dprec.Mat4)
- func (s *Scene) SetNodeIndependent(id NodeID, independent bool)
- func (s *Scene) SetNodeMatrix(id NodeID, matrix dprec.Mat4)
- func (s *Scene) SetNodeName(id NodeID, name string)
- func (s *Scene) SetNodePosition(id NodeID, position dprec.Vec3)
- func (s *Scene) SetNodeRotation(id NodeID, rotation dprec.Quat)
- func (s *Scene) SetNodeScale(id NodeID, scale dprec.Vec3)
- func (s *Scene) SetNodeTransformFunc(id NodeID, transformFunc TransformFunc)
- func (s *Scene) SetNodeVisible(id NodeID, visible bool)
- func (s *Scene) SubscribeInterpolationApply(callback InterpolationCallback) *InterpolationSubscription
- func (s *Scene) SubscribeNodeDelete(callback DeleteCallback) *DeleteSubscription
- func (s *Scene) SubscribeSourceApply(callback SourceCallback) *SourceSubscription
- func (s *Scene) SubscribeTargetApply(callback TargetCallback) *TargetSubscription
- func (s *Scene) SubtreeIter(rootID NodeID) iter.Seq[NodeID]
- func (s *Scene) Visit(callback func(NodeID) bool) bool
- func (s *Scene) VisitSubtree(rootID NodeID, callback func(NodeID) bool) bool
- func (s *Scene) Wrap(id NodeID) Node
- type SourceBinding
- type SourceBindingSet
- type SourceCallback
- type SourceSubscription
- type SourceSubscriptionSet
- type TargetBinding
- type TargetBindingSet
- type TargetCallback
- type TargetSubscription
- type TargetSubscriptionSet
- type TransformFunc
Constants ¶
This section is empty.
Variables ¶
var NilNodeID = NodeID{0, 0}
NilNodeID is a sentinel value representing a nil NodeID.
Functions ¶
Types ¶
type Binding ¶ added in v0.23.0
type Binding[T BindingObject] interface { // OnStaleBinding is called when the node is deleted and the binding // is determined to no longer be valid. OnStaleBinding(*Scene, T) }
Binding represents a relationship between an object and a node.
type BindingObject ¶ added in v0.23.0
type BindingObject interface {
comparable
}
BindingObject represents a type that can be bound to a node.
type BindingSet ¶ added in v0.23.0
type BindingSet[T BindingObject] struct { // contains filtered or unexported fields }
BindingSet represents a set of bindings for a specific object type.
func NewBindingSet ¶ added in v0.23.0
func NewBindingSet[T BindingObject](scene *Scene, binding Binding[T]) *BindingSet[T]
NewManualBindingSet creates a binding set that only tracks deletions.
func (*BindingSet[T]) Bind ¶ added in v0.23.0
func (s *BindingSet[T]) Bind(id NodeID, obj T)
Bind binds the object to the node with the given ID.
func (*BindingSet[T]) Get ¶ added in v0.23.0
func (s *BindingSet[T]) Get(id NodeID) T
Get returns the object bound to the node with the given ID. If one is not found, the zero value is returned.
type DeleteCallback ¶ added in v0.23.0
DeleteCallback is a function type for callbacks that are invoked when a node is about to be deleted.
type DeleteSubscription ¶ added in v0.23.0
type DeleteSubscription = observer.Subscription[DeleteCallback]
DeleteSubscription represents a notification subscription for node deletions.
type DeleteSubscriptionSet ¶ added in v0.23.0
type DeleteSubscriptionSet = observer.SubscriptionSet[DeleteCallback]
DeleteSubscriptionSet represents a set of deletion subscriptions.
func NewDeleteSubscriptionSet ¶ added in v0.23.0
func NewDeleteSubscriptionSet() *DeleteSubscriptionSet
NewDeleteSubscriptionSet creates a new DeleteSubscriptionSet.
type InterpolationBinding ¶ added in v0.23.0
type InterpolationBinding[T BindingObject] interface { Binding[T] // OnNodeToInterpolation is called when the node's state should be applied to // the target, using interpolation. OnNodeToInterpolation(*Scene, NodeID, T, float64) }
InterpolationBinding represents a binding between a node and a target that needs to use interpolated state from the node.
type InterpolationBindingSet ¶ added in v0.23.0
type InterpolationBindingSet[T BindingObject] struct { *BindingSet[T] // contains filtered or unexported fields }
InterpolationBindingSet represents a set of interpolation bindings for a specific object type.
func NewInterpolationBindingSet ¶ added in v0.23.0
func NewInterpolationBindingSet[T BindingObject](scene *Scene, binding InterpolationBinding[T]) *InterpolationBindingSet[T]
InterpolationBindingSet creates a binding set that tracks deletions and notifies when the node should be applied to the target using interpolation.
func (*InterpolationBindingSet[T]) ApplyNodeToInterpolation ¶ added in v0.23.0
func (s *InterpolationBindingSet[T]) ApplyNodeToInterpolation(id NodeID, fraction float64)
ApplyNodeToInterpolation applies the state of the node to its target using interpolation.
type InterpolationCallback ¶ added in v0.23.0
InterpolationCallback is a function type for callbacks that are invoked when a target needs to be interpolated from the node.
type InterpolationSubscription ¶ added in v0.23.0
type InterpolationSubscription = observer.Subscription[InterpolationCallback]
InterpolationSubscription represents a notification subscription for interpolation updates.
type InterpolationSubscriptionSet ¶ added in v0.23.0
type InterpolationSubscriptionSet = observer.SubscriptionSet[InterpolationCallback]
InterpolationSubscriptionSet represents a set of interpolation subscriptions.
func NewInterpolationSubscriptionSet ¶ added in v0.23.0
func NewInterpolationSubscriptionSet() *InterpolationSubscriptionSet
NewInterpolationSubscriptionSet creates a new InterpolationSubscriptionSet.
type Node ¶
type Node struct {
// contains filtered or unexported fields
}
Node is a wrapper over a NodeID that simplifies interactions related to the node.
It should not be persisted for long-term use.
func (Node) AbsoluteMatrix ¶
AbsoluteMatrix returns the absolute transformation matrix of the node.
func (Node) AppendChild ¶
AppendChild attaches the specified child node as the last child of this node.
func (Node) AppendSibling ¶
AppendSibling attaches the specified sibling node as the right sibling of this node.
func (Node) BaseMatrix ¶ added in v0.23.0
BaseMatrix returns the base transformation matrix of the node with the specified ID - this is the absolute matrix of the parent, if there is one, or the identity matrix otherwise.
func (Node) Delete ¶ added in v0.19.0
func (n Node) Delete()
Delete removes the node from the scene.
func (Node) Detach ¶
Detach detaches the node from its parent. If preserveWorldTransform is true, the world transform of the node is preserved.
func (Node) FindNode ¶
FindNode searches for a node with the specified name in the subtree rooted at this node. It returns a nil Node if no such node is found.
func (Node) FirstChild ¶
FirstChild returns the first child of the node, or a nil Node if it has no children.
func (Node) InitializeMatrix ¶ added in v0.23.0
InitializeMatrix initializes the local transformation matrix of the node with the specified ID, avoiding interpolation with previous value.
func (Node) InitializePosition ¶ added in v0.23.0
InitializePosition initializes the local position of the node with the specified ID, avoiding interpolation with previous value.
func (Node) InitializeRotation ¶ added in v0.23.0
InitializeRotation initializes the local rotation of the node with the specified ID, avoiding interpolation with previous value.
func (Node) InitializeScale ¶ added in v0.23.0
InitializeScale initializes the local scale of the node with the specified ID, avoiding interpolation with previous value.
func (Node) InterpolatedAbsoluteMatrix ¶ added in v0.23.0
InterpolatedAbsoluteMatrix returns the interpolated absolute transformation matrix of the node, based on the specified alpha value in the range [0, 1].
func (Node) IsAncestorOf ¶ added in v0.23.0
IsAncestorOf returns whether the node is an ancestor of the specified descendant node.
func (Node) IsIndependent ¶ added in v0.23.0
IsIndependent returns whether the node is independent (i.e., not affected by parent transforms).
func (Node) LastChild ¶
LastChild returns the last child of the node, or a nil Node if it has no children.
func (Node) LeftSibling ¶
LeftSibling returns the left sibling of the node, or a nil Node if it has no left sibling.
func (Node) PrependChild ¶
PrependChild attaches the specified child node as the first child of this node.
func (Node) PrependSibling ¶
PrependSibling attaches the specified sibling node as the left sibling of this node.
func (Node) ResetDelta ¶ added in v0.23.0
ResetDelta resets the delta state of the node. If recursive is true, the delta state of all descendants is also reset.
func (Node) RightSibling ¶
RightSibling returns the right sibling of the node, or a nil Node if it has no right sibling.
func (Node) SetAbsoluteMatrix ¶
SetAbsoluteMatrix sets the absolute transformation matrix of the node. This is a convenience method that sets the local transformation matrix accordingly.
func (Node) SetIndependent ¶ added in v0.23.0
SetIndependent sets whether the node is independent (i.e., not affected by parent transforms).
func (Node) SetPosition ¶
SetPosition sets the local position of the node.
func (Node) SetRotation ¶
SetRotation sets the local rotation of the node.
func (Node) SetTransformFunc ¶ added in v0.23.0
func (n Node) SetTransformFunc(transformFunc TransformFunc)
SetTransformFunc sets the custom transformation function of the node.
func (Node) SetVisible ¶ added in v0.23.0
SetVisible sets whether the node is visible.
func (Node) TransformFunc ¶ added in v0.23.0
func (n Node) TransformFunc() TransformFunc
TransformFunc returns the custom transformation function of the node.
type NodeID ¶ added in v0.23.0
type NodeID struct {
// contains filtered or unexported fields
}
NodeID represents a unique identifier for a node in the scene.
type Scene ¶ added in v0.23.0
type Scene struct {
// contains filtered or unexported fields
}
func NewScene ¶ added in v0.23.0
NewScene creates a new scene with the specified initial capacity for nodes.
func (*Scene) AppendNodeChild ¶ added in v0.23.0
AppendNodeChild attaches the node with the specified childID as the last child of the node with the specified parentID.
func (*Scene) AppendNodeSibling ¶ added in v0.23.0
AppendNodeSibling attaches the node with the specified siblingID to the right of the node with the specified ID.
func (*Scene) ApplyNodeToInterpolation ¶ added in v0.23.0
ApplyNodeToInterpolation applies the state of the node with the specified ID to its interpolation target.
If recursive is true, the state is applied to all descendant nodes as well.
func (*Scene) ApplyNodeToTarget ¶ added in v0.23.0
ApplyNodeToTarget applies the state of the node with the specified ID to its target.
If recursive is true, the state is applied to all descendant nodes as well.
func (*Scene) ApplyNodesToInterpolations ¶ added in v0.23.0
ApplyNodesToInterpolations applies the state of all nodes to their interpolation targets.
func (*Scene) ApplyNodesToTargets ¶ added in v0.23.0
func (s *Scene) ApplyNodesToTargets()
ApplyNodesToTargets applies the state of all nodes to their targets.
func (*Scene) ApplySourceToTarget ¶ added in v0.23.0
ApplySourceToTarget applies the state of the source to its target.
If recursive is true, the state is applied to all descendant nodes as well.
func (*Scene) ApplySourcesToNodes ¶ added in v0.23.0
func (s *Scene) ApplySourcesToNodes()
ApplySourcesToNodes applies the state of the sources to their nodes.
func (*Scene) CreateNode ¶ added in v0.23.0
CreateNode creates a new node in the scene and returns its ID.
func (*Scene) DeleteNode ¶ added in v0.23.0
DeleteNode deletes the node with the specified ID, as well as any children, from the scene.
func (*Scene) DetachNode ¶ added in v0.23.0
DetachNode detaches the node with the specified ID from its parent.
func (*Scene) FindNode ¶ added in v0.23.0
FindNode returns the first found node with the specified name or NilNodeID if no such node exists.
The search order is arbitrary and should not be relied upon, hence use this method for nodes that have unique names only.
func (*Scene) FindSubtreeNode ¶ added in v0.23.0
FindSubtreeNode returns the first found node with the specified name in the subtree rooted at the node with the specified ID or NilNodeID if no such node exists.
func (*Scene) InitializeNodeMatrix ¶ added in v0.23.0
InitializeNodeMatrix initializes the local transformation matrix of the node with the specified ID, avoiding interpolation with previous value.
func (*Scene) InitializeNodePosition ¶ added in v0.23.0
InitializeNodePosition initializes the local position of the node with the specified ID, avoiding interpolation with previous value.
If multiple aspects are initialized, it is best to use the Set methods followed by a ResetNodeDelta call.
func (*Scene) InitializeNodeRotation ¶ added in v0.23.0
InitializeNodeRotation initializes the local rotation of the node with the specified ID, avoiding interpolation with previous value.
If multiple aspects are initialized, it is best to use the Set methods followed by a ResetNodeDelta call.
func (*Scene) InitializeNodeScale ¶ added in v0.23.0
InitializeNodeScale initializes the local scale of the node with the specified ID, avoiding interpolation with previous value.
If multiple aspects are initialized, it is best to use the Set methods followed by a ResetNodeDelta call.
func (*Scene) IsNodeChain ¶ added in v0.23.0
IsNodeChain returns whether the node with the specified leaf ID is a descendant of the node with the specified root ID.
func (*Scene) IsNodeIndependent ¶ added in v0.23.0
IsNodeIndependent returns whether the node with the specified ID is marked as independent (i.e. not affected by parent transformations).
func (*Scene) IsNodeVisible ¶ added in v0.23.0
IsNodeVisible returns whether the node with the specified ID is marked as visible.
func (*Scene) IsValidNode ¶ added in v0.23.0
IsValidNode returns whether the specified ID represents a valid node in the scene.
func (*Scene) NodeAbsoluteMatrix ¶ added in v0.23.0
NodeAbsoluteMatrix returns the absolute transformation matrix of the node with the specified ID.
func (*Scene) NodeBaseMatrix ¶ added in v0.23.0
NodeBaseMatrix returns the base transformation matrix of the node with the specified ID - this is the absolute matrix of the parent, if there is one, or the identity matrix otherwise.
func (*Scene) NodeFirstChild ¶ added in v0.23.0
NodeFirstChild returns the ID of the first child of the node with the specified ID.
func (*Scene) NodeHasParent ¶ added in v0.23.0
NodeHasParent returns whether the node with the specified ID has a parent.
func (*Scene) NodeInterpolatedAbsoluteMatrix ¶ added in v0.23.0
NodeInterpolatedAbsoluteMatrix returns the absolute transformation matrix of the node with the specified ID, interpolated between the previous and current states by the specified fraction in [0, 1].
func (*Scene) NodeLastChild ¶ added in v0.23.0
NodeLastChild returns the ID of the last child of the node with the specified ID.
func (*Scene) NodeLeftSibling ¶ added in v0.23.0
NodeLeftSibling returns the ID of the left sibling of the node with the specified ID.
func (*Scene) NodeMatrix ¶ added in v0.23.0
NodeMatrix returns the local transformation matrix of the node with the specified ID.
func (*Scene) NodeName ¶ added in v0.23.0
NodeName returns the name of the node with the specified ID.
func (*Scene) NodeParent ¶ added in v0.23.0
NodeParent returns the ID of the parent of the node with the specified ID.
func (*Scene) NodePosition ¶ added in v0.23.0
NodePosition returns the local position of the node with the specified ID.
func (*Scene) NodeRightSibling ¶ added in v0.23.0
NodeRightSibling returns the ID of the right sibling of the node with the specified ID.
func (*Scene) NodeRotation ¶ added in v0.23.0
NodeRotation returns the local rotation of the node with the specified ID.
func (*Scene) NodeScale ¶ added in v0.23.0
NodeScale returns the local scale of the node with the specified ID.
func (*Scene) NodeTransformFunc ¶ added in v0.23.0
func (s *Scene) NodeTransformFunc(id NodeID) TransformFunc
NodeTransformFunc returns the custom transformation function of the node with the specified ID.
func (*Scene) NodesIter ¶ added in v0.23.0
NodesIter returns an iterator that traverses all the nodes in a depth-first manner.
func (*Scene) PrependNodeChild ¶ added in v0.23.0
PrependNodeChild attaches the node with the specified childID as the first child of the node with the specified parentID.
func (*Scene) PrependNodeSibling ¶ added in v0.23.0
PrependNodeSibling attaches the node with the specified siblingID to the left of the node with the specified ID.
func (*Scene) ResetDelta ¶ added in v0.23.0
func (s *Scene) ResetDelta()
ResetDelta resets the delta state of all nodes in the scene.
func (*Scene) ResetNodeDelta ¶ added in v0.23.0
ResetNodeDelta resets the delta state of the node with the specified ID.
If recursive is true, the delta state of all descendant nodes is also reset.
func (*Scene) RootNodesIter ¶ added in v0.23.0
RootNodesIter returns an iterator that traverses all root nodes in the scene.
func (*Scene) SetNodeAbsoluteMatrix ¶ added in v0.23.0
SetNodeAbsoluteMatrix sets the absolute transformation matrix of the node with the specified ID.
func (*Scene) SetNodeIndependent ¶ added in v0.23.0
SetNodeIndependent sets whether the node with the specified ID is marked as independent (i.e. not affected by parent transformations).
func (*Scene) SetNodeMatrix ¶ added in v0.23.0
SetNodeMatrix sets the local transformation matrix of the node with the specified ID.
func (*Scene) SetNodeName ¶ added in v0.23.0
SetNodeName sets the name of the node with the specified ID.
func (*Scene) SetNodePosition ¶ added in v0.23.0
SetNodePosition sets the local position of the node with the specified ID.
func (*Scene) SetNodeRotation ¶ added in v0.23.0
SetNodeRotation sets the local rotation of the node with the specified ID.
func (*Scene) SetNodeScale ¶ added in v0.23.0
SetNodeScale sets the local scale of the node with the specified ID.
func (*Scene) SetNodeTransformFunc ¶ added in v0.23.0
func (s *Scene) SetNodeTransformFunc(id NodeID, transformFunc TransformFunc)
SetNodeTransformFunc sets the custom transformation function of the node with the specified ID.
func (*Scene) SetNodeVisible ¶ added in v0.23.0
SetNodeVisible sets whether the node with the specified ID is marked as visible.
func (*Scene) SubscribeInterpolationApply ¶ added in v0.23.0
func (s *Scene) SubscribeInterpolationApply(callback InterpolationCallback) *InterpolationSubscription
SubscribeInterpolationApply subscribes to events for interpolation applications.
func (*Scene) SubscribeNodeDelete ¶ added in v0.23.0
func (s *Scene) SubscribeNodeDelete(callback DeleteCallback) *DeleteSubscription
SubscribeNodeDelete subscribes to node deletion events.
func (*Scene) SubscribeSourceApply ¶ added in v0.23.0
func (s *Scene) SubscribeSourceApply(callback SourceCallback) *SourceSubscription
SubscribeSourceApply subscribes to events for source applications.
func (*Scene) SubscribeTargetApply ¶ added in v0.23.0
func (s *Scene) SubscribeTargetApply(callback TargetCallback) *TargetSubscription
SubscribeTargetApply subscribes to events for target applications.
func (*Scene) SubtreeIter ¶ added in v0.23.0
SubtreeIter returns an iterator that traverses the subtree rooted at the node with the specified ID.
func (*Scene) Visit ¶ added in v0.23.0
Visit traverses the all the nodes in a depth-first manner, invoking the specified callback for each node in the scene.
func (*Scene) VisitSubtree ¶ added in v0.23.0
VisitSubtree traverses the subtree rooted at the node with the specified ID, invoking the specified callback for each node in the subtree.
type SourceBinding ¶ added in v0.23.0
type SourceBinding[T BindingObject] interface { Binding[T] // OnSourceToNode is called when the source's state should be applied to the // node. OnSourceToNode(*Scene, T, NodeID) }
SourceBinding represents a binding between a source of data to a node.
type SourceBindingSet ¶ added in v0.23.0
type SourceBindingSet[T BindingObject] struct { *BindingSet[T] // contains filtered or unexported fields }
SourceBindingSet represents a set of source bindings for a specific object type.
func NewSourceBindingSet ¶ added in v0.23.0
func NewSourceBindingSet[T BindingObject](scene *Scene, binding SourceBinding[T]) *SourceBindingSet[T]
NewSourceBindingSet creates a binding set that tracks deletions and notifies when the source should be applied to the node.
func (*SourceBindingSet[T]) ApplySourceToNode ¶ added in v0.23.0
func (s *SourceBindingSet[T]) ApplySourceToNode(id NodeID)
ApplyTargetToNode applies the state of the target to its node.
type SourceCallback ¶ added in v0.23.0
SourceCallback is a function type for callbacks that are invoked when a source needs to be applied to a node.
type SourceSubscription ¶ added in v0.23.0
type SourceSubscription = observer.Subscription[SourceCallback]
SourceSubscription represents a notification subscription for source updates.
type SourceSubscriptionSet ¶ added in v0.23.0
type SourceSubscriptionSet = observer.SubscriptionSet[SourceCallback]
SourceSubscriptionSet represents a set of source subscriptions.
func NewSourceSubscriptionSet ¶ added in v0.23.0
func NewSourceSubscriptionSet() *SourceSubscriptionSet
NewSourceSubscriptionSet creates a new SourceSubscriptionSet.
type TargetBinding ¶ added in v0.23.0
type TargetBinding[T BindingObject] interface { Binding[T] // OnNodeToTarget is called when the node's state should be applied to the // target. OnNodeToTarget(*Scene, NodeID, T) }
TargetBinding represents a binding between a node and a target.
type TargetBindingSet ¶ added in v0.23.0
type TargetBindingSet[T BindingObject] struct { *BindingSet[T] // contains filtered or unexported fields }
TargetBindingSet represents a set of target bindings for a specific object type.
func NewTargetBindingSet ¶ added in v0.23.0
func NewTargetBindingSet[T BindingObject](scene *Scene, binding TargetBinding[T]) *TargetBindingSet[T]
NewTargetBindingSet creates a binding set that tracks deletions and notifies when the node should be applied to the target.
func (*TargetBindingSet[T]) ApplyNodeToTarget ¶ added in v0.23.0
func (s *TargetBindingSet[T]) ApplyNodeToTarget(id NodeID)
ApplyNodeToTarget applies the state of the node to its target.
type TargetCallback ¶ added in v0.23.0
TargetCallback is a function type for callbacks that are invoked when a target needs to be applied from a node.
type TargetSubscription ¶ added in v0.23.0
type TargetSubscription = observer.Subscription[TargetCallback]
TargetSubscription represents a notification subscription for target updates.
type TargetSubscriptionSet ¶ added in v0.23.0
type TargetSubscriptionSet = observer.SubscriptionSet[TargetCallback]
TargetSubscriptionSet represents a set of target subscriptions.
func NewTargetSubscriptionSet ¶ added in v0.23.0
func NewTargetSubscriptionSet() *TargetSubscriptionSet
NewTargetSubscriptionSet creates a new TargetSubscriptionSet.