Module: GrWorld

CS559 3D World Framework Code

GrWorld - bascially a wrapper around scene, except that it uses GrObject instead of Object3D (GrObjects have Object3D)

To make things simple, this keeps a renderer and a default camera. Of course, that might complicate things if you want to have multiple renderers and cameras

Basically, this keeps some of the basic stuff you need when you use three.

Source:

Classes

GrWorld

Type Definitions

GrWorldProperties

Document the parameters for making a world - all are optional we'll guess at something if you don't give it to us

Properties:
Name Type Attributes Default Description
camera <optional>

use this camera if passed

fov <optional>

camera property if we make one

near <optional>

camera property if we make one

far <optional>

camera property if we make one

renderer <optional>

if you don't give one, we'll make it

renderparams <optional>

parameters for making the renderer

width <optional>

canvas size

height <optional>

canvas size

where <optional>

where in the DOM to insert things

lights <optional>

a list of lights, or else default ones are made

lightBrightness <optional>
.75

brightness of the default lights

lightColoring <optional>
"cool-to-warm"

either "c"ool-to-warm, "w"hite, or e"x"treme

sideLightColors <optional>

to make extreme lighting

ambient <optional>
.5

brightness of the ambient light in default light

groundplane <optional>

can be a groundplane, or False (otherwise, one gets made)

groundplanecolor <optional>
"green"

if we create a ground plane, what color

groundplanesize <optional>
5

if we create a ground plane, how big

lookfrom <optional>

where to put the camera (only if we make the camera)

lookat <optional>

where to have the camera looking (only if we make the camera)

background <optional>
"black"

color to set the background

runbutton HTMLInputElement <optional>

a checkbox (HTML) to switch things on or off (can be undefined)

speedcontrol HTMLInputElement <optional>

a slider to get the speed (must be an HTML element, not a LabelSlider)

Source:

WorldCallbacks

callback list - used in 2 places, so document once

Type:
  • Object
Properties:
Name Type Attributes Description
prefirst function <optional>

called before the first loop go around

prestep function <optional>

called before the step (even if there is no step)

stepWorld function <optional>

called after the step (only if there is a step)

predraw function <optional>

called before drawing (after the step - if there is one)

postdraw function <optional>

called after drawing

first function <optional>

called after the end of the first loop go-around

Source: