Options
All
  • Public
  • Public/Protected
  • All
Menu

Records the position and attitude history of a Mesh allowing the Mesh to be drawn in multiple historical configurations.

This class is refererce counted because it maintains a reference to a Mesh. You should call the release method when the trail is no longer required.

// The trail is constructed, at any time, on an existing mesh.
const trail = new EIGHT.Trail(mesh)

// Configure the Trail object, or use the defaults.
trail.config.enabled = true
trail.config.interval = 30
trail.config.retain = 5

// Take a snapshot of the ball position and attitude, usually each animation frame.
trail.snapshot()

// Draw the trail during the animation frame.
trail.draw(ambients)

// Release the trail when no longer required, usually in the window.onunload function.
trail.release()

Hierarchy

  • ShareableBase
    • Trail

Implements

Index

Constructors

constructor

Properties

config

config: TrailConfig = new TrailConfig()

The configuration that determines how the history is recorded.

Methods

addRef

  • addRef(): number

draw

  • draw(ambients: Facet[]): void

erase

  • erase(): void

forEach

  • forEach(callback: (alpha: number, X: Vector3, R: Spinor3) => any): void
  • Parameters

    • callback: (alpha: number, X: Vector3, R: Spinor3) => any
        • (alpha: number, X: Vector3, R: Spinor3): any
        • Parameters

          • alpha: number
          • X: Vector3
          • R: Spinor3

          Returns any

    Returns void

getLoggingName

  • getLoggingName(): string
  • Returns the name that was assigned by the call to the setLoggingName method.

    Returns string

isZombie

  • isZombie(): boolean
  • An object is a zombie if it has been released by all who have held references. In some cases it may be possible to recycle a zombie.

    Returns boolean

release

  • release(): number

render

  • render(ambients: Facet[]): void

Protected setLoggingName

  • setLoggingName(name: string): void
  • This method is for use within constructors.

    Immediately after a call to the super class constructor, make a call to setLoggingName. This will have the effect of refining the name used for reporting reference counts.

    This method has the secondary purpose of enabling a tally of the number of classes in the constructor chain. This enables the runtime architecture to verify that destructor chains are consistent with constructor chains, which is a good practice for cleaning up resources.

    Notice that this method is intentionally protected to discourage it from being called outside of the constructor.

    Parameters

    • name: string

      This will usually be set to the name of the class.

    Returns void

snapshot

  • snapshot(alpha?: number): void
  • Records the Mesh variables according to the interval property.

    Parameters

    • Default value alpha: number = 0

    Returns void

Legend

  • Constructor
  • Property
  • Method
  • Accessor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Property
  • Method
  • Protected property
  • Protected method
  • Static property
  • Static method

Generated using TypeDoc