Class TransformWidget

This is the base class for all objects that can be added to a GopherGfx 3D scene. It is named "Node" because the scene is stored in a graph data structure, so we think of every element in that graph as a "node" in the graph. There is also a "Node2" base class for all objects that can be added to the 2D scene.

Every object that can be added to a 3D scene (e.g., Lights, Mesh3s) will inherit from this base object. So, every object in the scene will have a position, rotation, scale, boundingBox, boundingSphere, visibility, and all of the other properties listed in this class.

For more detail on how the scene graph works, see the documentation for the Scene class.

Hierarchy

Constructors

  • Constructor for the TransformWidget class

    Parameters

    • lineLength: number = 1

      The length of each line in the axes, default = 1

    • selectionWidth: number = 0.01

      The width of each selected axis line

    • triggerDistance: number = 0.05

      The maximum distance from the axis line that can trigger selection

    Returns TransformWidget

Properties

_localBoundingBox: BoundingBox3

Bounding box in this transform's local coordinate space

_localBoundingSphere: BoundingSphere

Bounding circle in this transform's local coordinate space

_position: Vector3

The position of this node as a Vector3.

_rotation: Quaternion

The rotation of this transform represented as a quaternion.

_scale: Vector3

The scale of this node as a Vector3.

_worldBoundingBox: BoundingBox3

Bounding box in the world coordinate space

_worldBoundingSphere: BoundingSphere

Bounding box in the world coordinate space

axes: Line3
boundingBox: BoundingBox3

The bounding box in vertex coordinate space

boundingSphere: BoundingSphere

The bounding sphere in vertex coordinate space

children: Node3[]
currentAxis: number
deviceCoords: Vector2
localBoundsDirty: boolean
localMatrixDirty: boolean
localMatrixNegScale: boolean
localMatrixUpdated: boolean
localToParentMatrix: Matrix4

The local transformation matrix of this node.

localToWorldMatrix: Matrix4

The world transformation matrix of this node.

parent: null | Node3

The parent transform of this transform. Null if this transform has no parent.

selectionPlane: Plane3
thickAxes: Mesh3[]
visible: boolean

Whether this transform is currently visible in the scene.

worldBoundsDirty: boolean
worldMatrixDirty: boolean

Accessors

Methods

  • Draws this transform and all its children in the scene graph.

    Parameters

    • parent: Node3

      The parent transform of this transform.

    • camera: Camera

      The camera used to view the scene.

    • lightManager: LightManager

      The light manager used to manage the lights in the scene.

    Returns void

  • Checks for intersection between this Node3 and another

    Returns

    Whether or not the two objects intersect

    Parameters

    • other: Node3

      The other Node3 object

    • mode: IntersectionMode3 = IntersectionMode3.BOUNDING_SPHERE

      The IntersectionMode3 to use for the comparison (default: BOUNDING_SPHERE)

    • space: CoordinateSpace3 = CoordinateSpace3.LOCAL_SPACE

      The CoordinateSpace3 to use for the comparison (default: LOCAL_SPACE)

    Returns boolean

  • Checks if the TransformWidget is currently selected

    Returns

    True if the TransformWidget is selected, false otherwise

    Returns boolean

  • Rotates this Node3 object to look at the given target with the given up vector

    Parameters

    • target: Vector3

      The Vector3 representing the target in world space

    • up: Vector3 = Vector3.UP

      The Vector3 representing the up direction (defaults to Vector3.UP)

    • coordinateSpace: CoordinateSpace3 = CoordinateSpace3.LOCAL_SPACE

    Returns void

  • Handles a mouse down event, checking for intersection with the thickAxes and setting currentAxis if one is found

    Parameters

    • event: MouseEvent

      The MouseEvent

    Returns void

  • Handles a mouse move event, updating the deviceCoords

    Parameters

    • event: MouseEvent

      The MouseEvent

    Returns void

  • Handles a mouse up event, resetting the currentAxis

    Parameters

    • event: MouseEvent

      The MouseEvent

    Returns void

  • Removes the current Node3 from its parent Node3

    Returns

    true if the Node3 was successfully removed, false otherwise

    Returns boolean

  • Traverses the scene graph starting from this Node3 object and updates the world matrices of all Node3 objects in the graph.

    Parameters

    • parentMatrixDirty: boolean = false

    Returns void

  • Updates the TransformWidget based on the deltaTime value

    Parameters

    • deltaTime: number

      The amount of time that has passed since the last update

    Returns void

  • Updates the world matrix of this Node3 by computing the multiplication of its local matrix with its parent's world matrix (if it has a parent).

    Returns

    void

    Returns void

Generated using TypeDoc