View on GitHub

3DreamEngine

3DreamEngine is an *awesome* 3d engine for LÖVE.

Camera

Extends Transformable

Contains transformation and lens information used to render the scene

Constructors

Camera:newCamera(transform, transformProj, position, normal)

Creates a new camera

Arguments

transform (Mat4)

transformProj (Mat4)

position (Vec3)

normal (Vec3)

Returns

(Camera)


Methods

Camera:setFov(fov)

Set FOV

Arguments

fov (number) vertical field of view in degrees


Camera:getFov()

Returns

(number)


Camera:setNear(near)

Set near plane

Arguments

near (number)


Camera:getNear()

Returns

(number)


Camera:setFar(far)

Set far plane

Arguments

far (number)


Camera:getFar()

Returns

(number)


Camera:setSize(size)

Sets the horizontal orthographic viewport size

Arguments

size (number)


Camera:getSize()

Returns

(number)


Camera:setOrthographic(orthographic)

Sets projection transform to orthographic, does not work with sky-boxes

Arguments

orthographic (boolean)


Camera:isOrthographic()

Returns

(boolean)


Camera:getNormal()

Returns

(Vec3)


Camera:getPosition()

Returns

(Vec3)


Camera:inFrustum(pos, radius, id)

Checks if the giving sphere is in the cameras frustum

Arguments

pos (Vec3)

radius (number)

id (any)


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)