Appearance3DChooser (1.1) - README

Frédéric Roudaut
Creation : 03/2009
Last Update: Sun September 27 2009 03:12:33 AM
1 - INTRODUCTION
2 - NEEDS AND INSTALLATION
     2.1 - The Source Package
     2.2 - The Whole Package
3 - USING AS A Java3D APPEARANCE DEMONSTRATOR
     3.1 - The Rendering Panel
     3.2 - The Material Panel
     3.3 - The Transparency Panel
     3.4 - The Texture Panel
     3.5 - The System Info Panel
     3.6 - The 3D Info & Characteristics Panel
     3.7 - The Java Info Panel
     3.8 - The User Info Panel
     3.9 - The Parameters Values Info Panel
4 - USING AS A 3D APPEARANCE MODELOR
     4.1 - The Appearance3DChooserPanel Class
     4.2 - The Appearance3DChooser Class
5 - UPDATES
6 - CREDITS AND LICENCE
7 - BUGS
 

1 - INTRODUCTION

Appearance3DChooser.png

Appearance3DChooser is born from a projet I have concerning the update of Java3D Material on a live Scene. For those that does not know, Java3D is a Java API that enables the creation of three-dimensional graphics applications and Internet-based 3D applets. It provides high-level constructs for creating and manipulation 3D geometry and building the structures used in rendering that geometry.

Appearance3DChooser will let you play with some of the parameters of a Java3D Appearance object. The Appearance object defines all rendering state that can be set as a component object of a Shape3D node. The rendering state consists of the following:

  • Coloring attributes - defines attributes used in color selection and shading. These attributes are defined in a ColoringAttributes object.
  • Line attributes - defines attributes used to define lines, including the pattern, width, and whether antialiasing is to be used. These attributes are defined in a LineAttributes object.
  • Point attributes - defines attributes used to define points, including the size and whether antialiasing is to be used. These attributes are defined in a PointAttributes object.
  • Polygon attributes - defines the attributes used to define polygons, including culling, rasterization mode (filled, lines, or points), constant offset, offset factor, and whether back back facing normals are flipped. These attributes are defined in a PolygonAttributes object.
  • Rendering attributes - defines rendering operations, including the alpha test function and test value, the raster operation, whether vertex colors are ignored, whether invisible objects are rendered, and whether the depth buffer is enabled. These attributes are defined in a RenderingAttributes object.
  • Transparency attributes - defines the attributes that affect transparency of the object, such as the transparency mode (blended, screen-door), blending function (used in transparency and antialiasing operations), and a blend value that defines the amount of transparency to be applied to this Appearance component object.
  • Material - defines the appearance of an object under illumination, such as the ambient color, diffuse color, specular color, emissive color, and shininess. These attributes are defined in a Material object.
  • Texture - defines the texture image and filtering parameters used when texture mapping is enabled. These attributes are defined in a Texture object.
  • Texture attributes - defines the attributes that apply to texture mapping, such as the texture mode, texture transform, blend color, and perspective correction mode. These attributes are defined in a TextureAttributes object.
  • Texture coordinate generation - defines the attributes that apply to texture coordinate generation, such as whether texture coordinate generation is enabled, coordinate format (2D or 3D coordinates), coordinate generation mode (object linear, eye linear, or spherical reflection mapping), and the R, S, and T coordinate plane equations. These attributes are defined in a TexCoordGeneration object.
  • Texture unit state - array that defines texture state for each of N separate texture units. This allows multiple textures to be applied to geometry. Each TextureUnitState object contains a Texture object, TextureAttributes, and TexCoordGeneration object for one texture unit. If the length of the texture unit state array is greater than 0, then the array is used for all texture state; the individual Texture, TextureAttributes, and TexCoordGeneration objects in this Appearance object are not used and must not be set by an application. If the length of the texture unit state array is 0, the multi-texture is disabled and the Texture, TextureAttributes, and TexCoordGeneration objects in the Appearance object are used. If the application sets the existing Texture, TextureAttributes, and TexCoordGeneration objects to non-null values, they effectively define the state for texture unit 0. If the TextureUnitState array is set to a non-null, non-empty array, the individual TextureUnitState objects define the state for texture units 0 through n -1. If both the old and new values are set, an exception is thrown.

Each Time a parameter is updated, an associated event is fired and then may be used for updating a component in a live scene.

Moreover you also have a rendering view to check the result before applying it. Thus it may also be a good option before fixing parameters on a Java3D scene.

This component uses the following libraries :

  • Java3D
  • Jfreechart
  • Jcommon
  • ColorPicker (Slightly modified)

All the source code is commented with Javadoc and you may parse it from Here.

Now, if you want to have a look to an applet version of this component, you must follow this Link.

2 - NEEDS AND INSTALLATION

Because it has been written in JAVA, it is not dedicated to a particular OS ... then if you use Windows, Linux, or whatever, it does not matter ...

First of all, you need the Tool with associated libraries ;-). You may get it from 2 differents packagesThe first one contains only the source, and the Jar exemples, the other one contains the source, the Jar exemples and the associated libraries. It's up to you !

Then you also need a Java Environment. Get it from Sun JDK. Be sure you have the java and eventually the javac commands into you path.

We would like to remind 2 importants parameters that may be used during the call to the java command :

  • -Xmx : useful to fix the maximum amount of memory to use into the JVM (default is 64MB). -Xmx256M fixes it to 256MB
  • -Dj3d.rend : Win32-only. Specifies which underlying rendering API should be used (thus allowing both Direct3D (d3d) and OpenGL native (ogl) DLLs to be installed on a singe machine (default value is "ogl"). -Dj3d.rend="d3d" will set it to Direct3D.

2.1 - The Source Package

You may get this package Here.

To compile or to run an exemple of the use of this component you need to install :

  • Java3D. This library is available on most Operating Systems. The version 1.5.1, 1.5.2 needs JDK 1.5 and above.
  • Jfreechart
  • Jcommon

Then you need to compile all the src branch.

2.2 - The Whole Package

This package already contains all the libraries needeed for Windows and Linux. You may get it Here.

Then if you need to compile this component on Windows, you just have to run compile-windows-j3d1.5.1.bat or compile-windows-j3d1.5.2.bat according to the Java3D version you want to use.
compile-windows-j3d1.5.1.bat will use the java version 1.5 whereas the other script will use your current java version (ie > 1.5).

If your System is Linux you may use the script compile-linux-j3d1.5.1.sh or compile-linux-j3d1.5.2.sh (bash ./compile-linux-j3d1.5.X.sh). As for Windows, compile-linux-jd31.5.1.bat will use the java version 1.5 whereas the other script will use your current java version (ie > 1.5).

For running an exemple of this component on Windows you just have to run start-windows-j3d1.5.1.bat (By defaut compiled with java 1.5) or start-windows-j3d1.5.2.bat (By defaut compiled with java 1.6)

If your System is Linux you may use the script start-linux-j3d1.5.1.sh (By defaut compiled with java 1.5) or start-linux-j3d1.5.2.sh (By defaut compiled with java 1.6) (bash ./start-linux-j3d1.5.X.sh)

For others Systems you also have to compile and run the component by yourself ;-(.

3 - USING AS A Java3D APPEARANCE DEMONSTRATOR

Appearance3DChooser may be used to check the rendering on Java3D objects. In particular following objects are available :

  • Material
  • TransparencyAttributes
  • TextureAttributes
  • Lighting

The sections described hereafter will explain the parameters taken into account.

3.1 - The Rendering Panel

The rendering Panel may be used to check the effect of the parametrisation done. You have 4 different views (Right, Front, Left, Top) to check the result and a checkbox to add a bigger Front view. Any Java3D primitive (ie Cone, Cube, Sphere and Cylinder) may be choosen for the scene. In each view you may use the mouse to navigate : the left button handles rotations, the right one handles translations and the middle one is used for the zoom.

RenderPanel-1.png

You may add Antialiasing on the scene and the 3 Axis (x,y,z) to help you to manipulate the objects. Each axis is 1.0 in length. From Version 1.1 you also may change the background color.

You also may add the different Java3D lights into the scene :

  • Ambient Lights
  • Directional Lights
  • Spot Lights
  • Point Lights

By default only one of each light type is shown, but a panel is available to add some more if needed. The resulting lighting will then be applied on each view.

3.2 - The Material Panel

The Material Panel defines the appearance of an object under illumination, such as the ambient color, diffuse color, specular color, emissive color, and shininess. These attributes are defined in a Java3D Material object. It represents the Java3D Material class.

MaterialPanel-1.png MaterialPanel-2.png

  • Emissive : defines the material's emissive color. This is the color of light, if any, that the material emits. The emissive color in this Material object may be overridden by per-vertex colors in some cases. If vertex colors are present in the geometry, and lighting is enabled, and the colorTarget is EMISSIVE, and vertex colors are not being ignored, then the vertex colors are used in place of this Material's emissive color in the lighting equation. The range of values is 0.0 to 1.0. The default emissive color is in general (0.0, 0.0, 0.0) but here it is set to (0.36f, 0.85f, 0.80f).
  • Ambient : defines the material's ambient color. This specifies how much ambient light is reflected by the surface. The ambient color in this Material object may be overridden by per-vertex colors in some cases. If vertex colors are present in the geometry, and lighting is enabled, and the colorTarget is either AMBIENT or AMBIENT_AND_DIFFUSE, and vertex colors are not being ignored, then the vertex colors are used in place of this Material's ambient color in the lighting equation. The range of values is 0.0 to 1.0. The default ambient color is (0.2, 0.2, 0.2).
  • Diffuse : defines the material's diffuse color. This is the color of the material when illuminated by a light source. The diffuse color in this Material object may be overridden by per-vertex colors in some cases. If vertex colors are present in the geometry, and lighting is enabled, and the colorTarget is either DIFFUSE or AMBIENT_AND_DIFFUSE, and vertex colors are not being ignored, then the vertex colors are used in place of this Material's diffuse color in the lighting equation. The range of values is 0.0 to 1.0. The default diffuse color is (1.0, 1.0, 1.0).
  • Specular : defines the material's specular color. This is the specular highlight color of the material. The specular color in this Material object may be overridden by per-vertex colors in some cases. If vertex colors are present in the geometry, and lighting is enabled, and the colorTarget is SPECULAR, and vertex colors are not being ignored, then the vertex colors are used in place of this Material's specular color in the lighting equation. The range of values is 0.0 to 1.0. The default specular color is (1.0, 1.0, 1.0).
  • Lighting : Enables or disables lighting for this appearance component object.
  • Shininess : defines the material's shininess. This specifies a material specular scattering exponent, or shininess. It takes a floating point number in the range [1.0, 128.0] with 1.0 being not shiny and 128.0 being very shiny. The default value for the material's shininess is 64.
  • ColorTarget : Sets the color target for per-vertex colors. When lighting is enabled and per-vertex colors are present (and not ignored) in the geometry for a given Shape3D node, those per-vertex colors are used in place of the specified material color(s) for this Material object. The color target is ignored when lighting is disabled or when per-vertex colors are not used. The ColorInterpolator behavior also uses the color target to determine which color in the associated Material is modified. The value is one of: AMBIENT, EMISSIVE, DIFFUSE, SPECULAR, or AMBIENT_AND_DIFFUSE. The default target in Java3D is DIFFUSE.

3.3 - The Transparency Panel

The Transparency Panel defines the attributes that affect transparency of the object, such as the transparency mode (blended, screen-door), blending function (used in transparency and antialiasing operations), and a blend value that defines the amount of transparency to be applied to this Appearance component object. It represents the Java3D TransparencyAttributes class.

TransparencyPanel-1.png

  • Transparency Mode : defines how transparency is applied to this Appearance component object. The default value is NONE.
    • FASTEST - uses the fastest available method for transparency.
    • NICEST - uses the nicest available method for transparency.
    • SCREEN_DOOR - uses screen-door transparency. This is done using an on/off stipple pattern in which the percentage of transparent pixels is approximately equal to the value specified by the transparency parameter.
    • BLENDED - uses alpha blended transparency. The blend equation is specified by the srcBlendFunction and dstBlendFunction attributes. The default equation is:
        alphasrc*src + (1-alphasrc)*dst
      where alphasrc is 1-transparency. When this mode is used with a Raster object or with a Geometry that contains per-vertex colors with alpha, the alpha values in the Raster's image or in the Geometry's per-vertex colors are combined with the transparency value in this TransparencyAttributes object to perform blending. In this case, the alpha value used for blending at each pixel is:
        alphasrc = alphapix * (1-transparency).
    • NONE - no transparency; opaque object.
  • Blend function : used in blended transparency and antialiasing operations.
    The source function specifies the factor that is multiplied by the source color. This value is added to the product of the destination factor and the destination color. The default source blend function is BLEND_SRC_ALPHA. The source blend function is one of the following:
    • BLEND_ZERO - the blend function is f = 0
    • BLEND_ONE - the blend function is f = 1
    • BLEND_SRC_ALPHA - the blend function is f = alphasrc
    • BLEND_ONE_MINUS_SRC_ALPHA - the blend function is f = 1 - alphasrc
    • BLEND_DST_COLOR - the blend function is f = colordst
    • BLEND_ONE_MINUS_DST_COLOR - the blend function is f = 1 - colordst
  • The destination function specifies the factor that is multiplied by the destination color; this value is added to the product of the source factor and the source color. The default destination blend function is BLEND_ONE_MINUS_SRC_ALPHA. The destination blend function is one of the following:
    • BLEND_ZERO - the blend function is f = 0
    • BLEND_ONE - the blend function is f = 1
    • BLEND_SRC_ALPHA - the blend function is f = alphasrc
    • BLEND_ONE_MINUS_SRC_ALPHA - the blend function is f = 1 - alphasrc
    • BLEND_SRC_COLOR - the blend function is f = colorsrc
    • BLEND_ONE_MINUS_SRC_COLOR - the blend function is f = 1 - colorsrc
  • Transparency value : the amount of transparency to be applied to this Appearance component object. The transparency values are in the range [0.0, 1.0], with 0.0 being fully opaque and 1.0 being fully transparent. The default value is 0.0.

3.4 - The Texture Panel

The Texture Panel defines attributes that apply to texture mapping.

TexturePanel-1.png TexturePanel-2.png

The Texture Panel includes the following:

  • Transform : the texture transform object used to transform texture coordinates. The texture transform can translate, scale, or rotate the texture coordinates before the texture is applied to the object.
  • Perspective Correction Mode : the perspective correction mode used for color and texture coordinate interpolation. One of the following:
    • NICEST - uses the nicest (highest quality) available method for texture mapping perspective correction.
    • FASTEST - uses the fastest available method for texture mapping perspective correction.
    The default value is NICEST.
  • Texture mode : defines how the object and texture colors are blended. The mode may be one of the following:
    • MODULATE - modulates the incoming color with the texture color.
        C' = C Ct
    • DECAL - applies the texture color to the incoming color as a decal.
        C'rgb = Crgb (1 - Cta) + Ctrgb Cta C'a = Ca
    • BLEND - blends the texture blend color with the incoming color.
        C'rgb = Crgb (1 - Ctrgb) + Cbrgb Ctrgb C'a = Ca Cta
      Note that if the texture format is INTENSITY, alpha is computed identically to red, green, and blue:
        C'a = Ca (1 - Cta) + Cba Cta
    • REPLACE - replaces the incoming color with the texture color.
        C' = Ct
    • COMBINE - combines the object color with the texture color or texture blend color according to the combine operation as specified in the texture combine mode.
    C = Incoming color to the texture unit state. For texture unit state 0, C is the object color Ct = Texture color
    Cb = Texture blend color
    The default value is REPLACE.
  • Blend color : the constant texture blend color. In General, the default value is (0,0,0,0). Here it is set to (0.5,0.5,0.5,0.5).
  • Combine Mode : defines the RGB/Alpha combine operation when texture mode specifies COMBINE. The combine mode includes the following:
    • COMBINE_REPLACE
        C' = C0
    • COMBINE_MODULATE
        C' = C0 C1
    • COMBINE_ADD
        C' = C0 + C1
    • COMBINE_ADD_SIGNED
        C' = C0 + C1 - 0.5
    • COMBINE_SUBTRACT
        C' = C0 - C1
    • COMBINE_INTERPOLATE
        C' = C0 C2 + C1 (1 - C2)
    • COMBINE_DOT3
        C' = 4 * ( (C0r - 0.5) * (C1r - 0.5) + (C0g - 0.5) * (C1g - 0.5) + (C0b - 0.5) * (C1b - 0.5)) where CNx is the x component of the Nth color operand in the combine operation. The value C' will be placed to the all three r,g,b components or the a component of the output.
  • where C0, C1 and C2 are determined by the color source, and the color operand.
    The default value is COMBINE_MODULATE.
  • Combine Color Source : defines the RGB/Alpha source for a color operand in the combine operation. The color source includes the following:
    • COMBINE_OBJECT_COLOR - object color
    • COMBINE_TEXTURE_COLOR - texture color
    • COMBINE_CONSTANT_COLOR - texture blend color
    • COMBINE_PREVIOUS_TEXTURE_UNIT_STATE - color from the previous texture unit state. For texture unit state 0, this is equivalent to COMBINE_OBJECT_COLOR.
      The default value is (COMBINE_TEXTURE_COLOR, COMBINE_PREVIOUS_TEXTURE_UNIT_STATE, COMBINE_CONSTANT_COLOR).
  • Combine Color Function : specifies the RGB/Alpha function for a color operand in the combine operation. The valid values are:
    • COMBINE_SRC_COLOR - the color function is f = Crgb
    • COMBINE_ONE_MINUS_SRC_COLOR - the color function is f = (1 - Crgb)
    • COMBINE_SRC_ALPHA - the color function is f = Ca
    • COMBINE_ONE_MINUS_SRC_ALPHA - the color function is f = (1 - Ca)
    The function for the alpha component only accepts COMBINE_SRC_ALPHA and COMBINE_ONE_MINUS_SRC_ALPHA.
    For RGB the default value is COMBINE_SRC_COLOR for (C0,C1,C2) and for Alpha it is set to COMBINE_SRC_ALPHA for (C0,C1,C2).
  • Combine scale factor specifies the scale factor to be applied to the output color of the combine operation. The valid values include: 1, 2, or 4. The default value is set to 1.

3.5 - The System Info Panel

The System Info Panel gives information on the system environnement, in particular the architecture, the Operating System and the memory used in real time through the JVM. This panel is accessible from the question mark in the menu bar.

The GC Button may be used to force a Garbage Collector.

SystemInfoPanel-1.png

This panel also gives a flash view on the live Threads.

SystemInfoPanel-2.png

2 Timers may be used to update the Threads information and the Memories dots on the curve.

3.6 - The 3D Info & Characteristics Panel

The Java3D Characteristics Panel queries information from the used Java3D Universe and Canvas. It is accessible from the question mark in the menu bar.

3DInfoPanel.png

In particular this Panel gives the following information :

  • j3d.version
      A String that defines the Java 3D implementation version. The portion of the implementation version string before the first space must adhere to one of the the following three formats (anything after the first space is an optional free-form addendum to the version):
        x.y.z
        x.y.z_p
        x.y.z-ssss
      where:
        x is the major version number
        y is the minor version number
        z is the sub-minor version number
        p is the patch revision number
        ssss is a string, identifying a non-release build (e.g., beta1, build47, rc1, etc.). It may only contain letters, numbers, periods, dashes, or underscores.
  • j3d.vendor
      String that specifies the Java 3D implementation vendor.
  • j3d.specification.version
      A String that defines the Java 3D specification version. This string must be of the following form:
        x.y
      where:
        x is the major version number
        y is the minor version number
      No other characters are allowed in the specification version string.
  • j3d.specification.vendor
      String that specifies the Java 3D specification vendor.
  • j3d.pipeline
      String that specifies the Java 3D rendering pipeline. This could be one of: "NATIVE_OGL", "NATIVE_D3D", or "JOGL". Others could be added in the future.
  • j3d.renderer
      String that specifies the underlying rendering library. This could be one of: "OpenGL" or "DirectX". Others could be added in the future.
  • doubleBufferAvailable
      A Boolean indicating whether or not double buffering is available for this Canvas3D. This is equivalent to the getDoubleBufferAvailable method. If this flag is false, the Canvas3D will be rendered in single buffer mode; requests to enable double buffering will be ignored.
  • stereoAvailable
      A Boolean indicating whether or not stereo is available for this Canvas3D. This is equivalent to the getStereoAvailable method. If this flag is false, the Canvas3D will be rendered in monoscopic mode; requests to enable stereo will be ignored.
  • sceneAntialiasingAvailable
      A Boolean indicating whether or not scene antialiasing is available for this Canvas3D. This is equivalent to the getSceneAntialiasingAvailable method. If this flag is false, requests to enable scene antialiasing will be ignored.
  • sceneAntialiasingNumPasses
      An Integer indicating the number of passes scene antialiasing requires to render a single frame for this Canvas3D. If this value is zero, scene antialiasing is not supported. If this value is one, multisampling antialiasing is used. Otherwise, the number indicates the number of rendering passes needed.
  • texture3DAvailable
      A Boolean indicating whether or not 3D Texture mapping is available for this Canvas3D. If this flag is false, 3D texture mapping is either not supported by the underlying rendering layer or is otherwise unavailable for this particular Canvas3D. All use of 3D texture mapping will be ignored in this case.
  • textureColorTableSize
      An Integer indicating the maximum size of the texture color table for this Canvas3D. If the size is 0, the texture color table is either not supported by the underlying rendering layer or is otherwise unavailable for this particular Canvas3D. An attempt to use a texture color table larger than textureColorTableSize will be ignored; no color lookup will be performed.
  • textureLodRangeAvailable
      A Boolean indicating whether or not setting only a subset of mipmap levels and setting a range of texture LOD are available for this Canvas3D. If it indicates false, setting a subset of mipmap levels and setting a texture LOD range are not supported by the underlying rendering layer, and an attempt to set base level, or maximum level, or minimum LOD, or maximum LOD will be ignored. In this case, images for all mipmap levels must be defined for the texture to be valid.
  • textureLodOffsetAvailable
      A Boolean indicating whether or not setting texture LOD offset is available for this Canvas3D. If it indicates false, setting texture LOD offset is not supported by the underlying rendering layer, and an attempt to set the texture LOD offset will be ignored.
  • textureWidthMax
      An Integer indicating the maximum texture width supported by this Canvas3D. If the width of a texture exceeds the maximum texture width for a Canvas3D, then the texture will be effectively disabled for that Canvas3D.
  • textureHeightMax
      An Integer indicating the maximum texture height supported by this Canvas3D. If the height of a texture exceeds the maximum texture height for a Canvas3D, then the texture will be effectively disabled for that Canvas3D.
  • textureBoundaryWidthMax
      An Integer indicating the maximum texture boundary width supported by the underlying rendering layer for this Canvas3D. If the maximum supported texture boundary width is 0, then texture boundary is not supported by the underlying rendering layer. An attempt to specify a texture boundary width > the textureBoundaryWidthMax will effectively disable the texture.
  • textureEnvCombineAvailable
      A Boolean indicating whether or not texture environment combine operation is supported for this Canvas3D. If it indicates false, then texture environment combine is not supported by the underlying rendering layer, and an attempt to specify COMBINE as the texture mode will be ignored. The texture mode in effect will be REPLACE.
  • textureCombineDot3Available
      A Boolean indicating whether or not texture combine mode COMBINE_DOT3 is supported for this Canvas3D. If it indicates false, then texture combine mode COMBINE_DOT3 is not supported by the underlying rendering layer, and an attempt to specify COMBINE_DOT3 as the texture combine mode will be ignored. The texture combine mode in effect will be COMBINE_REPLACE.
  • textureCombineSubtractAvailable
      A Boolean indicating whether or not texture combine mode COMBINE_SUBTRACT is supported for this Canvas3D. If it indicates false, then texture combine mode COMBINE_SUBTRACT is not supported by the underlying rendering layer, and an attempt to specify COMBINE_SUBTRACT as the texture combine mode will be ignored. The texture combine mode in effect will be COMBINE_REPLACE.
  • textureUnitStateMax
      An Integer indicating the maximum number of texture unit states supported by the underlying rendering layer. Java3D allows an application to specify number of texture unit states more than what the underlying rendering layer supports; in this case, Java3D will use multi-pass to support the specified number of texture unit states.
  • textureCubeMapAvailable
      A Boolean indicating whether or not texture cube map is supported for this Canvas3D. If it indicates false, then texture cube map is not supported by the underlying rendering layer, and an attempt to specify NORMAL_MAP or REFLECTION_MAP as the texture generation mode will be ignored. The texture generation mode in effect will be SPHERE_MAP.
  • textureDetailAvailable
      A Boolean indicating whether or not detail texture is supported for this Canvas3D. If it indicates false, then detail texture is not supported by the underlying rendering layer, and an attempt to specify LINEAR_DETAIL, LINEAR_DETAIL_ALPHA or LINEAR_DETAIL_RGB as the texture magnification filter mode will be ignored. The texture magnification filter mode in effect will be BASE_LEVEL_LINEAR.
  • textureSharpenAvailable
      A Boolean indicating whether or not sharpen texture is supported for this Canvas3D. If it indicates false, then sharpen texture is not supported by the underlying rendering layer, and an attempt to specify LINEAR_SHARPEN, LINEAR_SHARPEN_ALPHA or LINEAR_SHARPEN_RGB as the texture magnification filter mode will be ignored. The texture magnification filter mode in effect will be BASE_LEVEL_LINEAR.
  • textureFilter4Available
      A Boolean indicating whether or not filter4 is supported for this Canvas3D. If it indicates flase, then filter4 is not supported by the underlying rendering layer, and an attempt to specify FILTER_4 as the texture minification filter mode or texture magnification filter mode will be ignored. The texture filter mode in effect will be BASE_LEVEL_LINEAR.
  • textureAnisotropicFilterDegreeMax
      A Float indicating the maximum degree of anisotropic filter available for this Canvas3D. If it indicates 1.0, setting anisotropic filter is not supported by the underlying rendering layer, and an attempt to set anisotropic filter degree will be ignored.
  • compressedGeometry.majorVersionNumber
    compressedGeometry.minorVersionNumber
    compressedGeometry.minorMinorVersionNumber
      Integers indicating the major, minor, and minor-minor version numbers, respectively, of the version of compressed geometry supported by this version of Java 3D.
  • native.version
      A String indicating the version number of the native graphics library. The format of this string is defined by the native library.

3.7 - The Java Info Panel

The Java Info Panel gives information related to Java, ie the Java Version and the JRE used, the CLASSPATH ... It is accessible from the question mark in the menu bar.

JavaInfoPanel-1.png

This Panel also shows all the used classes and their version.

JavaInfoPanel-2.png

Through this Panel it is also possible to see all the defined Java System properties.

JavaInfoPanel-3.png

3.8 - The User Info Panel

The User Info Panel gives mostly information related to the user, ie your Login, you Home directory, your language ... It is accessible from the question mark in the menu bar.

UserInfoPanel-1.png

3.9 - The Parameters Values Info Panel

The Parameters Values Info Panel summarizes all the Appearance3DChooser values that are handled by this component for a java3D Appearence object.

ParametersInfoPanel-1.png

4 - USING AS A 3D APPEARANCE MODELOR

We remind that all the source code is commented with Javadoc and you may parse it from Here.

4.1 - The Appearance3DChooserPanel Class

The Appearance3DChooser component may be used in your live scene to update your objects appearances. Indeed, as soon as a property is modified a Java Event is fired and then you may easily catch it.

Here are the Events eventually fired by this class :

  • Material Panel
    • SPECULAR
    • AMBIENT
    • EMISSIVE
    • DIFFUSE
    • COLORTARGET
    • SHININESS
    • LIGHTING
  • Transparency Panel
    • TRANSPARENCY
    • TRANSPARENCY_MODE
    • TRANSPARENCY_SRC_BLEND_FUNCTION
    • TRANSPARENCY_DST_BLEND_FUNCTION
  • Texture Panel
    • TEXTURE_FILE
    • TEXTURE_USE
    • TEXTURE_TRANSFORM
    • TEXTURE_PERSPECTIVE_CORRECTION_MODE
    • TEXTURE_MODE
    • TEXTURE_BLEND
    • TEXTURE_COMBINE_RGB_MODE
    • TEXTURE_COMBINE_RGB_SOURCE
    • TEXTURE_COMBINE_RGB_FUNCTION
    • TEXTURE_COMBINE_RGB_SCALE
    • TEXTURE_COMBINE_ALPHA_MODE
    • TEXTURE_COMBINE_ALPHA_SOURCE
    • TEXTURE_COMBINE_ALPHA_FUNCTION
    • TEXTURE_COMBINE_ALPHA_SCALE

Some functions are then available to get or set the associated values. Even if in the interfaces, values are not shown according to the Java3D ranges, these functions always use the validity ranges.
You will get some more details Here.

Here is an exemple on how to use it with catching all the Events and printing the corresponding values.

final Appearance3DChooserPanel m1 = new Appearance3DChooserPanel(true, true, true, true);

m1.addPropertyChangeListener(new PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent evt) {
if(evt.getPropertyName().compareTo(Appearance3DChooserPanel.AMBIENT) == 0)
{
System.out.println("AMBIENT : ("
+ m1.getAmbientColor()[0]+ ","
+ m1.getAmbientColor()[1] + ","
+ m1.getAmbientColor()[2]+")");
}
else if (evt.getPropertyName().compareTo(Appearance3DChooserPanel.EMISSIVE) == 0)
{
System.out.println("EMISSIVE : ("
+ m1.getEmissiveColor()[0]+ ","
+ m1.getEmissiveColor()[1] + ","
+ m1.getEmissiveColor()[2]+")");
}
else if (evt.getPropertyName().compareTo(Appearance3DChooserPanel.SPECULAR) == 0)
{
System.out.println("SPECULAR : ("
+ m1.getSpecularColor()[0]+ ","
+ m1.getSpecularColor()[1]+ ","
+ m1.getSpecularColor()[2]+")");
}
else if (evt.getPropertyName().compareTo(Appearance3DChooserPanel.DIFFUSE) == 0)
{
System.out.println("DIFFUSE : ("
+ m1.getDiffuseColor()[0] + ","
+ m1.getDiffuseColor()[1] + ","
+ m1.getDiffuseColor()[2]+")");
}
else if (evt.getPropertyName().compareTo(Appearance3DChooserPanel.COLORTARGET) == 0)
{
System.out.println("COLORTARGET : (" + m1.getColorTarget() +")");
}
else if (evt.getPropertyName().compareTo(Appearance3DChooserPanel.SHININESS) == 0)
{
System.out.println("SHININESS : (" + m1.getShininess() + ")");
}
else if (evt.getPropertyName().compareTo(Appearance3DChooserPanel.LIGHTING) == 0)
{
System.out.println("LIGHTING : (" + m1.getLighting() +")");
}
else if (evt.getPropertyName().compareTo(Appearance3DChooserPanel.TRANSPARENCY) == 0)
{
System.out.println("TRANSPARENCY : (" + m1.getTransparency() +")");
}
else if (evt.getPropertyName().compareTo(Appearance3DChooserPanel.TRANSPARENCY_MODE) == 0)
{
System.out.println("TRANSPARENCY_MODE : (" + m1.getTransparencyMode() +")");
}
else if (evt.getPropertyName().compareTo(Appearance3DChooserPanel.TRANSPARENCY_SRC_BLEND_FUNCTION) == 0)
{
System.out.println("TRANSPARENCY_SRC_BLEND_FUNCTION : (" + m1.getTransparencySrcBlendFunction() +")");
}
else if (evt.getPropertyName().compareTo(Appearance3DChooserPanel.TRANSPARENCY_DST_BLEND_FUNCTION) == 0)
{
System.out.println("TRANSPARENCY_DST_BLEND_FUNCTION : (" + m1.getTransparencyDstBlendFunction() +")");
}
else if (evt.getPropertyName().compareTo(Appearance3DChooserPanel.TEXTURE_USE) == 0)
{
System.out.println("TEXTURE_USE : (" + m1.isTextureSet() +")");
}
else if (evt.getPropertyName().compareTo(Appearance3DChooserPanel.TEXTURE_FILE) == 0)
{
System.out.println("TEXTURE_FILE : (" + m1.getTextureFile() +")");
}
else if (evt.getPropertyName().compareTo(Appearance3DChooserPanel.TEXTURE_TRANSFORM) == 0)
{
System.out.println("TEXTURE_TRANSFORM1 : \n" + m1.getTextureTransform() );
System.out.println("Scale : x="
+ m1.getTextureTransformScaleX() + ", y="
+ m1.getTextureTransformScaleY());
System.out.println("Translation : x="
+ m1.getTextureTransformTranslatX() + ", y="
+ m1.getTextureTransformTranslatY());
System.out.println("Rotation : z=" + m1.getTextureTransformRotZ());
}
else if (evt.getPropertyName().compareTo(Appearance3DChooserPanel.TEXTURE_PERSPECTIVE_CORRECTION_MODE) == 0)
{
System.out.println("TEXTURE_PERSPECTIVE_CORRECTION_MODE : (" + m1.getTexturePerspectiveCorrectionMode() +")");
}
else if (evt.getPropertyName().compareTo(Appearance3DChooserPanel.TEXTURE_MODE) == 0)
{
System.out.println("TEXTURE_MODE : (" + m1.getTextureMode() +")");
}
else if (evt.getPropertyName().compareTo(Appearance3DChooserPanel.TEXTURE_BLEND) == 0)
{
System.out.println("TEXTURE_BLEND : (" +
m1.getTextureBlendColor()[0] + "," +
m1.getTextureBlendColor()[1] + "," +
m1.getTextureBlendColor()[2] + "," +
m1.getTextureBlendColor()[3]
+ ")");
}
else if (evt.getPropertyName().compareTo(Appearance3DChooserPanel.TEXTURE_COMBINE_RGB_MODE) == 0)
{
System.out.println("TEXTURE_COMBINE_RGB_MODE : (" + m1.getTextureCombineRGBMode() +")");
}
else if (evt.getPropertyName().compareTo(Appearance3DChooserPanel.TEXTURE_COMBINE_RGB_SOURCE) == 0)
{
System.out.println("TEXTURE_COMBINE_RGB_SOURCE : (" +
m1.getTextureCombineRGBSource()[0] + "," +
m1.getTextureCombineRGBSource()[1] + "," +
m1.getTextureCombineRGBSource()[2]
+ ")");
}
else if (evt.getPropertyName().compareTo(Appearance3DChooserPanel.TEXTURE_COMBINE_RGB_FUNCTION) == 0)
{
System.out.println("TEXTURE_COMBINE_RGB_FUNCTION : (" +
m1.getTextureCombineRGBFunction()[0] + "," +
m1.getTextureCombineRGBFunction()[1] + "," +
m1.getTextureCombineRGBFunction()[2]
+ ")");
}
else if (evt.getPropertyName().compareTo(Appearance3DChooserPanel.TEXTURE_COMBINE_RGB_SCALE) == 0)
{
System.out.println("TEXTURE_COMBINE_RGB_SCALE : (" + m1.getTextureCombineRGBScale() +")");
}
else if (evt.getPropertyName().compareTo(Appearance3DChooserPanel.TEXTURE_COMBINE_ALPHA_MODE) == 0)
{
System.out.println("TEXTURE_COMBINE_ALPHA_MODE : (" + m1.getTextureCombineAlphaMode() +")");
}
else if (evt.getPropertyName().compareTo(Appearance3DChooserPanel.TEXTURE_COMBINE_ALPHA_SOURCE) == 0)
{
System.out.println("TEXTURE_COMBINE_ALPHA_SOURCE : (" +
m1.getTextureCombineAlphaSource()[0] + "," +
m1.getTextureCombineAlphaSource()[1] + "," +
m1.getTextureCombineAlphaSource()[2]
+ ")");
}
else if (evt.getPropertyName().compareTo(Appearance3DChooserPanel.TEXTURE_COMBINE_ALPHA_FUNCTION) == 0)
{
System.out.println("TEXTURE_COMBINE_ALPHA_FUNCTION : (" +
m1.getTextureCombineAlphaFunction()[0] + "," +
m1.getTextureCombineAlphaFunction()[1] + "," +
m1.getTextureCombineAlphaFunction()[2]
+ ")");
}
else if (evt.getPropertyName().compareTo(Appearance3DChooserPanel.TEXTURE_COMBINE_ALPHA_SCALE) == 0)
{
System.out.println("TEXTURE_COMBINE_ALPHA_SCALE : (" + m1.getTextureCombineAlphaScale() +")");
}

}});

If you want to put aside some Panels you may do it during the call of the constructor. Indeed the constructor Appearance3DChooserPanel has to be called with 4 booleans set to true if the Panel has to be shown and false otherwise.

In the correct order they are :

  • the Material Panel
  • the Transparency Panel
  • the Texture Panel
  • the Rendering Panel

4.2 - The Appearance3DChooser Class

This is perhaps the Class you want to use. It is quite similar to the previous one, but this time it includes :

  • A menu bar with some submenus for the Help, the java3D characteristics, the user info, the java info, the system info and a About Panel.
  • three more buttons : one for OK, one for CANCEL and now one for RESET

The basic behaviour is identical to the Appearance3DChooserPanel class. Ie as soon as a property is modified a Java Event that you may catch is fired. Nevertheless if you click the CANCEL button, the initial values are then fired before leaving.

The Events are similar to those of the Appearance3DChooserPanel class :

  • Material Panel
    • SPECULAR
    • AMBIENT
    • EMISSIVE
    • DIFFUSE
    • COLORTARGET
    • SHININESS
    • LIGHTING
  • Transparency Panel
    • TRANSPARENCY
    • TRANSPARENCY_MODE
    • TRANSPARENCY_SRC_BLEND_FUNCTION
    • TRANSPARENCY_DST_BLEND_FUNCTION
  • Texture Panel
    • TEXTURE_FILE
    • TEXTURE_USE
    • TEXTURE_TRANSFORM
    • TEXTURE_PERSPECTIVE_CORRECTION_MODE
    • TEXTURE_MODE
    • TEXTURE_BLEND
    • TEXTURE_COMBINE_RGB_MODE
    • TEXTURE_COMBINE_RGB_SOURCE
    • TEXTURE_COMBINE_RGB_FUNCTION
    • TEXTURE_COMBINE_RGB_SCALE
    • TEXTURE_COMBINE_ALPHA_MODE
    • TEXTURE_COMBINE_ALPHA_SOURCE
    • TEXTURE_COMBINE_ALPHA_FUNCTION
    • TEXTURE_COMBINE_ALPHA_SCALE

As before, some functions are then available to get or set the associated values, in particular the initial ones. Even if in the interfaces, values are not shown according to the Java3D ranges, these functions always use the validity ranges.
You will get some more details Here.

Here is an exemple on how to use it with catching all the Events and printing the corresponding values.

final Appearance3DChooser m2 = new Appearance3DChooser("test2", true, true, true, true);

m2.runListeners();

m2.addPropertyChangeListener(new PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent evt)
{
if (evt.getPropertyName().compareTo(Appearance3DChooser.SPECULAR) == 0)
{
System.out.println("SPECULAR2 : ("
+ m2.getSpecularColor()[0]+ ","
+ m2.getSpecularColor()[1]+ ","
+ m2.getSpecularColor()[2]+")");
}
else if (evt.getPropertyName().compareTo(Appearance3DChooser.AMBIENT) == 0)
{
System.out.println("AMBIENT2 : ("
+ m2.getAmbientColor()[0]+ ","
+ m2.getAmbientColor()[1] + ","
+ m2.getAmbientColor()[2]+")");
}
else if (evt.getPropertyName().compareTo(Appearance3DChooser.EMISSIVE) == 0)
{
System.out.println("EMISSIVE2 : ("
+ m2.getEmissiveColor()[0]+ ","
+ m2.getEmissiveColor()[1] + ","
+ m2.getEmissiveColor()[2]+")");
}
else if (evt.getPropertyName().compareTo(Appearance3DChooser.DIFFUSE) == 0)
{
System.out.println("DIFFUSE2 : ("
+ m2.getDiffuseColor()[0] + ","
+ m2.getDiffuseColor()[1] + ","
+ m2.getDiffuseColor()[2]+")");
}
else if (evt.getPropertyName().compareTo(Appearance3DChooser.COLORTARGET) == 0)
{
System.out.println("COLORTARGET2 : ("
+ m2.getColorTarget() +")");
}
else if (evt.getPropertyName().compareTo(Appearance3DChooser.SHININESS) == 0)
{
System.out.println("SHININESS2 : (" + m2.getShininess() + ")");
}
else if (evt.getPropertyName().compareTo(Appearance3DChooser.LIGHTING) == 0)
{
System.out.println("LIGHTING2 : (" + m2.getLighting() +")");
}
else if (evt.getPropertyName().compareTo(Appearance3DChooser.TRANSPARENCY) == 0)
{
System.out.println("TRANSPARENCY2 : (" + m2.getTransparency() +")");
}
else if (evt.getPropertyName().compareTo(Appearance3DChooser.TRANSPARENCY_MODE) == 0)
{
System.out.println("TRANSPARENCY_MODE2 : (" + m2.getTransparencyMode() +")");
}
else if (evt.getPropertyName().compareTo(Appearance3DChooser.TRANSPARENCY_SRC_BLEND_FUNCTION) == 0)
{
System.out.println("TRANSPARENCY_SRC_BLEND_FUNCTION2 : (" + m2.getTransparencySrcBlendFunction() +")");
}
else if (evt.getPropertyName().compareTo(Appearance3DChooser.TRANSPARENCY_DST_BLEND_FUNCTION) == 0)
{
System.out.println("TRANSPARENCY_DST_BLEND_FUNCTION2 : (" + m2.getTransparencyDstBlendFunction() +")");
}
else if (evt.getPropertyName().compareTo(Appearance3DChooserPanel.TEXTURE_USE) == 0)
{
System.out.println("TEXTURE_USE2 : (" + m2.isTextureSet() +")");
}
else if (evt.getPropertyName().compareTo(Appearance3DChooser.TEXTURE_FILE) == 0)
{
System.out.println("TEXTURE_FILE2 : (" + m2.getTextureFile() +")");
}
else if (evt.getPropertyName().compareTo(Appearance3DChooser.TEXTURE_TRANSFORM) == 0)
{
System.out.println("TEXTURE_TRANSFORM2 : \n" + m2.getTextureTransform() );
System.out.println("Scale : x="
+ m2.getTextureTransformScaleX()
+ ", y=" +m2.getTextureTransformScaleY());
System.out.println("Translation : x="
+ m2.getTextureTransformTranslatX() + ", y="
+ m2.getTextureTransformTranslatY());
System.out.println("Rotation : z=" + m2.getTextureTransformRotZ());
}
else if (evt.getPropertyName().compareTo(Appearance3DChooser.TEXTURE_PERSPECTIVE_CORRECTION_MODE) == 0)
{
System.out.println("TEXTURE_PERSPECTIVE_CORRECTION_MODE2 : (" + m2.getTexturePerspectiveCorrectionMode() +")");
}
else if (evt.getPropertyName().compareTo(Appearance3DChooser.TEXTURE_MODE) == 0)
{
System.out.println("TEXTURE_MODE2 : (" + m2.getTextureMode() +")");
}
else if (evt.getPropertyName().compareTo(Appearance3DChooser.TEXTURE_BLEND) == 0)
{
System.out.println("TEXTURE_BLEND2 : (" +
m2.getTextureBlendColor()[0] + "," +
m2.getTextureBlendColor()[1] + "," +
m2.getTextureBlendColor()[2] + "," +
m2.getTextureBlendColor()[3]
+ ")");
}
else if (evt.getPropertyName().compareTo(Appearance3DChooserPanel.TEXTURE_COMBINE_RGB_MODE) == 0)
{
System.out.println("TEXTURE_COMBINE_RGB_MODE2 : (" + m2.getTextureCombineRGBMode() +")");
}
else if (evt.getPropertyName().compareTo(Appearance3DChooserPanel.TEXTURE_COMBINE_RGB_SOURCE) == 0)
{
System.out.println("TEXTURE_COMBINE_RGB_SOURCE2 : (" +
m2.getTextureCombineRGBSource()[0] + "," +
m2.getTextureCombineRGBSource()[1] + "," +
m2.getTextureCombineRGBSource()[2]
+ ")");
}
else if (evt.getPropertyName().compareTo(Appearance3DChooserPanel.TEXTURE_COMBINE_RGB_FUNCTION) == 0)
{
System.out.println("TEXTURE_COMBINE_RGB_FUNCTION2 : (" +
m2.getTextureCombineRGBFunction()[0] + "," +
m2.getTextureCombineRGBFunction()[1] + "," +
m2.getTextureCombineRGBFunction()[2]
+ ")");
}
else if (evt.getPropertyName().compareTo(Appearance3DChooserPanel.TEXTURE_COMBINE_RGB_SCALE) == 0)
{
System.out.println("TEXTURE_COMBINE_RGB_SCALE2 : (" + m2.getTextureCombineRGBScale() +")");
}
else if (evt.getPropertyName().compareTo(Appearance3DChooserPanel.TEXTURE_COMBINE_ALPHA_MODE) == 0)
{
System.out.println("TEXTURE_COMBINE_ALPHA_MODE2 : (" + m2.getTextureCombineAlphaMode() +")");
}
else if (evt.getPropertyName().compareTo(Appearance3DChooserPanel.TEXTURE_COMBINE_ALPHA_SOURCE) == 0)
{
System.out.println("TEXTURE_COMBINE_ALPHA_SOURCE2 : (" +
m2.getTextureCombineAlphaSource()[0] + "," +
m2.getTextureCombineAlphaSource()[1] + "," +
m2.getTextureCombineAlphaSource()[2]
+ ")");
}
else if (evt.getPropertyName().compareTo(Appearance3DChooserPanel.TEXTURE_COMBINE_ALPHA_FUNCTION) == 0)
{
System.out.println("TEXTURE_COMBINE_ALPHA_FUNCTION2 : (" +
m2.getTextureCombineAlphaFunction()[0] + "," +
m2.getTextureCombineAlphaFunction()[1] + "," +
m2.getTextureCombineAlphaFunction()[2]
+ ")");
}
else if (evt.getPropertyName().compareTo(Appearance3DChooserPanel.TEXTURE_COMBINE_ALPHA_SCALE) == 0)
{
System.out.println("TEXTURE_COMBINE_ALPHA_SCALE2 : (" + m2.getTextureCombineAlphaScale() +")");
}

}});

Once again, if you want to put aside some Panels you may do it during the call of the constructor. Indeed the constructor Appearance3DChooser has to be called with 4 booleans set to true if the Panel has to be shown and false otherwise.

In the correct order they are :

  • the Material Panel
  • the Transparency Panel
  • the Texture Panel
  • the Rendering Panel

5 - UPDATES

  • From Version 1.0:
    • Several bugs fixes
    • java Information are now in a separate worskpace and the System Info Windows has been improved.
  • From Version 0.9: Adding of a RESET button.

6 - CREDITS AND LICENCE

gplv3.png

This tool 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 3 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.

7 - BUGS

If you find any bug you may send me reports at:
frederic.roudaut@free.fr

eXTReMe Tracker
Copyright 2007-2011 - Frédéric RoudautLast modified: Sun September 27 2009 03:12:33 AM