Environment Molecule
From oWiki
Preference Dialog
Attributes
type
string ( r )
Type of this molecule, 'environment'.
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.skyType
int ( r, w )
Type of sky. Possible types are:
| Value | Description |
|---|---|
| none = 0 | No sky. |
| skyPlane = 1 | A plane at constant distance from the camera representing the sky. |
| skyBox = 2 | A 6-sided box at constant distance from the camera representing the sky. |
| skyDome = 3 | An illusion of a curved sky. |
pref.skyMaterial
string ( r, w )
The name of the material the sky will use.
pref.distance
float ( r, w )
Distance in world coorinates from the camera to each plane of the box the sky is rendered on. The recommended distance is 1000 for skyPlane, 5000 for skyBox, and 4000 for skyDome.
pref.curvature
float ( r, w )
The curvature of the skyDome. Good values are between 2 and 65. Higher values are more curved leading to a smoother effect, lower values are less curved meaning more distortion at the horizons but a better distance effect.
pref.tiling
float ( r, w )
How many times to tile the texture(s) across the sky, applies to skyPlane and skyDome.
pref.scale
float ( r, w )
The scaling applied to the skyPlane - higher values mean a bigger sky plane - you may want to tweak this depending on the size of plane.d and the other characteristics of your scene
pref.bow
float ( r, w )
If zero, the skyPlane will be completely flat. If above zero, the plane will be curved, allowing the sky to appear below camera level. Curved sky planes are similar to skyDomes, but are more compatible with fog.
pref.xsegments
int ( r, w )
Determines the number of x-segments the plane will have. This is most important when you are bowing the plane, but may also be useful if you need tesselation on the plane to perform per-vertex effects. The recommended value is 1 for skyPlane and 16 for skyDome.
pref.ysegments
int ( r, w )
Determines the number of y-segments the plane will have. This is most important when you are bowing the plane, but may also be useful if you need tesselation on the plane to perform per-vertex effects. The recommended value is 1 for skyPlane and 16 for skyDome.
pref.fogType
int ( r, w )
Type of fog. Possible types are:
| Value | Description |
|---|---|
| FOG_NONE = 0 | No fog. |
| FOG_EXP = 1 | Fog density increases exponentially from the camera (fog = 1/e^(distance * density)) |
| FOG_EXP2 = 2 | Fog density increases at the square of FOG_EXP, i.e. even quicker (fog = 1/e^(distance * density)^2) |
| FOG_LINEAR = 3 | Fog density increases linearly between the start and end distances. |
pref.density
float ( r, w )
The density of the fog in FOG_EXP or FOG_EXP2 mode, as a value between 0 and 1. The default is 0.001.
pref.linearStart
float ( r, w )
Distance in world units at which linear fog starts to encroach. Only applicable if mode is FOG_LINEAR.
pref.linearEnd
float ( r, w )
Distance in world units at which linear fog becomes completely opaque. Only applicable if mode is FOG_LINEAR.
pref.fr
float ( r, w )
Specifies the RED component of the fog color. Possible values is between 0 to 255.
pref.fg
float ( r, w )
Specifies the GREEN component of the fog color. Possible values is between 0 to 255.
pref.fb
float ( r, w )
Specifies the BLUE component of the fog color. Possible values is between 0 to 255.
Methods
rename(n)
n: string
| Rename this molecule. |
update()
| Force molecule to update 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. |

