Class: GrWorld

GrWorld.GrWorld(params)

GrWorld

The GrWorld is basically a wrapper around THREE.js's scene, except that it keeps a list of GrObject rather than Object3D.

It contains a scene (and it puts things into it for you). It also contains a renderer and a camera.

When this creates a renderer, it places it into the dom (see the where option).

By default, the world is created with a reasonable default renderer, camera and groundplane. Orbit controls are installed.

Constructor

new GrWorld(params)

Construct an empty world

Parameters:
Name Type Description
params GrWorldProperties
Source:

Members

active_object :GrObject

Type:
  • GrObject
Source:

animCount :Number

Type:
  • Number
Source:

camera :THREE.PerspectiveCamera

Type:
  • THREE.PerspectiveCamera
Source:

objCount :Number

Type:
  • Number
Source:

objects :Array.<GrObject>

Type:
  • Array.<GrObject>
Source:

objNames :Object

Type:
  • Object
Source:

renderer :THREE.WebGLRenderer

Type:
  • THREE.WebGLRenderer
Source:

runbutton :HTMLInputElement

Type:
  • HTMLInputElement
Source:

speedcontrol :HTMLInputElement

Type:
  • HTMLInputElement
Source:

Methods

add(grobj)

Add an object to the world - this takes care of putting everything into the scene, as well as assigning IDs

Parameters:
Name Type Description
grobj GrObject
Source:

animate(callbacksopt)

perform a cycle of the animation loop - this measures the time since the last redraw and advances that much before redrawing

because draw is part of animate, the callbacks are handled here

Parameters:
Name Type Attributes Description
callbacks WorldCallbacks <optional>
Source:

draw()

draw the default camera to the default renderer

Source:

enableVR()

adds VR capability

Source:

go(callbacks)

start an (endless) animation loop - this just keeps going

Parameters:
Name Type Description
callbacks WorldCallbacks
Source:

stepWorld()

advance all of the objects

Source:

viewStats()

adds performance stats to the DOM

Source: