Class Entity

Represents a node in the scene graph.

class Entity
  : dlib.core.ownership.Owner
  , Updateable;

Constructors

NameDescription
this (owner) Constructs an entity and adds it to the world if provided.

Fields

NameTypeDescription
absoluteTransformation dlib.math.matrix.Matrix!(float,4L)Final transformation matrix relative to world root.
autoUpdateTransformation bool
bindShaderParameters boolIf true, shader parameters will be bound automatically in the RenderPass before rendering the entity. Otherwise the derived render pass should bind shader parameters.
blurMask floatMotion blur mask value. This value is treated as an alpha channel when rendering the entity to the screen-space velocity buffer.
boundingBoxSize dlib.math.vector.Vector!(float,3)The size of the entity's bounding box.
castShadow boolIf true, the entity casts shadows.
children dlib.container.array.Array!(dagon.graphics.entity.Entity,32L)List of child entities.
components dlib.container.array.Array!(dagon.graphics.entity.EntityComponent,32L)The attached components.
decal boolIf true, the entity is treated as a decal.
drawable DrawableOptional drawable object (visual representation) for this entity.
dynamic boolIndicates whether the entity can move.
gbufferMask floatG-buffer mask value for deferred rendering. This value is treated as an alpha channel when rendering the entity to the G-buffer.
invAbsoluteTransformation dlib.math.matrix.Matrix!(float,4L)Inverse of the absolute transformation matrix.
invTransformation dlib.math.matrix.Matrix!(float,4L)Inverse of the local transformation matrix.
layer EntityLayerThe logical layer of this entity.
material MaterialOptional material used for rendering.
opacity floatOpacity factor for rendering (0.0 = fully transparent, 1.0 = fully opaque).
parent EntityOptional parent entity in the scene graph.
pose PoseOptional pose (for skinning).
position dlib.math.vector.Vector!(float,3)Local position.
prevAbsoluteTransformation dlib.math.matrix.Matrix!(float,4L)Previous frame's absolute transformation.
prevTransformation dlib.math.matrix.Matrix!(float,4L)Previous frame's local transformation (for motion blur).
probe boolIf true, the entity is treated as an environment probe volume (for lighting/reflections).
probeExtents dlib.math.vector.Vector!(float,3)The extents of the probe volume.
probeFalloffMargin floatThe falloff margin for the probe.
probeUseBoxProjection boolIf true, enable box projection for the probe volume
renderLayer intThe render layer index for sorting or batching.
rotation dlib.math.quaternion.Quaternion!(float)Local rotation (quaternion).
scaling dlib.math.vector.Vector!(float,3)Local scaling.
solid boolWhether the entity should be treated as a solid object (for physics/collision).
transformation dlib.math.matrix.Matrix!(float,4L)Local transformation matrix.
transformMode TransformModeTransformation mode (TRS or Matrix).
transparent boolIf true, the entity is treated as transparent.
tweens dlib.container.array.Array!(dagon.graphics.tween.Tween,32L)Pool of tweens used to animate this entity.
type EntityTypeThe type of this entity.
visible boolIf false, the entity is not rendered.
world WorldThe world this entity belongs to.
aabb dlib.geometry.aabb.AABBThe axis-aligned bounding box.

Properties

NameTypeDescription
boundingBox[get] dlib.geometry.aabb.AABBReturns the entity's bounding box in world space.
direction[get] dlib.math.vector.Vector!(float,3)Returns the local forward vector.
directionAbsolute[get] dlib.math.vector.Vector!(float,3)Returns the absolute forward vector.
right[get] dlib.math.vector.Vector!(float,3)Returns the local right vector.
rightAbsolute[get] dlib.math.vector.Vector!(float,3)Returns the absolute right vector.
shader[get] ShaderReturns the shader of entity's material, if available. Otherwise returns null.
up[get] dlib.math.vector.Vector!(float,3)Returns the local up vector.
upAbsolute[get] dlib.math.vector.Vector!(float,3)Returns the absolute up vector.

Methods

NameDescription
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.Matrix, 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.