@ThreadSafe
public class J3DLoader
extends java.lang.Object
Facility to construct a Linkage
sub-tree from a Java3D
scenegraph.
Among other uses, this provides a bridge from the Java3D loaders to the MSim model.
Copyright (C) 2008 Marsette A. Vona, III
Modifier and Type | Field and Description |
---|---|
private static java.lang.String |
cvsid |
static java.lang.String |
WP_J3D_PATH
Widget property containing the corresponding Java3D path, for
Widget s generated in loadFromJ3D(Link, Node, boolean,
int, boolean) . |
Constructor and Description |
---|
J3DLoader() |
Modifier and Type | Method and Description |
---|---|
protected static void |
loadChildrenFromJ3D(Link linkageRoot,
javax.media.j3d.Group j3dGroup,
boolean loadBodyShapes,
int j3dFormatMask,
boolean mergeUnnamed,
java.lang.StringBuffer j3dPath,
vona.math.RX mergeCMT,
char type)
Helper for
loadFromJ3D(Link, Node, boolean, int, boolean,
StringBuffer, RX) that loads correspondents to the children of
j3dGroup to linkageRoot. |
static Link |
loadFromJ3D(Link linkageRoot,
javax.media.j3d.Node j3dRoot)
Covers
loadFromJ3D(Link, Node, boolean, int, boolean) , always
loads body shapes with all vertex components and does not merge unnamed
transforms. |
static Link |
loadFromJ3D(Link linkageRoot,
javax.media.j3d.Node j3dRoot,
boolean loadBodyShapes,
int j3dFormatMask,
boolean mergeUnnamed)
Load a
Linkage sub-tree from a Java3D scene graph. |
protected static void |
loadFromJ3D(Link linkageRoot,
javax.media.j3d.Node j3dRoot,
boolean loadBodyShapes,
int j3dFormatMask,
boolean mergeUnnamed,
java.lang.StringBuffer j3dPath,
vona.math.RX mergeCMT)
|
static Link |
loadFromJ3D(Link linkageRoot,
com.sun.j3d.loaders.Scene j3dScene)
Covers
loadFromJ3D(Link, Node, boolean, int, boolean) , loads
from the scene group, always loads body shapes with all vertex components
and does not merge unnamed transforms. |
static Link |
loadFromJ3D(Link linkageRoot,
com.sun.j3d.loaders.Scene j3dScene,
boolean loadBodyShapes,
int j3dFormatMask,
boolean mergeUnnamed)
Covers
loadFromJ3D(Link, Node, boolean, int, boolean) , loads
from the scene group. |
static Link |
loadFromJ3D(javax.media.j3d.Node j3dRoot)
Covers
loadFromJ3D(Link, Node, boolean, int, boolean) , always
loads body shapes with all vertex components, does not merge unnamed
transforms, and makes a new linkageRoot. |
static Link |
loadFromJ3D(com.sun.j3d.loaders.Scene j3dScene)
Covers
loadFromJ3D(Link, Node, boolean, int, boolean) , loads
from the scene group, always loads body shapes with all vertex components,
does not merge unnamed transforms, and makes a new linkageRoot. |
private static final java.lang.String cvsid
public static final java.lang.String WP_J3D_PATH
Widget
property containing the corresponding Java3D path, for
Widget
s generated in loadFromJ3D(Link, Node, boolean,
int, boolean)
.
public static Link loadFromJ3D(Link linkageRoot, javax.media.j3d.Node j3dRoot, boolean loadBodyShapes, int j3dFormatMask, boolean mergeUnnamed)
Load a Linkage
sub-tree from a Java3D scene graph.
The Java3D scene graph is traversed as a tree starting at
j3dRoot, with the SharedGroup
of any encountered Java3D
Link
nodes instantiated in-place. For each TransformGroup
g with a rigid transform t (except in the case that
j3dRoot itself is a TransformGroup, see below), a new Joint.Type.GENERAL
Joint
j is added with
identity mobility transform and mobility-to-parent transform set to
t, and the childLink of j is set to a new Link
.
The new sub-linkage is attached at the link linkageRoot such
that linkageRoot and j3dRoot correspond. Thus, if
j3dRoot is a Group
then the correspondents to its
children are directly attached to linkageRoot; this holds even in
the case that j3dRoot is itself a TransformGroup
.
linkageRoot
- the attach point for the new sub-tree, or null to
create a new root Link
in the top-level Linkage
j3dRoot
- the root of the Java3D scene graph from which to load the
sub-linkage, not nullloadBodyShapes
- whether to assign Shape3D
nodes as
Link
user Widget
s, if not they are ignoredj3dFormatMask
- see JOGLGeometry.extract(GeometryArray, int,
PrintStream)
mergeUnnamed
- whether to create Joint
s only for
TransformGroup
s that have non-empty namesCapabilityNotSetException
- if the appropriate capabilities are
not set and j3dRoot or any of its descendants is part of live or
compiled scene graphpublic static Link loadFromJ3D(Link linkageRoot, javax.media.j3d.Node j3dRoot)
Covers loadFromJ3D(Link, Node, boolean, int, boolean)
, always
loads body shapes with all vertex components and does not merge unnamed
transforms.
public static Link loadFromJ3D(javax.media.j3d.Node j3dRoot)
Covers loadFromJ3D(Link, Node, boolean, int, boolean)
, always
loads body shapes with all vertex components, does not merge unnamed
transforms, and makes a new linkageRoot.
public static Link loadFromJ3D(Link linkageRoot, com.sun.j3d.loaders.Scene j3dScene, boolean loadBodyShapes, int j3dFormatMask, boolean mergeUnnamed)
Covers loadFromJ3D(Link, Node, boolean, int, boolean)
, loads
from the scene group.
public static Link loadFromJ3D(Link linkageRoot, com.sun.j3d.loaders.Scene j3dScene)
Covers loadFromJ3D(Link, Node, boolean, int, boolean)
, loads
from the scene group, always loads body shapes with all vertex components
and does not merge unnamed transforms.
public static Link loadFromJ3D(com.sun.j3d.loaders.Scene j3dScene)
Covers loadFromJ3D(Link, Node, boolean, int, boolean)
, loads
from the scene group, always loads body shapes with all vertex components,
does not merge unnamed transforms, and makes a new linkageRoot.
protected static void loadFromJ3D(Link linkageRoot, javax.media.j3d.Node j3dRoot, boolean loadBodyShapes, int j3dFormatMask, boolean mergeUnnamed, java.lang.StringBuffer j3dPath, vona.math.RX mergeCMT)
Impl of loadFromJ3D(Link, Node, boolean, int, boolean)
.
Keeps track of the current tree path under j3dRoot so that informative warnings can be emitted when issues like ignored node types or non-rigid transforms are encountered.
j3dPath
- a string describing the current tree path under
j3dRoot, for the top-level call this should have length 1. For
each recursive call two elements are appended: a character describing the
type of the parent node and, if appliccable, an int giving the child indexmergeCMT
- if children are transformed by this when they are
attached, used for mergeUnnamedprotected static void loadChildrenFromJ3D(Link linkageRoot, javax.media.j3d.Group j3dGroup, boolean loadBodyShapes, int j3dFormatMask, boolean mergeUnnamed, java.lang.StringBuffer j3dPath, vona.math.RX mergeCMT, char type)
Helper for loadFromJ3D(Link, Node, boolean, int, boolean,
StringBuffer, RX)
that loads correspondents to the children of
j3dGroup to linkageRoot.