public class J3DUtils
extends java.lang.Object
Java3D Utilities.
Copyright (C) 2007 Marsette A. Vona, III
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Modifier and Type | Class and Description |
---|---|
static class |
J3DUtils.ApplyingShapeHandler
Generic
J3DUtils.ShapeHandler impl that delegates to an object
implementing an apply(Object[]) method. |
static interface |
J3DUtils.ShapeHandler
callback interface for
traverseShapes(Node, ShapeHandler) |
Modifier and Type | Field and Description |
---|---|
static javax.vecmath.Color3f |
BLACK_3F
basic colors
|
static javax.vecmath.Color3f |
BLUE_3F
basic colors
|
static javax.media.j3d.BoundingSphere |
BOUNDS_ALL
a bounds that is never disabled
|
private static java.lang.String |
cvsid |
static int |
DEF_ANTI_ALIASING
default for
DEF_TRY_GCT and FALLBACK_GCT |
static int |
DEF_DOUBLE_BUFFER
default for
DEF_TRY_GCT and FALLBACK_GCT |
static int |
DEF_STENCIL
default for
DEF_TRY_GCT |
static int |
DEF_STEREO
default for
DEF_TRY_GCT and FALLBACK_GCT |
static int[] |
DEF_TRY_DEPTH
|
static int[][] |
DEF_TRY_FORMAT
|
static javax.media.j3d.GraphicsConfigTemplate3D[] |
DEF_TRY_GCT
default for
getBestGC() APIs |
static javax.media.j3d.GraphicsConfigTemplate3D |
FALLBACK_GCT
|
static javax.vecmath.Color3f |
GRAY_3F
basic colors
|
static javax.vecmath.Color3f |
GREEN_3F
basic colors
|
static java.lang.String |
J3D_3DS_LOADER_CLASS
external loader class names
|
static java.lang.String |
J3D_VRML97_LOADER_CLASS
external loader class names
|
static javax.vecmath.Point3d |
ORIGIN_3D
(0, 0, 0)
|
static javax.vecmath.Point3f |
ORIGIN_3F
(0, 0, 0)
|
static javax.vecmath.Color3f |
RED_3F
basic colors
|
static javax.vecmath.Color3f |
WHITE_3F
basic colors
|
Constructor and Description |
---|
J3DUtils() |
Modifier and Type | Method and Description |
---|---|
static void |
addMaterialColor(javax.media.j3d.Appearance appearance,
int from,
int to)
|
static void |
addMaterialColor(javax.media.j3d.Material material,
int from,
int to)
Add one of the four colors of a material to another color in that
material.
|
static void |
addMaterialColor(javax.media.j3d.Shape3D shape,
int from,
int to)
|
static void |
addMaterialColorRecursively(javax.media.j3d.Node root,
int from,
int to)
|
static void |
copyMaterialColor(javax.media.j3d.Appearance appearance,
int from,
int to)
|
static void |
copyMaterialColor(javax.media.j3d.Material material,
int from,
int to)
Copy one of the four colors of a material to another color in that
material.
|
static void |
copyMaterialColor(javax.media.j3d.Shape3D shape,
int from,
int to)
|
static void |
copyMaterialColorRecursively(javax.media.j3d.Node root,
int from,
int to)
|
static void |
dump(javax.media.j3d.Transform3D t3d)
dump(Transform3D, PrintStream) to System.out |
static void |
dump(javax.media.j3d.Transform3D t3d,
java.io.PrintStream s)
dumpBestType(javax.media.j3d.Transform3D, java.io.PrintStream) and contents of t3d |
static void |
dumpBestType(javax.media.j3d.Transform3D t3d)
dumpBestType(Transform3D, PrintStream) to System.out |
static void |
dumpBestType(javax.media.j3d.Transform3D t3d,
java.io.PrintStream s)
dumpTransformType(int, java.io.PrintStream) best type of t3d |
static void |
dumpGraph(javax.media.j3d.Appearance a)
dumpGraph(Appearance, PrintStream) to System.out |
static void |
dumpGraph(javax.media.j3d.Appearance a,
java.io.PrintStream s)
Specialized dump of an appearance.
|
protected static void |
dumpGraph(javax.media.j3d.Appearance a,
java.lang.String prefix,
java.lang.String qualifiers,
java.io.PrintStream s)
|
static void |
dumpGraph(javax.media.j3d.Geometry g)
dumpGraph(Geometry, PrintStream) to System.out |
static void |
dumpGraph(javax.media.j3d.Geometry g,
java.io.PrintStream s)
Specialized dump of a geometry.
|
protected static void |
dumpGraph(javax.media.j3d.Geometry g,
java.lang.String prefix,
java.lang.String qualifiers,
java.io.PrintStream s)
impl of
dumpGraph(Geometry, PrintStream) |
static void |
dumpGraph(javax.media.j3d.Group g)
dumpGraph(Group, PrintStream) to System.out |
static void |
dumpGraph(javax.media.j3d.Group g,
java.io.PrintStream s)
Recursively dump
Group g and all its children. |
protected static void |
dumpGraph(javax.media.j3d.Group g,
java.lang.String prefix,
java.lang.String qualifiers,
java.util.Map<javax.media.j3d.SharedGroup,java.lang.Integer> sharedGroups,
java.io.PrintStream s)
Impl of
dumpGraph(Group, PrintStream) . |
static void |
dumpGraph(javax.media.j3d.Link l)
dumpGraph(Link, PrintStream) to System.out |
static void |
dumpGraph(javax.media.j3d.Link l,
java.io.PrintStream s)
Specialized dump of a
Link leaf. |
protected static void |
dumpGraph(javax.media.j3d.Link l,
java.lang.String prefix,
java.lang.String qualifiers,
java.util.Map<javax.media.j3d.SharedGroup,java.lang.Integer> sharedGroups,
java.io.PrintStream s)
Impl of
dumpGraph(Link, PrintStream) , manages collection of
sharedGroups. |
static void |
dumpGraph(com.sun.j3d.loaders.Scene scene)
dumpGraph(Scene, PrintStream) to System.out |
static void |
dumpGraph(javax.media.j3d.SceneGraphObject sgo)
dumpGraph(SceneGraphObject, PrintStream) to System.out |
static void |
dumpGraph(javax.media.j3d.SceneGraphObject sgo,
java.io.PrintStream s)
One-line dump of the type and name (if any) of a
SceneGraphObject . |
protected static void |
dumpGraph(javax.media.j3d.SceneGraphObject sgo,
java.lang.String prefix,
java.lang.String qualifiers,
java.io.PrintStream s,
boolean withNewline)
|
static void |
dumpGraph(com.sun.j3d.loaders.Scene scene,
java.io.PrintStream s)
calls
dumpGraph(Group, PrintStream) on the scene group |
static void |
dumpGraph(javax.media.j3d.Shape3D s3d)
dumpGraph(Shape3D, PrintStream) to System.out |
static void |
dumpGraph(javax.media.j3d.Shape3D s3d,
java.io.PrintStream s)
Specialized dump of a
Shape3D leaf. |
protected static void |
dumpGraph(javax.media.j3d.Shape3D s3d,
java.lang.String prefix,
java.lang.String qualifiers,
java.io.PrintStream s)
impl of
dumpGraph(Shape3D, PrintStream) |
static void |
dumpJ3DProperties()
dumpJ3DProperties(PrintStream) to System.out |
static void |
dumpJ3DProperties(javax.media.j3d.Canvas3D canvas)
dumpJ3DProperties(Canvas3D, PrintStream) , to System.out |
static void |
dumpJ3DProperties(javax.media.j3d.Canvas3D canvas3D,
java.io.PrintStream s)
dump Java3D system, and optionally a Canvas3D's, properties
|
static void |
dumpJ3DProperties(java.io.PrintStream s)
covers
dumpJ3DProperties(Canvas3D, PrintStream) , no canvas |
static void |
dumpTransformType(int type)
dumpTransformType(int, PrintStream) to System.out |
static void |
dumpTransformType(int type,
java.io.PrintStream s)
dump a
Transform3D transform type mask |
static void |
dumpVertexFormat(int vertexFormat)
dumpVertexFormat(int, PrintStream) to System.out |
static void |
dumpVertexFormat(int vertexFormat,
java.io.PrintStream s)
dump a string describing a vertexFormat bitmap
|
static java.awt.GraphicsDevice[] |
getAllGDs()
get all available GraphicsDevices
|
static java.awt.GraphicsConfiguration |
getBestGC()
|
static java.awt.GraphicsConfiguration |
getBestGC(java.awt.Container c)
|
static java.awt.GraphicsConfiguration |
getBestGC(java.awt.Container c,
javax.media.j3d.GraphicsConfigTemplate3D... tryGCT)
Covers getBestGC(GraphicsDevice, GraphicsConfigTemplate3D...)
with graphics device of container c.
|
static java.awt.GraphicsConfiguration |
getBestGC(javax.media.j3d.GraphicsConfigTemplate3D... tryGCT)
|
static java.awt.GraphicsConfiguration |
getBestGC(java.awt.GraphicsDevice gd)
|
static java.awt.GraphicsConfiguration |
getBestGC(java.awt.GraphicsDevice gd,
javax.media.j3d.GraphicsConfigTemplate3D... tryGCT)
For each template in tryGCT, in order, attempt to get the best
compatible graphics configuration for graphics device gd, and
return the first hit, if any, else null.
|
static javax.media.j3d.GraphicsConfigTemplate3D |
getBestGCT()
Covers
getBestGC(GraphicsConfigTemplate3D...)
with DEF_TRY_GCT . |
static javax.media.j3d.GraphicsConfigTemplate3D |
getBestGCT(java.awt.Container c)
|
static javax.media.j3d.GraphicsConfigTemplate3D |
getBestGCT(java.awt.Container c,
javax.media.j3d.GraphicsConfigTemplate3D... tryGCT)
Covers
getBestGC(GraphicsDevice, GraphicsConfigTemplate3D...)
with graphics device of container c. |
static javax.media.j3d.GraphicsConfigTemplate3D |
getBestGCT(javax.media.j3d.GraphicsConfigTemplate3D... tryGCT)
|
static javax.media.j3d.GraphicsConfigTemplate3D |
getBestGCT(java.awt.GraphicsDevice gd)
|
static javax.media.j3d.GraphicsConfigTemplate3D |
getBestGCT(java.awt.GraphicsDevice gd,
javax.media.j3d.GraphicsConfigTemplate3D... tryGCT)
For each template in tryGCT, in order, attempt to get the best
compatible graphics configuration for graphics device gd, and
return the template corresponding to the first hit, if any, else null.
|
static int[] |
getComponentOffsets(int vertexFormat)
getComponentOffsets(int, int[]) , always cons |
static int[] |
getComponentOffsets(int vertexFormat,
int[] offset)
get the start indices for each component of an interleaved vertex
|
static java.awt.GraphicsDevice |
getDefaultGD()
get default GraphicsDevice
|
static java.nio.FloatBuffer |
getFloatBuffer(javax.media.j3d.J3DBuffer j3dBuf)
Dereference the contained NIO buffer in j3dBuf as a
FloatBuffer . |
static java.awt.GraphicsDevice |
getGD(java.awt.Container c)
get GraphicsDevice of a Container, or null if c not realized
|
static java.lang.String |
getInfo(javax.media.j3d.Geometry geometry)
Covers
dumpGraph(Geometry, String, String, PrintStream) , writes
to String. |
static java.lang.String |
getJ3DVersionMessage()
defers to eponymous method in
J3DVersion |
static javax.vecmath.Color3f |
getMaterialColor(javax.media.j3d.Appearance appearance,
int which)
|
static javax.vecmath.Color3f |
getMaterialColor(javax.media.j3d.Appearance appearance,
int which,
javax.vecmath.Color3f color)
|
static javax.vecmath.Color3f |
getMaterialColor(javax.media.j3d.Material material,
int which)
covers
getMaterialColor(Material, int) , always conses |
static javax.vecmath.Color3f |
getMaterialColor(javax.media.j3d.Material material,
int which,
javax.vecmath.Color3f color)
Get one of the four colors of a material.
|
static javax.vecmath.Color3f |
getMaterialColor(javax.media.j3d.Shape3D shape,
int which)
|
static javax.vecmath.Color3f |
getMaterialColor(javax.media.j3d.Shape3D shape,
int which,
javax.vecmath.Color3f color)
|
static java.lang.String |
getName(javax.media.j3d.SceneGraphObject sgo)
Get the name of sgo as it may have been set by
load(URL,
URL, String, int) . |
static boolean |
hasJ3D()
defers to eponymous method in
J3DVersion |
static boolean |
hasJ3D14()
defers to eponymous method in
J3DVersion |
static boolean |
hasJ3D15()
defers to eponymous method in
J3DVersion |
static com.sun.j3d.loaders.Scene |
load(java.io.File sceneFile)
covers
load(File, File, String, int) , uses defaults |
static com.sun.j3d.loaders.Scene |
load(java.io.File sceneFile,
java.io.File baseFile,
java.lang.String format,
int flags)
covers
load(URL, URL, String, int) , loads from file |
static com.sun.j3d.loaders.Scene |
load(java.lang.String sceneFile)
covers
load(String, String, String, int) , uses defaults |
static com.sun.j3d.loaders.Scene |
load(java.lang.String sceneFile,
java.lang.String baseFile,
java.lang.String format,
int flags)
|
static com.sun.j3d.loaders.Scene |
load(java.net.URL sceneURL)
covers
load(URL, URL, String, int) , uses defaults |
static com.sun.j3d.loaders.Scene |
load(java.net.URL sceneURL,
java.net.URL baseURL,
java.lang.String format,
int flags)
Load a Java3D
Scene from a URL. |
static void |
main(java.lang.String[] arg)
|
static java.nio.FloatBuffer |
makeFloatBuffer(int numFloats)
make a new direct native byte order float buffer
|
static javax.media.j3d.GraphicsConfigTemplate3D[] |
makeGCTs(int[][] tryFormat,
int[] tryDepth,
int stencil,
int doubleBuffer,
int stereo,
int antialiasing,
boolean withFallback,
javax.media.j3d.GraphicsConfigTemplate3D[] gct)
Make a priority list of graphics config templates given ordered set of
desired pixel formats and depth buffer widths.
|
static javax.media.j3d.Raster |
makeImageRaster(javax.media.j3d.ImageComponent2D imageComponent)
make a color image raster around an imageComponent
|
static javax.media.j3d.Raster |
makeImageRaster(int width,
int height)
Calls
makeImageRaster(ImageComponent2D) with an image
component from makeRGBImageComponent2D(int, int) . |
static java.nio.IntBuffer |
makeIntBuffer(int numInts)
make a new direct native byte order int buffer
|
static com.sun.j3d.loaders.Loader |
makeLoaderForFormat(java.lang.String format)
Dispatch factory for
load(URL, URL, String, int) mapping a
loader format string to an instance of a Java3D scene
Loader . |
static javax.media.j3d.ImageComponent2D |
makeRGBImageComponent2D(int width,
int height)
make RGB image component with a byRef yUp
BufferedImage |
static int |
numColorComponents(int vertexFormat)
get the number of color components per vertex, no multitexturing
|
static int |
numPrims(javax.media.j3d.GeometryArray ga)
return the prim count of ga
|
static int |
numTexCoords(int vertexFormat)
get the number of texture coords per vertex, no multitexturing
|
static java.nio.FloatBuffer |
resizeBuffer(java.nio.FloatBuffer buffer,
int newSize)
Returns a buffer of newSize floats initialized to the contents
of buffer.
|
static java.nio.IntBuffer |
resizeBuffer(java.nio.IntBuffer buffer,
int newSize)
similar to
resizeBuffer(FloatBuffer, int) |
static boolean |
restoreJOGLSingleThreading()
|
static void |
saveRGBImage(javax.media.j3d.ImageComponent2D imageComponent,
java.io.File file,
java.lang.String format)
Save the
BufferedImage from imageComponent to
file in the given format. |
static void |
saveRGBImage(javax.media.j3d.Raster raster,
java.io.File file,
java.lang.String format)
|
static void |
setAlpha(javax.media.j3d.Appearance appearance,
float alpha,
boolean iffPresent)
set TransparencyAttributes alpha (1.0f-transparency)
|
static void |
setAlpha(javax.media.j3d.Shape3D shape,
float alpha,
boolean iffPresent)
|
static void |
setAlphaRecursively(javax.media.j3d.Node root,
float alpha)
Covers
setAlphaRecursively(Node, float, boolean) , conses if
not present. |
static void |
setAlphaRecursively(javax.media.j3d.Node root,
float alpha,
boolean iffPresent)
setAlpha(Shape3D, float, boolean) via a traverseShapes(Node, ShapeHandler) from root. |
static void |
setBlendedRecursively(javax.media.j3d.Node root)
covers
setBlendedRecursively(Node, boolean) , always conses |
static void |
setBlendedRecursively(javax.media.j3d.Node root,
boolean iffPresent)
|
static void |
setColorTarget(javax.media.j3d.Appearance appearance,
int target,
boolean iffPresent)
|
static void |
setColorTarget(javax.media.j3d.Material material,
int target)
Set the color target of a material.
|
static void |
setColorTarget(javax.media.j3d.Shape3D shape,
int target,
boolean iffPresent)
|
static void |
setFlatShadeModelRecursively(javax.media.j3d.Node root)
|
static void |
setGouraudShadeModelRecursively(javax.media.j3d.Node root)
|
static void |
setIgnoreVertexColors(javax.media.j3d.Appearance appearance,
boolean ignore,
boolean iffPresent)
set whether to ignore per-vertex colors
|
static void |
setIgnoreVertexColors(javax.media.j3d.Shape3D shape,
boolean ignore,
boolean iffPresent)
|
static void |
setIgnoreVertexColorsRecursively(javax.media.j3d.Node root,
boolean ignore)
Covers
setIgnoreVertexColorsRecursively(Node, boolean,
boolean) , conses if not present. |
static void |
setIgnoreVertexColorsRecursively(javax.media.j3d.Node root,
boolean ignore,
boolean iffPresent)
|
static void |
setLightWeightPopupEnabled(boolean enable)
enable/disable Swing lightweight menu and tooltip popups
|
static void |
setLineWidth(javax.media.j3d.Appearance appearance,
float width,
boolean iffPresent)
set LineAttributes lineWidth
|
static void |
setLineWidth(javax.media.j3d.Shape3D shape,
float width,
boolean iffPresent)
|
static void |
setMaterialColor(javax.media.j3d.Appearance appearance,
int which,
javax.vecmath.Color3f color,
boolean iffPresent)
|
static void |
setMaterialColor(javax.media.j3d.Material material,
int which,
javax.vecmath.Color3f color)
Set one of the four colors of a material.
|
static void |
setMaterialColor(javax.media.j3d.Shape3D shape,
int which,
javax.vecmath.Color3f color,
boolean iffPresent)
|
static void |
setMaterialColorRecursively(javax.media.j3d.Node root,
int which,
javax.vecmath.Color3f color)
Covers
setMaterialColorRecursively(Node, int, Color3f,
boolean) , never conses if not present. |
static void |
setMaterialColorRecursively(javax.media.j3d.Node root,
int which,
javax.vecmath.Color3f color,
boolean iffPresent)
|
static void |
setMaterialColorRecursively(javax.media.j3d.Node root,
int which,
float r,
float g,
float b)
|
static boolean |
setPreferredPipeline(java.lang.String preferredPipeline)
Set the system property Java3D considers when choosing a pipeline.
|
static void |
setScreenDoorRecursively(javax.media.j3d.Node root)
Covers
setScreenDoorRecursively(Node, boolean) , always
conses. |
static void |
setScreenDoorRecursively(javax.media.j3d.Node root,
boolean iffPresent)
|
static void |
setShadeModel(javax.media.j3d.Appearance appearance,
int shadeModel,
boolean iffPresent)
set ColoringAttributes shade model
|
static void |
setShadeModel(javax.media.j3d.Shape3D shape,
int shadeModel,
boolean iffPresent)
|
static void |
setShadeModelRecursively(javax.media.j3d.Node root,
int shadeModel)
Covers
setShadeModelRecursively(Node, int, boolean) , conses if
not present. |
static void |
setShadeModelRecursively(javax.media.j3d.Node root,
int shadeModel,
boolean iffPresent)
setShadeModel(Shape3D, int, boolean) via a traverseShapes(Node, ShapeHandler) from root. |
static void |
setTransparencyMode(javax.media.j3d.Appearance appearance,
int transparencyMode,
boolean iffPresent)
set TransparencyAttributes transparency mode
|
static void |
setTransparencyMode(javax.media.j3d.Shape3D shape,
int transparencyMode,
boolean iffPresent)
|
static void |
setTransparencyModeRecursively(javax.media.j3d.Node root,
int transparencyMode)
Covers
setTransparencyModeRecursively(Node, int, boolean) ,
conses if not present. |
static void |
setTransparencyModeRecursively(javax.media.j3d.Node root,
int transparencyMode,
boolean iffPresent)
|
static void |
setTwoSided(javax.media.j3d.Appearance appearance,
boolean twoSided,
boolean iffPresent)
set PolygonAttributes back face normal flip and cull face
|
static void |
setTwoSided(javax.media.j3d.Shape3D shape,
boolean twoSided,
boolean iffPresent)
|
static void |
setTwoSidedRecursively(javax.media.j3d.Node root,
boolean twoSided)
Covers
setTwoSidedRecursively(Node, boolean, boolean) ,
conses if not present. |
static void |
setTwoSidedRecursively(javax.media.j3d.Node root,
boolean twoSided,
boolean iffPresent)
setTwoSided(Shape3D, boolean, boolean) via a traverseShapes(Node, ShapeHandler) from root. |
static void |
setUnlitColor(javax.media.j3d.Appearance appearance,
javax.vecmath.Color3f color,
boolean iffPresent)
set ColoringAttributes color
|
static void |
setUnlitColor(javax.media.j3d.Shape3D shape,
javax.vecmath.Color3f color,
boolean iffPresent)
|
static void |
setUnlitColorRecursively(javax.media.j3d.Node root,
javax.vecmath.Color3f color)
Covers
setUnlitColorRecursively(Node, Color3f, boolean) ,
conses if not present. |
static void |
setUnlitColorRecursively(javax.media.j3d.Node root,
javax.vecmath.Color3f color,
boolean iffPresent)
|
static void |
setUnlitColorRecursively(javax.media.j3d.Node root,
float r,
float g,
float b)
|
static java.lang.String |
textBestType(javax.media.j3d.Transform3D t3d)
covers
dumpBestType(javax.media.j3d.Transform3D, java.io.PrintStream) , writes to String |
static java.lang.String |
textTransformType(int type)
covers
dumpTransformType(int, java.io.PrintStream) , writes to String |
static java.lang.String |
textVertexFormat(int vertexFormat)
covers
dumpVertexFormat(int, java.io.PrintStream) , writes to String |
static void |
traverseShapes(javax.media.j3d.Node root,
J3DUtils.ShapeHandler shapeHandler)
DFS the scene graph starting at root passing each encountered
Shape3D to shapeHandler.
|
protected static boolean |
traverseShapes(javax.media.j3d.Node root,
J3DUtils.ShapeHandler shapeHandler,
java.util.Set<javax.media.j3d.SharedGroup> visitedSharedGroups)
|
static void |
traverseShapes(com.sun.j3d.loaders.Scene scene,
J3DUtils.ShapeHandler shapeHandler)
|
static int |
vertsPerPrim(javax.media.j3d.GeometryArray ga)
get number of vertices per primitive based on the type of ga
|
static int |
wordsPerVertex(int vertexFormat)
get the number of 32-bit words per vertex, no multitexturing
|
static int |
wordsPerVertex(int vertexFormat,
int texCoordSetCount)
get the number of 32-bit words per vertex
|
private static final java.lang.String cvsid
public static final java.lang.String J3D_VRML97_LOADER_CLASS
public static final java.lang.String J3D_3DS_LOADER_CLASS
public static final javax.vecmath.Color3f BLACK_3F
public static final javax.vecmath.Color3f WHITE_3F
public static final javax.vecmath.Color3f GRAY_3F
public static final javax.vecmath.Color3f RED_3F
public static final javax.vecmath.Color3f GREEN_3F
public static final javax.vecmath.Color3f BLUE_3F
public static final javax.vecmath.Point3f ORIGIN_3F
public static final javax.vecmath.Point3d ORIGIN_3D
public static final javax.media.j3d.BoundingSphere BOUNDS_ALL
public static final int[][] DEF_TRY_FORMAT
public static final int[] DEF_TRY_DEPTH
public static final int DEF_STENCIL
DEF_TRY_GCT
public static final int DEF_DOUBLE_BUFFER
DEF_TRY_GCT
and FALLBACK_GCT
public static final int DEF_STEREO
DEF_TRY_GCT
and FALLBACK_GCT
public static final int DEF_ANTI_ALIASING
DEF_TRY_GCT
and FALLBACK_GCT
public static final javax.media.j3d.GraphicsConfigTemplate3D FALLBACK_GCT
public static final javax.media.j3d.GraphicsConfigTemplate3D[] DEF_TRY_GCT
getBestGC()
APIspublic static com.sun.j3d.loaders.Scene load(java.net.URL sceneURL, java.net.URL baseURL, java.lang.String format, int flags) throws java.io.IOException, com.sun.j3d.loaders.IncorrectFormatException, com.sun.j3d.loaders.ParsingErrorException
Load a Java3D Scene
from a URL.
See makeLoaderForFormat(java.lang.String)
for currently supported formats.
The loader is executed with the specified flags to load a Java3D
Scene
. If the Scene
defines any named
SceneGraphObject
s then the names are set on those objects (or
the user data is set to the name in early versions of Java3D which do not
support SceneGraphObject.setName()
).
sceneURL
- the url of the scene, this is just passed to the loader
implementation selected for the formatbaseURL
- if not null then the base URL of the loader is set to this.
If null then the base URL is implied from the sceneURL and set on the
loader (some versions of some loaders have been known not to work
correctly in some contexts if the base URL is not explicitly set).format
- if not null then this is a lower case string identifying the
file format, see above. If null this is implied as the filename extension
of sceneURL.flags
- bitmask of Java3D Loader.LOAD_*
flags to set on
the loader. Zero means load geometry only.java.lang.IllegalArgumentException
- if baseURL is null and there
was an error extracting the base of sceneURL, or if no
Loader
is registered for formatjava.io.IOException
com.sun.j3d.loaders.IncorrectFormatException
com.sun.j3d.loaders.ParsingErrorException
public static com.sun.j3d.loaders.Scene load(java.net.URL sceneURL) throws java.io.IOException, com.sun.j3d.loaders.IncorrectFormatException, com.sun.j3d.loaders.ParsingErrorException
load(URL, URL, String, int)
, uses defaultsjava.io.IOException
com.sun.j3d.loaders.IncorrectFormatException
com.sun.j3d.loaders.ParsingErrorException
public static com.sun.j3d.loaders.Scene load(java.io.File sceneFile, java.io.File baseFile, java.lang.String format, int flags) throws java.io.IOException, com.sun.j3d.loaders.IncorrectFormatException, com.sun.j3d.loaders.ParsingErrorException
load(URL, URL, String, int)
, loads from filejava.io.IOException
com.sun.j3d.loaders.IncorrectFormatException
com.sun.j3d.loaders.ParsingErrorException
public static com.sun.j3d.loaders.Scene load(java.io.File sceneFile) throws java.io.IOException, com.sun.j3d.loaders.IncorrectFormatException, com.sun.j3d.loaders.ParsingErrorException
load(File, File, String, int)
, uses defaultsjava.io.IOException
com.sun.j3d.loaders.IncorrectFormatException
com.sun.j3d.loaders.ParsingErrorException
public static com.sun.j3d.loaders.Scene load(java.lang.String sceneFile, java.lang.String baseFile, java.lang.String format, int flags) throws java.io.IOException, com.sun.j3d.loaders.IncorrectFormatException, com.sun.j3d.loaders.ParsingErrorException
java.io.IOException
com.sun.j3d.loaders.IncorrectFormatException
com.sun.j3d.loaders.ParsingErrorException
public static com.sun.j3d.loaders.Scene load(java.lang.String sceneFile) throws java.io.IOException, com.sun.j3d.loaders.IncorrectFormatException, com.sun.j3d.loaders.ParsingErrorException
load(String, String, String, int)
, uses defaultsjava.io.IOException
com.sun.j3d.loaders.IncorrectFormatException
com.sun.j3d.loaders.ParsingErrorException
public static com.sun.j3d.loaders.Loader makeLoaderForFormat(java.lang.String format)
Dispatch factory for load(URL, URL, String, int)
mapping a
loader format string to an instance of a Java3D scene
Loader
.
Currently supported formats:
format
- a string identifying the file type, will be converted to
lower casejava.lang.IllegalArgumentException
- if no Loader
is
registered for formatpublic static java.lang.String getName(javax.media.j3d.SceneGraphObject sgo)
Get the name of sgo as it may have been set by load(URL,
URL, String, int)
.
public static void setTwoSided(javax.media.j3d.Appearance appearance, boolean twoSided, boolean iffPresent)
public static void setTwoSided(javax.media.j3d.Shape3D shape, boolean twoSided, boolean iffPresent)
public static void setUnlitColor(javax.media.j3d.Appearance appearance, javax.vecmath.Color3f color, boolean iffPresent)
public static void setUnlitColor(javax.media.j3d.Shape3D shape, javax.vecmath.Color3f color, boolean iffPresent)
public static void setShadeModel(javax.media.j3d.Appearance appearance, int shadeModel, boolean iffPresent)
public static void setShadeModel(javax.media.j3d.Shape3D shape, int shadeModel, boolean iffPresent)
public static void setTransparencyMode(javax.media.j3d.Appearance appearance, int transparencyMode, boolean iffPresent)
public static void setTransparencyMode(javax.media.j3d.Shape3D shape, int transparencyMode, boolean iffPresent)
public static void setAlpha(javax.media.j3d.Appearance appearance, float alpha, boolean iffPresent)
public static void setAlpha(javax.media.j3d.Shape3D shape, float alpha, boolean iffPresent)
public static void setLineWidth(javax.media.j3d.Appearance appearance, float width, boolean iffPresent)
public static void setLineWidth(javax.media.j3d.Shape3D shape, float width, boolean iffPresent)
public static void setIgnoreVertexColors(javax.media.j3d.Appearance appearance, boolean ignore, boolean iffPresent)
public static void setIgnoreVertexColors(javax.media.j3d.Shape3D shape, boolean ignore, boolean iffPresent)
public static void setColorTarget(javax.media.j3d.Material material, int target)
Set the color target of a material.
target
- Material.AMBIENT_AND_DIFFUSE or one of the
Material
color index constants, e.g. AMBIENT, DIFFUSE,
EMISSIVE, SPECULARpublic static void setColorTarget(javax.media.j3d.Appearance appearance, int target, boolean iffPresent)
public static void setColorTarget(javax.media.j3d.Shape3D shape, int target, boolean iffPresent)
public static javax.vecmath.Color3f getMaterialColor(javax.media.j3d.Material material, int which, javax.vecmath.Color3f color)
Get one of the four colors of a material.
color
- the color is written here on return, or if null a new Color3f
is consedwhich
- one of the Material
color index constants,
e.g. AMBIENT, DIFFUSE, EMISSIVE, SPECULARpublic static javax.vecmath.Color3f getMaterialColor(javax.media.j3d.Appearance appearance, int which, javax.vecmath.Color3f color)
public static javax.vecmath.Color3f getMaterialColor(javax.media.j3d.Shape3D shape, int which, javax.vecmath.Color3f color)
public static javax.vecmath.Color3f getMaterialColor(javax.media.j3d.Material material, int which)
getMaterialColor(Material, int)
, always consespublic static javax.vecmath.Color3f getMaterialColor(javax.media.j3d.Appearance appearance, int which)
public static javax.vecmath.Color3f getMaterialColor(javax.media.j3d.Shape3D shape, int which)
public static void setMaterialColor(javax.media.j3d.Material material, int which, javax.vecmath.Color3f color)
Set one of the four colors of a material.
which
- one of the Material
color index constants,
e.g. AMBIENT, DIFFUSE, EMISSIVE, SPECULARpublic static void setMaterialColor(javax.media.j3d.Appearance appearance, int which, javax.vecmath.Color3f color, boolean iffPresent)
public static void setMaterialColor(javax.media.j3d.Shape3D shape, int which, javax.vecmath.Color3f color, boolean iffPresent)
public static void copyMaterialColor(javax.media.j3d.Material material, int from, int to)
Copy one of the four colors of a material to another color in that material.
from
- one of the Material
color index constants,
e.g. AMBIENT, DIFFUSE, EMISSIVE, SPECULARto
- another color index constantpublic static void copyMaterialColor(javax.media.j3d.Appearance appearance, int from, int to)
public static void copyMaterialColor(javax.media.j3d.Shape3D shape, int from, int to)
public static void addMaterialColor(javax.media.j3d.Material material, int from, int to)
Add one of the four colors of a material to another color in that material.
from
- one of the Material
color index constants,
e.g. AMBIENT, DIFFUSE, EMISSIVE, SPECULARto
- another color index constantpublic static void addMaterialColor(javax.media.j3d.Appearance appearance, int from, int to)
public static void addMaterialColor(javax.media.j3d.Shape3D shape, int from, int to)
public static void traverseShapes(javax.media.j3d.Node root, J3DUtils.ShapeHandler shapeHandler)
DFS the scene graph starting at root passing each encountered Shape3D to shapeHandler.
Each encountered SharedGroup, if any, will be traversed exactly once.
public static void traverseShapes(com.sun.j3d.loaders.Scene scene, J3DUtils.ShapeHandler shapeHandler)
protected static boolean traverseShapes(javax.media.j3d.Node root, J3DUtils.ShapeHandler shapeHandler, java.util.Set<javax.media.j3d.SharedGroup> visitedSharedGroups)
public static void setTwoSidedRecursively(javax.media.j3d.Node root, boolean twoSided, boolean iffPresent)
setTwoSided(Shape3D, boolean, boolean)
via a traverseShapes(Node, ShapeHandler)
from root.
public static void setTwoSidedRecursively(javax.media.j3d.Node root, boolean twoSided)
Covers setTwoSidedRecursively(Node, boolean, boolean)
,
conses if not present.
public static void setUnlitColorRecursively(javax.media.j3d.Node root, javax.vecmath.Color3f color, boolean iffPresent)
public static void setUnlitColorRecursively(javax.media.j3d.Node root, javax.vecmath.Color3f color)
Covers setUnlitColorRecursively(Node, Color3f, boolean)
,
conses if not present.
public static void setUnlitColorRecursively(javax.media.j3d.Node root, float r, float g, float b)
public static void setShadeModelRecursively(javax.media.j3d.Node root, int shadeModel, boolean iffPresent)
setShadeModel(Shape3D, int, boolean)
via a traverseShapes(Node, ShapeHandler)
from root.
public static void setShadeModelRecursively(javax.media.j3d.Node root, int shadeModel)
Covers setShadeModelRecursively(Node, int, boolean)
, conses if
not present.
public static void setFlatShadeModelRecursively(javax.media.j3d.Node root)
public static void setGouraudShadeModelRecursively(javax.media.j3d.Node root)
public static void setTransparencyModeRecursively(javax.media.j3d.Node root, int transparencyMode, boolean iffPresent)
public static void setTransparencyModeRecursively(javax.media.j3d.Node root, int transparencyMode)
Covers setTransparencyModeRecursively(Node, int, boolean)
,
conses if not present.
public static void setScreenDoorRecursively(javax.media.j3d.Node root, boolean iffPresent)
public static void setScreenDoorRecursively(javax.media.j3d.Node root)
Covers setScreenDoorRecursively(Node, boolean)
, always
conses.
public static void setBlendedRecursively(javax.media.j3d.Node root, boolean iffPresent)
public static void setBlendedRecursively(javax.media.j3d.Node root)
setBlendedRecursively(Node, boolean)
, always consespublic static void setAlphaRecursively(javax.media.j3d.Node root, float alpha, boolean iffPresent)
setAlpha(Shape3D, float, boolean)
via a traverseShapes(Node, ShapeHandler)
from root.
public static void setAlphaRecursively(javax.media.j3d.Node root, float alpha)
Covers setAlphaRecursively(Node, float, boolean)
, conses if
not present.
public static void setIgnoreVertexColorsRecursively(javax.media.j3d.Node root, boolean ignore, boolean iffPresent)
public static void setIgnoreVertexColorsRecursively(javax.media.j3d.Node root, boolean ignore)
Covers setIgnoreVertexColorsRecursively(Node, boolean,
boolean)
, conses if not present.
public static void setMaterialColorRecursively(javax.media.j3d.Node root, int which, javax.vecmath.Color3f color, boolean iffPresent)
public static void setMaterialColorRecursively(javax.media.j3d.Node root, int which, javax.vecmath.Color3f color)
Covers setMaterialColorRecursively(Node, int, Color3f,
boolean)
, never conses if not present.
public static void setMaterialColorRecursively(javax.media.j3d.Node root, int which, float r, float g, float b)
public static void copyMaterialColorRecursively(javax.media.j3d.Node root, int from, int to)
public static void addMaterialColorRecursively(javax.media.j3d.Node root, int from, int to)
public static void dumpGraph(com.sun.j3d.loaders.Scene scene, java.io.PrintStream s)
dumpGraph(Group, PrintStream)
on the scene grouppublic static void dumpGraph(com.sun.j3d.loaders.Scene scene)
dumpGraph(Scene, PrintStream)
to System.outpublic static void dumpGraph(javax.media.j3d.SceneGraphObject sgo, java.io.PrintStream s)
One-line dump of the type and name (if any) of a
SceneGraphObject
.
This serves as a baseline dump; more detailed dumps for particular subclasses are also provided.
javax.media.j3d.CapabilityNotSetException
- if the appropriate capabilities are
not set and sgo is part of live or compiled scene graphpublic static void dumpGraph(javax.media.j3d.SceneGraphObject sgo)
dumpGraph(SceneGraphObject, PrintStream)
to System.outprotected static void dumpGraph(javax.media.j3d.SceneGraphObject sgo, java.lang.String prefix, java.lang.String qualifiers, java.io.PrintStream s, boolean withNewline)
prefix
- this is printed firstqualifiers
- if non-null this is printed next, and then the class and
toString()
, if any, of sgopublic static void dumpGraph(javax.media.j3d.Group g, java.io.PrintStream s)
Recursively dump Group
g and all its children.
javax.media.j3d.CapabilityNotSetException
- if the appropriate capabilities are
not set and g or any of its descendants is part of live or compiled
scene graphpublic static void dumpGraph(javax.media.j3d.Group g)
dumpGraph(Group, PrintStream)
to System.outprotected static void dumpGraph(javax.media.j3d.Group g, java.lang.String prefix, java.lang.String qualifiers, java.util.Map<javax.media.j3d.SharedGroup,java.lang.Integer> sharedGroups, java.io.PrintStream s)
Impl of dumpGraph(Group, PrintStream)
.
sharedGroups
- A map from encountered SharedGroup
s to
unique integers identifying them. If null then this is considered a
top-level call: the graph will be recursively dumped while collecting
referenced shared groups in a newly consed map, and at the end the
contents of this map will be dumped. If non-null then this is a recursive
call: newly encountered shared groups are added to this map.public static void dumpGraph(javax.media.j3d.Link l, java.io.PrintStream s)
Specialized dump of a Link
leaf.
Dumps the leaf and recursively dups its referenced
SharedGroup
if any.
javax.media.j3d.CapabilityNotSetException
- if the appropriate capabilities are
not set and l or its ref are part of live or compiled scene graphpublic static void dumpGraph(javax.media.j3d.Link l)
dumpGraph(Link, PrintStream)
to System.outprotected static void dumpGraph(javax.media.j3d.Link l, java.lang.String prefix, java.lang.String qualifiers, java.util.Map<javax.media.j3d.SharedGroup,java.lang.Integer> sharedGroups, java.io.PrintStream s)
Impl of dumpGraph(Link, PrintStream)
, manages collection of
sharedGroups.
sharedGroups
- if non-null then the ref of this Link
is
resolved, or added if not found, here, and the ref is not
recursively dumped. If null then the ref is recursively dumped.public static void dumpGraph(javax.media.j3d.Shape3D s3d, java.io.PrintStream s)
Specialized dump of a Shape3D
leaf.
All geometries of the shape are dumped.
javax.media.j3d.CapabilityNotSetException
- if the appropriate capabilities are
not set and s3d or any of its geometries are part of live or
compiled scene graphpublic static void dumpGraph(javax.media.j3d.Shape3D s3d)
dumpGraph(Shape3D, PrintStream)
to System.outprotected static void dumpGraph(javax.media.j3d.Shape3D s3d, java.lang.String prefix, java.lang.String qualifiers, java.io.PrintStream s)
dumpGraph(Shape3D, PrintStream)
public static void dumpGraph(javax.media.j3d.Appearance a, java.io.PrintStream s)
Specialized dump of an appearance.
javax.media.j3d.CapabilityNotSetException
- if the appropriate capabilities are
not set and g or is part of live or compiled scene graphpublic static void dumpGraph(javax.media.j3d.Appearance a)
dumpGraph(Appearance, PrintStream)
to System.outprotected static void dumpGraph(javax.media.j3d.Appearance a, java.lang.String prefix, java.lang.String qualifiers, java.io.PrintStream s)
public static void dumpGraph(javax.media.j3d.Geometry g, java.io.PrintStream s)
Specialized dump of a geometry.
Also dumps vertex count and format, strip count, and total primitive count.
javax.media.j3d.CapabilityNotSetException
- if the appropriate capabilities are
not set and g or is part of live or compiled scene graphpublic static void dumpGraph(javax.media.j3d.Geometry g)
dumpGraph(Geometry, PrintStream)
to System.outprotected static void dumpGraph(javax.media.j3d.Geometry g, java.lang.String prefix, java.lang.String qualifiers, java.io.PrintStream s)
dumpGraph(Geometry, PrintStream)
public static java.lang.String getInfo(javax.media.j3d.Geometry geometry)
Covers dumpGraph(Geometry, String, String, PrintStream)
, writes
to String.
public static int numPrims(javax.media.j3d.GeometryArray ga)
public static void dumpVertexFormat(int vertexFormat, java.io.PrintStream s)
public static void dumpVertexFormat(int vertexFormat)
dumpVertexFormat(int, PrintStream)
to System.outpublic static java.lang.String textVertexFormat(int vertexFormat)
dumpVertexFormat(int, java.io.PrintStream)
, writes to Stringpublic static int wordsPerVertex(int vertexFormat, int texCoordSetCount)
public static int wordsPerVertex(int vertexFormat)
public static int numTexCoords(int vertexFormat)
public static int numColorComponents(int vertexFormat)
public static int[] getComponentOffsets(int vertexFormat, int[] offset)
public static int[] getComponentOffsets(int vertexFormat)
getComponentOffsets(int, int[])
, always conspublic static int vertsPerPrim(javax.media.j3d.GeometryArray ga)
public static void dumpBestType(javax.media.j3d.Transform3D t3d, java.io.PrintStream s)
dumpTransformType(int, java.io.PrintStream)
best type of t3dpublic static void dumpBestType(javax.media.j3d.Transform3D t3d)
dumpBestType(Transform3D, PrintStream)
to System.outpublic static java.lang.String textBestType(javax.media.j3d.Transform3D t3d)
dumpBestType(javax.media.j3d.Transform3D, java.io.PrintStream)
, writes to Stringpublic static void dumpTransformType(int type, java.io.PrintStream s)
Transform3D
transform type maskpublic static void dumpTransformType(int type)
dumpTransformType(int, PrintStream)
to System.outpublic static java.lang.String textTransformType(int type)
dumpTransformType(int, java.io.PrintStream)
, writes to Stringpublic static void dump(javax.media.j3d.Transform3D t3d, java.io.PrintStream s)
dumpBestType(javax.media.j3d.Transform3D, java.io.PrintStream)
and contents of t3dpublic static void dump(javax.media.j3d.Transform3D t3d)
dump(Transform3D, PrintStream)
to System.outpublic static boolean hasJ3D()
J3DVersion
public static boolean hasJ3D14()
J3DVersion
public static boolean hasJ3D15()
J3DVersion
public static java.lang.String getJ3DVersionMessage()
J3DVersion
public static void dumpJ3DProperties(javax.media.j3d.Canvas3D canvas3D, java.io.PrintStream s)
public static void dumpJ3DProperties(java.io.PrintStream s)
dumpJ3DProperties(Canvas3D, PrintStream)
, no canvaspublic static void dumpJ3DProperties(javax.media.j3d.Canvas3D canvas)
dumpJ3DProperties(Canvas3D, PrintStream)
, to System.outpublic static void dumpJ3DProperties()
dumpJ3DProperties(PrintStream)
to System.outpublic static java.awt.GraphicsDevice[] getAllGDs()
public static java.awt.GraphicsDevice getDefaultGD()
public static java.awt.GraphicsDevice getGD(java.awt.Container c)
public static javax.media.j3d.GraphicsConfigTemplate3D[] makeGCTs(int[][] tryFormat, int[] tryDepth, int stencil, int doubleBuffer, int stereo, int antialiasing, boolean withFallback, javax.media.j3d.GraphicsConfigTemplate3D[] gct)
Make a priority list of graphics config templates given ordered set of desired pixel formats and depth buffer widths.
The list is prioritized first by format and second by depth, with a total of nf*nd templates generated, plus one additional one if withFallback, where nf is the number of passed formats and nd is the number of passed depths.
tryFormat
- an ordered list of pixel formats, each a triple of ints
giving the desired minimum R, G, and B bitplane widths in that order, if
null then use DEF_TRY_FORMAT
tryDepth
- an ordered list of desired depth buffer widths, if null
then use DEF_TRY_DEPTH
stencil
- the desired stencil plane widthdoubleBuffer
- template status for double bufferstereo
- template status for stereoantialiasing
- template status for antialiasingwithFallback
- whether to also append FALLBACK_GCT
gct
- the generated templates are written here, if non-null and of
sufficient length, else a new array is consedpublic static javax.media.j3d.GraphicsConfigTemplate3D getBestGCT(java.awt.GraphicsDevice gd, javax.media.j3d.GraphicsConfigTemplate3D... tryGCT)
For each template in tryGCT, in order, attempt to get the best compatible graphics configuration for graphics device gd, and return the template corresponding to the first hit, if any, else null.
gd
- the graphics device to use, or null to getDefaultGD()
public static javax.media.j3d.GraphicsConfigTemplate3D getBestGCT(java.awt.GraphicsDevice gd)
public static javax.media.j3d.GraphicsConfigTemplate3D getBestGCT(java.awt.Container c, javax.media.j3d.GraphicsConfigTemplate3D... tryGCT)
Covers getBestGC(GraphicsDevice, GraphicsConfigTemplate3D...)
with graphics device of container c.
public static javax.media.j3d.GraphicsConfigTemplate3D getBestGCT(java.awt.Container c)
public static javax.media.j3d.GraphicsConfigTemplate3D getBestGCT(javax.media.j3d.GraphicsConfigTemplate3D... tryGCT)
public static javax.media.j3d.GraphicsConfigTemplate3D getBestGCT()
Covers getBestGC(GraphicsConfigTemplate3D...)
with DEF_TRY_GCT
.
public static java.awt.GraphicsConfiguration getBestGC(java.awt.GraphicsDevice gd, javax.media.j3d.GraphicsConfigTemplate3D... tryGCT)
For each template in tryGCT, in order, attempt to get the best compatible graphics configuration for graphics device gd, and return the first hit, if any, else null.
gd
- the graphics device to use, or null to getDefaultGD()
public static java.awt.GraphicsConfiguration getBestGC(java.awt.GraphicsDevice gd)
public static java.awt.GraphicsConfiguration getBestGC(java.awt.Container c, javax.media.j3d.GraphicsConfigTemplate3D... tryGCT)
Covers getBestGC(GraphicsDevice, GraphicsConfigTemplate3D...)
with graphics device of container c.
public static java.awt.GraphicsConfiguration getBestGC(java.awt.Container c)
public static java.awt.GraphicsConfiguration getBestGC(javax.media.j3d.GraphicsConfigTemplate3D... tryGCT)
public static java.awt.GraphicsConfiguration getBestGC()
public static javax.media.j3d.ImageComponent2D makeRGBImageComponent2D(int width, int height)
BufferedImage
public static javax.media.j3d.Raster makeImageRaster(javax.media.j3d.ImageComponent2D imageComponent)
public static javax.media.j3d.Raster makeImageRaster(int width, int height)
Calls makeImageRaster(ImageComponent2D)
with an image
component from makeRGBImageComponent2D(int, int)
.
public static void saveRGBImage(javax.media.j3d.ImageComponent2D imageComponent, java.io.File file, java.lang.String format) throws java.io.IOException
Save the BufferedImage
from imageComponent to
file in the given format.
imageComponent
- the image to savefile
- the destination fileformat
- string identifying the image format to write, as per
ImageIO.getImageWritersBySuffix()
, or null to use the
filename extension of filejava.io.IOException
- if file exists, if format is null and
file has no filename extension, or if there was an error writing
filepublic static void saveRGBImage(javax.media.j3d.Raster raster, java.io.File file, java.lang.String format) throws java.io.IOException
java.io.IOException
public static java.nio.FloatBuffer getFloatBuffer(javax.media.j3d.J3DBuffer j3dBuf)
Dereference the contained NIO buffer in j3dBuf as a
FloatBuffer
.
public static java.nio.FloatBuffer makeFloatBuffer(int numFloats)
public static java.nio.IntBuffer makeIntBuffer(int numInts)
public static java.nio.FloatBuffer resizeBuffer(java.nio.FloatBuffer buffer, int newSize)
Returns a buffer of newSize floats initialized to the contents of buffer.
If newSize is less than the limit
of buffer then
only the first newSize floats are copied; if newSize is
greater than the limit
of buffer then only that many floats
are copied.
In the case that newSize equals the capacity
of
buffer then the return value may be buffer itself.
public static java.nio.IntBuffer resizeBuffer(java.nio.IntBuffer buffer, int newSize)
resizeBuffer(FloatBuffer, int)
public static void setLightWeightPopupEnabled(boolean enable)
public static boolean setPreferredPipeline(java.lang.String preferredPipeline)
Set the system property Java3D considers when choosing a pipeline.
This is probably only useful if you call it before calling other Java3D APIs. For example, just consing a VirtualUniverse or adding a Geometry to a non-live Shape3D can cause Java3D to try to init its pipeline.
Note that if the JOGL pipeline is selected and loaded then the current
implementation of Java3D will disable JOGL single threading. If that is
not desired, see restoreJOGLSingleThreading()
.
preferredPipeline
- the preferred pipeline, one of "jogl", "d3d",
"ogl", or "noop"AccessControlException
- if there is a security manager that
won't let us set a system propertypublic static boolean restoreJOGLSingleThreading()
AccessControlException
- if there is a security manager that
won't let us do what we needpublic static void main(java.lang.String[] arg)