public class Object3D
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static interface |
Object3D.ObjectHandler |
static interface |
Object3D.Traverse |
Modifier and Type | Field and Description |
---|---|
boolean |
__webglActive |
boolean |
__webglInit |
Matrix4 |
_modelViewMatrix |
Matrix3 |
_normalMatrix |
static Vector3 |
DefaultUp |
Constructor and Description |
---|
Object3D() |
Modifier and Type | Method and Description |
---|---|
Object3D |
add(java.util.List<? extends Object3D> objects) |
Object3D |
add(Object3D object)
Adds object as child of this object.
|
void |
applyMatrix(Matrix4 matrix)
This updates the position, rotation and scale with the matrix.
|
Object3D |
clone()
Creates a new clone of this object and all descendants.
|
Object3D |
clone(Object3D object) |
Object3D |
clone(Object3D object,
boolean recursive) |
java.util.List<Object3D> |
getChildren()
Array with object's children.
|
java.util.List<? extends Object3D> |
getChildrenByClass(java.lang.Class<?> clazz,
boolean recursive) |
int |
getId()
Unique number for this object instance.
|
Matrix4 |
getMatrix()
Local transform.
|
Matrix4 |
getMatrixWorld()
The global transform of the object.
|
java.lang.String |
getName()
Optional name of the object (doesn't need to be unique).
|
Object3D |
getObjectById(int id,
boolean recursive)
Searches through the object's children and returns the first with a matching id, optionally recursive.
|
Object3D |
getObjectByName(java.lang.String name,
boolean recursive)
Searches through the object's children and returns the first with a matching name, optionally recursive.
|
Object3D |
getParent()
Object's parent in the scene graph.
|
Vector3 |
getPosition()
Object's local position.
|
Quaternion |
getQuaternion()
Object's local rotation as
Quaternion . |
double |
getRenderDepth() |
Euler |
getRotation()
Object's local rotation (
Euler angles), in radians. |
Vector3 |
getScale()
Object's local scale.
|
Vector3 |
getUp()
Up direction.
|
Vector3 |
getWorldDirection() |
Vector3 |
getWorldDirection(Vector3 optionalTarget) |
Vector3 |
getWorldPosition() |
Vector3 |
getWorldPosition(Vector3 optionalTarget) |
Quaternion |
getWorldQuaternion(Quaternion optionalTarget) |
Quaternion |
getWorldQuaternion(Vector3 optionalTarget) |
Euler |
getWorldRotation() |
Euler |
getWorldRotation(Euler optionalTarget) |
Vector3 |
getWorldScale() |
Vector3 |
getWorldScale(Vector3 optionalTarget) |
boolean |
isCastShadow()
If set to true light will cast dynamic shadows.
|
boolean |
isFrustumCulled()
When this is set, it checks every frame if the object is in the frustum of the camera.
|
boolean |
isMatrixAutoUpdate()
When this is set, it calculates the matrix of position, (rotation or quaternion) and scale every
frame and also recalculates the matrixWorld property. default – true
|
boolean |
isMatrixWorldNeedsUpdate()
When this is set, it calculates the matrixWorld in that frame and resets this property to false. default – false
|
boolean |
isReceiveShadow()
Material gets baked in shadow receiving. default – false
|
boolean |
isRotationAutoUpdate()
When this is set, then the rotationMatrix gets calculated every frame. default – true
|
boolean |
isVisible()
Object gets rendered if true. default – true
|
Vector3 |
localToWorld(Vector3 vector) |
void |
lookAt(Vector3 vector)
Rotates object to face point in space.
|
void |
remove(java.util.List<? extends Object3D> objects) |
void |
remove(Object3D object)
Removes object as child of this object.
|
Object3D |
rotateOnAxis(Vector3 axis,
double angle)
Rotate an object along an axis in object space.
|
Object3D |
rotateX(double angle) |
Object3D |
rotateY(double angle) |
Object3D |
rotateZ(double angle) |
void |
setCastShadow(boolean isCastShadow) |
void |
setChildren(java.util.Collection<? extends Object3D> children) |
void |
setFrustumCulled(boolean isFrustumCulled) |
void |
setHandler(Object3D.ObjectHandler handler) |
void |
setMatrix(Matrix4 matrix) |
void |
setMatrixAutoUpdate(boolean autoUpdate) |
void |
setMatrixWorld(Matrix4 matrixWorld) |
void |
setMatrixWorldNeedsUpdate(boolean needsUpdate) |
void |
setName(java.lang.String name) |
void |
setParent(Object3D parent) |
void |
setPosition(Vector3 position) |
void |
setQuaternion(Quaternion quaternion) |
void |
setReceiveShadow(boolean isReceiveShadow) |
void |
setRenderDepth(double renderDepth) |
void |
setRotation(Euler rotation) |
void |
setRotationAutoUpdate(boolean rotationAutoUpdate) |
void |
setRotationFromAxisAngle(Vector3 axis,
double angle) |
void |
setRotationFromEuler(Euler euler) |
void |
setRotationFromMatrix(Matrix4 m) |
void |
setRotationFromQuaternion(Quaternion q) |
void |
setScale(Vector3 scale) |
void |
setUp(Vector3 up) |
void |
setVisible(boolean visible) |
java.lang.String |
toString() |
Object3D |
translateOnAxis(Vector3 axis,
double distance)
Translate an object by distance along an axis in object space.
|
Object3D |
translateX(double distance)
Translates object along x axis by distance.
|
Object3D |
translateY(double distance)
Translates object along y axis by distance.
|
Object3D |
translateZ(double distance)
Translates object along z axis by distance.
|
void |
traverse(Object3D.Traverse traverse)
Executes the callback on this object and all descendants
|
void |
traverseVisible(Object3D.Traverse traverse)
Like
traverse(Traverse) , but the Object3D.Traverse will only be executed for visible objects. |
void |
updateMatrix()
Updates local transform.
|
void |
updateMatrixWorld(boolean force)
Updates global transform of the object and its children.
|
Vector3 |
worldToLocal(Vector3 vector)
Updates the vector from world space to local space.
|
public static final Vector3 DefaultUp
public Matrix3 _normalMatrix
public Matrix4 _modelViewMatrix
public boolean __webglActive
public boolean __webglInit
public void setHandler(Object3D.ObjectHandler handler)
public int getId()
public Object3D getParent()
public void setParent(Object3D parent)
public java.util.List<Object3D> getChildren()
public void setChildren(java.util.Collection<? extends Object3D> children)
public java.util.List<? extends Object3D> getChildrenByClass(java.lang.Class<?> clazz, boolean recursive)
public Vector3 getPosition()
public void setPosition(Vector3 position)
public void setRotation(Euler rotation)
public boolean isCastShadow()
Default � false.
public void setCastShadow(boolean isCastShadow)
public boolean isReceiveShadow()
public void setReceiveShadow(boolean isReceiveShadow)
public boolean isFrustumCulled()
public void setFrustumCulled(boolean isFrustumCulled)
public void setRotationAutoUpdate(boolean rotationAutoUpdate)
public boolean isRotationAutoUpdate()
public void setName(java.lang.String name)
public java.lang.String getName()
public Vector3 getScale()
public void setScale(Vector3 scale)
public double getRenderDepth()
public void setRenderDepth(double renderDepth)
renderDepth
- the renderDepth to setpublic Vector3 getUp()
public void setUp(Vector3 up)
public Matrix4 getMatrix()
public void setMatrix(Matrix4 matrix)
public Matrix4 getMatrixWorld()
public void setMatrixWorld(Matrix4 matrixWorld)
public boolean isMatrixWorldNeedsUpdate()
public void setMatrixWorldNeedsUpdate(boolean needsUpdate)
public boolean isMatrixAutoUpdate()
public void setMatrixAutoUpdate(boolean autoUpdate)
public Quaternion getQuaternion()
Quaternion
.public void setQuaternion(Quaternion quaternion)
public boolean isVisible()
public void setVisible(boolean visible)
public void applyMatrix(Matrix4 matrix)
matrix
- public void setRotationFromAxisAngle(Vector3 axis, double angle)
public void setRotationFromEuler(Euler euler)
public void setRotationFromMatrix(Matrix4 m)
public void setRotationFromQuaternion(Quaternion q)
public Object3D rotateOnAxis(Vector3 axis, double angle)
axis
- A normalized vector in object space.angle
- The angle in radians.public Object3D rotateX(double angle)
public Object3D rotateY(double angle)
public Object3D rotateZ(double angle)
public Object3D translateOnAxis(Vector3 axis, double distance)
axis
- A normalized vector in object space.distance
- The distance to translate.public Object3D translateX(double distance)
distance
- public Object3D translateY(double distance)
distance
- public Object3D translateZ(double distance)
distance
- public Vector3 worldToLocal(Vector3 vector)
vector
- A world vector.public void lookAt(Vector3 vector)
vector
- A world vector to look at.public Object3D add(Object3D object)
object
- An objectpublic void remove(java.util.List<? extends Object3D> objects)
public void remove(Object3D object)
object
- An object.public Object3D getObjectById(int id, boolean recursive)
id
- Unique number of the object instancerecursive
- Boolean whether to search through the children's children.public Object3D getObjectByName(java.lang.String name, boolean recursive)
name
- String to match to the children's Object3d.name property.recursive
- Boolean whether to search through the children's children.public Vector3 getWorldPosition()
public Quaternion getWorldQuaternion(Vector3 optionalTarget)
public Quaternion getWorldQuaternion(Quaternion optionalTarget)
public Euler getWorldRotation()
public Vector3 getWorldScale()
public Vector3 getWorldDirection()
public void traverse(Object3D.Traverse traverse)
traverse
- A Object3D.Traverse
interface with as first argument an object3D object.public void traverseVisible(Object3D.Traverse traverse)
traverse(Traverse)
, but the Object3D.Traverse
will only be executed for visible objects. Descendants of invisible objects are not traversed.traverse
- A Object3D.Traverse
interface with as first argument an object3D object.public void updateMatrix()
public void updateMatrixWorld(boolean force)
force
- public Object3D clone()
clone
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object