Add a 3D scene.
Camera Molecule | |
Preference Dialog | |
Properties | |
type | string, ( r ) |
pref.name | string, ( r ) |
pref. | string, ( r, w ) |
pref. | string, ( r, w ) |
pref. | string, ( r, w ) |
pref. | string, ( r, w ) |
pref.x | float, ( r, w ) |
pref.y | float, ( r, w ) |
pref.z | float, ( r, w ) |
pref.ax | float, ( r, w ) |
pref.ay | float, ( r, w ) |
pref.az | float, ( r, w ) |
pref.dx | float, ( r, w ) |
pref.dy | float, ( r, w ) |
pref.dz | float, ( r, w ) |
pref.near | float, ( r, w ) |
pref.far | float, ( r, w ) |
pref.br | int [0, 255], ( r, w ) |
pref.bg | int [0, 255], ( r, w ) |
pref.bb | int [0, 255], ( r, w ) |
pref.ambr | int [0, 255], ( r, w ) |
pref.ambg | int [0, 255], ( r, w ) |
pref.ambb | int [0, 255], ( r, w ) |
pref.fX | float, ( r, w ) |
pref.fY | float, ( r, w ) |
pref.fZ | float, ( r, w ) |
pref.fW | float, ( r, w ) |
pref.mode | string, ( r, w ) |
pref.auto | bool, ( r, w ) |
pref. | float, ( r, w ) |
pref.fovy | int, ( r, w ) |
pref. | bool, ( r, w ) |
pref. | bool, ( r, w ) |
position | object, ( r, w ) |
rotation | object, ( r, w ) |
worldPosition | object, ( r ) |
worldRotation | object, ( r ) |
zoom | float, ( r, w ) |
up | object, ( r ) |
right | object, ( r ) |
scene | object, ( r ) |
renderer | object, ( r ) |
camera | object, ( r ) |
projector | object, ( r ) |
depthBuffer | object, ( r ) |
target | object/string, ( r, w ) |
orthographic | bool, ( r, w ) |
paused | bool, ( r ) |
Functions | |
attach | |
detach | |
delete | |
rename | |
clone | |
serialize | |
render | |
createRenderTarget | |
createDataTexture | |
rayCastSelect | |
rayCastPoint | |
rayCastDetect | |
translate | |
roll | |
pitch | |
yaw | |
rotate | |
getScreenCoords | |
projectOnScreen | |
enableAutoTracking | |
disableAutoTracking | |
listen | |
pause | |
resume | |
attachTo | |
detachFrom | |
createJoint |
string, ( r )
The scriptable name for this molecule. This name can be set using rename function dynamically.
int, ( r, w )
Sets the Y-dimension Field Of View (FOV) of the frustum in degree. Field Of View (FOV) is the angle made between the frustum’s position, and the edges of the ‘screen’ onto which the scene is projected. High values (90+ degrees) result in a wide-angle, fish-eye kind of view, low values (30- degrees) in a stretched, telescopic kind of view. Typical values are between 45 and 60 degrees. This value represents the VERTICAL field-of-view. The horizontal field of view is calculated from this depending on the dimensions of the viewport (they will only be the same if the viewport is square). Default to 45 degree.
render(renderTarget, scene, camera, forceClear);
Render this camera’s scene into the given render target.
renderTarget | (object) a valid render target. |
scene | (object) scene to be rendered. |
camera | (object) camera’s view. |
forceClear | (bool) clear buffer content before render. Default to false. |
N/A
createRenderTarget(name, width, height, format);
Create a render target with the given name, dimension, and formats and store it in an internal array.
name | (string) render target name. |
width | (number) width in pixels. Default to droplet width. |
height | (number) height in pixels. Default to droplet height. |
format | (object) optional render target formats. |
(object) the newly created render target which is set active immediately and is accessible by this molecule’s target property.
createDataTexture(data, width, height, format, type);
Create a data texture from the given initial data arrayBufferView, dimension, format, and type.
data | (arrayBufferView) initial data array. |
width | (number) width in pixels. |
height | (number) height in pixels. |
format | (number) The default is THREE.RGBAFormat for the texture. Other formats are: THREE.AlphaFormat, THREE.RGBFormat, THREE.LuminanceFormat, and THREE.LuminanceAlphaFormat. |
type | (number) the data type. The default is THREE.FloatType. Other types are: THREE.ByteType, THREE.ShortType, THREE.UnsignedShortType, THREE.IntType, THREE.UnsignedIntType, THREE.UnsignedByteType, THREE.UnsignedShort4444Type, THREE.UnsignedShort5551Type, and THREE.UnsignedShort565Type. |
(object) a newly created texture.
rayCastSelect(x, y);
Given a 2D point (x, y) in the droplet, this function returns an array of objects each containing the following information,
id | (string) an internal identifier of the molecule that intersects this ray. |
name | (string) the name of the intersecting molecule. |
molecule | (object) the molecule itself. |
point | (object) the intersecting point. |
distance | (float) the distance of intersect to the camera. |
face | (object) the mesh’s face at the intersect. |
The array is sorted by distance from near to far.
x | (int) x-coordinate relative to the top left corner of a droplet. |
y | (int) y-coordinate relative to the top left corner of a droplet. |
(array) an array of objects containing intersects’ information.
rayCastPoint(x, y, d);
Given a 2D point (x, y) within the droplet and a distance d into the 3D scene, this function returns the location in the 3D scene.
x | (int) x-coordinate relative to the top left corner of a droplet. |
y | (int) y-coordinate relative to the top left corner of a droplet. |
d | (float) distance into the scene. |
(object) Vector3 of the point location.
rayCastDetect(origin, direction, near, far);
This function creates a ray at the origin with given direction and returns an array of intersects between the two given distances, near and far. Each intersect in the array contains the following information,
id | (string) an internal identifier of the molecule that intersects this ray. |
name | (string) the name of the intersecting molecule. |
molecule | (object) the molecule itself. |
point | (object) the intersecting point. |
distance | (float) the distance of intersect to the camera. |
face | (object) the mesh’s face at the intersect. |
The array is sorted by distance from near to far.
origin | (Vector3) the ray origin. |
direction | (Vector3) the ray direction. |
near | (float) the near distance to begin detection. Default to 0. |
far | (float) the far distance to end detection. Default to Infinity. |
(array) an array of objects containing intersects’ information.
getScreenCoords(entity, pos);
Returns the entity’s position on screen relative to the top left corner of a droplet. The pos option specifies which part of the entity is being queried.
entity | (object) a mesh, light, manualobject, or particle molecule. |
pos | (string) center, min, or max. |
(object) a Vector2 in pixels.
createJoint(type, entity1, entity2, pos, axis);
Create a joint between 2 entities in the scene. The joint can be any one of the 5 types (point, hinge, slider, conetwist, dof).
point | This joint allows objects to be bound to a certain point in the scene (if entity2 is omitted), and can be used to constrain two objects together at a point between them. The axis parameter is not applicable for this joint type. |
hinge | The hinge joint limits the movement of an object to act as if it were on a hinge, such as a door. Like the point joint, the hinge can be created with either 1 or 2 entities. The axis is the direction along which the hinge lies. |
slider | The slider joint will constrain the linear movement of an object to align with the given axis. Examples are a sliding door or the lifting mechanism on a fork lift. Like the point and hinge joints, the second entity is an optional parameter. |
conetwist | The cone twist joint limits the movement and rotation between two entities in a manner similar to human joints like the shoulder or ankle. In this joint type, both entities are required. The axis parameter is not applicable for this joint type. |
dof | The degree of freedom joint yields full control over how the entities should be constrained both in linear and angular movement. |
type | (const) JOINT_POINT, JOINT_HINGE, JOINT_SLIDER, JOINT_CONETWIST, or JOINT_DOF; |
entity1 | (object) a mesh or manualobject molecule. |
entity2 | (object) a mesh or manualobject molecule. |
pos | (object) a Vector3. |
axis | (object) a Vector3. |
(object) a Joint3D object.