Oolite JavaScript Reference: VisualEffect

From Elite Wiki
Revision as of 21:08, 20 August 2012 by Cim (talk | contribs) (New class for 1.77)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This is a new class planned for 1.77 and may be subject to significant change before 1.77 is released.

Prototype: Entity

The VisualEffect class is an Entity representing a visible but non-solid object defined from effectdata.plist. It has all the properties and methods of an Entity, and several others.

Properties

This property was added in Oolite test release 1.77.

isBreakPattern

allowsDocking : Boolean (read/write)

If this is true, the VisualEffect object will remain visible while break patterns on docking, launching or witchspace are being displayed (or not displayed). Normally all objects other than the break pattern itself are hidden.

scannerDisplayColor1

scannerDisplayColor1 : Colour specifier (read/write)

The first of two colours used by the ship’s scanner “lollipop”. When read, this will always be an array of four numbers in the range 0..1 (representing red, green, blue and alpha components). Any colour specifier format may be assigned to it. Assigning null will restore the value from effectdata.plist.

If both this and scannerDisplayColor2 are set to null, and no value is set for either in effectdata.plist then the effect will not appear on scanners.

See also: scannerDisplayColor2

scannerDisplayColor2

scannerDisplayColor2 : Colour specifier (read/write)

The second scanner colour. If both scannerDisplayColor1 and scannerDisplayColor2 are specified, the scanner lollipop will alternate between the two colours.

See also: scannerDisplayColor1

Methods

This method was added in Oolite test release 1.77.

getMaterials

function getMaterials() : Object

getMaterials() returns the effect's current materials dictionary, or if none present an empty dictionary.

See also: setMaterials(), getShaders()

getShaders

function getShaders() : Object

getShaders() returns the effect's current shaders dictionary, or if none present an empty dictionary.

See also: setShaders(), getMaterials()

remove

function remove()

Immediately removes the effect from the universe.

setMaterials

function setMaterials(materialDictionary : Object [, shaderDictionary : Object]) : Boolean

Set the materials of the effect’s model. This works exactly like the materials dictionary in effectdata.plist. The optional shaderDictionary argument overrides materialDictionary if shaders are active.

Example:

effect.setMaterials({"my_effect_diffuse.png": { diffuse_map: "my_effect_damaged_diffuse.png" }});

See also: setShaders(), getMaterials()

setShaders

function setShaders(shaderDictionary : Object) : Boolean

Set the shader materials of the effect’s model. Equivalent to setMaterials() with the materialDictionary value set to the effect’s current material dictionary.

See also: setMaterials(), getShaders()