Class Entity
Represents a node in the scene graph.
Constructors
| Name | Description |
|---|---|
this
(owner)
|
Constructs an entity and adds it to the world if provided. |
Fields
| Name | Type | Description |
|---|---|---|
absoluteTransformation
|
dlib | Final transformation matrix relative to world root. |
autoUpdateTransformation
|
bool | |
bindShaderParameters
|
bool | If true, shader parameters will be bound automatically
in the RenderPass before rendering the entity.
Otherwise the derived render pass should bind shader
parameters.
|
blurMask
|
float | Motion blur mask value. This value is treated as an alpha channel when rendering the entity to the screen-space velocity buffer. |
boundingBoxSize
|
dlib | The size of the entity's bounding box. |
castShadow
|
bool | If true, the entity casts shadows. |
children
|
dlib | List of child entities. |
components
|
dlib | The attached components. |
decal
|
bool | If true, the entity is treated as a decal. |
drawable
|
Drawable | Optional drawable object (visual representation) for this entity. |
dynamic
|
bool | Indicates whether the entity can move. |
gbufferMask
|
float | G-buffer mask value for deferred rendering. This value is treated as an alpha channel when rendering the entity to the G-buffer. |
invAbsoluteTransformation
|
dlib | Inverse of the absolute transformation matrix. |
invTransformation
|
dlib | Inverse of the local transformation matrix. |
layer
|
EntityLayer | The logical layer of this entity. |
material
|
Material | Optional material used for rendering. |
opacity
|
float | Opacity factor for rendering (0.0 = fully transparent, 1.0 = fully opaque). |
parent
|
Entity | Optional parent entity in the scene graph. |
pose
|
Pose | Optional pose (for skinning). |
position
|
dlib | Local position. |
prevAbsoluteTransformation
|
dlib | Previous frame's absolute transformation. |
prevTransformation
|
dlib | Previous frame's local transformation (for motion blur). |
probe
|
bool | If true, the entity is treated as an environment probe volume (for lighting/reflections). |
probeExtents
|
dlib | The extents of the probe volume. |
probeFalloffMargin
|
float | The falloff margin for the probe. |
probeUseBoxProjection
|
bool | If true, enable box projection for the probe volume |
renderLayer
|
int | The render layer index for sorting or batching. |
rotation
|
dlib | Local rotation (quaternion). |
scaling
|
dlib | Local scaling. |
solid
|
bool | Whether the entity should be treated as a solid object (for physics/collision). |
transformation
|
dlib | Local transformation matrix. |
transformMode
|
TransformMode | Transformation mode (TRS or Matrix). |
transparent
|
bool | If true, the entity is treated as transparent. |
tweens
|
dlib | Pool of tweens used to animate this entity. |
type
|
EntityType | The type of this entity. |
visible
|
bool | If false, the entity is not rendered. |
world
|
World | The world this entity belongs to. |
aabb
|
dlib | The axis-aligned bounding box. |
Properties
| Name | Type | Description |
|---|---|---|
boundingBox[get]
|
dlib | Returns the entity's bounding box in world space. |
direction[get]
|
dlib | Returns the local forward vector. |
directionAbsolute[get]
|
dlib | Returns the absolute forward vector. |
right[get]
|
dlib | Returns the local right vector. |
rightAbsolute[get]
|
dlib | Returns the absolute right vector. |
shader[get]
|
Shader | Returns the shader of entity's material, if available. Otherwise returns null. |
up[get]
|
dlib | Returns the local up vector. |
upAbsolute[get]
|
dlib | Returns the absolute up vector. |
Methods
| Name | Description |
|---|---|
addChild
(childEntity)
|
Adds a child entity. |
addComponent
(component)
|
Adds a component to this entity. |
angles
(v)
|
Sets the rotation using Euler angles (degrees). |
fadeIn
(duration, easing)
|
Starts a "fade-in" opacity tween (from 0 to 1) |
fadeOut
(duration, easing)
|
Starts a "fade-out" opacity tween (from 1 to 0) |
getInactiveTween
()
|
Returns a pointer to an inactive tween from the tweens pool, or null if none. |
getTween
()
|
Returns a pointer to an inactive tween, adding a new one to the tweens pool if necessary. |
hide
()
|
Makes the entity and, recursively, all of its children invisible. |
lift
(speed)
|
Lifts (moves up) by the given speed. |
move
(speed)
|
Moves the entity forward by the given speed. |
moveFromTo
(pointFrom, pointTo, duration, easing)
|
Starts a position tween from one point to another. |
moveToPoint
(p, speed)
|
Moves the entity toward a point at the given speed. |
opacityFromTo
(opFrom, opTo, duration, easing)
|
Starts an opacity tween. |
pitch
(angle)
|
Rotates the entity around the local X axis. |
positionAbsolute
()
|
Returns the absolute position of the entity. |
processEvents
()
|
Processes events for all attached components. |
release
()
|
Releases all resources and detaches from parent and children. |
removeChild
(childEntity)
|
Removes a child entity. |
removeComponent
(component)
|
Removes a component from this entity. |
roll
(angle)
|
Rotates the entity around the local Z axis. |
rotate
(v)
|
Rotates the entity by the given Euler angles (degrees). |
rotateFromTo
(anglesFrom, anglesTo, duration, easing)
|
Starts a rotation tween from one set of angles to another. |
rotationAbsolute
()
|
Returns the absolute rotation of the entity. |
scale
(s)
|
Scales the entity uniformly. |
scale
(s)
|
Scales the entity non-uniformly by the given vector. |
scaleFromTo
(sFrom, sTo, duration, easing)
|
Starts a scaling tween from one scale to another. |
scaleX
(s)
|
Scales the entity along the local X axis. |
scaleY
(s)
|
Scales the entity along the local Y axis. |
scaleZ
(s)
|
Scales the entity along the Z axis. |
scalingAbsolute
()
|
Returns the absolute scaling vector. |
setParent
(parentEntity)
|
Sets the parent entity in the scene graph. |
setRotation
(x, y, z)
|
Sets the rotation using Euler angles (degrees). |
show
()
|
Makes the entity and, recursively, all of its children visible. |
strafe
(speed)
|
Strafes (moves to the right) by the given speed. |
teleport
(pos)
|
Instantly change entity position. This method resets previous transformation to prevent blinking with motion blur enabled. |
translate
(v)
|
Translates the entity by the given vector. |
translate
(vx, vy, vz)
|
Translates the entity by the given vector components. |
turn
(angle)
|
Rotates the entity around the local Y axis. |
update
(t)
|
Updates the entity and its components for the current frame. |
updateAbsoluteTransformation
()
|
Updates the absolute transformation matrix. |
updateTransformation
()
|
Updates the local and absolute transformation matrices.
If transformMode is TransformMode,
the transformation matrix should be updated manually when needed
|
updateTransformationBottomUp
()
|
Updates transformations bottom-up through the hierarchy (from child to parent). |
updateTransformationTopDown
()
|
Updates transformations top-down through the hierarchy (from parent to children). |
Description
Entities are spatially transformable objects that may have children,
components, and a visual representation (via Drawable). They can be
dynamic or static, cast shadows, and interact with the rendering system
through various flags and material parameters.
Entity is a basic building block for a scene.
Entities form a hierarchical structure and are updated each frame
as part of the world update cycle.