WebGL 3D Space

iv.space

3d Space, list of nodes, materials, textures and 3d properties.

Constructor

iv.space(wnd,gl)

Constructor creates new 3d space object. Usually space created from iv.window.

wnd 3d window
gl WebGL context.

 

Properties

root Root 3d node
gl WebGL context
window 3d window
view default view
root Root 3d node
materials Array of materials
cfgTextures true if textures are allowed
cfgDbl double sided rendering
cfgKeepMeshData &1 - keep faces, &2 - keep points
cfgDefMtl Default material. If null, per node materials will be used.
cfgSelZOffset If true, selected objects will have z offset
cfgRMode Default render mode. 0 is idefault value.
stdLights Array of lights. If set, this lights will override lights in scene.

 

Selection

.select(node,sel,keep)

Method selects node in 3d space.

node Node to select.
sel true to select node, false - deselect.
keep Keep old selection. In false previous selection will be removed.

.selectRange(a,b)

Method selects range of nodes in 3d space. Method is used with tree-view control, when user selects nodes with shift key.

a First node
b Second node

Node which was firstly created in its parent object is first in the list. Same as in tree-view control. This method does not send notifications.

.getSelection()

Method return list of selected nodes. If selection is empty null will be returned.

Select None:

space.select(null,false,true);

 

Materials

.newMaterial(data)

Method creates new material

data

If string - this will be name of material. You should create material channels after that.

If object - data for material properties. This data may include name, colors, blending, textures, etc.
For description of material please see WebGL material.

.getMaterial(name)

This method searches material by name and returns it.

name Name of material.

If material was found it will be returned. If such material was not found, null will be returned.

.invalidate(flags)

Method marks viewport as invalid and scheduled update for the next frame. This method invokes iv.window.invalidate

flags

[optional] may be undefined or bit combinations of:

iv.INV_VERSION Update camera, increment current camera version. Version may be used by billboards in order to update position only when required.
iv.INV_STRUCTURE Structure was changed. Used to update shadow maps.
iv.INV_MTLS Flush shaders in materials. Same as view.space.invalidateMaterials()

Default is 0.

.invalidateMaterials()

Method removes all shaders from materials. Method may be used after some changes in scenes, for instance after chaning lights.

.render()

Used internally for rendering scene.

 

Rest methods are used internally.

In this article