Light Molecule

Add a light source to 3D scene.  The light can be any of point, directional, spot, area, or hemi types.  Note: Only directional and spot light cast shadows.

Summary
Light Molecule
Preference Dialog
Properties
typestring, ( r )
pref.namestring, ( r )
pref.enableWhenstring, ( r, w )
pref.disableWhenstring, ( r, w )
pref.lookatstring, ( r, w )
pref.xfloat, ( r, w )
pref.yfloat, ( r, w )
pref.zfloat, ( r, w )
pref.axfloat, ( r, w )
pref.ayfloat, ( r, w )
pref.azfloat, ( r, w )
pref.dxfloat, ( r, w )
pref.dyfloat, ( r, w )
pref.dzfloat, ( r, w )
pref.rint [0, 255], ( r, w )
pref.gint [0, 255], ( r, w )
pref.bint [0, 255], ( r, w )
pref.srint [0, 255], ( r, w )
pref.sgint [0, 255], ( r, w )
pref.sbint [0, 255], ( r, w )
pref.att_rangefloat, ( r, w )
pref.att_constantfloat [0.0, 1.0], ( r, w )
pref.att_linearfloat [0.0, 1.0], ( r, w )
pref.att_quadraticfloat, ( r, w )
pref.in_angleint, ( r, w )
pref.out_angleint, ( r, w )
pref.fallofffloat, ( r, w )
pref.castShadowbool, ( r, w )
pref.gelstring, ( r, w )
pref.additivebool, ( r, w )
pref.widthint, ( r, w )
pref.heightint, ( r, w )
positionobject, ( r, w )
worldPositionobject, ( r )
rotationobject, ( r, w )
intensityfloat, ( r, w )
directionfloat, ( r )
lightobject, ( r )
Functions
attach
detach
delete
rename
show
hide
refresh
clone
serialize
setDiffuseColor
setSpecularColor
attachTo
detachFrom

Preference Dialog

Properties

type

string, ( r )

Type of this molecule, light.

pref.name

string, ( r )

The scriptable name for this molecule.  This name can be set using rename function dynamically.

pref.enableWhen

string, ( r, w )

Specifies the event that activates this molecule.  Default is load.

pref.disableWhen

string, ( r, w )

Specifies the event that deactivates this molecule.  Default is none.

pref.lookat

string, ( r, w )

Specifies the name of the mesh or manualobject molecule that this light is aiming at.

pref.x

float, ( r, w )

Specifies the x coordinate of this light’s position.

pref.y

float, ( r, w )

Specifies the y coordinate of this light’s position.

pref.z

float, ( r, w )

Specifies the z coordinate of this light’s position.

pref.ax

float, ( r, w )

Specifies the x coordinate of a point this light is aiming at.

pref.ay

float, ( r, w )

Specifies the y coordinate of a point this light is aiming at.

pref.az

float, ( r, w )

Specifies the z coordinate of a point this light is aiming at.

pref.dx

float, ( r, w )

Specifies the x direction of this light.

pref.dy

float, ( r, w )

Specifies the y direction of this light.

pref.dz

float, ( r, w )

Specifies the z direction of this light.

pref.r

int [0, 255], ( r, w )

Specifies the RED component of the diffuse color.

pref.g

int [0, 255], ( r, w )

Specifies the GREEN component of the diffuse color.

pref.b

int [0, 255], ( r, w )

Specifies the BLUE component of the diffuse color.

pref.sr

int [0, 255], ( r, w )

Specifies the RED component of the specular color.

pref.sg

int [0, 255], ( r, w )

Specifies the GREEN component of the specular color.

pref.sb

int [0, 255], ( r, w )

Specifies the BLUE component of the specular color.

pref.att_range

float, ( r, w )

Specifies the absolute upper range of the light in world units. i.e. how it diminishes with distance.  Lights normally get fainter the further they are away.  Also, each light is given a maximum range beyond which it cannot affect any objects.  Light attenuation is not applicable to directional lights since they have an infinite range and constant intensity.

pref.att_constant

float [0.0, 1.0], ( r, w )

Sets the constant factor in the attenuation formula: 1.0 means never attenuate, 0.0 is complete attenuation.

pref.att_linear

float [0.0, 1.0], ( r, w )

Sets the linear factor in the attenuation formula: 1 means attenuate evenly over the distance.

pref.att_quadratic

float, ( r, w )

Sets the quadratic factor in the attenuation formula: adds a curvature to the attenuation formula.

pref.in_angle

int, ( r, w )

Sets the angle in degrees covered by the spotlights inner cone.

pref.out_angle

int, ( r, w )

Sets the angle in degrees covered by the spotlights outer cone.

pref.falloff

float, ( r, w )

Sets the falloff between the inner and outer cones of the spotlight.

pref.castShadow

bool, ( r, w )

Sets whether or not this light will cast shadows.

pref.gel

string, ( r, w )

Sets the material name to be used in spotlight’s projective texture.

pref.additive

bool, ( r, w )

Specifies the gel’s projective texture is to be additively blended with the texture of receiving mesh.  (Instead of multiplicative blending which is the default.)

pref.width

int, ( r, w )

Specifies the width of light volume.  Shadows is calculated for objects inside spot and directional lights’ volume.

pref.height

int, ( r, w )

Specifies the height of light volume.  Shadows is calculated for objects inside spot and directional lights’ volume.

position

object, ( r, w )

Get/Set the light’s position in Vector3 format.

worldPosition

object, ( r )

Returns the light’s world position in Vector3 format.

rotation

object, ( r, w )

Get/Set the light’s rotation in Vector3 format.

intensity

float, ( r, w )

Sets the light’s intensity/luminosity.

direction

float, ( r )

Returns the direcitonal or spot light’s normalized direction.

light

object, ( r )

Returns the light’s internal light object.

Functions

attach

attach(droplet);

Attach this molecule to the given droplet.

Parameters

droplet(object) a droplet.

Returns

N/A

detach

detach();

Remove this molecule from its droplet.

Parameters

N/A

Returns

N/A

delete

delete();

Delete this molecule.

Parameters

N/A

Returns

N/A

rename

rename(name);

Rename this molecule.

Parameters

name(string) a new name.

Returns

N/A

show

show();

Shows the effects of this molecule.

Parameters

N/A

Returns

N/A

hide

hide();

Hides the effects of this molecule.

Parameters

N/A

Returns

N/A

refresh

refresh();

Forces molecule to redraw with the current set of preferences.

Parameters

N/A

Returns

N/A

clone

clone();

Create a clone of this molecule.

Parameters

N/A

Returns

(object) a molecule.

serialize

serialize();

Serialize this molecule into its JSON representation.

Parameters

N/A

Returns

(string) JSON representation of a molecule.

setDiffuseColor

setDiffuseColor(r, g, b);

Sets this light’s diffuse color.  For hemi-light, this sets the sky color.

Parameters

r(int) the RED component between 0 and 255;
g(int) the GREEN component between 0 and 255;
b(int) the BLUE component between 0 and 255;

Returns

N/A

setSpecularColor

setSpecularColor(r, g, b);

Sets this light’s specular color.  For hemi-light, this sets the ground color.

Parameters

r(int) the RED component between 0 and 255;
g(int) the GREEN component between 0 and 255;
b(int) the BLUE component between 0 and 255;

Returns

N/A

attachTo

attachTo(entity);

Attach this light to the given 3D entity.

Parameters

entity(object) a mesh, manualobject, or particle molecule.

Returns

N/A

detachFrom

detachFrom();

Detach this light from its parent, if any.

Parameters

N/A

Returns

N/A

Close