SceneUtils

A class containing useful utility functions for scene manipulation.

Methods

.assignDefaultControls(camera : Camera, sceneBox : Box3)

Assigns default control settings on the camera based on the given sceneBox param.

.calcSceneBox(scene : Scene) → Box3

scene — current scene.

Calculates scene bounding box.

.checkActionIsUsed(scene : Scene, action : AnimationAction) → Boolean

Checks if the given action is used with one of the scene objects, i.e. the action's target node exists on the scene.

.createDefaultCamera(sceneBox : Box3, aspect : Float) → Camera

Creates default PerspectiveCamera which looks to the center of the scene bounding box.

.createMeshesFromMultiMaterialMesh(mesh : Mesh) → Group

mesh — a mesh with multiple materials.

Converts the given multi-material mesh into an instance of Group holding for each material a separate mesh.

.createMultiMaterialObject(geometry : BufferGeometry, materials : Array) → Group

Creates a new Group that contains a new mesh for each material defined in materials. Beware that this is not the same as an array of materials which defines multiple materials for one mesh. This is mostly useful for objects that need both a material and a wireframe implementation.

.getAnimationActionByName(scope : App, animClipName : String) → AnimationAction

Search for animation action by its clip name.

.getMaterialByName(appInstance : App, matName : String) → Material

Find material by the given name. If not found, returns null.

.getMaterialsByName(appInstance : App, matName : String) → Material

Find materials by the given name. If not found, returns [].

.reduceVertices(object : Object3D, func : Function, initialValue : T) → T

Akin to Array.prototype.reduce(), but operating on the vertices of all the visible descendant objects, in world space. Additionally, it can operate as a transform-reduce, returning a different type T than the Vector3 input. This can be useful for e.g. fitting a viewing frustum to the scene.

Source

For more info on how to obtain the source code of this module see this page.