aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornobody <nobody@28c7f869-5b4e-e670-f602-82bfaf57f300>2006-07-17 20:02:22 +0000
committernobody <nobody@28c7f869-5b4e-e670-f602-82bfaf57f300>2006-07-17 20:02:22 +0000
commit16e0478078cef1a2ae55a0899802e3e9001b84c0 (patch)
tree8c5f9b4eed21290546b13add74347ab32e9958f3
parent90add9e4f695f08544cb886a8ee6466a13801ae4 (diff)
This commit was manufactured by cvs2svn to create tagexp-1_5_0-build5
'exp-1_5_0-build5'.
-rw-r--r--.cvsignore2
-rw-r--r--README-build.html6
-rw-r--r--build.xml77
-rw-r--r--manifest.mf2
-rw-r--r--nbproject/.cvsignore1
-rw-r--r--nbproject/project.xml18
-rw-r--r--src/classes/org/jdesktop/j3d/examples/configured_universe/ConfigObjLoad.java9
-rw-r--r--src/classes/org/jdesktop/j3d/examples/fps_counter/FPSCounterDemo.java3
-rw-r--r--src/classes/org/jdesktop/j3d/examples/geometry_compression/ObjectFileCompressor.java40
-rw-r--r--src/classes/org/jdesktop/j3d/examples/geometry_compression/README.txt2
-rw-r--r--src/classes/org/jdesktop/j3d/examples/geometry_compression/cgview.java49
-rw-r--r--src/classes/org/jdesktop/j3d/examples/geometry_compression/obj2cg.java5
-rw-r--r--src/classes/org/jdesktop/j3d/examples/texture/TextureImage.java11
-rw-r--r--src/classes/org/jdesktop/j3d/examples/texture/TextureImageNPOT.java222
14 files changed, 365 insertions, 82 deletions
diff --git a/.cvsignore b/.cvsignore
new file mode 100644
index 0000000..9d0b71a
--- /dev/null
+++ b/.cvsignore
@@ -0,0 +1,2 @@
+build
+dist
diff --git a/README-build.html b/README-build.html
index 40e1245..ec62fea 100644
--- a/README-build.html
+++ b/README-build.html
@@ -80,10 +80,10 @@ work.We have built j3d-examples on the following operating environments:<br>
</ul>
<p>The following software must be installed:</p>
<ul>
- <li><a href="http://java.sun.com/j2se">JDK 1.4.2</a> </li>
- <li><a href="http://jakarta.apache.org/ant">Apache Ant 1.6.5</a> </li>
+ <li><a href="http://java.sun.com/j2se">JDK 1.5.0</a> </li>
+ <li><a href="http://jakarta.apache.org/ant">Apache Ant 1.6.1</a> </li>
<li><a href="https://java3d.dev.java.net/">Java&nbsp;3D
-1.4.0</a> or later. </li>
+1.5.0</a> or later. </li>
</ul>
<h3><span style="text-decoration: underline;">Building
j3d-examples</span><span
diff --git a/build.xml b/build.xml
index 130d53f..ab792c2 100644
--- a/build.xml
+++ b/build.xml
@@ -46,28 +46,35 @@
*/
-->
-<project name="j3d-examples-1.4.0" default="jar">
+<project name="j3d-examples-1.5.0" default="jar">
<target name="init">
<!-- Set global properties for this build -->
- <property name="src" location="src"/>
- <property name="build" location="build"/>
- <property name="dist" location="dist"/>
- <property name="output.jar" location="dist/j3d-examples.jar"/>
- <property name="output.zip" location="dist/j3d-examples-1_4_0-src.zip"/>
+ <property name="src" location="src"/>
+ <property name="build" location="build"/>
+ <property name="dist" location="dist"/>
+ <property name="output.jar" location="dist/j3d-examples.jar"/>
+ <property name="output.zip" location="dist/j3d-examples-1_5_0-src.zip"/>
+ <property name="j3ddir" location="../j3d-core/build/default/debug"/>
+ <property name="vecmathdir" location="../vecmath/build/debug"/>
+ <property name="j3dcore.jar" location="${j3ddir}/lib/ext/j3dcore.jar"/>
+ <property name="j3dutils.jar" location="${j3ddir}/lib/ext/j3dutils.jar"/>
+ <property name="vecmath.jar" location="${vecmathdir}/lib/ext/vecmath.jar"/>
+ <property name="native.dir" location="${j3ddir}/native"/>
</target>
- <target name="compile" depends="init">
+ <target name="compile" depends="init-compile">
<!-- Create the build directory -->
<mkdir dir="${build}/classes"/>
<!-- Compile the java code from ${src}/classes into ${build}/classes -->
<javac srcdir="${src}/classes"
destdir="${build}/classes"
- source="1.4"
- target="1.4"
+ source="1.5"
+ target="1.5"
debug="true"
deprecation="off">
+ <classpath refid="comp.classpath"/>
</javac>
<!-- Copy resources to build in preparation for jarring -->
@@ -117,9 +124,20 @@
<delete dir="${dist}"/>
</target>
+ <target name="init-compile" depends="init">
+ <path id="comp.classpath">
+ <pathelement location="${j3dcore.jar}"/>
+ <pathelement location="${j3dutils.jar}"/>
+ <pathelement location="${vecmath.jar}"/>
+ </path>
+ </target>
+
<target name="init-run" depends="init,jar">
<path id="run.classpath">
<pathelement location="${output.jar}"/>
+ <pathelement location="${j3dcore.jar}"/>
+ <pathelement location="${j3dutils.jar}"/>
+ <pathelement location="${vecmath.jar}"/>
</path>
</target>
@@ -136,6 +154,7 @@
<java fork="true"
classname="org.jdesktop.j3d.examples.appearance.AppearanceMixed">
<classpath refid="run.classpath"/>
+ <sysproperty key="java.library.path" value="${native.dir}"/>
</java>
</target>
@@ -143,6 +162,7 @@
<java fork="true"
classname="org.jdesktop.j3d.examples.appearance.AppearanceTest">
<classpath refid="run.classpath"/>
+ <sysproperty key="java.library.path" value="${native.dir}"/>
</java>
</target>
@@ -150,6 +170,7 @@
<java fork="true"
classname="org.jdesktop.j3d.examples.applet3d.Applet3D">
<classpath refid="run.classpath"/>
+ <sysproperty key="java.library.path" value="${native.dir}"/>
</java>
</target>
@@ -157,6 +178,7 @@
<java fork="true"
classname="org.jdesktop.j3d.examples.background.BackgroundGeometry">
<classpath refid="run.classpath"/>
+ <sysproperty key="java.library.path" value="${native.dir}"/>
</java>
</target>
@@ -164,6 +186,7 @@
<java fork="true"
classname="org.jdesktop.j3d.examples.configured_universe.ConfigObjLoad">
<classpath refid="run.classpath"/>
+ <sysproperty key="java.library.path" value="${native.dir}"/>
</java>
</target>
@@ -171,6 +194,7 @@
<java fork="true"
classname="org.jdesktop.j3d.examples.depth_func.DepthFuncTest">
<classpath refid="run.classpath"/>
+ <sysproperty key="java.library.path" value="${native.dir}"/>
</java>
</target>
@@ -178,6 +202,7 @@
<java fork="true"
classname="org.jdesktop.j3d.examples.distort_glyph.DistortGlyphTest">
<classpath refid="run.classpath"/>
+ <sysproperty key="java.library.path" value="${native.dir}"/>
</java>
</target>
@@ -185,6 +210,7 @@
<java fork="true"
classname="org.jdesktop.j3d.examples.dot3.Dot3Demo">
<classpath refid="run.classpath"/>
+ <sysproperty key="java.library.path" value="${native.dir}"/>
</java>
</target>
@@ -192,6 +218,7 @@
<java fork="true"
classname="org.jdesktop.j3d.examples.glsl_shader.EnvironmentMappingGLSL">
<classpath refid="run.classpath"/>
+ <sysproperty key="java.library.path" value="${native.dir}"/>
</java>
</target>
@@ -199,6 +226,7 @@
<java fork="true"
classname="org.jdesktop.j3d.examples.four_by_four.FourByFour">
<classpath refid="run.classpath"/>
+ <sysproperty key="java.library.path" value="${native.dir}"/>
</java>
</target>
@@ -206,6 +234,7 @@
<java fork="true"
classname="org.jdesktop.j3d.examples.fps_counter.FPSCounterDemo">
<classpath refid="run.classpath"/>
+ <sysproperty key="java.library.path" value="${native.dir}"/>
</java>
</target>
@@ -213,6 +242,7 @@
<java fork="true"
classname="org.jdesktop.j3d.examples.gears.GearBox">
<classpath refid="run.classpath"/>
+ <sysproperty key="java.library.path" value="${native.dir}"/>
</java>
</target>
@@ -220,6 +250,7 @@
<java fork="true"
classname="org.jdesktop.j3d.examples.gears.GearTest">
<classpath refid="run.classpath"/>
+ <sysproperty key="java.library.path" value="${native.dir}"/>
</java>
</target>
@@ -227,6 +258,7 @@
<java fork="true"
classname="org.jdesktop.j3d.examples.hello_universe.HelloUniverse">
<classpath refid="run.classpath"/>
+ <sysproperty key="java.library.path" value="${native.dir}"/>
</java>
</target>
@@ -234,6 +266,7 @@
<java fork="true"
classname="org.jdesktop.j3d.examples.geometry_by_ref.ImageComponentByReferenceTest">
<classpath refid="run.classpath"/>
+ <sysproperty key="java.library.path" value="${native.dir}"/>
</java>
</target>
@@ -241,6 +274,7 @@
<java fork="true"
classname="org.jdesktop.j3d.examples.geometry_by_ref.InterleavedNIOBuffer">
<classpath refid="run.classpath"/>
+ <sysproperty key="java.library.path" value="${native.dir}"/>
</java>
</target>
@@ -248,6 +282,7 @@
<java fork="true"
classname="org.jdesktop.j3d.examples.geometry_by_ref.InterleavedTest">
<classpath refid="run.classpath"/>
+ <sysproperty key="java.library.path" value="${native.dir}"/>
</java>
</target>
@@ -255,6 +290,7 @@
<java fork="true"
classname="org.jdesktop.j3d.examples.lod.LOD">
<classpath refid="run.classpath"/>
+ <sysproperty key="java.library.path" value="${native.dir}"/>
</java>
</target>
@@ -262,6 +298,7 @@
<java fork="true"
classname="org.jdesktop.j3d.examples.morphing.Morphing">
<classpath refid="run.classpath"/>
+ <sysproperty key="java.library.path" value="${native.dir}"/>
</java>
</target>
@@ -269,6 +306,7 @@
<java fork="true"
classname="org.jdesktop.j3d.examples.texture.MultiTextureTest">
<classpath refid="run.classpath"/>
+ <sysproperty key="java.library.path" value="${native.dir}"/>
</java>
</target>
@@ -276,6 +314,7 @@
<java fork="true"
classname="org.jdesktop.j3d.examples.objload.ObjLoad">
<classpath refid="run.classpath"/>
+ <sysproperty key="java.library.path" value="${native.dir}"/>
</java>
</target>
@@ -283,6 +322,7 @@
<java fork="true"
classname="org.jdesktop.j3d.examples.cg_shader.ObjLoadCg">
<classpath refid="run.classpath"/>
+ <sysproperty key="java.library.path" value="${native.dir}"/>
<sysproperty key="j3d.shadingLanguage" value="Cg"/>
</java>
</target>
@@ -291,6 +331,7 @@
<java fork="true"
classname="org.jdesktop.j3d.examples.glsl_shader.ObjLoadGLSL">
<classpath refid="run.classpath"/>
+ <sysproperty key="java.library.path" value="${native.dir}"/>
</java>
</target>
@@ -298,6 +339,7 @@
<java fork="true"
classname="org.jdesktop.j3d.examples.oriented_shape3d.OrientedPtTest">
<classpath refid="run.classpath"/>
+ <sysproperty key="java.library.path" value="${native.dir}"/>
</java>
</target>
@@ -305,6 +347,7 @@
<java fork="true"
classname="org.jdesktop.j3d.examples.oriented_shape3d.OrientedTest">
<classpath refid="run.classpath"/>
+ <sysproperty key="java.library.path" value="${native.dir}"/>
</java>
</target>
@@ -312,6 +355,7 @@
<java fork="true"
classname="org.jdesktop.j3d.examples.print_canvas3d.PrintCanvas3D">
<classpath refid="run.classpath"/>
+ <sysproperty key="java.library.path" value="${native.dir}"/>
</java>
</target>
@@ -319,6 +363,7 @@
<java fork="true"
classname="org.jdesktop.j3d.examples.glsl_shader.PhongShadingGLSL">
<classpath refid="run.classpath"/>
+ <sysproperty key="java.library.path" value="${native.dir}"/>
</java>
</target>
@@ -326,6 +371,7 @@
<java fork="true"
classname="org.jdesktop.j3d.examples.pure_immediate.PureImmediate">
<classpath refid="run.classpath"/>
+ <sysproperty key="java.library.path" value="${native.dir}"/>
</java>
</target>
@@ -333,6 +379,7 @@
<java fork="true"
classname="org.jdesktop.j3d.examples.pure_immediate.PureImmediateStereo">
<classpath refid="run.classpath"/>
+ <sysproperty key="java.library.path" value="${native.dir}"/>
</java>
</target>
@@ -340,6 +387,7 @@
<java fork="true"
classname="org.jdesktop.j3d.examples.morphing.Pyramid2Cube">
<classpath refid="run.classpath"/>
+ <sysproperty key="java.library.path" value="${native.dir}"/>
</java>
</target>
@@ -347,6 +395,7 @@
<java fork="true"
classname="org.jdesktop.j3d.examples.package_info.QueryProperties">
<classpath refid="run.classpath"/>
+ <sysproperty key="java.library.path" value="${native.dir}"/>
</java>
</target>
@@ -354,6 +403,7 @@
<java fork="true"
classname="org.jdesktop.j3d.examples.glsl_shader.SamplerTestGLSL">
<classpath refid="run.classpath"/>
+ <sysproperty key="java.library.path" value="${native.dir}"/>
</java>
</target>
@@ -361,6 +411,7 @@
<java fork="true"
classname="org.jdesktop.j3d.examples.glsl_shader.ShaderTestGLSL">
<classpath refid="run.classpath"/>
+ <sysproperty key="java.library.path" value="${native.dir}"/>
</java>
</target>
@@ -368,6 +419,7 @@
<java fork="true"
classname="org.jdesktop.j3d.examples.sphere_motion.SphereMotion">
<classpath refid="run.classpath"/>
+ <sysproperty key="java.library.path" value="${native.dir}"/>
</java>
</target>
@@ -375,6 +427,7 @@
<java fork="true"
classname="org.jdesktop.j3d.examples.glsl_shader.SphereGLSL">
<classpath refid="run.classpath"/>
+ <sysproperty key="java.library.path" value="${native.dir}"/>
</java>
</target>
@@ -382,6 +435,7 @@
<java fork="true"
classname="org.jdesktop.j3d.examples.cg_shader.SphereCg">
<classpath refid="run.classpath"/>
+ <sysproperty key="java.library.path" value="${native.dir}"/>
<sysproperty key="j3d.shadingLanguage" value="Cg"/>
</java>
</target>
@@ -390,6 +444,7 @@
<java fork="true"
classname="org.jdesktop.j3d.examples.texture_by_ref.TextureByReference">
<classpath refid="run.classpath"/>
+ <sysproperty key="java.library.path" value="${native.dir}"/>
</java>
</target>
@@ -397,6 +452,7 @@
<java fork="true"
classname="org.jdesktop.j3d.examples.texture.TextureImage">
<classpath refid="run.classpath"/>
+ <sysproperty key="java.library.path" value="${native.dir}"/>
</java>
</target>
@@ -404,6 +460,7 @@
<java fork="true"
classname="org.jdesktop.j3d.examples.collision.TickTockCollision">
<classpath refid="run.classpath"/>
+ <sysproperty key="java.library.path" value="${native.dir}"/>
</java>
</target>
@@ -411,6 +468,7 @@
<java fork="true"
classname="org.jdesktop.j3d.examples.glsl_shader.VertexAttrTestGLSL">
<classpath refid="run.classpath"/>
+ <sysproperty key="java.library.path" value="${native.dir}"/>
</java>
</target>
@@ -418,6 +476,7 @@
<java fork="true"
classname="org.jdesktop.j3d.examples.cg_shader.VertexAttrTestCg">
<classpath refid="run.classpath"/>
+ <sysproperty key="java.library.path" value="${native.dir}"/>
<sysproperty key="j3d.shadingLanguage" value="Cg"/>
</java>
</target>
diff --git a/manifest.mf b/manifest.mf
index dc0b38e..4ca12ca 100644
--- a/manifest.mf
+++ b/manifest.mf
@@ -1,5 +1,5 @@
Manifest-Version: 1.0
Implementation-Title: Java 3D Example Programs
-Implementation-Version: 1.4.0
+Implementation-Version: 1.5.0
Implementation-Vendor: Sun Microsystems, Inc.
Main-Class: org.jdesktop.j3d.examples.hello_universe.HelloUniverse
diff --git a/nbproject/.cvsignore b/nbproject/.cvsignore
new file mode 100644
index 0000000..3e18ebf
--- /dev/null
+++ b/nbproject/.cvsignore
@@ -0,0 +1 @@
+private
diff --git a/nbproject/project.xml b/nbproject/project.xml
index 411d578..6586f04 100644
--- a/nbproject/project.xml
+++ b/nbproject/project.xml
@@ -4,7 +4,7 @@
<configuration>
<general-data xmlns="http://www.netbeans.org/ns/freeform-project/1">
<!-- Do not use Project Properties customizer when editing this file manually. -->
- <name>j3d-examples-1.4.0</name>
+ <name>j3d-examples-1.5.0</name>
<properties/>
<folders>
<source-folder>
@@ -21,13 +21,18 @@
<target>clean</target>
</action>
<action name="run">
- <target>run</target>
+ <target>run.HelloUniverse</target>
</action>
<action name="rebuild">
<target>clean</target>
<target>jar</target>
</action>
</ide-actions>
+ <export>
+ <type>jar</type>
+ <location>dist/j3d-examples.jar</location>
+ <build-target>jar</build-target>
+ </export>
<view>
<items>
<source-folder style="packages">
@@ -45,12 +50,17 @@
<ide-action name="rebuild"/>
</context-menu>
</view>
- <subprojects/>
+ <subprojects>
+ <project>../j3d-core</project>
+ <project>../vecmath</project>
+ </subprojects>
</general-data>
<java-data xmlns="http://www.netbeans.org/ns/freeform-project-java/1">
<compilation-unit>
<package-root>src/classes</package-root>
- <source-level>1.4</source-level>
+ <classpath mode="compile">../j3d-core/build/default/debug/lib/ext/j3dcore.jar:../j3d-core/build/default/debug/lib/ext/j3dutils.jar:../vecmath/build/debug/lib/ext/vecmath.jar</classpath>
+ <built-to>dist/j3d-examples.jar</built-to>
+ <source-level>1.5</source-level>
</compilation-unit>
</java-data>
</configuration>
diff --git a/src/classes/org/jdesktop/j3d/examples/configured_universe/ConfigObjLoad.java b/src/classes/org/jdesktop/j3d/examples/configured_universe/ConfigObjLoad.java
index 16d1060..8cd44bb 100644
--- a/src/classes/org/jdesktop/j3d/examples/configured_universe/ConfigObjLoad.java
+++ b/src/classes/org/jdesktop/j3d/examples/configured_universe/ConfigObjLoad.java
@@ -189,9 +189,12 @@ public class ConfigObjLoad {
// Get the config file URL from the j3d.configURL property or use the
// default config file "j3d1x1-window" in the current directory.
- //URL configURL = ConfiguredUniverse.getConfigURL("file:j3d1x1-window");
- URL configURL = Resources.getResource("configured_universe/j3d1x1-windows.cfg");
- // Create a simple scene and attach it to the virtual universe
+ URL configURL = ConfiguredUniverse.getConfigURL(null);
+ if(configURL == null) {
+ configURL = Resources.getResource("configured_universe/j3d1x1-window.cfg");
+ }
+
+ // Create a simple scene and attach it to the virtual universe
BranchGroup scene = createSceneGraph();
u = new ConfiguredUniverse(configURL);
diff --git a/src/classes/org/jdesktop/j3d/examples/fps_counter/FPSCounterDemo.java b/src/classes/org/jdesktop/j3d/examples/fps_counter/FPSCounterDemo.java
index d7f8ee9..88ca026 100644
--- a/src/classes/org/jdesktop/j3d/examples/fps_counter/FPSCounterDemo.java
+++ b/src/classes/org/jdesktop/j3d/examples/fps_counter/FPSCounterDemo.java
@@ -118,9 +118,6 @@ public class FPSCounterDemo extends javax.swing.JFrame {
// objects in the scene can be viewed.
univ.getViewingPlatform().setNominalViewingTransform();
- // Ensure at least 5 msec per frame (i.e., < 200Hz)
- univ.getViewer().getView().setMinimumFrameCycleTime(5);
-
return c;
}
diff --git a/src/classes/org/jdesktop/j3d/examples/geometry_compression/ObjectFileCompressor.java b/src/classes/org/jdesktop/j3d/examples/geometry_compression/ObjectFileCompressor.java
index 57267eb..2155581 100644
--- a/src/classes/org/jdesktop/j3d/examples/geometry_compression/ObjectFileCompressor.java
+++ b/src/classes/org/jdesktop/j3d/examples/geometry_compression/ObjectFileCompressor.java
@@ -44,15 +44,17 @@
package org.jdesktop.j3d.examples.geometry_compression;
-import com.sun.j3d.utils.compression.* ;
-import com.sun.j3d.loaders.objectfile.ObjectFile ;
-import com.sun.j3d.loaders.ParsingErrorException ;
-import com.sun.j3d.loaders.IncorrectFormatException ;
-import com.sun.j3d.loaders.Scene ;
-import javax.media.j3d.* ;
-import java.util.* ;
-import java.net.* ;
-import java.io.* ;
+import com.sun.j3d.loaders.IncorrectFormatException;
+import com.sun.j3d.loaders.ParsingErrorException;
+import com.sun.j3d.loaders.Scene;
+import com.sun.j3d.loaders.objectfile.ObjectFile;
+import com.sun.j3d.utils.geometry.compression.*;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.Reader;
+import java.net.URL;
+import java.util.Hashtable;
+import javax.media.j3d.Shape3D;
/**
* This extension of ObjectFile provides the methods setQuantization() and
@@ -104,12 +106,12 @@ public class ObjectFileCompressor extends ObjectFile {
}
/**
- * Compress the specified .obj file into a CompressedGeometry node
+ * Compress the specified .obj file into a CompressedGeometryData node
* component.
* @param objFileName String object representing the path to a .obj file
- * @return a CompressedGeometry node component
+ * @return a CompressedGeometryData node component
*/
- public CompressedGeometry compress(String objFileName) {
+ public CompressedGeometryData compress(String objFileName) {
return compressScene(getScene(objFileName)) ;
}
@@ -126,12 +128,12 @@ public class ObjectFileCompressor extends ObjectFile {
}
/**
- * Compress the specified .obj file into a CompressedGeometry node
+ * Compress the specified .obj file into a CompressedGeometryData node
* component.
* @param reader an open .obj file
- * @return a CompressedGeometry node component
+ * @return a CompressedGeometryData node component
*/
- public CompressedGeometry compress(Reader reader) {
+ public CompressedGeometryData compress(Reader reader) {
return compressScene(getScene(reader)) ;
}
@@ -148,12 +150,12 @@ public class ObjectFileCompressor extends ObjectFile {
}
/**
- * Compress the specified .obj file into a CompressedGeometry node
+ * Compress the specified .obj file into a CompressedGeometryData node
* component.
* @param url Uniform Resource Locator for the .obj file
- * @return a CompressedGeometry node component
+ * @return a CompressedGeometryData node component
*/
- public CompressedGeometry compress(URL url) {
+ public CompressedGeometryData compress(URL url) {
return compressScene(getScene(url)) ;
}
@@ -169,7 +171,7 @@ public class ObjectFileCompressor extends ObjectFile {
compressScene(getScene(url), file) ;
}
- private CompressedGeometry compressScene(Scene scene) {
+ private CompressedGeometryData compressScene(Scene scene) {
return compressor.compress(getStream(scene)) ;
}
diff --git a/src/classes/org/jdesktop/j3d/examples/geometry_compression/README.txt b/src/classes/org/jdesktop/j3d/examples/geometry_compression/README.txt
index 1cab35b..345766b 100644
--- a/src/classes/org/jdesktop/j3d/examples/geometry_compression/README.txt
+++ b/src/classes/org/jdesktop/j3d/examples/geometry_compression/README.txt
@@ -1,5 +1,5 @@
This directory contains example code for using compressed geometry in
-Java 3D through the com.sun.j3d.utils.compression package.
+Java 3D through the com.sun.j3d.utils.geometry.compression package.
Applications:
diff --git a/src/classes/org/jdesktop/j3d/examples/geometry_compression/cgview.java b/src/classes/org/jdesktop/j3d/examples/geometry_compression/cgview.java
index 2efc221..23e027a 100644
--- a/src/classes/org/jdesktop/j3d/examples/geometry_compression/cgview.java
+++ b/src/classes/org/jdesktop/j3d/examples/geometry_compression/cgview.java
@@ -44,22 +44,21 @@
package org.jdesktop.j3d.examples.geometry_compression;
-import com.sun.j3d.utils.compression.* ;
-import com.sun.j3d.utils.behaviors.vp.* ;
-import com.sun.j3d.utils.applet.MainFrame ;
-import com.sun.j3d.utils.universe.* ;
-import javax.media.j3d.* ;
-import javax.vecmath.* ;
-import java.applet.Applet ;
-import java.awt.BorderLayout ;
-import java.awt.event.* ;
-import java.io.* ;
+import com.sun.j3d.utils.applet.MainFrame;
+import com.sun.j3d.utils.behaviors.vp.OrbitBehavior;
+import com.sun.j3d.utils.geometry.compression.*;
+import com.sun.j3d.utils.universe.*;
+import java.applet.Applet;
+import java.awt.BorderLayout;
+import java.io.IOException;
+import javax.media.j3d.*;
+import javax.vecmath.*;
public class cgview extends Applet {
private SimpleUniverse u = null;
- public BranchGroup createSceneGraph(CompressedGeometry cg) {
+ public BranchGroup createSceneGraph(CompressedGeometryData cg) {
// Create the root of the branch graph
BranchGroup objRoot = new BranchGroup() ;
@@ -81,27 +80,15 @@ public class cgview extends Applet {
objScale.addChild(objTrans) ;
// Add compressed geometry to the scene graph.
- CompressedGeometryHeader hdr = new CompressedGeometryHeader() ;
+ CompressedGeometryData.Header hdr = new CompressedGeometryData.Header() ;
cg.getCompressedGeometryHeader(hdr) ;
- // There isn't really enough information in the compressed geometry
- // header to unamiguously determine the proper rendering attributes.
- // The bufferDataPresent field specifies whether or not normals are
- // bundled with vertices, but the compressed buffer can still contain
- // normals that should be lit. Assume that any surface geometry
- // should be lit and that lines and points should not unless the
- // header contains the NORMAL_IN_BUFFER bit.
- Material m = new Material() ;
- if ((hdr.bufferType == hdr.TRIANGLE_BUFFER) ||
- ((hdr.bufferDataPresent & hdr.NORMAL_IN_BUFFER) == 1))
- m.setLightingEnable(true) ;
- else
- m.setLightingEnable(false) ;
-
- Appearance a = new Appearance() ;
- a.setMaterial(m) ;
-
- objTrans.addChild(new Shape3D(cg, a)) ;
+ Shape3D[] shapes = cg.decompress();
+ if (shapes != null) {
+ for (int i = 0; i < shapes.length; i++) {
+ objTrans.addChild(shapes[i]);
+ }
+ }
// Create mouse behavior scheduling bounds.
BoundingSphere bounds =
@@ -158,7 +145,7 @@ public class cgview extends Applet {
usage() ;
// Read the compressed geometry.
- CompressedGeometry cg = null ;
+ CompressedGeometryData cg = null ;
try {
CompressedGeometryFile cgf ;
cgf = new CompressedGeometryFile(filename, false) ;
diff --git a/src/classes/org/jdesktop/j3d/examples/geometry_compression/obj2cg.java b/src/classes/org/jdesktop/j3d/examples/geometry_compression/obj2cg.java
index e863dbc..4d3fa66 100644
--- a/src/classes/org/jdesktop/j3d/examples/geometry_compression/obj2cg.java
+++ b/src/classes/org/jdesktop/j3d/examples/geometry_compression/obj2cg.java
@@ -44,9 +44,8 @@
package org.jdesktop.j3d.examples.geometry_compression;
-import com.sun.j3d.utils.compression.* ;
-import javax.media.j3d.* ;
-import java.io.* ;
+import com.sun.j3d.utils.geometry.compression.*;
+import java.io.IOException;
class obj2cg {
diff --git a/src/classes/org/jdesktop/j3d/examples/texture/TextureImage.java b/src/classes/org/jdesktop/j3d/examples/texture/TextureImage.java
index 5ac421e..59cec91 100644
--- a/src/classes/org/jdesktop/j3d/examples/texture/TextureImage.java
+++ b/src/classes/org/jdesktop/j3d/examples/texture/TextureImage.java
@@ -55,7 +55,8 @@ import javax.vecmath.*;
import org.jdesktop.j3d.examples.Resources;
public class TextureImage extends Applet {
-
+
+ private static final String defaultFileName = "resources/images/stone.jpg";
private java.net.URL texImage = null;
private SimpleUniverse u = null;
@@ -118,9 +119,9 @@ public class TextureImage extends Applet {
public void init() {
if (texImage == null) {
// the path to the image for an applet
- texImage = Resources.getResource("resources/images/stone.jpg");
+ texImage = Resources.getResource(defaultFileName);
if (texImage == null) {
- System.err.println("resources/images/stone.jpg not found");
+ System.err.println(defaultFileName + " not found");
System.exit(1);
}
}
@@ -161,9 +162,9 @@ public class TextureImage extends Applet {
}
} else {
// the path to the image for an application
- url = Resources.getResource("resources/images/stone.jpg");
+ url = Resources.getResource(defaultFileName);
if (url == null) {
- System.err.println("resources/images/stone.jpg not found");
+ System.err.println(defaultFileName + " not found");
System.exit(1);
}
}
diff --git a/src/classes/org/jdesktop/j3d/examples/texture/TextureImageNPOT.java b/src/classes/org/jdesktop/j3d/examples/texture/TextureImageNPOT.java
new file mode 100644
index 0000000..3976f0b
--- /dev/null
+++ b/src/classes/org/jdesktop/j3d/examples/texture/TextureImageNPOT.java
@@ -0,0 +1,222 @@
+/*
+ * $RCSfile$
+ *
+ * Copyright (c) 2006 Sun Microsystems, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistribution of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistribution in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of Sun Microsystems, Inc. or the names of
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * This software is provided "AS IS," without a warranty of any
+ * kind. ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND
+ * WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY
+ * EXCLUDED. SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL
+ * NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF
+ * USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS
+ * DERIVATIVES. IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR
+ * ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL,
+ * CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED AND
+ * REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF OR
+ * INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS BEEN ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
+ *
+ * You acknowledge that this software is not designed, licensed or
+ * intended for use in the design, construction, operation or
+ * maintenance of any nuclear facility.
+ *
+ * $Revision$
+ * $Date$
+ * $State$
+ */
+
+package org.jdesktop.j3d.examples.texture;
+
+import java.applet.Applet;
+import java.awt.*;
+import com.sun.j3d.utils.applet.MainFrame;
+import com.sun.j3d.utils.universe.*;
+import com.sun.j3d.utils.image.TextureLoader;
+import com.sun.j3d.utils.geometry.Box;
+import javax.media.j3d.*;
+import javax.vecmath.*;
+import java.util.Map;
+import org.jdesktop.j3d.examples.Resources;
+
+public class TextureImageNPOT extends Applet {
+
+ private static final String defaultFileName = "resources/images/Java3d.jpg";
+ private java.net.URL texImage = null;
+
+ private SimpleUniverse u = null;
+ private boolean allowNonPowerOfTwo = true;
+ private boolean mipmap = true;
+
+ public BranchGroup createSceneGraph() {
+ // Create the root of the branch graph
+ BranchGroup objRoot = new BranchGroup();
+
+ // Create the transform group node and initialize it to the
+ // identity. Enable the TRANSFORM_WRITE capability so that
+ // our behavior code can modify it at runtime. Add it to the
+ // root of the subgraph.
+ TransformGroup objTrans = new TransformGroup();
+ objTrans.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
+ objRoot.addChild(objTrans);
+
+ // Create the scaling transform group node and initialize it to the
+ // identity. Enable the TRANSFORM_WRITE capability so that
+ // our behavior code can modify it at runtime. Add it to the
+ // objTrans group
+ TransformGroup objScale = new TransformGroup();
+ objScale.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
+ objTrans.addChild(objScale);
+
+ // Create appearance object for textured cube
+ Appearance app = new Appearance();
+ int flags = 0;
+ if (allowNonPowerOfTwo) {
+ flags |= TextureLoader.ALLOW_NON_POWER_OF_TWO;
+ }
+ if (mipmap) {
+ flags |= TextureLoader.GENERATE_MIPMAP;
+ }
+ Texture tex = new TextureLoader(texImage, flags, this).getTexture();
+ tex.setMagFilter(Texture.BASE_LEVEL_LINEAR);
+ if (mipmap) {
+ tex.setMinFilter(Texture.MULTI_LEVEL_LINEAR);
+ } else {
+ tex.setMinFilter(Texture.BASE_LEVEL_LINEAR);
+ }
+ app.setTexture(tex);
+ TextureAttributes texAttr = new TextureAttributes();
+ texAttr.setTextureMode(TextureAttributes.MODULATE);
+ app.setTextureAttributes(texAttr);
+
+ // Create textured cube and add it to the scene graph.
+ Box textureCube = new Box(0.4f, 0.4f, 0.4f,
+ Box.GENERATE_TEXTURE_COORDS, app);
+ objScale.addChild(textureCube);
+
+ // Create a new Behavior object that will perform the desired
+ // operation on the specified transform object and add it into
+ // the scene graph.
+ Transform3D yAxis = new Transform3D();
+ Alpha rotationAlpha = new Alpha(-1, Alpha.INCREASING_ENABLE,
+ 0, 0,
+ 50000, 0, 0,
+ 0, 0, 0);
+
+ RotationInterpolator rotator =
+ new RotationInterpolator(rotationAlpha, objTrans, yAxis,
+ 0.0f, (float) Math.PI*2.0f);
+ BoundingSphere bounds =
+ new BoundingSphere(new Point3d(0.0,0.0,0.0), 100.0);
+ rotator.setSchedulingBounds(bounds);
+ objTrans.addChild(rotator);
+
+ // Create a new Behavior object that will perform the desired
+ // operation on the specified transform object and add it into
+ // the scene graph.
+ Alpha scaleAlpha = new Alpha(-1,
+ Alpha.INCREASING_ENABLE | Alpha.DECREASING_ENABLE,
+ 0, 0,
+ 8000, 0, 0,
+ 8000, 0, 0);
+
+ ScaleInterpolator scaler =
+ new ScaleInterpolator(scaleAlpha, objScale, yAxis,
+ 0.01f, 1.5f);
+ scaler.setSchedulingBounds(bounds);
+ objScale.addChild(scaler);
+
+ // Have Java 3D perform optimizations on this scene graph.
+ objRoot.compile();
+
+ return objRoot;
+ }
+
+ public TextureImageNPOT() {
+ }
+
+ public TextureImageNPOT(java.net.URL url) {
+ texImage = url;
+ }
+
+ public void init() {
+ if (texImage == null) {
+ // the path to the image for an applet
+ texImage = Resources.getResource(defaultFileName);
+ if (texImage == null) {
+ System.err.println(defaultFileName + " not found");
+ System.exit(1);
+ }
+ }
+ setLayout(new BorderLayout());
+ GraphicsConfiguration config =
+ SimpleUniverse.getPreferredConfiguration();
+
+ Canvas3D c = new Canvas3D(config);
+
+ Map map = c.queryProperties();
+ Boolean value = (Boolean) map.get("textureNonPowerOfTwoAvailable");
+ if (value != null) {
+ System.out.println("textureNonPowerOfTwoAvailable property = " + value);
+ } else {
+ System.out.println("textureNonPowerOfTwoAvailable property not found");
+ }
+
+ add("Center", c);
+
+ // Create a simple scene and attach it to the virtual universe
+ BranchGroup scene = createSceneGraph();
+ u = new SimpleUniverse(c);
+
+ // This will move the ViewPlatform back a bit so the
+ // objects in the scene can be viewed.
+ u.getViewingPlatform().setNominalViewingTransform();
+
+ u.addBranchGraph(scene);
+ }
+
+ public void destroy() {
+ u.cleanup();
+ }
+
+ //
+ // The following allows TextureImageNPOT to be run as an application
+ // as well as an applet
+ //
+ public static void main(String[] args) {
+ java.net.URL url = null;
+ if (args.length > 0) {
+ try {
+ url = new java.net.URL("file:" + args[0]);
+ } catch (java.net.MalformedURLException ex) {
+ System.out.println(ex.getMessage());
+ System.exit(1);
+ }
+ } else {
+ // the path to the image for an application
+ url = Resources.getResource(defaultFileName);
+ if (url == null) {
+ System.err.println(defaultFileName + " not found");
+ System.exit(1);
+ }
+ }
+ new MainFrame(new TextureImageNPOT(url), 512, 512);
+ }
+
+}