Component

A Component adds functionality to a SceneObject. There are three fundamental types of components: ObjectTransform, Render, and Behavior. Of these, only ObjectTransform is treated special, otherwise the type of component it is just depends on what methods the component class implements. A component can be both behavioral and renderable, if it provides both an update method and a getRenderInstance method, for example.

A ObjectTransform component provides local and world transformation matrices for the object or other components. A Render component provides data to the renderer, such as mesh data, lights, cameras. A Behavior component provides scriptable functionality, called via various methods of the component like start and update.

A ObjectTransform component can have a list of children components, which can include other ObjectTransform components, forming an internal transformation hierarchy within the object.

An object has a list of components, only one of which can be a ObjectTransform. The ObjectTransform in the objects root component list defines the transformation of the object itself, providing its position, orientation and scale. If an object doesn't have a root ObjectTransform, then it's local transformation is considered to be identity.

The world space transformation of an object is the objects local transformation multiplied with its parent object transformation, if it has a parent.

The world space transformation of any component is either the world space transformation of its parent component, or if it doesn't have a parent component, the object that owns it.

A Render component provides a method getRenderInstances, which allows the component to provide its render data to the renderer.

A Behavior component provides methods start, update, etc, which are called by the Engine.

Both Render and Behavior component classes are extended directly from this Component class. They just define the appropriate methods. Only ObjectTransform components should be extended from the ObjectTransform class. A ObjectTransform component can also include Render and Behavior component methods to provide that functionality.

Constructor

new L3D.Component()

Mixes In:

Extends

Properties

active bool

Is the both the component active in it's hierarchy? Inactive components won't be computed or rendered.

fullPath String
Overrides:
id String

The unique ID of this component.

Overrides:
name String

The name of the object.

object SceneObject

The SceneObject this component belongs to. A Component is always attached to a SceneObject.

Overrides:
onModified Signal

Fired when the object has been modified.

Overrides:
onNameChanged Signal

Fired when the object's name changes.

parent *

Either a parent ObjectTransform, if the component is a child of a ObjectTransform, or the SceneObject, if the component is a direct child of a SceneObject.

parentTransform ObjectTransform

The parent ObjectTransform of a component of this component, whether from the immediate object the component belongs to, or an ancestor object.

scene Scene

The scene this component belongs to.

transform ObjectTransform

Gets the immediate parent transform component of this component. If this component is the child of a transform component, then that transform component is returned, otherwise the transform of the SceneObject that this component belongs to is returned.

visible bool

Is the object this component belongs to visible?

Methods

clone(options) → Object

Overrides:

Creates a clone of this object.

Parameters
options Object

Options for the clone method.

Returns
Object

configure(o)

Overrides:

Set the properties of the object from a JSON structure.

Parameters
o Object

Serialized data to configure the object with

getPropertyInfo(path) → Object

Overrides:

Get information about a particular property of this object.

Parameters
path String
Returns
Object

serialize() → Object

Overrides:

Serialize the object to a JSON structure.

Returns
Object

The serialized version of the object.

setModified()

Overrides:

Fires the objects onModified signal.

toJSON() → Object

Overrides:

Serialize the object to a JSON structure

Returns
Object

The serialized version of the object.