- Dw
- INFO
- EasyCam
- setCanvas
- getCanvas
- attachMouseListeners
- removeMouseListeners
- dispose
- getAutoUpdate
- setAutoUpdate
- update
- apply
- setViewport
- getViewport
- mouseWheelZoom
- mouseDragZoom
- mouseDragPan
- mouseDragRotate
- getZoomMult
- getPanMult
- getRotationMult
- zoom
- panX
- panY
- pan
- rotateX
- rotateY
- rotateZ
- rotate
- setInterpolatedDistance
- setInterpolatedCenter
- setInterpolatedRotation
- setDistanceMin
- setDistanceMax
- setDistance
- getDistance
- setCenter
- getCenter
- setRotation
- getRotation
- getPosition
- getUpVector
- getState
- setState
- pushResetState
- reset
- setRotationScale
- setPanScale
- setZoomScale
- setWheelScale
- getRotationScale
- getPanScale
- getZoomScale
- getWheelScale
- setDamping
- setDefaultInterpolationTime
- setRotationConstraint
- beginHUD
- endHUD
- INFO
- damped-callback
- DampedAction
- interpolation-callback
- Interpolation
- Rotation
- Scalar
- Vec3
EasyCam Library Info
name
version
author
source
EasyCam
new Dw.EasyCam(p5.RendererGL, { distance : z // scalar center : [x, y, z] // vector rotation : [q0, q1, q2, q3] // quaternion viewport : [x, y, w, h] // array }
Parameters
renderer
p5.RendererGL p5 WEBGL rendererargs
Object {distance, center, rotation, viewport} // * @memberof Dw
sets the WEBGL renderer the camera is working on
Parameters
renderer
RendererGL ... p5 WEBGL renderer
Returns RendererGL the currently used renderer
attaches input-listeners (mouse, touch, key) to the used renderer
Parameters
renderer
detaches all attached input-listeners
Disposes/releases the camera.
Returns boolean the current autoUpdate state
If true, the EasyCam will update automatically in a pre-draw step. This updates the camera state and updates the renderers modelview/camera matrix.
If false, the update() needs to be called manually.
Parameters
status
the
boolean new autoUpdate state
Updates the camera state (interpolated / damped animations) and updates the renderers' modelview/camera matrix.
if "auto_update" is true, this is called automatically in a pre-draw call.
Applies the current camera state to the renderers' modelview/camera matrix. If no argument is given, then the cameras currently set renderer is used.
Parameters
renderer
Parameters
viewport
the
Array<int> new viewport-def, as [x,y,w,h]
Returns Array<int> the current viewport-def, as [x,y,w,h]
implemented zoom-cb for mouswheel handler.
implemented zoom-cb for mousedrag/touch handler.
implemented pan-cb for mousedrag/touch handler.
implemented rotate-cb for mousedrag/touch handler.
(private) returns the used zoom -multiplier for damped actions.
(private) returns the used pan-multiplier for damped actions.
(private) returns the used rotate-multiplier for damped actions.
Applies a change to the current zoom.
Parameters
dz
Applies a change to the current pan-xValue.
Parameters
dx
Applies a change to the current pan-yValue.
Parameters
dy
Applies a change to the current pan-value.
Parameters
dx
dy
Applies a change to the current xRotation.
Parameters
rx
Applies a change to the current yRotation.
Parameters
ry
Applies a change to the current zRotation.
Parameters
rz
Applies a change to the current rotation, using the given axis/angle.
Parameters
axis
angle
Sets the new camera-distance, interpolated (t) between given A and B.
Parameters
valA
valB
t
Sets the new camera-center, interpolated (t) between given A and B.
Parameters
valA
valB
t
Sets the new camera-rotation, interpolated (t) between given A and B.
Parameters
valA
valB
t
Sets the minimum camera distance.
Parameters
distance_min
Sets the maximum camera distance.
Parameters
distance_max
Sets the new camera distance.
Parameters
distance
duration
new
double distance.animation
long time in millis.
Returns double the current camera distance.
Sets the new camera center.
Parameters
center
duration
new
Array<double> center.animation
long time in millis.
Returns Array<double> the current camera center.
Sets the new camera rotation (quaternion).
Parameters
rotation
duration
new
Array<double> rotation as quat[q0,q1,q2,q3].animation
long time in millis.
Returns Array<double> the current camera rotation as quat[q0,q1,q2,q3].
Parameters
dst
Returns Array<double> the current camera position, aka. the eye position.
Parameters
dst
Returns Array<double> the current camera up vector.
Returns Object a copy of the camera state {distance,center,rotation}
Parameters
other
duration
a
Object new camera state {distance,center,rotation}.animation
long time in millis.
sets the current state as reset-state.
resets the camera, by applying the reset-state.
Parameters
duration
sets the rotation scale/speed.
Parameters
scale_rotation
sets the pan scale/speed.
Parameters
scale_pan
sets the zoom scale/speed.
Parameters
scale_zoom
sets the wheel scale/speed.
Parameters
wheelScale
Returns any the rotation scale/speed.
Returns any the pan scale/speed.
Returns any the zoom scale/speed.
Returns any the wheel scale/speed.
sets the default damping scale/speed.
Parameters
damping
sets the default interpolation time in millis.
Parameters
duration
sets the rotation constraint for each axis separately.
Parameters
begin screen-aligned 2D-drawing.
beginHUD() disabled depth test ortho ... your code is executed here ... endHUD()
Parameters
renderer
w
h
end screen-aligned 2D-drawing.
Parameters
renderer
Damped callback, that accepts the resulting damped/smooth value.
Type: Function
Parameters
value
double the damped/smoothed value
DampedAction, for smoothly changing a value to zero.
Parameters
cb
damped-callback callback that accepts the damped value as argument.
adds a value to the current value beeing damped.
Parameters
force
double the value beeing added.
updates the damping and calls damped-callback.
stops the damping.
Interpolation callback, that implements any form of interpolation between two values A and B and the interpolationparameter t.
linear: A * (1-t) + B * t smooth, etc...
Type: Function
Parameters
Interpolation, for smoothly changing a value by interpolating it over time.
Parameters
cb
interpolation-callback callback for interpolating between two values.
starts the interpolation. If the given interpolation-duration is 0, then interpolation-callback is called immediately.
Parameters
valA
valB
duration
actions
updates the interpolation and calls interpolation-callback.
stops the interpolation.
Rotation as Quaternion [q0, q1, q2, q3]
Note: Only functions that were required for the EasyCam to work are implemented.
Returns Array<Number> an identity rotation [1,0,0,0]
Applies the rotation to a vector and returns dst or a new vector.
Parameters
rot
Array<Number> Rotation (Quaternion)vec
Array<Number> vector to be rotated by rotdst
Array<Number> resulting vector
Returns Array<Number> dst- resulting vector
Applies the rotation to another rotation and returns dst or a new rotation.
Parameters
rotA
Array<Number> RotationA (Quaternion)rotB
Array<Number> RotationB (Quaternion)dst
Array<Number> resulting rotation
Returns Array<Number> dst - resulting rotation
Interpolates a rotation.
Parameters
rotA
Array<Number> RotationA (Quaternion)rotB
Array<Number> RotationB (Quaternion)t
Number interpolation parameterdst
Array<Number> resulting rotation
Returns Array<Number> dst - resulting rotation
Creates/Initiates a new Rotation
1) Axis,Angle: { axis : [x, y, z], angle: double } 2) Another Rotation: { rotation : [q0, q1, q2, q3], normalize: boolean } 3) 3 euler angles, XYZ-order: { angles_xyz : [rX, rY, rZ] }
Parameters
Returns Array<Number> dst - resulting rotation
Scalar as a simple number.
Note: Only functions that were required for the EasyCam to work are implemented.
Linear interpolation between A and B using t[0,1]
Parameters
a
b
t
modifying t as a function of smoothstep(0,1,t);
Parameters
x
modifying t as a function of smootherstep(0,1,t);
Parameters
t
Vec3 as a 3D vector (Array)
addition:
dst = a + b
Parameters
a
b
dst
componentwise multiplication:
dst = a * b
Parameters
a
b
dst
squared length
Parameters
a
length
Parameters
a
dot-product
Parameters
a
b
cross-product
Parameters
a
b
dst
angle
Parameters
v1
v2
linear interpolation:
dst = a _ (1 - t) + b _ t
Parameters
a
b
t
dst