Class: XWorld

XWorld(canvas, wind, options)

new XWorld(canvas, wind, options)

Create x-world.

Parameters:
Name Type Description
canvas Canvas

html dom canvas

wind Window
options object
options.frustum: { fov, ratio, near, far },
options.camera: { position, lookAt }, where value in [x, y, z]
options.control: CameraCtrl
Source:

Members

bgColor

Properties:
Name Type Description
bgColor THREE.HemisphereLight

background color

Source:

xcam

Properties:
Name Type Description
xcam THREE.PerspectiveCamera

main camera

Source:

xecs

Properties:
Name Type Description
xecs ECS

ECS instance

Source:

xlight

Properties:
Name Type Description
xmaterials XMaterials

material & light,

Source:

xlight

xlight getter. see XMaterial#light

Properties:
Name Type Description
xlight object

set light parameters that can be applied to objects, of which xlight.hemisphere = THREE.HemisphereLight

Source:

xlight

Properties:
Name Type Description
xlight THREE.HemisphereLight

light, with property "options"

Source:

xscene

Properties:
Name Type Description
xscene THREE.Scene

main scene

Source:

xview

Properties:
Name Type Description
xview object

X view singleton: {flag, cmds}.

Source:

Methods

(static) update(time)

this.ecs.runSystemGroup('input');
this.ecs.runSystemGroup('render');
...

Parameters:
Name Type Description
time number
Source:

addEntities(defs) → {array}

Add entities.

Parameters:
Name Type Description
defs array | object

e.g.
[{ Obj3: {...}, ... }]

Source:
Returns:

entities been added

Type
array

addSystem(group, sys) → {XWorld}

Add systems.

Parameters:
Name Type Description
group string

group name

sys System

ECS system

Source:
Returns:

this

Type
XWorld

registerComponents(comps)

ecs.registerComponent(name, ComponentExports[name]);

Parameters:
Name Type Description
comps object | Component

a component or an object of {comp-name, comp}

Source:

setChannel(ch, pass) → {XWorld}

Set channel state.

Parameters:
Name Type Description
ch int

channel number 0 ~ 31, where 0 is all visible

pass bool
Source:
Returns:

this

Type
XWorld

startUpdate()

Source:

XWorld()

new XWorld()

x-visual world

Source:

Members

bgColor

Properties:
Name Type Description
bgColor THREE.HemisphereLight

background color

Source:

xcam

Properties:
Name Type Description
xcam THREE.PerspectiveCamera

main camera

Source:

xecs

Properties:
Name Type Description
xecs ECS

ECS instance

Source:

xlight

Properties:
Name Type Description
xmaterials XMaterials

material & light,

Source:

xlight

xlight getter. see XMaterial#light

Properties:
Name Type Description
xlight object

set light parameters that can be applied to objects, of which xlight.hemisphere = THREE.HemisphereLight

Source:

xlight

Properties:
Name Type Description
xlight THREE.HemisphereLight

light, with property "options"

Source:

xscene

Properties:
Name Type Description
xscene THREE.Scene

main scene

Source:

xview

Properties:
Name Type Description
xview object

X view singleton: {flag, cmds}.

Source:

Methods

(static) update(time)

this.ecs.runSystemGroup('input');
this.ecs.runSystemGroup('render');
...

Parameters:
Name Type Description
time number
Source:

addEntities(defs) → {array}

Add entities.

Parameters:
Name Type Description
defs array | object

e.g.
[{ Obj3: {...}, ... }]

Source:
Returns:

entities been added

Type
array

addSystem(group, sys) → {XWorld}

Add systems.

Parameters:
Name Type Description
group string

group name

sys System

ECS system

Source:
Returns:

this

Type
XWorld

registerComponents(comps)

ecs.registerComponent(name, ComponentExports[name]);

Parameters:
Name Type Description
comps object | Component

a component or an object of {comp-name, comp}

Source:

setChannel(ch, pass) → {XWorld}

Set channel state.

Parameters:
Name Type Description
ch int

channel number 0 ~ 31, where 0 is all visible

pass bool
Source:
Returns:

this

Type
XWorld

startUpdate()

Source: