# `class WMRibbon extends WMObjBase`

Available on all platforms

Ribbon or Coil object; ribbon or tube

This class should belong to a `WMChain`. See `WMBase` and `WMObjBase` classes for inheritted parameters.

## Instance Fields

### `var init:Int`

actual first index in CHAIN (calculated from `initXML` in `WMChain` class)

### `var initXML:Int`

given initial index in the CHAIN

### `var isRibbon:Bool`

is this object a ribbon? default is false

### `var last:Int`

actual last index in CHAIN (calculated from `initXML` in `WMChain` class)

### `var lastXML:Int`

given last index in the CHAIN

### `var smoothing:Bool`

whether smoothing is performed. default is false. This parameter is instrinsically fro beta-strands, do not use for others.

### `var thickness:Float`

thickness of ribbon. coil does not use this param. default is 0

### `function new(i:Bool, r:Float, c0:Int, c1:Int, a:Float, o:Float, q:Int, ag:Float, d:Float, sp:Float, gl:Float, sh:String):Void`

Constructor. Constructor. Parameters are listed below, where values in parenthesis are default values.

- i: is this ribbon? (false)
- r: radius (3.0)
- c0: color (0x00FF00; lime)
- c1: color, currently not used (0x00FF00, lime)
- a: alpha (1.0, opaque)
- o: offset, not used (0.0)
- q: quality, higher is better (0), not used.
- ag: ambient intensity (0.3)
- d: diffuse intensity (0.6)
- sp: specular intensity (0.3)
- gl: gloss (30.0)
- sh: shader type ("Phong")

### `function clear(def:WMDefaults):Void`

initialize values; if `def` is given, that is used as initial value.

### `function clone():WMRibbon`

returns clone of `this` instance

### `function gen(c:Context3D, chain:WMSmoothChain, is_dc_active:Bool):Void`

generate polygon and set corresponding shaders; this function calls `pregen` and `gen2`.

### `function gen2(c:Context3D, is_dc_active:Bool):Void`

generate polygon and shader. Call `pregen` function before. This function should not be called explicitly unless you are using multiple Workers.

### `function get_init():Int`

getter of `init`

### `function get_initXML():Int`

getter of `initXML`

### `function get_isRibbon():Bool`

getter of `isRibbon`

### `function get_last():Int`

getter of `last`

### `function get_lastXML():Int`

getter of `lastXML`

### `function get_smoothing():Bool`

getter of `smoothing`

### `function get_thickness():Float`

getter of `thickness`

### `function loadFromXml(x:Xml, def:WMDefaults):Void`

load from XML; if `def` is given, that is used as initial value. See also `clear` function of this class.

### `function loadFromXmlOverwrite(x:Xml):Void`

read XML while overriding default values; this function does not read WMAtom specific fields. Use `loadFromXmlWOClear` when loading WMAtom specific fields.

### `function loadFromXmlWOClear(x:Xml):Void`

load XML data; usually this function is called by loadFromXml function

### `function pregen(chain:WMSmoothChain):Void`

preparation for generating polygon. This function is explicitly used in non-primordial Worker, where Context3D of the primordial Worker is not available. If Worker is not used, this function should not be called explicitly.

### `function set_init(n:Int):Int`

setter of `init`

### `function set_initXML(n:Int):Int`

setter of `initXML`

### `function set_isRibbon(i:Bool):Bool`

setter of `isRibbon`

### `function set_last(n:Int):Int`

setter of `last`

### `function set_lastXML(n:Int):Int`

setter of `lastXML`

### `function set_smoothing(b:Bool):Bool`

setter of `smoothing`

### `function set_thickness(t:Float):Float`

setter of `thickness`