rhodonite
    Preparing search index...

    Class AABBGizmo

    AABB Gizmo class that visualizes the Axis-Aligned Bounding Box of a target entity. This gizmo renders a wireframe box around the target entity showing its spatial boundaries.

    Hierarchy (View Summary)

    Index
    __engine: Engine
    __isVisible: boolean = false

    the target entity which this gizmo belong to

    The top entity of this gizmo group. A programmer who implements a gizmo class has to make this entity a child of the target entity's scene graph component that the gizmo will belong to manually.

    _tags: RnTags = {}

    Collection of tags associated with this object

    currentMaxObjectCount: number = 0

    Current maximum object count for UID generation

    InvalidObjectUID: -1

    Invalid object UID constant

    • get isSetup(): boolean

      Checks if the gizmo has been properly set up and initialized.

      Returns boolean

      True if the gizmo is set up and ready to render, false otherwise

    • get isVisible(): boolean

      Gets the current visibility state of the gizmo

      Returns boolean

      True if the gizmo is visible, false otherwise

    • set isVisible(flg: boolean): void

      Sets the visibility state of the gizmo

      Parameters

      • flg: boolean

        True to make the gizmo visible, false to hide it

      Returns void

    • get objectUID(): number

      Gets the unique object identifier

      Returns number

      The object's UID

    • get uniqueName(): string

      Gets the unique name of this object

      Returns string

      The unique name string

    • Internal method to set the visibility of the gizmo and all its child entities

      Parameters

      • flg: boolean

        True to show the gizmo, false to hide it

      Returns void

    • Determines whether the gizmo setup should be skipped

      Returns boolean

      True if setup should be skipped, false otherwise

    • Internal

      Marks the gizmo subtree's world matrices as dirty and materializes them immediately.

      The GPU instance data (world and normal matrices) is uploaded at the beginning of the Render stage from component buffers, and those buffers are only written when the matrices are recalculated. A gizmo updated after the Logic stage (for example when only the camera changed) therefore has to recalculate its matrices here, otherwise the gizmo keeps being rendered with its previous transform until some later frame re-uploads the data.

      Returns void

    • Internal

      Copies tag data from another RnObject instance to this object

      Parameters

      • rnObject: RnObject

        The source RnObject to copy tags from

      Returns void

    • Internal

      Destroys the gizmo and cleans up all associated resources. Removes the gizmo entity from the scene graph and frees memory.

      Returns void

    • Internal

      Initializes the gizmo entities and mesh components if not already done. Creates the wireframe mesh entity, sets up the primitive geometry, and attaches it to the target entity's scene graph.

      Returns void

    • Internal

      Updates the gizmo's transform to match the target entity's current AABB. Repositions and rescales the wireframe to accurately represent the target's world-space bounding box including skeletal deformations.

      Returns void

    • Retrieves a complete tag object (name and value) for the specified tag name

      Parameters

      • tagName: string

        The name of the tag to retrieve

      Returns Tag

      A Tag object containing the name and value

    • Retrieves the value associated with a specific tag name

      Parameters

      • tagName: string

        The name of the tag whose value to retrieve

      Returns any

      The tag value, or undefined if the tag doesn't exist

    • Checks whether this object has a tag with the specified name

      Parameters

      • tagName: string

        The name of the tag to check for

      Returns boolean

      True if the tag exists (value is not null/undefined), false otherwise

    • Checks if this object has a tag with the specified name and value

      Parameters

      • tagName: string

        The tag name to match

      • tagValue: string

        The tag value to match

      Returns boolean

      True if the object has a matching tag, false otherwise

    • Checks if this object has all the specified tags with exactly matching values

      Parameters

      • tags: RnTags

        Object containing tag names as keys and expected values

      Returns boolean

      True if all specified tags exist with matching values, false otherwise

    • Checks if the object's combined tag string contains all the provided search strings. This allows for flexible searching within tag names and values.

      Parameters

      • stringArray: string[]

        Array of strings that must all be present in the combined tag string

      Returns boolean

      True if all strings are found in the combined tag string, false otherwise

    • Removes a tag from this object

      Parameters

      • tagName: string

        The name of the tag to remove

      Returns void

    • Applies appropriate tags to the gizmo entities for identification and categorization This method ensures that all gizmo entities are properly tagged for rendering and processing pipelines

      Returns void

    • Attempts to set a tag on this object. If the tag already exists, it will be replaced.

      Parameters

      • tag: Tag

        The tag object containing the name and value to set

      Returns boolean

      True if the tag was successfully set, false if the tag name contains invalid characters

    • Attempts to set a unique name for this object

      Parameters

      • name: string

        The desired unique name

      • toAddNameIfConflict: boolean

        If true, appends UID to make name unique when conflicts occur; if false, fails on conflict

      Returns boolean

      True if the name was successfully set, false if there was a conflict and toAddNameIfConflict was false

    • Unregisters this object from all tracking collections. Should be called when the object is being destroyed.

      Returns void

    • Validates that a tag string contains only allowed characters (alphanumeric and underscore)

      Parameters

      • val: string

        The string to validate

      Returns boolean

      True if the string contains only valid characters, false if it contains invalid characters

    • Internal

      Calculates a uniform world-space scale that keeps a unit-length gizmo element (an axis of length 1, or a ring of radius 1) at a constant fraction of the viewport height, independent of the target size and the camera distance.

      The scale is derived from the vertical scale of the camera's projection matrix, so the on-screen size stays proportional to the viewport height for both perspective and orthographic cameras.

      Parameters

      • engine: Engine

        The engine used to resolve the current camera

      • worldPosition: IVector3

        The world-space position of the gizmo center

      • screenSpaceRatio: number

        The target size as a fraction of the viewport height

      Returns number

      The uniform scale to apply to the gizmo's top entity

    • Internal

      Cleans up all static resources for a specific Engine. This resets static members so that gizmos can be recreated with a new Engine. Called from Engine.destroy()

      Parameters

      Returns void

    • Internal

      Resets all static object tracking data. Used primarily for testing.

      Returns void

    • Retrieves an RnObject instance by its unique identifier

      Parameters

      • objectUid: number

        The unique identifier of the object to retrieve

      Returns RnObject | undefined

      The RnObject instance or undefined if not found or garbage collected

    • Retrieves an RnObject instance by its unique name

      Parameters

      • uniqueName: string

        The unique name of the object to retrieve

      Returns RnObject | undefined

      The RnObject instance or undefined if not found or garbage collected

    • Searches for the first object that has a specific tag with the given value

      Parameters

      • tag: string

        The tag name to search for

      • value: string

        The tag value to match

      Returns WeakRef<RnObject> | undefined

      WeakRef to the first matching object, or undefined if not found