├── .gitignore ├── COPYRIGHT.txt ├── LICENSE-SPEC.html ├── LICENSE.txt ├── README-FIRST.txt ├── README-build.html ├── build-old.xml ├── build-tools └── VersionInfo.java ├── build.xml ├── docs ├── ChangeLog-1_4.html ├── ChangeLog-1_5.html ├── api-changes-1_4.txt ├── api-changes-1_5.txt ├── api-changes-1_6.txt └── perf_guide.txt └── src └── javax └── media └── j3d ├── Alpha.java ├── AlternateAppearance.java ├── AlternateAppearanceRetained.java ├── AmbientLight.java ├── AmbientLightRetained.java ├── Appearance.java ├── AppearanceRetained.java ├── AssertionFailureException.java ├── AttributeBin.java ├── AudioDevice.java ├── AudioDevice3D.java ├── AudioDevice3DL2.java ├── AudioDeviceEnumerator.java ├── AuralAttributes.java ├── AuralAttributesRetained.java ├── AutoOffScreenCanvas3D.java ├── BHInsertStructure.java ├── BHInternalNode.java ├── BHLeafInterface.java ├── BHLeafNode.java ├── BHNode.java ├── BHTree.java ├── Background.java ├── BackgroundRetained.java ├── BackgroundSound.java ├── BackgroundSoundRetained.java ├── BadTransformException.java ├── Behavior.java ├── BehaviorRetained.java ├── BehaviorScheduler.java ├── BehaviorStructure.java ├── Billboard.java ├── BoundingBox.java ├── BoundingLeaf.java ├── BoundingLeafRetained.java ├── BoundingPolytope.java ├── BoundingSphere.java ├── Bounds.java ├── BranchGroup.java ├── BranchGroupRetained.java ├── CachedFrustum.java ├── CachedTargets.java ├── Canvas3D.java ├── CanvasViewCache.java ├── CanvasViewEventCatcher.java ├── CapabilityBits.java ├── CapabilityNotSetException.java ├── Clip.java ├── ClipRetained.java ├── ColorInterpolator.java ├── ColoringAttributes.java ├── ColoringAttributesRetained.java ├── CompileState.java ├── CompressedGeometry.java ├── CompressedGeometryHeader.java ├── CompressedGeometryRenderMethod.java ├── CompressedGeometryRetained.java ├── ConeSound.java ├── ConeSoundRetained.java ├── Context.java ├── DanglingReferenceException.java ├── DecalGroup.java ├── DecalGroupRetained.java ├── DefaultRenderMethod.java ├── DepthComponent.java ├── DepthComponentFloat.java ├── DepthComponentFloatRetained.java ├── DepthComponentInt.java ├── DepthComponentIntRetained.java ├── DepthComponentNative.java ├── DepthComponentNativeRetained.java ├── DepthComponentRetained.java ├── DirectionalLight.java ├── DirectionalLightRetained.java ├── DisplayListRenderMethod.java ├── DistanceLOD.java ├── Drawable.java ├── DrawingSurfaceObject.java ├── EnvironmentSet.java ├── EventCatcher.java ├── ExceptionStrings.properties ├── ExponentialFog.java ├── ExponentialFogRetained.java ├── Fog.java ├── FogRetained.java ├── Font3D.java ├── FontExtrusion.java ├── FreeListManager.java ├── GLSLShaderProgram.java ├── GLSLShaderProgramRetained.java ├── GeneralizedStrip.java ├── GeneralizedStripFlags.java ├── GeneralizedVertexList.java ├── Geometry.java ├── GeometryArray.java ├── GeometryArrayRetained.java ├── GeometryAtom.java ├── GeometryDecompressor.java ├── GeometryDecompressorRetained.java ├── GeometryDecompressorShape3D.java ├── GeometryLock.java ├── GeometryRetained.java ├── GeometryService.java ├── GeometryStripArray.java ├── GeometryStripArrayRetained.java ├── GeometryStructure.java ├── GeometryUpdater.java ├── GraphStructureChangeListener.java ├── GraphicsConfigInfo.java ├── GraphicsConfigTemplate3D.java ├── GraphicsContext3D.java ├── Group.java ├── GroupRetained.java ├── HashKey.java ├── HiResCoord.java ├── IllegalRenderingStateException.java ├── IllegalSceneGraphException.java ├── IllegalSharingException.java ├── ImageComponent.java ├── ImageComponent2D.java ├── ImageComponent2DRetained.java ├── ImageComponent3D.java ├── ImageComponent3DRetained.java ├── ImageComponentRetained.java ├── ImageComponentUpdateInfo.java ├── IndexedGeometryArray.java ├── IndexedGeometryArrayRetained.java ├── IndexedGeometryStripArray.java ├── IndexedGeometryStripArrayRetained.java ├── IndexedLineArray.java ├── IndexedLineArrayRetained.java ├── IndexedLineStripArray.java ├── IndexedLineStripArrayRetained.java ├── IndexedObject.java ├── IndexedPointArray.java ├── IndexedPointArrayRetained.java ├── IndexedQuadArray.java ├── IndexedQuadArrayRetained.java ├── IndexedTriangleArray.java ├── IndexedTriangleArrayRetained.java ├── IndexedTriangleFanArray.java ├── IndexedTriangleFanArrayRetained.java ├── IndexedTriangleStripArray.java ├── IndexedTriangleStripArrayRetained.java ├── IndexedUnorderSet.java ├── InputDevice.java ├── InputDeviceBlockingThread.java ├── InputDeviceScheduler.java ├── IntegerFreeList.java ├── Interpolator.java ├── J3DBuffer.java ├── J3DGraphics2D.java ├── J3DGraphics2DImpl.java ├── J3dClock.java ├── J3dDebug.java ├── J3dHash.java ├── J3dI18N.java ├── J3dMessage.java ├── J3dNotification.java ├── J3dQueryProps.java ├── J3dStructure.java ├── J3dThread.java ├── J3dThreadData.java ├── JoglContext.java ├── JoglDrawable.java ├── JoglDrawingSurfaceObject.java ├── JoglGraphicsConfiguration.java ├── JoglPipeline.java ├── JoglShaderObject.java ├── LOD.java ├── Leaf.java ├── LeafRetained.java ├── Light.java ├── LightBin.java ├── LightRetained.java ├── LightSet.java ├── LineArray.java ├── LineArrayRetained.java ├── LineAttributes.java ├── LineAttributesRetained.java ├── LineStripArray.java ├── LineStripArrayRetained.java ├── LinearFog.java ├── LinearFogRetained.java ├── Link.java ├── LinkRetained.java ├── Locale.java ├── MRSWLock.java ├── MasterControl.java ├── MasterControlThread.java ├── Material.java ├── MaterialRetained.java ├── MediaContainer.java ├── MediaContainerRetained.java ├── MemoryFreeList.java ├── ModelClip.java ├── ModelClipRetained.java ├── Morph.java ├── MorphRetained.java ├── MultipleParentException.java ├── NioImageBuffer.java ├── NnuId.java ├── NnuIdManager.java ├── Node.java ├── NodeComponent.java ├── NodeComponentRetained.java ├── NodeComponentUpdate.java ├── NodeData.java ├── NodeReferenceTable.java ├── NodeRetained.java ├── NoopDrawingSurfaceObject.java ├── NoopPipeline.java ├── NotificationThread.java ├── ObjectUpdate.java ├── OrderedBin.java ├── OrderedChildInfo.java ├── OrderedCollection.java ├── OrderedGroup.java ├── OrderedGroupRetained.java ├── OrderedPath.java ├── OrderedPathElement.java ├── OrientedShape3D.java ├── OrientedShape3DRenderMethod.java ├── OrientedShape3DRetained.java ├── PathInterpolator.java ├── PhysicalBody.java ├── PhysicalEnvironment.java ├── PickBounds.java ├── PickCone.java ├── PickConeRay.java ├── PickConeSegment.java ├── PickCylinder.java ├── PickCylinderRay.java ├── PickCylinderSegment.java ├── PickInfo.java ├── PickPoint.java ├── PickRay.java ├── PickSegment.java ├── PickShape.java ├── Pipeline.java ├── PointArray.java ├── PointArrayRetained.java ├── PointAttributes.java ├── PointAttributesRetained.java ├── PointLight.java ├── PointLightRetained.java ├── PointSound.java ├── PointSoundRetained.java ├── PolygonAttributes.java ├── PolygonAttributesRetained.java ├── PositionInterpolator.java ├── PositionPathInterpolator.java ├── QuadArray.java ├── QuadArrayRetained.java ├── Raster.java ├── RasterRetained.java ├── RenderAtom.java ├── RenderAtomListInfo.java ├── RenderBin.java ├── RenderMethod.java ├── RenderMolecule.java ├── Renderer.java ├── RendererStructure.java ├── RenderingAttributes.java ├── RenderingAttributesRetained.java ├── RenderingAttributesStructure.java ├── RenderingEnvironmentStructure.java ├── RenderingError.java ├── RenderingErrorListener.java ├── RestrictedAccessException.java ├── RotPosPathInterpolator.java ├── RotPosScalePathInterpolator.java ├── RotationInterpolator.java ├── RotationPathInterpolator.java ├── ScaleInterpolator.java ├── SceneGraphCycleException.java ├── SceneGraphObject.java ├── SceneGraphObjectRetained.java ├── SceneGraphPath.java ├── Screen3D.java ├── ScreenViewCache.java ├── Sensor.java ├── SensorRead.java ├── SetLiveState.java ├── Shader.java ├── ShaderAppearance.java ├── ShaderAppearanceRetained.java ├── ShaderAttrLoc.java ├── ShaderAttribute.java ├── ShaderAttributeArray.java ├── ShaderAttributeArrayRetained.java ├── ShaderAttributeBinding.java ├── ShaderAttributeBindingRetained.java ├── ShaderAttributeObject.java ├── ShaderAttributeObjectRetained.java ├── ShaderAttributeRetained.java ├── ShaderAttributeSet.java ├── ShaderAttributeSetRetained.java ├── ShaderAttributeValue.java ├── ShaderAttributeValueRetained.java ├── ShaderBin.java ├── ShaderConstants.java ├── ShaderError.java ├── ShaderErrorListener.java ├── ShaderId.java ├── ShaderProgram.java ├── ShaderProgramId.java ├── ShaderProgramRetained.java ├── ShaderRetained.java ├── Shape3D.java ├── Shape3DCompileRetained.java ├── Shape3DRetained.java ├── SharedGroup.java ├── SharedGroupRetained.java ├── Sound.java ├── SoundException.java ├── SoundRetained.java ├── SoundScheduler.java ├── SoundSchedulerAtom.java ├── SoundStructure.java ├── Soundscape.java ├── SoundscapeRetained.java ├── SourceCodeShader.java ├── SourceCodeShaderRetained.java ├── SpotLight.java ├── SpotLightRetained.java ├── StructureUpdateThread.java ├── Switch.java ├── SwitchRetained.java ├── SwitchState.java ├── SwitchValueInterpolator.java ├── Targets.java ├── TargetsInterface.java ├── TexCoordGeneration.java ├── TexCoordGenerationRetained.java ├── Text3D.java ├── Text3DRenderMethod.java ├── Text3DRetained.java ├── Texture.java ├── Texture2D.java ├── Texture2DRetained.java ├── Texture3D.java ├── Texture3DRetained.java ├── TextureAttributes.java ├── TextureAttributesRetained.java ├── TextureBin.java ├── TextureCubeMap.java ├── TextureCubeMapRetained.java ├── TextureRetained.java ├── TextureUnitState.java ├── TextureUnitStateRetained.java ├── TimerThread.java ├── Transform3D.java ├── TransformGroup.java ├── TransformGroupData.java ├── TransformGroupRetained.java ├── TransformInterpolator.java ├── TransformStructure.java ├── TransparencyAttributes.java ├── TransparencyAttributesRetained.java ├── TransparencyInterpolator.java ├── TransparencySortGeom.java ├── TransparencySortMap.java ├── TransparentRenderingInfo.java ├── TriangleArray.java ├── TriangleArrayRetained.java ├── TriangleFanArray.java ├── TriangleFanArrayRetained.java ├── TriangleStripArray.java ├── TriangleStripArrayRetained.java ├── UnorderList.java ├── UpdateTargets.java ├── Utils.java ├── VertexArrayRenderMethod.java ├── View.java ├── ViewCache.java ├── ViewPlatform.java ├── ViewPlatformRetained.java ├── ViewSpecificGroup.java ├── ViewSpecificGroupRetained.java ├── VirtualUniverse.java ├── WakeupAnd.java ├── WakeupAndOfOrs.java ├── WakeupCondition.java ├── WakeupCriteriaEnumerator.java ├── WakeupCriterion.java ├── WakeupIndexedList.java ├── WakeupOnAWTEvent.java ├── WakeupOnActivation.java ├── WakeupOnBehaviorPost.java ├── WakeupOnCollisionEntry.java ├── WakeupOnCollisionExit.java ├── WakeupOnCollisionMovement.java ├── WakeupOnDeactivation.java ├── WakeupOnElapsedFrames.java ├── WakeupOnElapsedTime.java ├── WakeupOnElapsedTimeHeap.java ├── WakeupOnSensorEntry.java ├── WakeupOnSensorExit.java ├── WakeupOnTransformChange.java ├── WakeupOnViewPlatformEntry.java ├── WakeupOnViewPlatformExit.java ├── WakeupOr.java ├── WakeupOrOfAnds.java ├── doc-files ├── Behaviors.html ├── Behaviors1.gif ├── Behaviors2.gif ├── Behaviors3.gif ├── Behaviors4.gif ├── Behaviors5.gif ├── Behaviors6.gif ├── Behaviors7.gif ├── Behaviors8.gif ├── Concepts.html ├── Concepts1.gif ├── Concepts2.gif ├── DAG.gif ├── HelloUniverse.html ├── Immediate.html ├── Immediate1.gif ├── Rendering.html ├── SceneGraphOverview.html ├── SceneGraphSharing.html ├── SceneGraphSharing1.gif ├── SceneGraphSharing2.gif ├── SceneGraphSharing3.gif ├── SceneGraphSharing4.gif ├── SceneGraphSharing5.gif ├── ViewBranch.gif ├── ViewModel.html ├── ViewModel1.gif ├── ViewModel10.gif ├── ViewModel11.gif ├── ViewModel12.gif ├── ViewModel13.gif ├── ViewModel14.gif ├── ViewModel2.gif ├── ViewModel3.gif ├── ViewModel4.gif ├── ViewModel5.gif ├── ViewModel6.gif ├── ViewModel7.gif ├── ViewModel8.gif ├── ViewModel9.gif ├── VirtualUniverse.gif ├── VirtualUniverse.html ├── intro.gif └── intro.html └── package.html /.gitignore: -------------------------------------------------------------------------------- 1 | /build/ 2 | -------------------------------------------------------------------------------- /COPYRIGHT.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hharrison/java3d-core/baff3df05ba098e8ae6de40fbf0e5568d1549979/COPYRIGHT.txt -------------------------------------------------------------------------------- /LICENSE-SPEC.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 6 |Copyright 1996-2008 Sun Microsystems, Inc. All rights reserved. 10 | Use is subject to license terms. 11 |
12 |This javadoc-generated API documentation is not an 13 | official API specification. This documentation may contain references to 14 | Java and Java 3D, both of which are trademarks of Sun Microsystems, Inc. 15 | Any reference to these and other trademarks of Sun Microsystems are 16 | for explanatory purposes only. Their use does impart any rights beyond 17 | those listed in the source code license. In particular, Sun Microsystems 18 | retains all intellectual property and trademark rights as described in 19 | the proprietary rights notice in the COPYRIGHT.txt file. 20 |
21 | 22 | 23 | -------------------------------------------------------------------------------- /README-FIRST.txt: -------------------------------------------------------------------------------- 1 | The source code for the j3d-core project is copyrighted code that is 2 | licensed to individuals or companies who download or otherwise access 3 | the code. 4 | 5 | The copyright notice for this project is in COPYRIGHT.txt 6 | 7 | The source code license information for this project is in LICENSE.txt 8 | 9 | Additional information and license restrictions for third party source 10 | code are found in the THIRDPARTY-LICENSE-*.txt files. 11 | 12 | Instructions for building this project are in README-build.html 13 | 14 | Note that the source code in this directory is untested and presumed 15 | incompatible with the Java 3D(TM) API specification. You must only use 16 | this code in accordance with the terms under which the code is 17 | licensed. No additional rights are granted to you. 18 | 19 | If you prefer to use a tested and certified compatible version of the 20 | code, then you can download a binary release for the Solaris, Linux, 21 | Windows, and Mac OS X operating environments at: 22 | https://java3d.dev.java.net/binary-builds.html 23 | or at: 24 | http://java.sun.com/products/java-media/3D/ 25 | -------------------------------------------------------------------------------- /docs/api-changes-1_6.txt: -------------------------------------------------------------------------------- 1 | ------------------------------------------------------------------------ 2 | $RCSfile$ 3 | $Revision$ 4 | $Date$ 5 | ------------------------------------------------------------------------ 6 | This document conatains proposed API changes to the Java 3D 1.6 API 7 | that deviate from the 1.5 API. 8 | 9 | This file must be updated to record the addition or deprecation of any 10 | public or protected class, interface, field, constructor, or method to 11 | the Java 3D API. 12 | 13 | The one exception to this rule is that you don't need to update this 14 | file when adding a non-final (i.e., virtual) method to a class if that 15 | method--with exactly the same signature--already exists in a 16 | superclass. For example, adding a "toString" method to a j3d object 17 | doesn't require an entry in this file. Likewise, adding duplicateNode 18 | or cloneNode methods to Node subclasses doesn't require an entry in 19 | this file. 20 | 21 | No incompatible changes to the Java 3D 1.5 API are allowed. 22 | 23 | 24 | I. New/deprecated fields, constructors, methods 25 | 26 |cloneTree
call an updated reference was requested
31 | * for a node that did not get cloned. This happens when a sub-graph is
32 | * duplicated via cloneTree
and has at least one Leaf node
33 | * that contains a reference to a Node that has no corresponding node in
34 | * the cloned sub-graph. This results in two Leaf nodes wanting to share
35 | * access to the same Node.
36 | *
37 | * If dangling references are to be allowed during the cloneTree call,
38 | * cloneTree
should be called with the
39 | * allowDanglingReferences
parameter set to true
.
40 | * @see Node#cloneTree
41 | */
42 | public class DanglingReferenceException extends RuntimeException {
43 |
44 | /**
45 | * Create the exception object with default values.
46 | */
47 | public DanglingReferenceException() {
48 | }
49 |
50 | /**
51 | * Create the exception object that outputs message.
52 | * @param str the message string to be output.
53 | */
54 | public DanglingReferenceException(String str) {
55 | super(str);
56 | }
57 |
58 | }
59 |
--------------------------------------------------------------------------------
/src/javax/media/j3d/DecalGroupRetained.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 1996-2008 Sun Microsystems, Inc. All Rights Reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Sun designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Sun in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22 | * CA 95054 USA or visit www.sun.com if you need additional information or
23 | * have any questions.
24 | *
25 | */
26 |
27 | package javax.media.j3d;
28 |
29 | class DecalGroupRetained extends OrderedGroupRetained {
30 |
31 | DecalGroupRetained() {
32 | this.nodeType = NodeRetained.DECALGROUP;
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/src/javax/media/j3d/DefaultRenderMethod.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 1999-2008 Sun Microsystems, Inc. All Rights Reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Sun designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Sun in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22 | * CA 95054 USA or visit www.sun.com if you need additional information or
23 | * have any questions.
24 | *
25 | */
26 |
27 | package javax.media.j3d;
28 |
29 | /**
30 | * The RenderMethod interface is used to create various ways to render
31 | * different geometries.
32 | */
33 |
34 | class DefaultRenderMethod implements RenderMethod {
35 | /**
36 | * The actual rendering code for this RenderMethod
37 | */
38 | @Override
39 | public boolean render(RenderMolecule rm, Canvas3D cv,
40 | RenderAtomListInfo ra, int dirtyBits) {
41 |
42 | boolean isVisible = false; // True if any of the RAs is visible.
43 |
44 | while (ra != null) {
45 | if (cv.ra == ra.renderAtom) {
46 | if (cv.raIsVisible) {
47 | cv.updateState(dirtyBits);
48 | ra.geometry().execute(cv, ra.renderAtom,
49 | rm.isNonUniformScale,
50 | rm.useAlpha, rm.alpha,
51 | cv.screen.screen,
52 | rm.textureBin.attributeBin.
53 | ignoreVertexColors);
54 | isVisible = true;
55 | }
56 | }
57 | else {
58 | if (!VirtualUniverse.mc.viewFrustumCulling ||
59 | ra.renderAtom.localeVwcBounds.intersect(cv.viewFrustum)) {
60 | cv.raIsVisible = true;
61 | cv.updateState(dirtyBits);
62 | ra.geometry().execute(cv, ra.renderAtom, rm.isNonUniformScale,
63 | rm.useAlpha, rm.alpha,
64 | cv.screen.screen,
65 | rm.textureBin.attributeBin.
66 | ignoreVertexColors);
67 | isVisible = true;
68 | }
69 | else {
70 | cv.raIsVisible = false;
71 | }
72 | cv.ra = ra.renderAtom;
73 | }
74 | ra = ra.next;
75 | }
76 |
77 | return isVisible;
78 |
79 | }
80 |
81 |
82 |
83 | }
84 |
--------------------------------------------------------------------------------
/src/javax/media/j3d/DepthComponent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 1997-2008 Sun Microsystems, Inc. All Rights Reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Sun designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Sun in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22 | * CA 95054 USA or visit www.sun.com if you need additional information or
23 | * have any questions.
24 | *
25 | */
26 |
27 | package javax.media.j3d;
28 |
29 | /**
30 | * Abstract base class that defines a 2D array of depth (Z) values.
31 | */
32 |
33 | public abstract class DepthComponent extends NodeComponent {
34 | /**
35 | * Specifies that this DepthComponent object allows reading its
36 | * size component information (width and height).
37 | */
38 | public static final int
39 | ALLOW_SIZE_READ = CapabilityBits.DEPTH_COMPONENT_ALLOW_SIZE_READ;
40 |
41 | /**
42 | * Specifies that this DepthComponent object allows reading its
43 | * depth data component information.
44 | */
45 | public static final int
46 | ALLOW_DATA_READ = CapabilityBits.DEPTH_COMPONENT_ALLOW_DATA_READ;
47 |
48 | // Array for setting default read capabilities
49 | private static final int[] readCapabilities = {
50 | ALLOW_SIZE_READ,
51 | ALLOW_DATA_READ
52 | };
53 |
54 | /**
55 | * default constructor
56 | */
57 | DepthComponent() {
58 | // set default read capabilities
59 | setDefaultReadCapabilities(readCapabilities);
60 | }
61 |
62 | /**
63 | * Retrieves the width of this depth component object.
64 | * @return the width of the array of depth values
65 | * @exception CapabilityNotSetException if appropriate capability is
66 | * not set and this object is part of live or compiled scene graph
67 | */
68 | public int getWidth() {
69 | if (isLiveOrCompiled())
70 | if (!this.getCapability(ALLOW_SIZE_READ))
71 | throw new CapabilityNotSetException(J3dI18N.getString("DepthComponent0"));
72 | return ((DepthComponentRetained)this.retained).getWidth();
73 | }
74 |
75 | /**
76 | * Retrieves the height of this depth component object.
77 | * @return the height of the array of depth values
78 | * @exception CapabilityNotSetException if appropriate capability is
79 | * not set and this object is part of live or compiled scene graph
80 | */
81 | public int getHeight() {
82 | if (isLiveOrCompiled())
83 | if (!this.getCapability(ALLOW_SIZE_READ))
84 | throw new CapabilityNotSetException(J3dI18N.getString("DepthComponent0"));
85 | return ((DepthComponentRetained)this.retained).getHeight();
86 | }
87 |
88 |
89 | }
90 |
--------------------------------------------------------------------------------
/src/javax/media/j3d/DepthComponentFloatRetained.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 1998-2008 Sun Microsystems, Inc. All Rights Reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Sun designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Sun in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22 | * CA 95054 USA or visit www.sun.com if you need additional information or
23 | * have any questions.
24 | *
25 | */
26 |
27 | package javax.media.j3d;
28 |
29 |
30 | /**
31 | * A 2D array of depth (Z) values in floating point format in the range [0,1].
32 | * A value of 0.0 indicates the closest Z value to the user while a value of
33 | * 1.0 indicates the farthest Z value.
34 | */
35 |
36 | class DepthComponentFloatRetained extends DepthComponentRetained {
37 | float depthData[];
38 |
39 | /**
40 | * Constructs a new floating-point depth (z-buffer) component object with
41 | * the specified width and height.
42 | * @param width the width of the array of depth values
43 | * @param height the height of the array of depth values
44 | */
45 | void initialize(int width, int height) {
46 | type = DEPTH_COMPONENT_TYPE_FLOAT;
47 | depthData = new float[width * height];
48 | this.width = width;
49 | this.height = height;
50 | }
51 |
52 | /**
53 | * Copies the specified depth data to this object.
54 | * @param depthData array of floats containing the depth data
55 | */
56 | void setDepthData(float[] depthData) {
57 | int i;
58 | for (i = 0; i < depthData.length; i++)
59 | this.depthData[i] = depthData[i];
60 | }
61 |
62 |
63 | /**
64 | * Copies the depth data from this object to the specified array.
65 | * @param depthData array of floats that will receive a copy of
66 | * the depth data
67 | */
68 | void getDepthData(float[] depthData) {
69 | int i;
70 | for (i = 0; i < this.depthData.length; i++)
71 | depthData[i] = this.depthData[i];
72 | }
73 |
74 | /*
75 | * retrieve depth data from input buffer
76 | */
77 | final void retrieveDepth(float[] buf, int wRead, int hRead) {
78 | int srcOffset, dstOffset, i;
79 |
80 | // Yup -> Ydown
81 | for (srcOffset = (hRead - 1) * wRead, dstOffset = 0,
82 | i = 0; i < hRead; i++,
83 | srcOffset -= wRead, dstOffset += width) {
84 |
85 | System.arraycopy(buf, srcOffset, depthData, dstOffset, wRead);
86 | }
87 | }
88 | }
89 |
--------------------------------------------------------------------------------
/src/javax/media/j3d/DepthComponentIntRetained.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 1998-2008 Sun Microsystems, Inc. All Rights Reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Sun designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Sun in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22 | * CA 95054 USA or visit www.sun.com if you need additional information or
23 | * have any questions.
24 | *
25 | */
26 |
27 | package javax.media.j3d;
28 |
29 |
30 | /**
31 | * A 2D array of depth (Z) values in integer format. Values are in the
32 | * range [0,(2**N)-1], where N is the pixel depth of the Z buffer.
33 | */
34 |
35 | class DepthComponentIntRetained extends DepthComponentRetained {
36 | int depthData[];
37 |
38 | /**
39 | * Constructs a new integer depth (z-buffer) component object with the
40 | * specified width and height.
41 | * @param width the width of the array of depth values
42 | * @param height the height of the array of depth values
43 | */
44 | void initialize(int width, int height) {
45 | type = DEPTH_COMPONENT_TYPE_INT;
46 | depthData = new int[width * height];
47 | this.width = width;
48 | this.height = height;
49 | }
50 |
51 | /**
52 | * Copies the specified depth data to this object.
53 | * @param depthData array of ints containing the depth data
54 | */
55 | void setDepthData(int[] depthData) {
56 | int i;
57 | for (i = 0; i < depthData.length; i++)
58 | this.depthData[i] = depthData[i];
59 | }
60 |
61 |
62 | /**
63 | * Copies the depth data from this object to the specified array.
64 | * @param depthData array of ints that will receive a copy of
65 | * the depth data
66 | */
67 | void getDepthData(int[] depthData) {
68 | int i;
69 |
70 | for (i = 0; i < this.depthData.length; i++)
71 | depthData[i] = this.depthData[i];
72 | }
73 |
74 | /**
75 | * retrieve depth data from input buffer
76 | */
77 | final void retrieveDepth(int[] buf, int wRead, int hRead) {
78 | int srcOffset, dstOffset, i;
79 |
80 | // Yup -> Ydown
81 | for (srcOffset = (hRead - 1) * wRead, dstOffset = 0,
82 | i = 0; i < hRead; i++,
83 | srcOffset -= wRead, dstOffset += width) {
84 |
85 | System.arraycopy(buf, srcOffset, depthData, dstOffset, wRead);
86 | }
87 | }
88 | }
89 |
--------------------------------------------------------------------------------
/src/javax/media/j3d/DepthComponentNativeRetained.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 1998-2008 Sun Microsystems, Inc. All Rights Reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Sun designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Sun in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22 | * CA 95054 USA or visit www.sun.com if you need additional information or
23 | * have any questions.
24 | *
25 | */
26 |
27 | package javax.media.j3d;
28 |
29 | /**
30 | * A 2D array of depth (Z) values stored in the most efficient format for a
31 | * particular device. Values are not accessible by the user and may only be
32 | * used to read the Z values and subsequently write them back.
33 | */
34 |
35 | class DepthComponentNativeRetained extends DepthComponentRetained {
36 | // Change this to whatever native format is best...
37 | int depthData[];
38 |
39 | /**
40 | * Constructs a new native depth (z-buffer) component object with the
41 | * specified width and height.
42 | * @param width the width of the array of depth values
43 | * @param height the height of the array of depth values
44 | */
45 | void initialize(int width, int height) {
46 | type = DEPTH_COMPONENT_TYPE_NATIVE;
47 | depthData = new int[width * height];
48 | this.width = width;
49 | this.height = height;
50 | }
51 |
52 | /**
53 | * Copies the depth data from this object to the specified array.
54 | * @param depthData array of ints that will receive a copy of
55 | * the depth data
56 | */
57 | void getDepthData(int[] depthData) {
58 | int i;
59 | for (i = 0; i < this.depthData.length; i++)
60 | depthData[i] = this.depthData[i];
61 | }
62 |
63 | /**
64 | * retrieve depth data from input buffer
65 | */
66 | final void retrieveDepth(int[] buf, int wRead, int hRead) {
67 | int srcOffset, dstOffset, i;
68 |
69 | // Yup -> Ydown
70 | for (srcOffset = (hRead - 1) * wRead, dstOffset = 0,
71 | i = 0; i < hRead; i++,
72 | srcOffset -= wRead, dstOffset += width) {
73 |
74 | System.arraycopy(buf, srcOffset, depthData, dstOffset, wRead);
75 | }
76 | }
77 | }
78 |
--------------------------------------------------------------------------------
/src/javax/media/j3d/DepthComponentRetained.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 1998-2008 Sun Microsystems, Inc. All Rights Reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Sun designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Sun in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22 | * CA 95054 USA or visit www.sun.com if you need additional information or
23 | * have any questions.
24 | *
25 | */
26 |
27 | package javax.media.j3d;
28 |
29 | /**
30 | * Abstract base class that defines a 2D array of depth (Z) values.
31 | */
32 |
33 |
34 | abstract class DepthComponentRetained extends NodeComponentRetained {
35 | // depth component types
36 | static final int DEPTH_COMPONENT_TYPE_INT = 1;
37 | static final int DEPTH_COMPONENT_TYPE_FLOAT = 2;
38 | static final int DEPTH_COMPONENT_TYPE_NATIVE = DEPTH_COMPONENT_TYPE_INT;
39 |
40 |
41 | // Width and height of DepthComponent---set by subclasses
42 | int width;
43 | int height;
44 | int type;
45 |
46 | /**
47 | * Retrieves the width of this depth component object
48 | * @return the width of the array of depth values
49 | */
50 | int getWidth() {
51 | return width;
52 | }
53 |
54 | /**
55 | * Retrieves the height of this depth component object
56 | * @return the height of the array of depth values
57 | */
58 | int getHeight() {
59 | return height;
60 | }
61 |
62 | }
63 |
--------------------------------------------------------------------------------
/src/javax/media/j3d/Drawable.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2006-2008 Sun Microsystems, Inc. All Rights Reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Sun designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Sun in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22 | * CA 95054 USA or visit www.sun.com if you need additional information or
23 | * have any questions.
24 | *
25 | */
26 |
27 | package javax.media.j3d;
28 |
29 | /**
30 | * Tagging interface for drawable (window) objects. The rendering pipelines
31 | * will define concrete classes that implement this interface. All code that
32 | * uses the tagged objects will be in the pipelines.
33 | */
34 | interface Drawable {
35 | // No methods or constants defined at this time
36 | }
37 |
--------------------------------------------------------------------------------
/src/javax/media/j3d/DrawingSurfaceObject.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 1999-2008 Sun Microsystems, Inc. All Rights Reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Sun designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Sun in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22 | * CA 95054 USA or visit www.sun.com if you need additional information or
23 | * have any questions.
24 | *
25 | */
26 |
27 | package javax.media.j3d;
28 |
29 | /**
30 | * The DrawingSurfaceObject class is used to manage native drawing surface
31 | */
32 |
33 | abstract class DrawingSurfaceObject extends Object {
34 |
35 | Canvas3D canvas;
36 | boolean gotDsiLock = false;
37 | boolean onScreen;
38 |
39 | abstract boolean renderLock();
40 | abstract void unLock();
41 | abstract void getDrawingSurfaceObjectInfo();
42 | abstract void invalidate();
43 |
44 | DrawingSurfaceObject(Canvas3D cv) {
45 | canvas = cv;
46 | onScreen = !cv.offScreen;
47 | }
48 |
49 | synchronized boolean isLocked() {
50 | return gotDsiLock;
51 | }
52 |
53 | synchronized void contextValidated() {
54 | canvas.validCtx = true;
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/src/javax/media/j3d/FreeListManager.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2001-2008 Sun Microsystems, Inc. All Rights Reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Sun designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Sun in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22 | * CA 95054 USA or visit www.sun.com if you need additional information or
23 | * have any questions.
24 | *
25 | */
26 |
27 | package javax.media.j3d;
28 |
29 |
30 | class FreeListManager {
31 |
32 | private static final boolean DEBUG = false;
33 |
34 | // constants that represent the freelists managed by the Manager
35 | static final int DISPLAYLIST = 0;
36 |
37 | private static int maxFreeListNum = 0;
38 |
39 | // what list we are going to shrink next
40 | private static int currlist = 0;
41 |
42 | static MemoryFreeList[] freelist = null;
43 |
44 | static void createFreeLists() {
45 | maxFreeListNum = 0;
46 | freelist = new MemoryFreeList[maxFreeListNum+1];
47 | freelist[DISPLAYLIST] = new IntegerFreeList();
48 | }
49 |
50 | // see if the current list can be shrunk
51 | static void manageLists() {
52 | // System.err.println("manageLists");
53 | if (freelist[currlist] != null) {
54 | freelist[currlist].shrink();
55 | }
56 |
57 | currlist++;
58 | if (currlist > maxFreeListNum) currlist = 0;
59 | }
60 |
61 | // return the freelist specified by the list param
62 | static MemoryFreeList getFreeList(int list) {
63 | if (list < 0 || list > maxFreeListNum) {
64 | if (DEBUG) System.err.println("illegal list");
65 | return null;
66 | }
67 | else {
68 | return freelist[list];
69 | }
70 | }
71 |
72 | static Object getObject(int listId) {
73 | return freelist[listId].getObject();
74 | }
75 |
76 | static void freeObject(int listId, Object obj) {
77 | freelist[listId].add(obj);
78 | }
79 |
80 | static void clearList(int listId) {
81 | freelist[listId].clear();
82 | }
83 |
84 | }
85 |
--------------------------------------------------------------------------------
/src/javax/media/j3d/GeneralizedStripFlags.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 1998-2008 Sun Microsystems, Inc. All Rights Reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Sun designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Sun in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22 | * CA 95054 USA or visit www.sun.com if you need additional information or
23 | * have any questions.
24 | *
25 | */
26 |
27 | package javax.media.j3d;
28 |
29 | /**
30 | * A class which implements GeneralizedStripFlags provides the means to access
31 | * the vertex replace code flags associated with each vertex of a generalized
32 | * strip. This allows a flexible representation of generalized strips for
33 | * various classes and makes it possible to provide a common subset of static
34 | * methods which operate only on their topology.
35 | *
36 | * @see GeneralizedStrip
37 | * @see GeneralizedVertexList
38 | */
39 | interface GeneralizedStripFlags {
40 |
41 | /**
42 | * This flag indicates that a vertex starts a new strip with clockwise
43 | * winding.
44 | */
45 | static final int RESTART_CW = 0 ;
46 |
47 | /**
48 | * This flag indicates that a vertex starts a new strip with
49 | * counter-clockwise winding.
50 | */
51 | static final int RESTART_CCW = 1 ;
52 |
53 | /**
54 | * This flag indicates that the next triangle in the strip is defined by
55 | * replacing the middle vertex of the previous triangle in the strip.
56 | */
57 | static final int REPLACE_MIDDLE = 2 ;
58 |
59 | /**
60 | * This flag indicates that the next triangle in the strip is defined by
61 | * replacing the oldest vertex of the previous triangle in the strip.
62 | */
63 | static final int REPLACE_OLDEST = 3 ;
64 |
65 | /**
66 | * This constant is used to indicate that triangles with clockwise vertex
67 | * winding are front facing.
68 | */
69 | static final int FRONTFACE_CW = 0 ;
70 |
71 | /**
72 | * This constant is used to indicate that triangles with counter-clockwise
73 | * vertex winding are front facing.
74 | */
75 | static final int FRONTFACE_CCW = 1 ;
76 |
77 | /**
78 | * Return the number of flags. This should be the same as the number of
79 | * vertices in the generalized strip.
80 | */
81 | int getFlagCount() ;
82 |
83 | /**
84 | * Return the flag associated with the vertex at the specified index.
85 | */
86 | int getFlag(int index) ;
87 | }
88 |
--------------------------------------------------------------------------------
/src/javax/media/j3d/Geometry.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 1997-2008 Sun Microsystems, Inc. All Rights Reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Sun designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Sun in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22 | * CA 95054 USA or visit www.sun.com if you need additional information or
23 | * have any questions.
24 | *
25 | */
26 |
27 | package javax.media.j3d;
28 |
29 | /**
30 | * Geometry is an abstract class that specifies the geometry
31 | * component information required by a Shape3D node. Geometry objects
32 | * describe both the geometry and topology of the Shape3D nodes that
33 | * reference them. Geometry objects consist of four generic geometric
34 | * types:
35 | *
40 | * Each of these geometric types defines a visible object or set of 41 | * objects. A Geometry object is used as a component object of a Shape3D 42 | * leaf node. 43 | * 44 | */ 45 | 46 | public abstract class Geometry extends NodeComponent { 47 | 48 | /** 49 | * Specifies that this Geometry allows intersect operation. This 50 | * capability bit is set (true) by default for all Geometry objects. 51 | */ 52 | public static final int 53 | ALLOW_INTERSECT = CapabilityBits.GEOMETRY_ALLOW_INTERSECT; 54 | 55 | // Array for setting default read capabilities 56 | private static final int[] readCapabilities = { 57 | ALLOW_INTERSECT 58 | }; 59 | 60 | /** 61 | * Constructs a new Geometry object. 62 | */ 63 | public Geometry() { 64 | // set default read capabilities 65 | setDefaultReadCapabilities(readCapabilities); 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /src/javax/media/j3d/GeometryLock.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2008 Sun Microsystems, Inc. All Rights Reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Sun designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Sun in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 22 | * CA 95054 USA or visit www.sun.com if you need additional information or 23 | * have any questions. 24 | * 25 | */ 26 | 27 | package javax.media.j3d; 28 | 29 | 30 | class GeometryLock { 31 | 32 | // Current thread holding the lock 33 | Thread threadId = null; 34 | 35 | // Whether the lock is currently owned 36 | boolean lockOwned = false; 37 | 38 | // Count > 1 , if there is nested lock by the same thread 39 | int count = 0; 40 | 41 | // Number of outstanding threads waiting for the lock 42 | int waiting = 0; 43 | 44 | 45 | synchronized void getLock() { 46 | Thread curThread = Thread.currentThread(); 47 | // If the thread already has the lock, incr 48 | // a count and return 49 | if (threadId == curThread) { 50 | count++; 51 | return; 52 | } 53 | // Otherwise, wait until the lock is released 54 | while (lockOwned) { 55 | try { 56 | waiting++; 57 | wait(); 58 | } catch (InterruptedException e) { 59 | System.err.println(e); 60 | } 61 | waiting--; 62 | } 63 | count++; 64 | // Acquire the lock 65 | lockOwned = true; 66 | threadId = curThread; 67 | } 68 | 69 | synchronized void unLock() { 70 | Thread curThread = Thread.currentThread(); 71 | if (threadId == curThread) { 72 | // If the lock count > 0, then return 73 | if (--count > 0) { 74 | return; 75 | } 76 | lockOwned = false; 77 | threadId = null; 78 | if (waiting > 0) { 79 | notify(); 80 | } 81 | } 82 | 83 | } 84 | 85 | } 86 | -------------------------------------------------------------------------------- /src/javax/media/j3d/GeometryService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 JogAmp Community. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Sun designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Sun in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | */ 17 | package javax.media.j3d; 18 | 19 | import java.util.ArrayList; 20 | 21 | import javax.vecmath.Point3f; 22 | 23 | /** 24 | * A service interface for certain geometric operations that are not available 25 | * in core Java 3D. 26 | *
27 | * In particular, the {@code j3d-core-utils} project provides additional 28 | * functionality under a different license, which is needed in some 29 | * circumstances by core Java 3D. Thus, historically, these two projects have 30 | * been co-dependent. This interface breaks the circular dependency by using 31 | * Java's service discovery mechanism: if {@code j3d-core-utils} is present on 32 | * the classpath, its {@code GeometryServiceImpl} will provide the functionality 33 | * defined here. Or if not (i.e., no suitable {@code GeometryService} 34 | * implementation can be discovered and instantiated}), then the Java3D core 35 | * will fail as gracefully as possible. 36 | *
37 | * 38 | * @see Font3D#triangulateGlyphs 39 | */ 40 | public interface GeometryService { 41 | 42 | /** 43 | * Loops through each island, calling triangulator once per island. Combines 44 | * triangle data for all islands together in one object. 45 | * 46 | * @param islandCounts TODO 47 | * @param outVerts TODO 48 | * @param contourCounts TODO 49 | * @param triangData TODO 50 | * @return total vertex count of the combined array 51 | */ 52 | int triangulateIslands(int[][] islandCounts, Point3f[][] outVerts, 53 | int[] contourCounts, ArrayListupdateData
method of the
36 | * GeometryArray object to be modified.
37 | *
38 | * @since Java 3D 1.2
39 | */
40 |
41 | public interface GeometryUpdater {
42 | /**
43 | * Updates geometry data that is accessed by reference.
44 | * This method is called by the updateData method of a
45 | * GeometryArray object to effect
46 | * safe updates to vertex data that
47 | * is referenced by that object. Applications that wish to modify
48 | * such data must implement this method and perform all updates
49 | * within it.
50 | *
37 | * NOTE: Applications should not extend this class directly.
38 | */
39 |
40 | public abstract class Leaf extends Node {
41 |
42 | /**
43 | * Construct and initialize the Leaf object.
44 | */
45 | public Leaf(){
46 | }
47 |
48 | }
49 |
--------------------------------------------------------------------------------
/src/javax/media/j3d/LeafRetained.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 1996-2008 Sun Microsystems, Inc. All Rights Reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Sun designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Sun in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22 | * CA 95054 USA or visit www.sun.com if you need additional information or
23 | * have any questions.
24 | *
25 | */
26 |
27 | package javax.media.j3d;
28 | import java.util.ArrayList;
29 |
30 | /**
31 | * LeafRetained node.
32 | */
33 | abstract class LeafRetained extends NodeRetained {
34 |
35 | SwitchState switchState = null;
36 |
37 | // temporary variable used during bounds computation, since
38 | // multiple mirror shapes could be pointing to the same shape3D
39 | boolean boundsDirty = false;
40 |
41 | // Appicable only to the mirror object
42 | void updateBoundingLeaf() {
43 |
44 | }
45 | protected Object clone(boolean forceDuplicate) {
46 | return super.clone();
47 | }
48 |
49 | void updateMirrorObject(Object[] args) {
50 | }
51 |
52 | void updateTransformChange() {
53 | }
54 |
55 | void updateBounds() {
56 | }
57 |
58 | void getMirrorObjects(ArrayList l, HashKey k) {
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/src/javax/media/j3d/LightSet.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 1997-2008 Sun Microsystems, Inc. All Rights Reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Sun designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Sun in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22 | * CA 95054 USA or visit www.sun.com if you need additional information or
23 | * have any questions.
24 | *
25 | */
26 |
27 | package javax.media.j3d;
28 |
29 |
30 | class LightSet extends Object {
31 | /**
32 | * The Lights that make up this set
33 | */
34 | LightRetained[] lights = null;
35 |
36 | // The number of lights in this lightset, may be less than lights.length
37 | int nlights = 0;
38 |
39 | // A reference to the next LightSet
40 | LightSet next = null;
41 |
42 | // A reference to the previous LightSet
43 | LightSet prev = null;
44 |
45 | // A flag that indicates that lighting is on
46 | boolean lightingOn = true;
47 |
48 | // A flag that indicates that this light set has changed.
49 | boolean isDirty = true;
50 |
51 | /**
52 | * Constructs a new LightSet
53 | */
54 | LightSet(RenderBin rb, RenderAtom ra, LightRetained[] lights,
55 | int nlights, boolean lightOn) {
56 | this.reset(rb, ra, lights, nlights, lightOn);
57 | }
58 |
59 | void reset(RenderBin rb, RenderAtom ra, LightRetained[] lights,
60 | int nlights, boolean lightOn) {
61 | int i;
62 |
63 | this.isDirty = true;
64 | this.lightingOn = lightOn;
65 | if (this.lights == null || this.lights.length < nlights) {
66 | this.lights = new LightRetained[nlights];
67 | }
68 |
69 | for (i=0; i
41 | * There are two ways in which values can be specified for uniform
42 | * attributes: explicitly, by providing a value; and implicitly, by
43 | * defining a binding between a Java 3D system attribute and a uniform
44 | * attribute. This functionality is provided by two subclasses of
45 | * ShaderAttribute as follows:
46 | *
47 | * Here are code fragments from a simple program, Provides the core set of classes for the
11 | 3D graphics API for the Java platform; click here for more information,
13 | including explanatory material that was formerly found in the guide.
14 | The 3D API is an application
17 | programming interface used for writing three-dimensional graphics
18 | applications and applets. It gives developers high-level constructs for
19 | creating and manipulating 3D geometry and for constructing the
20 | structures used in rendering that geometry. Application developers can
21 | describe very large virtual worlds using these constructs, which
22 | provide the runtime system with enough information to render these worlds
23 | efficiently.
24 | PI/64
.
49 | */
50 | public PickCone() {
51 | this.origin = new Point3d();
52 | this.direction = new Vector3d();
53 | this.spreadAngle = Math.PI / 64.0;
54 | }
55 |
56 | /**
57 | * Gets the origin of this PickCone.
58 | * @param origin the Point3d object into which the origin will be copied.
59 | */
60 | public void getOrigin(Point3d origin) {
61 | origin.set(this.origin);
62 | }
63 |
64 | /**
65 | * Gets the direction of this PickCone.
66 | * @param direction the Vector3d object into which the direction
67 | * will be copied.
68 | */
69 | public void getDirection(Vector3d direction) {
70 | direction.set(this.direction);
71 | }
72 |
73 |
74 | /**
75 | * Gets the spread angle of this PickCone.
76 | * @return the spread angle.
77 | */
78 | public double getSpreadAngle() {
79 | return spreadAngle;
80 | }
81 |
82 | /**
83 | * Gets the radius of this PickCone at the specified distance.
84 | * @param distance the distance from the origin at which we want
85 | * the radius of the cone
86 | * @return the radius at the specified distance
87 | */
88 | double getRadius(double distance) {
89 | return distance * Math.tan (spreadAngle);
90 | }
91 |
92 | /**
93 | * Return true if shape intersect with bounds.
94 | * The point of intersection is stored in pickPos.
95 | */
96 | @Override
97 | abstract boolean intersect(Bounds bounds, Point4d pickPos);
98 |
99 | @Override
100 | Point3d getStartPoint() {
101 | return origin;
102 | }
103 |
104 | @Override
105 | int getPickType() {
106 | return PICKCONE;
107 | }
108 | }
109 |
--------------------------------------------------------------------------------
/src/javax/media/j3d/PickShape.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 1997-2008 Sun Microsystems, Inc. All Rights Reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Sun designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Sun in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22 | * CA 95054 USA or visit www.sun.com if you need additional information or
23 | * have any questions.
24 | *
25 | */
26 |
27 | package javax.media.j3d;
28 | import javax.vecmath.Point3d;
29 | import javax.vecmath.Point4d;
30 |
31 | /**
32 | * An abstract class for describing a pick shape that can be used with
33 | * the BranchGroup and Locale picking methods.
34 | *
35 | * @see BranchGroup#pickAll
36 | * @see Locale#pickAll
37 | */
38 | public abstract class PickShape {
39 |
40 | // Use for picking
41 | static final int PICKRAY = 1;
42 | static final int PICKSEGMENT = 2;
43 | static final int PICKPOINT = 3;
44 | static final int PICKCYLINDER = 4;
45 | static final int PICKCONE = 5;
46 | static final int PICKBOUNDINGBOX = 6;
47 | static final int PICKBOUNDINGSPHERE = 7;
48 | static final int PICKBOUNDINGPOLYTOPE = 8;
49 | static final int PICKUNKNOWN = 9;
50 |
51 | /**
52 | * Constructs a PickShape object.
53 | */
54 | public PickShape() {
55 | }
56 |
57 | /**
58 | * Return true if shape intersect with bounds.
59 | * The point of intersection is stored in pickPos.
60 | */
61 | abstract boolean intersect(Bounds bounds, Point4d pickPos);
62 |
63 | // Only use within J3D.
64 | // Return a new PickShape that is the transformed (t3d) of this pickShape.
65 | abstract PickShape transform(Transform3D t3d);
66 |
67 | // Get the start point use to compute the distance
68 | // with intersect point for this shape.
69 | abstract Point3d getStartPoint();
70 |
71 | // Return the distance between the original of this
72 | // pickShape and iPnt
73 | double distance(Point3d iPnt) {
74 | Point3d p = getStartPoint();
75 | double x = iPnt.x - p.x;
76 | double y = iPnt.y - p.y;
77 | double z = iPnt.z - p.z;
78 | return Math.sqrt(x*x + y*y + z*z);
79 | }
80 |
81 | // Return one of PickShape type constant define above
82 | abstract int getPickType();
83 |
84 | }
85 |
86 |
--------------------------------------------------------------------------------
/src/javax/media/j3d/RenderAtomListInfo.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2000-2008 Sun Microsystems, Inc. All Rights Reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Sun designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Sun in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22 | * CA 95054 USA or visit www.sun.com if you need additional information or
23 | * have any questions.
24 | *
25 | */
26 |
27 | package javax.media.j3d;
28 | /**
29 | * Information per geometry in the renderAtom, there are several
30 | * of these per RenderAtom, one per geometry in GeometryAtom
31 | */
32 | class RenderAtomListInfo extends Object {
33 |
34 | final RenderAtom renderAtom; // RenderAtom that its a part of
35 |
36 | // Specific geometry index in the GeometryAtom geometryArr list that
37 | // corresponds to this RenderAtomListInfo
38 | final int index;
39 |
40 | // Prev and next pointer
41 | RenderAtomListInfo next = null;
42 | RenderAtomListInfo prev = null;
43 |
44 | // Which bucket in the renderMolecule that it falls info
45 | int groupType = 0;
46 |
47 | // Used only for Text3D
48 | // background geometry rendering
49 | Transform3D infLocalToVworld = null;
50 | Transform3D localToVworld = null;
51 |
52 | RenderAtomListInfo(RenderAtom ra, int idx) {
53 | renderAtom = ra;
54 | index = idx;
55 | }
56 |
57 | GeometryRetained geometry() {
58 | return renderAtom.geometryAtom.geometryArray[index];
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/src/javax/media/j3d/RenderMethod.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 1999-2008 Sun Microsystems, Inc. All Rights Reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Sun designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Sun in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22 | * CA 95054 USA or visit www.sun.com if you need additional information or
23 | * have any questions.
24 | *
25 | */
26 |
27 | package javax.media.j3d;
28 |
29 | /**
30 | * The RenderMethod interface is used to create various ways to render
31 | * different geometries.
32 | */
33 |
34 | interface RenderMethod {
35 |
36 | /**
37 | * The actual rendering code for this RenderMethod
38 | */
39 | abstract boolean render(RenderMolecule rm, Canvas3D cv,
40 | RenderAtomListInfo ra, int dirtyBits);
41 | }
42 |
--------------------------------------------------------------------------------
/src/javax/media/j3d/RendererStructure.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 1999-2008 Sun Microsystems, Inc. All Rights Reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Sun designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Sun in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22 | * CA 95054 USA or visit www.sun.com if you need additional information or
23 | * have any questions.
24 | *
25 | */
26 |
27 | package javax.media.j3d;
28 |
29 |
30 | /**
31 | * A renderer structure is an object that organizes messages
32 | * to the renderer thread.
33 | */
34 | class RendererStructure extends J3dStructure{
35 |
36 | /**
37 | * This constructor does nothing
38 | */
39 | RendererStructure() {
40 | super(null, J3dThread.RENDER_THREAD);
41 | }
42 |
43 | /**
44 | * Returns all messages in the queue.
45 | */
46 | J3dMessage[] getMessages() {
47 | int sz;
48 |
49 | synchronized (messageList) {
50 | if ((sz = messageList.size()) > 0) {
51 | if (msgList.length < sz) {
52 | msgList = new J3dMessage[sz];
53 | }
54 | messageList.toArrayAndClear(msgList);
55 | }
56 | }
57 |
58 | nMessage = sz;
59 | return msgList;
60 | }
61 |
62 |
63 | @Override
64 | void processMessages(long referenceTime) {}
65 |
66 | @Override
67 | void removeNodes(J3dMessage m) {}
68 |
69 | @Override
70 | void cleanup() {}
71 | }
72 |
--------------------------------------------------------------------------------
/src/javax/media/j3d/RenderingErrorListener.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2006-2008 Sun Microsystems, Inc. All Rights Reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Sun designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Sun in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22 | * CA 95054 USA or visit www.sun.com if you need additional information or
23 | * have any questions.
24 | *
25 | */
26 |
27 | package javax.media.j3d;
28 |
29 | /**
30 | * Listener interface for monitoring Java 3D rendering errors.
31 | *
32 | * @see VirtualUniverse#addRenderingErrorListener
33 | *
34 | * @since Java 3D 1.5
35 | */
36 | public interface RenderingErrorListener {
37 | /**
38 | * Invoked when an error occurs in the Java 3D rendering system.
39 | *
40 | * @param error object that contains the details of the error.
41 | */
42 | public void errorOccurred(RenderingError error);
43 | }
44 |
--------------------------------------------------------------------------------
/src/javax/media/j3d/RestrictedAccessException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 1997-2008 Sun Microsystems, Inc. All Rights Reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Sun designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Sun in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22 | * CA 95054 USA or visit www.sun.com if you need additional information or
23 | * have any questions.
24 | *
25 | */
26 |
27 | package javax.media.j3d;
28 |
29 | /**
30 | * Indicates an attempt to access or modify a state variable
31 | * without permission to do so. For example, invoking a set
32 | * method for a state variable that is currently read-only.
33 | */
34 | public class RestrictedAccessException extends RuntimeException {
35 |
36 | /**
37 | * Create the exception object with default values.
38 | */
39 | public RestrictedAccessException(){
40 | }
41 |
42 | /**
43 | * Create the exception object that outputs a message.
44 | * @param str the message string to be output.
45 | */
46 | public RestrictedAccessException(String str) {
47 |
48 | super(str);
49 | }
50 |
51 | }
52 |
--------------------------------------------------------------------------------
/src/javax/media/j3d/SceneGraphCycleException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 1997-2008 Sun Microsystems, Inc. All Rights Reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Sun designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Sun in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22 | * CA 95054 USA or visit www.sun.com if you need additional information or
23 | * have any questions.
24 | *
25 | */
26 |
27 | package javax.media.j3d;
28 |
29 | /**
30 | * Indicates a graph that contains a cycle.
31 | * Java 3D scene graphs are directed acyclic graphs and, as such, do not
32 | * permit cycles.
33 | * This exception is thrown when a graph containing a cycle:
34 | *
35 | *
40 | */
41 | public class SceneGraphCycleException extends IllegalSceneGraphException{
42 |
43 | /**
44 | * Create the exception object with default values.
45 | */
46 | public SceneGraphCycleException(){
47 | }
48 |
49 | /**
50 | * Create the exception object that outputs message.
51 | * @param str the message string to be output.
52 | */
53 | public SceneGraphCycleException(String str){
54 |
55 | super(str);
56 | }
57 |
58 | }
59 |
--------------------------------------------------------------------------------
/src/javax/media/j3d/ShaderAttrLoc.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2006-2008 Sun Microsystems, Inc. All Rights Reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Sun designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Sun in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22 | * CA 95054 USA or visit www.sun.com if you need additional information or
23 | * have any questions.
24 | *
25 | */
26 |
27 | package javax.media.j3d;
28 |
29 | /**
30 | * Tagging interface for shader attribute location objects. The rendering
31 | * pipelines will define concrete classes that implement this interface. All
32 | * code that uses the tagged objects will be in the pipelines.
33 | */
34 | interface ShaderAttrLoc {
35 | // No methods or constants defined at this time
36 | }
37 |
--------------------------------------------------------------------------------
/src/javax/media/j3d/ShaderAttribute.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2005-2008 Sun Microsystems, Inc. All Rights Reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Sun designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Sun in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22 | * CA 95054 USA or visit www.sun.com if you need additional information or
23 | * have any questions.
24 | *
25 | */
26 |
27 | package javax.media.j3d;
28 |
29 |
30 | /**
31 | * The ShaderAttribute object encapsulates a uniform attribute for a
32 | * shader programs. Uniform attributes (variables) are those
33 | * attributes whose values are constant during the rendering of a
34 | * primitive. Their values may change from primitive to primitive, but
35 | * are constant for each vertex (for vertex shaders) or fragment (for
36 | * fragment shaders) of a single primitive. Examples of uniform
37 | * attributes include a transformation matrix, a texture map, lights,
38 | * lookup tables, etc.
39 | *
40 | *
48 | *
55 | *
56 | * @see ShaderAttributeSet
57 | * @see ShaderProgram
58 | *
59 | * @since Java 3D 1.4
60 | */
61 |
62 | public abstract class ShaderAttribute extends NodeComponent {
63 | /**
64 | * Name of the shader attribute (immutable)
65 | */
66 |
67 | /**
68 | * Package scope constructor
69 | *
70 | */
71 | ShaderAttribute(String attrName) {
72 | if (attrName == null) {
73 | throw new NullPointerException();
74 | }
75 |
76 | ((ShaderAttributeRetained)this.retained).initializeAttrName(attrName);
77 | }
78 |
79 | /**
80 | * Retrieves the name of this shader attribute.
81 | *
82 | * @return the name of this shader attribute
83 | */
84 | public String getAttributeName() {
85 |
86 | return ((ShaderAttributeRetained)this.retained).getAttributeName();
87 |
88 | }
89 |
90 | }
91 |
--------------------------------------------------------------------------------
/src/javax/media/j3d/ShaderAttributeBindingRetained.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2005-2008 Sun Microsystems, Inc. All Rights Reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Sun designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Sun in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22 | * CA 95054 USA or visit www.sun.com if you need additional information or
23 | * have any questions.
24 | *
25 | */
26 |
27 | package javax.media.j3d;
28 |
29 |
30 | /**
31 | * The ShaderAttributeBinding object encapsulates a uniform attribute
32 | * whose value is bound to a Java 3D system attribute. The
33 | * shader variable (attrName, value)
pairs, is used for explicitly
50 | * defined attributes(attrName, j3dAttrName)
pairs, is used for
53 | * implicitly defined, automatically tracked attributesattrName
is implicitly set to the
34 | * value of the corresponding Java 3D system attribute
35 | * j3dAttrName
during rendering. attrName
36 | * must be the name of a valid uniform attribute in the shader in
37 | * which it is used. Otherwise, the attribute name will be ignored and
38 | * a runtime error may be generated. j3dAttrName
must be
39 | * the name of a predefined Java 3D system attribute. An
40 | * IllegalArgumentException will be thrown if the specified
41 | * j3dAttrName
is not one of the predefined system
42 | * attributes. Further, the type of the j3dAttrName
43 | * attribute must match the type of the corresponding
44 | * attrName
variable in the shader in which it is
45 | * used. Otherwise, the shader will not be able to use the attribute
46 | * and a runtime error may be generated.
47 | */
48 |
49 | class ShaderAttributeBindingRetained extends ShaderAttributeRetained {
50 | String j3dAttrName;
51 |
52 | ShaderAttributeBindingRetained() {
53 | }
54 |
55 | void initJ3dAttrName(String j3dAttrName) {
56 | this.j3dAttrName = j3dAttrName;
57 | }
58 |
59 | /**
60 | * Retrieves the name of the Java 3D system attribute that is bound to this
61 | * shader attribute.
62 | *
63 | * @return the name of the Java 3D system attribute that is bound to this
64 | * shader attribute
65 | */
66 | String getJ3DAttributeName() {
67 | return j3dAttrName;
68 | }
69 |
70 | }
71 |
--------------------------------------------------------------------------------
/src/javax/media/j3d/ShaderAttributeRetained.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2005-2008 Sun Microsystems, Inc. All Rights Reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Sun designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Sun in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22 | * CA 95054 USA or visit www.sun.com if you need additional information or
23 | * have any questions.
24 | *
25 | */
26 |
27 | package javax.media.j3d;
28 |
29 |
30 | /**
31 | * The ShaderAttributeRetained object encapsulates a uniform attribute for a
32 | * shader programs.
33 | */
34 |
35 | abstract class ShaderAttributeRetained extends NodeComponentRetained {
36 |
37 | /**
38 | * Name of the shader attribute (immutable)
39 | */
40 | String attrName;
41 |
42 | /**
43 | * Package scope constructor
44 | */
45 | ShaderAttributeRetained() {
46 | }
47 |
48 | void initializeAttrName(String attrName) {
49 | this.attrName = attrName;
50 | }
51 |
52 | /**
53 | * Retrieves the name of this shader attribute.
54 | *
55 | * @return the name of this shader attribute
56 | */
57 | String getAttributeName() {
58 | return attrName;
59 | }
60 |
61 | @Override
62 | void initMirrorObject() {
63 | ((ShaderAttributeObjectRetained)mirror).initializeAttrName(this.attrName);
64 | }
65 |
66 | }
67 |
--------------------------------------------------------------------------------
/src/javax/media/j3d/ShaderConstants.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2007-2008 Sun Microsystems, Inc. All Rights Reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Sun designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Sun in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22 | * CA 95054 USA or visit www.sun.com if you need additional information or
23 | * have any questions.
24 | *
25 | */
26 |
27 | package javax.media.j3d;
28 |
29 | /**
30 | * The ShaderConstants class contains internal constants used by other
31 | * Shader classes.
32 | */
33 | class ShaderConstants extends Object {
34 |
35 | //
36 | // The following bits are used in the messages for various Shader objects.
37 | //
38 |
39 | // ShaderAttributeSet bits -- indicates which attribute
40 | // operation in this ShaderAttributeSet object is needed.
41 | static final int ATTRIBUTE_SET_PUT = 0x0001;
42 | static final int ATTRIBUTE_SET_REMOVE = 0x0002;
43 | static final int ATTRIBUTE_SET_CLEAR = 0x0004;
44 |
45 | // ShaderAttribute bits
46 | static final int ATTRIBUTE_VALUE_UPDATE = 0x0008;
47 |
48 | }
49 |
--------------------------------------------------------------------------------
/src/javax/media/j3d/ShaderErrorListener.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2005-2008 Sun Microsystems, Inc. All Rights Reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Sun designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Sun in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22 | * CA 95054 USA or visit www.sun.com if you need additional information or
23 | * have any questions.
24 | *
25 | */
26 |
27 | package javax.media.j3d;
28 |
29 | /**
30 | * Listener interface for monitoring errors in Shader Programs.
31 | * Compile and link errors are reported by the shader compiler, as are
32 | * runtime errors, such as those resulting from shader attributes that
33 | * aren't found or are of the wrong type.
34 | *
35 | * @see VirtualUniverse#addShaderErrorListener
36 | *
37 | * @since Java 3D 1.4
38 | */
39 | public interface ShaderErrorListener {
40 | /**
41 | * Invoked when an error occurs while compiling, linking or
42 | * executing a programmable shader.
43 | *
44 | * @param error object that contains the details of the error.
45 | */
46 | public void errorOccurred(ShaderError error);
47 | }
48 |
--------------------------------------------------------------------------------
/src/javax/media/j3d/ShaderId.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2006-2008 Sun Microsystems, Inc. All Rights Reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Sun designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Sun in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22 | * CA 95054 USA or visit www.sun.com if you need additional information or
23 | * have any questions.
24 | *
25 | */
26 |
27 | package javax.media.j3d;
28 |
29 | /**
30 | * Tagging interface for shader objects. The rendering pipelines
31 | * will define concrete classes that implement this interface. All code that
32 | * uses the tagged objects will be in the pipelines.
33 | */
34 | interface ShaderId {
35 | // No methods or constants defined at this time
36 | }
37 |
--------------------------------------------------------------------------------
/src/javax/media/j3d/ShaderProgramId.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2006-2008 Sun Microsystems, Inc. All Rights Reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Sun designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Sun in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22 | * CA 95054 USA or visit www.sun.com if you need additional information or
23 | * have any questions.
24 | *
25 | */
26 |
27 | package javax.media.j3d;
28 |
29 | /**
30 | * Tagging interface for shader program objects. The rendering pipelines
31 | * will define concrete classes that implement this interface. All code that
32 | * uses the tagged objects will be in the pipelines.
33 | */
34 | interface ShaderProgramId {
35 | // No methods or constants defined at this time
36 | }
37 |
--------------------------------------------------------------------------------
/src/javax/media/j3d/SoundException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 1997-2008 Sun Microsystems, Inc. All Rights Reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Sun designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Sun in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22 | * CA 95054 USA or visit www.sun.com if you need additional information or
23 | * have any questions.
24 | *
25 | */
26 |
27 | package javax.media.j3d;
28 |
29 | /**
30 | * Indicates a problem in loading or playing a sound sample.
31 | */
32 | public class SoundException extends RuntimeException{
33 |
34 | /**
35 | * Create the exception object with default values.
36 | */
37 | public SoundException(){
38 | }
39 |
40 | /**
41 | * Create the exception object that outputs message.
42 | * @param str the message string to be output.
43 | */
44 | public SoundException(String str){
45 |
46 | super(str);
47 | }
48 |
49 | }
50 |
--------------------------------------------------------------------------------
/src/javax/media/j3d/SourceCodeShaderRetained.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2005-2008 Sun Microsystems, Inc. All Rights Reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Sun designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Sun in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22 | * CA 95054 USA or visit www.sun.com if you need additional information or
23 | * have any questions.
24 | *
25 | */
26 |
27 | package javax.media.j3d;
28 |
29 | /**
30 | * The SourceCodeShaderRetained object is a shader that is defined using
31 | * text-based source code. It is used to define the source code for
32 | * both vertex and fragment shaders. The currently supported shading
33 | * languages are Cg and GLSL.
34 | */
35 |
36 | class SourceCodeShaderRetained extends ShaderRetained {
37 |
38 | private String shaderSource = null;
39 |
40 | /**
41 | * Constructs a new shader retained object of the specified shading
42 | * language and shader type from the specified source string.
43 | */
44 |
45 | SourceCodeShaderRetained() {
46 | }
47 |
48 | // This method is similar to setShaderSource().
49 | // To conform to j3d frame in retained creation, we will stick with method
50 | // with init name.
51 | final void initShaderSource(String shaderSource) {
52 | this.shaderSource = shaderSource;
53 | }
54 |
55 | final void set(int shadingLanguage, int shaderType, String shaderSource) {
56 | this.shadingLanguage = shadingLanguage;
57 | this.shaderType = shaderType;
58 | this.shaderSource = shaderSource;
59 | }
60 |
61 | /**
62 | * Retrieves the shader source string from this shader object.
63 | *
64 | * @return the shader source string.
65 | */
66 | final String getShaderSource() {
67 | return shaderSource;
68 | }
69 |
70 | final void setShaderSource(String shaderSource) {
71 | this.shaderSource = shaderSource;
72 | }
73 |
74 | @Override
75 | synchronized void createMirrorObject() {
76 | // System.err.println("SourceCodeShaderRetained : createMirrorObject");
77 |
78 | if (mirror == null) {
79 | SourceCodeShaderRetained mirrorSCS = new SourceCodeShaderRetained();
80 | mirror = mirrorSCS;
81 | }
82 |
83 | initMirrorObject();
84 | }
85 |
86 | /**
87 | * Initializes a mirror object.
88 | */
89 | @Override
90 | synchronized void initMirrorObject() {
91 | mirror.source = source;
92 |
93 | ((SourceCodeShaderRetained) mirror).set(shadingLanguage, shaderType, shaderSource);
94 | ((SourceCodeShaderRetained) mirror).shaderData = null;
95 | }
96 |
97 | @Override
98 | synchronized void updateMirrorObject(int component, Object value) {
99 | System.err.println("SourceCodeShader.updateMirrorObject not implemented yet!");
100 | }
101 |
102 | }
103 |
--------------------------------------------------------------------------------
/src/javax/media/j3d/StructureUpdateThread.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 1998-2008 Sun Microsystems, Inc. All Rights Reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Sun designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Sun in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22 | * CA 95054 USA or visit www.sun.com if you need additional information or
23 | * have any questions.
24 | *
25 | */
26 |
27 | package javax.media.j3d;
28 |
29 | /**
30 | * The StructureUpdateThread is thread that passes messages to its structure
31 | */
32 |
33 | class StructureUpdateThread extends J3dThread {
34 | /**
35 | * The structure that this thread works for
36 | */
37 | J3dStructure structure;
38 |
39 | /**
40 | * Some variables used to name threads correctly
41 | */
42 | private static int numInstances[] = new int[7];
43 | private int instanceNum[] = new int[7];
44 |
45 | private synchronized int newInstanceNum(int idx) {
46 | return (++numInstances[idx]);
47 | }
48 |
49 | int getInstanceNum(int idx) {
50 | if (instanceNum[idx] == 0)
51 | instanceNum[idx] = newInstanceNum(idx);
52 | return instanceNum[idx];
53 | }
54 |
55 | /**
56 | * Just saves the structure
57 | */
58 | StructureUpdateThread(ThreadGroup t, J3dStructure s, int threadType) {
59 | super(t);
60 | structure = s;
61 | type = threadType;
62 | classification = J3dThread.UPDATE_THREAD;
63 |
64 | switch (type) {
65 | case J3dThread.UPDATE_GEOMETRY:
66 | setName("J3D-GeometryStructureUpdateThread-" + getInstanceNum(0));
67 | break;
68 | case J3dThread.UPDATE_RENDER:
69 | setName("J3D-RenderStructureUpdateThread-" + getInstanceNum(1));
70 | break;
71 | case J3dThread.UPDATE_BEHAVIOR:
72 | setName("J3D-BehaviorStructureUpdateThread-" + getInstanceNum(2));
73 | break;
74 | case J3dThread.UPDATE_SOUND:
75 | setName("J3D-SoundStructureUpdateThread-" + getInstanceNum(3));
76 | break;
77 | case J3dThread.UPDATE_RENDERING_ATTRIBUTES:
78 | // Only one exists in Java3D system
79 | setName("J3D-RenderingAttributesStructureUpdateThread");
80 | break;
81 | case J3dThread.UPDATE_RENDERING_ENVIRONMENT:
82 | setName("J3D-RenderingEnvironmentStructureUpdateThread-"+
83 | getInstanceNum(4));
84 | break;
85 | case J3dThread.UPDATE_TRANSFORM:
86 | setName("J3D-TransformStructureUpdateThread-"+ getInstanceNum(5));
87 | break;
88 | case J3dThread.SOUND_SCHEDULER:
89 | setName("J3D-SoundSchedulerUpdateThread-"+ getInstanceNum(6));
90 | break;
91 |
92 | }
93 |
94 | }
95 |
96 | @Override
97 | void doWork(long referenceTime) {
98 | structure.processMessages(referenceTime);
99 | }
100 | }
101 |
--------------------------------------------------------------------------------
/src/javax/media/j3d/TargetsInterface.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2001-2008 Sun Microsystems, Inc. All Rights Reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Sun designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Sun in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22 | * CA 95054 USA or visit www.sun.com if you need additional information or
23 | * have any questions.
24 | *
25 | */
26 |
27 | package javax.media.j3d;
28 | import java.util.ArrayList;
29 |
30 |
31 | interface TargetsInterface {
32 |
33 | static final int TRANSFORM_TARGETS = 0;
34 | static final int SWITCH_TARGETS = 1;
35 |
36 | // used by Switch, TransformGroup and SharedGroup
37 | abstract CachedTargets getCachedTargets(int type, int index, int child);
38 | abstract void resetCachedTargets(int type, CachedTargets[] newCt, int child);
39 | // used by TransformGroup and SharedGroup
40 | abstract int getTargetThreads(int type);
41 | abstract void updateCachedTargets(int type, CachedTargets[] newCt);
42 | abstract void computeTargetThreads(int type, CachedTargets[] newCt);
43 | abstract void updateTargetThreads(int type, CachedTargets[] newCt);
44 | abstract void propagateTargetThreads(int type, int childTargetThreads);
45 | abstract void copyCachedTargets(int type, CachedTargets[] newCt);
46 |
47 | // used by Switch and SharedGroup
48 | abstract ArrayListHelloUniverse: A Sample Java
10 | 3D Program
11 | HelloUniverse.java
,
12 | that creates a cube and a RotationInterpolator behavior object that
13 | rotates the cube at a constant rate of pi/2 radians per second. The
14 | HelloUniverse class creates the branch graph
15 | that includes the cube and the RotationInterpolator behavior. It then
16 | adds this branch graph to the Locale object generated by the
17 | SimpleUniverse utility.
18 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/src/javax/media/j3d/doc-files/Immediate1.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hharrison/java3d-core/baff3df05ba098e8ae6de40fbf0e5568d1549979/src/javax/media/j3d/doc-files/Immediate1.gif
--------------------------------------------------------------------------------
/src/javax/media/j3d/doc-files/SceneGraphSharing1.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hharrison/java3d-core/baff3df05ba098e8ae6de40fbf0e5568d1549979/src/javax/media/j3d/doc-files/SceneGraphSharing1.gif
--------------------------------------------------------------------------------
/src/javax/media/j3d/doc-files/SceneGraphSharing2.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hharrison/java3d-core/baff3df05ba098e8ae6de40fbf0e5568d1549979/src/javax/media/j3d/doc-files/SceneGraphSharing2.gif
--------------------------------------------------------------------------------
/src/javax/media/j3d/doc-files/SceneGraphSharing3.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hharrison/java3d-core/baff3df05ba098e8ae6de40fbf0e5568d1549979/src/javax/media/j3d/doc-files/SceneGraphSharing3.gif
--------------------------------------------------------------------------------
/src/javax/media/j3d/doc-files/SceneGraphSharing4.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hharrison/java3d-core/baff3df05ba098e8ae6de40fbf0e5568d1549979/src/javax/media/j3d/doc-files/SceneGraphSharing4.gif
--------------------------------------------------------------------------------
/src/javax/media/j3d/doc-files/SceneGraphSharing5.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hharrison/java3d-core/baff3df05ba098e8ae6de40fbf0e5568d1549979/src/javax/media/j3d/doc-files/SceneGraphSharing5.gif
--------------------------------------------------------------------------------
/src/javax/media/j3d/doc-files/ViewBranch.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hharrison/java3d-core/baff3df05ba098e8ae6de40fbf0e5568d1549979/src/javax/media/j3d/doc-files/ViewBranch.gif
--------------------------------------------------------------------------------
/src/javax/media/j3d/doc-files/ViewModel1.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hharrison/java3d-core/baff3df05ba098e8ae6de40fbf0e5568d1549979/src/javax/media/j3d/doc-files/ViewModel1.gif
--------------------------------------------------------------------------------
/src/javax/media/j3d/doc-files/ViewModel10.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hharrison/java3d-core/baff3df05ba098e8ae6de40fbf0e5568d1549979/src/javax/media/j3d/doc-files/ViewModel10.gif
--------------------------------------------------------------------------------
/src/javax/media/j3d/doc-files/ViewModel11.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hharrison/java3d-core/baff3df05ba098e8ae6de40fbf0e5568d1549979/src/javax/media/j3d/doc-files/ViewModel11.gif
--------------------------------------------------------------------------------
/src/javax/media/j3d/doc-files/ViewModel12.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hharrison/java3d-core/baff3df05ba098e8ae6de40fbf0e5568d1549979/src/javax/media/j3d/doc-files/ViewModel12.gif
--------------------------------------------------------------------------------
/src/javax/media/j3d/doc-files/ViewModel13.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hharrison/java3d-core/baff3df05ba098e8ae6de40fbf0e5568d1549979/src/javax/media/j3d/doc-files/ViewModel13.gif
--------------------------------------------------------------------------------
/src/javax/media/j3d/doc-files/ViewModel14.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hharrison/java3d-core/baff3df05ba098e8ae6de40fbf0e5568d1549979/src/javax/media/j3d/doc-files/ViewModel14.gif
--------------------------------------------------------------------------------
/src/javax/media/j3d/doc-files/ViewModel2.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hharrison/java3d-core/baff3df05ba098e8ae6de40fbf0e5568d1549979/src/javax/media/j3d/doc-files/ViewModel2.gif
--------------------------------------------------------------------------------
/src/javax/media/j3d/doc-files/ViewModel3.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hharrison/java3d-core/baff3df05ba098e8ae6de40fbf0e5568d1549979/src/javax/media/j3d/doc-files/ViewModel3.gif
--------------------------------------------------------------------------------
/src/javax/media/j3d/doc-files/ViewModel4.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hharrison/java3d-core/baff3df05ba098e8ae6de40fbf0e5568d1549979/src/javax/media/j3d/doc-files/ViewModel4.gif
--------------------------------------------------------------------------------
/src/javax/media/j3d/doc-files/ViewModel5.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hharrison/java3d-core/baff3df05ba098e8ae6de40fbf0e5568d1549979/src/javax/media/j3d/doc-files/ViewModel5.gif
--------------------------------------------------------------------------------
/src/javax/media/j3d/doc-files/ViewModel6.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hharrison/java3d-core/baff3df05ba098e8ae6de40fbf0e5568d1549979/src/javax/media/j3d/doc-files/ViewModel6.gif
--------------------------------------------------------------------------------
/src/javax/media/j3d/doc-files/ViewModel7.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hharrison/java3d-core/baff3df05ba098e8ae6de40fbf0e5568d1549979/src/javax/media/j3d/doc-files/ViewModel7.gif
--------------------------------------------------------------------------------
/src/javax/media/j3d/doc-files/ViewModel8.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hharrison/java3d-core/baff3df05ba098e8ae6de40fbf0e5568d1549979/src/javax/media/j3d/doc-files/ViewModel8.gif
--------------------------------------------------------------------------------
/src/javax/media/j3d/doc-files/ViewModel9.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hharrison/java3d-core/baff3df05ba098e8ae6de40fbf0e5568d1549979/src/javax/media/j3d/doc-files/ViewModel9.gif
--------------------------------------------------------------------------------
/src/javax/media/j3d/doc-files/VirtualUniverse.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hharrison/java3d-core/baff3df05ba098e8ae6de40fbf0e5568d1549979/src/javax/media/j3d/doc-files/VirtualUniverse.gif
--------------------------------------------------------------------------------
/src/javax/media/j3d/doc-files/intro.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hharrison/java3d-core/baff3df05ba098e8ae6de40fbf0e5568d1549979/src/javax/media/j3d/doc-files/intro.gif
--------------------------------------------------------------------------------
/src/javax/media/j3d/package.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
6 |
public class HelloUniverse ... {
public BranchGroup createSceneGraph() {
// Create the root of the branch graph
BranchGroup objRoot = new BranchGroup();
// Create the TransformGroup node and initialize it to the
// identity. Enable the TRANSFORM_WRITE capability so that
// our behavior code can modify it at run time. Add it to
// the root of the subgraph.
TransformGroup objTrans = new TransformGroup();
objTrans.setCapability(
TransformGroup.ALLOW_TRANSFORM_WRITE);
objRoot.addChild(objTrans);
// Create a simple Shape3D node; add it to the scene graph.
objTrans.addChild(new ColorCube(0.4));
// Create a new Behavior object that will perform the
// desired operation on the specified transform and add
// it into the scene graph.
Transform3D yAxis = new Transform3D();
Alpha rotationAlpha = new Alpha(-1, 4000);
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);
objRoot.addChild(rotator);
// Have Java 3D perform optimizations on this scene graph.
objRoot.compile();
return objRoot;
}
public HelloUniverse() {
<set layout of container, construct canvas3d, add canvas3d>
// Create the scene; attach it to the virtual universe
BranchGroup scene = createSceneGraph();
SimpleUniverse u = new SimpleUniverse(canvas3d);
u.getViewingPlatform().setNominalViewingTransform();
u.addBranchGraph(scene);
}
}