Documentation ¶
Index ¶
- type Node
- func (n *Node) Add(ichild NodeI) *Node
- func (n *Node) AddAt(idx int, ichild NodeI) *Node
- func (n *Node) BoundingBox() math32.Box3
- func (n *Node) Changed() bool
- func (n *Node) ChildAt(idx int) NodeI
- func (n *Node) ChildIndex(ichild NodeI) int
- func (n *Node) Children() []NodeI
- func (n *Node) Clone() NodeI
- func (n *Node) Direction() math32.Vector3
- func (n *Node) Dispose()
- func (n *Node) DisposeChildren(recurs bool)
- func (n *Node) FindLoaderID(id string) NodeI
- func (n *Node) FindPath(path string) NodeI
- func (n *Node) GetNode() *Node
- func (n *Node) GetNodeI() NodeI
- func (n *Node) Init(inode NodeI)
- func (n *Node) IsAncestorOf(desc NodeI) bool
- func (n *Node) LoaderID() string
- func (n *Node) LookAt(target, up *math32.Vector3)
- func (n *Node) LowestCommonAncestor(other NodeI) NodeI
- func (n *Node) Matrix() math32.Matrix4
- func (n *Node) MatrixWorld() math32.Matrix4
- func (n *Node) Name() string
- func (n *Node) Parent() NodeI
- func (n *Node) Position() math32.Vector3
- func (n *Node) Quaternion() math32.Quaternion
- func (n *Node) QuaternionMult(q *math32.Quaternion)
- func (n *Node) Remove(ichild NodeI) bool
- func (n *Node) RemoveAll(recurs bool)
- func (n *Node) RemoveAt(idx int) NodeI
- func (n *Node) Render(gs *gls.GLS)
- func (n *Node) RotateOnAxis(axis *math32.Vector3, angle float32)
- func (n *Node) RotateX(x float32)
- func (n *Node) RotateY(y float32)
- func (n *Node) RotateZ(z float32)
- func (n *Node) Rotation() math32.Vector3
- func (n *Node) Scale() math32.Vector3
- func (n *Node) SetChanged(changed bool)
- func (n *Node) SetDirection(x, y, z float32)
- func (n *Node) SetDirectionVec(vdir *math32.Vector3)
- func (n *Node) SetLoaderID(id string)
- func (n *Node) SetMatrix(m *math32.Matrix4)
- func (n *Node) SetName(name string)
- func (n *Node) SetPosition(x, y, z float32)
- func (n *Node) SetPositionVec(vpos *math32.Vector3)
- func (n *Node) SetPositionX(x float32)
- func (n *Node) SetPositionY(y float32)
- func (n *Node) SetPositionZ(z float32)
- func (n *Node) SetQuaternion(x, y, z, w float32)
- func (n *Node) SetQuaternionQuat(q *math32.Quaternion)
- func (n *Node) SetQuaternionVec(q *math32.Vector4)
- func (n *Node) SetRotation(x, y, z float32)
- func (n *Node) SetRotationQuat(quat *math32.Quaternion)
- func (n *Node) SetRotationVec(vrot *math32.Vector3)
- func (n *Node) SetRotationX(x float32)
- func (n *Node) SetRotationY(y float32)
- func (n *Node) SetRotationZ(z float32)
- func (n *Node) SetScale(x, y, z float32)
- func (n *Node) SetScaleVec(scale *math32.Vector3)
- func (n *Node) SetScaleX(sx float32)
- func (n *Node) SetScaleY(sy float32)
- func (n *Node) SetScaleZ(sz float32)
- func (n *Node) SetUserData(data interface{})
- func (n *Node) SetVisible(state bool)
- func (n *Node) TranslateOnAxis(axis *math32.Vector3, dist float32)
- func (n *Node) TranslateX(dist float32)
- func (n *Node) TranslateY(dist float32)
- func (n *Node) TranslateZ(dist float32)
- func (n *Node) UpdateMatrix() bool
- func (n *Node) UpdateMatrixWorld()
- func (n *Node) UserData() interface{}
- func (n *Node) Visible() bool
- func (n *Node) WorldDirection(result *math32.Vector3)
- func (n *Node) WorldPosition(result *math32.Vector3)
- func (n *Node) WorldQuaternion(result *math32.Quaternion)
- func (n *Node) WorldRotation(result *math32.Vector3)
- func (n *Node) WorldScale(result *math32.Vector3)
- type NodeI
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Node ¶
type Node struct { dispatcher.Dispatcher // Embedded event dispatcher // contains filtered or unexported fields }
Node represents an object in 3D space existing within a hierarchy.
func (*Node) Add ¶
Add adds the specified node to the list of children and sets its parent pointer. If the specified node had a parent, the specified node is removed from the original parent's list of children.
func (*Node) AddAt ¶
AddAt adds the specified node to the list of children at the specified index and sets its parent pointer. If the specified node had a parent, the specified node is removed from the original parent's list of children.
func (*Node) BoundingBox ¶
BoundingBox satisfies the NodeI interface. Computes union of own bounding box with those of all descendents.
func (*Node) ChildIndex ¶
ChildIndex returns the index of the specified child (-1 if not found).
func (*Node) DisposeChildren ¶
DisposeChildren removes and disposes of all children. If 'recurs' is true, call DisposeChildren on each child recursively.
func (*Node) FindLoaderID ¶
FindLoaderID looks in the specified node and in all its children for a node with the specified loaderID and if found returns it. Returns nil if not found.
func (*Node) FindPath ¶
FindPath finds a node with the specified path starting with this node and searching in all its children recursively. A path is the sequence of the names from the first node to the desired node separated by the forward slash.
func (*Node) GetNode ¶
GetNode satisfies the NodeI interface and returns a pointer to the embedded Node.
func (*Node) IsAncestorOf ¶
IsAncestorOf returns whether this node is an ancestor of the specified node. Returns true if they are the same.
func (*Node) LoaderID ¶
LoaderID returns an optional ID set when this node was created by an external loader such as Collada.
func (*Node) LookAt ¶
LookAt rotates the node to look at the specified target position, using the specified up vector.
func (*Node) LowestCommonAncestor ¶
LowestCommonAncestor returns the common ancestor of this node and the specified node if any.
func (*Node) MatrixWorld ¶
MatrixWorld returns a copy of the matrix world of this node.
func (*Node) Quaternion ¶
func (n *Node) Quaternion() math32.Quaternion
Quaternion returns the current quaternion.
func (*Node) QuaternionMult ¶
func (n *Node) QuaternionMult(q *math32.Quaternion)
QuaternionMult multiplies the current quaternion by the specified quaternion.
func (*Node) Remove ¶
Remove removes the specified NodeI from the list of children. Returns true if found or false otherwise.
func (*Node) RotateOnAxis ¶
RotateOnAxis rotates around the specified local axis the specified angle in radians.
func (*Node) SetChanged ¶
SetChanged sets the matNeedsUpdate flag of the node.
func (*Node) SetDirection ¶
SetDirection sets the direction.
func (*Node) SetDirectionVec ¶
SetDirectionVec sets the direction based on a vector pointer.
func (*Node) SetLoaderID ¶
SetLoaderID is normally used by external loaders, such as Collada, to assign an ID to the node with the ID value in the node description. Can be used to find other loaded nodes.
func (*Node) SetName ¶
SetName sets the (optional) name. The name can be used for debugging or other purposes.
func (*Node) SetPosition ¶
SetPosition sets the position.
func (*Node) SetPositionVec ¶
SetPositionVec sets the position based on the specified vector pointer.
func (*Node) SetPositionX ¶
SetPositionX sets the X coordinate of the position.
func (*Node) SetPositionY ¶
SetPositionY sets the Y coordinate of the position.
func (*Node) SetPositionZ ¶
SetPositionZ sets the Z coordinate of the position.
func (*Node) SetQuaternion ¶
SetQuaternion sets the quaternion based on the specified quaternion unit multiples.
func (*Node) SetQuaternionQuat ¶
func (n *Node) SetQuaternionQuat(q *math32.Quaternion)
SetQuaternionQuat sets the quaternion based on the specified quaternion pointer.
func (*Node) SetQuaternionVec ¶
SetQuaternionVec sets the quaternion based on the specified quaternion unit multiples vector.
func (*Node) SetRotation ¶
SetRotation sets the global rotation in Euler angles (radians).
func (*Node) SetRotationQuat ¶
func (n *Node) SetRotationQuat(quat *math32.Quaternion)
SetRotationQuat sets the global rotation based on the specified quaternion pointer.
func (*Node) SetRotationVec ¶
SetRotationVec sets the global rotation in Euler angles (radians) based on the specified vector pointer.
func (*Node) SetRotationX ¶
SetRotationX sets the global X rotation to the specified angle in radians.
func (*Node) SetRotationY ¶
SetRotationY sets the global Y rotation to the specified angle in radians.
func (*Node) SetRotationZ ¶
SetRotationZ sets the global Z rotation to the specified angle in radians.
func (*Node) SetScaleVec ¶
SetScaleVec sets the scale based on the specified vector pointer.
func (*Node) SetUserData ¶
func (n *Node) SetUserData(data interface{})
SetUserData sets the generic user data associated to the node.
func (*Node) SetVisible ¶
SetVisible sets the visibility of the node.
func (*Node) TranslateOnAxis ¶
TranslateOnAxis translates the specified distance on the specified local axis.
func (*Node) TranslateX ¶
TranslateX translates the specified distance on the local X axis.
func (*Node) TranslateY ¶
TranslateY translates the specified distance on the local Y axis.
func (*Node) TranslateZ ¶
TranslateZ translates the specified distance on the local Z axis.
func (*Node) UpdateMatrix ¶
UpdateMatrix updates (if necessary) the local transform matrix of this node based on its position, quaternion, and scale.
func (*Node) UpdateMatrixWorld ¶
func (n *Node) UpdateMatrixWorld()
UpdateMatrixWorld updates this node world transform matrix and of all its children
func (*Node) UserData ¶
func (n *Node) UserData() interface{}
UserData returns the generic user data associated to the node.
func (*Node) WorldDirection ¶
WorldDirection updates the world matrix and sets the specified vector to the current world direction of this node.
func (*Node) WorldPosition ¶
WorldPosition updates the world matrix and sets the specified vector to the current world position of this node.
func (*Node) WorldQuaternion ¶
func (n *Node) WorldQuaternion(result *math32.Quaternion)
WorldQuaternion updates the world matrix and sets the specified quaternion to the current world quaternion of this node.
func (*Node) WorldRotation ¶
WorldRotation updates the world matrix and sets the specified vector to the current world rotation of this node in Euler angles.
func (*Node) WorldScale ¶
WorldScale updates the world matrix and sets the specified vector to the current world scale of this node.
type NodeI ¶
type NodeI interface { dispatcheri.DispatcherI GetNode() *Node GetNodeI() NodeI Visible() bool SetVisible(state bool) Name() string SetName(string) Parent() NodeI Children() []NodeI IsAncestorOf(NodeI) bool LowestCommonAncestor(NodeI) NodeI UpdateMatrixWorld() BoundingBox() math32.Box3 Render(gs *gls.GLS) Clone() NodeI Dispose() Position() math32.Vector3 Rotation() math32.Vector3 Scale() math32.Vector3 }
NodeI is the interface for all node types.