Gizmo3DPlugin

View source

ExtendsPlugin

Provides a labelled Gizmo3D resource for immediate-mode 3D debug drawing in an App.

The required label constructor identifies the resource. Use the same label when retrieving it from the world; different labels provide separate gizmo resources. The optional GizmoSettings instance controls line width, caps, joins, style, and dash offset. When it is omitted, the plugin creates the default settings.

The current canvas backend does not render 3D geometry. It reports that 3D gizmos are unsupported and clears the labelled resource’s buffered data when its drawing step runs.

Register CorePlugin, ReflectPlugin, ColorPlugin, and MathPlugin before this plugin. These dependencies are not installed automatically.

Examples

import { App } from '@wimaengine/app'
import { ColorPlugin } from '@wimaengine/color'
import { CorePlugin } from '@wimaengine/core'
import { Gizmo3DPlugin } from '@wimaengine/gizmo'
import { MathPlugin } from '@wimaengine/math'
import { ReflectPlugin } from '@wimaengine/reflect'

class DebugGizmo {}

new App()
  .registerPlugin(new ReflectPlugin())
  .registerPlugin(new CorePlugin())
  .registerPlugin(new ColorPlugin())
  .registerPlugin(new MathPlugin())
  .registerPlugin(new Gizmo3DPlugin({ label: DebugGizmo }))
  .run()

Constructor


constructor<T>(param0: Gizmo3DPluginSettings<T>)

View source

Creates a 3D gizmo plugin for a labelled resource.

label is required and identifies the typed Gizmo3D resource. settings is optional and defaults to a new GizmoSettings; pass a shared settings instance when the app needs a specific line width, cap, join, style, or dash offset.

Type Parameters

T

Parameters

NameDescriptionDefault
param0

Generic resource label and draw settings.

—

Properties


readonlylabel: Constructor<T>

View source

Constructor identifying this plugin’s labelled Gizmo3D resource.

Use the same constructor when retrieving the resource. Different labels provide separate typed gizmo resources and plugin identities.

readonlysettings: GizmoSettings

View source

Drawing settings used by this plugin’s labelled Gizmo3D resource.

The settings control line width, caps, joins, style, and dash offset. The configured instance is shared with the resource created by this plugin.

Methods


register(app: App): void

View source

Adds the labelled Gizmo3D resource to an App.

The resource uses this plugin’s label and settings. The current canvas backend does not render 3D data; it reports that 3D gizmos are unsupported and clears the resource’s buffered data during drawing.

Parameters

NameDescriptionDefault
app

App to configure.

—

name(): TypeId

View source

Returns this plugin’s identity used by PluginRegistry.

The default implementation returns typeid(this.constructor). Override it when a plugin has multiple valid instances that need distinct identities, such as a generic plugin keyed by a configured constructor. The returned ID is checked when App#registerPlugin adds the plugin; registering a duplicate ID throws instead of replacing the existing instance.

Returns

Plugin identity used for duplicate detection and dependency lookup.