|
Sweet Home 3D 3.4 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.eteks.sweethome3d.j3d.ModelManager
public class ModelManager
Singleton managing 3D models cache.
This manager supports 3D models with an OBJ, DAE, 3DS or LWS format by default.
Additional classes implementing Java 3D Loader
interface may be
specified in the com.eteks.sweethome3d.j3d.additionalLoaderClasses
(separated by a space or a colon :) to enable the support of other formats.
Note: this class is compatible with Java 3D 1.3.
Nested Class Summary | |
---|---|
static interface |
ModelManager.ModelObserver
An observer that receives model loading notifications. |
Field Summary | |
---|---|
static java.lang.String |
LIGHT_SHAPE_PREFIX
Shape3D user data prefix for lights. |
static java.lang.String |
MIRROR_SHAPE_PREFIX
Shape3D user data prefix for mirror shapes. |
static java.lang.String |
WINDOW_PANE_SHAPE_PREFIX
Shape3D user data prefix for window pane shapes. |
Method Summary | |
---|---|
void |
clear()
Shutdowns the multithreaded service that load textures. |
Node |
cloneNode(Node node)
Returns a clone of the given node . |
java.awt.geom.Area |
getAreaOnFloor(Node node)
Returns the 2D area of the 3D shapes children of the given node
projected on the floor (plan y = 0). |
BoundingBox |
getBounds(Node node)
Returns the bounds of the 3D shapes of node . |
BoundingBox |
getBounds(Node node,
Transform3D transformation)
Returns the bounds of the 3D shapes of node with an additional transformation . |
static ModelManager |
getInstance()
Returns an instance of this singleton. |
Transform3D |
getNormalizedTransform(Node node,
float[][] modelRotation,
float width)
Returns a transform that will transform the model node
to let it fill a box of the given width centered on the origin. |
TransformGroup |
getNormalizedTransformGroup(Node node,
float[][] modelRotation,
float width)
Returns a transform group that will transform the model node
to let it fill a box of the given width centered on the origin. |
Vector3f |
getSize(Node node)
Returns the size of 3D shapes of node . |
Vector3f |
getSize(Node node,
Transform3D transformation)
Returns the size of 3D shapes of node after an additional transformation . |
BranchGroup |
loadModel(Content content)
Returns the node loaded synchronously from content with supported loaders. |
void |
loadModel(Content content,
boolean synchronous,
ModelManager.ModelObserver modelObserver)
Reads a 3D node from content with supported loaders
and notifies the loaded model to the given modelObserver once available. |
void |
loadModel(Content content,
ModelManager.ModelObserver modelObserver)
Reads asynchronously a 3D node from content with supported loaders
and notifies the loaded model to the given modelObserver once available. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String WINDOW_PANE_SHAPE_PREFIX
Shape3D
user data prefix for window pane shapes.
public static final java.lang.String MIRROR_SHAPE_PREFIX
Shape3D
user data prefix for mirror shapes.
public static final java.lang.String LIGHT_SHAPE_PREFIX
Shape3D
user data prefix for lights.
Method Detail |
---|
public static ModelManager getInstance()
public void clear()
public Vector3f getSize(Node node)
node
.
This method computes the exact box that contains all the shapes,
contrary to node.getBounds()
that returns a bounding
sphere for a scene.
public Vector3f getSize(Node node, Transform3D transformation)
node
after an additional transformation
.
This method computes the exact box that contains all the shapes,
contrary to node.getBounds()
that returns a bounding
sphere for a scene.
public BoundingBox getBounds(Node node)
node
.
This method computes the exact box that contains all the shapes,
contrary to node.getBounds()
that returns a bounding
sphere for a scene.
public BoundingBox getBounds(Node node, Transform3D transformation)
node
with an additional transformation
.
This method computes the exact box that contains all the shapes, contrary to node.getBounds()
that returns a bounding sphere for a scene.
public TransformGroup getNormalizedTransformGroup(Node node, float[][] modelRotation, float width)
node
to let it fill a box of the given width
centered on the origin.
node
- the root of a model with any size and locationmodelRotation
- the rotation applied to the model before normalization
or null
if no transformation should be applied to node.width
- the width of the boxpublic Transform3D getNormalizedTransform(Node node, float[][] modelRotation, float width)
node
to let it fill a box of the given width
centered on the origin.
node
- the root of a model with any size and locationmodelRotation
- the rotation applied to the model before normalization
or null
if no transformation should be applied to node.width
- the width of the boxpublic void loadModel(Content content, ModelManager.ModelObserver modelObserver)
content
with supported loaders
and notifies the loaded model to the given modelObserver
once available.
content
- an object containing a modelmodelObserver
- the observer that will be notified once the model is available
or if an error happens
java.lang.IllegalStateException
- if the current thread isn't the Event Dispatch Thread.public void loadModel(Content content, boolean synchronous, ModelManager.ModelObserver modelObserver)
content
with supported loaders
and notifies the loaded model to the given modelObserver
once available.
content
- an object containing a modelsynchronous
- if true
, this method will return only once model content is loadedmodelObserver
- the observer that will be notified once the model is available
or if an error happens. When the model is loaded synchronously, the observer will be notified
in the same thread as the caller, otherwise the observer will be notified in the Event
Dispatch Thread and this method must be called in Event Dispatch Thread too.
java.lang.IllegalStateException
- if synchronous is false
and the current thread isn't
the Event Dispatch Thread.public Node cloneNode(Node node)
node
.
All the children and the attributes of the given node are duplicated except the geometries
and the texture images of shapes.
public BranchGroup loadModel(Content content) throws java.io.IOException
content
with supported loaders.
This method is threadsafe and may be called from any thread.
content
- an object containing a model
java.io.IOException
public java.awt.geom.Area getAreaOnFloor(Node node)
node
projected on the floor (plan y = 0).
|
Sweet Home 3D 3.4 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
![]() |
? Copyrights 2006-2011 eTeks - All rights reserved
Distributed under GNU General Public License |