Billboard Molecule
From oWiki
Preference Dialog
Attributes
type
string ( r )
Type of this molecule, 'billboard'.
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 )
Select the types of object this molecule creates, either Billboard=0 or RibbonTrail=1.
pref.material
string ( r, w )
Sets the name of the material to be used for this billboard set.
pref.poolSize
int ( r, w )
Adjusts the size of the pool of billboards available in this set.
This method adjusts the pre-allocated size of the pool. If you try to reduce the size of the pool, the set has the option of ignoring you if too many billboards are already in use. Bear in mind that calling this method will incur significant construction / destruction calls so should be avoided in time-critical code. Try to avoid it by estimating the pool size correctly up-front.
pref.width
float ( r, w )
Sets the default width of the billboards in this set. All billboards in a set are created with these default dimensions. The set will render most efficiently if all the billboards in the set are the default size.
pref.height
float ( r, w )
Sets the default height of the billboards in this set. All billboards in a set are created with these default dimensions. The set will render most efficiently if all the billboards in the set are the default size.
pref.originx
float ( r, w )
Sets the x coordinate of the origin point for all billboards in this set.
pref.originy
float ( r, w )
Sets the y coordinate of the origin point for all billboards in this set.
pref.originz
float ( r, w )
Sets the z coordinate of the origin point for all billboards in this set.
pref.rotationType
string ( r, w )
Sets billboard rotation type. Possible values are:
| Value | Description |
|---|---|
| BBR_VERTEX | Rotate the billboard's vertices around their facing direction. |
| BBR_TEXCOORD | Rotate the billboard's texture coordinates. |
pref.billboardType
string ( r, w )
Sets the type of billboard to render. Possible types are:
| Value | Description |
|---|---|
| BBT_POINT | Standard point billboard (default), always faces the camera completely and is always upright. |
| BBT_ORIENTED_COMMON | Billboards are oriented around a shared direction vector (used as Y axis) and only rotate around this to face the camera. |
| BBT_ORIENTED_SELF | Billboards are oriented around their own direction vector (their own Y axis) and only rotate around this to face the camera. |
| BBT_PERPENDICULAR_COMMON | Billboards are perpendicular to a shared direction vector (used as Z axis, the facing direction) and X, Y axis are determined by a shared up-vertor. |
| BBT_PERPENDICULAR_SELF | Billboards are perpendicular to their own direction vector (their own Z axis, the facing direction) and X, Y axis are determined by a shared up-vertor. |
pref.billboardOrigin
string ( r, w )
Sets the point which acts as the origin point for all billboards in this set. Possible string values are:
BBO_TOP_LEFT
BBO_TOP_CENTER
BBO_TOP_RIGHT
BBO_CENTER_LEFT
BBO_CENTER
BBO_CENTER_RIGHT
BBO_BOTTOM_LEFT
BBO_BOTTOM_CENTER
BBO_BOTTOM_RIGHT
pref.numberOfChains
int ( r, w )
Set the number of chain segments (this object can render multiple chains at once using the same material).
pref.maxElements
int ( r, w )
Set the maximum number of chain elements per chain.
pref.trailLength
float ( r, w )
Set the length of the trail.
pref.ir
float ( r, w )
Set the RED component of the starting ribbon color for all chains.
pref.ig
float ( r, w )
Set the GREEN component of the starting ribbon color for all chains.
pref.ib
float ( r, w )
Set the BLUE component of the starting ribbon color for all chains.
pref.ia
float ( r, w )
Set the ALPHA component of the starting ribbon color for all chains.
volume
float, [0.0, 1.0] ( r, w )
Gets/Sets the volume of the sound attached to this billboardset.
currentTime
float ( r, w )
Gets/Sets the playback position (in secs) of the sound attached to this billboardset.
duration
float ( r )
Gets the duration (in secs) of the sound attached to this billboardset.
status
int ( r )
Polls for the current sound playing status.
Possible return values are:
| Value | Description |
|---|---|
| AL_PLAYING | A sound track is playing. |
| AL_STOPPED | Sound track has stopped. |
Methods
rename(n)
n: string
| Rename 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. |
setMaterial( name )
name: string
| Sets the material for this billboard set. |
setPosition( pos )
pos: Vector3
| Sets the position of this billboard set's origin point. |
createBillboard( pos, color )
pos: Vector3
color: RGBA
| Creates a new billboard and adds it to this set. |
| pos is the position of the new billboard realtive to the certer of the set. |
| color is the base color of the billboard. |
setBillboardColor( i, color )
i: int
color: RGBA
| Sets the base color of the billboard at index i of this billboard set. |
removeBillboard( i )
i: int
| Delete the billboard at index i of this billboard set. |
removeAllBillboards()
| Delete all billboards of this billboard set. |
addTexCoord( rect )
rect: an object {x1:0,y1:0,x2:10,y2:10}
| Adds a texture coordinates and appends to an internal array. |
| BillboardSet can use custom texture coordinates for various billboards. This is useful for selecting one of many particle images out of a tiled texture sheet, or doing flipbook animation within a single texture. |
resetTexCoords()
| Delete all texture coordinates from the internal array. |
setTexCoordIndex( bbi, tci )
bbi: int
tci: int
| Specifies that the billboard at index bbi should use the texture coordinate at index tci of the internal array. |
setTexCoordRect( bbi, rect )
bbi: int
rect: an object {x1:0,y1:0,x2:10,y2:10}
| Specifies that the billboard at index bbi should use the texture coordinate given as rect. |
setInitialColor( i, color )
i: int
color: RGBA
| Set the starting ribbon color for the chain at index i. |
setColorChange( i, valuePerSecond )
i: int
valuePerSecond: RGBA
| Enables / disables fading the trail using color. |
| valuePerSecond is the amount to subtract from color each second. |
setInitialWidth( i, width )
i: int
width: float
| Set the starting ribbon width in world units, for the chain at index i. |
setWidthChange( i, widthDeltaPerSecond )
i: int
widthDeltaPerSecond: float
| Set the change in ribbon width per second. |
| widthDeltaPerSecond is the amount the width will reduce by per second. |
setTrailLength( i, length )
i: int
length: float
| Set the length of the trail. |
| This sets the length of the trail, in world units. It also sets how far apart each segment will be, i.e. length / max_elements. |
addNode( entity )
entity: molecule
| Makes the ribbon trail track the movement of the given entity. |
removeNode( entity )
entity: molecule
| Remove tracking on the given entity. |
removeAllNodes()
| Remove tracking on all entities. |
attachSound( url )
url: string
| Attach an audio track to this billboard set, replace the existing one if any. The attached audio moves with the billboard set during animation and creates 3D sound effect. Use Camera.listen() to hear the sound effects. |
playSound( loop )
loop: bool
| Play the attached sound track, loops if necessary. |
pauseSound()
| Pause the sound track. |
stopSound()
| Stop the sound track. |
rewindSound()
| Rewind the sound track to the beginning. |
attachTo( entity )
entity: molecule
| Attach this billboard set to another 3D entity in scene. |
detachFrom( entity )
entity: molecule (optional)
| Detach this billboard set from another 3D entity in scene. |

