Light Molecule
From oWiki
Preference Dialog
Attributes
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 method 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.type
int ( r, w )
Specifies the types of light source. 0 = point light, 1 = directional light, 2 = spot light.
pref.lookat
string ( r, w )
Specifies the name of the molecule that this light is aiming at.
pref.x
float ( r, w )
Specifies the x coordinate of this light.
pref.y
float ( r, w )
Specifies the y coordinate of this light.
pref.z
float ( r, w )
Specifies the z coordinate of this light.
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
float [0, 255] ( r, w )
Specifies the RED component of the diffuse color.
pref.g
float [0, 255] ( r, w )
Specifies the GREEN component of the diffuse color.
pref.b
float [0, 255] ( r, w )
Specifies the BLUE component of the diffuse color.
pref.sr
float [0, 255] ( r, w )
Specifies the RED component of the specular color.
pref.sg
float [0, 255] ( r, w )
Specifies the GREEN component of the specular color.
pref.sb
float [0, 255] ( r, w )
Specifies the BLUE component of the specular color.
pref.att_range
float ( r, w )
Sets 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.visible
bool ( r, w )
Turns on and off the light.
pref.castShadow
bool ( r, w )
Sets whether or not this light will cast shadows.
Methods
rename(n)
n: string
| Rename this molecule. |
show()
| show the effects of this molecule. |
hide()
| hide the effects of this molecule. |
update()
| Force molecule to redraw with the current set of attributes. |
clone()
Return: a molecule
| Create a clone of this molecule. |
attach(droplet)
droplet: a droplet object (e.g. app.box.droplet)
| Attach this molecule to a droplet. |
detach()
| Remove this molecule from its droplet. |
deleteMod()
| Delete this molecule. |
serialize()
Return: string
| Serialize this molecule into its JSON representation. |
setDiffuseColor( r, g, b )
r: float [0, 255]
g: float [0, 255]
b: float [0, 255]
| Sets the diffuse color of the light. |
setSpecularColor( r, g, b )
r: float [0, 255]
g: float [0, 255]
b: float [0, 255]
| Sets the specular color of the light. |
attachTo( entity )
entity: molecule
| Attach this light to a 3D entity in scene. |
detachFrom( entity )
entity: molecule (optional)
| Detach this light from a 3D entity in scene. |

