Object
Extends Clonable, Transformable, HasShaders, IsNamed
Constructors
Object:newObject()
Create an empty object
Returns
(Object)
Object:loadLibrary(path, args, prefix)
Loads and adds that object as a library, see https://3dreamengine.github.io/3DreamEngine/docu/introduction
Arguments
path
(any)
args
(any)
prefix
(any)
Object:loadObject(path, args)
Load an object
Arguments
path
(string) Path to object without extension
args
(table)
Fields
objects
(Object[])
meshes
(Mesh[])
positions
(Position[])
lights
(Light[])
collisionMeshes
(CollisionMesh[])
raytraceMeshes
(RaytraceMesh[])
reflections
(Reflection[])
animations
(Animation[])
Methods
Object:newInstance()
Object:clone()
Object:instance()
Creates an recursive instance, objects can now be transformed individually, all other changes remain synced
Returns
(Object)
Object:getMainSkeleton()
The main skeleton is usually the one used by all meshes, but may be nil or unused
Returns
(Skeleton)
Object:setLOD(min, max)
Range in which this object should be rendered
Arguments
min
(number)
max
(number)
Object:getLOD()
Object:updateBoundingSphere()
Object:clearMeshes()
Object:cleanup()
Object:preload(force)
Arguments
force
(any)
Object:meshesToCollisionMeshes()
Converts all meshes to physics meshes
Object:getAllMeshes()
Get all pairs of (DreamMesh, mat4 transform), recursively, as a flat array
Object:merge()
Merge all meshes, recursively, of an object
Object:applyTransform()
Apply the current transformation to the meshes
Object:applyBones(skeleton)
Apply joints to mesh data directly
Arguments
skeleton
(Skeleton) optional
Object:createMeshes()
Create all render-able meshes
Object:setVisible(visibility)
Arguments
visibility
(boolean)
Object:setRenderVisibility(visibility)
Arguments
visibility
(boolean)
Object:setShadowVisibility(visibility)
Arguments
visibility
(boolean)
Object:setFarVisibility(visibility)
Set whether the outer layers of the sun cascade shadow should render this object
Arguments
visibility
(boolean)
Object:setMaterial(material)
A object has no material, therefore this call will forward this to all Meshes
Arguments
material
(Material)
Object:print()
Print a detailed summary of this object
Object:export3do()
deprecated
Exports this object in the custom, compact and fast 3DO format
Clonable:clone()
Slow and deep clone
Clonable:instance()
Creates an fast instance
Transformable:resetTransform()
Resets the transform to the identify matrix
Returns
(Transformable)
Transformable:setTransform(transform)
Arguments
transform
(Mat4)
Returns
(Transformable)
Transformable:getTransform()
Gets the current, local transformation matrix
Returns
(Mat4)
Transformable:translate(x, y, z)
Translate in local coordinates
Arguments
x
(number)
y
(number)
z
(number)
Returns
(Transformable)
Transformable:scale(x, y, z)
Scale in local coordinates
Arguments
x
(number)
y
(number)
z
(number)
Returns
(Transformable)
Transformable:rotateX(rx)
Euler rotation around the X axis in local coordinates
Arguments
rx
(number)
Returns
(Transformable)
Transformable:rotateY(ry)
Euler rotation around the Y axis in local coordinates
Arguments
ry
(number)
Returns
(Transformable)
Transformable:rotateZ(rz)
Euler rotation around the Z axis in local coordinates
Arguments
rz
(number)
Returns
(Transformable)
Transformable:translateWorld(x, y, z)
Translate in world coordinates
Arguments
x
(number)
y
(number)
z
(number)
Returns
(Transformable)
Transformable:scaleWorld(x, y, z)
Scale in world coordinates
Arguments
x
(number)
y
(number)
z
(number)
Returns
(Transformable)
Transformable:rotateXWorld(rx)
Euler rotation around the X axis in world coordinates
Arguments
rx
(number)
Returns
(Transformable)
Transformable:rotateYWorld(ry)
Euler rotation around the Y axis in world coordinates
Arguments
ry
(number)
Returns
(Transformable)
Transformable:rotateZWorld(rz)
Euler rotation around the Z axis in world coordinates
Arguments
rz
(number)
Returns
(Transformable)
Transformable:getPosition()
Gets the current world position
Returns
(Vec3)
Transformable:lookAt()
Makes the object look at the target position with given up vector
Returns
(Transformable)
Transformable:setDirty()
Marks as modified
Transformable:getGlobalTransform()
Gets the last global transform. Needs to be rendered once, and if rendered multiple times, the result is undefined
Returns
(Mat4)
Transformable:lookTowards(direction, up)
Look towards the global direction and upwards vector
Arguments
direction
(Vec3)
up
(Vec3)
Transformable:getInvertedTransform()
Returns the cached inverse of the local transformation
Returns
(Mat4)
Transformable:setDynamic(dynamic)
Dynamic objects are excluded from static shadows and reflections. Applying a transforms sets this flag automatically.
Arguments
dynamic
(boolean)
Transformable:isDynamic()
Returns weather this object is excluded from statis shadows and reflections
Returns
(boolean)
HasShaders:setPixelShader(shader)
Arguments
shader
(Shader)
HasShaders:setVertexShader(shader)
Arguments
shader
(Shader)
HasShaders:setWorldShader(shader)
Arguments
shader
(Shader)
IsNamed:setName(name)
A name has no influence other than being able to print more nicely
Arguments
name
(string)
IsNamed:getName()
Gets the name, or “unnamed”
Returns
(string)