An Urbject is an object that can be added to a Scene. There are many sub-classes of an Urbject such as MeshUrbject, AmbientLight, DirectionalLight, PointLight, and Camera. The base Urbject class holds positional and classification data, and on its own can be used as a "parent" object to contain children Urbjects and transform them locally to itself.
See also: Scene, MeshUrbject, AmbientLight, DirectionalLight, PointLight, Camera
Urbjects are named after Urchin to avoid confusion with the basic JavaScript "Object".
Constructors
Constants
Urbject Types
| Urbject.PARENT = 0 |
A non-explicit value used to classify an Urbject as a standard Urbject. |
| Urbject.MESH_URBJECT = 1 |
A non-explicit value used to classify an Urbject as a MeshUrbject. See also: MeshUrbject
|
| Urbject.AMBIENT_LIGHT = 2 |
A non-explicit value used to classify an Urbject as an AmbientLight. See also: AmbientLight
|
| Urbject.DIRECTIONAL_LIGHT = 3 |
A non-explicit value used to classify an Urbject as a DirectionalLight. See also: DirectionalLight
|
| Urbject.SPOT_LIGHT = 4 |
A non-explicit value used to classify an Urbject as a PointLight. See also: PointLight
|
| Urbject.CAMERA = 5 |
A non-explicit value used to classify an Urbject as a Camera. See also: Camera
|
Urbject States
| Urbject.DYNAMIC = 100 |
A non-explicit value used to classify the state of the Urbject as Dynamic. A Dynamic Urbject will assume that it has moved or changed visual properties in some way since the last frame render. This is the default state of all Urbjects. |
| Urbject.STATIC = 101 |
A non-explicit value used to classify the state of the Urbject as Static. A Static Urbject will assume that it and any of its children have NOT moved or changed visual properties in any way since the last frame render. When a FrameInstance is calculated, this object's FrameInstance will be pulled from the instanceCache if it exists, or calculated and then stored in the instanceCache if it does not exist. See also: FrameInstance
|
| Urbject.BILLBOARD = 102 |
A non-explicit value used to classify the state of the Urbject as a Billboard. A Billboard Urbject will always rotate so that its default orientation faces the camera. i.e. The local X-Axis of the Urbject will rotate to point towards the camera. |
| Urbject.Z_BILLBOARD = 103 |
A non-explicit value used to classify the state of the Urbject as a Billboard about the Z-Axis. A Z-Billboard Urbject will always rotate so that its default orientation rotates around the Z-Axis to face the camera. |
| Urbject.X_BILLBOARD = 104 |
A non-explicit value used to classify the state of the Urbject as a Billboard about the X-Axis. A X-Billboard Urbject will always rotate so that its default orientation rotates around the X-Axis to face the camera. |
| Urbject.Y_BILLBOARD = 105 |
A non-explicit value used to classify the state of the Urbject as a Billboard about the Y-Axis. A Y-Billboard Urbject will always rotate so that its default orientation rotates around the Y-Axis to face the camera. |
Other
| Urbject.DEFAULT_GROUP = 100 |
The translation that is added to a group number of an Urbject when calculating its position in the render queue. This allows all Urbjects to be positioned at group 0, and there can be up to 100 groups that come before group 0. |
Variables
Public Variables
| children: Array<Urbject> |
An Array of Urbjects that are positioned relatively to this Urbject. |
| group: number |
The render group that the Urbject is a part of. Smaller group numbers are rendered first. Note: The minimum group that can be assigned is -100, and the maximum is equal to 232 - 101.
|
| orientation: Quaternion |
The orientation of the Urbject in 3D space. See also: Quaternion
|
| parent: Urbject |
This Urbject's parent Urbject. If this Urbject does not have a parent, then it is undefined. |
| position: Vector |
The position of the Urbject in 3D space. See also: Vector
|
| scaleVector: Vector |
The scale of the Urbject in 3D space. See also: Vector |
| state: number |
The state of the Urbject used to determine the way the FrameInstance for the Urbject is calculated. Must be one of the Urbject states listed above under "Constants".See also: FrameInstance
|
| type: number |
The type of the Urbject. Must be one of the Urbject types listed above under "Constants". |
Protected Variables
| protected instanceCache: FrameInstance |
A protected variable that stores the FrameInstance for Static Urbjects. See also: FrameInstance
|
Functions
Static Functions
| Urbject.addChild(u: Urbject, c: Urbject): Urbject |
Returns a copy of the first Urbject with the second Urbject added as a child. |
| Urbject.applyTransform(target: Urbject, transform: Urbject): Urbject |
Returns a copy of the target Urbject with the transform Urbject applied. |
| Urbject.copy(u: Urbject, options?: { typeCheck?: boolean, shallow?: boolean } ): Urbject |
Returns a copy of the given Urbject or makes a new Urbject from an Object that contains all public Urbject attributes. typeCheck is true by default and determines whether the type of the Urbject will be considered when copied. shallow is false by default and, if true, will prevent the Urbject's children from being copied as well. |
| Urbject.getInstance(u: Urbject, camera: Camera): FrameInstance |
Returns the FrameInstance for the given Urbject and its children. See also: FrameInstance
|
| Urbject.getWorldTransform(u: Urbject): Urbject |
Returns a "shallow" copy of the Urbject with its absolute position, orientation, and scale in the scene. See the implementation of copy() for more information on a "shallow" copy.
|
| Urbject.removeChild(u: Urbject, c: Urbject): Urbject |
Returns a copy of the first Urbject with the second Urbject removed as a child. |
| Urbject.scale(u: Urbject, a: number | Vector): Urbject |
Returns a copy of the given Urbject, scaled by the given number or vector. See also: Vector
|
| Urbject.setScale(u: Urbject, a: number | Vector): Urbject |
Returns a copy of the given Urbject with the scale set to the given vector or a new vector with all components equal to the number given. See also: Vector
|
| Urbject.transform(u: Urbject, v: Vector): Urbject |
Returns a copy of the given Urbject transformed by the given vector. See also: Vector
|
Home
Copyright © 2020 Trevor Richard