diff options
-rw-r--r-- | build.xml | 57 | ||||
-rw-r--r-- | src/javax/media/j3d/Canvas3D.java | 14 | ||||
-rw-r--r-- | src/javax/media/j3d/CanvasViewEventCatcher.java | 7 | ||||
-rw-r--r-- | src/javax/media/j3d/GroupRetained.java | 11 | ||||
-rw-r--r-- | src/javax/media/j3d/JoglPipeline.java | 34 | ||||
-rw-r--r-- | src/javax/media/j3d/MasterControl.java | 21 | ||||
-rw-r--r-- | src/javax/media/j3d/NodeRetained.java | 3 | ||||
-rw-r--r-- | src/javax/media/j3d/VirtualUniverse.java | 7 |
8 files changed, 96 insertions, 58 deletions
@@ -1,34 +1,38 @@ <?xml version="1.0"?> -<project name="j3dall" default="jar" basedir="."> +<project name="j3dall" default="all" basedir="."> <property name="src.dir" location="src"/> <property name="build.dir" location="build"/> <property name="gen.dir" location="${build.dir}/gen"/> <property name="class.dir" location="${build.dir}/classes"/> + <property name="javadoc.dir" location="${build.dir}/javadoc"/> <property name="j3dtools.dir" location="../j3d-utils"/> <property name="j3dtools.src.dir" location="${j3dtools.dir}/src"/> - <property name="vecmath.lib" location="../vecmath/build/jars/vecmath.jar"/> - <property name="jogl.lib" location="../jogl-v2.3.1/jogl-all.jar"/> - <property name="gluegen.lib" location="../jogl-v2.3.1/gluegen-rt.jar"/> - - <property name="version_base" value="1.6.0"/> + <property name="vecmath.dir" location="../vecmath"/> + <property name="vecmath.src.dir" location="${vecmath.dir}/src"/> + <property name="vecmath.lib" location="${vecmath.dir}/build/jars/vecmath.jar"/> + + <property name="jogl.lib" location="../jogl-v2.3.2/jogl-all.jar"/> + <property name="gluegen.lib" location="../jogl-v2.3.2/gluegen-rt.jar"/> + + <property name="version_base" value="1.6.1"/> <property name="build.spec.title" value="3D Graphics API for the Java Platform"/> <property name="build.spec.vendor" value=""/> <property name="build.impl.title" value="3D Graphics API for the Java Platform"/> <property name="build.impl.vendor" value=""/> <property name="build.impl.vendor.id" value=""/> - <property name="build.type" value="daily"/> - <property name="buildtime" value="daily"/> - <property name="buildtime_verbose" value="daily"/> - <property name="is_dev_phase" value="true"/> - <property name="is_production" value="false"/> + <property name="build.type" value="fcs"/> + <property name="buildtime" value="fcs"/> + <property name="buildtime_verbose" value="fcs"/> + <property name="is_dev_phase" value="false"/> + <property name="is_production" value="true"/> <property name="use_verbose_buildtime" value="true"/> - <property name="version_buildnum" value="12"/> - <property name="version_build" value="pre${version_buildnum}"/> + <property name="version_buildnum" value=""/> + <property name="version_build" value=""/> <property name="version_suffix" value="${version_build}"/> <target name="clean"> @@ -72,10 +76,10 @@ </target> <target name="compile" depends="gen"> - <javac srcdir="${src.dir}:${j3dtools.src.dir}/classes/share:${gen.dir}/src" + <javac srcdir="${src.dir}:${j3dtools.src.dir}:${gen.dir}/src" destdir="${class.dir}" - source="1.5" - target="1.5" + source="1.6" + target="1.6" debug="true" debuglevel="lines,source" deprecation="off" @@ -84,10 +88,10 @@ <copy todir="${class.dir}"> <fileset dir="${src.dir}" includes="**/*.properties"/> - <fileset dir="${j3dtools.src.dir}/classes/share" includes="META-INF/** **/*.properties"/> + <fileset dir="${j3dtools.src.dir}" includes="META-INF/** **/*.properties"/> </copy> </target> - + <target name="jar" depends="compile"> <jar jarfile="${build.dir}/jars/j3dcore.jar" update="no" compress="false"> @@ -120,7 +124,7 @@ </manifest> <fileset dir="${class.dir}" includes="META-INF/** com/**/*"/> </jar> - + <zip destfile="${build.dir}/jars/j3dcore-src.zip"> <fileset dir="${src.dir}" includes="javax/**/*.java"/> <fileset dir="${gen.dir}/src" includes="javax/**/*.java"/> @@ -129,10 +133,23 @@ </zip> <zip destfile="${build.dir}/jars/j3dutils-src.zip"> - <fileset dir="${j3dtools.src.dir}/classes/share" includes="com/**/*.java"/> + <fileset dir="${j3dtools.src.dir}" includes="com/**/*.java"/> <fileset dir="${j3dtools.dir}" includes="COPYRIGHT.txt"/> <fileset dir="${j3dtools.dir}" includes="*LICENSE*.txt"/> </zip> </target> + + <target name="docs"> + <mkdir dir="${javadoc.dir}"/> + + <javadoc sourcepath="${src.dir}:${j3dtools.src.dir}:${vecmath.src.dir}" + packagenames="javax.media.j3d.*,com.sun.j3d.*,javax.vecmath.*" + destdir="${javadoc.dir}" + additionalparam="-Xdoclint:none" + windowtitle="Java3D ${version_base}"> + </javadoc> + </target> + + <target name="all" depends="jar,docs" /> </project> diff --git a/src/javax/media/j3d/Canvas3D.java b/src/javax/media/j3d/Canvas3D.java index 080bd18..8824191 100644 --- a/src/javax/media/j3d/Canvas3D.java +++ b/src/javax/media/j3d/Canvas3D.java @@ -32,12 +32,14 @@ import java.awt.Container; import java.awt.Dimension; import java.awt.Frame; import java.awt.Graphics; +import java.awt.Graphics2D; import java.awt.GraphicsConfiguration; import java.awt.GraphicsDevice; import java.awt.GraphicsEnvironment; import java.awt.IllegalComponentStateException; import java.awt.Point; import java.awt.Window; +import java.awt.geom.AffineTransform; import java.awt.image.BufferedImage; import java.util.ArrayList; import java.util.Hashtable; @@ -820,6 +822,8 @@ ArrayList<Integer> textureIdResourceFreeList = new ArrayList<Integer>(); // CanvasViewEventCatcher. Point newPosition = new Point(); Dimension newSize = new Dimension(); + double xscale = 1.0; + double yscale = 1.0; // Remember OGL context resources to free // before context is destroy. @@ -1227,9 +1231,15 @@ ArrayList<TextureRetained> textureIDResourceTable = new ArrayList<TextureRetaine if (!firstPaintCalled && added && validCanvas && validGraphicsMode()) { + final Graphics2D g2d = (Graphics2D) g; + final AffineTransform t = g2d.getTransform(); + try { - newSize = getSize(); - newPosition = getLocationOnScreen(); + Dimension scaledSize = getSize(); + xscale = t.getScaleX(); + yscale = t.getScaleY(); + newSize = new Dimension((int)(scaledSize.getWidth()*xscale), (int)(scaledSize.getHeight()*yscale)); + newPosition = getLocationOnScreen(); } catch (IllegalComponentStateException e) { return; } diff --git a/src/javax/media/j3d/CanvasViewEventCatcher.java b/src/javax/media/j3d/CanvasViewEventCatcher.java index aadbf5f..478a84c 100644 --- a/src/javax/media/j3d/CanvasViewEventCatcher.java +++ b/src/javax/media/j3d/CanvasViewEventCatcher.java @@ -26,6 +26,7 @@ package javax.media.j3d; +import java.awt.Dimension; import java.awt.IllegalComponentStateException; import java.awt.event.ComponentAdapter; import java.awt.event.ComponentEvent; @@ -65,7 +66,8 @@ class CanvasViewEventCatcher extends ComponentAdapter { // see comment below try { - canvas.newSize = canvas.getSize(); + Dimension size = canvas.getSize(); + canvas.newSize = new Dimension((int)(size.getWidth()*canvas.xscale), (int)(size.getHeight()*canvas.yscale)); canvas.newPosition = canvas.getLocationOnScreen(); } catch (IllegalComponentStateException ex) {} @@ -90,7 +92,8 @@ class CanvasViewEventCatcher extends ComponentAdapter { // first, then canvas lock in removeComponentListener() try { - canvas.newSize = canvas.getSize(); + Dimension size = canvas.getSize(); + canvas.newSize = new Dimension((int)(size.getWidth()*canvas.xscale), (int)(size.getHeight()*canvas.yscale)); canvas.newPosition = canvas.getLocationOnScreen(); } catch (IllegalComponentStateException ex) {} diff --git a/src/javax/media/j3d/GroupRetained.java b/src/javax/media/j3d/GroupRetained.java index 84a6bc6..826a989 100644 --- a/src/javax/media/j3d/GroupRetained.java +++ b/src/javax/media/j3d/GroupRetained.java @@ -2128,17 +2128,6 @@ synchronized void setAltAppScope() { (TargetsInterface)parentSwitchLink; } - - @Override - synchronized void updateLocalToVworld() { - // For each children call ..... - for (int i=children.size()-1; i>=0; i--) { - NodeRetained child = children.get(i); - if(child != null) - child.updateLocalToVworld(); - } - } - @Override void setNodeData(SetLiveState s) { super.setNodeData(s); diff --git a/src/javax/media/j3d/JoglPipeline.java b/src/javax/media/j3d/JoglPipeline.java index 2f38fd8..c45fd61 100644 --- a/src/javax/media/j3d/JoglPipeline.java +++ b/src/javax/media/j3d/JoglPipeline.java @@ -52,6 +52,7 @@ import java.util.StringTokenizer; import java.util.regex.Matcher; import java.util.regex.Pattern; +import com.jogamp.common.nio.Buffers; import com.jogamp.nativewindow.AbstractGraphicsDevice; import com.jogamp.nativewindow.AbstractGraphicsScreen; import com.jogamp.nativewindow.CapabilitiesChooser; @@ -61,7 +62,12 @@ import com.jogamp.nativewindow.NativeWindowFactory; import com.jogamp.nativewindow.ProxySurface; import com.jogamp.nativewindow.UpstreamSurfaceHook; import com.jogamp.nativewindow.VisualIDHolder; +import com.jogamp.nativewindow.awt.AWTGraphicsConfiguration; +import com.jogamp.nativewindow.awt.AWTGraphicsDevice; +import com.jogamp.nativewindow.awt.AWTGraphicsScreen; +import com.jogamp.nativewindow.awt.JAWTWindow; import com.jogamp.opengl.DefaultGLCapabilitiesChooser; +import com.jogamp.opengl.FBObject; import com.jogamp.opengl.GL; import com.jogamp.opengl.GL2; import com.jogamp.opengl.GLCapabilities; @@ -75,13 +81,6 @@ import com.jogamp.opengl.GLFBODrawable; import com.jogamp.opengl.GLProfile; import com.jogamp.opengl.Threading; -import com.jogamp.common.nio.Buffers; -import com.jogamp.nativewindow.awt.AWTGraphicsConfiguration; -import com.jogamp.nativewindow.awt.AWTGraphicsDevice; -import com.jogamp.nativewindow.awt.AWTGraphicsScreen; -import com.jogamp.nativewindow.awt.JAWTWindow; -import com.jogamp.opengl.FBObject; - /** * Concrete implementation of Pipeline class for the JOGL rendering * pipeline. @@ -6789,7 +6788,8 @@ void swapBuffers(Canvas3D cv, Context ctx, Drawable drawable) { if (VERBOSE) System.err.println("JoglPipeline.updateMaterialColor()"); GL2 gl = context(ctx).getGL().getGL2(); - gl.glColor4f(r, g, b, a); + // FIXME: Removed call to glColor4f because of segfault issues in Parallels Desktop driver + // gl.glColor4f(r, g, b, a); gl.glDisable(GL2.GL_LIGHTING); } @@ -7068,6 +7068,8 @@ void swapBuffers(Canvas3D cv, Context ctx, Drawable drawable) { gl.glDepthFunc(GL.GL_LEQUAL); gl.glEnable(GL2.GL_COLOR_MATERIAL); gl.glDisable(GL.GL_COLOR_LOGIC_OP); + gl.glDisable(GL.GL_STENCIL_TEST); + } // native method for setting default texture @@ -7218,9 +7220,10 @@ void swapBuffers(Canvas3D cv, Context ctx, Drawable drawable) { GL2 gl = context(ctx).getGL().getGL2(); - if (!enableLight) { - gl.glColor4f(r, g, b, a); - } + if (!enableLight) { + // FIXME: Removed call to glColor4f because of segfault issues in Parallels Desktop driver + // gl.glColor4f(r, g, b, a); + } gl.glShadeModel(GL2.GL_SMOOTH); } @@ -7693,7 +7696,11 @@ static boolean hasFBObjectSizeChanged(JoglDrawable jdraw, int width, int height) gl.glEnable(GL.GL_BLEND); gl.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA); - gl.glEnable(GL.GL_TEXTURE_2D); + gl.glEnable(GL.GL_TEXTURE_2D); + gl.glPushAttrib(GL2.GL_TRANSFORM_BIT); + gl.glMatrixMode(GL.GL_TEXTURE); + gl.glLoadIdentity(); + gl.glPopAttrib(); // loaded identity modelview and projection matrix gl.glMatrixMode(GL2.GL_PROJECTION); @@ -8307,7 +8314,8 @@ static boolean hasFBObjectSizeChanged(JoglDrawable jdraw, int width, int height) if (gct.getSceneAntialiasing() != GraphicsConfigTemplate.UNNECESSARY && gct.getDoubleBuffer() != GraphicsConfigTemplate.UNNECESSARY) { caps.setSampleBuffers(true); - caps.setNumSamples(2); + int numSamples = MasterControl.getIntegerProperty("j3d.numSamples", 2); + caps.setNumSamples(numSamples); } else { caps.setSampleBuffers(false); caps.setNumSamples(0); diff --git a/src/javax/media/j3d/MasterControl.java b/src/javax/media/j3d/MasterControl.java index 0d7af66..0bf27ab 100644 --- a/src/javax/media/j3d/MasterControl.java +++ b/src/javax/media/j3d/MasterControl.java @@ -779,6 +779,22 @@ private static String getProperty(final String prop) { }); } + static int getIntegerProperty(String prop, int defaultValue) { + int value = defaultValue; + String propValue = getProperty(prop); + + if (propValue != null) { + try { + value = Integer.parseInt(propValue); + } + catch (NumberFormatException e) {} + } + if (J3dDebug.debug) + System.err.println("Java 3D: " + prop + "=" + value); + + return value; + } + static boolean getBooleanProperty(String prop, boolean defaultValue, String trueMsg, @@ -833,6 +849,11 @@ private static String getProperty(final String prop) { // Use default pipeline } + // Java 3D cannot run in headless mode unless using the noop renderer + if (java.awt.GraphicsEnvironment.isHeadless() && pipelineType != Pipeline.Type.NOOP) { + throw new java.awt.HeadlessException(); + } + // Construct the singleton Pipeline instance Pipeline.createPipeline(pipelineType); diff --git a/src/javax/media/j3d/NodeRetained.java b/src/javax/media/j3d/NodeRetained.java index 83739da..662a730 100644 --- a/src/javax/media/j3d/NodeRetained.java +++ b/src/javax/media/j3d/NodeRetained.java @@ -624,9 +624,6 @@ NodeRetained getParent() { void recombineAbove() {} - synchronized void updateLocalToVworld() {} - - @Override void setLive(SetLiveState s) { int oldrefCount = refCount; diff --git a/src/javax/media/j3d/VirtualUniverse.java b/src/javax/media/j3d/VirtualUniverse.java index 624bccb..42e3725 100644 --- a/src/javax/media/j3d/VirtualUniverse.java +++ b/src/javax/media/j3d/VirtualUniverse.java @@ -262,13 +262,6 @@ ArrayList<Integer> viewIdFreeList = new ArrayList<Integer>(); } } - // Java 3D cannot run in headless mode, so we will throw a - // HeadlessException if isHeadless() is true. This avoids a - // cryptic error message from MasterControl.loadLibraries(). - if (java.awt.GraphicsEnvironment.isHeadless()) { - throw new java.awt.HeadlessException(); - } - // Load the native libraries and create the static // MasterControl object MasterControl.loadLibraries(); |