Class Index | File Index

Classes


Class ModelManager


Defined in: ModelManager.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
Singleton managing 3D models cache.
Field Summary
Field Attributes Field Name and Description
<static>  
ModelManager.BALL_PREFIX
Node user data prefix for ball / rotating joints.
<static>  
Deformable group suffix.
<static>  
ModelManager.HINGE_PREFIX
Node user data prefix for hinge / rotating opening joints.
<static>  
ModelManager.LIGHT_SHAPE_PREFIX
Shape3D name prefix for lights.
<static>  
Node user data prefix for mannequin parts.
<static>  
ModelManager.MIRROR_SHAPE_PREFIX
Shape3D name prefix for mirror shapes.
<static>  
ModelManager.SPECIAL_SHAPE_PREFIX
Special shapes prefix;
<static>  
Node user data separator for sub transformations.
<static>  
ModelManager.UNIQUE_RAIL_PREFIX
Node user data prefix for rail / sliding opening joints.
<static>  
Shape3D name prefix for window pane shapes.
Method Summary
Method Attributes Method Name and Description
 
Clears loaded models cache.
 
cloneNode(node, clonedSharedGroups)
Returns a clone of the given node.
 
Returns true if the given node or its children contains at least a deformable group.
 
containsNode(node, prefix)
Returns true if the given node or a node in its hierarchy contains a node which name, stored in user data, starts with prefix.
 
Frees geometry data of the given node.
 
Returns the 2D area of the 3D shapes children of the given scene 3D node projected on the floor (plan y = 0), or of the given staircase if node is an instance of HomePieceOfFurniture.
 
getBounds(node, transformation)
Returns the bounds of the 3D shapes of node with an additional optional transformation.
 
getCenter(node)
Returns the center of the bounds of node 3D shapes.
 
getFrontArea(cutOutShape, node)
Returns the shape matching the given cut out shape if not null or the 2D area of the 3D shapes children of the node projected on its front side.
<static>  
ModelManager.getInstance()
Returns an instance of this singleton.
 
getMaterials(node, ignoreEdgeColorMaterial, creator)
Returns the materials used by the children shapes of the given node, attributing their creator to them.
 
Returns the minimum size of a model.
 
getNormalizedTransform(node, modelRotation, width, modelCenteredAtOrigin)
Returns a transformation matrix that will transform the model node to let it fill a box of the given width centered on the origin.
 
getNormalizedTransformGroup(node, modelRotation, width, modelCenteredAtOrigin)
Returns a transform group that will transform the model node to let it fill a box of the given width centered on the origin.
 
getShape(svgPathShape)
Returns the shape matching the given SVG path shape.
 
getSize(node, transformation)
Returns the size of 3D shapes of node after an additional optional transformation.
 
getTransformedGeometry(geometry, transformations)
Returns a new geometry where coordinates are transformed with the given transformations.
 
loadModel(content, synchronous, modelObserver)
Reads a 3D node from content with supported loaders and notifies the loaded model to the given modelObserver once available with its modelUpdated and modelError methods.
 
removeSharedShape(node, shape)
Removes the shared shape from the children of the given node.
 
searchShapeTransformations(node, shape, transformations, parentTransformations)
Searches all the transformations applied to a shared shape child of the given node.
 
unloadModel(content, disposeGeometries)
Removes the model matching the given content from the manager.
Class Detail
ModelManager()
Singleton managing 3D models cache.
Author: Emmanuel Puybaret.
Field Detail
<static> ModelManager.BALL_PREFIX
Node user data prefix for ball / rotating joints.

<static> ModelManager.DEFORMABLE_TRANSFORM_GROUP_SUFFIX
Deformable group suffix.

<static> ModelManager.HINGE_PREFIX
Node user data prefix for hinge / rotating opening joints.

<static> ModelManager.LIGHT_SHAPE_PREFIX
Shape3D name prefix for lights.

<static> ModelManager.MANNEQUIN_ABDOMEN_PREFIX
Node user data prefix for mannequin parts.

<static> ModelManager.MIRROR_SHAPE_PREFIX
Shape3D name prefix for mirror shapes.

<static> ModelManager.SPECIAL_SHAPE_PREFIX
Special shapes prefix;

<static> ModelManager.SUB_TRANSFORMATION_SEPARATOR
Node user data separator for sub transformations.

<static> ModelManager.UNIQUE_RAIL_PREFIX
Node user data prefix for rail / sliding opening joints.

<static> ModelManager.WINDOW_PANE_SHAPE_PREFIX
Shape3D name prefix for window pane shapes.
Method Detail
clear()
Clears loaded models cache.

cloneNode(node, clonedSharedGroups)
Returns a clone of the given node. All the children and the attributes of the given node are duplicated except the geometries and the texture images of shapes.
Parameters:
{Node3D} node
the root of a model
{Array} clonedSharedGroups Optional

{boolean} containsDeformableNode(node)
Returns true if the given node or its children contains at least a deformable group.
Parameters:
{Node3D} node
the root of a model
Returns:
{boolean}

containsNode(node, prefix)
Returns true if the given node or a node in its hierarchy contains a node which name, stored in user data, starts with prefix.
Parameters:
{Node3D} node
a node
{string} prefix
a string

disposeGeometries(node)
Frees geometry data of the given node.
Parameters:
{Node3D} node
the root of a model

{Area} getAreaOnFloor(node)
Returns the 2D area of the 3D shapes children of the given scene 3D node projected on the floor (plan y = 0), or of the given staircase if node is an instance of HomePieceOfFurniture.
Parameters:
{Node3D|HomePieceOfFurniture} node
Returns:
{Area}

getBounds(node, transformation)
Returns the bounds of the 3D shapes of node with an additional optional transformation.
Parameters:
{Node3D} node
the root of a model
{Array} transformation Optional
the optional transformation applied to the model

getCenter(node)
Returns the center of the bounds of node 3D shapes.
Parameters:
node
the root of a model

getFrontArea(cutOutShape, node)
Returns the shape matching the given cut out shape if not null or the 2D area of the 3D shapes children of the node projected on its front side. The returned area is normalized in a 1 unit square centered at the origin.
Parameters:
cutOutShape
node

<static> {ModelManager} ModelManager.getInstance()
Returns an instance of this singleton.
Returns:
{ModelManager}

getMaterials(node, ignoreEdgeColorMaterial, creator)
Returns the materials used by the children shapes of the given node, attributing their creator to them.
Parameters:
{Node3D} node
{boolean} ignoreEdgeColorMaterial
{string} creator Optional

getMinimumSize()
Returns the minimum size of a model.

getNormalizedTransform(node, modelRotation, width, modelCenteredAtOrigin)
Returns a transformation matrix that will transform the model node to let it fill a box of the given width centered on the origin.
Parameters:
{Node3D} node
the root of a model with any size and location
{?Array} modelRotation
the rotation applied to the model before normalization or null if no transformation should be applied to node.
{number} width
the width of the box
{boolean} modelCenteredAtOrigin Optional
if true center will be moved to match the origin after the model rotation is applied

getNormalizedTransformGroup(node, modelRotation, width, modelCenteredAtOrigin)
Returns a transform group that will transform the model node to let it fill a box of the given width centered on the origin.
Parameters:
{Node3D} node
the root of a model with any size and location
{Array} modelRotation
the rotation applied to the model before normalization or null if no transformation should be applied to node.
{number} width
the width of the box
{boolean} modelCenteredAtOrigin Optional
if true or missing, center will be moved to match the origin after the model rotation is applied

{Shape} getShape(svgPathShape)
Returns the shape matching the given SVG path shape.
Parameters:
{string} svgPathShape
Returns:
{Shape}

getSize(node, transformation)
Returns the size of 3D shapes of node after an additional optional transformation.
Parameters:
{Node3D} node
the root of a model
{Array} transformation Optional
the optional transformation applied to the model

{IndexedGeometryArray3D} getTransformedGeometry(geometry, transformations)
Returns a new geometry where coordinates are transformed with the given transformations.
Parameters:
{IndexedGeometryArray3D} geometry
{mat4[]} transformations
Returns:
{IndexedGeometryArray3D}

loadModel(content, synchronous, modelObserver)
Reads a 3D node from content with supported loaders and notifies the loaded model to the given modelObserver once available with its modelUpdated and modelError methods.
Parameters:
{URLContent} content
an object containing a model
{boolean} synchronous Optional
optional parameter equal to false by default
{{modelUpdated|modelError|progression}} modelObserver
the observer containing modelUpdated(model), modelError(error), progression(part, info, percentage) optional methods that will be notified once the model is available or if an error happens, with model being an instance of Node3D, error, part, info strings and percentage a number.

removeSharedShape(node, shape)
Removes the shared shape from the children of the given node.
Parameters:
{Node3D} node
a node
{Shape3D} shape

searchShapeTransformations(node, shape, transformations, parentTransformations)
Searches all the transformations applied to a shared shape child of the given node.
Parameters:
{Node3D} node
a node
{Shape3D} shape
{mat4[]} transformations
{mat4} parentTransformations

unloadModel(content, disposeGeometries)
Removes the model matching the given content from the manager.
Parameters:
{URLContent} content
an object containing a model
{boolean} disposeGeometries
if true model geometries will be disposed too

© Copyright 2024 Emmanuel PUYBARET / eTeks
Distributed under GNU General Public License
Documentation generated by JsDoc Toolkit 2.4.0 on Thu Apr 04 2024 17:30:26 GMT+0200 (CEST)