# `class WMObject3D extends WMObjBase`

Available on all platforms

Basic 3D Objects: Cone, Cube, Cylinder, Square(2D)

available objects and their params Cone: radius, height, quality Cube: x, y, z Cylinder: radius, height, quality Square: width, height

## Instance Fields

### `var dir:Point3D`

direction of the object

### `var pos:Point3D`

position of the object

### `var type:String`

object type. default is "cone"

### `var xsize:Float`

length for X direction; used for "Cube"

### `var ysize:Float`

length for Y direction; used for "Cube"

### `var zsize:Float`

length for Z direction; used for "Cube"

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

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

- r: radius (1.0)
- c0: color (0x00FF00; lime)
- c1: color (0x00FF00, lime)
- a: alpha (1.0, opaque)
- o: offset, not used (0.0)
- q: quality, higher is better (3)
- ag: ambient intensity (0.4)
- d: diffuse intensity (0.5)
- sp: specular intensity (0.2)
- gl: gloss (30.0)
- sh: shader type ("Phong")

### `function absmax():Point3D`

absolute max of position: max(abs(x),abs(y),abs(z))

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

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

### `function clone():WMObject3D`

returns clone of `this` instance

### `function gen(c:Context3D, 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 getDataSize():Int`

predefined cost for drawing; return always 10.

### `function get_dir():Point3D`

getter for `dir`

### `function get_pos():Point3D`

getter of `pos`

### `function get_type():String`

getter of `type`

### `function get_xsize():Float`

getter of `xsize`

### `function get_ysize():Float`

getter of `ysize`

### `function get_zsize():Float`

getter of `zsize`

### `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 num():Int`

number of elements inside; return always 1.

### `function pregen():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 scaleCoord(scale:Float):Void`

scale position by `scale`

### `function set_dir(d:Point3D):Point3D`

setter for `dir`

### `function set_pos(p:Point3D):Point3D`

setter of `pos`

### `function set_type(s:String):String`

setter of `type`

### `function set_xsize(x:Float):Float`

setter of `xsize`

### `function set_ysize(y:Float):Float`

setter of `ysize`

### `function set_zsize(z:Float):Float`

setter of `zsize`

### `function sumPos():Point3D`

sum of position

### `function translate(p:Point3D):Void`

translate coordinate by `p`