diff options
348 files changed, 12214 insertions, 12214 deletions
diff --git a/src/classes/jogl/javax/media/j3d/JoglContext.java b/src/classes/jogl/javax/media/j3d/JoglContext.java index 9aabda0..b25ff19 100644 --- a/src/classes/jogl/javax/media/j3d/JoglContext.java +++ b/src/classes/jogl/javax/media/j3d/JoglContext.java @@ -165,7 +165,7 @@ class JoglContext implements Context { private int glslVertexAttrOffset; // Only used when Cg shader library is active - private CGcontext cgContext; + private CGcontext cgContext; private int cgVertexProfile; private int cgFragmentProfile; diff --git a/src/classes/jogl/javax/media/j3d/JoglDrawingSurfaceObject.java b/src/classes/jogl/javax/media/j3d/JoglDrawingSurfaceObject.java index 0da2a6f..439213e 100644 --- a/src/classes/jogl/javax/media/j3d/JoglDrawingSurfaceObject.java +++ b/src/classes/jogl/javax/media/j3d/JoglDrawingSurfaceObject.java @@ -32,13 +32,13 @@ package javax.media.j3d; /** - * The DrawingSurfaceObject class is used to manage native drawing surface + * The DrawingSurfaceObject class is used to manage native drawing surface */ class JoglDrawingSurfaceObject extends DrawingSurfaceObject { - + JoglDrawingSurfaceObject(Canvas3D cv) { super(cv); - + // System.err.println("JoglDrawingSurfaceObject constructed"); } @@ -56,9 +56,9 @@ class JoglDrawingSurfaceObject extends DrawingSurfaceObject { synchronized void getDrawingSurfaceObjectInfo() { // FIXME: we don't have all of the information we need here to // create a GLDrawable for the Canvas3D, so for now, do nothing - + // FIXME: this mechanism is much too complicated - + /* System.err.println("JoglDrawingSurfaceObject.getDrawingSurfaceObjectInfo()"); diff --git a/src/classes/jogl/javax/media/j3d/JoglPipeline.java b/src/classes/jogl/javax/media/j3d/JoglPipeline.java index 30d1dab..b174183 100644 --- a/src/classes/jogl/javax/media/j3d/JoglPipeline.java +++ b/src/classes/jogl/javax/media/j3d/JoglPipeline.java @@ -49,10 +49,10 @@ import com.sun.opengl.util.*; * pipeline. */ class JoglPipeline extends Pipeline { - + // Flags indicating whether the Cg or GLSL libraries are available. private boolean cgLibraryAvailable = false; - + // Currently prints for entry points not yet implemented private static final boolean DEBUG = true; // Currently prints for entry points already implemented @@ -65,27 +65,27 @@ class JoglPipeline extends Pipeline { private static final int WAIT_TIME = 1000; // Configurable constant just in case we want to change this later private static final int MIN_FRAME_SIZE = 1; - + /** * Constructor for singleton JoglPipeline instance */ protected JoglPipeline() { } - + /** * Initialize the pipeline */ void initialize(Pipeline.Type pipelineType) { super.initialize(pipelineType); - + assert pipelineType == Pipeline.Type.JOGL; - + // Java3D maintains strict control over which threads perform OpenGL work Threading.disableSingleThreading(); - + // TODO: finish this with any other needed initialization } - + /** * Load all of the required libraries */ @@ -105,7 +105,7 @@ class JoglPipeline extends Pipeline { } } } - + /** * Returns true if the Cg library is loaded and available. Note that this * does not necessarily mean that Cg is supported by the graphics card. @@ -113,7 +113,7 @@ class JoglPipeline extends Pipeline { boolean isCgLibraryAvailable() { return cgLibraryAvailable; } - + /** * Returns true if the GLSL library is loaded and available. Note that this * does not necessarily mean that GLSL is supported by the graphics card. @@ -121,19 +121,19 @@ class JoglPipeline extends Pipeline { boolean isGLSLLibraryAvailable() { return true; } - - + + // --------------------------------------------------------------------- - + // // GeometryArrayRetained methods // - + // Used by D3D to free vertex buffer void freeD3DArray(GeometryArrayRetained geo, boolean deleteVB) { // Nothing to do } - + // used for GeometryArrays by Copy or interleaved void execute(Context ctx, GeometryArrayRetained geo, int geo_type, @@ -148,7 +148,7 @@ class JoglPipeline extends Pipeline { int vertexAttrCount, int[] vertexAttrSizes, float[] varray, float[] carray, int cDirty) { if (VERBOSE) System.err.println("JoglPipeline.execute()"); - + executeGeometryArray(ctx, geo, geo_type, isNonUniformScale, useAlpha, ignoreVertexColors, startVIndex, vcount, vformat, texCoordSetCount, texCoordSetMap, texCoordSetMapLen, @@ -156,7 +156,7 @@ class JoglPipeline extends Pipeline { vertexAttrCount, vertexAttrSizes, varray, null, carray, cDirty); } - + // used by GeometryArray by Reference with java arrays void executeVA(Context ctx, GeometryArrayRetained geo, int geo_type, @@ -176,7 +176,7 @@ class JoglPipeline extends Pipeline { int[] texIndex, int texstride, Object[] texCoords, int cdirty) { if (VERBOSE) System.err.println("JoglPipeline.executeVA()"); - + boolean floatCoordDefined = ((vdefined & GeometryArrayRetained.COORD_FLOAT) != 0); boolean doubleCoordDefined = ((vdefined & GeometryArrayRetained.COORD_DOUBLE) != 0); boolean floatColorsDefined = ((vdefined & GeometryArrayRetained.COLOR_FLOAT) != 0); @@ -184,7 +184,7 @@ class JoglPipeline extends Pipeline { boolean normalsDefined = ((vdefined & GeometryArrayRetained.NORMAL_FLOAT) != 0); boolean vattrDefined = ((vdefined & GeometryArrayRetained.VATTR_FLOAT) != 0); boolean textureDefined = ((vdefined & GeometryArrayRetained.TEXCOORD_FLOAT) != 0); - + FloatBuffer fverts = null; DoubleBuffer dverts = null; FloatBuffer fclrs = null; @@ -192,36 +192,36 @@ class JoglPipeline extends Pipeline { FloatBuffer[] texCoordBufs = null; FloatBuffer norms = null; FloatBuffer[] vertexAttrBufs = null; - + // Get vertex attribute arrays if (vattrDefined) { vertexAttrBufs = getVertexAttrSetBuffer(vertexAttrData); } - + // get texture arrays if (textureDefined) { texCoordBufs = getTexCoordSetBuffer(texCoords); } - + // get coordinate array if (floatCoordDefined) { fverts = getVertexArrayBuffer(vfcoords); } else if (doubleCoordDefined) { dverts = getVertexArrayBuffer(vdcoords); } - + // get color array if (floatColorsDefined) { fclrs = getColorArrayBuffer(cfdata); } else if (byteColorsDefined) { bclrs = getColorArrayBuffer(cbdata); } - + // get normal array if (normalsDefined) { norms = getNormalArrayBuffer(ndata); } - + int[] sarray = null; int[] start_array = null; int strip_len = 0; @@ -232,7 +232,7 @@ class JoglPipeline extends Pipeline { strip_len = sarray.length; start_array = ((GeometryStripArrayRetained) geo).stripStartOffsetIndices; } - + executeGeometryArrayVA(ctx, geo, geo_type, isNonUniformScale, ignoreVertexColors, vcount, vformat, vdefined, @@ -246,7 +246,7 @@ class JoglPipeline extends Pipeline { texIndex, texstride, texCoordBufs, cdirty, sarray, strip_len, start_array); } - + // used by GeometryArray by Reference with NIO buffer void executeVABuffer(Context ctx, GeometryArrayRetained geo, int geo_type, @@ -269,7 +269,7 @@ class JoglPipeline extends Pipeline { int[] texIndex, int texstride, Object[] texCoords, int cdirty) { if (VERBOSE) System.err.println("JoglPipeline.executeVABuffer()"); - + boolean floatCoordDefined = ((vdefined & GeometryArrayRetained.COORD_FLOAT) != 0); boolean doubleCoordDefined = ((vdefined & GeometryArrayRetained.COORD_DOUBLE) != 0); boolean floatColorsDefined = ((vdefined & GeometryArrayRetained.COLOR_FLOAT) != 0); @@ -277,7 +277,7 @@ class JoglPipeline extends Pipeline { boolean normalsDefined = ((vdefined & GeometryArrayRetained.NORMAL_FLOAT) != 0); boolean vattrDefined = ((vdefined & GeometryArrayRetained.VATTR_FLOAT) != 0); boolean textureDefined = ((vdefined & GeometryArrayRetained.TEXCOORD_FLOAT) != 0); - + FloatBuffer fverts = null; DoubleBuffer dverts = null; FloatBuffer fclrs = null; @@ -285,12 +285,12 @@ class JoglPipeline extends Pipeline { FloatBuffer[] texCoordBufs = null; FloatBuffer norms = null; FloatBuffer[] vertexAttrBufs = null; - + // Get vertex attribute arrays if (vattrDefined) { vertexAttrBufs = getVertexAttrSetBuffer(vertexAttrData); } - + // get texture arrays if (textureDefined) { texCoordBufs = new FloatBuffer[texCoords.length]; @@ -298,18 +298,18 @@ class JoglPipeline extends Pipeline { texCoordBufs[i] = (FloatBuffer) texCoords[i]; } } - + // get coordinate array if (floatCoordDefined) { fverts = (FloatBuffer) vcoords; } else if (doubleCoordDefined) { dverts = (DoubleBuffer) vcoords; } - + if (fverts == null && dverts == null) { return; } - + // get color array if (floatColorsDefined) { if (cfdata != null) @@ -322,12 +322,12 @@ class JoglPipeline extends Pipeline { else bclrs = (ByteBuffer) cdataBuffer; } - + // get normal array if (normalsDefined) { norms = (FloatBuffer) ndata; } - + int[] sarray = null; int[] start_array = null; int strip_len = 0; @@ -338,7 +338,7 @@ class JoglPipeline extends Pipeline { strip_len = sarray.length; start_array = ((GeometryStripArrayRetained) geo).stripStartOffsetIndices; } - + executeGeometryArrayVA(ctx, geo, geo_type, isNonUniformScale, ignoreVertexColors, vcount, vformat, vdefined, @@ -352,7 +352,7 @@ class JoglPipeline extends Pipeline { texIndex, texstride, texCoordBufs, cdirty, sarray, strip_len, start_array); } - + // used by GeometryArray by Reference in interleaved format with NIO buffer void executeInterleavedBuffer(Context ctx, GeometryArrayRetained geo, int geo_type, @@ -366,7 +366,7 @@ class JoglPipeline extends Pipeline { int numActiveTexUnit, Object varray, float[] cdata, int cdirty) { if (VERBOSE) System.err.println("JoglPipeline.executeInterleavedBuffer()"); - + executeGeometryArray(ctx, geo, geo_type, isNonUniformScale, useAlpha, ignoreVertexColors, startVIndex, vcount, vformat, @@ -374,13 +374,13 @@ class JoglPipeline extends Pipeline { texUnitOffset, numActiveTexUnit, 0, null, null, (Buffer) varray, cdata, cdirty); } - + void setVertexFormat(Context ctx, GeometryArrayRetained geo, int vformat, boolean useAlpha, boolean ignoreVertexColors) { if (VERBOSE) System.err.println("JoglPipeline.setVertexFormat()"); - + GL gl = context(ctx).getGL(); - + // Enable and disable the appropriate pointers if ((vformat & GeometryArray.NORMALS) != 0) { gl.glEnableClientState(GL.GL_NORMAL_ARRAY); @@ -392,7 +392,7 @@ class JoglPipeline extends Pipeline { } else { gl.glDisableClientState(GL.GL_COLOR_ARRAY); } - + if (gl.isExtensionAvailable("GL_SUN_global_alpha")) { if (useAlpha) { gl.glEnable(GL.GL_GLOBAL_ALPHA_SUN); @@ -400,20 +400,20 @@ class JoglPipeline extends Pipeline { gl.glDisable(GL.GL_GLOBAL_ALPHA_SUN); } } - + if ((vformat & GeometryArray.COORDINATES) != 0) { gl.glEnableClientState(GL.GL_VERTEX_ARRAY); } else { gl.glDisableClientState(GL.GL_VERTEX_ARRAY); } } - + void disableGlobalAlpha(Context ctx, GeometryArrayRetained geo, int vformat, boolean useAlpha, boolean ignoreVertexColors) { if (VERBOSE) System.err.println("JoglPipeline.disableGlobalAlpha()"); - + GL gl = context(ctx).getGL(); - + if (gl.isExtensionAvailable("GL_SUN_global_alpha")) { if (!ignoreVertexColors && ((vformat & GeometryArray.COLOR) != 0)) { if (useAlpha) { @@ -422,7 +422,7 @@ class JoglPipeline extends Pipeline { } } } - + // used for GeometryArrays void buildGA(Context ctx, GeometryArrayRetained geo, int geo_type, @@ -450,7 +450,7 @@ class JoglPipeline extends Pipeline { stride += 3; coordoff += 3; } - + if ((vformat & GeometryArray.COLOR) != 0) { if ((vformat & GeometryArray.BY_REFERENCE) != 0) { if ((vformat & GeometryArray.WITH_ALPHA) != 0) { @@ -468,7 +468,7 @@ class JoglPipeline extends Pipeline { coordoff += 4; } } - + if ((vformat & GeometryArray.TEXTURE_COORDINATE) != 0) { if ((vformat & GeometryArray.TEXTURE_COORDINATE_2) != 0) { texStride = 2 * texCoordSetCount; @@ -482,7 +482,7 @@ class JoglPipeline extends Pipeline { coloroff += texStride; coordoff += texStride; } - + int vAttrStride = 0; if ((vformat & GeometryArray.VERTEX_ATTRIBUTES) != 0) { for (int i = 0; i < vertexAttrCount; i++) { @@ -494,7 +494,7 @@ class JoglPipeline extends Pipeline { coordoff += vAttrStride; texCoordoff += vAttrStride; } - + int bstride = stride * BufferUtil.SIZEOF_FLOAT; // Start sending down from the startVIndex int initialOffset = startVIndex * stride; @@ -503,18 +503,18 @@ class JoglPipeline extends Pipeline { coordoff += initialOffset; texCoordoff += initialOffset; vAttrOff += initialOffset; - + // process alpha for geometryArray without alpha boolean useAlpha = false; if (updateAlpha && !ignoreVertexColors) { useAlpha = true; } - + if (geo_type == GeometryRetained.GEO_TYPE_TRI_STRIP_SET || geo_type == GeometryRetained.GEO_TYPE_TRI_FAN_SET || geo_type == GeometryRetained.GEO_TYPE_LINE_STRIP_SET) { int[] sarray = ((GeometryStripArrayRetained) geo).stripVertexCounts; - + int primType = 0; switch (geo_type) { case GeometryRetained.GEO_TYPE_TRI_STRIP_SET : @@ -527,11 +527,11 @@ class JoglPipeline extends Pipeline { primType = GL.GL_LINE_STRIP; break; } - + if (ignoreVertexColors) { vformat &= ~GeometryArray.COLOR; } - + for (int i = 0; i < sarray.length; i++) { gl.glBegin(primType); for (int j = 0; j < sarray[i]; j++) { @@ -570,7 +570,7 @@ class JoglPipeline extends Pipeline { } } } - + if ((vformat & GeometryArray.VERTEX_ATTRIBUTES) != 0) { int vaOff = vAttrOff; if (verts == null) { @@ -595,11 +595,11 @@ class JoglPipeline extends Pipeline { jctx.vertexAttr4fv(gl, vaIdx, verts); break; } - + vaOff += vertexAttrSizes[vaIdx]; } } - + if ((vformat & GeometryArray.TEXTURE_COORDINATE) != 0) { if (texCoordSetMapLen > 0) { if (gl.isExtensionAvailable("GL_VERSION_1_3")) { @@ -650,7 +650,7 @@ class JoglPipeline extends Pipeline { // texCoordSetMapLen can't be 0 if texture coordinates // is to be specified } - + if ((vformat & GeometryArray.COORDINATES) != 0) { if (xform != null) { // transform the vertex data with the static transform @@ -703,11 +703,11 @@ class JoglPipeline extends Pipeline { primType = GL.GL_LINES; break; } - + if (ignoreVertexColors) { vformat &= ~GeometryArray.COLOR; } - + gl.glBegin(primType); for (int j = 0; j < vcount; j++) { if ((vformat & GeometryArray.NORMALS) != 0) { @@ -754,7 +754,7 @@ class JoglPipeline extends Pipeline { } } } - + if ((vformat & GeometryArray.VERTEX_ATTRIBUTES) != 0) { int vaOff = vAttrOff; if (verts == null) { @@ -779,11 +779,11 @@ class JoglPipeline extends Pipeline { jctx.vertexAttr4fv(gl, vaIdx, verts); break; } - + vaOff += vertexAttrSizes[vaIdx]; } } - + if ((vformat & GeometryArray.TEXTURE_COORDINATE) != 0) { if (texCoordSetMapLen > 0) { if (gl.isExtensionAvailable("GL_VERSION_1_3")) { @@ -834,7 +834,7 @@ class JoglPipeline extends Pipeline { // texCoordSetMapLen can't be 0 if texture coordinates is // to be specified } - + if ((vformat & GeometryArray.COORDINATES) != 0) { if (xform != null) { // transform the vertex data with the static transform @@ -869,7 +869,7 @@ class JoglPipeline extends Pipeline { gl.glEnd(); } } - + // used to Build Dlist GeometryArray by Reference with java arrays void buildGAForByRef(Context ctx, GeometryArrayRetained geo, int geo_type, @@ -889,9 +889,9 @@ class JoglPipeline extends Pipeline { int[] texIndices, int texStride, Object[] texCoords, double[] xform, double[] nxform) { if (VERBOSE) System.err.println("JoglPipeline.buildGAForByRef()"); - + GL gl = context(ctx).getGL(); - + boolean floatCoordDefined = ((vdefined & GeometryArrayRetained.COORD_FLOAT) != 0); boolean doubleCoordDefined = ((vdefined & GeometryArrayRetained.COORD_DOUBLE) != 0); boolean floatColorsDefined = ((vdefined & GeometryArrayRetained.COLOR_FLOAT) != 0); @@ -899,7 +899,7 @@ class JoglPipeline extends Pipeline { boolean normalsDefined = ((vdefined & GeometryArrayRetained.NORMAL_FLOAT) != 0); boolean vattrDefined = ((vdefined & GeometryArrayRetained.VATTR_FLOAT) != 0); boolean textureDefined = ((vdefined & GeometryArrayRetained.TEXCOORD_FLOAT) != 0); - + FloatBuffer fverts = null; DoubleBuffer dverts = null; FloatBuffer fclrs = null; @@ -907,23 +907,23 @@ class JoglPipeline extends Pipeline { FloatBuffer[] texCoordBufs = null; FloatBuffer norms = null; FloatBuffer[] vertexAttrBufs = null; - + // Get vertex attribute arrays if (vattrDefined) { vertexAttrBufs = getVertexAttrSetBuffer(vertexAttrData); } - + // get texture arrays if (textureDefined) { texCoordBufs = getTexCoordSetBuffer(texCoords); } - + // process alpha for geometryArray without alpha boolean useAlpha = false; if (updateAlpha && !ignoreVertexColors) { useAlpha = true; } - + int[] sarray = null; int[] start_array = null; int strip_len = 0; @@ -934,13 +934,13 @@ class JoglPipeline extends Pipeline { strip_len = sarray.length; start_array = ((GeometryStripArrayRetained) geo).stripStartOffsetIndices; } - + if (ignoreVertexColors) { vformat &= ~GeometryArray.COLOR; floatColorsDefined = false; byteColorsDefined = false; } - + // get coordinate array if (floatCoordDefined) { gl.glEnableClientState(GL.GL_VERTEX_ARRAY); @@ -979,7 +979,7 @@ class JoglPipeline extends Pipeline { } else { gl.glDisableClientState(GL.GL_VERTEX_ARRAY); } - + // get color array if (floatColorsDefined) { gl.glEnableClientState(GL.GL_COLOR_ARRAY); @@ -1030,7 +1030,7 @@ class JoglPipeline extends Pipeline { } else { gl.glDisableClientState(GL.GL_COLOR_ARRAY); } - + // get normal array if (normalsDefined) { gl.glEnableClientState(GL.GL_NORMAL_ARRAY); @@ -1052,7 +1052,7 @@ class JoglPipeline extends Pipeline { } else { gl.glDisableClientState(GL.GL_NORMAL_ARRAY); } - + executeGeometryArrayVA(ctx, geo, geo_type, isNonUniformScale, ignoreVertexColors, vcount, vformat, vdefined, @@ -1066,11 +1066,11 @@ class JoglPipeline extends Pipeline { texIndices, texStride, texCoordBufs, 0, sarray, strip_len, start_array); } - + //---------------------------------------------------------------------- // Private helper methods for GeometryArrayRetained // - + private void testForInterleavedArrays(int vformat, boolean[] useInterleavedArrays, @@ -1096,7 +1096,7 @@ class JoglPipeline extends Pipeline { useInterleavedArrays[0] = false; break; } } - + private void enableTexCoordPointer(GL gl, int texUnit, @@ -1109,7 +1109,7 @@ class JoglPipeline extends Pipeline { gl.glEnableClientState(GL.GL_TEXTURE_COORD_ARRAY); gl.glTexCoordPointer(texSize, texDataType, stride, pointer); } - + private void disableTexCoordPointer(GL gl, int texUnit) { @@ -1117,7 +1117,7 @@ class JoglPipeline extends Pipeline { clientActiveTextureUnit(gl, texUnit); gl.glDisableClientState(GL.GL_TEXTURE_COORD_ARRAY); } - + private void clientActiveTextureUnit(GL gl, int texUnit) { @@ -1126,8 +1126,8 @@ class JoglPipeline extends Pipeline { gl.glClientActiveTexture(texUnit + GL.GL_TEXTURE0); } } - - + + private void executeTexture(int texCoordSetMapLen, int texSize, int bstride, int texCoordoff, @@ -1136,11 +1136,11 @@ class JoglPipeline extends Pipeline { FloatBuffer verts, GL gl) { if (VERBOSE) System.err.println("JoglPipeline.executeTexture()"); int tus = 0; /* texture unit state index */ - + for (int i = 0; i < numActiveTexUnit; i++) { - + tus = i; - + /* * it's possible thattexture unit state index (tus) * is greater than the texCoordSetMapOffsetLen, in this @@ -1160,7 +1160,7 @@ class JoglPipeline extends Pipeline { } } } - + private void resetTexture(GL gl, JoglContext ctx) { if (VERBOSE) System.err.println("JoglPipeline.resetTexture()"); @@ -1171,7 +1171,7 @@ class JoglPipeline extends Pipeline { /* Reset client active texture unit to 0 */ clientActiveTextureUnit(gl, 0); } - + private void executeGeometryArray(Context absCtx, GeometryArrayRetained geo, int geo_type, @@ -1190,7 +1190,7 @@ class JoglPipeline extends Pipeline { JoglContext ctx = (JoglContext) absCtx; GLContext context = context(ctx); GL gl = context.getGL(); - + boolean useInterleavedArrays; int iaFormat = 0; int primType = 0; @@ -1203,7 +1203,7 @@ class JoglPipeline extends Pipeline { FloatBuffer clrs = null; int[] sarray = null; int[] start_array = null; - + if (EXTRA_DEBUGGING) { System.err.println("Vertex format: " + getVertexDescription(vformat)); System.err.println("Geometry type: " + getGeometryDescription(geo_type)); @@ -1213,7 +1213,7 @@ class JoglPipeline extends Pipeline { System.err.println(" Colors (if any) interleaved"); } } - + if ((vformat & GeometryArray.COORDINATES) != 0) { stride += 3; } @@ -1261,16 +1261,16 @@ class JoglPipeline extends Pipeline { coordoff += vAttrStride; texCoordoff += vAttrStride; } - + bstride = stride * BufferUtil.SIZEOF_FLOAT; - + if (geo_type == GeometryRetained.GEO_TYPE_TRI_STRIP_SET || geo_type == GeometryRetained.GEO_TYPE_TRI_FAN_SET || geo_type == GeometryRetained.GEO_TYPE_LINE_STRIP_SET) { sarray = ((GeometryStripArrayRetained) geo).stripVertexCounts; start_array = ((GeometryStripArrayRetained) geo).stripStartOffsetIndices; } - + // We have to copy if the data isn't specified using NIO if (varray != null) { verts = getVertexArrayBuffer(varray); @@ -1280,7 +1280,7 @@ class JoglPipeline extends Pipeline { // This should never happen throw new AssertionError("Unable to get vertex pointer"); } - + // using byRef interleaved array and has a separate pointer, then .. int cstride = stride; if (carray != null) { @@ -1290,20 +1290,20 @@ class JoglPipeline extends Pipeline { // FIXME: need to "auto-slice" this buffer later clrs = verts; } - + cbstride = cstride * BufferUtil.SIZEOF_FLOAT; - + // Enable normalize for non-uniform scale (which rescale can't handle) if (isNonUniformScale) { gl.glEnable(GL.GL_NORMALIZE); } - + int startVertex = stride * startVIndex; int startClrs = cstride * startVIndex; if (clrs == verts) { startClrs += coloroff; } - + /*** Handle non-indexed strip GeometryArray first *******/ if (geo_type == GeometryRetained.GEO_TYPE_TRI_STRIP_SET || geo_type == GeometryRetained.GEO_TYPE_TRI_FAN_SET || @@ -1342,7 +1342,7 @@ class JoglPipeline extends Pipeline { verts.position(startVertex + coordoff); gl.glVertexPointer(3, GL.GL_FLOAT, bstride, verts); } - + if ((vformat & GeometryArray.TEXTURE_COORDINATE) != 0) { executeTexture(texCoordSetMapLen, texSize, bstride, texCoordoff, @@ -1350,7 +1350,7 @@ class JoglPipeline extends Pipeline { numActiveTexUnitState, verts, gl); } - + if ((vformat & GeometryArray.VERTEX_ATTRIBUTES) != 0) { int vAttrOffset = startVertex + vAttrOff; for (int i = 0; i < vertexAttrCount; i++) { @@ -1362,7 +1362,7 @@ class JoglPipeline extends Pipeline { } } } - + switch (geo_type) { case GeometryRetained.GEO_TYPE_TRI_STRIP_SET: primType = GL.GL_TRIANGLE_STRIP; @@ -1374,7 +1374,7 @@ class JoglPipeline extends Pipeline { primType = GL.GL_LINE_STRIP; break; } - + if (gl.isExtensionAvailable("GL_EXT_multi_draw_arrays")) { gl.glMultiDrawArraysEXT(primType, start_array, 0, sarray, 0, sarray.length); } else { @@ -1398,7 +1398,7 @@ class JoglPipeline extends Pipeline { useInterleavedArrays = tmp[0]; iaFormat = tmp2[0]; } - + if (useInterleavedArrays) { verts.position(startVertex); gl.glInterleavedArrays(iaFormat, bstride, verts); @@ -1428,7 +1428,7 @@ class JoglPipeline extends Pipeline { verts.position(startVertex + coordoff); gl.glVertexPointer(3, GL.GL_FLOAT, bstride, verts); } - + if ((vformat & GeometryArray.TEXTURE_COORDINATE) != 0) { executeTexture(texCoordSetMapLen, texSize, bstride, texCoordoff, @@ -1436,7 +1436,7 @@ class JoglPipeline extends Pipeline { numActiveTexUnitState, verts, gl); } - + if ((vformat & GeometryArray.VERTEX_ATTRIBUTES) != 0) { int vAttrOffset = startVertex + vAttrOff; for (int i = 0; i < vertexAttrCount; i++) { @@ -1455,22 +1455,22 @@ class JoglPipeline extends Pipeline { case GeometryRetained.GEO_TYPE_LINE_SET : gl.glDrawArrays(GL.GL_LINES, 0, vcount); break; } } - + /* clean up if we turned on normalize */ if (isNonUniformScale) { gl.glDisable(GL.GL_NORMALIZE); } - + if ((vformat & GeometryArray.VERTEX_ATTRIBUTES) != 0) { resetVertexAttrs(gl, ctx, vertexAttrCount); } - + if ((vformat & GeometryArray.TEXTURE_COORDINATE) != 0) { resetTexture(gl, ctx); } } - - + + // glLockArrays() is invoked only for indexed geometry, and the // vertexCount is guarenteed to be >= 0. private void lockArray(GL gl, int vertexCount) { @@ -1478,13 +1478,13 @@ class JoglPipeline extends Pipeline { gl.glLockArraysEXT(0, vertexCount); } } - + private void unlockArray(GL gl) { if (gl.isExtensionAvailable("GL_EXT_compiled_vertex_array")) { gl.glUnlockArraysEXT(); } } - + private void executeGeometryArrayVA(Context absCtx, GeometryArrayRetained geo, @@ -1510,7 +1510,7 @@ class JoglPipeline extends Pipeline { JoglContext ctx = (JoglContext) absCtx; GLContext context = context(ctx); GL gl = context.getGL(); - + boolean floatCoordDefined = ((vdefined & GeometryArrayRetained.COORD_FLOAT) != 0); boolean doubleCoordDefined = ((vdefined & GeometryArrayRetained.COORD_DOUBLE) != 0); boolean floatColorsDefined = ((vdefined & GeometryArrayRetained.COLOR_FLOAT) != 0); @@ -1518,12 +1518,12 @@ class JoglPipeline extends Pipeline { boolean normalsDefined = ((vdefined & GeometryArrayRetained.NORMAL_FLOAT) != 0); boolean vattrDefined = ((vdefined & GeometryArrayRetained.VATTR_FLOAT) != 0); boolean textureDefined = ((vdefined & GeometryArrayRetained.TEXCOORD_FLOAT) != 0); - + // Enable normalize for non-uniform scale (which rescale can't handle) if (isNonUniformScale) { gl.glEnable(GL.GL_NORMALIZE); } - + int coordoff = 3 * initialCoordIndex; // Define the data pointers if (floatCoordDefined) { @@ -1533,7 +1533,7 @@ class JoglPipeline extends Pipeline { dverts.position(coordoff); gl.glVertexPointer(3, GL.GL_DOUBLE, 0, dverts); } - + if (floatColorsDefined) { int coloroff; int sz; @@ -1564,7 +1564,7 @@ class JoglPipeline extends Pipeline { norms.position(normoff); gl.glNormalPointer(GL.GL_FLOAT, 0, norms); } - + if (vattrDefined) { for (int i = 0; i < vertexAttrCount; i++) { FloatBuffer vertexAttrs = vertexAttrData[i]; @@ -1575,7 +1575,7 @@ class JoglPipeline extends Pipeline { ctx.vertexAttrPointer(gl, i, sz, GL.GL_FLOAT, 0, vertexAttrs); } } - + if (textureDefined) { int texSet = 0; for (int i = 0; i < numActiveTexUnit; i++) { @@ -1589,11 +1589,11 @@ class JoglPipeline extends Pipeline { disableTexCoordPointer(gl, i); } } - + // Reset client active texture unit to 0 clientActiveTextureUnit(gl, 0); } - + if (geo_type == GeometryRetained.GEO_TYPE_TRI_STRIP_SET || geo_type == GeometryRetained.GEO_TYPE_TRI_FAN_SET || geo_type == GeometryRetained.GEO_TYPE_LINE_STRIP_SET) { @@ -1626,21 +1626,21 @@ class JoglPipeline extends Pipeline { case GeometryRetained.GEO_TYPE_LINE_SET : gl.glDrawArrays(GL.GL_LINES, 0, vcount); break; } } - + // clean up if we turned on normalize if (isNonUniformScale) { gl.glDisable(GL.GL_NORMALIZE); } - + if (vattrDefined) { resetVertexAttrs(gl, ctx, vertexAttrCount); } - + if (textureDefined) { resetTexture(gl, ctx); } } - + private String getVertexDescription(int vformat) { String res = ""; if ((vformat & GeometryArray.COORDINATES) != 0) res += "COORDINATES "; @@ -1654,7 +1654,7 @@ class JoglPipeline extends Pipeline { if ((vformat & GeometryArray.VERTEX_ATTRIBUTES) != 0) res += "VERTEX_ATTRIBUTES "; return res; } - + private String getGeometryDescription(int geo_type) { switch (geo_type) { case GeometryRetained.GEO_TYPE_TRI_STRIP_SET : return "GEO_TYPE_TRI_STRIP_SET"; @@ -1667,21 +1667,21 @@ class JoglPipeline extends Pipeline { default: return "(unknown " + geo_type + ")"; } } - + private void resetVertexAttrs(GL gl, JoglContext ctx, int vertexAttrCount) { // Disable specified vertex attr arrays for (int i = 0; i < vertexAttrCount; i++) { ctx.disableVertexAttrArray(gl, i); } } - - + + // --------------------------------------------------------------------- - + // // IndexedGeometryArrayRetained methods // - + // by-copy or interleaved, by reference, Java arrays void executeIndexedGeometry(Context ctx, GeometryArrayRetained geo, int geo_type, @@ -1700,7 +1700,7 @@ class JoglPipeline extends Pipeline { int cdirty, int[] indexCoord) { if (VERBOSE) System.err.println("JoglPipeline.executeIndexedGeometry()"); - + executeIndexedGeometryArray(ctx, geo, geo_type, isNonUniformScale, useAlpha, ignoreVertexColors, initialIndexIndex, indexCount, @@ -1712,7 +1712,7 @@ class JoglPipeline extends Pipeline { varray, null, carray, cdirty, indexCoord); } - + // interleaved, by reference, nio buffer void executeIndexedGeometryBuffer(Context ctx, GeometryArrayRetained geo, int geo_type, @@ -1730,7 +1730,7 @@ class JoglPipeline extends Pipeline { int cDirty, int[] indexCoord) { if (VERBOSE) System.err.println("JoglPipeline.executeIndexedGeometryBuffer()"); - + executeIndexedGeometryArray(ctx, geo, geo_type, isNonUniformScale, useAlpha, ignoreVertexColors, initialIndexIndex, indexCount, vertexCount, vformat, @@ -1740,7 +1740,7 @@ class JoglPipeline extends Pipeline { null, (FloatBuffer) vdata, carray, cDirty, indexCoord); } - + // non interleaved, by reference, Java arrays void executeIndexedGeometryVA(Context ctx, GeometryArrayRetained geo, int geo_type, @@ -1763,7 +1763,7 @@ class JoglPipeline extends Pipeline { int cdirty, int[] indexCoord) { if (VERBOSE) System.err.println("JoglPipeline.executeIndexedGeometryVA()"); - + boolean floatCoordDefined = ((vdefined & GeometryArrayRetained.COORD_FLOAT) != 0); boolean doubleCoordDefined = ((vdefined & GeometryArrayRetained.COORD_DOUBLE) != 0); boolean floatColorsDefined = ((vdefined & GeometryArrayRetained.COLOR_FLOAT) != 0); @@ -1771,7 +1771,7 @@ class JoglPipeline extends Pipeline { boolean normalsDefined = ((vdefined & GeometryArrayRetained.NORMAL_FLOAT) != 0); boolean vattrDefined = ((vdefined & GeometryArrayRetained.VATTR_FLOAT) != 0); boolean textureDefined = ((vdefined & GeometryArrayRetained.TEXCOORD_FLOAT) != 0); - + FloatBuffer fverts = null; DoubleBuffer dverts = null; FloatBuffer fclrs = null; @@ -1779,17 +1779,17 @@ class JoglPipeline extends Pipeline { FloatBuffer[] texCoordBufs = null; FloatBuffer norms = null; FloatBuffer[] vertexAttrBufs = null; - + // Get vertex attribute arrays if (vattrDefined) { vertexAttrBufs = getVertexAttrSetBuffer(vertexAttrData); } - + // get texture arrays if (textureDefined) { texCoordBufs = getTexCoordSetBuffer(texCoords); } - + int[] sarray = null; int strip_len = 0; if (geo_type == GeometryRetained.GEO_TYPE_INDEXED_TRI_STRIP_SET || @@ -1798,26 +1798,26 @@ class JoglPipeline extends Pipeline { sarray = ((IndexedGeometryStripArrayRetained) geo).stripIndexCounts; strip_len = sarray.length; } - + // get coordinate array if (floatCoordDefined) { fverts = getVertexArrayBuffer(vfcoords); } else if (doubleCoordDefined) { dverts = getVertexArrayBuffer(vdcoords); } - + // get color array if (floatColorsDefined) { fclrs = getColorArrayBuffer(cfdata); } else if (byteColorsDefined) { bclrs = getColorArrayBuffer(cbdata); } - + // get normal array if (normalsDefined) { norms = getNormalArrayBuffer(ndata); } - + executeIndexedGeometryArrayVA(ctx, geo, geo_type, isNonUniformScale, ignoreVertexColors, initialIndexIndex, validIndexCount, vertexCount, @@ -1832,7 +1832,7 @@ class JoglPipeline extends Pipeline { cdirty, indexCoord, sarray, strip_len); } - + // non interleaved, by reference, nio buffer void executeIndexedGeometryVABuffer(Context ctx, GeometryArrayRetained geo, int geo_type, @@ -1856,7 +1856,7 @@ class JoglPipeline extends Pipeline { int cdirty, int[] indexCoord) { if (VERBOSE) System.err.println("JoglPipeline.executeIndexedGeometryVABuffer()"); - + boolean floatCoordDefined = ((vdefined & GeometryArrayRetained.COORD_FLOAT) != 0); boolean doubleCoordDefined = ((vdefined & GeometryArrayRetained.COORD_DOUBLE) != 0); boolean floatColorsDefined = ((vdefined & GeometryArrayRetained.COLOR_FLOAT) != 0); @@ -1864,7 +1864,7 @@ class JoglPipeline extends Pipeline { boolean normalsDefined = ((vdefined & GeometryArrayRetained.NORMAL_FLOAT) != 0); boolean vattrDefined = ((vdefined & GeometryArrayRetained.VATTR_FLOAT) != 0); boolean textureDefined = ((vdefined & GeometryArrayRetained.TEXCOORD_FLOAT) != 0); - + FloatBuffer fverts = null; DoubleBuffer dverts = null; FloatBuffer fclrs = null; @@ -1872,12 +1872,12 @@ class JoglPipeline extends Pipeline { FloatBuffer[] texCoordBufs = null; FloatBuffer norms = null; FloatBuffer[] vertexAttrBufs = null; - + // Get vertex attribute arrays if (vattrDefined) { vertexAttrBufs = getVertexAttrSetBuffer(vertexAttrData); } - + // get texture arrays if (textureDefined) { texCoordBufs = new FloatBuffer[texCoords.length]; @@ -1885,18 +1885,18 @@ class JoglPipeline extends Pipeline { texCoordBufs[i] = (FloatBuffer) texCoords[i]; } } - + // get coordinate array if (floatCoordDefined) { fverts = (FloatBuffer) vcoords; } else if (doubleCoordDefined) { dverts = (DoubleBuffer) vcoords; } - + if (fverts == null && dverts == null) { return; } - + int[] sarray = null; int strip_len = 0; if (geo_type == GeometryRetained.GEO_TYPE_INDEXED_TRI_STRIP_SET || @@ -1905,7 +1905,7 @@ class JoglPipeline extends Pipeline { sarray = ((IndexedGeometryStripArrayRetained) geo).stripIndexCounts; strip_len = sarray.length; } - + // get color array if (floatColorsDefined) { if (cfdata != null) @@ -1918,12 +1918,12 @@ class JoglPipeline extends Pipeline { else bclrs = (ByteBuffer) cdataBuffer; } - + // get normal array if (normalsDefined) { norms = (FloatBuffer) ndata; } - + executeIndexedGeometryArrayVA(ctx, geo, geo_type, isNonUniformScale, ignoreVertexColors, initialIndexIndex, validIndexCount, vertexCount, @@ -1938,7 +1938,7 @@ class JoglPipeline extends Pipeline { cdirty, indexCoord, sarray, strip_len); } - + // by-copy geometry void buildIndexedGeometry(Context absCtx, GeometryArrayRetained geo, int geo_type, @@ -1956,10 +1956,10 @@ class JoglPipeline extends Pipeline { double[] xform, double[] nxform, float[] varray, int[] indexCoord) { if (VERBOSE) System.err.println("JoglPipeline.buildIndexedGeometry()"); - + JoglContext ctx = (JoglContext) absCtx; GL gl = context(ctx).getGL(); - + boolean useInterleavedArrays; int iaFormat = 0; int primType = 0; @@ -1973,14 +1973,14 @@ class JoglPipeline extends Pipeline { int[] sarray = null; int strip_len = 0; boolean useAlpha = false; - + if ((vformat & GeometryArray.COORDINATES) != 0) { gl.glEnableClientState(GL.GL_VERTEX_ARRAY); stride += 3; } else { gl.glDisableClientState(GL.GL_VERTEX_ARRAY); } - + if ((vformat & GeometryArray.NORMALS) != 0) { gl.glEnableClientState(GL.GL_NORMAL_ARRAY); stride += 3; @@ -1988,7 +1988,7 @@ class JoglPipeline extends Pipeline { } else { gl.glDisableClientState(GL.GL_NORMAL_ARRAY); } - + if ((vformat & GeometryArray.COLOR) != 0) { gl.glEnableClientState(GL.GL_COLOR_ARRAY); stride += 4; @@ -1997,7 +1997,7 @@ class JoglPipeline extends Pipeline { } else { gl.glDisableClientState(GL.GL_COLOR_ARRAY); } - + if ((vformat & GeometryArray.TEXTURE_COORDINATE) != 0) { if ((vformat & GeometryArray.TEXTURE_COORDINATE_2) != 0) { texSize = 2; @@ -2014,7 +2014,7 @@ class JoglPipeline extends Pipeline { coloroff += texStride; coordoff += texStride; } - + if ((vformat & GeometryArray.VERTEX_ATTRIBUTES) != 0) { for (int i = 0; i < vertexAttrCount; i++) { vAttrStride += vertexAttrSizes[i]; @@ -2025,24 +2025,24 @@ class JoglPipeline extends Pipeline { coordoff += vAttrStride; texCoordoff += vAttrStride; } - + bstride = stride * BufferUtil.SIZEOF_FLOAT; - + // process alpha for geometryArray without alpha if (updateAlpha && !ignoreVertexColors) { useAlpha = true; } - + if (geo_type == GeometryRetained.GEO_TYPE_INDEXED_TRI_STRIP_SET || geo_type == GeometryRetained.GEO_TYPE_INDEXED_TRI_FAN_SET || geo_type == GeometryRetained.GEO_TYPE_INDEXED_LINE_STRIP_SET) { sarray = ((IndexedGeometryStripArrayRetained) geo).stripIndexCounts; strip_len = sarray.length; } - + // Copy data into NIO array verts = getVertexArrayBuffer(varray); - + // Apply normal transform if necessary if ((vformat & GeometryArray.NORMALS) != 0 && nxform != null) { int off = normoff; @@ -2059,7 +2059,7 @@ class JoglPipeline extends Pipeline { off += stride; } } - + // Apply coordinate transform if necessary if ((vformat & GeometryArray.COORDINATES) != 0 && xform != null) { int off = coordoff; @@ -2076,7 +2076,7 @@ class JoglPipeline extends Pipeline { off += stride; } } - + if (geo_type == GeometryRetained.GEO_TYPE_INDEXED_TRI_STRIP_SET || geo_type == GeometryRetained.GEO_TYPE_INDEXED_TRI_FAN_SET || geo_type == GeometryRetained.GEO_TYPE_INDEXED_LINE_STRIP_SET) { @@ -2094,7 +2094,7 @@ class JoglPipeline extends Pipeline { useInterleavedArrays = tmp[0]; iaFormat = tmp2[0]; } - + if (useInterleavedArrays) { verts.position(0); gl.glInterleavedArrays(iaFormat, bstride, verts); @@ -2133,7 +2133,7 @@ class JoglPipeline extends Pipeline { } } } - + switch (geo_type) { case GeometryRetained.GEO_TYPE_INDEXED_TRI_STRIP_SET: primType = GL.GL_TRIANGLE_STRIP; @@ -2145,9 +2145,9 @@ class JoglPipeline extends Pipeline { primType = GL.GL_LINE_STRIP; break; } - + lockArray(gl, vertexCount); - + // Note: using MultiDrawElements is probably more expensive than // not in this case due to the need to allocate more temporary // direct buffers and slice up the incoming indices array @@ -2177,7 +2177,7 @@ class JoglPipeline extends Pipeline { useInterleavedArrays = tmp[0]; iaFormat = tmp2[0]; } - + if (useInterleavedArrays) { verts.position(0); gl.glInterleavedArrays(iaFormat, bstride, verts); @@ -2186,7 +2186,7 @@ class JoglPipeline extends Pipeline { verts.position(normoff); gl.glNormalPointer(GL.GL_FLOAT, bstride, verts); } - + if (!ignoreVertexColors && ((vformat & GeometryArray.COLOR) != 0)) { verts.position(coloroff); if (((vformat & GeometryArray.WITH_ALPHA) != 0) || useAlpha) { @@ -2216,7 +2216,7 @@ class JoglPipeline extends Pipeline { vAttrOffset += vertexAttrSizes[i]; } } - + switch (geo_type) { case GeometryRetained.GEO_TYPE_INDEXED_QUAD_SET : primType = GL.GL_QUADS; @@ -2231,32 +2231,32 @@ class JoglPipeline extends Pipeline { primType = GL.GL_LINES; break; } - + lockArray(gl, vertexCount); - + IntBuffer indicesBuffer = IntBuffer.wrap(indexCoord); indicesBuffer.position(initialIndexIndex); gl.glDrawElements(primType, validIndexCount, GL.GL_UNSIGNED_INT, indicesBuffer); } } - + unlockArray(gl); - + if ((vformat & GeometryArray.VERTEX_ATTRIBUTES) != 0) { resetVertexAttrs(gl, ctx, vertexAttrCount); } - + if ((vformat & GeometryArray.TEXTURE_COORDINATE) != 0) { resetTexture(gl, ctx); } } - - + + //---------------------------------------------------------------------- // // Helper routines for IndexedGeometryArrayRetained // - + private void executeIndexedGeometryArray(Context absCtx, GeometryArrayRetained geo, int geo_type, boolean isNonUniformScale, @@ -2275,7 +2275,7 @@ class JoglPipeline extends Pipeline { int[] indexCoord) { JoglContext ctx = (JoglContext) absCtx; GL gl = context(ctx).getGL(); - + boolean useInterleavedArrays; int iaFormat = 0; int primType = 0; @@ -2288,7 +2288,7 @@ class JoglPipeline extends Pipeline { FloatBuffer clrs = null; int[] sarray = null; int strip_len = 0; - + if ((vformat & GeometryArray.COORDINATES) != 0) { stride += 3; } @@ -2296,7 +2296,7 @@ class JoglPipeline extends Pipeline { stride += 3; coordoff += 3; } - + if ((vformat & GeometryArray.COLOR) != 0) { if ((vformat & GeometryArray.WITH_ALPHA) != 0) { stride += 4; @@ -2308,7 +2308,7 @@ class JoglPipeline extends Pipeline { coordoff += 3; } } - + if ((vformat & GeometryArray.TEXTURE_COORDINATE) != 0) { if ((vformat & GeometryArray.TEXTURE_COORDINATE_2) != 0) { texSize = 2; @@ -2325,7 +2325,7 @@ class JoglPipeline extends Pipeline { coloroff += texStride; coordoff += texStride; } - + if ((vformat & GeometryArray.VERTEX_ATTRIBUTES) != 0) { for (int i = 0; i < vertexAttrCount; i++) { vAttrStride += vertexAttrSizes[i]; @@ -2336,16 +2336,16 @@ class JoglPipeline extends Pipeline { coordoff += vAttrStride; texCoordoff += vAttrStride; } - + bstride = stride * BufferUtil.SIZEOF_FLOAT; - + if (geo_type == GeometryRetained.GEO_TYPE_INDEXED_TRI_STRIP_SET || geo_type == GeometryRetained.GEO_TYPE_INDEXED_TRI_FAN_SET || geo_type == GeometryRetained.GEO_TYPE_INDEXED_LINE_STRIP_SET) { sarray = ((IndexedGeometryStripArrayRetained) geo).stripIndexCounts; strip_len = sarray.length; } - + // We have to copy if the data isn't specified using NIO if (varray != null) { verts = getVertexArrayBuffer(varray); @@ -2355,7 +2355,7 @@ class JoglPipeline extends Pipeline { // This should never happen throw new AssertionError("Unable to get vertex pointer"); } - + // using byRef interleaved array and has a separate pointer, then .. int cstride = stride; if (carray != null) { @@ -2365,14 +2365,14 @@ class JoglPipeline extends Pipeline { // FIXME: need to "auto-slice" this buffer later clrs = verts; } - + cbstride = cstride * BufferUtil.SIZEOF_FLOAT; - + // Enable normalize for non-uniform scale (which rescale can't handle) if (isNonUniformScale) { gl.glEnable(GL.GL_NORMALIZE); } - + /*** Handle non-indexed strip GeometryArray first *******/ if (geo_type == GeometryRetained.GEO_TYPE_INDEXED_TRI_STRIP_SET || geo_type == GeometryRetained.GEO_TYPE_INDEXED_TRI_FAN_SET || @@ -2410,7 +2410,7 @@ class JoglPipeline extends Pipeline { verts.position(coordoff); gl.glVertexPointer(3, GL.GL_FLOAT, bstride, verts); } - + if ((vformat & GeometryArray.TEXTURE_COORDINATE) != 0) { /* XXXX: texCoordoff == 0 ???*/ executeTexture(texCoordSetMapLen, @@ -2419,7 +2419,7 @@ class JoglPipeline extends Pipeline { numActiveTexUnitState, verts, gl); } - + if ((vformat & GeometryArray.VERTEX_ATTRIBUTES) != 0) { int vAttrOffset = vAttrOff; for (int i = 0; i < vertexAttrCount; i++) { @@ -2431,7 +2431,7 @@ class JoglPipeline extends Pipeline { } } } - + switch (geo_type) { case GeometryRetained.GEO_TYPE_INDEXED_TRI_STRIP_SET: primType = GL.GL_TRIANGLE_STRIP; @@ -2443,9 +2443,9 @@ class JoglPipeline extends Pipeline { primType = GL.GL_LINE_STRIP; break; } - + lockArray(gl, vertexCount); - + // Note: using MultiDrawElements is probably more expensive than // not in this case due to the need to allocate more temporary // direct buffers and slice up the incoming indices array @@ -2473,7 +2473,7 @@ class JoglPipeline extends Pipeline { useInterleavedArrays = tmp[0]; iaFormat = tmp2[0]; } - + if (useInterleavedArrays) { verts.position(0); gl.glInterleavedArrays(iaFormat, bstride, verts); @@ -2482,7 +2482,7 @@ class JoglPipeline extends Pipeline { verts.position(normoff); gl.glNormalPointer(GL.GL_FLOAT, bstride, verts); } - + if (!ignoreVertexColors && (vformat & GeometryArray.COLOR) != 0) { if (clrs == verts) { clrs.position(coloroff); @@ -2497,7 +2497,7 @@ class JoglPipeline extends Pipeline { verts.position(coordoff); gl.glVertexPointer(3, GL.GL_FLOAT, bstride, verts); } - + if ((vformat & GeometryArray.TEXTURE_COORDINATE) != 0) { /* XXXX: texCoordoff == 0 ???*/ executeTexture(texCoordSetMapLen, @@ -2506,7 +2506,7 @@ class JoglPipeline extends Pipeline { numActiveTexUnitState, verts, gl); } - + if ((vformat & GeometryArray.VERTEX_ATTRIBUTES) != 0) { int vAttrOffset = vAttrOff; for (int i = 0; i < vertexAttrCount; i++) { @@ -2518,7 +2518,7 @@ class JoglPipeline extends Pipeline { } } } - + lockArray(gl, vertexCount); IntBuffer buf = IntBuffer.wrap(indexCoord); buf.position(initialIndexIndex); @@ -2529,24 +2529,24 @@ class JoglPipeline extends Pipeline { case GeometryRetained.GEO_TYPE_INDEXED_LINE_SET : gl.glDrawElements(GL.GL_LINES, indexCount, GL.GL_UNSIGNED_INT, buf); break; } } - + unlockArray(gl); - + if ((vformat & GeometryArray.VERTEX_ATTRIBUTES) != 0) { resetVertexAttrs(gl, ctx, vertexAttrCount); } - + if ((vformat & GeometryArray.TEXTURE_COORDINATE) != 0) { resetTexture(gl, ctx); } - + // clean up if we turned on normalize if (isNonUniformScale) { gl.glDisable(GL.GL_NORMALIZE); } } - - + + private void executeIndexedGeometryArrayVA(Context absCtx, GeometryArrayRetained geo, int geo_type, boolean isNonUniformScale, @@ -2565,7 +2565,7 @@ class JoglPipeline extends Pipeline { int cDirty, int[] indexCoord, int[] sarray, int strip_len) { JoglContext ctx = (JoglContext) absCtx; GL gl = context(ctx).getGL(); - + boolean floatCoordDefined = ((vdefined & GeometryArrayRetained.COORD_FLOAT) != 0); boolean doubleCoordDefined = ((vdefined & GeometryArrayRetained.COORD_DOUBLE) != 0); boolean floatColorsDefined = ((vdefined & GeometryArrayRetained.COLOR_FLOAT) != 0); @@ -2573,12 +2573,12 @@ class JoglPipeline extends Pipeline { boolean normalsDefined = ((vdefined & GeometryArrayRetained.NORMAL_FLOAT) != 0); boolean vattrDefined = ((vdefined & GeometryArrayRetained.VATTR_FLOAT) != 0); boolean textureDefined = ((vdefined & GeometryArrayRetained.TEXCOORD_FLOAT) != 0); - + // Enable normalize for non-uniform scale (which rescale can't handle) if (isNonUniformScale) { gl.glEnable(GL.GL_NORMALIZE); } - + // Define the data pointers if (floatCoordDefined) { fverts.position(0); @@ -2606,7 +2606,7 @@ class JoglPipeline extends Pipeline { norms.position(0); gl.glNormalPointer(GL.GL_FLOAT, 0, norms); } - + if (vattrDefined) { for (int i = 0; i < vertexAttrCount; i++) { FloatBuffer vertexAttrs = vertexAttrBufs[i]; @@ -2616,7 +2616,7 @@ class JoglPipeline extends Pipeline { ctx.vertexAttrPointer(gl, i, sz, GL.GL_FLOAT, 0, vertexAttrs); } } - + if (textureDefined) { int texSet = 0; for (int i = 0; i < numActiveTexUnitState; i++) { @@ -2630,13 +2630,13 @@ class JoglPipeline extends Pipeline { disableTexCoordPointer(gl, i); } } - + // Reset client active texture unit to 0 clientActiveTextureUnit(gl, 0); } - + lockArray(gl, vertexCount); - + if (geo_type == GeometryRetained.GEO_TYPE_INDEXED_TRI_STRIP_SET || geo_type == GeometryRetained.GEO_TYPE_INDEXED_TRI_FAN_SET || geo_type == GeometryRetained.GEO_TYPE_INDEXED_LINE_STRIP_SET) { @@ -2652,7 +2652,7 @@ class JoglPipeline extends Pipeline { primType = GL.GL_LINE_STRIP; break; } - + // Note: using MultiDrawElements is probably more expensive than // not in this case due to the need to allocate more temporary // direct buffers and slice up the incoming indices array @@ -2674,26 +2674,26 @@ class JoglPipeline extends Pipeline { case GeometryRetained.GEO_TYPE_INDEXED_LINE_SET : gl.glDrawElements(GL.GL_LINES, validIndexCount, GL.GL_UNSIGNED_INT, buf); break; } } - + unlockArray(gl); - + // clean up if we turned on normalize if (isNonUniformScale) { gl.glDisable(GL.GL_NORMALIZE); } - + if (vattrDefined) { resetVertexAttrs(gl, ctx, vertexAttrCount); } - + if (textureDefined) { resetTexture(gl, ctx); } } - - + + // --------------------------------------------------------------------- - + // // GraphicsContext3D methods // @@ -2790,23 +2790,23 @@ class JoglPipeline extends Pipeline { gl.glPixelTransferf(GL.GL_ALPHA_SCALE, 0.0f); gl.glPixelTransferf(GL.GL_ALPHA_BIAS, 1.0f); } - + gl.glReadPixels(xSrcOffset, yAdjusted, width, height, oglFormat, intType, IntBuffer.wrap((int[]) imageBuffer)); - + /* Restore Alpha scale and bias */ if(forceAlphaToOne) { gl.glPixelTransferf(GL.GL_ALPHA_SCALE, 1.0f); gl.glPixelTransferf(GL.GL_ALPHA_BIAS, 0.0f); } - + } else { assert false; } } - + if ((type & Raster.RASTER_DEPTH) != 0) { - + if (depthFormat == DepthComponentRetained.DEPTH_COMPONENT_TYPE_INT) { // yOffset is adjusted for OpenGL - Y upward gl.glReadPixels(xSrcOffset, yAdjusted, width, height, @@ -2817,414 +2817,414 @@ class JoglPipeline extends Pipeline { gl.glReadPixels(xSrcOffset, yAdjusted, width, height, GL.GL_DEPTH_COMPONENT, GL.GL_FLOAT, FloatBuffer.wrap((float[]) depthBuffer)); } - } - - } - + } + + } + // --------------------------------------------------------------------- - + // // CgShaderProgramRetained methods // - + // ShaderAttributeValue methods - + ShaderError setCgUniform1i(Context ctx, ShaderProgramId shaderProgramId, ShaderAttrLoc uniformLocation, int value) { if (VERBOSE) System.err.println("JoglPipeline.setCgUniform1i()"); - + JoglCgShaderParameter param = (JoglCgShaderParameter) uniformLocation; if (param.vParam() != null) { CgGL.cgSetParameter1i(param.vParam(), value); } - + if (param.fParam() != null) { CgGL.cgSetParameter1i(param.fParam(), value); } - + return null; } - + ShaderError setCgUniform1f(Context ctx, ShaderProgramId shaderProgramId, ShaderAttrLoc uniformLocation, float value) { if (VERBOSE) System.err.println("JoglPipeline.setCgUniform1f()"); - + JoglCgShaderParameter param = (JoglCgShaderParameter) uniformLocation; if (param.vParam() != null) { CgGL.cgSetParameter1f(param.vParam(), value); } - + if (param.fParam() != null) { CgGL.cgSetParameter1f(param.fParam(), value); } - + return null; } - + ShaderError setCgUniform2i(Context ctx, ShaderProgramId shaderProgramId, ShaderAttrLoc uniformLocation, int[] value) { if (VERBOSE) System.err.println("JoglPipeline.setCgUniform2i()"); - + JoglCgShaderParameter param = (JoglCgShaderParameter) uniformLocation; if (param.vParam() != null) { CgGL.cgSetParameter2i(param.vParam(), value[0], value[1]); } - + if (param.fParam() != null) { CgGL.cgSetParameter2i(param.fParam(), value[0], value[1]); } - + return null; } - + ShaderError setCgUniform2f(Context ctx, ShaderProgramId shaderProgramId, ShaderAttrLoc uniformLocation, float[] value) { if (VERBOSE) System.err.println("JoglPipeline.setCgUniform2f()"); - + JoglCgShaderParameter param = (JoglCgShaderParameter) uniformLocation; if (param.vParam() != null) { CgGL.cgSetParameter2f(param.vParam(), value[0], value[1]); } - + if (param.fParam() != null) { CgGL.cgSetParameter2f(param.fParam(), value[0], value[1]); } - + return null; } - + ShaderError setCgUniform3i(Context ctx, ShaderProgramId shaderProgramId, ShaderAttrLoc uniformLocation, int[] value) { if (VERBOSE) System.err.println("JoglPipeline.setCgUniform3i()"); - + JoglCgShaderParameter param = (JoglCgShaderParameter) uniformLocation; if (param.vParam() != null) { CgGL.cgSetParameter3i(param.vParam(), value[0], value[1], value[2]); } - + if (param.fParam() != null) { CgGL.cgSetParameter3i(param.fParam(), value[0], value[1], value[2]); } - + return null; } - + ShaderError setCgUniform3f(Context ctx, ShaderProgramId shaderProgramId, ShaderAttrLoc uniformLocation, float[] value) { if (VERBOSE) System.err.println("JoglPipeline.setCgUniform3f()"); - + JoglCgShaderParameter param = (JoglCgShaderParameter) uniformLocation; if (param.vParam() != null) { CgGL.cgSetParameter3f(param.vParam(), value[0], value[1], value[2]); } - + if (param.fParam() != null) { CgGL.cgSetParameter3f(param.fParam(), value[0], value[1], value[2]); } - + return null; } - + ShaderError setCgUniform4i(Context ctx, ShaderProgramId shaderProgramId, ShaderAttrLoc uniformLocation, int[] value) { if (VERBOSE) System.err.println("JoglPipeline.setCgUniform4i()"); - + JoglCgShaderParameter param = (JoglCgShaderParameter) uniformLocation; if (param.vParam() != null) { CgGL.cgSetParameter4i(param.vParam(), value[0], value[1], value[2], value[3]); } - + if (param.fParam() != null) { CgGL.cgSetParameter4i(param.fParam(), value[0], value[1], value[2], value[3]); } - + return null; } - + ShaderError setCgUniform4f(Context ctx, ShaderProgramId shaderProgramId, ShaderAttrLoc uniformLocation, float[] value) { if (VERBOSE) System.err.println("JoglPipeline.setCgUniform4f()"); - + JoglCgShaderParameter param = (JoglCgShaderParameter) uniformLocation; if (param.vParam() != null) { CgGL.cgSetParameter4f(param.vParam(), value[0], value[1], value[2], value[3]); } - + if (param.fParam() != null) { CgGL.cgSetParameter4f(param.fParam(), value[0], value[1], value[2], value[3]); } - + return null; } - + ShaderError setCgUniformMatrix3f(Context ctx, ShaderProgramId shaderProgramId, ShaderAttrLoc uniformLocation, float[] value) { if (VERBOSE) System.err.println("JoglPipeline.setCgUniformMatrix3f()"); - + JoglCgShaderParameter param = (JoglCgShaderParameter) uniformLocation; if (param.vParam() != null) { CgGL.cgGLSetMatrixParameterfr(param.vParam(), value, 0); } - + if (param.fParam() != null) { CgGL.cgGLSetMatrixParameterfr(param.fParam(), value, 0); } - + return null; } - + ShaderError setCgUniformMatrix4f(Context ctx, ShaderProgramId shaderProgramId, ShaderAttrLoc uniformLocation, float[] value) { if (VERBOSE) System.err.println("JoglPipeline.setCgUniformMatrix4f()"); - + JoglCgShaderParameter param = (JoglCgShaderParameter) uniformLocation; if (param.vParam() != null) { CgGL.cgGLSetMatrixParameterfr(param.vParam(), value, 0); } - + if (param.fParam() != null) { CgGL.cgGLSetMatrixParameterfr(param.fParam(), value, 0); } - + return null; } - + // ShaderAttributeArray methods - + ShaderError setCgUniform1iArray(Context ctx, ShaderProgramId shaderProgramId, ShaderAttrLoc uniformLocation, int numElements, int[] value) { if (VERBOSE) System.err.println("JoglPipeline.setCgUniform1iArray()"); - + float[] fval = new float[value.length]; for (int i = 0; i < value.length; i++) { fval[i] = value[i]; } - + JoglCgShaderParameter param = (JoglCgShaderParameter) uniformLocation; if (param.vParam() != null) { CgGL.cgGLSetParameterArray1f(param.vParam(), 0, numElements, fval, 0); } - + if (param.fParam() != null) { CgGL.cgGLSetParameterArray1f(param.fParam(), 0, numElements, fval, 0); } - + return null; } - + ShaderError setCgUniform1fArray(Context ctx, ShaderProgramId shaderProgramId, ShaderAttrLoc uniformLocation, int numElements, float[] value) { if (VERBOSE) System.err.println("JoglPipeline.setCgUniform1fArray()"); - + JoglCgShaderParameter param = (JoglCgShaderParameter) uniformLocation; if (param.vParam() != null) { CgGL.cgGLSetParameterArray1f(param.vParam(), 0, numElements, value, 0); } - + if (param.fParam() != null) { CgGL.cgGLSetParameterArray1f(param.fParam(), 0, numElements, value, 0); } - + return null; } - + ShaderError setCgUniform2iArray(Context ctx, ShaderProgramId shaderProgramId, ShaderAttrLoc uniformLocation, int numElements, int[] value) { if (VERBOSE) System.err.println("JoglPipeline.setCgUniform2iArray()"); - + float[] fval = new float[value.length]; for (int i = 0; i < value.length; i++) { fval[i] = value[i]; } - + JoglCgShaderParameter param = (JoglCgShaderParameter) uniformLocation; if (param.vParam() != null) { CgGL.cgGLSetParameterArray2f(param.vParam(), 0, numElements, fval, 0); } - + if (param.fParam() != null) { CgGL.cgGLSetParameterArray2f(param.fParam(), 0, numElements, fval, 0); } - + return null; } - + ShaderError setCgUniform2fArray(Context ctx, ShaderProgramId shaderProgramId, ShaderAttrLoc uniformLocation, int numElements, float[] value) { if (VERBOSE) System.err.println("JoglPipeline.setCgUniform2fArray()"); - + JoglCgShaderParameter param = (JoglCgShaderParameter) uniformLocation; if (param.vParam() != null) { CgGL.cgGLSetParameterArray2f(param.vParam(), 0, numElements, value, 0); } - + if (param.fParam() != null) { CgGL.cgGLSetParameterArray2f(param.fParam(), 0, numElements, value, 0); } - + return null; } - + ShaderError setCgUniform3iArray(Context ctx, ShaderProgramId shaderProgramId, ShaderAttrLoc uniformLocation, int numElements, int[] value) { if (VERBOSE) System.err.println("JoglPipeline.setCgUniform3iArray()"); - + float[] fval = new float[value.length]; for (int i = 0; i < value.length; i++) { fval[i] = value[i]; } - + JoglCgShaderParameter param = (JoglCgShaderParameter) uniformLocation; if (param.vParam() != null) { CgGL.cgGLSetParameterArray3f(param.vParam(), 0, numElements, fval, 0); } - + if (param.fParam() != null) { CgGL.cgGLSetParameterArray3f(param.fParam(), 0, numElements, fval, 0); } - + return null; } - + ShaderError setCgUniform3fArray(Context ctx, ShaderProgramId shaderProgramId, ShaderAttrLoc uniformLocation, int numElements, float[] value) { if (VERBOSE) System.err.println("JoglPipeline.setCgUniform3fArray()"); - + JoglCgShaderParameter param = (JoglCgShaderParameter) uniformLocation; if (param.vParam() != null) { CgGL.cgGLSetParameterArray2f(param.vParam(), 0, numElements, value, 0); } - + if (param.fParam() != null) { CgGL.cgGLSetParameterArray2f(param.fParam(), 0, numElements, value, 0); } - + return null; } - + ShaderError setCgUniform4iArray(Context ctx, ShaderProgramId shaderProgramId, ShaderAttrLoc uniformLocation, int numElements, int[] value) { if (VERBOSE) System.err.println("JoglPipeline.setCgUniform4iArray()"); - + float[] fval = new float[value.length]; for (int i = 0; i < value.length; i++) { fval[i] = value[i]; } - + JoglCgShaderParameter param = (JoglCgShaderParameter) uniformLocation; if (param.vParam() != null) { CgGL.cgGLSetParameterArray4f(param.vParam(), 0, numElements, fval, 0); } - + if (param.fParam() != null) { CgGL.cgGLSetParameterArray4f(param.fParam(), 0, numElements, fval, 0); } - + return null; } - + ShaderError setCgUniform4fArray(Context ctx, ShaderProgramId shaderProgramId, ShaderAttrLoc uniformLocation, int numElements, float[] value) { if (VERBOSE) System.err.println("JoglPipeline.setCgUniform4fArray()"); - + JoglCgShaderParameter param = (JoglCgShaderParameter) uniformLocation; if (param.vParam() != null) { CgGL.cgGLSetParameterArray2f(param.vParam(), 0, numElements, value, 0); } - + if (param.fParam() != null) { CgGL.cgGLSetParameterArray2f(param.fParam(), 0, numElements, value, 0); } - + return null; } - + ShaderError setCgUniformMatrix3fArray(Context ctx, ShaderProgramId shaderProgramId, ShaderAttrLoc uniformLocation, int numElements, float[] value) { if (VERBOSE) System.err.println("JoglPipeline.setCgUniformMatrix3fArray()"); - + JoglCgShaderParameter param = (JoglCgShaderParameter) uniformLocation; if (param.vParam() != null) { CgGL.cgGLSetMatrixParameterArrayfr(param.vParam(), 0, numElements, value, 0); } - + if (param.fParam() != null) { CgGL.cgGLSetMatrixParameterArrayfr(param.fParam(), 0, numElements, value, 0); } - + return null; } - + ShaderError setCgUniformMatrix4fArray(Context ctx, ShaderProgramId shaderProgramId, ShaderAttrLoc uniformLocation, int numElements, float[] value) { if (VERBOSE) System.err.println("JoglPipeline.setCgUniformMatrix4fArray()"); - + JoglCgShaderParameter param = (JoglCgShaderParameter) uniformLocation; if (param.vParam() != null) { CgGL.cgGLSetMatrixParameterArrayfr(param.vParam(), 0, numElements, value, 0); } - + if (param.fParam() != null) { CgGL.cgGLSetMatrixParameterArrayfr(param.fParam(), 0, numElements, value, 0); } - + return null; } - + // interfaces for shader compilation, etc. ShaderError createCgShader(Context ctx, int shaderType, ShaderId[] shaderId) { if (VERBOSE) System.err.println("JoglPipeline.createCgShader()"); - + JoglContext jctx = (JoglContext) ctx; JoglCgShaderInfo info = new JoglCgShaderInfo(); info.setJ3DShaderType(shaderType); @@ -3240,7 +3240,7 @@ class JoglPipeline extends Pipeline { } ShaderError destroyCgShader(Context ctx, ShaderId shaderId) { if (VERBOSE) System.err.println("JoglPipeline.destroyCgShader()"); - + JoglCgShaderInfo info = (JoglCgShaderInfo) shaderId; CGprogram program = info.getCgShader(); if (program != null) { @@ -3250,7 +3250,7 @@ class JoglPipeline extends Pipeline { } ShaderError compileCgShader(Context ctx, ShaderId shaderId, String programString) { if (VERBOSE) System.err.println("JoglPipeline.compileCgShader()"); - + if (programString == null) throw new AssertionError("shader program string is null"); JoglCgShaderInfo info = (JoglCgShaderInfo) shaderId; @@ -3271,10 +3271,10 @@ class JoglPipeline extends Pipeline { info.setCgShader(program); return null; } - + ShaderError createCgShaderProgram(Context ctx, ShaderProgramId[] shaderProgramId) { if (VERBOSE) System.err.println("JoglPipeline.createCgShaderProgram()"); - + JoglCgShaderProgramInfo info = new JoglCgShaderProgramInfo(); shaderProgramId[0] = info; return null; @@ -3287,7 +3287,7 @@ class JoglPipeline extends Pipeline { ShaderError linkCgShaderProgram(Context ctx, ShaderProgramId shaderProgramId, ShaderId[] shaderIds) { if (VERBOSE) System.err.println("JoglPipeline.linkCgShaderProgram()"); - + JoglCgShaderProgramInfo shaderProgramInfo = (JoglCgShaderProgramInfo) shaderProgramId; // NOTE: we assume that the caller has already verified that there // is at most one vertex program and one fragment program @@ -3300,7 +3300,7 @@ class JoglPipeline extends Pipeline { } else { shaderProgramInfo.setFragmentShader(shader); } - + CgGL.cgGLLoadProgram(shader.getCgShader()); int lastError = 0; if ((lastError = CgGL.cgGetError()) != 0) { @@ -3310,7 +3310,7 @@ class JoglPipeline extends Pipeline { lastError)); return err; } - + CgGL.cgGLBindProgram(shader.getCgShader()); if ((lastError = CgGL.cgGetError()) != 0) { ShaderError err = new ShaderError(ShaderError.LINK_ERROR, @@ -3320,13 +3320,13 @@ class JoglPipeline extends Pipeline { return err; } } - + return null; } void lookupCgVertexAttrNames(Context ctx, ShaderProgramId shaderProgramId, int numAttrNames, String[] attrNames, boolean[] errArr) { if (VERBOSE) System.err.println("JoglPipeline.lookupCgVertexAttrNames()"); - + JoglCgShaderProgramInfo shaderProgramInfo = (JoglCgShaderProgramInfo) shaderProgramId; if (shaderProgramInfo.getVertexShader() == null) { // If there if no vertex shader, no attributes can be looked up, so all fail @@ -3335,7 +3335,7 @@ class JoglPipeline extends Pipeline { } return; } - + shaderProgramInfo.setVertexAttributes(new CGparameter[numAttrNames]); for (int i = 0; i < numAttrNames; i++) { String attrName = attrNames[i]; @@ -3351,26 +3351,26 @@ class JoglPipeline extends Pipeline { int numAttrNames, String[] attrNames, ShaderAttrLoc[] locArr, int[] typeArr, int[] sizeArr, boolean[] isArrayArr) { if (VERBOSE) System.err.println("JoglPipeline.lookupCgShaderAttrNames()"); - + JoglCgShaderProgramInfo shaderProgramInfo = (JoglCgShaderProgramInfo) shaderProgramId; - + // Set the loc, type, and size arrays to out-of-bounds values for (int i = 0; i < numAttrNames; i++) { locArr[i] = null; typeArr[i] = -1; sizeArr[i] = -1; } - + int[] vType = new int[1]; int[] vSize = new int[1]; boolean[] vIsArray = new boolean[1]; int[] fType = new int[1]; int[] fSize = new int[1]; boolean[] fIsArray = new boolean[1]; - + boolean err = false; - + // Now lookup the location of each name in the attrNames array for (int i = 0; i < numAttrNames; i++) { String attrName = attrNames[i]; @@ -3399,7 +3399,7 @@ class JoglPipeline extends Pipeline { typeArr[i] = cgToJ3dType(vType[0]); } } - + CGparameter fLoc = null; if (shaderProgramInfo.getVertexShader() != null) { fLoc = lookupCgParams(shaderProgramInfo.getFragmentShader(), @@ -3411,7 +3411,7 @@ class JoglPipeline extends Pipeline { typeArr[i] = cgToJ3dType(fType[0]); } } - + // If the name lookup found an entry in both vertex and // fragment program, verify that the type and size are the // same. @@ -3424,7 +3424,7 @@ class JoglPipeline extends Pipeline { err = true; } } - + // Report an error if we got a mismatch or if the attribute // was not found in either the vertex or the fragment program if (err || (vLoc == null && fLoc == null)) { @@ -3440,14 +3440,14 @@ class JoglPipeline extends Pipeline { } } } - + ShaderError useCgShaderProgram(Context ctx, ShaderProgramId shaderProgramId) { if (VERBOSE) System.err.println("JoglPipeline.useCgShaderProgram()"); - + JoglCgShaderProgramInfo shaderProgramInfo = (JoglCgShaderProgramInfo) shaderProgramId; JoglContext jctx = (JoglContext) ctx; - + // Disable shader profiles CgGL.cgGLDisableProfile(jctx.getCgVertexProfile()); CgGL.cgGLDisableProfile(jctx.getCgFragmentProfile()); @@ -3458,7 +3458,7 @@ class JoglPipeline extends Pipeline { } else { CgGL.cgGLUnbindProgram(jctx.getCgVertexProfile()); } - + if (shaderProgramInfo.getFragmentShader() != null) { CgGL.cgGLBindProgram(shaderProgramInfo.getFragmentShader().getCgShader()); CgGL.cgGLEnableProfile(shaderProgramInfo.getFragmentShader().getShaderProfile()); @@ -3469,11 +3469,11 @@ class JoglPipeline extends Pipeline { CgGL.cgGLUnbindProgram(jctx.getCgVertexProfile()); CgGL.cgGLUnbindProgram(jctx.getCgFragmentProfile()); } - + jctx.setShaderProgram(shaderProgramInfo); return null; } - + // // Helper methods for above // @@ -3484,7 +3484,7 @@ class JoglPipeline extends Pipeline { String listing = CgGL.cgGetLastListing(ctx.getCgContext()); return (errString + System.getProperty("line.separator") + listing); } - + private int cgToJ3dType(int type) { switch (type) { case CgGL.CG_BOOL: @@ -3496,7 +3496,7 @@ class JoglPipeline extends Pipeline { case CgGL.CG_INT: case CgGL.CG_INT1: return ShaderAttributeObjectRetained.TYPE_INTEGER; - + // XXXX: add ShaderAttribute support for setting samplers. In the // mean time, the binding between sampler and texture unit will // need to be specified in the shader itself (which it already is @@ -3505,53 +3505,53 @@ class JoglPipeline extends Pipeline { // case CgGL.CG_SAMPLER2D: // case CgGL.CG_SAMPLER3D: // case CgGL.CG_SAMPLERCUBE: - + case CgGL.CG_BOOL2: case CgGL.CG_FIXED2: case CgGL.CG_HALF2: case CgGL.CG_INT2: return ShaderAttributeObjectRetained.TYPE_TUPLE2I; - + case CgGL.CG_BOOL3: case CgGL.CG_FIXED3: case CgGL.CG_HALF3: case CgGL.CG_INT3: return ShaderAttributeObjectRetained.TYPE_TUPLE3I; - + case CgGL.CG_BOOL4: case CgGL.CG_FIXED4: case CgGL.CG_HALF4: case CgGL.CG_INT4: return ShaderAttributeObjectRetained.TYPE_TUPLE4I; - + case CgGL.CG_FLOAT: case CgGL.CG_FLOAT1: return ShaderAttributeObjectRetained.TYPE_FLOAT; - + case CgGL.CG_FLOAT2: return ShaderAttributeObjectRetained.TYPE_TUPLE2F; - + case CgGL.CG_FLOAT3: return ShaderAttributeObjectRetained.TYPE_TUPLE3F; - + case CgGL.CG_FLOAT4: return ShaderAttributeObjectRetained.TYPE_TUPLE4F; - + case CgGL.CG_FLOAT3x3: return ShaderAttributeObjectRetained.TYPE_MATRIX3F; - + case CgGL.CG_FLOAT4x4: return ShaderAttributeObjectRetained.TYPE_MATRIX4F; - + // Java 3D does not support the following sampler types: // // case CgGL.CG_SAMPLER1D: // case CgGL.CG_SAMPLERRECT: } - + return -1; } - + private CGparameter lookupCgParams(JoglCgShaderInfo shader, String attrNameString, int[] type, @@ -3572,277 +3572,277 @@ class JoglPipeline extends Pipeline { } return loc; } - - - + + + // --------------------------------------------------------------------- - + // // GLSLShaderProgramRetained methods // - + // ShaderAttributeValue methods - + ShaderError setGLSLUniform1i(Context ctx, ShaderProgramId shaderProgramId, ShaderAttrLoc uniformLocation, int value) { if (VERBOSE) System.err.println("JoglPipeline.setGLSLUniform1i()"); - + context(ctx).getGL().glUniform1iARB(unbox(uniformLocation), value); return null; } - + ShaderError setGLSLUniform1f(Context ctx, ShaderProgramId shaderProgramId, ShaderAttrLoc uniformLocation, float value) { if (VERBOSE) System.err.println("JoglPipeline.setGLSLUniform1f()"); - + context(ctx).getGL().glUniform1fARB(unbox(uniformLocation), value); return null; } - + ShaderError setGLSLUniform2i(Context ctx, ShaderProgramId shaderProgramId, ShaderAttrLoc uniformLocation, int[] value) { if (VERBOSE) System.err.println("JoglPipeline.setGLSLUniform2i()"); - + context(ctx).getGL().glUniform2iARB(unbox(uniformLocation), value[0], value[1]); return null; } - + ShaderError setGLSLUniform2f(Context ctx, ShaderProgramId shaderProgramId, ShaderAttrLoc uniformLocation, float[] value) { if (VERBOSE) System.err.println("JoglPipeline.setGLSLUniform2f()"); - + context(ctx).getGL().glUniform2fARB(unbox(uniformLocation), value[0], value[1]); return null; } - + ShaderError setGLSLUniform3i(Context ctx, ShaderProgramId shaderProgramId, ShaderAttrLoc uniformLocation, int[] value) { if (VERBOSE) System.err.println("JoglPipeline.setGLSLUniform3i()"); - + context(ctx).getGL().glUniform3iARB(unbox(uniformLocation), value[0], value[1], value[2]); return null; } - + ShaderError setGLSLUniform3f(Context ctx, ShaderProgramId shaderProgramId, ShaderAttrLoc uniformLocation, float[] value) { if (VERBOSE) System.err.println("JoglPipeline.setGLSLUniform3f()"); - + context(ctx).getGL().glUniform3fARB(unbox(uniformLocation), value[0], value[1], value[2]); return null; } - + ShaderError setGLSLUniform4i(Context ctx, ShaderProgramId shaderProgramId, ShaderAttrLoc uniformLocation, int[] value) { if (VERBOSE) System.err.println("JoglPipeline.setGLSLUniform4i()"); - + context(ctx).getGL().glUniform4iARB(unbox(uniformLocation), value[0], value[1], value[2], value[3]); return null; } - + ShaderError setGLSLUniform4f(Context ctx, ShaderProgramId shaderProgramId, ShaderAttrLoc uniformLocation, float[] value) { if (VERBOSE) System.err.println("JoglPipeline.setGLSLUniform4f()"); - + context(ctx).getGL().glUniform4fARB(unbox(uniformLocation), value[0], value[1], value[2], value[3]); return null; } - + ShaderError setGLSLUniformMatrix3f(Context ctx, ShaderProgramId shaderProgramId, ShaderAttrLoc uniformLocation, float[] value) { if (VERBOSE) System.err.println("JoglPipeline.setGLSLUniformMatrix3f()"); - + // Load attribute // transpose is true : each matrix is supplied in row major order context(ctx).getGL().glUniformMatrix3fvARB(unbox(uniformLocation), 1, true, value, 0); return null; } - + ShaderError setGLSLUniformMatrix4f(Context ctx, ShaderProgramId shaderProgramId, ShaderAttrLoc uniformLocation, float[] value) { if (VERBOSE) System.err.println("JoglPipeline.setGLSLUniformMatrix4f()"); - + // Load attribute // transpose is true : each matrix is supplied in row major order context(ctx).getGL().glUniformMatrix4fvARB(unbox(uniformLocation), 1, true, value, 0); return null; } - + // ShaderAttributeArray methods - + ShaderError setGLSLUniform1iArray(Context ctx, ShaderProgramId shaderProgramId, ShaderAttrLoc uniformLocation, int numElements, int[] value) { if (VERBOSE) System.err.println("JoglPipeline.setGLSLUniform1iArray()"); - + context(ctx).getGL().glUniform1ivARB(unbox(uniformLocation), numElements, value, 0); return null; } - + ShaderError setGLSLUniform1fArray(Context ctx, ShaderProgramId shaderProgramId, ShaderAttrLoc uniformLocation, int numElements, float[] value) { if (VERBOSE) System.err.println("JoglPipeline.setGLSLUniform1fArray()"); - + context(ctx).getGL().glUniform1fvARB(unbox(uniformLocation), numElements, value, 0); return null; } - + ShaderError setGLSLUniform2iArray(Context ctx, ShaderProgramId shaderProgramId, ShaderAttrLoc uniformLocation, int numElements, int[] value) { if (VERBOSE) System.err.println("JoglPipeline.setGLSLUniform2iArray()"); - + context(ctx).getGL().glUniform2ivARB(unbox(uniformLocation), numElements, value, 0); return null; } - + ShaderError setGLSLUniform2fArray(Context ctx, ShaderProgramId shaderProgramId, ShaderAttrLoc uniformLocation, int numElements, float[] value) { if (VERBOSE) System.err.println("JoglPipeline.setGLSLUniform2fArray()"); - + context(ctx).getGL().glUniform2fvARB(unbox(uniformLocation), numElements, value, 0); return null; } - + ShaderError setGLSLUniform3iArray(Context ctx, ShaderProgramId shaderProgramId, ShaderAttrLoc uniformLocation, int numElements, int[] value) { if (VERBOSE) System.err.println("JoglPipeline.setGLSLUniform3iArray()"); - + context(ctx).getGL().glUniform3ivARB(unbox(uniformLocation), numElements, value, 0); return null; } - + ShaderError setGLSLUniform3fArray(Context ctx, ShaderProgramId shaderProgramId, ShaderAttrLoc uniformLocation, int numElements, float[] value) { if (VERBOSE) System.err.println("JoglPipeline.setGLSLUniform3fArray()"); - + context(ctx).getGL().glUniform3fvARB(unbox(uniformLocation), numElements, value, 0); return null; } - + ShaderError setGLSLUniform4iArray(Context ctx, ShaderProgramId shaderProgramId, ShaderAttrLoc uniformLocation, int numElements, int[] value) { if (VERBOSE) System.err.println("JoglPipeline.setGLSLUniform4iArray()"); - + context(ctx).getGL().glUniform4ivARB(unbox(uniformLocation), numElements, value, 0); return null; } - + ShaderError setGLSLUniform4fArray(Context ctx, ShaderProgramId shaderProgramId, ShaderAttrLoc uniformLocation, int numElements, float[] value) { if (VERBOSE) System.err.println("JoglPipeline.setGLSLUniform4fArray()"); - + context(ctx).getGL().glUniform4fvARB(unbox(uniformLocation), numElements, value, 0); return null; } - + ShaderError setGLSLUniformMatrix3fArray(Context ctx, ShaderProgramId shaderProgramId, ShaderAttrLoc uniformLocation, int numElements, float[] value) { if (VERBOSE) System.err.println("JoglPipeline.setGLSLUniformMatrix3fArray()"); - + // Load attribute // transpose is true : each matrix is supplied in row major order context(ctx).getGL().glUniformMatrix3fvARB(unbox(uniformLocation), numElements, true, value, 0); return null; } - + ShaderError setGLSLUniformMatrix4fArray(Context ctx, ShaderProgramId shaderProgramId, ShaderAttrLoc uniformLocation, int numElements, float[] value) { if (VERBOSE) System.err.println("JoglPipeline.setGLSLUniformMatrix4fArray()"); - + // Load attribute // transpose is true : each matrix is supplied in row major order context(ctx).getGL().glUniformMatrix4fvARB(unbox(uniformLocation), numElements, true, value, 0); return null; } - + // interfaces for shader compilation, etc. ShaderError createGLSLShader(Context ctx, int shaderType, ShaderId[] shaderId) { if (VERBOSE) System.err.println("JoglPipeline.createGLSLShader()"); - + GL gl = context(ctx).getGL(); - + int shaderHandle = 0; if (shaderType == Shader.SHADER_TYPE_VERTEX) { shaderHandle = gl.glCreateShaderObjectARB(GL.GL_VERTEX_SHADER_ARB); } else if (shaderType == Shader.SHADER_TYPE_FRAGMENT) { shaderHandle = gl.glCreateShaderObjectARB(GL.GL_FRAGMENT_SHADER_ARB); } - + if (shaderHandle == 0) { return new ShaderError(ShaderError.COMPILE_ERROR, "Unable to create native shader object"); } - + shaderId[0] = new JoglShaderObject(shaderHandle); return null; } ShaderError destroyGLSLShader(Context ctx, ShaderId shaderId) { if (VERBOSE) System.err.println("JoglPipeline.destroyGLSLShader()"); - + GL gl = context(ctx).getGL(); gl.glDeleteObjectARB(unbox(shaderId)); return null; } ShaderError compileGLSLShader(Context ctx, ShaderId shaderId, String program) { if (VERBOSE) System.err.println("JoglPipeline.compileGLSLShader()"); - + int id = unbox(shaderId); if (id == 0) { throw new AssertionError("shaderId == 0"); } - + if (program == null) { throw new AssertionError("shader program string is null"); } - + GL gl = context(ctx).getGL(); gl.glShaderSourceARB(id, 1, new String[] { program }, null, 0); gl.glCompileShaderARB(id); @@ -3857,12 +3857,12 @@ class JoglPipeline extends Pipeline { } return null; } - + ShaderError createGLSLShaderProgram(Context ctx, ShaderProgramId[] shaderProgramId) { if (VERBOSE) System.err.println("JoglPipeline.createGLSLShaderProgram()"); - + GL gl = context(ctx).getGL(); - + int shaderProgramHandle = gl.glCreateProgramObjectARB(); if (shaderProgramHandle == 0) { return new ShaderError(ShaderError.LINK_ERROR, @@ -3879,7 +3879,7 @@ class JoglPipeline extends Pipeline { ShaderError linkGLSLShaderProgram(Context ctx, ShaderProgramId shaderProgramId, ShaderId[] shaderIds) { if (VERBOSE) System.err.println("JoglPipeline.linkGLSLShaderProgram()"); - + GL gl = context(ctx).getGL(); int id = unbox(shaderProgramId); for (int i = 0; i < shaderIds.length; i++) { @@ -3900,7 +3900,7 @@ class JoglPipeline extends Pipeline { ShaderError bindGLSLVertexAttrName(Context ctx, ShaderProgramId shaderProgramId, String attrName, int attrIndex) { if (VERBOSE) System.err.println("JoglPipeline.bindGLSLVertexAttrName()"); - + JoglContext jctx = (JoglContext) ctx; context(ctx).getGL().glBindAttribLocationARB(unbox(shaderProgramId), attrIndex + VirtualUniverse.mc.glslVertexAttrOffset, @@ -3911,14 +3911,14 @@ class JoglPipeline extends Pipeline { int numAttrNames, String[] attrNames, ShaderAttrLoc[] locArr, int[] typeArr, int[] sizeArr, boolean[] isArrayArr) { if (VERBOSE) System.err.println("JoglPipeline.lookupGLSLShaderAttrNames()"); - + // set the loc, type, and size arrays to out-of-bound values for (int i = 0; i < attrNames.length; i++) { locArr[i] = null; typeArr[i] = -1; sizeArr[i] = -1; } - + // Loop through the list of active uniform variables, one at a // time, searching for a match in the attrNames array. // @@ -3942,7 +3942,7 @@ class JoglPipeline extends Pipeline { tmp, 0); int maxStrLen = tmp[0]; byte[] nameBuf = new byte[maxStrLen]; - + for (int i = 0; i < numActiveUniforms; i++) { gl.glGetActiveUniformARB(id, i, maxStrLen, tmp3, 0, tmp, 0, @@ -3957,7 +3957,7 @@ class JoglPipeline extends Pipeline { } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } - + // Issue 247 - we need to workaround an ATI bug where they erroneously // report individual elements of arrays rather than the array itself if (name.length() >= 3 && name.endsWith("]")) { @@ -3968,7 +3968,7 @@ class JoglPipeline extends Pipeline { continue; } } - + // Now try to find the name for (int j = 0; j < numAttrNames; j++) { if (name.equals(attrNames[j])) { @@ -3979,7 +3979,7 @@ class JoglPipeline extends Pipeline { } } } - + // Now lookup the location of each name in the attrNames array for (int i = 0; i < numAttrNames; i++) { // Get uniform attribute location @@ -3987,15 +3987,15 @@ class JoglPipeline extends Pipeline { locArr[i] = new JoglShaderObject(loc); } } - + ShaderError useGLSLShaderProgram(Context ctx, ShaderProgramId shaderProgramId) { if (VERBOSE) System.err.println("JoglPipeline.useGLSLShaderProgram()"); - + context(ctx).getGL().glUseProgramObjectARB(unbox(shaderProgramId)); ((JoglContext) ctx).setShaderProgram((JoglShaderObject) shaderProgramId); return null; } - + //---------------------------------------------------------------------- // Helper methods for above shader routines // @@ -4004,19 +4004,19 @@ class JoglPipeline extends Pipeline { return 0; return ((JoglShaderObject) loc).getValue(); } - + private int unbox(ShaderProgramId id) { if (id == null) return 0; return ((JoglShaderObject) id).getValue(); } - + private int unbox(ShaderId id) { if (id == null) return 0; return ((JoglShaderObject) id).getValue(); } - + private String getInfoLog(GL gl, int id) { int[] infoLogLength = new int[1]; gl.glGetObjectParameterivARB(id, GL.GL_OBJECT_INFO_LOG_LENGTH_ARB, infoLogLength, 0); @@ -4033,7 +4033,7 @@ class JoglPipeline extends Pipeline { } return null; } - + private int glslToJ3dType(int type) { switch (type) { case GL.GL_BOOL_ARB: @@ -4042,39 +4042,39 @@ class JoglPipeline extends Pipeline { case GL.GL_SAMPLER_3D_ARB: case GL.GL_SAMPLER_CUBE_ARB: return ShaderAttributeObjectRetained.TYPE_INTEGER; - + case GL.GL_FLOAT: return ShaderAttributeObjectRetained.TYPE_FLOAT; - + case GL.GL_INT_VEC2_ARB: case GL.GL_BOOL_VEC2_ARB: return ShaderAttributeObjectRetained.TYPE_TUPLE2I; - + case GL.GL_FLOAT_VEC2_ARB: return ShaderAttributeObjectRetained.TYPE_TUPLE2F; - + case GL.GL_INT_VEC3_ARB: case GL.GL_BOOL_VEC3_ARB: return ShaderAttributeObjectRetained.TYPE_TUPLE3I; - + case GL.GL_FLOAT_VEC3_ARB: return ShaderAttributeObjectRetained.TYPE_TUPLE3F; - + case GL.GL_INT_VEC4_ARB: case GL.GL_BOOL_VEC4_ARB: return ShaderAttributeObjectRetained.TYPE_TUPLE4I; - + case GL.GL_FLOAT_VEC4_ARB: return ShaderAttributeObjectRetained.TYPE_TUPLE4F; - + // case GL.GL_FLOAT_MAT2_ARB: - + case GL.GL_FLOAT_MAT3_ARB: return ShaderAttributeObjectRetained.TYPE_MATRIX3F; - + case GL.GL_FLOAT_MAT4_ARB: return ShaderAttributeObjectRetained.TYPE_MATRIX4F; - + // Java 3D does not support the following sampler types: // // case GL.GL_SAMPLER_1D_ARB: @@ -4083,27 +4083,27 @@ class JoglPipeline extends Pipeline { // case GL.GL_SAMPLER_2D_RECT_ARB: // case GL.GL_SAMPLER_2D_RECT_SHADOW_ARB: } - + return -1; } - + // --------------------------------------------------------------------- - + // // Renderer methods // - + void cleanupRenderer() { // Nothing to do } - - + + // --------------------------------------------------------------------- - + // // ColoringAttributesRetained methods // - + void updateColoringAttributes(Context ctx, float dRed, float dGreen, float dBlue, float red, float green, float blue, @@ -4111,11 +4111,11 @@ class JoglPipeline extends Pipeline { boolean lightEnable, int shadeModel) { if (VERBOSE) System.err.println("JoglPipeline.updateColoringAttributes()"); - + GL gl = context(ctx).getGL(); - + float cr, cg, cb; - + if (lightEnable) { cr = dRed; cg = dGreen; cb = dBlue; } else { @@ -4128,25 +4128,25 @@ class JoglPipeline extends Pipeline { gl.glShadeModel(GL.GL_SMOOTH); } } - - + + // --------------------------------------------------------------------- - + // // DirectionalLightRetained methods // - + private static final float[] black = new float[4]; void updateDirectionalLight(Context ctx, int lightSlot, float red, float green, float blue, float dirx, float diry, float dirz) { if (VERBOSE) System.err.println("JoglPipeline.updateDirectionalLight()"); - + GL gl = context(ctx).getGL(); - + int lightNum = GL.GL_LIGHT0 + lightSlot; float[] values = new float[4]; - + values[0] = red; values[1] = green; values[2] = blue; @@ -4165,25 +4165,25 @@ class JoglPipeline extends Pipeline { gl.glLightf(lightNum, GL.GL_SPOT_EXPONENT, 0.0f); gl.glLightf(lightNum, GL.GL_SPOT_CUTOFF, 180.0f); } - - + + // --------------------------------------------------------------------- - + // // PointLightRetained methods // - + void updatePointLight(Context ctx, int lightSlot, float red, float green, float blue, float attenx, float atteny, float attenz, float posx, float posy, float posz) { if (VERBOSE) System.err.println("JoglPipeline.updatePointLight()"); - + GL gl = context(ctx).getGL(); - + int lightNum = GL.GL_LIGHT0 + lightSlot; float[] values = new float[4]; - + values[0] = red; values[1] = green; values[2] = blue; @@ -4201,14 +4201,14 @@ class JoglPipeline extends Pipeline { gl.glLightf(lightNum, GL.GL_SPOT_EXPONENT, 0.0f); gl.glLightf(lightNum, GL.GL_SPOT_CUTOFF, 180.0f); } - - + + // --------------------------------------------------------------------- - + // // SpotLightRetained methods // - + void updateSpotLight(Context ctx, int lightSlot, float red, float green, float blue, float attenx, float atteny, float attenz, @@ -4216,12 +4216,12 @@ class JoglPipeline extends Pipeline { float concentration, float dirx, float diry, float dirz) { if (VERBOSE) System.err.println("JoglPipeline.updateSpotLight()"); - + GL gl = context(ctx).getGL(); - + int lightNum = GL.GL_LIGHT0 + lightSlot; float[] values = new float[4]; - + values[0] = red; values[1] = green; values[2] = blue; @@ -4243,21 +4243,21 @@ class JoglPipeline extends Pipeline { gl.glLightf(lightNum, GL.GL_SPOT_EXPONENT, concentration); gl.glLightf(lightNum, GL.GL_SPOT_CUTOFF, (float) (spreadAngle * 180.0f / Math.PI)); } - - + + // --------------------------------------------------------------------- - + // // ExponentialFogRetained methods // - + void updateExponentialFog(Context ctx, float red, float green, float blue, float density) { if (VERBOSE) System.err.println("JoglPipeline.updateExponentialFog()"); - + GL gl = context(ctx).getGL(); - + float[] color = new float[3]; color[0] = red; color[1] = green; @@ -4267,21 +4267,21 @@ class JoglPipeline extends Pipeline { gl.glFogf(GL.GL_FOG_DENSITY, density); gl.glEnable(GL.GL_FOG); } - - + + // --------------------------------------------------------------------- - + // // LinearFogRetained methods // - + void updateLinearFog(Context ctx, float red, float green, float blue, double fdist, double bdist) { if (VERBOSE) System.err.println("JoglPipeline.updateLinearFog()"); - + GL gl = context(ctx).getGL(); - + float[] color = new float[3]; color[0] = red; color[1] = green; @@ -4292,24 +4292,24 @@ class JoglPipeline extends Pipeline { gl.glFogf(GL.GL_FOG_END, (float) bdist); gl.glEnable(GL.GL_FOG); } - - + + // --------------------------------------------------------------------- - + // // LineAttributesRetained methods // - + void updateLineAttributes(Context ctx, float lineWidth, int linePattern, int linePatternMask, int linePatternScaleFactor, boolean lineAntialiasing) { if (VERBOSE) System.err.println("JoglPipeline.updateLineAttributes()"); - + GL gl = context(ctx).getGL(); gl.glLineWidth(lineWidth); - + if (linePattern == LineAttributes.PATTERN_SOLID) { gl.glDisable(GL.GL_LINE_STIPPLE); } else { @@ -4324,7 +4324,7 @@ class JoglPipeline extends Pipeline { } gl.glEnable(GL.GL_LINE_STIPPLE); } - + /* XXXX: Polygon Mode check, blend enable */ if (lineAntialiasing) { gl.glEnable(GL.GL_LINE_SMOOTH); @@ -4332,14 +4332,14 @@ class JoglPipeline extends Pipeline { gl.glDisable(GL.GL_LINE_SMOOTH); } } - - + + // --------------------------------------------------------------------- - + // // MaterialRetained methods // - + void updateMaterial(Context ctx, float red, float green, float blue, float alpha, float aRed, float aGreen, float aBlue, @@ -4348,11 +4348,11 @@ class JoglPipeline extends Pipeline { float sRed, float sGreen, float sBlue, float shininess, int colorTarget, boolean lightEnable) { if (VERBOSE) System.err.println("JoglPipeline.updateMaterial()"); - + float[] color = new float[4]; - + GL gl = context(ctx).getGL(); - + gl.glMaterialf(GL.GL_FRONT_AND_BACK, GL.GL_SHININESS, shininess); switch (colorTarget) { case Material.DIFFUSE: @@ -4371,18 +4371,18 @@ class JoglPipeline extends Pipeline { gl.glColorMaterial(GL.GL_FRONT_AND_BACK, GL.GL_AMBIENT_AND_DIFFUSE); break; } - + color[0] = eRed; color[1] = eGreen; color[2] = eBlue; gl.glMaterialfv(GL.GL_FRONT_AND_BACK, GL.GL_EMISSION, color, 0); - + color[0] = aRed; color[1] = aGreen; color[2] = aBlue; gl.glMaterialfv(GL.GL_FRONT_AND_BACK, GL.GL_AMBIENT, color, 0); - + color[0] = sRed; color[1] = sGreen; color[2] = sBlue; gl.glMaterialfv(GL.GL_FRONT_AND_BACK, GL.GL_SPECULAR, color, 0); - + float cr, cg, cb; - + if (lightEnable) { color[0] = dRed; color[1] = dGreen; color[2] = dBlue; } else { @@ -4391,30 +4391,30 @@ class JoglPipeline extends Pipeline { color[3] = alpha; gl.glMaterialfv(GL.GL_FRONT_AND_BACK, GL.GL_DIFFUSE, color, 0); gl.glColor4f(color[0], color[1], color[2], color[3]); - + if (lightEnable) { gl.glEnable(GL.GL_LIGHTING); } else { gl.glDisable(GL.GL_LIGHTING); } } - - + + // --------------------------------------------------------------------- - + // // ModelClipRetained methods // - + void updateModelClip(Context ctx, int planeNum, boolean enableFlag, double A, double B, double C, double D) { if (VERBOSE) System.err.println("JoglPipeline.updateModelClip()"); - + GL gl = context(ctx).getGL(); - + double[] equation = new double[4]; int pl = GL.GL_CLIP_PLANE0 + planeNum; - + // OpenGL clip planes are opposite to J3d clip planes if (enableFlag) { equation[0] = -A; @@ -4427,20 +4427,20 @@ class JoglPipeline extends Pipeline { gl.glDisable(pl); } } - - + + // --------------------------------------------------------------------- - + // // PointAttributesRetained methods // - + void updatePointAttributes(Context ctx, float pointSize, boolean pointAntialiasing) { if (VERBOSE) System.err.println("JoglPipeline.updatePointAttributes()"); - + GL gl = context(ctx).getGL(); gl.glPointSize(pointSize); - + // XXXX: Polygon Mode check, blend enable if (pointAntialiasing) { gl.glEnable(GL.GL_POINT_SMOOTH); @@ -4448,23 +4448,23 @@ class JoglPipeline extends Pipeline { gl.glDisable(GL.GL_POINT_SMOOTH); } } - - + + // --------------------------------------------------------------------- - + // // PolygonAttributesRetained methods // - + void updatePolygonAttributes(Context ctx, int polygonMode, int cullFace, boolean backFaceNormalFlip, float polygonOffset, float polygonOffsetFactor) { if (VERBOSE) System.err.println("JoglPipeline.updatePolygonAttributes()"); - + GL gl = context(ctx).getGL(); - + if (cullFace == PolygonAttributes.CULL_NONE) { gl.glDisable(GL.GL_CULL_FACE); } else { @@ -4475,13 +4475,13 @@ class JoglPipeline extends Pipeline { } gl.glEnable(GL.GL_CULL_FACE); } - + if (backFaceNormalFlip && (cullFace != PolygonAttributes.CULL_BACK)) { gl.glLightModeli(GL.GL_LIGHT_MODEL_TWO_SIDE, GL.GL_TRUE); } else { gl.glLightModeli(GL.GL_LIGHT_MODEL_TWO_SIDE, GL.GL_FALSE); } - + if (polygonMode == PolygonAttributes.POLYGON_POINT) { gl.glPolygonMode(GL.GL_FRONT_AND_BACK, GL.GL_POINT); } else if (polygonMode == PolygonAttributes.POLYGON_LINE) { @@ -4489,9 +4489,9 @@ class JoglPipeline extends Pipeline { } else { gl.glPolygonMode(GL.GL_FRONT_AND_BACK, GL.GL_FILL); } - + gl.glPolygonOffset(polygonOffsetFactor, polygonOffset); - + if ((polygonOffsetFactor != 0.0) || (polygonOffset != 0.0)) { switch (polygonMode) { case PolygonAttributes.POLYGON_POINT: @@ -4516,14 +4516,14 @@ class JoglPipeline extends Pipeline { gl.glDisable(GL.GL_POLYGON_OFFSET_FILL); } } - - + + // --------------------------------------------------------------------- - + // // RenderingAttributesRetained methods // - + void updateRenderingAttributes(Context ctx, boolean depthBufferWriteEnableOverride, boolean depthBufferEnableOverride, @@ -4538,9 +4538,9 @@ class JoglPipeline extends Pipeline { int stencilFunction, int stencilReferenceValue, int stencilCompareMask, int stencilWriteMask ) { if (VERBOSE) System.err.println("JoglPipeline.updateRenderingAttributes()"); - + GL gl = context(ctx).getGL(); - + if (!depthBufferEnableOverride) { if (depthBufferEnable) { gl.glEnable(GL.GL_DEPTH_TEST); @@ -4549,7 +4549,7 @@ class JoglPipeline extends Pipeline { gl.glDisable(GL.GL_DEPTH_TEST); } } - + if (!depthBufferWriteEnableOverride) { if (depthBufferWriteEnable) { gl.glDepthMask(true); @@ -4557,20 +4557,20 @@ class JoglPipeline extends Pipeline { gl.glDepthMask(false); } } - + if (alphaTestFunction == RenderingAttributes.ALWAYS) { gl.glDisable(GL.GL_ALPHA_TEST); } else { gl.glEnable(GL.GL_ALPHA_TEST); gl.glAlphaFunc(getFunctionValue(alphaTestFunction), alphaTestValue); } - + if (ignoreVertexColors) { gl.glDisable(GL.GL_COLOR_MATERIAL); } else { gl.glEnable(GL.GL_COLOR_MATERIAL); } - + if (rasterOpEnable) { gl.glEnable(GL.GL_COLOR_LOGIC_OP); switch (rasterOp) { @@ -4626,26 +4626,26 @@ class JoglPipeline extends Pipeline { } else { gl.glDisable(GL.GL_COLOR_LOGIC_OP); } - + if (userStencilAvailable) { if (stencilEnable) { gl.glEnable(GL.GL_STENCIL_TEST); - + gl.glStencilOp(getStencilOpValue(stencilFailOp), getStencilOpValue(stencilZFailOp), getStencilOpValue(stencilZPassOp)); - + gl.glStencilFunc(getFunctionValue(stencilFunction), stencilReferenceValue, stencilCompareMask); - + gl.glStencilMask(stencilWriteMask); - + } else { gl.glDisable(GL.GL_STENCIL_TEST); } } } - + private int getFunctionValue(int func) { switch (func) { case RenderingAttributes.ALWAYS: @@ -4673,10 +4673,10 @@ class JoglPipeline extends Pipeline { func = GL.GL_GEQUAL; break; } - + return func; } - + private int getStencilOpValue(int op) { switch (op) { case RenderingAttributes.STENCIL_KEEP: @@ -4698,17 +4698,17 @@ class JoglPipeline extends Pipeline { op = GL.GL_INVERT; break; } - + return op; } - - + + // --------------------------------------------------------------------- - + // // TexCoordGenerationRetained methods // - + /** * This method updates the native context: * trans contains eyeTovworld transform in d3d @@ -4722,14 +4722,14 @@ class JoglPipeline extends Pipeline { float planeQx, float planeQy, float planeQz, float planeQw, double[] vworldToEc) { if (VERBOSE) System.err.println("JoglPipeline.updateTexCoordGeneration()"); - + GL gl = context(ctx).getGL(); - + float[] planeS = new float[4]; float[] planeT = new float[4]; float[] planeR = new float[4]; float[] planeQ = new float[4]; - + if (enable) { gl.glEnable(GL.GL_TEXTURE_GEN_S); gl.glEnable(GL.GL_TEXTURE_GEN_T); @@ -4743,7 +4743,7 @@ class JoglPipeline extends Pipeline { gl.glDisable(GL.GL_TEXTURE_GEN_R); gl.glDisable(GL.GL_TEXTURE_GEN_Q); } - + if (genMode != TexCoordGeneration.SPHERE_MAP) { planeS[0] = planeSx; planeS[1] = planeSy; planeS[2] = planeSz; planeS[3] = planeSw; @@ -4759,14 +4759,14 @@ class JoglPipeline extends Pipeline { planeQ[2] = planeQz; planeQ[3] = planeQw; } } - + switch (genMode) { case TexCoordGeneration.OBJECT_LINEAR: gl.glTexGeni(GL.GL_S, GL.GL_TEXTURE_GEN_MODE, GL.GL_OBJECT_LINEAR); gl.glTexGeni(GL.GL_T, GL.GL_TEXTURE_GEN_MODE, GL.GL_OBJECT_LINEAR); gl.glTexGenfv(GL.GL_S, GL.GL_OBJECT_PLANE, planeS, 0); gl.glTexGenfv(GL.GL_T, GL.GL_OBJECT_PLANE, planeT, 0); - + if (format == TexCoordGeneration.TEXTURE_COORDINATE_3) { gl.glTexGeni(GL.GL_R, GL.GL_TEXTURE_GEN_MODE, GL.GL_OBJECT_LINEAR); gl.glTexGenfv(GL.GL_R, GL.GL_OBJECT_PLANE, planeR, 0); @@ -4778,10 +4778,10 @@ class JoglPipeline extends Pipeline { } break; case TexCoordGeneration.EYE_LINEAR: - + gl.glMatrixMode(GL.GL_MODELVIEW); gl.glPushMatrix(); - + if (gl.isExtensionAvailable("GL_VERSION_1_3")) { gl.glLoadTransposeMatrixd(vworldToEc, 0); } else { @@ -4789,12 +4789,12 @@ class JoglPipeline extends Pipeline { copyTranspose(vworldToEc, v); gl.glLoadMatrixd(v, 0); } - + gl.glTexGeni(GL.GL_S, GL.GL_TEXTURE_GEN_MODE, GL.GL_EYE_LINEAR); gl.glTexGeni(GL.GL_T, GL.GL_TEXTURE_GEN_MODE, GL.GL_EYE_LINEAR); gl.glTexGenfv(GL.GL_S, GL.GL_EYE_PLANE, planeS, 0); gl.glTexGenfv(GL.GL_T, GL.GL_EYE_PLANE, planeT, 0); - + if (format == TexCoordGeneration.TEXTURE_COORDINATE_3) { gl.glTexGeni(GL.GL_R, GL.GL_TEXTURE_GEN_MODE, GL.GL_EYE_LINEAR); gl.glTexGenfv(GL.GL_R, GL.GL_EYE_PLANE, planeR, 0); @@ -4815,7 +4815,7 @@ class JoglPipeline extends Pipeline { gl.glTexGeni(GL.GL_R, GL.GL_TEXTURE_GEN_MODE, GL.GL_SPHERE_MAP); gl.glTexGeni(GL.GL_Q, GL.GL_TEXTURE_GEN_MODE, GL.GL_SPHERE_MAP); } - + break; case TexCoordGeneration.NORMAL_MAP: gl.glTexGeni(GL.GL_S, GL.GL_TEXTURE_GEN_MODE, GL.GL_NORMAL_MAP); @@ -4845,14 +4845,14 @@ class JoglPipeline extends Pipeline { gl.glDisable(GL.GL_TEXTURE_GEN_Q); } } - - + + // --------------------------------------------------------------------- - + // // TransparencyAttributesRetained methods // - + private static final int screen_door[][] = { /* 0 / 16 */ { @@ -5057,7 +5057,7 @@ class JoglPipeline extends Pipeline { screen_door_table[i] = buf.slice(); } } - + private static final int[] blendFunctionTable = new int[TransparencyAttributes.MAX_BLEND_FUNC_TABLE_SIZE]; static { blendFunctionTable[TransparencyAttributes.BLEND_ZERO] = GL.GL_ZERO; @@ -5070,7 +5070,7 @@ class JoglPipeline extends Pipeline { blendFunctionTable[TransparencyAttributes.BLEND_ONE_MINUS_SRC_COLOR] = GL.GL_ONE_MINUS_SRC_COLOR; blendFunctionTable[TransparencyAttributes.BLEND_CONSTANT_COLOR] = GL.GL_CONSTANT_COLOR; } - + void updateTransparencyAttributes(Context ctx, float alpha, int geometryType, int polygonMode, @@ -5079,16 +5079,16 @@ class JoglPipeline extends Pipeline { int srcBlendFunction, int dstBlendFunction) { if (VERBOSE) System.err.println("JoglPipeline.updateTransparencyAttributes()"); - + GL gl = context(ctx).getGL(); - + if (transparencyMode != TransparencyAttributes.SCREEN_DOOR) { gl.glDisable(GL.GL_POLYGON_STIPPLE); } else { gl.glEnable(GL.GL_POLYGON_STIPPLE); gl.glPolygonStipple(screen_door_table[(int)(alpha * 16)]); } - + if ((transparencyMode < TransparencyAttributes.SCREEN_DOOR) || ((((geometryType & RenderMolecule.LINE) != 0) || (polygonMode == PolygonAttributes.POLYGON_LINE)) @@ -5103,14 +5103,14 @@ class JoglPipeline extends Pipeline { gl.glDisable(GL.GL_BLEND); } } - - + + // --------------------------------------------------------------------- - + // // TextureAttributesRetained methods // - + void updateTextureAttributes(Context ctx, double[] transform, boolean isIdentity, int textureMode, int perspCorrectionMode, @@ -5120,15 +5120,15 @@ class JoglPipeline extends Pipeline { float textureBlendColorAlpha, int textureFormat) { if (VERBOSE) System.err.println("JoglPipeline.updateTextureAttributes()"); - + GL gl = context(ctx).getGL(); gl.glHint(GL.GL_PERSPECTIVE_CORRECTION_HINT, (perspCorrectionMode == TextureAttributes.NICEST) ? GL.GL_NICEST : GL.GL_FASTEST); - + // set OGL texture matrix gl.glPushAttrib(GL.GL_TRANSFORM_BIT); gl.glMatrixMode(GL.GL_TEXTURE); - + if (isIdentity) { gl.glLoadIdentity(); } else if (gl.isExtensionAvailable("GL_VERSION_1_3")) { @@ -5138,9 +5138,9 @@ class JoglPipeline extends Pipeline { copyTranspose(transform, mx); gl.glLoadMatrixd(mx, 0); } - + gl.glPopAttrib(); - + // set texture color float[] color = new float[4]; color[0] = textureBlendColorRed; @@ -5148,9 +5148,9 @@ class JoglPipeline extends Pipeline { color[2] = textureBlendColorBlue; color[3] = textureBlendColorAlpha; gl.glTexEnvfv(GL.GL_TEXTURE_ENV, GL.GL_TEXTURE_ENV_COLOR, color, 0); - + // set texture environment mode - + switch (textureMode) { case TextureAttributes.MODULATE: gl.glTexEnvi(GL.GL_TEXTURE_ENV, GL.GL_TEXTURE_ENV_MODE, GL.GL_MODULATE); @@ -5168,12 +5168,12 @@ class JoglPipeline extends Pipeline { gl.glTexEnvi(GL.GL_TEXTURE_ENV, GL.GL_TEXTURE_ENV_MODE, GL.GL_COMBINE); break; } - + if (gl.isExtensionAvailable("GL_SGI_texture_color_table")) { gl.glDisable(GL.GL_TEXTURE_COLOR_TABLE_SGI); } } - + void updateRegisterCombiners(Context absCtx, double[] transform, boolean isIdentity, int textureMode, int perspCorrectionMode, @@ -5187,20 +5187,20 @@ class JoglPipeline extends Pipeline { int[] combineRgbFcn, int[] combineAlphaFcn, int combineRgbScale, int combineAlphaScale) { if (VERBOSE) System.err.println("JoglPipeline.updateRegisterCombiners()"); - + JoglContext ctx = (JoglContext) absCtx; GL gl = context(ctx).getGL(); - + if (perspCorrectionMode == TextureAttributes.NICEST) { gl.glHint(GL.GL_PERSPECTIVE_CORRECTION_HINT, GL.GL_NICEST); } else { gl.glHint(GL.GL_PERSPECTIVE_CORRECTION_HINT, GL.GL_FASTEST); } - + // set OGL texture matrix gl.glPushAttrib(GL.GL_TRANSFORM_BIT); gl.glMatrixMode(GL.GL_TEXTURE); - + if (isIdentity) { gl.glLoadIdentity(); } else if (gl.isExtensionAvailable("GL_VERSION_1_3")) { @@ -5210,9 +5210,9 @@ class JoglPipeline extends Pipeline { copyTranspose(transform, mx); gl.glLoadMatrixd(mx, 0); } - + gl.glPopAttrib(); - + // set texture color float[] color = new float[4]; color[0] = textureBlendColorRed; @@ -5220,7 +5220,7 @@ class JoglPipeline extends Pipeline { color[2] = textureBlendColorBlue; color[3] = textureBlendColorAlpha; gl.glTexEnvfv(GL.GL_TEXTURE_ENV, GL.GL_TEXTURE_ENV_COLOR, color, 0); - + // set texture environment mode gl.glEnable(GL.GL_REGISTER_COMBINERS_NV); int textureUnit = ctx.getCurrentTextureUnit(); @@ -5231,7 +5231,7 @@ class JoglPipeline extends Pipeline { } else { fragment = GL.GL_SPARE0_NV; } - + switch (textureMode) { case TextureAttributes.MODULATE: gl.glCombinerInputNV(combinerUnit, GL.GL_RGB, @@ -5246,7 +5246,7 @@ class JoglPipeline extends Pipeline { gl.glCombinerInputNV(combinerUnit, GL.GL_ALPHA, GL.GL_VARIABLE_B_NV, textureUnit, GL.GL_UNSIGNED_IDENTITY_NV, GL.GL_ALPHA); - + gl.glCombinerOutputNV(combinerUnit, GL.GL_RGB, GL.GL_SPARE0_NV, GL.GL_DISCARD_NV, GL.GL_DISCARD_NV, GL.GL_NONE, GL.GL_NONE, false, false, false); @@ -5254,7 +5254,7 @@ class JoglPipeline extends Pipeline { GL.GL_SPARE0_NV, GL.GL_DISCARD_NV, GL.GL_DISCARD_NV, GL.GL_NONE, GL.GL_NONE, false, false, false); break; - + case TextureAttributes.DECAL: gl.glCombinerInputNV(combinerUnit, GL.GL_RGB, GL.GL_VARIABLE_A_NV, fragment, @@ -5268,14 +5268,14 @@ class JoglPipeline extends Pipeline { gl.glCombinerInputNV(combinerUnit, GL.GL_RGB, GL.GL_VARIABLE_D_NV, textureUnit, GL.GL_UNSIGNED_IDENTITY_NV, GL.GL_ALPHA); - + gl.glCombinerInputNV(combinerUnit, GL.GL_ALPHA, GL.GL_VARIABLE_A_NV, fragment, GL.GL_UNSIGNED_IDENTITY_NV, GL.GL_ALPHA); gl.glCombinerInputNV(combinerUnit, GL.GL_ALPHA, GL.GL_VARIABLE_B_NV, GL.GL_ZERO, GL.GL_UNSIGNED_INVERT_NV, GL.GL_ALPHA); - + gl.glCombinerOutputNV(combinerUnit, GL.GL_RGB, GL.GL_DISCARD_NV, GL.GL_DISCARD_NV, GL.GL_SPARE0_NV, GL.GL_NONE, GL.GL_NONE, false, false, false); @@ -5283,10 +5283,10 @@ class JoglPipeline extends Pipeline { GL.GL_SPARE0_NV, GL.GL_DISCARD_NV, GL.GL_DISCARD_NV, GL.GL_NONE, GL.GL_NONE, false, false, false); break; - + case TextureAttributes.BLEND: gl.glCombinerParameterfvNV(GL.GL_CONSTANT_COLOR0_NV, color, 0); - + gl.glCombinerInputNV(combinerUnit, GL.GL_RGB, GL.GL_VARIABLE_A_NV, fragment, GL.GL_UNSIGNED_IDENTITY_NV, GL.GL_RGB); @@ -5299,14 +5299,14 @@ class JoglPipeline extends Pipeline { gl.glCombinerInputNV(combinerUnit, GL.GL_RGB, GL.GL_VARIABLE_D_NV, textureUnit, GL.GL_UNSIGNED_IDENTITY_NV, GL.GL_RGB); - + gl.glCombinerInputNV(combinerUnit, GL.GL_ALPHA, GL.GL_VARIABLE_A_NV, fragment, GL.GL_UNSIGNED_IDENTITY_NV, GL.GL_ALPHA); gl.glCombinerInputNV(combinerUnit, GL.GL_ALPHA, GL.GL_VARIABLE_B_NV, textureUnit, GL.GL_UNSIGNED_IDENTITY_NV, GL.GL_ALPHA); - + gl.glCombinerOutputNV(combinerUnit, GL.GL_RGB, GL.GL_DISCARD_NV, GL.GL_DISCARD_NV, GL.GL_SPARE0_NV, GL.GL_NONE, GL.GL_NONE, false, false, false); @@ -5314,7 +5314,7 @@ class JoglPipeline extends Pipeline { GL.GL_SPARE0_NV, GL.GL_DISCARD_NV, GL.GL_DISCARD_NV, GL.GL_NONE, GL.GL_NONE, false, false, false); break; - + case TextureAttributes.REPLACE: gl.glCombinerInputNV(combinerUnit, GL.GL_RGB, GL.GL_VARIABLE_A_NV, textureUnit, @@ -5328,7 +5328,7 @@ class JoglPipeline extends Pipeline { gl.glCombinerInputNV(combinerUnit, GL.GL_ALPHA, GL.GL_VARIABLE_B_NV, GL.GL_ZERO, GL.GL_UNSIGNED_INVERT_NV, GL.GL_ALPHA); - + gl.glCombinerOutputNV(combinerUnit, GL.GL_RGB, GL.GL_SPARE0_NV, GL.GL_DISCARD_NV, GL.GL_DISCARD_NV, GL.GL_NONE, GL.GL_NONE, false, false, false); @@ -5336,7 +5336,7 @@ class JoglPipeline extends Pipeline { GL.GL_SPARE0_NV, GL.GL_DISCARD_NV, GL.GL_DISCARD_NV, GL.GL_NONE, GL.GL_NONE, false, false, false); break; - + case TextureAttributes.COMBINE: if (combineRgbMode == TextureAttributes.COMBINE_DOT3) { int color1 = getCombinerArg(gl, combineRgbSrc[0], textureUnit, combinerUnit); @@ -5353,7 +5353,7 @@ class JoglPipeline extends Pipeline { gl.glCombinerInputNV(combinerUnit, GL.GL_ALPHA, GL.GL_VARIABLE_B_NV, GL.GL_ZERO, GL.GL_UNSIGNED_INVERT_NV, GL.GL_ALPHA); - + gl.glCombinerOutputNV(combinerUnit, GL.GL_RGB, GL.GL_SPARE0_NV, GL.GL_DISCARD_NV, GL.GL_DISCARD_NV, GL.GL_NONE/*SCALE_BY_FOUR_NV*/, GL.GL_NONE, true, @@ -5365,7 +5365,7 @@ class JoglPipeline extends Pipeline { } break; } - + gl.glFinalCombinerInputNV(GL.GL_VARIABLE_A_NV, GL.GL_SPARE0_NV, GL.GL_UNSIGNED_IDENTITY_NV, GL.GL_RGB); gl.glFinalCombinerInputNV(GL.GL_VARIABLE_B_NV, @@ -5380,17 +5380,17 @@ class JoglPipeline extends Pipeline { GL.GL_ZERO, GL.GL_UNSIGNED_IDENTITY_NV, GL.GL_RGB); gl.glFinalCombinerInputNV(GL.GL_VARIABLE_G_NV, GL.GL_SPARE0_NV, GL.GL_UNSIGNED_IDENTITY_NV, GL.GL_ALPHA); - + if (gl.isExtensionAvailable("GL_SGI_texture_color_table")) gl.glDisable(GL.GL_TEXTURE_COLOR_TABLE_SGI); // GL_SGI_texture_color_table } - + void updateTextureColorTable(Context ctx, int numComponents, int colorTableSize, int[] textureColorTable) { if (VERBOSE) System.err.println("JoglPipeline.updateTextureColorTable()"); - + GL gl = context(ctx).getGL(); if (gl.isExtensionAvailable("GL_SGI_texture_color_table")) { if (numComponents == 3) { @@ -5403,14 +5403,14 @@ class JoglPipeline extends Pipeline { gl.glEnable(GL.GL_TEXTURE_COLOR_TABLE_SGI); } } - + void updateCombiner(Context ctx, int combineRgbMode, int combineAlphaMode, int[] combineRgbSrc, int[] combineAlphaSrc, int[] combineRgbFcn, int[] combineAlphaFcn, int combineRgbScale, int combineAlphaScale) { if (VERBOSE) System.err.println("JoglPipeline.updateCombiner()"); - + GL gl = context(ctx).getGL(); int[] GLrgbMode = new int[1]; int[] GLalphaMode = new int[1]; @@ -5418,7 +5418,7 @@ class JoglPipeline extends Pipeline { GLrgbMode, GLalphaMode); gl.glTexEnvi(GL.GL_TEXTURE_ENV, GL.GL_COMBINE_RGB, GLrgbMode[0]); gl.glTexEnvi(GL.GL_TEXTURE_ENV, GL.GL_COMBINE_ALPHA, GLalphaMode[0]); - + int nargs; if (combineRgbMode == TextureAttributes.COMBINE_REPLACE) { nargs = 1; @@ -5427,14 +5427,14 @@ class JoglPipeline extends Pipeline { } else { nargs = 2; } - + for (int i = 0; i < nargs; i++) { gl.glTexEnvi(GL.GL_TEXTURE_ENV, _gl_combineRgbSrcIndex[i], _gl_combineSrc[combineRgbSrc[i]]); gl.glTexEnvi(GL.GL_TEXTURE_ENV, _gl_combineRgbOpIndex[i], _gl_combineFcn[combineRgbFcn[i]]); } - + if (combineAlphaMode == TextureAttributes.COMBINE_REPLACE) { nargs = 1; } else if (combineAlphaMode == TextureAttributes.COMBINE_INTERPOLATE) { @@ -5442,20 +5442,20 @@ class JoglPipeline extends Pipeline { } else { nargs = 2; } - + for (int i = 0; i < nargs; i++) { gl.glTexEnvi(GL.GL_TEXTURE_ENV, _gl_combineAlphaSrcIndex[i], _gl_combineSrc[combineAlphaSrc[i]]); gl.glTexEnvi(GL.GL_TEXTURE_ENV, _gl_combineAlphaOpIndex[i], _gl_combineFcn[combineAlphaFcn[i]]); } - + gl.glTexEnvi(GL.GL_TEXTURE_ENV, GL.GL_RGB_SCALE, combineRgbScale); gl.glTexEnvi(GL.GL_TEXTURE_ENV, GL.GL_ALPHA_SCALE, combineAlphaScale); } - + // Helper routines for above - + private void getGLCombineMode(GL gl, int combineRgbMode, int combineAlphaMode, int[] GLrgbMode, int[] GLalphaMode) { switch (combineRgbMode) { @@ -5483,7 +5483,7 @@ class JoglPipeline extends Pipeline { default: break; } - + switch (combineAlphaMode) { case TextureAttributes.COMBINE_REPLACE: GLalphaMode[0] = GL.GL_REPLACE; @@ -5516,49 +5516,49 @@ class JoglPipeline extends Pipeline { break; } } - + // mapping from java enum to gl enum private static final int[] _gl_combineRgbSrcIndex = { GL.GL_SOURCE0_RGB, GL.GL_SOURCE1_RGB, GL.GL_SOURCE2_RGB, }; - + private static final int[] _gl_combineAlphaSrcIndex = { GL.GL_SOURCE0_ALPHA, GL.GL_SOURCE1_ALPHA, GL.GL_SOURCE2_ALPHA, }; - + private static final int[] _gl_combineRgbOpIndex = { GL.GL_OPERAND0_RGB, GL.GL_OPERAND1_RGB, GL.GL_OPERAND2_RGB, }; - + private static final int[] _gl_combineAlphaOpIndex = { GL.GL_OPERAND0_ALPHA, GL.GL_OPERAND1_ALPHA, GL.GL_OPERAND2_ALPHA, }; - + private static final int[] _gl_combineSrc = { GL.GL_PRIMARY_COLOR, // TextureAttributes.COMBINE_OBJECT_COLOR GL.GL_TEXTURE, // TextureAttributes.COMBINE_TEXTURE GL.GL_CONSTANT, // TextureAttributes.COMBINE_CONSTANT_COLOR GL.GL_PREVIOUS, // TextureAttributes.COMBINE_PREVIOUS_TEXTURE_UNIT_STATE }; - + private static final int[] _gl_combineFcn = { GL.GL_SRC_COLOR, // TextureAttributes.COMBINE_SRC_COLOR GL.GL_ONE_MINUS_SRC_COLOR, // TextureAttributes.COMBINE_ONE_MINUS_SRC_COLOR GL.GL_SRC_ALPHA, // TextureAttributes.COMBINE_SRC_ALPHA GL.GL_ONE_MINUS_SRC_ALPHA, // TextureAttributes.COMBINE_ONE_MINUS_SRC_ALPHA }; - + private int getCombinerArg(GL gl, int arg, int textureUnit, int combUnit) { int comb = 0; - + switch (arg) { case TextureAttributes.COMBINE_OBJECT_COLOR: if (combUnit == GL.GL_COMBINER0_NV) { @@ -5577,23 +5577,23 @@ class JoglPipeline extends Pipeline { comb = textureUnit -1; break; } - + return comb; } - - + + // --------------------------------------------------------------------- - + // // TextureUnitStateRetained methods // - + void updateTextureUnitState(Context ctx, int index, boolean enable) { if (VERBOSE) System.err.println("JoglPipeline.updateTextureUnitState()"); - + GL gl = context(ctx).getGL(); JoglContext jctx = (JoglContext) ctx; - + if (index >= 0 && gl.isExtensionAvailable("GL_VERSION_1_3")) { gl.glActiveTexture(index + GL.GL_TEXTURE0); gl.glClientActiveTexture(GL.GL_TEXTURE0 + index); @@ -5603,7 +5603,7 @@ class JoglPipeline extends Pipeline { gl.glCombinerParameteriNV(GL.GL_NUM_GENERAL_COMBINERS_NV, index + 1); } } - + if (!enable) { // if not enabled, then don't enable any tex mapping gl.glDisable(GL.GL_TEXTURE_1D); @@ -5611,26 +5611,26 @@ class JoglPipeline extends Pipeline { gl.glDisable(GL.GL_TEXTURE_3D); gl.glDisable(GL.GL_TEXTURE_CUBE_MAP); } - + // if it is enabled, the enable flag will be taken care of // in the bindTexture call } - - + + // --------------------------------------------------------------------- - + // // TextureRetained methods // Texture2DRetained methods // - + void bindTexture2D(Context ctx, int objectId, boolean enable) { if (VERBOSE) System.err.println("JoglPipeline.bindTexture2D(objectId=" + objectId + ",enable=" + enable + ")"); - + GL gl = context(ctx).getGL(); gl.glDisable(GL.GL_TEXTURE_CUBE_MAP); gl.glDisable(GL.GL_TEXTURE_3D); - + if (!enable) { gl.glDisable(GL.GL_TEXTURE_2D); } else { @@ -5638,7 +5638,7 @@ class JoglPipeline extends Pipeline { gl.glEnable(GL.GL_TEXTURE_2D); } } - + void updateTexture2DImage(Context ctx, int numLevels, int level, int textureFormat, int imageFormat, @@ -5646,92 +5646,92 @@ class JoglPipeline extends Pipeline { int boundaryWidth, int dataType, Object data, boolean useAutoMipMap) { if (VERBOSE) System.err.println("JoglPipeline.updateTexture2DImage(width=" + width + ",height=" + height + ",level=" + level + ")"); - + updateTexture2DImage(ctx, GL.GL_TEXTURE_2D, numLevels, level, textureFormat, imageFormat, width, height, boundaryWidth, dataType, data, useAutoMipMap); } - + void updateTexture2DSubImage(Context ctx, int level, int xoffset, int yoffset, int textureFormat, int imageFormat, int imgXOffset, int imgYOffset, int tilew, int width, int height, int dataType, Object data, boolean useAutoMipMap) { - + /* Note: useAutoMipMap is not use for SubImage in the jogl pipe */ - + if (VERBOSE) System.err.println("JoglPipeline.updateTexture2DSubImage()"); - + updateTexture2DSubImage(ctx, GL.GL_TEXTURE_2D, level, xoffset, yoffset, textureFormat, imageFormat, imgXOffset, imgYOffset, tilew, width, height, dataType, data); } - + void updateTexture2DLodRange(Context ctx, int baseLevel, int maximumLevel, float minimumLOD, float maximumLOD) { if (VERBOSE) System.err.println("JoglPipeline.updateTexture2DLodRange()"); - + updateTextureLodRange(ctx, GL.GL_TEXTURE_2D, baseLevel, maximumLevel, minimumLOD, maximumLOD); } - + void updateTexture2DLodOffset(Context ctx, float lodOffsetS, float lodOffsetT, float lodOffsetR) { if (VERBOSE) System.err.println("JoglPipeline.updateTexture2DLodOffset()"); - + updateTextureLodOffset(ctx, GL.GL_TEXTURE_2D, lodOffsetS, lodOffsetT, lodOffsetR); } - + void updateTexture2DBoundary(Context ctx, int boundaryModeS, int boundaryModeT, float boundaryRed, float boundaryGreen, float boundaryBlue, float boundaryAlpha) { if (VERBOSE) System.err.println("JoglPipeline.updateTexture2DBoundary()"); - + updateTextureBoundary(ctx, GL.GL_TEXTURE_2D, boundaryModeS, boundaryModeT, -1, boundaryRed, boundaryGreen, boundaryBlue, boundaryAlpha); } - + void updateTexture2DFilterModes(Context ctx, int minFilter, int magFilter) { if (VERBOSE) System.err.println("JoglPipeline.updateTexture2DFilterModes()"); - + updateTextureFilterModes(ctx, GL.GL_TEXTURE_2D, minFilter, magFilter); } - + void updateTexture2DSharpenFunc(Context ctx, int numSharpenTextureFuncPts, float[] sharpenTextureFuncPts) { if (VERBOSE) System.err.println("JoglPipeline.updateTexture2DSharpenFunc()"); - + updateTextureSharpenFunc(ctx, GL.GL_TEXTURE_2D, numSharpenTextureFuncPts, sharpenTextureFuncPts); } - + void updateTexture2DFilter4Func(Context ctx, int numFilter4FuncPts, float[] filter4FuncPts) { if (VERBOSE) System.err.println("JoglPipeline.updateTexture2DFilter4Func()"); - + updateTextureFilter4Func(ctx, GL.GL_TEXTURE_2D, numFilter4FuncPts, filter4FuncPts); } - + void updateTexture2DAnisotropicFilter(Context ctx, float degree) { if (VERBOSE) System.err.println("JoglPipeline.updateTexture2DAnisotropicFilter()"); - + updateTextureAnisotropicFilter(ctx, GL.GL_TEXTURE_2D, degree); } - + private void updateTextureLodRange(Context ctx, int target, int baseLevel, int maximumLevel, @@ -5744,7 +5744,7 @@ class JoglPipeline extends Pipeline { gl.glTexParameterf(target, GL.GL_TEXTURE_MIN_LOD, minimumLOD); gl.glTexParameterf(target, GL.GL_TEXTURE_MAX_LOD, maximumLOD); } - + private void updateTextureLodOffset(Context ctx, int target, float lodOffsetS, float lodOffsetT, @@ -5756,7 +5756,7 @@ class JoglPipeline extends Pipeline { gl.glTexParameterf(target, GL.GL_TEXTURE_LOD_BIAS_T_SGIX, lodOffsetT); gl.glTexParameterf(target, GL.GL_TEXTURE_LOD_BIAS_R_SGIX, lodOffsetR); } - + private void updateTextureAnisotropicFilter(Context ctx, int target, float degree) { GL gl = context(ctx).getGL(); // checking of the availability of anisotropic filter functionality @@ -5765,20 +5765,20 @@ class JoglPipeline extends Pipeline { GL.GL_TEXTURE_MAX_ANISOTROPY_EXT, degree); } - + // --------------------------------------------------------------------- - + // // Texture3DRetained methods // - + void bindTexture3D(Context ctx, int objectId, boolean enable) { if (VERBOSE) System.err.println("JoglPipeline.bindTexture3D()"); - + GL gl = context(ctx).getGL(); // textureCubeMap will take precedure over 3D Texture gl.glDisable(GL.GL_TEXTURE_CUBE_MAP); - + if (!enable) { gl.glDisable(GL.GL_TEXTURE_3D); } else { @@ -5786,18 +5786,18 @@ class JoglPipeline extends Pipeline { gl.glEnable(GL.GL_TEXTURE_3D); } } - + void updateTexture3DImage(Context ctx, int numLevels, int level, int textureFormat, int imageFormat, int width, int height, int depth, int boundaryWidth, int dataType, Object data, boolean useAutoMipMap) { - + if (VERBOSE) System.err.println("JoglPipeline.updateTexture3DImage()"); - + GL gl = context(ctx).getGL(); - + int format = 0; int internalFormat = 0; int type = GL.GL_UNSIGNED_INT_8_8_8_8; @@ -5831,12 +5831,12 @@ class JoglPipeline extends Pipeline { gl.glTexParameteri(GL.GL_TEXTURE_3D, GL.GL_GENERATE_MIPMAP, GL.GL_TRUE); } else { - gl.glTexParameteri(GL.GL_TEXTURE_3D, GL.GL_GENERATE_MIPMAP, GL.GL_FALSE); + gl.glTexParameteri(GL.GL_TEXTURE_3D, GL.GL_GENERATE_MIPMAP, GL.GL_FALSE); } - + if((dataType == ImageComponentRetained.IMAGE_DATA_TYPE_BYTE_ARRAY) || (dataType == ImageComponentRetained.IMAGE_DATA_TYPE_BYTE_BUFFER)) { - + switch (imageFormat) { case ImageComponentRetained.TYPE_BYTE_BGR: format = GL.GL_BGR; @@ -5875,9 +5875,9 @@ class JoglPipeline extends Pipeline { assert false; return; } - + if(dataType == ImageComponentRetained.IMAGE_DATA_TYPE_BYTE_ARRAY) { - + gl.glTexImage3D(GL.GL_TEXTURE_3D, level, internalFormat, width, height, depth, boundaryWidth, @@ -5889,10 +5889,10 @@ class JoglPipeline extends Pipeline { width, height, depth, boundaryWidth, format, GL.GL_UNSIGNED_BYTE, (ByteBuffer) data); } - + } else if((dataType == ImageComponentRetained.IMAGE_DATA_TYPE_INT_ARRAY) || (dataType == ImageComponentRetained.IMAGE_DATA_TYPE_INT_BUFFER)) { - + switch (imageFormat) { /* GL_BGR */ case ImageComponentRetained.TYPE_INT_BGR: /* Assume XBGR format */ @@ -5919,13 +5919,13 @@ class JoglPipeline extends Pipeline { assert false; return; } - + /* Force Alpha to 1.0 if needed */ if(forceAlphaToOne) { gl.glPixelTransferf(GL.GL_ALPHA_SCALE, 0.0f); gl.glPixelTransferf(GL.GL_ALPHA_BIAS, 1.0f); } - + if(dataType == ImageComponentRetained.IMAGE_DATA_TYPE_INT_ARRAY) { gl.glTexImage3D(GL.GL_TEXTURE_3D, level, internalFormat, @@ -5937,7 +5937,7 @@ class JoglPipeline extends Pipeline { width, height, depth, boundaryWidth, format, type, (Buffer) data); } - + /* Restore Alpha scale and bias */ if(forceAlphaToOne) { gl.glPixelTransferf(GL.GL_ALPHA_SCALE, 1.0f); @@ -5947,7 +5947,7 @@ class JoglPipeline extends Pipeline { assert false; } } - + void updateTexture3DSubImage(Context ctx, int level, int xoffset, int yoffset, int zoffset, @@ -5956,25 +5956,25 @@ class JoglPipeline extends Pipeline { int tilew, int tileh, int width, int height, int depth, int dataType, Object data, boolean useAutoMipMap) { - + /* Note: useAutoMipMap is not use for SubImage in the jogl pipe */ - + if (VERBOSE) System.err.println("JoglPipeline.updateTexture3DSubImage()"); - + GL gl = context(ctx).getGL(); - + int format = 0; int internalFormat = 0; int type = GL.GL_UNSIGNED_INT_8_8_8_8; int numBytes = 0; boolean forceAlphaToOne = false; boolean pixelStore = false; - + if (imgXOffset > 0 || (width < tilew)) { pixelStore = true; gl.glPixelStorei(GL.GL_UNPACK_ROW_LENGTH, tilew); } - + switch (textureFormat) { case Texture.INTENSITY: internalFormat = GL.GL_INTENSITY; @@ -5997,10 +5997,10 @@ class JoglPipeline extends Pipeline { default: assert false; } - + if((dataType == ImageComponentRetained.IMAGE_DATA_TYPE_BYTE_ARRAY) || (dataType == ImageComponentRetained.IMAGE_DATA_TYPE_BYTE_BUFFER)) { - + switch (imageFormat) { case ImageComponentRetained.TYPE_BYTE_BGR: format = GL.GL_BGR; @@ -6045,8 +6045,8 @@ class JoglPipeline extends Pipeline { default: assert false; return; - } - + } + ByteBuffer buf = null; if(dataType == ImageComponentRetained.IMAGE_DATA_TYPE_BYTE_ARRAY) { buf = ByteBuffer.wrap((byte[]) data); @@ -6063,10 +6063,10 @@ class JoglPipeline extends Pipeline { width, height, depth, format, GL.GL_UNSIGNED_BYTE, buf); - + } else if((dataType == ImageComponentRetained.IMAGE_DATA_TYPE_INT_ARRAY) || (dataType == ImageComponentRetained.IMAGE_DATA_TYPE_INT_BUFFER)) { - + switch (imageFormat) { /* GL_BGR */ case ImageComponentRetained.TYPE_INT_BGR: /* Assume XBGR format */ @@ -6093,21 +6093,21 @@ class JoglPipeline extends Pipeline { assert false; return; } - + /* Force Alpha to 1.0 if needed */ if(forceAlphaToOne) { gl.glPixelTransferf(GL.GL_ALPHA_SCALE, 0.0f); gl.glPixelTransferf(GL.GL_ALPHA_BIAS, 1.0f); } - + IntBuffer buf = null; if(dataType == ImageComponentRetained.IMAGE_DATA_TYPE_INT_ARRAY) { buf = IntBuffer.wrap((int[]) data); } else { buf = (IntBuffer) data; - } - + } + int offset = tilew * tileh * imgZOffset + tilew * imgYOffset + imgXOffset; buf.position(offset); @@ -6116,7 +6116,7 @@ class JoglPipeline extends Pipeline { width, height, depth, format, type, buf); - + /* Restore Alpha scale and bias */ if(forceAlphaToOne) { gl.glPixelTransferf(GL.GL_ALPHA_SCALE, 1.0f); @@ -6126,88 +6126,88 @@ class JoglPipeline extends Pipeline { assert false; return; } - + if (pixelStore) { gl.glPixelStorei(GL.GL_UNPACK_ROW_LENGTH, 0); } - + } - - + + void updateTexture3DLodRange(Context ctx, int baseLevel, int maximumLevel, float minimumLod, float maximumLod) { if (VERBOSE) System.err.println("JoglPipeline.updateTexture3DLodRange()"); - + updateTextureLodRange(ctx, GL.GL_TEXTURE_3D, baseLevel, maximumLevel, minimumLod, maximumLod); } - + void updateTexture3DLodOffset(Context ctx, float lodOffsetS, float lodOffsetT, float lodOffsetR) { if (VERBOSE) System.err.println("JoglPipeline.updateTexture3DLodOffset()"); - + updateTextureLodOffset(ctx, GL.GL_TEXTURE_3D, lodOffsetS, lodOffsetT, lodOffsetR); } - + void updateTexture3DBoundary(Context ctx, int boundaryModeS, int boundaryModeT, int boundaryModeR, float boundaryRed, float boundaryGreen, float boundaryBlue, float boundaryAlpha) { if (VERBOSE) System.err.println("JoglPipeline.updateTexture3DBoundary()"); - + updateTextureBoundary(ctx, GL.GL_TEXTURE_2D, boundaryModeS, boundaryModeT, boundaryModeR, boundaryRed, boundaryGreen, boundaryBlue, boundaryAlpha); } - + void updateTexture3DFilterModes(Context ctx, int minFilter, int magFilter) { if (VERBOSE) System.err.println("JoglPipeline.updateTexture3DFilterModes()"); - + updateTextureFilterModes(ctx, GL.GL_TEXTURE_3D, minFilter, magFilter); } - + void updateTexture3DSharpenFunc(Context ctx, int numSharpenTextureFuncPts, float[] sharpenTextureFuncPts) { if (VERBOSE) System.err.println("JoglPipeline.updateTexture3DSharpenFunc()"); - + updateTextureSharpenFunc(ctx, GL.GL_TEXTURE_3D, numSharpenTextureFuncPts, sharpenTextureFuncPts); } - + void updateTexture3DFilter4Func(Context ctx, int numFilter4FuncPts, float[] filter4FuncPts) { if (VERBOSE) System.err.println("JoglPipeline.updateTexture3DFilter4Func()"); - + updateTextureFilter4Func(ctx, GL.GL_TEXTURE_3D, numFilter4FuncPts, filter4FuncPts); } - + void updateTexture3DAnisotropicFilter(Context ctx, float degree) { if (VERBOSE) System.err.println("JoglPipeline.updateTexture3DAnisotropicFilter()"); - + updateTextureAnisotropicFilter(ctx, GL.GL_TEXTURE_3D, degree); } - - + + // --------------------------------------------------------------------- - + // // TextureCubeMapRetained methods // - + void bindTextureCubeMap(Context ctx, int objectId, boolean enable) { if (VERBOSE) System.err.println("JoglPipeline.bindTextureCubeMap()"); - + GL gl = context(ctx).getGL(); // TextureCubeMap will take precedure over 3D Texture so // there is no need to disable 3D Texture here. @@ -6218,7 +6218,7 @@ class JoglPipeline extends Pipeline { gl.glEnable(GL.GL_TEXTURE_CUBE_MAP); } } - + void updateTextureCubeMapImage(Context ctx, int face, int numLevels, int level, int textureFormat, int imageFormat, @@ -6226,105 +6226,105 @@ class JoglPipeline extends Pipeline { int boundaryWidth, int dataType, Object data, boolean useAutoMipMap) { if (VERBOSE) System.err.println("JoglPipeline.updateTextureCubeMapImage()"); - + updateTexture2DImage(ctx, _gl_textureCubeMapFace[face], numLevels, level, textureFormat, imageFormat, width, height, boundaryWidth, dataType, data, useAutoMipMap); } - + void updateTextureCubeMapSubImage(Context ctx, int face, int level, int xoffset, int yoffset, int textureFormat,int imageFormat, int imgXOffset, int imgYOffset, int tilew, int width, int height, int dataType, Object data, boolean useAutoMipMap) { - + /* Note: useAutoMipMap is not use for SubImage in the jogl pipe */ - + if (VERBOSE) System.err.println("JoglPipeline.updateTextureCubeMapSubImage()"); - + updateTexture2DSubImage(ctx, _gl_textureCubeMapFace[face], level, xoffset, yoffset, textureFormat, imageFormat, imgXOffset, imgYOffset, tilew, width, height, dataType, data); } - + void updateTextureCubeMapLodRange(Context ctx, int baseLevel, int maximumLevel, float minimumLod, float maximumLod) { if (VERBOSE) System.err.println("JoglPipeline.updateTextureCubeMapLodRange()"); - + updateTextureLodRange(ctx, GL.GL_TEXTURE_CUBE_MAP, baseLevel, maximumLevel, minimumLod, maximumLod); } - + void updateTextureCubeMapLodOffset(Context ctx, float lodOffsetS, float lodOffsetT, float lodOffsetR) { if (VERBOSE) System.err.println("JoglPipeline.updateTextureCubeMapLodOffset()"); - + updateTextureLodOffset(ctx, GL.GL_TEXTURE_CUBE_MAP, lodOffsetS, lodOffsetT, lodOffsetR); } - + void updateTextureCubeMapBoundary(Context ctx, int boundaryModeS, int boundaryModeT, float boundaryRed, float boundaryGreen, float boundaryBlue, float boundaryAlpha) { if (VERBOSE) System.err.println("JoglPipeline.updateTextureCubeMapBoundary()"); - + updateTextureBoundary(ctx, GL.GL_TEXTURE_CUBE_MAP, boundaryModeS, boundaryModeT, -1, boundaryRed, boundaryGreen, boundaryBlue, boundaryAlpha); } - + void updateTextureCubeMapFilterModes(Context ctx, int minFilter, int magFilter) { if (VERBOSE) System.err.println("JoglPipeline.updateTextureCubeMapFilterModes()"); - + updateTextureFilterModes(ctx, GL.GL_TEXTURE_CUBE_MAP, minFilter, magFilter); } - + void updateTextureCubeMapSharpenFunc(Context ctx, int numSharpenTextureFuncPts, float[] sharpenTextureFuncPts) { if (VERBOSE) System.err.println("JoglPipeline.updateTextureCubeMapSharpenFunc()"); - + updateTextureSharpenFunc(ctx, GL.GL_TEXTURE_CUBE_MAP, numSharpenTextureFuncPts, sharpenTextureFuncPts); } - + void updateTextureCubeMapFilter4Func(Context ctx, int numFilter4FuncPts, float[] filter4FuncPts) { if (VERBOSE) System.err.println("JoglPipeline.updateTextureCubeMapFilter4Func()"); - + updateTextureFilter4Func(ctx, GL.GL_TEXTURE_CUBE_MAP, numFilter4FuncPts, filter4FuncPts); } - + void updateTextureCubeMapAnisotropicFilter(Context ctx, float degree) { if (VERBOSE) System.err.println("JoglPipeline.updateTextureCubeMapAnisotropicFilter()"); - + updateTextureAnisotropicFilter(ctx, GL.GL_TEXTURE_CUBE_MAP, degree); } - + //---------------------------------------------------------------------- // // Helper routines for above texture methods // - + private void updateTexture2DImage(Context ctx, int target, int numLevels, @@ -6338,11 +6338,11 @@ class JoglPipeline extends Pipeline { Object data, boolean useAutoMipMap) { GL gl = context(ctx).getGL(); - + int format = 0, internalFormat = 0; int type = GL.GL_UNSIGNED_INT_8_8_8_8; boolean forceAlphaToOne = false; - + switch (textureFormat) { case Texture.INTENSITY: internalFormat = GL.GL_INTENSITY; @@ -6365,17 +6365,17 @@ class JoglPipeline extends Pipeline { default: assert false; } - + if (useAutoMipMap) { gl.glTexParameteri(target, GL.GL_GENERATE_MIPMAP, GL.GL_TRUE); } else { - gl.glTexParameteri(target, GL.GL_GENERATE_MIPMAP, GL.GL_FALSE); + gl.glTexParameteri(target, GL.GL_GENERATE_MIPMAP, GL.GL_FALSE); } - + if((dataType == ImageComponentRetained.IMAGE_DATA_TYPE_BYTE_ARRAY) || (dataType == ImageComponentRetained.IMAGE_DATA_TYPE_BYTE_BUFFER)) { - + switch (imageFormat) { case ImageComponentRetained.TYPE_BYTE_BGR: format = GL.GL_BGR; @@ -6414,9 +6414,9 @@ class JoglPipeline extends Pipeline { assert false; return; } - + if(dataType == ImageComponentRetained.IMAGE_DATA_TYPE_BYTE_ARRAY) { - + gl.glTexImage2D(target, level, internalFormat, width, height, boundaryWidth, format, GL.GL_UNSIGNED_BYTE, ByteBuffer.wrap((byte[])data)); @@ -6425,10 +6425,10 @@ class JoglPipeline extends Pipeline { width, height, boundaryWidth, format, GL.GL_UNSIGNED_BYTE, (Buffer) data); } - + } else if((dataType == ImageComponentRetained.IMAGE_DATA_TYPE_INT_ARRAY) || (dataType == ImageComponentRetained.IMAGE_DATA_TYPE_INT_BUFFER)) { - + switch (imageFormat) { /* GL_BGR */ case ImageComponentRetained.TYPE_INT_BGR: /* Assume XBGR format */ @@ -6455,13 +6455,13 @@ class JoglPipeline extends Pipeline { assert false; return; } - + /* Force Alpha to 1.0 if needed */ if(forceAlphaToOne) { gl.glPixelTransferf(GL.GL_ALPHA_SCALE, 0.0f); gl.glPixelTransferf(GL.GL_ALPHA_BIAS, 1.0f); } - + if(dataType == ImageComponentRetained.IMAGE_DATA_TYPE_INT_ARRAY) { gl.glTexImage2D(target, level, internalFormat, width, height, boundaryWidth, @@ -6471,7 +6471,7 @@ class JoglPipeline extends Pipeline { width, height, boundaryWidth, format, type, (Buffer) data); } - + /* Restore Alpha scale and bias */ if(forceAlphaToOne) { gl.glPixelTransferf(GL.GL_ALPHA_SCALE, 1.0f); @@ -6481,7 +6481,7 @@ class JoglPipeline extends Pipeline { assert false; } } - + private void updateTexture2DSubImage(Context ctx, int target, int level, int xoffset, int yoffset, @@ -6490,18 +6490,18 @@ class JoglPipeline extends Pipeline { int tilew, int width, int height, int dataType, Object data) { GL gl = context(ctx).getGL(); - + int format = 0, internalFormat=0; int numBytes = 0; int type = GL.GL_UNSIGNED_INT_8_8_8_8; boolean forceAlphaToOne = false; boolean pixelStore = false; - + if (imgXOffset > 0 || (width < tilew)) { pixelStore = true; gl.glPixelStorei(GL.GL_UNPACK_ROW_LENGTH, tilew); } - + switch (textureFormat) { case Texture.INTENSITY: internalFormat = GL.GL_INTENSITY; @@ -6524,10 +6524,10 @@ class JoglPipeline extends Pipeline { default: assert false; } - + if((dataType == ImageComponentRetained.IMAGE_DATA_TYPE_BYTE_ARRAY) || (dataType == ImageComponentRetained.IMAGE_DATA_TYPE_BYTE_BUFFER)) { - + switch (imageFormat) { case ImageComponentRetained.TYPE_BYTE_BGR: format = GL.GL_BGR; @@ -6573,7 +6573,7 @@ class JoglPipeline extends Pipeline { assert false; return; } - + ByteBuffer buf = null; if(dataType == ImageComponentRetained.IMAGE_DATA_TYPE_BYTE_ARRAY) { buf = ByteBuffer.wrap((byte[]) data); @@ -6581,15 +6581,15 @@ class JoglPipeline extends Pipeline { else { buf = (ByteBuffer) data; } - + // offset by the imageOffset buf.position((tilew * imgYOffset + imgXOffset) * numBytes); gl.glTexSubImage2D(target, level, xoffset, yoffset, width, height, format, GL.GL_UNSIGNED_BYTE, buf); - + } else if((dataType == ImageComponentRetained.IMAGE_DATA_TYPE_INT_ARRAY) || (dataType == ImageComponentRetained.IMAGE_DATA_TYPE_INT_BUFFER)) { - + switch (imageFormat) { /* GL_BGR */ case ImageComponentRetained.TYPE_INT_BGR: /* Assume XBGR format */ @@ -6621,20 +6621,20 @@ class JoglPipeline extends Pipeline { gl.glPixelTransferf(GL.GL_ALPHA_SCALE, 0.0f); gl.glPixelTransferf(GL.GL_ALPHA_BIAS, 1.0f); } - + IntBuffer buf = null; if(dataType == ImageComponentRetained.IMAGE_DATA_TYPE_INT_ARRAY) { buf = IntBuffer.wrap((int[]) data); } else { buf = (IntBuffer) data; - } - + } + // offset by the imageOffset buf.position(tilew * imgYOffset + imgXOffset); gl.glTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, buf); - + /* Restore Alpha scale and bias */ if(forceAlphaToOne) { gl.glPixelTransferf(GL.GL_ALPHA_SCALE, 1.0f); @@ -6644,29 +6644,29 @@ class JoglPipeline extends Pipeline { assert false; return; } - + if (pixelStore) { gl.glPixelStorei(GL.GL_UNPACK_ROW_LENGTH, 0); } - + } - + void updateTextureFilterModes(Context ctx, int target, int minFilter, int magFilter) { GL gl = context(ctx).getGL(); - + if (EXTRA_DEBUGGING) { System.err.println("minFilter: " + getFilterName(minFilter) + " magFilter: " + getFilterName(magFilter)); } - + // FIXME: unclear whether we really need to set up the enum values // in the JoglContext as is done in the native code depending on // extension availability; maybe this is the defined fallback // behavior of the various Java3D modes - + // set texture min filter switch (minFilter) { case Texture.FASTEST: @@ -6690,7 +6690,7 @@ class JoglPipeline extends Pipeline { GL.GL_FILTER4_SGIS); break; } - + // set texture mag filter switch (magFilter) { case Texture.FASTEST: @@ -6731,7 +6731,7 @@ class JoglPipeline extends Pipeline { break; } } - + void updateTextureBoundary(Context ctx, int target, int boundaryModeS, @@ -6742,7 +6742,7 @@ class JoglPipeline extends Pipeline { float boundaryBlue, float boundaryAlpha) { GL gl = context(ctx).getGL(); - + // set texture wrap parameter switch (boundaryModeS) { case Texture.WRAP: @@ -6760,7 +6760,7 @@ class JoglPipeline extends Pipeline { GL.GL_CLAMP_TO_BORDER); break; } - + switch (boundaryModeT) { case Texture.WRAP: gl.glTexParameteri(target, GL.GL_TEXTURE_WRAP_T, GL.GL_REPEAT); @@ -6777,7 +6777,7 @@ class JoglPipeline extends Pipeline { GL.GL_CLAMP_TO_BORDER); break; } - + // applies to Texture3D only if (boundaryModeR != -1) { switch (boundaryModeR) { @@ -6785,7 +6785,7 @@ class JoglPipeline extends Pipeline { gl.glTexParameteri(target, GL.GL_TEXTURE_WRAP_R, GL.GL_REPEAT); break; - + case Texture.CLAMP: gl.glTexParameteri(target, GL.GL_TEXTURE_WRAP_R, GL.GL_CLAMP); @@ -6802,7 +6802,7 @@ class JoglPipeline extends Pipeline { break; } } - + if (boundaryModeS == Texture.CLAMP || boundaryModeT == Texture.CLAMP || boundaryModeR == Texture.CLAMP) { @@ -6815,7 +6815,7 @@ class JoglPipeline extends Pipeline { gl.glTexParameterfv(target, GL.GL_TEXTURE_BORDER_COLOR, color, 0); } } - + private static final String getFilterName(int filter) { switch (filter) { case Texture.FASTEST: @@ -6848,7 +6848,7 @@ class JoglPipeline extends Pipeline { return "(unknown)"; } } - + private void updateTextureSharpenFunc(Context ctx, int target, int numPts, @@ -6858,7 +6858,7 @@ class JoglPipeline extends Pipeline { GL gl = context(ctx).getGL(); gl.glSharpenTexFuncSGIS(target, numPts, pts, 0); } - + private void updateTextureFilter4Func(Context ctx, int target, int numPts, @@ -6869,7 +6869,7 @@ class JoglPipeline extends Pipeline { gl.glTexFilterFuncSGIS(target, GL.GL_FILTER4_SGIS, numPts, pts, 0); } - + // mapping from java enum to gl enum private static final int[] _gl_textureCubeMapFace = { GL.GL_TEXTURE_CUBE_MAP_POSITIVE_X, @@ -6879,44 +6879,44 @@ class JoglPipeline extends Pipeline { GL.GL_TEXTURE_CUBE_MAP_POSITIVE_Z, GL.GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, }; - + // --------------------------------------------------------------------- - + // // MasterControl methods // - + // Method to return the AWT object long getAWT() { if (VERBOSE) System.err.println("JoglPipeline.getAWT()"); - + // FIXME: probably completely unneeded in this implementation, // but should probably remove this dependence in the shared code return 0; } - + // Method to initialize the native J3D library boolean initializeJ3D(boolean disableXinerama) { // Dummy method in JOGL pipeline return true; } - + // Maximum lights supported by the native API int getMaximumLights() { if (VERBOSE) System.err.println("JoglPipeline.getMaximumLights()"); - + // FIXME: this isn't quite what the NativePipeline returns but // is probably close enough return 8; } - - + + // --------------------------------------------------------------------- - + // // Canvas3D methods - native wrappers // - + // This is the native method for creating the underlying graphics context. Context createNewContext(Canvas3D cv, long display, Drawable drawable, long fbConfig, Context shareCtx, boolean isSharedCtx, @@ -6939,14 +6939,14 @@ class JoglPipeline extends Pipeline { } else { draw = drawable(cv.drawable); } - + // FIXME: assuming that this only gets called after addNotify has been called draw.setRealized(true); GLContext context = draw.createContext(context(shareCtx)); - + // Apparently we are supposed to make the context current at // this point and set up a bunch of properties - + // Work around for some low end graphics driver bug, such as Intel Chipset. // Issue 324 : Lockup Java3D program and throw exception using JOGL renderer boolean failed = false; @@ -6967,24 +6967,24 @@ class JoglPipeline extends Pipeline { } while (failed && (failCount < MAX_FAIL_COUNT)); if (failCount == MAX_FAIL_COUNT) { throw new IllegalRenderingStateException("Unable to make new context current after " + failCount + "tries"); - } - + } + GL gl = context.getGL(); JoglContext ctx = new JoglContext(context); - + try { if (!getPropertiesFromCurrentContext(ctx)) { throw new IllegalRenderingStateException("Unable to fetch properties from current OpenGL context"); } - + if(!isSharedCtx){ // Set up fields in Canvas3D setupCanvasProperties(cv, ctx, gl, glslLibraryAvailable, cgLibraryAvailable); } - + // Enable rescale normal gl.glEnable(GL.GL_RESCALE_NORMAL); - + gl.glColorMaterial(GL.GL_FRONT_AND_BACK, GL.GL_DIFFUSE); gl.glDepthFunc(GL.GL_LEQUAL); gl.glEnable(GL.GL_COLOR_MATERIAL); @@ -6999,22 +6999,22 @@ class JoglPipeline extends Pipeline { } finally { context.release(); } - + return ctx; } - + void createQueryContext(Canvas3D cv, long display, Drawable drawable, long fbConfig, boolean offScreen, int width, int height, boolean glslLibraryAvailable, boolean cgLibraryAvailable) { if (VERBOSE) System.err.println("JoglPipeline.createQueryContext()"); - + // FIXME: for now, ignoring the "offscreen" flag -- unclear how // to create an offscreen buffer at this point -- very likely // need Canvas3D.offScreenBufferInfo promoted to an Object -- // this logic will need to be revisited to make sure we capture // all of the functionality of the NativePipeline - + Frame f = new Frame(); f.setUndecorated(true); f.setLayout(new BorderLayout()); @@ -7041,21 +7041,21 @@ class JoglPipeline extends Pipeline { } } } - + disposeOnEDT(f); } - + // This is the native for creating an offscreen buffer Drawable createOffScreenBuffer(Canvas3D cv, Context ctx, long display, long fbConfig, int width, int height) { if (VERBOSE) System.err.println("JoglPipeline.createOffScreenBuffer()"); - + // Note 1: when this is called, the incoming Context argument is // null because (obviously) no drawable or context has been // created for the Canvas3D yet. - + // Note 2: we ignore the global j3d.usePbuffer flag; JOGL // doesn't expose pixmap/bitmap surfaces in its public API. - + // First pick up the JoglGraphicsConfiguration and from there // the GLCapabilities from the Canvas3D JoglGraphicsConfiguration jcfg = (JoglGraphicsConfiguration) cv.graphicsConfiguration; @@ -7067,24 +7067,24 @@ class JoglPipeline extends Pipeline { // FIXME: do anything else here? Throw exception? return null; } - + GLPbuffer pbuffer = GLDrawableFactory.getFactory().createGLPbuffer(caps, null, width, height, null); return new JoglDrawable(pbuffer); } - + void destroyOffScreenBuffer(Canvas3D cv, Context ctx, long display, long fbConfig, Drawable drawable) { if (VERBOSE) System.err.println("JoglPipeline.destroyOffScreenBuffer()"); - + JoglDrawable jdraw = (JoglDrawable) drawable; GLPbuffer pbuffer = (GLPbuffer) jdraw.getGLDrawable(); pbuffer.destroy(); } - + // This is the native for reading the image from the offscreen buffer void readOffScreenBuffer(Canvas3D cv, Context ctx, int format, int dataType, Object data, int width, int height) { if (VERBOSE) System.err.println("JoglPipeline.readOffScreenBuffer()"); - + GL gl = context(ctx).getGL(); gl.glPixelStorei(GL.GL_PACK_ROW_LENGTH, width); gl.glPixelStorei(GL.GL_PACK_ALIGNMENT, 1); @@ -7092,7 +7092,7 @@ class JoglPipeline extends Pipeline { int type = 0; if((dataType == ImageComponentRetained.IMAGE_DATA_TYPE_BYTE_ARRAY) || (dataType == ImageComponentRetained.IMAGE_DATA_TYPE_BYTE_BUFFER)) { - + switch (format) { // GL_BGR case ImageComponentRetained.TYPE_BYTE_BGR: @@ -7113,7 +7113,7 @@ class JoglPipeline extends Pipeline { case ImageComponentRetained.TYPE_BYTE_RGBA: type = GL.GL_RGBA; break; - + /* This method only supports 3 and 4 components formats and BYTE types. */ case ImageComponentRetained.TYPE_BYTE_LA: case ImageComponentRetained.TYPE_BYTE_GRAY: @@ -7124,7 +7124,7 @@ class JoglPipeline extends Pipeline { default: throw new AssertionError("illegal format " + format); } - + gl.glReadPixels(0, 0, width, height, type, GL.GL_UNSIGNED_BYTE, ByteBuffer.wrap((byte[]) data)); } else if((dataType == ImageComponentRetained.IMAGE_DATA_TYPE_INT_ARRAY) || @@ -7158,13 +7158,13 @@ class JoglPipeline extends Pipeline { default: throw new AssertionError("illegal format " + format); } - + /* Force Alpha to 1.0 if needed */ if(forceAlphaToOne) { gl.glPixelTransferf(GL.GL_ALPHA_SCALE, 0.0f); gl.glPixelTransferf(GL.GL_ALPHA_BIAS, 1.0f); } - + gl.glReadPixels(0, 0, width, height, type, intType, IntBuffer.wrap((int[]) data)); /* Restore Alpha scale and bias */ @@ -7172,13 +7172,13 @@ class JoglPipeline extends Pipeline { gl.glPixelTransferf(GL.GL_ALPHA_SCALE, 1.0f); gl.glPixelTransferf(GL.GL_ALPHA_BIAS, 0.0f); } - + } else { throw new AssertionError("illegal image data type " + dataType); - + } } - + // The native method for swapBuffers int swapBuffers(Canvas3D cv, Context ctx, long dpy, Drawable drawable) { if (VERBOSE) System.err.println("JoglPipeline.swapBuffers()"); @@ -7186,28 +7186,28 @@ class JoglPipeline extends Pipeline { draw.swapBuffers(); return 0; } - + // notify D3D that Canvas is resize int resizeD3DCanvas(Canvas3D cv, Context ctx) { // Dummy method in JOGL pipeline return 0; } - + // notify D3D to toggle between FullScreen and window mode int toggleFullScreenMode(Canvas3D cv, Context ctx) { // Dummy method in JOGL pipeline return 0; } - + // native method for setting Material when no material is present void updateMaterialColor(Context ctx, float r, float g, float b, float a) { if (VERBOSE) System.err.println("JoglPipeline.updateMaterialColor()"); - + GL gl = context(ctx).getGL(); gl.glColor4f(r, g, b, a); gl.glDisable(GL.GL_LIGHTING); } - + void destroyContext(long display, Drawable drawable, Context ctx) { if (VERBOSE) System.err.println("JoglPipeline.destroyContext()"); GLDrawable draw = drawable(drawable); @@ -7219,48 +7219,48 @@ class JoglPipeline extends Pipeline { // FIXME: assuming this is the right point at which to make this call draw.setRealized(false); } - + // This is the native method for doing accumulation. void accum(Context ctx, float value) { if (VERBOSE) System.err.println("JoglPipeline.accum()"); - + GL gl = context(ctx).getGL(); gl.glReadBuffer(GL.GL_BACK); gl.glAccum(GL.GL_ACCUM, value); gl.glReadBuffer(GL.GL_FRONT); } - + // This is the native method for doing accumulation return. void accumReturn(Context ctx) { if (VERBOSE) System.err.println("JoglPipeline.accumReturn()"); - + GL gl = context(ctx).getGL(); gl.glAccum(GL.GL_RETURN, 1.0f); } - + // This is the native method for clearing the accumulation buffer. void clearAccum(Context ctx) { if (VERBOSE) System.err.println("JoglPipeline.clearAccum()"); - + GL gl = context(ctx).getGL(); gl.glClear(GL.GL_ACCUM_BUFFER_BIT); } - + // This is the native method for getting the number of lights the underlying // native library can support. int getNumCtxLights(Context ctx) { if (VERBOSE) System.err.println("JoglPipeline.getNumCtxLights()"); - + GL gl = context(ctx).getGL(); int[] res = new int[1]; gl.glGetIntegerv(GL.GL_MAX_LIGHTS, res, 0); return res[0]; } - + // Native method for decal 1st child setup boolean decal1stChildSetup(Context ctx) { if (VERBOSE) System.err.println("JoglPipeline.decal1stChildSetup()"); - + GL gl = context(ctx).getGL(); gl.glEnable(GL.GL_STENCIL_TEST); gl.glClearStencil(0x0); @@ -7272,79 +7272,79 @@ class JoglPipeline extends Pipeline { else return false; } - + // Native method for decal nth child setup void decalNthChildSetup(Context ctx) { if (VERBOSE) System.err.println("JoglPipeline.decalNthChildSetup()"); - + GL gl = context(ctx).getGL(); gl.glDisable(GL.GL_DEPTH_TEST); gl.glStencilFunc(GL.GL_EQUAL, 0x1, 0x1); gl.glStencilOp(GL.GL_KEEP, GL.GL_KEEP, GL.GL_KEEP); } - + // Native method for decal reset void decalReset(Context ctx, boolean depthBufferEnable) { if (VERBOSE) System.err.println("JoglPipeline.decalReset()"); - + GL gl = context(ctx).getGL(); gl.glDisable(GL.GL_STENCIL_TEST); if (depthBufferEnable) gl.glEnable(GL.GL_DEPTH_TEST); } - + // Native method for eye lighting void ctxUpdateEyeLightingEnable(Context ctx, boolean localEyeLightingEnable) { if (VERBOSE) System.err.println("JoglPipeline.ctxUpdateEyeLightingEnable()"); - + GL gl = context(ctx).getGL(); - + if (localEyeLightingEnable) { gl.glLightModeli(GL.GL_LIGHT_MODEL_LOCAL_VIEWER, GL.GL_TRUE); } else { gl.glLightModeli(GL.GL_LIGHT_MODEL_LOCAL_VIEWER, GL.GL_FALSE); } } - + // The following three methods are used in multi-pass case - + // native method for setting blend color void setBlendColor(Context ctx, float red, float green, float blue, float alpha) { if (VERBOSE) System.err.println("JoglPipeline.setBlendColor()"); - + GL gl = context(ctx).getGL(); if (gl.isExtensionAvailable("GL_ARB_imaging")) { gl.glBlendColor(red, green, blue, alpha); } } - + // native method for setting blend func void setBlendFunc(Context ctx, int srcBlendFunction, int dstBlendFunction) { if (VERBOSE) System.err.println("JoglPipeline.setBlendFunc()"); - + GL gl = context(ctx).getGL(); gl.glEnable(GL.GL_BLEND); gl.glBlendFunc(blendFunctionTable[srcBlendFunction], blendFunctionTable[dstBlendFunction]); } - + // native method for setting fog enable flag void setFogEnableFlag(Context ctx, boolean enable) { if (VERBOSE) System.err.println("JoglPipeline.setFogEnableFlag()"); - + GL gl = context(ctx).getGL(); - + if (enable) gl.glEnable(GL.GL_FOG); else gl.glDisable(GL.GL_FOG); } - + // Setup the full scene antialising in D3D and ogl when GL_ARB_multisamle supported void setFullSceneAntialiasing(Context absCtx, boolean enable) { if (VERBOSE) System.err.println("JoglPipeline.setFullSceneAntialiasing()"); - + JoglContext ctx = (JoglContext) absCtx; GL gl = context(ctx).getGL(); if (ctx.getHasMultisample() && !VirtualUniverse.mc.implicitAntialiasing) { @@ -7355,41 +7355,41 @@ class JoglPipeline extends Pipeline { } } } - + void setGlobalAlpha(Context ctx, float alpha) { if (VERBOSE) System.err.println("JoglPipeline.setGlobalAlpha()"); - + GL gl = context(ctx).getGL(); if (gl.isExtensionAvailable("GL_SUN_global_alpha")) { gl.glEnable(GL.GL_GLOBAL_ALPHA_SUN); gl.glGlobalAlphaFactorfSUN(alpha); } } - + // Native method to update separate specular color control void updateSeparateSpecularColorEnable(Context ctx, boolean enable) { if (VERBOSE) System.err.println("JoglPipeline.updateSeparateSpecularColorEnable()"); - + GL gl = context(ctx).getGL(); - + if (enable) { gl.glLightModeli(GL.GL_LIGHT_MODEL_COLOR_CONTROL, GL.GL_SEPARATE_SPECULAR_COLOR); } else { gl.glLightModeli(GL.GL_LIGHT_MODEL_COLOR_CONTROL, GL.GL_SINGLE_COLOR); } } - + // Initialization for D3D when scene begins and ends void beginScene(Context ctx) { } void endScene(Context ctx) { } - + // True under Solaris, // False under windows when display mode <= 8 bit boolean validGraphicsMode() { if (VERBOSE) System.err.println("JoglPipeline.validGraphicsMode()"); - + // FIXME: believe this should do exactly what the native code // used to, but not 100% sure (also in theory should only run // this code on the Windows platform? What about Mac OS X?) @@ -7397,20 +7397,20 @@ class JoglPipeline extends Pipeline { GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDisplayMode(); // Note: on X11 platforms, a bit depth < 0 simply indicates that // multiple visuals are supported on the current display mode - + if (VERBOSE) System.err.println(" Returning " + (currentMode.getBitDepth() < 0 || currentMode.getBitDepth() > 8)); - + return (currentMode.getBitDepth() < 0 || currentMode.getBitDepth() > 8); } - + // native method for setting light enables void setLightEnables(Context ctx, long enableMask, int maxLights) { if (VERBOSE) System.err.println("JoglPipeline.setLightEnables()"); - + GL gl = context(ctx).getGL(); - + for (int i = 0; i < maxLights; i++) { if ((enableMask & (1 << i)) != 0) { gl.glEnable(GL.GL_LIGHT0 + i); @@ -7419,13 +7419,13 @@ class JoglPipeline extends Pipeline { } } } - + // native method for setting scene ambient void setSceneAmbient(Context ctx, float red, float green, float blue) { if (VERBOSE) System.err.println("JoglPipeline.setSceneAmbient()"); - + GL gl = context(ctx).getGL(); - + float[] color = new float[4]; color[0] = red; color[1] = green; @@ -7433,21 +7433,21 @@ class JoglPipeline extends Pipeline { color[3] = 1.0f; gl.glLightModelfv(GL.GL_LIGHT_MODEL_AMBIENT, color, 0); } - + // native method for disabling fog void disableFog(Context ctx) { if (VERBOSE) System.err.println("JoglPipeline.disableFog()"); - + GL gl = context(ctx).getGL(); gl.glDisable(GL.GL_FOG); } - + // native method for disabling modelClip void disableModelClip(Context ctx) { if (VERBOSE) System.err.println("JoglPipeline.disableModelClip()"); - + GL gl = context(ctx).getGL(); - + gl.glDisable(GL.GL_CLIP_PLANE0); gl.glDisable(GL.GL_CLIP_PLANE1); gl.glDisable(GL.GL_CLIP_PLANE2); @@ -7455,15 +7455,15 @@ class JoglPipeline extends Pipeline { gl.glDisable(GL.GL_CLIP_PLANE4); gl.glDisable(GL.GL_CLIP_PLANE5); } - + // native method for setting default RenderingAttributes void resetRenderingAttributes(Context ctx, boolean depthBufferWriteEnableOverride, boolean depthBufferEnableOverride) { if (VERBOSE) System.err.println("JoglPipeline.resetRenderingAttributes()"); - + GL gl = context(ctx).getGL(); - + if (!depthBufferWriteEnableOverride) { gl.glDepthMask(true); } @@ -7475,54 +7475,54 @@ class JoglPipeline extends Pipeline { gl.glEnable(GL.GL_COLOR_MATERIAL); gl.glDisable(GL.GL_COLOR_LOGIC_OP); } - + // native method for setting default texture void resetTextureNative(Context ctx, int texUnitIndex) { if (VERBOSE) System.err.println("JoglPipeline.resetTextureNative()"); - + GL gl = context(ctx).getGL(); if (texUnitIndex >= 0 && gl.isExtensionAvailable("GL_VERSION_1_3")) { gl.glActiveTexture(texUnitIndex + GL.GL_TEXTURE0); gl.glClientActiveTexture(texUnitIndex + GL.GL_TEXTURE0); } - + gl.glDisable(GL.GL_TEXTURE_1D); gl.glDisable(GL.GL_TEXTURE_2D); gl.glDisable(GL.GL_TEXTURE_3D); gl.glDisable(GL.GL_TEXTURE_CUBE_MAP); } - + // native method for activating a particular texture unit void activeTextureUnit(Context ctx, int texUnitIndex) { if (VERBOSE) System.err.println("JoglPipeline.activeTextureUnit()"); - + GL gl = context(ctx).getGL(); if (gl.isExtensionAvailable("GL_VERSION_1_3")) { gl.glActiveTexture(texUnitIndex + GL.GL_TEXTURE0); gl.glClientActiveTexture(texUnitIndex + GL.GL_TEXTURE0); } } - + // native method for setting default TexCoordGeneration void resetTexCoordGeneration(Context ctx) { if (VERBOSE) System.err.println("JoglPipeline.resetTexCoordGeneration()"); - + GL gl = context(ctx).getGL(); gl.glDisable(GL.GL_TEXTURE_GEN_S); gl.glDisable(GL.GL_TEXTURE_GEN_T); gl.glDisable(GL.GL_TEXTURE_GEN_R); gl.glDisable(GL.GL_TEXTURE_GEN_Q); } - + // native method for setting default TextureAttributes void resetTextureAttributes(Context ctx) { if (VERBOSE) System.err.println("JoglPipeline.resetTextureAttributes()"); - + GL gl = context(ctx).getGL(); - + float[] color = new float[4]; - + gl.glPushAttrib(GL.GL_TRANSFORM_BIT); gl.glMatrixMode(GL.GL_TEXTURE); gl.glLoadIdentity(); @@ -7530,66 +7530,66 @@ class JoglPipeline extends Pipeline { gl.glTexEnvfv(GL.GL_TEXTURE_ENV, GL.GL_TEXTURE_ENV_COLOR, color, 0); gl.glTexEnvi(GL.GL_TEXTURE_ENV, GL.GL_TEXTURE_ENV_MODE, GL.GL_REPLACE); gl.glHint(GL.GL_PERSPECTIVE_CORRECTION_HINT, GL.GL_NICEST); - + if (gl.isExtensionAvailable("GL_NV_register_combiners")) { gl.glDisable(GL.GL_REGISTER_COMBINERS_NV); } - + if (gl.isExtensionAvailable("GL_SGI_texture_color_table")) { gl.glDisable(GL.GL_TEXTURE_COLOR_TABLE_SGI); } } - + // native method for setting default PolygonAttributes void resetPolygonAttributes(Context ctx) { if (VERBOSE) System.err.println("JoglPipeline.resetPolygonAttributes()"); - + GL gl = context(ctx).getGL(); - + gl.glCullFace(GL.GL_BACK); gl.glEnable(GL.GL_CULL_FACE); - + gl.glLightModeli(GL.GL_LIGHT_MODEL_TWO_SIDE, GL.GL_FALSE); - + gl.glPolygonMode(GL.GL_FRONT_AND_BACK, GL.GL_FILL); - + gl.glPolygonOffset(0.0f, 0.0f); gl.glDisable(GL.GL_POLYGON_OFFSET_POINT); gl.glDisable(GL.GL_POLYGON_OFFSET_LINE); gl.glDisable(GL.GL_POLYGON_OFFSET_FILL); } - + // native method for setting default LineAttributes void resetLineAttributes(Context ctx) { if (VERBOSE) System.err.println("JoglPipeline.resetLineAttributes()"); - + GL gl = context(ctx).getGL(); gl.glLineWidth(1.0f); gl.glDisable(GL.GL_LINE_STIPPLE); - + // XXXX: Polygon Mode check, blend enable gl.glDisable(GL.GL_LINE_SMOOTH); } - + // native method for setting default PointAttributes void resetPointAttributes(Context ctx) { if (VERBOSE) System.err.println("JoglPipeline.resetPointAttributes()"); - + GL gl = context(ctx).getGL(); gl.glPointSize(1.0f); - + // XXXX: Polygon Mode check, blend enable gl.glDisable(GL.GL_POINT_SMOOTH); } - + // native method for setting default TransparencyAttributes void resetTransparency(Context ctx, int geometryType, int polygonMode, boolean lineAA, boolean pointAA) { if (VERBOSE) System.err.println("JoglPipeline.resetTransparency()"); - + GL gl = context(ctx).getGL(); - + if (((((geometryType & RenderMolecule.LINE) != 0) || (polygonMode == PolygonAttributes.POLYGON_LINE)) && lineAA) || @@ -7603,37 +7603,37 @@ class JoglPipeline extends Pipeline { } gl.glDisable(GL.GL_POLYGON_STIPPLE); } - + // native method for setting default ColoringAttributes void resetColoringAttributes(Context ctx, float r, float g, float b, float a, boolean enableLight) { if (VERBOSE) System.err.println("JoglPipeline.resetColoringAttributes()"); - + GL gl = context(ctx).getGL(); - + if (!enableLight) { gl.glColor4f(r, g, b, a); } gl.glShadeModel(GL.GL_SMOOTH); } - + /** * This native method makes sure that the rendering for this canvas * gets done now. */ void syncRender(Context ctx, boolean wait) { if (VERBOSE) System.err.println("JoglPipeline.syncRender()"); - + GL gl = context(ctx).getGL(); - + if (wait) gl.glFinish(); else gl.glFlush(); } - + // The native method that sets this ctx to be the current one boolean useCtx(Context ctx, long display, Drawable drawable) { if (VERBOSE) System.err.println("JoglPipeline.useCtx()"); @@ -7641,7 +7641,7 @@ class JoglPipeline extends Pipeline { int res = context.makeCurrent(); return (res != GLContext.CONTEXT_NOT_CURRENT); } - + // Optionally release the context. Returns true if the context was released. boolean releaseCtx(Context ctx, long dpy) { if (VERBOSE) System.err.println("JoglPipeline.releaseCtx()"); @@ -7649,7 +7649,7 @@ class JoglPipeline extends Pipeline { context.release(); return true; } - + void clear(Context ctx, float r, float g, float b, boolean clearStencil) { if (VERBOSE) System.err.println("JoglPipeline.clear()"); @@ -7661,7 +7661,7 @@ class JoglPipeline extends Pipeline { /* gl.glClearColor(r, g, b, jctx.getAlphaClearValue()); gl.glClear(GL.GL_COLOR_BUFFER_BIT); - + // Java 3D always clears the Z-buffer gl.glPushAttrib(GL.GL_DEPTH_BUFFER_BIT); gl.glDepthMask(true); @@ -7692,23 +7692,23 @@ class JoglPipeline extends Pipeline { gl.glPushAttrib(GL.GL_DEPTH_BUFFER_BIT); } - gl.glDepthMask(true); + gl.glDepthMask(true); gl.glClearColor(r, g, b, jctx.getAlphaClearValue()); gl.glClear(clearMask); gl.glPopAttrib(); } - + void textureFillBackground(Context ctx, float texMinU, float texMaxU, float texMinV, float texMaxV, float mapMinX, float mapMaxX, float mapMinY, float mapMaxY, boolean useBilinearFilter) { if (VERBOSE) System.err.println("JoglPipeline.textureFillBackground()"); - + GLContext context = context(ctx); GL gl = context.getGL(); - + // Temporarily disable fragment and most 3D operations gl.glPushAttrib(GL.GL_ENABLE_BIT | GL.GL_TEXTURE_BIT | GL.GL_POLYGON_BIT); - + disableAttribFor2D(gl); gl.glDepthMask(false); gl.glEnable(GL.GL_TEXTURE_2D); @@ -7718,13 +7718,13 @@ class JoglPipeline extends Pipeline { // System.err.println("JoglPipeline - Background : use bilinear filter\n"); gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MIN_FILTER, GL.GL_LINEAR); gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MAG_FILTER, GL.GL_LINEAR); - } - + } + // reset the polygon mode gl.glPolygonMode(GL.GL_FRONT_AND_BACK, GL.GL_FILL); - + gl.glPixelStorei(GL.GL_UNPACK_ALIGNMENT, 1); - + // load identity modelview and projection matrix gl.glMatrixMode(GL.GL_PROJECTION); gl.glLoadIdentity(); @@ -7734,36 +7734,36 @@ class JoglPipeline extends Pipeline { gl.glMatrixMode(GL.GL_TEXTURE); gl.glPushMatrix(); gl.glLoadIdentity(); - + gl.glBegin(GL.GL_QUADS); gl.glTexCoord2f(texMinU, texMinV); gl.glVertex2f(mapMinX,mapMinY); gl.glTexCoord2f(texMaxU, texMinV); gl.glVertex2f(mapMaxX,mapMinY); gl.glTexCoord2f(texMaxU, texMaxV); gl.glVertex2f(mapMaxX,mapMaxY); gl.glTexCoord2f(texMinU, texMaxV); gl.glVertex2f(mapMinX,mapMaxY); gl.glEnd(); - + // Restore texture Matrix transform gl.glPopMatrix(); - + gl.glMatrixMode(GL.GL_MODELVIEW); // Restore attributes gl.glPopAttrib(); - + } - + void textureFillRaster(Context ctx, float texMinU, float texMaxU, float texMinV, float texMaxV, - float mapMinX, float mapMaxX, float mapMinY, float mapMaxY, float mapZ, float alpha, + float mapMinX, float mapMaxX, float mapMinY, float mapMaxY, float mapZ, float alpha, boolean useBilinearFilter) { - + if (VERBOSE) System.err.println("JoglPipeline.textureFillRaster()"); - + GLContext context = context(ctx); GL gl = context.getGL(); - + // Temporarily disable fragment and most 3D operations - gl.glPushAttrib(GL.GL_ENABLE_BIT | GL.GL_TEXTURE_BIT | GL.GL_POLYGON_BIT | + gl.glPushAttrib(GL.GL_ENABLE_BIT | GL.GL_TEXTURE_BIT | GL.GL_POLYGON_BIT | GL.GL_CURRENT_BIT ); - + disableAttribForRaster(gl); /* Setup filter mode if needed */ @@ -7771,16 +7771,16 @@ class JoglPipeline extends Pipeline { // System.err.println("JoglPipeline - Raster : use bilinear filter\n"); gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MIN_FILTER, GL.GL_LINEAR); gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MAG_FILTER, GL.GL_LINEAR); - } - + } + gl.glTexEnvi(GL.GL_TEXTURE_ENV, GL.GL_TEXTURE_ENV_MODE, GL.GL_MODULATE); gl.glColor4f(1.0f, 1.0f, 1.0f, alpha); - + // reset the polygon mode gl.glPolygonMode(GL.GL_FRONT_AND_BACK, GL.GL_FILL); - + gl.glPixelStorei(GL.GL_UNPACK_ALIGNMENT, 1); - + // load identity modelview and projection matrix gl.glMatrixMode(GL.GL_MODELVIEW); gl.glPushMatrix(); @@ -7789,7 +7789,7 @@ class JoglPipeline extends Pipeline { gl.glPushMatrix(); gl.glLoadIdentity(); gl.glOrtho(0.0, 1.0, 0.0, 1.0, 0.0, 1.0); - + gl.glBegin(GL.GL_QUADS); gl.glTexCoord2f(texMinU, texMinV); gl.glVertex3f(mapMinX,mapMinY, mapZ); gl.glTexCoord2f(texMaxU, texMinV); gl.glVertex3f(mapMaxX,mapMinY, mapZ); @@ -7798,12 +7798,12 @@ class JoglPipeline extends Pipeline { gl.glEnd(); // Restore matrices - gl.glPopMatrix(); + gl.glPopMatrix(); gl.glMatrixMode(GL.GL_MODELVIEW); - gl.glPopMatrix(); + gl.glPopMatrix(); // Restore attributes gl.glPopAttrib(); - + } void executeRasterDepth(Context ctx, float posX, float posY, float posZ, @@ -7867,15 +7867,15 @@ class JoglPipeline extends Pipeline { gl.glPixelStorei(GL.GL_UNPACK_SKIP_ROWS, 0); } - + // The native method for setting the ModelView matrix. void setModelViewMatrix(Context ctx, double[] viewMatrix, double[] modelMatrix) { if (VERBOSE) System.err.println("JoglPipeline.setModelViewMatrix()"); GLContext context = context(ctx); GL gl = context.getGL(); - + gl.glMatrixMode(GL.GL_MODELVIEW); - + if (gl.isExtensionAvailable("GL_VERSION_1_3")) { gl.glLoadTransposeMatrixd(viewMatrix, 0); gl.glMultTransposeMatrixd(modelMatrix, 0); @@ -7888,15 +7888,15 @@ class JoglPipeline extends Pipeline { gl.glMultMatrixd(m, 0); } } - + // The native method for setting the Projection matrix. void setProjectionMatrix(Context ctx, double[] projMatrix) { if (VERBOSE) System.err.println("JoglPipeline.setProjectionMatrix()"); GLContext context = context(ctx); GL gl = context.getGL(); - + gl.glMatrixMode(GL.GL_PROJECTION); - + if (gl.isExtensionAvailable("GL_VERSION_1_3")) { // Invert the Z value in clipping coordinates because OpenGL uses // left-handed clipping coordinates, while Java3D defines right-handed @@ -7923,31 +7923,31 @@ class JoglPipeline extends Pipeline { gl.glLoadMatrixd(p, 0); } } - + // The native method for setting the Viewport. void setViewport(Context ctx, int x, int y, int width, int height) { if (VERBOSE) System.err.println("JoglPipeline.setViewport()"); GL gl = context(ctx).getGL(); gl.glViewport(x, y, width, height); } - + // used for display Lists void newDisplayList(Context ctx, int displayListId) { if (VERBOSE) System.err.println("JoglPipeline.newDisplayList()"); if (displayListId <= 0) { System.err.println("JAVA 3D ERROR : glNewList(" + displayListId + ") -- IGNORED"); } - + GL gl = context(ctx).getGL(); gl.glNewList(displayListId, GL.GL_COMPILE); } - + void endDisplayList(Context ctx) { if (VERBOSE) System.err.println("JoglPipeline.endDisplayList()"); GL gl = context(ctx).getGL(); gl.glEndList(); } - + int numInvalidLists = 0; void callDisplayList(Context ctx, int id, boolean isNonUniformScale) { if (VERBOSE) System.err.println("JoglPipeline.callDisplayList()"); @@ -7961,35 +7961,35 @@ class JoglPipeline extends Pipeline { } return; } - + GL gl = context(ctx).getGL(); // Set normalization if non-uniform scale if (isNonUniformScale) { gl.glEnable(GL.GL_NORMALIZE); } - + gl.glCallList(id); - + // Turn normalization back off if (isNonUniformScale) { gl.glDisable(GL.GL_NORMALIZE); } } - + void freeDisplayList(Context ctx, int id) { if (VERBOSE) System.err.println("JoglPipeline.freeDisplayList()"); if (id <= 0) { System.err.println("JAVA 3D ERROR : glDeleteLists(" + id + ",1) -- IGNORED"); } - + GL gl = context(ctx).getGL(); gl.glDeleteLists(id, 1); } void freeTexture(Context ctx, int id) { if (VERBOSE) System.err.println("JoglPipeline.freeTexture()"); - + GL gl = context(ctx).getGL(); - + if (id > 0) { int[] tmp = new int[1]; tmp[0] = id; @@ -7998,8 +7998,8 @@ class JoglPipeline extends Pipeline { System.err.println("tried to delete tex with texid <= 0"); } } - - + + void texturemapping(Context ctx, int px, int py, int minX, int minY, int maxX, int maxY, @@ -8009,18 +8009,18 @@ class JoglPipeline extends Pipeline { byte[] imageYdown, int winWidth, int winHeight) { if (VERBOSE) System.err.println("JoglPipeline.texturemapping()"); - + GL gl = context(ctx).getGL(); - + int glType = GL.GL_RGBA; - + // Temporarily disable fragment and most 3D operations gl.glPushAttrib(GL.GL_ENABLE_BIT | GL.GL_TEXTURE_BIT | GL.GL_DEPTH_BUFFER_BIT | GL.GL_POLYGON_BIT); disableAttribFor2D(gl); - + // Reset the polygon mode gl.glPolygonMode(GL.GL_FRONT_AND_BACK, GL.GL_FILL); - + gl.glDepthMask(false); gl.glPixelStorei(GL.GL_UNPACK_ALIGNMENT, 1); gl.glBindTexture(GL.GL_TEXTURE_2D, objectId); @@ -8029,22 +8029,22 @@ class JoglPipeline extends Pipeline { gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MIN_FILTER, GL.GL_NEAREST); gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_WRAP_S, GL.GL_REPEAT); gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_WRAP_T, GL.GL_REPEAT); - + gl.glTexEnvf(GL.GL_TEXTURE_ENV, GL.GL_TEXTURE_ENV_MODE, GL.GL_REPLACE); gl.glEnable(GL.GL_BLEND); gl.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA); - + gl.glEnable(GL.GL_TEXTURE_2D); - + // loaded identity modelview and projection matrix gl.glMatrixMode(GL.GL_PROJECTION); gl.glLoadIdentity(); - + gl.glOrtho(0.0, winWidth, 0.0, winHeight, 0.0, 0.0); - + gl.glMatrixMode(GL.GL_MODELVIEW); gl.glLoadIdentity(); - + if (gl.isExtensionAvailable("GL_EXT_abgr")) { glType = GL.GL_ABGR_EXT; } else { @@ -8067,62 +8067,62 @@ class JoglPipeline extends Pipeline { gl.glPixelStorei(GL.GL_UNPACK_ROW_LENGTH, 0); gl.glPixelStorei(GL.GL_UNPACK_SKIP_PIXELS, 0); gl.glPixelStorei(GL.GL_UNPACK_SKIP_ROWS, 0); - + float texMinU = (float) minX/ (float) texWidth; float texMinV = (float) minY/ (float) texHeight; float texMaxU = (float) maxX/ (float) texWidth; float texMaxV = (float) maxY/ (float) texHeight; float halfWidth = (float)winWidth/2.0f; float halfHeight = (float)winHeight/2.0f; - + float mapMinX = (float) (((px + minX)- halfWidth)/halfWidth); float mapMinY = (float) ((halfHeight - (py + maxY))/halfHeight); float mapMaxX = (float) ((px + maxX - halfWidth)/halfWidth); float mapMaxY = (float) ((halfHeight - (py + minY))/halfHeight); - + gl.glBegin(GL.GL_QUADS); - + gl.glTexCoord2f(texMinU, texMaxV); gl.glVertex2f(mapMinX,mapMinY); gl.glTexCoord2f(texMaxU, texMaxV); gl.glVertex2f(mapMaxX,mapMinY); gl.glTexCoord2f(texMaxU, texMinV); gl.glVertex2f(mapMaxX,mapMaxY); gl.glTexCoord2f(texMinU, texMinV); gl.glVertex2f(mapMinX,mapMaxY); gl.glEnd(); - + // Java 3D always clears the Z-buffer gl.glDepthMask(true); gl.glClear(GL.GL_DEPTH_BUFFER_BIT); gl.glPopAttrib(); } - + boolean initTexturemapping(Context ctx, int texWidth, int texHeight, int objectId) { if (VERBOSE) System.err.println("JoglPipeline.initTexturemapping()"); - + GL gl = context(ctx).getGL(); - + int glType = (gl.isExtensionAvailable("GL_EXT_abgr") ? GL.GL_ABGR_EXT : GL.GL_RGBA); - + gl.glBindTexture(GL.GL_TEXTURE_2D, objectId); - + gl.glTexImage2D(GL.GL_PROXY_TEXTURE_2D, 0, GL.GL_RGBA, texWidth, texHeight, 0, glType, GL.GL_UNSIGNED_BYTE, null); - + int[] width = new int[1]; gl.glGetTexLevelParameteriv(GL.GL_PROXY_TEXTURE_2D, 0, GL.GL_TEXTURE_WIDTH, width, 0); - + if (width[0] <= 0) { return false; } - + // init texture size only without filling the pixels gl.glTexImage2D(GL.GL_TEXTURE_2D, 0, GL.GL_RGBA, texWidth, texHeight, 0, glType, GL.GL_UNSIGNED_BYTE, null); - + return true; } - - + + // Set internal render mode to one of FIELD_ALL, FIELD_LEFT or // FIELD_RIGHT. Note that it is up to the caller to ensure that // stereo is available before setting the mode to FIELD_LEFT or @@ -8130,7 +8130,7 @@ class JoglPipeline extends Pipeline { // foe single buffering. void setRenderMode(Context ctx, int mode, boolean doubleBuffer) { if (VERBOSE) System.err.println("JoglPipeline.setRenderMode()"); - + GL gl = context(ctx).getGL(); int drawBuf = 0; if (doubleBuffer) { @@ -8160,14 +8160,14 @@ class JoglPipeline extends Pipeline { break; } } - + gl.glDrawBuffer(drawBuf); } - + // Set glDepthMask. void setDepthBufferWriteEnable(Context ctx, boolean mode) { if (VERBOSE) System.err.println("JoglPipeline.setDepthBufferWriteEnable()"); - + GL gl = context(ctx).getGL(); if (mode) { gl.glDepthMask(true); @@ -8175,11 +8175,11 @@ class JoglPipeline extends Pipeline { gl.glDepthMask(false); } } - + //---------------------------------------------------------------------- // Helper private functions for Canvas3D // - + private boolean getPropertiesFromCurrentContext(JoglContext ctx) { GL gl = GLU.getCurrentGL(); // FIXME: this is a heavily abridged set of the stuff in Canvas3D.c; @@ -8198,12 +8198,12 @@ class JoglPipeline extends Pipeline { } return true; } - + private int[] extractVersionInfo(String versionString) { StringTokenizer tok = new StringTokenizer(versionString, ". "); int major = Integer.valueOf(tok.nextToken()).intValue(); int minor = Integer.valueOf(tok.nextToken()).intValue(); - + // See if there's vendor-specific information which might // imply a more recent OpenGL version tok = new StringTokenizer(versionString, " "); @@ -8226,12 +8226,12 @@ class JoglPipeline extends Pipeline { } return new int[] { major, minor }; } - + private int getTextureColorTableSize(GL gl) { if (!gl.isExtensionAvailable("GL_ARB_imaging")) { return 0; } - + gl.glColorTable(GL.GL_PROXY_TEXTURE_COLOR_TABLE_SGI, GL.GL_RGBA, 256, GL.GL_RGB, GL.GL_INT, null); int[] tmp = new int[1]; @@ -8239,8 +8239,8 @@ class JoglPipeline extends Pipeline { GL.GL_COLOR_TABLE_WIDTH, tmp, 0); return tmp[0]; } - - + + private void checkTextureExtensions(Canvas3D cv, JoglContext ctx, GL gl, @@ -8257,11 +8257,11 @@ class JoglPipeline extends Pipeline { cv.maxTexCoordSets = tmp[0]; } } - + if (gl.isExtensionAvailable("GL_SGI_texture_color_table") || gl.isExtensionAvailable("GL_ARB_imaging")) { cv.textureExtendedFeatures |= Canvas3D.TEXTURE_COLOR_TABLE; - + // get texture color table size // need to check later cv.textureColorTableSize = getTextureColorTableSize(gl); @@ -8272,62 +8272,62 @@ class JoglPipeline extends Pipeline { cv.textureColorTableSize = 256; } } - + if (gl.isExtensionAvailable("GL_ARB_texture_env_combine")) { cv.textureExtendedFeatures |= Canvas3D.TEXTURE_COMBINE; cv.textureExtendedFeatures |= Canvas3D.TEXTURE_COMBINE_SUBTRACT; } else if (gl.isExtensionAvailable("GL_EXT_texture_env_combine")) { cv.textureExtendedFeatures |= Canvas3D.TEXTURE_COMBINE; } - + if (gl.isExtensionAvailable("GL_NV_register_combiners")) { cv.textureExtendedFeatures |= Canvas3D.TEXTURE_REGISTER_COMBINERS; } - + if (gl.isExtensionAvailable("GL_ARB_texture_env_dot3") || gl.isExtensionAvailable("GL_EXT_texture_env_dot3")) { cv.textureExtendedFeatures |= Canvas3D.TEXTURE_COMBINE_DOT3; } - + if (gl13) { cv.textureExtendedFeatures |= Canvas3D.TEXTURE_CUBE_MAP; } - + if (gl.isExtensionAvailable("GL_SGIS_sharpen_texture")) { cv.textureExtendedFeatures |= Canvas3D.TEXTURE_SHARPEN; } - + if (gl.isExtensionAvailable("GL_SGIS_detail_texture")) { cv.textureExtendedFeatures |= Canvas3D.TEXTURE_DETAIL; } - + if (gl.isExtensionAvailable("GL_SGIS_texture_filter4")) { cv.textureExtendedFeatures |= Canvas3D.TEXTURE_FILTER4; } - + if (gl.isExtensionAvailable("GL_EXT_texture_filter_anisotropic")) { cv.textureExtendedFeatures |= Canvas3D.TEXTURE_ANISOTROPIC_FILTER; float[] tmp = new float[1]; gl.glGetFloatv(GL. GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, tmp, 0); cv.anisotropicDegreeMax = tmp[0]; } - + if (gl.isExtensionAvailable("GL_SGIX_texture_lod_bias")) { cv.textureExtendedFeatures |= Canvas3D.TEXTURE_LOD_OFFSET; } - + if (!VirtualUniverse.mc.enforcePowerOfTwo && gl.isExtensionAvailable("GL_ARB_texture_non_power_of_two")) { cv.textureExtendedFeatures |= Canvas3D.TEXTURE_NON_POWER_OF_TWO; } - + if (gl.isExtensionAvailable("GL_SGIS_generate_mipmap")) { cv.textureExtendedFeatures |= Canvas3D.TEXTURE_AUTO_MIPMAP_GENERATION; - } - + } + } - - + + private void checkGLSLShaderExtensions(Canvas3D cv, JoglContext ctx, GL gl, @@ -8337,7 +8337,7 @@ class JoglPipeline extends Pipeline { gl.isExtensionAvailable("GL_ARB_shading_language_100")) { // Initialize shader vertex attribute function pointers ctx.initGLSLVertexAttributeImpl(); - + // FIXME: this isn't complete and would need to set up the // JoglContext for dispatch of various routines such as those // related to vertex attributes @@ -8360,10 +8360,10 @@ class JoglPipeline extends Pipeline { cv.shadingLanguageGLSL = true; } } - + private boolean createCgContext(JoglContext ctx) { CGcontext cgContext = CgGL.cgCreateContext(); - + int err = CgGL.cgGetError(); if (err != 0) { String detail = CgGL.cgGetErrorString(err); @@ -8371,14 +8371,14 @@ class JoglPipeline extends Pipeline { detail + "\""); return false; } - + if (cgContext == null) { System.err.println("JAVA 3D ERROR : Invalid null Cg context"); return false; } - + ctx.setCgContext(cgContext); - + // Use GL_ARB_vertex_program extension if supported by video card if (CgGL.cgGLIsProfileSupported(CgGL.CG_PROFILE_ARBVP1)) { ctx.setCgVertexProfile(CgGL.CG_PROFILE_ARBVP1); @@ -8389,7 +8389,7 @@ class JoglPipeline extends Pipeline { ctx.setCgContext(null); return false; } - + // Use GL_ARB_fragment_program extension if supported by video card if (CgGL.cgGLIsProfileSupported(CgGL.CG_PROFILE_ARBFP1)) { ctx.setCgFragmentProfile(CgGL.CG_PROFILE_ARBFP1); @@ -8400,10 +8400,10 @@ class JoglPipeline extends Pipeline { ctx.setCgContext(null); return false; } - + return true; } - + private void checkCgShaderExtensions(Canvas3D cv, JoglContext ctx, GL gl, @@ -8423,7 +8423,7 @@ class JoglPipeline extends Pipeline { ctx.initCgVertexAttributeImpl(); } } - + private void setupCanvasProperties(Canvas3D cv, JoglContext ctx, GL gl, @@ -8431,7 +8431,7 @@ class JoglPipeline extends Pipeline { boolean cgLibraryAvailable) { // Note: this includes relevant portions from both the // NativePipeline's getPropertiesFromCurrentContext and setupCanvasProperties - + // Reset all fields cv.multiTexAccelerated = false; cv.maxTextureUnits = 1; @@ -8452,7 +8452,7 @@ class JoglPipeline extends Pipeline { cv.texture3DDepthMax = 0; cv.shadingLanguageGLSL = false; cv.shadingLanguageCg = false; - + // Now make queries and set up these fields String glVersion = gl.glGetString(GL.GL_VERSION); String glVendor = gl.glGetString(GL.GL_VENDOR); @@ -8460,15 +8460,15 @@ class JoglPipeline extends Pipeline { cv.nativeGraphicsVersion = glVersion; cv.nativeGraphicsVendor = glVendor; cv.nativeGraphicsRenderer = glRenderer; - + // find out the version, major and minor version number int[] versionNumbers = extractVersionInfo(glVersion); int major = versionNumbers[0]; int minor = versionNumbers[1]; - + /////////////////////////////////////////// // setup the graphics context properties // - + // NOTE: Java 3D now requires OpenGL 1.3 for full functionality. // For backwards compatibility with certain older graphics cards and // drivers (e.g., the Linux DRI driver for older ATI cards), @@ -8476,21 +8476,21 @@ class JoglPipeline extends Pipeline { // we will not attempt to use OpenGL extensions for any features that // are available in OpenGL 1.3, specifically multitexture, multisample, // and cube map textures. - + if (major < 1 || (major == 1 && minor < 2)) { throw new IllegalRenderingStateException( "Java 3D ERROR : OpenGL 1.2 or better is required (GL_VERSION=" + major + "." + minor + ")"); } - + boolean gl20 = false; boolean gl14 = false; boolean gl13 = false; - + if (major == 1) { if (minor == 2) { System.err.println("JAVA 3D: OpenGL 1.2 detected; will run with reduced functionality"); - } + } if (minor >= 3) { gl13 = true; } @@ -8508,27 +8508,27 @@ class JoglPipeline extends Pipeline { assert gl14; assert gl.isExtensionAvailable("GL_VERSION_2_0"); } - + if (gl14) { assert gl13; assert gl.isExtensionAvailable("GL_VERSION_1_4"); } - + if (gl13) { assert gl.isExtensionAvailable("GL_VERSION_1_3"); } - + // Set up properties for OpenGL 1.3 cv.textureExtendedFeatures |= Canvas3D.TEXTURE_3D; - + // Note that we don't query for GL_ARB_imaging here - + cv.textureExtendedFeatures |= Canvas3D.TEXTURE_LOD_RANGE; if (gl14) { cv.textureExtendedFeatures |= Canvas3D.TEXTURE_AUTO_MIPMAP_GENERATION; } - + // look for OpenGL 2.0 features // Fix to Issue 455 : Need to disable NPOT textures for older cards that claim to support it. // Some older cards (e.g., Nvidia fx500 and ATI 9800) claim to support OpenGL 2.0. @@ -8541,31 +8541,31 @@ class JoglPipeline extends Pipeline { // cv.textureExtendedFeatures |= Canvas3D.TEXTURE_NON_POWER_OF_TWO; // } // } - - + + // Setup GL_EXT_abgr if (gl.isExtensionAvailable("GL_EXT_abgr")) { cv.extensionsSupported |= Canvas3D.EXT_ABGR; } - + // GL_BGR is always supported cv.extensionsSupported |= Canvas3D.EXT_BGR; - + // Setup multisample // FIXME: this is not correct for the Windows platform yet if (gl13) { cv.extensionsSupported |= Canvas3D.MULTISAMPLE; ctx.setHasMultisample(true); } - + if ((cv.extensionsSupported & Canvas3D.MULTISAMPLE) != 0 && !VirtualUniverse.mc.implicitAntialiasing) { gl.glDisable(GL.GL_MULTISAMPLE); } - + // Check texture extensions checkTextureExtensions(cv, ctx, gl, gl13); - + // Check shader extensions if (gl13) { checkGLSLShaderExtensions(cv, ctx, gl, glslLibraryAvailable); @@ -8575,19 +8575,19 @@ class JoglPipeline extends Pipeline { checkGLSLShaderExtensions(cv, ctx, gl, false); checkCgShaderExtensions(cv, ctx, gl, false); } - + // Setup GL_SUN_gloabl_alpha if (gl.isExtensionAvailable("GL_SUN_gloabl_alpha")) { cv.extensionsSupported |= Canvas3D.SUN_GLOBAL_ALPHA; } - + cv.textureBoundaryWidthMax = 1; { int[] tmp = new int[1]; gl.glGetIntegerv(GL.GL_MAX_TEXTURE_SIZE, tmp, 0); cv.textureWidthMax = tmp[0]; cv.textureHeightMax = tmp[0]; - + tmp[0] = -1; gl.glGetIntegerv(GL.GL_MAX_3D_TEXTURE_SIZE, tmp, 0); cv.texture3DWidthMax = tmp[0]; @@ -8595,7 +8595,7 @@ class JoglPipeline extends Pipeline { cv.texture3DDepthMax = tmp[0]; } } - + /* * Function to disable most rendering attributes when doing a 2D * clear, image copy, or image composite operation. Note that the @@ -8619,47 +8619,47 @@ class JoglPipeline extends Pipeline { gl.glDisable(GL.GL_TEXTURE_GEN_R); gl.glDisable(GL.GL_TEXTURE_GEN_S); gl.glDisable(GL.GL_TEXTURE_GEN_T); - - + + for (int i = 0; i < 6; i++) { gl.glDisable(GL.GL_CLIP_PLANE0 + i); } - + gl.glDisable(GL.GL_TEXTURE_3D); gl.glDisable(GL.GL_TEXTURE_CUBE_MAP); - + if (gl.isExtensionAvailable("GL_NV_register_combiners")) { gl.glDisable(GL.GL_REGISTER_COMBINERS_NV); } - + if (gl.isExtensionAvailable("GL_SGI_texture_color_table")) { gl.glDisable(GL.GL_TEXTURE_COLOR_TABLE_SGI); } - + if (gl.isExtensionAvailable("GL_SUN_global_alpha")) { gl.glDisable(GL.GL_GLOBAL_ALPHA_SUN); } - + } - + private void disableAttribForRaster(GL gl) { - + gl.glDisable(GL.GL_COLOR_MATERIAL); gl.glDisable(GL.GL_CULL_FACE); gl.glDisable(GL.GL_LIGHTING); gl.glDisable(GL.GL_POLYGON_OFFSET_FILL); gl.glDisable(GL.GL_POLYGON_STIPPLE); - + // TODO: Disable if Raster.CLIP_POSITION is true // for (int i = 0; i < 6; i++) { // gl.glDisable(GL.GL_CLIP_PLANE0 + i); // } - + if (gl.isExtensionAvailable("GL_SUN_global_alpha")) { gl.glDisable(GL.GL_GLOBAL_ALPHA_SUN); } } - + private void copyTranspose(double[] src, double[] dst) { dst[0] = src[0]; dst[1] = src[4]; @@ -8678,14 +8678,14 @@ class JoglPipeline extends Pipeline { dst[14] = src[11]; dst[15] = src[15]; } - + // --------------------------------------------------------------------- - + // // Canvas3D / GraphicsConfigTemplate3D methods - logic dealing with // native graphics configuration or drawing surface // - + // Return a graphics config based on the one passed in. Note that we can // assert that the input config is non-null and was created from a // GraphicsConfigTemplate3D. @@ -8698,7 +8698,7 @@ class JoglPipeline extends Pipeline { if (config.getChosenIndex() >= 0) { indexChooser = new IndexCapabilitiesChooser(config.getChosenIndex()); } - + AbstractGraphicsConfiguration absConfig = GLDrawableFactory.getFactory().chooseGraphicsConfiguration(config.getGLCapabilities(), indexChooser, @@ -8707,9 +8707,9 @@ class JoglPipeline extends Pipeline { return null; } return ((AWTGraphicsConfiguration) absConfig).getGraphicsConfiguration(); - + /* - + System.err.println("JoglPipeline.getGraphicsConfig()"); // Just return the input graphics config for now. eventually, we will // use the input graphics config to get the GraphicsConfigTemplate3D @@ -8717,18 +8717,18 @@ class JoglPipeline extends Pipeline { return gconfig; */ } - + // Get the native FBconfig pointer long getFbConfig(GraphicsConfigInfo gcInfo) { if (VERBOSE) System.err.println("JoglPipeline.getFbConfig()"); return 0L; // Dummy method in JOGL } - - + + private static final int DISABLE_STEREO = 1; private static final int DISABLE_AA = 2; private static final int DISABLE_DOUBLE_BUFFER = 3; - + // Get best graphics config from pipeline GraphicsConfiguration getBestConfiguration(GraphicsConfigTemplate3D gct, GraphicsConfiguration[] gc) { @@ -8742,7 +8742,7 @@ class JoglPipeline extends Pipeline { System.err.println("gct.getBlueSize(): " + gct.getBlueSize()); System.err.println("gct.getSceneAntialiasing(): " + gct.getSceneAntialiasing()); */ - + // Create a GLCapabilities based on the GraphicsConfigTemplate3D GLCapabilities caps = new GLCapabilities(); caps.setDoubleBuffered(gct.getDoubleBuffer() <= GraphicsConfigTemplate.PREFERRED); @@ -8756,12 +8756,12 @@ class JoglPipeline extends Pipeline { // FIXME: should be smarter about choosing the number of samples // (Java3D's native code has a loop trying 8, 6, 4, 3, and 2 samples) caps.setNumSamples(4); - + // Issue 399: Request alpha buffer if transparentOffScreen is set if (VirtualUniverse.mc.transparentOffScreen) { caps.setAlphaBits(1); } - + java.util.List<Integer> capsToDisable = new ArrayList<Integer>(); // Add PREFERRED capabilities in order we will try disabling them if (gct.getStereo() == GraphicsConfigTemplate.PREFERRED) { @@ -8773,12 +8773,12 @@ class JoglPipeline extends Pipeline { if (gct.getDoubleBuffer() == GraphicsConfigTemplate.PREFERRED) { capsToDisable.add(new Integer(DISABLE_DOUBLE_BUFFER)); } - + // Pick the GraphicsDevice from a random configuration GraphicsDevice dev = gc[0].getDevice(); - + // Create a Frame and dummy GLCanvas to perform eager pixel format selection - + // Note that we loop in similar fashion to the NativePipeline's // native code in the situation where we need to disable certain // capabilities which aren't required @@ -8822,15 +8822,15 @@ class JoglPipeline extends Pipeline { case DISABLE_STEREO: caps.setStereo(false); break; - + case DISABLE_AA: caps.setSampleBuffers(false); break; - + case DISABLE_DOUBLE_BUFFER: caps.setDoubleBuffered(false); break; - + default: throw new AssertionError("missing case statement"); } @@ -8853,16 +8853,16 @@ class JoglPipeline extends Pipeline { } chosenCaps = capturer.getCapabilities(); } - + JoglGraphicsConfiguration config = new JoglGraphicsConfiguration(chosenCaps, chosenIndex, dev); - + // FIXME: because of the fact that JoglGraphicsConfiguration // doesn't override hashCode() or equals(), we will basically be // creating a new one each time getBestConfiguration() is // called; in theory, we should probably map the same // GLCapabilities on the same GraphicsDevice to the same // JoglGraphicsConfiguration object - + // Cache the GraphicsTemplate3D synchronized (Canvas3D.graphicsConfigTable) { GraphicsConfigInfo gcInfo = new GraphicsConfigInfo(gct); @@ -8870,18 +8870,18 @@ class JoglPipeline extends Pipeline { // gcInfo.setPrivateData(privateData); Canvas3D.graphicsConfigTable.put(config, gcInfo); } - + return config; - + /* - + // TODO: implement this - + // TODO: construct a unique GraphicsConfiguration object that will be // used the key in the hashmap so we can lookup the GraphicsTemplate3D GraphicsConfiguration gc1 = GraphicsEnvironment.getLocalGraphicsEnvironment(). getDefaultScreenDevice().getDefaultConfiguration(); - + // Cache the GraphicsTemplate3D synchronized (Canvas3D.graphicsConfigTable) { if (Canvas3D.graphicsConfigTable.get(gc1) == null) { @@ -8891,15 +8891,15 @@ class JoglPipeline extends Pipeline { } } return gc1; - + */ } - + // Determine whether specified graphics config is supported by pipeline boolean isGraphicsConfigSupported(GraphicsConfigTemplate3D gct, GraphicsConfiguration gc) { if (VERBOSE) System.err.println("JoglPipeline.isGraphicsConfigSupported()"); - + // FIXME: it looks like this method is implemented incorrectly // in the existing NativePipeline in both the Windows and X11 // ports. According to the semantics of the javadoc, it looks @@ -8918,33 +8918,33 @@ class JoglPipeline extends Pipeline { // without breaking anything. return true; } - + // Methods to get actual capabilities from Canvas3D boolean hasDoubleBuffer(Canvas3D cv) { if (VERBOSE) System.err.println("JoglPipeline.hasDoubleBuffer()"); if (VERBOSE) System.err.println(" Returning " + caps(cv).getDoubleBuffered()); return caps(cv).getDoubleBuffered(); } - + boolean hasStereo(Canvas3D cv) { if (VERBOSE) System.err.println("JoglPipeline.hasStereo()"); if (VERBOSE) System.err.println(" Returning " + caps(cv).getStereo()); return caps(cv).getStereo(); } - + int getStencilSize(Canvas3D cv) { if (VERBOSE) System.err.println("JoglPipeline.getStencilSize()"); if (VERBOSE) System.err.println(" Returning " + caps(cv).getStencilBits()); return caps(cv).getStencilBits(); } - + boolean hasSceneAntialiasingMultisample(Canvas3D cv) { if (VERBOSE) System.err.println("JoglPipeline.hasSceneAntialiasingMultisample()"); if (VERBOSE) System.err.println(" Returning " + caps(cv).getSampleBuffers()); - + return caps(cv).getSampleBuffers(); } - + boolean hasSceneAntialiasingAccum(Canvas3D cv) { if (VERBOSE) System.err.println("JoglPipeline.hasSceneAntialiasingAccum()"); GLCapabilities caps = caps(cv); @@ -8955,18 +8955,18 @@ class JoglPipeline extends Pipeline { caps.getAccumGreenBits() > 0 && caps.getAccumBlueBits() > 0); } - + // Methods to get native WS display and screen long getDisplay() { if (VERBOSE) System.err.println("JoglPipeline.getDisplay()"); return 0L; // Dummy method in JOGL } - + private boolean checkedForGetScreenMethod = false; private Method getScreenMethod = null; int getScreen(final GraphicsDevice graphicsDevice) { if (VERBOSE) System.err.println("JoglPipeline.getScreen()"); - + if (!checkedForGetScreenMethod) { // All of the Sun GraphicsDevice implementations have a method // int getScreen(); @@ -8983,7 +8983,7 @@ class JoglPipeline extends Pipeline { } }); } - + if (getScreenMethod != null) { try { return ((Integer) getScreenMethod.invoke(graphicsDevice, (Object[]) null)).intValue(); @@ -8991,18 +8991,18 @@ class JoglPipeline extends Pipeline { throw new RuntimeException(e); } } - + return 0; } - + //---------------------------------------------------------------------- // Helper classes and methods to support query context functionality // and pixel format selection - + interface ExtendedCapabilitiesChooser extends GLCapabilitiesChooser { public void init(GLContext context); } - + // Canvas subclass to help with various query operations such as the // "query context" mechanism and pixel format selection. // Must defeat and simplify the single-threading behavior of JOGL's @@ -9013,7 +9013,7 @@ class JoglPipeline extends Pipeline { private GLDrawable drawable; private ExtendedCapabilitiesChooser chooser; private boolean alreadyRan; - + public QueryCanvas(GLCapabilities capabilities, ExtendedCapabilitiesChooser chooser, GraphicsDevice device) { @@ -9033,12 +9033,12 @@ class JoglPipeline extends Pipeline { drawable = GLDrawableFactory.getFactory().getGLDrawable(this, capabilities, chooser); this.chooser = chooser; } - + public void addNotify() { super.addNotify(); drawable.setRealized(true); } - + // It seems that at least on Mac OS X we need to do the OpenGL // context-related work outside of the addNotify call because the // Canvas hasn't been resized to a non-zero size by that point @@ -9058,33 +9058,33 @@ class JoglPipeline extends Pipeline { alreadyRan = true; } } - + private static GraphicsConfiguration unwrap(AWTGraphicsConfiguration config) { if (config == null) { return null; } return config.getGraphicsConfiguration(); } - + // Used in conjunction with IndexCapabilitiesChooser in pixel format // selection -- see getBestConfiguration class CapabilitiesCapturer extends DefaultGLCapabilitiesChooser implements ExtendedCapabilitiesChooser { private boolean done; private GLCapabilities capabilities; private int chosenIndex = -1; - + public boolean done() { return done; } - + public GLCapabilities getCapabilities() { return capabilities; } - + public int getChosenIndex() { return chosenIndex; } - + public int chooseCapabilities(GLCapabilities desired, GLCapabilities[] available, int windowSystemRecommendedChoice) { @@ -9094,26 +9094,26 @@ class JoglPipeline extends Pipeline { markDone(); return res; } - + public void init(GLContext context) { // Avoid hanging things up for several seconds kick(); } - + private void markDone() { synchronized (this) { done = true; notifyAll(); } } - + private void kick() { synchronized (this) { notifyAll(); } } } - + // Used to support the query context mechanism -- needs to be more // than just a GLCapabilitiesChooser class ContextQuerier extends DefaultGLCapabilitiesChooser implements ExtendedCapabilitiesChooser { @@ -9121,7 +9121,7 @@ class JoglPipeline extends Pipeline { private boolean glslLibraryAvailable; private boolean cgLibraryAvailable; private boolean done; - + public ContextQuerier(Canvas3D canvas, boolean glslLibraryAvailable, boolean cgLibraryAvailable) { @@ -9129,11 +9129,11 @@ class JoglPipeline extends Pipeline { this.glslLibraryAvailable = glslLibraryAvailable; this.cgLibraryAvailable = cgLibraryAvailable; } - + public boolean done() { return done; } - + public void init(GLContext context) { // This is basically a temporary JoglContext jctx = new JoglContext(context); @@ -9145,7 +9145,7 @@ class JoglPipeline extends Pipeline { } markDone(); } - + private void markDone() { synchronized (this) { done = true; @@ -9153,18 +9153,18 @@ class JoglPipeline extends Pipeline { } } } - + // Used in two phases of pixel format selection: transforming the // JoglGraphicsConfiguration to a real AWT GraphicsConfiguration and // during context creation to select exactly the same graphics // configuration as was done during getBestConfiguration. class IndexCapabilitiesChooser implements GLCapabilitiesChooser { private int indexToChoose; - + IndexCapabilitiesChooser(int indexToChoose) { this.indexToChoose = indexToChoose; } - + public int chooseCapabilities(GLCapabilities desired, GLCapabilities[] available, int windowSystemRecommendedChoice) { @@ -9174,7 +9174,7 @@ class JoglPipeline extends Pipeline { return indexToChoose; } } - + private void disposeOnEDT(final Frame f) { Runnable r = new Runnable() { public void run() { @@ -9188,58 +9188,58 @@ class JoglPipeline extends Pipeline { r.run(); } } - - + + // --------------------------------------------------------------------- - + // // DrawingSurfaceObject methods // - + // Method to construct a new DrawingSurfaceObject DrawingSurfaceObject createDrawingSurfaceObject(Canvas3D cv) { if (VERBOSE) System.err.println("JoglPipeline.createDrawingSurfaceObject()"); return new JoglDrawingSurfaceObject(cv); } - + // Method to free the drawing surface object void freeDrawingSurface(Canvas3D cv, DrawingSurfaceObject drawingSurfaceObject) { if (VERBOSE) System.err.println("JoglPipeline.freeDrawingSurface()"); // This method is a no-op } - + // Method to free the native drawing surface object void freeDrawingSurfaceNative(Object o) { if (VERBOSE) System.err.println("JoglPipeline.freeDrawingSurfaceNative()"); // This method is a no-op } - + //---------------------------------------------------------------------- // Context-related routines // - + // Helper used everywhere GLContext context(Context ctx) { if (ctx == null) return null; return ((JoglContext) ctx).getGLContext(); } - + // Helper used everywhere GLDrawable drawable(Drawable drawable) { if (drawable == null) return null; return ((JoglDrawable) drawable).getGLDrawable(); } - + GLCapabilities caps(Canvas3D ctx) { return ((JoglGraphicsConfiguration) ctx.graphicsConfiguration).getGLCapabilities(); } - + //---------------------------------------------------------------------- // General helper routines // - + private static ThreadLocal nioVertexTemp = new ThreadLocal(); private static ThreadLocal nioVertexDoubleTemp = new ThreadLocal(); private static ThreadLocal nioColorTemp = new ThreadLocal(); @@ -9247,55 +9247,55 @@ class JoglPipeline extends Pipeline { private static ThreadLocal nioNormalTemp = new ThreadLocal(); private static ThreadLocal nioTexCoordSetTemp = new ThreadLocal(); private static ThreadLocal nioVertexAttrSetTemp = new ThreadLocal(); - + private static FloatBuffer getVertexArrayBuffer(float[] vertexArray) { return getVertexArrayBuffer(vertexArray, true); } - + private static FloatBuffer getVertexArrayBuffer(float[] vertexArray, boolean copyData) { return getNIOBuffer(vertexArray, nioVertexTemp, copyData); } - + private static DoubleBuffer getVertexArrayBuffer(double[] vertexArray) { return getVertexArrayBuffer(vertexArray, true); } - + private static DoubleBuffer getVertexArrayBuffer(double[] vertexArray, boolean copyData) { return getNIOBuffer(vertexArray, nioVertexDoubleTemp, true); } - + private static FloatBuffer getColorArrayBuffer(float[] colorArray) { return getColorArrayBuffer(colorArray, true); } - + private static FloatBuffer getColorArrayBuffer(float[] colorArray, boolean copyData) { return getNIOBuffer(colorArray, nioColorTemp, true); } - + private static ByteBuffer getColorArrayBuffer(byte[] colorArray) { return getColorArrayBuffer(colorArray, true); } - + private static ByteBuffer getColorArrayBuffer(byte[] colorArray, boolean copyData) { return getNIOBuffer(colorArray, nioColorByteTemp, true); } - + private static FloatBuffer getNormalArrayBuffer(float[] normalArray) { return getNormalArrayBuffer(normalArray, true); } - + private static FloatBuffer getNormalArrayBuffer(float[] normalArray, boolean copyData) { return getNIOBuffer(normalArray, nioNormalTemp, true); } - + private static FloatBuffer[] getTexCoordSetBuffer(Object[] texCoordSet) { return getNIOBuffer(texCoordSet, nioTexCoordSetTemp); } - + private static FloatBuffer[] getVertexAttrSetBuffer(Object[] vertexAttrSet) { return getNIOBuffer(vertexAttrSet, nioVertexAttrSetTemp); } - + private static FloatBuffer getNIOBuffer(float[] array, ThreadLocal threadLocal, boolean copyData) { if (array == null) { return null; @@ -9318,7 +9318,7 @@ class JoglPipeline extends Pipeline { } return buf; } - + private static DoubleBuffer getNIOBuffer(double[] array, ThreadLocal threadLocal, boolean copyData) { if (array == null) { return null; @@ -9341,7 +9341,7 @@ class JoglPipeline extends Pipeline { } return buf; } - + private static ByteBuffer getNIOBuffer(byte[] array, ThreadLocal threadLocal, boolean copyData) { if (array == null) { return null; @@ -9364,13 +9364,13 @@ class JoglPipeline extends Pipeline { } return buf; } - + private static FloatBuffer[] getNIOBuffer(Object[] array, ThreadLocal threadLocal) { if (array == null) { return null; } FloatBuffer[] bufs = (FloatBuffer[]) threadLocal.get(); - + // First resize array of FloatBuffers if (bufs == null) { bufs = new FloatBuffer[array.length]; @@ -9381,7 +9381,7 @@ class JoglPipeline extends Pipeline { bufs = newBufs; threadLocal.set(bufs); } - + // Now go down array of arrays, converting each into a direct FloatBuffer for (int i = 0; i < array.length; i++) { float[] cur = (float[]) array[i]; @@ -9400,7 +9400,7 @@ class JoglPipeline extends Pipeline { buf.put(cur); buf.rewind(); } - + return bufs; } } diff --git a/src/classes/share/javax/media/j3d/Alpha.java b/src/classes/share/javax/media/j3d/Alpha.java index b6bf7d6..4be139f 100644 --- a/src/classes/share/javax/media/j3d/Alpha.java +++ b/src/classes/share/javax/media/j3d/Alpha.java @@ -171,7 +171,7 @@ public class Alpha extends NodeComponent { public Alpha() { loopCount = -1; mode = INCREASING_ENABLE; - increasingAlpha = 1.0f; // converted to seconds internally + increasingAlpha = 1.0f; // converted to seconds internally /* // Java initialize them to zero by default triggerTime = 0L; @@ -223,10 +223,10 @@ public class Alpha extends NodeComponent { */ public Alpha(int loopCount, int mode, long triggerTime, long phaseDelayDuration, - long increasingAlphaDuration, + long increasingAlphaDuration, long increasingAlphaRampDuration, long alphaAtOneDuration, - long decreasingAlphaDuration, + long decreasingAlphaDuration, long decreasingAlphaRampDuration, long alphaAtZeroDuration) { @@ -255,8 +255,8 @@ public class Alpha extends NodeComponent { /** - * Constructs a new Alpha object that assumes that the mode is - * INCREASING_ENABLE. + * Constructs a new Alpha object that assumes that the mode is + * INCREASING_ENABLE. * * @param loopCount number of times to run this alpha; a value * of -1 specifies that the alpha loops indefinitely. @@ -280,7 +280,7 @@ public class Alpha extends NodeComponent { long increasingAlphaDuration, long increasingAlphaRampDuration, long alphaAtOneDuration) { - this(loopCount, INCREASING_ENABLE, + this(loopCount, INCREASING_ENABLE, triggerTime, phaseDelayDuration, increasingAlphaDuration, increasingAlphaRampDuration, alphaAtOneDuration, 0, 0, 0); @@ -290,12 +290,12 @@ public class Alpha extends NodeComponent { /** * This constructor takes only the loopCount and increasingAlphaDuration * as parameters and assigns the default values to all of the other - * parameters. + * parameters. * @param loopCount number of times to run this alpha; a value * of -1 specifies that the alpha loops indefinitely * @param increasingAlphaDuration period of time during which alpha goes * from zero to one - */ + */ public Alpha(int loopCount, long increasingAlphaDuration) { // defaults mode = INCREASING_ENABLE; @@ -465,7 +465,7 @@ public class Alpha extends NodeComponent { // If non-looping and before start // if ((loopCount != -1) && // interpolatorTime <= ( triggerTime + phaseDelay)) { - // + // // if (( mode & INCREASING_ENABLE ) == 0 && // ( mode & DECREASING_ENABLE) != 0) // alpha = 1.0f; @@ -473,8 +473,8 @@ public class Alpha extends NodeComponent { // alpha = 0.0f; // return alpha; // } - - + + // Case of {constantly} moving forward, snap back, forward again if (( mode & INCREASING_ENABLE ) != 0 && ( mode & DECREASING_ENABLE) == 0) { @@ -495,7 +495,7 @@ public class Alpha extends NodeComponent { if ( alpha > 1.0f) alpha = 1.0f; return alpha; } - + // Ramped velocity case alphaRampDuration = incAlphaRampInternal; @@ -503,7 +503,7 @@ public class Alpha extends NodeComponent { 6.0f*( increasingAlpha + alphaAtOne), ( increasingAlpha + alphaAtOne)); if (dt >= increasingAlpha) { alpha = 1.0f; return alpha; } - + // Original equation kept to help understand // computation logic - simplification saves // a multiply and an add @@ -513,7 +513,7 @@ public class Alpha extends NodeComponent { a1 = 1.0f/(increasingAlpha * alphaRampDuration - alphaRampDuration * alphaRampDuration); - + if (dt < alphaRampDuration) { alpha = 0.5f*a1*dt*dt; } else if (dt < increasingAlpha - alphaRampDuration) { @@ -529,31 +529,31 @@ public class Alpha extends NodeComponent { ( increasingAlpha - dt); } return alpha; - + } else - - + + // Case of {constantly} moving backward, snap forward, backward // again if (( mode & INCREASING_ENABLE ) == 0 && ( mode & DECREASING_ENABLE) != 0) { - + // If non-looping and past end // if ((loopCount != -1) - // && (interpolatorTime + // && (interpolatorTime // >= (triggerTime + phaseDelay + decreasingAlpha))) { // alpha = 0.0f; // return alpha; // } if(interpolatorTime <= (triggerTime + phaseDelay)) - return 1.0f; + return 1.0f; if((loopCount != -1) && (interpolatorTime >= stopTime) ) - return 0.0f; + return 0.0f; + - // Constant velocity case if (decAlphaRampInternal == 0.0f) { alpha = mfmod((interpolatorTime - triggerTime - @@ -564,15 +564,15 @@ public class Alpha extends NodeComponent { alpha = 1.0f - alpha; return alpha; } - + // Ramped velocity case alphaRampDuration = decAlphaRampInternal; - + dt = mfmod((interpolatorTime - triggerTime - phaseDelay) + 6.0f*( decreasingAlpha + alphaAtZero), ( decreasingAlpha + alphaAtZero)); if (dt >= decreasingAlpha) { alpha = 0.0f; return alpha; } - + // Original equation kept to help understand // computation logic - simplification saves // a multiply and an add @@ -582,7 +582,7 @@ public class Alpha extends NodeComponent { a1 = 1.0f/(decreasingAlpha * alphaRampDuration - alphaRampDuration * alphaRampDuration); - + if (dt < alphaRampDuration) { alpha = 0.5f*a1*dt*dt; } else if (dt < decreasingAlpha - alphaRampDuration) { @@ -599,17 +599,17 @@ public class Alpha extends NodeComponent { } alpha = 1.0f - alpha; return alpha; - + } else - - + + // Case of {osscilating} increasing and decreasing alpha if (( mode & INCREASING_ENABLE) != 0 && ( mode & DECREASING_ENABLE) != 0) { - + // If non-looping and past end // if ((loopCount != -1) && - // (interpolatorTime >= + // (interpolatorTime >= // (triggerTime + phaseDelay + increasingAlpha + // alphaAtOne + decreasingAlpha))) { // alpha = 0.0f; @@ -622,7 +622,7 @@ public class Alpha extends NodeComponent { if(interpolatorTime <= (triggerTime + phaseDelay)) return 0.0f; - if( (loopCount != -1) && (interpolatorTime >= stopTime)) + if( (loopCount != -1) && (interpolatorTime >= stopTime)) return 0.0f; // Constant velocity case @@ -645,7 +645,7 @@ public class Alpha extends NodeComponent { else alpha = 0.0f; return alpha; } - + // Ramped velocity case alphaRampDuration = incAlphaRampInternal; @@ -669,7 +669,7 @@ public class Alpha extends NodeComponent { a1 = 1.0f/(increasingAlpha * alphaRampDuration - alphaRampDuration * alphaRampDuration); - + if (dt < alphaRampDuration) { alpha = 0.5f*a1*dt*dt; } else if (dt < increasingAlpha - alphaRampDuration) { @@ -707,7 +707,7 @@ public class Alpha extends NodeComponent { // a1 = 1.0f/(alphaRampDuration*alphaRampDuration + // ( decreasingAlpha - 2*alphaRampDuration)* // alphaRampDuration); - + a1 = 1.0f/(decreasingAlpha * alphaRampDuration - alphaRampDuration * alphaRampDuration); @@ -729,7 +729,7 @@ public class Alpha extends NodeComponent { alpha = 1.0f - alpha; return alpha; } - + } return 0.0f; } @@ -741,7 +741,7 @@ public class Alpha extends NodeComponent { if (ta < 0.0f) ta = -ta; fmint =(int)( ta/tb); - fm = ta - (float)fmint * tb; + fm = ta - (float)fmint * tb; if ((a) < 0.0f) return ((b) - fm); else return fm; @@ -758,7 +758,7 @@ public class Alpha extends NodeComponent { } /** - * Sets this alpha's startTime to that specified in the argument; + * Sets this alpha's startTime to that specified in the argument; * startTime sets the base (or zero) for all relative time * computations; the default value for startTime is the system * start time. @@ -843,7 +843,7 @@ public class Alpha extends NodeComponent { } /** - * Set this alpha's phaseDelayDuration to that specified in + * Set this alpha's phaseDelayDuration to that specified in * the argument. * @param phaseDelayDuration the new phaseDelayDuration */ @@ -862,7 +862,7 @@ public class Alpha extends NodeComponent { } /** - * Set this alpha's increasingAlphaDuration to that specified in + * Set this alpha's increasingAlphaDuration to that specified in * the argument. * @param increasingAlphaDuration the new increasingAlphaDuration */ @@ -881,7 +881,7 @@ public class Alpha extends NodeComponent { } /** - * Set this alpha's increasingAlphaRampDuration to that specified + * Set this alpha's increasingAlphaRampDuration to that specified * in the argument. * @param increasingAlphaRampDuration the new increasingAlphaRampDuration */ @@ -903,7 +903,7 @@ public class Alpha extends NodeComponent { } /** - * Set this alpha object's alphaAtOneDuration to the specified + * Set this alpha object's alphaAtOneDuration to the specified * value. * @param alphaAtOneDuration the new alphaAtOneDuration */ @@ -922,7 +922,7 @@ public class Alpha extends NodeComponent { } /** - * Set this alpha's decreasingAlphaDuration to that specified in + * Set this alpha's decreasingAlphaDuration to that specified in * the argument. * @param decreasingAlphaDuration the new decreasingAlphaDuration */ @@ -941,7 +941,7 @@ public class Alpha extends NodeComponent { } /** - * Set this alpha's decreasingAlphaRampDuration to that specified + * Set this alpha's decreasingAlphaRampDuration to that specified * in the argument. * @param decreasingAlphaRampDuration the new decreasingAlphaRampDuration */ @@ -963,7 +963,7 @@ public class Alpha extends NodeComponent { } /** - * Set this alpha object's alphaAtZeroDuration to the specified + * Set this alpha object's alphaAtZeroDuration to the specified * value. * @param alphaAtZeroDuration the new alphaAtZeroDuration */ @@ -988,7 +988,7 @@ public class Alpha extends NodeComponent { if (loopCount >= 0) { float sum = 0; if (( mode & INCREASING_ENABLE ) != 0) { - sum = increasingAlpha+alphaAtOne; + sum = increasingAlpha+alphaAtOne; } if ((mode & DECREASING_ENABLE) != 0) { sum += decreasingAlpha+alphaAtZero; @@ -999,7 +999,7 @@ public class Alpha extends NodeComponent { } } - /** + /** * This internal method returns a clone of the Alpha * * @return a duplicate of this Alpha diff --git a/src/classes/share/javax/media/j3d/AlternateAppearance.java b/src/classes/share/javax/media/j3d/AlternateAppearance.java index ac0f0c1..540fbff 100644 --- a/src/classes/share/javax/media/j3d/AlternateAppearance.java +++ b/src/classes/share/javax/media/j3d/AlternateAppearance.java @@ -117,7 +117,7 @@ public class AlternateAppearance extends Leaf { ALLOW_APPEARANCE_READ, ALLOW_SCOPE_READ }; - + /** * Constructs an AlternateAppearance node with default * parameters. The default values are as follows: @@ -133,7 +133,7 @@ public class AlternateAppearance extends Leaf { // Just use the defaults // set default read capabilities setDefaultReadCapabilities(readCapabilities); - + } /** @@ -169,7 +169,7 @@ public class AlternateAppearance extends Leaf { if(!this.getCapability(ALLOW_APPEARANCE_WRITE)) throw new CapabilityNotSetException(J3dI18N.getString("AlternateAppearance0")); - if (isLive()) + if (isLive()) ((AlternateAppearanceRetained)this.retained).setAppearance(appearance); else ((AlternateAppearanceRetained)this.retained).initAppearance(appearance); @@ -206,7 +206,7 @@ public class AlternateAppearance extends Leaf { throw new CapabilityNotSetException(J3dI18N.getString("AlternateAppearance3")); - if (isLive()) + if (isLive()) ((AlternateAppearanceRetained)this.retained).setInfluencingBounds(region); else ((AlternateAppearanceRetained)this.retained).initInfluencingBounds(region); @@ -531,15 +531,15 @@ public class AlternateAppearance extends Leaf { void duplicateAttributes(Node originalNode, boolean forceDuplicate) { super.duplicateAttributes(originalNode, forceDuplicate); - AlternateAppearanceRetained attr = (AlternateAppearanceRetained) + AlternateAppearanceRetained attr = (AlternateAppearanceRetained) originalNode.retained; AlternateAppearanceRetained rt = (AlternateAppearanceRetained) retained; rt.initAppearance((Appearance) getNodeComponent( - attr.getAppearance(), + attr.getAppearance(), forceDuplicate, originalNode.nodeHashtable)); - + rt.initInfluencingBounds(attr.getInfluencingBounds()); Enumeration elm = attr.getAllScopes(); @@ -547,7 +547,7 @@ public class AlternateAppearance extends Leaf { // this reference will set correctly in updateNodeReferences() callback rt.initAddScope((Group) elm.nextElement()); } - + // correct value will set in updateNodeReferences rt.initInfluencingBoundingLeaf(attr.getInfluencingBoundingLeaf()); @@ -584,7 +584,7 @@ public class AlternateAppearance extends Leaf { retained; BoundingLeaf bl = rt.getInfluencingBoundingLeaf(); - + if (bl != null) { Object o = referenceTable.getNewObjectReference(bl); rt.initInfluencingBoundingLeaf((BoundingLeaf) o); diff --git a/src/classes/share/javax/media/j3d/AlternateAppearanceRetained.java b/src/classes/share/javax/media/j3d/AlternateAppearanceRetained.java index e3e23d6..10cdfa6 100644 --- a/src/classes/share/javax/media/j3d/AlternateAppearanceRetained.java +++ b/src/classes/share/javax/media/j3d/AlternateAppearanceRetained.java @@ -52,10 +52,10 @@ class AlternateAppearanceRetained extends LeafRetained { /** * The Boundary object defining the lights's region of influence. - */ + */ Bounds regionOfInfluence = null; - /** + /** * The bounding leaf reference */ BoundingLeafRetained boundingLeaf = null; @@ -76,9 +76,9 @@ class AlternateAppearanceRetained extends LeafRetained { boolean isScoped = false; // The object that contains the dynamic HashKey - a string type object - // Used in scoping + // Used in scoping HashKey tempKey = new HashKey(250); - + /** * The transformed value of the applicationRegion. */ @@ -121,7 +121,7 @@ class AlternateAppearanceRetained extends LeafRetained { appearance = null; } - + /** * sets the appearance and send a message */ @@ -137,12 +137,12 @@ class AlternateAppearanceRetained extends LeafRetained { } } // There is no need to clone the appearance's mirror - sendMessage(APPEARANCE_CHANGED, - (appearance != null ? appearance.mirror: null)); + sendMessage(APPEARANCE_CHANGED, + (appearance != null ? appearance.mirror: null)); } - + Appearance getAppearance() { return (appearance == null ? null: (Appearance) appearance.source); } @@ -150,7 +150,7 @@ class AlternateAppearanceRetained extends LeafRetained { /** * Set the alternate's region of influence. - */ + */ void initInfluencingBounds(Bounds region) { if (region != null) { this.regionOfInfluence = (Bounds) region.clone(); @@ -161,16 +161,16 @@ class AlternateAppearanceRetained extends LeafRetained { /** * Set the alternate's region of influence and send message - */ + */ void setInfluencingBounds(Bounds region) { initInfluencingBounds(region); - sendMessage(BOUNDS_CHANGED, + sendMessage(BOUNDS_CHANGED, (region != null ? region.clone() : null)); } - /** + /** * Get the alternate's region of Influence. - */ + */ Bounds getInfluencingBounds() { return (regionOfInfluence != null ? (Bounds) regionOfInfluence.clone() : null); @@ -178,7 +178,7 @@ class AlternateAppearanceRetained extends LeafRetained { /** * Set the alternate's region of influence to the specified Leaf node. - */ + */ void initInfluencingBoundingLeaf(BoundingLeaf region) { if (region != null) { boundingLeaf = (BoundingLeafRetained)region.retained; @@ -189,7 +189,7 @@ class AlternateAppearanceRetained extends LeafRetained { /** * Set the alternate's region of influence to the specified Leaf node. - */ + */ void setInfluencingBoundingLeaf(BoundingLeaf region) { if (boundingLeaf != null) boundingLeaf.mirrorBoundingLeaf.removeUser(mirrorAltApp); @@ -199,21 +199,21 @@ class AlternateAppearanceRetained extends LeafRetained { } else { boundingLeaf = null; } - sendMessage(BOUNDINGLEAF_CHANGED, - (boundingLeaf != null ? + sendMessage(BOUNDINGLEAF_CHANGED, + (boundingLeaf != null ? boundingLeaf.mirrorBoundingLeaf : null)); } - /** + /** * Get the alternate's region of influence. - */ + */ BoundingLeaf getInfluencingBoundingLeaf() { - return (boundingLeaf != null ? + return (boundingLeaf != null ? (BoundingLeaf)boundingLeaf.source : null); } - + /** * Replaces the specified scope with the scope provided. * @param scope the new scope @@ -292,7 +292,7 @@ class AlternateAppearanceRetained extends LeafRetained { scopeInfo[2] = (scopes.size() > 0 ? Boolean.TRUE: Boolean.FALSE); sendMessage(SCOPE_CHANGED, scopeInfo); } - + void initRemoveScope(int index) { @@ -318,11 +318,11 @@ class AlternateAppearanceRetained extends LeafRetained { sendMessage(SCOPE_CHANGED, scopeInfo); } - /** + /** * Removes the specified Group node from this node's list of scopes. - * Method is a no-op if the + * Method is a no-op if the * specified node is not found - * @param The Group node to be removed + * @param The Group node to be removed */ void removeScope(Group scope) { int ind = indexOfScope(scope); @@ -355,14 +355,14 @@ class AlternateAppearanceRetained extends LeafRetained { void initRemoveAllScopes() { int n = scopes.size(); - for(int i = n-1; i >= 0; i--) + for(int i = n-1; i >= 0; i--) initRemoveScope(i); } - + /** * Returns an enumeration object of the scoperen. * @return an enumeration object of the scoperen - */ + */ Enumeration getAllScopes() { Enumeration elm = scopes.elements(); Vector v = new Vector(scopes.size()); @@ -372,7 +372,7 @@ class AlternateAppearanceRetained extends LeafRetained { return v.elements(); } - /** + /** * Returns the index of the specified Group node in this node's list of scopes. * @param scope the Group node whose index is needed */ @@ -412,7 +412,7 @@ class AlternateAppearanceRetained extends LeafRetained { scopeInfo[2] = (scopes.size() > 0 ? Boolean.TRUE: Boolean.FALSE); sendMessage(SCOPE_CHANGED, scopeInfo); } - + /** @@ -422,7 +422,7 @@ class AlternateAppearanceRetained extends LeafRetained { int numScopes() { return scopes.size(); } - + /** * This sets the immedate mode context flag @@ -430,7 +430,7 @@ class AlternateAppearanceRetained extends LeafRetained { void setInImmCtx(boolean inCtx) { inImmCtx = inCtx; } - + /** * This gets the immedate mode context flag */ @@ -472,7 +472,7 @@ class AlternateAppearanceRetained extends LeafRetained { if (objs[2] != null) { mirrorAltApp.region = (Bounds)mirrorAltApp.boundingLeaf.transformedRegion; } - else { + else { if (mirrorAltApp.regionOfInfluence != null) { mirrorAltApp.region = mirrorAltApp.regionOfInfluence.copy(mirrorAltApp.region); mirrorAltApp.region.transform( @@ -482,7 +482,7 @@ class AlternateAppearanceRetained extends LeafRetained { else { mirrorAltApp.region = null; } - + } } else if ((component & SCOPE_CHANGED) != 0) { @@ -490,7 +490,7 @@ class AlternateAppearanceRetained extends LeafRetained { ArrayList addList = (ArrayList)scopeList[0]; ArrayList removeList = (ArrayList)scopeList[1]; boolean isScoped = ((Boolean)scopeList[2]).booleanValue(); - + if (addList != null) { mirrorAltApp.isScoped = isScoped; for (i = 0; i < addList.size(); i++) { @@ -498,7 +498,7 @@ class AlternateAppearanceRetained extends LeafRetained { obj.addAltApp(mirrorAltApp); } } - + if (removeList != null) { mirrorAltApp.isScoped = isScoped; for (i = 0; i < removeList.size(); i++) { @@ -514,7 +514,7 @@ class AlternateAppearanceRetained extends LeafRetained { /** Note: This routine will only be called on * the mirror object - will update the object's - * cached region and transformed region + * cached region and transformed region */ void updateBoundingLeaf() { @@ -584,13 +584,13 @@ class AlternateAppearanceRetained extends LeafRetained { } else { s.nodeList.add(mirrorAltApp); } - + if (s.transformTargets != null && s.transformTargets[0] != null) { s.transformTargets[0].addNode(mirrorAltApp, Targets.ENV_TARGETS); s.notifyThreads |= J3dThread.UPDATE_TRANSFORM; } - + // process switch leaf if (s.switchTargets != null && s.switchTargets[0] != null) { @@ -635,11 +635,11 @@ class AlternateAppearanceRetained extends LeafRetained { obj[1] = (regionOfInfluence != null?regionOfInfluence.clone():null); createMessage.args[4] = obj; VirtualUniverse.mc.processMessage(createMessage); - - - - + + + + } /** @@ -653,7 +653,7 @@ class AlternateAppearanceRetained extends LeafRetained { AppearanceRetained app = (AppearanceRetained)args[3]; BoundingLeafRetained bl=(BoundingLeafRetained)((Object[])args[4])[0]; Bounds bnds = (Bounds)((Object[])args[4])[1]; - + for (int i = 0; i < shapeList.size(); i++) { shape = ((GeometryAtom)shapeList.get(i)).source; shape.addAltApp(mirrorAltApp); @@ -670,7 +670,7 @@ class AlternateAppearanceRetained extends LeafRetained { mirrorAltApp.boundingLeaf = null; mirrorAltApp.region = null; } - + if (bnds != null) { mirrorAltApp.regionOfInfluence = bnds; if (mirrorAltApp.region == null) { @@ -688,17 +688,17 @@ class AlternateAppearanceRetained extends LeafRetained { Shape3DRetained shape; ArrayList shapeList = (ArrayList)args[2]; ArrayList removeScopeList = new ArrayList(); - + for (int i = 0; i < shapeList.size(); i++) { shape = ((GeometryAtom)shapeList.get(i)).source; shape.removeAltApp(mirrorAltApp); - } - mirrorAltApp.isScoped = false; + } + mirrorAltApp.isScoped = false; } - + /** * This clearLive routine first calls the superclass's method, then @@ -718,10 +718,10 @@ class AlternateAppearanceRetained extends LeafRetained { s.notifyThreads |= J3dThread.UPDATE_RENDERING_ENVIRONMENT| J3dThread.UPDATE_RENDER; - // Remove this mirror light as users of the bounding leaf + // Remove this mirror light as users of the bounding leaf if (mirrorAltApp.boundingLeaf != null) mirrorAltApp.boundingLeaf.removeUser(mirrorAltApp); - + if ((s.viewScopedNodeList != null) && (s.viewLists != null)) { s.viewScopedNodeList.add(mirrorAltApp); s.scopedNodesViewList.add(s.viewLists.get(0)); @@ -731,14 +731,14 @@ class AlternateAppearanceRetained extends LeafRetained { if (s.transformTargets != null && s.transformTargets[0] != null) { s.transformTargets[0].addNode(mirrorAltApp, Targets.ENV_TARGETS); - s.notifyThreads |= J3dThread.UPDATE_TRANSFORM; + s.notifyThreads |= J3dThread.UPDATE_TRANSFORM; } if (s.switchTargets != null && s.switchTargets[0] != null) { s.switchTargets[0].addNode(mirrorAltApp, Targets.ENV_TARGETS); } - + if (scopes.size() > 0) { J3dMessage createMessage = new J3dMessage(); createMessage.threads = J3dThread.UPDATE_RENDERING_ENVIRONMENT; @@ -773,10 +773,10 @@ class AlternateAppearanceRetained extends LeafRetained { region.transform(regionOfInfluence, sgAltApp.getCurrentLocalToVworld()); } - + } } - + final void sendMessage(int attrMask, Object attr) { J3dMessage createMessage = new J3dMessage(); createMessage.threads = targetThreads; @@ -786,7 +786,7 @@ class AlternateAppearanceRetained extends LeafRetained { createMessage.args[1]= new Integer(attrMask); createMessage.args[2] = attr; VirtualUniverse.mc.processMessage(createMessage); - } + } void getMirrorObjects(ArrayList leafList, HashKey key) { diff --git a/src/classes/share/javax/media/j3d/AmbientLight.java b/src/classes/share/javax/media/j3d/AmbientLight.java index bfe4bac..b62f8bc 100644 --- a/src/classes/share/javax/media/j3d/AmbientLight.java +++ b/src/classes/share/javax/media/j3d/AmbientLight.java @@ -40,7 +40,7 @@ import javax.vecmath.Color3f; * influencing bounds, scopes, and * a flag indicating whether this light source is on or off. * Ambient reflections do not depend on the orientation or - * position of a surface. + * position of a surface. * Ambient light has only an ambient reflection component. * It does not have diffuse or specular reflection components. * <p> diff --git a/src/classes/share/javax/media/j3d/Appearance.java b/src/classes/share/javax/media/j3d/Appearance.java index 5ebef98..e403915 100644 --- a/src/classes/share/javax/media/j3d/Appearance.java +++ b/src/classes/share/javax/media/j3d/Appearance.java @@ -35,13 +35,13 @@ import java.util.Hashtable; /** * The Appearance object defines all rendering state that can be set - * as a component object of a Shape3D node. The rendering state + * as a component object of a Shape3D node. The rendering state * consists of the following:<p> * <ul> * <li>Coloring attributes - defines attributes used in color selection * and shading. These attributes are defined in a ColoringAttributes * object.</li><p> - * + * * <li>Line attributes - defines attributes used to define lines, including * the pattern, width, and whether antialiasing is to be used. These * attributes are defined in a LineAttributes object.</li><p> @@ -60,16 +60,16 @@ import java.util.Hashtable; * including the alpha test function and test value, the raster * operation, whether vertex colors are ignored, whether invisible * objects are rendered, and whether the depth buffer is enabled. - * These attributes are defined in a RenderingAttributes + * These attributes are defined in a RenderingAttributes * object.</li><p> * * <li>Transparency attributes - defines the attributes that affect - * transparency of the object, such as the transparency mode + * transparency of the object, such as the transparency mode * (blended, screen-door), blending function (used in transparency * and antialiasing operations), and a blend value that defines - * the amount of transparency to be applied to this Appearance + * the amount of transparency to be applied to this Appearance * component object.</li><p> - * + * * <li>Material - defines the appearance of an object under illumination, * such as the ambient color, diffuse color, specular color, emissive * color, and shininess. These attributes are defined in a Material @@ -86,7 +86,7 @@ import java.util.Hashtable; * * <li>Texture coordinate generation - defines the attributes * that apply to texture coordinate generation, such as whether - * texture coordinate generation is enabled, coordinate format + * texture coordinate generation is enabled, coordinate format * (2D or 3D coordinates), coordinate generation mode (object * linear, eye linear, or spherical reflection mapping), and the * R, S, and T coordinate plane equations. These attributes @@ -316,12 +316,12 @@ public class Appearance extends NodeComponent { ALLOW_TEXTURE_ATTRIBUTES_READ, ALLOW_TEXTURE_READ, ALLOW_TEXTURE_UNIT_STATE_READ, - ALLOW_TRANSPARENCY_ATTRIBUTES_READ + ALLOW_TRANSPARENCY_ATTRIBUTES_READ }; - + /** * Constructs an Appearance component object using defaults for all - * state variables. All component object references are initialized + * state variables. All component object references are initialized * to null. */ public Appearance() { @@ -338,13 +338,13 @@ public class Appearance extends NodeComponent { this.retained = new AppearanceRetained(); this.retained.setSource(this); } - + /** * Sets the material object to the specified object. * Setting it to null disables lighting. * @param material object that specifies the desired material * properties - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ public void setMaterial(Material material) { @@ -357,7 +357,7 @@ public class Appearance extends NodeComponent { /** * Retrieves the current material object. * @return the material object - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ public Material getMaterial() { @@ -372,7 +372,7 @@ public class Appearance extends NodeComponent { * Setting it to null will result in default attribute usage. * @param coloringAttributes object that specifies the desired * coloringAttributes parameters - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ public void setColoringAttributes(ColoringAttributes coloringAttributes) { @@ -385,7 +385,7 @@ public class Appearance extends NodeComponent { /** * Retrieves the current coloringAttributes object. * @return the coloringAttributes object - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ public ColoringAttributes getColoringAttributes() { @@ -400,7 +400,7 @@ public class Appearance extends NodeComponent { * Setting it to null will result in default attribute usage. * @param transparencyAttributes object that specifies the desired * transparencyAttributes parameters - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ public void setTransparencyAttributes(TransparencyAttributes transparencyAttributes) { @@ -413,7 +413,7 @@ public class Appearance extends NodeComponent { /** * Retrieves the current transparencyAttributes object. * @return the transparencyAttributes object - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ public TransparencyAttributes getTransparencyAttributes() { @@ -428,7 +428,7 @@ public class Appearance extends NodeComponent { * Setting it to null will result in default attribute usage. * @param renderingAttributes object that specifies the desired * renderingAttributes parameters - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ public void setRenderingAttributes(RenderingAttributes renderingAttributes) { @@ -441,7 +441,7 @@ public class Appearance extends NodeComponent { /** * Retrieves the current renderingAttributes object. * @return the renderingAttributes object - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ public RenderingAttributes getRenderingAttributes() { @@ -454,9 +454,9 @@ public class Appearance extends NodeComponent { /** * Sets the polygonAttributes object to the specified object. * Setting it to null will result in default attribute usage. - * @param polygonAttributes object that specifies the desired + * @param polygonAttributes object that specifies the desired * polygonAttributes parameters - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ public void setPolygonAttributes(PolygonAttributes polygonAttributes) { @@ -469,7 +469,7 @@ public class Appearance extends NodeComponent { /** * Retrieves the current polygonAttributes object. * @return the polygonAttributes object - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ public PolygonAttributes getPolygonAttributes() { @@ -484,7 +484,7 @@ public class Appearance extends NodeComponent { * Setting it to null will result in default attribute usage. * @param lineAttributes object that specifies the desired * lineAttributes parameters - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ public void setLineAttributes(LineAttributes lineAttributes) { @@ -497,7 +497,7 @@ public class Appearance extends NodeComponent { /** * Retrieves the current lineAttributes object. * @return the lineAttributes object - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ public LineAttributes getLineAttributes() { @@ -512,7 +512,7 @@ public class Appearance extends NodeComponent { * Setting it to null will result in default attribute usage. * @param pointAttributes object that specifies the desired * pointAttributes parameters - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ public void setPointAttributes(PointAttributes pointAttributes) { @@ -525,7 +525,7 @@ public class Appearance extends NodeComponent { /** * Retrieves the current pointAttributes object. * @return the pointAttributes object - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ public PointAttributes getPointAttributes() { @@ -548,7 +548,7 @@ public class Appearance extends NodeComponent { * @param texture object that specifies the desired texture * map and texture parameters * - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph * * @exception IllegalStateException if the specified texture @@ -568,7 +568,7 @@ public class Appearance extends NodeComponent { if (isLiveOrCompiled()) if (!this.getCapability(ALLOW_TEXTURE_WRITE)) throw new CapabilityNotSetException(J3dI18N.getString("Appearance2")); - + // Do illegal sharing check if(texture != null) { ImageComponent[] images = ((TextureRetained)(texture.retained)).getImages(); @@ -578,14 +578,14 @@ public class Appearance extends NodeComponent { } } } - + ((AppearanceRetained)this.retained).setTexture(texture); } /** * Retrieves the current texture object. * @return the texture object - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ public Texture getTexture() { @@ -608,7 +608,7 @@ public class Appearance extends NodeComponent { * @param textureAttributes object that specifies the desired * textureAttributes map and textureAttributes parameters * - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph * * @exception IllegalStateException if the specified textureAttributes @@ -625,7 +625,7 @@ public class Appearance extends NodeComponent { /** * Retrieves the current textureAttributes object. * @return the textureAttributes object - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ public TextureAttributes getTextureAttributes() { @@ -648,7 +648,7 @@ public class Appearance extends NodeComponent { * @param texCoordGeneration object that specifies the texture coordinate * generation parameters * - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph * * @exception IllegalStateException if the specified texCoordGeneration @@ -665,7 +665,7 @@ public class Appearance extends NodeComponent { /** * Retrieves the current texCoordGeneration object. * @return the texCoordGeneration object - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ public TexCoordGeneration getTexCoordGeneration() { @@ -696,7 +696,7 @@ public class Appearance extends NodeComponent { * numbered from <code>0</code> through * <code>stateArray.length-1</code>. * - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph * * @exception IllegalStateException if the specified array is @@ -719,7 +719,7 @@ public class Appearance extends NodeComponent { if (isLiveOrCompiled()) if (!this.getCapability(ALLOW_TEXTURE_UNIT_STATE_WRITE)) throw new CapabilityNotSetException(J3dI18N.getString("Appearance20")); - + // Do illegal sharing check if (stateArray != null) { for(int j=0; j<stateArray.length; j++) { @@ -752,7 +752,7 @@ public class Appearance extends NodeComponent { * * @param state new texture unit state object * - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph * @exception NullPointerException if the texture unit state array is * null. @@ -799,7 +799,7 @@ public class Appearance extends NodeComponent { * * @return the array of texture unit state objects * - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph * * @since Java 3D 1.2 @@ -821,7 +821,7 @@ public class Appearance extends NodeComponent { * * @return the texture unit state object at the specified index * - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph * * @since Java 3D 1.2 @@ -843,7 +843,7 @@ public class Appearance extends NodeComponent { * * @return the length of the texture unit state array * - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph * * @since Java 3D 1.2 @@ -882,7 +882,7 @@ public class Appearance extends NodeComponent { * <code>originalNodeComponent</code> into * the current node. This method is called from the * <code>cloneNode</code> method which is, in turn, called by the - * <code>cloneTree</code> method.<P> + * <code>cloneTree</code> method.<P> * * @param originalNodeComponent the original node to duplicate. * @param forceDuplicate when set to <code>true</code>, causes the @@ -899,62 +899,62 @@ public class Appearance extends NodeComponent { */ void duplicateAttributes(NodeComponent originalNodeComponent, boolean forceDuplicate) { - super.duplicateAttributes(originalNodeComponent, forceDuplicate); - + super.duplicateAttributes(originalNodeComponent, forceDuplicate); + Hashtable hashtable = originalNodeComponent.nodeHashtable; - + AppearanceRetained app = (AppearanceRetained) originalNodeComponent.retained; AppearanceRetained rt = (AppearanceRetained) retained; - + rt.setMaterial((Material) getNodeComponent(app.getMaterial(), forceDuplicate, hashtable)); - + rt.setColoringAttributes((ColoringAttributes) getNodeComponent( app.getColoringAttributes(), forceDuplicate, hashtable)); - - + + rt.setTransparencyAttributes((TransparencyAttributes) getNodeComponent( app.getTransparencyAttributes(), forceDuplicate, hashtable)); - - + + rt.setRenderingAttributes((RenderingAttributes) getNodeComponent( app.getRenderingAttributes(), forceDuplicate, hashtable)); - - + + rt.setPolygonAttributes((PolygonAttributes) getNodeComponent( app.getPolygonAttributes(), forceDuplicate, hashtable)); - - + + rt.setLineAttributes((LineAttributes) getNodeComponent( app.getLineAttributes(), forceDuplicate, hashtable)); - - + + rt.setPointAttributes((PointAttributes) getNodeComponent( app.getPointAttributes(), forceDuplicate, hashtable)); - + rt.setTexture((Texture) getNodeComponent(app.getTexture(), forceDuplicate, hashtable)); - + rt.setTextureAttributes((TextureAttributes) getNodeComponent( app.getTextureAttributes(), forceDuplicate, hashtable)); - + rt.setTexCoordGeneration((TexCoordGeneration) getNodeComponent( app.getTexCoordGeneration(), forceDuplicate, @@ -970,14 +970,14 @@ public class Appearance extends NodeComponent { hashtable)); } } - + } - + /** * This function is called from getNodeComponent() to see if any of - * the sub-NodeComponents duplicateOnCloneTree flag is true. - * If it is the case, current NodeComponent needs to - * duplicate also even though current duplicateOnCloneTree flag is false. + * the sub-NodeComponents duplicateOnCloneTree flag is true. + * If it is the case, current NodeComponent needs to + * duplicate also even though current duplicateOnCloneTree flag is false. * This should be overwrite by NodeComponent which contains sub-NodeComponent. */ boolean duplicateChild() { @@ -991,27 +991,27 @@ public class Appearance extends NodeComponent { nc = rt.getMaterial(); if ((nc != null) && nc.getDuplicateOnCloneTree()) return true; - + nc = rt.getColoringAttributes(); if ((nc != null) && nc.getDuplicateOnCloneTree()) return true; - + nc = rt.getTransparencyAttributes(); if ((nc != null) && nc.getDuplicateOnCloneTree()) return true; - + nc = rt.getPolygonAttributes(); if ((nc != null) && nc.getDuplicateOnCloneTree()) return true; - + nc = rt.getLineAttributes(); if ((nc != null) && nc.getDuplicateOnCloneTree()) return true; - + nc = rt.getPointAttributes(); if ((nc != null) && nc.getDuplicateOnCloneTree()) return true; - + nc = rt.getTexture(); if ((nc != null) && nc.duplicateChild()) return true; @@ -1025,7 +1025,7 @@ public class Appearance extends NodeComponent { return true; // XXXX: TextureUnitState - + return false; } diff --git a/src/classes/share/javax/media/j3d/AppearanceRetained.java b/src/classes/share/javax/media/j3d/AppearanceRetained.java index 9e3629f..b771957 100644 --- a/src/classes/share/javax/media/j3d/AppearanceRetained.java +++ b/src/classes/share/javax/media/j3d/AppearanceRetained.java @@ -82,10 +82,10 @@ class AppearanceRetained extends NodeComponentRetained { // Lock used for synchronization of live state Object liveStateLock = new Object(); - + // NOTE: Consider grouping random state into common objects - // Cache used during compilation. If map == compState, then + // Cache used during compilation. If map == compState, then // mapAppearance can be used for this appearance CompileState map = null; AppearanceRetained mapAppearance = null; @@ -131,7 +131,7 @@ class AppearanceRetained extends NodeComponentRetained { // appaearance as users of this material ((MaterialRetained)material.retained).copyMirrorUsers(this); } - sendMessage(MATERIAL, + sendMessage(MATERIAL, (material != null ? ((MaterialRetained)material.retained).mirror : null), true); } @@ -150,7 +150,7 @@ class AppearanceRetained extends NodeComponentRetained { Material getMaterial() { return (material == null ? null : (Material)material.source); } - + /** * Sets the texture object to the specified object. * @param texture object that specifies the desired texture @@ -169,11 +169,11 @@ class AppearanceRetained extends NodeComponentRetained { ((TextureRetained)texture.retained).setLive(inBackgroundGroup, refCount); ((TextureRetained)texture.retained).copyMirrorUsers(this); } - sendMessage(TEXTURE, + sendMessage(TEXTURE, (texture != null ? ((TextureRetained)texture.retained).mirror : null), true); - } + } if (texture == null) { @@ -185,7 +185,7 @@ class AppearanceRetained extends NodeComponentRetained { } /** - * Retrieves the current texture object. + * Retrieves the current texture object. * @return the texture object */ Texture getTexture() { @@ -211,12 +211,12 @@ class AppearanceRetained extends NodeComponentRetained { ((TextureAttributesRetained)textureAttributes.retained).setLive(inBackgroundGroup, refCount); ((TextureAttributesRetained)textureAttributes.retained).copyMirrorUsers(this); } - sendMessage(TEXTURE_ATTR, + sendMessage(TEXTURE_ATTR, (textureAttributes != null ? ((TextureAttributesRetained)textureAttributes.retained).mirror: null), true); - } + } if (textureAttributes == null) { @@ -255,11 +255,11 @@ class AppearanceRetained extends NodeComponentRetained { ((ColoringAttributesRetained)coloringAttributes.retained).setLive(inBackgroundGroup, refCount); ((ColoringAttributesRetained)coloringAttributes.retained).copyMirrorUsers(this); } - sendMessage(COLOR, - (coloringAttributes != null ? + sendMessage(COLOR, + (coloringAttributes != null ? ((ColoringAttributesRetained)coloringAttributes.retained).mirror: null), true); - } + } if (coloringAttributes == null) { @@ -299,10 +299,10 @@ class AppearanceRetained extends NodeComponentRetained { ((TransparencyAttributesRetained)transparencyAttributes.retained).copyMirrorUsers(this); } - sendMessage(TRANSPARENCY, - (transparencyAttributes != null ? + sendMessage(TRANSPARENCY, + (transparencyAttributes != null ? ((TransparencyAttributesRetained)transparencyAttributes.retained).mirror: null), true); - } + } if (transparencyAttributes == null) { @@ -389,12 +389,12 @@ class AppearanceRetained extends NodeComponentRetained { ((PolygonAttributesRetained)polygonAttributes.retained).setLive(inBackgroundGroup, refCount); ((PolygonAttributesRetained)polygonAttributes.retained).copyMirrorUsers(this); } - sendMessage(POLYGON, + sendMessage(POLYGON, (polygonAttributes != null ? ((PolygonAttributesRetained)polygonAttributes.retained).mirror : null), true); - } + } if (polygonAttributes == null) { this.polygonAttributes = null; @@ -432,10 +432,10 @@ class AppearanceRetained extends NodeComponentRetained { ((LineAttributesRetained)lineAttributes.retained).setLive(inBackgroundGroup, refCount); ((LineAttributesRetained)lineAttributes.retained).copyMirrorUsers(this); } - sendMessage(LINE, - (lineAttributes != null ? + sendMessage(LINE, + (lineAttributes != null ? ((LineAttributesRetained)lineAttributes.retained).mirror: null), true); - } + } if (lineAttributes == null) { @@ -473,11 +473,11 @@ class AppearanceRetained extends NodeComponentRetained { ((PointAttributesRetained)pointAttributes.retained).setLive(inBackgroundGroup, refCount); ((PointAttributesRetained)pointAttributes.retained).copyMirrorUsers(this); } - sendMessage(POINT, + sendMessage(POINT, (pointAttributes != null ? - ((PointAttributesRetained)pointAttributes.retained).mirror: + ((PointAttributesRetained)pointAttributes.retained).mirror: null), true); - } + } if (pointAttributes == null) { @@ -515,10 +515,10 @@ class AppearanceRetained extends NodeComponentRetained { ((TexCoordGenerationRetained)texGen.retained).setLive(inBackgroundGroup, refCount); ((TexCoordGenerationRetained)texGen.retained).copyMirrorUsers(this); } - sendMessage(TEXCOORD_GEN, + sendMessage(TEXCOORD_GEN, (texGen != null ? ((TexCoordGenerationRetained)texGen.retained).mirror : null), true); - } + } if (texGen == null) { this.texCoordGeneration = null; @@ -545,7 +545,7 @@ class AppearanceRetained extends NodeComponentRetained { void setTextureUnitState(TextureUnitState[] stateArray) { int i; - + synchronized(liveStateLock) { if (source.isLive()) { @@ -567,9 +567,9 @@ class AppearanceRetained extends NodeComponentRetained { // -1 index means the entire array is to be set args[0] = new Integer(-1); - + // make a copy of the array for the message, - TextureUnitStateRetained mirrorStateArray[] = + TextureUnitStateRetained mirrorStateArray[] = new TextureUnitStateRetained[stateArray.length]; args[1] = (Object) mirrorStateArray; @@ -592,7 +592,7 @@ class AppearanceRetained extends NodeComponentRetained { } else { sendMessage(TEXTURE_UNIT_STATE, null, true); } - } + } // assign the retained copy of the texture unit state to the // appearance @@ -603,14 +603,14 @@ class AppearanceRetained extends NodeComponentRetained { // make another copy of the array for the retained object // itself if it doesn't have a copy or the array size is // not the same - if ((this.texUnitState == null) || + if ((this.texUnitState == null) || (this.texUnitState.length != stateArray.length)) { this.texUnitState = new TextureUnitStateRetained[ stateArray.length]; } for (i = 0; i < stateArray.length; i++) { if (stateArray[i] != null) { - this.texUnitState[i] = + this.texUnitState[i] = (TextureUnitStateRetained)stateArray[i].retained; } else { this.texUnitState[i] = null; @@ -621,7 +621,7 @@ class AppearanceRetained extends NodeComponentRetained { } void setTextureUnitState(int index, TextureUnitState state) { - + synchronized(liveStateLock) { if (source.isLive()) { @@ -648,7 +648,7 @@ class AppearanceRetained extends NodeComponentRetained { args[1] = null; sendMessage(TEXTURE_UNIT_STATE, args, true); } - } + } // assign the retained copy of the texture unit state to the // appearance @@ -672,7 +672,7 @@ class AppearanceRetained extends NodeComponentRetained { if (texUnitState == null) { return null; } else { - TextureUnitState tus[] = + TextureUnitState tus[] = new TextureUnitState[texUnitState.length]; for (int i = 0; i < texUnitState.length; i++) { if (texUnitState[i] != null) { @@ -687,13 +687,13 @@ class AppearanceRetained extends NodeComponentRetained { /** * Retrieves the texture unit state object at the specified - * index within the texture unit state array. + * index within the texture unit state array. */ TextureUnitState getTextureUnitState(int index) { // let Java throw an exception if texUnitState == null or // index is >= length - if (texUnitState[index] != null) + if (texUnitState[index] != null) return (TextureUnitState)texUnitState[index].source; else return null; @@ -719,7 +719,7 @@ class AppearanceRetained extends NodeComponentRetained { synchronized void createMirrorObject() { if (mirror == null) { // we can't check isStatic() since it sub-NodeComponent - // create a new one, we should create a + // create a new one, we should create a // new AppearanceRetained() even though isStatic() = true. // For simplicity, always create a retained side. mirror = new AppearanceRetained(); @@ -742,24 +742,24 @@ class AppearanceRetained extends NodeComponentRetained { // Fix for Issue 33: copy the changedFrequent mask to mirror mirrorApp.changedFrequent = changedFrequent; - if (material != null) { + if (material != null) { mirrorApp.material = (MaterialRetained)material.mirror; } else { mirrorApp.material = null; } - if (texture != null) { + if (texture != null) { mirrorApp.texture = (TextureRetained)texture.mirror; } else { mirrorApp.texture = null; } - if (texCoordGeneration != null) { + if (texCoordGeneration != null) { mirrorApp.texCoordGeneration = (TexCoordGenerationRetained)texCoordGeneration.mirror; } else { mirrorApp.texCoordGeneration = null; } - if (textureAttributes != null) { + if (textureAttributes != null) { mirrorApp.textureAttributes = (TextureAttributesRetained)textureAttributes.mirror; } else { mirrorApp.textureAttributes = null; @@ -767,11 +767,11 @@ class AppearanceRetained extends NodeComponentRetained { // TextureUnitState supercedes the single texture interface if (texUnitState != null && texUnitState.length > 0) { - mirrorApp.texUnitState = + mirrorApp.texUnitState = new TextureUnitStateRetained[texUnitState.length]; for (int i = 0; i < texUnitState.length; i++) { if (texUnitState[i] != null) { - mirrorApp.texUnitState[i] = + mirrorApp.texUnitState[i] = (TextureUnitStateRetained)texUnitState[i].mirror; } } @@ -787,44 +787,44 @@ class AppearanceRetained extends NodeComponentRetained { mirrorApp.texCoordGeneration); } - if (coloringAttributes != null) { + if (coloringAttributes != null) { mirrorApp.coloringAttributes = (ColoringAttributesRetained)coloringAttributes.mirror; } else { mirrorApp.coloringAttributes = null; } - if (transparencyAttributes != null) { + if (transparencyAttributes != null) { mirrorApp.transparencyAttributes = (TransparencyAttributesRetained)transparencyAttributes.mirror; } else { mirrorApp.transparencyAttributes = null; } - if (renderingAttributes != null) { + if (renderingAttributes != null) { mirrorApp.renderingAttributes = (RenderingAttributesRetained)renderingAttributes.mirror; } else { mirrorApp.renderingAttributes = null; } - if (polygonAttributes != null) { + if (polygonAttributes != null) { mirrorApp.polygonAttributes = (PolygonAttributesRetained)polygonAttributes.mirror; } else { mirrorApp.polygonAttributes = null; } - if (lineAttributes != null) { + if (lineAttributes != null) { mirrorApp.lineAttributes = (LineAttributesRetained)lineAttributes.mirror; } else { mirrorApp.lineAttributes = null; } - if (pointAttributes != null) { + if (pointAttributes != null) { mirrorApp.pointAttributes = (PointAttributesRetained)pointAttributes.mirror; } else { mirrorApp.pointAttributes = null; } } - /** - * Update the "component" field of the mirror object with the + /** + * Update the "component" field of the mirror object with the * given "value" */ synchronized void updateMirrorObject(int component, Object value) { @@ -863,10 +863,10 @@ class AppearanceRetained extends NodeComponentRetained { } else { int index = ((Integer)args[0]).intValue(); if (index == -1) { - mirrorApp.texUnitState = + mirrorApp.texUnitState = (TextureUnitStateRetained [])args[1]; } else { - mirrorApp.texUnitState[index] = + mirrorApp.texUnitState[index] = (TextureUnitStateRetained)args[1]; } } @@ -904,9 +904,9 @@ class AppearanceRetained extends NodeComponentRetained { */ void doSetLive(boolean backgroundGroup, int refCount) { // System.err.println("AppearceRetained.doSetLive()"); - - if (material != null) { - + + if (material != null) { + material.setLive(backgroundGroup, refCount); } @@ -921,7 +921,7 @@ class AppearanceRetained extends NodeComponentRetained { } if (textureAttributes != null) { - + textureAttributes.setLive(backgroundGroup, refCount); } @@ -932,7 +932,7 @@ class AppearanceRetained extends NodeComponentRetained { } } - + if (coloringAttributes != null) { coloringAttributes.setLive(backgroundGroup, refCount); } @@ -984,7 +984,7 @@ class AppearanceRetained extends NodeComponentRetained { if (texUnitState != null) { for (int i = 0; i < texUnitState.length; i++) { - if (texUnitState[i] != null) + if (texUnitState[i] != null) texUnitState[i].clearLive(refCount); } } @@ -1022,26 +1022,26 @@ class AppearanceRetained extends NodeComponentRetained { boolean isStatic() { boolean flag; - flag = (source.capabilityBitsEmpty() && + flag = (source.capabilityBitsEmpty() && ((texture == null) || texture.source.capabilityBitsEmpty()) && - ((texCoordGeneration == null) || - texCoordGeneration.source.capabilityBitsEmpty()) && - ((textureAttributes == null) || + ((texCoordGeneration == null) || + texCoordGeneration.source.capabilityBitsEmpty()) && + ((textureAttributes == null) || textureAttributes.source.capabilityBitsEmpty()) && ((coloringAttributes == null) || coloringAttributes.source.capabilityBitsEmpty()) && - ((transparencyAttributes == null) || + ((transparencyAttributes == null) || transparencyAttributes.source.capabilityBitsEmpty()) && - ((renderingAttributes == null) || + ((renderingAttributes == null) || renderingAttributes.source.capabilityBitsEmpty()) && - ((polygonAttributes == null) || + ((polygonAttributes == null) || polygonAttributes.source.capabilityBitsEmpty()) && - ((lineAttributes == null) || + ((lineAttributes == null) || lineAttributes.source.capabilityBitsEmpty()) && - ((pointAttributes == null) || + ((pointAttributes == null) || pointAttributes.source.capabilityBitsEmpty()) && - ((material == null) || + ((material == null) || material.source.capabilityBitsEmpty())); if (!flag) @@ -1081,7 +1081,7 @@ class AppearanceRetained extends NodeComponentRetained { texUnitState[i].compile(compState); } } - + if (coloringAttributes != null) { coloringAttributes.compile(compState); } @@ -1113,13 +1113,13 @@ class AppearanceRetained extends NodeComponentRetained { /** * Returns the hashcode for this object. - * hashcode should be constant for object but same for two objects + * hashcode should be constant for object but same for two objects * if .equals() is true. For an appearance (where .equals() is going * to use the values in the appearance), the only way to have a * constant value is for all appearances to have the same hashcode, so * we use the hashcode of the class obj. * - * Since hashCode is only used by AppearanceMap (at present) we may be + * Since hashCode is only used by AppearanceMap (at present) we may be * able to improve efficency by calcing a hashCode from the values. */ public int hashCode() { @@ -1141,30 +1141,30 @@ class AppearanceRetained extends NodeComponentRetained { ((texture == app.texture) || ((texture != null) && texture.equals(app.texture))) && ((renderingAttributes == app.renderingAttributes) || - ((renderingAttributes != null) && + ((renderingAttributes != null) && renderingAttributes.equivalent( app.renderingAttributes))) && - ((polygonAttributes == app.polygonAttributes) || - ((polygonAttributes != null) && + ((polygonAttributes == app.polygonAttributes) || + ((polygonAttributes != null) && polygonAttributes.equivalent(app.polygonAttributes))) && ((texCoordGeneration == app.texCoordGeneration) || - ((texCoordGeneration != null) && - texCoordGeneration.equivalent(app.texCoordGeneration))) && + ((texCoordGeneration != null) && + texCoordGeneration.equivalent(app.texCoordGeneration))) && ((textureAttributes == app.textureAttributes) || - ((textureAttributes != null) && - textureAttributes.equivalent(app.textureAttributes))) && + ((textureAttributes != null) && + textureAttributes.equivalent(app.textureAttributes))) && ((coloringAttributes == app.coloringAttributes) || - ((coloringAttributes != null) && - coloringAttributes.equivalent(app.coloringAttributes))) && + ((coloringAttributes != null) && + coloringAttributes.equivalent(app.coloringAttributes))) && ((transparencyAttributes == app.transparencyAttributes) || - ((transparencyAttributes != null) && + ((transparencyAttributes != null) && transparencyAttributes.equivalent( - app.transparencyAttributes))) && + app.transparencyAttributes))) && ((lineAttributes == app.lineAttributes) || - ((lineAttributes != null) && - lineAttributes.equivalent(app.lineAttributes))) && + ((lineAttributes != null) && + lineAttributes.equivalent(app.lineAttributes))) && ((pointAttributes == app.pointAttributes) || - ((pointAttributes != null) && + ((pointAttributes != null) && pointAttributes.equivalent(app.pointAttributes))))); if (!flag) @@ -1178,7 +1178,7 @@ class AppearanceRetained extends NodeComponentRetained { return (false); for (int i = 0; i < texUnitState.length; i++) { - if (texUnitState[i] == app.texUnitState[i]) + if (texUnitState[i] == app.texUnitState[i]) continue; if (texUnitState[i] == null || app.texUnitState[i] == null || @@ -1194,14 +1194,14 @@ class AppearanceRetained extends NodeComponentRetained { synchronized void addAMirrorUser(Shape3DRetained shape) { super.addAMirrorUser(shape); - if (material != null) + if (material != null) material.addAMirrorUser(shape); - if (texture != null) + if (texture != null) texture.addAMirrorUser(shape); - if (texCoordGeneration != null) + if (texCoordGeneration != null) texCoordGeneration.addAMirrorUser(shape); - if (textureAttributes != null) + if (textureAttributes != null) textureAttributes.addAMirrorUser(shape); if (texUnitState != null) { @@ -1211,29 +1211,29 @@ class AppearanceRetained extends NodeComponentRetained { } } - if (coloringAttributes != null) + if (coloringAttributes != null) coloringAttributes.addAMirrorUser(shape); - if (transparencyAttributes != null) + if (transparencyAttributes != null) transparencyAttributes.addAMirrorUser(shape); - if (renderingAttributes != null) + if (renderingAttributes != null) renderingAttributes.addAMirrorUser(shape); - if (polygonAttributes != null) + if (polygonAttributes != null) polygonAttributes.addAMirrorUser(shape); - if (lineAttributes != null) + if (lineAttributes != null) lineAttributes.addAMirrorUser(shape); - if (pointAttributes != null) + if (pointAttributes != null) pointAttributes.addAMirrorUser(shape); } synchronized void removeAMirrorUser(Shape3DRetained shape) { super.removeAMirrorUser(shape); - if (material != null) + if (material != null) material.removeAMirrorUser(shape); - if (texture != null) + if (texture != null) texture.removeAMirrorUser(shape); - if (texCoordGeneration != null) + if (texCoordGeneration != null) texCoordGeneration.removeAMirrorUser(shape); - if (textureAttributes != null) + if (textureAttributes != null) textureAttributes.removeAMirrorUser(shape); if (texUnitState != null) { @@ -1243,24 +1243,24 @@ class AppearanceRetained extends NodeComponentRetained { } } - if (coloringAttributes != null) + if (coloringAttributes != null) coloringAttributes.removeAMirrorUser(shape); - if (transparencyAttributes != null) + if (transparencyAttributes != null) transparencyAttributes.removeAMirrorUser(shape); - if (renderingAttributes != null) + if (renderingAttributes != null) renderingAttributes.removeAMirrorUser(shape); - if (polygonAttributes != null) + if (polygonAttributes != null) polygonAttributes.removeAMirrorUser(shape); - if (lineAttributes != null) + if (lineAttributes != null) lineAttributes.removeAMirrorUser(shape); - if (pointAttributes != null) + if (pointAttributes != null) pointAttributes.removeAMirrorUser(shape); } // 3rd argument used only when Rendering Attr comp changes final void sendMessage(int attrMask, Object attr, boolean visible) { ArrayList univList = new ArrayList(); - ArrayList gaList = Shape3DRetained.getGeomAtomsList(mirror.users, univList); + ArrayList gaList = Shape3DRetained.getGeomAtomsList(mirror.users, univList); // Send to rendering attribute structure, regardless of // whether there are users or not (alternate appearance case ..) J3dMessage createMessage = new J3dMessage(); @@ -1274,13 +1274,13 @@ class AppearanceRetained extends NodeComponentRetained { VirtualUniverse.mc.processMessage(createMessage); - + // System.err.println("univList.size is " + univList.size()); for(int i=0; i<univList.size(); i++) { createMessage = new J3dMessage(); createMessage.threads = J3dThread.UPDATE_RENDER; createMessage.type = J3dMessage.APPEARANCE_CHANGED; - + createMessage.universe = (VirtualUniverse) univList.get(i); createMessage.args[0] = this; createMessage.args[1]= new Integer(attrMask); @@ -1293,35 +1293,35 @@ class AppearanceRetained extends NodeComponentRetained { // Send the value itself, since Geometry Structure cannot rely on the // mirror (which may be updated lazily) if (attrMask == RENDERING) { - if (attr != null) { - createMessage.args[4] = visible?Boolean.TRUE:Boolean.FALSE; - } - else { - createMessage.args[4] = Boolean.TRUE; - } - } + if (attr != null) { + createMessage.args[4] = visible?Boolean.TRUE:Boolean.FALSE; + } + else { + createMessage.args[4] = Boolean.TRUE; + } + } VirtualUniverse.mc.processMessage(createMessage); } } - + final void sendRenderingAttributesChangedMessage(boolean visible) { ArrayList univList = new ArrayList(); - ArrayList gaList = Shape3DRetained.getGeomAtomsList(mirror.users, univList); - + ArrayList gaList = Shape3DRetained.getGeomAtomsList(mirror.users, univList); + // System.err.println("univList.size is " + univList.size()); for(int i=0; i<univList.size(); i++) { J3dMessage createMessage = new J3dMessage(); createMessage.threads = J3dThread.UPDATE_GEOMETRY; createMessage.type = J3dMessage.RENDERINGATTRIBUTES_CHANGED; - + createMessage.universe = (VirtualUniverse) univList.get(i); createMessage.args[0] = this; createMessage.args[1] = null; // Sync with RenderingAttrRetained sendMessage createMessage.args[2]= visible?Boolean.TRUE:Boolean.FALSE; - + ArrayList gL = (ArrayList) gaList.get(i); GeometryAtom[] gaArr = new GeometryAtom[gL.size()]; gL.toArray(gaArr); @@ -1342,7 +1342,7 @@ class AppearanceRetained extends NodeComponentRetained { (ta.transparencyMode != TransparencyAttributes.SCREEN_DOOR)))) { return(false); - } + } switch (geoType) { case GeometryRetained.GEO_TYPE_POINT_SET: @@ -1366,12 +1366,12 @@ class AppearanceRetained extends NodeComponentRetained { break; default: if (polygonAttributes != null) { - if((polygonAttributes.polygonMode == + if((polygonAttributes.polygonMode == PolygonAttributes.POLYGON_POINT) && (pointAttributes != null) && pointAttributes.pointAntialiasing) { return (false); - } else if ((polygonAttributes.polygonMode == + } else if ((polygonAttributes.polygonMode == PolygonAttributes.POLYGON_LINE) && (lineAttributes != null) && lineAttributes.lineAntialiasing) { @@ -1382,7 +1382,7 @@ class AppearanceRetained extends NodeComponentRetained { } return(true); - } + } void handleFrequencyChange(int bit) { int mask = 0; diff --git a/src/classes/share/javax/media/j3d/AttributeBin.java b/src/classes/share/javax/media/j3d/AttributeBin.java index 667ea56..88ca9dd 100644 --- a/src/classes/share/javax/media/j3d/AttributeBin.java +++ b/src/classes/share/javax/media/j3d/AttributeBin.java @@ -123,7 +123,7 @@ class AttributeBin extends Object implements ObjectUpdate { this.app = app; else app = null; - + if (renderingAttributes != null) { if (renderingAttributes.changedFrequent != 0) { definingRenderingAttributes = renderingAttributes; @@ -156,24 +156,24 @@ class AttributeBin extends Object implements ObjectUpdate { // If the any reference to the appearance components that is cached renderMolecule // can change frequently, make a separate bin if (soleUser || (ra.geometryAtom.source.appearance != null && - ((ra.geometryAtom.source.appearance.changedFrequent & + ((ra.geometryAtom.source.appearance.changedFrequent & AppearanceRetained.RENDERING) != 0))) { if (app == (Object)ra.geometryAtom.source.appearance) { // if this AttributeBin is currently on a zombie state, // we'll need to put it on the update list to reevaluate // the state, because while it is on a zombie state, - // rendering attributes reference could have been changed. + // rendering attributes reference could have been changed. // Example, application could have detached an appearance, // made changes to the reference, and then // reattached the appearance. In this case, the rendering - // attributes reference change would not have reflected to + // attributes reference change would not have reflected to // the AttributeBin if (numEditingShaderBins == 0) { if ((onUpdateList & ON_CHANGED_FREQUENT_UPDATE_LIST) == 0) { renderBin.aBinUpdateList.add(this); - onUpdateList |= + onUpdateList |= AttributeBin.ON_CHANGED_FREQUENT_UPDATE_LIST; } } @@ -182,11 +182,11 @@ class AttributeBin extends Object implements ObjectUpdate { else { return false; } - + } // Either a changedFrequent or a null case // and the incoming one is not equal or null - // then return; + // then return; // This check also handles null == null case if (definingRenderingAttributes != null) { if ((this.definingRenderingAttributes.changedFrequent != 0) || @@ -217,7 +217,7 @@ class AttributeBin extends Object implements ObjectUpdate { ShaderBin sb; TextureBin t; int i, size; - + size = addShaderBins.size(); if (size > 0) { sb = (ShaderBin)addShaderBins.get(0); @@ -229,7 +229,7 @@ class AttributeBin extends Object implements ObjectUpdate { shaderBinList.prev = sb; shaderBinList = sb; } - + for (i = 1; i < size ; i++) { sb = (ShaderBin)addShaderBins.get(i); sb.next = shaderBinList; @@ -257,7 +257,7 @@ class AttributeBin extends Object implements ObjectUpdate { sb.shaderAttributeSet = sApp.shaderAttributeSet; } sb.shaderAppearance = sApp; - + // TODO : JADA - sort by ShaderProgram to avoid state trashing. addShaderBins.add(sb); if ((onUpdateList & ON_OBJ_UPDATE_LIST) == 0) { @@ -272,8 +272,8 @@ class AttributeBin extends Object implements ObjectUpdate { * Removes the given shaderBin from this AttributeBin. */ void removeShaderBin(ShaderBin sb) { - - // If the shaderBin being remove is contained in addShaderBins, + + // If the shaderBin being remove is contained in addShaderBins, // then remove the shadereBin from the addList if (addShaderBins.contains(sb)) { addShaderBins.remove(addShaderBins.indexOf(sb)); @@ -307,8 +307,8 @@ class AttributeBin extends Object implements ObjectUpdate { void render(Canvas3D cv) { ShaderBin sb; - - boolean visible = (definingRenderingAttributes == null || + + boolean visible = (definingRenderingAttributes == null || definingRenderingAttributes.visible); if ( (renderBin.view.viewCache.visibilityPolicy @@ -317,7 +317,7 @@ class AttributeBin extends Object implements ObjectUpdate { == View.VISIBILITY_DRAW_INVISIBLE && visible)) { return; } - + // include this AttributeBin to the to-be-updated list in Canvas cv.setStateToUpdate(Canvas3D.ATTRIBUTEBIN_BIT, this); @@ -347,7 +347,7 @@ class AttributeBin extends Object implements ObjectUpdate { cv.renderingAttrs = renderingAttrs; } - else if (cv.renderingAttrs != renderingAttrs && + else if (cv.renderingAttrs != renderingAttrs && cv.attributeBin != this) { // Update Attribute Bundles if (definingRenderingAttributes == null) { @@ -362,7 +362,7 @@ class AttributeBin extends Object implements ObjectUpdate { cv.depthBufferEnableOverride); } cv.renderingAttrs = renderingAttrs; - } + } cv.attributeBin = this; cv.canvasDirty &= ~Canvas3D.ATTRIBUTEBIN_DIRTY; } @@ -413,7 +413,7 @@ class AttributeBin extends Object implements ObjectUpdate { void updateFromShaderBin(RenderAtom ra) { AppearanceRetained raApp = ra.geometryAtom.source.appearance; - RenderingAttributesRetained rAttrs = + RenderingAttributesRetained rAttrs = (raApp == null)? null : raApp.renderingAttributes; if (!soleUser && renderingAttrs != rAttrs) { diff --git a/src/classes/share/javax/media/j3d/AudioDevice.java b/src/classes/share/javax/media/j3d/AudioDevice.java index 4c4bd60..ab0daf1 100644 --- a/src/classes/share/javax/media/j3d/AudioDevice.java +++ b/src/classes/share/javax/media/j3d/AudioDevice.java @@ -33,7 +33,7 @@ package javax.media.j3d; /** - * The AudioDevice Class defines and encapsulates the + * The AudioDevice Class defines and encapsulates the * audio device's basic information and characteristics. * <P> * A Java3D application running on a particular machine could have one of @@ -52,13 +52,13 @@ package javax.media.j3d; * outputs to. *<P> * AudioDevice Interface - *<P> + *<P> *<UL> The selection of this device driver is done through methods in the * PhysicalEnvironment object - see PhysicalEnvironment class. * The application would query how many audio devices are available. For * each device, the user can get the AudioDevice object that describes it * and query its characteristics. Once a decision is made about which of - * the available audio devices to use for a PhysicalEnvironment, the + * the available audio devices to use for a PhysicalEnvironment, the * particular device is set into this PhysicalEnvironment's fields. Each * PhysicalEnvironment object may use only a single audio device. *<P> @@ -71,9 +71,9 @@ package javax.media.j3d; *<P> *Initialization *<P><UL> - * Each audio device driver must be initialized. - * The chosen device driver should be initialized before any Java3D - * Sound methods are executed because the implementation of the Sound + * Each audio device driver must be initialized. + * The chosen device driver should be initialized before any Java3D + * Sound methods are executed because the implementation of the Sound * methods, in general, are potentially device driver dependent.</UL> *<P> * Audio Playback Type @@ -92,8 +92,8 @@ package javax.media.j3d; *<P> * Distance to Speaker *<P><UL> - * These methods set and retrieve the distance in meters from the center - * ear (the midpoint between the left and right ears) and one of the + * These methods set and retrieve the distance in meters from the center + * ear (the midpoint between the left and right ears) and one of the * speakers in the listener's environment. For monaural speaker playback, * a typical distance from the listener to the speaker in a workstation * cabinet is 0.76 meters. For stereo speakers placed at the sides of the @@ -111,12 +111,12 @@ package javax.media.j3d; *<P><UL> * While the sound image created for final output to the playback system * is either only mono or stereo (for this version of Java3D) most device - * driver implementations will mix the left and right image signals + * driver implementations will mix the left and right image signals * generated for each rendered sound source before outputting the final * playback image. Each sound source will use N input channels of this * internal mixer. Each implemented Java3D audio device driver will have * its own limitations and driver-specific characteristics. These include - * channel availability and usage (during rendering). Methods for + * channel availability and usage (during rendering). Methods for * querying these device-driver specific characteristics are provided.</UL></UL> *<P> * Instantiating and Registering a New Device @@ -139,7 +139,7 @@ package javax.media.j3d; * environment. See PhysicalEnvironment class for more details.</UL> * <P> * General Rules for calling AudioDevice methods: - * It is illegal for an application to call any non-query AudioDevice method + * It is illegal for an application to call any non-query AudioDevice method * if the AudioDevice is created then explicitly assigned to a * PhysicalEnvironment using PhysicalEnvironment.setAudioDevice(); * When either PhysicalEnvironment.setAudioDevice() is called - including @@ -151,7 +151,7 @@ package javax.media.j3d; * initializes it directly, rather than using PhysicalEnvironment. * setAudioDevice(), that application may make <i>any</i> AudioDevice3D methods calls * without fear of the Java 3D Core also trying to control the AudioDevice. - * Under this condition it is safe to call AudioDevice non-query methods. + * Under this condition it is safe to call AudioDevice non-query methods. */ public interface AudioDevice { @@ -161,7 +161,7 @@ public interface AudioDevice { * Constants * ****************/ - /** + /** * Audio Playback Types * * Types of audio output device Java3D sound is played over: @@ -174,7 +174,7 @@ public interface AudioDevice { public static final int HEADPHONES = 0; /** - * Choosing a + * Choosing a * single near-field monoaural speaker * as the audio playback type * specifies that the audio playback will be through a single speaker @@ -183,11 +183,11 @@ public interface AudioDevice { public static final int MONO_SPEAKER = 1; /** - * Choosing a + * Choosing a * two near-field stereo speakers * as the audio playback type * specifies that the audio playback will be through stereo speakers - * some supplied distance away from, and at some given angle to + * some supplied distance away from, and at some given angle to * the listener. */ public static final int STEREO_SPEAKERS = 2; @@ -239,7 +239,7 @@ public interface AudioDevice { * @param angle in radians from head Z axis and vector from center ear to speaker */ public abstract void setAngleOffsetToSpeaker(float angle); - + /** * Get Angle Offset (in radians) To Speaker. * @return angle in radians from head Z axis and vector from center ear to speaker @@ -248,12 +248,12 @@ public interface AudioDevice { /** * Query total number of channels available for sound rendering - * for this audio device. This returns the maximum number of channels + * for this audio device. This returns the maximum number of channels * available for Java3D sound rendering for all sound sources. * @return total number of channels that can be used for this audio device */ public abstract int getTotalChannels(); - + /** * Query number of channels currently available for use. * During rendering, when sound nodes are playing, this method returns the @@ -262,9 +262,9 @@ public interface AudioDevice { * @return total number of channels current available */ public abstract int getChannelsAvailable(); - + /** - * Query number of channels that are used, or would be used to render + * Query number of channels that are used, or would be used to render * a particular sound node. This method returns the number of channels * needed to render a particular Sound node. The return value is the same * no matter if the Sound is currently active and enabled (being played) or diff --git a/src/classes/share/javax/media/j3d/AudioDevice3D.java b/src/classes/share/javax/media/j3d/AudioDevice3D.java index 81f7e8c..1b9f4b4 100644 --- a/src/classes/share/javax/media/j3d/AudioDevice3D.java +++ b/src/classes/share/javax/media/j3d/AudioDevice3D.java @@ -53,7 +53,7 @@ import javax.vecmath.*; * <P> * Start, stop, pause, unpause, mute, and unmute of sample on the device. * <P> - * Set parameters for each sample corresponding to the fields in the + * Set parameters for each sample corresponding to the fields in the * Sound node. * <P> * Set the current active aural parameters that affect all positional samples. @@ -64,20 +64,20 @@ import javax.vecmath.*; * Sound types match the Sound node classes defined for Java 3D core * for BackgroundSound, PointSound, and ConeSound. The type of sound * a sample is loaded as determines which methods affect it. - * + * * <P> * Sound Data Types * <P> * Samples can be processed as streaming or buffered data. * Fully spatializing sound sources may require data to be buffered. - * + * */ public interface AudioDevice3D extends AudioDevice { /** * Specifies the sound type as background sound. - */ + */ public static final int BACKGROUND_SOUND = 1; /** @@ -109,7 +109,7 @@ public interface AudioDevice3D extends AudioDevice { /** * Accepts a reference to the current View. * Passes reference to current View Object. The PhysicalEnvironment - * parameters (with playback type and speaker placement), and the + * parameters (with playback type and speaker placement), and the * PhysicalBody parameters (position/orientation of ears) * can be obtained from this object, and the transformations to/from * ViewPlatform coordinate (space the listener's head is in) and @@ -136,9 +136,9 @@ public interface AudioDevice3D extends AudioDevice { * specific index, used to reference the sample in future method calls, * is returned. All the rest of the methods described below require * this index as a parameter. - * <P> + * <P> * This method should only be called by Java3D Core and NOT by any application. - * @param soundType defines the type of Sound Node: Background, Point, and + * @param soundType defines the type of Sound Node: Background, Point, and * Cone * @param soundData reference to MediaContainer sound data and cached flag * @return device specific sample index used for referencing this sound @@ -148,7 +148,7 @@ public interface AudioDevice3D extends AudioDevice { /** * Requests that the AudioDevice free all * resources associated with sample with index id. - * <P> + * <P> * This method should only be called by Java3D Core and NOT by any application. * @param index device specific reference number to device driver sample */ @@ -159,7 +159,7 @@ public interface AudioDevice3D extends AudioDevice { * if this information can be determined. * For non-cached * streams, this method returns Sound.DURATION_UNKNOWN. - * <P> + * <P> * This method should only be called by Java3D Core and NOT by any application. * @param index device specific reference number to device driver sample * @return sound duration in milliseconds if this can be determined, @@ -168,47 +168,47 @@ public interface AudioDevice3D extends AudioDevice { public abstract long getSampleDuration(int index); /** - * - * Retrieves the number of channels (on executing audio device) that - * this sound is using, if it is playing, or is expected to use + * + * Retrieves the number of channels (on executing audio device) that + * this sound is using, if it is playing, or is expected to use * if it were begun to be played. This form of this method takes the * sound's current state (including whether it is muted or unmuted) * into account. *<P> - * For some AudioDevice3D implementations: + * For some AudioDevice3D implementations: *<UL> * Muted sound take channels up on the systems mixer (because they're * rendered as samples playing with gain zero. *<P> - * A single sound could be rendered using multiple samples, each taking + * A single sound could be rendered using multiple samples, each taking * up mixer channels. *</UL> - * <P> + * <P> * This method should only be called by Java3D Core and NOT by any application. * @param index device specific reference number to device driver sample * @return number of channels used by sound if it were playing - */ + */ public abstract int getNumberOfChannelsUsed(int index); /** - * - * Retrieves the number of channels (on executing audio device) that + * + * Retrieves the number of channels (on executing audio device) that * this sound is using, if it is playing, or is projected to use if * it were to be started playing. Rather than using the actual current * muted/unmuted state of the sound, the muted parameter is used in * making the determination. - * <P> + * <P> * This method should only be called by Java3D Core and NOT by any application. * @param index device specific reference number to device driver sample * @param muted flag to use as the current muted state ignoring current * mute state * @return number of channels used by sound if it were playing - */ + */ public abstract int getNumberOfChannelsUsed(int index, boolean muted); /** * Begins a sound playing on the AudioDevice. - * <P> + * <P> * This method should only be called by Java3D Core and NOT by any application. * @param index device specific reference number to device driver sample * @return flag denoting if sample was started; 1 if true, 0 if false @@ -220,7 +220,7 @@ public interface AudioDevice3D extends AudioDevice { * was last "started". Note that this start time will be as accurate * as the AudioDevice implementation can make it - but that it is not * guaranteed to be exact. - * <P> + * <P> * This method should only be called by Java3D Core and NOT by any application. * @param index device specific reference number to device driver sample * @return system time in milliseconds of the last time sound was started @@ -229,7 +229,7 @@ public interface AudioDevice3D extends AudioDevice { /** * Stops the sound on the AudioDevice. - * <P> + * <P> * This method should only be called by Java3D Core and NOT by any application. * @param index device specific reference number to device driver sample * associated with sound data to be played @@ -238,12 +238,12 @@ public interface AudioDevice3D extends AudioDevice { public abstract int stopSample(int index); /** - * Sets the overall gain scale factor applied to data associated with this + * Sets the overall gain scale factor applied to data associated with this * source to increase or decrease its overall amplitude. * The gain scale factor value passed into this method is the combined value * of the Sound node's Initial Gain and the current AuralAttribute Gain * scale factors. - * <P> + * <P> * This method should only be called by Java3D Core and NOT by any application. * @param index device specific reference number to device driver sample * @param scaleFactor amplitude (gain) scale factor @@ -252,9 +252,9 @@ public interface AudioDevice3D extends AudioDevice { /** * Sets a sound's loop count. - * A full description of this parameter and how it is used is in + * A full description of this parameter and how it is used is in * the documentation for Sound.setLoop. - * <P> + * <P> * This method should only be called by Java3D Core and NOT by any application. * @param index device specific reference number to device driver sample * @param count number of times sound is looped during play @@ -265,7 +265,7 @@ public interface AudioDevice3D extends AudioDevice { /** * Passes a reference to the concatenated transformation to be applied to * local sound position and direction parameters. - * <P> + * <P> * This method should only be called by Java3D Core and NOT by any application. * @param index device specific reference number to device driver sample * @param trans transformation matrix applied to local coordinate parameters @@ -277,9 +277,9 @@ public interface AudioDevice3D extends AudioDevice { * Sets this sound's location (in Local coordinates) from specified * Point. The form of the position parameter matches those of the PointSound * method of the same name. - * A full description of this parameter and how it is used is in + * A full description of this parameter and how it is used is in * the documentation for PointSound class. - * <P> + * <P> * This method should only be called by Java3D Core and NOT by any application. * @param index device specific reference number to device driver sample * @param position location of Point or Cone Sound in Virtual World @@ -291,10 +291,10 @@ public interface AudioDevice3D extends AudioDevice { /** * Sets this sound's distance gain elliptical attenuation (not - * including filter cutoff frequency) by defining corresponding + * including filter cutoff frequency) by defining corresponding * arrays containing distances from the sound's origin and gain * scale factors applied to all active positional sounds. - * Gain scale factor is applied to sound based on the distance + * Gain scale factor is applied to sound based on the distance * the listener * is from sound source. * These attenuation parameters are ignored for BackgroundSound nodes. @@ -302,9 +302,9 @@ public interface AudioDevice3D extends AudioDevice { * <P> * The form of the attenuation parameters match that of the ConeSound method * of the same name. - * A full description of this parameter and how it is used is in + * A full description of this parameter and how it is used is in * the documentation for ConeSound class. - * <P> + * <P> * This method should only be called by Java3D Core and NOT by any application. * @param index device specific reference number to device driver sample * @param frontDistance defines an array of distance along positive axis @@ -317,17 +317,17 @@ public interface AudioDevice3D extends AudioDevice { * float[] backDistance, float[] backGain) * @see ConeSound#setDistanceGain(Point2f[] frontAttenuation, * Point2f[] backAttenuation) - */ - public abstract void setDistanceGain(int index, + */ + public abstract void setDistanceGain(int index, double[] frontDistance, float[] frontAttenuationScaleFactor, double[] backDistance, float[] backAttenuationScaleFactor); /** * Sets this sound's direction from the local coordinate vector provided. * The form of the direction parameter matches that of the ConeSound method * of the same name. - * A full description of this parameter and how it is used is in + * A full description of this parameter and how it is used is in * the documentation for the ConeSound class. - * <P> + * <P> * This method should only be called by Java3D Core and NOT by any application. * @param index device specific reference number to device driver sample * @param direction the new direction vector in local coordinates @@ -339,22 +339,22 @@ public interface AudioDevice3D extends AudioDevice { /** * Sets this sound's angular gain attenuation (including filter) * by defining corresponding arrays containing angular offsets from - * the sound's axis, gain scale factors, and frequency cutoff applied + * the sound's axis, gain scale factors, and frequency cutoff applied * to all active directional sounds. * Gain scale factor is applied to sound based on the angle between the * sound's axis and the ray from the sound source origin to the listener. - * The form of the attenuation parameter matches that of the ConeSound + * The form of the attenuation parameter matches that of the ConeSound * method of the same name. - * A full description of this parameter and how it is used is in + * A full description of this parameter and how it is used is in * the documentation for the ConeSound class. - * <P> + * <P> * This method should only be called by Java3D Core and NOT by any application. * @param index device specific reference number to device driver sample * @param filterType describes type (if any) of filtering defined by attenuation * @param angle array containing angular distances from sound axis * @param attenuationScaleFactor array containing gain scale factor * @param filterCutoff array containing filter cutoff frequencies. - * The filter values for each tuples can be set to Sound.NO_FILTER. + * The filter values for each tuples can be set to Sound.NO_FILTER. * @see ConeSound#setAngularAttenuation(float[] distance, float[] gain, * float[] filter) * @see ConeSound#setAngularAttenuation(Point3f[] attenuation) @@ -365,9 +365,9 @@ public interface AudioDevice3D extends AudioDevice { /** * Changes the speed of sound factor. - * A full description of this parameter and how it is used is in + * A full description of this parameter and how it is used is in * the documentation for the AuralAttributes class. - * <P> + * <P> * This method should only be called by Java3D Core and NOT by any application. * @param rolloff atmospheric gain scale factor (changing speed of sound) * @see AuralAttributes#setRolloff @@ -378,10 +378,10 @@ public interface AudioDevice3D extends AudioDevice { * Sets the Reflective Coefficient scale factor applied to distinct * low-order early reflections of sound off the surfaces in the region * defined by the current listening region. - * <P> - * A full description of this parameter and how it is used is in + * <P> + * A full description of this parameter and how it is used is in * the documentation for the AuralAttributes class. - * <P> + * <P> * This method should only be called by Java3D Core and NOT by any application. * @param coefficient reflection/absorption factor applied to reverb * @see AuralAttributes#setReflectionCoefficient @@ -395,13 +395,13 @@ public interface AudioDevice3D extends AudioDevice { * explicitly given in milliseconds. * A value for delay time of 0.0 disables * reverberation. - * <P> - * A full description of this parameter and how it is used is in + * <P> + * A full description of this parameter and how it is used is in * the documentation for the AuralAttributes class. - * <P> + * <P> * This method should only be called by Java3D Core and NOT by any application. * @param reverbDelay time between each order of late reflection - * @see AuralAttributes#setReverbDelay(float reverbDelay) + * @see AuralAttributes#setReverbDelay(float reverbDelay) */ public abstract void setReverbDelay(float reverbDelay); @@ -410,9 +410,9 @@ public interface AudioDevice3D extends AudioDevice { * The reverbOrder parameter specifies the number of times reflections are added to * reverberation being calculated. A value of -1 specifies an unbounded * number of reverberations. - * A full description of this parameter and how it is used is in + * A full description of this parameter and how it is used is in * the documentation for the AuralAttributes class. - * <P> + * <P> * This method should only be called by Java3D Core and NOT by any application. * @param reverbOrder number of times reflections added to reverb signal * @see AuralAttributes#setReverbOrder @@ -420,35 +420,35 @@ public interface AudioDevice3D extends AudioDevice { public abstract void setReverbOrder(int reverbOrder); /** - * Sets Distance Filter corresponding arrays containing distances and + * Sets Distance Filter corresponding arrays containing distances and * frequency cutoff applied to all active positional sounds. * Gain scale factor is applied to sound based on the distance the listener * is from the sound source. - * A full description of this parameter and how it is used is in + * A full description of this parameter and how it is used is in * the documentation for the AuralAttributes class. - * <P> + * <P> * This method should only be called by Java3D Core and NOT by any application. * @param filterType denotes the type of filtering to be applied * @param distance array of offset distances from sound origin * @param filterCutoff array of frequency cutoff * @see AuralAttributes#setDistanceFilter(float[] distance, - * float[] frequencyCutoff) - * @see AuralAttributes#setDistanceFilter(Point2f[] attenuation) + * float[] frequencyCutoff) + * @see AuralAttributes#setDistanceFilter(Point2f[] attenuation) */ - public abstract void setDistanceFilter(int filterType, + public abstract void setDistanceFilter(int filterType, double[] distance, float[] filterCutoff); /** - * Specifies a scale factor applied to the frequency (or + * Specifies a scale factor applied to the frequency (or * wavelength). A value less than 1.0 will result of slowing the playback * rate of the sample. A value greater than 1.0 will increase the playback * rate. * This parameter is also used to expand or contract the usual * frequency shift applied to the sound source due to Doppler effect * calculations. Valid values are >= 0.0. - * A full description of this parameter and how it is used is in + * A full description of this parameter and how it is used is in * the documentation for the AuralAttributes class. - * <P> + * <P> * This method should only be called by Java3D Core and NOT by any application. * @param frequencyScaleFactor factor applied to change of frequency * @see AuralAttributes#setFrequencyScaleFactor @@ -457,15 +457,15 @@ public interface AudioDevice3D extends AudioDevice { /** * Sets the Velocity scale factor applied during Doppler Effect calculation. - * This parameter specifies a scale factor applied to the velocity of sound + * This parameter specifies a scale factor applied to the velocity of sound * relative to the listener's position and movement in relation to the sound's * position and movement. This scale factor is multipled by the calculated * velocity portion of the Doppler effect equation used during sound rendering. - * A full description of this parameter and how it is used is in + * A full description of this parameter and how it is used is in * the documentation for the AuralAttributes class. - * <P> + * <P> * This method should only be called by Java3D Core and NOT by any application. - * @param velocityScaleFactor applied to velocity of sound in relation + * @param velocityScaleFactor applied to velocity of sound in relation * to listener * @see AuralAttributes#setVelocityScaleFactor */ @@ -477,21 +477,21 @@ public interface AudioDevice3D extends AudioDevice { * of a playing sound sample. Ideally this is implemented by * stopping a sample and freeing channel resources (rather than * just setting the gain of the sample to zero). - * <P> + * <P> * This method should only be called by Java3D Core and NOT by any application. * @param index device specific reference number to device driver sample - */ + */ public abstract void muteSample(int index); /** * Makes a silently playing sample audible. * In the ideal, this restarts a muted sample by offset from the * beginning by the number of milliseconds since the time the sample - * began playing (rather than setting gain to current non-zero gain). - * <P> + * began playing (rather than setting gain to current non-zero gain). + * <P> * This method should only be called by Java3D Core and NOT by any application. * @param index device specific reference number to device driver sample - */ + */ public abstract void unmuteSample(int index); /** @@ -500,35 +500,35 @@ public interface AudioDevice3D extends AudioDevice { * that it can be unpaused at a later time from the same location in the * sample when the pause was initiated. Pausing a streaming, non-cached * sound sample will be treated as a mute. - * <P> + * <P> * This method should only be called by Java3D Core and NOT by any application. * @param index device specific reference number to device driver sample - */ + */ public abstract void pauseSample(int index); /** * Restarts the paused sample from the location in the sample where * paused. - * <P> + * <P> * This method should only be called by Java3D Core and NOT by any application. * @param index device specific reference number to device driver sample - */ + */ public abstract void unpauseSample(int index); /** - * + * * Explicitly updates a Sample. * This method is called when a Sound is to be explicitly updated. * It is only called when all a sounds parameters are known to have * been passed to the audio device. In this way, an implementation - * can choose to perform lazy-evaluation of a sample, rather than + * can choose to perform lazy-evaluation of a sample, rather than * updating the rendering state of the sample after every individual * parameter changed. * This method can be left as a null method if the implementor so chooses. - * <P> + * <P> * This method should only be called by Java3D Core and NOT by any application. * @param index device specific reference number to device driver sample - */ + */ public abstract void updateSample(int index); } diff --git a/src/classes/share/javax/media/j3d/AudioDevice3DL2.java b/src/classes/share/javax/media/j3d/AudioDevice3DL2.java index 4f5e578..79c098f 100644 --- a/src/classes/share/javax/media/j3d/AudioDevice3DL2.java +++ b/src/classes/share/javax/media/j3d/AudioDevice3DL2.java @@ -37,7 +37,7 @@ package javax.media.j3d; * that are defined in the MIDI Manufactures' Association Interactive Audio * Special Interest Group (MMA IASIG) Level 2 Specification. *<P> - * The reverberation methods of AudioDevice3DL2 interface augment the + * The reverberation methods of AudioDevice3DL2 interface augment the * reverberation methods defined in AudioDevice3D. *<P> * The intent is for this interface to be implemented by AudioDevice Driver @@ -48,10 +48,10 @@ package javax.media.j3d; * to be performed on. *<P> * The non-query methods of this interface should only be called by - * an application if the AudioDevice instance + * an application if the AudioDevice instance * is not referenced by any PhysicalEnvironment * explicitly with .setAudioDevice() or implicitly through Universe - * utility method in which case these are called by Core Java 3D + * utility method in which case these are called by Core Java 3D * Sound classes and Sound Scheduler thread(s). *<P> * After the application chooses the AudioDevice3DL2 implementation @@ -92,17 +92,17 @@ public interface AudioDevice3DL2 extends AudioDevice3D { */ public abstract void pause(); - /** + /** * Resumes audio device engine (if previously paused) without reinitializing * the device. * Causes all paused cached sounds to be resumed and all streaming sounds - * restarted. + * restarted. * <P> * This method should NOT be called by any application if the audio device * is associated with a Physical Environment used by Java3D Core. - * This method will be implicitly called when View (associated with this - * device) is actived. - */ + * This method will be implicitly called when View (associated with this + * device) is actived. + */ public abstract void resume(); /** @@ -128,7 +128,7 @@ public interface AudioDevice3DL2 extends AudioDevice3D { * This method should NOT be called by any application if the audio device * is associated with a Physical Environment used by Java3D Core. * @param sampleId device specific reference number to device driver sample - * @param scaleFactor non-negative factor applied to calculated + * @param scaleFactor non-negative factor applied to calculated * amplitudes for all sounds playing on this device */ public abstract void setRateScaleFactor(int sampleId, float scaleFactor); @@ -151,17 +151,17 @@ public interface AudioDevice3DL2 extends AudioDevice3D { * <P> * This method should NOT be called by any application if the audio device * is associated with a Physical Environment used by Java3D Core. - * @param coefficient late reflection attenuation factor + * @param coefficient late reflection attenuation factor * @see AuralAttributes#setReverbCoefficient */ public abstract void setReverbCoefficient(float coefficient); - /** + /** * Sets the early reflection delay time. * In this form, the parameter specifies the delay time between each order * of reflection (while reverberation is being rendered) explicitly given - * in milliseconds. + * in milliseconds. * Valid values are non-negative floats. * There may be limitations imposed by the device on how small or large this * value can be made. @@ -176,7 +176,7 @@ public interface AudioDevice3DL2 extends AudioDevice3D { * is associated with a Physical Environment used by Java3D Core. * @param reflectionDelay time between each order of early reflection * @see AuralAttributes#setReflectionDelay - */ + */ public abstract void setReflectionDelay(float reflectionDelay); /** @@ -198,7 +198,7 @@ public interface AudioDevice3DL2 extends AudioDevice3D { * Set reverb decay filter. * This provides for frequencies above the given cutoff frequency to be * attenuated during reverb decay at a different rate than frequencies - * below this value. Thus, defining a different reverb decay curve for + * below this value. Thus, defining a different reverb decay curve for * frequencies above the cutoff value. * Default: 1.0 decay is uniform for all frequencies. * <P> @@ -206,7 +206,7 @@ public interface AudioDevice3DL2 extends AudioDevice3D { * Until high frequency attenuation is supported by new Core API, * this will be set by the Core with the value 1.0. * It is highly recommended that this method should NOT be - * called by any application if the audio device is associated with + * called by any application if the audio device is associated with * a Physical Environment used by Java3D Core. * @param frequencyCutoff value of frequencies in Hertz above which a * low-pass filter is applied. @@ -226,14 +226,14 @@ public interface AudioDevice3DL2 extends AudioDevice3D { * <P> * This method should NOT be called by any application if the audio device * is associated with a Physical Environment used by Java3D Core. - * @param diffusion percentage expressed within the range of 0.0 and 1.0 + * @param diffusion percentage expressed within the range of 0.0 and 1.0 * @see AuralAttributes#setDiffusion */ public abstract void setDiffusion(float diffusion); /** * Set reverb density. - * This defines the modal density (also referred to as 'spectral + * This defines the modal density (also referred to as 'spectral * coloration'). * The value of this parameter is expressed as a percent of the audio * device's minimum-to-maximum values for this reverb parameter. @@ -245,10 +245,10 @@ public interface AudioDevice3DL2 extends AudioDevice3D { * This method should NOT be called by any application if the audio device * is associated with a Physical Environment used by Java3D Core. * @param density reverb density expressed as a percentage, - * within the range of 0.0 and 1.0 + * within the range of 0.0 and 1.0 * @see AuralAttributes#setDensity */ - public abstract void setDensity(float density); + public abstract void setDensity(float density); /** @@ -282,7 +282,7 @@ public interface AudioDevice3DL2 extends AudioDevice3D { * called by any application if the audio device is associated with * a Physical Environment used by Java3D Core. * @param frequencyCutoff value of frequencies in Hertz above which a - * low-pass filter is applied. + * low-pass filter is applied. */ public abstract void setObstructionFilter(int sampleId, float frequencyCutoff); @@ -318,7 +318,7 @@ public interface AudioDevice3DL2 extends AudioDevice3D { * called by any application if the audio device is associated with * a Physical Environment used by Java3D Core. * @param frequencyCutoff value of frequencies in Hertz above which a - * low-pass filter is applied. + * low-pass filter is applied. */ public abstract void setOcclusionFilter(int sampleId, float frequencyCutoff); } diff --git a/src/classes/share/javax/media/j3d/AudioDeviceEnumerator.java b/src/classes/share/javax/media/j3d/AudioDeviceEnumerator.java index 122328d..5eb6bf1 100644 --- a/src/classes/share/javax/media/j3d/AudioDeviceEnumerator.java +++ b/src/classes/share/javax/media/j3d/AudioDeviceEnumerator.java @@ -36,7 +36,7 @@ import java.util.NoSuchElementException; /** * The class that enumerates all AudioDevices defined in the environment - * + * * An AudioDeviceEnumerator generates the audio devices defined with the * execution environment of the currently running Java 3D application. */ @@ -50,31 +50,31 @@ class AudioDeviceEnumerator implements Enumeration { device = physicalEnvironment.getAudioDevice(); if(device == null) endOfList = true; - else + else endOfList = false; } void reset() { if(device != null) endOfList = false; - } - - - /** + } + + + /** * Query that tells whether the enumerator has more elements * @return true if the enumerator has more elements, false otherwise - */ + */ public boolean hasMoreElements() { - if(endOfList == false) + if(endOfList == false) return true; - else + else return false; - } + } - /** + /** * Return the next element in the enumerators * @return the next element in this enumerator - */ + */ public Object nextElement() { if (this.hasMoreElements()) { endOfList = true; diff --git a/src/classes/share/javax/media/j3d/AuralAttributes.java b/src/classes/share/javax/media/j3d/AuralAttributes.java index aaac5a8..4843f4c 100644 --- a/src/classes/share/javax/media/j3d/AuralAttributes.java +++ b/src/classes/share/javax/media/j3d/AuralAttributes.java @@ -51,7 +51,7 @@ import javax.vecmath.Point2f; * <P><UL> * Rolloff scale factor is used to model atmospheric changes from normal * speed of sound. The base value, 0.344 meters/millisecond is used - * to approximate the speed of sound through air at room temperature, + * to approximate the speed of sound through air at room temperature, * is multipled by this scale factor whenever the speed of sound is * applied during spatialization calculations. * Valid values are >= 0.0. Values > 1.0 increase the speed of sound, @@ -63,17 +63,17 @@ import javax.vecmath.Point2f; *<UL> * Auralization is the environmental modeling of sound iteratively * reflecting off the surfaces of the bounded region the listener is in. - * Auralization components include + * Auralization components include * early, distinct, low-order reflections and later, dense, * higher-order reflections referred to as reverberation. - * These reflections are attenuated relative to the direct, unreflected + * These reflections are attenuated relative to the direct, unreflected * sound. The difference in gain between direct and reflected sound - * gives the listener a sense of the surface material and + * gives the listener a sense of the surface material and * the relative distance of the sound. - * The delay between the start of the direct sound and start of - * reverberation (as detected by the listener), + * The delay between the start of the direct sound and start of + * reverberation (as detected by the listener), * as well as the length of time reverberation is audible as it - * exponentially decays, give the listener a sense of the size of the + * exponentially decays, give the listener a sense of the size of the * listening space. * <P> * In Java3D's model for auralization there are several parameters @@ -97,8 +97,8 @@ import javax.vecmath.Point2f; * <UL>Diffusion <UL>Echo dispersement of reverberation.</UL></UL> * <UL>Reverb Bounds <UL>Approximates the volume of the listening space. * If specified, it defines the reverberation delay.</UL></UL> - * <UL>Reverb Order <UL>Optionally limits the amount of times during - * reverb calculation that a sound is recursively reflected off the + * <UL>Reverb Order <UL>Optionally limits the amount of times during + * reverb calculation that a sound is recursively reflected off the * bounding region.</UL></UL> * <P> * Reflection Coefficient @@ -108,7 +108,7 @@ import javax.vecmath.Point2f; * for early reflections * of the composite surfaces in the region the listener is in. * This scale factor is applied to the sound's amplitude regardless of the - * sound's position. + * sound's position. * The range of valid values is 0.0 to 1.0. * A value of 1.0 denotes that reflections are unattenuated - * the amplitude of reflected sound waves are not decreased. @@ -171,7 +171,7 @@ import javax.vecmath.Point2f; * Decay Time * <P><UL> * The reverberation decay time explicitly defines the length of time in - * milliseconds it takes for the amplitude of late reflections to + * milliseconds it takes for the amplitude of late reflections to * exponentally decrease to effective zero. * In the case where reverb delay is set non-positive * the renderer will perform the shortest reverberation decay @@ -185,7 +185,7 @@ import javax.vecmath.Point2f; * <P><UL> * The reverberation decay filter defines how frequencies above a given * value are attenuated by the listening space. This allows for modelling - * materials on surfaces that absorb high frequencies at a faster rate + * materials on surfaces that absorb high frequencies at a faster rate * than low frequencies. * </UL> * <P> @@ -196,15 +196,15 @@ import javax.vecmath.Point2f; * is proportional to the number of echos per second heard in late * reverberation, especially noticable at the tail of the reverberation * decay. The greater the diffusion the more 'natural' the reverberation - * decay sounds. Reducing diffusion makes the decay sound hollow as + * decay sounds. Reducing diffusion makes the decay sound hollow as * produced in a small highly reflecive space (such as a bathroom). * </UL> * <P> * Reverberation Density * <P><UL> - * The reverberation density explicitly defines modal reverb density + * The reverberation density explicitly defines modal reverb density * The value for this modal density is proportional to the number of - * resonances heard in late reverberation perceived as spectral + * resonances heard in late reverberation perceived as spectral * coloration. The greater the density, the smoother, less grainy the * later reverberation decay. * </UL> @@ -255,8 +255,8 @@ import javax.vecmath.Point2f; * Values must be > zero for sounds to be heard. If the value is zero, * sounds affected by this AuralAttribute object are paused. * <P> - * To simulate Doppler effect, the relative velocity (change in - * distance in the local coordinate system between the sound source and + * To simulate Doppler effect, the relative velocity (change in + * distance in the local coordinate system between the sound source and * the listener over time, in meters per second) is calculated. This * calculated velocity is multipled by the given VelocityScaleFactor. * Values must be >= zero. If is a scale factor value of zero is given, @@ -507,13 +507,13 @@ public class AuralAttributes extends NodeComponent { ALLOW_REVERB_DELAY_READ, ALLOW_REVERB_ORDER_READ, ALLOW_ROLLOFF_READ, - ALLOW_VELOCITY_SCALE_FACTOR_READ + ALLOW_VELOCITY_SCALE_FACTOR_READ }; - + /** ***************** - * + * * Constructors - * + * * ******************/ /** * Constructs and initializes a new AuralAttributes object using default @@ -535,7 +535,7 @@ public class AuralAttributes extends NodeComponent { * frequency scale factor: 1.0<br> * velocity scale factor: 0.0<br> * </ul> - */ + */ public AuralAttributes() { // Just use default values // set default read capabilities @@ -553,7 +553,7 @@ public class AuralAttributes extends NodeComponent { * @param distanceFilter frequency cutoff * @param frequencyScaleFactor applied to change of pitch * @param velocityScaleFactor applied to velocity of sound in relation to listener - */ + */ public AuralAttributes(float gain, float rolloff, float reflectionCoefficient, @@ -590,7 +590,7 @@ public class AuralAttributes extends NodeComponent { * @param frequencyCutoff distance filter frequency cutoff * @param frequencyScaleFactor applied to velocity/wave-length * @param velocityScaleFactor applied to velocity of sound in relation to listener - */ + */ public AuralAttributes(float gain, float rolloff, float reflectionCoefficient, @@ -679,79 +679,79 @@ public class AuralAttributes extends NodeComponent { /** * Creates the retained mode AuralAttributesRetained object that this * component object will point to. - */ + */ void createRetained() { this.retained = new AuralAttributesRetained(); this.retained.setSource(this); } /** **************************************** - * + * * Attribute Gain * * ****************************************/ /** * Set Attribute Gain (amplitude) scale factor. * @param gain scale factor applied to amplitude of direct and reflected sound - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ public void setAttributeGain(float gain) { if (isLiveOrCompiled()) - if (!this.getCapability(ALLOW_ATTRIBUTE_GAIN_WRITE)) - throw new CapabilityNotSetException(J3dI18N.getString("AuralAttributes0")); + if (!this.getCapability(ALLOW_ATTRIBUTE_GAIN_WRITE)) + throw new CapabilityNotSetException(J3dI18N.getString("AuralAttributes0")); ((AuralAttributesRetained)this.retained).setAttributeGain(gain); } /** * Retrieve Attribute Gain (amplitude). * @return gain amplitude scale factor - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ public float getAttributeGain() { if (isLiveOrCompiled()) - if (!this.getCapability(ALLOW_ATTRIBUTE_GAIN_READ)) - throw new CapabilityNotSetException(J3dI18N.getString("AuralAttributes1")); + if (!this.getCapability(ALLOW_ATTRIBUTE_GAIN_READ)) + throw new CapabilityNotSetException(J3dI18N.getString("AuralAttributes1")); return ((AuralAttributesRetained)this.retained).getAttributeGain(); } /** * Set Attribute Gain Rolloff. * @param rolloff atmospheric gain scale factor (changing speed of sound) - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ public void setRolloff(float rolloff) { if (isLiveOrCompiled()) - if (!this.getCapability(ALLOW_ROLLOFF_WRITE)) - throw new CapabilityNotSetException(J3dI18N.getString("AuralAttributes2")); + if (!this.getCapability(ALLOW_ROLLOFF_WRITE)) + throw new CapabilityNotSetException(J3dI18N.getString("AuralAttributes2")); ((AuralAttributesRetained)this.retained).setRolloff(rolloff); } /** * Retrieve Attribute Gain Rolloff. * @return rolloff atmospheric gain scale factor (changing speed of sound) - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ public float getRolloff() { if (isLiveOrCompiled()) - if (!this.getCapability(ALLOW_ROLLOFF_READ)) - throw new CapabilityNotSetException(J3dI18N.getString("AuralAttributes3")); + if (!this.getCapability(ALLOW_ROLLOFF_READ)) + throw new CapabilityNotSetException(J3dI18N.getString("AuralAttributes3")); return ((AuralAttributesRetained)this.retained).getRolloff(); } /** - * Set Reflective Coefficient. + * Set Reflective Coefficient. * Scales the amplitude of the early reflections of reverberated sounds * @param coefficient reflection/absorption factor applied to reflections - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ public void setReflectionCoefficient(float coefficient) { if (isLiveOrCompiled()) - if (!this.getCapability(ALLOW_REFLECTION_COEFFICIENT_WRITE)) + if (!this.getCapability(ALLOW_REFLECTION_COEFFICIENT_WRITE)) throw new CapabilityNotSetException(J3dI18N.getString("AuralAttributes4")); ((AuralAttributesRetained)this.retained).setReflectionCoefficient(coefficient); } @@ -759,19 +759,19 @@ public class AuralAttributes extends NodeComponent { /** * Retrieve Reflective Coefficient. * @return reflection coeff reflection/absorption factor - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ public float getReflectionCoefficient() { if (isLiveOrCompiled()) - if (!this.getCapability(ALLOW_REFLECTION_COEFFICIENT_READ)) - throw new CapabilityNotSetException(J3dI18N.getString("AuralAttributes21")); + if (!this.getCapability(ALLOW_REFLECTION_COEFFICIENT_READ)) + throw new CapabilityNotSetException(J3dI18N.getString("AuralAttributes21")); return ((AuralAttributesRetained)this.retained).getReflectionCoefficient(); } /********************* * - * Early Reflection Delay + * Early Reflection Delay * ********************/ /** @@ -780,21 +780,21 @@ public class AuralAttributes extends NodeComponent { * direct, unreflected sound and the start of first order early reflections. * In this method, this time is explicitly given in milliseconds. * @param reflectionDelay delay time before start of reverberation - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph * @since Java 3D 1.3 */ public void setReflectionDelay(float reflectionDelay) { if (isLiveOrCompiled()) - if (!this.getCapability(ALLOW_REFLECTION_DELAY_WRITE)) + if (!this.getCapability(ALLOW_REFLECTION_DELAY_WRITE)) throw new CapabilityNotSetException(J3dI18N.getString("AuralAttributes22")); ((AuralAttributesRetained)this.retained).setReflectionDelay(reflectionDelay); } /** * Retrieve Reflection Delay Time. - * @return reflection delay time - * @exception CapabilityNotSetException if appropriate capability is + * @return reflection delay time + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph * @since Java 3D 1.3 */ @@ -811,17 +811,17 @@ public class AuralAttributes extends NodeComponent { * ********************/ /** - * Set Reverb Coefficient. + * Set Reverb Coefficient. * Scale the amplitude of the late reflections including the decaying tail * of reverberated sound. * @param coefficient reflective/absorptive factor applied to late reflections - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph * @since Java 3D 1.3 */ public void setReverbCoefficient(float coefficient) { if (isLiveOrCompiled()) - if (!this.getCapability(ALLOW_REVERB_COEFFICIENT_WRITE)) + if (!this.getCapability(ALLOW_REVERB_COEFFICIENT_WRITE)) throw new CapabilityNotSetException(J3dI18N.getString("AuralAttributes24")); ((AuralAttributesRetained)this.retained).setReverbCoefficient(coefficient); } @@ -829,7 +829,7 @@ public class AuralAttributes extends NodeComponent { /** * Retrieve Reverb Coefficient. * @return late reflection coeff. reflection/absorption factor - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph * @since Java 3D 1.3 */ @@ -842,7 +842,7 @@ public class AuralAttributes extends NodeComponent { /********************* * - * Reverberation Delay + * Reverberation Delay * ********************/ /** @@ -851,25 +851,25 @@ public class AuralAttributes extends NodeComponent { * direct, unreflected sound and the start of reverberation. In this * method, this time is explicitly given in milliseconds. * @param reverbDelay delay time before start of reverberation - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ public void setReverbDelay(float reverbDelay) { if (isLiveOrCompiled()) - if (!this.getCapability(ALLOW_REVERB_DELAY_WRITE)) + if (!this.getCapability(ALLOW_REVERB_DELAY_WRITE)) throw new CapabilityNotSetException(J3dI18N.getString("AuralAttributes5")); ((AuralAttributesRetained)this.retained).setReverbDelay(reverbDelay); } /** * Retrieve Reverberation Delay Time. - * @return reverb delay time - * @exception CapabilityNotSetException if appropriate capability is + * @return reverb delay time + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ public float getReverbDelay() { if (isLiveOrCompiled()) - if (!this.getCapability(ALLOW_REVERB_DELAY_READ)) + if (!this.getCapability(ALLOW_REVERB_DELAY_READ)) throw new CapabilityNotSetException(J3dI18N.getString("AuralAttributes7")); return ((AuralAttributesRetained)this.retained).getReverbDelay(); } @@ -880,11 +880,11 @@ public class AuralAttributes extends NodeComponent { * ********************/ /** - * Set Decay Time + * Set Decay Time * Length of time from the start of late reflections reverberation volume * takes to decay to effective zero (-60 dB of initial signal amplitude). * @param decayTime of late reflections (reverb) in milliseconds - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph * @since Java 3D 1.3 */ @@ -898,7 +898,7 @@ public class AuralAttributes extends NodeComponent { /** * Retrieve Decay Time. * @return reverb decay time - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph * @since Java 3D 1.3 */ @@ -915,13 +915,13 @@ public class AuralAttributes extends NodeComponent { * ********************/ /** - * Set Decay Filter + * Set Decay Filter * In this form, reverberation decay filtering is defined as a low-pass * filter, starting at the given reference frequency. This allows for * higher frequencies to be attenuated at a different (typically faster) * rate than lower frequencies. * @param frequencyCutoff of reverberation decay low-pass filter - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph * @since Java 3D 1.3 */ @@ -935,7 +935,7 @@ public class AuralAttributes extends NodeComponent { /** * Retrieve Decay Filter. * @return reverb decay filter cutoff frequency - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph * @since Java 3D 1.3 */ @@ -952,12 +952,12 @@ public class AuralAttributes extends NodeComponent { * ********************/ /** - * Set Diffusion. + * Set Diffusion. * Sets the echo dispersement of reverberation to an amount between * the minimum (0.0) to the maximum (1.0) available. Changing this * increases/decreases the 'smoothness' of reverb decay. * @param ratio reverberation echo dispersement factor - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph * @since Java 3D 1.3 */ @@ -971,7 +971,7 @@ public class AuralAttributes extends NodeComponent { /** * Retrieve Diffusion. * @return reverb diffusion ratio - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph * @since Java 3D 1.3 */ @@ -988,12 +988,12 @@ public class AuralAttributes extends NodeComponent { * ********************/ /** - * Set Density. + * Set Density. * Sets the density of reverberation to an amount between * the minimum (0.0) to the maximum (1.0) available. Changing this * effects the spectral coloration (timbre) of late reflections. * @param ratio reverberation modal density factor - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph * @since Java 3D 1.3 */ @@ -1007,7 +1007,7 @@ public class AuralAttributes extends NodeComponent { /** * Retrieve Density. * @return reverb density - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph * @since Java 3D 1.3 */ @@ -1019,12 +1019,12 @@ public class AuralAttributes extends NodeComponent { } /** - * @deprecated As of Java 3D version 1.2, replaced by + * @deprecated As of Java 3D version 1.2, replaced by * <code>setReverbBounds(Bounds)</code> */ public void setReverbDelay(Bounds reverbVolume) { if (isLiveOrCompiled()) - if (!this.getCapability(ALLOW_REVERB_DELAY_WRITE)) + if (!this.getCapability(ALLOW_REVERB_DELAY_WRITE)) throw new CapabilityNotSetException(J3dI18N.getString("AuralAttributes5")); ((AuralAttributesRetained)this.retained).setReverbBounds(reverbVolume); } @@ -1033,12 +1033,12 @@ public class AuralAttributes extends NodeComponent { * Set Reverberation Bounds volume. * In this form, the reverberation bounds volume parameter is used to * calculate the reverberation Delay and Decay times. Specification - * of a non-null bounding volume causes the explicit values given for - * Reverb Delay and Decay to be overridden by the implicit values + * of a non-null bounding volume causes the explicit values given for + * Reverb Delay and Decay to be overridden by the implicit values * calculated from these bounds. * ALLOW_REVERB_DELAY_WRITE flag used setting capability of this method. * @param reverbVolume the bounding region - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph * @since Java 3D 1.2 */ @@ -1054,7 +1054,7 @@ public class AuralAttributes extends NodeComponent { * @return reverb bounds volume that defines the Reverberation space and * indirectly the delay/decay * ALLOW_REVERB_DELAY_READ flag used setting capability of this method. - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph * @since Java 3D 1.2 */ @@ -1076,12 +1076,12 @@ public class AuralAttributes extends NodeComponent { * to the reverberation being rendered. * A non-positive value specifies an unbounded number of reflections. * @param reverbOrder limit to the number of times reflections added to reverb signal - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ public void setReverbOrder(int reverbOrder) { if (isLiveOrCompiled()) - if (!this.getCapability(ALLOW_REVERB_ORDER_WRITE)) + if (!this.getCapability(ALLOW_REVERB_ORDER_WRITE)) throw new CapabilityNotSetException(J3dI18N.getString("AuralAttributes8")); ((AuralAttributesRetained)this.retained).setReverbOrder(reverbOrder); } @@ -1089,27 +1089,27 @@ public class AuralAttributes extends NodeComponent { /** * Retrieve Reverberation Order * @return reverb order - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ public int getReverbOrder() { - if (!this.getCapability(ALLOW_REVERB_ORDER_READ)) + if (!this.getCapability(ALLOW_REVERB_ORDER_READ)) if (isLiveOrCompiled()) throw new CapabilityNotSetException(J3dI18N.getString("AuralAttributes9")); return ((AuralAttributesRetained)this.retained).getReverbOrder(); } /** - * Set Distance Filter using a single array containing distances and + * Set Distance Filter using a single array containing distances and * frequency cutoff as pairs of values as a single array of Point2f. * @param attenuation array of pairs of distance and frequency cutoff - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ public void setDistanceFilter(Point2f[] attenuation) { if (isLiveOrCompiled()) - if (!this.getCapability(ALLOW_DISTANCE_FILTER_WRITE)) - throw new CapabilityNotSetException(J3dI18N.getString("AuralAttributes10")); + if (!this.getCapability(ALLOW_DISTANCE_FILTER_WRITE)) + throw new CapabilityNotSetException(J3dI18N.getString("AuralAttributes10")); ((AuralAttributesRetained)this.retained).setDistanceFilter(attenuation); } @@ -1117,20 +1117,20 @@ public class AuralAttributes extends NodeComponent { * Set Distance Filter using separate arrays for distances and frequency * cutoff. The distance and frequencyCutoff arrays should be of the same * length. If the frequencyCutoff array length is greater than the distance - * array length, the frequencyCutoff array elements beyond the length of + * array length, the frequencyCutoff array elements beyond the length of * the distance array are ignored. If the frequencyCutoff array is shorter * than the distance array, the last frequencyCutoff array value is repeated * to fill an array of length equal to distance array. * @param distance array of float distance with corresponding cutoff values * @param frequencyCutoff array of frequency cutoff values in Hertz - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ - public void setDistanceFilter(float[] distance, + public void setDistanceFilter(float[] distance, float[] frequencyCutoff) { if (isLiveOrCompiled()) - if (!this.getCapability(ALLOW_DISTANCE_FILTER_WRITE)) - throw new CapabilityNotSetException(J3dI18N.getString("AuralAttributes10")); + if (!this.getCapability(ALLOW_DISTANCE_FILTER_WRITE)) + throw new CapabilityNotSetException(J3dI18N.getString("AuralAttributes10")); ((AuralAttributesRetained)this.retained).setDistanceFilter( distance, frequencyCutoff ); } @@ -1138,7 +1138,7 @@ public class AuralAttributes extends NodeComponent { /** * Retrieve Distance Filter array length. * @return attenuation array length - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ public int getDistanceFilterLength() { @@ -1146,17 +1146,17 @@ public class AuralAttributes extends NodeComponent { if (!this.getCapability(ALLOW_DISTANCE_FILTER_READ)) throw new CapabilityNotSetException(J3dI18N.getString("AuralAttributes12")); return (((AuralAttributesRetained)this.retained).getDistanceFilterLength()); - } + } /** * Retrieve Distance Filter as a single array containing distances * and frequency cutoff. The distance filter is copied into * the specified array. - * The array must be large enough to hold all of the points. + * The array must be large enough to hold all of the points. * The individual array elements must be allocated by the caller. * @param attenuation array of pairs of distance and frequency cutoff values * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph - */ + */ public void getDistanceFilter(Point2f[] attenuation) { if (isLiveOrCompiled()) if (!this.getCapability(ALLOW_DISTANCE_FILTER_READ)) @@ -1170,34 +1170,34 @@ public class AuralAttributes extends NodeComponent { * and frequency cutoff values. * @param distance array * @param frequencyCutoff cutoff array - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ - public void getDistanceFilter(float[] distance, + public void getDistanceFilter(float[] distance, float[] frequencyCutoff) { if (isLiveOrCompiled()) - if (!this.getCapability(ALLOW_DISTANCE_FILTER_READ)) - throw new CapabilityNotSetException(J3dI18N.getString("AuralAttributes12")); + if (!this.getCapability(ALLOW_DISTANCE_FILTER_READ)) + throw new CapabilityNotSetException(J3dI18N.getString("AuralAttributes12")); ((AuralAttributesRetained)this.retained).getDistanceFilter( distance, frequencyCutoff); } /** - * This parameter specifies a scale factor applied to the frequency + * This parameter specifies a scale factor applied to the frequency * of sound during rendering playback. If the Doppler effect is - * disabled, this scale factor can be used to increase or + * disabled, this scale factor can be used to increase or * decrease the original pitch of the sound. During rendering, - * this scale factor expands or contracts the usual frequency shift - * applied to the sound source due to Doppler calculations. + * this scale factor expands or contracts the usual frequency shift + * applied to the sound source due to Doppler calculations. * Valid values are >= 0.0. * A value of zero causes playing sounds to pause. * @param frequencyScaleFactor factor applied to change of frequency - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ public void setFrequencyScaleFactor(float frequencyScaleFactor) { if (isLiveOrCompiled()) - if (!this.getCapability(ALLOW_FREQUENCY_SCALE_FACTOR_WRITE)) + if (!this.getCapability(ALLOW_FREQUENCY_SCALE_FACTOR_WRITE)) throw new CapabilityNotSetException(J3dI18N.getString("AuralAttributes15")); ((AuralAttributesRetained)this.retained).setFrequencyScaleFactor( frequencyScaleFactor); @@ -1206,12 +1206,12 @@ public class AuralAttributes extends NodeComponent { /** * Retrieve Frequency Scale Factor. * @return scaleFactor factor applied to change of frequency - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ public float getFrequencyScaleFactor() { if (isLiveOrCompiled()) - if (!this.getCapability(ALLOW_FREQUENCY_SCALE_FACTOR_READ)) + if (!this.getCapability(ALLOW_FREQUENCY_SCALE_FACTOR_READ)) throw new CapabilityNotSetException(J3dI18N.getString("AuralAttributes17")); return ((AuralAttributesRetained)this.retained).getFrequencyScaleFactor(); } @@ -1223,21 +1223,21 @@ public class AuralAttributes extends NodeComponent { *********************************/ /** * Set Velocity scale factor applied during Doppler Effect calculation. - * This parameter specifies a scale factor applied to the velocity of - * the sound relative to the listener's position and movement in relation + * This parameter specifies a scale factor applied to the velocity of + * the sound relative to the listener's position and movement in relation * to the sound's position and movement. This scale factor is multipled - * by the calculated velocity portion of the Doppler effect equation used + * by the calculated velocity portion of the Doppler effect equation used * during sound rendering. * A value of zero disables Doppler calculations. - * @param velocityScaleFactor applied to velocity of sound in relation + * @param velocityScaleFactor applied to velocity of sound in relation * to listener - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ public void setVelocityScaleFactor(float velocityScaleFactor) { if (isLiveOrCompiled()) - if (!this.getCapability(ALLOW_VELOCITY_SCALE_FACTOR_WRITE)) - throw new CapabilityNotSetException(J3dI18N.getString("AuralAttributes19")); + if (!this.getCapability(ALLOW_VELOCITY_SCALE_FACTOR_WRITE)) + throw new CapabilityNotSetException(J3dI18N.getString("AuralAttributes19")); ((AuralAttributesRetained)this.retained).setVelocityScaleFactor( velocityScaleFactor); } @@ -1245,13 +1245,13 @@ public class AuralAttributes extends NodeComponent { /** * Retrieve Velocity Scale Factor used to calculate Doppler Effect. * @return scale factor applied to Doppler velocity of sound - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ public float getVelocityScaleFactor() { if (isLiveOrCompiled()) - if (!this.getCapability(ALLOW_VELOCITY_SCALE_FACTOR_READ)) - throw new CapabilityNotSetException(J3dI18N.getString("AuralAttributes20")); + if (!this.getCapability(ALLOW_VELOCITY_SCALE_FACTOR_READ)) + throw new CapabilityNotSetException(J3dI18N.getString("AuralAttributes20")); return ((AuralAttributesRetained)this.retained).getVelocityScaleFactor(); } @@ -1272,7 +1272,7 @@ public class AuralAttributes extends NodeComponent { * the current node. This method is called from the * <code>duplicateNode</code> method. This routine does * the actual duplication of all "local data" (any data defined in - * this object). + * this object). * * @param originalNodeComponent the original node to duplicate. * @param forceDuplicate when set to <code>true</code>, causes the @@ -1284,11 +1284,11 @@ public class AuralAttributes extends NodeComponent { * @see Node#cloneTree * @see NodeComponent#setDuplicateOnCloneTree */ - void duplicateAttributes(NodeComponent originalNodeComponent, - boolean forceDuplicate) { + void duplicateAttributes(NodeComponent originalNodeComponent, + boolean forceDuplicate) { super.duplicateAttributes(originalNodeComponent, forceDuplicate); - + AuralAttributesRetained aural = (AuralAttributesRetained) originalNodeComponent.retained; AuralAttributesRetained rt = (AuralAttributesRetained) retained; diff --git a/src/classes/share/javax/media/j3d/AuralAttributesRetained.java b/src/classes/share/javax/media/j3d/AuralAttributesRetained.java index 2ef094b..ca35483 100644 --- a/src/classes/share/javax/media/j3d/AuralAttributesRetained.java +++ b/src/classes/share/javax/media/j3d/AuralAttributesRetained.java @@ -44,7 +44,7 @@ class AuralAttributesRetained extends NodeComponentRetained { * Gain Scale Factor applied to source with this attribute */ float attributeGain = 1.0f; // Valid values are >= 0.0. - + /** * Atmospheric Rolloff - speed of sound - coeff * Normal gain attenuation based on distance of sound from @@ -59,17 +59,17 @@ class AuralAttributesRetained extends NodeComponentRetained { * * Within Java 3D's model for auralization, the components to * reverberation for a particular space are: - * Reflection and Reverb Coefficients - - * attenuation of sound (uniform for all frequencies) due to - * absorption of reflected sound off materials within the + * Reflection and Reverb Coefficients - + * attenuation of sound (uniform for all frequencies) due to + * absorption of reflected sound off materials within the * listening space. - * Reflection and Reverb Delay - + * Reflection and Reverb Delay - * approximating time from the start of the direct sound that * initial early and late reflection waves take to reach listener. - * Reverb Decay - + * Reverb Decay - * approximating time from the start of the direct sound that * reverberation is audible. - */ + */ /** * Coefficients for reverberation @@ -97,17 +97,17 @@ class AuralAttributesRetained extends NodeComponentRetained { /** * Decay parameters - * Length and timbre of reverb decay tail + * Length and timbre of reverb decay tail */ float decayTime = 1000.0f; // in milliseconds float decayFilter = 5000.0f; // low-pass cutoff frequency - + /** * Reverb Diffusion and Density ratios (0=min, 1=max) */ float diffusion = 1.0f; float density = 1.0f; - + /** * Reverberation order * This limits the number of Reverberation iterations executed while @@ -128,7 +128,7 @@ class AuralAttributesRetained extends NodeComponentRetained { * from the listener. * For now the only supported filterType will be LOW_PASS frequency cutoff. * At some time full FIR filtering will be supported. - */ + */ static final int NO_FILTERING = -1; static final int LOW_PASS = 1; @@ -143,21 +143,21 @@ class AuralAttributesRetained extends NodeComponentRetained { * If there has been no change in the distance between head and sound * source over this delta time: * f' = f - * + * * If there has been a change in the distance between head and sound: * f' = f * Af * v - * + * * When head and sound are moving towards each other then * | (S * Ar) + (deltaV(h,t) * Av) | * v = | -------------------------------- | * | (S * Ar) - (deltaV(s,t) * Av) | - * + * * When head and sound are moving away from each other then * | (S * Ar) - (deltaV(h,t) * Av) | * v = | -------------------------------- | * | (S * Ar) + (deltaV(s,t) * Av) | - * - * + * + * * Af = AuralAttribute frequency scalefactor * Ar = AuralAttribute rolloff scalefactor * Av = AuralAttribute velocity scalefactor @@ -169,8 +169,8 @@ class AuralAttributesRetained extends NodeComponentRetained { * S = Speed of sound * s = Sound source position * t = time - * - * If adjusted velocity of head or adjusted velocity of sound is + * + * If adjusted velocity of head or adjusted velocity of sound is * greater than adjusted speed of sound, f' is undefined. */ /** @@ -182,8 +182,8 @@ class AuralAttributesRetained extends NodeComponentRetained { float frequencyScaleFactor = 1.0f; /** * Velocity Scale Factor - * Float value applied to the Change of distance between Sound Source - * and Listener over some delta time. Non-zero if listener moving + * Float value applied to the Change of distance between Sound Source + * and Listener over some delta time. Non-zero if listener moving * even if sound is not. Value of zero implies no Doppler applied. */ float velocityScaleFactor = 0.0f; @@ -200,12 +200,12 @@ class AuralAttributesRetained extends NodeComponentRetained { /** ** Debug print mechanism for Sound nodes - **/ + **/ static final // 'static final' so compiler doesn't include debugPrint calls boolean debugFlag = false; static final // 'static final' so internal error message are not compiled - boolean internalErrors = false; + boolean internalErrors = false; void debugPrint(String message) { if (debugFlag) // leave test in in case debugFlag made non-static final @@ -221,7 +221,7 @@ class AuralAttributesRetained extends NodeComponentRetained { /** * Set Attribute Gain (amplitude) - * @param gain scale factor applied to amplitude + * @param gain scale factor applied to amplitude */ void setAttributeGain(float gain) { this.attributeGain = gain; @@ -255,7 +255,7 @@ class AuralAttributesRetained extends NodeComponentRetained { /** * Set Reflective Coefficient - * @param reflectionCoefficient reflection/absorption factor applied to + * @param reflectionCoefficient reflection/absorption factor applied to * early reflections. */ void setReflectionCoefficient(float reflectionCoefficient) { @@ -265,7 +265,7 @@ class AuralAttributesRetained extends NodeComponentRetained { } /** * Retrieve Reflective Coefficient - * @return reflection coeff reflection/absorption factor applied to + * @return reflection coeff reflection/absorption factor applied to * early reflections. */ float getReflectionCoefficient() { @@ -284,7 +284,7 @@ class AuralAttributesRetained extends NodeComponentRetained { } /** * Retrieve Reflection Delay Time - * @return reflection delay time + * @return reflection delay time */ float getReflectionDelay() { return this.reflectionDelay; @@ -292,7 +292,7 @@ class AuralAttributesRetained extends NodeComponentRetained { /** * Set Reverb Coefficient - * @param reverbCoefficient reflection/absorption factor applied to + * @param reverbCoefficient reflection/absorption factor applied to * late reflections. */ void setReverbCoefficient(float reverbCoefficient) { @@ -336,7 +336,7 @@ class AuralAttributesRetained extends NodeComponentRetained { } /** * Retrieve Revereration Decay Time - * @return reverb delay time + * @return reverb delay time */ float getDecayTime() { return this.decayTime; @@ -354,7 +354,7 @@ class AuralAttributesRetained extends NodeComponentRetained { /** * Retrieve Revereration Decay Filter - * @return reverb delay Filter + * @return reverb delay Filter */ float getDecayFilter() { return this.decayFilter; @@ -406,11 +406,11 @@ class AuralAttributesRetained extends NodeComponentRetained { this.aaDirty = true; notifyUsers(); } - /** + /** * Retrieve Revereration Delay Bounds volume * @return reverb bounds volume that defines the Reverberation space and * indirectly the delay - */ + */ Bounds getReverbBounds() { return this.reverbBounds; } @@ -461,11 +461,11 @@ class AuralAttributesRetained extends NodeComponentRetained { notifyUsers(); } /** - * Set Distance Filter (based on distances and frequency cutoff) using + * Set Distance Filter (based on distances and frequency cutoff) using * separate arrays * @param distance array containing distance values * @param filter array containing low-pass frequency cutoff values - */ + */ synchronized void setDistanceFilter(float[] distance, float[] filter) { if (distance == null || filter == null) { this.filterType = NO_FILTERING; @@ -515,13 +515,13 @@ class AuralAttributesRetained extends NodeComponentRetained { /** * Retrieve Distance Filter array length * @return attenuation array length - */ - int getDistanceFilterLength() { + */ + int getDistanceFilterLength() { if (distance == null) return 0; else - return this.distance.length; - } + return this.distance.length; + } /** @@ -530,7 +530,7 @@ class AuralAttributesRetained extends NodeComponentRetained { */ void getDistanceFilter(Point2f[] attenuation) { // Write into existing param array already allocated - if (attenuation == null) + if (attenuation == null) return; if (this.distance == null || this.frequencyCutoff == null) return; @@ -560,7 +560,7 @@ class AuralAttributesRetained extends NodeComponentRetained { */ void getDistanceFilter(float[] distance, float[] filter) { // Write into existing param arrays already allocated - if (distance == null || filter == null) + if (distance == null || filter == null) return; if (this.distance == null || this.frequencyCutoff == null) return; @@ -578,7 +578,7 @@ class AuralAttributesRetained extends NodeComponentRetained { int filterLength = this.frequencyCutoff.length; if (filter.length < filterLength) // parameter array not large enough to hold all this.filter data - filterLength = filter.length; + filterLength = filter.length; if (filterType == NO_FILTERING) { for (int i=0; i< filterLength; i++) filter[i] = Sound.NO_FILTER; @@ -669,5 +669,5 @@ class AuralAttributesRetained extends NodeComponentRetained { void update(AuralAttributesRetained aa) { this.reset(aa); } - + } diff --git a/src/classes/share/javax/media/j3d/BHInsertStructure.java b/src/classes/share/javax/media/j3d/BHInsertStructure.java index 0fdcddb..b1d7f2c 100644 --- a/src/classes/share/javax/media/j3d/BHInsertStructure.java +++ b/src/classes/share/javax/media/j3d/BHInsertStructure.java @@ -34,10 +34,10 @@ package javax.media.j3d; import java.util.*; class BHInsertStructure { - + static boolean debug = false; static boolean debug2 = false; - + Random randomNumber; ArrayList[] bhListArr = null; ArrayList[] oldBhListArr = null; @@ -46,25 +46,25 @@ class BHInsertStructure { int bhListArrCnt = 0; int bhListArrMaxCnt = 0; int blockSize = 0; - + BHInsertStructure(int length) { randomNumber = new Random(0); - + if(length > 50) { length = 50; } - + blockSize = 50; bhListArr = new ArrayList[length]; bhListArrRef = new BHNode[length]; bhListArrCnt = 0; - bhListArrMaxCnt = length; - + bhListArrMaxCnt = length; + } - + void clear() { - - for(int i=0; i< bhListArrCnt; i++) { + + for(int i=0; i< bhListArrCnt; i++) { bhListArr[i].clear(); bhListArrRef[i] = null; } @@ -73,7 +73,7 @@ class BHInsertStructure { void lookupAndInsert(BHNode parent, BHNode child) { boolean found = false; - + for ( int i=0; i<bhListArrCnt; i++ ) { // check for current parent if ( bhListArrRef[i] == parent ) { @@ -83,40 +83,40 @@ class BHInsertStructure { break; } } - + if ( !found ) { - + if(bhListArrCnt >= bhListArrMaxCnt) { // allocate a bigger array here.... if(debug) System.err.println("(1) Expanding bhListArr array ..."); - bhListArrMaxCnt += blockSize; + bhListArrMaxCnt += blockSize; oldBhListArr = bhListArr; oldBhListArrRef = bhListArrRef; - + bhListArr = new ArrayList[bhListArrMaxCnt]; bhListArrRef = new BHNode[bhListArrMaxCnt]; System.arraycopy(oldBhListArr, 0, bhListArr, 0, oldBhListArr.length); System.arraycopy(oldBhListArrRef, 0, bhListArrRef, 0, oldBhListArrRef.length); } - + bhListArrRef[bhListArrCnt] = parent; bhListArr[bhListArrCnt] = new ArrayList(); bhListArr[bhListArrCnt].add(child); bhListArrCnt++; } - + } - + void updateBoundingTree(BHTree bhTree) { - + // based on the data in this stucture, update the tree such that // all things work out now .. i.e for each element of the array list // of bhListArr ... create a new reclustered tree. int size, cnt; BHNode child1, child2; - + for ( int i=0; i < bhListArrCnt; i++ ) { // extract and form an array of all children : l, r, and n1 ... nk cnt = 0; @@ -126,9 +126,9 @@ class BHInsertStructure { if(child2 != null) cnt++; size = bhListArr[i].size(); - + BHNode bhArr[] = new BHNode[cnt + size]; - + bhListArr[i].toArray(bhArr); //reset cnt, so that we can reuse it. @@ -138,21 +138,21 @@ class BHInsertStructure { cnt++; bhArr[size + cnt] = child2; } - + if(debug2) if((child1 == null) || (child2 == null)) { System.err.println("child1 or child2 is null ..."); System.err.println("This is bad, it shouldn't happen"); - + } - + ((BHInternalNode)(bhListArrRef[i])).setRightChild(null); - ((BHInternalNode)(bhListArrRef[i])).setLeftChild(null); - - bhTree.cluster((BHInternalNode)bhListArrRef[i], bhArr); + ((BHInternalNode)(bhListArrRef[i])).setLeftChild(null); + + bhTree.cluster((BHInternalNode)bhListArrRef[i], bhArr); } } - + } diff --git a/src/classes/share/javax/media/j3d/BHInternalNode.java b/src/classes/share/javax/media/j3d/BHInternalNode.java index 5e83655..81ac361 100644 --- a/src/classes/share/javax/media/j3d/BHInternalNode.java +++ b/src/classes/share/javax/media/j3d/BHInternalNode.java @@ -34,93 +34,93 @@ package javax.media.j3d; import javax.vecmath.*; class BHInternalNode extends BHNode { - + static boolean debug2 = true; - + BHNode rChild; BHNode lChild; - + BHInternalNode() { super(); nodeType = BH_TYPE_INTERNAL; this.rChild = null; this.lChild = null; } - + BHInternalNode(BHNode parent) { super(parent); nodeType = BH_TYPE_INTERNAL; this.rChild = null; - this.lChild = null; + this.lChild = null; } - + BHInternalNode(BHNode parent, BHNode rChild, BHNode lChild) { super(parent); nodeType = BH_TYPE_INTERNAL; this.rChild = rChild; - this.lChild = lChild; + this.lChild = lChild; } - + BHInternalNode(BHNode parent, BoundingBox bHull) { super(parent, bHull); nodeType = BH_TYPE_INTERNAL; this.rChild = null; - this.lChild = null; + this.lChild = null; } - + BHInternalNode(BHNode parent, BHNode rChild, BHNode lChild, BoundingBox bHull) { super(parent, bHull); nodeType = BH_TYPE_INTERNAL; this.rChild = rChild; - this.lChild = lChild; + this.lChild = lChild; } - + BHNode getLeftChild() { return (BHNode) lChild; } - + BHNode getRightChild() { return (BHNode) rChild; } - + void setLeftChild(BHNode child) { lChild = child; } - + void setRightChild(BHNode child) { rChild = child; } - + void computeBoundingHull(BoundingBox bHull) { computeBoundingHull(); bHull.set(this.bHull); } - + void computeBoundingHull() { BoundingBox rChildBound = null; BoundingBox lChildBound = null; int i; - + if((lChild==null) && (rChild==null)) { bHull = null; return; } - + if(lChild != null) lChildBound = lChild.getBoundingHull(); - + if(rChild != null) rChildBound = rChild.getBoundingHull(); - + if(bHull == null) - bHull = new BoundingBox(); - + bHull = new BoundingBox(); + // Since left child is null. bHull is equal to right child's Hull. if(lChild == null) { bHull.set(rChildBound); return; } - + // Since right child is null. bHull is equal to left child's Hull. if(rChild == null) { bHull.set(lChildBound); @@ -130,21 +130,21 @@ class BHInternalNode extends BHNode { // Compute the combined bounds of the children. bHull.set(rChildBound); bHull.combine(lChildBound); - + } - + void updateMarkedBoundingHull() { - + if(mark == false) return; - + rChild.updateMarkedBoundingHull(); lChild.updateMarkedBoundingHull(); computeBoundingHull(); mark = false; - + } - + // this method inserts a single element into the tree given the stipulation // that the current tree node already contains the child ... 3 cases // one --node is inside the left child, and not inside the right @@ -153,7 +153,7 @@ class BHInternalNode extends BHNode { // recurse placing it inside the right child // three -- node is not inside either one, added it to the current // element - + void insert( BHNode node, BHInsertStructure insertStructure ) { // NOTE: the node must already be inside this node if its not then fail. if(debug2) @@ -161,10 +161,10 @@ class BHInternalNode extends BHNode { System.err.println("Incorrect use of insertion, current node"); System.err.println("must contain the input element ..."); } - + boolean insideRightChild = false; boolean insideLeftChild = false; - + // leaf children are considered inpenetrable for insert so returns false if(this.rChild.nodeType == BHNode.BH_TYPE_LEAF) { insideRightChild = false; @@ -176,7 +176,7 @@ class BHInternalNode extends BHNode { } else { insideLeftChild = this.lChild.isInside(node.bHull); } - + if ( insideLeftChild && !insideRightChild ) { ((BHInternalNode)this.lChild).insert(node, insertStructure); } else if ( !insideLeftChild && insideRightChild ) { @@ -195,16 +195,16 @@ class BHInternalNode extends BHNode { // if not then allocate a new element to the array insertStructure.lookupAndInsert(this, node); } - } + } void destroyTree(BHNode[] bhArr, int[] index) { - + if(rChild != null) rChild.destroyTree(bhArr, index); - + if(lChild != null) lChild.destroyTree(bhArr, index); - + rChild = null; lChild = null; } diff --git a/src/classes/share/javax/media/j3d/BHLeafInterface.java b/src/classes/share/javax/media/j3d/BHLeafInterface.java index bab5263..44f0291 100644 --- a/src/classes/share/javax/media/j3d/BHLeafInterface.java +++ b/src/classes/share/javax/media/j3d/BHLeafInterface.java @@ -32,14 +32,14 @@ package javax.media.j3d; interface BHLeafInterface { - + abstract BoundingBox computeBoundingHull(); abstract boolean isEnable(); abstract boolean isEnable(int visibilityPolicy); - + // Can't use getLocale, it is used by BranchGroupRetained abstract Locale getLocale2(); - + } diff --git a/src/classes/share/javax/media/j3d/BHLeafNode.java b/src/classes/share/javax/media/j3d/BHLeafNode.java index e928967..7b59d98 100644 --- a/src/classes/share/javax/media/j3d/BHLeafNode.java +++ b/src/classes/share/javax/media/j3d/BHLeafNode.java @@ -34,54 +34,54 @@ package javax.media.j3d; import javax.vecmath.*; class BHLeafNode extends BHNode { - + BHLeafInterface leafIF; - + BHLeafNode() { super(); nodeType = BH_TYPE_LEAF; leafIF = null; } - + BHLeafNode(BHNode parent) { super(parent); nodeType = BH_TYPE_LEAF; } - + BHLeafNode(BHLeafInterface lIF) { super(); nodeType = BH_TYPE_LEAF; leafIF = lIF; } - + BHLeafNode(BHNode parent, BHLeafInterface lIF) { super(parent); leafIF = lIF; nodeType = BH_TYPE_LEAF; } - + BHLeafNode(BHNode parent, BoundingBox bHull) { super(parent, bHull); - nodeType = BH_TYPE_LEAF; + nodeType = BH_TYPE_LEAF; } - + BHLeafNode(BHNode parent, BHLeafInterface lIF, BoundingBox bHull) { super(parent, bHull); leafIF = lIF; nodeType = BH_TYPE_LEAF; } - - void computeBoundingHull() { + + void computeBoundingHull() { bHull = leafIF.computeBoundingHull(); } void updateMarkedBoundingHull() { - + if(mark == false) return; computeBoundingHull(); - mark = false; + mark = false; } boolean isEnable() { @@ -91,7 +91,7 @@ class BHLeafNode extends BHNode { boolean isEnable(int vis) { return leafIF.isEnable(vis); } - + Locale getLocale() { return leafIF.getLocale2(); } @@ -103,8 +103,8 @@ class BHLeafNode extends BHNode { } parent = null; - bhArr[index[0]] = this; + bhArr[index[0]] = this; index[0]++; } - + } diff --git a/src/classes/share/javax/media/j3d/BHNode.java b/src/classes/share/javax/media/j3d/BHNode.java index 98603e2..aa8bd22 100644 --- a/src/classes/share/javax/media/j3d/BHNode.java +++ b/src/classes/share/javax/media/j3d/BHNode.java @@ -34,74 +34,74 @@ package javax.media.j3d; import javax.vecmath.*; abstract class BHNode { - + static final byte BH_TYPE_INTERNAL = 1; static final byte BH_TYPE_LEAF = 2; - + static final int NUMBER_OF_PLANES = 6; - + static final boolean debug = false; static final boolean debug2 = false; - - BHNode parent; + + BHNode parent; byte nodeType; BoundingBox bHull = null; boolean mark; - + BHNode () { this.parent = null; mark = false; } - + BHNode (BHNode parent) { this.parent = parent; mark = false; } - + BHNode (BHNode parent, BoundingBox bHull) { this.parent = parent; mark = false; - - this.bHull = bHull; + + this.bHull = bHull; } - + BHNode getParent () { return (this.parent) ; } - + abstract void computeBoundingHull(); abstract void updateMarkedBoundingHull(); abstract void destroyTree(BHNode[] bhArr, int[] index); - + void setParent (BHNode node) { this.parent = node; } - + BoundingBox getBoundingHull() { return (this.bHull); } - + void setBoundingHull(BoundingBox bHull) { - this.bHull = bHull; + this.bHull = bHull; } - + // given two nodes determine the bHull surrounding them, ie. the parent hull void combineBHull(BHNode node1, BHNode node2 ) { BoundingBox bHull1 = null; BoundingBox bHull2 = null; - + bHull1 = node1.getBoundingHull(); bHull2 = node2.getBoundingHull(); - + if(this.bHull==null) this.bHull = new BoundingBox(bHull1); else this.bHull.set(bHull1); - + this.bHull.combine(bHull2); - - } - + + } + // returns true iff the bHull is completely inside this // bounding hull i.e. bHull values are strictly less // than or equal to all this.bHull values @@ -112,7 +112,7 @@ abstract class BHNode { if( this.bHull.isEmpty() || bHull.isEmpty() ) { return false; } - + if( this.bHull.upper.x < bHull.upper.x || this.bHull.upper.y < bHull.upper.y || this.bHull.upper.z < bHull.upper.z || @@ -121,19 +121,19 @@ abstract class BHNode { this.bHull.lower.z > bHull.lower.z ) return false; else - return true; + return true; } - + // finds the node matching the search element in the tree and returns // the node if found, else it returns null if the node couldn't be found BHNode findNode(BHNode node) { BHNode fNode = null; - + if ( this.nodeType == BHNode.BH_TYPE_LEAF) { if ( this == node ) { return this; - } - } + } + } else { if (((BHInternalNode) this).rChild.isInside(node.bHull)) { fNode = ((BHInternalNode)this).rChild.findNode(node); @@ -147,7 +147,7 @@ abstract class BHNode { } return null; } - + void deleteFromParent() { BHInternalNode parent; @@ -159,7 +159,7 @@ abstract class BHNode { else if(parent.lChild == this) parent.lChild = null; else { - if(debug2) { + if(debug2) { System.err.println("BHNode.java: Trouble! No match found. This can't happen."); System.err.println("this " + this ); if ( this.nodeType == BHNode.BH_TYPE_INTERNAL) { @@ -173,30 +173,30 @@ abstract class BHNode { } } } - + // delete all leaf nodes marked with DELETE_UPDATE and update the // bounds of the parents node BHNode deleteAndUpdateMarkedNodes() { - + if (this.mark == true) { if (this.nodeType == BH_TYPE_LEAF) { this.deleteFromParent(); return null; - + } else { if(debug) if(((BHInternalNode)(this)).rChild == ((BHInternalNode)(this)).lChild) System.err.println("rChild " + ((BHInternalNode)(this)).rChild + " lChild " + ((BHInternalNode)(this)).lChild); - - + + if(((BHInternalNode)(this)).rChild != null) - ((BHInternalNode)(this)).rChild = + ((BHInternalNode)(this)).rChild = ((BHInternalNode)(this)).rChild.deleteAndUpdateMarkedNodes(); - if(((BHInternalNode)(this)).lChild != null) - ((BHInternalNode)(this)).lChild = + if(((BHInternalNode)(this)).lChild != null) + ((BHInternalNode)(this)).lChild = ((BHInternalNode)(this)).lChild.deleteAndUpdateMarkedNodes(); - + if ((((BHInternalNode)(this)).rChild == null) && (((BHInternalNode)(this)).lChild == null)) { this.deleteFromParent(); @@ -212,11 +212,11 @@ abstract class BHNode { BHNode rightChild = ((BHInternalNode)this).rChild; rightChild.parent = this.parent; // delete self, return rChild - this.deleteFromParent(); + this.deleteFromParent(); return rightChild; } else { // recompute your bounds and return yourself - this.combineBHull(((BHInternalNode)this).rChild, + this.combineBHull(((BHInternalNode)this).rChild, ((BHInternalNode)this).lChild); // update the parent's pointers ((BHInternalNode)this).rChild.parent = this; @@ -231,10 +231,10 @@ abstract class BHNode { return this; } } - - + + // generic tree gathering statistics operations - + int countNumberOfInternals() { if ( this.nodeType == BHNode.BH_TYPE_LEAF ) { return 0; @@ -243,7 +243,7 @@ abstract class BHNode { ((BHInternalNode)this).lChild.countNumberOfInternals() + 1 ); } } - + // recursively traverse the tree and compute the total number of leaves int countNumberOfLeaves() { if ( this.nodeType == BHNode.BH_TYPE_LEAF ) { @@ -253,27 +253,27 @@ abstract class BHNode { ((BHInternalNode)this).lChild.countNumberOfLeaves() ); } } - - + + // traverse tree and compute the maximum depth to a leaf int computeMaxDepth (int currentDepth) { if ( this.nodeType == BHNode.BH_TYPE_LEAF ) { return (currentDepth); } else { - int rightDepth = ((BHInternalNode)this).rChild.computeMaxDepth(currentDepth + 1); + int rightDepth = ((BHInternalNode)this).rChild.computeMaxDepth(currentDepth + 1); int leftDepth = ((BHInternalNode)this).lChild.computeMaxDepth(currentDepth + 1); if( rightDepth > leftDepth ) return rightDepth; - return leftDepth; + return leftDepth; } } - + // compute the average depth of the leaves ... float computeAverageLeafDepth ( int numberOfLeaves, int currentDepth ) { int sumOfDepths = this.computeSumOfDepths(0); return ( (float)sumOfDepths / (float)numberOfLeaves ); - } - + } + int computeSumOfDepths ( int currentDepth ) { if ( this.nodeType == BHNode.BH_TYPE_LEAF ) { return ( currentDepth ); @@ -282,6 +282,6 @@ abstract class BHNode { ((BHInternalNode)this).lChild.computeSumOfDepths(currentDepth + 1) ) ; } } - - + + } diff --git a/src/classes/share/javax/media/j3d/BHTree.java b/src/classes/share/javax/media/j3d/BHTree.java index 5d08b98..228c5f1 100644 --- a/src/classes/share/javax/media/j3d/BHTree.java +++ b/src/classes/share/javax/media/j3d/BHTree.java @@ -36,15 +36,15 @@ import java.util.Vector; import javax.vecmath.Point4d; class BHTree { - + Locale locale; private BHNode root; private BHInsertStructure insertStructure = null; // Temporary point, so we dont generate garbage - Point4d tPoint4d = new Point4d(); - + Point4d tPoint4d = new Point4d(); + // A flag to signal that number of renderAtoms sent to RenderBin is stable. private boolean stable = false; @@ -58,12 +58,12 @@ class BHTree { static final int DEPTH_UPPER_BOUND = 56; static final int INCR_DEPTH_BOUND = 5; int depthUpperBound = DEPTH_UPPER_BOUND; - + BHTree() { locale = null; root = null; } - + BHTree(Locale loc) { locale = loc; root = null; @@ -82,63 +82,63 @@ class BHTree { Locale getLocale() { return locale; } - + void cluster(BHInternalNode root, BHNode[] bhArr) { if(J3dDebug.devPhase) { if(J3dDebug.doDebug(J3dDebug.bHTree, J3dDebug.LEVEL_4, "BHTree.java :In cluster length is " + bhArr.length - + "\n")) { - + + "\n")) { + for(int i=0; i<bhArr.length; i++) { System.err.println(bhArr[i]); } } } - + if((bhArr == null) || (bhArr.length < 2) || (root == null)){ if(J3dDebug.devPhase) J3dDebug.doDebug(J3dDebug.bHTree, J3dDebug.LEVEL_1, "BHTree.java : cluster : trouble! \n"); return; } - + int centerValuesIndex[] = new int[bhArr.length]; float centerValues[][] = computeCenterValues(bhArr, centerValuesIndex); - - constructTree(root, bhArr, centerValues, centerValuesIndex); - + + constructTree(root, bhArr, centerValues, centerValuesIndex); + } - + // bhArr can only contains BHLeafNode. void boundsChanged(BHNode bhArr[], int size) { // Mark phase. markParentChain(bhArr, size); - + // Compute phase. root.updateMarkedBoundingHull(); } - + // Return true if bhTree's root in encompass by frustumBBox and nothing changed. boolean getVisibleBHTrees(RenderBin rBin, ArrayList bhTrees, BoundingBox frustumBBox, long referenceTime, boolean stateChanged, int visibilityPolicy, boolean singleLocale) { - + int i, j, size; - + if ((frustumBBox != null) && (root != null)) { - + boolean inSide = aEncompassB(frustumBBox, root.bHull); /* - System.err.println("stateChanged is " + stateChanged); + System.err.println("stateChanged is " + stateChanged); System.err.println("frustumBBox is " + frustumBBox); System.err.println("root.bHull is " + root.bHull); System.err.println("inSide is " + inSide); */ - + if(singleLocale && !stateChanged && inSide && stable) { // just return the whole tree, no change in render mol.. // System.err.println("Optimize case 1 ..." + this); @@ -151,7 +151,7 @@ class BHTree { // System.err.println("Optimize case 2 ..." + this); select(rBin, bhTrees, frustumBBox, root, referenceTime, visibilityPolicy, true); - + bhTrees.add(root); stable = true; } else { @@ -166,7 +166,7 @@ class BHTree { return false; } - + private void select(RenderBin rBin, ArrayList bhTrees, BoundingBox frustumBBox, BHNode bh, long referenceTime, int visibilityPolicy, boolean inSide) { @@ -174,19 +174,19 @@ class BHTree { if ((bh == null) || (bh.bHull.isEmpty())) { return; } - + switch(bh.nodeType) { case BHNode.BH_TYPE_LEAF: if((((BHLeafNode) bh).leafIF instanceof GeometryAtom) && (((BHLeafNode) bh).isEnable(visibilityPolicy)) && ((inSide) || (frustumBBox.intersect(bh.bHull)))) { - + // do render atom setup. rBin.processGeometryAtom((GeometryAtom) (((BHLeafNode)bh).leafIF), referenceTime); if(!inSide) { - bhTrees.add(bh); + bhTrees.add(bh); } } break; @@ -197,17 +197,17 @@ class BHTree { referenceTime, visibilityPolicy, true); select(rBin, bhTrees, frustumBBox, ((BHInternalNode)bh).getLeftChild(), - referenceTime, visibilityPolicy, true); + referenceTime, visibilityPolicy, true); } else if(aEncompassB(frustumBBox, bh.bHull)) { - bhTrees.add(bh); + bhTrees.add(bh); select(rBin, bhTrees, frustumBBox, ((BHInternalNode)bh).getRightChild(), referenceTime, visibilityPolicy, true); select(rBin, bhTrees, frustumBBox, ((BHInternalNode)bh).getLeftChild(), referenceTime, visibilityPolicy, true); - } + } else if(frustumBBox.intersect(bh.bHull)) { select(rBin, bhTrees, frustumBBox, ((BHInternalNode)bh).getRightChild(), @@ -216,10 +216,10 @@ class BHTree { ((BHInternalNode)bh).getLeftChild(), referenceTime, visibilityPolicy, false); } - break; + break; } - } - + } + // returns true iff the bBox is completely inside aBox // i.e. bBoxl values are strictly less than or equal to all aBox values. static boolean aEncompassB(BoundingBox aBox, BoundingBox bBox) { @@ -231,7 +231,7 @@ class BHTree { (aBox.lower.z <= bBox.lower.z)); } - + BHLeafInterface selectAny(GeometryAtom atom, int accurancyMode) { if (atom.source.geometryList == null) return null; @@ -243,7 +243,7 @@ class BHTree { return ((BHLeafNode) bhNode).leafIF; } - + BHLeafInterface selectAny(GeometryAtom atoms[], int size, int accurancyMode) { BHNode bhNode = doSelectAny(atoms, size, root, accurancyMode); if (bhNode == null) { @@ -282,7 +282,7 @@ class BHTree { if ((atom.source.sourceNode != leafAtom.source.sourceNode) && (atom.source.collisionVwcBound.intersect(leafAtom.source.collisionVwcBound)) && ((accurancyMode == WakeupOnCollisionEntry.USE_BOUNDS) || - ((leafAtom.source.geometryList != null) && + ((leafAtom.source.geometryList != null) && (atom.source.intersectGeometryList(leafAtom.source))))) { return bh; } @@ -308,13 +308,13 @@ class BHTree { atom = atoms[i]; if (atom.source.collisionVwcBound.intersect(bh.bHull)) { - BHNode hitNode = doSelectAny(atoms, + BHNode hitNode = doSelectAny(atoms, atomSize, ((BHInternalNode) bh).getRightChild(), accurancyMode); if (hitNode != null) return hitNode; - + return doSelectAny(atoms, atomSize, ((BHInternalNode) bh).getLeftChild(), accurancyMode); @@ -337,10 +337,10 @@ class BHTree { GeometryAtom leafAtom = (GeometryAtom) leaf; if ((atom.source.sourceNode != leafAtom.source.sourceNode) && (((BHLeafNode) bh).isEnable()) && - (leafAtom.source.isCollidable) && + (leafAtom.source.isCollidable) && (atom.source.collisionVwcBound.intersect(leafAtom.source.collisionVwcBound)) && ((accurancyMode == WakeupOnCollisionEntry.USE_BOUNDS) || - ((leafAtom.source.geometryList != null) && + ((leafAtom.source.geometryList != null) && (atom.source.intersectGeometryList(leafAtom.source))))) { return bh; } @@ -356,13 +356,13 @@ class BHTree { } return null; case BHNode.BH_TYPE_INTERNAL: - if (atom.source.collisionVwcBound.intersect(bh.bHull)) { - BHNode hitNode = doSelectAny(atom, + if (atom.source.collisionVwcBound.intersect(bh.bHull)) { + BHNode hitNode = doSelectAny(atom, ((BHInternalNode) bh).getRightChild(), accurancyMode); if (hitNode != null) return hitNode; - + return doSelectAny(atom, ((BHInternalNode) bh).getLeftChild(), accurancyMode); @@ -396,10 +396,10 @@ class BHTree { if (leaf instanceof GeometryAtom) { GeometryAtom leafAtom = (GeometryAtom) leaf; if ((((BHLeafNode) bh).isEnable()) && - (leafAtom.source.isCollidable) && + (leafAtom.source.isCollidable) && (bound.intersect(leafAtom.source.collisionVwcBound)) && ((accurancyMode == WakeupOnCollisionEntry.USE_BOUNDS) || - ((leafAtom.source.geometryList != null) && + ((leafAtom.source.geometryList != null) && (leafAtom.source.intersectGeometryList( leafAtom.source.getCurrentLocalToVworld(0), bound))))) { return bh; @@ -414,14 +414,14 @@ class BHTree { } return null; case BHNode.BH_TYPE_INTERNAL: - if (bound.intersect(bh.bHull)) { + if (bound.intersect(bh.bHull)) { BHNode hitNode = doSelectAny(bound, ((BHInternalNode) bh).getRightChild(), accurancyMode, armingNode); if (hitNode != null) return hitNode; - + return doSelectAny(bound, ((BHInternalNode) bh).getLeftChild(), accurancyMode, @@ -457,12 +457,12 @@ class BHTree { if (leaf instanceof GeometryAtom) { GeometryAtom leafAtom = (GeometryAtom) leaf; if ((((BHLeafNode) bh).isEnable()) && - (leafAtom.source.isCollidable) && + (leafAtom.source.isCollidable) && (bound.intersect(leafAtom.source.collisionVwcBound)) && (!isDescendent(leafAtom.source.sourceNode, armingGroup, leafAtom.source.key)) && ((accurancyMode == WakeupOnCollisionEntry.USE_BOUNDS) || - ((leafAtom.source.geometryList != null) && + ((leafAtom.source.geometryList != null) && (leafAtom.source.intersectGeometryList( leafAtom.source.getCurrentLocalToVworld(0), bound))))) { return bh; @@ -478,14 +478,14 @@ class BHTree { } return null; case BHNode.BH_TYPE_INTERNAL: - if (bound.intersect(bh.bHull)) { + if (bound.intersect(bh.bHull)) { BHNode hitNode = doSelectAny(bound, ((BHInternalNode) bh).getRightChild(), accurancyMode, armingGroup); if (hitNode != null) return hitNode; - + return doSelectAny(bound, ((BHInternalNode) bh).getLeftChild(), accurancyMode, @@ -497,7 +497,7 @@ class BHTree { } // Return true if node is a descendent of group - private boolean isDescendent(NodeRetained node, + private boolean isDescendent(NodeRetained node, GroupRetained group, HashKey key) { @@ -508,7 +508,7 @@ class BHTree { key = new HashKey(key); } } - + do { if (node == group) { return true; @@ -538,22 +538,22 @@ class BHTree { void select(PickShape pickShape, UnorderList hitArrList) { - + if((pickShape == null)||(root == null)) return; doSelect(pickShape, hitArrList, root, tPoint4d); - + } - - + + private void doSelect(PickShape pickShape, UnorderList hitArrList, BHNode bh, Point4d pickPos) { - + if ((bh == null) || (bh.bHull.isEmpty())) { return; } - + switch(bh.nodeType) { case BHNode.BH_TYPE_LEAF: if (((BHLeafNode)(bh)).isEnable() && @@ -561,38 +561,38 @@ class BHTree { ((GeometryAtom) (((BHLeafNode) bh).leafIF)).source.isPickable && pickShape.intersect(bh.bHull, pickPos)) { - hitArrList.add(bh); + hitArrList.add(bh); } break; case BHNode.BH_TYPE_INTERNAL: if (pickShape.intersect(bh.bHull, pickPos)) { - doSelect(pickShape, + doSelect(pickShape, hitArrList, ((BHInternalNode)bh).getRightChild(), pickPos); - doSelect(pickShape, + doSelect(pickShape, hitArrList, ((BHInternalNode)bh).getLeftChild(), pickPos); } - break; - } + break; + } } BHNode selectAny(PickShape pickShape) { - + if((pickShape == null)||(root == null)) return null; - + return doSelectAny(pickShape, root, tPoint4d); - + } - - + + private BHNode doSelectAny(PickShape pickShape, BHNode bh, Point4d pickPos) { BHNode hitNode = null; - + if((bh == null) || (bh.bHull.isEmpty())) return null; @@ -604,19 +604,19 @@ class BHTree { bh).leafIF)).source.isPickable && pickShape.intersect(bh.bHull, pickPos)) { return bh; - } + } break; case BHNode.BH_TYPE_INTERNAL: if (pickShape.intersect(bh.bHull, pickPos)) { - hitNode = doSelectAny(pickShape, + hitNode = doSelectAny(pickShape, ((BHInternalNode)bh).getRightChild(), pickPos); - + if (hitNode != null) { return hitNode; } - - return doSelectAny(pickShape, + + return doSelectAny(pickShape, ((BHInternalNode)bh).getLeftChild(), pickPos); } @@ -624,8 +624,8 @@ class BHTree { } return null; } - - + + private void create(BHNode bhArr[]) { int i; @@ -633,34 +633,34 @@ class BHTree { root = null; return; } - - if(bhArr.length == 1) { - bhArr[0].computeBoundingHull(); + + if(bhArr.length == 1) { + bhArr[0].computeBoundingHull(); root = (BHNode)bhArr[0]; return; } - + int centerValuesIndex[] = new int[bhArr.length]; float centerValues[][] = computeCenterValues(bhArr, centerValuesIndex); /* System.err.println("Length of array is " + bhArr.length); - for(int kk=0; kk<bhArr.length;kk++) { - System.err.println("( " + centerValues[kk][0] + ", " + + for(int kk=0; kk<bhArr.length;kk++) { + System.err.println("( " + centerValues[kk][0] + ", " + centerValues[kk][1] + ", " + centerValues[kk][2] + " )"); } */ - + root = new BHInternalNode(); constructTree((BHInternalNode) root, bhArr, centerValues, - centerValuesIndex); + centerValuesIndex); if(J3dDebug.devPhase && J3dDebug.debug) gatherTreeStatistics(); - + } - + void insert(BHNode bhArr[], int size) { // first pass: add all elements to the tree creating k array internal // nodes using the auxiliaryInsertStucture @@ -672,15 +672,15 @@ class BHTree { J3dDebug.doDebug(J3dDebug.bHTree, J3dDebug.LEVEL_4, "BHTree.java : Insert - bhArr.length is " + bhArr.length + "\n"); - + if((bhArr == null) || (size < 1) || (bhArr.length < 1)) - return; - + return; + if(root == null) { if(J3dDebug.devPhase) J3dDebug.doDebug(J3dDebug.bHTree, J3dDebug.LEVEL_4, "BHTree.java : Tree has not be created yet.\n"); - + // This extra "new" is needed, because create() require its input // array's length be equal to the number of inserted nodes. BHNode[] newbhArr = new BHNode[size]; @@ -688,7 +688,7 @@ class BHTree { create(newbhArr); return; } - + if(root.nodeType == BHNode.BH_TYPE_LEAF) { BHNode[] oldBhArr = bhArr; bhArr = new BHNode[size + 1]; @@ -697,36 +697,36 @@ class BHTree { create(bhArr); return; } - + if(insertStructure == null) { insertStructure = new BHInsertStructure(size); } else { insertStructure.clear(); } - + for (int i=0; i<size; i++) { // test if its inside the 'root' element if ( root.isInside(bhArr[i].bHull) ) { ((BHInternalNode)root).insert(bhArr[i], insertStructure); - } + } else { // extend the bounds of root by joining with current element root.bHull.combine(bhArr[i].bHull); insertStructure.lookupAndInsert(root, bhArr[i]); } } - + insertStructure.updateBoundingTree(this); // System.err.println("BHTree - Inserting ..."); - + // Issue 353: clear temporary insertStructure so we don't leak. insertStructure.clear(); - + // Guard against size<1 is done at the start of this method. estMaxDepth += (int) (Math.log(size)/LOG_OF_2) + 1; - - if(estMaxDepth > depthUpperBound) { + + if(estMaxDepth > depthUpperBound) { int maxDepth = root.computeMaxDepth(0); int leafCount = root.countNumberOfLeaves(); double compDepth = Math.log(leafCount)/LOG_OF_2; @@ -736,8 +736,8 @@ class BHTree { System.err.println("maxDepth " + maxDepth); System.err.println("leafCount " + leafCount); */ - - // Upper bound guard. + + // Upper bound guard. if(maxDepth > depthUpperBound) { reConstructTree(leafCount); maxDepth = root.computeMaxDepth(0); @@ -757,27 +757,27 @@ class BHTree { }else if((depthUpperBound != DEPTH_UPPER_BOUND) && (maxDepth * 1.5 < depthUpperBound)) { depthUpperBound = depthUpperBound - INCR_DEPTH_BOUND; - + if(depthUpperBound < DEPTH_UPPER_BOUND) { - // Be sure that DEPTH_UPPER_BOUND is the min. + // Be sure that DEPTH_UPPER_BOUND is the min. depthUpperBound = DEPTH_UPPER_BOUND; } } - + // This is the only place for resetting estMaxDepth to the tree real // maxDepth. Hence in cases where tree may get deteriorate fast, such // as multiple inserts and deletes frequently. estMaxDepth is accuminated, // and will lead to tree re-evaluation and possibly re-balancing. estMaxDepth = maxDepth; } - + } // mark all elements of the node and its parent as needing updating private void markParentChain(BHNode[] nArr, int size) { BHNode node; - + for(int i=0; i<size; i++) { node = nArr[i]; node.mark = true; @@ -796,17 +796,17 @@ class BHTree { node.mark = true; } } - + // Delete a series of n node elements from the input binary tree. // These elements are removed from the tree in a 2 phase process. // First, all elements to be removed are marked and all parent // chains are marked ... then a second phase of the algorithm goes // through and deletes them and updates all of the bounds ... - + // delete the n elements in the array from the tree void delete(BHNode bhArr[], int size) { BHNode node; - + /* if((bhArr == null) || (bhArr.length < 1)) return; @@ -814,9 +814,9 @@ class BHTree { bhArr.length); for(int i=0; i<bhArr.length; i++) System.err.println("bhArr[" + i +"] " + bhArr[i]); - + */ - + for(int i=0; i<size; i++) { if((bhArr[i] != null) && (bhArr[i].nodeType == BHNode.BH_TYPE_LEAF)) { markParentChain(bhArr[i]); @@ -829,65 +829,65 @@ class BHTree { "In tree = " + this + " can not delete it ...\n"); } - + } - + root = root.deleteAndUpdateMarkedNodes(); - + if(J3dDebug.devPhase) if (root == null) { J3dDebug.doDebug(J3dDebug.bHTree, J3dDebug.LEVEL_4, "Tree has been completely deleted ...\n"); - } + } } - + // compute the center values along each of the three dimensions given // the array of leaf objects to be split and joined float[][] computeCenterValues(BHNode[] bhArr, int[] cIndex) { float centers[][] = new float[bhArr.length][3]; - + // compute the center values of the input array of nodes for ( int i=0; i < bhArr.length; i++ ) { cIndex[i] = i; - + bhArr[i].computeBoundingHull(); - + centers[i][0] = (float)((bhArr[i].bHull.upper.x + bhArr[i].bHull.lower.x))/ 2.0f; centers[i][1] = (float)((bhArr[i].bHull.upper.y + bhArr[i].bHull.lower.y)) / 2.0f; centers[i][2] = (float)((bhArr[i].bHull.upper.z + bhArr[i].bHull.lower.z)) / 2.0f; - + } return centers; } - - + + void computeMeansAndSumSquares(float[][] centerValues, int[] centerValuesIndex, float[] means, float[] ss) { - + int i, arrLen; float sumCenters[] = new float[3]; float temp = 0.0f; - + arrLen = centerValuesIndex.length; // Initialization. for(i=2; i>=0; i--) { sumCenters[i] = 0.0f; ss[i] = 0.0f; } - + for(i=arrLen-1; i>=0 ; i--) { sumCenters[0] += centerValues[centerValuesIndex[i]][0]; sumCenters[1] += centerValues[centerValuesIndex[i]][1]; sumCenters[2] += centerValues[centerValuesIndex[i]][2]; } - + means[0] = sumCenters[0]/(float)arrLen; means[1] = sumCenters[1]/(float)arrLen; means[2] = sumCenters[2]/(float)arrLen; - + for(i=arrLen-1; i>=0 ; i--) { temp = (centerValues[centerValuesIndex[i]][0] - means[0]); ss[0] += (temp*temp); @@ -895,17 +895,17 @@ class BHTree { ss[1] += (temp*temp); temp = (centerValues[centerValuesIndex[i]][2] - means[2]); ss[2] += (temp*temp); - - } - + + } + } - + // find the split axis (the highest ss and return its index) for // a given set of ss values int findSplitAxis ( float ss[] ) { int splitAxis = -1; float maxSS = 0.0f; - + // the largest ss index value for (int i=0; i < 3; i++) { if ( ss[i] > maxSS ) { @@ -915,18 +915,18 @@ class BHTree { } return splitAxis; } - - // Recursive method for constructing a binary tree. + + // Recursive method for constructing a binary tree. void constructTree( BHInternalNode parent, BHNode bhArr[], - float[][] centerValues, + float[][] centerValues, int[] centerValuesIndex ){ - + int i, splitAxis; int rightSetCount = 0; int leftSetCount = 0; float means[] = new float[3]; float ss[] = new float[3]; - + if(J3dDebug.devPhase) if ( bhArr.length <= 1 ) { // this is only here for debugging can be removed after testing @@ -934,22 +934,22 @@ class BHTree { J3dDebug.doDebug(J3dDebug.bHTree, J3dDebug.LEVEL_1, "constructTree - bhArr.length <= 1. Bad !!!\n"); } - + computeMeansAndSumSquares(centerValues, centerValuesIndex, means, ss); - + splitAxis = findSplitAxis(ss); // an array of decision variables for storing the values of inside // the right or left set for a particular element of bhArr. // true if its in the left set, false if its in the right set boolean leftOrRightSet[] = new boolean[bhArr.length]; - + if ( splitAxis == -1 ) { // This is bad. Since we can't find a split axis, the best thing // to do is to split the set in two sets; each with about the // same number of elements. By doing this we can avoid constructing // a skew tree. - + // split elements into half. for ( i=0; i < bhArr.length; i++) { if(leftSetCount > rightSetCount) { @@ -958,7 +958,7 @@ class BHTree { } else { leftSetCount++; leftOrRightSet[i] = true; - } + } } } else { @@ -966,7 +966,7 @@ class BHTree { // the split criterion, special multiple equals cases added if ( centerValues[centerValuesIndex[i]][splitAxis] < means[splitAxis]) { - + if(J3dDebug.devPhase) J3dDebug.doDebug(J3dDebug.bHTree, J3dDebug.LEVEL_4, "Found a left element\n"); @@ -1000,8 +1000,8 @@ class BHTree { rightSetCount + "\n"); - // Don't think that this guard is needed, but still like to have it. - // Just in case, bad means and the sum of squares might lead us into the guard. + // Don't think that this guard is needed, but still like to have it. + // Just in case, bad means and the sum of squares might lead us into the guard. if (leftSetCount == bhArr.length) { if(J3dDebug.devPhase) J3dDebug.doDebug(J3dDebug.bHTree, J3dDebug.LEVEL_1, @@ -1017,8 +1017,8 @@ class BHTree { } else { leftSetCount++; leftOrRightSet[i] = true; - } - } + } + } } else if (rightSetCount == bhArr.length) { if(J3dDebug.devPhase) J3dDebug.doDebug(J3dDebug.bHTree, J3dDebug.LEVEL_1, @@ -1034,29 +1034,29 @@ class BHTree { } else { leftSetCount++; leftOrRightSet[i] = true; - } + } } } - + if(J3dDebug.devPhase) if(J3dDebug.doDebug(J3dDebug.bHTree, J3dDebug.LEVEL_4)) // check to make sure that rightSet and leftSet sum to the // number of elements in the original array. if ( bhArr.length != (rightSetCount + leftSetCount) ) { - System.err.println("An error has occurred in spliting"); + System.err.println("An error has occurred in spliting"); } - + BHNode rightSet[] = new BHNode[rightSetCount]; BHNode leftSet[] = new BHNode[leftSetCount]; int centerValuesIndexR[] = new int[rightSetCount]; int centerValuesIndexL[] = new int[leftSetCount]; - + rightSetCount = 0; leftSetCount = 0; - + for (i=0; i < bhArr.length; i++) { if ( leftOrRightSet[i] ) { // element in left set - leftSet[leftSetCount] = bhArr[i]; + leftSet[leftSetCount] = bhArr[i]; centerValuesIndexL[leftSetCount] = centerValuesIndex[i]; leftSetCount++; } else { @@ -1065,27 +1065,27 @@ class BHTree { rightSetCount++; } } - + if (rightSet.length != 1) { parent.rChild = new BHInternalNode(); parent.rChild.setParent(parent); constructTree((BHInternalNode)(parent.rChild), rightSet, centerValues, - centerValuesIndexR); + centerValuesIndexR); } else { parent.rChild = rightSet[0]; parent.rChild.setParent(parent); } - + if (leftSet.length != 1) { parent.lChild = new BHInternalNode(); parent.lChild.setParent(parent); - constructTree((BHInternalNode)(parent.lChild), leftSet, centerValues, - centerValuesIndexL); + constructTree((BHInternalNode)(parent.lChild), leftSet, centerValues, + centerValuesIndexL); } else { parent.lChild = leftSet[0]; parent.lChild.setParent(parent); } - + parent.combineBHull(parent.rChild, parent.lChild); } @@ -1102,23 +1102,23 @@ class BHTree { /* if(bhArr.length != index[0]) System.err.println("BHTree - This isn't right!!! - bhArr.length " + - bhArr.length + " index " + index[0]); + bhArr.length + " index " + index[0]); */ - + create(bhArr); } - + void gatherTreeStatistics() { - + int leafCount = root.countNumberOfLeaves(); int internalCount = root.countNumberOfInternals(); int maxDepth = root.computeMaxDepth(0); - float averageDepth = root.computeAverageLeafDepth ( leafCount, 0); - - + float averageDepth = root.computeAverageLeafDepth ( leafCount, 0); + + System.err.println("Statistics for tree = " + this); - System.err.println("Total Number of nodes in tree = " + + System.err.println("Total Number of nodes in tree = " + (leafCount + internalCount) ); System.err.println("Number of Leaf Nodes = " + leafCount ); System.err.println("Number of Internal Nodes = " + internalCount ); @@ -1126,8 +1126,8 @@ class BHTree { System.err.println("Average Leaf depth = " + averageDepth ); System.err.println("root.bHull = " + root.bHull); // printTree(root); - - } + + } void printTree(BHNode bh) { @@ -1142,9 +1142,9 @@ class BHTree { } else if(bh.nodeType == BHNode.BH_TYPE_LEAF) { System.err.println("BH_TYPE_LEAF - bHull : " + bh); - System.err.println(bh.bHull); + System.err.println(bh.bHull); } - + } diff --git a/src/classes/share/javax/media/j3d/Background.java b/src/classes/share/javax/media/j3d/Background.java index fcc9361..1a975b6 100644 --- a/src/classes/share/javax/media/j3d/Background.java +++ b/src/classes/share/javax/media/j3d/Background.java @@ -231,7 +231,7 @@ public class Background extends Leaf { * * @since Java 3D 1.3 */ - public static final int SCALE_REPEAT = 4; + public static final int SCALE_REPEAT = 4; /** * Indicates that the background image is centered in the window @@ -245,8 +245,8 @@ public class Background extends Leaf { * * @since Java 3D 1.3 */ - public static final int SCALE_NONE_CENTER = 5; - + public static final int SCALE_NONE_CENTER = 5; + // Array for setting default read capabilities private static final int[] readCapabilities = { ALLOW_APPLICATION_BOUNDS_READ, @@ -255,8 +255,8 @@ public class Background extends Leaf { ALLOW_IMAGE_READ, ALLOW_IMAGE_SCALE_MODE_READ }; - - + + /** * Constructs a Background node with default parameters. The default * values are as follows: @@ -308,16 +308,16 @@ public class Background extends Leaf { * filled with the background color. * * @param image pixel array object used as the background image - * + * * @exception IllegalArgumentException if the image class of the specified * ImageComponent2D is ImageClass.NIO_IMAGE_BUFFER. */ public Background(ImageComponent2D image) { // set default read capabilities setDefaultReadCapabilities(readCapabilities); - - if((image != null) && - (image.getImageClass() == ImageComponent.ImageClass.NIO_IMAGE_BUFFER)) { + + if((image != null) && + (image.getImageClass() == ImageComponent.ImageClass.NIO_IMAGE_BUFFER)) { throw new IllegalArgumentException(J3dI18N.getString("Background14")); } @@ -357,7 +357,7 @@ public class Background extends Leaf { if(!this.getCapability(ALLOW_COLOR_WRITE)) throw new CapabilityNotSetException(J3dI18N.getString("Background0")); - if (isLive()) + if (isLive()) ((BackgroundRetained)this.retained).setColor(color); else ((BackgroundRetained)this.retained).initColor(color); @@ -429,8 +429,8 @@ public class Background extends Leaf { BackgroundRetained bgRetained = (BackgroundRetained)this.retained; - if((image != null) && - (image.getImageClass() == ImageComponent.ImageClass.NIO_IMAGE_BUFFER)) { + if((image != null) && + (image.getImageClass() == ImageComponent.ImageClass.NIO_IMAGE_BUFFER)) { throw new IllegalArgumentException(J3dI18N.getString("Background14")); } @@ -446,7 +446,7 @@ public class Background extends Leaf { } } } - + if (isLive()) bgRetained.setImage(image); else @@ -498,12 +498,12 @@ public class Background extends Leaf { default: throw new IllegalArgumentException(J3dI18N.getString("Background11")); } - + if (isLive()) ((BackgroundRetained)this.retained).setImageScaleMode(imageScaleMode); else ((BackgroundRetained)this.retained).initImageScaleMode(imageScaleMode); - + } /** @@ -572,7 +572,7 @@ public class Background extends Leaf { * region. * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph - */ + */ public void setApplicationBounds(Bounds region) { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_APPLICATION_BOUNDS_WRITE)) @@ -584,12 +584,12 @@ public class Background extends Leaf { ((BackgroundRetained)this.retained).initApplicationBounds(region); } - /** + /** * Retrieves the Background node's application bounds. * @return this Background's application bounds information * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph - */ + */ public Bounds getApplicationBounds() { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_APPLICATION_BOUNDS_READ)) @@ -606,7 +606,7 @@ public class Background extends Leaf { * node's new application region. * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph - */ + */ public void setApplicationBoundingLeaf(BoundingLeaf region) { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_APPLICATION_BOUNDS_WRITE)) @@ -618,12 +618,12 @@ public class Background extends Leaf { ((BackgroundRetained)this.retained).initApplicationBoundingLeaf(region); } - /** + /** * Retrieves the Background node's application bounding leaf. * @return this Background's application bounding leaf information * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph - */ + */ public BoundingLeaf getApplicationBoundingLeaf() { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_APPLICATION_BOUNDS_READ)) @@ -641,7 +641,7 @@ public class Background extends Leaf { this.retained.setSource(this); } - + /** * Creates a new instance of the node. This routine is called * by <code>cloneTree</code> to duplicate the current node. @@ -650,7 +650,7 @@ public class Background extends Leaf { * <code>false</code>, the value of each node's * <code>duplicateOnCloneTree</code> variable determines whether * NodeComponent data is duplicated or copied.<br> - * Background geometry will not clone in this operation. + * Background geometry will not clone in this operation. * It is the user's responsibility * to call <code>cloneTree</code> on that branchGroup. * @@ -665,7 +665,7 @@ public class Background extends Leaf { return b; } - + /** * Copies all node information from <code>originalNode</code> into * the current node. This method is called from the @@ -691,7 +691,7 @@ public class Background extends Leaf { * <code>false</code>, the value of each node's * <code>duplicateOnCloneTree</code> variable determines whether * NodeComponent data is duplicated or copied. - * @exception ClassCastException if originalNode is not an instance of + * @exception ClassCastException if originalNode is not an instance of * <code>Background</code> * * @see Node#cloneTree @@ -709,7 +709,7 @@ public class Background extends Leaf { * <code>originalNode</code> into * the current node. This method is called from the * <code>cloneNode</code> method which is, in turn, called by the - * <code>cloneTree</code> method.<P> + * <code>cloneTree</code> method.<P> * * @param originalNode the original node to duplicate * @param forceDuplicate when set to <code>true</code>, causes the @@ -740,14 +740,14 @@ public class Background extends Leaf { rt.initGeometry((BranchGroup) (attr.getGeometry() == null ? null : attr.getGeometry().cloneTree(true))); rt.initImage((ImageComponent2D) getNodeComponent( attr.getImage(), - forceDuplicate, + forceDuplicate, originalNode.nodeHashtable)); // this will be updated in updateNodeReferences rt.initApplicationBoundingLeaf(attr.getApplicationBoundingLeaf()); } - + /** * Callback used to allow a node to check if any scene graph objects * referenced diff --git a/src/classes/share/javax/media/j3d/BackgroundRetained.java b/src/classes/share/javax/media/j3d/BackgroundRetained.java index 76b5ba6..fee0094 100644 --- a/src/classes/share/javax/media/j3d/BackgroundRetained.java +++ b/src/classes/share/javax/media/j3d/BackgroundRetained.java @@ -57,21 +57,21 @@ class BackgroundRetained extends LeafRetained { Color3f color = new Color3f(0.0f, 0.0f, 0.0f); ImageComponent2DRetained image = null; Texture2DRetained texture = null; - + // the image scale mode if image is used. - int imageScaleMode = Background.SCALE_NONE; - + int imageScaleMode = Background.SCALE_NONE; + /** * The Boundary object defining the lights's application region. - */ + */ Bounds applicationRegion = null; - /** + /** * The bounding leaf reference */ BoundingLeafRetained boundingLeaf = null; - /** + /** * Background geometry branch group */ BranchGroup geometryBranch = null; @@ -121,7 +121,7 @@ class BackgroundRetained extends LeafRetained { // Is true, if the background is viewScoped boolean isViewScoped = false; - + BackgroundRetained () { this.nodeType = NodeRetained.BACKGROUND; localBounds = new BoundingBox(); @@ -130,7 +130,7 @@ class BackgroundRetained extends LeafRetained { } /** - * Initializes the background color to the specified color. + * Initializes the background color to the specified color. * This color is used * if the image is null. * @param color the new background color @@ -153,7 +153,7 @@ class BackgroundRetained extends LeafRetained { } /** - * Initializes the background color to the specified color. + * Initializes the background color to the specified color. * This color is used * if the image is null. * @param r the red component of the background color @@ -195,7 +195,7 @@ class BackgroundRetained extends LeafRetained { final void initImageScaleMode(int imageScaleMode){ this.imageScaleMode = imageScaleMode; } - + /** * Sets the image scale mode for this Background node. * @param imageScaleMode the image scale mode @@ -206,16 +206,16 @@ class BackgroundRetained extends LeafRetained { sendMessage(IMAGE_SCALE_CHANGED, new Integer(imageScaleMode)); } } - + /** * gets the image scale mode for this Background node. */ final int getImageScaleMode(){ return imageScaleMode; } - + /** - * Initializes the background image to the specified image. + * Initializes the background image to the specified image. * @param image new ImageCompoent2D object used as the background image */ final void initImage(ImageComponent2D img) { @@ -260,7 +260,7 @@ class BackgroundRetained extends LeafRetained { } /** - * Sets the background image to the specified image. + * Sets the background image to the specified image. * @param image new ImageCompoent3D object used as the background image */ final void setImage(ImageComponent2D img) { @@ -268,16 +268,16 @@ class BackgroundRetained extends LeafRetained { if (texture != null) { texture.clearLive(refCount); } - } + } initImage(img); if (source.isLive()) { if (texture != null) { texture.setLive(inBackgroundGroup, refCount); } - + sendMessage(IMAGE_CHANGED, (texture != null ? texture.mirror : null)); - + } } @@ -286,23 +286,23 @@ class BackgroundRetained extends LeafRetained { * @return the current background image */ final ImageComponent2D getImage() { - return (image == null ? null : + return (image == null ? null : (ImageComponent2D)image.source); } /** - * Initializes the background geometry branch group to the specified branch. + * Initializes the background geometry branch group to the specified branch. * @param branch new branch group object used for background geometry - */ + */ final void initGeometry(BranchGroup branch) { geometryBranch = branch; } /** - * Sets the background geometry branch group to the specified branch. + * Sets the background geometry branch group to the specified branch. * @param branch new branch group object used for background geometry - */ + */ final void setGeometry(BranchGroup branch) { int numMessages = 0; int i; @@ -320,7 +320,7 @@ class BackgroundRetained extends LeafRetained { i = 0; if (geometryBranch != null) { clearGeometryBranch((BranchGroupRetained)geometryBranch.retained); - m[i].threads = (J3dThread.UPDATE_RENDER | + m[i].threads = (J3dThread.UPDATE_RENDER | J3dThread.UPDATE_RENDERING_ENVIRONMENT); m[i].type = J3dMessage.ORDERED_GROUP_REMOVED; m[i].universe = universe; @@ -339,7 +339,7 @@ class BackgroundRetained extends LeafRetained { } if (branch != null) { setGeometryBranch((BranchGroupRetained)branch.retained); - m[i].threads = (J3dThread.UPDATE_RENDER | + m[i].threads = (J3dThread.UPDATE_RENDER | J3dThread.UPDATE_RENDERING_ENVIRONMENT); m[i].type = J3dMessage.ORDERED_GROUP_INSERTED; m[i].universe = universe; @@ -373,7 +373,7 @@ class BackgroundRetained extends LeafRetained { /** * Initializes the Background's application region. * @param region a region that contains the Backgound's new application bounds - */ + */ final void initApplicationBounds(Bounds region) { if (region != null) { applicationRegion = (Bounds) region.clone(); @@ -385,19 +385,19 @@ class BackgroundRetained extends LeafRetained { /** * Set the Background's application region. * @param region a region that contains the Backgound's new application bounds - */ + */ final void setApplicationBounds(Bounds region) { initApplicationBounds(region); // Don't send the message if there is a valid boundingleaf if (boundingLeaf == null) { J3dMessage createMessage = new J3dMessage(); - createMessage.threads = targetThreads | + createMessage.threads = targetThreads | J3dThread.UPDATE_RENDERING_ENVIRONMENT; createMessage.type = J3dMessage.BACKGROUND_CHANGED; createMessage.universe = universe; createMessage.args[0] = this; createMessage.args[1]= new Integer(BOUNDS_CHANGED); - if (region != null) + if (region != null) createMessage.args[2] = region.clone(); else createMessage.args[2] = null; @@ -405,18 +405,18 @@ class BackgroundRetained extends LeafRetained { } } - /** + /** * Get the Backgound's application region. * @return this Backgound's application region information - */ + */ final Bounds getApplicationBounds() { return (applicationRegion != null ? (Bounds) applicationRegion.clone() : null); } /** - * Initializes the Background's application region + * Initializes the Background's application region * to the specified Leaf node. - */ + */ void initApplicationBoundingLeaf(BoundingLeaf region) { if (region != null) { boundingLeaf = (BoundingLeafRetained)region.retained; @@ -427,11 +427,11 @@ class BackgroundRetained extends LeafRetained { /** * Set the Background's application region to the specified Leaf node. - */ + */ void setApplicationBoundingLeaf(BoundingLeaf region) { if (boundingLeaf != null) boundingLeaf.mirrorBoundingLeaf.removeUser(this); - + if (region != null) { boundingLeaf = (BoundingLeafRetained)region.retained; boundingLeaf.mirrorBoundingLeaf.addUser(this); @@ -439,7 +439,7 @@ class BackgroundRetained extends LeafRetained { boundingLeaf = null; } J3dMessage createMessage = new J3dMessage(); - createMessage.threads = targetThreads | + createMessage.threads = targetThreads | J3dThread.UPDATE_RENDERING_ENVIRONMENT; createMessage.type = J3dMessage.BACKGROUND_CHANGED; createMessage.universe = universe; @@ -452,7 +452,7 @@ class BackgroundRetained extends LeafRetained { createMessage.args[2] = null; if (applicationRegion != null) createMessage.args[3] = applicationRegion.clone(); - else + else createMessage.args[3] = null; } VirtualUniverse.mc.processMessage(createMessage); @@ -461,7 +461,7 @@ class BackgroundRetained extends LeafRetained { /** * Get the Background's application region - */ + */ BoundingLeaf getApplicationBoundingLeaf() { return (boundingLeaf != null ? (BoundingLeaf)boundingLeaf.source : null); @@ -473,7 +473,7 @@ class BackgroundRetained extends LeafRetained { void setInImmCtx(boolean inCtx) { inImmCtx = inCtx; } - + /** * This gets the immedate mode context flag */ @@ -547,17 +547,17 @@ class BackgroundRetained extends LeafRetained { if (geometryBranch != null) { - BranchGroupRetained branch = + BranchGroupRetained branch = (BranchGroupRetained)geometryBranch.retained; if (branch.inBackgroundGroup == true) throw new IllegalSharingException( J3dI18N.getString("BackgroundRetained0")); - if (branch.parent != null) + if (branch.parent != null) throw new IllegalSharingException( J3dI18N.getString("BackgroundRetained3")); - if (branch.locale != null) + if (branch.locale != null) throw new IllegalSharingException( J3dI18N.getString("BackgroundRetained4")); @@ -575,7 +575,7 @@ class BackgroundRetained extends LeafRetained { // Free up memory. setLiveState.reset(null); } - + if ((s.viewScopedNodeList != null) && (s.viewLists != null)) { s.viewScopedNodeList.add(this); s.scopedNodesViewList.add(s.viewLists.get(0)); @@ -592,7 +592,7 @@ class BackgroundRetained extends LeafRetained { // Initialize some mirror values if (boundingLeaf != null) { - transformedRegion = + transformedRegion = (Bounds)boundingLeaf.mirrorBoundingLeaf.transformedRegion; } else { // Evaluate applicationRegion if not null @@ -605,7 +605,7 @@ class BackgroundRetained extends LeafRetained { else { transformedRegion = null; } - + } cachedLocale = s.locale; @@ -624,7 +624,7 @@ class BackgroundRetained extends LeafRetained { super.markAsLive(); } - + /** * This clearLive routine first calls the superclass's method, then * it removes itself to the list of lights @@ -674,7 +674,7 @@ class BackgroundRetained extends LeafRetained { int component = ((Integer)objs[1]).intValue(); Transform3D trans; // If initialization - + // Bounds message only sent when boundingleaf is null if ((component & BOUNDS_CHANGED) != 0) { if (objs[2] != null) { @@ -700,15 +700,15 @@ class BackgroundRetained extends LeafRetained { else { transformedRegion = null; } - + } } } - /** Note: This routine will only be called + /** Note: This routine will only be called * to update the object's - * transformed region + * transformed region */ void updateBoundingLeaf() { if (boundingLeaf != null && @@ -791,5 +791,5 @@ class BackgroundRetained extends LeafRetained { } void getMirrorObjects(ArrayList leafList, HashKey key) { leafList.add(this); // No Mirror in this case - } + } } diff --git a/src/classes/share/javax/media/j3d/BackgroundSound.java b/src/classes/share/javax/media/j3d/BackgroundSound.java index 48a0f9b..f9a743e 100644 --- a/src/classes/share/javax/media/j3d/BackgroundSound.java +++ b/src/classes/share/javax/media/j3d/BackgroundSound.java @@ -30,7 +30,7 @@ */ package javax.media.j3d; - + /** * A BackgroundSound node defines an unattenuated, nonspatialized sound * source that has no position or direction. It has the same attributes as a @@ -41,9 +41,9 @@ package javax.media.j3d; */ public class BackgroundSound extends Sound { /** - * Constructs a new BackgroundSound node using the default parameters + * Constructs a new BackgroundSound node using the default parameters * for Sound nodes. - */ + */ public BackgroundSound() { /** * Uses default values defined in SoundRetained.java @@ -51,12 +51,12 @@ public class BackgroundSound extends Sound { } /** - * Constructs a BackgroundSound node object using only the provided + * Constructs a BackgroundSound node object using only the provided * parameter values for sound data and sample gain. The remaining fields * are set to the default values for a Sound node. * @param soundData sound data associated with this sound source node * @param initialGain amplitude scale factor applied to sound source - */ + */ public BackgroundSound(MediaContainer soundData, float initialGain ) { super(soundData, initialGain); } @@ -72,7 +72,7 @@ public class BackgroundSound extends Sound { * @param enable sound switched on/off * @param region scheduling bounds * @param priority playback ranking value - */ + */ public BackgroundSound(MediaContainer soundData, float initialGain, int loopCount, @@ -81,12 +81,12 @@ public class BackgroundSound extends Sound { boolean enable, Bounds region, float priority) { - + super(soundData, initialGain, loopCount, release, continuous, enable, region, priority ); } - + /** * Creates the retained mode BackgroundSoundRetained object that this * BackgroundSound component object will point to. @@ -95,7 +95,7 @@ public class BackgroundSound extends Sound { this.retained = new BackgroundSoundRetained(); this.retained.setSource(this); } - + /** * Creates a new instance of the node. This routine is called @@ -142,7 +142,7 @@ public class BackgroundSound extends Sound { * <code>false</code>, the value of each node's * <code>duplicateOnCloneTree</code> variable determines whether * NodeComponent data is duplicated or copied. - * @exception ClassCastException if originalNode is not an instance of + * @exception ClassCastException if originalNode is not an instance of * <code>Sound</code> * * @see Node#cloneTree diff --git a/src/classes/share/javax/media/j3d/BackgroundSoundRetained.java b/src/classes/share/javax/media/j3d/BackgroundSoundRetained.java index 14265a5..46b2fab 100644 --- a/src/classes/share/javax/media/j3d/BackgroundSoundRetained.java +++ b/src/classes/share/javax/media/j3d/BackgroundSoundRetained.java @@ -30,7 +30,7 @@ */ package javax.media.j3d; - + /** * BackgroundSound is a class for sounds that are not spatially rendered. * These sounds are simply added to the stereo sound mix without modification. diff --git a/src/classes/share/javax/media/j3d/Behavior.java b/src/classes/share/javax/media/j3d/Behavior.java index 7ae9de9..82c5a01 100644 --- a/src/classes/share/javax/media/j3d/Behavior.java +++ b/src/classes/share/javax/media/j3d/Behavior.java @@ -253,15 +253,15 @@ public abstract class Behavior extends Leaf { * This is used when the scheduling bounding leaf is set to null. * @param region the bounds that contains the Behavior's new scheduling * region - */ + */ public void setSchedulingBounds(Bounds region) { ((BehaviorRetained)this.retained).setSchedulingBounds(region); } - /** + /** * Retrieves the Behavior node's scheduling bounds. * @return this Behavior's scheduling bounds information - */ + */ public Bounds getSchedulingBounds() { return ((BehaviorRetained)this.retained).getSchedulingBounds(); } @@ -272,15 +272,15 @@ public abstract class Behavior extends Leaf { * bounds object. * @param region the bounding leaf node used to specify the Behavior * node's new scheduling region - */ + */ public void setSchedulingBoundingLeaf(BoundingLeaf region) { ((BehaviorRetained)this.retained).setSchedulingBoundingLeaf(region); } - /** + /** * Retrieves the Behavior node's scheduling bounding leaf. * @return this Behavior's scheduling bounding leaf information - */ + */ public BoundingLeaf getSchedulingBoundingLeaf() { return ((BehaviorRetained)this.retained).getSchedulingBoundingLeaf(); } @@ -310,7 +310,7 @@ public abstract class Behavior extends Leaf { throw new IllegalStateException(J3dI18N.getString("Behavior0")); } } - behavret.wakeupOn(criteria); + behavret.wakeupOn(criteria); } /** @@ -330,9 +330,9 @@ public abstract class Behavior extends Leaf { } /** - * Posts the specified postId to the Behavior Scheduler. All behaviors - * that have registered WakeupOnBehaviorPost with this postId, or a postId - * of 0, and with this behavior, or a null behavior, will have that wakeup + * Posts the specified postId to the Behavior Scheduler. All behaviors + * that have registered WakeupOnBehaviorPost with this postId, or a postId + * of 0, and with this behavior, or a null behavior, will have that wakeup * condition met. * <p> * This feature allows applications to send arbitrary events into the @@ -441,7 +441,7 @@ public abstract class Behavior extends Leaf { * View. So, for instance, Billboard behaviors would be oriented toward * this primary view, in the case of multiple active views into the same * scene graph. - */ + */ protected View getView() { return ((BehaviorRetained)this.retained).getView(); } @@ -452,7 +452,7 @@ public abstract class Behavior extends Leaf { * <code>originalNode</code> into * the current node. This method is called from the * <code>cloneNode</code> method which is, in turn, called by the - * <code>cloneTree</code> method.<P> + * <code>cloneTree</code> method.<P> * * @param originalNode the original node to duplicate * @param forceDuplicate when set to <code>true</code>, causes the @@ -470,7 +470,7 @@ public abstract class Behavior extends Leaf { */ void duplicateAttributes(Node originalNode, boolean forceDuplicate) { super.duplicateAttributes(originalNode, forceDuplicate); - + BehaviorRetained attr = (BehaviorRetained) originalNode.retained; BehaviorRetained rt = (BehaviorRetained) retained; @@ -520,7 +520,7 @@ public abstract class Behavior extends Leaf { if (bl != null) { Object o = referenceTable.getNewObjectReference(bl); rt.setSchedulingBoundingLeaf((BoundingLeaf) o); - + } } diff --git a/src/classes/share/javax/media/j3d/BehaviorRetained.java b/src/classes/share/javax/media/j3d/BehaviorRetained.java index 778c357..b39b3af 100644 --- a/src/classes/share/javax/media/j3d/BehaviorRetained.java +++ b/src/classes/share/javax/media/j3d/BehaviorRetained.java @@ -47,13 +47,13 @@ class BehaviorRetained extends LeafRetained { static final int WAKEUP_TIME_INDEX = 4; static final int NUM_WAKEUPS = 5; - + static final int WAKEUP_ACTIVATE = 0x0001; static final int WAKEUP_DEACTIVATE = 0x0002; static final int WAKEUP_VP_ENTRY = 0x0004; static final int WAKEUP_VP_EXIT = 0x0008; static final int WAKEUP_TIME = 0x0010; - + /** * The number of scheduling intervals supported by this * implementation. This is fixed for a particular implementation @@ -64,7 +64,7 @@ class BehaviorRetained extends LeafRetained { // different types of IndexedUnorderedSet that use in BehaviorStructure static final int BEHAIVORS_IN_BS_LIST = 0; static final int SCHEDULE_IN_BS_LIST = 1; - + // total number of different IndexedUnorderedSet types static final int TOTAL_INDEXED_UNORDER_SET_TYPES = 2; @@ -72,20 +72,20 @@ class BehaviorRetained extends LeafRetained { * The Boundary object defining the behavior's scheduling region. */ Bounds schedulingRegion = null; - - /** + + /** * The bounding leaf reference */ BoundingLeafRetained boundingLeaf = null; - + /** * The current wakeup condition. */ WakeupCondition wakeupCondition = null; /** - * This is the new WakeupCondition to be set in - * initialize wakeupOn() + * This is the new WakeupCondition to be set in + * initialize wakeupOn() */ WakeupCondition newWakeupCondition = null; @@ -94,7 +94,7 @@ class BehaviorRetained extends LeafRetained { * false until it comes into range of a view platform. */ ViewPlatformRetained vp = null; - + /** * The current activation status for this behavior; this value * is false until it comes into range of a view platform. @@ -105,7 +105,7 @@ class BehaviorRetained extends LeafRetained { * Flag indicating whether the behavior is enabled. */ boolean enable = true; - + /** * Current scheduling interval. */ @@ -117,7 +117,7 @@ class BehaviorRetained extends LeafRetained { * not, then the wakeupCondition will be set to null. */ boolean conditionSet = false; - + /** * This is a flag that indicates whether we are in an initialize or * processStimulus callback. If wakeupOn is called for this behavior @@ -128,7 +128,7 @@ class BehaviorRetained extends LeafRetained { /** * This is a flag that indicates whether we are in initialize * callback. If wakeupOn is called for this behavior when - * this flag is true, then its + * this flag is true, then its * buildTree() will delay until insert nodes message * is get. This is because some localToVworld[] that wakeup * depends may not initialize when this behavior setLive(). @@ -139,15 +139,15 @@ class BehaviorRetained extends LeafRetained { * The transformed schedulingRegion */ Bounds transformedRegion = null; - + // A bitmask that indicates that the scheduling region has changed. int isDirty = 0xffff; - + /** * A bitmask that represents all conditions that this behavior is waiting on. */ int wakeupMask = 0; - + /** * An array of ints that count how many of each wakup is present */ @@ -164,7 +164,7 @@ class BehaviorRetained extends LeafRetained { targets[0] = this; IndexedUnorderSet.init(this, TOTAL_INDEXED_UNORDER_SET_TYPES); } - + /** * Get the Behavior's scheduling region. * @return this Behavior's scheduling region information @@ -181,7 +181,7 @@ class BehaviorRetained extends LeafRetained { } return b; } - + /** * Set the Behavior's scheduling region. * @param region a region that contains the Behavior's new scheduling @@ -205,7 +205,7 @@ class BehaviorRetained extends LeafRetained { /** * Set the Sound's scheduling region to the specified Leaf node. - */ + */ synchronized void setSchedulingBoundingLeaf(BoundingLeaf region) { if (source != null && source.isLive()) { @@ -283,7 +283,7 @@ class BehaviorRetained extends LeafRetained { /** * Get the Behavior's scheduling region - */ + */ BoundingLeaf getSchedulingBoundingLeaf() { return (boundingLeaf != null ? (BoundingLeaf)boundingLeaf.source : null); @@ -325,7 +325,7 @@ class BehaviorRetained extends LeafRetained { } super.markAsLive(); } - + /** * This clearLive routine first calls the superclass's method, then * it deactivates all canvases that are associated with the attached @@ -409,7 +409,7 @@ class BehaviorRetained extends LeafRetained { // The above wakeupOn() just remember the reference // We only need to handle (and ignore the rest) the // last wakeupOn() condition set in the behavior. - // This handle the case when multiple wakeupOn() + // This handle the case when multiple wakeupOn() // are invoked in the same processStimulus() void handleLastWakeupOn(WakeupCondition prevWakeupCond, BehaviorStructure bs) { @@ -430,29 +430,29 @@ class BehaviorRetained extends LeafRetained { } } - - /** + + /** * Returns this behavior's wakeup criteria. * @return criteria The wakeup criteria of this object */ WakeupCondition getWakeupCondition() { return wakeupCondition; } - + /** * Post the specified Id. Behaviors use this method to cause sequential * scheduling of other behavior object. * @param postId The Id being posted */ - + void postId(int postId){ if (source != null && source.isLive()) { universe.behaviorStructure.handleBehaviorPost((Behavior) source, postId); } } - + protected View getView() { - return (universe != null ? + return (universe != null ? universe.getCurrentView() : null); } @@ -489,7 +489,7 @@ class BehaviorRetained extends LeafRetained { // use boundingLeaf transformedRegion = boundingLeaf.mirrorBoundingLeaf.transformedRegion; - + } } diff --git a/src/classes/share/javax/media/j3d/BehaviorScheduler.java b/src/classes/share/javax/media/j3d/BehaviorScheduler.java index 838e851..91db555 100644 --- a/src/classes/share/javax/media/j3d/BehaviorScheduler.java +++ b/src/classes/share/javax/media/j3d/BehaviorScheduler.java @@ -89,7 +89,7 @@ class BehaviorScheduler extends J3dThread { type = J3dThread.BEHAVIOR_SCHEDULER; } - void stopBehaviorScheduler(long[] intervalTime) { + void stopBehaviorScheduler(long[] intervalTime) { stopCount = 2; VirtualUniverse.mc.sendRunMessage(univ, J3dThread.BEHAVIOR_SCHEDULER); @@ -121,9 +121,9 @@ class BehaviorScheduler extends J3dThread { /** * The main loop for the Behavior Scheduler. * Main method for firing off vector of satisfied conditions that - * are contained in the condMet vector. Method is synchronized + * are contained in the condMet vector. Method is synchronized * because it is modifying the current wakeup vectors in the - * clean (emptying out satisfied conditions) and processStimulus + * clean (emptying out satisfied conditions) and processStimulus * (adding conditions again if wakeupOn called) calls. */ void doWork(long referenceTime) { @@ -161,7 +161,7 @@ class BehaviorScheduler extends J3dThread { synchronized (behavret) { Behavior behav = (Behavior) behavret.source; - if (!behav.isLive() || + if (!behav.isLive() || !behavret.conditionSet || (behavret.wakeupCondition == null)) { continue; @@ -178,7 +178,7 @@ class BehaviorScheduler extends J3dThread { } // BehaviorRetained now cache the old - // wakeupCondition in order to + // wakeupCondition in order to // reuse it without the heavyweight cleanTree() // behavret.wakeupCondition.cleanTree(); @@ -221,7 +221,7 @@ class BehaviorScheduler extends J3dThread { behavret.handleLastWakeupOn(wakeupCond, behaviorStructure); } - } + } } list.clear(); } @@ -229,7 +229,7 @@ class BehaviorScheduler extends J3dThread { behaviorStructure.handleAWTEvent(); behaviorStructure.handleBehaviorPost(); lastStopTime = J3dClock.currentTimeMillis(); - + if (MasterControl.isStatsLoggable(Level.FINE)) { VirtualUniverse.mc.recordTime(MasterControl.TimeType.BEHAVIOR, (lastStopTime-lastStartTime)*1000000); } @@ -239,7 +239,7 @@ class BehaviorScheduler extends J3dThread { behaviorStructure = null; getThreadData(null, null).thread = null; univ = null; - for (int i=BehaviorRetained.NUM_SCHEDULING_INTERVALS-1; + for (int i=BehaviorRetained.NUM_SCHEDULING_INTERVALS-1; i >= 0; i--) { processList[i].clear(); } diff --git a/src/classes/share/javax/media/j3d/BehaviorStructure.java b/src/classes/share/javax/media/j3d/BehaviorStructure.java index a0582cb..77a58bc 100644 --- a/src/classes/share/javax/media/j3d/BehaviorStructure.java +++ b/src/classes/share/javax/media/j3d/BehaviorStructure.java @@ -43,7 +43,7 @@ import java.util.Arrays; */ class BehaviorStructure extends J3dStructure { - + /** * The list of behaviors */ @@ -52,10 +52,10 @@ class BehaviorStructure extends J3dStructure { /** * The list of view platforms */ - IndexedUnorderSet viewPlatforms; + IndexedUnorderSet viewPlatforms; /** - * An array of schedulable behaviors, use in + * An array of schedulable behaviors, use in * removeViewPlatform() to go through only active behaviors */ IndexedUnorderSet scheduleList; @@ -74,17 +74,17 @@ class BehaviorStructure extends J3dStructure { Point3d vpTransCenter = new Point3d(); /** - * A list of bounds WakeupOnViewPlatformEntry objects that + * A list of bounds WakeupOnViewPlatformEntry objects that * have seen ViewPlatformEntry */ WakeupIndexedList boundsEntryList; /** - * A list of bounds WakeupOnViewPlatformExit objects that have + * A list of bounds WakeupOnViewPlatformExit objects that have * seen ViewPlatformEntry */ WakeupIndexedList boundsExitList; - + /** * A list of WakeupOnSensorEntry objects that have seen a sensor */ @@ -96,7 +96,7 @@ class BehaviorStructure extends J3dStructure { WakeupIndexedList currentSensorExitList; /** - * The lists of the WakeupCriterion objects that the + * The lists of the WakeupCriterion objects that the * behavior scheduler keeps. */ WakeupIndexedList wakeupOnAWTEvent; @@ -129,11 +129,11 @@ class BehaviorStructure extends J3dStructure { // Use generic integer array to avoid new Integer() for individual element int postIDBuffer[] = new int[10]; // size of default UnorderList - int clonePostIDBuffer[] = new int[postIDBuffer.length]; + int clonePostIDBuffer[] = new int[postIDBuffer.length]; UnorderList behaviorPostBuffer = new UnorderList(Behavior.class); - // temp values for transformed hotspot used in + // temp values for transformed hotspot used in // wakeupOnSensorEntry/ExitupdateSensorsHotspot Transform3D sensorTransform = new Transform3D(); Vector3d sensorLoc = new Vector3d(); @@ -145,8 +145,8 @@ class BehaviorStructure extends J3dStructure { // list of Behavior waiting to be add to behavior list and buildTree() UnorderList pendingBehaviors = new UnorderList(BehaviorRetained.class); - - // true if branch detach + + // true if branch detach boolean branchDetach = false; // This is used to notify WakeupOnAWTEvent re-enable Canvas3D events @@ -159,7 +159,7 @@ class BehaviorStructure extends J3dStructure { BehaviorStructure(VirtualUniverse u) { super(u, J3dThread.UPDATE_BEHAVIOR); - for (int i=BehaviorRetained.NUM_SCHEDULING_INTERVALS-1; + for (int i=BehaviorRetained.NUM_SCHEDULING_INTERVALS-1; i >= 0; i--) { processList[i] = new UnorderList(BehaviorRetained.class); } @@ -174,9 +174,9 @@ class BehaviorStructure extends J3dStructure { boundsExitList = new WakeupIndexedList(WakeupOnViewPlatformExit.class, WakeupOnViewPlatformExit.BOUNDSEXIT_IN_BS_LIST, u); currentSensorEntryList = new WakeupIndexedList(WakeupOnSensorEntry.class, - WakeupOnSensorEntry.SENSORENTRY_IN_BS_LIST, u); + WakeupOnSensorEntry.SENSORENTRY_IN_BS_LIST, u); currentSensorExitList = new WakeupIndexedList(WakeupOnSensorExit.class, - WakeupOnSensorExit.SENSOREXIT_IN_BS_LIST, u); + WakeupOnSensorExit.SENSOREXIT_IN_BS_LIST, u); wakeupOnAWTEvent = new WakeupIndexedList(WakeupOnAWTEvent.class, WakeupOnAWTEvent.COND_IN_BS_LIST, u); wakeupOnActivation = new WakeupIndexedList(WakeupOnActivation.class, @@ -207,7 +207,7 @@ class BehaviorStructure extends J3dStructure { if (nMsg > 0) { for (int i=0; i<nMsg; i++) { m = messages[i]; - + switch (m.type) { case J3dMessage.TRANSFORM_CHANGED: // Compress Message transformMsg = true; @@ -216,7 +216,7 @@ class BehaviorStructure extends J3dStructure { // No need to compress Message since wakeupCondition // will make sure that only one message is sent. processConditionMet((BehaviorRetained) m.args[0], - (Boolean) m.args[1]); + (Boolean) m.args[1]); break; case J3dMessage.INSERT_NODES: insertNodes((Object[])m.args[0]); @@ -254,7 +254,7 @@ class BehaviorStructure extends J3dStructure { reEvaluatePhysicalEnvironments(); ViewPlatform v = ((View) m.args[0]).getViewPlatform(); - if (v != null) { + if (v != null) { // ViewPlatform may set to null when deactivate() processViewPlatformTransform((ViewPlatformRetained) v.retained); } @@ -266,18 +266,18 @@ class BehaviorStructure extends J3dStructure { // then process the VP transform processViewPlatformTransform(vp); break; - case J3dMessage.REGION_BOUND_CHANGED: + case J3dMessage.REGION_BOUND_CHANGED: { BehaviorRetained behav = (BehaviorRetained) m.args[1]; behav.updateTransformRegion(); processBehaviorTransform(behav); } break; - case J3dMessage.BEHAVIOR_REEVALUATE: + case J3dMessage.BEHAVIOR_REEVALUATE: { BehaviorRetained behav = (BehaviorRetained) m.args[0]; behav.active = false; - addToScheduleList(behav); + addToScheduleList(behav); } break; } @@ -287,28 +287,28 @@ class BehaviorStructure extends J3dStructure { if (transformMsg) { // get the targets from the transform structure targets = universe.transformStructure.getTargetList(); - + // process the transform changed for each target UnorderList arrList; - + arrList = targets.targetList[Targets.BEH_TARGETS]; if (arrList != null) { processBehXformChanged(arrList); } - + arrList = targets.targetList[Targets.VPF_TARGETS]; if (arrList != null) { processVpfXformChanged(arrList); } - + transformMsg = false; targets = null; } Arrays.fill(messages, 0, nMsg, null); } - + // wakeup even when message is null since wakeupOnElapsedFrame - // will wakeup this + // will wakeup this if (activeWakeupOnSensorCount <= 0) { if (activeWakeupOnFrameCount > 0) { @@ -316,12 +316,12 @@ class BehaviorStructure extends J3dStructure { VirtualUniverse.mc.sendRunMessage(universe, J3dThread.BEHAVIOR_SCHEDULER| J3dThread.RENDER_THREAD); - + } else { - VirtualUniverse.mc.sendRunMessage(universe, + VirtualUniverse.mc.sendRunMessage(universe, J3dThread.BEHAVIOR_SCHEDULER); } - } else { + } else { checkSensorEntryExit(); // we have to invoke checkSensorEntryExit() next time if (activeWakeupOnFrameCount > 0) { @@ -329,9 +329,9 @@ class BehaviorStructure extends J3dStructure { J3dThread.UPDATE_BEHAVIOR| J3dThread.BEHAVIOR_SCHEDULER| J3dThread.RENDER_THREAD); - + } else { - VirtualUniverse.mc.sendRunMessage(universe, + VirtualUniverse.mc.sendRunMessage(universe, J3dThread.UPDATE_BEHAVIOR| J3dThread.BEHAVIOR_SCHEDULER); } @@ -344,7 +344,7 @@ class BehaviorStructure extends J3dStructure { if (node instanceof BehaviorRetained) { pendingBehaviors.add(node); - } + } else if (node instanceof ViewPlatformRetained) { addViewPlatform((ViewPlatformRetained) node); } @@ -353,7 +353,7 @@ class BehaviorStructure extends J3dStructure { void activateBehaviors() { BehaviorRetained behav; - BehaviorRetained behavArr[] = (BehaviorRetained []) + BehaviorRetained behavArr[] = (BehaviorRetained []) pendingBehaviors.toArray(false); for (int i=pendingBehaviors.arraySize()-1; i>=0; i--) { @@ -364,7 +364,7 @@ class BehaviorStructure extends J3dStructure { behav.conditionSet = true; behaviors.add(behav); behav.updateTransformRegion(); - addToScheduleList(behav); + addToScheduleList(behav); } } pendingBehaviors.clear(); @@ -374,10 +374,10 @@ class BehaviorStructure extends J3dStructure { int i; BehaviorRetained behav; BehaviorRetained behavArr[] = (BehaviorRetained []) behaviors.toArray(false); - + viewPlatforms.add(vp); vp.updateTransformRegion(); - + if (!vp.isActiveViewPlatform()) { return; } @@ -410,7 +410,7 @@ class BehaviorStructure extends J3dStructure { WakeupOnViewPlatformExit wexit; for (i=wakeupOnViewPlatformExit.arraySize()-1; i >=0; i--) { - wexit = wakeupOnViewPlatformExitArr[i]; + wexit = wakeupOnViewPlatformExitArr[i]; if (!boundsExitList.contains(wexit) && wexit.transformedRegion.intersect(vp.center)) { wexit.triggeredVP = vp; @@ -447,7 +447,7 @@ class BehaviorStructure extends J3dStructure { if (behavRemove) { // disable AWT Event from Canvas3D - WakeupOnAWTEvent awtConds[] = (WakeupOnAWTEvent []) + WakeupOnAWTEvent awtConds[] = (WakeupOnAWTEvent []) wakeupOnAWTEvent.toArray(); int eventSize = wakeupOnAWTEvent.arraySize(); @@ -466,7 +466,7 @@ class BehaviorStructure extends J3dStructure { awtCond = awtConds[i]; awtId = awtCond.AwtId; eventMask = awtCond.EventMask; - + if ((awtId >= FocusEvent.FOCUS_FIRST && awtId <= FocusEvent.FOCUS_LAST) || (eventMask & AWTEvent.FOCUS_EVENT_MASK) != 0) { focusEnable = true; @@ -475,19 +475,19 @@ class BehaviorStructure extends J3dStructure { (eventMask & AWTEvent.KEY_EVENT_MASK) != 0) { keyEnable = true; } - if ((awtId >= MouseEvent.MOUSE_FIRST) && + if ((awtId >= MouseEvent.MOUSE_FIRST) && (awtId <= MouseEvent.MOUSE_LAST)) { - if ((awtId == MouseEvent.MOUSE_DRAGGED) || + if ((awtId == MouseEvent.MOUSE_DRAGGED) || (awtId == MouseEvent.MOUSE_MOVED)) { mouseMotionEnable = true; } - else if ((awtId == MouseEvent.MOUSE_ENTERED) || - (awtId == MouseEvent.MOUSE_EXITED) || - (awtId == MouseEvent.MOUSE_CLICKED) || - (awtId == MouseEvent.MOUSE_PRESSED) || + else if ((awtId == MouseEvent.MOUSE_ENTERED) || + (awtId == MouseEvent.MOUSE_EXITED) || + (awtId == MouseEvent.MOUSE_CLICKED) || + (awtId == MouseEvent.MOUSE_PRESSED) || (awtId == MouseEvent.MOUSE_RELEASED) ) { mouseEnable = true; - } + } else if (awtId == MouseEvent.MOUSE_WHEEL) { mouseWheelEnable = true; } @@ -503,7 +503,7 @@ class BehaviorStructure extends J3dStructure { } } } - + if (!focusEnable && universe.enableFocus) { incTimestamp = true; universe.disableFocusEvents(); @@ -537,7 +537,7 @@ class BehaviorStructure extends J3dStructure { viewPlatforms.remove(vp); - BehaviorRetained scheduleArr[] = (BehaviorRetained []) + BehaviorRetained scheduleArr[] = (BehaviorRetained []) scheduleList.toArray(false); // handle Deactive @@ -596,10 +596,10 @@ class BehaviorStructure extends J3dStructure { // cleanup boundsEntryList // since we didn't remove it on removeVPEntryCondition - WakeupOnViewPlatformEntry boundsEntryArr[] = + WakeupOnViewPlatformEntry boundsEntryArr[] = (WakeupOnViewPlatformEntry []) boundsEntryList.toArray(false); WakeupOnViewPlatformEntry wentry; - + for (int i=boundsEntryList.arraySize()-1; i>=0; i--) { wentry = boundsEntryArr[i]; if (wentry.behav == behav) { @@ -609,10 +609,10 @@ class BehaviorStructure extends J3dStructure { // cleanup boundsExitList // since we didn't remove it on removeVPExitCondition - WakeupOnViewPlatformExit boundsExitArr[] = + WakeupOnViewPlatformExit boundsExitArr[] = (WakeupOnViewPlatformExit []) boundsExitList.toArray(false); WakeupOnViewPlatformExit wexit; - + for (int i=boundsExitList.arraySize()-1; i>=0; i--) { wexit = boundsExitArr[i]; if (wexit.behav == behav) { @@ -623,7 +623,7 @@ class BehaviorStructure extends J3dStructure { // cleanup currentSensorEntryList // since we didn't remove it on removeSensorEntryCondition - WakeupOnSensorEntry currentSensorEntryArr[] = + WakeupOnSensorEntry currentSensorEntryArr[] = (WakeupOnSensorEntry []) currentSensorEntryList.toArray(false); WakeupOnSensorEntry sentry; @@ -637,7 +637,7 @@ class BehaviorStructure extends J3dStructure { // cleanup currentSensorExitList // since we didn't remove it on removeSensorExitCondition - WakeupOnSensorExit currentSensorExitArr[] = + WakeupOnSensorExit currentSensorExitArr[] = (WakeupOnSensorExit []) currentSensorExitList.toArray(false); WakeupOnSensorExit sexit; @@ -663,7 +663,7 @@ class BehaviorStructure extends J3dStructure { * conditions */ void handleAWTEvent() { - WakeupOnAWTEvent awtConds[] = (WakeupOnAWTEvent []) + WakeupOnAWTEvent awtConds[] = (WakeupOnAWTEvent []) wakeupOnAWTEvent.toArray(); AWTEvent events[]; int eventSize = wakeupOnAWTEvent.arraySize(); @@ -691,22 +691,22 @@ class BehaviorStructure extends J3dStructure { awtCond.addAWTEvent(evt); } } else { - if (id >= ComponentEvent.COMPONENT_FIRST && + if (id >= ComponentEvent.COMPONENT_FIRST && id <= ComponentEvent.COMPONENT_LAST && (awtCond.EventMask & AWTEvent.COMPONENT_EVENT_MASK) != 0) { awtCond.addAWTEvent(evt); - } - else if (id >= FocusEvent.FOCUS_FIRST && + } + else if (id >= FocusEvent.FOCUS_FIRST && id <= FocusEvent.FOCUS_LAST && (awtCond.EventMask & AWTEvent.FOCUS_EVENT_MASK) != 0) { awtCond.addAWTEvent(evt); } - else if (id >= KeyEvent.KEY_FIRST && + else if (id >= KeyEvent.KEY_FIRST && id <= KeyEvent.KEY_LAST && (awtCond.EventMask & AWTEvent.KEY_EVENT_MASK) != 0) { awtCond.addAWTEvent(evt); } - else if ((id == MouseEvent.MOUSE_CLICKED || + else if ((id == MouseEvent.MOUSE_CLICKED || id == MouseEvent.MOUSE_ENTERED || id == MouseEvent.MOUSE_EXITED || id == MouseEvent.MOUSE_PRESSED || @@ -714,7 +714,7 @@ class BehaviorStructure extends J3dStructure { (awtCond.EventMask & AWTEvent.MOUSE_EVENT_MASK) != 0) { awtCond.addAWTEvent(evt); } - else if ((id == MouseEvent.MOUSE_DRAGGED || + else if ((id == MouseEvent.MOUSE_DRAGGED || id == MouseEvent.MOUSE_MOVED) && (awtCond.EventMask & AWTEvent.MOUSE_MOTION_EVENT_MASK) != 0) { awtCond.addAWTEvent(evt); @@ -728,7 +728,7 @@ class BehaviorStructure extends J3dStructure { } - + } @@ -748,7 +748,7 @@ class BehaviorStructure extends J3dStructure { } /** - * This goes through all of the criteria waiting for Behavior Posts + * This goes through all of the criteria waiting for Behavior Posts * and notifys them. */ void handleBehaviorPost() { @@ -762,7 +762,7 @@ class BehaviorStructure extends J3dStructure { synchronized (behaviorPostBuffer) { behavArr = (Behavior []) behaviorPostBuffer.toArray(); - behavBufferSize = behaviorPostBuffer.size(); + behavBufferSize = behaviorPostBuffer.size(); if (clonePostIDBuffer.length < behavBufferSize) { clonePostIDBuffer = new int[behavBufferSize]; } @@ -777,7 +777,7 @@ class BehaviorStructure extends J3dStructure { for (int j=0; j < behavBufferSize; j++) { behav = behavArr[j]; postid = clonePostIDBuffer[j]; - if ((wakeup.post == postid || wakeup.post == 0) && + if ((wakeup.post == postid || wakeup.post == 0) && (behav == wakeup.armingBehavior || wakeup.armingBehavior == null)) { wakeup.triggeringBehavior = behav; wakeup.triggeringPost = postid; @@ -791,7 +791,7 @@ class BehaviorStructure extends J3dStructure { /** * This goes through all of the criteria waiting for Elapsed Frames * and notified them. - */ + */ void incElapsedFrames() { WakeupOnElapsedFrames wakeupConds[] = (WakeupOnElapsedFrames []) @@ -801,13 +801,13 @@ class BehaviorStructure extends J3dStructure { while (i < size) { wakeupConds[i++].newFrame(); - } + } if ( size > 0) { - VirtualUniverse.mc.sendRunMessage(universe, + VirtualUniverse.mc.sendRunMessage(universe, J3dThread.BEHAVIOR_SCHEDULER|J3dThread.UPDATE_BEHAVIOR); } - + if (branchDetach) { // Since this procedure may call by immediate mode user // thread, we can't just clear it in removeNodes() @@ -815,14 +815,14 @@ class BehaviorStructure extends J3dStructure { branchDetach = false; } - } + } void removeVPEntryCondition(WakeupCondition w) { wakeupOnViewPlatformEntry.remove(w); // don't remove boundsEntryList, it is use next time // when addVPExitCondition invoke to determine whether to // trigger an event or not. - + } void addVPEntryCondition(WakeupOnViewPlatformEntry w) { @@ -830,10 +830,10 @@ class BehaviorStructure extends J3dStructure { // see if the matching wakeupOnViewPlatformEntry // condition exists & do cleanup - WakeupOnViewPlatformEntry boundsEntryArr[] = + WakeupOnViewPlatformEntry boundsEntryArr[] = (WakeupOnViewPlatformEntry []) boundsEntryList.toArray(false); WakeupOnViewPlatformEntry wentry; - + for (int i=boundsEntryList.arraySize()-1; i>=0; i--) { wentry = boundsEntryArr[i]; if ((wentry.behav == w.behav) && @@ -871,7 +871,7 @@ class BehaviorStructure extends J3dStructure { // Cleanup, since collideEntryList did not remove // its condition in removeVPEntryCondition boolean needTrigger = true; - WakeupOnViewPlatformExit boundsExitArr[] = + WakeupOnViewPlatformExit boundsExitArr[] = (WakeupOnViewPlatformExit []) boundsExitList.toArray(false); WakeupOnViewPlatformExit wexit; for (int i=boundsExitList.arraySize()-1; i>=0; i--) { @@ -883,14 +883,14 @@ class BehaviorStructure extends J3dStructure { break; } } - + ViewPlatformRetained triggeredVP = intersectVPCenter(w.transformedRegion); wakeupOnViewPlatformExit.add(w); if (triggeredVP != null) { w.triggeredVP = triggeredVP; boundsExitList.add(w); - } + } if (!needTrigger) { return; @@ -899,15 +899,15 @@ class BehaviorStructure extends J3dStructure { // see if the matching wakeupOnViewPlatformEntry // condition exists - WakeupOnViewPlatformEntry boundsEntryArr[] = + WakeupOnViewPlatformEntry boundsEntryArr[] = (WakeupOnViewPlatformEntry []) boundsEntryList.toArray(false); WakeupOnViewPlatformEntry wentry; - + for (int i=boundsEntryList.arraySize()-1; i>=0; i--) { wentry = boundsEntryArr[i]; if ((wentry.behav == w.behav) && (wentry.region.equals(w.region))) { - // Don't remove this since if user wakeupOr() + // Don't remove this since if user wakeupOr() // Entry and Exit condition together we may have trouble // boundsEntryList.remove(i); if (triggeredVP == null) { @@ -932,10 +932,10 @@ class BehaviorStructure extends J3dStructure { // see if the matching wakeupOnSensorEntry // condition exists - WakeupOnSensorEntry sensorEntryArr[] = + WakeupOnSensorEntry sensorEntryArr[] = (WakeupOnSensorEntry []) currentSensorEntryList.toArray(false); WakeupOnSensorEntry wentry; - + for (int i=currentSensorEntryList.arraySize()-1; i>=0; i--) { wentry = sensorEntryArr[i]; if ((wentry.behav == w.behav) && @@ -954,7 +954,7 @@ class BehaviorStructure extends J3dStructure { w.setTarget(target); currentSensorEntryList.add(w); } - + if (needTrigger && (target != null)) { w.setTriggered(); @@ -974,7 +974,7 @@ class BehaviorStructure extends J3dStructure { // Cleanup boolean needTrigger = true; - WakeupOnSensorExit currentSensorExitArr[] = + WakeupOnSensorExit currentSensorExitArr[] = (WakeupOnSensorExit []) currentSensorExitList.toArray(false); WakeupOnSensorExit wexit; for (int i=currentSensorExitList.arraySize()-1; i>=0; i--) { @@ -994,17 +994,17 @@ class BehaviorStructure extends J3dStructure { if (target != null) { w.setTarget(target); currentSensorExitList.add(w); - } + } if (!needTrigger) { return; } // see if the matching wakeupOnSensorEntry // condition exists - WakeupOnSensorEntry sensorEntryArr[] = + WakeupOnSensorEntry sensorEntryArr[] = (WakeupOnSensorEntry []) currentSensorEntryList.toArray(false); WakeupOnSensorEntry wentry; - + for (int i=currentSensorEntryList.arraySize()-1; i>=0; i--) { wentry = sensorEntryArr[i]; if ((wentry.behav == w.behav) && @@ -1020,17 +1020,17 @@ class BehaviorStructure extends J3dStructure { J3dThread.UPDATE_BEHAVIOR); } - void processConditionMet(BehaviorRetained behav, + void processConditionMet(BehaviorRetained behav, Boolean checkSchedulingRegion) { // Since we reuse wakeup condition, the old wakeupCondition // will not reactivate again while processStimulus is running - // which may set another wakeupCondition. + // which may set another wakeupCondition. // Previously we don't reuse wakeupCondition and cleanTree() // everytime before calling processStimulus() so the flag // inCallback is not necessary to check. - if (!behav.inCallback && - ((checkSchedulingRegion == Boolean.FALSE) || + if (!behav.inCallback && + ((checkSchedulingRegion == Boolean.FALSE) || behav.active)) { processList[behav.schedulingInterval].add(behav); } else { @@ -1083,7 +1083,7 @@ class BehaviorStructure extends J3dStructure { int i; // We have to process them in group rather then one by one, - // otherwise we may have both activation/deactivation + // otherwise we may have both activation/deactivation // conditions wakeup at the same time when both ViewPlatform // and Behavior transform under a branch. @@ -1097,7 +1097,7 @@ class BehaviorStructure extends J3dStructure { } else if (node instanceof ViewPlatformRetained) { ((ViewPlatformRetained) node).updateTransformRegion(); transformViewPlatformList.add(node); - } + } } // finally handle ViewPlatformRetained Transform change @@ -1107,7 +1107,7 @@ class BehaviorStructure extends J3dStructure { int size = transformViewPlatformList.arraySize(); for (i=0; i < size; i++) { - processViewPlatformTransform((ViewPlatformRetained) + processViewPlatformTransform((ViewPlatformRetained) vpArr[i]); } transformViewPlatformList.clear(); @@ -1119,10 +1119,10 @@ class BehaviorStructure extends J3dStructure { final void processBehaviorTransform(BehaviorRetained behav) { if ((behav.wakeupMask & BehaviorRetained.WAKEUP_VP_ENTRY) != 0) { updateVPEntryTransformRegion(behav); - } + } if ((behav.wakeupMask & BehaviorRetained.WAKEUP_VP_EXIT) != 0) { - updateVPExitTransformRegion(behav); + updateVPExitTransformRegion(behav); } if (behav.active) { @@ -1144,7 +1144,7 @@ class BehaviorStructure extends J3dStructure { if (!vp.isActiveViewPlatform()) { return; } - + BehaviorRetained behavArr[] = (BehaviorRetained []) behaviors.toArray(false); // re-evaulate all behaviors affected by this vp @@ -1202,7 +1202,7 @@ class BehaviorStructure extends J3dStructure { if (triggeredVP == null) { boundsExitList.remove(idx); wexit.setTriggered(); - } + } } } } @@ -1218,7 +1218,7 @@ class BehaviorStructure extends J3dStructure { if (wentry.behav == behav) { wentry.updateTransformRegion(behav); int idx = boundsEntryList.indexOf(wentry); - + triggeredVP = intersectVPCenter(wentry.transformedRegion); if (triggeredVP != null) { if (idx < 0) { @@ -1281,7 +1281,7 @@ class BehaviorStructure extends J3dStructure { views = ((ViewPlatformRetained) vpList.get(i)).getViewList(); for (int j=views.length-1; j>=0; j--) { v = views[j]; - if (v.active && + if (v.active && !physicalEnvironments.contains(v.physicalEnvironment)) { physicalEnvironments.add(v.physicalEnvironment); } @@ -1295,9 +1295,9 @@ class BehaviorStructure extends J3dStructure { // handle WakeupOnSensorEntry WakeupOnSensorEntry wentry; - WakeupOnSensorEntry wentryArr[] = (WakeupOnSensorEntry []) + WakeupOnSensorEntry wentryArr[] = (WakeupOnSensorEntry []) wakeupOnSensorEntry.toArray(); - + for (i=wakeupOnSensorEntry.arraySize()-1; i>=0; i--) { wentry = wentryArr[i]; idx = currentSensorEntryList.indexOf(wentry); @@ -1318,9 +1318,9 @@ class BehaviorStructure extends J3dStructure { // handle WakeupOnSensorExit WakeupOnSensorExit wexit; - WakeupOnSensorExit wexitArr[] = (WakeupOnSensorExit []) + WakeupOnSensorExit wexitArr[] = (WakeupOnSensorExit []) wakeupOnSensorExit.toArray(); - + for (i=wakeupOnSensorExit.arraySize()-1; i>=0; i--) { wexit = wexitArr[i]; idx = currentSensorExitList.indexOf(wexit); @@ -1350,14 +1350,14 @@ class BehaviorStructure extends J3dStructure { if (behregion == null) return null; - PhysicalEnvironment env[] = (PhysicalEnvironment []) + PhysicalEnvironment env[] = (PhysicalEnvironment []) physicalEnvironments.toArray(false); Sensor sensors[]; Sensor s; View v; for (int i=physicalEnvironments.arraySize()-1; i>=0; i--) { if (env[i].activeViewRef > 0) { - sensors = env[i].getSensorList(); + sensors = env[i].getSensorList(); if (sensors != null) { for (int j= env[i].users.size()-1; j>=0; j--) { v = (View) env[i].users.get(j); @@ -1396,7 +1396,7 @@ class BehaviorStructure extends J3dStructure { for (int i=viewPlatforms.arraySize()- 1; i>=0; i--) { vp = vpLists[i]; - if (vp.isActiveViewPlatform() && + if (vp.isActiveViewPlatform() && vp.schedSphere.intersect(behregion)) { return true; } @@ -1419,7 +1419,7 @@ class BehaviorStructure extends J3dStructure { for (int i=viewPlatforms.arraySize()- 1; i>=0; i--) { vp = vpLists[i]; - if (vp.isActiveViewPlatform() && + if (vp.isActiveViewPlatform() && behregion.intersect(vp.center)) { return vp; } @@ -1443,7 +1443,7 @@ class BehaviorStructure extends J3dStructure { void notifyActivationCondition(BehaviorRetained behav) { WakeupOnActivation wakeup; WakeupOnActivation wakeupConds[] = (WakeupOnActivation []) - wakeupOnActivation.toArray(false); + wakeupOnActivation.toArray(false); for (int i=wakeupOnActivation.arraySize()-1; i>=0; i--) { wakeup = wakeupConds[i]; @@ -1542,7 +1542,7 @@ class BehaviorStructure extends J3dStructure { final void removeFromScheduleList(BehaviorRetained behav) { if (behav.active) { - if ((behav.wakeupMask & + if ((behav.wakeupMask & BehaviorRetained.WAKEUP_DEACTIVATE) != 0) { notifyDeactivationCondition(behav); } @@ -1560,7 +1560,7 @@ class BehaviorStructure extends J3dStructure { } final void addToScheduleList(BehaviorRetained behav) { - + if (!behav.inCallback && !behav.active && behav.enable && @@ -1571,13 +1571,13 @@ class BehaviorStructure extends J3dStructure { scheduleList.add(behav); behav.active = true; - if ((behav.wakeupMask & + if ((behav.wakeupMask & BehaviorRetained.WAKEUP_ACTIVATE) != 0) { notifyActivationCondition(behav); } if (behav.wakeupCondition != null) { - // This reset the conditionMet, otherwise + // This reset the conditionMet, otherwise // if conditionMet is true then WakeupCondition // will never post message to BehaviorStructure behav.wakeupCondition.conditionMet = false; @@ -1595,9 +1595,9 @@ class BehaviorStructure extends J3dStructure { void resetConditionMet() { resetConditionMet(wakeupOnAWTEvent); resetConditionMet(wakeupOnActivation); - resetConditionMet(wakeupOnDeactivation); - resetConditionMet(wakeupOnBehaviorPost); - resetConditionMet(wakeupOnElapsedFrames); + resetConditionMet(wakeupOnDeactivation); + resetConditionMet(wakeupOnBehaviorPost); + resetConditionMet(wakeupOnElapsedFrames); resetConditionMet(wakeupOnViewPlatformEntry); resetConditionMet(wakeupOnViewPlatformExit); resetConditionMet(wakeupOnSensorEntry); @@ -1617,25 +1617,25 @@ class BehaviorStructure extends J3dStructure { wakeupOnElapsedFrames.toArray(true); int size = wakeupOnElapsedFrames.arraySize(); int i = 0; - WakeupOnElapsedFrames cond; - + WakeupOnElapsedFrames cond; + activeWakeupOnFrameCount = 0; while (i < size) { cond = wakeupConds[i++]; - if (!cond.passive && - (cond.behav != null) && + if (!cond.passive && + (cond.behav != null) && cond.behav.enable) { activeWakeupOnFrameCount++; } - } + } activeWakeupOnSensorCount = 0; WakeupOnSensorEntry wentry; - WakeupOnSensorEntry wentryArr[] = (WakeupOnSensorEntry []) + WakeupOnSensorEntry wentryArr[] = (WakeupOnSensorEntry []) wakeupOnSensorEntry.toArray(); - + for (i=wakeupOnSensorEntry.arraySize()-1; i>=0; i--) { wentry = wentryArr[i]; if ((wentry.behav != null) && @@ -1645,9 +1645,9 @@ class BehaviorStructure extends J3dStructure { } WakeupOnSensorExit wexit; - WakeupOnSensorExit wexitArr[] = (WakeupOnSensorExit []) + WakeupOnSensorExit wexitArr[] = (WakeupOnSensorExit []) wakeupOnSensorExit.toArray(); - + for (i=wakeupOnSensorExit.arraySize()-1; i>=0; i--) { wexit = wexitArr[i]; if ((wexit.behav != null) && @@ -1663,7 +1663,7 @@ class BehaviorStructure extends J3dStructure { viewPlatforms.clear(); scheduleList.clear(); boundsEntryList.clear(); - boundsExitList.clear(); + boundsExitList.clear(); currentSensorEntryList.clear(); currentSensorExitList.clear(); wakeupOnAWTEvent.clear(); diff --git a/src/classes/share/javax/media/j3d/Billboard.java b/src/classes/share/javax/media/j3d/Billboard.java index 5c0151a..751616a 100644 --- a/src/classes/share/javax/media/j3d/Billboard.java +++ b/src/classes/share/javax/media/j3d/Billboard.java @@ -41,7 +41,7 @@ import javax.vecmath.AxisAngle4d; /** * The Billboard behavior node operates on the TransformGroup node * to cause the local +z axis of the TransformGroup to point at - * the viewer's eye position. This is done regardless of the transforms + * the viewer's eye position. This is done regardless of the transforms * above the specified TransformGroup node in the scene graph. * * <p> @@ -95,7 +95,7 @@ public class Billboard extends Behavior { private Point3d viewPosition = new Point3d(); private Point3d yUpPoint = new Point3d(); - private Vector3d eyeVec = new Vector3d(); + private Vector3d eyeVec = new Vector3d(); private Vector3d yUp = new Vector3d(); private Vector3d zAxis = new Vector3d(); private Vector3d yAxis = new Vector3d(); @@ -150,7 +150,7 @@ public class Billboard extends Behavior { * * @param tg the TransformGroup node that this Billboard * node operates upon - * @param mode alignment mode, one of ROTATE_ABOUT_AXIS or + * @param mode alignment mode, one of ROTATE_ABOUT_AXIS or * ROTATE_ABOUT_POINT * @param axis the ray about which the billboard rotates */ @@ -171,7 +171,7 @@ public class Billboard extends Behavior { * that operates on the specified TransformGroup node. * @param tg the TransformGroup node that this Billboard * node operates upon - * @param mode alignment mode, one of ROTATE_ABOUT_AXIS or + * @param mode alignment mode, one of ROTATE_ABOUT_AXIS or * ROTATE_ABOUT_POINT * @param point the position about which the billboard rotates */ @@ -284,15 +284,15 @@ public class Billboard extends Behavior { * Sets the tranformGroup for this Billboard object. * @param tg the transformGroup node which replaces the current * transformGroup node for this Billboard - */ + */ public void setTarget(TransformGroup tg ) { this.tg = tg; } /** * Returns a copy of the transformGroup associated with this Billboard. - * @return the TranformGroup for this Billboard - */ + * @return the TranformGroup for this Billboard + */ public TransformGroup getTarget() { return(tg); } @@ -321,7 +321,7 @@ public class Billboard extends Behavior { wakeupOn(wakeupFrame); return; } - + // get viewplatforms's location in virutal world View v = this.getView(); if( v == null ) { @@ -362,7 +362,7 @@ public class Billboard extends Behavior { // project the eye into the rotation plane status = projectToPlane(eyeVec, nAxis); - // If the first project was successful .. + // If the first project was successful .. if (status) { // project the z axis into the rotation plane zAxis.x = 0.0; @@ -374,16 +374,16 @@ public class Billboard extends Behavior { ((TransformGroupRetained) tg.retained).getTransform(xform); if (status) { - // compute the sign of the angle by checking if the cross product + // compute the sign of the angle by checking if the cross product // of the two vectors is in the same direction as the normal axis - vector.cross(eyeVec, zAxis); + vector.cross(eyeVec, zAxis); if (vector.dot(nAxis) > 0.0) { sign = 1.0; - } else { + } else { sign = -1.0; } - // compute the angle between the projected eye vector and the + // compute the angle between the projected eye vector and the // projected z double dot = eyeVec.dot(zAxis); @@ -392,12 +392,12 @@ public class Billboard extends Behavior { } else if (dot < -1.0f) { dot = -1.0f; } - + angle = sign*Math.acos(dot); // use -angle because xform is to *undo* rotation by angle - aa.x = nAxis.x; - aa.y = nAxis.y; + aa.x = nAxis.x; + aa.y = nAxis.y; aa.z = nAxis.z; aa.angle = -angle; bbXform.set(aa); @@ -416,12 +416,12 @@ public class Billboard extends Behavior { } } else { // rotate about point - // Need to rotate Z axis to point to eye, and Y axis to be - // parallel to view platform Y axis, rotating around rotation pt + // Need to rotate Z axis to point to eye, and Y axis to be + // parallel to view platform Y axis, rotating around rotation pt Transform3D zRotate = new Transform3D(); - // get the eye point + // get the eye point canvas.getCenterEyeInImagePlate(viewPosition); // derive the yUp point @@ -466,7 +466,7 @@ public class Billboard extends Behavior { // rotation axis is cross product of eyeVec and zAxis vector.cross(eyeVec, zAxis); // vector is cross product - // if cross product is non-zero, vector is rotation axis and + // if cross product is non-zero, vector is rotation axis and // rotation angle is acos(eyeVec.dot(zAxis))); double length = vector.length(); @@ -496,11 +496,11 @@ public class Billboard extends Behavior { yAxis.z = 0.0; zRotate.transform(yAxis); - // project the yAxis onto the plane perp to the eyeVec + // project the yAxis onto the plane perp to the eyeVec status = projectToPlane(yAxis, eyeVec); if (status) { - // project the yUp onto the plane perp to the eyeVec + // project the yUp onto the plane perp to the eyeVec status = projectToPlane(yUp, eyeVec); } @@ -518,11 +518,11 @@ public class Billboard extends Behavior { angle = Math.acos(dot); - // check the sign by looking a the cross product vs the eyeVec + // check the sign by looking a the cross product vs the eyeVec vector.cross(yUp, yAxis); // vector is cross product if (eyeVec.dot(vector) < 0) { angle *= -1; - } + } aa.x = eyeVec.x; aa.y = eyeVec.y; aa.z = eyeVec.z; @@ -538,7 +538,7 @@ public class Billboard extends Behavior { bbXform.mul(xform); // yRotate bbXform.mul(zRotate); // zRotate vector.scale(-1.0); // vector to translate back - xform.set(vector); // xform to translate back + xform.set(vector); // xform to translate back bbXform.mul(xform); // translate back @@ -566,10 +566,10 @@ private boolean projectToPlane(Vector3d projVec, Vector3d planeVec) { projVec.z = projVec.z - planeVec.z*dis; double length = projVec.length(); - + if (length < EPSILON) { return false; - } + } projVec.scale(1 / length); return true; } @@ -594,13 +594,13 @@ private boolean projectToPlane(Vector3d projVec, Vector3d planeVec) { return b; } - + /** * Copies all Billboard information from * <code>originalNode</code> into * the current node. This method is called from the * <code>cloneNode</code> method which is, in turn, called by the - * <code>cloneTree</code> method.<P> + * <code>cloneTree</code> method.<P> * * @param originalNode the original node to duplicate. * @param forceDuplicate when set to <code>true</code>, causes the @@ -620,13 +620,13 @@ private boolean projectToPlane(Vector3d projVec, Vector3d planeVec) { super.duplicateAttributes(originalNode, forceDuplicate); Billboard bb = (Billboard) originalNode; - + setAlignmentMode(bb.getAlignmentMode()); Vector3f v = new Vector3f(); bb.getAlignmentAxis(v); setAlignmentAxis(v); - + Point3f p = new Point3f(); bb.getRotationPoint(p); setRotationPoint(p); @@ -634,7 +634,7 @@ private boolean projectToPlane(Vector3d projVec, Vector3d planeVec) { // this will be updated by updateNodeReferences() later setTarget(bb.getTarget()); } - + /** * Callback used to allow a node to check if any scene graph objects @@ -664,7 +664,7 @@ private boolean projectToPlane(Vector3d projVec, Vector3d planeVec) { */ public void updateNodeReferences(NodeReferenceTable referenceTable) { super.updateNodeReferences(referenceTable); - + // check for new TransformGroup TransformGroup g = getTarget(); if (g != null) { diff --git a/src/classes/share/javax/media/j3d/BoundingLeaf.java b/src/classes/share/javax/media/j3d/BoundingLeaf.java index 40c297f..70285e6 100644 --- a/src/classes/share/javax/media/j3d/BoundingLeaf.java +++ b/src/classes/share/javax/media/j3d/BoundingLeaf.java @@ -35,7 +35,7 @@ import javax.vecmath.*; /** * The BoundingLeaf node defines a bounding region object that can be - * referenced by other nodes to define a region of influence + * referenced by other nodes to define a region of influence * (Fog and Light nodes), an application region (Background, Clip, * and Soundscape nodes), or a scheduling region (Sound and * Behavior nodes). The bounding region is defined in the local @@ -73,14 +73,14 @@ public class BoundingLeaf extends Leaf { private static final int[] readCapabilities = { ALLOW_REGION_READ }; - + /** * Constructs a BoundingLeaf node with a null (empty) bounding region. */ public BoundingLeaf() { // set default read capabilities setDefaultReadCapabilities(readCapabilities); - + ((BoundingLeafRetained)this.retained).createBoundingLeaf(); } @@ -91,7 +91,7 @@ public class BoundingLeaf extends Leaf { public BoundingLeaf(Bounds region) { // set default read capabilities setDefaultReadCapabilities(readCapabilities); - + ((BoundingLeafRetained)this.retained).createBoundingLeaf(); ((BoundingLeafRetained)this.retained).initRegion(region); } @@ -123,18 +123,18 @@ public class BoundingLeaf extends Leaf { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_REGION_READ)) throw new CapabilityNotSetException(J3dI18N.getString("BoundingLeaf1")); - + return ((BoundingLeafRetained)this.retained).getRegion(); } - - /** - * Creates the BoundingLeafRetained object that this - * BoundingLeaf object will point to. - */ + + /** + * Creates the BoundingLeafRetained object that this + * BoundingLeaf object will point to. + */ void createRetained() { - this.retained = new BoundingLeafRetained(); - this.retained.setSource(this); - } + this.retained = new BoundingLeafRetained(); + this.retained.setSource(this); + } /** * Used to create a new instance of the node. This routine is called @@ -156,7 +156,7 @@ public class BoundingLeaf extends Leaf { return bl; } - + /** * Copies all BoundingLeaf information from diff --git a/src/classes/share/javax/media/j3d/BoundingLeafRetained.java b/src/classes/share/javax/media/j3d/BoundingLeafRetained.java index d29d994..6935743 100644 --- a/src/classes/share/javax/media/j3d/BoundingLeafRetained.java +++ b/src/classes/share/javax/media/j3d/BoundingLeafRetained.java @@ -48,8 +48,8 @@ class BoundingLeafRetained extends LeafRetained { Bounds region = null; - // For the mirror object, this region is the transformed region - // (the region of the original bounding leaf object transformed + // For the mirror object, this region is the transformed region + // (the region of the original bounding leaf object transformed // by the cache transform) Bounds transformedRegion = null; @@ -76,7 +76,7 @@ class BoundingLeafRetained extends LeafRetained { this.nodeType = NodeRetained.BOUNDINGLEAF; mirrorBoundingLeaf = new BoundingLeafRetained(); } - + /** * Initialize the bounding region */ @@ -173,7 +173,7 @@ class BoundingLeafRetained extends LeafRetained { } - /** Update the "component" field of the mirror object with the + /** Update the "component" field of the mirror object with the * given "value" */ synchronized void updateImmediateMirrorObject(Object[] objs) { @@ -181,7 +181,7 @@ class BoundingLeafRetained extends LeafRetained { int component = ((Integer)objs[1]).intValue(); Bounds b = ((Bounds)objs[2]); Transform3D t; - + if ((component & REGION_CHANGED) != 0) { mirrorBoundingLeaf.region = b; if (b != null) { @@ -192,7 +192,7 @@ class BoundingLeafRetained extends LeafRetained { else { mirrorBoundingLeaf.transformedRegion = null; } - + } } diff --git a/src/classes/share/javax/media/j3d/BoundingPolytope.java b/src/classes/share/javax/media/j3d/BoundingPolytope.java index 64a42ff..b6a0e68 100644 --- a/src/classes/share/javax/media/j3d/BoundingPolytope.java +++ b/src/classes/share/javax/media/j3d/BoundingPolytope.java @@ -53,20 +53,20 @@ import com.sun.j3d.internal.HashCodeUtil; */ public class BoundingPolytope extends Bounds { - + /** * An array of bounding planes. */ - Vector4d[] planes; + Vector4d[] planes; double[] mag; // magnitude of plane vector double[] pDotN; // point on plane dotted with normal Point3d[] verts; // vertices of polytope int nVerts; // number of verts in polytope Point3d centroid = new Point3d(); // centroid of polytope - + Point3d boxVerts[]; boolean allocBoxVerts = false; - + /** * Constructs a BoundingPolytope using the specified planes. * @param planes a set of planes defining the polytope. @@ -84,16 +84,16 @@ public class BoundingPolytope extends Bounds { this.planes = new Vector4d[planes.length]; mag = new double[planes.length]; pDotN = new double[planes.length]; - + for(i=0;i<planes.length;i++) { - + // normalize the plane normals mag[i] = Math.sqrt(planes[i].x*planes[i].x + planes[i].y*planes[i].y + planes[i].z*planes[i].z); invMag = 1.0/mag[i]; this.planes[i] = new Vector4d( planes[i].x*invMag, planes[i].y*invMag, planes[i].z*invMag, planes[i].w*invMag ); - + } computeAllVerts(); // XXXX: lazy evaluate } @@ -153,7 +153,7 @@ public class BoundingPolytope extends Bounds { computeAllVerts(); // XXXX: lazy evaluate return; } - + boundsIsEmpty = boundsObject.boundsIsEmpty; boundsIsInfinite = boundsObject.boundsIsInfinite; @@ -162,7 +162,7 @@ public class BoundingPolytope extends Bounds { planes = new Vector4d[6]; mag = new double[planes.length]; pDotN = new double[planes.length]; - + planes[0] = new Vector4d( 1.0, 0.0, 0.0, -(sphere.center.x+sphere.radius) ); planes[1] = new Vector4d(-1.0, 0.0, 0.0, sphere.center.x-sphere.radius ); planes[2] = new Vector4d( 0.0, 1.0, 0.0, -(sphere.center.y+sphere.radius) ); @@ -176,13 +176,13 @@ public class BoundingPolytope extends Bounds { mag[4] = 1.0; mag[5] = 1.0; computeAllVerts(); // XXXX: lazy evaluate - + } else if( boundsObject.boundId == BOUNDING_BOX ){ BoundingBox box = (BoundingBox)boundsObject; planes = new Vector4d[6]; pDotN = new double[planes.length]; mag = new double[planes.length]; - + planes[0] = new Vector4d( 1.0, 0.0, 0.0, -box.upper.x ); planes[1] = new Vector4d(-1.0, 0.0, 0.0, box.lower.x ); planes[2] = new Vector4d( 0.0, 1.0, 0.0, -box.upper.y ); @@ -196,14 +196,14 @@ public class BoundingPolytope extends Bounds { mag[4] = 1.0; mag[5] = 1.0; computeAllVerts(); // XXXX: lazy evaluate - + } else if( boundsObject.boundId == BOUNDING_POLYTOPE ) { BoundingPolytope polytope = (BoundingPolytope)boundsObject; planes = new Vector4d[polytope.planes.length]; mag = new double[planes.length]; pDotN = new double[planes.length]; nVerts = polytope.nVerts; - verts = new Point3d[nVerts]; + verts = new Point3d[nVerts]; for(i=0;i<planes.length;i++) { planes[i] = new Vector4d(polytope.planes[i]); mag[i] = polytope.mag[i]; @@ -228,7 +228,7 @@ public class BoundingPolytope extends Bounds { */ public BoundingPolytope(Bounds[] boundsObjects) { int i=0; - + boundId = BOUNDING_POLYTOPE; if( boundsObjects == null || boundsObjects.length <= 0 ) { boundsIsEmpty = true; @@ -241,18 +241,18 @@ public class BoundingPolytope extends Bounds { while( boundsObjects[i] == null && i < boundsObjects.length) { i++; } - + if( i >= boundsObjects.length ) { // all bounds objects were empty boundsIsEmpty = true; boundsIsInfinite = false; initEmptyPolytope(); computeAllVerts(); // XXXX: lazy evaluate - return; + return; } - + boundsIsEmpty = boundsObjects[i].boundsIsEmpty; boundsIsInfinite = boundsObjects[i].boundsIsInfinite; - + if( boundsObjects[i].boundId == BOUNDING_SPHERE ) { BoundingSphere sphere = (BoundingSphere)boundsObjects[i]; planes = new Vector4d[6]; @@ -278,7 +278,7 @@ public class BoundingPolytope extends Bounds { planes = new Vector4d[6]; mag = new double[planes.length]; pDotN = new double[planes.length]; - + planes[0] = new Vector4d( 1.0, 0.0, 0.0, -box.upper.x ); planes[1] = new Vector4d(-1.0, 0.0, 0.0, box.lower.x ); planes[2] = new Vector4d( 0.0, 1.0, 0.0, -box.upper.y ); @@ -299,7 +299,7 @@ public class BoundingPolytope extends Bounds { mag = new double[planes.length]; pDotN = new double[planes.length]; nVerts = polytope.nVerts; - verts = new Point3d[nVerts]; + verts = new Point3d[nVerts]; for(i=0;i<planes.length;i++) { planes[i] = new Vector4d(polytope.planes[i]); pDotN[i] = polytope.pDotN[i]; @@ -350,17 +350,17 @@ public class BoundingPolytope extends Bounds { invMag = 1.0/mag[i]; this.planes[i] = new Vector4d( planes[i].x*invMag, planes[i].y*invMag, planes[i].z*invMag, planes[i].w*invMag ); - } + } computeAllVerts(); // XXXX: lazy evaluate } - + /** * Returns the equations of the bounding planes for this bounding polytope. * The equations are copied into the specified array. - * The array must be large enough to hold all of the vectors. + * The array must be large enough to hold all of the vectors. * The individual array elements must be allocated by the caller. - * @param planes an array Vector4d to receive the bounding planes + * @param planes an array Vector4d to receive the bounding planes */ public void getPlanes(Vector4d[] planes) { @@ -393,18 +393,18 @@ public class BoundingPolytope extends Bounds { boundsIsEmpty = true; boundsIsInfinite = false; computeAllVerts(); // XXXX: lazy evaluate - + }else if( boundsObject.boundId == BOUNDING_SPHERE ) { BoundingSphere sphere = (BoundingSphere)boundsObject; - + if( boundsIsEmpty) { - initEmptyPolytope(); // no ptope exist so must initialize to default - computeAllVerts(); + initEmptyPolytope(); // no ptope exist so must initialize to default + computeAllVerts(); } - + for(i=0;i<planes.length;i++) { // D = -(N dot C + radius) - planes[i].w = -(sphere.center.x*planes[i].x + - sphere.center.y*planes[i].y + + planes[i].w = -(sphere.center.x*planes[i].x + + sphere.center.y*planes[i].y + sphere.center.z*planes[i].z + sphere.radius); } @@ -417,15 +417,15 @@ public class BoundingPolytope extends Bounds { double ux,uy,uz,lx,ly,lz,newD; if( boundsIsEmpty) { - initEmptyPolytope(); // no ptope exist so must initialize to default - computeAllVerts(); + initEmptyPolytope(); // no ptope exist so must initialize to default + computeAllVerts(); } - for(i=0;i<planes.length;i++) { - ux = box.upper.x*planes[i].x; + for(i=0;i<planes.length;i++) { + ux = box.upper.x*planes[i].x; uy = box.upper.y*planes[i].y; uz = box.upper.z*planes[i].z; - lx = box.lower.x*planes[i].x; + lx = box.lower.x*planes[i].x; ly = box.lower.y*planes[i].y; lz = box.lower.z*planes[i].z; planes[i].w = -(ux + uy + uz ); // initalize plane to upper vert @@ -438,7 +438,7 @@ public class BoundingPolytope extends Bounds { if( (newD = lx + ly + uz ) + planes[i].w > 0.0) planes[i].w = -newD; if( (newD = lx + ly + lz ) + planes[i].w > 0.0) planes[i].w = -newD; } - + boundsIsEmpty = boundsObject.boundsIsEmpty; boundsIsInfinite = boundsObject.boundsIsInfinite; computeAllVerts(); // XXXX: lazy evaluate @@ -452,7 +452,7 @@ public class BoundingPolytope extends Bounds { pDotN = new double[polytope.planes.length]; } - + for(i=0;i<polytope.planes.length;i++) { planes[i].x = polytope.planes[i].x; planes[i].y = polytope.planes[i].y; @@ -468,7 +468,7 @@ public class BoundingPolytope extends Bounds { boundsIsEmpty = boundsObject.boundsIsEmpty; boundsIsInfinite = boundsObject.boundsIsInfinite; - + } else { throw new IllegalArgumentException(J3dI18N.getString("BoundingPolytope2")); } @@ -554,24 +554,24 @@ public class BoundingPolytope extends Bounds { BoundingSphere sphere; if((boundsObject == null) || (boundsObject.boundsIsEmpty) - || (boundsIsInfinite)) + || (boundsIsInfinite)) return; - + if((boundsIsEmpty) || (boundsObject.boundsIsInfinite)) { this.set(boundsObject); return; } - + boundsIsEmpty = boundsObject.boundsIsEmpty; boundsIsInfinite = boundsObject.boundsIsInfinite; - + if( boundsObject.boundId == BOUNDING_SPHERE ) { sphere = (BoundingSphere)boundsObject; int i; double dis; for(i = 0; i < planes.length; i++){ - dis = sphere.radius+ sphere.center.x*planes[i].x + + dis = sphere.radius+ sphere.center.x*planes[i].x + sphere.center.y*planes[i].y + sphere.center.z * planes[i].z + planes[i].w; if( dis > 0.0 ) { @@ -594,17 +594,17 @@ public class BoundingPolytope extends Bounds { boxVerts[6].set(b.upper.x, b.lower.y, b.upper.z ); boxVerts[7].set(b.upper.x, b.upper.y, b.upper.z ); this.combine(boxVerts); - + } else if(boundsObject.boundId == BOUNDING_POLYTOPE) { BoundingPolytope polytope = (BoundingPolytope)boundsObject; this.combine(polytope.verts); } else { throw new IllegalArgumentException(J3dI18N.getString("BoundingPolytope3")); } - + computeAllVerts(); } - + /** * Combines this bounding polytope with an array of bounding objects so that the * resulting bounding polytope encloses the original bounding polytope and the @@ -618,7 +618,7 @@ public class BoundingPolytope extends Bounds { if( (boundsObjects == null) || (boundsObjects.length <= 0) || (boundsIsInfinite)) return; - + // find first non empty bounds object while( (i<boundsObjects.length) && ((boundsObjects[i]==null) || boundsObjects[i].boundsIsEmpty)) { @@ -626,13 +626,13 @@ public class BoundingPolytope extends Bounds { } if( i >= boundsObjects.length) return; // no non empty bounds so do not modify current bounds - + if(boundsIsEmpty) this.set(boundsObjects[i++]); - + if(boundsIsInfinite) return; - + for(;i<boundsObjects.length;i++) { if( boundsObjects[i] == null ); // do nothing else if( boundsObjects[i].boundsIsEmpty ); // do nothing @@ -643,7 +643,7 @@ public class BoundingPolytope extends Bounds { else if( boundsObjects[i].boundId == BOUNDING_SPHERE ) { BoundingSphere sphere = (BoundingSphere)boundsObjects[i]; for(int j = 0; j < planes.length; j++){ - dis = sphere.radius+ sphere.center.x*planes[j].x + + dis = sphere.radius+ sphere.center.x*planes[j].x + sphere.center.y*planes[j].y + sphere.center.z* planes[j].z + planes[j].w; if( dis > 0.0 ) { @@ -666,23 +666,23 @@ public class BoundingPolytope extends Bounds { boxVerts[6].set(b.upper.x, b.lower.y, b.upper.z ); boxVerts[7].set(b.upper.x, b.upper.y, b.upper.z ); this.combine(boxVerts); - + } else if(boundsObjects[i] instanceof BoundingPolytope) { BoundingPolytope polytope = (BoundingPolytope)boundsObjects[i]; this.combine(polytope.verts); - + } else { throw new IllegalArgumentException(J3dI18N.getString("BoundingPolytope4")); } - + computeAllVerts(); } } - + /** * Combines this bounding polytope with a point. * @param point a 3d point in space - */ + */ public void combine(Point3d point) { int i; double dis; @@ -690,7 +690,7 @@ public class BoundingPolytope extends Bounds { if(boundsIsInfinite) { return; } - + if( boundsIsEmpty ){ planes = new Vector4d[6]; mag = new double[planes.length]; @@ -708,7 +708,7 @@ public class BoundingPolytope extends Bounds { planes[3] = new Vector4d( 0.0,-1.0, 0.0, point.y ); planes[4] = new Vector4d( 0.0, 0.0, 1.0, -point.z ); planes[5] = new Vector4d( 0.0, 0.0,-1.0, point.z ); - mag[0] = 1.0; + mag[0] = 1.0; mag[1] = 1.0; mag[2] = 1.0; mag[3] = 1.0; @@ -730,12 +730,12 @@ public class BoundingPolytope extends Bounds { } computeAllVerts(); } - } - + } + /** * Combines this bounding polytope with an array of points. * @param points an array of 3d points in space - */ + */ public void combine(Point3d[] points) { int i,j; double dis; @@ -761,7 +761,7 @@ public class BoundingPolytope extends Bounds { planes[3] = new Vector4d( 0.0,-1.0, 0.0, points[0].y ); planes[4] = new Vector4d( 0.0, 0.0, 1.0, -points[0].z ); planes[5] = new Vector4d( 0.0, 0.0,-1.0, points[0].z ); - mag[0] = 1.0; + mag[0] = 1.0; mag[1] = 1.0; mag[2] = 1.0; mag[3] = 1.0; @@ -773,7 +773,7 @@ public class BoundingPolytope extends Bounds { boundsIsEmpty = false; boundsIsInfinite = false; } - + for(j = 0; j < points.length; j++){ for(i = 0; i < planes.length; i++){ dis = points[j].x*planes[i].x + points[j].y*planes[i].y + @@ -783,30 +783,30 @@ public class BoundingPolytope extends Bounds { } } } - + computeAllVerts(); } /** * Modifies the bounding polytope so that it bounds the volume * generated by transforming the given bounding object. - * @param boundsObject the bounding object to be transformed + * @param boundsObject the bounding object to be transformed * @param matrix a transformation matrix */ public void transform( Bounds boundsObject, Transform3D matrix) { - + if( boundsObject == null || boundsObject.boundsIsEmpty) { boundsIsEmpty = true; boundsIsInfinite = false; computeAllVerts(); return; } - + if(boundsObject.boundsIsInfinite) { this.set(boundsObject); return; } - + if( boundsObject.boundId == BOUNDING_SPHERE ) { BoundingSphere sphere = new BoundingSphere((BoundingSphere)boundsObject); sphere.transform(matrix); @@ -823,8 +823,8 @@ public class BoundingPolytope extends Bounds { throw new IllegalArgumentException(J3dI18N.getString("BoundingPolytope5")); } } - - /** + + /** * Transforms this bounding polytope by the given transformation matrix. * @param matrix a transformation matrix */ @@ -832,12 +832,12 @@ public class BoundingPolytope extends Bounds { if(boundsIsInfinite) return; - + int i; double invMag; Transform3D invTrans = new Transform3D(matrix); - - invTrans.invert(); + + invTrans.invert(); invTrans.transpose(); for(i = 0; i < planes.length; i++){ @@ -845,9 +845,9 @@ public class BoundingPolytope extends Bounds { planes[i].y = planes[i].y * mag[i]; planes[i].z = planes[i].z * mag[i]; planes[i].w = planes[i].w * mag[i]; - invTrans.transform( planes[i] ); + invTrans.transform( planes[i] ); } - + for(i=0;i<planes.length;i++) { // normalize the plane normals @@ -856,21 +856,21 @@ public class BoundingPolytope extends Bounds { invMag = 1.0/mag[i]; this.planes[i] = new Vector4d( planes[i].x*invMag, planes[i].y*invMag, planes[i].z*invMag, planes[i].w*invMag ); - + } - + for (i=0; i < verts.length; i++) { matrix.transform(verts[i]); } - + } - /** + /** * Test for intersection with a ray. - * @param origin is a the starting point of the ray + * @param origin is a the starting point of the ray * @param direction is the direction of the ray * @param intersectPoint is a point defining the location of the intersection - * @return true or false indicating if an intersection occured + * @return true or false indicating if an intersection occured */ boolean intersect(Point3d origin, Vector3d direction, Point3d intersectPoint ) { @@ -888,13 +888,13 @@ public class BoundingPolytope extends Bounds { intersectPoint.z = origin.z; return true; } - + invMag = 1.0/Math.sqrt(direction.x*direction.x + direction.y*direction.y + direction.z*direction.z); dx = direction.x*invMag; dy = direction.y*invMag; dz = direction.z*invMag; - + // compute intersection point of ray and each plane then test if point is in polytope for(i=0;i<planes.length;i++) { vd = planes[i].x*dx + planes[i].y*dy + planes[i].z*dz; @@ -902,38 +902,38 @@ public class BoundingPolytope extends Bounds { planes[i].z*origin.z + planes[i].w); if(vd != 0.0) { // ray is parallel to plane t = v0/vd; - + if( t >= 0.0) { // plane is behind origin - + x = origin.x + dx*t; // compute intersection point y = origin.y + dy*t; z = origin.z + dz*t; - + if( pointInPolytope(x,y,z) ) { intersectPoint.x = x; intersectPoint.y = y; intersectPoint.z = z; return true; // ray intersects a face of polytope - } - } + } + } } - } - - return false; + } + + return false; } - /** - * Test for intersection with a ray - * @param origin is a the starting point of the ray + /** + * Test for intersection with a ray + * @param origin is a the starting point of the ray * @param direction is the direction of the ray * @param position is a point defining the location of the pick w= distance to pick - * @return true or false indicating if an intersection occured + * @return true or false indicating if an intersection occured */ boolean intersect(Point3d origin, Vector3d direction, Point4d position ) { double t,v0,vd,x,y,z,invMag; double dx, dy, dz; int i,j; - + if( boundsIsEmpty ) { return false; } @@ -945,13 +945,13 @@ public class BoundingPolytope extends Bounds { position.w = 0.0; return true; } - + invMag = 1.0/Math.sqrt(direction.x*direction.x + direction.y* direction.y + direction.z*direction.z); dx = direction.x*invMag; dy = direction.y*invMag; dz = direction.z*invMag; - + for(i=0;i<planes.length;i++) { vd = planes[i].x*dx + planes[i].y*dy + planes[i].z*dz; v0 = -(planes[i].x*origin.x + planes[i].y*origin.y + @@ -959,38 +959,38 @@ public class BoundingPolytope extends Bounds { // System.err.println("v0="+v0+" vd="+vd); if(vd != 0.0) { // ray is parallel to plane t = v0/vd; - + if( t >= 0.0) { // plane is behind origin - + x = origin.x + dx*t; // compute intersection point y = origin.y + dy*t; z = origin.z + dz*t; // System.err.println("t="+t+" point="+x+" "+y+" "+z); - + if( pointInPolytope(x,y,z) ) { position.x = x; position.y = y; position.z = z; position.w = t; return true; // ray intersects a face of polytope - } - } + } + } } - } - + } + return false; } - /** - * Test for intersection with a point - * @param point is the pick point + /** + * Test for intersection with a point + * @param point is the pick point * @param position is a point defining the location of the pick w= distance to pick - * @return true or false indicating if an intersection occured + * @return true or false indicating if an intersection occured */ boolean intersect(Point3d point, Point4d position ) { int i; - + if( boundsIsEmpty ) { return false; } @@ -1008,16 +1008,16 @@ public class BoundingPolytope extends Bounds { point.y*this.planes[i].y + point.z*this.planes[i].z + planes[i].w ) > 0.0 ) return false; - - } + + } return true; } /** * Test for intersection with a segment - * @param start is a point defining the start of the line segment - * @param end is a point defining the end of the line segment + * @param start is a point defining the start of the line segment + * @param end is a point defining the end of the line segment * @param position is a point defining the location of the pick w= distance to pick * @return true or false indicating if an intersection occured */ @@ -1026,11 +1026,11 @@ public class BoundingPolytope extends Bounds { int i,j; //System.err.println("line segment intersect : planes.length " + planes.length); - + if( boundsIsEmpty ) { return false; } - + if( boundsIsInfinite ) { position.x = start.x; position.y = start.y; @@ -1040,11 +1040,11 @@ public class BoundingPolytope extends Bounds { } Point3d direction = new Point3d(); - + direction.x = end.x - start.x; direction.y = end.y - start.y; direction.z = end.z - start.z; - + for(i=0;i<planes.length;i++) { vd = planes[i].x*direction.x + planes[i].y*direction.y + planes[i].z*direction.z; @@ -1053,16 +1053,16 @@ public class BoundingPolytope extends Bounds { // System.err.println("v0="+v0+" vd="+vd); if(vd != 0.0) { // ray is parallel to plane t = v0/vd; - + // System.err.println("t is " + t); - + if( t >= 0.0) { // plane is behind start - + x = start.x + direction.x*t; // compute intersection point y = start.y + direction.y*t; z = start.z + direction.z*t; // System.err.println("t="+t+" point="+x+" "+y+" "+z); - + if( pointInPolytope(x,y,z) ) { // if((t*t) > (end.x-start.x)*(end.x-start.x) + // (end.y-start.y)*(end.y-start.y) + @@ -1075,31 +1075,31 @@ public class BoundingPolytope extends Bounds { return true; // ray intersects a face of polytope } } - } + } } - } - + } + return false; } - /** + /** * Test for intersection with a ray. * @param origin the starting point of the ray * @param direction the direction of the ray * @return true or false indicating if an intersection occured - */ + */ public boolean intersect(Point3d origin, Vector3d direction ) { // compute intersection point of ray and each plane then test if point is in polytope - + double t,v0,vd,x,y,z; int i,j; - + if( boundsIsEmpty ) { return false; } - + if( boundsIsInfinite ) { return true; } @@ -1111,7 +1111,7 @@ public class BoundingPolytope extends Bounds { planes[i].z*origin.z + planes[i].w); if(vd != 0.0) { // ray is parallel to plane t = v0/vd; - + if( t >= 0.0) { // plane is behind origin x = origin.x + direction.x*t; // compute intersection point @@ -1123,13 +1123,13 @@ public class BoundingPolytope extends Bounds { } else { // System.err.println("point outside polytope"); } - } + } } } - + return false; - - } + + } /** * Tests whether the bounding polytope is empty. A bounding polytope is @@ -1149,7 +1149,7 @@ public class BoundingPolytope extends Bounds { * Test for intersection with a point. * @param point a Point defining a position in 3-space * @return true or false indicating if an intersection occured - */ + */ public boolean intersect(Point3d point ) { int i; @@ -1159,14 +1159,14 @@ public class BoundingPolytope extends Bounds { if( boundsIsInfinite ) { return true; } - + for(i = 0; i < this.planes.length; i++){ if(( point.x*this.planes[i].x + point.y*this.planes[i].y + point.z*this.planes[i].z + planes[i].w ) > 0.0 ) return false; - - } + + } return true; } @@ -1175,7 +1175,7 @@ public class BoundingPolytope extends Bounds { * Test for intersection with another bounds object. * @param boundsObject another bounds object * @return true or false indicating if an intersection occured - */ + */ boolean intersect(Bounds boundsObject, Point4d position) { return intersect(boundsObject); } @@ -1184,12 +1184,12 @@ public class BoundingPolytope extends Bounds { * Test for intersection with another bounds object. * @param boundsObject another bounds object * @return true or false indicating if an intersection occured - */ + */ public boolean intersect(Bounds boundsObject) { - + if( boundsObject == null ) { return false; - } + } if( boundsIsEmpty || boundsObject.boundsIsEmpty ) { return false; @@ -1209,27 +1209,27 @@ public class BoundingPolytope extends Bounds { throw new IllegalArgumentException(J3dI18N.getString("BoundingPolytope6")); } } - + /** * Test for intersection with another bounds object. * @param boundsObjects an array of bounding objects * @return true or false indicating if an intersection occured - */ + */ public boolean intersect(Bounds[] boundsObjects) { - + double distsq, radsq; BoundingSphere sphere; int i; if( boundsObjects == null || boundsObjects.length <= 0 ) { return false; } - + if( boundsIsEmpty ) { return false; } - + for(i = 0; i < boundsObjects.length; i++){ - if( boundsObjects[i] == null || boundsObjects[i].boundsIsEmpty) ; + if( boundsObjects[i] == null || boundsObjects[i].boundsIsEmpty) ; else if( boundsIsInfinite || boundsObjects[i].boundsIsInfinite ) { return true; // We're done here. } @@ -1240,7 +1240,7 @@ public class BoundingPolytope extends Bounds { distsq = sphere.center.distanceSquared(sphere.center); if (distsq < radsq) { return true; - } + } } else if(boundsObjects[i].boundId == BOUNDING_BOX){ if( this.intersect(boundsObjects[i])) return true; } else if(boundsObjects[i].boundId == BOUNDING_POLYTOPE) { @@ -1258,7 +1258,7 @@ public class BoundingPolytope extends Bounds { * @param newBoundPolytope the new bounding polytope, which is the intersection of * the boundsObject and this BoundingPolytope * @return true or false indicating if an intersection occured - */ + */ public boolean intersect(Bounds boundsObject, BoundingPolytope newBoundPolytope) { int i; @@ -1281,26 +1281,26 @@ public class BoundingPolytope extends Bounds { return true; } - - BoundingBox tbox = new BoundingBox(); // convert sphere to box - + + BoundingBox tbox = new BoundingBox(); // convert sphere to box + if( boundsObject.boundId == BOUNDING_SPHERE ) { BoundingSphere sphere = (BoundingSphere)boundsObject; if( this.intersect( sphere)) { - BoundingBox sbox = new BoundingBox( sphere ); // convert sphere to box - BoundingBox pbox = new BoundingBox( this ); // convert polytope to box + BoundingBox sbox = new BoundingBox( sphere ); // convert sphere to box + BoundingBox pbox = new BoundingBox( this ); // convert polytope to box pbox.intersect(sbox, tbox); // insersect two boxes newBoundPolytope.set( tbox ); return true; - } + } } else if( boundsObject.boundId == BOUNDING_BOX){ - BoundingBox box = (BoundingBox)boundsObject; + BoundingBox box = (BoundingBox)boundsObject; if( this.intersect( box)) { - BoundingBox pbox = new BoundingBox( this ); // convert polytope to box + BoundingBox pbox = new BoundingBox( this ); // convert polytope to box pbox.intersect(box, tbox); // insersect two boxes newBoundPolytope.set( tbox ); return true; - } + } } else if(boundsObject.boundId == BOUNDING_POLYTOPE) { BoundingPolytope polytope = (BoundingPolytope)boundsObject; @@ -1316,75 +1316,75 @@ public class BoundingPolytope extends Bounds { newBoundPolytope.set(newPtope); return true; - } + } } else { throw new IllegalArgumentException(J3dI18N.getString("BoundingPolytope8")); } - + newBoundPolytope.boundsIsEmpty = true; newBoundPolytope.boundsIsInfinite = false; newBoundPolytope.computeAllVerts(); return false; } - + /** * Test for intersection with an array of bounds objects. * @param boundsObjects an array of bounds objects * @param newBoundingPolytope the new bounding polytope, which is the intersection of * the boundsObject and this BoundingPolytope * @return true or false indicating if an intersection occured - */ + */ public boolean intersect(Bounds[] boundsObjects, BoundingPolytope newBoundingPolytope) { - + if( boundsObjects == null || boundsObjects.length <= 0 || boundsIsEmpty ) { newBoundingPolytope.boundsIsEmpty = true; newBoundingPolytope.boundsIsInfinite = false; newBoundingPolytope.computeAllVerts(); return false; - } + } int i=0; // find first non null bounds object while( boundsObjects[i] == null && i < boundsObjects.length) { i++; } - + if( i >= boundsObjects.length ) { // all bounds objects were empty newBoundingPolytope.boundsIsEmpty = true; newBoundingPolytope.boundsIsInfinite = false; newBoundingPolytope.computeAllVerts(); return false; } - + boolean status = false; - BoundingBox tbox = new BoundingBox(); // convert sphere to box + BoundingBox tbox = new BoundingBox(); // convert sphere to box for(i=0;i<boundsObjects.length;i++) { if( boundsObjects[i] == null || boundsObjects[i].boundsIsEmpty) ; else if( boundsObjects[i].boundId == BOUNDING_SPHERE ) { BoundingSphere sphere = (BoundingSphere)boundsObjects[i]; if( this.intersect( sphere)) { - BoundingBox sbox = new BoundingBox( sphere ); // convert sphere to box - BoundingBox pbox = new BoundingBox( this ); // convert polytope to box + BoundingBox sbox = new BoundingBox( sphere ); // convert sphere to box + BoundingBox pbox = new BoundingBox( this ); // convert polytope to box pbox.intersect(sbox, tbox); // insersect two boxes if ( status ) { - newBoundingPolytope.combine( tbox ); + newBoundingPolytope.combine( tbox ); } else { - newBoundingPolytope.set( tbox ); + newBoundingPolytope.set( tbox ); status = true; } } } else if( boundsObjects[i].boundId == BOUNDING_BOX){ BoundingBox box = (BoundingBox)boundsObjects[i]; if( this.intersect( box) ){ - BoundingBox pbox = new BoundingBox( this ); // convert polytope to box + BoundingBox pbox = new BoundingBox( this ); // convert polytope to box pbox.intersect(box,tbox); // insersect two boxes if ( status ) { - newBoundingPolytope.combine( tbox ); + newBoundingPolytope.combine( tbox ); } else { - newBoundingPolytope.set( tbox ); + newBoundingPolytope.set( tbox ); status = true; } } else { @@ -1411,10 +1411,10 @@ public class BoundingPolytope extends Bounds { } else { throw new IllegalArgumentException(J3dI18N.getString("BoundingPolytope8")); } - + if(newBoundingPolytope.boundsIsInfinite) - break; // We're done. - + break; // We're done. + } if( status == false ) { @@ -1423,12 +1423,12 @@ public class BoundingPolytope extends Bounds { newBoundingPolytope.computeAllVerts(); } return status; - - } - /** + + } + /** * Finds closest bounding object that intersects this bounding polytope. - * @param boundsObjects is an array of bounds objects - * @return closest bounding object + * @param boundsObjects is an array of bounds objects + * @return closest bounding object */ public Bounds closestIntersection( Bounds[] boundsObjects) { @@ -1443,7 +1443,7 @@ public class BoundingPolytope extends Bounds { double dis,disToPlane; boolean contains = false; boolean inside; - double smallest_distance = Double.MAX_VALUE; + double smallest_distance = Double.MAX_VALUE; int i,j,index=0; double cenX = 0.0, cenY = 0.0, cenZ = 0.0; @@ -1460,13 +1460,13 @@ public class BoundingPolytope extends Bounds { for(j=0;j<planes.length;j++) { if( ( sphere.center.x*planes[j].x + sphere.center.y*planes[j].y + - sphere.center.z*planes[j].z + planes[i].w ) > 0.0 ) { // check if sphere center in polytope - disToPlane = sphere.center.x*planes[j].x + + sphere.center.z*planes[j].z + planes[i].w ) > 0.0 ) { // check if sphere center in polytope + disToPlane = sphere.center.x*planes[j].x + sphere.center.y*planes[j].y + sphere.center.z*planes[j].z + planes[j].w; // check if distance from center to plane is larger than radius - if( disToPlane > sphere.radius ) inside = false; + if( disToPlane > sphere.radius ) inside = false; } } if( inside) { // contains the sphere @@ -1529,10 +1529,10 @@ public class BoundingPolytope extends Bounds { (centroid.z-polytope.centroid.z)*(centroid.z-polytope.centroid.z) ); inside = true; for(j=0;j<polytope.nVerts;j++) { - if ( !pointInPolytope( polytope.verts[j].x, polytope.verts[j].y, polytope.verts[j].z ) ) + if ( !pointInPolytope( polytope.verts[j].x, polytope.verts[j].y, polytope.verts[j].z ) ) inside = false; } - if( inside ) { + if( inside ) { if( !contains ){ // initialize smallest_distance for the first containment index = i; smallest_distance = dis; @@ -1559,18 +1559,18 @@ public class BoundingPolytope extends Bounds { return boundsObjects[index]; } - /** + /** * Returns a string representation of this class */ public String toString() { int i; - + String description = new String("BoundingPolytope:\n Num Planes ="+planes.length); for(i = 0; i < planes.length; i++){ description = description+"\n"+mag[i]*planes[i].x+" "+ mag[i]*planes[i].y+" "+mag[i]*planes[i].z+" "+mag[i]*planes[i].w; } - + return description; } @@ -1579,39 +1579,39 @@ public class BoundingPolytope extends Bounds { det = planes[a].x*planes[b].y*planes[c].z + planes[a].y*planes[b].z*planes[c].x + planes[a].z*planes[b].x*planes[c].y - planes[a].z*planes[b].y*planes[c].x - - planes[a].y*planes[b].x*planes[c].z - planes[a].x*planes[b].z*planes[c].y; + planes[a].y*planes[b].x*planes[c].z - planes[a].x*planes[b].z*planes[c].y; // System.err.println("\n det="+det); if( det*det < EPSILON ){ // System.err.println("parallel planes="+a+" "+b+" "+c); return; // two planes are parallel } - + det = 1.0/det; - + x = (planes[b].y*planes[c].z - planes[b].z*planes[c].y) * pDotN[a]; y = (planes[b].z*planes[c].x - planes[b].x*planes[c].z) * pDotN[a]; z = (planes[b].x*planes[c].y - planes[b].y*planes[c].x) * pDotN[a]; - + x += (planes[c].y*planes[a].z - planes[c].z*planes[a].y) * pDotN[b]; y += (planes[c].z*planes[a].x - planes[c].x*planes[a].z) * pDotN[b]; z += (planes[c].x*planes[a].y - planes[c].y*planes[a].x) * pDotN[b]; - + x += (planes[a].y*planes[b].z - planes[a].z*planes[b].y) * pDotN[c]; y += (planes[a].z*planes[b].x - planes[a].x*planes[b].z) * pDotN[c]; z += (planes[a].x*planes[b].y - planes[a].y*planes[b].x) * pDotN[c]; - + x = x*det; y = y*det; z = z*det; - + if (pointInPolytope( x, y, z ) ) { if (nVerts >= verts.length) { Point3d newVerts[] = new Point3d[nVerts << 1]; for(int i=0;i<nVerts;i++) { newVerts[i] = verts[i]; } - verts = newVerts; + verts = newVerts; } verts[nVerts++] = new Point3d( x,y,z); } @@ -1621,18 +1621,18 @@ public class BoundingPolytope extends Bounds { private void computeAllVerts() { int i,a,b,c; double x,y,z; - + nVerts = 0; - + if( boundsIsEmpty) { verts = null; return; } - - verts = new Point3d[planes.length*planes.length]; + + verts = new Point3d[planes.length*planes.length]; for(i=0;i<planes.length;i++) { - pDotN[i] = -planes[i].x*planes[i].w*planes[i].x - + pDotN[i] = -planes[i].x*planes[i].w*planes[i].x - planes[i].y*planes[i].w*planes[i].y - planes[i].z*planes[i].w*planes[i].z; } @@ -1645,8 +1645,8 @@ public class BoundingPolytope extends Bounds { } } // XXXX: correctly compute centroid - - x=y=z=0.0; + + x=y=z=0.0; Point3d newVerts[] = new Point3d[nVerts]; for(i=0;i<nVerts;i++) { @@ -1656,15 +1656,15 @@ public class BoundingPolytope extends Bounds { // copy the verts into an array of the correct size newVerts[i] = verts[i]; } - + this.verts = newVerts; // copy the verts into an array of the correct size - + centroid.x = x/nVerts; centroid.y = y/nVerts; centroid.z = z/nVerts; - + checkBoundsIsEmpty(); - + } private boolean pointInPolytope( double x, double y, double z ){ @@ -1675,22 +1675,22 @@ public class BoundingPolytope extends Bounds { z*planes[i].z + planes[i].w ) > EPSILON ) { return false; } - - } + + } return true; } private void checkBoundsIsEmpty() { boundsIsEmpty = (planes.length < 4); } - + private void initEmptyPolytope() { planes = new Vector4d[6]; pDotN = new double[6]; mag = new double[6]; verts = new Point3d[planes.length*planes.length]; nVerts = 0; - + planes[0] = new Vector4d( 1.0, 0.0, 0.0, -1.0 ); planes[1] = new Vector4d(-1.0, 0.0, 0.0, -1.0 ); planes[2] = new Vector4d( 0.0, 1.0, 0.0, -1.0 ); @@ -1703,7 +1703,7 @@ public class BoundingPolytope extends Bounds { mag[3] = 1.0; mag[4] = 1.0; mag[5] = 1.0; - + checkBoundsIsEmpty(); } @@ -1718,7 +1718,7 @@ public class BoundingPolytope extends Bounds { */ Bounds copy(Bounds r) { int i, k; - + if (r != null && this.boundId == r.boundId) { BoundingPolytope region = (BoundingPolytope) r; if( region.planes.length !=planes.length) { @@ -1734,8 +1734,8 @@ public class BoundingPolytope extends Bounds { for(k=0;k<nVerts;k++) region.verts[k] = new Point3d(verts[k]); } - - + + for(i=0;i<planes.length;i++) { region.planes[i].x = planes[i].x; region.planes[i].y = planes[i].y; diff --git a/src/classes/share/javax/media/j3d/BoundingSphere.java b/src/classes/share/javax/media/j3d/BoundingSphere.java index f0d41fc..cf0fe3e 100644 --- a/src/classes/share/javax/media/j3d/BoundingSphere.java +++ b/src/classes/share/javax/media/j3d/BoundingSphere.java @@ -41,7 +41,7 @@ import com.sun.j3d.internal.HashCodeUtil; */ public class BoundingSphere extends Bounds { - + /** * The center of the bounding sphere. */ @@ -51,14 +51,14 @@ public class BoundingSphere extends Bounds { * The radius of the bounding sphere. */ double radius; - + Point3d boxVerts[]; boolean allocBoxVerts = false; // reusable temp objects private BoundingBox tmpBox = null; private BoundingPolytope tmpPolytope = null; - + /** * Constructs and initializes a BoundingSphere from a center and radius. * @param center the center of the bounding sphere @@ -80,22 +80,22 @@ public class BoundingSphere extends Bounds { } /** - * Constructs and initializes a BoundingSphere from a bounding object. + * Constructs and initializes a BoundingSphere from a bounding object. * @param boundsObject a bounds object */ public BoundingSphere(Bounds boundsObject) { int i; - + boundId = BOUNDING_SPHERE; - if (boundsObject == null) { + if (boundsObject == null) { // Negative volume. center = new Point3d(); radius = -1.0; - } + } else if( boundsObject.boundsIsInfinite ) { center = new Point3d(); radius = Double.POSITIVE_INFINITY; - + } else if( boundsObject.boundId == BOUNDING_BOX){ BoundingBox box = (BoundingBox)boundsObject; center = new Point3d(); @@ -108,12 +108,12 @@ public class BoundingSphere extends Bounds { (box.upper.y-box.lower.y)+ (box.upper.z-box.lower.z)* (box.upper.z-box.lower.z))); - + } else if (boundsObject.boundId == BOUNDING_SPHERE) { BoundingSphere sphere = (BoundingSphere)boundsObject; center = new Point3d(sphere.center); radius = sphere.radius; - + } else if(boundsObject.boundId == BOUNDING_POLYTOPE) { BoundingPolytope polytope = (BoundingPolytope)boundsObject; double t,dis,dis_sq,rad_sq,oldc_to_new_c; @@ -127,10 +127,10 @@ public class BoundingSphere extends Bounds { (polytope.verts[0].y - center.y) + (polytope.verts[0].z - center.z)* (polytope.verts[0].z - center.z)); - + for(i=1;i<polytope.nVerts;i++) { rad_sq = radius * radius; - + dis_sq = (polytope.verts[i].x - center.x)* (polytope.verts[i].x - center.x) + (polytope.verts[i].y - center.y)* @@ -144,7 +144,7 @@ public class BoundingSphere extends Bounds { dis = Math.sqrt( dis_sq); radius = (radius + dis)*.5; oldc_to_new_c = dis - radius; - t = oldc_to_new_c/dis; + t = oldc_to_new_c/dis; center.x = center.x + (polytope.verts[i].x - center.x)*t; center.y = center.y + (polytope.verts[i].y - center.y)*t; center.z = center.z + (polytope.verts[i].z - center.z)*t; @@ -153,13 +153,13 @@ public class BoundingSphere extends Bounds { } else { throw new IllegalArgumentException(J3dI18N.getString("BoundingSphere0")); } - + updateBoundsStates(); } /** - * Constructs and initializes a BoundingSphere from an array of bounding objects. - * @param boundsObjects an array of bounds objects + * Constructs and initializes a BoundingSphere from an array of bounding objects. + * @param boundsObjects an array of bounds objects */ public BoundingSphere(Bounds[] boundsObjects) { int i=0; @@ -184,7 +184,7 @@ public class BoundingSphere extends Bounds { // Negative volume. radius = -1.0; updateBoundsStates(); - return; + return; } this.set(boundsObjects[i++]); @@ -231,7 +231,7 @@ public class BoundingSphere extends Bounds { center.x = sphere.center.x + (center.x-sphere.center.x)*t; center.y = sphere.center.y + (center.y-sphere.center.y)*t; center.z = sphere.center.z + (center.z-sphere.center.z)*t; - } + } }else { if( (dis+radius) <= sphere.radius) { center.x = sphere.center.x; @@ -246,7 +246,7 @@ public class BoundingSphere extends Bounds { center.y = center.y + (sphere.center.y-center.y)*t; center.z = center.z + (sphere.center.z-center.z)*t; } - } + } } else if(boundsObjects[i].boundId == BOUNDING_POLYTOPE) { BoundingPolytope polytope = (BoundingPolytope)boundsObjects[i]; @@ -299,7 +299,7 @@ public class BoundingSphere extends Bounds { this.center.z = center.z; checkBoundsIsNaN(); } - + /** * Sets the value of this BoundingSphere. * @param boundsObject another bounds object @@ -346,7 +346,7 @@ public class BoundingSphere extends Bounds { (polytope.verts[0].y - center.y) + (polytope.verts[0].z - center.z)* (polytope.verts[0].z - center.z)); - + for(i=1;i<polytope.nVerts;i++) { rad_sq = radius * radius; @@ -356,14 +356,14 @@ public class BoundingSphere extends Bounds { (polytope.verts[i].y - center.y) + (polytope.verts[i].z - center.z)* (polytope.verts[i].z - center.z); - + // change sphere so one side passes through the point // and other passes through the old sphere if( dis_sq > rad_sq) { // point is outside sphere dis = Math.sqrt( dis_sq); radius = (radius + dis)*.5; oldc_to_new_c = dis - radius; - t = oldc_to_new_c/dis; + t = oldc_to_new_c/dis; center.x = center.x + (polytope.verts[i].x - center.x)*t; center.y = center.y + (polytope.verts[i].y - center.y)*t; center.z = center.z + (polytope.verts[i].z - center.z)*t; @@ -377,7 +377,7 @@ public class BoundingSphere extends Bounds { /** * Creates a copy of the bounding sphere. - * @return a BoundingSphere + * @return a BoundingSphere */ public Object clone() { return new BoundingSphere(this.center, this.radius); @@ -434,7 +434,7 @@ public class BoundingSphere extends Bounds { } - /** + /** * Combines this bounding sphere with a bounding object so that the * resulting bounding sphere encloses the original bounding sphere and the * given bounds object. @@ -447,7 +447,7 @@ public class BoundingSphere extends Bounds { if((boundsObject == null) || (boundsObject.boundsIsEmpty) || (boundsIsInfinite)) return; - + if((boundsIsEmpty) || (boundsObject.boundsIsInfinite)) { this.set(boundsObject); return; @@ -456,25 +456,25 @@ public class BoundingSphere extends Bounds { if( boundsObject.boundId == BOUNDING_BOX){ BoundingBox b = (BoundingBox)boundsObject; - - // start with point furthest from sphere + + // start with point furthest from sphere u = b.upper.x-center.x; l = b.lower.x-center.x; - if( u*u > l*l) + if( u*u > l*l) x = b.upper.x; else x = b.lower.x; u = b.upper.y-center.y; l = b.lower.y-center.y; - if( u*u > l*l) + if( u*u > l*l) y = b.upper.y; else y = b.lower.y; u = b.upper.z-center.z; l = b.lower.z-center.z; - if( u*u > l*l) + if( u*u > l*l) z = b.upper.z; else z = b.lower.z; @@ -482,7 +482,7 @@ public class BoundingSphere extends Bounds { dis = Math.sqrt( (x - center.x)*(x - center.x) + (y - center.y)*(y - center.y) + (z - center.z)*(z - center.z) ); - + if( dis > radius) { radius = (dis + radius)*.5; oldc_to_new_c = dis - radius; @@ -514,7 +514,7 @@ public class BoundingSphere extends Bounds { center.x = sphere.center.x + (center.x-sphere.center.x)*t; center.y = sphere.center.y + (center.y-sphere.center.y)*t; center.z = sphere.center.z + (center.z-sphere.center.z)*t; - } + } }else { if( (dis+radius) <= sphere.radius) { center.x = sphere.center.x; @@ -529,7 +529,7 @@ public class BoundingSphere extends Bounds { center.y = center.y + (sphere.center.y-center.y)*t; center.z = center.z + (sphere.center.z-center.z)*t; } - } + } } else if(boundsObject.boundId == BOUNDING_POLYTOPE) { BoundingPolytope polytope = (BoundingPolytope)boundsObject; @@ -539,13 +539,13 @@ public class BoundingSphere extends Bounds { } updateBoundsStates(); } - + private void combinePoint( double x, double y, double z) { double dis,oldc_to_new_c; dis = Math.sqrt( (x - center.x)*(x - center.x) + (y - center.y)*(y - center.y) + (z - center.z)*(z - center.z) ); - + if( dis > radius) { radius = (dis + radius)*.5; oldc_to_new_c = dis - radius; @@ -555,7 +555,7 @@ public class BoundingSphere extends Bounds { } } - /** + /** * Combines this bounding sphere with an array of bounding objects so that the * resulting bounding sphere encloses the original bounding sphere and the * given array of bounds object. @@ -567,12 +567,12 @@ public class BoundingSphere extends Bounds { BoundingPolytope polytope; double t,dis,d1,u,l,x,y,z,oldc_to_new_c; int i=0; - - + + if((boundsObjects == null) || (boundsObjects.length <= 0) || (boundsIsInfinite)) return; - + // find first non empty bounds object while((i<boundsObjects.length) && ((boundsObjects[i] == null) || boundsObjects[i].boundsIsEmpty)) { @@ -580,13 +580,13 @@ public class BoundingSphere extends Bounds { } if( i >= boundsObjects.length) return; // no non empty bounds so do not modify current bounds - + if( boundsIsEmpty) this.set(boundsObjects[i++]); if(boundsIsInfinite) return; - + for(;i<boundsObjects.length;i++) { if( boundsObjects[i] == null ); // do nothing else if( boundsObjects[i].boundsIsEmpty); // do nothing @@ -596,35 +596,35 @@ public class BoundingSphere extends Bounds { center.z = 0.0; radius = Double.POSITIVE_INFINITY; break; // We're done. - } else if( boundsObjects[i].boundId == BOUNDING_BOX){ - b = (BoundingBox)boundsObjects[i]; - - // start with point furthest from sphere + } else if( boundsObjects[i].boundId == BOUNDING_BOX){ + b = (BoundingBox)boundsObjects[i]; + + // start with point furthest from sphere u = b.upper.x-center.x; l = b.lower.x-center.x; - if( u*u > l*l) + if( u*u > l*l) x = b.upper.x; else x = b.lower.x; - + u = b.upper.y-center.y; l = b.lower.y-center.y; - if( u*u > l*l) + if( u*u > l*l) y = b.upper.y; else y = b.lower.y; u = b.upper.z-center.z; l = b.lower.z-center.z; - if( u*u > l*l) + if( u*u > l*l) z = b.upper.z; else z = b.lower.z; - + dis = Math.sqrt( (x - center.x)*(x - center.x) + (y - center.y)*(y - center.y) + (z - center.z)*(z - center.z) ); - + if( dis > radius) { radius = (dis + radius)*.5; oldc_to_new_c = dis - radius; @@ -649,14 +649,14 @@ public class BoundingSphere extends Bounds { (center.z - sphere.center.z)* (center.z - sphere.center.z) ); if( radius > sphere.radius) { - if( (dis+sphere.radius) > radius) { + if( (dis+sphere.radius) > radius) { d1 = .5*(radius-sphere.radius+dis); t = d1/dis; radius = d1+sphere.radius; center.x = sphere.center.x + (center.x-sphere.center.x)*t; center.y = sphere.center.y + (center.y-sphere.center.y)*t; center.z = sphere.center.z + (center.z-sphere.center.z)*t; - } + } }else { if( (dis+radius) <= sphere.radius) { center.x = sphere.center.x; @@ -671,10 +671,10 @@ public class BoundingSphere extends Bounds { center.y = center.y + (sphere.center.y-center.y)*t; center.z = center.z + (sphere.center.z-center.z)*t; } - } + } } else if(boundsObjects[i].boundId == BOUNDING_POLYTOPE) { - polytope = (BoundingPolytope)boundsObjects[i]; - this.combine(polytope.verts); + polytope = (BoundingPolytope)boundsObjects[i]; + this.combine(polytope.verts); } else { throw new IllegalArgumentException(J3dI18N.getString("BoundingSphere4")); } @@ -683,7 +683,7 @@ public class BoundingSphere extends Bounds { updateBoundsStates(); } - /** + /** * Combines this bounding sphere with a point. * @param point a 3D point in space */ @@ -693,7 +693,7 @@ public class BoundingSphere extends Bounds { if( boundsIsInfinite) { return; } - + if( boundsIsEmpty) { radius = 0.0; center.x = point.x; @@ -712,16 +712,16 @@ public class BoundingSphere extends Bounds { center.z = (radius*center.z + oldc_to_new_c*point.z)/dis; } } - + updateBoundsStates(); - } - + } + /** * Combines this bounding sphere with an array of points. * @param points an array of 3D points in space */ public void combine(Point3d[] points) { - int i; + int i; double dis,dis_sq,rad_sq,oldc_to_new_c; if( boundsIsInfinite) { @@ -740,7 +740,7 @@ public class BoundingSphere extends Bounds { dis_sq = (points[i].x - center.x)*(points[i].x - center.x) + (points[i].y - center.y)*(points[i].y - center.y) + (points[i].z - center.z)*(points[i].z - center.z); - + // change sphere so one side passes through the point and // other passes through the old sphere if( dis_sq > rad_sq) { @@ -752,15 +752,15 @@ public class BoundingSphere extends Bounds { center.z = (radius*center.z + oldc_to_new_c*points[i].z)/dis; } } - + updateBoundsStates(); } - + /** * Modifies the bounding sphere so that it bounds the volume * generated by transforming the given bounding object. - * @param boundsObject the bounding object to be transformed + * @param boundsObject the bounding object to be transformed * @param matrix a transformation matrix */ public void transform( Bounds boundsObject, Transform3D matrix) { @@ -773,14 +773,14 @@ public class BoundingSphere extends Bounds { updateBoundsStates(); return; } - + if(boundsObject.boundsIsInfinite) { center.x = center.y = center.z = 0.0; radius = Double.POSITIVE_INFINITY; updateBoundsStates(); return; } - + if( boundsObject.boundId == BOUNDING_BOX){ if (tmpBox == null) { tmpBox = new BoundingBox( (BoundingBox)boundsObject); @@ -814,7 +814,7 @@ public class BoundingSphere extends Bounds { } } - /** + /** * Transforms this bounding sphere by the given matrix. */ public void transform( Transform3D trans) { @@ -835,15 +835,15 @@ public class BoundingSphere extends Bounds { } } - /** - * Test for intersection with a ray - * @param origin the starting point of the ray + /** + * Test for intersection with a ray + * @param origin the starting point of the ray * @param direction the direction of the ray * @param position3 a point defining the location of the pick w= distance to pick - * @return true or false indicating if an intersection occured + * @return true or false indicating if an intersection occured */ boolean intersect(Point3d origin, Vector3d direction, Point4d position ) { - + if( boundsIsEmpty ) { return false; } @@ -863,15 +863,15 @@ public class BoundingSphere extends Bounds { oc.x = center.x - origin.x; oc.y = center.y - origin.y; oc.z = center.z - origin.z; - + l2oc = oc.x*oc.x + oc.y*oc.y + oc.z*oc.z; // center to origin squared - + rad2 = radius*radius; if( l2oc < rad2 ){ // System.err.println("ray origin inside sphere" ); return true; // ray origin inside sphere } - + invMag = 1.0/Math.sqrt(direction.x*direction.x + direction.y*direction.y + direction.z*direction.z); @@ -879,14 +879,14 @@ public class BoundingSphere extends Bounds { dir.y = direction.y*invMag; dir.z = direction.z*invMag; tca = oc.x*dir.x + oc.y*dir.y + oc.z*dir.z; - + if( tca <= 0.0 ) { // System.err.println("ray points away from sphere" ); return false; // ray points away from sphere } - + t2hc = rad2 - l2oc + tca*tca; - + if( t2hc > 0.0 ){ t = tca - Math.sqrt(t2hc); // System.err.println("ray hits sphere:"+this.toString()+" t="+t+" direction="+dir ); @@ -902,15 +902,15 @@ public class BoundingSphere extends Bounds { } - /** - * Test for intersection with a point - * @param point the pick point + /** + * Test for intersection with a point + * @param point the pick point * @param position a point defining the location of the pick w= distance to pick - * @return true or false indicating if an intersection occured + * @return true or false indicating if an intersection occured */ boolean intersect(Point3d point, Point4d position ) { double x,y,z,dist; - + if( boundsIsEmpty ) { return false; } @@ -942,13 +942,13 @@ public class BoundingSphere extends Bounds { /** * Test for intersection with a segment - * @param start a point defining the start of the line segment - * @param end a point defining the end of the line segment + * @param start a point defining the start of the line segment + * @param end a point defining the end of the line segment * @param position a point defining the location of the pick w= distance to pick * @return true or false indicating if an intersection occured */ boolean intersect( Point3d start, Point3d end, Point4d position ) { - + if( boundsIsEmpty ) { return false; } @@ -960,7 +960,7 @@ public class BoundingSphere extends Bounds { position.w = 0.0; return true; } - + double l2oc,rad2,tca,t2hc,mag,invMag,t; Vector3d dir = new Vector3d(); // normalized direction of ray Point3d oc = new Point3d(); // vector from sphere center to ray origin @@ -979,24 +979,24 @@ public class BoundingSphere extends Bounds { dir.y = direction.y*invMag; dir.z = direction.z*invMag; - + l2oc = oc.x*oc.x + oc.y*oc.y + oc.z*oc.z; // center to origin squared - + rad2 = radius*radius; if( l2oc < rad2 ){ // System.err.println("ray origin inside sphere" ); return true; // ray origin inside sphere - } - + } + tca = oc.x*dir.x + oc.y*dir.y + oc.z*dir.z; - + if( tca <= 0.0 ) { // System.err.println("ray points away from sphere" ); return false; // ray points away from sphere - } - + } + t2hc = rad2 - l2oc + tca*tca; - + if( t2hc > 0.0 ){ t = tca - Math.sqrt(t2hc); if( t*t <= ((end.x-start.x)*(end.x-start.x)+ @@ -1013,12 +1013,12 @@ public class BoundingSphere extends Bounds { return false; } - /** + /** * Test for intersection with a ray. * @param origin the starting point of the ray * @param direction the direction of the ray * @return true or false indicating if an intersection occured - */ + */ public boolean intersect(Point3d origin, Vector3d direction ) { if( boundsIsEmpty ) { @@ -1032,7 +1032,7 @@ public class BoundingSphere extends Bounds { double l2oc,rad2,tca,t2hc,mag; Vector3d dir = new Vector3d(); // normalized direction of ray Point3d oc = new Point3d(); // vector from sphere center to ray origin - + oc.x = center.x - origin.x; oc.y = center.y - origin.y; oc.z = center.z - origin.z; @@ -1060,16 +1060,16 @@ public class BoundingSphere extends Bounds { t2hc = rad2 - l2oc + tca*tca; - if( t2hc > 0.0 ){ + if( t2hc > 0.0 ){ // System.err.println("ray hits sphere" ); return true; // ray hits sphere - }else { + }else { // System.err.println("ray does not hit sphere" ); return false; } - } + } + - /** * Returns the position of the intersect point if the ray intersects with * the sphere. @@ -1080,7 +1080,7 @@ public class BoundingSphere extends Bounds { if( boundsIsEmpty ) { return false; } - + if( boundsIsInfinite ) { intersectPoint.x = origin.x; intersectPoint.y = origin.y; @@ -1103,7 +1103,7 @@ public class BoundingSphere extends Bounds { // System.err.println("ray origin inside sphere" ); return true; // ray origin inside sphere } - + mag = Math.sqrt(direction.x*direction.x + direction.y*direction.y + direction.z*direction.z); @@ -1119,14 +1119,14 @@ public class BoundingSphere extends Bounds { t2hc = rad2 - l2oc + tca*tca; - if( t2hc > 0.0 ){ + if( t2hc > 0.0 ){ t = tca - Math.sqrt(t2hc); intersectPoint.x = origin.x + direction.x*t; intersectPoint.y = origin.y + direction.y*t; intersectPoint.z = origin.z + direction.z*t; // System.err.println("ray hits sphere" ); return true; // ray hits sphere - }else { + }else { // System.err.println("ray does not hit sphere" ); return false; } @@ -1137,7 +1137,7 @@ public class BoundingSphere extends Bounds { * Test for intersection with a point. * @param point a point defining a position in 3-space * @return true or false indicating if an intersection occured - */ + */ public boolean intersect(Point3d point ) { double x,y,z,dist; @@ -1147,17 +1147,17 @@ public class BoundingSphere extends Bounds { if( boundsIsInfinite ) { return true; } - + x = point.x - center.x; y = point.y - center.y; z = point.z - center.z; - + dist = x*x + y*y + z*z; if( dist > radius*radius) return false; else return true; - + } /** @@ -1176,7 +1176,7 @@ public class BoundingSphere extends Bounds { * Test for intersection with another bounds object. * @param boundsObject another bounds object * @return true or false indicating if an intersection occured - */ + */ boolean intersect(Bounds boundsObject, Point4d position) { return intersect(boundsObject); } @@ -1185,15 +1185,15 @@ public class BoundingSphere extends Bounds { * Test for intersection with another bounds object. * @param boundsObject another bounds object * @return true or false indicating if an intersection occured - */ + */ public boolean intersect(Bounds boundsObject) { double distsq, radsq; BoundingSphere sphere; boolean intersect; - + if( boundsObject == null ) { return false; - } + } if( boundsIsEmpty || boundsObject.boundsIsEmpty ) { return false; @@ -1227,8 +1227,8 @@ public class BoundingSphere extends Bounds { else if( center.z > box.upper.z ) dis += (center.z-box.upper.z)*(center.z-box.upper.z); - - return ( dis <= rad_sq ); + + return ( dis <= rad_sq ); } else if( boundsObject.boundId == BOUNDING_SPHERE ) { sphere = (BoundingSphere)boundsObject; radsq = radius + sphere.radius; @@ -1246,12 +1246,12 @@ public class BoundingSphere extends Bounds { * Test for intersection with another bounds object. * @param boundsObjects an array of bounding objects * @return true or false indicating if an intersection occured - */ + */ public boolean intersect(Bounds[] boundsObjects) { double distsq, radsq; BoundingSphere sphere; int i; - + if( boundsObjects == null || boundsObjects.length <= 0 ) { return false; } @@ -1259,7 +1259,7 @@ public class BoundingSphere extends Bounds { if( boundsIsEmpty ) { return false; } - + for(i = 0; i < boundsObjects.length; i++){ if( boundsObjects[i] == null || boundsObjects[i].boundsIsEmpty); else if( boundsIsInfinite || boundsObjects[i].boundsIsInfinite ) { @@ -1280,10 +1280,10 @@ public class BoundingSphere extends Bounds { throw new IllegalArgumentException(J3dI18N.getString("BoundingSphere7")); } } - + return false; - - } + + } /** * Test for intersection with another bounds object. @@ -1291,9 +1291,9 @@ public class BoundingSphere extends Bounds { * @param newBoundSphere the new bounding sphere which is the intersection of * the boundsObject and this BoundingSphere * @return true or false indicating if an intersection occured - */ + */ public boolean intersect(Bounds boundsObject, BoundingSphere newBoundSphere) { - + if((boundsObject == null ) || boundsIsEmpty || boundsObject.boundsIsEmpty) { // Negative volume. newBoundSphere.center.x = newBoundSphere.center.y = @@ -1318,7 +1318,7 @@ public class BoundingSphere extends Bounds { BoundingBox tbox = new BoundingBox(); BoundingBox box = (BoundingBox)boundsObject; if( this.intersect( box) ){ - BoundingBox sbox = new BoundingBox( this ); // convert sphere to box + BoundingBox sbox = new BoundingBox( this ); // convert sphere to box sbox.intersect(box, tbox); // insersect two boxes newBoundSphere.set( tbox ); // set sphere to the intersection of 2 boxes return true; @@ -1368,7 +1368,7 @@ public class BoundingSphere extends Bounds { newBoundSphere.updateBoundsStates(); return status; - + } else if(boundsObject.boundId == BOUNDING_POLYTOPE) { BoundingBox tbox = new BoundingBox(); @@ -1398,8 +1398,8 @@ public class BoundingSphere extends Bounds { * @param newBoundSphere the new bounding sphere which is the intersection of * the boundsObject and this BoundingSphere * @return true or false indicating if an intersection occured - */ - public boolean intersect(Bounds[] boundsObjects, BoundingSphere newBoundSphere) { + */ + public boolean intersect(Bounds[] boundsObjects, BoundingSphere newBoundSphere) { if( boundsObjects == null || boundsObjects.length <= 0 || boundsIsEmpty ) { // Negative volume. @@ -1411,12 +1411,12 @@ public class BoundingSphere extends Bounds { } int i=0; - + // find first non null bounds object while( boundsObjects[i] == null && i < boundsObjects.length) { i++; } - + if( i >= boundsObjects.length ) { // all bounds objects were empty // Negative volume. newBoundSphere.center.x = newBoundSphere.center.y = @@ -1424,8 +1424,8 @@ public class BoundingSphere extends Bounds { newBoundSphere.radius = -1.0; newBoundSphere.updateBoundsStates(); return false; - } - + } + boolean status = false; double newRadius; Point3d newCenter = new Point3d(); @@ -1436,7 +1436,7 @@ public class BoundingSphere extends Bounds { else if( boundsObjects[i].boundId == BOUNDING_BOX) { BoundingBox box = (BoundingBox)boundsObjects[i]; if( this.intersect( box) ){ - BoundingBox sbox = new BoundingBox( this ); // convert sphere to box + BoundingBox sbox = new BoundingBox( this ); // convert sphere to box sbox.intersect(box,tbox); // insersect two boxes if( status ) { newBoundSphere.combine( tbox ); @@ -1520,10 +1520,10 @@ public class BoundingSphere extends Bounds { return status; } - /** + /** * Finds closest bounding object that intersects this bounding sphere. - * @param boundsObjects an array of bounds objects - * @return closest bounding object + * @param boundsObjects an array of bounds objects + * @return closest bounding object */ public Bounds closestIntersection( Bounds[] boundsObjects) { @@ -1540,7 +1540,7 @@ public class BoundingSphere extends Bounds { boolean contains = false; boolean inside; boolean intersect = false; - double smallest_distance = Double.MAX_VALUE; + double smallest_distance = Double.MAX_VALUE; int i,j,index=0; @@ -1559,23 +1559,23 @@ public class BoundingSphere extends Bounds { (center.z-cenZ)*(center.z-cenZ) ); if( (center.x-box.lower.x)*(center.x-box.lower.x) > (center.x-box.upper.x)*(center.x-box.upper.x) ) - far_dis = (center.x-box.lower.x)*(center.x-box.lower.x); + far_dis = (center.x-box.lower.x)*(center.x-box.lower.x); else far_dis = (center.x-box.upper.x)*(center.x-box.upper.x); - + if( (center.y-box.lower.y)*(center.y-box.lower.y) > (center.y-box.upper.y)*(center.y-box.upper.y) ) - far_dis += (center.y-box.lower.y)*(center.y-box.lower.y); + far_dis += (center.y-box.lower.y)*(center.y-box.lower.y); else far_dis += (center.y-box.upper.y)*(center.y-box.upper.y); - + if( (center.z-box.lower.z)*(center.z-box.lower.z) > (center.z-box.upper.z)*(center.z-box.upper.z) ) - far_dis += (center.z-box.lower.z)*(center.z-box.lower.z); + far_dis += (center.z-box.lower.z)*(center.z-box.lower.z); else far_dis += (center.z-box.upper.z)*(center.z-box.upper.z); - - rad_sq = radius * radius; + + rad_sq = radius * radius; if( far_dis <= rad_sq ) { // contains box if( !contains ){ // initialize smallest_distance for the first containment index = i; @@ -1626,12 +1626,12 @@ public class BoundingSphere extends Bounds { x = polytope.verts[j].x - center.x; y = polytope.verts[j].y - center.y; z = polytope.verts[j].z - center.z; - + pdist = x*x + y*y + z*z; if( pdist > radius*radius) inside=false; } - if( inside ) { + if( inside ) { if( !contains ){ // initialize smallest_distance for the first containment index = i; smallest_distance = dis; @@ -1679,7 +1679,7 @@ public class BoundingSphere extends Bounds { return true; for (i=0; i<6; i++) { - dist = frustum.clipPlanes[i].x*center.x + frustum.clipPlanes[i].y*center.y + + dist = frustum.clipPlanes[i].x*center.x + frustum.clipPlanes[i].y*center.y + frustum.clipPlanes[i].z*center.z + frustum.clipPlanes[i].w; if (dist < 0.0 && (dist + radius) < 0.0) { return(false); @@ -1704,7 +1704,7 @@ public class BoundingSphere extends Bounds { return true; for (i=0; i<6; i++) { - dist = planes[i].x*center.x + planes[i].y*center.y + + dist = planes[i].x*center.x + planes[i].y*center.y + planes[i].z*center.z + planes[i].w; if (dist < 0.0 && (dist + radius) < 0.0) { //System.err.println("Tossing " + i + " " + dist + " " + radius); @@ -1720,15 +1720,15 @@ public class BoundingSphere extends Bounds { public String toString() { return new String( "Center="+center+" Radius="+radius); } - + private void updateBoundsStates() { if (checkBoundsIsNaN()) { boundsIsEmpty = true; - boundsIsInfinite = false; + boundsIsInfinite = false; return; } - + if(radius == Double.POSITIVE_INFINITY) { boundsIsEmpty = false; boundsIsInfinite = true; @@ -1746,7 +1746,7 @@ public class BoundingSphere extends Bounds { Point3d getCenter() { return center; } - + /** * if the passed the "region" is same type as this object * then do a copy, otherwise clone the Bounds and diff --git a/src/classes/share/javax/media/j3d/BranchGroup.java b/src/classes/share/javax/media/j3d/BranchGroup.java index caf04b4..7fe2a3b 100644 --- a/src/classes/share/javax/media/j3d/BranchGroup.java +++ b/src/classes/share/javax/media/j3d/BranchGroup.java @@ -56,7 +56,7 @@ package javax.media.j3d; public class BranchGroup extends Group { /** - * For BranchGroup nodes, specifies that this BranchGroup allows detaching + * For BranchGroup nodes, specifies that this BranchGroup allows detaching * from its parent. */ public static final int @@ -76,7 +76,7 @@ public class BranchGroup extends Group { this.retained = new BranchGroupRetained(); this.retained.setSource(this); } - + /** * Compiles the source BranchGroup associated with this object and @@ -96,7 +96,7 @@ public class BranchGroup extends Group { // will throw SceneGraphCycleException if there is a cycle // in the scene graph checkForCycle(); - + ((BranchGroupRetained)this.retained).compile(); } } @@ -106,62 +106,62 @@ public class BranchGroup extends Group { */ public void detach() { Group parent; - + if (isLiveOrCompiled()) { if(!this.getCapability(ALLOW_DETACH)) throw new CapabilityNotSetException(J3dI18N.getString("BranchGroup1")); - + if (((BranchGroupRetained)this.retained).parent != null) { parent = (Group)((BranchGroupRetained)this.retained).parent.source; if(!parent.getCapability(Group.ALLOW_CHILDREN_WRITE)) throw new CapabilityNotSetException(J3dI18N.getString("BranchGroup2")); } } - + ((BranchGroupRetained)this.retained).detach(); } - - + + void validateModeFlagAndPickShape(int mode, int flags, PickShape pickShape) { if(isLive()==false) { throw new IllegalStateException(J3dI18N.getString("BranchGroup3")); } - + if((mode != PickInfo.PICK_BOUNDS) && (mode != PickInfo.PICK_GEOMETRY)) { - + throw new IllegalArgumentException(J3dI18N.getString("BranchGroup4")); } - + if((pickShape instanceof PickPoint) && (mode == PickInfo.PICK_GEOMETRY)) { throw new IllegalArgumentException(J3dI18N.getString("BranchGroup5")); } - + if(((flags & PickInfo.CLOSEST_GEOM_INFO) != 0) && ((flags & PickInfo.ALL_GEOM_INFO) != 0)) { throw new IllegalArgumentException(J3dI18N.getString("BranchGroup6")); } - - if((mode == PickInfo.PICK_BOUNDS) && - (((flags & (PickInfo.CLOSEST_GEOM_INFO | + + if((mode == PickInfo.PICK_BOUNDS) && + (((flags & (PickInfo.CLOSEST_GEOM_INFO | PickInfo.ALL_GEOM_INFO | PickInfo.CLOSEST_DISTANCE | PickInfo.CLOSEST_INTERSECTION_POINT)) != 0))) { - + throw new IllegalArgumentException(J3dI18N.getString("BranchGroup7")); } - - if((pickShape instanceof PickBounds) && - (((flags & (PickInfo.CLOSEST_GEOM_INFO | + + if((pickShape instanceof PickBounds) && + (((flags & (PickInfo.CLOSEST_GEOM_INFO | PickInfo.ALL_GEOM_INFO | PickInfo.CLOSEST_DISTANCE | PickInfo.CLOSEST_INTERSECTION_POINT)) != 0))) { - + throw new IllegalArgumentException(J3dI18N.getString("BranchGroup8")); - } + } + + } - } - /** * Returns an array referencing all the items that are pickable below this * <code>BranchGroup</code> that intersect with PickShape. @@ -180,25 +180,25 @@ public class BranchGroup extends Group { if(isLive()==false) throw new IllegalStateException(J3dI18N.getString("BranchGroup3")); - return ((BranchGroupRetained)this.retained).pickAll(pickShape); - + return ((BranchGroupRetained)this.retained).pickAll(pickShape); + } - + /** - * Returns an array unsorted references to all the PickInfo objects that are + * Returns an array unsorted references to all the PickInfo objects that are * pickable below this <code>BranchGroup</code> that intersect with PickShape. - * The accuracy of the pick is set by the pick mode. The mode include : - * PickInfo.PICK_BOUNDS and PickInfo.PICK_GEOMETRY. The amount of information returned - * is specified via a masked variable, flags, indicating which components are - * present in each returned PickInfo object. + * The accuracy of the pick is set by the pick mode. The mode include : + * PickInfo.PICK_BOUNDS and PickInfo.PICK_GEOMETRY. The amount of information returned + * is specified via a masked variable, flags, indicating which components are + * present in each returned PickInfo object. * * @param mode picking mode, one of <code>PickInfo.PICK_BOUNDS</code> or <code>PickInfo.PICK_GEOMETRY</code>. * - * @param flags a mask indicating which components are present in each PickInfo object. - * This is specified as one or more individual bits that are bitwise "OR"ed together to + * @param flags a mask indicating which components are present in each PickInfo object. + * This is specified as one or more individual bits that are bitwise "OR"ed together to * describe the PickInfo data. The flags include : * <ul> - * <code>PickInfo.SCENEGRAPHPATH</code> - request for computed SceneGraphPath.<br> + * <code>PickInfo.SCENEGRAPHPATH</code> - request for computed SceneGraphPath.<br> * <code>PickInfo.NODE</code> - request for computed intersected Node.<br> * <code>PickInfo.LOCAL_TO_VWORLD</code> - request for computed local to virtual world transform.<br> * <code>PickInfo.CLOSEST_INTERSECTION_POINT</code> - request for closest intersection point.<br> @@ -209,20 +209,20 @@ public class BranchGroup extends Group { * * @param pickShape the description of this picking volume or area. * - * @exception IllegalArgumentException if flags contains both CLOSEST_GEOM_INFO and + * @exception IllegalArgumentException if flags contains both CLOSEST_GEOM_INFO and * ALL_GEOM_INFO. * * @exception IllegalArgumentException if pickShape is a PickPoint and pick mode * is set to PICK_GEOMETRY. * - * @exception IllegalArgumentException if pick mode is neither PICK_BOUNDS + * @exception IllegalArgumentException if pick mode is neither PICK_BOUNDS * nor PICK_GEOMETRY. * - * @exception IllegalArgumentException if pick mode is PICK_BOUNDS + * @exception IllegalArgumentException if pick mode is PICK_BOUNDS * and flags includes any of CLOSEST_INTERSECTION_POINT, CLOSEST_DISTANCE, * CLOSEST_GEOM_INFO or ALL_GEOM_INFO. * - * @exception IllegalArgumentException if pickShape is PickBounds + * @exception IllegalArgumentException if pickShape is PickBounds * and flags includes any of CLOSEST_INTERSECTION_POINT, CLOSEST_DISTANCE, * CLOSEST_GEOM_INFO or ALL_GEOM_INFO. * @@ -232,14 +232,14 @@ public class BranchGroup extends Group { * PICK_GEOMETRY and the Geometry.ALLOW_INTERSECT capability bit * is not set in any Geometry objects referred to by any shape * node whose bounds intersects the PickShape. - * + * * @exception CapabilityNotSetException if flags contains any of * CLOSEST_INTERSECTION_POINT, CLOSEST_DISTANCE, CLOSEST_GEOM_INFO * or ALL_GEOM_INFO, and the capability bits that control reading of * coordinate data are not set in any GeometryArray object referred * to by any shape node that intersects the PickShape. * The capability bits that must be set to avoid this exception are as follows : - * <ul> + * <ul> * <li>By-copy geometry : GeometryArray.ALLOW_COORDINATE_READ</li> * <li>By-reference geometry : GeometryArray.ALLOW_REF_DATA_READ</li> * <li>Indexed geometry : IndexedGeometryArray.ALLOW_COORDINATE_INDEX_READ @@ -248,62 +248,62 @@ public class BranchGroup extends Group { * * @see Locale#pickAll(int,int,javax.media.j3d.PickShape) * @see PickInfo - * + * * @since Java 3D 1.4 * */ public PickInfo[] pickAll( int mode, int flags, PickShape pickShape ) { - validateModeFlagAndPickShape(mode, flags, pickShape); - return ((BranchGroupRetained)this.retained).pickAll(mode, flags, pickShape); + validateModeFlagAndPickShape(mode, flags, pickShape); + return ((BranchGroupRetained)this.retained).pickAll(mode, flags, pickShape); } /** - * Returns a sorted array of references to all the Pickable items that - * intersect with the pickShape. Element [0] references the item closest - * to <i>origin</i> of PickShape successive array elements are further + * Returns a sorted array of references to all the Pickable items that + * intersect with the pickShape. Element [0] references the item closest + * to <i>origin</i> of PickShape successive array elements are further * from the <i>origin</i> * - * Note: If pickShape is of type PickBounds, the resulting array + * Note: If pickShape is of type PickBounds, the resulting array * is unordered. * @param pickShape the PickShape object - * + * * @see SceneGraphPath * @see Locale#pickAllSorted * @see PickShape * @exception IllegalStateException if BranchGroup is not live. - * + * */ public SceneGraphPath[] pickAllSorted( PickShape pickShape ) { if(isLive()==false) - throw new IllegalStateException(J3dI18N.getString("BranchGroup3")); + throw new IllegalStateException(J3dI18N.getString("BranchGroup3")); - return ((BranchGroupRetained)this.retained).pickAllSorted(pickShape); + return ((BranchGroupRetained)this.retained).pickAllSorted(pickShape); } /** * Returns a sorted array of PickInfo references to all the pickable - * items that intersect with the pickShape. Element [0] references + * items that intersect with the pickShape. Element [0] references * the item closest to <i>origin</i> of PickShape successive array * elements are further from the <i>origin</i> - * The accuracy of the pick is set by the pick mode. The mode include : - * PickInfo.PICK_BOUNDS and PickInfo.PICK_GEOMETRY. The amount of information returned - * is specified via a masked variable, flags, indicating which components are - * present in each returned PickInfo object. + * The accuracy of the pick is set by the pick mode. The mode include : + * PickInfo.PICK_BOUNDS and PickInfo.PICK_GEOMETRY. The amount of information returned + * is specified via a masked variable, flags, indicating which components are + * present in each returned PickInfo object. * * @param mode picking mode, one of <code>PickInfo.PICK_BOUNDS</code> or <code>PickInfo.PICK_GEOMETRY</code>. * - * @param flags a mask indicating which components are present in each PickInfo object. - * This is specified as one or more individual bits that are bitwise "OR"ed together to + * @param flags a mask indicating which components are present in each PickInfo object. + * This is specified as one or more individual bits that are bitwise "OR"ed together to * describe the PickInfo data. The flags include : * <ul> - * <code>PickInfo.SCENEGRAPHPATH</code> - request for computed SceneGraphPath.<br> + * <code>PickInfo.SCENEGRAPHPATH</code> - request for computed SceneGraphPath.<br> * <code>PickInfo.NODE</code> - request for computed intersected Node.<br> * <code>PickInfo.LOCAL_TO_VWORLD</code> - request for computed local to virtual world transform.<br> * <code>PickInfo.CLOSEST_INTERSECTION_POINT</code> - request for closest intersection point.<br> @@ -314,20 +314,20 @@ public class BranchGroup extends Group { * * @param pickShape the description of this picking volume or area. * - * @exception IllegalArgumentException if flags contains both CLOSEST_GEOM_INFO and + * @exception IllegalArgumentException if flags contains both CLOSEST_GEOM_INFO and * ALL_GEOM_INFO. * * @exception IllegalArgumentException if pickShape is a PickPoint and pick mode * is set to PICK_GEOMETRY. * - * @exception IllegalArgumentException if pick mode is neither PICK_BOUNDS + * @exception IllegalArgumentException if pick mode is neither PICK_BOUNDS * nor PICK_GEOMETRY. * - * @exception IllegalArgumentException if pick mode is PICK_BOUNDS + * @exception IllegalArgumentException if pick mode is PICK_BOUNDS * and flags includes any of CLOSEST_INTERSECTION_POINT, CLOSEST_DISTANCE, * CLOSEST_GEOM_INFO or ALL_GEOM_INFO. * - * @exception IllegalArgumentException if pickShape is PickBounds + * @exception IllegalArgumentException if pickShape is PickBounds * and flags includes any of CLOSEST_INTERSECTION_POINT, CLOSEST_DISTANCE, * CLOSEST_GEOM_INFO or ALL_GEOM_INFO. * @@ -337,14 +337,14 @@ public class BranchGroup extends Group { * PICK_GEOMETRY and the Geometry.ALLOW_INTERSECT capability bit * is not set in any Geometry objects referred to by any shape * node whose bounds intersects the PickShape. - * + * * @exception CapabilityNotSetException if flags contains any of * CLOSEST_INTERSECTION_POINT, CLOSEST_DISTANCE, CLOSEST_GEOM_INFO * or ALL_GEOM_INFO, and the capability bits that control reading of * coordinate data are not set in any GeometryArray object referred * to by any shape node that intersects the PickShape. * The capability bits that must be set to avoid this exception are as follows : - * <ul> + * <ul> * <li>By-copy geometry : GeometryArray.ALLOW_COORDINATE_READ</li> * <li>By-reference geometry : GeometryArray.ALLOW_REF_DATA_READ</li> * <li>Indexed geometry : IndexedGeometryArray.ALLOW_COORDINATE_INDEX_READ @@ -353,7 +353,7 @@ public class BranchGroup extends Group { * * @see Locale#pickAllSorted(int,int,javax.media.j3d.PickShape) * @see PickInfo - * + * * @since Java 3D 1.4 * */ @@ -365,7 +365,7 @@ public class BranchGroup extends Group { } /** - * Returns a SceneGraphPath that references the pickable item + * Returns a SceneGraphPath that references the pickable item * closest to the origin of <code>pickShape</code>. * * Note: If pickShape is of type PickBounds, the return is any pickable node @@ -376,32 +376,32 @@ public class BranchGroup extends Group { * @see Locale#pickClosest * @see PickShape * @exception IllegalStateException if BranchGroup is not live. - * + * */ public SceneGraphPath pickClosest( PickShape pickShape ) { if(isLive()==false) throw new IllegalStateException(J3dI18N.getString("BranchGroup3")); - return ((BranchGroupRetained)this.retained).pickClosest(pickShape); + return ((BranchGroupRetained)this.retained).pickClosest(pickShape); } /** * Returns a PickInfo which references the pickable item * which is closest to the origin of <code>pickShape</code>. - * The accuracy of the pick is set by the pick mode. The mode include : - * PickInfo.PICK_BOUNDS and PickInfo.PICK_GEOMETRY. The amount of information returned - * is specified via a masked variable, flags, indicating which components are - * present in each returned PickInfo object. + * The accuracy of the pick is set by the pick mode. The mode include : + * PickInfo.PICK_BOUNDS and PickInfo.PICK_GEOMETRY. The amount of information returned + * is specified via a masked variable, flags, indicating which components are + * present in each returned PickInfo object. * * @param mode picking mode, one of <code>PickInfo.PICK_BOUNDS</code> or <code>PickInfo.PICK_GEOMETRY</code>. * - * @param flags a mask indicating which components are present in each PickInfo object. - * This is specified as one or more individual bits that are bitwise "OR"ed together to + * @param flags a mask indicating which components are present in each PickInfo object. + * This is specified as one or more individual bits that are bitwise "OR"ed together to * describe the PickInfo data. The flags include : * <ul> - * <code>PickInfo.SCENEGRAPHPATH</code> - request for computed SceneGraphPath.<br> + * <code>PickInfo.SCENEGRAPHPATH</code> - request for computed SceneGraphPath.<br> * <code>PickInfo.NODE</code> - request for computed intersected Node.<br> * <code>PickInfo.LOCAL_TO_VWORLD</code> - request for computed local to virtual world transform.<br> * <code>PickInfo.CLOSEST_INTERSECTION_POINT</code> - request for closest intersection point.<br> @@ -412,20 +412,20 @@ public class BranchGroup extends Group { * * @param pickShape the description of this picking volume or area. * - * @exception IllegalArgumentException if flags contains both CLOSEST_GEOM_INFO and + * @exception IllegalArgumentException if flags contains both CLOSEST_GEOM_INFO and * ALL_GEOM_INFO. * * @exception IllegalArgumentException if pickShape is a PickPoint and pick mode * is set to PICK_GEOMETRY. * - * @exception IllegalArgumentException if pick mode is neither PICK_BOUNDS + * @exception IllegalArgumentException if pick mode is neither PICK_BOUNDS * nor PICK_GEOMETRY. * - * @exception IllegalArgumentException if pick mode is PICK_BOUNDS + * @exception IllegalArgumentException if pick mode is PICK_BOUNDS * and flags includes any of CLOSEST_INTERSECTION_POINT, CLOSEST_DISTANCE, * CLOSEST_GEOM_INFO or ALL_GEOM_INFO. * - * @exception IllegalArgumentException if pickShape is PickBounds + * @exception IllegalArgumentException if pickShape is PickBounds * and flags includes any of CLOSEST_INTERSECTION_POINT, CLOSEST_DISTANCE, * CLOSEST_GEOM_INFO or ALL_GEOM_INFO. * @@ -435,14 +435,14 @@ public class BranchGroup extends Group { * PICK_GEOMETRY and the Geometry.ALLOW_INTERSECT capability bit * is not set in any Geometry objects referred to by any shape * node whose bounds intersects the PickShape. - * + * * @exception CapabilityNotSetException if flags contains any of * CLOSEST_INTERSECTION_POINT, CLOSEST_DISTANCE, CLOSEST_GEOM_INFO * or ALL_GEOM_INFO, and the capability bits that control reading of * coordinate data are not set in any GeometryArray object referred * to by any shape node that intersects the PickShape. * The capability bits that must be set to avoid this exception are as follows : - * <ul> + * <ul> * <li>By-copy geometry : GeometryArray.ALLOW_COORDINATE_READ</li> * <li>By-reference geometry : GeometryArray.ALLOW_REF_DATA_READ</li> * <li>Indexed geometry : IndexedGeometryArray.ALLOW_COORDINATE_INDEX_READ @@ -451,7 +451,7 @@ public class BranchGroup extends Group { * * @see Locale#pickClosest(int,int,javax.media.j3d.PickShape) * @see PickInfo - * + * * @since Java 3D 1.4 * */ @@ -472,32 +472,32 @@ public class BranchGroup extends Group { * @see Locale#pickAny * @see PickShape * @exception IllegalStateException if BranchGroup is not live. - * + * */ public SceneGraphPath pickAny( PickShape pickShape ) { if(isLive()==false) throw new IllegalStateException(J3dI18N.getString("BranchGroup3")); - return ((BranchGroupRetained)this.retained).pickAny(pickShape); - + return ((BranchGroupRetained)this.retained).pickAny(pickShape); + } /** * Returns a PickInfo which references the pickable item below this * BranchGroup that intersects with <code>pickShape</code>. - * The accuracy of the pick is set by the pick mode. The mode include : - * PickInfo.PICK_BOUNDS and PickInfo.PICK_GEOMETRY. The amount of information returned - * is specified via a masked variable, flags, indicating which components are - * present in each returned PickInfo object. + * The accuracy of the pick is set by the pick mode. The mode include : + * PickInfo.PICK_BOUNDS and PickInfo.PICK_GEOMETRY. The amount of information returned + * is specified via a masked variable, flags, indicating which components are + * present in each returned PickInfo object. * * @param mode picking mode, one of <code>PickInfo.PICK_BOUNDS</code> or <code>PickInfo.PICK_GEOMETRY</code>. * - * @param flags a mask indicating which components are present in each PickInfo object. - * This is specified as one or more individual bits that are bitwise "OR"ed together to + * @param flags a mask indicating which components are present in each PickInfo object. + * This is specified as one or more individual bits that are bitwise "OR"ed together to * describe the PickInfo data. The flags include : * <ul> - * <code>PickInfo.SCENEGRAPHPATH</code> - request for computed SceneGraphPath.<br> + * <code>PickInfo.SCENEGRAPHPATH</code> - request for computed SceneGraphPath.<br> * <code>PickInfo.NODE</code> - request for computed intersected Node.<br> * <code>PickInfo.LOCAL_TO_VWORLD</code> - request for computed local to virtual world transform.<br> * <code>PickInfo.CLOSEST_INTERSECTION_POINT</code> - request for closest intersection point.<br> @@ -508,20 +508,20 @@ public class BranchGroup extends Group { * * @param pickShape the description of this picking volume or area. * - * @exception IllegalArgumentException if flags contains both CLOSEST_GEOM_INFO and + * @exception IllegalArgumentException if flags contains both CLOSEST_GEOM_INFO and * ALL_GEOM_INFO. * * @exception IllegalArgumentException if pickShape is a PickPoint and pick mode * is set to PICK_GEOMETRY. * - * @exception IllegalArgumentException if pick mode is neither PICK_BOUNDS + * @exception IllegalArgumentException if pick mode is neither PICK_BOUNDS * nor PICK_GEOMETRY. * - * @exception IllegalArgumentException if pick mode is PICK_BOUNDS + * @exception IllegalArgumentException if pick mode is PICK_BOUNDS * and flags includes any of CLOSEST_INTERSECTION_POINT, CLOSEST_DISTANCE, * CLOSEST_GEOM_INFO or ALL_GEOM_INFO. * - * @exception IllegalArgumentException if pickShape is PickBounds + * @exception IllegalArgumentException if pickShape is PickBounds * and flags includes any of CLOSEST_INTERSECTION_POINT, CLOSEST_DISTANCE, * CLOSEST_GEOM_INFO or ALL_GEOM_INFO. * @@ -531,14 +531,14 @@ public class BranchGroup extends Group { * PICK_GEOMETRY and the Geometry.ALLOW_INTERSECT capability bit * is not set in any Geometry objects referred to by any shape * node whose bounds intersects the PickShape. - * + * * @exception CapabilityNotSetException if flags contains any of * CLOSEST_INTERSECTION_POINT, CLOSEST_DISTANCE, CLOSEST_GEOM_INFO * or ALL_GEOM_INFO, and the capability bits that control reading of * coordinate data are not set in any GeometryArray object referred * to by any shape node that intersects the PickShape. * The capability bits that must be set to avoid this exception are as follows : - * <ul> + * <ul> * <li>By-copy geometry : GeometryArray.ALLOW_COORDINATE_READ</li> * <li>By-reference geometry : GeometryArray.ALLOW_REF_DATA_READ</li> * <li>Indexed geometry : IndexedGeometryArray.ALLOW_COORDINATE_INDEX_READ @@ -547,7 +547,7 @@ public class BranchGroup extends Group { * * @see Locale#pickAny(int,int,javax.media.j3d.PickShape) * @see PickInfo - * + * * @since Java 3D 1.4 * */ diff --git a/src/classes/share/javax/media/j3d/BranchGroupRetained.java b/src/classes/share/javax/media/j3d/BranchGroupRetained.java index 04c758e..3ab3a0c 100644 --- a/src/classes/share/javax/media/j3d/BranchGroupRetained.java +++ b/src/classes/share/javax/media/j3d/BranchGroupRetained.java @@ -128,7 +128,7 @@ class BranchGroupRetained extends GroupRetained { // For inSharedGroup case. int j, hkIndex; for(j=0; j<s.keys.length; j++) { - hkIndex = s.keys[j].equals(localToVworldKeys, 0, + hkIndex = s.keys[j].equals(localToVworldKeys, 0, localToVworldKeys.length); if(hkIndex >= 0) { @@ -146,7 +146,7 @@ class BranchGroupRetained extends GroupRetained { void setAuxData(SetLiveState s, int index, int hkIndex) { super.setAuxData(s, index, hkIndex); - BranchGroupRetained path[] = (BranchGroupRetained[]) + BranchGroupRetained path[] = (BranchGroupRetained[]) s.branchGroupPaths.get(index); BranchGroupRetained clonePath[] = new BranchGroupRetained[path.length+1]; @@ -163,7 +163,7 @@ class BranchGroupRetained extends GroupRetained { void removeNodeData(SetLiveState s) { if((!inSharedGroup) || (s.keys.length == localToVworld.length)) { - // restore to default and avoid calling clear() + // restore to default and avoid calling clear() // that may clear parent reference branchGroupPaths branchGroupPaths = new ArrayList(1); } @@ -181,14 +181,14 @@ class BranchGroupRetained extends GroupRetained { } super.removeNodeData(s); } - + void setLive(SetLiveState s) { // recursively call child super.doSetLive(s); super.markAsLive(); } - + // Top level compile call void compile() { @@ -196,7 +196,7 @@ class BranchGroupRetained extends GroupRetained { return; if (J3dDebug.devPhase && J3dDebug.debug) { - J3dDebug.doDebug(J3dDebug.compileState, J3dDebug.LEVEL_3, + J3dDebug.doDebug(J3dDebug.compileState, J3dDebug.LEVEL_3, "BranchGroupRetained.compile()....\n"); } @@ -234,12 +234,12 @@ class BranchGroupRetained extends GroupRetained { // without any capabilities set mergeFlag = SceneGraphObjectRetained.DONT_MERGE; } - + SceneGraphPath[] pickAll(PickShape pickShape) { - + PickInfo[] pickInfoArr = pickAll(PickInfo.PICK_BOUNDS, PickInfo.SCENEGRAPHPATH, pickShape); - + if(pickInfoArr == null) { return null; } @@ -249,27 +249,27 @@ class BranchGroupRetained extends GroupRetained { sgpArr[i] = pickInfoArr[i].getSceneGraphPath(); } - return sgpArr; + return sgpArr; } - + PickInfo[] pickAll( int mode, int flags, PickShape pickShape ) { - + if (inSharedGroup) { throw new RestrictedAccessException(J3dI18N.getString("BranchGroup9")); } - + GeometryAtom geomAtoms[] = locale.universe.geometryStructure.pickAll(locale, pickShape); return PickInfo.pick(this, geomAtoms, mode, flags, pickShape, PickInfo.PICK_ALL); } - + SceneGraphPath[] pickAllSorted(PickShape pickShape) { - + PickInfo[] pickInfoArr = pickAllSorted(PickInfo.PICK_BOUNDS, PickInfo.SCENEGRAPHPATH, pickShape); - + if(pickInfoArr == null) { return null; } @@ -278,23 +278,23 @@ class BranchGroupRetained extends GroupRetained { for( int i=0; i<sgpArr.length; i++) { sgpArr[i] = pickInfoArr[i].getSceneGraphPath(); } - + return sgpArr; } - + PickInfo[] pickAllSorted( int mode, int flags, PickShape pickShape ) { - + if (inSharedGroup) { throw new RestrictedAccessException(J3dI18N.getString("BranchGroup9")); } - + GeometryAtom geomAtoms[] = locale.universe.geometryStructure.pickAll(locale, pickShape); PickInfo[] pickInfoArr = null; - - + + if ((geomAtoms == null) || (geomAtoms.length == 0)) { return null; } @@ -302,7 +302,7 @@ class BranchGroupRetained extends GroupRetained { if (mode == PickInfo.PICK_GEOMETRY) { // Need to have closestDistance set flags |= PickInfo.CLOSEST_DISTANCE; - pickInfoArr= PickInfo.pick(this, geomAtoms, mode, flags, + pickInfoArr= PickInfo.pick(this, geomAtoms, mode, flags, pickShape, PickInfo.PICK_ALL); if (pickInfoArr != null) { PickInfo.sortPickInfoArray(pickInfoArr); @@ -310,19 +310,19 @@ class BranchGroupRetained extends GroupRetained { } else { PickInfo.sortGeomAtoms(geomAtoms, pickShape); - pickInfoArr= PickInfo.pick(this, geomAtoms, mode, flags, - pickShape, PickInfo.PICK_ALL); + pickInfoArr= PickInfo.pick(this, geomAtoms, mode, flags, + pickShape, PickInfo.PICK_ALL); } - + return pickInfoArr; - + } SceneGraphPath pickClosest( PickShape pickShape ) { PickInfo pickInfo = pickClosest( PickInfo.PICK_BOUNDS, PickInfo.SCENEGRAPHPATH, pickShape); - + if(pickInfo == null) { return null; } @@ -330,32 +330,32 @@ class BranchGroupRetained extends GroupRetained { return pickInfo.getSceneGraphPath(); } - + PickInfo pickClosest( int mode, int flags, PickShape pickShape ) { PickInfo[] pickInfoArr = null; pickInfoArr = pickAllSorted( mode, flags, pickShape ); - + if(pickInfoArr == null) { return null; } - + return pickInfoArr[0]; - + } - + SceneGraphPath pickAny( PickShape pickShape ) { PickInfo pickInfo = pickAny( PickInfo.PICK_BOUNDS, PickInfo.SCENEGRAPHPATH, pickShape); - + if(pickInfo == null) { return null; } return pickInfo.getSceneGraphPath(); } - + PickInfo pickAny( int mode, int flags, PickShape pickShape ) { if (inSharedGroup) { @@ -364,15 +364,15 @@ class BranchGroupRetained extends GroupRetained { GeometryAtom geomAtoms[] = locale.universe.geometryStructure.pickAll(locale, pickShape); - - PickInfo[] pickInfoArr = PickInfo.pick(this, geomAtoms, mode, + + PickInfo[] pickInfoArr = PickInfo.pick(this, geomAtoms, mode, flags, pickShape, PickInfo.PICK_ANY); - + if(pickInfoArr == null) { return null; } - + return pickInfoArr[0]; - - } + + } } diff --git a/src/classes/share/javax/media/j3d/CachedTargets.java b/src/classes/share/javax/media/j3d/CachedTargets.java index 88b69f7..3f24046 100644 --- a/src/classes/share/javax/media/j3d/CachedTargets.java +++ b/src/classes/share/javax/media/j3d/CachedTargets.java @@ -33,7 +33,7 @@ package javax.media.j3d; class CachedTargets { // cached targets, used by J3d threads - + // 0 - Data type is GeometryAtom. // 1 - Data type is Light, Fog, Background, ModelClip, AlternateAppearance, // Clip @@ -44,7 +44,7 @@ class CachedTargets { // 6 - Data type is GroupRetained. // Order of index is as above. - // The handling of BoundingLeaf isn't optimize. Target threads should be + // The handling of BoundingLeaf isn't optimize. Target threads should be // more specific. static String typeString[] = { @@ -59,7 +59,7 @@ class CachedTargets { static int updateTargetThreads[] = { // GEO - J3dThread.UPDATE_TRANSFORM | J3dThread.UPDATE_RENDER | + J3dThread.UPDATE_TRANSFORM | J3dThread.UPDATE_RENDER | J3dThread.UPDATE_GEOMETRY, // ENV @@ -83,12 +83,12 @@ class CachedTargets { J3dThread.UPDATE_TRANSFORM | J3dThread.UPDATE_GEOMETRY }; - + NnuId targetArr[][] = new NnuId[Targets.MAX_NODELIST][]; - + int computeTargetThreads() { int targetThreads = 0; - + for (int i=0; i < Targets.MAX_NODELIST; i++) { if (targetArr[i] != null) { targetThreads |= updateTargetThreads[i]; @@ -110,7 +110,7 @@ class CachedTargets { System.arraycopy(targetArr[type], 0, newArr, 0, targetArr[type].length); targetArr[type] = newArr; - NnuIdManager.replace((NnuId)oldObj, (NnuId)newObj, + NnuIdManager.replace((NnuId)oldObj, (NnuId)newObj, (NnuId[])targetArr[type]); } diff --git a/src/classes/share/javax/media/j3d/CanvasViewCache.java b/src/classes/share/javax/media/j3d/CanvasViewCache.java index 116e6ea..a0b1449 100644 --- a/src/classes/share/javax/media/j3d/CanvasViewCache.java +++ b/src/classes/share/javax/media/j3d/CanvasViewCache.java @@ -417,7 +417,7 @@ class CanvasViewCache extends Object { int dirtyIndex = (frustumBBox != null) ? Canvas3D.RENDER_BIN_DIRTY_IDX : Canvas3D.RENDERER_DIRTY_IDX; int scrvcDirtyMask; - + // Issue 109 : read/clear the dirty bits for the correct index synchronized (screenViewCache) { scrvcDirtyMask = screenViewCache.scrvcDirtyMask[dirtyIndex]; diff --git a/src/classes/share/javax/media/j3d/CanvasViewEventCatcher.java b/src/classes/share/javax/media/j3d/CanvasViewEventCatcher.java index cd296dd..2d0a0ef 100644 --- a/src/classes/share/javax/media/j3d/CanvasViewEventCatcher.java +++ b/src/classes/share/javax/media/j3d/CanvasViewEventCatcher.java @@ -38,7 +38,7 @@ import java.awt.event.*; /** * The CanvasViewEventCatcher class is used to track events on a Canvas3D that * may cause view matries to change. - * + * */ class CanvasViewEventCatcher extends ComponentAdapter { @@ -49,12 +49,12 @@ class CanvasViewEventCatcher extends ComponentAdapter { CanvasViewEventCatcher(Canvas3D c) { canvas = c; } - + public void componentResized(ComponentEvent e) { if (DEBUG) { System.err.println("Component resized " + e); } - + if(e.getComponent() == canvas ) { if (DEBUG) { System.err.println("It is canvas!"); @@ -66,7 +66,7 @@ class CanvasViewEventCatcher extends ComponentAdapter { } canvas.resizeGraphics2D = true; } - + // see comment below try { canvas.newSize = canvas.getSize(); @@ -75,7 +75,7 @@ class CanvasViewEventCatcher extends ComponentAdapter { } } - + public void componentMoved(ComponentEvent e) { if (DEBUG) { System.err.println("Component moved " + e); @@ -88,15 +88,15 @@ class CanvasViewEventCatcher extends ComponentAdapter { } } // Can't sync. with canvas lock since canvas.getLocationOnScreen() - // required Component lock. The order is reverse of + // required Component lock. The order is reverse of // removeNotify() lock sequence which required Component lock // first, then canvas lock in removeComponentListener() - + try { canvas.newSize = canvas.getSize(); canvas.newPosition = canvas.getLocationOnScreen(); } catch (IllegalComponentStateException ex) {} } - + } diff --git a/src/classes/share/javax/media/j3d/CapabilityBits.java b/src/classes/share/javax/media/j3d/CapabilityBits.java index 5142098..9030062 100644 --- a/src/classes/share/javax/media/j3d/CapabilityBits.java +++ b/src/classes/share/javax/media/j3d/CapabilityBits.java @@ -236,7 +236,7 @@ class CapabilityBits extends Object { static final int POINT_SOUND_ALLOW_DISTANCE_GAIN_READ = 34; static final int POINT_SOUND_ALLOW_DISTANCE_GAIN_WRITE = 35; - // ConeSound extends PointSound + // ConeSound extends PointSound static final int CONE_SOUND_ALLOW_DIRECTION_READ = 36; static final int CONE_SOUND_ALLOW_DIRECTION_WRITE = 37; static final int CONE_SOUND_ALLOW_ANGULAR_ATTENUATION_READ = 38; @@ -267,7 +267,7 @@ class CapabilityBits extends Object { // NodeComponent extends SceneGraphObject - // Appearance extends NodeComponent + // Appearance extends NodeComponent static final int APPEARANCE_ALLOW_MATERIAL_READ = 0; static final int APPEARANCE_ALLOW_MATERIAL_WRITE = 1; static final int APPEARANCE_ALLOW_TEXTURE_READ = 2; @@ -291,13 +291,13 @@ class CapabilityBits extends Object { static final int APPEARANCE_ALLOW_TEXTURE_UNIT_STATE_READ = 20; static final int APPEARANCE_ALLOW_TEXTURE_UNIT_STATE_WRITE = 21; - // ShaderAppearance extends Appearance + // ShaderAppearance extends Appearance static final int SHADER_APPEARANCE_ALLOW_SHADER_PROGRAM_READ = 22; static final int SHADER_APPEARANCE_ALLOW_SHADER_PROGRAM_WRITE = 23; static final int SHADER_APPEARANCE_ALLOW_SHADER_ATTRIBUTE_SET_READ = 24; static final int SHADER_APPEARANCE_ALLOW_SHADER_ATTRIBUTE_SET_WRITE = 25; - // AuralAttributes extends NodeComponent + // AuralAttributes extends NodeComponent static final int AURAL_ATTRIBUTES_ALLOW_ATTRIBUTE_GAIN_READ = 0; static final int AURAL_ATTRIBUTES_ALLOW_ATTRIBUTE_GAIN_WRITE = 1; static final int AURAL_ATTRIBUTES_ALLOW_ROLLOFF_READ = 2; @@ -327,23 +327,23 @@ class CapabilityBits extends Object { static final int AURAL_ATTRIBUTES_ALLOW_DENSITY_READ = 26; static final int AURAL_ATTRIBUTES_ALLOW_DENSITY_WRITE = 27; - // ColoringAttributes extends NodeComponent + // ColoringAttributes extends NodeComponent static final int COLORING_ATTRIBUTES_ALLOW_COLOR_READ = 0; static final int COLORING_ATTRIBUTES_ALLOW_COLOR_WRITE = 1; static final int COLORING_ATTRIBUTES_ALLOW_SHADE_MODEL_READ = 2; static final int COLORING_ATTRIBUTES_ALLOW_SHADE_MODEL_WRITE = 3; - // DepthComponent extends NodeComponent + // DepthComponent extends NodeComponent static final int DEPTH_COMPONENT_ALLOW_SIZE_READ = 0; static final int DEPTH_COMPONENT_ALLOW_DATA_READ = 1; - // ImageComponent extends NodeComponent + // ImageComponent extends NodeComponent static final int IMAGE_COMPONENT_ALLOW_SIZE_READ = 0; static final int IMAGE_COMPONENT_ALLOW_FORMAT_READ = 1; static final int IMAGE_COMPONENT_ALLOW_IMAGE_READ = 2; static final int IMAGE_COMPONENT_ALLOW_IMAGE_WRITE = 3; - // LineAttributes extends NodeComponent + // LineAttributes extends NodeComponent static final int LINE_ATTRIBUTES_ALLOW_WIDTH_READ = 0; static final int LINE_ATTRIBUTES_ALLOW_WIDTH_WRITE = 1; static final int LINE_ATTRIBUTES_ALLOW_PATTERN_READ = 2; @@ -351,23 +351,23 @@ class CapabilityBits extends Object { static final int LINE_ATTRIBUTES_ALLOW_ANTIALIASING_READ = 4; static final int LINE_ATTRIBUTES_ALLOW_ANTIALIASING_WRITE = 5; - // Material extends NodeComponent + // Material extends NodeComponent static final int MATERIAL_ALLOW_COMPONENT_READ = 0; static final int MATERIAL_ALLOW_COMPONENT_WRITE = 1; - // MediaContainer extends NodeComponent + // MediaContainer extends NodeComponent static final int MEDIA_CONTAINER_ALLOW_CACHE_READ = 0; static final int MEDIA_CONTAINER_ALLOW_CACHE_WRITE = 1; static final int MEDIA_CONTAINER_ALLOW_URL_READ = 2; static final int MEDIA_CONTAINER_ALLOW_URL_WRITE = 3; - // PointAttributes extends NodeComponent + // PointAttributes extends NodeComponent static final int POINT_ATTRIBUTES_ALLOW_SIZE_READ = 0; static final int POINT_ATTRIBUTES_ALLOW_SIZE_WRITE = 1; static final int POINT_ATTRIBUTES_ALLOW_ANTIALIASING_READ = 2; static final int POINT_ATTRIBUTES_ALLOW_ANTIALIASING_WRITE = 3; - // PolygonAttributes extends NodeComponent + // PolygonAttributes extends NodeComponent static final int POLYGON_ATTRIBUTES_ALLOW_CULL_FACE_READ = 0; static final int POLYGON_ATTRIBUTES_ALLOW_CULL_FACE_WRITE = 1; static final int POLYGON_ATTRIBUTES_ALLOW_MODE_READ = 2; @@ -377,7 +377,7 @@ class CapabilityBits extends Object { static final int POLYGON_ATTRIBUTES_ALLOW_NORMAL_FLIP_READ = 6; static final int POLYGON_ATTRIBUTES_ALLOW_NORMAL_FLIP_WRITE = 7; - // RenderingAttributes extends NodeComponent + // RenderingAttributes extends NodeComponent static final int RENDERING_ATTRIBUTES_ALLOW_ALPHA_TEST_VALUE_READ = 0; static final int RENDERING_ATTRIBUTES_ALLOW_ALPHA_TEST_VALUE_WRITE = 1; static final int RENDERING_ATTRIBUTES_ALLOW_ALPHA_TEST_FUNCTION_READ = 2; @@ -397,7 +397,7 @@ class CapabilityBits extends Object { static final int RENDERING_ATTRIBUTES_ALLOW_STENCIL_ATTRIBUTES_READ = 14; static final int RENDERING_ATTRIBUTES_ALLOW_STENCIL_ATTRIBUTES_WRITE = 15; - // TexCoordGeneration extends NodeComponent + // TexCoordGeneration extends NodeComponent static final int TEX_COORD_GENERATION_ALLOW_ENABLE_READ = 0; static final int TEX_COORD_GENERATION_ALLOW_ENABLE_WRITE = 1; static final int TEX_COORD_GENERATION_ALLOW_FORMAT_READ = 2; @@ -405,7 +405,7 @@ class CapabilityBits extends Object { static final int TEX_COORD_GENERATION_ALLOW_PLANE_READ = 4; static final int TEX_COORD_GENERATION_ALLOW_PLANE_WRITE = 5; - // Texture extends NodeComponent + // Texture extends NodeComponent static final int TEXTURE_ALLOW_ENABLE_READ = 0; static final int TEXTURE_ALLOW_ENABLE_WRITE = 1; static final int TEXTURE_ALLOW_BOUNDARY_MODE_READ = 2; @@ -425,7 +425,7 @@ class CapabilityBits extends Object { // Texture2D extends Texture static final int TEXTURE2D_ALLOW_DETAIL_TEXTURE_READ = 15; - // TextureAttributes extends NodeComponent + // TextureAttributes extends NodeComponent static final int TEXTURE_ATTRIBUTES_ALLOW_MODE_READ = 0; static final int TEXTURE_ATTRIBUTES_ALLOW_MODE_WRITE = 1; static final int TEXTURE_ATTRIBUTES_ALLOW_BLEND_COLOR_READ = 2; @@ -437,7 +437,7 @@ class CapabilityBits extends Object { static final int TEXTURE_ATTRIBUTES_ALLOW_COMBINE_READ = 8; static final int TEXTURE_ATTRIBUTES_ALLOW_COMBINE_WRITE = 9; - // TransparencyAttributes extends NodeComponent + // TransparencyAttributes extends NodeComponent static final int TRANSPARENCY_ATTRIBUTES_ALLOW_MODE_READ = 0; static final int TRANSPARENCY_ATTRIBUTES_ALLOW_MODE_WRITE = 1; static final int TRANSPARENCY_ATTRIBUTES_ALLOW_VALUE_READ = 2; @@ -445,19 +445,19 @@ class CapabilityBits extends Object { static final int TRANSPARENCY_ATTRIBUTES_ALLOW_BLEND_FUNCTION_READ = 4; static final int TRANSPARENCY_ATTRIBUTES_ALLOW_BLEND_FUNCTION_WRITE = 5; - // TextureUnitState extends NodeComponent + // TextureUnitState extends NodeComponent static final int TEXTURE_UNIT_STATE_ALLOW_STATE_READ = 0; static final int TEXTURE_UNIT_STATE_ALLOW_STATE_WRITE = 1; - // ShaderProgram extends NodeComponent + // ShaderProgram extends NodeComponent static final int SHADER_PROGRAM_ALLOW_SHADERS_READ = 0; static final int SHADER_PROGRAM_ALLOW_NAMES_READ = 1; - // ShaderAttributeSet extends NodeComponent + // ShaderAttributeSet extends NodeComponent static final int SHADER_ATTRIBUTE_SET_ALLOW_ATTRIBUTES_READ = 0; static final int SHADER_ATTRIBUTE_SET_ALLOW_ATTRIBUTES_WRITE = 1; - // ShaderAttribute extends NodeComponent + // ShaderAttribute extends NodeComponent // ShaderAttributeObject extends ShaderAttribute static final int SHADER_ATTRIBUTE_OBJECT_ALLOW_VALUE_READ = 0; @@ -466,7 +466,7 @@ class CapabilityBits extends Object { // Geometry extends NodeComponent // NOTE: additional bits are below the subclasses - // GeometryArray extends Geometry + // GeometryArray extends Geometry static final int GEOMETRY_ARRAY_ALLOW_COORDINATE_READ = 0; static final int GEOMETRY_ARRAY_ALLOW_COORDINATE_WRITE = 1; static final int GEOMETRY_ARRAY_ALLOW_COLOR_READ = 2; @@ -477,7 +477,7 @@ class CapabilityBits extends Object { static final int GEOMETRY_ARRAY_ALLOW_TEXCOORD_WRITE = 7; static final int GEOMETRY_ARRAY_ALLOW_COUNT_READ = 8; - // IndexedGeometryArray extends GeometryArray + // IndexedGeometryArray extends GeometryArray static final int INDEXED_GEOMETRY_ARRAY_ALLOW_COORDINATE_INDEX_READ = 9; static final int INDEXED_GEOMETRY_ARRAY_ALLOW_COORDINATE_INDEX_WRITE= 10; static final int INDEXED_GEOMETRY_ARRAY_ALLOW_COLOR_INDEX_READ = 11; @@ -500,13 +500,13 @@ class CapabilityBits extends Object { static final int INDEXED_GEOMETRY_ARRAY_ALLOW_VERTEX_ATTR_INDEX_READ = 24; static final int INDEXED_GEOMETRY_ARRAY_ALLOW_VERTEX_ATTR_INDEX_WRITE = 25; - // CompressedGeometry extends Geometry + // CompressedGeometry extends Geometry static final int COMPRESSED_GEOMETRY_ALLOW_COUNT_READ = 0; static final int COMPRESSED_GEOMETRY_ALLOW_HEADER_READ = 1; static final int COMPRESSED_GEOMETRY_ALLOW_GEOMETRY_READ = 2; static final int COMPRESSED_GEOMETRY_ALLOW_REF_DATA_READ = 3; - // Raster extends Geometry + // Raster extends Geometry static final int RASTER_ALLOW_POSITION_READ = 0; static final int RASTER_ALLOW_POSITION_WRITE = 1; static final int RASTER_ALLOW_OFFSET_READ = 2; @@ -521,7 +521,7 @@ class CapabilityBits extends Object { static final int RASTER_ALLOW_CLIP_MODE_READ = 11; static final int RASTER_ALLOW_CLIP_MODE_WRITE = 12; - // Text3D extends Geometry + // Text3D extends Geometry static final int TEXT3D_ALLOW_FONT3D_READ = 0; static final int TEXT3D_ALLOW_FONT3D_WRITE = 1; static final int TEXT3D_ALLOW_STRING_READ = 2; diff --git a/src/classes/share/javax/media/j3d/CgShaderProgramRetained.java b/src/classes/share/javax/media/j3d/CgShaderProgramRetained.java index fef91e3..36eca1e 100644 --- a/src/classes/share/javax/media/j3d/CgShaderProgramRetained.java +++ b/src/classes/share/javax/media/j3d/CgShaderProgramRetained.java @@ -37,7 +37,7 @@ package javax.media.j3d; */ class CgShaderProgramRetained extends ShaderProgramRetained { - + /** * Constructs a Cg shader program node component. */ @@ -48,7 +48,7 @@ class CgShaderProgramRetained extends ShaderProgramRetained { // System.err.println("CgShaderProgramRetained : createMirrorObject"); // This method should only call by setLive(). if (mirror == null) { - CgShaderProgramRetained mirrorCgSP = new CgShaderProgramRetained(); + CgShaderProgramRetained mirrorCgSP = new CgShaderProgramRetained(); mirror = mirrorCgSP; } initMirrorObject(); @@ -310,17 +310,17 @@ class CgShaderProgramRetained extends ShaderProgramRetained { /** * Method to create the native shader. */ - ShaderError createShader(Context ctx, ShaderRetained shader, ShaderId[] shaderIdArr) { + ShaderError createShader(Context ctx, ShaderRetained shader, ShaderId[] shaderIdArr) { return Pipeline.getPipeline().createCgShader(ctx, shader.shaderType, shaderIdArr); } - + /** * Method to destroy the native shader. */ ShaderError destroyShader(Context ctx, ShaderId shaderId) { return Pipeline.getPipeline().destroyCgShader(ctx, shaderId); } - + /** * Method to compile the native shader. */ @@ -332,7 +332,7 @@ class CgShaderProgramRetained extends ShaderProgramRetained { * Method to create the native shader program. */ ShaderError createShaderProgram(Context ctx, ShaderProgramId[] shaderProgramIdArr) { - return Pipeline.getPipeline().createCgShaderProgram(ctx, shaderProgramIdArr); + return Pipeline.getPipeline().createCgShaderProgram(ctx, shaderProgramIdArr); } /** @@ -348,7 +348,7 @@ class CgShaderProgramRetained extends ShaderProgramRetained { ShaderError linkShaderProgram(Context ctx, ShaderProgramId shaderProgramId, ShaderId[] shaderIds) { return Pipeline.getPipeline().linkCgShaderProgram(ctx, shaderProgramId, shaderIds); } - + ShaderError bindVertexAttrName(Context ctx, ShaderProgramId shaderProgramId, String attrName, int attrIndex) { // This is a no-op for Cg return null; @@ -362,7 +362,7 @@ class CgShaderProgramRetained extends ShaderProgramRetained { String[] attrNames, AttrNameInfo[] attrNameInfoArr) { int numAttrNames = attrNames.length; - + ShaderAttrLoc[] locArr = new ShaderAttrLoc[numAttrNames]; int[] typeArr = new int[numAttrNames]; int[] sizeArr = new int[numAttrNames]; // currently unused @@ -392,7 +392,7 @@ class CgShaderProgramRetained extends ShaderProgramRetained { ShaderError enableShaderProgram(Context ctx, ShaderProgramId shaderProgramId) { return Pipeline.getPipeline().useCgShaderProgram(ctx, shaderProgramId); } - + /** * Method to disable the native shader program. */ diff --git a/src/classes/share/javax/media/j3d/Clip.java b/src/classes/share/javax/media/j3d/Clip.java index d56a3a6..ba669b2 100644 --- a/src/classes/share/javax/media/j3d/Clip.java +++ b/src/classes/share/javax/media/j3d/Clip.java @@ -55,28 +55,28 @@ public class Clip extends Leaf { /** * Specifies that the Clip allows read access to its application * bounds and bounding leaf at runtime. - */ + */ public static final int ALLOW_APPLICATION_BOUNDS_READ = CapabilityBits.CLIP_ALLOW_APPLICATION_BOUNDS_READ; /** * Specifies that the Clip allows write access to its application * bounds and bounding leaf at runtime. - */ + */ public static final int ALLOW_APPLICATION_BOUNDS_WRITE = CapabilityBits.CLIP_ALLOW_APPLICATION_BOUNDS_WRITE; /** * Specifies that the Clip allows read access to its back distance * at runtime. - */ + */ public static final int ALLOW_BACK_DISTANCE_READ = CapabilityBits.CLIP_ALLOW_BACK_DISTANCE_READ; /** * Specifies that the Clip allows write access to its back distance * at runtime. - */ + */ public static final int ALLOW_BACK_DISTANCE_WRITE = CapabilityBits.CLIP_ALLOW_BACK_DISTANCE_WRITE; @@ -85,7 +85,7 @@ public class Clip extends Leaf { ALLOW_APPLICATION_BOUNDS_READ, ALLOW_BACK_DISTANCE_READ }; - + /** * Constructs a Clip node with default parameters. The default * values are as follows: @@ -126,7 +126,7 @@ public class Clip extends Leaf { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_BACK_DISTANCE_WRITE)) throw new CapabilityNotSetException(J3dI18N.getString("Clip0")); - + if (isLive()) ((ClipRetained)this.retained).setBackDistance(backDistance); else @@ -140,7 +140,7 @@ public class Clip extends Leaf { public double getBackDistance() { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_BACK_DISTANCE_READ)) - throw new CapabilityNotSetException(J3dI18N.getString("Clip1")); + throw new CapabilityNotSetException(J3dI18N.getString("Clip1")); return ((ClipRetained)this.retained).getBackDistance(); } @@ -151,29 +151,29 @@ public class Clip extends Leaf { * region. * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph - */ + */ public void setApplicationBounds(Bounds region) { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_APPLICATION_BOUNDS_WRITE)) - throw new CapabilityNotSetException(J3dI18N.getString("Clip2")); - + throw new CapabilityNotSetException(J3dI18N.getString("Clip2")); + if (isLive()) ((ClipRetained)this.retained).setApplicationBounds(region); else ((ClipRetained)this.retained).initApplicationBounds(region); } - /** + /** * Retrieves the Clip node's application bounds. * @return this Clip's application bounds information * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph - */ + */ public Bounds getApplicationBounds() { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_APPLICATION_BOUNDS_READ)) - throw new CapabilityNotSetException(J3dI18N.getString("Clip3")); - + throw new CapabilityNotSetException(J3dI18N.getString("Clip3")); + return ((ClipRetained)this.retained).getApplicationBounds(); } @@ -185,40 +185,40 @@ public class Clip extends Leaf { * node's new application region. * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph - */ + */ public void setApplicationBoundingLeaf(BoundingLeaf region) { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_APPLICATION_BOUNDS_WRITE)) - throw new CapabilityNotSetException(J3dI18N.getString("Clip2")); - + throw new CapabilityNotSetException(J3dI18N.getString("Clip2")); + if (isLive()) ((ClipRetained)this.retained).setApplicationBoundingLeaf(region); else ((ClipRetained)this.retained).initApplicationBoundingLeaf(region); } - /** + /** * Retrieves the Clip node's application bounding leaf. * @return this Clip's application bounding leaf information * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph - */ + */ public BoundingLeaf getApplicationBoundingLeaf() { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_APPLICATION_BOUNDS_READ)) - throw new CapabilityNotSetException(J3dI18N.getString("Clip3")); - + throw new CapabilityNotSetException(J3dI18N.getString("Clip3")); + return ((ClipRetained)this.retained).getApplicationBoundingLeaf(); } - /** - * Creates the retained mode ClipRetained object that this - * Clip component object will point to. - */ + /** + * Creates the retained mode ClipRetained object that this + * Clip component object will point to. + */ void createRetained() { - this.retained = new ClipRetained(); - this.retained.setSource(this); - } + this.retained = new ClipRetained(); + this.retained.setSource(this); + } /** * Used to create a new instance of the node. This routine is called @@ -283,7 +283,7 @@ public class Clip extends Leaf { * <code>originalNode</code> into * the current node. This method is called from the * <code>cloneNode</code> method which is, in turn, called by the - * <code>cloneTree</code> method.<P> + * <code>cloneTree</code> method.<P> * * @param originalNode the original node to duplicate. * @param forceDuplicate when set to <code>true</code>, causes the diff --git a/src/classes/share/javax/media/j3d/ClipRetained.java b/src/classes/share/javax/media/j3d/ClipRetained.java index bdf99fc..8a60136 100644 --- a/src/classes/share/javax/media/j3d/ClipRetained.java +++ b/src/classes/share/javax/media/j3d/ClipRetained.java @@ -51,7 +51,7 @@ class ClipRetained extends LeafRetained { /** * Clip's back distance */ - double backDistance = 100.0; + double backDistance = 100.0; /** * back distance scaled to vworld @@ -60,10 +60,10 @@ class ClipRetained extends LeafRetained { /** * The Boundary object defining the application region. - */ + */ Bounds applicationRegion = null; - /** + /** * The bounding leaf reference */ BoundingLeafRetained boundingLeaf = null; @@ -98,7 +98,7 @@ class ClipRetained extends LeafRetained { } /** - * initializes the clip's back distance to the specified value. + * initializes the clip's back distance to the specified value. * @param backDistance the new back clipping distance */ final void initBackDistance(double backDistance) { @@ -107,7 +107,7 @@ class ClipRetained extends LeafRetained { /** - * Sets the clip's back distance to the specified value. + * Sets the clip's back distance to the specified value. * @param backDistance the new back clipping distance */ final void setBackDistance(double backDistance) { @@ -127,7 +127,7 @@ class ClipRetained extends LeafRetained { /** * Initializes the Clip's application region. * @param region a region that contains the Backgound's new application bounds - */ + */ final void initApplicationBounds(Bounds region) { if (region != null) { applicationRegion = (Bounds) region.clone(); @@ -139,29 +139,29 @@ class ClipRetained extends LeafRetained { /** * Set the Clip's application region. * @param region a region that contains the Clip's new application bounds - */ + */ final void setApplicationBounds(Bounds region) { initApplicationBounds(region); // Don't send the message if there is a valid boundingleaf if (boundingLeaf == null) { - sendMessage(BOUNDS_CHANGED, + sendMessage(BOUNDS_CHANGED, (region != null ? region.clone(): null), null); } } - /** + /** * Get the Backgound's application region. * @return this Clip's application bounds information - */ + */ final Bounds getApplicationBounds() { return (applicationRegion != null ? (Bounds) applicationRegion.clone() : null); } /** - * Initializes the Clip's application region + * Initializes the Clip's application region * to the specified Leaf node. - */ + */ void initApplicationBoundingLeaf(BoundingLeaf region) { if (region != null) { boundingLeaf = (BoundingLeafRetained)region.retained; @@ -172,18 +172,18 @@ class ClipRetained extends LeafRetained { /** * Set the Clip's application region to the specified Leaf node. - */ + */ void setApplicationBoundingLeaf(BoundingLeaf region) { if (boundingLeaf != null) boundingLeaf.mirrorBoundingLeaf.removeUser(this); - + if (region != null) { boundingLeaf = (BoundingLeafRetained)region.retained; boundingLeaf.mirrorBoundingLeaf.addUser(this); } else { boundingLeaf = null; } - sendMessage(BOUNDINGLEAF_CHANGED, + sendMessage(BOUNDINGLEAF_CHANGED, (boundingLeaf != null ? boundingLeaf.mirrorBoundingLeaf : null), (applicationRegion != null ? applicationRegion.clone() : null)); @@ -191,7 +191,7 @@ class ClipRetained extends LeafRetained { /** * Get the Clip's application region - */ + */ BoundingLeaf getApplicationBoundingLeaf() { return (boundingLeaf != null ? (BoundingLeaf)boundingLeaf.source : null); @@ -203,7 +203,7 @@ class ClipRetained extends LeafRetained { void setInImmCtx(boolean inCtx) { inImmCtx = inCtx; } - + /** * This gets the immedate mode context flag */ @@ -258,7 +258,7 @@ class ClipRetained extends LeafRetained { super.markAsLive(); } - + /** * This clearLive routine first calls the superclass's method, then * it removes itself to the list of lights @@ -299,9 +299,9 @@ class ClipRetained extends LeafRetained { else { transformedRegion = null; } - + } - backDistanceInVworld = backDistance * + backDistanceInVworld = backDistance * lastLocalToVworld.getDistanceScale(); } @@ -337,7 +337,7 @@ class ClipRetained extends LeafRetained { else { transformedRegion = null; } - + } } @@ -349,7 +349,7 @@ class ClipRetained extends LeafRetained { /** Note: This routine will only be called on * the mirror object - will update the object's - * cached region and transformed region + * cached region and transformed region */ void updateBoundingLeaf() { diff --git a/src/classes/share/javax/media/j3d/ColorInterpolator.java b/src/classes/share/javax/media/j3d/ColorInterpolator.java index 388a610..c527e38 100644 --- a/src/classes/share/javax/media/j3d/ColorInterpolator.java +++ b/src/classes/share/javax/media/j3d/ColorInterpolator.java @@ -58,13 +58,13 @@ public class ColorInterpolator extends Interpolator { Color3f endColor = new Color3f(); Color3f newColor = new Color3f(); - // We can't use a boolean flag since it is possible + // We can't use a boolean flag since it is possible // that after alpha change, this procedure only run // once at alpha.finish(). So the best way is to // detect alpha value change. private float prevAlphaValue = Float.NaN; private int prevColorTarget = -1; - private WakeupCriterion passiveWakeupCriterion = + private WakeupCriterion passiveWakeupCriterion = (WakeupCriterion) new WakeupOnElapsedFrames(0, true); // non-public, no parameter constructor used by cloneNode @@ -144,7 +144,7 @@ public class ColorInterpolator extends Interpolator { } /** - * This method sets the target material component object for + * This method sets the target material component object for * this interpolator. * @param target the material component object whose * color is affected by this color interpolator @@ -163,7 +163,7 @@ public class ColorInterpolator extends Interpolator { return target; } - // The ColorInterpolator's initialize routine uses the default + // The ColorInterpolator's initialize routine uses the default // initialization routine. /** @@ -241,14 +241,14 @@ public class ColorInterpolator extends Interpolator { ci.duplicateNode(this, forceDuplicate); return ci; } - + /** * Copies all ColorInterpolator information from * <code>originalNode</code> into * the current node. This method is called from the * <code>cloneNode</code> method which is, in turn, called by the - * <code>cloneTree</code> method.<P> + * <code>cloneTree</code> method.<P> * * @param originalNode the original node to duplicate. * @param forceDuplicate when set to <code>true</code>, causes the @@ -266,7 +266,7 @@ public class ColorInterpolator extends Interpolator { */ void duplicateAttributes(Node originalNode, boolean forceDuplicate) { super.duplicateAttributes(originalNode, forceDuplicate); - + ColorInterpolator ci = (ColorInterpolator) originalNode; ci.getStartColor(startColor); diff --git a/src/classes/share/javax/media/j3d/ColoringAttributes.java b/src/classes/share/javax/media/j3d/ColoringAttributes.java index 833df11..d1ddcbf 100644 --- a/src/classes/share/javax/media/j3d/ColoringAttributes.java +++ b/src/classes/share/javax/media/j3d/ColoringAttributes.java @@ -42,7 +42,7 @@ import javax.vecmath.Color3f; * <p> * The <code>setColor</code> methods set the current intrinsic red, green, and * blue color values of this ColoringAttributes component object. - * This color is only used for unlit geometry. If lighting is enabled, + * This color is only used for unlit geometry. If lighting is enabled, * the material colors are used in the lighting equation to produce * the final color. When vertex colors are present in unlit * geometry, those vertex colors are used in place of this @@ -56,15 +56,15 @@ import javax.vecmath.Color3f; * <p> * <b>Shading Model</b> * <p> - * The <code>setShadeModel</code> method sets the shade model for this - * ColoringAttributes component object. The shade model may be one of + * The <code>setShadeModel</code> method sets the shade model for this + * ColoringAttributes component object. The shade model may be one of * the following:<p> * <ul> * <li>FASTEST - use the fastest available method for shading. This * shading mode maps to whatever shading model the Java 3D implementor * defines as the "fastest," which may be hardware-dependent.</li> * <p> - * <li>NICEST - use the nicest (highest quality) available method + * <li>NICEST - use the nicest (highest quality) available method * for shading. This shading mode maps to whatever shading model * the Java 3D implementor defines as the "nicest," shading * model, which may be hardware-dependent.</li> @@ -72,11 +72,11 @@ import javax.vecmath.Color3f; * <li>SHADE_FLAT - use the flat shading model. This shading model * does not interpolate color across the primitive. * The primitive is drawn with a single color - * and the color of one vertex of the primitive is duplicated + * and the color of one vertex of the primitive is duplicated * across all the vertices of the primitive.</li> * <p> * <li>SHADE_GOURAUD - use the Gouraud (smooth) shading model. - * This shading model smoothly interpolates the color at each vertex + * This shading model smoothly interpolates the color at each vertex * across the primitive. * The primitive is drawn with many different colors * and the color at each vertex is treated individually. For lines, @@ -139,7 +139,7 @@ public class ColoringAttributes extends NodeComponent { ALLOW_COLOR_READ, ALLOW_SHADE_MODEL_READ }; - + /** * Constructs a ColoringAttributes node with default parameters. * The default values are as follows: @@ -166,7 +166,7 @@ public class ColoringAttributes extends NodeComponent { ((ColoringAttributesRetained)this.retained).initColor(color); ((ColoringAttributesRetained)this.retained).initShadeModel(shadeModel); - + } /** @@ -196,7 +196,7 @@ public class ColoringAttributes extends NodeComponent { * unless the vertex colors are ignored. * @param color the color that is used when lighting is disabled * or when material is null - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph * @see Material * @see RenderingAttributes#setIgnoreVertexColors @@ -206,7 +206,7 @@ public class ColoringAttributes extends NodeComponent { if (!this.getCapability(ALLOW_COLOR_WRITE)) throw new CapabilityNotSetException(J3dI18N.getString("ColoringAttributes0")); - if (isLive()) + if (isLive()) ((ColoringAttributesRetained)this.retained).setColor(color); else ((ColoringAttributesRetained)this.retained).initColor(color); @@ -224,7 +224,7 @@ public class ColoringAttributes extends NodeComponent { * @param r the red component of the color * @param g the green component of the color * @param b the blue component of the color - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph * @see Material * @see RenderingAttributes#setIgnoreVertexColors @@ -244,7 +244,7 @@ public class ColoringAttributes extends NodeComponent { * Gets the intrinsic color of this ColoringAttributes * component object. * @param color the vector that will receive color - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ public void getColor(Color3f color) { @@ -259,7 +259,7 @@ public class ColoringAttributes extends NodeComponent { * Sets the shade mode for this ColoringAttributes component object. * @param shadeModel the shade mode to be used; one of FASTEST, * NICEST, SHADE_FLAT, or SHADE_GOURAUD - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ public void setShadeModel(int shadeModel) { @@ -267,7 +267,7 @@ public class ColoringAttributes extends NodeComponent { if (!this.getCapability(ALLOW_SHADE_MODEL_WRITE)) throw new CapabilityNotSetException(J3dI18N.getString("ColoringAttributes3")); - if (isLive()) + if (isLive()) ((ColoringAttributesRetained)this.retained).setShadeModel(shadeModel); else ((ColoringAttributesRetained)this.retained).initShadeModel(shadeModel); @@ -276,7 +276,7 @@ public class ColoringAttributes extends NodeComponent { /** * Gets the shade mode for this ColoringAttributes component object. * @return shadeModel the shade mode - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ public int getShadeModel() { @@ -313,7 +313,7 @@ public class ColoringAttributes extends NodeComponent { * the current node. This method is called from the * <code>duplicateNode</code> method. This routine does * the actual duplication of all "local data" (any data defined in - * this object). + * this object). * * @param originalNodeComponent the original node to duplicate. * @param forceDuplicate when set to <code>true</code>, causes the @@ -325,15 +325,15 @@ public class ColoringAttributes extends NodeComponent { * @see Node#cloneTree * @see NodeComponent#setDuplicateOnCloneTree */ - void duplicateAttributes(NodeComponent originalNodeComponent, - boolean forceDuplicate) { + void duplicateAttributes(NodeComponent originalNodeComponent, + boolean forceDuplicate) { super.duplicateAttributes(originalNodeComponent, - forceDuplicate); + forceDuplicate); - ColoringAttributesRetained attr = + ColoringAttributesRetained attr = (ColoringAttributesRetained) originalNodeComponent.retained; - + ColoringAttributesRetained rt = (ColoringAttributesRetained) retained; Color3f c = new Color3f(); attr.getColor(c); diff --git a/src/classes/share/javax/media/j3d/ColoringAttributesRetained.java b/src/classes/share/javax/media/j3d/ColoringAttributesRetained.java index 1e3581c..2e3fc9b 100644 --- a/src/classes/share/javax/media/j3d/ColoringAttributesRetained.java +++ b/src/classes/share/javax/media/j3d/ColoringAttributesRetained.java @@ -50,7 +50,7 @@ class ColoringAttributesRetained extends NodeComponentRetained { // Shade model (flat, smooth) int shadeModel = ColoringAttributes.SHADE_GOURAUD; - + /** * Sets the intrinsic color of this ColoringAttributes * component object. @@ -140,7 +140,7 @@ class ColoringAttributesRetained extends NodeComponentRetained { /** - * Creates and initializes a mirror object, point the mirror object + * Creates and initializes a mirror object, point the mirror object * to the retained object if the object is not editable */ synchronized void createMirrorObject() { @@ -150,7 +150,7 @@ class ColoringAttributesRetained extends NodeComponentRetained { if (isStatic()) { mirror = this; } else { - ColoringAttributesRetained mirrorCa + ColoringAttributesRetained mirrorCa = new ColoringAttributesRetained(); mirrorCa.source = source; mirrorCa.set(this); @@ -178,11 +178,11 @@ class ColoringAttributesRetained extends NodeComponentRetained { ((ColoringAttributesRetained)mirror).set(this); } - /** Update the "component" field of the mirror object with the + /** Update the "component" field of the mirror object with the * given "value" */ synchronized void updateMirrorObject(int component, Object value) { - + ColoringAttributesRetained mirrorCa = (ColoringAttributesRetained) mirror; @@ -196,7 +196,7 @@ class ColoringAttributesRetained extends NodeComponentRetained { boolean equivalent(ColoringAttributesRetained cr) { return ((cr != null) && - color.equals(cr.color) && + color.equals(cr.color) && (shadeModel == cr.shadeModel)); } @@ -217,11 +217,11 @@ class ColoringAttributesRetained extends NodeComponentRetained { super.set(cr); color.set(cr.color); shadeModel = cr.shadeModel; - } + } final void sendMessage(int attrMask, Object attr) { ArrayList univList = new ArrayList(); - ArrayList gaList = Shape3DRetained.getGeomAtomsList(mirror.users, univList); + ArrayList gaList = Shape3DRetained.getGeomAtomsList(mirror.users, univList); // Send to rendering attribute structure, regardless of // whether there are users or not (alternate appearance case ..) J3dMessage createMessage = new J3dMessage(); @@ -234,23 +234,23 @@ class ColoringAttributesRetained extends NodeComponentRetained { createMessage.args[3] = new Integer(changedFrequent); VirtualUniverse.mc.processMessage(createMessage); - + // System.err.println("univList.size is " + univList.size()); for(int i=0; i<univList.size(); i++) { createMessage = new J3dMessage(); createMessage.threads = J3dThread.UPDATE_RENDER; createMessage.type = J3dMessage.COLORINGATTRIBUTES_CHANGED; - + createMessage.universe = (VirtualUniverse) univList.get(i); createMessage.args[0] = this; createMessage.args[1]= new Integer(attrMask); createMessage.args[2] = attr; - + ArrayList gL = (ArrayList) gaList.get(i); GeometryAtom[] gaArr = new GeometryAtom[gL.size()]; gL.toArray(gaArr); createMessage.args[3] = gaArr; - + VirtualUniverse.mc.processMessage(createMessage); } } @@ -260,5 +260,5 @@ class ColoringAttributesRetained extends NodeComponentRetained { setFrequencyChangeMask(bit, 0x1); } } - + } diff --git a/src/classes/share/javax/media/j3d/CompileState.java b/src/classes/share/javax/media/j3d/CompileState.java index 19f939c..8063368 100644 --- a/src/classes/share/javax/media/j3d/CompileState.java +++ b/src/classes/share/javax/media/j3d/CompileState.java @@ -70,25 +70,25 @@ class CompileState { static final int BOUNDS_READ = 0x00001; static final int GEOMETRY_READ = 0x00002; - + // scene graph flattening boolean keepTG = false; // used to force the immediate transform // group to stay around - boolean needNormalsTransform = false; // true if the current transform + boolean needNormalsTransform = false; // true if the current transform // needs to push down normals // transform to geometries - + // the current static transform group TransformGroupRetained staticTransform = null; - + // parent group GroupRetained parentGroup = null; // list of transform group // for the current transform group - ArrayList transformGroupChildrenList = null; + ArrayList transformGroupChildrenList = null; // list of objects that have a static // transform that can be deferenced @@ -114,7 +114,7 @@ class CompileState { compileVerbose = false; } initShapeMerge(); - } + } // Appearance mapping: /** @@ -175,7 +175,7 @@ class CompileState { while (geometry == null && i < shape.geometryList.size()) { geometry = (GeometryRetained) shape.geometryList.get(i); i++; - } + } if (shape.parent instanceof GroupRetained && ((GroupRetained)shape.parent).isStaticChildren() && geometry.geoType < GeometryArrayRetained.GEO_TYPE_RASTER) { list.add(shape); } @@ -204,15 +204,15 @@ class CompileState { // System.err.println("doShapeMerge, shapeList = "+shapeLists); if (shapeLists != null) { - // loop over the shapes in each list, creating a single shape - // for each. Add the shape to the group + // loop over the shapes in each list, creating a single shape + // for each. Add the shape to the group Collection lists = shapeLists.values(); Iterator listIterator = lists.iterator(); Shape3DRetained mergeShape; GeometryRetained firstGeo; int num = 0; int compileFlags = 0; - + while (listIterator.hasNext()) { Vector curList = (Vector)listIterator.next(); int numShapes = curList.size(); @@ -235,7 +235,7 @@ class CompileState { int numMerge = 0; mergeShape = shapes[i]; GeometryArrayRetained mergeGeo = (GeometryArrayRetained)firstGeo; - + toBeMergedShapes[numMerge++] = mergeShape; // Determine if all mergeable shapes have the same boundsCompute // and collisionBounds set the same way @@ -257,11 +257,11 @@ class CompileState { shapes[j].isEquivalent(mergeShape) && firstGeo.isEquivalenceClass(mergeGeo) && ((GeometryArrayRetained)firstGeo).vertexFormat == mergeGeo.vertexFormat) { - // got one to merge, add shapes to merge, + // got one to merge, add shapes to merge, toBeMergedShapes[numMerge++] = shapes[j]; compileFlags |= getCompileFlags(shapes[j]); - + // remove from shapes shapes[j] = null; } @@ -285,10 +285,10 @@ class CompileState { if (!found) { System.err.println("ShapeSet.add(): Can't remove " + "shape from parent, can't find shape!"); - } - + } + } - + mergeShape = new Shape3DCompileRetained(toBeMergedShapes, numMerge, compileFlags); if (J3dDebug.devPhase && J3dDebug.debug) { @@ -336,9 +336,9 @@ class CompileState { (shape.boundsAutoCompute && shape.source.getCapability(Shape3D.ALLOW_BOUNDS_READ))) cflag |= GEOMETRY_READ; - + return cflag; - + } } diff --git a/src/classes/share/javax/media/j3d/CompressedGeometry.java b/src/classes/share/javax/media/j3d/CompressedGeometry.java index 9ecbd77..ffe9cd7 100644 --- a/src/classes/share/javax/media/j3d/CompressedGeometry.java +++ b/src/classes/share/javax/media/j3d/CompressedGeometry.java @@ -145,7 +145,7 @@ public class CompressedGeometry extends Geometry { * * @see CompressedGeometryHeader * @see Canvas3D#queryProperties - */ + */ public CompressedGeometry(CompressedGeometryHeader hdr, byte[] compressedGeometry) { this(hdr, compressedGeometry, false) ; @@ -266,7 +266,7 @@ public class CompressedGeometry extends Geometry { * Retrieves the compressed geometry associated with the * CompressedGeometry NodeComponent object. Copies the compressed * geometry from the CompressedGeometry node into the given array. - * The array must be large enough to hold all of the bytes. + * The array must be large enough to hold all of the bytes. * The individual array elements must be allocated by the caller. * * @param compressedGeometry the array into which to copy the compressed @@ -286,7 +286,7 @@ public class CompressedGeometry extends Geometry { if (!this.getCapability(ALLOW_GEOMETRY_READ)) throw new CapabilityNotSetException (J3dI18N.getString("CompressedGeometry3")) ; - + if (isByReference()) throw new IllegalStateException (J3dI18N.getString("CompressedGeometry7")) ; @@ -294,7 +294,7 @@ public class CompressedGeometry extends Geometry { if (cgHeader.size > compressedGeometry.length) throw new ArrayIndexOutOfBoundsException (J3dI18N.getString("CompressedGeometry4")) ; - + ((CompressedGeometryRetained)this.retained).copy(compressedGeometry) ; } diff --git a/src/classes/share/javax/media/j3d/CompressedGeometryHeader.java b/src/classes/share/javax/media/j3d/CompressedGeometryHeader.java index d39b2c8..75f6761 100644 --- a/src/classes/share/javax/media/j3d/CompressedGeometryHeader.java +++ b/src/classes/share/javax/media/j3d/CompressedGeometryHeader.java @@ -63,7 +63,7 @@ public class CompressedGeometryHeader extends Object { * bufferType: compressed geometry is made up of triangles. */ public static final int TRIANGLE_BUFFER = 2 ; - + // Valid values for the bufferDataPresent field. /** @@ -143,7 +143,7 @@ public class CompressedGeometryHeader extends Object { * Offset in bytes of the start of the compressed geometry from the * beginning of the compressed geometry byte array passed to the * CompressedGeometry constructor. <p> - * + * * If the CompressedGeometry is created with reference access semantics, * then this allow external compressors or file readers to embed several * blocks of compressed geometry in a single large byte array, possibly @@ -193,7 +193,7 @@ public class CompressedGeometryHeader extends Object { * in by the application. * * @see CompressedGeometry - */ + */ public CompressedGeometryHeader() { } @@ -229,7 +229,7 @@ public class CompressedGeometryHeader extends Object { case LINE_BUFFER: type = "LINE_BUFFER" ; break ; case TRIANGLE_BUFFER: type = "TRIANGLE_BUFFER" ; break ; } - + String data = "" ; if ((bufferDataPresent & NORMAL_IN_BUFFER) != 0) data = data + "NORMALS " ; @@ -237,7 +237,7 @@ public class CompressedGeometryHeader extends Object { data = data + "COLORS " ; if ((bufferDataPresent & ALPHA_IN_BUFFER) != 0) data = data + "ALPHA " ; - + String lbound = "null" ; if (lowerBound != null) lbound = lowerBound.toString() ; diff --git a/src/classes/share/javax/media/j3d/CompressedGeometryRenderMethod.java b/src/classes/share/javax/media/j3d/CompressedGeometryRenderMethod.java index eb824b1..bbe9157 100644 --- a/src/classes/share/javax/media/j3d/CompressedGeometryRenderMethod.java +++ b/src/classes/share/javax/media/j3d/CompressedGeometryRenderMethod.java @@ -54,7 +54,7 @@ class CompressedGeometryRenderMethod implements RenderMethod { } return true; } - + boolean isVisible = false; // True if any of the RAs is visible. while (ra != null) { @@ -77,21 +77,21 @@ class CompressedGeometryRenderMethod implements RenderMethod { cv.raIsVisible = false; } cv.ra = ra.renderAtom; - } - + } + ra = ra.next; } return isVisible; - + } void renderCompressedGeo(RenderAtomListInfo ra, RenderMolecule rm, Canvas3D cv) { - + boolean useAlpha ; CompressedGeometryRetained cgr ; useAlpha = rm.useAlpha ; - + cgr = (CompressedGeometryRetained)ra.renderAtom.geometryAtom.geometryArray[ra.index]; /* force_decompression if lighting is disabled and @@ -110,7 +110,7 @@ class CompressedGeometryRenderMethod implements RenderMethod { // decompressor error return ; } - + cgr.mirrorGeometry.execute(cv, ra.renderAtom, rm.isNonUniformScale, (useAlpha && ra.geometry().noAlpha), rm.alpha, cv.screen.screen, diff --git a/src/classes/share/javax/media/j3d/CompressedGeometryRetained.java b/src/classes/share/javax/media/j3d/CompressedGeometryRetained.java index 82cc98f..113fd04 100644 --- a/src/classes/share/javax/media/j3d/CompressedGeometryRetained.java +++ b/src/classes/share/javax/media/j3d/CompressedGeometryRetained.java @@ -92,11 +92,11 @@ class CompressedGeometryRetained extends GeometryRetained { // True if the platform supports hardware decompression. private static boolean hardwareDecompression = false ; - + // This field retains a reference to the GeometryRetained object used for // geometry-based picking. It is normally the same reference as the // mirror geometry used for rendering unless hardware decompression is - // supported. + // supported. private GeometryRetained pickGeometry = null ; /** @@ -137,25 +137,25 @@ class CompressedGeometryRetained extends GeometryRetained { execute(cv.ctx, packedVersion, bufferType, bufferContents, renderFlags, offset, size, compressedGeometry) ; } - + /** * The package-scoped constructor. */ CompressedGeometryRetained() { this.geoType = GEO_TYPE_COMPRESSED ; - + // Compressed geometry is always bounded by [-1..1] on each axis, so // set that as the initial bounding box. geoBounds.setUpper( 1.0, 1.0, 1.0) ; geoBounds.setLower(-1.0,-1.0,-1.0) ; } - + /** * Compressed geometry is immutable so this method does nothing. */ void computeBoundingBox() { } - + /** * Update this object. Compressed geometry is immutable so there's * nothing to do. @@ -177,7 +177,7 @@ class CompressedGeometryRetained extends GeometryRetained { // GL_SUNX_geometry_compression extension. The header is unnecessary // if only the newer GL_SUN_geometry_compression API needs support. compressedGeometry = new byte[HEADER_LENGTH + this.size] ; - + compressedGeometry[HEADER_MAJOR_VERSION_OFFSET] = (byte)this.majorVersionNumber ; @@ -192,7 +192,7 @@ class CompressedGeometryRetained extends GeometryRetained { compressedGeometry[HEADER_BUFFER_DATA_OFFSET] = (byte)this.bufferContents ; - + System.arraycopy(geometry, this.offset, compressedGeometry, HEADER_LENGTH, this.size) ; @@ -284,7 +284,7 @@ class CompressedGeometryRetained extends GeometryRetained { // Return this object if hardware decompression is available. if (hardwareDecompression) return (GeometryRetained)this ; - + // Check to see if hardware decompression is available. if (decompressHW(cv.ctx, majorVersionNumber, minorVersionNumber)) { hardwareDecompression = true ; @@ -292,7 +292,7 @@ class CompressedGeometryRetained extends GeometryRetained { // If hardware can't handle by-reference, punt to by-copy. if (isByReference() && !decompressByRef(cv.ctx)) { createByCopy(compressedGeometry) ; - } + } return (GeometryRetained)this ; } @@ -334,7 +334,7 @@ class CompressedGeometryRetained extends GeometryRetained { gdr.getBoundingBox(geoBounds) ; return pickGeometry ; } - + // // The following intersect() methods are used to implement geometry-based // picking and collision. @@ -345,7 +345,7 @@ class CompressedGeometryRetained extends GeometryRetained { return (geomR != null ? geomR.intersect(pickShape, pickInfo, flags, iPnt, geom, geomIndex) : false); } - + boolean intersect(Bounds targetBound) { GeometryRetained geom = getPickGeometry() ; return (geom != null ? geom.intersect(targetBound) : false); @@ -353,13 +353,13 @@ class CompressedGeometryRetained extends GeometryRetained { boolean intersect(Transform3D thisToOtherVworld, GeometryRetained g) { GeometryRetained geom = getPickGeometry() ; - return (geom != null ? + return (geom != null ? geom.intersect(thisToOtherVworld, g) : false); } boolean intersect(Point3d[] pnts) { GeometryRetained geom = getPickGeometry() ; - return (geom != null ? geom.intersect(pnts) : false); + return (geom != null ? geom.intersect(pnts) : false); } /** @@ -372,15 +372,15 @@ class CompressedGeometryRetained extends GeometryRetained { if ((this.bufferContents & CompressedGeometryHeader.NORMAL_IN_BUFFER) != 0) vertexFormat |= GeometryArray.NORMALS ; - + if ((this.bufferContents & CompressedGeometryHeader.COLOR_IN_BUFFER) != 0) vertexFormat |= GeometryArray.COLOR ; - + if ((this.bufferContents & CompressedGeometryHeader.ALPHA_IN_BUFFER) != 0) vertexFormat |= GeometryArray.WITH_ALPHA ; - + return vertexFormat ; } diff --git a/src/classes/share/javax/media/j3d/ConeSound.java b/src/classes/share/javax/media/j3d/ConeSound.java index 48344b8..d4197d6 100644 --- a/src/classes/share/javax/media/j3d/ConeSound.java +++ b/src/classes/share/javax/media/j3d/ConeSound.java @@ -43,7 +43,7 @@ import javax.vecmath.Vector3f; * by gain scale factors and filters based on the angle between the vector from * the source to the listener, and the ConeSound's direction vector. This * attenuation is either a single spherical distance gain attenuation (as for - * a general PointSound source) or dual front and back distance gain + * a general PointSound source) or dual front and back distance gain * attenuations defining elliptical attenuation areas. The angular filter and the * active AuralAttribute component filter define what filtering is applied to * the sound source. (See AuralAtttribute class for more details on filtering.) @@ -51,7 +51,7 @@ import javax.vecmath.Vector3f; * direction vector and an array of points each containing: angular distance (in * radians), gain scale factor, and filter (which for now consists of a lowpass * filter cutoff frequency). Similar to the definition of the back distance gain - * array for PointSounds, a piece-wise linear curve (defined in terms of + * array for PointSounds, a piece-wise linear curve (defined in terms of * radians from the axis) specifies the slope of these additional attenuation * values. * <P> @@ -68,7 +68,7 @@ import javax.vecmath.Vector3f; * attenuation array separate from the back distance attenuation array. * A front distance attenuation array defines monotonically-increasing * distances from the sound source origin along the position direction - * vector. A back distance attenuation array (if given) defines + * vector. A back distance attenuation array (if given) defines * monotonically-increasing distances from the sound source origin along the * negative direction vector. The two arrays must be of the same length. * The backDistance[i] gain values must be less than or equal to @@ -105,7 +105,7 @@ import javax.vecmath.Vector3f; *<P> * If this is not set, no angular gain attenuation or filtering is performed * (equivalent to using an angular gain scale factor of 1.0 and an angular - * filter of Sound.NO_FILTER for all distances). + * filter of Sound.NO_FILTER for all distances). * <P> * If angular distance from the listener-sound-position vector and a sound's * direction vector is less than the first distance in the array, only the first @@ -128,7 +128,7 @@ import javax.vecmath.Vector3f; * attenuation arrays. Arrays passed into getAngularAttenuation methods * should all be at least this size. *</UL> - */ + */ public class ConeSound extends PointSound { // Constants @@ -200,7 +200,7 @@ public class ConeSound extends PointSound { */ public ConeSound(MediaContainer soundData, float initialGain, - Point3f position, + Point3f position, Vector3f direction) { super(soundData, initialGain, position ); @@ -215,7 +215,7 @@ public class ConeSound extends PointSound { * Constructs a ConeSound node object using only the provided parameter * values for sound, overall initial gain, position, and direction. The * remaining fields are set to the default values above. This form uses - * individual float parameters for the elements of the position and + * individual float parameters for the elements of the position and * direction vectors. * @param soundData sound source data * @param initialGain amplitude scale factor applied to sound @@ -228,7 +228,7 @@ public class ConeSound extends PointSound { */ public ConeSound(MediaContainer soundData, float initialGain, - float posX, float posY, float posZ, + float posX, float posY, float posZ, float dirX, float dirY, float dirZ) { super(soundData, initialGain, posX, posY, posZ ); @@ -241,13 +241,13 @@ public class ConeSound extends PointSound { /** * Constructs a ConeSound node object using all the provided PointSound - * parameter values. This form uses points or vectors as input for its + * parameter values. This form uses points or vectors as input for its * position, direction, and front/back distance attenuation arrays. *<P> * Unlike the single distance gain attenuation array for PointSounds which * define spherical areas about the sound source between which gains are * linearly interpolated, this directed ConeSound can have two distance gain - * attenuation arrays that define ellipsoidal attenuation areas. See the + * attenuation arrays that define ellipsoidal attenuation areas. See the * setDistanceGain PointSound method for details on how the separate distance * and distanceGain arrays are interpreted. *<P> @@ -262,9 +262,9 @@ public class ConeSound extends PointSound { * @param region scheduling bounds * @param priority playback ranking value * @param position 3D location of source - * @param frontDistanceAttenuation array of (distance,gain) pairs controlling + * @param frontDistanceAttenuation array of (distance,gain) pairs controlling * attenuation values along the positive direction axis - * @param backDistanceAttenuation array of (distance,gain) pairs controlling + * @param backDistanceAttenuation array of (distance,gain) pairs controlling * attenuation values along the negative direction axis * @param direction vector defining cones' axii */ @@ -294,13 +294,13 @@ public class ConeSound extends PointSound { /** * Constructs a ConeSound node object using the provided parameter values. - * This form uses individual float parameters for the elements of the + * This form uses individual float parameters for the elements of the * position, direction, and two distance attenuation arrays. - * Unlike the single distance gain attenuation array for PointSounds, which + * Unlike the single distance gain attenuation array for PointSounds, which * define spherical areas about the sound source between which gains are * linearly interpolated, this directed ConeSound can have two distance - * gain attenuation arrays that define ellipsoidal attenuation areas. - * See the setDistanceGain PointSound method for details on how the + * gain attenuation arrays that define ellipsoidal attenuation areas. + * See the setDistanceGain PointSound method for details on how the * separate distance and distanceGain arrays are interpreted. * The ConeSound's direction vector and angular measurements are defined * in the local coordinate system of the node. @@ -338,7 +338,7 @@ public class ConeSound extends PointSound { float[] backDistanceGain, float dirX, float dirY, float dirZ ) { super(soundData, initialGain, loopCount, release, continuous, enable, - region, priority, posX, posY, posZ, + region, priority, posX, posY, posZ, frontDistance, frontDistanceGain ); // set default read capabilities @@ -352,7 +352,7 @@ public class ConeSound extends PointSound { /** * Constructs a ConeSound node object using all the provided PointSound * parameter values, which include a single spherical distance attenuation - * array, but includes an angular attenuation array. + * array, but includes an angular attenuation array. * This form uses points and vectors as input for its position, direction, * single spherical distanceAttenuation array, and angularAttenuation array. * It also accepts arrays of points for the distance attenuation and angular @@ -369,7 +369,7 @@ public class ConeSound extends PointSound { * @param region scheduling bounds * @param priority playback ranking value * @param position 3D location of source - * @param distanceAttenuation array of (distance,gain) pairs controlling + * @param distanceAttenuation array of (distance,gain) pairs controlling * attenuation values along the positive direction axis * @param direction vector defining cones' axii * @param angularAttenuation array of tuples defining angular gain/filtering @@ -408,7 +408,7 @@ public class ConeSound extends PointSound { * components of distance attenuation, and separate arrays for the angular * distance, angular gain, and filtering components of angular attenuation. * See the setDistanceGain ConeSound method for details on how the separate - * distance and distanceGain arrays are interpreted. See the + * distance and distanceGain arrays are interpreted. See the * setAngularAttenuation ConeSound method for details on how the separate * angularDistance, angularGain, and filter arrays are interpreted. * @param soundData sound source data associated with this node @@ -447,7 +447,7 @@ public class ConeSound extends PointSound { float[] angularGain, float[] frequencyCutoff) { super(soundData, initialGain, loopCount, release, continuous, enable, - region, priority, posX, posY, posZ, + region, priority, posX, posY, posZ, distance, distanceGain ); // set default read capabilities @@ -472,9 +472,9 @@ public class ConeSound extends PointSound { * @param region scheduling bounds * @param priority playback ranking value * @param position 3D location of source - * @param frontDistanceAttenuation array of (distance,gain) pairs controlling + * @param frontDistanceAttenuation array of (distance,gain) pairs controlling * attenuation values along the positive direction axis - * @param backDistanceAttenuation array of (distance,gain) pairs controlling + * @param backDistanceAttenuation array of (distance,gain) pairs controlling * attenuation values along the negative direction axis * @param direction vector defining cones' axii * @param angularAttenuation array of tuples defining angular gain/filtering @@ -550,7 +550,7 @@ public class ConeSound extends PointSound { float[] angularGain, float[] frequencyCutoff) { super(soundData, initialGain, loopCount, release, continuous, enable, - region, priority, posX, posY, posZ, + region, priority, posX, posY, posZ, frontDistance, frontDistanceGain ); // set default read capabilities @@ -576,20 +576,20 @@ public class ConeSound extends PointSound { // OVERLOADED Sound methods // /** - * Sets this sound's distance gain elliptical attenuation - + * Sets this sound's distance gain elliptical attenuation - * where gain scale factor is applied to sound based on distance listener * is from sound source. * @param frontAttenuation defined by pairs of (distance,gain-scale-factor) * @param backAttenuation defined by pairs of (distance,gain-scale-factor) * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph - */ + */ public void setDistanceGain(Point2f[] frontAttenuation, Point2f[] backAttenuation ) { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_DISTANCE_GAIN_WRITE)) throw new CapabilityNotSetException(J3dI18N.getString("ConeSound0")); - + ((ConeSoundRetained)this.retained).setDistanceGain(frontAttenuation, backAttenuation); } @@ -602,30 +602,30 @@ public class ConeSound extends PointSound { * @param backGain array of non-negative scale factors * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph - */ + */ public void setDistanceGain(float[] frontDistance, float[] frontGain, float[] backDistance, float[] backGain) { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_DISTANCE_GAIN_WRITE)) throw new CapabilityNotSetException(J3dI18N.getString("ConeSound0")); - + ((ConeSoundRetained)this.retained).setDistanceGain( frontDistance, frontGain, backDistance, backGain); } /** - * Sets this sound's back distance gain attenuation - where gain scale + * Sets this sound's back distance gain attenuation - where gain scale * factor is applied to sound based on distance listener along the negative * sound direction axis from sound source. * @param attenuation defined by pairs of (distance,gain-scale-factor) * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph - */ + */ public void setBackDistanceGain(Point2f[] attenuation) { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_DISTANCE_GAIN_WRITE)) throw new CapabilityNotSetException(J3dI18N.getString("ConeSound0")); - + ((ConeSoundRetained)this.retained).setBackDistanceGain(attenuation); } @@ -635,12 +635,12 @@ public class ConeSound extends PointSound { * @param gain array of non-negative scale factors * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph - */ + */ public void setBackDistanceGain(float[] distance, float[] gain) { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_DISTANCE_GAIN_WRITE)) throw new CapabilityNotSetException(J3dI18N.getString("ConeSound0")); - + ((ConeSoundRetained)this.retained).setBackDistanceGain(distance, gain); } @@ -652,43 +652,43 @@ public class ConeSound extends PointSound { * The individual array elements must be allocated by the * caller. The Point2f x,y values are defined as follows: * x is the distance, y is the gain. - * @param frontAttenuation arrays containing forward distances + * @param frontAttenuation arrays containing forward distances * attenuation pairs - * @param backAttenuation arrays containing backward distances + * @param backAttenuation arrays containing backward distances * attenuation pairs * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph - */ + */ public void getDistanceGain(Point2f[] frontAttenuation, - Point2f[] backAttenuation) { + Point2f[] backAttenuation) { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_DISTANCE_GAIN_READ)) throw new CapabilityNotSetException(J3dI18N.getString("ConeSound2")); - + ((ConeSoundRetained)this.retained).getDistanceGain( frontAttenuation, backAttenuation); } /** - * Gets this sound's elliptical distance gain attenuation values in + * Gets this sound's elliptical distance gain attenuation values in * separate arrays. The arrays must be large enough to hold all * of the values. * @param frontDistance array of float distances along the sound axis - * @param frontGain array of non-negative scale factors associated with + * @param frontGain array of non-negative scale factors associated with * front distances - * @param backDistance array of float negative distances along the sound + * @param backDistance array of float negative distances along the sound * axis - * @param backGain array of non-negative scale factors associated with + * @param backGain array of non-negative scale factors associated with * back distances * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph - */ + */ public void getDistanceGain(float[] frontDistance, float[] frontGain, - float[] backDistance, float[] backGain) { + float[] backDistance, float[] backGain) { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_DISTANCE_GAIN_READ)) throw new CapabilityNotSetException(J3dI18N.getString("ConeSound10")); - + ((ConeSoundRetained)this.retained).getDistanceGain( frontDistance, frontGain, backDistance, backGain); } @@ -703,7 +703,7 @@ public class ConeSound extends PointSound { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_DIRECTION_WRITE)) throw new CapabilityNotSetException(J3dI18N.getString("ConeSound3")); - + ((ConeSoundRetained)this.retained).setDirection(direction); } @@ -740,9 +740,9 @@ public class ConeSound extends PointSound { /** * Sets this sound's angular gain attenuation (not including filter). - * In this form of setAngularAttenuation, only the angular distances - * and angular gain scale factors pairs are given. The filter values for - * these tuples are implicitly set to Sound.NO_FILTER. + * In this form of setAngularAttenuation, only the angular distances + * and angular gain scale factors pairs are given. The filter values for + * these tuples are implicitly set to Sound.NO_FILTER. * @param attenuation array containing angular distance and gain * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph @@ -756,7 +756,7 @@ public class ConeSound extends PointSound { } /** - * In the second form of setAngularAttenuation, an array of all three values + * In the second form of setAngularAttenuation, an array of all three values * is supplied. * @param attenuation array containing angular distance, gain, and filter * @exception CapabilityNotSetException if appropriate capability is @@ -778,7 +778,7 @@ public class ConeSound extends PointSound { * angularDistance array length, the array elements beyond the length of * the angularDistance array are ignored. If the angularGain or filtering * array is shorter than the angularDistance array, the last value of the - * short array is repeated to fill an array of length equal to + * short array is repeated to fill an array of length equal to * angularDistance array. * @param distance array containing angular distance * @param gain array containing angular gain attenuation @@ -801,24 +801,24 @@ public class ConeSound extends PointSound { * All arrays are forced to same size. * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph - */ + */ public int getAngularAttenuationLength() { - if (isLiveOrCompiled()) - if(!this.getCapability(ALLOW_ANGULAR_ATTENUATION_READ)) - throw new CapabilityNotSetException(J3dI18N.getString("ConeSound9")); - + if (isLiveOrCompiled()) + if(!this.getCapability(ALLOW_ANGULAR_ATTENUATION_READ)) + throw new CapabilityNotSetException(J3dI18N.getString("ConeSound9")); + return (((ConeSoundRetained)this.retained).getAngularAttenuationLength()); } /** - * Copies the array of attenuation values from this sound, including + * Copies the array of attenuation values from this sound, including * gain and filter, into the specified array. The array must be * large enough to hold all of the points. The individual array * elements must be allocated by the caller. The Point3f x,y,z values * are defined as follows: x is the angular distance, y is * the angular gain attenuation, and z is the frequency * cutoff. - * @param attenuation the array to receive the attenuation values + * @param attenuation the array to receive the attenuation values * applied to gain when listener is between cones * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph @@ -896,7 +896,7 @@ public class ConeSound extends PointSound { * <code>false</code>, the value of each node's * <code>duplicateOnCloneTree</code> variable determines whether * NodeComponent data is duplicated or copied. - * @exception ClassCastException if originalNode is not an instance of + * @exception ClassCastException if originalNode is not an instance of * <code>ConeSound</code> * * @see Node#cloneTree @@ -913,7 +913,7 @@ public class ConeSound extends PointSound { * <code>originalNode</code> into * the current node. This method is called from the * <code>cloneNode</code> method which is, in turn, called by the - * <code>cloneTree</code> method.<P> + * <code>cloneTree</code> method.<P> * * @param originalNode the original node to duplicate. * @param forceDuplicate when set to <code>true</code>, causes the @@ -935,18 +935,18 @@ public class ConeSound extends PointSound { ConeSoundRetained orgRetained = (ConeSoundRetained)originalNode.retained; ConeSoundRetained thisRetained = (ConeSoundRetained)this.retained; - // front distance gain & attenuation is set in super + // front distance gain & attenuation is set in super // set back distance gain only int len = orgRetained.getDistanceGainLength(); float distance[] = new float[len]; float gain[] = new float[len]; orgRetained.getDistanceGain(null, null,distance, gain); thisRetained.setBackDistanceGain(distance, gain); - + Vector3f v = new Vector3f(); orgRetained.getDirection(v); thisRetained.setDirection(v); - + len = orgRetained.getAngularAttenuationLength(); distance = gain = null; float angle[] = new float[len]; diff --git a/src/classes/share/javax/media/j3d/ConeSoundRetained.java b/src/classes/share/javax/media/j3d/ConeSoundRetained.java index 445a68f..a3f4b38 100644 --- a/src/classes/share/javax/media/j3d/ConeSoundRetained.java +++ b/src/classes/share/javax/media/j3d/ConeSoundRetained.java @@ -40,12 +40,12 @@ import javax.vecmath.Point3f; /** * A ConeSoundRetained node defines a point sound source located at some - * location + * location * in space whose amplitude is constrained not only by maximum and minimum * amplitude * spheres but by two concentric cone volumes directed down an vector radiating * from the sound's location. - */ + */ class ConeSoundRetained extends PointSoundRetained { /** @@ -90,14 +90,14 @@ class ConeSoundRetained extends PointSoundRetained { // ********************* /** - * Sets this sound's distance gain elliptical attenuation - + * Sets this sound's distance gain elliptical attenuation - * where gain scale factor is applied to sound based on distance listener * is from sound source. * @param frontAttenuation defined by pairs of (distance,gain-scale-factor) * @param backAttenuation defined by pairs of (distance,gain-scale-factor) * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph - */ + */ void setDistanceGain(Point2f[] frontAttenuation, Point2f[] backAttenuation ) { @@ -113,7 +113,7 @@ class ConeSoundRetained extends PointSoundRetained { * @param backGain array of non-negative scale factors * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph - */ + */ void setDistanceGain(float[] frontDistance, float[] frontGain, float[] backDistance, float[] backGain) { this.setDistanceGain(frontDistance, frontGain); @@ -121,13 +121,13 @@ class ConeSoundRetained extends PointSoundRetained { } /** - * Sets this sound's back distance gain attenuation - where gain scale + * Sets this sound's back distance gain attenuation - where gain scale * factor is applied to sound based on distance listener along the negative * sound direction axis from sound source. * @param attenuation defined by pairs of (distance,gain-scale-factor) * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph - */ + */ void setBackDistanceGain(Point2f[] attenuation) { // if attenuation array null set both attenuation components to null @@ -162,7 +162,7 @@ class ConeSoundRetained extends PointSoundRetained { * @param gain array of non-negative scale factors * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph - */ + */ void setBackDistanceGain(float[] distance, float[] gain) { int distanceLength = 0; @@ -184,10 +184,10 @@ class ConeSoundRetained extends PointSoundRetained { this.backAttenuationGain = new float[distanceLength]; // Copy the distance array into nodes field System.arraycopy(distance, 0, this.backAttenuationDistance, - 0, distanceLength); + 0, distanceLength); // Copy the gain array an array of same length as the distance array if (distanceLength <= gainLength) { - System.arraycopy(gain, 0, this.backAttenuationGain, + System.arraycopy(gain, 0, this.backAttenuationGain, 0, distanceLength); } else { @@ -200,12 +200,12 @@ class ConeSoundRetained extends PointSoundRetained { } } } - - Point2f [] attenuation = new Point2f[distanceLength]; - for (int i=0; i<distanceLength; i++) { + + Point2f [] attenuation = new Point2f[distanceLength]; + for (int i=0; i<distanceLength; i++) { attenuation[i] = new Point2f(this.backAttenuationDistance[i], this.backAttenuationGain[i]); - } + } dispatchAttribChange(BACK_DISTANCE_GAIN_DIRTY_BIT, attenuation); if (source != null && source.isLive()) { notifySceneGraphChanged(false); @@ -218,9 +218,9 @@ class ConeSoundRetained extends PointSoundRetained { * @param backAttenuation arrays containing backward distances attenuation pairs * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph - */ + */ void getDistanceGain(Point2f[] frontAttenuation, - Point2f[] backAttenuation) { + Point2f[] backAttenuation) { this.getDistanceGain(frontAttenuation); this.getBackDistanceGain(backAttenuation); } @@ -233,19 +233,19 @@ class ConeSoundRetained extends PointSoundRetained { * @param backGain array of non-negative scale factors associated with back distances * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph - */ + */ void getDistanceGain(float[] frontDistance, float[] frontGain, - float[] backDistance, float[] backGain) { + float[] backDistance, float[] backGain) { this.getDistanceGain( frontDistance, frontGain); this.getBackDistanceGain( backDistance, backGain); } - /** + /** * Retieves sound's back distance attenuation * Put the contents of the two separate distance and gain arrays into * an array of Point2f. * @param attenuation containing distance attenuation pairs - */ + */ void getBackDistanceGain(Point2f[] attenuation) { // Write into arrays passed in, don't do a new if (attenuation == null) @@ -265,17 +265,17 @@ class ConeSoundRetained extends PointSoundRetained { } } - /** - * Retieves this sound's back attenuation distance and gain arrays, + /** + * Retieves this sound's back attenuation distance and gain arrays, * returned in separate arrays. * @param distance array of monotonically-increasing floats. * @param gain array of amplitude scale factors associated with distances. - */ + */ void getBackDistanceGain(float[] distance, float[] gain) { // write into arrays passed in, don't do a new if (distance == null || gain == null) return; - if (this.backAttenuationDistance == null || + if (this.backAttenuationDistance == null || this.backAttenuationGain == null) return; // backAttenuationDistance and backAttenuationGain array length should @@ -308,9 +308,9 @@ class ConeSoundRetained extends PointSoundRetained { if (staticTransform != null) { staticTransform.transform.transform(direction, this.direction); } else { - this.direction.set(direction); + this.direction.set(direction); } - dispatchAttribChange(DIRECTION_DIRTY_BIT, + dispatchAttribChange(DIRECTION_DIRTY_BIT, (new Vector3f(this.direction))); if (source != null && source.isLive()) { @@ -330,7 +330,7 @@ class ConeSoundRetained extends PointSoundRetained { direction.z = z; if (staticTransform != null) { staticTransform.transform.transform(direction); - } + } dispatchAttribChange(DIRECTION_DIRTY_BIT, (new Vector3f(direction))); if (source != null && source.isLive()) { @@ -366,10 +366,10 @@ class ConeSoundRetained extends PointSoundRetained { // // *************************** - /** + /** * Sets this sound's angular gain attenuation (not including filter) * @param attenuation array containing angular distance and gain - */ + */ void setAngularAttenuation(Point2f[] attenuation) { int attenuationLength = 0; this.filterType = NO_FILTERING; @@ -392,11 +392,11 @@ class ConeSoundRetained extends PointSoundRetained { } } // lengths not zero } // arrays not null - Point3f [] attenuation3f = new Point3f[attenuationLength]; - for (int i=0; i<attenuationLength; i++) { + Point3f [] attenuation3f = new Point3f[attenuationLength]; + for (int i=0; i<attenuationLength; i++) { attenuation3f[i] = new Point3f(this.angularDistance[i], - this.angularGain[i], - Sound.NO_FILTER); + this.angularGain[i], + Sound.NO_FILTER); } dispatchAttribChange(ANGULAR_ATTENUATION_DIRTY_BIT, attenuation3f); @@ -405,10 +405,10 @@ class ConeSoundRetained extends PointSoundRetained { } } - /** + /** * Sets this sound's angular attenuation including both gain and filter. * @param attenuation array containing angular distance, gain and filter - */ + */ void setAngularAttenuation(Point3f[] attenuation) { if (attenuation == null) { this.angularDistance = null; @@ -446,7 +446,7 @@ class ConeSoundRetained extends PointSoundRetained { * Sets angular attenuation including gain and filter using separate arrays * @param distance array containing angular distance * @param filter array containing angular low-pass frequency cutoff values - */ + */ void setAngularAttenuation(float[] distance, float[] gain, float[] filter) { int distanceLength = 0; if (distance == null || gain == null || filter == null) { @@ -480,7 +480,7 @@ class ConeSoundRetained extends PointSoundRetained { /** * Extend gain array to length of distance array by * replicate last gain values. - */ + */ for (int i=gainLength; i< distanceLength; i++) { this.angularGain[i] = gain[gainLength - 1]; } @@ -528,19 +528,19 @@ class ConeSoundRetained extends PointSoundRetained { * All arrays are forced to same size * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph - */ + */ int getAngularAttenuationLength() { if (angularDistance == null) return 0; - else + else return (this.angularDistance.length); } - + /** * Retrieves angular attenuation including gain and filter in a single array * @param attenuation applied to gain when listener is between cones - */ + */ void getAngularAttenuation(Point3f[] attenuation) { /// use attenuation array allocated by user - don't new it // The three angular attenuation arrays length should be the same @@ -562,12 +562,12 @@ class ConeSoundRetained extends PointSoundRetained { } /** - * Retrieves angular attenuation including gain and filter + * Retrieves angular attenuation including gain and filter * returned as separate arrays * @param distance array containing angular distance * @param gain array containing angular gain attenuation * @param filter array containing angular low-pass frequency cutoff values - */ + */ void getAngularAttenuation(float[] distance, float[] gain, float[] filter) { // use attenuation array allocated by user - don't new it if (distance == null || gain == null || filter == null) @@ -593,7 +593,7 @@ class ConeSoundRetained extends PointSoundRetained { filterLength = filter.length; } if (filterType == NO_FILTERING || this.frequencyCutoff == null) { - for (int i=0; i< filterLength; i++) + for (int i=0; i< filterLength; i++) filter[i] = Sound.NO_FILTER; } if (filterType == LOW_PASS) { @@ -602,18 +602,18 @@ class ConeSoundRetained extends PointSoundRetained { } - /** + /** * This updates the Direction fields of cone sound. * * Neither Angular gain Attenuation and Filtering fields, nor * back distance gain not maintained in mirror object - */ + */ void updateMirrorObject(Object[] objs) { if (debugFlag) debugPrint("PointSoundRetained:updateMirrorObj()"); Transform3D trans = null; int component = ((Integer)objs[1]).intValue(); - int numSnds = ((Integer)objs[2]).intValue(); + int numSnds = ((Integer)objs[2]).intValue(); SoundRetained[] mSnds = (SoundRetained[]) objs[3]; if (component == -1) { // update every field @@ -621,7 +621,7 @@ class ConeSoundRetained extends PointSoundRetained { return; } if ((component & DIRECTION_DIRTY_BIT) != 0) { - for (int i = 0; i < numSnds; i++) { + for (int i = 0; i < numSnds; i++) { ConeSoundRetained cone = (ConeSoundRetained)mSnds[i]; cone.direction = (Vector3f)objs[4]; cone.getLastLocalToVworld().transform(cone.direction, @@ -646,12 +646,12 @@ class ConeSoundRetained extends PointSoundRetained { super.updateTransformChange(); lastLocalToVworld.transform(direction, xformDirection); xformDirection.normalize(); - // set flag looked at by Scheduler to denote Transform change - // this flag will force resneding transformed direction to AudioDevice - if (debugFlag) + // set flag looked at by Scheduler to denote Transform change + // this flag will force resneding transformed direction to AudioDevice + if (debugFlag) debugPrint("ConeSound xformDirection is (" + xformDirection.x + ", " - + xformDirection.y + ", "+ xformDirection.z + ")"); - } + + xformDirection.y + ", "+ xformDirection.z + ")"); + } void mergeTransform(TransformGroupRetained xform) { super.mergeTransform(xform); diff --git a/src/classes/share/javax/media/j3d/DefaultRenderMethod.java b/src/classes/share/javax/media/j3d/DefaultRenderMethod.java index 9a5aa6d..9cb0555 100644 --- a/src/classes/share/javax/media/j3d/DefaultRenderMethod.java +++ b/src/classes/share/javax/media/j3d/DefaultRenderMethod.java @@ -45,14 +45,14 @@ class DefaultRenderMethod implements RenderMethod { */ public boolean render(RenderMolecule rm, Canvas3D cv, RenderAtomListInfo ra, int dirtyBits) { - + boolean isVisible = false; // True if any of the RAs is visible. - + while (ra != null) { if (cv.ra == ra.renderAtom) { if (cv.raIsVisible) { cv.updateState(dirtyBits); - ra.geometry().execute(cv, ra.renderAtom, + ra.geometry().execute(cv, ra.renderAtom, rm.isNonUniformScale, rm.useAlpha, rm.alpha, cv.screen.screen, @@ -80,11 +80,11 @@ class DefaultRenderMethod implements RenderMethod { } ra = ra.next; } - + return isVisible; - + } - - + + } diff --git a/src/classes/share/javax/media/j3d/DepthComponent.java b/src/classes/share/javax/media/j3d/DepthComponent.java index a32f0c0..2f81fbe 100644 --- a/src/classes/share/javax/media/j3d/DepthComponent.java +++ b/src/classes/share/javax/media/j3d/DepthComponent.java @@ -55,7 +55,7 @@ public abstract class DepthComponent extends NodeComponent { ALLOW_SIZE_READ, ALLOW_DATA_READ }; - + /** * default constructor */ @@ -90,5 +90,5 @@ public abstract class DepthComponent extends NodeComponent { return ((DepthComponentRetained)this.retained).getHeight(); } - + } diff --git a/src/classes/share/javax/media/j3d/DepthComponentFloat.java b/src/classes/share/javax/media/j3d/DepthComponentFloat.java index 758c07a..3cd0efa 100644 --- a/src/classes/share/javax/media/j3d/DepthComponentFloat.java +++ b/src/classes/share/javax/media/j3d/DepthComponentFloat.java @@ -46,7 +46,7 @@ public class DepthComponentFloat extends DepthComponent { } /** - * Constructs a new floating-point depth (z-buffer) component object with + * Constructs a new floating-point depth (z-buffer) component object with * the specified width and height. * @param width the width of the array of depth values * @param height the height of the array of depth values @@ -68,7 +68,7 @@ public class DepthComponentFloat extends DepthComponent { /** * Copies the depth data from this object to the specified array. - * The array must be large enough to hold all of the floats. + * The array must be large enough to hold all of the floats. * @param depthData array of floats that will receive a copy of * the depth data * @exception CapabilityNotSetException if appropriate capability is @@ -92,7 +92,7 @@ public class DepthComponentFloat extends DepthComponent { /** - * @deprecated replaced with cloneNodeComponent(boolean forceDuplicate) + * @deprecated replaced with cloneNodeComponent(boolean forceDuplicate) */ public NodeComponent cloneNodeComponent() { DepthComponentFloatRetained rt = (DepthComponentFloatRetained) retained; @@ -108,7 +108,7 @@ public class DepthComponentFloat extends DepthComponent { * the current node. This method is called from the * <code>duplicateNode</code> method. This routine does * the actual duplication of all "local data" (any data defined in - * this object). + * this object). * * @param originalNodeComponent the original node to duplicate. * @param forceDuplicate when set to <code>true</code>, causes the @@ -120,8 +120,8 @@ public class DepthComponentFloat extends DepthComponent { * @see Node#cloneTree * @see NodeComponent#setDuplicateOnCloneTree */ - void duplicateAttributes(NodeComponent originalNodeComponent, - boolean forceDuplicate) { + void duplicateAttributes(NodeComponent originalNodeComponent, + boolean forceDuplicate) { super.duplicateAttributes(originalNodeComponent, forceDuplicate); // width, height is copied in cloneNode before diff --git a/src/classes/share/javax/media/j3d/DepthComponentFloatRetained.java b/src/classes/share/javax/media/j3d/DepthComponentFloatRetained.java index 1d83d3f..6c2e79e 100644 --- a/src/classes/share/javax/media/j3d/DepthComponentFloatRetained.java +++ b/src/classes/share/javax/media/j3d/DepthComponentFloatRetained.java @@ -42,7 +42,7 @@ class DepthComponentFloatRetained extends DepthComponentRetained { float depthData[]; /** - * Constructs a new floating-point depth (z-buffer) component object with + * Constructs a new floating-point depth (z-buffer) component object with * the specified width and height. * @param width the width of the array of depth values * @param height the height of the array of depth values @@ -81,7 +81,7 @@ class DepthComponentFloatRetained extends DepthComponentRetained { */ final void retrieveDepth(float[] buf, int wRead, int hRead) { int srcOffset, dstOffset, i; - + // Yup -> Ydown for (srcOffset = (hRead - 1) * wRead, dstOffset = 0, i = 0; i < hRead; i++, diff --git a/src/classes/share/javax/media/j3d/DepthComponentInt.java b/src/classes/share/javax/media/j3d/DepthComponentInt.java index b1a8613..bf975cc 100644 --- a/src/classes/share/javax/media/j3d/DepthComponentInt.java +++ b/src/classes/share/javax/media/j3d/DepthComponentInt.java @@ -67,7 +67,7 @@ public class DepthComponentInt extends DepthComponent { /** * Copies the depth data from this object to the specified array. - * The array must be large enough to hold all of the ints. + * The array must be large enough to hold all of the ints. * @param depthData array of ints that will receive a copy of * the depth data * @exception CapabilityNotSetException if appropriate capability is @@ -91,7 +91,7 @@ public class DepthComponentInt extends DepthComponent { /** - * @deprecated replaced with cloneNodeComponent(boolean forceDuplicate) + * @deprecated replaced with cloneNodeComponent(boolean forceDuplicate) */ public NodeComponent cloneNodeComponent() { DepthComponentIntRetained rt = (DepthComponentIntRetained) retained; @@ -101,13 +101,13 @@ public class DepthComponentInt extends DepthComponent { return d; } - + /** * Copies all node information from <code>originalNodeComponent</code> into * the current node. This method is called from the * <code>duplicateNode</code> method. This routine does * the actual duplication of all "local data" (any data defined in - * this object). + * this object). * * @param originalNodeComponent the original node to duplicate. * @param forceDuplicate when set to <code>true</code>, causes the @@ -120,9 +120,9 @@ public class DepthComponentInt extends DepthComponent { * @see NodeComponent#setDuplicateOnCloneTree */ void duplicateAttributes(NodeComponent originalNodeComponent, - boolean forceDuplicate) { + boolean forceDuplicate) { super.duplicateAttributes(originalNodeComponent, forceDuplicate); - + // width, height is copied in cloneNode before int len = getWidth()*getHeight(); int d[] = new int[len]; diff --git a/src/classes/share/javax/media/j3d/DepthComponentIntRetained.java b/src/classes/share/javax/media/j3d/DepthComponentIntRetained.java index d0b0586..0fcb254 100644 --- a/src/classes/share/javax/media/j3d/DepthComponentIntRetained.java +++ b/src/classes/share/javax/media/j3d/DepthComponentIntRetained.java @@ -71,7 +71,7 @@ class DepthComponentIntRetained extends DepthComponentRetained { */ void getDepthData(int[] depthData) { int i; - + for (i = 0; i < this.depthData.length; i++) depthData[i] = this.depthData[i]; } @@ -81,13 +81,13 @@ class DepthComponentIntRetained extends DepthComponentRetained { */ final void retrieveDepth(int[] buf, int wRead, int hRead) { int srcOffset, dstOffset, i; - + // Yup -> Ydown for (srcOffset = (hRead - 1) * wRead, dstOffset = 0, i = 0; i < hRead; i++, srcOffset -= wRead, dstOffset += width) { - + System.arraycopy(buf, srcOffset, depthData, dstOffset, wRead); } - } + } } diff --git a/src/classes/share/javax/media/j3d/DepthComponentNative.java b/src/classes/share/javax/media/j3d/DepthComponentNative.java index 34cbb9f..4d5b05e 100644 --- a/src/classes/share/javax/media/j3d/DepthComponentNative.java +++ b/src/classes/share/javax/media/j3d/DepthComponentNative.java @@ -90,13 +90,13 @@ public class DepthComponentNative extends DepthComponent { return d; } - + /** * Copies all node information from <code>originalNodeComponent</code> into * the current node. This method is called from the * <code>duplicateNode</code> method. This routine does * the actual duplication of all "local data" (any data defined in - * this object). + * this object). * * @param originalNodeComponent the original node to duplicate. * @param forceDuplicate when set to <code>true</code>, causes the @@ -110,9 +110,9 @@ public class DepthComponentNative extends DepthComponent { * @see NodeComponent#setDuplicateOnCloneTree */ void duplicateAttributes(NodeComponent originalNodeComponent, - boolean forceDuplicate) { + boolean forceDuplicate) { super.duplicateAttributes(originalNodeComponent, forceDuplicate); - + int originalData[] = ((DepthComponentNativeRetained) originalNodeComponent.retained).depthData; diff --git a/src/classes/share/javax/media/j3d/DepthComponentNativeRetained.java b/src/classes/share/javax/media/j3d/DepthComponentNativeRetained.java index 3f7460a..aab53cf 100644 --- a/src/classes/share/javax/media/j3d/DepthComponentNativeRetained.java +++ b/src/classes/share/javax/media/j3d/DepthComponentNativeRetained.java @@ -49,9 +49,9 @@ class DepthComponentNativeRetained extends DepthComponentRetained { */ void initialize(int width, int height) { type = DEPTH_COMPONENT_TYPE_NATIVE; - depthData = new int[width * height]; - this.width = width; - this.height = height; + depthData = new int[width * height]; + this.width = width; + this.height = height; } /** @@ -70,13 +70,13 @@ class DepthComponentNativeRetained extends DepthComponentRetained { */ final void retrieveDepth(int[] buf, int wRead, int hRead) { int srcOffset, dstOffset, i; - + // Yup -> Ydown for (srcOffset = (hRead - 1) * wRead, dstOffset = 0, i = 0; i < hRead; i++, srcOffset -= wRead, dstOffset += width) { - + System.arraycopy(buf, srcOffset, depthData, dstOffset, wRead); } - } + } } diff --git a/src/classes/share/javax/media/j3d/DirectionalLight.java b/src/classes/share/javax/media/j3d/DirectionalLight.java index 382c08e..99def5d 100644 --- a/src/classes/share/javax/media/j3d/DirectionalLight.java +++ b/src/classes/share/javax/media/j3d/DirectionalLight.java @@ -38,7 +38,7 @@ import javax.vecmath.Vector3f; * A DirectionalLight node defines an oriented light with an origin at * infinity. It has the same attributes as a Light node, with the * addition of a directional vector to specify the direction in which the - * light shines. A directional light has parallel light rays that travel + * light shines. A directional light has parallel light rays that travel * in one direction along the specified vector. Directional light contributes * to diffuse and specular reflections, which in turn depend on the * orientation of an object's surface but not its position. A directional @@ -64,7 +64,7 @@ public class DirectionalLight extends Light { private static final int[] readCapabilities = { ALLOW_DIRECTION_READ }; - + /** * Constructs a DirectionalLight node with default parameters. * The default values are as follows: @@ -116,7 +116,7 @@ public class DirectionalLight extends Light { this.retained = new DirectionalLightRetained(); this.retained.setSource(this); } - + /** * Set light direction. * @param direction the new direction @@ -129,7 +129,7 @@ public class DirectionalLight extends Light { throw new CapabilityNotSetException( J3dI18N.getString("DirectionalLight0")); - if (isLive()) + if (isLive()) ((DirectionalLightRetained)this.retained).setDirection(direction); else ((DirectionalLightRetained)this.retained).initDirection(direction); @@ -196,7 +196,7 @@ public class DirectionalLight extends Light { * <code>originalNode</code> into * the current node. This method is called from the * <code>cloneNode</code> method which is, in turn, called by the - * <code>cloneTree</code> method.<P> + * <code>cloneTree</code> method.<P> * * @param originalNode the original node to duplicate. * @param forceDuplicate when set to <code>true</code>, causes the @@ -214,7 +214,7 @@ public class DirectionalLight extends Light { */ void duplicateAttributes(Node originalNode, boolean forceDuplicate) { super.duplicateAttributes(originalNode, forceDuplicate); - + Vector3f v = new Vector3f(); ((DirectionalLightRetained) originalNode.retained).getDirection(v); ((DirectionalLightRetained) retained).initDirection(v); diff --git a/src/classes/share/javax/media/j3d/DirectionalLightRetained.java b/src/classes/share/javax/media/j3d/DirectionalLightRetained.java index 798d3c3..98bf8a4 100644 --- a/src/classes/share/javax/media/j3d/DirectionalLightRetained.java +++ b/src/classes/share/javax/media/j3d/DirectionalLightRetained.java @@ -142,8 +142,8 @@ class DirectionalLightRetained extends LightRetained VirtualUniverse.mc.processMessage(createMessage); } - - /** + + /** * This update function, and its native counterpart, * updates a directional light. This includes its * color and its transformed direction. @@ -155,16 +155,16 @@ class DirectionalLightRetained extends LightRetained int component = ((Integer)objs[1]).intValue(); Transform3D trans; int numLgts = ((Integer)objs[2]).intValue(); - - LightRetained[] mLgts = (LightRetained[]) objs[3]; + + LightRetained[] mLgts = (LightRetained[]) objs[3]; DirectionalLightRetained ml; if ((component & DIRECTION_CHANGED) != 0) { - + for (i = 0; i < numLgts; i++) { if (mLgts[i].nodeType == NodeRetained.DIRECTIONALLIGHT) { ml = (DirectionalLightRetained) mLgts[i]; ml.direction = (Vector3f)objs[4]; - ml.getLastLocalToVworld().transform(ml.direction, + ml.getLastLocalToVworld().transform(ml.direction, ml.xformDirection); ml.xformDirection.normalize(); } @@ -176,7 +176,7 @@ class DirectionalLightRetained extends LightRetained if (mLgts[i].nodeType == NodeRetained.DIRECTIONALLIGHT) { ml = (DirectionalLightRetained) mLgts[i]; ml.direction = (Vector3f)((Object[])objs[4])[7]; - ml.getLastLocalToVworld().transform(ml.direction, + ml.getLastLocalToVworld().transform(ml.direction, ml.xformDirection); ml.xformDirection.normalize(); } @@ -186,8 +186,8 @@ class DirectionalLightRetained extends LightRetained super.updateMirrorObject(objs); } - - void update(Context ctx, int lightSlot, double scale) { + + void update(Context ctx, int lightSlot, double scale) { Pipeline.getPipeline().updateDirectionalLight(ctx, lightSlot, color.x, color.y, color.z, xformDirection.x, xformDirection.y, @@ -201,9 +201,9 @@ class DirectionalLightRetained extends LightRetained dr.direction = new Vector3f(direction); dr.xformDirection = new Vector3f(0.0f, 0.0f, -1.0f); return dr; - } + } + - // Called on the mirror object void updateTransformChange() { super.updateTransformChange(); diff --git a/src/classes/share/javax/media/j3d/DisplayListRenderMethod.java b/src/classes/share/javax/media/j3d/DisplayListRenderMethod.java index da7ac50..521ca23 100644 --- a/src/classes/share/javax/media/j3d/DisplayListRenderMethod.java +++ b/src/classes/share/javax/media/j3d/DisplayListRenderMethod.java @@ -54,35 +54,35 @@ class DisplayListRenderMethod implements RenderMethod { public boolean render(RenderMolecule rm, Canvas3D cv, RenderAtomListInfo ra, int dirtyBits) { - - if (rm.doInfinite || + + if (rm.doInfinite || !VirtualUniverse.mc.viewFrustumCulling || rm.vwcBounds.intersect(cv.viewFrustum)) { cv.updateState(dirtyBits); cv.callDisplayList(cv.ctx, rm.displayListId, rm.isNonUniformScale); return true; - } + } return false; } - public boolean renderSeparateDlists(RenderMolecule rm, + public boolean renderSeparateDlists(RenderMolecule rm, Canvas3D cv, RenderAtomListInfo r, int dirtyBits) { - + if (rm.doInfinite) { cv.updateState(dirtyBits); while (r != null) { - cv.callDisplayList(cv.ctx, + cv.callDisplayList(cv.ctx, ((GeometryArrayRetained)r.geometry()).dlistId, rm.isNonUniformScale); r = r.next; } - + return true; } - - boolean isVisible = false; // True if any of the RAs is visible. + + boolean isVisible = false; // True if any of the RAs is visible. while (r != null) { if (cv.ra == r.renderAtom) { if (cv.raIsVisible) { @@ -97,7 +97,7 @@ class DisplayListRenderMethod implements RenderMethod { if (r.renderAtom.localeVwcBounds.intersect(cv.viewFrustum)) { cv.updateState(dirtyBits); cv.raIsVisible = true; - cv.callDisplayList(cv.ctx, + cv.callDisplayList(cv.ctx, ((GeometryArrayRetained)r.geometry()).dlistId, rm.isNonUniformScale); isVisible = true; @@ -109,13 +109,13 @@ class DisplayListRenderMethod implements RenderMethod { } r = r.next; } - + return isVisible; } - - public boolean renderSeparateDlistPerRinfo(RenderMolecule rm, + + public boolean renderSeparateDlistPerRinfo(RenderMolecule rm, Canvas3D cv, RenderAtomListInfo r, int dirtyBits) { @@ -129,7 +129,7 @@ class DisplayListRenderMethod implements RenderMethod { } return true; } - boolean isVisible = false; // True if any of the RAs is visible. + boolean isVisible = false; // True if any of the RAs is visible. while (r != null) { if (cv.ra == r.renderAtom) { if (cv.raIsVisible) { @@ -155,11 +155,11 @@ class DisplayListRenderMethod implements RenderMethod { r = r.next; } return isVisible; - + } - + void buildDisplayList(RenderMolecule rm, Canvas3D cv) { RenderAtomListInfo ra; @@ -182,10 +182,10 @@ class DisplayListRenderMethod implements RenderMethod { staticTransform = null; staticNormalTransform = null; } else { - staticTransform = + staticTransform = ra.renderAtom.geometryAtom.source.staticTransform.transform; if ((geo.vertexFormat & GeometryArray.NORMALS) != 0) { - staticNormalTransform = + staticNormalTransform = ra.renderAtom.geometryAtom.source.staticTransform.getNormalTransform(); } else { staticNormalTransform = null; @@ -204,12 +204,12 @@ class DisplayListRenderMethod implements RenderMethod { } } - void buildIndividualDisplayList(RenderAtomListInfo ra, Canvas3D cv, + void buildIndividualDisplayList(RenderAtomListInfo ra, Canvas3D cv, Context ctx) { GeometryArrayRetained geo; geo = (GeometryArrayRetained)ra.geometry(); - if ((geo.texCoordSetMap != null) && + if ((geo.texCoordSetMap != null) && (geo.texCoordSetMap.length > cv.maxTexCoordSets)) { return; } @@ -224,7 +224,7 @@ class DisplayListRenderMethod implements RenderMethod { geo.buildGA(cv, ra.renderAtom, false, false, 1.0f, - false, + false, null, null); cv.endDisplayList(ctx); } @@ -236,7 +236,7 @@ class DisplayListRenderMethod implements RenderMethod { Transform3D staticTransform; Transform3D staticNormalTransform; int id; - + geo = (GeometryArrayRetained)ra.geometry(); if ((rm.primaryRenderAtomList != null) && (rm.texCoordSetMapLen <= cv.maxTexCoordSets)) { @@ -248,10 +248,10 @@ class DisplayListRenderMethod implements RenderMethod { staticTransform = null; staticNormalTransform = null; } else { - staticTransform = + staticTransform = ra.renderAtom.geometryAtom.source.staticTransform.transform; if ((geo.vertexFormat & GeometryArray.NORMALS) != 0) { - staticNormalTransform = + staticNormalTransform = ra.renderAtom.geometryAtom.source.staticTransform.getNormalTransform(); } else { staticNormalTransform = null; @@ -269,5 +269,5 @@ class DisplayListRenderMethod implements RenderMethod { } } - + } diff --git a/src/classes/share/javax/media/j3d/DistanceLOD.java b/src/classes/share/javax/media/j3d/DistanceLOD.java index cd193b5..59ecb9e 100644 --- a/src/classes/share/javax/media/j3d/DistanceLOD.java +++ b/src/classes/share/javax/media/j3d/DistanceLOD.java @@ -70,7 +70,7 @@ public class DistanceLOD extends LOD { /** * Constructs and initializes a DistanceLOD node with default values. - * Note that the default constructor creates a DistanceLOD object with + * Note that the default constructor creates a DistanceLOD object with * a single distance value set to 0.0 and is, therefore, not useful. */ public DistanceLOD() { @@ -169,7 +169,7 @@ public class DistanceLOD extends LOD { */ public void initialize() { // Insert wakeup condition into queue - wakeupOn(wakeupFrame); + wakeupOn(wakeupFrame); } /** @@ -183,7 +183,7 @@ public class DistanceLOD extends LOD { // compute distance in virtual world View v = this.getView(); if( v == null ) { - wakeupOn(wakeupFrame); + wakeupOn(wakeupFrame); return; } @@ -195,41 +195,41 @@ public class DistanceLOD extends LOD { // Handle stimulus double viewDistance = 0.0; int nSwitches,i,index=0; - - Transform3D localToWorldTrans = new Transform3D(); - + + Transform3D localToWorldTrans = new Transform3D(); + localToWorldTrans.set(((NodeRetained)this.retained).getCurrentLocalToVworld()); - - - // DistanceLOD's location in virutal world - localToWorldTrans.transform( position, center); - - + + + // DistanceLOD's location in virutal world + localToWorldTrans.transform( position, center); + + viewPosition.x = (float)((ViewPlatformRetained)vp.retained).schedSphere.center.x; viewPosition.y = (float)((ViewPlatformRetained)vp.retained).schedSphere.center.y; viewPosition.z = (float)((ViewPlatformRetained)vp.retained).schedSphere.center.z; viewDistance = center.distance( viewPosition); - + // convert distance into local coordinates viewDistance = viewDistance/localToWorldTrans.getDistanceScale(); - + nSwitches = numSwitches(); - + index = distances.length; // viewDistance > distances[n-1] - + if( viewDistance <= distances[0] ) { index = 0; } else { for (i=1; i < distances.length; i++) { - if ((viewDistance > distances[i-1]) && + if ((viewDistance > distances[i-1]) && (viewDistance <= distances[i])) { index = i; break; } } } - + for(i=nSwitches-1; i>=0; i--) { Switch sw = getSwitch(i); // Optimize, this behavior is passive @@ -240,8 +240,8 @@ public class DistanceLOD extends LOD { } } // Insert wakeup condition into queue - wakeupOn(wakeupFrame); - + wakeupOn(wakeupFrame); + } /** @@ -270,7 +270,7 @@ public class DistanceLOD extends LOD { * <code>originalNode</code> into * the current node. This method is called from the * <code>cloneNode</code> method which is, in turn, called by the - * <code>cloneTree</code> method.<P> + * <code>cloneTree</code> method.<P> * * @param originalNode the original node to duplicate. * @param forceDuplicate when set to <code>true</code>, causes the diff --git a/src/classes/share/javax/media/j3d/DrawingSurfaceObjectAWT.java b/src/classes/share/javax/media/j3d/DrawingSurfaceObjectAWT.java index 9047b2d..4197da2 100644 --- a/src/classes/share/javax/media/j3d/DrawingSurfaceObjectAWT.java +++ b/src/classes/share/javax/media/j3d/DrawingSurfaceObjectAWT.java @@ -34,12 +34,12 @@ package javax.media.j3d; import java.awt.Point; /** - * The DrawingSurfaceObject class is used to manage native drawing surface + * The DrawingSurfaceObject class is used to manage native drawing surface */ class DrawingSurfaceObjectAWT extends DrawingSurfaceObject { - // drawing surface + // drawing surface private long nativeDS = 0; private long dsi = 0; @@ -81,7 +81,7 @@ class DrawingSurfaceObjectAWT extends DrawingSurfaceObject { if (nativeDS == 0) { return false; } else { - if (lockAWT(nativeDS)) { + if (lockAWT(nativeDS)) { gotDsiLock = true; return true; } else { @@ -104,12 +104,12 @@ class DrawingSurfaceObjectAWT extends DrawingSurfaceObject { gotDsiLock = false; if (doLastUnlock) { nativeDS = 0; - dsi = 0; + dsi = 0; doLastUnlock = false; } } } else { - unlockGlobal(nativeAWT); + unlockGlobal(nativeAWT); gotDsiLock = false; } } @@ -166,5 +166,5 @@ class DrawingSurfaceObjectAWT extends DrawingSurfaceObject { long getDS() { return nativeDS; } - + } diff --git a/src/classes/share/javax/media/j3d/EnvironmentSet.java b/src/classes/share/javax/media/j3d/EnvironmentSet.java index ff8ffa2..4e495b8 100644 --- a/src/classes/share/javax/media/j3d/EnvironmentSet.java +++ b/src/classes/share/javax/media/j3d/EnvironmentSet.java @@ -62,7 +62,7 @@ class EnvironmentSet extends Object implements ObjectUpdate{ /** - * The arraylist of ambient lights in this env list + * The arraylist of ambient lights in this env list */ ArrayList ambLights = new ArrayList(); @@ -111,7 +111,7 @@ class EnvironmentSet extends Object implements ObjectUpdate{ EnvironmentSet next = null; EnvironmentSet prev = null; - /** + /** * List of attrributeBins to be added next Frame */ ArrayList addAttributeBins = new ArrayList(); @@ -137,13 +137,13 @@ class EnvironmentSet extends Object implements ObjectUpdate{ */ AttributeBin attributeBinList = null; - EnvironmentSet(RenderAtom ra, LightRetained[] lightList, FogRetained fog, + EnvironmentSet(RenderAtom ra, LightRetained[] lightList, FogRetained fog, ModelClipRetained modelClip, RenderBin rb) { renderBin = rb; reset(ra, lightList, fog, modelClip); } - private void reset(RenderAtom ra, LightRetained[] lightList, FogRetained fog, + private void reset(RenderAtom ra, LightRetained[] lightList, FogRetained fog, ModelClipRetained modelClip) { int i; LightRetained light; @@ -187,7 +187,7 @@ class EnvironmentSet extends Object implements ObjectUpdate{ enableMCMaskCache = 0; if (modelClip != null) { for (i = 0; i < 6; i++) { - if (modelClip.enables[i]) + if (modelClip.enables[i]) enableMCMaskCache |= 1 << i; } enableMCMask = enableMCMaskCache; @@ -204,11 +204,11 @@ class EnvironmentSet extends Object implements ObjectUpdate{ lightList[i].environmentSets.add(this); } } - + if (fog != null) { fog.environmentSets.add(this); } - + if (modelClip != null) { modelClip.environmentSets.add(this); } @@ -217,7 +217,7 @@ class EnvironmentSet extends Object implements ObjectUpdate{ /** * This tests if the qiven lights and fog match this EnviornmentSet */ - boolean equals(RenderAtom ra, LightRetained[] lights, FogRetained fog, + boolean equals(RenderAtom ra, LightRetained[] lights, FogRetained fog, ModelClipRetained modelClip) { int i; @@ -334,13 +334,13 @@ class EnvironmentSet extends Object implements ObjectUpdate{ if ((canvasDirty & Canvas3D.AMBIENTLIGHT_DIRTY) != 0) { updateSceneAmbient(); - } + } - if ((canvasDirty & Canvas3D.LIGHTENABLES_DIRTY) != 0) { + if ((canvasDirty & Canvas3D.LIGHTENABLES_DIRTY) != 0) { enableMask = enableMaskCache; } - if ((canvasDirty & Canvas3D.MODELCLIP_DIRTY) != 0) { + if ((canvasDirty & Canvas3D.MODELCLIP_DIRTY) != 0) { enableMCMask = enableMCMaskCache; } @@ -413,7 +413,7 @@ class EnvironmentSet extends Object implements ObjectUpdate{ } } - void updateSceneAmbient() + void updateSceneAmbient() { int i; sceneAmbient.x = 0.0f; @@ -481,35 +481,35 @@ class EnvironmentSet extends Object implements ObjectUpdate{ if (cv.modelClip != modelClip) { updateModelClip = true; } - } + } // Check for dirtybit. - if ((cv.canvasDirty & (Canvas3D.LIGHTENABLES_DIRTY| + if ((cv.canvasDirty & (Canvas3D.LIGHTENABLES_DIRTY| Canvas3D.AMBIENTLIGHT_DIRTY| Canvas3D.FOG_DIRTY| Canvas3D.MODELCLIP_DIRTY| Canvas3D.VIEW_MATRIX_DIRTY)) != 0) { - + if ((cv.canvasDirty & Canvas3D.LIGHTENABLES_DIRTY) != 0) { updateLightEnables = true; } - + if ((cv.canvasDirty & Canvas3D.AMBIENTLIGHT_DIRTY) != 0) { updateSceneAmbient = true; } - + if ((cv.canvasDirty & Canvas3D.FOG_DIRTY) != 0) { updateFog = true; } - + if ((cv.canvasDirty & Canvas3D.MODELCLIP_DIRTY) != 0) { updateModelClip = true; } - if ((cv.canvasDirty & Canvas3D.VIEW_MATRIX_DIRTY) != 0) { + if ((cv.canvasDirty & Canvas3D.VIEW_MATRIX_DIRTY) != 0) { updateFog = true; updateModelClip = true; - } + } } // do states update here. @@ -550,8 +550,8 @@ class EnvironmentSet extends Object implements ObjectUpdate{ Canvas3D.FOG_DIRTY | Canvas3D.MODELCLIP_DIRTY | Canvas3D.VIEW_MATRIX_DIRTY); - + cv.environmentSet = this; - + } } diff --git a/src/classes/share/javax/media/j3d/EventCatcher.java b/src/classes/share/javax/media/j3d/EventCatcher.java index 6d5daea..86b26dd 100644 --- a/src/classes/share/javax/media/j3d/EventCatcher.java +++ b/src/classes/share/javax/media/j3d/EventCatcher.java @@ -106,8 +106,8 @@ class EventCatcher extends Object implements ComponentListener, FocusListener, } } } - - + + void enableMouseEvents() { if (!mouseEvents) { @@ -236,7 +236,7 @@ class EventCatcher extends Object implements ComponentListener, FocusListener, canvas.sendEventToBehaviorScheduler(e); if (VirtualUniverse.mc.isD3D() && - e.isAltDown() && + e.isAltDown() && (e.getKeyCode() == KeyEvent.VK_ENTER)) { canvas.notifyD3DPeer(Canvas3D.TOGGLEFULLSCREEN); } @@ -290,7 +290,7 @@ class EventCatcher extends Object implements ComponentListener, FocusListener, } public void mouseExited(MouseEvent e) { - if (mouseEvents) + if (mouseEvents) canvas.sendEventToBehaviorScheduler(e); if (DEBUG) { System.err.println(e); @@ -314,7 +314,7 @@ class EventCatcher extends Object implements ComponentListener, FocusListener, } public void mouseDragged(MouseEvent e) { - // Note : We don't have to test for mouseMotionEvent here because + // Note : We don't have to test for mouseMotionEvent here because // this routine will never be called unless mouseMotionEvent is enabled. canvas.sendEventToBehaviorScheduler(e); if (DEBUG) { @@ -323,16 +323,16 @@ class EventCatcher extends Object implements ComponentListener, FocusListener, } public void mouseMoved(MouseEvent e) { - // Note : We don't have to test for mouseMotionEvent here because + // Note : We don't have to test for mouseMotionEvent here because // this routine will never be called unless mouseMotionEvent is enabled. canvas.sendEventToBehaviorScheduler(e); if (DEBUG) { System.err.println(e); } } - + public void mouseWheelMoved(MouseWheelEvent e) { - // Note : We don't have to test for mouseWheelEvent here because + // Note : We don't have to test for mouseWheelEvent here because // this routine will never be called unless mouseWheelEvent is enabled. canvas.sendEventToBehaviorScheduler(e); if (DEBUG) { @@ -402,16 +402,16 @@ class EventCatcher extends Object implements ComponentListener, FocusListener, canvas.sendEventToBehaviorScheduler(e); canvas.evaluateVisiblilty(); } - + void reset() { focusEvents = false; keyEvents = false; mouseEvents = false; mouseMotionEvents = false; mouseWheelEvents = false; - mouseListenerAdded = false; + mouseListenerAdded = false; stopped = false; } - + } diff --git a/src/classes/share/javax/media/j3d/ExponentialFog.java b/src/classes/share/javax/media/j3d/ExponentialFog.java index 27d0a60..f56d58b 100644 --- a/src/classes/share/javax/media/j3d/ExponentialFog.java +++ b/src/classes/share/javax/media/j3d/ExponentialFog.java @@ -45,7 +45,7 @@ import javax.vecmath.Color3f; * where * <ul>z is the distance from the viewpoint.<br> * density is the density of the fog.<P></ul></UL> - * + * * In addition to specifying the fog density, ExponentialFog lets you * specify the fog color, which is represented by R, G, and B * color values, where a color of (0,0,0) represents black. @@ -205,7 +205,7 @@ public class ExponentialFog extends Fog { * <code>originalNode</code> into * the current node. This method is called from the * <code>cloneNode</code> method which is, in turn, called by the - * <code>cloneTree</code> method.<P> + * <code>cloneTree</code> method.<P> * * @param originalNode the original node to duplicate. * @param forceDuplicate when set to <code>true</code>, causes the diff --git a/src/classes/share/javax/media/j3d/ExponentialFogRetained.java b/src/classes/share/javax/media/j3d/ExponentialFogRetained.java index 77d179f..3588451 100644 --- a/src/classes/share/javax/media/j3d/ExponentialFogRetained.java +++ b/src/classes/share/javax/media/j3d/ExponentialFogRetained.java @@ -86,7 +86,7 @@ class ExponentialFogRetained extends FogRetained { void setLive(SetLiveState s) { super.setLive(s); GroupRetained group; - + // Initialize the mirror object, this needs to be done, when // renderBin is not accessing any of the fields J3dMessage createMessage = new J3dMessage(); @@ -116,14 +116,14 @@ class ExponentialFogRetained extends FogRetained { obj[2] = (inBackgroundGroup? Boolean.TRUE:Boolean.FALSE); obj[3] = geometryBackground; obj[4] = new Float(density); - + createMessage.args[4] = obj; VirtualUniverse.mc.processMessage(createMessage); } - - - /** + + + /** * This method and its native counterpart update the native context * fog values. */ @@ -148,22 +148,22 @@ class ExponentialFogRetained extends FogRetained { if ((component & INIT_MIRROR) != 0) { ((ExponentialFogRetained)mirrorFog).density = ((Float)((Object[])objs[4])[4]).floatValue(); - + } // Issue 144: store the local to vworld scale used to transform the density - ((ExponentialFogRetained)mirrorFog).setLocalToVworldScale(getLastLocalToVworld().getDistanceScale()); + ((ExponentialFogRetained)mirrorFog).setLocalToVworldScale(getLastLocalToVworld().getDistanceScale()); super.updateMirrorObject(objs); } - // Clone the retained side only, internal use only + // Clone the retained side only, internal use only protected Object clone() { ExponentialFogRetained efr = (ExponentialFogRetained)super.clone(); - + efr.initDensity(getDensity()); - + return efr; } diff --git a/src/classes/share/javax/media/j3d/Fog.java b/src/classes/share/javax/media/j3d/Fog.java index 06f1a42..e4df45c 100644 --- a/src/classes/share/javax/media/j3d/Fog.java +++ b/src/classes/share/javax/media/j3d/Fog.java @@ -100,9 +100,9 @@ public abstract class Fog extends Leaf { private static final int[] readCapabilities = { ALLOW_INFLUENCING_BOUNDS_READ, ALLOW_COLOR_READ, - ALLOW_SCOPE_READ + ALLOW_SCOPE_READ }; - + /** * Constructs a Fog node with default parameters. The default * values are as follows: @@ -154,7 +154,7 @@ public abstract class Fog extends Leaf { if(!this.getCapability(ALLOW_COLOR_WRITE)) throw new CapabilityNotSetException(J3dI18N.getString("Fog0")); - if (isLive()) + if (isLive()) ((FogRetained)this.retained).setColor(color); else ((FogRetained)this.retained).initColor(color); @@ -173,7 +173,7 @@ public abstract class Fog extends Leaf { if(!this.getCapability(ALLOW_COLOR_WRITE)) throw new CapabilityNotSetException(J3dI18N.getString("Fog0")); - if (isLive()) + if (isLive()) ((FogRetained)this.retained).setColor(r, g, b); else ((FogRetained)this.retained).initColor(r, g, b); @@ -199,25 +199,25 @@ public abstract class Fog extends Leaf { * @param region the bounds that contains the Fog's new influencing region. * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph - */ + */ public void setInfluencingBounds(Bounds region) { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_INFLUENCING_BOUNDS_WRITE)) throw new CapabilityNotSetException(J3dI18N.getString("Fog3")); - if (isLive()) + if (isLive()) ((FogRetained)this.retained).setInfluencingBounds(region); else ((FogRetained)this.retained).initInfluencingBounds(region); } - /** + /** * Retrieves the Fog node's influencing bounds. * @return this Fog's influencing bounds information * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph - */ + */ public Bounds getInfluencingBounds() { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_INFLUENCING_BOUNDS_READ)) @@ -234,7 +234,7 @@ public abstract class Fog extends Leaf { * node's new influencing region. * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph - */ + */ public void setInfluencingBoundingLeaf(BoundingLeaf region) { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_INFLUENCING_BOUNDS_WRITE)) @@ -246,12 +246,12 @@ public abstract class Fog extends Leaf { ((FogRetained)this.retained).initInfluencingBoundingLeaf(region); } - /** + /** * Retrieves the Fog node's influencing bounding leaf. * @return this Fog's influencing bounding leaf information * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph - */ + */ public BoundingLeaf getInfluencingBoundingLeaf() { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_INFLUENCING_BOUNDS_READ)) @@ -279,7 +279,7 @@ public abstract class Fog extends Leaf { if(!this.getCapability(ALLOW_SCOPE_WRITE)) throw new CapabilityNotSetException(J3dI18N.getString("Fog7")); - + if (isLive()) ((FogRetained)this.retained).setScope(scope, index); else @@ -350,7 +350,7 @@ public abstract class Fog extends Leaf { else ((FogRetained)this.retained).initRemoveScope(index); } - + /** * Returns an enumeration of this Fog node's list of scopes. @@ -390,7 +390,7 @@ public abstract class Fog extends Leaf { ((FogRetained)this.retained).initAddScope(scope); } - + /** * Returns the number of nodes in this Fog node's list of scopes. * If this number is 0, then the list of scopes is empty and this @@ -487,7 +487,7 @@ public abstract class Fog extends Leaf { * <code>originalNode</code> into * the current node. This method is called from the * <code>cloneNode</code> method which is, in turn, called by the - * <code>cloneTree</code> method.<P> + * <code>cloneTree</code> method.<P> * * @param originalNode the original node to duplicate. * @param forceDuplicate when set to <code>true</code>, causes the @@ -519,7 +519,7 @@ public abstract class Fog extends Leaf { // this reference will set correctly in updateNodeReferences() callback rt.initAddScope((Group) elm.nextElement()); } - + // this reference will set correctly in updateNodeReferences() callback rt.initInfluencingBoundingLeaf(attr.getInfluencingBoundingLeaf()); } @@ -553,7 +553,7 @@ public abstract class Fog extends Leaf { FogRetained rt = (FogRetained) retained; BoundingLeaf bl = rt.getInfluencingBoundingLeaf(); - + if (bl != null) { Object o = referenceTable.getNewObjectReference(bl); rt.initInfluencingBoundingLeaf((BoundingLeaf) o); diff --git a/src/classes/share/javax/media/j3d/FogRetained.java b/src/classes/share/javax/media/j3d/FogRetained.java index 01d5b54..a8b83e5 100644 --- a/src/classes/share/javax/media/j3d/FogRetained.java +++ b/src/classes/share/javax/media/j3d/FogRetained.java @@ -57,10 +57,10 @@ abstract class FogRetained extends LeafRetained{ /** * The Boundary object defining the lights's region of influence. - */ + */ Bounds regionOfInfluence = null; - /** + /** * The bounding leaf reference */ BoundingLeafRetained boundingLeaf = null; @@ -70,7 +70,7 @@ abstract class FogRetained extends LeafRetained{ */ Vector scopes = new Vector(); - // An int that is set when this fog is changed + // An int that is set when this fog is changed int isDirty = 0xffff; // This is true when this fog is referenced in an immediate mode context @@ -81,7 +81,7 @@ abstract class FogRetained extends LeafRetained{ */ Bounds region = null; - // A reference to the scene graph fog + // A reference to the scene graph fog FogRetained sgFog = null; // The mirror copy of this fog @@ -95,7 +95,7 @@ abstract class FogRetained extends LeafRetained{ boolean isScoped = false; // The object that contains the dynamic HashKey - a string type object - // Used in scoping + // Used in scoping HashKey tempKey = new HashKey(250); /** @@ -157,7 +157,7 @@ abstract class FogRetained extends LeafRetained{ /** * Set the Fog's region of influence. - */ + */ void initInfluencingBounds(Bounds region) { if (region != null) { this.regionOfInfluence = (Bounds) region.clone(); @@ -171,16 +171,16 @@ abstract class FogRetained extends LeafRetained{ /** * Set the Fog's region of influence and send message - */ + */ void setInfluencingBounds(Bounds region) { initInfluencingBounds(region); - sendMessage(BOUNDS_CHANGED, + sendMessage(BOUNDS_CHANGED, (region != null ? region.clone() : null)); } - /** + /** * Get the Fog's region of Influence. - */ + */ Bounds getInfluencingBounds() { Bounds b = null; if (regionOfInfluence != null) { @@ -195,7 +195,7 @@ abstract class FogRetained extends LeafRetained{ /** * Set the Fog's region of influence to the specified Leaf node. - */ + */ void initInfluencingBoundingLeaf(BoundingLeaf region) { if (region != null) { boundingLeaf = (BoundingLeafRetained)region.retained; @@ -206,7 +206,7 @@ abstract class FogRetained extends LeafRetained{ /** * Set the Fog's region of influence to the specified Leaf node. - */ + */ void setInfluencingBoundingLeaf(BoundingLeaf region) { if (boundingLeaf != null) boundingLeaf.mirrorBoundingLeaf.removeUser(mirrorFog); @@ -216,17 +216,17 @@ abstract class FogRetained extends LeafRetained{ } else { boundingLeaf = null; } - sendMessage(BOUNDINGLEAF_CHANGED, - (boundingLeaf != null ? + sendMessage(BOUNDINGLEAF_CHANGED, + (boundingLeaf != null ? boundingLeaf.mirrorBoundingLeaf : null)); } - /** + /** * Get the Fog's region of influence. - */ + */ BoundingLeaf getInfluencingBoundingLeaf() { - return (boundingLeaf != null ? + return (boundingLeaf != null ? (BoundingLeaf)boundingLeaf.source : null); } @@ -252,7 +252,7 @@ abstract class FogRetained extends LeafRetained{ GroupRetained group; Object[] scopeInfo = new Object[3]; - + group = (GroupRetained) scopes.get(index); tempKey.reset(); group.removeAllNodesForScopedFog(mirrorFog, removeScopeList, tempKey); @@ -270,7 +270,7 @@ abstract class FogRetained extends LeafRetained{ scopeInfo[2] = (scopes.size() > 0 ? Boolean.TRUE:Boolean.FALSE); sendMessage(SCOPE_CHANGED, scopeInfo); } - + /** * Inserts the specified scope at specified index.before the * fog is live @@ -302,7 +302,7 @@ abstract class FogRetained extends LeafRetained{ scopeInfo[2] = (scopes.size() > 0 ? Boolean.TRUE: Boolean.FALSE); sendMessage(SCOPE_CHANGED, scopeInfo); } - + void initRemoveScope(int index) { GroupRetained group = (GroupRetained)scopes.elementAt(index); @@ -327,7 +327,7 @@ abstract class FogRetained extends LeafRetained{ sendMessage(SCOPE_CHANGED, scopeInfo); } - + /** * Returns the scope specified by the index. * @param index which scope to return @@ -336,11 +336,11 @@ abstract class FogRetained extends LeafRetained{ Group getScope(int index) { return (Group)(((GroupRetained)(scopes.elementAt(index))).source); } - + /** * Returns an enumeration object of the scoperen. * @return an enumeration object of the scoperen - */ + */ Enumeration getAllScopes() { Enumeration elm = scopes.elements(); Vector v = new Vector(scopes.size()); @@ -379,7 +379,7 @@ abstract class FogRetained extends LeafRetained{ scopeInfo[2] = (scopes.size() > 0 ? Boolean.TRUE: Boolean.FALSE); sendMessage(SCOPE_CHANGED, scopeInfo); } - + /** * Returns a count of this nodes' scopes. * @return the number of scopes descendant from this node @@ -388,7 +388,7 @@ abstract class FogRetained extends LeafRetained{ return scopes.size(); } - /** + /** * Returns the index of the specified scope within this nodes' list of scopes * @param scope whose index is desired * @return index of specified scope @@ -400,7 +400,7 @@ abstract class FogRetained extends LeafRetained{ return scopes.indexOf(null); } - /** + /** * Removes the specified scope from this nodes' list of scopes * @param scope to be removed. If the scope is not found, * the method returns silently @@ -415,11 +415,11 @@ abstract class FogRetained extends LeafRetained{ int i = indexOfScope(scope); if(i >= 0) initRemoveScope(i); - } + } - /** + /** * Removes all the scopes from this node's list of scopes. - * The node should revert to universal + * The node should revert to universal * scope after this method returns */ void removeAllScopes() { @@ -439,13 +439,13 @@ abstract class FogRetained extends LeafRetained{ scopeInfo[2] = Boolean.FALSE; sendMessage(SCOPE_CHANGED, scopeInfo); } - + /** * Removes all scopes from this node */ void initRemoveAllScopes() { int n = scopes.size(); - for(int index = n-1; index >= 0; index--) + for(int index = n-1; index >= 0; index--) initRemoveScope(index); } @@ -455,7 +455,7 @@ abstract class FogRetained extends LeafRetained{ void setInImmCtx(boolean inCtx) { inImmCtx = inCtx; } - + /** * This gets the immedate mode context flag */ @@ -500,7 +500,7 @@ abstract class FogRetained extends LeafRetained{ if (objs[2] != null) { mirrorFog.region = (Bounds)mirrorFog.boundingLeaf.transformedRegion; } - else { + else { if (mirrorFog.regionOfInfluence != null) { mirrorFog.region = ((Bounds)mirrorFog.regionOfInfluence).copy(mirrorFog.region); mirrorFog.region.transform( @@ -510,7 +510,7 @@ abstract class FogRetained extends LeafRetained{ else { mirrorFog.region = null; } - + } } else if ((component & SCOPE_CHANGED) != 0) { @@ -518,7 +518,7 @@ abstract class FogRetained extends LeafRetained{ ArrayList addList = (ArrayList)scopeList[0]; ArrayList removeList = (ArrayList)scopeList[1]; boolean isScoped = ((Boolean)scopeList[2]).booleanValue(); - + if (addList != null) { mirrorFog.isScoped = isScoped; for (i = 0; i < addList.size(); i++) { @@ -526,7 +526,7 @@ abstract class FogRetained extends LeafRetained{ obj.addFog(mirrorFog); } } - + if (removeList != null) { mirrorFog.isScoped = isScoped; for (i = 0; i < removeList.size(); i++) { @@ -557,7 +557,7 @@ abstract class FogRetained extends LeafRetained{ /** * Note: This routine will only be called on * the mirror object - will update the object's - * cached region and transformed region + * cached region and transformed region */ void updateBoundingLeaf() { if (boundingLeaf != null && boundingLeaf.switchState.currentSwitchOn) { @@ -565,7 +565,7 @@ abstract class FogRetained extends LeafRetained{ } else { if (regionOfInfluence != null) { region = regionOfInfluence.copy(region); - region.transform(regionOfInfluence, + region.transform(regionOfInfluence, getCurrentLocalToVworld()); } else { region = null; @@ -594,7 +594,7 @@ abstract class FogRetained extends LeafRetained{ IllegalSharingException(J3dI18N.getString("FogRetained1")); } - + // Create the mirror object // Initialization of the mirror object during the INSERT_NODE // message (in updateMirrorObject) @@ -613,7 +613,7 @@ abstract class FogRetained extends LeafRetained{ if (boundingLeaf != null) { boundingLeaf.mirrorBoundingLeaf.addUser(mirrorFog); } - + if ((s.viewScopedNodeList != null) && (s.viewLists != null)) { s.viewScopedNodeList.add(mirrorFog); s.scopedNodesViewList.add(s.viewLists.get(0)); @@ -668,7 +668,7 @@ abstract class FogRetained extends LeafRetained{ mirrorFog.boundingLeaf = null; mirrorFog.region = null; } - + if (bnds != null) { mirrorFog.regionOfInfluence = bnds; if (mirrorFog.region == null) { @@ -687,18 +687,18 @@ abstract class FogRetained extends LeafRetained{ Shape3DRetained shape; ArrayList shapeList = (ArrayList)args[2]; ArrayList removeScopeList = new ArrayList(); - + for (int i = 0; i < shapeList.size(); i++) { shape = ((GeometryAtom)shapeList.get(i)).source; shape.removeFog(mirrorFog); - } - mirrorFog.isScoped = false; + } + mirrorFog.isScoped = false; } - + /** * This clearLive routine first calls the superclass's method, then @@ -717,10 +717,10 @@ abstract class FogRetained extends LeafRetained{ s.notifyThreads |= J3dThread.UPDATE_RENDERING_ENVIRONMENT| J3dThread.UPDATE_RENDER; - // Remove this mirror light as users of the bounding leaf + // Remove this mirror light as users of the bounding leaf if (mirrorFog.boundingLeaf != null) mirrorFog.boundingLeaf.removeUser(mirrorFog); - + if ((s.viewScopedNodeList != null) && (s.viewLists != null)) { s.viewScopedNodeList.add(mirrorFog); s.scopedNodesViewList.add(s.viewLists.get(0)); @@ -751,7 +751,7 @@ abstract class FogRetained extends LeafRetained{ } } - // Clone the retained side only, internal use only + // Clone the retained side only, internal use only protected Object clone() { FogRetained fr = (FogRetained)super.clone(); @@ -760,7 +760,7 @@ abstract class FogRetained extends LeafRetained{ if (b != null) { fr.initInfluencingBounds(b); } - + fr.scopes = new Vector(); fr.isDirty = 0xffff; fr.inImmCtx = false; @@ -785,10 +785,10 @@ abstract class FogRetained extends LeafRetained{ region.transform(regionOfInfluence, sgFog.getCurrentLocalToVworld()); } - + } } - + final void sendMessage(int attrMask, Object attr) { J3dMessage createMessage = new J3dMessage(); createMessage.threads = targetThreads; @@ -798,7 +798,7 @@ abstract class FogRetained extends LeafRetained{ createMessage.args[1]= new Integer(attrMask); createMessage.args[2] = attr; VirtualUniverse.mc.processMessage(createMessage); - } + } void mergeTransform(TransformGroupRetained xform) { super.mergeTransform(xform); diff --git a/src/classes/share/javax/media/j3d/Font3D.java b/src/classes/share/javax/media/j3d/Font3D.java index ce88f0b..d7372e1 100644 --- a/src/classes/share/javax/media/j3d/Font3D.java +++ b/src/classes/share/javax/media/j3d/Font3D.java @@ -181,7 +181,7 @@ public class Font3D extends NodeComponent { GlyphVector gVec = font.createGlyphVector(frc, gCodes); Rectangle2D.Float bounds2d = (Rectangle2D.Float) (((GlyphMetrics)(gVec.getGlyphMetrics(0))).getBounds2D()); - + Point3d lower = new Point3d(bounds2d.x, bounds2d.y, 0.0); Point3d upper; if (fontExtrusion != null) { @@ -223,7 +223,7 @@ public class Font3D extends NodeComponent { // create a correctly sized TriangleArray TriangleArray ga = new TriangleArray(glyph_gar.getVertexCount(),glyph_gar.getVertexFormat()); - + // temp storage for coords, normals float tmp[] = new float[3]; @@ -267,7 +267,7 @@ public class Font3D extends NodeComponent { FastVector contours = new FastVector(10); float maxY = -Float.MAX_VALUE; int maxYIndex = 0, beginIdx = 0, endIdx = 0, start = 0; - + boolean setMaxY = false; @@ -330,10 +330,10 @@ public class Font3D extends NodeComponent { coords.add(vertex); num++; numPoints++; - } + } pIt.next(); } - + // No data(e.g space, control characters) // Two point can't form a valid contour if (numPoints == 0){ @@ -351,13 +351,13 @@ public class Font3D extends NodeComponent { // must be true unless it is a single line // define as "MoveTo p1 LineTo p2 Close" which is // not a valid font definition. - + if (maxYIndex == beginIdx) { - p1.set(vertices[endIdx]); + p1.set(vertices[endIdx]); } else { - p1.set(vertices[maxYIndex-1]); + p1.set(vertices[maxYIndex-1]); } - p2.set(vertices[maxYIndex]); + p2.set(vertices[maxYIndex]); if (maxYIndex == endIdx) { p3.set(vertices[beginIdx]); } else { @@ -374,7 +374,7 @@ public class Font3D extends NodeComponent { flip_side_orient = (p2.x > p1.x); } } else { - flip_side_orient = (p3.x > p2.x); + flip_side_orient = (p3.x > p2.x); } } else { // p1.x != p2.x, otherwise all three @@ -395,9 +395,9 @@ public class Font3D extends NodeComponent { endIdx = startIdx + contourCounts[i]; islandsTree.insert(new IslandsNode(startIdx, endIdx), vertices); startIdx = endIdx; - } + } - coords = null; // Free memory + coords = null; // Free memory contours = null; contourCounts = null; @@ -408,7 +408,7 @@ public class Font3D extends NodeComponent { int islandCounts[][] = new int[islandsList.arraySize()][]; Point3f outVerts[][] = new Point3f[islandCounts.length][]; int nchild, sum; - IslandsNode node; + IslandsNode node; for (i=0; i < islandCounts.length; i++) { node = nodes[i]; @@ -420,7 +420,7 @@ public class Font3D extends NodeComponent { for (j=0; j < nchild; j++) { islandCounts[i][j+1] = node.getChild(j).numVertices(); sum += islandCounts[i][j+1]; - } + } outVerts[i] = new Point3f[sum]; startIdx = 0; for (k=node.startIdx; k < node.endIdx; k++) { @@ -434,10 +434,10 @@ public class Font3D extends NodeComponent { } } } - - islandsTree = null; // Free memory + + islandsTree = null; // Free memory islandsList = null; vertices = null; @@ -446,7 +446,7 @@ public class Font3D extends NodeComponent { ArrayList triangData = new ArrayList(); Point3f q1 = new Point3f(), q2 = new Point3f(), q3 = new Point3f(); - Vector3f n1 = new Vector3f(), n2 = new Vector3f(); + Vector3f n1 = new Vector3f(), n2 = new Vector3f(); numPoints = 0; //Now loop thru each island, calling triangulator once per island. //Combine triangle data for all islands together in one object. @@ -477,11 +477,11 @@ public class Font3D extends NodeComponent { } } - // XXXX: Should use IndexedTriangleArray to avoid + // XXXX: Should use IndexedTriangleArray to avoid // duplication of vertices. To create triangles for // side faces, every vertex is duplicated currently. TriangleArray triAry = new TriangleArray(vertCnt, - GeometryArray.COORDINATES | + GeometryArray.COORDINATES | GeometryArray.NORMALS); boolean flip_orient[] = new boolean[islandCounts.length]; @@ -495,7 +495,7 @@ public class Font3D extends NodeComponent { vertOffset = ga.getVertexCount(); findOrient = false; - + //Create the triangle array for (i= 0; i < vertOffset; i+= 3, currCoordIndex += 3){ //Get 3 points. Since triangle is known to be flat, normal @@ -504,14 +504,14 @@ public class Font3D extends NodeComponent { ga.getNormal(i, n1); ga.getCoordinate(i+1, p2); ga.getCoordinate(i+2, p3); - + if (!findOrient) { //Check here if triangles are wound incorrectly and need //to be flipped. if (!getNormal(p1,p2, p3, n2)) { continue; } - + if (n2.z >= EPS) { flip_orient[j] = false; } else if (n2.z <= -EPS) { @@ -530,22 +530,22 @@ public class Font3D extends NodeComponent { p3.x = q1.x; p3.y = q1.y; p3.z = q1.z; n1.x = -n1.x; n1.y = -n1.y; n1.z = -n1.z; } - - + + if (fontExtrusion != null) { n2.x = -n1.x;n2.y = -n1.y;n2.z = -n1.z; - + triAry.setCoordinate(currCoordIndex, p1); triAry.setNormal(currCoordIndex, n2); triAry.setCoordinate(currCoordIndex+1, p3); triAry.setNormal(currCoordIndex+1, n2); triAry.setCoordinate(currCoordIndex+2, p2); triAry.setNormal(currCoordIndex+2, n2); - + q1.x = p1.x; q1.y = p1.y; q1.z = p1.z + fontExtrusion.length; q2.x = p2.x; q2.y = p2.y; q2.z = p2.z + fontExtrusion.length; q3.x = p3.x; q3.y = p3.y; q3.z = p3.z + fontExtrusion.length; - + triAry.setCoordinate(currCoordIndex+vertOffset, q1); triAry.setNormal(currCoordIndex+vertOffset, n1); triAry.setCoordinate(currCoordIndex+1+vertOffset, q2); @@ -562,11 +562,11 @@ public class Font3D extends NodeComponent { } } - if (fontExtrusion != null) { + if (fontExtrusion != null) { currCoordIndex += vertOffset; } } - + //Now add side triangles in both cases. // Since we duplicated triangles with different Z, make sure @@ -590,7 +590,7 @@ public class Font3D extends NodeComponent { Vector3f q1Normal = new Vector3f(); Vector3f q2Normal = new Vector3f(); Vector3f q3Normal = new Vector3f(); - + for (i=0;i < islandCounts.length;i++){ for (j=0, k=0, num =0;j < islandCounts[i].length;j++){ num += islandCounts[i][j]; @@ -600,13 +600,13 @@ public class Font3D extends NodeComponent { q1.x = p1.x; q1.y = p1.y; q1.z = p1.z+fontExtrusion.length; p2.z = 0.0f; q2.z = p2.z+fontExtrusion.length; - for (int m=0; m < num;m++) { + for (int m=0; m < num;m++) { p2.x = outVerts[i][m].x; p2.y = outVerts[i][m].y; - q2.x = p2.x; - q2.y = p2.y; + q2.x = p2.x; + q2.y = p2.y; if (getNormal(p1, q1, p2, n1)) { - + if (!flip_side_orient) { n1.negate(); } @@ -614,11 +614,11 @@ public class Font3D extends NodeComponent { break; } } - + for (;k < num;k++){ p2.x = outVerts[i][k].x;p2.y = outVerts[i][k].y;p2.z = 0.0f; q2.x = p2.x; q2.y = p2.y; q2.z = p2.z+fontExtrusion.length; - + if (!getNormal(p1, q1, p2, n1)) { n1.set(goodNormal); } else { @@ -627,7 +627,7 @@ public class Font3D extends NodeComponent { } goodNormal.set(n1); } - + if (!getNormal(p2, q1, q2, n2)) { n2.set(goodNormal); } else { @@ -638,7 +638,7 @@ public class Font3D extends NodeComponent { } // if there is a previous normal, see if we need to smooth // this normal or make a crease - + if (pn1 != null) { cosine = n1.dot(pn2); smooth = cosine > threshold; @@ -647,7 +647,7 @@ public class Font3D extends NodeComponent { p1Normal.y = (pn1.y + pn2.y + n1.y); p1Normal.z = (pn1.z + pn2.z + n1.z); normalize(p1Normal); - + q1Normal.x = (pn2.x + n1.x + n2.x); q1Normal.y = (pn2.y + n1.y + n2.y); q1Normal.z = (pn2.z + n1.z + n2.z); @@ -655,9 +655,9 @@ public class Font3D extends NodeComponent { } // if smooth else { p1Normal.x = n1.x; p1Normal.y = n1.y; p1Normal.z = n1.z; - q1Normal.x = n1.x+n2.x; + q1Normal.x = n1.x+n2.x; q1Normal.y = n1.y+n2.y; - q1Normal.z = n1.z+ n2.z; + q1Normal.z = n1.z+ n2.z; normalize(q1Normal); } // else } // if pn1 != null @@ -667,20 +667,20 @@ public class Font3D extends NodeComponent { p1Normal.x = n1.x; p1Normal.y = n1.y; p1Normal.z = n1.z; - + q1Normal.x = (n1.x + n2.x); q1Normal.y = (n1.y + n2.y); q1Normal.z = (n1.z + n2.z); normalize(q1Normal); } // else - + // if there is a next, check if we should smooth normal - + if (k+1 < num) { - p3.x = outVerts[i][k+1].x; p3.y = outVerts[i][k+1].y; + p3.x = outVerts[i][k+1].x; p3.y = outVerts[i][k+1].y; p3.z = 0.0f; q3.x = p3.x; q3.y = p3.y; q3.z = p3.z + fontExtrusion.length; - + if (!getNormal(p2, q2, p3, n3)) { n3.set(goodNormal); } else { @@ -689,7 +689,7 @@ public class Font3D extends NodeComponent { } goodNormal.set(n3); } - + if (!getNormal(p3, q2, q3, n4)) { n4.set(goodNormal); } else { @@ -698,16 +698,16 @@ public class Font3D extends NodeComponent { } goodNormal.set(n4); } - + cosine = n2.dot(n3); smooth = cosine > threshold; - + if (smooth) { p2Normal.x = (n1.x + n2.x + n3.x); p2Normal.y = (n1.y + n2.y + n3.y); p2Normal.z = (n1.z + n2.z + n3.z); normalize(p2Normal); - + q2Normal.x = (n2.x + n3.x + n4.x); q2Normal.y = (n2.y + n3.y + n4.y); q2Normal.z = (n2.z + n3.z + n4.z); @@ -724,32 +724,32 @@ public class Font3D extends NodeComponent { p2Normal.y = (n1.y + n2.y); p2Normal.z = (n1.z + n2.z); normalize(p2Normal); - + q2Normal.x = n2.x; q2Normal.y = n2.y; q2Normal.z = n2.z; } // else - + // add pts for the 2 tris // p1, q1, p2 and p2, q1, q2 - + if (flip_side_orient) { triAry.setCoordinate(currCoordIndex, p1); triAry.setNormal(currCoordIndex, p1Normal); currCoordIndex++; - + triAry.setCoordinate(currCoordIndex, q1); triAry.setNormal(currCoordIndex, q1Normal); currCoordIndex++; - + triAry.setCoordinate(currCoordIndex, p2); triAry.setNormal(currCoordIndex, p2Normal); currCoordIndex++; - + triAry.setCoordinate(currCoordIndex, p2); triAry.setNormal(currCoordIndex, p2Normal); currCoordIndex++; - + triAry.setCoordinate(currCoordIndex, q1); triAry.setNormal(currCoordIndex, q1Normal); currCoordIndex++; @@ -757,19 +757,19 @@ public class Font3D extends NodeComponent { triAry.setCoordinate(currCoordIndex, q1); triAry.setNormal(currCoordIndex, q1Normal); currCoordIndex++; - + triAry.setCoordinate(currCoordIndex, p1); triAry.setNormal(currCoordIndex, p1Normal); currCoordIndex++; - + triAry.setCoordinate(currCoordIndex, p2); triAry.setNormal(currCoordIndex, p2Normal); currCoordIndex++; - + triAry.setCoordinate(currCoordIndex, q1); triAry.setNormal(currCoordIndex, q1Normal); currCoordIndex++; - + triAry.setCoordinate(currCoordIndex, p2); triAry.setNormal(currCoordIndex, p2Normal); currCoordIndex++; @@ -781,9 +781,9 @@ public class Font3D extends NodeComponent { pn2.x = n2.x; pn2.y = n2.y; pn2.z = n2.z; p1.x = p2.x; p1.y = p2.y; p1.z = p2.z; q1.x = q2.x; q1.y = q2.y; q1.z = q2.z; - + }// for k - + // set the previous normals to null when we are done pn1 = null; pn2 = null; @@ -792,12 +792,12 @@ public class Font3D extends NodeComponent { } else { // if shape int m, offset=0; Point3f P2 = new Point3f(), Q2 = new Point3f(), P1=new Point3f(); - Vector3f nn = new Vector3f(), nn1= new Vector3f(), + Vector3f nn = new Vector3f(), nn1= new Vector3f(), nn2= new Vector3f(), nn3= new Vector3f(); Vector3f nna = new Vector3f(), nnb=new Vector3f(); float length; boolean validNormal = false; - + // fontExtrusion.shape is specified, and is NOT straight line for (i=0;i < islandCounts.length;i++){ for (j=0, k= 0, offset = num =0;j < islandCounts[i].length;j++){ @@ -811,7 +811,7 @@ public class Font3D extends NodeComponent { for (m=num-2; m >= 0; m--) { p3.x = outVerts[i][m].x; p3.y = outVerts[i][m].y; - + if (getNormal(p3, q1, p1, nn1)) { if (!flip_side_orient) { nn1.negate(); @@ -824,7 +824,7 @@ public class Font3D extends NodeComponent { p2.x = outVerts[i][k].x;p2.y = outVerts[i][k].y;p2.z = 0.0f; q2.x = p2.x; q2.y = p2.y; q2.z = p2.z+fontExtrusion.length; getNormal(p1, q1, p2, nn2); - + p3.x = outVerts[i][(k+1)==num ? offset:(k+1)].x; p3.y = outVerts[i][(k+1)==num ? offset:(k+1)].y; p3.z = 0.0f; @@ -836,19 +836,19 @@ public class Font3D extends NodeComponent { } goodNormal.set(nn3); } - + // Calculate normals at the point by averaging normals // of two faces on each side of the point. nna.x = (nn1.x+nn2.x); nna.y = (nn1.y+nn2.y); nna.z = (nn1.z+nn2.z); normalize(nna); - + nnb.x = (nn3.x+nn2.x); nnb.y = (nn3.y+nn2.y); nnb.z = (nn3.z+nn2.z); normalize(nnb); - + P1.x = p1.x;P1.y = p1.y;P1.z = p1.z; P2.x = p2.x;P2.y = p2.y; P2.z = p2.z; Q2.x = q2.x;Q2.y = q2.y; Q2.z = q2.z; @@ -858,7 +858,7 @@ public class Font3D extends NodeComponent { q1.y = P1.y + nna.y * fontExtrusion.pnts[m].y; q2.x = P2.x + nnb.x * fontExtrusion.pnts[m].y; q2.y = P2.y + nnb.y * fontExtrusion.pnts[m].y; - + if (!getNormal(p1, q1, p2, n1)) { n1.set(goodNormal); } else { @@ -867,12 +867,12 @@ public class Font3D extends NodeComponent { } goodNormal.set(n1); } - + if (flip_side_orient) { triAry.setCoordinate(currCoordIndex, p1); triAry.setNormal(currCoordIndex, n1); currCoordIndex++; - + triAry.setCoordinate(currCoordIndex, q1); triAry.setNormal(currCoordIndex, n1); currCoordIndex++; @@ -880,15 +880,15 @@ public class Font3D extends NodeComponent { triAry.setCoordinate(currCoordIndex, q1); triAry.setNormal(currCoordIndex, n1); currCoordIndex++; - + triAry.setCoordinate(currCoordIndex, p1); triAry.setNormal(currCoordIndex, n1); currCoordIndex++; } triAry.setCoordinate(currCoordIndex, p2); triAry.setNormal(currCoordIndex, n1); - currCoordIndex++; - + currCoordIndex++; + if (!getNormal(p2, q1, q2, n1)) { n1.set(goodNormal); } else { @@ -897,12 +897,12 @@ public class Font3D extends NodeComponent { } goodNormal.set(n1); } - + if (flip_side_orient) { triAry.setCoordinate(currCoordIndex, p2); triAry.setNormal(currCoordIndex, n1); currCoordIndex++; - + triAry.setCoordinate(currCoordIndex, q1); triAry.setNormal(currCoordIndex, n1); currCoordIndex++; @@ -910,7 +910,7 @@ public class Font3D extends NodeComponent { triAry.setCoordinate(currCoordIndex, q1); triAry.setNormal(currCoordIndex, n1); currCoordIndex++; - + triAry.setCoordinate(currCoordIndex, p2); triAry.setNormal(currCoordIndex, n1); currCoordIndex++; @@ -918,7 +918,7 @@ public class Font3D extends NodeComponent { triAry.setCoordinate(currCoordIndex, q2); triAry.setNormal(currCoordIndex, n1); currCoordIndex++; - + p1.x = q1.x;p1.y = q1.y;p1.z = q1.z; p2.x = q2.x;p2.y = q2.y;p2.z = q2.z; }// for m @@ -933,8 +933,8 @@ public class Font3D extends NodeComponent { }// if fontExtrusion geo = (GeometryArrayRetained) triAry.retained; geomHash.put(ch, geo); - } - + } + return geo; } @@ -942,15 +942,15 @@ public class Font3D extends NodeComponent { static boolean getNormal(Point3f p1, Point3f p2, Point3f p3, Vector3f normal) { Vector3f v1 = new Vector3f(); Vector3f v2 = new Vector3f(); - + // Must compute normal v1.sub(p2, p1); v2.sub(p2, p3); normal.cross(v1, v2); normal.negate(); - + float length = normal.length(); - + if (length > 0) { length = 1 / length; normal.x *= length; @@ -961,7 +961,7 @@ public class Font3D extends NodeComponent { return false; } - + // check if 2 contours are inside/outside/intersect one another // INPUT: // vertCnt1, vertCnt2 - number of vertices in 2 contours @@ -969,56 +969,56 @@ public class Font3D extends NodeComponent { // vertices - actual vertex data // OUTPUT: // status == 1 - intersecting contours - // 2 - first contour inside the second + // 2 - first contour inside the second // 3 - second contour inside the first // 0 - disjoint contours(2 islands) - - static int check2Contours(int begin1, int end1, int begin2, int end2, + + static int check2Contours(int begin1, int end1, int begin2, int end2, Point3f[] vertices) { int i, j; boolean inside2, inside1; - - inside2 = pointInPolygon2D(vertices[begin1].x, vertices[begin1].y, + + inside2 = pointInPolygon2D(vertices[begin1].x, vertices[begin1].y, begin2, end2, vertices); - + for (i=begin1+1; i < end1;i++) { - if (pointInPolygon2D(vertices[i].x, vertices[i].y, + if (pointInPolygon2D(vertices[i].x, vertices[i].y, begin2, end2, vertices) != inside2) { return 1; //intersecting contours } } - - // Since we are using point in polygon test and not + + // Since we are using point in polygon test and not // line in polygon test. There are cases we miss the interesting // if we are not checking the reverse for all points. This happen // when two points form a line pass through a polygon but the two // points are outside of it. - - inside1 = pointInPolygon2D(vertices[begin2].x, vertices[begin2].y, + + inside1 = pointInPolygon2D(vertices[begin2].x, vertices[begin2].y, begin1, end1, vertices); - + for (i=begin2+1; i < end2;i++) { - if (pointInPolygon2D(vertices[i].x, vertices[i].y, - begin1, end1, vertices) != inside1) { + if (pointInPolygon2D(vertices[i].x, vertices[i].y, + begin1, end1, vertices) != inside1) { return 1; //intersecting contours } } - + if (!inside2) { - if (!inside1) { + if (!inside1) { return 0; // disjoint countours - } + } // inside2 = false and inside1 = true return 3; // second contour inside first } - + // must be inside2 = true and inside1 = false // Note that it is not possible inside2 = inside1 = true // unless two contour overlap to each others. // return 2; // first contour inside second } - + // Test if 2D point (x,y) lies inside polygon represented by verts. // z-value of polygon vertices is ignored. Sent only to avoid data-copy. // Uses ray-shooting algorithm to compute intersections along +X axis. @@ -1026,9 +1026,9 @@ public class Font3D extends NodeComponent { // is best solution here due to large number of polygon vertices. // Point is INSIDE if number of intersections is odd, OUTSIDE if number // of intersections is even. - static boolean pointInPolygon2D(float x, float y, int begIdx, int endIdx, + static boolean pointInPolygon2D(float x, float y, int begIdx, int endIdx, Point3f[] verts){ - + int i, num_intersections = 0; float xi; @@ -1036,42 +1036,42 @@ public class Font3D extends NodeComponent { if ((verts[i].y >= y && verts[i+1].y >= y) || (verts[i].y < y && verts[i+1].y < y)) continue; - + xi = verts[i].x + (verts[i].x - verts[i+1].x)*(y - verts[i].y)/ (verts[i].y - verts[i+1].y); - + if (x < xi) num_intersections++; } - + // Check for segment from last vertex to first vertex. - + if (!((verts[i].y >= y && verts[begIdx].y >= y) || (verts[i].y < y && verts[begIdx].y < y))) { xi = verts[i].x + (verts[i].x - verts[begIdx].x)*(y - verts[i].y)/ (verts[i].y - verts[begIdx].y); - + if (x < xi) num_intersections++; } - + return ((num_intersections % 2) != 0); } - - + + static final boolean normalize(Vector3f v) { float len = v.length(); - + if (len > 0) { len = 1.0f/len; v.x *= len; v.y *= len; v.z *= len; return true; - } + } return false; - } + } - // A Tree of islands form based on contour, each parent's contour + // A Tree of islands form based on contour, each parent's contour // enclosed all the child. We built this since Triangular fail to // handle the case of multiple concentrated contours. i.e. if // 4 contours A > B > C > D. Triangular will fail recongized @@ -1115,11 +1115,11 @@ public class Font3D extends NodeComponent { void insert(IslandsNode newNode, Point3f[] vertices) { boolean createNewLevel = false; - + if (islandsList != null) { IslandsNode childNode; int status; - + for (int i=numChild()-1; i>=0; i--) { childNode = getChild(i); status = check2Contours(newNode.startIdx, newNode.endIdx, @@ -1129,15 +1129,15 @@ public class Font3D extends NodeComponent { case 2: // newNode inside childNode, go down recursively childNode.insert(newNode, vertices); return; - case 3:// childNode inside newNode, + case 3:// childNode inside newNode, // continue to search other childNode also // inside this one and group them together. newNode.addChild(childNode); createNewLevel = true; break; default: // intersecting or disjoint - - } + + } } } @@ -1146,8 +1146,8 @@ public class Font3D extends NodeComponent { for (int i=newNode.numChild()-1; i>=0; i--) { removeChild(newNode.getChild(i)); } - // Add the newNode to parent - } + // Add the newNode to parent + } addChild(newNode); } diff --git a/src/classes/share/javax/media/j3d/FontExtrusion.java b/src/classes/share/javax/media/j3d/FontExtrusion.java index 7ba46dd..5569919 100644 --- a/src/classes/share/javax/media/j3d/FontExtrusion.java +++ b/src/classes/share/javax/media/j3d/FontExtrusion.java @@ -49,7 +49,7 @@ import java.util.ArrayList; * modified via the extrusionShape parameter, a Shape object that * describes the 3D contour of a Font3D object. * <P> - * User is responsible for data sanity and must make sure that + * User is responsible for data sanity and must make sure that * extrusionShape does not cause intersection of adjacent glyphs * or within single glyph. Else undefined output may be generated. * @@ -95,7 +95,7 @@ public class FontExtrusion extends Object { * A null shape specifies that a straight line from 0.0 to 0.2 * (straight bevel) is used. * - * @exception IllegalArgumentException if multiple contours in + * @exception IllegalArgumentException if multiple contours in * extrusionShape, or contour is not monotonic or least x-value * of a contour point is not 0.0f * @@ -122,7 +122,7 @@ public class FontExtrusion extends Object { * This corresponds to the <code>flatness</code> parameter in * the <code>java.awt.Shape.getPathIterator</code> method. * - * @exception IllegalArgumentException if multiple contours in + * @exception IllegalArgumentException if multiple contours in * extrusionShape, or contour is not monotonic or least x-value * of a contour point is not 0.0f * @@ -147,7 +147,7 @@ public class FontExtrusion extends Object { * A null shape specifies that a straight line from 0.0 to 0.2 * (straight bevel) is used. * - * @exception IllegalArgumentException if multiple contours in + * @exception IllegalArgumentException if multiple contours in * extrusionShape, or contour is not monotonic or least x-value * of a contour point is not 0.0f * @@ -160,7 +160,7 @@ public class FontExtrusion extends Object { PathIterator pIt = shape.getPathIterator(null, tessellationTolerance); ArrayList coords = new ArrayList(); - float tmpCoords[] = new float[6], prevX = 0.0f; + float tmpCoords[] = new float[6], prevX = 0.0f; int flag, n = 0, inc = -1; // Extrusion shape is restricted to be single contour, monotonous @@ -172,12 +172,12 @@ public class FontExtrusion extends Object { vertex.x = tmpCoords[0]; vertex.y = tmpCoords[1]; if (inc == -1){ - if (prevX < vertex.x) inc = 0; + if (prevX < vertex.x) inc = 0; else if (prevX > vertex.x) inc = 1; } - //Flag 'inc' indicates if curve is monotonic increasing or + //Flag 'inc' indicates if curve is monotonic increasing or // monotonic decreasing. It is set to -1 initially and remains - // -1 if consecutive x values are same. Once 'inc' is set to + // -1 if consecutive x values are same. Once 'inc' is set to // 1 or 0, exception is thrown is curve changes direction. if (((inc == 0) && (prevX > vertex.x)) || ((inc == 1) && (prevX < vertex.x))) diff --git a/src/classes/share/javax/media/j3d/FreeListManager.java b/src/classes/share/javax/media/j3d/FreeListManager.java index c12a0dd..d97a63f 100644 --- a/src/classes/share/javax/media/j3d/FreeListManager.java +++ b/src/classes/share/javax/media/j3d/FreeListManager.java @@ -39,22 +39,22 @@ class FreeListManager { // constants that represent the freelists managed by the Manager static final int DISPLAYLIST = 0; static final int TEXTURE2D = 1; - static final int TEXTURE3D = 2; - + static final int TEXTURE3D = 2; + private static int maxFreeListNum = 2; - + // what list we are going to shrink next private static int currlist = 0; static MemoryFreeList[] freelist = null; - + static void createFreeLists() { maxFreeListNum = 2; freelist = new MemoryFreeList[maxFreeListNum+1]; freelist[DISPLAYLIST] = new IntegerFreeList(); freelist[TEXTURE2D] = new IntegerFreeList(); freelist[TEXTURE3D] = new IntegerFreeList(); - + } // see if the current list can be shrunk @@ -63,7 +63,7 @@ class FreeListManager { if (freelist[currlist] != null) { freelist[currlist].shrink(); } - + currlist++; if (currlist > maxFreeListNum) currlist = 0; } diff --git a/src/classes/share/javax/media/j3d/GLSLShaderProgram.java b/src/classes/share/javax/media/j3d/GLSLShaderProgram.java index 1f7fb08..00f4487 100644 --- a/src/classes/share/javax/media/j3d/GLSLShaderProgram.java +++ b/src/classes/share/javax/media/j3d/GLSLShaderProgram.java @@ -134,21 +134,21 @@ public class GLSLShaderProgram extends ShaderProgram { */ public void setShaders(Shader[] shaders) { checkForLiveOrCompiled(); - + if(shaders != null) { // Check shaders for valid shading language and class type for (int i = 0; i < shaders.length; i++) { if (shaders[i].getShadingLanguage() != Shader.SHADING_LANGUAGE_GLSL) { throw new IllegalArgumentException(J3dI18N.getString("GLSLShaderProgram2")); } - + // Try to cast shader to SourceCodeShader; it will throw // ClassCastException if it isn't. SourceCodeShader shad = (SourceCodeShader)shaders[i]; } - + } - + ((GLSLShaderProgramRetained)this.retained).setShaders(shaders); } diff --git a/src/classes/share/javax/media/j3d/GLSLShaderProgramRetained.java b/src/classes/share/javax/media/j3d/GLSLShaderProgramRetained.java index 369a3ea..e25def3 100644 --- a/src/classes/share/javax/media/j3d/GLSLShaderProgramRetained.java +++ b/src/classes/share/javax/media/j3d/GLSLShaderProgramRetained.java @@ -37,7 +37,7 @@ package javax.media.j3d; */ class GLSLShaderProgramRetained extends ShaderProgramRetained { - + /** * Constructs a GLSL shader program node component. */ @@ -298,7 +298,7 @@ class GLSLShaderProgramRetained extends ShaderProgramRetained { numElements, value); } - + /** * Method to return a flag indicating whether this * ShaderProgram is supported on the specified Canvas. @@ -310,17 +310,17 @@ class GLSLShaderProgramRetained extends ShaderProgramRetained { /** * Method to create the native shader. */ - ShaderError createShader(Context ctx, ShaderRetained shader, ShaderId[] shaderIdArr) { + ShaderError createShader(Context ctx, ShaderRetained shader, ShaderId[] shaderIdArr) { return Pipeline.getPipeline().createGLSLShader(ctx, shader.shaderType, shaderIdArr); } - + /** * Method to destroy the native shader. */ ShaderError destroyShader(Context ctx, ShaderId shaderId) { return Pipeline.getPipeline().destroyGLSLShader(ctx, shaderId); } - + /** * Method to compile the native shader. */ @@ -332,7 +332,7 @@ class GLSLShaderProgramRetained extends ShaderProgramRetained { * Method to create the native shader program. */ ShaderError createShaderProgram(Context ctx, ShaderProgramId[] shaderProgramIdArr) { - return Pipeline.getPipeline().createGLSLShaderProgram(ctx, shaderProgramIdArr); + return Pipeline.getPipeline().createGLSLShaderProgram(ctx, shaderProgramIdArr); } /** @@ -348,7 +348,7 @@ class GLSLShaderProgramRetained extends ShaderProgramRetained { ShaderError linkShaderProgram(Context ctx, ShaderProgramId shaderProgramId, ShaderId[] shaderIds) { return Pipeline.getPipeline().linkGLSLShaderProgram(ctx, shaderProgramId, shaderIds); } - + ShaderError bindVertexAttrName(Context ctx, ShaderProgramId shaderProgramId, String attrName, int attrIndex) { return Pipeline.getPipeline().bindGLSLVertexAttrName(ctx, shaderProgramId, attrName, attrIndex); } @@ -361,7 +361,7 @@ class GLSLShaderProgramRetained extends ShaderProgramRetained { String[] attrNames, AttrNameInfo[] attrNameInfoArr) { int numAttrNames = attrNames.length; - + ShaderAttrLoc[] locArr = new ShaderAttrLoc[numAttrNames]; int[] typeArr = new int[numAttrNames]; int[] sizeArr = new int[numAttrNames]; // currently unused @@ -382,14 +382,14 @@ class GLSLShaderProgramRetained extends ShaderProgramRetained { // ", size = " + sizeArr[i]); } } - + /** * Method to enable the native shader program. */ ShaderError enableShaderProgram(Context ctx, ShaderProgramId shaderProgramId) { return Pipeline.getPipeline().useGLSLShaderProgram(ctx, shaderProgramId); } - + /** * Method to disable the native shader program. */ diff --git a/src/classes/share/javax/media/j3d/GeneralizedStrip.java b/src/classes/share/javax/media/j3d/GeneralizedStrip.java index 883737a..b870c54 100644 --- a/src/classes/share/javax/media/j3d/GeneralizedStrip.java +++ b/src/classes/share/javax/media/j3d/GeneralizedStrip.java @@ -151,7 +151,7 @@ class GeneralizedStrip { /** * A list of indices into the vertices of the original generalized * strip. It specifies the order in which vertices in the original - * strip should be followed to build GeometryArray objects. + * strip should be followed to build GeometryArray objects. */ IntList vertices ; @@ -285,7 +285,7 @@ class GeneralizedStrip { } } } - + // Finish off the last strip or fan. // If v > size then the strip is degenerate. if (v == size) @@ -304,7 +304,7 @@ class GeneralizedStrip { if (v > size) System.err.println(" ended with a degenerate triangle:" + " number of vertices: " + (v-size)) ; - + System.err.println("\n number of strips: " + stripCounts.count) ; if (stripCounts.count > 0) { System.err.println(" number of vertices: " + stripVerts.count) ; @@ -323,7 +323,7 @@ class GeneralizedStrip { // System.err.println(" indices: " + fanVerts.toString()) ; } System.err.println("\n total vertices: " + - (stripVerts.count + fanVerts.count) + + (stripVerts.count + fanVerts.count) + "\n original number of vertices: " + size + "\n") ; } @@ -334,7 +334,7 @@ class GeneralizedStrip { // have counter-clockwise (CCW) winding order when projected to // the view surface. Polygons with clockwise (CW) vertex winding // will be culled as back-facing by default. - // + // // Generalized triangle strips can flip the orientation of their // triangles with the RESTART_CW and RESTART_CCW vertex flags. // Strips flagged with an orientation opposite to what has been @@ -384,7 +384,7 @@ class GeneralizedStrip { } } } - + private static void addFan(IntList fanVerts, IntList fanCounts, int start, int length, @@ -463,12 +463,12 @@ class GeneralizedStrip { StripArray sa = new StripArray(stripVerts, stripCounts) ; if (debug) { - System.err.println("GeneralizedStrip.toTriangleStrips" + + System.err.println("GeneralizedStrip.toTriangleStrips" + "\n number of strips: " + sa.stripCounts.count) ; if (sa.stripCounts.count > 0) { System.err.println(" number of vertices: " + - sa.vertices.count + + sa.vertices.count + "\n vertices/strip: " + ((float)sa.vertices.count / (float)sa.stripCounts.count)) ; @@ -490,7 +490,7 @@ class GeneralizedStrip { // Construct a strip by criss-crossing across the interior. stripCounts.add(length) ; stripVerts.add(fans[v]) ; - + int j = v + 1 ; int k = v + (length - 1) ; while (j <= k) { @@ -701,7 +701,7 @@ class GeneralizedStrip { System.err.print(" long strip counts: [") ; for (int i = 0 ; i < longStripCount-1 ; i++) System.err.print(newStripCounts[i++] + ", ") ; - + System.err.println (newStripCounts[longStripCount-1] + "]\n") ; } @@ -716,7 +716,7 @@ class GeneralizedStrip { * * RESTART_CW and RESTART_CCW are treated as equivalent, as are * REPLACE_MIDDLE and REPLACE_OLDEST. - * + * * @param vertices an object implementing GeneralizedStripFlags * @return a StripArray representing an array of line strips */ @@ -753,7 +753,7 @@ class GeneralizedStrip { v += 2 ; } } - + // Finish off the last strip. // If v > size then the strip is degenerate. if (v == size) { @@ -788,7 +788,7 @@ class GeneralizedStrip { /** * Counts the number of lines defined by arrays of line strips. - * + * * @param stripCounts array of strip counts, as used by the * GeometryStripArray object * @return number of lines in the strips @@ -831,7 +831,7 @@ class GeneralizedStrip { /** * Breaks up triangle strips into separate triangles. - * + * * @param stripCounts array of strip counts, as used by the * GeometryStripArray object * @return array of ints which index into the original vertex array; each @@ -852,7 +852,7 @@ class GeneralizedStrip { /** * Breaks up triangle fans into separate triangles. - * + * * @param stripCounts array of strip counts, as used by the * GeometryStripArray object * @return array of ints which index into the original vertex array; each @@ -873,7 +873,7 @@ class GeneralizedStrip { /** * Takes a fan and converts it to one or more strips. - * + * * @param v index into the fans array of the first vertex in the fan * @param length number of vertices in the fan * @param fans array of vertex indices representing one or more fans diff --git a/src/classes/share/javax/media/j3d/GeneralizedStripFlags.java b/src/classes/share/javax/media/j3d/GeneralizedStripFlags.java index cc9d2a8..8776c55 100644 --- a/src/classes/share/javax/media/j3d/GeneralizedStripFlags.java +++ b/src/classes/share/javax/media/j3d/GeneralizedStripFlags.java @@ -45,7 +45,7 @@ interface GeneralizedStripFlags { /** * This flag indicates that a vertex starts a new strip with clockwise - * winding. + * winding. */ static final int RESTART_CW = 0 ; diff --git a/src/classes/share/javax/media/j3d/GeneralizedVertexList.java b/src/classes/share/javax/media/j3d/GeneralizedVertexList.java index 5732048..45b5611 100644 --- a/src/classes/share/javax/media/j3d/GeneralizedVertexList.java +++ b/src/classes/share/javax/media/j3d/GeneralizedVertexList.java @@ -53,10 +53,10 @@ class GeneralizedVertexList implements GeneralizedStripFlags { private boolean hasColor3 = false ; private boolean hasColor4 = false ; private boolean hasNormals = false ; - + // Indicates the vertex winding of front-facing triangles in this strip. private int frontFace ; - + /** * Count of number of strips generated after conversion to GeometryArray. */ @@ -90,7 +90,7 @@ class GeneralizedVertexList implements GeneralizedStripFlags { GeneralizedVertexList(int vertexFormat, int frontFace, int initSize) { this.frontFace = frontFace ; setVertexFormat(vertexFormat) ; - + if (initSize == 0) vertices = new ArrayList() ; else @@ -130,7 +130,7 @@ class GeneralizedVertexList implements GeneralizedStripFlags { else hasColor3 = true ; } - + /** * A class with fields corresponding to all the data that can be bundled * with the vertices of generalized strips. @@ -141,11 +141,11 @@ class GeneralizedVertexList implements GeneralizedStripFlags { Color3f color3 ; Color4f color4 ; Vector3f normal ; - + Vertex(Point3f p, Vector3f n, Color4f c, int flag) { this.flag = flag ; coord = new Point3f(p) ; - + if (hasNormals) normal = new Vector3f(n) ; @@ -163,7 +163,7 @@ class GeneralizedVertexList implements GeneralizedStripFlags { void addVertex(Point3f pos, Vector3f norm, Color4f color, int flag) { vertices.add(new Vertex(pos, norm, color, flag)) ; } - + /** * Return the number of vertices in this list. */ @@ -230,7 +230,7 @@ class GeneralizedVertexList implements GeneralizedStripFlags { c3f[i] = v.color3 ; } ga.setColors(0, c3f) ; - + } else if (hasColor4) { Color4f c4f[] = new Color4f[indices.count] ; for (int i = 0 ; i < indices.count ; i++) { diff --git a/src/classes/share/javax/media/j3d/Geometry.java b/src/classes/share/javax/media/j3d/Geometry.java index 8e0797f..60276c8 100644 --- a/src/classes/share/javax/media/j3d/Geometry.java +++ b/src/classes/share/javax/media/j3d/Geometry.java @@ -45,7 +45,7 @@ package javax.media.j3d; * Each of these geometric types defines a visible object or set of * objects. A Geometry object is used as a component object of a Shape3D * leaf node. - * + * */ public abstract class Geometry extends NodeComponent { @@ -61,7 +61,7 @@ public abstract class Geometry extends NodeComponent { private static final int[] readCapabilities = { ALLOW_INTERSECT }; - + /** * Constructs a new Geometry object. */ diff --git a/src/classes/share/javax/media/j3d/GeometryArray.java b/src/classes/share/javax/media/j3d/GeometryArray.java index 9f95391..a402865 100644 --- a/src/classes/share/javax/media/j3d/GeometryArray.java +++ b/src/classes/share/javax/media/j3d/GeometryArray.java @@ -348,10 +348,10 @@ public abstract class GeometryArray extends Geometry { //NVaidya /** - * Specifies that the indices in this GeometryArray - * are accessed by reference. This flag is only valid for + * Specifies that the indices in this GeometryArray + * are accessed by reference. This flag is only valid for * indexed geometry arrays (subclasses of IndexedGeometryArray) and only - * when used in conjunction with the <code>BY_REFERENCE</code> and + * when used in conjunction with the <code>BY_REFERENCE</code> and * <code>USE_COORD_INDEX_ONLY</code> flags. * * @since Java 3D 1.5 @@ -367,7 +367,7 @@ public abstract class GeometryArray extends Geometry { private TexCoord4f [] texCoord4fArray = null; private TexCoord2f texCoord2fScratch = null; private TexCoord3f texCoord3fScratch = null; - + private static final int[] defTexCoordMap = { 0 }; // Array for setting default read capabilities @@ -379,9 +379,9 @@ public abstract class GeometryArray extends Geometry { ALLOW_NORMAL_READ, ALLOW_REF_DATA_READ, ALLOW_TEXCOORD_READ, - ALLOW_VERTEX_ATTR_READ + ALLOW_VERTEX_ATTR_READ }; - + // non-public, no parameter constructor GeometryArray() { @@ -444,7 +444,7 @@ public abstract class GeometryArray extends Geometry { * include <code>COORDINATES</code> * * @exception IllegalArgumentException if the <code>USE_COORD_INDEX_ONLY</code> - * bit or the <code>BY_REFERENCE_INDICES</code> bit is set for + * bit or the <code>BY_REFERENCE_INDICES</code> bit is set for * non-indexed geometry arrays (that is, GeometryArray objects * that are not a subclass of IndexedGeometryArray) * @@ -457,9 +457,9 @@ public abstract class GeometryArray extends Geometry { * @exception IllegalArgumentException if the <code>INTERLEAVED</code> * bit and the <code>VERTEX_ATTRIBUTES</code> bit are both set * - * @exception IllegalArgumentException if the + * @exception IllegalArgumentException if the * <code>BY_REFERENCE_INDICES</code> - * bit is set without the <code>BY_REFERENCE</code> and + * bit is set without the <code>BY_REFERENCE</code> and * <code>USE_COORD_INDEX_ONLY</code> bits being set */ public GeometryArray(int vertexCount, int vertexFormat) { @@ -578,7 +578,7 @@ public abstract class GeometryArray extends Geometry { * include <code>COORDINATES</code> * * @exception IllegalArgumentException if the <code>USE_COORD_INDEX_ONLY</code> - * bit or the <code>BY_REFERENCE_INDICES</code> bit is set for + * bit or the <code>BY_REFERENCE_INDICES</code> bit is set for * non-indexed geometry arrays (that is, GeometryArray objects * that are not a subclass of IndexedGeometryArray) * @@ -591,9 +591,9 @@ public abstract class GeometryArray extends Geometry { * @exception IllegalArgumentException if the <code>INTERLEAVED</code> * bit and the <code>VERTEX_ATTRIBUTES</code> bit are both set * - * @exception IllegalArgumentException if the + * @exception IllegalArgumentException if the * <code>BY_REFERENCE_INDICES</code> - * bit is set without the <code>BY_REFERENCE</code> and + * bit is set without the <code>BY_REFERENCE</code> and * <code>USE_COORD_INDEX_ONLY</code> bits being set * * @exception IllegalArgumentException if @@ -733,7 +733,7 @@ public abstract class GeometryArray extends Geometry { * include <code>COORDINATES</code> * * @exception IllegalArgumentException if the <code>USE_COORD_INDEX_ONLY</code> - * bit or the <code>BY_REFERENCE_INDICES</code> bit is set for + * bit or the <code>BY_REFERENCE_INDICES</code> bit is set for * non-indexed geometry arrays (that is, GeometryArray objects * that are not a subclass of IndexedGeometryArray) * @@ -746,9 +746,9 @@ public abstract class GeometryArray extends Geometry { * @exception IllegalArgumentException if the <code>INTERLEAVED</code> * bit and the <code>VERTEX_ATTRIBUTES</code> bit are both set * - * @exception IllegalArgumentException if the + * @exception IllegalArgumentException if the * <code>BY_REFERENCE_INDICES</code> - * bit is set without the <code>BY_REFERENCE</code> and + * bit is set without the <code>BY_REFERENCE</code> and * <code>USE_COORD_INDEX_ONLY</code> bits being set * * @exception IllegalArgumentException if @@ -844,13 +844,13 @@ public abstract class GeometryArray extends Geometry { texCoord4fArray = new TexCoord4f[1]; } } - + if ((vertexFormat & VERTEX_ATTRIBUTES) != 0) { if (vertexAttrCount > 0) { if (vertexAttrCount != vertexAttrSizes.length) { throw new IllegalArgumentException(J3dI18N.getString("GeometryArray132")); } - + for (int i = 0; i < vertexAttrSizes.length; i++) { if (vertexAttrSizes[i] < 1 || vertexAttrSizes[i] > 4) { throw new IllegalArgumentException(J3dI18N.getString("GeometryArray133")); @@ -866,10 +866,10 @@ public abstract class GeometryArray extends Geometry { throw new IllegalArgumentException(J3dI18N.getString("GeometryArray131")); } } - + // set default read capabilities setDefaultReadCapabilities(readCapabilities); - + ((GeometryArrayRetained)this.retained).createGeometryArrayData( vertexCount, vertexFormat, texCoordSetCount, texCoordSetMap, @@ -1642,7 +1642,7 @@ public abstract class GeometryArray extends Geometry { * constructor <code>vertexFormat</code> or array index for element is out of bounds. * @exception IllegalStateException if the data mode for this geometry * array object is <code>BY_REFERENCE</code>. - * @exception IllegalStateException if COLOR_4 is specified in the vertex + * @exception IllegalStateException if COLOR_4 is specified in the vertex * format */ public void setColor(int index, Color3f color) { @@ -1659,7 +1659,7 @@ public abstract class GeometryArray extends Geometry { if ((format & WITH_ALPHA) != 0) throw new IllegalStateException(J3dI18N.getString("GeometryArray92")); - + ((GeometryArrayRetained)this.retained).setColor(index, color); } @@ -1674,7 +1674,7 @@ public abstract class GeometryArray extends Geometry { * constructor <code>vertexFormat</code> or array index for element is out of bounds. * @exception IllegalStateException if the data mode for this geometry * array object is <code>BY_REFERENCE</code>. - * @exception IllegalStateException if COLOR_3 is specified in the vertex + * @exception IllegalStateException if COLOR_3 is specified in the vertex * format */ public void setColor(int index, Color4f color) { @@ -1706,7 +1706,7 @@ public abstract class GeometryArray extends Geometry { * constructor <code>vertexFormat</code> or array index for element is out of bounds. * @exception IllegalStateException if the data mode for this geometry * array object is <code>BY_REFERENCE</code>. - * @exception IllegalStateException if COLOR_4 is specified in the vertex + * @exception IllegalStateException if COLOR_4 is specified in the vertex * format */ public void setColor(int index, Color3b color) { @@ -1738,7 +1738,7 @@ public abstract class GeometryArray extends Geometry { * constructor <code>vertexFormat</code> or array index for element is out of bounds. * @exception IllegalStateException if the data mode for this geometry * array object is <code>BY_REFERENCE</code>. - * @exception IllegalStateException if COLOR_3 is specified in the vertex + * @exception IllegalStateException if COLOR_3 is specified in the vertex * format */ public void setColor(int index, Color4b color) { @@ -2405,7 +2405,7 @@ public abstract class GeometryArray extends Geometry { if(!this.getCapability(ALLOW_TEXCOORD_WRITE)) throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray39")); - if (((((GeometryArrayRetained)this.retained).vertexFormat) & + if (((((GeometryArrayRetained)this.retained).vertexFormat) & (TEXTURE_COORDINATE_3 | TEXTURE_COORDINATE_4)) != 0) throw new IllegalStateException(J3dI18N.getString("GeometryArray94")); @@ -2454,7 +2454,7 @@ public abstract class GeometryArray extends Geometry { if(!this.getCapability(ALLOW_TEXCOORD_WRITE)) throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray39")); - if (((((GeometryArrayRetained)this.retained).vertexFormat) & + if (((((GeometryArrayRetained)this.retained).vertexFormat) & (TEXTURE_COORDINATE_2 | TEXTURE_COORDINATE_4)) != 0) throw new IllegalStateException(J3dI18N.getString("GeometryArray95")); @@ -2494,7 +2494,7 @@ public abstract class GeometryArray extends Geometry { if(!this.getCapability(ALLOW_TEXCOORD_WRITE)) throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray39")); - if (((((GeometryArrayRetained)this.retained).vertexFormat) & + if (((((GeometryArrayRetained)this.retained).vertexFormat) & (TEXTURE_COORDINATE_2 | TEXTURE_COORDINATE_3)) != 0) throw new IllegalStateException(J3dI18N.getString("GeometryArray109")); @@ -2548,7 +2548,7 @@ public abstract class GeometryArray extends Geometry { else if ((format & GeometryArray.TEXTURE_COORDINATE_3) != 0) ((GeometryArrayRetained)this.retained).setTextureCoordinates( texCoordSet, index, texCoords, 0, texCoords.length / 3); - else + else ((GeometryArrayRetained)this.retained).setTextureCoordinates( texCoordSet, index, texCoords, 0, texCoords.length / 4); } @@ -2600,7 +2600,7 @@ public abstract class GeometryArray extends Geometry { if(!this.getCapability(ALLOW_TEXCOORD_WRITE)) throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray42")); - if (((((GeometryArrayRetained)this.retained).vertexFormat) & + if (((((GeometryArrayRetained)this.retained).vertexFormat) & (TEXTURE_COORDINATE_3 | TEXTURE_COORDINATE_4)) != 0) throw new IllegalStateException(J3dI18N.getString("GeometryArray94")); @@ -2655,7 +2655,7 @@ public abstract class GeometryArray extends Geometry { throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray42")); - if (((((GeometryArrayRetained)this.retained).vertexFormat) & + if (((((GeometryArrayRetained)this.retained).vertexFormat) & (TEXTURE_COORDINATE_2 | TEXTURE_COORDINATE_4)) != 0) throw new IllegalStateException(J3dI18N.getString("GeometryArray95")); @@ -2697,7 +2697,7 @@ public abstract class GeometryArray extends Geometry { throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray42")); - if (((((GeometryArrayRetained)this.retained).vertexFormat) & + if (((((GeometryArrayRetained)this.retained).vertexFormat) & (TEXTURE_COORDINATE_2 | TEXTURE_COORDINATE_3)) != 0) throw new IllegalStateException(J3dI18N.getString("GeometryArray109")); @@ -2722,7 +2722,7 @@ public abstract class GeometryArray extends Geometry { * ending at index <code>start+length</code>. * * @param index starting destination vertex index in this geometry array - * @param texCoords source array of 2*n , 3*n or 4*n values containing + * @param texCoords source array of 2*n , 3*n or 4*n values containing * n new texture coordinates * @param start starting source vertex index in <code>texCoords</code> * array. @@ -2792,7 +2792,7 @@ public abstract class GeometryArray extends Geometry { * @exception IllegalStateException if the data mode for this geometry * array object is <code>BY_REFERENCE</code>. * - * @exception IllegalStateException if TEXTURE_COORDINATE_3 or + * @exception IllegalStateException if TEXTURE_COORDINATE_3 or * TEXTURE_COORDINATE_4 is specified in vertex format * * @since Java 3D 1.2 @@ -2804,7 +2804,7 @@ public abstract class GeometryArray extends Geometry { if(!this.getCapability(ALLOW_TEXCOORD_WRITE)) throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray42")); - if (((((GeometryArrayRetained)this.retained).vertexFormat) & + if (((((GeometryArrayRetained)this.retained).vertexFormat) & (TEXTURE_COORDINATE_3 | TEXTURE_COORDINATE_4)) != 0) throw new IllegalStateException(J3dI18N.getString("GeometryArray94")); @@ -2863,7 +2863,7 @@ public abstract class GeometryArray extends Geometry { if(!this.getCapability(ALLOW_TEXCOORD_WRITE)) throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray42")); - if (((((GeometryArrayRetained)this.retained).vertexFormat) & + if (((((GeometryArrayRetained)this.retained).vertexFormat) & (TEXTURE_COORDINATE_2 | TEXTURE_COORDINATE_4)) != 0) throw new IllegalStateException(J3dI18N.getString("GeometryArray95")); @@ -2908,7 +2908,7 @@ public abstract class GeometryArray extends Geometry { if(!this.getCapability(ALLOW_TEXCOORD_WRITE)) throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray42")); - if (((((GeometryArrayRetained)this.retained).vertexFormat) & + if (((((GeometryArrayRetained)this.retained).vertexFormat) & (TEXTURE_COORDINATE_2 | TEXTURE_COORDINATE_3)) != 0) throw new IllegalStateException(J3dI18N.getString("GeometryArray109")); @@ -3702,7 +3702,7 @@ public abstract class GeometryArray extends Geometry { /** * Gets the color associated with the vertex at * the specified index for this object. The color is copied into the - * specified array. The array must be large enough to hold all + * specified array. The array must be large enough to hold all * of the colors. * @param index source vertex index in this geometry array * @param color destination array of 3 or 4 values that will receive the color @@ -3886,7 +3886,7 @@ public abstract class GeometryArray extends Geometry { * many colors as the array will hold are copied. * * @param index starting source vertex index in this geometry array - * @param colors destination array of 3*n or 4*n values that will + * @param colors destination array of 3*n or 4*n values that will * receive n new colors * @exception CapabilityNotSetException if the appropriate capability is * not set and this object is part of a live or compiled scene graph @@ -3921,7 +3921,7 @@ public abstract class GeometryArray extends Geometry { * many colors as the array will hold are copied. * * @param index starting source vertex index in this geometry array - * @param colors destination array of 3*n or 4*n values that will + * @param colors destination array of 3*n or 4*n values that will * receive new colors * @exception CapabilityNotSetException if the appropriate capability is * not set and this object is part of a live or compiled scene graph @@ -5104,7 +5104,7 @@ public abstract class GeometryArray extends Geometry { if (initialCoordIndex < 0) throw new IllegalArgumentException(J3dI18N.getString("GeometryArray97")); if ((format & BY_REFERENCE) == 0) - throw new IllegalStateException(J3dI18N.getString("GeometryArray83")); + throw new IllegalStateException(J3dI18N.getString("GeometryArray83")); if ((format & INTERLEAVED) != 0) throw new IllegalStateException(J3dI18N.getString("GeometryArray84")); @@ -5182,7 +5182,7 @@ public abstract class GeometryArray extends Geometry { throw new IllegalArgumentException(J3dI18N.getString("GeometryArray97")); int format = ((GeometryArrayRetained)this.retained).vertexFormat; if ((format & BY_REFERENCE) == 0) - throw new IllegalStateException(J3dI18N.getString("GeometryArray83")); + throw new IllegalStateException(J3dI18N.getString("GeometryArray83")); if ((format & INTERLEAVED) != 0) throw new IllegalStateException(J3dI18N.getString("GeometryArray84")); @@ -5541,7 +5541,7 @@ public abstract class GeometryArray extends Geometry { throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray86")); int format = ((GeometryArrayRetained)this.retained).vertexFormat; - + if ((format & USE_NIO_BUFFER) == 0) throw new IllegalStateException(J3dI18N.getString("GeometryArray118")); @@ -5925,7 +5925,7 @@ public abstract class GeometryArray extends Geometry { throw new IllegalStateException(J3dI18N.getString("GeometryArray84")); ((GeometryArrayRetained)this.retained).setColorRefBuffer(colors); - + } @@ -5955,7 +5955,7 @@ public abstract class GeometryArray extends Geometry { if ((format & INTERLEAVED) != 0) throw new IllegalStateException(J3dI18N.getString("GeometryArray84")); - return ((GeometryArrayRetained)this.retained).getColorRefBuffer(); + return ((GeometryArrayRetained)this.retained).getColorRefBuffer(); } @@ -6474,7 +6474,7 @@ public abstract class GeometryArray extends Geometry { if ((format & INTERLEAVED) != 0) throw new IllegalStateException(J3dI18N.getString("GeometryArray84")); - return ((GeometryArrayRetained)this.retained).getNormalRefBuffer(); + return ((GeometryArrayRetained)this.retained).getNormalRefBuffer(); } @@ -6631,9 +6631,9 @@ public abstract class GeometryArray extends Geometry { * texture coordinate set to the * specified buffer object. The buffer contains a java.nio.FloatBuffer * object containing <i>s</i>, - * <i>t</i>, and, optionally, <i>r</i> and <i>q</i> values for each + * <i>t</i>, and, optionally, <i>r</i> and <i>q</i> values for each * vertex (for - * a total of 2*<i>n</i> , 3*<i>n</i> or 4*<i>n</i> values, + * a total of 2*<i>n</i> , 3*<i>n</i> or 4*<i>n</i> values, * where <i>n</i> is * the number of vertices). * If the texCoord buffer reference is null and texture @@ -6735,7 +6735,7 @@ public abstract class GeometryArray extends Geometry { if ((format & INTERLEAVED) != 0) throw new IllegalStateException(J3dI18N.getString("GeometryArray84")); - return ((GeometryArrayRetained)this.retained).getTexCoordRefBuffer(texCoordSet); + return ((GeometryArrayRetained)this.retained).getTexCoordRefBuffer(texCoordSet); } @@ -6743,9 +6743,9 @@ public abstract class GeometryArray extends Geometry { * Sets the float texture coordinate array reference for the specified * texture coordinate set to the * specified array. The array contains floating-point <i>s</i>, - * <i>t</i>, and, optionally, <i>r</i> and <i>q</i> values for each + * <i>t</i>, and, optionally, <i>r</i> and <i>q</i> values for each * vertex (for - * a total of 2*<i>n</i> , 3*<i>n</i> or 4*<i>n</i> values, + * a total of 2*<i>n</i> , 3*<i>n</i> or 4*<i>n</i> values, * where <i>n</i> is * the number of vertices). Only one of * <code>texCoordRefFloat</code>, <code>texCoordRef2f</code>, or diff --git a/src/classes/share/javax/media/j3d/GeometryArrayRetained.java b/src/classes/share/javax/media/j3d/GeometryArrayRetained.java index 190029c..869a208 100644 --- a/src/classes/share/javax/media/j3d/GeometryArrayRetained.java +++ b/src/classes/share/javax/media/j3d/GeometryArrayRetained.java @@ -4660,7 +4660,7 @@ abstract class GeometryArrayRetained extends GeometryRetained{ this.vertexData[offset] = normal[0]; this.vertexData[offset+1] = normal[1]; this.vertexData[offset+2] = normal[2]; - + if(isLive) { geomLock.unLock(); sendDataChangedMessage(false); diff --git a/src/classes/share/javax/media/j3d/GeometryAtom.java b/src/classes/share/javax/media/j3d/GeometryAtom.java index e7286db..7891ba1 100644 --- a/src/classes/share/javax/media/j3d/GeometryAtom.java +++ b/src/classes/share/javax/media/j3d/GeometryAtom.java @@ -39,21 +39,21 @@ import javax.vecmath.*; */ class GeometryAtom extends Object implements BHLeafInterface, NnuId { - + /** * Array of geometry components of this geometry atom */ // The first index of geometryArr should always be 0, unless geometryArr contains // multiple Text3Ds. GeometryRetained[] geometryArray = null; - + /** * Array of transforms used only for Text3d. */ Transform3D[] lastLocalTransformArray = null; - /** + /** * The locale that this geometry atom is attatched to. This is only non-null * if this instance is directly linked into a locale. */ @@ -63,18 +63,18 @@ class GeometryAtom extends Object implements BHLeafInterface, NnuId { * The mirror Shape3DRetained for this GeometryAtom. */ Shape3DRetained source = null; - + /** * The BHLeafNode for this GeometryAtom. */ - BHLeafNode bhLeafNode = null; - + BHLeafNode bhLeafNode = null; + // true if alpha channel is editable boolean alphaEditable; - + // true if this ga is visible. Default is true. boolean visible = true; - + /** * This is the original geometry type from which this atom came */ @@ -114,22 +114,22 @@ class GeometryAtom extends Object implements BHLeafInterface, NnuId { return 0; } } - + public BoundingBox computeBoundingHull() { /* - System.err.println("Bounds is " + source.vwcBounds); + System.err.println("Bounds is " + source.vwcBounds); for(int i=0; i<geometryArray.length; i++) { System.err.println( i + " geoBounds " + geometryArray[i].geoBounds); } */ - + return source.vwcBounds; } // This method is use by picking and collision queries. public boolean isEnable() { - return ((source.vwcBounds != null) && + return ((source.vwcBounds != null) && (source.vwcBounds.isEmpty() == false) && (source.switchState.currentSwitchOn)); } @@ -154,7 +154,7 @@ class GeometryAtom extends Object implements BHLeafInterface, NnuId { return locale; } - + /** * Gets a RenderAtom for the given viewIndex. * If it doesn't exist, it creates one. @@ -181,7 +181,7 @@ class GeometryAtom extends Object implements BHLeafInterface, NnuId { ra = new RenderAtom(); newList[index] = ra; newList[index].geometryAtom = this; - + // Allocate space based on number of geometry in the list ra.rListInfo = new RenderAtomListInfo[geometryArray.length]; if (geoType != GeometryRetained.GEO_TYPE_TEXT3D) { @@ -238,7 +238,7 @@ class GeometryAtom extends Object implements BHLeafInterface, NnuId { } } } - + return (renderAtoms[index]); } // If the renderAtom is transparent, then make sure that the @@ -273,7 +273,7 @@ class GeometryAtom extends Object implements BHLeafInterface, NnuId { return; } // End of new for 1.3.2 - + synchronized(lockObj) { for (int j = 0; j < geometryArray.length; j++) { if (geometryArray[j] == null) diff --git a/src/classes/share/javax/media/j3d/GeometryDecompressor.java b/src/classes/share/javax/media/j3d/GeometryDecompressor.java index f42ffb7..e925f04 100644 --- a/src/classes/share/javax/media/j3d/GeometryDecompressor.java +++ b/src/classes/share/javax/media/j3d/GeometryDecompressor.java @@ -51,7 +51,7 @@ abstract class GeometryDecompressor { /** * This method is called when a SetState command is encountered in the - * decompression stream. + * decompression stream. * * @param bundlingNorm true indicates normals are bundled with vertices * @param bundlingColor true indicates colors are bundled with vertices @@ -65,11 +65,11 @@ abstract class GeometryDecompressor { * This method captures the vertex output of the decompressor. The normal * or color references may be null if the corresponding data is not * bundled with the vertices in the compressed geometry buffer. Alpha - * values may be included in the color. - * + * values may be included in the color. + * * @param position The coordinates of the vertex. * @param normal The normal bundled with the vertex. May be null. - * @param color The color bundled with the vertex. May be null. + * @param color The color bundled with the vertex. May be null. * Alpha may be present. * @param vertexReplaceCode Specifies the generalized strip flag * that is bundled with each vertex. @@ -129,7 +129,7 @@ abstract class GeometryDecompressor { " shift: " + rightShift + " abs/rel: " + absolute ; } - } + } // A 16-entry mesh buffer is used. private MeshBufferEntry meshBuffer[] ; @@ -186,7 +186,7 @@ abstract class GeometryDecompressor { 0xFFFFF, 0x1FFFFF, 0x3FFFFF, 0x7FFFFF, 0xFFFFFF, 0x1FFFFFF, 0x3FFFFFF, 0x7FFFFFF, 0xFFFFFFF, 0x1FFFFFFF, 0x3FFFFFFF, 0x7FFFFFFF, - 0xFFFFFFFF, + 0xFFFFFFFF, } ; // A reference to the compressed data and the current offset. @@ -267,7 +267,7 @@ abstract class GeometryDecompressor { gctables[1][i] = new HuffmanTableEntry() ; gctables[2][i] = new HuffmanTableEntry() ; } - + meshBuffer = new MeshBufferEntry[16] ; for (int i = 0 ; i < 16 ; i++) meshBuffer[i] = new MeshBufferEntry() ; @@ -297,9 +297,9 @@ abstract class GeometryDecompressor { " start: " + start + " length: " + length + " data array size: " + data.length) ; - if (benchmark) + if (benchmark) benchmarkStart(length) ; - + if (start+length > data.length) throw new ArrayIndexOutOfBoundsException (J3dI18N.getString("GeometryDecompressor0")) ; @@ -347,7 +347,7 @@ abstract class GeometryDecompressor { if (debug) System.err.println(": got 0x0") ; return 0 ; } - + if (bitBufferCount == 0) { bitBuffer = (((gcData[gcIndex++] & 0xff) << 24) | ((gcData[gcIndex++] & 0xff) << 16) | @@ -454,7 +454,7 @@ abstract class GeometryDecompressor { // // Decode the opcode in currentHeader, and dispatch to the appropriate - // processing method. + // processing method. // private int processDecompressionOpcode(int mbp) { if ((currentHeader & 0xC0) == GC_SET_NORM) @@ -490,7 +490,7 @@ abstract class GeometryDecompressor { processPassThrough() ; else if ((currentHeader & 0xFF) == GC_SKIP_8) processSkip8() ; - + return 0 ; } @@ -907,12 +907,12 @@ abstract class GeometryDecompressor { ny = (float)gcNormals[v][u][1] ; nz = (float)gcNormals[v][u][2] ; - // reverse the swap + // reverse the swap if ((sex & 0x4) != 0) { t = nx ; nx = nz ; nz = t ; } if ((sex & 0x2) != 0) { t = ny ; ny = nz ; nz = t ; } if ((sex & 0x1) != 0) { t = nx ; nx = ny ; ny = t ; } - // reverse the sign flip + // reverse the sign flip if ((oct & 0x1) != 0) nz = -nz ; if ((oct & 0x2) != 0) ny = -ny ; if ((oct & 0x4) != 0) nx = -nx ; @@ -990,7 +990,7 @@ abstract class GeometryDecompressor { a = (a << (dataLength - (6-gct.tagLength - 3*dataLength))) | ii ; } - } + } } else { ii = getBits(dataLength - (6 - gct.tagLength - 2*dataLength), "b") ; @@ -1138,7 +1138,7 @@ abstract class GeometryDecompressor { curColor.w = curA ; curColor.w /= 32768.0 ; } if (debug) - System.err.println(" retrieved color " + curColor.x + + System.err.println(" retrieved color " + curColor.x + " " + curColor.y + " " + curColor.z + " " + curColor.w) ; } @@ -1191,7 +1191,7 @@ abstract class GeometryDecompressor { float t = (J3dClock.currentTimeMillis() - startTime) / 1000.0f ; System.err.println (" done in " + t + " sec." + "\n" + - " decompressed " + vertexCount + " vertices at " + + " decompressed " + vertexCount + " vertices at " + (vertexCount/t) + " vertices/sec\n") ; System.err.print(" vertex data present: coords") ; diff --git a/src/classes/share/javax/media/j3d/GeometryDecompressorRetained.java b/src/classes/share/javax/media/j3d/GeometryDecompressorRetained.java index c1718dd..ccf55ca 100644 --- a/src/classes/share/javax/media/j3d/GeometryDecompressorRetained.java +++ b/src/classes/share/javax/media/j3d/GeometryDecompressorRetained.java @@ -84,13 +84,13 @@ class GeometryDecompressorRetained extends GeometryDecompressor { private long endTime ; // Private convenience copies of various constants. - private static final int TYPE_POINT = + private static final int TYPE_POINT = CompressedGeometryRetained.TYPE_POINT ; - private static final int TYPE_LINE = + private static final int TYPE_LINE = CompressedGeometryRetained.TYPE_LINE ; - private static final int TYPE_TRIANGLE = + private static final int TYPE_TRIANGLE = CompressedGeometryRetained.TYPE_TRIANGLE ; - private static final int FRONTFACE_CCW = + private static final int FRONTFACE_CCW = GeneralizedStripFlags.FRONTFACE_CCW ; /** @@ -105,7 +105,7 @@ class GeometryDecompressorRetained extends GeometryDecompressor { } /** - * If the given argument is true, sets the decompressor to output only the + * If the given argument is true, sets the decompressor to output only the * decompressed positions, their connections, and the bounding box. * @param positionsOnly set to true if the decompressor should output only * position, connection, and bounding box data. @@ -121,12 +121,12 @@ class GeometryDecompressorRetained extends GeometryDecompressor { * efficient rendering. Global color and normal changes output by the * decompressor are stored as redundant per-vertex data so that a single * GeometryArray can be used. - * + * * Since only one GeometryArray is created, if the bundling attributes * change while building the vertex list then the decompression is * aborted. There should be only one SetState bundling attribute command * per CompressedGeometry. - * + * * @param cgr CompressedGeometryRetained containing compressed geometry * @return GeometryArrayRetained containing the results of the * decompression, or null if only the bounds are computed. @@ -156,7 +156,7 @@ class GeometryDecompressorRetained extends GeometryDecompressor { if (boundsOnly) { if (printInfo) endPrint() ; return null ; - } + } // Convert the output to a GeometryRetained. GeometryArray ga ; @@ -183,7 +183,7 @@ class GeometryDecompressorRetained extends GeometryDecompressor { } /** - * Get the bounds of the decompressed geometry. + * Get the bounds of the decompressed geometry. * @param bb BoundingBox to receive bounds */ void getBoundingBox(BoundingBox bb) { @@ -264,7 +264,7 @@ class GeometryDecompressorRetained extends GeometryDecompressor { if (vlist.size() > 0) throw new IllegalStateException (J3dI18N.getString("GeometryDecompressorRetained2")) ; - + vlist.setVertexFormat(vlist.vertexFormat | GeometryArray.COLOR) ; } @@ -287,7 +287,7 @@ class GeometryDecompressorRetained extends GeometryDecompressor { if (vlist.size() > 0) throw new IllegalStateException (J3dI18N.getString("GeometryDecompressorRetained3")) ; - + vlist.setVertexFormat(vlist.vertexFormat | GeometryArray.NORMALS) ; } @@ -334,7 +334,7 @@ class GeometryDecompressorRetained extends GeometryDecompressor { if (benchmark || statistics) printBench() ; - + if (statistics) printStats() ; } @@ -368,7 +368,7 @@ class GeometryDecompressorRetained extends GeometryDecompressor { (" decompressed " + (vlist.vertexCount - 2*vlist.stripCount) + " triangles at " + - ((vlist.vertexCount - 2*vlist.stripCount)/t) + + ((vlist.vertexCount - 2*vlist.stripCount)/t) + " triangles/sec.\n") ; break ; } @@ -395,7 +395,7 @@ class GeometryDecompressorRetained extends GeometryDecompressor { System.err.print(" alpha") ; System.err.println("\n number of strips: " + vlist.stripCount) ; - if (vlist.stripCount > 0) + if (vlist.stripCount > 0) System.err.println (" vertices/strip: " + ((float)vlist.vertexCount / (float)vlist.stripCount)) ; diff --git a/src/classes/share/javax/media/j3d/GeometryDecompressorShape3D.java b/src/classes/share/javax/media/j3d/GeometryDecompressorShape3D.java index 759d3bc..e1f3d07 100644 --- a/src/classes/share/javax/media/j3d/GeometryDecompressorShape3D.java +++ b/src/classes/share/javax/media/j3d/GeometryDecompressorShape3D.java @@ -80,17 +80,17 @@ class GeometryDecompressorShape3D extends GeometryDecompressor { private static final int TRI_STRIP_AND_TRI_SET = 3 ; // Private convenience copies of various constants. - private static final int TYPE_POINT = + private static final int TYPE_POINT = CompressedGeometryRetained.TYPE_POINT ; - private static final int TYPE_LINE = + private static final int TYPE_LINE = CompressedGeometryRetained.TYPE_LINE ; - private static final int TYPE_TRIANGLE = + private static final int TYPE_TRIANGLE = CompressedGeometryRetained.TYPE_TRIANGLE ; - private static final int FRONTFACE_CCW = + private static final int FRONTFACE_CCW = GeneralizedStripFlags.FRONTFACE_CCW ; /** - * Decompress the given compressed geometry. + * Decompress the given compressed geometry. * @param cgr CompressedGeometryRetained object with compressed geometry * @return an array of Shape3D with TriangleArray geometry if compressed * data contains triangles; otherwise, Shape3D array containing PointArray @@ -104,7 +104,7 @@ class GeometryDecompressorShape3D extends GeometryDecompressor { /** - * Decompress the given compressed geometry. + * Decompress the given compressed geometry. * @param cgr CompressedGeometryRetained object with compressed geometry * @return an array of Shape3D with TriangleStripArray geometry if * compressed data contains triangles; otherwise, Shape3D array containing @@ -118,7 +118,7 @@ class GeometryDecompressorShape3D extends GeometryDecompressor { /** - * Decompress the given compressed geometry. + * Decompress the given compressed geometry. * @param cgr CompressedGeometryRetained object with compressed geometry * @return an array of Shape3D with TriangleStripArray and * TriangleFanArray geometry if compressed data contains triangles; @@ -133,7 +133,7 @@ class GeometryDecompressorShape3D extends GeometryDecompressor { /** - * Decompress the given compressed geometry. + * Decompress the given compressed geometry. * @param cgr CompressedGeometryRetained object with compressed geometry * @return an array of Shape3D with TriangleStripArray and * TriangleArray geometry if compressed data contains triangles; @@ -151,7 +151,7 @@ class GeometryDecompressorShape3D extends GeometryDecompressor { * return an array of Shape3D objects using the specified triangle output * type. The triangle output type is ignored if the compressed data * contains points or lines. - */ + */ private Shape3D[] decompress(CompressedGeometryRetained cgr, int triOutputType) { @@ -195,7 +195,7 @@ class GeometryDecompressorShape3D extends GeometryDecompressor { if (vlist != null) // Construct shapes using the current vertex format. addShape3D() ; - + int vertexFormat = GeometryArray.COORDINATES ; if (bundlingNorm) vertexFormat |= GeometryArray.NORMALS ; @@ -259,7 +259,7 @@ class GeometryDecompressorShape3D extends GeometryDecompressor { if (vlist.size() > 0) // Construct Shape3D using the current vertex format. addShape3D() ; - + // Start a new vertex list with the new format. vlist = new GeneralizedVertexList (vlist.vertexFormat|GeometryArray.NORMALS, FRONTFACE_CCW) ; @@ -395,7 +395,7 @@ class GeometryDecompressorShape3D extends GeometryDecompressor { if (benchmark || statistics) printBench() ; - + if (statistics) printStats() ; } @@ -452,11 +452,11 @@ class GeometryDecompressorShape3D extends GeometryDecompressor { System.err.println(vertexCount) ; } else if (triOutputType == TRI_STRIP_AND_TRI_SET) { - System.err.println((vertexCount + triangleCount*3) + + System.err.println((vertexCount + triangleCount*3) + "\n number of strips: " + stripCount + "\n number of individual triangles: " + triangleCount) ; - if (stripCount > 0) + if (stripCount > 0) System.err.println (" vertices/strip: " + (float)vertexCount/stripCount + "\n triangles represented in strips: " + @@ -465,7 +465,7 @@ class GeometryDecompressorShape3D extends GeometryDecompressor { else { System.err.println(vertexCount + "\n number of strips: " + stripCount) ; - if (stripCount > 0) + if (stripCount > 0) System.err.println (" vertices/strip: " + (float)vertexCount/stripCount) ; } diff --git a/src/classes/share/javax/media/j3d/GeometryLock.java b/src/classes/share/javax/media/j3d/GeometryLock.java index 09df730..1f5333d 100644 --- a/src/classes/share/javax/media/j3d/GeometryLock.java +++ b/src/classes/share/javax/media/j3d/GeometryLock.java @@ -36,7 +36,7 @@ import java.util.Vector; class GeometryLock { // Current thread holding the lock - Thread threadId = null; + Thread threadId = null; // Whether the lock is currently owned boolean lockOwned = false; @@ -85,7 +85,7 @@ class GeometryLock { notify(); } } - + } - + } diff --git a/src/classes/share/javax/media/j3d/GeometryRetained.java b/src/classes/share/javax/media/j3d/GeometryRetained.java index 1ae4496..fb548f4 100644 --- a/src/classes/share/javax/media/j3d/GeometryRetained.java +++ b/src/classes/share/javax/media/j3d/GeometryRetained.java @@ -69,7 +69,7 @@ abstract class GeometryRetained extends NodeComponentRetained { boolean boundsDirty = true; // Changed while holding the geoBounds lock int computeGeoBounds = 0; // Changed while holding the geoBounds lock - + // The "type" of this object int geoType = GEO_TYPE_NONE; @@ -102,7 +102,7 @@ abstract class GeometryRetained extends NodeComponentRetained { // above. ArrayList<ArrayList<Shape3DRetained>> userLists = new ArrayList(); - // true if color not specified with alpha channel + // true if color not specified with alpha channel boolean noAlpha = false; static final double EPSILON = 1.0e-6; @@ -111,16 +111,16 @@ abstract class GeometryRetained extends NodeComponentRetained { // The cached value is evaluated by renderBin and used in determining // whether to put it in display list or not int cachedChangedFrequent = 0; - + static final int POINT_TYPE = 1; static final int LINE_TYPE = 2; static final int TRIANGLE_TYPE = 3; static final int QUAD_TYPE = 4; - static final int RASTER_TYPE = 5; - static final int TEXT3D_TYPE = 6; - static final int COMPRESS_TYPE = 7; + static final int RASTER_TYPE = 5; + static final int TEXT3D_TYPE = 6; + static final int COMPRESS_TYPE = 7; + - boolean isEquivalenceClass( GeometryRetained geometry ) { int t1 = getClassType(); int t2 = geometry.getClassType(); @@ -155,11 +155,11 @@ abstract class GeometryRetained extends NodeComponentRetained { void addUser(Shape3DRetained s) { int index; ArrayList shapeList; - + if (s.sourceNode.boundsAutoCompute) { incrComputeGeoBounds(); } - + // If static, no need to maintain a userlist if (this instanceof GeometryArrayRetained) { if (((GeometryArrayRetained)this).isWriteStatic()) { @@ -189,13 +189,13 @@ abstract class GeometryRetained extends NodeComponentRetained { if (s.sourceNode.boundsAutoCompute) { decrComputeGeoBounds(); } - + if (this instanceof GeometryArrayRetained) { if (((GeometryArrayRetained)this).isWriteStatic()) { return; } } - + synchronized (universeList) { index = universeList.indexOf(s.universe); shapeList = (ArrayList)userLists.get(index); @@ -207,12 +207,12 @@ abstract class GeometryRetained extends NodeComponentRetained { } } - + public void updateObject() { this.update(); } - + abstract void computeBoundingBox(); void setLive(boolean inBackgroundGroup, int refCount) { @@ -223,7 +223,7 @@ abstract class GeometryRetained extends NodeComponentRetained { /** * This setLive routine calls the superclass's method when reference * count is 1 - */ + */ void doSetLive(boolean inBackgroundGroup, int refCount) { super.doSetLive(inBackgroundGroup, refCount); this.update(); @@ -249,10 +249,10 @@ abstract class GeometryRetained extends NodeComponentRetained { // Issue 199 -- Chien abstract boolean intersect(PickShape pickShape, PickInfo pickInfo, int flags, Point3d iPnt, GeometryRetained geom, int geomIndex); - + // Old stuff -- Chien - //abstract boolean intersect(PickShape pickShape, PickInfo.IntersectionInfo iInfo, int flags, Point3d iPnt); - + //abstract boolean intersect(PickShape pickShape, PickInfo.IntersectionInfo iInfo, int flags, Point3d iPnt); + abstract boolean intersect(Bounds targetBound); abstract boolean intersect(Point3d[] pnts); abstract boolean intersect(Transform3D thisToOtherVworld, GeometryRetained geom); @@ -261,12 +261,12 @@ abstract class GeometryRetained extends NodeComponentRetained { int[] vtxIndexArr, Point3d iPnt, double dist) { PickInfo.IntersectionInfo iInfo = null; - + if((flags & PickInfo.CLOSEST_GEOM_INFO) != 0) { PickInfo.IntersectionInfo iInfoArr[] = pickInfo.getIntersectionInfos(); if((iInfoArr == null) || (iInfoArr.length == 0)) { iInfo = pickInfo.createIntersectionInfo(); - pickInfo.insertIntersectionInfo(iInfo); + pickInfo.insertIntersectionInfo(iInfo); } else { assert(iInfoArr.length == 1); @@ -289,7 +289,7 @@ abstract class GeometryRetained extends NodeComponentRetained { iInfo.setVertexIndices(vtxIndexArr); } - boolean intersect(Transform3D thisLocalToVworld, + boolean intersect(Transform3D thisLocalToVworld, Transform3D otherLocalToVworld, GeometryRetained geom) { Transform3D t3d = new Transform3D(); t3d.invert(otherLocalToVworld); diff --git a/src/classes/share/javax/media/j3d/GeometryStripArray.java b/src/classes/share/javax/media/j3d/GeometryStripArray.java index 1e39a28..df008c3 100644 --- a/src/classes/share/javax/media/j3d/GeometryStripArray.java +++ b/src/classes/share/javax/media/j3d/GeometryStripArray.java @@ -244,7 +244,7 @@ public abstract class GeometryStripArray extends GeometryArray { /** * Get a list of vertexCounts for each strip. The list is copied - * into the specified array. The array must be large enough to hold + * into the specified array. The array must be large enough to hold * all of the ints. * @param stripVertexCounts an array that will receive vertexCounts */ diff --git a/src/classes/share/javax/media/j3d/GeometryStripArrayRetained.java b/src/classes/share/javax/media/j3d/GeometryStripArrayRetained.java index 60a6dc5..8078fe1 100644 --- a/src/classes/share/javax/media/j3d/GeometryStripArrayRetained.java +++ b/src/classes/share/javax/media/j3d/GeometryStripArrayRetained.java @@ -144,8 +144,8 @@ abstract class GeometryStripArrayRetained extends GeometryArrayRetained { nullGeo = (interleavedFloatBufferImpl == null); } } - } - + } + for (i=0; i<num-1; i++) { this.stripVertexCounts[i] = stripVertexCounts[i]; stripStartVertexIndices[i+1] = stripStartVertexIndices[i] + @@ -157,10 +157,10 @@ abstract class GeometryStripArrayRetained extends GeometryArrayRetained { geomLock.unLock(); } if (!inUpdater && isLive) { - processCoordsChanged(nullGeo); + processCoordsChanged(nullGeo); sendDataChangedMessage(true); } - + } void unIndexify(IndexedGeometryStripArrayRetained src) { if ((src.vertexFormat & GeometryArray.USE_NIO_BUFFER) == 0) { @@ -182,7 +182,7 @@ abstract class GeometryStripArrayRetained extends GeometryArrayRetained { if ((src.vertexFormat & GeometryArray.BY_REFERENCE) == 0) { vdata = src.vertexData; - if ((src.vertexFormat & GeometryArray.COLOR) != 0) + if ((src.vertexFormat & GeometryArray.COLOR) != 0) colorStride = 4; } else if ((src.vertexFormat & GeometryArray.INTERLEAVED) != 0) { @@ -229,7 +229,7 @@ abstract class GeometryStripArrayRetained extends GeometryArrayRetained { * src.stride + src.textureOffset + src.texCoordSetMapOffset[k], vertexData, - vOffset + textureOffset + + vOffset + textureOffset + texCoordSetMapOffset[k], texCoordStride); } @@ -259,8 +259,8 @@ abstract class GeometryStripArrayRetained extends GeometryArrayRetained { if ((vertexFormat & GeometryArray.NORMALS) != 0){ base = src.initialIndexIndex; vOffset = normalOffset; - switch ((src.vertexType & NORMAL_DEFINED)) { - case NF: + switch ((src.vertexType & NORMAL_DEFINED)) { + case NF: for (i=0; i < src.stripIndexCounts.length; i++) { for (j=0; j < src.stripIndexCounts[i]; j++) { index = j+base; @@ -273,7 +273,7 @@ abstract class GeometryStripArrayRetained extends GeometryArrayRetained { base += src.stripIndexCounts[i]; } break; - case N3F: + case N3F: for (i=0; i < src.stripIndexCounts.length; i++) { for (j=0; j < src.stripIndexCounts[i]; j++) { index = src.indexNormal[j+base]; @@ -296,8 +296,8 @@ abstract class GeometryStripArrayRetained extends GeometryArrayRetained { int multiplier = 3; if ((src.vertexFormat & GeometryArray.WITH_ALPHA) != 0) multiplier = 4; - - switch ((src.vertexType & COLOR_DEFINED)) { + + switch ((src.vertexType & COLOR_DEFINED)) { case CF: for (i=0; i < src.stripIndexCounts.length; i++) { for (j=0; j < src.stripIndexCounts[i]; j++) { @@ -321,7 +321,7 @@ abstract class GeometryStripArrayRetained extends GeometryArrayRetained { base += src.stripIndexCounts[i]; } break; - case CUB: + case CUB: for (i=0; i < src.stripIndexCounts.length; i++) { for (j=0; j < src.stripIndexCounts[i]; j++) { index = src.indexColor[j+base] * multiplier; @@ -339,7 +339,7 @@ abstract class GeometryStripArrayRetained extends GeometryArrayRetained { base += src.stripIndexCounts[i]; } break; - case C3F: + case C3F: for (i=0; i < src.stripIndexCounts.length; i++) { for (j=0; j < src.stripIndexCounts[i]; j++) { index = src.indexColor[j+base]; @@ -352,7 +352,7 @@ abstract class GeometryStripArrayRetained extends GeometryArrayRetained { base += src.stripIndexCounts[i]; } break; - case C4F: + case C4F: for (i=0; i < src.stripIndexCounts.length; i++) { for (j=0; j < src.stripIndexCounts[i]; j++) { index = src.indexColor[j+base]; @@ -365,7 +365,7 @@ abstract class GeometryStripArrayRetained extends GeometryArrayRetained { base += src.stripIndexCounts[i]; } break; - case C3UB: + case C3UB: for (i=0; i < src.stripIndexCounts.length; i++) { for (j=0; j < src.stripIndexCounts[i]; j++) { index = src.indexColor[j+base]; @@ -373,13 +373,13 @@ abstract class GeometryStripArrayRetained extends GeometryArrayRetained { vertexData[vOffset+1] = (src.c3bRefColors[index].y & 0xff) * ByteToFloatScale; vertexData[vOffset+2] = (src.c3bRefColors[index].z & 0xff) * ByteToFloatScale; vertexData[vOffset+3] = 1.0f; - + vOffset += stride; } base += src.stripIndexCounts[i]; } break; - case C4UB: + case C4UB: for (i=0; i < src.stripIndexCounts.length; i++) { for (j=0; j < src.stripIndexCounts[i]; j++) { index = src.indexColor[j+base]; @@ -406,7 +406,7 @@ abstract class GeometryStripArrayRetained extends GeometryArrayRetained { for (j=0; j < src.stripIndexCounts[i]; j++) { index = j+base; - for (k = 0, tOffset = vOffset; + for (k = 0, tOffset = vOffset; k < texCoordSetCount; k++) { System.arraycopy(src.refTexCoords[k], src.indexTexCoord[k][index] @@ -419,13 +419,13 @@ abstract class GeometryStripArrayRetained extends GeometryArrayRetained { base += src.stripIndexCounts[i]; } break; - case T2F: + case T2F: for (i=0; i < src.stripIndexCounts.length; i++) { for (j=0; j < src.stripIndexCounts[i]; j++) { index = j+base; for (k = 0, tOffset = vOffset; k < texCoordSetCount; k++) { - srcOffset = + srcOffset = src.indexTexCoord[k][index]; vertexData[tOffset] = ((TexCoord2f[]) src.refTexCoords[k])[srcOffset].x; @@ -438,13 +438,13 @@ abstract class GeometryStripArrayRetained extends GeometryArrayRetained { base += src.stripIndexCounts[i]; } break; - case T3F: + case T3F: for (i=0; i < src.stripIndexCounts.length; i++) { for (j=0; j < src.stripIndexCounts[i]; j++) { index = j+base; for (k = 0, tOffset = vOffset; k < texCoordSetCount; k++) { - srcOffset = + srcOffset = src.indexTexCoord[k][index]; vertexData[tOffset] = ((TexCoord3f[]) src.refTexCoords[k])[srcOffset].x; @@ -492,7 +492,7 @@ abstract class GeometryStripArrayRetained extends GeometryArrayRetained { if ((vertexFormat & GeometryArray.COORDINATES) != 0){ vOffset = coordinateOffset; base = src.initialIndexIndex; - switch ((src.vertexType & VERTEX_DEFINED)) { + switch ((src.vertexType & VERTEX_DEFINED)) { case PF: for (i=0; i < src.stripIndexCounts.length; i++) { for (j=0; j < src.stripIndexCounts[i]; j++) { @@ -504,9 +504,9 @@ abstract class GeometryStripArrayRetained extends GeometryArrayRetained { vOffset += stride; } base += src.stripIndexCounts[i]; - } + } break; - case PD: + case PD: for (i=0; i < src.stripIndexCounts.length; i++) { for (j=0; j < src.stripIndexCounts[i]; j++) { index = src.indexCoord[j+base] * 3; @@ -518,7 +518,7 @@ abstract class GeometryStripArrayRetained extends GeometryArrayRetained { base += src.stripIndexCounts[i]; } break; - case P3F: + case P3F: for (i=0; i < src.stripIndexCounts.length; i++) { for (j=0; j < src.stripIndexCounts[i]; j++) { index = src.indexCoord[j+base]; @@ -530,7 +530,7 @@ abstract class GeometryStripArrayRetained extends GeometryArrayRetained { base += src.stripIndexCounts[i]; } break; - case P3D: + case P3D: for (i=0; i < src.stripIndexCounts.length; i++) { for (j=0; j < src.stripIndexCounts[i]; j++) { index = src.indexCoord[j+base]; @@ -545,7 +545,7 @@ abstract class GeometryStripArrayRetained extends GeometryArrayRetained { default: break; } - } + } } } @@ -553,9 +553,9 @@ abstract class GeometryStripArrayRetained extends GeometryArrayRetained { int vOffset = 0, srcOffset, tOffset = 0; int base = src.initialIndexIndex; int i,j, k, index, colorStride = 0; - - - // interleaved case + + + // interleaved case if ((src.vertexFormat & GeometryArray.INTERLEAVED) != 0) { if ((src.vertexFormat & GeometryArray.WITH_ALPHA) != 0) colorStride = 4; @@ -574,7 +574,7 @@ abstract class GeometryStripArrayRetained extends GeometryArrayRetained { src.interleavedFloatBufferImpl.get(vertexData, vOffset + colorOffset, colorStride); } else if (colorStride == 3) { src.interleavedFloatBufferImpl.position(src.indexColor[index]*src.stride + src.colorOffset); - src.interleavedFloatBufferImpl.get(vertexData, vOffset + colorOffset, colorStride); + src.interleavedFloatBufferImpl.get(vertexData, vOffset + colorOffset, colorStride); vertexData[vOffset + colorOffset + 3] = 1.0f; } @@ -583,7 +583,7 @@ abstract class GeometryStripArrayRetained extends GeometryArrayRetained { src.interleavedFloatBufferImpl.position((src.indexTexCoord[k][index]) *src.stride + src.textureOffset + src.texCoordSetMapOffset[k]); - + src.interleavedFloatBufferImpl.get(vertexData, vOffset + textureOffset + texCoordSetMapOffset[k], texCoordStride); } @@ -621,8 +621,8 @@ abstract class GeometryStripArrayRetained extends GeometryArrayRetained { int multiplier = 3; if ((src.vertexFormat & GeometryArray.WITH_ALPHA) != 0) multiplier = 4; - - switch ((src.vertexType & COLOR_DEFINED)) { + + switch ((src.vertexType & COLOR_DEFINED)) { case CF: for (i=0; i < src.stripIndexCounts.length; i++) { for (j=0; j < src.stripIndexCounts[i]; j++) { @@ -631,12 +631,12 @@ abstract class GeometryStripArrayRetained extends GeometryArrayRetained { if ((src.vertexFormat & GeometryArray.WITH_ALPHA) != 0) { src.floatBufferRefColors.position(src.indexColor[index]*multiplier); src.floatBufferRefColors.get(vertexData, vOffset, 4); - + } else { src.floatBufferRefColors.position(src.indexColor[index]*multiplier); src.floatBufferRefColors.get(vertexData, vOffset, 3); - + vertexData[vOffset+3] = 1.0f; } vOffset += stride; @@ -644,7 +644,7 @@ abstract class GeometryStripArrayRetained extends GeometryArrayRetained { base += src.stripIndexCounts[i]; } break; - case CUB: + case CUB: for (i=0; i < src.stripIndexCounts.length; i++) { for (j=0; j < src.stripIndexCounts[i]; j++) { index = src.indexColor[j+base] * multiplier; @@ -676,7 +676,7 @@ abstract class GeometryStripArrayRetained extends GeometryArrayRetained { for (j=0; j < src.stripIndexCounts[i]; j++) { index = j+base; - for (k = 0, tOffset = vOffset; + for (k = 0, tOffset = vOffset; k < texCoordSetCount; k++) { texBuffer = (FloatBufferWrapper)(((J3DBuffer) (src.refTexCoordsBuffer[k])).getBufferImpl()); texBuffer.position(src.indexTexCoord[k][index]*texCoordStride); @@ -714,7 +714,7 @@ abstract class GeometryStripArrayRetained extends GeometryArrayRetained { if ((vertexFormat & GeometryArray.COORDINATES) != 0) { vOffset = coordinateOffset; base = src.initialIndexIndex; - switch ((src.vertexType & VERTEX_DEFINED)) { + switch ((src.vertexType & VERTEX_DEFINED)) { case PF: for (i=0; i < src.stripIndexCounts.length; i++) { for (j=0; j < src.stripIndexCounts[i]; j++) { @@ -725,9 +725,9 @@ abstract class GeometryStripArrayRetained extends GeometryArrayRetained { vOffset += stride; } base += src.stripIndexCounts[i]; - } + } break; - case PD: + case PD: for (i=0; i < src.stripIndexCounts.length; i++) { for (j=0; j < src.stripIndexCounts[i]; j++) { index = src.indexCoord[j+base] * 3; @@ -743,7 +743,7 @@ abstract class GeometryStripArrayRetained extends GeometryArrayRetained { default: break; } - } + } } } @@ -786,10 +786,10 @@ abstract class GeometryStripArrayRetained extends GeometryArrayRetained { void mergeGeometryArrays(ArrayList list) { int numMerge = list.size(); int numStrips = 0; - + for (int i = 0; i < numMerge; i++) { - numStrips += + numStrips += ((GeometryStripArrayRetained)list.get(i)).stripVertexCounts.length; } stripVertexCounts = new int[numStrips]; @@ -800,12 +800,12 @@ abstract class GeometryStripArrayRetained extends GeometryArrayRetained { int[] curStripVertexCounts; int[] curStripStartIndices ; int[] curStripOffsetIndices ; - + compileNumStrips = new int[numMerge]; compileStripCountOffset = new int[numMerge]; for (int i = 0; i < numMerge; i++) { - GeometryStripArrayRetained strip = + GeometryStripArrayRetained strip = (GeometryStripArrayRetained)list.get(i); curStripVertexCounts = strip.stripVertexCounts; curStripStartIndices = strip.stripStartVertexIndices; @@ -828,7 +828,7 @@ abstract class GeometryStripArrayRetained extends GeometryArrayRetained { } // Assign the merged validVertexCount validVertexCount = curStripIndexOffset; - + // call the super to merge the vertex data super.mergeGeometryArrays(list); } diff --git a/src/classes/share/javax/media/j3d/GeometryStructure.java b/src/classes/share/javax/media/j3d/GeometryStructure.java index e640c79..a140491 100644 --- a/src/classes/share/javax/media/j3d/GeometryStructure.java +++ b/src/classes/share/javax/media/j3d/GeometryStructure.java @@ -59,9 +59,9 @@ class GeometryStructure extends J3dStructure { * A lock object to prevent concurrent getVisibleBHTree query. */ private Object visLock = new Object(); - + /** - * A lock object to prevent concurrent collideEntryList, + * A lock object to prevent concurrent collideEntryList, * collideExitList using toArray() in BehaviorStructure buildTree() * while clearMirror() is invoked in GeometryStructure removeNode() */ @@ -89,8 +89,8 @@ class GeometryStructure extends J3dStructure { // Support for multi-locale. private Vector3d localeTrans = new Vector3d(); - - + + //The lists of wakeupCriterion object currently in collision. WakeupIndexedList collideEntryList; WakeupIndexedList collideExitList; @@ -103,11 +103,11 @@ class GeometryStructure extends J3dStructure { // When Shape insert/remove for WakeupOnCollisionxxx() using // Group node and USE_GEOMETRY, we need to reevaluate the - // cache geometryAtoms list. + // cache geometryAtoms list. boolean reEvaluateWakeupCollisionGAs; private boolean transformMsg = false; - + /** * Constructor. */ @@ -115,7 +115,7 @@ class GeometryStructure extends J3dStructure { super(u, J3dThread.UPDATE_GEOMETRY); bhNodeCount = 0; bhNodeMax = bhNodeBlockSize; - bhNodeArr = new BHNode[bhNodeMax]; + bhNodeArr = new BHNode[bhNodeMax]; bhTreeMax = 1; bhTreeArr = new BHTree[bhTreeMax]; bhTreeCount=0; @@ -133,12 +133,12 @@ class GeometryStructure extends J3dStructure { wakeupOnCollisionMovement = new WakeupIndexedList(WakeupOnCollisionMovement.class, WakeupOnCollisionMovement.COND_IN_GS_LIST, u); } - + void processMessages(long referenceTime) { J3dMessage m; J3dMessage[] messages = getMessages(referenceTime); int nMsg = getNumMessage(); - + if (nMsg > 0) { reEvaluateWakeupCollisionGAs = false; for (int i=0; i < nMsg; i++) { @@ -163,7 +163,7 @@ class GeometryStructure extends J3dStructure { removeNodes(m); reEvaluateWakeupCollisionGAs = true; break; - case J3dMessage.SHAPE3D_CHANGED: { + case J3dMessage.SHAPE3D_CHANGED: { int comp = ((Integer)m.args[1]).intValue(); if (comp == Shape3DRetained.GEOMETRY_CHANGED) { m.args[0] = m.args[2]; @@ -174,7 +174,7 @@ class GeometryStructure extends J3dStructure { else if (comp == Shape3DRetained.APPEARANCE_CHANGED) { processVisibleChanged(m.args[2], ((GeometryAtom[]) m.args[3])); - } + } break; } case J3dMessage.TEXT3D_DATA_CHANGED: @@ -192,7 +192,7 @@ class GeometryStructure extends J3dStructure { else if (comp == MorphRetained.APPEARANCE_CHANGED) { processVisibleChanged(m.args[2], ((GeometryAtom[]) m.args[3])); - } + } break; } case J3dMessage.REGION_BOUND_CHANGED: @@ -209,36 +209,36 @@ class GeometryStructure extends J3dStructure { ((GeometryAtom[]) m.args[3])); break; } - - lock.writeUnlock(); + + lock.writeUnlock(); m.decRefcount(); } - + if (transformMsg) { targets = universe.transformStructure.getTargetList(); lock.writeLock(); - + processTransformChanged(targets); - + lock.writeUnlock(); - + transformMsg = false; targets = null; } - Arrays.fill(messages, 0, nMsg, null); + Arrays.fill(messages, 0, nMsg, null); } processCollisionDetection(); } - + private int getBHTreeIndex(Locale locale) { int i; for (i=0; i< bhTreeCount; i++) { if (bhTreeArr[i].locale == locale) - return i; + return i; } // Can't find will return -1 so that other // program know this @@ -247,27 +247,27 @@ class GeometryStructure extends J3dStructure { private int getOrAddBHTreeIndex(Locale locale) { int i; - + for (i=0; i< bhTreeCount; i++) { if (bhTreeArr[i].locale == locale) - return i; + return i; } - + if (bhTreeCount >= bhTreeMax) { // allocate a bigger array here.... - if (J3dDebug.devPhase) + if (J3dDebug.devPhase) J3dDebug.doDebug(J3dDebug.geometryStructure, J3dDebug.LEVEL_2, "Expanding bhTreeArr array ...\n"); - bhTreeMax += bhTreeBlockSize; + bhTreeMax += bhTreeBlockSize; BHTree[] oldBhTreeArr = bhTreeArr; - + bhTreeArr = new BHTree[bhTreeMax]; System.arraycopy(oldBhTreeArr, 0, bhTreeArr, 0, oldBhTreeArr.length); } - + bhTreeArr[bhTreeCount] = new BHTree(locale); bhTreeCount++; - return i; + return i; } private void clearBhNodeArr() { @@ -282,42 +282,42 @@ class GeometryStructure extends J3dStructure { } private void addToBhNodeArr(BHNode bhNode) { - + // Add to bhNodeArr. if (bhNodeCount >= bhNodeMax) { - bhNodeMax += bhNodeBlockSize; + bhNodeMax += bhNodeBlockSize; BHNode[] oldbhNodeArr = bhNodeArr; - + bhNodeArr = new BHNode[bhNodeMax]; System.arraycopy(oldbhNodeArr, 0, bhNodeArr, 0, oldbhNodeArr.length); } - + bhNodeArr[bhNodeCount] = bhNode; bhNodeCount++; } - + private void processVisibleChanged(Object valueObj, GeometryAtom[] gaArr) { boolean visible = true; // Default is true. int i, treeIndex; - + if ((gaArr == null) || (gaArr.length < 1)) return; treeIndex = getBHTreeIndex(gaArr[0].locale); - + visible = ((Boolean)valueObj).booleanValue(); - + for ( i=gaArr.length-1; i>=0; i--) { gaArr[i].visible = visible; } - + } - + private void insertNodes(Object[] nodes) { Object node; GeometryAtom geomAtom; BHTree currTree = null; - + clearBhNodeArr(); // System.err.println("GS : nodes.length is " + nodes.length); @@ -336,7 +336,7 @@ class GeometryStructure extends J3dStructure { bhLeafNode.leafIF = geomAtom; geomAtom.bhLeafNode = bhLeafNode; bhLeafNode.computeBoundingHull(); - // System.err.println("bhLeafNode.bHull is " + bhLeafNode.bHull); + // System.err.println("bhLeafNode.bHull is " + bhLeafNode.bHull); addToBhNodeArr(bhLeafNode); } } else if (node instanceof GroupRetained) { @@ -345,27 +345,27 @@ class GeometryStructure extends J3dStructure { BHLeafNode bhLeafNode = new BHLeafNode(); bhLeafNode.leafIF = group; group.bhLeafNode = bhLeafNode; - bhLeafNode.computeBoundingHull(); + bhLeafNode.computeBoundingHull(); addToBhNodeArr(bhLeafNode); } - } + } } if (bhNodeCount < 1) { return; } - + // Look for the right BHTree to insert to. if (currTree == null) { - // We must separate the following two calls + // We must separate the following two calls // since the first Call will allocate storage bhTreeArr // for the second index operation. (see bug 4361998) int idx = getOrAddBHTreeIndex(((BHLeafNode)bhNodeArr[0]).getLocale()); currTree = bhTreeArr[idx]; } - - currTree.insert(bhNodeArr, bhNodeCount); + + currTree.insert(bhNodeArr, bhNodeCount); // Issue 353: must clear array after we are done with it clearBhNodeArr(); @@ -378,7 +378,7 @@ class GeometryStructure extends J3dStructure { BHTree currTree = null; Object node; int index; - + clearBhNodeArr(); for (int i=0; i<nodes.length; i++) { @@ -395,9 +395,9 @@ class GeometryStructure extends J3dStructure { if (geomAtom.bhLeafNode != null) { addToBhNodeArr(geomAtom.bhLeafNode); // Dereference BHLeafNode in GeometryAtom. - geomAtom.bhLeafNode = null; + geomAtom.bhLeafNode = null; } - + } } else if (node instanceof GroupRetained) { if (((NodeRetained)node).nodeType != NodeRetained.ORDEREDGROUP) { @@ -420,7 +420,7 @@ class GeometryStructure extends J3dStructure { // Note that GeometryStructure may run in // parallel with BehaviorStructure when // BS invoke activateBehaviors() to buildTree() - // which in turn call addWakeupOnCollision() + // which in turn call addWakeupOnCollision() // to modify collideEntryList at the same time. WakeupOnCollisionEntry wentry; @@ -444,11 +444,11 @@ class GeometryStructure extends J3dStructure { } } } - + if (bhNodeCount < 1) { return; } - + if (currTree == null) { index = getBHTreeIndex(((BHLeafNode)bhNodeArr[0]).getLocale()); if (index<0) { @@ -476,13 +476,13 @@ class GeometryStructure extends J3dStructure { collideExitList.clearMirror(); } } - - + + private void processBoundsChanged(Object[] nodes, boolean transformChanged) { - + int index; Object node; - + clearBhNodeArr(); for (int i = 0; i < nodes.length; i++) { @@ -491,10 +491,10 @@ class GeometryStructure extends J3dStructure { synchronized (node) { GeometryAtom geomAtom = (GeometryAtom) node; - if (geomAtom.bhLeafNode != null) { + if (geomAtom.bhLeafNode != null) { addToBhNodeArr(geomAtom.bhLeafNode); } - } + } } else if (node instanceof GroupRetained) { GroupRetained group = (GroupRetained) node; @@ -507,11 +507,11 @@ class GeometryStructure extends J3dStructure { } } } - + if (bhNodeCount < 1) { return; } - + index = getBHTreeIndex(((BHLeafNode)bhNodeArr[0]).getLocale()); if (index >= 0) { @@ -524,11 +524,11 @@ class GeometryStructure extends J3dStructure { } private void processTransformChanged(UpdateTargets targets) { - + int i, j, index; Object[] nodes, nodesArr; UnorderList arrList; - int size; + int size; clearBhNodeArr(); @@ -543,19 +543,19 @@ class GeometryStructure extends J3dStructure { for (i = 0; i < nodes.length; i++) { GeometryAtom geomAtom = (GeometryAtom) nodes[i]; synchronized (geomAtom) { - if (geomAtom.bhLeafNode != null) { + if (geomAtom.bhLeafNode != null) { addToBhNodeArr(geomAtom.bhLeafNode); } } } - } + } } - + arrList = targets.targetList[Targets.GRP_TARGETS]; if (arrList != null) { size = arrList.size(); - nodesArr = arrList.toArray(false); + nodesArr = arrList.toArray(false); for ( j = 0; j < size; j++) { nodes = (Object[])nodesArr[j]; for ( i = 0; i < nodes.length; i++) { @@ -570,37 +570,37 @@ class GeometryStructure extends J3dStructure { } } } - + if (bhNodeCount < 1) { return; } - + index = getBHTreeIndex(((BHLeafNode)bhNodeArr[0]).getLocale()); - + if (index >= 0) { - bhTreeArr[index].boundsChanged(bhNodeArr, bhNodeCount); - + bhTreeArr[index].boundsChanged(bhNodeArr, bhNodeCount); + } // Issue 353: must clear array after we are done with it clearBhNodeArr(); - } + } // This method is called by RenderBin to get a array of possibly visible // sub-trees. // bhTrees mustn't be null. // Return true if bhTree's root in encompass by frustumBBox. - + boolean getVisibleBHTrees(RenderBin rBin, BoundingBox frustumBBox, Locale locale, long referenceTime, boolean stateChanged, int visibilityPolicy) { - + int i, j; boolean unviInFB = true; - + // System.err.println("GeometryStructure : view's locale is " + locale); lock.readLock(); @@ -629,18 +629,18 @@ class GeometryStructure extends J3dStructure { } else { // Multiple locale case. - + // For debugging only. - if (J3dDebug.devPhase) + if (J3dDebug.devPhase) J3dDebug.doDebug(J3dDebug.geometryStructure, J3dDebug.LEVEL_2, "GeometryStructure : bhTreeCount is " + universe.geometryStructure.bhTreeCount + - " view's locale is " + locale + "\n"); - + " view's locale is " + locale + "\n"); + BoundingBox localeFrustumBBox = new BoundingBox(); - + synchronized(visLock) { - + for (j=0; j<bhTreeCount; j++) { if (J3dDebug.devPhase) { J3dDebug.doDebug(J3dDebug.geometryStructure, J3dDebug.LEVEL_2, @@ -650,7 +650,7 @@ class GeometryStructure extends J3dStructure { } if (!locale.hiRes.equals(bhTreeArr[j].locale.hiRes)) { bhTreeArr[j].locale.hiRes.difference(locale.hiRes, localeTrans); - + if (J3dDebug.devPhase) { J3dDebug.doDebug(J3dDebug.geometryStructure, J3dDebug.LEVEL_2, @@ -658,7 +658,7 @@ class GeometryStructure extends J3dStructure { "GeometryStructure : localeFrustumBBox " + localeFrustumBBox + "\n" ); } - + // Need to translate view frustumBBox here. localeFrustumBBox.lower.x = frustumBBox.lower.x + localeTrans.x; localeFrustumBBox.lower.y = frustumBBox.lower.y + localeTrans.y; @@ -670,7 +670,7 @@ class GeometryStructure extends J3dStructure { else { frustumBBox.copy(localeFrustumBBox); } - + if(!(bhTreeArr[j].getVisibleBHTrees(rBin, bhTrees, localeFrustumBBox, referenceTime, @@ -679,14 +679,14 @@ class GeometryStructure extends J3dStructure { false))) { unviInFB = false; } - } + } } } - + lock.readUnlock(); return unviInFB; } - + GeometryAtom[] pickAll(Locale locale, PickShape shape) { int i; @@ -694,40 +694,40 @@ class GeometryStructure extends J3dStructure { hitList.clear(); lock.readLock(); - + i = getBHTreeIndex(locale); if (i < 0) { lock.readUnlock(); return null; } - + bhTreeArr[i].select(shape, hitList); lock.readUnlock(); int size = hitList.size(); - + if (size < 1) return null; - + BHNode[] hitArr = (BHNode []) hitList.toArray(false); - + GeometryAtom[] geometryAtoms = new GeometryAtom[size]; for (i=0; i<size; i++) { geometryAtoms[i] = (GeometryAtom)(((BHLeafNode)hitArr[i]).leafIF); - } - + } + return geometryAtoms; } - + GeometryAtom pickAny(Locale locale, PickShape shape) { - + int i; - + BHNode hitNode = null; lock.readLock(); - - i = getBHTreeIndex(locale); + + i = getBHTreeIndex(locale); if (i < 0) { lock.readUnlock(); return null; @@ -739,20 +739,20 @@ class GeometryStructure extends J3dStructure { if (hitNode == null) return null; - + return (GeometryAtom)(((BHLeafNode)hitNode).leafIF); - } - + } + void addWakeupOnCollision(WakeupOnCollisionEntry w) { - + boolean needTrigger = true; // Cleanup, since collideEntryList did not remove // its condition in removeWakeupOnCollision synchronized (collideListLock) { - WakeupOnCollisionEntry collideEntryArr[] = + WakeupOnCollisionEntry collideEntryArr[] = (WakeupOnCollisionEntry []) collideEntryList.toArray(); WakeupOnCollisionEntry wentry; for (int i=collideEntryList.arraySize()-1; i>=0; i--) { @@ -772,7 +772,7 @@ class GeometryStructure extends J3dStructure { // check for collision and triggered event BHLeafInterface target = collide(w.behav.locale, w.accuracyMode, - w.geometryAtoms, + w.geometryAtoms, w.vwcBounds, w.boundingLeaf, w.armingNode, @@ -796,7 +796,7 @@ class GeometryStructure extends J3dStructure { boolean needTrigger = true; synchronized (collideListLock) { - WakeupOnCollisionExit collideExitArr[] = + WakeupOnCollisionExit collideExitArr[] = (WakeupOnCollisionExit []) collideExitList.toArray(); WakeupOnCollisionExit wexit; for (int i=collideExitList.arraySize()-1; i>=0; i--) { @@ -810,12 +810,12 @@ class GeometryStructure extends J3dStructure { } } - // add condition + // add condition wakeupOnCollisionExit.add(w); w.updateCollisionBounds(false); BHLeafInterface target = collide(w.behav.locale, w.accuracyMode, - w.geometryAtoms, + w.geometryAtoms, w.vwcBounds, w.boundingLeaf, w.armingNode, @@ -838,7 +838,7 @@ class GeometryStructure extends J3dStructure { WakeupOnCollisionEntry collideEntryArr[] = (WakeupOnCollisionEntry []) collideEntryList.toArray(); WakeupOnCollisionEntry wentry; - + for (int i=collideEntryList.arraySize()-1; i>=0; i--) { wentry = collideEntryArr[i]; if ((wentry.behav == w.behav) && @@ -860,10 +860,10 @@ class GeometryStructure extends J3dStructure { w.updateCollisionBounds(false); BHLeafInterface target = collide(w.behav.locale, w.accuracyMode, - w.geometryAtoms, + w.geometryAtoms, w.vwcBounds, w.boundingLeaf, - w.armingNode, + w.armingNode, w); if (target != null) { w.setTarget(target); @@ -905,7 +905,7 @@ class GeometryStructure extends J3dStructure { wakeupOnCollisionEntry.toArray(); for (i = wakeupOnCollisionEntry.arraySize()-1; i >=0; i--) { - wentry = wentryArr[i]; + wentry = wentryArr[i]; wentry.updateCollisionBounds(reEvaluateWakeupCollisionGAs); target = collide(wentry.behav.locale, wentry.accuracyMode, @@ -936,7 +936,7 @@ class GeometryStructure extends J3dStructure { wakeupOnCollisionMovement.toArray(); for (i = wakeupOnCollisionMovement.arraySize()-1; i >=0; i--) { - wmove = wmoveArr[i]; + wmove = wmoveArr[i]; wmove.updateCollisionBounds(reEvaluateWakeupCollisionGAs); target = collide(wmove.behav.locale, wmove.accuracyMode, @@ -972,7 +972,7 @@ class GeometryStructure extends J3dStructure { wakeupOnCollisionExit.toArray(); for (i = wakeupOnCollisionExit.arraySize()-1; i >=0; i--) { - wexit = wexitArr[i]; + wexit = wexitArr[i]; wexit.updateCollisionBounds(reEvaluateWakeupCollisionGAs); target = collide(wexit.behav.locale, wexit.accuracyMode, @@ -1000,7 +1000,7 @@ class GeometryStructure extends J3dStructure { /** * Check for duplicate WakeupOnCollisionMovement event. - * We don't want to continue deliver event even though the + * We don't want to continue deliver event even though the * two colliding object did not move but this Geometry update * thread continue to run due to transform change in others * shape not in collision. @@ -1036,7 +1036,7 @@ class GeometryStructure extends J3dStructure { * bound or boundingLeaf collide with BHTree. * Only one of geomAtoms, bound, boundingLeaf is non-null. * If accurancyMode is USE_GEOMETRY, object geometry is used, - * otherwise object bounding box is used for collision + * otherwise object bounding box is used for collision * detection. * In case of GROUP & BOUND, the armingNode is used * to tell whether the colliding Group is itself or not. @@ -1045,7 +1045,7 @@ class GeometryStructure extends J3dStructure { */ BHLeafInterface collide(Locale locale, int accurancyMode, - UnorderList geomAtoms, + UnorderList geomAtoms, Bounds bound, BoundingLeafRetained boundingLeaf, NodeRetained armingNode, @@ -1066,7 +1066,7 @@ class GeometryStructure extends J3dStructure { (armingNode instanceof GroupRetained)) { // Check Bound intersect first before process // to individual Shape3D geometryAtoms - hitNode = bhTreeArr[idx].selectAny(bound, + hitNode = bhTreeArr[idx].selectAny(bound, accurancyMode, (GroupRetained) armingNode); @@ -1077,9 +1077,9 @@ class GeometryStructure extends J3dStructure { GeometryAtom galist[] = (GeometryAtom []) geomAtoms.toArray(false); - hitNode = bhTreeArr[idx].selectAny(galist, + hitNode = bhTreeArr[idx].selectAny(galist, geomAtoms.arraySize(), - accurancyMode); + accurancyMode); if (hitNode != null) { lock.readUnlock(); @@ -1118,7 +1118,7 @@ class GeometryStructure extends J3dStructure { } if (armingNode instanceof GroupRetained) { synchronized (bhTreeArr[idx]) { - hitNode = bhTreeArr[idx].selectAny(bound, + hitNode = bhTreeArr[idx].selectAny(bound, accurancyMode, (GroupRetained) armingNode); @@ -1157,7 +1157,7 @@ class GeometryStructure extends J3dStructure { void resetConditionMet() { BehaviorStructure.resetConditionMet(wakeupOnCollisionEntry); BehaviorStructure.resetConditionMet(wakeupOnCollisionExit); - BehaviorStructure.resetConditionMet(wakeupOnCollisionMovement); + BehaviorStructure.resetConditionMet(wakeupOnCollisionMovement); } /** @@ -1188,7 +1188,7 @@ class GeometryStructure extends J3dStructure { } } */ - } + } void cleanup() { collideEntryList.clear(); diff --git a/src/classes/share/javax/media/j3d/GraphStructureChangeListener.java b/src/classes/share/javax/media/j3d/GraphStructureChangeListener.java index 5e35101..83fb4f9 100755 --- a/src/classes/share/javax/media/j3d/GraphStructureChangeListener.java +++ b/src/classes/share/javax/media/j3d/GraphStructureChangeListener.java @@ -49,7 +49,7 @@ public interface GraphStructureChangeListener { * @param child the child being added */ public void branchGroupAdded(Object parent, BranchGroup child); - + /** * Invoked when a branch group is removed. * Called just after the child has been removed from the parent. @@ -59,7 +59,7 @@ public interface GraphStructureChangeListener { * @param child the child being added */ public void branchGroupRemoved(Object parent, BranchGroup child); - + /** * Invoked when a branch group is moved. * Called after a child has been moved to it's new parent. This call differs diff --git a/src/classes/share/javax/media/j3d/GraphicsConfigTemplate3D.java b/src/classes/share/javax/media/j3d/GraphicsConfigTemplate3D.java index e97d156..1960eb6 100644 --- a/src/classes/share/javax/media/j3d/GraphicsConfigTemplate3D.java +++ b/src/classes/share/javax/media/j3d/GraphicsConfigTemplate3D.java @@ -44,7 +44,7 @@ import java.awt.GraphicsConfigTemplate; * GraphicsConfiguration means that this GraphicsConfiguration is supported and it * meets or exceeds what was requested in the GraphicsConfigTemplate. * Null is returned if no such "best" GraphicsConfiguration is found. - * + * * @see GraphicsConfigTemplate * @see GraphicsDevice * @see GraphicsConfiguration @@ -98,7 +98,7 @@ public class GraphicsConfigTemplate3D extends GraphicsConfigTemplate { * If the value of double buffering is * GraphicsConfigTemplate.REQUIRED, and no GraphicsConfiguration is found * that meets this requirement, null will be returned in getBestConfiguration(). - * @param value the value to set this field to + * @param value the value to set this field to */ public void setDoubleBuffer(int value) { if (value < REQUIRED && value > UNNECESSARY) @@ -122,7 +122,7 @@ public class GraphicsConfigTemplate3D extends GraphicsConfigTemplate { * is passed in, it is ignored. If the value of stereo requirement is * GraphicsConfigTemplate.REQUIRED, and no GraphicsConfiguration is found * that meets this requirement, null will be returned in getBestConfiguration(). - * @param value the value to set this field to + * @param value the value to set this field to */ public void setStereo(int value) { if (value < REQUIRED && value > UNNECESSARY) @@ -146,7 +146,7 @@ public class GraphicsConfigTemplate3D extends GraphicsConfigTemplate { * is passed in, it is ignored. If the value of scene antialiasing is * GraphicsConfigTemplate.REQUIRED, and no GraphicsConfiguration is found * that meets this requirement, null will be returned in getBestConfiguration(). - * @param value the value to set this field to + * @param value the value to set this field to */ public void setSceneAntialiasing(int value) { if (value < REQUIRED && value > UNNECESSARY) @@ -167,7 +167,7 @@ public class GraphicsConfigTemplate3D extends GraphicsConfigTemplate { * Sets the depth buffer size requirement. This is the minimum requirement. * If no GraphicsConfiguration is found that meets or * exceeds this minimum requirement, null will be returned in - * getBestConfiguration(). + * getBestConfiguration(). * @param value the value to set this field to */ public void setDepthSize(int value) { @@ -199,7 +199,7 @@ public class GraphicsConfigTemplate3D extends GraphicsConfigTemplate { public void setStencilSize(int value) { if (value < 0) return; - + stencilSize = value; } @@ -218,7 +218,7 @@ public class GraphicsConfigTemplate3D extends GraphicsConfigTemplate { * Sets the number of red bits required. This is the minimum requirement. * If no GraphicsConfiguration is found that meets or * exceeds this minimum requirement, null will be returned in - * getBestConfiguration(). + * getBestConfiguration(). * @param value the value to set this field to */ public void setRedSize(int value) { @@ -241,7 +241,7 @@ public class GraphicsConfigTemplate3D extends GraphicsConfigTemplate { * Sets the number of green bits required. This is the minimum requirement. * If no GraphicsConfiguration is found that meets or * exceeds this minimum requirement, null will be returned in - * getBestConfiguration(). + * getBestConfiguration(). * @param value the value to set this field to */ public void setGreenSize(int value) { @@ -263,7 +263,7 @@ public class GraphicsConfigTemplate3D extends GraphicsConfigTemplate { * Sets the number of blue bits required. This is the minimum requirement. * If no GraphicsConfiguration is found that meets or * exceeds this minimum requirement, null will be returned in - * getBestConfiguration(). + * getBestConfiguration(). * @param value the value to set this field to */ public void setBlueSize(int value) { @@ -306,7 +306,7 @@ public class GraphicsConfigTemplate3D extends GraphicsConfigTemplate { // It is possible that the followign postRequest will // cause request renderer run immediately before - // runMonitor(WAIT). So we need to set + // runMonitor(WAIT). So we need to set // threadWaiting to true. threadWaiting = true; @@ -315,7 +315,7 @@ public class GraphicsConfigTemplate3D extends GraphicsConfigTemplate { // MC can only handle postRequest and put it in Renderer // queue when free. if (Thread.currentThread() instanceof BehaviorScheduler) { - VirtualUniverse.mc.sendRenderMessage(gc[0], this, + VirtualUniverse.mc.sendRenderMessage(gc[0], this, MasterControl.GETBESTCONFIG); } else { VirtualUniverse.mc.postRequest(MasterControl.GETBESTCONFIG, this); @@ -390,10 +390,10 @@ public class GraphicsConfigTemplate3D extends GraphicsConfigTemplate { } } - + static void runMonitor(int action) { // user thread will locked the globalLock when Renderer - // thread invoke this function so we can't use + // thread invoke this function so we can't use // the same lock. synchronized (monitorLock) { switch (action) { diff --git a/src/classes/share/javax/media/j3d/GraphicsContext3D.java b/src/classes/share/javax/media/j3d/GraphicsContext3D.java index 04244d1..ce8c3d9 100644 --- a/src/classes/share/javax/media/j3d/GraphicsContext3D.java +++ b/src/classes/share/javax/media/j3d/GraphicsContext3D.java @@ -202,7 +202,7 @@ public class GraphicsContext3D extends Object { boolean lightsChanged = false; // A boolean that indicates the sounds have changed - // XXXX: the soundsChanged flag are set like lights methods set + // XXXX: the soundsChanged flag are set like lights methods set // lightsChanged? but where is this supposed to be check??? // lightsChanged tested in 'draw'; but Sound are not processed // in draw. @@ -219,15 +219,15 @@ public class GraphicsContext3D extends Object { int stereoMode = STEREO_BOTH; // Read Buffer for reading raster of color image - byte[] byteBuffer = new byte[1]; + byte[] byteBuffer = new byte[1]; // Read Buffer for reading floating depth image - float[] floatBuffer = new float[1]; + float[] floatBuffer = new float[1]; // Read Buffer for reading integer depth image int[] intBuffer = new int[1]; - /** + /** * The cached ColoringAttributes color value. It is * 1.0, 1.0, 1.0 if there is no ColoringAttributes. */ @@ -243,18 +243,18 @@ public class GraphicsContext3D extends Object { float dGreen = 1.0f; float dBlue = 1.0f; - /** + /** * The cached TransparencyAttributes transparency value. It is * 0.0 if there is no TransparencyAttributes. */ float alpha = 0.0f; - /** + /** * The cached visible flag for geometry. */ boolean visible = true; - /** + /** * Cached values for polygonMode, line antialiasing, and point antialiasing */ int polygonMode = PolygonAttributes.POLYGON_FILL; @@ -263,7 +263,7 @@ public class GraphicsContext3D extends Object { /** - /** + /** * A boolean indicating whether or not lighting should be on. */ boolean enableLighting = false; @@ -352,11 +352,11 @@ public class GraphicsContext3D extends Object { /** * Sets the current Appearance object to the specified * Appearance component object. - * The graphics context stores a reference to the specified - * Appearance object. This means that the application may modify - * individual appearance attributes by using the appropriate + * The graphics context stores a reference to the specified + * Appearance object. This means that the application may modify + * individual appearance attributes by using the appropriate * methods on the Appearance object. - * If the Appearance object is null, default values will be used + * If the Appearance object is null, default values will be used * for all appearance attributes - it is as if an * Appearance node were created using the default constructor. * @@ -367,7 +367,7 @@ public class GraphicsContext3D extends Object { * an off-screen buffer. */ public void setAppearance(Appearance appearance) { - + if(appearance == null) { if(defaultAppearance == null) { defaultAppearance = new Appearance(); @@ -410,13 +410,13 @@ public class GraphicsContext3D extends Object { } } } - } - } + } + } } } uAppearance = appearance; - if ((canvas3d.view == null) || + if ((canvas3d.view == null) || (canvas3d.view.universe == null) || (!canvas3d.view.active) || (Thread.currentThread() == canvas3d.screen.renderer)) { @@ -428,11 +428,11 @@ public class GraphicsContext3D extends Object { sendRenderMessage(true, GraphicsContext3D.SET_APPEARANCE, appearance, null); } } - + void doSetAppearance(Appearance appearance) { // Appearance can't be null. See setAppearance(). assert(appearance != null); - + NodeComponentRetained nc; nc = ((AppearanceRetained)appearance.retained).material; if (nc != null) { @@ -444,8 +444,8 @@ public class GraphicsContext3D extends Object { } else { enableLighting = false; } - - if(appearance instanceof ShaderAppearance){ + + if(appearance instanceof ShaderAppearance){ // Handle ShaderProgramRetained. ShaderProgramRetained spR = ((ShaderAppearanceRetained)appearance.retained).shaderProgram; if(spR != null) { @@ -461,7 +461,7 @@ public class GraphicsContext3D extends Object { } //Handle ShaderAttributeSetRetained. - ShaderAttributeSetRetained sasR = + ShaderAttributeSetRetained sasR = ((ShaderAppearanceRetained)appearance.retained).shaderAttributeSet; if(sasR != null) { sasR.setInImmCtx(true); @@ -475,33 +475,33 @@ public class GraphicsContext3D extends Object { } } } - + if (((AppearanceRetained)appearance.retained).texUnitState != null) { TextureUnitStateRetained[] texUnitState = ((AppearanceRetained)appearance.retained).texUnitState; - + for (int i = 0 ; i < texUnitState.length; i++) { if (texUnitState[i] != null) { texUnitState[i].setInImmCtx(true); } } } - + nc = ((AppearanceRetained)appearance.retained).texture; if (nc != null) { nc.setInImmCtx(true); } - + nc = ((AppearanceRetained)appearance.retained).texCoordGeneration; if (nc != null) { nc.setInImmCtx(true); } - + nc = ((AppearanceRetained)appearance.retained).textureAttributes; if (nc != null) { nc.setInImmCtx(true); } - + nc = ((AppearanceRetained)appearance.retained).coloringAttributes; if (nc != null) { nc.setInImmCtx(true); @@ -513,7 +513,7 @@ public class GraphicsContext3D extends Object { green = 1.0f; blue = 1.0f; } - + nc = ((AppearanceRetained)appearance.retained).transparencyAttributes; if (nc != null) { nc.setInImmCtx(true); @@ -521,14 +521,14 @@ public class GraphicsContext3D extends Object { } else { alpha = 1.0f; } - + nc = ((AppearanceRetained)appearance.retained).renderingAttributes; if (nc != null) { nc.setInImmCtx(true); visible = ((RenderingAttributesRetained)nc).visible; } else visible = true; - + nc = ((AppearanceRetained)appearance.retained).polygonAttributes; if (nc != null) { nc.setInImmCtx(true); @@ -536,16 +536,16 @@ public class GraphicsContext3D extends Object { } else { polygonMode = PolygonAttributes.POLYGON_FILL; } - + nc = ((AppearanceRetained)appearance.retained).lineAttributes; if (nc != null) { nc.setInImmCtx(true); lineAA = ((LineAttributesRetained)nc).lineAntialiasing; - + } else { lineAA = false; } - + nc = ((AppearanceRetained)appearance.retained).pointAttributes; if (nc != null) { if (nc.source.isLive()) @@ -554,7 +554,7 @@ public class GraphicsContext3D extends Object { } else { pointAA = false; } - + // Reset the inImmCtx flag of this.appearance. if (this.appearance != null) { AppearanceRetained app = (AppearanceRetained)this.appearance.retained; @@ -562,7 +562,7 @@ public class GraphicsContext3D extends Object { if (app.material != null) { app.material.setInImmCtx(false); } - + if(app instanceof ShaderAppearanceRetained){ // Handle ShaderProgramRetained. ShaderProgramRetained spR = ((ShaderAppearanceRetained)app).shaderProgram; @@ -577,7 +577,7 @@ public class GraphicsContext3D extends Object { } } } - + //Handle ShaderAttributeSetRetained. ShaderAttributeSetRetained sasR = ((ShaderAppearanceRetained)app).shaderAttributeSet; if(sasR != null) { @@ -592,7 +592,7 @@ public class GraphicsContext3D extends Object { } } } - + if (app.texUnitState != null) { for (int i = 0; i < app.texUnitState.length; i++) { if (app.texUnitState[0] != null) @@ -627,8 +627,8 @@ public class GraphicsContext3D extends Object { app.pointAttributes.setInImmCtx(false); } } - - ((AppearanceRetained)appearance.retained).setInImmCtx(true); + + ((AppearanceRetained)appearance.retained).setInImmCtx(true); this.appearance = appearance; } @@ -643,16 +643,16 @@ public class GraphicsContext3D extends Object { /** * Sets the current Background to the specified Background * leaf node object. - * The graphics context stores a reference to the specified - * Background node. This means that the application may modify - * the background color or image by using the appropriate - * methods on the Background node. The Background node must - * not be part of a live scene graph, nor may it subsequently - * be made part of a live scene graph-an IllegalSharingException - * is thrown in such cases. If the Background object is null, + * The graphics context stores a reference to the specified + * Background node. This means that the application may modify + * the background color or image by using the appropriate + * methods on the Background node. The Background node must + * not be part of a live scene graph, nor may it subsequently + * be made part of a live scene graph-an IllegalSharingException + * is thrown in such cases. If the Background object is null, * the default background color of black (0,0,0) is used to clear - * the canvas prior to rendering a new frame. The Background - * node's application region is ignored for immediate-mode + * the canvas prior to rendering a new frame. The Background + * node's application region is ignored for immediate-mode * rendering. * * @param background the new Background object @@ -665,7 +665,7 @@ public class GraphicsContext3D extends Object { * an off-screen buffer. */ public void setBackground(Background background) { - + if (background.isLive()) { throw new IllegalSharingException(J3dI18N.getString("GraphicsContext3D11")); } @@ -681,9 +681,9 @@ public class GraphicsContext3D extends Object { if (((BackgroundRetained)background.retained).geometryBranch != null) { throw new IllegalSharingException(J3dI18N.getString("GraphicsContext3D22")); } - + uBackground = background; - if ((canvas3d.view == null) || + if ((canvas3d.view == null) || (canvas3d.view.universe == null) || (!canvas3d.view.active) || (Thread.currentThread() == canvas3d.screen.renderer)) { @@ -697,7 +697,7 @@ public class GraphicsContext3D extends Object { } void doSetBackground(Background background) { - BackgroundRetained bg; + BackgroundRetained bg; if (this.background != null) { bg = (BackgroundRetained)this.background.retained; @@ -720,14 +720,14 @@ public class GraphicsContext3D extends Object { /** * Sets the current Fog to the specified Fog * leaf node object. - * The graphics context stores a reference to the specified - * Fog node. This means that the application may modify the - * fog attributes using the appropriate methods on the Fog - * node object. The Fog node must not be part of a live + * The graphics context stores a reference to the specified + * Fog node. This means that the application may modify the + * fog attributes using the appropriate methods on the Fog + * node object. The Fog node must not be part of a live * scene graph, nor may it subsequently be made part of a - * live scene graph-an IllegalSharingException is thrown in - * such cases. If the Fog object is null, fog is disabled. - * Both the region of influence and the hierarchical scope + * live scene graph-an IllegalSharingException is thrown in + * such cases. If the Fog object is null, fog is disabled. + * Both the region of influence and the hierarchical scope * of the Fog node are ignored for immediate-mode rendering. * @param fog the new Fog object * @exception IllegalSharingException if the Fog node @@ -738,7 +738,7 @@ public class GraphicsContext3D extends Object { throw new IllegalSharingException(J3dI18N.getString("GraphicsContext3D12")); } uFog = fog; - if ((canvas3d.view == null) || + if ((canvas3d.view == null) || (canvas3d.view.universe == null) || (!canvas3d.view.active) || (Thread.currentThread() == canvas3d.screen.renderer)) { @@ -798,17 +798,17 @@ public class GraphicsContext3D extends Object { throw new IllegalSharingException(J3dI18N.getString("GraphicsContext3D25")); } uModelClip = modelClip; - if ((canvas3d.view == null) || + if ((canvas3d.view == null) || (canvas3d.view.universe == null) || (!canvas3d.view.active) || (Thread.currentThread() == canvas3d.screen.renderer)) { doSetModelClip(modelClip); } else if (Thread.currentThread() == canvas3d.view.universe.behaviorScheduler) { - sendRenderMessage(false, GraphicsContext3D.SET_MODELCLIP, + sendRenderMessage(false, GraphicsContext3D.SET_MODELCLIP, modelClip, null); } else { - sendRenderMessage(true, GraphicsContext3D.SET_MODELCLIP, + sendRenderMessage(true, GraphicsContext3D.SET_MODELCLIP, modelClip, null); } } @@ -827,7 +827,7 @@ public class GraphicsContext3D extends Object { // save the current model Transform modelClipTransform.set(compTransform); - } + } } /** @@ -843,14 +843,14 @@ public class GraphicsContext3D extends Object { /** * Replaces the specified light with the light provided. - * The graphics context stores a reference to each light - * object in the list of lights. This means that the + * The graphics context stores a reference to each light + * object in the list of lights. This means that the * application may modify the light attributes for - * any of the lights using the appropriate methods on that - * Light node object. None of the Light nodes in the list - * of lights may be part of a live scene graph, nor may + * any of the lights using the appropriate methods on that + * Light node object. None of the Light nodes in the list + * of lights may be part of a live scene graph, nor may * they subsequently be made part of a live scene graph - - * an IllegalSharingException is thrown in such cases. + * an IllegalSharingException is thrown in such cases. * @param light the new light * @param index which light to replace * @exception IllegalSharingException if the Light node @@ -865,14 +865,14 @@ public class GraphicsContext3D extends Object { throw new IllegalSharingException(J3dI18N.getString("GraphicsContext3D14")); } uLights.setElementAt(light, index); - if ((canvas3d.view == null) || + if ((canvas3d.view == null) || (canvas3d.view.universe == null) || (!canvas3d.view.active) || (Thread.currentThread() == canvas3d.screen.renderer)) { doSetLight(light, index); } else if (Thread.currentThread() == canvas3d.view.universe.behaviorScheduler) { - sendRenderMessage(false, GraphicsContext3D.SET_LIGHT, light, + sendRenderMessage(false, GraphicsContext3D.SET_LIGHT, light, new Integer(index)); } else { sendRenderMessage(true, GraphicsContext3D.SET_LIGHT, light, @@ -904,12 +904,12 @@ public class GraphicsContext3D extends Object { public void insertLight(Light light, int index) { if (light == null) { throw new NullPointerException(J3dI18N.getString("GraphicsContext3D13")); - } + } if (light.isLive()) { throw new IllegalSharingException(J3dI18N.getString("GraphicsContext3D14")); } uLights.insertElementAt(light, index); - if ((canvas3d.view == null) || + if ((canvas3d.view == null) || (canvas3d.view.universe == null) || (!canvas3d.view.active) || (Thread.currentThread() == canvas3d.screen.renderer)) { @@ -937,7 +937,7 @@ public class GraphicsContext3D extends Object { */ public void removeLight(int index) { uLights.removeElementAt(index); - if ((canvas3d.view == null) || + if ((canvas3d.view == null) || (canvas3d.view.universe == null) || (!canvas3d.view.active) || (Thread.currentThread() == canvas3d.screen.renderer)) { @@ -972,16 +972,16 @@ public class GraphicsContext3D extends Object { /** * Retrieves the enumeration object of all the lights. * @return the enumeration object of all the lights - */ + */ public Enumeration getAllLights() { return uLights.elements(); - } - + } + /** * Appends the specified light to this graphics context's list of lights. - * Adding a null Light object to the list will result - * in a NullPointerException. Both the region of influence - * and the hierarchical scope of all lights in the list + * Adding a null Light object to the list will result + * in a NullPointerException. Both the region of influence + * and the hierarchical scope of all lights in the list * are ignored for immediate-mode rendering. * @param light the light to add * @exception IllegalSharingException if the Light node @@ -992,12 +992,12 @@ public class GraphicsContext3D extends Object { if (light == null) { throw new NullPointerException(J3dI18N.getString("GraphicsContext3D13")); } - + if (light.isLive()) { throw new IllegalSharingException(J3dI18N.getString("GraphicsContext3D14")); } uLights.addElement(light); - if ((canvas3d.view == null) || + if ((canvas3d.view == null) || (canvas3d.view.universe == null) || (!canvas3d.view.active) || (Thread.currentThread() == canvas3d.screen.renderer)) { @@ -1033,7 +1033,7 @@ public class GraphicsContext3D extends Object { } if (normalTransform == null) { normalTransform = new Transform3D(); - } + } if (normalTransformNeedToUpdate) { normalTransform.invert(compTransform); @@ -1080,7 +1080,7 @@ public class GraphicsContext3D extends Object { /** * Sets the HiRes coordinate of this context to the location * specified by the parameters provided. - * The parameters x, y, and z are arrays of eight 32-bit + * The parameters x, y, and z are arrays of eight 32-bit * integers that specify the high-resolution coordinates point. * @param x an eight element array specifying the x position * @param y an eight element array specifying the y position @@ -1091,7 +1091,7 @@ public class GraphicsContext3D extends Object { HiResCoord hiRes = new HiResCoord(x, y, z); setHiRes(hiRes); } - + /** * Sets the HiRes coordinate of this context * to the location specified by the HiRes argument. @@ -1099,7 +1099,7 @@ public class GraphicsContext3D extends Object { */ public void setHiRes(HiResCoord hiRes) { uHiRes.setHiResCoord(hiRes); - if ((canvas3d.view == null) || + if ((canvas3d.view == null) || (canvas3d.view.universe == null) || (!canvas3d.view.active) || (Thread.currentThread() == canvas3d.screen.renderer)) { @@ -1129,14 +1129,14 @@ public class GraphicsContext3D extends Object { /** * Sets the current model transform to a copy of the specified * transform. - * A BadTransformException is thrown if an attempt is made + * A BadTransformException is thrown if an attempt is made * to specify an illegal Transform3D. * @param t the new model transform * @exception BadTransformException if the transform is not affine. */ public void setModelTransform(Transform3D t) { - - if ((canvas3d.view == null) || + + if ((canvas3d.view == null) || (canvas3d.view.universe == null) || (!canvas3d.view.active) || (Thread.currentThread() == canvas3d.screen.renderer)) { @@ -1147,10 +1147,10 @@ public class GraphicsContext3D extends Object { //Transform3D uModelTransform = t; if (Thread.currentThread() == canvas3d.view.universe.behaviorScheduler) { - sendRenderMessage(false, GraphicsContext3D.SET_MODEL_TRANSFORM, + sendRenderMessage(false, GraphicsContext3D.SET_MODEL_TRANSFORM, uModelTransform, null); } else { - sendRenderMessage(true, GraphicsContext3D.SET_MODEL_TRANSFORM, + sendRenderMessage(true, GraphicsContext3D.SET_MODEL_TRANSFORM, uModelTransform, null); } } @@ -1171,8 +1171,8 @@ public class GraphicsContext3D extends Object { * @exception BadTransformException if the transform is not affine. */ public void multiplyModelTransform(Transform3D t) { - if ((canvas3d.view == null) || - (canvas3d.view.universe == null) || + if ((canvas3d.view == null) || + (canvas3d.view.universe == null) || (!canvas3d.view.active) || (Thread.currentThread() == canvas3d.screen.renderer)) { doMultiplyModelTransform(t); @@ -1187,13 +1187,13 @@ public class GraphicsContext3D extends Object { } } } - + void doMultiplyModelTransform(Transform3D t) { this.modelTransform.mul(t); computeCompositeTransform(); normalTransformNeedToUpdate = true; } - + /** * Retrieves the current model transform. * @param t the model transform that will receive the current @@ -1205,10 +1205,10 @@ public class GraphicsContext3D extends Object { /** * Replaces the specified sound with the sound provided. - * The graphics context stores a reference to each sound - * object in the list of sounds. This means that the + * The graphics context stores a reference to each sound + * object in the list of sounds. This means that the * application may modify the sound attributes for - * any of the sounds by using the appropriate methods on + * any of the sounds by using the appropriate methods on * that Sound node object. * @param sound the new sound * @param index which sound to replace @@ -1224,7 +1224,7 @@ public class GraphicsContext3D extends Object { throw new IllegalSharingException(J3dI18N.getString("GraphicsContext3D23")); } uSounds.setElementAt(sound, index); - if ((canvas3d.view == null) || + if ((canvas3d.view == null) || (canvas3d.view.universe == null) || (!canvas3d.view.active) || (Thread.currentThread() == canvas3d.screen.renderer)) { @@ -1257,9 +1257,9 @@ public class GraphicsContext3D extends Object { /** * Inserts the specified sound at the specified index location. * Inserting a sound to the list of sounds implicitly starts the - * sound playing. Once a sound is finished playing, it can be - * restarted by setting the sound's enable flag to true. - * The scheduling region of all sounds in the list is ignored + * sound playing. Once a sound is finished playing, it can be + * restarted by setting the sound's enable flag to true. + * The scheduling region of all sounds in the list is ignored * for immediate-mode rendering. * @param sound the new sound * @param index at which location to insert @@ -1268,14 +1268,14 @@ public class GraphicsContext3D extends Object { * @exception NullPointerException if the Sound object is null. */ public void insertSound(Sound sound, int index) { - if (sound == null) { - throw new NullPointerException(J3dI18N.getString("GraphicsContext3D17")); } - - if (sound.isLive()) { + if (sound == null) { + throw new NullPointerException(J3dI18N.getString("GraphicsContext3D17")); } + + if (sound.isLive()) { throw new IllegalSharingException(J3dI18N.getString("GraphicsContext3D23")); } uSounds.insertElementAt(sound, index); - if ((canvas3d.view == null) || + if ((canvas3d.view == null) || (canvas3d.view.universe == null) || (!canvas3d.view.active) || (Thread.currentThread() == canvas3d.screen.renderer)) { @@ -1303,17 +1303,17 @@ public class GraphicsContext3D extends Object { */ public void removeSound(int index) { uSounds.removeElementAt(index); - if ((canvas3d.view == null) || + if ((canvas3d.view == null) || (canvas3d.view.universe == null) || (!canvas3d.view.active) || (Thread.currentThread() == canvas3d.screen.renderer)) { doRemoveSound(index); } else if (Thread.currentThread() == canvas3d.view.universe.behaviorScheduler) { - sendRenderMessage(false, GraphicsContext3D.REMOVE_SOUND, + sendRenderMessage(false, GraphicsContext3D.REMOVE_SOUND, new Integer(index), null); } else { - sendRenderMessage(true, GraphicsContext3D.REMOVE_SOUND, + sendRenderMessage(true, GraphicsContext3D.REMOVE_SOUND, new Integer(index), null); } } @@ -1341,17 +1341,17 @@ public class GraphicsContext3D extends Object { /** * Retrieves the enumeration object of all the sounds. * @return the enumeration object of all the sounds - */ + */ public Enumeration getAllSounds() { return uSounds.elements(); - } + } /** * Appends the specified sound to this graphics context's list of sounds. * Adding a sound to the list of sounds implicitly starts the - * sound playing. Once a sound is finished playing, it can be - * restarted by setting the sound's enable flag to true. - * The scheduling region of all sounds in the list is ignored + * sound playing. Once a sound is finished playing, it can be + * restarted by setting the sound's enable flag to true. + * The scheduling region of all sounds in the list is ignored * for immediate-mode rendering. * @param sound the sound to add * @exception IllegalSharingException if the Sound node @@ -1359,15 +1359,15 @@ public class GraphicsContext3D extends Object { * @exception NullPointerException if the Sound object is null. */ public void addSound(Sound sound) { - if (sound == null) { - throw new NullPointerException(J3dI18N.getString("GraphicsContext3D17")); } - + if (sound == null) { + throw new NullPointerException(J3dI18N.getString("GraphicsContext3D17")); } + if (sound.isLive()) { throw new IllegalSharingException(J3dI18N.getString("GraphicsContext3D23")); - + } uSounds.addElement(sound); - if ((canvas3d.view == null) || + if ((canvas3d.view == null) || (canvas3d.view.universe == null) || (!canvas3d.view.active) || (Thread.currentThread() == canvas3d.screen.renderer)) { @@ -1395,7 +1395,7 @@ public class GraphicsContext3D extends Object { public int numSounds() { return uSounds.size(); } - + SoundScheduler getSoundScheduler() { if (canvas3d != null && canvas3d.view != null) return canvas3d.view.soundScheduler; // could be null as well @@ -1437,7 +1437,7 @@ public class GraphicsContext3D extends Object { /** * Retrieves the sound playing flag. - * @param index which sound + * @param index which sound * @return flag denoting if sound is currently playing */ public boolean isSoundPlaying(int index) { @@ -1450,15 +1450,15 @@ public class GraphicsContext3D extends Object { /** * Sets the current AuralAttributes object to the specified * AuralAttributes component object. - * This means that the application may modify individual - * audio attributes by using the appropriate methods in + * This means that the application may modify individual + * audio attributes by using the appropriate methods in * the Aural-Attributes object. * @param attributes the new AuralAttributes object */ public void setAuralAttributes(AuralAttributes attributes) { uAuralAttributes = attributes; - if ((canvas3d.view == null) || + if ((canvas3d.view == null) || (canvas3d.view.universe == null) || (!canvas3d.view.active) || (Thread.currentThread() == canvas3d.screen.renderer)) { @@ -1502,7 +1502,7 @@ public class GraphicsContext3D extends Object { */ public void setBufferOverride(boolean bufferOverride) { uBufferOverride = bufferOverride; - if ((canvas3d.view == null) || + if ((canvas3d.view == null) || (canvas3d.view.universe == null) || (!canvas3d.view.active) || (Thread.currentThread() == canvas3d.screen.renderer)) { @@ -1516,7 +1516,7 @@ public class GraphicsContext3D extends Object { new Boolean(bufferOverride), null); } } - + void doSetBufferOverride(boolean bufferOverride) { if (bufferOverride != this.bufferOverride) { this.bufferOverride = bufferOverride; @@ -1554,7 +1554,7 @@ public class GraphicsContext3D extends Object { */ public void setFrontBufferRendering(boolean frontBufferRendering) { uFrontBufferRendering = frontBufferRendering; - if ((canvas3d.view == null) || + if ((canvas3d.view == null) || (canvas3d.view.universe == null) || (!canvas3d.view.active) || (Thread.currentThread() == canvas3d.screen.renderer)) { @@ -1621,7 +1621,7 @@ public class GraphicsContext3D extends Object { */ public void setStereoMode(int stereoMode) { uStereoMode = stereoMode; - if ((canvas3d.view == null) || + if ((canvas3d.view == null) || (canvas3d.view.universe == null) || (!canvas3d.view.active) || (Thread.currentThread() == canvas3d.screen.renderer)) { @@ -1679,19 +1679,19 @@ public class GraphicsContext3D extends Object { } void doClear() { - + if (!canvas3d.firstPaintCalled) return; - + RenderBin rb = canvas3d.view.renderBin; BackgroundRetained back = null; - - + + if (this.background != null) back = (BackgroundRetained)this.background.retained; else back = this.black; - + // XXXX: This should ideally be done by the renderer (or by the // canvas itself) when the canvas is first added to a view. /* @@ -1702,10 +1702,10 @@ public class GraphicsContext3D extends Object { // If we are in pure immediate mode, update the view cache if (!canvas3d.isRunning) updateViewCache(rb); - + // We need to catch NullPointerException when the dsi // gets yanked from us during a remove. - + try { // Issue 78 - need to get the drawingSurface info every // frame; this is necessary since the HDC (window ID) @@ -1714,7 +1714,7 @@ public class GraphicsContext3D extends Object { if (!canvas3d.offScreen) { canvas3d.drawingSurfaceObject.getDrawingSurfaceObjectInfo(); } - + if (canvas3d.drawingSurfaceObject.renderLock()) { // XXXX : Fix texture /* @@ -1732,7 +1732,7 @@ public class GraphicsContext3D extends Object { } } */ - + if (canvas3d.ctx == null) { synchronized (VirtualUniverse.mc.contextCreationLock) { canvas3d.ctx = canvas3d.createNewContext(null, false); @@ -1740,28 +1740,28 @@ public class GraphicsContext3D extends Object { canvas3d.drawingSurfaceObject.unLock(); return; } - + canvas3d.ctxTimeStamp = VirtualUniverse.mc.getContextTimeStamp(); canvas3d.screen.renderer.listOfCtxs.add(canvas3d.ctx); canvas3d.screen.renderer.listOfCanvases.add(canvas3d); - + canvas3d.beginScene(); - + if (canvas3d.graphics2D != null) { canvas3d.graphics2D.init(); } - + // enable separate specular color canvas3d.enableSeparateSpecularColor(); } - + // create the cache texture state in canvas // for state download checking purpose if (canvas3d.texUnitState == null) { canvas3d.createTexUnitState(); } - + canvas3d.drawingSurfaceObject.contextValidated(); canvas3d.screen.renderer.currentCtx = canvas3d.ctx; canvas3d.screen.renderer.currentDrawable = canvas3d.drawable; @@ -1770,18 +1770,18 @@ public class GraphicsContext3D extends Object { canvas3d.canvasDirty = 0xffff; // Update Appearance updateState(rb, RenderMolecule.SURFACE); - + canvas3d.currentLights = new LightRetained[canvas3d.getNumCtxLights(canvas3d.ctx)]; - + for (int j=0; j<canvas3d.currentLights.length; j++) { canvas3d.currentLights[j] = null; } } - - + + canvas3d.makeCtxCurrent(); - + if ((dirtyMask & BUFFER_MODE) != 0) { if (bufferOverride) { canvas3d.setRenderMode(canvas3d.ctx, stereoMode, @@ -1795,27 +1795,27 @@ public class GraphicsContext3D extends Object { } dirtyMask &= ~BUFFER_MODE; } - + Dimension size = canvas3d.getSize(); int winWidth = size.width; int winHeight = size.height; boolean isByRefBackgroundImage = false; - if (back.image != null) { + if (back.image != null) { if (back.image.isByReference()) { back.image.geomLock.getLock(); isByRefBackgroundImage = true; } - + back.image.evaluateExtensions(canvas3d); } - + canvas3d.clear(back, winWidth, winHeight); if (isByRefBackgroundImage) { back.image.geomLock.unLock(); } - - + + // Set the viewport and view matrices if (!canvas3d.isRunning) { CanvasViewCache cvCache = canvas3d.canvasViewCache; @@ -1837,7 +1837,7 @@ public class GraphicsContext3D extends Object { rb.vworldToVpc); } } - + canvas3d.drawingSurfaceObject.unLock(); } } catch (NullPointerException ne) { @@ -1845,11 +1845,11 @@ public class GraphicsContext3D extends Object { throw ne; } } - + // Method to update compTransform. private void computeCompositeTransform() { ViewPlatform vp; - + if ((canvas3d == null) || (canvas3d.view == null) || (((vp = canvas3d.view.getViewPlatform()) == null)) || @@ -1857,15 +1857,15 @@ public class GraphicsContext3D extends Object { compTransform.set(modelTransform); return; } - + ViewPlatformRetained vpR = (ViewPlatformRetained)vp.retained; if ((vpR == null) || (vpR.locale == null)) { compTransform.set(modelTransform); return; } - + HiResCoord localeHiRes = vpR.locale.hiRes; - + if (localeHiRes.equals(hiRes)) { compTransform.set(modelTransform); } else { @@ -1876,7 +1876,7 @@ public class GraphicsContext3D extends Object { compTransform.mul(trans, modelTransform); } } - + // Method to update the view cache in pure immediate mode private void updateViewCache(RenderBin rb) { @@ -1929,13 +1929,13 @@ public class GraphicsContext3D extends Object { J3dDebug.doAssert(canvas3d.ctx != null, "canvas3d.ctx != null"); } - // We need to catch NullPointerException when the dsi + // We need to catch NullPointerException when the dsi // gets yanked from us during a remove. - try { + try { if (canvas3d.drawingSurfaceObject.renderLock()) { // Make the context current - canvas3d.makeCtxCurrent(); + canvas3d.makeCtxCurrent(); if ((dirtyMask & BUFFER_MODE) != 0) { if (bufferOverride) { @@ -1947,16 +1947,16 @@ public class GraphicsContext3D extends Object { } dirtyMask &= ~BUFFER_MODE; } - - CanvasViewCache cvCache = canvas3d.canvasViewCache; + + CanvasViewCache cvCache = canvas3d.canvasViewCache; Transform3D proj; -// vpcToEc = cvCache.getLeftVpcToEc(); +// vpcToEc = cvCache.getLeftVpcToEc(); if (bufferOverride) { switch(stereoMode) { case STEREO_RIGHT: vpcToEc = cvCache.getRightVpcToEc(); - // XXXX: move this under check for + // XXXX: move this under check for // (dirtyMask & BUFFER_MODE) above after testing // PureImmediate mode canvas3d.setProjectionMatrix(canvas3d.ctx, @@ -1966,19 +1966,19 @@ public class GraphicsContext3D extends Object { case STEREO_BOTH: default: vpcToEc = cvCache.getLeftVpcToEc(); - // XXXX: move this under check for + // XXXX: move this under check for // (dirtyMask & BUFFER_MODE) above after testing // PureImmediate mode canvas3d.setProjectionMatrix(canvas3d.ctx, cvCache.getLeftProjection()); } } - else if (!canvas3d.isRunning || + else if (!canvas3d.isRunning || // vpcToEc is not set in the first frame // of preRender() callback (canvas3d.vpcToEc == null)) { vpcToEc = cvCache.getLeftVpcToEc(); - } + } else { vpcToEc = canvas3d.vpcToEc; } @@ -1989,9 +1989,9 @@ public class GraphicsContext3D extends Object { // this.drawTransform.mul(rb.vworldToVpc, - // this.compTransform); + // this.compTransform); - boolean isNonUniformScale = !drawTransform.isCongruent(); + boolean isNonUniformScale = !drawTransform.isCongruent(); int geometryType = 0; switch (((GeometryRetained)geometry.retained).geoType) { @@ -2010,7 +2010,7 @@ public class GraphicsContext3D extends Object { break; case GeometryRetained.GEO_TYPE_COMPRESSED: geometryType = RenderMolecule.COMPRESSED; - + switch (((CompressedGeometryRetained)geometry.retained).getBufferType()) { case CompressedGeometryHeader.POINT_BUFFER: geometryType |= RenderMolecule.POINT ; @@ -2028,7 +2028,7 @@ public class GraphicsContext3D extends Object { geometryType = RenderMolecule.SURFACE; break; } - + useAlpha = updateState(rb, geometryType); canvas3d.setModelViewMatrix(canvas3d.ctx, @@ -2038,7 +2038,7 @@ public class GraphicsContext3D extends Object { updateModelClip(rb.vworldToVpc); - this.drawTransform.mul(rb.vworldToVpc, this.compTransform); + this.drawTransform.mul(rb.vworldToVpc, this.compTransform); canvas3d.setModelViewMatrix(canvas3d.ctx, vpcToEc.mat, this.drawTransform); @@ -2060,7 +2060,7 @@ public class GraphicsContext3D extends Object { geoRetained.setupMirrorColorPointer((geoRetained.vertexType & GeometryArrayRetained.COLOR_DEFINED),true); } } - + if ((geometry.retained instanceof IndexedGeometryArrayRetained) && ((((GeometryArrayRetained)geometry.retained).vertexFormat & GeometryArray.USE_COORD_INDEX_ONLY) == 0)) { if (geoRetained.dirtyFlag != 0) { @@ -2078,7 +2078,7 @@ public class GraphicsContext3D extends Object { geoRetained.setVertexFormat(false, ignoreVertexColors, canvas3d.ctx ); - } else if (geometry.retained instanceof Text3DRetained) { + } else if (geometry.retained instanceof Text3DRetained) { ((Text3DRetained)geometry.retained).setModelViewMatrix( vpcToEc, this.drawTransform); drawGeo = (GeometryRetained)geometry.retained; @@ -2099,7 +2099,7 @@ public class GraphicsContext3D extends Object { } drawGeo.execute(canvas3d, null, isNonUniformScale, - false, alpha, + false, alpha, canvas3d.screen.screen, ignoreVertexColors); @@ -2115,18 +2115,18 @@ public class GraphicsContext3D extends Object { canvas3d.drawingSurfaceObject.unLock(); } - } catch (NullPointerException ne) { + } catch (NullPointerException ne) { canvas3d.drawingSurfaceObject.unLock(); throw ne; - } + } } /** * Draw the specified Geometry component object. * @param geometry the Geometry object to draw. * - * @exception IllegalSharingException if the specified geometry is a - * Raster that refers to an ImageComponent2D that is being used by a + * @exception IllegalSharingException if the specified geometry is a + * Raster that refers to an ImageComponent2D that is being used by a * Canvas3D as an off-screen buffer. */ public void draw(Geometry geometry) { @@ -2142,7 +2142,7 @@ public class GraphicsContext3D extends Object { } } } - + if ((canvas3d.view == null) || (canvas3d.view.universe == null) || (!canvas3d.view.active)) { return; @@ -2151,10 +2151,10 @@ public class GraphicsContext3D extends Object { } else { if (Thread.currentThread() == canvas3d.view.universe.behaviorScheduler) { - sendRenderMessage(false, GraphicsContext3D.DRAW, + sendRenderMessage(false, GraphicsContext3D.DRAW, geometry, null); } else { - sendRenderMessage(true, GraphicsContext3D.DRAW, geometry, + sendRenderMessage(true, GraphicsContext3D.DRAW, geometry, null); } } @@ -2181,7 +2181,7 @@ public class GraphicsContext3D extends Object { if (shape.isLive()) { throw new IllegalSharingException(J3dI18N.getString("GraphicsContext3D26")); } - ((Shape3DRetained)shape.retained).setInImmCtx(true); + ((Shape3DRetained)shape.retained).setInImmCtx(true); setAppearance(shape.getAppearance()); draw(shape.getGeometry()); } @@ -2236,15 +2236,15 @@ public class GraphicsContext3D extends Object { throw new IllegalArgumentException(J3dI18N.getString("GraphicsContext3D34")); } if (imageRetained.getNumberOfComponents() < 3) { - throw new IllegalArgumentException(J3dI18N.getString("GraphicsContext3D35")); + throw new IllegalArgumentException(J3dI18N.getString("GraphicsContext3D35")); } if (image.isLive()) { throw new IllegalSharingException(J3dI18N.getString("GraphicsContext3D36")); } if (imageRetained.getInImmCtx() || imageRetained.getUsedByOffScreen()) { throw new IllegalSharingException(J3dI18N.getString("GraphicsContext3D37")); - } - } + } + } } if ((canvas3d.view == null) || (canvas3d.view.universe == null) || (!canvas3d.view.active)) { @@ -2253,18 +2253,18 @@ public class GraphicsContext3D extends Object { doReadRaster(raster); } else if (Thread.currentThread() == canvas3d.view.universe.behaviorScheduler) { - readRasterReady = false; + readRasterReady = false; sendRenderMessage(false, GraphicsContext3D.READ_RASTER, raster, null); while (!readRasterReady) { MasterControl.threadYield(); - } + } } else { // call from user thread readRasterReady = false; sendRenderMessage(true, GraphicsContext3D.READ_RASTER, raster, null); while (!readRasterReady) { MasterControl.threadYield(); - } + } } } @@ -2393,7 +2393,7 @@ public class GraphicsContext3D extends Object { * @since Java 3D 1.2 */ public void flush(boolean wait) { - if ((canvas3d.view == null) || + if ((canvas3d.view == null) || (canvas3d.view.universe == null) || (!canvas3d.view.active) || (Thread.currentThread() == canvas3d.screen.renderer)) { @@ -2403,10 +2403,10 @@ public class GraphicsContext3D extends Object { if (Thread.currentThread() == canvas3d.view.universe.behaviorScheduler) { - sendRenderMessage(false, GraphicsContext3D.FLUSH, waitArg, + sendRenderMessage(false, GraphicsContext3D.FLUSH, waitArg, null); } else { - sendRenderMessage(true, GraphicsContext3D.FLUSH, waitArg, + sendRenderMessage(true, GraphicsContext3D.FLUSH, waitArg, null); } // Issue 131: AutomaticOffscreen canvases must be treated as onscreen ones. @@ -2414,13 +2414,13 @@ public class GraphicsContext3D extends Object { !canvas3d.manualRendering ) { // No need to wait if renderer thread is not schedule runMonitor(J3dThread.WAIT); - } + } } } void doFlush(boolean wait) { try { - if (canvas3d.drawingSurfaceObject.renderLock()) { + if (canvas3d.drawingSurfaceObject.renderLock()) { canvas3d.syncRender(canvas3d.ctx, wait); canvas3d.drawingSurfaceObject.unLock(); if (wait) { @@ -2445,13 +2445,13 @@ public class GraphicsContext3D extends Object { for (i = 0; i < nLight;i++) { LightRetained lt = (LightRetained)((Light)lights.get(i)).retained; if (lt instanceof AmbientLightRetained) { - sceneAmbient.x += lt.color.x; - sceneAmbient.y += lt.color.y; + sceneAmbient.x += lt.color.x; + sceneAmbient.y += lt.color.y; sceneAmbient.z += lt.color.z; continue; } - - lt.update(canvas3d.ctx, n, + + lt.update(canvas3d.ctx, n, canvas3d.canvasViewCache.getVworldToCoexistenceScale()); if (lt.lightOn) enableMask |= (1 << n); @@ -2466,12 +2466,12 @@ public class GraphicsContext3D extends Object { if (sceneAmbient.z > 1.0f) { sceneAmbient.z = 1.0f; } - + canvas3d.setSceneAmbient(canvas3d.ctx, sceneAmbient.x, sceneAmbient.y, sceneAmbient.z); canvas3d.canvasDirty |= Canvas3D.AMBIENTLIGHT_DIRTY; - canvas3d.sceneAmbient.set(sceneAmbient); + canvas3d.sceneAmbient.set(sceneAmbient); if (canvas3d.enableMask != enableMask) { canvas3d.canvasDirty |= Canvas3D.LIGHTENABLES_DIRTY; @@ -2480,7 +2480,7 @@ public class GraphicsContext3D extends Object { canvas3d.enableMask = enableMask; } - // Force LightBin.updateAttributes and EnvironmentSet.updateAttributes + // Force LightBin.updateAttributes and EnvironmentSet.updateAttributes // to use the within frame case. canvas3d.lightBin = null; canvas3d.environmentSet = null; @@ -2516,7 +2516,7 @@ public class GraphicsContext3D extends Object { this.drawTransform); } ((ModelClipRetained)modelClip.retained).update( - canvas3d.ctx, enableMask, + canvas3d.ctx, enableMask, this.drawTransform); canvas3d.canvasDirty |= Canvas3D.MODELCLIP_DIRTY; canvas3d.modelClip = (ModelClipRetained) modelClip.retained; @@ -2533,7 +2533,7 @@ public class GraphicsContext3D extends Object { } - + boolean updateState(RenderBin rb, int geometryType) { @@ -2557,13 +2557,13 @@ public class GraphicsContext3D extends Object { if (app.material != null) { app.material.updateNative(canvas3d.ctx, red,green,blue, - alpha,enableLighting); + alpha,enableLighting); canvas3d.material = app.material; canvas3d.canvasDirty |= Canvas3D.MATERIAL_DIRTY; } else { if (canvas3d.material != null) { - canvas3d.updateMaterial(canvas3d.ctx, - red, green, blue, alpha); + canvas3d.updateMaterial(canvas3d.ctx, + red, green, blue, alpha); canvas3d.material = null; canvas3d.canvasDirty |= Canvas3D.MATERIAL_DIRTY; } @@ -2575,24 +2575,24 @@ public class GraphicsContext3D extends Object { ShaderProgramRetained spR = ((ShaderAppearanceRetained)app).shaderProgram; if ( spR != null) { spR.updateNative(canvas3d, true); - + ShaderAttributeSetRetained sasR = ((ShaderAppearanceRetained)app).shaderAttributeSet; - + if (sasR != null) { sasR.updateNative(canvas3d, spR); } - + canvas3d.shaderProgram = spR; useShaders = true; } } - else if (canvas3d.shaderProgram != null) { + else if (canvas3d.shaderProgram != null) { canvas3d.shaderProgram.updateNative(canvas3d, false); canvas3d.shaderProgram = null; useShaders = false; } - + // Set the number of available texture units; this depends on // whether or not shaders are being used. int availableTextureUnits = @@ -2631,7 +2631,7 @@ public class GraphicsContext3D extends Object { if ((app.texUnitState[i] != null) && app.texUnitState[i].isTextureEnabled()) { - app.texUnitState[i].updateNative(i, canvas3d, + app.texUnitState[i].updateNative(i, canvas3d, false, false); } else { canvas3d.resetTexture(canvas3d.ctx, i); @@ -2653,7 +2653,7 @@ public class GraphicsContext3D extends Object { } canvas3d.setNumActiveTexUnit(0); } - + // set the active texture unit back to 0 canvas3d.activeTextureUnit(canvas3d.ctx, 0); } else { @@ -2667,7 +2667,7 @@ public class GraphicsContext3D extends Object { canvas3d.resetTexture(canvas3d.ctx, i); canvas3d.texUnitState[i].texture = null; } - } + } } // set the active texture unit back to 0 @@ -2701,7 +2701,7 @@ public class GraphicsContext3D extends Object { if (app.texCoordGeneration != null) { app.texCoordGeneration.updateNative(canvas3d); canvas3d.canvasDirty |= Canvas3D.TEXTUREBIN_DIRTY|Canvas3D.TEXTUREATTRIBUTES_DIRTY; - if ((canvas3d.texUnitState != null) && + if ((canvas3d.texUnitState != null) && (canvas3d.texUnitState[0] != null)) { canvas3d.texUnitState[0].texGen = app.texCoordGeneration; } @@ -2709,20 +2709,20 @@ public class GraphicsContext3D extends Object { else { // If the canvas does not alreadt have a null texCoordGeneration // load the default - if ((canvas3d.texUnitState != null) && + if ((canvas3d.texUnitState != null) && (canvas3d.texUnitState[0] != null) && (canvas3d.texUnitState[0].texGen != null)) { canvas3d.resetTexCoordGeneration(canvas3d.ctx); - canvas3d.canvasDirty |= Canvas3D.TEXTUREBIN_DIRTY|Canvas3D.TEXTUREATTRIBUTES_DIRTY; + canvas3d.canvasDirty |= Canvas3D.TEXTUREBIN_DIRTY|Canvas3D.TEXTUREATTRIBUTES_DIRTY; canvas3d.texUnitState[0].texGen = app.texCoordGeneration; } } - - + + if (app.textureAttributes != null) { - if ((canvas3d.texUnitState != null) && + if ((canvas3d.texUnitState != null) && (canvas3d.texUnitState[0] != null)) { - + if (canvas3d.texUnitState[0].texture != null) { app.textureAttributes.updateNative(canvas3d, false, canvas3d.texUnitState[0].texture.format); @@ -2738,11 +2738,11 @@ public class GraphicsContext3D extends Object { else { // If the canvas does not already have a null texAttribute // load the default if necessary - if ((canvas3d.texUnitState != null) && - (canvas3d.texUnitState[0] != null) && + if ((canvas3d.texUnitState != null) && + (canvas3d.texUnitState[0] != null) && (canvas3d.texUnitState[0].texAttrs != null)) { canvas3d.resetTextureAttributes(canvas3d.ctx); - canvas3d.canvasDirty |= Canvas3D.TEXTUREBIN_DIRTY|Canvas3D.TEXTUREATTRIBUTES_DIRTY; + canvas3d.canvasDirty |= Canvas3D.TEXTUREBIN_DIRTY|Canvas3D.TEXTUREATTRIBUTES_DIRTY; canvas3d.texUnitState[0].texAttrs = null; } } @@ -2769,8 +2769,8 @@ public class GraphicsContext3D extends Object { if (app.transparencyAttributes != null) { app.transparencyAttributes.updateNative(canvas3d.ctx, - alpha, geometryType, - polygonMode, + alpha, geometryType, + polygonMode, lineAA, pointAA); canvas3d.canvasDirty |= Canvas3D.TRANSPARENCYATTRS_DIRTY; canvas3d.transparency = app.transparencyAttributes; @@ -2799,21 +2799,21 @@ public class GraphicsContext3D extends Object { canvas3d.canvasDirty |= Canvas3D.ATTRIBUTEBIN_DIRTY|Canvas3D.TEXTUREATTRIBUTES_DIRTY; canvas3d.renderingAttrs = app.renderingAttributes; - useAlpha = useAlpha || - (app.renderingAttributes.alphaTestFunction + useAlpha = useAlpha || + (app.renderingAttributes.alphaTestFunction != RenderingAttributes.ALWAYS); } else { // If the canvas does not alreadt have a null renderingAttrs // load the default ignoreVertexColors = false; if (canvas3d.renderingAttrs != null) { - canvas3d.resetRenderingAttributes(canvas3d.ctx, - canvas3d.depthBufferWriteEnableOverride, + canvas3d.resetRenderingAttributes(canvas3d.ctx, + canvas3d.depthBufferWriteEnableOverride, canvas3d.depthBufferEnableOverride); canvas3d.canvasDirty |= Canvas3D.ATTRIBUTEBIN_DIRTY|Canvas3D.TEXTUREATTRIBUTES_DIRTY; canvas3d.renderingAttrs = null; } - } + } if (app.polygonAttributes != null) { @@ -2861,7 +2861,7 @@ public class GraphicsContext3D extends Object { canvas3d.pointAttributes = null; } } - + canvas3d.appearance = app; } else { @@ -2871,21 +2871,21 @@ public class GraphicsContext3D extends Object { } } - + return (useAlpha ); } void initializeState() { - + canvas3d.setSceneAmbient(canvas3d.ctx, 0.0f, 0.0f, 0.0f); canvas3d.disableFog(canvas3d.ctx); canvas3d.resetRenderingAttributes(canvas3d.ctx,false, false); - + if(canvas3d.shaderProgram != null) { canvas3d.shaderProgram.updateNative(canvas3d, false); canvas3d.shaderProgram = null; } - + // reset the previously enabled texture units int prevNumActiveTexUnit = canvas3d.getNumActiveTexUnit(); @@ -2924,7 +2924,7 @@ public class GraphicsContext3D extends Object { //System.err.println("GC3D.resetAppearance ...."); if (canvas3d.material != null) { - canvas3d.updateMaterial(canvas3d.ctx, + canvas3d.updateMaterial(canvas3d.ctx, red, green, blue, alpha); canvas3d.material = null; canvas3d.canvasDirty |= Canvas3D.MATERIAL_DIRTY; @@ -3001,7 +3001,7 @@ public class GraphicsContext3D extends Object { } } - void sendRenderMessage(boolean renderRun, int command, + void sendRenderMessage(boolean renderRun, int command, Object arg1, Object arg2) { // send a message to the request renderer @@ -3023,7 +3023,7 @@ public class GraphicsContext3D extends Object { } canvas3d.screen.renderer.rendererStructure.addMessage(renderMessage); - + if (renderRun) { // notify mc that there is work to do VirtualUniverse.mc.sendRunMessage(canvas3d.view, J3dThread.RENDER_THREAD); @@ -3034,7 +3034,7 @@ public class GraphicsContext3D extends Object { } void sendSoundMessage(int command, Object arg1, Object arg2) { - if ((canvas3d.view == null) || + if ((canvas3d.view == null) || (canvas3d.view.universe == null) ) { return; } diff --git a/src/classes/share/javax/media/j3d/Group.java b/src/classes/share/javax/media/j3d/Group.java index d9c9c96..ccdc4a0 100644 --- a/src/classes/share/javax/media/j3d/Group.java +++ b/src/classes/share/javax/media/j3d/Group.java @@ -84,8 +84,8 @@ public class Group extends Node { ALLOW_CHILDREN_READ, ALLOW_COLLISION_BOUNDS_READ }; - - + + /** * Creates the retained mode GroupRetained object that this * Group component object will point to. @@ -94,7 +94,7 @@ public class Group extends Node { retained = new GroupRetained(); retained.setSource(this); } - + /** * Sets the collision bounds of a node. @@ -154,7 +154,7 @@ public class Group extends Node { if (!getCapability(ALLOW_CHILDREN_WRITE)) throw new CapabilityNotSetException(J3dI18N.getString("Group13")); - if ((oldchild != null) && + if ((oldchild != null) && (! ((BranchGroup)oldchild).getCapability(BranchGroup.ALLOW_DETACH))) { throw new CapabilityNotSetException(J3dI18N.getString("Group4")); } @@ -162,7 +162,7 @@ public class Group extends Node { ((GroupRetained)retained).setChild(child, index); } - + /** * Inserts the specified child node in this group node's list of * children at the specified index. @@ -196,7 +196,7 @@ public class Group extends Node { ((GroupRetained)this.retained).insertChild(child, index); } - + /** * Removes the child node at the specified index from this group node's * list of children. @@ -228,7 +228,7 @@ public class Group extends Node { ((GroupRetained)this.retained).removeChild(index); } - + /** * Retrieves the child node at the specified index in * this group node's list of children. @@ -247,7 +247,7 @@ public class Group extends Node { return (Node) ((GroupRetained)this.retained).getChild(index); } - + /** * Returns an Enumeration object of this group node's list of children. * @return an Enumeration object of all the children @@ -289,7 +289,7 @@ public class Group extends Node { ((GroupRetained)this.retained).addChild(child); } - + /** * Moves the specified branch group node from its existing location to * the end of this group node's list of children. @@ -310,7 +310,7 @@ public class Group extends Node { ((GroupRetained)this.retained).moveTo(branchGroup); } - + /** * Returns a count of this group node's children. * @return the number of children descendant from this node. @@ -417,12 +417,12 @@ public class Group extends Node { /** * Causes this Group node to be reported as the collision target when - * collision is being used and this node or any of its children is in + * collision is being used and this node or any of its children is in * a collision. The default value is false. For collision with * USE_GEOMETRY set, the collision traverser will check the geometry - * of all the Group node's leaf descendants; for collision with + * of all the Group node's leaf descendants; for collision with * USE_BOUNDS set, the collision traverser will only check the bounds - * at this Group node. In both cases, if there is a collision, this + * at this Group node. In both cases, if there is a collision, this * Group node will be reported as the colliding object in the * SceneGraphPath. This reporting is done regardless of whether * ENABLE_COLLISION_REPORTING @@ -475,7 +475,7 @@ public class Group extends Node { int nChildren = rt.numChildren(); // call cloneTree on all child nodes - for (int i = 0; i < nChildren; i++) { + for (int i = 0; i < nChildren; i++) { Node n = rt.getChild(i); Node clonedN = n.cloneTree(forceDuplicate, nodeHashtable); // add the cloned child to the cloned group node @@ -492,7 +492,7 @@ public class Group extends Node { * <code>originalNode</code> into * the current node. This method is called from the * <code>cloneNode</code> method which is, in turn, called by the - * <code>cloneTree</code> method.<P> + * <code>cloneTree</code> method.<P> * * @param originalNode the original node to duplicate. * @param forceDuplicate when set to <code>true</code>, causes the @@ -523,7 +523,7 @@ public class Group extends Node { rt.children.clear(); } - + /** * Used to create a new instance of the node. This routine is called * by <code>cloneTree</code> to duplicate the current node. @@ -555,6 +555,6 @@ public class Group extends Node { */ public Group() { // set default read capabilities - setDefaultReadCapabilities(readCapabilities); + setDefaultReadCapabilities(readCapabilities); } } diff --git a/src/classes/share/javax/media/j3d/GroupRetained.java b/src/classes/share/javax/media/j3d/GroupRetained.java index 860abfd..674d650 100644 --- a/src/classes/share/javax/media/j3d/GroupRetained.java +++ b/src/classes/share/javax/media/j3d/GroupRetained.java @@ -86,7 +86,7 @@ class GroupRetained extends NodeRetained implements BHLeafInterface { // per shared path ordered path data ArrayList orderedPaths = null; - + /** * If collisionBound is set, this is equal to the * transformed collisionBounds, otherwise it is equal @@ -111,7 +111,7 @@ class GroupRetained extends NodeRetained implements BHLeafInterface { HashKey key; /** - * sourceNode of this mirror Group + * sourceNode of this mirror Group */ GroupRetained sourceNode; @@ -138,7 +138,7 @@ class GroupRetained extends NodeRetained implements BHLeafInterface { // > 0 if this group is being used in scoping int scopingRefCount = 0; - + ArrayList compiledChildrenList = null; boolean isInClearLive = false; @@ -165,7 +165,7 @@ class GroupRetained extends NodeRetained implements BHLeafInterface { ((BoundingSphere) localBounds).setRadius(-1.0); } } - + /** * Sets the collision bounds of a node. * @param bounds the bounding object for the node @@ -187,7 +187,7 @@ class GroupRetained extends NodeRetained implements BHLeafInterface { VirtualUniverse.mc.processMessage(message); } - } + } /** @@ -196,8 +196,8 @@ class GroupRetained extends NodeRetained implements BHLeafInterface { */ Bounds getCollisionBounds() { return (collisionBound == null ? null : (Bounds)collisionBound.clone()); - } - + } + /** * Replaces the specified child with the child provided. * @param child the new child @@ -210,7 +210,7 @@ class GroupRetained extends NodeRetained implements BHLeafInterface { universe.resetWaitMCFlag(); synchronized (universe.sceneGraphLock) { doSetChild(child, index); - universe.setLiveState.clear(); + universe.setLiveState.clear(); } universe.waitForMC(); @@ -218,27 +218,27 @@ class GroupRetained extends NodeRetained implements BHLeafInterface { doSetChild(child, index); if (universe != null) { synchronized (universe.sceneGraphLock) { - universe.setLiveState.clear(); - } + universe.setLiveState.clear(); + } } } dirtyBoundsCache(); } - + // The method that does the work once the lock is acquired. void doSetChild(Node child, int index) { NodeRetained oldchildr; J3dMessage[] messages = null; int numMessages = 0; int attachStartIndex = 0; - + // since we want to make sure the replacement of the child // including removal of the oldChild and insertion of the newChild // all happen in the same frame, we'll send all the necessary // messages to masterControl for processing in one call. // So let's first find out how many messages will be sent - + oldchildr = (NodeRetained) children.get(index); if (this.source.isLive()) { @@ -275,7 +275,7 @@ class GroupRetained extends NodeRetained implements BHLeafInterface { } return; } - + if (this.source.isLive()) { universe.notifyStructureChangeListeners(true, this.source, (BranchGroup)child); } @@ -294,7 +294,7 @@ class GroupRetained extends NodeRetained implements BHLeafInterface { VirtualUniverse.mc.processMessage(messages); } } - + /** * Inserts the specified child at specified index. * @param child the new child @@ -308,20 +308,20 @@ class GroupRetained extends NodeRetained implements BHLeafInterface { synchronized (universe.sceneGraphLock) { universe.notifyStructureChangeListeners(true, this.source, (BranchGroup)child); doInsertChild(child, index); - universe.setLiveState.clear(); + universe.setLiveState.clear(); } universe.waitForMC(); } else { doInsertChild(child, index); if (universe != null) { synchronized (universe.sceneGraphLock) { - universe.setLiveState.clear(); - } + universe.setLiveState.clear(); + } } } dirtyBoundsCache(); } - + // The method that does the work once the lock is acquired. void doInsertChild(Node child, int index) { int i; @@ -332,12 +332,12 @@ class GroupRetained extends NodeRetained implements BHLeafInterface { childi = (NodeRetained) children.get(i); if(childi != null) childi.childIndex++; - } + } if(child==null) { children.add(index, null); return; } - + NodeRetained childr = (NodeRetained) child.retained; childr.setParent(this); children.add(index, childr); @@ -346,19 +346,19 @@ class GroupRetained extends NodeRetained implements BHLeafInterface { ((BranchGroupRetained)childr).isNew = true; } } - + /** * Removes the child at specified index. * @param index which child to remove */ void removeChild(int index) { - + if (this.source.isLive()) { universe.resetWaitMCFlag(); synchronized (universe.sceneGraphLock) { NodeRetained childr = (NodeRetained)children.get(index); doRemoveChild(index, null, 0); - universe.setLiveState.clear(); + universe.setLiveState.clear(); universe.notifyStructureChangeListeners(false, this.source, (BranchGroup)childr.source); } universe.waitForMC(); @@ -366,20 +366,20 @@ class GroupRetained extends NodeRetained implements BHLeafInterface { doRemoveChild(index, null, 0); if (universe != null) { synchronized (universe.sceneGraphLock) { - universe.setLiveState.clear(); - } + universe.setLiveState.clear(); + } } } dirtyBoundsCache(); } - /** + /** * Returns the index of the specified Node in this Group's list of Nodes * @param Node whose index is desired * @return index of the Node */ int indexOfChild(Node child) { - if(child != null) + if(child != null) return children.indexOf((NodeRetained)child.retained); else return children.indexOf(null); @@ -410,7 +410,7 @@ class GroupRetained extends NodeRetained implements BHLeafInterface { void doRemoveChild(int index, J3dMessage messages[], int messageIndex) { NodeRetained oldchildr, child; int i; - + oldchildr = (NodeRetained) children.get(index); int size = children.size(); @@ -424,7 +424,7 @@ class GroupRetained extends NodeRetained implements BHLeafInterface { oldchildr.setParent(null); checkClearLive(oldchildr, messages, messageIndex, index, null); } - + children.remove(index); removeChildrenData(index); @@ -435,7 +435,7 @@ class GroupRetained extends NodeRetained implements BHLeafInterface { } } - + /** * Returns the child specified by the index. * @param index which child to return @@ -446,18 +446,18 @@ class GroupRetained extends NodeRetained implements BHLeafInterface { SceneGraphObjectRetained sgo = (SceneGraphObjectRetained) children.get(index); if(sgo == null) return null; - else + else return (Node) sgo.source; } - + /** * Returns an enumeration object of the children. * @return an enumeration object of the children - */ + */ Enumeration getAllChildren() { Vector userChildren=new Vector(children.size()); SceneGraphObjectRetained sgo; - + for(int i=0; i<children.size(); i++) { sgo = (SceneGraphObjectRetained)children.get(i); if(sgo != null) @@ -465,14 +465,14 @@ class GroupRetained extends NodeRetained implements BHLeafInterface { else userChildren.add(null); } - + return userChildren.elements(); } void checkValidChild(Node child, String s) { if ((child != null) && - (((child instanceof BranchGroup) && + (((child instanceof BranchGroup) && (((BranchGroupRetained) child.retained).attachedToLocale)) || (((NodeRetained)child.retained).parent != null))) { throw new MultipleParentException(J3dI18N.getString(s)); @@ -485,36 +485,36 @@ class GroupRetained extends NodeRetained implements BHLeafInterface { */ void addChild(Node child) { checkValidChild(child, "GroupRetained2"); - + if (this.source.isLive()) { universe.resetWaitMCFlag(); synchronized (universe.sceneGraphLock) { universe.notifyStructureChangeListeners(true, this.source, (BranchGroup)child); doAddChild(child, null, 0); - universe.setLiveState.clear(); + universe.setLiveState.clear(); } universe.waitForMC(); } else { doAddChild(child, null, 0); if (universe != null) { synchronized (universe.sceneGraphLock) { - universe.setLiveState.clear(); - } + universe.setLiveState.clear(); + } } } dirtyBoundsCache(); } - + // The method that does the work once the lock is acquired. void doAddChild(Node child, J3dMessage messages[], int messageIndex) { appendChildrenData(); - if(child == null) { + if(child == null) { children.add(null); return; } - + NodeRetained childr = (NodeRetained) child.retained; childr.setParent(this); children.add(childr); @@ -524,7 +524,7 @@ class GroupRetained extends NodeRetained implements BHLeafInterface { } } - + void moveTo(BranchGroup bg) { if (bg != null) { ((GroupRetained)bg.retained).dirtyBoundsCache(); @@ -534,7 +534,7 @@ class GroupRetained extends NodeRetained implements BHLeafInterface { synchronized (universe.sceneGraphLock) { GroupRetained oldParent = (GroupRetained)((BranchGroupRetained)bg.retained).parent; doMoveTo(bg); - universe.setLiveState.clear(); + universe.setLiveState.clear(); if (oldParent==null) universe.notifyStructureChangeListeners(((BranchGroupRetained)bg.retained).locale, this.source, bg); else @@ -545,26 +545,26 @@ class GroupRetained extends NodeRetained implements BHLeafInterface { doMoveTo(bg); if (universe != null) { synchronized (universe.sceneGraphLock) { - universe.setLiveState.clear(); - } + universe.setLiveState.clear(); + } } } dirtyBoundsCache(); } - + // The method that does the work once the lock is acquired. void doMoveTo(BranchGroup branchGroup) { J3dMessage messages[] = null; int numMessages = 0; int detachStartIndex = 0; - int attachStartIndex = 0; + int attachStartIndex = 0; if(branchGroup != null) { BranchGroupRetained bg = (BranchGroupRetained) branchGroup.retained; GroupRetained g = (GroupRetained)bg.parent; // Find out how many messages to be created // Note that g can be NULL if branchGroup parent is - // a Locale, in this case the following condition + // a Locale, in this case the following condition // will fail. // Figure out the number of messages based on whether the group // from which its moving from is live and group to which its @@ -578,7 +578,7 @@ class GroupRetained extends NodeRetained implements BHLeafInterface { numMessages = 0; attachStartIndex = 0; } - + } else { // Attached to locale numMessages = 3; // REMOVE_NODES, ORDERED_GROUP_REMOVED, VIEWSPECIFICGROUP_CLEAR @@ -590,7 +590,7 @@ class GroupRetained extends NodeRetained implements BHLeafInterface { numMessages+=4; // INSERT_NODES, BEHAVIOR_ACTIVATE // ORDERED_GROUP_INSERTED, VIEWSPECIFICGROUP_INIT - } + } messages = new J3dMessage[numMessages]; for (int i=0; i<numMessages; i++) { messages[i] = new J3dMessage(); @@ -600,17 +600,17 @@ class GroupRetained extends NodeRetained implements BHLeafInterface { // Remove it from it's parents state if (g == null) { if (bg.locale != null) { - bg.locale.doRemoveBranchGraph(branchGroup, + bg.locale.doRemoveBranchGraph(branchGroup, messages, detachStartIndex); } } else { g.doRemoveChild(g.children.indexOf(bg), - messages, + messages, detachStartIndex); } } - + // Add it to it's new parent doAddChild(branchGroup, messages, attachStartIndex); @@ -630,13 +630,13 @@ class GroupRetained extends NodeRetained implements BHLeafInterface { if (count > 0) { ms = new J3dMessage[count]; } - + int k=0; for (int i=0; i < numMessages; i++) { if (messages[i].type != J3dMessage.INVALID_TYPE) { ms[k++] = messages[i]; - } - } + } + } if (ms != null) { VirtualUniverse.mc.processMessage(ms); } @@ -652,7 +652,7 @@ class GroupRetained extends NodeRetained implements BHLeafInterface { int numChildren() { return children.size(); } - + // Remove a light from the list of lights void removeLight(int numLgt, LightRetained[] removelight, HashKey key) { ArrayList l; @@ -680,7 +680,7 @@ class GroupRetained extends NodeRetained implements BHLeafInterface { // one from itself and one call from every LightRetained // reference this. So there is case that this procedure get // called when light already removed. - if (i >= 0) + if (i >= 0) lights.remove(i); */ } @@ -777,7 +777,7 @@ class GroupRetained extends NodeRetained implements BHLeafInterface { } } } - + void addAllNodesForScopedFog(FogRetained mfog, ArrayList list, HashKey k) { if (inSharedGroup) { @@ -792,8 +792,8 @@ class GroupRetained extends NodeRetained implements BHLeafInterface { } void processAddNodesForScopedFog(FogRetained mfog, ArrayList list, HashKey k) { - // If this group has it own scoping list then add .. - if (allocatedFogs) + // If this group has it own scoping list then add .. + if (allocatedFogs) addFog(mfog, k); // If the source is live, then notify the children if (this.source.isLive() || this.isInSetLive()) { @@ -821,7 +821,7 @@ class GroupRetained extends NodeRetained implements BHLeafInterface { } } } - + // If its a group, then add the scope to the group, if // its a shape, then keep a list to be added during // updateMirrorObject @@ -838,7 +838,7 @@ class GroupRetained extends NodeRetained implements BHLeafInterface { } void processRemoveAllNodesForScopedFog(FogRetained mfog, ArrayList list, HashKey k) { // If the source is live, then notify the children - if (allocatedFogs) + if (allocatedFogs) removeFog(mfog, k); if (this.source.isLive() && !isInClearLive) { for (int i = children.size()-1; i >=0; i--) { @@ -878,7 +878,7 @@ class GroupRetained extends NodeRetained implements BHLeafInterface { processAddNodesForScopedModelClip(mModelClip, list, k); } } - + void processAddNodesForScopedModelClip(ModelClipRetained mModelClip, ArrayList list, HashKey k) { @@ -921,7 +921,7 @@ class GroupRetained extends NodeRetained implements BHLeafInterface { else { processRemoveAllNodesForScopedModelClip(mModelClip, list, k); } - + } // If its a group, then add the scope to the group, if @@ -968,7 +968,7 @@ class GroupRetained extends NodeRetained implements BHLeafInterface { else { processAddNodesForScopedAltApp(mAltApp, list, k); } - } + } // If its a group, then add the scope to the group, if // its a shape, then keep a list to be added during @@ -1080,7 +1080,7 @@ class GroupRetained extends NodeRetained implements BHLeafInterface { } } lights = newLights; - + } scopingRefCount++; } @@ -1120,7 +1120,7 @@ class GroupRetained extends NodeRetained implements BHLeafInterface { } } fogs = newFogs; - + } scopingRefCount++; } @@ -1160,7 +1160,7 @@ class GroupRetained extends NodeRetained implements BHLeafInterface { } } modelClips = newMclips; - + } scopingRefCount++; } @@ -1200,20 +1200,20 @@ class GroupRetained extends NodeRetained implements BHLeafInterface { } } altAppearances = newAltApps; - + } scopingRefCount++; } synchronized void removeAltAppScope() { scopingRefCount--; - } + } synchronized boolean usedInScoping() { return (scopingRefCount > 0); } - + // Add a light to the list of lights void addLight(LightRetained[] addlight, int numLgts, HashKey key) { ArrayList l; @@ -1248,9 +1248,9 @@ class GroupRetained extends NodeRetained implements BHLeafInterface { l = (ArrayList)fogs.get(0); l.add(fog); } - + } - + // Add a ModelClip to the list of ModelClip void addModelClip(ModelClipRetained modelClip, HashKey key) { ArrayList l; @@ -1281,10 +1281,10 @@ class GroupRetained extends NodeRetained implements BHLeafInterface { l = (ArrayList)altAppearances.get(0); l.add(altApp); } - + } - - + + // Remove a fog from the list of fogs void removeFog(FogRetained fog, HashKey key) { ArrayList l; @@ -1346,8 +1346,8 @@ class GroupRetained extends NodeRetained implements BHLeafInterface { } } - - + + void updatePickable(HashKey keys[], boolean pick[]) { int numChildLessOne = children.size() - 1; super.updatePickable(keys, pick); @@ -1368,28 +1368,28 @@ class GroupRetained extends NodeRetained implements BHLeafInterface { // No need to clone for the last value child = (NodeRetained)children.get(i); - if(child != null) + if(child != null) child.updatePickable(keys, pick); } - + void updateCollidable(HashKey keys[], boolean collide[]) { int numChildLessOne = children.size() - 1; super.updateCollidable(keys, collide); int i=0; NodeRetained child; - + // Fix for issue 540 if (numChildLessOne < 0) { return; } // End fix for issue 540 - + for (i = 0; i < numChildLessOne; i++) { child = (NodeRetained)children.get(i); - if(child != null) - child.updateCollidable(keys, (boolean []) collide.clone()); + if(child != null) + child.updateCollidable(keys, (boolean []) collide.clone()); } // No need to clone for the last value child = (NodeRetained)children.get(i); @@ -1432,7 +1432,7 @@ class GroupRetained extends NodeRetained implements BHLeafInterface { for (int i=0; i<numPath; i++) { ct = ti.getCachedTargets(TargetsInterface.TRANSFORM_TARGETS, i, -1); if (ct != null) { - targets.addNode((NnuId)mirrorGroup.get(i), + targets.addNode((NnuId)mirrorGroup.get(i), Targets.GRP_TARGETS); newCtArr[i] = targets.snapShotAdd(ct); } else { @@ -1455,7 +1455,7 @@ class GroupRetained extends NodeRetained implements BHLeafInterface { message.args[2] = newCtArr; } else { - TargetsInterface ti = + TargetsInterface ti = getClosestTargetsInterface(TargetsInterface.TRANSFORM_TARGETS); if (ti != null) { @@ -1466,7 +1466,7 @@ class GroupRetained extends NodeRetained implements BHLeafInterface { newCtArr = new CachedTargets[numPath]; for (int i=0; i<numPath; i++) { ct = ti.getCachedTargets(TargetsInterface.TRANSFORM_TARGETS, i, -1); - if (ct != null) { + if (ct != null) { targets.addNode((NnuId)mirrorGroup.get(i), Targets.GRP_TARGETS); //Note snapShotRemove calls targets.clearNode() @@ -1503,19 +1503,19 @@ class GroupRetained extends NodeRetained implements BHLeafInterface { * This checks is setLive needs to be called. If it does, it gets the * needed info and calls it. */ - void checkSetLive(NodeRetained child, int childIndex, J3dMessage messages[], + void checkSetLive(NodeRetained child, int childIndex, J3dMessage messages[], int messageIndex, NodeRetained linkNode) { checkSetLive(child, childIndex, localToVworldKeys, inSharedGroup, messages, messageIndex, linkNode); } - + /** * This checks is setLive needs to be called. If it does, it gets the * needed info and calls it. */ - void checkSetLive(NodeRetained child, int childIndex, HashKey keys[], - boolean isShared, J3dMessage messages[], + void checkSetLive(NodeRetained child, int childIndex, HashKey keys[], + boolean isShared, J3dMessage messages[], int messageIndex, NodeRetained linkNode) { SceneGraphObject me = this.source; @@ -1534,7 +1534,7 @@ class GroupRetained extends NodeRetained implements BHLeafInterface { s.inBackgroundGroup = inBackgroundGroup; s.inViewSpecificGroup = inViewSpecificGroup; s.geometryBackground = geometryBackground; - s.keys = keys; + s.keys = keys; s.viewLists = viewLists; s.parentBranchGroupPaths = branchGroupPaths; // Note that there is no need to clone individual @@ -1565,7 +1565,7 @@ class GroupRetained extends NodeRetained implements BHLeafInterface { s.pickable = pick; findCollidableFlags(collide); - super.updateCollidable(null, collide); + super.updateCollidable(null, collide); s.collidable = collide; TargetsInterface transformInterface, switchInterface; @@ -1573,7 +1573,7 @@ class GroupRetained extends NodeRetained implements BHLeafInterface { switchInterface = initSwitchStates(s, this, child, linkNode, true); - if (s.inViewSpecificGroup && + if (s.inViewSpecificGroup && (s.changedViewGroup == null)) { s.changedViewGroup = new ArrayList(); s.changedViewList = new ArrayList(); @@ -1593,7 +1593,7 @@ class GroupRetained extends NodeRetained implements BHLeafInterface { // We need to create an array of messages to MasterControl, this // will ensure that all these messages will get the same time stamp. - // If it is called from "moveTo", messages is not null. + // If it is called from "moveTo", messages is not null. if (messages == null) { int numMessages = 2; if(s.ogList.size() > 0) { @@ -1616,10 +1616,10 @@ class GroupRetained extends NodeRetained implements BHLeafInterface { } sendMessages = true; } - + if(sendOGMessage) { - createMessage = messages[messageIndex++]; - createMessage.threads = J3dThread.UPDATE_RENDER | + createMessage = messages[messageIndex++]; + createMessage.threads = J3dThread.UPDATE_RENDER | J3dThread.UPDATE_RENDERING_ENVIRONMENT; createMessage.type = J3dMessage.ORDERED_GROUP_INSERTED; createMessage.universe = universe; @@ -1652,13 +1652,13 @@ class GroupRetained extends NodeRetained implements BHLeafInterface { } else { createMessage.args[1] = null; createMessage.args[2] = null; - } + } if (s.viewScopedNodeList != null) { createMessage.args[3] = s.viewScopedNodeList; createMessage.args[4] = s.scopedNodesViewList; } - + // execute user behavior's initialize methods int sz = s.behaviorNodes.size(); @@ -1671,7 +1671,7 @@ class GroupRetained extends NodeRetained implements BHLeafInterface { s.behaviorNodes.clear(); createMessage = messages[messageIndex++]; - + createMessage.threads = J3dThread.UPDATE_BEHAVIOR; createMessage.type = J3dMessage.BEHAVIOR_ACTIVATE; createMessage.universe = universe; @@ -1692,15 +1692,15 @@ class GroupRetained extends NodeRetained implements BHLeafInterface { } - + void checkClearLive(NodeRetained child, - J3dMessage messages[], int messageIndex, + J3dMessage messages[], int messageIndex, int childIndex, NodeRetained linkNode) { checkClearLive(child, localToVworldKeys, inSharedGroup, messages, messageIndex, childIndex, linkNode); } - + /** * This checks if clearLive needs to be called. If it does, it gets the @@ -1735,7 +1735,7 @@ class GroupRetained extends NodeRetained implements BHLeafInterface { s.modelClips = modelClips; // Issue 312: Allocate data structures if we are in a ViewSpecificGroup - if (s.inViewSpecificGroup && + if (s.inViewSpecificGroup && (s.changedViewGroup == null)) { s.changedViewGroup = new ArrayList(); s.changedViewList = new ArrayList(); @@ -1757,7 +1757,7 @@ class GroupRetained extends NodeRetained implements BHLeafInterface { 0, og.userChildIndexOrder.length); } s.ogCIOTableList.add(newArr); - + } // Issue 312: always initialize s.viewLists @@ -1805,7 +1805,7 @@ class GroupRetained extends NodeRetained implements BHLeafInterface { if(sendOGMessage) { destroyMessage = messages[messageIndex++]; - destroyMessage.threads = J3dThread.UPDATE_RENDER | + destroyMessage.threads = J3dThread.UPDATE_RENDER | J3dThread.UPDATE_RENDERING_ENVIRONMENT; destroyMessage.type = J3dMessage.ORDERED_GROUP_REMOVED; destroyMessage.universe = universe; @@ -1819,26 +1819,26 @@ class GroupRetained extends NodeRetained implements BHLeafInterface { // RenderingEnvironmentStructure before we send VIEWSPECIFICGROUP_CLEAR, // since the latter clears the list of views that is referred to by // scopedNodesViewList and used by removeNodes. - destroyMessage = messages[messageIndex++]; + destroyMessage = messages[messageIndex++]; destroyMessage.threads = s.notifyThreads; destroyMessage.type = J3dMessage.REMOVE_NODES; destroyMessage.universe = universe; destroyMessage.args[0] = s.nodeList.toArray(); - + if (newCtArr != null) { destroyMessage.args[1] = transformInterface; destroyMessage.args[2] = newCtArr; } else { destroyMessage.args[1] = null; destroyMessage.args[2] = null; - } + } if (s.viewScopedNodeList != null) { destroyMessage.args[3] = s.viewScopedNodeList; destroyMessage.args[4] = s.scopedNodesViewList; } if(sendVSGMessage) { - destroyMessage = messages[messageIndex++]; + destroyMessage = messages[messageIndex++]; destroyMessage.threads = J3dThread.UPDATE_RENDERING_ENVIRONMENT; destroyMessage.type = J3dMessage.VIEWSPECIFICGROUP_CLEAR; destroyMessage.universe = universe; @@ -1849,7 +1849,7 @@ class GroupRetained extends NodeRetained implements BHLeafInterface { if (sendMessages == true) { VirtualUniverse.mc.processMessage(messages); } - + s.reset(null); // for GC } } @@ -1885,23 +1885,23 @@ class GroupRetained extends NodeRetained implements BHLeafInterface { int transformLevels[] = new int[numPaths]; findTransformLevels(transformLevels); s.transformLevels = transformLevels; - + if (ti != null) { Targets[] newTargets = new Targets[numPaths]; for(int i=0; i<numPaths; i++) { - if (s.transformLevels[i] >= 0) { + if (s.transformLevels[i] >= 0) { newTargets[i] = new Targets(); } else { newTargets[i] = null; } } s.transformTargets = newTargets; - + // XXXX: optimization for targetThreads computation, require // cleanup in GroupRetained.doSetLive() //s.transformTargetThreads = 0; } - + return ti; } @@ -1983,12 +1983,12 @@ class GroupRetained extends NodeRetained implements BHLeafInterface { newCtArr); ti.resetCachedTargets(TargetsInterface.TRANSFORM_TARGETS, newCtArr, -1); - + } return newCtArr; } - TargetsInterface initSwitchStates(SetLiveState s, + TargetsInterface initSwitchStates(SetLiveState s, NodeRetained parentNode, NodeRetained childNode, NodeRetained linkNode, boolean isSetLive) { NodeRetained child; @@ -2042,11 +2042,11 @@ class GroupRetained extends NodeRetained implements BHLeafInterface { s.switchStates = new ArrayList(1); s.switchStates.add(new SwitchState(false)); } - } + } return ti; } - void updateSwitchStates(SetLiveState s, TargetsInterface ti, + void updateSwitchStates(SetLiveState s, TargetsInterface ti, boolean isSetLive) { // update switch leaves's compositeSwitchMask for ancestors @@ -2078,10 +2078,10 @@ class GroupRetained extends NodeRetained implements BHLeafInterface { for (int i=0; i<s.keys.length; i++) { if (s.switchTargets[i] != null) { ct = ti.getCachedTargets( - TargetsInterface.SWITCH_TARGETS, i, + TargetsInterface.SWITCH_TARGETS, i, parentSwitchLinkChildIndex); if (ct != null) { - newCtArr[i] = + newCtArr[i] = s.switchTargets[i].snapShotAdd(ct); } else { newCtArr[i] = @@ -2102,7 +2102,7 @@ class GroupRetained extends NodeRetained implements BHLeafInterface { } else { CachedTargets ct; - CachedTargets[] newCtArr = + CachedTargets[] newCtArr = new CachedTargets[localToVworld.length]; if (! inSharedGroup) { @@ -2155,7 +2155,7 @@ class GroupRetained extends NodeRetained implements BHLeafInterface { synchronized void updateLocalToVworld() { NodeRetained child; - + // For each children call ..... for (int i=children.size()-1; i>=0; i--) { child = (NodeRetained)children.get(i); @@ -2218,7 +2218,7 @@ class GroupRetained extends NodeRetained implements BHLeafInterface { ArrayList savedScopedFogs = s.fogs; ArrayList savedScopedAltApps = s.altAppearances; ArrayList savedScopedMclips = s.modelClips; - + boolean oldpickableArray[] = (boolean []) s.pickable.clone(); boolean oldcollidableArray[] = (boolean []) s.collidable.clone(); boolean workingpickableArray[] = new boolean[oldpickableArray.length]; @@ -2281,7 +2281,7 @@ class GroupRetained extends NodeRetained implements BHLeafInterface { l.add(src.get(k)); } } - + } } else { @@ -2314,7 +2314,7 @@ class GroupRetained extends NodeRetained implements BHLeafInterface { l.add(src.get(k)); } } - + } } else { @@ -2347,7 +2347,7 @@ class GroupRetained extends NodeRetained implements BHLeafInterface { l.add(src.get(k)); } } - + } } else { @@ -2380,7 +2380,7 @@ class GroupRetained extends NodeRetained implements BHLeafInterface { l.add(src.get(k)); } } - + } } else { @@ -2418,9 +2418,9 @@ class GroupRetained extends NodeRetained implements BHLeafInterface { j = s.keys[i].equals(localToVworldKeys, 0, localToVworldKeys.length); if(j < 0) { - System.err.println("GroupRetained : Can't find hashKey"); + System.err.println("GroupRetained : Can't find hashKey"); } - + g.localToVworld[0] = localToVworld[j]; g.localToVworldIndex[0] = localToVworldIndex[j]; g.collisionVwcBounds = new BoundingBox(); @@ -2450,7 +2450,7 @@ class GroupRetained extends NodeRetained implements BHLeafInterface { g.sourceNode = this; g.locale = locale; // need by getVisibleGeometryAtom() mirrorGroup.add(g); - if (s.transformTargets != null && + if (s.transformTargets != null && s.transformTargets[0] != null) { s.transformTargets[0].addNode(g, Targets.GRP_TARGETS); } @@ -2460,9 +2460,9 @@ class GroupRetained extends NodeRetained implements BHLeafInterface { void computeCombineBounds(Bounds bounds) { if (!VirtualUniverse.mc.cacheAutoComputedBounds) { - if (boundsAutoCompute) { + if (boundsAutoCompute) { for (int i=children.size()-1; i>=0; i--) { - NodeRetained child = (NodeRetained)children.get(i); + NodeRetained child = (NodeRetained)children.get(i); if(child != null) child.computeCombineBounds(bounds); } @@ -2501,16 +2501,16 @@ class GroupRetained extends NodeRetained implements BHLeafInterface { } } } - + } - - + + /** * Gets the bounding object of a node. * @return the node's bounding object */ Bounds getBounds() { - + if ( boundsAutoCompute) { // Issue 514 : NPE in Wonderland : triggered in cached bounds computation if (validCachedBounds) { @@ -2534,7 +2534,7 @@ class GroupRetained extends NodeRetained implements BHLeafInterface { return (Bounds) boundingObject; } return super.getBounds(); - } + } /** * Gets the bounding object of a node. @@ -2543,10 +2543,10 @@ class GroupRetained extends NodeRetained implements BHLeafInterface { Bounds getEffectiveBounds() { if ( boundsAutoCompute) { return getBounds(); - } + } return super.getEffectiveBounds(); } - + // returns true if children cannot be read/written and none of the // children can read their parent (i.e., "this") group node boolean isStaticChildren() { @@ -2577,7 +2577,7 @@ class GroupRetained extends NodeRetained implements BHLeafInterface { void setCompiled() { super.setCompiled(); for (int i=children.size()-1; i>=0; i--) { - SceneGraphObjectRetained node = + SceneGraphObjectRetained node = (SceneGraphObjectRetained) children.get(i); if (node != null) node.setCompiled(); @@ -2596,7 +2596,7 @@ class GroupRetained extends NodeRetained implements BHLeafInterface { System.err.print(" (s)"); } else if (source.getCapability(Group.ALLOW_CHILDREN_WRITE)) { System.err.print(" (w)"); - } + } } level++; @@ -2621,7 +2621,7 @@ class GroupRetained extends NodeRetained implements BHLeafInterface { mergeFlag = SceneGraphObjectRetained.DONT_MERGE; } - if (isRoot || this.usedInScoping() || + if (isRoot || this.usedInScoping() || (parent instanceof SwitchRetained)) { mergeFlag = SceneGraphObjectRetained.DONT_MERGE; } @@ -2645,12 +2645,12 @@ class GroupRetained extends NodeRetained implements BHLeafInterface { GroupRetained saveParentGroup = null; SceneGraphObjectRetained node; - if (mergeFlag != SceneGraphObjectRetained.MERGE_DONE) { + if (mergeFlag != SceneGraphObjectRetained.MERGE_DONE) { if (mergeFlag == SceneGraphObjectRetained.DONT_MERGE) { // don't merge/eliminate this node super.merge(compState); - + saveParentGroup = compState.parentGroup; compState.parentGroup = this; } @@ -2682,7 +2682,7 @@ class GroupRetained extends NodeRetained implements BHLeafInterface { if (compState.parentGroup != null) { compState.parentGroup.compiledChildrenList.add(this); parent = compState.parentGroup; - } + } } } @@ -2701,15 +2701,15 @@ class GroupRetained extends NodeRetained implements BHLeafInterface { int groupScopedMcSize = 0; int groupScopedAltAppSize = 0; int size; - + isInClearLive = true; - // Save this for later use in this method. Temporary. to be removed when OG cleanup. + // Save this for later use in this method. Temporary. to be removed when OG cleanup. HashKey[] savedLocalToVworldKeys = localToVworldKeys; super.clearLive(s); - + nchildren = this.children.size(); if (!(this instanceof ViewSpecificGroupRetained)) { @@ -2736,14 +2736,14 @@ class GroupRetained extends NodeRetained implements BHLeafInterface { if (allocatedAltApps) { s.altAppearances = altAppearances; } - - + + for (i=nchildren-1; i >=0 ; i--) { child = (NodeRetained)children.get(i); - if (this instanceof OrderedGroupRetained) { + if (this instanceof OrderedGroupRetained) { OrderedGroupRetained og = (OrderedGroupRetained)this; - // adjust refCount, which has been decremented + // adjust refCount, which has been decremented //in super.clearLive if ((refCount+1) == s.refCount) { //only need to do it once if in shared group. Add @@ -2754,7 +2754,7 @@ class GroupRetained extends NodeRetained implements BHLeafInterface { s.orderedPaths = (ArrayList)og.childrenOrderedPaths.get(i); } - if (child != null) { + if (child != null) { child.clearLive(s); } } @@ -2764,7 +2764,7 @@ class GroupRetained extends NodeRetained implements BHLeafInterface { if (savedParentLights != null) { if (allocatedLights) { if (inSharedGroup) { - + for (i=0; i < s.keys.length; i++) { hkIndex = s.keys[i].equals(localToVworldKeys, 0, localToVworldKeys.length); @@ -2776,7 +2776,7 @@ class GroupRetained extends NodeRetained implements BHLeafInterface { gl.remove(l.get(k)); } } - + } } else { @@ -2804,7 +2804,7 @@ class GroupRetained extends NodeRetained implements BHLeafInterface { gl.remove(l.get(k)); } } - + } } else { @@ -2831,7 +2831,7 @@ class GroupRetained extends NodeRetained implements BHLeafInterface { gl.remove(l.get(k)); } } - + } } else { @@ -2858,7 +2858,7 @@ class GroupRetained extends NodeRetained implements BHLeafInterface { gl.remove(l.get(k)); } } - + } } else { @@ -2869,7 +2869,7 @@ class GroupRetained extends NodeRetained implements BHLeafInterface { } } } - } + } if (collisionTarget) { GroupRetained g; @@ -2886,7 +2886,7 @@ class GroupRetained extends NodeRetained implements BHLeafInterface { } break; } - + } } } else { @@ -2895,7 +2895,7 @@ class GroupRetained extends NodeRetained implements BHLeafInterface { s.transformTargets[0] != null) { s.transformTargets[0].addNode(g, Targets.GRP_TARGETS); } - s.nodeList.add(mirrorGroup.remove(0)); + s.nodeList.add(mirrorGroup.remove(0)); } } s.lights = savedParentLights; @@ -2939,7 +2939,7 @@ class GroupRetained extends NodeRetained implements BHLeafInterface { synchronized (node.universe.sceneGraphLock) { do { if ((node instanceof SwitchRetained) && - (prevNode != null) && + (prevNode != null) && !validSwitchChild((SwitchRetained) node, prevNode)) { return false; } @@ -2958,7 +2958,7 @@ class GroupRetained extends NodeRetained implements BHLeafInterface { } if (node == prevNode) { // Fail to found a matching link, this is - // probably cause by BHTree not yet updated + // probably cause by BHTree not yet updated // because message not yet arrive // when collision so it return current node as target. return false; @@ -2973,8 +2973,8 @@ class GroupRetained extends NodeRetained implements BHLeafInterface { } - - /** + + /** * Determinte if nodeR is a valid child to render for * Switch Node swR. */ @@ -2982,7 +2982,7 @@ class GroupRetained extends NodeRetained implements BHLeafInterface { NodeRetained node) { int whichChild = sw.whichChild; - + if (whichChild == Switch.CHILD_NONE) { return false; } @@ -2992,7 +2992,7 @@ class GroupRetained extends NodeRetained implements BHLeafInterface { } ArrayList children = sw.children; - + if (whichChild >= 0) { // most common case return (children.get(whichChild) == node); } @@ -3012,11 +3012,11 @@ class GroupRetained extends NodeRetained implements BHLeafInterface { * Create mirror group when this Group AlternateCollisionTarget * is set to true while live. */ - void createMirrorGroup() { + void createMirrorGroup() { GroupRetained g; mirrorGroup = new ArrayList(); - + Bounds bound = (collisionBound != null ? collisionBound : getEffectiveBounds()); @@ -3045,7 +3045,7 @@ class GroupRetained extends NodeRetained implements BHLeafInterface { g.sourceNode = this; g.locale = locale; // need by getVisibleGeometryAtom() mirrorGroup.add(g); - } + } } void setBoundsAutoCompute(boolean autoCompute) { @@ -3054,7 +3054,7 @@ class GroupRetained extends NodeRetained implements BHLeafInterface { if (!autoCompute) { localBounds = getEffectiveBounds(); } - if (source.isLive() && collisionBound == null && autoCompute + if (source.isLive() && collisionBound == null && autoCompute && mirrorGroup != null) { J3dMessage message = new J3dMessage(); @@ -3130,16 +3130,16 @@ class GroupRetained extends NodeRetained implements BHLeafInterface { s.switchLevels[0]++; if (s.closestSwitchParents[0] == null) { s.closestSwitchParents[0] = (SwitchRetained)parent; - s.closestSwitchIndices[0] = + s.closestSwitchIndices[0] = ((SwitchRetained)parent).switchIndexCount++; } if (parentSwitchLinkChildIndex == -1) { - parentSwitchLinkChildIndex = + parentSwitchLinkChildIndex = ((GroupRetained)parent).children.indexOf(child); } } else if (parent instanceof SharedGroupRetained) { if (parentSwitchLinkChildIndex == -1) { - parentSwitchLinkChildIndex = + parentSwitchLinkChildIndex = ((GroupRetained)parent).children.indexOf(child); } } @@ -3171,12 +3171,12 @@ class GroupRetained extends NodeRetained implements BHLeafInterface { s.switchLevels[i]++; if (s.closestSwitchParents[i] == null) { s.closestSwitchParents[i] = (SwitchRetained)parent; - s.closestSwitchIndices[i] = + s.closestSwitchIndices[i] = ((SwitchRetained)parent).switchIndexCount++; } if (parentSwitchLinkChildIndex == -1) { - parentSwitchLinkChildIndex = + parentSwitchLinkChildIndex = ((GroupRetained)parent).children.indexOf(child); } } else if (parent instanceof SharedGroupRetained) { @@ -3185,7 +3185,7 @@ class GroupRetained extends NodeRetained implements BHLeafInterface { NodeRetained ln; if (parentSwitchLinkChildIndex == -1) { - parentSwitchLinkChildIndex = + parentSwitchLinkChildIndex = ((GroupRetained)parent).children.indexOf(child); } @@ -3196,7 +3196,7 @@ class GroupRetained extends NodeRetained implements BHLeafInterface { break; } } - } + } child = parent; parent = child.parent; } diff --git a/src/classes/share/javax/media/j3d/HashKey.java b/src/classes/share/javax/media/j3d/HashKey.java index 4a632d9..1e0d556 100644 --- a/src/classes/share/javax/media/j3d/HashKey.java +++ b/src/classes/share/javax/media/j3d/HashKey.java @@ -145,11 +145,11 @@ class HashKey extends Object { return false; } - + /* For internal use only. */ private int equals(HashKey hk) { int index = 0; - + while((index < count) && (index < hk.count)) { if(value[index] < hk.value[index]) return -1; @@ -157,7 +157,7 @@ class HashKey extends Object { return 1; index++; } - + if(count == hk.count) // Found it! return 0; @@ -165,10 +165,10 @@ class HashKey extends Object { return -1; else return 1; - + } - + /* For package use only. */ int equals(HashKey localToVworldKeys[], int start, int end) { int mid; @@ -182,7 +182,7 @@ class HashKey extends Object { else if((test > 0) && (start != mid)) return equals(localToVworldKeys, mid, end); else if(test == 0) - return mid; + return mid; else return -1; } @@ -195,11 +195,11 @@ class HashKey extends Object { int start, int end) { int mid; - + mid = start +((end - start)/ 2); if(localToVworldKeys[mid] != null) { int test = equals(localToVworldKeys[mid]); - + if(start != mid) { if(test < 0) { return equals(localToVworldKeys, index, start, mid); @@ -213,34 +213,34 @@ class HashKey extends Object { index[0] = mid; return false; } - else if(test > 0) { + else if(test > 0) { index[0] = mid+1; return false; } } - - // (test == 0) + + // (test == 0) index[0] = mid; return true; - + } // A null haskey encountered. // But we still want to return the index where we encounter it. index[0] = mid; return false; } - + public String toString() { return new String(value, 0, count); } - + String getLastNodeId() { int i, j, temp; - - for(i=(count-1); i>0; i--) + + for(i=(count-1); i>0; i--) if(value[i] == '+') break; - + if(i>0) { value[i++] = '\0'; temp = count-i; @@ -249,10 +249,10 @@ class HashKey extends Object { v1[j] = value[i]; value[i] = '\0'; } - count = count - (temp+1); + count = count - (temp+1); return new String(v1); } - + return new String(value, 0, count); } diff --git a/src/classes/share/javax/media/j3d/HiResCoord.java b/src/classes/share/javax/media/j3d/HiResCoord.java index f7a32a7..f9104c6 100644 --- a/src/classes/share/javax/media/j3d/HiResCoord.java +++ b/src/classes/share/javax/media/j3d/HiResCoord.java @@ -39,7 +39,7 @@ import javax.vecmath.*; * */ -/** +/** * The HiResCoord object specifies the location of scene * components within the Virtual Universe. * The coordinates of all scene graph objects are relative to @@ -81,10 +81,10 @@ public class HiResCoord { */ int z[]; -private double scales[] = { - 79228162514264337593543950336.0, // 2^96 - 18446744073709551616.0, // 2^64 - 4294967296.0, // 2^32 +private double scales[] = { + 79228162514264337593543950336.0, // 2^96 + 18446744073709551616.0, // 2^64 + 4294967296.0, // 2^32 1.0, // 2^0 2.3283064365386962890625e-10, // 2^-32 5.421010862427522170037264004349708557128906250000000000000000e-20, // 2^-64 @@ -93,7 +93,7 @@ private double scales[] = { - /** + /** * Constructs and initializes a new HiResCoord using the values * provided in the argument. * The HiResCoord represents 768 bits of floating point 3-Space. @@ -116,7 +116,7 @@ private double scales[] = { } - /** + /** * Constructs and initializes a new HiResCoord using the values * provided in the argument. * The HiResCoord represents 768 bits of floating point 3-Space. @@ -160,7 +160,7 @@ private double scales[] = { this.z[7] = hc.z[7]; } - /** + /** * Constructs and initializes a new HiResCoord located at (0, 0, 0). * The HiResCoord represents 768 bits of floating point 3-Space. */ @@ -272,7 +272,7 @@ private double scales[] = { this.z[6] = Z[6]; this.z[7] = Z[7]; } - + /** * Retrieves this HiResCoord's location and saves the coordinates * in the specified arrays. The arrays must be large enough @@ -309,7 +309,7 @@ private double scales[] = { Z[6] = this.z[6]; Z[7] = this.z[7]; } - + /** * Retrieves this HiResCoord's location and places it into the hires * argument. @@ -343,10 +343,10 @@ private double scales[] = { hc.z[6] = this.z[6]; hc.z[7] = this.z[7]; } - + /** * Retrieves this HiResCoord's X value and stores it in the specified - * array. The array must be large enough to hold all of the ints. + * array. The array must be large enough to hold all of the ints. * @param X an eight-element array that will receive the x position */ public void getHiResCoordX(int[] X) { @@ -362,7 +362,7 @@ private double scales[] = { /** * Retrieves this HiResCoord's Y value and stores it in the specified - * array. The array must be large enough to hold all of the ints. + * array. The array must be large enough to hold all of the ints. * @param Y an eight-element array that will receive the y position */ public void getHiResCoordY(int[] Y) { @@ -378,7 +378,7 @@ private double scales[] = { /** * Retrieves this HiResCoord's Z value and stores it in the specified - * array. The array must be large enough to hold all of the ints. + * array. The array must be large enough to hold all of the ints. * @param Z an eight-element array that will receive the z position */ public void getHiResCoordZ(int[] Z) { @@ -493,7 +493,7 @@ private double scales[] = { // hiResNegate( tmpHc, h2); hiResAdd( this, h1, tmpHc); - + } /** @@ -594,7 +594,7 @@ private double scales[] = { return; } - private void hiResAdd(HiResCoord ho, HiResCoord h1, HiResCoord h2 ){ + private void hiResAdd(HiResCoord ho, HiResCoord h1, HiResCoord h2 ){ int i; long tmp1, tmp2,carry; long signMask = Integer.MAX_VALUE; @@ -656,7 +656,7 @@ private double scales[] = { return; } - private void hiResScale( int tin[], int tout[], double scale) { + private void hiResScale( int tin[], int tout[], double scale) { int i; long tmp,carry; int signMask = Integer.MAX_VALUE; @@ -665,7 +665,7 @@ private double scales[] = { carryMask += 1; long signBit = 1; signBit = signBit << 31; - + carry = 0; for(i=7;i>0;i--) { tmp = 0; @@ -678,7 +678,7 @@ private double scales[] = { tout[0] = (int)(tin[0]*scale + carry); return; } - private void hiResDiff( HiResCoord h1, HiResCoord h2, Vector3d diff) { + private void hiResDiff( HiResCoord h1, HiResCoord h2, Vector3d diff) { int i; HiResCoord diffHi = new HiResCoord(); long value; diff --git a/src/classes/share/javax/media/j3d/ImageComponent.java b/src/classes/share/javax/media/j3d/ImageComponent.java index 7312296..bb5096b 100644 --- a/src/classes/share/javax/media/j3d/ImageComponent.java +++ b/src/classes/share/javax/media/j3d/ImageComponent.java @@ -255,13 +255,13 @@ public abstract class ImageComponent extends NodeComponent { ALLOW_IMAGE_READ, ALLOW_FORMAT_READ }; - + /** * Not a public constructor, for internal use */ ImageComponent() { // set default read capabilities - setDefaultReadCapabilities(readCapabilities); + setDefaultReadCapabilities(readCapabilities); } /** @@ -281,7 +281,7 @@ public abstract class ImageComponent extends NodeComponent { * object * @exception IllegalArgumentException if format is invalid, or if * width or height are not positive. - */ + */ public ImageComponent(int format, int width, int height) { // set default read capabilities setDefaultReadCapabilities(readCapabilities); @@ -328,7 +328,7 @@ public abstract class ImageComponent extends NodeComponent { * @return the width of this image component object * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph - */ + */ public int getWidth() { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_SIZE_READ)) @@ -341,7 +341,7 @@ public abstract class ImageComponent extends NodeComponent { * @return the height of this image component object * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph - */ + */ public int getHeight() { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_SIZE_READ)) @@ -354,7 +354,7 @@ public abstract class ImageComponent extends NodeComponent { * @return the format of this image component object * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph - */ + */ public int getFormat() { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_FORMAT_READ)) @@ -399,7 +399,7 @@ public abstract class ImageComponent extends NodeComponent { */ public void setYUp(boolean yUp) { checkForLiveOrCompiled(); - + // check for illegal image class if (((ImageComponentRetained)this.retained).getImageClass() == ImageClass.NIO_IMAGE_BUFFER) { throw new IllegalStateException("ImageComponent4"); diff --git a/src/classes/share/javax/media/j3d/ImageComponent2D.java b/src/classes/share/javax/media/j3d/ImageComponent2D.java index a4c7404..98b2c5c 100644 --- a/src/classes/share/javax/media/j3d/ImageComponent2D.java +++ b/src/classes/share/javax/media/j3d/ImageComponent2D.java @@ -71,7 +71,7 @@ public class ImageComponent2D extends ImageComponent { // non-public, no parameter constructor ImageComponent2D() {} - + /** * Constructs a 2D image component object using the specified * format, width, and height. Default values are used for @@ -95,7 +95,7 @@ public class ImageComponent2D extends ImageComponent { int height) { if (MasterControl.isDevLoggable(Level.FINER)) { - MasterControl.getDevLogger().finer("ImageComponent - using default of byCopy"); + MasterControl.getDevLogger().finer("ImageComponent - using default of byCopy"); } ((ImageComponent2DRetained)this.retained).processParams(format, width, height, 1); } @@ -115,7 +115,7 @@ public class ImageComponent2D extends ImageComponent { public ImageComponent2D(int format, BufferedImage image) { if (MasterControl.isDevLoggable(Level.FINER)) { - MasterControl.getDevLogger().finer("ImageComponent - using default of byCopy"); + MasterControl.getDevLogger().finer("ImageComponent - using default of byCopy"); } ((ImageComponent2DRetained)this.retained).processParams(format, image.getWidth(), image.getHeight(), 1); ((ImageComponent2DRetained)this.retained).set(image); @@ -139,7 +139,7 @@ public class ImageComponent2D extends ImageComponent { if (MasterControl.isDevLoggable(Level.FINER)) { - MasterControl.getDevLogger().finer("ImageComponent - using default of byCopy"); + MasterControl.getDevLogger().finer("ImageComponent - using default of byCopy"); } ((ImageComponent2DRetained)this.retained).processParams(format, image.getWidth(), image.getHeight(), 1); ((ImageComponent2DRetained)this.retained).set(image); @@ -180,7 +180,7 @@ public class ImageComponent2D extends ImageComponent { "otherwise an extra copy of the image will be created"); } } - + ((ImageComponentRetained)this.retained).setByReference(byReference); ((ImageComponentRetained)this.retained).setYUp(yUp); ((ImageComponent2DRetained)this.retained).processParams(format, width, height, 1); @@ -217,7 +217,7 @@ public class ImageComponent2D extends ImageComponent { "otherwise an extra copy of the image will be created"); } } - + ((ImageComponentRetained)this.retained).setByReference(byReference); ((ImageComponentRetained)this.retained).setYUp(yUp); ((ImageComponent2DRetained)this.retained).processParams(format, image.getWidth(), image.getHeight(), 1); @@ -285,7 +285,7 @@ public class ImageComponent2D extends ImageComponent { * * @exception IllegalArgumentException if the yUp flag is false. * - * @exception IllegalArgumentException if the number of components in format + * @exception IllegalArgumentException if the number of components in format * does not match the number of components in image. * * @since Java 3D 1.5 @@ -393,7 +393,7 @@ public class ImageComponent2D extends ImageComponent { * specified image is not equal to the width and height of this * ImageComponent object. * - * @exception IllegalArgumentException if the number of components in format + * @exception IllegalArgumentException if the number of components in format * does not match the number of components in image. * * @since Java 3D 1.5 @@ -435,7 +435,7 @@ public class ImageComponent2D extends ImageComponent { if ((img != null) && !(img instanceof BufferedImage)) { throw new IllegalStateException(J3dI18N.getString("ImageComponent2D5")); - } + } return (BufferedImage) img; } @@ -499,7 +499,7 @@ public class ImageComponent2D extends ImageComponent { /** * Modifies a contiguous subregion of the image component. * Block of data of dimension (width * height) - * starting at the offset (srcX, srcY) of the specified + * starting at the offset (srcX, srcY) of the specified * RenderedImage object will be copied into the image component * starting at the offset (dstX, dstY) of the ImageComponent2D object. * The specified RenderedImage object must be of the same format as @@ -510,13 +510,13 @@ public class ImageComponent2D extends ImageComponent { * @param image RenderedImage object containing the subimage. * @param width width of the subregion. * @param height height of the subregion. - * @param srcX starting X offset of the subregion in the + * @param srcX starting X offset of the subregion in the * specified image. - * @param srcY starting Y offset of the subregion in the + * @param srcY starting Y offset of the subregion in the * specified image. - * @param dstX starting X offset of the subregion in the image + * @param dstX starting X offset of the subregion in the image * component of this object. - * @param dstY starting Y offset of the subregion in the image + * @param dstY starting Y offset of the subregion in the image * component of this object. * * @exception CapabilityNotSetException if appropriate capability is @@ -525,24 +525,24 @@ public class ImageComponent2D extends ImageComponent { * @exception IllegalStateException if the data access mode is * <code>BY_REFERENCE</code>. * - * @exception IllegalArgumentException if <code>width</code> or + * @exception IllegalArgumentException if <code>width</code> or * <code>height</code> of * the subregion exceeds the dimension of the image of this object. * * @exception IllegalArgumentException if <code>dstX</code> < 0, or - * (<code>dstX</code> + <code>width</code>) > width of this object, or + * (<code>dstX</code> + <code>width</code>) > width of this object, or * <code>dstY</code> < 0, or * (<code>dstY</code> + <code>height</code>) > height of this object. * * @exception IllegalArgumentException if <code>srcX</code> < 0, or * (<code>srcX</code> + <code>width</code>) > width of the RenderedImage - * object containing the subimage, or + * object containing the subimage, or * <code>srcY</code> < 0, or - * (<code>srcY</code> + <code>height</code>) > height of the + * (<code>srcY</code> + <code>height</code>) > height of the * RenderedImage object containing the subimage. * * @exception IllegalArgumentException if the specified RenderedImage - * is not compatible with the existing RenderedImage. + * is not compatible with the existing RenderedImage. * * @exception IllegalStateException if the image class is not one of: * ImageClass.BUFFERED_IMAGE or ImageClass.RENDERED_IMAGE. @@ -572,8 +572,8 @@ public class ImageComponent2D extends ImageComponent { ((dstX + width) > w) || ((dstY + height) > h)) { throw new IllegalArgumentException( J3dI18N.getString("ImageComponent2D3")); - } - + } + ((ImageComponent2DRetained)this.retained).setSubImage( image, width, height, srcX, srcY, dstX, dstY); } @@ -615,7 +615,7 @@ public class ImageComponent2D extends ImageComponent { * * @since Java 3D 1.3 */ - public void updateData(Updater updater, + public void updateData(Updater updater, int x, int y, int width, int height) { @@ -666,13 +666,13 @@ public class ImageComponent2D extends ImageComponent { return img; } - + /** - * Copies all node information from <code>originalNodeComponent</code> + * Copies all node information from <code>originalNodeComponent</code> * into the current node. This method is called from the * <code>duplicateNode</code> method. This routine does * the actual duplication of all "local data" (any data defined in - * this object). + * this object). * * @param originalNodeComponent the original node to duplicate * @param forceDuplicate when set to <code>true</code>, causes the diff --git a/src/classes/share/javax/media/j3d/ImageComponent2DRetained.java b/src/classes/share/javax/media/j3d/ImageComponent2DRetained.java index 0591dbd..2e145e7 100644 --- a/src/classes/share/javax/media/j3d/ImageComponent2DRetained.java +++ b/src/classes/share/javax/media/j3d/ImageComponent2DRetained.java @@ -44,7 +44,7 @@ class ImageComponent2DRetained extends ImageComponentRetained { ImageComponent2DRetained() { } - + /** * This method handles NioImageBuffer * Refers or copies the specified NioImageBuffer to this 2D image component object. @@ -58,19 +58,19 @@ class ImageComponent2DRetained extends ImageComponentRetained { int height = image.getHeight(); if (!byReference) { - throw new IllegalArgumentException(J3dI18N.getString("ImageComponent2D7")); + throw new IllegalArgumentException(J3dI18N.getString("ImageComponent2D7")); } if (!yUp) { - throw new IllegalArgumentException(J3dI18N.getString("ImageComponent2D8")); + throw new IllegalArgumentException(J3dI18N.getString("ImageComponent2D8")); } - + if (width != this.width) { throw new IllegalArgumentException(J3dI18N.getString("ImageComponent2DRetained0")); } if (height != this.height) { throw new IllegalArgumentException(J3dI18N.getString("ImageComponent2DRetained1")); } - + geomLock.getLock(); setImageClass(image); @@ -85,27 +85,27 @@ class ImageComponent2DRetained extends ImageComponentRetained { imageTypeIsSupported = isImageTypeSupported(image); if (imageTypeIsSupported) { - + /* Use reference when ( format is OK, Yup is true, and byRef is true). */ // Create image data object with the byRef image. */ imageData = createNioImageBufferDataObject(image); - + } else { // Handle abgrSupported is false case. imageData = createNioImageBufferDataObject(null); copyUnsupportedNioImageToImageData(image, 0, 0, 0, 0, width, height, imageData); } - + geomLock.unLock(); - + if (source.isLive()) { // send a IMAGE_CHANGED message in order to // notify all the users of the change sendMessage(IMAGE_CHANGED, null); } } - + /** * This method handles both BufferedImage and RenderedImage * Copies the specified RenderedImage to this 2D image component object. @@ -114,46 +114,46 @@ class ImageComponent2DRetained extends ImageComponentRetained { * ImageComponent2D object. */ void set(RenderedImage image) { - + int width = image.getWidth(); int height = image.getHeight(); - + if (width != this.width) { throw new IllegalArgumentException(J3dI18N.getString("ImageComponent2DRetained0")); } if (height != this.height) { throw new IllegalArgumentException(J3dI18N.getString("ImageComponent2DRetained1")); } - + setImageClass(image); - - geomLock.getLock(); - - if (byReference) { - setRefImage(image,0); + + geomLock.getLock(); + + if (byReference) { + setRefImage(image,0); } - - // Reset this flag to true, incase it was set to false due to + + // Reset this flag to true, incase it was set to false due to // the previous image type. abgrSupported = true; - + imageTypeIsSupported = isImageTypeSupported(image); - + if (imageTypeIsSupported) { if (byReference && yUp) { /* Use reference when ( format is OK, Yup is true, and byRef is true). */ // System.err.println("ImageComponent2DRetained.set() : (imageTypeSupported && byReference && yUp) --- (1)"); if (image instanceof BufferedImage) { - // Create image data object with the byRef image. */ - imageData = createRenderedImageDataObject(image); + // Create image data object with the byRef image. */ + imageData = createRenderedImageDataObject(image); } else { // System.err.println("byRef and not BufferedImage !!!"); imageData = null; } - } else { + } else { // Either not byRef or not yUp or not both // System.err.println("ImageComponent2DRetained.set() : (imageTypeSupported && ((!byReference && yUp) || (imageTypeSupported && !yUp)) --- (2)"); @@ -172,10 +172,10 @@ class ImageComponent2DRetained extends ImageComponentRetained { imageData = createRenderedImageDataObject(null); copyUnsupportedImageToImageData(image, 0, imageData); - } - + } + geomLock.unLock(); - + if (source.isLive()) { // send a IMAGE_CHANGED message in order to // notify all the users of the change @@ -183,12 +183,12 @@ class ImageComponent2DRetained extends ImageComponentRetained { } } - void setSubImage(RenderedImage image, int width, int height, + void setSubImage(RenderedImage image, int width, int height, int srcX, int srcY, int dstX, int dstY) { if (!isSubImageTypeEqual(image)) { throw new IllegalStateException( - J3dI18N.getString("ImageComponent2D6")); + J3dI18N.getString("ImageComponent2D6")); } // Can't be byReference @@ -197,7 +197,7 @@ class ImageComponent2DRetained extends ImageComponentRetained { geomLock.getLock(); - if (imageTypeIsSupported) { + if (imageTypeIsSupported) { // Either not byRef or not yUp or not both // System.err.println("ImageComponent2DRetained.setSubImage() : (imageTypeSupported ) --- (1)"); if (image instanceof BufferedImage) { @@ -211,12 +211,12 @@ class ImageComponent2DRetained extends ImageComponentRetained { // TODO : Should look into borrow code from JAI to convert to right format. // System.err.println("ImageComponent2DRetained.setSubImage() : (imageTypeSupported == false) --- (2)"); if (image instanceof BufferedImage) { - copyUnsupportedImageToImageData((BufferedImage)image, srcX, srcY, dstX, dstY, 0, width, height, imageData); + copyUnsupportedImageToImageData((BufferedImage)image, srcX, srcY, dstX, dstY, 0, width, height, imageData); } else { copyUnsupportedImageToImageData(image, srcX, srcY, dstX, dstY, 0, width, height, imageData); } - } + } geomLock.unLock(); if (source.isLive()) { @@ -235,23 +235,23 @@ class ImageComponent2DRetained extends ImageComponentRetained { sendMessage(SUBIMAGE_CHANGED, info); } - } - + } + /** * Retrieves a copy of the image in this ImageComponent2D object. * @return a new RenderedImage object created from the image in this * ImageComponent2D object */ RenderedImage getImage() { - + if (isByReference()) { return (RenderedImage) getRefImage(0); } - + if(imageData != null) { return imageData.createBufferedImage(0); } - + return null; } @@ -261,11 +261,11 @@ class ImageComponent2DRetained extends ImageComponentRetained { NioImageBuffer getNioImage() { if (getImageClass() != ImageComponent.ImageClass.NIO_IMAGE_BUFFER) { - throw new IllegalStateException(J3dI18N.getString("ImageComponent2D9")); + throw new IllegalStateException(J3dI18N.getString("ImageComponent2D9")); } - + assert (byReference == true); - + return (NioImageBuffer) getRefImage(0); } @@ -284,11 +284,11 @@ class ImageComponent2DRetained extends ImageComponentRetained { Object refImage = getRefImage(0); assert (refImage != null); assert (imageData != null); - + // Check is data copied internally. if(!imageData.isDataByRef()) { // update the internal copy of the image data if a copy has been - // made + // made if (imageTypeIsSupported) { assert !(refImage instanceof NioImageBuffer); @@ -298,7 +298,7 @@ class ImageComponent2DRetained extends ImageComponentRetained { RenderedImage ri = (RenderedImage)refImage; copySupportedImageToImageData(ri, (x + ri.getMinX()), (y + ri.getMinY()), x, y, 0, width, height, imageData); } - } else { + } else { // image type is unsupported, need to create a supported local copy. // TODO : Should look into borrow code from JAI to convert to right format. if (refImage instanceof BufferedImage) { @@ -315,10 +315,10 @@ class ImageComponent2DRetained extends ImageComponentRetained { } geomLock.unLock(); - + if (source.isLive()) { - // send a SUBIMAGE_CHANGED message in order to + // send a SUBIMAGE_CHANGED message in order to // notify all the users of the change ImageComponentUpdateInfo info; diff --git a/src/classes/share/javax/media/j3d/ImageComponent3D.java b/src/classes/share/javax/media/j3d/ImageComponent3D.java index ae965db..af4221d 100644 --- a/src/classes/share/javax/media/j3d/ImageComponent3D.java +++ b/src/classes/share/javax/media/j3d/ImageComponent3D.java @@ -66,7 +66,7 @@ public class ImageComponent3D extends ImageComponent { // non-public, no parameter constructor ImageComponent3D() {} - + /** * Constructs a 3D image component object using the specified * format, width, height, and depth. Default values are used for @@ -110,7 +110,7 @@ public class ImageComponent3D extends ImageComponent { * the width or height of the first image are not positive. */ public ImageComponent3D(int format, BufferedImage[] images) { - ((ImageComponent3DRetained)this.retained).processParams(format, + ((ImageComponent3DRetained)this.retained).processParams(format, images[0].getWidth(null), images[0].getHeight(null), images.length); for (int i=0; i<images.length; i++) { ((ImageComponent3DRetained)this.retained).set(i, images[i]); @@ -136,7 +136,7 @@ public class ImageComponent3D extends ImageComponent { */ public ImageComponent3D(int format, RenderedImage[] images) { - ((ImageComponent3DRetained)this.retained).processParams(format, + ((ImageComponent3DRetained)this.retained).processParams(format, images[0].getWidth(), images[0].getHeight(), images.length); for (int i=0; i<images.length; i++) { ((ImageComponent3DRetained)this.retained).set(i, images[i]); @@ -209,7 +209,7 @@ public class ImageComponent3D extends ImageComponent { ((ImageComponentRetained)this.retained).setByReference(byReference); ((ImageComponentRetained)this.retained).setYUp(yUp); - ((ImageComponent3DRetained)this.retained).processParams(format, + ((ImageComponent3DRetained)this.retained).processParams(format, images[0].getWidth(null), images[0].getHeight(null), images.length); for (int i=0; i<images.length; i++) { ((ImageComponent3DRetained)this.retained).set(i, images[i]); @@ -247,7 +247,7 @@ public class ImageComponent3D extends ImageComponent { ((ImageComponentRetained)this.retained).setByReference(byReference); ((ImageComponentRetained)this.retained).setYUp(yUp); - ((ImageComponent3DRetained)this.retained).processParams(format, + ((ImageComponent3DRetained)this.retained).processParams(format, images[0].getWidth(), images[0].getHeight(), images.length); for (int i=0; i<images.length; i++) { ((ImageComponent3DRetained)this.retained).set(i, images[i]); @@ -288,12 +288,12 @@ public class ImageComponent3D extends ImageComponent { boolean byReference, boolean yUp) { - + throw new UnsupportedOperationException(); /* ((ImageComponentRetained)this.retained).setByReference(byReference); ((ImageComponentRetained)this.retained).setYUp(yUp); - ((ImageComponent3DRetained)this.retained).processParams(format, + ((ImageComponent3DRetained)this.retained).processParams(format, images[0].getWidth(), images[0].getHeight(), images.length); for (int i=0; i<images.length; i++) { ((ImageComponent3DRetained)this.retained).set(i, images[i]); @@ -431,7 +431,7 @@ public class ImageComponent3D extends ImageComponent { * @since Java 3D 1.5 */ public void set(NioImageBuffer[] images) { - + throw new UnsupportedOperationException(); /* checkForLiveOrCompiled(); @@ -543,11 +543,11 @@ public class ImageComponent3D extends ImageComponent { * @since Java 3D 1.5 */ public void set(int index, NioImageBuffer image) { - + throw new UnsupportedOperationException(); /* checkForLiveOrCompiled(); - // For NioImageBuffer the width and height checking is done in the retained. + // For NioImageBuffer the width and height checking is done in the retained. ((ImageComponent3DRetained)this.retained).set(index, image); */ } @@ -570,7 +570,7 @@ public class ImageComponent3D extends ImageComponent { * ImageClass.BUFFERED_IMAGE. */ public BufferedImage[] getImage() { - if (isLiveOrCompiled()) + if (isLiveOrCompiled()) if(!this.getCapability(ImageComponent.ALLOW_IMAGE_READ)) throw new CapabilityNotSetException(J3dI18N.getString("ImageComponent3D3")); return ((ImageComponent3DRetained)this.retained).getImage(); @@ -656,7 +656,7 @@ public class ImageComponent3D extends ImageComponent { RenderedImage img = ((ImageComponent3DRetained)this.retained).getImage(index); if ((img != null) && !(img instanceof BufferedImage)) { throw new IllegalStateException(J3dI18N.getString("ImageComponent3D9")); - } + } return (BufferedImage) img; } @@ -766,7 +766,7 @@ public class ImageComponent3D extends ImageComponent { * RenderedImage object containing the subimage. * * @exception IllegalArgumentException if the specified RenderedImage - * is not compatible with the existing RenderedImage. + * is not compatible with the existing RenderedImage. * * @exception IllegalStateException if the image class is not one of: * ImageClass.BUFFERED_IMAGE or ImageClass.RENDERED_IMAGE. @@ -879,7 +879,7 @@ public class ImageComponent3D extends ImageComponent { this.retained.setSource(this); } - + /** * @deprecated replaced with cloneNodeComponent(boolean forceDuplicate) @@ -905,13 +905,13 @@ public class ImageComponent3D extends ImageComponent { return img; } - + /** * Copies all node information from <code>originalNodeComponent</code> into * the current node. This method is called from the * <code>duplicateNode</code> method. This routine does * the actual duplication of all "local data" (any data defined in - * this object). + * this object). * * @param originalNodeComponent the original node to duplicate. * @param forceDuplicate when set to <code>true</code>, causes the @@ -923,8 +923,8 @@ public class ImageComponent3D extends ImageComponent { * @see Node#cloneTree * @see NodeComponent#setDuplicateOnCloneTree */ - void duplicateAttributes(NodeComponent originalNodeComponent, - boolean forceDuplicate) { + void duplicateAttributes(NodeComponent originalNodeComponent, + boolean forceDuplicate) { super.duplicateAttributes(originalNodeComponent, forceDuplicate); // TODO : Handle NioImageBuffer if its supported. RenderedImage imgs[] = ((ImageComponent3DRetained) diff --git a/src/classes/share/javax/media/j3d/ImageComponent3DRetained.java b/src/classes/share/javax/media/j3d/ImageComponent3DRetained.java index 55247f7..0a1a9ea 100644 --- a/src/classes/share/javax/media/j3d/ImageComponent3DRetained.java +++ b/src/classes/share/javax/media/j3d/ImageComponent3DRetained.java @@ -62,16 +62,16 @@ class ImageComponent3DRetained extends ImageComponentRetained { * ImageComponent3D object. */ void set(int index, BufferedImage image) { - - geomLock.getLock(); - + + geomLock.getLock(); + if(byReference) { // Fix to issue 488. - setRefImage(image, index); + setRefImage(image, index); } if(imageData == null) { - // Only do this once, on the first image + // Only do this once, on the first image // Reset this flag to true, incase it was set to false due to // the previous image type. abgrSupported = true; @@ -83,7 +83,7 @@ class ImageComponent3DRetained extends ImageComponentRetained { // TODO need to throw illegal state exception } } - + if (imageTypeIsSupported) { copySupportedImageToImageData(image, index, imageData); } else { @@ -91,17 +91,17 @@ class ImageComponent3DRetained extends ImageComponentRetained { // TODO : borrow code from JAI to convert to right format. copyUnsupportedImageToImageData(image, index, imageData); - } - + } + geomLock.unLock(); - + if (source.isLive()) { // send a IMAGE_CHANGED message in order to // notify all the users of the change sendMessage(IMAGE_CHANGED, null); - } + } } - + /** * Copies the specified BufferedImage to this 3D image component * object at the specified index. @@ -112,81 +112,81 @@ class ImageComponent3DRetained extends ImageComponentRetained { * ImageComponent3D object. * void set(int index, NioImageBuffer nioImage) { - + int width = nioImage.getWidth(); int height = nioImage.getHeight(); - + if (!byReference) { - throw new IllegalArgumentException(J3dI18N.getString("Need_New_Message_XXXXXImageComponent2D7")); + throw new IllegalArgumentException(J3dI18N.getString("Need_New_Message_XXXXXImageComponent2D7")); } if (!yUp) { - throw new IllegalArgumentException(J3dI18N.getString("Need_New_Message_XXXXXImageComponent2D8")); + throw new IllegalArgumentException(J3dI18N.getString("Need_New_Message_XXXXXImageComponent2D8")); } - + if (width != this.width) { throw new IllegalArgumentException(J3dI18N.getString("ImageComponent3D2")); } if (height != this.height) { throw new IllegalArgumentException(J3dI18N.getString("ImageComponent3D4")); } - + geomLock.getLock(); - + setImageClass(nioImage); - - // This is a byRef image. - setRefImage(nioImage,0); + + // This is a byRef image. + setRefImage(nioImage,0); if(imageData == null) { - // Only do this once, on the first image + // Only do this once, on the first image // Reset this flag to true, incase it was set to false due to // the previous image type. abgrSupported = true; - + imageTypeIsSupported = isImageTypeSupported(nioImage); - + // TODO : Need to handle null .... imageData = createNioImageBufferDataObject(null); } else { - + //if(getImageType() != evaluateImageType(image)) { // TODO need to throw illegal state exception //} - + } - + if (imageTypeIsSupported) { - // TODO : Need to handle this ..... case .... + // TODO : Need to handle this ..... case .... // copySupportedImageToImageData(image, index, imageData); } else { // System.err.println("Image format is unsupported -- illogical case"); throw new AssertionError(); - } - + } + geomLock.unLock(); - + if (source.isLive()) { // send a IMAGE_CHANGED message in order to // notify all the users of the change sendMessage(IMAGE_CHANGED, null); - } + } } */ - + void set(int index, RenderedImage image) { - + int width = image.getWidth(); int height = image.getHeight(); - + if (width != this.width) { throw new IllegalArgumentException(J3dI18N.getString("ImageComponent3D2")); } if (height != this.height) { throw new IllegalArgumentException(J3dI18N.getString("ImageComponent3D4")); } - + if (image instanceof BufferedImage) { set(index, ((BufferedImage)image)); } @@ -210,7 +210,7 @@ class ImageComponent3DRetained extends ImageComponentRetained { RenderedImage[] getRenderedImage() { int i; RenderedImage bi[] = new RenderedImage[depth]; - + if (!byReference) { for (i=0; i<depth; i++) { bi[i] = imageData.createBufferedImage(i); @@ -221,7 +221,7 @@ class ImageComponent3DRetained extends ImageComponentRetained { bi[i] = imageData.createBufferedImage(i); } } - + return bi; } @@ -239,7 +239,7 @@ class ImageComponent3DRetained extends ImageComponentRetained { for (i=0; i<depth; i++) { bi[i] = imageData.createBufferedImage(i); } - } + } else { for (i = 0; i < depth; i++) { bi[i] = imageData.createBufferedImage(i); @@ -262,7 +262,7 @@ class ImageComponent3DRetained extends ImageComponentRetained { if (!byReference) { return imageData.createBufferedImage(index); } - + return (RenderedImage) getRefImage(index); } @@ -283,12 +283,12 @@ class ImageComponent3DRetained extends ImageComponentRetained { assert (refImage != null); assert (imageData != null); - + // update the internal copy of the image data if a copy has been // made int srcX = x + refImage.getMinX(); int srcY = y + refImage.getMinY(); - + if (imageTypeIsSupported) { if (refImage instanceof BufferedImage) { copyImageLineByLine((BufferedImage)refImage, srcX, srcY, x, y, index, width, height, imageData); @@ -304,7 +304,7 @@ class ImageComponent3DRetained extends ImageComponentRetained { copyUnsupportedImageToImageData(refImage, srcX, srcY, x, y, index, width, height, imageData); } } - + geomLock.unLock(); @@ -331,16 +331,16 @@ class ImageComponent3DRetained extends ImageComponentRetained { if(!isSubImageTypeEqual(image)) { throw new IllegalStateException( - J3dI18N.getString("ImageComponent2D6")); + J3dI18N.getString("ImageComponent2D6")); } // Can't be byReference assert (!byReference); assert (imageData != null); - + geomLock.getLock(); - if (imageTypeIsSupported) { + if (imageTypeIsSupported) { // Either not byRef or not yUp or not both // System.err.println("ImageComponen3DRetained.setSubImage() : (imageTypeSupported ) --- (1)"); if (image instanceof BufferedImage) { @@ -354,12 +354,12 @@ class ImageComponent3DRetained extends ImageComponentRetained { // TODO : Should look into borrow code from JAI to convert to right format. // System.err.println("ImageComponent3DRetained.setSubImage() : (imageTypeSupported == false) --- (2)"); if (image instanceof BufferedImage) { - copyUnsupportedImageToImageData((BufferedImage)image, srcX, srcY, dstX, dstY, index, width, height, imageData); + copyUnsupportedImageToImageData((BufferedImage)image, srcX, srcY, dstX, dstY, index, width, height, imageData); } else { copyUnsupportedImageToImageData(image, srcX, srcY, dstX, dstY, index, width, height, imageData); } - } + } geomLock.unLock(); diff --git a/src/classes/share/javax/media/j3d/ImageComponentRetained.java b/src/classes/share/javax/media/j3d/ImageComponentRetained.java index 410e2f0..9698bbe 100644 --- a/src/classes/share/javax/media/j3d/ImageComponentRetained.java +++ b/src/classes/share/javax/media/j3d/ImageComponentRetained.java @@ -52,11 +52,11 @@ import java.util.logging.Level; */ abstract class ImageComponentRetained extends NodeComponentRetained { - + // change flag static final int IMAGE_CHANGED = 0x01; static final int SUBIMAGE_CHANGED = 0x02; - + static final int TYPE_BYTE_BGR = 0x1; static final int TYPE_BYTE_RGB = 0x2; static final int TYPE_BYTE_ABGR = 0x4; @@ -67,9 +67,9 @@ abstract class ImageComponentRetained extends NodeComponentRetained { static final int TYPE_INT_BGR = 0x80; static final int TYPE_INT_RGB = 0x100; static final int TYPE_INT_ARGB = 0x200; - + static final int IMAGE_SIZE_512X512 = 262144; - + enum ImageFormatType { TYPE_UNKNOWN, TYPE_BYTE_BGR, @@ -83,12 +83,12 @@ abstract class ImageComponentRetained extends NodeComponentRetained { TYPE_INT_RGB, TYPE_INT_ARGB } - + static final int IMAGE_DATA_TYPE_BYTE_ARRAY = 0x1000; static final int IMAGE_DATA_TYPE_INT_ARRAY = 0x2000; static final int IMAGE_DATA_TYPE_BYTE_BUFFER = 0x4000; static final int IMAGE_DATA_TYPE_INT_BUFFER = 0x8000; - + enum ImageDataType { TYPE_NULL, TYPE_BYTE_ARRAY, @@ -96,7 +96,7 @@ abstract class ImageComponentRetained extends NodeComponentRetained { TYPE_BYTE_BUFFER, TYPE_INT_BUFFER } - + private int apiFormat; // The format set by user. int width; // Width of PixelArray int height; // Height of PixelArray @@ -108,47 +108,47 @@ abstract class ImageComponentRetained extends NodeComponentRetained { boolean npotSupported = true; private int unitsPerPixel; private int numberOfComponents; - + // Note : This is unuse for NioImageBuffer. // The image type of the input image. Using the constant in BufferedImage private int imageType; - + private ImageFormatType imageFormatType = ImageFormatType.TYPE_UNKNOWN; ImageData imageData; private ImageComponent.ImageClass imageClass = ImageComponent.ImageClass.BUFFERED_IMAGE; - + // To support Non power of 2 (NPOT) image // if enforceNonPowerOfTwoSupport is true (for examples Raster and Background) // and imageData is a non power of 2 image // and graphics driver doesn't support NPOT extension. private ImageData imageDataPowerOfTwo; private AffineTransformOp powerOfTwoATOp; - // The following flag means that if the image is non-power-of-two and the - // card doesn't support NPOT texture, we will scale the image to a power + // The following flag means that if the image is non-power-of-two and the + // card doesn't support NPOT texture, we will scale the image to a power // of two. private boolean enforceNonPowerOfTwoSupport = false; private boolean usedByOffScreenCanvas = false; - + // This will store the referenced Images for reference case. // private RenderedImage refImage[] = null; private Object refImage[] = null; - + // Issue 366: Lock for evaluateExtensions Object evaluateExtLock = new Object(); - + // Lock used in the "by ref case" GeometryLock geomLock = new GeometryLock(); - + int tilew = 0; int tileh = 0; int numXTiles = 0; int numYTiles = 0; - + // lists of Node Components that are referencing this ImageComponent // object. This list is used to notify the referencing node components // of any changes of this ImageComponent. ArrayList userList = new ArrayList(); - + /** * Retrieves the width of this image component object. * @return the width of this image component object @@ -156,7 +156,7 @@ abstract class ImageComponentRetained extends NodeComponentRetained { int getWidth() { return width; } - + /** * Retrieves the height of this image component object. * @return the height of this image component object @@ -164,7 +164,7 @@ abstract class ImageComponentRetained extends NodeComponentRetained { int getHeight() { return height; } - + /** * Retrieves the apiFormat of this image component object. * @@ -173,39 +173,39 @@ abstract class ImageComponentRetained extends NodeComponentRetained { int getFormat() { return apiFormat; } - + void setFormat(int format) { this.apiFormat = format; } - + void setByReference(boolean byReference) { this.byReference = byReference; } - + boolean isByReference() { return byReference; } - + void setYUp( boolean yUp) { this.yUp = yUp; } - + boolean isYUp() { return yUp; } - + int getUnitsPerPixel() { return unitsPerPixel; } - + void setUnitsPerPixel(int ipp) { unitsPerPixel = ipp; } - + ImageComponent.ImageClass getImageClass() { return imageClass; } - + void setImageClass(RenderedImage image) { if(image instanceof BufferedImage) { imageClass = ImageComponent.ImageClass.BUFFERED_IMAGE; @@ -213,31 +213,31 @@ abstract class ImageComponentRetained extends NodeComponentRetained { imageClass = ImageComponent.ImageClass.RENDERED_IMAGE; } } - + void setImageClass(NioImageBuffer image) { imageClass = ImageComponent.ImageClass.NIO_IMAGE_BUFFER; } - + void setEnforceNonPowerOfTwoSupport(boolean npot) { this.enforceNonPowerOfTwoSupport = npot; } - + void setUsedByOffScreen(boolean used) { usedByOffScreenCanvas = used; } - + boolean getUsedByOffScreen() { return usedByOffScreenCanvas; } - + int getNumberOfComponents() { return numberOfComponents; } - + void setNumberOfComponents(int numberOfComponents) { this.numberOfComponents = numberOfComponents; } - + int getImageDataTypeIntValue() { int idtValue = -1; switch(imageData.imageDataType) { @@ -257,9 +257,9 @@ abstract class ImageComponentRetained extends NodeComponentRetained { assert false; } return idtValue; - + } - + int getImageFormatTypeIntValue(boolean powerOfTwoData) { int iftValue = -1; switch(imageFormatType) { @@ -303,28 +303,28 @@ abstract class ImageComponentRetained extends NodeComponentRetained { } return iftValue; } - + // Note: This method for RenderedImage, can't be used by NioImageBuffer. int getImageType() { return imageType; } - + void setImageFormatType(ImageFormatType ift) { this.imageFormatType = ift; } - + ImageFormatType getImageFormatType() { return this.imageFormatType; } - + void setRefImage(Object image, int index) { this.refImage[index] = image; } - + Object getRefImage(int index) { return this.refImage[index]; } - + ImageData getImageData(boolean npotSupportNeeded) { if(npotSupportNeeded) { assert enforceNonPowerOfTwoSupport; @@ -339,27 +339,27 @@ abstract class ImageComponentRetained extends NodeComponentRetained { if(imageDataPowerOfTwo != null) { return true; } - + return false; } - + boolean isImageTypeSupported() { return imageTypeIsSupported; } - + /** * Check if ImageComponent parameters have valid values. */ void processParams(int format, int width, int height, int depth) { if (width < 1) throw new IllegalArgumentException(J3dI18N.getString("ImageComponentRetained0")); - + if (height < 1) throw new IllegalArgumentException(J3dI18N.getString("ImageComponentRetained1")); - + if (depth < 1) throw new IllegalArgumentException(J3dI18N.getString("ImageComponentRetained2")); - + // If the format is 8bit per component, we may send it down // to OpenGL directly if its by ref case switch (format) { @@ -384,38 +384,38 @@ abstract class ImageComponentRetained extends NodeComponentRetained { default: throw new IllegalArgumentException(J3dI18N.getString("ImageComponentRetained3")); } - + this.setFormat(format); this.width = width; this.height = height; this.depth = depth; - refImage = new Object[depth]; + refImage = new Object[depth]; } - + int evaluateImageType(RenderedImage ri) { int imageType = BufferedImage.TYPE_CUSTOM; - + if (ri instanceof BufferedImage) { imageType = ((BufferedImage)ri).getType(); - + if(imageType != BufferedImage.TYPE_CUSTOM) { return imageType; } } else { - // Fix to Issue 412. Force copy for RenderedImage of type not equal to BufferedImage. + // Fix to Issue 412. Force copy for RenderedImage of type not equal to BufferedImage. return imageType; } - + // System.err.println("This is a RenderedImage or BufferedImage with TYPE_CUSTOM. It imageType classification may not be correct."); ColorModel cm = ri.getColorModel(); ColorSpace cs = cm.getColorSpace(); SampleModel sm = ri.getSampleModel(); - + int csType = cs.getType(); boolean isAlphaPre = cm.isAlphaPremultiplied(); - - + + if (csType == ColorSpace.TYPE_GRAY && cm instanceof ComponentColorModel) { if (sm.getDataType() == DataBuffer.TYPE_BYTE) { imageType = BufferedImage.TYPE_BYTE_GRAY; @@ -423,7 +423,7 @@ abstract class ImageComponentRetained extends NodeComponentRetained { imageType = BufferedImage.TYPE_USHORT_GRAY; } } - + // RGB , only interested in BYTE ABGR and BGR for now // all others will be copied to a buffered image else if(csType == ColorSpace.TYPE_RGB) { @@ -434,7 +434,7 @@ abstract class ImageComponentRetained extends NodeComponentRetained { } else if(smDataType == DataBuffer.TYPE_INT) { comparedBit = 32; } - + if(comparedBit != 0) { int numBands = sm.getNumBands(); if (cm instanceof ComponentColorModel && @@ -451,7 +451,7 @@ abstract class ImageComponentRetained extends NodeComponentRetained { break; } } - + // Handle TYPE_BYTE if( comparedBit == 8) { if (isNBit && @@ -493,10 +493,10 @@ abstract class ImageComponentRetained extends NodeComponentRetained { } } } - + return imageType; } - + // Assume ri's imageType is BufferedImage.TYPE_CUSTOM boolean is3ByteRGB(RenderedImage ri) { boolean value = false; @@ -534,7 +534,7 @@ abstract class ImageComponentRetained extends NodeComponentRetained { } return value; } - + // Assume ri's imageType is BufferedImage.TYPE_CUSTOM boolean is4ByteRGBA(RenderedImage ri) { boolean value = false; @@ -573,12 +573,12 @@ abstract class ImageComponentRetained extends NodeComponentRetained { } return value; } - + // Note: This method for RenderedImage, can't be used by NioImageBuffer. /* Check if sub-image type matches image type */ boolean isSubImageTypeEqual(RenderedImage ri) { int subImageType = evaluateImageType(ri); - + // This test is likely too loose, but the specification isn't clear either. // Assuming TYPE_CUSTOM of sub-image == the TYPE_CUSTOM of existing image. if(imageType == subImageType) { @@ -586,21 +586,21 @@ abstract class ImageComponentRetained extends NodeComponentRetained { } else { return false; } - + } - + // This method only support caller of offScreenBuffer and readRaster. void createBlankImageData() { - + assert (imageData == null); - + switch(numberOfComponents) { case 4: imageType = BufferedImage.TYPE_INT_ARGB; imageFormatType = ImageFormatType.TYPE_INT_ARGB; unitsPerPixel = 1; break; - + case 3: imageType = BufferedImage.TYPE_INT_RGB; imageFormatType = ImageFormatType.TYPE_INT_RGB; @@ -610,20 +610,20 @@ abstract class ImageComponentRetained extends NodeComponentRetained { // Only valid for 3 and 4 channel case. ( Read back from framebuffer ) assert false; } - + imageTypeIsSupported = true; imageData = createRenderedImageDataObject(null); - + } - + // This method will set imageType, imageFormatType, and unitsPerPixel // as it evaluates NioImageBuffer is supported. It will also reset // abgrSupported. boolean isImageTypeSupported(NioImageBuffer nioImgBuf) { - + boolean isSupported = true; NioImageBuffer.ImageType nioImageType = nioImgBuf.getImageType(); - + switch(numberOfComponents) { case 4: switch(nioImageType) { @@ -649,7 +649,7 @@ abstract class ImageComponentRetained extends NodeComponentRetained { break; default: throw new IllegalArgumentException(J3dI18N.getString("ImageComponent5")); - + } break; case 3: @@ -674,7 +674,7 @@ abstract class ImageComponentRetained extends NodeComponentRetained { throw new IllegalArgumentException(J3dI18N.getString("ImageComponent5")); } break; - + case 2: throw new IllegalArgumentException(J3dI18N.getString("ImageComponent5")); case 1: @@ -685,26 +685,26 @@ abstract class ImageComponentRetained extends NodeComponentRetained { throw new IllegalArgumentException(J3dI18N.getString("ImageComponent5")); } break; - + default: throw new AssertionError(); } - + return isSupported; } - + // This method will set imageType, imageFormatType, and unitsPerPixel // as it evaluates RenderedImage is supported. It will also reset // abgrSupported. boolean isImageTypeSupported(RenderedImage ri) { - + boolean isSupported = true; imageType = evaluateImageType(ri); - + switch(numberOfComponents) { case 4: if(imageType == BufferedImage.TYPE_4BYTE_ABGR) { - + // TODO : This approach will lead to a very slow path // for unsupported case. if(abgrSupported) { @@ -729,7 +729,7 @@ abstract class ImageComponentRetained extends NodeComponentRetained { unitsPerPixel = 4; } break; - + case 3: if(imageType == BufferedImage.TYPE_3BYTE_BGR) { imageFormatType = ImageFormatType.TYPE_BYTE_BGR; @@ -751,7 +751,7 @@ abstract class ImageComponentRetained extends NodeComponentRetained { unitsPerPixel = 3; } break; - + case 2: // System.err.println("Image format is unsupported --- Case 2"); // Convert unsupported format to TYPE_BYTE_LA. @@ -759,7 +759,7 @@ abstract class ImageComponentRetained extends NodeComponentRetained { isSupported = false; unitsPerPixel = 2; break; - + case 1: if(imageType == BufferedImage.TYPE_BYTE_GRAY) { imageFormatType = ImageFormatType.TYPE_BYTE_GRAY; @@ -772,20 +772,20 @@ abstract class ImageComponentRetained extends NodeComponentRetained { unitsPerPixel = 1; } break; - + default: throw new AssertionError(); } - + return isSupported; } - + /* * This method assume that the following members have been initialized : * width, height, depth, imageFormatType, and unitsPerPixel. */ ImageData createNioImageBufferDataObject(NioImageBuffer nioImageBuffer) { - + switch(imageFormatType) { case TYPE_BYTE_GRAY: case TYPE_BYTE_LA: @@ -813,7 +813,7 @@ abstract class ImageComponentRetained extends NodeComponentRetained { throw new AssertionError(); } } - + /* * This method assume that the following members have been initialized : * depth, imageType, imageFormatType, and unitsPerPixel. @@ -851,104 +851,104 @@ abstract class ImageComponentRetained extends NodeComponentRetained { throw new AssertionError(); } } - + private void updateImageDataPowerOfTwo(int depthIndex) { assert enforceNonPowerOfTwoSupport; BufferedImage bufImage = imageData.createBufferedImage(depthIndex); BufferedImage scaledImg = powerOfTwoATOp.filter(bufImage, null); copySupportedImageToImageData(scaledImg, 0, imageDataPowerOfTwo); } - + /* * This method assume that the following members have been initialized : * width, height, depth, imageType, imageFormatType, and bytesPerPixel. */ ImageData createRenderedImageDataObject(RenderedImage byRefImage) { - + return createRenderedImageDataObject(byRefImage, width, height); - + } - - + + /** * Copy specified region of image data from RenderedImage to * ImageComponent's imageData object */ void copySupportedImageToImageData(RenderedImage ri, int srcX, int srcY, int dstX, int dstY, int depthIndex, int copyWidth, int copyHeight, ImageData data) { - + assert (data != null); - + ColorModel cm = ri.getColorModel(); - + int xoff = ri.getTileGridXOffset(); // tile origin x offset int yoff = ri.getTileGridYOffset(); // tile origin y offset int minTileX = ri.getMinTileX(); // min tile x index int minTileY = ri.getMinTileY(); // min tile y index tilew = ri.getTileWidth(); // tile width in pixels tileh = ri.getTileHeight(); // tile height in pixels - + // determine the first tile of the image float mt; - + mt = (float)(srcX - xoff) / (float)tilew; if (mt < 0) { minTileX = (int)(mt - 1); } else { minTileX = (int)mt; } - + mt = (float)(srcY - yoff) / (float)tileh; if (mt < 0) { minTileY = (int)(mt - 1); } else { minTileY = (int)mt; } - + // determine the pixel offset of the upper-left corner of the // first tile int startXTile = minTileX * tilew + xoff; int startYTile = minTileY * tileh + yoff; - + // image dimension in the first tile int curw = (startXTile + tilew - srcX); int curh = (startYTile + tileh - srcY); - + // check if the to-be-copied region is less than the tile image // if so, update the to-be-copied dimension of this tile if (curw > copyWidth) { curw = copyWidth; } - + if (curh > copyHeight) { curh = copyHeight; } - + // save the to-be-copied width of the left most tile int startw = curw; - + // temporary variable for dimension of the to-be-copied region int tmpw = copyWidth; int tmph = copyHeight; - + // offset of the first pixel of the tile to be copied; offset is // relative to the upper left corner of the title int x = srcX - startXTile; int y = srcY - startYTile; - + // determine the number of tiles in each direction that the // image spans numXTiles = (copyWidth + x) / tilew; numYTiles = (copyHeight + y) / tileh; - + if (((float)(copyWidth + x ) % (float)tilew) > 0) { numXTiles += 1; } - + if (((float)(copyHeight + y ) % (float)tileh) > 0) { numYTiles += 1; } - + int offset; int w, h, i, j, m, n; int dstBegin; @@ -959,10 +959,10 @@ abstract class ImageComponentRetained extends NodeComponentRetained { int dstLineUnits; // sign * lineUnits int tileStart; // destination buffer offset // at the next left most tile - + byte[] dstByteBuffer = null; int[] dstIntBuffer = null; - + switch(data.getType()) { case TYPE_BYTE_ARRAY: dstByteBuffer = data.getAsByteArray(); @@ -973,10 +973,10 @@ abstract class ImageComponentRetained extends NodeComponentRetained { default: assert false; } - + int dataWidth = data.dataWidth; int dataHeight = data.dataHeight; - + lineUnits = dataWidth * unitsPerPixel; if (yUp) { // destination buffer offset @@ -989,42 +989,42 @@ abstract class ImageComponentRetained extends NodeComponentRetained { sign = -1; dstLineUnits = -lineUnits; } - + /* System.err.println("tileStart= " + tileStart + " dstLineUnits= " + dstLineUnits); System.err.println("startw= " + startw); */ - + // allocate memory for a pixel ras = ri.getTile(minTileX,minTileY); pixel = getDataElementBuffer(ras); - + int srcOffset, dstOffset; int tileLineUnits = tilew * unitsPerPixel; int copyUnits; - + for (n = minTileY; n < minTileY+numYTiles; n++) { - + dstBegin = tileStart; // destination buffer offset tmpw = copyWidth; // reset the width to be copied curw = startw; // reset the width to be copied of // the left most tile x = srcX - startXTile; // reset the starting x offset of // the left most tile - + for (m = minTileX; m < minTileX+numXTiles; m++) { - + // retrieve the raster for the next tile ras = ri.getTile(m,n); - + srcOffset = (y * tilew + x) * unitsPerPixel; dstOffset = dstBegin; - + copyUnits = curw * unitsPerPixel; - + //System.err.println("curh = "+curh+" curw = "+curw); //System.err.println("x = "+x+" y = "+y); - + switch(data.getType()) { case TYPE_BYTE_ARRAY: byte[] srcByteBuffer = ((DataBufferByte)ras.getDataBuffer()).getData(); @@ -1047,15 +1047,15 @@ abstract class ImageComponentRetained extends NodeComponentRetained { default: assert false; } - + // advance the destination buffer offset dstBegin += curw * unitsPerPixel; - + // move to the next tile in x direction x = 0; - + // determine the width of copy region of the next tile - + tmpw -= curw; if (tmpw < tilew) { curw = tmpw; @@ -1063,14 +1063,14 @@ abstract class ImageComponentRetained extends NodeComponentRetained { curw = tilew; } } - + // we are done copying an array of tiles in the x direction // advance the tileStart offset tileStart += dataWidth * unitsPerPixel * curh * sign; - + // move to the next set of tiles in y direction y = 0; - + // determine the height of copy region for the next set // of tiles tmph -= curh; @@ -1080,40 +1080,40 @@ abstract class ImageComponentRetained extends NodeComponentRetained { curh = tileh; } } - + if((imageData == data) && (imageDataPowerOfTwo != null)) { updateImageDataPowerOfTwo(depthIndex); } } - + // Quick line by line copy void copyImageLineByLine(BufferedImage bi, int srcX, int srcY, int dstX, int dstY, int depthIndex, int copyWidth, int copyHeight, ImageData data) { - + assert (data != null); - + int h; int rowBegin, // src begin row index srcBegin, // src begin offset dstBegin; // dst begin offset - + int dataWidth = data.dataWidth; int dataHeight = data.dataHeight; int dstUnitsPerRow = dataWidth * unitsPerPixel; // bytes per row in dst image rowBegin = srcY; - + if (yUp) { dstBegin = (depthIndex * dataWidth * dataHeight + dstY * dataWidth + dstX) * unitsPerPixel; } else { dstBegin = (depthIndex * dataWidth * dataHeight + (dataHeight - dstY - 1) * dataWidth + dstX) * unitsPerPixel; dstUnitsPerRow = - 1 * dstUnitsPerRow; } - + int copyUnits = copyWidth * unitsPerPixel; int srcWidth = bi.getWidth(); int srcUnitsPerRow = srcWidth * unitsPerPixel; srcBegin = (rowBegin * srcWidth + srcX) * unitsPerPixel; - + switch(data.getType()) { case TYPE_BYTE_ARRAY: byte[] srcByteBuffer = ((DataBufferByte)bi.getRaster().getDataBuffer()).getData(); @@ -1124,7 +1124,7 @@ abstract class ImageComponentRetained extends NodeComponentRetained { srcBegin += srcUnitsPerRow; } break; - + case TYPE_INT_ARRAY: int[] srcIntBuffer = ((DataBufferInt)bi.getRaster().getDataBuffer()).getData(); int[] dstIntBuffer = data.getAsIntArray(); @@ -1137,23 +1137,23 @@ abstract class ImageComponentRetained extends NodeComponentRetained { default: assert false; } - + if((imageData == data) && (imageDataPowerOfTwo != null)) { updateImageDataPowerOfTwo(depthIndex); } } - + // Quick block copy for yUp image void copyImageByBlock(BufferedImage bi, int depthIndex, ImageData data) { - + assert ((data != null) && yUp); - + int dataWidth = data.dataWidth; int dataHeight = data.dataHeight; - + int dstBegin; // dst begin offset dstBegin = depthIndex * dataWidth * dataHeight * unitsPerPixel; - + switch(imageData.getType()) { case TYPE_BYTE_ARRAY: byte[] srcByteBuffer = ((DataBufferByte)bi.getRaster().getDataBuffer()).getData(); @@ -1168,18 +1168,18 @@ abstract class ImageComponentRetained extends NodeComponentRetained { default: assert false; } - + if((imageData == data) && (imageDataPowerOfTwo != null)) { updateImageDataPowerOfTwo(depthIndex); } - + } - + /** * copy complete region of a RenderedImage to ImageComponent's imageData object. */ void copySupportedImageToImageData(RenderedImage ri, int depthIndex, ImageData data) { - + if (ri instanceof BufferedImage) { if(yUp) { /* Use quick block copy when ( format is OK, Yup is true, and byRef is false). */ @@ -1193,7 +1193,7 @@ abstract class ImageComponentRetained extends NodeComponentRetained { } else { // System.err.println("ImageComponentRetained.copySupportedImageToImageData() : (imageTypeSupported && !byReference ) --- (2 RI)"); copySupportedImageToImageData(ri, ri.getMinX(), ri.getMinY(), 0, 0, depthIndex, data.dataWidth, data.dataHeight, data); - + /* * An alternative approach. * @@ -1204,15 +1204,15 @@ abstract class ImageComponentRetained extends NodeComponentRetained { wRaster, cm.isAlphaPremultiplied() ,null); - + copySupportedImageToImageData((BufferedImage)ri, 0, 0, 0, 0, depthIndex, data.dataWidth, data.dataHeight, data); - + * * */ } } - + /* * copy the complete unsupported NioImageBuffer into a supported BYTE_BUFFER format */ @@ -1224,14 +1224,14 @@ abstract class ImageComponentRetained extends NodeComponentRetained { } assert (iData.getType() == ImageDataType.TYPE_BYTE_BUFFER); - assert (getImageFormatType() == ImageFormatType.TYPE_BYTE_RGBA); - + assert (getImageFormatType() == ImageFormatType.TYPE_BYTE_RGBA); + int length = copyWidth * copyHeight; ByteBuffer srcBuffer = (ByteBuffer) nioImage.getDataBuffer(); srcBuffer.rewind(); ByteBuffer dstBuffer = iData.getAsByteBuffer(); dstBuffer.rewind(); - + // Do copy and swap. for(int i = 0; i < length; i +=4) { dstBuffer.put(i, srcBuffer.get(i+3)); @@ -1240,18 +1240,18 @@ abstract class ImageComponentRetained extends NodeComponentRetained { dstBuffer.put(i+3, srcBuffer.get(i)); } } - + /* * copy the complete unsupported image into a supported BYTE_ARRAY format */ void copyUnsupportedImageToImageData(RenderedImage ri, int depthIndex, ImageData data) { - + assert (data.getType() == ImageDataType.TYPE_BYTE_ARRAY); - + if (MasterControl.isDevLoggable(Level.INFO)) { MasterControl.getDevLogger().info("ImageComponent - Copying Unsupported Image, use a different image type"); } - + if (ri instanceof BufferedImage) { copyUnsupportedImageToImageData((BufferedImage)ri, 0, 0, 0, 0, depthIndex, data.dataWidth, data.dataHeight, data); @@ -1260,10 +1260,10 @@ abstract class ImageComponentRetained extends NodeComponentRetained { 0, 0, depthIndex, data.dataWidth, data.dataHeight, data); } } - + void copyUnsupportedImageToImageData(BufferedImage bi, int srcX, int srcY, int dstX, int dstY, int depthIndex, int copyWidth, int copyHeight, ImageData data) { - + int w, h, i, j; int rowBegin, // src begin row index srcBegin, // src begin offset @@ -1272,29 +1272,29 @@ abstract class ImageComponentRetained extends NodeComponentRetained { // -1 --- ydown // 1 --- yup row; - + rowBegin = srcY; rowInc = 1; - + assert (data != null); - + int dataWidth = data.dataWidth; int dataHeight = data.dataHeight; int dstBytesPerRow = dataWidth * unitsPerPixel; // bytes per row in dst image - + if (yUp) { dstBegin = (depthIndex * dataWidth * dataHeight + dstY * dataWidth + dstX) * unitsPerPixel; } else { dstBegin = (depthIndex * dataWidth * dataHeight + (dataHeight - dstY - 1) * dataWidth + dstX) * unitsPerPixel; dstBytesPerRow = - 1 * dstBytesPerRow; } - + WritableRaster ras = bi.getRaster(); ColorModel cm = bi.getColorModel(); Object pixel = getDataElementBuffer(ras); - + byte[] dstBuffer = data.getAsByteArray(); - + switch(numberOfComponents) { case 4: { for (row = rowBegin, h = 0; @@ -1311,7 +1311,7 @@ abstract class ImageComponentRetained extends NodeComponentRetained { } } break; - + case 3: { for (row = rowBegin, h = 0; h < copyHeight; h++, row += rowInc) { @@ -1326,7 +1326,7 @@ abstract class ImageComponentRetained extends NodeComponentRetained { } } break; - + case 2: { for (row = rowBegin, h = 0; h < copyHeight; h++, row += rowInc) { @@ -1340,7 +1340,7 @@ abstract class ImageComponentRetained extends NodeComponentRetained { } } break; - + case 1: { for (row = rowBegin, h = 0; h < copyHeight; h++, row += rowInc) { @@ -1356,15 +1356,15 @@ abstract class ImageComponentRetained extends NodeComponentRetained { default: assert false; } - + if((imageData == data) && (imageDataPowerOfTwo != null)) { updateImageDataPowerOfTwo(depthIndex); } } - + void copyUnsupportedImageToImageData(RenderedImage ri, int srcX, int srcY, int dstX, int dstY, int depthIndex, int copyWidth, int copyHeight, ImageData data) { - + int w, h, i, j, m, n; int dstBegin; Object pixel = null; @@ -1374,90 +1374,90 @@ abstract class ImageComponentRetained extends NodeComponentRetained { int dstLineBytes; // sign * lineBytes int tileStart; // destination buffer offset // at the next left most tile - + int offset; - + ColorModel cm = ri.getColorModel(); - + int xoff = ri.getTileGridXOffset(); // tile origin x offset int yoff = ri.getTileGridYOffset(); // tile origin y offset int minTileX = ri.getMinTileX(); // min tile x index int minTileY = ri.getMinTileY(); // min tile y index tilew = ri.getTileWidth(); // tile width in pixels tileh = ri.getTileHeight(); // tile height in pixels - + // determine the first tile of the image - + float mt; - + mt = (float)(srcX - xoff) / (float)tilew; if (mt < 0) { minTileX = (int)(mt - 1); } else { minTileX = (int)mt; } - + mt = (float)(srcY - yoff) / (float)tileh; if (mt < 0) { minTileY = (int)(mt - 1); } else { minTileY = (int)mt; } - + // determine the pixel offset of the upper-left corner of the // first tile int startXTile = minTileX * tilew + xoff; int startYTile = minTileY * tileh + yoff; - - + + // image dimension in the first tile int curw = (startXTile + tilew - srcX); int curh = (startYTile + tileh - srcY); - + // check if the to-be-copied region is less than the tile image // if so, update the to-be-copied dimension of this tile if (curw > copyWidth) { curw = copyWidth; } - + if (curh > copyHeight) { curh = copyHeight; } - + // save the to-be-copied width of the left most tile int startw = curw; - - + + // temporary variable for dimension of the to-be-copied region int tmpw = copyWidth; int tmph = copyHeight; - - + + // offset of the first pixel of the tile to be copied; offset is // relative to the upper left corner of the title int x = srcX - startXTile; int y = srcY - startYTile; - - + + // determine the number of tiles in each direction that the // image spans - + numXTiles = (copyWidth + x) / tilew; numYTiles = (copyHeight + y) / tileh; - + if (((float)(copyWidth + x ) % (float)tilew) > 0) { numXTiles += 1; } - + if (((float)(copyHeight + y ) % (float)tileh) > 0) { numYTiles += 1; } - + assert (data != null); int dataWidth = data.dataWidth; int dataHeight = data.dataHeight; int lineBytes = dataWidth * unitsPerPixel; // nbytes per line in - + if (yUp) { // destination buffer offset tileStart = (depthIndex * dataWidth * dataHeight + dstY * dataWidth + dstX) * unitsPerPixel; @@ -1469,40 +1469,40 @@ abstract class ImageComponentRetained extends NodeComponentRetained { sign = -1; dstLineBytes = -lineBytes; } - + /* System.err.println("tileStart= " + tileStart + " dstLineBytes= " + dstLineBytes); System.err.println("startw= " + startw); */ - + // allocate memory for a pixel ras = ri.getTile(minTileX,minTileY); pixel = getDataElementBuffer(ras); byte[] dstBuffer = imageData.getAsByteArray(); - + switch(numberOfComponents) { case 4: { // System.err.println("Case 1: byReference = "+byReference); for (n = minTileY; n < minTileY+numYTiles; n++) { - + dstBegin = tileStart; // destination buffer offset tmpw = copyWidth; // reset the width to be copied curw = startw; // reset the width to be copied of // the left most tile x = srcX - startXTile; // reset the starting x offset of // the left most tile - + for (m = minTileX; m < minTileX+numXTiles; m++) { - + // retrieve the raster for the next tile ras = ri.getTile(m,n); - + j = dstBegin; offset = 0; - + //System.err.println("curh = "+curh+" curw = "+curw); //System.err.println("x = "+x+" y = "+y); - + for (h = y; h < (y + curh); h++) { // System.err.println("j = "+j); for (w = x; w < (x + curw); w++) { @@ -1515,15 +1515,15 @@ abstract class ImageComponentRetained extends NodeComponentRetained { offset += dstLineBytes; j = dstBegin + offset; } - + // advance the destination buffer offset dstBegin += curw * unitsPerPixel; - + // move to the next tile in x direction x = 0; - + // determine the width of copy region of the next tile - + tmpw -= curw; if (tmpw < tilew) { curw = tmpw; @@ -1531,15 +1531,15 @@ abstract class ImageComponentRetained extends NodeComponentRetained { curw = tilew; } } - + // we are done copying an array of tiles in the x direction // advance the tileStart offset - + tileStart += dataWidth * unitsPerPixel * curh * sign; - + // move to the next set of tiles in y direction y = 0; - + // determine the height of copy region for the next set // of tiles tmph -= curh; @@ -1553,25 +1553,25 @@ abstract class ImageComponentRetained extends NodeComponentRetained { break; case 3: { for (n = minTileY; n < minTileY+numYTiles; n++) { - + dstBegin = tileStart; // destination buffer offset tmpw = copyWidth; // reset the width to be copied curw = startw; // reset the width to be copied of // the left most tile x = srcX - startXTile; // reset the starting x offset of // the left most tile - + for (m = minTileX; m < minTileX+numXTiles; m++) { - + // retrieve the raster for the next tile ras = ri.getTile(m,n); - + j = dstBegin; offset = 0; - + //System.err.println("curh = "+curh+" curw = "+curw); //System.err.println("x = "+x+" y = "+y); - + for (h = y; h < (y + curh); h++) { // System.err.println("j = "+j); for (w = x; w < (x + curw); w++) { @@ -1583,15 +1583,15 @@ abstract class ImageComponentRetained extends NodeComponentRetained { offset += dstLineBytes; j = dstBegin + offset; } - + // advance the destination buffer offset dstBegin += curw * unitsPerPixel; - + // move to the next tile in x direction x = 0; - + // determine the width of copy region of the next tile - + tmpw -= curw; if (tmpw < tilew) { curw = tmpw; @@ -1599,15 +1599,15 @@ abstract class ImageComponentRetained extends NodeComponentRetained { curw = tilew; } } - + // we are done copying an array of tiles in the x direction // advance the tileStart offset - + tileStart += dataWidth * unitsPerPixel * curh * sign; - + // move to the next set of tiles in y direction y = 0; - + // determine the height of copy region for the next set // of tiles tmph -= curh; @@ -1621,25 +1621,25 @@ abstract class ImageComponentRetained extends NodeComponentRetained { break; case 2: { for (n = minTileY; n < minTileY+numYTiles; n++) { - + dstBegin = tileStart; // destination buffer offset tmpw = copyWidth; // reset the width to be copied curw = startw; // reset the width to be copied of // the left most tile x = srcX - startXTile; // reset the starting x offset of // the left most tile - + for (m = minTileX; m < minTileX+numXTiles; m++) { - + // retrieve the raster for the next tile ras = ri.getTile(m,n); - + j = dstBegin; offset = 0; - + //System.err.println("curh = "+curh+" curw = "+curw); //System.err.println("x = "+x+" y = "+y); - + for (h = y; h < (y + curh); h++) { // System.err.println("j = "+j); for (w = x; w < (x + curw); w++) { @@ -1650,15 +1650,15 @@ abstract class ImageComponentRetained extends NodeComponentRetained { offset += dstLineBytes; j = dstBegin + offset; } - + // advance the destination buffer offset dstBegin += curw * unitsPerPixel; - + // move to the next tile in x direction x = 0; - + // determine the width of copy region of the next tile - + tmpw -= curw; if (tmpw < tilew) { curw = tmpw; @@ -1666,17 +1666,17 @@ abstract class ImageComponentRetained extends NodeComponentRetained { curw = tilew; } } - - + + // we are done copying an array of tiles in the x direction // advance the tileStart offset - + tileStart += dataWidth * unitsPerPixel * curh * sign; - - + + // move to the next set of tiles in y direction y = 0; - + // determine the height of copy region for the next set // of tiles tmph -= curh; @@ -1690,25 +1690,25 @@ abstract class ImageComponentRetained extends NodeComponentRetained { break; case 1: { for (n = minTileY; n < minTileY+numYTiles; n++) { - + dstBegin = tileStart; // destination buffer offset tmpw = copyWidth; // reset the width to be copied curw = startw; // reset the width to be copied of // the left most tile x = srcX - startXTile; // reset the starting x offset of // the left most tile - + for (m = minTileX; m < minTileX+numXTiles; m++) { - + // retrieve the raster for the next tile ras = ri.getTile(m,n); - + j = dstBegin; offset = 0; - + //System.err.println("curh = "+curh+" curw = "+curw); //System.err.println("x = "+x+" y = "+y); - + for (h = y; h < (y + curh); h++) { // System.err.println("j = "+j); for (w = x; w < (x + curw); w++) { @@ -1718,15 +1718,15 @@ abstract class ImageComponentRetained extends NodeComponentRetained { offset += dstLineBytes; j = dstBegin + offset; } - + // advance the destination buffer offset dstBegin += curw * unitsPerPixel; - + // move to the next tile in x direction x = 0; - + // determine the width of copy region of the next tile - + tmpw -= curw; if (tmpw < tilew) { curw = tmpw; @@ -1734,14 +1734,14 @@ abstract class ImageComponentRetained extends NodeComponentRetained { curw = tilew; } } - + // we are done copying an array of tiles in the x direction // advance the tileStart offset tileStart += dataWidth * unitsPerPixel * curh * sign; - + // move to the next set of tiles in y direction y = 0; - + // determine the height of copy region for the next set // of tiles tmph -= curh; @@ -1753,17 +1753,17 @@ abstract class ImageComponentRetained extends NodeComponentRetained { } } break; - + default: assert false; } - + if((imageData == data) && (imageDataPowerOfTwo != null)) { updateImageDataPowerOfTwo(depthIndex); } } - - + + void evaluateExtensions(Canvas3D canvas) { // Issue 366: need to synchronize since it could be called concurrently // from multiple renderers (and maybe the renderer(s) and renderbin) @@ -1773,38 +1773,38 @@ abstract class ImageComponentRetained extends NodeComponentRetained { evaluateExtABGR(canvas.extensionsSupported); evaluateExtNonPowerOfTwo(canvas.textureExtendedFeatures); } - + } - - + + void evaluateExtABGR(int ext) { - - + + // If abgrSupported is false, a copy has been created so // we don't have to check again. if(!abgrSupported) { return; } - + if(getImageFormatType() != ImageFormatType.TYPE_BYTE_ABGR) { return; } - + if((ext & Canvas3D.EXT_ABGR) != 0) { return; } - + // ABGR is unsupported, set flag to false. abgrSupported = false; convertImageDataFromABGRToRGBA(); - + } - + private int getClosestPowerOf2(int value) { - + if (value < 1) return value; - + int powerValue = 1; for (;;) { powerValue *= 2; @@ -1819,12 +1819,12 @@ abstract class ImageComponentRetained extends NodeComponentRetained { } } } - + private int getCeilPowerOf2(int value) { - + if (value < 1) return value; - + int powerValue = 1; for (;;) { powerValue *= 2; @@ -1833,13 +1833,13 @@ abstract class ImageComponentRetained extends NodeComponentRetained { return powerValue; } } - } - + } + void evaluateExtNonPowerOfTwo(int ext) { // Only need to enforce for Raster or Background. if(!enforceNonPowerOfTwoSupport) { return; - } + } // If npotSupported is false, a copy power of two image has been created // so we don't have to check again. @@ -1850,7 +1850,7 @@ abstract class ImageComponentRetained extends NodeComponentRetained { if (imageData == null && !isByReference()) { return; } - + if((ext & Canvas3D.TEXTURE_NON_POWER_OF_TWO) != 0) { return; } @@ -1859,7 +1859,7 @@ abstract class ImageComponentRetained extends NodeComponentRetained { npotSupported = false; int npotWidth; - int npotHeight; + int npotHeight; // Always scale up if image size is smaller 512*512. if((width * height) < IMAGE_SIZE_512X512) { npotWidth = getCeilPowerOf2(width); @@ -1868,22 +1868,22 @@ abstract class ImageComponentRetained extends NodeComponentRetained { npotWidth = getClosestPowerOf2(width); npotHeight = getClosestPowerOf2(height); } - + // System.err.println("width " + width + " height " + height + " npotWidth " + npotWidth + " npotHeight " + npotHeight); float xScale = (float)npotWidth/(float)width; float yScale = (float)npotHeight/(float)height; - + // scale if scales aren't 1.0 if (!(xScale == 1.0f && yScale == 1.0f)) { - + if (imageData == null) { // This is a byRef, support format and is a RenderedImage case. // See ImageComponent2DRetained.set(RenderedImage image) - RenderedImage ri = (RenderedImage) getRefImage(0); - + RenderedImage ri = (RenderedImage) getRefImage(0); + assert !(ri instanceof BufferedImage); - + // Create a buffered image from renderImage ColorModel cm = ri.getColorModel(); WritableRaster wRaster = ri.copyData(null); @@ -1891,53 +1891,53 @@ abstract class ImageComponentRetained extends NodeComponentRetained { wRaster, cm.isAlphaPremultiplied() ,null); - - + + // Create image data object with buffer for image. */ imageData = createRenderedImageDataObject(null); copySupportedImageToImageData(ri, 0, imageData); - + } - + assert imageData != null; - + // Create a supported BufferedImage type. BufferedImage bi = imageData.createBufferedImage(0); - + int imageType = bi.getType(); - BufferedImage scaledImg = new BufferedImage(npotWidth, npotHeight, imageType); - + BufferedImage scaledImg = new BufferedImage(npotWidth, npotHeight, imageType); + AffineTransform at = AffineTransform.getScaleInstance(xScale, yScale); - + powerOfTwoATOp = new AffineTransformOp(at, AffineTransformOp.TYPE_BILINEAR); - + powerOfTwoATOp.filter(bi, scaledImg); - + // System.err.println("bi " + bi.getColorModel()); // System.err.println("scaledImg " + scaledImg.getColorModel()); - + imageDataPowerOfTwo = createRenderedImageDataObject(null, npotWidth, npotHeight); // Since bi is created from imageData, it's imageType is supported. copySupportedImageToImageData(scaledImg, 0, imageDataPowerOfTwo); - + } else { imageDataPowerOfTwo = null; } } - + void convertImageDataFromABGRToRGBA() { - + // Unsupported format on HW, switch to slow copy. imageFormatType = ImageFormatType.TYPE_BYTE_RGBA; imageTypeIsSupported = false; - + // Only need to convert imageData imageData.convertFromABGRToRGBA(); - + } - + /** * Copy supported ImageType from ImageData to the user defined bufferedImage */ @@ -1946,25 +1946,25 @@ abstract class ImageComponentRetained extends NodeComponentRetained { int rowBegin, // src begin row index srcBegin, // src begin offset dstBegin; // dst begin offset - + // refImage has to be a BufferedImage for off screen and read raster assert refImage[depth] != null; assert (refImage[depth] instanceof BufferedImage); - + BufferedImage bi = (BufferedImage)refImage[depth]; int dstUnitsPerRow = width * unitsPerPixel; // bytes per row in dst image rowBegin = 0; - + if (yUp) { dstBegin = (depth * width * height) * unitsPerPixel; } else { dstBegin = (depth * width * height + (height - 1) * width ) * unitsPerPixel; dstUnitsPerRow = - 1 * dstUnitsPerRow; } - + int scanline = width * unitsPerPixel; srcBegin = (rowBegin * width ) * unitsPerPixel; - + switch(imageData.getType()) { case TYPE_BYTE_ARRAY: byte[] dstByteBuffer = ((DataBufferByte)bi.getRaster().getDataBuffer()).getData(); @@ -1975,7 +1975,7 @@ abstract class ImageComponentRetained extends NodeComponentRetained { srcBegin += scanline; } break; - + case TYPE_INT_ARRAY: int[] dstIntBuffer = ((DataBufferInt)bi.getRaster().getDataBuffer()).getData(); int[] srcIntBuffer = imageData.getAsIntArray(); @@ -1988,9 +1988,9 @@ abstract class ImageComponentRetained extends NodeComponentRetained { default: assert false; } - + } - + /** * Copy image to the user defined bufferedImage ( 3 or 4 components only ) */ @@ -2000,11 +2000,11 @@ abstract class ImageComponentRetained extends NodeComponentRetained { // refImage has to be a BufferedImage for off screen and read raster assert refImage[depth] != null; assert (refImage[depth] instanceof BufferedImage); - + BufferedImage bi = (BufferedImage)refImage[depth]; int biType = bi.getType(); byte[] buf = imageData.getAsByteArray(); - + // convert from Ydown to Yup for texture if (!yUp) { dstInc = -1 * width; @@ -2017,7 +2017,7 @@ abstract class ImageComponentRetained extends NodeComponentRetained { dstIndex = 0; dstIndexInc = 1; } - + switch (biType) { case BufferedImage.TYPE_INT_ARGB: int[] intData = @@ -2051,7 +2051,7 @@ abstract class ImageComponentRetained extends NodeComponentRetained { assert false; } break; - + case BufferedImage.TYPE_INT_RGB: intData = ((DataBufferInt)bi.getRaster().getDataBuffer()).getData(); @@ -2067,16 +2067,16 @@ abstract class ImageComponentRetained extends NodeComponentRetained { } } break; - + case BufferedImage.TYPE_4BYTE_ABGR: byte[] byteData = ((DataBufferByte)bi.getRaster().getDataBuffer()).getData(); // Multiply by 4 to get the byte incr and start point j = 0; - + //Issue 381: dstBegin contains pixel count, but we are looping over byte count. In case of YDown, it contains a count that is decremented and if we do not multiply, we have an AIOOB thrown at 25% of the copy. dstBegin <<= 2; - + switch (imageFormatType) { case TYPE_BYTE_RGBA: for(h = 0; h < height; h++, dstBegin += (dstInc << 2)) { @@ -2104,13 +2104,13 @@ abstract class ImageComponentRetained extends NodeComponentRetained { assert false; } break; - + case BufferedImage.TYPE_INT_BGR: intData = ((DataBufferInt)bi.getRaster().getDataBuffer()).getData(); // Multiply by 4 to get the byte incr and start point j = 0; - + for(h = 0; h < height; h++, dstBegin += dstInc) { i = dstBegin; for (w = 0; w < width; w++, j+=4, i++) { @@ -2124,14 +2124,14 @@ abstract class ImageComponentRetained extends NodeComponentRetained { default: assert false; } - + } - + // Add a user to the userList synchronized void addUser(NodeComponentRetained node) { userList.add(node); } - + // Add a user to the userList synchronized void removeUser(NodeComponentRetained node) { int i = userList.indexOf(node); @@ -2139,7 +2139,7 @@ abstract class ImageComponentRetained extends NodeComponentRetained { userList.remove(i); } } - + /* * * @exception IllegalSharingException if this image is @@ -2152,18 +2152,18 @@ abstract class ImageComponentRetained extends NodeComponentRetained { } super.setLive(inBackgroundGroup, refCount); } - + /** * ImageComponent object doesn't really have mirror object. * But it's using the updateMirrorObject interface to propagate * the changes to the users */ synchronized void updateMirrorObject(int component, Object value) { - + //System.err.println("ImageComponent.updateMirrorObject"); - + Object user; - + if (((component & IMAGE_CHANGED) != 0) || ((component & SUBIMAGE_CHANGED) != 0)) { synchronized(userList) { @@ -2182,9 +2182,9 @@ abstract class ImageComponentRetained extends NodeComponentRetained { } } } - + final void sendMessage(int attrMask, Object attr) { - + J3dMessage createMessage = new J3dMessage(); createMessage.threads = J3dThread.UPDATE_RENDERING_ATTRIBUTES | J3dThread.UPDATE_RENDER; @@ -2196,16 +2196,16 @@ abstract class ImageComponentRetained extends NodeComponentRetained { createMessage.args[3] = new Integer(changedFrequent); VirtualUniverse.mc.processMessage(createMessage); } - + void handleFrequencyChange(int bit) { if (bit == ImageComponent.ALLOW_IMAGE_WRITE) { setFrequencyChangeMask(ImageComponent.ALLOW_IMAGE_WRITE, 0x1); } } - + static Object getDataElementBuffer(java.awt.image.Raster ras) { int nc = ras.getNumDataElements(); - + switch (ras.getTransferType()) { case DataBuffer.TYPE_INT: return new int[nc]; @@ -2222,20 +2222,20 @@ abstract class ImageComponentRetained extends NodeComponentRetained { // Should not happen return null; } - + /** * Wrapper class for image data. * Currently supports byte array and int array. * Will eventually support NIO ByteBuffer and IntBuffer. */ class ImageData { - + private Object data = null; private ImageDataType imageDataType = ImageDataType.TYPE_NULL; private int length = 0; private boolean dataIsByRef = false; private int dataWidth, dataHeight; - + /** * Constructs a new ImageData buffer of the specified type with the * specified length. @@ -2246,7 +2246,7 @@ abstract class ImageComponentRetained extends NodeComponentRetained { this.dataWidth = dataWidth; this.dataHeight = dataHeight; this.dataIsByRef = false; - + switch (imageDataType) { case TYPE_BYTE_ARRAY: data = new byte[length]; @@ -2263,7 +2263,7 @@ abstract class ImageComponentRetained extends NodeComponentRetained { throw new AssertionError(); } } - + /** * Constructs a new ImageData buffer of the specified type with the * specified length and the specified byRefImage as data. @@ -2272,13 +2272,13 @@ abstract class ImageComponentRetained extends NodeComponentRetained { Object byRefImage) { BufferedImage bi; NioImageBuffer nio; - + this.imageDataType = imageDataType; this.length = length; this.dataWidth = dataWidth; this.dataHeight = dataHeight; this.dataIsByRef = true; - + switch (imageDataType) { case TYPE_BYTE_ARRAY: bi = (BufferedImage) byRefImage; @@ -2289,7 +2289,7 @@ abstract class ImageComponentRetained extends NodeComponentRetained { data = ((DataBufferInt)bi.getRaster().getDataBuffer()).getData(); break; case TYPE_BYTE_BUFFER: - case TYPE_INT_BUFFER: + case TYPE_INT_BUFFER: nio = (NioImageBuffer) byRefImage; data = nio.getDataBuffer(); break; @@ -2297,7 +2297,7 @@ abstract class ImageComponentRetained extends NodeComponentRetained { throw new AssertionError(); } } - + /** * Constructs a new ImageData buffer from the specified * object. This object stores a reference to the input image data. @@ -2307,7 +2307,7 @@ abstract class ImageComponentRetained extends NodeComponentRetained { dataIsByRef = isByRef; dataWidth = ((ImageData) data).dataWidth; dataHeight = ((ImageData) data).dataHeight; - + if (data == null) { imageDataType = ImageDataType.TYPE_NULL; length = 0; @@ -2327,87 +2327,87 @@ abstract class ImageComponentRetained extends NodeComponentRetained { assert false; } } - + /** * Returns the type of this DataBuffer. */ ImageDataType getType() { return imageDataType; } - + /** * Returns the number of elements in this DataBuffer. */ int length() { return length; } - + /** * Returns the width of this DataBuffer. */ int getWidth() { return dataWidth; } - + /** * Returns the height of this DataBuffer. */ int getHeight() { return dataHeight; } - + /** * Returns this DataBuffer as an Object. */ Object get() { return data; } - + /** * Returns is this data is byRef. No internal data is made. */ boolean isDataByRef() { return dataIsByRef; } - - + + /** * Returns this DataBuffer as a byte array. */ byte[] getAsByteArray() { return (byte[]) data; } - + /** * Returns this DataBuffer as an int array. */ int[] getAsIntArray() { return (int[]) data; } - + /** * Returns this DataBuffer as an nio ByteBuffer. */ ByteBuffer getAsByteBuffer() { return (ByteBuffer) data; } - + /** * Returns this DataBuffer as an nio IntBuffer. */ IntBuffer getAsIntBuffer() { return (IntBuffer) data; } - + // Handle TYPE_BYTE_LA only void copyByLineAndExpand(BufferedImage bi, int depthIndex) { int h; int srcBegin, // src begin offset dstBegin; // dst begin offset - + assert (imageData.getType() == ImageDataType.TYPE_BYTE_ARRAY); assert (imageFormatType == ImageFormatType.TYPE_BYTE_LA); - + int unitsPerRow = width * unitsPerPixel; // bytes per row int scanline = unitsPerRow; if (yUp) { @@ -2416,11 +2416,11 @@ abstract class ImageComponentRetained extends NodeComponentRetained { srcBegin = (depthIndex * width * height + (height - 1) * width) * unitsPerPixel; unitsPerRow = - 1 * unitsPerRow; } - + dstBegin = 0; // ABGR is 4 bytes per pixel int dstUnitsPerRow = width * 4; - + byte[] dstByteBuffer = ((DataBufferByte)bi.getRaster().getDataBuffer()).getData(); byte[] srcByteBuffer = imageData.getAsByteArray(); for (h = 0; h < height; h++) { @@ -2430,20 +2430,20 @@ abstract class ImageComponentRetained extends NodeComponentRetained { dstByteBuffer[dstBegin+v+2] = 0; dstByteBuffer[dstBegin+v+3] = srcByteBuffer[srcBegin+w]; // Red } - + dstBegin += dstUnitsPerRow; srcBegin += unitsPerRow; } - + } - + // Quick line by line copy void copyByLine(BufferedImage bi, int depthIndex, boolean swapNeeded) { - + int h; int srcBegin, // src begin offset dstBegin; // dst begin offset - + int unitsPerRow = width * unitsPerPixel; // bytes per row int copyUnits = unitsPerRow; if (yUp) { @@ -2452,9 +2452,9 @@ abstract class ImageComponentRetained extends NodeComponentRetained { srcBegin = (depthIndex * width * height + (height - 1) * width) * unitsPerPixel; unitsPerRow = - 1 * unitsPerRow; } - + dstBegin = 0; - + switch(imageData.getType()) { case TYPE_BYTE_ARRAY: byte[] dstByteBuffer = ((DataBufferByte)bi.getRaster().getDataBuffer()).getData(); @@ -2487,7 +2487,7 @@ abstract class ImageComponentRetained extends NodeComponentRetained { srcBegin += unitsPerRow; } break; - + // INT case doesn't required to handle swapNeeded case TYPE_INT_ARRAY: assert (!swapNeeded); @@ -2503,11 +2503,11 @@ abstract class ImageComponentRetained extends NodeComponentRetained { assert false; } } - + void copyByBlock(BufferedImage bi, int depthIndex) { // src begin offset int srcBegin = depthIndex * width * height * unitsPerPixel; - + switch(imageData.getType()) { case TYPE_BYTE_ARRAY: byte[] dstByteBuffer = ((DataBufferByte)bi.getRaster().getDataBuffer()).getData(); @@ -2523,13 +2523,13 @@ abstract class ImageComponentRetained extends NodeComponentRetained { assert false; } } - + // Need to check for imageData is null. if it is null return null. BufferedImage createBufferedImage(int depthIndex) { if(data != null) { int bufferType = BufferedImage.TYPE_CUSTOM; boolean swapNeeded = false; - + switch(imageFormatType) { case TYPE_BYTE_BGR: bufferType = BufferedImage.TYPE_3BYTE_BGR; @@ -2566,9 +2566,9 @@ abstract class ImageComponentRetained extends NodeComponentRetained { bufferType = BufferedImage.TYPE_USHORT_GRAY; default: assert false; - + } - + BufferedImage bi = new BufferedImage(width, height, bufferType); if((!swapNeeded) && (imageFormatType != ImageFormatType.TYPE_BYTE_LA)) { if(yUp) { @@ -2583,23 +2583,23 @@ abstract class ImageComponentRetained extends NodeComponentRetained { } else { assert false; } - + return bi; - + } return null; } - + void convertFromABGRToRGBA() { int i; - + if(imageDataType == ImageComponentRetained.ImageDataType.TYPE_BYTE_ARRAY) { // Note : Highly inefficient for depth > 0 case. // This method doesn't take into account of depth, it is assuming that // depth == 0, which is true for ImageComponent2D. byte[] srcBuffer, dstBuffer; srcBuffer = getAsByteArray(); - + if(dataIsByRef) { dstBuffer = new byte[length]; // Do copy and swap. @@ -2611,7 +2611,7 @@ abstract class ImageComponentRetained extends NodeComponentRetained { } data = dstBuffer; dataIsByRef = false; - + } else { byte a, b; // Do swap in place. @@ -2623,20 +2623,20 @@ abstract class ImageComponentRetained extends NodeComponentRetained { srcBuffer[i+2] = b; srcBuffer[i+3] = a; } - } + } } else if(imageDataType == ImageComponentRetained.ImageDataType.TYPE_BYTE_BUFFER) { - + assert dataIsByRef; ByteBuffer srcBuffer, dstBuffer; - + srcBuffer = getAsByteBuffer(); srcBuffer.rewind(); - + ByteOrder order = ByteOrder.nativeOrder(); dstBuffer = ByteBuffer.allocateDirect(length).order(order); dstBuffer.rewind(); - + // Do copy and swap. for(i = 0; i < length; i +=4) { dstBuffer.put(i, srcBuffer.get(i+3)); @@ -2644,7 +2644,7 @@ abstract class ImageComponentRetained extends NodeComponentRetained { dstBuffer.put(i+2, srcBuffer.get(i+1)); dstBuffer.put(i+3, srcBuffer.get(i)); } - + dataIsByRef = false; } diff --git a/src/classes/share/javax/media/j3d/IndexedGeometryArray.java b/src/classes/share/javax/media/j3d/IndexedGeometryArray.java index 56d5aaa..73910c0 100644 --- a/src/classes/share/javax/media/j3d/IndexedGeometryArray.java +++ b/src/classes/share/javax/media/j3d/IndexedGeometryArray.java @@ -50,7 +50,7 @@ public abstract class IndexedGeometryArray extends GeometryArray { // set default read capabilities setDefaultReadCapabilities(readCapabilities); } - + /** * Specifies that this IndexedGeometryArray allows reading the array of * coordinate indices. @@ -529,7 +529,7 @@ public abstract class IndexedGeometryArray extends GeometryArray { int format = ((IndexedGeometryArrayRetained)this.retained).vertexFormat; if ((format & BY_REFERENCE_INDICES) != 0) throw new IllegalStateException(J3dI18N.getString("IndexedGeometryArray31")); - + ((IndexedGeometryArrayRetained)this.retained).setCoordinateIndex(index, coordinateIndex); } @@ -566,7 +566,7 @@ public abstract class IndexedGeometryArray extends GeometryArray { int format = ((IndexedGeometryArrayRetained)this.retained).vertexFormat; if ((format & BY_REFERENCE_INDICES) != 0) throw new IllegalStateException(J3dI18N.getString("IndexedGeometryArray31")); - + ((IndexedGeometryArrayRetained)this.retained).setCoordinateIndices(index, coordinateIndices); } @@ -637,7 +637,7 @@ public abstract class IndexedGeometryArray extends GeometryArray { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_COLOR_INDEX_WRITE)) throw new CapabilityNotSetException(J3dI18N.getString("IndexedGeometryArray3")); - + ((IndexedGeometryArrayRetained)this.retained).setColorIndex(index, colorIndex); } @@ -667,7 +667,7 @@ public abstract class IndexedGeometryArray extends GeometryArray { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_COLOR_INDEX_WRITE)) throw new CapabilityNotSetException(J3dI18N.getString("IndexedGeometryArray3")); - + ((IndexedGeometryArrayRetained)this.retained).setColorIndices(index, colorIndices); } @@ -697,7 +697,7 @@ public abstract class IndexedGeometryArray extends GeometryArray { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_NORMAL_INDEX_WRITE)) throw new CapabilityNotSetException(J3dI18N.getString("IndexedGeometryArray5")); - + ((IndexedGeometryArrayRetained)this.retained).setNormalIndex(index, normalIndex); } @@ -727,7 +727,7 @@ public abstract class IndexedGeometryArray extends GeometryArray { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_NORMAL_INDEX_WRITE)) throw new CapabilityNotSetException(J3dI18N.getString("IndexedGeometryArray5")); - + ((IndexedGeometryArrayRetained)this.retained).setNormalIndices(index, normalIndices); } @@ -774,7 +774,7 @@ public abstract class IndexedGeometryArray extends GeometryArray { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_TEXCOORD_INDEX_WRITE)) throw new CapabilityNotSetException(J3dI18N.getString("IndexedGeometryArray7")); - + ((IndexedGeometryArrayRetained)this.retained).setTextureCoordinateIndex(texCoordSet, index, texCoordIndex); } @@ -821,7 +821,7 @@ public abstract class IndexedGeometryArray extends GeometryArray { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_TEXCOORD_INDEX_WRITE)) throw new CapabilityNotSetException(J3dI18N.getString("IndexedGeometryArray7")); - + ((IndexedGeometryArrayRetained)this.retained).setTextureCoordinateIndices(texCoordSet, index, texCoordIndices); } @@ -899,7 +899,7 @@ public abstract class IndexedGeometryArray extends GeometryArray { throw new CapabilityNotSetException(J3dI18N.getString("IndexedGeometryArray28")); } } - + ((IndexedGeometryArrayRetained)this.retained).setVertexAttrIndices(vertexAttrNum, index, vertexAttrIndices); } @@ -924,7 +924,7 @@ public abstract class IndexedGeometryArray extends GeometryArray { int format = ((IndexedGeometryArrayRetained)this.retained).vertexFormat; if ((format & BY_REFERENCE_INDICES) != 0) throw new IllegalStateException(J3dI18N.getString("IndexedGeometryArray31")); - + return ((IndexedGeometryArrayRetained)this.retained).getCoordinateIndex(index); } @@ -949,7 +949,7 @@ public abstract class IndexedGeometryArray extends GeometryArray { int format = ((IndexedGeometryArrayRetained)this.retained).vertexFormat; if ((format & BY_REFERENCE_INDICES) != 0) throw new IllegalStateException(J3dI18N.getString("IndexedGeometryArray31")); - + ((IndexedGeometryArrayRetained)this.retained).getCoordinateIndices(index, coordinateIndices); } @@ -968,13 +968,13 @@ public abstract class IndexedGeometryArray extends GeometryArray { */ public int[] getCoordIndicesRef() { if (isLiveOrCompiled()) - if (!this.getCapability(ALLOW_REF_DATA_READ)) + if (!this.getCapability(ALLOW_REF_DATA_READ)) throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray87")); int format = ((IndexedGeometryArrayRetained)this.retained).vertexFormat; if ((format & BY_REFERENCE_INDICES) == 0) throw new IllegalStateException(J3dI18N.getString("IndexedGeometryArray32")); - + return ((IndexedGeometryArrayRetained)this.retained).getCoordIndicesRef(); } @@ -993,7 +993,7 @@ public abstract class IndexedGeometryArray extends GeometryArray { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_COLOR_INDEX_READ)) throw new CapabilityNotSetException(J3dI18N.getString("IndexedGeometryArray11")); - + return ((IndexedGeometryArrayRetained)this.retained).getColorIndex(index); } @@ -1014,7 +1014,7 @@ public abstract class IndexedGeometryArray extends GeometryArray { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_COLOR_INDEX_READ)) throw new CapabilityNotSetException(J3dI18N.getString("IndexedGeometryArray11")); - + ((IndexedGeometryArrayRetained)this.retained).getColorIndices(index, colorIndices); } @@ -1033,7 +1033,7 @@ public abstract class IndexedGeometryArray extends GeometryArray { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_NORMAL_INDEX_READ)) throw new CapabilityNotSetException(J3dI18N.getString("IndexedGeometryArray13")); - + return ((IndexedGeometryArrayRetained)this.retained).getNormalIndex(index); } @@ -1042,7 +1042,7 @@ public abstract class IndexedGeometryArray extends GeometryArray { * the specified index for this object. The normal indicies are * copied into the specified array. The array must be large enough * to hold all of the normal indicies. - * + * * @param index the vertex index * @param normalIndices array that will receive the normal indices * @exception CapabilityNotSetException if appropriate capability is @@ -1055,7 +1055,7 @@ public abstract class IndexedGeometryArray extends GeometryArray { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_NORMAL_INDEX_READ)) throw new CapabilityNotSetException(J3dI18N.getString("IndexedGeometryArray13")); - + ((IndexedGeometryArrayRetained)this.retained).getNormalIndices(index, normalIndices); } @@ -1116,7 +1116,7 @@ public abstract class IndexedGeometryArray extends GeometryArray { * * @param texCoordSet texture coordinate set in this geometry array * @param index the vertex index - * @param texCoordIndices array that will receive the texture coordinate + * @param texCoordIndices array that will receive the texture coordinate * indices * * @exception CapabilityNotSetException if appropriate capability is @@ -1138,7 +1138,7 @@ public abstract class IndexedGeometryArray extends GeometryArray { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_COORDINATE_INDEX_READ)) throw new CapabilityNotSetException(J3dI18N.getString("IndexedGeometryArray15")); - + ((IndexedGeometryArrayRetained)this.retained).getTextureCoordinateIndices(texCoordSet, index, texCoordIndices); } @@ -1204,7 +1204,7 @@ public abstract class IndexedGeometryArray extends GeometryArray { throw new CapabilityNotSetException(J3dI18N.getString("IndexedGeometryArray29")); } } - + ((IndexedGeometryArrayRetained)this.retained).getVertexAttrIndices(vertexAttrNum, index, vertexAttrIndices); } @@ -1213,7 +1213,7 @@ public abstract class IndexedGeometryArray extends GeometryArray { * the current node. This method is called from the * <code>duplicateNode</code> method. This routine does * the actual duplication of all "local data" (any data defined in - * this object). + * this object). * * @param originalNodeComponent the original node to duplicate. * @param forceDuplicate when set to <code>true</code>, causes the @@ -1225,17 +1225,17 @@ public abstract class IndexedGeometryArray extends GeometryArray { * @see Node#cloneTree * @see NodeComponent#setDuplicateOnCloneTree */ - void duplicateAttributes(NodeComponent originalNodeComponent, + void duplicateAttributes(NodeComponent originalNodeComponent, boolean forceDuplicate) { super.duplicateAttributes(originalNodeComponent, forceDuplicate); - // vertexFormat, vertexCount and indexCount are copied in + // vertexFormat, vertexCount and indexCount are copied in // subclass when constructor - // public IndexedGeometryArray(int vertexCount, int vertexFormat, - // int indexCount) + // public IndexedGeometryArray(int vertexCount, int vertexFormat, + // int indexCount) // is used in cloneNodeComponent() - IndexedGeometryArrayRetained ga = + IndexedGeometryArrayRetained ga = (IndexedGeometryArrayRetained) originalNodeComponent.retained; - IndexedGeometryArrayRetained rt = + IndexedGeometryArrayRetained rt = (IndexedGeometryArrayRetained) retained; int vformat = ga.getVertexFormat(); diff --git a/src/classes/share/javax/media/j3d/IndexedGeometryArrayRetained.java b/src/classes/share/javax/media/j3d/IndexedGeometryArrayRetained.java index 5bd9f36..8df03cd 100644 --- a/src/classes/share/javax/media/j3d/IndexedGeometryArrayRetained.java +++ b/src/classes/share/javax/media/j3d/IndexedGeometryArrayRetained.java @@ -135,7 +135,7 @@ abstract class IndexedGeometryArrayRetained extends GeometryArrayRetained { obj.cloneSourceArray = this; obj.unIndexify(this); obj.source=source; - + return obj; } @@ -206,18 +206,18 @@ abstract class IndexedGeometryArrayRetained extends GeometryArrayRetained { throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("IndexedGeometryArray23")); } break; - case PD: + case PD: if (doubleRefCoords != null && (3 * newMax >= doubleRefCoords.length)) { throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("IndexedGeometryArray23")); } break; - case P3F: + case P3F: if (p3fRefCoords != null && (newMax >= p3fRefCoords.length)) { throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("IndexedGeometryArray23")); } break; - case P3D: + case P3D: if (p3dRefCoords != null && (newMax >= p3dRefCoords.length)) { throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("IndexedGeometryArray23")); } @@ -234,7 +234,7 @@ abstract class IndexedGeometryArrayRetained extends GeometryArrayRetained { } } - } + } void doColorCheck(int newMax) { // If the new Value is greater than the old value, make sure there is array length @@ -242,14 +242,14 @@ abstract class IndexedGeometryArrayRetained extends GeometryArrayRetained { // Check to make sure that the array length defined by the user is ateast maxCoordIndex long if ((vertexFormat & GeometryArray.COLOR) == 0) return; - + if ((vertexFormat & GeometryArray.BY_REFERENCE) == 0) { if (newMax >= vertexCount) { throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("IndexedGeometryArray24")); } } else { - int multiplier = getColorStride(); + int multiplier = getColorStride(); if(( vertexFormat & GeometryArray.USE_NIO_BUFFER) != 0) { if ((vertexFormat & GeometryArray.INTERLEAVED) == 0) { @@ -257,12 +257,12 @@ abstract class IndexedGeometryArrayRetained extends GeometryArrayRetained { case CF: if (floatBufferRefColors != null && multiplier * newMax >= floatBufferRefColors.limit()) { throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("IndexedGeometryArray24")); - } + } break; - case CUB: + case CUB: if (byteBufferRefColors != null && multiplier * newMax >= byteBufferRefColors.limit()) { throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("IndexedGeometryArray24")); - } + } break; } } @@ -280,28 +280,28 @@ abstract class IndexedGeometryArrayRetained extends GeometryArrayRetained { throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("IndexedGeometryArray24")); } break; - case CUB: + case CUB: if (byteRefColors != null && (multiplier * newMax >= byteRefColors.length)) { throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("IndexedGeometryArray24")); } break; - case C3F: + case C3F: if (c3fRefColors != null && (newMax >= c3fRefColors.length)) { throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("IndexedGeometryArray24")); } break; - case C4F: + case C4F: if (c4fRefColors != null && (newMax >= c4fRefColors.length)) { throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("IndexedGeometryArray24")); } break; - case C3UB: + case C3UB: if (c3bRefColors != null && (newMax >= c3bRefColors.length)) { throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("IndexedGeometryArray24")); } break; - case C4UB: + case C4UB: if (c4bRefColors != null && (newMax >= c4bRefColors.length)) { throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("IndexedGeometryArray24")); } @@ -346,7 +346,7 @@ abstract class IndexedGeometryArrayRetained extends GeometryArrayRetained { throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("IndexedGeometryArray26")); } } - } else { + } else { if ((vertexFormat & GeometryArray.INTERLEAVED) == 0) { switch ((vertexType & NORMAL_DEFINED)) { case NF: @@ -354,7 +354,7 @@ abstract class IndexedGeometryArrayRetained extends GeometryArrayRetained { throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("IndexedGeometryArray26")); } break; - case N3F: + case N3F: if (v3fRefNormals != null && (newMax >= v3fRefNormals.length)) { throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("IndexedGeometryArray26")); } @@ -416,13 +416,13 @@ abstract class IndexedGeometryArrayRetained extends GeometryArrayRetained { throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("IndexedGeometryArray25")); } break; - case T2F: + case T2F: if (refTexCoords[texCoordSet] != null && (newMax >= ((TexCoord2f[])refTexCoords[texCoordSet]).length)) { throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("IndexedGeometryArray25")); } break; - case T3F: + case T3F: if (refTexCoords[texCoordSet] != null && (newMax >= ((TexCoord3f[])refTexCoords[texCoordSet]).length)) { throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("IndexedGeometryArray25")); } @@ -507,9 +507,9 @@ abstract class IndexedGeometryArrayRetained extends GeometryArrayRetained { } if ((vertexFormat & GeometryArray.NORMALS) != 0) { maxNormalIndex = newMax; - } + } } - + boolean isLive = source!=null && source.isLive(); if(isLive){ geomLock.getLock(); @@ -536,9 +536,9 @@ abstract class IndexedGeometryArrayRetained extends GeometryArrayRetained { if (dataValue < 0) { // Throw an exception, since index is negative throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("IndexedGeometryArray27")); - + } - + if (newMax == indices[index]) { if (dataValue >= newMax) { newMax = dataValue; @@ -572,7 +572,7 @@ abstract class IndexedGeometryArrayRetained extends GeometryArrayRetained { if (newIndices[j] < 0) { // Throw an exception, since index is negative throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("IndexedGeometryArray27")); - + } if (indices[index+j] == maxIndex) { if (newIndices[j] >= newMax) { @@ -633,9 +633,9 @@ abstract class IndexedGeometryArrayRetained extends GeometryArrayRetained { } if ((vertexFormat & GeometryArray.NORMALS) != 0) { maxNormalIndex = newMax; - } + } } - + boolean isLive = source!=null && source.isLive(); if(isLive){ geomLock.getLock(); @@ -726,8 +726,8 @@ abstract class IndexedGeometryArrayRetained extends GeometryArrayRetained { final void doPostUpdaterUpdate() { // user may have called setCoordIndicesRef and/or // changed contents of indexCoord array. Thus, need to - // recompute maxCoordIndex unconditionally (and redundantly - // if user had only invoked setCoordIndicesRef but not also + // recompute maxCoordIndex unconditionally (and redundantly + // if user had only invoked setCoordIndicesRef but not also // changed contents). geomLock is currently locked. // Option 1: @@ -736,7 +736,7 @@ abstract class IndexedGeometryArrayRetained extends GeometryArrayRetained { // out too many sendDataChangedMessage(true) - occurs if updateData // method is called rapidly. // setCoordIndicesRef(indexCoord); - + // Option 2: // use only necessary code from setCoordIndicesRef // System.err.println("IndexedGeometryArrayretained#doUpdaterUpdate"); @@ -744,7 +744,7 @@ abstract class IndexedGeometryArrayRetained extends GeometryArrayRetained { if (indexCoord != null) { newMax = computeMaxIndexWithCheck(initialIndexIndex, validIndexCount, indexCoord); - if (newMax > maxCoordIndex) { + if (newMax > maxCoordIndex) { doErrorCheck(newMax); } } @@ -765,9 +765,9 @@ abstract class IndexedGeometryArrayRetained extends GeometryArrayRetained { } if ((vertexFormat & GeometryArray.NORMALS) != 0) { maxNormalIndex = newMax; - } + } } - + dirtyFlag |= INDEX_CHANGED; maxCoordIndex = newMax; } @@ -791,7 +791,7 @@ abstract class IndexedGeometryArrayRetained extends GeometryArrayRetained { } // No need to set INDEX_CHANGED since IndexBuffer // is used only when USE_COORD_INDEX_ONLY specified. - // In this case only coordinate index array is + // In this case only coordinate index array is // considered. this.indexColor[index] = colorIndex; maxColorIndex = newMax; @@ -990,7 +990,7 @@ abstract class IndexedGeometryArrayRetained extends GeometryArrayRetained { void setVertexAttrIndices(int vertexAttrNum, int index, int[] vertexAttrIndices) { - + int i, j, num = vertexAttrIndices.length; int [] indices = this.indexVertexAttr[vertexAttrNum]; @@ -1042,7 +1042,7 @@ abstract class IndexedGeometryArrayRetained extends GeometryArrayRetained { //NVaidya /** - * Returns a reference to the coordinate indices associated + * Returns a reference to the coordinate indices associated * with the vertices */ final int[] getCoordIndicesRef() { @@ -1157,7 +1157,7 @@ abstract class IndexedGeometryArrayRetained extends GeometryArrayRetained { } - void execute(Canvas3D cv, RenderAtom ra, boolean isNonUniformScale, + void execute(Canvas3D cv, RenderAtom ra, boolean isNonUniformScale, boolean updateAlpha, float alpha, int screen, boolean ignoreVertexColors) { @@ -1240,7 +1240,7 @@ abstract class IndexedGeometryArrayRetained extends GeometryArrayRetained { retVal = updateAlphaInInterLeavedData(cv, screen, alpha); useAlpha = (retVal[0] == Boolean.TRUE); cdata = (float[])retVal[1]; - if (alpha != lastScreenAlpha) { + if (alpha != lastScreenAlpha) { lastScreenAlpha = alpha; cdirty |= COLOR_CHANGED; } @@ -1283,11 +1283,11 @@ abstract class IndexedGeometryArrayRetained extends GeometryArrayRetained { (vertexType & VATTR_DEFINED) == 0) || (((vertexFormat& GeometryArray.TEXTURE_COORDINATE) != 0) && (vertexType & TEXCOORD_DEFINED) == 0)) { - return; + return; } else { byte[] cbdata = null; float[] cfdata = null; - + if ((vertexType & (CF | C3F | C4F )) != 0) { synchronized (this) { cdirty = dirtyFlag; @@ -1305,7 +1305,7 @@ abstract class IndexedGeometryArrayRetained extends GeometryArrayRetained { lastScreenAlpha = -1; cdirty |= COLOR_CHANGED; } - + } dirtyFlag = 0; } @@ -1332,7 +1332,7 @@ abstract class IndexedGeometryArrayRetained extends GeometryArrayRetained { } else { cdirty = dirtyFlag; } - + int vdefined = 0; if((vertexType & (PF | P3F)) != 0) vdefined |= COORD_FLOAT; @@ -1375,7 +1375,7 @@ abstract class IndexedGeometryArrayRetained extends GeometryArrayRetained { if ((vertexFormat & GeometryArray.INTERLEAVED) != 0) { if( interleavedFloatBufferImpl == null) return; - + float[] cdata = null; synchronized (this) { @@ -1385,7 +1385,7 @@ abstract class IndexedGeometryArrayRetained extends GeometryArrayRetained { retVal = updateAlphaInInterLeavedData(cv, screen, alpha); useAlpha = (retVal[0] == Boolean.TRUE); cdata = (float[])retVal[1]; - if (alpha != lastScreenAlpha) { + if (alpha != lastScreenAlpha) { lastScreenAlpha = alpha; cdirty |= COLOR_CHANGED; } @@ -1398,7 +1398,7 @@ abstract class IndexedGeometryArrayRetained extends GeometryArrayRetained { } dirtyFlag = 0; } - + Pipeline.getPipeline().executeIndexedGeometryBuffer(cv.ctx, this, geoType, isNonUniformScale, useAlpha, @@ -1427,11 +1427,11 @@ abstract class IndexedGeometryArrayRetained extends GeometryArrayRetained { (vertexType & VATTR_DEFINED) == 0) || (((vertexFormat& GeometryArray.TEXTURE_COORDINATE) != 0) && (vertexType & TEXCOORD_DEFINED) == 0)) { - return; + return; } else { byte[] cbdata = null; float[] cfdata = null; - + if ((vertexType & CF ) != 0) { synchronized (this) { cdirty = dirtyFlag; @@ -1451,7 +1451,7 @@ abstract class IndexedGeometryArrayRetained extends GeometryArrayRetained { lastScreenAlpha = -1; cdirty |= COLOR_CHANGED; } - + } dirtyFlag = 0; } @@ -1482,7 +1482,7 @@ abstract class IndexedGeometryArrayRetained extends GeometryArrayRetained { } Object vcoord = null, cdataBuffer=null, normal=null; - + int vdefined = 0; if((vertexType & PF) != 0) { vdefined |= COORD_FLOAT; @@ -1498,7 +1498,7 @@ abstract class IndexedGeometryArrayRetained extends GeometryArrayRetained { vdefined |= COLOR_BYTE; cdataBuffer = byteBufferRefColors.getBufferAsObject(); } - + if((vertexType & NORMAL_DEFINED) != 0) { vdefined |= NORMAL_FLOAT; normal = floatBufferRefNormals.getBufferAsObject(); @@ -1537,7 +1537,7 @@ abstract class IndexedGeometryArrayRetained extends GeometryArrayRetained { } // end of nio buffer } - void buildGA(Canvas3D cv, RenderAtom ra, boolean isNonUniformScale, + void buildGA(Canvas3D cv, RenderAtom ra, boolean isNonUniformScale, boolean updateAlpha, float alpha, boolean ignoreVertexColors, Transform3D xform, Transform3D nxform) { int cdirty; @@ -1548,7 +1548,7 @@ abstract class IndexedGeometryArrayRetained extends GeometryArrayRetained { ignoreVertexColors, xform, nxform); } else { - + if ((vertexFormat & GeometryArray.BY_REFERENCE) == 0) { float[] vdata; // System.err.println("by-copy"); @@ -1603,7 +1603,7 @@ abstract class IndexedGeometryArrayRetained extends GeometryArrayRetained { // go into a display list. } } - + void mergeGeometryArrays(ArrayList list) { int numMerge = list.size(); int[] texCoord = null; @@ -1641,11 +1641,11 @@ abstract class IndexedGeometryArrayRetained extends GeometryArrayRetained { for (int j = 0; j < curIndexCount; j++) { indexCoord[j+curIndexOffset] = geo.indexCoord[j+geo.initialIndexIndex]+curDataOffset; if (notUCIO) { - if ((vertexFormat & GeometryArray.COLOR) != 0) + if ((vertexFormat & GeometryArray.COLOR) != 0) indexColor[j+curIndexOffset] = geo.indexColor[j+geo.initialIndexIndex]+curDataOffset; - if ((vertexFormat & GeometryArray.NORMALS) != 0) + if ((vertexFormat & GeometryArray.NORMALS) != 0) indexNormal[j+curIndexOffset] = geo.indexNormal[j+geo.initialIndexIndex]+curDataOffset; - if ((vertexFormat & GeometryArray.TEXTURE_COORDINATE) != 0) + if ((vertexFormat & GeometryArray.TEXTURE_COORDINATE) != 0) texCoord[j+curIndexOffset] = geo.indexTexCoord[0][j+geo.initialIndexIndex]+curDataOffset; } } @@ -1657,7 +1657,7 @@ abstract class IndexedGeometryArrayRetained extends GeometryArrayRetained { // reset the max Values // call the super to merge the vertex data - super.mergeGeometryArrays(list); + super.mergeGeometryArrays(list); } @@ -1674,7 +1674,7 @@ abstract class IndexedGeometryArrayRetained extends GeometryArrayRetained { return true; } - + /** * Gets current number of indices * @return indexCount @@ -1693,7 +1693,7 @@ abstract class IndexedGeometryArrayRetained extends GeometryArrayRetained { } } return maxIndex; - + } //NVaidya @@ -1709,7 +1709,7 @@ abstract class IndexedGeometryArrayRetained extends GeometryArrayRetained { } } return maxIndex; - + } void setValidIndexCount(int validIndexCount) { @@ -1802,7 +1802,7 @@ abstract class IndexedGeometryArrayRetained extends GeometryArrayRetained { if (!inUpdater && isLive) { sendDataChangedMessage(true); } - + } void setInitialIndexIndex(int initialIndexIndex) { @@ -1820,7 +1820,7 @@ abstract class IndexedGeometryArrayRetained extends GeometryArrayRetained { int newNormalIndex=0; int[] newTexCoordIndex = null; int[] newVertexAttrIndex = null; - + newCoordMax = computeMaxIndex(initialIndexIndex, validIndexCount, indexCoord); doErrorCheck(newCoordMax); if ((vertexFormat & GeometryArray.USE_COORD_INDEX_ONLY) == 0) { @@ -1850,7 +1850,7 @@ abstract class IndexedGeometryArrayRetained extends GeometryArrayRetained { doNormalCheck(newNormalIndex); } } - + boolean isLive = source!=null && source.isLive(); if(isLive){ geomLock.getLock(); @@ -1899,7 +1899,7 @@ abstract class IndexedGeometryArrayRetained extends GeometryArrayRetained { int getInitialIndexIndex() { return initialIndexIndex; } - + int getValidIndexCount() { return validIndexCount; } diff --git a/src/classes/share/javax/media/j3d/IndexedGeometryStripArray.java b/src/classes/share/javax/media/j3d/IndexedGeometryStripArray.java index 41a61f1..e449114 100644 --- a/src/classes/share/javax/media/j3d/IndexedGeometryStripArray.java +++ b/src/classes/share/javax/media/j3d/IndexedGeometryStripArray.java @@ -75,7 +75,7 @@ public abstract class IndexedGeometryStripArray extends IndexedGeometryArray { int vertexFormat, int indexCount, int[] stripIndexCounts) { - + super(vertexCount, vertexFormat, indexCount); ((IndexedGeometryStripArrayRetained)this.retained). setStripIndexCounts(stripIndexCounts); @@ -127,7 +127,7 @@ public abstract class IndexedGeometryStripArray extends IndexedGeometryArray { int[] texCoordSetMap, int indexCount, int[] stripIndexCounts) { - + super(vertexCount, vertexFormat, texCoordSetCount, texCoordSetMap, indexCount); diff --git a/src/classes/share/javax/media/j3d/IndexedGeometryStripArrayRetained.java b/src/classes/share/javax/media/j3d/IndexedGeometryStripArrayRetained.java index 544daf0..8becf30 100644 --- a/src/classes/share/javax/media/j3d/IndexedGeometryStripArrayRetained.java +++ b/src/classes/share/javax/media/j3d/IndexedGeometryStripArrayRetained.java @@ -71,16 +71,16 @@ abstract class IndexedGeometryStripArrayRetained extends IndexedGeometryArrayRet } } } - - // Sum of all stripIndexCounts MUST be same as indexCount - if ((initialIndexIndex + total) > indexCount) + + // Sum of all stripIndexCounts MUST be same as indexCount + if ((initialIndexIndex + total) > indexCount) throw new IllegalArgumentException(J3dI18N.getString("IndexedGeometryStripArrayRetained0")); int newCoordMax =0; int newColorIndex=0; int newNormalIndex=0; int[] newTexCoordIndex = null; int[] newVertexAttrIndex = null; - + newCoordMax = computeMaxIndex(initialIndexIndex, total, indexCoord); doErrorCheck(newCoordMax); if ((vertexFormat & GeometryArray.USE_COORD_INDEX_ONLY) == 0) { @@ -211,12 +211,12 @@ abstract class IndexedGeometryStripArrayRetained extends IndexedGeometryArrayRet int numMerge = list.size(); int numCount = 0; int i, j; - + for (i = 0; i < numMerge; i++) { IndexedGeometryStripArrayRetained geo = (IndexedGeometryStripArrayRetained) list.get(i); numCount += geo.stripIndexCounts.length; } - + stripIndexCounts = new int[numCount]; compileIndexLength = new int[numCount]; compileStripICOffset = new int[numMerge]; @@ -247,5 +247,5 @@ abstract class IndexedGeometryStripArrayRetained extends IndexedGeometryArrayRet stripIndexCounts[i] = this.stripIndexCounts[coffset+1]; } } - + } diff --git a/src/classes/share/javax/media/j3d/IndexedLineArray.java b/src/classes/share/javax/media/j3d/IndexedLineArray.java index 10860cb..f994079 100644 --- a/src/classes/share/javax/media/j3d/IndexedLineArray.java +++ b/src/classes/share/javax/media/j3d/IndexedLineArray.java @@ -69,8 +69,8 @@ public class IndexedLineArray extends IndexedGeometryArray { public IndexedLineArray(int vertexCount, int vertexFormat, int indexCount) { super(vertexCount,vertexFormat, indexCount); - if (vertexCount < 1) - throw new IllegalArgumentException(J3dI18N.getString("IndexedLineArray0")); + if (vertexCount < 1) + throw new IllegalArgumentException(J3dI18N.getString("IndexedLineArray0")); if (indexCount < 2 || ((indexCount%2) != 0)) throw new IllegalArgumentException(J3dI18N.getString("IndexedLineArray1")); @@ -119,8 +119,8 @@ public class IndexedLineArray extends IndexedGeometryArray { texCoordSetCount, texCoordSetMap, indexCount); - if (vertexCount < 1) - throw new IllegalArgumentException(J3dI18N.getString("IndexedLineArray0")); + if (vertexCount < 1) + throw new IllegalArgumentException(J3dI18N.getString("IndexedLineArray0")); if (indexCount < 2 || ((indexCount%2) != 0)) throw new IllegalArgumentException(J3dI18N.getString("IndexedLineArray1")); @@ -176,8 +176,8 @@ public class IndexedLineArray extends IndexedGeometryArray { vertexAttrCount, vertexAttrSizes, indexCount); - if (vertexCount < 1) - throw new IllegalArgumentException(J3dI18N.getString("IndexedLineArray0")); + if (vertexCount < 1) + throw new IllegalArgumentException(J3dI18N.getString("IndexedLineArray0")); if (indexCount < 2 || ((indexCount%2) != 0)) throw new IllegalArgumentException(J3dI18N.getString("IndexedLineArray1")); diff --git a/src/classes/share/javax/media/j3d/IndexedLineArrayRetained.java b/src/classes/share/javax/media/j3d/IndexedLineArrayRetained.java index 4a7408f..8bc049d 100644 --- a/src/classes/share/javax/media/j3d/IndexedLineArrayRetained.java +++ b/src/classes/share/javax/media/j3d/IndexedLineArrayRetained.java @@ -44,7 +44,7 @@ class IndexedLineArrayRetained extends IndexedGeometryArrayRetained { IndexedLineArrayRetained() { this.geoType = GEO_TYPE_INDEXED_LINE_SET; } - + boolean intersect(PickShape pickShape, PickInfo pickInfo, int flags, Point3d iPnt, GeometryRetained geom, int geomIndex) { Point3d pnts[] = new Point3d[2]; @@ -60,11 +60,11 @@ class IndexedLineArrayRetained extends IndexedGeometryArrayRetained { pnts[0] = new Point3d(); pnts[1] = new Point3d(); int[] vtxIndexArr = new int[2]; - + switch (pickShape.getPickType()) { case PickShape.PICKRAY: PickRay pickRay= (PickRay) pickShape; - + while (i < loopStopIndex) { for(int k=0; k<2; k++) { vtxIndexArr[k] = indexCoord[i]; @@ -99,7 +99,7 @@ class IndexedLineArrayRetained extends IndexedGeometryArrayRetained { new Vector3d(pickSegment.end.x - pickSegment.start.x, pickSegment.end.y - pickSegment.start.y, pickSegment.end.z - pickSegment.start.z); - + while (i < loopStopIndex) { for(int k=0; k<2; k++) { vtxIndexArr[k] = indexCoord[i]; @@ -132,7 +132,7 @@ class IndexedLineArrayRetained extends IndexedGeometryArrayRetained { case PickShape.PICKBOUNDINGBOX: BoundingBox bbox = (BoundingBox) ((PickBounds) pickShape).bounds; - + while (i < loopStopIndex) { for(int k=0; k<2; k++) { vtxIndexArr[k] = indexCoord[i]; @@ -162,7 +162,7 @@ class IndexedLineArrayRetained extends IndexedGeometryArrayRetained { case PickShape.PICKBOUNDINGSPHERE: BoundingSphere bsphere = (BoundingSphere) ((PickBounds) pickShape).bounds; - + while (i < loopStopIndex) { for(int k=0; k<2; k++) { vtxIndexArr[k] = indexCoord[i]; @@ -192,7 +192,7 @@ class IndexedLineArrayRetained extends IndexedGeometryArrayRetained { case PickShape.PICKBOUNDINGPOLYTOPE: BoundingPolytope bpolytope = (BoundingPolytope) ((PickBounds) pickShape).bounds; - + while (i < loopStopIndex) { for(int k=0; k<2; k++) { vtxIndexArr[k] = indexCoord[i]; @@ -221,7 +221,7 @@ class IndexedLineArrayRetained extends IndexedGeometryArrayRetained { break; case PickShape.PICKCYLINDER: PickCylinder pickCylinder= (PickCylinder) pickShape; - + while (i < loopStopIndex) { for(int k=0; k<2; k++) { vtxIndexArr[k] = indexCoord[i]; @@ -250,7 +250,7 @@ class IndexedLineArrayRetained extends IndexedGeometryArrayRetained { break; case PickShape.PICKCONE: PickCone pickCone= (PickCone) pickShape; - + while (i < loopStopIndex) { for(int k=0; k<2; k++) { vtxIndexArr[k] = indexCoord[i]; @@ -283,7 +283,7 @@ class IndexedLineArrayRetained extends IndexedGeometryArrayRetained { default: throw new RuntimeException("PickShape not supported for intersection"); } - + if (minDist < Double.MAX_VALUE) { iPnt.x = x; iPnt.y = y; @@ -291,9 +291,9 @@ class IndexedLineArrayRetained extends IndexedGeometryArrayRetained { return true; } return false; - + } - + boolean intersect(Point3d[] pnts) { Point3d[] points = new Point3d[2]; Vector3d dir; @@ -304,7 +304,7 @@ class IndexedLineArrayRetained extends IndexedGeometryArrayRetained { int loopStopIndex = initialIndexIndex + validIndexCount; points[0] = new Point3d(); points[1] = new Point3d(); - + switch (pnts.length) { case 3: // Triangle/Quad , common case first case 4: @@ -349,11 +349,11 @@ class IndexedLineArrayRetained extends IndexedGeometryArrayRetained { } return false; } - - + + boolean intersect(Transform3D thisToOtherVworld, GeometryRetained geom) { - + Point3d[] pnts = new Point3d[2]; //NVaidya // Bug 447: correction for loop indices @@ -361,7 +361,7 @@ class IndexedLineArrayRetained extends IndexedGeometryArrayRetained { int loopStopIndex = initialIndexIndex + validIndexCount; pnts[0] = new Point3d(); pnts[1] = new Point3d(); - + while (i < loopStopIndex) { getVertexData(indexCoord[i++], pnts[0]); getVertexData(indexCoord[i++], pnts[1]); @@ -373,7 +373,7 @@ class IndexedLineArrayRetained extends IndexedGeometryArrayRetained { } return false; } - + // the bounds argument is already transformed boolean intersect(Bounds targetBound) { Point3d[] pnts = new Point3d[2]; @@ -383,11 +383,11 @@ class IndexedLineArrayRetained extends IndexedGeometryArrayRetained { int loopStopIndex = initialIndexIndex + validIndexCount; pnts[0] = new Point3d(); pnts[1] = new Point3d(); - + switch(targetBound.getPickType()) { case PickShape.PICKBOUNDINGBOX: BoundingBox box = (BoundingBox) targetBound; - + while(i < loopStopIndex) { getVertexData(indexCoord[i++], pnts[0]); getVertexData(indexCoord[i++], pnts[1]); @@ -398,7 +398,7 @@ class IndexedLineArrayRetained extends IndexedGeometryArrayRetained { break; case PickShape.PICKBOUNDINGSPHERE: BoundingSphere bsphere = (BoundingSphere) targetBound; - + while(i < loopStopIndex) { getVertexData(indexCoord[i++], pnts[0]); getVertexData(indexCoord[i++], pnts[1]); @@ -409,7 +409,7 @@ class IndexedLineArrayRetained extends IndexedGeometryArrayRetained { break; case PickShape.PICKBOUNDINGPOLYTOPE: BoundingPolytope bpolytope = (BoundingPolytope) targetBound; - + while(i < loopStopIndex) { getVertexData(indexCoord[i++], pnts[0]); getVertexData(indexCoord[i++], pnts[1]); @@ -425,7 +425,7 @@ class IndexedLineArrayRetained extends IndexedGeometryArrayRetained { return false; } - int getClassType() { - return LINE_TYPE; + int getClassType() { + return LINE_TYPE; } } diff --git a/src/classes/share/javax/media/j3d/IndexedLineStripArray.java b/src/classes/share/javax/media/j3d/IndexedLineStripArray.java index 3b9f46a..bddaff6 100644 --- a/src/classes/share/javax/media/j3d/IndexedLineStripArray.java +++ b/src/classes/share/javax/media/j3d/IndexedLineStripArray.java @@ -82,8 +82,8 @@ public class IndexedLineStripArray extends IndexedGeometryStripArray { super(vertexCount, vertexFormat, indexCount, stripIndexCounts); - if (vertexCount < 1) - throw new IllegalArgumentException(J3dI18N.getString("IndexedLineStripArray0")); + if (vertexCount < 1) + throw new IllegalArgumentException(J3dI18N.getString("IndexedLineStripArray0")); if (indexCount < 2 ) throw new IllegalArgumentException(J3dI18N.getString("IndexedLineStripArray1")); @@ -137,8 +137,8 @@ public class IndexedLineStripArray extends IndexedGeometryStripArray { texCoordSetCount, texCoordSetMap, indexCount, stripIndexCounts); - if (vertexCount < 1) - throw new IllegalArgumentException(J3dI18N.getString("IndexedLineStripArray0")); + if (vertexCount < 1) + throw new IllegalArgumentException(J3dI18N.getString("IndexedLineStripArray0")); if (indexCount < 2 ) throw new IllegalArgumentException(J3dI18N.getString("IndexedLineStripArray1")); @@ -199,8 +199,8 @@ public class IndexedLineStripArray extends IndexedGeometryStripArray { vertexAttrCount, vertexAttrSizes, indexCount, stripIndexCounts); - if (vertexCount < 1) - throw new IllegalArgumentException(J3dI18N.getString("IndexedLineStripArray0")); + if (vertexCount < 1) + throw new IllegalArgumentException(J3dI18N.getString("IndexedLineStripArray0")); if (indexCount < 2 ) throw new IllegalArgumentException(J3dI18N.getString("IndexedLineStripArray1")); diff --git a/src/classes/share/javax/media/j3d/IndexedLineStripArrayRetained.java b/src/classes/share/javax/media/j3d/IndexedLineStripArrayRetained.java index a6f132f..5280c01 100644 --- a/src/classes/share/javax/media/j3d/IndexedLineStripArrayRetained.java +++ b/src/classes/share/javax/media/j3d/IndexedLineStripArrayRetained.java @@ -43,7 +43,7 @@ import java.lang.Math; */ class IndexedLineStripArrayRetained extends IndexedGeometryStripArrayRetained { - + IndexedLineStripArrayRetained() { geoType = GEO_TYPE_INDEXED_LINE_STRIP_SET; } @@ -57,10 +57,10 @@ class IndexedLineStripArrayRetained extends IndexedGeometryStripArrayRetained { int scount, j, i = 0; int count = 0; int[] vtxIndexArr = new int[2]; - + pnts[0] = new Point3d(); pnts[1] = new Point3d(); - + switch (pickShape.getPickType()) { case PickShape.PICKRAY: PickRay pickRay= (PickRay) pickShape; @@ -84,13 +84,13 @@ class IndexedLineStripArrayRetained extends IndexedGeometryStripArrayRetained { y = iPnt.y; z = iPnt.z; if((flags & PickInfo.CLOSEST_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, + storeInterestData(pickInfo, flags, geom, geomIndex, vtxIndexArr, iPnt, sdist[0]); } } if((flags & PickInfo.ALL_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, - vtxIndexArr, iPnt, sdist[0]); + storeInterestData(pickInfo, flags, geom, geomIndex, + vtxIndexArr, iPnt, sdist[0]); } } pnts[0].set(pnts[1]); @@ -100,20 +100,20 @@ class IndexedLineStripArrayRetained extends IndexedGeometryStripArrayRetained { break; case PickShape.PICKSEGMENT: PickSegment pickSegment = (PickSegment) pickShape; - Vector3d dir = - new Vector3d(pickSegment.end.x - pickSegment.start.x, + Vector3d dir = + new Vector3d(pickSegment.end.x - pickSegment.start.x, pickSegment.end.y - pickSegment.start.y, pickSegment.end.z - pickSegment.start.z); - - while (i < stripIndexCounts.length) { + + while (i < stripIndexCounts.length) { vtxIndexArr[0] = indexCoord[count]; getVertexData(indexCoord[count++], pnts[0]); scount = stripIndexCounts[i++]; - for (j=1; j < scount; j++) { + for (j=1; j < scount; j++) { vtxIndexArr[1] = indexCoord[count]; getVertexData(indexCoord[count++], pnts[1]); if (intersectLineAndRay(pnts[0], pnts[1], - pickSegment.start, + pickSegment.start, dir, sdist, iPnt) && (sdist[0] <= 1.0)) { if (flags == 0) { @@ -125,13 +125,13 @@ class IndexedLineStripArrayRetained extends IndexedGeometryStripArrayRetained { y = iPnt.y; z = iPnt.z; if((flags & PickInfo.CLOSEST_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, + storeInterestData(pickInfo, flags, geom, geomIndex, vtxIndexArr, iPnt, sdist[0]); } } if((flags & PickInfo.ALL_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, - vtxIndexArr, iPnt, sdist[0]); + storeInterestData(pickInfo, flags, geom, geomIndex, + vtxIndexArr, iPnt, sdist[0]); } } pnts[0].set(pnts[1]); @@ -140,14 +140,14 @@ class IndexedLineStripArrayRetained extends IndexedGeometryStripArrayRetained { } break; case PickShape.PICKBOUNDINGBOX: - BoundingBox bbox = (BoundingBox) + BoundingBox bbox = (BoundingBox) ((PickBounds) pickShape).bounds; - while (i < stripIndexCounts.length) { + while (i < stripIndexCounts.length) { vtxIndexArr[0] = indexCoord[count]; getVertexData(indexCoord[count++], pnts[0]); scount = stripIndexCounts[i++]; - for (j=1; j < scount; j++) { + for (j=1; j < scount; j++) { vtxIndexArr[1] = indexCoord[count]; getVertexData(indexCoord[count++], pnts[1]); if (intersectBoundingBox(pnts, bbox, sdist, iPnt)) { @@ -160,13 +160,13 @@ class IndexedLineStripArrayRetained extends IndexedGeometryStripArrayRetained { y = iPnt.y; z = iPnt.z; if((flags & PickInfo.CLOSEST_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, + storeInterestData(pickInfo, flags, geom, geomIndex, vtxIndexArr, iPnt, sdist[0]); } } if((flags & PickInfo.ALL_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, - vtxIndexArr, iPnt, sdist[0]); + storeInterestData(pickInfo, flags, geom, geomIndex, + vtxIndexArr, iPnt, sdist[0]); } } pnts[0].set(pnts[1]); @@ -175,10 +175,10 @@ class IndexedLineStripArrayRetained extends IndexedGeometryStripArrayRetained { } break; case PickShape.PICKBOUNDINGSPHERE: - BoundingSphere bsphere = (BoundingSphere) + BoundingSphere bsphere = (BoundingSphere) ((PickBounds) pickShape).bounds; - while (i < stripIndexCounts.length) { + while (i < stripIndexCounts.length) { vtxIndexArr[0] = indexCoord[count]; getVertexData(indexCoord[count++], pnts[0]); scount = stripIndexCounts[i++]; @@ -195,13 +195,13 @@ class IndexedLineStripArrayRetained extends IndexedGeometryStripArrayRetained { y = iPnt.y; z = iPnt.z; if((flags & PickInfo.CLOSEST_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, + storeInterestData(pickInfo, flags, geom, geomIndex, vtxIndexArr, iPnt, sdist[0]); } } if((flags & PickInfo.ALL_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, - vtxIndexArr, iPnt, sdist[0]); + storeInterestData(pickInfo, flags, geom, geomIndex, + vtxIndexArr, iPnt, sdist[0]); } } pnts[0].set(pnts[1]); @@ -210,10 +210,10 @@ class IndexedLineStripArrayRetained extends IndexedGeometryStripArrayRetained { } break; case PickShape.PICKBOUNDINGPOLYTOPE: - BoundingPolytope bpolytope = (BoundingPolytope) + BoundingPolytope bpolytope = (BoundingPolytope) ((PickBounds) pickShape).bounds; - while (i < stripIndexCounts.length) { + while (i < stripIndexCounts.length) { vtxIndexArr[0] = indexCoord[count]; getVertexData(indexCoord[count++], pnts[0]); scount = stripIndexCounts[i++]; @@ -230,13 +230,13 @@ class IndexedLineStripArrayRetained extends IndexedGeometryStripArrayRetained { y = iPnt.y; z = iPnt.z; if((flags & PickInfo.CLOSEST_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, + storeInterestData(pickInfo, flags, geom, geomIndex, vtxIndexArr, iPnt, sdist[0]); } } if((flags & PickInfo.ALL_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, - vtxIndexArr, iPnt, sdist[0]); + storeInterestData(pickInfo, flags, geom, geomIndex, + vtxIndexArr, iPnt, sdist[0]); } } pnts[0].set(pnts[1]); @@ -247,7 +247,7 @@ class IndexedLineStripArrayRetained extends IndexedGeometryStripArrayRetained { case PickShape.PICKCYLINDER: PickCylinder pickCylinder= (PickCylinder) pickShape; - while (i < stripIndexCounts.length) { + while (i < stripIndexCounts.length) { vtxIndexArr[0] = indexCoord[count]; getVertexData(indexCoord[count++], pnts[0]); scount = stripIndexCounts[i++]; @@ -264,13 +264,13 @@ class IndexedLineStripArrayRetained extends IndexedGeometryStripArrayRetained { y = iPnt.y; z = iPnt.z; if((flags & PickInfo.CLOSEST_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, + storeInterestData(pickInfo, flags, geom, geomIndex, vtxIndexArr, iPnt, sdist[0]); } } if((flags & PickInfo.ALL_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, - vtxIndexArr, iPnt, sdist[0]); + storeInterestData(pickInfo, flags, geom, geomIndex, + vtxIndexArr, iPnt, sdist[0]); } } pnts[0].set(pnts[1]); @@ -281,7 +281,7 @@ class IndexedLineStripArrayRetained extends IndexedGeometryStripArrayRetained { case PickShape.PICKCONE: PickCone pickCone= (PickCone) pickShape; - while (i < stripIndexCounts.length) { + while (i < stripIndexCounts.length) { vtxIndexArr[0] = indexCoord[count]; getVertexData(indexCoord[count++], pnts[0]); scount = stripIndexCounts[i++]; @@ -298,13 +298,13 @@ class IndexedLineStripArrayRetained extends IndexedGeometryStripArrayRetained { y = iPnt.y; z = iPnt.z; if((flags & PickInfo.CLOSEST_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, + storeInterestData(pickInfo, flags, geom, geomIndex, vtxIndexArr, iPnt, sdist[0]); } } if((flags & PickInfo.ALL_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, - vtxIndexArr, iPnt, sdist[0]); + storeInterestData(pickInfo, flags, geom, geomIndex, + vtxIndexArr, iPnt, sdist[0]); } } pnts[0].set(pnts[1]); @@ -316,8 +316,8 @@ class IndexedLineStripArrayRetained extends IndexedGeometryStripArrayRetained { // Should not happen since API already check for this throw new IllegalArgumentException(J3dI18N.getString("IndexedLineStripArrayRetained0")); default: - throw new RuntimeException ("PickShape not supported for intersection"); - } + throw new RuntimeException ("PickShape not supported for intersection"); + } if (minDist < Double.MAX_VALUE) { iPnt.x = x; @@ -327,7 +327,7 @@ class IndexedLineStripArrayRetained extends IndexedGeometryStripArrayRetained { } return false; } - + // intersect pnts[] with every triangle in this object boolean intersect(Point3d[] pnts) { int i = 0; @@ -336,10 +336,10 @@ class IndexedLineStripArrayRetained extends IndexedGeometryStripArrayRetained { Point3d[] points = new Point3d[2]; double dist[] = new double[1]; Vector3d dir; - + points[0] = new Point3d(); points[1] = new Point3d(); - + switch (pnts.length) { case 3: case 4: // Triangle, Quad @@ -395,10 +395,10 @@ class IndexedLineStripArrayRetained extends IndexedGeometryStripArrayRetained { } break; } - + return false; } - + boolean intersect(Transform3D thisToOtherVworld, GeometryRetained geom) { int i = 0; @@ -483,12 +483,12 @@ class IndexedLineStripArrayRetained extends IndexedGeometryStripArrayRetained { break; default: throw new RuntimeException("Bounds not supported for intersection " - + targetBound); + + targetBound); } return false; } - int getClassType() { - return LINE_TYPE; + int getClassType() { + return LINE_TYPE; } } diff --git a/src/classes/share/javax/media/j3d/IndexedObject.java b/src/classes/share/javax/media/j3d/IndexedObject.java index d08fbf0..66e444d 100644 --- a/src/classes/share/javax/media/j3d/IndexedObject.java +++ b/src/classes/share/javax/media/j3d/IndexedObject.java @@ -52,7 +52,7 @@ abstract class IndexedObject extends Object { int[][] listIdx; abstract VirtualUniverse getVirtualUniverse(); - + synchronized int getIdxUsed(VirtualUniverse u) { int idx = listIdx[2][0]; if (u == getVirtualUniverse()) { @@ -63,10 +63,10 @@ abstract class IndexedObject extends Object { void incIdxUsed() { if (listIdx[2][0] == 0) { - listIdx[2][0] = 1; + listIdx[2][0] = 1; } else { - listIdx[2][0] = 0; - } + listIdx[2][0] = 0; + } } } diff --git a/src/classes/share/javax/media/j3d/IndexedPointArray.java b/src/classes/share/javax/media/j3d/IndexedPointArray.java index c4c9e1b..3b9423f 100644 --- a/src/classes/share/javax/media/j3d/IndexedPointArray.java +++ b/src/classes/share/javax/media/j3d/IndexedPointArray.java @@ -69,8 +69,8 @@ public class IndexedPointArray extends IndexedGeometryArray { public IndexedPointArray(int vertexCount, int vertexFormat, int indexCount) { super(vertexCount,vertexFormat, indexCount); - if (vertexCount < 1) - throw new IllegalArgumentException(J3dI18N.getString("IndexedPointArray0")); + if (vertexCount < 1) + throw new IllegalArgumentException(J3dI18N.getString("IndexedPointArray0")); if (indexCount < 1 ) throw new IllegalArgumentException(J3dI18N.getString("IndexedPointArray1")); @@ -118,8 +118,8 @@ public class IndexedPointArray extends IndexedGeometryArray { texCoordSetCount, texCoordSetMap, indexCount); - if (vertexCount < 1) - throw new IllegalArgumentException(J3dI18N.getString("IndexedPointArray0")); + if (vertexCount < 1) + throw new IllegalArgumentException(J3dI18N.getString("IndexedPointArray0")); if (indexCount < 1 ) throw new IllegalArgumentException(J3dI18N.getString("IndexedPointArray1")); @@ -174,8 +174,8 @@ public class IndexedPointArray extends IndexedGeometryArray { vertexAttrCount, vertexAttrSizes, indexCount); - if (vertexCount < 1) - throw new IllegalArgumentException(J3dI18N.getString("IndexedPointArray0")); + if (vertexCount < 1) + throw new IllegalArgumentException(J3dI18N.getString("IndexedPointArray0")); if (indexCount < 1 ) throw new IllegalArgumentException(J3dI18N.getString("IndexedPointArray1")); diff --git a/src/classes/share/javax/media/j3d/IndexedPointArrayRetained.java b/src/classes/share/javax/media/j3d/IndexedPointArrayRetained.java index b60a8c1..befe726 100644 --- a/src/classes/share/javax/media/j3d/IndexedPointArrayRetained.java +++ b/src/classes/share/javax/media/j3d/IndexedPointArrayRetained.java @@ -42,7 +42,7 @@ class IndexedPointArrayRetained extends IndexedGeometryArrayRetained { IndexedPointArrayRetained() { this.geoType = GEO_TYPE_INDEXED_POINT_SET; - } + } boolean intersect(PickShape pickShape, PickInfo pickInfo, int flags, Point3d iPnt, GeometryRetained geom, int geomIndex) { @@ -54,7 +54,7 @@ class IndexedPointArrayRetained extends IndexedGeometryArrayRetained { int i = ((vertexFormat & GeometryArray.BY_REFERENCE) == 0 ? initialVertexIndex : initialCoordIndex); - + switch (pickShape.getPickType()) { case PickShape.PICKRAY: PickRay pickRay= (PickRay) pickShape; @@ -73,28 +73,28 @@ class IndexedPointArrayRetained extends IndexedGeometryArrayRetained { y = pnt.y; z = pnt.z; if((flags & PickInfo.CLOSEST_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, + storeInterestData(pickInfo, flags, geom, geomIndex, vtxIndexArr, iPnt, sdist[0]); } } if((flags & PickInfo.ALL_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, - vtxIndexArr, iPnt, sdist[0]); + storeInterestData(pickInfo, flags, geom, geomIndex, + vtxIndexArr, iPnt, sdist[0]); } } } break; case PickShape.PICKSEGMENT: PickSegment pickSegment = (PickSegment) pickShape; - Vector3d dir = - new Vector3d(pickSegment.end.x - pickSegment.start.x, + Vector3d dir = + new Vector3d(pickSegment.end.x - pickSegment.start.x, pickSegment.end.y - pickSegment.start.y, pickSegment.end.z - pickSegment.start.z); - + while (i < validVertexCount) { vtxIndexArr[0] = indexCoord[i]; getVertexData(indexCoord[i++], pnt); - if (intersectPntAndRay(pnt, pickSegment.start, + if (intersectPntAndRay(pnt, pickSegment.start, dir, sdist) && (sdist[0] <= 1.0)) { if (flags == 0) { @@ -106,13 +106,13 @@ class IndexedPointArrayRetained extends IndexedGeometryArrayRetained { y = pnt.y; z = pnt.z; if((flags & PickInfo.CLOSEST_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, + storeInterestData(pickInfo, flags, geom, geomIndex, vtxIndexArr, iPnt, sdist[0]); } } if((flags & PickInfo.ALL_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, - vtxIndexArr, iPnt, sdist[0]); + storeInterestData(pickInfo, flags, geom, geomIndex, + vtxIndexArr, iPnt, sdist[0]); } } } @@ -136,13 +136,13 @@ class IndexedPointArrayRetained extends IndexedGeometryArrayRetained { y = pnt.y; z = pnt.z; if((flags & PickInfo.CLOSEST_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, + storeInterestData(pickInfo, flags, geom, geomIndex, vtxIndexArr, iPnt, sdist[0]); } } if((flags & PickInfo.ALL_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, - vtxIndexArr, iPnt, sdist[0]); + storeInterestData(pickInfo, flags, geom, geomIndex, + vtxIndexArr, iPnt, sdist[0]); } } } @@ -163,13 +163,13 @@ class IndexedPointArrayRetained extends IndexedGeometryArrayRetained { y = pnt.y; z = pnt.z; if((flags & PickInfo.CLOSEST_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, + storeInterestData(pickInfo, flags, geom, geomIndex, vtxIndexArr, iPnt, sdist[0]); } } if((flags & PickInfo.ALL_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, - vtxIndexArr, iPnt, sdist[0]); + storeInterestData(pickInfo, flags, geom, geomIndex, + vtxIndexArr, iPnt, sdist[0]); } } } @@ -190,13 +190,13 @@ class IndexedPointArrayRetained extends IndexedGeometryArrayRetained { y = pnt.y; z = pnt.z; if((flags & PickInfo.CLOSEST_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, + storeInterestData(pickInfo, flags, geom, geomIndex, vtxIndexArr, iPnt, sdist[0]); } } if((flags & PickInfo.ALL_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, - vtxIndexArr, iPnt, sdist[0]); + storeInterestData(pickInfo, flags, geom, geomIndex, + vtxIndexArr, iPnt, sdist[0]); } } } @@ -205,8 +205,8 @@ class IndexedPointArrayRetained extends IndexedGeometryArrayRetained { // Should not happen since API already check for this throw new IllegalArgumentException(J3dI18N.getString("IndexedPointArrayRetained0")); default: - throw new RuntimeException ("PickShape not supported for intersection"); - } + throw new RuntimeException ("PickShape not supported for intersection"); + } if (minDist < Double.MAX_VALUE) { iPnt.x = x; @@ -221,12 +221,12 @@ class IndexedPointArrayRetained extends IndexedGeometryArrayRetained { Point3d point = new Point3d(); int i = ((vertexFormat & GeometryArray.BY_REFERENCE) == 0 ? initialVertexIndex : initialCoordIndex); - + switch (pnts.length) { case 3: // Triangle while (i < validVertexCount) { getVertexData(indexCoord[i++], point); - if (intersectTriPnt(pnts[0], pnts[1], pnts[2], point)) { + if (intersectTriPnt(pnts[0], pnts[1], pnts[2], point)) { return true; } } @@ -234,8 +234,8 @@ class IndexedPointArrayRetained extends IndexedGeometryArrayRetained { case 4: // Quad while (i < validVertexCount) { getVertexData(indexCoord[i++], point); - if (intersectTriPnt(pnts[0], pnts[1], pnts[2], point) || - intersectTriPnt(pnts[0], pnts[2], pnts[3], point)) { + if (intersectTriPnt(pnts[0], pnts[1], pnts[2], point) || + intersectTriPnt(pnts[0], pnts[2], pnts[3], point)) { return true; } } @@ -258,8 +258,8 @@ class IndexedPointArrayRetained extends IndexedGeometryArrayRetained { case 1: // Point while (i < validVertexCount) { getVertexData(indexCoord[i++], point); - if ((pnts[0].x == point.x) && - (pnts[0].y == point.y) && + if ((pnts[0].x == point.x) && + (pnts[0].y == point.y) && (pnts[0].z == point.z)) { return true; } @@ -284,7 +284,7 @@ class IndexedPointArrayRetained extends IndexedGeometryArrayRetained { } } return false; - + } // the bounds argument is already transformed @@ -292,7 +292,7 @@ class IndexedPointArrayRetained extends IndexedGeometryArrayRetained { int i = ((vertexFormat & GeometryArray.BY_REFERENCE) == 0 ? initialVertexIndex : initialCoordIndex); Point3d pnt = new Point3d(); - + while (i < validVertexCount) { getVertexData(indexCoord[i++], pnt); if (targetBound.intersect(pnt)) { @@ -300,10 +300,10 @@ class IndexedPointArrayRetained extends IndexedGeometryArrayRetained { } } return false; - } + } - int getClassType() { - return POINT_TYPE; + int getClassType() { + return POINT_TYPE; } } diff --git a/src/classes/share/javax/media/j3d/IndexedQuadArray.java b/src/classes/share/javax/media/j3d/IndexedQuadArray.java index 7447f05..d524ae4 100644 --- a/src/classes/share/javax/media/j3d/IndexedQuadArray.java +++ b/src/classes/share/javax/media/j3d/IndexedQuadArray.java @@ -71,8 +71,8 @@ public class IndexedQuadArray extends IndexedGeometryArray { public IndexedQuadArray(int vertexCount, int vertexFormat, int indexCount) { super(vertexCount,vertexFormat, indexCount); - if (vertexCount < 1) - throw new IllegalArgumentException(J3dI18N.getString("IndexedQuadArray0")); + if (vertexCount < 1) + throw new IllegalArgumentException(J3dI18N.getString("IndexedQuadArray0")); if (indexCount < 4 || ((indexCount%4) != 0)) throw new IllegalArgumentException(J3dI18N.getString("IndexedQuadArray1")); @@ -121,8 +121,8 @@ public class IndexedQuadArray extends IndexedGeometryArray { texCoordSetCount, texCoordSetMap, indexCount); - if (vertexCount < 1) - throw new IllegalArgumentException(J3dI18N.getString("IndexedQuadArray0")); + if (vertexCount < 1) + throw new IllegalArgumentException(J3dI18N.getString("IndexedQuadArray0")); if (indexCount < 4 || ((indexCount%4) != 0)) throw new IllegalArgumentException(J3dI18N.getString("IndexedQuadArray1")); @@ -178,8 +178,8 @@ public class IndexedQuadArray extends IndexedGeometryArray { vertexAttrCount, vertexAttrSizes, indexCount); - if (vertexCount < 1) - throw new IllegalArgumentException(J3dI18N.getString("IndexedQuadArray0")); + if (vertexCount < 1) + throw new IllegalArgumentException(J3dI18N.getString("IndexedQuadArray0")); if (indexCount < 4 || ((indexCount%4) != 0)) throw new IllegalArgumentException(J3dI18N.getString("IndexedQuadArray1")); @@ -194,7 +194,7 @@ public class IndexedQuadArray extends IndexedGeometryArray { this.retained.setSource(this); } - + /** * @deprecated replaced with cloneNodeComponent(boolean forceDuplicate) */ diff --git a/src/classes/share/javax/media/j3d/IndexedQuadArrayRetained.java b/src/classes/share/javax/media/j3d/IndexedQuadArrayRetained.java index a9ab1a7..30e29bd 100644 --- a/src/classes/share/javax/media/j3d/IndexedQuadArrayRetained.java +++ b/src/classes/share/javax/media/j3d/IndexedQuadArrayRetained.java @@ -41,7 +41,7 @@ import java.lang.Math; */ class IndexedQuadArrayRetained extends IndexedGeometryArrayRetained { - + IndexedQuadArrayRetained() { this.geoType = GEO_TYPE_INDEXED_QUAD_SET; } @@ -53,7 +53,7 @@ class IndexedQuadArrayRetained extends IndexedGeometryArrayRetained { double minDist = Double.MAX_VALUE; double x = 0, y = 0, z = 0; int[] vtxIndexArr = new int[4]; - + //NVaidya // Bug 447: While loops below now traverse over all // elements in the valid index range from initialIndexIndex @@ -64,7 +64,7 @@ class IndexedQuadArrayRetained extends IndexedGeometryArrayRetained { pnts[1] = new Point3d(); pnts[2] = new Point3d(); pnts[3] = new Point3d(); - + switch (pickShape.getPickType()) { case PickShape.PICKRAY: PickRay pickRay= (PickRay) pickShape; @@ -84,13 +84,13 @@ class IndexedQuadArrayRetained extends IndexedGeometryArrayRetained { y = iPnt.y; z = iPnt.z; if((flags & PickInfo.CLOSEST_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, + storeInterestData(pickInfo, flags, geom, geomIndex, vtxIndexArr, iPnt, sdist[0]); } } if((flags & PickInfo.ALL_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, - vtxIndexArr, iPnt, sdist[0]); + storeInterestData(pickInfo, flags, geom, geomIndex, + vtxIndexArr, iPnt, sdist[0]); } } } @@ -114,19 +114,19 @@ class IndexedQuadArrayRetained extends IndexedGeometryArrayRetained { y = iPnt.y; z = iPnt.z; if((flags & PickInfo.CLOSEST_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, + storeInterestData(pickInfo, flags, geom, geomIndex, vtxIndexArr, iPnt, sdist[0]); } } if((flags & PickInfo.ALL_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, - vtxIndexArr, iPnt, sdist[0]); + storeInterestData(pickInfo, flags, geom, geomIndex, + vtxIndexArr, iPnt, sdist[0]); } } } break; case PickShape.PICKBOUNDINGBOX: - BoundingBox bbox = (BoundingBox) + BoundingBox bbox = (BoundingBox) ((PickBounds) pickShape).bounds; while (i < loopStopIndex) { for(int j=0; j<4; j++) { @@ -143,19 +143,19 @@ class IndexedQuadArrayRetained extends IndexedGeometryArrayRetained { y = iPnt.y; z = iPnt.z; if((flags & PickInfo.CLOSEST_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, + storeInterestData(pickInfo, flags, geom, geomIndex, vtxIndexArr, iPnt, sdist[0]); } } if((flags & PickInfo.ALL_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, - vtxIndexArr, iPnt, sdist[0]); + storeInterestData(pickInfo, flags, geom, geomIndex, + vtxIndexArr, iPnt, sdist[0]); } } } break; case PickShape.PICKBOUNDINGSPHERE: - BoundingSphere bsphere = (BoundingSphere) + BoundingSphere bsphere = (BoundingSphere) ((PickBounds) pickShape).bounds; while (i < loopStopIndex) { for(int j=0; j<4; j++) { @@ -172,19 +172,19 @@ class IndexedQuadArrayRetained extends IndexedGeometryArrayRetained { y = iPnt.y; z = iPnt.z; if((flags & PickInfo.CLOSEST_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, + storeInterestData(pickInfo, flags, geom, geomIndex, vtxIndexArr, iPnt, sdist[0]); } } if((flags & PickInfo.ALL_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, - vtxIndexArr, iPnt, sdist[0]); + storeInterestData(pickInfo, flags, geom, geomIndex, + vtxIndexArr, iPnt, sdist[0]); } } } break; case PickShape.PICKBOUNDINGPOLYTOPE: - BoundingPolytope bpolytope = (BoundingPolytope) + BoundingPolytope bpolytope = (BoundingPolytope) ((PickBounds) pickShape).bounds; while (i < loopStopIndex) { for(int j=0; j<4; j++) { @@ -201,13 +201,13 @@ class IndexedQuadArrayRetained extends IndexedGeometryArrayRetained { y = iPnt.y; z = iPnt.z; if((flags & PickInfo.CLOSEST_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, + storeInterestData(pickInfo, flags, geom, geomIndex, vtxIndexArr, iPnt, sdist[0]); } } if((flags & PickInfo.ALL_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, - vtxIndexArr, iPnt, sdist[0]); + storeInterestData(pickInfo, flags, geom, geomIndex, + vtxIndexArr, iPnt, sdist[0]); } } } @@ -229,13 +229,13 @@ class IndexedQuadArrayRetained extends IndexedGeometryArrayRetained { y = iPnt.y; z = iPnt.z; if((flags & PickInfo.CLOSEST_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, + storeInterestData(pickInfo, flags, geom, geomIndex, vtxIndexArr, iPnt, sdist[0]); } } if((flags & PickInfo.ALL_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, - vtxIndexArr, iPnt, sdist[0]); + storeInterestData(pickInfo, flags, geom, geomIndex, + vtxIndexArr, iPnt, sdist[0]); } } } @@ -257,13 +257,13 @@ class IndexedQuadArrayRetained extends IndexedGeometryArrayRetained { y = iPnt.y; z = iPnt.z; if((flags & PickInfo.CLOSEST_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, + storeInterestData(pickInfo, flags, geom, geomIndex, vtxIndexArr, iPnt, sdist[0]); } } if((flags & PickInfo.ALL_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, - vtxIndexArr, iPnt, sdist[0]); + storeInterestData(pickInfo, flags, geom, geomIndex, + vtxIndexArr, iPnt, sdist[0]); } } } @@ -272,8 +272,8 @@ class IndexedQuadArrayRetained extends IndexedGeometryArrayRetained { // Should not happen since API already check for this throw new IllegalArgumentException(J3dI18N.getString("IndexedQuadArrayRetained0")); default: - throw new RuntimeException("PickShape not supported for intersection "); - } + throw new RuntimeException("PickShape not supported for intersection "); + } if (minDist < Double.MAX_VALUE) { iPnt.x = x; @@ -282,8 +282,8 @@ class IndexedQuadArrayRetained extends IndexedGeometryArrayRetained { return true; } return false; - - } + + } // intersect pnts[] with every quad in this object boolean intersect(Point3d[] pnts) { @@ -293,19 +293,19 @@ class IndexedQuadArrayRetained extends IndexedGeometryArrayRetained { // Bug 447: correction for loop indices int i = initialIndexIndex; int loopStopIndex = initialIndexIndex + validIndexCount; - + points[0] = new Point3d(); points[1] = new Point3d(); points[2] = new Point3d(); points[3] = new Point3d(); - + switch (pnts.length) { case 3: // Triangle while (i < loopStopIndex) { - getVertexData(indexCoord[i++], points[0]); - getVertexData(indexCoord[i++], points[1]); - getVertexData(indexCoord[i++], points[2]); - getVertexData(indexCoord[i++], points[3]); + getVertexData(indexCoord[i++], points[0]); + getVertexData(indexCoord[i++], points[1]); + getVertexData(indexCoord[i++], points[2]); + getVertexData(indexCoord[i++], points[3]); if (intersectTriTri(points[0], points[1], points[2], pnts[0], pnts[1], pnts[2]) || intersectTriTri(points[0], points[2], points[3], @@ -316,10 +316,10 @@ class IndexedQuadArrayRetained extends IndexedGeometryArrayRetained { break; case 4: // Quad while (i < loopStopIndex) { - getVertexData(indexCoord[i++], points[0]); - getVertexData(indexCoord[i++], points[1]); - getVertexData(indexCoord[i++], points[2]); - getVertexData(indexCoord[i++], points[3]); + getVertexData(indexCoord[i++], points[0]); + getVertexData(indexCoord[i++], points[1]); + getVertexData(indexCoord[i++], points[2]); + getVertexData(indexCoord[i++], points[3]); if (intersectTriTri(points[0], points[1], points[2], pnts[0], pnts[1], pnts[2]) || intersectTriTri(points[0], points[1], points[2], @@ -334,10 +334,10 @@ class IndexedQuadArrayRetained extends IndexedGeometryArrayRetained { break; case 2: // Line while (i < loopStopIndex) { - getVertexData(indexCoord[i++], points[0]); - getVertexData(indexCoord[i++], points[1]); - getVertexData(indexCoord[i++], points[2]); - getVertexData(indexCoord[i++], points[3]); + getVertexData(indexCoord[i++], points[0]); + getVertexData(indexCoord[i++], points[1]); + getVertexData(indexCoord[i++], points[2]); + getVertexData(indexCoord[i++], points[3]); if (intersectSegment(points, pnts[0], pnts[1], dist, null)) { return true; @@ -346,10 +346,10 @@ class IndexedQuadArrayRetained extends IndexedGeometryArrayRetained { break; case 1: // Point while (i < loopStopIndex) { - getVertexData(indexCoord[i++], points[0]); - getVertexData(indexCoord[i++], points[1]); - getVertexData(indexCoord[i++], points[2]); - getVertexData(indexCoord[i++], points[3]); + getVertexData(indexCoord[i++], points[0]); + getVertexData(indexCoord[i++], points[1]); + getVertexData(indexCoord[i++], points[2]); + getVertexData(indexCoord[i++], points[3]); if (intersectTriPnt(points[0], points[1], points[2], pnts[0]) || intersectTriPnt(points[0], points[2], points[3], @@ -361,9 +361,9 @@ class IndexedQuadArrayRetained extends IndexedGeometryArrayRetained { } return false; } - - boolean intersect(Transform3D thisToOtherVworld, + + boolean intersect(Transform3D thisToOtherVworld, GeometryRetained geom) { Point3d[] points = new Point3d[4]; @@ -371,17 +371,17 @@ class IndexedQuadArrayRetained extends IndexedGeometryArrayRetained { // Bug 447: correction for loop indices int i = initialIndexIndex; int loopStopIndex = initialIndexIndex + validIndexCount; - + points[0] = new Point3d(); points[1] = new Point3d(); points[2] = new Point3d(); points[3] = new Point3d(); - + while (i < loopStopIndex) { - getVertexData(indexCoord[i++], points[0]); - getVertexData(indexCoord[i++], points[1]); - getVertexData(indexCoord[i++], points[2]); - getVertexData(indexCoord[i++], points[3]); + getVertexData(indexCoord[i++], points[0]); + getVertexData(indexCoord[i++], points[1]); + getVertexData(indexCoord[i++], points[2]); + getVertexData(indexCoord[i++], points[3]); thisToOtherVworld.transform(points[0]); thisToOtherVworld.transform(points[1]); thisToOtherVworld.transform(points[2]); @@ -400,7 +400,7 @@ class IndexedQuadArrayRetained extends IndexedGeometryArrayRetained { // Bug 447: correction for loop indices int i = initialIndexIndex; int loopStopIndex = initialIndexIndex + validIndexCount; - + points[0] = new Point3d(); points[1] = new Point3d(); points[2] = new Point3d(); @@ -411,10 +411,10 @@ class IndexedQuadArrayRetained extends IndexedGeometryArrayRetained { BoundingBox box = (BoundingBox) targetBound; while (i < loopStopIndex) { - getVertexData(indexCoord[i++], points[0]); - getVertexData(indexCoord[i++], points[1]); - getVertexData(indexCoord[i++], points[2]); - getVertexData(indexCoord[i++], points[3]); + getVertexData(indexCoord[i++], points[0]); + getVertexData(indexCoord[i++], points[1]); + getVertexData(indexCoord[i++], points[2]); + getVertexData(indexCoord[i++], points[3]); if (intersectBoundingBox(points, box, null, null)) { return true; } @@ -424,10 +424,10 @@ class IndexedQuadArrayRetained extends IndexedGeometryArrayRetained { BoundingSphere bsphere = (BoundingSphere) targetBound; while (i < loopStopIndex) { - getVertexData(indexCoord[i++], points[0]); - getVertexData(indexCoord[i++], points[1]); - getVertexData(indexCoord[i++], points[2]); - getVertexData(indexCoord[i++], points[3]); + getVertexData(indexCoord[i++], points[0]); + getVertexData(indexCoord[i++], points[1]); + getVertexData(indexCoord[i++], points[2]); + getVertexData(indexCoord[i++], points[3]); if (intersectBoundingSphere(points, bsphere, null, null)) { return true; @@ -437,10 +437,10 @@ class IndexedQuadArrayRetained extends IndexedGeometryArrayRetained { case PickShape.PICKBOUNDINGPOLYTOPE: BoundingPolytope bpolytope = (BoundingPolytope) targetBound; while (i < loopStopIndex) { - getVertexData(indexCoord[i++], points[0]); - getVertexData(indexCoord[i++], points[1]); - getVertexData(indexCoord[i++], points[2]); - getVertexData(indexCoord[i++], points[3]); + getVertexData(indexCoord[i++], points[0]); + getVertexData(indexCoord[i++], points[1]); + getVertexData(indexCoord[i++], points[2]); + getVertexData(indexCoord[i++], points[3]); if (intersectBoundingPolytope(points, bpolytope, null, null)) { return true; } @@ -448,11 +448,11 @@ class IndexedQuadArrayRetained extends IndexedGeometryArrayRetained { break; default: throw new RuntimeException("Bounds not supported for intersection " - + targetBound); + + targetBound); } return false; } - + int getClassType() { return QUAD_TYPE; diff --git a/src/classes/share/javax/media/j3d/IndexedTriangleArray.java b/src/classes/share/javax/media/j3d/IndexedTriangleArray.java index b189b69..aba5b61 100644 --- a/src/classes/share/javax/media/j3d/IndexedTriangleArray.java +++ b/src/classes/share/javax/media/j3d/IndexedTriangleArray.java @@ -71,8 +71,8 @@ public class IndexedTriangleArray extends IndexedGeometryArray { public IndexedTriangleArray(int vertexCount, int vertexFormat, int indexCount) { super(vertexCount,vertexFormat, indexCount); - if (vertexCount < 1) - throw new IllegalArgumentException(J3dI18N.getString("IndexedTriangleArray0")); + if (vertexCount < 1) + throw new IllegalArgumentException(J3dI18N.getString("IndexedTriangleArray0")); if (indexCount < 3 || ((indexCount%3) != 0)) throw new IllegalArgumentException(J3dI18N.getString("IndexedTriangleArray1")); @@ -121,8 +121,8 @@ public class IndexedTriangleArray extends IndexedGeometryArray { texCoordSetCount, texCoordSetMap, indexCount); - if (vertexCount < 1) - throw new IllegalArgumentException(J3dI18N.getString("IndexedTriangleArray0")); + if (vertexCount < 1) + throw new IllegalArgumentException(J3dI18N.getString("IndexedTriangleArray0")); if (indexCount < 3 || ((indexCount%3) != 0)) throw new IllegalArgumentException(J3dI18N.getString("IndexedTriangleArray1")); @@ -178,8 +178,8 @@ public class IndexedTriangleArray extends IndexedGeometryArray { vertexAttrCount, vertexAttrSizes, indexCount); - if (vertexCount < 1) - throw new IllegalArgumentException(J3dI18N.getString("IndexedTriangleArray0")); + if (vertexCount < 1) + throw new IllegalArgumentException(J3dI18N.getString("IndexedTriangleArray0")); if (indexCount < 3 || ((indexCount%3) != 0)) throw new IllegalArgumentException(J3dI18N.getString("IndexedTriangleArray1")); @@ -216,7 +216,7 @@ public class IndexedTriangleArray extends IndexedGeometryArray { rt.getVertexFormat(), texSetCount, texMap, - vertexAttrCount, + vertexAttrCount, vertexAttrSizes, rt.getIndexCount()); t.duplicateNodeComponent(this); diff --git a/src/classes/share/javax/media/j3d/IndexedTriangleArrayRetained.java b/src/classes/share/javax/media/j3d/IndexedTriangleArrayRetained.java index bbd51d9..da579a0 100644 --- a/src/classes/share/javax/media/j3d/IndexedTriangleArrayRetained.java +++ b/src/classes/share/javax/media/j3d/IndexedTriangleArrayRetained.java @@ -41,7 +41,7 @@ import java.lang.Math; */ class IndexedTriangleArrayRetained extends IndexedGeometryArrayRetained { - + IndexedTriangleArrayRetained() { this.geoType = GEO_TYPE_INDEXED_TRI_SET; } @@ -53,7 +53,7 @@ class IndexedTriangleArrayRetained extends IndexedGeometryArrayRetained { double minDist = Double.MAX_VALUE; double x = 0, y = 0, z = 0; int[] vtxIndexArr = new int[3]; - + //NVaidya // Bug 447: While loops below now traverse over all // elements in the valid index range from initialIndexIndex @@ -63,7 +63,7 @@ class IndexedTriangleArrayRetained extends IndexedGeometryArrayRetained { pnts[0] = new Point3d(); pnts[1] = new Point3d(); pnts[2] = new Point3d(); - + switch (pickShape.getPickType()) { case PickShape.PICKRAY: PickRay pickRay= (PickRay) pickShape; @@ -83,13 +83,13 @@ class IndexedTriangleArrayRetained extends IndexedGeometryArrayRetained { y = iPnt.y; z = iPnt.z; if((flags & PickInfo.CLOSEST_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, + storeInterestData(pickInfo, flags, geom, geomIndex, vtxIndexArr, iPnt, sdist[0]); } } if((flags & PickInfo.ALL_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, - vtxIndexArr, iPnt, sdist[0]); + storeInterestData(pickInfo, flags, geom, geomIndex, + vtxIndexArr, iPnt, sdist[0]); } } } @@ -112,21 +112,21 @@ class IndexedTriangleArrayRetained extends IndexedGeometryArrayRetained { y = iPnt.y; z = iPnt.z; if((flags & PickInfo.CLOSEST_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, + storeInterestData(pickInfo, flags, geom, geomIndex, vtxIndexArr, iPnt, sdist[0]); } } if((flags & PickInfo.ALL_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, - vtxIndexArr, iPnt, sdist[0]); + storeInterestData(pickInfo, flags, geom, geomIndex, + vtxIndexArr, iPnt, sdist[0]); } } } break; case PickShape.PICKBOUNDINGBOX: - BoundingBox bbox = (BoundingBox) + BoundingBox bbox = (BoundingBox) ((PickBounds) pickShape).bounds; - + while (i < loopStopIndex) { for(int j=0; j<3; j++) { vtxIndexArr[j] = indexCoord[i]; @@ -142,21 +142,21 @@ class IndexedTriangleArrayRetained extends IndexedGeometryArrayRetained { y = iPnt.y; z = iPnt.z; if((flags & PickInfo.CLOSEST_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, + storeInterestData(pickInfo, flags, geom, geomIndex, vtxIndexArr, iPnt, sdist[0]); } } if((flags & PickInfo.ALL_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, - vtxIndexArr, iPnt, sdist[0]); + storeInterestData(pickInfo, flags, geom, geomIndex, + vtxIndexArr, iPnt, sdist[0]); } } } break; case PickShape.PICKBOUNDINGSPHERE: - BoundingSphere bsphere = (BoundingSphere) + BoundingSphere bsphere = (BoundingSphere) ((PickBounds) pickShape).bounds; - + while (i < loopStopIndex) { for(int j=0; j<3; j++) { vtxIndexArr[j] = indexCoord[i]; @@ -172,28 +172,28 @@ class IndexedTriangleArrayRetained extends IndexedGeometryArrayRetained { y = iPnt.y; z = iPnt.z; if((flags & PickInfo.CLOSEST_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, + storeInterestData(pickInfo, flags, geom, geomIndex, vtxIndexArr, iPnt, sdist[0]); } } if((flags & PickInfo.ALL_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, - vtxIndexArr, iPnt, sdist[0]); + storeInterestData(pickInfo, flags, geom, geomIndex, + vtxIndexArr, iPnt, sdist[0]); } } } break; case PickShape.PICKBOUNDINGPOLYTOPE: - BoundingPolytope bpolytope = (BoundingPolytope) + BoundingPolytope bpolytope = (BoundingPolytope) ((PickBounds) pickShape).bounds; - + while (i < loopStopIndex) { for(int j=0; j<3; j++) { vtxIndexArr[j] = indexCoord[i]; getVertexData(indexCoord[i++], pnts[j]); } if (intersectBoundingPolytope(pnts, bpolytope, - sdist,iPnt)) { + sdist,iPnt)) { if (flags == 0) { return true; } @@ -203,13 +203,13 @@ class IndexedTriangleArrayRetained extends IndexedGeometryArrayRetained { y = iPnt.y; z = iPnt.z; if((flags & PickInfo.CLOSEST_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, + storeInterestData(pickInfo, flags, geom, geomIndex, vtxIndexArr, iPnt, sdist[0]); } } if((flags & PickInfo.ALL_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, - vtxIndexArr, iPnt, sdist[0]); + storeInterestData(pickInfo, flags, geom, geomIndex, + vtxIndexArr, iPnt, sdist[0]); } } } @@ -232,20 +232,20 @@ class IndexedTriangleArrayRetained extends IndexedGeometryArrayRetained { y = iPnt.y; z = iPnt.z; if((flags & PickInfo.CLOSEST_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, + storeInterestData(pickInfo, flags, geom, geomIndex, vtxIndexArr, iPnt, sdist[0]); } } if((flags & PickInfo.ALL_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, - vtxIndexArr, iPnt, sdist[0]); + storeInterestData(pickInfo, flags, geom, geomIndex, + vtxIndexArr, iPnt, sdist[0]); } } } break; case PickShape.PICKCONE: PickCone pickCone= (PickCone) pickShape; - + while (i < loopStopIndex) { for(int j=0; j<3; j++) { vtxIndexArr[j] = indexCoord[i]; @@ -261,13 +261,13 @@ class IndexedTriangleArrayRetained extends IndexedGeometryArrayRetained { y = iPnt.y; z = iPnt.z; if((flags & PickInfo.CLOSEST_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, + storeInterestData(pickInfo, flags, geom, geomIndex, vtxIndexArr, iPnt, sdist[0]); } } if((flags & PickInfo.ALL_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, - vtxIndexArr, iPnt, sdist[0]); + storeInterestData(pickInfo, flags, geom, geomIndex, + vtxIndexArr, iPnt, sdist[0]); } } } @@ -276,9 +276,9 @@ class IndexedTriangleArrayRetained extends IndexedGeometryArrayRetained { // Should not happen since API already check for this throw new IllegalArgumentException(J3dI18N.getString("IndexedTriangleArrayRetained0")); default: - throw new RuntimeException ("PickShape not supported for intersection"); - } - + throw new RuntimeException ("PickShape not supported for intersection"); + } + if (minDist < Double.MAX_VALUE) { iPnt.x = x; iPnt.y = y; @@ -287,7 +287,7 @@ class IndexedTriangleArrayRetained extends IndexedGeometryArrayRetained { } return false; } - + // intersect pnts[] with every triangle in this object boolean intersect(Point3d[] pnts) { Point3d[] points = new Point3d[3]; @@ -296,10 +296,10 @@ class IndexedTriangleArrayRetained extends IndexedGeometryArrayRetained { // Bug 447: correction for loop indices int i = initialIndexIndex; int loopStopIndex = initialIndexIndex + validIndexCount; - + points[0] = new Point3d(); - points[1] = new Point3d(); - points[2] = new Point3d(); + points[1] = new Point3d(); + points[2] = new Point3d(); switch (pnts.length) { case 3: // Triangle @@ -352,7 +352,7 @@ class IndexedTriangleArrayRetained extends IndexedGeometryArrayRetained { return false; } - + boolean intersect(Transform3D thisToOtherVworld, GeometryRetained geom) { Point3d[] pnts = new Point3d[3]; //NVaidya @@ -391,7 +391,7 @@ class IndexedTriangleArrayRetained extends IndexedGeometryArrayRetained { switch(targetBound.getPickType()) { case PickShape.PICKBOUNDINGBOX: BoundingBox box = (BoundingBox) targetBound; - + while (i < loopStopIndex) { getVertexData(indexCoord[i++], pnts[0]); getVertexData(indexCoord[i++], pnts[1]); @@ -403,7 +403,7 @@ class IndexedTriangleArrayRetained extends IndexedGeometryArrayRetained { break; case PickShape.PICKBOUNDINGSPHERE: BoundingSphere bsphere = (BoundingSphere) targetBound; - + while (i < loopStopIndex) { getVertexData(indexCoord[i++], pnts[0]); getVertexData(indexCoord[i++], pnts[1]); @@ -416,7 +416,7 @@ class IndexedTriangleArrayRetained extends IndexedGeometryArrayRetained { break; case PickShape.PICKBOUNDINGPOLYTOPE: BoundingPolytope bpolytope = (BoundingPolytope) targetBound; - + while (i < loopStopIndex) { getVertexData(indexCoord[i++], pnts[0]); getVertexData(indexCoord[i++], pnts[1]); @@ -429,11 +429,11 @@ class IndexedTriangleArrayRetained extends IndexedGeometryArrayRetained { break; default: throw new RuntimeException("Bounds not supported for intersection " - + targetBound); + + targetBound); } return false; } - + int getClassType() { return TRIANGLE_TYPE; } diff --git a/src/classes/share/javax/media/j3d/IndexedTriangleFanArray.java b/src/classes/share/javax/media/j3d/IndexedTriangleFanArray.java index 31c576c..b81452d 100644 --- a/src/classes/share/javax/media/j3d/IndexedTriangleFanArray.java +++ b/src/classes/share/javax/media/j3d/IndexedTriangleFanArray.java @@ -81,8 +81,8 @@ public class IndexedTriangleFanArray extends IndexedGeometryStripArray { super(vertexCount, vertexFormat, indexCount, stripIndexCounts); - if (vertexCount < 1) - throw new IllegalArgumentException(J3dI18N.getString("IndexedTriangleFanArray0")); + if (vertexCount < 1) + throw new IllegalArgumentException(J3dI18N.getString("IndexedTriangleFanArray0")); if (indexCount < 3 ) throw new IllegalArgumentException(J3dI18N.getString("IndexedTriangleFanArray1")); @@ -136,8 +136,8 @@ public class IndexedTriangleFanArray extends IndexedGeometryStripArray { texCoordSetCount, texCoordSetMap, indexCount, stripIndexCounts); - if (vertexCount < 1) - throw new IllegalArgumentException(J3dI18N.getString("IndexedTriangleFanArray0")); + if (vertexCount < 1) + throw new IllegalArgumentException(J3dI18N.getString("IndexedTriangleFanArray0")); if (indexCount < 3 ) throw new IllegalArgumentException(J3dI18N.getString("IndexedTriangleFanArray1")); @@ -198,8 +198,8 @@ public class IndexedTriangleFanArray extends IndexedGeometryStripArray { vertexAttrCount, vertexAttrSizes, indexCount, stripIndexCounts); - if (vertexCount < 1) - throw new IllegalArgumentException(J3dI18N.getString("IndexedTriangleFanArray0")); + if (vertexCount < 1) + throw new IllegalArgumentException(J3dI18N.getString("IndexedTriangleFanArray0")); if (indexCount < 3 ) throw new IllegalArgumentException(J3dI18N.getString("IndexedTriangleFanArray1")); @@ -214,7 +214,7 @@ public class IndexedTriangleFanArray extends IndexedGeometryStripArray { this.retained.setSource(this); } - + /** * @deprecated replaced with cloneNodeComponent(boolean forceDuplicate) */ diff --git a/src/classes/share/javax/media/j3d/IndexedTriangleFanArrayRetained.java b/src/classes/share/javax/media/j3d/IndexedTriangleFanArrayRetained.java index a94c28b..883a28c 100644 --- a/src/classes/share/javax/media/j3d/IndexedTriangleFanArrayRetained.java +++ b/src/classes/share/javax/media/j3d/IndexedTriangleFanArrayRetained.java @@ -46,7 +46,7 @@ import java.lang.Math; */ class IndexedTriangleFanArrayRetained extends IndexedGeometryStripArrayRetained { - + IndexedTriangleFanArrayRetained(){ geoType = GEO_TYPE_INDEXED_TRI_FAN_SET; } @@ -61,13 +61,13 @@ class IndexedTriangleFanArrayRetained extends IndexedGeometryStripArrayRetained int j, scount, count = 0; pnts[0] = new Point3d(); pnts[1] = new Point3d(); - pnts[2] = new Point3d(); + pnts[2] = new Point3d(); int[] vtxIndexArr = new int[3]; switch (pickShape.getPickType()) { case PickShape.PICKRAY: PickRay pickRay= (PickRay) pickShape; - + while (i < stripIndexCounts.length) { for(int k=0; k<2; k++) { vtxIndexArr[k] = indexCoord[count]; @@ -87,13 +87,13 @@ class IndexedTriangleFanArrayRetained extends IndexedGeometryStripArrayRetained y = iPnt.y; z = iPnt.z; if((flags & PickInfo.CLOSEST_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, + storeInterestData(pickInfo, flags, geom, geomIndex, vtxIndexArr, iPnt, sdist[0]); } } if((flags & PickInfo.ALL_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, - vtxIndexArr, iPnt, sdist[0]); + storeInterestData(pickInfo, flags, geom, geomIndex, + vtxIndexArr, iPnt, sdist[0]); } } pnts[1].set(pnts[2]); @@ -104,7 +104,7 @@ class IndexedTriangleFanArrayRetained extends IndexedGeometryStripArrayRetained case PickShape.PICKSEGMENT: PickSegment pickSegment = (PickSegment) pickShape; - while (i < stripIndexCounts.length) { + while (i < stripIndexCounts.length) { for(int k=0; k<2; k++) { vtxIndexArr[k] = indexCoord[count]; getVertexData(indexCoord[count++], pnts[k]); @@ -113,7 +113,7 @@ class IndexedTriangleFanArrayRetained extends IndexedGeometryStripArrayRetained for (j=2; j < scount; j++) { vtxIndexArr[2] = indexCoord[count]; getVertexData(indexCoord[count++], pnts[2]); - if (intersectSegment(pnts, pickSegment.start, + if (intersectSegment(pnts, pickSegment.start, pickSegment.end, sdist, iPnt)) { if (flags == 0) { return true; @@ -124,13 +124,13 @@ class IndexedTriangleFanArrayRetained extends IndexedGeometryStripArrayRetained y = iPnt.y; z = iPnt.z; if((flags & PickInfo.CLOSEST_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, + storeInterestData(pickInfo, flags, geom, geomIndex, vtxIndexArr, iPnt, sdist[0]); } } if((flags & PickInfo.ALL_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, - vtxIndexArr, iPnt, sdist[0]); + storeInterestData(pickInfo, flags, geom, geomIndex, + vtxIndexArr, iPnt, sdist[0]); } } pnts[1].set(pnts[2]); @@ -139,10 +139,10 @@ class IndexedTriangleFanArrayRetained extends IndexedGeometryStripArrayRetained } break; case PickShape.PICKBOUNDINGBOX: - BoundingBox bbox = (BoundingBox) + BoundingBox bbox = (BoundingBox) ((PickBounds) pickShape).bounds; - while (i < stripIndexCounts.length) { + while (i < stripIndexCounts.length) { for(int k=0; k<2; k++) { vtxIndexArr[k] = indexCoord[count]; getVertexData(indexCoord[count++], pnts[k]); @@ -161,13 +161,13 @@ class IndexedTriangleFanArrayRetained extends IndexedGeometryStripArrayRetained y = iPnt.y; z = iPnt.z; if((flags & PickInfo.CLOSEST_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, + storeInterestData(pickInfo, flags, geom, geomIndex, vtxIndexArr, iPnt, sdist[0]); } } if((flags & PickInfo.ALL_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, - vtxIndexArr, iPnt, sdist[0]); + storeInterestData(pickInfo, flags, geom, geomIndex, + vtxIndexArr, iPnt, sdist[0]); } } pnts[1].set(pnts[2]); @@ -176,10 +176,10 @@ class IndexedTriangleFanArrayRetained extends IndexedGeometryStripArrayRetained } break; case PickShape.PICKBOUNDINGSPHERE: - BoundingSphere bsphere = (BoundingSphere) + BoundingSphere bsphere = (BoundingSphere) ((PickBounds) pickShape).bounds; - while (i < stripIndexCounts.length) { + while (i < stripIndexCounts.length) { for(int k=0; k<2; k++) { vtxIndexArr[k] = indexCoord[count]; getVertexData(indexCoord[count++], pnts[k]); @@ -189,7 +189,7 @@ class IndexedTriangleFanArrayRetained extends IndexedGeometryStripArrayRetained vtxIndexArr[2] = indexCoord[count]; getVertexData(indexCoord[count++], pnts[2]); if (intersectBoundingSphere(pnts, bsphere, sdist, - iPnt)) { + iPnt)) { if (flags == 0) { return true; } @@ -199,13 +199,13 @@ class IndexedTriangleFanArrayRetained extends IndexedGeometryStripArrayRetained y = iPnt.y; z = iPnt.z; if((flags & PickInfo.CLOSEST_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, + storeInterestData(pickInfo, flags, geom, geomIndex, vtxIndexArr, iPnt, sdist[0]); } } if((flags & PickInfo.ALL_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, - vtxIndexArr, iPnt, sdist[0]); + storeInterestData(pickInfo, flags, geom, geomIndex, + vtxIndexArr, iPnt, sdist[0]); } } pnts[1].set(pnts[2]); @@ -214,10 +214,10 @@ class IndexedTriangleFanArrayRetained extends IndexedGeometryStripArrayRetained } break; case PickShape.PICKBOUNDINGPOLYTOPE: - BoundingPolytope bpolytope = (BoundingPolytope) + BoundingPolytope bpolytope = (BoundingPolytope) ((PickBounds) pickShape).bounds; - while (i < stripIndexCounts.length) { + while (i < stripIndexCounts.length) { for(int k=0; k<2; k++) { vtxIndexArr[k] = indexCoord[count]; getVertexData(indexCoord[count++], pnts[k]); @@ -237,13 +237,13 @@ class IndexedTriangleFanArrayRetained extends IndexedGeometryStripArrayRetained y = iPnt.y; z = iPnt.z; if((flags & PickInfo.CLOSEST_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, + storeInterestData(pickInfo, flags, geom, geomIndex, vtxIndexArr, iPnt, sdist[0]); } } if((flags & PickInfo.ALL_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, - vtxIndexArr, iPnt, sdist[0]); + storeInterestData(pickInfo, flags, geom, geomIndex, + vtxIndexArr, iPnt, sdist[0]); } } pnts[1].set(pnts[2]); @@ -254,7 +254,7 @@ class IndexedTriangleFanArrayRetained extends IndexedGeometryStripArrayRetained case PickShape.PICKCYLINDER: PickCylinder pickCylinder= (PickCylinder) pickShape; - while (i < stripIndexCounts.length) { + while (i < stripIndexCounts.length) { for(int k=0; k<2; k++) { vtxIndexArr[k] = indexCoord[count]; getVertexData(indexCoord[count++], pnts[k]); @@ -273,13 +273,13 @@ class IndexedTriangleFanArrayRetained extends IndexedGeometryStripArrayRetained y = iPnt.y; z = iPnt.z; if((flags & PickInfo.CLOSEST_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, + storeInterestData(pickInfo, flags, geom, geomIndex, vtxIndexArr, iPnt, sdist[0]); } } if((flags & PickInfo.ALL_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, - vtxIndexArr, iPnt, sdist[0]); + storeInterestData(pickInfo, flags, geom, geomIndex, + vtxIndexArr, iPnt, sdist[0]); } } pnts[1].set(pnts[2]); @@ -290,7 +290,7 @@ class IndexedTriangleFanArrayRetained extends IndexedGeometryStripArrayRetained case PickShape.PICKCONE: PickCone pickCone= (PickCone) pickShape; - while (i < stripIndexCounts.length) { + while (i < stripIndexCounts.length) { for(int k=0; k<2; k++) { vtxIndexArr[k] = indexCoord[count]; getVertexData(indexCoord[count++], pnts[k]); @@ -309,13 +309,13 @@ class IndexedTriangleFanArrayRetained extends IndexedGeometryStripArrayRetained y = iPnt.y; z = iPnt.z; if((flags & PickInfo.CLOSEST_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, + storeInterestData(pickInfo, flags, geom, geomIndex, vtxIndexArr, iPnt, sdist[0]); } } if((flags & PickInfo.ALL_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, - vtxIndexArr, iPnt, sdist[0]); + storeInterestData(pickInfo, flags, geom, geomIndex, + vtxIndexArr, iPnt, sdist[0]); } } pnts[1].set(pnts[2]); @@ -327,8 +327,8 @@ class IndexedTriangleFanArrayRetained extends IndexedGeometryStripArrayRetained // Should not happen since API already check for this throw new IllegalArgumentException(J3dI18N.getString("IndexedTriangleFanArrayRetained0")); default: - throw new RuntimeException ("PickShape not supported for intersection"); - } + throw new RuntimeException ("PickShape not supported for intersection"); + } if (minDist < Double.MAX_VALUE) { iPnt.x = x; @@ -337,8 +337,8 @@ class IndexedTriangleFanArrayRetained extends IndexedGeometryStripArrayRetained return true; } return false; - } - + } + // intersect pnts[] with every triangle in this object boolean intersect(Point3d[] pnts) { int j, end; @@ -416,7 +416,7 @@ class IndexedTriangleFanArrayRetained extends IndexedGeometryStripArrayRetained } return false; } - + boolean intersect(Transform3D thisToOtherVworld, GeometryRetained geom) { int i = 0, j, scount, count = 0; Point3d[] pnts = new Point3d[3]; @@ -470,7 +470,7 @@ class IndexedTriangleFanArrayRetained extends IndexedGeometryStripArrayRetained break; case PickShape.PICKBOUNDINGSPHERE: BoundingSphere bsphere = (BoundingSphere) targetBound; - + while (i < stripIndexCounts.length) { getVertexData(indexCoord[count++], pnts[0]); getVertexData(indexCoord[count++], pnts[1]); @@ -502,7 +502,7 @@ class IndexedTriangleFanArrayRetained extends IndexedGeometryStripArrayRetained break; default: throw new RuntimeException("Bounds not supported for intersection " - + targetBound); + + targetBound); } return false; } diff --git a/src/classes/share/javax/media/j3d/IndexedTriangleStripArray.java b/src/classes/share/javax/media/j3d/IndexedTriangleStripArray.java index f661e5d..68061f1 100644 --- a/src/classes/share/javax/media/j3d/IndexedTriangleStripArray.java +++ b/src/classes/share/javax/media/j3d/IndexedTriangleStripArray.java @@ -83,8 +83,8 @@ public class IndexedTriangleStripArray extends IndexedGeometryStripArray { super(vertexCount, vertexFormat, indexCount, stripIndexCounts); - if (vertexCount < 1) - throw new IllegalArgumentException(J3dI18N.getString("IndexedTriangleStripArray0")); + if (vertexCount < 1) + throw new IllegalArgumentException(J3dI18N.getString("IndexedTriangleStripArray0")); if (indexCount < 3 ) throw new IllegalArgumentException(J3dI18N.getString("IndexedTriangleStripArray1")); @@ -138,8 +138,8 @@ public class IndexedTriangleStripArray extends IndexedGeometryStripArray { texCoordSetCount, texCoordSetMap, indexCount, stripIndexCounts); - if (vertexCount < 1) - throw new IllegalArgumentException(J3dI18N.getString("IndexedTriangleStripArray0")); + if (vertexCount < 1) + throw new IllegalArgumentException(J3dI18N.getString("IndexedTriangleStripArray0")); if (indexCount < 3 ) throw new IllegalArgumentException(J3dI18N.getString("IndexedTriangleStripArray1")); @@ -200,8 +200,8 @@ public class IndexedTriangleStripArray extends IndexedGeometryStripArray { vertexAttrCount, vertexAttrSizes, indexCount, stripIndexCounts); - if (vertexCount < 1) - throw new IllegalArgumentException(J3dI18N.getString("IndexedTriangleStripArray0")); + if (vertexCount < 1) + throw new IllegalArgumentException(J3dI18N.getString("IndexedTriangleStripArray0")); if (indexCount < 3 ) throw new IllegalArgumentException(J3dI18N.getString("IndexedTriangleStripArray1")); @@ -216,7 +216,7 @@ public class IndexedTriangleStripArray extends IndexedGeometryStripArray { this.retained.setSource(this); } - + /** * @deprecated replaced with cloneNodeComponent(boolean forceDuplicate) */ diff --git a/src/classes/share/javax/media/j3d/IndexedTriangleStripArrayRetained.java b/src/classes/share/javax/media/j3d/IndexedTriangleStripArrayRetained.java index 376a39f..7742e8c 100644 --- a/src/classes/share/javax/media/j3d/IndexedTriangleStripArrayRetained.java +++ b/src/classes/share/javax/media/j3d/IndexedTriangleStripArrayRetained.java @@ -45,11 +45,11 @@ import java.lang.Math; */ class IndexedTriangleStripArrayRetained extends IndexedGeometryStripArrayRetained { - + IndexedTriangleStripArrayRetained(){ geoType = GEO_TYPE_INDEXED_TRI_STRIP_SET; } - + boolean intersect(PickShape pickShape, PickInfo pickInfo, int flags, Point3d iPnt, GeometryRetained geom, int geomIndex) { Point3d pnts[] = new Point3d[3]; @@ -60,14 +60,14 @@ class IndexedTriangleStripArrayRetained extends IndexedGeometryStripArrayRetaine int j, scount, count = 0; pnts[0] = new Point3d(); pnts[1] = new Point3d(); - pnts[2] = new Point3d(); + pnts[2] = new Point3d(); int[] vtxIndexArr = new int[3]; switch (pickShape.getPickType()) { case PickShape.PICKRAY: PickRay pickRay= (PickRay) pickShape; - - while (i < stripIndexCounts.length) { + + while (i < stripIndexCounts.length) { for(int k=0; k<2; k++) { vtxIndexArr[k] = indexCoord[count]; getVertexData(indexCoord[count++], pnts[k]); @@ -86,13 +86,13 @@ class IndexedTriangleStripArrayRetained extends IndexedGeometryStripArrayRetaine y = iPnt.y; z = iPnt.z; if((flags & PickInfo.CLOSEST_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, + storeInterestData(pickInfo, flags, geom, geomIndex, vtxIndexArr, iPnt, sdist[0]); } } if((flags & PickInfo.ALL_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, - vtxIndexArr, iPnt, sdist[0]); + storeInterestData(pickInfo, flags, geom, geomIndex, + vtxIndexArr, iPnt, sdist[0]); } } pnts[0].set(pnts[1]); @@ -105,7 +105,7 @@ class IndexedTriangleStripArrayRetained extends IndexedGeometryStripArrayRetaine case PickShape.PICKSEGMENT: PickSegment pickSegment = (PickSegment) pickShape; - while (i < stripIndexCounts.length) { + while (i < stripIndexCounts.length) { for(int k=0; k<2; k++) { vtxIndexArr[k] = indexCoord[count]; getVertexData(indexCoord[count++], pnts[k]); @@ -114,7 +114,7 @@ class IndexedTriangleStripArrayRetained extends IndexedGeometryStripArrayRetaine for (j=2; j < scount; j++) { vtxIndexArr[2] = indexCoord[count]; getVertexData(indexCoord[count++], pnts[2]); - if (intersectSegment(pnts, pickSegment.start, + if (intersectSegment(pnts, pickSegment.start, pickSegment.end, sdist, iPnt)) { if (flags == 0) { return true; @@ -125,13 +125,13 @@ class IndexedTriangleStripArrayRetained extends IndexedGeometryStripArrayRetaine y = iPnt.y; z = iPnt.z; if((flags & PickInfo.CLOSEST_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, + storeInterestData(pickInfo, flags, geom, geomIndex, vtxIndexArr, iPnt, sdist[0]); } } if((flags & PickInfo.ALL_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, - vtxIndexArr, iPnt, sdist[0]); + storeInterestData(pickInfo, flags, geom, geomIndex, + vtxIndexArr, iPnt, sdist[0]); } } pnts[0].set(pnts[1]); @@ -142,10 +142,10 @@ class IndexedTriangleStripArrayRetained extends IndexedGeometryStripArrayRetaine } break; case PickShape.PICKBOUNDINGBOX: - BoundingBox bbox = (BoundingBox) + BoundingBox bbox = (BoundingBox) ((PickBounds) pickShape).bounds; - while (i < stripIndexCounts.length) { + while (i < stripIndexCounts.length) { for(int k=0; k<2; k++) { vtxIndexArr[k] = indexCoord[count]; getVertexData(indexCoord[count++], pnts[k]); @@ -164,13 +164,13 @@ class IndexedTriangleStripArrayRetained extends IndexedGeometryStripArrayRetaine y = iPnt.y; z = iPnt.z; if((flags & PickInfo.CLOSEST_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, + storeInterestData(pickInfo, flags, geom, geomIndex, vtxIndexArr, iPnt, sdist[0]); } } if((flags & PickInfo.ALL_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, - vtxIndexArr, iPnt, sdist[0]); + storeInterestData(pickInfo, flags, geom, geomIndex, + vtxIndexArr, iPnt, sdist[0]); } } pnts[0].set(pnts[1]); @@ -181,10 +181,10 @@ class IndexedTriangleStripArrayRetained extends IndexedGeometryStripArrayRetaine } break; case PickShape.PICKBOUNDINGSPHERE: - BoundingSphere bsphere = (BoundingSphere) + BoundingSphere bsphere = (BoundingSphere) ((PickBounds) pickShape).bounds; - while (i < stripIndexCounts.length) { + while (i < stripIndexCounts.length) { for(int k=0; k<2; k++) { vtxIndexArr[k] = indexCoord[count]; getVertexData(indexCoord[count++], pnts[k]); @@ -194,7 +194,7 @@ class IndexedTriangleStripArrayRetained extends IndexedGeometryStripArrayRetaine vtxIndexArr[2] = indexCoord[count]; getVertexData(indexCoord[count++], pnts[2]); if (intersectBoundingSphere(pnts, bsphere, sdist, - iPnt)) { + iPnt)) { if (flags == 0) { return true; } @@ -204,13 +204,13 @@ class IndexedTriangleStripArrayRetained extends IndexedGeometryStripArrayRetaine y = iPnt.y; z = iPnt.z; if((flags & PickInfo.CLOSEST_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, + storeInterestData(pickInfo, flags, geom, geomIndex, vtxIndexArr, iPnt, sdist[0]); } } if((flags & PickInfo.ALL_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, - vtxIndexArr, iPnt, sdist[0]); + storeInterestData(pickInfo, flags, geom, geomIndex, + vtxIndexArr, iPnt, sdist[0]); } } pnts[0].set(pnts[1]); @@ -221,10 +221,10 @@ class IndexedTriangleStripArrayRetained extends IndexedGeometryStripArrayRetaine } break; case PickShape.PICKBOUNDINGPOLYTOPE: - BoundingPolytope bpolytope = (BoundingPolytope) + BoundingPolytope bpolytope = (BoundingPolytope) ((PickBounds) pickShape).bounds; - while (i < stripIndexCounts.length) { + while (i < stripIndexCounts.length) { for(int k=0; k<2; k++) { vtxIndexArr[k] = indexCoord[count]; getVertexData(indexCoord[count++], pnts[k]); @@ -244,13 +244,13 @@ class IndexedTriangleStripArrayRetained extends IndexedGeometryStripArrayRetaine y = iPnt.y; z = iPnt.z; if((flags & PickInfo.CLOSEST_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, + storeInterestData(pickInfo, flags, geom, geomIndex, vtxIndexArr, iPnt, sdist[0]); } } if((flags & PickInfo.ALL_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, - vtxIndexArr, iPnt, sdist[0]); + storeInterestData(pickInfo, flags, geom, geomIndex, + vtxIndexArr, iPnt, sdist[0]); } } pnts[0].set(pnts[1]); @@ -263,7 +263,7 @@ class IndexedTriangleStripArrayRetained extends IndexedGeometryStripArrayRetaine case PickShape.PICKCYLINDER: PickCylinder pickCylinder= (PickCylinder) pickShape; - while (i < stripIndexCounts.length) { + while (i < stripIndexCounts.length) { for(int k=0; k<2; k++) { vtxIndexArr[k] = indexCoord[count]; getVertexData(indexCoord[count++], pnts[k]); @@ -282,13 +282,13 @@ class IndexedTriangleStripArrayRetained extends IndexedGeometryStripArrayRetaine y = iPnt.y; z = iPnt.z; if((flags & PickInfo.CLOSEST_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, + storeInterestData(pickInfo, flags, geom, geomIndex, vtxIndexArr, iPnt, sdist[0]); } } if((flags & PickInfo.ALL_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, - vtxIndexArr, iPnt, sdist[0]); + storeInterestData(pickInfo, flags, geom, geomIndex, + vtxIndexArr, iPnt, sdist[0]); } } pnts[0].set(pnts[1]); @@ -301,7 +301,7 @@ class IndexedTriangleStripArrayRetained extends IndexedGeometryStripArrayRetaine case PickShape.PICKCONE: PickCone pickCone= (PickCone) pickShape; - while (i < stripIndexCounts.length) { + while (i < stripIndexCounts.length) { for(int k=0; k<2; k++) { vtxIndexArr[k] = indexCoord[count]; getVertexData(indexCoord[count++], pnts[k]); @@ -320,13 +320,13 @@ class IndexedTriangleStripArrayRetained extends IndexedGeometryStripArrayRetaine y = iPnt.y; z = iPnt.z; if((flags & PickInfo.CLOSEST_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, + storeInterestData(pickInfo, flags, geom, geomIndex, vtxIndexArr, iPnt, sdist[0]); } } if((flags & PickInfo.ALL_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, - vtxIndexArr, iPnt, sdist[0]); + storeInterestData(pickInfo, flags, geom, geomIndex, + vtxIndexArr, iPnt, sdist[0]); } } pnts[0].set(pnts[1]); @@ -340,8 +340,8 @@ class IndexedTriangleStripArrayRetained extends IndexedGeometryStripArrayRetaine // Should not happen since API already check for this throw new IllegalArgumentException(J3dI18N.getString("IndexedTriangleStripArrayRetained0")); default: - throw new RuntimeException ("PickShape not supported for intersection"); - } + throw new RuntimeException ("PickShape not supported for intersection"); + } if (minDist < Double.MAX_VALUE) { iPnt.x = x; @@ -351,7 +351,7 @@ class IndexedTriangleStripArrayRetained extends IndexedGeometryStripArrayRetaine } return false; } - + // intersect pnts[] with every triangle in this object boolean intersect(Point3d[] pnts) { int j, end; @@ -433,7 +433,7 @@ class IndexedTriangleStripArrayRetained extends IndexedGeometryStripArrayRetaine } return false; } - + boolean intersect(Transform3D thisToOtherVworld, GeometryRetained geom) { int i = 0, j, scount, count = 0; Point3d[] pnts = new Point3d[3]; @@ -489,7 +489,7 @@ class IndexedTriangleStripArrayRetained extends IndexedGeometryStripArrayRetaine break; case PickShape.PICKBOUNDINGSPHERE: BoundingSphere bsphere = (BoundingSphere) targetBound; - + while (i < stripIndexCounts.length) { getVertexData(indexCoord[count++], pnts[0]); getVertexData(indexCoord[count++], pnts[1]); @@ -523,7 +523,7 @@ class IndexedTriangleStripArrayRetained extends IndexedGeometryStripArrayRetaine break; default: throw new RuntimeException("Bounds not supported for intersection " - + targetBound); + + targetBound); } return false; } diff --git a/src/classes/share/javax/media/j3d/IndexedUnorderSet.java b/src/classes/share/javax/media/j3d/IndexedUnorderSet.java index e26d500..9d18909 100644 --- a/src/classes/share/javax/media/j3d/IndexedUnorderSet.java +++ b/src/classes/share/javax/media/j3d/IndexedUnorderSet.java @@ -36,7 +36,7 @@ package javax.media.j3d; * All operations remove(IndexedObject, ListType), add(IndexedObject, ListType), * contains(IndexedObject, ListType) etc. take O(1) time. * The class is designed to optimize speed. So many reductance - * procedures call and range check as found in ArrayList are + * procedures call and range check as found in ArrayList are * removed. * * <p> @@ -61,7 +61,7 @@ package javax.media.j3d; * 1) The array return is a copied of internal array.<br> * 2) Don't use arr.length , use IUset.arraySize();<br> * 3) IndexedObject contains an array of listIndex, the number of - * array elements depends on the number of different types of + * array elements depends on the number of different types of * IndexedUnorderSet that use it.<br> * 4) No need to do casting for individual element as in ArrayList.<br> * 5) IndexedUnorderSet is thread safe.<br> @@ -176,7 +176,7 @@ class IndexedUnorderSet implements Cloneable, java.io.Serializable { obj.listIdx[0][i] = -1; obj.listIdx[1][i] = -1; } - + // Just want to set both RenderMolecule idx // and BehaviorRetained idx to 0 by default // It is OK without the following lines @@ -197,9 +197,9 @@ class IndexedUnorderSet implements Cloneable, java.io.Serializable { return size; } - + /** - * Returns the size of entry use in toArray() number of elements + * Returns the size of entry use in toArray() number of elements * in this list. * * @return the number of elements in this list. @@ -229,8 +229,8 @@ class IndexedUnorderSet implements Cloneable, java.io.Serializable { /** - * Searches for the last occurence of the given argument, testing - * for equality using the <tt>equals</tt> method. + * Searches for the last occurence of the given argument, testing + * for equality using the <tt>equals</tt> method. * * @param o an object. * @return the index of the first occurrence of the argument in this @@ -248,14 +248,14 @@ class IndexedUnorderSet implements Cloneable, java.io.Serializable { * @return a clone of this <tt>ArrayList</tt> instance. */ synchronized protected final Object clone() { - try { + try { IndexedUnorderSet v = (IndexedUnorderSet)super.clone(); v.elementData = (IndexedObject[])java.lang.reflect.Array.newInstance( componentType, size); System.arraycopy(elementData, 0, v.elementData, 0, size); isDirty = true; // can't use the old cloneData reference return v; - } catch (CloneNotSupportedException e) { + } catch (CloneNotSupportedException e) { // this shouldn't happen, since we are Cloneable throw new InternalError(); } @@ -265,7 +265,7 @@ class IndexedUnorderSet implements Cloneable, java.io.Serializable { /** * Returns an array containing all of the elements in this list. * The size of the array may longer than the actual size. Use - * arraySize() to retrieve the size. + * arraySize() to retrieve the size. * The array return is a copied of internal array. if copy * is true. * @@ -287,13 +287,13 @@ class IndexedUnorderSet implements Cloneable, java.io.Serializable { cloneSize = size; return elementData; } - + } /** * Returns an array containing all of the elements in this list. * The size of the array may longer than the actual size. Use - * arraySize() to retrieve the size. + * arraySize() to retrieve the size. * The array return is a copied of internal array. So another * thread can continue add/delete the current list. However, * it should be noticed that two call to toArray() may return @@ -308,10 +308,10 @@ class IndexedUnorderSet implements Cloneable, java.io.Serializable { /** * Returns an array containing elements starting from startElement - * all of the elements in this list. A new array of exact size + * all of the elements in this list. A new array of exact size * is always allocated. * - * @param startElement starting element to copy + * @param startElement starting element to copy * * @return an array containing elements starting from * startElement, null if element not found. @@ -343,7 +343,7 @@ class IndexedUnorderSet implements Cloneable, java.io.Serializable { System.arraycopy(oldData, 0, elementData, 0, size); } } - + // Positional Access Operations @@ -375,12 +375,12 @@ class IndexedUnorderSet implements Cloneable, java.io.Serializable { oldElm.listIdx[oldElm.getIdxUsed(univ)][listType] = -1; } elementData[index] = o; - + int univIdx = o.getIdxUsed(univ); if (debug) { if (o.listIdx[univIdx][listType] != -1) { - System.err.println("Illegal use of UnorderIndexedList idx in set " + + System.err.println("Illegal use of UnorderIndexedList idx in set " + o.listIdx[univIdx][listType]); Thread.dumpStack(); } @@ -398,7 +398,7 @@ class IndexedUnorderSet implements Cloneable, java.io.Serializable { * @param o element to be appended to this list. */ synchronized final void add(IndexedObject o) { - + if (elementData.length == size) { IndexedObject oldData[] = elementData; elementData = (IndexedObject[])java.lang.reflect.Array.newInstance( @@ -426,7 +426,7 @@ class IndexedUnorderSet implements Cloneable, java.io.Serializable { isDirty = true; } - + /** * Removes the element at the specified position in this list. * Replace the removed element by the last one. @@ -443,17 +443,17 @@ class IndexedUnorderSet implements Cloneable, java.io.Serializable { if (debug) { if (elm.listIdx[univIdx][listType] != index) { System.err.println("Inconsistent idx in remove, expect " + index + " actual " + elm.listIdx[univIdx][listType]); - Thread.dumpStack(); - } + Thread.dumpStack(); + } } elm.listIdx[univIdx][listType] = -1; size--; if (index != size) { - elm = elementData[size]; + elm = elementData[size]; elm.listIdx[univIdx][listType] = index; elementData[index] = elm; - } + } elementData[size] = null; isDirty = true; /* @@ -463,7 +463,7 @@ class IndexedUnorderSet implements Cloneable, java.io.Serializable { */ } - + /** * Removes the element at the last position in this list. * @return The element remove @@ -514,7 +514,7 @@ class IndexedUnorderSet implements Cloneable, java.io.Serializable { o.listIdx[univIdx][listType] = -1; isDirty = true; return true; - } + } return false; } @@ -556,7 +556,7 @@ class IndexedUnorderSet implements Cloneable, java.io.Serializable { StringBuffer sb = new StringBuffer("Size = " + size + "\n["); int len = size-1; Object obj; - + for (int i=0; i < size; i++) { obj = elementData[i]; if (obj != null) { diff --git a/src/classes/share/javax/media/j3d/InputDevice.java b/src/classes/share/javax/media/j3d/InputDevice.java index 3f158c7..33a5933 100644 --- a/src/classes/share/javax/media/j3d/InputDevice.java +++ b/src/classes/share/javax/media/j3d/InputDevice.java @@ -52,20 +52,20 @@ public interface InputDevice { * Signifies that the driver for a device is a blocking driver and that * it should be scheduled for regular reads by Java 3D. A blocking driver * is defined as a driver that can cause the thread accessing the driver - * (the Java 3D implementation thread calling the pollAndProcessInput - * method) to block while the data is being accessed from the driver. - */ + * (the Java 3D implementation thread calling the pollAndProcessInput + * method) to block while the data is being accessed from the driver. + */ public static final int BLOCKING = 3; - /** + /** * Signifies that the driver for a device is a non-blocking driver and * that it should be scheduled for regular reads by Java 3D. A * non-blocking driver is defined as a driver that does not cause the * calling thread to block while data is being retrieved from the * driver. If no data is available from the device, pollAndProcessInput * should return without updating the sensor read value. - */ + */ public static final int NON_BLOCKING = 4; /** @@ -76,13 +76,13 @@ public interface InputDevice { * must always provide the current value of the sensor on demand whenever * pollAndProcessInput is called. This means that DEMAND_DRIVEN drivers * are non-blocking by definition. - */ + */ public static final int DEMAND_DRIVEN = 5; /** - * This method initializes the device. A device should be initialized - * before it is registered with Java 3D via the + * This method initializes the device. A device should be initialized + * before it is registered with Java 3D via the * PhysicalEnvironment.addInputDevice(InputDevice) method call. * @return return true for succesful initialization, false for failure */ @@ -90,7 +90,7 @@ public interface InputDevice { /** * This method sets the device's current position and orientation as the - * devices nominal position and orientation (establish its reference + * devices nominal position and orientation (establish its reference * frame relative to the "Tracker base" reference frame). */ public abstract void setNominalPositionAndOrientation(); @@ -98,35 +98,35 @@ public interface InputDevice { /** * This method causes the device's sensor readings to be updated by the - * device driver. For BLOCKING and NON_BLOCKING drivers, this method is - * called regularly and the Java 3D implementation can cache the sensor - * values. For DEMAND_DRIVEN drivers this method is called each time one + * device driver. For BLOCKING and NON_BLOCKING drivers, this method is + * called regularly and the Java 3D implementation can cache the sensor + * values. For DEMAND_DRIVEN drivers this method is called each time one * of the Sensor.getRead methods is called, and is not otherwise called. */ public abstract void pollAndProcessInput(); /** - * This method will not be called by the Java 3D implementation and + * This method will not be called by the Java 3D implementation and * should be implemented as an empty method. */ public abstract void processStreamInput(); /** - * Code to process the clean up of the device and relinquish associated - * resources. This method should be called after the device has been + * Code to process the clean up of the device and relinquish associated + * resources. This method should be called after the device has been * unregistered from Java 3D via the * PhysicalEnvironment.removeInputDevice(InputDevice) method call. */ public abstract void close(); - + /** - * This method retrieves the device's processing mode: one of BLOCKING, + * This method retrieves the device's processing mode: one of BLOCKING, * NON_BLOCKING, or DEMAND_DRIVEN. The Java 3D implementation calls * this method when PhysicalEnvironment.addInputDevice(InputDevice) is - * called to register the device with Java 3D. If this method returns + * called to register the device with Java 3D. If this method returns * any value other than BLOCKING, NON_BLOCKING, or DEMAND_DRIVEN, * addInputDevice will throw an IllegalArgumentException. - * @return Returns the devices processing mode, one of BLOCKING, + * @return Returns the devices processing mode, one of BLOCKING, * NON_BLOCKING, or DEMAND_DRIVEN */ public abstract int getProcessingMode(); @@ -134,10 +134,10 @@ public interface InputDevice { /** * This method sets the device's processing mode to one of: BLOCKING, - * NON_BLOCKING, or DEMAND_DRIVEN. Many drivers will be written to run - * in only one mode. Applications using such drivers should not attempt - * to set the processing mode. This method should throw an - * IllegalArgumentException if there is an attempt to set the processing + * NON_BLOCKING, or DEMAND_DRIVEN. Many drivers will be written to run + * in only one mode. Applications using such drivers should not attempt + * to set the processing mode. This method should throw an + * IllegalArgumentException if there is an attempt to set the processing * mode to anything other than the aforementioned three values. * * <p> @@ -160,13 +160,13 @@ public interface InputDevice { /** * Gets the specified Sensor associated with the device. Each InputDevice * implementation is responsible for creating and managing its own set of - * sensors. The sensor indices begin at zero and end at number of - * sensors minus one. Each sensor should have had + * sensors. The sensor indices begin at zero and end at number of + * sensors minus one. Each sensor should have had * Sensor.setDevice(InputDevice) set properly before addInputDevice * is called. * @param sensorIndex the sensor to retrieve * @return Returns the specified sensor. */ - public Sensor getSensor(int sensorIndex); + public Sensor getSensor(int sensorIndex); } diff --git a/src/classes/share/javax/media/j3d/InputDeviceBlockingThread.java b/src/classes/share/javax/media/j3d/InputDeviceBlockingThread.java index 74dd195..27505cd 100644 --- a/src/classes/share/javax/media/j3d/InputDeviceBlockingThread.java +++ b/src/classes/share/javax/media/j3d/InputDeviceBlockingThread.java @@ -70,7 +70,7 @@ class InputDeviceBlockingThread extends Thread { // yield() call should not be necessary (and may be ineffective), // but we can't call MasterControl.threadYield() because it will // sleep for at least a millisecond. - while (running) { + while (running) { while (!stop) { device.pollAndProcessInput(); Thread.yield(); diff --git a/src/classes/share/javax/media/j3d/InputDeviceScheduler.java b/src/classes/share/javax/media/j3d/InputDeviceScheduler.java index 53f5729..e3f7773 100644 --- a/src/classes/share/javax/media/j3d/InputDeviceScheduler.java +++ b/src/classes/share/javax/media/j3d/InputDeviceScheduler.java @@ -35,8 +35,8 @@ import java.util.*; /** * This thread manages all input device scheduling. It monitors and caches - * all device additions and removals. It spawns new threads for blocking - * devices, manages all non-blocking drivers itself, and tags the sensors + * all device additions and removals. It spawns new threads for blocking + * devices, manages all non-blocking drivers itself, and tags the sensors * of demand_driven devices. This implementation assume that * processMode of InputDevice will not change after addInputDevice(). * @@ -51,7 +51,7 @@ class InputDeviceScheduler extends J3dThread { ArrayList blockingDevices = new ArrayList(1); ArrayList threads = new ArrayList(1); - // This is used by MasterControl to keep track activeViewRef + // This is used by MasterControl to keep track activeViewRef PhysicalEnvironment physicalEnv; // store all inputDevices @@ -78,7 +78,7 @@ class InputDeviceScheduler extends J3dThread { return instanceNum; } - InputDeviceScheduler(ThreadGroup threadGroup, + InputDeviceScheduler(ThreadGroup threadGroup, PhysicalEnvironment physicalEnv) { super(threadGroup); setName("J3D-InputDeviceScheduler-" + getInstanceNum()); @@ -101,11 +101,11 @@ class InputDeviceScheduler extends J3dThread { switch(device.getProcessingMode()) { case InputDevice.BLOCKING: - InputDeviceBlockingThread thread = + InputDeviceBlockingThread thread = VirtualUniverse.mc.getInputDeviceBlockingThread(device); thread.start(); synchronized (blockingDevices) { - threads.add(thread); + threads.add(thread); blockingDevices.add(device); } break; @@ -120,7 +120,7 @@ class InputDeviceScheduler extends J3dThread { default: // InputDevice.DEMAND_DRIVEN: // tag the sensors for (int i=device.getSensorCount()-1; i>=0; i--) { - device.getSensor(i).demand_driven = true; + device.getSensor(i).demand_driven = true; } break; } @@ -135,7 +135,7 @@ class InputDeviceScheduler extends J3dThread { // tell the thread to clean up and permanently block synchronized (blockingDevices) { int idx = blockingDevices.indexOf(device); - InputDeviceBlockingThread thread = + InputDeviceBlockingThread thread = (InputDeviceBlockingThread) threads.remove(idx); thread.finish(); blockingDevices.remove(idx); @@ -150,10 +150,10 @@ class InputDeviceScheduler extends J3dThread { } } break; - default: // InputDevice.DEMAND_DRIVEN: + default: // InputDevice.DEMAND_DRIVEN: // untag the sensors for (int i=device.getSensorCount()-1; i>=0; i--) { - device.getSensor(i).demand_driven = false; + device.getSensor(i).demand_driven = false; } } } @@ -185,7 +185,7 @@ class InputDeviceScheduler extends J3dThread { VirtualUniverse.mc.removeInputDeviceScheduler(this); } } - + // stop all spawn threads synchronized (blockingDevices) { for (int i=threads.size()-1; i >=0; i--) { diff --git a/src/classes/share/javax/media/j3d/IntegerFreeList.java b/src/classes/share/javax/media/j3d/IntegerFreeList.java index 5558ede..0dce527 100644 --- a/src/classes/share/javax/media/j3d/IntegerFreeList.java +++ b/src/classes/share/javax/media/j3d/IntegerFreeList.java @@ -55,5 +55,5 @@ class IntegerFreeList extends MemoryFreeList { super.clear(); count = 0; } - + } diff --git a/src/classes/share/javax/media/j3d/Interpolator.java b/src/classes/share/javax/media/j3d/Interpolator.java index a053db9..ed6d2f3 100644 --- a/src/classes/share/javax/media/j3d/Interpolator.java +++ b/src/classes/share/javax/media/j3d/Interpolator.java @@ -49,15 +49,15 @@ public abstract class Interpolator extends Behavior { Alpha alpha; - /** + /** * Default WakeupCondition for all interpolators. The * wakeupOn method of Behavior, which takes a WakeupCondition as * the method parameter, will need to be called at the end * of the processStimulus method of any class that subclasses - * Interpolator; this can be done with the following method call: + * Interpolator; this can be done with the following method call: * wakeupOn(defaultWakeupCriterion). */ - protected WakeupCriterion defaultWakeupCriterion = + protected WakeupCriterion defaultWakeupCriterion = (WakeupCriterion) new WakeupOnElapsedFrames(0); @@ -116,7 +116,7 @@ public abstract class Interpolator extends Behavior { * <code>originalNode</code> into * the current node. This method is called from the * <code>cloneNode</code> method which is, in turn, called by the - * <code>cloneTree</code> method.<P> + * <code>cloneTree</code> method.<P> * * @param originalNode the original node to duplicate. * @param forceDuplicate when set to <code>true</code>, causes the @@ -134,7 +134,7 @@ public abstract class Interpolator extends Behavior { */ void duplicateAttributes(Node originalNode, boolean forceDuplicate) { super.duplicateAttributes(originalNode, forceDuplicate); - + Interpolator it = (Interpolator) originalNode; Alpha a = it.getAlpha(); diff --git a/src/classes/share/javax/media/j3d/J3DGraphics2DImpl.java b/src/classes/share/javax/media/j3d/J3DGraphics2DImpl.java index 74d7ee0..87c480e 100644 --- a/src/classes/share/javax/media/j3d/J3DGraphics2DImpl.java +++ b/src/classes/share/javax/media/j3d/J3DGraphics2DImpl.java @@ -72,7 +72,7 @@ final class J3DGraphics2DImpl extends J3DGraphics2D { // Package scope contructor J3DGraphics2DImpl(Canvas3D c) { canvas3d = c; - + synchronized (VirtualUniverse.mc.contextCreationLock) { if (c.ctx == null) { // create a dummy bufferImage @@ -80,7 +80,7 @@ final class J3DGraphics2DImpl extends J3DGraphics2D { height = 1; g3dImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); - offScreenGraphics2D = g3dImage.createGraphics(); + offScreenGraphics2D = g3dImage.createGraphics(); } else { init(); } @@ -89,7 +89,7 @@ final class J3DGraphics2DImpl extends J3DGraphics2D { } // This is invoke from Renderer callback when the first - // time createContext() finish which set + // time createContext() finish which set // canvas3d.extensionSupported correctly. void init() { // if ABGR extension is supported, we want to use @@ -100,14 +100,14 @@ final class J3DGraphics2DImpl extends J3DGraphics2D { width = canvas3d.getWidth(); height = canvas3d.getHeight(); initTexMap = false; - + if (width <= 0) { width = 1; } if (height <= 0) { height = 1; } - + synchronized (extentLock) { xmax = width; ymax = height; @@ -122,7 +122,7 @@ final class J3DGraphics2DImpl extends J3DGraphics2D { if (!abgr) { data = new byte[width*height*4]; } - + // should be the last flag to set initCtx = true; } @@ -136,19 +136,19 @@ final class J3DGraphics2DImpl extends J3DGraphics2D { * rendering to be complete before returning from this call. */ public void flush(boolean waiting) { - + if (hasBeenDisposed) { throw new IllegalStateException(J3dI18N.getString("J3DGraphics2D0")); } if (!isFlushed) { - // Composite g3dImage into Canvas3D + // Composite g3dImage into Canvas3D if (Thread.currentThread() == canvas3d.screen.renderer) { if (!initCtx) { return; - } + } doFlush(); - } else { + } else { if (!initCtx) { if (waiting && (canvas3d.pendingView != null) && @@ -166,23 +166,23 @@ final class J3DGraphics2DImpl extends J3DGraphics2D { // XXXX: may not be legal for behaviorScheduler // May cause deadlock if it is in behaviorScheduler // and we wait for Renderer to finish - boolean renderRun = (Thread.currentThread() != + boolean renderRun = (Thread.currentThread() != canvas3d.view.universe.behaviorScheduler); // This must put before sendRenderMessage() threadWaiting = true; sendRenderMessage(renderRun, GraphicsContext3D.FLUSH2D, null, - null, null); - if (waiting) { + null, null); + if (waiting) { // It is possible that thread got notify BEFORE // the following runMonitor invoke. runMonitor(J3dThread.WAIT); - } + } } isFlushed = true; } } - + // copy the data into a byte buffer that will be passed to opengl void doFlush() { assert !hasBeenDisposed; @@ -215,7 +215,7 @@ final class J3DGraphics2DImpl extends J3DGraphics2D { } copyDataToCanvas(0, 0, xmin, ymin, xmax, ymax, width, height); } else { - + runMonitor(J3dThread.NOTIFY); } // this define an empty region @@ -239,7 +239,7 @@ final class J3DGraphics2DImpl extends J3DGraphics2D { int biType = bi.getType(); int w, h, i, j; int row, rowBegin, rowInc, dstBegin; - + dstBegin = 0; rowInc = 1; rowBegin = 0; @@ -249,17 +249,17 @@ final class J3DGraphics2DImpl extends J3DGraphics2D { (biType == BufferedImage.TYPE_INT_RGB)) { // optimized cases rowBegin = y1; - + int colBegin = x1; - + int[] intData = ((DataBufferInt)bi.getRaster().getDataBuffer()).getData(); int rowOffset = rowInc * width; int intPixel; - + rowBegin = rowBegin*width + colBegin; dstBegin = rowBegin*4; - + if (biType == BufferedImage.TYPE_INT_ARGB) { for (h = y1; h < y2; h++) { i = rowBegin; @@ -274,7 +274,7 @@ final class J3DGraphics2DImpl extends J3DGraphics2D { rowBegin += rowOffset; dstBegin += (rowOffset*4); } - } else { + } else { for (h = y1; h < y2; h++) { i = rowBegin; j = dstBegin; @@ -291,7 +291,7 @@ final class J3DGraphics2DImpl extends J3DGraphics2D { } } else { // non-optimized cases - WritableRaster ras = bi.getRaster(); + WritableRaster ras = bi.getRaster(); ColorModel cm = bi.getColorModel(); Object pixel = ImageComponentRetained.getDataElementBuffer(ras); @@ -346,7 +346,7 @@ final class J3DGraphics2DImpl extends J3DGraphics2D { validate(0, 0, width, height); } - void validate(float x1, float y1, float x2, float y2, + void validate(float x1, float y1, float x2, float y2, AffineTransform xform) { float t; @@ -359,7 +359,7 @@ final class J3DGraphics2DImpl extends J3DGraphics2D { ptSrc.x = x2; ptSrc.y = y2; xform.transform(ptSrc, ptDst2); - + if (ptDst1.x > ptDst2.x) { t = ptDst1.x; ptDst1.x = ptDst2.x; @@ -386,7 +386,7 @@ final class J3DGraphics2DImpl extends J3DGraphics2D { } } if (doResize) { - synchronized (VirtualUniverse.mc.contextCreationLock) { + synchronized (VirtualUniverse.mc.contextCreationLock) { Graphics2D oldOffScreenGraphics2D = offScreenGraphics2D; initCtx = false; init(); @@ -399,8 +399,8 @@ final class J3DGraphics2DImpl extends J3DGraphics2D { tr.transform(ptSrc, ptDst1); ptSrc.x = x2; ptSrc.y = y2; - tr.transform(ptSrc, ptDst2); - + tr.transform(ptSrc, ptDst2); + synchronized (extentLock) { if (ptDst1.x < xmin) { xmin = (int) ptDst1.x; @@ -417,10 +417,10 @@ final class J3DGraphics2DImpl extends J3DGraphics2D { } } } - + void copyGraphics2D(Graphics2D oldg) { // restore the original setting of Graphics2D when resizing the windows - setColor(oldg.getColor()); + setColor(oldg.getColor()); setFont(oldg.getFont()); setClip(oldg.getClip()); setComposite(oldg.getComposite()); @@ -429,8 +429,8 @@ final class J3DGraphics2DImpl extends J3DGraphics2D { setStroke(oldg.getStroke()); if (xOrModeColor != null) { setXORMode(xOrModeColor); - } - + } + } // Implementation of Graphics2D methods @@ -452,7 +452,7 @@ final class J3DGraphics2DImpl extends J3DGraphics2D { public String toString() { return offScreenGraphics2D.toString(); - + } public final AffineTransform getTransform() { @@ -513,7 +513,7 @@ final class J3DGraphics2DImpl extends J3DGraphics2D { validate(0, 0, img.getWidth(obs), img.getHeight(obs), xform); return offScreenGraphics2D.drawImage(img, xform, obs); } - + public final void drawImage(BufferedImage img, BufferedImageOp op, int x, int y) { if (op != null) { @@ -522,17 +522,17 @@ final class J3DGraphics2DImpl extends J3DGraphics2D { validate(x, y, x+img.getWidth(), y+img.getHeight()); offScreenGraphics2D.drawImage(img, null, x, y); } - + public final boolean drawImage(Image img, int x, int y, ImageObserver observer) { - validate(x, y, - x + img.getWidth(observer), + validate(x, y, + x + img.getWidth(observer), y + img.getWidth(observer)); return offScreenGraphics2D.drawImage(img, x, y, observer); } - + public final boolean drawImage(Image img, int x, int y, int width, int height, ImageObserver observer) { @@ -540,7 +540,7 @@ final class J3DGraphics2DImpl extends J3DGraphics2D { return offScreenGraphics2D.drawImage(img, x, y, width, height, observer); } - + public final boolean drawImage(Image img, int x, int y, int width, int height, Color bgcolor, @@ -555,7 +555,7 @@ final class J3DGraphics2DImpl extends J3DGraphics2D { int sx1, int sy1, int sx2, int sy2, ImageObserver observer) { validate(dx1, dy1, dx2, dy2); - offScreenGraphics2D.drawImage(img, dx1, dy1, dx2, dy2, sx1, sy1, + offScreenGraphics2D.drawImage(img, dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2, observer); } @@ -564,7 +564,7 @@ final class J3DGraphics2DImpl extends J3DGraphics2D { int sx1, int sy1, int sx2, int sy2, ImageObserver observer) { validate(dx1, dy1, dx2, dy2); - return offScreenGraphics2D.drawImage(img, dx1, dy1, dx2, dy2, sx1, sy1, + return offScreenGraphics2D.drawImage(img, dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2, observer); } @@ -574,7 +574,7 @@ final class J3DGraphics2DImpl extends J3DGraphics2D { Color bgcolor, ImageObserver observer) { validate(dx1, dy1, dx2, dy2); - return offScreenGraphics2D.drawImage(img, dx1, dy1, dx2, dy2, sx1, sy1, + return offScreenGraphics2D.drawImage(img, dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2, bgcolor, observer); } @@ -605,8 +605,8 @@ final class J3DGraphics2DImpl extends J3DGraphics2D { public final void draw(Shape s) { Rectangle rect = s.getBounds(); - validate(rect.x, rect.y, - rect.x + rect.width, + validate(rect.x, rect.y, + rect.x + rect.width, rect.y + rect.height); offScreenGraphics2D.draw(s); } @@ -712,7 +712,7 @@ final class J3DGraphics2DImpl extends J3DGraphics2D { float x1 = (float) bounds.getX(); float y1 = (float) bounds.getY(); validate(x1+x, y1+y, - x1 + x + (float) bounds.getWidth(), + x1 + x + (float) bounds.getWidth(), y1 + y + (float) bounds.getHeight()); offScreenGraphics2D.drawString(s, x, y); @@ -745,7 +745,7 @@ final class J3DGraphics2DImpl extends J3DGraphics2D { int arcWidth, int arcHeight) { // XXXX: call validate with bounding box of primitive validate(); - offScreenGraphics2D.fillRoundRect(x, y, width, height, arcWidth, + offScreenGraphics2D.fillRoundRect(x, y, width, height, arcWidth, arcHeight); } @@ -844,7 +844,7 @@ final class J3DGraphics2DImpl extends J3DGraphics2D { validate(); offScreenGraphics2D.drawBytes(data, offset, length, x, y); } - + public void drawChars(char data[], int offset, int length, int x, int y) { // XXXX: call validate with bounding box of primitive validate(); @@ -952,15 +952,15 @@ final class J3DGraphics2DImpl extends J3DGraphics2D { if (Thread.currentThread() == canvas3d.screen.renderer) { doDrawAndFlushImage(img, x, y, observer); - } else { + } else { // Behavior Scheduler or other threads // XXXX: may not be legal for behaviorScheduler // May cause deadlock if it is in behaviorScheduler // and we wait for Renderer to finish - boolean renderRun = (Thread.currentThread() != + boolean renderRun = (Thread.currentThread() != canvas3d.view.universe.behaviorScheduler); sendRenderMessage(renderRun, GraphicsContext3D.DRAWANDFLUSH2D, - img, new Point(x, y), observer); + img, new Point(x, y), observer); } } @@ -1004,7 +1004,7 @@ final class J3DGraphics2DImpl extends J3DGraphics2D { } else { x1 = 0; } - + if (py + imgHeight > height) { y2 = height - py; } else { @@ -1024,13 +1024,13 @@ final class J3DGraphics2DImpl extends J3DGraphics2D { } - + void copyDataToCanvas(int px, int py, int x1, int y1, int x2, int y2, int w, int h) { try { if (!canvas3d.drawingSurfaceObject.renderLock()) { return; - } + } if (!initTexMap) { if (objectId == -1) { @@ -1038,7 +1038,7 @@ final class J3DGraphics2DImpl extends J3DGraphics2D { } texWidth = getGreaterPowerOf2(w); texHeight = getGreaterPowerOf2(h); - + // Canvas got resize, need to init texture map again // in Renderer thread if (!canvas3d.initTexturemapping(canvas3d.ctx, @@ -1050,8 +1050,8 @@ final class J3DGraphics2DImpl extends J3DGraphics2D { VirtualUniverse.mc.freeTexture2DId(objectId); objectId = -1; // TODO : Need to find a better way to report no resource problem --- Chien. - System.err.println("J3DGraphics2DImpl.copyDataToCanvas() : Fail to get texture resources ..."); - + System.err.println("J3DGraphics2DImpl.copyDataToCanvas() : Fail to get texture resources ..."); + } else { initTexMap = true; } @@ -1064,7 +1064,7 @@ final class J3DGraphics2DImpl extends J3DGraphics2D { ImageComponentRetained.TYPE_BYTE_RGBA), objectId, data, width, height); } - + canvas3d.drawingSurfaceObject.unLock(); } catch (NullPointerException ne) { canvas3d.drawingSurfaceObject.unLock(); diff --git a/src/classes/share/javax/media/j3d/J3dDebug.java b/src/classes/share/javax/media/j3d/J3dDebug.java index 8eec3bd..bc8f06e 100644 --- a/src/classes/share/javax/media/j3d/J3dDebug.java +++ b/src/classes/share/javax/media/j3d/J3dDebug.java @@ -34,7 +34,7 @@ package javax.media.j3d; class J3dDebug { // For production release devPhase is set to false. - + // Do no debugging. static final int NO_DEBUG = 0; @@ -68,7 +68,7 @@ class J3dDebug { // devPhase is put before debug, smart compiler will not include // code_segment when devPhase is false. static boolean debug; - + // Class debug variable, there is one debug variable per class. // Set one of the 5 debug levels to the class debug variable when // debugging. @@ -330,7 +330,7 @@ class J3dDebug { // switch is a reserved word. static final int Switch = !devPhase?NO_DEBUG:NO_DEBUG; static final int switchRetained = !devPhase?NO_DEBUG:NO_DEBUG; - static final int switchValueInterpolator = !devPhase?NO_DEBUG:NO_DEBUG; + static final int switchValueInterpolator = !devPhase?NO_DEBUG:NO_DEBUG; static final int table = !devPhase?NO_DEBUG:NO_DEBUG; static final int texCoordGeneration = !devPhase?NO_DEBUG:NO_DEBUG; static final int texCoordGenerationRetained = !devPhase?NO_DEBUG:NO_DEBUG; @@ -360,7 +360,7 @@ class J3dDebug { static final int triangleFanArray = !devPhase?NO_DEBUG:NO_DEBUG; static final int triangleFanArrayRetained = !devPhase?NO_DEBUG:NO_DEBUG; static final int triangleStripArray = !devPhase?NO_DEBUG:NO_DEBUG; - static final int triangleStripArrayRetained = !devPhase?NO_DEBUG:NO_DEBUG; + static final int triangleStripArrayRetained = !devPhase?NO_DEBUG:NO_DEBUG; static final int unorderList = !devPhase?NO_DEBUG:NO_DEBUG; static final int vertexArrayRenderMethod = !devPhase?NO_DEBUG:NO_DEBUG; static final int view = !devPhase?NO_DEBUG:NO_DEBUG; @@ -391,7 +391,7 @@ class J3dDebug { static final int wakeupOr = !devPhase?NO_DEBUG:NO_DEBUG; static final int wakeupOrOfAnds = !devPhase?NO_DEBUG:NO_DEBUG; - + static boolean doDebug(int j3dClassLevel, int level, String str) { if(j3dClassLevel >= level) { System.err.print(str); @@ -416,10 +416,10 @@ class J3dDebug { static void pkgInfo(ClassLoader classLoader, String pkgName, String className) { - + try { classLoader.loadClass(pkgName + "." + className); - + Package p = Package.getPackage(pkgName); if (p == null) { System.err.println("WARNING: Package.getPackage(" + @@ -451,7 +451,7 @@ class J3dDebug { // System.err.println(); } - + static { // initialize the debug flag debug = false; diff --git a/src/classes/share/javax/media/j3d/J3dMessage.java b/src/classes/share/javax/media/j3d/J3dMessage.java index e5a7302..1ba60e2 100644 --- a/src/classes/share/javax/media/j3d/J3dMessage.java +++ b/src/classes/share/javax/media/j3d/J3dMessage.java @@ -76,8 +76,8 @@ class J3dMessage extends Object { static final int ORDERED_GROUP_INSERTED = 32; static final int ORDERED_GROUP_REMOVED = 33; static final int COLLISION_BOUND_CHANGED = 34; - static final int REGION_BOUND_CHANGED = 35; - static final int MODELCLIP_CHANGED = 36; + static final int REGION_BOUND_CHANGED = 35; + static final int MODELCLIP_CHANGED = 36; static final int BOUNDS_AUTO_COMPUTE_CHANGED = 37; static final int SOUND_ATTRIB_CHANGED = 38; static final int AURALATTRIBUTES_CHANGED = 39; @@ -93,8 +93,8 @@ class J3dMessage extends Object { static final int BEHAVIOR_ACTIVATE = 49; static final int GEOMETRYARRAY_CHANGED = 50; static final int MEDIA_CONTAINER_CHANGED = 51; - static final int RESIZE_CANVAS = 52; - static final int TOGGLE_CANVAS = 53; + static final int RESIZE_CANVAS = 52; + static final int TOGGLE_CANVAS = 53; static final int IMAGE_COMPONENT_CHANGED = 54; static final int SCHEDULING_INTERVAL_CHANGED = 55; static final int VIEWSPECIFICGROUP_CHANGED = 56; @@ -116,12 +116,12 @@ class J3dMessage extends Object { long time = -1; /** - * This is the number of references to this message + * This is the number of references to this message */ private int refcount = 0; /** - * This is a bitmask of the types of threads that need to be run + * This is a bitmask of the types of threads that need to be run * once this message is consumed. */ int threads = 0; @@ -138,7 +138,7 @@ class J3dMessage extends Object { /** * This holds the target view of this message, null means all views - */ + */ View view = null; diff --git a/src/classes/share/javax/media/j3d/J3dNodeTable.java b/src/classes/share/javax/media/j3d/J3dNodeTable.java index 9a41b5c..4433b9d 100644 --- a/src/classes/share/javax/media/j3d/J3dNodeTable.java +++ b/src/classes/share/javax/media/j3d/J3dNodeTable.java @@ -75,7 +75,7 @@ class J3dNodeTable { static final int ORDERED_GROUP = 4; static final int BRANCH_GROUP = 5; static final int ENDGROUP = 9; // denotes done with group - + // 10 - 19: Shape3D (in a class by itself) static final int SHAPE3D = 10; @@ -97,7 +97,7 @@ class J3dNodeTable { static final int IMAGE_COMPONENT_2D = 34; static final int IMAGE_COMPONENT_3D = 35; static final int ENDAPPEARANCE = 49; - + // 100 - 149: All Geometry types static final int GEOMETRY = 100; static final int COMPRESSED_GEOMETRY = 101; @@ -145,7 +145,7 @@ class J3dNodeTable { static final int BOUNDING_POLYTOPE = 173; static final int TRANSFORM3D = 180; static final int BACKGROUND = 181; - + // 190 - 199: Lights static final int LIGHT = 190; static final int POINT_LIGHT = 191; @@ -153,7 +153,7 @@ class J3dNodeTable { static final int DIRECTIONAL_LIGHT = 193; static final int AMBIENT_LIGHT = 194; - + /** * Constructs this Object, which initializes the array and Hashtable */ @@ -170,13 +170,13 @@ class J3dNodeTable { nodeArray[BRANCH_GROUP] = "BranchGroup"; nodeArray[SHAPE3D] = "Shape3D"; - + nodeArray[APPEARANCE] = "Appearance"; nodeArray[MATERIAL] = "Material"; - nodeArray[TEXTURE] = "Texture"; + nodeArray[TEXTURE] = "Texture"; nodeArray[TEXTURE_2D] = "Texture2D"; nodeArray[TEXTURE_3D] = "Texture3D"; - nodeArray[IMAGE_COMPONENT] = "ImageComponent"; + nodeArray[IMAGE_COMPONENT] = "ImageComponent"; nodeArray[IMAGE_COMPONENT_2D] = "ImageComponent2D"; nodeArray[IMAGE_COMPONENT_3D] = "ImageComponent3D"; nodeArray[TRANSPARENCY_ATTRIBUTES] = "TransparencyAttributes"; @@ -217,7 +217,7 @@ class J3dNodeTable { nodeArray[SCALE_INTERPOLATOR] = "ScaleInterpolator"; nodeArray[SOUND_PLAYER] = "SoundPlayer"; nodeArray[SOUND_FADER] = "SoundFader"; - + nodeArray[BOUNDS] = "Bounds"; nodeArray[BOUNDING_SPHERE] = "BoundingSphere"; nodeArray[BOUNDING_BOX] = "BoundingBox"; @@ -230,7 +230,7 @@ class J3dNodeTable { nodeArray[SPOT_LIGHT] = "SpotLight"; nodeArray[DIRECTIONAL_LIGHT] = "DirectionalLight"; nodeArray[AMBIENT_LIGHT] = "AmbientLight"; - + for (int i = 0; i < MAX_NUM_NODES; ++i) { if (nodeArray[i] != null) nodeTable.put(nodeArray[i], new Integer(i)); @@ -256,7 +256,7 @@ class J3dNodeTable { if ((lastIndex = fullName.lastIndexOf("Retained")) == -1) lastIndex = fullName.length(); String nodeName = fullName.substring(firstIndex, lastIndex); - if ((i = (Integer)nodeTable.get(nodeName)) + if ((i = (Integer)nodeTable.get(nodeName)) != null) { return i.intValue(); } diff --git a/src/classes/share/javax/media/j3d/J3dStructure.java b/src/classes/share/javax/media/j3d/J3dStructure.java index aac6dcc..2ce0b5c 100644 --- a/src/classes/share/javax/media/j3d/J3dStructure.java +++ b/src/classes/share/javax/media/j3d/J3dStructure.java @@ -35,7 +35,7 @@ import java.util.ArrayList; import java.util.Arrays; /** - * The J3dStructure is the super class of all structures in Java 3D. + * The J3dStructure is the super class of all structures in Java 3D. * A structure is a object that organizes a collection of objects. */ @@ -144,13 +144,13 @@ abstract class J3dStructure extends Object { nMessage = 0; msgList = new J3dMessage[5]; } - + } int getNumMessage() { return nMessage; } - + /** * This gets overriden by the structure */ @@ -161,12 +161,12 @@ abstract class J3dStructure extends Object { * for final cleanup. DON'T decrememt message count in * the method, as it is done by MasterControl. */ - abstract void removeNodes(J3dMessage m); + abstract void removeNodes(J3dMessage m); /** * Release resource associate with this structure before GC - * We need to clear all those IndexedUnorderSet/WakeupIndexedList + * We need to clear all those IndexedUnorderSet/WakeupIndexedList * so that the listIdx associate with IndexedObject reset to -1. */ - abstract void cleanup(); + abstract void cleanup(); } diff --git a/src/classes/share/javax/media/j3d/J3dThread.java b/src/classes/share/javax/media/j3d/J3dThread.java index 63e4e6b..42d9c12 100644 --- a/src/classes/share/javax/media/j3d/J3dThread.java +++ b/src/classes/share/javax/media/j3d/J3dThread.java @@ -54,7 +54,7 @@ abstract class J3dThread extends Thread { static final int UPDATE_TRANSFORM = 0x2000; /** - * The classification types. + * The classification types. */ static final int WORK_THREAD = 0x01; static final int UPDATE_THREAD = 0x02; @@ -65,7 +65,7 @@ abstract class J3dThread extends Thread { static final int WAIT = 0; /** - * This runMonitor action notifies MasterControl that this thread + * This runMonitor action notifies MasterControl that this thread * has completed and wait. */ static final int NOTIFY_AND_WAIT = 1; @@ -77,7 +77,7 @@ abstract class J3dThread extends Thread { static final int NOTIFY = 2; /** - * This runMonitor action tells the thread to run N number of + * This runMonitor action tells the thread to run N number of * iterations. */ static final int RUN = 2; @@ -96,7 +96,7 @@ abstract class J3dThread extends Thread { * This indicates that this thread is alive and running */ private volatile boolean running = true; - + /** * This flag is set by the RUN action of runMonitor to indicate that the * waiting thread has work to do. @@ -184,7 +184,7 @@ abstract class J3dThread extends Thread { J3dThreadData threadData; int i, j; J3dThreadData[] newData; - + if (type != RENDER_THREAD) { // Regular Thread if (data == null) { data = new J3dThreadData[1]; @@ -211,7 +211,7 @@ abstract class J3dThread extends Thread { threadData = data[0]; } else { for (i=0; i<data.length; i++) { - if (data[i].view == v && data[i].canvas == c) { + if (data[i].view == v && data[i].canvas == c) { break; } } @@ -237,7 +237,7 @@ abstract class J3dThread extends Thread { args[3] = null; } } - + } return (threadData); @@ -254,7 +254,7 @@ abstract class J3dThread extends Thread { } } - /** + /** * This causes the threads run method to exit. */ void finish() { @@ -340,7 +340,7 @@ abstract class J3dThread extends Thread { // default resource clean up method void shutdown() { } - + void cleanup() { active = false; running = true; @@ -352,7 +352,7 @@ abstract class J3dThread extends Thread { args = null; userStop = false; referenceTime = 0; - + } } diff --git a/src/classes/share/javax/media/j3d/J3dThreadData.java b/src/classes/share/javax/media/j3d/J3dThreadData.java index 6284bc9..87f2d71 100644 --- a/src/classes/share/javax/media/j3d/J3dThreadData.java +++ b/src/classes/share/javax/media/j3d/J3dThreadData.java @@ -32,7 +32,7 @@ package javax.media.j3d; /** - * The J3dThreadData is the data wrapper for threads in Java 3D. + * The J3dThreadData is the data wrapper for threads in Java 3D. */ class J3dThreadData extends Object { @@ -44,7 +44,7 @@ class J3dThreadData extends Object { static final int WAIT_THIS_THREAD = 0x04; static final int START_TIMER = 0x08; static final int STOP_TIMER = 0x10; - static final int LAST_STOP_TIMER = 0x20; + static final int LAST_STOP_TIMER = 0x20; //static final int LOCK_RENDERBIN = 0x20; //static final int RELEASE_RENDERBIN = 0x40; diff --git a/src/classes/share/javax/media/j3d/LOD.java b/src/classes/share/javax/media/j3d/LOD.java index 10b3a8f..0128175 100644 --- a/src/classes/share/javax/media/j3d/LOD.java +++ b/src/classes/share/javax/media/j3d/LOD.java @@ -108,7 +108,7 @@ public abstract class LOD extends Behavior { /** * Returns the enumeration object of all switches. * @return the enumeration object of all switches - */ + */ public Enumeration getAllSwitches() { return switches.elements(); } @@ -173,7 +173,7 @@ public abstract class LOD extends Behavior { * <code>originalNode</code> into * the current node. This method is called from the * <code>cloneNode</code> method which is, in turn, called by the - * <code>cloneTree</code> method.<P> + * <code>cloneTree</code> method.<P> * * @param originalNode the original node to duplicate. * @param forceDuplicate when set to <code>true</code>, causes the @@ -191,7 +191,7 @@ public abstract class LOD extends Behavior { */ void duplicateAttributes(Node originalNode, boolean forceDuplicate) { super.duplicateAttributes(originalNode, forceDuplicate); - + LOD lod = (LOD) originalNode; int numSwitch = lod.numSwitches(); diff --git a/src/classes/share/javax/media/j3d/Light.java b/src/classes/share/javax/media/j3d/Light.java index d4c1283..2e591ad 100644 --- a/src/classes/share/javax/media/j3d/Light.java +++ b/src/classes/share/javax/media/j3d/Light.java @@ -35,12 +35,12 @@ import javax.vecmath.Color3f; import java.util.Enumeration; /** - * The Light leaf node is an abstract class that defines a set of + * The Light leaf node is an abstract class that defines a set of * parameters common to all * types of light. These parameters include the light color, an enable * flag, and a region of influence in which this Light node is active. * A Light node also contains a list of Group nodes that specifies the - * hierarchical scope of this Light. If the scope list is empty, + * hierarchical scope of this Light. If the scope list is empty, * the Light node has universe scope: all nodes within the region of * influence are affected by this Light node. If the scope list is * non-empty, only those Leaf nodes under the Group nodes in the @@ -60,7 +60,7 @@ import java.util.Enumeration; * <b>Light Color</b> * <p> * The Java 3D lighting model approximates the way light works in - * the real world. Light is defined in terms of the red, green, and + * the real world. Light is defined in terms of the red, green, and * blue components that combine to create the light color. The * three color components represent the amount of light emitted * by the source. @@ -77,12 +77,12 @@ import java.util.Enumeration; * red and green but no blue, produces a yellow light. * <p> * If a scene has multiple lights and all lights illuminate an object, - * the effect of the light on the object is the sum of the - * lights. For example, in a scene with two lights, if the first - * light emits (R<sub>1</sub>, G<sub>1</sub>, B<sub>1</sub>) and - * the second light emits (R<sub>2</sub>, G<sub>2</sub>, - * B<sub>2</sub>), the components are added together giving - * (R<sub>1</sub>+R<sub>2</sub>, G<sub>1</sub>+G<sub>2</sub>, + * the effect of the light on the object is the sum of the + * lights. For example, in a scene with two lights, if the first + * light emits (R<sub>1</sub>, G<sub>1</sub>, B<sub>1</sub>) and + * the second light emits (R<sub>2</sub>, G<sub>2</sub>, + * B<sub>2</sub>), the components are added together giving + * (R<sub>1</sub>+R<sub>2</sub>, G<sub>1</sub>+G<sub>2</sub>, * B<sub>1</sub>+B<sub>2</sub>). * If the sums of any of the color values is greater than 1.0, * brighter than the maximum brightness permitted, the color value is @@ -103,15 +103,15 @@ import java.util.Enumeration; * <p> * The surface of each object in the scene has * certain material properties that define how light affects its - * appearance. The object might reflect light in various ways, + * appearance. The object might reflect light in various ways, * depending on the object's surface type. The object - * might even emit its own light. The Java 3D lighting model specifies + * might even emit its own light. The Java 3D lighting model specifies * these material properties as five independent components: emitted * color, ambient color, diffuse color, specular color, and shininess. - * All of these properties are computed independently, then added + * All of these properties are computed independently, then added * together to define how the surface of the object appears under - * light (an exception is Ambient light, which does not contribute - * to specular reflection). The material properties are defined + * light (an exception is Ambient light, which does not contribute + * to specular reflection). The material properties are defined * in the Material class. * <p> * <b>Influencing Bounds</b> @@ -126,11 +126,11 @@ import java.util.Enumeration; * should both objects be set. * <p> * A Bounds object represents a convex, closed volume. Bounds - * defines three different types of containing - * volumes: an axis-aligned-box volume, a spherical volume, and a + * defines three different types of containing + * volumes: an axis-aligned-box volume, a spherical volume, and a * bounding polytope. A BoundingLeaf object also specifies a region - * of influence, but allows an application to specify a bounding - * region in one coordinate system (the local coordinate system of + * of influence, but allows an application to specify a bounding + * region in one coordinate system (the local coordinate system of * the BoundingLeaf node) other than the local coordinate * system of the node that references the bounds (the Light). * <p> @@ -140,7 +140,7 @@ import java.util.Enumeration; * region of a scene, lighting can also be limited to groups of * nodes, defined by a Group object. This is known as "scoping." * All nodes attached to a Group node define a <i>list of scopes</i>. - * Methods in the Light class permit the setting, addition, insertion, + * Methods in the Light class permit the setting, addition, insertion, * removal, and enumeration of nodes in the list of scopes. * <p> * <b>Two-sided Lighting of Polygons</b> @@ -167,14 +167,14 @@ import java.util.Enumeration; * <p> * If lighting is not enabled, the current color of an * object in the scene is simply mapped onto the object, and none of - * the lighting equations regarding Material properties, such as ambient + * the lighting equations regarding Material properties, such as ambient * color, diffuse color, specular color, and shininess, are performed. * However, an object's emitted color, if specified and enabled, will * still affect that object's appearance. * <p> * To disable lighting, call setEnable with <code>false</code> as * the argument. - * + * * @see Material * @see Bounds * @see BoundingLeaf @@ -246,7 +246,7 @@ public abstract class Light extends Leaf { ALLOW_INFLUENCING_BOUNDS_READ, ALLOW_SCOPE_READ }; - + /** * Constructs a Light node with default parameters. The default * values are as follows: @@ -299,7 +299,7 @@ public abstract class Light extends Leaf { if(!this.getCapability(ALLOW_STATE_WRITE)) throw new CapabilityNotSetException(J3dI18N.getString("Light0")); - if (isLive()) + if (isLive()) ((LightRetained)this.retained).setEnable(state); else ((LightRetained)this.retained).initEnable(state); @@ -409,8 +409,8 @@ public abstract class Light extends Leaf { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_SCOPE_WRITE)) throw new CapabilityNotSetException(J3dI18N.getString("Light6")); - - if (isLive()) + + if (isLive()) ((LightRetained)this.retained).insertScope(scope, index); else ((LightRetained)this.retained).initInsertScope(scope, index); @@ -645,7 +645,7 @@ public abstract class Light extends Leaf { * <code>originalNode</code> into * the current node. This method is called from the * <code>cloneNode</code> method which is, in turn, called by the - * <code>cloneTree</code> method.<P> + * <code>cloneTree</code> method.<P> * * @param originalNode the original node to duplicate. * @param forceDuplicate when set to <code>true</code>, causes the @@ -663,7 +663,7 @@ public abstract class Light extends Leaf { */ void duplicateAttributes(Node originalNode, boolean forceDuplicate) { super.duplicateAttributes(originalNode, forceDuplicate); - + LightRetained attr = (LightRetained) originalNode.retained; LightRetained rt = (LightRetained) retained; @@ -677,7 +677,7 @@ public abstract class Light extends Leaf { // this reference will set correctly in updateNodeReferences() callback rt.initAddScope((Group) elm.nextElement()); } - + // this reference will set correctly in updateNodeReferences() callback rt.initInfluencingBoundingLeaf(attr.getInfluencingBoundingLeaf()); diff --git a/src/classes/share/javax/media/j3d/LightBin.java b/src/classes/share/javax/media/j3d/LightBin.java index 8ebff0e..20b06dc 100644 --- a/src/classes/share/javax/media/j3d/LightBin.java +++ b/src/classes/share/javax/media/j3d/LightBin.java @@ -55,7 +55,7 @@ class LightBin extends Object implements ObjectUpdate { LightRetained[] lights = null; /** - * An Array of reference counts for shared lights in + * An Array of reference counts for shared lights in * among EnvirionmentSets */ int[] lightsRef = null; @@ -95,7 +95,7 @@ class LightBin extends Object implements ObjectUpdate { int canvasDirty = 0; /** - * lightDirty Mask cache , used to + * lightDirty Mask cache , used to * mark the lightdirty bits for next frame */ int lightDirtyMaskCache = 0; @@ -106,8 +106,8 @@ class LightBin extends Object implements ObjectUpdate { */ int lightDirtyMask = 0; - /** - * List of pointLts in this lightbin + /** + * List of pointLts in this lightbin * Need to reload these lights when vworld scale changes */ ArrayList pointLts = new ArrayList(); @@ -161,7 +161,7 @@ class LightBin extends Object implements ObjectUpdate { numEsLights = e.lights.size(); slotsNeeded = numEsLights; - for (i=0; i<numEsLights; i++) { + for (i=0; i<numEsLights; i++) { light = (LightRetained) e.lights.get(i); if (light instanceof AmbientLightRetained) { continue; @@ -186,7 +186,7 @@ class LightBin extends Object implements ObjectUpdate { void addEnvironmentSet(EnvironmentSet e, RenderBin rb) { int i, j, numEsLights; LightRetained light; - + numEsLights = e.lights.size(); for (i=0; i<numEsLights; i++) { light = (LightRetained) e.lights.get(i); @@ -222,8 +222,8 @@ class LightBin extends Object implements ObjectUpdate { if (pointLtsSlotIndex != null) pointLtsSlotIndexLen = pointLtsSlotIndex.length; if (pointLtsSlotIndexLen < pointLts.size()) { - - int[] newIndexList = + + int[] newIndexList = new int[pointLtsSlotIndexLen + 8]; for (int x = 0; x < pointLtsSlotIndexLen; x++) { newIndexList[x] = pointLtsSlotIndex[x]; @@ -271,7 +271,7 @@ class LightBin extends Object implements ObjectUpdate { environmentSetList.prev = e; environmentSetList = e; } - for (i = 1; i < insertEnvSet.size(); i++) { + for (i = 1; i < insertEnvSet.size(); i++) { e = (EnvironmentSet)insertEnvSet.get(i); e.next = environmentSetList; environmentSetList.prev = e; @@ -293,7 +293,7 @@ class LightBin extends Object implements ObjectUpdate { } onUpdateList = false; } - + /** @@ -342,9 +342,9 @@ class LightBin extends Object implements ObjectUpdate { e.next.prev = e.prev; } } - + // Mark all canvases that uses this environment set as - Canvas3D canvases[] = renderBin.view.getCanvases(); + Canvas3D canvases[] = renderBin.view.getCanvases(); for (i = 0; i < canvases.length; i++) { // Mark the environmentSet cached by all the canvases as null // to force to reEvaluate when it comes back from the freelist @@ -357,7 +357,7 @@ class LightBin extends Object implements ObjectUpdate { } e.prev = null; e.next = null; - + if (environmentSetList == null && insertEnvSet.size() == 0) { renderBin.removeLightBin(this); geometryBackground = null; @@ -387,8 +387,8 @@ class LightBin extends Object implements ObjectUpdate { int frameCount = VirtualUniverse.mc.frameCount; - // TODO: When working on issue 15 and 88, we realise that the - // logic in this method flaw. As we are ready into 1.3.2beta1 + // TODO: When working on issue 15 and 88, we realise that the + // logic in this method flaw. As we are ready into 1.3.2beta1 // phase, and there isn't an existing issue related to the logic // error in method, we decided not to fix it for now. This method // should have the logic as in EnvironmentSet.updateAttributes(); @@ -399,18 +399,18 @@ class LightBin extends Object implements ObjectUpdate { if (geometryBackground == null) { scale = cv.canvasViewCache.getVworldToCoexistenceScale(); - cv.setModelViewMatrix(cv.ctx, cv.vpcToEc.mat, + cv.setModelViewMatrix(cv.ctx, cv.vpcToEc.mat, renderBin.vworldToVpc); } else { scale = cv.canvasViewCache.getInfVworldToCoexistenceScale(); - cv.setModelViewMatrix(cv.ctx, cv.vpcToEc.mat, + cv.setModelViewMatrix(cv.ctx, cv.vpcToEc.mat, renderBin.infVworldToVpc); - } + } for (i=0; i<maxLights; i++) { if (lights[i] != null) { - if (cv.lights[i] != lights[i] || + if (cv.lights[i] != lights[i] || cv.frameCount[i] != frameCount) { cv.lights[i] = lights[i]; cv.frameCount[i] = frameCount; @@ -423,18 +423,18 @@ class LightBin extends Object implements ObjectUpdate { // invalidate canvas cached enableMask cv.enableMask = -1; } - // across frames + // across frames else if ((cv.canvasDirty & Canvas3D.LIGHTBIN_DIRTY) != 0) { // Just update the dirty lights if (geometryBackground == null) { scale = cv.canvasViewCache.getVworldToCoexistenceScale(); - cv.setModelViewMatrix(cv.ctx, cv.vpcToEc.mat, + cv.setModelViewMatrix(cv.ctx, cv.vpcToEc.mat, renderBin.vworldToVpc); } else { scale = cv.canvasViewCache.getInfVworldToCoexistenceScale(); - cv.setModelViewMatrix(cv.ctx, cv.vpcToEc.mat, + cv.setModelViewMatrix(cv.ctx, cv.vpcToEc.mat, renderBin.infVworldToVpc); - } + } i = 0; int mask = lightDirtyMask; while (mask != 0) { @@ -446,19 +446,19 @@ class LightBin extends Object implements ObjectUpdate { mask >>= 1; i++; } - + cv.canvasDirty &= ~Canvas3D.LIGHTBIN_DIRTY; } else if ((pointLts.size() > 0) && ((cv.canvasDirty & Canvas3D.VIEW_MATRIX_DIRTY) != 0 )) { if (geometryBackground == null) { scale = cv.canvasViewCache.getVworldToCoexistenceScale(); - cv.setModelViewMatrix(cv.ctx, cv.vpcToEc.mat, + cv.setModelViewMatrix(cv.ctx, cv.vpcToEc.mat, renderBin.vworldToVpc); } else { scale = cv.canvasViewCache.getInfVworldToCoexistenceScale(); - cv.setModelViewMatrix(cv.ctx, cv.vpcToEc.mat, + cv.setModelViewMatrix(cv.ctx, cv.vpcToEc.mat, renderBin.infVworldToVpc); - } + } for (i = 0; i < pointLts.size(); i++) { LightRetained lt = (LightRetained) pointLts.get(i); lt.update(cv.ctx, pointLtsSlotIndex[i], scale); diff --git a/src/classes/share/javax/media/j3d/LightRetained.java b/src/classes/share/javax/media/j3d/LightRetained.java index ee95145..5b21689 100644 --- a/src/classes/share/javax/media/j3d/LightRetained.java +++ b/src/classes/share/javax/media/j3d/LightRetained.java @@ -66,10 +66,10 @@ abstract class LightRetained extends LeafRetained { /** * The Boundary object defining the lights's region of influence. - */ + */ Bounds regionOfInfluence = null; - - /** + + /** * The bounding leaf reference */ BoundingLeafRetained boundingLeaf = null; @@ -79,7 +79,7 @@ abstract class LightRetained extends LeafRetained { */ Bounds region = null; - /** + /** * This bitmask is set when something changes in the light */ int lightDirty = 0xffff; @@ -114,7 +114,7 @@ abstract class LightRetained extends LeafRetained { boolean isScoped = false; // The object that contains the dynamic HashKey - a string type object - // Used in scoping + // Used in scoping HashKey tempKey = new HashKey(250); /** @@ -152,7 +152,7 @@ abstract class LightRetained extends LeafRetained { */ void setEnable(boolean state) { initEnable(state); - sendMessage(ENABLE_CHANGED, + sendMessage(ENABLE_CHANGED, (state ? Boolean.TRUE: Boolean.FALSE)); } @@ -205,7 +205,7 @@ abstract class LightRetained extends LeafRetained { /** * Replaces the specified scope with the scope provided and * send a message - * @param scope the new scope + * @param scope the new scope * @param index which scope to replace */ void setScope(Group scope, int index) { @@ -218,7 +218,7 @@ abstract class LightRetained extends LeafRetained { tempKey.reset(); group.removeAllNodesForScopedLight((inSharedGroup?numMirrorLights:1), mirrorLights, removeScopeList, tempKey); - + group = (GroupRetained)scope.retained; tempKey.reset(); // If its a group, then add the scope to the group, if @@ -226,7 +226,7 @@ abstract class LightRetained extends LeafRetained { // updateMirrorObject group.addAllNodesForScopedLight((inSharedGroup?numMirrorLights:1), mirrorLights,addScopeList, tempKey); - + initScope(scope, index); J3dMessage createMessage = new J3dMessage(); scopeInfo[0] = addScopeList; @@ -234,7 +234,7 @@ abstract class LightRetained extends LeafRetained { scopeInfo[2] = (scopes.size() > 0 ? Boolean.TRUE: Boolean.FALSE); sendMessage(SCOPE_CHANGED, scopeInfo); } - + /** * Inserts the specified scope at specified index. * @param scope the new scope @@ -259,7 +259,7 @@ abstract class LightRetained extends LeafRetained { tempKey.reset(); group.addAllNodesForScopedLight((inSharedGroup?numMirrorLights:1), mirrorLights,addScopeList, tempKey); - + initInsertScope(scope, index); scopeInfo[0] = addScopeList; scopeInfo[1] = null; @@ -267,7 +267,7 @@ abstract class LightRetained extends LeafRetained { sendMessage(SCOPE_CHANGED, scopeInfo); } - + /** * Removes the scope at specified index. * @param index which scope to remove @@ -278,7 +278,7 @@ abstract class LightRetained extends LeafRetained { group.removeLightScope(); } - + /** * Removes the scope at specified index. * @param index which scope to remove @@ -287,7 +287,7 @@ abstract class LightRetained extends LeafRetained { Object[] scopeInfo = new Object[3]; ArrayList removeScopeList = new ArrayList(); - + GroupRetained group = (GroupRetained)scopes.elementAt(index); tempKey.reset(); group.removeAllNodesForScopedLight((inSharedGroup?numMirrorLights:1), mirrorLights, removeScopeList, tempKey); @@ -297,7 +297,7 @@ abstract class LightRetained extends LeafRetained { sendMessage(SCOPE_CHANGED, scopeInfo); } - + /** * Removes the specified scope * @param scope to be removed @@ -337,10 +337,10 @@ abstract class LightRetained extends LeafRetained { void initRemoveAllScopes() { int n = scopes.size(); - for(int i = n-1; i >= 0; i--) + for(int i = n-1; i >= 0; i--) initRemoveScope(i); } - + /** * Returns the scope specified by the index. * @param index of the scope to be returned @@ -349,11 +349,11 @@ abstract class LightRetained extends LeafRetained { Group getScope(int index) { return (Group)(((GroupRetained)(scopes.elementAt(index))).source); } - + /** * Returns an enumeration object of the scope * @return an enumeration object of the scope - */ + */ Enumeration getAllScopes() { Enumeration elm = scopes.elements(); Vector v = new Vector(scopes.size()); @@ -390,7 +390,7 @@ abstract class LightRetained extends LeafRetained { scopeInfo[2] = (scopes.size() > 0 ? Boolean.TRUE: Boolean.FALSE); sendMessage(SCOPE_CHANGED, scopeInfo); } - + /** * Returns a count of this nodes' scopes. * @return the number of scopes descendant from this node @@ -409,11 +409,11 @@ abstract class LightRetained extends LeafRetained { else return scopes.indexOf(null); } - + /** * Initializes the Light's region of influence. * @param region a region that contains the Light's new region of influence - */ + */ void initInfluencingBounds(Bounds region) { if (region != null) { regionOfInfluence = (Bounds) region.clone(); @@ -429,17 +429,17 @@ abstract class LightRetained extends LeafRetained { /** * Set the Light's region of influence and send a message * @param region a region that contains the Light's new region of influence - */ + */ void setInfluencingBounds(Bounds region) { initInfluencingBounds(region); - sendMessage(BOUNDS_CHANGED, + sendMessage(BOUNDS_CHANGED, (region != null ? region.clone() : null)); } /** * Get the Light's region of influence * @return this Light's region of influence information - */ + */ Bounds getInfluencingBounds() { Bounds b = null; @@ -455,7 +455,7 @@ abstract class LightRetained extends LeafRetained { /** * Initializes the Light's region of influence to the specified Leaf node. - */ + */ void initInfluencingBoundingLeaf(BoundingLeaf region) { if (region != null) { boundingLeaf = (BoundingLeafRetained)region.retained; @@ -466,12 +466,12 @@ abstract class LightRetained extends LeafRetained { /** * Set the Light's region of influence to the specified Leaf node. - */ + */ void setInfluencingBoundingLeaf(BoundingLeaf region) { int i, numLgts; numLgts = numMirrorLights; - if (numMirrorLights == 0) + if (numMirrorLights == 0) numLgts = 1; if (boundingLeaf != null) { @@ -491,14 +491,14 @@ abstract class LightRetained extends LeafRetained { boundingLeaf = null; } - sendMessage(BOUNDINGLEAF_CHANGED, + sendMessage(BOUNDINGLEAF_CHANGED, (boundingLeaf != null ? boundingLeaf.mirrorBoundingLeaf : null)); } - /** + /** * Get the Light's region of influence. - */ + */ BoundingLeaf getInfluencingBoundingLeaf() { return (boundingLeaf != null ? (BoundingLeaf)boundingLeaf.source : null); @@ -530,7 +530,7 @@ abstract class LightRetained extends LeafRetained { int numLgts = ((Integer)args[2]).intValue(); LightRetained[] mLgts = (LightRetained[]) args[3]; int k; - + for ( k = 0; k < numLgts; k++) { for (int i = 0; i < gAtomList.size(); i++) { shape = ((GeometryAtom)gAtomList.get(i)).source; @@ -538,7 +538,7 @@ abstract class LightRetained extends LeafRetained { } mLgts[k].isScoped = scoped.booleanValue(); } - + for (k = 0; k < numLgts; k++) { mLgts[k].inBackgroundGroup = ((Boolean)((Object[])args[4])[2]).booleanValue(); mLgts[k].geometryBackground = (BackgroundRetained)((Object[])args[4])[3]; @@ -551,7 +551,7 @@ abstract class LightRetained extends LeafRetained { mLgts[k].boundingLeaf = null; mLgts[k].region = null; } - + if (bnds != null) { mLgts[k].regionOfInfluence = bnds; if (mLgts[k].region == null) { @@ -572,10 +572,10 @@ abstract class LightRetained extends LeafRetained { mLgts[i].color.set(clr); } } - + } - - /** + + /** * This method is implemented by each light for rendering * context updates. This default one does nothing. */ @@ -598,7 +598,7 @@ abstract class LightRetained extends LeafRetained { } } else if ((component & ENABLE_CHANGED) != 0) { - for (int i = 0; i < numLgts; i++) + for (int i = 0; i < numLgts; i++) mLgts[i].lightOn = ((Boolean)objs[4]).booleanValue(); } else if ((component & BOUNDS_CHANGED) != 0) { @@ -606,7 +606,7 @@ abstract class LightRetained extends LeafRetained { mLgts[i].regionOfInfluence = (Bounds) objs[4]; if (mLgts[i].boundingLeaf == null) { if (objs[4] != null) { - mLgts[i].region = + mLgts[i].region = ((Bounds)mLgts[i].regionOfInfluence).copy(mLgts[i].region); mLgts[i].region.transform(mLgts[i].regionOfInfluence, mLgts[i].getCurrentLocalToVworld()); @@ -623,11 +623,11 @@ abstract class LightRetained extends LeafRetained { if (objs[4] != null) { mLgts[i].region = (Bounds)mLgts[i].boundingLeaf.transformedRegion; } - else { // evaluate regionOfInfluence if not null + else { // evaluate regionOfInfluence if not null if (mLgts[i].regionOfInfluence != null) { - mLgts[i].region = + mLgts[i].region = ((Bounds)mLgts[i].regionOfInfluence).copy(mLgts[i].region); - mLgts[i].region.transform(mLgts[i].regionOfInfluence, + mLgts[i].region.transform(mLgts[i].regionOfInfluence, mLgts[i].getCurrentLocalToVworld()); } else { @@ -644,7 +644,7 @@ abstract class LightRetained extends LeafRetained { ArrayList addList = (ArrayList)scopeList[0]; ArrayList removeList = (ArrayList)scopeList[1]; boolean isScoped = ((Boolean)scopeList[2]).booleanValue(); - + if (addList != null) { for (i = 0; i < numLgts; i++) { mLgts[i].isScoped = isScoped; @@ -654,7 +654,7 @@ abstract class LightRetained extends LeafRetained { } } } - + if (removeList != null) { for (i = 0; i < numLgts; i++) { mLgts[i].isScoped = isScoped; @@ -669,8 +669,8 @@ abstract class LightRetained extends LeafRetained { } - - + + // The update Object function called during RenderingEnv objUpdate // Note : if you add any more fields here , you need to update // updateLight() in RenderingEnvironmentStructure @@ -697,7 +697,7 @@ abstract class LightRetained extends LeafRetained { /** Note: This routine will only be called on * the mirror object - will update the object's - * cached region and transformed region + * cached region and transformed region */ void updateBoundingLeaf() { @@ -725,7 +725,7 @@ abstract class LightRetained extends LeafRetained { break; } } - + } } /** @@ -747,7 +747,7 @@ abstract class LightRetained extends LeafRetained { newLights[i] = mirrorLights[i]; } mirrorLights = newLights; - } + } // mirrorLights[numMirrorLights] = (LightRetained) // this.clone(true); mirrorLights[numMirrorLights] = (LightRetained) this.clone(); @@ -771,7 +771,7 @@ abstract class LightRetained extends LeafRetained { if (boundingLeaf != null) { mirrorLights[0].boundingLeaf = this.boundingLeaf.mirrorBoundingLeaf; if (mirrorLights[0].boundingLeaf != null) - mirrorLights[0].boundingLeaf.addUser(mirrorLights[0]); + mirrorLights[0].boundingLeaf.addUser(mirrorLights[0]); } mirrorLights[0].sgLight = this; } @@ -798,9 +798,9 @@ abstract class LightRetained extends LeafRetained { j = s.keys[i].equals(localToVworldKeys, 0, localToVworldKeys.length); if(j < 0) { - System.err.println("LightRetained : Can't find hashKey"); + System.err.println("LightRetained : Can't find hashKey"); } - + ml.localToVworld[0] = localToVworld[j]; ml.localToVworldIndex[0] = localToVworldIndex[j]; // If its view Scoped, then add this list @@ -811,7 +811,7 @@ abstract class LightRetained extends LeafRetained { } else { s.nodeList.add(ml); } - + newlyAddedMirrorLights.add(ml); if (boundingLeaf != null) { boundingLeaf.mirrorBoundingLeaf.addUser(ml); @@ -826,7 +826,7 @@ abstract class LightRetained extends LeafRetained { s.switchTargets[i].addNode(ml, Targets.ENV_TARGETS); } ml.switchState = (SwitchState)s.switchStates.get(j); - + } } else { ml = this.getMirrorLight(null); @@ -834,7 +834,7 @@ abstract class LightRetained extends LeafRetained { ml.localToVworldIndex = new int[1][]; ml.localToVworld[0] = this.localToVworld[0]; ml.localToVworldIndex[0] = this.localToVworldIndex[0]; - // Initialization of the mirror object + // Initialization of the mirror object // If its view Scoped, then add this list // to be sent to Rendering Env // System.err.println("lightSetLive, s.viewList = "+s.viewLists); @@ -903,7 +903,7 @@ abstract class LightRetained extends LeafRetained { obj[6] = clr; createMessage.args[4] = obj; return createMessage; - + } // The default set of clearLive actions @@ -921,7 +921,7 @@ abstract class LightRetained extends LeafRetained { s.notifyThreads |= J3dThread.UPDATE_TRANSFORM; } newlyAddedMirrorLights.add(ml); - // Remove this mirror light as users of the bounding leaf + // Remove this mirror light as users of the bounding leaf if (ml.boundingLeaf != null) { ml.boundingLeaf.removeUser(ml); ml.boundingLeaf = null; @@ -939,8 +939,8 @@ abstract class LightRetained extends LeafRetained { } } else { ml = this.getMirrorLight(null); - - // Remove this mirror light as users of the bounding leaf + + // Remove this mirror light as users of the bounding leaf if (ml.boundingLeaf != null) { ml.boundingLeaf.removeUser(ml); ml.boundingLeaf = null; @@ -951,7 +951,7 @@ abstract class LightRetained extends LeafRetained { } if ((s.viewScopedNodeList != null) && (s.viewLists != null)) { s.viewScopedNodeList.add(ml); - //System.err.println("s.viewList is " + s.viewLists); + //System.err.println("s.viewList is " + s.viewLists); s.scopedNodesViewList.add(s.viewLists.get(0)); } else { s.nodeList.add(ml); @@ -969,8 +969,8 @@ abstract class LightRetained extends LeafRetained { J3dThread.UPDATE_RENDER; - - if (scopes.size() > 0) { + + if (scopes.size() > 0) { J3dMessage createMessage = new J3dMessage(); LightRetained[] mlts = new LightRetained[newlyAddedMirrorLights.size()]; for (int i = 0; i < mlts.length; i++) { @@ -1011,9 +1011,9 @@ abstract class LightRetained extends LeafRetained { } } - - + + /** * Clones only the retained side, internal use only */ @@ -1050,7 +1050,7 @@ abstract class LightRetained extends LeafRetained { region.transform(regionOfInfluence, getCurrentLocalToVworld()); } - + } } @@ -1078,4 +1078,4 @@ abstract class LightRetained extends LeafRetained { } } } - + diff --git a/src/classes/share/javax/media/j3d/LightSet.java b/src/classes/share/javax/media/j3d/LightSet.java index 081793e..fc8a58d 100644 --- a/src/classes/share/javax/media/j3d/LightSet.java +++ b/src/classes/share/javax/media/j3d/LightSet.java @@ -39,13 +39,13 @@ class LightSet extends Object { * The Lights that make up this set */ LightRetained[] lights = null; - + // The number of lights in this lightset, may be less than lights.length int nlights = 0; // A reference to the next LightSet LightSet next = null; - + // A reference to the previous LightSet LightSet prev = null; @@ -56,14 +56,14 @@ class LightSet extends Object { boolean isDirty = true; /** - * Constructs a new LightSet + * Constructs a new LightSet */ - LightSet(RenderBin rb, RenderAtom ra, LightRetained[] lights, + LightSet(RenderBin rb, RenderAtom ra, LightRetained[] lights, int nlights, boolean lightOn) { this.reset(rb, ra, lights, nlights, lightOn); } - void reset(RenderBin rb, RenderAtom ra, LightRetained[] lights, + void reset(RenderBin rb, RenderAtom ra, LightRetained[] lights, int nlights, boolean lightOn) { int i; @@ -78,11 +78,11 @@ class LightSet extends Object { } this.nlights = nlights; - + //lists = new RenderList(ro); //lists.prims[ro.geometry.geoType-1] = ro; } - + boolean equals(RenderBin rb, LightRetained[] lights, int nlights, boolean lightOn) { int i, j; @@ -90,7 +90,7 @@ class LightSet extends Object { if (this.nlights != nlights) return(false); - + if (this.lightingOn != lightOn) return(false); diff --git a/src/classes/share/javax/media/j3d/LineArray.java b/src/classes/share/javax/media/j3d/LineArray.java index c220e40..f317098 100644 --- a/src/classes/share/javax/media/j3d/LineArray.java +++ b/src/classes/share/javax/media/j3d/LineArray.java @@ -187,7 +187,7 @@ public class LineArray extends GeometryArray { LineArray l = new LineArray(rt.getVertexCount(), rt.getVertexFormat(), texSetCount, - texMap, + texMap, vertexAttrCount, vertexAttrSizes); l.duplicateNodeComponent(this); diff --git a/src/classes/share/javax/media/j3d/LineArrayRetained.java b/src/classes/share/javax/media/j3d/LineArrayRetained.java index b17ac39..fcb39c5 100644 --- a/src/classes/share/javax/media/j3d/LineArrayRetained.java +++ b/src/classes/share/javax/media/j3d/LineArrayRetained.java @@ -40,11 +40,11 @@ import java.lang.Math; */ class LineArrayRetained extends GeometryArrayRetained implements Cloneable { - + LineArrayRetained() { this.geoType = GEO_TYPE_LINE_SET; } - + boolean intersect(PickShape pickShape, PickInfo pickInfo, int flags, Point3d iPnt, GeometryRetained geom, int geomIndex) { Point3d pnts[] = new Point3d[2]; @@ -57,7 +57,7 @@ class LineArrayRetained extends GeometryArrayRetained implements Cloneable { initialVertexIndex : initialCoordIndex); pnts[0] = new Point3d(); pnts[1] = new Point3d(); - + switch (pickShape.getPickType()) { case PickShape.PICKRAY: PickRay pickRay= (PickRay) pickShape; @@ -79,31 +79,31 @@ class LineArrayRetained extends GeometryArrayRetained implements Cloneable { y = iPnt.y; z = iPnt.z; if((flags & PickInfo.CLOSEST_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, + storeInterestData(pickInfo, flags, geom, geomIndex, vtxIndexArr, iPnt, sdist[0]); } } if((flags & PickInfo.ALL_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, - vtxIndexArr, iPnt, sdist[0]); + storeInterestData(pickInfo, flags, geom, geomIndex, + vtxIndexArr, iPnt, sdist[0]); } } } break; case PickShape.PICKSEGMENT: PickSegment pickSegment = (PickSegment) pickShape; - Vector3d dir = - new Vector3d(pickSegment.end.x - pickSegment.start.x, + Vector3d dir = + new Vector3d(pickSegment.end.x - pickSegment.start.x, pickSegment.end.y - pickSegment.start.y, pickSegment.end.z - pickSegment.start.z); - + while (i < validVertexCount) { for(int j=0; j<2; j++) { vtxIndexArr[j] = i; getVertexData(i++, pnts[j]); } if (intersectLineAndRay(pnts[0], pnts[1], - pickSegment.start, + pickSegment.start, dir, sdist, iPnt) && (sdist[0] <= 1.0)) { if (flags == 0) { @@ -115,19 +115,19 @@ class LineArrayRetained extends GeometryArrayRetained implements Cloneable { y = iPnt.y; z = iPnt.z; if((flags & PickInfo.CLOSEST_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, + storeInterestData(pickInfo, flags, geom, geomIndex, vtxIndexArr, iPnt, sdist[0]); } } if((flags & PickInfo.ALL_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, - vtxIndexArr, iPnt, sdist[0]); + storeInterestData(pickInfo, flags, geom, geomIndex, + vtxIndexArr, iPnt, sdist[0]); } } } break; case PickShape.PICKBOUNDINGBOX: - BoundingBox bbox = (BoundingBox) + BoundingBox bbox = (BoundingBox) ((PickBounds) pickShape).bounds; while (i < validVertexCount) { for(int j=0; j<2; j++) { @@ -144,20 +144,20 @@ class LineArrayRetained extends GeometryArrayRetained implements Cloneable { y = iPnt.y; z = iPnt.z; if((flags & PickInfo.CLOSEST_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, + storeInterestData(pickInfo, flags, geom, geomIndex, vtxIndexArr, iPnt, sdist[0]); } } if((flags & PickInfo.ALL_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, - vtxIndexArr, iPnt, sdist[0]); + storeInterestData(pickInfo, flags, geom, geomIndex, + vtxIndexArr, iPnt, sdist[0]); } } } break; case PickShape.PICKBOUNDINGSPHERE: - BoundingSphere bsphere = (BoundingSphere) + BoundingSphere bsphere = (BoundingSphere) ((PickBounds) pickShape).bounds; while (i < validVertexCount) { @@ -175,19 +175,19 @@ class LineArrayRetained extends GeometryArrayRetained implements Cloneable { y = iPnt.y; z = iPnt.z; if((flags & PickInfo.CLOSEST_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, + storeInterestData(pickInfo, flags, geom, geomIndex, vtxIndexArr, iPnt, sdist[0]); } } if((flags & PickInfo.ALL_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, - vtxIndexArr, iPnt, sdist[0]); + storeInterestData(pickInfo, flags, geom, geomIndex, + vtxIndexArr, iPnt, sdist[0]); } } } break; case PickShape.PICKBOUNDINGPOLYTOPE: - BoundingPolytope bpolytope = (BoundingPolytope) + BoundingPolytope bpolytope = (BoundingPolytope) ((PickBounds) pickShape).bounds; while (i < validVertexCount) { @@ -205,13 +205,13 @@ class LineArrayRetained extends GeometryArrayRetained implements Cloneable { y = iPnt.y; z = iPnt.z; if((flags & PickInfo.CLOSEST_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, + storeInterestData(pickInfo, flags, geom, geomIndex, vtxIndexArr, iPnt, sdist[0]); } } if((flags & PickInfo.ALL_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, - vtxIndexArr, iPnt, sdist[0]); + storeInterestData(pickInfo, flags, geom, geomIndex, + vtxIndexArr, iPnt, sdist[0]); } } } @@ -234,13 +234,13 @@ class LineArrayRetained extends GeometryArrayRetained implements Cloneable { y = iPnt.y; z = iPnt.z; if((flags & PickInfo.CLOSEST_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, + storeInterestData(pickInfo, flags, geom, geomIndex, vtxIndexArr, iPnt, sdist[0]); } } if((flags & PickInfo.ALL_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, - vtxIndexArr, iPnt, sdist[0]); + storeInterestData(pickInfo, flags, geom, geomIndex, + vtxIndexArr, iPnt, sdist[0]); } } } @@ -263,13 +263,13 @@ class LineArrayRetained extends GeometryArrayRetained implements Cloneable { y = iPnt.y; z = iPnt.z; if((flags & PickInfo.CLOSEST_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, + storeInterestData(pickInfo, flags, geom, geomIndex, vtxIndexArr, iPnt, sdist[0]); } } if((flags & PickInfo.ALL_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, - vtxIndexArr, iPnt, sdist[0]); + storeInterestData(pickInfo, flags, geom, geomIndex, + vtxIndexArr, iPnt, sdist[0]); } } } @@ -278,8 +278,8 @@ class LineArrayRetained extends GeometryArrayRetained implements Cloneable { // Should not happen since API already check for this throw new IllegalArgumentException(J3dI18N.getString("LineArrayRetained0")); default: - throw new RuntimeException ("PickShape not supported for intersection"); - } + throw new RuntimeException ("PickShape not supported for intersection"); + } if (minDist < Double.MAX_VALUE) { iPnt.x = x; @@ -288,8 +288,8 @@ class LineArrayRetained extends GeometryArrayRetained implements Cloneable { return true; } return false; - - } + + } boolean intersect(Point3d[] pnts) { Point3d[] points = new Point3d[2]; @@ -297,9 +297,9 @@ class LineArrayRetained extends GeometryArrayRetained implements Cloneable { Vector3d dir; int i = ((vertexFormat & GeometryArray.BY_REFERENCE) == 0 ? initialVertexIndex : initialCoordIndex); - + points[0] = new Point3d(); - points[1] = new Point3d(); + points[1] = new Point3d(); switch (pnts.length) { case 3: // Triangle @@ -346,7 +346,7 @@ class LineArrayRetained extends GeometryArrayRetained implements Cloneable { return false; } - boolean intersect(Transform3D thisToOtherVworld, + boolean intersect(Transform3D thisToOtherVworld, GeometryRetained geom) { Point3d[] pnts = new Point3d[2]; int i = ((vertexFormat & GeometryArray.BY_REFERENCE) == 0 ? @@ -377,7 +377,7 @@ class LineArrayRetained extends GeometryArrayRetained implements Cloneable { switch(targetBound.getPickType()) { case PickShape.PICKBOUNDINGBOX: BoundingBox box = (BoundingBox) targetBound; - + while (i < validVertexCount) { getVertexData(i++, pnts[0]); getVertexData(i++, pnts[1]); @@ -388,7 +388,7 @@ class LineArrayRetained extends GeometryArrayRetained implements Cloneable { break; case PickShape.PICKBOUNDINGSPHERE: BoundingSphere bsphere = (BoundingSphere) targetBound; - + while (i < validVertexCount) { getVertexData(i++, pnts[0]); getVertexData(i++, pnts[1]); @@ -400,8 +400,8 @@ class LineArrayRetained extends GeometryArrayRetained implements Cloneable { break; case PickShape.PICKBOUNDINGPOLYTOPE: BoundingPolytope bpolytope = (BoundingPolytope) targetBound; - - + + while (i < validVertexCount) { getVertexData(i++, pnts[0]); getVertexData(i++, pnts[1]); @@ -413,7 +413,7 @@ class LineArrayRetained extends GeometryArrayRetained implements Cloneable { break; default: throw new RuntimeException("Bounds not supported for intersection " - + targetBound); + + targetBound); } return false; @@ -432,8 +432,8 @@ class LineArrayRetained extends GeometryArrayRetained implements Cloneable { centroid.z = 0; while (i < validVertexCount) { - getVertexData(i++, pnt0); - getVertexData(i++, pnt1); + getVertexData(i++, pnt0); + getVertexData(i++, pnt1); length = pnt0.distance(pnt1); centroid.x += (pnt0.x + pnt1.x) * length; centroid.y += (pnt0.y + pnt1.y) * length; diff --git a/src/classes/share/javax/media/j3d/LineAttributes.java b/src/classes/share/javax/media/j3d/LineAttributes.java index 4147773..a042179 100644 --- a/src/classes/share/javax/media/j3d/LineAttributes.java +++ b/src/classes/share/javax/media/j3d/LineAttributes.java @@ -47,7 +47,7 @@ package javax.media.j3d; * a repeating pattern of 1 pixel on and 7 pixels off.</li> * <p> * <li>PATTERN_DASH_DOT - draws dashed-dotted lines. Ideally, these will be - * drawn with a repeating pattern of 7 pixels on, 4 pixels off, 1 pixel on, + * drawn with a repeating pattern of 7 pixels on, 4 pixels off, 1 pixel on, * and 4 pixels off.</li> * <p> * <li>PATTERN_USER_DEFINED - draws lines with a user-defined line pattern. @@ -59,48 +59,48 @@ package javax.media.j3d; * <p> * <p> * If antialiasing is enabled, the lines are considered transparent - * for rendering purposes. They are rendered with all the other transparent + * for rendering purposes. They are rendered with all the other transparent * objects and adhere to the other transparency settings such as the - * View transparency sorting policy and the View depth buffer freeze + * View transparency sorting policy and the View depth buffer freeze * transparent enable. - * </p> + * </p> * <LI>Width (in pixels). The default is a line width of one pixel. * </LI></UL><p> * * <b>User-defined Line Patterns</b> * <p> - * A user-defined line pattern is specified with a pattern mask and + * A user-defined line pattern is specified with a pattern mask and * an optional scale factor. * <p> * The Pattern Mask<p> * * The pattern is specified - * using a 16-bit mask that specifies on and off segments. Bit 0 in - * the pattern mask corresponds to the first pixel of the line or line - * strip primitive. A value of 1 for a bit in the pattern mask indicates + * using a 16-bit mask that specifies on and off segments. Bit 0 in + * the pattern mask corresponds to the first pixel of the line or line + * strip primitive. A value of 1 for a bit in the pattern mask indicates * that the corresponding pixel is drawn, while a value of 0 - * indicates that the corresponding pixel is not drawn. After all 16 bits + * indicates that the corresponding pixel is not drawn. After all 16 bits * in the pattern are used, the pattern is repeated. * <p> * For example, a mask of 0x00ff defines a dashed line with a repeating - * pattern of 8 pixels on followed by 8 pixels off. A value of 0x0101 - * defines a a dotted line with a repeating pattern of 1 pixel on and 7 + * pattern of 8 pixels on followed by 8 pixels off. A value of 0x0101 + * defines a a dotted line with a repeating pattern of 1 pixel on and 7 * pixels off. * <p> * The pattern continues around individual line segments of a line strip - * primitive. It is restarted at the beginning of each new line strip. - * For line array primitives, the pattern is restarted at the beginning + * primitive. It is restarted at the beginning of each new line strip. + * For line array primitives, the pattern is restarted at the beginning * of each line. * <p> * The Scale Factor * <p> * The pattern is multiplied by the scale factor such that each bit in * the pattern mask corresponds to that many consecutive pixels. - * For example, a scale factor of 3 applied to a pattern mask of 0x001f + * For example, a scale factor of 3 applied to a pattern mask of 0x001f * would produce a repeating pattern of 15 pixels on followed by 33 * pixels off. The valid range for this attribute is [1,15]. Values * outside this range are clamped.<p> - * + * * @see Appearance * @see View */ @@ -192,9 +192,9 @@ public class LineAttributes extends NodeComponent { private static final int[] readCapabilities = { ALLOW_ANTIALIASING_READ, ALLOW_PATTERN_READ, - ALLOW_WIDTH_READ + ALLOW_WIDTH_READ }; - + /** * Constructs a LineAttributes object with default parameters. * The default values are as follows: @@ -242,7 +242,7 @@ public class LineAttributes extends NodeComponent { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_WIDTH_WRITE)) throw new CapabilityNotSetException(J3dI18N.getString("LineAttributes1")); - if (isLive()) + if (isLive()) ((LineAttributesRetained)this.retained).setLineWidth(lineWidth); else ((LineAttributesRetained)this.retained).initLineWidth(lineWidth); @@ -283,7 +283,7 @@ public class LineAttributes extends NodeComponent { else ((LineAttributesRetained)this.retained).initLinePattern(linePattern); - + } /** @@ -407,11 +407,11 @@ public class LineAttributes extends NodeComponent { * for this LineAttributes component object. * <p> * If antialiasing is enabled, the lines are considered transparent - * for rendering purposes. They are rendered with all the other - * transparent objects and adhere to the other transparency settings - * such as the View transparency sorting policy and the View depth buffer + * for rendering purposes. They are rendered with all the other + * transparent objects and adhere to the other transparency settings + * such as the View transparency sorting policy and the View depth buffer * freeze transparent enable. - * </p> + * </p> * @param state true or false to enable or disable line antialiasing * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph @@ -456,7 +456,7 @@ public class LineAttributes extends NodeComponent { /** - * @deprecated replaced with cloneNodeComponent(boolean forceDuplicate) + * @deprecated replaced with cloneNodeComponent(boolean forceDuplicate) */ public NodeComponent cloneNodeComponent() { LineAttributes la = new LineAttributes(); @@ -464,14 +464,14 @@ public class LineAttributes extends NodeComponent { return la; } - - + + /** * Copies all node information from <code>originalNodeComponent</code> into * the current node. This method is called from the * <code>duplicateNode</code> method. This routine does * the actual duplication of all "local data" (any data defined in - * this object). + * this object). * * @param originalNodeComponent the original node to duplicate. * @param forceDuplicate when set to <code>true</code>, causes the @@ -483,12 +483,12 @@ public class LineAttributes extends NodeComponent { * @see Node#cloneTree * @see NodeComponent#setDuplicateOnCloneTree */ - void duplicateAttributes(NodeComponent originalNodeComponent, - boolean forceDuplicate) { + void duplicateAttributes(NodeComponent originalNodeComponent, + boolean forceDuplicate) { super.duplicateAttributes(originalNodeComponent, forceDuplicate); - - LineAttributesRetained attr = (LineAttributesRetained) + + LineAttributesRetained attr = (LineAttributesRetained) originalNodeComponent.retained; LineAttributesRetained rt = (LineAttributesRetained) retained; diff --git a/src/classes/share/javax/media/j3d/LineAttributesRetained.java b/src/classes/share/javax/media/j3d/LineAttributesRetained.java index 70f3d3d..11c9b6b 100644 --- a/src/classes/share/javax/media/j3d/LineAttributesRetained.java +++ b/src/classes/share/javax/media/j3d/LineAttributesRetained.java @@ -57,7 +57,7 @@ class LineAttributesRetained extends NodeComponentRetained { // user-defined line pattern mask int linePatternMask = 0xffff; - + // line mask pattern scale factor int linePatternScaleFactor = 1; @@ -116,7 +116,7 @@ class LineAttributesRetained extends NodeComponentRetained { /** * Enables or disables line antialiasing - * for this lineAttributes component object and sends a + * for this lineAttributes component object and sends a * message notifying the interested structures of the change. * @param state true or false to enable or disable line antialiasing */ @@ -125,13 +125,13 @@ class LineAttributesRetained extends NodeComponentRetained { } /** * Enables or disables line antialiasing - * for this lineAttributes component object and sends a + * for this lineAttributes component object and sends a * message notifying the interested structures of the change. * @param state true or false to enable or disable line antialiasing */ final void setLineAntialiasingEnable(boolean state) { initLineAntialiasingEnable(state); - sendMessage(LINE_AA_CHANGED, + sendMessage(LINE_AA_CHANGED, (state ? Boolean.TRUE: Boolean.FALSE)); } @@ -147,7 +147,7 @@ class LineAttributesRetained extends NodeComponentRetained { /** * Sets the pattern mask for this LineAttributes component object. - * This is used when the linePattern attribute is set to + * This is used when the linePattern attribute is set to * PATTERN_USER_DEFINED. * @param mask the line pattern mask to be used. */ @@ -158,8 +158,8 @@ class LineAttributesRetained extends NodeComponentRetained { /** * Sets the pattern mask for this LineAttributes component object * and sends a message notifying the interested structures of change. - * This is used when the linePattern attribute is set to - * PATTERN_USER_DEFINED. + * This is used when the linePattern attribute is set to + * PATTERN_USER_DEFINED. * @param mask the line pattern mask to be used. */ final void setPatternMask(int mask) { @@ -176,7 +176,7 @@ class LineAttributesRetained extends NodeComponentRetained { } /** - * Sets the pattern mask scale factor for this LineAttributes + * Sets the pattern mask scale factor for this LineAttributes * component object. This is used when the linePattern attribute * is set to PATTERN_USER_DEFINED. * @param scaleFactor the scale factor of mask, clamp to [1, 15] @@ -191,10 +191,10 @@ class LineAttributesRetained extends NodeComponentRetained { } /** - * Sets the pattern mask scale factor for this LineAttributes - * component object and sends a message notifying the interested + * Sets the pattern mask scale factor for this LineAttributes + * component object and sends a message notifying the interested * structures of change. This is used when the linePattern - * attribute is set to PATTERN_USER_DEFINED. + * attribute is set to PATTERN_USER_DEFINED. * @param scaleFactor the scale factor of mask, clamp to [1, 15] */ final void setPatternScaleFactor(int scaleFactor) { @@ -203,7 +203,7 @@ class LineAttributesRetained extends NodeComponentRetained { } /** - * Retrieves the pattern scale factor for this LineAttributes + * Retrieves the pattern scale factor for this LineAttributes * component object. * @return the pattern mask scale factor */ @@ -212,7 +212,7 @@ class LineAttributesRetained extends NodeComponentRetained { } /** - * Creates and initializes a mirror object, point the mirror object + * Creates and initializes a mirror object, point the mirror object * to the retained object if the object is not editable */ synchronized void createMirrorObject() { @@ -251,13 +251,13 @@ class LineAttributesRetained extends NodeComponentRetained { ((LineAttributesRetained)mirror).set(this); } - /** Update the "component" field of the mirror object with the + /** Update the "component" field of the mirror object with the * given "value" */ synchronized void updateMirrorObject(int component, Object value) { LineAttributesRetained mirrorLa = (LineAttributesRetained) mirror; - + if ((component & LINE_WIDTH_CHANGED) != 0) { mirrorLa.lineWidth = ((Float)value).floatValue(); } @@ -266,7 +266,7 @@ class LineAttributesRetained extends NodeComponentRetained { } else if ((component & LINE_AA_CHANGED) != 0) { mirrorLa.lineAntialiasing = ((Boolean)value).booleanValue(); - } + } else if ((component & LINE_PATTERN_MASK_CHANGED) != 0) { mirrorLa.linePatternMask = ((Integer)value).intValue(); } @@ -275,7 +275,7 @@ class LineAttributesRetained extends NodeComponentRetained { mirrorLa.linePatternScaleFactor = ((Integer)value).intValue(); } } - + boolean equivalent(LineAttributesRetained lr) { return ((lr != null) && @@ -298,7 +298,7 @@ class LineAttributesRetained extends NodeComponentRetained { final void sendMessage(int attrMask, Object attr) { ArrayList univList = new ArrayList(); - ArrayList gaList = Shape3DRetained.getGeomAtomsList(mirror.users, univList); + ArrayList gaList = Shape3DRetained.getGeomAtomsList(mirror.users, univList); // Send to rendering attribute structure, regardless of // whether there are users or not (alternate appearance case ..) @@ -318,7 +318,7 @@ class LineAttributesRetained extends NodeComponentRetained { createMessage = new J3dMessage(); createMessage.threads = J3dThread.UPDATE_RENDER; createMessage.type = J3dMessage.LINEATTRIBUTES_CHANGED; - + createMessage.universe = (VirtualUniverse) univList.get(i); createMessage.args[0] = this; createMessage.args[1]= new Integer(attrMask); @@ -328,7 +328,7 @@ class LineAttributesRetained extends NodeComponentRetained { GeometryAtom[] gaArr = new GeometryAtom[gL.size()]; gL.toArray(gaArr); createMessage.args[3] = gaArr; - + VirtualUniverse.mc.processMessage(createMessage); } diff --git a/src/classes/share/javax/media/j3d/LineStripArrayRetained.java b/src/classes/share/javax/media/j3d/LineStripArrayRetained.java index f276084..cdf6d7a 100644 --- a/src/classes/share/javax/media/j3d/LineStripArrayRetained.java +++ b/src/classes/share/javax/media/j3d/LineStripArrayRetained.java @@ -65,7 +65,7 @@ class LineStripArrayRetained extends GeometryStripArrayRetained { case PickShape.PICKRAY: PickRay pickRay= (PickRay) pickShape; - while(i < stripVertexCounts.length) { + while(i < stripVertexCounts.length) { j = stripStartVertexIndices[i]; end = j + stripVertexCounts[i++]; vtxIndexArr[0] = j; @@ -85,13 +85,13 @@ class LineStripArrayRetained extends GeometryStripArrayRetained { y = iPnt.y; z = iPnt.z; if((flags & PickInfo.CLOSEST_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, + storeInterestData(pickInfo, flags, geom, geomIndex, vtxIndexArr, iPnt, sdist[0]); } } if((flags & PickInfo.ALL_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, - vtxIndexArr, iPnt, sdist[0]); + storeInterestData(pickInfo, flags, geom, geomIndex, + vtxIndexArr, iPnt, sdist[0]); } } pnts[0].set(pnts[1]); @@ -101,11 +101,11 @@ class LineStripArrayRetained extends GeometryStripArrayRetained { break; case PickShape.PICKSEGMENT: PickSegment pickSegment = (PickSegment) pickShape; - Vector3d dir = - new Vector3d(pickSegment.end.x - pickSegment.start.x, + Vector3d dir = + new Vector3d(pickSegment.end.x - pickSegment.start.x, pickSegment.end.y - pickSegment.start.y, pickSegment.end.z - pickSegment.start.z); - + while (i < stripVertexCounts.length) { j = stripStartVertexIndices[i]; end = j + stripVertexCounts[i++]; @@ -115,7 +115,7 @@ class LineStripArrayRetained extends GeometryStripArrayRetained { vtxIndexArr[1] = j; getVertexData(j++, pnts[1]); if (intersectLineAndRay(pnts[0], pnts[1], - pickSegment.start, + pickSegment.start, dir, sdist, iPnt) && (sdist[0] <= 1.0)) { if (flags == 0) { @@ -127,30 +127,30 @@ class LineStripArrayRetained extends GeometryStripArrayRetained { y = iPnt.y; z = iPnt.z; if((flags & PickInfo.CLOSEST_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, + storeInterestData(pickInfo, flags, geom, geomIndex, vtxIndexArr, iPnt, sdist[0]); } } if((flags & PickInfo.ALL_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, - vtxIndexArr, iPnt, sdist[0]); + storeInterestData(pickInfo, flags, geom, geomIndex, + vtxIndexArr, iPnt, sdist[0]); } } - pnts[0].set(pnts[1]); + pnts[0].set(pnts[1]); vtxIndexArr[0] = vtxIndexArr[1]; } } break; case PickShape.PICKBOUNDINGBOX: - BoundingBox bbox = (BoundingBox) + BoundingBox bbox = (BoundingBox) ((PickBounds) pickShape).bounds; - while (i < stripVertexCounts.length) { + while (i < stripVertexCounts.length) { j = stripStartVertexIndices[i]; end = j + stripVertexCounts[i++]; vtxIndexArr[0] = j; getVertexData(j++, pnts[0]); - while (j < end) { + while (j < end) { vtxIndexArr[1] = j; getVertexData(j++, pnts[1]); if (intersectBoundingBox(pnts, bbox, sdist, iPnt)) { @@ -163,26 +163,26 @@ class LineStripArrayRetained extends GeometryStripArrayRetained { y = iPnt.y; z = iPnt.z; if((flags & PickInfo.CLOSEST_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, + storeInterestData(pickInfo, flags, geom, geomIndex, vtxIndexArr, iPnt, sdist[0]); } } if((flags & PickInfo.ALL_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, - vtxIndexArr, iPnt, sdist[0]); + storeInterestData(pickInfo, flags, geom, geomIndex, + vtxIndexArr, iPnt, sdist[0]); } } - pnts[0].set(pnts[1]); + pnts[0].set(pnts[1]); vtxIndexArr[0] = vtxIndexArr[1]; } } break; case PickShape.PICKBOUNDINGSPHERE: - BoundingSphere bsphere = (BoundingSphere) + BoundingSphere bsphere = (BoundingSphere) ((PickBounds) pickShape).bounds; - while (i < stripVertexCounts.length) { + while (i < stripVertexCounts.length) { j = stripStartVertexIndices[i]; end = j + stripVertexCounts[i++]; vtxIndexArr[0] = j; @@ -200,25 +200,25 @@ class LineStripArrayRetained extends GeometryStripArrayRetained { y = iPnt.y; z = iPnt.z; if((flags & PickInfo.CLOSEST_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, + storeInterestData(pickInfo, flags, geom, geomIndex, vtxIndexArr, iPnt, sdist[0]); } } if((flags & PickInfo.ALL_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, - vtxIndexArr, iPnt, sdist[0]); + storeInterestData(pickInfo, flags, geom, geomIndex, + vtxIndexArr, iPnt, sdist[0]); } } - pnts[0].set(pnts[1]); + pnts[0].set(pnts[1]); vtxIndexArr[0] = vtxIndexArr[1]; } } break; case PickShape.PICKBOUNDINGPOLYTOPE: - BoundingPolytope bpolytope = (BoundingPolytope) + BoundingPolytope bpolytope = (BoundingPolytope) ((PickBounds) pickShape).bounds; - while (i < stripVertexCounts.length) { + while (i < stripVertexCounts.length) { j = stripStartVertexIndices[i]; end = j + stripVertexCounts[i++]; vtxIndexArr[0] = j; @@ -236,16 +236,16 @@ class LineStripArrayRetained extends GeometryStripArrayRetained { y = iPnt.y; z = iPnt.z; if((flags & PickInfo.CLOSEST_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, + storeInterestData(pickInfo, flags, geom, geomIndex, vtxIndexArr, iPnt, sdist[0]); } } if((flags & PickInfo.ALL_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, - vtxIndexArr, iPnt, sdist[0]); + storeInterestData(pickInfo, flags, geom, geomIndex, + vtxIndexArr, iPnt, sdist[0]); } } - pnts[0].set(pnts[1]); + pnts[0].set(pnts[1]); vtxIndexArr[0] = vtxIndexArr[1]; } } @@ -253,7 +253,7 @@ class LineStripArrayRetained extends GeometryStripArrayRetained { case PickShape.PICKCYLINDER: PickCylinder pickCylinder= (PickCylinder) pickShape; - while (i < stripVertexCounts.length) { + while (i < stripVertexCounts.length) { j = stripStartVertexIndices[i]; end = j + stripVertexCounts[i++]; vtxIndexArr[0] = j; @@ -271,16 +271,16 @@ class LineStripArrayRetained extends GeometryStripArrayRetained { y = iPnt.y; z = iPnt.z; if((flags & PickInfo.CLOSEST_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, + storeInterestData(pickInfo, flags, geom, geomIndex, vtxIndexArr, iPnt, sdist[0]); } } if((flags & PickInfo.ALL_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, - vtxIndexArr, iPnt, sdist[0]); + storeInterestData(pickInfo, flags, geom, geomIndex, + vtxIndexArr, iPnt, sdist[0]); } } - pnts[0].set(pnts[1]); + pnts[0].set(pnts[1]); vtxIndexArr[0] = vtxIndexArr[1]; } } @@ -288,7 +288,7 @@ class LineStripArrayRetained extends GeometryStripArrayRetained { case PickShape.PICKCONE: PickCone pickCone= (PickCone) pickShape; - while (i < stripVertexCounts.length) { + while (i < stripVertexCounts.length) { j = stripStartVertexIndices[i]; end = j + stripVertexCounts[i++]; vtxIndexArr[0] = j; @@ -306,16 +306,16 @@ class LineStripArrayRetained extends GeometryStripArrayRetained { y = iPnt.y; z = iPnt.z; if((flags & PickInfo.CLOSEST_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, + storeInterestData(pickInfo, flags, geom, geomIndex, vtxIndexArr, iPnt, sdist[0]); } } if((flags & PickInfo.ALL_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, - vtxIndexArr, iPnt, sdist[0]); + storeInterestData(pickInfo, flags, geom, geomIndex, + vtxIndexArr, iPnt, sdist[0]); } } - pnts[0].set(pnts[1]); + pnts[0].set(pnts[1]); vtxIndexArr[0] = vtxIndexArr[1]; } } @@ -324,8 +324,8 @@ class LineStripArrayRetained extends GeometryStripArrayRetained { // Should not happen since API already check for this throw new IllegalArgumentException(J3dI18N.getString("LineStripArrayRetained0")); default: - throw new RuntimeException ("PickShape not supported for intersection"); - } + throw new RuntimeException ("PickShape not supported for intersection"); + } if (minDist < Double.MAX_VALUE) { iPnt.x = x; @@ -333,9 +333,9 @@ class LineStripArrayRetained extends GeometryStripArrayRetained { iPnt.z = z; return true; } - return false; + return false; } - + boolean intersect(Point3d[] pnts) { int j, end; Point3d[] points = new Point3d[2]; @@ -354,9 +354,9 @@ class LineStripArrayRetained extends GeometryStripArrayRetained { while (i < stripVertexCounts.length) { j = stripStartVertexIndices[i]; end = j + stripVertexCounts[i++]; - getVertexData(j++, points[0]); + getVertexData(j++, points[0]); while (j < end) { - getVertexData(j++, points[1]); + getVertexData(j++, points[1]); if (intersectSegment(pnts, points[0], points[1], dist, null)) { return true; @@ -370,9 +370,9 @@ class LineStripArrayRetained extends GeometryStripArrayRetained { while (i < stripVertexCounts.length) { j = stripStartVertexIndices[i]; end = j + stripVertexCounts[i++]; - getVertexData(j++, points[0]); + getVertexData(j++, points[0]); while (j < end) { - getVertexData(j++, points[1]); + getVertexData(j++, points[1]); dir.x = points[1].x - points[0].x; dir.y = points[1].y - points[0].y; dir.z = points[1].z - points[0].z; @@ -382,7 +382,7 @@ class LineStripArrayRetained extends GeometryStripArrayRetained { return true; } points[0].set(points[1]); - } + } } break; case 1: // Point @@ -390,9 +390,9 @@ class LineStripArrayRetained extends GeometryStripArrayRetained { while (i < stripVertexCounts.length) { j = stripStartVertexIndices[i]; end = j + stripVertexCounts[i++]; - getVertexData(j++, points[0]); + getVertexData(j++, points[0]); while (j < end) { - getVertexData(j++, points[1]); + getVertexData(j++, points[1]); dir.x = points[1].x - points[0].x; dir.y = points[1].y - points[0].y; dir.z = points[1].z - points[0].z; @@ -401,7 +401,7 @@ class LineStripArrayRetained extends GeometryStripArrayRetained { (dist[0] <= 1.0)) { return true; } - points[0].set(points[1]); + points[0].set(points[1]); } } break; @@ -421,10 +421,10 @@ class LineStripArrayRetained extends GeometryStripArrayRetained { while (i < stripVertexCounts.length) { j = stripStartVertexIndices[i]; end = j + stripVertexCounts[i++]; - getVertexData(j++, pnts[0]); + getVertexData(j++, pnts[0]); thisToOtherVworld.transform(pnts[0]); while (j < end) { - getVertexData(j++, pnts[1]); + getVertexData(j++, pnts[1]); thisToOtherVworld.transform(pnts[1]); if (geom.intersect(pnts)) { return true; @@ -452,9 +452,9 @@ class LineStripArrayRetained extends GeometryStripArrayRetained { while (i < stripVertexCounts.length) { j = stripStartVertexIndices[i]; end = j + stripVertexCounts[i++]; - getVertexData(j++, pnts[0]); + getVertexData(j++, pnts[0]); while ( j < end) { - getVertexData(j++, pnts[1]); + getVertexData(j++, pnts[1]); if (intersectBoundingBox(pnts, box, null, null)) { return true; } @@ -467,9 +467,9 @@ class LineStripArrayRetained extends GeometryStripArrayRetained { while (i < stripVertexCounts.length) { j = stripStartVertexIndices[i]; end = j + stripVertexCounts[i++]; - getVertexData(j++, pnts[0]); + getVertexData(j++, pnts[0]); while ( j < end) { - getVertexData(j++, pnts[1]); + getVertexData(j++, pnts[1]); if (intersectBoundingSphere(pnts, bsphere, null, null)) { return true; @@ -484,9 +484,9 @@ class LineStripArrayRetained extends GeometryStripArrayRetained { while (i < stripVertexCounts.length) { j = stripStartVertexIndices[i]; end = j + stripVertexCounts[i++]; - getVertexData(j++, pnts[0]); + getVertexData(j++, pnts[0]); while ( j < end) { - getVertexData(j++, pnts[1]); + getVertexData(j++, pnts[1]); if (intersectBoundingPolytope(pnts, bpolytope, null, null)) { return true; @@ -497,7 +497,7 @@ class LineStripArrayRetained extends GeometryStripArrayRetained { break; default: throw new RuntimeException("Bounds not supported for intersection " - + targetBound); + + targetBound); } return false; @@ -520,7 +520,7 @@ class LineStripArrayRetained extends GeometryStripArrayRetained { - while (i < stripVertexCounts.length) { + while (i < stripVertexCounts.length) { j = stripStartVertexIndices[i]; end = j + stripVertexCounts[i++]; getVertexData(j++, pnt0); diff --git a/src/classes/share/javax/media/j3d/LinearFog.java b/src/classes/share/javax/media/j3d/LinearFog.java index 6b6cf03..65865b0 100644 --- a/src/classes/share/javax/media/j3d/LinearFog.java +++ b/src/classes/share/javax/media/j3d/LinearFog.java @@ -246,7 +246,7 @@ public class LinearFog extends Fog { * <code>originalNode</code> into * the current node. This method is called from the * <code>cloneNode</code> method which is, in turn, called by the - * <code>cloneTree</code> method.<P> + * <code>cloneTree</code> method.<P> * * @param originalNode the original node to duplicate. * @param forceDuplicate when set to <code>true</code>, causes the diff --git a/src/classes/share/javax/media/j3d/LinearFogRetained.java b/src/classes/share/javax/media/j3d/LinearFogRetained.java index 4205ae7..bc7782e 100644 --- a/src/classes/share/javax/media/j3d/LinearFogRetained.java +++ b/src/classes/share/javax/media/j3d/LinearFogRetained.java @@ -113,7 +113,7 @@ class LinearFogRetained extends FogRetained { double getBackDistance(){ return this.backDistance; } - /** + /** * This method and its native counterpart update the native context * fog values. */ @@ -123,11 +123,11 @@ class LinearFogRetained extends FogRetained { color.x, color.y, color.z, frontDistanceInEc, backDistanceInEc); } - + void setLive(SetLiveState s) { GroupRetained group; - + super.setLive(s); // Initialize the mirror object, this needs to be done, when @@ -148,7 +148,7 @@ class LinearFogRetained extends FogRetained { } Object[] scopeInfo = new Object[2]; scopeInfo[0] = ((scopes.size() > 0) ? Boolean.TRUE:Boolean.FALSE); - scopeInfo[1] = addScopeList; + scopeInfo[1] = addScopeList; createMessage.args[2] = scopeInfo; Color3f clr = new Color3f(color); createMessage.args[3] = clr; @@ -160,12 +160,12 @@ class LinearFogRetained extends FogRetained { obj[3] = geometryBackground; obj[4] = new Double(frontDistance); obj[5] = new Double(backDistance); - + createMessage.args[4] = obj; VirtualUniverse.mc.processMessage(createMessage); } - + // The update Object function. // Note : if you add any more fields here , you need to update @@ -175,16 +175,16 @@ class LinearFogRetained extends FogRetained { int component = ((Integer)objs[1]).intValue(); Transform3D trans; - if ((component & FRONT_DISTANCE_CHANGED) != 0) + if ((component & FRONT_DISTANCE_CHANGED) != 0) ((LinearFogRetained)mirrorFog).frontDistance = ((Double)objs[2]).doubleValue(); - if ((component & BACK_DISTANCE_CHANGED) != 0) + if ((component & BACK_DISTANCE_CHANGED) != 0) ((LinearFogRetained)mirrorFog).backDistance = ((Double)objs[2]).doubleValue(); if ((component & INIT_MIRROR) != 0) { ((LinearFogRetained)mirrorFog).frontDistance = ((Double)((Object[])objs[4])[4]).doubleValue(); ((LinearFogRetained)mirrorFog).backDistance = ((Double)((Object[])objs[4])[5]).doubleValue(); - + } - ((LinearFogRetained)mirrorFog).setLocalToVworldScale(getLastLocalToVworld().getDistanceScale()); + ((LinearFogRetained)mirrorFog).setLocalToVworldScale(getLastLocalToVworld().getDistanceScale()); super.updateMirrorObject(objs); } diff --git a/src/classes/share/javax/media/j3d/Link.java b/src/classes/share/javax/media/j3d/Link.java index de3e3d9..b4922c5 100644 --- a/src/classes/share/javax/media/j3d/Link.java +++ b/src/classes/share/javax/media/j3d/Link.java @@ -40,14 +40,14 @@ package javax.media.j3d; public class Link extends Leaf { /** - * For Link nodes, specifies that the node allows access to + * For Link nodes, specifies that the node allows access to * its object's SharedGroup information. */ public static final int ALLOW_SHARED_GROUP_READ = CapabilityBits.LINK_ALLOW_SHARED_GROUP_READ; /** - * For Link nodes, specifies that the node allows writing + * For Link nodes, specifies that the node allows writing * its object's SharedGroup information. */ public static final int @@ -57,7 +57,7 @@ public class Link extends Leaf { private static final int[] readCapabilities = { ALLOW_SHARED_GROUP_READ }; - + /** * Constructs a Link node object that does not yet point to a * SharedGroup node. @@ -145,7 +145,7 @@ public class Link extends Leaf { * <code>originalNode</code> into * the current node. This method is called from the * <code>cloneNode</code> method which is, in turn, called by the - * <code>cloneTree</code> method.<P> + * <code>cloneTree</code> method.<P> * * @param originalNode the original node to duplicate. * @param forceDuplicate when set to <code>true</code>, causes the diff --git a/src/classes/share/javax/media/j3d/LinkRetained.java b/src/classes/share/javax/media/j3d/LinkRetained.java index 8743b7e..3564a3c 100644 --- a/src/classes/share/javax/media/j3d/LinkRetained.java +++ b/src/classes/share/javax/media/j3d/LinkRetained.java @@ -41,7 +41,7 @@ class LinkRetained extends LeafRetained { * The SharedGroup component of the link node. */ SharedGroupRetained sharedGroup; - + static String plus = "+"; // This is used when setLive to check for cycle scene graph @@ -53,7 +53,7 @@ class LinkRetained extends LeafRetained { ((BoundingBox)localBounds).setLower( 1.0, 1.0, 1.0); ((BoundingBox)localBounds).setUpper(-1.0,-1.0,-1.0); } - + /** * Sets the SharedGroup reference. * @param sharedGroup the SharedGroup node @@ -63,7 +63,7 @@ class LinkRetained extends LeafRetained { // in already link to another link and live. HashKey newKeys[] = null; boolean abort = false; - + if (source.isLive()) { // bug 4370407: if sharedGroup is a parent, then don't do anything if (sharedGroup != null) { @@ -76,27 +76,27 @@ class LinkRetained extends LeafRetained { } } } - if (abort) + if (abort) return; } - + newKeys = getNewKeys(locale.nodeId, localToVworldKeys); - + if (this.sharedGroup != null) { ((GroupRetained) parent).checkClearLive(this.sharedGroup, newKeys, true, null, - 0, 0, this); + 0, 0, this); this.sharedGroup.parents.removeElement(this); - } + } } - + if (sharedGroup != null) { this.sharedGroup = (SharedGroupRetained)sharedGroup.retained; } else { this.sharedGroup = null; } - + if (source.isLive() && (sharedGroup != null)) { this.sharedGroup.parents.addElement(this); @@ -105,16 +105,16 @@ class LinkRetained extends LeafRetained { int ci = ((GroupRetained) parent).indexOfChild((Node)this.sharedGroup.source); ((GroupRetained) parent).checkSetLive(this.sharedGroup, ci, newKeys, true, null, - 0, this); + 0, this); } catch (SceneGraphCycleException e) { throw e; } finally { visited = false; } } - + } - + /** * Retrieves the SharedGroup reference. * @return the SharedGroup node @@ -126,7 +126,7 @@ class LinkRetained extends LeafRetained { void computeCombineBounds(Bounds bounds) { - if (boundsAutoCompute) { + if (boundsAutoCompute) { sharedGroup.computeCombineBounds(bounds); } else { // Should this be lock too ? ( MT safe ? ) @@ -135,8 +135,8 @@ class LinkRetained extends LeafRetained { } } } - - + + /** * Gets the bounding object of a node. * @return the node's bounding object @@ -145,9 +145,9 @@ class LinkRetained extends LeafRetained { return (boundsAutoCompute ? (Bounds)sharedGroup.getBounds().clone() : super.getBounds()); - } - - + } + + /** * assign a name to this node when it is made live. */ @@ -177,14 +177,14 @@ class LinkRetained extends LeafRetained { try { this.sharedGroup.setLive(s); } catch (SceneGraphCycleException e) { - throw e; + throw e; } finally { - visited = false; + visited = false; } s.inSharedGroup = inSharedGroup; s.keys = oldKeys; - + localBounds.setWithLock(this.sharedGroup.localBounds); } @@ -220,12 +220,12 @@ class LinkRetained extends LeafRetained { localBounds.setWithLock(sharedGroup.localBounds); parent.recombineAbove(); } - + /** * assign a name to this node when it is made live. */ void clearLive(SetLiveState s) { - + if (sharedGroup != null) { HashKey newKeys[] = getNewKeys(s.locale.nodeId, s.keys); super.clearLive(s); @@ -325,7 +325,7 @@ class LinkRetained extends LeafRetained { HashKey[] getNewKeys(String localeNodeId, HashKey oldKeys[]) { HashKey newKeys[]; - + if (!inSharedGroup) { newKeys = new HashKey[1]; newKeys[0] = new HashKey(localeNodeId); @@ -334,7 +334,7 @@ class LinkRetained extends LeafRetained { // Need to append this link node id to all keys passed in. newKeys = new HashKey[oldKeys.length]; for (int i=oldKeys.length-1; i>=0; i--) { - newKeys[i] = new HashKey(oldKeys[i].toString() + newKeys[i] = new HashKey(oldKeys[i].toString() + plus + nodeId); } } diff --git a/src/classes/share/javax/media/j3d/Locale.java b/src/classes/share/javax/media/j3d/Locale.java index 5407983..ab92bd3 100644 --- a/src/classes/share/javax/media/j3d/Locale.java +++ b/src/classes/share/javax/media/j3d/Locale.java @@ -140,7 +140,7 @@ public class Locale extends Object { * @param y an eight element array specifying the y position * @param z an eight element array specifying the z position */ - public void setHiRes(int[] x, int[] y, int[] z) { + public void setHiRes(int[] x, int[] y, int[] z) { this.hiRes.setHiResCoord(x, y, z); } @@ -163,7 +163,7 @@ public class Locale extends Object { } /** - * Add a new branch graph rooted at BranchGroup to + * Add a new branch graph rooted at BranchGroup to * the list of branch graphs. * @param branchGroup root of the branch graph to be added * @exception IllegalStateException if this Locale has been @@ -214,7 +214,7 @@ public class Locale extends Object { s.currentTransformsIndex[0] = new int[2]; s.currentTransformsIndex[0][0] = 0; s.currentTransformsIndex[0][1] = 0; - + s.localToVworld = s.currentTransforms; s.localToVworldIndex = s.currentTransformsIndex; @@ -238,7 +238,7 @@ public class Locale extends Object { createMessage.args[2] = s.ogOrderedIdList.toArray(); createMessage.args[3] = s.ogCIOList.toArray(); createMessage.args[4] = s.ogCIOTableList.toArray(); - + VirtualUniverse.mc.processMessage(createMessage); createMessage = new J3dMessage(); @@ -249,8 +249,8 @@ public class Locale extends Object { createMessage.args[1] = s.changedViewList; createMessage.args[2] = s.keyList; VirtualUniverse.mc.processMessage(createMessage); - - + + createMessage = new J3dMessage(); createMessage.threads = s.notifyThreads; createMessage.type = J3dMessage.INSERT_NODES; @@ -282,7 +282,7 @@ public class Locale extends Object { } /** - * Removes a branch graph rooted at BranchGroup from + * Removes a branch graph rooted at BranchGroup from * the list of branch graphs. * @param branchGroup root of the branch graph to be removed * @exception IllegalStateException if this Locale has been @@ -337,7 +337,7 @@ public class Locale extends Object { // The method that does the work once the lock is acquired. - void doRemoveBranchGraph(BranchGroup branchGroup, + void doRemoveBranchGraph(BranchGroup branchGroup, J3dMessage messages[], int startIndex) { BranchGroupRetained bgr = (BranchGroupRetained)branchGroup.retained; @@ -411,7 +411,7 @@ public class Locale extends Object { } /** - * Replaces the branch graph rooted at oldGroup in the list of + * Replaces the branch graph rooted at oldGroup in the list of * branch graphs with the branch graph rooted at * newGroup. * @param oldGroup root of the branch graph to be replaced. @@ -455,7 +455,7 @@ public class Locale extends Object { BranchGroupRetained nbgr = (BranchGroupRetained)newGroup.retained; J3dMessage createMessage; J3dMessage destroyMessage; - + branchGroups.removeElement(oldGroup); obgr.attachedToLocale = false; @@ -514,7 +514,7 @@ public class Locale extends Object { universe.setLiveState.switchStates.add(new SwitchState(false)); nbgr.setLive(universe.setLiveState); - + createMessage = new J3dMessage(); createMessage.threads = J3dThread.UPDATE_RENDER| J3dThread.UPDATE_RENDERING_ENVIRONMENT; @@ -569,7 +569,7 @@ public class Locale extends Object { public int numBranchGraphs(){ return branchGroups.size(); } - + /** * Gets an Enumeration object of all branch graphs in this Locale. * @return an Enumeration object of all branch graphs. @@ -584,44 +584,44 @@ public class Locale extends Object { return branchGroups.elements(); } - + void validateModeFlagAndPickShape(int mode, int flags, PickShape pickShape) { if (universe == null) { throw new IllegalStateException(J3dI18N.getString("Locale4")); } - + if((mode != PickInfo.PICK_BOUNDS) && (mode != PickInfo.PICK_GEOMETRY)) { - + throw new IllegalArgumentException(J3dI18N.getString("Locale5")); } - + if((pickShape instanceof PickPoint) && (mode == PickInfo.PICK_GEOMETRY)) { throw new IllegalArgumentException(J3dI18N.getString("Locale6")); } - + if(((flags & PickInfo.CLOSEST_GEOM_INFO) != 0) && ((flags & PickInfo.ALL_GEOM_INFO) != 0)) { throw new IllegalArgumentException(J3dI18N.getString("Locale7")); } - - if((mode == PickInfo.PICK_BOUNDS) && - (((flags & (PickInfo.CLOSEST_GEOM_INFO | + + if((mode == PickInfo.PICK_BOUNDS) && + (((flags & (PickInfo.CLOSEST_GEOM_INFO | PickInfo.ALL_GEOM_INFO | PickInfo.CLOSEST_DISTANCE | PickInfo.CLOSEST_INTERSECTION_POINT)) != 0))) { - + throw new IllegalArgumentException(J3dI18N.getString("Locale8")); } - - if((pickShape instanceof PickBounds) && - (((flags & (PickInfo.CLOSEST_GEOM_INFO | + + if((pickShape instanceof PickBounds) && + (((flags & (PickInfo.CLOSEST_GEOM_INFO | PickInfo.ALL_GEOM_INFO | PickInfo.CLOSEST_DISTANCE | PickInfo.CLOSEST_INTERSECTION_POINT)) != 0))) { - + throw new IllegalArgumentException(J3dI18N.getString("Locale9")); - } + } } /** @@ -643,7 +643,7 @@ public class Locale extends Object { PickInfo[] pickInfoArr = pickAll( PickInfo.PICK_BOUNDS, PickInfo.SCENEGRAPHPATH, pickShape); - + if(pickInfoArr == null) { return null; } @@ -653,25 +653,25 @@ public class Locale extends Object { } return sgpArr; - + } /** - * Returns an array unsorted references to all the PickInfo objects that are pickable - * below this <code>Locale</code> that intersect with PickShape. - * The accuracy of the pick is set by the pick mode. The mode include : - * PickInfo.PICK_BOUNDS and PickInfo.PICK_GEOMETRY. The amount of information returned - * is specified via a masked variable, flags, indicating which components are - * present in each returned PickInfo object. + * Returns an array unsorted references to all the PickInfo objects that are pickable + * below this <code>Locale</code> that intersect with PickShape. + * The accuracy of the pick is set by the pick mode. The mode include : + * PickInfo.PICK_BOUNDS and PickInfo.PICK_GEOMETRY. The amount of information returned + * is specified via a masked variable, flags, indicating which components are + * present in each returned PickInfo object. * * @param mode picking mode, one of <code>PickInfo.PICK_BOUNDS</code> or <code>PickInfo.PICK_GEOMETRY</code>. * - * @param flags a mask indicating which components are present in each PickInfo object. - * This is specified as one or more individual bits that are bitwise "OR"ed together to + * @param flags a mask indicating which components are present in each PickInfo object. + * This is specified as one or more individual bits that are bitwise "OR"ed together to * describe the PickInfo data. The flags include : * <ul> - * <code>PickInfo.SCENEGRAPHPATH</code> - request for computed SceneGraphPath.<br> + * <code>PickInfo.SCENEGRAPHPATH</code> - request for computed SceneGraphPath.<br> * <code>PickInfo.NODE</code> - request for computed intersected Node.<br> * <code>PickInfo.LOCAL_TO_VWORLD</code> - request for computed local to virtual world transform.<br> * <code>PickInfo.CLOSEST_INTERSECTION_POINT</code> - request for closest intersection point.<br> @@ -682,20 +682,20 @@ public class Locale extends Object { * * @param pickShape the description of this picking volume or area. * - * @exception IllegalArgumentException if flags contains both CLOSEST_GEOM_INFO and + * @exception IllegalArgumentException if flags contains both CLOSEST_GEOM_INFO and * ALL_GEOM_INFO. * * @exception IllegalArgumentException if pickShape is a PickPoint and pick mode * is set to PICK_GEOMETRY. * - * @exception IllegalArgumentException if pick mode is neither PICK_BOUNDS + * @exception IllegalArgumentException if pick mode is neither PICK_BOUNDS * nor PICK_GEOMETRY. * - * @exception IllegalArgumentException if pick mode is PICK_BOUNDS + * @exception IllegalArgumentException if pick mode is PICK_BOUNDS * and flags includes any of CLOSEST_INTERSECTION_POINT, CLOSEST_DISTANCE, * CLOSEST_GEOM_INFO or ALL_GEOM_INFO. * - * @exception IllegalArgumentException if pickShape is PickBounds + * @exception IllegalArgumentException if pickShape is PickBounds * and flags includes any of CLOSEST_INTERSECTION_POINT, CLOSEST_DISTANCE, * CLOSEST_GEOM_INFO or ALL_GEOM_INFO. * @@ -706,14 +706,14 @@ public class Locale extends Object { * PICK_GEOMETRY and the Geometry.ALLOW_INTERSECT capability bit * is not set in any Geometry objects referred to by any shape * node whose bounds intersects the PickShape. - * + * * @exception CapabilityNotSetException if flags contains any of * CLOSEST_INTERSECTION_POINT, CLOSEST_DISTANCE, CLOSEST_GEOM_INFO * or ALL_GEOM_INFO, and the capability bits that control reading of * coordinate data are not set in any GeometryArray object referred * to by any shape node that intersects the PickShape. * The capability bits that must be set to avoid this exception are as follows : - * <ul> + * <ul> * <li>By-copy geometry : GeometryArray.ALLOW_COORDINATE_READ</li> * <li>By-reference geometry : GeometryArray.ALLOW_REF_DATA_READ</li> * <li>Indexed geometry : IndexedGeometryArray.ALLOW_COORDINATE_INDEX_READ @@ -722,16 +722,16 @@ public class Locale extends Object { * * @see BranchGroup#pickAll(int,int,javax.media.j3d.PickShape) * @see PickInfo - * + * * @since Java 3D 1.4 * */ public PickInfo[] pickAll( int mode, int flags, PickShape pickShape ) { - - validateModeFlagAndPickShape(mode, flags, pickShape); + + validateModeFlagAndPickShape(mode, flags, pickShape); GeometryAtom geomAtoms[] = universe.geometryStructure.pickAll(this, pickShape); - + return PickInfo.pick(this, geomAtoms, mode, flags, pickShape, PickInfo.PICK_ALL); } @@ -768,27 +768,27 @@ public class Locale extends Object { sgpArr[i] = pickInfoArr[i].getSceneGraphPath(); } - return sgpArr; - + return sgpArr; + } /** * Returns a sorted array of PickInfo references to all the pickable - * items that intersect with the pickShape. Element [0] references + * items that intersect with the pickShape. Element [0] references * the item closest to <i>origin</i> of PickShape successive array * elements are further from the <i>origin</i> - * The accuracy of the pick is set by the pick mode. The mode include : - * PickInfo.PICK_BOUNDS and PickInfo.PICK_GEOMETRY. The amount of information returned - * is specified via a masked variable, flags, indicating which components are - * present in each returned PickInfo object. + * The accuracy of the pick is set by the pick mode. The mode include : + * PickInfo.PICK_BOUNDS and PickInfo.PICK_GEOMETRY. The amount of information returned + * is specified via a masked variable, flags, indicating which components are + * present in each returned PickInfo object. * * @param mode picking mode, one of <code>PickInfo.PICK_BOUNDS</code> or <code>PickInfo.PICK_GEOMETRY</code>. * - * @param flags a mask indicating which components are present in each PickInfo object. - * This is specified as one or more individual bits that are bitwise "OR"ed together to + * @param flags a mask indicating which components are present in each PickInfo object. + * This is specified as one or more individual bits that are bitwise "OR"ed together to * describe the PickInfo data. The flags include : * <ul> - * <code>PickInfo.SCENEGRAPHPATH</code> - request for computed SceneGraphPath.<br> + * <code>PickInfo.SCENEGRAPHPATH</code> - request for computed SceneGraphPath.<br> * <code>PickInfo.NODE</code> - request for computed intersected Node.<br> * <code>PickInfo.LOCAL_TO_VWORLD</code> - request for computed local to virtual world transform.<br> * <code>PickInfo.CLOSEST_INTERSECTION_POINT</code> - request for closest intersection point.<br> @@ -799,20 +799,20 @@ public class Locale extends Object { * * @param pickShape the description of this picking volume or area. * - * @exception IllegalArgumentException if flags contains both CLOSEST_GEOM_INFO and + * @exception IllegalArgumentException if flags contains both CLOSEST_GEOM_INFO and * ALL_GEOM_INFO. * * @exception IllegalArgumentException if pickShape is a PickPoint and pick mode * is set to PICK_GEOMETRY. * - * @exception IllegalArgumentException if pick mode is neither PICK_BOUNDS + * @exception IllegalArgumentException if pick mode is neither PICK_BOUNDS * nor PICK_GEOMETRY. * - * @exception IllegalArgumentException if pick mode is PICK_BOUNDS + * @exception IllegalArgumentException if pick mode is PICK_BOUNDS * and flags includes any of CLOSEST_INTERSECTION_POINT, CLOSEST_DISTANCE, * CLOSEST_GEOM_INFO or ALL_GEOM_INFO. * - * @exception IllegalArgumentException if pickShape is PickBounds + * @exception IllegalArgumentException if pickShape is PickBounds * and flags includes any of CLOSEST_INTERSECTION_POINT, CLOSEST_DISTANCE, * CLOSEST_GEOM_INFO or ALL_GEOM_INFO. * @@ -823,14 +823,14 @@ public class Locale extends Object { * PICK_GEOMETRY and the Geometry.ALLOW_INTERSECT capability bit * is not set in any Geometry objects referred to by any shape * node whose bounds intersects the PickShape. - * + * * @exception CapabilityNotSetException if flags contains any of * CLOSEST_INTERSECTION_POINT, CLOSEST_DISTANCE, CLOSEST_GEOM_INFO * or ALL_GEOM_INFO, and the capability bits that control reading of * coordinate data are not set in any GeometryArray object referred * to by any shape node that intersects the PickShape. * The capability bits that must be set to avoid this exception are as follows : - * <ul> + * <ul> * <li>By-copy geometry : GeometryArray.ALLOW_COORDINATE_READ</li> * <li>By-reference geometry : GeometryArray.ALLOW_REF_DATA_READ</li> * <li>Indexed geometry : IndexedGeometryArray.ALLOW_COORDINATE_INDEX_READ @@ -839,21 +839,21 @@ public class Locale extends Object { * * @see BranchGroup#pickAllSorted(int,int,javax.media.j3d.PickShape) * @see PickInfo - * + * * @since Java 3D 1.4 * */ public PickInfo[] pickAllSorted( int mode, int flags, PickShape pickShape ) { - validateModeFlagAndPickShape(mode, flags, pickShape); + validateModeFlagAndPickShape(mode, flags, pickShape); GeometryAtom geomAtoms[] = universe.geometryStructure.pickAll(this, pickShape); if ((geomAtoms == null) || (geomAtoms.length == 0)) { return null; } - + PickInfo[] pickInfoArr = null; - + if (mode == PickInfo.PICK_GEOMETRY) { // Need to have closestDistance set flags |= PickInfo.CLOSEST_DISTANCE; @@ -864,9 +864,9 @@ public class Locale extends Object { } else { PickInfo.sortGeomAtoms(geomAtoms, pickShape); - pickInfoArr= PickInfo.pick(this, geomAtoms, mode, flags, pickShape, PickInfo.PICK_ALL); + pickInfoArr= PickInfo.pick(this, geomAtoms, mode, flags, pickShape, PickInfo.PICK_ALL); } - + return pickInfoArr; } @@ -891,7 +891,7 @@ public class Locale extends Object { PickInfo pickInfo = pickClosest( PickInfo.PICK_BOUNDS, PickInfo.SCENEGRAPHPATH, pickShape); - + if(pickInfo == null) { return null; } @@ -901,18 +901,18 @@ public class Locale extends Object { /** * Returns a PickInfo which references the pickable item * which is closest to the origin of <code>pickShape</code>. - * The accuracy of the pick is set by the pick mode. The mode include : - * PickInfo.PICK_BOUNDS and PickInfo.PICK_GEOMETRY. The amount of information returned - * is specified via a masked variable, flags, indicating which components are - * present in each returned PickInfo object. + * The accuracy of the pick is set by the pick mode. The mode include : + * PickInfo.PICK_BOUNDS and PickInfo.PICK_GEOMETRY. The amount of information returned + * is specified via a masked variable, flags, indicating which components are + * present in each returned PickInfo object. * * @param mode picking mode, one of <code>PickInfo.PICK_BOUNDS</code> or <code>PickInfo.PICK_GEOMETRY</code>. * - * @param flags a mask indicating which components are present in each PickInfo object. - * This is specified as one or more individual bits that are bitwise "OR"ed together to + * @param flags a mask indicating which components are present in each PickInfo object. + * This is specified as one or more individual bits that are bitwise "OR"ed together to * describe the PickInfo data. The flags include : * <ul> - * <code>PickInfo.SCENEGRAPHPATH</code> - request for computed SceneGraphPath.<br> + * <code>PickInfo.SCENEGRAPHPATH</code> - request for computed SceneGraphPath.<br> * <code>PickInfo.NODE</code> - request for computed intersected Node.<br> * <code>PickInfo.LOCAL_TO_VWORLD</code> - request for computed local to virtual world transform.<br> * <code>PickInfo.CLOSEST_INTERSECTION_POINT</code> - request for closest intersection point.<br> @@ -923,20 +923,20 @@ public class Locale extends Object { * * @param pickShape the description of this picking volume or area. * - * @exception IllegalArgumentException if flags contains both CLOSEST_GEOM_INFO and + * @exception IllegalArgumentException if flags contains both CLOSEST_GEOM_INFO and * ALL_GEOM_INFO. * * @exception IllegalArgumentException if pickShape is a PickPoint and pick mode * is set to PICK_GEOMETRY. * - * @exception IllegalArgumentException if pick mode is neither PICK_BOUNDS + * @exception IllegalArgumentException if pick mode is neither PICK_BOUNDS * nor PICK_GEOMETRY. * - * @exception IllegalArgumentException if pick mode is PICK_BOUNDS + * @exception IllegalArgumentException if pick mode is PICK_BOUNDS * and flags includes any of CLOSEST_INTERSECTION_POINT, CLOSEST_DISTANCE, * CLOSEST_GEOM_INFO or ALL_GEOM_INFO. * - * @exception IllegalArgumentException if pickShape is PickBounds + * @exception IllegalArgumentException if pickShape is PickBounds * and flags includes any of CLOSEST_INTERSECTION_POINT, CLOSEST_DISTANCE, * CLOSEST_GEOM_INFO or ALL_GEOM_INFO. * @@ -947,14 +947,14 @@ public class Locale extends Object { * PICK_GEOMETRY and the Geometry.ALLOW_INTERSECT capability bit * is not set in any Geometry objects referred to by any shape * node whose bounds intersects the PickShape. - * + * * @exception CapabilityNotSetException if flags contains any of * CLOSEST_INTERSECTION_POINT, CLOSEST_DISTANCE, CLOSEST_GEOM_INFO * or ALL_GEOM_INFO, and the capability bits that control reading of * coordinate data are not set in any GeometryArray object referred * to by any shape node that intersects the PickShape. * The capability bits that must be set to avoid this exception are as follows : - * <ul> + * <ul> * <li>By-copy geometry : GeometryArray.ALLOW_COORDINATE_READ</li> * <li>By-reference geometry : GeometryArray.ALLOW_REF_DATA_READ</li> * <li>Indexed geometry : IndexedGeometryArray.ALLOW_COORDINATE_INDEX_READ @@ -963,7 +963,7 @@ public class Locale extends Object { * * @see BranchGroup#pickClosest(int,int,javax.media.j3d.PickShape) * @see PickInfo - * + * * @since Java 3D 1.4 * */ @@ -972,13 +972,13 @@ public class Locale extends Object { PickInfo[] pickInfoArr = null; pickInfoArr = pickAllSorted( mode, flags, pickShape ); - + if(pickInfoArr == null) { return null; } - + return pickInfoArr[0]; - + } /** @@ -996,32 +996,32 @@ public class Locale extends Object { if (universe == null) { throw new IllegalStateException(J3dI18N.getString("Locale4")); } - + PickInfo pickInfo = pickAny( PickInfo.PICK_BOUNDS, PickInfo.SCENEGRAPHPATH, pickShape); - + if(pickInfo == null) { return null; } return pickInfo.getSceneGraphPath(); - + } /** * Returns a PickInfo which references the pickable item below this * Locale which intersects with <code>pickShape</code>. - * The accuracy of the pick is set by the pick mode. The mode include : - * PickInfo.PICK_BOUNDS and PickInfo.PICK_GEOMETRY. The amount of information returned - * is specified via a masked variable, flags, indicating which components are - * present in each returned PickInfo object. + * The accuracy of the pick is set by the pick mode. The mode include : + * PickInfo.PICK_BOUNDS and PickInfo.PICK_GEOMETRY. The amount of information returned + * is specified via a masked variable, flags, indicating which components are + * present in each returned PickInfo object. * * @param mode picking mode, one of <code>PickInfo.PICK_BOUNDS</code> or <code>PickInfo.PICK_GEOMETRY</code>. * - * @param flags a mask indicating which components are present in each PickInfo object. - * This is specified as one or more individual bits that are bitwise "OR"ed together to + * @param flags a mask indicating which components are present in each PickInfo object. + * This is specified as one or more individual bits that are bitwise "OR"ed together to * describe the PickInfo data. The flags include : * <ul> - * <code>PickInfo.SCENEGRAPHPATH</code> - request for computed SceneGraphPath.<br> + * <code>PickInfo.SCENEGRAPHPATH</code> - request for computed SceneGraphPath.<br> * <code>PickInfo.NODE</code> - request for computed intersected Node.<br> * <code>PickInfo.LOCAL_TO_VWORLD</code> - request for computed local to virtual world transform.<br> * <code>PickInfo.CLOSEST_INTERSECTION_POINT</code> - request for closest intersection point.<br> @@ -1032,20 +1032,20 @@ public class Locale extends Object { * * @param pickShape the description of this picking volume or area. * - * @exception IllegalArgumentException if flags contains both CLOSEST_GEOM_INFO and + * @exception IllegalArgumentException if flags contains both CLOSEST_GEOM_INFO and * ALL_GEOM_INFO. * * @exception IllegalArgumentException if pickShape is a PickPoint and pick mode * is set to PICK_GEOMETRY. * - * @exception IllegalArgumentException if pick mode is neither PICK_BOUNDS + * @exception IllegalArgumentException if pick mode is neither PICK_BOUNDS * nor PICK_GEOMETRY. * - * @exception IllegalArgumentException if pick mode is PICK_BOUNDS + * @exception IllegalArgumentException if pick mode is PICK_BOUNDS * and flags includes any of CLOSEST_INTERSECTION_POINT, CLOSEST_DISTANCE, * CLOSEST_GEOM_INFO or ALL_GEOM_INFO. * - * @exception IllegalArgumentException if pickShape is PickBounds + * @exception IllegalArgumentException if pickShape is PickBounds * and flags includes any of CLOSEST_INTERSECTION_POINT, CLOSEST_DISTANCE, * CLOSEST_GEOM_INFO or ALL_GEOM_INFO. * @@ -1056,14 +1056,14 @@ public class Locale extends Object { * PICK_GEOMETRY and the Geometry.ALLOW_INTERSECT capability bit * is not set in any Geometry objects referred to by any shape * node whose bounds intersects the PickShape. - * + * * @exception CapabilityNotSetException if flags contains any of * CLOSEST_INTERSECTION_POINT, CLOSEST_DISTANCE, CLOSEST_GEOM_INFO * or ALL_GEOM_INFO, and the capability bits that control reading of * coordinate data are not set in any GeometryArray object referred * to by any shape node that intersects the PickShape. * The capability bits that must be set to avoid this exception are as follows : - * <ul> + * <ul> * <li>By-copy geometry : GeometryArray.ALLOW_COORDINATE_READ</li> * <li>By-reference geometry : GeometryArray.ALLOW_REF_DATA_READ</li> * <li>Indexed geometry : IndexedGeometryArray.ALLOW_COORDINATE_INDEX_READ @@ -1072,7 +1072,7 @@ public class Locale extends Object { * * @see BranchGroup#pickAny(int,int,javax.media.j3d.PickShape) * @see PickInfo - * + * * @since Java 3D 1.4 * */ @@ -1080,15 +1080,15 @@ public class Locale extends Object { validateModeFlagAndPickShape(mode, flags, pickShape); GeometryAtom geomAtoms[] = universe.geometryStructure.pickAll(this, pickShape); - + PickInfo[] pickInfoArr = PickInfo.pick(this, geomAtoms, mode, flags, pickShape, PickInfo.PICK_ANY); - + if(pickInfoArr == null) { return null; } - + return pickInfoArr[0]; - + } } diff --git a/src/classes/share/javax/media/j3d/MRSWLock.java b/src/classes/share/javax/media/j3d/MRSWLock.java index f5ca22f..157d9b5 100644 --- a/src/classes/share/javax/media/j3d/MRSWLock.java +++ b/src/classes/share/javax/media/j3d/MRSWLock.java @@ -52,7 +52,7 @@ class MRSWLock { writeRequested = 0; lockRequested = 0; } - + synchronized final void readLock() { lockRequested++; while((write == true) || (writeRequested > 0)) { @@ -61,17 +61,17 @@ class MRSWLock { lockRequested--; readCount++; } - + synchronized final void readUnlock() { if(readCount>0) readCount--; else if(debug) System.err.println("ReadWriteLock.java : Problem! readCount is >= 0."); - + if(lockRequested>0) notifyAll(); } - + synchronized final void writeLock() { lockRequested++; writeRequested++; @@ -89,5 +89,5 @@ class MRSWLock { if(lockRequested>0) notifyAll(); } - + } diff --git a/src/classes/share/javax/media/j3d/MasterControl.java b/src/classes/share/javax/media/j3d/MasterControl.java index c8c5e1e..7c50c52 100644 --- a/src/classes/share/javax/media/j3d/MasterControl.java +++ b/src/classes/share/javax/media/j3d/MasterControl.java @@ -45,14 +45,14 @@ import java.util.logging.Logger; class MasterControl { /** - * Options for the runMonitor + * Options for the runMonitor */ static final int CHECK_FOR_WORK = 0; static final int SET_WORK = 1; static final int RUN_THREADS = 2; static final int THREAD_DONE = 3; static final int SET_WORK_FOR_REQUEST_RENDERER = 5; - static final int RUN_RENDERER_CLEANUP = 6; + static final int RUN_RENDERER_CLEANUP = 6; // The thread states for MC static final int SLEEPING = 0; @@ -86,7 +86,7 @@ class MasterControl { static final Integer GETBESTCONFIG = new Integer(17); static final Integer ISCONFIGSUPPORT = new Integer(18); static final Integer SET_GRAPHICSCONFIG_FEATURES = new Integer(19); - static final Integer SET_QUERYPROPERTIES = new Integer(20); + static final Integer SET_QUERYPROPERTIES = new Integer(20); static final Integer SET_VIEW = new Integer(21); // Developer logger for reporting informational messages; see getDevLogger() @@ -119,7 +119,7 @@ class MasterControl { */ private UnorderList views = new UnorderList(1, View.class); - + /** * by MIK OF CLASSX * @@ -149,12 +149,12 @@ class MasterControl { */ private boolean lockGeometry = false; - + /** - * The number of registered views that are active + * The number of registered views that are active */ private int numActiveViews = 0; - + /** * The list of active universes get from View */ @@ -177,16 +177,16 @@ class MasterControl { private long time = 0; /** - * Use to assign threadOpts in Renderer thread. + * Use to assign threadOpts in Renderer thread. */ private long waitTimestamp = 0; /** * The current list of work threads */ - private UnorderList stateWorkThreads = + private UnorderList stateWorkThreads = new UnorderList(J3dThreadData.class); - private UnorderList renderWorkThreads = + private UnorderList renderWorkThreads = new UnorderList(J3dThreadData.class); private UnorderList requestRenderWorkThreads = new UnorderList(J3dThreadData.class); @@ -199,7 +199,7 @@ class MasterControl { /** * The list of input device scheduler thread */ - private UnorderList inputDeviceThreads = + private UnorderList inputDeviceThreads = new UnorderList(1, InputDeviceScheduler.class); /** @@ -241,13 +241,13 @@ class MasterControl { */ private boolean requestRenderWorkToDo = false; - /** + /** * The number of THREAD_DONE messages pending */ private int threadPending = 0; private int renderPending = 0; private int statePending = 0; - + /** * State variables for work lists */ @@ -267,17 +267,17 @@ class MasterControl { * The number of cpu's Java 3D may use */ private int cpuLimit; - + /** * A list of mirror objects to be updated */ private UnorderList mirrorObjects = new UnorderList(ObjectUpdate.class); /** - * The renderingAttributesStructure for updating node component + * The renderingAttributesStructure for updating node component * objects */ - private RenderingAttributesStructure renderingAttributesStructure = + private RenderingAttributesStructure renderingAttributesStructure = new RenderingAttributesStructure(); /** @@ -319,7 +319,7 @@ class MasterControl { // Flag indicating that we are on a Windows OS private static boolean isWindowsOs = false; - + // Flag indicating we are on MacOS private static boolean isMacOs = false; @@ -331,7 +331,7 @@ class MasterControl { // This is a time stamp used when context is created private long contextTimeStamp = 0; - + // This is an array of canvasIds in used private boolean[] canvasIds = null; private int canvasFreeIndex = 0; @@ -361,7 +361,7 @@ class MasterControl { // If this flag is set, then by-ref geometry will not be // put in display list boolean buildDisplayListIfPossible = false; - + // If this flag is set, then geometry arrays with vertex attributes can // be in display list. boolean vertexAttrsInDisplayList = false; @@ -401,7 +401,7 @@ class MasterControl { static Integer REMOVENOTIFY_CLEANUP = new Integer(3); static Integer RESETCANVAS_CLEANUP = new Integer(4); static Integer FREECONTEXT_CLEANUP = new Integer(5); - + // arguments for renderer resource cleanup run Object rendererCleanupArgs[] = {new Integer(Renderer.REQUESTCLEANUP), null, null}; @@ -411,15 +411,15 @@ class MasterControl { // first_time and all the extension initilialization // are done in the MT safe manner Object contextCreationLock = new Object(); - + // Flag that indicates whether to lock the DSI while rendering boolean doDsiRenderLock = false; - + // Flag that indicates the pre-1.5 behavior of enforcing power-of-two // textures. If set, then any non-power-of-two textures will throw an // exception. boolean enforcePowerOfTwo = false; - + // Flag that indicates whether the framebuffer is sharing the // Z-buffer with both the left and right eyes when in stereo mode. // If this is true, we need to clear the Z-buffer between rendering @@ -427,7 +427,7 @@ class MasterControl { boolean sharedStereoZBuffer = true; // True to disable all underlying multisampling API so it uses - // the setting in the driver. + // the setting in the driver. boolean implicitAntialiasing = false; // False to disable compiled vertex array extensions if support @@ -496,13 +496,13 @@ class MasterControl { //Default false value does affect Java3D View dispose behavior. boolean forceReleaseView = false; - // Issue 480: Cache the bounds of nodes so that getBounds does not + // Issue 480: Cache the bounds of nodes so that getBounds does not // recompute the boounds of the entire graph per call boolean cacheAutoComputedBounds = false; - + // issue 544 boolean useBoxForGroupBounds = false; - + /** * Constructs a new MasterControl object. Note that there is * exatly one MasterControl object, created statically by @@ -543,7 +543,7 @@ class MasterControl { "Off-screen Pbuffer"); viewFrustumCulling = getBooleanProperty("j3d.viewFrustumCulling", viewFrustumCulling,"View frustum culling in the renderer is"); - + sortShape3DBounds = getBooleanProperty("j3d.sortShape3DBounds", sortShape3DBounds, "Shape3D bounds enabled for transparency sorting", @@ -603,7 +603,7 @@ class MasterControl { doDsiRenderLock = getBooleanProperty("j3d.renderLock", doDsiRenderLock, "render lock"); - + // Check to see whether we enforce power-of-two textures enforcePowerOfTwo = getBooleanProperty("j3d.textureEnforcePowerOfTwo", enforcePowerOfTwo, @@ -625,7 +625,7 @@ class MasterControl { "per-frame stencil clear"); // Check to see if stereo mode is sharing the Z-buffer for both eyes. - sharedStereoZBuffer = + sharedStereoZBuffer = getBooleanProperty("j3d.sharedstereozbuffer", sharedStereoZBuffer, "shared stereo Z buffer"); @@ -657,7 +657,7 @@ class MasterControl { return Integer.getInteger("j3d.deviceSampleTime", 0); } }); - + if (samplingTime.intValue() > 0) { InputDeviceScheduler.samplingTime = samplingTime.intValue(); @@ -702,7 +702,7 @@ class MasterControl { getBooleanProperty("j3d.useBoxForGroupBounds", useBoxForGroupBounds, "Use of BoundingBox for group geometric bounds"); - + // Initialize the native J3D library if (!Pipeline.getPipeline().initializeJ3D(disableXinerama)) { throw new RuntimeException(J3dI18N.getString("MasterControl0")); @@ -719,11 +719,11 @@ class MasterControl { // Check for obsolete properties String[] obsoleteProps = { - "j3d.backgroundtexture", + "j3d.backgroundtexture", "j3d.forceNormalized", "j3d.g2ddrawpixel", - "j3d.simulatedMultiTexture", - "j3d.useFreeLists", + "j3d.simulatedMultiTexture", + "j3d.useFreeLists", }; for (int i = 0; i < obsoleteProps.length; i++) { if (getProperty(obsoleteProps[i]) != null) { @@ -734,12 +734,12 @@ class MasterControl { // Get the maximum Lights maxLights = Pipeline.getPipeline().getMaximumLights(); - // create the freelists + // create the freelists FreeListManager.createFreeLists(); // create an array canvas use registers // The 32 limit can be lifted once the - // resourceXXXMasks in other classes + // resourceXXXMasks in other classes // are change not to use integer. canvasIds = new boolean[32]; for(int i=0; i<canvasIds.length; i++) { @@ -994,7 +994,7 @@ class MasterControl { /** * Invoke from InputDeviceScheduler to create an - * InputDeviceBlockingThread. + * InputDeviceBlockingThread. */ InputDeviceBlockingThread getInputDeviceBlockingThread( final InputDevice device) { @@ -1125,7 +1125,7 @@ class MasterControl { int i; synchronized(canvasIdLock) { - // Master control need to keep count itself + // Master control need to keep count itself for(i=canvasFreeIndex; i<canvasIds.length; i++) { if(canvasIds[i] == false) break; @@ -1140,7 +1140,7 @@ class MasterControl { } return i; - + } void freeCanvasId(int canvasId) { @@ -1157,7 +1157,7 @@ class MasterControl { /** * Create a Renderer if it is not already done so. - * This is used for GraphicsConfigTemplate3D passing + * This is used for GraphicsConfigTemplate3D passing * graphics call to RequestRenderer, and for creating * an off-screen buffer for an off-screen Canvas3D. */ @@ -1197,7 +1197,7 @@ class MasterControl { synchronized (mcThreadLock) { synchronized (requestObjList) { if (mcThread == null) { - if ((type == ACTIVATE_VIEW) || + if ((type == ACTIVATE_VIEW) || (type == GETBESTCONFIG) || (type == SET_VIEW) || (type == ISCONFIGSUPPORT) || @@ -1241,8 +1241,8 @@ class MasterControl { /** - * This procedure is invoked when isRunning is false. - * Return true when there is no more pending request so that + * This procedure is invoked when isRunning is false. + * Return true when there is no more pending request so that * Thread can terminate. Otherwise we have to recreate * the MC related threads. */ @@ -1260,8 +1260,8 @@ class MasterControl { renderingAttributesStructure = new RenderingAttributesStructure(); if (timerThread != null) { timerThread.finish(); - timerThread = null; - } + timerThread = null; + } if (notificationThread != null) { notificationThread.finish(); notificationThread = null; @@ -1308,9 +1308,9 @@ class MasterControl { final long getTime() { return (time++); } - - - /** + + + /** * This takes a given message and parses it out to the structures and * marks its time value. */ @@ -1322,8 +1322,8 @@ class MasterControl { } setWork(); } - - /** + + /** * This takes an array of messages and parses them out to the structures and * marks the time value. Make sure, setWork() is done at the very end * to make sure all the messages will be processed in the same frame @@ -1411,7 +1411,7 @@ class MasterControl { u.renderingEnvironmentStructure.addMessage(message); } } - + if ((targetThreads & J3dThread.SOUND_SCHEDULER) != 0) { // Note that we don't check for active view if (message.view != null && message.view.soundScheduler != null ) { @@ -1435,7 +1435,7 @@ class MasterControl { } } } - } + } } if ((targetThreads & J3dThread.UPDATE_RENDER) != 0) { @@ -1455,7 +1455,7 @@ class MasterControl { } else { while (i>=0) { - if (v[i].universe == u) { + if (v[i].universe == u) { v[i].renderBin.addMessage(message); } i--; @@ -1485,7 +1485,7 @@ class MasterControl { if ((targetThreads & J3dThread.INPUT_DEVICE_SCHEDULER) != 0) { synchronized (inputDeviceThreads) { - InputDeviceScheduler ds[] = (InputDeviceScheduler []) + InputDeviceScheduler ds[] = (InputDeviceScheduler []) inputDeviceThreads.toArray(false); for (int i=inputDeviceThreads.size()-1; i >=0; i--) { if (ds[i].physicalEnv.activeViewRef > 0) { @@ -1498,18 +1498,18 @@ class MasterControl { // destroyUniverseThreads() so we need to check if // TimerThread kick in to sendRunMessage() after that. // It happens because TimerThread is the only thread run - // asychronizously with MasterControl thread. + // asychronizously with MasterControl thread. if (timerThread != null) { - // Notify TimerThread to wakeup this procedure - // again next time. + // Notify TimerThread to wakeup this procedure + // again next time. timerThread.addInputDeviceSchedCond(); } } } if ((targetThreads & J3dThread.RENDER_THREAD) != 0) { synchronized (renderThreadData) { - J3dThreadData[] threads = (J3dThreadData []) + J3dThreadData[] threads = (J3dThreadData []) renderThreadData.toArray(false); int i=renderThreadData.arraySize()-1; J3dThreadData thr; @@ -1541,7 +1541,7 @@ class MasterControl { } // wakeup this procedure next time // QUESTION: waitTime calculated some milliseconds BEFORE - // this methods getTime() called - shouldn't actual + // this methods getTime() called - shouldn't actual // sound Complete time be passed by SoundScheduler // QUESTION: will this wake up only soundScheduler associated // with this view?? (since only it's lastUpdateTime is set) @@ -1563,7 +1563,7 @@ class MasterControl { if ((targetThreads & J3dThread.RENDER_THREAD) != 0) { synchronized (renderThreadData) { - J3dThreadData[] threads = (J3dThreadData []) + J3dThreadData[] threads = (J3dThreadData []) renderThreadData.toArray(false); int i=renderThreadData.arraySize()-1; J3dThreadData thr; @@ -1595,19 +1595,19 @@ class MasterControl { null).lastUpdateTime = time; } } - + if ((targetThreads & J3dThread.UPDATE_BEHAVIOR) != 0) { u.behaviorStructure.threadData.lastUpdateTime = time; } - + if ((targetThreads & J3dThread.UPDATE_GEOMETRY) != 0) { u.geometryStructure.threadData.lastUpdateTime = time; } - + if ((targetThreads & J3dThread.UPDATE_SOUND) != 0) { u.soundStructure.threadData.lastUpdateTime = time; } - + if ((targetThreads & J3dThread.SOUND_SCHEDULER) != 0) { synchronized (views) { View v[] = (View []) views.toArray(false); @@ -1621,9 +1621,9 @@ class MasterControl { } if ((targetThreads & J3dThread.RENDER_THREAD) != 0) { - + synchronized (renderThreadData) { - J3dThreadData[] threads = (J3dThreadData []) + J3dThreadData[] threads = (J3dThreadData []) renderThreadData.toArray(false); int i=renderThreadData.arraySize()-1; J3dThreadData thr; @@ -1642,14 +1642,14 @@ class MasterControl { /** - * Return a clone of View, we can't access + * Return a clone of View, we can't access * individual element of View after getting the size * in separate API call without synchronized views. */ UnorderList cloneView() { return (UnorderList) views.clone(); } - + /** * Return true if view is already registered with MC */ @@ -1673,14 +1673,14 @@ class MasterControl { currentTime = getTime(); - J3dThreadData threads[] = (J3dThreadData []) + J3dThreadData threads[] = (J3dThreadData []) stateWorkThreads.toArray(false); int size = stateWorkThreads.arraySize(); while (i<lastTransformStructureThread) { thread = threads[i++]; - if ((thread.lastUpdateTime > thread.lastRunTime) && + if ((thread.lastUpdateTime > thread.lastRunTime) && !thread.thread.userStop) { lastThread = thread; thread.needsRun = true; @@ -1715,7 +1715,7 @@ class MasterControl { while (i<size) { thread = threads[i++]; - if ((thread.lastUpdateTime > thread.lastRunTime) && + if ((thread.lastUpdateTime > thread.lastRunTime) && !thread.thread.userStop) { lastThread = thread; thread.needsRun = true; @@ -1768,7 +1768,7 @@ class MasterControl { !thread.thread.userStop) { if (thread.thread.lastWaitTimestamp == waitTimestamp) { - // This renderer thread is repeated. We must wait + // This renderer thread is repeated. We must wait // until all previous renderer threads done before // allowing this thread to continue. Note that // lastRunThread can't be null in this case. @@ -1786,7 +1786,7 @@ class MasterControl { } else { if ((lastRunThread.threadOpts & J3dThreadData.START_TIMER) != 0) { - lastRunThread.threadOpts = + lastRunThread.threadOpts = (J3dThreadData.START_TIMER | J3dThreadData.WAIT_ALL_THREADS); @@ -1829,11 +1829,11 @@ class MasterControl { if (lastRunThread != null) { - lastRunThread.threadOpts = + lastRunThread.threadOpts = (J3dThreadData.STOP_TIMER | J3dThreadData.WAIT_ALL_THREADS| J3dThreadData.LAST_STOP_TIMER); - lockGeometry = true; + lockGeometry = true; ((Object []) lastRunThread.threadArgs)[3] = lastRunThread.view; } else { lockGeometry = false; @@ -1873,12 +1873,12 @@ class MasterControl { s.threadData.thread = s.updateThread; // This takes into accout for thread that just destroy and // create again. In this case the threadData may receive - // message before the thread actually created. We don't want + // message before the thread actually created. We don't want // the currentTime to overwrite the update time of which // is set by threadData when get message. s.threadData.lastUpdateTime = Math.max(currentTime, s.threadData.lastUpdateTime); - } + } } private void emptyMessageList(J3dStructure structure, View v) { @@ -1887,7 +1887,7 @@ class MasterControl { if (structure.threadData != null) { structure.threadData.thread = null; } - + if (structure.updateThread != null) { structure.updateThread.structure = null; } @@ -1918,11 +1918,11 @@ class MasterControl { Object oldRef= null; while (i < size) { m = mess[i]; - if ((v == null) || (m.view == v) || + if ((v == null) || (m.view == v) || ((m.view == null) && !otherViewExist)) { if (m.type == J3dMessage.INSERT_NODES) { // There is another View register request - // immediately following, so no need + // immediately following, so no need // to remove message. break; } @@ -1954,7 +1954,7 @@ class MasterControl { } /** - * This register a View with MasterControl. + * This register a View with MasterControl. * The View has at least one Canvas3D added to a container. */ private void registerView(View v) { @@ -1979,10 +1979,10 @@ class MasterControl { createUpdateThread(univ.soundStructure); createUpdateThread(univ.renderingEnvironmentStructure); createUpdateThread(univ.transformStructure); - + // create Behavior scheduler J3dThreadData threadData = null; - + if (univ.behaviorScheduler == null) { java.security.AccessController.doPrivileged( new java.security.PrivilegedAction() { @@ -1998,12 +1998,12 @@ class MasterControl { univ.behaviorScheduler.initialize(); univ.behaviorScheduler.userStop = v.stopBehavior; threadData = univ.behaviorScheduler.getThreadData(null, null); - threadData.thread = univ.behaviorScheduler; + threadData.thread = univ.behaviorScheduler; threadData.threadType = J3dThread.BEHAVIOR_SCHEDULER; threadData.lastUpdateTime = Math.max(currentTime, threadData.lastUpdateTime); - } - + } + createUpdateThread(v.renderBin); createUpdateThread(v.soundScheduler); @@ -2011,16 +2011,16 @@ class MasterControl { v.physicalEnvironment.addUser(v); } // create InputDeviceScheduler - evaluatePhysicalEnv(v); + evaluatePhysicalEnv(v); regUniverseList.addUnique(univ); - views.addUnique(v); + views.addUnique(v); } /** - * This unregister a View with MasterControl. + * This unregister a View with MasterControl. * The View no longer has any Canvas3Ds in a container. */ private void unregisterView(View v) { @@ -2052,14 +2052,14 @@ class MasterControl { synchronized (timeLock) { // The reason we need to sync. with timeLock is because we - // don't want user thread running sendMessage() to + // don't want user thread running sendMessage() to // dispatch it in different structure queue when // part of the structure list is empty at the same time. // This will cause inconsistence in the message reference // count. emptyMessageList(v.soundScheduler, v); emptyMessageList(v.renderBin, v); - + if (univ.isEmpty()) { destroyUniverseThreads(univ); } else { @@ -2074,7 +2074,7 @@ class MasterControl { if (v.physicalEnvironment != null) { v.physicalEnvironment.removeUser(v); } - + // remove all InputDeviceScheduler if this is the last View UnorderList list = new UnorderList(1, PhysicalEnvironment.class); for (Enumeration e = PhysicalEnvironment.physicalEnvMap.keys(); @@ -2103,7 +2103,7 @@ class MasterControl { PhysicalEnvironment.physicalEnvMap.remove(list.get(i)); } - + freeContext(v); if (views.isEmpty()) { @@ -2116,7 +2116,7 @@ class MasterControl { e.hasMoreElements(); ) { Renderer rdr = (Renderer) e.nextElement(); Screen3D scr; - + rendererCleanupArgs[2] = REMOVEALLCTXS_CLEANUP; runMonitor(RUN_RENDERER_CLEANUP, null, null, null, rdr); scr = rdr.onScreen; @@ -2127,13 +2127,13 @@ class MasterControl { null, scr.renderer); scr.renderer = null; } - + } scr = rdr.offScreen; if (scr != null) { if (scr.renderer != null) { rendererCleanupArgs[2] = REMOVEALLCTXS_CLEANUP; - runMonitor(RUN_RENDERER_CLEANUP, null, null, + runMonitor(RUN_RENDERER_CLEANUP, null, null, null, scr.renderer); scr.renderer = null; } @@ -2170,7 +2170,7 @@ class MasterControl { renderWorkThreads.clear(); requestRenderWorkThreads.clear(); threadListsChanged = true; - + // This notify VirtualUniverse waitForMC() thread to continue v.doneUnregister = true; } @@ -2233,7 +2233,7 @@ class MasterControl { univ.behaviorScheduler = null; univ.initMCStructure(); activeUniverseList.remove(univ); - regUniverseList.remove(univ); + regUniverseList.remove(univ); } else { emptyMessageList(univ.behaviorStructure, null); emptyMessageList(univ.geometryStructure, null); @@ -2246,7 +2246,7 @@ class MasterControl { if(J3dDebug.devPhase) { J3dDebug.doDebug(J3dDebug.masterControl, J3dDebug.LEVEL_1, "MC: Destroy RenderingAttributes Update and Timer threads"); - } + } if (renderingAttributesStructure.updateThread != null) { renderingAttributesStructure.updateThread.finish(); renderingAttributesStructure.updateThread = null; @@ -2271,13 +2271,13 @@ class MasterControl { mirrorObjects.clear(); // Note: We should not clear the DISPLAYLIST/TEXTURE // list here because other structure may release them - // later + // later for(int i=0; i<canvasIds.length; i++) { canvasIds[i] = false; } canvasFreeIndex = 0; - + renderOnceList.clear(); timestampUpdateList.clear(); @@ -2322,33 +2322,33 @@ class MasterControl { View v = viewArr[i]; Canvas3D canvasList[][] = v.getCanvasList(false); if (!v.active) { - continue; + continue; } - + for (int j=canvasList.length-1; j>=0; j--) { boolean added = false; for (int k=canvasList[j].length-1; k>=0; k--) { Canvas3D cv = canvasList[j][k]; - + final Screen3D screen = cv.screen; if (cv.active) { if (screen.canvasCount++ == 0) { // Create Renderer, one per screen if (screen.renderer == null) { - // get the renderer created for the graphics + // get the renderer created for the graphics // device of the screen of the canvas // No need to synchronized since only - // MC use it. - Renderer rdr = + // MC use it. + Renderer rdr = (Renderer) screen.deviceRendererMap.get( cv.screen.graphicsDevice); if (rdr == null) { java.security.AccessController.doPrivileged( new java.security.PrivilegedAction() { public Object run() { - + synchronized (rootThreadGroup) { screen.renderer = new Renderer( @@ -2364,7 +2364,7 @@ class MasterControl { } else { screen.renderer = rdr; } - } + } } // offScreen canvases will be handled by the // request renderer, so don't add offScreen canvas @@ -2385,36 +2385,36 @@ class MasterControl { } if (!added) { - // Swap message data thread, one per + // Swap message data thread, one per // screen only. Note that we don't set // lastUpdateTime for this thread so // that it won't run in the first round - J3dThreadData renderData = + J3dThreadData renderData = screen.renderer.getThreadData(v, null); renderThreadData.add(renderData); // only if renderBin is ready then we - // update the lastUpdateTime to make it run + // update the lastUpdateTime to make it run if (v.renderBinReady) { - renderData.lastUpdateTime = + renderData.lastUpdateTime = Math.max(currentTime, renderData.lastUpdateTime); } added = true; } // Renderer message data thread - J3dThreadData renderData = + J3dThreadData renderData = screen.renderer.getThreadData(v, cv); renderThreadData.add(renderData); if (v.renderBinReady) { - renderData.lastUpdateTime = + renderData.lastUpdateTime = Math.max(currentTime, renderData.lastUpdateTime); } } } } - + } } @@ -2442,7 +2442,7 @@ class MasterControl { } threadListsChanged = true; } - + final private void addToStateThreads(J3dThreadData threadData) { if (threadData.thread.active) { stateWorkThreads.add(threadData); @@ -2471,7 +2471,7 @@ class MasterControl { } univ.setCurrentView(null); } - + /** * This returns the default RenderMethod @@ -2535,7 +2535,7 @@ class MasterControl { return orientedShape3DRenderMethod; } - /** + /** * This notifies MasterControl that the given view has been activated */ private void viewActivate(View v) { @@ -2593,9 +2593,9 @@ class MasterControl { threadListsChanged = true; // Notify GeometryStructure to query visible atom again // We should send message instead of just setting - // v.vDirtyMask = View.VISIBILITY_POLICY_DIRTY; + // v.vDirtyMask = View.VISIBILITY_POLICY_DIRTY; // since RenderBin may not run immediately next time. - // In this case the dirty flag will lost since + // In this case the dirty flag will lost since // updateViewCache() will reset it to 0. v.renderBin.reactivateView = true; } @@ -2610,7 +2610,7 @@ class MasterControl { for (int k=canvasList[j].length-1; k>=0; k--) { Canvas3D cv = canvasList[j][k]; if (!cv.validCanvas) { - if ((cv.screen != null) && + if ((cv.screen != null) && (cv.screen.renderer != null)) { rendererCleanupArgs[1] = cv; rendererCleanupArgs[2] = FREECONTEXT_CLEANUP; @@ -2623,7 +2623,7 @@ class MasterControl { } } - /** + /** * This notifies MasterControl that the given view has been deactivated */ private void viewDeactivate(View v) { @@ -2641,7 +2641,7 @@ class MasterControl { --numActiveViews; --univ.activeViewCount; } - + if (numActiveViews == 0) { renderingAttributesStructure.updateThread.active = false; } @@ -2678,7 +2678,7 @@ class MasterControl { } - /** + /** * This notifies MasterControl to start given view */ private void startView(View v) { @@ -2708,7 +2708,7 @@ class MasterControl { } - /** + /** * This notifies MasterControl to stop given view */ private void stopView(View v) { @@ -2741,7 +2741,7 @@ class MasterControl { synchronized (inputDeviceThreads) { inputDeviceThreads.add(ds); if (inputDeviceThreads.size() == 1) { - timerThread.addInputDeviceSchedCond(); + timerThread.addInputDeviceSchedCond(); } } postRequest(INPUTDEVICE_CHANGE, null); @@ -2761,7 +2761,7 @@ class MasterControl { } /** - * This updates any mirror objects. It is called when threads + * This updates any mirror objects. It is called when threads * are done. */ void updateMirrorObjects() { @@ -2770,7 +2770,7 @@ class MasterControl { for (int i = 0; i< sz; i++) { objs[i].updateObject(); - } + } mirrorObjects.clear(); } @@ -2780,7 +2780,7 @@ class MasterControl { * work thread list. */ private void updateWorkThreads() { - + stateWorkThreads.clear(); renderWorkThreads.clear(); requestRenderWorkThreads.clear(); @@ -2791,7 +2791,7 @@ class MasterControl { } // Next, each of the transform structure updates - VirtualUniverse universes[] = (VirtualUniverse []) + VirtualUniverse universes[] = (VirtualUniverse []) activeUniverseList.toArray(false); VirtualUniverse univ; int i; @@ -2802,7 +2802,7 @@ class MasterControl { } lastTransformStructureThread = stateWorkThreads.size(); - // Next, the GeometryStructure, BehaviorStructure, + // Next, the GeometryStructure, BehaviorStructure, // RenderingEnvironmentStructure, and SoundStructure for (i=size-1; i>=0; i--) { univ = universes[i]; @@ -2823,7 +2823,7 @@ class MasterControl { // Now InputDeviceScheduler - InputDeviceScheduler ds[] = (InputDeviceScheduler []) + InputDeviceScheduler ds[] = (InputDeviceScheduler []) inputDeviceThreads.toArray(true); for (i=inputDeviceThreads.size()-1; i >=0; i--) { J3dThreadData threadData = ds[i].getThreadData(); @@ -2843,7 +2843,7 @@ class MasterControl { Canvas3D canvasList[][] = v.getCanvasList(false); int longestScreenList = v.getLongestScreenList(); Object args[] = null; - // renderer render + // renderer render for (int j=0; j<longestScreenList; j++) { for (int k=0; k < canvasList.length; k++) { if (j < canvasList[k].length) { @@ -2863,9 +2863,9 @@ class MasterControl { } } } - + // renderer swap - for (int j=0; j<canvasList.length; j++) { + for (int j=0; j<canvasList.length; j++) { for (int k=0; k < canvasList[j].length; k++) { Canvas3D cv = canvasList[j][k]; // create swap thread only if there is at @@ -2913,10 +2913,10 @@ class MasterControl { void dumpWorkThreads() { System.err.println("-----------------------------"); System.err.println("MasterControl/dumpWorkThreads"); - + J3dThreadData threads[]; int size = 0; - + for (int k=0; k<3; k++) { switch (k) { case 0: @@ -3014,7 +3014,7 @@ class MasterControl { } } } - + // Fix for Issue 18 // Pass CreateOffScreenBuffer to the Renderer thread for execution. void sendCreateOffScreenBuffer(Canvas3D c) { @@ -3103,7 +3103,7 @@ class MasterControl { */ void doWork() { runMonitor(CHECK_FOR_WORK, null, null, null, null); - + synchronized (timeLock) { synchronized (requestObjList) { if (pendingRequest) { @@ -3121,7 +3121,7 @@ class MasterControl { } synchronized (timeLock) { - // This is neccesary to prevent updating + // This is neccesary to prevent updating // thread.lastUpdateTime from user thread // in sendMessage() or sendRunMessage() updateTimeValues(); @@ -3133,16 +3133,16 @@ class MasterControl { if (v[i].active) { v[i].updateViewCache(); // update OrientedShape3D - if ((v[i].viewCache.vcDirtyMask != 0 && + if ((v[i].viewCache.vcDirtyMask != 0 && !v[i].renderBin.orientedRAs.isEmpty()) || - (v[i].renderBin.cachedDirtyOrientedRAs != null && + (v[i].renderBin.cachedDirtyOrientedRAs != null && !v[i].renderBin.cachedDirtyOrientedRAs.isEmpty())) { v[i].renderBin.updateOrientedRAs(); } } } - runMonitor(RUN_THREADS, stateWorkThreads, renderWorkThreads, + runMonitor(RUN_THREADS, stateWorkThreads, renderWorkThreads, requestRenderWorkThreads, null); if (renderOnceList.size() > 0) { @@ -3154,14 +3154,14 @@ class MasterControl { } private void handlePendingRequest() { - + Object objs[]; Integer types[]; int size; boolean rendererRun = false; objs = requestObjList.toArray(false); - types = (Integer []) requestTypeList.toArray(false); + types = (Integer []) requestTypeList.toArray(false); size = requestObjList.size(); for (int i=0; i < size; i++) { @@ -3170,21 +3170,21 @@ class MasterControl { Object o = objs[i]; if (type == RESET_CANVAS) { Canvas3D cv = (Canvas3D) o; - if ((cv.screen != null) && + if ((cv.screen != null) && (cv.screen.renderer != null)) { rendererCleanupArgs[1] = o; rendererCleanupArgs[2] = RESETCANVAS_CLEANUP; runMonitor(RUN_RENDERER_CLEANUP, null, null, null, cv.screen.renderer); rendererCleanupArgs[1] = null; - } + } cv.reset(); cv.view = null; cv.computeViewCache(); } else if (type == ACTIVATE_VIEW) { viewActivate((View) o); - } + } else if (type == DEACTIVATE_VIEW) { viewDeactivate((View) o); } else if (type == REEVALUATE_CANVAS) { @@ -3199,7 +3199,7 @@ class MasterControl { // Collision takes 3 rounds to finish its request if (++v.stopViewCount > 4) { v.stopViewCount = -1; // reset counter - stopView(v); + stopView(v); } else { tempViewList.add(v); } @@ -3250,18 +3250,18 @@ class MasterControl { startView(v); renderOnceList.add(v); sendRunMessage(v, J3dThread.UPDATE_RENDER); - threadListsChanged = true; + threadListsChanged = true; rendererRun = true; } else if (type == FREE_CONTEXT) { Canvas3D cv = (Canvas3D ) ((Object []) o)[0]; - if ((cv.screen != null) && + if ((cv.screen != null) && (cv.screen.renderer != null)) { rendererCleanupArgs[1] = o; rendererCleanupArgs[2] = REMOVECTX_CLEANUP; runMonitor(RUN_RENDERER_CLEANUP, null, null, null, cv.screen.renderer); rendererCleanupArgs[1] = null; - } + } rendererRun = true; } else if (type == FREE_DRAWING_SURFACE) { Pipeline.getPipeline().freeDrawingSurfaceNative(o); @@ -3271,14 +3271,14 @@ class MasterControl { sendRenderMessage(gc, o, type); rendererRun = true; } else if (type == ISCONFIGSUPPORT) { - GraphicsConfiguration gc = (GraphicsConfiguration) + GraphicsConfiguration gc = (GraphicsConfiguration) ((GraphicsConfigTemplate3D) o).testCfg; sendRenderMessage(gc, o, type); rendererRun = true; } else if ((type == SET_GRAPHICSCONFIG_FEATURES) || (type == SET_QUERYPROPERTIES)) { - GraphicsConfiguration gc = (GraphicsConfiguration) - ((Canvas3D) o).graphicsConfiguration; + GraphicsConfiguration gc = (GraphicsConfiguration) + ((Canvas3D) o).graphicsConfiguration; sendRenderMessage(gc, o, type); rendererRun = true; } else if (type == SET_VIEW) { @@ -3296,7 +3296,7 @@ class MasterControl { VirtualUniverse u = (VirtualUniverse) objs[i]; if (!regUniverseList.contains(u)) { emptyMessageList(u.behaviorStructure, null); - emptyMessageList(u.geometryStructure, null); + emptyMessageList(u.geometryStructure, null); emptyMessageList(u.soundStructure, null); emptyMessageList(u.renderingEnvironmentStructure, null); } @@ -3318,7 +3318,7 @@ class MasterControl { FreeListManager.clearList(FreeListManager.DISPLAYLIST); FreeListManager.clearList(FreeListManager.TEXTURE2D); FreeListManager.clearList(FreeListManager.TEXTURE3D); - + synchronized (textureIdLock) { textureIdCount = 0; } @@ -3344,7 +3344,7 @@ class MasterControl { setWork(); } else { // MC will shutdown for (int i=0; i < size; i++) { - View v = (View) tempViewList.get(i); + View v = (View) tempViewList.get(i); v.stopViewCount = -1; v.isRunning = false; } @@ -3355,7 +3355,7 @@ class MasterControl { pendingRequest = rendererRun || (requestObjList.size() > 0); } - + size = freeMessageList.size(); if (size > 0) { for (int i=0; i < size; i++) { @@ -3368,7 +3368,7 @@ class MasterControl { if (!running && (renderOnceList.size() > 0)) { clearRenderOnceList(); } - + if (pendingRequest) { setWork(); } @@ -3391,8 +3391,8 @@ class MasterControl { } - synchronized void runMonitor(int action, - UnorderList stateThreadList, + synchronized void runMonitor(int action, + UnorderList stateThreadList, UnorderList renderThreadList, UnorderList requestRenderThreadList, J3dThread nthread) { @@ -3407,9 +3407,9 @@ class MasterControl { J3dThreadData thread; J3dThreadData renderThreads[] = (J3dThreadData []) renderThreadList.toArray(false); - J3dThreadData stateThreads[] = (J3dThreadData []) + J3dThreadData stateThreads[] = (J3dThreadData []) stateThreadList.toArray(false); - J3dThreadData requestRenderThreads[] = (J3dThreadData []) + J3dThreadData requestRenderThreads[] = (J3dThreadData []) requestRenderThreadList.toArray(false); int renderThreadSize = renderThreadList.arraySize(); int stateThreadSize = stateThreadList.arraySize(); @@ -3452,10 +3452,10 @@ class MasterControl { thread.thread.doWork(currentTime); } else { threadPending++; - thread.thread.runMonitor(J3dThread.RUN, - currentTime, + thread.thread.runMonitor(J3dThread.RUN, + currentTime, (Object[])thread.threadArgs); - } + } if ((thread.threadOpts & J3dThreadData.STOP_TIMER) != 0) { view = (View)((Object[])thread.threadArgs)[3]; @@ -3469,8 +3469,8 @@ class MasterControl { currentV.renderBin.releaseGeometry(); } } - - if ((cpuLimit != 1) && + + if ((cpuLimit != 1) && (thread.threadOpts & J3dThreadData.WAIT_ALL_THREADS) != 0) { @@ -3493,7 +3493,7 @@ class MasterControl { while (!stateWaiting && currentStateThread != stateThreadSize) { thread = stateThreads[currentStateThread++]; - + if (!thread.needsRun) { continue; } @@ -3505,19 +3505,19 @@ class MasterControl { thread.thread.doWork(currentTime); } else { threadPending++; - thread.thread.runMonitor(J3dThread.RUN, - currentTime, + thread.thread.runMonitor(J3dThread.RUN, + currentTime, (Object[])thread.threadArgs); } - if (cpuLimit != 1 && (thread.threadOpts & + if (cpuLimit != 1 && (thread.threadOpts & J3dThreadData.WAIT_ALL_THREADS) != 0) { stateWaiting = true; } if ((cpuLimit != 1) && (cpuLimit <= threadPending)) { // Fix bug 4686766 - always allow - // renderer thread to continue if not finish - // geomLock can release for Behavior thread to + // renderer thread to continue if not finish + // geomLock can release for Behavior thread to // continue. if (currentRenderThread == renderThreadSize) { state = WAITING_FOR_CPU; @@ -3543,7 +3543,7 @@ class MasterControl { (currentRequestRenderThread != requestRenderThreadSize)) { - thread = + thread = requestRenderThreads[currentRequestRenderThread++]; renderPending++; @@ -3553,7 +3553,7 @@ class MasterControl { thread.thread.doWork(currentTime); } else { threadPending++; - thread.thread.runMonitor(J3dThread.RUN, + thread.thread.runMonitor(J3dThread.RUN, currentTime, (Object[])thread.threadArgs); } @@ -3574,9 +3574,9 @@ class MasterControl { } if (cpuLimit != 1) { - if ((renderWaiting && + if ((renderWaiting && (currentStateThread == stateThreadSize)) || - (stateWaiting && + (stateWaiting && currentRenderThread == renderThreadSize) || (renderWaiting && stateWaiting)) { if (!requestRenderWorkToDo) { @@ -3832,7 +3832,7 @@ class MasterControl { if ((threads & J3dThread.UPDATE_TRANSFORM) != 0) { strBuf.append(" UPDATE_TRANSFORM"); } - + return strBuf.toString(); } diff --git a/src/classes/share/javax/media/j3d/MasterControlThread.java b/src/classes/share/javax/media/j3d/MasterControlThread.java index 2101052..dfc1ad7 100644 --- a/src/classes/share/javax/media/j3d/MasterControlThread.java +++ b/src/classes/share/javax/media/j3d/MasterControlThread.java @@ -77,4 +77,4 @@ class MasterControlThread extends Thread { "MC: MasterControl Thread Terminate"); } } -} +} diff --git a/src/classes/share/javax/media/j3d/Material.java b/src/classes/share/javax/media/j3d/Material.java index 936cf55..769e5a0 100644 --- a/src/classes/share/javax/media/j3d/Material.java +++ b/src/classes/share/javax/media/j3d/Material.java @@ -50,10 +50,10 @@ import javax.vecmath.Color3f; * <LI>Specular color - the RGB specular color of the material (highlights). * The range of values is 0.0 to 1.0. The default specular color * is (1.0, 1.0, 1.0).<p></LI> - * <LI>Emissive color - the RGB color of the light the material emits, if + * <LI>Emissive color - the RGB color of the light the material emits, if * any. The range of values is 0.0 to 1.0. The default emissive * color is (0.0, 0.0, 0.0).<p></LI> - * <LI>Shininess - the material's shininess, in the range [1.0, 128.0] + * <LI>Shininess - the material's shininess, in the range [1.0, 128.0] * with 1.0 being not shiny and 128.0 being very shiny. Values outside * this range are clamped. The default value for the material's * shininess is 64.<p></LI> @@ -126,7 +126,7 @@ public class Material extends NodeComponent { private static final int[] readCapabilities = { ALLOW_COMPONENT_READ }; - + /** * Constructs and initializes a Material object using default parameters. * The default values are as follows: @@ -168,7 +168,7 @@ public class Material extends NodeComponent { setDefaultReadCapabilities(readCapabilities); ((MaterialRetained)this.retained).createMaterial(ambientColor, - emissiveColor, diffuseColor, specularColor, + emissiveColor, diffuseColor, specularColor, shininess); } @@ -214,7 +214,7 @@ public class Material extends NodeComponent { /** * Sets this material's ambient color. * This specifies how much ambient light is reflected by - * the surface. + * the surface. * The ambient color in this Material object may be overridden by * per-vertex colors in some cases. If vertex colors are present * in the geometry, and lighting is enabled, and the colorTarget @@ -232,7 +232,7 @@ public class Material extends NodeComponent { * @see #setColorTarget */ public void setAmbientColor(float r, float g, float b) { - if (isLiveOrCompiled()) + if (isLiveOrCompiled()) if (!this.getCapability(ALLOW_COMPONENT_WRITE)) throw new CapabilityNotSetException(J3dI18N.getString("Material0")); if (isLive()) { @@ -278,12 +278,12 @@ public class Material extends NodeComponent { if (isLiveOrCompiled()) if (!this.getCapability(ALLOW_COMPONENT_WRITE)) throw new CapabilityNotSetException(J3dI18N.getString("Material0")); - if (isLive()) + if (isLive()) ((MaterialRetained)this.retained).setEmissiveColor(color); else ((MaterialRetained)this.retained).initEmissiveColor(color); - + } @@ -312,7 +312,7 @@ public class Material extends NodeComponent { if (!this.getCapability(ALLOW_COMPONENT_WRITE)) throw new CapabilityNotSetException(J3dI18N.getString("Material0")); - if (isLive()) + if (isLive()) ((MaterialRetained)this.retained).setEmissiveColor(r,g,b); else ((MaterialRetained)this.retained).initEmissiveColor(r,g,b); @@ -355,7 +355,7 @@ public class Material extends NodeComponent { if (!this.getCapability(ALLOW_COMPONENT_WRITE)) throw new CapabilityNotSetException(J3dI18N.getString("Material0")); - if (isLive()) + if (isLive()) ((MaterialRetained)this.retained).setDiffuseColor(color); else ((MaterialRetained)this.retained).initDiffuseColor(color); @@ -385,7 +385,7 @@ public class Material extends NodeComponent { if (!this.getCapability(ALLOW_COMPONENT_WRITE)) throw new CapabilityNotSetException(J3dI18N.getString("Material0")); - if (isLive()) + if (isLive()) ((MaterialRetained)this.retained).setDiffuseColor(r,g,b); else ((MaterialRetained)this.retained).initDiffuseColor(r,g,b); @@ -416,7 +416,7 @@ public class Material extends NodeComponent { if (!this.getCapability(ALLOW_COMPONENT_WRITE)) throw new CapabilityNotSetException(J3dI18N.getString("Material0")); - if (isLive()) + if (isLive()) ((MaterialRetained)this.retained).setDiffuseColor(r,g,b,a); else ((MaterialRetained)this.retained).initDiffuseColor(r,g,b,a); @@ -458,7 +458,7 @@ public class Material extends NodeComponent { if (!this.getCapability(ALLOW_COMPONENT_WRITE)) throw new CapabilityNotSetException(J3dI18N.getString("Material0")); - if (isLive()) + if (isLive()) ((MaterialRetained)this.retained).setSpecularColor(color); else ((MaterialRetained)this.retained).initSpecularColor(color); @@ -488,7 +488,7 @@ public class Material extends NodeComponent { if (!this.getCapability(ALLOW_COMPONENT_WRITE)) throw new CapabilityNotSetException(J3dI18N.getString("Material0")); - if (isLive()) + if (isLive()) ((MaterialRetained)this.retained).setSpecularColor(r,g,b); else ((MaterialRetained)this.retained).initSpecularColor(r,g,b); @@ -523,7 +523,7 @@ public class Material extends NodeComponent { if (!this.getCapability(ALLOW_COMPONENT_WRITE)) throw new CapabilityNotSetException(J3dI18N.getString("Material0")); - if (isLive()) + if (isLive()) ((MaterialRetained)this.retained).setShininess(shininess); else ((MaterialRetained)this.retained).initShininess(shininess); @@ -546,14 +546,14 @@ public class Material extends NodeComponent { /** * Enables or disables lighting for this appearance component object. * @param state true or false to enable or disable lighting - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ public void setLightingEnable(boolean state) { if (isLiveOrCompiled()) if (!this.getCapability(ALLOW_COMPONENT_WRITE)) throw new CapabilityNotSetException(J3dI18N.getString("Material15")); - if (isLive()) + if (isLive()) ((MaterialRetained)this.retained).setLightingEnable(state); else ((MaterialRetained)this.retained).initLightingEnable(state); @@ -562,7 +562,7 @@ public class Material extends NodeComponent { /** * Retrieves the state of the lighting enable flag. * @return true if lighting is enabled, false if lighting is disabled - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ public boolean getLightingEnable() { @@ -599,7 +599,7 @@ public class Material extends NodeComponent { if (!this.getCapability(ALLOW_COMPONENT_WRITE)) throw new CapabilityNotSetException(J3dI18N.getString("Material3")); - if (isLive()) + if (isLive()) ((MaterialRetained)this.retained).setColorTarget(colorTarget); else ((MaterialRetained)this.retained).initColorTarget(colorTarget); @@ -665,7 +665,7 @@ public class Material extends NodeComponent { } /** - * @deprecated replaced with cloneNodeComponent(boolean forceDuplicate) + * @deprecated replaced with cloneNodeComponent(boolean forceDuplicate) */ public NodeComponent cloneNodeComponent() { Material m = new Material(); @@ -679,7 +679,7 @@ public class Material extends NodeComponent { * the current node. This method is called from the * <code>duplicateNode</code> method. This routine does * the actual duplication of all "local data" (any data defined in - * this object). + * this object). * * @param originalNodeComponent the original node to duplicate. * @param forceDuplicate when set to <code>true</code>, causes the @@ -692,16 +692,16 @@ public class Material extends NodeComponent { * @see NodeComponent#setDuplicateOnCloneTree */ void duplicateAttributes(NodeComponent originalNodeComponent, - boolean forceDuplicate) { - super.duplicateAttributes(originalNodeComponent, + boolean forceDuplicate) { + super.duplicateAttributes(originalNodeComponent, forceDuplicate); - + MaterialRetained mat = (MaterialRetained) originalNodeComponent.retained; - MaterialRetained rt = (MaterialRetained) retained; - + MaterialRetained rt = (MaterialRetained) retained; + Color3f c = new Color3f(); - mat.getAmbientColor(c); + mat.getAmbientColor(c); rt.initAmbientColor(c); mat.getEmissiveColor(c); diff --git a/src/classes/share/javax/media/j3d/MaterialRetained.java b/src/classes/share/javax/media/j3d/MaterialRetained.java index f8e184e..4c36a79 100644 --- a/src/classes/share/javax/media/j3d/MaterialRetained.java +++ b/src/classes/share/javax/media/j3d/MaterialRetained.java @@ -115,7 +115,7 @@ class MaterialRetained extends NodeComponentRetained { } /** - * Sets this material's ambient color + * Sets this material's ambient color * @param r the new ambient color's red component * @param g the new ambient color's green component * @param b the new ambient color's blue component @@ -253,7 +253,7 @@ class MaterialRetained extends NodeComponentRetained { } /** - * Sets this material's diffuse color plus alpha and sends + * Sets this material's diffuse color plus alpha and sends * a message notifying the interested structures of the change. * This is the color of the material when illuminated by a light source. * @param r the new diffuse color's red component @@ -355,7 +355,7 @@ class MaterialRetained extends NodeComponentRetained { */ final void setShininess(float shininess) { initShininess(shininess); - sendMessage(SHININESS_CHANGED, new Float(this.shininess)); + sendMessage(SHININESS_CHANGED, new Float(this.shininess)); } /** @@ -382,7 +382,7 @@ class MaterialRetained extends NodeComponentRetained { */ void setLightingEnable(boolean state) { initLightingEnable(state); - sendMessage(ENABLE_CHANGED, + sendMessage(ENABLE_CHANGED, (state ? Boolean.TRUE: Boolean.FALSE)); } @@ -420,7 +420,7 @@ class MaterialRetained extends NodeComponentRetained { mirror = mirrorMat; } } else { - ((MaterialRetained) mirror).set(this); + ((MaterialRetained) mirror).set(this); } } @@ -431,11 +431,11 @@ class MaterialRetained extends NodeComponentRetained { void updateNative(Context ctx, float red, float green, float blue, float alpha, boolean enableLighting) { - Pipeline.getPipeline().updateMaterial(ctx, red, green, blue, alpha, + Pipeline.getPipeline().updateMaterial(ctx, red, green, blue, alpha, ambientColor.x, ambientColor.y, ambientColor.z, - emissiveColor.x, emissiveColor.y, emissiveColor.z, - diffuseColor.x, diffuseColor.y, diffuseColor.z, - specularColor.x, specularColor.y, specularColor.z, + emissiveColor.x, emissiveColor.y, emissiveColor.z, + diffuseColor.x, diffuseColor.y, diffuseColor.z, + specularColor.x, specularColor.y, specularColor.z, shininess, colorTarget, enableLighting); } @@ -450,7 +450,7 @@ class MaterialRetained extends NodeComponentRetained { } /** - * Update the "component" field of the mirror object with the + * Update the "component" field of the mirror object with the * given "value" */ synchronized void updateMirrorObject(int component, Object value) { @@ -475,8 +475,8 @@ class MaterialRetained extends NodeComponentRetained { } else if ((component & COLORTARGET_CHANGED) != 0) { mirrorMaterial.colorTarget = ((Integer)value).intValue(); - } - + } + } @@ -484,14 +484,14 @@ class MaterialRetained extends NodeComponentRetained { return ((m != null) && lightingEnable == m.lightingEnable && diffuseColor.equals(m.diffuseColor) && - emissiveColor.equals(m.emissiveColor) && + emissiveColor.equals(m.emissiveColor) && specularColor.equals(m.specularColor) && - ambientColor.equals(m.ambientColor) && + ambientColor.equals(m.ambientColor) && colorTarget == m.colorTarget && - shininess == m.shininess); + shininess == m.shininess); } - - + + // This functions clones the retained side only and is used // internally protected Object clone() { @@ -517,7 +517,7 @@ class MaterialRetained extends NodeComponentRetained { lightingEnable = mat.lightingEnable; colorTarget = mat.colorTarget; } - + final void sendMessage(int attrMask, Object attr) { ArrayList univList = new ArrayList(); @@ -539,7 +539,7 @@ class MaterialRetained extends NodeComponentRetained { createMessage = new J3dMessage(); createMessage.threads = J3dThread.UPDATE_RENDER; createMessage.type = J3dMessage.MATERIAL_CHANGED; - + createMessage.universe = (VirtualUniverse) univList.get(i); createMessage.args[0] = this; createMessage.args[1]= new Integer(attrMask); diff --git a/src/classes/share/javax/media/j3d/MediaContainer.java b/src/classes/share/javax/media/j3d/MediaContainer.java index b5c68c4..0f71376 100644 --- a/src/classes/share/javax/media/j3d/MediaContainer.java +++ b/src/classes/share/javax/media/j3d/MediaContainer.java @@ -35,10 +35,10 @@ import java.net.URL; import java.io.InputStream; /** - * The MediaContainer object defines all sound data: cached state flag, and - * associated sound media. Currently this references the sound media in + * The MediaContainer object defines all sound data: cached state flag, and + * associated sound media. Currently this references the sound media in * one of three forms: URL String, URL object, or InputStream object. - * In future releases media data will include references to Java Media + * In future releases media data will include references to Java Media * Player objects. * Only one type of sound media data specified using * <code>setURLString</code>, <code>setURLObject</code>, @@ -84,7 +84,7 @@ public class MediaContainer extends NodeComponent { ALLOW_CACHE_READ, ALLOW_URL_READ }; - + /** * Constructs a MediaContainer object with default parameters. * The default values are as follows: @@ -94,7 +94,7 @@ public class MediaContainer extends NodeComponent { * InputStream data : null<br> * cache enable : true<br> * </ul> - */ + */ public MediaContainer() { // Just use default values // set default read capabilities @@ -106,7 +106,7 @@ public class MediaContainer extends NodeComponent { * parameters. * @param path string of URL path containing sound data * @exception SoundException if the URL is not valid or cannot be opened - */ + */ public MediaContainer(String path) { // set default read capabilities setDefaultReadCapabilities(readCapabilities); @@ -119,7 +119,7 @@ public class MediaContainer extends NodeComponent { * parameters. * @param url URL path containing sound data * @exception SoundException if the URL is not valid or cannot be opened - */ + */ public MediaContainer(URL url) { // set default read capabilities setDefaultReadCapabilities(readCapabilities); @@ -133,7 +133,7 @@ public class MediaContainer extends NodeComponent { * @param stream input stream containing sound data * * @since Java 3D 1.2 - */ + */ public MediaContainer(InputStream stream) { // set default read capabilities setDefaultReadCapabilities(readCapabilities); @@ -144,7 +144,7 @@ public class MediaContainer extends NodeComponent { /** * Creates the retained mode MediaContainerRetained object that this * component object will point to. - */ + */ void createRetained() { this.retained = new MediaContainerRetained(); this.retained.setSource(this); @@ -154,29 +154,29 @@ public class MediaContainer extends NodeComponent { * Set Cache Enable state flag. * Allows the writing of sound data explicitly into the MediaContainer * rather than just referencing a JavaMedia container. - * @param flag boolean denoting if sound data is cached in this instance - * @exception CapabilityNotSetException if appropriate capability is + * @param flag boolean denoting if sound data is cached in this instance + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ public void setCacheEnable(boolean flag) { if (isLiveOrCompiled()) - if(!this.getCapability(ALLOW_CACHE_WRITE)) - throw new CapabilityNotSetException(J3dI18N.getString("MediaContainer1")); - + if(!this.getCapability(ALLOW_CACHE_WRITE)) + throw new CapabilityNotSetException(J3dI18N.getString("MediaContainer1")); + ((MediaContainerRetained)this.retained).setCacheEnable(flag); } /** * Retrieve Cache Enable state flag. * @return flag denoting is sound data is non-cached or cached - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ public boolean getCacheEnable() { if (isLiveOrCompiled()) - if(!this.getCapability(ALLOW_CACHE_READ)) - throw new CapabilityNotSetException(J3dI18N.getString("MediaContainer2")); - + if(!this.getCapability(ALLOW_CACHE_READ)) + throw new CapabilityNotSetException(J3dI18N.getString("MediaContainer2")); + return ((MediaContainerRetained)this.retained).getCacheEnable(); } @@ -186,27 +186,27 @@ public class MediaContainer extends NodeComponent { */ public void setURL(String path) { if (isLiveOrCompiled()) { - if(!this.getCapability(ALLOW_URL_WRITE)) - throw new CapabilityNotSetException(J3dI18N.getString("MediaContainer3")); + if(!this.getCapability(ALLOW_URL_WRITE)) + throw new CapabilityNotSetException(J3dI18N.getString("MediaContainer3")); } ((MediaContainerRetained)this.retained).setURLString(path); } /** - * @deprecated As of Java 3D version 1.2, replaced by + * @deprecated As of Java 3D version 1.2, replaced by * <code>setURLObject</code> */ public void setURL(URL url) { if (isLiveOrCompiled()) - if(!this.getCapability(ALLOW_URL_WRITE)) - throw new CapabilityNotSetException(J3dI18N.getString("MediaContainer3")); + if(!this.getCapability(ALLOW_URL_WRITE)) + throw new CapabilityNotSetException(J3dI18N.getString("MediaContainer3")); ((MediaContainerRetained)this.retained).setURLObject(url); } /** * Set URL String. * @param path string of URL containing sound data - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph * @exception SoundException if the URL is not valid or cannot be opened * @exception IllegalArgumentException if the specified sound data is @@ -215,8 +215,8 @@ public class MediaContainer extends NodeComponent { */ public void setURLString(String path) { if (isLiveOrCompiled()) { - if(!this.getCapability(ALLOW_URL_WRITE)) - throw new CapabilityNotSetException(J3dI18N.getString("MediaContainer3")); + if(!this.getCapability(ALLOW_URL_WRITE)) + throw new CapabilityNotSetException(J3dI18N.getString("MediaContainer3")); } ((MediaContainerRetained)this.retained).setURLString(path); } @@ -224,7 +224,7 @@ public class MediaContainer extends NodeComponent { /** * Set URL Object. * @param url URL object containing sound data - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph * @exception SoundException if the URL is not valid or cannot be opened * @exception IllegalArgumentException if the specified sound data is @@ -233,15 +233,15 @@ public class MediaContainer extends NodeComponent { */ public void setURLObject(URL url) { if (isLiveOrCompiled()) - if(!this.getCapability(ALLOW_URL_WRITE)) - throw new CapabilityNotSetException(J3dI18N.getString("MediaContainer3")); + if(!this.getCapability(ALLOW_URL_WRITE)) + throw new CapabilityNotSetException(J3dI18N.getString("MediaContainer3")); ((MediaContainerRetained)this.retained).setURLObject(url); } /** * Set Input Stream. * @param stream input stream object containing sound data - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph * @exception SoundException if InputStream is bad * @exception IllegalArgumentException if the specified sound data is @@ -250,66 +250,66 @@ public class MediaContainer extends NodeComponent { */ public void setInputStream(InputStream stream) { if (isLiveOrCompiled()) - if(!this.getCapability(ALLOW_URL_WRITE)) - throw new CapabilityNotSetException(J3dI18N.getString("MediaContainer3")); + if(!this.getCapability(ALLOW_URL_WRITE)) + throw new CapabilityNotSetException(J3dI18N.getString("MediaContainer3")); ((MediaContainerRetained)this.retained).setInputStream(stream); } /** - * @deprecated As of Java 3D version 1.2, replaced by + * @deprecated As of Java 3D version 1.2, replaced by * <code>getURLString</code> */ public String getURL() { if (isLiveOrCompiled()) - if(!this.getCapability(ALLOW_URL_READ)) - throw new CapabilityNotSetException(J3dI18N.getString("MediaContainer4")); + if(!this.getCapability(ALLOW_URL_READ)) + throw new CapabilityNotSetException(J3dI18N.getString("MediaContainer4")); return ((MediaContainerRetained)this.retained).getURLString(); } /** * Retrieve URL String. * @return string of URL containing sound data - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph * @since Java 3D 1.2 */ public String getURLString() { if (isLiveOrCompiled()) - if(!this.getCapability(ALLOW_URL_READ)) - throw new CapabilityNotSetException(J3dI18N.getString("MediaContainer4")); + if(!this.getCapability(ALLOW_URL_READ)) + throw new CapabilityNotSetException(J3dI18N.getString("MediaContainer4")); return ((MediaContainerRetained)this.retained).getURLString(); } /** * Retrieve URL Object. * @return URL containing sound data - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph * @since Java 3D 1.2 */ public URL getURLObject() { if (isLiveOrCompiled()) - if(!this.getCapability(ALLOW_URL_READ)) - throw new CapabilityNotSetException(J3dI18N.getString("MediaContainer4")); + if(!this.getCapability(ALLOW_URL_READ)) + throw new CapabilityNotSetException(J3dI18N.getString("MediaContainer4")); return ((MediaContainerRetained)this.retained).getURLObject(); } /** * Retrieve Input Stream. * @return reference to input stream containing sound data - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph * @since Java 3D 1.2 */ public InputStream getInputStream() { if (isLiveOrCompiled()) - if(!this.getCapability(ALLOW_URL_READ)) - throw new CapabilityNotSetException(J3dI18N.getString("MediaContainer4")); + if(!this.getCapability(ALLOW_URL_READ)) + throw new CapabilityNotSetException(J3dI18N.getString("MediaContainer4")); return ((MediaContainerRetained)this.retained).getInputStream(); } /** - * @deprecated As of Java 3D version 1.2, replaced with + * @deprecated As of Java 3D version 1.2, replaced with * <code>cloneNodeComponent(boolean forceDuplicate)</code> */ public NodeComponent cloneNodeComponent() { @@ -325,7 +325,7 @@ public class MediaContainer extends NodeComponent { * the current node. This method is called from the * <code>cloneNodeComponent</code> method and <code>duplicateNodeComponent</code> * method which is, in turn, called by the - * <code>cloneTree</code> method.<P> + * <code>cloneTree</code> method.<P> * * @param originalNodeComponent the original node component to duplicate. * @param forceDuplicate when set to <code>true</code>, causes the @@ -343,9 +343,9 @@ public class MediaContainer extends NodeComponent { void duplicateAttributes(NodeComponent originalNodeComponent, boolean forceDuplicate) { - super.duplicateAttributes(originalNodeComponent, forceDuplicate); - - MediaContainerRetained mc = (MediaContainerRetained) + super.duplicateAttributes(originalNodeComponent, forceDuplicate); + + MediaContainerRetained mc = (MediaContainerRetained) originalNodeComponent.retained; MediaContainerRetained rt = (MediaContainerRetained) retained; rt.setCacheEnable(mc.getCacheEnable()); diff --git a/src/classes/share/javax/media/j3d/MediaContainerRetained.java b/src/classes/share/javax/media/j3d/MediaContainerRetained.java index 97df6ca..dfc816b 100644 --- a/src/classes/share/javax/media/j3d/MediaContainerRetained.java +++ b/src/classes/share/javax/media/j3d/MediaContainerRetained.java @@ -31,7 +31,7 @@ package javax.media.j3d; -import java.net.URL; +import java.net.URL; import java.io.InputStream; /** @@ -43,7 +43,7 @@ class MediaContainerRetained extends NodeComponentRetained { * Gain Scale Factor applied to source with this attribute */ boolean cached = true; - + /** * URL string that references the sound data */ @@ -89,13 +89,13 @@ class MediaContainerRetained extends NodeComponentRetained { if (urlString != null || inputStream != null) throw new IllegalArgumentException(J3dI18N.getString("MediaContainer5")); // Test if url object is valid by openning it - try { - InputStream stream; - stream = url.openStream(); - stream.close(); + try { + InputStream stream; + stream = url.openStream(); + stream.close(); } - catch (Exception e) { - throw new SoundException(javax.media.j3d.J3dI18N.getString("MediaContainer0")); + catch (Exception e) { + throw new SoundException(javax.media.j3d.J3dI18N.getString("MediaContainer0")); } } this.url = url; @@ -132,7 +132,7 @@ class MediaContainerRetained extends NodeComponentRetained { stream.close(); } catch (Exception e) { - throw new SoundException(javax.media.j3d.J3dI18N.getString("MediaContainer0")); + throw new SoundException(javax.media.j3d.J3dI18N.getString("MediaContainer0")); } } this.urlString = path; @@ -193,9 +193,9 @@ class MediaContainerRetained extends NodeComponentRetained { return this.inputStream; } - /** + /** * Dispatch a message about a media container change - */ + */ void dispatchMessage() { // Send message including a integer argumentD J3dMessage createMessage = new J3dMessage(); diff --git a/src/classes/share/javax/media/j3d/MemoryFreeList.java b/src/classes/share/javax/media/j3d/MemoryFreeList.java index 2012064..28deb98 100644 --- a/src/classes/share/javax/media/j3d/MemoryFreeList.java +++ b/src/classes/share/javax/media/j3d/MemoryFreeList.java @@ -51,7 +51,7 @@ class MemoryFreeList { int minBlockSize = 0; boolean justShrunk = false; int initcap = 10; - + // the minimum size since the last shrink int minSize = 0; @@ -73,7 +73,7 @@ class MemoryFreeList { catch (Exception e) { System.err.println(e); } - + initcap = initialCapacity; currBlockSize = initialCapacity; minBlockSize = currBlockSize; @@ -86,25 +86,25 @@ class MemoryFreeList { } /* - MemoryFreeList(String className, Collection collection) { - try { - c = Class.forName(className); - } - catch (Exception e) { + MemoryFreeList(String className, Collection collection) { + try { + c = Class.forName(className); + } + catch (Exception e) { // System.err.println(e); - } - - size = collection.size(); - initcap = size; - currBlockSize = size; - minBlockSize = currBlockSize; - elementData = new ArrayList(); - currBlock = new Object[currBlockSize]; - collection.toArray(currBlock); - elementData.add(currBlock); - numBlocks++; - capacity += currBlockSize; - spaceUsed = size; + } + + size = collection.size(); + initcap = size; + currBlockSize = size; + minBlockSize = currBlockSize; + elementData = new ArrayList(); + currBlock = new Object[currBlockSize]; + collection.toArray(currBlock); + elementData.add(currBlock); + numBlocks++; + capacity += currBlockSize; + spaceUsed = size; } */ @@ -142,7 +142,7 @@ class MemoryFreeList { int index = spaceUsed++; currBlock[index] = o; size++; - + return true; } } @@ -179,13 +179,13 @@ class MemoryFreeList { // minSize); if ((minSize > minBlockSize) && (numBlocks > 1)) { justShrunk = true; - + // System.err.println("removing a block"); // Runtime r = Runtime.getRuntime(); // r.gc(); // System.err.println("numBlocks = " + numBlocks + " size = " + size); // System.err.println("free memory before shrink: " + r.freeMemory()); - + // remove the last block Object[] block = (Object[])elementData.remove(numBlocks-1); numBlocks--; @@ -201,9 +201,9 @@ class MemoryFreeList { currBlockSize = currBlock.length; spaceUsed = currBlockSize; - + } - + // r.gc(); // System.err.println("free memory after shrink: " + r.freeMemory()); // System.err.println("numBlocks = " + numBlocks + " size = " + size); @@ -219,7 +219,7 @@ class MemoryFreeList { // elementData.length); // System.err.println("minCapacity = " + minCapacity + " capacity = " // + capacity); - + if (minCapacity > capacity) { // System.err.println("adding a block: numBlocks = " + numBlocks); int lastBlockSize = @@ -278,6 +278,6 @@ class MemoryFreeList { } } } - + } diff --git a/src/classes/share/javax/media/j3d/ModelClip.java b/src/classes/share/javax/media/j3d/ModelClip.java index dc42122..e63bad7 100644 --- a/src/classes/share/javax/media/j3d/ModelClip.java +++ b/src/classes/share/javax/media/j3d/ModelClip.java @@ -135,7 +135,7 @@ public class ModelClip extends Leaf { ALLOW_INFLUENCING_BOUNDS_READ, ALLOW_PLANE_READ }; - + /** * Constructs a ModelClip node with default parameters. The default * values are as follows: @@ -156,7 +156,7 @@ public class ModelClip extends Leaf { // Just use the defaults // set default read capabilities setDefaultReadCapabilities(readCapabilities); - + } @@ -183,7 +183,7 @@ public class ModelClip extends Leaf { public ModelClip(Vector4d[] planes, boolean[] enables) { // set default read capabilities setDefaultReadCapabilities(readCapabilities); - + ((ModelClipRetained)this.retained).initPlanes(planes); ((ModelClipRetained)this.retained).initEnables(enables); } @@ -196,7 +196,7 @@ public class ModelClip extends Leaf { * region. * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph - */ + */ public void setInfluencingBounds(Bounds region) { if (isLiveOrCompiled()) if (!this.getCapability(ALLOW_INFLUENCING_BOUNDS_WRITE)) @@ -209,12 +209,12 @@ public class ModelClip extends Leaf { } - /** + /** * Retrieves the ModelClip node's influencing bounds. * @return this node's influencing bounds information * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph - */ + */ public Bounds getInfluencingBounds() { if (isLiveOrCompiled()) if (!this.getCapability(ALLOW_INFLUENCING_BOUNDS_READ)) @@ -233,7 +233,7 @@ public class ModelClip extends Leaf { * new influencing region. * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph - */ + */ public void setInfluencingBoundingLeaf(BoundingLeaf region) { if (isLiveOrCompiled()) if (!this.getCapability(ALLOW_INFLUENCING_BOUNDS_WRITE)) @@ -246,12 +246,12 @@ public class ModelClip extends Leaf { } - /** + /** * Retrieves the ModelClip node's influencing bounding leaf. * @return this node's influencing bounding leaf information * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph - */ + */ public BoundingLeaf getInfluencingBoundingLeaf() { if (isLiveOrCompiled()) if (!this.getCapability(ALLOW_INFLUENCING_BOUNDS_READ)) @@ -349,7 +349,7 @@ public class ModelClip extends Leaf { else ((ModelClipRetained)this.retained).initRemoveScope(index); } - + /** * Returns an enumeration of this ModelClip node's list of scopes. @@ -389,7 +389,7 @@ public class ModelClip extends Leaf { ((ModelClipRetained)this.retained).initAddScope(scope); } - + /** * Returns the number of nodes in this ModelClip node's list of scopes. * If this number is 0, then the list of scopes is empty and this @@ -614,7 +614,7 @@ public class ModelClip extends Leaf { } /** - * Creates the retained mode ModelClipRetained object that + * Creates the retained mode ModelClipRetained object that * this ModelClip node will point to. */ void createRetained() { @@ -693,7 +693,7 @@ public class ModelClip extends Leaf { * <code>originalNode</code> into * the current node. This method is called from the * <code>cloneNode</code> method which is, in turn, called by the - * <code>cloneTree</code> method.<P> + * <code>cloneTree</code> method.<P> * * @param originalNode the original node to duplicate. * @param forceDuplicate when set to <code>true</code>, causes the @@ -712,10 +712,10 @@ public class ModelClip extends Leaf { void duplicateAttributes(Node originalNode, boolean forceDuplicate) { super.duplicateAttributes(originalNode, forceDuplicate); - ModelClipRetained attr = (ModelClipRetained) + ModelClipRetained attr = (ModelClipRetained) originalNode.retained; ModelClipRetained rt = (ModelClipRetained) retained; - + Vector4d plane = new Vector4d(); for (int i=5; i >=0; i--) { diff --git a/src/classes/share/javax/media/j3d/ModelClipRetained.java b/src/classes/share/javax/media/j3d/ModelClipRetained.java index e565459..ff2e3e3 100644 --- a/src/classes/share/javax/media/j3d/ModelClipRetained.java +++ b/src/classes/share/javax/media/j3d/ModelClipRetained.java @@ -96,7 +96,7 @@ class ModelClipRetained extends LeafRetained { boolean inImmCtx = false; // The mirror copy of this modelClip - ModelClipRetained mirrorModelClip = null; + ModelClipRetained mirrorModelClip = null; // A reference to the scene graph model clip ModelClipRetained sgModelClip = null; @@ -118,7 +118,7 @@ class ModelClipRetained extends LeafRetained { /** * Constructs and initializes model clip planes - */ + */ ModelClipRetained() { // planes contains the negate default values @@ -191,8 +191,8 @@ class ModelClipRetained extends LeafRetained { */ void setPlane(int planeNum, Vector4d plane) { initPlane(planeNum, plane); - sendMessage(PLANE_CHANGED, - new Integer(planeNum), + sendMessage(PLANE_CHANGED, + new Integer(planeNum), new Vector4d(this.xformPlanes[planeNum])); } @@ -233,7 +233,7 @@ class ModelClipRetained extends LeafRetained { void setEnables(boolean[] enables) { Boolean[] en = new Boolean[6]; - initEnables(enables); + initEnables(enables); en[0] = (enables[0] ? Boolean.TRUE: Boolean.FALSE); en[1] = (enables[1] ? Boolean.TRUE: Boolean.FALSE); en[2] = (enables[2] ? Boolean.TRUE: Boolean.FALSE); @@ -258,7 +258,7 @@ class ModelClipRetained extends LeafRetained { */ void setEnable(int planeNum, boolean enable) { initEnable(planeNum, enable); - sendMessage(ENABLE_CHANGED, + sendMessage(ENABLE_CHANGED, new Integer(planeNum), (enable ? Boolean.TRUE: Boolean.FALSE)); } @@ -300,7 +300,7 @@ class ModelClipRetained extends LeafRetained { /** * Set the Model Clip's region of influencing and send message - */ + */ void setInfluencingBounds(Bounds region) { initInfluencingBounds(region); sendMessage(BOUNDS_CHANGED, @@ -308,9 +308,9 @@ class ModelClipRetained extends LeafRetained { null); } - /** + /** * Get the Model Clip's region of influencing. - */ + */ Bounds getInfluencingBounds() { Bounds b = null; @@ -326,7 +326,7 @@ class ModelClipRetained extends LeafRetained { /** * Set the Model Clip's region of influencing to the specified Leaf node. - */ + */ void initInfluencingBoundingLeaf(BoundingLeaf region) { if (region != null) { boundingLeaf = (BoundingLeafRetained)region.retained; @@ -337,7 +337,7 @@ class ModelClipRetained extends LeafRetained { /** * Set the Model Clip's region of influencing to the specified Leaf node. - */ + */ void setInfluencingBoundingLeaf(BoundingLeaf region) { if (boundingLeaf != null) boundingLeaf.mirrorBoundingLeaf.removeUser(mirrorModelClip); @@ -348,16 +348,16 @@ class ModelClipRetained extends LeafRetained { boundingLeaf = null; } - sendMessage(BOUNDINGLEAF_CHANGED, + sendMessage(BOUNDINGLEAF_CHANGED, (boundingLeaf != null ? - boundingLeaf.mirrorBoundingLeaf : null), + boundingLeaf.mirrorBoundingLeaf : null), null); } - /** + /** * Get the Model Clip's region of influencing. - */ + */ BoundingLeaf getInfluencingBoundingLeaf() { return (boundingLeaf != null ? (BoundingLeaf)boundingLeaf.source : null); @@ -565,7 +565,7 @@ class ModelClipRetained extends LeafRetained { } /** - * Returns the index of the specified Group node within the ModelClip's list of scoped + * Returns the index of the specified Group node within the ModelClip's list of scoped * Group nodes * @param Group node whose index is desired * @return index of this node @@ -592,12 +592,12 @@ class ModelClipRetained extends LeafRetained { } - /** + /** * This method and its native counterpart update the native context * model clip planes. */ void update(Canvas3D cv, int enableMask) { - cv.setModelViewMatrix(cv.ctx, + cv.setModelViewMatrix(cv.ctx, cv.vworldToEc.mat, getLastLocalToVworld()); update(cv.ctx, enableMask, getLastLocalToVworld()); @@ -606,8 +606,8 @@ class ModelClipRetained extends LeafRetained { void update(Context ctx, int enableMask, Transform3D trans) { if (!VirtualUniverse.mc.isD3D()) { for (int i = 0; i < 6; i ++) { - Pipeline.getPipeline().updateModelClip(ctx, i, ((enableMask & (1 << i)) != 0), - xformPlanes[i].x, xformPlanes[i].y, + Pipeline.getPipeline().updateModelClip(ctx, i, ((enableMask & (1 << i)) != 0), + xformPlanes[i].x, xformPlanes[i].y, xformPlanes[i].z, xformPlanes[i].w); } return; @@ -624,8 +624,8 @@ class ModelClipRetained extends LeafRetained { for (int i=0; i < 6; i++) { if ((enableMask & (1 << i)) != 0) { - - Vector4d vec = new Vector4d(xformPlanes[i].x, xformPlanes[i].y, + + Vector4d vec = new Vector4d(xformPlanes[i].x, xformPlanes[i].y, xformPlanes[i].z, xformPlanes[i].w); vec.normalize(); invtrans.transform(vec); @@ -658,7 +658,7 @@ class ModelClipRetained extends LeafRetained { mirrorModelClip.boundingLeaf = null; mirrorModelClip.region = null; } - + if (bnds != null) { mirrorModelClip.regionOfInfluence = bnds; if (mirrorModelClip.region == null) { @@ -696,7 +696,7 @@ class ModelClipRetained extends LeafRetained { } else if ((component & PLANE_CHANGED) != 0) { int planeNum = ((Integer)objs[2]).intValue(); - + mirrorModelClip.xformPlanes[planeNum].set((Vector4d)objs[3]); } else if ((component & INIT_MIRROR) != 0) { @@ -716,12 +716,12 @@ class ModelClipRetained extends LeafRetained { if ((component & BOUNDINGLEAF_CHANGED) != 0) { mirrorModelClip.boundingLeaf = (BoundingLeafRetained)objs[2]; if (objs[2] != null) { - mirrorModelClip.region = + mirrorModelClip.region = (Bounds)mirrorModelClip.boundingLeaf.transformedRegion; } else { if (mirrorModelClip.regionOfInfluence != null) { - mirrorModelClip.region = + mirrorModelClip.region = ((Bounds)mirrorModelClip.regionOfInfluence).copy(mirrorModelClip.region); mirrorModelClip.region.transform(mirrorModelClip.regionOfInfluence, getCurrentLocalToVworld()); @@ -729,17 +729,17 @@ class ModelClipRetained extends LeafRetained { else { mirrorModelClip.region = null; } - + } - } + } if ((component & BOUNDS_CHANGED) != 0) { mirrorModelClip.regionOfInfluence = (Bounds) objs[2]; if (mirrorModelClip.boundingLeaf == null) { if (objs[2] != null) { - mirrorModelClip.region = + mirrorModelClip.region = ((Bounds)mirrorModelClip.regionOfInfluence).copy(mirrorModelClip.region); - + mirrorModelClip.region.transform(mirrorModelClip.regionOfInfluence, getCurrentLocalToVworld()); } @@ -747,7 +747,7 @@ class ModelClipRetained extends LeafRetained { mirrorModelClip.region = null; } } - } + } if ((component & SCOPE_CHANGED) != 0) { Object[] scopeList = (Object[])objs[2]; @@ -797,7 +797,7 @@ class ModelClipRetained extends LeafRetained { mirrorModelClip.enables[3] | mirrorModelClip.enables[4] | mirrorModelClip.enables[5] ; - } + } } @@ -885,7 +885,7 @@ class ModelClipRetained extends LeafRetained { } Object[] scopeInfo = new Object[2]; scopeInfo[0] = ((scopes.size() > 0) ? Boolean.TRUE:Boolean.FALSE); - scopeInfo[1] = addScopeList; + scopeInfo[1] = addScopeList; createMessage.args[2] = scopeInfo; createMessage.args[3] = xformPlanes.clone(); @@ -896,7 +896,7 @@ class ModelClipRetained extends LeafRetained { createMessage.args[4] = obj; VirtualUniverse.mc.processMessage(createMessage); - + } @@ -952,16 +952,16 @@ class ModelClipRetained extends LeafRetained { Shape3DRetained shape; ArrayList shapeList = (ArrayList)args[2]; ArrayList removeScopeList = new ArrayList(); - + for (int i = 0; i < shapeList.size(); i++) { shape = ((GeometryAtom)shapeList.get(i)).source; shape.removeModelClip(mirrorModelClip); } - mirrorModelClip.isScoped = false; + mirrorModelClip.isScoped = false; } - + // Clone the retained side only, internal use only protected Object clone() { @@ -982,7 +982,7 @@ class ModelClipRetained extends LeafRetained { mc.enables[2] | mc.enables[3] | mc.enables[4] | - mc.enables[5] ); + mc.enables[5] ); mc.inImmCtx = false; mc.region = null; @@ -1012,13 +1012,13 @@ class ModelClipRetained extends LeafRetained { } - void printPlane(int index, String string) + void printPlane(int index, String string) { - System.err.println(string + " : < " + planes[index].toString() + System.err.println(string + " : < " + planes[index].toString() + " > " + enables[index]); - } + } - void printPlanes(String string, Vector4d[] planes) + void printPlanes(String string, Vector4d[] planes) { System.err.println(string); printPlane(0, "[0]"); @@ -1030,7 +1030,7 @@ class ModelClipRetained extends LeafRetained { } - void printEnables(String string, boolean[] enables) + void printEnables(String string, boolean[] enables) { System.err.println(string); System.err.println("[0] : < " + enables[0] + " >"); diff --git a/src/classes/share/javax/media/j3d/Morph.java b/src/classes/share/javax/media/j3d/Morph.java index e79c5c8..53d5790 100644 --- a/src/classes/share/javax/media/j3d/Morph.java +++ b/src/classes/share/javax/media/j3d/Morph.java @@ -174,15 +174,15 @@ public class Morph extends Leaf { private static final int[] readCapabilities = { ALLOW_GEOMETRY_ARRAY_READ, ALLOW_APPEARANCE_READ, - ALLOW_WEIGHTS_READ, + ALLOW_WEIGHTS_READ, ALLOW_COLLISION_BOUNDS_READ, ALLOW_APPEARANCE_OVERRIDE_READ }; - + // non public default constructor Morph() { // set default read capabilities - setDefaultReadCapabilities(readCapabilities); + setDefaultReadCapabilities(readCapabilities); } /** @@ -227,7 +227,7 @@ public class Morph extends Leaf { public Morph(GeometryArray geometryArrays[]) { // set default read capabilities setDefaultReadCapabilities(readCapabilities); - + ((MorphRetained)retained).setGeometryArrays(geometryArrays); } @@ -290,7 +290,7 @@ public class Morph extends Leaf { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_COLLISION_BOUNDS_WRITE)) throw new CapabilityNotSetException(J3dI18N.getString("Morph0")); - + ((MorphRetained)this.retained).setCollisionBounds(bounds); } @@ -305,11 +305,11 @@ public class Morph extends Leaf { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_COLLISION_BOUNDS_READ)) throw new CapabilityNotSetException(J3dI18N.getString("Morph1")); - + return ((MorphRetained)this.retained).getCollisionBounds(); } - + /** * Sets the geometryArrays component of the Morph node. * @@ -361,7 +361,7 @@ public class Morph extends Leaf { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_GEOMETRY_ARRAY_WRITE)) throw new CapabilityNotSetException(J3dI18N.getString("Morph2")); - + ((MorphRetained)this.retained).setGeometryArrays(geometryArrays); } @@ -377,7 +377,7 @@ public class Morph extends Leaf { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_GEOMETRY_ARRAY_READ)) throw new CapabilityNotSetException(J3dI18N.getString("Morph3")); - + return ((MorphRetained)this.retained).getGeometryArray(index); } @@ -394,7 +394,7 @@ public class Morph extends Leaf { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_APPEARANCE_WRITE)) throw new CapabilityNotSetException(J3dI18N.getString("Morph4")); - + ((MorphRetained)this.retained).setAppearance(appearance); } @@ -409,7 +409,7 @@ public class Morph extends Leaf { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_APPEARANCE_READ)) throw new CapabilityNotSetException(J3dI18N.getString("Morph5")); - + return ((MorphRetained)this.retained).getAppearance(); } @@ -505,7 +505,7 @@ public class Morph extends Leaf { /** * Sets this Morph node's morph weight vector. The Morph node "weights" - * the corresponding GeometryArray by the amount specified. + * the corresponding GeometryArray by the amount specified. * The weights apply a morph weight vector component that creates * the desired morphing effect. * The length @@ -519,14 +519,14 @@ public class Morph extends Leaf { * * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph - * @exception IllegalArgumentException if sum of all 'weights' is + * @exception IllegalArgumentException if sum of all 'weights' is * NOT 1.0 or number of weights is NOT exqual to number of GeometryArrays. */ public void setWeights(double weights[]) { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_WEIGHTS_WRITE)) throw new CapabilityNotSetException(J3dI18N.getString("Morph8")); - + ((MorphRetained)this.retained).setWeights(weights); } @@ -540,10 +540,10 @@ public class Morph extends Leaf { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_WEIGHTS_READ)) throw new CapabilityNotSetException(J3dI18N.getString("Morph9")); - + return ((MorphRetained)this.retained).getWeights(); } - + /** * Sets a flag that indicates whether this node's appearance can * be overridden. If the flag is true, this node's @@ -553,7 +553,7 @@ public class Morph extends Leaf { * The default value is false. * * @param flag the apperance override enable flag - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph * * @see AlternateAppearance @@ -572,7 +572,7 @@ public class Morph extends Leaf { * Retrieves the appearanceOverrideEnable flag for this node. * @return true if the appearance can be overridden; false * otherwise. - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph * * @since Java 3D 1.2 @@ -629,7 +629,7 @@ public class Morph extends Leaf { * <code>false</code>, the value of each node's * <code>duplicateOnCloneTree</code> variable determines whether * NodeComponent data is duplicated or copied. - * @exception ClassCastException if originalNode is not an instance of + * @exception ClassCastException if originalNode is not an instance of * <code>Morph</code> * * @see Node#cloneTree @@ -645,7 +645,7 @@ public class Morph extends Leaf { * <code>originalNode</code> into * the current node. This method is called from the * <code>cloneNode</code> method which is, in turn, called by the - * <code>cloneTree</code> method.<P> + * <code>cloneTree</code> method.<P> * * @param originalNode the original node to duplicate. * @param forceDuplicate when set to <code>true</code>, causes the @@ -663,7 +663,7 @@ public class Morph extends Leaf { */ void duplicateAttributes(Node originalNode, boolean forceDuplicate) { super.duplicateAttributes(originalNode, forceDuplicate); - + MorphRetained attr = (MorphRetained) originalNode.retained; MorphRetained rt = (MorphRetained) retained; @@ -688,7 +688,7 @@ public class Morph extends Leaf { rt.setGeometryArrays(ga); rt.setWeights(weights); } - + // Method to check whether all geometries have allow intersect // capability bit set; it will throw an exception if any don't // have the bit set. diff --git a/src/classes/share/javax/media/j3d/MorphRetained.java b/src/classes/share/javax/media/j3d/MorphRetained.java index 8dbb517..ac6ebe7 100644 --- a/src/classes/share/javax/media/j3d/MorphRetained.java +++ b/src/classes/share/javax/media/j3d/MorphRetained.java @@ -59,12 +59,12 @@ class MorphRetained extends LeafRetained implements GeometryUpdater { * a SharedGroup, only index 0 is valid. */ ArrayList mirrorShape3D = new ArrayList(); - - + + // Target threads to be notified when morph changes final static int targetThreads = (J3dThread.UPDATE_RENDER | - J3dThread.UPDATE_GEOMETRY); - + J3dThread.UPDATE_GEOMETRY); + /** * The appearance component of the morph node. */ @@ -89,12 +89,12 @@ class MorphRetained extends LeafRetained implements GeometryUpdater { BranchGroupRetained branchGroupPath[]; - // cache value for picking in mirror shape. + // cache value for picking in mirror shape. // True if all the node of the path from this to root are all pickable boolean isPickable = true; - // cache value for collidable in mirror shape. + // cache value for collidable in mirror shape. // True if all the node of the path from this to root are all collidable boolean isCollidable = true; @@ -105,9 +105,9 @@ class MorphRetained extends LeafRetained implements GeometryUpdater { // the child index from the closest switch parent int closestSwitchIndex = -1; - // Is this Morph visible ? The default is true. + // Is this Morph visible ? The default is true. boolean visible = true; - + // geometry Bounds in local coordinate Bounds bounds = null; @@ -120,9 +120,9 @@ class MorphRetained extends LeafRetained implements GeometryUpdater { // collision Bounds in virtual world coordinate Bounds collisionVwcBound = null; - + GeometryArray morphedGeometryArray = null; - + // Morph data float[] Mcoord = null; float[] Mcolor = null; @@ -130,13 +130,13 @@ class MorphRetained extends LeafRetained implements GeometryUpdater { // First dimension is the coordSet, second dimenension is the vertex index // each vertex has 2 or 3floats float[][]MtexCoord = null; - + // Whether the normal appearance is overrided by the alternate app boolean appearanceOverrideEnable = false; int changedFrequent = 0; - + MorphRetained() { this.nodeType = NodeRetained.MORPH; localBounds = new BoundingBox(); @@ -164,7 +164,7 @@ class MorphRetained extends LeafRetained implements GeometryUpdater { message.args[1] = collisionBound; VirtualUniverse.mc.processMessage(message); } - } + } /** * Sets the geometric bounds of a node. @@ -172,7 +172,7 @@ class MorphRetained extends LeafRetained implements GeometryUpdater { */ void setBounds(Bounds bounds) { super.setBounds(bounds); - if (source.isLive() && !boundsAutoCompute) { + if (source.isLive() && !boundsAutoCompute) { J3dMessage message = new J3dMessage(); message.type = J3dMessage.REGION_BOUND_CHANGED; message.threads = J3dThread.UPDATE_TRANSFORM | @@ -190,8 +190,8 @@ class MorphRetained extends LeafRetained implements GeometryUpdater { */ Bounds getCollisionBounds() { return (collisionBound == null? null : (Bounds)collisionBound.clone()); - } - + } + /** * Sets the geometryArrays component of the Morph node. * @param geometryArrays the new vector of geometryArrays for the morph node @@ -201,7 +201,7 @@ class MorphRetained extends LeafRetained implements GeometryUpdater { if ((geometryArrays == null || geometryArrays.length == 0) && numGeometryArrays == 0) return; - + GeometryArrayRetained geo, prevGeo; if (numGeometryArrays != 0 && (geometryArrays == null || numGeometryArrays != geometryArrays.length)) @@ -235,7 +235,7 @@ class MorphRetained extends LeafRetained implements GeometryUpdater { this.geometryArrays = new GeometryArrayRetained[geometryArrays.length]; numGeometryArrays = geometryArrays.length; } - + for (i=0;i < numGeometryArrays;i++) { geo = (GeometryArrayRetained)geometryArrays[i].retained; if (((Morph)this.source).isLive()) { @@ -248,7 +248,7 @@ class MorphRetained extends LeafRetained implements GeometryUpdater { geo.addMorphUser(this); } } - + this.geometryArrays[i] = geo; } if (this.geometryArrays[0] == null) @@ -265,14 +265,14 @@ class MorphRetained extends LeafRetained implements GeometryUpdater { int texCoordSetCount = this.geometryArrays[0].getTexCoordSetCount(); if (this.geometryArrays[0] instanceof IndexedGeometryArrayRetained) { Mcoord = new float[this.geometryArrays[0].getNumCoordCount()* 3]; - + if ((vFormat & GeometryArray.COLOR_4) == GeometryArray.COLOR_3) Mcolor = new float[this.geometryArrays[0].getNumColorCount()* 3]; else if ((vFormat & GeometryArray.COLOR_4) == GeometryArray.COLOR_4) Mcolor = new float[this.geometryArrays[0].getNumColorCount()* 4]; MtexCoord = new float[texCoordSetCount][]; - if ((vFormat & GeometryArray.NORMALS) != 0) + if ((vFormat & GeometryArray.NORMALS) != 0) Mnormal = new float[this.geometryArrays[0].getNumNormalCount() *3]; for (int k = 0; k < texCoordSetCount; k++) { if ((vFormat & GeometryArray.TEXTURE_COORDINATE_2) != 0) @@ -285,7 +285,7 @@ class MorphRetained extends LeafRetained implements GeometryUpdater { } else { Mcoord = new float[this.geometryArrays[0].validVertexCount* 3]; - + if ((vFormat & GeometryArray.COLOR_4) == GeometryArray.COLOR_3) { Mcolor = new float[this.geometryArrays[0].validVertexCount* 3]; } else if ((vFormat & GeometryArray.COLOR_4) == GeometryArray.COLOR_4) { @@ -305,8 +305,8 @@ class MorphRetained extends LeafRetained implements GeometryUpdater { } } } - - // create a new morphedGeometryArray + + // create a new morphedGeometryArray initMorphedGeometry(); if (source.isLive()) { @@ -331,17 +331,17 @@ class MorphRetained extends LeafRetained implements GeometryUpdater { VirtualUniverse.mc.processMessage(mChangeMessage); if (boundsAutoCompute) { - GeometryArrayRetained mga = (GeometryArrayRetained)morphedGeometryArray.retained; + GeometryArrayRetained mga = (GeometryArrayRetained)morphedGeometryArray.retained; // Compute the bounds once mga.incrComputeGeoBounds();// This compute the bbox if dirty mga.decrComputeGeoBounds(); } } - + } - + /** * Retrieves the geometryArrays component of this Morph node. * @param index the index of GeometryArray to be returned @@ -350,7 +350,7 @@ class MorphRetained extends LeafRetained implements GeometryUpdater { GeometryArray getGeometryArray(int index) { return (GeometryArray)this.geometryArrays[index].source; } - + /** * Sets the appearance component of this Morph node. * @param appearance the new apearance component for this morph node @@ -359,15 +359,15 @@ class MorphRetained extends LeafRetained implements GeometryUpdater { boolean visibleIsDirty = false; if (((Morph)this.source).isLive()) { - + if (appearance != null) { this.appearance.clearLive(refCount); for (int i=mirrorShape3D.size()-1; i>=0; i--) { this.appearance.removeAMirrorUser( (Shape3DRetained)mirrorShape3D.get(i)); - } + } } - + if (newAppearance != null) { ((AppearanceRetained)newAppearance.retained).setLive(inBackgroundGroup, refCount); appearance = ((AppearanceRetained)newAppearance.retained); @@ -385,17 +385,17 @@ class MorphRetained extends LeafRetained implements GeometryUpdater { if(visible == false) { visible = true; visibleIsDirty = true; - } + } } // Send a message int size = 0; - + if (visibleIsDirty) size = 2; else size = 1; - J3dMessage[] createMessage = new J3dMessage[size]; + J3dMessage[] createMessage = new J3dMessage[size]; createMessage[0] = new J3dMessage(); createMessage[0].threads = J3dThread.UPDATE_RENDERING_ENVIRONMENT | J3dThread.UPDATE_RENDER; @@ -418,7 +418,7 @@ class MorphRetained extends LeafRetained implements GeometryUpdater { createMessage[0].args[4] = Shape3DRetained.getGeomAtomsArray(mirrorShape3D); if(visibleIsDirty) { createMessage[1] = new J3dMessage(); - createMessage[1].threads = J3dThread.UPDATE_GEOMETRY; + createMessage[1].threads = J3dThread.UPDATE_GEOMETRY; createMessage[1].type = J3dMessage.SHAPE3D_CHANGED; createMessage[1].universe = universe; createMessage[1].args[0] = this; @@ -436,7 +436,7 @@ class MorphRetained extends LeafRetained implements GeometryUpdater { } } } - + /** * Retrieves the morph node's appearance component. * @return the morph node's appearance @@ -445,10 +445,10 @@ class MorphRetained extends LeafRetained implements GeometryUpdater { return (appearance == null ? null : (Appearance) this.appearance.source); } - + void setAppearanceOverrideEnable(boolean flag) { if (((Morph)this.source).isLive()) { - + // Send a message J3dMessage createMessage = new J3dMessage(); createMessage.threads = J3dThread.UPDATE_RENDERING_ENVIRONMENT | @@ -478,7 +478,7 @@ class MorphRetained extends LeafRetained implements GeometryUpdater { boolean getAppearanceOverrideEnable() { return appearanceOverrideEnable; } - + boolean intersect(PickInfo pickInfo, PickShape pickShape, int flags ) { Transform3D localToVworld = pickInfo.getLocalToVWorldRef(); @@ -492,7 +492,7 @@ class MorphRetained extends LeafRetained implements GeometryUpdater { if (geo.mirrorGeometry != null) { geo = geo.mirrorGeometry; } - + if (((flags & PickInfo.CLOSEST_INTERSECTION_POINT) == 0) && ((flags & PickInfo.CLOSEST_DISTANCE) == 0) && ((flags & PickInfo.CLOSEST_GEOM_INFO) == 0) && @@ -504,11 +504,11 @@ class MorphRetained extends LeafRetained implements GeometryUpdater { Point3d iPntVW = new Point3d(); if (geo.intersect(newPS, pickInfo, flags, iPnt, geo, 0)) { - + iPntVW.set(iPnt); localToVworld.transform(iPntVW); double distance = pickShape.distance(iPntVW); - + if ((flags & PickInfo.CLOSEST_DISTANCE) != 0) { pickInfo.setClosestDistance(distance); } @@ -520,8 +520,8 @@ class MorphRetained extends LeafRetained implements GeometryUpdater { } return false; } - - + + /** * Check if the geometry component of this shape node under path * intersects with the pickShape. @@ -531,17 +531,17 @@ class MorphRetained extends LeafRetained implements GeometryUpdater { */ boolean intersect(SceneGraphPath path, PickShape pickShape, double[] dist) { - + // This method will not do bound intersect check, as it assume caller // has already done that. ( For performance and code simplification // reasons. ) int flags; PickInfo pickInfo = new PickInfo(); - + Transform3D localToVworld = path.getTransform(); if (localToVworld == null) { - throw new RuntimeException(J3dI18N.getString("MorphRetained5")); + throw new RuntimeException(J3dI18N.getString("MorphRetained5")); } pickInfo.setLocalToVWorldRef( localToVworld); @@ -550,17 +550,17 @@ class MorphRetained extends LeafRetained implements GeometryUpdater { //System.err.println(" no dist request ...."); return intersect(pickInfo, pickShape, 0); } - + flags = PickInfo.CLOSEST_DISTANCE; if (intersect(pickInfo, pickShape, flags)) { dist[0] = pickInfo.getClosestDistance(); return true; } - + return false; - - } - + + } + /** * Sets the Morph node's weight vector * @param wieghts the new vector of weights for the morph node @@ -580,9 +580,9 @@ class MorphRetained extends LeafRetained implements GeometryUpdater { throw new IllegalArgumentException(J3dI18N.getString("MorphRetained8")); // Weights array is ALWAYS malloced in setGeometryArrays method - for (i=numGeometryArrays-1; i>=0; i--) + for (i=numGeometryArrays-1; i>=0; i--) this.weights[i] = weights[i]; - + if (source.isLive()) { ((GeometryArrayRetained)morphedGeometryArray.retained).updateData(this); @@ -592,7 +592,7 @@ class MorphRetained extends LeafRetained implements GeometryUpdater { mChangeMessage.threads = (J3dThread.UPDATE_GEOMETRY | J3dThread.UPDATE_TRANSFORM); // If its a indexed geometry array, unindexify in renderBin - if (this.geometryArrays[0] instanceof IndexedGeometryArrayRetained) + if (this.geometryArrays[0] instanceof IndexedGeometryArrayRetained) mChangeMessage.threads |= J3dThread.UPDATE_RENDERING_ATTRIBUTES; mChangeMessage.args[0] = this; mChangeMessage.args[1]= new Integer(GEOMETRY_CHANGED); @@ -602,7 +602,7 @@ class MorphRetained extends LeafRetained implements GeometryUpdater { } } - + /** * Retrieves the Morph node's weight vector * @return the morph node's weight vector. @@ -645,7 +645,7 @@ class MorphRetained extends LeafRetained implements GeometryUpdater { * Compute the combine bounds of bounds and its localBounds. */ void computeCombineBounds(Bounds bounds) { - + if(boundsAutoCompute) { GeometryArrayRetained mga = (GeometryArrayRetained)morphedGeometryArray.retained; @@ -660,7 +660,7 @@ class MorphRetained extends LeafRetained implements GeometryUpdater { bounds.combine((Bounds) localBounds); } } - } + } // Return the number of geometry arrays in this MorphRetained object. int getNumGeometryArrays() { @@ -680,15 +680,15 @@ class MorphRetained extends LeafRetained implements GeometryUpdater { if (numGeometryArrays > 1) { doErrorCheck(geo, geometryArrays[1]); } - + } } - + ((GeometryArrayRetained)morphedGeometryArray.retained).updateData(this); // Compute the bounds once if (boundsAutoCompute && coordinatesChanged) { - GeometryArrayRetained mga = (GeometryArrayRetained)morphedGeometryArray.retained; + GeometryArrayRetained mga = (GeometryArrayRetained)morphedGeometryArray.retained; mga.incrComputeGeoBounds(); // This compute the bbox if dirty mga.decrComputeGeoBounds(); } @@ -700,11 +700,11 @@ class MorphRetained extends LeafRetained implements GeometryUpdater { */ public void updateData(Geometry mga) { - int i,j,k, vFormat, geoType, stripVCount[]; + int i,j,k, vFormat, geoType, stripVCount[]; int iCount = 0; int numStrips = 0; int texCoordSetCount = 0; - float coord[] = new float[3], color[] = new float[4], + float coord[] = new float[3], color[] = new float[4], normal[] = new float[3], texCoord[] = new float[3]; vFormat = geometryArrays[0].vertexFormat; @@ -720,11 +720,11 @@ class MorphRetained extends LeafRetained implements GeometryUpdater { } else { count = geometryArrays[0].validVertexCount; } - + for (i=0; i < count; i++) { Mcoord[vc++] = Mcoord[vc++] = Mcoord[vc++] = 0.0f; } - + if ((vFormat & GeometryArray.COLOR) != 0) { if (geometryArrays[0] instanceof IndexedGeometryArrayRetained){ @@ -735,12 +735,12 @@ class MorphRetained extends LeafRetained implements GeometryUpdater { for (i=0; i < count; i++) { if ((vFormat & GeometryArray.COLOR_4) == GeometryArray.COLOR_3) Mcolor[cc++] = Mcolor[cc++] = Mcolor[cc++] = 0.0f; - + else if ((vFormat & GeometryArray.COLOR_4) == GeometryArray.COLOR_4) Mcolor[cc++] = Mcolor[cc++] = Mcolor[cc++] = Mcolor[cc++] = 0.0f; } } - + if ((vFormat & GeometryArray.NORMALS) != 0) { if (geometryArrays[0] instanceof IndexedGeometryArrayRetained){ @@ -752,9 +752,9 @@ class MorphRetained extends LeafRetained implements GeometryUpdater { Mnormal[nc++] = Mnormal[nc++] = Mnormal[nc++] = 0.0f; } } - + if ((vFormat & GeometryArray.TEXTURE_COORDINATE) != 0) { - for (k = 0; k < texCoordSetCount; k++) { + for (k = 0; k < texCoordSetCount; k++) { if (geometryArrays[0] instanceof IndexedGeometryArrayRetained){ count = geometryArrays[0].getNumTexCoordCount(k); } else { @@ -822,7 +822,7 @@ class MorphRetained extends LeafRetained implements GeometryUpdater { Mnormal[nc++] += normal[2]*w; } } - + if ((vFormat & GeometryArray.TEXTURE_COORDINATE) != 0) { for (k = 0; k < texCoordSetCount; k++) { int tcount = 0; @@ -873,7 +873,7 @@ class MorphRetained extends LeafRetained implements GeometryUpdater { int noffset = geometryArrays[0].normalOffset(); int voffset = geometryArrays[0].coordinateOffset(); int offset = 0; - + int initialVertex = 0; for (j=0;j < numGeometryArrays;j++) { double w = weights[j]; @@ -954,7 +954,7 @@ class MorphRetained extends LeafRetained implements GeometryUpdater { Mcoord[vc++] += vdata[offset]*w; Mcoord[vc++] += vdata[offset+1]*w; Mcoord[vc++] += vdata[offset+2]*w; - + } } } @@ -1103,7 +1103,7 @@ class MorphRetained extends LeafRetained implements GeometryUpdater { Mcolor[cc++] += (c4b[cIndex].w & 0xff) * val; } break; - + } } if ((vFormat & GeometryArray.NORMALS) != 0) { @@ -1126,7 +1126,7 @@ class MorphRetained extends LeafRetained implements GeometryUpdater { Mnormal[nc++] += nf[nIndex++]*w; } break; - case GeometryArrayRetained.N3F: + case GeometryArrayRetained.N3F: Vector3f[] n3f = geometryArrays[j].getNormalRef3f(); for (i=0; i< count; i++, nIndex++) { Mnormal[nc++] += n3f[nIndex].x*w; @@ -1181,27 +1181,27 @@ class MorphRetained extends LeafRetained implements GeometryUpdater { Mcoord[vc++] += (float)p3d[vIndex].z*w; } break; - + } - - } + + } } } } - + GeometryArrayRetained mgaR = (GeometryArrayRetained)mga.retained; mgaR.setCoordRefFloat(Mcoord); - + if ((vFormat & GeometryArray.COLOR) != 0) mgaR.setColorRefFloat(Mcolor); - + // *******Need to normalize normals if ((vFormat & GeometryArray.NORMALS) != 0) mgaR.setNormalRefFloat(Mnormal); - - if ((vFormat & GeometryArray.TEXTURE_COORDINATE) != 0) { + + if ((vFormat & GeometryArray.TEXTURE_COORDINATE) != 0) { for (k = 0; k < texCoordSetCount; k++) { mgaR.setTexCoordRefFloat(k, MtexCoord[k]); } @@ -1210,7 +1210,7 @@ class MorphRetained extends LeafRetained implements GeometryUpdater { void updateImmediateMirrorObject(Object[] objs) { int i; - + int component = ((Integer)objs[1]).intValue(); Shape3DRetained[] msArr = (Shape3DRetained[]) objs[2]; if ((component & APPEARANCE_CHANGED) != 0) { @@ -1231,7 +1231,7 @@ class MorphRetained extends LeafRetained implements GeometryUpdater { } } } - + /** * assign a name to this node when it is made live. */ @@ -1241,10 +1241,10 @@ class MorphRetained extends LeafRetained implements GeometryUpdater { ArrayList msList = new ArrayList(); GeometryAtom ga; int oldrefCount = refCount; - + super.doSetLive(s); nodeId = universe.getNodeId(); - + for (i = 0; i < numGeometryArrays; i++) { synchronized(geometryArrays[i].liveStateLock) { @@ -1263,14 +1263,14 @@ class MorphRetained extends LeafRetained implements GeometryUpdater { ((GeometryArrayRetained)(morphedGeometryArray.retained)).setLive(inBackgroundGroup, s.refCount); if (boundsAutoCompute) { - GeometryArrayRetained mga = (GeometryArrayRetained)morphedGeometryArray.retained; + GeometryArrayRetained mga = (GeometryArrayRetained)morphedGeometryArray.retained; // Compute the bounds once mga.incrComputeGeoBounds(); // This compute the bbox if dirty mga.decrComputeGeoBounds(); localBounds.setWithLock(mga.geoBounds); } - + if (inSharedGroup) { for (i=0; i<s.keys.length; i++) { shape = new Shape3DRetained(); @@ -1282,7 +1282,7 @@ class MorphRetained extends LeafRetained implements GeometryUpdater { j = s.keys[i].equals(localToVworldKeys, 0, localToVworldKeys.length); if(j < 0) { - System.err.println("MorphRetained : Can't find hashKey"); + System.err.println("MorphRetained : Can't find hashKey"); } shape.localToVworld[0] = localToVworld[j]; @@ -1304,7 +1304,7 @@ class MorphRetained extends LeafRetained implements GeometryUpdater { } } } - + // Add any scoped fog if (s.fogs != null) { ArrayList l = (ArrayList)s.fogs.get(j); @@ -1324,7 +1324,7 @@ class MorphRetained extends LeafRetained implements GeometryUpdater { } } } - + // Add any scoped alt app if (s.altAppearances != null) { ArrayList l = (ArrayList)s.altAppearances.get(j); @@ -1341,7 +1341,7 @@ class MorphRetained extends LeafRetained implements GeometryUpdater { shape.viewList = null; // ((GeometryArrayRetained)(morphedGeometryArray.retained)).addUser(shape); - + ga = Shape3DRetained.getGeomAtom(shape); @@ -1383,7 +1383,7 @@ class MorphRetained extends LeafRetained implements GeometryUpdater { } } } - + // Add any scoped fog if (s.fogs != null) { ArrayList l = (ArrayList)s.fogs.get(0); @@ -1403,7 +1403,7 @@ class MorphRetained extends LeafRetained implements GeometryUpdater { } } } - + // Add any scoped alt app if (s.altAppearances != null) { ArrayList l = (ArrayList)s.altAppearances.get(0); @@ -1418,14 +1418,14 @@ class MorphRetained extends LeafRetained implements GeometryUpdater { shape.viewList = (ArrayList)s.viewLists.get(0); else shape.viewList = null; - + // ((GeometryArrayRetained)(morphedGeometryArray.retained)).addUser(shape); ga = Shape3DRetained.getGeomAtom(shape); // Add the geometry atom for this shape to the Targets s.nodeList.add(ga); - + if (s.transformTargets != null && s.transformTargets[0] != null) { s.transformTargets[0].addNode(ga, Targets.GEO_TARGETS); @@ -1459,7 +1459,7 @@ class MorphRetained extends LeafRetained implements GeometryUpdater { } } - s.notifyThreads |= (J3dThread.UPDATE_GEOMETRY | + s.notifyThreads |= (J3dThread.UPDATE_GEOMETRY | J3dThread.UPDATE_TRANSFORM | J3dThread.UPDATE_RENDER | J3dThread.UPDATE_RENDERING_ATTRIBUTES); @@ -1475,10 +1475,10 @@ class MorphRetained extends LeafRetained implements GeometryUpdater { VirtualUniverse.mc.processMessage(mChangeMessage); } super.markAsLive(); - + } - + /** * assign a name to this node when it is made live. */ @@ -1488,9 +1488,9 @@ class MorphRetained extends LeafRetained implements GeometryUpdater { Object[] shapes; ArrayList appList = new ArrayList(); GeometryAtom ga; - + super.clearLive(s); - + for (i = 0; i < numGeometryArrays; i++) { synchronized(geometryArrays[i].liveStateLock) { geometryArrays[i].clearLive(s.refCount); @@ -1501,7 +1501,7 @@ class MorphRetained extends LeafRetained implements GeometryUpdater { } } } - GeometryArrayRetained mga = (GeometryArrayRetained)morphedGeometryArray.retained; + GeometryArrayRetained mga = (GeometryArrayRetained)morphedGeometryArray.retained; mga.clearLive( s.refCount); @@ -1569,13 +1569,13 @@ class MorphRetained extends LeafRetained implements GeometryUpdater { J3dThread.UPDATE_TRANSFORM | // This is used to clear the scope info // of all the mirror shapes - J3dThread.UPDATE_RENDERING_ENVIRONMENT | + J3dThread.UPDATE_RENDERING_ENVIRONMENT | J3dThread.UPDATE_RENDER); } - void updatePickable(HashKey keys[], boolean pick[]) { + void updatePickable(HashKey keys[], boolean pick[]) { super.updatePickable(keys, pick); Shape3DRetained shape; @@ -1595,11 +1595,11 @@ class MorphRetained extends LeafRetained implements GeometryUpdater { } } - } + } } - void updateCollidable(HashKey keys[], boolean collide[]) { + void updateCollidable(HashKey keys[], boolean collide[]) { super.updateCollidable(keys, collide); Shape3DRetained shape; @@ -1618,7 +1618,7 @@ class MorphRetained extends LeafRetained implements GeometryUpdater { } } - } + } } Shape3DRetained getMirrorShape(SceneGraphPath path) { @@ -1626,7 +1626,7 @@ class MorphRetained extends LeafRetained implements GeometryUpdater { return (Shape3DRetained) mirrorShape3D.get(0); } HashKey key = new HashKey(""); - path.getHashKey(key); + path.getHashKey(key); return getMirrorShape(key); } @@ -1635,7 +1635,7 @@ class MorphRetained extends LeafRetained implements GeometryUpdater { if (i>=0) { return (Shape3DRetained) mirrorShape3D.get(i); } - + // Not possible throw new RuntimeException("Shape3DRetained: MirrorShape Not found!"); } @@ -1650,7 +1650,7 @@ class MorphRetained extends LeafRetained implements GeometryUpdater { } GeometryAtom ga = Shape3DRetained.getGeomAtom(ms); leafList.add(ga); - + } void setBoundsAutoCompute(boolean autoCompute) { @@ -1659,13 +1659,13 @@ class MorphRetained extends LeafRetained implements GeometryUpdater { // localBounds may not have been set to bbox localBounds = new BoundingBox(); if (source.isLive() && morphedGeometryArray != null) { - GeometryArrayRetained mga = (GeometryArrayRetained)morphedGeometryArray.retained; + GeometryArrayRetained mga = (GeometryArrayRetained)morphedGeometryArray.retained; mga.incrComputeGeoBounds(); // This compute the bbox if dirty - mga.decrComputeGeoBounds(); + mga.decrComputeGeoBounds(); } - } + } + - localBounds = getBounds(); super.setBoundsAutoCompute(autoCompute); if (source.isLive()) { @@ -1701,7 +1701,7 @@ class MorphRetained extends LeafRetained implements GeometryUpdater { * Initialization of morphed geometry */ void initMorphedGeometry() { - int vFormat, geoType, stripVCount[]; + int vFormat, geoType, stripVCount[]; int iCount = 0; int numStrips = 0; int texCoordSetCount = 0; @@ -1717,25 +1717,25 @@ class MorphRetained extends LeafRetained implements GeometryUpdater { geo.getTexCoordSetMap(texCoordSetMap); } geoType = geo.geoType; - + switch (geoType){ case GeometryRetained.GEO_TYPE_QUAD_SET: - this.morphedGeometryArray = - new QuadArray(geometryArrays[0].validVertexCount, vFormat, texCoordSetCount, + this.morphedGeometryArray = + new QuadArray(geometryArrays[0].validVertexCount, vFormat, texCoordSetCount, texCoordSetMap); break; - case GeometryRetained.GEO_TYPE_TRI_SET: - this.morphedGeometryArray = + case GeometryRetained.GEO_TYPE_TRI_SET: + this.morphedGeometryArray = new TriangleArray(geometryArrays[0].validVertexCount, vFormat, texCoordSetCount, texCoordSetMap); break; case GeometryRetained.GEO_TYPE_POINT_SET: - this.morphedGeometryArray = + this.morphedGeometryArray = new PointArray(geometryArrays[0].validVertexCount, vFormat, texCoordSetCount, texCoordSetMap); break; case GeometryRetained.GEO_TYPE_LINE_SET: - this.morphedGeometryArray = + this.morphedGeometryArray = new LineArray(geometryArrays[0].validVertexCount, vFormat, texCoordSetCount, texCoordSetMap); break; @@ -1743,7 +1743,7 @@ class MorphRetained extends LeafRetained implements GeometryUpdater { numStrips = ((TriangleStripArrayRetained)geo).getNumStrips(); stripVCount = new int[numStrips]; ((TriangleStripArrayRetained)geo).getStripVertexCounts(stripVCount); - this.morphedGeometryArray = + this.morphedGeometryArray = new TriangleStripArray(geometryArrays[0].validVertexCount, vFormat, texCoordSetCount, texCoordSetMap, stripVCount); break; @@ -1751,7 +1751,7 @@ class MorphRetained extends LeafRetained implements GeometryUpdater { numStrips = ((TriangleFanArrayRetained)geo).getNumStrips(); stripVCount = new int[numStrips]; ((TriangleFanArrayRetained)geo).getStripVertexCounts(stripVCount); - this.morphedGeometryArray = + this.morphedGeometryArray = new TriangleFanArray(geometryArrays[0].validVertexCount, vFormat, texCoordSetCount, texCoordSetMap, stripVCount); break; @@ -1759,32 +1759,32 @@ class MorphRetained extends LeafRetained implements GeometryUpdater { numStrips = ((LineStripArrayRetained)geo).getNumStrips(); stripVCount = new int[numStrips]; ((LineStripArrayRetained)geo).getStripVertexCounts(stripVCount); - this.morphedGeometryArray = + this.morphedGeometryArray = new LineStripArray(geometryArrays[0].validVertexCount, vFormat, texCoordSetCount, texCoordSetMap, stripVCount); break; case GeometryRetained.GEO_TYPE_INDEXED_QUAD_SET: iCount = ((IndexedGeometryArrayRetained)geo).getIndexCount(); - this.morphedGeometryArray = + this.morphedGeometryArray = new IndexedQuadArray(geometryArrays[0].getNumCoordCount(), vFormat, texCoordSetCount, texCoordSetMap, iCount); break; case GeometryRetained.GEO_TYPE_INDEXED_TRI_SET: iCount = ((IndexedGeometryArrayRetained)geo).getIndexCount(); - this.morphedGeometryArray = + this.morphedGeometryArray = new IndexedTriangleArray(geometryArrays[0].getNumCoordCount(), vFormat, texCoordSetCount, texCoordSetMap, iCount); break; case GeometryRetained.GEO_TYPE_INDEXED_POINT_SET: iCount = ((IndexedGeometryArrayRetained)geo).getIndexCount(); - this.morphedGeometryArray = + this.morphedGeometryArray = new IndexedPointArray(geometryArrays[0].getNumCoordCount(), vFormat, texCoordSetCount, texCoordSetMap, iCount); break; case GeometryRetained.GEO_TYPE_INDEXED_LINE_SET: iCount = ((IndexedGeometryArrayRetained)geo).getIndexCount(); - this.morphedGeometryArray = + this.morphedGeometryArray = new IndexedLineArray(geometryArrays[0].getNumCoordCount(), vFormat, texCoordSetCount, texCoordSetMap, iCount); break; @@ -1793,7 +1793,7 @@ class MorphRetained extends LeafRetained implements GeometryUpdater { numStrips = ((IndexedTriangleStripArrayRetained)geo).getNumStrips(); stripVCount = new int[numStrips]; ((IndexedTriangleStripArrayRetained)geo).getStripIndexCounts(stripVCount); - this.morphedGeometryArray = + this.morphedGeometryArray = new IndexedTriangleStripArray(geometryArrays[0].getNumCoordCount(), vFormat, texCoordSetCount, texCoordSetMap, iCount, stripVCount);break; case GeometryRetained.GEO_TYPE_INDEXED_TRI_FAN_SET: @@ -1801,7 +1801,7 @@ class MorphRetained extends LeafRetained implements GeometryUpdater { numStrips = ((IndexedTriangleFanArrayRetained)geo).getNumStrips(); stripVCount = new int[numStrips]; ((IndexedTriangleFanArrayRetained)geo).getStripIndexCounts(stripVCount); - this.morphedGeometryArray = + this.morphedGeometryArray = new IndexedTriangleFanArray(geometryArrays[0].getNumCoordCount(), vFormat, texCoordSetCount, texCoordSetMap, iCount, stripVCount);break; case GeometryRetained.GEO_TYPE_INDEXED_LINE_STRIP_SET: @@ -1809,7 +1809,7 @@ class MorphRetained extends LeafRetained implements GeometryUpdater { numStrips = ((IndexedLineStripArrayRetained)geo).getNumStrips(); stripVCount = new int[numStrips]; ((IndexedLineStripArrayRetained)geo).getStripIndexCounts(stripVCount); - this.morphedGeometryArray = + this.morphedGeometryArray = new IndexedLineStripArray(geometryArrays[0].getNumCoordCount(), vFormat, texCoordSetCount, texCoordSetMap, iCount, stripVCount);break; } @@ -1827,7 +1827,7 @@ class MorphRetained extends LeafRetained implements GeometryUpdater { } if ((vFormat & GeometryArray.COLOR) != 0) { morphedGeo.setColorIndices(0, igeo.indexColor); - } + } if ((vFormat & GeometryArray.TEXTURE_COORDINATE) != 0) { for (k = 0; k < texCoordSetCount; k++) { morphedGeo.setTextureCoordinateIndices(k, 0, @@ -1841,9 +1841,9 @@ class MorphRetained extends LeafRetained implements GeometryUpdater { GeometryArrayRetained mga = (GeometryArrayRetained)morphedGeometryArray.retained; mga.updateData(this); - + } - + void getMirrorShape3D(ArrayList list, HashKey k) { Shape3DRetained ms; if (inSharedGroup) { @@ -1853,7 +1853,7 @@ class MorphRetained extends LeafRetained implements GeometryUpdater { ms = (Shape3DRetained)mirrorShape3D.get(0); } list.add(ms); - + } void compile(CompileState compState) { @@ -1900,7 +1900,7 @@ class MorphRetained extends LeafRetained implements GeometryUpdater { } else if (geo instanceof IndexedGeometryArrayRetained) { if (((IndexedGeometryArrayRetained)prevGeo).validIndexCount != ((IndexedGeometryArrayRetained)geo).validIndexCount) throw new IllegalArgumentException(J3dI18N.getString("MorphRetained1")); - + // If by reference, then all array lengths should be same if (geo.getNumCoordCount() != prevGeo.getNumCoordCount() || geo.getNumColorCount() != prevGeo.getNumColorCount() || @@ -1912,8 +1912,8 @@ class MorphRetained extends LeafRetained implements GeometryUpdater { if (geo.getNumTexCoordCount(k) != prevGeo.getNumTexCoordCount(k)) { throw new IllegalArgumentException(J3dI18N.getString("MorphRetained1")); } - } - + } + if (geo instanceof IndexedGeometryStripArrayRetained) { prevSvc= ((IndexedGeometryStripArrayRetained)prevGeo).stripIndexCounts; svc= ((IndexedGeometryStripArrayRetained)geo).stripIndexCounts; @@ -1945,7 +1945,7 @@ class MorphRetained extends LeafRetained implements GeometryUpdater { changedFrequent &= ~mask; } } - } + } void searchGeometryAtoms(UnorderList list) { list.add(Shape3DRetained.getGeomAtom( diff --git a/src/classes/share/javax/media/j3d/NativeConfigTemplate3D.java b/src/classes/share/javax/media/j3d/NativeConfigTemplate3D.java index 4d41abd..fb21df3 100644 --- a/src/classes/share/javax/media/j3d/NativeConfigTemplate3D.java +++ b/src/classes/share/javax/media/j3d/NativeConfigTemplate3D.java @@ -119,7 +119,7 @@ abstract class NativeConfigTemplate3D { // Return whether scene antialiasing is available. abstract boolean hasSceneAntialiasingMultisample(Canvas3D c3d); - + // Ensure that the native libraries are loaded static { VirtualUniverse.loadLibraries(); diff --git a/src/classes/share/javax/media/j3d/NativePipeline.java b/src/classes/share/javax/media/j3d/NativePipeline.java index e0de869..d78a03b 100644 --- a/src/classes/share/javax/media/j3d/NativePipeline.java +++ b/src/classes/share/javax/media/j3d/NativePipeline.java @@ -44,27 +44,27 @@ import java.util.ArrayList; * pipeline. */ class NativePipeline extends Pipeline { - + // System properties containing the native library search PATH // The order listed is the order in which they will be searched private static final String[] systemPathProps = { "sun.boot.library.path", "java.library.path" }; - + // Prefix for native libraries private static final String libPrefix = "j3dcore"; - + // Boolean indicating whether we are using D3D or OGL private boolean isD3D; - + // Renderer name, either "ogl" or "d3d" private String rendererName; - + // Flags indicating whether the Cg or GLSL libraries are available. private boolean cgLibraryAvailable = false; private boolean glslLibraryAvailable = false; - + // Flag indicating that the ogl-chk library has been loaded private static boolean oglChkLibraryLoaded = false; @@ -95,7 +95,7 @@ class NativePipeline extends Pipeline { */ protected NativePipeline() { } - + /** * Initialize the pipeline */ @@ -108,7 +108,7 @@ class NativePipeline extends Pipeline { toolkit = null; // just making sure GC collects this } catch (java.awt.AWTError e) { } - + switch (pipelineType) { case NATIVE_OGL: isD3D = false; @@ -249,7 +249,7 @@ class NativePipeline extends Pipeline { new java.security.PrivilegedAction() { public Object run() { ArrayList pathList = new ArrayList(); - + String filename = System.mapLibraryName(libraryName); for (int n = 0; n < systemPathProps.length; n++) { String pathString = System.getProperty(systemPathProps[n]); @@ -266,29 +266,29 @@ class NativePipeline extends Pipeline { if (pathFile.exists()) { pathList.add(pathFile.getAbsolutePath()); } - + posStart = posEnd + 1; } } - + // If no absolute path names exist, add in the relative library name if (pathList.size() == 0) { pathList.add(filename); } - + return (String[])pathList.toArray(new String[0]); } }); } - + // Method to verify whether the native Cg library is available private native boolean loadNativeCgLibrary(String[] libpath); - - + + // // Methods to box/unbox various native objects // - + private long unbox(Context ctx) { if (ctx == null) { return 0; @@ -296,7 +296,7 @@ class NativePipeline extends Pipeline { return ((NativeContext)ctx).getNativeCtx(); } } - + private Context boxContext(long nativeCtx) { if (nativeCtx == 0) { return null; @@ -304,7 +304,7 @@ class NativePipeline extends Pipeline { return new NativeContext(nativeCtx); } } - + private long unbox(Drawable drawable) { if (drawable == null) { return 0; @@ -312,7 +312,7 @@ class NativePipeline extends Pipeline { return ((NativeDrawable)drawable).getNativeDrawable(); } } - + private Drawable boxDrawable(long nativeDrawable) { if (nativeDrawable == 0) { return null; @@ -320,7 +320,7 @@ class NativePipeline extends Pipeline { return new NativeDrawable(nativeDrawable); } } - + private long unbox(ShaderProgramId shaderProgramId) { if (shaderProgramId == null) { return 0; @@ -328,7 +328,7 @@ class NativePipeline extends Pipeline { return ((NativeShaderObject)shaderProgramId).getNativeId(); } } - + private ShaderProgramId boxShaderProgramId(long nativeId) { if (nativeId == 0) { return null; @@ -336,7 +336,7 @@ class NativePipeline extends Pipeline { return new NativeShaderObject(nativeId); } } - + private long unbox(ShaderId shaderId) { if (shaderId == null) { return 0; @@ -344,7 +344,7 @@ class NativePipeline extends Pipeline { return ((NativeShaderObject)shaderId).getNativeId(); } } - + private ShaderId boxShaderId(long nativeId) { if (nativeId == 0) { return null; @@ -352,7 +352,7 @@ class NativePipeline extends Pipeline { return new NativeShaderObject(nativeId); } } - + private long unbox(ShaderAttrLoc attrLoc) { if (attrLoc == null) { return -1; @@ -360,7 +360,7 @@ class NativePipeline extends Pipeline { return ((NativeShaderObject)attrLoc).getNativeId(); } } - + private ShaderAttrLoc boxShaderAttrLoc(long nativeId) { if (nativeId == -1) { return null; @@ -368,16 +368,16 @@ class NativePipeline extends Pipeline { return new NativeShaderObject(nativeId); } } - + // --------------------------------------------------------------------- - + // // GeometryArrayRetained methods // - + // Used by D3D to free vertex buffer native void freeD3DArray(GeometryArrayRetained geo, boolean deleteVB); - + // used for GeometryArrays by Copy or interleaved native void execute(long ctx, GeometryArrayRetained geo, int geo_type, @@ -391,7 +391,7 @@ class NativePipeline extends Pipeline { int numActiveTexUnitState, int vertexAttrCount, int[] vertexAttrSizes, float[] varray, float[] cdata, int cdirty); - + void execute(Context ctx, GeometryArrayRetained geo, int geo_type, boolean isNonUniformScale, @@ -417,7 +417,7 @@ class NativePipeline extends Pipeline { vertexAttrCount, vertexAttrSizes, varray, cdata, cdirty); } - + // used by GeometryArray by Reference with java arrays native void executeVA(long ctx, GeometryArrayRetained geo, int geo_type, @@ -436,7 +436,7 @@ class NativePipeline extends Pipeline { int numActiveTexUnitState, int[] texIndex, int texstride, Object[] texCoords, int cdirty); - + void executeVA(Context ctx, GeometryArrayRetained geo, int geo_type, boolean isNonUniformScale, @@ -472,7 +472,7 @@ class NativePipeline extends Pipeline { texIndex, texstride, texCoords, cdirty); } - + // used by GeometryArray by Reference with NIO buffer native void executeVABuffer(long ctx, GeometryArrayRetained geo, int geo_type, @@ -494,7 +494,7 @@ class NativePipeline extends Pipeline { int numActiveTexUnitState, int[] texIndex, int texstride, Object[] texCoords, int cdirty); - + void executeVABuffer(Context ctx, GeometryArrayRetained geo, int geo_type, boolean isNonUniformScale, @@ -536,7 +536,7 @@ class NativePipeline extends Pipeline { texIndex, texstride, texCoords, cdirty); } - + // used by GeometryArray by Reference in interleaved format with NIO buffer native void executeInterleavedBuffer(long ctx, GeometryArrayRetained geo, int geo_type, @@ -549,7 +549,7 @@ class NativePipeline extends Pipeline { int[] texCoordSetOffset, int numActiveTexUnitState, Object varray, float[] cdata, int cdirty); - + void executeInterleavedBuffer(Context ctx, GeometryArrayRetained geo, int geo_type, boolean isNonUniformScale, @@ -573,25 +573,25 @@ class NativePipeline extends Pipeline { numActiveTexUnitState, varray, cdata, cdirty); } - + native void setVertexFormat(long ctx, GeometryArrayRetained geo, int vformat, boolean useAlpha, boolean ignoreVertexColors); - + void setVertexFormat(Context ctx, GeometryArrayRetained geo, int vformat, boolean useAlpha, boolean ignoreVertexColors) { setVertexFormat(unbox(ctx), geo, vformat, useAlpha, ignoreVertexColors); } - + native void disableGlobalAlpha(long ctx, GeometryArrayRetained geo, int vformat, boolean useAlpha, boolean ignoreVertexColors); - + void disableGlobalAlpha(Context ctx, GeometryArrayRetained geo, int vformat, boolean useAlpha, boolean ignoreVertexColors) { disableGlobalAlpha(unbox(ctx), geo, vformat, useAlpha, ignoreVertexColors); } - + // used for GeometryArrays native void buildGA(long ctx, GeometryArrayRetained geo, int geo_type, @@ -605,7 +605,7 @@ class NativePipeline extends Pipeline { int vertexAttrCount, int[] vertexAttrSizes, double[] xform, double[] nxform, float[] varray); - + void buildGA(Context ctx, GeometryArrayRetained geo, int geo_type, boolean isNonUniformScale, boolean updateAlpha, @@ -631,7 +631,7 @@ class NativePipeline extends Pipeline { xform, nxform, varray); } - + // used to Build Dlist GeometryArray by Reference with java arrays native void buildGAForByRef(long ctx, GeometryArrayRetained geo, int geo_type, @@ -650,7 +650,7 @@ class NativePipeline extends Pipeline { int[] texcoordoffset, int[] texIndex, int texstride, Object[] texCoords, double[] xform, double[] nxform); - + void buildGAForByRef(Context ctx, GeometryArrayRetained geo, int geo_type, boolean isNonUniformScale, boolean updateAlpha, @@ -686,13 +686,13 @@ class NativePipeline extends Pipeline { texIndex, texstride, texCoords, xform, nxform); } - + // --------------------------------------------------------------------- - + // // IndexedGeometryArrayRetained methods // - + // by-copy or interleaved, by reference, Java arrays native void executeIndexedGeometry(long ctx, GeometryArrayRetained geo, int geo_type, @@ -710,7 +710,7 @@ class NativePipeline extends Pipeline { float[] varray, float[] cdata, int cdirty, int[] indexCoord); - + void executeIndexedGeometry(Context ctx, GeometryArrayRetained geo, int geo_type, boolean isNonUniformScale, @@ -744,7 +744,7 @@ class NativePipeline extends Pipeline { cdirty, indexCoord); } - + // interleaved, by reference, nio buffer native void executeIndexedGeometryBuffer(long ctx, GeometryArrayRetained geo, int geo_type, @@ -761,7 +761,7 @@ class NativePipeline extends Pipeline { Object varray, float[] cdata, int cdirty, int[] indexCoord); - + void executeIndexedGeometryBuffer(Context ctx, GeometryArrayRetained geo, int geo_type, boolean isNonUniformScale, @@ -793,7 +793,7 @@ class NativePipeline extends Pipeline { cdirty, indexCoord); } - + // non interleaved, by reference, Java arrays native void executeIndexedGeometryVA(long ctx, GeometryArrayRetained geo, int geo_type, @@ -815,7 +815,7 @@ class NativePipeline extends Pipeline { int texstride, Object[] texCoords, int cdirty, int[] indexCoord); - + void executeIndexedGeometryVA(Context ctx, GeometryArrayRetained geo, int geo_type, boolean isNonUniformScale, @@ -857,7 +857,7 @@ class NativePipeline extends Pipeline { cdirty, indexCoord); } - + // non interleaved, by reference, nio buffer native void executeIndexedGeometryVABuffer(long ctx, GeometryArrayRetained geo, int geo_type, @@ -880,7 +880,7 @@ class NativePipeline extends Pipeline { int texstride, Object[] texCoords, int cdirty, int[] indexCoord); - + void executeIndexedGeometryVABuffer(Context ctx, GeometryArrayRetained geo, int geo_type, boolean isNonUniformScale, @@ -924,7 +924,7 @@ class NativePipeline extends Pipeline { cdirty, indexCoord); } - + // by-copy geometry native void buildIndexedGeometry(long ctx, GeometryArrayRetained geo, int geo_type, @@ -941,7 +941,7 @@ class NativePipeline extends Pipeline { int[] texCoordSetMapOffset, double[] xform, double[] nxform, float[] varray, int[] indexCoord); - + void buildIndexedGeometry(Context ctx, GeometryArrayRetained geo, int geo_type, boolean isNonUniformScale, boolean updateAlpha, @@ -973,14 +973,14 @@ class NativePipeline extends Pipeline { xform, nxform, varray, indexCoord); } - - + + // --------------------------------------------------------------------- - + // // GraphicsContext3D methods // - + native void readRaster(long ctx, int type, int xSrcOffset, int ySrcOffset, int width, int height, int hCanvas, @@ -989,7 +989,7 @@ class NativePipeline extends Pipeline { Object imageBuffer, int depthFormat, Object depthBuffer); - + void readRaster(Context ctx, int type, int xSrcOffset, int ySrcOffset, int width, int height, int hCanvas, @@ -1001,24 +1001,24 @@ class NativePipeline extends Pipeline { readRaster(unbox(ctx), type, xSrcOffset, ySrcOffset, width, height, hCanvas, - imageDataType, + imageDataType, imageFormat, imageBuffer, depthFormat, depthBuffer); - } - + } + // --------------------------------------------------------------------- - + // // CgShaderProgramRetained methods // - + // ShaderAttributeValue methods - + native ShaderError setCgUniform1i(long ctx, long shaderProgramId, long uniformLocation, int value); - + ShaderError setCgUniform1i(Context ctx, ShaderProgramId shaderProgramId, ShaderAttrLoc uniformLocation, @@ -1028,12 +1028,12 @@ class NativePipeline extends Pipeline { unbox(uniformLocation), value); } - + native ShaderError setCgUniform1f(long ctx, long shaderProgramId, long uniformLocation, float value); - + ShaderError setCgUniform1f(Context ctx, ShaderProgramId shaderProgramId, ShaderAttrLoc uniformLocation, @@ -1043,12 +1043,12 @@ class NativePipeline extends Pipeline { unbox(uniformLocation), value); } - + native ShaderError setCgUniform2i(long ctx, long shaderProgramId, long uniformLocation, int[] value); - + ShaderError setCgUniform2i(Context ctx, ShaderProgramId shaderProgramId, ShaderAttrLoc uniformLocation, @@ -1058,12 +1058,12 @@ class NativePipeline extends Pipeline { unbox(uniformLocation), value); } - + native ShaderError setCgUniform2f(long ctx, long shaderProgramId, long uniformLocation, float[] value); - + ShaderError setCgUniform2f(Context ctx, ShaderProgramId shaderProgramId, ShaderAttrLoc uniformLocation, @@ -1073,12 +1073,12 @@ class NativePipeline extends Pipeline { unbox(uniformLocation), value); } - + native ShaderError setCgUniform3i(long ctx, long shaderProgramId, long uniformLocation, int[] value); - + ShaderError setCgUniform3i(Context ctx, ShaderProgramId shaderProgramId, ShaderAttrLoc uniformLocation, @@ -1088,12 +1088,12 @@ class NativePipeline extends Pipeline { unbox(uniformLocation), value); } - + native ShaderError setCgUniform3f(long ctx, long shaderProgramId, long uniformLocation, float[] value); - + ShaderError setCgUniform3f(Context ctx, ShaderProgramId shaderProgramId, ShaderAttrLoc uniformLocation, @@ -1103,12 +1103,12 @@ class NativePipeline extends Pipeline { unbox(uniformLocation), value); } - + native ShaderError setCgUniform4i(long ctx, long shaderProgramId, long uniformLocation, int[] value); - + ShaderError setCgUniform4i(Context ctx, ShaderProgramId shaderProgramId, ShaderAttrLoc uniformLocation, @@ -1118,12 +1118,12 @@ class NativePipeline extends Pipeline { unbox(uniformLocation), value); } - + native ShaderError setCgUniform4f(long ctx, long shaderProgramId, long uniformLocation, float[] value); - + ShaderError setCgUniform4f(Context ctx, ShaderProgramId shaderProgramId, ShaderAttrLoc uniformLocation, @@ -1133,12 +1133,12 @@ class NativePipeline extends Pipeline { unbox(uniformLocation), value); } - + native ShaderError setCgUniformMatrix3f(long ctx, long shaderProgramId, long uniformLocation, float[] value); - + ShaderError setCgUniformMatrix3f(Context ctx, ShaderProgramId shaderProgramId, ShaderAttrLoc uniformLocation, @@ -1148,12 +1148,12 @@ class NativePipeline extends Pipeline { unbox(uniformLocation), value); } - + native ShaderError setCgUniformMatrix4f(long ctx, long shaderProgramId, long uniformLocation, float[] value); - + ShaderError setCgUniformMatrix4f(Context ctx, ShaderProgramId shaderProgramId, ShaderAttrLoc uniformLocation, @@ -1163,15 +1163,15 @@ class NativePipeline extends Pipeline { unbox(uniformLocation), value); } - + // ShaderAttributeArray methods - + native ShaderError setCgUniform1iArray(long ctx, long shaderProgramId, long uniformLocation, int numElements, int[] value); - + ShaderError setCgUniform1iArray(Context ctx, ShaderProgramId shaderProgramId, ShaderAttrLoc uniformLocation, @@ -1183,13 +1183,13 @@ class NativePipeline extends Pipeline { numElements, value); } - + native ShaderError setCgUniform1fArray(long ctx, long shaderProgramId, long uniformLocation, int numElements, float[] value); - + ShaderError setCgUniform1fArray(Context ctx, ShaderProgramId shaderProgramId, ShaderAttrLoc uniformLocation, @@ -1201,13 +1201,13 @@ class NativePipeline extends Pipeline { numElements, value); } - + native ShaderError setCgUniform2iArray(long ctx, long shaderProgramId, long uniformLocation, int numElements, int[] value); - + ShaderError setCgUniform2iArray(Context ctx, ShaderProgramId shaderProgramId, ShaderAttrLoc uniformLocation, @@ -1219,13 +1219,13 @@ class NativePipeline extends Pipeline { numElements, value); } - + native ShaderError setCgUniform2fArray(long ctx, long shaderProgramId, long uniformLocation, int numElements, float[] value); - + ShaderError setCgUniform2fArray(Context ctx, ShaderProgramId shaderProgramId, ShaderAttrLoc uniformLocation, @@ -1237,13 +1237,13 @@ class NativePipeline extends Pipeline { numElements, value); } - + native ShaderError setCgUniform3iArray(long ctx, long shaderProgramId, long uniformLocation, int numElements, int[] value); - + ShaderError setCgUniform3iArray(Context ctx, ShaderProgramId shaderProgramId, ShaderAttrLoc uniformLocation, @@ -1255,13 +1255,13 @@ class NativePipeline extends Pipeline { numElements, value); } - + native ShaderError setCgUniform3fArray(long ctx, long shaderProgramId, long uniformLocation, int numElements, float[] value); - + ShaderError setCgUniform3fArray(Context ctx, ShaderProgramId shaderProgramId, ShaderAttrLoc uniformLocation, @@ -1273,13 +1273,13 @@ class NativePipeline extends Pipeline { numElements, value); } - + native ShaderError setCgUniform4iArray(long ctx, long shaderProgramId, long uniformLocation, int numElements, int[] value); - + ShaderError setCgUniform4iArray(Context ctx, ShaderProgramId shaderProgramId, ShaderAttrLoc uniformLocation, @@ -1291,13 +1291,13 @@ class NativePipeline extends Pipeline { numElements, value); } - + native ShaderError setCgUniform4fArray(long ctx, long shaderProgramId, long uniformLocation, int numElements, float[] value); - + ShaderError setCgUniform4fArray(Context ctx, ShaderProgramId shaderProgramId, ShaderAttrLoc uniformLocation, @@ -1309,13 +1309,13 @@ class NativePipeline extends Pipeline { numElements, value); } - + native ShaderError setCgUniformMatrix3fArray(long ctx, long shaderProgramId, long uniformLocation, int numElements, float[] value); - + ShaderError setCgUniformMatrix3fArray(Context ctx, ShaderProgramId shaderProgramId, ShaderAttrLoc uniformLocation, @@ -1327,13 +1327,13 @@ class NativePipeline extends Pipeline { numElements, value); } - + native ShaderError setCgUniformMatrix4fArray(long ctx, long shaderProgramId, long uniformLocation, int numElements, float[] value); - + ShaderError setCgUniformMatrix4fArray(Context ctx, ShaderProgramId shaderProgramId, ShaderAttrLoc uniformLocation, @@ -1345,50 +1345,50 @@ class NativePipeline extends Pipeline { numElements, value); } - + // Native interfaces for shader compilation, etc. native ShaderError createCgShader(long ctx, int shaderType, long[] shaderId); - + ShaderError createCgShader(Context ctx, int shaderType, ShaderId[] shaderId) { long[] nativeId = new long[1]; ShaderError err = createCgShader(unbox(ctx), shaderType, nativeId); shaderId[0] = boxShaderId(nativeId[0]); return err; } - + native ShaderError destroyCgShader(long ctx, long shaderId); - + ShaderError destroyCgShader(Context ctx, ShaderId shaderId) { return destroyCgShader(unbox(ctx), unbox(shaderId)); } - + native ShaderError compileCgShader(long ctx, long shaderId, String program); - + ShaderError compileCgShader(Context ctx, ShaderId shaderId, String program) { return compileCgShader(unbox(ctx), unbox(shaderId), program); } - + native ShaderError createCgShaderProgram(long ctx, long[] shaderProgramId); - + ShaderError createCgShaderProgram(Context ctx, ShaderProgramId[] shaderProgramId) { long[] nativeId = new long[1]; ShaderError err = createCgShaderProgram(unbox(ctx), nativeId); shaderProgramId[0] = boxShaderProgramId(nativeId[0]); return err; } - + native ShaderError destroyCgShaderProgram(long ctx, long shaderProgramId); - + ShaderError destroyCgShaderProgram(Context ctx, ShaderProgramId shaderProgramId) { return destroyCgShaderProgram(unbox(ctx), unbox(shaderProgramId)); } - + native ShaderError linkCgShaderProgram(long ctx, long shaderProgramId, long[] shaderIds); - + ShaderError linkCgShaderProgram(Context ctx, ShaderProgramId shaderProgramId, ShaderId[] shaderIds) { - + assert shaderIds != null; long[] nativeIds = new long[shaderIds.length]; for (int i = 0; i < shaderIds.length; i++) { @@ -1397,24 +1397,24 @@ class NativePipeline extends Pipeline { return linkCgShaderProgram(unbox(ctx), unbox(shaderProgramId), nativeIds); } - + native void lookupCgVertexAttrNames(long ctx, long shaderProgramId, int numAttrNames, String[] attrNames, boolean[] errArr); - + void lookupCgVertexAttrNames(Context ctx, ShaderProgramId shaderProgramId, int numAttrNames, String[] attrNames, boolean[] errArr) { lookupCgVertexAttrNames(unbox(ctx), unbox(shaderProgramId), numAttrNames, attrNames, errArr); } - + native void lookupCgShaderAttrNames(long ctx, long shaderProgramId, int numAttrNames, String[] attrNames, long[] locArr, int[] typeArr, int[] sizeArr, boolean[] isArrayArr); - + void lookupCgShaderAttrNames(Context ctx, ShaderProgramId shaderProgramId, int numAttrNames, String[] attrNames, ShaderAttrLoc[] locArr, int[] typeArr, int[] sizeArr, boolean[] isArrayArr) { - + assert numAttrNames == locArr.length; long[] nativeLocArr = new long[numAttrNames]; for (int i = 0; i < numAttrNames; i++) { @@ -1428,26 +1428,26 @@ class NativePipeline extends Pipeline { locArr[i] = boxShaderAttrLoc(nativeLocArr[i]); } } - + native ShaderError useCgShaderProgram(long ctx, long shaderProgramId); - + ShaderError useCgShaderProgram(Context ctx, ShaderProgramId shaderProgramId) { return useCgShaderProgram(unbox(ctx), unbox(shaderProgramId)); } - + // --------------------------------------------------------------------- - + // // GLSLShaderProgramRetained methods // - + // ShaderAttributeValue methods - + native ShaderError setGLSLUniform1i(long ctx, long shaderProgramId, long uniformLocation, int value); - + ShaderError setGLSLUniform1i(Context ctx, ShaderProgramId shaderProgramId, ShaderAttrLoc uniformLocation, @@ -1457,12 +1457,12 @@ class NativePipeline extends Pipeline { unbox(uniformLocation), value); } - + native ShaderError setGLSLUniform1f(long ctx, long shaderProgramId, long uniformLocation, float value); - + ShaderError setGLSLUniform1f(Context ctx, ShaderProgramId shaderProgramId, ShaderAttrLoc uniformLocation, @@ -1472,12 +1472,12 @@ class NativePipeline extends Pipeline { unbox(uniformLocation), value); } - + native ShaderError setGLSLUniform2i(long ctx, long shaderProgramId, long uniformLocation, int[] value); - + ShaderError setGLSLUniform2i(Context ctx, ShaderProgramId shaderProgramId, ShaderAttrLoc uniformLocation, @@ -1487,12 +1487,12 @@ class NativePipeline extends Pipeline { unbox(uniformLocation), value); } - + native ShaderError setGLSLUniform2f(long ctx, long shaderProgramId, long uniformLocation, float[] value); - + ShaderError setGLSLUniform2f(Context ctx, ShaderProgramId shaderProgramId, ShaderAttrLoc uniformLocation, @@ -1502,12 +1502,12 @@ class NativePipeline extends Pipeline { unbox(uniformLocation), value); } - + native ShaderError setGLSLUniform3i(long ctx, long shaderProgramId, long uniformLocation, int[] value); - + ShaderError setGLSLUniform3i(Context ctx, ShaderProgramId shaderProgramId, ShaderAttrLoc uniformLocation, @@ -1517,12 +1517,12 @@ class NativePipeline extends Pipeline { unbox(uniformLocation), value); } - + native ShaderError setGLSLUniform3f(long ctx, long shaderProgramId, long uniformLocation, float[] value); - + ShaderError setGLSLUniform3f(Context ctx, ShaderProgramId shaderProgramId, ShaderAttrLoc uniformLocation, @@ -1532,12 +1532,12 @@ class NativePipeline extends Pipeline { unbox(uniformLocation), value); } - + native ShaderError setGLSLUniform4i(long ctx, long shaderProgramId, long uniformLocation, int[] value); - + ShaderError setGLSLUniform4i(Context ctx, ShaderProgramId shaderProgramId, ShaderAttrLoc uniformLocation, @@ -1547,12 +1547,12 @@ class NativePipeline extends Pipeline { unbox(uniformLocation), value); } - + native ShaderError setGLSLUniform4f(long ctx, long shaderProgramId, long uniformLocation, float[] value); - + ShaderError setGLSLUniform4f(Context ctx, ShaderProgramId shaderProgramId, ShaderAttrLoc uniformLocation, @@ -1562,12 +1562,12 @@ class NativePipeline extends Pipeline { unbox(uniformLocation), value); } - + native ShaderError setGLSLUniformMatrix3f(long ctx, long shaderProgramId, long uniformLocation, float[] value); - + ShaderError setGLSLUniformMatrix3f(Context ctx, ShaderProgramId shaderProgramId, ShaderAttrLoc uniformLocation, @@ -1577,12 +1577,12 @@ class NativePipeline extends Pipeline { unbox(uniformLocation), value); } - + native ShaderError setGLSLUniformMatrix4f(long ctx, long shaderProgramId, long uniformLocation, float[] value); - + ShaderError setGLSLUniformMatrix4f(Context ctx, ShaderProgramId shaderProgramId, ShaderAttrLoc uniformLocation, @@ -1592,15 +1592,15 @@ class NativePipeline extends Pipeline { unbox(uniformLocation), value); } - + // ShaderAttributeArray methods - + native ShaderError setGLSLUniform1iArray(long ctx, long shaderProgramId, long uniformLocation, int numElements, int[] value); - + ShaderError setGLSLUniform1iArray(Context ctx, ShaderProgramId shaderProgramId, ShaderAttrLoc uniformLocation, @@ -1612,13 +1612,13 @@ class NativePipeline extends Pipeline { numElements, value); } - + native ShaderError setGLSLUniform1fArray(long ctx, long shaderProgramId, long uniformLocation, int numElements, float[] value); - + ShaderError setGLSLUniform1fArray(Context ctx, ShaderProgramId shaderProgramId, ShaderAttrLoc uniformLocation, @@ -1630,13 +1630,13 @@ class NativePipeline extends Pipeline { numElements, value); } - + native ShaderError setGLSLUniform2iArray(long ctx, long shaderProgramId, long uniformLocation, int numElements, int[] value); - + ShaderError setGLSLUniform2iArray(Context ctx, ShaderProgramId shaderProgramId, ShaderAttrLoc uniformLocation, @@ -1648,13 +1648,13 @@ class NativePipeline extends Pipeline { numElements, value); } - + native ShaderError setGLSLUniform2fArray(long ctx, long shaderProgramId, long uniformLocation, int numElements, float[] value); - + ShaderError setGLSLUniform2fArray(Context ctx, ShaderProgramId shaderProgramId, ShaderAttrLoc uniformLocation, @@ -1666,13 +1666,13 @@ class NativePipeline extends Pipeline { numElements, value); } - + native ShaderError setGLSLUniform3iArray(long ctx, long shaderProgramId, long uniformLocation, int numElements, int[] value); - + ShaderError setGLSLUniform3iArray(Context ctx, ShaderProgramId shaderProgramId, ShaderAttrLoc uniformLocation, @@ -1684,13 +1684,13 @@ class NativePipeline extends Pipeline { numElements, value); } - + native ShaderError setGLSLUniform3fArray(long ctx, long shaderProgramId, long uniformLocation, int numElements, float[] value); - + ShaderError setGLSLUniform3fArray(Context ctx, ShaderProgramId shaderProgramId, ShaderAttrLoc uniformLocation, @@ -1702,13 +1702,13 @@ class NativePipeline extends Pipeline { numElements, value); } - + native ShaderError setGLSLUniform4iArray(long ctx, long shaderProgramId, long uniformLocation, int numElements, int[] value); - + ShaderError setGLSLUniform4iArray(Context ctx, ShaderProgramId shaderProgramId, ShaderAttrLoc uniformLocation, @@ -1720,13 +1720,13 @@ class NativePipeline extends Pipeline { numElements, value); } - + native ShaderError setGLSLUniform4fArray(long ctx, long shaderProgramId, long uniformLocation, int numElements, float[] value); - + ShaderError setGLSLUniform4fArray(Context ctx, ShaderProgramId shaderProgramId, ShaderAttrLoc uniformLocation, @@ -1738,13 +1738,13 @@ class NativePipeline extends Pipeline { numElements, value); } - + native ShaderError setGLSLUniformMatrix3fArray(long ctx, long shaderProgramId, long uniformLocation, int numElements, float[] value); - + ShaderError setGLSLUniformMatrix3fArray(Context ctx, ShaderProgramId shaderProgramId, ShaderAttrLoc uniformLocation, @@ -1756,13 +1756,13 @@ class NativePipeline extends Pipeline { numElements, value); } - + native ShaderError setGLSLUniformMatrix4fArray(long ctx, long shaderProgramId, long uniformLocation, int numElements, float[] value); - + ShaderError setGLSLUniformMatrix4fArray(Context ctx, ShaderProgramId shaderProgramId, ShaderAttrLoc uniformLocation, @@ -1774,10 +1774,10 @@ class NativePipeline extends Pipeline { numElements, value); } - + // native interfaces for shader compilation, etc. native ShaderError createGLSLShader(long ctx, int shaderType, long[] shaderId); - + ShaderError createGLSLShader(Context ctx, int shaderType, ShaderId[] shaderId) { long[] nativeId = new long[1]; ShaderError err = createGLSLShader(unbox(ctx), shaderType, nativeId); @@ -1785,18 +1785,18 @@ class NativePipeline extends Pipeline { return err; } native ShaderError destroyGLSLShader(long ctx, long shaderId); - + ShaderError destroyGLSLShader(Context ctx, ShaderId shaderId) { return destroyGLSLShader(unbox(ctx), unbox(shaderId)); } native ShaderError compileGLSLShader(long ctx, long shaderId, String program); - + ShaderError compileGLSLShader(Context ctx, ShaderId shaderId, String program) { return compileGLSLShader(unbox(ctx), unbox(shaderId), program); } - + native ShaderError createGLSLShaderProgram(long ctx, long[] shaderProgramId); - + ShaderError createGLSLShaderProgram(Context ctx, ShaderProgramId[] shaderProgramId) { long[] nativeId = new long[1]; ShaderError err = createGLSLShaderProgram(unbox(ctx), nativeId); @@ -1804,13 +1804,13 @@ class NativePipeline extends Pipeline { return err; } native ShaderError destroyGLSLShaderProgram(long ctx, long shaderProgramId); - + ShaderError destroyGLSLShaderProgram(Context ctx, ShaderProgramId shaderProgramId) { return destroyGLSLShaderProgram(unbox(ctx), unbox(shaderProgramId)); } native ShaderError linkGLSLShaderProgram(long ctx, long shaderProgramId, long[] shaderId); - + ShaderError linkGLSLShaderProgram(Context ctx, ShaderProgramId shaderProgramId, ShaderId[] shaderIds) { assert shaderIds != null; @@ -1823,7 +1823,7 @@ class NativePipeline extends Pipeline { } native ShaderError bindGLSLVertexAttrName(long ctx, long shaderProgramId, String attrName, int attrIndex); - + ShaderError bindGLSLVertexAttrName(Context ctx, ShaderProgramId shaderProgramId, String attrName, int attrIndex) { return bindGLSLVertexAttrName(unbox(ctx), unbox(shaderProgramId), @@ -1832,11 +1832,11 @@ class NativePipeline extends Pipeline { native void lookupGLSLShaderAttrNames(long ctx, long shaderProgramId, int numAttrNames, String[] attrNames, long[] locArr, int[] typeArr, int[] sizeArr, boolean[] isArrayArr); - + void lookupGLSLShaderAttrNames(Context ctx, ShaderProgramId shaderProgramId, int numAttrNames, String[] attrNames, ShaderAttrLoc[] locArr, int[] typeArr, int[] sizeArr, boolean[] isArrayArr) { - + assert numAttrNames == locArr.length; long[] nativeLocArr = new long[numAttrNames]; for (int i = 0; i < numAttrNames; i++) { @@ -1850,36 +1850,36 @@ class NativePipeline extends Pipeline { locArr[i] = boxShaderAttrLoc(nativeLocArr[i]); } } - + native ShaderError useGLSLShaderProgram(long ctx, long shaderProgramId); - + ShaderError useGLSLShaderProgram(Context ctx, ShaderProgramId shaderProgramId) { return useGLSLShaderProgram(unbox(ctx), unbox(shaderProgramId)); } - - + + // --------------------------------------------------------------------- - + // // Renderer methods // - + native void cleanupRenderer(); - - + + // --------------------------------------------------------------------- - + // // ColoringAttributesRetained methods // - + native void updateColoringAttributes(long ctx, float dRed, float dGreen, float dBlue, float red, float green, float blue, float alpha, boolean lEnable, int shadeModel); - + void updateColoringAttributes(Context ctx, float dRed, float dGreen, float dBlue, float red, float green, float blue, @@ -1893,18 +1893,18 @@ class NativePipeline extends Pipeline { lEnable, shadeModel); } - - + + // --------------------------------------------------------------------- - + // // DirectionalLightRetained methods // - + native void updateDirectionalLight(long ctx, int lightSlot, float red, float green, float blue, float x, float y, float z); - + void updateDirectionalLight(Context ctx, int lightSlot, float red, float green, float blue, float x, float y, float z) { @@ -1912,19 +1912,19 @@ class NativePipeline extends Pipeline { lightSlot, red, green, blue, x, y, z); } - - + + // --------------------------------------------------------------------- - + // // PointLightRetained methods // - + native void updatePointLight(long ctx, int lightSlot, float red, float green, float blue, float ax, float ay, float az, float px, float py, float pz); - + void updatePointLight(Context ctx, int lightSlot, float red, float green, float blue, float ax, float ay, float az, @@ -1934,21 +1934,21 @@ class NativePipeline extends Pipeline { blue, ax, ay, az, px, py, pz); } - - + + // --------------------------------------------------------------------- - + // // SpotLightRetained methods // - + native void updateSpotLight(long ctx, int lightSlot, float red, float green, float blue, float ax, float ay, float az, float px, float py, float pz, float spreadAngle, float concentration, float dx, float dy, float dz); - + void updateSpotLight(Context ctx, int lightSlot, float red, float green, float blue, float ax, float ay, float az, @@ -1962,18 +1962,18 @@ class NativePipeline extends Pipeline { concentration, dx, dy, dz); } - - + + // --------------------------------------------------------------------- - + // // ExponentialFogRetained methods // - + native void updateExponentialFog(long ctx, float red, float green, float blue, float density); - + void updateExponentialFog(Context ctx, float red, float green, float blue, float density) { @@ -1981,18 +1981,18 @@ class NativePipeline extends Pipeline { red, green, blue, density); } - - + + // --------------------------------------------------------------------- - + // // LinearFogRetained methods // - + native void updateLinearFog(long ctx, float red, float green, float blue, double fdist, double bdist); - + void updateLinearFog(Context ctx, float red, float green, float blue, double fdist, double bdist) { @@ -2000,20 +2000,20 @@ class NativePipeline extends Pipeline { red, green, blue, fdist, bdist); } - - + + // --------------------------------------------------------------------- - + // // LineAttributesRetained methods // - + native void updateLineAttributes(long ctx, float lineWidth, int linePattern, int linePatternMask, int linePatternScaleFactor, boolean lineAntialiasing); - + void updateLineAttributes(Context ctx, float lineWidth, int linePattern, int linePatternMask, @@ -2025,14 +2025,14 @@ class NativePipeline extends Pipeline { linePatternScaleFactor, lineAntialiasing); } - - + + // --------------------------------------------------------------------- - + // // MaterialRetained methods // - + native void updateMaterial(long ctx, float red, float green, float blue, float alpha, float ared, float agreen, float ablue, @@ -2040,7 +2040,7 @@ class NativePipeline extends Pipeline { float dred, float dgreen, float dblue, float sred, float sgreen, float sblue, float shininess, int colorTarget, boolean enable); - + void updateMaterial(Context ctx, float red, float green, float blue, float alpha, float ared, float agreen, float ablue, @@ -2056,49 +2056,49 @@ class NativePipeline extends Pipeline { sred, sgreen, sblue, shininess, colorTarget, enable); } - - + + // --------------------------------------------------------------------- - + // // ModelClipRetained methods // - + native void updateModelClip(long ctx, int planeNum, boolean enableFlag, double A, double B, double C, double D); - + void updateModelClip(Context ctx, int planeNum, boolean enableFlag, double A, double B, double C, double D) { updateModelClip(unbox(ctx), planeNum, enableFlag, A, B, C, D); } - - + + // --------------------------------------------------------------------- - + // // PointAttributesRetained methods // - + native void updatePointAttributes(long ctx, float pointSize, boolean pointAntialiasing); - + void updatePointAttributes(Context ctx, float pointSize, boolean pointAntialiasing) { updatePointAttributes(unbox(ctx), pointSize, pointAntialiasing); } - - + + // --------------------------------------------------------------------- - + // // PolygonAttributesRetained methods // - + native void updatePolygonAttributes(long ctx, int polygonMode, int cullFace, boolean backFaceNormalFlip, float polygonOffset, float polygonOffsetFactor); - + void updatePolygonAttributes(Context ctx, int polygonMode, int cullFace, boolean backFaceNormalFlip, @@ -2110,14 +2110,14 @@ class NativePipeline extends Pipeline { polygonOffset, polygonOffsetFactor); } - - + + // --------------------------------------------------------------------- - + // // RenderingAttributesRetained methods // - + // TODO : Need to handle stencil operation on the native side -- Chien native void updateRenderingAttributes(long ctx, boolean depthBufferWriteEnableOverride, @@ -2132,7 +2132,7 @@ class NativePipeline extends Pipeline { int stencilFailOp, int stencilZFailOp, int stencilZPassOp, int stencilFunction, int stencilReferenceValue, int stencilCompareMask, int stencilWriteMask ); - + void updateRenderingAttributes(Context ctx, boolean depthBufferWriteEnableOverride, boolean depthBufferEnableOverride, @@ -2160,14 +2160,14 @@ class NativePipeline extends Pipeline { stencilFunction, stencilReferenceValue, stencilCompareMask, stencilWriteMask ); } - - + + // --------------------------------------------------------------------- - + // // TexCoordGenerationRetained methods // - + /** * This method updates the native context: * trans contains eyeTovworld transform in d3d @@ -2180,7 +2180,7 @@ class NativePipeline extends Pipeline { float planeRx, float planeRy, float planeRz, float planeRw, float planeQx, float planeQy, float planeQz, float planeQw, double[] trans); - + void updateTexCoordGeneration(Context ctx, boolean enable, int genMode, int format, float planeSx, float planeSy, float planeSz, float planeSw, @@ -2196,14 +2196,14 @@ class NativePipeline extends Pipeline { planeQx, planeQy, planeQz, planeQw, trans); } - - + + // --------------------------------------------------------------------- - + // // TransparencyAttributesRetained methods // - + native void updateTransparencyAttributes(long ctx, float alpha, int geometryType, int polygonMode, @@ -2211,7 +2211,7 @@ class NativePipeline extends Pipeline { int transparencyMode, int srcBlendFunction, int dstBlendFunction); - + void updateTransparencyAttributes(Context ctx, float alpha, int geometryType, int polygonMode, @@ -2227,20 +2227,20 @@ class NativePipeline extends Pipeline { srcBlendFunction, dstBlendFunction); } - - + + // --------------------------------------------------------------------- - + // // TextureAttributesRetained methods // - + native void updateTextureAttributes(long ctx, double[] transform, boolean isIdentity, int textureMode, int perspCorrectionMode, float red, float green, float blue, float alpha, int textureFormat); - + void updateTextureAttributes(Context ctx, double[] transform, boolean isIdentity, int textureMode, int perspCorrectionMode, float red, @@ -2252,7 +2252,7 @@ class NativePipeline extends Pipeline { green, blue, alpha, textureFormat); } - + native void updateRegisterCombiners(long ctx, double[] transform, boolean isIdentity, int textureMode, int perspCorrectionMode, float red, @@ -2262,7 +2262,7 @@ class NativePipeline extends Pipeline { int[] combineRgbSrc, int[] combineAlphaSrc, int[] combineRgbFcn, int[] combineAlphaFcn, int combineRgbScale, int combineAlphaScale); - + void updateRegisterCombiners(Context ctx, double[] transform, boolean isIdentity, int textureMode, int perspCorrectionMode, float red, @@ -2282,11 +2282,11 @@ class NativePipeline extends Pipeline { combineRgbFcn, combineAlphaFcn, combineRgbScale, combineAlphaScale); } - + native void updateTextureColorTable(long ctx, int numComponents, int colorTableSize, int[] colorTable); - + void updateTextureColorTable(Context ctx, int numComponents, int colorTableSize, int[] colorTable) { @@ -2294,13 +2294,13 @@ class NativePipeline extends Pipeline { colorTableSize, colorTable); } - + native void updateCombiner(long ctx, int combineRgbMode, int combineAlphaMode, int[] combineRgbSrc, int[] combineAlphaSrc, int[] combineRgbFcn, int[] combineAlphaFcn, int combineRgbScale, int combineAlphaScale); - + void updateCombiner(Context ctx, int combineRgbMode, int combineAlphaMode, int[] combineRgbSrc, int[] combineAlphaSrc, @@ -2312,41 +2312,41 @@ class NativePipeline extends Pipeline { combineRgbFcn, combineAlphaFcn, combineRgbScale, combineAlphaScale); } - - + + // --------------------------------------------------------------------- - + // // TextureUnitStateRetained methods // - + native void updateTextureUnitState(long ctx, int unitIndex, boolean enableFlag); - + void updateTextureUnitState(Context ctx, int unitIndex, boolean enableFlag) { updateTextureUnitState(unbox(ctx), unitIndex, enableFlag); } - - + + // --------------------------------------------------------------------- - + // // TextureRetained methods // Texture2DRetained methods // - + native void bindTexture2D(long ctx, int objectId, boolean enable); - + void bindTexture2D(Context ctx, int objectId, boolean enable) { bindTexture2D(unbox(ctx), objectId, enable); } - + native void updateTexture2DImage(long ctx, int numLevels, int level, int textureFormat, int imageFormat, int width, int height, int boundaryWidth, int imageDataType, Object data, boolean useAutoMipMap); - + void updateTexture2DImage(Context ctx, int numLevels, int level, int textureFormat, int imageFormat, @@ -2360,14 +2360,14 @@ class NativePipeline extends Pipeline { boundaryWidth, imageDataType, data, useAutoMipMap); } - + native void updateTexture2DSubImage(long ctx, int level, int xoffset, int yoffset, int textureFormat, int imageFormat, int imgXOffset, int imgYOffset, int tilew, int width, int height, int imageDataType, Object data, boolean useAutoMipMap); - + void updateTexture2DSubImage(Context ctx, int level, int xoffset, int yoffset, int textureFormat, int imageFormat, @@ -2381,11 +2381,11 @@ class NativePipeline extends Pipeline { tilew, width, height, imageDataType, data, useAutoMipMap); } - + native void updateTexture2DLodRange(long ctx, int baseLevel, int maximumLevel, float minimumLod, float maximumLod); - + void updateTexture2DLodRange(Context ctx, int baseLevel, int maximumLevel, float minimumLod, float maximumLod) { @@ -2393,11 +2393,11 @@ class NativePipeline extends Pipeline { baseLevel, maximumLevel, minimumLod, maximumLod); } - + native void updateTexture2DLodOffset(long ctx, float lodOffsetX, float lodOffsetY, float lodOffsetZ); - + void updateTexture2DLodOffset(Context ctx, float lodOffsetX, float lodOffsetY, float lodOffsetZ) { @@ -2405,12 +2405,12 @@ class NativePipeline extends Pipeline { lodOffsetX, lodOffsetY, lodOffsetZ); } - + native void updateTexture2DBoundary(long ctx, int boundaryModeS, int boundaryModeT, float boundaryRed, float boundaryGreen, float boundaryBlue, float boundaryAlpha); - + void updateTexture2DBoundary(Context ctx, int boundaryModeS, int boundaryModeT, float boundaryRed, float boundaryGreen, @@ -2420,20 +2420,20 @@ class NativePipeline extends Pipeline { boundaryRed, boundaryGreen, boundaryBlue, boundaryAlpha); } - + native void updateTexture2DFilterModes(long ctx, int minFilter, int magFilter); - + void updateTexture2DFilterModes(Context ctx, int minFilter, int magFilter) { updateTexture2DFilterModes(unbox(ctx), minFilter, magFilter); } - + native void updateTexture2DSharpenFunc(long ctx, int numSharpenTextureFuncPts, float[] sharpenTextureFuncPts); - + void updateTexture2DSharpenFunc(Context ctx, int numSharpenTextureFuncPts, float[] sharpenTextureFuncPts) { @@ -2441,11 +2441,11 @@ class NativePipeline extends Pipeline { numSharpenTextureFuncPts, sharpenTextureFuncPts); } - + native void updateTexture2DFilter4Func(long ctx, int numFilter4FuncPts, float[] filter4FuncPts); - + void updateTexture2DFilter4Func(Context ctx, int numFilter4FuncPts, float[] filter4FuncPts) { @@ -2453,33 +2453,33 @@ class NativePipeline extends Pipeline { numFilter4FuncPts, filter4FuncPts); } - + native void updateTexture2DAnisotropicFilter(long ctx, float degree); - + void updateTexture2DAnisotropicFilter(Context ctx, float degree) { updateTexture2DAnisotropicFilter(unbox(ctx), degree); } - - + + // --------------------------------------------------------------------- - + // // Texture3DRetained methods // - + native void bindTexture3D(long ctx, int objectId, boolean enable); - + void bindTexture3D(Context ctx, int objectId, boolean enable) { bindTexture3D(unbox(ctx), objectId, enable); } - + native void updateTexture3DImage(long ctx, int numLevels, int level, int textureFormat, int imageFormat, int width, int height, int depth, int boundaryWidth, int imageDataType, Object imageData, boolean useAutoMipMap); - + void updateTexture3DImage(Context ctx, int numLevels, int level, int textureFormat, int imageFormat, @@ -2493,7 +2493,7 @@ class NativePipeline extends Pipeline { boundaryWidth, imageDataType, imageData, useAutoMipMap); } - + native void updateTexture3DSubImage(long ctx, int level, int xoffset, int yoffset, int zoffset, @@ -2502,7 +2502,7 @@ class NativePipeline extends Pipeline { int tilew, int tileh, int width, int height, int depth, int imageDataType, Object imageData, boolean useAutoMipMap); - + void updateTexture3DSubImage(Context ctx, int level, int xoffset, int yoffset, int zoffset, @@ -2520,11 +2520,11 @@ class NativePipeline extends Pipeline { width, height, depth, imageDataType, imageData, useAutoMipMap); } - + native void updateTexture3DLodRange(long ctx, int baseLevel, int maximumLevel, float minimumLod, float maximumLod); - + void updateTexture3DLodRange(Context ctx, int baseLevel, int maximumLevel, float minimumLod, float maximumLod) { @@ -2532,11 +2532,11 @@ class NativePipeline extends Pipeline { baseLevel, maximumLevel, minimumLod, maximumLod); } - + native void updateTexture3DLodOffset(long ctx, float lodOffsetX, float lodOffsetY, float lodOffsetZ); - + void updateTexture3DLodOffset(Context ctx, float lodOffsetX, float lodOffsetY, float lodOffsetZ) { @@ -2544,14 +2544,14 @@ class NativePipeline extends Pipeline { lodOffsetX, lodOffsetY, lodOffsetZ); } - + native void updateTexture3DBoundary(long ctx, int boundaryModeS, int boundaryModeT, int boundaryModeR, float boundaryRed, float boundaryGreen, float boundaryBlue, float boundaryAlpha); - - + + void updateTexture3DBoundary(Context ctx, int boundaryModeS, int boundaryModeT, int boundaryModeR, float boundaryRed, @@ -2563,20 +2563,20 @@ class NativePipeline extends Pipeline { boundaryGreen, boundaryBlue, boundaryAlpha); } - + native void updateTexture3DFilterModes(long ctx, int minFilter, int magFilter); - + void updateTexture3DFilterModes(Context ctx, int minFilter, int magFilter) { updateTexture3DFilterModes(unbox(ctx), minFilter, magFilter); } - + native void updateTexture3DSharpenFunc(long ctx, int numSharpenTextureFuncPts, float[] sharpenTextureFuncPts); - + void updateTexture3DSharpenFunc(Context ctx, int numSharpenTextureFuncPts, float[] sharpenTextureFuncPts) { @@ -2584,11 +2584,11 @@ class NativePipeline extends Pipeline { numSharpenTextureFuncPts, sharpenTextureFuncPts); } - + native void updateTexture3DFilter4Func(long ctx, int numFilter4FuncPts, float[] filter4FuncPts); - + void updateTexture3DFilter4Func(Context ctx, int numFilter4FuncPts, float[] filter4FuncPts) { @@ -2596,33 +2596,33 @@ class NativePipeline extends Pipeline { numFilter4FuncPts, filter4FuncPts); } - + native void updateTexture3DAnisotropicFilter(long ctx, float degree); - + void updateTexture3DAnisotropicFilter(Context ctx, float degree) { updateTexture3DAnisotropicFilter(unbox(ctx), degree); } - - + + // --------------------------------------------------------------------- - + // // TextureCubeMapRetained methods // - + native void bindTextureCubeMap(long ctx, int objectId, boolean enable); - + void bindTextureCubeMap(Context ctx, int objectId, boolean enable) { bindTextureCubeMap(unbox(ctx), objectId, enable); } - + native void updateTextureCubeMapImage(long ctx, int face, int numLevels, int level, int textureFormat, int imageFormat, int width, int height, int boundaryWidth, int imageDataType, Object imageData, boolean useAutoMipMap); - + void updateTextureCubeMapImage(Context ctx, int face, int numLevels, int level, int textureFormat, int imageFormat, @@ -2636,14 +2636,14 @@ class NativePipeline extends Pipeline { boundaryWidth, imageDataType, imageData, useAutoMipMap); } - + native void updateTextureCubeMapSubImage(long ctx, int face, int level, int xoffset, int yoffset, int textureFormat, int imageFormat, int imgXOffset, int imgYOffset, int tilew, int width, int height, int imageDataType, Object imageData, boolean useAutoMipMap); - + void updateTextureCubeMapSubImage(Context ctx, int face, int level, int xoffset, int yoffset, int textureFormat, int imageFormat, @@ -2657,11 +2657,11 @@ class NativePipeline extends Pipeline { tilew, width, height, imageDataType, imageData, useAutoMipMap); } - + native void updateTextureCubeMapLodRange(long ctx, int baseLevel, int maximumLevel, float minimumLod, float maximumLod); - + void updateTextureCubeMapLodRange(Context ctx, int baseLevel, int maximumLevel, float minimumLod, float maximumLod) { @@ -2669,11 +2669,11 @@ class NativePipeline extends Pipeline { baseLevel, maximumLevel, minimumLod, maximumLod); } - + native void updateTextureCubeMapLodOffset(long ctx, float lodOffsetX, float lodOffsetY, float lodOffsetZ); - + void updateTextureCubeMapLodOffset(Context ctx, float lodOffsetX, float lodOffsetY, float lodOffsetZ) { @@ -2681,12 +2681,12 @@ class NativePipeline extends Pipeline { lodOffsetX, lodOffsetY, lodOffsetZ); } - + native void updateTextureCubeMapBoundary(long ctx, int boundaryModeS, int boundaryModeT, float boundaryRed, float boundaryGreen, float boundaryBlue, float boundaryAlpha); - + void updateTextureCubeMapBoundary(Context ctx, int boundaryModeS, int boundaryModeT, float boundaryRed, float boundaryGreen, @@ -2696,20 +2696,20 @@ class NativePipeline extends Pipeline { boundaryRed, boundaryGreen, boundaryBlue, boundaryAlpha); } - + native void updateTextureCubeMapFilterModes(long ctx, int minFilter, int magFilter); - + void updateTextureCubeMapFilterModes(Context ctx, int minFilter, int magFilter) { updateTextureCubeMapFilterModes(unbox(ctx), minFilter, magFilter); } - + native void updateTextureCubeMapSharpenFunc(long ctx, int numSharpenTextureFuncPts, float[] sharpenTextureFuncPts); - + void updateTextureCubeMapSharpenFunc(Context ctx, int numSharpenTextureFuncPts, float[] sharpenTextureFuncPts) { @@ -2717,11 +2717,11 @@ class NativePipeline extends Pipeline { numSharpenTextureFuncPts, sharpenTextureFuncPts); } - + native void updateTextureCubeMapFilter4Func(long ctx, int numFilter4FuncPts, float[] filter4FuncPts); - + void updateTextureCubeMapFilter4Func(Context ctx, int numFilter4FuncPts, float[] filter4FuncPts) { @@ -2729,309 +2729,309 @@ class NativePipeline extends Pipeline { numFilter4FuncPts, filter4FuncPts); } - + native void updateTextureCubeMapAnisotropicFilter(long ctx, float degree); - + void updateTextureCubeMapAnisotropicFilter(Context ctx, float degree) { updateTextureCubeMapAnisotropicFilter(unbox(ctx), degree); } - + // --------------------------------------------------------------------- - + // // MasterControl methods // - + // Method to return the AWT object native long getAWT(); - + // Method to initialize the native J3D library native boolean initializeJ3D(boolean disableXinerama); - + // Maximum lights supported by the native API native int getMaximumLights(); - - + + // --------------------------------------------------------------------- - + // // Canvas3D methods // - + // This is the native method for creating the underlying graphics context. native long createNewContext(Canvas3D cv, long display, long drawable, long fbConfig, long shareCtx, boolean isSharedCtx, boolean offScreen, boolean glslLibraryAvailable, boolean cgLibraryAvailable); - + // This is the native method for creating the underlying graphics context. Context createNewContext(Canvas3D cv, long display, Drawable drawable, long fbConfig, Context shareCtx, boolean isSharedCtx, boolean offScreen, boolean glslLibraryAvailable, boolean cgLibraryAvailable) { - + long nativeCtx = createNewContext(cv, display, unbox(drawable), fbConfig, unbox(shareCtx), isSharedCtx, offScreen, glslLibraryAvailable, cgLibraryAvailable); - + return boxContext(nativeCtx); } - + native void createQueryContext(Canvas3D cv, long display, long drawable, long fbConfig, boolean offScreen, int width, int height, boolean glslLibraryAvailable, boolean cgLibraryAvailable); - + void createQueryContext(Canvas3D cv, long display, Drawable drawable, long fbConfig, boolean offScreen, int width, int height, boolean glslLibraryAvailable, boolean cgLibraryAvailable) { - + createQueryContext(cv, display, unbox(drawable), fbConfig, offScreen, width, height, glslLibraryAvailable, cgLibraryAvailable); } - + // This is the native for creating offscreen buffer native long createOffScreenBuffer(Canvas3D cv, long ctx, long display, long fbConfig, int width, int height); - + Drawable createOffScreenBuffer(Canvas3D cv, Context ctx, long display, long fbConfig, int width, int height) { long nativeDrawable = createOffScreenBuffer(cv, unbox(ctx), display, fbConfig, width, height); return boxDrawable(nativeDrawable); } - + native void destroyOffScreenBuffer(Canvas3D cv, long ctx, long display, long fbConfig, long drawable); - + void destroyOffScreenBuffer(Canvas3D cv, Context ctx, long display, long fbConfig, Drawable drawable) { destroyOffScreenBuffer(cv, unbox(ctx), display, fbConfig, unbox(drawable)); } - + // This is the native for reading the image from the offscreen buffer native void readOffScreenBuffer(Canvas3D cv, long ctx, int format, int type, Object data, int width, int height); - + void readOffScreenBuffer(Canvas3D cv, Context ctx, int format, int type, Object data, int width, int height) { readOffScreenBuffer(cv, unbox(ctx), format, type, data, width, height); } - + // The native method for swapBuffers native int swapBuffers(Canvas3D cv, long ctx, long dpy, long drawable); - + int swapBuffers(Canvas3D cv, Context ctx, long dpy, Drawable drawable) { return swapBuffers(cv, unbox(ctx), dpy, unbox(drawable)); } - - + + // notify D3D that Canvas is resize native int resizeD3DCanvas(Canvas3D cv, long ctx); - + int resizeD3DCanvas(Canvas3D cv, Context ctx) { return resizeD3DCanvas(cv, unbox(ctx)); } - - + + // notify D3D to toggle between FullScreen and window mode native int toggleFullScreenMode(Canvas3D cv, long ctx); - + int toggleFullScreenMode(Canvas3D cv, Context ctx) { return toggleFullScreenMode(cv, unbox(ctx)); } - - + + // native method for setting Material when no material is present native void updateMaterialColor(long ctx, float r, float g, float b, float a); - + void updateMaterialColor(Context ctx, float r, float g, float b, float a) { updateMaterialColor(unbox(ctx), r, g, b, a); } - - + + native void destroyContext(long display, long drawable, long ctx); - + void destroyContext(long display, Drawable drawable, Context ctx) { assert display != 0 || VirtualUniverse.mc.isWindows(); assert ctx != null; assert drawable != null; destroyContext(display, unbox(drawable), unbox(ctx)); } - - + + // This is the native method for doing accumulation. native void accum(long ctx, float value); - + void accum(Context ctx, float value) { accum(unbox(ctx), value); } - - + + // This is the native method for doing accumulation return. native void accumReturn(long ctx); - + void accumReturn(Context ctx) { accumReturn(unbox(ctx)); } - - + + // This is the native method for clearing the accumulation buffer. native void clearAccum(long ctx); - + void clearAccum(Context ctx) { clearAccum(unbox(ctx)); } - - + + // This is the native method for getting the number of lights the underlying // native library can support. native int getNumCtxLights(long ctx); - + int getNumCtxLights(Context ctx) { return getNumCtxLights(unbox(ctx)); } - - + + // Native method for decal 1st child setup native boolean decal1stChildSetup(long ctx); - + boolean decal1stChildSetup(Context ctx) { return decal1stChildSetup(unbox(ctx)); } - - + + // Native method for decal nth child setup native void decalNthChildSetup(long ctx); - + void decalNthChildSetup(Context ctx) { decalNthChildSetup(unbox(ctx)); } - - + + // Native method for decal reset native void decalReset(long ctx, boolean depthBufferEnable); - + void decalReset(Context ctx, boolean depthBufferEnable) { decalReset(unbox(ctx), depthBufferEnable); } - - + + // Native method for decal reset native void ctxUpdateEyeLightingEnable(long ctx, boolean localEyeLightingEnable); - + void ctxUpdateEyeLightingEnable(Context ctx, boolean localEyeLightingEnable) { ctxUpdateEyeLightingEnable(unbox(ctx), localEyeLightingEnable); } - - + + // The following three methods are used in multi-pass case - + // native method for setting blend color native void setBlendColor(long ctx, float red, float green, float blue, float alpha); - + void setBlendColor(Context ctx, float red, float green, float blue, float alpha) { setBlendColor(unbox(ctx), red, green, blue, alpha); } - - + + // native method for setting blend func native void setBlendFunc(long ctx, int src, int dst); - + void setBlendFunc(Context ctx, int src, int dst) { setBlendFunc(unbox(ctx), src, dst); } - - + + // native method for setting fog enable flag native void setFogEnableFlag(long ctx, boolean enableFlag); - + void setFogEnableFlag(Context ctx, boolean enableFlag) { setFogEnableFlag(unbox(ctx), enableFlag); } - - + + // Setup the full scene antialising in D3D and ogl when GL_ARB_multisamle supported native void setFullSceneAntialiasing(long ctx, boolean enable); - + void setFullSceneAntialiasing(Context ctx, boolean enable) { setFullSceneAntialiasing(unbox(ctx), enable); } - - + + native void setGlobalAlpha(long ctx, float alpha); - + void setGlobalAlpha(Context ctx, float alpha) { setGlobalAlpha(unbox(ctx), alpha); } - - + + // Native method to update separate specular color control native void updateSeparateSpecularColorEnable(long ctx, boolean control); - + void updateSeparateSpecularColorEnable(Context ctx, boolean control) { updateSeparateSpecularColorEnable(unbox(ctx), control); } - - + + // Initialization for D3D when scene begin native void beginScene(long ctx); - + void beginScene(Context ctx) { beginScene(unbox(ctx)); } - + native void endScene(long ctx); - + void endScene(Context ctx) { endScene(unbox(ctx)); } - - + + // True under Solaris, // False under windows when display mode <= 8 bit native boolean validGraphicsMode(); - + // native method for setting light enables native void setLightEnables(long ctx, long enableMask, int maxLights); - + void setLightEnables(Context ctx, long enableMask, int maxLights) { setLightEnables(unbox(ctx), enableMask, maxLights); } - - + + // native method for setting scene ambient native void setSceneAmbient(long ctx, float red, float green, float blue); - + void setSceneAmbient(Context ctx, float red, float green, float blue) { setSceneAmbient(unbox(ctx), red, green, blue); } - - + + // native method for disabling fog native void disableFog(long ctx); - + void disableFog(Context ctx) { disableFog(unbox(ctx)); } - - + + // native method for disabling modelClip native void disableModelClip(long ctx); - + void disableModelClip(Context ctx) { disableModelClip(unbox(ctx)); } - - + + // native method for setting default RenderingAttributes native void resetRenderingAttributes(long ctx, boolean depthBufferWriteEnableOverride, boolean depthBufferEnableOverride); - + void resetRenderingAttributes(Context ctx, boolean depthBufferWriteEnableOverride, boolean depthBufferEnableOverride) { @@ -3039,69 +3039,69 @@ class NativePipeline extends Pipeline { depthBufferWriteEnableOverride, depthBufferEnableOverride); } - - + + // native method for setting default texture native void resetTextureNative(long ctx, int texUnitIndex); - + void resetTextureNative(Context ctx, int texUnitIndex) { resetTextureNative(unbox(ctx), texUnitIndex); } - - + + // native method for activating a particular texture unit native void activeTextureUnit(long ctx, int texUnitIndex); - + void activeTextureUnit(Context ctx, int texUnitIndex) { activeTextureUnit(unbox(ctx), texUnitIndex); } - - + + // native method for setting default TexCoordGeneration native void resetTexCoordGeneration(long ctx); - + void resetTexCoordGeneration(Context ctx) { resetTexCoordGeneration(unbox(ctx)); } - - + + // native method for setting default TextureAttributes native void resetTextureAttributes(long ctx); - + void resetTextureAttributes(Context ctx) { resetTextureAttributes(unbox(ctx)); } - - + + // native method for setting default PolygonAttributes native void resetPolygonAttributes(long ctx); - + void resetPolygonAttributes(Context ctx) { resetPolygonAttributes(unbox(ctx)); } - - + + // native method for setting default LineAttributes native void resetLineAttributes(long ctx); - + void resetLineAttributes(Context ctx) { resetLineAttributes(unbox(ctx)); } - - + + // native method for setting default PointAttributes native void resetPointAttributes(long ctx); - + void resetPointAttributes(Context ctx) { resetPointAttributes(unbox(ctx)); } - - + + // native method for setting default TransparencyAttributes native void resetTransparency(long ctx, int geometryType, int polygonMode, boolean lineAA, boolean pointAA); - + void resetTransparency(Context ctx, int geometryType, int polygonMode, boolean lineAA, boolean pointAA) { @@ -3109,14 +3109,14 @@ class NativePipeline extends Pipeline { polygonMode, lineAA, pointAA); } - - + + // native method for setting default ColoringAttributes native void resetColoringAttributes(long ctx, float r, float g, float b, float a, boolean enableLight); - + void resetColoringAttributes(Context ctx, float r, float g, float b, float a, @@ -3126,120 +3126,120 @@ class NativePipeline extends Pipeline { b, a, enableLight); } - + /** * This native method makes sure that the rendering for this canvas * gets done now. */ native void syncRender(long ctx, boolean wait); - + void syncRender(Context ctx, boolean wait) { syncRender(unbox(ctx), wait); } - - + + // The native method that sets this ctx to be the current one native boolean useCtx(long ctx, long display, long drawable); - + boolean useCtx(Context ctx, long display, Drawable drawable) { assert display != 0 || VirtualUniverse.mc.isWindows(); return useCtx(unbox(ctx), display, unbox(drawable)); } - + native void clear(long ctx, float r, float g, float b, boolean clearStencil); - + void clear(Context ctx, float r, float g, float b, boolean clearStencil) { clear(unbox(ctx), r, g, b, clearStencil); - + } - + native void textureFillBackground(long ctx, float texMinU, float texMaxU, float texMinV, float texMaxV, float mapMinX, float mapMaxX, float mapMinY, float mapMaxY, boolean useBiliearFilter); - + void textureFillBackground(Context ctx, float texMinU, float texMaxU, float texMinV, float texMaxV, float mapMinX, float mapMaxX, float mapMinY, float mapMaxY, boolean useBiliearFilter) { textureFillBackground(unbox(ctx), texMinU, texMaxU, texMinV, texMaxV, mapMinX, mapMaxX, mapMinY, mapMaxY, useBiliearFilter); } - + native void textureFillRaster(long ctx, float texMinU, float texMaxU, float texMinV, float texMaxV, - float mapMinX, float mapMaxX, float mapMinY, float mapMaxY, float mapZ, float alpha, + float mapMinX, float mapMaxX, float mapMinY, float mapMaxY, float mapZ, float alpha, boolean useBiliearFilter); - + void textureFillRaster(Context ctx, float texMinU, float texMaxU, float texMinV, float texMaxV, - float mapMinX, float mapMaxX, float mapMinY, float mapMaxY, float mapZ, float alpha, + float mapMinX, float mapMaxX, float mapMinY, float mapMaxY, float mapZ, float alpha, boolean useBiliearFilter) { textureFillRaster(unbox(ctx), texMinU, texMaxU, texMinV, texMaxV, mapMinX, mapMaxX, mapMinY, mapMaxY, mapZ, alpha, useBiliearFilter); } native void executeRasterDepth(long ctx, float posX, float posY, float posZ, - int srcOffsetX, int srcOffsetY, int rasterWidth, int rasterHeight, + int srcOffsetX, int srcOffsetY, int rasterWidth, int rasterHeight, int depthWidth, int depthHeight, int depthType, Object depthData); - + void executeRasterDepth(Context ctx, float posX, float posY, float posZ, - int srcOffsetX, int srcOffsetY, int rasterWidth, int rasterHeight, + int srcOffsetX, int srcOffsetY, int rasterWidth, int rasterHeight, int depthWidth, int depthHeight, int depthType, Object depthData) { executeRasterDepth(unbox(ctx), posX, posY, posZ, srcOffsetX, srcOffsetY, rasterWidth, rasterHeight, depthWidth, depthHeight, depthType, depthData); } - + // The native method for setting the ModelView matrix. native void setModelViewMatrix(long ctx, double[] viewMatrix, double[] modelMatrix); - + void setModelViewMatrix(Context ctx, double[] viewMatrix, double[] modelMatrix) { setModelViewMatrix(unbox(ctx), viewMatrix, modelMatrix); } - - + + // The native method for setting the Projection matrix. native void setProjectionMatrix(long ctx, double[] projMatrix); - + void setProjectionMatrix(Context ctx, double[] projMatrix) { setProjectionMatrix(unbox(ctx), projMatrix); } - - + + // The native method for setting the Viewport. native void setViewport(long ctx, int x, int y, int width, int height); - + void setViewport(Context ctx, int x, int y, int width, int height) { setViewport(unbox(ctx), x, y, width, height); } - - + + // used for display Lists native void newDisplayList(long ctx, int displayListId); - + void newDisplayList(Context ctx, int displayListId) { newDisplayList(unbox(ctx), displayListId); } - + native void endDisplayList(long ctx); - + void endDisplayList(Context ctx) { endDisplayList(unbox(ctx)); } - + native void callDisplayList(long ctx, int id, boolean isNonUniformScale); - + void callDisplayList(Context ctx, int id, boolean isNonUniformScale) { callDisplayList(unbox(ctx), id, isNonUniformScale); } - - + + native void freeDisplayList(long ctx, int id); - + void freeDisplayList(Context ctx, int id) { freeDisplayList(unbox(ctx), id); } - + native void freeTexture(long ctx, int id); - + void freeTexture(Context ctx, int id) { freeTexture(unbox(ctx), id); } - + native void texturemapping(long ctx, int px, int py, int xmin, int ymin, int xmax, int ymax, @@ -3248,7 +3248,7 @@ class NativePipeline extends Pipeline { int format, int objectId, byte[] image, int winWidth, int winHeight); - + void texturemapping(Context ctx, int px, int py, int xmin, int ymin, int xmax, int ymax, @@ -3266,47 +3266,47 @@ class NativePipeline extends Pipeline { image, winWidth, winHeight); } - - + + native boolean initTexturemapping(long ctx, int texWidth, int texHeight, int objectId); - + boolean initTexturemapping(Context ctx, int texWidth, int texHeight, int objectId) { return initTexturemapping(unbox(ctx), texWidth, texHeight, objectId); } - - - + + + // Set internal render mode to one of FIELD_ALL, FIELD_LEFT or // FIELD_RIGHT. Note that it is up to the caller to ensure that // stereo is available before setting the mode to FIELD_LEFT or // FIELD_RIGHT. The boolean isTRUE for double buffered mode, FALSE // foe single buffering. native void setRenderMode(long ctx, int mode, boolean doubleBuffer); - + void setRenderMode(Context ctx, int mode, boolean doubleBuffer) { setRenderMode(unbox(ctx), mode, doubleBuffer); } - - + + // Set glDepthMask. native void setDepthBufferWriteEnable(long ctx, boolean mode); - + void setDepthBufferWriteEnable(Context ctx, boolean mode) { setDepthBufferWriteEnable(unbox(ctx), mode); } - - - + + + // --------------------------------------------------------------------- - + // // Canvas3D / GraphicsConfigTemplate3D methods - logic dealing with // native graphics configuration or drawing surface // - + // Return a graphics config based on the one passed in. Note that we can // assert that the input config is non-null and was created from a // GraphicsConfigTemplate3D. @@ -3314,54 +3314,54 @@ class NativePipeline extends Pipeline { // an exception if one cannot be returned. GraphicsConfiguration getGraphicsConfig(GraphicsConfiguration gconfig) { //KCR: System.err.println("NativePipeline.getGraphicsConfig()"); - + // Just return the input graphics config return gconfig; } - + // Get the native FBconfig pointer long getFbConfig(GraphicsConfigInfo gcInfo) { long fbConfig = ((Long)gcInfo.getPrivateData()).longValue(); if (fbConfig == 0L) { throw new IllegalArgumentException(J3dI18N.getString("Canvas3D23")); } - + return fbConfig; } - + // Get best graphics config from pipeline GraphicsConfiguration getBestConfiguration(GraphicsConfigTemplate3D gct, GraphicsConfiguration[] gc) { return NativeConfigTemplate3D.getNativeConfigTemplate3D().getBestConfiguration(gct, gc); } - + // Determine whether specified graphics config is supported by pipeline boolean isGraphicsConfigSupported(GraphicsConfigTemplate3D gct, GraphicsConfiguration gc) { return NativeConfigTemplate3D.getNativeConfigTemplate3D().isGraphicsConfigSupported(gct, gc); } - + // Methods to get actual capabilities from Canvas3D boolean hasDoubleBuffer(Canvas3D cv) { return NativeConfigTemplate3D.getNativeConfigTemplate3D().hasDoubleBuffer(cv); } - + boolean hasStereo(Canvas3D cv) { return NativeConfigTemplate3D.getNativeConfigTemplate3D().hasStereo(cv); } - + int getStencilSize(Canvas3D cv) { return NativeConfigTemplate3D.getNativeConfigTemplate3D().getStencilSize(cv); } - + boolean hasSceneAntialiasingMultisample(Canvas3D cv) { return NativeConfigTemplate3D.getNativeConfigTemplate3D().hasSceneAntialiasingMultisample(cv); } - + boolean hasSceneAntialiasingAccum(Canvas3D cv) { return NativeConfigTemplate3D.getNativeConfigTemplate3D().hasSceneAntialiasingAccum(cv); } - + // Methods to get native WS display and screen long getDisplay() { return NativeScreenInfo.getNativeScreenInfo().getDisplay(); @@ -3369,21 +3369,21 @@ class NativePipeline extends Pipeline { int getScreen(GraphicsDevice graphicsDevice) { return NativeScreenInfo.getNativeScreenInfo().getScreen(graphicsDevice); } - + // --------------------------------------------------------------------- - + // // DrawingSurfaceObject methods // - + // Method to construct a new DrawingSurfaceObject DrawingSurfaceObject createDrawingSurfaceObject(Canvas3D cv) { return new DrawingSurfaceObjectAWT(cv, VirtualUniverse.mc.awt, cv.screen.display, cv.screen.screen, VirtualUniverse.mc.xineramaDisabled); } - - + + // Method to free the drawing surface object // (called from Canvas3D.removeNotify) void freeDrawingSurface(Canvas3D cv, DrawingSurfaceObject drawingSurfaceObject) { @@ -3398,11 +3398,11 @@ class NativePipeline extends Pipeline { MasterControl.FREE_DRAWING_SURFACE, ds_struct); } - + drawingSurfaceObject.invalidate(); } } - + // Method to free the native drawing surface object void freeDrawingSurfaceNative(Object o) { DrawingSurfaceObjectAWT.freeDrawingSurface(o); diff --git a/src/classes/share/javax/media/j3d/NioImageBuffer.java b/src/classes/share/javax/media/j3d/NioImageBuffer.java index 0625510..f2a61a6 100644 --- a/src/classes/share/javax/media/j3d/NioImageBuffer.java +++ b/src/classes/share/javax/media/j3d/NioImageBuffer.java @@ -45,7 +45,7 @@ import java.nio.IntBuffer; * * @see ImageComponent2D * @see ImageComponent3D - * + * * @since Java 3D 1.5 */ public class NioImageBuffer { @@ -251,7 +251,7 @@ public class NioImageBuffer { * The the byte order of the specified dataBuffer must match the native * byte order of the underlying platform. * For best performance, the NIO buffer should be a direct buffer. - * + * * @param dataBuffer an NIO buffer of the correct type (ByteBuffer or * IntBuffer) to match the imageType of this * NioImageBuffer. This method will create a new view of diff --git a/src/classes/share/javax/media/j3d/NnuId.java b/src/classes/share/javax/media/j3d/NnuId.java index 09d3d8b..92fa040 100644 --- a/src/classes/share/javax/media/j3d/NnuId.java +++ b/src/classes/share/javax/media/j3d/NnuId.java @@ -36,9 +36,9 @@ package javax.media.j3d; */ interface NnuId { - + abstract int equal(NnuId obj); abstract int getId(); - + } diff --git a/src/classes/share/javax/media/j3d/NnuIdManager.java b/src/classes/share/javax/media/j3d/NnuIdManager.java index bf0d43a..f8e9ff9 100644 --- a/src/classes/share/javax/media/j3d/NnuIdManager.java +++ b/src/classes/share/javax/media/j3d/NnuIdManager.java @@ -33,18 +33,18 @@ package javax.media.j3d; class NnuIdManager { static int nnuId = 0; - + final static int getId() { if(nnuId == Integer.MAX_VALUE) { nnuId = 0; } - + return nnuId++; } final static int equals(NnuId nnuIdArr[], NnuId key, int start, int end) { int mid; - + mid = start +((end - start)/ 2); if(nnuIdArr[mid] != null) { int test = key.equal(nnuIdArr[mid]); @@ -56,31 +56,31 @@ class NnuIdManager { else if(test == 0) { // Since id is not necessary unique, we've to do // some extra check. - + // check for equal reference. if(key == nnuIdArr[mid]) { - return mid; + return mid; } - + int temp = mid - 1; // Look to the left. while((temp >= start) && (key.equal(nnuIdArr[temp]) == 0)) { if(key == nnuIdArr[temp]) { - return temp; + return temp; } temp--; } - + // Look to the right. temp = mid + 1; while((temp < end) && (key.equal(nnuIdArr[temp]) == 0)) { if(key == nnuIdArr[temp]) { - return temp; + return temp; } temp++; } - - // Fail equal reference check. + + // Fail equal reference check. return -1; } else @@ -94,12 +94,12 @@ class NnuIdManager { int start, int end) { int mid; - + mid = start +((end - start)/ 2); if(nnuIdArr[mid] != null) { int test = key.equal(nnuIdArr[mid]); - + if(start != mid) { if(test < 0) { return equals(nnuIdArr, key, index, start, mid); @@ -113,22 +113,22 @@ class NnuIdManager { index[0] = mid; return false; } - else if(test > 0) { + else if(test > 0) { index[0] = mid+1; return false; } } - + // (test == 0) // Since id is not necessary unique, we've to do // some extra check. - + // check for equal reference. if(key == nnuIdArr[mid]) { index[0] = mid; return true; } - + int temp = mid - 1; // Look to the left. while((temp >= start) && (key.equal(nnuIdArr[temp]) == 0)) { @@ -138,7 +138,7 @@ class NnuIdManager { } temp--; } - + // Look to the right. temp = mid + 1; while((temp < end) && (key.equal(nnuIdArr[temp]) == 0)) { @@ -148,11 +148,11 @@ class NnuIdManager { } temp++; } - - // Fail equal reference check. + + // Fail equal reference check. index[0] = temp; return false; - + } // A null entry encountered. // But we still want to return the index where we encounter it. @@ -167,13 +167,13 @@ class NnuIdManager { quicksort(nnuIdArr, 0, nnuIdArr.length-1); } } - + // Insertion sort on smaller array final static void insertSort(NnuId nnuIdArr[]) { - - for (int i=0; i<nnuIdArr.length; i++) { - for (int j=i; j>0 && + + for (int i=0; i<nnuIdArr.length; i++) { + for (int j=i; j>0 && (nnuIdArr[j-1].getId() > nnuIdArr[j].getId()); j--) { NnuId temp = nnuIdArr[j]; nnuIdArr[j] = nnuIdArr[j-1]; @@ -186,7 +186,7 @@ class NnuIdManager { int i = l; int j = r; int k = nnuIdArr[(l+r) / 2].getId(); - + do { while (nnuIdArr[i].getId() < k) i++; while (k < nnuIdArr[j].getId()) j--; @@ -194,21 +194,21 @@ class NnuIdManager { NnuId tmp = nnuIdArr[i]; nnuIdArr[i] = nnuIdArr[j]; nnuIdArr[j] = tmp; - + i++; j--; } } while (i<=j); - + if (l<j) quicksort(nnuIdArr, l,j); if (l<r) quicksort(nnuIdArr, i,r); } - + // This method assumes that nnuIdArr0 and nnuIdArr1 are sorted. final static NnuId[] delete( NnuId nnuIdArr0[], NnuId nnuIdArr1[] ) { - + int i, index, len; int curStart =0, newStart =0; boolean found = false; @@ -217,7 +217,7 @@ class NnuIdManager { if(size > 0) { NnuId newNnuIdArr[] = new NnuId[size]; - + for (i = 0; i < nnuIdArr1.length; i++) { index = equals(nnuIdArr0, nnuIdArr1[i], 0, nnuIdArr0.length); @@ -269,24 +269,24 @@ class NnuIdManager { } - + // This method assumes that nnuIdArr0 and nnuIdArr1 are sorted. final static NnuId[] merge( NnuId nnuIdArr0[], NnuId nnuIdArr1[] ) { int index[] = new int[1]; int indexPlus1, blkSize, i, j; - + int size = nnuIdArr0.length + nnuIdArr1.length; - + NnuId newNnuIdArr[] = new NnuId[size]; - + // Copy the nnuIdArr0 data into the newly created newNnuIdArr. System.arraycopy(nnuIdArr0, 0, newNnuIdArr, 0, nnuIdArr0.length); - + for(i=nnuIdArr0.length, j=0; i<size; i++, j++) { // True or false, it doesn't matter. equals((NnuId[])newNnuIdArr, nnuIdArr1[j], index, 0, i); - + if(index[0] == i) { // Append to last. newNnuIdArr[i] = nnuIdArr1[j]; } @@ -298,17 +298,17 @@ class NnuIdManager { // This is the make room for the new data entry. System.arraycopy(newNnuIdArr, index[0], newNnuIdArr, indexPlus1, blkSize); - + newNnuIdArr[index[0]] = nnuIdArr1[j]; } - + } return newNnuIdArr; - + } - + final static void replace(NnuId oldObj, NnuId newObj, NnuId nnuIdArr[]) { @@ -324,7 +324,7 @@ class NnuIdManager { else if(index[0] >= 0) { blkSize = lenLess1 - index[0]; System.arraycopy(nnuIdArr, index[0]+1, - nnuIdArr, index[0], blkSize); + nnuIdArr, index[0], blkSize); nnuIdArr[lenLess1] = null; } else { @@ -333,7 +333,7 @@ class NnuIdManager { // insert new to nnuIdArr. equals(nnuIdArr, newObj, index, 0, lenLess1); - + if(index[0] == lenLess1) { // Append to last. nnuIdArr[index[0]] = newObj; } @@ -344,14 +344,14 @@ class NnuIdManager { // This is the make room for the new data entry. System.arraycopy(nnuIdArr, index[0], nnuIdArr, index[0]+1, blkSize); - + nnuIdArr[index[0]] = newObj; } - + } - + final static void printIds(NnuId nnuIdArr[]) { for(int i=0; i<nnuIdArr.length; i++) { System.err.println("[" + i +"] is " + nnuIdArr[i].getId()); diff --git a/src/classes/share/javax/media/j3d/Node.java b/src/classes/share/javax/media/j3d/Node.java index 4ef7363..56b0044 100644 --- a/src/classes/share/javax/media/j3d/Node.java +++ b/src/classes/share/javax/media/j3d/Node.java @@ -50,12 +50,12 @@ import java.lang.reflect.Constructor; public abstract class Node extends SceneGraphObject { /** - * Specifies that this Node will be reported in the pick - * SceneGraphPath if a pick occurs. This capability is only + * Specifies that this Node will be reported in the pick + * SceneGraphPath if a pick occurs. This capability is only * specifiable for Group nodes; it is ignored for leaf nodes. - * The default for Group nodes is false. All interior nodes not - * needed for uniqueness in a SceneGraphPath that don't have - * ENABLE_PICK_REPORTING set to true will not be reported in the + * The default for Group nodes is false. All interior nodes not + * needed for uniqueness in a SceneGraphPath that don't have + * ENABLE_PICK_REPORTING set to true will not be reported in the * SceneGraphPath. * @see SceneGraphPath */ @@ -63,15 +63,15 @@ public abstract class Node extends SceneGraphObject { ENABLE_PICK_REPORTING = CapabilityBits.NODE_ENABLE_PICK_REPORTING; /** - * Specifies that this Node will be reported in the collision + * Specifies that this Node will be reported in the collision * SceneGraphPath if a collision occurs. This capability is only * specifiable for Group nodes; it is ignored for leaf nodes. - * The default for Group nodes is false. All interior nodes not + * The default for Group nodes is false. All interior nodes not * needed for uniqueness in a SceneGraphPath that don't have * ENABLE_COLLISION_REPORTING set to true will not be reported * in the SceneGraphPath. * @see SceneGraphPath - */ + */ public static final int ENABLE_COLLISION_REPORTING = CapabilityBits.NODE_ENABLE_COLLISION_REPORTING; @@ -220,7 +220,7 @@ public abstract class Node extends SceneGraphObject { * scene graph */ public Bounds getBounds() { - + if (isLiveOrCompiled()) { if(!this.getCapability(ALLOW_BOUNDS_READ)) { throw new CapabilityNotSetException(J3dI18N.getString("Node2")); @@ -231,37 +231,37 @@ public abstract class Node extends SceneGraphObject { // a cycle checkForCycle(); } - + return ((NodeRetained)this.retained).getBounds(); } /** * Returns the collidable value; this value determines whether this node * and it's children, if a group node, can be considered for collision - * purposes; if it is set to false, then neither this node nor any + * purposes; if it is set to false, then neither this node nor any * children nodes will be traversed for collision purposes; the default - * value is true. The collidable setting is the way that an + * value is true. The collidable setting is the way that an * application can perform collision culling. * @return the present collidable value for this node - */ + */ public boolean getCollidable() { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_COLLIDABLE_READ)) - throw new CapabilityNotSetException(J3dI18N.getString("Node16")); + throw new CapabilityNotSetException(J3dI18N.getString("Node16")); return ((NodeRetained)retained).getCollidable(); } /** - * Sets the collidable value; determines whether this node and any of its + * Sets the collidable value; determines whether this node and any of its * children, if a group node, can be considered for collision purposes. * @param collidable the new collidable value for this node - */ + */ public void setCollidable( boolean collidable ) { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_COLLIDABLE_WRITE)) throw new CapabilityNotSetException(J3dI18N.getString("Node4")); - + ((NodeRetained)retained).setCollidable(collidable); } @@ -304,7 +304,7 @@ public abstract class Node extends SceneGraphObject { * calculated as if the graph was attached at the origin of a locale. * @param t the object that will receive the local coordinates to * Vworld coordinates transform. - * @exception RestrictedAccessException if the node is compiled but not + * @exception RestrictedAccessException if the node is compiled but not * part of a live scene graph * @exception CapabilityNotSetException if appropriate capability is * not set and this node is part of live or compiled scene graph @@ -316,12 +316,12 @@ public abstract class Node extends SceneGraphObject { if(!this.getCapability(ALLOW_LOCAL_TO_VWORLD_READ)) throw new CapabilityNotSetException(J3dI18N.getString("Node8")); } - + if (!isLive()) { // TODO Support compiled graphs if (isCompiled()) throw new RestrictedAccessException(J3dI18N.getString("Node7")); - + // In 1.4 we support getLocalToVworld for non live nodes ((NodeRetained)this.retained).computeNonLiveLocalToVworld(t, this); //throw new RestrictedAccessException(J3dI18N.getString("Node7")); @@ -329,7 +329,7 @@ public abstract class Node extends SceneGraphObject { ((NodeRetained)this.retained).getLocalToVworld(t); } } - + /** * Retrieves the local coordinates to virtual world coordinates @@ -354,13 +354,13 @@ public abstract class Node extends SceneGraphObject { public void getLocalToVworld(SceneGraphPath path, Transform3D t) { if (!isLive()) { throw new RestrictedAccessException(J3dI18N.getString("Node7")); - } - + } + if(!this.getCapability(ALLOW_LOCAL_TO_VWORLD_READ)) throw new CapabilityNotSetException(J3dI18N.getString("Node8")); ((NodeRetained)this.retained).getLocalToVworld(path,t); - + } /** @@ -463,7 +463,7 @@ public abstract class Node extends SceneGraphObject { * @return a reference to the cloned scene graph. * * @exception DanglingReferenceException When a dangling reference is - * discovered during the cloneTree operation and the + * discovered during the cloneTree operation and the * <code>allowDanglingReference</code> parameter is </code>false</code>. * @exception RestrictedAccessException if this object is part of live * or compiled scene graph @@ -474,8 +474,8 @@ public abstract class Node extends SceneGraphObject { */ public Node cloneTree(boolean forceDuplicate, boolean allowDanglingReferences) { - return cloneTree(new NodeReferenceTable(), - forceDuplicate, allowDanglingReferences); + return cloneTree(new NodeReferenceTable(), + forceDuplicate, allowDanglingReferences); } @@ -582,7 +582,7 @@ public abstract class Node extends SceneGraphObject { // a cycle checkForCycle(); } - + referenceTable.set(allowDanglingReferences, new Hashtable()); Node n = cloneTree(forceDuplicate, referenceTable.objectHashtable); @@ -629,9 +629,9 @@ public abstract class Node extends SceneGraphObject { this.nodeHashtable = null; throw e; } - // must reset to null so that we can tell whether the call is from user + // must reset to null so that we can tell whether the call is from user // or cloneTree - this.nodeHashtable = null; + this.nodeHashtable = null; nodeHashtable.put(this, l); return l; } @@ -639,7 +639,7 @@ public abstract class Node extends SceneGraphObject { /** * Used to create a new instance of the node. This routine is called - * by <code>cloneTree</code> to duplicate the current node. + * by <code>cloneTree</code> to duplicate the current node. * <code>cloneNode</code> should be overridden by any user subclassed * objects. All subclasses must have their <code>cloneNode</code> * method consist of the following lines: @@ -740,8 +740,8 @@ public abstract class Node extends SceneGraphObject { if (originalNode.nodeHashtable != null) { duplicateAttributes(originalNode, forceDuplicate); } else { - // user call cloneNode() or duplicateNode() directly - // instead of via cloneTree() + // user call cloneNode() or duplicateNode() directly + // instead of via cloneTree() originalNode.nodeHashtable = new Hashtable(); duplicateAttributes(originalNode, forceDuplicate); originalNode.nodeHashtable = null; @@ -754,7 +754,7 @@ public abstract class Node extends SceneGraphObject { * <code>originalNode</code> into * the current node. This method is called from the * <code>cloneNode</code> method which is, in turn, called by the - * <code>cloneTree</code> method.<P> + * <code>cloneTree</code> method.<P> * * @param originalNode the original node to duplicate. * @param forceDuplicate when set to <code>true</code>, causes the @@ -825,5 +825,5 @@ public abstract class Node extends SceneGraphObject { } visited = false; } - + } diff --git a/src/classes/share/javax/media/j3d/NodeComponent.java b/src/classes/share/javax/media/j3d/NodeComponent.java index f74ea55..5f5e27b 100644 --- a/src/classes/share/javax/media/j3d/NodeComponent.java +++ b/src/classes/share/javax/media/j3d/NodeComponent.java @@ -43,7 +43,7 @@ import java.util.Hashtable; public abstract class NodeComponent extends SceneGraphObject { // This is use for cloneTree only, set to false after the operation - boolean forceDuplicate = false; + boolean forceDuplicate = false; /** * Constructs a NodeComponent object with default parameters. * The default values are as follows: @@ -106,7 +106,7 @@ public abstract class NodeComponent extends SceneGraphObject { * originalNodeComponent, boolean forceDuplicate)</code> */ public void duplicateNodeComponent(NodeComponent originalNodeComponent) { - duplicateAttributes(originalNodeComponent, + duplicateAttributes(originalNodeComponent, originalNodeComponent.forceDuplicate); } @@ -114,7 +114,7 @@ public abstract class NodeComponent extends SceneGraphObject { * Copies all node information from <code>originalNodeComponent</code> into * the current node component. This method is called from subclass of * <code>duplicateNodeComponent</code> method which is, in turn, called by the - * <code>cloneNodeComponent</code> method. + * <code>cloneNodeComponent</code> method. * * For any <i>NodeComponent</i> objects * contained by the object being duplicated, each <i>NodeComponent</i> @@ -134,10 +134,10 @@ public abstract class NodeComponent extends SceneGraphObject { duplicateAttributes(originalNodeComponent, originalNodeComponent.forceDuplicate); } else { - // user call cloneNodeComponent() or duplicateNodeComponent() + // user call cloneNodeComponent() or duplicateNodeComponent() // directly instead of via cloneTree() originalNodeComponent.nodeHashtable = new Hashtable(); - duplicateAttributes(originalNodeComponent, + duplicateAttributes(originalNodeComponent, originalNodeComponent.forceDuplicate); originalNodeComponent.nodeHashtable = null; } @@ -182,9 +182,9 @@ public abstract class NodeComponent extends SceneGraphObject { /** * Used to create a new instance of a NodeComponent object. This - * routine is called by <code>cloneNode</code> to duplicate the + * routine is called by <code>cloneNode</code> to duplicate the * current node. <br> - * + * * <code>cloneNodeComponent</code> should be overridden by any user * subclassed <i>NodeComponent</i> objects. All subclasses must have their * <code>cloneNodeComponent</code> @@ -202,7 +202,7 @@ public abstract class NodeComponent extends SceneGraphObject { * <code>false</code>, the value of each node's * <code>duplicateOnCloneTree</code> variable determines whether * NodeComponent data is duplicated or copied. - * + * * @exception RestrictedAccessException if forceDuplicate is set and * this object is part of a compiled scenegraph * @@ -216,12 +216,12 @@ public abstract class NodeComponent extends SceneGraphObject { // For backward compatibility ! // // If user did not overwrite this procedure, it will fall back - // to call cloneNodeComponent() - // So for core API, + // to call cloneNodeComponent() + // So for core API, // don't implement cloneNodeComponent(boolean forceDuplicate) // otherwise this prcedure will not call and the user // cloneNodeComponent() will not invoke. - NodeComponent nc; + NodeComponent nc; this.forceDuplicate = forceDuplicate; try { nc = cloneNodeComponent(); @@ -239,7 +239,7 @@ public abstract class NodeComponent extends SceneGraphObject { * <code>originalNode</code> into * the current node. This method is called from the * <code>cloneNode</code> method which is, in turn, called by the - * <code>cloneTree</code> method.<P> + * <code>cloneTree</code> method.<P> * * @param originalNode the original node to duplicate. * @param forceDuplicate when set to <code>true</code>, causes the @@ -274,17 +274,17 @@ public abstract class NodeComponent extends SceneGraphObject { this.retained.setSource(this); } - /** + /** * This function is called from getNodeComponent() to see if any of - * the sub-NodeComponents duplicateOnCloneTree flag is true. - * If it is the case, current NodeComponent needs to - * duplicate also even though current duplicateOnCloneTree flag is false. + * the sub-NodeComponents duplicateOnCloneTree flag is true. + * If it is the case, current NodeComponent needs to + * duplicate also even though current duplicateOnCloneTree flag is false. * This should be overwrite by NodeComponent which contains sub-NodeComponent. */ boolean duplicateChild() { return getDuplicateOnCloneTree(); } - + /* * @exception IllegalSharingException if this NodeComponent is live and * the specified image is being used by a Canvas3D as an off-screen buffer. @@ -307,6 +307,6 @@ public abstract class NodeComponent extends SceneGraphObject { } } } - } - + } + } diff --git a/src/classes/share/javax/media/j3d/NodeComponentRetained.java b/src/classes/share/javax/media/j3d/NodeComponentRetained.java index 0c848e2..1a8c403 100644 --- a/src/classes/share/javax/media/j3d/NodeComponentRetained.java +++ b/src/classes/share/javax/media/j3d/NodeComponentRetained.java @@ -62,7 +62,7 @@ class NodeComponentRetained extends SceneGraphObjectRetained { // In the case of Appearance, its a bitmask of all components int changedFrequent = 0; int compChanged = 0; - + // Increment the refcount. If this is the first, mark it as live. void doSetLive(boolean inBackgroundGroup, int refCount) { int oldRefCount = this.refCount; @@ -85,7 +85,7 @@ class NodeComponentRetained extends SceneGraphObjectRetained { } } - + // Decrement the refcount. If this is the last, mark it as not live. void clearLive(int refCount) { @@ -176,7 +176,7 @@ class NodeComponentRetained extends SceneGraphObjectRetained { void setInImmCtx(boolean inCtx) { inImmCtx = inCtx; } - + /** * This gets the immedate mode context flag */ diff --git a/src/classes/share/javax/media/j3d/NodeComponentUpdate.java b/src/classes/share/javax/media/j3d/NodeComponentUpdate.java index 1f5502d..ad6408b 100644 --- a/src/classes/share/javax/media/j3d/NodeComponentUpdate.java +++ b/src/classes/share/javax/media/j3d/NodeComponentUpdate.java @@ -32,7 +32,7 @@ package javax.media.j3d; /** - * A Node Component Update interface. Any object that can be put in the + * A Node Component Update interface. Any object that can be put in the * node component updateCheck list must implement this interface. */ diff --git a/src/classes/share/javax/media/j3d/NodeReferenceTable.java b/src/classes/share/javax/media/j3d/NodeReferenceTable.java index a36370a..01ab7f4 100644 --- a/src/classes/share/javax/media/j3d/NodeReferenceTable.java +++ b/src/classes/share/javax/media/j3d/NodeReferenceTable.java @@ -49,11 +49,11 @@ import java.util.Hashtable; * <code>getNewObjectReference</code> method from this object to get updated * references to objects that have been duplicated in the new cloneTree * sub-graph. If a match is found, a - * reference to the corresponding SceneGraphObject in the newly cloned sub-graph + * reference to the corresponding SceneGraphObject in the newly cloned sub-graph * is returned. If no corresponding reference is found, either a * DanglingReferenceException is thrown by the <code>cloneTree</code> * method or a reference to the original - * SceneGraphObject is returned depending on the value of the + * SceneGraphObject is returned depending on the value of the * <code>allowDanglingReferences</code> parameter passed in the * <code>cloneTree</code> call. * @see SceneGraphObject#updateNodeReferences diff --git a/src/classes/share/javax/media/j3d/NodeRetained.java b/src/classes/share/javax/media/j3d/NodeRetained.java index 56847c4..cd4bbcf 100644 --- a/src/classes/share/javax/media/j3d/NodeRetained.java +++ b/src/classes/share/javax/media/j3d/NodeRetained.java @@ -78,19 +78,19 @@ abstract class NodeRetained extends SceneGraphObjectRetained implements NnuId { // traverse flags static final int CONTAINS_VIEWPLATFORM = 0x1; - + /** * The universe that we are in - */ + */ VirtualUniverse universe = null; - /** + /** * The locale that this node is attatched to. This is only non-null * if this instance is directly linked into a locale. */ Locale locale = null; - + /** * The node's parent. */ @@ -102,7 +102,7 @@ abstract class NodeRetained extends SceneGraphObjectRetained implements NnuId { String nodeId = null; /** - * An int that represents the nodes type. Used for quick if tests + * An int that represents the nodes type. Used for quick if tests * in the traverser. */ int nodeType; @@ -138,17 +138,17 @@ abstract class NodeRetained extends SceneGraphObjectRetained implements NnuId { // TransformGroupRetained Transform3D localToVworld[][] = null; int localToVworldIndex[][] = null; - + static final int LAST_LOCAL_TO_VWORLD = 0; static final int CURRENT_LOCAL_TO_VWORLD = 1; - // A parallel array to localToVworld. This is the keys for + // A parallel array to localToVworld. This is the keys for // localToVworld transforms in shared groups. HashKey localToVworldKeys[] = null; /** - * This boolean is true when the geometric bounds for the node is - * automatically updated + * This boolean is true when the geometric bounds for the node is + * automatically updated */ boolean boundsAutoCompute = true; @@ -158,7 +158,7 @@ abstract class NodeRetained extends SceneGraphObjectRetained implements NnuId { // Bounds set by the API Bounds apiBounds; - + protected Bounds cachedBounds=null; // Cached auto compute bounds, could we use localBounds ? protected boolean validCachedBounds = false; // Fix to Issue 514 /** @@ -167,13 +167,13 @@ abstract class NodeRetained extends SceneGraphObjectRetained implements NnuId { * For BranchGroup under a non-shared group this size of * branchGroupPaths is always 1. Otherwise, the size is equal to * the number of possible paths to reach this node. - * This variable is used to cached BranchGroup for fast picking. + * This variable is used to cached BranchGroup for fast picking. * For non BranchGroupRetained class this is a reference to * the previous BranchGroupRetained branchGroupPaths. */ ArrayList branchGroupPaths = new ArrayList(1); - // background node whose geometry branch contains this node + // background node whose geometry branch contains this node BackgroundRetained geometryBackground = null; // closest parent which is a TransformGroupRetained or sharedGroupRetained @@ -190,11 +190,11 @@ abstract class NodeRetained extends SceneGraphObjectRetained implements NnuId { // Id use for quick search. int nnuId; - + NodeRetained() { // Get a not necessary unique Id. nnuId = NnuIdManager.getId(); - + localBounds = new BoundingBox(); ((BoundingBox)localBounds).setUpper(-1.0, -1.0, -1.0); ((BoundingBox)localBounds).setLower( 1.0, 1.0, 1.0); @@ -221,7 +221,7 @@ abstract class NodeRetained extends SceneGraphObjectRetained implements NnuId { Bounds getLocalBounds(Bounds bounds) { return (Bounds)bounds.clone(); } - + /** * Sets the geometric bounds of a node. * @param bounds the bounding object for the node @@ -236,7 +236,7 @@ abstract class NodeRetained extends SceneGraphObjectRetained implements NnuId { localBounds.transform(staticTransform.transform); } } else { - if(localBounds != null) { + if(localBounds != null) { localBounds.set((Bounds)null); } else { @@ -251,7 +251,7 @@ abstract class NodeRetained extends SceneGraphObjectRetained implements NnuId { localBounds.transform(staticTransform.transform); } } else { - if(localBounds != null) { + if(localBounds != null) { localBounds.set((Bounds)null); } else { @@ -260,7 +260,7 @@ abstract class NodeRetained extends SceneGraphObjectRetained implements NnuId { } } } - + /** * Gets the bounding object of a node. * @return the node's bounding object @@ -275,43 +275,43 @@ abstract class NodeRetained extends SceneGraphObjectRetained implements NnuId { } } return b; - } - + } + Bounds getBounds() { return apiBounds; } - + /** * ONLY needed for SHAPE, MORPH, and LINK node type. * Compute the combine bounds of bounds and its localBounds. */ void computeCombineBounds(Bounds bounds) { // Do nothing except for Group, Shape3D, Morph, and Link node. - } - - + } + + /** * Sets the automatic calcuation of geometric bounds of a node. - * @param autoCompute is a boolean value indicating if automatic calcuation - * of bounds + * @param autoCompute is a boolean value indicating if automatic calcuation + * of bounds */ void setBoundsAutoCompute(boolean autoCompute) { if (this.boundsAutoCompute==autoCompute) { return; } - + this.boundsAutoCompute = autoCompute; dirtyBoundsCache(); - } - + } + /** * Gets the auto Compute flag for the geometric bounds. * @return the node's auto Compute flag for the geometric bounding object */ boolean getBoundsAutoCompute() { return boundsAutoCompute; - } - + } + /** * Replaces the specified parent by a new parent. * @param parent the new parent @@ -319,7 +319,7 @@ abstract class NodeRetained extends SceneGraphObjectRetained implements NnuId { void setParent(NodeRetained parent) { this.parent = parent; } - + /** * Returns the parent of the node. * @return the parent. @@ -339,39 +339,39 @@ abstract class NodeRetained extends SceneGraphObjectRetained implements NnuId { } } - - // Note : key will get modified in this method. + + // Note : key will get modified in this method. private void computeLocalToVworld( NodeRetained caller, NodeRetained nodeR, HashKey key, Transform3D l2Vw) { int i; - + // To handle localToVworld under a SG. - if(nodeR instanceof SharedGroupRetained) { + if(nodeR instanceof SharedGroupRetained) { // Get the immediate parent's id and remove last id from key. String nodeId = key.getLastNodeId(); - + SharedGroupRetained sgRetained = (SharedGroupRetained) nodeR; - + // Search for the right parent. for(i=0; i<sgRetained.parents.size(); i++) { - + if(nodeId.equals((String)(((NodeRetained) (sgRetained.parents.elementAt(i))).nodeId))) { // Found the right link. Now traverse upward. - + computeLocalToVworld(caller, (NodeRetained)(sgRetained.parents.elementAt(i)), key, l2Vw); - return; + return; } } // Problem ! throw new RuntimeException(J3dI18N.getString("NodeRetained4")); } else { - + NodeRetained nodeParentR =(NodeRetained)nodeR.getParent(); - + if(nodeParentR == null) { // Base case. It has to be a BG attached to a locale. if(((BranchGroupRetained)(nodeR)).locale != null) { @@ -380,14 +380,14 @@ abstract class NodeRetained extends SceneGraphObjectRetained implements NnuId { else { throw new RuntimeException(J3dI18N.getString("NodeRetained5")); } - } - else { + } + else { computeLocalToVworld(caller, (NodeRetained)nodeParentR, key, l2Vw); - + } - + } - + if((nodeR instanceof TransformGroupRetained) && (nodeR != caller)) { Transform3D t1 = new Transform3D(); ((TransformGroupRetained)(nodeR)).transform.getWithLock(t1); @@ -395,30 +395,30 @@ abstract class NodeRetained extends SceneGraphObjectRetained implements NnuId { } else if ((nodeR == caller) && (staticTransform != null)) { l2Vw.mul(staticTransform.transform); } - + return; - } - + } + /** * Compute the LocalToVworld of this node even though it is not live. We * assume the graph is attached at the origin of a locale */ void computeNonLiveLocalToVworld(Transform3D t, Node caller) { NodeRetained n = getParent(); - + if (n==null) t.setIdentity(); else n.computeNonLiveLocalToVworld(t, caller); - + if (this instanceof TransformGroupRetained && this.source!=caller) { Transform3D trans = new Transform3D(); ((TransformGroupRetained)this).getTransform(trans); t.mul(trans); } - + } - + /** * Get the localToVworld transform for a node. */ @@ -426,7 +426,7 @@ abstract class NodeRetained extends SceneGraphObjectRetained implements NnuId { if (inSharedGroup) { throw new IllegalSharingException(J3dI18N.getString("NodeRetained0")); } - + // Lock the object while writing into t. if (localToVworld == null) { t.setIdentity(); @@ -434,8 +434,8 @@ abstract class NodeRetained extends SceneGraphObjectRetained implements NnuId { computeLocalToVworld(this, this, null, t); } } - - + + /** * Get the localToVworld transform for a node. */ @@ -449,13 +449,13 @@ abstract class NodeRetained extends SceneGraphObjectRetained implements NnuId { computeLocalToVworld(this, this, key, t); } - + /** * Get the localToVworld transform for a node */ void getLocalToVworld(Transform3D t, HashKey key) { - HashKey newKey = new HashKey(key); - computeLocalToVworld(this, this, newKey, t); + HashKey newKey = new HashKey(key); + computeLocalToVworld(this, this, newKey, t); } @@ -476,7 +476,7 @@ abstract class NodeRetained extends SceneGraphObjectRetained implements NnuId { */ Transform3D getCurrentLocalToVworld() { - if (localToVworld != null) { + if (localToVworld != null) { return localToVworld[0][localToVworldIndex[0][CURRENT_LOCAL_TO_VWORLD]]; } else { return new Transform3D(); @@ -491,7 +491,7 @@ abstract class NodeRetained extends SceneGraphObjectRetained implements NnuId { Transform3D getCurrentLocalToVworld(HashKey key) { - if (localToVworld != null) { + if (localToVworld != null) { if (!inSharedGroup) { return localToVworld[0][localToVworldIndex[0][CURRENT_LOCAL_TO_VWORLD]]; } else { @@ -499,11 +499,11 @@ abstract class NodeRetained extends SceneGraphObjectRetained implements NnuId { if(i>= 0) { return localToVworld[i][localToVworldIndex[i][CURRENT_LOCAL_TO_VWORLD]]; } - } + } } return new Transform3D(); } - + /** * Get the last localToVworld transform for a node */ @@ -530,16 +530,16 @@ abstract class NodeRetained extends SceneGraphObjectRetained implements NnuId { if(i>= 0) { return localToVworld[i][localToVworldIndex[i][LAST_LOCAL_TO_VWORLD]]; } - } + } } return new Transform3D(); } // Do nothing for NodeRetained. void setAuxData(SetLiveState s, int index, int hkIndex) { - + } - + void setNodeData(SetLiveState s) { localToVworld = s.localToVworld; localToVworldIndex = s.localToVworldIndex; @@ -552,21 +552,21 @@ abstract class NodeRetained extends SceneGraphObjectRetained implements NnuId { parentSwitchLink = s.parentSwitchLink; } - + // set pickable, recursively update cache result void setPickable(boolean pickable) { if (this.pickable == pickable) return; this.pickable = pickable; - + if (source.isLive()) { synchronized(universe.sceneGraphLock) { boolean pick[]; if (!inSharedGroup) { pick = new boolean[1]; } else { - pick = new boolean[localToVworldKeys.length]; + pick = new boolean[localToVworldKeys.length]; } findPickableFlags(pick); @@ -595,14 +595,14 @@ abstract class NodeRetained extends SceneGraphObjectRetained implements NnuId { return; this.collidable = collidable; - + if (source.isLive()) { synchronized(universe.sceneGraphLock) { boolean collide[]; if (!inSharedGroup) { collide = new boolean[1]; } else { - collide = new boolean[localToVworldKeys.length]; + collide = new boolean[localToVworldKeys.length]; } findCollidableFlags(collide); @@ -648,7 +648,7 @@ abstract class NodeRetained extends SceneGraphObjectRetained implements NnuId { void doSetLive(SetLiveState s) { int i; int oldrefCount = refCount; - + refCount += s.refCount; if(!(locale == null || universe == s.universe)) throw new IllegalSharingException(J3dI18N.getString("NodeRetained3")); @@ -658,7 +658,7 @@ abstract class NodeRetained extends SceneGraphObjectRetained implements NnuId { locale = s.locale; inSharedGroup = s.inSharedGroup; - + if (oldrefCount <= 0) { if (listIdx == null) { universe = s.universe; @@ -682,19 +682,19 @@ abstract class NodeRetained extends SceneGraphObjectRetained implements NnuId { if (!collidable) { s.collidable[i] = false; } - } + } if (oldrefCount <= 0) super.doSetLive(s); - + if (inBackgroundGroup) { geometryBackground = s.geometryBackground; } - - setNodeData(s); + + setNodeData(s); } - + /** * remove the localToVworld transform for this node. @@ -705,7 +705,7 @@ abstract class NodeRetained extends SceneGraphObjectRetained implements NnuId { localToVworld = null; localToVworldIndex = null; localToVworldKeys = null; - // restore to default and avoid calling clear() + // restore to default and avoid calling clear() // that may clear parent reference branchGroupPaths branchGroupPaths = new ArrayList(1); parentTransformLink = null; @@ -717,15 +717,15 @@ abstract class NodeRetained extends SceneGraphObjectRetained implements NnuId { localToVworld = s.localToVworld; localToVworldIndex = s.localToVworldIndex; localToVworldKeys = s.localToVworldKeys; - + // Reference of parent branchGroupPaths will not change - // no need to reset parentSwitchLink or parentTransformLink + // no need to reset parentSwitchLink or parentTransformLink // because there are not per path data } - + } - + // The default set of clearLive actions void clearLive(SetLiveState s) { @@ -743,8 +743,8 @@ abstract class NodeRetained extends SceneGraphObjectRetained implements NnuId { universe.numNodes--; - - removeNodeData(s); + + removeNodeData(s); if(refCount <= 0) { locale = null; @@ -766,7 +766,7 @@ abstract class NodeRetained extends SceneGraphObjectRetained implements NnuId { break; } nodeR = nodeR.parent; - } + } } else { HashKey key; for (int i=0; i < pick.length; i++) { @@ -776,7 +776,7 @@ abstract class NodeRetained extends SceneGraphObjectRetained implements NnuId { do { if (nodeR instanceof SharedGroupRetained) { - String nodeId = key.getLastNodeId(); + String nodeId = key.getLastNodeId(); Vector parents = ((SharedGroupRetained) nodeR).parents; int sz = parents.size(); NodeRetained prevNodeR = nodeR; @@ -789,10 +789,10 @@ abstract class NodeRetained extends SceneGraphObjectRetained implements NnuId { } if (prevNodeR == nodeR) { // branch is already detach - return; + return; } } else { - nodeR = nodeR.parent; + nodeR = nodeR.parent; } if (nodeR == null) break; @@ -819,7 +819,7 @@ abstract class NodeRetained extends SceneGraphObjectRetained implements NnuId { break; } nodeR = nodeR.parent; - } + } } else { HashKey key; for (int i=0; i < collide.length; i++) { @@ -844,7 +844,7 @@ abstract class NodeRetained extends SceneGraphObjectRetained implements NnuId { return; } } else { - nodeR = nodeR.parent; + nodeR = nodeR.parent; } if (nodeR == null) break; @@ -889,7 +889,7 @@ abstract class NodeRetained extends SceneGraphObjectRetained implements NnuId { int sz = parents.size(); NodeRetained prevNodeR = nodeR; for (j=0; j< sz; j++) { - NodeRetained linkR = + NodeRetained linkR = (NodeRetained) parents.elementAt(j); if (linkR.nodeId.equals(nodeId)) { nodeR = linkR; @@ -904,23 +904,23 @@ abstract class NodeRetained extends SceneGraphObjectRetained implements NnuId { else if (nodeR.nodeType == NodeRetained.TRANSFORMGROUP) { tg = (TransformGroupRetained)nodeR; if (tg.inSharedGroup) { - + j = key.equals(tg.localToVworldKeys, 0, tg.localToVworldKeys.length); - + transformLevels[i] = tg.transformLevels[j]; } else { transformLevels[i] = tg.transformLevels[0]; } break; } - + nodeR = nodeR.parent; } while (true); } } } - + boolean isStatic() { if (source.getCapability(Node.ALLOW_LOCAL_TO_VWORLD_READ) || @@ -967,8 +967,8 @@ abstract class NodeRetained extends SceneGraphObjectRetained implements NnuId { } void searchGeometryAtoms(UnorderList list) {} - - /** + + /** * Make the boundsCache of this node and all its parents dirty */ void dirtyBoundsCache() { diff --git a/src/classes/share/javax/media/j3d/NoopDrawingSurfaceObject.java b/src/classes/share/javax/media/j3d/NoopDrawingSurfaceObject.java index cdc6647..55784a4 100644 --- a/src/classes/share/javax/media/j3d/NoopDrawingSurfaceObject.java +++ b/src/classes/share/javax/media/j3d/NoopDrawingSurfaceObject.java @@ -32,13 +32,13 @@ package javax.media.j3d; /** - * The DrawingSurfaceObject class is used to manage native drawing surface + * The DrawingSurfaceObject class is used to manage native drawing surface */ class NoopDrawingSurfaceObject extends DrawingSurfaceObject { - + NoopDrawingSurfaceObject(Canvas3D cv) { super(cv); - + System.err.println("NoopDrawingSurfaceObject constructed"); } diff --git a/src/classes/share/javax/media/j3d/NoopPipeline.java b/src/classes/share/javax/media/j3d/NoopPipeline.java index 28141d7..5a7deaa 100644 --- a/src/classes/share/javax/media/j3d/NoopPipeline.java +++ b/src/classes/share/javax/media/j3d/NoopPipeline.java @@ -330,7 +330,7 @@ class NoopPipeline extends Pipeline { Object imageBuffer, int depthFormat, Object depthBuffer) { - + } // --------------------------------------------------------------------- @@ -1007,7 +1007,7 @@ class NoopPipeline extends Pipeline { int tilew, int width, int height, int imageDataType, Object data, boolean useAutoMipMap) { } - + void updateTexture2DLodRange(Context ctx, int baseLevel, int maximumLevel, float minimumLod, float maximumLod) { @@ -1216,7 +1216,7 @@ class NoopPipeline extends Pipeline { // This is the native for reading the image from the offscreen buffer void readOffScreenBuffer(Canvas3D cv, Context ctx, int format, int type, Object data, int width, int height) { } - + // The native method for swapBuffers int swapBuffers(Canvas3D cv, Context ctx, long dpy, Drawable drawable) { return 0; @@ -1388,26 +1388,26 @@ class NoopPipeline extends Pipeline { } void clear(Context ctx, float r, float g, float b, boolean clearStencil) { - + } void textureFillBackground(Context ctx, float texMinU, float texMaxU, float texMinV, float texMaxV, float mapMinX, float mapMaxX, float mapMinY, float mapMaxY, boolean useBiliearFilter) { } - + void textureFillRaster(Context ctx, float texMinU, float texMaxU, float texMinV, float texMaxV, - float mapMinX, float mapMaxX, float mapMinY, float mapMaxY, float mapZ, float alpha, + float mapMinX, float mapMaxX, float mapMinY, float mapMaxY, float mapZ, float alpha, boolean useBiliearFilter) { } - + void executeRasterDepth(Context ctx, float posX, float posY, float posZ, - int srcOffsetX, int srcOffsetY, int rasterWidth, int rasterHeight, + int srcOffsetX, int srcOffsetY, int rasterWidth, int rasterHeight, int depthWidth, int depthHeight, int depthType, Object depthData) { - + } - + // The native method for setting the ModelView matrix. void setModelViewMatrix(Context ctx, double[] viewMatrix, double[] modelMatrix) { } @@ -1498,7 +1498,7 @@ class NoopPipeline extends Pipeline { // gcInfo.setPrivateData(privateData); Canvas3D.graphicsConfigTable.put(gc1, gcInfo); } - } + } return gc1; } diff --git a/src/classes/share/javax/media/j3d/NotificationThread.java b/src/classes/share/javax/media/j3d/NotificationThread.java index 9c32228..91542f7 100644 --- a/src/classes/share/javax/media/j3d/NotificationThread.java +++ b/src/classes/share/javax/media/j3d/NotificationThread.java @@ -46,17 +46,17 @@ class NotificationThread extends Thread { private volatile boolean running = true; private boolean waiting = false; private boolean ready = false; - + private LinkedList notificationQueue = new LinkedList(); /** - * Creates a new instance of NotificationThread + * Creates a new instance of NotificationThread */ NotificationThread(ThreadGroup t) { // Only one notification thread for the entire system super(t, "J3D-NotificationThread"); } - + /** * Adds a notification message to the queue */ @@ -73,13 +73,13 @@ class NotificationThread extends Thread { notificationQueue.clear(); return notifications; } - + /** * Processes all pending notification messages */ private void processNotifications() { J3dNotification[] notifications = getNotifications(); - + for (int i = 0; i < notifications.length; i++) { J3dNotification n = notifications[i]; switch (n.type) { @@ -103,7 +103,7 @@ class NotificationThread extends Thread { public void run() { while (running) { runMonitor(WAIT); - + processNotifications(); } // System.err.println("Notification thread finished"); diff --git a/src/classes/share/javax/media/j3d/OrderedBin.java b/src/classes/share/javax/media/j3d/OrderedBin.java index b8dcc7f..48619e4 100644 --- a/src/classes/share/javax/media/j3d/OrderedBin.java +++ b/src/classes/share/javax/media/j3d/OrderedBin.java @@ -40,7 +40,7 @@ import java.util.ArrayList; class OrderedBin extends Object { // ArrayList of orderedCollection, one for each child of the orderedGroup ArrayList orderedCollections = new ArrayList(); - + // orderedGroup source OrderedGroupRetained source; OrderedChildInfo childInfoList= null; @@ -88,7 +88,7 @@ class OrderedBin extends Object { } childInfoList = childInfoList.next; } - + // Now update the sets based on oi, since the og.orderedChildIdTable reflects // the childIds for the next frame, use the table to set the oc at the // correct place @@ -100,7 +100,7 @@ class OrderedBin extends Object { } setOCForOI.clear(); valueOfSetOCForOI.clear(); - + onUpdateList = false; lastChildInfo = null; @@ -115,14 +115,14 @@ class OrderedBin extends Object { else { // Add at the end cinfo.prev = lastChildInfo; - lastChildInfo.next = cinfo; + lastChildInfo.next = cinfo; cinfo.next = null; // Update this to be the last child lastChildInfo = cinfo; } } - + } diff --git a/src/classes/share/javax/media/j3d/OrderedChildInfo.java b/src/classes/share/javax/media/j3d/OrderedChildInfo.java index 58eb559..1594066 100644 --- a/src/classes/share/javax/media/j3d/OrderedChildInfo.java +++ b/src/classes/share/javax/media/j3d/OrderedChildInfo.java @@ -42,7 +42,7 @@ class OrderedChildInfo extends Object { static int ADD = 0x1; static int REMOVE = 0x2; - + /** * Type of operation, could be add/remove or set */ @@ -77,7 +77,7 @@ class OrderedChildInfo extends Object { value = val; prev = null; next = null; - + } } diff --git a/src/classes/share/javax/media/j3d/OrderedCollection.java b/src/classes/share/javax/media/j3d/OrderedCollection.java index 2979dc0..502d12e 100644 --- a/src/classes/share/javax/media/j3d/OrderedCollection.java +++ b/src/classes/share/javax/media/j3d/OrderedCollection.java @@ -47,7 +47,7 @@ class OrderedCollection extends Object implements ObjectUpdate{ // LightBin used for next frame LightBin nextFrameLightBin = null; - + // LightBins to be added for this frame LightBin addLightBins = null; @@ -70,7 +70,7 @@ class OrderedCollection extends Object implements ObjectUpdate{ addLightBins = null; onUpdateList = false; } - + } diff --git a/src/classes/share/javax/media/j3d/OrderedGroup.java b/src/classes/share/javax/media/j3d/OrderedGroup.java index 92d79a1..9d8cab1 100644 --- a/src/classes/share/javax/media/j3d/OrderedGroup.java +++ b/src/classes/share/javax/media/j3d/OrderedGroup.java @@ -103,7 +103,7 @@ public class OrderedGroup extends Group { */ public OrderedGroup() { // set default read capabilities - setDefaultReadCapabilities(readCapabilities); + setDefaultReadCapabilities(readCapabilities); } @@ -162,7 +162,7 @@ public class OrderedGroup extends Group { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_CHILD_INDEX_ORDER_READ)) - throw new + throw new CapabilityNotSetException(J3dI18N.getString("OrderedGroup5")); return ((OrderedGroupRetained)this.retained).getChildIndexOrder(); @@ -215,7 +215,7 @@ public class OrderedGroup extends Group { * @since Java 3D 1.3 */ public void addChild(Node child, int[] childIndexOrder) { - + verifyAddStates(child); verifyChildIndexOrderArray(childIndexOrder, 1); @@ -403,17 +403,17 @@ public class OrderedGroup extends Group { this.retained = new OrderedGroupRetained(); this.retained.setSource(this); } - + void verifyAddStates(Node child) { if (child instanceof SharedGroup) { throw new IllegalArgumentException(J3dI18N.getString("Group2")); } - + if (isLiveOrCompiled()) { if (! (child instanceof BranchGroup)) throw new RestrictedAccessException(J3dI18N.getString("Group12")); - + if(!this.getCapability(ALLOW_CHILDREN_EXTEND)) throw new CapabilityNotSetException(J3dI18N.getString("Group16")); } @@ -422,25 +422,25 @@ public class OrderedGroup extends Group { void verifyChildIndexOrderArray(int[] cIOArr, int plus) { if (isLiveOrCompiled()) { - - if(!this.getCapability(ALLOW_CHILD_INDEX_ORDER_WRITE)) + + if(!this.getCapability(ALLOW_CHILD_INDEX_ORDER_WRITE)) throw new CapabilityNotSetException(J3dI18N.getString("OrderedGroup4")); } - if(cIOArr != null) { - + if(cIOArr != null) { + if(cIOArr.length != (((GroupRetained)retained).children.size() + plus)) { - throw new + throw new IllegalArgumentException(J3dI18N.getString("OrderedGroup0")); } - + if((checkArr == null) || (checkArr.length != cIOArr.length)) { checkArr = new boolean[cIOArr.length]; } - + Arrays.fill(checkArr, false); - + for(int i=0; i<cIOArr.length; i++) { if(cIOArr[i] < 0) { throw new diff --git a/src/classes/share/javax/media/j3d/OrderedGroupRetained.java b/src/classes/share/javax/media/j3d/OrderedGroupRetained.java index ab09105..232477a 100644 --- a/src/classes/share/javax/media/j3d/OrderedGroupRetained.java +++ b/src/classes/share/javax/media/j3d/OrderedGroupRetained.java @@ -33,7 +33,7 @@ package javax.media.j3d; import java.util.ArrayList; -/** +/** * The OrderedGroup is a group node that ensures its children rendered * in index increasing order. */ @@ -76,11 +76,11 @@ class OrderedGroupRetained extends GroupRetained { void setChildIndexOrder(int[] cIOArr) { if(cIOArr != null) { - if((userChildIndexOrder == null) || + if((userChildIndexOrder == null) || (userChildIndexOrder.length != cIOArr.length)) { userChildIndexOrder = new int[cIOArr.length]; } - + System.arraycopy(cIOArr, 0, userChildIndexOrder, 0, userChildIndexOrder.length); } @@ -102,19 +102,19 @@ class OrderedGroupRetained extends GroupRetained { VirtualUniverse.mc.processMessage(m); } } - + int[] getChildIndexOrder() { if (userChildIndexOrder == null) { return null; } - + int[] newArr = new int[userChildIndexOrder.length]; - System.arraycopy(userChildIndexOrder, 0, + System.arraycopy(userChildIndexOrder, 0, newArr, 0, userChildIndexOrder.length); return newArr; } - + Integer getOrderedChildId() { Integer orderedChildId; synchronized(orderedChildIdFreeList) { @@ -136,12 +136,12 @@ class OrderedGroupRetained extends GroupRetained { int getOrderedChildCount() { int count; - + synchronized (orderedChildIdFreeList) { count = orderedChildIdCount; } return count; - } + } void addChild(Node child) { if(userChildIndexOrder != null) { @@ -153,19 +153,19 @@ class OrderedGroupRetained extends GroupRetained { super.addChild(child); } - + void addChild(Node child, int[] cIOArr) { if(cIOArr != null) { userChildIndexOrder = new int[cIOArr.length]; - + System.arraycopy(cIOArr, 0, userChildIndexOrder, - 0, userChildIndexOrder.length); + 0, userChildIndexOrder.length); } else { userChildIndexOrder = null; } - // GroupRetained.addChild have to check for case of non-null child + // GroupRetained.addChild have to check for case of non-null child // index order array and handle it. super.addChild(child); @@ -181,11 +181,11 @@ class OrderedGroupRetained extends GroupRetained { super.moveTo(bg); } - + void doRemoveChildIndexEntry(int index) { - + int[] newArr = new int[userChildIndexOrder.length - 1]; - + for(int i=0, j=0; i<userChildIndexOrder.length; i++) { if(userChildIndexOrder[i] > index) { newArr[j] = userChildIndexOrder[i] - 1; @@ -196,24 +196,24 @@ class OrderedGroupRetained extends GroupRetained { j++; } } - + userChildIndexOrder = newArr; - + } - + void doAddChildIndexEntry() { int[] newArr = new int[userChildIndexOrder.length + 1]; - + System.arraycopy(userChildIndexOrder, 0, newArr, 0, userChildIndexOrder.length); - + newArr[userChildIndexOrder.length] = userChildIndexOrder.length; - + userChildIndexOrder = newArr; } - /** - * Compiles the children of the OrderedGroup, preventing shape merging at + /** + * Compiles the children of the OrderedGroup, preventing shape merging at * this level or above */ void compile(CompileState compState) { @@ -227,7 +227,7 @@ class OrderedGroupRetained extends GroupRetained { compState.numOrderedGroups++; } } - + void setOrderedBin(OrderedBin ob, int index) { synchronized (orderedBin) { orderedBin[index] = ob; @@ -256,7 +256,7 @@ class OrderedGroupRetained extends GroupRetained { int i; //System.err.println("updateChildIdTableInserted childId " + childId + " orderedId " + orderedId + " " + this); - if (orderedChildIdTable != null) { + if (orderedChildIdTable != null) { size = orderedChildIdTable.length; for (i=0; i<size; i++) { if (orderedChildIdTable[i] != -1) { @@ -282,7 +282,7 @@ class OrderedGroupRetained extends GroupRetained { } orderedChildIdTable[orderedId] = childId; //printTable(orderedChildIdTable); - + } void updateChildIdTableRemoved(int childId ) { @@ -292,7 +292,7 @@ class OrderedGroupRetained extends GroupRetained { // from the table if (orderedChildIdTable == null) return; - + for (int i=0; i<orderedChildIdTable.length; i++) { if (orderedChildIdTable[i] != -1) { if (orderedChildIdTable[i] > childId) { @@ -334,7 +334,7 @@ class OrderedGroupRetained extends GroupRetained { super.setLive(s); s.orderedPaths = orderedPaths; if((userChildIndexOrder != null) && (refCount == 1)) { - + // Don't send a message for initial set live. int[]newArr = new int[userChildIndexOrder.length]; System.arraycopy(userChildIndexOrder, 0, newArr, @@ -352,7 +352,7 @@ class OrderedGroupRetained extends GroupRetained { s.notifyThreads |= J3dThread.UPDATE_RENDERING_ENVIRONMENT; // only need to do it once if in shared group s.nodeList.add(this); - s.ogCIOList.add(this); + s.ogCIOList.add(this); s.ogCIOTableList.add(null); userChildIndexOrder = null; } @@ -407,11 +407,11 @@ class OrderedGroupRetained extends GroupRetained { } - // This node has been cleared, so + // This node has been cleared, so void clearDerivedDataStructures() { int i; - - //System.err.println("og clearDerivedDataStructures " + this); + + //System.err.println("og clearDerivedDataStructures " + this); // Clear the orderedBin and childId table for all views // since this orderedGroup has been clearLived! for (i = 0; i < orderedBin.length; i++) { @@ -440,11 +440,11 @@ class OrderedGroupRetained extends GroupRetained { void decrChildCount() { childCount--; } - + void printTable(int[] table) { for (int i=0; i<table.length; i++) { System.err.print(" " + table[i]); - } + } System.err.println(""); } @@ -461,7 +461,7 @@ class OrderedGroupRetained extends GroupRetained { if(userChildIndexOrder != null) { doRemoveChildIndexEntry(index); } - + super.doRemoveChild(index, messages, messageIndex); } @@ -501,12 +501,12 @@ class OrderedGroupRetained extends GroupRetained { int[] newArr = new int[userChildIndexOrder.length]; System.arraycopy(userChildIndexOrder, 0, newArr, 0, userChildIndexOrder.length); - + s.ogCIOTableList.add(newArr); } childOrderedPaths = (ArrayList)childrenOrderedPaths.get(childIndex); - + for(int i=0; i< orderedPaths.size();i++){ childOrderedPath = ((OrderedPath)orderedPaths.get(i)).clonePath(); diff --git a/src/classes/share/javax/media/j3d/OrientedShape3D.java b/src/classes/share/javax/media/j3d/OrientedShape3D.java index b41963b..2837a23 100644 --- a/src/classes/share/javax/media/j3d/OrientedShape3D.java +++ b/src/classes/share/javax/media/j3d/OrientedShape3D.java @@ -73,7 +73,7 @@ import javax.vecmath.*; * consist of a quadrilateral that contains a texture of a tree. * * <p> - * Note that in a multiple View system, picking and interestion test + * Note that in a multiple View system, picking and interestion test * is done with the primary View only. * * @see Billboard @@ -343,7 +343,7 @@ public class OrientedShape3D extends Shape3D { * @param mode alignment mode, one of: ROTATE_ABOUT_AXIS, * ROTATE_ABOUT_POINT, or ROTATE_NONE * - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ public void setAlignmentMode(int mode) { @@ -363,7 +363,7 @@ public class OrientedShape3D extends Shape3D { * @return one of: ROTATE_ABOUT_AXIS, ROTATE_ABOUT_POINT, * or ROTATE_NONE * - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ public int getAlignmentMode() { @@ -385,7 +385,7 @@ public class OrientedShape3D extends Shape3D { * * @param axis the new alignment axis * - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ public void setAlignmentAxis(Vector3f axis) { @@ -412,7 +412,7 @@ public class OrientedShape3D extends Shape3D { * @param y the y component of the alignment axis * @param z the z component of the alignment axis * - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ public void setAlignmentAxis(float x, float y, float z) { @@ -432,7 +432,7 @@ public class OrientedShape3D extends Shape3D { * * @param axis the vector that will contain the alignment axis * - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ public void getAlignmentAxis(Vector3f axis) { @@ -448,7 +448,7 @@ public class OrientedShape3D extends Shape3D { * * @param point the new rotation point * - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ public void setRotationPoint(Point3f point) { @@ -470,7 +470,7 @@ public class OrientedShape3D extends Shape3D { * @param y the y component of the rotation point * @param z the z component of the rotation point * - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ public void setRotationPoint(float x, float y, float z) { @@ -490,7 +490,7 @@ public class OrientedShape3D extends Shape3D { * * @param point the point that will contain the rotation point * - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ public void getRotationPoint(Point3f point) { @@ -507,7 +507,7 @@ public class OrientedShape3D extends Shape3D { * @param constantScaleEnable a flag indicating whether to enable * constant scale * - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph * * @since Java 3D 1.3 @@ -531,7 +531,7 @@ public class OrientedShape3D extends Shape3D { * * @return the current constant scale enable flag * - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph * * @since Java 3D 1.3 @@ -551,7 +551,7 @@ public class OrientedShape3D extends Shape3D { * * @param scale the scale value * - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph * * @since Java 3D 1.3 @@ -573,7 +573,7 @@ public class OrientedShape3D extends Shape3D { * * @return the current scale value * - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph * * @since Java 3D 1.3 @@ -640,7 +640,7 @@ public class OrientedShape3D extends Shape3D { * <code>false</code>, the value of each node's * <code>duplicateOnCloneTree</code> variable determines whether * NodeComponent data is duplicated or copied. - * @exception ClassCastException if originalNode is not an instance of + * @exception ClassCastException if originalNode is not an instance of * <code>Shape3D</code> * * @see Node#cloneTree @@ -648,7 +648,7 @@ public class OrientedShape3D extends Shape3D { * @see NodeComponent#setDuplicateOnCloneTree */ public void duplicateNode(Node originalNode, boolean forceDuplicate) { - checkDuplicateNode(originalNode, forceDuplicate); + checkDuplicateNode(originalNode, forceDuplicate); } @@ -675,9 +675,9 @@ public class OrientedShape3D extends Shape3D { * @see NodeComponent#setDuplicateOnCloneTree */ void duplicateAttributes(Node originalNode, boolean forceDuplicate) { - + super.duplicateAttributes(originalNode, forceDuplicate); - OrientedShape3DRetained attr = (OrientedShape3DRetained) + OrientedShape3DRetained attr = (OrientedShape3DRetained) originalNode.retained; OrientedShape3DRetained rt = (OrientedShape3DRetained) retained; diff --git a/src/classes/share/javax/media/j3d/OrientedShape3DRenderMethod.java b/src/classes/share/javax/media/j3d/OrientedShape3DRenderMethod.java index f64a763..4772d02 100644 --- a/src/classes/share/javax/media/j3d/OrientedShape3DRenderMethod.java +++ b/src/classes/share/javax/media/j3d/OrientedShape3DRenderMethod.java @@ -40,25 +40,25 @@ package javax.media.j3d; class OrientedShape3DRenderMethod implements RenderMethod { - public boolean render(RenderMolecule rm, Canvas3D cv, + public boolean render(RenderMolecule rm, Canvas3D cv, RenderAtomListInfo ra, int dirtyBits) { boolean useAlpha; boolean isNonUniformScale; Transform3D trans=null; - + useAlpha = rm.useAlpha; - + GeometryArrayRetained geo = (GeometryArrayRetained)ra.geometry(); - geo.setVertexFormat((rm.useAlpha && - ((geo.vertexFormat & GeometryArray.COLOR) != 0)), + geo.setVertexFormat((rm.useAlpha && + ((geo.vertexFormat & GeometryArray.COLOR) != 0)), rm.textureBin.attributeBin.ignoreVertexColors, cv.ctx); - + if (rm.doInfinite) { cv.updateState(dirtyBits); while (ra != null) { trans = ra.infLocalToVworld; isNonUniformScale = !trans.isCongruent(); - + cv.setModelViewMatrix(cv.ctx, cv.vworldToEc.mat, trans); ra.geometry().execute(cv, ra.renderAtom, isNonUniformScale, (useAlpha && ra.geometry().noAlpha), @@ -69,8 +69,8 @@ class OrientedShape3DRenderMethod implements RenderMethod { } return true; } - - boolean isVisible = false; // True if any of the RAs is visible. + + boolean isVisible = false; // True if any of the RAs is visible. while (ra != null) { if (cv.ra == ra.renderAtom) { if (cv.raIsVisible) { @@ -95,7 +95,7 @@ class OrientedShape3DRenderMethod implements RenderMethod { cv.raIsVisible = true; trans = ra.localToVworld; isNonUniformScale = !trans.isCongruent(); - + cv.setModelViewMatrix(cv.ctx, cv.vworldToEc.mat, trans); ra.geometry().execute(cv, ra.renderAtom, isNonUniformScale, (useAlpha && ra.geometry().noAlpha), @@ -109,16 +109,16 @@ class OrientedShape3DRenderMethod implements RenderMethod { cv.raIsVisible = false; } cv.ra = ra.renderAtom; - + } ra = ra.next; - + } - - geo.disableGlobalAlpha(cv.ctx, - (rm.useAlpha && - ((geo.vertexFormat & GeometryArray.COLOR) != 0)), + + geo.disableGlobalAlpha(cv.ctx, + (rm.useAlpha && + ((geo.vertexFormat & GeometryArray.COLOR) != 0)), rm.textureBin.attributeBin.ignoreVertexColors); return isVisible; } diff --git a/src/classes/share/javax/media/j3d/OrientedShape3DRetained.java b/src/classes/share/javax/media/j3d/OrientedShape3DRetained.java index 1e338ba..8d7b7c9 100644 --- a/src/classes/share/javax/media/j3d/OrientedShape3DRetained.java +++ b/src/classes/share/javax/media/j3d/OrientedShape3DRetained.java @@ -71,10 +71,10 @@ class OrientedShape3DRetained extends Shape3DRetained { // Frequently used variables for scale invariant computation // Left and right Vworld to Clip coordinates transforms - private Transform3D left_xform = new Transform3D(); - private Transform3D right_xform = new Transform3D(); + private Transform3D left_xform = new Transform3D(); + private Transform3D right_xform = new Transform3D(); - // Transform for scaling the OrientedShape3D to correct for + // Transform for scaling the OrientedShape3D to correct for // perspective foreshortening Transform3D scaleXform = new Transform3D(); @@ -254,7 +254,7 @@ class OrientedShape3DRetained extends Shape3DRetained { changeMessage.args[0] = getGeomAtomsArray(mirrorShape3D); changeMessage.args[1] = new Integer(component); changeMessage.args[2] = attr; - OrientedShape3DRetained[] o3dArr = + OrientedShape3DRetained[] o3dArr = new OrientedShape3DRetained[mirrorShape3D.size()]; mirrorShape3D.toArray(o3dArr); changeMessage.args[3] = o3dArr; @@ -264,7 +264,7 @@ class OrientedShape3DRetained extends Shape3DRetained { void updateImmediateMirrorObject(Object[] args) { int component = ((Integer)args[1]).intValue(); - if ((component & (ALIGNMENT_CHANGED | + if ((component & (ALIGNMENT_CHANGED | AXIS_CHANGED | ROTATION_CHANGED | CONSTANT_SCALE_CHANGED | @@ -317,7 +317,7 @@ class OrientedShape3DRetained extends Shape3DRetained { newList[i] = orientedTransforms[i]; } newList[viewIndex] = xform; - orientedTransforms = newList; + orientedTransforms = newList; } else { if (orientedTransforms[viewIndex] == null) { @@ -335,7 +335,7 @@ class OrientedShape3DRetained extends Shape3DRetained { double angle = 0.0; double sign; boolean status; - + Transform3D orientedxform = getOrientedTransform(viewIndex); // get viewplatforms's location in virutal world if (mode == OrientedShape3D.ROTATE_ABOUT_AXIS) { // rotate about axis @@ -367,16 +367,16 @@ class OrientedShape3DRetained extends Shape3DRetained { } if (status) { - // compute the sign of the angle by checking if the cross product + // compute the sign of the angle by checking if the cross product // of the two vectors is in the same direction as the normal axis - vector.cross(eyeVec, zAxis); + vector.cross(eyeVec, zAxis); if (vector.dot(nAxis) > 0.0) { sign = 1.0; - } else { + } else { sign = -1.0; } - - // compute the angle between the projected eye vector and the + + // compute the angle between the projected eye vector and the // projected z double dot = eyeVec.dot(zAxis); @@ -387,10 +387,10 @@ class OrientedShape3DRetained extends Shape3DRetained { } angle = sign*Math.acos(dot); - + // use -angle because xform is to *undo* rotation by angle - aa.x = nAxis.x; - aa.y = nAxis.y; + aa.x = nAxis.x; + aa.y = nAxis.y; aa.z = nAxis.z; aa.angle = -angle; orientedxform.set(aa); @@ -400,10 +400,10 @@ class OrientedShape3DRetained extends Shape3DRetained { } } else if(mode == OrientedShape3D.ROTATE_ABOUT_POINT ){ // rotate about point - // Need to rotate Z axis to point to eye, and Y axis to be - // parallel to view platform Y axis, rotating around rotation pt + // Need to rotate Z axis to point to eye, and Y axis to be + // parallel to view platform Y axis, rotating around rotation pt - // get the eye point + // get the eye point canvas.getCenterEyeInImagePlate(viewPosition); // derive the yUp point @@ -441,7 +441,7 @@ class OrientedShape3DRetained extends Shape3DRetained { // rotation axis is cross product of eyeVec and zAxis vector.cross(eyeVec, zAxis); // vector is cross product - // if cross product is non-zero, vector is rotation axis and + // if cross product is non-zero, vector is rotation axis and // rotation angle is acos(eyeVec.dot(zAxis))); double length = vector.length(); if (length > 0.0001) { @@ -468,12 +468,12 @@ class OrientedShape3DRetained extends Shape3DRetained { yAxis.z = 0.0; zRotate.transform(yAxis); - // project the yAxis onto the plane perp to the eyeVec + // project the yAxis onto the plane perp to the eyeVec status = projectToPlane(yAxis, eyeVec); if (status) { - // project the yUp onto the plane perp to the eyeVec + // project the yUp onto the plane perp to the eyeVec status = projectToPlane(yUp, eyeVec); } @@ -490,11 +490,11 @@ class OrientedShape3DRetained extends Shape3DRetained { angle = Math.acos(dot); - // check the sign by looking a the cross product vs the eyeVec + // check the sign by looking a the cross product vs the eyeVec vector.cross(yUp, yAxis); // vector is cross product if (eyeVec.dot(vector) < 0) { angle *= -1; - } + } aa.x = eyeVec.x; aa.y = eyeVec.y; aa.z = eyeVec.z; @@ -509,13 +509,13 @@ class OrientedShape3DRetained extends Shape3DRetained { orientedxform.mul(xform); // yRotate orientedxform.mul(zRotate); // zRotate vector.scale(-1.0); // vector to translate back - xform.set(vector); // xform to translate back + xform.set(vector); // xform to translate back orientedxform.mul(xform); // translate back } else { orientedxform.setIdentity(); } - + } //Scale invariant computation if(constantScale) { diff --git a/src/classes/share/javax/media/j3d/PathInterpolator.java b/src/classes/share/javax/media/j3d/PathInterpolator.java index f857076..33b5447 100644 --- a/src/classes/share/javax/media/j3d/PathInterpolator.java +++ b/src/classes/share/javax/media/j3d/PathInterpolator.java @@ -42,14 +42,14 @@ import java.util.Enumeration; * the currentInterpolationValue. * The currentInterpolationValue is calculated * by linearly interpolating among a series of predefined knots - * (using the value generated by the specified Alpha object). + * (using the value generated by the specified Alpha object). * The first knot must have a value of 0.0 and the last knot must have a * value of 1.0. An intermediate knot with index k must have a value * strictly greater than any knot with index less than k. */ public abstract class PathInterpolator extends TransformInterpolator { - + // Array of knots private float knots[]; @@ -65,7 +65,7 @@ public abstract class PathInterpolator extends TransformInterpolator { * value which can be used in further calculations by the subclass. */ protected float currentInterpolationValue; - + /** * This value is the index of the current base knot value, as * determined by the alpha function. A subclass wishing to @@ -104,7 +104,7 @@ public abstract class PathInterpolator extends TransformInterpolator { public PathInterpolator(Alpha alpha, float[] knots) { this(alpha, null, knots); } - + /** * Constructs a new PathInterpolator object that interpolates * between the knot values in the knots array. The array of knots @@ -117,7 +117,7 @@ public abstract class PathInterpolator extends TransformInterpolator { * @since Java 3D 1.3 */ - public PathInterpolator(Alpha alpha,TransformGroup target, + public PathInterpolator(Alpha alpha,TransformGroup target, float[] knots) { super(alpha, target); setKnots(knots); @@ -231,7 +231,7 @@ public abstract class PathInterpolator extends TransformInterpolator { protected void computePathInterpolation(float alphaValue ) { int i; - + for (i = 0; i < knots.length; i++) { if ((i == 0 && alphaValue <= knots[i]) || (i > 0 && alphaValue >= knots[i-1] && alphaValue <= knots[i])) { @@ -246,7 +246,7 @@ public abstract class PathInterpolator extends TransformInterpolator { currentKnotIndex = i - 1; } break; - } + } } } @@ -256,7 +256,7 @@ public abstract class PathInterpolator extends TransformInterpolator { */ protected void computePathInterpolation() { float value = this.alpha.value(); - computePathInterpolation(value); + computePathInterpolation(value); } @@ -265,7 +265,7 @@ public abstract class PathInterpolator extends TransformInterpolator { * <code>originalNode</code> into * the current node. This method is called from the * <code>cloneNode</code> method which is, in turn, called by the - * <code>cloneTree</code> method.<P> + * <code>cloneTree</code> method.<P> * * @param originalNode the original node to duplicate. * @param forceDuplicate when set to <code>true</code>, causes the diff --git a/src/classes/share/javax/media/j3d/PhysicalBody.java b/src/classes/share/javax/media/j3d/PhysicalBody.java index 6fbd097..b23ee4d 100644 --- a/src/classes/share/javax/media/j3d/PhysicalBody.java +++ b/src/classes/share/javax/media/j3d/PhysicalBody.java @@ -108,7 +108,7 @@ public class PhysicalBody extends Object { | View.PB_EAR_POSITION_DIRTY | View.PB_NOMINAL_EYE_HEIGHT_FROM_GROUND_DIRTY | View.PB_NOMINAL_EYE_OFFSET_FROM_NOMINAL_SCREEN_DIRTY); - + /** * Constructs a PhysicalBody object with default parameters. * The default values are as follows: @@ -203,7 +203,7 @@ public class PhysicalBody extends Object { /** * Retrieves the user head object's left eye position and places * that value in the specified object. - * @param position the object that will receive the left-eye's position + * @param position the object that will receive the left-eye's position * in head coordinates */ public void getLeftEyePosition(Point3d position) { @@ -223,9 +223,9 @@ public class PhysicalBody extends Object { } /** - * Retrieves the user head object's right eye position and places + * Retrieves the user head object's right eye position and places * that value in the specified object. - * @param position the object that will receive the right-eye's position + * @param position the object that will receive the right-eye's position * in head coordinates */ public void getRightEyePosition(Point3d position) { @@ -247,7 +247,7 @@ public class PhysicalBody extends Object { /** * Retrieves the user head object's left ear position and places * that value in the specified object. - * @param position the object that will receive the left-ear's position + * @param position the object that will receive the left-ear's position * in head coordinates */ public void getLeftEarPosition(Point3d position) { @@ -267,9 +267,9 @@ public class PhysicalBody extends Object { } /** - * Retrieves the user head object's right ear position and places + * Retrieves the user head object's right ear position and places * that value in the specified object. - * @param position the object that will receive the right-ear's position + * @param position the object that will receive the right-ear's position * in head coordinates */ public void getRightEarPosition(Point3d position) { diff --git a/src/classes/share/javax/media/j3d/PhysicalEnvironment.java b/src/classes/share/javax/media/j3d/PhysicalEnvironment.java index 234218c..62125db 100644 --- a/src/classes/share/javax/media/j3d/PhysicalEnvironment.java +++ b/src/classes/share/javax/media/j3d/PhysicalEnvironment.java @@ -95,7 +95,7 @@ public class PhysicalEnvironment extends Object { | View.PE_TRACKING_AVAILABLE_DIRTY | View.PE_COE_CENTER_IN_PWORLD_POLICY_DIRTY); - + //// /** //// * The offset in the user's dominant-hand-tracker coordinates //// * to that hand's hot spot. This value is a calibration constant. @@ -118,10 +118,10 @@ public class PhysicalEnvironment extends Object { // Sensor[] sensors; - // Audio device associated with this PhysicalEnvironment + // Audio device associated with this PhysicalEnvironment AudioDevice audioDevice = null; - boolean sensorListChanged = false; + boolean sensorListChanged = false; Sensor[] sensorList = null; @@ -199,7 +199,7 @@ public class PhysicalEnvironment extends Object { } } - + /** * Returns copy of Sensor references. Returns null for zero @@ -220,18 +220,18 @@ public class PhysicalEnvironment extends Object { } } - - /** + + /** * Sets the specified AudioDevice object as the device through * which audio rendering for this PhysicalEnvironment will be * performed. - * @param device audio device object to be associated with this + * @param device audio device object to be associated with this * PhysicalEnvironment */ public void setAudioDevice(AudioDevice device) { audioDevice = device; } - + /** * Gets the audioDevice for this PhysicalEnvironment. * @return audio device object associated with this PhysicalEnvironment @@ -243,14 +243,14 @@ public class PhysicalEnvironment extends Object { /** * Create an enumerator that produces all input devices. * @return an enumerator of all available devices - */ + */ public Enumeration getAllInputDevices() { return devices.elements(); } /** - * Add an input device to the list of input devices. User is - * responsible for initializing the device and setting the + * Add an input device to the list of input devices. User is + * responsible for initializing the device and setting the * processing mode (streaming or polling). * @param device the device to be added to the list of input devices * @exception IllegalArgumentException if InputDevice.getProcessingMode() @@ -260,7 +260,7 @@ public class PhysicalEnvironment extends Object { int driver_type = device.getProcessingMode(); - if ((driver_type == InputDevice.BLOCKING) || + if ((driver_type == InputDevice.BLOCKING) || (driver_type == InputDevice.NON_BLOCKING) || (driver_type == InputDevice.DEMAND_DRIVEN)) { synchronized (devices) { @@ -380,7 +380,7 @@ public class PhysicalEnvironment extends Object { /** * Set the sensor specified by the index to sensor provided; sensors are - * indexed starting at 0. All sensors must be registered via this + * indexed starting at 0. All sensors must be registered via this * method. * @param index the sensor's index * @param sensor the new sensor @@ -404,8 +404,8 @@ public class PhysicalEnvironment extends Object { * @param index the sensor's index */ public Sensor getSensor(int index){ - // not synchronized, since the only way to write to sensors is - // via a public API call, and user shouldn't call Sensor with + // not synchronized, since the only way to write to sensors is + // via a public API call, and user shouldn't call Sensor with // two threads return sensors[index]; } @@ -427,7 +427,7 @@ public class PhysicalEnvironment extends Object { coexistenceToTrackerBase.setWithLock(t); peDirtyMask |= View.PE_COE_TO_TRACKER_BASE_DIRTY; } - + notifyUsers(); } @@ -465,7 +465,7 @@ public class PhysicalEnvironment extends Object { case View.NOMINAL_HEAD: case View.NOMINAL_FEET: break; - + default: throw new IllegalArgumentException(J3dI18N.getString("PhysicalEnvironment2")); } @@ -476,7 +476,7 @@ public class PhysicalEnvironment extends Object { } notifyUsers(); } - + /** * Returns the current coexistence center in physical world policy. * @return one of: View.NOMINAL_SCREEN, View.NOMINAL_HEAD, or @@ -496,7 +496,7 @@ public class PhysicalEnvironment extends Object { /** * Set the number of sensor objects per PhysicalEnvironmnet. This is a - * calibration parameter that should be set before setting any sensors + * calibration parameter that should be set before setting any sensors * in the PhysicalEnvironment object. This call associates 'count' * Sensors with this object, and they are indexed from 0 to count-1. * @param count the new sensor count @@ -517,7 +517,7 @@ public class PhysicalEnvironment extends Object { sensorCount = count; sensorListChanged = true; sensors = tmp; - } + } notifyUsers(); } diff --git a/src/classes/share/javax/media/j3d/PickBounds.java b/src/classes/share/javax/media/j3d/PickBounds.java index 267385b..ff0f4e6 100644 --- a/src/classes/share/javax/media/j3d/PickBounds.java +++ b/src/classes/share/javax/media/j3d/PickBounds.java @@ -41,7 +41,7 @@ import javax.vecmath.*; * @see Locale#pickAll */ public final class PickBounds extends PickShape { - + Bounds bounds; /** @@ -50,7 +50,7 @@ public final class PickBounds extends PickShape { public PickBounds() { bounds = null; } - + /** * Constructs a PickBounds from the specified bounds object. * @param boundsObject the bounds of this PickBounds. @@ -58,8 +58,8 @@ public final class PickBounds extends PickShape { public PickBounds(Bounds boundsObject) { bounds = boundsObject; } - - + + /** * Sets the bounds object of this PickBounds to the specified object. * @param boundsObject the new bounds of this PickBounds. @@ -67,7 +67,7 @@ public final class PickBounds extends PickShape { public void set(Bounds boundsObject) { bounds = boundsObject; } - + /** * Gets the bounds object from this PickBounds. * @return the bounds. @@ -83,26 +83,26 @@ public final class PickBounds extends PickShape { final boolean intersect(Bounds bounds, Point4d pickPos) { return bounds.intersect(this.bounds, pickPos); } - + // Only use within J3D. - // Return a new PickBounds that is the transformed (t3d) of this pickBounds. + // Return a new PickBounds that is the transformed (t3d) of this pickBounds. PickShape transform(Transform3D t3d) { // If the bounds is a BoundingBox, then the transformed bounds will // get bigger. So this is a potential bug, and we'll have to deal with - // if there is a complain. + // if there is a complain. Bounds newBds = (Bounds)bounds.clone(); newBds.transform(t3d); PickBounds newPB = new PickBounds(newBds); - + return newPB; } Point3d getStartPoint() { return bounds.getCenter(); - } + } int getPickType() { - return (bounds != null ? bounds.getPickType() : + return (bounds != null ? bounds.getPickType() : PickShape.PICKUNKNOWN); } } diff --git a/src/classes/share/javax/media/j3d/PickCone.java b/src/classes/share/javax/media/j3d/PickCone.java index 3668260..c51d5aa 100644 --- a/src/classes/share/javax/media/j3d/PickCone.java +++ b/src/classes/share/javax/media/j3d/PickCone.java @@ -63,7 +63,7 @@ public abstract class PickCone extends PickShape { public void getOrigin(Point3d origin) { origin.set(this.origin); } - + /** * Gets the direction of this PickCone. * @param direction the Vector3d object into which the direction @@ -84,7 +84,7 @@ public abstract class PickCone extends PickShape { /** * Gets the radius of this PickCone at the specified distance. - * @param distance the distance from the origin at which we want + * @param distance the distance from the origin at which we want * the radius of the cone * @return the radius at the specified distance */ diff --git a/src/classes/share/javax/media/j3d/PickConeRay.java b/src/classes/share/javax/media/j3d/PickConeRay.java index 0846a65..e49239e 100644 --- a/src/classes/share/javax/media/j3d/PickConeRay.java +++ b/src/classes/share/javax/media/j3d/PickConeRay.java @@ -100,7 +100,7 @@ public final class PickConeRay extends PickCone { if (bounds instanceof BoundingSphere) { Point3d sphCenter = ((BoundingSphere)bounds).getCenter(); double sphRadius = ((BoundingSphere)bounds).getRadius(); - double sqDist = + double sqDist = Distance.pointToRay (sphCenter, origin, direction, rayPt, null); vector.sub (rayPt, origin); distance = vector.length(); @@ -109,7 +109,7 @@ public final class PickConeRay extends PickCone { return true; } return false; // we are too far to intersect - } + } // // ================ BOUNDING BOX ================ // @@ -119,9 +119,9 @@ public final class PickConeRay extends PickCone { ((BoundingBox)bounds).getLower (lower); Point3d center = ((BoundingBox)bounds).getCenter (); - + // First, see if cone is too far away from BoundingBox - double sqDist = + double sqDist = Distance.pointToRay (center, origin, direction, rayPt, null); vector.sub (rayPt, origin); @@ -133,7 +133,7 @@ public final class PickConeRay extends PickCone { temp = (center.y - lower.y + radius); boxRadiusSquared += temp*temp; temp = (center.z - lower.z + radius); - boxRadiusSquared += temp*temp; + boxRadiusSquared += temp*temp; if (sqDist > boxRadiusSquared) { @@ -151,7 +151,7 @@ public final class PickConeRay extends PickCone { // Ray does not intersect, test for distance with each edge Point3d upper = new Point3d(); ((BoundingBox)bounds).getUpper (upper); - + Point3d[][] edges = { // Top horizontal 4 {upper, new Point3d (lower.x, upper.y, upper.z)}, @@ -172,8 +172,8 @@ public final class PickConeRay extends PickCone { for (int i=0;i<edges.length;i++) { // System.err.println ("Testing edge: "+edges[i][0]+" - "+edges[i][1]); - double distToEdge = - Distance.rayToSegment (origin, direction, edges[i][0], edges[i][1], + double distToEdge = + Distance.rayToSegment (origin, direction, edges[i][0], edges[i][1], rayPt, null, null); vector.sub (rayPt, origin); @@ -201,7 +201,7 @@ public final class PickConeRay extends PickCone { bsphere.getCenter (sphCenter); double sphRadius = bsphere.getRadius(); - double sqDist = + double sqDist = Distance.pointToRay (sphCenter, origin, direction, rayPt, null); vector.sub (rayPt, origin); distance = vector.length(); @@ -229,13 +229,13 @@ public final class PickConeRay extends PickCone { midpt.y = (ptope.verts[i].y + ptope.verts[j].y) * 0.5; midpt.z = (ptope.verts[i].z + ptope.verts[j].z) * 0.5; - if (! PickCylinder.pointInPolytope (ptope, + if (! PickCylinder.pointInPolytope (ptope, midpt.x, midpt.y, midpt.z)) { continue; } - distToEdge = - Distance.rayToSegment (origin, direction, - ptope.verts[i], ptope.verts[j], + distToEdge = + Distance.rayToSegment (origin, direction, + ptope.verts[i], ptope.verts[j], rayPt, null, null); vector.sub (rayPt, origin); distance = vector.length(); @@ -256,30 +256,30 @@ public final class PickConeRay extends PickCone { } // Only use within J3D. - // Return a new PickConeRay that is the transformed (t3d) of this pickConeRay. + // Return a new PickConeRay that is the transformed (t3d) of this pickConeRay. PickShape transform(Transform3D t3d) { - + Point3d end = new Point3d(); - + PickConeRay newPCR = new PickConeRay(); - + newPCR.origin.x = origin.x; newPCR.origin.y = origin.y; newPCR.origin.z = origin.z; newPCR.spreadAngle = spreadAngle; - + end.x = origin.x + direction.x; end.y = origin.y + direction.y; end.z = origin.z + direction.z; - + t3d.transform(newPCR.origin); t3d.transform(end); - + newPCR.direction.x = end.x - newPCR.origin.x; newPCR.direction.y = end.y - newPCR.origin.y; newPCR.direction.z = end.z - newPCR.origin.z; newPCR.direction.normalize(); - + return newPCR; } } diff --git a/src/classes/share/javax/media/j3d/PickConeSegment.java b/src/classes/share/javax/media/j3d/PickConeSegment.java index 1866ce4..70a3176 100644 --- a/src/classes/share/javax/media/j3d/PickConeSegment.java +++ b/src/classes/share/javax/media/j3d/PickConeSegment.java @@ -114,7 +114,7 @@ public final class PickConeSegment extends PickCone { Point4d iPnt = new Point4d(); Vector3d vector = new Vector3d(); Point3d rayPt = new Point3d(); - + double distance; double radius; @@ -124,17 +124,17 @@ public final class PickConeSegment extends PickCone { if (bounds instanceof BoundingSphere) { Point3d sphCenter = ((BoundingSphere)bounds).getCenter(); double sphRadius = ((BoundingSphere)bounds).getRadius(); - double sqDist = + double sqDist = Distance.pointToSegment (sphCenter, origin, end, rayPt, null); vector.sub (rayPt, origin); distance = vector.length(); radius = getRadius (distance); if (sqDist <= (sphRadius+radius)*(sphRadius+radius)) { - return true; + return true; } return false; // we are too far to intersect - } + } // // ================ BOUNDING BOX ================ // @@ -146,7 +146,7 @@ public final class PickConeSegment extends PickCone { Point3d center = ((BoundingBox)bounds).getCenter (); // First, see if cone is too far away from BoundingBox - double sqDist = + double sqDist = Distance.pointToSegment (center, origin, end, rayPt, null); vector.sub (rayPt, origin); @@ -158,7 +158,7 @@ public final class PickConeSegment extends PickCone { temp = (center.y - lower.y + radius); boxRadiusSquared += temp*temp; temp = (center.z - lower.z + radius); - boxRadiusSquared += temp*temp; + boxRadiusSquared += temp*temp; if (sqDist > boxRadiusSquared) { return false; // we are too far to intersect @@ -175,7 +175,7 @@ public final class PickConeSegment extends PickCone { // Ray does not intersect, test for distance with each edge Point3d upper = new Point3d(); ((BoundingBox)bounds).getUpper (upper); - + Point3d[][] edges = { // Top horizontal 4 {upper, new Point3d (lower.x, upper.y, upper.z)}, @@ -195,8 +195,8 @@ public final class PickConeSegment extends PickCone { }; for (int i=0;i<edges.length;i++) { // System.err.println ("Testing edge: "+edges[i][0]+" - "+edges[i][1]); - double distToEdge = - Distance.segmentToSegment (origin, end, edges[i][0], edges[i][1], + double distToEdge = + Distance.segmentToSegment (origin, end, edges[i][0], edges[i][1], rayPt, null, null); vector.sub (rayPt, origin); @@ -206,7 +206,7 @@ public final class PickConeSegment extends PickCone { distance+" radius: " + radius + " distToEdge:" +Math.sqrt(distToEdge)); */ - + if (distToEdge <= radius*radius) { // System.err.println ("Intersects!"); return true; @@ -228,7 +228,7 @@ public final class PickConeSegment extends PickCone { bsphere.getCenter (sphCenter); double sphRadius = bsphere.getRadius(); - double sqDist = + double sqDist = Distance.pointToSegment (sphCenter, origin, end, rayPt, null); vector.sub (rayPt, origin); @@ -258,12 +258,12 @@ public final class PickConeSegment extends PickCone { midpt.y = (ptope.verts[i].y + ptope.verts[j].y) * 0.5; midpt.z = (ptope.verts[i].z + ptope.verts[j].z) * 0.5; - if (! PickCylinder.pointInPolytope (ptope, + if (! PickCylinder.pointInPolytope (ptope, midpt.x, midpt.y, midpt.z)) { continue; } - distToEdge = - Distance.segmentToSegment (origin, end, + distToEdge = + Distance.segmentToSegment (origin, end, ptope.verts[i], ptope.verts[j], rayPt, null, null); vector.sub (rayPt, origin); @@ -285,11 +285,11 @@ public final class PickConeSegment extends PickCone { } // Only use within J3D. - // Return a new PickConeSegment that is the transformed (t3d) of this pickConeSegment. + // Return a new PickConeSegment that is the transformed (t3d) of this pickConeSegment. PickShape transform(Transform3D t3d) { - + PickConeSegment newPCS = new PickConeSegment(); - + newPCS.origin.x = origin.x; newPCS.origin.y = origin.y; newPCS.origin.z = origin.z; @@ -297,7 +297,7 @@ public final class PickConeSegment extends PickCone { newPCS.end.x = end.x; newPCS.end.y = end.y; newPCS.end.z = end.z; - + t3d.transform(newPCS.origin); t3d.transform(newPCS.end); diff --git a/src/classes/share/javax/media/j3d/PickCylinder.java b/src/classes/share/javax/media/j3d/PickCylinder.java index 10d9d77..03f912d 100644 --- a/src/classes/share/javax/media/j3d/PickCylinder.java +++ b/src/classes/share/javax/media/j3d/PickCylinder.java @@ -53,7 +53,7 @@ public abstract class PickCylinder extends PickShape { public PickCylinder() { origin = new Point3d(); direction = new Vector3d(); - radius = 0.0; + radius = 0.0; } /** @@ -88,11 +88,11 @@ public abstract class PickCylinder extends PickShape { */ abstract boolean intersect(Bounds bounds, Point4d pickPos); - // This is a duplicate of the same method, declared private inside of + // This is a duplicate of the same method, declared private inside of // BoundingPolytope // XXXX: remove this once the original method is available (public) in // BoundingPolytope - static boolean pointInPolytope(BoundingPolytope ptope, + static boolean pointInPolytope(BoundingPolytope ptope, double x, double y, double z ){ Vector4d p; int i = ptope.planes.length - 1; @@ -102,7 +102,7 @@ public abstract class PickCylinder extends PickShape { if (( x*p.x + y*p.y + z*p.z + p.w ) > Bounds.EPSILON) { return false; } - } + } return true; } diff --git a/src/classes/share/javax/media/j3d/PickCylinderRay.java b/src/classes/share/javax/media/j3d/PickCylinderRay.java index ccfdf93..326ae3e 100644 --- a/src/classes/share/javax/media/j3d/PickCylinderRay.java +++ b/src/classes/share/javax/media/j3d/PickCylinderRay.java @@ -54,7 +54,7 @@ public final class PickCylinderRay extends PickCylinder { */ public PickCylinderRay() { } - + /** * Constructs an infinite cylindrical ray pick shape from the specified * parameters. @@ -97,13 +97,13 @@ public final class PickCylinderRay extends PickCylinder { if (bounds instanceof BoundingSphere) { Point3d sphCenter = ((BoundingSphere)bounds).getCenter(); double sphRadius = ((BoundingSphere)bounds).getRadius(); - double sqDist = + double sqDist = Distance.pointToRay (sphCenter, origin, direction); if (sqDist <= (sphRadius+radius)*(sphRadius+radius)) { - return true; + return true; } return false; - } + } // // ================ BOUNDING BOX ================ // @@ -113,16 +113,16 @@ public final class PickCylinderRay extends PickCylinder { ((BoundingBox)bounds).getLower (lower); Point3d center = ((BoundingBox)bounds).getCenter (); - + double temp = (center.x - lower.x + radius); double boxRadiusSquared = temp*temp; temp = (center.y - lower.y + radius); boxRadiusSquared += temp*temp; temp = (center.z - lower.z + radius); - boxRadiusSquared += temp*temp; + boxRadiusSquared += temp*temp; // First, see if cylinder is too far away from BoundingBox - double sqDist = + double sqDist = Distance.pointToRay (center, origin, direction); if (sqDist > boxRadiusSquared ) { @@ -140,7 +140,7 @@ public final class PickCylinderRay extends PickCylinder { // Ray does not intersect, test for distance with each edge Point3d upper = new Point3d(); ((BoundingBox)bounds).getUpper (upper); - + Point3d[][] edges = { // Top horizontal 4 {upper, new Point3d (lower.x, upper.y, upper.z)}, @@ -161,7 +161,7 @@ public final class PickCylinderRay extends PickCylinder { for (int i=0;i<edges.length;i++) { // System.err.println ("Testing edge: "+edges[i][0]+" - "+edges[i][1]); - double distToEdge = + double distToEdge = Distance.rayToSegment (origin, direction, edges[i][0], edges[i][1]); if (distToEdge <= radius*radius) { // System.err.println ("Intersects!"); @@ -185,7 +185,7 @@ public final class PickCylinderRay extends PickCylinder { bsphere.getCenter (sphCenter); double sphRadius = bsphere.getRadius(); - double sqDist = + double sqDist = Distance.pointToRay (sphCenter, origin, direction); if (sqDist > (sphRadius+radius) * (sphRadius+radius)) { return false; // we are too far to intersect @@ -210,12 +210,12 @@ public final class PickCylinderRay extends PickCylinder { midpt.y = (ptope.verts[i].y + ptope.verts[j].y) * 0.5; midpt.z = (ptope.verts[i].z + ptope.verts[j].z) * 0.5; - if (! PickCylinder.pointInPolytope (ptope, + if (! PickCylinder.pointInPolytope (ptope, midpt.x, midpt.y, midpt.z)) { continue; } - distToEdge = - Distance.rayToSegment (origin, direction, + distToEdge = + Distance.rayToSegment (origin, direction, ptope.verts[i], ptope.verts[j]); if (distToEdge <= radius*radius) { return true; @@ -234,9 +234,9 @@ public final class PickCylinderRay extends PickCylinder { // Only use within J3D. - // Return a new PickCylinderRay that is the transformed (t3d) of this pickCylinderRay. + // Return a new PickCylinderRay that is the transformed (t3d) of this pickCylinderRay. PickShape transform(Transform3D t3d) { - + PickCylinderRay newPCR = new PickCylinderRay(); Point3d end = new Point3d(); /* @@ -251,15 +251,15 @@ public final class PickCylinderRay extends PickCylinder { end.x = origin.x + direction.x; end.y = origin.y + direction.y; end.z = origin.z + direction.z; - + t3d.transform(newPCR.origin); t3d.transform(end); - + newPCR.direction.x = end.x - newPCR.origin.x; newPCR.direction.y = end.y - newPCR.origin.y; newPCR.direction.z = end.z - newPCR.origin.z; newPCR.direction.normalize(); - + return newPCR; } diff --git a/src/classes/share/javax/media/j3d/PickCylinderSegment.java b/src/classes/share/javax/media/j3d/PickCylinderSegment.java index 3942556..0b97cf6 100644 --- a/src/classes/share/javax/media/j3d/PickCylinderSegment.java +++ b/src/classes/share/javax/media/j3d/PickCylinderSegment.java @@ -71,7 +71,7 @@ public final class PickCylinderSegment extends PickCylinder { this.radius = radius; calcDirection(); // calculate direction, based on start and end } - + /** * Sets the parameters of this PickCylinderSegment to the specified values. * @param origin the origin point of the cylindrical segment. @@ -119,13 +119,13 @@ public final class PickCylinderSegment extends PickCylinder { if (bounds instanceof BoundingSphere) { Point3d sphCenter = ((BoundingSphere)bounds).getCenter(); double sphRadius = ((BoundingSphere)bounds).getRadius(); - double sqDist = + double sqDist = Distance.pointToSegment (sphCenter, origin, end); if (sqDist <= (sphRadius+radius)*(sphRadius+radius)) { - return true; + return true; } return false; // we are too far to intersect - } + } // // ================ BOUNDING BOX ================ // @@ -141,10 +141,10 @@ public final class PickCylinderSegment extends PickCylinder { temp = (center.y - lower.y + radius); boxRadiusSquared += temp*temp; temp = (center.z - lower.z + radius); - boxRadiusSquared += temp*temp; + boxRadiusSquared += temp*temp; // First, see if cylinder is too far away from BoundingBox - double sqDist = + double sqDist = Distance.pointToSegment (center, origin, end); if (sqDist > boxRadiusSquared) { return false; // we are too far to intersect @@ -161,7 +161,7 @@ public final class PickCylinderSegment extends PickCylinder { // Ray does not intersect, test for distance with each edge Point3d upper = new Point3d(); ((BoundingBox)bounds).getUpper (upper); - + Point3d[][] edges = { // Top horizontal 4 {upper, new Point3d (lower.x, upper.y, upper.z)}, @@ -181,8 +181,8 @@ public final class PickCylinderSegment extends PickCylinder { }; for (int i=0;i<edges.length;i++) { // System.err.println ("Testing edge: "+edges[i][0]+" - "+edges[i][1]); - double distToEdge = - Distance.segmentToSegment (origin, end, + double distToEdge = + Distance.segmentToSegment (origin, end, edges[i][0], edges[i][1]); if (distToEdge <= radius*radius) { // System.err.println ("Intersects!"); @@ -205,7 +205,7 @@ public final class PickCylinderSegment extends PickCylinder { bsphere.getCenter (sphCenter); double sphRadius = bsphere.getRadius(); - double sqDist = + double sqDist = Distance.pointToSegment (sphCenter, origin, end); if (sqDist > (sphRadius+radius)*(sphRadius+radius)) { return false; // we are too far to intersect @@ -230,12 +230,12 @@ public final class PickCylinderSegment extends PickCylinder { midpt.y = (ptope.verts[i].y + ptope.verts[j].y) * 0.5; midpt.z = (ptope.verts[i].z + ptope.verts[j].z) * 0.5; - if (! PickCylinder.pointInPolytope (ptope, + if (! PickCylinder.pointInPolytope (ptope, midpt.x, midpt.y, midpt.z)) { continue; } - distToEdge = - Distance.segmentToSegment (origin, end, + distToEdge = + Distance.segmentToSegment (origin, end, ptope.verts[i], ptope.verts[j]); if (distToEdge <= radius*radius) { return true; @@ -254,11 +254,11 @@ public final class PickCylinderSegment extends PickCylinder { // Only use within J3D. // Return a new PickCylinderSegment that is the transformed (t3d) of this - // pickCylinderSegment. + // pickCylinderSegment. PickShape transform(Transform3D t3d) { - + PickCylinderSegment newPCS = new PickCylinderSegment(); - + newPCS.origin.x = origin.x; newPCS.origin.y = origin.y; newPCS.origin.z = origin.z; @@ -266,15 +266,15 @@ public final class PickCylinderSegment extends PickCylinder { newPCS.end.x = end.x; newPCS.end.y = end.y; newPCS.end.z = end.z; - + t3d.transform(newPCS.origin); t3d.transform(newPCS.end); - + newPCS.direction.x = newPCS.end.x - newPCS.origin.x; newPCS.direction.y = newPCS.end.y - newPCS.origin.y; newPCS.direction.z = newPCS.end.z - newPCS.origin.z; newPCS.direction.normalize(); - + return newPCS; } diff --git a/src/classes/share/javax/media/j3d/PickInfo.java b/src/classes/share/javax/media/j3d/PickInfo.java index b51ec82..3d5cc76 100644 --- a/src/classes/share/javax/media/j3d/PickInfo.java +++ b/src/classes/share/javax/media/j3d/PickInfo.java @@ -35,23 +35,23 @@ import javax.vecmath.*; import java.util.*; /** - * The PickInfo object contains the computed information about a pick hit. - * The detailed information about each intersection of the PickShape + * The PickInfo object contains the computed information about a pick hit. + * The detailed information about each intersection of the PickShape * with the picked Node can be inquired. The PickInfo object is constructed with * basic information and more detailed information can be generated by setting the - * appropriate mask to the flag argument in the pick methods of BranchGroup and + * appropriate mask to the flag argument in the pick methods of BranchGroup and * Locale. * <p> * * @see Locale - * @see BranchGroup + * @see BranchGroup * * @since Java 3D 1.4 */ public class PickInfo extends Object { - + static final int PICK_ALL = 1; static final int PICK_ANY = 2; @@ -61,50 +61,50 @@ public class PickInfo extends Object { /* The intersected pickable node object */ private Node node; - + /* A copy of LocalToVworld transform of the pickable node */ private Transform3D l2vw; /* The closest intersection point */ private Point3d closestIntersectionPoint; - + /* Distance between start point of pickShape and closest intersection point */ private double closestDistance; /* An array to store intersection results */ private IntersectionInfo[] intersectionInfoArr; - + /* The following references are for internal geometry computation use only */ private ArrayList intersectionInfoList = new ArrayList(); private boolean intersectionInfoListSorted = false; private Transform3D l2vwRef; private Node nodeRef; - + /** * Specifies a Pick using the bounds of the pickable nodes. */ public static final int PICK_BOUNDS = 1; - + /** * Specifies a Pick using the geometry of the pickable nodes. */ public static final int PICK_GEOMETRY = 2; - + /** * Specifies that this PickInfo returns the computed SceneGraphPath object. */ public static final int SCENEGRAPHPATH = 0x01; - + /** * Specifies that this PickInfo returns the computed intersected Node object. */ public static final int NODE = 0x02; - + /** * Specifies that this PickInfo returns the computed local to vworld transform. */ public static final int LOCAL_TO_VWORLD = 0x04; - + /** * Specifies that this PickInfo returns the closest intersection point. */ @@ -116,13 +116,13 @@ public class PickInfo extends Object { public static final int CLOSEST_DISTANCE = 0x10; /** - * Specifies that this PickInfo returns only the closest intersection + * Specifies that this PickInfo returns only the closest intersection * geometry information. */ public static final int CLOSEST_GEOM_INFO = 0x20; /** - * Specifies that this PickInfo returns all the closest intersection + * Specifies that this PickInfo returns all the closest intersection * geometry informations. */ public static final int ALL_GEOM_INFO = 0x40; @@ -132,48 +132,48 @@ public class PickInfo extends Object { PickInfo() { } - + void setSceneGraphPath(SceneGraphPath sgp) { this.sgp = sgp; } - + void setNode(Node node) { this.node = node; } - + void setLocalToVWorld(Transform3D l2vw) { this.l2vw = l2vw; } - + void setClosestIntersectionPoint(Point3d cIPt) { this.closestIntersectionPoint = cIPt; } - + void setClosestDistance(double cDist) { this.closestDistance = cDist; } - + void setLocalToVWorldRef(Transform3D l2vwRef) { this.l2vwRef = l2vwRef; } - + void setNodeRef(Node nodeRef) { this.nodeRef = nodeRef; } - + IntersectionInfo createIntersectionInfo() { return new IntersectionInfo(); } - + void insertIntersectionInfo(IntersectionInfo iInfo) { intersectionInfoList.add(iInfo); intersectionInfoListSorted = false; } - + void sortIntersectionInfoArray(IntersectionInfo[] iInfoArr) { class Sort { - + IntersectionInfo iInfoArr[]; Sort(IntersectionInfo[] iInfoArr) { @@ -186,7 +186,7 @@ public class PickInfo extends Object { // System.err.println(" -- insertSort."); insertSort(); } else { - // System.err.println(" -- quicksort."); + // System.err.println(" -- quicksort."); quicksort(0, iInfoArr.length-1); } } @@ -194,7 +194,7 @@ public class PickInfo extends Object { // Insertion sort on smallest arrays final void insertSort() { for (int i=0; i<iInfoArr.length; i++) { - for (int j=i; j>0 && + for (int j=i; j>0 && (iInfoArr[j-1].distance > iInfoArr[j].distance); j--) { IntersectionInfo iInfo = iInfoArr[j]; iInfoArr[j] = iInfoArr[j-1]; @@ -211,7 +211,7 @@ public class PickInfo extends Object { do { while (iInfoArr[i].distance<k) i++; while (k<iInfoArr[j].distance) j--; - if (i<=j) { + if (i<=j) { IntersectionInfo iInfo = iInfoArr[i]; iInfoArr[i] = iInfoArr[j]; iInfoArr[j] = iInfo; @@ -219,20 +219,20 @@ public class PickInfo extends Object { j--; } } while (i<=j); - + if (l<j) quicksort(l,j); if (l<r) quicksort(i,r); } } - (new Sort(iInfoArr)).sorting(); + (new Sort(iInfoArr)).sorting(); intersectionInfoListSorted = true; } static void sortPickInfoArray(PickInfo[] pickInfoArr) { - + class Sort { - + PickInfo pIArr[]; Sort(PickInfo[] pIArr) { @@ -245,7 +245,7 @@ public class PickInfo extends Object { // System.err.println(" -- insertSort."); insertSort(); } else { - // System.err.println(" -- quicksort."); + // System.err.println(" -- quicksort."); quicksort(0, pIArr.length-1); } } @@ -253,7 +253,7 @@ public class PickInfo extends Object { // Insertion sort on smallest arrays final void insertSort() { for (int i=0; i<pIArr.length; i++) { - for (int j=i; j>0 && + for (int j=i; j>0 && (pIArr[j-1].closestDistance > pIArr[j].closestDistance); j--) { PickInfo pI = pIArr[j]; pIArr[j] = pIArr[j-1]; @@ -270,7 +270,7 @@ public class PickInfo extends Object { do { while (pIArr[i].closestDistance<k) i++; while (k<pIArr[j].closestDistance) j--; - if (i<=j) { + if (i<=j) { PickInfo pI = pIArr[i]; pIArr[i] = pIArr[j]; pIArr[j] = pI; @@ -278,17 +278,17 @@ public class PickInfo extends Object { j--; } } while (i<=j); - + if (l<j) quicksort(l,j); if (l<r) quicksort(i,r); } } - (new Sort(pickInfoArr)).sorting(); - + (new Sort(pickInfoArr)).sorting(); + } - + /** * Retrieves the reference to the SceneGraphPath in this PickInfo object. * @return the SceneGraphPath object, or null if flag is not set with SCENEGRAPHPATH. @@ -318,7 +318,7 @@ public class PickInfo extends Object { public Transform3D getLocalToVWorld() { return l2vw; } - + /** * Retrieves the reference to the closest intersection point in this PickInfo object. * @return the closest intersection point, or null if flag is not set with CLOSEST_INTERSECTION_POINT. @@ -344,16 +344,16 @@ public class PickInfo extends Object { Transform3D getLocalToVWorldRef() { return l2vwRef; } - + Node getNodeRef() { return nodeRef; } - + /** * Retrieves the reference to the array of intersection results in this PickInfo object. * @return an array of 1 IntersectionInfo object if flag is to set CLOSEST_GEOM_INFO, - * or an array of <i>N</i> IntersectionInfo objects containing all intersections of - * the picked node in sorted order if flag is to set ALL_GEOM_INFO, or null if neither + * or an array of <i>N</i> IntersectionInfo objects containing all intersections of + * the picked node in sorted order if flag is to set ALL_GEOM_INFO, or null if neither * bit is set. * @see Locale * @see BranchGroup @@ -363,45 +363,45 @@ public class PickInfo extends Object { intersectionInfoArr = new IntersectionInfo[intersectionInfoList.size()]; intersectionInfoArr = (IntersectionInfo []) intersectionInfoList.toArray(intersectionInfoArr); - - sortIntersectionInfoArray(intersectionInfoArr); + + sortIntersectionInfoArray(intersectionInfoArr); } - + return intersectionInfoArr; } - + /** * Search the path from nodeR up to Locale. * Return the search path as ArrayList if found. * Note that the locale will not insert into path. */ - static ArrayList initSceneGraphPath(NodeRetained nodeR) { + static ArrayList initSceneGraphPath(NodeRetained nodeR) { ArrayList path = new ArrayList(5); do { if (nodeR.source.getCapability(Node.ENABLE_PICK_REPORTING)){ - path.add(nodeR); + path.add(nodeR); } nodeR = nodeR.parent; } while (nodeR != null); // reach Locale return path; - } + } static private Node[] createPath(NodeRetained srcNode, BranchGroupRetained bgRetained, GeometryAtom geomAtom, ArrayList initpath) { - + ArrayList path = retrievePath(srcNode, bgRetained, geomAtom.source.key); assert(path != null); - + return mergePath(path, initpath); } - - + + /** * Return true if bg is inside cachedBG or bg is null */ @@ -424,16 +424,16 @@ public class PickInfo extends Object { * search the full path from the bottom of the scene graph - * startNode, up to the Locale if endNode is null. * If endNode is not null, the path is found up to, but not - * including, endNode or return null if endNode not hit + * including, endNode or return null if endNode not hit * during the search. */ - static private ArrayList retrievePath(NodeRetained startNode, + static private ArrayList retrievePath(NodeRetained startNode, NodeRetained endNode, HashKey key) { ArrayList path = new ArrayList(5); NodeRetained nodeR = startNode; - + if (nodeR.inSharedGroup) { // getlastNodeId() will destroy this key key = new HashKey(key); @@ -445,7 +445,7 @@ public class PickInfo extends Object { } if (nodeR.source.getCapability(Node.ENABLE_PICK_REPORTING)) { - path.add(nodeR); + path.add(nodeR); } if (nodeR instanceof SharedGroupRetained) { @@ -460,20 +460,20 @@ public class PickInfo extends Object { nodeR = linkR; // Need to add Link to the path report path.add(nodeR); - // since !(endNode instanceof Link), we + // since !(endNode instanceof Link), we // can skip the check (nodeR == endNode) and // proceed to parent of link below break; } } - if (nodeR == prevNodeR) { + if (nodeR == prevNodeR) { // branch is already detach return null; } } nodeR = nodeR.parent; } while (nodeR != null); // reach Locale - + if (endNode == null) { // user call pickxxx(Locale locale, PickShape shape) return path; @@ -481,10 +481,10 @@ public class PickInfo extends Object { // user call pickxxx(BranchGroup endNode, PickShape shape) // if locale is reached and endNode not hit, this is not - // the path user want to select + // the path user want to select return null; } - + /** * copy p1, (follow by) p2 into a new array, p2 can be null * The path is then reverse before return. @@ -515,19 +515,19 @@ public class PickInfo extends Object { * Sort the GeometryAtoms distance from shape in ascending order * geomAtoms.length must be >= 1 */ - static void sortGeomAtoms(GeometryAtom geomAtoms[], + static void sortGeomAtoms(GeometryAtom geomAtoms[], PickShape shape) { final double distance[] = new double[geomAtoms.length]; Point4d pickPos = new Point4d(); for (int i=0; i < geomAtoms.length; i++) { - shape.intersect(geomAtoms[i].source.vwcBounds, pickPos); + shape.intersect(geomAtoms[i].source.vwcBounds, pickPos); distance[i] = pickPos.w; } class Sort { - + GeometryAtom atoms[]; Sort(GeometryAtom[] atoms) { @@ -545,7 +545,7 @@ public class PickInfo extends Object { // Insertion sort on smallest arrays final void insertSort() { for (int i=0; i<atoms.length; i++) { - for (int j=i; j>0 && + for (int j=i; j>0 && (distance[j-1] > distance[j]); j--) { double t = distance[j]; distance[j] = distance[j-1]; @@ -569,7 +569,7 @@ public class PickInfo extends Object { double tmp = distance[i]; distance[i] =distance[j]; distance[j] = tmp; - + GeometryAtom p=atoms[i]; atoms[i]=atoms[j]; atoms[j]=p; @@ -577,7 +577,7 @@ public class PickInfo extends Object { j--; } } while (i<=j); - + if (l<j) quicksort(l,j); if (l<r) quicksort(i,r); } @@ -589,14 +589,14 @@ public class PickInfo extends Object { /** * return all PickInfo[] of the geomAtoms. - * If initpath is null, the path is search from + * If initpath is null, the path is search from * geomAtom Shape3D/Morph Node up to Locale * (assume the same locale). - * Otherwise, the path is search up to node or + * Otherwise, the path is search up to node or * null is return if it is not hit. - */ - static ArrayList getPickInfos(ArrayList initpath, - BranchGroupRetained bgRetained, + */ + static ArrayList getPickInfos(ArrayList initpath, + BranchGroupRetained bgRetained, GeometryAtom geomAtoms[], Locale locale, int flags, int pickType) { @@ -607,11 +607,11 @@ public class PickInfo extends Object { if ((geomAtoms == null) || (geomAtoms.length == 0)) { return null; } - + for (int i=0; i < geomAtoms.length; i++) { assert((geomAtoms[i] != null) && (geomAtoms[i].source != null)); - + PickInfo pickInfo = null; Shape3DRetained shape = geomAtoms[i].source; srcNode = shape.sourceNode; @@ -621,13 +621,13 @@ public class PickInfo extends Object { if (!inside(shape.branchGroupPath,bgRetained)) { continue; } - + if (srcNode == null) { // The node is just detach from branch so sourceNode = null continue; } - + // Special case, for Text3DRetained, it is possible // for different geomAtoms pointing to the same // source Text3DRetained. So we need to combine @@ -640,10 +640,10 @@ public class PickInfo extends Object { if(geomR != null) break; } - + if (geomR == null) continue; - + if (geomR instanceof Text3DRetained) { // assume this case is not frequent, we allocate // ArrayList only when necessary and we use ArrayList @@ -668,28 +668,28 @@ public class PickInfo extends Object { text3dList.add(srcNode); } } - + // If srcNode is instance of compile retained, then loop thru // the entire source list and add it to the scene graph path if (srcNode instanceof Shape3DCompileRetained) { Shape3DCompileRetained s3dCR = (Shape3DCompileRetained)srcNode; - + Node[] mpath = null; boolean first = true; - + for (int n = 0; n < s3dCR.srcList.length; n++) { - + pickInfo = null; - + // PickInfo.SCENEGRAPHPATH - request for computed SceneGraphPath. if ((flags & SCENEGRAPHPATH) != 0){ - + if(first) { mpath = createPath(srcNode, bgRetained, geomAtoms[i], initpath); first = false; } - + if(mpath != null) { SceneGraphPath sgpath = new SceneGraphPath(locale, mpath, (Node) s3dCR.srcList[n]); @@ -706,7 +706,7 @@ public class PickInfo extends Object { pickInfo = new PickInfo(); pickInfo.setNode((Node) s3dCR.srcList[n]); } - + // PickInfo.LOCAL_TO_VWORLD // - request for computed local to virtual world transform. if ((flags & LOCAL_TO_VWORLD) != 0) { @@ -715,7 +715,7 @@ public class PickInfo extends Object { pickInfo = new PickInfo(); pickInfo.setLocalToVWorld( new Transform3D(l2vw)); } - + // NOTE : Piggy bag for geometry computation by caller. if (((flags & CLOSEST_DISTANCE) != 0) || ((flags & CLOSEST_GEOM_INFO) != 0) || @@ -731,18 +731,18 @@ public class PickInfo extends Object { if(pickInfo != null) pickInfoList.add(pickInfo); if(pickType == PICK_ANY) { - return pickInfoList; + return pickInfoList; } - } + } } else { Node[] mpath = null; // PickInfo.SCENEGRAPHPATH - request for computed SceneGraphPath. if ((flags & SCENEGRAPHPATH) != 0) { - + mpath = createPath(srcNode, bgRetained, geomAtoms[i], initpath); - + if(mpath != null) { SceneGraphPath sgpath = new SceneGraphPath(locale, mpath, (Node) srcNode.source); @@ -750,33 +750,33 @@ public class PickInfo extends Object { if(pickInfo == null) pickInfo = new PickInfo(); pickInfo.setSceneGraphPath(sgpath); - } + } } - + // PickInfo.NODE - request for computed intersected Node. if ((flags & NODE) != 0) { - if(pickInfo == null) + if(pickInfo == null) pickInfo = new PickInfo(); pickInfo.setNode((Node) srcNode.source); } - + // PickInfo.LOCAL_TO_VWORLD // - request for computed local to virtual world transform. if ((flags & LOCAL_TO_VWORLD) != 0) { Transform3D l2vw = geomAtoms[i].source.getCurrentLocalToVworld(); - if(pickInfo == null) + if(pickInfo == null) pickInfo = new PickInfo(); pickInfo.setLocalToVWorld( new Transform3D(l2vw)); } - + // NOTE : Piggy bag for geometry computation by caller. if (((flags & CLOSEST_DISTANCE) != 0) || ((flags & CLOSEST_GEOM_INFO) != 0) || ((flags & CLOSEST_INTERSECTION_POINT) != 0) || ((flags & ALL_GEOM_INFO) != 0)) { - if(pickInfo == null) + if(pickInfo == null) pickInfo = new PickInfo(); - pickInfo.setNodeRef((Node) srcNode.source); + pickInfo.setNodeRef((Node) srcNode.source); Transform3D l2vw = geomAtoms[i].source.getCurrentLocalToVworld(); pickInfo.setLocalToVWorldRef(l2vw); } @@ -784,7 +784,7 @@ public class PickInfo extends Object { if(pickInfo != null) pickInfoList.add(pickInfo); if(pickType == PICK_ANY) { - return pickInfoList; + return pickInfoList; } } } @@ -801,7 +801,7 @@ public class PickInfo extends Object { BranchGroupRetained bgRetained = null; ArrayList initPath = null; ArrayList pickInfoList = null; - + if (node instanceof Locale) { locale = (Locale) node; } @@ -811,30 +811,30 @@ public class PickInfo extends Object { } synchronized (locale.universe.sceneGraphLock) { if ( bgRetained != null) { - initPath = initSceneGraphPath(bgRetained); + initPath = initSceneGraphPath(bgRetained); } pickInfoList = getPickInfos(initPath, bgRetained, geomAtoms, locale, flags, pickType); } - + // We're done with PICK_BOUNDS case, but there is still more work for PICK_GEOMETRY case. - if((mode == PICK_GEOMETRY) && (pickInfoList != null) && + if((mode == PICK_GEOMETRY) && (pickInfoList != null) && ((pickInfoListSize = pickInfoList.size()) > 0)) { - + //System.err.println("PickInfo.pick() - In geometry case : pickInfoList.size() is " + pickInfoListSize); PickInfo pickInfo = null; Node pickNode = null; - - // Order is impt. Need to do in reverse order. + + // Order is impt. Need to do in reverse order. for(int i = pickInfoListSize - 1; i >= 0; i--) { pickInfo = (PickInfo) pickInfoList.get(i); - + pickNode = pickInfo.getNode(); if( pickNode == null) { // Use the piggy reference from getPickInfos() - pickNode = pickInfo.getNodeRef(); + pickNode = pickInfo.getNodeRef(); } - + if (pickNode instanceof Shape3D) { /* @@ -848,23 +848,23 @@ public class PickInfo extends Object { * or ALL_GEOM_INFO, and the capability bits that control reading of * coordinate data are not set in any GeometryArray object referred * to by any shape node that intersects the PickShape. - * The capability bits that must be set to avoid this exception are + * The capability bits that must be set to avoid this exception are * as follows : - * + * * By-copy geometry : GeometryArray.ALLOW_COORDINATE_READ * By-reference geometry : GeometryArray.ALLOW_REF_DATA_READ * Indexed geometry : IndexedGeometryArray.ALLOW_COORDINATE_INDEX_READ * (in addition to one of the above) - * + * */ - + if (!pickNode.getCapability(Shape3D.ALLOW_GEOMETRY_READ)) { throw new CapabilityNotSetException(J3dI18N.getString("PickInfo0")); } - + for (int j = 0; j < ((Shape3D)pickNode).numGeometries(); j++) { Geometry geo = ((Shape3D)pickNode).getGeometry(j); - + if(geo == null) { continue; } @@ -879,21 +879,21 @@ public class PickInfo extends Object { if(!geo.getCapability(GeometryArray.ALLOW_COUNT_READ)) throw new CapabilityNotSetException(J3dI18N.getString("PickInfo3")); if(!geo.getCapability(GeometryArray.ALLOW_FORMAT_READ)) - throw new CapabilityNotSetException(J3dI18N.getString("PickInfo4")); + throw new CapabilityNotSetException(J3dI18N.getString("PickInfo4")); if (geo instanceof IndexedGeometryArray) { if(!geo.getCapability(IndexedGeometryArray.ALLOW_COORDINATE_INDEX_READ)) throw new CapabilityNotSetException(J3dI18N.getString("PickInfo5")); - } + } } else if (geo instanceof CompressedGeometry) { if(!geo.getCapability(CompressedGeometry.ALLOW_GEOMETRY_READ)) throw new CapabilityNotSetException(J3dI18N.getString("PickInfo0")); } } - + if (((Shape3DRetained)(pickNode.retained)).intersect(pickInfo, pickShape, flags) == false) { // System.err.println(" ---- geom " + i + " not intersected"); - pickInfoList.remove(i); + pickInfoList.remove(i); } else if(pickType == PICK_ANY) { @@ -902,7 +902,7 @@ public class PickInfo extends Object { return pickInfoArr; } } else if (pickNode instanceof Morph) { - + /* * @exception CapabilityNotSetException if the mode is * PICK_GEOMETRY and the Geometry.ALLOW_INTERSECT capability bit @@ -914,20 +914,20 @@ public class PickInfo extends Object { * or ALL_GEOM_INFO, and the capability bits that control reading of * coordinate data are not set in any GeometryArray object referred * to by any shape node that intersects the PickShape. - * The capability bits that must be set to avoid this exception are + * The capability bits that must be set to avoid this exception are * as follows : - * + * * By-copy geometry : GeometryArray.ALLOW_COORDINATE_READ * By-reference geometry : GeometryArray.ALLOW_REF_DATA_READ * Indexed geometry : IndexedGeometryArray.ALLOW_COORDINATE_INDEX_READ * (in addition to one of the above) - * + * */ if (!pickNode.getCapability(Morph.ALLOW_GEOMETRY_ARRAY_READ)) { throw new CapabilityNotSetException(J3dI18N.getString("PickInfo6")); } - + int numGeo = ((MorphRetained)(pickNode.retained)).getNumGeometryArrays(); for (int j = 0; j < numGeo; j++) { GeometryArray geo = ((Morph)pickNode).getGeometryArray(j); @@ -946,21 +946,21 @@ public class PickInfo extends Object { throw new CapabilityNotSetException(J3dI18N.getString("PickInfo3")); if(!geo.getCapability(GeometryArray.ALLOW_FORMAT_READ)) throw new CapabilityNotSetException(J3dI18N.getString("PickInfo4")); - + if (geo instanceof IndexedGeometryArray) { if(!geo.getCapability(IndexedGeometryArray.ALLOW_COORDINATE_INDEX_READ)) - throw new CapabilityNotSetException(J3dI18N.getString("PickInfo5")); + throw new CapabilityNotSetException(J3dI18N.getString("PickInfo5")); } } if (((MorphRetained)(pickNode.retained)).intersect(pickInfo, pickShape, flags) == false) { - pickInfoList.remove(i); + pickInfoList.remove(i); } else if(pickType == PICK_ANY) { pickInfoArr = new PickInfo[1]; pickInfoArr[0] = pickInfo; - return pickInfoArr; - } + return pickInfoArr; + } } } } @@ -969,37 +969,37 @@ public class PickInfo extends Object { if ((pickInfoList != null) && (pickInfoList.size() > 0)) { // System.err.println(" --- : pickInfoList.size() " + pickInfoList.size()); - // System.err.println(" --- : pickInfoList's sgp " + + // System.err.println(" --- : pickInfoList's sgp " + // ((PickInfo)(pickInfoList.get(0))).getSceneGraphPath()); pickInfoArr = new PickInfo[pickInfoList.size()]; - return (PickInfo []) pickInfoList.toArray(pickInfoArr); + return (PickInfo []) pickInfoList.toArray(pickInfoArr); } - + return null; - + } - + /** - * The IntersectionInfo object holds extra information about an intersection - * of a PickShape with a Node as part of a PickInfo. Information such as - * the intersected geometry, the intersected point, and the vertex indices - * can be inquired. + * The IntersectionInfo object holds extra information about an intersection + * of a PickShape with a Node as part of a PickInfo. Information such as + * the intersected geometry, the intersected point, and the vertex indices + * can be inquired. * The local coordinates, normal, color and texture coordiantes of at the - * intersection can be computed, if they are present and readable, using the + * intersection can be computed, if they are present and readable, using the * interpolation weights and vertex indices. * <p> * If the Shape3D being picked has multiple geometry arrays, the possible arrays - * of IntersectionInfo are stored in the PickInfo and referred to by a geometry - * index. If the picked geometry is of type, Text3D or CompressGeometry, - * getVertexIndices is invalid. If the picked Node is an Morph + * of IntersectionInfo are stored in the PickInfo and referred to by a geometry + * index. If the picked geometry is of type, Text3D or CompressGeometry, + * getVertexIndices is invalid. If the picked Node is an Morph * object, the geometry used in pick computation is alway at index 0. * <p> * * @since Java 3D 1.4 - */ - + */ + public class IntersectionInfo extends Object { - + /* The index to the intersected geometry in the pickable node */ private int geomIndex; @@ -1012,11 +1012,11 @@ public class PickInfo extends Object { /* Distance between start point of pickShape and intersection point */ private double distance; - /* The vertex indices of the intersected primitive in the geometry */ + /* The vertex indices of the intersected primitive in the geometry */ private int[] vertexIndices; /* The interpolation weights for each of the verticies of the primitive */ - // private float[] weights; Not supported. Should be done in util. package + // private float[] weights; Not supported. Should be done in util. package /** IntersectionInfo Constructor */ IntersectionInfo() { @@ -1026,20 +1026,20 @@ public class PickInfo extends Object { void setGeometryIndex(int geomIndex) { this.geomIndex = geomIndex; } - + void setGeometry(Geometry geom) { this.geom = geom; } - + void setIntersectionPoint(Point3d intersectionPoint) { assert(intersectionPoint != null); this.intersectionPoint = new Point3d(intersectionPoint); } - + void setDistance(double distance) { this.distance = distance; - } - + } + void setVertexIndices(int[] vertexIndices) { assert(vertexIndices != null); this.vertexIndices = new int[vertexIndices.length]; @@ -1048,7 +1048,7 @@ public class PickInfo extends Object { } } - + /** * Retrieves the index to the intersected geometry in the picked node, either a Shape3D or Morph. * @return the index of the intersected geometry in the pickable node. @@ -1074,15 +1074,15 @@ public class PickInfo extends Object { } /** - * Retrieves the distance between the start point of the pickShape and the + * Retrieves the distance between the start point of the pickShape and the * intersection point. - * @return distance between the start point of the pickShape and the + * @return distance between the start point of the pickShape and the * intersection point. */ - public double getDistance() { + public double getDistance() { return distance; } - + /** * Retrieves the vertex indices of the intersected primitive in the geometry. * @return the vertex indices of the intersected primitive. diff --git a/src/classes/share/javax/media/j3d/PickPoint.java b/src/classes/share/javax/media/j3d/PickPoint.java index d83ccd2..9c50b74 100644 --- a/src/classes/share/javax/media/j3d/PickPoint.java +++ b/src/classes/share/javax/media/j3d/PickPoint.java @@ -93,23 +93,23 @@ public final class PickPoint extends PickShape { } // Only use within J3D. - // Return a new PickPoint that is the transformed (t3d) of this pickPoint. + // Return a new PickPoint that is the transformed (t3d) of this pickPoint. PickShape transform(Transform3D t3d) { - + PickPoint newPPt = new PickPoint(); - + newPPt.location.x = location.x; newPPt.location.y = location.y; newPPt.location.z = location.z; - + t3d.transform(newPPt.location); - + return newPPt; } Point3d getStartPoint() { return location; - } + } int getPickType() { return PICKPOINT; diff --git a/src/classes/share/javax/media/j3d/PickRay.java b/src/classes/share/javax/media/j3d/PickRay.java index db71b33..7c52831 100644 --- a/src/classes/share/javax/media/j3d/PickRay.java +++ b/src/classes/share/javax/media/j3d/PickRay.java @@ -105,25 +105,25 @@ public final class PickRay extends PickShape { // Only use within J3D. - // Return a new PickRay that is the transformed (t3d) of this pickRay. + // Return a new PickRay that is the transformed (t3d) of this pickRay. PickShape transform(Transform3D t3d) { Point3d end = new Point3d(); - + PickRay newPR = new PickRay(origin, direction); - + end.x = origin.x + direction.x; end.y = origin.y + direction.y; end.z = origin.z + direction.z; - + t3d.transform(newPR.origin); t3d.transform(end); - + newPR.direction.x = end.x - newPR.origin.x; newPR.direction.y = end.y - newPR.origin.y; newPR.direction.z = end.z - newPR.origin.z; newPR.direction.normalize(); - + return newPR; } diff --git a/src/classes/share/javax/media/j3d/PickSegment.java b/src/classes/share/javax/media/j3d/PickSegment.java index f7b1841..2a449d0 100644 --- a/src/classes/share/javax/media/j3d/PickSegment.java +++ b/src/classes/share/javax/media/j3d/PickSegment.java @@ -45,7 +45,7 @@ public final class PickSegment extends PickShape { Point3d start; Point3d end; - /** + /** * Constructs an empty PickSegment. * The start and end points of the line segment are * initialized to (0,0,0). @@ -105,9 +105,9 @@ public final class PickSegment extends PickShape { } - + // Only use within J3D. - // Return a new PickSegment that is the transformed (t3d) of this pickSegment. + // Return a new PickSegment that is the transformed (t3d) of this pickSegment. PickShape transform(Transform3D t3d) { PickSegment newPS = new PickSegment(start, end); t3d.transform(newPS.start); diff --git a/src/classes/share/javax/media/j3d/PickShape.java b/src/classes/share/javax/media/j3d/PickShape.java index 82c9ad1..975f32b 100644 --- a/src/classes/share/javax/media/j3d/PickShape.java +++ b/src/classes/share/javax/media/j3d/PickShape.java @@ -45,12 +45,12 @@ public abstract class PickShape { // Use for picking static final int PICKRAY = 1; static final int PICKSEGMENT = 2; - static final int PICKPOINT = 3; - static final int PICKCYLINDER = 4; - static final int PICKCONE = 5; - static final int PICKBOUNDINGBOX = 6; - static final int PICKBOUNDINGSPHERE = 7; - static final int PICKBOUNDINGPOLYTOPE = 8; + static final int PICKPOINT = 3; + static final int PICKCYLINDER = 4; + static final int PICKCONE = 5; + static final int PICKBOUNDINGBOX = 6; + static final int PICKBOUNDINGSPHERE = 7; + static final int PICKBOUNDINGPOLYTOPE = 8; static final int PICKUNKNOWN = 9; /** @@ -63,7 +63,7 @@ public abstract class PickShape { * Return true if shape intersect with bounds. * The point of intersection is stored in pickPos. */ - abstract boolean intersect(Bounds bounds, Point4d pickPos); + abstract boolean intersect(Bounds bounds, Point4d pickPos); // Only use within J3D. // Return a new PickShape that is the transformed (t3d) of this pickShape. @@ -81,7 +81,7 @@ public abstract class PickShape { double y = iPnt.y - p.y; double z = iPnt.z - p.z; return Math.sqrt(x*x + y*y + z*z); - } + } // Return one of PickShape type constant define above abstract int getPickType(); diff --git a/src/classes/share/javax/media/j3d/Pipeline.java b/src/classes/share/javax/media/j3d/Pipeline.java index af8bbb1..f021b1a 100644 --- a/src/classes/share/javax/media/j3d/Pipeline.java +++ b/src/classes/share/javax/media/j3d/Pipeline.java @@ -44,7 +44,7 @@ abstract class Pipeline { // Native rendering pipelines using OGL or D3D library NATIVE_OGL, NATIVE_D3D, - + // Java rendering pipeline using Java Bindings for OpenGL JOGL, @@ -129,7 +129,7 @@ abstract class Pipeline { return true; } - + /** * Initialize the Pipeline. Called exactly once by * MasterControl.loadLibraries() to create the singleton @@ -355,7 +355,7 @@ abstract class Pipeline { int vcount, int vformat, int texCoordSetCount, int[] texCoordSetMap, int texCoordSetMapLen, int[] texCoordSetMapOffset, - int vertexAttrCount, int[] vertexAttrSizes, + int vertexAttrCount, int[] vertexAttrSizes, double[] xform, double[] nxform, float[] varray); @@ -519,7 +519,7 @@ abstract class Pipeline { Object imageBuffer, int depthFormat, Object depthBuffer); - + // --------------------------------------------------------------------- // @@ -1072,7 +1072,7 @@ abstract class Pipeline { int imgXOffset, int imgYOffset, int tilew, int width, int height, int imageDataType, Object data, boolean useAutoMipMap); - + abstract void updateTexture2DLodRange(Context ctx, int baseLevel, int maximumLevel, float minimumLod, float maximumLod); @@ -1166,14 +1166,14 @@ abstract class Pipeline { int width, int height, int boundaryWidth, int imageDataType, Object imageData, boolean useAutoMipMap); - + abstract void updateTextureCubeMapSubImage(Context ctx, int face, int level, int xoffset, int yoffset, int textureFormat, int imageFormat, int imgXOffset, int imgYOffset, int tilew, int width, int height, int imageDataType, Object imageData, boolean useAutoMipMap); - + abstract void updateTextureCubeMapLodRange(Context ctx, int baseLevel, int maximumLevel, float minimumLod, float maximumLod); @@ -1212,7 +1212,7 @@ abstract class Pipeline { // Method to initialize the native J3D library abstract boolean initializeJ3D(boolean disableXinerama); - // Maximum lights supported by the native API + // Maximum lights supported by the native API abstract int getMaximumLights(); @@ -1372,19 +1372,19 @@ abstract class Pipeline { boolean releaseCtx(Context ctx, long dpy) { return false; } - + abstract void clear(Context ctx, float r, float g, float b, boolean clearStencil); - + abstract void textureFillBackground(Context ctx, float texMinU, float texMaxU, float texMinV, float texMaxV, float mapMinX, float mapMaxX, float mapMinY, float mapMaxY, boolean useBiliearFilter); - + abstract void textureFillRaster(Context ctx, float texMinU, float texMaxU, float texMinV, float texMaxV, float mapMinX, float mapMaxX, float mapMinY, float mapMaxY, float mapZ, float alpha, boolean useBiliearFilter); - abstract void executeRasterDepth(Context ctx, float posX, float posY, float posZ, - int srcOffsetX, int srcOffsetY, int rasterWidth, int rasterHeight, int depthWidth, int depthHeight, - int depthType, Object depthData); - + abstract void executeRasterDepth(Context ctx, float posX, float posY, float posZ, + int srcOffsetX, int srcOffsetY, int rasterWidth, int rasterHeight, int depthWidth, int depthHeight, + int depthType, Object depthData); + // The native method for setting the ModelView matrix. abstract void setModelViewMatrix(Context ctx, double[] viewMatrix, double[] modelMatrix); @@ -1457,7 +1457,7 @@ abstract class Pipeline { abstract int getStencilSize(Canvas3D cv); abstract boolean hasSceneAntialiasingMultisample(Canvas3D cv); abstract boolean hasSceneAntialiasingAccum(Canvas3D cv); - + // Methods to get native WS display and screen abstract long getDisplay(); abstract int getScreen(GraphicsDevice graphicsDevice); diff --git a/src/classes/share/javax/media/j3d/PointArray.java b/src/classes/share/javax/media/j3d/PointArray.java index 82292ff..b22aced 100644 --- a/src/classes/share/javax/media/j3d/PointArray.java +++ b/src/classes/share/javax/media/j3d/PointArray.java @@ -159,7 +159,7 @@ public class PointArray extends GeometryArray { this.retained.setSource(this); } - + /** * @deprecated replaced with cloneNodeComponent(boolean forceDuplicate) */ diff --git a/src/classes/share/javax/media/j3d/PointArrayRetained.java b/src/classes/share/javax/media/j3d/PointArrayRetained.java index 63d21cc..9dd10d3 100644 --- a/src/classes/share/javax/media/j3d/PointArrayRetained.java +++ b/src/classes/share/javax/media/j3d/PointArrayRetained.java @@ -53,7 +53,7 @@ class PointArrayRetained extends GeometryArrayRetained { initialVertexIndex : initialCoordIndex); Point3d pnt = new Point3d(); int[] vtxIndexArr = new int[1]; - + switch (pickShape.getPickType()) { case PickShape.PICKRAY: PickRay pickRay= (PickRay) pickShape; @@ -72,27 +72,27 @@ class PointArrayRetained extends GeometryArrayRetained { y = pnt.y; z = pnt.z; if((flags & PickInfo.CLOSEST_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, + storeInterestData(pickInfo, flags, geom, geomIndex, vtxIndexArr, iPnt, sdist[0]); } } if((flags & PickInfo.ALL_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, - vtxIndexArr, iPnt, sdist[0]); + storeInterestData(pickInfo, flags, geom, geomIndex, + vtxIndexArr, iPnt, sdist[0]); } } } break; case PickShape.PICKSEGMENT: PickSegment pickSegment = (PickSegment) pickShape; - Vector3d dir = - new Vector3d(pickSegment.end.x - pickSegment.start.x, + Vector3d dir = + new Vector3d(pickSegment.end.x - pickSegment.start.x, pickSegment.end.y - pickSegment.start.y, pickSegment.end.z - pickSegment.start.z); while (i < validVertexCount) { vtxIndexArr[0] = i; getVertexData(i++, pnt); - if (intersectPntAndRay(pnt, pickSegment.start, + if (intersectPntAndRay(pnt, pickSegment.start, dir, sdist) && (sdist[0] <= 1.0)) { if (flags == 0) { @@ -104,13 +104,13 @@ class PointArrayRetained extends GeometryArrayRetained { y = pnt.y; z = pnt.z; if((flags & PickInfo.CLOSEST_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, + storeInterestData(pickInfo, flags, geom, geomIndex, vtxIndexArr, iPnt, sdist[0]); } } if((flags & PickInfo.ALL_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, - vtxIndexArr, iPnt, sdist[0]); + storeInterestData(pickInfo, flags, geom, geomIndex, + vtxIndexArr, iPnt, sdist[0]); } } } @@ -134,13 +134,13 @@ class PointArrayRetained extends GeometryArrayRetained { y = pnt.y; z = pnt.z; if((flags & PickInfo.CLOSEST_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, + storeInterestData(pickInfo, flags, geom, geomIndex, vtxIndexArr, iPnt, sdist[0]); } } if((flags & PickInfo.ALL_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, - vtxIndexArr, iPnt, sdist[0]); + storeInterestData(pickInfo, flags, geom, geomIndex, + vtxIndexArr, iPnt, sdist[0]); } } } @@ -162,13 +162,13 @@ class PointArrayRetained extends GeometryArrayRetained { y = pnt.y; z = pnt.z; if((flags & PickInfo.CLOSEST_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, + storeInterestData(pickInfo, flags, geom, geomIndex, vtxIndexArr, iPnt, sdist[0]); } } if((flags & PickInfo.ALL_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, - vtxIndexArr, iPnt, sdist[0]); + storeInterestData(pickInfo, flags, geom, geomIndex, + vtxIndexArr, iPnt, sdist[0]); } } } @@ -189,13 +189,13 @@ class PointArrayRetained extends GeometryArrayRetained { y = pnt.y; z = pnt.z; if((flags & PickInfo.CLOSEST_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, + storeInterestData(pickInfo, flags, geom, geomIndex, vtxIndexArr, iPnt, sdist[0]); } } if((flags & PickInfo.ALL_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, - vtxIndexArr, iPnt, sdist[0]); + storeInterestData(pickInfo, flags, geom, geomIndex, + vtxIndexArr, iPnt, sdist[0]); } } } @@ -204,8 +204,8 @@ class PointArrayRetained extends GeometryArrayRetained { // Should not happen since API already check for this throw new IllegalArgumentException(J3dI18N.getString("PointArrayRetained0")); default: - throw new RuntimeException ("PickShape not supported for intersection"); - } + throw new RuntimeException ("PickShape not supported for intersection"); + } if (minDist < Double.MAX_VALUE) { iPnt.x = x; @@ -220,12 +220,12 @@ class PointArrayRetained extends GeometryArrayRetained { Point3d point = new Point3d(); int i = ((vertexFormat & GeometryArray.BY_REFERENCE) == 0 ? initialVertexIndex : initialCoordIndex); - + switch (pnts.length) { case 3: // Triangle while (i < validVertexCount) { getVertexData(i++, point); - if (intersectTriPnt(pnts[0], pnts[1], pnts[2], point)) { + if (intersectTriPnt(pnts[0], pnts[1], pnts[2], point)) { return true; } } @@ -233,8 +233,8 @@ class PointArrayRetained extends GeometryArrayRetained { case 4: // Quad while (i < validVertexCount) { getVertexData(i++, point); - if (intersectTriPnt(pnts[0], pnts[1], pnts[2], point) || - intersectTriPnt(pnts[0], pnts[2], pnts[3], point)) { + if (intersectTriPnt(pnts[0], pnts[1], pnts[2], point) || + intersectTriPnt(pnts[0], pnts[2], pnts[3], point)) { return true; } } @@ -257,8 +257,8 @@ class PointArrayRetained extends GeometryArrayRetained { case 1: // Point while (i < validVertexCount) { getVertexData(i++, point); - if ((pnts[0].x == point.x) && - (pnts[0].y == point.y) && + if ((pnts[0].x == point.x) && + (pnts[0].y == point.y) && (pnts[0].z == point.z)) { return true; } @@ -266,7 +266,7 @@ class PointArrayRetained extends GeometryArrayRetained { break; } return false; - } + } boolean intersect(Transform3D thisToOtherVworld, @@ -292,7 +292,7 @@ class PointArrayRetained extends GeometryArrayRetained { int i = ((vertexFormat & GeometryArray.BY_REFERENCE) == 0 ? initialVertexIndex : initialCoordIndex); Point3d pnt = new Point3d(); - + while (i < validVertexCount) { getVertexData(i++, pnt); if (targetBound.intersect(pnt)) { diff --git a/src/classes/share/javax/media/j3d/PointAttributes.java b/src/classes/share/javax/media/j3d/PointAttributes.java index deaa406..c2e2378 100644 --- a/src/classes/share/javax/media/j3d/PointAttributes.java +++ b/src/classes/share/javax/media/j3d/PointAttributes.java @@ -32,12 +32,12 @@ package javax.media.j3d; /** - * The PointAttributes object defines all attributes that apply to + * The PointAttributes object defines all attributes that apply to * point primitives. The point attributes that can be defined are:<p> * <ul> * <li>Size - the size of the point, in pixels. The default is a point * size of one pixel.</li><p> - * <li>Antialiasing - for points greater than one-pixel in size, + * <li>Antialiasing - for points greater than one-pixel in size, * antialiasing smooths the outline of the point when it is rendered.</li> * <p></ul> * If antialiasing is disabled (the default), fractional point sizes @@ -45,11 +45,11 @@ package javax.media.j3d; * of pixels is drawn.<p> * <p> * If antialiasing is enabled, the points are considered transparent - * for rendering purposes. They are rendered with all the other transparent + * for rendering purposes. They are rendered with all the other transparent * objects and adhere to the other transparency settings such as the - * View transparency sorting policy and the View depth buffer freeze + * View transparency sorting policy and the View depth buffer freeze * transparent enable. - * </p> + * </p> * * @see Appearance * @see View @@ -89,7 +89,7 @@ public class PointAttributes extends NodeComponent { ALLOW_SIZE_READ, ALLOW_ANTIALIASING_READ }; - + /** * Constructs a PointAttributes object with default parameters. * The default values are as follows: @@ -127,7 +127,7 @@ public class PointAttributes extends NodeComponent { if(!this.getCapability(ALLOW_SIZE_WRITE)) throw new CapabilityNotSetException(J3dI18N.getString("PointAttributes0")); - if (isLive()) + if (isLive()) ((PointAttributesRetained)this.retained).setPointSize(pointSize); else ((PointAttributesRetained)this.retained).initPointSize(pointSize); @@ -152,11 +152,11 @@ public class PointAttributes extends NodeComponent { * for this appearance component object. * <p> * If antialiasing is enabled, the points are considered transparent - * for rendering purposes. They are rendered with all the other - * transparent objects and adhere to the other transparency settings - * such as the View transparency sorting policy and the View depth + * for rendering purposes. They are rendered with all the other + * transparent objects and adhere to the other transparency settings + * such as the View transparency sorting policy and the View depth * buffer freeze transparent enable. - * </p> + * </p> * @param state true or false to enable or disable point antialiasing * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph @@ -166,7 +166,7 @@ public class PointAttributes extends NodeComponent { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_ANTIALIASING_WRITE)) throw new CapabilityNotSetException(J3dI18N.getString("PointAttributes2")); - if (isLive()) + if (isLive()) ((PointAttributesRetained)this.retained).setPointAntialiasingEnable(state); else ((PointAttributesRetained)this.retained).initPointAntialiasingEnable(state); @@ -197,7 +197,7 @@ public class PointAttributes extends NodeComponent { } /** - * @deprecated replaced with cloneNodeComponent(boolean forceDuplicate) + * @deprecated replaced with cloneNodeComponent(boolean forceDuplicate) */ public NodeComponent cloneNodeComponent() { PointAttributes pa = new PointAttributes(); @@ -211,7 +211,7 @@ public class PointAttributes extends NodeComponent { * the current node. This method is called from the * <code>duplicateNode</code> method. This routine does * the actual duplication of all "local data" (any data defined in - * this object). + * this object). * * @param originalNodeComponent the original node to duplicate. * @param forceDuplicate when set to <code>true</code>, causes the @@ -223,11 +223,11 @@ public class PointAttributes extends NodeComponent { * @see Node#cloneTree * @see NodeComponent#setDuplicateOnCloneTree */ - void duplicateAttributes(NodeComponent originalNodeComponent, - boolean forceDuplicate) { + void duplicateAttributes(NodeComponent originalNodeComponent, + boolean forceDuplicate) { super.duplicateAttributes(originalNodeComponent, forceDuplicate); - PointAttributesRetained attr = (PointAttributesRetained) + PointAttributesRetained attr = (PointAttributesRetained) originalNodeComponent.retained; PointAttributesRetained rt = (PointAttributesRetained) retained; diff --git a/src/classes/share/javax/media/j3d/PointAttributesRetained.java b/src/classes/share/javax/media/j3d/PointAttributesRetained.java index 5837cbf..7dcc1ad 100644 --- a/src/classes/share/javax/media/j3d/PointAttributesRetained.java +++ b/src/classes/share/javax/media/j3d/PointAttributesRetained.java @@ -59,7 +59,7 @@ class PointAttributesRetained extends NodeComponentRetained { } /** - * Sets the point size for this appearance component object and sends a + * Sets the point size for this appearance component object and sends a * message notifying the interested structures of the change. * @param pointSize the size, in pixels, of point primitives */ @@ -87,13 +87,13 @@ class PointAttributesRetained extends NodeComponentRetained { /** * Enables or disables point antialiasing - * for this appearance component object and sends a + * for this appearance component object and sends a * message notifying the interested structures of the change. * @param state true or false to enable or disable point antialiasing */ final void setPointAntialiasingEnable(boolean state) { initPointAntialiasingEnable(state); - sendMessage(POINT_AA_CHANGED, + sendMessage(POINT_AA_CHANGED, (state ? Boolean.TRUE: Boolean.FALSE)); } @@ -107,7 +107,7 @@ class PointAttributesRetained extends NodeComponentRetained { } /** - * Creates and initializes a mirror object, point the mirror object + * Creates and initializes a mirror object, point the mirror object * to the retained object if the object is not editable */ synchronized void createMirrorObject() { @@ -146,7 +146,7 @@ class PointAttributesRetained extends NodeComponentRetained { /** - * Update the "component" field of the mirror object with the + * Update the "component" field of the mirror object with the * given "value" */ synchronized void updateMirrorObject(int component, Object value) { @@ -163,7 +163,7 @@ class PointAttributesRetained extends NodeComponentRetained { boolean equivalent(PointAttributesRetained pr) { return ((pr != null) && - (pr.pointSize == pointSize) && + (pr.pointSize == pointSize) && (pr.pointAntialiasing == pointAntialiasing)); } @@ -174,10 +174,10 @@ class PointAttributesRetained extends NodeComponentRetained { pointAntialiasing = pr.pointAntialiasing; } - + final void sendMessage(int attrMask, Object attr) { ArrayList univList = new ArrayList(); - ArrayList gaList = Shape3DRetained.getGeomAtomsList(mirror.users, univList); + ArrayList gaList = Shape3DRetained.getGeomAtomsList(mirror.users, univList); // Send to rendering attribute structure, regardless of // whether there are users or not (alternate appearance case ..) @@ -197,7 +197,7 @@ class PointAttributesRetained extends NodeComponentRetained { createMessage = new J3dMessage(); createMessage.threads = J3dThread.UPDATE_RENDER; createMessage.type = J3dMessage.POINTATTRIBUTES_CHANGED; - + createMessage.universe = (VirtualUniverse) univList.get(i); createMessage.args[0] = this; createMessage.args[1]= new Integer(attrMask); @@ -207,7 +207,7 @@ class PointAttributesRetained extends NodeComponentRetained { GeometryAtom[] gaArr = new GeometryAtom[gL.size()]; gL.toArray(gaArr); createMessage.args[3] = gaArr; - + VirtualUniverse.mc.processMessage(createMessage); } @@ -218,5 +218,5 @@ class PointAttributesRetained extends NodeComponentRetained { setFrequencyChangeMask(bit, 0x1); } } - + } diff --git a/src/classes/share/javax/media/j3d/PointLight.java b/src/classes/share/javax/media/j3d/PointLight.java index 52e7b71..212ca6a 100644 --- a/src/classes/share/javax/media/j3d/PointLight.java +++ b/src/classes/share/javax/media/j3d/PointLight.java @@ -126,7 +126,7 @@ public class PointLight extends Light { */ public PointLight(Color3f color, Point3f position, - Point3f attenuation) { + Point3f attenuation) { super(color); // set default read capabilities @@ -146,7 +146,7 @@ public class PointLight extends Light { public PointLight(boolean lightOn, Color3f color, Point3f position, - Point3f attenuation) { + Point3f attenuation) { super(lightOn, color); // set default read capabilities @@ -164,7 +164,7 @@ public class PointLight extends Light { this.retained = new PointLightRetained(); this.retained.setSource(this); } - + /** * Set light position. @@ -235,9 +235,9 @@ public class PointLight extends Light { /** * Sets this Light's current attenuation values and places it in the parameter specified. - * @param constant the light's constant attenuation - * @param linear the light's linear attenuation - * @param quadratic the light's quadratic attenuation + * @param constant the light's constant attenuation + * @param linear the light's linear attenuation + * @param quadratic the light's quadratic attenuation * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ @@ -267,7 +267,7 @@ public class PointLight extends Light { } - + /** * Used to create a new instance of the node. This routine is called @@ -295,7 +295,7 @@ public class PointLight extends Light { * <code>originalNode</code> into * the current node. This method is called from the * <code>cloneNode</code> method which is, in turn, called by the - * <code>cloneTree</code> method.<P> + * <code>cloneTree</code> method.<P> * * @param originalNode the original node to duplicate. * @param forceDuplicate when set to <code>true</code>, causes the @@ -320,7 +320,7 @@ public class PointLight extends Light { Point3f p = new Point3f(); attr.getPosition(p); rt.initPosition(p); - + attr.getAttenuation(p); rt.initAttenuation(p); } diff --git a/src/classes/share/javax/media/j3d/PointLightRetained.java b/src/classes/share/javax/media/j3d/PointLightRetained.java index ef29eb9..d9acad7 100644 --- a/src/classes/share/javax/media/j3d/PointLightRetained.java +++ b/src/classes/share/javax/media/j3d/PointLightRetained.java @@ -42,10 +42,10 @@ class PointLightRetained extends LightRetained { static final int LAST_POINTLIGHT_DEFINED_BIT = ATTENUATION_CHANGED; /** - * The attenuation vector consisting of + * The attenuation vector consisting of * constant, linear, and quadratic coefficients. */ - Point3f attenuation = new Point3f(1.0f, 0.0f, 0.0f); + Point3f attenuation = new Point3f(1.0f, 0.0f, 0.0f); // The position at which this light source exists. Point3f position = new Point3f(); @@ -187,7 +187,7 @@ class PointLightRetained extends LightRetained { attenuation.set(this.attenuation); } - /** + /** * This update function, and its native counterpart, * updates a point light. This includes its color, attenuation, * and its transformed position. @@ -226,7 +226,7 @@ class PointLightRetained extends LightRetained { objs[8] = new Point3f(attenuation); return createMessage; } - + // Note : if you add any more fields here , you need to update // updateLight() in RenderingEnvironmentStructure @@ -245,9 +245,9 @@ class PointLightRetained extends LightRetained { PointLightRetained ml = (PointLightRetained)mLgts[i]; mlLastLocalToVworld = ml.getLastLocalToVworld(); ml.position = (Point3f) objs[4]; - mlLastLocalToVworld.transform(ml.position, + mlLastLocalToVworld.transform(ml.position, ml.xformPosition); - ml.localToVworldScale = + ml.localToVworldScale = mlLastLocalToVworld.getDistanceScale(); } } @@ -267,9 +267,9 @@ class PointLightRetained extends LightRetained { ml.position = (Point3f)((Object[]) objs[4])[7]; ml.attenuation.set((Point3f)((Object[]) objs[4])[8]); mlLastLocalToVworld = ml.getLastLocalToVworld(); - mlLastLocalToVworld.transform(ml.position, + mlLastLocalToVworld.transform(ml.position, ml.xformPosition); - ml.localToVworldScale = + ml.localToVworldScale = mlLastLocalToVworld.getDistanceScale(); } } @@ -281,14 +281,14 @@ class PointLightRetained extends LightRetained { void validateAttenuationInEc(double vworldToCoexistenceScale) { double localToEcScale = localToVworldScale * vworldToCoexistenceScale; - + linearAttenuationInEc = (float)(attenuation.y / localToEcScale); quadraticAttenuationInEc = (float)(attenuation.z / (localToEcScale * localToEcScale)); } - + // Clones only the retained side, internal use only protected Object clone() { PointLightRetained pr = @@ -298,7 +298,7 @@ class PointLightRetained extends LightRetained { pr.position = new Point3f(position); pr.xformPosition = new Point3f(); return pr; - } + } // Called on the mirror object diff --git a/src/classes/share/javax/media/j3d/PointSound.java b/src/classes/share/javax/media/j3d/PointSound.java index af1ab29..d0be959 100644 --- a/src/classes/share/javax/media/j3d/PointSound.java +++ b/src/classes/share/javax/media/j3d/PointSound.java @@ -36,8 +36,8 @@ import javax.vecmath.Point3f; /** - * The PointSound node (a sub-class of the Sound node) defines a spatially - * located sound source whose waves radiate uniformly in all directions from + * The PointSound node (a sub-class of the Sound node) defines a spatially + * located sound source whose waves radiate uniformly in all directions from * a given location in space. It has the same attributes as a Sound object * with the addition of a location and the specification of distance-based * gain attenuation for listener positions between an array of distances. @@ -45,7 +45,7 @@ import javax.vecmath.Point3f; * A sound's amplitude is attenuated based on the distance between the listener * and the sound source position. A piecewise linear curve (defined in terms of * pairs of distance and gain scale factor) specifies the gain scale factor slope. - * + * * The PointSound's location and attenuation distances are defined in the local * coordinate system of the node. *<P> @@ -54,7 +54,7 @@ import javax.vecmath.Point3f; * Associated with distances from the listener to the sound source via an * array of (distance, gain-scale-factor) pairs. The gain scale factor * applied to the sound source is the linear interpolated gain value between - * the distance value range that includes the current distance from + * the distance value range that includes the current distance from * the listener to the sound source. If the distance from the listener to * the sound source is less than the first distance in the array, the first * gain scale factor is applied to the sound source. This creates a @@ -69,16 +69,16 @@ import javax.vecmath.Point3f; * positive floating point numbers. While for most applications this list * of gain scale factors will usually be monotonically-decreasing, they * do not have to be. - * If this - * is not set, no distance gain attenuation is performed (equivalent to - * using a distance gain of 1.0 for all distances). + * If this + * is not set, no distance gain attenuation is performed (equivalent to + * using a distance gain of 1.0 for all distances). *<P> * getDistanceGainLength method returns the length of the distance gain * attenuation arrays. Arrays passed into getDistanceGain methods should all * be at least this size. *<P> * There are two methods for getDistanceGain, one returning an array of - * points, the other returning separate arrays for each attenuation + * points, the other returning separate arrays for each attenuation * component.</UL> */ @@ -140,7 +140,7 @@ public class PointSound extends Sound { // set default read capabilities setDefaultReadCapabilities(readCapabilities); - } + } /** * Constructs a PointSound node object using only the provided parameter @@ -150,7 +150,7 @@ public class PointSound extends Sound { * @param soundData sound data associated with this sound source node * @param initialGain amplitude scale factor applied to sound source * @param position 3D location of source - */ + */ public PointSound(MediaContainer soundData, float initialGain, Point3f position) { @@ -160,7 +160,7 @@ public class PointSound extends Sound { setDefaultReadCapabilities(readCapabilities); ((PointSoundRetained)this.retained).setPosition(position); - } + } /** * Constructs a PointSound node object using only the provided parameter @@ -172,7 +172,7 @@ public class PointSound extends Sound { * @param posX x coordinate of location of source * @param posY y coordinate of location of source * @param posZ z coordinate of location of source - */ + */ public PointSound(MediaContainer soundData, float initialGain, float posX, float posY, float posZ ) { @@ -182,7 +182,7 @@ public class PointSound extends Sound { setDefaultReadCapabilities(readCapabilities); ((PointSoundRetained)this.retained).setPosition(posX,posY,posZ); - } + } // The next four constructors fill all this classes fields with the provided // arguments values. @@ -191,7 +191,7 @@ public class PointSound extends Sound { /** * Construct a PointSound object accepting Point3f as input for the position - * and accepting an array of Point2f for the distance attenuation values + * and accepting an array of Point2f for the distance attenuation values * where each pair in the array contains a distance and a gain scale factor. * @param soundData sound data associated with this sound source node * @param initialGain amplitude scale factor applied to sound source @@ -203,7 +203,7 @@ public class PointSound extends Sound { * @param priority playback ranking value * @param position 3D location of source * @param distanceGain array of (distance,gain) pairs controling attenuation - */ + */ public PointSound(MediaContainer soundData, float initialGain, int loopCount, @@ -212,10 +212,10 @@ public class PointSound extends Sound { boolean enable, Bounds region, float priority, - Point3f position, + Point3f position, Point2f[] distanceGain) { - super(soundData, initialGain, loopCount, release, continuous, + super(soundData, initialGain, loopCount, release, continuous, enable, region, priority ); // set default read capabilities @@ -223,13 +223,13 @@ public class PointSound extends Sound { ((PointSoundRetained)this.retained).setPosition(position); ((PointSoundRetained)this.retained).setDistanceGain(distanceGain); - } + } /** - * Construct a PointSound object accepting individual float parameters for + * Construct a PointSound object accepting individual float parameters for * the elements of the position point, and accepting an array of Point2f for - * the distance attenuation values where each pair in the array contains a - * distance and a gain scale factor. + * the distance attenuation values where each pair in the array contains a + * distance and a gain scale factor. * @param soundData sound data associated with this sound source node * @param initialGain amplitude scale factor applied to sound source * @param loopCount number of times loop is looped @@ -242,7 +242,7 @@ public class PointSound extends Sound { * @param posY y coordinate of location of source * @param posZ z coordinate of location of source * @param distanceGain array of (distance,gain) pairs controling attenuation - */ + */ public PointSound(MediaContainer soundData, float initialGain, int loopCount, @@ -251,7 +251,7 @@ public class PointSound extends Sound { boolean enable, Bounds region, float priority, - float posX, float posY, float posZ, + float posX, float posY, float posZ, Point2f[] distanceGain) { super(soundData, initialGain, loopCount, release, @@ -262,12 +262,12 @@ public class PointSound extends Sound { ((PointSoundRetained)this.retained).setPosition(posX,posY,posZ); ((PointSoundRetained)this.retained).setDistanceGain(distanceGain); - } + } /** * Construct a PointSound object accepting points as input for the position. - * and accepting separate arrays for the distance and gain scale factors - * components of distance attenuation. + * and accepting separate arrays for the distance and gain scale factors + * components of distance attenuation. * @param soundData sound data associated with this sound source node * @param initialGain amplitude scale factor applied to sound source * @param loopCount number of times loop is looped @@ -279,7 +279,7 @@ public class PointSound extends Sound { * @param position 3D location of source * @param attenuationDistance array of distance values used for attenuation * @param attenuationGain array of gain scale factors used for attenuation - */ + */ public PointSound(MediaContainer soundData, float initialGain, int loopCount, @@ -288,11 +288,11 @@ public class PointSound extends Sound { boolean enable, Bounds region, float priority, - Point3f position, + Point3f position, float[] attenuationDistance, float[] attenuationGain) { - super(soundData, initialGain, loopCount, release, continuous, + super(soundData, initialGain, loopCount, release, continuous, enable, region, priority ); // set default read capabilities @@ -301,12 +301,12 @@ public class PointSound extends Sound { ((PointSoundRetained)this.retained).setPosition(position); ((PointSoundRetained)this.retained).setDistanceGain( attenuationDistance, attenuationGain); - } + } /** - * Construct a PointSound object accepting individual float parameters for - * the elements of the position points, and accepting separate arrays for - * the distance and gain scale factors components of distance attenuation. + * Construct a PointSound object accepting individual float parameters for + * the elements of the position points, and accepting separate arrays for + * the distance and gain scale factors components of distance attenuation. * @param soundData sound data associated with this sound source node * @param initialGain amplitude scale factor applied to sound source * @param loopCount number of times loop is looped @@ -320,7 +320,7 @@ public class PointSound extends Sound { * @param posZ z coordinate of location of source * @param attenuationDistance array of distance values used for attenuation * @param attenuationGain array of gain scale factors used for attenuation - */ + */ public PointSound(MediaContainer soundData, float initialGain, int loopCount, @@ -329,7 +329,7 @@ public class PointSound extends Sound { boolean enable, Bounds region, float priority, - float posX, float posY, float posZ, + float posX, float posY, float posZ, float[] attenuationDistance, float[] attenuationGain) { @@ -342,7 +342,7 @@ public class PointSound extends Sound { ((PointSoundRetained)this.retained).setPosition(posX,posY,posZ); ((PointSoundRetained)this.retained).setDistanceGain( attenuationDistance, attenuationGain); - } + } /** * Creates the retained mode PointSoundRetained object that this @@ -363,7 +363,7 @@ public class PointSound extends Sound { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_POSITION_WRITE)) throw new CapabilityNotSetException(J3dI18N.getString("PointSound0")); - + ((PointSoundRetained)this.retained).setPosition(position); } @@ -379,7 +379,7 @@ public class PointSound extends Sound { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_POSITION_WRITE)) throw new CapabilityNotSetException(J3dI18N.getString("PointSound0")); - + ((PointSoundRetained)this.retained).setPosition(x,y,z); } @@ -394,7 +394,7 @@ public class PointSound extends Sound { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_POSITION_READ)) throw new CapabilityNotSetException(J3dI18N.getString("PointSound2")); - + ((PointSoundRetained)this.retained).getPosition(position); } @@ -402,25 +402,25 @@ public class PointSound extends Sound { * Sets this sound's distance gain attenuation - where gain scale factor * is applied to sound based on distance listener is from sound source. * This form of setDistanceGain takes these pairs of values as an array of - * Point2f. + * Point2f. * @param attenuation defined by pairs of (distance,gain-scale-factor) * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph - */ + */ public void setDistanceGain(Point2f[] attenuation) { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_DISTANCE_GAIN_WRITE)) throw new CapabilityNotSetException(J3dI18N.getString("PointSound3")); - + ((PointSoundRetained)this.retained).setDistanceGain(attenuation); } /** * Sets this sound's distance gain attenuation as an array of Point2fs. * This form of setDistanceGain accepts two separate arrays for these values. - * The distance and gainScale arrays should be of the same length. If the - * gainScale array length is greater than the distance array length, the - * gainScale array elements beyond the length of the distance array are + * The distance and gainScale arrays should be of the same length. If the + * gainScale array length is greater than the distance array length, the + * gainScale array elements beyond the length of the distance array are * ignored. If the gainScale array is shorter than the distance array, the * last gainScale array value is repeated to fill an array of length equal * to distance array. @@ -428,12 +428,12 @@ public class PointSound extends Sound { * @param gain array of non-negative scale factors * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph - */ + */ public void setDistanceGain(float[] distance, float[] gain) { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_DISTANCE_GAIN_WRITE)) throw new CapabilityNotSetException(J3dI18N.getString("PointSound3")); - + ((PointSoundRetained)this.retained).setDistanceGain(distance, gain); } @@ -442,7 +442,7 @@ public class PointSound extends Sound { * @return distance gain attenuation array length * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph - */ + */ public int getDistanceGainLength() { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_DISTANCE_GAIN_READ)) @@ -454,17 +454,17 @@ public class PointSound extends Sound { /** * Gets this sound's distance attenuation. The distance attenuation * pairs are copied into the specified array. - * The array must be large enough to hold all of the points. + * The array must be large enough to hold all of the points. * The individual array elements must be allocated by the caller. * @param attenuation arrays containing distance attenuation pairs * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph - */ - public void getDistanceGain(Point2f[] attenuation) { + */ + public void getDistanceGain(Point2f[] attenuation) { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_DISTANCE_GAIN_READ)) throw new CapabilityNotSetException(J3dI18N.getString("PointSound4")); - + ((PointSoundRetained)this.retained).getDistanceGain(attenuation); } @@ -472,15 +472,15 @@ public class PointSound extends Sound { * Gets this sound's distance gain attenuation values in separate arrays. * The arrays must be large enough to hold all of the values. * @param distance array of float distance from sound source - * @param gain array of non-negative scale factors associated with + * @param gain array of non-negative scale factors associated with * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph - */ - public void getDistanceGain(float[] distance, float[] gain) { + */ + public void getDistanceGain(float[] distance, float[] gain) { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_DISTANCE_GAIN_READ)) throw new CapabilityNotSetException(J3dI18N.getString("PointSound4")); - + ((PointSoundRetained)this.retained).getDistanceGain(distance,gain); } @@ -528,7 +528,7 @@ public class PointSound extends Sound { * <code>false</code>, the value of each node's * <code>duplicateOnCloneTree</code> variable determines whether * NodeComponent data is duplicated or copied. - * @exception ClassCastException if originalNode is not an instance of + * @exception ClassCastException if originalNode is not an instance of * <code>PointSound</code> * * @see Node#cloneTree @@ -536,7 +536,7 @@ public class PointSound extends Sound { * @see NodeComponent#setDuplicateOnCloneTree */ public void duplicateNode(Node originalNode, boolean forceDuplicate) { - checkDuplicateNode(originalNode, forceDuplicate); + checkDuplicateNode(originalNode, forceDuplicate); } @@ -545,7 +545,7 @@ public class PointSound extends Sound { * <code>originalNode</code> into * the current node. This method is called from the * <code>cloneNode</code> method which is, in turn, called by the - * <code>cloneTree</code> method.<P> + * <code>cloneTree</code> method.<P> * * @param originalNode the original node to duplicate. * @param forceDuplicate when set to <code>true</code>, causes the @@ -577,5 +577,5 @@ public class PointSound extends Sound { orgRetained.getDistanceGain(distance, gain); thisRetained.setDistanceGain(distance, gain); } - + } diff --git a/src/classes/share/javax/media/j3d/PointSoundRetained.java b/src/classes/share/javax/media/j3d/PointSoundRetained.java index 6bf7124..3d7a657 100644 --- a/src/classes/share/javax/media/j3d/PointSoundRetained.java +++ b/src/classes/share/javax/media/j3d/PointSoundRetained.java @@ -32,14 +32,14 @@ package javax.media.j3d; import java.lang.Math; -import java.net.URL; +import java.net.URL; import javax.vecmath.Point3f; import javax.vecmath.Point3d; import javax.vecmath.Point2f; /** * The PointSoundRetained node (a sub-class of the SoundRetained node) defines - * a spatially-located sound source whose waves radiate uniformly in all + * a spatially-located sound source whose waves radiate uniformly in all * directions from a given location in space. */ @@ -59,7 +59,7 @@ class PointSoundRetained extends SoundRetained { // gain attenuation between each pair. float[] attenuationDistance; float[] attenuationGain; - + PointSoundRetained() { this.nodeType = NodeRetained.POINTSOUND; } @@ -72,7 +72,7 @@ class PointSoundRetained extends SoundRetained { if (staticTransform != null) { staticTransform.transform.transform(position, this.position); } else { - this.position.set(position); + this.position.set(position); } getLastLocalToVworld().transform(position, xformPosition); @@ -126,15 +126,15 @@ class PointSoundRetained extends SoundRetained { * Sets this sound's distance gain attenuation - where gain scale factor * is applied to sound based on distance listener is from sound source. * @param distance attenuation pairs of (distance,gain-scale-factor) - */ - void setDistanceGain(Point2f[] attenuation) { + */ + void setDistanceGain(Point2f[] attenuation) { // if attenuation array null set both attenuation components to null if (attenuation == null) { this.attenuationDistance = null; this.attenuationGain = null; // QUESTION: is this needed so that dispatch***() doesn't // fail with null? - return; + return; } int attenuationLength = attenuation.length; @@ -155,17 +155,17 @@ class PointSoundRetained extends SoundRetained { * applied to sound based on distance listener is from sound source. * @param distance array of monotonically-increasing floats. * @param gain array of amplitude scale factors associated with distances. - */ - void setDistanceGain(float[] distance, float[] gain) { - // if distance or gain arrays are null then treat both as null + */ + void setDistanceGain(float[] distance, float[] gain) { + // if distance or gain arrays are null then treat both as null if (distance == null) { - this.attenuationDistance = null; - this.attenuationGain = null; + this.attenuationDistance = null; + this.attenuationGain = null; // QUESTION: is this needed so that dispatch***() doesn't // fail with null? return; } - + int gainLength = gain.length; int distanceLength = distance.length; this.attenuationDistance = new float[distanceLength]; @@ -195,23 +195,23 @@ class PointSoundRetained extends SoundRetained { } } - /** - * Gets this sound's distance attenuation array length + /** + * Gets this sound's distance attenuation array length * @return distance gain attenuation array length - */ - int getDistanceGainLength() { - if (attenuationDistance == null) + */ + int getDistanceGainLength() { + if (attenuationDistance == null) return 0; else return this.attenuationDistance.length; - } - + } + /** * Retieves sound's distance attenuation * Put the contents of the two separate distance and gain arrays into * an array of Point2f. * @param attenuation containing distance attenuation pairs - */ + */ void getDistanceGain(Point2f[] attenuation) { // write into arrays passed in, don't do a new if (attenuation == null) @@ -231,12 +231,12 @@ class PointSoundRetained extends SoundRetained { } /** - * Retieves this sound's attenuation distance and gain arrays, returned in + * Retieves this sound's attenuation distance and gain arrays, returned in * separate arrays. * @param distance array of monotonically-increasing floats. * @param gain array of amplitude scale factors associated with distances. - */ - void getDistanceGain(float[] distance, float[] gain) { + */ + void getDistanceGain(float[] distance, float[] gain) { // write into arrays passed in, don't do a new if (distance == null || gain == null) return; @@ -246,20 +246,20 @@ class PointSoundRetained extends SoundRetained { int attenuationLength = this.attenuationDistance.length; int distanceLength = distance.length; if (distanceLength > attenuationLength) - distanceLength = attenuationLength; + distanceLength = attenuationLength; System.arraycopy(this.attenuationDistance, 0, distance, 0, distanceLength); attenuationLength = this.attenuationDistance.length; int gainLength = gain.length; if (gainLength > attenuationLength) - gainLength = attenuationLength; + gainLength = attenuationLength; System.arraycopy(this.attenuationGain, 0, gain, 0, gainLength); } - /** + /** * This updates the positional fields of point sound. * * Distance gain attenuation field not maintained in mirror object. - */ + */ void updateMirrorObject(Object[] objs) { if (debugFlag) debugPrint("PointSoundRetained:updateMirrorObj()"); @@ -297,7 +297,7 @@ class PointSoundRetained extends SoundRetained { void updateTransformChange() { super.updateTransformChange(); getLastLocalToVworld().transform(position, xformPosition); - // set flag looked at by Scheduler to denote Transform change + // set flag looked at by Scheduler to denote Transform change // this flag will force resneding transformed position to AudioDevice if (debugFlag) debugPrint("PointSoundRetained xformPosition is (" + xformPosition.x + diff --git a/src/classes/share/javax/media/j3d/PolygonAttributes.java b/src/classes/share/javax/media/j3d/PolygonAttributes.java index 44baf9d..d5a5e71 100644 --- a/src/classes/share/javax/media/j3d/PolygonAttributes.java +++ b/src/classes/share/javax/media/j3d/PolygonAttributes.java @@ -58,14 +58,14 @@ package javax.media.j3d; * <p></ul> * <li>Back-face normal flip - specifies whether vertex normals of * back-facing polygons are flipped (negated) prior to lighting. The - * setting is either true, meaning to flip back-facing normals, or + * setting is either true, meaning to flip back-facing normals, or * false. The default is false.</li> * <p> * <li>Offset - the depth values of all pixels generated by polygon - * rasterization can be offset by a value that is computed for that + * rasterization can be offset by a value that is computed for that * polygon. Two values are used to specify the offset:</li><p> * <ul> - * <li>Offset bias - the constant polygon offset that is added to + * <li>Offset bias - the constant polygon offset that is added to * the final device coordinate Z value of polygon primitives.</li> * <p> * <li>Offset factor - the factor to be multiplied by the @@ -75,7 +75,7 @@ package javax.media.j3d; * These values can be either positive or negative. The default * for both of these values is 0.0.<p> * </ul> - * + * * @see Appearance */ public class PolygonAttributes extends NodeComponent { @@ -172,7 +172,7 @@ public class PolygonAttributes extends NodeComponent { ALLOW_NORMAL_FLIP_READ, ALLOW_OFFSET_READ }; - + /** * Constructs a PolygonAttributes object with default parameters. * The default values are as follows: @@ -240,14 +240,14 @@ public class PolygonAttributes extends NodeComponent { float polygonOffsetFactor) { if (polygonMode < POLYGON_POINT || polygonMode > POLYGON_FILL) - throw new IllegalArgumentException(J3dI18N.getString("PolygonAttributes0")); + throw new IllegalArgumentException(J3dI18N.getString("PolygonAttributes0")); if (cullFace < CULL_NONE || cullFace > CULL_FRONT) - throw new IllegalArgumentException(J3dI18N.getString("PolygonAttributes12")); + throw new IllegalArgumentException(J3dI18N.getString("PolygonAttributes12")); // set default read capabilities setDefaultReadCapabilities(readCapabilities); - + ((PolygonAttributesRetained)this.retained).initPolygonMode(polygonMode); ((PolygonAttributesRetained)this.retained).initCullFace(cullFace); ((PolygonAttributesRetained)this.retained).initPolygonOffset(polygonOffset); @@ -269,8 +269,8 @@ public class PolygonAttributes extends NodeComponent { throw new CapabilityNotSetException(J3dI18N.getString("PolygonAttributes2")); if (cullFace < CULL_NONE || cullFace > CULL_FRONT) - throw new IllegalArgumentException(J3dI18N.getString("PolygonAttributes3")); - if (isLive()) + throw new IllegalArgumentException(J3dI18N.getString("PolygonAttributes3")); + if (isLive()) ((PolygonAttributesRetained)this.retained).setCullFace(cullFace); else ((PolygonAttributesRetained)this.retained).initCullFace(cullFace); @@ -309,7 +309,7 @@ public class PolygonAttributes extends NodeComponent { throw new CapabilityNotSetException(J3dI18N.getString("PolygonAttributes5")); if (isLive()) ((PolygonAttributesRetained)this.retained).setBackFaceNormalFlip(backFaceNormalFlip); - else + else ((PolygonAttributesRetained)this.retained).initBackFaceNormalFlip(backFaceNormalFlip); } @@ -342,10 +342,10 @@ public class PolygonAttributes extends NodeComponent { throw new CapabilityNotSetException(J3dI18N.getString("PolygonAttributes7")); if (polygonMode < POLYGON_POINT || polygonMode > POLYGON_FILL) - throw new IllegalArgumentException(J3dI18N.getString("PolygonAttributes8")); + throw new IllegalArgumentException(J3dI18N.getString("PolygonAttributes8")); if (isLive()) ((PolygonAttributesRetained)this.retained).setPolygonMode(polygonMode); - else + else ((PolygonAttributesRetained)this.retained).initPolygonMode(polygonMode); } @@ -450,7 +450,7 @@ public class PolygonAttributes extends NodeComponent { } /** - * @deprecated replaced with cloneNodeComponent(boolean forceDuplicate) + * @deprecated replaced with cloneNodeComponent(boolean forceDuplicate) */ public NodeComponent cloneNodeComponent() { PolygonAttributes pga = new PolygonAttributes(); @@ -464,7 +464,7 @@ public class PolygonAttributes extends NodeComponent { * the current node. This method is called from the * <code>duplicateNode</code> method. This routine does * the actual duplication of all "local data" (any data defined in - * this object). + * this object). * * @param originalNodeComponent the original node to duplicate. * @param forceDuplicate when set to <code>true</code>, causes the @@ -477,11 +477,11 @@ public class PolygonAttributes extends NodeComponent { * @see NodeComponent#setDuplicateOnCloneTree */ - void duplicateAttributes(NodeComponent originalNodeComponent, - boolean forceDuplicate) { + void duplicateAttributes(NodeComponent originalNodeComponent, + boolean forceDuplicate) { super.duplicateAttributes(originalNodeComponent, forceDuplicate); - + PolygonAttributesRetained attr = (PolygonAttributesRetained) originalNodeComponent.retained; diff --git a/src/classes/share/javax/media/j3d/PolygonAttributesRetained.java b/src/classes/share/javax/media/j3d/PolygonAttributesRetained.java index 8b041ac..8848a5f 100644 --- a/src/classes/share/javax/media/j3d/PolygonAttributesRetained.java +++ b/src/classes/share/javax/media/j3d/PolygonAttributesRetained.java @@ -162,9 +162,9 @@ class PolygonAttributesRetained extends NodeComponentRetained { } /** - * Sets the polygon offset to the specified value and sends a + * Sets the polygon offset to the specified value and sends a * message notifying the interested structures of the change. - * This screen space offset is added to the final, device + * This screen space offset is added to the final, device * coordinate Z value of polygon primitives. * @param polygonOffset the polygon offset */ @@ -173,9 +173,9 @@ class PolygonAttributesRetained extends NodeComponentRetained { } /** - * Sets the polygon offset to the specified value and sends a + * Sets the polygon offset to the specified value and sends a * message notifying the interested structures of the change. - * This screen space offset is added to the final, device + * This screen space offset is added to the final, device * coordinate Z value of polygon primitives. * @param polygonOffset the polygon offset */ @@ -195,7 +195,7 @@ class PolygonAttributesRetained extends NodeComponentRetained { /** - * Sets the polygon offset factor to the specified value and sends a + * Sets the polygon offset factor to the specified value and sends a * message notifying the interested structures of the change. * This factor is multiplied by the slope of the polygon, and * then added to the final, device coordinate Z value of polygon @@ -207,7 +207,7 @@ class PolygonAttributesRetained extends NodeComponentRetained { } /** - * Sets the polygon offset factor to the specified value and sends a + * Sets the polygon offset factor to the specified value and sends a * message notifying the interested structures of the change. * This factor is multiplied by the slope of the polygon, and * then added to the final, device coordinate Z value of polygon @@ -216,7 +216,7 @@ class PolygonAttributesRetained extends NodeComponentRetained { */ final void setPolygonOffsetFactor(float polygonOffsetFactor) { initPolygonOffsetFactor(polygonOffsetFactor); - sendMessage(POLYGON_OFFSETFACTOR_CHANGED, + sendMessage(POLYGON_OFFSETFACTOR_CHANGED, new Float(polygonOffsetFactor)); } @@ -230,7 +230,7 @@ class PolygonAttributesRetained extends NodeComponentRetained { } /** - * Creates and initializes a mirror object, point the mirror object + * Creates and initializes a mirror object, point the mirror object * to the retained object if the object is not editable */ synchronized void createMirrorObject() { @@ -244,9 +244,9 @@ class PolygonAttributesRetained extends NodeComponentRetained { mirrorPa.set(this); mirrorPa.source = source; mirror = mirrorPa; - } + } } else { - ((PolygonAttributesRetained) mirror).set(this); + ((PolygonAttributesRetained) mirror).set(this); } } @@ -269,7 +269,7 @@ class PolygonAttributesRetained extends NodeComponentRetained { } /** - * Update the "component" field of the mirror object with the + * Update the "component" field of the mirror object with the * given "value" */ synchronized void updateMirrorObject(int component, Object value) { @@ -287,12 +287,12 @@ class PolygonAttributesRetained extends NodeComponentRetained { } else if ((component & POLYGON_OFFSET_CHANGED) != 0) { mirrorPa.polygonOffset = ((Float)value).floatValue(); - } + } else if ((component & POLYGON_OFFSETFACTOR_CHANGED) != 0) { mirrorPa.polygonOffsetFactor = ((Float) value).floatValue(); } } - + boolean equivalent(PolygonAttributesRetained pr) { return ((pr != null) && @@ -311,10 +311,10 @@ class PolygonAttributesRetained extends NodeComponentRetained { polygonOffset = pr.polygonOffset; polygonOffsetFactor = pr.polygonOffsetFactor; } - + final void sendMessage(int attrMask, Object attr) { ArrayList univList = new ArrayList(); - ArrayList gaList = Shape3DRetained.getGeomAtomsList(mirror.users, univList); + ArrayList gaList = Shape3DRetained.getGeomAtomsList(mirror.users, univList); // Send to rendering attribute structure, regardless of // whether there are users or not (alternate appearance case ..) @@ -333,7 +333,7 @@ class PolygonAttributesRetained extends NodeComponentRetained { createMessage = new J3dMessage(); createMessage.threads = J3dThread.UPDATE_RENDER; createMessage.type = J3dMessage.POLYGONATTRIBUTES_CHANGED; - + createMessage.universe = (VirtualUniverse) univList.get(i); createMessage.args[0] = this; createMessage.args[1]= new Integer(attrMask); @@ -343,7 +343,7 @@ class PolygonAttributesRetained extends NodeComponentRetained { GeometryAtom[] gaArr = new GeometryAtom[gL.size()]; gL.toArray(gaArr); createMessage.args[3] = gaArr; - + VirtualUniverse.mc.processMessage(createMessage); } @@ -356,6 +356,6 @@ class PolygonAttributesRetained extends NodeComponentRetained { bit == PolygonAttributes.ALLOW_OFFSET_WRITE) { setFrequencyChangeMask(bit, 0x1); } - } + } } diff --git a/src/classes/share/javax/media/j3d/PositionInterpolator.java b/src/classes/share/javax/media/j3d/PositionInterpolator.java index 9875a61..2c528aa 100644 --- a/src/classes/share/javax/media/j3d/PositionInterpolator.java +++ b/src/classes/share/javax/media/j3d/PositionInterpolator.java @@ -36,9 +36,9 @@ import javax.vecmath.Vector3d; /** * Position interpolator behavior. This class defines a behavior - * that modifies the translational component of its target - * TransformGroup by linearly interpolating between a pair of - * specified positions (using the value generated by the + * that modifies the translational component of its target + * TransformGroup by linearly interpolating between a pair of + * specified positions (using the value generated by the * specified Alpha object). The interpolated position is used * to generate a translation transform along the local X-axis * of this interpolator. @@ -52,14 +52,14 @@ public class PositionInterpolator extends TransformInterpolator { float startPosition; float endPosition; - // We can't use a boolean flag since it is possible + // We can't use a boolean flag since it is possible // that after alpha change, this procedure only run // once at alpha.finish(). So the best way is to // detect alpha value change. private float prevAlphaValue = Float.NaN; - private WakeupCriterion passiveWakeupCriterion = + private WakeupCriterion passiveWakeupCriterion = (WakeupCriterion) new WakeupOnElapsedFrames(0, true); - + // non-public, default constructor used by cloneNode PositionInterpolator() { } @@ -69,7 +69,7 @@ public class PositionInterpolator extends TransformInterpolator { * an axisOfTranslation set to Identity, a startPosition of 0.0f, and * an endPosition of 1.0f. * @param alpha The alpha object for this Interpolator - * @param target The target for this position Interpolator + * @param target The target for this position Interpolator */ public PositionInterpolator(Alpha alpha, TransformGroup target) { super(alpha, target); @@ -140,7 +140,7 @@ public class PositionInterpolator extends TransformInterpolator { public void setAxisOfTranslation(Transform3D axisOfTranslation) { setTransformAxis(axisOfTranslation); } - + /** * @deprecated As of Java 3D version 1.3, replaced by * <code>TransformInterpolator.getTransformAxis()</code> @@ -162,11 +162,11 @@ public class PositionInterpolator extends TransformInterpolator { public void computeTransform(float alphaValue, Transform3D transform) { double val = (1.0-alphaValue)*startPosition + alphaValue*endPosition; - + // construct a Transform3D from: axis * translation * axisInverse transv.set(val, 0.0, 0.0); translation.setTranslation(transv); - + transform.mul(axis, translation); transform.mul(transform, axisInverse); } @@ -196,7 +196,7 @@ public class PositionInterpolator extends TransformInterpolator { * <code>originalNode</code> into * the current node. This method is called from the * <code>cloneNode</code> method which is, in turn, called by the - * <code>cloneTree</code> method.<P> + * <code>cloneTree</code> method.<P> * * @param originalNode the original node to duplicate. * @param forceDuplicate when set to <code>true</code>, causes the @@ -216,7 +216,7 @@ public class PositionInterpolator extends TransformInterpolator { super.duplicateAttributes(originalNode, forceDuplicate); PositionInterpolator pi = (PositionInterpolator) originalNode; - + setStartPosition(pi.getStartPosition()); setEndPosition(pi.getEndPosition()); } diff --git a/src/classes/share/javax/media/j3d/PositionPathInterpolator.java b/src/classes/share/javax/media/j3d/PositionPathInterpolator.java index 747d3db..336791d 100644 --- a/src/classes/share/javax/media/j3d/PositionPathInterpolator.java +++ b/src/classes/share/javax/media/j3d/PositionPathInterpolator.java @@ -39,11 +39,11 @@ import javax.vecmath.Vector3f; * PositionPathInterpolator behavior. This class defines a behavior * that modifies the translational component of its target TransformGroup * by linearly interpolating among a series of predefined knot/position - * pairs (using the value generated by the specified Alpha object). The + * pairs (using the value generated by the specified Alpha object). The * interpolated position is used to generate a translation transform * in the local coordinate system of this interpolator. The first knot * must have a value of 0.0. The last knot must have a value of 1.0. An - * intermediate knot with index k must have a value strictly greater + * intermediate knot with index k must have a value strictly greater * than any knot with index less than k. */ @@ -55,14 +55,14 @@ public class PositionPathInterpolator extends PathInterpolator { private Point3f positions[]; private float prevInterpolationValue = Float.NaN; - // We can't use a boolean flag since it is possible + // We can't use a boolean flag since it is possible // that after alpha change, this procedure only run // once at alpha.finish(). So the best way is to // detect alpha value change. private float prevAlphaValue = Float.NaN; - private WakeupCriterion passiveWakeupCriterion = + private WakeupCriterion passiveWakeupCriterion = (WakeupCriterion) new WakeupOnElapsedFrames(0, true); - + // non-public, default constructor used by cloneNode PositionPathInterpolator() { } @@ -70,10 +70,10 @@ public class PositionPathInterpolator extends PathInterpolator { /** * Constructs a new PositionPathInterpolator that varies the transform - * of the target TransformGroup. + * of the target TransformGroup. * @param alpha the alpha object for this interpolator * @param target the TransformGroup node affected by this translator - * @param axisOfTransform the transform that defines the local + * @param axisOfTransform the transform that defines the local * coordinate system in which this interpolator operates * @param knots an array of knot values that specify interpolation points. * @param positions an array of position values at the knots. @@ -95,7 +95,7 @@ public class PositionPathInterpolator extends PathInterpolator { /** - * Sets the position at the specified index for this + * Sets the position at the specified index for this * interpolator. * @param index the index of the position to be changed * @param position the new position at the index @@ -178,7 +178,7 @@ public class PositionPathInterpolator extends PathInterpolator { * <code>TransformInterpolator.getTransformAxis()</code> */ public Transform3D getAxisOfTranslation() { - return getTransformAxis(); + return getTransformAxis(); } /** @@ -194,7 +194,7 @@ public class PositionPathInterpolator extends PathInterpolator { public void computeTransform(float alphaValue, Transform3D transform) { computePathInterpolation(alphaValue); - + if (currentKnotIndex == 0 && currentInterpolationValue == 0f) { pos.x = positions[0].x; @@ -213,7 +213,7 @@ public class PositionPathInterpolator extends PathInterpolator { } position.setIdentity(); position.setTranslation(pos); - + // construct a Transform3D from: axis * position * axisInverse transform.mul(axis, position); transform.mul(transform, axisInverse); @@ -245,7 +245,7 @@ public class PositionPathInterpolator extends PathInterpolator { * <code>originalNode</code> into * the current node. This method is called from the * <code>cloneNode</code> method which is, in turn, called by the - * <code>cloneTree</code> method.<P> + * <code>cloneTree</code> method.<P> * * @param originalNode the original node to duplicate. * @param forceDuplicate when set to <code>true</code>, causes the @@ -264,9 +264,9 @@ public class PositionPathInterpolator extends PathInterpolator { void duplicateAttributes(Node originalNode, boolean forceDuplicate) { super.duplicateAttributes(originalNode, forceDuplicate); - PositionPathInterpolator pi = + PositionPathInterpolator pi = (PositionPathInterpolator) originalNode; - + int len = pi.getArrayLengths(); // No API available to set the size of positions diff --git a/src/classes/share/javax/media/j3d/QuadArrayRetained.java b/src/classes/share/javax/media/j3d/QuadArrayRetained.java index 8978766..d8b58e9 100644 --- a/src/classes/share/javax/media/j3d/QuadArrayRetained.java +++ b/src/classes/share/javax/media/j3d/QuadArrayRetained.java @@ -45,23 +45,23 @@ class QuadArrayRetained extends GeometryArrayRetained { QuadArrayRetained() { this.geoType = GEO_TYPE_QUAD_SET; } - + boolean intersect(PickShape pickShape, PickInfo pickInfo, int flags, Point3d iPnt, GeometryRetained geom, int geomIndex) { - + Point3d pnts[] = new Point3d[4]; double sdist[] = new double[1]; double minDist = Double.MAX_VALUE; double x = 0, y = 0, z = 0; int[] vtxIndexArr = new int[4]; - + int i = ((vertexFormat & GeometryArray.BY_REFERENCE) == 0 ? initialVertexIndex : initialCoordIndex); pnts[0] = new Point3d(); pnts[1] = new Point3d(); pnts[2] = new Point3d(); pnts[3] = new Point3d(); - + switch (pickShape.getPickType()) { case PickShape.PICKRAY: PickRay pickRay= (PickRay) pickShape; @@ -81,13 +81,13 @@ class QuadArrayRetained extends GeometryArrayRetained { y = iPnt.y; z = iPnt.z; if((flags & PickInfo.CLOSEST_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, + storeInterestData(pickInfo, flags, geom, geomIndex, vtxIndexArr, iPnt, sdist[0]); } } if((flags & PickInfo.ALL_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, - vtxIndexArr, iPnt, sdist[0]); + storeInterestData(pickInfo, flags, geom, geomIndex, + vtxIndexArr, iPnt, sdist[0]); } } } @@ -111,19 +111,19 @@ class QuadArrayRetained extends GeometryArrayRetained { y = iPnt.y; z = iPnt.z; if((flags & PickInfo.CLOSEST_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, + storeInterestData(pickInfo, flags, geom, geomIndex, vtxIndexArr, iPnt, sdist[0]); } } if((flags & PickInfo.ALL_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, - vtxIndexArr, iPnt, sdist[0]); + storeInterestData(pickInfo, flags, geom, geomIndex, + vtxIndexArr, iPnt, sdist[0]); } } } break; case PickShape.PICKBOUNDINGBOX: - BoundingBox bbox = (BoundingBox) + BoundingBox bbox = (BoundingBox) ((PickBounds) pickShape).bounds; while (i < validVertexCount) { for(int j=0; j<4; j++) { @@ -140,19 +140,19 @@ class QuadArrayRetained extends GeometryArrayRetained { y = iPnt.y; z = iPnt.z; if((flags & PickInfo.CLOSEST_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, + storeInterestData(pickInfo, flags, geom, geomIndex, vtxIndexArr, iPnt, sdist[0]); } } if((flags & PickInfo.ALL_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, - vtxIndexArr, iPnt, sdist[0]); + storeInterestData(pickInfo, flags, geom, geomIndex, + vtxIndexArr, iPnt, sdist[0]); } } } break; case PickShape.PICKBOUNDINGSPHERE: - BoundingSphere bsphere = (BoundingSphere) + BoundingSphere bsphere = (BoundingSphere) ((PickBounds) pickShape).bounds; while (i < validVertexCount) { @@ -170,20 +170,20 @@ class QuadArrayRetained extends GeometryArrayRetained { y = iPnt.y; z = iPnt.z; if((flags & PickInfo.CLOSEST_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, + storeInterestData(pickInfo, flags, geom, geomIndex, vtxIndexArr, iPnt, sdist[0]); } } if((flags & PickInfo.ALL_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, - vtxIndexArr, iPnt, sdist[0]); + storeInterestData(pickInfo, flags, geom, geomIndex, + vtxIndexArr, iPnt, sdist[0]); } } } break; case PickShape.PICKBOUNDINGPOLYTOPE: - BoundingPolytope bpolytope = (BoundingPolytope) + BoundingPolytope bpolytope = (BoundingPolytope) ((PickBounds) pickShape).bounds; while (i < validVertexCount) { @@ -201,13 +201,13 @@ class QuadArrayRetained extends GeometryArrayRetained { y = iPnt.y; z = iPnt.z; if((flags & PickInfo.CLOSEST_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, + storeInterestData(pickInfo, flags, geom, geomIndex, vtxIndexArr, iPnt, sdist[0]); } } if((flags & PickInfo.ALL_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, - vtxIndexArr, iPnt, sdist[0]); + storeInterestData(pickInfo, flags, geom, geomIndex, + vtxIndexArr, iPnt, sdist[0]); } } } @@ -230,13 +230,13 @@ class QuadArrayRetained extends GeometryArrayRetained { y = iPnt.y; z = iPnt.z; if((flags & PickInfo.CLOSEST_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, + storeInterestData(pickInfo, flags, geom, geomIndex, vtxIndexArr, iPnt, sdist[0]); } } if((flags & PickInfo.ALL_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, - vtxIndexArr, iPnt, sdist[0]); + storeInterestData(pickInfo, flags, geom, geomIndex, + vtxIndexArr, iPnt, sdist[0]); } } } @@ -259,13 +259,13 @@ class QuadArrayRetained extends GeometryArrayRetained { y = iPnt.y; z = iPnt.z; if((flags & PickInfo.CLOSEST_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, + storeInterestData(pickInfo, flags, geom, geomIndex, vtxIndexArr, iPnt, sdist[0]); } } if((flags & PickInfo.ALL_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, - vtxIndexArr, iPnt, sdist[0]); + storeInterestData(pickInfo, flags, geom, geomIndex, + vtxIndexArr, iPnt, sdist[0]); } } } @@ -274,8 +274,8 @@ class QuadArrayRetained extends GeometryArrayRetained { // Should not happen since API already check for this throw new IllegalArgumentException(J3dI18N.getString("QuadArrayRetained0")); default: - throw new RuntimeException("PickShape not supported for intersection "); - } + throw new RuntimeException("PickShape not supported for intersection "); + } if (minDist < Double.MAX_VALUE) { iPnt.x = x; @@ -284,7 +284,7 @@ class QuadArrayRetained extends GeometryArrayRetained { return true; } return false; - + } // intersect pnts[] with every quad in this object @@ -298,14 +298,14 @@ class QuadArrayRetained extends GeometryArrayRetained { points[1] = new Point3d(); points[2] = new Point3d(); points[3] = new Point3d(); - + switch (pnts.length) { case 3: // Triangle while (i < validVertexCount) { - getVertexData(i++, points[0]); - getVertexData(i++, points[1]); - getVertexData(i++, points[2]); - getVertexData(i++, points[3]); + getVertexData(i++, points[0]); + getVertexData(i++, points[1]); + getVertexData(i++, points[2]); + getVertexData(i++, points[3]); if (intersectTriTri(points[0], points[1], points[2], pnts[0], pnts[1], pnts[2]) || intersectTriTri(points[0], points[2], points[3], @@ -315,12 +315,12 @@ class QuadArrayRetained extends GeometryArrayRetained { } break; case 4: // Quad - + while (i < validVertexCount) { - getVertexData(i++, points[0]); - getVertexData(i++, points[1]); - getVertexData(i++, points[2]); - getVertexData(i++, points[3]); + getVertexData(i++, points[0]); + getVertexData(i++, points[1]); + getVertexData(i++, points[2]); + getVertexData(i++, points[3]); if (intersectTriTri(points[0], points[1], points[2], pnts[0], pnts[1], pnts[2]) || intersectTriTri(points[0], points[1], points[2], @@ -335,10 +335,10 @@ class QuadArrayRetained extends GeometryArrayRetained { break; case 2: // Line while (i < validVertexCount) { - getVertexData(i++, points[0]); - getVertexData(i++, points[1]); - getVertexData(i++, points[2]); - getVertexData(i++, points[3]); + getVertexData(i++, points[0]); + getVertexData(i++, points[1]); + getVertexData(i++, points[2]); + getVertexData(i++, points[3]); if (intersectSegment(points, pnts[0], pnts[1], dist, null)) { return true; @@ -347,10 +347,10 @@ class QuadArrayRetained extends GeometryArrayRetained { break; case 1: // Point while (i < validVertexCount) { - getVertexData(i++, points[0]); - getVertexData(i++, points[1]); - getVertexData(i++, points[2]); - getVertexData(i++, points[3]); + getVertexData(i++, points[0]); + getVertexData(i++, points[1]); + getVertexData(i++, points[2]); + getVertexData(i++, points[3]); if (intersectTriPnt(points[0], points[1], points[2], pnts[0]) || intersectTriPnt(points[0], points[2], points[3], @@ -362,7 +362,7 @@ class QuadArrayRetained extends GeometryArrayRetained { } return false; } - + boolean intersect(Transform3D thisToOtherVworld, GeometryRetained geom) { @@ -374,12 +374,12 @@ class QuadArrayRetained extends GeometryArrayRetained { points[1] = new Point3d(); points[2] = new Point3d(); points[3] = new Point3d(); - + while (i < validVertexCount) { - getVertexData(i++, points[0]); - getVertexData(i++, points[1]); - getVertexData(i++, points[2]); - getVertexData(i++, points[3]); + getVertexData(i++, points[0]); + getVertexData(i++, points[1]); + getVertexData(i++, points[2]); + getVertexData(i++, points[3]); thisToOtherVworld.transform(points[0]); thisToOtherVworld.transform(points[1]); thisToOtherVworld.transform(points[2]); @@ -407,10 +407,10 @@ class QuadArrayRetained extends GeometryArrayRetained { BoundingBox box = (BoundingBox) targetBound; while (i < validVertexCount) { - getVertexData(i++, points[0]); - getVertexData(i++, points[1]); - getVertexData(i++, points[2]); - getVertexData(i++, points[3]); + getVertexData(i++, points[0]); + getVertexData(i++, points[1]); + getVertexData(i++, points[2]); + getVertexData(i++, points[3]); if (intersectBoundingBox(points, box, null, null)) { return true; } @@ -420,10 +420,10 @@ class QuadArrayRetained extends GeometryArrayRetained { BoundingSphere bsphere = (BoundingSphere) targetBound; while (i < validVertexCount) { - getVertexData(i++, points[0]); - getVertexData(i++, points[1]); - getVertexData(i++, points[2]); - getVertexData(i++, points[3]); + getVertexData(i++, points[0]); + getVertexData(i++, points[1]); + getVertexData(i++, points[2]); + getVertexData(i++, points[3]); if (intersectBoundingSphere(points, bsphere, null, null)) { return true; @@ -434,10 +434,10 @@ class QuadArrayRetained extends GeometryArrayRetained { BoundingPolytope bpolytope = (BoundingPolytope) targetBound; while (i < validVertexCount) { - getVertexData(i++, points[0]); - getVertexData(i++, points[1]); - getVertexData(i++, points[2]); - getVertexData(i++, points[3]); + getVertexData(i++, points[0]); + getVertexData(i++, points[1]); + getVertexData(i++, points[2]); + getVertexData(i++, points[3]); if (intersectBoundingPolytope(points, bpolytope, null, null)) { return true; } @@ -445,11 +445,11 @@ class QuadArrayRetained extends GeometryArrayRetained { break; default: throw new RuntimeException("Bounds not supported for intersection " - + targetBound); + + targetBound); } return false; } - + // From Graphics Gems IV (pg5) and Graphics Gems II, Pg170 // The centroid is the area-weighted sum of the centroids of // disjoint triangles that make up the polygon. diff --git a/src/classes/share/javax/media/j3d/Raster.java b/src/classes/share/javax/media/j3d/Raster.java index 57c70ea..70d0fc1 100644 --- a/src/classes/share/javax/media/j3d/Raster.java +++ b/src/classes/share/javax/media/j3d/Raster.java @@ -126,71 +126,71 @@ public class Raster extends Geometry { public static final int ALLOW_POSITION_WRITE = CapabilityBits.RASTER_ALLOW_POSITION_WRITE; - /** + /** * Specifies that this Raster allows reading the source or * destination offset. - */ + */ public static final int ALLOW_OFFSET_READ = CapabilityBits.RASTER_ALLOW_OFFSET_READ; - - /** + + /** * Specifies that this Raster allows writing the source or * destination offset. - */ - public static final int + */ + public static final int ALLOW_OFFSET_WRITE = CapabilityBits.RASTER_ALLOW_OFFSET_WRITE; - /** + /** * Specifies that this Raster allows reading the image. - */ - public static final int + */ + public static final int ALLOW_IMAGE_READ = CapabilityBits.RASTER_ALLOW_IMAGE_READ; - - /** - * Specifies that this Raster allows writing the image. - */ - public static final int + + /** + * Specifies that this Raster allows writing the image. + */ + public static final int ALLOW_IMAGE_WRITE = CapabilityBits.RASTER_ALLOW_IMAGE_WRITE; - /** + /** * Specifies that this Raster allows reading the depth component. - */ - public static final int + */ + public static final int ALLOW_DEPTH_COMPONENT_READ = CapabilityBits.RASTER_ALLOW_DEPTH_COMPONENT_READ; - - /** - * Specifies that this Raster allows writing the depth component. - */ - public static final int + + /** + * Specifies that this Raster allows writing the depth component. + */ + public static final int ALLOW_DEPTH_COMPONENT_WRITE = CapabilityBits.RASTER_ALLOW_DEPTH_COMPONENT_WRITE; - /** + /** * Specifies that this Raster allows reading the size. */ public static final int ALLOW_SIZE_READ = CapabilityBits.RASTER_ALLOW_SIZE_READ; - - /** + + /** * Specifies that this Raster allows writing the size. */ public static final int ALLOW_SIZE_WRITE = CapabilityBits.RASTER_ALLOW_SIZE_WRITE; - /** - * Specifies that this Raster allows reading the type. - */ - public static final int + /** + * Specifies that this Raster allows reading the type. + */ + public static final int ALLOW_TYPE_READ = CapabilityBits.RASTER_ALLOW_TYPE_READ; - - /** + + /** * Specifies that this Raster allows reading the clip mode. * * @since Java 3D 1.3 */ public static final int ALLOW_CLIP_MODE_READ = CapabilityBits.RASTER_ALLOW_CLIP_MODE_READ; - - /** + + /** * Specifies that this Raster allows writing the clip mode. * * @since Java 3D 1.3 @@ -281,17 +281,17 @@ public class Raster extends Geometry { * @param image the ImageComponent2D object containing the * color data * @param depthComponent the DepthComponent object containing the depth - * (z-buffer) data + * (z-buffer) data * * @exception IllegalArgumentException if the image class of the specified * ImageComponent2D is ImageClass.NIO_IMAGE_BUFFER. */ - public Raster(Point3f pos, - int type, + public Raster(Point3f pos, + int type, Point srcOffset, Dimension size, - ImageComponent2D image, - DepthComponent depthComponent) { + ImageComponent2D image, + DepthComponent depthComponent) { // set default read capabilities setDefaultReadCapabilities(readCapabilities); @@ -336,7 +336,7 @@ public class Raster extends Geometry { ImageComponent2D image, DepthComponent depthComponent) { - + // set default read capabilities setDefaultReadCapabilities(readCapabilities); @@ -366,11 +366,11 @@ public class Raster extends Geometry { * @param pos the new position of this raster * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph - */ + */ public void setPosition(Point3f pos) { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_POSITION_WRITE)) - throw new CapabilityNotSetException(J3dI18N.getString("Raster0")); + throw new CapabilityNotSetException(J3dI18N.getString("Raster0")); ((RasterRetained)this.retained).setPosition(pos); } @@ -383,7 +383,7 @@ public class Raster extends Geometry { public void getPosition(Point3f pos) { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_POSITION_READ)) - throw new CapabilityNotSetException(J3dI18N.getString("Raster1")); + throw new CapabilityNotSetException(J3dI18N.getString("Raster1")); ((RasterRetained)this.retained).getPosition(pos); } @@ -399,8 +399,8 @@ public class Raster extends Geometry { checkForLiveOrCompiled(); ((RasterRetained)this.retained).setType(type); } - - + + /** * Retrieves the current type of this raster object, one of: RASTER_COLOR, * RASTER_DEPTH, or RASTER_COLOR_DEPTH. @@ -411,7 +411,7 @@ public class Raster extends Geometry { public int getType() { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_TYPE_READ)) - throw new CapabilityNotSetException(J3dI18N.getString("Raster2")); + throw new CapabilityNotSetException(J3dI18N.getString("Raster2")); return (((RasterRetained)this.retained).getType()); } @@ -550,8 +550,8 @@ public class Raster extends Geometry { throw new CapabilityNotSetException(J3dI18N.getString("Raster9")); ((RasterRetained)this.retained).setSize(width, height); - } - + } + /** * Sets the size of the array of pixels to be copied. * @param size the new size @@ -564,9 +564,9 @@ public class Raster extends Geometry { throw new CapabilityNotSetException(J3dI18N.getString("Raster9")); ((RasterRetained)this.retained).setSize(size.width, size.height); - } - - + } + + /** * Retrieves the current raster size. * @param size the object that will receive the size @@ -576,10 +576,10 @@ public class Raster extends Geometry { public void getSize(Dimension size) { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_SIZE_READ)) - throw new CapabilityNotSetException(J3dI18N.getString("Raster1")); + throw new CapabilityNotSetException(J3dI18N.getString("Raster1")); ((RasterRetained)this.retained).getSize(size); - } + } /** @@ -659,13 +659,13 @@ public class Raster extends Geometry { * @exception IllegalArgumentException if the image class of the specified * ImageComponent2D is ImageClass.NIO_IMAGE_BUFFER. * - */ + */ public void setImage(ImageComponent2D image) { - + if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_IMAGE_WRITE)) throw new CapabilityNotSetException(J3dI18N.getString("Raster3")); - + // Do illegal sharing check if(image != null) { ImageComponent2DRetained imageRetained = (ImageComponent2DRetained) image.retained; @@ -675,7 +675,7 @@ public class Raster extends Geometry { } } } - + ((RasterRetained)this.retained).setImage(image); } @@ -685,11 +685,11 @@ public class Raster extends Geometry { * color data * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph - */ + */ public ImageComponent2D getImage() { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_IMAGE_READ)) - throw new CapabilityNotSetException(J3dI18N.getString("Raster4")); + throw new CapabilityNotSetException(J3dI18N.getString("Raster4")); return (((RasterRetained)this.retained).getImage()); } @@ -700,7 +700,7 @@ public class Raster extends Geometry { * depth (z-buffer) data * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph - */ + */ public void setDepthComponent(DepthComponent depthComponent) { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_DEPTH_COMPONENT_WRITE)) @@ -714,22 +714,22 @@ public class Raster extends Geometry { * depth (z-buffer) data * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph - */ + */ public DepthComponent getDepthComponent() { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_DEPTH_COMPONENT_READ)) - throw new CapabilityNotSetException(J3dI18N.getString("Raster6")); + throw new CapabilityNotSetException(J3dI18N.getString("Raster6")); return (((RasterRetained)this.retained).getDepthComponent()); } - + /** * @deprecated replaced with cloneNodeComponent(boolean forceDuplicate) */ public NodeComponent cloneNodeComponent() { Raster r = new Raster(); - r.duplicateNodeComponent(this); + r.duplicateNodeComponent(this); return r; } @@ -745,14 +745,14 @@ public class Raster extends Geometry { checkDuplicateNodeComponent(originalNodeComponent); } - + /** * Copies all node information from <code>originalNodeComponent</code> into * the current node. This method is called from the * <code>duplicateNode</code> method. This routine does * the actual duplication of all "local data" (any data defined in - * this object). + * this object). * * @param originalNodeComponent the original node to duplicate. * @param forceDuplicate when set to <code>true</code>, causes the @@ -764,7 +764,7 @@ public class Raster extends Geometry { * @see Node#cloneTree * @see NodeComponent#setDuplicateOnCloneTree */ - void duplicateAttributes(NodeComponent originalNodeComponent, + void duplicateAttributes(NodeComponent originalNodeComponent, boolean forceDuplicate) { super.duplicateAttributes(originalNodeComponent, forceDuplicate); @@ -795,11 +795,11 @@ public class Raster extends Geometry { } - /** + /** * This function is called from getNodeComponent() to see if any of - * the sub-NodeComponents duplicateOnCloneTree flag is true. - * If it is the case, current NodeComponent needs to - * duplicate also even though current duplicateOnCloneTree flag is false. + * the sub-NodeComponents duplicateOnCloneTree flag is true. + * If it is the case, current NodeComponent needs to + * duplicate also even though current duplicateOnCloneTree flag is false. * This should be overwrite by NodeComponent which contains sub-NodeComponent. */ boolean duplicateChild() { diff --git a/src/classes/share/javax/media/j3d/RasterRetained.java b/src/classes/share/javax/media/j3d/RasterRetained.java index 8c4d8c4..8e97715 100644 --- a/src/classes/share/javax/media/j3d/RasterRetained.java +++ b/src/classes/share/javax/media/j3d/RasterRetained.java @@ -47,7 +47,7 @@ class RasterRetained extends GeometryRetained { /** * Raster type - */ + */ int type = Raster.RASTER_COLOR; private int clipMode = Raster.CLIP_POSITION; @@ -59,17 +59,17 @@ class RasterRetained extends GeometryRetained { private int xDstOffset = 0; private int yDstOffset = 0; ImageComponent2DRetained image = null; - Texture2DRetained texture = null; + Texture2DRetained texture = null; DepthComponentRetained depthComponent = null; - + RasterRetained() { this.geoType = GEO_TYPE_RASTER; } /** * Set the Raster position - * @param position new raster position - */ + * @param position new raster position + */ final void setPosition(Point3f pos) { geomLock.getLock(); position.x = pos.x; @@ -99,8 +99,8 @@ class RasterRetained extends GeometryRetained { this.type = type; geomLock.unLock(); } - - + + /** * Retrieves the current type of this raster object, one of: RASTER_COLOR, * RASTER_DEPTH, or RASTER_COLOR_DEPTH. @@ -125,9 +125,9 @@ class RasterRetained extends GeometryRetained { if(source.isLive()) { //update the Shape3Ds that refer to this Raster int un = userLists.size(); - ArrayList shapeList; + ArrayList shapeList; Shape3DRetained ms, shape; - int sn; + int sn; for(int i = 0; i < un; i++) { shapeList = (ArrayList)userLists.get(i); sn = shapeList.size(); @@ -141,8 +141,8 @@ class RasterRetained extends GeometryRetained { } } - - + + /** * Retrieves the current clipping mode of this raster object. * @return clipMode the clipping mode of this raster, @@ -185,15 +185,15 @@ class RasterRetained extends GeometryRetained { this.width = width; this.height = height; geomLock.unLock(); - } - + } + /** * Gets the size of the array of pixels to be copied. * @param size the new size */ final void getSize(Dimension size) { size.setSize(width, height); - } + } /** * Sets the destination pixel offset of the upper-left @@ -218,19 +218,19 @@ class RasterRetained extends GeometryRetained { /** - * Initializes the raster image to the specified image. + * Initializes the raster image to the specified image. * @param image new ImageCompoent2D object used as the raster image */ final void initImage(ImageComponent2D img) { - + int texFormat; - + if(img == null) { image = null; texture = null; return; } - + image = (ImageComponent2DRetained) img.retained; image.setEnforceNonPowerOfTwoSupport(true); switch(image.getNumberOfComponents()) { @@ -250,17 +250,17 @@ class RasterRetained extends GeometryRetained { assert false; return; } - - Texture2D tex2D = new Texture2D(Texture.BASE_LEVEL, texFormat, + + Texture2D tex2D = new Texture2D(Texture.BASE_LEVEL, texFormat, img.getWidth(), img.getHeight()); texture = (Texture2DRetained) tex2D.retained; texture.setUseAsRaster(true); // Fix to issue 372 : ImageComponent.set(BufferedImage) ignored when used by Raster image.addUser(texture); texture.initImage(0,img); - + } - + /** * Sets the pixel array used to copy pixels to/from a Canvas3D. * This is used when the type is RASTER_COLOR or RASTER_COLOR_DEPTH. @@ -268,12 +268,12 @@ class RasterRetained extends GeometryRetained { * color data */ final void setImage(ImageComponent2D img) { - - if((img != null) && - (img.getImageClass() == ImageComponent.ImageClass.NIO_IMAGE_BUFFER)) { + + if((img != null) && + (img.getImageClass() == ImageComponent.ImageClass.NIO_IMAGE_BUFFER)) { throw new IllegalArgumentException(J3dI18N.getString("Background14")); } - + TextureRetained oldTex = this.texture; if (source.isLive()) { if (this.texture != null) { @@ -291,7 +291,7 @@ class RasterRetained extends GeometryRetained { if (texture != null) { texture.setLive(inBackgroundGroup, refCount); } - + sendChangedMessage((J3dThread.UPDATE_RENDER|J3dThread.UPDATE_RENDERING_ATTRIBUTES), oldTex, this.texture); } @@ -326,12 +326,12 @@ class RasterRetained extends GeometryRetained { if (depthComponent == null) { this.depthComponent = null; } else { - this.depthComponent = + this.depthComponent = (DepthComponentRetained)depthComponent.retained; } geomLock.unLock(); - } - + } + /** * Retrieves the current depth image object. * @return depthImage DepthComponent containing the @@ -384,14 +384,14 @@ class RasterRetained extends GeometryRetained { void computeBoundingBox() { if(clipMode == Raster.CLIP_IMAGE) { - // Disable view frustum culling by setting the raster's bounds to - // infinity. - Point3d minBounds = new Point3d(Double.NEGATIVE_INFINITY, - Double.NEGATIVE_INFINITY, + // Disable view frustum culling by setting the raster's bounds to + // infinity. + Point3d minBounds = new Point3d(Double.NEGATIVE_INFINITY, + Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY); - Point3d maxBounds = new Point3d(Double.POSITIVE_INFINITY, - Double.POSITIVE_INFINITY, - Double.POSITIVE_INFINITY); + Point3d maxBounds = new Point3d(Double.POSITIVE_INFINITY, + Double.POSITIVE_INFINITY, + Double.POSITIVE_INFINITY); geoBounds.setUpper(maxBounds); geoBounds.setLower(minBounds); } else { @@ -406,7 +406,7 @@ class RasterRetained extends GeometryRetained { void update() { computeBoundingBox(); - } + } private void sendChangedMessage(int threads, Object arg1, Object arg2) { @@ -447,9 +447,9 @@ class RasterRetained extends GeometryRetained { // Check if adjusted position needs to be computed Point3d adjPos = new Point3d(); // Position of the Raster after adjusting for dstOffset adjPos.set(position); - + Point2d winCoord = new Point2d(); // Position of Raster in window coordinates - Transform3D localToImagePlate = new Transform3D(); // Local to Image plate transform + Transform3D localToImagePlate = new Transform3D(); // Local to Image plate transform Point3d clipCoord = computeWinCoord(cv, ra, winCoord, adjPos, localToImagePlate); @@ -457,7 +457,7 @@ class RasterRetained extends GeometryRetained { if (clipCoord == null) { return; } - + if(clipMode == Raster.CLIP_POSITION) { // Do trivial reject test on Raster position. if(!isRasterClipPositionInside(clipCoord)) { @@ -470,15 +470,15 @@ class RasterRetained extends GeometryRetained { winCoord.y += yDstOffset; // System.err.println("Step 2 : adjPos " + adjPos + " winCoord " + winCoord); - - + + if((type == Raster.RASTER_COLOR) || (type == Raster.RASTER_COLOR_DEPTH)) { - float devCoordZ = (float) (clipCoord.z * 0.5 - 0.5); + float devCoordZ = (float) (clipCoord.z * 0.5 - 0.5); // Do textfill stuffs if (texture != null) { - // setup Texture pipe. - cv.updateTextureForRaster(texture); - + // setup Texture pipe. + cv.updateTextureForRaster(texture); + cv.textureFill(this, winCoord, (float) devCoordZ, alpha); // Restore texture pipe. @@ -490,12 +490,12 @@ class RasterRetained extends GeometryRetained { if((type == Raster.RASTER_DEPTH) || (type == Raster.RASTER_COLOR_DEPTH)) { Point2i srcOffset = new Point2i(xSrcOffset, ySrcOffset); - + if (clipMode == Raster.CLIP_IMAGE) { clipImage(cv, ra, winCoord, srcOffset); } - - computeObjCoord(cv, winCoord, adjPos, localToImagePlate); + + computeObjCoord(cv, winCoord, adjPos, localToImagePlate); cv.executeRasterDepth(cv.ctx, (float) adjPos.x, @@ -509,11 +509,11 @@ class RasterRetained extends GeometryRetained { depthComponent.height, depthComponent.type, ((DepthComponentIntRetained) depthComponent).depthData); - + } } - - + + /** * Clips the image against the window. This method simulates * clipping the image by determining the subimage that will be @@ -523,59 +523,59 @@ class RasterRetained extends GeometryRetained { * the underlying graphics library automatically. */ private void clipImage(Canvas3D canvas, RenderAtom ra, Point2d winCoord, Point2i srcOffset) { - + if ((winCoord.x > 0) && (winCoord.y > 0)) { return; } - + // Check if the Raster point will be culled // Note that w use 1 instead of 0, because when hardware // tranform the coordinate back to winCoord it may get // a small negative value due to numerically inaccurancy. - // This clip the Raster away and cause flickering + // This clip the Raster away and cause flickering // (see bug 4732965) if(winCoord.x < 1) { // Negate the window position and use this as the offset srcOffset.x = (int)-winCoord.x+1; winCoord.x = 1; } - + if(winCoord.y < 1) { // Negate the window position and use this as the offset srcOffset.y = (int)-winCoord.y+1; winCoord.y = 1; } - + //check if user-specified subimage is smaller than the clipped image if (srcOffset.x < xSrcOffset) srcOffset.x = xSrcOffset; if(srcOffset.y < ySrcOffset) srcOffset.y = ySrcOffset; - - } - + } + + private boolean isRasterClipPositionInside(Point3d clipCoord) { return (clipCoord.x >= -1.0) && (clipCoord.x <= 1.0) && (clipCoord.y >= -1.0) && (clipCoord.y <= 1.0); } - + private void computeObjCoord(Canvas3D canvas, Point2d winCoord, Point3d objCoord, Transform3D localToImagePlate) { // Back transform this pt. from window to object coordinates - // Assumes this method is ALWAYS called after computeWinCoord has been - // called. computeWinCoord calculates the Vworld to Image Plate Xform. + // Assumes this method is ALWAYS called after computeWinCoord has been + // called. computeWinCoord calculates the Vworld to Image Plate Xform. // This method simply uses it without recomputing it. - - canvas.getPixelLocationInImagePlate(winCoord.x, winCoord.y, objCoord.z, + + canvas.getPixelLocationInImagePlate(winCoord.x, winCoord.y, objCoord.z, objCoord); // Get image plate to object coord transform // inv(P x M) localToImagePlate.invert(); localToImagePlate.transform(objCoord); } - - private Point3d computeWinCoord(Canvas3D canvas, RenderAtom ra, + + private Point3d computeWinCoord(Canvas3D canvas, RenderAtom ra, Point2d winCoord, Point3d objCoord, Transform3D localToImagePlate) { // Get local to Vworld transform @@ -583,64 +583,64 @@ class RasterRetained extends GeometryRetained { if (rm == null) { // removeRenderAtom() may set ra.renderMolecule to null - // in RenderBin before this renderer thread run. + // in RenderBin before this renderer thread run. return null; } - + // MT safe issue: We can't reference ra.renderMolecule below since // RenderBin thread may set it to null anytime. Use rm instead. Transform3D lvw = rm.localToVworld[rm.localToVworldIndex[ NodeRetained.LAST_LOCAL_TO_VWORLD]]; - + Point3d clipCoord3 = new Point3d(); clipCoord3.set(objCoord); Point4d clipCoord4 = new Point4d(); - + // Transform point from local coord. to clipping coord. lvw.transform(clipCoord3); canvas.vworldToEc.transform(clipCoord3); canvas.projTrans.transform(clipCoord3, clipCoord4); - + // clip check in Z - if((clipCoord4.w <= 0.0) || + if((clipCoord4.w <= 0.0) || (clipCoord4.z > clipCoord4.w) || (-clipCoord4.z > clipCoord4.w)) { return null; } double invW = 1.0 / clipCoord4.w; - + clipCoord3.x = clipCoord4.x * invW; clipCoord3.y = clipCoord4.y * invW; clipCoord3.z = clipCoord4.z * invW; - + // Get Vworld to image plate Xform canvas.getLastVworldToImagePlate(localToImagePlate); - - // v' = vwip x lvw x v - // where v' = transformed vertex, + + // v' = vwip x lvw x v + // where v' = transformed vertex, // lvw = local to Vworld Xform // vwip = Vworld to Image plate Xform // v = vertex - + // Compute composite local to image plate Xform localToImagePlate.mul(lvw); - + // Transform the Raster's position from object to world coordinates localToImagePlate.transform(objCoord); - - + + // Get the window coordinates of this point canvas.getPixelLocationFromImagePlate(objCoord, winCoord); - + return clipCoord3; } - + int getClassType() { return RASTER_TYPE; } - + // notifies the Raster mirror object that the image data in a referenced // ImageComponent object is changed. // Currently we are not making use of this information. @@ -652,8 +652,8 @@ class RasterRetained extends GeometryRetained { boolean intersect(PickShape pickShape, PickInfo pickInfo, int flags, Point3d iPnt, GeometryRetained geom, int geomIndex) { return false; - } - + } + boolean intersect(Bounds targetBound) { return false; } @@ -665,7 +665,7 @@ class RasterRetained extends GeometryRetained { geom) { return false; } - boolean intersect(Transform3D thisLocalToVworld, + boolean intersect(Transform3D thisLocalToVworld, Transform3D otherLocalToVworld, GeometryRetained geom) { return false; @@ -677,7 +677,7 @@ class RasterRetained extends GeometryRetained { void handleFrequencyChange(int bit) { if (bit == Raster.ALLOW_IMAGE_WRITE) setFrequencyChangeMask(bit, 0x1); - + } } diff --git a/src/classes/share/javax/media/j3d/RenderAtom.java b/src/classes/share/javax/media/j3d/RenderAtom.java index 2bbce61..55eb48d 100644 --- a/src/classes/share/javax/media/j3d/RenderAtom.java +++ b/src/classes/share/javax/media/j3d/RenderAtom.java @@ -48,12 +48,12 @@ class RenderAtom extends Object implements ObjectUpdate { RenderMolecule renderMolecule = null; - /** + /** * The lights that influence this RenderAtom */ LightRetained[] lights = null; - /** + /** * The fog that influences this RenderAtom */ FogRetained fog = null; @@ -102,10 +102,10 @@ class RenderAtom extends Object implements ObjectUpdate { // true if in dirty depth sort position list static int IN_SORTED_POS_DIRTY_TRANSP_LIST = 0x80; - + // A bitmask for all the bit specified above in this renderAtom int dirtyMask = 0; - + /** * Environment set that this renderAtom belongs to, used * to compare the new env set with the old one when the @@ -123,7 +123,7 @@ class RenderAtom extends Object implements ObjectUpdate { * The last time this atom was reported visible */ long lastVisibleTime = -1; - + /** * Next and Previous references for the list of RenderAtoms * groupType is a mask set to true if this renderAtom is part of the displaylist array @@ -172,7 +172,7 @@ class RenderAtom extends Object implements ObjectUpdate { RenderAtom() { } - /** + /** * This sets the inRenderBin flag */ synchronized void setRenderBin(boolean value) { @@ -185,7 +185,7 @@ class RenderAtom extends Object implements ObjectUpdate { else { dirtyMask |= IN_RENDERBIN; } - + } /** @@ -225,12 +225,12 @@ class RenderAtom extends Object implements ObjectUpdate { break; default: if (app.polygonAttributes != null) { - if ((app.polygonAttributes.polygonMode == + if ((app.polygonAttributes.polygonMode == PolygonAttributes.POLYGON_POINT) && (app.pointAttributes != null) && app.pointAttributes.pointAntialiasing) { return false; - } else if ((app.polygonAttributes.polygonMode == + } else if ((app.polygonAttributes.polygonMode == PolygonAttributes.POLYGON_LINE) && (app.lineAttributes != null) && app.lineAttributes.lineAntialiasing) { @@ -241,9 +241,9 @@ class RenderAtom extends Object implements ObjectUpdate { } return ((ta == null) || - (ta.transparencyMode == + (ta.transparencyMode == TransparencyAttributes.NONE) || - (ta.transparencyMode == + (ta.transparencyMode == TransparencyAttributes.SCREEN_DOOR)); } else { return ((ta == null) || @@ -270,7 +270,7 @@ class RenderAtom extends Object implements ObjectUpdate { boolean onLocaleVwcBoundsUpdateList() { return ((dirtyMask & ON_LOCALE_VWC_BOUNDS_UPDATELIST) != 0); - } + } boolean isOriented() { return ((dirtyMask & IS_ORIENTED) != 0); @@ -284,16 +284,16 @@ class RenderAtom extends Object implements ObjectUpdate { boolean inDirtyOrientedRAs() { return ((dirtyMask & IN_DIRTY_ORIENTED_RAs) != 0); } - + public void updateObject() { if (inRenderBin()) { - int lastLVWIndex = + int lastLVWIndex = renderMolecule.localToVworldIndex[NodeRetained.LAST_LOCAL_TO_VWORLD]; for (int i = 0; i < rListInfo.length; i++) { if (rListInfo[i].geometry() == null) continue; - + if (geometryAtom.source.inBackgroundGroup) { if (rListInfo[i].infLocalToVworld == null) rListInfo[i].infLocalToVworld = new Transform3D(); @@ -314,9 +314,9 @@ class RenderAtom extends Object implements ObjectUpdate { } void updateOrientedTransform() { - int lastLVWIndex = + int lastLVWIndex = renderMolecule.localToVworldIndex[NodeRetained.LAST_LOCAL_TO_VWORLD]; - Transform3D orientedTransform = + Transform3D orientedTransform = ((OrientedShape3DRetained)geometryAtom.source). getOrientedTransform(renderMolecule.renderBin.view.viewIndex); for (int i = 0; i < rListInfo.length; i++) { @@ -362,19 +362,19 @@ class RenderAtom extends Object implements ObjectUpdate { void updateLocaleVwcBounds() { // it is possible that inRenderBin could be false because - // the renderAtom could have been removed from RenderBin + // the renderAtom could have been removed from RenderBin // in the same frame, and removeRenderAtoms does happen // before updateLocaleVwcBounds if (inRenderBin()) { // Check if the locale of this is different from the - // locale on which the view is,then compute the translated + // locale on which the view is,then compute the translated // localeVwcBounds if (renderMolecule.renderBin.locale != geometryAtom.source.locale) { - + geometryAtom.source.locale. - hiRes.difference(renderMolecule.renderBin.locale.hiRes, + hiRes.difference(renderMolecule.renderBin.locale.hiRes, renderMolecule.renderBin.localeTranslation); - localeVwcBounds.translate(geometryAtom.source.vwcBounds, + localeVwcBounds.translate(geometryAtom.source.vwcBounds, renderMolecule.renderBin.localeTranslation); } else { localeVwcBounds.set(geometryAtom.source.vwcBounds); diff --git a/src/classes/share/javax/media/j3d/RenderAtomListInfo.java b/src/classes/share/javax/media/j3d/RenderAtomListInfo.java index 1be930f..3ff04f6 100644 --- a/src/classes/share/javax/media/j3d/RenderAtomListInfo.java +++ b/src/classes/share/javax/media/j3d/RenderAtomListInfo.java @@ -37,12 +37,12 @@ package javax.media.j3d; class RenderAtomListInfo extends Object { // RenderAtom that its a part of - RenderAtom renderAtom = null; + RenderAtom renderAtom = null; // Specific geometry index in the GeometryAtom geometryArr list that // corresponds to this RenderAtomListInfo int index; - + // Prev and next pointer RenderAtomListInfo next = null; RenderAtomListInfo prev = null; diff --git a/src/classes/share/javax/media/j3d/RenderBin.java b/src/classes/share/javax/media/j3d/RenderBin.java index 0a60252..662db84 100644 --- a/src/classes/share/javax/media/j3d/RenderBin.java +++ b/src/classes/share/javax/media/j3d/RenderBin.java @@ -40,12 +40,12 @@ import java.util.*; */ class RenderBin extends J3dStructure implements ObjectUpdate { - + /** * The list of RenderAtoms */ ArrayList renderAtoms = new ArrayList(5); - + /** * A couple ArrayLists used during light Processing */ @@ -82,17 +82,17 @@ class RenderBin extends J3dStructure implements ObjectUpdate { * are temporarily removed from the bin. */ ArrayList updateCheckList = new ArrayList(); - + /** * The number of lights supported by the underlying context. */ int maxLights; - + /** * The opaque objects */ LightBin opaqueBin = null; - + /** * OpaqueBins to be added for the next frame */ @@ -104,28 +104,28 @@ class RenderBin extends J3dStructure implements ObjectUpdate { ArrayList allTransparentObjects = new ArrayList(5); TransparentRenderingInfo transparentInfo; - + /** * List of RenderAtoms whose postion have changed - only used for * depth sorted transparency - */ + */ ArrayList positionDirtyList = new ArrayList(5); - + /** * Used when ColoringAttributes is null */ Color3f white = new Color3f(1.0f, 1.0f, 1.0f); - + /** * Used when Background is null */ Color3f black = new Color3f(0.0f, 0.0f, 0.0f); - + /** * The backgound color data. */ BackgroundRetained background = new BackgroundRetained(); - + /** * The view platform transforms. */ @@ -134,7 +134,7 @@ class RenderBin extends J3dStructure implements ObjectUpdate { // used for updating vpSchedSphere Transform3D vpcToVworld = new Transform3D(); - + /** * Two bounding spheres to track the scheduling region of * the view platform. @@ -154,7 +154,7 @@ class RenderBin extends J3dStructure implements ObjectUpdate { /** * back clip distance in vworld - */ + */ double backClipDistanceInVworld; boolean backClipActive = false; @@ -178,9 +178,9 @@ class RenderBin extends J3dStructure implements ObjectUpdate { * The View for this render bin */ View view = null; - + private Comparator transparencySortComparator = null; - + private ArrayList toBeAddedTextureResourceFreeList = new ArrayList(5); private ArrayList displayListResourceFreeList = new ArrayList(5); @@ -200,7 +200,7 @@ class RenderBin extends J3dStructure implements ObjectUpdate { static int REEVALUATE_ALL_ENV = REEVALUATE_LIGHTS | REEVALUATE_FOG | REEVALUATE_MCLIP; int envDirty = 0; - + private boolean reEvaluateBg = true; private boolean reloadBgTexture = true; @@ -234,13 +234,13 @@ class RenderBin extends J3dStructure implements ObjectUpdate { /** * remove the bins first before adding them to new ones */ - IndexedUnorderSet removeRenderAtomInRMList = + IndexedUnorderSet removeRenderAtomInRMList = new IndexedUnorderSet(RenderMolecule.class, RenderMolecule.REMOVE_RENDER_ATOM_IN_RM_LIST, null); - + /** - * list of affect OrderedGroups with childIndexOrder changed. + * list of affect OrderedGroups with childIndexOrder changed. */ ArrayList ogCIOList = new ArrayList(5); @@ -301,7 +301,7 @@ class RenderBin extends J3dStructure implements ObjectUpdate { ArrayList newNodeComponentList = new ArrayList(5); ArrayList removeNodeComponentList = new ArrayList(5); ArrayList dirtyNodeComponentList = new ArrayList(5); - + ArrayList textureBinList = new ArrayList(5); /** @@ -319,7 +319,7 @@ class RenderBin extends J3dStructure implements ObjectUpdate { // Cached copy of dirty oriented RAs to be updated in MasterControl ArrayList cachedDirtyOrientedRAs = null; - // list of offScreen message that + // list of offScreen message that ArrayList offScreenMessage = new ArrayList(5); // Vector used for locale translation @@ -332,7 +332,7 @@ class RenderBin extends J3dStructure implements ObjectUpdate { // Separate dlists per rinfo that were added/removed in this snapshot ArrayList addDlistPerRinfo = new ArrayList(5); ArrayList removeDlistPerRinfo = new ArrayList(5); - + Locale locale = null; // Set to true if locale changes as part of UPDATE_VIEW message @@ -358,7 +358,7 @@ class RenderBin extends J3dStructure implements ObjectUpdate { // Temporary dirtylist ArrayList dirtyList = new ArrayList(5); - + // Transaprency sort mode int transpSortMode = View.TRANSPARENCY_SORT_NONE; int cachedTranspSortMode = View.TRANSPARENCY_SORT_NONE; @@ -372,11 +372,11 @@ class RenderBin extends J3dStructure implements ObjectUpdate { Point3d eyeInVworld = new Point3d(); // Number of RenderAtomListInfo in the depthSortedList int nElements = 0; - - + + /** - * Constructs a new RenderBin + * Constructs a new RenderBin */ RenderBin(VirtualUniverse u, View v) { super(u, J3dThread.UPDATE_RENDER); @@ -393,7 +393,7 @@ class RenderBin extends J3dStructure implements ObjectUpdate { dlistRenderMethod = (DisplayListRenderMethod) VirtualUniverse.mc.getDisplayListRenderMethod(); } - + /** * updateObject */ @@ -409,16 +409,16 @@ class RenderBin extends J3dStructure implements ObjectUpdate { TextureRetained tex; Integer texIdObj; int size; - + // System.err.println("dirtyRenderMoleculeList.size = "+dirtyRenderMoleculeList.size()); // System.err.println("reEvaluateBg = "+reEvaluateBg); - // System.err.println("reEvaluateClip = "+reEvaluateClip); + // System.err.println("reEvaluateClip = "+reEvaluateClip); // System.err.println("<========+End All Cached Values===========>"); // Add the new lightBins that have been created // System.err.println("objUpdateList.size = "+objUpdateList.size()); // System.err.println("addOpaqueBin = "+addOpaqueBin); // System.err.println("opaqueBin = "+opaqueBin); - + // List of renderMolecule from which renderAtoms have been removed size = removeRenderAtomInRMList.size(); if (size > 0) { @@ -439,13 +439,13 @@ class RenderBin extends J3dStructure implements ObjectUpdate { orderBin.addRemoveOrderedCollection(); } } - + size = ogCIOList.size(); - if(size > 0) { + if(size > 0) { J3dMessage m; for(i=0; i<size; i++) { m = (J3dMessage) ogCIOList.get(i); - + switch(m.type) { case J3dMessage.ORDERED_GROUP_TABLE_CHANGED: OrderedGroupRetained og = (OrderedGroupRetained)m.args[3]; @@ -453,8 +453,8 @@ class RenderBin extends J3dStructure implements ObjectUpdate { og.childIndexOrder = ((int[])m.args[4]); } break; - - + + case J3dMessage.ORDERED_GROUP_INSERTED: case J3dMessage.ORDERED_GROUP_REMOVED: if(m.args[3] != null) { @@ -467,14 +467,14 @@ class RenderBin extends J3dStructure implements ObjectUpdate { } } } - + break; } m.decRefcount(); } } - - + + if (addOpaqueBin != null) { if (opaqueBin != null) { @@ -503,14 +503,14 @@ class RenderBin extends J3dStructure implements ObjectUpdate { bgOpaqueBin = bgAddOpaqueBin; } } - + size = orderedBinsList.size(); if (size > 0 ) { - + for (i = 0; i < size; i++) { ArrayList obs= (ArrayList) orderedBinsList.get(i); ArrayList list = (ArrayList) toBeAddedBinList.get(i); - + int lSize = list.size(); for (j = 0; j < lSize; j++) { obs.add(list.get(j)); @@ -518,8 +518,8 @@ class RenderBin extends J3dStructure implements ObjectUpdate { } } - - size = raLocaleVwcBoundsUpdateList.size(); + + size = raLocaleVwcBoundsUpdateList.size(); if ( size > 0) { RenderAtom renderAtom; for (i = 0; i < size; i++) { @@ -527,7 +527,7 @@ class RenderBin extends J3dStructure implements ObjectUpdate { renderAtom.updateLocaleVwcBounds(); } } - + if ((size = aBinUpdateList.size()) > 0) { for (i = 0; i < size; i++) { AttributeBin abin = (AttributeBin)aBinUpdateList.get(i); @@ -557,7 +557,7 @@ class RenderBin extends J3dStructure implements ObjectUpdate { tb = (TextureBin) tbUpdateList.get(i); // Bug Id : 4701430 - Have to be sure tb.shaderBin is // not equal to null. This is a temporary fix for j3d1.3. - if (((tb.tbFlag & TextureBin.RESORT) != 0) && + if (((tb.tbFlag & TextureBin.RESORT) != 0) && (tb.shaderBin != null)) { tb.shaderBin.reInsertTextureBin(tb); @@ -573,7 +573,7 @@ class RenderBin extends J3dStructure implements ObjectUpdate { if ((size = rmUpdateList.size()) > 0) { for (i = 0; i < size; i++) { rm = (RenderMolecule)rmUpdateList.get(i); - + boolean changeLists = rm.updateNodeComponent(); // If an existing rm went from opaque to transparent or vice-versa // and has not been removed, then switch the RM @@ -587,21 +587,21 @@ class RenderBin extends J3dStructure implements ObjectUpdate { } } - - size = objUpdateList.size(); + + size = objUpdateList.size(); if ( size > 0) { for (i = 0; i < size; i++) { ob = (ObjectUpdate)objUpdateList.get(i); ob.updateObject(); } } - - size = dirtyReferenceGeomList.size(); + + size = dirtyReferenceGeomList.size(); if ( size > 0) { GeometryArrayRetained geo; Canvas3D canvases[] = view.getCanvases(); - + for (i = 0; i < size; i++) { geo = (GeometryArrayRetained) dirtyReferenceGeomList.get(i); // Evaluate the nodeComponentList for all the canvases @@ -625,11 +625,11 @@ class RenderBin extends J3dStructure implements ObjectUpdate { geo.geomLock.unLock(); } - + } - + if (reEvaluateBg) { - setBackground(currentActiveBackground); + setBackground(currentActiveBackground); } size = textureBinList.size(); @@ -639,7 +639,7 @@ class RenderBin extends J3dStructure implements ObjectUpdate { Canvas3D cv; boolean useSharedCtx = false; TextureRetained texture; - + // do a quick check to see if there is any canvas using // shared context for (j = 0; j < canvasList.length && !useSharedCtx; j++) { @@ -648,8 +648,8 @@ class RenderBin extends J3dStructure implements ObjectUpdate { useSharedCtx = true; } } - - for (int m = 0; m <size; m++) { + + for (int m = 0; m <size; m++) { k = 0; TextureBin tb = (TextureBin) textureBinList.get(m); tb.tbFlag |= TextureBin.ON_RENDER_BIN_LIST; @@ -660,31 +660,31 @@ class RenderBin extends J3dStructure implements ObjectUpdate { for (i = 0; i < tb.texUnitState.length; i++) { if (tb.texUnitState[i] != null && tb.texUnitState[i].texture != null) { - + texture = tb.texUnitState[i].texture; - + // for all the textures in this texture bin list that // need to be reloaded, add the textures to the - // corresponding resource reload list if the + // corresponding resource reload list if the // resource uses shared context, // so that the texture can be reloaded up front, and // we don't need to do make context current for // each texture reload. Make Context current isn't // cheap. - + if (useSharedCtx) { synchronized (texture.resourceLock) { for (j = 0; j < canvasList.length; j++) { cv = canvasList[j][0]; - if (cv.useSharedCtx && + if (cv.useSharedCtx && cv.screen.renderer != null && ((cv.screen.renderer.rendererBit & (texture.resourceCreationMask | texture.resourceInReloadList)) == 0)) { - + cv.screen.renderer.textureReloadList.add( texture); - + texture.resourceInReloadList |= cv.screen.renderer.rendererBit; } @@ -695,8 +695,8 @@ class RenderBin extends J3dStructure implements ObjectUpdate { } } } - - size = newNodeComponentList.size(); + + size = newNodeComponentList.size(); if ( size > 0) { //System.err.println("newNodeComponentlist.size= " + size); Canvas3D canvases[] = view.getCanvases(); @@ -727,22 +727,22 @@ class RenderBin extends J3dStructure implements ObjectUpdate { nodeComponentList.add(nc); } } - - size = removeNodeComponentList.size(); + + size = removeNodeComponentList.size(); if ( size > 0) { for (i = 0; i < size; i++) { nodeComponentList.remove(removeNodeComponentList.get(i)); } } - - // reevaluate dirty node component + + // reevaluate dirty node component size = dirtyNodeComponentList.size(); if (size > 0) { Canvas3D canvases[] = view.getCanvases(); for (i = 0; i < size; i++) { // Evaluate the nodeComponentList for all the canvases - ImageComponentRetained nc = + ImageComponentRetained nc = (ImageComponentRetained)dirtyNodeComponentList.get(i); if (nc.isByReference()) { nc.geomLock.getLock(); @@ -764,17 +764,17 @@ class RenderBin extends J3dStructure implements ObjectUpdate { if (canvases[j].ctx != null) { nc.evaluateExtensions(canvases[j]); } - } + } } } } - + if (reEvaluateClip) { double[] retVal = null; if ((retVal = universe.renderingEnvironmentStructure.backClipDistanceInVworld(vpSchedSphereInVworld, view)) != null) { backClipDistanceInVworld = retVal[0]; - backClipActive = true; + backClipActive = true; } else { backClipActive = false; @@ -784,21 +784,21 @@ class RenderBin extends J3dStructure implements ObjectUpdate { // Issue 113 - multiScreen no longer used // multiScreen = ((view.getScreens()).length > 1); - + // renderBin is ready now, so send the offScreen message - size = offScreenMessage.size(); + size = offScreenMessage.size(); if ( size > 0) { J3dMessage m; for (i=size-1; i>=0; i--) { m = (J3dMessage) offScreenMessage.get(i); m.threads = J3dThread.RENDER_THREAD; ((Canvas3D)m.args[0]).screen.renderer.rendererStructure.addMessage(m); - + // the above call will increment the reference count again m.decRefcount(); } } - + // called from renderBin when there are dirtyOrientedRAs // This routin cache the dirtyOrintedRAs to be updated // by mastercontrol @@ -816,7 +816,7 @@ class RenderBin extends J3dStructure implements ObjectUpdate { } } } - + if (vpcToVworldDirty) { vworldToVpc.invert(vpcToVworld); // Have the send down the lights, so set the canvas @@ -829,7 +829,7 @@ class RenderBin extends J3dStructure implements ObjectUpdate { Transform3D xform; canvases[0].getCenterEyeInImagePlate(eyeInVworld); // xform is imagePlateToLocal - xform = canvases[0].canvasViewCache.getImagePlateToVworld(); + xform = canvases[0].canvasViewCache.getImagePlateToVworld(); xform.transform(eyeInVworld); } if (transpSortMode == View.TRANSPARENCY_SORT_GEOMETRY && transparentInfo != null) { @@ -839,10 +839,10 @@ class RenderBin extends J3dStructure implements ObjectUpdate { } size = dirtyDepthSortRenderAtom.size(); - + if (sortAll || size > 0) { int tsize = allTransparentObjects.size(); - + double zVal; for (i = 0; i < tsize; i++) { RenderAtom renderAtom = (RenderAtom)allTransparentObjects.get(i); @@ -851,20 +851,20 @@ class RenderBin extends J3dStructure implements ObjectUpdate { continue; zVal = renderAtom.geometryAtom.centroid[k].distanceSquared(eyeInVworld); renderAtom.parentTInfo[k].zVal = zVal; - renderAtom.parentTInfo[k].geometryAtom = renderAtom.geometryAtom; + renderAtom.parentTInfo[k].geometryAtom = renderAtom.geometryAtom; } } - + // Check to see if a majority of the transparent Objects have changed // If less than 66% of all transparentStructs are dirty // then, remove and insert, otherwise resort everything - - + + if (size > 0 && 1.5f * numDirtyTinfo > nElements) { // System.err.println("sortAll 3, size = "+size); sortAll = true; } - + if (size > 0) { TransparentRenderingInfo dirtyList = null, rList; Iterator dirtyDepthSortIterator = dirtyDepthSortRenderAtom.iterator(); @@ -907,7 +907,7 @@ class RenderBin extends J3dStructure implements ObjectUpdate { Canvas3D canvasList[][] = view.getCanvasList(false); Canvas3D cv; ArrayList rlist = new ArrayList(5); - + for (i = 0; i < canvasList.length; i++) { cv = canvasList[i][0]; if (cv.useSharedCtx) { @@ -920,20 +920,20 @@ class RenderBin extends J3dStructure implements ObjectUpdate { updateDlistCanvasResource(canvasList[i]); } } - + } - + if (dirtyRenderMoleculeList.size() > 0 || addDlistPerRinfo.size() > 0 || removeDlistPerRinfo.size() > 0 || displayListResourceFreeList.size() > 0 || toBeAddedTextureResourceFreeList.size() > 0 ) { - + Canvas3D canvasList[][] = view.getCanvasList(false); Canvas3D cv; - + for (i = 0; i < canvasList.length; i++) { cv = canvasList[i][0]; if (cv.useSharedCtx && (cv.screen.renderer != null)) { @@ -949,7 +949,7 @@ class RenderBin extends J3dStructure implements ObjectUpdate { id = (Integer)displayListResourceFreeList.get(i); VirtualUniverse.mc.freeDisplayListId(id); } - + // lock list of dlist // XXXX: Instead of copying could we keep 2 arrays // and just toggle? @@ -970,9 +970,9 @@ class RenderBin extends J3dStructure implements ObjectUpdate { dlistLockList.add(ra.geometry()); } } - + } - + clearAllUpdateObjectState(); /* if (opaqueBin != null) { @@ -981,17 +981,17 @@ class RenderBin extends J3dStructure implements ObjectUpdate { System.err.println("***** End Dumping OpaqueBin *****"); } */ - + } - - + + // Shared context case void updateDlistRendererResource(Renderer rdr) { int i; int size = 0; RenderAtomListInfo arr[]; RenderAtomListInfo ra; - + // XXXX: there is a possible problem in the case of multiple // renderers (i.e., multiple screens). Unless the // MasterControl sends us a separate message for each @@ -1016,7 +1016,7 @@ class RenderBin extends J3dStructure implements ObjectUpdate { geo.addDlistUser(this, ra); if (((geo.resourceCreationMask & rdr.rendererBit) == 0) || - (geo.getDlistTimeStamp(rdr.rendererBit) != + (geo.getDlistTimeStamp(rdr.rendererBit) != rdr.sharedCtxTimeStamp)) { geo.resourceCreationMask |= rdr.rendererBit; dirtyList.add(ra); @@ -1057,7 +1057,7 @@ class RenderBin extends J3dStructure implements ObjectUpdate { dirtyList.clear(); } } - + // Non-shared context case void updateDlistCanvasResource(Canvas3D[] canvases) { int i, j; @@ -1091,7 +1091,7 @@ class RenderBin extends J3dStructure implements ObjectUpdate { geo.removeDlistUser(this, arr[i]); } } - + // add to the dirty list per canvas for (j = 0; j < canvases.length; j++) { cv = canvases[j]; @@ -1104,8 +1104,8 @@ class RenderBin extends J3dStructure implements ObjectUpdate { GeometryArrayRetained geo = (GeometryArrayRetained) ra.geometry(); if ((cv.ctx != null) && - ((geo.resourceCreationMask & cv.canvasBit) == 0) || - (geo.getDlistTimeStamp(cv.canvasBit) != + ((geo.resourceCreationMask & cv.canvasBit) == 0) || + (geo.getDlistTimeStamp(cv.canvasBit) != cv.ctxTimeStamp)) { geo.resourceCreationMask |= cv.canvasBit; dirtyList.add(ra); @@ -1134,7 +1134,7 @@ class RenderBin extends J3dStructure implements ObjectUpdate { if ((size = dirtyList.size()) > 0) { for (i = 0; i <size; i++) { ra = (RenderAtomListInfo)dirtyList.get(i); - GeometryArrayRetained geo = (GeometryArrayRetained)ra.geometry(); + GeometryArrayRetained geo = (GeometryArrayRetained)ra.geometry(); if ((geo.resourceCreationMask & cv.canvasBit) != 0) { cv.dirtyRenderAtomList.add(ra); } @@ -1146,7 +1146,7 @@ class RenderBin extends J3dStructure implements ObjectUpdate { } - + void clearAllUpdateObjectState() { localeChanged = false; obList.clear(); @@ -1184,13 +1184,13 @@ class RenderBin extends J3dStructure implements ObjectUpdate { dirtyDepthSortRenderAtom.clear(); numDirtyTinfo = 0; } - + void updateRendererResource(Renderer rdr) { RenderMolecule rm; TextureRetained tex; Integer texIdObj; - if (rdr == null) + if (rdr == null) return; // Take care of display lists per Rinfo that should be rebuilt @@ -1209,7 +1209,7 @@ class RenderBin extends J3dStructure implements ObjectUpdate { rdr.dirtyDisplayList = true; } - + // Take care of display lists that should be rebuilt size = dirtyRenderMoleculeList.size(); if (size > 0) { @@ -1226,7 +1226,7 @@ class RenderBin extends J3dStructure implements ObjectUpdate { for (int j=0; j < size; j++) { tex = (TextureRetained)toBeAddedTextureResourceFreeList.get(j); id = tex.objectId; - if ((id >= rdr.textureIDResourceTable.size()) || + if ((id >= rdr.textureIDResourceTable.size()) || (id <= 0) || (rdr.textureIDResourceTable.get(id) != tex)) { // tex.objectId may change by another Renderer thread, @@ -1311,7 +1311,7 @@ class RenderBin extends J3dStructure implements ObjectUpdate { for (j=0; j < size; j++) { tex = (TextureRetained)toBeAddedTextureResourceFreeList.get(j); id = tex.objectId; - if ((id >= cv.textureIDResourceTable.size()) || + if ((id >= cv.textureIDResourceTable.size()) || (id <= 0) || (cv.textureIDResourceTable.get(id) != tex)) { // tex.objectId may change by another Renderer thread, @@ -1319,7 +1319,7 @@ class RenderBin extends J3dStructure implements ObjectUpdate { // rdr.textureIdResourceTable id = cv.textureIDResourceTable.indexOf(tex); - if (id <= 0) { + if (id <= 0) { continue; } } @@ -1360,7 +1360,7 @@ class RenderBin extends J3dStructure implements ObjectUpdate { if (nMsg > 0) { for (i=0; i < nMsg; i++) { m = messages[i]; - switch (m.type) { + switch (m.type) { case J3dMessage.INSERT_NODES: insertNodes(m); m.decRefcount(); @@ -1382,7 +1382,7 @@ class RenderBin extends J3dStructure implements ObjectUpdate { lightMessageList.add(m); break; } - + } break; case J3dMessage.SWITCH_CHANGED: @@ -1415,7 +1415,7 @@ class RenderBin extends J3dStructure implements ObjectUpdate { GeometryAtom[] gaArr = (GeometryAtom[])m.args[3]; RenderAtom ra = null; int start = -1; - + // Get the first ra that is visible for (int k = 0; (k < gaArr.length && (start < 0)); k++) { ra = gaArr[k].getRenderAtom(view); @@ -1426,12 +1426,12 @@ class RenderBin extends J3dStructure implements ObjectUpdate { start = k; } } - + if (start >= 0) { boolean restructure = (nc.mirror.changedFrequent == 0 || ra.renderMolecule.definingTransparency != nc.mirror); processRenderMoleculeNodeComponentChanged(m.args, - RenderMolecule.TRANSPARENCY_DIRTY, + RenderMolecule.TRANSPARENCY_DIRTY, start, restructure); } m.decRefcount(); @@ -1443,7 +1443,7 @@ class RenderBin extends J3dStructure implements ObjectUpdate { GeometryAtom[] gaArr = (GeometryAtom[])m.args[3]; RenderAtom ra = null; int start = -1; - + // Get the first ra that is visible // Get the first ra that is visible for (int k = 0; (k < gaArr.length && (start < 0)); k++) { @@ -1455,12 +1455,12 @@ class RenderBin extends J3dStructure implements ObjectUpdate { start = k; } } - + if (start >= 0) { boolean restructure = (nc.mirror.changedFrequent == 0 || ra.renderMolecule.definingPolygonAttributes != nc.mirror); processRenderMoleculeNodeComponentChanged(m.args, - RenderMolecule.POLYGONATTRS_DIRTY, + RenderMolecule.POLYGONATTRS_DIRTY, start, restructure); } m.decRefcount(); @@ -1472,7 +1472,7 @@ class RenderBin extends J3dStructure implements ObjectUpdate { GeometryAtom[] gaArr = (GeometryAtom[])m.args[3]; RenderAtom ra = null; int start = -1; - + // Get the first ra that is visible // Get the first ra that is visible for (int k = 0; (k < gaArr.length && (start < 0)); k++) { @@ -1484,12 +1484,12 @@ class RenderBin extends J3dStructure implements ObjectUpdate { start = k; } } - + if (start >= 0) { boolean restructure = (nc.mirror.changedFrequent == 0 || ra.renderMolecule.definingLineAttributes != nc.mirror); processRenderMoleculeNodeComponentChanged(m.args, - RenderMolecule.LINEATTRS_DIRTY, + RenderMolecule.LINEATTRS_DIRTY, start, restructure); } m.decRefcount(); @@ -1512,11 +1512,11 @@ class RenderBin extends J3dStructure implements ObjectUpdate { start = k; } } - + if (start >= 0) { boolean restructure = (nc.mirror.changedFrequent == 0 || ra.renderMolecule.definingPointAttributes != nc.mirror); - + processRenderMoleculeNodeComponentChanged(m.args, RenderMolecule.POINTATTRS_DIRTY, start, restructure); @@ -1530,7 +1530,7 @@ class RenderBin extends J3dStructure implements ObjectUpdate { GeometryAtom[] gaArr = (GeometryAtom[])m.args[3]; RenderAtom ra = null; int start = -1; - + // Get the first ra that is visible // Get the first ra that is visible for (int k = 0; (k < gaArr.length && (start < 0)); k++) { @@ -1542,12 +1542,12 @@ class RenderBin extends J3dStructure implements ObjectUpdate { start = k; } } - + if (start >= 0) { boolean restructure = (nc.mirror.changedFrequent == 0 || ra.renderMolecule.definingMaterial != nc.mirror); processRenderMoleculeNodeComponentChanged(m.args, - RenderMolecule.MATERIAL_DIRTY, + RenderMolecule.MATERIAL_DIRTY, start, restructure); } m.decRefcount(); @@ -1559,7 +1559,7 @@ class RenderBin extends J3dStructure implements ObjectUpdate { GeometryAtom[] gaArr = (GeometryAtom[])m.args[3]; RenderAtom ra = null; int start = -1; - + // Get the first ra that is visible // Get the first ra that is visible for (int k = 0; (k < gaArr.length && (start < 0)); k++) { @@ -1571,48 +1571,48 @@ class RenderBin extends J3dStructure implements ObjectUpdate { start = k; } } - + if (start >= 0) { boolean restructure = (nc.mirror.changedFrequent == 0 || ra.renderMolecule.definingColoringAttributes != nc.mirror); processRenderMoleculeNodeComponentChanged(m.args, - RenderMolecule.COLORINGATTRS_DIRTY, + RenderMolecule.COLORINGATTRS_DIRTY, start, restructure); } m.decRefcount(); break; } - case J3dMessage.TEXTUREATTRIBUTES_CHANGED: + case J3dMessage.TEXTUREATTRIBUTES_CHANGED: processTextureAttributesChanged( (NodeComponentRetained) m.args[0], (GeometryAtom[])m.args[3]); m.decRefcount(); break; - case J3dMessage.IMAGE_COMPONENT_CHANGED: + case J3dMessage.IMAGE_COMPONENT_CHANGED: addDirtyNodeComponent((NodeComponentRetained)m.args[0]); m.decRefcount(); break; - case J3dMessage.TEXTURE_UNIT_STATE_CHANGED: + case J3dMessage.TEXTURE_UNIT_STATE_CHANGED: processTextureUnitStateChanged( (NodeComponentRetained) m.args[0], (GeometryAtom[])m.args[3]); m.decRefcount(); break; - case J3dMessage.TEXCOORDGENERATION_CHANGED: + case J3dMessage.TEXCOORDGENERATION_CHANGED: processTexCoordGenerationChanged( (NodeComponentRetained) m.args[0], (GeometryAtom[])m.args[3]); m.decRefcount(); break; - case J3dMessage.TEXTURE_CHANGED: + case J3dMessage.TEXTURE_CHANGED: // Texture is always in a sole user position processTextureChanged((NodeComponentRetained) m.args[0], (GeometryAtom[])m.args[3], - m.args); + m.args); m.decRefcount(); - break; + break; case J3dMessage.SHADER_APPEARANCE_CHANGED: case J3dMessage.SHADER_ATTRIBUTE_SET_CHANGED: - case J3dMessage.SHADER_ATTRIBUTE_CHANGED: + case J3dMessage.SHADER_ATTRIBUTE_CHANGED: processShaderComponentChanged(m.args); m.decRefcount(); break; @@ -1669,7 +1669,7 @@ class RenderBin extends J3dStructure implements ObjectUpdate { if ((component & MorphRetained.GEOMETRY_CHANGED) == 0) { visGAIsDirty = true; visQuery = true; - } + } m.decRefcount(); break; case J3dMessage.UPDATE_VIEW: @@ -1688,19 +1688,19 @@ class RenderBin extends J3dStructure implements ObjectUpdate { reEvaluateSortMode = true; cachedTranspSortMode = value; } - updateViewPlatform((ViewPlatformRetained)vp.retained, + updateViewPlatform((ViewPlatformRetained)vp.retained, ((Float)m.args[1]).floatValue()); visQuery = true; // XXXX : Handle view.visibilityPolicy changed. if(((View.VISIBILITY_POLICY_DIRTY != 0) && (View.VISIBILITY_DRAW_ALL != view.viewCache.visibilityPolicy)) || locale != ((ViewPlatformRetained) (vp.retained)).locale) { - + for (int n = (renderAtoms.size() - 1); n>=0 ; n--) { removeARenderAtom((RenderAtom) renderAtoms.get(n)); } renderAtoms.clear(); - visGAIsDirty = true; + visGAIsDirty = true; if (locale != ((ViewPlatformRetained) (vp.retained)).locale) { locale = ((ViewPlatformRetained) (vp.retained)).locale; localeChanged = true; @@ -1716,7 +1716,7 @@ class RenderBin extends J3dStructure implements ObjectUpdate { m.decRefcount(); break; case J3dMessage.TEXT3D_DATA_CHANGED: - processDataChanged((Object[])m.args[0], + processDataChanged((Object[])m.args[0], (Object[])m.args[1], referenceTime); m.decRefcount(); @@ -1727,7 +1727,7 @@ class RenderBin extends J3dStructure implements ObjectUpdate { visQuery = true; m.decRefcount(); break; - + case J3dMessage.BOUNDS_AUTO_COMPUTE_CHANGED: case J3dMessage.REGION_BOUND_CHANGED: processGeometryAtomsChanged((Object[])m.args[0]); @@ -1750,7 +1750,7 @@ class RenderBin extends J3dStructure implements ObjectUpdate { case J3dMessage.ORDERED_GROUP_REMOVED: processOrderedGroupRemoved(m); // Do not do decRefcount() here. We'll do it in updateObject(). - ogCIOList.add(m); + ogCIOList.add(m); break; case J3dMessage.ORDERED_GROUP_TABLE_CHANGED: // Do not do decRefcount() here. We'll do it in updateObject(). @@ -1768,7 +1768,7 @@ class RenderBin extends J3dStructure implements ObjectUpdate { m.decRefcount(); } } - + if (transformMsg) { processTransformChanged(referenceTime); transformMsg = false; @@ -1778,7 +1778,7 @@ class RenderBin extends J3dStructure implements ObjectUpdate { lightMessageList.clear(); } VirtualUniverse.mc.addMirrorObject(this); - + // clear the array to prevent memory leaks Arrays.fill(messages, 0, nMsg, null); } @@ -1787,18 +1787,18 @@ class RenderBin extends J3dStructure implements ObjectUpdate { currentActiveBackground = universe.renderingEnvironmentStructure. getApplicationBackground(vpSchedSphereInVworld, locale, view); } - + if (visQuery) { GeometryAtom[] bgGeometryAtoms; boolean allEnComp; - + // computeViewFrustumBox in VisibilityStructure. computeViewFrustumBBox(viewFrustumBBox); // System.err.println("viewFrustumBBox = " + this); ViewPlatform vp = view.getViewPlatform(); - if (vp != null) { + if (vp != null) { allEnComp = universe.geometryStructure. getVisibleBHTrees(this, viewFrustumBBox, locale, referenceTime, @@ -1815,7 +1815,7 @@ class RenderBin extends J3dStructure implements ObjectUpdate { currentActiveBackground.getBackgroundGeometryAtoms(); if (bgGeometryAtoms != null) { processBgGeometryAtoms(bgGeometryAtoms, referenceTime); - } + } } if(!allEnComp) { @@ -1828,7 +1828,7 @@ class RenderBin extends J3dStructure implements ObjectUpdate { else if (frameCount == notVisibleCount) { removeCutoffTime = referenceTime; } - } + } } // Reset dirty bits. visGAIsDirty = false; @@ -1879,7 +1879,7 @@ class RenderBin extends J3dStructure implements ObjectUpdate { altAppearanceDirty = false; view.renderBinReady = true; - + VirtualUniverse.mc.sendRunMessage(view, J3dThread.RENDER_THREAD); } @@ -1971,7 +1971,7 @@ class RenderBin extends J3dStructure implements ObjectUpdate { } } } - + /** * Transparency/Line/point/Poly attributes is different from other renderMolecule @@ -2025,7 +2025,7 @@ class RenderBin extends J3dStructure implements ObjectUpdate { if (nc.mirror.changedFrequent != 0) { if ((ra.renderMolecule.soleUserCompDirty& RenderMolecule.ALL_DIRTY_BITS) == 0 ) { rmUpdateList.add(ra.renderMolecule); - } + } ra.renderMolecule.soleUserCompDirty |= mask; } */ @@ -2033,7 +2033,7 @@ class RenderBin extends J3dStructure implements ObjectUpdate { else { if ((ra.renderMolecule.soleUserCompDirty& RenderMolecule.ALL_DIRTY_BITS) == 0 ) { rmUpdateList.add(ra.renderMolecule); - } + } ra.renderMolecule.soleUserCompDirty |= mask; } } @@ -2067,7 +2067,7 @@ class RenderBin extends J3dStructure implements ObjectUpdate { // to check if the node component is currently // in an equivalent bin or not. If it is in an // equivalent bin, then the affected ra needs to - // be reinserted to a bin with a soleUser + // be reinserted to a bin with a soleUser // TextureAttributes for (int t = 0; t < tb.texUnitState.length; t++) { @@ -2130,7 +2130,7 @@ class RenderBin extends J3dStructure implements ObjectUpdate { // to check if the node component is currently // in an equivalent bin or not. If it is in an // equivalent bin, then the affected ra needs to - // be reinserted to a bin with a soleUser + // be reinserted to a bin with a soleUser // TexCoordGeneration for (int t = 0; t < tb.texUnitState.length; t++) { @@ -2189,11 +2189,11 @@ class RenderBin extends J3dStructure implements ObjectUpdate { tb = ra.renderMolecule.textureBin; if (tb.soleUserCompDirty == 0) { - // put this texture unit state on the sole user + // put this texture unit state on the sole user // update list if it's not already there tbUpdateList.add(tb); } - + tb.soleUserCompDirty |= TextureBin.SOLE_USER_DIRTY_TEXTURE; } break; @@ -2222,7 +2222,7 @@ class RenderBin extends J3dStructure implements ObjectUpdate { if (oldImage != null) { this.removeNodeComponent(oldImage); } - + // then add the new one to the list if it is byReference or // modifiable. @@ -2255,7 +2255,7 @@ class RenderBin extends J3dStructure implements ObjectUpdate { if (oldImage != null) { this.removeNodeComponent(oldImage); } - + // then add the new one to the list if it is byReference if (images[i] != null ) { this.addNodeComponent(((ImageComponent)images[i]).retained); @@ -2285,7 +2285,7 @@ class RenderBin extends J3dStructure implements ObjectUpdate { if (firstTextureBin) { - for (int t = 0; + for (int t = 0; t < tb.texUnitState.length && !mirrorSet; t++) { @@ -2315,7 +2315,7 @@ class RenderBin extends J3dStructure implements ObjectUpdate { } } } - + /** * This processes a rendering attribute change. @@ -2348,7 +2348,7 @@ class RenderBin extends J3dStructure implements ObjectUpdate { // any separate dlist in RMs to go thru VA boolean restructure = (nc.mirror.changedFrequent == 0 || ra.renderMolecule.textureBin.attributeBin.definingRenderingAttributes != nc.mirror); - + if (component != RenderingAttributesRetained.VISIBLE) { for (i = start; i < gaArr.length; i++) { ra = gaArr[i].getRenderAtom(view); @@ -2382,11 +2382,11 @@ class RenderBin extends J3dStructure implements ObjectUpdate { } } } - } + } else { for (i = start; i < gaArr.length; i++) { ra = gaArr[i].getRenderAtom(view); - + if (ra== null || !ra.inRenderBin()) continue; renderAtoms.remove(renderAtoms.indexOf(ra)); @@ -2428,9 +2428,9 @@ class RenderBin extends J3dStructure implements ObjectUpdate { // Issue 471 - Don't check ATTRIBUTE_VALUE_UPDATE, there is no need // to do anything to the shader bins when a value changes. - boolean spUpdate = + boolean spUpdate = ((component & ShaderAppearanceRetained.SHADER_PROGRAM) != 0); - boolean sasUpdate = + boolean sasUpdate = (((component & ShaderAppearanceRetained.SHADER_ATTRIBUTE_SET) != 0) || ((component & ShaderConstants.ATTRIBUTE_SET_PUT) != 0) || ((component & ShaderConstants.ATTRIBUTE_SET_REMOVE) != 0) || @@ -2446,14 +2446,14 @@ class RenderBin extends J3dStructure implements ObjectUpdate { */ ShaderBin sBin; - + for (i = start; i < gaArr.length; i++) { ra = gaArr[i].getRenderAtom(view); if (ra== null || !ra.inRenderBin()) continue; - + sBin = ra.renderMolecule.textureBin.shaderBin; - + if (sBin.componentDirty == 0) { sBinUpdateList.add(sBin); sBin.componentDirty |= ShaderBin.SHADER_PROGRAM_DIRTY; @@ -2469,7 +2469,7 @@ class RenderBin extends J3dStructure implements ObjectUpdate { ra = gaArr[i].getRenderAtom(view); if (ra== null || !ra.inRenderBin()) continue; - + AttributeBin attrBin = ra.renderMolecule.textureBin.attributeBin; ra.renderMolecule.removeRenderAtom(ra); reInsertShaderBin(attrBin, ra); @@ -2485,15 +2485,15 @@ class RenderBin extends J3dStructure implements ObjectUpdate { */ ShaderBin sBin; - + for (i = 0; i < gaArr.length; i++) { ra = gaArr[i].getRenderAtom(view); if (ra== null || !ra.inRenderBin()) continue; - + sBin = ra.renderMolecule.textureBin.shaderBin; - + if (sBin.componentDirty == 0) { sBinUpdateList.add(sBin); sBin.componentDirty |= ShaderBin.SHADER_ATTRIBUTE_SET_DIRTY; @@ -2509,7 +2509,7 @@ class RenderBin extends J3dStructure implements ObjectUpdate { ra = gaArr[i].getRenderAtom(view); if (ra== null || !ra.inRenderBin()) continue; - + AttributeBin attrBin = ra.renderMolecule.textureBin.attributeBin; ra.renderMolecule.removeRenderAtom(ra); reInsertShaderBin(attrBin, ra); @@ -2549,7 +2549,7 @@ class RenderBin extends J3dStructure implements ObjectUpdate { } - /** + /** * This routine get called whenever a component of the appearance * changes */ @@ -2560,7 +2560,7 @@ class RenderBin extends J3dStructure implements ObjectUpdate { GeometryAtom ga; RenderAtom ra = null; AppearanceRetained app = (AppearanceRetained) args[0]; - int TEXTURE_STATE_CHANGED = + int TEXTURE_STATE_CHANGED = AppearanceRetained.TEXTURE_UNIT_STATE | AppearanceRetained.TEXTURE | AppearanceRetained.TEXTURE_ATTR | @@ -2580,12 +2580,12 @@ class RenderBin extends J3dStructure implements ObjectUpdate { } if (start >= 0) { - + if ((component & TEXTURE_STATE_CHANGED) != 0) { if (((app.mirror.changedFrequent & TEXTURE_STATE_CHANGED) != 0) && - ((ra.renderMolecule.textureBin.tbFlag & + ((ra.renderMolecule.textureBin.tbFlag & TextureBin.SOLE_USER) != 0)) { /* @@ -2606,11 +2606,11 @@ System.err.println("renderbin. texture state changed tb sole user " + if (tb.soleUserCompDirty == 0) { tbUpdateList.add(tb); } - + // mark that the texture unit state ref is changed // also mark that the TextureBin needs to reevaluate // number of active textures - tb.soleUserCompDirty |= + tb.soleUserCompDirty |= TextureBin.SOLE_USER_DIRTY_REF; } } else { @@ -2619,7 +2619,7 @@ System.err.println("renderbin. texture state changed tb not sole user " + ra.renderMolecule.textureBin + " tb.tbFlag= " + ra.renderMolecule.textureBin.tbFlag); -System.err.println("......tb.soleUser= " + +System.err.println("......tb.soleUser= " + ((ra.renderMolecule.textureBin.tbFlag & TextureBin.SOLE_USER) != 0) + " app.mirror.changedFrequent= " + ((app.mirror.changedFrequent & TEXTURE_STATE_CHANGED) != 0)); @@ -2643,7 +2643,7 @@ System.err.println("......tb.soleUser= " + // remove all gaAttrs for (i = start; i < gaArr.length; i++) { ra = gaArr[i].getRenderAtom(view); - + if (ra== null || !ra.inRenderBin()) continue; renderAtoms.remove(renderAtoms.indexOf(ra)); @@ -2657,16 +2657,16 @@ System.err.println("......tb.soleUser= " + ra = gaArr[i].getRenderAtom(view); if (ra== null || !ra.inRenderBin()) continue; - + AttributeBin aBin = ra.renderMolecule.textureBin.attributeBin; if ((aBin.onUpdateList & AttributeBin.ON_CHANGED_FREQUENT_UPDATE_LIST) == 0 ) { aBinUpdateList.add(aBin); aBin.onUpdateList |= AttributeBin.ON_CHANGED_FREQUENT_UPDATE_LIST; - } - + } + } } - else { + else { for (i = start; i < gaArr.length; i++) { ra = gaArr[i].getRenderAtom(view); if (ra== null || !ra.inRenderBin()) @@ -2694,12 +2694,12 @@ System.err.println("......tb.soleUser= " + ra = gaArr[i].getRenderAtom(view); if (ra== null || !ra.inRenderBin()) continue; - + if ((ra.renderMolecule.soleUserCompDirty& RenderMolecule.ALL_DIRTY_BITS) == 0 ) { rmUpdateList.add(ra.renderMolecule); - } + } ra.renderMolecule.soleUserCompDirty |= component; - + } } @@ -2711,12 +2711,12 @@ System.err.println("......tb.soleUser= " + TextureBin tb = ra.renderMolecule.textureBin; ra.renderMolecule.removeRenderAtom(ra); reInsertRenderAtom(tb, ra); - + } } } } else { - // Nothing is visible + // Nothing is visible if ((component & AppearanceRetained.RENDERING) != 0) { // Rendering attributes change visGAIsDirty = true; @@ -2724,12 +2724,12 @@ System.err.println("......tb.soleUser= " + } } } - + void processModelClipChanged(Object[] args) { - ModelClipRetained modelClip = + ModelClipRetained modelClip = (ModelClipRetained)args[0]; EnvironmentSet e; int component = ((Integer)args[1]).intValue(); @@ -2746,7 +2746,7 @@ System.err.println("......tb.soleUser= " + changedModelClips.add(modelClip.mirrorModelClip); // need to reevaluate envset - envDirty |= REEVALUATE_MCLIP; + envDirty |= REEVALUATE_MCLIP; } else { UnorderList list = modelClip.mirrorModelClip.environmentSets; @@ -2766,7 +2766,7 @@ System.err.println("......tb.soleUser= " + } - /** + /** * This routine get called whenever a region of the boundingleaf * changes */ @@ -2784,7 +2784,7 @@ System.err.println("......tb.soleUser= " + case NodeRetained.POINTLIGHT: case NodeRetained.SPOTLIGHT: case NodeRetained.DIRECTIONALLIGHT: - if (universe.renderingEnvironmentStructure.isLightScopedToThisView(leaf, view)) + if (universe.renderingEnvironmentStructure.isLightScopedToThisView(leaf, view)) envDirty |= REEVALUATE_LIGHTS; break; case NodeRetained.LINEARFOG: @@ -2813,7 +2813,7 @@ System.err.println("......tb.soleUser= " + } } - + void processOrientedShape3DChanged(Object[] gaArr) { RenderAtom ra; @@ -2828,7 +2828,7 @@ System.err.println("......tb.soleUser= " + void processShapeChanged(Object[] args, long refTime) { - + int component = ((Integer)args[1]).intValue(); int i; RenderAtom ra; @@ -2881,7 +2881,7 @@ System.err.println("......tb.soleUser= " + continue; // Once shape could have many geometryAtoms, add the // mirrorShape as a user of an appearance only once - + if (saveShape != ra.geometryAtom.source) { saveShape = ra.geometryAtom.source; if (ra.geometryAtom.source.appearanceOverrideEnable) { @@ -2911,22 +2911,22 @@ System.err.println("......tb.soleUser= " + } else { app = saveApp; - } + } ra.app = app; e = ra.renderMolecule.textureBin.environmentSet; ra.renderMolecule.removeRenderAtom(ra); reInsertAttributeBin(e, ra); } } - + } /** - * Process a Text3D data change. This involves removing all the - * old geometry atoms in the list, and the creating new ones. - */ - void processDataChanged(Object[] oldGaList, + * Process a Text3D data change. This involves removing all the + * old geometry atoms in the list, and the creating new ones. + */ + void processDataChanged(Object[] oldGaList, Object[] newGaList, long referenceTime) { Shape3DRetained s, src; RenderAtom ra; @@ -2939,7 +2939,7 @@ System.err.println("......tb.soleUser= " + for (i=0; i<oldGaList.length; i++) { ga = ((GeometryAtom)oldGaList[i]); - + // Make sure that there is atleast one geo that is non-null geo = null; for (int k = 0; (k < ga.geometryArray.length && geo == null); k++) { @@ -2956,14 +2956,14 @@ System.err.println("......tb.soleUser= " + removeARenderAtom(ra); } } - + visQuery = true; visGAIsDirty = true; } - + void processMorphChanged(Object[] args, long refTime) { - + int component = ((Integer)args[1]).intValue(); int i; RenderAtom ra; @@ -3007,7 +3007,7 @@ System.err.println("......tb.soleUser= " + Shape3DRetained saveShape = null; GeometryAtom[] gaArr = (GeometryAtom[])args[4]; Object[] retVal; - + for (i =0; i < gaArr.length; i++) { ra = gaArr[i].getRenderAtom(view); if (ra == null || !ra.inRenderBin()) @@ -3044,7 +3044,7 @@ System.err.println("......tb.soleUser= " + } else { app = saveApp; - } + } ra.app = app; e = ra.renderMolecule.textureBin.environmentSet; ra.renderMolecule.removeRenderAtom(ra); @@ -3088,7 +3088,7 @@ System.err.println("......tb.soleUser= " + void processGeometryAtomsChanged(Object[] gaArr) { int i; RenderAtom ra; - + for (i = 0; i < gaArr.length; i++) { ra = ((GeometryAtom)gaArr[i]).getRenderAtom(view); if (ra != null && ra.inRenderBin()) { @@ -3108,7 +3108,7 @@ System.err.println("......tb.soleUser= " + GeometryRetained g = (GeometryRetained)args[1]; GeometryAtom ga; - + int i; for (i = 0; i < gaList.length; i++) { @@ -3129,11 +3129,11 @@ System.err.println("......tb.soleUser= " + RenderAtomListInfo ra = (RenderAtomListInfo)renderAtom.rListInfo[j]; if ((ra.groupType & RenderAtom.DLIST) != 0) addDirtyRenderMolecule(ra.renderAtom.renderMolecule); - + if ((ra.groupType & RenderAtom.SEPARATE_DLIST_PER_RINFO) != 0) { addDlistPerRinfo.add(ra); } - + if ((ra.groupType & RenderAtom.SEPARATE_DLIST_PER_GEO) != 0) addGeometryDlist(ra); @@ -3158,9 +3158,9 @@ System.err.println("......tb.soleUser= " + } } } - + } - + } void addTextureBin(TextureBin tb) { @@ -3197,7 +3197,7 @@ System.err.println("......tb.soleUser= " + } } - void updateDirtyDisplayLists(Canvas3D cv, + void updateDirtyDisplayLists(Canvas3D cv, ArrayList rmList, ArrayList dlistPerRinfoList, ArrayList raList, boolean useSharedCtx ) { int size, i, bitMask; @@ -3216,7 +3216,7 @@ System.err.println("......tb.soleUser= " + } size = rmList.size(); - + if (size > 0) { for (i = size-1; i >= 0; i--) { RenderMolecule rm = (RenderMolecule)rmList.get(i); @@ -3224,7 +3224,7 @@ System.err.println("......tb.soleUser= " + } rmList.clear(); } - + size = dlistPerRinfoList.size(); if (size > 0) { @@ -3242,8 +3242,8 @@ System.err.println("......tb.soleUser= " + for (i = size-1; i >= 0; i--) { ra = (RenderAtomListInfo)raList.get(i); - geo = (GeometryArrayRetained) ra.geometry(); - geo.resourceCreationMask &= ~bitMask; + geo = (GeometryArrayRetained) ra.geometry(); + geo.resourceCreationMask &= ~bitMask; } for (i = size-1; i >= 0; i--) { @@ -3286,7 +3286,7 @@ System.err.println("......tb.soleUser= " + RenderAtomListInfo ra; GeometryArrayRetained geo; RenderAtomListInfo arr[] = new RenderAtomListInfo[size]; - arr = (RenderAtomListInfo []) sharedDList.toArray(arr); + arr = (RenderAtomListInfo []) sharedDList.toArray(arr); int bitMask = cv.canvasBit; // We need two passes to avoid extra buildDisplayList @@ -3305,7 +3305,7 @@ System.err.println("......tb.soleUser= " + if ((geo.resourceCreationMask & bitMask) == 0) { dlistRenderMethod.buildIndividualDisplayList(ra, cv, cv.ctx); geo.resourceCreationMask |= bitMask; - geo.setDlistTimeStamp(bitMask, cv.ctxTimeStamp); + geo.setDlistTimeStamp(bitMask, cv.ctxTimeStamp); } } } @@ -3335,11 +3335,11 @@ System.err.println("......tb.soleUser= " + size = sharedDList.size(); if (size > 0) { RenderAtomListInfo arr[] = new RenderAtomListInfo[size]; - arr = (RenderAtomListInfo []) sharedDList.toArray(arr); + arr = (RenderAtomListInfo []) sharedDList.toArray(arr); RenderAtomListInfo ra; if (!setCtx) { - cv.makeCtxCurrent(rdr.sharedCtx); + cv.makeCtxCurrent(rdr.sharedCtx); setCtx = true; } @@ -3347,7 +3347,7 @@ System.err.println("......tb.soleUser= " + // when geo are the same. The first pass clean the // rendererBit. int bitMask = cv.screen.renderer.rendererBit; - long timeStamp = cv.screen.renderer.sharedCtxTimeStamp; + long timeStamp = cv.screen.renderer.sharedCtxTimeStamp; for (i = size-1; i >= 0; i--) { geo = (GeometryArrayRetained) arr[i].geometry(); @@ -3358,7 +3358,7 @@ System.err.println("......tb.soleUser= " + ra = arr[i]; geo = (GeometryArrayRetained) ra.geometry(); if ((geo.resourceCreationMask & bitMask) == 0) { - dlistRenderMethod.buildIndividualDisplayList(ra, cv, + dlistRenderMethod.buildIndividualDisplayList(ra, cv, rdr.sharedCtx); geo.resourceCreationMask |= bitMask; geo.setDlistTimeStamp(bitMask, timeStamp); @@ -3370,7 +3370,7 @@ System.err.println("......tb.soleUser= " + } } - private void processText3DTransformChanged(Object[] list, + private void processText3DTransformChanged(Object[] list, Object[] transforms, long referenceTime) { int i, j, numShapes; @@ -3392,18 +3392,18 @@ System.err.println("......tb.soleUser= " + " transforms.length is " + transforms.length); */ for (j=0; j<transforms.length; j++) { - + ga.lastLocalTransformArray[j] = (Transform3D)transforms[j]; - + for(int k = 0; k < ra.rListInfo.length; k++) { if (ra.rListInfo[k].localToVworld == null) { ra.rListInfo[k].localToVworld = new Transform3D(); } } - + if (ra.isOriented() && !ra.inDirtyOrientedRAs()) { dirtyOrientedRAs.add(ra); ra.dirtyMask |= RenderAtom.IN_DIRTY_ORIENTED_RAs; @@ -3437,7 +3437,7 @@ System.err.println("......tb.soleUser= " + for (n = 0; n < ogList.length; n++) { og = (OrderedGroupRetained)ogList[n]; index = ((Integer)ogChildIdList[n]).intValue(); - + ob = og.getOrderedBin(view.viewIndex); // System.err.println("Removed, index = "+index+" ob = "+ob); if (ob != null) { @@ -3470,7 +3470,7 @@ System.err.println("......tb.soleUser= " + // System.err.println("Inserted OG, index = "+index+" orderedId = "+orderedId+" og = "+og+" og.orderedBin = "+og.orderedBin); // System.err.println("Inserted OG, orderedId = "+orderedId); // System.err.println("Inserted, index = "+index+" oid = "+orderedId+" ob = "+ob); - + if(ogList == null) return; @@ -3480,13 +3480,13 @@ System.err.println("......tb.soleUser= " + orderedId = ((Integer)ogOrderedIdList[n]).intValue(); ob = og.getOrderedBin(view.viewIndex); cinfo = null; - - + + if (ob != null) { // Add at the end of the childInfo cinfo = new OrderedChildInfo(OrderedChildInfo.ADD, index, orderedId, null); ob.addChildInfo(cinfo); - + if (!ob.onUpdateList) { obList.add(ob); ob.onUpdateList = true; @@ -3494,7 +3494,7 @@ System.err.println("......tb.soleUser= " + } } } - + private void processTransformChanged(long referenceTime) { int i, j, k, numRenderMolecules, n; Shape3DRetained s; @@ -3508,7 +3508,7 @@ System.err.println("......tb.soleUser= " + Object[] list, nodesArr; UnorderList arrList; int size; - + targets = universe.transformStructure.getTargetList(); // process geometry atoms @@ -3528,13 +3528,13 @@ System.err.println("......tb.soleUser= " + //System.err.println(" ga " + ga); ra = ga.getRenderAtom(view); if (ra == null || !ra.inRenderBin()) - continue; + continue; rm = ra.renderMolecule; if (rm != null && rm.renderBin == this) { - if (ga.source.inBackgroundGroup && (rm.onUpdateList & + if (ga.source.inBackgroundGroup && (rm.onUpdateList & RenderMolecule.UPDATE_BACKGROUND_TRANSFORM) == 0) { if (rm.onUpdateList == 0) { objUpdateList.add(rm); @@ -3580,7 +3580,7 @@ System.err.println("......tb.soleUser= " + objUpdateList.add(rm); } rm.onUpdateList |= RenderMolecule.LOCALE_TRANSLATION; - + } if ((rm.primaryMoleculeType & RenderMolecule.DLIST_MOLECULE) != 0) { if (rm.onUpdateList == 0) { @@ -3620,7 +3620,7 @@ System.err.println("......tb.soleUser= " + } */ ra.dirtyMask |= RenderAtom.IN_SORTED_POS_DIRTY_TRANSP_LIST; - + } continue; } @@ -3656,9 +3656,9 @@ System.err.println("......tb.soleUser= " + // renderMolecule and reinsert getNewEnvironment(ra, lights, fog, modelClip, app); } - } - } - } + } + } + } // process misc environment nodes arrList = targets.targetList[Targets.ENV_TARGETS]; @@ -3716,13 +3716,13 @@ System.err.println("......tb.soleUser= " + for (j = 0; j < size; j++) { LeafRetained mLeaf = (LeafRetained)blUsers.get(j); if (mLeaf instanceof LightRetained && universe.renderingEnvironmentStructure.isLightScopedToThisView(mLeaf, view)) { - envDirty |= REEVALUATE_LIGHTS; + envDirty |= REEVALUATE_LIGHTS; } else if (mLeaf instanceof FogRetained && universe.renderingEnvironmentStructure.isFogScopedToThisView(mLeaf, view)) { envDirty |= REEVALUATE_FOG; } else if (mLeaf instanceof ModelClipRetained && universe.renderingEnvironmentStructure.isMclipScopedToThisView(mLeaf, view)) { - envDirty |= REEVALUATE_MCLIP; + envDirty |= REEVALUATE_MCLIP; } else if (mLeaf instanceof AlternateAppearanceRetained && universe.renderingEnvironmentStructure.isAltAppScopedToThisView(mLeaf, view)) { altAppearanceDirty = true; @@ -3730,7 +3730,7 @@ System.err.println("......tb.soleUser= " + } blUsers = null; } - + visQuery = true; } @@ -3789,12 +3789,12 @@ System.err.println("......tb.soleUser= " + } } } else { - if ((component & LightRetained.ENABLE_CHANGED) != 0) { + if ((component & LightRetained.ENABLE_CHANGED) != 0) { boolean value = lti.lightOn; if (value) { - if (!changedLts.contains(lti)) - changedLts.add(lti); - envDirty |= REEVALUATE_LIGHTS; + if (!changedLts.contains(lti)) + changedLts.add(lti); + envDirty |= REEVALUATE_LIGHTS; } } } @@ -3890,7 +3890,7 @@ System.err.println("......tb.soleUser= " + if (renderAtom == null || renderAtom.inRenderBin()) { return; } - + // If the geometry is all null , don't insert // Make sure that there is atleast one geo that is non-null @@ -3906,11 +3906,11 @@ System.err.println("......tb.soleUser= " + else { rm = insertRenderAtom(renderAtom); } - + } - + private void processBgGeometryAtoms(GeometryAtom[] nodes, long referenceTime) { int i; GeometryAtom ga; @@ -3918,7 +3918,7 @@ System.err.println("......tb.soleUser= " + RenderMolecule rm; RenderAtomListInfo ra; GeometryRetained geo; - + for (i=0; i<nodes.length; i++) { ga = nodes[i]; @@ -3934,7 +3934,7 @@ System.err.println("......tb.soleUser= " + renderAtom = ga.getRenderAtom(view); if (renderAtom == null) return; - + renderAtom.lastVisibleTime = referenceTime; if (renderAtom.inRenderBin()) { continue; @@ -3947,7 +3947,7 @@ System.err.println("......tb.soleUser= " + } } - + /** * This method looks through the list of RenderAtoms to see if * compaction is needed. @@ -3970,7 +3970,7 @@ System.err.println("......tb.soleUser= " + if (ra.lastVisibleTime < removeCutoffTime) { numDead++; } - + } numAlive = numRas - numDead; if (numAlive*2 < numDead) { @@ -3987,7 +3987,7 @@ System.err.println("......tb.soleUser= " + } /** - * This method stores the timestamp of the frame frameCountCuttoff + * This method stores the timestamp of the frame frameCountCuttoff * frames ago. It also does compaction if it is needed. */ void compact() { @@ -4047,11 +4047,11 @@ System.err.println("......tb.soleUser= " + ra.renderMolecule.removeRenderAtom(ra); reInsertAttributeBin(e, ra); } - + } private void reEvaluateAllRenderAtoms(boolean altAppDirty) { - + int sz = renderAtoms.size(); for (int n = 0; n < sz; n++) { @@ -4069,7 +4069,7 @@ System.err.println("......tb.soleUser= " + newfog = universe.renderingEnvironmentStructure.getInfluencingFog(ra, view); newModelClip = universe.renderingEnvironmentStructure.getInfluencingModelClip(ra, view); - + if (altAppDirty) { if (ra.geometryAtom.source.appearanceOverrideEnable) { retVal = universe.renderingEnvironmentStructure.getInfluencingAppearance(ra, view); @@ -4079,7 +4079,7 @@ System.err.println("......tb.soleUser= " + else { app = ra.geometryAtom.source.appearance; } - + } else { app = ra.geometryAtom.source.appearance; @@ -4184,7 +4184,7 @@ System.err.println("......tb.soleUser= " + newBin = (EnvironmentSet)currentBin.insertEnvSet.get(i); if (newBin.equals(ra, lights, fog, modelClip)) { eNew = newBin; - break; + break; } } } @@ -4207,7 +4207,7 @@ System.err.println("......tb.soleUser= " + newBin = (EnvironmentSet)currentBin.insertEnvSet.get(i); if (newBin.equals(ra, lights, fog, modelClip)) { eNew = newBin; - break; + break; } } } @@ -4228,7 +4228,7 @@ System.err.println("......tb.soleUser= " + ra.geometryAtom.source.geometryBackground && currentBin.willEnvironmentSetFit(currentEnvSet)) { - // there may be new lights define which needs to + // there may be new lights define which needs to // call native updateLight(). // When using existing lightBin we have to force // reevaluate Light. @@ -4253,7 +4253,7 @@ System.err.println("......tb.soleUser= " + ra.geometryAtom.source.geometryBackground && currentBin.willEnvironmentSetFit(currentEnvSet)) { - // there may be new lights define which needs to + // there may be new lights define which needs to // call native updateLight(). // When using existing lightBin we have to force // reevaluate Light. @@ -4284,16 +4284,16 @@ System.err.println("......tb.soleUser= " + } oc.addLightBins = currentBin; } else { - if (ra.geometryAtom.source.geometryBackground == null) + if (ra.geometryAtom.source.geometryBackground == null) addOpaqueBin = currentBin; else bgAddOpaqueBin = currentBin; } - + } eNew = currentEnvSet; currentBin.addEnvironmentSet(eNew, this); - + } ra.fog = fog; ra.lights = lights; @@ -4312,7 +4312,7 @@ System.err.println("......tb.soleUser= " + private void reInsertShaderBin(AttributeBin ab, RenderAtom ra) { ShaderBin sb; - + // System.err.println("RenderBin.reInsertShaderBin() ra= " + ra); sb = findShaderBin(ab, ra); reInsertTextureBin(sb, ra); @@ -4339,11 +4339,11 @@ System.err.println("......tb.soleUser= " + viewFrustumBBox.upper.x = Float.NEGATIVE_INFINITY; viewFrustumBBox.upper.y = Float.NEGATIVE_INFINITY; viewFrustumBBox.upper.z = Float.NEGATIVE_INFINITY; - - Canvas3D canvases[] = view.getCanvases(); + + Canvas3D canvases[] = view.getCanvases(); for (int i=0; i< canvases.length; i++) { Canvas3D canvas = canvases[i]; - + //Initial view frustumBBox BBox canvasFrustumBBox.lower.x = Float.POSITIVE_INFINITY; canvasFrustumBBox.lower.y = Float.POSITIVE_INFINITY; @@ -4351,7 +4351,7 @@ System.err.println("......tb.soleUser= " + canvasFrustumBBox.upper.x = Float.NEGATIVE_INFINITY; canvasFrustumBBox.upper.y = Float.NEGATIVE_INFINITY; canvasFrustumBBox.upper.z = Float.NEGATIVE_INFINITY; - + canvas.updateViewCache(true, null, canvasFrustumBBox, false); if(viewFrustumBBox.lower.x > canvasFrustumBBox.lower.x) @@ -4360,7 +4360,7 @@ System.err.println("......tb.soleUser= " + viewFrustumBBox.lower.y = canvasFrustumBBox.lower.y; if(viewFrustumBBox.lower.z > canvasFrustumBBox.lower.z) viewFrustumBBox.lower.z = canvasFrustumBBox.lower.z; - + if(viewFrustumBBox.upper.x < canvasFrustumBBox.upper.x) viewFrustumBBox.upper.x = canvasFrustumBBox.upper.x; if(viewFrustumBBox.upper.y < canvasFrustumBBox.upper.y) @@ -4421,13 +4421,13 @@ System.err.println("......tb.soleUser= " + ga.source.otherAppearance.sgApp. removeAMirrorUser(ga.source); ga.source.otherAppearance = app; - if (app != null) + if (app != null) ra.app.sgApp.addAMirrorUser(ga.source); } } else { ra.app = ga.source.appearance; - + } } else { ra.app = ga.source.appearance; @@ -4485,8 +4485,8 @@ System.err.println("......tb.soleUser= " + } return (renderMolecule); } - - private OrderedCollection findOrderedCollection(GeometryAtom ga, + + private OrderedCollection findOrderedCollection(GeometryAtom ga, boolean doBackground) { int i, n; int oi; // an id which identifies a children of the orderedGroup @@ -4503,7 +4503,7 @@ System.err.println("......tb.soleUser= " + int parentOrderedChildId; OrderedBin ob; OrderedPathElement ope; - + // Since the table has been incremented, in response to OG addition, // but the ordered collecyions has not been added yet, we need to // check what the original index into the ordered collection @@ -4536,7 +4536,7 @@ System.err.println("......tb.soleUser= " + index = n; break; } - + } if (index == -1) { orderedBinsList.add(parentChildOrderedBins); @@ -4559,7 +4559,7 @@ System.err.println("......tb.soleUser= " + // correct oc while (cinfo != null && !found) { if (cinfo.type == OrderedChildInfo.ADD) { - if (cinfo.orderedId == oi) { + if (cinfo.orderedId == oi) { oc = cinfo.value; if (oc == null) { oc = new OrderedCollection(); @@ -4582,7 +4582,7 @@ System.err.println("......tb.soleUser= " + // The list is not going to be modified by any additions // that have happened ... // Then this child must exists from the previous frame, so - // get the location + // get the location if (!found) { // The case below happens when there have been some insert // ordered nodes, but update_view happens later and @@ -4605,14 +4605,14 @@ System.err.println("......tb.soleUser= " + for (n = 0; n < ob.setOCForCI.size(); n++) { val = ((Integer)ob.setOCForCI.get(n)).intValue(); - if (val == ci) { + if (val == ci) { oc=(OrderedCollection)ob.valueOfSetOCForCI.get(n); if (oc == null) { oc = new OrderedCollection(); ob.valueOfSetOCForCI.set(n, oc); } - + break; } } @@ -4657,7 +4657,7 @@ System.err.println("......tb.soleUser= " + OrderedBin ob, savedOb; int n, val; - + oc = lightBin.orderedCollection; @@ -4683,8 +4683,8 @@ System.err.println("......tb.soleUser= " + private EnvironmentSet getEnvironmentSet(RenderAtom ra, LightRetained[] lights, FogRetained fog, ModelClipRetained modelClip) { EnvironmentSet envSet; - - envSet = new EnvironmentSet(ra, lights, fog, modelClip, this); + + envSet = new EnvironmentSet(ra, lights, fog, modelClip, this); return (envSet); } @@ -4700,7 +4700,7 @@ System.err.println("......tb.soleUser= " + } else { renderingAttributes = ra.app.renderingAttributes; } - + currentBin = envSet.attributeBinList; while (currentBin != null) { if (currentBin.equals(renderingAttributes, ra)) { @@ -4723,14 +4723,14 @@ System.err.println("......tb.soleUser= " + /** * This finds or creates an ShaderBin for a given RenderAtom. */ - private ShaderBin findShaderBin(AttributeBin attributeBin, RenderAtom ra) { + private ShaderBin findShaderBin(AttributeBin attributeBin, RenderAtom ra) { int i, size; ShaderBin currentBin; ShaderAppearanceRetained sApp; if((ra != null) && (ra.app instanceof ShaderAppearanceRetained)) sApp = (ShaderAppearanceRetained)ra.app; - else + else sApp = null; currentBin = attributeBin.shaderBinList; @@ -4749,7 +4749,7 @@ System.err.println("......tb.soleUser= " + return currentBin; } } - + currentBin = getShaderBin(sApp); attributeBin.addShaderBin(currentBin, this, sApp); return currentBin; @@ -4796,7 +4796,7 @@ System.err.println("......tb.soleUser= " + /** * This finds or creates a RenderMolecule for a given RenderAtom. */ - private RenderMolecule findRenderMolecule(TextureBin textureBin, + private RenderMolecule findRenderMolecule(TextureBin textureBin, RenderAtom ra) { RenderMolecule currentBin; @@ -4844,11 +4844,11 @@ System.err.println("......tb.soleUser= " + currentBin = (RenderMolecule)rmap.get(ra.geometryAtom.source.localToVworld[0]); while (currentBin != null) { - if (currentBin.equals(ra, - polygonAttributes, lineAttributes, - pointAttributes, material, - coloringAttributes, - transparencyAttributes, + if (currentBin.equals(ra, + polygonAttributes, lineAttributes, + pointAttributes, material, + coloringAttributes, + transparencyAttributes, ra.geometryAtom.source.localToVworld[0])) { currentBin.addRenderAtom(ra, this); @@ -4863,11 +4863,11 @@ System.err.println("......tb.soleUser= " + if ((list = (ArrayList)addmap.get(ra.geometryAtom.source.localToVworld[0])) != null) { for (i = 0; i < list.size(); i++) { currentBin = (RenderMolecule)list.get(i); - if (currentBin.equals(ra, - polygonAttributes, lineAttributes, - pointAttributes, material, - coloringAttributes, - transparencyAttributes, + if (currentBin.equals(ra, + polygonAttributes, lineAttributes, + pointAttributes, material, + coloringAttributes, + transparencyAttributes, ra.geometryAtom.source.localToVworld[0])) { currentBin.addRenderAtom(ra, this); return(currentBin); @@ -4876,18 +4876,18 @@ System.err.println("......tb.soleUser= " + } - currentBin = getRenderMolecule(ra.geometryAtom, + currentBin = getRenderMolecule(ra.geometryAtom, polygonAttributes, lineAttributes, pointAttributes, material, - coloringAttributes, + coloringAttributes, transparencyAttributes, renderingAttributes, texUnitState, ra.geometryAtom.source.localToVworld[0], ra.geometryAtom.source.localToVworldIndex[0]); - textureBin.addRenderMolecule(currentBin, this); + textureBin.addRenderMolecule(currentBin, this); currentBin.addRenderAtom(ra, this); return(currentBin); } @@ -4913,10 +4913,10 @@ System.err.println("......tb.soleUser= " + * on the freelist. */ private LightBin getLightBin(int maxLights, BackgroundRetained bg, boolean inOpaque) { - LightBin lightBin; - + LightBin lightBin; + lightBin = new LightBin(maxLights, this, inOpaque); - + lightBin.geometryBackground = bg; return (lightBin); } @@ -4927,7 +4927,7 @@ System.err.println("......tb.soleUser= " + */ private TextureBin getTextureBin(TextureUnitStateRetained texUnitState[], AppearanceRetained app) { - return new TextureBin(texUnitState, app, this); + return new TextureBin(texUnitState, app, this); } /** @@ -4945,17 +4945,17 @@ System.err.println("......tb.soleUser= " + TextureUnitStateRetained[] texUnits, Transform3D[] transform, int[] transformIndex) { - + return new RenderMolecule(ga, polya, linea, pointa, material, cola, transa, ra, texUnits, - transform, transformIndex, this); + transform, transformIndex, this); } /** * This finds or creates an EnviornmentSet for a given RenderAtom. - * This also deals with empty LightBin lists. + * This also deals with empty LightBin lists. */ private EnvironmentSet findEnvironmentSet(RenderAtom ra) { LightBin currentBin, lightBin ; @@ -4993,7 +4993,7 @@ System.err.println("......tb.soleUser= " + getInfluencingFog(ra, view); ra.modelClip = universe.renderingEnvironmentStructure. getInfluencingModelClip(ra, view); - + while (currentBin != null) { // this test is always true for non-backgroundGeo bins if (currentBin.geometryBackground == @@ -5040,7 +5040,7 @@ System.err.println("......tb.soleUser= " + // Need a new one currentEnvSet = getEnvironmentSet(ra, ra.lights, ra.fog, ra.modelClip); currentBin = lightBin; - + // Find a lightbin that envSet fits into while (currentBin != null) { @@ -5052,7 +5052,7 @@ System.err.println("......tb.soleUser= " + } currentBin = currentBin.next; } - + // Now check the to-be added lightbins if (currentBin == null) { currentBin = addBin; @@ -5084,14 +5084,14 @@ System.err.println("......tb.soleUser= " + } oc.addLightBins = currentBin; } else { - if (ra.geometryAtom.source.geometryBackground == null) + if (ra.geometryAtom.source.geometryBackground == null) addOpaqueBin = currentBin; else bgAddOpaqueBin = currentBin; } } - currentBin.addEnvironmentSet(currentEnvSet, this); + currentBin.addEnvironmentSet(currentEnvSet, this); return (currentEnvSet); } @@ -5108,7 +5108,7 @@ System.err.println("......tb.soleUser= " + } else { if (bgOpaqueBin == lbin) { bgOpaqueBin = lbin.next; - } + } } if (lbin.next != null) { lbin.next.prev = null; @@ -5246,7 +5246,7 @@ System.err.println("......tb.soleUser= " + OrderedGroupRetained og = orderedBin.source; boolean isDecal = (og instanceof DecalGroupRetained) && cv.systemStencilAvailable; int size = orderedBin.orderedCollections.size(); - + // System.err.println("RB : orderedBin.orderedCollections.size() " + size); for (i=0; i<size; i++) { if((og != null) && (og.childIndexOrder != null)) { @@ -5288,11 +5288,11 @@ System.err.println("......tb.soleUser= " + * Sets the new background color. */ void setBackground(BackgroundRetained back) { - + boolean cvDirty = false; BackgroundRetained oldGeomBack = geometryBackground; geometryBackground = null; - + if (back != null) { background.initColor(back.color); background.initImageScaleMode(back.imageScaleMode); @@ -5336,7 +5336,7 @@ System.err.println("......tb.soleUser= " + // Need to reEvaluate View cache since doInfinite // flag is changed in Renderer.updateViewCache() - Canvas3D canvases[] = view.getCanvases(); + Canvas3D canvases[] = view.getCanvases(); for (int i=0; i< canvases.length; i++) { Canvas3D canvas = canvases[i]; synchronized (canvas.dirtyMaskLock) { @@ -5378,7 +5378,7 @@ System.err.println("......tb.soleUser= " + else { app = ra.geometryAtom.source.appearance; } - + if (app == ra.app) { if (ra.envSet.fog == newfog) continue; @@ -5419,9 +5419,9 @@ System.err.println("......tb.soleUser= " + getNewEnvironment(ra, ra.lights, newfog, ra.modelClip, ra.app); }; } - + // Only done for new fogs added to the system - if (updateDirty) + if (updateDirty) updateCanvasForDirtyFog(fogs); } @@ -5442,7 +5442,7 @@ System.err.println("......tb.soleUser= " + envsets = (EnvironmentSet []) list.toArray(false); for (j = 0; j < envsize; j++) { e = envsets[j]; - e.canvasDirty |= Canvas3D.FOG_DIRTY; + e.canvasDirty |= Canvas3D.FOG_DIRTY; if (!e.onUpdateList) { objUpdateList.add(e); e.onUpdateList = true; @@ -5452,7 +5452,7 @@ System.err.println("......tb.soleUser= " + } } - void reEvaluateModelClip(ArrayList modelClips, + void reEvaluateModelClip(ArrayList modelClips, boolean updateDirty, boolean altAppDirty) { EnvironmentSet e; @@ -5467,7 +5467,7 @@ System.err.println("......tb.soleUser= " + if (!ra.inRenderBin()) continue; - newModelClip = + newModelClip = universe.renderingEnvironmentStructure.getInfluencingModelClip(ra, view); // If the model clip of the render atom is the same @@ -5518,7 +5518,7 @@ System.err.println("......tb.soleUser= " + } } else { - if (ra.envSet.modelClip == newModelClip) + if (ra.envSet.modelClip == newModelClip) continue; getNewEnvironment(ra, ra.lights, ra.fog, newModelClip, ra.app); }; @@ -5590,7 +5590,7 @@ System.err.println("......tb.soleUser= " + else { app = ra.geometryAtom.source.appearance; } - + if (app == ra.app) { if (ra.lights == lights || ra.envSet.equalLights(lights)) continue; @@ -5630,7 +5630,7 @@ System.err.println("......tb.soleUser= " + } } // Only done for new lights added to the system - if (changedLts.size() > 0) + if (changedLts.size() > 0) updateCanvasForDirtyLights(changedLts); } @@ -5741,7 +5741,7 @@ System.err.println("......tb.soleUser= " + for (i = 0; i < size; i++) { geo = (GeometryRetained) lockGeometryList.get(i); geo.geomLock.getLock(); - + } // dlist is locked only when they are rebuilt @@ -5759,18 +5759,18 @@ System.err.println("......tb.soleUser= " + nc.geomLock.getLock(); } } - + // Release all geometry after rendering to the last canvas void releaseGeometry() { GeometryRetained geo; int i, size; - + size = lockGeometryList.size(); for (i = 0; i < size; i++) { geo = (GeometryRetained) lockGeometryList.get(i); geo.geomLock.unLock(); } - + size = dlistLockList.size(); for (i = 0; i < size; i++) { geo = (GeometryRetained) dlistLockList.get(i); @@ -5818,7 +5818,7 @@ System.err.println("......tb.soleUser= " + void addDirtyNodeComponent(Object nc) { dirtyNodeComponentList.add(nc); } - + void clearDirtyOrientedRAs() { int i, nRAs; @@ -5834,7 +5834,7 @@ System.err.println("......tb.soleUser= " + } dirtyOrientedRAs.clear(); } - + // Called from MasterControl when viewCache changes or if there are // dirtyOrientedShapes void updateOrientedRAs() { @@ -5950,7 +5950,7 @@ System.err.println("......tb.soleUser= " + bgOrderedBins.clear(); nodeComponentList.clear(); orientedRAs.clear(); - + // clean up any messages that are queued up, since they are // irrelevant // clearMessages(); @@ -5961,7 +5961,7 @@ System.err.println("......tb.soleUser= " + int i, k; for (i = 0; i < ob.orderedCollections.size(); i++) { OrderedCollection oc = (OrderedCollection) ob.orderedCollections.get(i); - if (oc == null) + if (oc == null) continue; for (k = 0; k < oc.childOrderedBins.size(); k++) { @@ -5974,7 +5974,7 @@ System.err.println("......tb.soleUser= " + } } - + void removeGeometryDlist(RenderAtomListInfo ra) { removeDlist.add(ra); } @@ -6152,12 +6152,12 @@ System.err.println("......tb.soleUser= " + if (r.parentTInfo[i] == null) continue; - /* + /* r.parentTInfo[i].lightBin = r.envSet.lightBin; r.parentTInfo[i].envSet = r.envSet; r.parentTInfo[i].aBin = r.renderMolecule.textureBin.attributeBin; */ - r.parentTInfo[i].rm = r.renderMolecule; + r.parentTInfo[i].rm = r.renderMolecule; } } @@ -6167,7 +6167,7 @@ System.err.println("......tb.soleUser= " + TextureBin tb = (TextureBin) obj; // Background geometry if (tb.environmentSet.lightBin.geometryBackground != null) { - bgTransparentInfo = computeDirtyAcrossTransparentBins(tb, bgTransparentInfo); + bgTransparentInfo = computeDirtyAcrossTransparentBins(tb, bgTransparentInfo); } else { allTransparentObjects.add(obj); @@ -6218,7 +6218,7 @@ System.err.println("......tb.soleUser= " + else { tinfo.next = startinfo; startinfo.prev = tinfo; - startinfo = tinfo; + startinfo = tinfo; } return startinfo; } @@ -6283,7 +6283,7 @@ System.err.println("......tb.soleUser= " + } } rinfo = rinfo.next; - + } } @@ -6308,7 +6308,7 @@ System.err.println("......tb.soleUser= " + // System.err.println("&&&&&&&&& changing from dlist to dlist_per_rinfo"); addDisplayListResourceFreeList(r); removeDirtyRenderMolecule(r); - + r.vwcBounds.set(null); r.displayListId = 0; r.displayListIdObj = null; @@ -6356,7 +6356,7 @@ System.err.println("......tb.soleUser= " + if (r.parentTInfo[j] == null) continue; - r.parentTInfo[j] = null; + r.parentTInfo[j] = null; } if (r.renderMolecule.textureBin.parentTInfo == null) { transparentInfo = computeDirtyAcrossTransparentBins(r.renderMolecule.textureBin, transparentInfo); @@ -6395,14 +6395,14 @@ System.err.println("......tb.soleUser= " + zval1 = input1.zVal; zval2 = input2.zVal; // Put the newList before the current one - + // System.err.print("Code path 1 "); -// if (transparencySortComparator!=null) +// if (transparencySortComparator!=null) // if (zval2 > zval1 && (transparencySortComparator.compare(input2, input1)>0)) // System.err.println("PASS"); // else // System.err.println("FAIL"); - + if ((transparencySortComparator==null && zval2 > zval1) || (transparencySortComparator!=null && (transparencySortComparator.compare(input2, input1)>0))){ // System.err.println("===> path1"); @@ -6446,7 +6446,7 @@ System.err.println("......tb.soleUser= " + // for (int i = 0; i < r.rListInfo.length; i++) { // if (r.parentTInfo[i] == null) // continue; -// +// // if (transparentInfo == null) { // transparentInfo = r.parentTInfo[i]; // transparentInfo.prev = null; @@ -6477,9 +6477,9 @@ System.err.println("......tb.soleUser= " + // } // r.parentTInfo[i].next = prevInfo.next; // prevInfo.next = r.parentTInfo[i]; -// +// // } -// +// // } // } @@ -6525,7 +6525,7 @@ System.err.println("......tb.soleUser= " + return dirtyList; } - + TransparentRenderingInfo depthSortAll(TransparentRenderingInfo startinfo) { transparencySortComparator = com.sun.j3d.utils.scenegraph.transparency.TransparencySortController.getComparator(view); @@ -6560,9 +6560,9 @@ System.err.println("......tb.soleUser= " + // System.err.println("FAIL"); while (previnfo != null && transparencySortComparator.compare(previnfo,tinfo)<0) { previnfo = previnfo.prev; - } + } } - + if (tinfo.prev != previnfo) { if (previnfo == null) { if (tinfo.next != null) { @@ -6583,14 +6583,14 @@ System.err.println("......tb.soleUser= " + tinfo.prev.next = tinfo.next; } tinfo.next = previnfo.next; - if (previnfo.next != null) + if (previnfo.next != null) previnfo.next.prev = tinfo; tinfo.prev = previnfo; previnfo.next = tinfo; // System.err.println("path2, tinfo.prev = "+tinfo.prev); // System.err.println("path2, tinfo.next = "+tinfo.next); } - + } /* TransparentRenderingInfo tmp = startinfo; @@ -6599,7 +6599,7 @@ System.err.println("......tb.soleUser= " + tmp = tmp.next; } */ - + tinfo = nextinfo; } @@ -6623,7 +6623,7 @@ System.err.println("......tb.soleUser= " + prevZ = curZ; tinfo = tinfo.next; - + } tinfo = startinfo; while (tinfo != null) { @@ -6647,7 +6647,7 @@ System.err.println("......tb.soleUser= " + } tinfo = tinfo.next; } - */ + */ return startinfo; } @@ -6696,9 +6696,9 @@ System.err.println("......tb.soleUser= " + visQuery = true; } } - + } - + } if (((component & ViewSpecificGroupRetained.REMOVE_VIEW) != 0)|| ((component & ViewSpecificGroupRetained.SET_VIEW) != 0)) { @@ -6706,7 +6706,7 @@ System.err.println("......tb.soleUser= " + Object obj; ArrayList leafList; View v; - + if ((component & ViewSpecificGroupRetained.REMOVE_VIEW) != 0) { v = (View)objAry[0]; leafList = (ArrayList)objAry[2]; @@ -6728,7 +6728,7 @@ System.err.println("......tb.soleUser= " + } else if (obj instanceof LightRetained) { envDirty |= REEVALUATE_LIGHTS; - } + } else if (obj instanceof FogRetained) { envDirty |= REEVALUATE_FOG; } @@ -6747,11 +6747,11 @@ System.err.println("......tb.soleUser= " + else if (obj instanceof ClipRetained) { reEvaluateClip = true; - } + } } } } - + } void insertNodes(J3dMessage m) { @@ -6788,7 +6788,7 @@ System.err.println("......tb.soleUser= " + altAppearanceDirty = true; } } - + // Handle ViewScoped Nodes if (viewScopedNodes != null) { int size = viewScopedNodes.size(); @@ -6823,7 +6823,7 @@ System.err.println("......tb.soleUser= " + } // Note: geometryAtom is not part of viewScopedNodes // Its a part of orginal nodes even if scoped - + } } } @@ -6934,9 +6934,9 @@ System.err.println("......tb.soleUser= " + size = sharedDList.size(); if (size > 0) { RenderAtomListInfo arr[] = new RenderAtomListInfo[size]; - arr = (RenderAtomListInfo []) sharedDList.toArray(arr); + arr = (RenderAtomListInfo []) sharedDList.toArray(arr); - GeometryArrayRetained geo; + GeometryArrayRetained geo; int mask = (cv.useSharedCtx ? rdr.rendererBit : cv.canvasBit); for (i = 0; i < size; i++) { @@ -6975,8 +6975,8 @@ System.err.println("......tb.soleUser= " + size = sharedDList.size(); if (size > 0) { RenderAtomListInfo arr[] = new RenderAtomListInfo[size]; - arr = (RenderAtomListInfo []) sharedDList.toArray(arr); - GeometryArrayRetained geo; + arr = (RenderAtomListInfo []) sharedDList.toArray(arr); + GeometryArrayRetained geo; for (i = 0; i < size; i++) { geo = (GeometryArrayRetained)arr[i].geometry(); @@ -7012,7 +7012,7 @@ System.err.println("......tb.soleUser= " + if (ra == null) return; - + int start = i; // Check if the removed renderAtom is already in // a separate bin - this is to handle the case @@ -7024,7 +7024,7 @@ System.err.println("......tb.soleUser= " + ra = gaArr[i].getRenderAtom(view); if (ra== null || !ra.inRenderBin()) continue; - + TextureBin tb = ra.renderMolecule.textureBin; ra.renderMolecule.removeRenderAtom(ra); reInsertRenderAtom(tb, ra); @@ -7040,7 +7040,7 @@ System.err.println("......tb.soleUser= " + ra = gaArr[i].getRenderAtom(view); if (ra== null || !ra.inRenderBin()) continue; - + TextureBin tb = ra.renderMolecule.textureBin; ra.renderMolecule.removeRenderAtom(ra); reInsertRenderAtom(tb, ra); @@ -7056,7 +7056,7 @@ System.err.println("......tb.soleUser= " + ra = gaArr[i].getRenderAtom(view); if (ra== null || !ra.inRenderBin()) continue; - + TextureBin tb = ra.renderMolecule.textureBin; ra.renderMolecule.removeRenderAtom(ra); reInsertRenderAtom(tb, ra); @@ -7072,7 +7072,7 @@ System.err.println("......tb.soleUser= " + ra = gaArr[i].getRenderAtom(view); if (ra== null || !ra.inRenderBin()) continue; - + TextureBin tb = ra.renderMolecule.textureBin; ra.renderMolecule.removeRenderAtom(ra); reInsertRenderAtom(tb, ra); @@ -7088,7 +7088,7 @@ System.err.println("......tb.soleUser= " + ra = gaArr[i].getRenderAtom(view); if (ra== null || !ra.inRenderBin()) continue; - + TextureBin tb = ra.renderMolecule.textureBin; ra.renderMolecule.removeRenderAtom(ra); reInsertRenderAtom(tb, ra); @@ -7104,7 +7104,7 @@ System.err.println("......tb.soleUser= " + ra = gaArr[i].getRenderAtom(view); if (ra== null || !ra.inRenderBin()) continue; - + TextureBin tb = ra.renderMolecule.textureBin; ra.renderMolecule.removeRenderAtom(ra); reInsertRenderAtom(tb, ra); @@ -7116,18 +7116,18 @@ System.err.println("......tb.soleUser= " + ra = gaArr[i].getRenderAtom(view); if (ra== null || !ra.inRenderBin()) continue; - + EnvironmentSet e= ra.renderMolecule.textureBin.environmentSet; ra.renderMolecule.removeRenderAtom(ra); reInsertAttributeBin(e, ra); } } else { - + // XXXX: handle texture } - + } */ diff --git a/src/classes/share/javax/media/j3d/RenderMolecule.java b/src/classes/share/javax/media/j3d/RenderMolecule.java index 4540f0a..629b7b4 100644 --- a/src/classes/share/javax/media/j3d/RenderMolecule.java +++ b/src/classes/share/javax/media/j3d/RenderMolecule.java @@ -55,7 +55,7 @@ class RenderMolecule extends IndexedObject implements ObjectUpdate, NodeComponen static final int LINE = 0x02; static final int SURFACE = 0x04; static final int RASTER = 0x08; - static final int COMPRESSED = 0x10; + static final int COMPRESSED = 0x10; static int RM_COMPONENTS = (AppearanceRetained.POLYGON | AppearanceRetained.LINE | @@ -73,11 +73,11 @@ class RenderMolecule extends IndexedObject implements ObjectUpdate, NodeComponen ColoringAttributesRetained coloringAttributes = null; TransparencyAttributesRetained transparency = null; - // Use Object instead of AppearanceRetained class for + // Use Object instead of AppearanceRetained class for // state caching optimation memory performance boolean normalPresent = true; - + // Equivalent bits static final int POINTATTRS_DIRTY = AppearanceRetained.POINT; @@ -89,8 +89,8 @@ class RenderMolecule extends IndexedObject implements ObjectUpdate, NodeComponen static final int ALL_DIRTY_BITS = POINTATTRS_DIRTY | LINEATTRS_DIRTY | POLYGONATTRS_DIRTY | MATERIAL_DIRTY | TRANSPARENCY_DIRTY | COLORINGATTRS_DIRTY; - /** - * bit mask of all attr fields that are equivalent across + /** + * bit mask of all attr fields that are equivalent across * renderMolecules */ int dirtyAttrsAcrossRms = ALL_DIRTY_BITS; @@ -147,12 +147,12 @@ class RenderMolecule extends IndexedObject implements ObjectUpdate, NodeComponen */ Transform3D[] trans = null; - + /** * specify whether scale is nonuniform */ boolean isNonUniformScale = false; - + /** * number of renderAtoms to be rendered in this RenderMolecule */ @@ -166,7 +166,7 @@ class RenderMolecule extends IndexedObject implements ObjectUpdate, NodeComponen RenderAtom addRAs = null; RenderAtom removeRAs = null; - /** + /** * The cached ColoringAttributes color value. It is * 1.0, 1.0, 1.0 if there is no ColoringAttributes. */ @@ -182,9 +182,9 @@ class RenderMolecule extends IndexedObject implements ObjectUpdate, NodeComponen float dGreen = 1.0f; float dBlue = 1.0f; - - /** + + /** * The cached TransparencyAttributes transparency value. It is * 0.0 if there is no TransparencyAttributes. */ @@ -195,12 +195,12 @@ class RenderMolecule extends IndexedObject implements ObjectUpdate, NodeComponen */ int geometryType = -1; - /** + /** * A boolean indicating whether or not lighting should be on. */ boolean enableLighting = false; - /** + /** * A boolean indicating whether or not this molecule rendered Text3D */ @@ -213,7 +213,7 @@ class RenderMolecule extends IndexedObject implements ObjectUpdate, NodeComponen static int SEPARATE_DLIST_PER_RINFO_MOLECULE = 0x20; - /** + /** * Cached values for polygonMode, line antialiasing, and point antialiasing */ int polygonMode = PolygonAttributes.POLYGON_FILL; @@ -232,7 +232,7 @@ class RenderMolecule extends IndexedObject implements ObjectUpdate, NodeComponen int texCoordSetMapLen = 0; /** - * The primary renderMethod object for this RenderMolecule + * The primary renderMethod object for this RenderMolecule * this is either a Text3D, display list, or compressed geometry renderer. */ RenderMethod primaryRenderMethod = null; @@ -269,7 +269,7 @@ class RenderMolecule extends IndexedObject implements ObjectUpdate, NodeComponen */ RenderAtomListInfo separateDlistRenderAtomList = null; - + /** * The list of RenderAtoms in this RenderMolecule that are using vertex * arrays. @@ -297,8 +297,8 @@ class RenderMolecule extends IndexedObject implements ObjectUpdate, NodeComponen boolean soleUser = false; Object appHandle = null; - - VertexArrayRenderMethod cachedVertexArrayRenderMethod = + + VertexArrayRenderMethod cachedVertexArrayRenderMethod = (VertexArrayRenderMethod) VirtualUniverse.mc.getVertexArrayRenderMethod(); @@ -334,7 +334,7 @@ class RenderMolecule extends IndexedObject implements ObjectUpdate, NodeComponen // Transform when locale is different from the view's locale Transform3D[] localeLocalToVworld = null; - + // Vector used for locale translation Vector3d localeTranslation = null; @@ -355,27 +355,27 @@ class RenderMolecule extends IndexedObject implements ObjectUpdate, NodeComponen PolygonAttributesRetained polygonAttributes, LineAttributesRetained lineAttributes, PointAttributesRetained pointAttributes, - MaterialRetained material, + MaterialRetained material, ColoringAttributesRetained coloringAttributes, TransparencyAttributesRetained transparency, RenderingAttributesRetained renderAttrs, TextureUnitStateRetained[] texUnits, Transform3D[] transform, int[] transformIndex, - RenderBin rb) { + RenderBin rb) { renderBin = rb; IndexedUnorderSet.init(this, TOTAL_INDEXED_UNORDER_SET_TYPES); - reset(ga, polygonAttributes, lineAttributes, pointAttributes, + reset(ga, polygonAttributes, lineAttributes, pointAttributes, material, coloringAttributes, transparency, renderAttrs, texUnits, transform, transformIndex); } - void reset(GeometryAtom ga, + void reset(GeometryAtom ga, PolygonAttributesRetained polygonAttributes, LineAttributesRetained lineAttributes, PointAttributesRetained pointAttributes, - MaterialRetained material, + MaterialRetained material, ColoringAttributesRetained coloringAttributes, TransparencyAttributesRetained transparency, RenderingAttributesRetained renderAttrs, @@ -398,7 +398,7 @@ class RenderMolecule extends IndexedObject implements ObjectUpdate, NodeComponen closestSwitchParent = ga.source.closestSwitchParent; closestSwitchIndex = ga.source.closestSwitchIndex; - + int i1; // Find the first non-null geometey GeometryRetained geo = null; @@ -423,8 +423,8 @@ class RenderMolecule extends IndexedObject implements ObjectUpdate, NodeComponen appHandle = ga.source.appearance; else appHandle = (Object)this; - - // If its of type GeometryArrayRetained + + // If its of type GeometryArrayRetained if (ga.geoType <= GeometryRetained.GEO_TYPE_GEOMETRYARRAY || ga.geoType == GeometryRetained.GEO_TYPE_TEXT3D) { @@ -480,7 +480,7 @@ class RenderMolecule extends IndexedObject implements ObjectUpdate, NodeComponen break; case GeometryRetained.GEO_TYPE_COMPRESSED: this.geometryType = COMPRESSED; - + switch (((CompressedGeometryRetained)geo).getBufferType()) { case CompressedGeometryHeader.POINT_BUFFER: this.geometryType |= POINT ; @@ -492,10 +492,10 @@ class RenderMolecule extends IndexedObject implements ObjectUpdate, NodeComponen case CompressedGeometryHeader.TRIANGLE_BUFFER: this.geometryType |= SURFACE ; if (polygonAttributes != null) { - if (polygonAttributes.polygonMode == + if (polygonAttributes.polygonMode == PolygonAttributes.POLYGON_POINT) { this.geometryType |= POINT; - } else if (polygonAttributes.polygonMode == + } else if (polygonAttributes.polygonMode == PolygonAttributes.POLYGON_LINE) { this.geometryType |= LINE; } @@ -506,10 +506,10 @@ class RenderMolecule extends IndexedObject implements ObjectUpdate, NodeComponen default: this.geometryType = SURFACE; if (polygonAttributes != null) { - if (polygonAttributes.polygonMode == + if (polygonAttributes.polygonMode == PolygonAttributes.POLYGON_POINT) { this.geometryType |= POINT; - } else if (polygonAttributes.polygonMode == + } else if (polygonAttributes.polygonMode == PolygonAttributes.POLYGON_LINE) { this.geometryType |= LINE; } @@ -517,11 +517,11 @@ class RenderMolecule extends IndexedObject implements ObjectUpdate, NodeComponen break; } - isQuadGeometryArray = (geo.getClassType() == + isQuadGeometryArray = (geo.getClassType() == GeometryRetained.QUAD_TYPE); - isTriGeometryArray = (geo.getClassType() == + isTriGeometryArray = (geo.getClassType() == GeometryRetained.TRIANGLE_TYPE); - + this.localToVworld = transform; this.localToVworldIndex = transformIndex; doInfinite = ga.source.inBackgroundGroup; @@ -536,7 +536,7 @@ class RenderMolecule extends IndexedObject implements ObjectUpdate, NodeComponen if (polygonAttributes != null) { if (polygonAttributes.changedFrequent != 0) { definingPolygonAttributes = polygonAttributes; - + mask |= POLYGONATTRS_DIRTY; } else { @@ -678,7 +678,7 @@ class RenderMolecule extends IndexedObject implements ObjectUpdate, NodeComponen definingTransparency.set(transparency); } else { - definingTransparency = + definingTransparency = (TransparencyAttributesRetained)transparency.clone(); } } @@ -732,7 +732,7 @@ class RenderMolecule extends IndexedObject implements ObjectUpdate, NodeComponen PolygonAttributesRetained polygonAttributes, LineAttributesRetained lineAttributes, PointAttributesRetained pointAttributes, - MaterialRetained material, + MaterialRetained material, ColoringAttributesRetained coloringAttributes, TransparencyAttributesRetained transparency, Transform3D[] transform) { @@ -794,10 +794,10 @@ class RenderMolecule extends IndexedObject implements ObjectUpdate, NodeComponen default: geoType = SURFACE; if (polygonAttributes != null) { - if (polygonAttributes.polygonMode == + if (polygonAttributes.polygonMode == PolygonAttributes.POLYGON_POINT) { geoType |= POINT; - } else if (polygonAttributes.polygonMode == + } else if (polygonAttributes.polygonMode == PolygonAttributes.POLYGON_LINE) { geoType |= LINE; } @@ -809,17 +809,17 @@ class RenderMolecule extends IndexedObject implements ObjectUpdate, NodeComponen return (false); } /* - // XXXX : Check this + // XXXX : Check this if (useDisplayList && (ga.geometry.isEditable || ga.geometry.refCount > 1 || ((GroupRetained)ga.source.parent).switchLevel >= 0 || - ga.alphaEditable)) { + ga.alphaEditable)) { return (false); } */ if (ga.geoType == GeometryRetained.GEO_TYPE_TEXT3D && - primaryMoleculeType != 0 && + primaryMoleculeType != 0 && ((primaryMoleculeType & TEXT3D_MOLECULE) == 0)) { return (false); } @@ -846,7 +846,7 @@ class RenderMolecule extends IndexedObject implements ObjectUpdate, NodeComponen // or punt all to vertex array. And we don't need to worry // about some of the ga can be in display list for this canvas, // and some other can be in display list for the other canvas. - if (((gr.texCoordSetMap != null) && + if (((gr.texCoordSetMap != null) && (this.texCoordSetMapLen != gr.texCoordSetMap.length)) || ((gr.texCoordSetMap == null) && (this.texCoordSetMapLen != 0))) { return (false); @@ -855,7 +855,7 @@ class RenderMolecule extends IndexedObject implements ObjectUpdate, NodeComponen if (VirtualUniverse.mc.isD3D() && (((geo.getClassType() == GeometryRetained.QUAD_TYPE) && !isQuadGeometryArray) || - ((geo.getClassType() == GeometryRetained.TRIANGLE_TYPE) + ((geo.getClassType() == GeometryRetained.TRIANGLE_TYPE) && !isTriGeometryArray))) { return false; } @@ -884,7 +884,7 @@ class RenderMolecule extends IndexedObject implements ObjectUpdate, NodeComponen // state could have been changed. Example, // application could have detached an appearance, // made changes to the appearance state, and then - // reattached the appearance. In this case, the + // reattached the appearance. In this case, the // changes would not have reflected to the RenderMolecule if (numEditingRenderAtoms == 0) { @@ -899,13 +899,13 @@ class RenderMolecule extends IndexedObject implements ObjectUpdate, NodeComponen else { return false; } - + } // Assign the cloned value as the original value // Either a changedFrequent or a null case // and the incoming one is not equal or null - // then return; + // then return; // This check also handles null == null case if (definingPolygonAttributes != null) { if ((this.definingPolygonAttributes.changedFrequent != 0) || @@ -950,7 +950,7 @@ class RenderMolecule extends IndexedObject implements ObjectUpdate, NodeComponen else if (lineAttributes != null) { return false; } - + if (definingPointAttributes != null) { if ((this.definingPointAttributes.changedFrequent != 0) || @@ -974,7 +974,7 @@ class RenderMolecule extends IndexedObject implements ObjectUpdate, NodeComponen return false; } - + if (definingMaterial != null) { @@ -1066,7 +1066,7 @@ class RenderMolecule extends IndexedObject implements ObjectUpdate, NodeComponen textureBin.removeRenderMolecule(this); return; } - + while (removeRAs != null) { r = (RenderAtom)removeRAs; r.removed = null; @@ -1079,7 +1079,7 @@ class RenderMolecule extends IndexedObject implements ObjectUpdate, NodeComponen // Don't remove null geo if (rinfo.geometry() == null) continue; - + if ((rinfo.groupType & RenderAtom.PRIMARY) != 0) { primaryChanged = true; if (rinfo.prev == null) { // At the head of the list @@ -1098,7 +1098,7 @@ class RenderMolecule extends IndexedObject implements ObjectUpdate, NodeComponen if (primaryMoleculeType == RASTER) { RasterRetained geo = (RasterRetained)rinfo.geometry(); renderBin.removeGeometryFromLockList(geo); - if (geo.image != null) + if (geo.image != null) renderBin.removeNodeComponent(geo.image); } @@ -1107,7 +1107,7 @@ class RenderMolecule extends IndexedObject implements ObjectUpdate, NodeComponen renderBin.removeDlistPerRinfo.add(rinfo); } } - } + } else if ((rinfo.groupType & RenderAtom.SEPARATE_DLIST_PER_GEO) != 0) { if (rinfo.prev == null) { // At the head of the list separateDlistRenderAtomList = rinfo.next; @@ -1121,7 +1121,7 @@ class RenderMolecule extends IndexedObject implements ObjectUpdate, NodeComponen } } renderBin.removeGeometryDlist(rinfo); - + } else { if (rinfo.prev == null) { // At the head of the list @@ -1174,7 +1174,7 @@ class RenderMolecule extends IndexedObject implements ObjectUpdate, NodeComponen vwcBounds.set(null); displayListId = 0; displayListIdObj = null; - } + } if (locale != renderBin.locale) { localeLocalToVworld = null; } @@ -1185,7 +1185,7 @@ class RenderMolecule extends IndexedObject implements ObjectUpdate, NodeComponen // If a renderAtom is added to the display list // structure then add this to the dirty list of rm // for which the display list needs to be recreated - renderBin.addDirtyRenderMolecule(this); + renderBin.addDirtyRenderMolecule(this); vwcBounds.set(null); rinfo = primaryRenderAtomList; while (rinfo != null) { @@ -1193,7 +1193,7 @@ class RenderMolecule extends IndexedObject implements ObjectUpdate, NodeComponen rinfo = rinfo.next; } primaryChanged = false; - } + } } } numEditingRenderAtoms = numRenderAtoms; @@ -1224,10 +1224,10 @@ class RenderMolecule extends IndexedObject implements ObjectUpdate, NodeComponen if ((r.groupType & RenderAtom.DLIST) != 0 && primaryRenderMethod == null) { primaryMoleculeType = DLIST_MOLECULE; renderBin.renderMoleculeList.add(this); - + if (vwcBounds == null) vwcBounds = new BoundingBox((BoundingBox)null); - primaryRenderMethod = + primaryRenderMethod = VirtualUniverse.mc.getDisplayListRenderMethod(); // Assign a displayListId for this renderMolecule if (displayListId == 0) { @@ -1239,7 +1239,7 @@ class RenderMolecule extends IndexedObject implements ObjectUpdate, NodeComponen primaryRenderMethod == null) { primaryMoleculeType = SEPARATE_DLIST_PER_RINFO_MOLECULE; renderBin.renderMoleculeList.add(this); - primaryRenderMethod = + primaryRenderMethod = VirtualUniverse.mc.getDisplayListRenderMethod(); } @@ -1281,13 +1281,13 @@ class RenderMolecule extends IndexedObject implements ObjectUpdate, NodeComponen else { r.next = separateDlistRenderAtomList; separateDlistRenderAtomList.prev = r; - separateDlistRenderAtomList = r; + separateDlistRenderAtomList = r; } ((GeometryArrayRetained)r.geometry()).assignDlistId(); renderBin.addGeometryDlist(r); } else { - if (secondaryRenderMethod == null) + if (secondaryRenderMethod == null) secondaryRenderMethod = cachedVertexArrayRenderMethod; if (vertexArrayRenderAtomList == null) { vertexArrayRenderAtomList = r; @@ -1295,7 +1295,7 @@ class RenderMolecule extends IndexedObject implements ObjectUpdate, NodeComponen else { r.next = vertexArrayRenderAtomList; vertexArrayRenderAtomList.prev = r; - vertexArrayRenderAtomList = r; + vertexArrayRenderAtomList = r; } // For indexed geometry there is no need to lock since // the mirror is changed only when the renderer is not @@ -1311,7 +1311,7 @@ class RenderMolecule extends IndexedObject implements ObjectUpdate, NodeComponen // refernce and there is color and we need to use alpha // Issue 113 - ignore multiScreen if ((( geo.vertexFormat & GeometryArray.BY_REFERENCE)!=0) && - (geo.c4fAllocated == 0) && + (geo.c4fAllocated == 0) && ((geo.vertexFormat & GeometryArray.COLOR) != 0) && useAlpha) { renderBin.addDirtyReferenceGeometry(geo); @@ -1390,8 +1390,8 @@ class RenderMolecule extends IndexedObject implements ObjectUpdate, NodeComponen i = localToVworldIndex[NodeRetained.LAST_LOCAL_TO_VWORLD]; localeLocalToVworld[i].getRotation(infLocalToVworld[i]); } - - // No new renderAtoms were added, but need to + + // No new renderAtoms were added, but need to // recompute vwcBounds in response to xform change if ((onUpdateList & BOUNDS_RECOMPUTE_UPDATE) != 0) { vwcBounds.set(null); @@ -1400,7 +1400,7 @@ class RenderMolecule extends IndexedObject implements ObjectUpdate, NodeComponen vwcBounds.combine(r.renderAtom.localeVwcBounds); r = r.next; } - } + } } // Clear all bits except the IN_DIRTY_LIST @@ -1420,10 +1420,10 @@ class RenderMolecule extends IndexedObject implements ObjectUpdate, NodeComponen // If dlist will be altered due to alpha or ignoreVertexColors, then don't // put in a separate dlist that can be shared ... final boolean geoNotAltered(GeometryArrayRetained geo) { - return !(((geo.vertexFormat & GeometryArray.COLOR) != 0) && + return !(((geo.vertexFormat & GeometryArray.COLOR) != 0) && (textureBin.attributeBin.ignoreVertexColors || useAlpha)); } - + int evalRinfoGroupType(RenderAtomListInfo r) { int groupType = 0; @@ -1433,7 +1433,7 @@ class RenderMolecule extends IndexedObject implements ObjectUpdate, NodeComponen if ((primaryMoleculeType & (COMPRESSED_MOLECULE | RASTER_MOLECULE | - TEXT3D_MOLECULE | + TEXT3D_MOLECULE | ORIENTEDSHAPE3D_MOLECULE)) != 0) { groupType = RenderAtom.OTHER; } @@ -1491,51 +1491,51 @@ class RenderMolecule extends IndexedObject implements ObjectUpdate, NodeComponen MaterialRetained mat = (raApp == null)? null : raApp.material; if (!soleUser && material != mat) { // no longer sole user - material = definingMaterial; + material = definingMaterial; } if ((geometryType & SURFACE) != 0) { - PolygonAttributesRetained pgAttrs = + PolygonAttributesRetained pgAttrs = (raApp == null)? null : raApp.polygonAttributes; if (!soleUser && polygonAttributes != pgAttrs) { - // no longer sole user - polygonAttributes = definingPolygonAttributes; + // no longer sole user + polygonAttributes = definingPolygonAttributes; } - } + } if ((geometryType & LINE) != 0) { - LineAttributesRetained lnAttrs = + LineAttributesRetained lnAttrs = (raApp == null)? null : raApp.lineAttributes; if (!soleUser && lineAttributes != lnAttrs) { - // no longer sole user - lineAttributes = definingLineAttributes; + // no longer sole user + lineAttributes = definingLineAttributes; } - } + } if ((geometryType & POINT) != 0) { - PointAttributesRetained pnAttrs = + PointAttributesRetained pnAttrs = (raApp == null)? null : raApp.pointAttributes; if (!soleUser && pointAttributes != pnAttrs) { - // no longer sole user - pointAttributes = definingPointAttributes; + // no longer sole user + pointAttributes = definingPointAttributes; } } - ColoringAttributesRetained coAttrs = + ColoringAttributesRetained coAttrs = (raApp == null)? null : raApp.coloringAttributes; if (!soleUser && coloringAttributes != coAttrs) { - // no longer sole user - coloringAttributes = definingColoringAttributes; + // no longer sole user + coloringAttributes = definingColoringAttributes; } - TransparencyAttributesRetained trAttrs = + TransparencyAttributesRetained trAttrs = (raApp == null)? null : raApp.transparencyAttributes; if (!soleUser && transparency != trAttrs) { - // no longer sole user - transparency = definingTransparency; + // no longer sole user + transparency = definingTransparency; } - + // If the renderAtom is being inserted first time, then evaluate // the groupType to determine if need separate localeVwcBounds @@ -1582,7 +1582,7 @@ class RenderMolecule extends IndexedObject implements ObjectUpdate, NodeComponen renderBin.addGeometryDlist(renderAtom.rListInfo[i]); } - if (removeRAs == null) + if (removeRAs == null) rb.removeRenderAtomInRMList.remove(this); } else { @@ -1625,7 +1625,7 @@ class RenderMolecule extends IndexedObject implements ObjectUpdate, NodeComponen void removeRenderAtom(RenderAtom r) { int index; - r.renderMolecule = null; + r.renderMolecule = null; if (r.added == this) { //Remove this renderAtom from the addRAs list @@ -1645,7 +1645,7 @@ class RenderMolecule extends IndexedObject implements ObjectUpdate, NodeComponen r.nextAdd = null; r.prevAdd = null; } - + r.added = null; r.envSet = null; // If the number of renderAtoms is zero, and it is on the @@ -1655,14 +1655,14 @@ class RenderMolecule extends IndexedObject implements ObjectUpdate, NodeComponen // Might be expensive to remove this entry from the renderBin // objUpdateList, just let it call the renderMolecule /* - if (addRAs == null) { + if (addRAs == null) { if (onUpdateList == NEW_RENDERATOMS_UPDATE){ renderBin.objUpdateList.remove(renderBin.objUpdateList.indexOf(this)); } onUpdateList &= ~NEW_RENDERATOMS_UPDATE; } */ - + } else { // Add this renderAtom to the remove list @@ -1727,14 +1727,14 @@ class RenderMolecule extends IndexedObject implements ObjectUpdate, NodeComponen definingTransparency.transparencyMode != TransparencyAttributes.SCREEN_DOOR); - + if (texUnits != null) { - for (int i = 0; + for (int i = 0; textureBlend == false && i < texUnits.length; i++) { if (texUnits[i] != null && texUnits[i].texAttrs != null) { - textureBlend = textureBlend || + textureBlend = textureBlend || (texUnits[i].texAttrs.textureMode == TextureAttributes.BLEND); } @@ -1743,8 +1743,8 @@ class RenderMolecule extends IndexedObject implements ObjectUpdate, NodeComponen alphaTest = renderAttrs != null && renderAttrs.alphaTestFunction != RenderingAttributes.ALWAYS; - - boolean oldUseAlpha = useAlpha; + + boolean oldUseAlpha = useAlpha; useAlpha = alphaBlend || alphaTest || textureBlend; if( !oldUseAlpha && useAlpha) { @@ -1761,7 +1761,7 @@ class RenderMolecule extends IndexedObject implements ObjectUpdate, NodeComponen // reference and there is color and we need to use alpha // Issue 113 - ignore multiScreen if ((( geo.vertexFormat & GeometryArray.BY_REFERENCE)!=0) && - (geo.c4fAllocated == 0) && + (geo.c4fAllocated == 0) && ((geo.vertexFormat & GeometryArray.COLOR) != 0) && useAlpha) { renderBin.addDirtyReferenceGeometry(geo); @@ -1780,13 +1780,13 @@ class RenderMolecule extends IndexedObject implements ObjectUpdate, NodeComponen return primaryRenderAtomList.renderAtom.geometryAtom. source.switchState.lastSwitchOn; - } - + } + if (vertexArrayRenderAtomList != null) { return vertexArrayRenderAtomList.renderAtom.geometryAtom. source.switchState.lastSwitchOn; - - } + + } if (separateDlistRenderAtomList != null) { return separateDlistRenderAtomList.renderAtom.geometryAtom. @@ -1800,10 +1800,10 @@ class RenderMolecule extends IndexedObject implements ObjectUpdate, NodeComponen */ boolean render(Canvas3D cv, int pass, int dirtyBits) { assert pass < 0; - + boolean isVisible = isSwitchOn(); - - if (!isVisible) { + + if (!isVisible) { return false; } @@ -1813,9 +1813,9 @@ class RenderMolecule extends IndexedObject implements ObjectUpdate, NodeComponen cv.setStateToUpdate(Canvas3D.RENDERMOLECULE_BIT, this); boolean modeSupportDL = true; - isNonUniformScale = !trans[localToVworldIndex[NodeRetained.LAST_LOCAL_TO_VWORLD]].isCongruent(); + isNonUniformScale = !trans[localToVworldIndex[NodeRetained.LAST_LOCAL_TO_VWORLD]].isCongruent(); // We have to dynamically switch between using displaymode - // mode or not instead of decide in canBeInDisplayList(), + // mode or not instead of decide in canBeInDisplayList(), // since polygonAttribute can be change by editable Appearance // or editable polygonAttribute which mode we can't take // advantage of display list mode in many cases just because @@ -1828,7 +1828,7 @@ class RenderMolecule extends IndexedObject implements ObjectUpdate, NodeComponen // the number of texture units supported by the Canvas, then // we'll have to punt to vertex array as well. - if ((pass != TextureBin.USE_DISPLAYLIST) || + if ((pass != TextureBin.USE_DISPLAYLIST) || (texCoordSetMapLen > cv.maxTexCoordSets) || (VirtualUniverse.mc.isD3D() && (((definingPolygonAttributes != null) && @@ -1837,7 +1837,7 @@ class RenderMolecule extends IndexedObject implements ObjectUpdate, NodeComponen PolygonAttributes.POLYGON_LINE))|| (isTriGeometryArray && (definingPolygonAttributes.polygonMode == - PolygonAttributes.POLYGON_POINT)))) || + PolygonAttributes.POLYGON_POINT)))) || cv.texLinearMode))) { modeSupportDL = false; } @@ -1862,18 +1862,18 @@ class RenderMolecule extends IndexedObject implements ObjectUpdate, NodeComponen else { if (renderBin.dlistRenderMethod.renderSeparateDlistPerRinfo(this, cv, primaryRenderAtomList,dirtyBits)) isVisible = true; - + } - } else { + } else { if(cachedVertexArrayRenderMethod.render(this, cv, - primaryRenderAtomList, + primaryRenderAtomList, dirtyBits)) { isVisible = true; } } } } - else { // TEXT3D or ORIENTEDSHAPE3D + else { // TEXT3D or ORIENTEDSHAPE3D if (primaryRenderAtomList != null) { if(primaryRenderMethod.render(this, cv, primaryRenderAtomList, @@ -1882,7 +1882,7 @@ class RenderMolecule extends IndexedObject implements ObjectUpdate, NodeComponen } } } - + if (separateDlistRenderAtomList != null) { if (modeSupportDL) { if(renderBin.dlistRenderMethod.renderSeparateDlists(this, cv, @@ -1890,21 +1890,21 @@ class RenderMolecule extends IndexedObject implements ObjectUpdate, NodeComponen dirtyBits)) { isVisible = true; } - + } else { - if(cachedVertexArrayRenderMethod.render(this, cv, + if(cachedVertexArrayRenderMethod.render(this, cv, separateDlistRenderAtomList, dirtyBits)) { isVisible = true; } } - + } - + // XXXX: In the case of independent primitives such as quads, // it would still be better to call multi draw arrays if (vertexArrayRenderAtomList != null) { - if(cachedVertexArrayRenderMethod.render(this, cv, + if(cachedVertexArrayRenderMethod.render(this, cv, vertexArrayRenderAtomList, dirtyBits)) { isVisible = true; @@ -1912,19 +1912,19 @@ class RenderMolecule extends IndexedObject implements ObjectUpdate, NodeComponen } return isVisible; } - + void updateAttributes(Canvas3D cv, int dirtyBits) { - boolean setTransparency = false; + boolean setTransparency = false; - // If this is a beginning of a frame OR diff. geometryType + // If this is a beginning of a frame OR diff. geometryType // then reload everything for the first rendermolecule // System.err.println("updateAttributes"); int bitMask = geometryType | Canvas3D.MATERIAL_DIRTY| Canvas3D.COLORINGATTRS_DIRTY| Canvas3D.TRANSPARENCYATTRS_DIRTY; - + // If beginning of a frame then reload all the attributes if ((cv.canvasDirty & bitMask) != 0) { if ((geometryType & SURFACE) != 0) { @@ -1932,9 +1932,9 @@ class RenderMolecule extends IndexedObject implements ObjectUpdate, NodeComponen cv.resetPolygonAttributes(cv.ctx); } else { definingPolygonAttributes.updateNative(cv.ctx); - } + } cv.polygonAttributes = polygonAttributes; - } + } if ((geometryType & LINE) != 0) { if (definingLineAttributes == null) { cv.resetLineAttributes(cv.ctx); @@ -1942,7 +1942,7 @@ class RenderMolecule extends IndexedObject implements ObjectUpdate, NodeComponen definingLineAttributes.updateNative(cv.ctx); } cv.lineAttributes = lineAttributes; - } + } if ((geometryType & POINT) != 0) { if (definingPointAttributes == null) { cv.resetPointAttributes(cv.ctx); @@ -1958,29 +1958,29 @@ class RenderMolecule extends IndexedObject implements ObjectUpdate, NodeComponen } else { definingTransparency.updateNative(cv.ctx, alpha, geometryType, - polygonMode, lineAA, + polygonMode, lineAA, pointAA); } cv.transparency = transparency; - + if (definingMaterial == null) { cv.updateMaterial(cv.ctx, red, green, blue, alpha); } else { definingMaterial.updateNative(cv.ctx, - red, green, blue, alpha, + red, green, blue, alpha, enableLighting); } cv.material = material; cv.enableLighting = enableLighting; if (definingColoringAttributes == null) { - cv.resetColoringAttributes(cv.ctx, red, green, blue, + cv.resetColoringAttributes(cv.ctx, red, green, blue, alpha, enableLighting); } else { definingColoringAttributes.updateNative(cv.ctx, dRed, dBlue, - dGreen,alpha, + dGreen,alpha, enableLighting); } cv.coloringAttributes = coloringAttributes; @@ -1996,46 +1996,46 @@ class RenderMolecule extends IndexedObject implements ObjectUpdate, NodeComponen // whenever encounter a non-visible rm else if (cv.renderMolecule != this && (dirtyBits != 0)) { - + // no need to download states if appHandle is the same if (cv.appHandle != appHandle) { - + // Check if the attribute bundle in the canvas is the same // as the attribute bundle in this renderMolecule - - if (cv.transparency != transparency && + + if (cv.transparency != transparency && (dirtyBits & TRANSPARENCY_DIRTY) != 0) { setTransparency = true; if (definingTransparency == null) { - + cv.resetTransparency(cv.ctx, geometryType, polygonMode, lineAA, pointAA); - } else { - definingTransparency.updateNative(cv.ctx, alpha, - geometryType, polygonMode, + } else { + definingTransparency.updateNative(cv.ctx, alpha, + geometryType, polygonMode, lineAA, pointAA); } cv.transparency = transparency; - } - - if (setTransparency || ((cv.enableLighting != enableLighting) || - (cv.material != material) && - (dirtyBits & MATERIAL_DIRTY) != 0)){ - if (definingMaterial == null) { + } + + if (setTransparency || ((cv.enableLighting != enableLighting) || + (cv.material != material) && + (dirtyBits & MATERIAL_DIRTY) != 0)){ + if (definingMaterial == null) { cv.updateMaterial(cv.ctx, red, green, blue, alpha); - } else { - definingMaterial.updateNative(cv.ctx, red, green, - blue, alpha, + } else { + definingMaterial.updateNative(cv.ctx, red, green, + blue, alpha, enableLighting); } cv.material = material; cv.enableLighting = enableLighting; - } - + } + if (((geometryType & SURFACE) != 0) && cv.polygonAttributes != polygonAttributes && (dirtyBits & POLYGONATTRS_DIRTY) != 0) { - + if (definingPolygonAttributes == null) { cv.resetPolygonAttributes(cv.ctx); } else { @@ -2043,11 +2043,11 @@ class RenderMolecule extends IndexedObject implements ObjectUpdate, NodeComponen } cv.polygonAttributes = polygonAttributes; } - + if (((geometryType & LINE) != 0) && cv.lineAttributes != lineAttributes && (dirtyBits & LINEATTRS_DIRTY) != 0) { - + if (definingLineAttributes == null) { cv.resetLineAttributes(cv.ctx); } else { @@ -2055,11 +2055,11 @@ class RenderMolecule extends IndexedObject implements ObjectUpdate, NodeComponen } cv.lineAttributes = lineAttributes; } - + if (((geometryType & POINT) != 0) && cv.pointAttributes != pointAttributes && (dirtyBits & POINTATTRS_DIRTY) != 0) { - + if (definingPointAttributes == null) { cv.resetPointAttributes(cv.ctx); } else { @@ -2067,15 +2067,15 @@ class RenderMolecule extends IndexedObject implements ObjectUpdate, NodeComponen } cv.pointAttributes = pointAttributes; } - + // Use Object instead of AppearanceRetained class for // state caching optimation for memory performance cv.appHandle = appHandle; } - // no state caching for color attrs, which can also be + // no state caching for color attrs, which can also be // changed by primitive with colors if(setTransparency || ((dirtyBits & COLORINGATTRS_DIRTY) != 0)) { - + if (definingColoringAttributes == null) { cv.resetColoringAttributes(cv.ctx, red, green, blue, alpha, @@ -2083,34 +2083,34 @@ class RenderMolecule extends IndexedObject implements ObjectUpdate, NodeComponen } else { definingColoringAttributes.updateNative(cv.ctx, dRed, - dBlue, - dGreen,alpha, + dBlue, + dGreen,alpha, enableLighting); - + } cv.coloringAttributes = coloringAttributes; - } - + } + } - + if ((primaryMoleculeType & (TEXT3D_MOLECULE| ORIENTEDSHAPE3D_MOLECULE)) == 0) { /* System.err.println("updateAttributes setModelViewMatrix (1)"); */ Transform3D modelMatrix = trans[localToVworldIndex[NodeRetained.LAST_LOCAL_TO_VWORLD]]; - + if (cv.modelMatrix != modelMatrix) { /* System.err.println("updateAttributes setModelViewMatrix (2)"); */ - cv.setModelViewMatrix(cv.ctx, cv.vworldToEc.mat, + cv.setModelViewMatrix(cv.ctx, cv.vworldToEc.mat, modelMatrix); } } - + cv.canvasDirty &= ~bitMask; cv.renderMolecule = this; } - + void transparentSortRender(Canvas3D cv, int pass, TransparentRenderingInfo tinfo) { assert pass < 0; @@ -2119,12 +2119,12 @@ class RenderMolecule extends IndexedObject implements ObjectUpdate, NodeComponen // include this LightBin to the to-be-updated list in Canvas cv.setStateToUpdate(Canvas3D.RENDERMOLECULE_BIT, this); - - + + boolean modeSupportDL = true; - + // We have to dynamically switch between using displaymode - // mode or not instead of decide in canBeInDisplayList(), + // mode or not instead of decide in canBeInDisplayList(), // since polygonAttribute can be change by editable Appearance // or editable polygonAttribute which mode we can't take // advantage of display list mode in many cases just because @@ -2145,7 +2145,7 @@ class RenderMolecule extends IndexedObject implements ObjectUpdate, NodeComponen (isTriGeometryArray && (definingPolygonAttributes.polygonMode == PolygonAttributes.POLYGON_POINT)))) - || + || cv.texLinearMode))) { modeSupportDL = false; } @@ -2202,7 +2202,7 @@ class RenderMolecule extends IndexedObject implements ObjectUpdate, NodeComponen ALL_DIRTY_BITS); tinfo.rInfo.next = save; } - + } @@ -2213,7 +2213,7 @@ class RenderMolecule extends IndexedObject implements ObjectUpdate, NodeComponen */ void updateTransparencyAttributes(Canvas3D cv) { if (definingTransparency == null) { - cv.resetTransparency(cv.ctx, geometryType, polygonMode, + cv.resetTransparency(cv.ctx, geometryType, polygonMode, lineAA, pointAA); } else { definingTransparency.updateNative(cv.ctx, alpha, geometryType, @@ -2225,7 +2225,7 @@ class RenderMolecule extends IndexedObject implements ObjectUpdate, NodeComponen // This function only gets called when primaryRenderAtomsList are if (primaryRenderAtomList != null) { ((DisplayListRenderMethod)primaryRenderMethod).buildDisplayList(this, cv); - } + } } void releaseAllPrimaryDisplayListID() { @@ -2252,7 +2252,7 @@ class RenderMolecule extends IndexedObject implements ObjectUpdate, NodeComponen displayListId = -1; } } - } + } } @@ -2274,7 +2274,7 @@ class RenderMolecule extends IndexedObject implements ObjectUpdate, NodeComponen cv.freeDisplayList(ctx, displayListId); } } - } + } } void updateAllPrimaryDisplayLists(Canvas3D cv) { @@ -2290,9 +2290,9 @@ class RenderMolecule extends IndexedObject implements ObjectUpdate, NodeComponen else if(primaryMoleculeType == DLIST_MOLECULE) { ((DisplayListRenderMethod)primaryRenderMethod).buildDisplayList(this, cv); } - } + } } - + void checkEquivalenceWithBothNeighbors(int dirtyBits) { RenderMolecule leftRm = prev; RenderMolecule rightRm = next; @@ -2306,7 +2306,7 @@ class RenderMolecule extends IndexedObject implements ObjectUpdate, NodeComponen next.checkEquivalenceWithLeftNeighbor(this, dirtyBits); } } - + boolean reloadColor(RenderMolecule rm) { if (((rm.vertexFormat & GeometryArray.COLOR) == 0) || (((rm.vertexFormat & GeometryArray.COLOR) != 0) && @@ -2320,8 +2320,8 @@ class RenderMolecule extends IndexedObject implements ObjectUpdate, NodeComponen boolean reload_color = reloadColor(rm); // XXXX : For now ignore the dirtyBits being sent in dirtyAttrsAcrossRms = ALL_DIRTY_BITS ; - - + + // There is some interdepenency between the different components // in the way it is sent down to the native code @@ -2331,12 +2331,12 @@ class RenderMolecule extends IndexedObject implements ObjectUpdate, NodeComponen int materialColoringDirty = (MATERIAL_DIRTY | TRANSPARENCY_DIRTY | COLORINGATTRS_DIRTY); - + int transparencyDirty = (TRANSPARENCY_DIRTY| POLYGONATTRS_DIRTY | LINEATTRS_DIRTY | POINTATTRS_DIRTY); - + if ((dirtyAttrsAcrossRms & POLYGONATTRS_DIRTY) != 0) { if (rm.geometryType == geometryType && (rm.polygonAttributes == polygonAttributes || @@ -2356,7 +2356,7 @@ class RenderMolecule extends IndexedObject implements ObjectUpdate, NodeComponen } if ((dirtyAttrsAcrossRms & LINEATTRS_DIRTY) != 0) { - if (rm.geometryType == geometryType && + if (rm.geometryType == geometryType && ((rm.lineAttributes == lineAttributes) || ((rm.definingLineAttributes != null) && (rm.definingLineAttributes.equivalent(definingLineAttributes))))) @@ -2396,7 +2396,7 @@ class RenderMolecule extends IndexedObject implements ObjectUpdate, NodeComponen void translate() { // System.err.println("onUpdateList = "+onUpdateList+" renderBin.localeChanged = "+renderBin.localeChanged+" rm = "+this); int i = localToVworldIndex[NodeRetained.LAST_LOCAL_TO_VWORLD]; - + localeLocalToVworld[i].mat[0] = localToVworld[i].mat[0]; localeLocalToVworld[i].mat[1] = localToVworld[i].mat[1]; localeLocalToVworld[i].mat[2] = localToVworld[i].mat[2]; @@ -2422,12 +2422,12 @@ class RenderMolecule extends IndexedObject implements ObjectUpdate, NodeComponen // D3D doesn't support line/point antialiasing if ((geometryType & SURFACE) != 0) { if (definingPolygonAttributes != null) { - if ((definingPolygonAttributes.polygonMode == + if ((definingPolygonAttributes.polygonMode == PolygonAttributes.POLYGON_POINT) && (definingPointAttributes != null) && definingPointAttributes.pointAntialiasing) { return false; - } else if ((definingPolygonAttributes.polygonMode == + } else if ((definingPolygonAttributes.polygonMode == PolygonAttributes.POLYGON_LINE) && (definingLineAttributes != null) && definingLineAttributes.lineAntialiasing) { @@ -2474,7 +2474,7 @@ class RenderMolecule extends IndexedObject implements ObjectUpdate, NodeComponen // System.err.println("===> updating node component, cloned = "+cloned+" material.changedFrequent = "+material.changedFrequent); // System.err.println("===> definingMaterial ="+definingMaterial+" material = "+material); - + material = ((AppearanceRetained)appHandle).material; if (material == null) definingMaterial = null; @@ -2537,7 +2537,7 @@ class RenderMolecule extends IndexedObject implements ObjectUpdate, NodeComponen if (pointAttributes.changedFrequent != 0) { definingPointAttributes = pointAttributes; } - else { + else { // If the one replaced is a cloned copy, then .. if (cloned) { definingPointAttributes.set(pointAttributes); @@ -2552,7 +2552,7 @@ class RenderMolecule extends IndexedObject implements ObjectUpdate, NodeComponen else { pointAA = definingPointAttributes.pointAntialiasing; } - + } if ((soleUserCompDirty & POLYGONATTRS_DIRTY) != 0) { if (soleUser) { @@ -2578,7 +2578,7 @@ class RenderMolecule extends IndexedObject implements ObjectUpdate, NodeComponen definingPolygonAttributes = (PolygonAttributesRetained)polygonAttributes.clone(); } } - + polygonMode = definingPolygonAttributes.polygonMode; } } @@ -2589,7 +2589,7 @@ class RenderMolecule extends IndexedObject implements ObjectUpdate, NodeComponen if (polygonMode == PolygonAttributes.POLYGON_LINE) { geometryType |= LINE; } else if (polygonMode == PolygonAttributes.POLYGON_POINT) { - geometryType |= POINT; + geometryType |= POINT; } } @@ -2623,7 +2623,7 @@ class RenderMolecule extends IndexedObject implements ObjectUpdate, NodeComponen alpha = 1.0f - definingTransparency.transparency; } } - + if ((soleUserCompDirty & COLORINGATTRS_DIRTY) != 0) { if (soleUser) { // Evaluate before replacing the old Value @@ -2665,7 +2665,7 @@ class RenderMolecule extends IndexedObject implements ObjectUpdate, NodeComponen // System.err.println("rm = "+this+"red = "+red+" green = "+green+" blue = "+blue); boolean newVal = isOpaque() || inOrderedGroup; return (isOpaqueOrInOG != newVal); - + } // Issue 129: method to add or remove all rendering atoms in this @@ -2677,7 +2677,7 @@ class RenderMolecule extends IndexedObject implements ObjectUpdate, NodeComponen addRemoveTransparentObject(renderBin, add, separateDlistRenderAtomList); addRemoveTransparentObject(renderBin, add, vertexArrayRenderAtomList); } - + private void addRemoveTransparentObject(RenderBin renderBin, boolean add, RenderAtomListInfo rinfo) { @@ -2707,7 +2707,7 @@ class RenderMolecule extends IndexedObject implements ObjectUpdate, NodeComponen dGreen = 1.0f; dBlue = 1.0f; } else { - if (normalPresent) + if (normalPresent) enableLighting = definingMaterial.lightingEnable; else enableLighting = false; @@ -2744,7 +2744,7 @@ class RenderMolecule extends IndexedObject implements ObjectUpdate, NodeComponen } } - + void handleMaterialEquivalence() { // Check if it has equivalent material to any of the "non-dirty" // renderMolecules before this one @@ -2772,7 +2772,7 @@ class RenderMolecule extends IndexedObject implements ObjectUpdate, NodeComponen bits = prev.soleUserCompDirty; else if (prevMap != null) bits = prevMap.soleUserCompDirty; - + leftBits = ((soleUserCompDirty |bits) &ALL_DIRTY_BITS); rightBits = ((soleUserCompDirty & ALL_DIRTY_BITS) & ~MATERIAL_DIRTY); markBitsAsDirty(leftBits, rightBits); @@ -2920,7 +2920,7 @@ class RenderMolecule extends IndexedObject implements ObjectUpdate, NodeComponen if (!reloadColor) { if (((this.material == rm.material) || ((rm.definingMaterial != null) && - (rm.definingMaterial.equivalent(definingMaterial)))) && + (rm.definingMaterial.equivalent(definingMaterial)))) && rm.alpha == alpha && enableLighting == rm.enableLighting && (enableLighting || @@ -2992,7 +2992,7 @@ class RenderMolecule extends IndexedObject implements ObjectUpdate, NodeComponen locale.hiRes.difference(renderBin.locale.hiRes, localeTranslation); translate(); int i = localToVworldIndex[NodeRetained.CURRENT_LOCAL_TO_VWORLD]; - + localeLocalToVworld[i].mat[0] = localToVworld[i].mat[0]; localeLocalToVworld[i].mat[1] = localToVworld[i].mat[1]; localeLocalToVworld[i].mat[2] = localToVworld[i].mat[2]; @@ -3011,13 +3011,13 @@ class RenderMolecule extends IndexedObject implements ObjectUpdate, NodeComponen localeLocalToVworld[i].mat[15] = localToVworld[i].mat[15]; } } - + trans = localeLocalToVworld; } /** - * updateNodeComponentCheck is called for each soleUser RenderMolecule + * updateNodeComponentCheck is called for each soleUser RenderMolecule * into which new renderAtom has been added. This method is called before * updateNodeComponent() to allow RenderMolecule to catch any node * component changes that have been missed because the changes @@ -3083,7 +3083,7 @@ class RenderMolecule extends IndexedObject implements ObjectUpdate, NodeComponen soleUserCompDirty |= COLORINGATTRS_DIRTY; } } - + if (definingTransparency != null && definingTransparency == transparency) { if (definingTransparency.compChanged != 0) { diff --git a/src/classes/share/javax/media/j3d/Renderer.java b/src/classes/share/javax/media/j3d/Renderer.java index 7861f7f..704b132 100644 --- a/src/classes/share/javax/media/j3d/Renderer.java +++ b/src/classes/share/javax/media/j3d/Renderer.java @@ -45,13 +45,13 @@ import java.util.*; class Renderer extends J3dThread { - + // This action causes this thread to wait static final int WAIT = 0; - + // This action causes this thread to notify the view, and then wait. static final int NOTIFY_AND_WAIT = 1; - + // This action causes this thread to be notified static final int NOTIFY = 2; @@ -59,16 +59,16 @@ class Renderer extends J3dThread { static final int DECAL_NONE = 0; static final int DECAL_1ST_CHILD = 1; static final int DECAL_NTH_CHILD = 2; - + // stuff for scene antialiasing static final int NUM_ACCUMULATION_SAMPLES = 8; static final float ACCUM_SAMPLES_X[] = - { -0.54818f, 0.56438f, 0.39462f, -0.54498f, + { -0.54818f, 0.56438f, 0.39462f, -0.54498f, -0.83790f, -0.39263f, 0.32254f, 0.84216f}; static final float ACCUM_SAMPLES_Y[] = - { 0.55331f, -0.53495f, 0.41540f, -0.52829f, + { 0.55331f, -0.53495f, 0.41540f, -0.52829f, 0.82102f, -0.27383f, 0.09133f, -0.84399f}; static final float accumValue = 1.0f / NUM_ACCUMULATION_SAMPLES; @@ -91,7 +91,7 @@ class Renderer extends J3dThread { // Local copy of sharedStereZBuffer flag boolean sharedStereoZBuffer; - + // This is the id for the underlying sharable graphics context Context sharedCtx = null; @@ -102,7 +102,7 @@ class Renderer extends J3dThread { // display and drawable, used to free shared context private long sharedCtxDisplay = 0; - private Drawable sharedCtxDrawable = null; + private Drawable sharedCtxDrawable = null; /** * This is the id of the current rendering context @@ -130,7 +130,7 @@ class Renderer extends J3dThread { // List of (Rm, rInfo) pair of individual dlists that need to be rebuilt ArrayList dirtyDlistPerRinfoList = new ArrayList(); - + // Texture and display list that should be freed ArrayList textureIdResourceFreeList = new ArrayList(); ArrayList displayListResourceFreeList = new ArrayList(); @@ -147,12 +147,12 @@ class Renderer extends J3dThread { Screen3D onScreen; Screen3D offScreen; - // full screen anti-aliasing projection matrices + // full screen anti-aliasing projection matrices Transform3D accumLeftProj = new Transform3D(); Transform3D accumRightProj = new Transform3D(); Transform3D accumInfLeftProj = new Transform3D(); - Transform3D accumInfRightProj = new Transform3D(); - + Transform3D accumInfRightProj = new Transform3D(); + // rendering messages J3dMessage m[]; int nmesg = 0; @@ -189,7 +189,7 @@ class Renderer extends J3dThread { } /** - * Constructs a new Renderer + * Constructs a new Renderer */ Renderer(ThreadGroup t) { super(t); @@ -201,7 +201,7 @@ class Renderer extends J3dThread { renderMessage = new J3dMessage[1]; } - + /** * The main loop for the renderer. */ @@ -219,14 +219,14 @@ class Renderer extends J3dThread { double accumDx = 0.0f, accumDy = 0.0f; double accumDxFactor = 1.0f, accumDyFactor = 1.0f; - double accumLeftX = 0.0, accumLeftY = 0.0, + double accumLeftX = 0.0, accumLeftY = 0.0, accumRightX = 0.0, accumRightY = 0.0, - accumInfLeftX = 0.0, accumInfLeftY = 0.0, + accumInfLeftX = 0.0, accumInfLeftY = 0.0, accumInfRightX = 0.0, accumInfRightY = 0.0; int opArg, status; boolean done = false; Transform3D t3d = null; - + opArg = ((Integer)args[0]).intValue(); try { @@ -363,7 +363,7 @@ class Renderer extends J3dThread { J3dThread.RENDER_THREAD); } } - + } else if (opArg == REQUESTCLEANUP) { Integer mtype = (Integer) args[2]; @@ -382,17 +382,17 @@ class Renderer extends J3dThread { cv.makeCtxCurrent(); } cv.freeContextResources(cv.screen.renderer, true, cv.ctx); - } else if (mtype == MasterControl.REMOVECTX_CLEANUP) { + } else if (mtype == MasterControl.REMOVECTX_CLEANUP) { // from Canvas3D removeCtx() postRequest Object[] obj = (Object []) args[1]; - Canvas3D c = (Canvas3D) obj[0]; + Canvas3D c = (Canvas3D) obj[0]; removeCtx(c, ((Long) obj[1]).longValue(), (Drawable) obj[2], - (Context) obj[3], - false, !c.offScreen, - false); - } + (Context) obj[3], + false, !c.offScreen, + false); + } return; } else { // RENDER || REQUESTRENDER @@ -446,8 +446,8 @@ class Renderer extends J3dThread { // Setup stencil related variables. c.actualStencilSize = c.getStencilSize(); boolean userOwnsStencil = c.requestedStencilSize > 0; - - c.userStencilAvailable = + + c.userStencilAvailable = (userOwnsStencil && (c.actualStencilSize > 0)); c.systemStencilAvailable = (!userOwnsStencil && (c.actualStencilSize > 0)); @@ -458,7 +458,7 @@ class Renderer extends J3dThread { if (c.sceneAntialiasingMultiSamplesAvailable) { c.sceneAntialiasingAvailable = true; } else { - c.sceneAntialiasingAvailable = + c.sceneAntialiasingAvailable = c.hasSceneAntialiasingAccum(); } } catch (RuntimeException ex) { @@ -493,7 +493,7 @@ class Renderer extends J3dThread { GraphicsConfigTemplate3D.runMonitor(J3dThread.NOTIFY); currentCtx = null; currentDrawable = null; - } + } } else if (secondArg instanceof Integer) { // Issue 121 - This was formerly used as a message from // the now-nonexistant TextureRetained finalize() method @@ -565,7 +565,7 @@ class Renderer extends J3dThread { canvas.drawable = null; try { - // Issue 396. Pass in a null ctx for 2 reasons : + // Issue 396. Pass in a null ctx for 2 reasons : // 1) We should not use ctx field directly without buffering in a msg. // 2) canvas.ctx should be null. canvas.drawable = @@ -592,7 +592,7 @@ class Renderer extends J3dThread { canvas.offScreenBufferPending = false; m[nmesg++].decRefcount(); continue; - } + } else if (renderType == J3dMessage.DESTROY_CTX_AND_OFFSCREENBUFFER) { Object[] obj = m[nmesg].args; @@ -622,7 +622,7 @@ class Renderer extends J3dThread { continue; } - if (!canvas.validCanvas && + if (!canvas.validCanvas && (renderType != J3dMessage.RENDER_OFFSCREEN)) { m[nmesg++].decRefcount(); continue; @@ -705,7 +705,7 @@ class Renderer extends J3dThread { (HiResCoord)m[nmesg].args[2]); break; case GraphicsContext3D.SET_MODEL_TRANSFORM: - t3d = (Transform3D)m[nmesg].args[2]; + t3d = (Transform3D)m[nmesg].args[2]; canvas.graphicsContext3D.doSetModelTransform(t3d); break; case GraphicsContext3D.MULTIPLY_MODEL_TRANSFORM: @@ -756,7 +756,7 @@ class Renderer extends J3dThread { case GraphicsContext3D.DRAWANDFLUSH2D: Object ar[] = m[nmesg].args; canvas.graphics2D.doDrawAndFlushImage( - (BufferedImage) ar[2], + (BufferedImage) ar[2], ((Point) ar[3]).x, ((Point) ar[3]).y, (ImageObserver) ar[4]); @@ -800,13 +800,13 @@ class Renderer extends J3dThread { } m[nmesg++].decRefcount(); - + if (canvas.isFatalError()) { continue; } ImageComponent2DRetained offBufRetained = null; - + if (renderType == J3dMessage.RENDER_OFFSCREEN) { // Issue 131: set offScreenRendering flag here, since it // otherwise won't be set for auto-off-screen rendering @@ -818,15 +818,15 @@ class Renderer extends J3dThread { } else { offBufRetained = (ImageComponent2DRetained) canvas.offScreenBuffer.retained; - + if (offBufRetained.isByReference()) { offBufRetained.geomLock.getLock(); } - + offBufRetained.evaluateExtensions(canvas); - + } - + } else if (!canvas.active) { continue; } @@ -841,7 +841,7 @@ class Renderer extends J3dThread { renderBin = canvas.view.renderBin; - // setup rendering context + // setup rendering context // We need to catch NullPointerException when the dsi // gets yanked from us during a remove. @@ -864,7 +864,7 @@ class Renderer extends J3dThread { synchronized (VirtualUniverse.mc.contextCreationLock) { sharedCtx = null; - try { + try { sharedCtx = canvas.createNewContext(null, true); } catch (RuntimeException ex) { ex.printStackTrace(); @@ -889,7 +889,7 @@ class Renderer extends J3dThread { break doneRender; } - sharedCtxTimeStamp = + sharedCtxTimeStamp = VirtualUniverse.mc.getContextTimeStamp(); needToRebuildDisplayList = true; @@ -901,7 +901,7 @@ class Renderer extends J3dThread { if (canvas.ctx == null) { - // Always lock for context create + // Always lock for context create if (!canvas.drawingSurfaceObject.renderLock()) { if ((offBufRetained != null) && offBufRetained.isByReference()) { @@ -920,7 +920,7 @@ class Renderer extends J3dThread { } if (canvas.ctx == null) { - canvas.drawingSurfaceObject.unLock(); + canvas.drawingSurfaceObject.unLock(); if ((offBufRetained != null) && offBufRetained.isByReference()) { offBufRetained.geomLock.unLock(); @@ -943,7 +943,7 @@ class Renderer extends J3dThread { canvas.graphics2D.init(); } - canvas.ctxTimeStamp = + canvas.ctxTimeStamp = VirtualUniverse.mc.getContextTimeStamp(); listOfCtxs.add(canvas.ctx); listOfCanvases.add(canvas); @@ -951,7 +951,7 @@ class Renderer extends J3dThread { if (renderBin.nodeComponentList.size() > 0) { for (i = 0; i < renderBin.nodeComponentList.size(); i++) { NodeComponentRetained nc = (NodeComponentRetained)renderBin.nodeComponentList.get(i); - if(nc instanceof ImageComponentRetained) { + if(nc instanceof ImageComponentRetained) { ((ImageComponentRetained)nc).evaluateExtensions(canvas); } } @@ -973,7 +973,7 @@ class Renderer extends J3dThread { if (!canvas.useSharedCtx) { canvas.needToRebuildDisplayList = true; } - canvas.drawingSurfaceObject.unLock(); + canvas.drawingSurfaceObject.unLock(); } else { if (canvas.isRunning) { @@ -1026,7 +1026,7 @@ class Renderer extends J3dThread { canvas.offScreenRendering = false; break doneRender; } - + // setup viewport canvas.setViewport(canvas.ctx, 0, 0, cvCache.getCanvasWidth(), @@ -1061,7 +1061,7 @@ class Renderer extends J3dThread { } textureReloadList.clear(); } - + } else { // update each canvas if (canvas.needToRebuildDisplayList) { @@ -1099,7 +1099,7 @@ class Renderer extends J3dThread { num_stereo_passes = 1; stereo_mode = Canvas3D.FIELD_ALL; - // just in case user set flag - + // just in case user set flag - // disable since we are not in stereo sharedStereoZBuffer = false; } @@ -1107,9 +1107,9 @@ class Renderer extends J3dThread { // full screen anti-aliasing setup if (canvas.view.getSceneAntialiasingEnable() && canvas.sceneAntialiasingAvailable) { - - if (!VirtualUniverse.mc.isD3D() && - ((canvas.extensionsSupported & Canvas3D.MULTISAMPLE) == 0) || + + if (!VirtualUniverse.mc.isD3D() && + ((canvas.extensionsSupported & Canvas3D.MULTISAMPLE) == 0) || !canvas.sceneAntialiasingMultiSamplesAvailable) { doAccum = true; num_accum_passes = NUM_ACCUMULATION_SAMPLES; @@ -1126,7 +1126,7 @@ class Renderer extends J3dThread { accumDyFactor = ( canvas.canvasViewCache.getPhysicalWindowHeight() / canvas.canvasViewCache.getCanvasHeight())*canvas.view.fieldOfView; - + accumLeftX = accumLeftProj.mat[3]; accumLeftY = accumLeftProj.mat[7]; @@ -1152,7 +1152,7 @@ class Renderer extends J3dThread { accumInfRightX = accumInfRightProj.mat[3]; accumInfRightY = accumInfRightProj.mat[7]; } - } + } } else { if (!canvas.antialiasingSet) { @@ -1192,9 +1192,9 @@ class Renderer extends J3dThread { // and not in stereo mode if (!doAccum && !sharedStereoZBuffer) { BackgroundRetained bg = renderBin.background; - + canvas.clear(bg, winWidth, winHeight); - + } // handle preRender callback @@ -1233,8 +1233,8 @@ class Renderer extends J3dThread { canvas.setRenderMode(canvas.ctx, stereo_mode, canvas.useDoubleBuffer); - - + + for (apass = 0; apass < num_accum_passes; apass++) { // jitter projection matrix and clear background @@ -1273,12 +1273,12 @@ class Renderer extends J3dThread { accumInfLeftProj.mat[5] * accumDy; if (useStereo) { - accumInfRightProj.mat[3] = + accumInfRightProj.mat[3] = accumInfRightX + accumInfRightProj.mat[0] * accumDx + accumInfRightProj.mat[1] * accumDy; - accumInfRightProj.mat[7] = + accumInfRightProj.mat[7] = accumInfRightY + accumInfRightProj.mat[4] * accumDx + accumInfRightProj.mat[5] * accumDy; @@ -1300,7 +1300,7 @@ class Renderer extends J3dThread { // setup rendering matrices if (pass == 0) { - canvas.vpcToEc = + canvas.vpcToEc = cvCache.getInfLeftVpcToEc(); if (doAccum) { canvas.setProjectionMatrix( @@ -1311,7 +1311,7 @@ class Renderer extends J3dThread { cvCache.getInfLeftProjection()); } } else { - canvas.vpcToEc = + canvas.vpcToEc = cvCache.getInfRightVpcToEc(); if (doAccum) { canvas.setProjectionMatrix( @@ -1347,7 +1347,7 @@ class Renderer extends J3dThread { canvas.setProjectionMatrix(canvas.ctx, cvCache.getRightProjection()); } - } + } canvas.vworldToEc.mul(canvas.vpcToEc, cvCache.getVworldToVpc()); @@ -1364,7 +1364,7 @@ class Renderer extends J3dThread { if (useStereo) { canvas.canvasDirty |= Canvas3D.VIEW_MATRIX_DIRTY; } - + // render opaque geometry renderBin.renderOpaque(canvas); @@ -1482,7 +1482,7 @@ class Renderer extends J3dThread { if ((offBufRetained != null) && offBufRetained.isByReference()) { offBufRetained.geomLock.unLock(); - } + } } } } @@ -1540,9 +1540,9 @@ class Renderer extends J3dThread { void cleanup() { super.cleanup(); renderMessage = new J3dMessage[1]; - rendererStructure = new RendererStructure(); + rendererStructure = new RendererStructure(); bgVworldToVpc = new Transform3D(); - sharedCtx = null; + sharedCtx = null; sharedCtxTimeStamp = 0; sharedCtxDisplay = 0; sharedCtxDrawable = null; @@ -1579,7 +1579,7 @@ class Renderer extends J3dThread { // user thread will not wait for it. Also we can just // reuse it as Canvas3D did not destroy. private void removeCtx(Canvas3D cv, long display, Drawable drawable, Context ctx, - boolean resetCtx, boolean freeBackground, + boolean resetCtx, boolean freeBackground, boolean destroyOffScreenBuffer) { synchronized (VirtualUniverse.mc.contextCreationLock) { @@ -1631,7 +1631,7 @@ class Renderer extends J3dThread { } // Fix for issue 18. - // Since we are now the renderer thread, + // Since we are now the renderer thread, // we can safely execute destroyOffScreenBuffer. if(destroyOffScreenBuffer) { cv.destroyOffScreenBuffer(ctx, display, cv.fbConfig, drawable); @@ -1680,7 +1680,7 @@ class Renderer extends J3dThread { cv.ctx = null; cv.ctxTimeStamp = 0; } - + if (sharedCtx != null) { sharedCtx = null; sharedCtxTimeStamp = 0; @@ -1703,7 +1703,7 @@ class Renderer extends J3dThread { if (cv != null) { cv.makeCtxCurrent(sharedCtx); } - + if (isFreeDL) { for (it = displayListResourceFreeList.iterator(); it.hasNext();) { val = ((Integer) it.next()).intValue(); @@ -1740,7 +1740,7 @@ class Renderer extends J3dThread { textureIDResourceTable.set(val, null); } Canvas3D.freeTexture(sharedCtx, val); - } + } textureIdResourceFreeList.clear(); } if (cv != null) { @@ -1751,11 +1751,11 @@ class Renderer extends J3dThread { final void addTextureResource(int id, Object obj) { if (textureIDResourceTable.size() <= id) { - for (int i=textureIDResourceTable.size(); + for (int i=textureIDResourceTable.size(); i < id; i++) { textureIDResourceTable.add(null); } - textureIDResourceTable.add(obj); + textureIDResourceTable.add(obj); } else { textureIDResourceTable.set(id, obj); } @@ -1781,11 +1781,11 @@ class Renderer extends J3dThread { } } } - textureIDResourceTable.clear(); - + textureIDResourceTable.clear(); + // displayList is free in Canvas.freeContextResources() } - + /** * Send a message to the notification thread, which will call the * shader error listeners. diff --git a/src/classes/share/javax/media/j3d/RendererStructure.java b/src/classes/share/javax/media/j3d/RendererStructure.java index 5492fad..189d616 100644 --- a/src/classes/share/javax/media/j3d/RendererStructure.java +++ b/src/classes/share/javax/media/j3d/RendererStructure.java @@ -48,7 +48,7 @@ class RendererStructure extends J3dStructure{ } /** - * Returns all messages in the queue. + * Returns all messages in the queue. */ J3dMessage[] getMessages() { int sz; diff --git a/src/classes/share/javax/media/j3d/RenderingAttributes.java b/src/classes/share/javax/media/j3d/RenderingAttributes.java index ef3d186..437315c 100644 --- a/src/classes/share/javax/media/j3d/RenderingAttributes.java +++ b/src/classes/share/javax/media/j3d/RenderingAttributes.java @@ -53,17 +53,17 @@ package javax.media.j3d; * * <li>NOT_EQUAL - pixels are drawn if the incoming pixel depth is * not equal to the stored pixel depth in the frame buffer.</li><p> - * + * * <li>LESS - pixels are drawn if the incoming pixel depth is less * than the stored pixel depth in the frame buffer.</li><p> - * + * * <li>LESS_OR_EQUAL - pixels are drawn if the incoming pixel depth * is less than or equal to the stored pixel depth in the frame buffer. * This is the default setting.</li><p> - * + * * <li>GREATER - pixels are drawn if the incoming pixel depth is greater * than the stored pixel depth in the frame buffer.</li><p> - * + * * <li>GREATER_OR_EQUAL - pixels are drawn if the incoming pixel depth * is greater than or equal to the stored pixel depth in the frame buffer.</li><p> * </ul> @@ -87,16 +87,16 @@ package javax.media.j3d; * * <li>NOT_EQUAL - pixels are drawn if the incoming pixel alpha value is * not equal to the alpha test value.</li><p> - * + * * <li>LESS - pixels are drawn if the incoming pixel alpha value is less * than the alpha test value.</li><p> - * + * * <li>LESS_OR_EQUAL - pixels are drawn if the incoming pixel alpha value * is less than or equal to the alpha test value.</li><p> - * + * * <li>GREATER - pixels are drawn if the incoming pixel alpha value is greater * than the alpha test value.</li><p> - * + * * <li>GREATER_OR_EQUAL - pixels are drawn if the incoming pixel alpha * value is greater than or equal to the alpha test value.</li><p> * </ul> @@ -105,7 +105,7 @@ package javax.media.j3d; * This value is compared to the alpha value of each rendered pixel. * The alpha test value is set with the <code>setAlphaTestValue</code> * method. The default alpha test value is 0.0.</li><p> - * + * * <li>Raster operation - the raster operation function for this * RenderingAttributes component object. The raster operation is * set with the <code>setRasterOp</code> method. The raster operation @@ -131,26 +131,26 @@ package javax.media.j3d; * </ul> * <li>Vertex colors - vertex colors can be ignored for this * RenderingAttributes object. This capability is set with the - * <code>setIgnoreVertexColors</code> method. If - * ignoreVertexColors is false, per-vertex colors are used, when + * <code>setIgnoreVertexColors</code> method. If + * ignoreVertexColors is false, per-vertex colors are used, when * present in the associated geometry objects, taking * precedence over the ColoringAttributes color and the * specified Material color(s). If ignoreVertexColors is true, per-vertex - * colors are ignored. In this case, if lighting is enabled, the + * colors are ignored. In this case, if lighting is enabled, the * Material diffuse color will be used as the object color. * if lighting is disabled, the ColoringAttributes color is * used. The default value is false.</li><p> - * + * * <li>Visibility flag - when set, invisible objects are * not rendered (subject to the visibility policy for * the current view), but they can be picked or collided with. * This flag is set with the <code>setVisible</code> * method. By default, the visibility flag is true.</li><p> - * + * * <li>Depth buffer - can be enabled or disabled for this - * RenderingAttributes component object. The + * RenderingAttributes component object. The * <code>setDepthBufferEnable</code> method enables - * or disabled the depth buffer. The + * or disabled the depth buffer. The * <code>setDepthBufferWriteEnable</code> method enables or disables * writing the depth buffer for this object. During the transparent * rendering pass, this attribute can be overridden by the @@ -210,16 +210,16 @@ package javax.media.j3d; * * <li>NOT_EQUAL - pixels are drawn if the stencil reference value is * not equal to the stored stencil value in the frame buffer.</li><p> - * + * * <li>LESS - pixels are drawn if the stencil reference value is less * than the stored stencil value in the frame buffer.</li><p> - * + * * <li>LESS_OR_EQUAL - pixels are drawn if the stencil reference value * is less than or equal to the stored stencil value in the frame buffer.</li><p> - * + * * <li>GREATER - pixels are drawn if the stencil reference value is greater * than the stored stencil value in the frame buffer.</li><p> - * + * * <li>GREATER_OR_EQUAL - pixels are drawn if the stencil reference value * is greater than or equal to the stored stencil value in the frame buffer.</li><p> * </ul> @@ -424,7 +424,7 @@ public class RenderingAttributes extends NodeComponent { public static final int NOT_EQUAL = 3; /** - * Specifies that pixels are drawn if the source/reference value is less + * Specifies that pixels are drawn if the source/reference value is less * than the destination/test value. * Can be used to specify the alpha test function, the depth test function, * or the stencil function. @@ -436,7 +436,7 @@ public class RenderingAttributes extends NodeComponent { public static final int LESS = 4; /** - * Specifies that pixels are drawn if the source/reference value is less + * Specifies that pixels are drawn if the source/reference value is less * than or equal to the destination/test value. * Can be used to specify the alpha test function, the depth test function, * or the stencil function. @@ -448,7 +448,7 @@ public class RenderingAttributes extends NodeComponent { public static final int LESS_OR_EQUAL = 5; /** - * Specifies that pixels are drawn if the source/reference value is greater + * Specifies that pixels are drawn if the source/reference value is greater * than the destination/test value. * Can be used to specify the alpha test function, the depth test function, * or the stencil function. @@ -460,7 +460,7 @@ public class RenderingAttributes extends NodeComponent { public static final int GREATER = 6; /** - * Specifies that pixels are drawn if the source/reference value is greater + * Specifies that pixels are drawn if the source/reference value is greater * than or equal to the destination/test value. * Can be used to specify the alpha test function, the depth test function, * or the stencil function. @@ -515,7 +515,7 @@ public class RenderingAttributes extends NodeComponent { * @since Java 3D 1.4 */ public static final int ROP_AND_INVERTED = 0x4; - + /** * Raster operation: <code>DST = DST</code>. * @see #setRasterOp @@ -555,7 +555,7 @@ public class RenderingAttributes extends NodeComponent { * @since Java 3D 1.4 */ public static final int ROP_EQUIV = 0x9; - + /** * Raster operation: <code>DST = ~DST</code>. * @see #setRasterOp @@ -563,7 +563,7 @@ public class RenderingAttributes extends NodeComponent { * @since Java 3D 1.4 */ public static final int ROP_INVERT = 0xA; - + /** * Raster operation: <code>DST = src | ~DST</code>. * @see #setRasterOp @@ -663,7 +663,7 @@ public class RenderingAttributes extends NodeComponent { ALLOW_ALPHA_TEST_VALUE_READ, ALLOW_DEPTH_ENABLE_READ, ALLOW_DEPTH_TEST_FUNCTION_READ, - ALLOW_IGNORE_VERTEX_COLORS_READ, + ALLOW_IGNORE_VERTEX_COLORS_READ, ALLOW_RASTER_OP_READ, ALLOW_STENCIL_ATTRIBUTES_READ, ALLOW_VISIBLE_READ @@ -745,14 +745,14 @@ public class RenderingAttributes extends NodeComponent { int rasterOp) { // set default read capabilities setDefaultReadCapabilities(readCapabilities); - + ((RenderingAttributesRetained)this.retained).initDepthBufferEnable(depthBufferEnable); ((RenderingAttributesRetained)this.retained).initDepthBufferWriteEnable(depthBufferWriteEnable); ((RenderingAttributesRetained)this.retained).initAlphaTestValue(alphaTestValue); ((RenderingAttributesRetained)this.retained).initAlphaTestFunction(alphaTestFunction); ((RenderingAttributesRetained)this.retained).initVisible(visible); - + ((RenderingAttributesRetained)this.retained).initIgnoreVertexColors(ignoreVertexColors); ((RenderingAttributesRetained)this.retained).initRasterOpEnable(rasterOpEnable); ((RenderingAttributesRetained)this.retained).initRasterOp(rasterOp); @@ -764,7 +764,7 @@ public class RenderingAttributes extends NodeComponent { * * @param state true or false to enable or disable depth buffer mode * - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph * * @see GraphicsConfigTemplate3D#setDepthSize @@ -785,7 +785,7 @@ public class RenderingAttributes extends NodeComponent { * Retrieves the state of zBuffer Enable flag * @return true if depth buffer mode is enabled, false * if depth buffer mode is disabled - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ public boolean getDepthBufferEnable(){ @@ -802,7 +802,7 @@ public class RenderingAttributes extends NodeComponent { * this attribute can be overridden by * the depthBufferFreezeTransparent attribute in the View object. * @param state true or false to enable or disable depth buffer Write mode - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph * @see View#setDepthBufferFreezeTransparent */ @@ -820,7 +820,7 @@ public class RenderingAttributes extends NodeComponent { * Retrieves the state of Depth Buffer Write Enable flag. * @return true if depth buffer is writable, false * if depth buffer is read-only - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ public boolean getDepthBufferWriteEnable(){ @@ -835,7 +835,7 @@ public class RenderingAttributes extends NodeComponent { * Set alpha test value used by alpha test function. This value is * compared to the alpha value of each rendered pixel. * @param value the alpha test value - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ public void setAlphaTestValue(float value){ @@ -852,7 +852,7 @@ public class RenderingAttributes extends NodeComponent { /** * Retrieves the alpha test value. * @return the alpha test value. - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ public float getAlphaTestValue(){ @@ -871,7 +871,7 @@ public class RenderingAttributes extends NodeComponent { * @param function the new alpha test function. One of * ALWAYS, NEVER, EQUAL, NOT_EQUAL, LESS, LESS_OR_EQUAL, GREATER, * GREATER_OR_EQUAL - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ public void setAlphaTestFunction(int function){ @@ -889,7 +889,7 @@ public class RenderingAttributes extends NodeComponent { /** * Retrieves current alpha test function. * @return the current alpha test function - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ public int getAlphaTestFunction(){ @@ -906,7 +906,7 @@ public class RenderingAttributes extends NodeComponent { * the visibility policy for the current view), but they can be picked * or collided with. The default value is true. * @param visible true or false to enable or disable visibility - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph * * @see View#setVisibilityPolicy @@ -917,7 +917,7 @@ public class RenderingAttributes extends NodeComponent { if (isLiveOrCompiled()) if (!this.getCapability(ALLOW_VISIBLE_WRITE)) throw new CapabilityNotSetException(J3dI18N.getString("RenderingAttributes8")); - + if (isLive()) ((RenderingAttributesRetained)this.retained).setVisible(visible); else @@ -928,7 +928,7 @@ public class RenderingAttributes extends NodeComponent { * Retrieves the visibility flag for this RenderingAttributes object. * @return true if the object is visible; false * if the object is invisible. - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph * * @since Java 3D 1.2 @@ -937,7 +937,7 @@ public class RenderingAttributes extends NodeComponent { if (isLiveOrCompiled()) if (!this.getCapability(ALLOW_VISIBLE_READ)) throw new CapabilityNotSetException(J3dI18N.getString("RenderingAttributes9")); - + return ((RenderingAttributesRetained)this.retained).getVisible(); } @@ -955,7 +955,7 @@ public class RenderingAttributes extends NodeComponent { * * @param ignoreVertexColors true or false to enable or disable * the ignoring of per-vertex colors - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph * * @see ColoringAttributes @@ -980,7 +980,7 @@ public class RenderingAttributes extends NodeComponent { * RenderingAttributes object. * @return true if per-vertex colors are ignored; false * if per-vertex colors are used. - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph * * @since Java 3D 1.2 @@ -1006,7 +1006,7 @@ public class RenderingAttributes extends NodeComponent { * * @param rasterOpEnable true or false to enable or disable * raster operations - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph * * @see #setRasterOp @@ -1029,7 +1029,7 @@ public class RenderingAttributes extends NodeComponent { * object. * @return true if raster operations are enabled; false * if raster operations are disabled. - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph * * @since Java 3D 1.2 @@ -1051,7 +1051,7 @@ public class RenderingAttributes extends NodeComponent { * ROP_CLEAR, ROP_AND, ROP_AND_REVERSE, ROP_COPY, ROP_AND_INVERTED, * ROP_NOOP, ROP_XOR, ROP_OR, ROP_NOR, ROP_EQUIV, ROP_INVERT, * ROP_OR_REVERSE, ROP_COPY_INVERTED, ROP_OR_INVERTED, ROP_NAND or ROP_SET. - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph * * @since Java 3D 1.2 @@ -1074,7 +1074,7 @@ public class RenderingAttributes extends NodeComponent { * ROP_CLEAR, ROP_AND, ROP_AND_REVERSE, ROP_COPY, ROP_AND_INVERTED, * ROP_NOOP, ROP_XOR, ROP_OR, ROP_NOR, ROP_EQUIV, ROP_INVERT, * ROP_OR_REVERSE, ROP_COPY_INVERTED, ROP_OR_INVERTED, ROP_NAND or ROP_SET - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph * * @since Java 3D 1.2 @@ -1098,7 +1098,7 @@ public class RenderingAttributes extends NodeComponent { /** - * @deprecated replaced with cloneNodeComponent(boolean forceDuplicate) + * @deprecated replaced with cloneNodeComponent(boolean forceDuplicate) */ public NodeComponent cloneNodeComponent() { RenderingAttributes ra = new RenderingAttributes(); @@ -1112,7 +1112,7 @@ public class RenderingAttributes extends NodeComponent { * the current node. This method is called from the * <code>duplicateNode</code> method. This routine does * the actual duplication of all "local data" (any data defined in - * this object). + * this object). * * @param originalNodeComponent the original node to duplicate. * @param forceDuplicate when set to <code>true</code>, causes the @@ -1124,12 +1124,12 @@ public class RenderingAttributes extends NodeComponent { * @see Node#cloneTree * @see NodeComponent#setDuplicateOnCloneTree */ - void duplicateAttributes(NodeComponent originalNodeComponent, - boolean forceDuplicate) { + void duplicateAttributes(NodeComponent originalNodeComponent, + boolean forceDuplicate) { super.duplicateAttributes(originalNodeComponent, forceDuplicate); - RenderingAttributesRetained attr = + RenderingAttributesRetained attr = (RenderingAttributesRetained) originalNodeComponent.retained; RenderingAttributesRetained rt = (RenderingAttributesRetained) retained; @@ -1163,7 +1163,7 @@ public class RenderingAttributes extends NodeComponent { * ALWAYS, NEVER, EQUAL, NOT_EQUAL, LESS, LESS_OR_EQUAL, GREATER, * or GREATER_OR_EQUAL. * The default value is LESS_OR_EQUAL. - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph * * @since Java 3D 1.4 @@ -1182,7 +1182,7 @@ public class RenderingAttributes extends NodeComponent { /** * Retrieves current depth test function. * @return the current depth test function - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph * * @since Java 3D 1.4 @@ -1207,7 +1207,7 @@ public class RenderingAttributes extends NodeComponent { * If this is set to false, the stencilOp and stencilFunction parameters * are not used. * - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph * * @see GraphicsConfigTemplate3D#setStencilSize @@ -1235,7 +1235,7 @@ public class RenderingAttributes extends NodeComponent { * @return true if stencil buffer operations are enabled; false * if stencil buffer operations are disabled. * - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph * * @since Java 3D 1.4 @@ -1268,7 +1268,7 @@ public class RenderingAttributes extends NodeComponent { * STENCIL_KEEP, STENCIL_ZERO, STENCIL_REPLACE, STENCIL_INCR, STENCIL_DECR, * or STENCIL_INVERT. * - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph * * @since Java 3D 1.4 @@ -1281,12 +1281,12 @@ public class RenderingAttributes extends NodeComponent { } if (isLive()) - ((RenderingAttributesRetained)this.retained).setStencilOp(failOp, - zFailOp, + ((RenderingAttributesRetained)this.retained).setStencilOp(failOp, + zFailOp, zPassOp); else - ((RenderingAttributesRetained)this.retained).initStencilOp(failOp, - zFailOp, + ((RenderingAttributesRetained)this.retained).initStencilOp(failOp, + zFailOp, zPassOp); } @@ -1301,7 +1301,7 @@ public class RenderingAttributes extends NodeComponent { * <code>zFailOp</code> parameter, and element 2 specifies the * <code>zPassOp</code> parameter. * - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph * * @see #setStencilOp(int,int,int) @@ -1316,11 +1316,11 @@ public class RenderingAttributes extends NodeComponent { } if (isLive()) - ((RenderingAttributesRetained)this.retained).setStencilOp(stencilOps[0], + ((RenderingAttributesRetained)this.retained).setStencilOp(stencilOps[0], stencilOps[1], stencilOps[2]); else - ((RenderingAttributesRetained)this.retained).initStencilOp(stencilOps[0], + ((RenderingAttributesRetained)this.retained).initStencilOp(stencilOps[0], stencilOps[1], stencilOps[2]); } @@ -1336,7 +1336,7 @@ public class RenderingAttributes extends NodeComponent { * into element 1, and the <code>zPassOp</code> parameter is copied * into element 2. * - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph * * @since Java 3D 1.4 @@ -1347,7 +1347,7 @@ public class RenderingAttributes extends NodeComponent { throw new CapabilityNotSetException(J3dI18N.getString("RenderingAttributes17")); } } - + ((RenderingAttributesRetained)this.retained).getStencilOp(stencilOps); } @@ -1382,11 +1382,11 @@ public class RenderingAttributes extends NodeComponent { } } if (isLive()) - ((RenderingAttributesRetained)this.retained).setStencilFunction(function, + ((RenderingAttributesRetained)this.retained).setStencilFunction(function, refValue, compareMask); else - ((RenderingAttributesRetained)this.retained).initStencilFunction(function, + ((RenderingAttributesRetained)this.retained).initStencilFunction(function, refValue, compareMask); } @@ -1402,7 +1402,7 @@ public class RenderingAttributes extends NodeComponent { * reference value, and element 2 specifies the * comparison mask. * - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph * * @see #setStencilFunction(int,int,int) @@ -1417,11 +1417,11 @@ public class RenderingAttributes extends NodeComponent { } if (isLive()) - ((RenderingAttributesRetained)this.retained).setStencilFunction(params[0], + ((RenderingAttributesRetained)this.retained).setStencilFunction(params[0], params[1], params[2]); else - ((RenderingAttributesRetained)this.retained).initStencilFunction(params[0], + ((RenderingAttributesRetained)this.retained).initStencilFunction(params[0], params[1], params[2]); @@ -1438,7 +1438,7 @@ public class RenderingAttributes extends NodeComponent { * into element 1, and the comparison mask is copied * into element 2. * - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph * * @since Java 3D 1.4 @@ -1461,7 +1461,7 @@ public class RenderingAttributes extends NodeComponent { * * @param mask the new stencil write mask. * - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph * * @since Java 3D 1.4 @@ -1485,7 +1485,7 @@ public class RenderingAttributes extends NodeComponent { * * @return the stencil write mask. * - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph * * @since Java 3D 1.4 diff --git a/src/classes/share/javax/media/j3d/RenderingAttributesRetained.java b/src/classes/share/javax/media/j3d/RenderingAttributesRetained.java index 968a2d1..ac46850 100644 --- a/src/classes/share/javax/media/j3d/RenderingAttributesRetained.java +++ b/src/classes/share/javax/media/j3d/RenderingAttributesRetained.java @@ -70,9 +70,9 @@ class RenderingAttributesRetained extends NodeComponentRetained { boolean depthBufferEnable = true; boolean depthBufferWriteEnable = true; - + float alphaTestValue = 0.0f; - + int alphaTestFunction = RenderingAttributes.ALWAYS; int depthTestFunction = RenderingAttributes.LESS_OR_EQUAL; @@ -101,9 +101,9 @@ class RenderingAttributesRetained extends NodeComponentRetained { static final int LEQUAL = 1; /** - * Sets the visibility flag for this RenderingAttributes component object. + * Sets the visibility flag for this RenderingAttributes component object. * @param visible true or false to enable or disable visibility - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph * * @see View#setVisibilityPolicy @@ -111,19 +111,19 @@ class RenderingAttributesRetained extends NodeComponentRetained { final void initVisible(boolean state){ visible = state; } - + /** * Sets the visibility flag for this RenderingAttributes * component object. Invisible objects are not rendered (subject to * the visibility policy for the current view), but they can be picked * or collided with. * @param visible true or false to enable or disable visibility - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph * * @see View#setVisibilityPolicy */ - final void setVisible(boolean state){ + final void setVisible(boolean state){ // Optimize : If new state equal to current state, should I simply return ? // Is it safe ? initVisible(state); @@ -136,19 +136,19 @@ class RenderingAttributesRetained extends NodeComponentRetained { sendMessage(VISIBLE, (state ? Boolean.TRUE: Boolean.FALSE)); } - + /** * Retrieves the visibility flag for this RenderingAttributes object. * @return true if the object is visible; false * if the object is invisible. - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ final boolean getVisible() { return visible; } - + /** * Enables or disables vertex colors for this RenderAttributes * component object. @@ -160,7 +160,7 @@ class RenderingAttributesRetained extends NodeComponentRetained { /** * Enables or disables vertex colors for this RenderAttributes - * component object and sends a + * component object and sends a * message notifying the interested structures of the change. * @param state true or false to enable or disable depth vertex colors */ @@ -190,7 +190,7 @@ class RenderingAttributesRetained extends NodeComponentRetained { /** * Enables or disables depth buffer mode for this RenderAttributes - * component object and sends a + * component object and sends a * message notifying the interested structures of the change. * @param state true or false to enable or disable depth buffer mode */ @@ -253,7 +253,7 @@ class RenderingAttributesRetained extends NodeComponentRetained { alphaTestValue = value; } /** - * Set alpha test value used by alpha test function and sends a + * Set alpha test value used by alpha test function and sends a * message notifying the interested structures of the change. * This value is compared to the alpha value of each rendered pixel. * @param value the alpha value @@ -288,7 +288,7 @@ class RenderingAttributesRetained extends NodeComponentRetained { /** - * Set alpha test function and sends a + * Set alpha test function and sends a * message notifying the interested structures of the change. * This function is used to compare the * alpha test value with each per-pixel alpha value. If the test @@ -299,7 +299,7 @@ class RenderingAttributesRetained extends NodeComponentRetained { * GREATER_OR_EQUAL. */ final void setAlphaTestFunction(int function){ - + initAlphaTestFunction(function); sendMessage(ALPHA_TEST_FUNC, new Integer(function)); } @@ -344,7 +344,7 @@ class RenderingAttributesRetained extends NodeComponentRetained { /** * Retrieves current depth test function. * @return the current depth test function - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ final int getDepthTestFunction(){ @@ -396,7 +396,7 @@ class RenderingAttributesRetained extends NodeComponentRetained { } - // Stencil operations + // Stencil operations /** * Initialize the stencil enable state */ @@ -433,7 +433,7 @@ class RenderingAttributesRetained extends NodeComponentRetained { */ final void setStencilOp(int failOp, int zFailOp, int zPassOp) { initStencilOp(failOp, zFailOp, zPassOp); - + ArrayList arrList = new ArrayList(3); arrList.add(new Integer(failOp)); arrList.add(new Integer(zFailOp)); @@ -465,7 +465,7 @@ class RenderingAttributesRetained extends NodeComponentRetained { */ final void setStencilFunction(int function, int refValue, int compareMask) { initStencilOp(function, refValue, compareMask); - + ArrayList arrList = new ArrayList(3); arrList.add(new Integer(function)); arrList.add(new Integer(refValue)); @@ -494,7 +494,7 @@ class RenderingAttributesRetained extends NodeComponentRetained { * Set the stencil write mask */ final void setStencilWriteMask(int mask) { - initStencilWriteMask(mask); + initStencilWriteMask(mask); sendMessage(STENCIL_WRITE_MASK, new Integer(mask)); } @@ -505,7 +505,7 @@ class RenderingAttributesRetained extends NodeComponentRetained { return stencilWriteMask; } - + /** * Updates the native context. */ @@ -516,11 +516,11 @@ class RenderingAttributesRetained extends NodeComponentRetained { void updateNative(Canvas3D c3d, boolean depthBufferWriteEnableOverride, boolean depthBufferEnableOverride) { - Pipeline.getPipeline().updateRenderingAttributes(c3d.ctx, + Pipeline.getPipeline().updateRenderingAttributes(c3d.ctx, depthBufferWriteEnableOverride, depthBufferEnableOverride, depthBufferEnable, depthBufferWriteEnable, depthTestFunction, alphaTestValue, alphaTestFunction, ignoreVertexColors, - rasterOpEnable, rasterOp, c3d.userStencilAvailable, stencilEnable, + rasterOpEnable, rasterOp, c3d.userStencilAvailable, stencilEnable, stencilFailOp, stencilZFailOp, stencilZPassOp, stencilFunction, stencilReferenceValue, stencilCompareMask, stencilWriteMask ); @@ -538,14 +538,14 @@ class RenderingAttributesRetained extends NodeComponentRetained { mirror = this; } else { - RenderingAttributesRetained mirrorRa + RenderingAttributesRetained mirrorRa = new RenderingAttributesRetained(); mirrorRa.set(this); mirrorRa.source = source; mirror = mirrorRa; } } else { - ((RenderingAttributesRetained) mirror).set(this); + ((RenderingAttributesRetained) mirror).set(this); } } @@ -558,11 +558,11 @@ class RenderingAttributesRetained extends NodeComponentRetained { } /** - * Update the "component" field of the mirror object with the + * Update the "component" field of the mirror object with the * given "value" */ synchronized void updateMirrorObject(int component, Object value) { - RenderingAttributesRetained mirrorRa = (RenderingAttributesRetained)mirror; + RenderingAttributesRetained mirrorRa = (RenderingAttributesRetained)mirror; if ((component & DEPTH_ENABLE) != 0) { mirrorRa.depthBufferEnable = ((Boolean)value).booleanValue(); @@ -584,10 +584,10 @@ class RenderingAttributesRetained extends NodeComponentRetained { } else if ((component & IGNORE_VCOLOR) != 0) { mirrorRa.ignoreVertexColors = (((Boolean)value).booleanValue()); - } + } else if ((component & RASTER_OP_ENABLE) != 0) { mirrorRa.rasterOpEnable = (((Boolean)value).booleanValue()); - } + } else if ((component & RASTER_OP_VALUE) != 0) { mirrorRa.rasterOp = (((Integer)value).intValue()); } @@ -615,7 +615,7 @@ class RenderingAttributesRetained extends NodeComponentRetained { return (this == rr) || ((rr != null) && (rr.depthBufferEnable == depthBufferEnable) && - (rr.depthBufferWriteEnable == depthBufferWriteEnable) && + (rr.depthBufferWriteEnable == depthBufferWriteEnable) && (rr.alphaTestValue == alphaTestValue) && (rr.alphaTestFunction == alphaTestFunction) && (rr.visible == visible) && @@ -654,11 +654,11 @@ class RenderingAttributesRetained extends NodeComponentRetained { stencilWriteMask = ra.stencilWriteMask; } - + final void sendMessage(int attrMask, Object attr) { ArrayList univList = new ArrayList(); - ArrayList gaList = Shape3DRetained.getGeomAtomsList(mirror.users, univList); + ArrayList gaList = Shape3DRetained.getGeomAtomsList(mirror.users, univList); // Send to rendering attribute structure, regardless of // whether there are users or not (alternate appearance case ..) @@ -680,7 +680,7 @@ class RenderingAttributesRetained extends NodeComponentRetained { if (attrMask == VISIBLE) createMessage.threads |= J3dThread.UPDATE_GEOMETRY; createMessage.type = J3dMessage.RENDERINGATTRIBUTES_CHANGED; - + createMessage.universe = (VirtualUniverse) univList.get(i); createMessage.args[0] = this; createMessage.args[1]= new Integer(attrMask); @@ -689,8 +689,8 @@ class RenderingAttributesRetained extends NodeComponentRetained { ArrayList gL = (ArrayList)gaList.get(i); GeometryAtom[] gaArr = new GeometryAtom[gL.size()]; gL.toArray(gaArr); - createMessage.args[3] = gaArr; - + createMessage.args[3] = gaArr; + VirtualUniverse.mc.processMessage(createMessage); } @@ -699,7 +699,7 @@ class RenderingAttributesRetained extends NodeComponentRetained { // TODO : Need to handle stencil operation -- Chien void handleFrequencyChange(int bit) { int mask = 0; - + if (bit == RenderingAttributes.ALLOW_ALPHA_TEST_VALUE_WRITE) mask = ALPHA_TEST_VALUE; if( bit == RenderingAttributes.ALLOW_ALPHA_TEST_FUNCTION_WRITE) @@ -719,12 +719,12 @@ class RenderingAttributesRetained extends NodeComponentRetained { mask = DEPTH_TEST_FUNC; if( bit == RenderingAttributes.ALLOW_DEPTH_TEST_FUNCTION_WRITE) - mask = STENCIL_ENABLE | STENCIL_OP_VALUES | STENCIL_FUNC | + mask = STENCIL_ENABLE | STENCIL_OP_VALUES | STENCIL_FUNC | STENCIL_WRITE_MASK; if (mask != 0) setFrequencyChangeMask(bit, mask); // System.err.println("changedFreqent2 = "+changedFrequent); } - + } diff --git a/src/classes/share/javax/media/j3d/RenderingAttributesStructure.java b/src/classes/share/javax/media/j3d/RenderingAttributesStructure.java index 118dde7..603edb2 100644 --- a/src/classes/share/javax/media/j3d/RenderingAttributesStructure.java +++ b/src/classes/share/javax/media/j3d/RenderingAttributesStructure.java @@ -35,7 +35,7 @@ import java.util.ArrayList; import java.util.Arrays; /** - * A rendering attributes structure is an object that handles + * A rendering attributes structure is an object that handles * NodeComponent object updates. */ @@ -50,7 +50,7 @@ class RenderingAttributesStructure extends J3dStructure implements ObjectUpdate void processMessages(long referenceTime) { J3dMessage m; boolean addMirrorObj = false; - + J3dMessage messages[] = getMessages(referenceTime); int nMsg = getNumMessage(); @@ -90,7 +90,7 @@ class RenderingAttributesStructure extends J3dStructure implements ObjectUpdate case J3dMessage.TRANSPARENCYATTRIBUTES_CHANGED: case J3dMessage.MATERIAL_CHANGED: case J3dMessage.TEXCOORDGENERATION_CHANGED: - case J3dMessage.SHADER_ATTRIBUTE_CHANGED: + case J3dMessage.SHADER_ATTRIBUTE_CHANGED: case J3dMessage.SHADER_ATTRIBUTE_SET_CHANGED: { // System.err.println("2 RAS : J3dMessage type : " + m.type); @@ -123,7 +123,7 @@ class RenderingAttributesStructure extends J3dStructure implements ObjectUpdate m.decRefcount(); } } - break; + break; case J3dMessage.TEXTUREATTRIBUTES_CHANGED: { @@ -141,11 +141,11 @@ class RenderingAttributesStructure extends J3dStructure implements ObjectUpdate } } break; - case J3dMessage.TEXTURE_CHANGED: + case J3dMessage.TEXTURE_CHANGED: { NodeComponentRetained nc = (NodeComponentRetained)m.args[0]; nc.mirror.changedFrequent = ((Integer)m.args[3]).intValue(); - + objList.add(m); nc.mirror.compChanged = 1; addMirrorObj = true; @@ -165,7 +165,7 @@ class RenderingAttributesStructure extends J3dStructure implements ObjectUpdate else { val = ((Integer)m.args[3]).intValue(); geo.cachedChangedFrequent = val; - m.decRefcount(); + m.decRefcount(); } break; case J3dMessage.MORPH_CHANGED: @@ -178,12 +178,12 @@ class RenderingAttributesStructure extends J3dStructure implements ObjectUpdate } if (addMirrorObj) { VirtualUniverse.mc.addMirrorObject(this); - } + } // clear array to prevent memory leaks Arrays.fill(messages, 0, nMsg, null); } - + public void updateObject() { int size = objList.size(); @@ -229,7 +229,7 @@ class RenderingAttributesStructure extends J3dStructure implements ObjectUpdate private void updateNodeComponent(Object[] args) { - // System.err.println("RAS : updateNodeComponent : " + this); + // System.err.println("RAS : updateNodeComponent : " + this); NodeComponentRetained n = (NodeComponentRetained)args[0]; n.updateMirrorObject(((Integer)args[1]).intValue(), args[2]); } @@ -246,4 +246,4 @@ class RenderingAttributesStructure extends J3dStructure implements ObjectUpdate } - + diff --git a/src/classes/share/javax/media/j3d/RenderingEnvironmentStructure.java b/src/classes/share/javax/media/j3d/RenderingEnvironmentStructure.java index b53aa36..f0b378c 100644 --- a/src/classes/share/javax/media/j3d/RenderingEnvironmentStructure.java +++ b/src/classes/share/javax/media/j3d/RenderingEnvironmentStructure.java @@ -161,16 +161,16 @@ class RenderingEnvironmentStructure extends J3dStructure implements ObjectUpdate } return objs; } - + void addObjArrayToFreeList(Object[] objs) { int i; for (i = 0; i < objs.length; i++) objs[i] = null; - + objFreeList.add(objs); } - + public void updateObject() { @@ -275,14 +275,14 @@ class RenderingEnvironmentStructure extends J3dStructure implements ObjectUpdate } m.decRefcount(); } - + if (transformMsg) { updateTransformChange(); transformMsg = false; } - + VirtualUniverse.mc.addMirrorObject(this); - + Arrays.fill(messages, 0, nMsg, null); } @@ -297,7 +297,7 @@ class RenderingEnvironmentStructure extends J3dStructure implements ObjectUpdate for (int n = 0; n < ogList.length; n++) { og = (OrderedGroupRetained)ogList[n]; og.updateChildIdTableInserted(((Integer) ogChildIdList[n]).intValue(), - ((Integer) ogOrderedIdList[n]).intValue()); + ((Integer) ogOrderedIdList[n]).intValue()); og.incrChildCount(); } } @@ -308,7 +308,7 @@ class RenderingEnvironmentStructure extends J3dStructure implements ObjectUpdate OrderedGroupRetained og; int index; Object[] objs; - + for (int n = 0; n < ogList.length; n++) { og = (OrderedGroupRetained)ogList[n]; og.updateChildIdTableRemoved(((Integer) ogChildIdList[n]).intValue()); @@ -373,7 +373,7 @@ class RenderingEnvironmentStructure extends J3dStructure implements ObjectUpdate LightRetained lt; FogRetained fg; ModelClipRetained mc; - ArrayList list; + ArrayList list; for (i=0; i<nodes.length; i++) { n = nodes[i]; @@ -399,14 +399,14 @@ class RenderingEnvironmentStructure extends J3dStructure implements ObjectUpdate nonViewScopedFogs.add(fg); } - + } else if (n instanceof AlternateAppearanceRetained) { AlternateAppearanceRetained altApp = (AlternateAppearanceRetained)n; - + numberOfAltApps++; nonViewScopedAltAppearances.add(n); - + } else if (n instanceof BackgroundRetained) { BackgroundRetained bg = (BackgroundRetained)n; numberOfBgs++; @@ -425,7 +425,7 @@ class RenderingEnvironmentStructure extends J3dStructure implements ObjectUpdate nonViewScopedModelClips.add(n); - } + } } @@ -485,7 +485,7 @@ class RenderingEnvironmentStructure extends J3dStructure implements ObjectUpdate viewScopedBackgrounds.put(view, list); } list.add(n); - } + } } else if (n instanceof ClipRetained) { ((ClipRetained)n).isViewScoped = true; numberOfClips++; @@ -520,9 +520,9 @@ class RenderingEnvironmentStructure extends J3dStructure implements ObjectUpdate intersectedFogs = new FogRetained[numberOfFogs]; if (intersectedAltApps.length < numberOfAltApps) intersectedAltApps = new AlternateAppearanceRetained[numberOfAltApps]; - if (intersectedBacks.length < numberOfBgs) + if (intersectedBacks.length < numberOfBgs) intersectedBacks = new BackgroundRetained[numberOfBgs]; - if (intersectedClips.length < numberOfClips) + if (intersectedClips.length < numberOfClips) intersectedClips = new ClipRetained[numberOfClips]; if (intersectedModelClips.length < numberOfModelClips) intersectedModelClips = new ModelClipRetained[numberOfModelClips]; @@ -550,7 +550,7 @@ class RenderingEnvironmentStructure extends J3dStructure implements ObjectUpdate else { nonViewScopedLights.remove(nonViewScopedLights.indexOf(n)); } - + numberOfLights--; } else if (n instanceof FogRetained) { numberOfFogs--; @@ -573,7 +573,7 @@ class RenderingEnvironmentStructure extends J3dStructure implements ObjectUpdate ModelClipRetained mc = (ModelClipRetained)n; numberOfModelClips--; nonViewScopedModelClips.remove(nonViewScopedModelClips.indexOf(n)); - + } else if (n instanceof GeometryAtom) { ga = (GeometryAtom)n; @@ -644,7 +644,7 @@ class RenderingEnvironmentStructure extends J3dStructure implements ObjectUpdate if (list.size() == 0) { viewScopedBackgrounds.remove(view); } - } + } } else if (n instanceof ClipRetained) { ((ClipRetained)n).isViewScoped = false; numberOfClips--; @@ -740,12 +740,12 @@ class RenderingEnvironmentStructure extends J3dStructure implements ObjectUpdate // System.err.println("light.region = "+light.region); // System.err.println("Intersected = "+bounds.intersect(light.region)); // System.err.println(""); - + // if ((light.viewList != null && light.viewList.contains(view)) && // Treat lights in background geo as having infinite bounds if (light.lightOn && light.switchState.currentSwitchOn && (ra.geometryAtom.source.inBackgroundGroup || bounds.intersect(light.region))){ - // Get the mirror Shape3D node + // Get the mirror Shape3D node n = ((Shape3DRetained)ra.geometryAtom.source).numlights; shapeScopedLt = ((Shape3DRetained)ra.geometryAtom.source).lights; @@ -755,7 +755,7 @@ class RenderingEnvironmentStructure extends J3dStructure implements ObjectUpdate // while accessing them?. So, Lock. if (light.isScoped) { for (j = 0; j < n; j++) { - // then check if the light is scoped to + // then check if the light is scoped to // this group if (light == shapeScopedLt[j]) { retlights[numLights++] = light; @@ -781,7 +781,7 @@ class RenderingEnvironmentStructure extends J3dStructure implements ObjectUpdate // Need to lock lockObj, since on a multi-processor // system with 2 views on a single universe, there might - // be councurrent access + // be councurrent access synchronized(lockObj) { nfogs = 0; Bounds bounds = ra.localeVwcBounds; @@ -795,14 +795,14 @@ class RenderingEnvironmentStructure extends J3dStructure implements ObjectUpdate // If background, then nfogs > 1, take the first one if (nfogs >= 1) fog = intersectedFogs[0]; - + } else { if ((globalFogs = (ArrayList)viewScopedFogs.get(view)) != null) { nfogs = processFogs(globalFogs, ra, nfogs); } // now process the common fogs nfogs = processFogs(nonViewScopedFogs, ra, nfogs); - + if (nfogs == 1) fog = intersectedFogs[0]; @@ -840,9 +840,9 @@ class RenderingEnvironmentStructure extends J3dStructure implements ObjectUpdate if (fog.isScoped) { for (k = 0; k < n; k++) { - // then check if the Fog is scoped to + // then check if the Fog is scoped to // this group - if (fog == shapeScopedFog[k]) { + if (fog == shapeScopedFog[k]) { intersectedBounds[numFogs] = fog.region; intersectedFogs[numFogs++] = fog; break; @@ -866,13 +866,13 @@ class RenderingEnvironmentStructure extends J3dStructure implements ObjectUpdate ArrayList globalModelClips; - + if (ra.geometryAtom.source.inBackgroundGroup) { return null; } // Need to lock lockObj, since on a multi-processor // system with 2 views on a single universe, there might - // be councurrent access + // be councurrent access synchronized(lockObj) { Bounds bounds = ra.localeVwcBounds; nModelClips = 0; @@ -901,7 +901,7 @@ class RenderingEnvironmentStructure extends J3dStructure implements ObjectUpdate break; } } - } + } return (modelClip); } @@ -913,11 +913,11 @@ class RenderingEnvironmentStructure extends J3dStructure implements ObjectUpdate ModelClipRetained modelClip; Bounds bounds = ra.localeVwcBounds; ModelClipRetained[] shapeScopedModelClip; - + if (size > 0) { for (i = 0; i < size; i++) { modelClip = (ModelClipRetained) globalModelClips.get(i); - if (modelClip.enableFlag == true && + if (modelClip.enableFlag == true && modelClip.region != null && modelClip.switchState.currentSwitchOn) { if (modelClip.region.intersect(bounds) == true) { n = ((Shape3DRetained)ra.geometryAtom.source).numModelClips; @@ -925,7 +925,7 @@ class RenderingEnvironmentStructure extends J3dStructure implements ObjectUpdate if (modelClip.isScoped) { for (k = 0; k < n; k++) { - // then check if the modelClip is scoped to + // then check if the modelClip is scoped to // this group if (shapeScopedModelClip[k] == modelClip) { @@ -945,7 +945,7 @@ class RenderingEnvironmentStructure extends J3dStructure implements ObjectUpdate } return nModelClips; } - + BackgroundRetained getApplicationBackground(BoundingSphere bounds, Locale viewLocale, View view) { BackgroundRetained bg = null; Bounds closestBounds; @@ -958,7 +958,7 @@ class RenderingEnvironmentStructure extends J3dStructure implements ObjectUpdate // Need to lock lockObj, since on a multi-processor // system with 2 views on a single universe, there might - // be councurrent access + // be councurrent access synchronized(lockObj) { nbacks = 0; if (intersectedBounds.length < numberOfBgs) @@ -975,7 +975,7 @@ class RenderingEnvironmentStructure extends J3dStructure implements ObjectUpdate if (nbacks == 1) { bg = intersectedBacks[0]; } else if (nbacks > 1) { - closestBounds = + closestBounds = bounds.closestIntersection(intersectedBounds); for (j=0; j<nbacks; j++) { if (intersectedBounds[j] == closestBounds) { @@ -1021,7 +1021,7 @@ class RenderingEnvironmentStructure extends J3dStructure implements ObjectUpdate } return nbacks; } - + double[] backClipDistanceInVworld (BoundingSphere bounds, View view) { int i,j; int nclips; @@ -1034,7 +1034,7 @@ class RenderingEnvironmentStructure extends J3dStructure implements ObjectUpdate // Need to lock intersectedBounds, since on a multi-processor // system with 2 views on a single universe, there might - // be councurrent access + // be councurrent access synchronized(lockObj) { backClipDistance = null; backClipActive = false; @@ -1048,9 +1048,9 @@ class RenderingEnvironmentStructure extends J3dStructure implements ObjectUpdate } nclips = processClips(nonViewScopedClips, bounds, nclips); - - + + if (nclips == 1) { distance = intersectedClips[0].backDistanceInVworld; backClipActive = true; @@ -1062,7 +1062,7 @@ class RenderingEnvironmentStructure extends J3dStructure implements ObjectUpdate distance = intersectedClips[j].backDistanceInVworld; backClipActive = true; break; - } + } } } if (backClipActive) { @@ -1077,7 +1077,7 @@ class RenderingEnvironmentStructure extends J3dStructure implements ObjectUpdate int i; int size = globalClips.size(); ClipRetained clip; - + for (i=0 ; i<size; i++) { clip = (ClipRetained)globalClips.get(i); if (clip.transformedRegion != null && @@ -1090,7 +1090,7 @@ class RenderingEnvironmentStructure extends J3dStructure implements ObjectUpdate return nclips; } - + void updateLight(Object[] args) { Object[] objs; LightRetained light = (LightRetained)args[0]; @@ -1152,7 +1152,7 @@ class RenderingEnvironmentStructure extends J3dStructure implements ObjectUpdate objs[2] = args[2]; objs[3] = args[3]; objs[4] = args[4]; - objList.add(objs); + objList.add(objs); } else if ((component & FogRetained.CLEAR_MIRROR) != 0) { fog.clearMirrorObject(args); @@ -1219,14 +1219,14 @@ class RenderingEnvironmentStructure extends J3dStructure implements ObjectUpdate objs[2] = args[2]; objs[3] = args[3]; objs[4] = args[4]; - objList.add(objs); + objList.add(objs); } else { modelClip.updateImmediateMirrorObject(args); } } - + void updateBoundingLeaf(Object[] args) { BoundingLeafRetained bl = (BoundingLeafRetained)args[0]; Object[] users = (Object[])(args[3]); @@ -1246,7 +1246,7 @@ class RenderingEnvironmentStructure extends J3dStructure implements ObjectUpdate void updateOrientedShape3D(Object[] args) { OrientedShape3DRetained shape = (OrientedShape3DRetained)args[4]; shape.updateImmediateMirrorObject(args); - } + } void updateMorph(Object[] args) { MorphRetained morph = (MorphRetained)args[0]; @@ -1256,7 +1256,7 @@ class RenderingEnvironmentStructure extends J3dStructure implements ObjectUpdate void updateTransformChange() { int i,j; - Object[] nodes, nodesArr; + Object[] nodes, nodesArr; BoundingLeafRetained bl; LightRetained ml; UnorderList arrList; @@ -1286,7 +1286,7 @@ class RenderingEnvironmentStructure extends J3dStructure implements ObjectUpdate xformChangeList.add(nodes[i]); } else if (nodes[i] instanceof AlternateAppearanceRetained){ - AlternateAppearanceRetained mAltApp = + AlternateAppearanceRetained mAltApp = (AlternateAppearanceRetained) nodes[i]; mAltApp.updateImmediateTransformChange(); xformChangeList.add(nodes[i]); @@ -1348,10 +1348,10 @@ class RenderingEnvironmentStructure extends J3dStructure implements ObjectUpdate retVal[0] = Boolean.FALSE; return retVal; } - + // Need to lock lockObj, since on a multi-processor // system with 2 views on a single universe, there might - // be councurrent access + // be councurrent access synchronized(lockObj) { nAltApp = 0; bounds = ra.localeVwcBounds; @@ -1376,7 +1376,7 @@ class RenderingEnvironmentStructure extends J3dStructure implements ObjectUpdate break; } } - } + } if (altApp == null) { retVal[0] = Boolean.FALSE; return retVal; @@ -1409,7 +1409,7 @@ class RenderingEnvironmentStructure extends J3dStructure implements ObjectUpdate shapeScopedAltApp = ((Shape3DRetained)ra.geometryAtom.source).altApps; if (altApp.isScoped) { for (k = 0; k < n; k++) { - // then check if the light is scoped to + // then check if the light is scoped to // this group if (altApp == shapeScopedAltApp[k]) { @@ -1504,7 +1504,7 @@ class RenderingEnvironmentStructure extends J3dStructure implements ObjectUpdate ViewSpecificGroupRetained vsg = (ViewSpecificGroupRetained)vsgList.get(i); int index = keyList[i]; vsg.updateCachedInformation(ViewSpecificGroupRetained.ADD_VIEW, view, index); - + } size = leafList.size(); // Leaves is non-null only for the top VSG @@ -1580,15 +1580,15 @@ class RenderingEnvironmentStructure extends J3dStructure implements ObjectUpdate bgList.add(obj); } } - if (numberOfLights > retlights.length) + if (numberOfLights > retlights.length) retlights = new LightRetained[numberOfLights]; if (intersectedFogs.length < numberOfFogs) intersectedFogs = new FogRetained[numberOfFogs]; if (intersectedAltApps.length < numberOfAltApps) intersectedAltApps = new AlternateAppearanceRetained[numberOfAltApps]; - if (intersectedBacks.length < numberOfBgs) + if (intersectedBacks.length < numberOfBgs) intersectedBacks = new BackgroundRetained[numberOfBgs]; - if (intersectedClips.length < numberOfClips) + if (intersectedClips.length < numberOfClips) intersectedClips = new ClipRetained[numberOfClips]; if (intersectedModelClips.length < numberOfModelClips) intersectedModelClips = new ModelClipRetained[numberOfModelClips]; @@ -1603,7 +1603,7 @@ class RenderingEnvironmentStructure extends J3dStructure implements ObjectUpdate ArrayList leafList; int[] keyList; View view; - + if ((component & ViewSpecificGroupRetained.REMOVE_VIEW) != 0) { view = (View)objAry[0]; vsgList = (ArrayList)objAry[1]; @@ -1623,7 +1623,7 @@ class RenderingEnvironmentStructure extends J3dStructure implements ObjectUpdate ViewSpecificGroupRetained vsg = (ViewSpecificGroupRetained)vsgList.get(i); int index = keyList[i]; vsg.updateCachedInformation(ViewSpecificGroupRetained.REMOVE_VIEW, view, index); - + } size = leafList.size(); // Leaves is non-null only for the top VSG @@ -1698,7 +1698,7 @@ class RenderingEnvironmentStructure extends J3dStructure implements ObjectUpdate } } } - + } boolean isLightScopedToThisView(Object obj, View view) { @@ -1722,7 +1722,7 @@ class RenderingEnvironmentStructure extends J3dStructure implements ObjectUpdate } return true; } - + boolean isAltAppScopedToThisView(Object obj, View view) { AlternateAppearanceRetained altApp = (AlternateAppearanceRetained)obj; if (altApp.isViewScoped) { @@ -1732,7 +1732,7 @@ class RenderingEnvironmentStructure extends J3dStructure implements ObjectUpdate return false; } return true; - } + } boolean isBgScopedToThisView(Object obj, View view) { BackgroundRetained bg = (BackgroundRetained)obj; @@ -1754,7 +1754,7 @@ class RenderingEnvironmentStructure extends J3dStructure implements ObjectUpdate return false; } return true; - } + } boolean isMclipScopedToThisView(Object obj, View view) { @@ -1766,9 +1766,9 @@ class RenderingEnvironmentStructure extends J3dStructure implements ObjectUpdate return false; } return true; - } + } void cleanup() {} } - + diff --git a/src/classes/share/javax/media/j3d/RenderingError.java b/src/classes/share/javax/media/j3d/RenderingError.java index 39780a2..2315c56 100644 --- a/src/classes/share/javax/media/j3d/RenderingError.java +++ b/src/classes/share/javax/media/j3d/RenderingError.java @@ -37,7 +37,7 @@ import java.io.PrintStream; /** * RenderingError is a container object that holds the details of * a runtime error that occurs in the Java 3D rendering system. - * + * * @since Java 3D 1.5 */ public class RenderingError extends Object { @@ -90,7 +90,7 @@ public class RenderingError extends Object { /** * Constructs a new RenderingError object with the given error code * and message. All other fields are initialized to null. - * + * * @param errorCode the error code for this rendering error. * @param errorMessage a short error message describing this * rendering error. diff --git a/src/classes/share/javax/media/j3d/RotPosPathInterpolator.java b/src/classes/share/javax/media/j3d/RotPosPathInterpolator.java index e6d7e8c..870d843 100644 --- a/src/classes/share/javax/media/j3d/RotPosPathInterpolator.java +++ b/src/classes/share/javax/media/j3d/RotPosPathInterpolator.java @@ -42,7 +42,7 @@ import javax.vecmath.Point3f; * modifies the rotational and translational components of its target * TransformGroup by linearly interpolating among a series of predefined * knot/positon and knot/orientation pairs (using the value generated - * by the specified Alpha object). The interpolated position and + * by the specified Alpha object). The interpolated position and * orientation are used to generate a transform in the local coordinate * system of this interpolator. */ @@ -59,12 +59,12 @@ public class RotPosPathInterpolator extends PathInterpolator { private Point3f positions[]; private float prevInterpolationValue = Float.NaN; - // We can't use a boolean flag since it is possible + // We can't use a boolean flag since it is possible // that after alpha change, this procedure only run // once at alpha.finish(). So the best way is to // detect alpha value change. private float prevAlphaValue = Float.NaN; - private WakeupCriterion passiveWakeupCriterion = + private WakeupCriterion passiveWakeupCriterion = (WakeupCriterion) new WakeupOnElapsedFrames(0, true); // non-public, default constructor used by cloneNode @@ -98,7 +98,7 @@ public class RotPosPathInterpolator extends PathInterpolator { if (knots.length != quats.length) throw new IllegalArgumentException(J3dI18N.getString("RotPosPathInterpolator0")); - + setPathArrays(quats, positions); } @@ -230,7 +230,7 @@ public class RotPosPathInterpolator extends PathInterpolator { public void setAxisOfRotPos(Transform3D axisOfRotPos) { setTransformAxis(axisOfRotPos); } - + /** * @deprecated As of Java 3D version 1.3, replaced by * <code>TransformInterpolator.getTransformAxis()</code> @@ -252,7 +252,7 @@ public class RotPosPathInterpolator extends PathInterpolator { */ public void computeTransform(float alphaValue, Transform3D transform) { double quatDot; - + computePathInterpolation(alphaValue); if (currentKnotIndex == 0 && @@ -299,7 +299,7 @@ public class RotPosPathInterpolator extends PathInterpolator { tQuat.w = quats[currentKnotIndex].w + (quats[currentKnotIndex+1].w - quats[currentKnotIndex].w)*currentInterpolationValue; - } + } pos.x = positions[currentKnotIndex].x + (positions[currentKnotIndex+1].x - positions[currentKnotIndex].x) * currentInterpolationValue; @@ -310,17 +310,17 @@ public class RotPosPathInterpolator extends PathInterpolator { (positions[currentKnotIndex+1].z - positions[currentKnotIndex].z) * currentInterpolationValue; } - tQuat.normalize(); - + tQuat.normalize(); + // Set the rotation components tMat.set(tQuat); - + // Set the translation components. tMat.m03 = pos.x; tMat.m13 = pos.y; tMat.m23 = pos.z; rotation.set(tMat); - + // construct a Transform3D from: axis * rotation * axisInverse transform.mul(axis, rotation); transform.mul(transform, axisInverse); @@ -353,7 +353,7 @@ public class RotPosPathInterpolator extends PathInterpolator { * <code>originalNode</code> into * the current node. This method is called from the * <code>cloneNode</code> method which is, in turn, called by the - * <code>cloneTree</code> method.<P> + * <code>cloneTree</code> method.<P> * * @param originalNode the original node to duplicate. * @param forceDuplicate when set to <code>true</code>, causes the @@ -373,7 +373,7 @@ public class RotPosPathInterpolator extends PathInterpolator { super.duplicateAttributes(originalNode, forceDuplicate); RotPosPathInterpolator ri = (RotPosPathInterpolator) originalNode; - + int len = ri.getArrayLengths(); // No API availble to set array size, so explicitly set it here diff --git a/src/classes/share/javax/media/j3d/RotPosScalePathInterpolator.java b/src/classes/share/javax/media/j3d/RotPosScalePathInterpolator.java index 4ff2c2f..db3cdb4 100644 --- a/src/classes/share/javax/media/j3d/RotPosScalePathInterpolator.java +++ b/src/classes/share/javax/media/j3d/RotPosScalePathInterpolator.java @@ -41,7 +41,7 @@ import javax.vecmath.Point3f; * RotPosScalePathInterpolation behavior. This class defines a behavior * that varies the rotational, translational, and scale components of its * target TransformGroup by linearly interpolating among a series of - * predefined knot/position, knot/orientation, and knot/scale pairs + * predefined knot/position, knot/orientation, and knot/scale pairs * (using the value generated by the specified Alpha object). The * interpolated position, orientation, and scale are used to generate * a transform in the local coordinate system of this interpolator. The @@ -65,12 +65,12 @@ public class RotPosScalePathInterpolator extends PathInterpolator { private float prevInterpolationValue = Float.NaN; - // We can't use a boolean flag since it is possible + // We can't use a boolean flag since it is possible // that after alpha change, this procedure only run // once at alpha.finish(). So the best way is to // detect alpha value change. private float prevAlphaValue = Float.NaN; - private WakeupCriterion passiveWakeupCriterion = + private WakeupCriterion passiveWakeupCriterion = (WakeupCriterion) new WakeupOnElapsedFrames(0, true); // non-public, default constructor used by cloneNode @@ -80,7 +80,7 @@ public class RotPosScalePathInterpolator extends PathInterpolator { /** * Constructs a new RotPosScalePathInterpolator object that varies the - * rotation, translation, and scale of the target TransformGroup's + * rotation, translation, and scale of the target TransformGroup's * transform. * @param alpha the alpha object for this interpolator. * @param target the TransformGroup node affected by this interpolator. @@ -110,13 +110,13 @@ public class RotPosScalePathInterpolator extends PathInterpolator { if (knots.length != scales.length) throw new IllegalArgumentException(J3dI18N.getString("RotPosScalePathInterpolator2")); - + setPathArrays(quats, positions, scales); } /** - * Sets the quat value at the specified index for this + * Sets the quat value at the specified index for this * interpolator. * @param index the index to be changed * @param quat the new quat value at index @@ -137,7 +137,7 @@ public class RotPosScalePathInterpolator extends PathInterpolator { /** - * Sets the position value at the specified index for + * Sets the position value at the specified index for * this interpolator. * @param index the index to be changed * @param position the new position value at index @@ -285,11 +285,11 @@ public class RotPosScalePathInterpolator extends PathInterpolator { * @deprecated As of Java 3D version 1.3, replaced by * <code>TransformInterpolator.setTransformAxis(Transform3D)</code> */ - + public void setAxisOfRotPosScale(Transform3D axisOfRotPosScale) { setTransformAxis(axisOfRotPosScale); } - + /** * @deprecated As of Java 3D version 1.3, replaced by * <code>TransformInterpolator.geTransformAxis()</code> @@ -314,9 +314,9 @@ public class RotPosScalePathInterpolator extends PathInterpolator { float scale; double quatDot; - + computePathInterpolation(alphaValue); - + if (currentKnotIndex == 0 && currentInterpolationValue == 0f) { tQuat.x = quats[0].x; @@ -362,7 +362,7 @@ public class RotPosScalePathInterpolator extends PathInterpolator { tQuat.w = quats[currentKnotIndex].w + (quats[currentKnotIndex+1].w - quats[currentKnotIndex].w)*currentInterpolationValue; - } + } pos.x = positions[currentKnotIndex].x + (positions[currentKnotIndex+1].x - positions[currentKnotIndex].x) * currentInterpolationValue; @@ -376,21 +376,21 @@ public class RotPosScalePathInterpolator extends PathInterpolator { (scales[currentKnotIndex+1] - scales[currentKnotIndex]) * currentInterpolationValue; } - tQuat.normalize(); - + tQuat.normalize(); + sMat.set(scale); tMat.set(tQuat); tMat.mul(sMat); // Set the translation components. - + tMat.m03 = pos.x; tMat.m13 = pos.y; tMat.m23 = pos.z; rotation.set(tMat); - + // construct a Transform3D from: axis * rotation * axisInverse transform.mul(axis, rotation); - transform.mul(transform, axisInverse); + transform.mul(transform, axisInverse); } /** @@ -419,7 +419,7 @@ public class RotPosScalePathInterpolator extends PathInterpolator { * <code>originalNode</code> into * the current node. This method is called from the * <code>cloneNode</code> method which is, in turn, called by the - * <code>cloneTree</code> method.<P> + * <code>cloneTree</code> method.<P> * * @param originalNode the original node to duplicate. * @param forceDuplicate when set to <code>true</code>, causes the @@ -439,9 +439,9 @@ public class RotPosScalePathInterpolator extends PathInterpolator { super.duplicateAttributes(originalNode, forceDuplicate); - RotPosScalePathInterpolator ri = + RotPosScalePathInterpolator ri = (RotPosScalePathInterpolator) originalNode; - + int len = ri.getArrayLengths(); // No API available to change size of array, so set here explicitly diff --git a/src/classes/share/javax/media/j3d/RotationInterpolator.java b/src/classes/share/javax/media/j3d/RotationInterpolator.java index 8d319ff..05e31a8 100644 --- a/src/classes/share/javax/media/j3d/RotationInterpolator.java +++ b/src/classes/share/javax/media/j3d/RotationInterpolator.java @@ -47,14 +47,14 @@ public class RotationInterpolator extends TransformInterpolator { float maximumAngle; private Transform3D rotation = new Transform3D(); - // We can't use a boolean flag since it is possible + // We can't use a boolean flag since it is possible // that after alpha change, this procedure only run // once at alpha.finish(). So the best way is to // detect alpha value change. private float prevAlphaValue = Float.NaN; - private WakeupCriterion passiveWakeupCriterion = + private WakeupCriterion passiveWakeupCriterion = (WakeupCriterion) new WakeupOnElapsedFrames(0, true); - + // non-public, default constructor used by cloneNode RotationInterpolator() { } @@ -104,7 +104,7 @@ public class RotationInterpolator extends TransformInterpolator { } /** - * This method retrieves this interpolator's minimumAngle, in + * This method retrieves this interpolator's minimumAngle, in * radians. * @return the interpolator's minimal angle value */ @@ -122,7 +122,7 @@ public class RotationInterpolator extends TransformInterpolator { } /** - * This method retrieves this interpolator's maximumAngle, in + * This method retrieves this interpolator's maximumAngle, in * radians. * @return the interpolator's maximal angle value */ @@ -137,7 +137,7 @@ public class RotationInterpolator extends TransformInterpolator { public void setAxisOfRotation(Transform3D axisOfRotation) { setTransformAxis(axisOfRotation); } - + /** * @deprecated As of Java 3D version 1.3, replaced by * <code>TransformInterpolator.getTransformAxis()</code> @@ -145,7 +145,7 @@ public class RotationInterpolator extends TransformInterpolator { public Transform3D getAxisOfRotation() { return getTransformAxis(); } - + /** * Computes the new transform for this interpolator for a given * alpha value. @@ -191,7 +191,7 @@ public class RotationInterpolator extends TransformInterpolator { * <code>originalNode</code> into * the current node. This method is called from the * <code>cloneNode</code> method which is, in turn, called by the - * <code>cloneTree</code> method.<P> + * <code>cloneTree</code> method.<P> * * @param originalNode the original node to duplicate. * @param forceDuplicate when set to <code>true</code>, causes the @@ -211,7 +211,7 @@ public class RotationInterpolator extends TransformInterpolator { super.duplicateAttributes(originalNode, forceDuplicate); RotationInterpolator ri = (RotationInterpolator) originalNode; - + setMinimumAngle(ri.getMinimumAngle()); setMaximumAngle(ri.getMaximumAngle()); diff --git a/src/classes/share/javax/media/j3d/RotationPathInterpolator.java b/src/classes/share/javax/media/j3d/RotationPathInterpolator.java index 0f6803c..f722b27 100644 --- a/src/classes/share/javax/media/j3d/RotationPathInterpolator.java +++ b/src/classes/share/javax/media/j3d/RotationPathInterpolator.java @@ -55,13 +55,13 @@ public class RotationPathInterpolator extends PathInterpolator { private Quat4f quats[]; private float prevInterpolationValue = Float.NaN; - // We can't use a boolean flag since it is possible + // We can't use a boolean flag since it is possible // that after alpha change, this procedure only run // once at alpha.finish(). So the best way is to // detect alpha value change. private float prevAlphaValue = Float.NaN; - private WakeupCriterion passiveWakeupCriterion = - (WakeupCriterion) new WakeupOnElapsedFrames(0, true); + private WakeupCriterion passiveWakeupCriterion = + (WakeupCriterion) new WakeupOnElapsedFrames(0, true); // non-public, default constructor used by cloneNode RotationPathInterpolator() { } @@ -170,7 +170,7 @@ public class RotationPathInterpolator extends PathInterpolator { public void setAxisOfRotation(Transform3D axisOfRotation) { setTransformAxis(axisOfRotation); } - + /** * @deprecated As of Java 3D version 1.3, replaced by * <code>TransformInterpolator.getTransformAxis()</code> @@ -178,7 +178,7 @@ public class RotationPathInterpolator extends PathInterpolator { public Transform3D getAxisOfRotation() { return getTransformAxis(); } - + // The RotationPathInterpolator's initialize routine uses the default // initialization routine. @@ -198,7 +198,7 @@ public class RotationPathInterpolator extends PathInterpolator { double quatDot; computePathInterpolation(alphaValue); // For RPATH, take quaternion average and set rotation in TransformGroup - + if (currentKnotIndex == 0 && currentInterpolationValue == 0f) { tQuat.x = quats[0].x; @@ -240,12 +240,12 @@ public class RotationPathInterpolator extends PathInterpolator { tQuat.w = quats[currentKnotIndex].w + (quats[currentKnotIndex+1].w - quats[currentKnotIndex].w)*currentInterpolationValue; - } + } } - - tQuat.normalize(); + + tQuat.normalize(); rotation.set(tQuat); - + // construct a Transform3D from: axis * rotation * axisInverse transform.mul(axis, rotation); transform.mul(transform, axisInverse); @@ -277,7 +277,7 @@ public class RotationPathInterpolator extends PathInterpolator { * <code>originalNode</code> into * the current node. This method is called from the * <code>cloneNode</code> method which is, in turn, called by the - * <code>cloneTree</code> method.<P> + * <code>cloneTree</code> method.<P> * * @param originalNode the original node to duplicate. * @param forceDuplicate when set to <code>true</code>, causes the @@ -296,7 +296,7 @@ public class RotationPathInterpolator extends PathInterpolator { void duplicateAttributes(Node originalNode, boolean forceDuplicate) { super.duplicateAttributes(originalNode, forceDuplicate); - RotationPathInterpolator ri = + RotationPathInterpolator ri = (RotationPathInterpolator) originalNode; int len = ri.getArrayLengths(); diff --git a/src/classes/share/javax/media/j3d/ScaleInterpolator.java b/src/classes/share/javax/media/j3d/ScaleInterpolator.java index 41645b2..cb0e4eb 100644 --- a/src/classes/share/javax/media/j3d/ScaleInterpolator.java +++ b/src/classes/share/javax/media/j3d/ScaleInterpolator.java @@ -48,12 +48,12 @@ public class ScaleInterpolator extends TransformInterpolator { private Transform3D scale = new Transform3D(); - // We can't use a boolean flag since it is possible + // We can't use a boolean flag since it is possible // that after alpha change, this procedure only run // once at alpha.finish(). So the best way is to // detect alpha value change. private float prevAlphaValue = Float.NaN; - private WakeupCriterion passiveWakeupCriterion = + private WakeupCriterion passiveWakeupCriterion = (WakeupCriterion) new WakeupOnElapsedFrames(0, true); // non-public, default constructor used by cloneNode @@ -62,8 +62,8 @@ public class ScaleInterpolator extends TransformInterpolator { /** * Constructs a trivial scale interpolator that varies its target - * TransformGroup node between the two specified alpha values - * using the specified alpha, an identity matrix, + * TransformGroup node between the two specified alpha values + * using the specified alpha, an identity matrix, * a minimum scale = 0.1f, and a maximum scale = 1.0f. * @param alpha the alpha object for this interpolator * @param target the TransformGroup node affected by this interpolator @@ -77,9 +77,9 @@ public class ScaleInterpolator extends TransformInterpolator { } /** - * Constructs a new scaleInterpolator object that varies its target + * Constructs a new scaleInterpolator object that varies its target * TransformGroup node's scale component between two scale values - * (minimumScale and maximumScale). + * (minimumScale and maximumScale). * @param alpha the alpha object for this interpolator * @param target the TransformGroup node affected by this interpolator * @param axisOfTransform the transform that defines the local coordinate @@ -98,7 +98,7 @@ public class ScaleInterpolator extends TransformInterpolator { this.minimumScale = minimumScale; this.maximumScale = maximumScale; - } + } /** * This method sets the minimumScale for this interpolator. @@ -139,7 +139,7 @@ public class ScaleInterpolator extends TransformInterpolator { public void setAxisOfScale(Transform3D axisOfScale) { setTransformAxis(axisOfScale); } - + /** * @deprecated As of Java 3D version 1.3, replaced by * <code>TransformInterpolator.getTransformAxis()</code> @@ -195,7 +195,7 @@ public class ScaleInterpolator extends TransformInterpolator { * <code>originalNode</code> into * the current node. This method is called from the * <code>cloneNode</code> method which is, in turn, called by the - * <code>cloneTree</code> method.<P> + * <code>cloneTree</code> method.<P> * * @param originalNode the original node to duplicate. * @param forceDuplicate when set to <code>true</code>, causes the @@ -214,7 +214,7 @@ public class ScaleInterpolator extends TransformInterpolator { void duplicateAttributes(Node originalNode, boolean forceDuplicate) { super.duplicateAttributes(originalNode, forceDuplicate); - + ScaleInterpolator si = (ScaleInterpolator) originalNode; setMinimumScale(si.getMinimumScale()); diff --git a/src/classes/share/javax/media/j3d/SceneGraphCycleException.java b/src/classes/share/javax/media/j3d/SceneGraphCycleException.java index be07db8..cd55116 100644 --- a/src/classes/share/javax/media/j3d/SceneGraphCycleException.java +++ b/src/classes/share/javax/media/j3d/SceneGraphCycleException.java @@ -33,7 +33,7 @@ package javax.media.j3d; /** * Indicates a graph that contains a cycle. - * Java 3D scene graphs are directed acyclic graphs and, as such, do not + * Java 3D scene graphs are directed acyclic graphs and, as such, do not * permit cycles. * This exception is thrown when a graph containing a cycle: * <ul> diff --git a/src/classes/share/javax/media/j3d/SceneGraphObject.java b/src/classes/share/javax/media/j3d/SceneGraphObject.java index 6944cad..08508d2 100644 --- a/src/classes/share/javax/media/j3d/SceneGraphObject.java +++ b/src/classes/share/javax/media/j3d/SceneGraphObject.java @@ -171,7 +171,7 @@ public abstract class SceneGraphObject extends Object { capabilityBits |= (1L << bit); retained.handleFrequencyChange(bit); - + } /** @@ -301,7 +301,7 @@ public abstract class SceneGraphObject extends Object { * allowed by the object's capability bits are allowed. * @return true if node is part of a compiled scene graph, else false */ - + public final boolean isCompiled() { return this.compiled; } @@ -370,7 +370,7 @@ public abstract class SceneGraphObject extends Object { /** * Callback used to allow a node to check if any scene graph objects - * referenced by that node have been duplicated via a call to + * referenced by that node have been duplicated via a call to * <code>cloneTree</code>. * This method is called by <code>cloneTree</code> after all nodes in * the sub-graph have been duplicated. The cloned Leaf @@ -417,7 +417,7 @@ public abstract class SceneGraphObject extends Object { * @return the name of this object * * @since Java 3D 1.4 - */ + */ public String getName() { return objectName; } @@ -448,12 +448,12 @@ public abstract class SceneGraphObject extends Object { /** - * If <code>forceDuplicate</code> is <code>true</code> or + * If <code>forceDuplicate</code> is <code>true</code> or * <code>duplicateOnCloneTree</code> flag is true. This procedure * will return a clone of originalNode or the value in - * in <code>nodeHashtable</code> if found. Otherwise return + * in <code>nodeHashtable</code> if found. Otherwise return * <code>originalNode</code> - * + * * This method is called from the * <code>duplicateAttributes</code> method during cloneNodeComponent. * @@ -463,16 +463,16 @@ public abstract class SceneGraphObject extends Object { * <code>false</code>, the value of each node's * <code>duplicateOnCloneTree</code> variable determines whether * NodeComponent data is duplicated or copied. - * @param nodeHashtable is used to keep track of mapping between old and + * @param nodeHashtable is used to keep track of mapping between old and * new node references. */ NodeComponent getNodeComponent(NodeComponent originalNodeComponent, boolean forceDuplicate, Hashtable hashtable) { if ((originalNodeComponent != null) && - (forceDuplicate || + (forceDuplicate || originalNodeComponent.duplicateChild())) { - NodeComponent nc = (NodeComponent) + NodeComponent nc = (NodeComponent) hashtable.get(originalNodeComponent); if (nc == null) { originalNodeComponent.nodeHashtable = hashtable; @@ -481,7 +481,7 @@ public abstract class SceneGraphObject extends Object { cloneNodeComponent(forceDuplicate); } catch (RuntimeException e) { // must reset nodeHashtable in any case - originalNodeComponent.nodeHashtable = null; + originalNodeComponent.nodeHashtable = null; throw e; } originalNodeComponent.nodeHashtable = null; diff --git a/src/classes/share/javax/media/j3d/SceneGraphObjectRetained.java b/src/classes/share/javax/media/j3d/SceneGraphObjectRetained.java index 64cf052..1e25cda 100644 --- a/src/classes/share/javax/media/j3d/SceneGraphObjectRetained.java +++ b/src/classes/share/javax/media/j3d/SceneGraphObjectRetained.java @@ -94,7 +94,7 @@ abstract class SceneGraphObjectRetained extends IndexedObject boolean isInSetLive() { return inSetLive; } - + /** * Makes the internal node live. */ @@ -119,7 +119,7 @@ abstract class SceneGraphObjectRetained extends IndexedObject /** * Makes the internal node not live */ - void clearLive(VirtualUniverse univ, int index, + void clearLive(VirtualUniverse univ, int index, boolean sharedGroup, HashKey [] keys) { inBackgroundGroup = false; this.source.clearLive(); @@ -154,7 +154,7 @@ abstract class SceneGraphObjectRetained extends IndexedObject void mergeTransform(TransformGroupRetained xform) { } - + void traverse(boolean sameLevel, int level) { System.err.println(); @@ -164,7 +164,7 @@ abstract class SceneGraphObjectRetained extends IndexedObject System.err.print(this); } - /** + /** * true if component can't be read or written after compile or setlive() */ boolean isStatic() { @@ -174,7 +174,7 @@ abstract class SceneGraphObjectRetained extends IndexedObject protected Object clone() { try { return super.clone(); - } catch (CloneNotSupportedException e) { + } catch (CloneNotSupportedException e) { return null; } } diff --git a/src/classes/share/javax/media/j3d/SceneGraphPath.java b/src/classes/share/javax/media/j3d/SceneGraphPath.java index 5995cce..11a1e69 100644 --- a/src/classes/share/javax/media/j3d/SceneGraphPath.java +++ b/src/classes/share/javax/media/j3d/SceneGraphPath.java @@ -127,7 +127,7 @@ public class SceneGraphPath { /** - * Constructs a new SceneGraphPath object + * Constructs a new SceneGraphPath object * @param sgp the SceneGraphPath to copy from */ SceneGraphPath(SceneGraphPath sgp) { @@ -173,7 +173,7 @@ public class SceneGraphPath { * the Locale to the terminal node */ public final void setNodes(Node nodes[]) { - + if(nodes != null && nodes.length > 0) { interior = new Node[nodes.length]; for (int i = 0; i < nodes.length; i++) @@ -200,7 +200,7 @@ public class SceneGraphPath { /** * Sets the transform component of this SceneGraphPath to the value of * the passed transform. - * @param trans the transform to be copied. trans should be the + * @param trans the transform to be copied. trans should be the * localToVworld matrix of this SceneGraphPath object. */ public final void setTransform(Transform3D trans) { @@ -215,7 +215,7 @@ public class SceneGraphPath { * coordinate transform for this scene graph object at the * time of the pick or collision is recorded. * @return the local to VWorld transform - */ + */ public final Transform3D getTransform() { return new Transform3D(transform); } @@ -254,7 +254,7 @@ public class SceneGraphPath { */ public final Node getNode(int index) { if(interior == null) - throw new + throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("SceneGraphPath1")); return interior[index]; } @@ -269,21 +269,21 @@ public class SceneGraphPath { public boolean equals(SceneGraphPath testPath) { boolean result = true; try { - + if(testPath == null || root != testPath.root || item != testPath.item) return false; - + result = transform.equals(testPath.transform); - + if(result == false) return false; if(interior == null || testPath.interior == null) { - if(interior != testPath.interior) + if(interior != testPath.interior) return false; - else + else result = (root == testPath.root && item == testPath.item); - + } else { if (interior.length == testPath.interior.length) { for (int i = 0; i < interior.length; i++) @@ -294,10 +294,10 @@ public class SceneGraphPath { else return false; } - + } catch (NullPointerException e2) {return false;} - + return result; } @@ -315,18 +315,18 @@ public class SceneGraphPath { SceneGraphPath testPath = (SceneGraphPath)o1; if(testPath == null || root != testPath.root || item != testPath.item) return false; - + result = transform.equals(testPath.transform); - + if(result == false) return false; - + if(interior == null || testPath.interior == null) { - if(interior != testPath.interior) + if(interior != testPath.interior) return false; - else + else result = (root == testPath.root && item == testPath.item); - + } else { if (interior.length == testPath.interior.length) { for (int i = 0; i < interior.length; i++) @@ -337,14 +337,14 @@ public class SceneGraphPath { else return false; } - + return result; } catch (NullPointerException e2) {return false;} catch (ClassCastException e1) {return false;} } - - + + /** * Returns a hash number based on the data values in this * object. Two different SceneGraphPath objects with identical data @@ -355,8 +355,8 @@ public class SceneGraphPath { */ public int hashCode() { HashKey key = new HashKey(250); - // NOTE: Needed to add interior != null because this method is called - // by object.toString() when interior is null. + // NOTE: Needed to add interior != null because this method is called + // by object.toString() when interior is null. if(interior != null && item != null) { for(int i=0; i<interior.length; i++) { key.append(LinkRetained.plus).append( item.toString() ); @@ -367,8 +367,8 @@ public class SceneGraphPath { /** * Determines whether two SceneGraphPath objects represent the same - * path in the scene graph; either object might include a different - * subset of internal nodes; only the internal link nodes, the Locale, + * path in the scene graph; either object might include a different + * subset of internal nodes; only the internal link nodes, the Locale, * and the Node itself are compared. The paths are not validated for * correctness or uniqueness. * @param testPath the SceneGraphPath to be compared to this SceneGraphPath @@ -393,7 +393,7 @@ public class SceneGraphPath { break; } count++; - // if true, this had an extra Link + // if true, this had an extra Link if(count == testPath.interior.length) return false; } @@ -401,7 +401,7 @@ public class SceneGraphPath { } // make sure testPath doesn't have any extra Links while(count < testPath.interior.length) { - if(testPath.interior[count] instanceof Link) + if(testPath.interior[count] instanceof Link) return false; count++; } @@ -414,31 +414,31 @@ public class SceneGraphPath { /** * Returns a string representation of this object; * the string contains the class names of all Nodes in the SceneGraphPath, - * the toString() method of any associated user data provided by + * the toString() method of any associated user data provided by * SceneGraphObject.getUserData(), and also prints out the transform, * if it is not null. * @return String representation of this object */ public String toString() { - + StringBuffer str = new StringBuffer(); Object obj; - + if(root == null && interior == null && item == null) return (super.toString()); - - if(root != null) + + if(root != null) str.append(root + " : "); - + if(interior != null) { for(int i=0; i<interior.length; i++) { - + str.append( interior[i].getClass().getName()); obj = interior[i].getUserData(); if(obj == null) - str.append(" : "); + str.append(" : "); else - str.append(", " + obj + " : "); + str.append(", " + obj + " : "); } } @@ -448,24 +448,24 @@ public class SceneGraphPath { obj = item.getUserData(); if(obj != null) str.append(", " + obj); - + try { if (item.getClass().getName().equals("javax.media.j3d.Shape3D")) str.append( ((Shape3D)item).getGeometry() ); - } + } catch( CapabilityNotSetException e) {} } - + str.append("\n" + "LocalToVworld Transform:\n" + transform); - + return new String(str); } - + /** * Determine if this SceneGraphPath is unique and valid * The graph don't have to be live for this checking. - * Set Locale when it is null. - * Only the essential link node which led to the Locale + * Set Locale when it is null. + * Only the essential link node which led to the Locale * is validated. */ boolean validate() { @@ -480,11 +480,11 @@ public class SceneGraphPath { } } } else { - root = locale; + root = locale; } - + int idx = (interior == null ? 0: interior.length); - + do { if (node instanceof SharedGroupRetained) { if (interior == null) @@ -503,7 +503,7 @@ public class SceneGraphPath { node = node.parent; } } while (node != null); - + return true; } @@ -527,7 +527,7 @@ public class SceneGraphPath { } } } - + /** * Determines whether this SceneGraphPath is unique and valid. The * verification determines that all of the nodes are live, that the @@ -535,49 +535,49 @@ public class SceneGraphPath { * that there is a Node specified. */ boolean validate(HashKey key) { - + int i; - + // verify that there is at least a Locale and Node specified if( root == null ) throw new IllegalArgumentException(J3dI18N.getString("SceneGraphPath2")); - + if( item == null ) throw new IllegalArgumentException(J3dI18N.getString("SceneGraphPath10")); - + // verify liveness if( !item.isLive() ) throw new IllegalArgumentException(J3dI18N.getString("SceneGraphPath3")); - + try { getHashKey(key); } catch (RuntimeException ex) { throw new IllegalArgumentException(ex.getMessage()); } - + // The rest of the code verifies uniqueness; it traverses the retained - // hierarchy of the scene graph. This could be problematic later in + // hierarchy of the scene graph. This could be problematic later in // when certain compile mode optimizations are added. */ - + NodeRetained bottomNR, currentNR, nextNR=null; Node currentNode; int count = 0; - + // Need to traverse the retained hierarchy on a live scene graph // from bottom to top - // + // // bottomNR = last verified node; as nodes are verified, bottomNR - // moves up the scen graph + // moves up the scen graph // nextNR = Next node that the user has specified after bottomNR - // currentNR = current node; is changing as it covers all the + // currentNR = current node; is changing as it covers all the // nodes from bottomNR to nextNR - + // If the parent of a NodeRetained is null, we know that the parent // is either a BranchGroupRetained at the top of a scene graph or // it is a SharedGroupRetained, potentially with multiple parents. - + bottomNR = (NodeRetained)(item.retained); - + if(interior != null) { for(i=interior.length-1; i >=0 ; i--) { nextNR = (NodeRetained)(interior[i].retained); @@ -587,21 +587,21 @@ public class SceneGraphPath { currentNR = nextNR; else throw new IllegalArgumentException(J3dI18N.getString("SceneGraphPath5")); - + } - + while(currentNR != nextNR) { if(currentNR == null) { throw new IllegalArgumentException(J3dI18N.getString("SceneGraphPath11")); } - - if(currentNR instanceof SharedGroupRetained) { + + if(currentNR instanceof SharedGroupRetained) { if(((SharedGroupRetained) (currentNR)).parents.contains(nextNR) ) - currentNR = nextNR; - else - throw new IllegalArgumentException(J3dI18N.getString("SceneGraphPath5")); - + currentNR = nextNR; + else + throw new IllegalArgumentException(J3dI18N.getString("SceneGraphPath5")); + } else { currentNR = currentNR.parent; } @@ -609,35 +609,35 @@ public class SceneGraphPath { bottomNR = currentNR; } } - + // Now go from bottomNR to Locale currentNR = bottomNR.parent; if(currentNR == null && bottomNR instanceof SharedGroupRetained) { throw new IllegalArgumentException(J3dI18N.getString("SceneGraphPath5")); } - + while(currentNR != null) { if(currentNR instanceof LinkRetained) { throw new IllegalArgumentException(J3dI18N.getString("SceneGraphPath5")); - } - + } + bottomNR = currentNR; currentNR = currentNR.parent; if(currentNR == null && bottomNR instanceof SharedGroupRetained) { throw new IllegalArgumentException(J3dI18N.getString("SceneGraphPath5")); } } - + // get the real BranchGroup from the BranchGroupRetained currentNode = (Node)(bottomNR.source); // now bottomNR should be a BranchGroup -- should try an assert here if(!root.branchGroups.contains(currentNode)) { throw new IllegalArgumentException(J3dI18N.getString("SceneGraphPath9")); - } - - return true; + } + + return true; } - + /** * Returns the distance from the intersectPoint for item and * origin. @@ -645,18 +645,18 @@ public class SceneGraphPath { double getDistanceFrom( Point3d origin ) { return intersectPoint.distance(origin); } - + /** - * Returns the distance of the pick + * Returns the distance of the pick */ double getDistance() { return pickDistance; } - + final void setIntersectPoint( Point3d point ) { intersectPoint.set(point); } - + final void setIntersectPointDis( Point4d pickLocation ) { // System.err.println( "setIntersectPointDis pickLocation= "+pickLocation); intersectPoint.x = pickLocation.x; @@ -664,7 +664,7 @@ public class SceneGraphPath { intersectPoint.z = pickLocation.z; pickDistance = pickLocation.w; } - + final Point3d getIntersectPoint() { return intersectPoint; } diff --git a/src/classes/share/javax/media/j3d/Screen3D.java b/src/classes/share/javax/media/j3d/Screen3D.java index 75a17f1..785be48 100644 --- a/src/classes/share/javax/media/j3d/Screen3D.java +++ b/src/classes/share/javax/media/j3d/Screen3D.java @@ -56,10 +56,10 @@ import java.util.Hashtable; * <b>Offscreen Rendering</b><P> * New for Java 3D 1.2, an off-screen rendering mode allows rendering * to a memory image, which is possibly larger than the screen. The - * setSize and getSize methods are defined specifically for this + * setSize and getSize methods are defined specifically for this * mode. Note that the off-screen size, physical width, and physical height * must be set prior to rendering - * to the associated off-screen canvas. Failure to do so will result + * to the associated off-screen canvas. Failure to do so will result * in an exception.<P> * <b>Calibration Parameters</b><P> * The Screen3D object must be calibrated with the coexistence volume. @@ -145,7 +145,7 @@ public class Screen3D extends Object { Transform3D headTrackerToLeftImagePlate = new Transform3D(); Transform3D headTrackerToRightImagePlate = new Transform3D(); - + // Physical screen size related field has changed. static final int PHYSICAL_SCREEN_SIZE_DIRTY = 0x01; // Screen size field has changed. @@ -153,14 +153,14 @@ public class Screen3D extends Object { // Tracker base to image plate field has changed. static final int TRACKER_BASE_TO_IMAGE_PLATE_DIRTY = 0x04; // Head tracker to image plate field has changed. - static final int HEAD_TRACKER_TO_IMAGE_PLATE_DIRTY = 0x08; + static final int HEAD_TRACKER_TO_IMAGE_PLATE_DIRTY = 0x08; // Mask that indicates this Screen3D view dependence info. has changed, // and CanvasViewCache may need to recompute the final view matries. int scrDirtyMask = (PHYSICAL_SCREEN_SIZE_DIRTY | SCREEN_SIZE_DIRTY_DIRTY | TRACKER_BASE_TO_IMAGE_PLATE_DIRTY - | HEAD_TRACKER_TO_IMAGE_PLATE_DIRTY); - + | HEAD_TRACKER_TO_IMAGE_PLATE_DIRTY); + // // View cache for this screen // @@ -168,7 +168,7 @@ public class Screen3D extends Object { // The renderer for this screen Renderer renderer = null; - + // Hashtable that maps a GraphicsDevice to its associated renderer static Hashtable deviceRendererMap = new Hashtable(); @@ -272,7 +272,7 @@ public class Screen3D extends Object { if (!offScreen) throw new IllegalStateException(J3dI18N.getString("Screen3D1")); - + synchronized(this) { screenSize.width = width; screenSize.height = height; @@ -298,7 +298,7 @@ public class Screen3D extends Object { public void setSize(Dimension d) { if (!offScreen) throw new IllegalStateException(J3dI18N.getString("Screen3D1")); - + synchronized(this) { screenSize.width = d.width; screenSize.height = d.height; @@ -341,7 +341,7 @@ public class Screen3D extends Object { } notifyUsers(); } - + /** * Retrieves the the screen's physical height in meters. * @return the screen's physical height in meters @@ -375,7 +375,7 @@ public class Screen3D extends Object { */ Screen3D(GraphicsConfiguration graphicsConfiguration, boolean offScreen) { this.offScreen = offScreen; - this.graphicsDevice = graphicsConfiguration.getDevice(); + this.graphicsDevice = graphicsConfiguration.getDevice(); screenViewCache = new ScreenViewCache(this); @@ -444,11 +444,11 @@ public class Screen3D extends Object { throw new BadTransformException(J3dI18N.getString("Screen3D0")); } headTrackerToLeftImagePlate.setWithLock(t); - scrDirtyMask |= Screen3D.HEAD_TRACKER_TO_IMAGE_PLATE_DIRTY; + scrDirtyMask |= Screen3D.HEAD_TRACKER_TO_IMAGE_PLATE_DIRTY; } notifyUsers(); } - + /** * Retrieves the head-tracker coordinate system to left image-plate * coordinate system transform and copies it into the specified @@ -477,7 +477,7 @@ public class Screen3D extends Object { } notifyUsers(); } - + /** * Retrieves the head-tracker coordinate system to right image-plate * coordinate system transform and copies it into the specified @@ -498,14 +498,14 @@ public class Screen3D extends Object { screenViewCache.snapshot(); } } - + /** * Increment canvas count, initialize renderer if needed */ synchronized void incCanvasCount() { canvasCount++; } - + /** * Decrement canvas count, kill renderer if needed */ diff --git a/src/classes/share/javax/media/j3d/ScreenViewCache.java b/src/classes/share/javax/media/j3d/ScreenViewCache.java index e75a295..e686be3 100644 --- a/src/classes/share/javax/media/j3d/ScreenViewCache.java +++ b/src/classes/share/javax/media/j3d/ScreenViewCache.java @@ -55,14 +55,14 @@ class ScreenViewCache extends Object { int screenHeight; // Mask that indicates Screen3D view dependence info. has changed, - // and CanvasViewCache may need to recompute the final view matries. + // and CanvasViewCache may need to recompute the final view matries. // Issue 163: Array of dirty bits is used because the Renderer and // RenderBin run asynchronously. Now that they each have a separate // instance of CanvasViewCache (due to the fix for Issue 109), they // need separate dirty bits. Array element 0 is used for the Renderer and // element 1 is used for the RenderBin. int[] scrvcDirtyMask = new int[2]; - + // // Tracker-base coordinate system to image-plate coordinate // system transform. If head tracking is enabled, this transform @@ -113,14 +113,14 @@ class ScreenViewCache extends Object { physicalScreenHeight = screen.physicalScreenHeight; screenWidth = screen.screenSize.width; screenHeight = screen.screenSize.height; - + screen.trackerBaseToImagePlate.getWithLock(trackerBaseToImagePlate); screen.headTrackerToLeftImagePlate.getWithLock (headTrackerToLeftImagePlate); screen.headTrackerToRightImagePlate.getWithLock (headTrackerToRightImagePlate); - + // This isn't really API data, but since we have no other derived // data, and it's a simple calculation, it's easier if we just do // it here. diff --git a/src/classes/share/javax/media/j3d/Sensor.java b/src/classes/share/javax/media/j3d/Sensor.java index 418b3d2..9082fa6 100644 --- a/src/classes/share/javax/media/j3d/Sensor.java +++ b/src/classes/share/javax/media/j3d/Sensor.java @@ -38,8 +38,8 @@ import javax.vecmath.*; * data. Examples include six-degree-of-freedom tracking, a joystick, * or a data file being read back during a program. A sensor must be * used in conjuction with an implementation of the InputDevice - * interface.<P> - * + * interface.<P> + * * The Sensor object provides an abstract concept of a hardware * input device. A Sensor consists of a timestamped sequence of * input values and the state of buttons or switches at the time @@ -60,15 +60,15 @@ import javax.vecmath.*; * Java 3D includes three special six-degrees-of-freedom (6DOF) entities. * These include UserHead, DominantHand, and NondominantHand. You * can assign or change which sensor drives one - * of these predefined entities. Java 3D uses the specified sensor to + * of these predefined entities. Java 3D uses the specified sensor to * drive the 6DOF entity - most visibly the View.<P> * - * Java 3D does not provide raw tracker or joystick-generated data in - * a sensor. At a minimum, Java 3D normalizes the raw data using the - * registration and calibration parameters either provided by or - * provided for the end user. It additionally may filter and process + * Java 3D does not provide raw tracker or joystick-generated data in + * a sensor. At a minimum, Java 3D normalizes the raw data using the + * registration and calibration parameters either provided by or + * provided for the end user. It additionally may filter and process * the data to remove noise and improve latency. - * The application programmer can suppress this latter effect on a + * The application programmer can suppress this latter effect on a * sensor-by-sensor basis.<P> * * @see SensorRead @@ -111,13 +111,13 @@ public class Sensor { public static final int HAND_PREDICTOR = 64; /** - * Default SensorRead object count (30); the number of SensorRead + * Default SensorRead object count (30); the number of SensorRead * objects constructed if no count is specified. */ public static final int DEFAULT_SENSOR_READ_COUNT = 30; /** - * SENSOR_READ_COUNT_BUFFER is the number of extra sensor reading + * SENSOR_READ_COUNT_BUFFER is the number of extra sensor reading * values to store at the end of the circular list. It helps provide * MT-safeness. This is necessary if someone asks for the last * k sensor values and k is close to sensor read count. @@ -128,7 +128,7 @@ public class Sensor { static int num_reads_so_far = 0; - // specifies whether a DEMAND_DRIVEN device has been added that + // specifies whether a DEMAND_DRIVEN device has been added that // manages this sensor boolean demand_driven = false; @@ -136,7 +136,7 @@ public class Sensor { int sensorReadCount; // Prediction policy -- unused - private int predictionPolicy = NO_PREDICTOR; + private int predictionPolicy = NO_PREDICTOR; // Predictor type -- unused private int predictorType = PREDICT_NONE; @@ -155,10 +155,10 @@ public class Sensor { // These matrices used as a temporary workspace for the local SVD // calculations (thus minimimizing garbage collection). - Matrix3d orig_rot = new Matrix3d(); - Matrix3d orig_rot_transpose = new Matrix3d(); - Matrix3d temp_rot = new Matrix3d(); - Matrix3d local_svd = new Matrix3d(); + Matrix3d orig_rot = new Matrix3d(); + Matrix3d orig_rot_transpose = new Matrix3d(); + Matrix3d temp_rot = new Matrix3d(); + Matrix3d local_svd = new Matrix3d(); /** @@ -205,7 +205,7 @@ public class Sensor { new Point3d(0.0,0.0, 0.0)); } - /** + /** * Constructs a Sensor object for the specified input device using * the specified hotspot. * Default values are used for all other parameters. @@ -258,7 +258,7 @@ public class Sensor { this.hotspot = new Point3d(hotspot); } - // argument of 0 is last reading (ie, currentIndex), argument + // argument of 0 is last reading (ie, currentIndex), argument // of 1 means next to last index, etc. int previousIndex(int k){ int temp = currentIndex - k; @@ -291,7 +291,7 @@ public class Sensor { * * @deprecated As of Java 3D version 1.4, prediction is not a * supported feature. - */ + */ public int getPredictor(){ return predictorType; } @@ -322,7 +322,7 @@ public class Sensor { * * @deprecated As of Java 3D version 1.4, prediction is not a * supported feature. - */ + */ public int getPredictionPolicy(){ return predictionPolicy; } @@ -397,8 +397,8 @@ public class Sensor { /** * Extracts the kth-most recent sensor reading and copies that value into - * the specified argument; where 0 is the most recent sensor reading, 1 is - * the next most recent sensor reading, etc. + * the specified argument; where 0 is the most recent sensor reading, 1 is + * the next most recent sensor reading, etc. * @param read the matrix that will receive the most recent sensor reading * @param kth the kth previous sensor reading */ @@ -438,14 +438,14 @@ public class Sensor { * placed */ public void lastButtons(int[] values) { - System.arraycopy(readings[currentIndex].buttonValues, 0, values, + System.arraycopy(readings[currentIndex].buttonValues, 0, values, 0, sensorButtonCount); } /** * Places the kth-most recent sensor reading value for each button into - * the array parameter; where k=0 is the most recent sensor reading, k=1 - * is the next most recent sensor reading, etc.; will throw an + * the array parameter; where k=0 is the most recent sensor reading, k=1 + * is the next most recent sensor reading, etc.; will throw an * ArrayIndexOutOfBoundsException if values.length is less than * the number of buttons. * @param k the time associated with the most recent sensor reading @@ -470,8 +470,8 @@ public class Sensor { } /** - * Set the number of sensor read objects per Sensor. This is a - * calibration parameter that should normally be set in this + * Set the number of sensor read objects per Sensor. This is a + * calibration parameter that should normally be set in this * object's constructor. Calling this method resets all of this * sensor's values that are already in the buffer. * It is illegal to change this value after the device has been @@ -487,7 +487,7 @@ public class Sensor { } currentIndex = 0; } - + /** * Returns the number of buttons associated with this sensor. @@ -502,7 +502,7 @@ public class Sensor { * @return the current sensor read object */ public SensorRead getCurrentSensorRead() { - // not sure if this should return a reference or a copy + // not sure if this should return a reference or a copy SensorRead read = new SensorRead(sensorButtonCount); read.set(readings[currentIndex]); return read; @@ -511,7 +511,7 @@ public class Sensor { /** * Sets the next sensor read to the specified values; once these * values are set via this method they become the current values - * returned by methods such as lastRead(), lastTime(), and + * returned by methods such as lastRead(), lastTime(), and * lastButtons(); note that if there are no buttons associated with * this sensor, values can just be an empty array. * @param time the next SensorRead's associated time @@ -523,7 +523,7 @@ public class Sensor { int temp = currentIndex + 1; if (temp > MaxSensorReadIndex) temp = 0; - + readings[temp].setTime(time); readings[temp].set(transform); if(sensorButtonCount > 0) @@ -537,10 +537,10 @@ public class Sensor { * returned by methods such as lastRead(), lastTime(), and * lastButtons(). * @param read the next SensorRead's values - */ + */ public void setNextSensorRead(SensorRead read) { - int temp = currentIndex + 1; - if (temp > MaxSensorReadIndex) temp = 0; + int temp = currentIndex + 1; + if (temp > MaxSensorReadIndex) temp = 0; readings[temp].set(read); currentIndex = temp; } diff --git a/src/classes/share/javax/media/j3d/SensorRead.java b/src/classes/share/javax/media/j3d/SensorRead.java index 2326237..b51a896 100644 --- a/src/classes/share/javax/media/j3d/SensorRead.java +++ b/src/classes/share/javax/media/j3d/SensorRead.java @@ -84,7 +84,7 @@ public class SensorRead { /** * Constructs a SensorRead object with the specified number * of buttons. - * @param numButtons the number of buttons for this SensorRead + * @param numButtons the number of buttons for this SensorRead */ public SensorRead(int numButtons){ this.read = new Transform3D(); @@ -137,10 +137,10 @@ public class SensorRead { } /** - * Sets the values of all buttons for this SensorRead object. + * Sets the values of all buttons for this SensorRead object. * @param values array contining the new buttons for this SensorRead - * @exception ArrayIndexOutOfBoundsException if this object - * has 0 buttons or if values.length is less than the number of + * @exception ArrayIndexOutOfBoundsException if this object + * has 0 buttons or if values.length is less than the number of * buttons in this object. */ public void setButtons(int[] values) { @@ -154,7 +154,7 @@ public class SensorRead { System.arraycopy(values, 0, buttonValues, 0, numButtons); } - + /** * Copies the array of button values for this SensorRead object into * the specified array. @@ -167,7 +167,7 @@ public class SensorRead { public void getButtons(int[] values) { if(numButtons > 0) System.arraycopy(buttonValues, 0, values, 0, numButtons); - } + } /** diff --git a/src/classes/share/javax/media/j3d/SetLiveState.java b/src/classes/share/javax/media/j3d/SetLiveState.java index 506936d..1df3b6c 100644 --- a/src/classes/share/javax/media/j3d/SetLiveState.java +++ b/src/classes/share/javax/media/j3d/SetLiveState.java @@ -48,7 +48,7 @@ class SetLiveState extends Object { // The transforms used to update state Transform3D[][] currentTransforms = new Transform3D[1][]; int[][] currentTransformsIndex = new int[1][]; - + // The keys used when dealing with SharedGroups HashKey[] keys = null; @@ -123,9 +123,9 @@ class SetLiveState extends Object { ArrayList ogCIOTableList = new ArrayList(5); /** - * List of BranchGroup from this node to the root of tree - * This is used by BranchGroupRetained to construct - * BranchGroup lists for picking. + * List of BranchGroup from this node to the root of tree + * This is used by BranchGroupRetained to construct + * BranchGroup lists for picking. * * @see NodeRetained.branchGroupPaths */ @@ -150,7 +150,7 @@ class SetLiveState extends Object { // many references of the original branch that attach()/detach() int refCount = 1; - // background node whose geometry branch contains this node + // background node whose geometry branch contains this node BackgroundRetained geometryBackground = null; // behavior nodes @@ -184,7 +184,7 @@ class SetLiveState extends Object { GroupRetained parentSwitchLink = null; SharedGroupRetained lastSharedGroup = null; - + int traverseFlags = 0; // Use for set live. @@ -197,13 +197,13 @@ class SetLiveState extends Object { int[] hashkeyIndex = null; ArrayList switchStates = null; - + SetLiveState(VirtualUniverse u) { universe = u; } - void reset(Locale l) { + void reset(Locale l) { locale = l; clear(); } @@ -215,7 +215,7 @@ class SetLiveState extends Object { nodeList.clear(); viewScopedNodeList = null; scopedNodesViewList = null; - + notifyThreads = 0; transformTargets = null; lights = null; @@ -226,7 +226,7 @@ class SetLiveState extends Object { changedViewGroup = null; changedViewList = null; keyList = null; - + behaviorNodes.clear(); traverseFlags = 0; @@ -261,13 +261,13 @@ class SetLiveState extends Object { localToVworld = null; localToVworldIndex = null; localToVworldKeys = null; - + // XXXX: optimization for targetThreads computation, require // cleanup in GroupRetained.doSetLive() //transformTargetThreads = 0; hashkeyIndex = null; - + // Fix for issue 75 parentBranchGroupPaths = null; branchGroupPaths = null; diff --git a/src/classes/share/javax/media/j3d/ShaderAppearance.java b/src/classes/share/javax/media/j3d/ShaderAppearance.java index e18bdc6..5e27e3f 100644 --- a/src/classes/share/javax/media/j3d/ShaderAppearance.java +++ b/src/classes/share/javax/media/j3d/ShaderAppearance.java @@ -165,7 +165,7 @@ public class ShaderAppearance extends Appearance { } ((ShaderAppearanceRetained)this.retained).setShaderProgram(shaderProgram); - + } diff --git a/src/classes/share/javax/media/j3d/ShaderAppearanceRetained.java b/src/classes/share/javax/media/j3d/ShaderAppearanceRetained.java index 506e971..ac37215 100644 --- a/src/classes/share/javax/media/j3d/ShaderAppearanceRetained.java +++ b/src/classes/share/javax/media/j3d/ShaderAppearanceRetained.java @@ -44,13 +44,13 @@ class ShaderAppearanceRetained extends AppearanceRetained { // Issue 485 - these values must start after the last value in Appearance static final int SHADER_PROGRAM = 0x0800; - static final int SHADER_ATTRIBUTE_SET = 0x1000; + static final int SHADER_ATTRIBUTE_SET = 0x1000; // // State variables: these should all be initialized to approproate // Java 3D defaults. // - + protected ShaderProgramRetained shaderProgram = null; protected ShaderAttributeSetRetained shaderAttributeSet = null; protected boolean isMirror = false; // For Debugging. @@ -71,14 +71,14 @@ class ShaderAppearanceRetained extends AppearanceRetained { } if (sp != null) { - ((ShaderProgramRetained)sp.retained).setLive(inBackgroundGroup, + ((ShaderProgramRetained)sp.retained).setLive(inBackgroundGroup, refCount); ((ShaderProgramRetained)sp.retained).copyMirrorUsers(this); } - - sendMessage(SHADER_PROGRAM, + + sendMessage(SHADER_PROGRAM, (sp != null ? ((ShaderProgramRetained)sp.retained).mirror : null)); - + } if (sp == null) { @@ -95,7 +95,7 @@ class ShaderAppearanceRetained extends AppearanceRetained { * @return current shader program object */ ShaderProgram getShaderProgram() { - return (shaderProgram == null ? null : (ShaderProgram)shaderProgram.source); + return (shaderProgram == null ? null : (ShaderProgram)shaderProgram.source); } @@ -116,18 +116,18 @@ class ShaderAppearanceRetained extends AppearanceRetained { } if (sas != null) { - ((ShaderAttributeSetRetained)sas.retained).setLive(inBackgroundGroup, + ((ShaderAttributeSetRetained)sas.retained).setLive(inBackgroundGroup, refCount); ((ShaderAttributeSetRetained)sas.retained).copyMirrorUsers(this); } - + // System.err.println(" -- testing needed!"); - sendMessage(SHADER_ATTRIBUTE_SET, - (sas != null ? + sendMessage(SHADER_ATTRIBUTE_SET, + (sas != null ? ((ShaderAttributeSetRetained)sas.retained).mirror : null)); - + } - + if (sas == null) { this.shaderAttributeSet = null; } else { @@ -142,7 +142,7 @@ class ShaderAppearanceRetained extends AppearanceRetained { * @return current ShaderAttributeSet object */ ShaderAttributeSet getShaderAttributeSet() { - return (shaderAttributeSet == null ? null : (ShaderAttributeSet)shaderAttributeSet.source); + return (shaderAttributeSet == null ? null : (ShaderAttributeSet)shaderAttributeSet.source); } @@ -155,7 +155,7 @@ class ShaderAppearanceRetained extends AppearanceRetained { boolean equals(ShaderAppearanceRetained sApp) { boolean flag; flag = (sApp == this); - + // If the reference is the same, we can stop check. if(flag) return flag; @@ -164,16 +164,16 @@ class ShaderAppearanceRetained extends AppearanceRetained { flag = ((sApp != null) && (shaderProgram == sApp.shaderProgram) && (shaderAttributeSet == sApp.shaderAttributeSet)); - + if (!flag) return flag; - + return super.equals(sApp); } - + synchronized void createMirrorObject() { // System.err.println("ShaderAppearanceRetained : createMirrorObject()"); @@ -205,11 +205,11 @@ class ShaderAppearanceRetained extends AppearanceRetained { mirrorApp.shaderProgram = (ShaderProgramRetained)shaderProgram.mirror; } else { - mirrorApp.shaderProgram = null; + mirrorApp.shaderProgram = null; } if(shaderAttributeSet != null) { - mirrorApp.shaderAttributeSet = + mirrorApp.shaderAttributeSet = (ShaderAttributeSetRetained)shaderAttributeSet.mirror; } else { @@ -235,7 +235,7 @@ class ShaderAppearanceRetained extends AppearanceRetained { else if ((component & SHADER_ATTRIBUTE_SET) != 0) { mirrorApp.shaderAttributeSet = (ShaderAttributeSetRetained)value; } - + } /** @@ -280,25 +280,25 @@ class ShaderAppearanceRetained extends AppearanceRetained { synchronized void addAMirrorUser(Shape3DRetained shape) { super.addAMirrorUser(shape); - if (shaderProgram != null) + if (shaderProgram != null) shaderProgram.addAMirrorUser(shape); - if (shaderAttributeSet != null) + if (shaderAttributeSet != null) shaderAttributeSet.addAMirrorUser(shape); } - + synchronized void removeAMirrorUser(Shape3DRetained shape) { - + super.removeAMirrorUser(shape); - if (shaderProgram != null) + if (shaderProgram != null) shaderProgram.removeAMirrorUser(shape); - if (shaderAttributeSet != null) + if (shaderAttributeSet != null) shaderAttributeSet.removeAMirrorUser(shape); } - - + + final void sendMessage(int attrMask, Object attr) { ArrayList univList = new ArrayList(); - ArrayList gaList = Shape3DRetained.getGeomAtomsList(mirror.users, univList); + ArrayList gaList = Shape3DRetained.getGeomAtomsList(mirror.users, univList); // Send to rendering attribute structure, regardless of // whether there are users or not (alternate appearance case ..) J3dMessage createMessage = new J3dMessage(); @@ -311,13 +311,13 @@ class ShaderAppearanceRetained extends AppearanceRetained { createMessage.args[3] = new Integer(changedFrequent); VirtualUniverse.mc.processMessage(createMessage); - + //System.err.println("univList.size is " + univList.size()); for(int i=0; i<univList.size(); i++) { createMessage = new J3dMessage(); createMessage.threads = J3dThread.UPDATE_RENDER; createMessage.type = J3dMessage.SHADER_APPEARANCE_CHANGED; - + createMessage.universe = (VirtualUniverse) univList.get(i); createMessage.args[0] = this; createMessage.args[1]= new Integer(attrMask); @@ -332,7 +332,7 @@ class ShaderAppearanceRetained extends AppearanceRetained { } } - + boolean isStatic() { if (!super.isStatic()) { return false; @@ -363,11 +363,11 @@ class ShaderAppearanceRetained extends AppearanceRetained { } boolean isOpaque(int geoType) { - + if (!super.isOpaque(geoType)) { return false; } - + // TODO: IMPLEMENT THIS // TODO: How do we determine whether a ShaderAppearance is opaque??? return true; @@ -382,7 +382,7 @@ class ShaderAppearanceRetained extends AppearanceRetained { mask = SHADER_PROGRAM; else if (bit == ShaderAppearance.ALLOW_SHADER_ATTRIBUTE_SET_WRITE) mask = SHADER_ATTRIBUTE_SET; - + if (mask != 0) setFrequencyChangeMask(bit, mask); diff --git a/src/classes/share/javax/media/j3d/ShaderAttribute.java b/src/classes/share/javax/media/j3d/ShaderAttribute.java index 85f783b..50452f2 100644 --- a/src/classes/share/javax/media/j3d/ShaderAttribute.java +++ b/src/classes/share/javax/media/j3d/ShaderAttribute.java @@ -74,7 +74,7 @@ public abstract class ShaderAttribute extends NodeComponent { * Package scope constructor * */ - ShaderAttribute(String attrName) { + ShaderAttribute(String attrName) { if (attrName == null) { throw new NullPointerException(); } @@ -90,7 +90,7 @@ public abstract class ShaderAttribute extends NodeComponent { public String getAttributeName() { return ((ShaderAttributeRetained)this.retained).getAttributeName(); - + } } diff --git a/src/classes/share/javax/media/j3d/ShaderAttributeArray.java b/src/classes/share/javax/media/j3d/ShaderAttributeArray.java index b4cba15..2b1889e 100644 --- a/src/classes/share/javax/media/j3d/ShaderAttributeArray.java +++ b/src/classes/share/javax/media/j3d/ShaderAttributeArray.java @@ -98,7 +98,7 @@ public class ShaderAttributeArray extends ShaderAttributeObject { if (isLiveOrCompiled()) if (!this.getCapability(ALLOW_VALUE_WRITE)) throw new CapabilityNotSetException(J3dI18N.getString("ShaderAttributeObject1")); - + if (isLive()) ((ShaderAttributeArrayRetained)this.retained).setValue(value); else @@ -120,7 +120,7 @@ public class ShaderAttributeArray extends ShaderAttributeObject { * the same base class as the individual elements of the array object * used to construct this shader attribute object. * - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ public void setValue(int index, Object value) { @@ -144,7 +144,7 @@ public class ShaderAttributeArray extends ShaderAttributeObject { * * @return the number of elements in the value array * - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ public int length() { diff --git a/src/classes/share/javax/media/j3d/ShaderAttributeArrayRetained.java b/src/classes/share/javax/media/j3d/ShaderAttributeArrayRetained.java index 4b3c630..c852e82 100644 --- a/src/classes/share/javax/media/j3d/ShaderAttributeArrayRetained.java +++ b/src/classes/share/javax/media/j3d/ShaderAttributeArrayRetained.java @@ -53,7 +53,7 @@ class ShaderAttributeArrayRetained extends ShaderAttributeObjectRetained { } - + /** * Sets the specified array element of the value of this shader * attribute to the specified value. @@ -67,16 +67,16 @@ class ShaderAttributeArrayRetained extends ShaderAttributeObjectRetained { * the same base class as the individual elements of the array object * used to construct this shader attribute object. * - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ void setValue(int index, Object value) { initValue(index, value); // We should only need to update the array instead of replacing it. - // Until this become a really bottleneck, it will just be a convenience - // method for end user. - // An efficient approach is to - // (1) Create a new ShaderAttributeValue object for the "value" object + // Until this become a really bottleneck, it will just be a convenience + // method for end user. + // An efficient approach is to + // (1) Create a new ShaderAttributeValue object for the "value" object // and pass it to sendMessage(), (2) Create a new sendMessage that take in // a third arguement, ie. index. setValue(attrWrapper.getRef()); @@ -87,7 +87,7 @@ class ShaderAttributeArrayRetained extends ShaderAttributeObjectRetained { * * @return the number of elements in the value array * - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ int length() { @@ -105,7 +105,7 @@ class ShaderAttributeArrayRetained extends ShaderAttributeObjectRetained { mirrorSAA.createObjectData(getValue()); mirror = mirrorSAA; mirror.source = source; - + } initMirrorObject(); } diff --git a/src/classes/share/javax/media/j3d/ShaderAttributeObject.java b/src/classes/share/javax/media/j3d/ShaderAttributeObject.java index d50aa00..604c138 100644 --- a/src/classes/share/javax/media/j3d/ShaderAttributeObject.java +++ b/src/classes/share/javax/media/j3d/ShaderAttributeObject.java @@ -91,7 +91,7 @@ public abstract class ShaderAttributeObject extends ShaderAttribute { * Package scope constructor */ ShaderAttributeObject(String attrName, Object value) { - super(attrName); + super(attrName); // set default read capabilities setDefaultReadCapabilities(readCapabilities); @@ -106,7 +106,7 @@ public abstract class ShaderAttributeObject extends ShaderAttribute { * * @return a copy of the value of this shader attribute * - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ public abstract Object getValue(); @@ -123,7 +123,7 @@ public abstract class ShaderAttributeObject extends ShaderAttribute { * the same base class as the object used to construct this shader * attribute object. * - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ public abstract void setValue(Object value); @@ -138,7 +138,7 @@ public abstract class ShaderAttributeObject extends ShaderAttribute { * * @return the base class of the value of this shader attribute * - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ public Class getValueClass() { diff --git a/src/classes/share/javax/media/j3d/ShaderAttributeObjectRetained.java b/src/classes/share/javax/media/j3d/ShaderAttributeObjectRetained.java index cab19ff..f343d7b 100644 --- a/src/classes/share/javax/media/j3d/ShaderAttributeObjectRetained.java +++ b/src/classes/share/javax/media/j3d/ShaderAttributeObjectRetained.java @@ -53,18 +53,18 @@ abstract class ShaderAttributeObjectRetained extends ShaderAttributeRetained { } void createObjectData(Object value) { - + classType = computeClassType(value); baseClass = getBaseClass(classType); - attrWrapper = createAttrWrapper(value, classType); + attrWrapper = createAttrWrapper(value, classType); /* System.err.println(" classType = " + classType + ", baseClass = " + baseClass + ", attrWrapper.get() = " + attrWrapper.get()); - */ + */ } - - + + void initValue(Object value) { /* System.err.println("ShaderAttributeObjectRetained : attrName = " + attrName + @@ -98,7 +98,7 @@ abstract class ShaderAttributeObjectRetained extends ShaderAttributeRetained { */ void setValue(Object value) { initValue(value); - AttrWrapper valueWrapper = createAttrWrapper(value, this.classType); + AttrWrapper valueWrapper = createAttrWrapper(value, this.classType); sendMessage(ShaderConstants.ATTRIBUTE_VALUE_UPDATE, valueWrapper); } @@ -115,15 +115,15 @@ abstract class ShaderAttributeObjectRetained extends ShaderAttributeRetained { Class getValueClass() { return baseClass; } - + /** * Initializes a mirror object. */ synchronized void initMirrorObject() { - super.initMirrorObject(); + super.initMirrorObject(); ((ShaderAttributeObjectRetained)mirror).initValue(getValue()); } - + /** * Update the "component" field of the mirror object with the given "value" */ @@ -136,11 +136,11 @@ abstract class ShaderAttributeObjectRetained extends ShaderAttributeRetained { mirrorSAV.attrWrapper = (AttrWrapper) value; } } - + final void sendMessage(int attrMask, Object attr) { - + ArrayList univList = new ArrayList(); - ArrayList gaList = Shape3DRetained.getGeomAtomsList(mirror.users, univList); + ArrayList gaList = Shape3DRetained.getGeomAtomsList(mirror.users, univList); // Send to rendering attribute structure, regardless of // whether there are users or not (alternate appearance case ..) @@ -160,7 +160,7 @@ abstract class ShaderAttributeObjectRetained extends ShaderAttributeRetained { createMessage = new J3dMessage(); createMessage.threads = J3dThread.UPDATE_RENDER; createMessage.type = J3dMessage.SHADER_ATTRIBUTE_CHANGED; - + createMessage.universe = (VirtualUniverse) univList.get(i); createMessage.args[0] = this; createMessage.args[1]= new Integer(attrMask); @@ -169,14 +169,14 @@ abstract class ShaderAttributeObjectRetained extends ShaderAttributeRetained { ArrayList gL = (ArrayList)gaList.get(i); GeometryAtom[] gaArr = new GeometryAtom[gL.size()]; gL.toArray(gaArr); - createMessage.args[3] = gaArr; - + createMessage.args[3] = gaArr; + VirtualUniverse.mc.processMessage(createMessage); } } - - + + // Enumerated types representing allowed classes for shader // attributes. // diff --git a/src/classes/share/javax/media/j3d/ShaderAttributeSet.java b/src/classes/share/javax/media/j3d/ShaderAttributeSet.java index c13cda2..099adb1 100644 --- a/src/classes/share/javax/media/j3d/ShaderAttributeSet.java +++ b/src/classes/share/javax/media/j3d/ShaderAttributeSet.java @@ -99,7 +99,7 @@ public class ShaderAttributeSet extends NodeComponent { private static final int[] readCapabilities = { ALLOW_ATTRIBUTES_READ }; - + /** * Constructs an empty ShaderAttributeSet object. The attributes set * is initially empty. @@ -123,7 +123,7 @@ public class ShaderAttributeSet extends NodeComponent { * * @exception NullPointerException if attr is null * - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ public void put(ShaderAttribute attr) { @@ -134,7 +134,7 @@ public class ShaderAttributeSet extends NodeComponent { if (isLiveOrCompiled()) if (!this.getCapability(ALLOW_ATTRIBUTES_WRITE)) throw new CapabilityNotSetException(J3dI18N.getString("ShaderAttributeSet1")); - + ((ShaderAttributeSetRetained)this.retained).put(attr); } @@ -152,7 +152,7 @@ public class ShaderAttributeSet extends NodeComponent { * attribute name, or null if the name is not in the attributes * set * - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ public ShaderAttribute get(String attrName) { @@ -177,18 +177,18 @@ public class ShaderAttributeSet extends NodeComponent { * * @exception NullPointerException if attrName is null * - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ public void remove(String attrName) { if (attrName == null) { throw new NullPointerException(); } - + if (isLiveOrCompiled()) if (!this.getCapability(ALLOW_ATTRIBUTES_WRITE)) throw new CapabilityNotSetException(J3dI18N.getString("ShaderAttributeSet1")); - + ((ShaderAttributeSetRetained)this.retained).remove(attrName); } @@ -205,7 +205,7 @@ public class ShaderAttributeSet extends NodeComponent { * * @exception NullPointerException if attr is null * - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ public void remove(ShaderAttribute attr) { @@ -224,7 +224,7 @@ public class ShaderAttributeSet extends NodeComponent { * Removes all shader attributes from the attributes set. The * attributes set will be empty following this call. * - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ public void clear() { @@ -241,7 +241,7 @@ public class ShaderAttributeSet extends NodeComponent { * * @return a shallow copy of the attributes set * - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ public ShaderAttribute[] getAll() { @@ -258,7 +258,7 @@ public class ShaderAttributeSet extends NodeComponent { * * @return the number of elements in the attributes set * - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ public int size() { @@ -266,7 +266,7 @@ public class ShaderAttributeSet extends NodeComponent { if (isLiveOrCompiled()) if (!this.getCapability(ALLOW_ATTRIBUTES_READ)) throw new CapabilityNotSetException(J3dI18N.getString("ShaderAttributeSet0")); - + return ((ShaderAttributeSetRetained)this.retained).size(); } diff --git a/src/classes/share/javax/media/j3d/ShaderAttributeSetRetained.java b/src/classes/share/javax/media/j3d/ShaderAttributeSetRetained.java index e586942..535de63 100644 --- a/src/classes/share/javax/media/j3d/ShaderAttributeSetRetained.java +++ b/src/classes/share/javax/media/j3d/ShaderAttributeSetRetained.java @@ -77,13 +77,13 @@ class ShaderAttributeSetRetained extends NodeComponentRetained { // System.err.println("attrName is " + sAttr.attrName + " attr.Retained is "+ sAttr ); assert(sAttr != null); attrs.put(sAttr.attrName, sAttr); - + if (source.isLive()) { sAttr.setLive(inBackgroundGroup, refCount); sAttr.copyMirrorUsers(this); - + sendMessage(ShaderConstants.ATTRIBUTE_SET_PUT, sAttr.mirror); - } + } } } @@ -94,7 +94,7 @@ class ShaderAttributeSetRetained extends NodeComponentRetained { * * @param attrName the name of the shader attribute to be retrieved * - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ ShaderAttribute get(String attrName) { @@ -115,7 +115,7 @@ class ShaderAttributeSetRetained extends NodeComponentRetained { if (source.isLive()) { sAttr.clearLive(refCount); sAttr.removeMirrorUsers(this); - + sendMessage(ShaderConstants.ATTRIBUTE_SET_REMOVE, attrName); } } @@ -133,14 +133,14 @@ class ShaderAttributeSetRetained extends NodeComponentRetained { * @param attr the shader attribute to be removed */ void remove(ShaderAttribute attr) { - synchronized(liveStateLock) { + synchronized(liveStateLock) { String attrName = attr.getAttributeName(); if (attrs.get(attrName) == attr.retained) { attrs.remove(attrName); if (source.isLive()) { ((ShaderAttributeRetained)attr.retained).clearLive(refCount); ((ShaderAttributeRetained)attr.retained).removeMirrorUsers(this); - + sendMessage(ShaderConstants.ATTRIBUTE_SET_REMOVE, attrName); } } @@ -181,7 +181,7 @@ class ShaderAttributeSetRetained extends NodeComponentRetained { for(int i=0; i < sAttrsRetained.length; i++) { sAttrs[i] = (ShaderAttribute) sAttrsRetained[i].source; } - + return sAttrs; } @@ -196,24 +196,24 @@ class ShaderAttributeSetRetained extends NodeComponentRetained { } - void updateNative(Canvas3D cv, ShaderProgramRetained shaderProgram) { + void updateNative(Canvas3D cv, ShaderProgramRetained shaderProgram) { shaderProgram.setShaderAttributes(cv, this); } Map getAttrs() { return attrs; } - + void setLive(boolean backgroundGroup, int refCount) { - + // System.err.println("ShaderAttributeSetRetained.setLive()"); ShaderAttributeRetained[] sAttrsRetained = new ShaderAttributeRetained[attrs.size()]; sAttrsRetained = (ShaderAttributeRetained[])attrs.values().toArray(sAttrsRetained); for(int i=0; i < sAttrsRetained.length; i++) { sAttrsRetained[i].setLive(backgroundGroup, refCount); } - + super.doSetLive(backgroundGroup, refCount); super.markAsLive(); } @@ -225,7 +225,7 @@ class ShaderAttributeSetRetained extends NodeComponentRetained { ShaderAttributeRetained[] sAttrsRetained = new ShaderAttributeRetained[attrs.size()]; sAttrsRetained = (ShaderAttributeRetained[])attrs.values().toArray(sAttrsRetained); for(int i=0; i < sAttrsRetained.length; i++) { - sAttrsRetained[i].addAMirrorUser(shape); + sAttrsRetained[i].addAMirrorUser(shape); } } @@ -256,15 +256,15 @@ class ShaderAttributeSetRetained extends NodeComponentRetained { ShaderAttributeRetained[] sAttrsRetained = new ShaderAttributeRetained[attrs.size()]; sAttrsRetained = (ShaderAttributeRetained[])attrs.values().toArray(sAttrsRetained); for(int i=0; i < sAttrsRetained.length; i++) { - sAttrsRetained[i].copyMirrorUsers(node); + sAttrsRetained[i].copyMirrorUsers(node); } } void clearLive(int refCount) { // System.err.println("ShaderAttributeSetRetained.clearLive()"); - + super.clearLive(refCount); - + ShaderAttributeRetained[] sAttrsRetained = new ShaderAttributeRetained[attrs.size()]; sAttrsRetained = (ShaderAttributeRetained[])attrs.values().toArray(sAttrsRetained); for(int i=0; i < sAttrsRetained.length; i++) { @@ -283,28 +283,28 @@ class ShaderAttributeSetRetained extends NodeComponentRetained { } initMirrorObject(); } - + void initMirrorObject() { ShaderAttributeRetained[] sAttrs = new ShaderAttributeRetained[attrs.size()]; sAttrs = (ShaderAttributeRetained[])attrs.values().toArray(sAttrs); - // Need to copy the mirror attrs + // Need to copy the mirror attrs for (int i = 0; i < sAttrs.length; i++) { ShaderAttributeRetained mirrorSA = (ShaderAttributeRetained) sAttrs[i].mirror; assert(mirrorSA != null); ((ShaderAttributeSetRetained)mirror).attrs.put(mirrorSA.attrName, mirrorSA); } } - + /** * Update the "component" field of the mirror object with the given "value" */ synchronized void updateMirrorObject(int component, Object value) { // System.err.println("ShaderAttributeSetRetained : updateMirrorObject"); - + ShaderAttributeSetRetained mirrorSAS = (ShaderAttributeSetRetained)mirror; - + if ((component & ShaderConstants.ATTRIBUTE_SET_PUT) != 0) { // System.err.println(" -- ATTRIBUTE_SET_PUT"); ShaderAttributeRetained mirrorSA = (ShaderAttributeRetained)value; @@ -322,12 +322,12 @@ class ShaderAttributeSetRetained extends NodeComponentRetained { else { assert(false); } - } + } final void sendMessage(int attrMask, Object attr) { ArrayList univList = new ArrayList(); - ArrayList gaList = Shape3DRetained.getGeomAtomsList(mirror.users, univList); + ArrayList gaList = Shape3DRetained.getGeomAtomsList(mirror.users, univList); // Send to rendering attribute structure, regardless of // whether there are users or not (alternate appearance case ..) @@ -347,7 +347,7 @@ class ShaderAttributeSetRetained extends NodeComponentRetained { createMessage = new J3dMessage(); createMessage.threads = J3dThread.UPDATE_RENDER; createMessage.type = J3dMessage.SHADER_ATTRIBUTE_SET_CHANGED; - + createMessage.universe = (VirtualUniverse) univList.get(i); createMessage.args[0] = this; createMessage.args[1]= new Integer(attrMask); @@ -356,8 +356,8 @@ class ShaderAttributeSetRetained extends NodeComponentRetained { ArrayList gL = (ArrayList)gaList.get(i); GeometryAtom[] gaArr = new GeometryAtom[gL.size()]; gL.toArray(gaArr); - createMessage.args[3] = gaArr; - + createMessage.args[3] = gaArr; + VirtualUniverse.mc.processMessage(createMessage); } diff --git a/src/classes/share/javax/media/j3d/ShaderAttributeValue.java b/src/classes/share/javax/media/j3d/ShaderAttributeValue.java index ef0faf8..fe900ee 100644 --- a/src/classes/share/javax/media/j3d/ShaderAttributeValue.java +++ b/src/classes/share/javax/media/j3d/ShaderAttributeValue.java @@ -78,10 +78,10 @@ public class ShaderAttributeValue extends ShaderAttributeObject { public ShaderAttributeValue(String attrName, Object value) { super(attrName, value); } - + // Implement abstract getValue method public Object getValue() { - + if (isLiveOrCompiled()) if (!this.getCapability(ALLOW_VALUE_READ)) throw new CapabilityNotSetException(J3dI18N.getString("ShaderAttributeObject0")); @@ -95,7 +95,7 @@ public class ShaderAttributeValue extends ShaderAttributeObject { if (value == null) { throw new NullPointerException(); } - + if (isLiveOrCompiled()) if (!this.getCapability(ALLOW_VALUE_WRITE)) throw new CapabilityNotSetException(J3dI18N.getString("ShaderAttributeObject1")); diff --git a/src/classes/share/javax/media/j3d/ShaderAttributeValueRetained.java b/src/classes/share/javax/media/j3d/ShaderAttributeValueRetained.java index 60d7202..56dc1e9 100644 --- a/src/classes/share/javax/media/j3d/ShaderAttributeValueRetained.java +++ b/src/classes/share/javax/media/j3d/ShaderAttributeValueRetained.java @@ -42,7 +42,7 @@ class ShaderAttributeValueRetained extends ShaderAttributeObjectRetained { ShaderAttributeValueRetained() { } - + synchronized void createMirrorObject() { // System.err.println("ShaderAttributeValueRetained : createMirrorObject"); // This method should only call by setLive(). diff --git a/src/classes/share/javax/media/j3d/ShaderBin.java b/src/classes/share/javax/media/j3d/ShaderBin.java index 133d9fb..1143b49 100644 --- a/src/classes/share/javax/media/j3d/ShaderBin.java +++ b/src/classes/share/javax/media/j3d/ShaderBin.java @@ -37,7 +37,7 @@ import java.util.HashMap; import java.util.ArrayList; -// XXXX : We should have a common Bin object that all other Bins extend from. +// XXXX : We should have a common Bin object that all other Bins extend from. //class ShaderBin extends Object implements ObjectUpdate, NodeComponentUpdate { @@ -85,11 +85,11 @@ class ShaderBin implements ObjectUpdate { ShaderAppearanceRetained shaderAppearance = null; ShaderProgramRetained shaderProgram = null; ShaderAttributeSetRetained shaderAttributeSet = new ShaderAttributeSetRetained(); - + ShaderBin(ShaderAppearanceRetained sApp, RenderBin rBin) { reset(sApp, rBin); } - + void reset(ShaderAppearanceRetained sApp, RenderBin rBin) { prev = null; next = null; @@ -101,7 +101,7 @@ class ShaderBin implements ObjectUpdate { addTextureBins.clear(); if(sApp != null) { shaderProgram = sApp.shaderProgram; - shaderAttributeSet = sApp.shaderAttributeSet; + shaderAttributeSet = sApp.shaderAttributeSet; } else { shaderProgram = null; @@ -109,19 +109,19 @@ class ShaderBin implements ObjectUpdate { } shaderAppearance = sApp; } - + void clear() { reset(null, null); } - + /** * This tests if the qiven ra.shaderProgram match this shaderProgram */ boolean equals(ShaderAppearanceRetained sApp) { - + ShaderProgramRetained sp; ShaderAttributeSetRetained ss; - + if (sApp == null) { sp = null; ss = null; @@ -129,19 +129,19 @@ class ShaderBin implements ObjectUpdate { sp = sApp.shaderProgram; ss = sApp.shaderAttributeSet; } - + if((shaderProgram != sp) || (shaderAttributeSet != ss)) { return false; } - + return true; - + } public void updateObject() { TextureBin t; int i; - + if (addTextureBins.size() > 0) { t = (TextureBin)addTextureBins.get(0); if (textureBinList == null) { @@ -150,8 +150,8 @@ class ShaderBin implements ObjectUpdate { } else { // Look for a TextureBin that has the same texture - insertTextureBin(t); - } + insertTextureBin(t); + } for (i = 1; i < addTextureBins.size() ; i++) { t = (TextureBin)addTextureBins.get(i); // Look for a TextureBin that has the same texture @@ -163,7 +163,7 @@ class ShaderBin implements ObjectUpdate { onUpdateList = false; } - + void insertTextureBin(TextureBin t) { TextureBin tb; int i; @@ -177,26 +177,26 @@ class ShaderBin implements ObjectUpdate { // use the texture in the first texture unit as the sorting criteria if (texture != null) { - tb = textureBinList; - while (tb != null) { + tb = textureBinList; + while (tb != null) { if (tb.texUnitState == null || tb.texUnitState[0] == null || tb.texUnitState[0].texture != texture) { tb = tb.next; } else { - // put it here - t.next = tb; - t.prev = tb.prev; - if (tb.prev == null) { - textureBinList = t; - } - else { - tb.prev.next = t; - } - tb.prev = t; - return; - } + // put it here + t.next = tb; + t.prev = tb.prev; + if (tb.prev == null) { + textureBinList = t; + } + else { + tb.prev.next = t; + } + tb.prev = t; + return; + } } - } + } // Just put it up front t.prev = null; t.next = textureBinList; @@ -245,7 +245,7 @@ class ShaderBin implements ObjectUpdate { * Adds the given TextureBin to this AttributeBin. */ void addTextureBin(TextureBin t, RenderBin rb, RenderAtom ra) { - + t.environmentSet = this.attributeBin.environmentSet; t.attributeBin = this.attributeBin; t.shaderBin = this; @@ -263,8 +263,8 @@ class ShaderBin implements ObjectUpdate { * Removes the given TextureBin from this ShaderBin. */ void removeTextureBin(TextureBin t) { - - // If the TextureBin being remove is contained in addTextureBins, + + // If the TextureBin being remove is contained in addTextureBins, // then remove the TextureBin from the addList if (addTextureBins.contains(t)) { addTextureBins.remove(addTextureBins.indexOf(t)); @@ -302,7 +302,7 @@ class ShaderBin implements ObjectUpdate { void render(Canvas3D cv) { TextureBin tb; - + // System.err.println("ShaderBin.render() shaderProgram = " + shaderProgram); // include this ShaderBin to the to-be-updated list in canvas @@ -314,7 +314,7 @@ class ShaderBin implements ObjectUpdate { tb = tb.next; } } - + void updateAttributes(Canvas3D cv) { // System.err.println("ShaderBin.updateAttributes() shaderProgram is " + shaderProgram); @@ -340,9 +340,9 @@ class ShaderBin implements ObjectUpdate { void updateNodeComponent() { // System.err.println("ShaderBin.updateNodeComponent() ..."); - - // We don't need to clone shaderProgram. - // ShaderProgram object can't be modified once it is live, + + // We don't need to clone shaderProgram. + // ShaderProgram object can't be modified once it is live, // so each update should be a new reference. if ((componentDirty & SHADER_PROGRAM_DIRTY) != 0) { // System.err.println(" - SHADER_PROGRAM_DIRTY"); @@ -360,7 +360,7 @@ class ShaderBin implements ObjectUpdate { attrs.putAll(shaderAppearance.shaderAttributeSet.getAttrs()); } } - + componentDirty = 0; } diff --git a/src/classes/share/javax/media/j3d/ShaderProgram.java b/src/classes/share/javax/media/j3d/ShaderProgram.java index 7ed29aa..8fb2af8 100644 --- a/src/classes/share/javax/media/j3d/ShaderProgram.java +++ b/src/classes/share/javax/media/j3d/ShaderProgram.java @@ -69,9 +69,9 @@ public abstract class ShaderProgram extends NodeComponent { // Array for setting default read capabilities private static final int[] readCapabilities = { ALLOW_SHADERS_READ, - ALLOW_NAMES_READ + ALLOW_NAMES_READ }; - + /* * Default values (copied from GeometryArray.java): * @@ -178,7 +178,7 @@ public abstract class ShaderProgram extends NodeComponent { * shaders array is null. */ public abstract void setShaders(Shader[] shaders); - + /** * Retrieves the array of shaders from this shader program. A * shallow copy of the array is returned. The return value may diff --git a/src/classes/share/javax/media/j3d/ShaderProgramRetained.java b/src/classes/share/javax/media/j3d/ShaderProgramRetained.java index 67d6018..84de223 100644 --- a/src/classes/share/javax/media/j3d/ShaderProgramRetained.java +++ b/src/classes/share/javax/media/j3d/ShaderProgramRetained.java @@ -35,9 +35,9 @@ import java.util.*; import javax.vecmath.*; /** - * The ShaderProgramRetained object is a component object of an AppearanceRetained + * The ShaderProgramRetained object is a component object of an AppearanceRetained * object that defines the shader properties used when programmable shader is - * enabled. ShaderProgramRetained object is an abstract class. All shader program + * enabled. ShaderProgramRetained object is an abstract class. All shader program * objects must be created as either a GLSLShaderProgramRetained object or a * CgShaderProgramRetained object. */ @@ -67,13 +67,13 @@ abstract class ShaderProgramRetained extends NodeComponentRetained { // an array of (uniform) shader attribute names protected String[] shaderAttrNames; - + // Set of ShaderAttribute objects for which we have already reported an error private HashSet shaderAttrErrorSet = null; - // need to synchronize access from multiple rendering threads + // need to synchronize access from multiple rendering threads Object resourceLock = new Object(); - + // Package-scope default constructor ShaderProgramRetained() { } @@ -112,8 +112,8 @@ abstract class ShaderProgramRetained extends NodeComponentRetained { if (vertexAttrNames == null) { return null; - } - + } + return (String[])vertexAttrNames.clone(); } @@ -152,8 +152,8 @@ abstract class ShaderProgramRetained extends NodeComponentRetained { if (shaderAttrNames == null) { return null; - } - + } + return (String[])shaderAttrNames.clone(); } @@ -184,7 +184,7 @@ abstract class ShaderProgramRetained extends NodeComponentRetained { this.shaders = null; return; } - + this.shaders = new ShaderRetained[shaders.length]; // Copy vertex and fragment shader @@ -207,7 +207,7 @@ abstract class ShaderProgramRetained extends NodeComponentRetained { if (shaders == null) { return null; } else { - Shader shads[] = + Shader shads[] = new Shader[shaders.length]; for (int i = 0; i < shaders.length; i++) { if (shaders[i] != null) { @@ -223,7 +223,7 @@ abstract class ShaderProgramRetained extends NodeComponentRetained { /** * Method to create the native shader. */ - abstract ShaderError createShader(Context ctx, ShaderRetained shader, ShaderId[] shaderIdArr); + abstract ShaderError createShader(Context ctx, ShaderRetained shader, ShaderId[] shaderIdArr); /** * Method to destroy the native shader. @@ -260,7 +260,7 @@ abstract class ShaderProgramRetained extends NodeComponentRetained { * information about the attributes. */ abstract void lookupShaderAttrNames(Context ctx, ShaderProgramId shaderProgramId, String[] attrNames, AttrNameInfo[] attrNameInfoArr); - + /* * Method to lookup a list of vertex attribute names. */ @@ -270,54 +270,54 @@ abstract class ShaderProgramRetained extends NodeComponentRetained { * Method to use the native shader program. */ abstract ShaderError enableShaderProgram(Context ctx, ShaderProgramId shaderProgramId); - + /** * Method to disable the native shader program. */ abstract ShaderError disableShaderProgram(Context ctx); - + // ShaderAttributeValue methods abstract ShaderError setUniform1i(Context ctx, ShaderProgramId shaderProgramId, ShaderAttrLoc uniformLocation, int value); - + abstract ShaderError setUniform1f(Context ctx, ShaderProgramId shaderProgramId, ShaderAttrLoc uniformLocation, float value); - + abstract ShaderError setUniform2i(Context ctx, ShaderProgramId shaderProgramId, ShaderAttrLoc uniformLocation, int[] value); - + abstract ShaderError setUniform2f(Context ctx, ShaderProgramId shaderProgramId, ShaderAttrLoc uniformLocation, float[] value); - + abstract ShaderError setUniform3i(Context ctx, ShaderProgramId shaderProgramId, ShaderAttrLoc uniformLocation, int[] value); - + abstract ShaderError setUniform3f(Context ctx, ShaderProgramId shaderProgramId, ShaderAttrLoc uniformLocation, - float[] value); - + float[] value); + abstract ShaderError setUniform4i(Context ctx, ShaderProgramId shaderProgramId, ShaderAttrLoc uniformLocation, int[] value); - + abstract ShaderError setUniform4f(Context ctx, ShaderProgramId shaderProgramId, ShaderAttrLoc uniformLocation, - float[] value); - + float[] value); + abstract ShaderError setUniformMatrix3f(Context ctx, ShaderProgramId shaderProgramId, ShaderAttrLoc uniformLocation, @@ -330,55 +330,55 @@ abstract class ShaderProgramRetained extends NodeComponentRetained { // ShaderAttributeArray methods - + abstract ShaderError setUniform1iArray(Context ctx, ShaderProgramId shaderProgramId, ShaderAttrLoc uniformLocation, int numElements, int[] value); - + abstract ShaderError setUniform1fArray(Context ctx, ShaderProgramId shaderProgramId, ShaderAttrLoc uniformLocation, int numElements, float[] value); - + abstract ShaderError setUniform2iArray(Context ctx, ShaderProgramId shaderProgramId, ShaderAttrLoc uniformLocation, int numElements, int[] value); - + abstract ShaderError setUniform2fArray(Context ctx, ShaderProgramId shaderProgramId, ShaderAttrLoc uniformLocation, int numElements, float[] value); - + abstract ShaderError setUniform3iArray(Context ctx, ShaderProgramId shaderProgramId, ShaderAttrLoc uniformLocation, int numElements, int[] value); - + abstract ShaderError setUniform3fArray(Context ctx, ShaderProgramId shaderProgramId, ShaderAttrLoc uniformLocation, int numElements, - float[] value); - + float[] value); + abstract ShaderError setUniform4iArray(Context ctx, ShaderProgramId shaderProgramId, ShaderAttrLoc uniformLocation, int numElements, int[] value); - + abstract ShaderError setUniform4fArray(Context ctx, ShaderProgramId shaderProgramId, ShaderAttrLoc uniformLocation, int numElements, - float[] value); - + float[] value); + abstract ShaderError setUniformMatrix3fArray(Context ctx, ShaderProgramId shaderProgramId, ShaderAttrLoc uniformLocation, @@ -391,7 +391,7 @@ abstract class ShaderProgramRetained extends NodeComponentRetained { int numElements, float[] value); - + /** * Method to return a flag indicating whether this * ShaderProgram is supported on the specified Canvas. @@ -400,7 +400,7 @@ abstract class ShaderProgramRetained extends NodeComponentRetained { void setLive(boolean backgroundGroup, int refCount) { - + // System.err.println("ShaderProgramRetained.setLive()"); if (shaders != null) { @@ -408,7 +408,7 @@ abstract class ShaderProgramRetained extends NodeComponentRetained { shaders[i].setLive(backgroundGroup, refCount); } } - + super.doSetLive(backgroundGroup, refCount); super.markAsLive(); @@ -433,7 +433,7 @@ abstract class ShaderProgramRetained extends NodeComponentRetained { private ShaderError enableShaderProgram(Canvas3D cv, int cvRdrIndex) { assert(cvRdrIndex >= 0); synchronized(resourceLock) { - return enableShaderProgram(cv.ctx, + return enableShaderProgram(cv.ctx, shaderProgramData[cvRdrIndex].getShaderProgramId()); } @@ -445,12 +445,12 @@ abstract class ShaderProgramRetained extends NodeComponentRetained { private ShaderError disableShaderProgram(Canvas3D cv) { return disableShaderProgram(cv.ctx); } - + /** * Initializes a mirror object. */ synchronized void initMirrorObject() { - + // Create mirror copy of shaders if (this.shaders == null) { ((ShaderProgramRetained)mirror).shaders = null; @@ -464,7 +464,7 @@ abstract class ShaderProgramRetained extends NodeComponentRetained { } } ((ShaderProgramRetained)mirror).shaderProgramData = null; - + // Create mirror copy of vertex attribute names if (this.vertexAttrNames == null) { ((ShaderProgramRetained)mirror).vertexAttrNames = null; @@ -472,7 +472,7 @@ abstract class ShaderProgramRetained extends NodeComponentRetained { else { ((ShaderProgramRetained)mirror).vertexAttrNames = (String[])this.vertexAttrNames.clone(); } - + // Create mirror copy of shader attribute names if (this.shaderAttrNames == null) { ((ShaderProgramRetained)mirror).shaderAttrNames = null; @@ -480,20 +480,20 @@ abstract class ShaderProgramRetained extends NodeComponentRetained { else { ((ShaderProgramRetained)mirror).shaderAttrNames = (String[])this.shaderAttrNames.clone(); } - + // Clear shader attribute error set ((ShaderProgramRetained)mirror).shaderAttrErrorSet = null; } - + /** * Update the "component" field of the mirror object with the given "value" */ synchronized void updateMirrorObject(int component, Object value) { - + // ShaderProgram can't be modified once it is live. - assert(false); + assert(false); System.err.println("ShaderProgramRetained : updateMirrorObject NOT IMPLEMENTED YET"); - } + } /** * Method to create a ShaderProgramData object for the specified @@ -545,14 +545,14 @@ abstract class ShaderProgramRetained extends NodeComponentRetained { } shaderProgramData[cvRdrIndex].setShaderProgramId(spIdArr[0]); } - + return null; } /** * Method to link the native shader program. */ - private ShaderError linkShaderProgram(Canvas3D cv, int cvRdrIndex, + private ShaderError linkShaderProgram(Canvas3D cv, int cvRdrIndex, ShaderRetained[] shaders) { synchronized(resourceLock) { ShaderId[] shaderIds = new ShaderId[shaders.length]; @@ -561,8 +561,8 @@ abstract class ShaderProgramRetained extends NodeComponentRetained { shaderIds[i] = shaders[i].shaderData[cvRdrIndex].getShaderId(); } } - ShaderError err = - linkShaderProgram(cv.ctx, + ShaderError err = + linkShaderProgram(cv.ctx, shaderProgramData[cvRdrIndex].getShaderProgramId(), shaderIds); if(err != null) { @@ -574,7 +574,7 @@ abstract class ShaderProgramRetained extends NodeComponentRetained { return null; } - + private ShaderError bindVertexAttrName(Canvas3D cv, int cvRdrIndex, String attrName, int attrIndex) { assert(attrName != null); synchronized(resourceLock) { @@ -587,14 +587,14 @@ abstract class ShaderProgramRetained extends NodeComponentRetained { } return null; } - + private void lookupVertexAttrNames(Canvas3D cv, int cvRdrIndex, String[] attrNames) { synchronized(resourceLock) { ShaderProgramId shaderProgramId = shaderProgramData[cvRdrIndex].getShaderProgramId(); boolean[] errArr = new boolean[attrNames.length]; lookupVertexAttrNames(cv.ctx, shaderProgramId, attrNames, errArr); - + for (int i = 0; i < attrNames.length; i++) { // Report non-fatal error if detected if (errArr[i]) { @@ -615,10 +615,10 @@ abstract class ShaderProgramRetained extends NodeComponentRetained { AttrNameInfo[] attrNameInfoArr = new AttrNameInfo[attrNames.length]; lookupShaderAttrNames(cv.ctx, shaderProgramId, attrNames, attrNameInfoArr); - + for (int i = 0; i < attrNames.length; i++) { shaderProgramData[cvRdrIndex].setAttrNameInfo(attrNames[i], attrNameInfoArr[i]); - + // Report non-fatal error if location is invalid if (attrNameInfoArr[i].getLocation() == null) { String errMsg = "Attribute name lookup failed: " + attrNames[i]; @@ -646,7 +646,7 @@ abstract class ShaderProgramRetained extends NodeComponentRetained { * called createShaderData for this cvRdrIndex. */ private ShaderError createShader(Canvas3D cv, int cvRdrIndex, ShaderRetained shader) { - + // Create shaderProgram resources if it has not been done. synchronized(shader.resourceLock) { if (shader.shaderData[cvRdrIndex].getShaderId() != null) { @@ -668,14 +668,14 @@ abstract class ShaderProgramRetained extends NodeComponentRetained { * Method to compile the native shader. */ private ShaderError compileShader(Canvas3D cv, int cvRdrIndex, ShaderRetained shader) { - + synchronized(shader.resourceLock) { - + if (shader.shaderData[cvRdrIndex].isCompiled()) { // We have already compiled the shaderId for this Canvas. return null; } - + String source = ((SourceCodeShaderRetained)shader).getShaderSource(); ShaderError err = compileShader(cv.ctx, shader.shaderData[cvRdrIndex].getShaderId(), source); if(err != null) { @@ -683,10 +683,10 @@ abstract class ShaderProgramRetained extends NodeComponentRetained { } shader.shaderData[cvRdrIndex].setCompiled(true); } - + return null; } - + /** * Send a message to the notification thread, which will call the * shader error listeners. @@ -698,8 +698,8 @@ abstract class ShaderProgramRetained extends NodeComponentRetained { notification.args[0] = err; VirtualUniverse.mc.sendNotification(notification); } - - + + /** * This method checks whether this ShaderProgram is supported on * the specified Canvas. If it isn't supported, it will report a @@ -735,7 +735,7 @@ abstract class ShaderProgramRetained extends NodeComponentRetained { shader.shaderData[cvRdrIndex] == null) { return; } - + // Nothing to do if the shaderId is null if (shader.shaderData[cvRdrIndex].getShaderId() == null) { return; @@ -756,7 +756,7 @@ abstract class ShaderProgramRetained extends NodeComponentRetained { if (!verifyShaderProgramSupported(cv)) { return; } - + // Destroy shaderProgram resource if it exists synchronized(resourceLock) { assert(shaderProgramData != null && @@ -769,8 +769,8 @@ abstract class ShaderProgramRetained extends NodeComponentRetained { // shaderProgramData[cvRdrIndex] == null) { // return; // } - - ShaderProgramId shaderProgramId = shaderProgramData[cvRdrIndex].getShaderProgramId(); + + ShaderProgramId shaderProgramId = shaderProgramData[cvRdrIndex].getShaderProgramId(); // Nothing to do if the shaderProgramId is null if (shaderProgramId == null) { return; @@ -783,11 +783,11 @@ abstract class ShaderProgramRetained extends NodeComponentRetained { // Reset this ShaderProgramData object. shaderProgramData[cvRdrIndex].reset(); } - } + } /** - * updateNative is called while traversing the RenderBin to + * updateNative is called while traversing the RenderBin to * update the shader program state */ void updateNative(Canvas3D cv, boolean enable) { @@ -796,7 +796,7 @@ abstract class ShaderProgramRetained extends NodeComponentRetained { final boolean useSharedCtx = cv.useSharedCtx && cv.screen.renderer.sharedCtx != null; int cvRdrIndex; long ctxTimeStamp; - + if (useSharedCtx) { cvRdrIndex = cv.screen.renderer.rendererId; ctxTimeStamp = cv.screen.renderer.sharedCtxTimeStamp; @@ -812,7 +812,7 @@ abstract class ShaderProgramRetained extends NodeComponentRetained { if (!verifyShaderProgramSupported(cv)) { return; } - + // Just disable shader program and return if enable parameter is set to false if (!enable) { // Given the current design, disableShaderProgram cannot return a non-null value, @@ -832,10 +832,10 @@ abstract class ShaderProgramRetained extends NodeComponentRetained { if (getShaderProgramData(cvRdrIndex).getShaderProgramId() == null) { loadShaderProgram = true; } - + //System.err.println(".... loadShaderProgram = " + loadShaderProgram); //System.err.println(".... resourceCreationMask= " + resourceCreationMask); - + ShaderError err = null; boolean errorOccurred = false; if (loadShaderProgram) { @@ -843,7 +843,7 @@ abstract class ShaderProgramRetained extends NodeComponentRetained { // TODO : Need to test useSharedCtx case. ** Untested case ** cv.makeCtxCurrent(cv.screen.renderer.sharedCtx); } - + // Create shader resources if not already done for(int i=0; i < shaders.length; i++) { // Create ShaderProgramData object for this canvas/renderer if it doesn't already exist @@ -875,7 +875,7 @@ abstract class ShaderProgramRetained extends NodeComponentRetained { } } } - + // Create shader program if (!errorOccurred) { err = createShaderProgram(cv, cvRdrIndex); @@ -886,7 +886,7 @@ abstract class ShaderProgramRetained extends NodeComponentRetained { errorOccurred = true; } } - + boolean linked = getShaderProgramData(cvRdrIndex).isLinked(); if (!linked) { // Bind vertex attribute names @@ -904,7 +904,7 @@ abstract class ShaderProgramRetained extends NodeComponentRetained { } } } - + // Link shader program if (!errorOccurred) { err = linkShaderProgram(cv, cvRdrIndex, shaders); @@ -917,14 +917,14 @@ abstract class ShaderProgramRetained extends NodeComponentRetained { errorOccurred = true; } } - + // lookup vertex attribute names if (!errorOccurred) { if (vertexAttrNames != null) { lookupVertexAttrNames(cv, cvRdrIndex, vertexAttrNames); } } - + // Lookup shader attribute names if (!errorOccurred) { if (shaderAttrNames != null) { @@ -933,19 +933,19 @@ abstract class ShaderProgramRetained extends NodeComponentRetained { } } } - + // Restore current context if we changed it to the shareCtx if (useSharedCtx) { cv.makeCtxCurrent(cv.ctx); } - + // If compilation or link error occured, disable shader program and return if (errorOccurred) { disableShaderProgram(cv); return; } } - + // Now we can enable the shader program enableShaderProgram(cv, cvRdrIndex); } @@ -1003,75 +1003,75 @@ abstract class ShaderProgramRetained extends NodeComponentRetained { return null; } } - + /** * Update native value for ShaderAttributeArray class */ ShaderError setUniformAttrArray(Context ctx, ShaderProgramId shaderProgramId, - ShaderAttrLoc loc, ShaderAttributeArrayRetained saa) { + ShaderAttrLoc loc, ShaderAttributeArrayRetained saa) { switch (saa.getClassType()) { case ShaderAttributeObjectRetained.TYPE_INTEGER: return setUniform1iArray(ctx, shaderProgramId, loc, saa.length(), ((int[])saa.attrWrapper.getRef())); - + case ShaderAttributeObjectRetained.TYPE_FLOAT: return setUniform1fArray(ctx, shaderProgramId, loc, saa.length(), ((float[])saa.attrWrapper.getRef())); - + case ShaderAttributeObjectRetained.TYPE_TUPLE2I: return setUniform2iArray(ctx, shaderProgramId, loc, saa.length(), (int[])saa.attrWrapper.getRef()); - + case ShaderAttributeObjectRetained.TYPE_TUPLE2F: return setUniform2fArray(ctx, shaderProgramId, loc, saa.length(), (float[])saa.attrWrapper.getRef()); - + case ShaderAttributeObjectRetained.TYPE_TUPLE3I: return setUniform3iArray(ctx, shaderProgramId, loc, saa.length(), (int[])saa.attrWrapper.getRef()); - + case ShaderAttributeObjectRetained.TYPE_TUPLE3F: return setUniform3fArray(ctx, shaderProgramId, loc, saa.length(), (float[])saa.attrWrapper.getRef()); - + case ShaderAttributeObjectRetained.TYPE_TUPLE4I: return setUniform4iArray(ctx, shaderProgramId, loc, saa.length(), (int[])saa.attrWrapper.getRef()); - + case ShaderAttributeObjectRetained.TYPE_TUPLE4F: return setUniform4fArray(ctx, shaderProgramId, loc, saa.length(), (float[])saa.attrWrapper.getRef()); - + case ShaderAttributeObjectRetained.TYPE_MATRIX3F: return setUniformMatrix3fArray(ctx, shaderProgramId, loc, saa.length(), (float[])saa.attrWrapper.getRef()); - + case ShaderAttributeObjectRetained.TYPE_MATRIX4F: return setUniformMatrix4fArray(ctx, shaderProgramId, loc, saa.length(), (float[])saa.attrWrapper.getRef()); - + default: // Should never get here assert false : "Unrecognized ShaderAttributeArray classType"; return null; } - + } - - + + void setShaderAttributes(Canvas3D cv, ShaderAttributeSetRetained attributeSet) { final boolean useSharedCtx = cv.useSharedCtx && cv.screen.renderer.sharedCtx != null; - final int cvRdrIndex = useSharedCtx ? cv.screen.renderer.rendererId : cv.canvasId; + final int cvRdrIndex = useSharedCtx ? cv.screen.renderer.rendererId : cv.canvasId; ShaderProgramData spData = getShaderProgramData(cvRdrIndex); - + // Just return if shader program wasn't linked successfully if (!spData.isLinked()) { return; } - + ShaderProgramId shaderProgramId = spData.getShaderProgramId(); - + Iterator attrs = attributeSet.getAttrs().values().iterator(); while (attrs.hasNext()) { ShaderError err = null; @@ -1116,7 +1116,7 @@ abstract class ShaderProgramRetained extends NodeComponentRetained { } } } - + if (err != null) { // Before reporting the ShaderAttribute error, check // whether it has already been reported for this ShaderProgram @@ -1133,25 +1133,25 @@ abstract class ShaderProgramRetained extends NodeComponentRetained { } } } - + class ShaderProgramData extends Object { // issue 378 - time stamp of context creation for this Canvas private long ctxTimeStamp; - // shaderProgramId use by native code. + // shaderProgramId use by native code. private ShaderProgramId shaderProgramId = null; - + // linked flag for native. private boolean linked = false; - + // A map of locations for ShaderAttributes. private HashMap attrNameInfoMap = new HashMap(); /** ShaderProgramData Constructor */ ShaderProgramData() { } - + void reset() { ctxTimeStamp = 0L; shaderProgramId = null; @@ -1193,7 +1193,7 @@ abstract class ShaderProgramRetained extends NodeComponentRetained { } } - + // Data associated with an attribute name class AttrNameInfo { void setLocation(ShaderAttrLoc loc) { @@ -1211,7 +1211,7 @@ abstract class ShaderProgramRetained extends NodeComponentRetained { int getType() { return type; } - + boolean isArray() { return isArray; } @@ -1225,7 +1225,7 @@ abstract class ShaderProgramRetained extends NodeComponentRetained { // boolean indicating whether the attribute is an array private boolean isArray; - + // type of shader attribute private int type; } diff --git a/src/classes/share/javax/media/j3d/ShaderRetained.java b/src/classes/share/javax/media/j3d/ShaderRetained.java index 2282805..c6af523 100644 --- a/src/classes/share/javax/media/j3d/ShaderRetained.java +++ b/src/classes/share/javax/media/j3d/ShaderRetained.java @@ -55,7 +55,7 @@ abstract class ShaderRetained extends NodeComponentRetained { // TODO KCR: Add code to clear this in setLive or clearLive boolean compileErrorOccurred = false; - // need to synchronize access from multiple rendering threads + // need to synchronize access from multiple rendering threads Object resourceLock = new Object(); void initializeShader(int shadingLanguage, int shaderType) { @@ -70,7 +70,7 @@ abstract class ShaderRetained extends NodeComponentRetained { int getShaderType() { return shaderType; } - + void setLive(boolean inBackgroundGroup, int refCount) { // System.err.println("SourceCodeShaderRetained.setLive()"); super.setLive(inBackgroundGroup, refCount); @@ -101,7 +101,7 @@ abstract class ShaderRetained extends NodeComponentRetained { shaderData = new ShaderData[cvRdrIndex+1]; } else if (shaderData.length <= cvRdrIndex) { ShaderData[] tempSData = new ShaderData[cvRdrIndex+1]; - + System.arraycopy(shaderData, 0, tempSData, 0, shaderData.length); diff --git a/src/classes/share/javax/media/j3d/Shape3D.java b/src/classes/share/javax/media/j3d/Shape3D.java index 3298311..7c758e4 100644 --- a/src/classes/share/javax/media/j3d/Shape3D.java +++ b/src/classes/share/javax/media/j3d/Shape3D.java @@ -134,10 +134,10 @@ public class Shape3D extends Leaf { private static final int[] readCapabilities = { ALLOW_GEOMETRY_READ, ALLOW_APPEARANCE_READ, - ALLOW_COLLISION_BOUNDS_READ, - ALLOW_APPEARANCE_OVERRIDE_READ + ALLOW_COLLISION_BOUNDS_READ, + ALLOW_APPEARANCE_OVERRIDE_READ }; - + /** * Constructs a Shape3D node with default parameters. The default * values are as follows: @@ -155,7 +155,7 @@ public class Shape3D extends Leaf { */ public Shape3D() { // set default read capabilities - setDefaultReadCapabilities(readCapabilities); + setDefaultReadCapabilities(readCapabilities); } /** @@ -214,7 +214,7 @@ public class Shape3D extends Leaf { if (isLiveOrCompiled()) if (!this.getCapability(ALLOW_COLLISION_BOUNDS_WRITE)) throw new CapabilityNotSetException(J3dI18N.getString("Shape3D0")); - + ((Shape3DRetained)this.retained).setCollisionBounds(bounds); } @@ -233,7 +233,7 @@ public class Shape3D extends Leaf { return ((Shape3DRetained)this.retained).getCollisionBounds(id); } - + /** * Replaces the geometry component at index 0 in this Shape3D node's * list of geometry components with the specified geometry component. @@ -253,7 +253,7 @@ public class Shape3D extends Leaf { if (isLiveOrCompiled()) if (!this.getCapability(ALLOW_GEOMETRY_WRITE)) throw new CapabilityNotSetException(J3dI18N.getString("Shape3D2")); - + ((Shape3DRetained)retained).setGeometry(geometry, 0); } @@ -269,7 +269,7 @@ public class Shape3D extends Leaf { if (isLiveOrCompiled()) if (!this.getCapability(ALLOW_GEOMETRY_READ)) throw new CapabilityNotSetException(J3dI18N.getString("Shape3D3")); - + return ((Shape3DRetained)retained).getGeometry(0, id); } @@ -298,7 +298,7 @@ public class Shape3D extends Leaf { if (isLiveOrCompiled()) if (!this.getCapability(ALLOW_GEOMETRY_WRITE)) throw new CapabilityNotSetException(J3dI18N.getString("Shape3D2")); - + ((Shape3DRetained)retained).setGeometry(geometry, index); } @@ -318,7 +318,7 @@ public class Shape3D extends Leaf { if (isLiveOrCompiled()) if (!this.getCapability(ALLOW_GEOMETRY_READ)) throw new CapabilityNotSetException(J3dI18N.getString("Shape3D3")); - + return ((Shape3DRetained)retained).getGeometry(index, id); } @@ -368,7 +368,7 @@ public class Shape3D extends Leaf { ((Shape3DRetained)retained).removeGeometry(index); } - + /** * Returns an enumeration of this Shape3D node's list of geometry @@ -411,11 +411,11 @@ public class Shape3D extends Leaf { if (isLiveOrCompiled()) if (!this.getCapability(ALLOW_GEOMETRY_WRITE)) throw new CapabilityNotSetException(J3dI18N.getString("Shape3D2")); - + ((Shape3DRetained)retained).addGeometry(geometry); } - + /** * Returns the number of geometry components in this Shape3D node's * list of geometry components. @@ -570,7 +570,7 @@ public class Shape3D extends Leaf { if (isLiveOrCompiled()) { if (!((Shape3DRetained)retained).allowIntersect()) - throw new CapabilityNotSetException(J3dI18N.getString("Shape3D6")); + throw new CapabilityNotSetException(J3dI18N.getString("Shape3D6")); } return ((Shape3DRetained)this.retained).intersect(path, pickRay, dist); @@ -604,7 +604,7 @@ public class Shape3D extends Leaf { if (isLiveOrCompiled()) { if (!((Shape3DRetained)retained).allowIntersect()) - throw new CapabilityNotSetException(J3dI18N.getString("Shape3D6")); + throw new CapabilityNotSetException(J3dI18N.getString("Shape3D6")); } if (pickShape instanceof PickPoint) { @@ -624,7 +624,7 @@ public class Shape3D extends Leaf { * The default value is false. * * @param flag the apperance override enable flag. - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph * * @see AlternateAppearance @@ -644,7 +644,7 @@ public class Shape3D extends Leaf { * Retrieves the appearanceOverrideEnable flag for this node. * @return true if the appearance can be overridden; false * otherwise. - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph * * @since Java 3D 1.2 @@ -711,7 +711,7 @@ public class Shape3D extends Leaf { * <code>false</code>, the value of each node's * <code>duplicateOnCloneTree</code> variable determines whether * NodeComponent data is duplicated or copied. - * @exception ClassCastException if originalNode is not an instance of + * @exception ClassCastException if originalNode is not an instance of * <code>Shape3D</code> * * @see Node#cloneTree @@ -719,7 +719,7 @@ public class Shape3D extends Leaf { * @see NodeComponent#setDuplicateOnCloneTree */ public void duplicateNode(Node originalNode, boolean forceDuplicate) { - checkDuplicateNode(originalNode, forceDuplicate); + checkDuplicateNode(originalNode, forceDuplicate); } @@ -746,26 +746,26 @@ public class Shape3D extends Leaf { * @see NodeComponent#setDuplicateOnCloneTree */ void duplicateAttributes(Node originalNode, boolean forceDuplicate) { - + super.duplicateAttributes(originalNode, forceDuplicate); Shape3DRetained attr = (Shape3DRetained) originalNode.retained; Shape3DRetained rt = (Shape3DRetained) retained; rt.setAppearance((Appearance) getNodeComponent( - attr.getAppearance(), + attr.getAppearance(), forceDuplicate, originalNode.nodeHashtable)); int num = attr.numGeometries(id); if (num > 0) { rt.setGeometry((Geometry) getNodeComponent( attr.getGeometry(0, id), - forceDuplicate, + forceDuplicate, originalNode.nodeHashtable), 0); for(int i=1; i< num; i++) { rt.addGeometry((Geometry) getNodeComponent( attr.getGeometry(i, id), - forceDuplicate, + forceDuplicate, originalNode.nodeHashtable)); } } @@ -789,6 +789,6 @@ public class Shape3D extends Leaf { return ((Shape3DRetained)this.retained).getBounds(); } - + } diff --git a/src/classes/share/javax/media/j3d/Shape3DCompileRetained.java b/src/classes/share/javax/media/j3d/Shape3DCompileRetained.java index 9a650d8..c87e141 100644 --- a/src/classes/share/javax/media/j3d/Shape3DCompileRetained.java +++ b/src/classes/share/javax/media/j3d/Shape3DCompileRetained.java @@ -41,14 +41,14 @@ class Shape3DCompileRetained extends Shape3DRetained { int numShapes = 0; - + // Each element in the arraylist is an array of geometries for a - // particular merged shape + // particular merged shape ArrayList geometryInfo = null; Object[] srcList = null; - + Shape3DCompileRetained(Shape3DRetained[] shapes, int nShapes, int compileFlags) { int i, j; Shape3DRetained shape; @@ -70,7 +70,7 @@ class Shape3DCompileRetained extends Shape3DRetained { boundsAutoCompute = shapes[0].boundsAutoCompute; source = shapes[0].source; } - + // Remove the null that was added by Shape3DRetained constructor geometryList.remove(0); int geoIndex = 0; @@ -85,11 +85,11 @@ class Shape3DCompileRetained extends Shape3DRetained { appearance = shapes[0].appearance; collisionBound = shapes[0].collisionBound; localBounds = shapes[0].localBounds; - + if ((compileFlags & CompileState.GEOMETRY_READ) != 0) geometryInfo = new ArrayList(); - + for (i = 0; i < nShapes; i++) { shape = shapes[i]; ((Shape3D)shape.source).id = i; @@ -121,7 +121,7 @@ class Shape3DCompileRetained extends Shape3DRetained { } } - + // Point to the geometryList's source, so the // retained side will be garbage collected if ((compileFlags & CompileState.GEOMETRY_READ) != 0) { @@ -369,7 +369,7 @@ class Shape3DCompileRetained extends Shape3DRetained { break; } } - + } @@ -377,7 +377,7 @@ class Shape3DCompileRetained extends Shape3DRetained { Bounds getCollisionBounds(int childIndex) { return collisionBound; } - + int numGeometries(int childIndex) { ArrayList geo = (ArrayList) geometryInfo.get(childIndex); @@ -389,17 +389,17 @@ class Shape3DCompileRetained extends Shape3DRetained { ArrayList geoInfo = (ArrayList) geometryInfo.get(childIndex); return (Geometry)geoInfo.get(i); - + } Enumeration getAllGeometries(int childIndex) { ArrayList geoInfo = (ArrayList) geometryInfo.get(childIndex); Vector geomList = new Vector(); - + for(int i=0; i<geoInfo.size(); i++) { geomList.add(geoInfo.get(i)); } - + return geomList.elements(); } @@ -423,11 +423,11 @@ class Shape3DCompileRetained extends Shape3DRetained { } return (Bounds) bbox; - + } else { return null; } - + } else { return super.getBounds(); } @@ -445,45 +445,45 @@ class Shape3DCompileRetained extends Shape3DRetained { */ boolean intersect(SceneGraphPath path, PickShape pickShape, double[] dist) { - + int flags; PickInfo pickInfo = new PickInfo(); - + Transform3D localToVworld = path.getTransform(); if (localToVworld == null) { - throw new IllegalArgumentException(J3dI18N.getString("Shape3DRetained3")); + throw new IllegalArgumentException(J3dI18N.getString("Shape3DRetained3")); } pickInfo.setLocalToVWorldRef( localToVworld); - + Shape3D shape = (Shape3D) path.getObject(); // Get the geometries for this shape only, since the compiled // geomtryList contains several shapes - ArrayList glist = (ArrayList) geometryInfo.get(shape.id); - + ArrayList glist = (ArrayList) geometryInfo.get(shape.id); + // System.err.println("Shape3DCompileRetained.intersect() : "); if (dist == null) { // System.err.println(" no dist request ...."); return intersect(pickInfo, pickShape, 0, glist); } - + flags = PickInfo.CLOSEST_DISTANCE; if (intersect(pickInfo, pickShape, flags, glist)) { dist[0] = pickInfo.getClosestDistance(); return true; } - + return false; - + } - + boolean intersect(PickInfo pickInfo, PickShape pickShape, int flags, ArrayList geometryList) { - + Transform3D localToVworld = pickInfo.getLocalToVWorldRef(); - + Transform3D t3d = new Transform3D(); t3d.invert(localToVworld); - PickShape newPS = pickShape.transform(t3d); + PickShape newPS = pickShape.transform(t3d); int geomListSize = geometryList.size(); GeometryRetained geometry; @@ -492,9 +492,9 @@ class Shape3DCompileRetained extends Shape3DRetained { ((flags & PickInfo.CLOSEST_DISTANCE) == 0) && ((flags & PickInfo.CLOSEST_GEOM_INFO) == 0) && ((flags & PickInfo.ALL_GEOM_INFO) == 0)) { - + for (int i=0; i < geomListSize; i++) { - geometry = (GeometryRetained) geometryList.get(i); + geometry = (GeometryRetained) geometryList.get(i); if (geometry != null) { if (geometry.mirrorGeometry != null) { geometry = geometry.mirrorGeometry; @@ -511,30 +511,30 @@ class Shape3DCompileRetained extends Shape3DRetained { double distance; double minDist = Double.POSITIVE_INFINITY; Point3d closestIPnt = new Point3d(); - Point3d iPnt = new Point3d(); - Point3d iPntVW = new Point3d(); - + Point3d iPnt = new Point3d(); + Point3d iPntVW = new Point3d(); + for (int i=0; i < geomListSize; i++) { geometry = (GeometryRetained) geometryList.get(i); if (geometry != null) { if (geometry.mirrorGeometry != null) { geometry = geometry.mirrorGeometry; } - if (geometry.intersect(newPS, pickInfo, flags, iPnt, geometry, i)) { + if (geometry.intersect(newPS, pickInfo, flags, iPnt, geometry, i)) { iPntVW.set(iPnt); localToVworld.transform(iPntVW); distance = pickShape.distance(iPntVW); - + if (minDist > distance) { - minDist = distance; + minDist = distance; closestIPnt.set(iPnt); - } + } } } } - - if (minDist < Double.POSITIVE_INFINITY) { + + if (minDist < Double.POSITIVE_INFINITY) { if ((flags & PickInfo.CLOSEST_DISTANCE) != 0) { pickInfo.setClosestDistance(minDist); } @@ -542,11 +542,11 @@ class Shape3DCompileRetained extends Shape3DRetained { pickInfo.setClosestIntersectionPoint(closestIPnt); } return true; - } + } } - + return false; - - } + + } } diff --git a/src/classes/share/javax/media/j3d/Shape3DRetained.java b/src/classes/share/javax/media/j3d/Shape3DRetained.java index 4a3d1b4..b51f8ba 100644 --- a/src/classes/share/javax/media/j3d/Shape3DRetained.java +++ b/src/classes/share/javax/media/j3d/Shape3DRetained.java @@ -45,11 +45,11 @@ class Shape3DRetained extends LeafRetained { static final int GEOMETRY_CHANGED = 0x00001; static final int APPEARANCE_CHANGED = 0x00002; static final int COLLISION_CHANGED = 0x00004; - static final int BOUNDS_CHANGED = 0x00008; + static final int BOUNDS_CHANGED = 0x00008; static final int APPEARANCEOVERRIDE_CHANGED = 0x00010; static final int LAST_DEFINED_BIT = 0x00010; - + // Target threads to be notified when light changes static final int targetThreads = J3dThread.UPDATE_RENDERING_ENVIRONMENT | J3dThread.UPDATE_RENDER; @@ -63,10 +63,10 @@ class Shape3DRetained extends LeafRetained { * The arraylist of geometry component of the shape node. */ ArrayList geometryList = null; - + /** - * A 2D storage of all geometry atoms associated with this shape node. - * There may be more than one geometry for a Shape3D node. + * A 2D storage of all geometry atoms associated with this shape node. + * There may be more than one geometry for a Shape3D node. * Do not change the following private variables to public, its access need to synchronize * via mirrorShape3DLock. */ @@ -75,7 +75,7 @@ class Shape3DRetained extends LeafRetained { private GeometryAtom geomAtom = null; /** - * To sychronize access of the mirrorShape3D's geomAtomArray*. + * To sychronize access of the mirrorShape3D's geomAtomArray*. * A multiple read single write Lock to sychronize access into mirrorShape3D. * To prevent deadlock a call to read/write lock must end with a read/write unlock * respectively. @@ -89,11 +89,11 @@ class Shape3DRetained extends LeafRetained { * Do not change the following private variables to public, its access need to synchronize * via mirrorShape3DLock. */ - ArrayList mirrorShape3D = new ArrayList(1); - + ArrayList mirrorShape3D = new ArrayList(1); + /** * This field is used for mirror Shape3D nodes accessing their - * original nodes. It is a NodeRetained because the original + * original nodes. It is a NodeRetained because the original * node may be a Shape3DRetained or a MorphRetained node. */ NodeRetained sourceNode = null; @@ -139,11 +139,11 @@ class Shape3DRetained extends LeafRetained { */ BranchGroupRetained branchGroupPath[]; - // cache value for picking in mirror shape. + // cache value for picking in mirror shape. // True if all the node of the path from this to root are all pickable boolean isPickable = true; - // cache value for collidable in mirror shape. + // cache value for collidable in mirror shape. // True if all the node of the path from this to root are all collidable boolean isCollidable = true; @@ -153,7 +153,7 @@ class Shape3DRetained extends LeafRetained { // the child index from the closest switch parent int closestSwitchIndex = -1; - // Is this S3D visible ? The default is true. + // Is this S3D visible ? The default is true. boolean visible = true; // Whether the normal appearance is overrided by the alternate app @@ -196,7 +196,7 @@ class Shape3DRetained extends LeafRetained { geometryList = new ArrayList(1); geometryList.add(null); } - + /** * Sets the collision bounds of a node. * @param bounds the bounding object for the node @@ -207,7 +207,7 @@ class Shape3DRetained extends LeafRetained { } else { this.collisionBound = (Bounds)bounds.clone(); } - + if (source.isLive()) { // Notify Geometry Structure to check for collision J3dMessage message = new J3dMessage(); @@ -219,10 +219,10 @@ class Shape3DRetained extends LeafRetained { message.args[1] = collisionBound; VirtualUniverse.mc.processMessage(message); } - } + } Bounds getLocalBounds(Bounds bounds) { - if(localBounds != null) { + if(localBounds != null) { localBounds.set(bounds); } else { @@ -237,9 +237,9 @@ class Shape3DRetained extends LeafRetained { * @param bounds the bounding object for the node */ void setBounds(Bounds bounds) { - super.setBounds(bounds); - - if (source.isLive() && !boundsAutoCompute) { + super.setBounds(bounds); + + if (source.isLive() && !boundsAutoCompute) { J3dMessage message = new J3dMessage(); message.type = J3dMessage.REGION_BOUND_CHANGED; message.threads = J3dThread.UPDATE_TRANSFORM | @@ -253,7 +253,7 @@ class Shape3DRetained extends LeafRetained { VirtualUniverse.mc.processMessage(message); } } - + /** * Gets the collision bounds of a node. * @return the node's bounding object @@ -261,8 +261,8 @@ class Shape3DRetained extends LeafRetained { Bounds getCollisionBounds(int id) { return (collisionBound == null ? null: (Bounds)collisionBound.clone()); - } - + } + /** * Appends the specified geometry component to this Shape3D * node's list of geometry components. @@ -281,23 +281,23 @@ class Shape3DRetained extends LeafRetained { int i; Shape3DRetained s; GeometryRetained newGeom = null; - + checkEquivalenceClass(geometry, -1); - + if(((Shape3D)this.source).isLive()) { if (geometry != null) { - - newGeom = ((GeometryRetained)geometry.retained); + + newGeom = ((GeometryRetained)geometry.retained); newGeom.setLive(inBackgroundGroup, refCount); geometryList.add(newGeom); - + } else { geometryList.add(null); newGeom = null; } sendDataChangedMessage(newGeom); - + } else { if (geometry != null) { geometryList.add((GeometryRetained) geometry.retained); @@ -305,8 +305,8 @@ class Shape3DRetained extends LeafRetained { geometryList.add(null); } } - dirtyBoundsCache(); - } + dirtyBoundsCache(); + } /** * Replaces the geometry component at the specified index in this @@ -332,9 +332,9 @@ class Shape3DRetained extends LeafRetained { GeometryRetained oldGeom = null; checkEquivalenceClass(geometry, index); - + if (((Shape3D)this.source).isLive()) { - + oldGeom = (GeometryRetained) (geometryList.get(index)); if (oldGeom != null) { oldGeom.clearLive(refCount); @@ -349,13 +349,13 @@ class Shape3DRetained extends LeafRetained { newGeom = (GeometryRetained) geometry.retained; newGeom.incRefCnt(); newGeom.setLive(inBackgroundGroup, refCount); - geometryList.set(index, newGeom); + geometryList.set(index, newGeom); sendDataChangedMessage(newGeom); } else { geometryList.set(index, null); sendDataChangedMessage(null); } - + } else { oldGeom = (GeometryRetained) (geometryList.get(index)); @@ -390,17 +390,17 @@ class Shape3DRetained extends LeafRetained { Shape3DRetained mShape; GeometryRetained newGeom = null; GeometryRetained oldGeom = null; - + checkEquivalenceClass(geometry, -1); - + if (((Shape3D)this.source).isLive()) { - + if (geometry != null) { // Note : The order of the statements in important. Want ArrayList class to do index bounds // check before creating internal object. newGeom = (GeometryRetained) geometry.retained; newGeom.incRefCnt(); - geometryList.add(index, newGeom); + geometryList.add(index, newGeom); newGeom.setLive(inBackgroundGroup, refCount); sendDataChangedMessage(newGeom); } else { @@ -409,7 +409,7 @@ class Shape3DRetained extends LeafRetained { } } else { - + if (geometry != null) { geometryList.add(index,(GeometryRetained) geometry.retained); ((GeometryRetained)geometry.retained).incRefCnt(); @@ -431,9 +431,9 @@ class Shape3DRetained extends LeafRetained { int i; Shape3DRetained mShape; GeometryRetained oldGeom = null; - + if (((Shape3D)this.source).isLive()) { - + oldGeom = (GeometryRetained) (geometryList.get(index)); if (oldGeom != null) { oldGeom.clearLive(refCount); @@ -441,25 +441,25 @@ class Shape3DRetained extends LeafRetained { for (i=0; i<mirrorShape3D.size(); i++) { mShape = (Shape3DRetained)mirrorShape3D.get(i); oldGeom.removeUser(mShape); - + } } - - geometryList.remove(index); + + geometryList.remove(index); sendDataChangedMessage(null); - + } else { oldGeom = (GeometryRetained) (geometryList.get(index)); if (oldGeom != null) { oldGeom.decRefCnt(); } - geometryList.remove(index); + geometryList.remove(index); } - + dirtyBoundsCache(); - + } - + /** * Retrieves the geometry component of this Shape3D node. * @return the geometry component of this shape node @@ -470,8 +470,8 @@ class Shape3DRetained extends LeafRetained { GeometryRetained ga = (GeometryRetained) geometryList.get(index); return (ga == null ? null : (Geometry)ga.source); } - - + + /** * Returns an enumeration of this Shape3D node's list of geometry * components. @@ -483,15 +483,15 @@ class Shape3DRetained extends LeafRetained { Enumeration getAllGeometries(int id) { GeometryRetained ga = null; Vector geomList = new Vector(geometryList.size()); - + for(int i=0; i<geometryList.size(); i++) { ga = (GeometryRetained) geometryList.get(i); - if(ga != null) + if(ga != null) geomList.add((Geometry)ga.source); else geomList.add(null); } - + return geomList.elements(); } @@ -507,7 +507,7 @@ class Shape3DRetained extends LeafRetained { return geometryList.size(); } - + /** * Sets the appearance component of this Shape3D node. * @param appearance the new apearance component for this shape node @@ -516,16 +516,16 @@ class Shape3DRetained extends LeafRetained { Shape3DRetained s; boolean visibleIsDirty = false; - - if (((Shape3D)this.source).isLive()) { + + if (((Shape3D)this.source).isLive()) { if (appearance != null) { appearance.clearLive(refCount); for (int i=0; i<mirrorShape3D.size(); i++) { s = (Shape3DRetained)mirrorShape3D.get(i); appearance.removeAMirrorUser(s); - } + } } - + if (newAppearance != null) { ((AppearanceRetained)newAppearance.retained).setLive(inBackgroundGroup, refCount); appearance = ((AppearanceRetained)newAppearance.retained); @@ -573,7 +573,7 @@ class Shape3DRetained extends LeafRetained { createMessage[0].args[4] = getGeomAtomsArray(mirrorShape3D); if(visibleIsDirty) { createMessage[1] = new J3dMessage(); - createMessage[1].threads = J3dThread.UPDATE_GEOMETRY; + createMessage[1].threads = J3dThread.UPDATE_GEOMETRY; createMessage[1].type = J3dMessage.SHAPE3D_CHANGED; createMessage[1].universe = universe; createMessage[1].args[0] = this; @@ -582,17 +582,17 @@ class Shape3DRetained extends LeafRetained { createMessage[1].args[3]= createMessage[0].args[4]; } VirtualUniverse.mc.processMessage(createMessage); - + } else { // not live. if (newAppearance == null) { appearance = null; } else { - appearance = (AppearanceRetained) newAppearance.retained; + appearance = (AppearanceRetained) newAppearance.retained; } } } - + /** * Retrieves the shape node's appearance component. * @return the shape node's appearance @@ -603,7 +603,7 @@ class Shape3DRetained extends LeafRetained { void setAppearanceOverrideEnable(boolean flag) { if (((Shape3D)this.source).isLive()) { - + // Send a message J3dMessage createMessage = new J3dMessage(); createMessage.threads = targetThreads; @@ -633,11 +633,11 @@ class Shape3DRetained extends LeafRetained { boolean getAppearanceOverrideEnable() { return appearanceOverrideEnable; } - + boolean intersect(PickInfo pickInfo, PickShape pickShape, int flags ) { - + Transform3D localToVworld = pickInfo.getLocalToVWorldRef(); - + // Support OrientedShape3D here. // Note - BugId : 4363899 - APIs issue : OrientedShape3D's intersect needs view // info. temp. fix use the primary view. @@ -646,7 +646,7 @@ class Shape3DRetained extends LeafRetained { getOrientedTransform(getPrimaryViewIdx()); localToVworld.mul(orientedTransform); } - + Transform3D t3d = new Transform3D(); t3d.invert(localToVworld); PickShape newPS = pickShape.transform(t3d); @@ -661,7 +661,7 @@ class Shape3DRetained extends LeafRetained { ((flags & PickInfo.CLOSEST_DISTANCE) == 0) && ((flags & PickInfo.CLOSEST_GEOM_INFO) == 0) && ((flags & PickInfo.ALL_GEOM_INFO) == 0)) { - + for (int i=0; i < geomListSize; i++) { geometry = (GeometryRetained) geometryList.get(i); if (geometry != null) { @@ -679,7 +679,7 @@ class Shape3DRetained extends LeafRetained { Point3d closestIPnt = new Point3d(); Point3d iPnt = new Point3d(); Point3d iPntVW = new Point3d(); - + for (int i=0; i < geomListSize; i++) { geometry = (GeometryRetained) geometryList.get(i); if (geometry != null) { @@ -688,11 +688,11 @@ class Shape3DRetained extends LeafRetained { } //if (geometry.intersect(newPS, intersectionInfo, flags, iPnt)) { if(geometry.intersect(newPS, pickInfo, flags, iPnt, geometry, i)) { - + iPntVW.set(iPnt); localToVworld.transform(iPntVW); distance = pickShape.distance(iPntVW); - + if (minDist > distance) { minDist = distance; closestIPnt.set(iPnt); @@ -700,7 +700,7 @@ class Shape3DRetained extends LeafRetained { } } } - + if (minDist < Double.POSITIVE_INFINITY) { if ((flags & PickInfo.CLOSEST_DISTANCE) != 0) { pickInfo.setClosestDistance(minDist); @@ -711,30 +711,30 @@ class Shape3DRetained extends LeafRetained { return true; } } - + return false; - - } - - + + } + + /** * Check if the geometry component of this shape node under path * intersects with the pickShape. * This is an expensive method. It should only be called if and only - * if the path's bound intersects pickShape. + * if the path's bound intersects pickShape. * @exception IllegalArgumentException if <code>path</code> is * invalid. */ - + boolean intersect(SceneGraphPath path, PickShape pickShape, double[] dist) { - + int flags; PickInfo pickInfo = new PickInfo(); - + Transform3D localToVworld = path.getTransform(); if (localToVworld == null) { - throw new IllegalArgumentException(J3dI18N.getString("Shape3DRetained3")); + throw new IllegalArgumentException(J3dI18N.getString("Shape3DRetained3")); } pickInfo.setLocalToVWorldRef( localToVworld); //System.err.println("Shape3DRetained.intersect() : "); @@ -742,27 +742,27 @@ class Shape3DRetained extends LeafRetained { //System.err.println(" no dist request ...."); return intersect(pickInfo, pickShape, 0); } - + flags = PickInfo.CLOSEST_DISTANCE; if (intersect(pickInfo, pickShape, flags)) { dist[0] = pickInfo.getClosestDistance(); return true; } - + return false; - + } /** * This sets the immedate mode context flag - */ + */ void setInImmCtx(boolean inCtx) { inImmCtx = inCtx; } /** * This gets the immedate mode context flag - */ + */ boolean getInImmCtx() { return (inImmCtx); } @@ -774,7 +774,7 @@ class Shape3DRetained extends LeafRetained { private void initMirrorShape3D(SetLiveState s, Shape3DRetained ms, int index) { // New 1.2.1 code - + ms.inBackgroundGroup = inBackgroundGroup; ms.geometryBackground = geometryBackground; ms.source = source; @@ -808,9 +808,9 @@ class Shape3DRetained extends LeafRetained { ms.appearanceOverrideEnable = appearanceOverrideEnable; - + ms.geometryList = geometryList; - + // Assign the parent of this mirror shape node ms.sourceNode = this; @@ -823,13 +823,13 @@ class Shape3DRetained extends LeafRetained { oms.initConstantScaleEnable(os.constantScale); oms.initScale(os.scaleFactor); } - + } void updateImmediateMirrorObject(Object[] objs) { int component = ((Integer)objs[1]).intValue(); GeometryArrayRetained ga; - + Shape3DRetained[] msArr = (Shape3DRetained[]) objs[2]; int i, j; if ((component & APPEARANCE_CHANGED) != 0) { @@ -854,7 +854,7 @@ class Shape3DRetained extends LeafRetained { * Gets the bounding object of a node. * @return the node's bounding object */ - + Bounds getBounds() { if(boundsAutoCompute) { @@ -866,10 +866,10 @@ class Shape3DRetained extends LeafRetained { if(geometryList != null) { BoundingBox bbox = new BoundingBox((Bounds) null); - GeometryRetained geometry; + GeometryRetained geometry; for(int i=0; i<geometryList.size(); i++) { geometry = (GeometryRetained) geometryList.get(i); - if ((geometry != null) && + if ((geometry != null) && (geometry.geoType != GeometryRetained.GEO_TYPE_NONE)) { geometry.computeBoundingBox(); synchronized(geometry.geoBounds) { @@ -878,16 +878,16 @@ class Shape3DRetained extends LeafRetained { } } return (Bounds) bbox; - + } else { return null; } - + } else { return super.getBounds(); } - } - + } + Bounds getEffectiveBounds() { if(boundsAutoCompute) { return getBounds(); @@ -896,24 +896,24 @@ class Shape3DRetained extends LeafRetained { return super.getEffectiveBounds(); } } - - + + /** * ONLY needed for SHAPE, MORPH, and LINK node type. * Compute the combine bounds of bounds and its localBounds. */ void computeCombineBounds(Bounds bounds) { - + if(boundsAutoCompute) { if(geometryList != null) { GeometryRetained geometry; BoundingBox bbox = null; - + if (staticTransform != null) { bbox = new BoundingBox((BoundingBox) null); } - - if (!VirtualUniverse.mc.cacheAutoComputedBounds) { + + if (!VirtualUniverse.mc.cacheAutoComputedBounds) { for(int i=0; i<geometryList.size(); i++) { geometry = (GeometryRetained) geometryList.get(i); if ((geometry != null) && @@ -959,7 +959,7 @@ class Shape3DRetained extends LeafRetained { } } } else { - + // Should this be lock too ? ( MT safe ? ) synchronized(localBounds) { bounds.combine((Bounds) localBounds); @@ -975,19 +975,19 @@ class Shape3DRetained extends LeafRetained { doSetLive(s); markAsLive(); } - + void doSetLive(SetLiveState s) { // System.err.println("S3DRetained : setLive " + s); Shape3DRetained shape; GeometryRetained geometry; int i, j, k, gaCnt; ArrayList msList = new ArrayList(); - + super.doSetLive(s); - + nodeId = universe.getNodeId(); - + if (inSharedGroup) { for (i=0; i<s.keys.length; i++) { if (this instanceof OrientedShape3DRetained) { @@ -1004,7 +1004,7 @@ class Shape3DRetained extends LeafRetained { /* System.err.print("s.keys[i] = "+s.keys[i]+" j = "+j); if(j < 0) { - System.err.println("Shape3dRetained : Can't find hashKey"); + System.err.println("Shape3dRetained : Can't find hashKey"); } */ shape.localToVworld[0] = localToVworld[j]; @@ -1012,7 +1012,7 @@ class Shape3DRetained extends LeafRetained { shape.branchGroupPath = (BranchGroupRetained []) branchGroupPaths.get(j); shape.isPickable = s.pickable[i]; shape.isCollidable = s.collidable[i]; - + initMirrorShape3D(s, shape, j); if (s.switchTargets != null && @@ -1033,7 +1033,7 @@ class Shape3DRetained extends LeafRetained { } } } - + // Add any scoped fog if (s.fogs != null) { ArrayList l = (ArrayList)s.fogs.get(j); @@ -1053,7 +1053,7 @@ class Shape3DRetained extends LeafRetained { } } } - + // Add any scoped alt app if (s.altAppearances != null) { ArrayList l = (ArrayList)s.altAppearances.get(j); @@ -1089,7 +1089,7 @@ class Shape3DRetained extends LeafRetained { shape.isPickable = s.pickable[0]; shape.isCollidable = s.collidable[0]; initMirrorShape3D(s, shape, 0); - + // Add any scoped lights to the mirror shape if (s.lights != null) { ArrayList l = (ArrayList)s.lights.get(0); @@ -1097,7 +1097,7 @@ class Shape3DRetained extends LeafRetained { shape.addLight((LightRetained)l.get(i)); } } - + // Add any scoped fog if (s.fogs != null) { ArrayList l = (ArrayList)s.fogs.get(0); @@ -1105,7 +1105,7 @@ class Shape3DRetained extends LeafRetained { shape.addFog((FogRetained)l.get(i)); } } - + // Add any scoped modelClip if (s.modelClips != null) { ArrayList l = (ArrayList)s.modelClips.get(0); @@ -1114,7 +1114,7 @@ class Shape3DRetained extends LeafRetained { } } - + // Add any scoped alt app if (s.altAppearances != null) { ArrayList l = (ArrayList)s.altAppearances.get(0); @@ -1131,7 +1131,7 @@ class Shape3DRetained extends LeafRetained { shape.viewList = (ArrayList)s.viewLists.get(0); else shape.viewList = null; - + if (s.switchTargets != null && s.switchTargets[0] != null) { s.switchTargets[0].addNode(shape, Targets.GEO_TARGETS); @@ -1146,7 +1146,7 @@ class Shape3DRetained extends LeafRetained { if (appearance != null) { synchronized(appearance.liveStateLock) { - if (k == 0) { // Do only first time + if (k == 0) { // Do only first time appearance.setLive(inBackgroundGroup, s.refCount); appearance.initMirrorObject(); if (appearance.renderingAttributes != null) @@ -1166,7 +1166,7 @@ class Shape3DRetained extends LeafRetained { geometry = (GeometryRetained) geometryList.get(gaCnt); if(geometry != null) { synchronized(geometry.liveStateLock) { - if (k == 0) { // Do only first time + if (k == 0) { // Do only first time geometry.setLive(inBackgroundGroup, s.refCount); } geometry.addUser(sh); @@ -1177,22 +1177,22 @@ class Shape3DRetained extends LeafRetained { } // after the geometry has been setLived and bounds computed - if (k== 0 && boundsAutoCompute) { // Do only once + if (k== 0 && boundsAutoCompute) { // Do only once // user may call setBounds with a bounds other than boundingBox if (! (localBounds instanceof BoundingBox)) { localBounds = new BoundingBox((BoundingBox) null); } getCombineBounds((BoundingBox)localBounds); - + } // Assign GAtom and set the bounds if we are not using switch initializeGAtom(sh); GeometryAtom ga = getGeomAtom(sh); - + // Add the geometry atom for this shape to the nodeList s.nodeList.add(ga); - + if (s.transformTargets != null && s.transformTargets[k] != null) { // Add the geometry atom for this shape to the transformTargets @@ -1200,14 +1200,14 @@ class Shape3DRetained extends LeafRetained { s.transformTargets[k].addNode(ga, Targets.GEO_TARGETS); } } - - s.notifyThreads |= (J3dThread.UPDATE_GEOMETRY | + + s.notifyThreads |= (J3dThread.UPDATE_GEOMETRY | J3dThread.UPDATE_TRANSFORM | J3dThread.UPDATE_RENDER | J3dThread.UPDATE_RENDERING_ENVIRONMENT); } - + /** * This clears all references in a mirror shape */ @@ -1242,24 +1242,24 @@ class Shape3DRetained extends LeafRetained { for (i = 0; i < numfogs; i++) fogs[i] = null; numfogs = 0; - + // Remove all the modelClips for (i = 0; i < numModelClips; i++) modelClips[i] = null; numModelClips = 0; - + // Remove all the lights for (i = 0; i < numlights; i++) lights[i] = null; numlights = 0; - + // Remove all the al app for (i = 0; i < numAltApps; i++) altApps[i] = null; numAltApps = 0; - + viewList = null; - + } /** @@ -1274,11 +1274,11 @@ class Shape3DRetained extends LeafRetained { GeometryRetained geometry; Object[] shapes; ArrayList msList = new ArrayList(); - + super.clearLive(s); - - + + if (inSharedGroup) { synchronized(mirrorShape3D) { shapes = mirrorShape3D.toArray(); @@ -1321,7 +1321,7 @@ class Shape3DRetained extends LeafRetained { msList.add(shape); GeometryAtom ga = getGeomAtom(shape); - + // Add the geometry atom for this shape to the nodeList s.nodeList.add(ga); if (s.transformTargets != null && @@ -1332,7 +1332,7 @@ class Shape3DRetained extends LeafRetained { for (int k = 0; k < msList.size(); k++) { - Shape3DRetained sh = (Shape3DRetained)msList.get(k); + Shape3DRetained sh = (Shape3DRetained)msList.get(k); if (appearance != null) { synchronized(appearance.liveStateLock) { if (k == 0) { @@ -1360,7 +1360,7 @@ class Shape3DRetained extends LeafRetained { J3dThread.UPDATE_TRANSFORM | // This is used to clear the scope info // of all the mirror shapes - J3dThread.UPDATE_RENDERING_ENVIRONMENT | + J3dThread.UPDATE_RENDERING_ENVIRONMENT | J3dThread.UPDATE_RENDER); if (!source.isLive()) { @@ -1369,17 +1369,17 @@ class Shape3DRetained extends LeafRetained { for (i = 0; i < numfogs; i++) fogs[i] = null; numfogs = 0; - + // Remove all the modelClips for (i = 0; i < numModelClips; i++) modelClips[i] = null; numModelClips = 0; - + // Remove all the lights for (i = 0; i < numlights; i++) lights[i] = null; numlights = 0; - + // Remove all the al app for (i = 0; i < numAltApps; i++) altApps[i] = null; @@ -1419,7 +1419,7 @@ class Shape3DRetained extends LeafRetained { if (appearance != null && (appearance.transparencyAttributes != null && appearance.transparencyAttributes.transparencyMode != TransparencyAttributes.NONE)) return false; - + GeometryRetained geo; boolean alphaEditable; @@ -1462,7 +1462,7 @@ class Shape3DRetained extends LeafRetained { if (J3dDebug.devPhase && J3dDebug.debug) { compState.numShapesWStaticTG++; } - } else + } else { mergeFlag = SceneGraphObjectRetained.DONT_MERGE; compState.keepTG = true; @@ -1489,18 +1489,18 @@ class Shape3DRetained extends LeafRetained { GeometryRetained geo = (GeometryRetained)geometryList.get(i); if (geo != null) geo.compile(compState); - } - + } + } void merge(CompileState compState) { - - + + if (mergeFlag == SceneGraphObjectRetained.DONT_MERGE) { // no need to save the staticTransform here - TransformGroupRetained saveStaticTransform = + TransformGroupRetained saveStaticTransform = compState.staticTransform; compState.staticTransform = null; super.merge(compState); @@ -1519,7 +1519,7 @@ class Shape3DRetained extends LeafRetained { boolean mergeable = true; AppearanceRetained newApp; int i; - + GeometryRetained geometry = null; int index = 0; i = 0; @@ -1549,7 +1549,7 @@ class Shape3DRetained extends LeafRetained { } GeometryArrayRetained firstGeo = (GeometryArrayRetained) geometry; - + for(i=index; (i<geometryList.size() && mergeable); i++) { geometry = (GeometryRetained) geometryList.get(i); if (geometry != null) { @@ -1560,14 +1560,14 @@ class Shape3DRetained extends LeafRetained { if (geo.vertexFormat != firstGeo.vertexFormat) mergeable = false; - + } } - // For now, turn off lots of capability bits + // For now, turn off lots of capability bits if (source.getCapability(Shape3D.ALLOW_COLLISION_BOUNDS_WRITE) || - source.getCapability(Shape3D.ALLOW_APPEARANCE_WRITE) || + source.getCapability(Shape3D.ALLOW_APPEARANCE_WRITE) || source.getCapability(Shape3D.ALLOW_APPEARANCE_OVERRIDE_WRITE) || source.getCapability(Shape3D.ALLOW_AUTO_COMPUTE_BOUNDS_WRITE) || source.getCapability(Shape3D.ALLOW_BOUNDS_WRITE) || @@ -1576,9 +1576,9 @@ class Shape3DRetained extends LeafRetained { source.getCapability(Shape3D.ALLOW_GEOMETRY_WRITE)) { mergeable = false; } - + return mergeable; - + } @@ -1596,12 +1596,12 @@ class Shape3DRetained extends LeafRetained { else { ms = (Shape3DRetained)mirrorShape3D.get(0); } - + list.add(getGeomAtom(ms)); - + } - + // Called on the mirror Object void addLight(LightRetained light) { LightRetained[] newlights; @@ -1683,7 +1683,7 @@ class Shape3DRetained extends LeafRetained { ModelClipRetained[] newModelClips; int i; - + if (modelClips == null) { modelClips = new ModelClipRetained[10]; } @@ -1756,7 +1756,7 @@ class Shape3DRetained extends LeafRetained { - void updatePickable(HashKey keys[], boolean pick[]) { + void updatePickable(HashKey keys[], boolean pick[]) { super.updatePickable(keys, pick); Shape3DRetained shape; @@ -1779,7 +1779,7 @@ class Shape3DRetained extends LeafRetained { } - void updateCollidable(HashKey keys[], boolean collide[]) { + void updateCollidable(HashKey keys[], boolean collide[]) { super.updateCollidable(keys, collide); Shape3DRetained shape; @@ -1809,34 +1809,34 @@ class Shape3DRetained extends LeafRetained { // Remove the old geometry atoms and reInsert // the new geometry atoms and update the transform // target list - + private void sendDataChangedMessage( GeometryRetained newGeom ) { - + int i, j, gaCnt; GeometryAtom[] newGAArray = null; GeometryAtom[] oldGAArray = null; GeometryAtom[] newGeometryAtoms = null; int geometryCnt = 0; GeometryRetained geometry = null; - + int s3dMSize = mirrorShape3D.size(); if(s3dMSize < 1) return; - + Shape3DRetained mS3d = (Shape3DRetained) mirrorShape3D.get(0); - + mS3d.mirrorShape3DLock.writeLock(); - + GeometryAtom oldGA = mS3d.geomAtom; - + GeometryAtom newGA = new GeometryAtom(); - + if(newGeom != null) { newGeom.addUser(mS3d); } - - int gSize = geometryList.size(); + + int gSize = geometryList.size(); for(i=0; i<gSize; i++) { geometry = (GeometryRetained) geometryList.get(i); @@ -1846,10 +1846,10 @@ class Shape3DRetained extends LeafRetained { break; } } - + if((geometry != null) && (geometry.geoType == GeometryRetained.GEO_TYPE_TEXT3D)) { - + for(i = 0; i<gSize; i++) { geometry = (GeometryRetained) geometryList.get(i); if(geometry != null) { @@ -1857,7 +1857,7 @@ class Shape3DRetained extends LeafRetained { geometryCnt += tempT3d.numChars; } else { - // This is slightly wasteful, but not quite worth to optimize yet. + // This is slightly wasteful, but not quite worth to optimize yet. geometryCnt++; } } @@ -1870,11 +1870,11 @@ class Shape3DRetained extends LeafRetained { else { newGA.geometryArray = new GeometryRetained[gSize]; } - + newGA.locale = mS3d.locale; newGA.visible = visible; newGA.source = mS3d; - + for(gaCnt = 0; gaCnt<gSize; gaCnt++) { geometry = (GeometryRetained) geometryList.get(gaCnt); @@ -1891,14 +1891,14 @@ class Shape3DRetained extends LeafRetained { newGA.geometryArray[geometryCnt] = geo; newGA.lastLocalTransformArray[geometryCnt] = t.charTransforms[i]; - + } else { newGA.geometryArray[geometryCnt] = null; newGA.lastLocalTransformArray[geometryCnt] = null; } - + } - + } else { newGA.geometryArray[geometryCnt++] = geometry; } @@ -1912,26 +1912,26 @@ class Shape3DRetained extends LeafRetained { mS3d.geomAtom = newGA; mS3d.mirrorShape3DLock.writeUnlock(); - + // ..... clone the rest of mirrorS3D's GA with the above newGA, but modify // its source. - - for (i = 1; i < s3dMSize; i++) { + + for (i = 1; i < s3dMSize; i++) { mS3d = (Shape3DRetained) mirrorShape3D.get(i); mS3d.mirrorShape3DLock.writeLock(); - oldGA = mS3d.geomAtom; + oldGA = mS3d.geomAtom; newGA = new GeometryAtom(); if(newGeom != null) { newGeom.addUser(mS3d); } - + newGA.geoType = newGAArray[0].geoType; newGA.locale = mS3d.locale; newGA.visible = visible; newGA.source = mS3d; newGA.alphaEditable = newGAArray[0].alphaEditable; - + newGA.geometryArray = new GeometryRetained[newGAArray[0].geometryArray.length]; for(j=0; j<newGA.geometryArray.length; j++) { newGA.geometryArray[j] = newGAArray[0].geometryArray[j]; @@ -1939,12 +1939,12 @@ class Shape3DRetained extends LeafRetained { oldGAArray[i] = oldGA; newGAArray[i] = newGA; - + mS3d.geomAtom = newGA; - mS3d.mirrorShape3DLock.writeUnlock(); + mS3d.mirrorShape3DLock.writeUnlock(); } - - TargetsInterface ti = + + TargetsInterface ti = ((GroupRetained)parent).getClosestTargetsInterface( TargetsInterface.TRANSFORM_TARGETS); CachedTargets[] newCtArr = null; @@ -1960,20 +1960,20 @@ class Shape3DRetained extends LeafRetained { if (ct != null) { newCtArr[i] = new CachedTargets(); newCtArr[i].copy(ct); - newCtArr[i].replace(oldGAArray[i], newGAArray[i], + newCtArr[i].replace(oldGAArray[i], newGAArray[i], Targets.GEO_TARGETS); } else { newCtArr[i] = null; } } - ti.resetCachedTargets(TargetsInterface.TRANSFORM_TARGETS, + ti.resetCachedTargets(TargetsInterface.TRANSFORM_TARGETS, newCtArr, -1); } - + J3dMessage changeMessage = new J3dMessage(); changeMessage.type = J3dMessage.SHAPE3D_CHANGED; - // Who to send this message to ? + // Who to send this message to ? changeMessage.threads = J3dThread.UPDATE_RENDER | J3dThread.UPDATE_TRANSFORM | J3dThread.UPDATE_GEOMETRY; @@ -1989,23 +1989,23 @@ class Shape3DRetained extends LeafRetained { if (boundsAutoCompute) { getCombineBounds((BoundingBox)localBounds); } - VirtualUniverse.mc.processMessage(changeMessage); - + VirtualUniverse.mc.processMessage(changeMessage); + } // ********** End of New 1.2.1 code .... - - + + Shape3DRetained getMirrorShape(SceneGraphPath path) { if (!inSharedGroup) { return (Shape3DRetained) mirrorShape3D.get(0); } HashKey key = new HashKey(""); - path.getHashKey(key); + path.getHashKey(key); return getMirrorShape(key); } @@ -2022,7 +2022,7 @@ class Shape3DRetained extends LeafRetained { // Not possible throw new RuntimeException("Shape3DRetained: MirrorShape Not found!"); } - + void setBoundsAutoCompute(boolean autoCompute) { GeometryRetained geometry; if (autoCompute != boundsAutoCompute) { @@ -2066,7 +2066,7 @@ class Shape3DRetained extends LeafRetained { } // This method is called when coordinates of a geometry in the geometrylist // changed and autoBoundsCompute is true - + void updateBounds() { localBounds = new BoundingBox((BoundingBox) null); getCombineBounds((BoundingBox)localBounds); @@ -2088,7 +2088,7 @@ class Shape3DRetained extends LeafRetained { boolean allowIntersect() { GeometryRetained ga = null; - + for(int i=0; i<geometryList.size(); i++) { ga = (GeometryRetained) geometryList.get(i); if(ga != null) @@ -2102,7 +2102,7 @@ class Shape3DRetained extends LeafRetained { GeometryRetained geom1, geom2; ArrayList gaList = otherShape.geometryList; int gaSize = gaList.size(); - Transform3D otherLocalToVworld = otherShape.getCurrentLocalToVworld(); + Transform3D otherLocalToVworld = otherShape.getCurrentLocalToVworld(); Transform3D thisLocalToVworld = getCurrentLocalToVworld(); View views = null; int primaryViewIdx = -1; @@ -2113,7 +2113,7 @@ class Shape3DRetained extends LeafRetained { thisLocalToVworld.mul(((OrientedShape3DRetained)this). getOrientedTransform(primaryViewIdx)); } - + if (otherShape instanceof OrientedShape3DRetained) { if (primaryViewIdx < 0) { primaryViewIdx = getPrimaryViewIdx(); @@ -2135,7 +2135,7 @@ class Shape3DRetained extends LeafRetained { } } } - + return false; } @@ -2144,7 +2144,7 @@ class Shape3DRetained extends LeafRetained { GeometryRetained geometry; if (this instanceof OrientedShape3DRetained) { - Transform3D orientedTransform = + Transform3D orientedTransform = ((OrientedShape3DRetained)this). getOrientedTransform(getPrimaryViewIdx()); thisLocalToVworld.mul(orientedTransform); @@ -2157,9 +2157,9 @@ class Shape3DRetained extends LeafRetained { return true; } } - + return false; - + } @@ -2209,16 +2209,16 @@ class Shape3DRetained extends LeafRetained { // mga is the final geometry we're interested. geometryList = new ArrayList(1); geometryList.add((GeometryArrayRetained)morph.morphedGeometryArray.retained); - + GeometryAtom gAtom = new GeometryAtom(); gAtom.geometryArray = new GeometryRetained[1]; - + gAtom.locale = locale; gAtom.visible = morph.visible; gAtom.source = this; - + geometry = (GeometryRetained) geometryList.get(0); - + if(geometry ==null) { gAtom.geometryArray[0] = null; } else { @@ -2260,7 +2260,7 @@ class Shape3DRetained extends LeafRetained { if (geometry ==null) { newGA.geometryArray[0] = null; } else { - newGA.geometryArray[0] = + newGA.geometryArray[0] = (GeometryArrayRetained)geometry.retained; newGA.geoType = newGA.geometryArray[0].geoType; } @@ -2275,7 +2275,7 @@ class Shape3DRetained extends LeafRetained { Shape3DRetained.setGeomAtom(ms, newGA); } - TargetsInterface ti = + TargetsInterface ti = ((GroupRetained)parent).getClosestTargetsInterface( TargetsInterface.TRANSFORM_TARGETS); CachedTargets[] newCtArr = null; @@ -2291,7 +2291,7 @@ class Shape3DRetained extends LeafRetained { if (ct != null) { newCtArr[i] = new CachedTargets(); newCtArr[i].copy(ct); - newCtArr[i].replace(oldGAArray[i], newGAArray[i], + newCtArr[i].replace(oldGAArray[i], newGAArray[i], Targets.GEO_TARGETS); } else { newCtArr[i] = null; @@ -2315,28 +2315,28 @@ class Shape3DRetained extends LeafRetained { changeMessage.args[4] = ti; changeMessage.args[5] = newCtArr; } - VirtualUniverse.mc.processMessage(changeMessage); + VirtualUniverse.mc.processMessage(changeMessage); } - + /** * Return an array of geometry atoms belongs to userList. * The input is an arraylist of Shape3DRetained type. - * This is used to send a message of the snapshot of the + * This is used to send a message of the snapshot of the * geometry atoms that are affected by this change. */ final static GeometryAtom[] getGeomAtomsArray(ArrayList userList) { Shape3DRetained ms = null; GeometryAtom[] gaArr = null; int size, nullCnt=0, i, j; - + synchronized(userList) { size = userList.size(); gaArr = new GeometryAtom[size]; for (i = 0; i < size; i++) { ms = (Shape3DRetained) userList.get(i); ms.mirrorShape3DLock.readLock(); - if(ms.geomAtom == null) { + if(ms.geomAtom == null) { nullCnt++; } gaArr[i] = ms.geomAtom; @@ -2351,7 +2351,7 @@ class Shape3DRetained extends LeafRetained { } else { GeometryAtom[] newGaArr = new GeometryAtom[size - nullCnt]; - + for (i=0, j=0; i < size; i++) { if(gaArr[i] != null) { newGaArr[j++] = gaArr[i]; @@ -2366,7 +2366,7 @@ class Shape3DRetained extends LeafRetained { * universe found in userList in univList. * The input is an array of Shape3DRetained type. * univList is assume to be empty. - * This is used to send a message of the snapshot of the + * This is used to send a message of the snapshot of the * geometry atoms that are affected by this change. */ final static ArrayList getGeomAtomsList(ArrayList userList, ArrayList univList) { @@ -2376,7 +2376,7 @@ class Shape3DRetained extends LeafRetained { Shape3DRetained ms = null; boolean moreThanOneUniv = false; VirtualUniverse firstFndUniv = null; - + synchronized(userList) { for (int i = userList.size()-1; i >=0; i--) { ms = (Shape3DRetained) userList.get(i); @@ -2420,10 +2420,10 @@ class Shape3DRetained extends LeafRetained { } return listPerUniverse; } - + final static GeometryAtom getGeomAtom(Shape3DRetained shape) { GeometryAtom ga; - + shape.mirrorShape3DLock.readLock(); ga = shape.geomAtom; shape.mirrorShape3DLock.readUnlock(); @@ -2436,7 +2436,7 @@ class Shape3DRetained extends LeafRetained { shape.geomAtom = ga; shape.mirrorShape3DLock.writeUnlock(); } - + // Alpha is editable due to the appearance boolean isAlphaEditable(GeometryRetained geo) { @@ -2509,7 +2509,7 @@ class Shape3DRetained extends LeafRetained { if (staticTransform != null) { bbox = new BoundingBox((BoundingBox) null); } - + synchronized(bounds) { bounds.setLower( 1.0, 1.0, 1.0); bounds.setUpper(-1.0,-1.0,-1.0); @@ -2529,7 +2529,7 @@ class Shape3DRetained extends LeafRetained { } } } - + // System.err.println("Shape3DRetained - getCombineBounds"); // Enlarge boundingBox to the "minmium bounds" that encompasses all possible // orientation. @@ -2556,7 +2556,7 @@ class Shape3DRetained extends LeafRetained { bounds.setUpper(maxVal, maxVal, maxVal); // System.err.println("Shape3DRetained - bounds (After) " + bounds); } - + } } @@ -2594,7 +2594,7 @@ class Shape3DRetained extends LeafRetained { } else if (shape.collisionBound != null) return false; - + return true; } @@ -2637,7 +2637,7 @@ class Shape3DRetained extends LeafRetained { geometryCnt += tempT3d.numChars; } else { - // This is slightly wasteful, but not quite worth to optimize yet. + // This is slightly wasteful, but not quite worth to optimize yet. geometryCnt++; } } @@ -2645,7 +2645,7 @@ class Shape3DRetained extends LeafRetained { gAtom.lastLocalTransformArray = new Transform3D[geometryCnt]; // Reset geometryCnt; geometryCnt = 0; - + } else { gAtom.geometryArray = new GeometryRetained[gSize]; @@ -2671,9 +2671,9 @@ class Shape3DRetained extends LeafRetained { gAtom.geometryArray[geometryCnt] = null; gAtom.lastLocalTransformArray[geometryCnt] = null; } - + } - + } else { gAtom.geometryArray[gaCnt] = geometry; } @@ -2689,13 +2689,13 @@ class Shape3DRetained extends LeafRetained { void checkEquivalenceClass(Geometry geometry, int index) { if (geometry != null) { - for (int i=geometryList.size()-1; i >= 0; i--) { + for (int i=geometryList.size()-1; i >= 0; i--) { GeometryRetained geomRetained = (GeometryRetained) geometryList.get(i); if ((geomRetained != null) && (index != i)) { // this geometry will replace // current one so there is no need to check if (!geomRetained.isEquivalenceClass((GeometryRetained)geometry.retained)) { - throw new IllegalArgumentException(J3dI18N.getString("Shape3DRetained5")); + throw new IllegalArgumentException(J3dI18N.getString("Shape3DRetained5")); } break; } @@ -2704,14 +2704,14 @@ class Shape3DRetained extends LeafRetained { } int indexOfGeometry(Geometry geometry) { - if(geometry != null) + if(geometry != null) return geometryList.indexOf(geometry.retained); else return geometryList.indexOf(null); } - // Removes the specified geometry from this Shape3DRetained's list of geometries + // Removes the specified geometry from this Shape3DRetained's list of geometries void removeGeometry(Geometry geometry) { int ind = indexOfGeometry(geometry); if(ind >= 0) @@ -2721,13 +2721,13 @@ class Shape3DRetained extends LeafRetained { // Removes all the geometries from this node void removeAllGeometries() { int n = geometryList.size(); - + int i; Shape3DRetained mShape; GeometryRetained oldGeom = null; - + if (((Shape3D)this.source).isLive()) { - for(int index = n-1; index >= 0; index--) { + for(int index = n-1; index >= 0; index--) { oldGeom = (GeometryRetained) (geometryList.get(index)); if (oldGeom != null) { oldGeom.clearLive(refCount); @@ -2737,16 +2737,16 @@ class Shape3DRetained extends LeafRetained { oldGeom.removeUser(mShape); } } - geometryList.remove(index); + geometryList.remove(index); } sendDataChangedMessage(null); } else { - for(int index = n-1; index >= 0; index--) { + for(int index = n-1; index >= 0; index--) { oldGeom = (GeometryRetained) (geometryList.get(index)); if (oldGeom != null) { oldGeom.decRefCnt(); } - geometryList.remove(index); + geometryList.remove(index); } } dirtyBoundsCache(); @@ -2782,7 +2782,7 @@ class Shape3DRetained extends LeafRetained { changedFrequent &= ~mask; } } - } + } // Alpha is editable due to the appearance(Called on the MirrorShape3D) @@ -2799,10 +2799,10 @@ class Shape3DRetained extends LeafRetained { ((app.changedFrequent &(AppearanceRetained.RENDERING|AppearanceRetained.TRANSPARENCY)) != 0) || (app.renderingAttributes != null && (((app.renderingAttributes.changedFrequent & (RenderingAttributesRetained.IGNORE_VCOLOR |RenderingAttributesRetained.ALPHA_TEST_FUNC)) != 0))) || - + (app.transparencyAttributes != null && ((app.transparencyAttributes.changedFrequent != 0)))) { - + alphaFrequentlyEditable = true; } else if (geo instanceof GeometryArrayRetained && @@ -2824,13 +2824,13 @@ class Shape3DRetained extends LeafRetained { return alphaFrequentlyEditable; } - + int getPrimaryViewIdx() { // To avoid MT-safe issues when using View, just clone it. UnorderList viewList = VirtualUniverse.mc.cloneView(); View views[] = (View []) viewList.toArray(false); int size = viewList.arraySize(); - + for (int i=0; i < size; i++) { if (views[i].primaryView) { return views[i].viewIndex; @@ -2838,7 +2838,7 @@ class Shape3DRetained extends LeafRetained { } return 0; } - + void searchGeometryAtoms(UnorderList list) { list.add(getGeomAtom(getMirrorShape(key))); } diff --git a/src/classes/share/javax/media/j3d/SharedGroup.java b/src/classes/share/javax/media/j3d/SharedGroup.java index fb7afcf..6fa0d09 100644 --- a/src/classes/share/javax/media/j3d/SharedGroup.java +++ b/src/classes/share/javax/media/j3d/SharedGroup.java @@ -96,13 +96,13 @@ public class SharedGroup extends Group { */ public SharedGroup() { // set default read capabilities - setDefaultReadCapabilities(readCapabilities); + setDefaultReadCapabilities(readCapabilities); } /** * Returns the list of Link nodes that refer to this SharedGroup node. - * @return An array of Link nodes that refer to this SharedGroup node. + * @return An array of Link nodes that refer to this SharedGroup node. * * @since Java 3D 1.3 */ @@ -112,7 +112,7 @@ public class SharedGroup extends Group { throw new CapabilityNotSetException(J3dI18N.getString("SharedGroup1")); } } - return ((SharedGroupRetained)retained).getLinks(); + return ((SharedGroupRetained)retained).getLinks(); } @@ -124,7 +124,7 @@ public class SharedGroup extends Group { this.retained = new SharedGroupRetained(); this.retained.setSource(this); } - + /** * Compiles the source SharedGroup associated with this object and @@ -143,7 +143,7 @@ public class SharedGroup extends Group { // will throw SceneGraphCycleException if there is a cycle // in the scene graph checkForCycle(); - + ((SharedGroupRetained)this.retained).compile(); } } diff --git a/src/classes/share/javax/media/j3d/SharedGroupRetained.java b/src/classes/share/javax/media/j3d/SharedGroupRetained.java index 529d85a..d71449f 100644 --- a/src/classes/share/javax/media/j3d/SharedGroupRetained.java +++ b/src/classes/share/javax/media/j3d/SharedGroupRetained.java @@ -65,7 +65,7 @@ class SharedGroupRetained extends GroupRetained implements TargetsInterface { /** * The Shared Group Node's parent vector. - */ + */ Vector parents = new Vector(1); // J3d copy. @@ -92,7 +92,7 @@ class SharedGroupRetained extends GroupRetained implements TargetsInterface { // Group's setAuxData() super.setAuxData(s, index, hkIndex); - branchGroupPaths.add(hkIndex, s.branchGroupPaths.get(index)); + branchGroupPaths.add(hkIndex, s.branchGroupPaths.get(index)); if (orderedPaths == null) { orderedPaths = new ArrayList(1); @@ -124,7 +124,7 @@ class SharedGroupRetained extends GroupRetained implements TargetsInterface { } else { lights.add(hkIndex, null); - } + } if (fogs == null) { fogs = new ArrayList(1); @@ -134,7 +134,7 @@ class SharedGroupRetained extends GroupRetained implements TargetsInterface { } else { fogs.add(hkIndex, null); - } + } if (modelClips == null) { @@ -145,7 +145,7 @@ class SharedGroupRetained extends GroupRetained implements TargetsInterface { } else { modelClips.add(hkIndex, null); - } + } if (altAppearances == null) { @@ -156,15 +156,15 @@ class SharedGroupRetained extends GroupRetained implements TargetsInterface { } else { altAppearances.add(hkIndex, null); - } + } } - + void setNodeData(SetLiveState s) { - + // For inSharedGroup case. - int i, j, len; - + int i, j, len; + if (localToVworld == null) { localToVworld = new Transform3D[s.keys.length][]; localToVworldIndex = new int[s.keys.length][]; @@ -175,12 +175,12 @@ class SharedGroupRetained extends GroupRetained implements TargetsInterface { else { int newLen = localToVworld.length + s.keys.length; - + Transform3D newTList[][] = new Transform3D[newLen][]; HashKey newHList[] = new HashKey[newLen]; int newIndexList[][] = new int[newLen][]; CachedTargets newTargets[] = new CachedTargets[newLen]; - + len = localToVworld.length; // Copy the existing data into the newly created data objects. @@ -200,7 +200,7 @@ class SharedGroupRetained extends GroupRetained implements TargetsInterface { int[] hkIndex = new int[1]; int hkIndexPlus1, blkSize; - + s.hashkeyIndex = new int[s.keys.length]; // This should appear before super.setNodeData() if it exists @@ -213,7 +213,7 @@ class SharedGroupRetained extends GroupRetained implements TargetsInterface { } s.hashkeyIndex[j] = hkIndex[0]; - + if(hkIndex[0] == i) { // Append to last. localToVworldKeys[i] = s.keys[j]; localToVworld[i] = s.currentTransforms[j]; @@ -233,12 +233,12 @@ class SharedGroupRetained extends GroupRetained implements TargetsInterface { hkIndexPlus1, blkSize); System.arraycopy(cachedTargets, hkIndex[0], cachedTargets, hkIndexPlus1, blkSize); - + localToVworldKeys[hkIndex[0]] = s.keys[j]; localToVworld[hkIndex[0]] = s.currentTransforms[j]; localToVworldIndex[hkIndex[0]] = s.currentTransformsIndex[j]; } - + // System.err.println("SG: j = "+j+" hkIndex[0] = "+hkIndex[0]+" s.keys[j] = "+s.keys[j]); // For now (1.2.1beta2) only. We cleanup setLive, and clearLive in // next release. @@ -264,12 +264,12 @@ class SharedGroupRetained extends GroupRetained implements TargetsInterface { s.altAppearances = altAppearances; s.modelClips = modelClips; } - + void setLive(SetLiveState s) { int i,j; Targets[] newTargets = null; - + // save setLiveState Transform3D savedLocalToVworld[][] = s.localToVworld; int savedLocalToVworldIndex[][] = s.localToVworldIndex; @@ -280,7 +280,7 @@ class SharedGroupRetained extends GroupRetained implements TargetsInterface { ArrayList savedFogs = s.fogs; ArrayList savedMclips = s.modelClips; ArrayList savedAltApps = s.altAppearances; - + SharedGroupRetained savedLastSharedGroup = s.lastSharedGroup; Targets[] savedSwitchTargets = s.switchTargets; ArrayList savedSwitchStates = s.switchStates; @@ -289,7 +289,7 @@ class SharedGroupRetained extends GroupRetained implements TargetsInterface { ArrayList savedChildTransformLinks = s.childTransformLinks; GroupRetained savedParentTransformLink = s.parentTransformLink; int[] savedHashkeyIndex = s.hashkeyIndex; - + // update setLiveState for this node // Note that s.containsNodesList is updated in super.setLive s.lastSharedGroup = this; @@ -303,7 +303,7 @@ class SharedGroupRetained extends GroupRetained implements TargetsInterface { newTargets[i] = new Targets(); } else { newTargets[i] = null; - } + } } s.transformTargets = newTargets; @@ -334,7 +334,7 @@ class SharedGroupRetained extends GroupRetained implements TargetsInterface { s.fogs = savedFogs; s.modelClips = savedMclips; s.altAppearances = savedAltApps; - + s.lastSharedGroup = savedLastSharedGroup; s.switchTargets = savedSwitchTargets; s.switchStates = savedSwitchStates; @@ -360,7 +360,7 @@ class SharedGroupRetained extends GroupRetained implements TargetsInterface { * remove the localToVworld transform for a node. */ void removeNodeData(SetLiveState s) { - + int numChildren = children.size(); ArrayList switchTargets; int i,j; @@ -369,7 +369,7 @@ class SharedGroupRetained extends GroupRetained implements TargetsInterface { localToVworld = null; localToVworldIndex = null; localToVworldKeys = null; - // restore to default and avoid calling clear() + // restore to default and avoid calling clear() // that may clear parent reference branchGroupPaths // Note that this function did not invoke super.removeNodeData() branchGroupPaths = new ArrayList(1); @@ -384,10 +384,10 @@ class SharedGroupRetained extends GroupRetained implements TargetsInterface { } else { int index, len; - - // Remove the localToVworld key + + // Remove the localToVworld key int newLen = localToVworld.length - s.keys.length; - + Transform3D[][] newTList = new Transform3D[newLen][]; HashKey[] newHList = new HashKey[newLen]; Transform3D newChildTList[][] = null; @@ -397,14 +397,14 @@ class SharedGroupRetained extends GroupRetained implements TargetsInterface { int[] tempIndex = new int[s.keys.length]; int curStart =0, newStart =0; boolean found = false; - + for(i=0;i<s.keys.length;i++) { index = s.keys[i].equals(localToVworldKeys, 0, localToVworldKeys.length); tempIndex[i] = index; - + if(index >= 0) { - found = true; + found = true; if(index == curStart) { curStart++; } @@ -416,7 +416,7 @@ class SharedGroupRetained extends GroupRetained implements TargetsInterface { System.arraycopy(localToVworldKeys, curStart, newHList, newStart, len); System.arraycopy(cachedTargets, curStart, newTargets, newStart, len); - + curStart = index+1; newStart = newStart + len; } @@ -426,7 +426,7 @@ class SharedGroupRetained extends GroupRetained implements TargetsInterface { MasterControl.getCoreLogger().severe("Can't Find matching hashKey in SG.removeNodeData."); } } - + if((found == true) && (curStart < localToVworld.length)) { len = localToVworld.length - curStart; System.arraycopy(localToVworld, curStart, newTList, newStart, len); @@ -466,7 +466,7 @@ class SharedGroupRetained extends GroupRetained implements TargetsInterface { s.modelClips = modelClips; s.altAppearances = altAppearances; } - + void clearLive(SetLiveState s) { int i,j,k, index; @@ -514,7 +514,7 @@ class SharedGroupRetained extends GroupRetained implements TargetsInterface { } } } - + // restore setLiveState from it's local variables. // removeNodeData has altered these variables. s.localToVworld = savedLocalToVworld; @@ -569,9 +569,9 @@ class SharedGroupRetained extends GroupRetained implements TargetsInterface { j = currentKey.equals(ln.sharedGroup.localToVworldKeys,0, ln.sharedGroup.localToVworldKeys.length); if(j < 0) { - System.err.println("SharedGroupRetained : Can't find hashKey"); + System.err.println("SharedGroupRetained : Can't find hashKey"); } - + if (j < ln.sharedGroup.localToVworldKeys.length) { ln.sharedGroup.updateChildLocalToVworld( ln.sharedGroup.localToVworldKeys[j], j, @@ -587,7 +587,7 @@ class SharedGroupRetained extends GroupRetained implements TargetsInterface { void traverseSwitchChild(int child, HashKey key, int index, SwitchRetained switchRoot, boolean init, boolean swChanged, - boolean switchOn, int switchLevel, + boolean switchOn, int switchLevel, ArrayList updateList) { SwitchRetained sw; @@ -610,15 +610,15 @@ class SharedGroupRetained extends GroupRetained implements TargetsInterface { ln = (LinkRetained)obj; switchKey.set(key); switchKey.append(LinkRetained.plus).append(ln.nodeId); - + if (ln.sharedGroup.localToVworldKeys != null) { - + j = switchKey.equals(ln.sharedGroup.localToVworldKeys,0, ln.sharedGroup.localToVworldKeys.length); if(j < 0) { - System.err.println("SharedGroupRetained : Can't find hashKey"); + System.err.println("SharedGroupRetained : Can't find hashKey"); } - + if (j < ln.sharedGroup.localToVworldKeys.length) { for(k=0; k<ln.sharedGroup.children.size(); k++) { ln.sharedGroup.traverseSwitchChild(k, @@ -685,7 +685,7 @@ class SharedGroupRetained extends GroupRetained implements TargetsInterface { * @return An array of Link nodes */ Link[] getLinks() { - Link[] links; + Link[] links; // make sure this method is MT-safe synchronized(parents) { int n = parents.size(); @@ -697,7 +697,7 @@ class SharedGroupRetained extends GroupRetained implements TargetsInterface { } } return links; - } + } void insertChildrenData(int index) { if (childrenSwitchLinks == null) { @@ -739,9 +739,9 @@ class SharedGroupRetained extends GroupRetained implements TargetsInterface { // re-evalute localTargetThreads using newCachedTargets and // re-evaluate targetThreads - public void computeTargetThreads(int type, + public void computeTargetThreads(int type, CachedTargets[] newCachedTargets) { - + localTargetThreads = 0; if (type == TargetsInterface.TRANSFORM_TARGETS) { for(int i=0; i<newCachedTargets.length; i++) { @@ -758,13 +758,13 @@ class SharedGroupRetained extends GroupRetained implements TargetsInterface { for(int i=0; i<numLinks; i++) { node = (NodeRetained)childTransformLinks.get(i); if (node.nodeType == NodeRetained.LINK) { - childLink = (TargetsInterface) + childLink = (TargetsInterface) ((LinkRetained)node).sharedGroup; } else { childLink = (TargetsInterface) node; } if (childLink != null) { - targetThreads |= + targetThreads |= childLink.getTargetThreads(TargetsInterface.TRANSFORM_TARGETS); } } @@ -790,7 +790,7 @@ class SharedGroupRetained extends GroupRetained implements TargetsInterface { } } - // re-evaluate targetThreads using childTargetThreads and + // re-evaluate targetThreads using childTargetThreads and // propagate changes to ancestors public void propagateTargetThreads(int type, int childTargetThreads) { if (type == TargetsInterface.TRANSFORM_TARGETS) { @@ -823,7 +823,7 @@ class SharedGroupRetained extends GroupRetained implements TargetsInterface { if (type == TargetsInterface.TRANSFORM_TARGETS) { int size = cachedTargets.length; for (int i=0; i<size; i++) { - newCt[i] = cachedTargets[i]; + newCt[i] = cachedTargets[i]; } } else { System.err.println("copyCachedTargets: wrong arguments"); @@ -845,7 +845,7 @@ class SharedGroupRetained extends GroupRetained implements TargetsInterface { } } - public void resetCachedTargets(int type, + public void resetCachedTargets(int type, CachedTargets[] newCtArr,int child) { if (type == TargetsInterface.SWITCH_TARGETS) { // child info is not used, SG does not have per child states @@ -892,8 +892,8 @@ class SharedGroupRetained extends GroupRetained implements TargetsInterface { s.parentTransformLink = this; child.setLive(s); } - - /** + + /** * Make the boundsCache of this node and all its parents dirty */ void dirtyBoundsCache() { diff --git a/src/classes/share/javax/media/j3d/Sound.java b/src/classes/share/javax/media/j3d/Sound.java index 30bf758..395953d 100644 --- a/src/classes/share/javax/media/j3d/Sound.java +++ b/src/classes/share/javax/media/j3d/Sound.java @@ -37,17 +37,17 @@ package javax.media.j3d; * sound sources. A scene graph can contain multiple sounds. Associated with each * sound source are: a reference to sound data, an amplitude scale factor, a release * flag denoting that the sound associated with this node is to play to end when - * it is disabled, the number of times sound is to be repeated, the sound's state + * it is disabled, the number of times sound is to be repeated, the sound's state * (on or off), a scheduling region, and a flag denoting if the sound is to - * continue playing "silently" even while it is inactive. Whenever the listener + * continue playing "silently" even while it is inactive. Whenever the listener * is within a sound node's scheduling bounds this sound is potentially audible. *<P> - * Sound Data + * Sound Data * * <UL>Associated with each Sound node is a MediaContainer * which includes audio data and information about this data. * This data can be cached (buffered) or non-cached (unbuffered or streaming). - * If an AudioDevice has been attached to the PhysicalEnvironment, the sound + * If an AudioDevice has been attached to the PhysicalEnvironment, the sound * data is made ready to begin playing. * Certain functionality can not be applied to true streaming sound data:<p> * 1) querying the sound's duration (Sound.DURATION_UNKNOWN will be returned),<br> @@ -58,24 +58,24 @@ package javax.media.j3d; *<P> * Initial Gain * - * <UL>This gain is a scale factor applied to the sound data associated + * <UL>This gain is a scale factor applied to the sound data associated * with this sound source to increase or decrease its overall amplitude.</UL> *<P> * Loop * * <UL>Data for non-streaming sound (such as a sound sample) can contain two * loop points marking a section of the data that is to be looped a specific - * number of times. Thus sound data can be divided into three segments: + * number of times. Thus sound data can be divided into three segments: * the attack (before the begin loop point), the sustain (between the begin - * and end loop points), and the release (after the end loop point). If + * and end loop points), and the release (after the end loop point). If * there are no loop begin and end points defined as part of the sound data, * the begin loop point is set at the beginning of the sound data, * and the end loop point at the end of the sound data. - * If this is the case, looping the sound would mean repeating the whole - * sound. However, these allow a portion in the middle of the sound to + * If this is the case, looping the sound would mean repeating the whole + * sound. However, these allow a portion in the middle of the sound to * be looped. *<P> - * A sound can be looped a specified number of times after it is activated + * A sound can be looped a specified number of times after it is activated * before it is completed. The loop count value explicitly sets the number * of times the sound is looped. Any non-negative number is a valid value. * A value of zero denotes that the looped section is not repeated, but is @@ -88,20 +88,20 @@ package javax.media.j3d; * <P> * Release Flag * - * <UL>When a sound is disabled, its playback would normally stop immediately - * no matter what part of the sound data was currently being played. By + * <UL>When a sound is disabled, its playback would normally stop immediately + * no matter what part of the sound data was currently being played. By * setting the Release Flag to true for nodes with non-streaming sound data, - * the sound is allowed to play from its current position in the sound data + * the sound is allowed to play from its current position in the sound data * to the end of the data (without repeats), thus playing the release portion * of the sound before stopping.</UL> *<P> * Continuous Flag * - * <UL>For some applications, it's useful to turn a sound source "off" but to + * <UL>For some applications, it's useful to turn a sound source "off" but to * continue "silently" playing the sound so that when it is turned back "on" - * the sound picks up playing in the same location (over time) as it would - * have been if the sound had never been disabled (turned off). Setting the - * Continuous flag true causes the sound renderer to keep track of where + * the sound picks up playing in the same location (over time) as it would + * have been if the sound had never been disabled (turned off). Setting the + * Continuous flag true causes the sound renderer to keep track of where * (over time) the sound would be playing even when the sound is disabled.</UL> *<P> * Enable Sound @@ -111,14 +111,14 @@ package javax.media.j3d; * state, gain control parameters, continuation state, and spatialization * parameters. If the continuous state is true, even if the sound is not * active, enabling the sound starts the sound silently "playing," so that - * when the sound is activated, the sound is (potentially) heard from + * when the sound is activated, the sound is (potentially) heard from * somewhere in the middle of the sound data. Activation state can change * from active to inactive any number of times without stopping or starting * the sound. To re-start a sound at the beginning of its data, re-enable * the sound by calling setEnable with true. *<P> * Setting the enable flag to true during construction acts as a request - * to start the sound playing "as soon as it can" be started. + * to start the sound playing "as soon as it can" be started. * This could be close to immediately in limited cases, but several conditions, * detailed below, must be met for a sound to be ready to be played.</UL> *<P> @@ -131,20 +131,20 @@ package javax.media.j3d; * <UL>When the pause state is set true, a playing sound is paused. *<P> * Setting the enable flag to true during construction acts as a request - * to start the sound playing "as soon as it can" be started. + * to start the sound playing "as soon as it can" be started. * This could be close to immediately in limited cases, but several conditions, * detailed below, must be met for a sound to be ready to be played.</UL> * <P> * Scheduling Bounds * * <UL> - * A Sound is scheduled for activation when its scheduling region intersects - * the ViewPlatform's activation volume. This is used when the scheduling + * A Sound is scheduled for activation when its scheduling region intersects + * the ViewPlatform's activation volume. This is used when the scheduling * bounding leaf is set to null.</UL> *<P> * Scheduling Bounding Leaf - * - * <UL>When set to a value other than null, the scheduling bounding leaf + * + * <UL>When set to a value other than null, the scheduling bounding leaf * region overrides the scheduling bounds * object.</UL> *<P> @@ -153,11 +153,11 @@ package javax.media.j3d; * <UL>Sound Priority is used * to rank concurrently playing sounds in order of importance during playback. * When more sounds are started than the AudioDevice - * can handle, the sound node with the lowest priority ranking is + * can handle, the sound node with the lowest priority ranking is * deactivated (but continues playing silently). If a sound is deactivated - * (due to a sound with a higher + * (due to a sound with a higher * priority being started), it is automatically re-activated when - * resources become available (e.g., when a sound with a higher priority + * resources become available (e.g., when a sound with a higher priority * finishes playing), or when the ordering of sound nodes are changed due to * a change in a sound node's priority. * <P> @@ -172,7 +172,7 @@ package javax.media.j3d; * channels * and the fourth sound needs only one channel. The first and second sounds * can be started because they require seven of the eight available channels. The - * third sound can not be audibly started because it requires three channels and + * third sound can not be audibly started because it requires three channels and * only one is still available. Consequently, the third sound starts playing * 'silently.' The fourth sound can and will be started since it only requires * one channel. The third sound will be made audible when three channels become @@ -186,8 +186,8 @@ package javax.media.j3d; * available audio output resources are described in the AudioDevice class.</UL> * <P> * Duration - * - * <UL>Each sound has a length of time in milliseconds that it + * + * <UL>Each sound has a length of time in milliseconds that it * can run (including repeating loop section) * if it plays to completion. If the sound * media type is streaming, or if the sound is looped indefinitely, then a @@ -197,7 +197,7 @@ package javax.media.j3d; * * <UL>When a sound is started, it could use more than one channel on the * selected AudioDevice it is to be played on. The number of Audio Device - * channels currently used for a sound can be queried using + * channels currently used for a sound can be queried using * getNumberOfChannelsUsed().</UL> *<P> * Preparing a Sound to be Played @@ -232,7 +232,7 @@ package javax.media.j3d; * 2) is enabled then deactivated while playing; it continues playing silently<br> * 3) is enabled while it mute state is true *<P> - * When the sound finishes playing it's sound data (including all loops), it + * When the sound finishes playing it's sound data (including all loops), it * is implicitly disabled.</UL> *<P> * @see AudioDevice @@ -242,9 +242,9 @@ public abstract class Sound extends Leaf { // Constants for Sound object. // // These flags, when enabled using the setCapability method, allow an - // application to invoke methods that respectively read and write the - // sound fields. - // These capability flags are enforced only when the node is part of + // application to invoke methods that respectively read and write the + // sound fields. + // These capability flags are enforced only when the node is part of // a live or compiled scene graph. /** @@ -316,7 +316,7 @@ public abstract class Sound extends Leaf { */ public static final int ALLOW_CONT_PLAY_WRITE = CapabilityBits.SOUND_ALLOW_CONT_PLAY_WRITE; - + /** * Specifies that this node allows access to its object's sound on * information. @@ -330,7 +330,7 @@ public abstract class Sound extends Leaf { */ public static final int ALLOW_ENABLE_WRITE = CapabilityBits.SOUND_ALLOW_ENABLE_WRITE; - + /** * Specifies that this node allows read access to its scheduling bounds * information. @@ -344,21 +344,21 @@ public abstract class Sound extends Leaf { */ public static final int ALLOW_SCHEDULING_BOUNDS_WRITE = CapabilityBits.SOUND_ALLOW_SCHEDULING_BOUNDS_WRITE; - + /** * Specifies that this node allows read access to its priority order * value. */ public static final int ALLOW_PRIORITY_READ = CapabilityBits.SOUND_ALLOW_PRIORITY_READ; - + /** * Specifies that this node allows write access to its priority order * value. */ public static final int ALLOW_PRIORITY_WRITE = CapabilityBits.SOUND_ALLOW_PRIORITY_WRITE; - + /** * Specifies that this node allows access to its object's sound duration * information. @@ -386,7 +386,7 @@ public abstract class Sound extends Leaf { */ public static final int ALLOW_CHANNELS_USED_READ = CapabilityBits.SOUND_ALLOW_CHANNELS_USED_READ; - + /** * Specifies that this node allows access to its object's mute flag * information. @@ -475,10 +475,10 @@ public abstract class Sound extends Leaf { ALLOW_RATE_SCALE_FACTOR_READ, ALLOW_RELEASE_READ, ALLOW_SCHEDULING_BOUNDS_READ, - ALLOW_SOUND_DATA_READ + ALLOW_SOUND_DATA_READ }; - - + + /** * Constructs and initializes a new Sound node using default * parameters. The following defaults values are used: @@ -500,11 +500,11 @@ public abstract class Sound extends Leaf { public Sound() { // set default read capabilities setDefaultReadCapabilities(readCapabilities); - } + } /** - * Constructs and initializes a new Sound node object using the provided - * data and gain parameter values, and defaults for all other fields. This + * Constructs and initializes a new Sound node object using the provided + * data and gain parameter values, and defaults for all other fields. This * constructor implicitly loads the sound data associated with this node if * the implementation uses sound caching. * @param soundData description of JMF source data used by this sound source @@ -516,7 +516,7 @@ public abstract class Sound extends Leaf { ((SoundRetained)this.retained).setSoundData(soundData); ((SoundRetained)this.retained).setInitialGain(initialGain); - } + } /** @@ -531,7 +531,7 @@ public abstract class Sound extends Leaf { * when disabled * @param enable flag specifying whether the sound is enabled * @param region scheduling bounds - * @param priority defines playback priority if too many sounds started + * @param priority defines playback priority if too many sounds started */ public Sound(MediaContainer soundData, float initialGain, @@ -552,7 +552,7 @@ public abstract class Sound extends Leaf { ((SoundRetained)this.retained).setEnable(enable); ((SoundRetained)this.retained).setSchedulingBounds(region); ((SoundRetained)this.retained).setPriority(priority); - } + } /** * Constructs and initializes a new Sound node using provided parameter @@ -566,7 +566,7 @@ public abstract class Sound extends Leaf { * when disabled * @param enable flag specifying whether the sound is enabled * @param region scheduling bounds - * @param priority defines playback priority if too many sounds started + * @param priority defines playback priority if too many sounds started * @param rateFactor defines playback sample rate scale factor * @since Java 3D 1.3 */ @@ -581,7 +581,7 @@ public abstract class Sound extends Leaf { float rateFactor ) { // set default read capabilities setDefaultReadCapabilities(readCapabilities); - + ((SoundRetained)this.retained).setSoundData(soundData); ((SoundRetained)this.retained).setInitialGain(initialGain); ((SoundRetained)this.retained).setLoop(loopCount); @@ -591,7 +591,7 @@ public abstract class Sound extends Leaf { ((SoundRetained)this.retained).setSchedulingBounds(region); ((SoundRetained)this.retained).setPriority(priority); ((SoundRetained)this.retained).setRateScaleFactor(rateFactor); - } + } /** * Sets fields that define the sound source data of this node. @@ -603,8 +603,8 @@ public abstract class Sound extends Leaf { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_SOUND_DATA_WRITE)) throw new CapabilityNotSetException(J3dI18N.getString("Sound0")); - - if (this instanceof BackgroundSound) + + if (this instanceof BackgroundSound) ((SoundRetained)this.retained).setSoundData(soundData); else // instanceof PointSound or ConeSound ((PointSoundRetained)this.retained).setSoundData(soundData); @@ -620,12 +620,12 @@ public abstract class Sound extends Leaf { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_SOUND_DATA_READ)) throw new CapabilityNotSetException(J3dI18N.getString("Sound1")); - + return ((SoundRetained)this.retained).getSoundData(); } /** - * Set the overall gain scale factor applied to data associated with this + * Set the overall gain scale factor applied to data associated with this * source to increase or decrease its overall amplitude. * @param amplitude (gain) scale factor * @exception CapabilityNotSetException if appropriate capability is @@ -635,7 +635,7 @@ public abstract class Sound extends Leaf { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_INITIAL_GAIN_WRITE)) throw new CapabilityNotSetException(J3dI18N.getString("Sound2")); - + ((SoundRetained)this.retained).setInitialGain(amplitude); } @@ -649,7 +649,7 @@ public abstract class Sound extends Leaf { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_INITIAL_GAIN_READ)) throw new CapabilityNotSetException(J3dI18N.getString("Sound3")); - + return ((SoundRetained)this.retained).getInitialGain(); } @@ -663,7 +663,7 @@ public abstract class Sound extends Leaf { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_LOOP_WRITE)) throw new CapabilityNotSetException(J3dI18N.getString("Sound4")); - + ((SoundRetained)this.retained).setLoop(loopCount); } @@ -677,10 +677,10 @@ public abstract class Sound extends Leaf { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_LOOP_READ)) throw new CapabilityNotSetException(J3dI18N.getString("Sound5")); - + return ((SoundRetained)this.retained).getLoop(); } - + /** * Enables or disables the release flag for the sound associated with * this sound. @@ -692,7 +692,7 @@ public abstract class Sound extends Leaf { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_RELEASE_WRITE)) throw new CapabilityNotSetException(J3dI18N.getString("Sound6")); - + ((SoundRetained)this.retained).setReleaseEnable(state); } @@ -706,10 +706,10 @@ public abstract class Sound extends Leaf { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_RELEASE_READ)) throw new CapabilityNotSetException(J3dI18N.getString("Sound7")); - + return ((SoundRetained)this.retained).getReleaseEnable(); } - + /** * Enables or disables continuous play flag. * @param state denotes if deactivated sound silently continues playing @@ -720,7 +720,7 @@ public abstract class Sound extends Leaf { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_CONT_PLAY_WRITE)) throw new CapabilityNotSetException(J3dI18N.getString("Sound8")); - + ((SoundRetained)this.retained).setContinuousEnable(state); } @@ -734,10 +734,10 @@ public abstract class Sound extends Leaf { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_CONT_PLAY_READ)) throw new CapabilityNotSetException(J3dI18N.getString("Sound9")); - + return ((SoundRetained)this.retained).getContinuousEnable(); } - + /** * Enable or disable sound. * @param state enable (on/off) flag denotes if active sound is heard @@ -748,13 +748,13 @@ public abstract class Sound extends Leaf { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_ENABLE_WRITE)) throw new CapabilityNotSetException(J3dI18N.getString("Sound10")); - - if (this instanceof BackgroundSound) + + if (this instanceof BackgroundSound) ((SoundRetained)this.retained).setEnable(state); else // instanceof PointSound or ConeSound ((PointSoundRetained)this.retained).setEnable(state); } - + /** * Retrieves sound's enabled flag. * @return sound enabled flag @@ -765,7 +765,7 @@ public abstract class Sound extends Leaf { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_ENABLE_READ)) throw new CapabilityNotSetException(J3dI18N.getString("Sound21")); - + return ((SoundRetained)this.retained).getEnable(); } @@ -777,7 +777,7 @@ public abstract class Sound extends Leaf { * region. * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph - */ + */ public void setSchedulingBounds(Bounds region) { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_SCHEDULING_BOUNDS_WRITE)) @@ -786,12 +786,12 @@ public abstract class Sound extends Leaf { ((SoundRetained)this.retained).setSchedulingBounds(region); } - /** + /** * Retrieves the Sound node's scheduling bounds. * @return this Sound's scheduling bounds information * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph - */ + */ public Bounds getSchedulingBounds() { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_SCHEDULING_BOUNDS_READ)) @@ -809,7 +809,7 @@ public abstract class Sound extends Leaf { * node's new scheduling region. * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph - */ + */ public void setSchedulingBoundingLeaf(BoundingLeaf region) { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_SCHEDULING_BOUNDS_WRITE)) @@ -818,12 +818,12 @@ public abstract class Sound extends Leaf { ((SoundRetained)this.retained).setSchedulingBoundingLeaf(region); } - /** + /** * Retrieves the Sound node's scheduling bounding leaf. * @return this Sound's scheduling bounding leaf information * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph - */ + */ public BoundingLeaf getSchedulingBoundingLeaf() { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_SCHEDULING_BOUNDS_READ)) @@ -838,26 +838,26 @@ public abstract class Sound extends Leaf { * @param priority value used to order sound's importance for playback. * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph - */ + */ public void setPriority(float priority) { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_PRIORITY_WRITE)) throw new CapabilityNotSetException(J3dI18N.getString("Sound15")); - + ((SoundRetained)this.retained).setPriority(priority); } - + /** * Retrieves sound's priority value. * @return sound priority value * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph - */ + */ public float getPriority() { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_PRIORITY_READ)) throw new CapabilityNotSetException(J3dI18N.getString("Sound16")); - + return ((SoundRetained)this.retained).getPriority(); } @@ -869,7 +869,7 @@ public abstract class Sound extends Leaf { * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ - public long getDuration() { + public long getDuration() { if (isLiveOrCompiled()) if (!this.getCapability(ALLOW_DURATION_READ)) throw new CapabilityNotSetException(J3dI18N.getString("Sound17")); @@ -890,7 +890,7 @@ public abstract class Sound extends Leaf { if (isLiveOrCompiled()) if (!this.getCapability(ALLOW_IS_READY_READ)) throw new CapabilityNotSetException(J3dI18N.getString("Sound22")); - + return ((SoundRetained)this.retained).isReady(); } @@ -908,7 +908,7 @@ public abstract class Sound extends Leaf { if (isLiveOrCompiled()) if (!this.getCapability(ALLOW_IS_READY_READ)) throw new CapabilityNotSetException(J3dI18N.getString("Sound22")); - + return ((SoundRetained)this.retained).isReady(view); } @@ -924,7 +924,7 @@ public abstract class Sound extends Leaf { if (isLiveOrCompiled()) if (!this.getCapability(ALLOW_IS_PLAYING_READ)) throw new CapabilityNotSetException(J3dI18N.getString("Sound18")); - + return ((SoundRetained)this.retained).isPlaying(); } @@ -942,7 +942,7 @@ public abstract class Sound extends Leaf { if (isLiveOrCompiled()) if (!this.getCapability(ALLOW_IS_PLAYING_READ)) throw new CapabilityNotSetException(J3dI18N.getString("Sound18")); - + return ((SoundRetained)this.retained).isPlaying(view); } @@ -957,7 +957,7 @@ public abstract class Sound extends Leaf { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_IS_PLAYING_READ)) throw new CapabilityNotSetException(J3dI18N.getString("Sound18")); - + return ((SoundRetained)this.retained).isPlayingSilently(); } @@ -977,23 +977,23 @@ public abstract class Sound extends Leaf { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_IS_PLAYING_READ)) throw new CapabilityNotSetException(J3dI18N.getString("Sound18")); - + return ((SoundRetained)this.retained).isPlayingSilently(view); } - /** + /** * Retrieves number of channels that are being used to render this sound * on the audio device associated with the Virtual Universe's primary view. * @return number of channels used by sound; returns 0 if not playing * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph - */ + */ public int getNumberOfChannelsUsed() { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_CHANNELS_USED_READ)) throw new CapabilityNotSetException(J3dI18N.getString("Sound20")); - + return ((SoundRetained)this.retained).getNumberOfChannelsUsed(); } @@ -1010,7 +1010,7 @@ public abstract class Sound extends Leaf { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_CHANNELS_USED_READ)) throw new CapabilityNotSetException(J3dI18N.getString("Sound20")); - + return ((SoundRetained)this.retained).getNumberOfChannelsUsed(view); } @@ -1026,13 +1026,13 @@ public abstract class Sound extends Leaf { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_MUTE_WRITE)) throw new CapabilityNotSetException(J3dI18N.getString("Sound23")); - + ((SoundRetained)this.retained).setMute(state); } /** * Retrieves sound Mute state. - * A return value of true does not imply that the sound has + * A return value of true does not imply that the sound has * been started playing or is still playing silently. * @return mute state flag * @exception CapabilityNotSetException if appropriate capability is @@ -1043,7 +1043,7 @@ public abstract class Sound extends Leaf { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_MUTE_READ)) throw new CapabilityNotSetException(J3dI18N.getString("Sound24")); - + return ((SoundRetained)this.retained).getMute(); } @@ -1058,13 +1058,13 @@ public abstract class Sound extends Leaf { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_PAUSE_WRITE)) throw new CapabilityNotSetException(J3dI18N.getString("Sound25")); - + ((SoundRetained)this.retained).setPause(state); } /** * Retrieves the value of the Pause state flag. - * A return value of true does not imply that the sound was + * A return value of true does not imply that the sound was * started playing and then paused. * @return pause state * @exception CapabilityNotSetException if appropriate capability is @@ -1075,7 +1075,7 @@ public abstract class Sound extends Leaf { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_PAUSE_READ)) throw new CapabilityNotSetException(J3dI18N.getString("Sound26")); - + return ((SoundRetained)this.retained).getPause(); } @@ -1093,7 +1093,7 @@ public abstract class Sound extends Leaf { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_RATE_SCALE_FACTOR_WRITE)) throw new CapabilityNotSetException(J3dI18N.getString("Sound27")); - + ((SoundRetained)this.retained).setRateScaleFactor(scaleFactor); } @@ -1108,7 +1108,7 @@ public abstract class Sound extends Leaf { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_RATE_SCALE_FACTOR_READ)) throw new CapabilityNotSetException(J3dI18N.getString("Sound28")); - + return ((SoundRetained)this.retained).getRateScaleFactor(); } @@ -1117,7 +1117,7 @@ public abstract class Sound extends Leaf { * <code>originalNode</code> into * the current node. This method is called from the * <code>cloneNode</code> method which is, in turn, called by the - * <code>cloneTree</code> method.<P> + * <code>cloneTree</code> method.<P> * * @param originalNode the original node to duplicate. * @param forceDuplicate when set to <code>true</code>, causes the diff --git a/src/classes/share/javax/media/j3d/SoundRenderer.java b/src/classes/share/javax/media/j3d/SoundRenderer.java index c51b5fe..9c9f249 100644 --- a/src/classes/share/javax/media/j3d/SoundRenderer.java +++ b/src/classes/share/javax/media/j3d/SoundRenderer.java @@ -59,7 +59,7 @@ class SoundRenderer extends Object { else System.err.println("AuralAttributes is null"); } - + void update(SoundRetained sound, SoundscapeRetained ss) { AuralAttributesRetained aa = ss.attributes.mirrorAa; @@ -74,7 +74,7 @@ class SoundRenderer extends Object { System.err.println("Soundscape is " + ss); } } - + void deactivate(SoundRetained sound) { if (false) { if (sound instanceof BackgroundSoundRetained) { @@ -86,9 +86,9 @@ class SoundRenderer extends Object { } } } - + public String toString() { return ""; } - + } diff --git a/src/classes/share/javax/media/j3d/SoundRetained.java b/src/classes/share/javax/media/j3d/SoundRetained.java index 57307b0..cf66692 100644 --- a/src/classes/share/javax/media/j3d/SoundRetained.java +++ b/src/classes/share/javax/media/j3d/SoundRetained.java @@ -40,7 +40,7 @@ import java.util.ArrayList; * SoundRetained is an abstract class that contains instance varables common * to all retained sounds. */ - + abstract class SoundRetained extends LeafRetained { @@ -51,45 +51,45 @@ abstract class SoundRetained extends LeafRetained /** * sound data associated with sound source - */ + */ MediaContainer soundData = null; /** * Overall Scale Factor applied to sound. - */ + */ float initialGain = 1.0f; // Valid values are >= 0.0. /** * Number of times sound is looped/repeated during play - */ + */ int loopCount = 0; // Range from 0 to POSITIVE_INFINITY(-1) /** * Switch for turning sound on or off while the sound is "active" - */ + */ boolean enable = false; /** * Type of release when sound is disabled. * If true, sound plays thru to end of sample before disabled * Otherwise, sound is disabled immediately. - */ + */ boolean release = false; /** * Flag denoting if sound silently continues playing when it's deactivated. - */ + */ boolean continuous = false; /** * Flag denoting if sound is explicitly muted, so that if begins playing * it will be played silently. - */ + */ boolean mute = false; /** * Flag denoting if sound is paused from playing - waiting to be resumed - */ + */ boolean pause = false; /** @@ -109,7 +109,7 @@ abstract class SoundRetained extends LeafRetained */ Bounds schedulingRegion = null; - /** + /** * The bounding leaf reference */ BoundingLeafRetained boundingLeaf = null; @@ -130,35 +130,35 @@ abstract class SoundRetained extends LeafRetained static final int SOUND_DATA_DIRTY_BIT = 0x0001; static final int INITIAL_GAIN_DIRTY_BIT = 0x0002; static final int LOOP_COUNT_DIRTY_BIT = 0x0004; - static final int BOUNDS_DIRTY_BIT = 0x0008; - static final int BOUNDING_LEAF_DIRTY_BIT = 0x0010; - static final int PRIORITY_DIRTY_BIT = 0x0020; - static final int POSITION_DIRTY_BIT = 0x0040; - static final int DISTANCE_GAIN_DIRTY_BIT = 0x0080; - static final int BACK_DISTANCE_GAIN_DIRTY_BIT = 0x0100; - static final int DIRECTION_DIRTY_BIT = 0x0200; - static final int ANGULAR_ATTENUATION_DIRTY_BIT = 0x0400; - static final int RATE_DIRTY_BIT = 0x0800; - - static final int BOUNDS_CHANGED = + static final int BOUNDS_DIRTY_BIT = 0x0008; + static final int BOUNDING_LEAF_DIRTY_BIT = 0x0010; + static final int PRIORITY_DIRTY_BIT = 0x0020; + static final int POSITION_DIRTY_BIT = 0x0040; + static final int DISTANCE_GAIN_DIRTY_BIT = 0x0080; + static final int BACK_DISTANCE_GAIN_DIRTY_BIT = 0x0100; + static final int DIRECTION_DIRTY_BIT = 0x0200; + static final int ANGULAR_ATTENUATION_DIRTY_BIT = 0x0400; + static final int RATE_DIRTY_BIT = 0x0800; + + static final int BOUNDS_CHANGED = BOUNDS_DIRTY_BIT | BOUNDING_LEAF_DIRTY_BIT; - static final int ATTRIBUTE_DIRTY_BITS = - SOUND_DATA_DIRTY_BIT | INITIAL_GAIN_DIRTY_BIT | - LOOP_COUNT_DIRTY_BIT | PRIORITY_DIRTY_BIT | + static final int ATTRIBUTE_DIRTY_BITS = + SOUND_DATA_DIRTY_BIT | INITIAL_GAIN_DIRTY_BIT | + LOOP_COUNT_DIRTY_BIT | PRIORITY_DIRTY_BIT | RATE_DIRTY_BIT; - static final int POSITIONAL_DIRTY_BITS = + static final int POSITIONAL_DIRTY_BITS = ATTRIBUTE_DIRTY_BITS | POSITION_DIRTY_BIT | DISTANCE_GAIN_DIRTY_BIT; - static final int DIRECTIONAL_DIRTY_BITS = + static final int DIRECTIONAL_DIRTY_BITS = POSITIONAL_DIRTY_BITS | BACK_DISTANCE_GAIN_DIRTY_BIT | DIRECTION_DIRTY_BIT | ANGULAR_ATTENUATION_DIRTY_BIT; // All attribute bits that are specifically set or cleared for any node */ static final int ALL_ATTIBS_DIRTY_BITS = 0x0FFF; - + // State Dirty bit flags // This bitmask is set when scene graph state is changed. static final int LIVE_DIRTY_BIT = 0x0001; @@ -194,7 +194,7 @@ abstract class SoundRetained extends LeafRetained /** * Array of references to sound scheduler atoms associated with this node. * For each view that a sound node is associated with a sound scheduler - * atom is created and maintained + * atom is created and maintained */ // for a particular view that are playing either audibly or silently. private SoundSchedulerAtom[] loadedAtoms = new SoundSchedulerAtom[1]; @@ -202,12 +202,12 @@ abstract class SoundRetained extends LeafRetained /** * This is true when this sound is referenced in an immediate mode context - */ + */ boolean inImmCtx = false; /** * Load Sound Data Status - */ + */ static final int LOAD_COMPLETE = 2; // load requested but could not be performed due because sound not live static final int LOAD_PENDING = 1; @@ -285,7 +285,7 @@ abstract class SoundRetained extends LeafRetained /** * Associates sound data with this sound source node - * Attempt to load sound + * Attempt to load sound * @param soundData descrition of sound source data */ void setSoundData(MediaContainer soundData) { @@ -326,7 +326,7 @@ abstract class SoundRetained extends LeafRetained return ( this.soundData ); } - + /** * Set the gain scale factor applied to this sound * @param amplitude gain scale factor @@ -334,7 +334,7 @@ abstract class SoundRetained extends LeafRetained void setInitialGain(float scaleFactor) { if (scaleFactor < 0.0f) this.initialGain = 0.0f; - else + else this.initialGain = scaleFactor; dispatchAttribChange(INITIAL_GAIN_DIRTY_BIT, (new Float(scaleFactor))); @@ -362,7 +362,7 @@ abstract class SoundRetained extends LeafRetained this.loopCount = (int) loopCount; if (debugFlag) debugPrint("setLoopCount called with " + this.loopCount); - + dispatchAttribChange(LOOP_COUNT_DIRTY_BIT, (new Integer(loopCount))); if (source != null && source.isLive()) { notifySceneGraphChanged(false); @@ -494,11 +494,11 @@ abstract class SoundRetained extends LeafRetained /** * Set the Sound's scheduling region to the specified Leaf node. - */ + */ void setSchedulingBoundingLeaf(BoundingLeaf region) { int i; int numSnds = numMirrorSounds; - if (numMirrorSounds == 0) + if (numMirrorSounds == 0) numSnds = 1; if ((boundingLeaf != null) && @@ -520,7 +520,7 @@ abstract class SoundRetained extends LeafRetained } else { boundingLeaf = null; } - // XXXX: since BoundingLeaf constructor only takes Bounds + // XXXX: since BoundingLeaf constructor only takes Bounds // test if region passed into dispatchAttribChange correctly. dispatchAttribChange(BOUNDING_LEAF_DIRTY_BIT, region); if (source != null && source.isLive()) { @@ -530,7 +530,7 @@ abstract class SoundRetained extends LeafRetained /** * Get the Sound's scheduling region - */ + */ BoundingLeaf getSchedulingBoundingLeaf() { if (boundingLeaf != null) { return((BoundingLeaf)boundingLeaf.source); @@ -570,11 +570,11 @@ abstract class SoundRetained extends LeafRetained } } - - /** + + /** * Set sound's proirity value. * @param priority value used to order sound's importance for playback. - */ + */ void setPriority(float rank) { if (rank == this.priority) // changing priority is expensive in the sound scheduler(s) @@ -587,20 +587,20 @@ abstract class SoundRetained extends LeafRetained if (source != null && source.isLive()) { notifySceneGraphChanged(false); } - } - - /** + } + + /** * Retrieves sound's priority value. - * @return sound priority value - */ - float getPriority() { + * @return sound priority value + */ + float getPriority() { return (this.priority); } /** * Retrieves sound's duration in milliseconds - * @return sound's duration, returns DURATION_UNKNOWN if duration could + * @return sound's duration, returns DURATION_UNKNOWN if duration could * not be queried from the audio device */ long getDuration() { @@ -608,23 +608,23 @@ abstract class SoundRetained extends LeafRetained } - /** - * Set scale factor + /** + * Set scale factor * @param scaleFactor applied to sound playback rate - */ + */ void setRateScaleFactor(float scaleFactor) { this.rate = scaleFactor; dispatchAttribChange(RATE_DIRTY_BIT, (new Float(scaleFactor))); if (source != null && source.isLive()) { notifySceneGraphChanged(false); } - } - - /** + } + + /** * Retrieves sound's rate scale factor * @return sound rate scale factor - */ - float getRateScaleFactor() { + */ + float getRateScaleFactor() { return (this.rate); } @@ -656,7 +656,7 @@ abstract class SoundRetained extends LeafRetained // remove atom from array of playing atoms if it is in list boolean atomFound = false; int i; - for (i=0; i<atomCount; i++) { + for (i=0; i<atomCount; i++) { if (atom == loadedAtoms[i]) { atomFound = true; continue; @@ -666,10 +666,10 @@ abstract class SoundRetained extends LeafRetained return; // otherwise remove atom from list by close up list - for (int j=i; j<atomCount; j++) { + for (int j=i; j<atomCount; j++) { loadedAtoms[j] = loadedAtoms[j+1]; } - atomCount--; + atomCount--; if (atomCount == 0) this.duration = Sound.DURATION_UNKNOWN; // clear sound duration } @@ -682,11 +682,11 @@ abstract class SoundRetained extends LeafRetained * true only if the following are true for all views/sound schedulers: * * <ul> - * 1) the Sound node has a non-null sound data and this data has + * 1) the Sound node has a non-null sound data and this data has * sucessfully been loaded/opened/copied/attached;<br> * 2) the Sound node is live;<br> * 3) there is at least one active View in the Universe; and<br> - * 4) an instance of an AudioDevice is attached to the current + * 4) an instance of an AudioDevice is attached to the current * PhysicalEnvironment. * </ul> * @@ -704,7 +704,7 @@ abstract class SoundRetained extends LeafRetained else if (atom.loadStatus == SoundRetained.LOAD_COMPLETE) { atomFoundReady = true; - continue; + continue; } else return false; @@ -723,11 +723,11 @@ abstract class SoundRetained extends LeafRetained * true only if the following are true for the given view: * * <ul> - * 1) the Sound node has a non-null sound data and this data has + * 1) the Sound node has a non-null sound data and this data has * sucessfully been loaded/opened/copied/attached;<br> * 2) the Sound node is live;<br> * 3) the given View is active in the Universe; and<br> - * 4) an instance of an AudioDevice is attached to the current + * 4) an instance of an AudioDevice is attached to the current * PhysicalEnvironment. * </ul> * @@ -753,7 +753,7 @@ abstract class SoundRetained extends LeafRetained continue; } return false; // sound scheduler atom for given view not found - + } // ******************************* @@ -767,7 +767,7 @@ abstract class SoundRetained extends LeafRetained * @return sound playing flag */ boolean isPlaying() { - for (int i=0; i<atomCount; i++) { + for (int i=0; i<atomCount; i++) { SoundSchedulerAtom atom = loadedAtoms[i]; if (atom == null || atom.soundScheduler == null) continue; @@ -775,7 +775,7 @@ abstract class SoundRetained extends LeafRetained return true; else continue; // look for at lease one atom that is playing - } + } // not even one atom is associated with this node so none are playing return false; } @@ -791,7 +791,7 @@ abstract class SoundRetained extends LeafRetained boolean isPlaying(View viewRef) { if (viewRef == null) return false; - for (int i=0; i<atomCount; i++) { + for (int i=0; i<atomCount; i++) { SoundSchedulerAtom atom = loadedAtoms[i]; if (atom == null || atom.soundScheduler == null) continue; @@ -814,16 +814,16 @@ abstract class SoundRetained extends LeafRetained * @return sound playing flag */ boolean isPlayingSilently() { - for (int i=0; i<atomCount; i++) { - SoundSchedulerAtom atom = loadedAtoms[i]; + for (int i=0; i<atomCount; i++) { + SoundSchedulerAtom atom = loadedAtoms[i]; if (atom == null || atom.soundScheduler == null) continue; if (atom.status == SoundSchedulerAtom.SOUND_SILENT) return true; else return false; - } - return false; // atom not found in list or not playing audibilly + } + return false; // atom not found in list or not playing audibilly } /** @@ -837,10 +837,10 @@ abstract class SoundRetained extends LeafRetained boolean isPlayingSilently(View viewRef) { if (viewRef == null) return false; - for (int i=0; i<atomCount; i++) { + for (int i=0; i<atomCount; i++) { SoundSchedulerAtom atom = loadedAtoms[i]; if (atom == null || atom.soundScheduler == null) - continue; + continue; if (atom.soundScheduler.view == viewRef) { if (atom.status == SoundSchedulerAtom.SOUND_SILENT) return true; @@ -861,7 +861,7 @@ abstract class SoundRetained extends LeafRetained int getNumberOfChannelsUsed() { // retrieves the number of channels used by the atom that is: // loaded, and - // playing either audibily or silently + // playing either audibily or silently // on the device associated with the primary view. View primaryView = this.universe.getCurrentView(); if (primaryView == null) @@ -869,15 +869,15 @@ abstract class SoundRetained extends LeafRetained // find atom associated with primary view (VirtualUniverse currentView) // then return the number of channels associated with that atom - SoundSchedulerAtom atom; - for (int i=0; i<atomCount; i++) { - atom = loadedAtoms[i]; + SoundSchedulerAtom atom; + for (int i=0; i<atomCount; i++) { + atom = loadedAtoms[i]; if (atom == null || atom.soundScheduler == null) continue; if (atom.soundScheduler.view == primaryView) { return atom.numberChannels; } - } + } return 0; // atom associated with primary view not found } @@ -890,19 +890,19 @@ abstract class SoundRetained extends LeafRetained int getNumberOfChannelsUsed(View viewRef) { // retrieves the number of channels used by the atom that is: // loaded, and - // playing either audibily or silently + // playing either audibily or silently // on the device associated with the given view. if (viewRef == null) return 0; SoundSchedulerAtom atom; - for (int i=0; i<atomCount; i++) { - atom = loadedAtoms[i]; + for (int i=0; i<atomCount; i++) { + atom = loadedAtoms[i]; if (atom == null || atom.soundScheduler == null) continue; if (atom.soundScheduler.view == viewRef) { return atom.numberChannels; } - } + } return 0; // atom associated with primary view not found } @@ -914,23 +914,23 @@ abstract class SoundRetained extends LeafRetained */ void setMute(boolean state) { this.mute = state; - dispatchAttribChange(MUTE_DIRTY_BIT, (state ? Boolean.TRUE: Boolean.FALSE)); + dispatchAttribChange(MUTE_DIRTY_BIT, (state ? Boolean.TRUE: Boolean.FALSE)); if (source != null && source.isLive()) { notifySceneGraphChanged(false); } - } - - /** + } + + /** * Retrieves sound Mute state. - * A return value of true does not imply that the sound has - * been started playing or is still playing silently. + * A return value of true does not imply that the sound has + * been started playing or is still playing silently. * @return mute state flag * @since Java 3D 1.3 - */ + */ boolean getMute() { return (boolean) this.mute; } - + /** * Set pause state flag. If the sound is playing it will be paused * @param state flag @@ -938,19 +938,19 @@ abstract class SoundRetained extends LeafRetained */ void setPause(boolean state) { this.pause = state; - dispatchAttribChange(PAUSE_DIRTY_BIT, (state ? Boolean.TRUE: Boolean.FALSE)); + dispatchAttribChange(PAUSE_DIRTY_BIT, (state ? Boolean.TRUE: Boolean.FALSE)); if (source != null && source.isLive()) { notifySceneGraphChanged(false); } - } - - /** + } + + /** * Retrieves sound Pause state. - * A return value of true does not imply that the sound has + * A return value of true does not imply that the sound has * been started playing auditibly or silently. * @return mute state flag * @since Java 3D 1.3 - */ + */ boolean getPause() { return (boolean) this.pause; } @@ -958,14 +958,14 @@ abstract class SoundRetained extends LeafRetained /** * This sets the immedate mode context flag - */ + */ void setInImmCtx(boolean inCtx) { inImmCtx = inCtx; } /** * This gets the immedate mode context flag - */ + */ boolean getInImmCtx() { return (inImmCtx); } @@ -989,9 +989,9 @@ abstract class SoundRetained extends LeafRetained newSounds[i] = mirrorSounds[i]; } mirrorSounds = newSounds; - } + } // mirrorSounds[numMirrorSounds] = (SoundRetained) this.clone(); - mirrorSounds[numMirrorSounds] = (SoundRetained) this.clone(); + mirrorSounds[numMirrorSounds] = (SoundRetained) this.clone(); //mirrorSounds[numMirrorSounds].key = new HashKey(key); mirrorSounds[numMirrorSounds].key = key; mirrorSounds[numMirrorSounds].sgSound = this; @@ -1043,7 +1043,7 @@ abstract class SoundRetained extends LeafRetained else { ms.boundingLeaf = null; } - + if (schedulingRegion != null) { ms.schedulingRegion = (Bounds) schedulingRegion.clone(); // Assign region only if bounding leaf is null @@ -1052,7 +1052,7 @@ abstract class SoundRetained extends LeafRetained ms.transformedRegion.transform(ms.schedulingRegion, ms.getLastLocalToVworld()); } - + } else { ms.schedulingRegion = null; @@ -1065,9 +1065,9 @@ abstract class SoundRetained extends LeafRetained if (debugFlag) debugPrint("Sound.setLive"); - + if (inImmCtx) { - throw new + throw new IllegalSharingException(J3dI18N.getString("SoundRetained2")); } super.setLive(s); @@ -1091,11 +1091,11 @@ abstract class SoundRetained extends LeafRetained ms = this.getMirrorSound(s.keys[i]); ms.localToVworld = new Transform3D[1][]; ms.localToVworldIndex = new int[1][]; - + j = s.keys[i].equals(localToVworldKeys, 0, localToVworldKeys.length); if(j < 0) { - System.err.println("SoundRetained : Can't find hashKey"); + System.err.println("SoundRetained : Can't find hashKey"); } ms.localToVworld[0] = localToVworld[j]; @@ -1255,7 +1255,7 @@ abstract class SoundRetained extends LeafRetained sound.sgSound = sgSound; sound.key = key; sound.numMirrorSounds = numMirrorSounds; - for (int index=0; index<numMirrorSounds; index++) + for (int index=0; index<numMirrorSounds; index++) sound.mirrorSounds = mirrorSounds; sound.universe = universe; if (universe.sounds.contains(sound) == false) { @@ -1282,7 +1282,7 @@ abstract class SoundRetained extends LeafRetained } } dispatchStateChange(XFORM_DIRTY_BIT, null); - } + } // QUESTION: // Clone method (from 1.1.1 version) removed!?!?!? yet LightRetained has it @@ -1309,8 +1309,8 @@ abstract class SoundRetained extends LeafRetained break; } } - + } } - + } diff --git a/src/classes/share/javax/media/j3d/SoundScheduler.java b/src/classes/share/javax/media/j3d/SoundScheduler.java index 11bb5e6..a66bd99 100644 --- a/src/classes/share/javax/media/j3d/SoundScheduler.java +++ b/src/classes/share/javax/media/j3d/SoundScheduler.java @@ -576,7 +576,7 @@ class SoundScheduler extends J3dStructure { // flag which is not implement turnOff(soundAtom); // Fix to Issue 431. - soundAtom.enable(soundRetained.enable); + soundAtom.enable(soundRetained.enable); } } } @@ -3226,7 +3226,7 @@ class SoundScheduler extends J3dStructure { // result in the re-evaluation of the lights/fogs/backgrounds Object[] users = (Object[])(m.args[3]); int i; - + for (i = 0; i < users.length; i++) { LeafRetained leaf = (LeafRetained)users[i]; if (leaf instanceof SoundRetained && universe.soundStructure.isSoundScopedToView(leaf, view)) { diff --git a/src/classes/share/javax/media/j3d/SoundSchedulerAtom.java b/src/classes/share/javax/media/j3d/SoundSchedulerAtom.java index a02328f..482c559 100644 --- a/src/classes/share/javax/media/j3d/SoundSchedulerAtom.java +++ b/src/classes/share/javax/media/j3d/SoundSchedulerAtom.java @@ -34,11 +34,11 @@ package javax.media.j3d; import java.util.ArrayList; /** - * A SoundSchedulerAtom is the smallest object representing a Sound within + * A SoundSchedulerAtom is the smallest object representing a Sound within * SoundScheduler. This class contains View-Depedent fields. Some of these - * fields may appear to over lap fields in the Sound Node classes, but + * fields may appear to over lap fields in the Sound Node classes, but * remember that the Sound Node fields are universal, user-defined fields - * and do not take into account specific Audio Device view-dependent + * and do not take into account specific Audio Device view-dependent * conditions. */ @@ -46,12 +46,12 @@ class SoundSchedulerAtom extends Object { /** * The mirror sound node component of this sound scheduler atom - */ + */ SoundRetained sound = null; /** * MediaContainer currently loaded for this atom - */ + */ MediaContainer soundData = null; // Maintain continuously playing silent sound sources. @@ -70,12 +70,12 @@ class SoundSchedulerAtom extends Object { /** * Is this sound in an active scheduling region - */ + */ boolean activated = false; /** * Switch for turning sound on or off while the sound is "active" - */ + */ static final int OFF = 0; static final int ON = 1; static final int PENDING_ON = 2; @@ -128,7 +128,7 @@ class SoundSchedulerAtom extends Object { /** * This status flag is used for sound scheduling - */ + */ static final int SOUND_OFF = 0; // The sound is not playing static final int SOUND_AUDIBLE = 1; // The sound is potentially audible static final int SOUND_SILENT = 2; // The sound is playing silently @@ -142,38 +142,38 @@ class SoundSchedulerAtom extends Object { // passed to all SoundSchedulers to update sound rendering or 'run' state // the bit for that field is cleared by the SoundStructure thread. - /** + /** * attribsDirty bit field * This bitmask is set when sound node attribute is changed by the user. - */ + */ int attribsDirty = 0x0000; - - /** + + /** * stateDirty bit field * This bitmask is set when scene graph state is changed. - */ + */ int stateDirty = 0x0000; // Load Sound Data Status maintained in SoundRetained class /** * Identifiers of sample associated with sound source - */ + */ int sampleId = SoundRetained.NULL_SOUND; /** * reference to Sound Scheduler this atom is associated with - */ + */ SoundScheduler soundScheduler = null; - /** + /** * Calculate absolute time at which sample completes * Checks playing flag denoting if sound is started already or not: * false - calcalutes endTime in relation to startTime * true - re-calculates endTime based on current position in * loop portion of sample plus release length - */ + */ synchronized void calculateEndTime() { SoundRetained sgSound = sound.sgSound; int loops = sgSound.loopCount; @@ -212,16 +212,16 @@ class SoundSchedulerAtom extends Object { debugPrint("calculateEndTime: NOT Playing so = " + endTime); } } - } + } + - void enable(boolean enabled) { if (enabled) { setEnableState(PENDING_ON); if (debugFlag) debugPrint(" enableSound calls soundAtom " + this + " setEnableState PENDING_ON"); - } + } else { setEnableState(PENDING_OFF); if (debugFlag) @@ -230,35 +230,35 @@ class SoundSchedulerAtom extends Object { } } - + void mute(boolean muted) { if (muted) { setMuteState(PENDING_MUTE); if (debugFlag) debugPrint(" muteSound() calls soundAtom " + this + " setMuteState PENDING_ON"); - } + } else { setMuteState(PENDING_UNMUTE); - if (debugFlag) + if (debugFlag) debugPrint(" muteSound() calls soundAtom " + this + " setMuteState PENDING_UNMUTE"); } } - + void pause(boolean paused) { if (paused) { setPauseState(PENDING_PAUSE); if (debugFlag) debugPrint(this + ".pause calls setPauseState(PENDING_PAUSE)"); - } + } else { setPauseState(PENDING_UNPAUSE); if (debugFlag) debugPrint(this +".pause calls setPauseState(PENDING_UNPAUSE)"); } } - + // XXXX: remove this // just set the state after debug no longer needed @@ -286,8 +286,8 @@ class SoundSchedulerAtom extends Object { debugPrint("state = " + state); break; } - } - + } + // XXXX: remove this // just set the state after debug no longer needed void setMuteState(int state) { @@ -314,8 +314,8 @@ class SoundSchedulerAtom extends Object { debugPrint("state = " + state); break; } - } - + } + // XXXX: remove this // just set the state after debug no longer needed void setPauseState(int state) { @@ -342,8 +342,8 @@ class SoundSchedulerAtom extends Object { debugPrint("state = " + state); break; } - } - + } + /** * calcActiveSchedAction() @@ -354,7 +354,7 @@ class SoundSchedulerAtom extends Object { * what SoundScheduler action to perform when sound is Active * set sound active flag true * switch on enable value, to set pending scheduling action - * depending on continuous and release flags and sound status + * depending on continuous and release flags and sound status */ synchronized int calcActiveSchedAction() { SoundRetained sgSound = sound.sgSound; @@ -377,7 +377,7 @@ class SoundSchedulerAtom extends Object { if (status == SOUND_OFF) // should NOT see this, but if we do... action = START_AUDIBLE; - else if (status == SOUND_SILENT) + else if (status == SOUND_SILENT) action = MAKE_AUDIBLE; else // status == SOUND_AUDIBLE action = LEAVE_AUDIBLE; @@ -428,8 +428,8 @@ class SoundSchedulerAtom extends Object { "action <- TURN_OFF"); action = TURN_OFF; } - } - else { // status == SOUND_OFF + } + else { // status == SOUND_OFF action = LEAVE_OFF; } break; @@ -439,7 +439,7 @@ class SoundSchedulerAtom extends Object { if (paused == PENDING_PAUSE) { // if this pause state is set to PAUSE then assume the sound is // already paused, so any incoming action that leave the state - // as it already is, leaves the sound paused. + // as it already is, leaves the sound paused. if (debugFlag) debugPrint(" PENDING_PAUSE"); switch (action) { @@ -447,12 +447,12 @@ class SoundSchedulerAtom extends Object { case LEAVE_AUDIBLE: case RESUME_AUDIBLE: action = PAUSE_AUDIBLE; - break; + break; case MAKE_SILENT: case LEAVE_SILENT: case RESUME_SILENT: action = PAUSE_SILENT; - break; + break; default: // don't change action for any other cases break; @@ -468,12 +468,12 @@ class SoundSchedulerAtom extends Object { case LEAVE_AUDIBLE: case PAUSE_AUDIBLE: action = RESUME_AUDIBLE; - break; + break; case MAKE_SILENT: case LEAVE_SILENT: case PAUSE_SILENT: action = RESUME_SILENT; - break; + break; default: // don't change action for any other cases break; @@ -491,14 +491,14 @@ class SoundSchedulerAtom extends Object { * what SoundScheduler action to perform when sound is inactive. * set sound active flag false * switch on enable value, to set pending scheduling action - * depending on continuous and release flags and sound status + * depending on continuous and release flags and sound status */ synchronized int calcInactiveSchedAction() { int action = DO_NOTHING; SoundRetained sgSound = sound.sgSound; // Sound is Inactive - // Generally, sound is OFF unless continuous flag true + // Generally, sound is OFF unless continuous flag true // then sound is silently playing if on. activated = false; @@ -572,7 +572,7 @@ class SoundSchedulerAtom extends Object { ", already OFF, action <- LEAVE_OFF"); action = LEAVE_OFF; } - } + } else { // continuous and release flag not both true if (status == SOUND_OFF) { if (debugFlag) @@ -583,7 +583,7 @@ class SoundSchedulerAtom extends Object { else { if (debugFlag) debugPrint("Enable = " + enabled + - ", not already OFF, action <- TURN_OFF"); + ", not already OFF, action <- TURN_OFF"); action = TURN_OFF; } } @@ -596,7 +596,7 @@ class SoundSchedulerAtom extends Object { if (paused == PENDING_PAUSE) { // if this pause state is set to PAUSE then assume the sound is // already paused, so any incoming action that leave the state - // as it already is, leaves the sound paused. + // as it already is, leaves the sound paused. switch (action) { case MAKE_SILENT: case LEAVE_SILENT: @@ -639,24 +639,24 @@ class SoundSchedulerAtom extends Object { /** * Set bit(s) in soundDirty field * @param binary flag denotes bits to set ON - */ + */ void setAttribsDirtyFlag(int bitFlag) { attribsDirty |= bitFlag; if (debugFlag) debugPrint("setAttribsDirtyFlag = " + bitFlag); return ; - } + } void setStateDirtyFlag(int bitFlag) { stateDirty |= bitFlag; if (debugFlag) debugPrint("setStateDirtyFlag = " + bitFlag); return ; - } - + } + /** * Clear sound's dirty flag bit value. * @param binary flag denotes bits to set OFF - */ + */ void clearAttribsDirtyFlag(int bitFlag) { if (debugFlag) debugPrint("clearAttribsDirtyFlag = " + bitFlag); @@ -682,25 +682,25 @@ class SoundSchedulerAtom extends Object { stateDirty = 0x0; return ; } - - + + /** * Test sound's dirty flag bit(s) * @param field denotes which bitmask to set into * @param binary flag denotes bits to set Test * @return true if bit(s) in bitFlag are set dirty (on) - */ + */ boolean testDirtyFlag(int field, int bitFlag) { if ((field & bitFlag) > 0) return true; else return false; } - + /** * Test sound's dirty flags for ANY bits on * @return true if any bit in bitFlag is flipped on - */ + */ boolean testDirtyFlags() { if ((attribsDirty & 0xFFFF) > 0) return true; diff --git a/src/classes/share/javax/media/j3d/SoundStructure.java b/src/classes/share/javax/media/j3d/SoundStructure.java index f3dd294..f16a4d3 100644 --- a/src/classes/share/javax/media/j3d/SoundStructure.java +++ b/src/classes/share/javax/media/j3d/SoundStructure.java @@ -55,12 +55,12 @@ class SoundStructure extends J3dStructure { /** * The list of view platforms - */ + */ UnorderList viewPlatforms = new UnorderList(ViewPlatformRetained.class); /** * A bounds used for getting a view platform scheduling BoundingSphere - */ + */ BoundingSphere tempSphere = new BoundingSphere(); BoundingSphere vpsphere = new BoundingSphere(); @@ -92,7 +92,7 @@ class SoundStructure extends J3dStructure { void processMessages(long referenceTime) { J3dMessage messages[] = getMessages(referenceTime); int nMsg = getNumMessage(); - J3dMessage m; + J3dMessage m; if (nMsg <= 0) { return; @@ -144,7 +144,7 @@ class SoundStructure extends J3dStructure { // Dispatch a message about a sound change ViewPlatformRetained vpLists[] = (ViewPlatformRetained []) viewPlatforms.toArray(false); - + // QUESTION: can I just use this message to pass to all the Sound Bins for (int k=viewPlatforms.arraySize()- 1; k>=0; k--) { View[] views = vpLists[k].getViewList(); @@ -163,7 +163,7 @@ class SoundStructure extends J3dStructure { transformMsg = false; targets = null; } - + Arrays.fill(messages, 0, nMsg, null); } @@ -219,7 +219,7 @@ class SoundStructure extends J3dStructure { /** * Add sound to sounds list. - */ + */ void addScopedSound(SoundRetained mirSound, View view) { if (debugFlag) debugPrint("SoundStructure.addSound()"); @@ -237,7 +237,7 @@ class SoundStructure extends J3dStructure { nonViewScopedSounds.add(mirSound); } // end addSound() - + void addScopedSoundscape(SoundscapeRetained soundscape, View view) { if (debugFlag) debugPrint("SoundStructure.addSoundscape()"); @@ -255,7 +255,7 @@ class SoundStructure extends J3dStructure { nonViewScopedSoundscapes.add(soundscape); } - + void removeNodes(J3dMessage m) { Object[] nodes = (Object[])m.args[0]; ArrayList viewScopedNodes = (ArrayList)m.args[3]; @@ -283,14 +283,14 @@ class SoundStructure extends J3dStructure { if (node instanceof SoundRetained) { ((SoundRetained)node).isViewScoped = false; - for (int k = 0; k < vsize; k++) { + for (int k = 0; k < vsize; k++) { View view = (View) vl.get(k); deleteScopedSound((SoundRetained) node, view); } } else if (node instanceof SoundscapeRetained) { ((SoundscapeRetained)node).isViewScoped = false; - for (int k = 0; k < vsize; k++) { + for (int k = 0; k < vsize; k++) { View view = (View) vl.get(k); deleteScopedSoundscape((SoundscapeRetained) node, view); } @@ -397,25 +397,25 @@ class SoundStructure extends J3dStructure { boolean intersect(Bounds region) { if (region == null) return false; - + ViewPlatformRetained vpLists[] = (ViewPlatformRetained []) viewPlatforms.toArray(false); - + for (int i=viewPlatforms.arraySize()- 1; i>=0; i--) { vpLists[i].schedSphere.getWithLock(tempSphere); if (tempSphere.intersect(region)) { return true; } - } + } return false; } void loadSound(SoundRetained sound, boolean forceLoad) { -// QUESTION: should not be calling into soundScheduler directly??? +// QUESTION: should not be calling into soundScheduler directly??? MediaContainer mediaContainer = sound.getSoundData(); ViewPlatformRetained vpLists[] = (ViewPlatformRetained []) viewPlatforms.toArray(false); - + for (int i=viewPlatforms.arraySize()- 1; i>=0; i--) { View[] views = vpLists[i].getViewList(); for (int j=(views.length-1); j>=0; j--) { @@ -423,7 +423,7 @@ class SoundStructure extends J3dStructure { // XXXX: Shouldn't this be done with messages?? v.soundScheduler.loadSound(sound, forceLoad); } - } + } } void enableSound(SoundRetained sound) { @@ -436,7 +436,7 @@ class SoundStructure extends J3dStructure { v.soundScheduler.enableSound(sound); } } - } + } void muteSound(SoundRetained sound) { ViewPlatformRetained vpLists[] = (ViewPlatformRetained []) @@ -448,8 +448,8 @@ class SoundStructure extends J3dStructure { v.soundScheduler.muteSound(sound); } } - } - + } + void pauseSound(SoundRetained sound) { ViewPlatformRetained vpLists[] = (ViewPlatformRetained []) viewPlatforms.toArray(false); @@ -493,7 +493,7 @@ class SoundStructure extends J3dStructure { */ } -// How can active flag (based on View orientataion) be set here for all Views?!? +// How can active flag (based on View orientataion) be set here for all Views?!? UnorderList getSoundList(View view) { ArrayList l = (ArrayList)viewScopedSounds.get(view); @@ -566,7 +566,7 @@ class SoundStructure extends J3dStructure { graphicsCtx = canvas.getGraphicsContext3D(); } - if (debugFlag) { + if (debugFlag) { debugPrint("SoundStructure: number of sounds in scene graph = "+nRetainedSounds); debugPrint("SoundStructure: number of immediate mode sounds = "+nImmedSounds); } @@ -578,7 +578,7 @@ class SoundStructure extends J3dStructure { // node.updateTransformChange() called immediately rather than // waiting for updateObject to be called and process xformChangeList // which apprears to only happen when sound started... - + UnorderList arrList = targets.targetList[Targets.SND_TARGETS]; if (arrList != null) { int j,i; @@ -593,13 +593,13 @@ class SoundStructure extends J3dStructure { if (nodes[i] instanceof ConeSoundRetained) { xformChangeList.add(nodes[i]); - ConeSoundRetained cnSndNode = + ConeSoundRetained cnSndNode = (ConeSoundRetained)nodes[i]; cnSndNode.updateTransformChange(); } else if (nodes[i] instanceof PointSoundRetained) { xformChangeList.add(nodes[i]); - PointSoundRetained ptSndNode = + PointSoundRetained ptSndNode = (PointSoundRetained)nodes[i]; ptSndNode.updateTransformChange(); @@ -610,7 +610,7 @@ class SoundStructure extends J3dStructure { } else if (nodes[i] instanceof SoundscapeRetained) { xformChangeList.add(nodes[i]); - SoundscapeRetained sndScapeNode = + SoundscapeRetained sndScapeNode = (SoundscapeRetained)nodes[i]; sndScapeNode.updateTransformChange(); @@ -620,7 +620,7 @@ class SoundStructure extends J3dStructure { } } } - } + } // Debug print mechanism for Sound nodes static final boolean debugFlag = false; @@ -659,7 +659,7 @@ class SoundStructure extends J3dStructure { ArrayList soundList = null; ArrayList soundsScapeList = null; - + if (((component & ViewSpecificGroupRetained.ADD_VIEW) != 0) || ((component & ViewSpecificGroupRetained.SET_VIEW) != 0)) { int i; @@ -700,7 +700,7 @@ class SoundStructure extends J3dStructure { ArrayList leafList; View view; - + if ((component & ViewSpecificGroupRetained.REMOVE_VIEW) != 0) { view = (View)objAry[0]; leafList = (ArrayList)objAry[2]; @@ -736,8 +736,8 @@ class SoundStructure extends J3dStructure { viewScopedSoundscapes.remove(view); } - } - + } + } void cleanup() {} diff --git a/src/classes/share/javax/media/j3d/Soundscape.java b/src/classes/share/javax/media/j3d/Soundscape.java index f448566..ff1a81b 100644 --- a/src/classes/share/javax/media/j3d/Soundscape.java +++ b/src/classes/share/javax/media/j3d/Soundscape.java @@ -94,14 +94,14 @@ public class Soundscape extends Leaf { // Array for setting default read capabilities private static final int[] readCapabilities = { ALLOW_APPLICATION_BOUNDS_READ, - ALLOW_ATTRIBUTES_READ + ALLOW_ATTRIBUTES_READ }; /** * Constructs and initializes a new Sound node using following * defaults: *<UL> application region: null (no active region)</UL> *<UL> aural attributes: null (uses default aural attributes)</UL> - */ + */ public Soundscape() { // Just use default values // set default read capabilities @@ -113,7 +113,7 @@ public class Soundscape extends Leaf { * parameters * @param region application region * @param attributes array of aural attribute component objects - */ + */ public Soundscape(Bounds region, AuralAttributes attributes) { // set default read capabilities @@ -126,7 +126,7 @@ public class Soundscape extends Leaf { /** * Creates the retained mode SoundscapeRetained object that this * component object will point to. - */ + */ void createRetained() { this.retained = new SoundscapeRetained(); this.retained.setSource(this); @@ -134,17 +134,17 @@ public class Soundscape extends Leaf { /** * Set the Soundscape's application region to the specified bounds - * specified in local coordinates of this leaf node. The aural - * attributes associated with this Soundscape are used to render - * the active sounds when this application region intersects the - * ViewPlatform's activation volume. The getApplicationBounds method + * specified in local coordinates of this leaf node. The aural + * attributes associated with this Soundscape are used to render + * the active sounds when this application region intersects the + * ViewPlatform's activation volume. The getApplicationBounds method * returns a new Bounds object. * This region is used when the application bounding leaf is null. * @param region the bounds that contains the Soundscape's new application * region. * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph - */ + */ public void setApplicationBounds(Bounds region) { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_APPLICATION_BOUNDS_WRITE)) @@ -153,12 +153,12 @@ public class Soundscape extends Leaf { ((SoundscapeRetained)this.retained).setApplicationBounds(region); } - /** + /** * Retrieves the Soundscape node's application bounds. * @return this Soundscape's application bounds information * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph - */ + */ public Bounds getApplicationBounds() { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_APPLICATION_BOUNDS_READ)) @@ -175,7 +175,7 @@ public class Soundscape extends Leaf { * node's new application region. * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph - */ + */ public void setApplicationBoundingLeaf(BoundingLeaf region) { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_APPLICATION_BOUNDS_WRITE)) @@ -184,12 +184,12 @@ public class Soundscape extends Leaf { ((SoundscapeRetained)this.retained).setApplicationBoundingLeaf(region); } - /** + /** * Retrieves the Soundscape node's application bounding leaf. * @return this Soundscape's application bounding leaf information * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph - */ + */ public BoundingLeaf getApplicationBoundingLeaf() { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_APPLICATION_BOUNDS_READ)) @@ -220,13 +220,13 @@ public class Soundscape extends Leaf { */ public AuralAttributes getAuralAttributes() { if (isLiveOrCompiled()) - if(!this.getCapability(ALLOW_ATTRIBUTES_READ)) - throw new CapabilityNotSetException(J3dI18N.getString("Soundscape5")); - + if(!this.getCapability(ALLOW_ATTRIBUTES_READ)) + throw new CapabilityNotSetException(J3dI18N.getString("Soundscape5")); + return ((SoundscapeRetained)this.retained).getAuralAttributes(); } - + /** * Creates a new instance of the node. This routine is called * by <code>cloneTree</code> to duplicate the current node. @@ -271,7 +271,7 @@ public class Soundscape extends Leaf { * <code>false</code>, the value of each node's * <code>duplicateOnCloneTree</code> variable determines whether * NodeComponent data is duplicated or copied. - * @exception ClassCastException if originalNode is not an instance of + * @exception ClassCastException if originalNode is not an instance of * <code>Soundscape</code> * * @see Node#cloneTree @@ -287,7 +287,7 @@ public class Soundscape extends Leaf { * <code>originalNode</code> into * the current node. This method is called from the * <code>cloneNode</code> method which is, in turn, called by the - * <code>cloneTree</code> method.<P> + * <code>cloneTree</code> method.<P> * * @param originalNode the original node to duplicate. * @param forceDuplicate when set to <code>true</code>, causes the @@ -310,7 +310,7 @@ public class Soundscape extends Leaf { SoundscapeRetained rt = (SoundscapeRetained) retained; rt.setApplicationBounds(attr.getApplicationBounds()); - + rt.setAuralAttributes((AuralAttributes) getNodeComponent( attr.getAuralAttributes(), forceDuplicate, diff --git a/src/classes/share/javax/media/j3d/SoundscapeRetained.java b/src/classes/share/javax/media/j3d/SoundscapeRetained.java index c637d26..7fa6945 100644 --- a/src/classes/share/javax/media/j3d/SoundscapeRetained.java +++ b/src/classes/share/javax/media/j3d/SoundscapeRetained.java @@ -33,7 +33,7 @@ package javax.media.j3d; import java.util.ArrayList; /** - * The SoundscapeRetained object defines all soundscape rendering state + * The SoundscapeRetained object defines all soundscape rendering state * as a subclass of a Leaf node. */ class SoundscapeRetained extends LeafRetained @@ -42,12 +42,12 @@ class SoundscapeRetained extends LeafRetained static final int BOUNDING_LEAF_CHANGED = 0x00002; static final int APPLICATION_BOUNDS_CHANGED = 0x00004; - /** + /** * Soundscape nodes application region - */ + */ Bounds applicationRegion = null; - /** + /** * The bounding leaf reference */ BoundingLeafRetained boundingLeaf = null; @@ -56,12 +56,12 @@ class SoundscapeRetained extends LeafRetained * The transformed Application Region */ Bounds transformedRegion = null; - - /** + + /** * Aural attributes associated with this Soundscape - */ + */ AuralAttributesRetained attributes = null; - + // A bitmask that indicates that the something has changed. int isDirty = 0xffff; @@ -87,7 +87,7 @@ class SoundscapeRetained extends LeafRetained VirtualUniverse.mc.processMessage(createMessage); } - + SoundscapeRetained() { super(); this.nodeType = NodeRetained.SOUNDSCAPE; @@ -100,7 +100,7 @@ class SoundscapeRetained extends LeafRetained /** * Set the Soundscape's application region. * @param region a region that contains the Soundscape's new application region - */ + */ void setApplicationBounds(Bounds region) { if (region != null) { @@ -124,7 +124,7 @@ class SoundscapeRetained extends LeafRetained /** * Get the Soundscape's application region. * @return this Soundscape's application region information - */ + */ Bounds getApplicationBounds() { Bounds b = null; @@ -143,7 +143,7 @@ class SoundscapeRetained extends LeafRetained /** * Set the Soundscape's application region to the specified Leaf node. - */ + */ void setApplicationBoundingLeaf(BoundingLeaf region) { if (boundingLeaf != null) { // Remove the soundscape as users of the original bounding leaf @@ -166,7 +166,7 @@ class SoundscapeRetained extends LeafRetained /** * Get the Soundscape's application region - */ + */ BoundingLeaf getApplicationBoundingLeaf() { if (boundingLeaf != null) { return (BoundingLeaf)boundingLeaf.source; @@ -218,7 +218,7 @@ class SoundscapeRetained extends LeafRetained { if (attributes != null) { return ((AuralAttributes) attributes.source); - } + } else return ((AuralAttributes) null); } @@ -238,11 +238,11 @@ class SoundscapeRetained extends LeafRetained // The update Object function. synchronized void updateMirrorObject(Object[] objs) { - // NOTE: There doesn't seem to be a use for mirror objects since + // NOTE: There doesn't seem to be a use for mirror objects since // Soundscapes can't be shared. // This method updates the transformed region from either bounding // leaf or application bounds. Bounding leaf takes precidence. - Transform3D trans = null; + Transform3D trans = null; int component = ((Integer)objs[1]).intValue(); if ((component & BOUNDING_LEAF_CHANGED) != 0) { if (this.boundingLeaf != null) { @@ -269,7 +269,7 @@ class SoundscapeRetained extends LeafRetained else { transformedRegion = null; } - } + } } // The update tranform fields @@ -311,7 +311,7 @@ class SoundscapeRetained extends LeafRetained GroupRetained group; Transform3D trans; Bounds region = null; - + if (ms == null) return; } @@ -338,7 +338,7 @@ class SoundscapeRetained extends LeafRetained else { ms.boundingLeaf = null; } - + if (applicationRegion != null) { ms.applicationRegion = (Bounds) applicationRegion.clone(); // Assign region only if bounding leaf is null @@ -347,7 +347,7 @@ class SoundscapeRetained extends LeafRetained ms.transformedRegion.transform(ms.applicationRegion, ms.getLastLocalToVworld()); } - + } else { ms.applicationRegion = null; @@ -386,7 +386,7 @@ class SoundscapeRetained extends LeafRetained if (inSharedGroup) { throw new IllegalSharingException(J3dI18N.getString("SoundscapeRetained0")); - } + } // process switch leaf if (s.switchTargets != null && @@ -399,7 +399,7 @@ class SoundscapeRetained extends LeafRetained super.markAsLive(); } - + /** * This clearLive routine first calls the superclass's method, then * it removes itself to the list of lights diff --git a/src/classes/share/javax/media/j3d/SourceCodeShader.java b/src/classes/share/javax/media/j3d/SourceCodeShader.java index cb12c36..b617910 100644 --- a/src/classes/share/javax/media/j3d/SourceCodeShader.java +++ b/src/classes/share/javax/media/j3d/SourceCodeShader.java @@ -94,13 +94,13 @@ public class SourceCodeShader extends Shader { this.retained.setSource(this); // System.err.println("SourceCodeShader.createRetained()"); } - + /** * @deprecated replaced with cloneNodeComponent(boolean forceDuplicate) */ public NodeComponent cloneNodeComponent() { SourceCodeShaderRetained scsRetained = (SourceCodeShaderRetained) retained; - + SourceCodeShader scs = new SourceCodeShader(scsRetained.getShadingLanguage(), scsRetained.getShaderType(), scsRetained.getShaderSource()); @@ -108,13 +108,13 @@ public class SourceCodeShader extends Shader { return scs; } - + /** - * Copies all node information from <code>originalNodeComponent</code> + * Copies all node information from <code>originalNodeComponent</code> * into the current node. This method is called from the * <code>duplicateNode</code> method. This routine does * the actual duplication of all "local data" (any data defined in - * this object). + * this object). * * @param originalNodeComponent the original node to duplicate * @param forceDuplicate when set to <code>true</code>, causes the @@ -127,7 +127,7 @@ public class SourceCodeShader extends Shader { * @see NodeComponent#setDuplicateOnCloneTree */ void duplicateAttributes(NodeComponent originalNodeComponent, - boolean forceDuplicate) { + boolean forceDuplicate) { super.duplicateAttributes(originalNodeComponent, forceDuplicate); String sc = ((SourceCodeShaderRetained) originalNodeComponent.retained).getShaderSource(); diff --git a/src/classes/share/javax/media/j3d/SourceCodeShaderRetained.java b/src/classes/share/javax/media/j3d/SourceCodeShaderRetained.java index 7232611..f80e371 100644 --- a/src/classes/share/javax/media/j3d/SourceCodeShaderRetained.java +++ b/src/classes/share/javax/media/j3d/SourceCodeShaderRetained.java @@ -50,12 +50,12 @@ class SourceCodeShaderRetained extends ShaderRetained { SourceCodeShaderRetained() { } - // This method is similar to setShaderSource(). - // To conform to j3d frame in retained creation, we will stick with method + // This method is similar to setShaderSource(). + // To conform to j3d frame in retained creation, we will stick with method // with init name. final void initShaderSource(String shaderSource) { this.shaderSource = shaderSource; - } + } final void set(int shadingLanguage, int shaderType, String shaderSource) { this.shadingLanguage = shadingLanguage; @@ -74,7 +74,7 @@ class SourceCodeShaderRetained extends ShaderRetained { final void setShaderSource(String shaderSource) { this.shaderSource = shaderSource; - } + } synchronized void createMirrorObject() { // System.err.println("SourceCodeShaderRetained : createMirrorObject"); @@ -86,7 +86,7 @@ class SourceCodeShaderRetained extends ShaderRetained { initMirrorObject(); } - + /** * Initializes a mirror object. */ @@ -94,7 +94,7 @@ class SourceCodeShaderRetained extends ShaderRetained { mirror.source = source; ((SourceCodeShaderRetained) mirror).set(shadingLanguage, shaderType, shaderSource); - ((SourceCodeShaderRetained) mirror).shaderData = null; + ((SourceCodeShaderRetained) mirror).shaderData = null; } synchronized void updateMirrorObject(int component, Object value) { diff --git a/src/classes/share/javax/media/j3d/SpotLight.java b/src/classes/share/javax/media/j3d/SpotLight.java index 23039c2..36fdfd8 100644 --- a/src/classes/share/javax/media/j3d/SpotLight.java +++ b/src/classes/share/javax/media/j3d/SpotLight.java @@ -53,7 +53,7 @@ import javax.vecmath.Vector3f; * lower than 0 are clamped to 0 and values over PI/2 are clamped * to PI. The default spread angle is PI radians. </LI> * <P> - * <LI>Concentration - Specifies how quickly the light intensity + * <LI>Concentration - Specifies how quickly the light intensity * attenuates as a function of the angle of radiation as measured from * the direction of radiation. The light's intensity is highest at the * center of the cone and is attenuated toward the edges of the cone @@ -62,7 +62,7 @@ import javax.vecmath.Vector3f; * to the power of the spot concentration exponent. * The higher the concentration value, the more focused the light * source. The range of values is [0.0,128.0]. The default - * concentration is 0.0, which provides uniform light + * concentration is 0.0, which provides uniform light * distribution.</LI><P> * </UL> * A spot light contributes to diffuse and specular reflections, which @@ -147,7 +147,7 @@ public class SpotLight extends PointLight { */ public SpotLight(Color3f color, Point3f position, - Point3f attenuation, + Point3f attenuation, Vector3f direction, float spreadAngle, float concentration) { @@ -175,7 +175,7 @@ public class SpotLight extends PointLight { public SpotLight(boolean lightOn, Color3f color, Point3f position, - Point3f attenuation, + Point3f attenuation, Vector3f direction, float spreadAngle, float concentration) { @@ -197,7 +197,7 @@ public class SpotLight extends PointLight { this.retained = new SpotLightRetained(); this.retained.setSource(this); } - + /** * Sets spot light spread angle. @@ -361,7 +361,7 @@ public class SpotLight extends PointLight { */ void duplicateAttributes(Node originalNode, boolean forceDuplicate) { - + super.duplicateAttributes(originalNode, forceDuplicate); SpotLightRetained attr = (SpotLightRetained) originalNode.retained; @@ -372,6 +372,6 @@ public class SpotLight extends PointLight { Vector3f v = new Vector3f(); attr.getDirection(v); rt.initDirection(v); - + } } diff --git a/src/classes/share/javax/media/j3d/SpotLightRetained.java b/src/classes/share/javax/media/j3d/SpotLightRetained.java index a618dc9..5f76e19 100644 --- a/src/classes/share/javax/media/j3d/SpotLightRetained.java +++ b/src/classes/share/javax/media/j3d/SpotLightRetained.java @@ -171,7 +171,7 @@ class SpotLightRetained extends PointLightRetained { staticTransform.transform.transform(this.direction, this.direction); } } - + /** * Sets this light's direction from the three values provided. * @param x the new x direction @@ -196,7 +196,7 @@ class SpotLightRetained extends PointLightRetained { } } - /** + /** * This update function, and its native counterpart, * updates a spot light. This includes its color, attenuation, * transformed position, spread angle, concentration, @@ -215,7 +215,7 @@ class SpotLightRetained extends PointLightRetained { } - /** + /** * This update function, and its native counterpart, * updates a directional light. This includes its * color and its transformed direction. @@ -234,7 +234,7 @@ class SpotLightRetained extends PointLightRetained { if (mLgts[i].nodeType == NodeRetained.SPOTLIGHT) { SpotLightRetained ml = (SpotLightRetained)mLgts[i]; ml.direction = (Vector3f)objs[4]; - ml.getLastLocalToVworld().transform(ml.direction, + ml.getLastLocalToVworld().transform(ml.direction, ml.xformDirection); ml.xformDirection.normalize(); } @@ -247,10 +247,10 @@ class SpotLightRetained extends PointLightRetained { ml.spreadAngle = ((Float)objs[4]).floatValue(); } } - + } else if ((component & CONCENTRATION_CHANGED) != 0) { - + for (i = 0; i < numLgts; i++) { if (mLgts[i].nodeType == NodeRetained.SPOTLIGHT) { SpotLightRetained ml = (SpotLightRetained)mLgts[i]; @@ -265,7 +265,7 @@ class SpotLightRetained extends PointLightRetained { ml.spreadAngle = ((Float)((Object[])objs[4])[9]).floatValue(); ml.concentration = ((Float)((Object[])objs[4])[10]).floatValue(); ml.direction = (Vector3f)((Object[])objs[4])[11]; - ml.getLastLocalToVworld().transform(ml.direction, + ml.getLastLocalToVworld().transform(ml.direction, ml.xformDirection); ml.xformDirection.normalize(); } @@ -283,7 +283,7 @@ class SpotLightRetained extends PointLightRetained { sr.direction = new Vector3f(direction); sr.xformDirection = new Vector3f(); return sr; - } + } diff --git a/src/classes/share/javax/media/j3d/StructureUpdateThread.java b/src/classes/share/javax/media/j3d/StructureUpdateThread.java index 1e09f35..5aeed1c 100644 --- a/src/classes/share/javax/media/j3d/StructureUpdateThread.java +++ b/src/classes/share/javax/media/j3d/StructureUpdateThread.java @@ -40,13 +40,13 @@ class StructureUpdateThread extends J3dThread { * The structure that this thread works for */ J3dStructure structure; - + /** * Some variables used to name threads correctly */ private static int numInstances[] = new int[7]; private int instanceNum[] = new int[7]; - + private synchronized int newInstanceNum(int idx) { return (++numInstances[idx]); } @@ -90,12 +90,12 @@ class StructureUpdateThread extends J3dThread { case J3dThread.UPDATE_TRANSFORM: setName("J3D-TransformStructureUpdateThread-"+ getInstanceNum(5)); break; - case J3dThread.SOUND_SCHEDULER: + case J3dThread.SOUND_SCHEDULER: setName("J3D-SoundSchedulerUpdateThread-"+ getInstanceNum(6)); break; } - + } void doWork(long referenceTime) { diff --git a/src/classes/share/javax/media/j3d/Switch.java b/src/classes/share/javax/media/j3d/Switch.java index b84d54e..8532364 100644 --- a/src/classes/share/javax/media/j3d/Switch.java +++ b/src/classes/share/javax/media/j3d/Switch.java @@ -45,7 +45,7 @@ import java.util.BitSet; */ public class Switch extends Group { - + /** * Specifies that this node allows reading its child selection * and mask values and its current child. @@ -87,7 +87,7 @@ public class Switch extends Group { private static final int[] readCapabilities = { ALLOW_SWITCH_READ }; - + /** * Constructs a Switch node with default parameters. * The default values are as follows: @@ -98,7 +98,7 @@ public class Switch extends Group { */ public Switch() { // set default read capabilities - setDefaultReadCapabilities(readCapabilities); + setDefaultReadCapabilities(readCapabilities); } /** @@ -108,7 +108,7 @@ public class Switch extends Group { */ public Switch(int whichChild) { // set default read capabilities - setDefaultReadCapabilities(readCapabilities); + setDefaultReadCapabilities(readCapabilities); ((SwitchRetained)this.retained).setWhichChild(whichChild, true); } @@ -121,7 +121,7 @@ public class Switch extends Group { */ public Switch(int whichChild, BitSet childMask){ // set default read capabilities - setDefaultReadCapabilities(readCapabilities); + setDefaultReadCapabilities(readCapabilities); ((SwitchRetained)this.retained).setWhichChild(whichChild, true); ((SwitchRetained)this.retained).setChildMask(childMask); diff --git a/src/classes/share/javax/media/j3d/SwitchRetained.java b/src/classes/share/javax/media/j3d/SwitchRetained.java index c180f04..0bbd8d4 100644 --- a/src/classes/share/javax/media/j3d/SwitchRetained.java +++ b/src/classes/share/javax/media/j3d/SwitchRetained.java @@ -52,7 +52,7 @@ class SwitchRetained extends GroupRetained implements TargetsInterface int whichChild = Switch.CHILD_NONE; /** - * The BitSet specifying which children are to be selected for + * The BitSet specifying which children are to be selected for * rendering. This is used ONLY if whichChild is set to CHILD_MASK. */ BitSet childMask = new BitSet(); @@ -84,11 +84,11 @@ class SwitchRetained extends GroupRetained implements TargetsInterface } /** - * Sets which child should be drawn. + * Sets which child should be drawn. * @param whichChild the child to choose during a render operation */ // synchronized with clearLive - synchronized void setWhichChild(int whichChild, boolean updateAlways) { + synchronized void setWhichChild(int whichChild, boolean updateAlways) { int i, nchildren; @@ -156,12 +156,12 @@ class SwitchRetained extends GroupRetained implements TargetsInterface * Returns the index of the current child. * @return the default child's index */ - int getWhichChild() { + int getWhichChild() { return this.whichChild; } /** - * Sets current childMask. + * Sets current childMask. * @param childMask a BitSet to select the children for rendering */ // synchronized with clearLive @@ -182,7 +182,7 @@ class SwitchRetained extends GroupRetained implements TargetsInterface } } this.isDirty = true; - if (source != null && source.isLive() && + if (source != null && source.isLive() && whichChild == Switch.CHILD_MASK) { updateTargets = new UpdateTargets(); ArrayList updateList = new ArrayList(1); @@ -262,7 +262,7 @@ class SwitchRetained extends GroupRetained implements TargetsInterface /** * Returns the current childMask. - * @return the current childMask + * @return the current childMask */ final BitSet getChildMask() { return (BitSet)this.childMask.clone(); @@ -322,7 +322,7 @@ class SwitchRetained extends GroupRetained implements TargetsInterface } } // Note that s.childSwitchLinks is updated in super.setLive - s.parentSwitchLink = this; + s.parentSwitchLink = this; if (!inSharedGroup) { setAuxData(s, 0, 0); @@ -332,7 +332,7 @@ class SwitchRetained extends GroupRetained implements TargetsInterface s.hashkeyIndex = new int[s.keys.length]; for(j=0; j<s.keys.length; j++) { - hkIndex = s.keys[j].equals(localToVworldKeys, 0, + hkIndex = s.keys[j].equals(localToVworldKeys, 0, localToVworldKeys.length); if(hkIndex >= 0) { setAuxData(s, j, hkIndex); @@ -349,7 +349,7 @@ class SwitchRetained extends GroupRetained implements TargetsInterface boolean switchOn; SwitchRetained switchRoot; int size; - + // save setLiveState Targets[] savedSwitchTargets = s.switchTargets; ArrayList savedSwitchStates = s.switchStates; @@ -462,7 +462,7 @@ class SwitchRetained extends GroupRetained implements TargetsInterface super.removeNodeData(s); } - + // synchronized with setWhichChild and setChildMask synchronized void clearLive(SetLiveState s) { @@ -509,7 +509,7 @@ class SwitchRetained extends GroupRetained implements TargetsInterface void traverseSwitchChild(int child, HashKey key, int index, SwitchRetained switchRoot, boolean init, - boolean swChanged, boolean switchOn, + boolean swChanged, boolean switchOn, int switchLevel, ArrayList updateList) { int i,j,k; SwitchRetained sw; @@ -543,7 +543,7 @@ class SwitchRetained extends GroupRetained implements TargetsInterface childSwitchLinks = (ArrayList)childrenSwitchLinks.get(child); - int cslSize =childSwitchLinks.size(); + int cslSize =childSwitchLinks.size(); for (i=0; i<cslSize; i++) { obj = childSwitchLinks.get(i); @@ -567,15 +567,15 @@ class SwitchRetained extends GroupRetained implements TargetsInterface if ((ln.sharedGroup != null) && (ln.sharedGroup.localToVworldKeys != null)) { - + j = switchKey.equals(ln.sharedGroup.localToVworldKeys,0, ln.sharedGroup.localToVworldKeys.length); if(j < 0) { - System.err.println("SwitchRetained : Can't find hashKey"); + System.err.println("SwitchRetained : Can't find hashKey"); } - + if (j<ln.sharedGroup.localToVworldKeys.length) { - int lscSize = ln.sharedGroup.children.size(); + int lscSize = ln.sharedGroup.children.size(); for(k=0; k<lscSize; k++) { ln.sharedGroup.traverseSwitchChild(k, ln.sharedGroup. localToVworldKeys[j], @@ -722,7 +722,7 @@ class SwitchRetained extends GroupRetained implements TargetsInterface if (validCachedBounds) { return (Bounds) cachedBounds.clone(); } - + // issue 544 Bounds boundingObject = null; if (VirtualUniverse.mc.useBoxForGroupBounds) { @@ -775,7 +775,7 @@ class SwitchRetained extends GroupRetained implements TargetsInterface */ /** - * Compiles the children of the switch, preventing shape merging at + * Compiles the children of the switch, preventing shape merging at * this level or above */ void compile(CompileState compState) { diff --git a/src/classes/share/javax/media/j3d/SwitchValueInterpolator.java b/src/classes/share/javax/media/j3d/SwitchValueInterpolator.java index 3a06d82..e8425bb 100644 --- a/src/classes/share/javax/media/j3d/SwitchValueInterpolator.java +++ b/src/classes/share/javax/media/j3d/SwitchValueInterpolator.java @@ -34,7 +34,7 @@ package javax.media.j3d; import java.util.Enumeration; /** - * SwitchValueInterpolator behavior. This class defines a + * SwitchValueInterpolator behavior. This class defines a * behavior that modifies the selected child of the target * switch node by linearly interpolating between a pair of * specified child index values (using the value generated @@ -48,12 +48,12 @@ public class SwitchValueInterpolator extends Interpolator { int lastSwitchIndex; int childCount; - // We can't use a boolean flag since it is possible + // We can't use a boolean flag since it is possible // that after alpha change, this procedure only run // once at alpha.finish(). So the best way is to // detect alpha value change. private float prevAlphaValue = Float.NaN; - private WakeupCriterion passiveWakeupCriterion = + private WakeupCriterion passiveWakeupCriterion = (WakeupCriterion) new WakeupOnElapsedFrames(0, true); // non-public, default constructor used by cloneNode @@ -61,7 +61,7 @@ public class SwitchValueInterpolator extends Interpolator { } /** - * Constructs a SwitchValueInterpolator behavior that varies its target + * Constructs a SwitchValueInterpolator behavior that varies its target * Switch node's child index between 0 and <i>n</i>-1, where <i>n</i> * is the number of children in the target Switch node. * @param alpha the alpha object for this interpolator @@ -76,11 +76,11 @@ public class SwitchValueInterpolator extends Interpolator { firstSwitchIndex = 0; childCount = target.numChildren(); lastSwitchIndex = childCount - 1; - + } /** - * Constructs a SwitchValueInterpolator behavior that varies its target + * Constructs a SwitchValueInterpolator behavior that varies its target * Switch node's child index between the two values provided. * @param alpha the alpha object for this interpolator * @param target the Switch node affected by this interpolator @@ -101,7 +101,7 @@ public class SwitchValueInterpolator extends Interpolator { lastSwitchIndex = lastChildIndex; computeChildCount(); } - + /** * This method sets the firstChildIndex for this interpolator. * @param firstIndex the new index for the first child @@ -153,11 +153,11 @@ public class SwitchValueInterpolator extends Interpolator { return target; } - // The SwitchValueInterpolator's initialize routine uses the default + // The SwitchValueInterpolator's initialize routine uses the default // initialization routine. /** - * This method is invoked by the behavior scheduler every frame. + * This method is invoked by the behavior scheduler every frame. * It maps the alpha value that corresponds to the current time * into a child index value and updates the specified Switch node * with this new child index value. @@ -178,7 +178,7 @@ public class SwitchValueInterpolator extends Interpolator { child = (int)(firstSwitchIndex + (int)(value * (childCount-1) + 0.49999999999f)); } else { - child = (int)(firstSwitchIndex - + child = (int)(firstSwitchIndex - (int)(value * (childCount-1) + 0.49999999999f)); } target.setWhichChild(child); @@ -193,13 +193,13 @@ public class SwitchValueInterpolator extends Interpolator { /** - * calculate the number of the child to manage for this switch node + * calculate the number of the child to manage for this switch node */ final private void computeChildCount() { - if (lastSwitchIndex >= firstSwitchIndex) { + if (lastSwitchIndex >= firstSwitchIndex) { childCount = lastSwitchIndex - firstSwitchIndex + 1; } else { - childCount = firstSwitchIndex - lastSwitchIndex + 1; + childCount = firstSwitchIndex - lastSwitchIndex + 1; } } @@ -248,7 +248,7 @@ public class SwitchValueInterpolator extends Interpolator { void duplicateAttributes(Node originalNode, boolean forceDuplicate) { super.duplicateAttributes(originalNode, forceDuplicate); - SwitchValueInterpolator si = + SwitchValueInterpolator si = (SwitchValueInterpolator) originalNode; setFirstChildIndex(si.getFirstChildIndex()); diff --git a/src/classes/share/javax/media/j3d/Table.java b/src/classes/share/javax/media/j3d/Table.java index 8044e02..7d068ef 100644 --- a/src/classes/share/javax/media/j3d/Table.java +++ b/src/classes/share/javax/media/j3d/Table.java @@ -32,7 +32,7 @@ package javax.media.j3d; /** - * Used by ImageComponent for data conversions + * Used by ImageComponent for data conversions */ class Table extends Object { @@ -45,12 +45,12 @@ class Table extends Object { // 4 to 8 bit data conversion static final int[] table4To8Bit = { - 0,17,34,51,68,85,102,119,136,153,170,187,204,221,238,255}; + 0,17,34,51,68,85,102,119,136,153,170,187,204,221,238,255}; // 5 to 8 bit data conversion static final int[] table5To8Bit = { 0,8,16,25,33,41,49,58,66,74,82,90,99,107,115,123,132,140,148,156, - 165,173,181,189,197,206,214,222,230,239,247,255}; + 165,173,181,189,197,206,214,222,230,239,247,255}; // 8 to 4 bit data conversion static final int[] table8To4Bit = { @@ -63,7 +63,7 @@ class Table extends Object { 11,11,11,11,11,11,11,11,11,11,11,12,12,12,12,12,12,12,12,12,12,12,12, 12,12,12,12,12,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,14, 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,15,15,15,15,15,15,15, - 15,15}; + 15,15}; // 8 to 5 bit data conversion static int[] table8To5Bit = { @@ -77,7 +77,7 @@ class Table extends Object { 22,22,22,22,23,23,23,23,23,23,23,23,24,24,24,24,24,24,24,24,25,25,25, 25,25,25,25,25,26,26,26,26,26,26,26,26,27,27,27,27,27,27,27,27,27,28, 28,28,28,28,28,28,28,29,29,29,29,29,29,29,29,30,30,30,30,30,30,30,30, - 31,31,31,31,31}; + 31,31,31,31,31}; // 8 to 3 bit data conversion static int[] table8To3Bit = { diff --git a/src/classes/share/javax/media/j3d/Targets.java b/src/classes/share/javax/media/j3d/Targets.java index 036ef08..0d7a2f4 100644 --- a/src/classes/share/javax/media/j3d/Targets.java +++ b/src/classes/share/javax/media/j3d/Targets.java @@ -46,18 +46,18 @@ class Targets { static final int GRP_TARGETS = 6; // For group nodes. ArrayList[] targetList = new ArrayList[MAX_NODELIST]; - + void addNode(NnuId node, int targetType) { if(targetList[targetType] == null) targetList[targetType] = new ArrayList(1); - + targetList[targetType].add(node); } void addNodeArray(NnuId[] nodeArr, int targetType) { if(targetList[targetType] == null) targetList[targetType] = new ArrayList(1); - + targetList[targetType].add(nodeArr); } @@ -72,12 +72,12 @@ class Targets { void addNodes(ArrayList nodeList, int targetType) { if(targetList[targetType] == null) targetList[targetType] = new ArrayList(1); - + targetList[targetType].addAll(nodeList); } - - - void clearNodes() { + + + void clearNodes() { for(int i=0; i<MAX_NODELIST; i++) { if (targetList[i] != null) { targetList[i].clear(); @@ -105,25 +105,25 @@ class Targets { cachedTargets.targetArr[i] = null; } } - + clearNodes(); - + return cachedTargets; } - + CachedTargets snapShotAdd(CachedTargets cachedTargets) { - + int i, size; - + CachedTargets newCachedTargets = new CachedTargets(); - - for(i=0; i<MAX_NODELIST; i++) { + + for(i=0; i<MAX_NODELIST; i++) { if((targetList[i] != null) && (cachedTargets.targetArr[i] == null)) { size = targetList[i].size(); NnuId[] nArr = new NnuId[size]; targetList[i].toArray(nArr); - newCachedTargets.targetArr[i] = nArr; + newCachedTargets.targetArr[i] = nArr; NnuIdManager.sort(newCachedTargets.targetArr[i]); } @@ -135,13 +135,13 @@ class Targets { NnuIdManager.sort(targetArr); newCachedTargets.targetArr[i] = NnuIdManager.merge(cachedTargets.targetArr[i], targetArr); - + } else if((targetList[i] == null) && (cachedTargets.targetArr[i] != null)) { newCachedTargets.targetArr[i] = cachedTargets.targetArr[i]; } } - + clearNodes(); return newCachedTargets; @@ -150,15 +150,15 @@ class Targets { CachedTargets snapShotRemove(CachedTargets cachedTargets) { - + int i, size; NnuId[] targetArr; - + CachedTargets newCachedTargets = new CachedTargets(); for(i=0; i<MAX_NODELIST; i++) { - + if((targetList[i] != null) && (cachedTargets.targetArr[i] != null)) { size = targetList[i].size(); targetArr = new NnuId[size]; @@ -166,27 +166,27 @@ class Targets { NnuIdManager.sort(targetArr); newCachedTargets.targetArr[i] = NnuIdManager.delete(cachedTargets.targetArr[i], targetArr); - + } else if((targetList[i] == null) && (cachedTargets.targetArr[i] != null)) { newCachedTargets.targetArr[i] = cachedTargets.targetArr[i]; - + } else if((targetList[i] != null) && (cachedTargets.targetArr[i] == null)) { System.err.println("You can't remove something that isn't there"); } } - + clearNodes(); return newCachedTargets; - + } boolean isEmpty() { boolean empty = true; - + for (int i=0; i < MAX_NODELIST; i++) { if (targetList[i] != null) { empty = false; diff --git a/src/classes/share/javax/media/j3d/TexCoordGeneration.java b/src/classes/share/javax/media/j3d/TexCoordGeneration.java index bb1c8a1..bd22b35 100644 --- a/src/classes/share/javax/media/j3d/TexCoordGeneration.java +++ b/src/classes/share/javax/media/j3d/TexCoordGeneration.java @@ -34,8 +34,8 @@ package javax.media.j3d; import javax.vecmath.Vector4f; /** - * The TexCoordGeneration object contains all parameters needed for - * automatic texture coordinate generation. It is included as part + * The TexCoordGeneration object contains all parameters needed for + * automatic texture coordinate generation. It is included as part * of an Appearance component object. * <p> * Texture coordinates determine which texel in the texture map is @@ -52,17 +52,17 @@ import javax.vecmath.Vector4f; * coordinate, similar to the <i>w</i> coordinate of the <i>(x, y, z, w)</i> * object coordinates, is used to create homogeneous coordinates. * <p> - * Rather than the programmer having to explicitly assign texture + * Rather than the programmer having to explicitly assign texture * coordinates, Java 3D can automatically generate the texture * coordinates to achieve texture mapping onto contours. * The TexCoordGeneration attributes specify the functions for automatically - * generating texture coordinates. The texture attributes that can be + * generating texture coordinates. The texture attributes that can be * defined are: * <p><ul> - * <li>Texture format - defines whether the generated texture + * <li>Texture format - defines whether the generated texture * coordinates are 2D, 3D, or 4D:<p> * <ul> - * <li>TEXTURE_COORDINATE_2 - generates 2D texture coordinates + * <li>TEXTURE_COORDINATE_2 - generates 2D texture coordinates * (S and T).<p> * <li>TEXTURE_COORDINATE_3 - generates 3D texture coordinates * (S, T, and R).<p> @@ -99,12 +99,12 @@ import javax.vecmath.Vector4f; * are the plane equation coefficients transformed into eye * coordinates.<p> * </ul></ul> - * - * <li>SPHERE_MAP - texture coordinates are generated using + * + * <li>SPHERE_MAP - texture coordinates are generated using * spherical reflection mapping in eye coordinates. Used to simulate * the reflected image of a spherical environment onto a polygon.<p> * - * <li>NORMAL_MAP - texture coordinates are generated to match + * <li>NORMAL_MAP - texture coordinates are generated to match * vertices' normals in eye coordinates. This is only available if * TextureCubeMap is available. * </li><p> @@ -114,8 +114,8 @@ import javax.vecmath.Vector4f; * if TextureCubeMap is available. * </li><p> * </ul> - * <li>Plane equation coefficients - defines the coefficients for the - * plane equations used to generate the coordinates in the + * <li>Plane equation coefficients - defines the coefficients for the + * plane equations used to generate the coordinates in the * OBJECT_LINEAR and EYE_LINEAR texture generation modes. * The coefficients define a reference plane in either object coordinates * or in eye coordinates, depending on the texture generation mode. @@ -139,7 +139,7 @@ import javax.vecmath.Vector4f; * * @see Canvas3D#queryProperties */ -public class TexCoordGeneration extends NodeComponent { +public class TexCoordGeneration extends NodeComponent { /** * Specifies that this TexCoordGeneration object allows reading its @@ -254,9 +254,9 @@ public class TexCoordGeneration extends NodeComponent { ALLOW_ENABLE_READ, ALLOW_FORMAT_READ, ALLOW_MODE_READ, - ALLOW_PLANE_READ + ALLOW_PLANE_READ }; - + /** * Constructs a TexCoordGeneration object with default parameters. * The default values are as follows: @@ -329,7 +329,7 @@ public class TexCoordGeneration extends NodeComponent { * * @see Canvas3D#queryProperties */ - public TexCoordGeneration(int genMode, int format, Vector4f planeS, + public TexCoordGeneration(int genMode, int format, Vector4f planeS, Vector4f planeT) { // set default read capabilities setDefaultReadCapabilities(readCapabilities); @@ -353,7 +353,7 @@ public class TexCoordGeneration extends NodeComponent { * * @see Canvas3D#queryProperties */ - public TexCoordGeneration(int genMode, int format, Vector4f planeS, + public TexCoordGeneration(int genMode, int format, Vector4f planeS, Vector4f planeT, Vector4f planeR) { // set default read capabilities setDefaultReadCapabilities(readCapabilities); @@ -381,7 +381,7 @@ public class TexCoordGeneration extends NodeComponent { * * @since Java 3D 1.3 */ - public TexCoordGeneration(int genMode, int format, Vector4f planeS, + public TexCoordGeneration(int genMode, int format, Vector4f planeS, Vector4f planeT, Vector4f planeR, Vector4f planeQ) { // set default read capabilities @@ -461,7 +461,7 @@ public class TexCoordGeneration extends NodeComponent { * * @exception IllegalArgumentException if <code>genMode</code> is * a value other than <code>OBJECT_LINEAR</code>, <code>EYE_LINEAR</code>, - * <code>SPHERE_MAP</code>, <code>NORMAL_MAP</code>, or + * <code>SPHERE_MAP</code>, <code>NORMAL_MAP</code>, or * <code>REFLECTION_MAP</code>. * * @see Canvas3D#queryProperties @@ -494,7 +494,7 @@ public class TexCoordGeneration extends NodeComponent { * is used to generate the S coordinate in OBJECT_LINEAR and EYE_LINEAR * texture generation modes. * @param planeS plane equation for the S coordinate - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ public void setPlaneS(Vector4f planeS) { @@ -527,7 +527,7 @@ public class TexCoordGeneration extends NodeComponent { * is used to generate the T coordinate in OBJECT_LINEAR and EYE_LINEAR * texture generation modes. * @param planeT plane equation for the T coordinate - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ public void setPlaneT(Vector4f planeT) { @@ -560,7 +560,7 @@ public class TexCoordGeneration extends NodeComponent { * is used to generate the R coordinate in OBJECT_LINEAR and EYE_LINEAR * texture generation modes. * @param planeR plane equation for the R coordinate - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ public void setPlaneR(Vector4f planeR) { @@ -593,7 +593,7 @@ public class TexCoordGeneration extends NodeComponent { * is used to generate the Q coordinate in OBJECT_LINEAR and EYE_LINEAR * texture generation modes. * @param planeQ plane equation for the Q coordinate - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph * * @since Java 3D 1.3 @@ -635,7 +635,7 @@ public class TexCoordGeneration extends NodeComponent { } /** - * @deprecated replaced with cloneNodeComponent(boolean forceDuplicate) + * @deprecated replaced with cloneNodeComponent(boolean forceDuplicate) */ public NodeComponent cloneNodeComponent() { TexCoordGeneration tga = new TexCoordGeneration(); @@ -649,7 +649,7 @@ public class TexCoordGeneration extends NodeComponent { * the current node. This method is called from the * <code>duplicateNode</code> method. This routine does * the actual duplication of all "local data" (any data defined in - * this object). + * this object). * * @param originalNodeComponent the original node to duplicate. * @param forceDuplicate when set to <code>true</code>, causes the @@ -662,12 +662,12 @@ public class TexCoordGeneration extends NodeComponent { * @see NodeComponent#setDuplicateOnCloneTree */ - void duplicateAttributes(NodeComponent originalNodeComponent, - boolean forceDuplicate) { + void duplicateAttributes(NodeComponent originalNodeComponent, + boolean forceDuplicate) { super.duplicateAttributes(originalNodeComponent, forceDuplicate); - - TexCoordGenerationRetained tex = (TexCoordGenerationRetained) + + TexCoordGenerationRetained tex = (TexCoordGenerationRetained) originalNodeComponent.retained; TexCoordGenerationRetained rt = (TexCoordGenerationRetained) retained; @@ -679,9 +679,9 @@ public class TexCoordGeneration extends NodeComponent { tex.getPlaneT(v); rt.initPlaneT(v); tex.getPlaneR(v); - rt.initPlaneR(v); + rt.initPlaneR(v); tex.getPlaneQ(v); - rt.initPlaneQ(v); + rt.initPlaneQ(v); rt.initFormat(tex.getFormat()); rt.initEnable(tex.getEnable()); } diff --git a/src/classes/share/javax/media/j3d/TexCoordGenerationRetained.java b/src/classes/share/javax/media/j3d/TexCoordGenerationRetained.java index 438e1bc..5e2636e 100644 --- a/src/classes/share/javax/media/j3d/TexCoordGenerationRetained.java +++ b/src/classes/share/javax/media/j3d/TexCoordGenerationRetained.java @@ -39,7 +39,7 @@ import java.util.ArrayList; * coordinate generation. It is included as part of an Appearance * component object. */ -class TexCoordGenerationRetained extends NodeComponentRetained { +class TexCoordGenerationRetained extends NodeComponentRetained { // A list of pre-defined bits to indicate which component // in this TexCoordGeneration object changed. @@ -67,7 +67,7 @@ class TexCoordGenerationRetained extends NodeComponentRetained { // true when mirror texCoord component set boolean mirrorCompDirty = false; - + /** * Enables or disables texture coordinate generation for this * appearance component object. @@ -270,7 +270,7 @@ class TexCoordGenerationRetained extends NodeComponentRetained { mirror = mirrorTg; } } else { - ((TexCoordGenerationRetained) mirror).set(this); + ((TexCoordGenerationRetained) mirror).set(this); } } @@ -278,25 +278,25 @@ class TexCoordGenerationRetained extends NodeComponentRetained { int gMode = genMode; Transform3D trans = null; Transform3D m = cv.vworldToEc; - + if (((cv.textureExtendedFeatures & Canvas3D.TEXTURE_CUBE_MAP) == 0) && - ((genMode == TexCoordGeneration.NORMAL_MAP) || + ((genMode == TexCoordGeneration.NORMAL_MAP) || (genMode == TexCoordGeneration.REFLECTION_MAP))) { gMode = TexCoordGeneration.SPHERE_MAP; - } + } if (VirtualUniverse.mc.isD3D() && (gMode == TexCoordGeneration.EYE_LINEAR)) { trans = new Transform3D(cv.vworldToEc); trans.invert(); m = trans; - } - - Pipeline.getPipeline().updateTexCoordGeneration(cv.ctx, + } + + Pipeline.getPipeline().updateTexCoordGeneration(cv.ctx, enable, gMode, format, planeS.x, planeS.y, planeS.z, planeS.w, planeT.x, planeT.y, planeT.z, planeT.w, - planeR.x, planeR.y, planeR.z, planeR.w, - planeQ.x, planeQ.y, planeQ.z, planeQ.w, + planeR.x, planeR.y, planeR.z, planeR.w, + planeQ.x, planeQ.y, planeQ.z, planeQ.w, m.mat); } @@ -308,11 +308,11 @@ class TexCoordGenerationRetained extends NodeComponentRetained { ((TexCoordGenerationRetained)mirror).set(this); } - /** Update the "component" field of the mirror object with the + /** Update the "component" field of the mirror object with the * given "value" */ synchronized void updateMirrorObject(int component, Object value) { - + TexCoordGenerationRetained mirrorTc = (TexCoordGenerationRetained) mirror; mirrorTc.mirrorCompDirty = true; @@ -359,7 +359,7 @@ class TexCoordGenerationRetained extends NodeComponentRetained { tr.planeR = new Vector4f(planeR); // other attributes is copied in super.clone() return tr; - + } protected void set(TexCoordGenerationRetained tr) { @@ -370,12 +370,12 @@ class TexCoordGenerationRetained extends NodeComponentRetained { planeS.set(tr.planeS); planeT.set(tr.planeT); planeR.set(tr.planeR); - } + } final void sendMessage(int attrMask, Object attr) { ArrayList univList = new ArrayList(); - ArrayList gaList = Shape3DRetained.getGeomAtomsList(mirror.users, univList); + ArrayList gaList = Shape3DRetained.getGeomAtomsList(mirror.users, univList); // Send to rendering attribute structure, regardless of // whether there are users or not (alternate appearance case ..) @@ -395,7 +395,7 @@ class TexCoordGenerationRetained extends NodeComponentRetained { createMessage = new J3dMessage(); createMessage.threads = J3dThread.UPDATE_RENDER; createMessage.type = J3dMessage.TEXCOORDGENERATION_CHANGED; - + createMessage.universe = (VirtualUniverse) univList.get(i); createMessage.args[0] = this; createMessage.args[1]= new Integer(attrMask); @@ -405,7 +405,7 @@ class TexCoordGenerationRetained extends NodeComponentRetained { GeometryAtom[] gaArr = new GeometryAtom[gL.size()]; gL.toArray(gaArr); createMessage.args[3] = gaArr; - + VirtualUniverse.mc.processMessage(createMessage); } } diff --git a/src/classes/share/javax/media/j3d/Text3D.java b/src/classes/share/javax/media/j3d/Text3D.java index 64a78e8..d29a137 100644 --- a/src/classes/share/javax/media/j3d/Text3D.java +++ b/src/classes/share/javax/media/j3d/Text3D.java @@ -41,8 +41,8 @@ import javax.vecmath.Point3f; * <UL> * <LI>Font3D object - describes the font style of the text string, * such as the font family (Helvetica, Courier, etc.), style (Italic, - * bold, etc.), and point size. The size of the resulting characters will - * be equal to the point size. For example, a 12 point font will result in + * bold, etc.), and point size. The size of the resulting characters will + * be equal to the point size. For example, a 12 point font will result in * a Font3D with characters 12 meters tall. </LI><P> * <LI>Text string - the text string to be written.</LI><P> * <LI>Position - determines the initial placement of the Text3D string @@ -487,7 +487,7 @@ public class Text3D extends Geometry { * * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph - * + * * @see #getPosition */ public void setAlignment(int alignment) { @@ -623,7 +623,7 @@ public class Text3D extends Geometry { * the current node. This method is called from the * <code>duplicateNode</code> method. This routine does * the actual duplication of all "local data" (any data defined in - * this object). + * this object). * * @param originalNodeComponent the original node to duplicate. * @param forceDuplicate when set to <code>true</code>, causes the @@ -635,7 +635,7 @@ public class Text3D extends Geometry { * @see Node#cloneTree * @see NodeComponent#setDuplicateOnCloneTree */ - void duplicateAttributes(NodeComponent originalNodeComponent, + void duplicateAttributes(NodeComponent originalNodeComponent, boolean forceDuplicate) { super.duplicateAttributes(originalNodeComponent, forceDuplicate); diff --git a/src/classes/share/javax/media/j3d/Text3DRenderMethod.java b/src/classes/share/javax/media/j3d/Text3DRenderMethod.java index 8972678..1818c45 100644 --- a/src/classes/share/javax/media/j3d/Text3DRenderMethod.java +++ b/src/classes/share/javax/media/j3d/Text3DRenderMethod.java @@ -46,10 +46,10 @@ class Text3DRenderMethod implements RenderMethod { boolean isNonUniformScale; Transform3D trans = null; - + GeometryArrayRetained geo = (GeometryArrayRetained)ra.geometry(); - geo.setVertexFormat((rm.useAlpha && ((geo.vertexFormat & - GeometryArray.COLOR) != 0)), + geo.setVertexFormat((rm.useAlpha && ((geo.vertexFormat & + GeometryArray.COLOR) != 0)), rm.textureBin.attributeBin.ignoreVertexColors, cv.ctx); if (rm.doInfinite) { @@ -58,7 +58,7 @@ class Text3DRenderMethod implements RenderMethod { trans = ra.infLocalToVworld; isNonUniformScale = !trans.isCongruent(); cv.setModelViewMatrix(cv.ctx, cv.vworldToEc.mat, trans); - + ra.geometry().execute(cv, ra.renderAtom, isNonUniformScale, (rm.useAlpha && ra.geometry().noAlpha), rm.alpha, @@ -68,7 +68,7 @@ class Text3DRenderMethod implements RenderMethod { } return true; } - + boolean isVisible = false; // True if any of the RAs is visible. while (ra != null) { if (cv.ra == ra.renderAtom) { @@ -76,7 +76,7 @@ class Text3DRenderMethod implements RenderMethod { cv.updateState(dirtyBits); trans = ra.localToVworld; isNonUniformScale = !trans.isCongruent(); - + cv.setModelViewMatrix(cv.ctx, cv.vworldToEc.mat, trans); ra.geometry().execute(cv, ra.renderAtom, isNonUniformScale, (rm.useAlpha && ra.geometry().noAlpha), @@ -94,7 +94,7 @@ class Text3DRenderMethod implements RenderMethod { cv.raIsVisible = true; trans = ra.localToVworld; isNonUniformScale = !trans.isCongruent(); - + cv.setModelViewMatrix(cv.ctx, cv.vworldToEc.mat, trans); ra.geometry().execute(cv, ra.renderAtom, isNonUniformScale, (rm.useAlpha && ra.geometry().noAlpha), @@ -109,16 +109,16 @@ class Text3DRenderMethod implements RenderMethod { } cv.ra = ra.renderAtom; } - + ra = ra.next; - + } - - geo.disableGlobalAlpha(cv.ctx, - (rm.useAlpha && ((geo.vertexFormat & - GeometryArray.COLOR) != 0)), + + geo.disableGlobalAlpha(cv.ctx, + (rm.useAlpha && ((geo.vertexFormat & + GeometryArray.COLOR) != 0)), rm.textureBin.attributeBin.ignoreVertexColors); - + return isVisible; } } diff --git a/src/classes/share/javax/media/j3d/Text3DRetained.java b/src/classes/share/javax/media/j3d/Text3DRetained.java index c3ad1c3..50ce513 100644 --- a/src/classes/share/javax/media/j3d/Text3DRetained.java +++ b/src/classes/share/javax/media/j3d/Text3DRetained.java @@ -57,7 +57,7 @@ class Text3DRetained extends GeometryRetained { * The temporary transforms for this Text3D */ Transform3D[] charTransforms = new Transform3D[0]; - + /** * A cached list of geometry arrays for the current settings */ @@ -98,14 +98,14 @@ class Text3DRetained extends GeometryRetained { double width = 0, height = 0; Rectangle2D bounds; - //Reset bounds data + //Reset bounds data l.set(location); u.set(location); if (numChars != 0) { // Set loop counters based on path type if (path == Text3D.PATH_RIGHT || path == Text3D.PATH_UP) { - k = 0; + k = 0; numTotal = numChars + 1; } else if (path == Text3D.PATH_LEFT || path == Text3D.PATH_DOWN) { k = 1; @@ -150,8 +150,8 @@ class Text3DRetained extends GeometryRetained { break; } } - - // Handle string alignment. ALIGN_FIRST is handled by default + + // Handle string alignment. ALIGN_FIRST is handled by default if (alignment != Text3D.ALIGN_FIRST) { double cx = (u.x - l.x); double cy = (u.y - l.y); @@ -344,7 +344,7 @@ class Text3DRetained extends GeometryRetained { * * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph - * + * * @see #getPosition */ final void setAlignment(int alignment) { @@ -496,10 +496,10 @@ class Text3DRetained extends GeometryRetained { } gSize = s.geometryList.size(); - + GeometryAtom oldGA = Shape3DRetained.getGeomAtom(s); GeometryAtom newGA = new GeometryAtom(); - + int geometryCnt = 0; for(k = 0; k<gSize; k++) { GeometryRetained geomRetained = @@ -509,17 +509,17 @@ class Text3DRetained extends GeometryRetained { geometryCnt += tempT3d.numChars; } else { - // Slightly wasteful, but not quite worth to optimize yet. + // Slightly wasteful, but not quite worth to optimize yet. geometryCnt++; } } - + newGA.geometryArray = new GeometryRetained[geometryCnt]; newGA.lastLocalTransformArray = new Transform3D[geometryCnt]; // Reset geometryCnt; geometryCnt = 0; - - newGA.locale = s.locale; + + newGA.locale = s.locale; newGA.visible = s.visible; newGA.source = s; int gaCnt=0; @@ -532,7 +532,7 @@ class Text3DRetained extends GeometryRetained { break; } } - + for(; gaCnt<gSize; gaCnt++) { geometry = (GeometryRetained) s.geometryList.get(gaCnt); if(geometry == null) { @@ -547,22 +547,22 @@ class Text3DRetained extends GeometryRetained { newGA.geometryArray[geometryCnt] = geo; newGA.lastLocalTransformArray[geometryCnt] = t.charTransforms[k]; - + } else { newGA.geometryArray[geometryCnt] = null; newGA.lastLocalTransformArray[geometryCnt] = null; } - + } - + } } - + oldGeometryAtomList.add(oldGA); newGeometryAtomList.add(newGA); Shape3DRetained.setGeomAtom(s, newGA); } - + Object[] oldGAArray = oldGeometryAtomList.toArray(); Object[] newGAArray = newGeometryAtomList.toArray(); ArrayList uniqueList = getUniqueSource(shapeList); @@ -574,11 +574,11 @@ class Text3DRetained extends GeometryRetained { CachedTargets[] newCtArr = null; src = (Shape3DRetained)uniqueList.get(j); numMS3D = src.mirrorShape3D.size(); - + TargetsInterface ti = ((GroupRetained)src. parent).getClosestTargetsInterface( TargetsInterface.TRANSFORM_TARGETS); - + if (ti != null) { CachedTargets ct; newCtArr = new CachedTargets[numMS3D]; @@ -586,7 +586,7 @@ class Text3DRetained extends GeometryRetained { for (k=0; k<numMS3D; k++) { ms = (Shape3DRetained)src.mirrorShape3D.get(k); - GeometryAtom ga = + GeometryAtom ga = Shape3DRetained.getGeomAtom(ms); for(kk=0; kk<newGAArray.length; kk++) { if(ga == newGAArray[kk]) { @@ -595,7 +595,7 @@ class Text3DRetained extends GeometryRetained { } if(kk==newGAArray.length) { - System.err.println("Text3DRetained : Problem !!! Can't find matching geomAtom"); + System.err.println("Text3DRetained : Problem !!! Can't find matching geomAtom"); } ct = ti.getCachedTargets(TargetsInterface. @@ -603,8 +603,8 @@ class Text3DRetained extends GeometryRetained { if (ct != null) { newCtArr[k] = new CachedTargets(); newCtArr[k].copy(ct); - newCtArr[k].replace((NnuId)oldGAArray[kk], - (NnuId)newGAArray[kk], + newCtArr[k].replace((NnuId)oldGAArray[kk], + (NnuId)newGAArray[kk], Targets.GEO_TARGETS); } else { newCtArr[k] = null; @@ -619,9 +619,9 @@ class Text3DRetained extends GeometryRetained { newCtArrArrList.add(newCtArr); } - + } - + m[i].args[0] = oldGAArray; m[i].args[1] = newGAArray; m[i].universe = (VirtualUniverse)universeList.get(i); @@ -630,18 +630,18 @@ class Text3DRetained extends GeometryRetained { m[i].args[2] = tiArrList.toArray(); m[i].args[3] = newCtArrArrList.toArray(); } - + tiArrList.clear(); newCtArrArrList.clear(); } VirtualUniverse.mc.processMessage(m); } - + } } } - + final void sendTransformChangedMessage() { J3dMessage[] m; @@ -671,8 +671,8 @@ class Text3DRetained extends GeometryRetained { break; } } - - if(sCnt < s.geometryList.size()) + + if(sCnt < s.geometryList.size()) gaList.add(Shape3DRetained.getGeomAtom(s)); } @@ -705,13 +705,13 @@ class Text3DRetained extends GeometryRetained { geometryList[i] = font3D.triangulateGlyphs(glyphVecs[i], c[0]); } } - + updateTransformData(); } /** * Update per character transform based on Text3D location, - * per character size and path. + * per character size and path. * * WARNING: Caller of this method must make sure SceneGraph is live, * else exceptions may be thrown. @@ -722,7 +722,7 @@ class Text3DRetained extends GeometryRetained { Vector3f location = new Vector3f(this.position); Rectangle2D bounds; - //Reset bounds data + //Reset bounds data lower.set(location); upper.set(location); @@ -736,7 +736,7 @@ class Text3DRetained extends GeometryRetained { // Set loop counters based on path type if (path == Text3D.PATH_RIGHT || path == Text3D.PATH_UP) { - k = 0; + k = 0; numTotal = numChars + 1; } else if (path == Text3D.PATH_LEFT || path == Text3D.PATH_DOWN) { k = 1; @@ -763,21 +763,21 @@ class Text3DRetained extends GeometryRetained { } break; case Text3D.PATH_LEFT: - location.x -= width; + location.x -= width; lower.x -= (width); if (upper.y < ( height + location.y)) { upper.y = location.y + height; } break; case Text3D.PATH_UP: - location.y += height; + location.y += height; upper.y += height; if (upper.x < (bounds.getWidth() + location.x)) { upper.x = location.x + bounds.getWidth(); } break; case Text3D.PATH_DOWN: - location.y -= height; + location.y -= height; lower.y -= height; if (upper.x < (bounds.getWidth() + location.x)) { upper.x = location.x + bounds.getWidth(); @@ -788,8 +788,8 @@ class Text3DRetained extends GeometryRetained { charTransforms[i].set(location); } } - - // Handle string alignment. ALIGN_FIRST is handled by default + + // Handle string alignment. ALIGN_FIRST is handled by default if (alignment != Text3D.ALIGN_FIRST) { double cx = (upper.x - lower.x); double cy = (upper.y - lower.y); @@ -867,7 +867,7 @@ class Text3DRetained extends GeometryRetained { double minDist = Double.MAX_VALUE; double distance =0.0; Point3d closestIPnt = new Point3d(); - + for (int i=0; i < numChars; i++) { geo= geometryList[i]; if (geo != null) { @@ -882,11 +882,11 @@ class Text3DRetained extends GeometryRetained { sIndex = i; minDist = distance; closestIPnt.set(iPnt); - } + } } } } - + if (sIndex >= 0) { // We need to transform iPnt to the vworld to compute the actual distance. // In this method we'll transform iPnt by its char. offset. Shape3D will @@ -894,8 +894,8 @@ class Text3DRetained extends GeometryRetained { iPnt.set(closestIPnt); charTransforms[sIndex].transform(iPnt); return true; - } - return false; + } + return false; } boolean intersect(Point3d[] pnts) { @@ -933,7 +933,7 @@ class Text3DRetained extends GeometryRetained { return true; } } - + return false; } @@ -946,9 +946,9 @@ class Text3DRetained extends GeometryRetained { return true; } } - + return false; - + } void setModelViewMatrix(Transform3D vpcToEc, Transform3D drawTransform) { @@ -957,10 +957,10 @@ class Text3DRetained extends GeometryRetained { } - void execute(Canvas3D cv, RenderAtom ra, boolean isNonUniformScale, + void execute(Canvas3D cv, RenderAtom ra, boolean isNonUniformScale, boolean updateAlpha, float alpha, - int screen, - boolean ignoreVertexColors) { + int screen, + boolean ignoreVertexColors) { Transform3D trans = new Transform3D(); diff --git a/src/classes/share/javax/media/j3d/Texture.java b/src/classes/share/javax/media/j3d/Texture.java index 16b455f..5ae1280 100644 --- a/src/classes/share/javax/media/j3d/Texture.java +++ b/src/classes/share/javax/media/j3d/Texture.java @@ -37,7 +37,7 @@ import java.util.Hashtable; /** * The Texture object is a component object of an Appearance object * that defines the texture properties used when texture mapping is - * enabled. The Texture object is an abstract class and all texture + * enabled. The Texture object is an abstract class and all texture * objects must be created as either a Texture2D object or a * Texture3D object. * <P> @@ -58,7 +58,7 @@ import java.util.Hashtable; * S and T coordinates, respectively. The boundary modes are as * follows:</LI><P> * <UL> - * <LI>CLAMP - clamps texture coordinates to be in the range [0,1]. + * <LI>CLAMP - clamps texture coordinates to be in the range [0,1]. * Texture boundary texels or the constant boundary color if boundary width * is 0 will be used for U,V values that fall outside this range.</LI><P> * <LI>WRAP - repeats the texture by wrapping texture coordinates @@ -66,19 +66,19 @@ import java.util.Hashtable; * of the texture coordinates is used. The integer portion is * discarded</LI><P> * <LI>CLAMP_TO_EDGE - clamps texture coordinates such that filtering - * will not sample a texture boundary texel. Texels at the edge of the + * will not sample a texture boundary texel. Texels at the edge of the * texture will be used instead.</LI><P> * <LI>CLAMP_TO_BOUNDARY - clamps texture coordinates such that filtering * will sample only texture boundary texels, that is, it will never * get some samples from the boundary and some from the edge. This - * will ensure clean unfiltered boundaries. If the texture does not - * have a boundary, that is the boundary width is equal to 0, then the + * will ensure clean unfiltered boundaries. If the texture does not + * have a boundary, that is the boundary width is equal to 0, then the * constant boundary color will be used.</LI></P> * </UL> * <LI>Image - an image or an array of images for all the mipmap * levels. If only one image is provided, the MIPmap mode must be * set to BASE_LEVEL.</LI><P> - * <LI>Magnification filter - the magnification filter function. + * <LI>Magnification filter - the magnification filter function. * Used when the pixel being rendered maps to an area less than or * equal to one texel. The magnification filter functions are as * follows:</LI><P> @@ -99,13 +99,13 @@ import java.util.Hashtable; * j<sub>1</sub> = j<sub>0</sub> + 1<P> * a = frac(u - 0.5)<P> * b = frac(v - 0.5)<P> - * T' = (1-a)*(1-b)*T<sub>i<sub>0</sub>j<sub>0</sub></sub> + + * T' = (1-a)*(1-b)*T<sub>i<sub>0</sub>j<sub>0</sub></sub> + * a*(1-b)*T<sub>i<sub>1</sub>j<sub>0</sub></sub> + * (1-a)*b*T<sub>i<sub>0</sub>j<sub>1</sub></sub> + * a*b*T<sub>i<sub>1</sub>j<sub>1</sub></sub><P> * </UL> * <LI>LINEAR_SHARPEN - sharpens the resulting image by extrapolating - * from the base level plus one image to the base level image of this + * from the base level plus one image to the base level image of this * texture object.</LI><P> * <LI>LINEAR_SHARPEN_RGB - performs linear sharpen filter for the rgb * components only. The alpha component is computed using BASE_LEVEL_LINEAR @@ -133,21 +133,21 @@ import java.util.Hashtable; * <td>b = frac(v - 0.5)</td> * </table> * f(x) : filter4 function where 0<=x<=2<P> - * T' = f(1+a) * f(1+b) * T<sub>i<sub>0</sub>j<sub>0</sub></sub> + - * f(a) * f(1+b) * T<sub>i<sub>1</sub>j<sub>0</sub></sub> + - * f(1-a) * f(1+b) * T<sub>i<sub>2</sub>j<sub>0</sub></sub> + + * T' = f(1+a) * f(1+b) * T<sub>i<sub>0</sub>j<sub>0</sub></sub> + + * f(a) * f(1+b) * T<sub>i<sub>1</sub>j<sub>0</sub></sub> + + * f(1-a) * f(1+b) * T<sub>i<sub>2</sub>j<sub>0</sub></sub> + * f(2-a) * f(1+b) * T<sub>i<sub>3</sub>j<sub>0</sub></sub> + <br> - * f(1+a) * f(b) * T<sub>i<sub>0</sub>j<sub>1</sub></sub> + - * f(a) * f(b) * T<sub>i<sub>1</sub>j<sub>1</sub></sub> + - * f(1-a) * f(b) * T<sub>i<sub>2</sub>j<sub>1</sub></sub> + + * f(1+a) * f(b) * T<sub>i<sub>0</sub>j<sub>1</sub></sub> + + * f(a) * f(b) * T<sub>i<sub>1</sub>j<sub>1</sub></sub> + + * f(1-a) * f(b) * T<sub>i<sub>2</sub>j<sub>1</sub></sub> + * f(2-a) * f(b) * T<sub>i<sub>3</sub>j<sub>1</sub></sub> + <br> - * f(1+a) * f(1-b) * T<sub>i<sub>0</sub>j<sub>2</sub></sub> + - * f(a) * f(1-b) * T<sub>i<sub>1</sub>j<sub>2</sub></sub> + - * f(1-a) * f(1-b) * T<sub>i<sub>2</sub>j<sub>2</sub></sub> + + * f(1+a) * f(1-b) * T<sub>i<sub>0</sub>j<sub>2</sub></sub> + + * f(a) * f(1-b) * T<sub>i<sub>1</sub>j<sub>2</sub></sub> + + * f(1-a) * f(1-b) * T<sub>i<sub>2</sub>j<sub>2</sub></sub> + * f(2-a) * f(1-b) * T<sub>i<sub>3</sub>j<sub>2</sub></sub> + <br> - * f(1+a) * f(2-b) * T<sub>i<sub>0</sub>j<sub>3</sub></sub> + - * f(a) * f(2-b) * T<sub>i<sub>1</sub>j<sub>3</sub></sub> + - * f(1-a) * f(2-b) * T<sub>i<sub>2</sub>j<sub>3</sub></sub> + + * f(1+a) * f(2-b) * T<sub>i<sub>0</sub>j<sub>3</sub></sub> + + * f(a) * f(2-b) * T<sub>i<sub>1</sub>j<sub>3</sub></sub> + + * f(1-a) * f(2-b) * T<sub>i<sub>2</sub>j<sub>3</sub></sub> + * f(2-a) * f(2-b) * T<sub>i<sub>3</sub>j<sub>3</sub></sub> <P> * </UL> * </UL> @@ -211,14 +211,14 @@ import java.util.Hashtable; * this texture object. The anisotropic modes are as follows:</LI><P> * <UL> * <LI>ANISOTROPIC_NONE - no anisotropic filtering.</LI><P> - * <LI>ANISOTROPIC_SINGLE_VALUE - applies the degree of anisotropic filter + * <LI>ANISOTROPIC_SINGLE_VALUE - applies the degree of anisotropic filter * in both the minification and magnification filters.</LI><P> * </UL> * <LI>Anisotropic Filter Degree - controls the degree of anisotropy. This - * property applies to both minification and magnification filtering. + * property applies to both minification and magnification filtering. * If it is equal to 1.0, then an isotropic filtering as specified in the - * minification or magnification filter will be used. If it is greater - * than 1.0, and the anisotropic mode is equal to ANISOTROPIC_SINGLE_VALUE, + * minification or magnification filter will be used. If it is greater + * than 1.0, and the anisotropic mode is equal to ANISOTROPIC_SINGLE_VALUE, * then * the degree of anisotropy will also be applied in the filtering.</LI><P> * <LI>Sharpen Texture Function - specifies the function of level-of-detail @@ -324,7 +324,7 @@ public abstract class Texture extends NodeComponent { /** * Specifies that this Texture object allows reading its LOD range - * information (e.g., base level, maximum level, minimum lod, + * information (e.g., base level, maximum level, minimum lod, * maximum lod, lod offset) * * @since Java 3D 1.3 @@ -334,7 +334,7 @@ public abstract class Texture extends NodeComponent { /** * Specifies that this Texture object allows writing its LOD range - * information (e.g., base level, maximum level, minimum lod, + * information (e.g., base level, maximum level, minimum lod, * maximum lod, lod offset) * * @since Java 3D 1.3 @@ -361,7 +361,7 @@ public abstract class Texture extends NodeComponent { public static final int ALLOW_SHARPEN_TEXTURE_READ = CapabilityBits.TEXTURE_ALLOW_SHARPEN_TEXTURE_READ; - /** + /** * Specifies that this Texture object allows reading its filter4 * function information. * @@ -395,7 +395,7 @@ public abstract class Texture extends NodeComponent { * @see #setMagFilter */ public static final int BASE_LEVEL_POINT = 2; - + /** * Performs bilinear interpolation on the four nearest texels * in level 0 texture map. @@ -404,18 +404,18 @@ public abstract class Texture extends NodeComponent { * @see #setMagFilter */ public static final int BASE_LEVEL_LINEAR = 3; - + /** * Selects the nearest texel in the nearest mipmap. * Maps to NEAREST_MIPMAP_NEAREST. * @see #setMinFilter */ public static final int MULTI_LEVEL_POINT = 4; - + /** * Performs tri-linear interpolation of texels between four * texels each from two nearest mipmap levels. - * Maps to LINEAR_MIPMAP_LINEAR, but an implementation can + * Maps to LINEAR_MIPMAP_LINEAR, but an implementation can * fall back to LINEAR_MIPMAP_NEAREST or NEAREST_MIPMAP_LINEAR. * @see #setMinFilter */ @@ -436,7 +436,7 @@ public abstract class Texture extends NodeComponent { /** * Performs linear sharpen filter for the rgb - * components only. The alpha component is computed using + * components only. The alpha component is computed using * BASE_LEVEL_LINEAR filter. * * @since Java 3D 1.3 @@ -446,7 +446,7 @@ public abstract class Texture extends NodeComponent { /** * Performs linear sharpen filter for the alpha - * component only. The rgb components are computed using + * component only. The rgb components are computed using * BASE_LEVEL_LINEAR filter. * * @since Java 3D 1.3 @@ -463,7 +463,7 @@ public abstract class Texture extends NodeComponent { * @see #setMagFilter */ public static final int FILTER4 = 12; - + // Texture boundary mode parameter values /** * Clamps texture coordinates to be in the range [0, 1]. @@ -504,7 +504,7 @@ public abstract class Texture extends NodeComponent { public static final int BASE_LEVEL = 1; /** - * Indicates that this Texture object has multiple images, one for + * Indicates that this Texture object has multiple images, one for * each mipmap level. In this mode, there are * <code>log<sub><font size=-2>2</font></sub>(max(width,height))+1</code> * separate images. @@ -565,16 +565,16 @@ public abstract class Texture extends NodeComponent { private static final int[] readCapabilities = { ALLOW_ANISOTROPIC_FILTER_READ, ALLOW_BOUNDARY_COLOR_READ, - ALLOW_BOUNDARY_MODE_READ, + ALLOW_BOUNDARY_MODE_READ, ALLOW_ENABLE_READ, ALLOW_FILTER4_READ, - ALLOW_FILTER_READ, + ALLOW_FILTER_READ, ALLOW_FORMAT_READ, ALLOW_IMAGE_READ, ALLOW_LOD_RANGE_READ, - ALLOW_MIPMAP_MODE_READ, + ALLOW_MIPMAP_MODE_READ, ALLOW_SHARPEN_TEXTURE_READ, - ALLOW_SIZE_READ + ALLOW_SIZE_READ }; /** @@ -604,7 +604,7 @@ public abstract class Texture extends NodeComponent { * filter4 func: null<br> * </ul> * <p> - * Note that the default constructor creates a texture object with + * Note that the default constructor creates a texture object with * a width and height of 0 and is, therefore, not useful. */ public Texture() { @@ -621,7 +621,7 @@ public abstract class Texture extends NodeComponent { * by the application (using either the <code>setImage</code> or * <code>setImages</code> method). If <code>mipMapMode</code> is * set to <code>MULTI_LEVEL_MIPMAP</code>, then images for levels - * Base Level through Maximum Level must be set. + * Base Level through Maximum Level must be set. * Note that a texture with a non-power-of-two width or height will * only be rendered on a graphics device that supports non-power-of-two * textures. @@ -646,12 +646,12 @@ public abstract class Texture extends NodeComponent { if ((mipMapMode != BASE_LEVEL) && (mipMapMode != MULTI_LEVEL_MIPMAP)) throw new IllegalArgumentException(J3dI18N.getString("Texture0")); - if ((format != INTENSITY) && (format != LUMINANCE) && + if ((format != INTENSITY) && (format != LUMINANCE) && (format != ALPHA) && (format != LUMINANCE_ALPHA) && (format != RGB) && (format != RGBA)) { throw new IllegalArgumentException(J3dI18N.getString("Texture1")); } - + if (width < 1) { throw new IllegalArgumentException(J3dI18N.getString("Texture46")); } @@ -662,7 +662,7 @@ public abstract class Texture extends NodeComponent { int widthLevels; int heightLevels; - + widthLevels = getLevelsNPOT(width); heightLevels = getLevelsNPOT(height); @@ -672,14 +672,14 @@ public abstract class Texture extends NodeComponent { /** * Constructs an empty Texture object with specified mipMapMode, - * format, width, height, and boundaryWidth. + * format, width, height, and boundaryWidth. * Defaults are used for all other * parameters. If <code>mipMapMode</code> is set to * <code>BASE_LEVEL</code>, then the image at level 0 must be set * by the application (using either the <code>setImage</code> or * <code>setImages</code> method). If <code>mipMapMode</code> is * set to <code>MULTI_LEVEL_MIPMAP</code>, then images for levels - * Base Level through Maximum Level must be set. + * Base Level through Maximum Level must be set. * Note that a texture with a non-power-of-two width or height will * only be rendered on a graphics device that supports non-power-of-two * textures. @@ -711,7 +711,7 @@ public abstract class Texture extends NodeComponent { if ((mipMapMode != BASE_LEVEL) && (mipMapMode != MULTI_LEVEL_MIPMAP)) throw new IllegalArgumentException(J3dI18N.getString("Texture0")); - if ((format != INTENSITY) && (format != LUMINANCE) && + if ((format != INTENSITY) && (format != LUMINANCE) && (format != ALPHA) && (format != LUMINANCE_ALPHA) && (format != RGB) && (format != RGBA)) { throw new IllegalArgumentException(J3dI18N.getString("Texture1")); @@ -727,7 +727,7 @@ public abstract class Texture extends NodeComponent { int widthLevels; int heightLevels; - + widthLevels = getLevelsNPOT(width); heightLevels = getLevelsNPOT(height); @@ -817,7 +817,7 @@ public abstract class Texture extends NodeComponent { * function is used when the pixel being rendered maps to an area * greater than one texel. * @param minFilter the minification filter. One of: - * FASTEST, NICEST, BASE_LEVEL_POINT, BASE_LEVEL_LINEAR, + * FASTEST, NICEST, BASE_LEVEL_POINT, BASE_LEVEL_LINEAR, * MULTI_LEVEL_POINT, MULTI_LEVEL_LINEAR, or FILTER4 * @exception RestrictedAccessException if the method is called * when this object is part of live or compiled scene graph. @@ -866,15 +866,15 @@ public abstract class Texture extends NodeComponent { * function is used when the pixel being rendered maps to an area * less than or equal to one texel. * @param magFilter the magnification filter, one of: - * FASTEST, NICEST, BASE_LEVEL_POINT, BASE_LEVEL_LINEAR, + * FASTEST, NICEST, BASE_LEVEL_POINT, BASE_LEVEL_LINEAR, * LINEAR_SHARPEN, LINEAR_SHARPEN_RGB, LINEAR_SHARPEN_ALPHA, or FILTER4. - * + * * @exception RestrictedAccessException if the method is called * when this object is part of live or compiled scene graph. * @exception IllegalArgumentException if <code>magFilter</code> * is a value other than <code>FASTEST</code>, <code>NICEST</code>, * <code>BASE_LEVEL_POINT</code>, <code>BASE_LEVEL_LINEAR</code>, - * <code>LINEAR_SHARPEN</code>, <code>LINEAR_SHARPEN_RGB</code>, + * <code>LINEAR_SHARPEN</code>, <code>LINEAR_SHARPEN_RGB</code>, * <code>LINEAR_SHARPEN_ALPHA</code>, or * <code>FILTER4</code>. * @@ -949,10 +949,10 @@ public abstract class Texture extends NodeComponent { if(!this.getCapability(ALLOW_IMAGE_WRITE)) throw new CapabilityNotSetException(J3dI18N.getString("Texture15")); } - + // Do illegal sharing check validateImageIllegalSharing(image); - + if (isLive()) ((TextureRetained)this.retained).setImage(level, image); else @@ -1018,11 +1018,11 @@ public abstract class Texture extends NodeComponent { throw new CapabilityNotSetException(J3dI18N.getString("Texture15")); } - // Do illegal sharing check + // Do illegal sharing check for(int i=0; i<images.length; i++) { validateImageIllegalSharing(images[i]); } - + if (images == null) throw new IllegalArgumentException(J3dI18N.getString("Texture20")); @@ -1116,7 +1116,7 @@ public abstract class Texture extends NodeComponent { /** * Retrieves the number of mipmap levels needed for this Texture object. - * @return (maximum Level - base Level + 1) + * @return (maximum Level - base Level + 1) * if <code>mipMapMode</code> is * <code>MULTI_LEVEL_MIPMAP</code>; otherwise it returns 1. * @exception CapabilityNotSetException if appropriate capability is @@ -1133,13 +1133,13 @@ public abstract class Texture extends NodeComponent { } /** - * Sets mipmap mode for texture mapping for this texture object. + * Sets mipmap mode for texture mapping for this texture object. * @param mipMapMode the new mipmap mode for this object. One of: * BASE_LEVEL or MULTI_LEVEL_MIPMAP. * @exception RestrictedAccessException if the method is called * when this object is part of live or compiled scene graph. * @exception IllegalArgumentException if <code>mipMapMode</code> - * is a value other than <code>BASE_LEVEL</code> or + * is a value other than <code>BASE_LEVEL</code> or * <code>MULTI_LEVEL_MIPMAP</code>. */ public void setMipMapMode(int mipMapMode) { @@ -1200,11 +1200,11 @@ public abstract class Texture extends NodeComponent { // num is NOT power of 2. // NOTE: ********** Assumes 32 bit integer****************** static int getPowerOf2(int num) { - + int i, tmp; // Can only handle positive numbers, return error. if (num < 1) return -1; - + for (i=0, tmp = num; i < 32;i++) { // Check if leftmost bit is 1 if ((tmp & 0x80000000) != 0) { @@ -1231,7 +1231,7 @@ public abstract class Texture extends NodeComponent { } return levels; } - + /** * Sets the texture boundary color for this texture object. The * texture boundary color is used when boundaryModeS or boundaryModeT @@ -1327,10 +1327,10 @@ public abstract class Texture extends NodeComponent { * @param maximumLevel index of the highest defined mipmap level. * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph - * @exception IllegalArgumentException if specified + * @exception IllegalArgumentException if specified * maximumLevel < baseLevel, or * if maximumLevel > <code>log<sub><font size=-2>2</font></sub>(max(width,height))</code> - * @exception IllegalArgumentException if mipMipMapMode is equal to BASE_LEVEL + * @exception IllegalArgumentException if mipMipMapMode is equal to BASE_LEVEL * and maximumLevel is not equal to zero. * * @since Java 3D 1.3 @@ -1541,7 +1541,7 @@ public abstract class Texture extends NodeComponent { */ public void setAnisotropicFilterMode(int mode) { checkForLiveOrCompiled(); - if ((mode != ANISOTROPIC_NONE) && + if ((mode != ANISOTROPIC_NONE) && (mode != ANISOTROPIC_SINGLE_VALUE)) { throw new IllegalArgumentException( J3dI18N.getString("Texture25")); @@ -1569,7 +1569,7 @@ public abstract class Texture extends NodeComponent { /** * Specifies the degree of anisotropy to be - * used when the anisotropic filter mode specifies + * used when the anisotropic filter mode specifies * ANISOTROPIC_SINGLE_VALUE. * @param degree degree of anisotropy * @exception RestrictedAccessException if the method is called @@ -1607,14 +1607,14 @@ public abstract class Texture extends NodeComponent { } return ((TextureRetained)this.retained).getAnisotropicFilterDegree(); } - + /** * sets the sharpen texture LOD function for this texture object. * @param lod array containing the level-of-detail values. * @param pts array containing the function values for the corresponding * level-of-detail values. * - * @exception IllegalStateException if the length of <code>lod</code> + * @exception IllegalStateException if the length of <code>lod</code> * does not match the length of <code>pts</code> * @exception RestrictedAccessException if the method is called * when this object is part of live or compiled scene graph. @@ -1638,7 +1638,7 @@ public abstract class Texture extends NodeComponent { * The Point2f x,y values are defined as follows: x is the lod value, * y is the corresponding function value. * - * @param pts array of Point2f containing the lod as well as the + * @param pts array of Point2f containing the lod as well as the * corresponding function value. * * @exception RestrictedAccessException if the method is called @@ -1672,14 +1672,14 @@ public abstract class Texture extends NodeComponent { } return ((TextureRetained)this.retained).getSharpenTextureFuncPointsCount(); } - + /** * Copies the array of sharpen texture LOD function points into the * specified arrays. The arrays must be large enough to hold all the * points. * * @param lod the array to receive the level-of-detail values. - * @param pts the array to receive the function values for the + * @param pts the array to receive the function values for the * corresponding level-of-detail values. * * @exception CapabilityNotSetException if appropriate capability is @@ -1720,12 +1720,12 @@ public abstract class Texture extends NodeComponent { } ((TextureRetained)this.retained).getSharpenTextureFunc(pts); } - + /** * sets the filter4 function for this texture object. * @param weights array containing samples of the filter4 function. * - * @exception IllegalArgumentException if the length of + * @exception IllegalArgumentException if the length of * <code>weight</code> < 4 * @exception RestrictedAccessException if the method is called * when this object is part of live or compiled scene graph. @@ -1787,11 +1787,11 @@ public abstract class Texture extends NodeComponent { /** - * Copies all node information from <code>originalNodeComponent</code> + * Copies all node information from <code>originalNodeComponent</code> * into the current node. This method is called from the * <code>duplicateNode</code> method. This routine does * the actual duplication of all "local data" (any data defined in - * this object). + * this object). * * @param originalNodeComponent the original node to duplicate. * @param forceDuplicate when set to <code>true</code>, causes the @@ -1803,8 +1803,8 @@ public abstract class Texture extends NodeComponent { * @see Node#cloneTree * @see NodeComponent#setDuplicateOnCloneTree */ - void duplicateAttributes(NodeComponent originalNodeComponent, - boolean forceDuplicate) { + void duplicateAttributes(NodeComponent originalNodeComponent, + boolean forceDuplicate) { super.duplicateAttributes(originalNodeComponent, forceDuplicate); @@ -1816,7 +1816,7 @@ public abstract class Texture extends NodeComponent { rt.initBoundaryModeS(tex.getBoundaryModeS()); rt.initBoundaryModeT(tex.getBoundaryModeT()); rt.initMinFilter(tex.getMinFilter()); - rt.initMagFilter(tex.getMagFilter()); + rt.initMagFilter(tex.getMagFilter()); rt.initMipMapMode(tex.getMipMapMode()); rt.initEnable(tex.getEnable()); rt.initAnisotropicFilterMode(tex.getAnisotropicFilterMode()); @@ -1839,7 +1839,7 @@ public abstract class Texture extends NodeComponent { // No API available to get the current level for (int i=tex.maxLevels-1; i>=0; i-- ) { - ImageComponent image = (ImageComponent) + ImageComponent image = (ImageComponent) getNodeComponent(tex.getImage(i), forceDuplicate, hashtable); @@ -1851,11 +1851,11 @@ public abstract class Texture extends NodeComponent { // NOTE: This sppears to have already been done } - /** + /** * This function is called from getNodeComponent() to see if any of - * the sub-NodeComponents duplicateOnCloneTree flag is true. - * If it is the case, current NodeComponent needs to - * duplicate also even though current duplicateOnCloneTree flag is false. + * the sub-NodeComponents duplicateOnCloneTree flag is true. + * If it is the case, current NodeComponent needs to + * duplicate also even though current duplicateOnCloneTree flag is false. * This should be overwrite by NodeComponent which contains sub-NodeComponent. */ boolean duplicateChild() { diff --git a/src/classes/share/javax/media/j3d/Texture2D.java b/src/classes/share/javax/media/j3d/Texture2D.java index 0b121f1..18d0352 100644 --- a/src/classes/share/javax/media/j3d/Texture2D.java +++ b/src/classes/share/javax/media/j3d/Texture2D.java @@ -62,7 +62,7 @@ public class Texture2D extends Texture { public static final int ALLOW_DETAIL_TEXTURE_READ = CapabilityBits.TEXTURE2D_ALLOW_DETAIL_TEXTURE_READ; - /** + /** * @deprecated As of Java 3D 1.5 the optional detail texture feature is no * longer supported. * Performs linear sampling in both the base level @@ -78,7 +78,7 @@ public class Texture2D extends Texture { * @deprecated As of Java 3D 1.5 the optional detail texture feature is no * longer supported. * Performs linear detail for the rgb - * components only. The alpha component is computed using + * components only. The alpha component is computed using * BASE_LEVEL_LINEAR filter. * * @since Java 3D 1.3 @@ -90,7 +90,7 @@ public class Texture2D extends Texture { * @deprecated As of Java 3D 1.5 the optional detail texture feature is no * longer supported. * Performs linear detail for the alpha - * component only. The rgb components are computed using + * component only. The rgb components are computed using * BASE_LEVEL_LINEAR filter. * * @since Java 3D 1.3 @@ -224,7 +224,7 @@ public class Texture2D extends Texture { * function is used when the pixel being rendered maps to an area * less than or equal to one texel. * @param magFilter the magnification filter, one of: - * FASTEST, NICEST, BASE_LEVEL_POINT, BASE_LEVEL_LINEAR, + * FASTEST, NICEST, BASE_LEVEL_POINT, BASE_LEVEL_LINEAR, * LINEAR_DETAIL, LINEAR_DETAIL_RGB, LINEAR_DETAIL_ALPHA, * LINEAR_SHARPEN, LINEAR_SHARPEN_RGB, LINEAR_SHARPEN_ALPHA, or FILTER4. * @@ -233,9 +233,9 @@ public class Texture2D extends Texture { * @exception IllegalArgumentException if <code>minFilter</code> * is a value other than <code>FASTEST</code>, <code>NICEST</code>, * <code>BASE_LEVEL_POINT</code>, <code>BASE_LEVEL_LINEAR</code>, - * <code>LINEAR_DETAIL</code>, <code>LINEAR_DETAIL_RGB</code>, - * <code>LINEAR_DETAIL_ALPHA</code>, - * <code>LINEAR_SHARPEN</code>, <code>LINEAR_SHARPEN_RGB</code>, + * <code>LINEAR_DETAIL</code>, <code>LINEAR_DETAIL_RGB</code>, + * <code>LINEAR_DETAIL_ALPHA</code>, + * <code>LINEAR_SHARPEN</code>, <code>LINEAR_SHARPEN_RGB</code>, * <code>LINEAR_SHARPEN_ALPHA</code>, or * <code>FILTER4</code>. * @@ -514,12 +514,12 @@ public class Texture2D extends Texture { /** - * @deprecated replaced with cloneNodeComponent(boolean forceDuplicate) + * @deprecated replaced with cloneNodeComponent(boolean forceDuplicate) */ public NodeComponent cloneNodeComponent() { Texture2DRetained t2d = (Texture2DRetained) retained; - Texture2D t = new Texture2D(t2d.getMipMapMode(), t2d.format, + Texture2D t = new Texture2D(t2d.getMipMapMode(), t2d.format, t2d.width, t2d.height); t.duplicateNodeComponent(this); return t; @@ -557,7 +557,7 @@ public class Texture2D extends Texture { boolean forceDuplicate) { super.duplicateAttributes(originalNodeComponent, forceDuplicate); - Texture2DRetained tex = (Texture2DRetained) + Texture2DRetained tex = (Texture2DRetained) originalNodeComponent.retained; Texture2DRetained rt = (Texture2DRetained) retained; diff --git a/src/classes/share/javax/media/j3d/Texture2DRetained.java b/src/classes/share/javax/media/j3d/Texture2DRetained.java index 57b1e48..c7ccd6c 100644 --- a/src/classes/share/javax/media/j3d/Texture2DRetained.java +++ b/src/classes/share/javax/media/j3d/Texture2DRetained.java @@ -41,12 +41,12 @@ import javax.vecmath.*; */ class Texture2DRetained extends TextureRetained { - // Note : There is hardly any HW vendor supports detail Image. + // Note : There is hardly any HW vendor supports detail Image. // Detail Image operation is simply no-op in 1.5. - + // currently detail image is only applicable to 2D texture // detail texture info - + // These members are unused except for public set and get methods. private ImageComponent2DRetained detailImage = null; private int detailTextureMode = Texture2D.DETAIL_MODULATE; @@ -190,8 +190,8 @@ class Texture2DRetained extends TextureRetained { if (detailTextureFuncPts != null) { for (int i = 0, j = 0; i < numDetailTextureFuncPts; i++) { pts[i].x = detailTextureFuncPts[j++]; - pts[i].y = detailTextureFuncPts[j++]; - } + pts[i].y = detailTextureFuncPts[j++]; + } } } diff --git a/src/classes/share/javax/media/j3d/Texture3D.java b/src/classes/share/javax/media/j3d/Texture3D.java index 14ed438..f64d08b 100644 --- a/src/classes/share/javax/media/j3d/Texture3D.java +++ b/src/classes/share/javax/media/j3d/Texture3D.java @@ -33,7 +33,7 @@ package javax.media.j3d; /** * Texture3D is a subclass of Texture class. It extends Texture - * class by adding a third coordinate, constructor and a mutator + * class by adding a third coordinate, constructor and a mutator * method for setting a 3D texture image. * If 3D texture mapping is not supported on a particular Canvas3D, * 3D texture mapping is ignored for that canvas. @@ -61,7 +61,7 @@ public class Texture3D extends Texture { * boundary mode R : WRAP<br> * </ul> * <p> - * Note that the default constructor creates a texture object with + * Note that the default constructor creates a texture object with * a width, height, and depth of 0 and is, therefore, not useful. */ public Texture3D() { @@ -70,7 +70,7 @@ public class Texture3D extends Texture { /** * Constructs an empty Texture3D object with specified mipmapMode - * format, width, height, and depth. Image at base level must be set by + * format, width, height, and depth. Image at base level must be set by * the application using 'setImage' method. If mipmapMode is * set to MULTI_LEVEL_MIPMAP, images for base level through * maximum level must be set. @@ -97,19 +97,19 @@ public class Texture3D extends Texture { super(mipmapMode, format, width, height); int depthLevels = -1; - + depthLevels = getLevelsNPOT(depth); - - // TODO : Need to verify whether this is a bug. Why depthLevels isn't + + // TODO : Need to verify whether this is a bug. Why depthLevels isn't // use to determine maxMipMapLevels ? See also Texture.java - + ((Texture3DRetained)this.retained).setDepth(depth); } /** * Constructs an empty Texture3D object with specified mipmapMode - * format, width, height, depth, and boundaryWidth. - * Image at base level must be set by + * format, width, height, depth, and boundaryWidth. + * Image at base level must be set by * the application using 'setImage' method. If mipmapMode is * set to MULTI_LEVEL_MIPMAP, images for base level through * maximum level must be set. @@ -143,12 +143,12 @@ public class Texture3D extends Texture { super(mipmapMode, format, width, height, boundaryWidth); int depthLevels = -1; - + depthLevels = getLevelsNPOT(depth); - - // TODO : Need to verify whether this is a bug. Why depthLevels isn't + + // TODO : Need to verify whether this is a bug. Why depthLevels isn't // use to determine maxMipMapLevels ? See also Texture.java - + ((Texture3DRetained)this.retained).setDepth(depth); } @@ -243,7 +243,7 @@ public class Texture3D extends Texture { * the current node. This method is called from the * <code>duplicateNode</code> method. This routine does * the actual duplication of all "local data" (any data defined in - * this object). + * this object). * * @param originalNodeComponent the original node to duplicate. * @param forceDuplicate when set to <code>true</code>, causes the @@ -255,8 +255,8 @@ public class Texture3D extends Texture { * @see Node#cloneTree * @see NodeComponent#setDuplicateOnCloneTree */ - void duplicateAttributes(NodeComponent originalNodeComponent, - boolean forceDuplicate) { + void duplicateAttributes(NodeComponent originalNodeComponent, + boolean forceDuplicate) { super.duplicateAttributes(originalNodeComponent, forceDuplicate); ((Texture3DRetained) retained).initBoundaryModeR(((Texture3DRetained) diff --git a/src/classes/share/javax/media/j3d/Texture3DRetained.java b/src/classes/share/javax/media/j3d/Texture3DRetained.java index a8a5f37..5fbfa7b 100644 --- a/src/classes/share/javax/media/j3d/Texture3DRetained.java +++ b/src/classes/share/javax/media/j3d/Texture3DRetained.java @@ -35,8 +35,8 @@ import java.util.BitSet; /** * Texture3D is a subclass of Texture class. It extends Texture - * class by adding a third co-ordinate, constructor and a mutator - * method for setting a 3D texture image. + * class by adding a third co-ordinate, constructor and a mutator + * method for setting a 3D texture image. */ class Texture3DRetained extends TextureRetained { @@ -74,7 +74,7 @@ class Texture3DRetained extends TextureRetained { } /** - * This method updates the native context. + * This method updates the native context. */ void bindTexture(Context ctx, int objectId, boolean enable) { Pipeline.getPipeline().bindTexture3D(ctx, objectId, enable); @@ -128,7 +128,7 @@ class Texture3DRetained extends TextureRetained { int width, int height, int depth, int boundaryWidth, int imageDataType, Object imageData) { - + Pipeline.getPipeline().updateTexture3DImage(cv.ctx, numLevels, level, textureFormat, imageFormat, @@ -153,8 +153,8 @@ class Texture3DRetained extends TextureRetained { imageDataType, imageData, useAutoMipMapGeneration(cv)); } - - // get an ID for Texture3D + + // get an ID for Texture3D int getTextureId() { return (VirtualUniverse.mc.getTexture3DId()); @@ -214,11 +214,11 @@ class Texture3DRetained extends TextureRetained { /* System.err.println("Texture3D.reloadTextureImage: level= " + level + - " image.imageYup= " + image.imageYup + " w= " + image.width + - " h= " + image.height + " d= " + depth + + " image.imageYup= " + image.imageYup + " w= " + image.width + + " h= " + image.height + " d= " + depth + " numLevels= " + numLevels); */ - + // Texture3D does not need to support Raster ImageComponentRetained.ImageData imageData = image.getImageData(false); @@ -241,9 +241,9 @@ class Texture3DRetained extends TextureRetained { int xoffset = x; int yoffset = y; - // Texture3D does not need to support Raster + // Texture3D does not need to support Raster ImageComponentRetained.ImageData imageData = image.getImageData(false); - + updateTextureSubImage(cv, 0, level, xoffset, yoffset, z, format, image.getImageFormatTypeIntValue(false), diff --git a/src/classes/share/javax/media/j3d/TextureAttributes.java b/src/classes/share/javax/media/j3d/TextureAttributes.java index 5610ab1..81f482b 100644 --- a/src/classes/share/javax/media/j3d/TextureAttributes.java +++ b/src/classes/share/javax/media/j3d/TextureAttributes.java @@ -77,7 +77,7 @@ import javax.vecmath.Color4f; * <LI>Combine Mode - defines the combine operation when texture mode * specifies COMBINE. The combine mode includes the following:<p> * <UL> - * <LI>COMBINE_REPLACE<P> + * <LI>COMBINE_REPLACE<P> * <UL> * C' = C<sub>0</sub> <P> * </UL></LI><P> @@ -97,19 +97,19 @@ import javax.vecmath.Color4f; * <UL> * C' = C<sub>0</sub> - C<sub>1</sub> <P> * </UL></LI><P> - * <LI>COMBINE_INTERPOLATE<P> + * <LI>COMBINE_INTERPOLATE<P> * <UL> * C' = C<sub>0</sub> C<sub>2</sub> + C<sub>1</sub> (1 - C<sub>2</sub>) <P> * </UL></LI><P> * <LI>COMBINE_DOT3<P> * <UL> * C' = 4 * ( - * (C<sub>0<sub>r</sub></sub> - 0.5) * (C<sub>1<sub>r</sub></sub> - 0.5) + - * (C<sub>0<sub>g</sub></sub> - 0.5) * (C<sub>1<sub>g</sub></sub> - 0.5) + + * (C<sub>0<sub>r</sub></sub> - 0.5) * (C<sub>1<sub>r</sub></sub> - 0.5) + + * (C<sub>0<sub>g</sub></sub> - 0.5) * (C<sub>1<sub>g</sub></sub> - 0.5) + * (C<sub>0<sub>b</sub></sub> - 0.5) * (C<sub>1<sub>b</sub></sub> - 0.5))<P> * where C<sub>N<sub>x</sub></sub> is the x component of the Nth color operand * in the combine operation.<P> - * The value C' will be placed to the all three r,g,b components or the + * The value C' will be placed to the all three r,g,b components or the * a component of the output. * </UL></LI><P> * </UL></LI><P> @@ -124,7 +124,7 @@ import javax.vecmath.Color4f; * <LI> COMBINE_TEXTURE_COLOR - texture color<P> * <LI> COMBINE_CONSTANT_COLOR - texture blend color<P> * <LI> COMBINE_PREVIOUS_TEXTURE_UNIT_STATE - color from the previous texture - * unit state. For texture unit state 0, this is equivalent to + * unit state. For texture unit state 0, this is equivalent to * COMBINE_OBJECT_COLOR.<P> * </UL></LI><P> * <LI>Combine Color Function - specifies the function for a color operand @@ -285,16 +285,16 @@ public class TextureAttributes extends NodeComponent { * @see #setTextureMode */ public static final int REPLACE = 5; - + /** - * Combine the object color with texture color as specified in + * Combine the object color with texture color as specified in * the combine mode. * * @see #setTextureMode * @since Java 3D 1.3 */ public static final int COMBINE = 6; - + /** * Replace the input color with the specified color. @@ -359,7 +359,7 @@ public class TextureAttributes extends NodeComponent { */ public static final int COMBINE_DOT3 = 6; - + /** * Object color coming into the texturing state. * @@ -379,7 +379,7 @@ public class TextureAttributes extends NodeComponent { public static final int COMBINE_TEXTURE_COLOR = 1; /** - * Texture blend color. + * Texture blend color. * * @since Java 3D 1.3 * @see #setCombineRgbSource @@ -396,7 +396,7 @@ public class TextureAttributes extends NodeComponent { */ public static final int COMBINE_PREVIOUS_TEXTURE_UNIT_STATE = 3; - /** + /** * Color function is f = C<sub>rgb</sub> * * @since Java 3D 1.3 @@ -404,7 +404,7 @@ public class TextureAttributes extends NodeComponent { */ public static final int COMBINE_SRC_COLOR = 0; - /** + /** * Color function is f = (1 - C<sub>rgb</sub>) * * @since Java 3D 1.3 @@ -412,7 +412,7 @@ public class TextureAttributes extends NodeComponent { */ public static final int COMBINE_ONE_MINUS_SRC_COLOR = 1; - /** + /** * Color function is f = C<sub>a</sub> * * @since Java 3D 1.3 @@ -421,7 +421,7 @@ public class TextureAttributes extends NodeComponent { */ public static final int COMBINE_SRC_ALPHA = 2; - /** + /** * Color function is f = (1 - C<sub>a</sub>) * * @since Java 3D 1.3 @@ -436,9 +436,9 @@ public class TextureAttributes extends NodeComponent { ALLOW_COLOR_TABLE_READ, ALLOW_COMBINE_READ, ALLOW_MODE_READ, - ALLOW_TRANSFORM_READ + ALLOW_TRANSFORM_READ }; - + /** * Constructs a TextureAttributes object with default parameters. * The default values are as follows: @@ -450,20 +450,20 @@ public class TextureAttributes extends NodeComponent { * texture color table : null<br> * combine rgb mode : COMBINE_MODULATE<br> * combine alpha mode : COMBINE_MODULATE<br> - * combine rgb source : + * combine rgb source : * <ul> * C<sub>0</sub>=COMBINE_TEXTURE_COLOR<br> * C<sub>1</sub>=COMBINE_PREVIOUS_TEXTURE_UNIT_STATE<br> * C<sub>2</sub>=COMBINE_CONSTANT_COLOR<br> * </ul> - * combine alpha source : + * combine alpha source : * <ul> * C<sub>0</sub>=COMBINE_TEXTURE_COLOR<br> * C<sub>1</sub>=COMBINE_PREVIOUS_TEXTURE_UNIT_STATE<br> * C<sub>2</sub>=COMBINE_CONSTANT_COLOR<br> * </ul> * combine rgb function : COMBINE_SRC_COLOR<br> - * combine alpha function : COMBINE_SRC_ALPHA<br> + * combine alpha function : COMBINE_SRC_ALPHA<br> * combine rgb scale : 1<br> * combine alpha scale : 1<br> * </ul> @@ -472,16 +472,16 @@ public class TextureAttributes extends NodeComponent { // set default read capabilities setDefaultReadCapabilities(readCapabilities); } - + /** * Constructs a TextureAttributes object with the specified values. - * @param textureMode the texture mode; one of <code>MODULATE</code>, + * @param textureMode the texture mode; one of <code>MODULATE</code>, * <code>DECAL</code>, <code>BLEND</code>, <code>REPLACE</code>, or * <code>COMBINE</code> * @param transform the transform object, used to transform texture * coordinates * @param textureBlendColor the texture constant color - * @param perspCorrectionMode the perspective correction mode to + * @param perspCorrectionMode the perspective correction mode to * be used for color and/or texture coordinate interpolation; * one of <code>NICEST</code> or <code>FASTEST</code> * @exception IllegalArgumentException if <code>textureMode</code> @@ -499,7 +499,7 @@ public class TextureAttributes extends NodeComponent { throw new IllegalArgumentException(J3dI18N.getString("TextureAttributes10")); } - if ((perspCorrectionMode != FASTEST) && + if ((perspCorrectionMode != FASTEST) && (perspCorrectionMode!= NICEST)) { throw new IllegalArgumentException(J3dI18N.getString("TextureAttributes9")); } @@ -512,7 +512,7 @@ public class TextureAttributes extends NodeComponent { ((TextureAttributesRetained)this.retained).initTextureTransform(transform); ((TextureAttributesRetained)this.retained).initPerspectiveCorrectionMode(perspCorrectionMode); } - + /** * Sets the texture mode parameter for this * appearance component object. @@ -545,7 +545,7 @@ public class TextureAttributes extends NodeComponent { * Gets the texture mode parameter for this * texture attributes object. * @return textureMode the texture mode - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ public int getTextureMode() { @@ -560,7 +560,7 @@ public class TextureAttributes extends NodeComponent { * Sets the texture constant color for this * texture attributes object. * @param textureBlendColor the texture constant color - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ public void setTextureBlendColor(Color4f textureBlendColor) { @@ -576,12 +576,12 @@ public class TextureAttributes extends NodeComponent { /** * Sets the texture blend color for this - * appearance component object. + * appearance component object. * @param r the red component of the color * @param g the green component of the color * @param b the blue component of the color * @param a the alpha component of the color - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ public void setTextureBlendColor(float r, float g, float b, float a) { @@ -599,8 +599,8 @@ public class TextureAttributes extends NodeComponent { * Gets the texture blend color for this * appearance component object. * @param textureBlendColor the vector that will receive the texture - * constant color - * @exception CapabilityNotSetException if appropriate capability is + * constant color + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ public void getTextureBlendColor(Color4f textureBlendColor) { @@ -654,7 +654,7 @@ public class TextureAttributes extends NodeComponent { * correction method should be used. * @param mode one of <code>NICEST</code> or <code>FASTEST</code> * The default value is <code>NICEST</code>. - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph * @exception IllegalArgumentException if mode value is other * than <code>FASTEST</code> or <code>NICEST</code>. @@ -676,7 +676,7 @@ public class TextureAttributes extends NodeComponent { /** * Gets perspective correction mode value. * @return mode the value of perspective correction mode - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ public int getPerspectiveCorrectionMode() { @@ -720,7 +720,7 @@ public class TextureAttributes extends NodeComponent { * is not 3 or 4, or if the arrays for each component are not all * the same length, or if the texture color table size * is not a power of 2 - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph * * @see Canvas3D#queryProperties @@ -749,7 +749,7 @@ public class TextureAttributes extends NodeComponent { * enough to hold the entire table (that is, * <code>int[numTextureColorTableComponents][textureColorTableSize]</code>). * - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph * * @since Java 3D 1.2 @@ -791,21 +791,21 @@ public class TextureAttributes extends NodeComponent { /** - * Sets the combine mode for the rgb components of the output color + * Sets the combine mode for the rgb components of the output color * for this object. * - * @param combineMode the combine mode, one of: + * @param combineMode the combine mode, one of: * <code>COMBINE_REPLACE</code>, - * <code>COMBINE_MODULATE</code>, <code>COMBINE_ADD</code>, + * <code>COMBINE_MODULATE</code>, <code>COMBINE_ADD</code>, * <code>COMBINE_ADD_SIGNED</code>, <code>COMBINE_SUBTRACT</code>, * <code>COMBINE_INTERPOLATE</code>, or <code>COMBINE_DOT3</code> * * @exception IllegalArgumentException if <code>combineMode</code> * is a value other than <code>COMBINE_REPLACE</code>, - * <code>COMBINE_MODULATE</code>, <code>COMBINE_ADD</code>, + * <code>COMBINE_MODULATE</code>, <code>COMBINE_ADD</code>, * <code>COMBINE_ADD_SIGNED</code>, <code>COMBINE_SUBTRACT</code>, * <code>COMBINE_INTERPOLATE</code>, or <code>COMBINE_DOT3</code> - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph * * @see Canvas3D#queryProperties @@ -833,21 +833,21 @@ public class TextureAttributes extends NodeComponent { } /** - * Sets the combine mode for the alpha component of the output color + * Sets the combine mode for the alpha component of the output color * for this object. * - * @param combineMode the combine mode, one of: + * @param combineMode the combine mode, one of: * <code>COMBINE_REPLACE</code>, - * <code>COMBINE_MODULATE</code>, <code>COMBINE_ADD</code>, + * <code>COMBINE_MODULATE</code>, <code>COMBINE_ADD</code>, * <code>COMBINE_ADD_SIGNED</code>, <code>COMBINE_SUBTRACT</code>, * <code>COMBINE_INTERPOLATE</code>, or <code>COMBINE_DOT3</code> * * @exception IllegalArgumentException if <code>combineMode</code> * is a value other than <code>COMBINE_REPLACE</code>, - * <code>COMBINE_MODULATE</code>, <code>COMBINE_ADD</code>, + * <code>COMBINE_MODULATE</code>, <code>COMBINE_ADD</code>, * <code>COMBINE_ADD_SIGNED</code>, <code>COMBINE_SUBTRACT</code>, * <code>COMBINE_INTERPOLATE</code>, or <code>COMBINE_DOT3</code> - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph * * @see Canvas3D#queryProperties @@ -859,7 +859,7 @@ public class TextureAttributes extends NodeComponent { if (!this.getCapability(ALLOW_COMBINE_WRITE)) { throw new CapabilityNotSetException( J3dI18N.getString("TextureAttributes18")); - } + } } if ((combineMode < COMBINE_REPLACE) || (combineMode > COMBINE_DOT3)) { @@ -879,7 +879,7 @@ public class TextureAttributes extends NodeComponent { * for this object. * @return the combine mode for the rgb components. * - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph * * @since Java 3D 1.3 @@ -900,7 +900,7 @@ public class TextureAttributes extends NodeComponent { * for this object. * @return the combine mode for the alpha component. * - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph * * @since Java 3D 1.3 @@ -917,25 +917,25 @@ public class TextureAttributes extends NodeComponent { } /** - * Sets the source for the rgb components of the specified color operand + * Sets the source for the rgb components of the specified color operand * for this object. * * @param index color operand in the combine operation * @param src the color source, one of: <code>COMBINE_OBJECT_COLOR</code>, - * <code>COMBINE_TEXTURE_COLOR</code>, + * <code>COMBINE_TEXTURE_COLOR</code>, * <code>COMBINE_CONSTANT_COLOR</code>, or * <code>COMBINE_PREVIOUS_TEXTURE_UNIT_STATE</code> * - * @exception IndexOutOfBoundsException if <code>index</code> < 0 or + * @exception IndexOutOfBoundsException if <code>index</code> < 0 or * <code>index</code> > 2 * @exception IllegalArgumentException if <code>src</code> * is a value other than <code>COMBINE_OBJECT_COLOR</code>, - * <code>COMBINE_TEXTURE_COLOR</code>, + * <code>COMBINE_TEXTURE_COLOR</code>, * <code>COMBINE_CONSTANT_COLOR</code>, or * <code>COMBINE_PREVIOUS_TEXTURE_UNIT_STATE</code> - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph - * + * * @see Canvas3D#queryProperties * * @since Java 3D 1.3 @@ -945,7 +945,7 @@ public class TextureAttributes extends NodeComponent { if (!this.getCapability(ALLOW_COMBINE_WRITE)) { throw new CapabilityNotSetException( J3dI18N.getString("TextureAttributes21")); - } + } } if ((index < 0) || (index > 2)) { @@ -953,7 +953,7 @@ public class TextureAttributes extends NodeComponent { J3dI18N.getString("TextureAttributes25")); } - if ((src < COMBINE_OBJECT_COLOR) || + if ((src < COMBINE_OBJECT_COLOR) || (src > COMBINE_PREVIOUS_TEXTURE_UNIT_STATE)) { throw new IllegalArgumentException( J3dI18N.getString("TextureAttributes26")); @@ -969,25 +969,25 @@ public class TextureAttributes extends NodeComponent { } /** - * Sets the source for the alpha component of the specified color operand + * Sets the source for the alpha component of the specified color operand * for this object. * * @param index color operand in the combine operation * @param src the color source, one of: <code>COMBINE_OBJECT_COLOR</code>, - * <code>COMBINE_TEXTURE_COLOR</code>, + * <code>COMBINE_TEXTURE_COLOR</code>, * <code>COMBINE_CONSTANT_COLOR</code>, or * <code>COMBINE_PREVIOUS_TEXTURE_UNIT_STATE</code> * - * @exception IndexOutOfBoundsException if <code>index</code> < 0 or + * @exception IndexOutOfBoundsException if <code>index</code> < 0 or * <code>index</code> > 2 * @exception IllegalArgumentException if <code>src</code> * is a value other than <code>COMBINE_OBJECT_COLOR</code>, - * <code>COMBINE_TEXTURE_COLOR</code>, + * <code>COMBINE_TEXTURE_COLOR</code>, * <code>COMBINE_CONSTANT_COLOR</code>, or * <code>COMBINE_PREVIOUS_TEXTURE_UNIT_STATE</code> - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph - * + * * @see Canvas3D#queryProperties * * @since Java 3D 1.3 @@ -1005,7 +1005,7 @@ public class TextureAttributes extends NodeComponent { J3dI18N.getString("TextureAttributes25")); } - if ((src < COMBINE_OBJECT_COLOR) || + if ((src < COMBINE_OBJECT_COLOR) || (src > COMBINE_PREVIOUS_TEXTURE_UNIT_STATE)) { throw new IllegalArgumentException( J3dI18N.getString("TextureAttributes26")); @@ -1029,11 +1029,11 @@ public class TextureAttributes extends NodeComponent { * @return the source for the rgb components of the specified color * operand for this object * - * @exception IndexOutOfBoundsException if <code>index</code> < 0 or + * @exception IndexOutOfBoundsException if <code>index</code> < 0 or * <code>index</code> > 2 - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph - * + * * @since Java 3D 1.3 */ public int getCombineRgbSource(int index) { @@ -1061,11 +1061,11 @@ public class TextureAttributes extends NodeComponent { * @return the source for the alpha component of the specified color * operand for this object * - * @exception IndexOutOfBoundsException if <code>index</code> < 0 or + * @exception IndexOutOfBoundsException if <code>index</code> < 0 or * <code>index</code> > 2 - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph - * + * * @since Java 3D 1.3 */ public int getCombineAlphaSource(int index) { @@ -1089,17 +1089,17 @@ public class TextureAttributes extends NodeComponent { * for this object. * * @param index color operand in the combine operation - * @param function the color function, one of: + * @param function the color function, one of: * <code>COMBINE_SRC_COLOR</code>, - * <code>COMBINE_ONE_MINUS_SRC_COLOR</code>, + * <code>COMBINE_ONE_MINUS_SRC_COLOR</code>, * <code>COMBINE_SRC_ALPHA</code>, or * <code>COMBINE_ONE_MINUS_SRC_ALPHA</code> * - * @exception IndexOutOfBoundsException if <code>index</code> < 0 or + * @exception IndexOutOfBoundsException if <code>index</code> < 0 or * <code>index</code> > 2 * @exception IllegalArgumentException if <code>function</code> * is a value other than <code>COMBINE_SRC_COLOR</code>, - * <code>COMBINE_ONE_MINUS_SRC_COLOR</code>, + * <code>COMBINE_ONE_MINUS_SRC_COLOR</code>, * <code>COMBINE_SRC_ALPHA</code>, or * <code>COMBINE_ONE_MINUS_SRC_ALPHA</code> * @exception CapabilityNotSetException if appropriate capability is @@ -1142,14 +1142,14 @@ public class TextureAttributes extends NodeComponent { * for this object. * * @param index color operand in the combine operation - * @param function the color function, one of: + * @param function the color function, one of: * <code>COMBINE_SRC_ALPHA</code>, or * <code>COMBINE_ONE_MINUS_SRC_ALPHA</code> * - * @exception IndexOutOfBoundsException if <code>index</code> < 0 or + * @exception IndexOutOfBoundsException if <code>index</code> < 0 or * <code>index</code> > 2 * @exception IllegalArgumentException if <code>function</code> - * is a value other than + * is a value other than * <code>COMBINE_SRC_ALPHA</code> or * <code>COMBINE_ONE_MINUS_SRC_ALPHA</code> * @exception CapabilityNotSetException if appropriate capability is @@ -1196,7 +1196,7 @@ public class TextureAttributes extends NodeComponent { * @return the function for the rgb components of the specified color * operand for this object. * - * @exception IndexOutOfBoundsException if <code>index</code> < 0 or + * @exception IndexOutOfBoundsException if <code>index</code> < 0 or * <code>index</code> > 2 * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph @@ -1228,7 +1228,7 @@ public class TextureAttributes extends NodeComponent { * @return the function for the alpha component of the specified color * operand for this object. * - * @exception IndexOutOfBoundsException if <code>index</code> < 0 or + * @exception IndexOutOfBoundsException if <code>index</code> < 0 or * <code>index</code> > 2 * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph @@ -1255,7 +1255,7 @@ public class TextureAttributes extends NodeComponent { * Sets the scale factor for the rgb components of the output color * for this object. * - * @param scale the scale factor for the rgb components of the output + * @param scale the scale factor for the rgb components of the output * color. It must be one of the following: 1, 2, or 4. * * @exception IllegalArgumentException if <code>scale</code> is a @@ -1292,7 +1292,7 @@ public class TextureAttributes extends NodeComponent { * Sets the scale factor for the alpha component of the output color * for this object. * - * @param scale the scale factor for the alpha component of the output + * @param scale the scale factor for the alpha component of the output * color. It must be one of the following: 1, 2, or 4. * * @exception IllegalArgumentException if <code>scale</code> is a @@ -1380,7 +1380,7 @@ public class TextureAttributes extends NodeComponent { /** - * @deprecated replaced with cloneNodeComponent(boolean forceDuplicate) + * @deprecated replaced with cloneNodeComponent(boolean forceDuplicate) */ public NodeComponent cloneNodeComponent() { TextureAttributes ta = new TextureAttributes(); @@ -1394,7 +1394,7 @@ public class TextureAttributes extends NodeComponent { * the current node. This method is called from the * <code>duplicateNode</code> method. This routine does * the actual duplication of all "local data" (any data defined in - * this object). + * this object). * * @param originalNodeComponent the original node to duplicate. * @param forceDuplicate when set to <code>true</code>, causes the @@ -1406,14 +1406,14 @@ public class TextureAttributes extends NodeComponent { * @see Node#cloneTree * @see NodeComponent#setDuplicateOnCloneTree */ - void duplicateAttributes(NodeComponent originalNodeComponent, - boolean forceDuplicate) { + void duplicateAttributes(NodeComponent originalNodeComponent, + boolean forceDuplicate) { super.duplicateAttributes(originalNodeComponent, forceDuplicate); - - TextureAttributesRetained attr = + + TextureAttributesRetained attr = (TextureAttributesRetained) originalNodeComponent.retained; - TextureAttributesRetained rt = (TextureAttributesRetained) retained; + TextureAttributesRetained rt = (TextureAttributesRetained) retained; Color4f c = new Color4f(); attr.getTextureBlendColor(c); @@ -1435,10 +1435,10 @@ public class TextureAttributes extends NodeComponent { // start fix issue 636 rt.initCombineRgbMode(attr.getCombineRgbMode()); rt.initCombineAlphaMode(attr.getCombineAlphaMode()); - + rt.initCombineRgbScale(attr.getCombineRgbScale()); rt.initCombineAlphaScale(attr.getCombineAlphaScale()); - + // Check one of the combine source or function arrays if (attr.combineRgbSrc != null) { for (int i=0; i < 3; i++) { diff --git a/src/classes/share/javax/media/j3d/TextureAttributesRetained.java b/src/classes/share/javax/media/j3d/TextureAttributesRetained.java index 235ceb0..4bf31ae 100644 --- a/src/classes/share/javax/media/j3d/TextureAttributesRetained.java +++ b/src/classes/share/javax/media/j3d/TextureAttributesRetained.java @@ -101,7 +101,7 @@ class TextureAttributesRetained extends NodeComponentRetained { static final void initTextureEnums() { // create some of the enums Integer to be used in the messages - // this can be eliminated if the message is modified to take + // this can be eliminated if the message is modified to take // integer itself // // NOTE: check with the actual enum value before using this @@ -287,7 +287,7 @@ class TextureAttributesRetained extends NodeComponentRetained { if (table == null) { sendMessage(TEXTURE_COLOR_TABLE_CHANGED, null, null); } else { - int ctable[] = new int[textureColorTableSize * + int ctable[] = new int[textureColorTableSize * numTextureColorTableComponents]; System.arraycopy(textureColorTable, 0, ctable, 0, textureColorTable.length); @@ -362,10 +362,10 @@ class TextureAttributesRetained extends NodeComponentRetained { final int getTextureColorTableSize() { return textureColorTableSize; } - + final void initCombineRgbMode(int mode) { - combineRgbMode = mode; + combineRgbMode = mode; } final void setCombineRgbMode(int mode) { @@ -399,7 +399,7 @@ class TextureAttributesRetained extends NodeComponentRetained { } combineRgbSrc[index] = src; } - + final void setCombineRgbSource(int index, int src) { initCombineRgbSource(index, src); sendMessage(COMBINE_RGB_SRC_CHANGED, enums[index], enums[src]); @@ -424,7 +424,7 @@ class TextureAttributesRetained extends NodeComponentRetained { } combineAlphaSrc[index] = src; } - + final void setCombineAlphaSource(int index, int src) { initCombineAlphaSource(index, src); sendMessage(COMBINE_ALPHA_SRC_CHANGED, enums[index], enums[src]); @@ -519,8 +519,8 @@ class TextureAttributesRetained extends NodeComponentRetained { void updateNative(Canvas3D cv, boolean simulate, int textureFormat) { //System.err.println("TextureAttributes/updateNative: simulate= " + simulate + " " + this); - - //if ((cv.textureExtendedFeatures & Canvas3D.TEXTURE_COLOR_TABLE) + + //if ((cv.textureExtendedFeatures & Canvas3D.TEXTURE_COLOR_TABLE) // == 0) && textureColorTable != null) { // System.err.println("TextureColorTable Not supported"); //} @@ -528,10 +528,10 @@ class TextureAttributesRetained extends NodeComponentRetained { //System.err.println("textureMode= " + textureMode); boolean isIdentity = ((transform.getType() & Transform3D.IDENTITY) != 0); - + if (simulate == false) { if (VirtualUniverse.mc.useCombiners && - (cv.textureExtendedFeatures & + (cv.textureExtendedFeatures & Canvas3D.TEXTURE_REGISTER_COMBINERS) != 0) { Pipeline.getPipeline().updateRegisterCombiners(cv.ctx, transform.mat, isIdentity, textureMode, perspCorrectionMode, @@ -544,7 +544,7 @@ class TextureAttributesRetained extends NodeComponentRetained { } else { if (textureMode == TextureAttributes.COMBINE) { - if ((cv.textureExtendedFeatures & + if ((cv.textureExtendedFeatures & Canvas3D.TEXTURE_COMBINE) != 0) { // Texture COMBINE is supported by the underlying layer @@ -561,26 +561,26 @@ class TextureAttributesRetained extends NodeComponentRetained { if (((combineRgbMode == TextureAttributes.COMBINE_DOT3) && - ((cv.textureExtendedFeatures & - Canvas3D.TEXTURE_COMBINE_DOT3) == 0)) || + ((cv.textureExtendedFeatures & + Canvas3D.TEXTURE_COMBINE_DOT3) == 0)) || ((combineRgbMode == TextureAttributes.COMBINE_SUBTRACT) && - ((cv.textureExtendedFeatures & + ((cv.textureExtendedFeatures & Canvas3D.TEXTURE_COMBINE_SUBTRACT) == 0))) { - // Combine DOT3/SUBTRACT is not supported by the + // Combine DOT3/SUBTRACT is not supported by the // underlying layer, fallback to COMBINE_REPLACE _combineRgbMode = TextureAttributes.COMBINE_REPLACE; } if (((combineAlphaMode == TextureAttributes.COMBINE_DOT3) && - ((cv.textureExtendedFeatures & + ((cv.textureExtendedFeatures & Canvas3D.TEXTURE_COMBINE_DOT3) == 0)) || ((combineAlphaMode == TextureAttributes.COMBINE_SUBTRACT) && - ((cv.textureExtendedFeatures & + ((cv.textureExtendedFeatures & Canvas3D.TEXTURE_COMBINE_SUBTRACT) == 0))) { - // Combine DOT3/SUBTRACT is not supported by the + // Combine DOT3/SUBTRACT is not supported by the // underlying layer, fallback to COMBINE_REPLACE _combineAlphaMode = TextureAttributes.COMBINE_REPLACE; @@ -616,10 +616,10 @@ class TextureAttributesRetained extends NodeComponentRetained { } - if (((cv.textureExtendedFeatures & Canvas3D.TEXTURE_COLOR_TABLE) + if (((cv.textureExtendedFeatures & Canvas3D.TEXTURE_COLOR_TABLE) != 0) && textureColorTable != null) { - Pipeline.getPipeline().updateTextureColorTable(cv.ctx, + Pipeline.getPipeline().updateTextureColorTable(cv.ctx, numTextureColorTableComponents, textureColorTableSize, textureColorTable); } @@ -633,7 +633,7 @@ class TextureAttributesRetained extends NodeComponentRetained { textureBlendColor.x, textureBlendColor.y, textureBlendColor.z, textureBlendColor.w, textureFormat); - if (((cv.textureExtendedFeatures & Canvas3D.TEXTURE_COLOR_TABLE) + if (((cv.textureExtendedFeatures & Canvas3D.TEXTURE_COLOR_TABLE) != 0) && textureColorTable != null) { Pipeline.getPipeline().updateTextureColorTable(cv.ctx, numTextureColorTableComponents, @@ -676,7 +676,7 @@ class TextureAttributesRetained extends NodeComponentRetained { /** - * Creates and initializes a mirror object, point the mirror object + * Creates and initializes a mirror object, point the mirror object * to the retained object if the object is not editable */ synchronized void createMirrorObject() { @@ -706,10 +706,10 @@ class TextureAttributesRetained extends NodeComponentRetained { /** - * Update the "component" field of the mirror object with the + * Update the "component" field of the mirror object with the * given "value" */ - synchronized void updateMirrorObject(int component, Object value, + synchronized void updateMirrorObject(int component, Object value, Object value2) { TextureAttributesRetained mirrorTa = (TextureAttributesRetained)mirror; mirrorTa.mirrorCompDirty = true; @@ -730,7 +730,7 @@ class TextureAttributesRetained extends NodeComponentRetained { } else if ((component & CORRECTION_CHANGED) != 0) { mirrorTa.perspCorrectionMode = ((Integer)value).intValue(); - } + } else if ((component & TEXTURE_COLOR_TABLE_CHANGED) != 0) { if (value == null) { mirrorTa.textureColorTable = null; @@ -739,9 +739,9 @@ class TextureAttributesRetained extends NodeComponentRetained { } else { Object args[] = (Object[])value; mirrorTa.textureColorTable = (int[])args[2]; - mirrorTa.numTextureColorTableComponents = + mirrorTa.numTextureColorTableComponents = ((Integer)args[0]).intValue(); - mirrorTa.textureColorTableSize = + mirrorTa.textureColorTableSize = ((Integer)args[1]).intValue(); } } @@ -855,7 +855,7 @@ class TextureAttributesRetained extends NodeComponentRetained { // tr.textureColorTable != null return false; } else { - if (tr.textureColorTable.length != this.textureColorTable.length) + if (tr.textureColorTable.length != this.textureColorTable.length) return false; for (int i = 0; i < this.textureColorTable.length; i++) { @@ -895,7 +895,7 @@ class TextureAttributesRetained extends NodeComponentRetained { tr.combineAlphaFcn[i] = combineAlphaFcn[i]; } } - + // other attributes are copied in super.clone() return tr; } @@ -921,7 +921,7 @@ class TextureAttributesRetained extends NodeComponentRetained { } numTextureColorTableComponents = tr.numTextureColorTableComponents; textureColorTableSize = tr.textureColorTableSize; - + // set the combine mode attributes @@ -951,7 +951,7 @@ class TextureAttributesRetained extends NodeComponentRetained { final void sendMessage(int attrMask, Object attr1, Object attr2) { ArrayList univList = new ArrayList(); - ArrayList gaList = Shape3DRetained.getGeomAtomsList(mirror.users, univList); + ArrayList gaList = Shape3DRetained.getGeomAtomsList(mirror.users, univList); // Send to rendering attribute structure, regardless of @@ -973,7 +973,7 @@ class TextureAttributesRetained extends NodeComponentRetained { createMessage = new J3dMessage(); createMessage.threads = J3dThread.UPDATE_RENDER; createMessage.type = J3dMessage.TEXTUREATTRIBUTES_CHANGED; - + createMessage.universe = (VirtualUniverse) univList.get(i); createMessage.args[0] = this; createMessage.args[1] = new Integer(attrMask); @@ -983,7 +983,7 @@ class TextureAttributesRetained extends NodeComponentRetained { GeometryAtom[] gaArr = new GeometryAtom[gL.size()]; gL.toArray(gaArr); createMessage.args[3] = gaArr; - + VirtualUniverse.mc.processMessage(createMessage); } } diff --git a/src/classes/share/javax/media/j3d/TextureBin.java b/src/classes/share/javax/media/j3d/TextureBin.java index 01219c6..b5d2778 100644 --- a/src/classes/share/javax/media/j3d/TextureBin.java +++ b/src/classes/share/javax/media/j3d/TextureBin.java @@ -102,10 +102,10 @@ class TextureBin extends Object implements ObjectUpdate { * TextureUnitState dirty bit. The ith bit set means the (i-1) * texture unit state is modified. Note, this mask only supports * 30 texture unit states. If the appearance uses more than 31 - * texture unit states, then the modification of the 32nd texture + * texture unit states, then the modification of the 32nd texture * unit state and up will have the first bit set, that means * the TextureBin will be reset, rather than only the particular - * texture unit state will be reset. + * texture unit state will be reset. */ int soleUserCompDirty; @@ -137,7 +137,7 @@ class TextureBin extends Object implements ObjectUpdate { int numRenderMolecules = 0; int numEditingRenderMolecules = 0; - + int tbFlag = 0; // a general bitmask for TextureBin // Following are the bits used in flag @@ -148,12 +148,12 @@ class TextureBin extends Object implements ObjectUpdate { final static int CONTIGUOUS_ACTIVE_UNITS = 0x0008; final static int RESORT = 0x0010; final static int ON_UPDATE_CHECK_LIST = 0x0020; - + final static int USE_DISPLAYLIST = -2; final static int USE_VERTEXARRAY = -1; TextureBin(TextureUnitStateRetained[] state, AppearanceRetained app, - RenderBin rb) { + RenderBin rb) { renderBin = rb; tbFlag = 0; reset(state, app); @@ -176,8 +176,8 @@ class TextureBin extends Object implements ObjectUpdate { // TextureBin tbFlag &= ~TextureBin.SOLE_USER; if (VirtualUniverse.mc.allowSoleUser) { - if ((app != null) && - (app.changedFrequent & + if ((app != null) && + (app.changedFrequent & (AppearanceRetained.TEXTURE | AppearanceRetained.TEXCOORD_GEN | AppearanceRetained.TEXTURE_ATTR | @@ -192,7 +192,7 @@ class TextureBin extends Object implements ObjectUpdate { } else { this.app = null; } - + resetTextureState(state); if ((tbFlag & TextureBin.ON_RENDER_BIN_LIST) == 0) { @@ -243,7 +243,7 @@ class TextureBin extends Object implements ObjectUpdate { texUnitState[i].mirror = state[i]; } - // for the lowest level of node component in + // for the lowest level of node component in // TextureBin, clone it only if it is not // changedFrequent; in other words, if the // lowest level of texture related node components @@ -261,18 +261,18 @@ class TextureBin extends Object implements ObjectUpdate { if (soleUser && (tex.getTextureBinRefCount(this) == 0) && (tex != state[i].texture)) { - // In this case texture change but + // In this case texture change but // TextureBin will not invoke clear() to reset. // So we need to free the texture resource here. - renderBin.addTextureResourceFreeList(tex); + renderBin.addTextureResourceFreeList(tex); } } - + texUnitState[i].texture = state[i].texture; // increment the TextureBin ref count of the new // texture - + if (texUnitState[i].texture != null) { texUnitState[i].texture.incTextureBinRefCount(this); } @@ -291,9 +291,9 @@ class TextureBin extends Object implements ObjectUpdate { if (texUnitState[i].texAttrs == null || texUnitState[i].texAttrs.source != null) { - texUnitState[i].texAttrs = + texUnitState[i].texAttrs = new TextureAttributesRetained(); - } + } texUnitState[i].texAttrs.set( state[i].texAttrs); texUnitState[i].texAttrs.mirrorCompDirty = true; @@ -302,7 +302,7 @@ class TextureBin extends Object implements ObjectUpdate { // the mirror node component in the mirror // reference in the clone object. This // will be used in state download to - // avoid redundant download + // avoid redundant download if (soleUser) { texUnitState[i].texAttrs.mirror = @@ -329,9 +329,9 @@ class TextureBin extends Object implements ObjectUpdate { if (texUnitState[i].texGen == null || texUnitState[i].texGen.source != null) { - texUnitState[i].texGen = + texUnitState[i].texGen = new TexCoordGenerationRetained(); - } + } texUnitState[i].texGen.set(state[i].texGen); texUnitState[i].texGen.mirrorCompDirty = true; @@ -341,7 +341,7 @@ class TextureBin extends Object implements ObjectUpdate { // the mirror node component in the mirror // reference in the clone object. This // will be used in state download to - // avoid redundant download + // avoid redundant download if (soleUser) { texUnitState[i].texGen.mirror = state[i].texGen; @@ -379,7 +379,7 @@ class TextureBin extends Object implements ObjectUpdate { // resorting is needed if ((texUnitState[0] == null && prevFirstTexture != null) || - (texUnitState[0] != null && + (texUnitState[0] != null && texUnitState[0].texture != prevFirstTexture)) { tbFlag |= TextureBin.RESORT; } @@ -413,7 +413,7 @@ class TextureBin extends Object implements ObjectUpdate { // the reference count. If the reference count == 0, tell // the renderer to free up the resource if (texUnitState != null) { - + TextureRetained tex; for (int i = 0; i < texUnitState.length; i++) { @@ -445,7 +445,7 @@ class TextureBin extends Object implements ObjectUpdate { } } } - + /** @@ -455,13 +455,13 @@ class TextureBin extends Object implements ObjectUpdate { int i, j, k = 0; TextureRetained texture; - + // if this TextureBin is a soleUser case or the incoming // app has changedFrequent bit set for any of the texture // related component, then either the current TextureBin // or the incoming app requires the same app match - if (((tbFlag & TextureBin.SOLE_USER) != 0) || - ((ra.app != null) && + if (((tbFlag & TextureBin.SOLE_USER) != 0) || + ((ra.app != null) && (ra.app.changedFrequent & (AppearanceRetained.TEXTURE | AppearanceRetained.TEXCOORD_GEN | @@ -500,8 +500,8 @@ class TextureBin extends Object implements ObjectUpdate { if (texUnitState == null || state == null) return (false); - - if (state.length != texUnitState.length) + + if (state.length != texUnitState.length) return (false); for (i = 0; i < texUnitState.length; i++) { @@ -531,7 +531,7 @@ class TextureBin extends Object implements ObjectUpdate { /* - // updateNodeComponentCheck is called for each soleUser TextureBin + // updateNodeComponentCheck is called for each soleUser TextureBin // into which new renderAtom has been added. This method is called before // updateNodeComponent() to allow TextureBin to catch any node // component changes that have been missed because the changes @@ -602,9 +602,9 @@ class TextureBin extends Object implements ObjectUpdate { } } */ - - + + /** * updateNodeComponent is called from RenderBin to update the @@ -616,18 +616,18 @@ class TextureBin extends Object implements ObjectUpdate { // don't bother to update if the TextureBin is already // removed from RenderBin - if ((tbFlag & TextureBin.ON_RENDER_BIN_LIST) == 0) + if ((tbFlag & TextureBin.ON_RENDER_BIN_LIST) == 0) return; // if any of the texture reference in the appearance referenced // by a sole user TextureBin is being modified, just do a reset - if (((tbFlag & TextureBin.SOLE_USER) != 0) && - ((soleUserCompDirty & TextureBin.SOLE_USER_DIRTY_REF) != 0)) { + if (((tbFlag & TextureBin.SOLE_USER) != 0) && + ((soleUserCompDirty & TextureBin.SOLE_USER_DIRTY_REF) != 0)) { resetTextureState(app.texUnitState); return; - } + } if (texUnitState == null) { soleUserCompDirty = 0; @@ -646,7 +646,7 @@ class TextureBin extends Object implements ObjectUpdate { if (tus.mirror != null) { mirrorTUS = (TextureUnitStateRetained)tus.mirror; - + if (tus.texture != mirrorTUS.texture) { if (tus.texture != null) { tus.texture.decTextureBinRefCount(this); @@ -663,7 +663,7 @@ class TextureBin extends Object implements ObjectUpdate { tbFlag |= TextureBin.RESORT; } } - + if (mirrorTUS.texAttrs != null) { if (mirrorTUS.texAttrs.changedFrequent != 0) { @@ -671,11 +671,11 @@ class TextureBin extends Object implements ObjectUpdate { } else { if (tus.texAttrs == null || tus.texAttrs.source != null) { - tus.texAttrs = + tus.texAttrs = new TextureAttributesRetained(); } tus.texAttrs.set(mirrorTUS.texAttrs); - tus.texAttrs.mirrorCompDirty = true; + tus.texAttrs.mirrorCompDirty = true; if (soleUser) { tus.texAttrs.mirror = mirrorTUS.texAttrs; @@ -686,19 +686,19 @@ class TextureBin extends Object implements ObjectUpdate { } else { tus.texAttrs = null; } - + if (mirrorTUS.texGen != null) { if (mirrorTUS.texGen.changedFrequent != 0) { tus.texGen = mirrorTUS.texGen; } else { if (tus.texGen == null || tus.texGen.source != null) { - tus.texGen = + tus.texGen = new TexCoordGenerationRetained(); } tus.texGen.set(mirrorTUS.texGen); tus.texGen.mirrorCompDirty = true; - + if (soleUser) { tus.texGen.mirror = mirrorTUS.texGen; } else { @@ -720,7 +720,7 @@ class TextureBin extends Object implements ObjectUpdate { soleUserCompDirty &= ~(TextureBin.SOLE_USER_DIRTY_TA | TextureBin.SOLE_USER_DIRTY_TC); - } + } if ((soleUserCompDirty & TextureBin.SOLE_USER_DIRTY_TEXTURE) != 0) { @@ -783,17 +783,17 @@ class TextureBin extends Object implements ObjectUpdate { public void updateObject() { if (!addOpaqueRMs.isEmpty()) { - opaqueRMList = addAll(opaqueRenderMoleculeMap, addOpaqueRMs, + opaqueRMList = addAll(opaqueRenderMoleculeMap, addOpaqueRMs, opaqueRMList, true); } if (!addTransparentRMs.isEmpty()) { - // If transparent and not in bg geometry and inodepth + // If transparent and not in bg geometry and inodepth // sorted transparency if (transparentRMList == null && (renderBin.transpSortMode == View.TRANSPARENCY_SORT_NONE || environmentSet.lightBin.geometryBackground != null)) { - // System.err.println("========> addTransparentTextureBin "+this); - transparentRMList = addAll(transparentRenderMoleculeMap, + // System.err.println("========> addTransparentTextureBin "+this); + transparentRMList = addAll(transparentRenderMoleculeMap, addTransparentRMs, transparentRMList, false); // Eventhough we are adding to transparentList , if all the RMS // have been switched already due to changeLists, then there is @@ -804,9 +804,9 @@ class TextureBin extends Object implements ObjectUpdate { } else { - transparentRMList = addAll(transparentRenderMoleculeMap, + transparentRMList = addAll(transparentRenderMoleculeMap, addTransparentRMs, transparentRMList, false); - } + } } tbFlag &= ~TextureBin.ON_UPDATE_LIST; @@ -823,24 +823,24 @@ class TextureBin extends Object implements ObjectUpdate { * to access another list and use rm.next to continue * until both rm.next and rm.nextMap are null. * - * renderMoleculeMap is use to assist faster location of + * renderMoleculeMap is use to assist faster location of * renderMolecule List with the same localToVWorld. The - * start of renderMolecule in the list with same + * start of renderMolecule in the list with same * localToVworld is insert in renderMoleculeMap. This * map is clean up at removeRenderMolecule(). TextureBin * also use the map for quick location of renderMolecule * with the same localToVworld and attributes in * findRenderMolecule(). */ - RenderMolecule addAll(HashMap renderMoleculeMap, HashMap addRMs, - RenderMolecule startList, + RenderMolecule addAll(HashMap renderMoleculeMap, HashMap addRMs, + RenderMolecule startList, boolean opaqueList) { int i; RenderMolecule r; Collection c = addRMs.values(); Iterator listIterator = c.iterator(); RenderMolecule renderMoleculeList, head; - + while (listIterator.hasNext()) { boolean changed = false; ArrayList curList = (ArrayList)listIterator.next(); @@ -875,10 +875,10 @@ class TextureBin extends Object implements ObjectUpdate { startList.nextMap.checkEquivalenceWithLeftNeighbor(r, RenderMolecule.ALL_DIRTY_BITS); } - + } else { - // Insert the renderMolecule next to a RM that has equivalent + // Insert the renderMolecule next to a RM that has equivalent // texture unit state if ((head = insertRenderMolecule(r, renderMoleculeList)) != null) { if (renderMoleculeList.prevMap != null) { @@ -921,12 +921,12 @@ class TextureBin extends Object implements ObjectUpdate { } else { startList = renderMoleculeList; - startList.dirtyAttrsAcrossRms = + startList.dirtyAttrsAcrossRms = RenderMolecule.ALL_DIRTY_BITS; } } } - + addRMs.clear(); return startList; } @@ -935,7 +935,7 @@ class TextureBin extends Object implements ObjectUpdate { // XXXX: Could the analysis be done during insertRenderMolecule? // Return the head of the list, // if the insertion occurred at beginning of the list - RenderMolecule insertRenderMolecule(RenderMolecule r, + RenderMolecule insertRenderMolecule(RenderMolecule r, RenderMolecule renderMoleculeList) { RenderMolecule rm, retval; @@ -991,13 +991,13 @@ class TextureBin extends Object implements ObjectUpdate { map = addOpaqueRMs; else map = addTransparentRMs; - + if ((list = (ArrayList)map.get(r.localToVworld)) == null) { list = new ArrayList(); map.put(r.localToVworld, list); } list.add(r); - + if ((tbFlag & TextureBin.ON_UPDATE_LIST) == 0) { tbFlag |= TextureBin.ON_UPDATE_LIST; rb.objUpdateList.add(this); @@ -1036,7 +1036,7 @@ class TextureBin extends Object implements ObjectUpdate { if (list.isEmpty()) { addMap.remove(r.localToVworld); } - + r.prev = null; r.next = null; found = true; @@ -1070,7 +1070,7 @@ class TextureBin extends Object implements ObjectUpdate { if (r.definingTransparency != null && (r.definingTransparency.changedFrequent != 0)) r.definingTransparency = null; - + renderBin.removeRenderMolecule(r); if (r.isOpaqueOrInOG) { opaqueRMList = head; @@ -1078,7 +1078,7 @@ class TextureBin extends Object implements ObjectUpdate { else { transparentRMList = head; } - + } // If the renderMolecule removed is not opaque then .. if (!r.isOpaqueOrInOG && transparentRMList == null && (renderBin.transpSortMode == View.TRANSPARENCY_SORT_NONE || @@ -1105,7 +1105,7 @@ class TextureBin extends Object implements ObjectUpdate { texUnitState = null; } } - + /** * This method is called to update the state for this * TextureBin. This is only applicable in the single-pass case. @@ -1122,7 +1122,7 @@ class TextureBin extends Object implements ObjectUpdate { } cv.textureBin = this; - + // save the current number of active texture unit so as // to be able to reset the one that is not enabled in this bin @@ -1180,18 +1180,18 @@ class TextureBin extends Object implements ObjectUpdate { if (j >= cv.texUnitState.length) { // We finish enabling the texture state. // Note that it is possible - // texUnitState.length > cv.texUnitState.length + // texUnitState.length > cv.texUnitState.length break; } if ((texUnitState[i] != null) && texUnitState[i].isTextureEnabled()) { - if (dirty || + if (dirty || cv.texUnitState[j].mirror == null || cv.texUnitState[j].mirror != texUnitState[i].mirror) { // update the texture unit state - texUnitState[i].updateNative(j, cv, false, false); + texUnitState[i].updateNative(j, cv, false, false); cv.texUnitState[j].mirror = texUnitState[i].mirror; } @@ -1200,11 +1200,11 @@ class TextureBin extends Object implements ObjectUpdate { lastActiveTexUnitIdx = j; } else { - if (j <= cv.getLastActiveTexUnit()) { + if (j <= cv.getLastActiveTexUnit()) { cv.resetTexture(cv.ctx, j); } } - + j++; } @@ -1239,7 +1239,7 @@ class TextureBin extends Object implements ObjectUpdate { /* System.err.println("TextureBin/render " + this + - " numActiveTexUnit= " + numActiveTexUnit + + " numActiveTexUnit= " + numActiveTexUnit + " maxTextureUnits= " + cv.maxTextureUnits); */ @@ -1280,17 +1280,17 @@ class TextureBin extends Object implements ObjectUpdate { /** - * render list of RenderMolecule + * render list of RenderMolecule */ void renderList(Canvas3D cv, int pass, RenderMolecule rlist) { assert pass < 0; - // bit mask of all attr fields that are equivalent across + // bit mask of all attr fields that are equivalent across // renderMolecules thro. ORing of invisible RMs. int combinedDirtyBits = 0; boolean rmVisible = true; RenderMolecule rm = rlist; - + while (rm != null) { if(rmVisible) { combinedDirtyBits = rm.dirtyAttrsAcrossRms; @@ -1300,7 +1300,7 @@ class TextureBin extends Object implements ObjectUpdate { } rmVisible = rm.render(cv, pass, combinedDirtyBits); - + // next render molecule or the nextmap if (rm.next == null) { @@ -1311,10 +1311,10 @@ class TextureBin extends Object implements ObjectUpdate { } } } - + /** - * render sorted transparent list + * render sorted transparent list */ void renderList(Canvas3D cv, int pass, TransparentRenderingInfo tinfo) { assert pass < 0; @@ -1344,7 +1344,7 @@ class TextureBin extends Object implements ObjectUpdate { rmlist = opaqueRMList; allMap = opaqueRenderMoleculeMap; } - + } else { if (transparentRMList == null && @@ -1380,7 +1380,7 @@ class TextureBin extends Object implements ObjectUpdate { } HashMap renderMoleculeMap; RenderMolecule startList; - + // Now insert in the other bin r.evalAlphaUsage(shaderBin.attributeBin.definingRenderingAttributes, texUnitState); r.isOpaqueOrInOG = r.isOpaque() ||r.inOrderedGroup; @@ -1396,7 +1396,7 @@ class TextureBin extends Object implements ObjectUpdate { renderBin.transpSortMode != View.TRANSPARENCY_SORT_NONE) { renderBin.addDisplayListResourceFreeList(r); renderBin.removeDirtyRenderMolecule(r); - + r.vwcBounds.set(null); r.displayListId = 0; r.displayListIdObj = null; @@ -1422,10 +1422,10 @@ class TextureBin extends Object implements ObjectUpdate { else { markDlistAsDirty(r); } - + } renderMoleculeList = (RenderMolecule)renderMoleculeMap.get(r.localToVworld); - + if (renderMoleculeList == null) { renderMoleculeList = r; renderMoleculeMap.put(r.localToVworld, renderMoleculeList); @@ -1446,7 +1446,7 @@ class TextureBin extends Object implements ObjectUpdate { startList.dirtyAttrsAcrossRms = RenderMolecule.ALL_DIRTY_BITS; } else { - // Insert the renderMolecule next to a RM that has equivalent + // Insert the renderMolecule next to a RM that has equivalent // texture unit state if ((head = insertRenderMolecule(r, renderMoleculeList)) != null) { if (renderMoleculeList.prevMap != null) { @@ -1525,7 +1525,7 @@ class TextureBin extends Object implements ObjectUpdate { // Update the maps and remove this entry from the map list else if (r.prev == null && r.next == null) { if (r.prevMap != null) { - r.prevMap.nextMap = r.nextMap; + r.prevMap.nextMap = r.nextMap; } else { @@ -1539,9 +1539,9 @@ class TextureBin extends Object implements ObjectUpdate { if (r.prevMap != null) { r.nextMap.checkEquivalenceWithLeftNeighbor(r.prevMap,RenderMolecule.ALL_DIRTY_BITS); } - + } - + allMap.remove(r.localToVworld); @@ -1590,7 +1590,7 @@ class TextureBin extends Object implements ObjectUpdate { shaderBin.incrActiveTextureBin(); } - + numEditingRenderMolecules++; } } diff --git a/src/classes/share/javax/media/j3d/TextureCubeMap.java b/src/classes/share/javax/media/j3d/TextureCubeMap.java index bca8144..2a36943 100644 --- a/src/classes/share/javax/media/j3d/TextureCubeMap.java +++ b/src/classes/share/javax/media/j3d/TextureCubeMap.java @@ -46,7 +46,7 @@ import javax.vecmath.*; * * The TextureCubeMap image is defined by specifying the images for each * face of the cube. The cube map texture can be thought of as centered at - * the orgin of and aligned to an XYZ coordinate system. The names + * the orgin of and aligned to an XYZ coordinate system. The names * of the cube faces are: * * <UL> @@ -56,7 +56,7 @@ import javax.vecmath.*; * <LI>NEGATIVE_Y</LI> * <LI>POSITIVE_Z</LI> * <LI>NEGATIVE_Z</LI> - * </UL> + * </UL> * * <p> * Note that as of Java 3D 1.5, the texture width and height are no longer @@ -74,39 +74,39 @@ public class TextureCubeMap extends Texture { // TODO KCR : NPOT /** - * Specifies the face of the cube that is pierced by the positive x axis + * Specifies the face of the cube that is pierced by the positive x axis */ public static final int POSITIVE_X = 0; /** - * Specifies the face of the cube that is pierced by the negative x axis + * Specifies the face of the cube that is pierced by the negative x axis */ public static final int NEGATIVE_X = 1; - + /** - * Specifies the face of the cube that is pierced by the positive y axis + * Specifies the face of the cube that is pierced by the positive y axis */ public static final int POSITIVE_Y = 2; /** - * Specifies the face of the cube that is pierced by the negative y axis + * Specifies the face of the cube that is pierced by the negative y axis */ public static final int NEGATIVE_Y = 3; /** - * Specifies the face of the cube that is pierced by the positive z axis + * Specifies the face of the cube that is pierced by the positive z axis */ public static final int POSITIVE_Z = 4; - + /** - * Specifies the face of the cube that is pierced by the negative z axis + * Specifies the face of the cube that is pierced by the negative z axis */ public static final int NEGATIVE_Z = 5; /** * Constructs a texture object using default values. - * Note that the default constructor creates a texture object with + * Note that the default constructor creates a texture object with * a width of 0 and is, therefore, not useful. */ public TextureCubeMap() { @@ -115,12 +115,12 @@ public class TextureCubeMap extends Texture { /** * Constructs an empty TextureCubeMap object with specified mipmapMode - * format, and width. Image at base level - * must be set by + * format, and width. Image at base level + * must be set by * the application using 'setImage' method. If mipmapMode is * set to MULTI_LEVEL_MIPMAP, images for base level through maximum level * must be set. - * Note that cube map is square in dimensions, hence specifying width + * Note that cube map is square in dimensions, hence specifying width * is sufficient. * Note also that a texture with a non-power-of-two width will * only be rendered on a graphics device that supports non-power-of-two @@ -144,12 +144,12 @@ public class TextureCubeMap extends Texture { /** * Constructs an empty TextureCubeMap object with specified mipmapMode - * format, width, and boundary width. Image at base level - * must be set by + * format, width, and boundary width. Image at base level + * must be set by * the application using 'setImage' method. If mipmapMode is * set to MULTI_LEVEL_MIPMAP, images for base level through maximum level * must be set. - * Note that cube map is square in dimensions, hence specifying width + * Note that cube map is square in dimensions, hence specifying width * is sufficient. * Note also that a texture with a non-power-of-two width will * only be rendered on a graphics device that supports non-power-of-two @@ -180,15 +180,15 @@ public class TextureCubeMap extends Texture { * of the cube map * * @param level mipmap level - * @param face face of the cube map. One of: - * <code>POSITIVE_X</code>, <code>NEGATIVE_X</code>, + * @param face face of the cube map. One of: + * <code>POSITIVE_X</code>, <code>NEGATIVE_X</code>, * <code>POSITIVE_Y</code>, <code>NEGATIVE_Y</code>, * <code>POSITIVE_Z</code> or <code>NEGATIVE_Z</code>. * @param image ImageComponent2D object containing the image * - * @exception IllegalArgumentException if + * @exception IllegalArgumentException if * <code>face</code> has a value other - * than <code>POSITIVE_X</code>, <code>NEGATIVE_X</code>, + * than <code>POSITIVE_X</code>, <code>NEGATIVE_X</code>, * <code>POSITIVE_Y</code>, <code>NEGATIVE_Y</code>, * <code>POSITIVE_Z</code> or <code>NEGATIVE_Z</code>. * @@ -208,9 +208,9 @@ public class TextureCubeMap extends Texture { throw new CapabilityNotSetException( J3dI18N.getString("TextureCubeMap1")); } - + validateImageIllegalSharing(image); - + if (isLive()) ((TextureCubeMapRetained)this.retained).setImage(level, face, image); else @@ -221,15 +221,15 @@ public class TextureCubeMap extends Texture { * Sets the array of images for mipmap levels from base level through * max level for a specified face of the cube map * - * @param face face of the cube map. One of: - * <code>POSITIVE_X</code>, <code>NEGATIVE_X</code>, + * @param face face of the cube map. One of: + * <code>POSITIVE_X</code>, <code>NEGATIVE_X</code>, * <code>POSITIVE_Y</code>, <code>NEGATIVE_Y</code>, * <code>POSITIVE_Z</code> or <code>NEGATIVE_Z</code>. * @param images array of ImageComponent2D objects containing the images * - * @exception IllegalArgumentException if + * @exception IllegalArgumentException if * <code>face</code> has a value other - * than <code>POSITIVE_X</code>, <code>NEGATIVE_X</code>, + * than <code>POSITIVE_X</code>, <code>NEGATIVE_X</code>, * <code>POSITIVE_Y</code>, <code>NEGATIVE_Y</code>, * <code>POSITIVE_Z</code> or <code>NEGATIVE_Z</code>. * @@ -252,11 +252,11 @@ public class TextureCubeMap extends Texture { J3dI18N.getString("TextureCubeMap1")); } - // Do illegal sharing check + // Do illegal sharing check for(int i=0; i<images.length; i++) { validateImageIllegalSharing(images[i]); } - + if (isLive()) ((TextureCubeMapRetained)this.retained).setImages(face, images); else @@ -269,16 +269,16 @@ public class TextureCubeMap extends Texture { * Retrieves the image for a specified mipmap level of a particular * face of the cube map. * @param level mipmap level to get. - * @param face face of the cube map. One of: - * <code>POSITIVE_X</code>, <code>NEGATIVE_X</code>, + * @param face face of the cube map. One of: + * <code>POSITIVE_X</code>, <code>NEGATIVE_X</code>, * <code>POSITIVE_Y</code>, <code>NEGATIVE_Y</code>, * <code>POSITIVE_Z</code> or <code>NEGATIVE_Z</code>. * @return the ImageComponent object containing the texture image at * the specified mipmap level. * - * @exception IllegalArgumentException if + * @exception IllegalArgumentException if * <code>face</code> has a value other - * than <code>POSITIVE_X</code>, <code>NEGATIVE_X</code>, + * than <code>POSITIVE_X</code>, <code>NEGATIVE_X</code>, * <code>POSITIVE_Y</code>, <code>NEGATIVE_Y</code>, * <code>POSITIVE_Z</code> or <code>NEGATIVE_Z</code>. * @@ -305,9 +305,9 @@ public class TextureCubeMap extends Texture { * @return an array of ImageComponent object for the particular face of * of the cube map. * - * @exception IllegalArgumentException if + * @exception IllegalArgumentException if * <code>face</code> has a value other - * than <code>POSITIVE_X</code>, <code>NEGATIVE_X</code>, + * than <code>POSITIVE_X</code>, <code>NEGATIVE_X</code>, * <code>POSITIVE_Y</code>, <code>NEGATIVE_Y</code>, * <code>POSITIVE_Z</code> or <code>NEGATIVE_Z</code>. * diff --git a/src/classes/share/javax/media/j3d/TextureCubeMapRetained.java b/src/classes/share/javax/media/j3d/TextureCubeMapRetained.java index d9fda1f..7d8bb26 100644 --- a/src/classes/share/javax/media/j3d/TextureCubeMapRetained.java +++ b/src/classes/share/javax/media/j3d/TextureCubeMapRetained.java @@ -45,8 +45,8 @@ class TextureCubeMapRetained extends TextureRetained { static final int NUMFACES = 6; - void initialize(int format, int width, int widPower, - int height, int heiPower, int mipmapMode, + void initialize(int format, int width, int widPower, + int height, int heiPower, int mipmapMode, int boundaryWidth) { this.numFaces = 6; @@ -67,7 +67,7 @@ class TextureCubeMapRetained extends TextureRetained { if (this.images == null) { throw new IllegalArgumentException( J3dI18N.getString("TextureRetained0")); - } + } if (image instanceof ImageComponent3D) { throw new IllegalArgumentException( @@ -86,7 +86,7 @@ class TextureCubeMapRetained extends TextureRetained { this.images[face][level].clearLive(refCount); } - + if (image != null) { ((ImageComponentRetained)image.retained).setLive( inBackgroundGroup, refCount); @@ -96,7 +96,7 @@ class TextureCubeMapRetained extends TextureRetained { /* Don't think this is needed. --- Chien. ((ImageComponent2DRetained)image.retained).setTextureRef(); */ - + if (image != null) { this.images[face][level] = (ImageComponentRetained)image.retained; } else { @@ -130,7 +130,7 @@ class TextureCubeMapRetained extends TextureRetained { enable = false; } } - if (!enable) + if (!enable) sendMessage(ENABLE_CHANGED, Boolean.FALSE); } } @@ -189,7 +189,7 @@ class TextureCubeMapRetained extends TextureRetained { } } - + /** @@ -206,7 +206,7 @@ class TextureCubeMapRetained extends TextureRetained { J3dI18N.getString("TextureCubeMap4")); } - return (((images != null) && (images[face][level] != null)) ? + return (((images != null) && (images[face][level] != null)) ? (ImageComponent)images[face][level].source : null); } @@ -307,12 +307,12 @@ class TextureCubeMapRetained extends TextureRetained { // All faces should have the same image format and type. int imageFormat = images[0][0].getImageFormatTypeIntValue(false); int imageType = images[0][0].getImageDataTypeIntValue(); - + for (int i = 0; i < 6; i++) { updateTextureImage(cv, i, maxLevels, 0, format, imageFormat, width, height, boundaryWidth, - imageType, null); + imageType, null); } } } @@ -324,7 +324,7 @@ class TextureCubeMapRetained extends TextureRetained { int width, int height, int boundaryWidth, int imageDataType, Object imageData) { - + Pipeline.getPipeline().updateTextureCubeMapImage(cv.ctx, face, numLevels, level, textureFormat, imageFormat, @@ -340,7 +340,7 @@ class TextureCubeMapRetained extends TextureRetained { int imgXOffset, int imgYOffset, int tilew, int width, int height, int imageDataType, Object imageData) { - + Pipeline.getPipeline().updateTextureCubeMapSubImage(cv.ctx, face, level, xoffset, yoffset, textureFormat, imageFormat, diff --git a/src/classes/share/javax/media/j3d/TextureRetained.java b/src/classes/share/javax/media/j3d/TextureRetained.java index 6460e8b..ed8e0dc 100644 --- a/src/classes/share/javax/media/j3d/TextureRetained.java +++ b/src/classes/share/javax/media/j3d/TextureRetained.java @@ -39,7 +39,7 @@ import java.awt.image.RenderedImage; /** * The Texture object is a component object of an Appearance object * that defines the texture properties used when texture mapping is - * enabled. Texture object is an abstract class and all texture + * enabled. Texture object is an abstract class and all texture * objects must be created as either a Texture2D object or a * Texture3D object. */ @@ -73,7 +73,7 @@ abstract class TextureRetained extends NodeComponentRetained { int minFilter = Texture.BASE_LEVEL_POINT; int magFilter = Texture.BASE_LEVEL_POINT; - // Integer flag that contains bitset to indicate + // Integer flag that contains bitset to indicate // which field changed. int isDirty = 0xffff; @@ -83,20 +83,20 @@ abstract class TextureRetained extends NodeComponentRetained { // Texture Object Id used by native code. int objectId = -1; - int mipmapMode = Texture.BASE_LEVEL; // Type of mip-mapping + int mipmapMode = Texture.BASE_LEVEL; // Type of mip-mapping int format = Texture.RGB; // Texture format int width = 1; // Width in pixels (2**n) int height = 1; // Height in pixels (2**m) - // true if width or height is non power of two - private boolean widthOrHeightIsNPOT = false; - // Array of images (one for each mipmap level) + // true if width or height is non power of two + private boolean widthOrHeightIsNPOT = false; + // Array of images (one for each mipmap level) ImageComponentRetained images[][]; // maximum number of levels needed for the mipmapMode of this texture - int maxLevels = 0; + int maxLevels = 0; // maximum number of mipmap levels that can be defined for this texture private int maxMipMapLevels = 0; - + int numFaces = 1; // For CubeMap, it is 6 int baseLevel = 0; int maximumLevel = 0; @@ -122,8 +122,8 @@ abstract class TextureRetained extends NodeComponentRetained { int numSharpenTextureFuncPts = 0; float sharpenTextureFuncPts[] = null; // array of pairs of floats // first value for LOD - // second value for the fcn value - + // second value for the fcn value + // filter4 info float filter4FuncPts[] = null; @@ -146,24 +146,24 @@ abstract class TextureRetained extends NodeComponentRetained { // 0 at a particular bit means texture images are not up-to-date. // 1 means otherwise. If it specifies 0, then it needs to go // through the imageUpdateInfo to update the images accordingly. - // - int resourceUpdatedMask = 0x0; + // + int resourceUpdatedMask = 0x0; // Each bit corresponds to a unique renderer if shared context // or a unique canvas otherwise // This mask specifies if texture lod info is up-to-date. // 0 at a particular bit means texture lod info is not up-to-date. - // 1 means otherwise. - // - int resourceLodUpdatedMask = 0x0; + // 1 means otherwise. + // + int resourceLodUpdatedMask = 0x0; // Each bit corresponds to a unique renderer if shared context // or a unique canvas otherwise // This mask specifies if texture is in the resource reload list // 0 at a particular bit means texture is not in reload list - // 1 means otherwise. - // - int resourceInReloadList = 0x0; + // 1 means otherwise. + // + int resourceInReloadList = 0x0; // image update info ArrayList imageUpdateInfo[][]; @@ -181,18 +181,18 @@ abstract class TextureRetained extends NodeComponentRetained { // This is used for D3D only to check whether texture need to // resend down private int texTimestamp = 0; - - // need to synchronize access from multiple rendering threads + + // need to synchronize access from multiple rendering threads Object resourceLock = new Object(); private static boolean isPowerOfTwo(int val) { return ((val & (val - 1)) == 0); } - - void initialize(int format, int width, int widLevels, + + void initialize(int format, int width, int widLevels, int height, int heiLevels, int mipmapMode, int boundaryWidth) { - + this.mipmapMode = mipmapMode; this.format = format; this.width = width; @@ -202,7 +202,7 @@ abstract class TextureRetained extends NodeComponentRetained { if(!isPowerOfTwo(width) || !isPowerOfTwo(height)) { this.widthOrHeightIsNPOT = true; } - + // determine the maximum number of mipmap levels that can be // defined from the specified dimension @@ -225,7 +225,7 @@ abstract class TextureRetained extends NodeComponentRetained { maximumLevel = 0; maxLevels = 1; } - + images = new ImageComponentRetained[numFaces][maxLevels]; for (int j = 0; j < numFaces; j++) { @@ -306,7 +306,7 @@ abstract class TextureRetained extends NodeComponentRetained { * function is used when the pixel being rendered maps to an area * greater than one texel. * @param minFilter the minification filter, one of: - * FASTEST, NICEST, BASE_LEVEL_POINT, BASE_LEVEL_LINEAR, + * FASTEST, NICEST, BASE_LEVEL_POINT, BASE_LEVEL_LINEAR, * MULTI_LEVEL_POINT, MULTI_LEVEL_LINEAR. * @exception RestrictedAccessException if the method is called * when this object is part of live or compiled scene graph. @@ -365,7 +365,7 @@ abstract class TextureRetained extends NodeComponentRetained { if (this.images == null) { throw new IllegalArgumentException(J3dI18N.getString("TextureRetained0")); - } + } if (this.source instanceof Texture2D) { if (image instanceof ImageComponent3D) @@ -385,7 +385,7 @@ abstract class TextureRetained extends NodeComponentRetained { this.images[0][level].clearLive(refCount); } - + if (image != null) { ((ImageComponentRetained)image.retained).setLive(inBackgroundGroup, refCount); } @@ -413,7 +413,7 @@ abstract class TextureRetained extends NodeComponentRetained { if (wdh < 1) wdh = 1; if (hgt < 1) hgt = 1; - + if ((wdh != (imgWidth - 2*boundaryWidth)) || (hgt != (imgHeight - 2*boundaryWidth))) { throw new IllegalArgumentException( @@ -434,7 +434,7 @@ abstract class TextureRetained extends NodeComponentRetained { for (int level = 0; level < images.length; level++) { int imgWidth = images[level].width; int imgHeight = images[level].height; - + assert (wdh == (imgWidth - 2*boundaryWidth)) && (hgt == (imgHeight - 2*boundaryWidth)); @@ -472,7 +472,7 @@ abstract class TextureRetained extends NodeComponentRetained { enable = false; } } - if (!enable) + if (!enable) sendMessage(ENABLE_CHANGED, Boolean.FALSE); } } @@ -512,7 +512,7 @@ abstract class TextureRetained extends NodeComponentRetained { enable = userSpecifiedEnable; for (i = baseLevel; i <= maximumLevel && enable; i++) { if (images[i] != null) { - ImageComponentRetained img= + ImageComponentRetained img= (ImageComponentRetained)images[i].retained; if (img.isByReference()) { if (img.getRefImage(0) == null) { @@ -532,7 +532,7 @@ abstract class TextureRetained extends NodeComponentRetained { } } - + /** @@ -543,7 +543,7 @@ abstract class TextureRetained extends NodeComponentRetained { * when this object is part of live or compiled scene graph. */ final ImageComponent getImage(int level) { - return (((images != null) && (images[0][level] != null)) ? + return (((images != null) && (images[0][level] != null)) ? (ImageComponent)images[0][level].source : null); } @@ -562,14 +562,14 @@ abstract class TextureRetained extends NodeComponentRetained { } /** - * Sets mipmap mode for texture mapping for this texture object. + * Sets mipmap mode for texture mapping for this texture object. * @param mipMapMode the new mipmap mode for this object. One of: * BASE_LEVEL or MULTI_LEVEL_MIPMAP. * @exception RestrictedAccessException if the method is called */ final void initMipMapMode(int mipmapMode) { - if (this.mipmapMode == mipmapMode) + if (this.mipmapMode == mipmapMode) return; @@ -584,9 +584,9 @@ abstract class TextureRetained extends NodeComponentRetained { maximumLevel = 0; maxLevels = 1; } - - ImageComponentRetained[][] newImages = + + ImageComponentRetained[][] newImages = new ImageComponentRetained[numFaces][maxLevels]; if (prevMaxLevels < maxLevels) { @@ -594,7 +594,7 @@ abstract class TextureRetained extends NodeComponentRetained { for (int i = 0; i < prevMaxLevels; i++) { newImages[f][i] = images[f][i]; } - + for (int j = prevMaxLevels; j < maxLevels; j++) { newImages[f][j] = null; } @@ -628,7 +628,7 @@ abstract class TextureRetained extends NodeComponentRetained { /** * Enables or disables texture mapping for this - * appearance component object and sends a + * appearance component object and sends a * message notifying the interested structures of the change. * @param state true or false to enable or disable texture mapping */ @@ -642,7 +642,7 @@ abstract class TextureRetained extends NodeComponentRetained { // because one of the images is null and user specifies false return; } - + enable = state; for (int j = 0; j < numFaces && enable; j++) { @@ -700,10 +700,10 @@ abstract class TextureRetained extends NodeComponentRetained { J3dI18N.getString("Texture37")); } if((mipmapMode == Texture.BASE_LEVEL) && (level != 0)) { - throw new IllegalArgumentException( + throw new IllegalArgumentException( J3dI18N.getString("Texture48")); } - + maximumLevel = level; } @@ -810,7 +810,7 @@ abstract class TextureRetained extends NodeComponentRetained { boundaryColor.set(this.boundaryColor); } - + /** * Set Anisotropic Filter */ @@ -1025,7 +1025,7 @@ abstract class TextureRetained extends NodeComponentRetained { if (!enable) sendMessage(ENABLE_CHANGED, Boolean.FALSE); } - + super.markAsLive(); } @@ -1107,7 +1107,7 @@ abstract class TextureRetained extends NodeComponentRetained { } - // get an ID for Texture 2D + // get an ID for Texture 2D int getTextureId() { return (VirtualUniverse.mc.getTexture2DId()); } @@ -1130,17 +1130,17 @@ abstract class TextureRetained extends NodeComponentRetained { } return enable; } - - + + // bind a named texture to a texturing target void bindTexture(Canvas3D cv) { - + synchronized(resourceLock) { if (objectId == -1) { objectId = getTextureId(); } cv.addTextureResource(objectId, this); - } + } bindTexture(cv.ctx, objectId, isEnabled(cv)); } @@ -1157,12 +1157,12 @@ abstract class TextureRetained extends NodeComponentRetained { images[0][0].getImageDataTypeIntValue(), null); } } - + void updateTextureLOD(Canvas3D cv) { if ((cv.textureExtendedFeatures & Canvas3D.TEXTURE_LOD_RANGE) != 0 ) { - + int max = 0; if( mipmapMode == Texture.BASE_LEVEL ) { max = maxMipMapLevels; @@ -1170,7 +1170,7 @@ abstract class TextureRetained extends NodeComponentRetained { else { max = maximumLevel; } - + updateTextureLodRange(cv.ctx, baseLevel, max, minimumLod, maximumLod); } @@ -1194,7 +1194,7 @@ abstract class TextureRetained extends NodeComponentRetained { int magnificationFilter = magFilter; int minificationFilter = minFilter; - + // update sharpen texture function if applicable if ((magnificationFilter >= Texture.LINEAR_SHARPEN) && @@ -1204,7 +1204,7 @@ abstract class TextureRetained extends NodeComponentRetained { // send down sharpen texture LOD function // - updateTextureSharpenFunc(cv.ctx, + updateTextureSharpenFunc(cv.ctx, numSharpenTextureFuncPts, sharpenTextureFuncPts); } else { @@ -1223,7 +1223,7 @@ abstract class TextureRetained extends NodeComponentRetained { magnificationFilter = Texture.BASE_LEVEL_LINEAR; } - } + } if (minificationFilter == Texture.FILTER4 || magnificationFilter == Texture.FILTER4) { @@ -1233,7 +1233,7 @@ abstract class TextureRetained extends NodeComponentRetained { if (filter4FuncPts == null) { - // filter4 function is not defined, + // filter4 function is not defined, // fallback to BASE_LEVEL_LINEAR noFilter4 = true; @@ -1247,7 +1247,7 @@ abstract class TextureRetained extends NodeComponentRetained { // library, fallback to BASE_LEVEL_LINEAR noFilter4 = true; - } + } if (noFilter4) { if (minificationFilter == Texture.FILTER4) { @@ -1262,7 +1262,7 @@ abstract class TextureRetained extends NodeComponentRetained { // Fallback to BASE mode if hardware mipmap generation is not supported. if ((mipmapMode == Texture.BASE_LEVEL) && ((cv.textureExtendedFeatures & Canvas3D.TEXTURE_AUTO_MIPMAP_GENERATION) == 0)) { - + if (minificationFilter == Texture.NICEST || minificationFilter == Texture.MULTI_LEVEL_LINEAR) { minificationFilter = Texture.BASE_LEVEL_LINEAR; @@ -1270,12 +1270,12 @@ abstract class TextureRetained extends NodeComponentRetained { minificationFilter = Texture.BASE_LEVEL_POINT; } } - + // update texture filtering modes - updateTextureFilterModes(cv.ctx, minificationFilter, + updateTextureFilterModes(cv.ctx, minificationFilter, magnificationFilter); - if ((cv.textureExtendedFeatures & Canvas3D.TEXTURE_ANISOTROPIC_FILTER) + if ((cv.textureExtendedFeatures & Canvas3D.TEXTURE_ANISOTROPIC_FILTER) != 0) { if (anisotropicFilterMode == Texture.ANISOTROPIC_NONE) { updateTextureAnisotropicFilter(cv.ctx, 1.0f); @@ -1287,7 +1287,7 @@ abstract class TextureRetained extends NodeComponentRetained { // update texture boundary modes, boundary color updateTextureBoundary(cv); - + } @@ -1299,7 +1299,7 @@ abstract class TextureRetained extends NodeComponentRetained { int width, int height, int boundaryWidth, int imageDataType, Object data) { - + Pipeline.getPipeline().updateTexture2DImage(cv.ctx, numLevels, level, textureFormat, imageFormat, @@ -1316,7 +1316,7 @@ abstract class TextureRetained extends NodeComponentRetained { int imgXOffset, int imgYOffset, int tilew, int width, int height, int imageDataType, Object data) { - + Pipeline.getPipeline().updateTexture2DSubImage(cv.ctx, level, xoffset, yoffset, textureFormat, imageFormat, @@ -1324,7 +1324,7 @@ abstract class TextureRetained extends NodeComponentRetained { tilew, width, height, imageDataType, data, useAutoMipMapGeneration(cv)); } - + /** * reloadTextureImage is used to load a particular level of image @@ -1333,24 +1333,24 @@ abstract class TextureRetained extends NodeComponentRetained { */ void reloadTextureImage(Canvas3D cv, int face, int level, ImageComponentRetained image, int numLevels) { - + boolean useAsRaster = isUseAsRaster(); ImageComponentRetained.ImageData imageData = image.getImageData(useAsRaster); assert imageData != null; - + updateTextureImage(cv, face, numLevels, level, format, image.getImageFormatTypeIntValue(useAsRaster), imageData.getWidth(), imageData.getHeight(), boundaryWidth, image.getImageDataTypeIntValue(), imageData.get()); - - + + // TODO : Dead code - need to clean up for 1.6 // Now take care of the RenderedImage (byRef and yUp) case. Note, if image // is a RenderedImage ( byRef and yUp), then imageData will be null - + if (imageData == null) { // System.err.println("==========. subImage"); // Download all the tiles for this texture @@ -1365,7 +1365,7 @@ abstract class TextureRetained extends NodeComponentRetained { if (tmpw < curw) { curw = tmpw; } - + if (tmph < curh) { curh = tmph; } @@ -1393,7 +1393,7 @@ abstract class TextureRetained extends NodeComponentRetained { xoffset += curw; imageXOffset = 0; tmpw -= curw; - if (tmpw < image.tilew) + if (tmpw < image.tilew) curw = tmpw; else curw = image.tilew; @@ -1415,7 +1415,7 @@ abstract class TextureRetained extends NodeComponentRetained { * This method needs to take care of RenderedImage as well as * BufferedImage */ - void reloadTextureSubImage(Canvas3D cv, int face, int level, + void reloadTextureSubImage(Canvas3D cv, int face, int level, ImageComponentUpdateInfo info, ImageComponentRetained image) { @@ -1423,7 +1423,7 @@ abstract class TextureRetained extends NodeComponentRetained { y = info.y, width = info.width, height = info.height; - + //The x and y here specifies the subregion of the imageData of //the associated RenderedImage. @@ -1435,12 +1435,12 @@ abstract class TextureRetained extends NodeComponentRetained { if(imageData != null) { int xoffset = x; int yoffset = y; - + // TODO Check this logic : If !yUp adjust yoffset if (!image.yUp) { yoffset = image.height - yoffset - height; } - + updateTextureSubImage(cv, face, level, xoffset, yoffset, format, image.getImageFormatTypeIntValue(false), @@ -1448,11 +1448,11 @@ abstract class TextureRetained extends NodeComponentRetained { image.width, width, height, image.getImageDataTypeIntValue(), imageData.get()); - + } else { assert false; - + // TODO : Dead code - need to clean up for 1.6 // System.err.println("RenderedImage subImage update"); // determine the first tile of the image @@ -1462,7 +1462,7 @@ abstract class TextureRetained extends NodeComponentRetained { int rx = x; int ry = y; - + mt = (float)(rx) / (float)image.tilew; if (mt < 0) { minTileX = (int)(mt - 1); @@ -1533,16 +1533,16 @@ abstract class TextureRetained extends NodeComponentRetained { java.awt.image.Raster ras; - int textureX = x; // x offset in the texture - int textureY = y; // y offset in the texture + int textureX = x; // x offset in the texture + int textureY = y; // y offset in the texture for (int yTile = minTileY; yTile < minTileY + numYTiles; yTile++) { - + tmpw = width; curw = startw; imgX = rx - startXTile; - + for (int xTile = minTileX; xTile < minTileX + numXTiles; xTile++) { ras = ((RenderedImage)image.getRefImage(0)).getTile(xTile, yTile); @@ -1552,7 +1552,7 @@ abstract class TextureRetained extends NodeComponentRetained { textureX, textureY, format, image.getImageFormatTypeIntValue(false), imgX, imgY, - image.tilew, curw, curh, + image.tilew, curw, curh, ImageComponentRetained.IMAGE_DATA_TYPE_BYTE_ARRAY, (Object)data); @@ -1568,7 +1568,7 @@ abstract class TextureRetained extends NodeComponentRetained { curw = tmpw; } else { curw = image.tilew; - } + } } // move to the next set of tiles in y direction @@ -1608,8 +1608,8 @@ abstract class TextureRetained extends NodeComponentRetained { if (blevel != 0) { // level 0 is not the base level, hence, need - // to load level 0 explicitly with a null pointer in order - // for mipmapping to be active. + // to load level 0 explicitly with a null pointer in order + // for mipmapping to be active. updateTextureDimensions(cv); } @@ -1641,7 +1641,7 @@ abstract class TextureRetained extends NodeComponentRetained { ImageComponentUpdateInfo info; - for (int k = 0; k < numFaces; k++) { + for (int k = 0; k < numFaces; k++) { for (int i = baseLevel; i <= maximumLevel; i++) { if (imageUpdateInfo[k][i] != null) { for (int j = 0; j < imageUpdateInfo[k][i].size(); j++) { @@ -1664,15 +1664,15 @@ abstract class TextureRetained extends NodeComponentRetained { // all the current resources have updated this // info, so this info can be removed from the // update list - if ((info.updateMask & resourceCreationMask) + if ((info.updateMask & resourceCreationMask) == 0) { info.updateMask = 0; // mark this update as // done // mark the prune flag so as to prune the - // update list next time when the update + // update list next time when the update // list is to be modified. - // Don't want to clean up the list at + // Don't want to clean up the list at // rendering time because (1) MT issue, // other renderer could be processing // the update list now; @@ -1685,7 +1685,7 @@ abstract class TextureRetained extends NodeComponentRetained { } if (info.entireImage == true) { - reloadTextureImage(cv, k, i, + reloadTextureImage(cv, k, i, images[k][i], maxLevels); } else { reloadTextureSubImage(cv, k, i, info, images[k][i]); @@ -1715,7 +1715,7 @@ abstract class TextureRetained extends NodeComponentRetained { } bindTexture(cv); - + // reload all levels of texture image // update texture parameters such as boundary modes, filtering @@ -1740,9 +1740,9 @@ abstract class TextureRetained extends NodeComponentRetained { } } - + /** - * updateNative is called while traversing the RenderBin to + * updateNative is called while traversing the RenderBin to * update the texture state */ void updateNative(Canvas3D cv) { @@ -1753,7 +1753,7 @@ abstract class TextureRetained extends NodeComponentRetained { //System.err.println("Texture/updateNative: " + this + "object= " + objectId + " enable= " + enable); bindTexture(cv); - + // if texture is not enabled, don't bother downloading the // the texture state @@ -1766,8 +1766,8 @@ abstract class TextureRetained extends NodeComponentRetained { if ((resourceCreationMask & cv.screen.renderer.rendererBit) == 0) { reloadTexture = true; } else { - if (((resourceUpdatedMask & - cv.screen.renderer.rendererBit) == 0) && + if (((resourceUpdatedMask & + cv.screen.renderer.rendererBit) == 0) && (imageUpdateInfo != null)) { updateTexture = true; } @@ -1785,7 +1785,7 @@ abstract class TextureRetained extends NodeComponentRetained { if ((resourceCreationMask & cv.canvasBit) == 0) { reloadTexture = true; } else { - if (((resourceUpdatedMask & cv.canvasBit) == 0) && + if (((resourceUpdatedMask & cv.canvasBit) == 0) && (imageUpdateInfo != null)) { updateTexture = true; } @@ -1795,7 +1795,7 @@ abstract class TextureRetained extends NodeComponentRetained { } } } - + if (VirtualUniverse.mc.isD3D()) { if (texTimestamp != VirtualUniverse.mc.resendTexTimestamp) { @@ -1811,12 +1811,12 @@ abstract class TextureRetained extends NodeComponentRetained { //System.err.println("......... reloadTexture= " + reloadTexture + -// " updateTexture= " + updateTexture + +// " updateTexture= " + updateTexture + // " updateTextureLod= " + updateTextureLod); //System.err.println("......... resourceCreationMask= " + resourceCreationMask + // " resourceUpdatedMask= " + resourceUpdatedMask); - + if (reloadTexture) { // reload all levels of texture image @@ -1933,7 +1933,7 @@ abstract class TextureRetained extends NodeComponentRetained { mirror.source = source; if (this instanceof Texture3DRetained) { Texture3DRetained t3d = (Texture3DRetained)this; - + ((Texture3DRetained)mirror).boundaryModeR = t3d.boundaryModeR; ((Texture3DRetained)mirror).depth = t3d.depth; } @@ -1969,11 +1969,11 @@ abstract class TextureRetained extends NodeComponentRetained { if ((mirrorTexture.sharpenTextureFuncPts == null) || (mirrorTexture.sharpenTextureFuncPts.length != sharpenTextureFuncPts.length)) { - mirrorTexture.sharpenTextureFuncPts = + mirrorTexture.sharpenTextureFuncPts = new float[sharpenTextureFuncPts.length]; } for (int i = 0; i < sharpenTextureFuncPts.length; i++) { - mirrorTexture.sharpenTextureFuncPts[i] = + mirrorTexture.sharpenTextureFuncPts[i] = sharpenTextureFuncPts[i]; } } @@ -2000,11 +2000,11 @@ abstract class TextureRetained extends NodeComponentRetained { mirrorTexture.maxLevels = maxLevels; if (images != null) { - + for (int j = 0; j < numFaces; j++) { for (int i = 0; i < maxLevels; i++) { mirrorTexture.images[j][i] = images[j][i]; - + // add texture to the userList of the images if (images[j][i] != null) { images[j][i].addUser(mirrorTexture); @@ -2015,18 +2015,18 @@ abstract class TextureRetained extends NodeComponentRetained { } boolean useAutoMipMapGeneration(Canvas3D cv) { - if (mipmapMode == Texture.BASE_LEVEL && + if (mipmapMode == Texture.BASE_LEVEL && (minFilter == Texture.NICEST || minFilter == Texture.MULTI_LEVEL_POINT || minFilter == Texture.MULTI_LEVEL_LINEAR) && ((cv.textureExtendedFeatures & Canvas3D.TEXTURE_AUTO_MIPMAP_GENERATION) != 0)) { return true; - } - - return false; + } + + return false; } - + /** * Go through the image update info list * and remove those that are already done @@ -2137,7 +2137,7 @@ abstract class TextureRetained extends NodeComponentRetained { } /** - * Update the "component" field of the mirror object with the + * Update the "component" field of the mirror object with the * given "value" */ synchronized void updateMirrorObject(int component, Object value) { @@ -2166,7 +2166,7 @@ abstract class TextureRetained extends NodeComponentRetained { mirrorTexture.images[face][level] = null; } else { - mirrorTexture.images[face][level] = + mirrorTexture.images[face][level] = (ImageComponentRetained)image.retained; mirrorTexture.images[face][level].addUser(mirror); @@ -2178,7 +2178,7 @@ abstract class TextureRetained extends NodeComponentRetained { // in the RenderBin itself in response to the // IMAGE_CHANGED message - + // mark that texture images need to be updated mirrorTexture.resourceUpdatedMask = 0; @@ -2186,30 +2186,30 @@ abstract class TextureRetained extends NodeComponentRetained { mirrorTexture.addImageUpdateInfo(level, face, null); } else if ((component & IMAGES_CHANGED) != 0) { - + Object [] arg = (Object []) value; ImageComponent [] images = (ImageComponent[])arg[0]; int face = ((Integer)arg[1]).intValue(); - + for (int i = 0; i < images.length; i++) { - + // first remove texture from the userList of the current // referencing image if (mirrorTexture.images[face][i] != null) { mirrorTexture.images[face][i].removeUser(mirror); } - + // assign the new image and add texture to the userList if (images[i] == null) { mirrorTexture.images[face][i] = null; } else { - mirrorTexture.images[face][i] = + mirrorTexture.images[face][i] = (ImageComponentRetained)images[i].retained; mirrorTexture.images[face][i].addUser(mirror); } } mirrorTexture.updateResourceCreationMask(); - + // NOTE: the old images have to be removed from the // renderBins' NodeComponentList and new image have to be // added to the lists. This will be taken care of @@ -2218,10 +2218,10 @@ abstract class TextureRetained extends NodeComponentRetained { } else if ((component & BASE_LEVEL_CHANGED) != 0) { int level = ((Integer)value).intValue(); - + if (level < mirrorTexture.baseLevel) { - // add texture to the userList of those new levels of + // add texture to the userList of those new levels of // enabling images for (int j = 0; j < numFaces; j++) { @@ -2317,7 +2317,7 @@ abstract class TextureRetained extends NodeComponentRetained { } else if ((component & LOD_OFFSET_CHANGED) != 0) { if ((mirrorTexture.lodOffset) == null) { - mirrorTexture.lodOffset = + mirrorTexture.lodOffset = new Point3f((Point3f)value); } else { mirrorTexture.lodOffset.set((Point3f)value); @@ -2374,7 +2374,7 @@ abstract class TextureRetained extends NodeComponentRetained { // first find which texture image is being affected boolean done; - + for (int j = 0; j < numFaces; j++) { done = false; @@ -2396,12 +2396,12 @@ abstract class TextureRetained extends NodeComponentRetained { } } - + // reset the resourceCreationMask // Note: called from the mirror object only void updateResourceCreationMask() { - resourceCreationMask = 0x0; + resourceCreationMask = 0x0; } void incTextureBinRefCount(TextureBin tb) { @@ -2424,7 +2424,7 @@ abstract class TextureRetained extends NodeComponentRetained { // hence don't have source and therefore they are // guaranteed not modifiable - if (image != null && + if (image != null && (image.isByReference() || (image.source != null && image.source.getCapability( @@ -2446,7 +2446,7 @@ abstract class TextureRetained extends NodeComponentRetained { for (int j = 0; j < numFaces; j++) { for (int i = 0; i < maxLevels; i++) { image = images[j][i]; - if (image != null && + if (image != null && (image.isByReference() || (image.source != null && image.source.getCapability( @@ -2457,11 +2457,11 @@ abstract class TextureRetained extends NodeComponentRetained { } } - + final void sendMessage(int attrMask, Object attr) { ArrayList univList = new ArrayList(); - ArrayList gaList = Shape3DRetained.getGeomAtomsList(mirror.users, univList); + ArrayList gaList = Shape3DRetained.getGeomAtomsList(mirror.users, univList); // Send to rendering attribute structure, regardless of // whether there are users or not (alternate appearance case ..) @@ -2480,7 +2480,7 @@ abstract class TextureRetained extends NodeComponentRetained { createMessage = new J3dMessage(); createMessage.threads = J3dThread.UPDATE_RENDER; createMessage.type = J3dMessage.TEXTURE_CHANGED; - + createMessage.universe = (VirtualUniverse) univList.get(i); createMessage.args[0] = this; createMessage.args[1]= new Integer(attrMask); @@ -2490,7 +2490,7 @@ abstract class TextureRetained extends NodeComponentRetained { GeometryAtom[] gaArr = new GeometryAtom[gL.size()]; gL.toArray(gaArr); createMessage.args[3] = gaArr; - + VirtualUniverse.mc.processMessage(createMessage); } @@ -2507,11 +2507,11 @@ abstract class TextureRetained extends NodeComponentRetained { break; } } - + void setUseAsRaster(boolean useAsRaster) { this.useAsRaster = useAsRaster; } - + boolean isUseAsRaster() { return this.useAsRaster; } diff --git a/src/classes/share/javax/media/j3d/TextureUnitState.java b/src/classes/share/javax/media/j3d/TextureUnitState.java index 49372ef..6ef8935 100644 --- a/src/classes/share/javax/media/j3d/TextureUnitState.java +++ b/src/classes/share/javax/media/j3d/TextureUnitState.java @@ -89,7 +89,7 @@ public class TextureUnitState extends NodeComponent { private static final int[] readCapabilities = { ALLOW_STATE_READ }; - + /** * Constructs a TextureUnitState component object using defaults for all * state variables. All component object references are initialized @@ -165,7 +165,7 @@ public class TextureUnitState extends NodeComponent { // Do illegal sharing check if(texture != null) { - TextureRetained texRetained = (TextureRetained)texture.retained; + TextureRetained texRetained = (TextureRetained)texture.retained; ImageComponent[] images = texRetained.getImages(); if(images != null) { for(int i=0; i<images.length; i++) { @@ -173,7 +173,7 @@ public class TextureUnitState extends NodeComponent { } } } - + ((TextureUnitStateRetained)this.retained).setTextureUnitState( texture, textureAttributes, texCoordGeneration); } @@ -205,7 +205,7 @@ public class TextureUnitState extends NodeComponent { // Do illegal sharing check if(texture != null) { - TextureRetained texRetained = (TextureRetained)texture.retained; + TextureRetained texRetained = (TextureRetained)texture.retained; ImageComponent[] images = texRetained.getImages(); if(images != null) { for(int i=0; i<images.length; i++) { diff --git a/src/classes/share/javax/media/j3d/TextureUnitStateRetained.java b/src/classes/share/javax/media/j3d/TextureUnitStateRetained.java index 77dd7fa..94847f7 100644 --- a/src/classes/share/javax/media/j3d/TextureUnitStateRetained.java +++ b/src/classes/share/javax/media/j3d/TextureUnitStateRetained.java @@ -52,7 +52,7 @@ class TextureUnitStateRetained extends NodeComponentRetained { NodeComponentRetained thisComp, int messageOp) { if (source.isLive()) { - + if ((comp == null && thisComp == null) || (comp != null && comp.retained == thisComp)) return; @@ -68,14 +68,14 @@ class TextureUnitStateRetained extends NodeComponentRetained { // texture unit state as users of this texture component ((NodeComponentRetained)comp.retained).copyMirrorUsers(this); } - + if (messageOp != -1) { - sendMessage(messageOp, - (comp == null ? null : + sendMessage(messageOp, + (comp == null ? null : ((NodeComponentRetained)comp.retained).mirror)); } - } + } } final void initTextureUnitState(Texture texture, @@ -100,7 +100,7 @@ class TextureUnitStateRetained extends NodeComponentRetained { // message to avoid modifying the renderBin repeatedly Object args[] = new Object[3]; - args[0] = (texture == null ? null : + args[0] = (texture == null ? null : ((TextureRetained)texture.retained).mirror); args[1] = (texAttrs == null ? null : ((TextureAttributesRetained)texAttrs.retained).mirror); @@ -136,7 +136,7 @@ class TextureUnitStateRetained extends NodeComponentRetained { TEXTURE_ATTRS_CHANGED); initTextureAttributes(texAttrs); } - + final void initTexCoordGeneration(TexCoordGeneration texGen) { if (texGen == null) this.texGen = null; @@ -148,7 +148,7 @@ class TextureUnitStateRetained extends NodeComponentRetained { setTextureUnitStateComponent(texGen, this.texGen, TEXCOORD_GEN_CHANGED); initTexCoordGeneration(texGen); } - + Texture getTexture() { return (texture == null ? null : (Texture)texture.source); } @@ -161,7 +161,7 @@ class TextureUnitStateRetained extends NodeComponentRetained { return (texGen == null ? null : (TexCoordGeneration)texGen.source); } - void updateNative(int unitIndex, Canvas3D cv, + void updateNative(int unitIndex, Canvas3D cv, boolean reload, boolean simulate) { //System.err.println("TextureUnitState/updateNative: unitIndex= " + unitIndex + " reload= " + reload + " simulate= " + simulate); @@ -175,7 +175,7 @@ class TextureUnitStateRetained extends NodeComponentRetained { if (index < 0) index = 0; - + boolean dirty = ((cv.canvasDirty & (Canvas3D.TEXTUREATTRIBUTES_DIRTY|Canvas3D.TEXTUREBIN_DIRTY)) != 0); if (this.texture == null) { @@ -216,8 +216,8 @@ class TextureUnitStateRetained extends NodeComponentRetained { (texGen != null) && ((texGen.genMode == TexCoordGeneration.EYE_LINEAR) || ((texGen.genMode == TexCoordGeneration.SPHERE_MAP)))) { - // We need to reload tex since eye linear - // and sphere map in D3D will change the + // We need to reload tex since eye linear + // and sphere map in D3D will change the // texture transform matrix also. dirty = true; } @@ -229,9 +229,9 @@ class TextureUnitStateRetained extends NodeComponentRetained { TextureAttributesRetained mTexAttrs; if (this.texAttrs.mirror == null) { - mTexAttrs = this.texAttrs; + mTexAttrs = this.texAttrs; } else { - mTexAttrs = (TextureAttributesRetained) this.texAttrs.mirror; + mTexAttrs = (TextureAttributesRetained) this.texAttrs.mirror; } @@ -253,7 +253,7 @@ class TextureUnitStateRetained extends NodeComponentRetained { } cv.texUnitState[index].texAttrs = mTexAttrs; } - } + } if (this.texGen == null) { if (reload || dirty || cv.texUnitState[index].texGen != null) { @@ -264,9 +264,9 @@ class TextureUnitStateRetained extends NodeComponentRetained { TexCoordGenerationRetained mTexGen; if (this.texGen.mirror == null) { - mTexGen = this.texGen; + mTexGen = this.texGen; } else { - mTexGen = (TexCoordGenerationRetained)this.texGen.mirror; + mTexGen = (TexCoordGenerationRetained)this.texGen.mirror; } if (mTexGen.mirrorCompDirty) { @@ -281,19 +281,19 @@ class TextureUnitStateRetained extends NodeComponentRetained { this.texGen.updateNative(cv); cv.texUnitState[index].texGen = mTexGen; } - } + } cv.canvasDirty &= ~Canvas3D.TEXTUREATTRIBUTES_DIRTY; } /** - * Creates and initializes a mirror object, point the mirror object + * Creates and initializes a mirror object, point the mirror object * to the retained object if the object is not editable */ synchronized void createMirrorObject() { if (mirror == null) { - TextureUnitStateRetained mirrorTus = + TextureUnitStateRetained mirrorTus = new TextureUnitStateRetained(); mirror = mirrorTus; } @@ -304,7 +304,7 @@ class TextureUnitStateRetained extends NodeComponentRetained { synchronized void initMirrorObject() { - TextureUnitStateRetained mirrorTus = + TextureUnitStateRetained mirrorTus = (TextureUnitStateRetained)mirror; if (this.texture != null) @@ -313,7 +313,7 @@ class TextureUnitStateRetained extends NodeComponentRetained { mirrorTus.texture = null; if (this.texAttrs != null) - mirrorTus.texAttrs = + mirrorTus.texAttrs = (TextureAttributesRetained)this.texAttrs.mirror; else mirrorTus.texAttrs = null; @@ -325,7 +325,7 @@ class TextureUnitStateRetained extends NodeComponentRetained { } - /** Update the "component" field of the mirror object with the + /** Update the "component" field of the mirror object with the * given "value" */ synchronized void updateMirrorObject(int component, Object value) { @@ -340,20 +340,20 @@ class TextureUnitStateRetained extends NodeComponentRetained { } else if ((component & TEXCOORD_GEN_CHANGED) != 0) { mirrorTus.texGen = (TexCoordGenerationRetained)value; - } + } else if ((component & ALL_STATE_CHANGED) != 0) { Object [] args = (Object []) value; mirrorTus.texture = (TextureRetained)args[0]; mirrorTus.texAttrs = (TextureAttributesRetained)args[1]; mirrorTus.texGen = (TexCoordGenerationRetained)args[2]; - } + } } boolean equivalent(TextureUnitStateRetained tr) { if (tr == null) { - return (false); + return (false); } else if ((this.changedFrequent != 0) || (tr.changedFrequent != 0)) { return (this.mirror == tr); @@ -364,11 +364,11 @@ class TextureUnitStateRetained extends NodeComponentRetained { return false; } - if (this.texAttrs != null && + if (this.texAttrs != null && !this.texAttrs.equivalent(tr.texAttrs)) { return false; } - + if (this.texGen != null && !this.texGen.equivalent(tr.texGen)) { return false; @@ -384,7 +384,7 @@ class TextureUnitStateRetained extends NodeComponentRetained { // the cloned object is used for RenderBin only. // In most cases, it will duplicate all attributes in the RenderBin // so that updating a mirror object in one level will not affect the - // entire structure of the RenderBin, but will affect only those bins + // entire structure of the RenderBin, but will affect only those bins // that got affected by the modified mirror object if (this.texAttrs != null) tr.texAttrs = (TextureAttributesRetained)this.texAttrs.clone(); @@ -425,7 +425,7 @@ class TextureUnitStateRetained extends NodeComponentRetained { } } - protected void set(TextureRetained texture, + protected void set(TextureRetained texture, TextureAttributesRetained texAttrs, TexCoordGenerationRetained texGen) { this.texture = texture; @@ -480,10 +480,10 @@ class TextureUnitStateRetained extends NodeComponentRetained { void setLive(boolean backgroundGroup, int refCount) { - if (texture != null) + if (texture != null) texture.setLive(backgroundGroup, refCount); - if (texAttrs != null) + if (texAttrs != null) texAttrs.setLive(backgroundGroup, refCount); if (texGen != null) @@ -493,7 +493,7 @@ class TextureUnitStateRetained extends NodeComponentRetained { // mirror object super.doSetLive(backgroundGroup, refCount); super.markAsLive(); - + } @@ -565,10 +565,10 @@ class TextureUnitStateRetained extends NodeComponentRetained { ((texAttrs != null) && (texAttrs.source.isLive())) || ((texGen != null) && (texGen.source.isLive()))); } - + final void sendMessage(int attrMask, Object attr) { ArrayList univList = new ArrayList(); - ArrayList gaList = Shape3DRetained.getGeomAtomsList(mirror.users, univList); + ArrayList gaList = Shape3DRetained.getGeomAtomsList(mirror.users, univList); // Send to rendering attribute structure, regardless of // whether there are users or not (alternate appearance case ..) @@ -587,7 +587,7 @@ class TextureUnitStateRetained extends NodeComponentRetained { createMessage = new J3dMessage(); createMessage.threads = J3dThread.UPDATE_RENDER; createMessage.type = J3dMessage.TEXTURE_UNIT_STATE_CHANGED; - + createMessage.universe = (VirtualUniverse) univList.get(i); createMessage.args[0] = this; createMessage.args[1]= new Integer(attrMask); @@ -597,7 +597,7 @@ class TextureUnitStateRetained extends NodeComponentRetained { GeometryAtom[] gaArr = new GeometryAtom[gL.size()]; gL.toArray(gaArr); createMessage.args[3] = gaArr; - + VirtualUniverse.mc.processMessage(createMessage); } diff --git a/src/classes/share/javax/media/j3d/TimerThread.java b/src/classes/share/javax/media/j3d/TimerThread.java index 615cba6..1444ee5 100644 --- a/src/classes/share/javax/media/j3d/TimerThread.java +++ b/src/classes/share/javax/media/j3d/TimerThread.java @@ -46,7 +46,7 @@ class TimerThread extends Thread { private WakeupOnElapsedTimeHeap heap = new WakeupOnElapsedTimeHeap(); // Wakeup InputDeviceScheduler for every sample time reach - private WakeupOnElapsedTime inputDeviceSchedCond = + private WakeupOnElapsedTime inputDeviceSchedCond = new WakeupOnElapsedTime(InputDeviceScheduler.samplingTime); // Wakeup {all?} Sound Scheduler{s} for every sample time reach @@ -54,7 +54,7 @@ class TimerThread extends Thread { // Schedulers are not pinged often unless explicitly requested // XXXX: need a way to remove/null this condition when all // soundschedulers are halted - private WakeupOnElapsedTime soundSchedCond = + private WakeupOnElapsedTime soundSchedCond = new WakeupOnElapsedTime(120000); // every 2 minutes private volatile boolean running = true; @@ -74,7 +74,7 @@ class TimerThread extends Thread { } void addInputDeviceSchedCond() { - inputDeviceSchedCond.triggeredTime = + inputDeviceSchedCond.triggeredTime = InputDeviceScheduler.samplingTime + J3dClock.currentTimeMillis(); add(inputDeviceSchedCond); @@ -102,7 +102,7 @@ class TimerThread extends Thread { public void run() { long waitTime = -1; - long time; + long time; WakeupOnElapsedTime cond; while (running) { diff --git a/src/classes/share/javax/media/j3d/Transform3D.java b/src/classes/share/javax/media/j3d/Transform3D.java index 6898209..ddbd26b 100644 --- a/src/classes/share/javax/media/j3d/Transform3D.java +++ b/src/classes/share/javax/media/j3d/Transform3D.java @@ -570,7 +570,7 @@ public class Transform3D { * @param pointOut the transformed point */ void transform(Point3d point, Point4d pointOut) { - + pointOut.x = mat[0]*point.x + mat[1]*point.y + mat[2]*point.z + mat[3]; pointOut.y = mat[4]*point.x + mat[5]*point.y + @@ -580,9 +580,9 @@ public class Transform3D { pointOut.w = mat[12]*point.x + mat[13]*point.y + mat[14]*point.z + mat[15]; } - - - + + + private static final boolean almostZero(double a) { return ((a < EPSILON_ABSOLUTE) && (a > -EPSILON_ABSOLUTE)); } @@ -2141,7 +2141,7 @@ public class Transform3D { mat[13] = m1.m31; mat[14] = m1.m32; mat[15] = m1.m33; - + dirtyBits = ALL_DIRTY; if (autoNormalize) { @@ -3444,7 +3444,7 @@ public class Transform3D { scales = new double[3]; scales[0] = scales[1] = scales[2] = scale; - + // Issue 253: set all dirty bits if input is infinity or NaN if (isInfOrNaN(x) || isInfOrNaN(y) || isInfOrNaN(z) || isInfOrNaN(scale)) { dirtyBits = ALL_DIRTY; diff --git a/src/classes/share/javax/media/j3d/TransformGroup.java b/src/classes/share/javax/media/j3d/TransformGroup.java index 6c24a08..fee0052 100644 --- a/src/classes/share/javax/media/j3d/TransformGroup.java +++ b/src/classes/share/javax/media/j3d/TransformGroup.java @@ -32,13 +32,13 @@ package javax.media.j3d; /** - * Group node that contains a transform. The TransformGroup node + * Group node that contains a transform. The TransformGroup node * specifies a single spatial transformation, via a Transform3D * object, that can position, orient, and scale all of its children. * <P> - * The specified transformation must be affine. Further, if the - * TransformGroup node is used as an ancestor of a ViewPlatform node - * in the scene graph, the transformation must be congruent-only + * The specified transformation must be affine. Further, if the + * TransformGroup node is used as an ancestor of a ViewPlatform node + * in the scene graph, the transformation must be congruent-only * rotations, translations, and uniform scales are allowed in * a direct path from a Locale to a ViewPlatform node. * <P> @@ -47,34 +47,34 @@ package javax.media.j3d; * within a branch graph are congruent, containing only rotations * translation, and uniform scale. * <P> - * The effects of transformations in the scene graph are cumulative. - * The concatenation of the transformations of each TransformGroup in - * a direct path from the Locale to a Leaf node defines a composite - * model transformation (CMT) that takes points in that Leaf node's - * local coordinates and transforms them into Virtual World (Vworld) + * The effects of transformations in the scene graph are cumulative. + * The concatenation of the transformations of each TransformGroup in + * a direct path from the Locale to a Leaf node defines a composite + * model transformation (CMT) that takes points in that Leaf node's + * local coordinates and transforms them into Virtual World (Vworld) * coordinates. This composite transformation is used to - * transform points, normals, and distances into Vworld coordinates. - * Points are transformed by the CMT. Normals are transformed by the - * inverse-transpose of the CMT. Distances are transformed by the scale - * of the CMT. In the case of a transformation containing a nonuniform + * transform points, normals, and distances into Vworld coordinates. + * Points are transformed by the CMT. Normals are transformed by the + * inverse-transpose of the CMT. Distances are transformed by the scale + * of the CMT. In the case of a transformation containing a nonuniform * scale or shear, the maximum scale value in - * any direction is used. This ensures, for example, that a transformed - * bounding sphere, which is specified as a point and a radius, - * continues to enclose all objects that are also transformed using + * any direction is used. This ensures, for example, that a transformed + * bounding sphere, which is specified as a point and a radius, + * continues to enclose all objects that are also transformed using * a nonuniform scale. * <P> */ public class TransformGroup extends Group { /** - * Specifies that the node allows access to + * Specifies that the node allows access to * its object's transform information. */ public static final int ALLOW_TRANSFORM_READ = CapabilityBits.TRANSFORM_GROUP_ALLOW_TRANSFORM_READ; /** - * Specifies that the node allows writing + * Specifies that the node allows writing * its object's transform information. */ public static final int @@ -91,7 +91,7 @@ public class TransformGroup extends Group { */ public TransformGroup() { // set default read capabilities - setDefaultReadCapabilities(readCapabilities); + setDefaultReadCapabilities(readCapabilities); } /** @@ -100,14 +100,14 @@ public class TransformGroup extends Group { * @param t1 the transform3D object * @exception BadTransformException if the transform is not affine. */ - public TransformGroup(Transform3D t1) { + public TransformGroup(Transform3D t1) { if (!t1.isAffine()) { throw new BadTransformException(J3dI18N.getString("TransformGroup0")); } - + // set default read capabilities setDefaultReadCapabilities(readCapabilities); - + ((TransformGroupRetained)this.retained).setTransform(t1); } @@ -151,11 +151,11 @@ public class TransformGroup extends Group { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_TRANSFORM_READ)) throw new CapabilityNotSetException(J3dI18N.getString("TransformGroup2")); - + ((TransformGroupRetained)this.retained).getTransform(t1); } - + /** * Creates a new instance of the node. This routine is called * by <code>cloneTree</code> to duplicate the current node. @@ -182,7 +182,7 @@ public class TransformGroup extends Group { * <code>originalNode</code> into * the current node. This method is called from the * <code>cloneNode</code> method which is, in turn, called by the - * <code>cloneTree</code> method.<P> + * <code>cloneTree</code> method.<P> * * @param originalNode the original node to duplicate. * @param forceDuplicate when set to <code>true</code>, causes the @@ -198,9 +198,9 @@ public class TransformGroup extends Group { * @see Node#cloneTree * @see NodeComponent#setDuplicateOnCloneTree */ - void duplicateAttributes(Node originalNode, boolean forceDuplicate) { + void duplicateAttributes(Node originalNode, boolean forceDuplicate) { super.duplicateAttributes(originalNode, forceDuplicate); - + Transform3D t = new Transform3D(); ((TransformGroupRetained) originalNode.retained).getTransform(t); ((TransformGroupRetained) retained).setTransform(t); diff --git a/src/classes/share/javax/media/j3d/TransformGroupRetained.java b/src/classes/share/javax/media/j3d/TransformGroupRetained.java index 733b42c..4f1781b 100644 --- a/src/classes/share/javax/media/j3d/TransformGroupRetained.java +++ b/src/classes/share/javax/media/j3d/TransformGroupRetained.java @@ -92,7 +92,7 @@ class TransformGroupRetained extends GroupRetained implements TargetsInterface boolean needNormalsTransform = false; // true if normals transformation // is needed to push this // transform down to geometry - + // key which identifies a unique path from a // locale to this transform group HashKey currentKey = new HashKey(); @@ -131,7 +131,7 @@ class TransformGroupRetained extends GroupRetained implements TargetsInterface J3dMessage tchangeMessage = null; int i, j; Transform3D trans = null; - + if (staticTransform != null) { // this writeable transformGroup has a static transform // merged into this node @@ -200,8 +200,8 @@ class TransformGroupRetained extends GroupRetained implements TargetsInterface // get the inverse of the transpose -- note: this method only - // supports static transform, the translation component will - // not transform + // supports static transform, the translation component will + // not transform Transform3D getNormalTransform() { if (normalTransform == null) { normalTransform = new Transform3D(transform); @@ -264,7 +264,7 @@ class TransformGroupRetained extends GroupRetained implements TargetsInterface // For inSharedGroup case. int j, len; - + if (childLocalToVworld == null) { childLocalToVworld = new Transform3D[s.keys.length][]; childLocalToVworldIndex = new int[s.keys.length][]; @@ -275,15 +275,15 @@ class TransformGroupRetained extends GroupRetained implements TargetsInterface } else { len = localToVworld.length - s.keys.length; - - int newLen = localToVworld.length; - + + int newLen = localToVworld.length; + Transform3D newChildTList[][] = new Transform3D[newLen][]; - int newChildIndexList[][] = new int[newLen][]; + int newChildIndexList[][] = new int[newLen][]; int newTransformLevels[] = new int[newLen]; CachedTargets newTargets[] = new CachedTargets[newLen]; TransformGroupData newPerPathData[] = new TransformGroupData[newLen]; - + System.arraycopy(childLocalToVworld, 0, newChildTList, 0, childLocalToVworld.length); System.arraycopy(childLocalToVworldIndex, 0, @@ -296,9 +296,9 @@ class TransformGroupRetained extends GroupRetained implements TargetsInterface System.arraycopy(perPathData, 0, newPerPathData, 0, perPathData.length); - + childLocalToVworld = newChildTList; - childLocalToVworldIndex = newChildIndexList; + childLocalToVworldIndex = newChildIndexList; transformLevels = newTransformLevels; cachedTargets = newTargets; perPathData = newPerPathData; @@ -308,23 +308,23 @@ class TransformGroupRetained extends GroupRetained implements TargetsInterface int hkIndexPlus1, blkSize; for(i=len, j=0; i<localToVworld.length; i++, j++) { - hkIndex = s.keys[j].equals(localToVworldKeys, 0, + hkIndex = s.keys[j].equals(localToVworldKeys, 0, localToVworldKeys.length); - - if(hkIndex < 0) { + + if(hkIndex < 0) { MasterControl.getCoreLogger().severe("Can't Find matching hashKey in setNodeData."); break; } else if(hkIndex >= i) { // Append to last. childLocalToVworld[i] = childTrans[j]; - childLocalToVworldIndex[i] = childTransIndex[j]; + childLocalToVworldIndex[i] = childTransIndex[j]; transformLevels[i] = s.transformLevels[j]; } else { hkIndexPlus1 = hkIndex + 1; blkSize = i - hkIndex; - + System.arraycopy(childLocalToVworld, hkIndex, childLocalToVworld, hkIndexPlus1, blkSize); - + System.arraycopy(childLocalToVworldIndex, hkIndex, childLocalToVworldIndex, hkIndexPlus1, blkSize); @@ -338,10 +338,10 @@ class TransformGroupRetained extends GroupRetained implements TargetsInterface perPathData, hkIndexPlus1, blkSize); childLocalToVworld[hkIndex] = childTrans[j]; - childLocalToVworldIndex[hkIndex] = childTransIndex[j]; + childLocalToVworldIndex[hkIndex] = childTransIndex[j]; transformLevels[hkIndex] = s.transformLevels[j]; } - + setAuxData(s, j, hkIndex); } } @@ -361,12 +361,12 @@ class TransformGroupRetained extends GroupRetained implements TargetsInterface s.childTransformLinks = childTransformLinks; s.parentTransformLink = this; - } + } void setAuxData(SetLiveState s, int index, int hkIndex) { super.setAuxData(s, index, hkIndex); perPathData[hkIndex] = new TransformGroupData(); - perPathData[hkIndex].switchState = + perPathData[hkIndex].switchState = (SwitchState)s.switchStates.get(hkIndex); } @@ -460,7 +460,7 @@ class TransformGroupRetained extends GroupRetained implements TargetsInterface compState.staticTransform = null; compState.parentGroup = null; super.merge(compState); - + } else { // flag this TG as to be merged later on mergeFlag = SceneGraphObjectRetained.MERGE; @@ -506,7 +506,7 @@ class TransformGroupRetained extends GroupRetained implements TargetsInterface // pushing down the static transform until it hits // a leaf or a subtree which is already merged. super.merge(compState); - + // reset the compile state compState.staticTransform = saveStaticTransform; @@ -530,7 +530,7 @@ class TransformGroupRetained extends GroupRetained implements TargetsInterface int oldTraverseFlags = 0; int len; Object obj; - + // XXXX - optimization for targetThreads computation, require // cleanup in GroupRetained.doSetLive() //int savedTargetThreads = 0; @@ -548,11 +548,11 @@ class TransformGroupRetained extends GroupRetained implements TargetsInterface } s.transformTargets = newTargets; - s.traverseFlags = 0; - + s.traverseFlags = 0; + // This is needed b/c super.setlive is called after inSharedGroup check. inSharedGroup = s.inSharedGroup; - + trans = new Transform3D(); transform.getWithLock(trans); currentTransform.set(trans); @@ -570,7 +570,7 @@ class TransformGroupRetained extends GroupRetained implements TargetsInterface if (! inSharedGroup) { if (s.transformTargets[0] != null) { cachedTargets[0] = s.transformTargets[0].snapShotInit(); - } + } if (s.switchTargets != null && s.switchTargets[0] != null) { s.switchTargets[0].addNode(this, Targets.GRP_TARGETS); @@ -586,15 +586,15 @@ class TransformGroupRetained extends GroupRetained implements TargetsInterface if (s.switchTargets != null && s.switchTargets[i] != null) { s.switchTargets[i].addNode(this, Targets.GRP_TARGETS); - } + } } } // Assign data in cachedTargets to j3dCTs. j3dCTs = new CachedTargets[cachedTargets.length]; - copyCachedTargets(TargetsInterface.TRANSFORM_TARGETS, j3dCTs); - - computeTargetThreads(TargetsInterface.TRANSFORM_TARGETS, cachedTargets); + copyCachedTargets(TargetsInterface.TRANSFORM_TARGETS, j3dCTs); + + computeTargetThreads(TargetsInterface.TRANSFORM_TARGETS, cachedTargets); // restore setLiveState from it's local variables. // setNodeData did keep a reference to these variables. @@ -616,7 +616,7 @@ class TransformGroupRetained extends GroupRetained implements TargetsInterface } } - + if ((s.traverseFlags & NodeRetained.CONTAINS_VIEWPLATFORM) != 0) { aboveAViewPlatform = true; } @@ -636,7 +636,7 @@ class TransformGroupRetained extends GroupRetained implements TargetsInterface void removeNodeData(SetLiveState s) { synchronized (this) { // synchronized with TransformStructure - + if (refCount <= 0) { childLocalToVworld = null; childLocalToVworldIndex = null; @@ -665,27 +665,27 @@ class TransformGroupRetained extends GroupRetained implements TargetsInterface } else { int i, index, len; - // Remove the localToVworld key + // Remove the localToVworld key int newLen = localToVworld.length - s.keys.length; - + Transform3D[][] newChildTList = new Transform3D[newLen][]; int[][] newChildIndexList = new int[newLen][]; int[] newTransformLevels = new int[newLen]; ArrayList[] newChildPTG = new ArrayList[newLen]; CachedTargets[] newTargets = new CachedTargets[newLen]; TransformGroupData[] newPerPathData = new TransformGroupData[newLen]; - + int[] tempIndex = new int[s.keys.length]; int curStart =0, newStart =0; boolean found = false; for(i=0;i<s.keys.length;i++) { index = s.keys[i].equals(localToVworldKeys, 0, localToVworldKeys.length); - + tempIndex[i] = index; - + if(index >= 0) { found = true; - + if(index == curStart) { curStart++; } @@ -700,7 +700,7 @@ class TransformGroupRetained extends GroupRetained implements TargetsInterface System.arraycopy(cachedTargets, curStart, newTargets, newStart, len); System.arraycopy(perPathData, curStart, newPerPathData, newStart, len); - + curStart = index+1; newStart = newStart + len; } @@ -710,7 +710,7 @@ class TransformGroupRetained extends GroupRetained implements TargetsInterface MasterControl.getCoreLogger().severe("TG.removeNodeData-Can't find matching hashKey."); } } - + if((found == true) && (curStart < localToVworld.length)) { len = localToVworld.length - curStart; System.arraycopy(childLocalToVworld, curStart, newChildTList, @@ -731,19 +731,19 @@ class TransformGroupRetained extends GroupRetained implements TargetsInterface perPathData = newPerPathData; } super.removeNodeData(s); - // Set it back to its parent localToVworld data. + // Set it back to its parent localToVworld data. // This is b/c the parent has changed it localToVworld data arrays. s.localToVworld = childLocalToVworld; s.localToVworldIndex = childLocalToVworldIndex; } } - + void clearLive(SetLiveState s) { Targets[] savedTransformTargets = null; savedTransformTargets = s.transformTargets; - // no need to gather targets from tg in clear live + // no need to gather targets from tg in clear live s.transformTargets = null; super.clearLive(s); @@ -766,8 +766,8 @@ class TransformGroupRetained extends GroupRetained implements TargetsInterface } else { maxTransformLevel = -1; } - - if (s.switchTargets != null) { + + if (s.switchTargets != null) { for (int i=0; i<s.switchTargets.length; i++) { if (s.switchTargets[i] != null) { s.switchTargets[i].addNode(this, Targets.GRP_TARGETS); @@ -786,12 +786,12 @@ class TransformGroupRetained extends GroupRetained implements TargetsInterface // XXXX: recontruct targetThreads } - + void computeCombineBounds(Bounds bounds) { // Issue 514 : NPE in Wonderland : triggered in cached bounds computation if (validCachedBounds && boundsAutoCompute) { Bounds b = (Bounds) cachedBounds.clone(); - // Should this be lock too ? ( MT safe ? ) + // Should this be lock too ? ( MT safe ? ) // Thoughts : // Make a temp copy with lock : transform.getWithLock(trans);, but this will cause gc ... synchronized(transform) { @@ -800,7 +800,7 @@ class TransformGroupRetained extends GroupRetained implements TargetsInterface bounds.combine(b); return; } - + NodeRetained child; //issue 544 Bounds boundingObject = null; @@ -810,13 +810,13 @@ class TransformGroupRetained extends GroupRetained implements TargetsInterface boundingObject = new BoundingSphere(); ((BoundingSphere) boundingObject).setRadius(-1.0); } - if(boundsAutoCompute) { + if(boundsAutoCompute) { for (int i=children.size()-1; i>=0; i--) { - child = (NodeRetained)children.get(i); + child = (NodeRetained)children.get(i); if(child != null) child.computeCombineBounds(boundingObject); - } - + } + if (VirtualUniverse.mc.cacheAutoComputedBounds) { cachedBounds = (Bounds) boundingObject.clone(); } @@ -825,32 +825,32 @@ class TransformGroupRetained extends GroupRetained implements TargetsInterface // Should this be lock too ? ( MT safe ? ) synchronized(localBounds) { boundingObject.set(localBounds); - } + } } - - // Should this be lock too ? ( MT safe ? ) + + // Should this be lock too ? ( MT safe ? ) // Thoughts : // Make a temp copy with lock : transform.getWithLock(trans);, but this will cause gc ... synchronized(transform) { boundingObject.transform(transform); } bounds.combine(boundingObject); - + } - + void processChildLocalToVworld(ArrayList dirtyTransformGroups, ArrayList keySet, UpdateTargets targets, ArrayList blUsers) { - + synchronized(this) { // sync with setLive/clearLive - + if (inSharedGroup) { if (localToVworldKeys != null) { for(int j=0; j<localToVworldKeys.length; j++) { if (perPathData[j].markedDirty) { updateChildLocalToVworld(localToVworldKeys[j], j, - dirtyTransformGroups, + dirtyTransformGroups, keySet, targets, blUsers); } else { @@ -864,31 +864,31 @@ class TransformGroupRetained extends GroupRetained implements TargetsInterface targets, blUsers); } else { //System.err.println("tg.procChild markedDiry skip"); - } + } } } } - + // for shared case void updateChildLocalToVworld(HashKey key, int index, ArrayList dirtyTransformGroups, ArrayList keySet, UpdateTargets targets, ArrayList blUsers) { - + int i, j; Object obj; Transform3D lToVw, childLToVw; TransformGroupRetained tg; LinkRetained ln; CachedTargets ct; - + synchronized(this) { // sync with setLive/clearLive - - if (localToVworld != null) { + + if (localToVworld != null) { perPathData[index].markedDirty = false; // update immediate child's localToVworld - + if (perPathData[index].switchState.currentSwitchOn ) { lToVw = getCurrentLocalToVworld(index); childLToVw = getUpdateChildLocalToVworld(index); @@ -899,7 +899,7 @@ class TransformGroupRetained extends GroupRetained implements TargetsInterface if (ct != null) { targets.addCachedTargets(ct); if (ct.targetArr[Targets.BLN_TARGETS] != null) { - gatherBlUsers(blUsers, + gatherBlUsers(blUsers, ct.targetArr[Targets.BLN_TARGETS]); } } @@ -915,26 +915,26 @@ class TransformGroupRetained extends GroupRetained implements TargetsInterface synchronized(childTransformLinks) { for (i=0; i<childTransformLinks.size(); i++) { obj = childTransformLinks.get(i); - + if (obj instanceof TransformGroupRetained) { tg = (TransformGroupRetained)obj; tg.updateChildLocalToVworld( - tg.localToVworldKeys[index], + tg.localToVworldKeys[index], index, dirtyTransformGroups, keySet, targets, blUsers); } else { // LinkRetained ln = (LinkRetained)obj; currentKey.set(localToVworldKeys[index]); currentKey.append(LinkRetained.plus).append(ln.nodeId); - if ((ln.sharedGroup != null) && + if ((ln.sharedGroup != null) && (ln.sharedGroup.localToVworldKeys != null)) { j = currentKey.equals(ln.sharedGroup.localToVworldKeys,0, ln.sharedGroup.localToVworldKeys.length); if(j < 0) { System.err. - println("TransformGroupRetained : Can't find hashKey"); + println("TransformGroupRetained : Can't find hashKey"); } - + if (j < ln.sharedGroup.localToVworldKeys.length) { ln.sharedGroup. updateChildLocalToVworld(ln.sharedGroup. @@ -961,10 +961,10 @@ class TransformGroupRetained extends GroupRetained implements TargetsInterface TransformGroupRetained tg; LinkRetained ln; CachedTargets ct; - + synchronized(this) { // sync with setLive/clearLive - - if (localToVworld != null) { + + if (localToVworld != null) { perPathData[0].markedDirty = false; // update immediate child's localToVworld @@ -977,15 +977,15 @@ class TransformGroupRetained extends GroupRetained implements TargetsInterface if (ct != null) { targets.addCachedTargets(ct); if (ct.targetArr[Targets.BLN_TARGETS] != null) { - gatherBlUsers(blUsers, + gatherBlUsers(blUsers, ct.targetArr[Targets.BLN_TARGETS]); } } } else { perPathData[0].switchDirty = true; //System.err.println("tg.updateChild skip"); - } - + } + // update child's localToVworld of its children // transformLink contains top level transform group nodes @@ -993,12 +993,12 @@ class TransformGroupRetained extends GroupRetained implements TargetsInterface synchronized(childTransformLinks) { for (i=0; i<childTransformLinks.size(); i++) { obj = childTransformLinks.get(i); - + if (obj instanceof TransformGroupRetained) { tg = (TransformGroupRetained)obj; - tg.updateChildLocalToVworld(dirtyTransformGroups, + tg.updateChildLocalToVworld(dirtyTransformGroups, keySet, targets, blUsers); - + } else { // LinkRetained ln = (LinkRetained)obj; currentKey.reset(); @@ -1010,14 +1010,14 @@ class TransformGroupRetained extends GroupRetained implements TargetsInterface ln.sharedGroup.localToVworldKeys.length); if(j < 0) { System.err. - println("TransformGroupRetained : Can't find hashKey"); + println("TransformGroupRetained : Can't find hashKey"); } - + if (j<ln.sharedGroup.localToVworldKeys.length) { ln.sharedGroup. updateChildLocalToVworld( ln.sharedGroup. - localToVworldKeys[j], + localToVworldKeys[j], j, dirtyTransformGroups, keySet, targets, blUsers); } @@ -1040,7 +1040,7 @@ class TransformGroupRetained extends GroupRetained implements TargetsInterface bound.transform(getCurrentChildLocalToVworld()); } else { HashKey key = new HashKey(""); - path.getHashKey(key); + path.getHashKey(key); bound.transform(getCurrentChildLocalToVworld(key)); } } @@ -1075,7 +1075,7 @@ class TransformGroupRetained extends GroupRetained implements TargetsInterface if (!inSharedGroup) { return childLocalToVworld[0][childLocalToVworldIndex[0][NodeRetained.CURRENT_LOCAL_TO_VWORLD]]; } else { - int i = key.equals(localToVworldKeys, 0, localToVworldKeys.length); + int i = key.equals(localToVworldKeys, 0, localToVworldKeys.length); if(i>= 0) { return childLocalToVworld[i] [childLocalToVworldIndex[i][NodeRetained.CURRENT_LOCAL_TO_VWORLD]]; @@ -1089,11 +1089,11 @@ class TransformGroupRetained extends GroupRetained implements TargetsInterface * Get the last child localToVworld transform for a node */ Transform3D getLastChildLocalToVworld(HashKey key) { - + if (!inSharedGroup) { return childLocalToVworld[0][childLocalToVworldIndex[0][NodeRetained.LAST_LOCAL_TO_VWORLD]]; } else { - int i = key.equals(localToVworldKeys, 0, localToVworldKeys.length); + int i = key.equals(localToVworldKeys, 0, localToVworldKeys.length); if(i>= 0) { return childLocalToVworld[i] [childLocalToVworldIndex[i][NodeRetained.LAST_LOCAL_TO_VWORLD]]; @@ -1113,7 +1113,7 @@ class TransformGroupRetained extends GroupRetained implements TargetsInterface } else { System.err.println("getTargetsThreads: wrong arguments"); return -1; - } + } } public CachedTargets getCachedTargets(int type, int index, int child) { @@ -1135,7 +1135,7 @@ class TransformGroupRetained extends GroupRetained implements TargetsInterface // re-evalute localTargetThreads using newCachedTargets and // re-evaluate targetThreads - public void computeTargetThreads(int type, + public void computeTargetThreads(int type, CachedTargets[] newCachedTargets) { // type is ignored here, only need for SharedGroup @@ -1153,28 +1153,28 @@ class TransformGroupRetained extends GroupRetained implements TargetsInterface TargetsInterface childLink; NodeRetained node; for(int i=0; i<numLinks; i++) { - + node = (NodeRetained)childTransformLinks.get(i); if (node.nodeType == NodeRetained.LINK) { - childLink = (TargetsInterface) + childLink = (TargetsInterface) ((LinkRetained)node).sharedGroup; } else { childLink = (TargetsInterface) node; } if (childLink != null) { - targetThreads |= + targetThreads |= childLink.getTargetThreads(TargetsInterface.TRANSFORM_TARGETS); } } } else { System.err.println("computeTargetsThreads: wrong arguments"); - } + } } // re-compute localTargetThread, targetThreads and // propagate changes to ancestors - public void updateTargetThreads(int type, + public void updateTargetThreads(int type, CachedTargets[] newCachedTargets) { // type is ignored here, only need for SharedGroup if (type == TargetsInterface.TRANSFORM_TARGETS) { @@ -1189,11 +1189,11 @@ class TransformGroupRetained extends GroupRetained implements TargetsInterface } } - // re-evaluate targetThreads using childTargetThreads and + // re-evaluate targetThreads using childTargetThreads and // propagate changes to ancestors public void propagateTargetThreads(int type, int childTargetThreads) { // type is ignored here, only need for SharedGroup - + if (type == TargetsInterface.TRANSFORM_TARGETS) { // XXXX : For now we'll OR more than exact. //targetThreads = localTargetThreads | childTargetThreads; @@ -1229,7 +1229,7 @@ class TransformGroupRetained extends GroupRetained implements TargetsInterface } } - public void resetCachedTargets(int type, + public void resetCachedTargets(int type, CachedTargets[] newCtArr, int child) { // type is ignored here, only need for SharedGroup // child is ignored here diff --git a/src/classes/share/javax/media/j3d/TransformInterpolator.java b/src/classes/share/javax/media/j3d/TransformInterpolator.java index a63233f..5156c3b 100644 --- a/src/classes/share/javax/media/j3d/TransformInterpolator.java +++ b/src/classes/share/javax/media/j3d/TransformInterpolator.java @@ -62,16 +62,16 @@ public abstract class TransformInterpolator extends Interpolator { * is called implicitly from processStimulus() */ private Transform3D currentTransform = new Transform3D(); - - // We can't use a boolean flag since it is possible + + // We can't use a boolean flag since it is possible // that after alpha change, this procedure only run // once at alpha.finish(). So the best way is to // detect alpha value change. private float prevAlphaValue = Float.NaN; - private WakeupCriterion passiveWakeupCriterion = + private WakeupCriterion passiveWakeupCriterion = (WakeupCriterion) new WakeupOnElapsedFrames(0, true); - + /** * Constructs a TransformInterpolator node with a null alpha value and * a null target of TransformGroup @@ -83,7 +83,7 @@ public abstract class TransformInterpolator extends Interpolator { * Constructs a trivial transform interpolator with a specified alpha, * a specified target and an default axis set to Identity. * @param alpha The alpha object for this transform Interpolator - * @param target The target TransformGroup for this TransformInterpolator + * @param target The target TransformGroup for this TransformInterpolator */ public TransformInterpolator(Alpha alpha, TransformGroup target) { super(alpha); @@ -97,7 +97,7 @@ public abstract class TransformInterpolator extends Interpolator { * @param alpha the alpha object for this interpolator * @param target the transformGroup node affected by this transformInterpolator * @param axisOfTransform the transform that defines the local coordinate - * system in which this interpolator operates. + * system in which this interpolator operates. */ public TransformInterpolator(Alpha alpha, TransformGroup target, @@ -108,9 +108,9 @@ public abstract class TransformInterpolator extends Interpolator { axis.set(axisOfTransform); axisInverse.invert(axis); } - + /** - * This method sets the target TransformGroup node for this + * This method sets the target TransformGroup node for this * interpolator. * @param target The target TransformGroup */ @@ -131,16 +131,16 @@ public abstract class TransformInterpolator extends Interpolator { * This method sets the axis of transform for this interpolator. * @param axisOfTransform the transform that defines the local coordinate * system in which this interpolator operates - */ + */ public void setTransformAxis(Transform3D axisOfTransform) { this.axis.set(axisOfTransform); this.axisInverse.invert(this.axis); } - + /** * This method retrieves this interpolator's axis of transform. * @return the interpolator's axis of transform - */ + */ public Transform3D getTransformAxis() { return new Transform3D(this.axis); } @@ -181,13 +181,13 @@ public abstract class TransformInterpolator extends Interpolator { } wakeupOn(criterion); } - + /** * Copies all TransformInterpolator information from * <code>originalNode</code> into * the current node. This method is called from the * <code>cloneNode</code> method which is, in turn, called by the - * <code>cloneTree</code> method.<P> + * <code>cloneTree</code> method.<P> * * @param originalNode the original node to duplicate. * @param forceDuplicate when set to <code>true</code>, causes the @@ -209,7 +209,7 @@ public abstract class TransformInterpolator extends Interpolator { TransformInterpolator ti = (TransformInterpolator) originalNode; setTransformAxis(ti.getTransformAxis()); - + // this reference will be updated in updateNodeReferences() setTarget(ti.getTarget()); } diff --git a/src/classes/share/javax/media/j3d/TransformStructure.java b/src/classes/share/javax/media/j3d/TransformStructure.java index 7a1b681..43009fd 100644 --- a/src/classes/share/javax/media/j3d/TransformStructure.java +++ b/src/classes/share/javax/media/j3d/TransformStructure.java @@ -55,7 +55,7 @@ class TransformStructure extends J3dStructure implements ObjectUpdate { private UpdateTargets targets = new UpdateTargets(); /** - * An arrayList of nodes that need collisionBounds updates + * An arrayList of nodes that need collisionBounds updates */ private ArrayList collisionObjectList = new ArrayList(); @@ -70,7 +70,7 @@ class TransformStructure extends J3dStructure implements ObjectUpdate { // just switched-on private ArrayList<TransformGroupRetained> activeTraverseList = new ArrayList<TransformGroupRetained>(); - + // contains TG that have been previously changed but just switched-on private ArrayList switchDirtyTgList = new ArrayList(1); @@ -118,7 +118,7 @@ class TransformStructure extends J3dStructure implements ObjectUpdate { for (i=0; i<nMsg; i++) { m = messages[i]; - + switch (m.type) { case J3dMessage.INSERT_NODES: objectList.add(m.args[0]); @@ -156,7 +156,7 @@ class TransformStructure extends J3dStructure implements ObjectUpdate { if (tiArr != null) { Object newCtArr[] = (Object[])m.args[3]; for (int j=0; j<tiArr.length;j++) { - TargetsInterface ti = + TargetsInterface ti = (TargetsInterface)tiArr[j]; ti.updateCachedTargets( TargetsInterface.TRANSFORM_TARGETS, @@ -180,15 +180,15 @@ class TransformStructure extends J3dStructure implements ObjectUpdate { m.decRefcount(); } processCurrentLocalToVworld(); - + // XXXX: temporary -- processVwcBounds will be // done in GeometryStructure - if (objectList.size() > 0) { + if (objectList.size() > 0) { processGeometryAtomVwcBounds(); } processVwcBounds(); } - + // Issue 434: clear references to objects that have been processed objectList.clear(); @@ -257,7 +257,7 @@ class TransformStructure extends J3dStructure implements ObjectUpdate { data.switchDirty = false; } else { // if in switch, add to activetraverseList only if - // it is currently switched on, otherwise, + // it is currently switched on, otherwise, // mark it as switchDirty if (data.switchState.currentSwitchOn) { if (!added) { @@ -322,7 +322,7 @@ class TransformStructure extends J3dStructure implements ObjectUpdate { // Insertion sort on smallest arrays private void insertSort(int size, TransformGroupRetained[] tgs) { for (int i=0; i<size; i++) { - for (int j=i; j>0 && + for (int j=i; j>0 && (tgs[j-1].maxTransformLevel > tgs[j].maxTransformLevel); j--) { TransformGroupRetained tmptg = tgs[j]; tgs[j] = tgs[j-1]; @@ -352,7 +352,7 @@ class TransformStructure extends J3dStructure implements ObjectUpdate { if (l<r) quicksort(i,r, tgs); } - + public void updateObject() { processLastLocalToVworld(); processLastSwitchOn(); @@ -378,17 +378,17 @@ class TransformStructure extends J3dStructure implements ObjectUpdate { TransformGroupRetained tg; HashKey key; - + int dTGSize = dirtyTransformGroups.size(); if (J3dDebug.devPhase && J3dDebug.debug) { J3dDebug.doDebug(J3dDebug.transformStructure, J3dDebug.LEVEL_5, "processLastLocalToVworld(): dTGSize= " + dTGSize + "\n"); } - + for (i=0, k=0; i < dTGSize; i++) { tg = (TransformGroupRetained)dirtyTransformGroups.get(i); // Check if the transformGroup is still alive - + // XXXX: This is a hack, should be fixed after EA // Null pointer checking should be removed! // should call trans = tg.getCurrentChildLocalToVworld(key); @@ -400,26 +400,26 @@ class TransformStructure extends J3dStructure implements ObjectUpdate { if (tg.localToVworldKeys[j].equals(key)) { break; } - } + } if (j < tg.localToVworldKeys.length) { // last index = current index - tg.childLocalToVworldIndex[j][NodeRetained.LAST_LOCAL_TO_VWORLD] = + tg.childLocalToVworldIndex[j][NodeRetained.LAST_LOCAL_TO_VWORLD] = tg.childLocalToVworldIndex[j][NodeRetained.CURRENT_LOCAL_TO_VWORLD]; } } else { // last index = current index - tg.childLocalToVworldIndex[0][NodeRetained.LAST_LOCAL_TO_VWORLD] = + tg.childLocalToVworldIndex[0][NodeRetained.LAST_LOCAL_TO_VWORLD] = tg.childLocalToVworldIndex[0][NodeRetained.CURRENT_LOCAL_TO_VWORLD]; } } - + } } dirtyTransformGroups.clear(); keySet.clear(); - + } void processGeometryAtomVwcBounds() { @@ -435,12 +435,12 @@ class TransformStructure extends J3dStructure implements ObjectUpdate { if (J3dDebug.devPhase && J3dDebug.debug) { J3dDebug.doDebug(J3dDebug.transformStructure, J3dDebug.LEVEL_5, "vwcBounds computed this frame = " + nodes.length + "\n"); - } + } for (int j = 0; j < nodes.length; j++) { // If the list has geometry atoms, update the vwc bounds synchronized(nodes[j]) { if (nodes[j] instanceof GeometryAtom) { - ga = (GeometryAtom) nodes[j]; + ga = (GeometryAtom) nodes[j]; ms = ga.source; // update mirrorShape's vwcBounds if in use @@ -463,19 +463,19 @@ class TransformStructure extends J3dStructure implements ObjectUpdate { Bounds bound = (g.sourceNode.collisionBound != null ? g.sourceNode.collisionBound : g.sourceNode.getEffectiveBounds()); - g.collisionVwcBounds.transform(bound, + g.collisionVwcBounds.transform(bound, g.getCurrentLocalToVworld()); } } } } - // process collision bounds only update + // process collision bounds only update for (int i = 0; i < collisionObjectList.size(); i++) { Object[] nodes = (Object[]) collisionObjectList.get(i); for (int j = 0; j < nodes.length; j++) { synchronized(nodes[j]) { if (nodes[j] instanceof GeometryAtom) { - ga = (GeometryAtom) nodes[j]; + ga = (GeometryAtom) nodes[j]; ms = ga.source; if (ms.collisionVwcBound != null) { @@ -483,7 +483,7 @@ class TransformStructure extends J3dStructure implements ObjectUpdate { ms.collisionBound, ms.getCurrentLocalToVworld(0)); } - } + } } } } @@ -544,13 +544,13 @@ class TransformStructure extends J3dStructure implements ObjectUpdate { } } - // process collision bounds only update + // process collision bounds only update for (i = 0; i < collisionObjectList.size(); i++) { nodes = (Object[]) collisionObjectList.get(i); for (j = 0; j < nodes.length; j++) { synchronized(nodes[j]) { if (nodes[j] instanceof GeometryAtom) { - ga = (GeometryAtom) nodes[j]; + ga = (GeometryAtom) nodes[j]; ms = ga.source; if (ms.collisionVwcBound != null) { @@ -558,7 +558,7 @@ class TransformStructure extends J3dStructure implements ObjectUpdate { ms.collisionBound, ms.getCurrentLocalToVworld(0)); } - } + } } } } @@ -584,7 +584,7 @@ class TransformStructure extends J3dStructure implements ObjectUpdate { ms.bounds = updateBounds; if (ms.collisionBound == null) { ms.collisionVwcBound = ms.vwcBounds; - } + } } objectList.add(gaArray); } @@ -594,14 +594,14 @@ class TransformStructure extends J3dStructure implements ObjectUpdate { int i; Shape3DRetained ms; Bounds collisionBound = (Bounds)m.args[1]; - + if (m.args[0] instanceof GroupRetained) { GroupRetained g = (GroupRetained) m.args[0]; if (g.mirrorGroup != null) { objectList.add(g.mirrorGroup.toArray()); } } else { - Object[] gaArray = (Object[]) m.args[0]; + Object[] gaArray = (Object[]) m.args[0]; GeometryAtom ga; for (i=0; i<gaArray.length; i++) { diff --git a/src/classes/share/javax/media/j3d/TransparencyAttributes.java b/src/classes/share/javax/media/j3d/TransparencyAttributes.java index a0ec6d6..0690a18 100644 --- a/src/classes/share/javax/media/j3d/TransparencyAttributes.java +++ b/src/classes/share/javax/media/j3d/TransparencyAttributes.java @@ -40,12 +40,12 @@ package javax.media.j3d; * <ul> * <li>FASTEST - uses the fastest available method for transparency.</li><p> * <li>NICEST - uses the nicest available method for transparency.</li><p> - * <li>SCREEN_DOOR - uses screen-door transparency. This is done using - * an on/off stipple pattern in which the percentage of transparent pixels - * is approximately equal to the value specified by the transparency + * <li>SCREEN_DOOR - uses screen-door transparency. This is done using + * an on/off stipple pattern in which the percentage of transparent pixels + * is approximately equal to the value specified by the transparency * parameter.</li><p> - * <li>BLENDED - uses alpha blended transparency. The blend equation is - * specified by the srcBlendFunction and dstBlendFunction attributes. + * <li>BLENDED - uses alpha blended transparency. The blend equation is + * specified by the srcBlendFunction and dstBlendFunction attributes. * The default equation is: * <ul> * <code>alpha<sub><font size=-1>src</font></sub>*src + @@ -72,25 +72,25 @@ package javax.media.j3d; * range [0.0, 1.0], with 0.0 being fully opaque and 1.0 being * fully transparent.</li><p> * <li>Blend function - used in blended transparency and antialiasing - * operations. The source function specifies the factor that is - * multiplied by the source color. This value is added to the product - * of the destination factor and the destination color. The default - * source blend function is BLEND_SRC_ALPHA. The source blend function + * operations. The source function specifies the factor that is + * multiplied by the source color. This value is added to the product + * of the destination factor and the destination color. The default + * source blend function is BLEND_SRC_ALPHA. The source blend function * is one of the following:</li><p> * <ul> * <li>BLEND_ZERO - the blend function is <code>f = 0</code></li> * <li>BLEND_ONE - the blend function is <code>f = 1</code></li> - * <li>BLEND_SRC_ALPHA - the blend function is <code>f = + * <li>BLEND_SRC_ALPHA - the blend function is <code>f = * alpha<sub><font size=-1>src</font></sub></code></li> - * <li>BLEND_ONE_MINUS_SRC_ALPHA - the blend function is <code>f = + * <li>BLEND_ONE_MINUS_SRC_ALPHA - the blend function is <code>f = * 1 - alpha<sub><font size=-1>src</font></sub></code></li> - * <li>BLEND_DST_COLOR - the blend function is <code>f = + * <li>BLEND_DST_COLOR - the blend function is <code>f = * color<sub><font size=-1>dst</font></sub></code></li> - * <li>BLEND_ONE_MINUS_DST_COLOR - the blend function is <code>f = + * <li>BLEND_ONE_MINUS_DST_COLOR - the blend function is <code>f = * 1 - color<sub><font size=-1>dst</font></sub></code></li> - * <li>BLEND_SRC_COLOR - the blend function is <code>f = + * <li>BLEND_SRC_COLOR - the blend function is <code>f = * color<sub><font size=-1>src</font></sub></code></li> - * <li>BLEND_ONE_MINUS_SRC_COLOR - the blend function is <code>f = + * <li>BLEND_ONE_MINUS_SRC_COLOR - the blend function is <code>f = * 1 - color<sub><font size=-1>src</font></sub></code></li> * </ul> * </ul> @@ -289,7 +289,7 @@ public class TransparencyAttributes extends NodeComponent { ALLOW_MODE_READ, ALLOW_VALUE_READ }; - + /** * Constructs a TransparencyAttributes object with default parameters. * The default values are as follows: @@ -312,9 +312,9 @@ public class TransparencyAttributes extends NodeComponent { * @param tVal the transparency value * @exception IllegalArgumentException if * <code>tMode</code> is a value other than - * <code>NONE</code>, <code>FASTEST</code>, <code>NICEST</code>, + * <code>NONE</code>, <code>FASTEST</code>, <code>NICEST</code>, * <code>SCREEN_DOOR</code>, or <code>BLENDED</code> - * + * */ public TransparencyAttributes(int tMode, float tVal){ this(tMode, tVal, BLEND_SRC_ALPHA, BLEND_ONE_MINUS_SRC_ALPHA); @@ -335,7 +335,7 @@ public class TransparencyAttributes extends NodeComponent { * <code>BLEND_SRC_COLOR</code>, or <code>BLEND_ONE_MINUS_SRC_COLOR</code>. * @exception IllegalArgumentException if * <code>tMode</code> is a value other than - * <code>NONE</code>, <code>FASTEST</code>, <code>NICEST</code>, + * <code>NONE</code>, <code>FASTEST</code>, <code>NICEST</code>, * <code>SCREEN_DOOR</code>, or <code>BLENDED</code> * @exception IllegalArgumentException if * <code>srcBlendFunction</code> or <code>dstBlendFunction</code> @@ -348,7 +348,7 @@ public class TransparencyAttributes extends NodeComponent { int srcBlendFunction, int dstBlendFunction) { if ((tMode < FASTEST) ||(tMode > NONE)) { - throw new IllegalArgumentException(J3dI18N.getString("TransparencyAttributes6")); + throw new IllegalArgumentException(J3dI18N.getString("TransparencyAttributes6")); } switch (srcBlendFunction) { @@ -388,13 +388,13 @@ public class TransparencyAttributes extends NodeComponent { * Sets the transparency mode for this * appearance component object. * @param transparencyMode the transparency mode to be used, one of - * <code>NONE</code>, <code>FASTEST</code>, <code>NICEST</code>, + * <code>NONE</code>, <code>FASTEST</code>, <code>NICEST</code>, * <code>SCREEN_DOOR</code>, or <code>BLENDED</code> - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph * @exception IllegalArgumentException if * <code>transparencyMode</code> is a value other than - * <code>NONE</code>, <code>FASTEST</code>, <code>NICEST</code>, + * <code>NONE</code>, <code>FASTEST</code>, <code>NICEST</code>, * <code>SCREEN_DOOR</code>, or <code>BLENDED</code> */ public void setTransparencyMode(int transparencyMode) { @@ -403,7 +403,7 @@ public class TransparencyAttributes extends NodeComponent { throw new CapabilityNotSetException(J3dI18N.getString("TransparencyAttributes0")); if ((transparencyMode < FASTEST) || (transparencyMode > NONE)) { - throw new IllegalArgumentException(J3dI18N.getString("TransparencyAttributes6")); + throw new IllegalArgumentException(J3dI18N.getString("TransparencyAttributes6")); } if (isLive()) @@ -418,7 +418,7 @@ public class TransparencyAttributes extends NodeComponent { * Gets the transparency mode for this * appearance component object. * @return transparencyMode the transparency mode - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ public int getTransparencyMode() { @@ -449,7 +449,7 @@ public class TransparencyAttributes extends NodeComponent { ((TransparencyAttributesRetained)this.retained).initTransparency(transparency); } - + /** * Retrieves this appearance's transparency. @@ -478,7 +478,7 @@ public class TransparencyAttributes extends NodeComponent { * <code>BLEND_SRC_ALPHA</code>, <code>BLEND_ONE_MINUS_SRC_ALPHA</code>, * <code>BLEND_DST_COLOR</code>, or <code>BLEND_ONE_MINUS_DST_COLOR</code>. * - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph * @exception IllegalArgumentException if <code>blendFunction</code> * is a value other than one of the supported functions listed above. @@ -503,7 +503,7 @@ public class TransparencyAttributes extends NodeComponent { throw new IllegalArgumentException(J3dI18N.getString("TransparencyAttributes7")); } - if (isLive()) + if (isLive()) ((TransparencyAttributesRetained)this.retained).setSrcBlendFunction(blendFunction); else ((TransparencyAttributesRetained)this.retained).initSrcBlendFunction(blendFunction); @@ -515,7 +515,7 @@ public class TransparencyAttributes extends NodeComponent { * Gets the source blend function for this * TransparencyAttributes object. * @return the source blend function. - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph * * @since Java 3D 1.2 @@ -540,7 +540,7 @@ public class TransparencyAttributes extends NodeComponent { * <code>BLEND_SRC_ALPHA</code>, <code>BLEND_ONE_MINUS_SRC_ALPHA</code>, * <code>BLEND_SRC_COLOR</code>, or <code>BLEND_ONE_MINUS_SRC_COLOR</code>. * - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph * @exception IllegalArgumentException if <code>blendFunction</code> * is a value other than one of the supported functions listed above. @@ -564,7 +564,7 @@ public class TransparencyAttributes extends NodeComponent { throw new IllegalArgumentException(J3dI18N.getString("TransparencyAttributes8")); } - if (isLive()) + if (isLive()) ((TransparencyAttributesRetained)this.retained).setDstBlendFunction(blendFunction); else ((TransparencyAttributesRetained)this.retained).initDstBlendFunction(blendFunction); @@ -576,7 +576,7 @@ public class TransparencyAttributes extends NodeComponent { * Gets the destination blend function for this * TransparencyAttributes object. * @return the destination blend function. - * @exception CapabilityNotSetException if appropriate capability is + * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph * * @since Java 3D 1.2 @@ -600,22 +600,22 @@ public class TransparencyAttributes extends NodeComponent { /** - * @deprecated replaced with cloneNodeComponent(boolean forceDuplicate) + * @deprecated replaced with cloneNodeComponent(boolean forceDuplicate) */ public NodeComponent cloneNodeComponent() { TransparencyAttributes transa = new TransparencyAttributes(); transa.duplicateNodeComponent(this); return transa; - } + } + - /** * Copies all node information from <code>originalNodeComponent</code> into * the current node. This method is called from the * <code>duplicateNode</code> method. This routine does * the actual duplication of all "local data" (any data defined in - * this object). + * this object). * * @param originalNodeComponent the original node to duplicate. * @param forceDuplicate when set to <code>true</code>, causes the @@ -627,15 +627,15 @@ public class TransparencyAttributes extends NodeComponent { * @see Node#cloneTree * @see NodeComponent#setDuplicateOnCloneTree */ - void duplicateAttributes(NodeComponent originalNodeComponent, - boolean forceDuplicate) { + void duplicateAttributes(NodeComponent originalNodeComponent, + boolean forceDuplicate) { super.duplicateAttributes(originalNodeComponent, forceDuplicate); - - TransparencyAttributesRetained attr = + + TransparencyAttributesRetained attr = (TransparencyAttributesRetained) originalNodeComponent.retained; TransparencyAttributesRetained rt = - (TransparencyAttributesRetained) retained; - + (TransparencyAttributesRetained) retained; + rt.initTransparencyMode(attr.getTransparencyMode()); rt.initTransparency(attr.getTransparency()); rt.initSrcBlendFunction(attr.getSrcBlendFunction()); diff --git a/src/classes/share/javax/media/j3d/TransparencyAttributesRetained.java b/src/classes/share/javax/media/j3d/TransparencyAttributesRetained.java index d7ef976..1e02560 100644 --- a/src/classes/share/javax/media/j3d/TransparencyAttributesRetained.java +++ b/src/classes/share/javax/media/j3d/TransparencyAttributesRetained.java @@ -45,7 +45,7 @@ class TransparencyAttributesRetained extends NodeComponentRetained { static final int SRC_BLEND_FUNCTION_CHANGED = 0x04; static final int DST_BLEND_FUNCTION_CHANGED = 0x08; - // Integer flag that contains bitset to indicate + // Integer flag that contains bitset to indicate // which field changed. int isDirty = 0xffff; @@ -61,7 +61,7 @@ class TransparencyAttributesRetained extends NodeComponentRetained { * Sets the transparency mode for this * appearance component object. * @param transparencyMode the transparency mode to be used, one of - * <code>NONE</code>, <code>FASTEST</code>, <code>NICEST</code>, + * <code>NONE</code>, <code>FASTEST</code>, <code>NICEST</code>, * <code>SCREEN_DOOR</code>, or <code>BLENDED</code> */ final void initTransparencyMode(int transparencyMode) { @@ -185,8 +185,8 @@ class TransparencyAttributesRetained extends NodeComponentRetained { /** * Sets the destination blend function used in blended transparency - * and antialiasing operations and sends a message notifying the - * interested structures of the change. The destination function + * and antialiasing operations and sends a message notifying the + * interested structures of the change. The destination function * specifies the factor that is multiplied by the destination * color; this value is added to the product of the source factor * and the source color. The default destination blend function is @@ -212,7 +212,7 @@ class TransparencyAttributesRetained extends NodeComponentRetained { /** - * Creates and initializes a mirror object, point the mirror object + * Creates and initializes a mirror object, point the mirror object * to the retained object if the object is not editable */ synchronized void createMirrorObject() { @@ -222,7 +222,7 @@ class TransparencyAttributesRetained extends NodeComponentRetained { if (isStatic()) { mirror = this; } else { - TransparencyAttributesRetained mirrorTa + TransparencyAttributesRetained mirrorTa = new TransparencyAttributesRetained(); mirrorTa.source = source; mirrorTa.set(this); @@ -235,11 +235,11 @@ class TransparencyAttributesRetained extends NodeComponentRetained { } void updateNative(Context ctx, - float alpha, int geometryType, int polygonMode, - boolean lineAA, - boolean pointAA) { - Pipeline.getPipeline().updateTransparencyAttributes(ctx, alpha, geometryType, polygonMode, - lineAA, pointAA, transparencyMode, + float alpha, int geometryType, int polygonMode, + boolean lineAA, + boolean pointAA) { + Pipeline.getPipeline().updateTransparencyAttributes(ctx, alpha, geometryType, polygonMode, + lineAA, pointAA, transparencyMode, srcBlendFunction, dstBlendFunction); } @@ -252,7 +252,7 @@ class TransparencyAttributesRetained extends NodeComponentRetained { } /** - * Update the "component" field of the mirror object with the + * Update the "component" field of the mirror object with the * given "value" */ synchronized void updateMirrorObject(int component, Object value) { @@ -265,12 +265,12 @@ class TransparencyAttributesRetained extends NodeComponentRetained { } else if ((component & VALUE_CHANGED) != 0) { mirrorTa.transparency = ((Float)value).floatValue(); - } + } else if ((component & SRC_BLEND_FUNCTION_CHANGED) != 0) { - mirrorTa.srcBlendFunction = ((Integer) value).intValue(); - } + mirrorTa.srcBlendFunction = ((Integer) value).intValue(); + } else if ((component & DST_BLEND_FUNCTION_CHANGED) != 0) { - mirrorTa.dstBlendFunction = ((Integer) value).intValue(); + mirrorTa.dstBlendFunction = ((Integer) value).intValue(); } } @@ -296,7 +296,7 @@ class TransparencyAttributesRetained extends NodeComponentRetained { final void sendMessage(int attrMask, Object attr) { ArrayList univList = new ArrayList(); - ArrayList gaList = Shape3DRetained.getGeomAtomsList(mirror.users, univList); + ArrayList gaList = Shape3DRetained.getGeomAtomsList(mirror.users, univList); // Send to rendering attribute structure, regardless of // whether there are users or not (alternate appearance case ..) @@ -316,17 +316,17 @@ class TransparencyAttributesRetained extends NodeComponentRetained { createMessage = new J3dMessage(); createMessage.threads = J3dThread.UPDATE_RENDER; createMessage.type = J3dMessage.TRANSPARENCYATTRIBUTES_CHANGED; - + createMessage.universe = (VirtualUniverse) univList.get(i); createMessage.args[0] = this; createMessage.args[1]= new Integer(attrMask); createMessage.args[2] = attr; - + ArrayList gL = (ArrayList) gaList.get(i); GeometryAtom[] gaArr = new GeometryAtom[gL.size()]; gL.toArray(gaArr); createMessage.args[3] = gaArr; - + VirtualUniverse.mc.processMessage(createMessage); } @@ -339,7 +339,7 @@ class TransparencyAttributesRetained extends NodeComponentRetained { setFrequencyChangeMask(bit, 0x1); } } - - + + } diff --git a/src/classes/share/javax/media/j3d/TransparencyInterpolator.java b/src/classes/share/javax/media/j3d/TransparencyInterpolator.java index 27b9414..22b1a29 100644 --- a/src/classes/share/javax/media/j3d/TransparencyInterpolator.java +++ b/src/classes/share/javax/media/j3d/TransparencyInterpolator.java @@ -36,12 +36,12 @@ import java.util.Enumeration; /** * TransparencyInterpolator behavior. This class defines a behavior * that modifies the transparency of its target TransparencyAttributes - * object by linearly interpolating between a pair of specified + * object by linearly interpolating between a pair of specified * transparency values (using the value generated by the specified - * Alpha object). + * Alpha object). * <P> * There are two forms of constructor to specify the - * type of transparency interpolation. The first constructor takes + * type of transparency interpolation. The first constructor takes * an Alpha and a TransparencyAttributes object and creates a transparency * interpolator that maps an Alpha value of 1.0 to a transparency * value of 1.0, and an Alpha value of 0.0 and maps it to a @@ -64,12 +64,12 @@ public class TransparencyInterpolator extends Interpolator { float minimumTransparency; float maximumTransparency; - // We can't use a boolean flag since it is possible + // We can't use a boolean flag since it is possible // that after alpha change, this procedure only run // once at alpha.finish(). So the best way is to // detect alpha value change. private float prevAlphaValue = Float.NaN; - private WakeupCriterion passiveWakeupCriterion = + private WakeupCriterion passiveWakeupCriterion = (WakeupCriterion) new WakeupOnElapsedFrames(0, true); // non-public, default constructor used by cloneNode @@ -80,7 +80,7 @@ public class TransparencyInterpolator extends Interpolator { * Constructs a trivial transparency interpolator with a specified target, * a minimum transparency of 0.0f and a maximum transparency of 1.0f. * @param alpha the alpha object for this interpolator - * @param target the TransparencyAttributes component object affected + * @param target the TransparencyAttributes component object affected * by this interpolator */ public TransparencyInterpolator(Alpha alpha, @@ -97,7 +97,7 @@ public class TransparencyInterpolator extends Interpolator { * Constructs a new transparency interpolator that varies the target * material's transparency between the two transparency values. * @param alpha the alpha object for this Interpolator - * @param target the TransparencyAttributes component object affected + * @param target the TransparencyAttributes component object affected * by this interpolator * @param minimumTransparency the starting transparency * @param maximumTransparency the ending transparency @@ -113,7 +113,7 @@ public class TransparencyInterpolator extends Interpolator { this.minimumTransparency = minimumTransparency; this.maximumTransparency = maximumTransparency; } - + /** * This method sets the minimumTransparency for this interpolator. * @param transparency the new minimum transparency @@ -163,7 +163,7 @@ public class TransparencyInterpolator extends Interpolator { return target; } - // The TransparencyInterpolator's initialize routine uses the default + // The TransparencyInterpolator's initialize routine uses the default // initialization routine. /** diff --git a/src/classes/share/javax/media/j3d/TransparentRenderingInfo.java b/src/classes/share/javax/media/j3d/TransparentRenderingInfo.java index bb0f1c2..9e0e3ea 100644 --- a/src/classes/share/javax/media/j3d/TransparentRenderingInfo.java +++ b/src/classes/share/javax/media/j3d/TransparentRenderingInfo.java @@ -47,14 +47,14 @@ class TransparentRenderingInfo extends Object implements com.sun.j3d.utils.scene // XXXX: Add Dirty info /** - * update state before rendering transparent objects + * update state before rendering transparent objects */ boolean updateState(Canvas3D cv) { TextureBin textureBin = rm.textureBin; AttributeBin attributeBin = textureBin.attributeBin; ShaderBin shaderBin = textureBin.shaderBin; - + // Get a collection to check if switch is on RenderMolecule rm = textureBin.transparentRMList ; @@ -72,7 +72,7 @@ class TransparentRenderingInfo extends Object implements com.sun.j3d.utils.scene rm = rm.nextMap; } } - + if (rm == null) { return false; } @@ -80,18 +80,18 @@ class TransparentRenderingInfo extends Object implements com.sun.j3d.utils.scene // XXXX : Code cleanup needed : The following code segment should simply test // each bin independently and update it if necessary. if (cv.environmentSet != attributeBin.environmentSet) { - + boolean visible = (attributeBin.definingRenderingAttributes == null || attributeBin.definingRenderingAttributes.visible); - + if ( (attributeBin.environmentSet.renderBin.view.viewCache.visibilityPolicy == View.VISIBILITY_DRAW_VISIBLE && !visible) || (attributeBin.environmentSet.renderBin.view.viewCache.visibilityPolicy == View.VISIBILITY_DRAW_INVISIBLE && visible)) { return false; } - - // Fix to issue 314. Set the appropriate bits for the dirty bins + + // Fix to issue 314. Set the appropriate bits for the dirty bins // and call the update state method. cv.setStateToUpdate(Canvas3D.LIGHTBIN_BIT, attributeBin.environmentSet.lightBin); cv.setStateToUpdate(Canvas3D.ENVIRONMENTSET_BIT, attributeBin.environmentSet); @@ -102,34 +102,34 @@ class TransparentRenderingInfo extends Object implements com.sun.j3d.utils.scene } else if (cv.attributeBin != attributeBin) { boolean visible = (attributeBin.definingRenderingAttributes == null || attributeBin.definingRenderingAttributes.visible); - + if ( (attributeBin.environmentSet.renderBin.view.viewCache.visibilityPolicy == View.VISIBILITY_DRAW_VISIBLE && !visible) || (attributeBin.environmentSet.renderBin.view.viewCache.visibilityPolicy == View.VISIBILITY_DRAW_INVISIBLE && visible)) { return false; } - - // Fix to issue 314. Set the appropriate bits for the dirty bins + + // Fix to issue 314. Set the appropriate bits for the dirty bins // and call the update state method. cv.setStateToUpdate(Canvas3D.ATTRIBUTEBIN_BIT, attributeBin); cv.setStateToUpdate(Canvas3D.SHADERBIN_BIT, shaderBin); cv.updateEnvState(); - + } else if (cv.shaderBin != shaderBin) { - // Fix to issue 314. Set the appropriate bits for the dirty bins + // Fix to issue 314. Set the appropriate bits for the dirty bins // and call the update state method. cv.setStateToUpdate(Canvas3D.SHADERBIN_BIT, shaderBin); cv.updateEnvState(); - - } + + } return true; } void render(Canvas3D cv) { - if (updateState(cv)) { + if (updateState(cv)) { rm.textureBin.render(cv, rm.textureBin.transparentRMList); } } @@ -146,8 +146,8 @@ class TransparentRenderingInfo extends Object implements com.sun.j3d.utils.scene } public Geometry getGeometry() { - // XXXX: verify 0 is always the correct index. Assumption is that for - // Shape3D with multiple geometry each geometry is put in it's + // XXXX: verify 0 is always the correct index. Assumption is that for + // Shape3D with multiple geometry each geometry is put in it's // own geometryAtom. if (geometryAtom.geometryArray[0]==null) return null; diff --git a/src/classes/share/javax/media/j3d/TriangleArrayRetained.java b/src/classes/share/javax/media/j3d/TriangleArrayRetained.java index 41c58ef..392d57c 100644 --- a/src/classes/share/javax/media/j3d/TriangleArrayRetained.java +++ b/src/classes/share/javax/media/j3d/TriangleArrayRetained.java @@ -53,13 +53,13 @@ class TriangleArrayRetained extends GeometryArrayRetained { double minDist = Double.MAX_VALUE; double x = 0, y = 0, z = 0; int[] vtxIndexArr = new int[3]; - + int i = ((vertexFormat & GeometryArray.BY_REFERENCE) == 0 ? initialVertexIndex : initialCoordIndex); pnts[0] = new Point3d(); pnts[1] = new Point3d(); pnts[2] = new Point3d(); - + switch (pickShape.getPickType()) { case PickShape.PICKRAY: PickRay pickRay= (PickRay) pickShape; @@ -74,17 +74,17 @@ class TriangleArrayRetained extends GeometryArrayRetained { return true; } if (sdist[0] < minDist) { - minDist = sdist[0]; + minDist = sdist[0]; x = iPnt.x; y = iPnt.y; z = iPnt.z; if((flags & PickInfo.CLOSEST_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, + storeInterestData(pickInfo, flags, geom, geomIndex, vtxIndexArr, iPnt, sdist[0]); } } if((flags & PickInfo.ALL_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, + storeInterestData(pickInfo, flags, geom, geomIndex, vtxIndexArr, iPnt, sdist[0]); } } @@ -109,21 +109,21 @@ class TriangleArrayRetained extends GeometryArrayRetained { y = iPnt.y; z = iPnt.z; if((flags & PickInfo.CLOSEST_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, + storeInterestData(pickInfo, flags, geom, geomIndex, vtxIndexArr, iPnt, sdist[0]); } } if((flags & PickInfo.ALL_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, - vtxIndexArr, iPnt, sdist[0]); + storeInterestData(pickInfo, flags, geom, geomIndex, + vtxIndexArr, iPnt, sdist[0]); } } } break; case PickShape.PICKBOUNDINGBOX: - BoundingBox bbox = (BoundingBox) + BoundingBox bbox = (BoundingBox) ((PickBounds) pickShape).bounds; - + while (i < validVertexCount) { for(int j=0; j<3; j++) { vtxIndexArr[j] = i; @@ -139,21 +139,21 @@ class TriangleArrayRetained extends GeometryArrayRetained { y = iPnt.y; z = iPnt.z; if((flags & PickInfo.CLOSEST_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, + storeInterestData(pickInfo, flags, geom, geomIndex, vtxIndexArr, iPnt, sdist[0]); } } if((flags & PickInfo.ALL_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, - vtxIndexArr, iPnt, sdist[0]); + storeInterestData(pickInfo, flags, geom, geomIndex, + vtxIndexArr, iPnt, sdist[0]); } } } break; case PickShape.PICKBOUNDINGSPHERE: - BoundingSphere bsphere = (BoundingSphere) + BoundingSphere bsphere = (BoundingSphere) ((PickBounds) pickShape).bounds; - + while (i < validVertexCount) { for(int j=0; j<3; j++) { vtxIndexArr[j] = i; @@ -169,28 +169,28 @@ class TriangleArrayRetained extends GeometryArrayRetained { y = iPnt.y; z = iPnt.z; if((flags & PickInfo.CLOSEST_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, + storeInterestData(pickInfo, flags, geom, geomIndex, vtxIndexArr, iPnt, sdist[0]); } } if((flags & PickInfo.ALL_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, - vtxIndexArr, iPnt, sdist[0]); + storeInterestData(pickInfo, flags, geom, geomIndex, + vtxIndexArr, iPnt, sdist[0]); } } } break; case PickShape.PICKBOUNDINGPOLYTOPE: - BoundingPolytope bpolytope = (BoundingPolytope) + BoundingPolytope bpolytope = (BoundingPolytope) ((PickBounds) pickShape).bounds; - + while (i < validVertexCount) { for(int j=0; j<3; j++) { vtxIndexArr[j] = i; getVertexData(i++, pnts[j]); } if (intersectBoundingPolytope(pnts, bpolytope, - sdist,iPnt)) { + sdist,iPnt)) { if (flags == 0) { return true; } @@ -200,13 +200,13 @@ class TriangleArrayRetained extends GeometryArrayRetained { y = iPnt.y; z = iPnt.z; if((flags & PickInfo.CLOSEST_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, + storeInterestData(pickInfo, flags, geom, geomIndex, vtxIndexArr, iPnt, sdist[0]); } } if((flags & PickInfo.ALL_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, - vtxIndexArr, iPnt, sdist[0]); + storeInterestData(pickInfo, flags, geom, geomIndex, + vtxIndexArr, iPnt, sdist[0]); } } } @@ -229,20 +229,20 @@ class TriangleArrayRetained extends GeometryArrayRetained { y = iPnt.y; z = iPnt.z; if((flags & PickInfo.CLOSEST_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, + storeInterestData(pickInfo, flags, geom, geomIndex, vtxIndexArr, iPnt, sdist[0]); } } if((flags & PickInfo.ALL_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, - vtxIndexArr, iPnt, sdist[0]); + storeInterestData(pickInfo, flags, geom, geomIndex, + vtxIndexArr, iPnt, sdist[0]); } } } break; case PickShape.PICKCONE: PickCone pickCone= (PickCone) pickShape; - + while (i < validVertexCount) { for(int j=0; j<3; j++) { vtxIndexArr[j] = i; @@ -258,13 +258,13 @@ class TriangleArrayRetained extends GeometryArrayRetained { y = iPnt.y; z = iPnt.z; if((flags & PickInfo.CLOSEST_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, + storeInterestData(pickInfo, flags, geom, geomIndex, vtxIndexArr, iPnt, sdist[0]); } } if((flags & PickInfo.ALL_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, - vtxIndexArr, iPnt, sdist[0]); + storeInterestData(pickInfo, flags, geom, geomIndex, + vtxIndexArr, iPnt, sdist[0]); } } } @@ -273,10 +273,10 @@ class TriangleArrayRetained extends GeometryArrayRetained { // Should not happen since API already check for this throw new IllegalArgumentException(J3dI18N.getString("TriangleArrayRetained0")); default: - throw new RuntimeException ("PickShape not supported for intersection"); - } + throw new RuntimeException ("PickShape not supported for intersection"); + } + - if (minDist < Double.MAX_VALUE) { iPnt.x = x; iPnt.y = y; @@ -285,17 +285,17 @@ class TriangleArrayRetained extends GeometryArrayRetained { } return false; } - - + + boolean intersect(Point3d[] pnts) { Point3d[] points = new Point3d[3]; double dist[] = new double[1]; int i = ((vertexFormat & GeometryArray.BY_REFERENCE) == 0 ? initialVertexIndex : initialCoordIndex); - + points[0] = new Point3d(); - points[1] = new Point3d(); - points[2] = new Point3d(); + points[1] = new Point3d(); + points[2] = new Point3d(); switch (pnts.length) { case 3: // Triangle @@ -346,11 +346,11 @@ class TriangleArrayRetained extends GeometryArrayRetained { break; } return false; - } - + } + boolean intersect(Transform3D thisToOtherVworld, GeometryRetained geom) { - + Point3d[] pnts = new Point3d[3]; int i = ((vertexFormat & GeometryArray.BY_REFERENCE) == 0 ? initialVertexIndex : initialCoordIndex); @@ -384,7 +384,7 @@ class TriangleArrayRetained extends GeometryArrayRetained { switch(targetBound.getPickType()) { case PickShape.PICKBOUNDINGBOX: BoundingBox box = (BoundingBox) targetBound; - + while (i < validVertexCount) { getVertexData(i++, pnts[0]); getVertexData(i++, pnts[1]); @@ -396,7 +396,7 @@ class TriangleArrayRetained extends GeometryArrayRetained { break; case PickShape.PICKBOUNDINGSPHERE: BoundingSphere bsphere = (BoundingSphere) targetBound; - + while (i < validVertexCount) { getVertexData(i++, pnts[0]); getVertexData(i++, pnts[1]); @@ -409,7 +409,7 @@ class TriangleArrayRetained extends GeometryArrayRetained { break; case PickShape.PICKBOUNDINGPOLYTOPE: BoundingPolytope bpolytope = (BoundingPolytope) targetBound; - + while (i < validVertexCount) { getVertexData(i++, pnts[0]); getVertexData(i++, pnts[1]); @@ -422,7 +422,7 @@ class TriangleArrayRetained extends GeometryArrayRetained { break; default: throw new RuntimeException("Bounds not supported for intersection " - + targetBound); + + targetBound); } return false; @@ -449,8 +449,8 @@ class TriangleArrayRetained extends GeometryArrayRetained { while(i < validVertexCount) { - getVertexData(i++, pnt0); - getVertexData(i++, pnt1); + getVertexData(i++, pnt0); + getVertexData(i++, pnt1); getVertexData(i++, pnt2); // Determine the normal diff --git a/src/classes/share/javax/media/j3d/TriangleFanArray.java b/src/classes/share/javax/media/j3d/TriangleFanArray.java index 59a2ac3..df8fdae 100644 --- a/src/classes/share/javax/media/j3d/TriangleFanArray.java +++ b/src/classes/share/javax/media/j3d/TriangleFanArray.java @@ -188,7 +188,7 @@ public class TriangleFanArray extends GeometryStripArray { this.retained.setSource(this); } - + /** * @deprecated replaced with cloneNodeComponent(boolean forceDuplicate) */ diff --git a/src/classes/share/javax/media/j3d/TriangleFanArrayRetained.java b/src/classes/share/javax/media/j3d/TriangleFanArrayRetained.java index 288499c..33b76c5 100644 --- a/src/classes/share/javax/media/j3d/TriangleFanArrayRetained.java +++ b/src/classes/share/javax/media/j3d/TriangleFanArrayRetained.java @@ -67,8 +67,8 @@ class TriangleFanArrayRetained extends GeometryStripArrayRetained { switch (pickShape.getPickType()) { case PickShape.PICKRAY: PickRay pickRay= (PickRay) pickShape; - - while (i < stripVertexCounts.length) { + + while (i < stripVertexCounts.length) { j = stripStartVertexIndices[i]; end = j + stripVertexCounts[i++]; for(int k=0; k<2; k++) { @@ -105,7 +105,7 @@ class TriangleFanArrayRetained extends GeometryStripArrayRetained { case PickShape.PICKSEGMENT: PickSegment pickSegment = (PickSegment) pickShape; - while (i < stripVertexCounts.length) { + while (i < stripVertexCounts.length) { j = stripStartVertexIndices[i]; end = j + stripVertexCounts[i++]; for(int k=0; k<2; k++) { @@ -115,7 +115,7 @@ class TriangleFanArrayRetained extends GeometryStripArrayRetained { while (j < end) { vtxIndexArr[2] = j; getVertexData(j++, pnts[2]); - if (intersectSegment(pnts, pickSegment.start, + if (intersectSegment(pnts, pickSegment.start, pickSegment.end, sdist, iPnt)) { if (flags == 0) { return true; @@ -141,10 +141,10 @@ class TriangleFanArrayRetained extends GeometryStripArrayRetained { } break; case PickShape.PICKBOUNDINGBOX: - BoundingBox bbox = (BoundingBox) + BoundingBox bbox = (BoundingBox) ((PickBounds) pickShape).bounds; - while (i < stripVertexCounts.length) { + while (i < stripVertexCounts.length) { j = stripStartVertexIndices[i]; end = j + stripVertexCounts[i++]; for(int k=0; k<2; k++) { @@ -179,10 +179,10 @@ class TriangleFanArrayRetained extends GeometryStripArrayRetained { } break; case PickShape.PICKBOUNDINGSPHERE: - BoundingSphere bsphere = (BoundingSphere) + BoundingSphere bsphere = (BoundingSphere) ((PickBounds) pickShape).bounds; - while (i < stripVertexCounts.length) { + while (i < stripVertexCounts.length) { j = stripStartVertexIndices[i]; end = j + stripVertexCounts[i++]; for(int k=0; k<2; k++) { @@ -193,7 +193,7 @@ class TriangleFanArrayRetained extends GeometryStripArrayRetained { vtxIndexArr[2] = j; getVertexData(j++, pnts[2]); if (intersectBoundingSphere(pnts, bsphere, sdist, - iPnt)) { + iPnt)) { if (flags == 0) { return true; } @@ -218,10 +218,10 @@ class TriangleFanArrayRetained extends GeometryStripArrayRetained { } break; case PickShape.PICKBOUNDINGPOLYTOPE: - BoundingPolytope bpolytope = (BoundingPolytope) + BoundingPolytope bpolytope = (BoundingPolytope) ((PickBounds) pickShape).bounds; - while (i < stripVertexCounts.length) { + while (i < stripVertexCounts.length) { j = stripStartVertexIndices[i]; end = j + stripVertexCounts[i++]; for(int k=0; k<2; k++) { @@ -259,7 +259,7 @@ class TriangleFanArrayRetained extends GeometryStripArrayRetained { case PickShape.PICKCYLINDER: PickCylinder pickCylinder= (PickCylinder) pickShape; - while (i < stripVertexCounts.length) { + while (i < stripVertexCounts.length) { j = stripStartVertexIndices[i]; end = j + stripVertexCounts[i++]; for(int k=0; k<2; k++) { @@ -296,7 +296,7 @@ class TriangleFanArrayRetained extends GeometryStripArrayRetained { case PickShape.PICKCONE: PickCone pickCone= (PickCone) pickShape; - while (i < stripVertexCounts.length) { + while (i < stripVertexCounts.length) { j = stripStartVertexIndices[i]; end = j + stripVertexCounts[i++]; for(int k=0; k<2; k++) { @@ -334,8 +334,8 @@ class TriangleFanArrayRetained extends GeometryStripArrayRetained { // Should not happen since API already check for this throw new IllegalArgumentException(J3dI18N.getString("TriangleFanArrayRetained0")); default: - throw new RuntimeException ("PickShape not supported for intersection"); - } + throw new RuntimeException ("PickShape not supported for intersection"); + } if (minDist < Double.MAX_VALUE) { iPnt.x = x; @@ -344,8 +344,8 @@ class TriangleFanArrayRetained extends GeometryStripArrayRetained { return true; } return false; - } - + } + // intersect pnts[] with every triangle in this object boolean intersect(Point3d[] pnts) { int j, end; @@ -364,10 +364,10 @@ class TriangleFanArrayRetained extends GeometryStripArrayRetained { while (i < stripVertexCounts.length) { j = stripStartVertexIndices[i]; end = j + stripVertexCounts[i++]; - getVertexData(j++, points[0]); - getVertexData(j++, points[1]); + getVertexData(j++, points[0]); + getVertexData(j++, points[1]); while (j < end) { - getVertexData(j++, points[2]); + getVertexData(j++, points[2]); if (intersectTriTri(points[0], points[1], points[2], pnts[0], pnts[1], pnts[2])) { return true; @@ -380,10 +380,10 @@ class TriangleFanArrayRetained extends GeometryStripArrayRetained { while (i < stripVertexCounts.length) { j = stripStartVertexIndices[i]; end = j + stripVertexCounts[i++]; - getVertexData(j++, points[0]); - getVertexData(j++, points[1]); + getVertexData(j++, points[0]); + getVertexData(j++, points[1]); while (j < end) { - getVertexData(j++, points[2]); + getVertexData(j++, points[2]); if (intersectTriTri(points[0], points[1], points[2], pnts[0], pnts[1], pnts[2]) || intersectTriTri(points[0], points[1], points[2], @@ -398,10 +398,10 @@ class TriangleFanArrayRetained extends GeometryStripArrayRetained { while (i < stripVertexCounts.length) { j = stripStartVertexIndices[i]; end = j + stripVertexCounts[i++]; - getVertexData(j++, points[0]); - getVertexData(j++, points[1]); + getVertexData(j++, points[0]); + getVertexData(j++, points[1]); while (j < end) { - getVertexData(j++, points[2]); + getVertexData(j++, points[2]); if (intersectSegment(points, pnts[0], pnts[1], dist, null)) { return true; @@ -414,10 +414,10 @@ class TriangleFanArrayRetained extends GeometryStripArrayRetained { while (i < stripVertexCounts.length) { j = stripStartVertexIndices[i]; end = j + stripVertexCounts[i++]; - getVertexData(j++, points[0]); - getVertexData(j++, points[1]); + getVertexData(j++, points[0]); + getVertexData(j++, points[1]); while (j < end) { - getVertexData(j++, points[2]); + getVertexData(j++, points[2]); if (intersectTriPnt(points[0], points[1], points[2], pnts[0])) { return true; @@ -429,7 +429,7 @@ class TriangleFanArrayRetained extends GeometryStripArrayRetained { } return false; } - + boolean intersect(Transform3D thisToOtherVworld, GeometryRetained geom) { int i = 0, j, end; Point3d[] pnts = new Point3d[3]; @@ -440,12 +440,12 @@ class TriangleFanArrayRetained extends GeometryStripArrayRetained { while (i < stripVertexCounts.length) { j = stripStartVertexIndices[i]; end = j + stripVertexCounts[i++]; - getVertexData(j++, pnts[0]); - getVertexData(j++, pnts[1]); + getVertexData(j++, pnts[0]); + getVertexData(j++, pnts[1]); thisToOtherVworld.transform(pnts[0]); thisToOtherVworld.transform(pnts[1]); while (j < end) { - getVertexData(j++, pnts[2]); + getVertexData(j++, pnts[2]); thisToOtherVworld.transform(pnts[2]); if (geom.intersect(pnts)) { return true; @@ -473,11 +473,11 @@ class TriangleFanArrayRetained extends GeometryStripArrayRetained { while (i < stripVertexCounts.length) { j = stripStartVertexIndices[i]; - getVertexData(j++, pnts[0]); - getVertexData(j++, pnts[1]); + getVertexData(j++, pnts[0]); + getVertexData(j++, pnts[1]); end = j + stripVertexCounts[i++]; while ( j < end) { - getVertexData(j++, pnts[2]); + getVertexData(j++, pnts[2]); if (intersectBoundingBox(pnts, box, null, null)) { return true; } @@ -491,10 +491,10 @@ class TriangleFanArrayRetained extends GeometryStripArrayRetained { while (i < stripVertexCounts.length) { j = stripStartVertexIndices[i]; end = j + stripVertexCounts[i++]; - getVertexData(j++, pnts[0]); - getVertexData(j++, pnts[1]); + getVertexData(j++, pnts[0]); + getVertexData(j++, pnts[1]); while ( j < end) { - getVertexData(j++, pnts[2]); + getVertexData(j++, pnts[2]); if (intersectBoundingSphere(pnts, bsphere, null, null)) { return true; } @@ -508,10 +508,10 @@ class TriangleFanArrayRetained extends GeometryStripArrayRetained { while (i < stripVertexCounts.length) { j = stripStartVertexIndices[i]; end = j + stripVertexCounts[i++]; - getVertexData(j++, pnts[0]); - getVertexData(j++, pnts[1]); + getVertexData(j++, pnts[0]); + getVertexData(j++, pnts[1]); while ( j < end) { - getVertexData(j++, pnts[2]); + getVertexData(j++, pnts[2]); if (intersectBoundingPolytope(pnts, bpolytope, null, null)) { return true; } @@ -521,7 +521,7 @@ class TriangleFanArrayRetained extends GeometryStripArrayRetained { break; default: throw new RuntimeException("Bounds not supported for intersection " - + targetBound); + + targetBound); } return false; } @@ -531,9 +531,9 @@ class TriangleFanArrayRetained extends GeometryStripArrayRetained { Vector3d vec = new Vector3d(); Vector3d normal = new Vector3d(); Vector3d tmpvec = new Vector3d(); - Point3d pnt0 = new Point3d(); - Point3d pnt1 = new Point3d(); - Point3d pnt2 = new Point3d(); + Point3d pnt0 = new Point3d(); + Point3d pnt1 = new Point3d(); + Point3d pnt2 = new Point3d(); double area, totalarea = 0; int end, replaceIndex, j, i = 0; centroid.x = 0; @@ -543,11 +543,11 @@ class TriangleFanArrayRetained extends GeometryStripArrayRetained { while( i < stripVertexCounts.length) { j = stripStartVertexIndices[i]; end = j + stripVertexCounts[i++]; - getVertexData(j++, pnt0); + getVertexData(j++, pnt0); getVertexData(j++, pnt1); replaceIndex = 2; while (j < end) { - area = 0; + area = 0; if (replaceIndex == 2) { getVertexData(j++, pnt2); replaceIndex = 1; @@ -556,20 +556,20 @@ class TriangleFanArrayRetained extends GeometryStripArrayRetained { replaceIndex = 2; } - // Determine the normal - vec.sub(pnt0, pnt1); - tmpvec.sub(pnt1, pnt2); + // Determine the normal + vec.sub(pnt0, pnt1); + tmpvec.sub(pnt1, pnt2); // Do the cross product - normal.cross(vec, tmpvec); + normal.cross(vec, tmpvec); normal.normalize(); // If a degenerate triangle, don't include if (Double.isNaN(normal.x + normal.y + normal.z)) continue; tmpvec.set(0,0,0); - - // compute the area + + // compute the area getCrossValue(pnt0, pnt1, tmpvec); getCrossValue(pnt1, pnt2, tmpvec); getCrossValue(pnt2, pnt0, tmpvec); diff --git a/src/classes/share/javax/media/j3d/TriangleStripArrayRetained.java b/src/classes/share/javax/media/j3d/TriangleStripArrayRetained.java index 98c44ed..e11c5fb 100644 --- a/src/classes/share/javax/media/j3d/TriangleStripArrayRetained.java +++ b/src/classes/share/javax/media/j3d/TriangleStripArrayRetained.java @@ -49,7 +49,7 @@ class TriangleStripArrayRetained extends GeometryStripArrayRetained { TriangleStripArrayRetained() { this.geoType = GEO_TYPE_TRI_STRIP_SET; } - + boolean intersect(PickShape pickShape, PickInfo pickInfo, int flags, Point3d iPnt, GeometryRetained geom, int geomIndex) { Point3d pnts[] = new Point3d[3]; @@ -66,8 +66,8 @@ class TriangleStripArrayRetained extends GeometryStripArrayRetained { switch (pickShape.getPickType()) { case PickShape.PICKRAY: PickRay pickRay= (PickRay) pickShape; - - while (i < stripVertexCounts.length) { + + while (i < stripVertexCounts.length) { j = stripStartVertexIndices[i]; end = j + stripVertexCounts[i++]; for(int k=0; k<2; k++) { @@ -76,7 +76,7 @@ class TriangleStripArrayRetained extends GeometryStripArrayRetained { } while (j < end) { vtxIndexArr[2] = j; - getVertexData(j++, pnts[2]); + getVertexData(j++, pnts[2]); if (intersectRay(pnts, pickRay, sdist, iPnt)) { if (flags == 0) { return true; @@ -87,13 +87,13 @@ class TriangleStripArrayRetained extends GeometryStripArrayRetained { y = iPnt.y; z = iPnt.z; if((flags & PickInfo.CLOSEST_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, + storeInterestData(pickInfo, flags, geom, geomIndex, vtxIndexArr, iPnt, sdist[0]); } } if((flags & PickInfo.ALL_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, - vtxIndexArr, iPnt, sdist[0]); + storeInterestData(pickInfo, flags, geom, geomIndex, + vtxIndexArr, iPnt, sdist[0]); } } pnts[0].set(pnts[1]); @@ -106,7 +106,7 @@ class TriangleStripArrayRetained extends GeometryStripArrayRetained { case PickShape.PICKSEGMENT: PickSegment pickSegment = (PickSegment) pickShape; - while (i < stripVertexCounts.length) { + while (i < stripVertexCounts.length) { j = stripStartVertexIndices[i]; end = j + stripVertexCounts[i++]; for(int k=0; k<2; k++) { @@ -116,7 +116,7 @@ class TriangleStripArrayRetained extends GeometryStripArrayRetained { while (j < end) { vtxIndexArr[2] = j; getVertexData(j++, pnts[2]); - if (intersectSegment(pnts, pickSegment.start, + if (intersectSegment(pnts, pickSegment.start, pickSegment.end, sdist, iPnt)) { if (flags == 0) { return true; @@ -127,13 +127,13 @@ class TriangleStripArrayRetained extends GeometryStripArrayRetained { y = iPnt.y; z = iPnt.z; if((flags & PickInfo.CLOSEST_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, + storeInterestData(pickInfo, flags, geom, geomIndex, vtxIndexArr, iPnt, sdist[0]); } } if((flags & PickInfo.ALL_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, - vtxIndexArr, iPnt, sdist[0]); + storeInterestData(pickInfo, flags, geom, geomIndex, + vtxIndexArr, iPnt, sdist[0]); } } pnts[0].set(pnts[1]); @@ -144,10 +144,10 @@ class TriangleStripArrayRetained extends GeometryStripArrayRetained { } break; case PickShape.PICKBOUNDINGBOX: - BoundingBox bbox = (BoundingBox) + BoundingBox bbox = (BoundingBox) ((PickBounds) pickShape).bounds; - while (i < stripVertexCounts.length) { + while (i < stripVertexCounts.length) { j = stripStartVertexIndices[i]; end = j + stripVertexCounts[i++]; for(int k=0; k<2; k++) { @@ -167,13 +167,13 @@ class TriangleStripArrayRetained extends GeometryStripArrayRetained { y = iPnt.y; z = iPnt.z; if((flags & PickInfo.CLOSEST_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, + storeInterestData(pickInfo, flags, geom, geomIndex, vtxIndexArr, iPnt, sdist[0]); } } if((flags & PickInfo.ALL_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, - vtxIndexArr, iPnt, sdist[0]); + storeInterestData(pickInfo, flags, geom, geomIndex, + vtxIndexArr, iPnt, sdist[0]); } } pnts[0].set(pnts[1]); @@ -184,10 +184,10 @@ class TriangleStripArrayRetained extends GeometryStripArrayRetained { } break; case PickShape.PICKBOUNDINGSPHERE: - BoundingSphere bsphere = (BoundingSphere) + BoundingSphere bsphere = (BoundingSphere) ((PickBounds) pickShape).bounds; - while (i < stripVertexCounts.length) { + while (i < stripVertexCounts.length) { j = stripStartVertexIndices[i]; end = j + stripVertexCounts[i++]; for(int k=0; k<2; k++) { @@ -198,7 +198,7 @@ class TriangleStripArrayRetained extends GeometryStripArrayRetained { vtxIndexArr[2] = j; getVertexData(j++, pnts[2]); if (intersectBoundingSphere(pnts, bsphere, sdist, - iPnt)) { + iPnt)) { if (flags == 0) { return true; } @@ -208,13 +208,13 @@ class TriangleStripArrayRetained extends GeometryStripArrayRetained { y = iPnt.y; z = iPnt.z; if((flags & PickInfo.CLOSEST_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, + storeInterestData(pickInfo, flags, geom, geomIndex, vtxIndexArr, iPnt, sdist[0]); } } if((flags & PickInfo.ALL_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, - vtxIndexArr, iPnt, sdist[0]); + storeInterestData(pickInfo, flags, geom, geomIndex, + vtxIndexArr, iPnt, sdist[0]); } } pnts[0].set(pnts[1]); @@ -225,10 +225,10 @@ class TriangleStripArrayRetained extends GeometryStripArrayRetained { } break; case PickShape.PICKBOUNDINGPOLYTOPE: - BoundingPolytope bpolytope = (BoundingPolytope) + BoundingPolytope bpolytope = (BoundingPolytope) ((PickBounds) pickShape).bounds; - while (i < stripVertexCounts.length) { + while (i < stripVertexCounts.length) { j = stripStartVertexIndices[i]; end = j + stripVertexCounts[i++]; for(int k=0; k<2; k++) { @@ -249,13 +249,13 @@ class TriangleStripArrayRetained extends GeometryStripArrayRetained { y = iPnt.y; z = iPnt.z; if((flags & PickInfo.CLOSEST_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, + storeInterestData(pickInfo, flags, geom, geomIndex, vtxIndexArr, iPnt, sdist[0]); } } if((flags & PickInfo.ALL_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, - vtxIndexArr, iPnt, sdist[0]); + storeInterestData(pickInfo, flags, geom, geomIndex, + vtxIndexArr, iPnt, sdist[0]); } } pnts[0].set(pnts[1]); @@ -268,7 +268,7 @@ class TriangleStripArrayRetained extends GeometryStripArrayRetained { case PickShape.PICKCYLINDER: PickCylinder pickCylinder= (PickCylinder) pickShape; - while (i < stripVertexCounts.length) { + while (i < stripVertexCounts.length) { j = stripStartVertexIndices[i]; end = j + stripVertexCounts[i++]; for(int k=0; k<2; k++) { @@ -288,13 +288,13 @@ class TriangleStripArrayRetained extends GeometryStripArrayRetained { y = iPnt.y; z = iPnt.z; if((flags & PickInfo.CLOSEST_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, + storeInterestData(pickInfo, flags, geom, geomIndex, vtxIndexArr, iPnt, sdist[0]); } } if((flags & PickInfo.ALL_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, - vtxIndexArr, iPnt, sdist[0]); + storeInterestData(pickInfo, flags, geom, geomIndex, + vtxIndexArr, iPnt, sdist[0]); } } pnts[0].set(pnts[1]); @@ -307,7 +307,7 @@ class TriangleStripArrayRetained extends GeometryStripArrayRetained { case PickShape.PICKCONE: PickCone pickCone= (PickCone) pickShape; - while (i < stripVertexCounts.length) { + while (i < stripVertexCounts.length) { j = stripStartVertexIndices[i]; end = j + stripVertexCounts[i++]; for(int k=0; k<2; k++) { @@ -327,13 +327,13 @@ class TriangleStripArrayRetained extends GeometryStripArrayRetained { y = iPnt.y; z = iPnt.z; if((flags & PickInfo.CLOSEST_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, + storeInterestData(pickInfo, flags, geom, geomIndex, vtxIndexArr, iPnt, sdist[0]); } } if((flags & PickInfo.ALL_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, - vtxIndexArr, iPnt, sdist[0]); + storeInterestData(pickInfo, flags, geom, geomIndex, + vtxIndexArr, iPnt, sdist[0]); } } pnts[0].set(pnts[1]); @@ -347,8 +347,8 @@ class TriangleStripArrayRetained extends GeometryStripArrayRetained { // Should not happen since API already check for this throw new IllegalArgumentException(J3dI18N.getString("TriangleStripArrayRetained0")); default: - throw new RuntimeException ("PickShape not supported for intersection"); - } + throw new RuntimeException ("PickShape not supported for intersection"); + } if (minDist < Double.MAX_VALUE) { iPnt.x = x; @@ -358,7 +358,7 @@ class TriangleStripArrayRetained extends GeometryStripArrayRetained { } return false; } - + // intersect pnts[] with every triangle in this object boolean intersect(Point3d[] pnts) { int j, end; @@ -375,10 +375,10 @@ class TriangleStripArrayRetained extends GeometryStripArrayRetained { while (i < stripVertexCounts.length) { j = stripStartVertexIndices[i]; end = j + stripVertexCounts[i++]; - getVertexData(j++, points[0]); - getVertexData(j++, points[1]); + getVertexData(j++, points[0]); + getVertexData(j++, points[1]); while (j < end) { - getVertexData(j++, points[2]); + getVertexData(j++, points[2]); if (intersectTriTri(points[0], points[1], points[2], pnts[0], pnts[1], pnts[2])) { return true; @@ -392,10 +392,10 @@ class TriangleStripArrayRetained extends GeometryStripArrayRetained { while (i < stripVertexCounts.length) { j = stripStartVertexIndices[i]; end = j + stripVertexCounts[i++]; - getVertexData(j++, points[0]); - getVertexData(j++, points[1]); + getVertexData(j++, points[0]); + getVertexData(j++, points[1]); while (j < end) { - getVertexData(j++, points[2]); + getVertexData(j++, points[2]); if (intersectTriTri(points[0], points[1], points[2], pnts[0], pnts[1], pnts[2]) || intersectTriTri(points[0], points[1], points[2], @@ -411,10 +411,10 @@ class TriangleStripArrayRetained extends GeometryStripArrayRetained { while (i < stripVertexCounts.length) { j = stripStartVertexIndices[i]; end = j + stripVertexCounts[i++]; - getVertexData(j++, points[0]); - getVertexData(j++, points[1]); + getVertexData(j++, points[0]); + getVertexData(j++, points[1]); while (j < end) { - getVertexData(j++, points[2]); + getVertexData(j++, points[2]); if (intersectSegment(points, pnts[0], pnts[1], dist, null)) { return true; @@ -428,10 +428,10 @@ class TriangleStripArrayRetained extends GeometryStripArrayRetained { while (i < stripVertexCounts.length) { j = stripStartVertexIndices[i]; end = j + stripVertexCounts[i++]; - getVertexData(j++, points[0]); - getVertexData(j++, points[1]); + getVertexData(j++, points[0]); + getVertexData(j++, points[1]); while (j < end) { - getVertexData(j++, points[2]); + getVertexData(j++, points[2]); if (intersectTriPnt(points[0], points[1], points[2], pnts[0])) { return true; @@ -444,7 +444,7 @@ class TriangleStripArrayRetained extends GeometryStripArrayRetained { } return false; } - + boolean intersect(Transform3D thisToOtherVworld, GeometryRetained geom) { int i = 0, j, end; Point3d[] pnts = new Point3d[3]; @@ -455,12 +455,12 @@ class TriangleStripArrayRetained extends GeometryStripArrayRetained { while (i < stripVertexCounts.length) { j = stripStartVertexIndices[i]; end = j + stripVertexCounts[i++]; - getVertexData(j++, pnts[0]); - getVertexData(j++, pnts[1]); + getVertexData(j++, pnts[0]); + getVertexData(j++, pnts[1]); thisToOtherVworld.transform(pnts[0]); thisToOtherVworld.transform(pnts[1]); while (j < end) { - getVertexData(j++, pnts[2]); + getVertexData(j++, pnts[2]); thisToOtherVworld.transform(pnts[2]); if (geom.intersect(pnts)) { return true; @@ -489,10 +489,10 @@ class TriangleStripArrayRetained extends GeometryStripArrayRetained { while (i < stripVertexCounts.length) { j = stripStartVertexIndices[i]; end = j + stripVertexCounts[i++]; - getVertexData(j++, pnts[0]); - getVertexData(j++, pnts[1]); + getVertexData(j++, pnts[0]); + getVertexData(j++, pnts[1]); while ( j < end) { - getVertexData(j++, pnts[2]); + getVertexData(j++, pnts[2]); if (intersectBoundingBox(pnts, box, null, null)) { return true; } @@ -507,10 +507,10 @@ class TriangleStripArrayRetained extends GeometryStripArrayRetained { while (i < stripVertexCounts.length) { j = stripStartVertexIndices[i]; end = j + stripVertexCounts[i++]; - getVertexData(j++, pnts[0]); - getVertexData(j++, pnts[1]); + getVertexData(j++, pnts[0]); + getVertexData(j++, pnts[1]); while ( j < end) { - getVertexData(j++, pnts[2]); + getVertexData(j++, pnts[2]); if (intersectBoundingSphere(pnts, bsphere, null, null)) { return true; } @@ -525,10 +525,10 @@ class TriangleStripArrayRetained extends GeometryStripArrayRetained { while (i < stripVertexCounts.length) { j = stripStartVertexIndices[i]; end = j + stripVertexCounts[i++]; - getVertexData(j++, pnts[0]); - getVertexData(j++, pnts[1]); + getVertexData(j++, pnts[0]); + getVertexData(j++, pnts[1]); while ( j < end) { - getVertexData(j++, pnts[2]); + getVertexData(j++, pnts[2]); if (intersectBoundingPolytope(pnts, bpolytope, null, null)) { return true; } @@ -539,7 +539,7 @@ class TriangleStripArrayRetained extends GeometryStripArrayRetained { break; default: throw new RuntimeException("Bounds not supported for intersection " - + targetBound); + + targetBound); } return false; } @@ -562,11 +562,11 @@ class TriangleStripArrayRetained extends GeometryStripArrayRetained { while( i < stripVertexCounts.length) { j = stripStartVertexIndices[i]; end = j + stripVertexCounts[i++]; - getVertexData(j++, pnt0); + getVertexData(j++, pnt0); getVertexData(j++, pnt1); replaceIndex = 2; while (j < end) { - area = 0; + area = 0; switch (replaceIndex) { case 0: getVertexData(j++, pnt0); @@ -581,20 +581,20 @@ class TriangleStripArrayRetained extends GeometryStripArrayRetained { replaceIndex = 0; } - // Determine the normal - vec.sub(pnt0, pnt1); - tmpvec.sub(pnt1, pnt2); + // Determine the normal + vec.sub(pnt0, pnt1); + tmpvec.sub(pnt1, pnt2); // Do the cross product - normal.cross(vec, tmpvec); + normal.cross(vec, tmpvec); normal.normalize(); // If a degenerate triangle, don't include if (Double.isNaN(normal.x + normal.y + normal.z)) continue; tmpvec.set(0,0,0); - - // compute the area + + // compute the area getCrossValue(pnt0, pnt1, tmpvec); getCrossValue(pnt1, pnt2, tmpvec); getCrossValue(pnt2, pnt0, tmpvec); @@ -612,7 +612,7 @@ class TriangleStripArrayRetained extends GeometryStripArrayRetained { centroid.x *= area; centroid.y *= area; centroid.z *= area; - } + } } diff --git a/src/classes/share/javax/media/j3d/UnorderList.java b/src/classes/share/javax/media/j3d/UnorderList.java index 67c23c8..0720111 100644 --- a/src/classes/share/javax/media/j3d/UnorderList.java +++ b/src/classes/share/javax/media/j3d/UnorderList.java @@ -36,7 +36,7 @@ import java.util.Arrays; * A strongly type unorder array list. * The operation add(Object o) & remove(int i) take O(1) time. * The class is designed to optimize speed. So many reductance - * procedures call and range check as found in ArrayList are + * procedures call and range check as found in ArrayList are * removed. * * <p> @@ -75,7 +75,7 @@ class UnorderList implements Cloneable, java.io.Serializable { * set(), remove() when -O flag turn on. */ transient Object elementData[]; - + /** * Clone copy of elementData return by toArray(true); */ @@ -139,7 +139,7 @@ class UnorderList implements Cloneable, java.io.Serializable { UnorderList() { this(10, Object.class); } - + /** * Returns the number of elements in this list. * @@ -149,9 +149,9 @@ class UnorderList implements Cloneable, java.io.Serializable { return size; } - + /** - * Returns the size of entry use in toArray() number of elements + * Returns the size of entry use in toArray() number of elements * in this list. * * @return the number of elements in this list. @@ -205,8 +205,8 @@ class UnorderList implements Cloneable, java.io.Serializable { } /** - * Searches for the last occurence of the given argument, testing - * for equality using the <tt>equals</tt> method. + * Searches for the last occurence of the given argument, testing + * for equality using the <tt>equals</tt> method. * * @param o an object. * @return the index of the first occurrence of the argument in this @@ -233,14 +233,14 @@ class UnorderList implements Cloneable, java.io.Serializable { * @return a clone of this <tt>ArrayList</tt> instance. */ synchronized protected final Object clone() { - try { + try { UnorderList v = (UnorderList)super.clone(); v.elementData = (Object[])java.lang.reflect.Array.newInstance( componentType, size); System.arraycopy(elementData, 0, v.elementData, 0, size); isDirty = true; // can't use the old cloneData reference return v; - } catch (CloneNotSupportedException e) { + } catch (CloneNotSupportedException e) { // this shouldn't happen, since we are Cloneable throw new InternalError(); } @@ -250,7 +250,7 @@ class UnorderList implements Cloneable, java.io.Serializable { /** * Returns an array containing all of the elements in this list. * The size of the array may longer than the actual size. Use - * arraySize() to retrieve the size. + * arraySize() to retrieve the size. * The array return is a copied of internal array. if copy * is true. * @@ -272,13 +272,13 @@ class UnorderList implements Cloneable, java.io.Serializable { cloneSize = size; return elementData; } - + } /** * Returns an array containing all of the elements in this list. * The size of the array may longer than the actual size. Use - * arraySize() to retrieve the size. + * arraySize() to retrieve the size. * The array return is a copied of internal array. So another * thread can continue add/delete the current list. However, * it should be noticed that two call to toArray() may return @@ -293,10 +293,10 @@ class UnorderList implements Cloneable, java.io.Serializable { /** * Returns an array containing elements starting from startElement - * all of the elements in this list. A new array of exact size + * all of the elements in this list. A new array of exact size * is always allocated. * - * @param startElement starting element to copy + * @param startElement starting element to copy * * @return an array containing elements starting from * startElement, null if element not found. @@ -319,7 +319,7 @@ class UnorderList implements Cloneable, java.io.Serializable { System.arraycopy(elementData, 0, objs, 0, size); Arrays.fill(elementData, 0, size, null); size = 0; - isDirty = true; + isDirty = true; } @@ -337,7 +337,7 @@ class UnorderList implements Cloneable, java.io.Serializable { System.arraycopy(oldData, 0, elementData, 0, size); } } - + // Positional Access Operations @@ -388,7 +388,7 @@ class UnorderList implements Cloneable, java.io.Serializable { isDirty = true; } - + /** * Removes the element at the specified position in this list. * Replace the removed element by the last one. @@ -398,7 +398,7 @@ class UnorderList implements Cloneable, java.io.Serializable { * < 0 || index >= size())</tt>. */ synchronized final void remove(int index) { - elementData[index] = elementData[--size]; + elementData[index] = elementData[--size]; elementData[size] = null; isDirty = true; /* @@ -408,7 +408,7 @@ class UnorderList implements Cloneable, java.io.Serializable { */ } - + /** * Removes the element at the specified position in this list. * The order is keep. @@ -420,7 +420,7 @@ class UnorderList implements Cloneable, java.io.Serializable { synchronized final void removeOrdered(int index) { size--; if (index < size) { - System.arraycopy(elementData, index+1, + System.arraycopy(elementData, index+1, elementData, index, size-index); } @@ -429,7 +429,7 @@ class UnorderList implements Cloneable, java.io.Serializable { isDirty = true; } - + /** * Removes the element at the last position in this list. * @return The element remove @@ -491,7 +491,7 @@ class UnorderList implements Cloneable, java.io.Serializable { for (int i=size; i >= 0; i--) if (elementData[i]==null) { elementData[i] = elementData[size]; - elementData[size] = null; + elementData[size] = null; /* if ((cloneData != null) && (i < cloneData.length)) { cloneData[i] = null; // for gc @@ -520,7 +520,7 @@ class UnorderList implements Cloneable, java.io.Serializable { synchronized final void clearMirror() { if (cloneData != null) { - Arrays.fill(cloneData, 0, cloneData.length, null); + Arrays.fill(cloneData, 0, cloneData.length, null); } cloneSize = 0; isDirty = true; @@ -534,7 +534,7 @@ class UnorderList implements Cloneable, java.io.Serializable { StringBuffer sb = new StringBuffer("Size = " + size + "\n["); int len = size-1; Object obj; - + for (int i=0; i < size; i++) { obj = elementData[i]; if (obj != null) { diff --git a/src/classes/share/javax/media/j3d/UpdateTargets.java b/src/classes/share/javax/media/j3d/UpdateTargets.java index bd0b6a2..0011b72 100644 --- a/src/classes/share/javax/media/j3d/UpdateTargets.java +++ b/src/classes/share/javax/media/j3d/UpdateTargets.java @@ -80,16 +80,16 @@ class UpdateTargets { targetList[targetType].add(node); } - + void addNodeArray(Object[] nodeArr, int targetType) { if(targetList[targetType] == null) targetList[targetType] = new UnorderList(1); - + targetList[targetType].add(nodeArr); } - void clearNodes() { + void clearNodes() { for(int i=0; i<Targets.MAX_NODELIST; i++) { if (targetList[i] != null) { targetList[i].clear(); diff --git a/src/classes/share/javax/media/j3d/VertexArrayRenderMethod.java b/src/classes/share/javax/media/j3d/VertexArrayRenderMethod.java index ba0184b..c555833 100644 --- a/src/classes/share/javax/media/j3d/VertexArrayRenderMethod.java +++ b/src/classes/share/javax/media/j3d/VertexArrayRenderMethod.java @@ -38,15 +38,15 @@ package javax.media.j3d; class VertexArrayRenderMethod implements RenderMethod { - - public boolean render(RenderMolecule rm, Canvas3D cv, + + public boolean render(RenderMolecule rm, Canvas3D cv, RenderAtomListInfo ra, int dirtyBits) { GeometryArrayRetained geo = (GeometryArrayRetained)ra.geometry(); - geo.setVertexFormat((rm.useAlpha && ((geo.vertexFormat & - GeometryArray.COLOR) != 0)), + geo.setVertexFormat((rm.useAlpha && ((geo.vertexFormat & + GeometryArray.COLOR) != 0)), rm.textureBin.attributeBin.ignoreVertexColors, cv.ctx); - + if (rm.doInfinite) { cv.updateState(dirtyBits); while (ra != null) { @@ -78,12 +78,12 @@ class VertexArrayRenderMethod implements RenderMethod { } cv.ra = ra.renderAtom; } - + ra = ra.next; } - geo.disableGlobalAlpha(cv.ctx, - (rm.useAlpha && ((geo.vertexFormat & - GeometryArray.COLOR) != 0)), + geo.disableGlobalAlpha(cv.ctx, + (rm.useAlpha && ((geo.vertexFormat & + GeometryArray.COLOR) != 0)), rm.textureBin.attributeBin.ignoreVertexColors); return isVisible; } @@ -91,9 +91,9 @@ class VertexArrayRenderMethod implements RenderMethod { void renderGeo(RenderAtomListInfo ra, RenderMolecule rm, Canvas3D cv) { GeometryArrayRetained geo; boolean useAlpha; - + useAlpha = rm.useAlpha; - + geo = (GeometryArrayRetained)ra.geometry(); diff --git a/src/classes/share/javax/media/j3d/View.java b/src/classes/share/javax/media/j3d/View.java index 1f59b17..d64f4ad 100644 --- a/src/classes/share/javax/media/j3d/View.java +++ b/src/classes/share/javax/media/j3d/View.java @@ -271,7 +271,7 @@ import com.sun.j3d.utils.universe.Viewer; // Needed for Support of DVR. * There are five methods used to get information about system * execution and performance:<P> * <UL> - * <code>getCurrentFrameStartTime</code> returns the time at which + * <code>getCurrentFrameStartTime</code> returns the time at which * the most recent rendering frame started.<P> * <code>getLastFrameDuration</code> returns the duration, in milliseconds, of * the most recently completed rendering frame.<P> @@ -286,7 +286,7 @@ import com.sun.j3d.utils.universe.Viewer; // Needed for Support of DVR. * The following methods control the traversal, the rendering, and * the execution of the behavior scheduler for this view:<P> * <UL> - * <code>startBehaviorScheduler</code> starts the behavior scheduler + * <code>startBehaviorScheduler</code> starts the behavior scheduler * running after it has been stopped.<P> * <code>stopBehaviorScheduler</code> stops the behavior scheduler after all * currently-scheduled behaviors are executed.<P> @@ -316,8 +316,8 @@ import com.sun.j3d.utils.universe.Viewer; // Needed for Support of DVR. * <code>getSceneAntialiasingEnable</code> returns the scene antialiasing * flag.<P> * </UL> - * Note that line and point antialiasing are independent of scene - * antialiasing. If antialiasing is enabled for lines and points, + * Note that line and point antialiasing are independent of scene + * antialiasing. If antialiasing is enabled for lines and points, * the lines and points will be antialiased prior to scene antialiasing. * If scene antialiasing is disabled, antialiased lines and points will * still be antialiased. @@ -387,7 +387,7 @@ import com.sun.j3d.utils.universe.Viewer; // Needed for Support of DVR. * The View object provides the following compatibility-mode * methods that operate on the viewing transform.<P> * <UL> - * <code>setVpcToEc</code> a compatibility mode method that + * <code>setVpcToEc</code> a compatibility mode method that * specifies the ViewPlatform * coordinates (VPC) to eye coordinates viewing transform.<P> * <code>getVpcToEc</code> returns the VPC.<P> @@ -397,12 +397,12 @@ import com.sun.j3d.utils.universe.Viewer; // Needed for Support of DVR. * The View object provides the following compatibility-mode * methods that operate on the projection transform:<P> * <UL> - * The <code>setLeftProjection</code> and <code>setRightProjection</code> + * The <code>setLeftProjection</code> and <code>setRightProjection</code> * methods specify * a viewing frustum for the left and right eye that transforms * points in eye coordinates to clipping coordinates.<P> - * - * The <code>getLeftProjection</code> and <code>getRightProjection</code> + * + * The <code>getLeftProjection</code> and <code>getRightProjection</code> * methods return * the viewing frustum for the left and right eye.<P> * </UL> @@ -720,7 +720,7 @@ public class View extends Object { // AudioDevice enumerator current position // AudioDeviceEnumerator allAudioEnumerator = null; - + // These are used for tracking the frame times static final int NUMBER_FRAME_START_TIMES = 10; @@ -736,7 +736,7 @@ public class View extends Object { // These are the ones that get updated directly by MC long frameNumber = 0; long startTime = 0; - long stopTime = 0; + long stopTime = 0; // Support dynamic video resize -- DVR. Viewer viewer = null; // Cached the associate viewer of this view. @@ -754,7 +754,7 @@ public class View extends Object { // View cache for this view. // ViewCache viewCache = null; - + // Compatibility mode related field has changed. // { compatibilityModeEnable, compatVpcToEc, compatLeftProjection, // compatRightProjection } @@ -779,7 +779,7 @@ public class View extends Object { // Monoscopic View Policy field has changed. static final int MONOSCOPIC_VIEW_POLICY_DIRTY = 0x200; // Field Of View field has changed. - static final int FIELD_OF_VIEW_DIRTY = 0x400; + static final int FIELD_OF_VIEW_DIRTY = 0x400; // Tracking Enable field has changed. static final int TRACKING_ENABLE_DIRTY = 0x800; // User Head To Vworld Enable field has changed. @@ -792,7 +792,7 @@ public class View extends Object { static final int RIGHT_MANUAL_EYE_IN_COEXISTENCE_DIRTY = 0x8000; // visibilityPolicy has changed. static final int VISIBILITY_POLICY_DIRTY = 0x10000; - + // This is not from View object. It is here for the purpose // keeping all ViewCache's dirty mask bit declaration in one place. // ViewPlatformRetained viewAttach Policy field has changed. @@ -803,14 +803,14 @@ public class View extends Object { static final int PE_COE_TO_TRACKER_BASE_DIRTY = 0x100000; static final int PE_TRACKING_AVAILABLE_DIRTY = 0x200000; static final int PE_COE_CENTER_IN_PWORLD_POLICY_DIRTY = 0x400000; - + // PhysicalBody fields has changed. static final int PB_EYE_POSITION_DIRTY = 0x1000000; static final int PB_EAR_POSITION_DIRTY = 0x2000000; static final int PB_NOMINAL_EYE_HEIGHT_FROM_GROUND_DIRTY = 0x4000000; static final int PB_NOMINAL_EYE_OFFSET_FROM_NOMINAL_SCREEN_DIRTY = 0x8000000; - + // Mask that indicates this View's view dependence info. has changed, // and CanvasViewCache may need to recompute the final view matries. int vDirtyMask = (COMPATIBILITY_MODE_DIRTY | SCREEN_SCALE_POLICY_DIRTY @@ -823,14 +823,14 @@ public class View extends Object { | COEXISTENCE_CENTERING_ENABLE_DIRTY | LEFT_MANUAL_EYE_IN_COEXISTENCE_DIRTY | RIGHT_MANUAL_EYE_IN_COEXISTENCE_DIRTY - | VISIBILITY_POLICY_DIRTY); - + | VISIBILITY_POLICY_DIRTY); + // // This object contains a specification of the user's physical body. // // Attributes of this object are defined in head coordinates and - // include information such as the location of the user's eyes and + // include information such as the location of the user's eyes and // ears. // The origin is defined to be halfway between the left and right eye // in the plane of the face. @@ -844,7 +844,7 @@ public class View extends Object { // View model compatibility mode flag boolean compatibilityModeEnable = false; - + // View model coexistenceCenteringEnable flag boolean coexistenceCenteringEnable = true; @@ -979,17 +979,17 @@ public class View extends Object { // // Flag to enable depth buffer freeze during trasparent rendering pass - // + // boolean depthBufferFreezeTransparent = true; // // Flag to enable scene antialiasing - // + // boolean sceneAntialiasingEnable = false; // // Flag to enable local eye lighting - // + // boolean localEyeLightingEnable = false; // Array Lists to track the screens and canvases associated with this View. @@ -1007,7 +1007,7 @@ public class View extends Object { // Flag to notify user thread when renderOnce is finished volatile boolean renderOnceFinish = true; - + // Lock to synchronize start/stop/renderOnce call private Object startStopViewLock = new Object(); @@ -1020,10 +1020,10 @@ public class View extends Object { * use for stop view, when stopview, set to count -1, * when reach 1, call stopView() in MC and reset to -1. */ - int stopViewCount = -1; + int stopViewCount = -1; /** - * False if current frame cycle time less than minimum frame cycle time + * False if current frame cycle time less than minimum frame cycle time */ boolean isMinCycleTimeAchieve = true; @@ -1047,7 +1047,7 @@ public class View extends Object { // resetting the newly set universe. long resetUnivCount = 0; - // This notify user thread waitForMC() to continue when + // This notify user thread waitForMC() to continue when // MC finish unregisterView volatile boolean doneUnregister = false; @@ -1123,7 +1123,7 @@ public class View extends Object { public void setViewPolicy(int policy) { if (policy != HMD_VIEW && policy != SCREEN_VIEW) { - + throw new IllegalArgumentException(J3dI18N.getString("View0")); } if(policy == HMD_VIEW) { @@ -1133,7 +1133,7 @@ public class View extends Object { synchronized (canvasList) { for (int i=canvases.size()-1; i>=0; i--) { Canvas3D c3d = (Canvas3D)canvases.elementAt(i); - + if ((c3d.monoscopicViewPolicy == View.CYCLOPEAN_EYE_VIEW) && (!c3d.useStereo)){ throw new @@ -1156,7 +1156,7 @@ public class View extends Object { public int getViewPolicy() { return this.viewPolicy; } - + /** * Sets the projection policy for this View. * This variable specifies the type of projection transform that @@ -1191,7 +1191,7 @@ public class View extends Object { public int getProjectionPolicy() { return this.projectionPolicy; } - + /** * Sets the screen scale policy for this view. * This policy specifies how the screen scale is derived. @@ -1392,7 +1392,7 @@ public class View extends Object { } repaint(); } - + /** * Retrieves the coexistenceCentering enable flag. * @@ -1416,7 +1416,7 @@ public class View extends Object { } repaint(); } - + /** * Retrieves the compatibility mode enable flag. * @return the current compatibility mode enable flag @@ -1424,7 +1424,7 @@ public class View extends Object { public boolean getCompatibilityModeEnable() { return this.compatibilityModeEnable; } - + /** * Compatibility mode method that specifies a viewing frustum for * the left eye that transforms points in Eye Coordinates (EC) to @@ -1519,7 +1519,7 @@ public class View extends Object { if (!vpcToEc.isAffine()) { throw new BadTransformException(J3dI18N.getString("View7")); } - + synchronized(this) { compatVpcToEc.setWithLock(vpcToEc); vDirtyMask |= View.COMPATIBILITY_MODE_DIRTY; @@ -1616,7 +1616,7 @@ public class View extends Object { } repaint(); } - + /** * Returns the current screen scale value * @return the current screen scale value @@ -1634,7 +1634,7 @@ public class View extends Object { public void setFieldOfView(double fieldOfView) { synchronized(this) { this.fieldOfView = fieldOfView; - vDirtyMask |= View.FIELD_OF_VIEW_DIRTY; + vDirtyMask |= View.FIELD_OF_VIEW_DIRTY; } repaint(); @@ -1822,7 +1822,7 @@ public class View extends Object { /** * Sets the view model's front clip policy, the policy Java 3D uses - * in computing where to place the front clip plane. The variable + * in computing where to place the front clip plane. The variable * can contain one of: * <UL> * <LI>VIRTUAL_EYE, to specify that the associated distance is @@ -1861,7 +1861,7 @@ public class View extends Object { /** * Sets the view model's back clip policy, the policy Java 3D uses - * in computing where to place the back clip plane. The variable + * in computing where to place the back clip plane. The variable * can contain one of: * <UL> * <LI>VIRTUAL_EYE, to specify that the associated distance is @@ -1899,7 +1899,7 @@ public class View extends Object { } /** - * Sets the visibility policy for this view. This attribute + * Sets the visibility policy for this view. This attribute * is one of: * <UL> * <LI>VISIBILITY_DRAW_VISIBLE, to specify that only visible objects @@ -1921,7 +1921,7 @@ public class View extends Object { * * @since Java 3D 1.2 */ - public void setVisibilityPolicy(int policy) { + public void setVisibilityPolicy(int policy) { synchronized(this) { this.visibilityPolicy = policy; @@ -1929,7 +1929,7 @@ public class View extends Object { } if (activeStatus && isRunning) { - + J3dMessage vpMessage = new J3dMessage(); vpMessage.universe = universe; vpMessage.view = this; @@ -1959,7 +1959,7 @@ public class View extends Object { } /** - * Sets the transparency sorting policy for this view. This attribute + * Sets the transparency sorting policy for this view. This attribute * is one of: * * <UL> @@ -1983,14 +1983,14 @@ public class View extends Object { * * @since Java 3D 1.3 */ - public void setTransparencySortingPolicy(int policy) { + public void setTransparencySortingPolicy(int policy) { if (policy == transparencySortingPolicy) { return; } - + transparencySortingPolicy = policy; if (activeStatus && isRunning) { - + J3dMessage vpMessage = new J3dMessage(); vpMessage.universe = universe; vpMessage.view = this; @@ -2026,7 +2026,7 @@ public class View extends Object { this.trackingEnable = flag; vDirtyMask |= View.TRACKING_ENABLE_DIRTY; } - + repaint(); } @@ -2067,13 +2067,13 @@ public class View extends Object { * and copies that value into the transform provided. * The computed transforms takes points in the sensor's coordinate * system and produces the point's corresponding value in - * virtual-world coordinates. + * virtual-world coordinates. * @param sensor the sensor in question * @param t the object that will receive the transform */ public void getSensorToVworld(Sensor sensor, Transform3D t) { // grab the first canvas -- not sure for multiple canvases - Canvas3D canvas = (Canvas3D) this.canvases.firstElement(); + Canvas3D canvas = (Canvas3D) this.canvases.firstElement(); Transform3D localTrans = new Transform3D(); synchronized(canvas.canvasViewCache) { t.set(canvas.canvasViewCache.getVworldToTrackerBase()); @@ -2084,7 +2084,7 @@ public class View extends Object { } /** - * Retrieves the position of the specified Sensor's + * Retrieves the position of the specified Sensor's * hotspot in virtual-world coordinates * and copies that value into the position provided. * This value is derived from other values and is read-only. @@ -2094,7 +2094,7 @@ public class View extends Object { public void getSensorHotspotInVworld(Sensor sensor, Point3f position) { - Canvas3D canvas = (Canvas3D) this.canvases.firstElement(); + Canvas3D canvas = (Canvas3D) this.canvases.firstElement(); Transform3D sensorToVworld = new Transform3D(); Point3d hotspot3d = new Point3d(); @@ -2105,7 +2105,7 @@ public class View extends Object { } /** - * Retrieves the position of the specified Sensor's + * Retrieves the position of the specified Sensor's * hotspot in virtual-world coordinates * and copies that value into the position provided. * This value is derived from other values and is read-only. @@ -2115,7 +2115,7 @@ public class View extends Object { public void getSensorHotspotInVworld(Sensor sensor, Point3d position) { - Canvas3D canvas = (Canvas3D) this.canvases.firstElement(); + Canvas3D canvas = (Canvas3D) this.canvases.firstElement(); Transform3D sensorToVworld = new Transform3D(); getSensorToVworld(sensor, sensorToVworld); @@ -2134,17 +2134,17 @@ public class View extends Object { * associated with another view */ public void setCanvas3D(Canvas3D canvas3D, int index) { - + if((viewPolicy == HMD_VIEW) && (canvas3D.monoscopicViewPolicy == View.CYCLOPEAN_EYE_VIEW) && (!canvas3D.useStereo)){ - + throw new IllegalStateException(J3dI18N.getString("View31")); } - + Canvas3D cv; - + synchronized(canvasList) { if (canvas3D.getView() != null) throw new IllegalSharingException(J3dI18N.getString("View10")); @@ -2160,7 +2160,7 @@ public class View extends Object { if (canvas3D.added) { evaluateActive(); - } + } if (cv.added) { evaluateActive(); } @@ -2249,7 +2249,7 @@ public class View extends Object { throw new IllegalStateException(J3dI18N.getString("View31")); } - + synchronized(canvasList) { if (canvas3D.getView() != null) throw new IllegalSharingException(J3dI18N.getString("View10")); @@ -2274,7 +2274,7 @@ public class View extends Object { * @param index the position of Canvas3D object to be removed */ public void removeCanvas3D(int index) { - // index -1 is possible if the view is unregistered first + // index -1 is possible if the view is unregistered first // because viewPlatform is clearLived, // and then removeCanvas from the view if (index == -1) @@ -2291,7 +2291,7 @@ public class View extends Object { } // reset canvas will set view to null also - VirtualUniverse.mc.postRequest(MasterControl.RESET_CANVAS, + VirtualUniverse.mc.postRequest(MasterControl.RESET_CANVAS, cv); cv.pendingView = null; @@ -2368,7 +2368,7 @@ public class View extends Object { Canvas3D cv = (Canvas3D)iterator.next(); // reset canvas will set view to null also - VirtualUniverse.mc.postRequest(MasterControl.RESET_CANVAS, + VirtualUniverse.mc.postRequest(MasterControl.RESET_CANVAS, cv); cv.pendingView = null; @@ -2387,7 +2387,7 @@ public class View extends Object { } - // This adds this canvas and its screen to the screen list. + // This adds this canvas and its screen to the screen list. // Locks are already acquired before this is called. private void addToCanvasList(Canvas3D c) { @@ -2399,7 +2399,7 @@ public class View extends Object { return; } } - + // Add a screen slot screenList.add(c.screen); ArrayList clist = new ArrayList(); @@ -2417,7 +2417,7 @@ public class View extends Object { // This is the right screen slot ArrayList clist = (ArrayList)canvasList.get(i); clist.remove(clist.indexOf(c)); - + if (clist.size() == 0) { canvasList.remove(i); screenList.remove(i); @@ -2460,7 +2460,7 @@ public class View extends Object { } len = screenList.size(); Screen3D newCachedScreens[] = new Screen3D[len]; - + for (int i=0; i < len; i++) { newCachedScreens[i] = (Screen3D) screenList.get(i); } @@ -2470,9 +2470,9 @@ public class View extends Object { canvasesDirty = false; } } - + // This creates a 2 dimentional list of canvases - // ONLY MC can call this procedure with canCompute=true, + // ONLY MC can call this procedure with canCompute=true, // since MC want the result return by // evaluateCanvases and updateWorkThreads agree to each other, // so only evaluateCanvases can compute a new list. @@ -2612,7 +2612,7 @@ public class View extends Object { index = NUMBER_FRAME_START_TIMES - 1; } } - + if (times.length > NUMBER_FRAME_START_TIMES) { for (; i<times.length; i++) { times[i] = 0; @@ -2663,7 +2663,7 @@ public class View extends Object { * This adds a frame time to the this of frame times */ void setFrameTimingValues() { - + synchronized (frameStartTimes) { if (currentFrameIndex == NUMBER_FRAME_START_TIMES) { currentFrameIndex = 0; @@ -2686,7 +2686,7 @@ public class View extends Object { isMinCycleTimeAchieve = true; sleepTime = 0; } else { - sleepTime = minFrameCycleTime - + sleepTime = minFrameCycleTime - (J3dClock.currentTimeMillis() - startTime); isMinCycleTimeAchieve = (sleepTime <= 0); } @@ -2808,14 +2808,14 @@ public class View extends Object { setUniverse(((ViewPlatformRetained)vp.retained).universe); } ((ViewPlatformRetained)vp.retained).setView(this); - } + } evaluateActive(); if ((vp == null) && (universe != null)) { universe.waitForMC(); } } - + /** * Retrieves the currently attached ViewPlatform object * @return the currently attached ViewPlatform @@ -2867,7 +2867,7 @@ public class View extends Object { universe.behaviorScheduler.userStop = true; } } - } + } stopBehavior = true; return intervalTime; } @@ -2883,21 +2883,21 @@ public class View extends Object { if (activeStatus && isRunning && (universe.behaviorScheduler != null)) { universe.behaviorScheduler.startBehaviorScheduler(); - + } else { - if ((universe != null) && + if ((universe != null) && (universe.behaviorScheduler != null)) { universe.behaviorScheduler.userStop = false; } } - } + } stopBehavior = false; } /** * Check if BehaviorScheduler is in valid state to start/stop - * itself. + * itself. * @param s1 Exception String if method is called from a Canvas3D * @param s2 Exception String if method is called from a Behavior method * @return true if viewPlatform is live @@ -3094,27 +3094,27 @@ public class View extends Object { // DVR support // This is a back door in j3d to provide DVR support. // A better place to put this code segment is in - // ViewCache.snapshot(). Since it consists of some + // ViewCache.snapshot(). Since it consists of some // back door code, I've decided to put it here to isolate // it from the rest of view snapshot code. if(firstTime) { // System.err.println("View : First Time is " + firstTime); // viewer = Viewer.getViewer(this); - // Since we've the handler to the viewer, we can remove the entry + // Since we've the handler to the viewer, we can remove the entry // now to avoid confusion and prevent memory leak problem. - viewer = Viewer.removeViewerMapEntry(this); + viewer = Viewer.removeViewerMapEntry(this); firstTime = false; } - + // if(viewer != null) { // if(viewer.isDvrEnabled()) { // dvrFactor = viewer.getDvrFactor(); -// dvrResizeCompensation = +// dvrResizeCompensation = // viewer.getDvrResizeCompensationEnable(); // /* // System.err.println("View : dvrFactor is " + dvrFactor); -// System.err.println("View : dvrResizeCompensation is " + -// dvrResizeCompensation); +// System.err.println("View : dvrResizeCompensation is " + +// dvrResizeCompensation); // */ // } // else { @@ -3125,7 +3125,7 @@ public class View extends Object { // } // } // End of back door -- DVR. - + synchronized(this) { viewCache.snapshot(); viewCache.computeDerivedData(); @@ -3148,7 +3148,7 @@ public class View extends Object { } - /** + /** * This routine activates or deactivates a view based on various information */ void evaluateActive() { @@ -3158,7 +3158,7 @@ public class View extends Object { return; } - if ((viewPlatform == null) || + if ((viewPlatform == null) || !viewPlatform.isLive() || !((ViewPlatformRetained)viewPlatform.retained).switchState.currentSwitchOn) { if (activeStatus) { @@ -3167,8 +3167,8 @@ public class View extends Object { } // Destroy threads from MC if (VirtualUniverse.mc.isRegistered(this) && - (universe.isEmpty() || - (canvases.isEmpty() && + (universe.isEmpty() || + (canvases.isEmpty() && ((viewPlatform == null) || !viewPlatform.isLive())))) { // We can't wait until MC finish unregister view @@ -3176,7 +3176,7 @@ public class View extends Object { // holds the universe.sceneGraphLock if branch // or locale remove in clearLive(). In this way // There is deadlock since MC also need need - // sceneGraphLock in some threads + // sceneGraphLock in some threads // (e.g. TransformStructure update thread) universe.unRegViewWaiting = this; resetUnivCount = universeCount; @@ -3187,7 +3187,7 @@ public class View extends Object { // We're on a live view platform. See what the canvases say // If view not register, MC will register it automatically - + int i; VirtualUniverse u = null; synchronized (canvasList) { @@ -3212,13 +3212,13 @@ public class View extends Object { return; } - + if ((i < 0) && activeStatus) { deactivate(); activeStatus = false; return; } - + if (VirtualUniverse.mc.isRegistered(this)) { // notify MC that canvases state for this view changed VirtualUniverse.mc.postRequest( @@ -3229,19 +3229,19 @@ public class View extends Object { } void setUniverse(VirtualUniverse universe) { - - synchronized (VirtualUniverse.mc.requestObjList) { - if ((renderBin == null) || + + synchronized (VirtualUniverse.mc.requestObjList) { + if ((renderBin == null) || (renderBin.universe != universe)) { if (renderBin != null) { renderBin.cleanup(); } renderBin = new RenderBin(universe, this); - renderBin.universe = universe; + renderBin.universe = universe; } - - - if ((soundScheduler == null) || + + + if ((soundScheduler == null) || (soundScheduler.universe != universe)) { // create a sound scheduler for this view, with this universe if (soundScheduler != null) { @@ -3249,9 +3249,9 @@ public class View extends Object { } soundScheduler = new SoundScheduler(universe, this); } - - - // This has to be the last call before + + + // This has to be the last call before // RenderBin and SoundScheduler construct. Since it is // possible that canvas receive paint call and invoked // evaluateActive in another thread - which check for @@ -3273,7 +3273,7 @@ public class View extends Object { if (physicalBody != null) { physicalBody.addUser(this); } - + if (!VirtualUniverse.mc.isRegistered(this)) { universe.regViewWaiting = this; } @@ -3286,13 +3286,13 @@ public class View extends Object { } if (soundScheduler != null) { soundScheduler.reset(); - } + } J3dMessage vpMessage = new J3dMessage(); vpMessage.universe = universe; vpMessage.view = this; vpMessage.type = J3dMessage.UPDATE_VIEW; - vpMessage.threads = + vpMessage.threads = J3dThread.SOUND_SCHEDULER | J3dThread.UPDATE_RENDER | J3dThread.UPDATE_BEHAVIOR; @@ -3314,13 +3314,13 @@ public class View extends Object { physicalBody.removeUser(this); } - // This is a temporary fix for bug 4267395 + // This is a temporary fix for bug 4267395 // XXXX:cleanup in RenderBin after View detach // universe.addViewIdToFreeList(viewId); - + // using new property -Dj3d.forceReleaseView to disable bug fix 4267395 - // this bug fix can produce memory leaks in *some* applications which creates - // and destroy Canvas3D from time to time. This just add the view in the + // this bug fix can produce memory leaks in *some* applications which creates + // and destroy Canvas3D from time to time. This just add the view in the // FreeList earlier. if (VirtualUniverse.mc.forceReleaseView) { universe.addViewIdToFreeList(viewId); @@ -3331,7 +3331,7 @@ public class View extends Object { vpMessage.universe = universe; vpMessage.view = this; vpMessage.type = J3dMessage.UPDATE_VIEW; - vpMessage.threads = + vpMessage.threads = J3dThread.SOUND_SCHEDULER | J3dThread.UPDATE_RENDER | J3dThread.UPDATE_BEHAVIOR; @@ -3361,10 +3361,10 @@ public class View extends Object { viewIndex = viewId.intValue(); } } - + /** * This method passes window event to SoundScheduler - */ + */ void sendEventToSoundScheduler(AWTEvent evt) { if (soundScheduler != null) { soundScheduler.receiveAWTEvent(evt); @@ -3383,7 +3383,7 @@ public class View extends Object { soundScheduler.cleanup(); soundScheduler = null; soundRenderer = new SoundRenderer(); - + viewCache = new ViewCache(this); getCanvasList(true); cleanupViewId(); diff --git a/src/classes/share/javax/media/j3d/ViewCache.java b/src/classes/share/javax/media/j3d/ViewCache.java index 7e5a752..56ad423 100644 --- a/src/classes/share/javax/media/j3d/ViewCache.java +++ b/src/classes/share/javax/media/j3d/ViewCache.java @@ -196,7 +196,7 @@ class ViewCache extends Object { Transform3D compatRightProjection = new Transform3D(); // Mask that indicates ViewCache's view dependence info. has changed, - // and CanvasViewCache may need to recompute the final view matries. + // and CanvasViewCache may need to recompute the final view matries. int vcDirtyMask = 0; // @@ -219,7 +219,7 @@ class ViewCache extends Object { * Take snapshot of all per-view API parameters and input values. */ synchronized void snapshot() { - + // View parameters vcDirtyMask = view.vDirtyMask; view.vDirtyMask = 0; @@ -231,20 +231,20 @@ class ViewCache extends Object { projectionPolicy = view.projectionPolicy; screenScalePolicy = view.screenScalePolicy; windowResizePolicy = view.windowResizePolicy; - windowMovementPolicy = view.windowMovementPolicy; + windowMovementPolicy = view.windowMovementPolicy; windowEyepointPolicy = view.windowEyepointPolicy; monoscopicViewPolicy = view.monoscopicViewPolicy; fieldOfView = view.fieldOfView; screenScale = view.screenScale; - + frontClipDistance = view.frontClipDistance; - backClipDistance = view.backClipDistance; + backClipDistance = view.backClipDistance; frontClipPolicy = view.frontClipPolicy; backClipPolicy = view.backClipPolicy; visibilityPolicy = view.visibilityPolicy; - + trackingEnable = view.trackingEnable; userHeadToVworldEnable = view.userHeadToVworldEnable; @@ -263,30 +263,30 @@ class ViewCache extends Object { } vpRetained = (ViewPlatformRetained) vpp.retained; - + synchronized(vpRetained) { - vcDirtyMask |= vpRetained.vprDirtyMask; + vcDirtyMask |= vpRetained.vprDirtyMask; vpRetained.vprDirtyMask = 0; viewAttachPolicy = vpRetained.viewAttachPolicy; // System.err.println("ViewCache snapshot vcDirtyMask " + vcDirtyMask ); } - + // PhysicalEnvironment parameters PhysicalEnvironment env = view.getPhysicalEnvironment(); synchronized(env) { - vcDirtyMask |= env.peDirtyMask; + vcDirtyMask |= env.peDirtyMask; env.peDirtyMask = 0; - + env.coexistenceToTrackerBase.getWithLock(coexistenceToTrackerBase); trackingAvailable = env.trackingAvailable; coexistenceCenterInPworldPolicy = env.coexistenceCenterInPworldPolicy; - + // NOTE: this is really derived data, but we need it here in order // to avoid reading head tracked data when no tracker is available // and enabled. doHeadTracking = trackingEnable && trackingAvailable; - + if (doHeadTracking) { headIndex = env.getHeadIndex(); env.getSensor(headIndex).getRead(headTrackerToTrackerBase); @@ -296,14 +296,14 @@ class ViewCache extends Object { headTrackerToTrackerBase.setIdentity(); } } - + // PhysicalBody parameters PhysicalBody body = view.getPhysicalBody(); synchronized(body) { - vcDirtyMask |= body.pbDirtyMask; + vcDirtyMask |= body.pbDirtyMask; body.pbDirtyMask = 0; - + leftEyePosInHead.set(body.leftEyePosition); rightEyePosInHead.set(body.rightEyePosition); leftEarPosInHead.set(body.leftEarPosition); diff --git a/src/classes/share/javax/media/j3d/ViewPlatform.java b/src/classes/share/javax/media/j3d/ViewPlatform.java index c1a7f20..2019a28 100644 --- a/src/classes/share/javax/media/j3d/ViewPlatform.java +++ b/src/classes/share/javax/media/j3d/ViewPlatform.java @@ -35,8 +35,8 @@ package javax.media.j3d; /** * The ViewPlatform leaf node object controls the position, orientation * and scale of the viewer. It is the node in the scene graph that a - * View object connects to. A viewer navigates through the virtual - * universe by changing the transform in the scene graph hierarchy above + * View object connects to. A viewer navigates through the virtual + * universe by changing the transform in the scene graph hierarchy above * the ViewPlatform. * <p> * <b>The View Attach Policy</b> @@ -79,7 +79,7 @@ package javax.media.j3d; * <p> * The ViewPlatform's activation radius defines an activation * volume surrounding the center of the ViewPlatform. This activation - * volume is a spherical region that intersects with the scheduling regions + * volume is a spherical region that intersects with the scheduling regions * and application regions * of other leaf node objects to determine which of those objects may * affect rendering. Only active view platforms--that is, view platforms @@ -92,12 +92,12 @@ package javax.media.j3d; * (Background, Clip, or Soundscape) intersects an active ViewPlatform's * activation volume, the "most appropriate" node is selected for that View. * Sound leaf objects and Behavior objects become active when - * their scheduling region intersects an active ViewPlatform's activation - * volume. + * their scheduling region intersects an active ViewPlatform's activation + * volume. * <p> * The activation radius is in view platform coordinates. For the - * default screen scale policy of SCALE_SCREEN_SIZE, the - * activationRadius parameter value is multiplied by half the + * default screen scale policy of SCALE_SCREEN_SIZE, the + * activationRadius parameter value is multiplied by half the * monitor screen size to derive the actual activation radius. For example, * for the default screen size of 0.35 meters, and the default activation * radius value of 62, the actual activation radius would be 10.85 @@ -131,7 +131,7 @@ public class ViewPlatform extends Leaf { private static final int[] readCapabilities = { ALLOW_POLICY_READ }; - + /** * Constructs a ViewPlatform object with default parameters. * The default values are as follows: @@ -153,7 +153,7 @@ public class ViewPlatform extends Leaf { this.retained = new ViewPlatformRetained(); this.retained.setSource(this); } - + /** * Sets the view attach policy that determines the coexistence center @@ -201,7 +201,7 @@ public class ViewPlatform extends Leaf { return ((ViewPlatformRetained)this.retained).getViewAttachPolicy(); } - /** + /** * Set the ViewPlatform's activation radius which defines an activation * volume around the view platform. * @param activationRadius the new activation radius @@ -210,7 +210,7 @@ public class ViewPlatform extends Leaf { ((ViewPlatformRetained)this.retained).setActivationRadius(activationRadius); } - /** + /** * Get the ViewPlatform's activation radius. * @return the ViewPlatform activation radius */ @@ -248,7 +248,7 @@ public class ViewPlatform extends Leaf { return v; } - + /** * Copies all ViewPlatform information from <code>originalNode</code> into * the current node. This method is called from the @@ -277,10 +277,10 @@ public class ViewPlatform extends Leaf { * @see NodeComponent#setDuplicateOnCloneTree */ - void duplicateAttributes(Node originalNode, boolean forceDuplicate) { + void duplicateAttributes(Node originalNode, boolean forceDuplicate) { super.duplicateAttributes(originalNode, forceDuplicate); - ViewPlatformRetained attr = + ViewPlatformRetained attr = (ViewPlatformRetained) originalNode.retained; ViewPlatformRetained rt = (ViewPlatformRetained) retained; diff --git a/src/classes/share/javax/media/j3d/ViewPlatformRetained.java b/src/classes/share/javax/media/j3d/ViewPlatformRetained.java index 2c5cda8..86e1797 100644 --- a/src/classes/share/javax/media/j3d/ViewPlatformRetained.java +++ b/src/classes/share/javax/media/j3d/ViewPlatformRetained.java @@ -70,10 +70,10 @@ class ViewPlatformRetained extends LeafRetained { // dirty flag for viewList boolean viewListDirty = true; - /** + /** * The current cached view platform transform (vworldToVpc) and * its inverse (vpcToVworld). - */ + */ Transform3D vworldToVpc = null; Transform3D vpcToVworld = new Transform3D(); @@ -119,7 +119,7 @@ class ViewPlatformRetained extends LeafRetained { * This setting determines how Java 3D places the * user's eye point as a function of head position. The variable can * contain one of NOMINAL_SCREEN, NOMINAL_HEAD, or NOMINAL_FEET. - * @param policy the new policy, one of NOMINAL_SCREEN, NOMINAL_HEAD, + * @param policy the new policy, one of NOMINAL_SCREEN, NOMINAL_HEAD, * or NOMINAL_FEET */ void setViewAttachPolicy(int policy) { @@ -127,7 +127,7 @@ class ViewPlatformRetained extends LeafRetained { this.viewAttachPolicy = policy; vprDirtyMask |= View.VPR_VIEW_ATTACH_POLICY_DIRTY; } - + if (source != null && source.isLive()) { repaint(); } @@ -172,7 +172,7 @@ class ViewPlatformRetained extends LeafRetained { } } - + /** * Get the ViewPlatform's activation radius */ @@ -200,9 +200,9 @@ class ViewPlatformRetained extends LeafRetained { viewListDirty = true; } } - + Transform3D getVworldToVpc() { - if (vworldToVpc == null) + if (vworldToVpc == null) vworldToVpc = new Transform3D(); vworldToVpc.set(getCurrentLocalToVworld(null)); vworldToVpc.invert(); @@ -253,9 +253,9 @@ class ViewPlatformRetained extends LeafRetained { lastLocalToVworld = getLastLocalToVworld(); if (lastLocalToVworld.equals(identity)) { - // lastLocalToVworld not yet updated + // lastLocalToVworld not yet updated // for Renderer viewCache when startup - evaluateInitViewPlatformTransform((NodeRetained)this, + evaluateInitViewPlatformTransform((NodeRetained)this, lastLocalToVworld); } } @@ -289,7 +289,7 @@ class ViewPlatformRetained extends LeafRetained { for (int i = views.length-1; i>=0; i--) { views[i].checkView(); } - + super.doSetLive(s); if (inBackgroundGroup) { @@ -305,7 +305,7 @@ class ViewPlatformRetained extends LeafRetained { if (s.viewLists != null) { throw new IllegalSceneGraphException(J3dI18N.getString("ViewPlatformRetained3")); - } + } /* if (false) { System.err.println("setLive: vworldToVpc = "); @@ -315,7 +315,7 @@ class ViewPlatformRetained extends LeafRetained { } */ this.locale = s.locale; - + if (s.transformTargets != null && s.transformTargets[0] != null) { s.transformTargets[0].addNode(this, Targets.VPF_TARGETS); @@ -338,7 +338,7 @@ class ViewPlatformRetained extends LeafRetained { universe.addViewPlatform(this); s.traverseFlags |= NodeRetained.CONTAINS_VIEWPLATFORM; } - + /** * This clearLive routine first calls the superclass's method, then * it deactivates all canvases that are associated with the attached @@ -359,9 +359,9 @@ class ViewPlatformRetained extends LeafRetained { if (s.transformTargets != null && s.transformTargets[0] != null) { s.transformTargets[0].addNode(this, Targets.VPF_TARGETS); s.notifyThreads |= J3dThread.UPDATE_TRANSFORM; - + } - s.notifyThreads |= (J3dThread.UPDATE_BEHAVIOR | + s.notifyThreads |= (J3dThread.UPDATE_BEHAVIOR | J3dThread.SOUND_SCHEDULER); universe.removeViewPlatform(this); } diff --git a/src/classes/share/javax/media/j3d/ViewSpecificGroup.java b/src/classes/share/javax/media/j3d/ViewSpecificGroup.java index e6ba636..63cbeb3 100644 --- a/src/classes/share/javax/media/j3d/ViewSpecificGroup.java +++ b/src/classes/share/javax/media/j3d/ViewSpecificGroup.java @@ -100,7 +100,7 @@ public class ViewSpecificGroup extends Group { */ public ViewSpecificGroup() { // set default read capabilities - setDefaultReadCapabilities(readCapabilities); + setDefaultReadCapabilities(readCapabilities); } @@ -184,9 +184,9 @@ public class ViewSpecificGroup extends Group { if(!this.getCapability(ALLOW_VIEW_WRITE)) throw new CapabilityNotSetException(J3dI18N.getString("ViewSpecificGroup1")); ((ViewSpecificGroupRetained)this.retained).removeView(index); - + } - + /** * Returns an enumeration of this ViewSpecificGroup node's list @@ -220,7 +220,7 @@ public class ViewSpecificGroup extends Group { ((ViewSpecificGroupRetained)this.retained).addView(view); } - + /** * Returns the number of View objects in this node's list of views. * If this number is 0, then the list of views is empty and diff --git a/src/classes/share/javax/media/j3d/ViewSpecificGroupRetained.java b/src/classes/share/javax/media/j3d/ViewSpecificGroupRetained.java index beecd6f..6e8c54f 100644 --- a/src/classes/share/javax/media/j3d/ViewSpecificGroupRetained.java +++ b/src/classes/share/javax/media/j3d/ViewSpecificGroupRetained.java @@ -43,10 +43,10 @@ class ViewSpecificGroupRetained extends GroupRetained { // Used by leaf objects particularly GAs // Updated in a MT Safe manner and also used by RenderBin - ArrayList cachedViewList = new ArrayList(); + ArrayList cachedViewList = new ArrayList(); // The object that contains the dynamic HashKey - a string type object - // Used in scoping + // Used in scoping HashKey tempKey = new HashKey(250); // ArrayList of Integer indices @@ -56,7 +56,7 @@ class ViewSpecificGroupRetained extends GroupRetained { static final int SET_VIEW = 0x1; static final int ADD_VIEW = 0x2; static final int REMOVE_VIEW = 0x4; - + // Construct retained object ViewSpecificGroupRetained() { this.nodeType = NodeRetained.VIEWSPECIFICGROUP; @@ -113,7 +113,7 @@ class ViewSpecificGroupRetained extends GroupRetained { } else { ArrayList parentList = (ArrayList)parentLists.get(0); - + // If the parentList contains this view or if this is the // first VSG then .. if (parentList == null || parentList.contains(view)) { @@ -137,7 +137,7 @@ class ViewSpecificGroupRetained extends GroupRetained { for (int n = 0; n < addLeafList.size(); n++) { System.err.println("n = "+n+" addLeafList = "+addLeafList.get(n)); } - */ + */ J3dMessage message = new J3dMessage(); message.type = J3dMessage.VIEWSPECIFICGROUP_CHANGED; @@ -155,7 +155,7 @@ class ViewSpecificGroupRetained extends GroupRetained { } } - + void setView(View view, int index) { int i; @@ -165,7 +165,7 @@ class ViewSpecificGroupRetained extends GroupRetained { if (oldView == view) return; - + apiViewList.set(index, view); if (source.isLive()) { // Gather all affected leaf nodes and send a message to @@ -188,19 +188,19 @@ class ViewSpecificGroupRetained extends GroupRetained { objAry[4] = oldView; objAry[5] = removeVsgList; objAry[6] = removeLeafList; - + HashKey key = localToVworldKeys[k]; if (oldView != null && (parentList == null || parentList.contains(oldView))) { removeVsgList.add(this); removeKeyList[0] = k; - objAry[7] = super.processViewSpecificInfo(REMOVE_VIEW, (HashKey)key, + objAry[7] = super.processViewSpecificInfo(REMOVE_VIEW, (HashKey)key, oldView, removeVsgList, removeKeyList, removeLeafList); } - + if (view != null && (parentList == null || parentList.contains(view))) { addVsgList.add(this); addKeyList[0] = k; - objAry[3] = super.processViewSpecificInfo(ADD_VIEW, (HashKey)key, + objAry[3] = super.processViewSpecificInfo(ADD_VIEW, (HashKey)key, view, addVsgList, addKeyList, addLeafList); } J3dMessage message = new J3dMessage(); @@ -239,14 +239,14 @@ class ViewSpecificGroupRetained extends GroupRetained { if (oldView != null && (parentList == null || parentList.contains(oldView))) { removeVsgList.add(this); removeKeyList[0] = 0; - objAry[7] = super.processViewSpecificInfo(REMOVE_VIEW, (HashKey)tempKey, + objAry[7] = super.processViewSpecificInfo(REMOVE_VIEW, (HashKey)tempKey, oldView, removeVsgList, removeKeyList, removeLeafList); } if (view != null && (parentList == null || parentList.contains(view))) { tempKey.reset(); addVsgList.add(this); addKeyList[0] = 0; - objAry[3] = super.processViewSpecificInfo(ADD_VIEW, (HashKey)tempKey, + objAry[3] = super.processViewSpecificInfo(ADD_VIEW, (HashKey)tempKey, view, addVsgList, addKeyList, addLeafList); } J3dMessage message = new J3dMessage(); @@ -255,7 +255,7 @@ class ViewSpecificGroupRetained extends GroupRetained { J3dThread.UPDATE_RENDER | J3dThread.UPDATE_SOUND| J3dThread.SOUND_SCHEDULER); - + message.universe = universe; message.args[0] = mtype; message.args[1] = objAry; @@ -264,23 +264,23 @@ class ViewSpecificGroupRetained extends GroupRetained { } - + } int[] processViewSpecificInfo(int mode, HashKey key, View v, ArrayList vsgList, int[] keyList, ArrayList leaflist) { int hkIndex = 0; Integer hashInt = null; int[] newKeyList = null; - // Get the intersection of the viewList with this view, + // Get the intersection of the viewList with this view, if (source.isLive()) { if (inSharedGroup) { hkIndex = key.equals(localToVworldKeys, 0, localToVworldKeys.length); } - + if (mode == ADD_VIEW) { ArrayList parentList = (ArrayList)parentLists.get(hkIndex); - parentList.add(v); + parentList.add(v); } else if (mode == REMOVE_VIEW) { ArrayList parentList = (ArrayList)parentLists.get(hkIndex); @@ -372,7 +372,7 @@ class ViewSpecificGroupRetained extends GroupRetained { } else { ArrayList parentList = (ArrayList)parentLists.get(0); - + // If the parentList contains this view or if this is the // first VSG then .. if (parentList == null || parentList.contains(view)) { @@ -396,7 +396,7 @@ class ViewSpecificGroupRetained extends GroupRetained { for (int n = 0; n < addLeafList.size(); n++) { System.err.println("n = "+n+" addLeafList = "+addLeafList.get(n)); } - */ + */ J3dMessage message = new J3dMessage(); message.type = J3dMessage.VIEWSPECIFICGROUP_CHANGED; @@ -432,12 +432,12 @@ class ViewSpecificGroupRetained extends GroupRetained { ArrayList removeVsgList = new ArrayList(); ArrayList removeLeafList = new ArrayList(); int[] removeKeyList = new int[10]; - + objAry[0] = v; objAry[1] = removeVsgList; objAry[2] = removeLeafList; HashKey key = localToVworldKeys[k]; - + removeVsgList.add(this); removeKeyList[0] = k; @@ -462,7 +462,7 @@ class ViewSpecificGroupRetained extends GroupRetained { } else { ArrayList parentList = (ArrayList)parentLists.get(0); - + // If the parentList contains this view or if this is the // first VSG then .. if (parentList == null || parentList.contains(v)) { @@ -476,7 +476,7 @@ class ViewSpecificGroupRetained extends GroupRetained { objAry[2] = removeLeafList; removeVsgList.add(this); removeKeyList[0] = 0; - + tempKey.reset(); objAry[3] = super.processViewSpecificInfo(REMOVE_VIEW, (HashKey)tempKey, v, @@ -518,7 +518,7 @@ class ViewSpecificGroupRetained extends GroupRetained { int indexOfView(View view) { return apiViewList.indexOf(view); } - + void removeView(View view) { removeView(apiViewList.indexOf(view)); } @@ -529,7 +529,7 @@ class ViewSpecificGroupRetained extends GroupRetained { removeView(0); } } - + void compile(CompileState compState) { super.compile(compState); @@ -538,7 +538,7 @@ class ViewSpecificGroupRetained extends GroupRetained { // XXXX: complete this } - + void setLive(SetLiveState s) { if (inBackgroundGroup) { throw new @@ -556,7 +556,7 @@ class ViewSpecificGroupRetained extends GroupRetained { } super.setLive(s); s.viewLists = savedViewList; - + } void clearLive(SetLiveState s) { @@ -625,7 +625,7 @@ class ViewSpecificGroupRetained extends GroupRetained { // Must be in reverse, to preserve right indexing. for (i = s.keys.length-1; i >= 0; i--) { index = s.keys[i].equals(localToVworldKeys, 0, localToVworldKeys.length); - if(index >= 0) { + if(index >= 0) { s.changedViewGroup.add(this); s.keyList[s.changedViewGroup.size() -1] = index; parentLists.remove(index); @@ -633,10 +633,10 @@ class ViewSpecificGroupRetained extends GroupRetained { } } s.viewLists =viewLists; - super.removeNodeData(s); + super.removeNodeData(s); } - - void updateCachedInformation(int component, View view, int index ) { + + void updateCachedInformation(int component, View view, int index ) { ArrayList list = (ArrayList) cachedViewList.get(index); /* @@ -697,8 +697,8 @@ class ViewSpecificGroupRetained extends GroupRetained { } // Make the VSG's viewLists as the relavant one for its children s.viewLists = viewLists; - - } + + } void setAuxData(SetLiveState s, int index, int hkIndex) { ArrayList vl; @@ -747,7 +747,7 @@ class ViewSpecificGroupRetained extends GroupRetained { else { parentLists.add(hkIndex, null); } - + viewLists.add(hkIndex,vl); s.changedViewGroup.add(this); s.changedViewList.add(vl); @@ -757,8 +757,8 @@ class ViewSpecificGroupRetained extends GroupRetained { else { s.keyList[s.changedViewGroup.size() -1] = 0; } - - + + } diff --git a/src/classes/share/javax/media/j3d/VirtualUniverse.java b/src/classes/share/javax/media/j3d/VirtualUniverse.java index 67c75c3..e7e6ae9 100644 --- a/src/classes/share/javax/media/j3d/VirtualUniverse.java +++ b/src/classes/share/javax/media/j3d/VirtualUniverse.java @@ -127,7 +127,7 @@ public class VirtualUniverse extends Object { // This is a global counter for node id's. long nodeIdCount = 0; - + // This is a global counter for view id's. int viewIdCount = 0; @@ -206,7 +206,7 @@ public class VirtualUniverse extends Object { initMCStructure(); } - + void initMCStructure() { if (geometryStructure != null) { geometryStructure.cleanup(); @@ -341,7 +341,7 @@ public class VirtualUniverse extends Object { if (locale.getVirtualUniverse() != this) { throw new IllegalArgumentException(J3dI18N.getString("VirtualUniverse0")); } - + listOfLocales.removeElement(locale); locale.removeFromUniverse(); if (isEmpty()) { @@ -391,7 +391,7 @@ public class VirtualUniverse extends Object { /** * Returns the enumeration object of all locales in this virtual universe. - * @return the enumeration object + * @return the enumeration object */ public Enumeration getAllLocales() { return this.listOfLocales.elements(); @@ -623,7 +623,7 @@ public class VirtualUniverse extends Object { // BUG 4181362 String getNodeId() { String str; - + if (nodeIdFreeList.size() == 0) { str = Long.toString(nodeIdCount); nodeIdCount++; @@ -712,7 +712,7 @@ public class VirtualUniverse extends Object { if (vps != null) { for (int i=0; i<vps.length; i++) { - vp =(ViewPlatformRetained)vps[i]; + vp =(ViewPlatformRetained)vps[i]; views = vp.getViewList(); for (int j=views.length-1; j>=0; j--) { cvs = views[j].getAllCanvas3Ds(); @@ -739,7 +739,7 @@ public class VirtualUniverse extends Object { if (vps != null) { for (int i=0; i<vps.length; i++) { - vp =(ViewPlatformRetained)vps[i]; + vp =(ViewPlatformRetained)vps[i]; views = vp.getViewList(); for (int j=views.length-1; j>=0; j--) { cvs = views[j].getAllCanvas3Ds(); @@ -765,7 +765,7 @@ public class VirtualUniverse extends Object { if (vps != null) { for (int i=0; i<vps.length; i++) { - vp =(ViewPlatformRetained)vps[i]; + vp =(ViewPlatformRetained)vps[i]; views = vp.getViewList(); for (int j=views.length-1; j>=0; j--) { cvs = views[j].getAllCanvas3Ds(); @@ -792,7 +792,7 @@ public class VirtualUniverse extends Object { if (vps != null) { for (int i=0; i<vps.length; i++) { - vp =(ViewPlatformRetained)vps[i]; + vp =(ViewPlatformRetained)vps[i]; views = vp.getViewList(); for (int j=views.length-1; j>=0; j--) { cvs = views[j].getAllCanvas3Ds(); @@ -819,7 +819,7 @@ public class VirtualUniverse extends Object { if (vps != null) { for (int i=0; i<vps.length; i++) { - vp =(ViewPlatformRetained)vps[i]; + vp =(ViewPlatformRetained)vps[i]; views = vp.getViewList(); for (int j=views.length-1; j>=0; j--) { cvs = views[j].getAllCanvas3Ds(); @@ -846,7 +846,7 @@ public class VirtualUniverse extends Object { if (vps != null) { for (int i=0; i<vps.length; i++) { - vp =(ViewPlatformRetained)vps[i]; + vp =(ViewPlatformRetained)vps[i]; views = vp.getViewList(); for (int j=views.length-1; j>=0; j--) { cvs = views[j].getAllCanvas3Ds(); @@ -872,7 +872,7 @@ public class VirtualUniverse extends Object { if (vps != null) { for (int i=0; i<vps.length; i++) { - vp =(ViewPlatformRetained)vps[i]; + vp =(ViewPlatformRetained)vps[i]; views = vp.getViewList(); for (int j=views.length-1; j>=0; j--) { cvs = views[j].getAllCanvas3Ds(); @@ -899,7 +899,7 @@ public class VirtualUniverse extends Object { if (vps != null) { for (int i=0; i<vps.length; i++) { - vp =(ViewPlatformRetained)vps[i]; + vp =(ViewPlatformRetained)vps[i]; views = vp.getViewList(); for (int j=views.length-1; j>=0; j--) { cvs = views[j].getAllCanvas3Ds(); @@ -925,7 +925,7 @@ public class VirtualUniverse extends Object { if (vps != null) { for (int i=0; i<vps.length; i++) { - vp =(ViewPlatformRetained)vps[i]; + vp =(ViewPlatformRetained)vps[i]; views = vp.getViewList(); for (int j=views.length-1; j>=0; j--) { cvs = views[j].getAllCanvas3Ds(); @@ -951,7 +951,7 @@ public class VirtualUniverse extends Object { if (vps != null) { for (int i=0; i<vps.length; i++) { - vp =(ViewPlatformRetained)vps[i]; + vp =(ViewPlatformRetained)vps[i]; views = vp.getViewList(); for (int j=views.length-1; j>=0; j--) { cvs = views[j].getAllCanvas3Ds(); @@ -977,7 +977,7 @@ public class VirtualUniverse extends Object { if (vps != null) { for (int i=0; i<vps.length; i++) { - vp =(ViewPlatformRetained)vps[i]; + vp =(ViewPlatformRetained)vps[i]; views = vp.getViewList(); for (int j=views.length-1; j>=0; j--) { cvs = views[j].getAllCanvas3Ds(); @@ -993,19 +993,19 @@ public class VirtualUniverse extends Object { } /** - * Sets the "current" view (during view activation) for this virtual + * Sets the "current" view (during view activation) for this virtual * universe. * @param last activated view - */ + */ final void setCurrentView(View view) { this.currentView = view; } /** - * Returns the "current" view (the last view activated for this virtual + * Returns the "current" view (the last view activated for this virtual * universe. * @return last activated view - */ + */ final View getCurrentView() { return this.currentView; } @@ -1055,7 +1055,7 @@ public class VirtualUniverse extends Object { unRegViewWaiting = null; } } - + if (regViewWaiting != null) { while (!VirtualUniverse.mc.isRegistered(regViewWaiting)) { MasterControl.threadYield(); @@ -1065,11 +1065,11 @@ public class VirtualUniverse extends Object { isSceneGraphLock = false; } } - + /** * Adds the specified GraphStructureChangeListener to the set of listeners * that will be notified when the graph structure is changed on a live - * scene graph. If the specifed listener is null no action is taken and no + * scene graph. If the specifed listener is null no action is taken and no * exception is thrown. * * @param listener the listener to add to the set. @@ -1080,16 +1080,16 @@ public class VirtualUniverse extends Object { if (listener == null) { return; } - + if (structureChangeListenerSet == null) { structureChangeListenerSet = new HashSet(); } - + synchronized(structureChangeListenerSet) { structureChangeListenerSet.add(listener); } } - + /** * Removes the specified GraphStructureChangeListener from the set of listeners. This * method performs no function, nor does it throw an exception if the specified listener @@ -1108,7 +1108,7 @@ public class VirtualUniverse extends Object { structureChangeListenerSet.remove(listener); } } - + /** * Processes all live BranchGroup add and removes and notifies * any registered listeners. Used for add and remove @@ -1117,7 +1117,7 @@ public class VirtualUniverse extends Object { if (structureChangeListenerSet == null) { return; } - + synchronized(structureChangeListenerSet) { Iterator<GraphStructureChangeListener> it = structureChangeListenerSet.iterator(); while(it.hasNext()) { @@ -1141,7 +1141,7 @@ public class VirtualUniverse extends Object { } } } - + /** * Processes all live BranchGroup moves and notifies * any registered listeners. Used for moveTo @@ -1273,7 +1273,7 @@ public class VirtualUniverse extends Object { * of listeners is empty, a default listener is notified. The * default listener prints the error information to System.err and * then calls System.exit(). - * + * * @param listener the listener to add to the set. * * @since Java 3D 1.5 @@ -1297,7 +1297,7 @@ public class VirtualUniverse extends Object { * listeners. This method performs no function, nor does it throw * an exception if the specified listener is not currently in the * set or is null. - * + * * @param listener the listener to remove from the set. * * @since Java 3D 1.5 diff --git a/src/classes/share/javax/media/j3d/WakeupAnd.java b/src/classes/share/javax/media/j3d/WakeupAnd.java index 18abf85..b25c2c2 100644 --- a/src/classes/share/javax/media/j3d/WakeupAnd.java +++ b/src/classes/share/javax/media/j3d/WakeupAnd.java @@ -35,8 +35,8 @@ import java.util.Vector; /** * Class specifying any number of wakeup conditions ANDed together. - * This WakeupCondition object specifies that Java 3D should awaken - * this Behavior when all of the WakeupCondition's constituent wakeup + * This WakeupCondition object specifies that Java 3D should awaken + * this Behavior when all of the WakeupCondition's constituent wakeup * criteria become valid. * <p> * Note that a unique WakeupCriterion object must be used @@ -62,20 +62,20 @@ public final class WakeupAnd extends WakeupCondition { // this.conditionsMet[i] = false; } } - + /** * This sets the bit for the given child, then checks if the full condition is met */ void setConditionMet(int id, Boolean checkSchedulingRegion) { conditionsMet[id] = true; - + for (int i=0; i<this.conditionsMet.length; i++) { if (!conditionsMet[i]) { return; } } - + if (parent == null) { super.setConditionMet(this.id, checkSchedulingRegion); } else { @@ -88,14 +88,14 @@ public final class WakeupAnd extends WakeupCondition { */ void buildTree(WakeupCondition parent, int id, BehaviorRetained b) { super.buildTree(parent, id, b); - + for(int i = 0; i < conditions.length; i++) { if (conditions[i] != null) { conditions[i].buildTree(this, i, b); } } } - + /** * This goes through the AndOr tree to remove the various criterion from the * BehaviorStructure lists @@ -106,8 +106,8 @@ public final class WakeupAnd extends WakeupCondition { conditionsMet[i] = false; } } - - + + void reInsertElapseTimeCond() { super.reInsertElapseTimeCond(); for(int i = 0; i < conditions.length; i++) { @@ -119,7 +119,7 @@ public final class WakeupAnd extends WakeupCondition { /** - * This goes through the AndOr tree to remove the various criterion from the + * This goes through the AndOr tree to remove the various criterion from the * BehaviorStructure. */ void resetTree() { @@ -130,5 +130,5 @@ public final class WakeupAnd extends WakeupCondition { } } } - + } diff --git a/src/classes/share/javax/media/j3d/WakeupAndOfOrs.java b/src/classes/share/javax/media/j3d/WakeupAndOfOrs.java index 3d2b611..c1b0fa4 100644 --- a/src/classes/share/javax/media/j3d/WakeupAndOfOrs.java +++ b/src/classes/share/javax/media/j3d/WakeupAndOfOrs.java @@ -35,8 +35,8 @@ import java.util.Vector; /** * Class specifying any number of OR wakeup conditions ANDed together. - * This WakeupCondition object specifies that Java 3D should awaken this - * Behavior when all of the WakeupCondition's constituent WakeupOr + * This WakeupCondition object specifies that Java 3D should awaken this + * Behavior when all of the WakeupCondition's constituent WakeupOr * conditions become valid. * <p> * Note that a unique WakeupCriterion object must be used for each @@ -63,41 +63,41 @@ public final class WakeupAndOfOrs extends WakeupCondition { // this.conditionsMet[i] = false; } } - + /** * This sets the bit for the given child, then checks if the full condition is met */ void setConditionMet(int id, Boolean checkSchedulingRegion) { conditionsMet[id] = true; - + for (int i=0; i<this.conditionsMet.length; i++) { if (!conditionsMet[i]) { return; } } - + if (parent == null) { super.setConditionMet(this.id, checkSchedulingRegion); } else { parent.setConditionMet(this.id, checkSchedulingRegion); } } - + /** * This gets called when this condition is added to the AndOr tree. */ void buildTree(WakeupCondition parent, int id, BehaviorRetained b) { - + super.buildTree(parent, id, b); - + for(int i = 0; i < conditions.length; i++) { if (conditions[i] != null) { conditions[i].buildTree(this, i, b); } } } - + /** * This goes through the AndOr tree to remove the various criterion from the * BehaviorStructure lists @@ -109,7 +109,7 @@ public final class WakeupAndOfOrs extends WakeupCondition { } } - + void reInsertElapseTimeCond() { super.reInsertElapseTimeCond(); for(int i = 0; i < conditions.length; i++) { @@ -120,7 +120,7 @@ public final class WakeupAndOfOrs extends WakeupCondition { } /** - * This goes through the AndOr tree to remove the various criterion from the + * This goes through the AndOr tree to remove the various criterion from the * BehaviorStructure. */ void resetTree() { @@ -131,5 +131,5 @@ public final class WakeupAndOfOrs extends WakeupCondition { } } } - + } diff --git a/src/classes/share/javax/media/j3d/WakeupCondition.java b/src/classes/share/javax/media/j3d/WakeupCondition.java index 2ea6a4f..5c4de1c 100644 --- a/src/classes/share/javax/media/j3d/WakeupCondition.java +++ b/src/classes/share/javax/media/j3d/WakeupCondition.java @@ -37,7 +37,7 @@ import java.util.Enumeration; * An abstract class specifying a single wakeup Condition. This class * is extended by the WakeupCriterion, WakeupOr, WakeupAnd, * WakeupOrOfAnds, and WakeupAndOfOr classes. A Behavior node hands a - * WakeupCondition object to the behavior scheduler and the behavior + * WakeupCondition object to the behavior scheduler and the behavior * scheduler hands back an enumeration of that WakeupCondition. */ @@ -50,12 +50,12 @@ public abstract class WakeupCondition extends Object { * This boolean indicates whether this condition has been fully met. */ boolean conditionMet = false; - + /** * This points to the parent of this criterion in the AndOr tree */ WakeupCondition parent = null; - + /** * The location of this criterion in the parents array. */ @@ -65,7 +65,7 @@ public abstract class WakeupCondition extends Object { * The BehaviorRetained node that is using this condition */ BehaviorRetained behav = null; - + /** * This is the allElements enumerator */ @@ -90,7 +90,7 @@ public abstract class WakeupCondition extends Object { } return allEnum; } - + /** * Returns an enumeration of all triggered WakeupCriterias in this Condition. */ @@ -103,7 +103,7 @@ public abstract class WakeupCondition extends Object { return trigEnum; } - /** + /** * this sets the conditionMet flag. */ void setConditionMet(int id, Boolean checkSchedulingRegion) { @@ -120,7 +120,7 @@ public abstract class WakeupCondition extends Object { VirtualUniverse.mc.processMessage(message); } } - + /** * Initialize And/Or tree and add criterion to the BehaviourStructure */ @@ -132,7 +132,7 @@ public abstract class WakeupCondition extends Object { } /** - * This goes through the AndOr tree to remove the various criterion from the + * This goes through the AndOr tree to remove the various criterion from the * BehaviorStructure. * We can't use behav.universe.behaviorStructure since behav * may reassign to another universe at this time. diff --git a/src/classes/share/javax/media/j3d/WakeupCriteriaEnumerator.java b/src/classes/share/javax/media/j3d/WakeupCriteriaEnumerator.java index b062c26..1638f97 100644 --- a/src/classes/share/javax/media/j3d/WakeupCriteriaEnumerator.java +++ b/src/classes/share/javax/media/j3d/WakeupCriteriaEnumerator.java @@ -105,7 +105,7 @@ class WakeupCriteriaEnumerator implements Enumeration { for (i=0; i<condOrOfAnds.conditions.length; i++) { for (j=0; j<condOrOfAnds.conditions[i].conditions.length; j++) { - if (condOrOfAnds.conditions[i].conditions[j].triggered || + if (condOrOfAnds.conditions[i].conditions[j].triggered || type == WakeupCondition.ALL_ELEMENTS) { criterion[length++] = condOrOfAnds.conditions[i].conditions[j]; } @@ -125,7 +125,7 @@ class WakeupCriteriaEnumerator implements Enumeration { for (i=0; i<condAndOfOrs.conditions.length; i++) { for (j=0; j<condAndOfOrs.conditions[i].conditions.length; j++) { - if (condAndOfOrs.conditions[i].conditions[j].triggered || + if (condAndOfOrs.conditions[i].conditions[j].triggered || type == WakeupCondition.ALL_ELEMENTS) { criterion[length++] = condAndOfOrs.conditions[i].conditions[j]; } diff --git a/src/classes/share/javax/media/j3d/WakeupCriterion.java b/src/classes/share/javax/media/j3d/WakeupCriterion.java index d3ce41f..2e55b02 100644 --- a/src/classes/share/javax/media/j3d/WakeupCriterion.java +++ b/src/classes/share/javax/media/j3d/WakeupCriterion.java @@ -34,9 +34,9 @@ package javax.media.j3d; /** * An abstract class specifying a singleton wakeup Criterion. This * class consists of several subclasses, each of which specifies one - * particular wakeup criterion, that criterion's associated arguments - * (if any), and either a flag that indicates whether this criterion - * caused a Behavior object to awaken or a return field containing the + * particular wakeup criterion, that criterion's associated arguments + * (if any), and either a flag that indicates whether this criterion + * caused a Behavior object to awaken or a return field containing the * information that caused the Behavior object to awaken. * <p> * Note that a unique WakeupCriterion object must be used with each instance @@ -61,7 +61,7 @@ public abstract class WakeupCriterion extends WakeupCondition { public boolean hasTriggered(){ return this.triggered; } - + /** * Set the Criterion's trigger flag to true. */ @@ -76,7 +76,7 @@ public abstract class WakeupCriterion extends WakeupCondition { /** * Initialize And/Or tree and add criterion to the BehaviourStructure. - * + * */ void buildTree(WakeupCondition parent, int id, BehaviorRetained b) { super.buildTree(parent, id, b); @@ -86,7 +86,7 @@ public abstract class WakeupCriterion extends WakeupCondition { /** - * This goes through the AndOr tree to remove the various criterion from the + * This goes through the AndOr tree to remove the various criterion from the * BehaviorStructure. * We can't use behav.universe.behaviorStructure since behav * may reassign to another universe at this time. @@ -95,11 +95,11 @@ public abstract class WakeupCriterion extends WakeupCondition { void cleanTree(BehaviorStructure bs){ conditionMet = false; removeBehaviorCondition(bs); - }; + }; /** - * This goes through the AndOr tree to reset various criterion. + * This goes through the AndOr tree to reset various criterion. */ void resetTree() { conditionMet = false; @@ -108,14 +108,14 @@ public abstract class WakeupCriterion extends WakeupCondition { } /** - * This is a callback from BehaviorStructure. It is + * This is a callback from BehaviorStructure. It is * used to add wakeupCondition to behavior structure. */ abstract void addBehaviorCondition(BehaviorStructure bs); /** - * This is a callback from BehaviorStructure. It is + * This is a callback from BehaviorStructure. It is * used to remove wakeupCondition from behavior structure. */ abstract void removeBehaviorCondition(BehaviorStructure bs); diff --git a/src/classes/share/javax/media/j3d/WakeupIndexedList.java b/src/classes/share/javax/media/j3d/WakeupIndexedList.java index 68be0fd..e8c3058 100644 --- a/src/classes/share/javax/media/j3d/WakeupIndexedList.java +++ b/src/classes/share/javax/media/j3d/WakeupIndexedList.java @@ -36,7 +36,7 @@ package javax.media.j3d; * All operations remove(WakeupCondition), add(WakeupCondition), * contains(WakeupCondition) etc. take O(1) time. * The class is designed to optimize speed. So many reductance - * procedures call and range check as found in ArrayList are + * procedures call and range check as found in ArrayList are * removed. * * <p> @@ -89,7 +89,7 @@ class WakeupIndexedList implements Cloneable, java.io.Serializable { * set(), remove() when -O flag turn on. */ transient WakeupCondition elementData[]; - + /** * Clone copy of elementData return by toArray(true); */ @@ -183,9 +183,9 @@ class WakeupIndexedList implements Cloneable, java.io.Serializable { final int size() { return size; } - + /** - * Returns the size of entry use in toArray() number of elements + * Returns the size of entry use in toArray() number of elements * in this list. * * @return the number of elements in this list. @@ -215,8 +215,8 @@ class WakeupIndexedList implements Cloneable, java.io.Serializable { /** - * Searches for the last occurence of the given argument, testing - * for equality using the <tt>equals</tt> method. + * Searches for the last occurence of the given argument, testing + * for equality using the <tt>equals</tt> method. * * @param o an object. * @return the index of the first occurrence of the argument in this @@ -234,14 +234,14 @@ class WakeupIndexedList implements Cloneable, java.io.Serializable { * @return a clone of this <tt>ArrayList</tt> instance. */ synchronized protected final Object clone() { - try { + try { WakeupIndexedList v = (WakeupIndexedList)super.clone(); v.elementData = (WakeupCondition[])java.lang.reflect.Array.newInstance( componentType, size); System.arraycopy(elementData, 0, v.elementData, 0, size); isDirty = true; // can't use the old cloneData reference return v; - } catch (CloneNotSupportedException e) { + } catch (CloneNotSupportedException e) { // this shouldn't happen, since we are Cloneable throw new InternalError(); } @@ -251,7 +251,7 @@ class WakeupIndexedList implements Cloneable, java.io.Serializable { /** * Returns an array containing all of the elements in this list. * The size of the array may longer than the actual size. Use - * arraySize() to retrieve the size. + * arraySize() to retrieve the size. * The array return is a copied of internal array. if copy * is true. * @@ -273,13 +273,13 @@ class WakeupIndexedList implements Cloneable, java.io.Serializable { cloneSize = size; return elementData; } - + } /** * Returns an array containing all of the elements in this list. * The size of the array may longer than the actual size. Use - * arraySize() to retrieve the size. + * arraySize() to retrieve the size. * The array return is a copied of internal array. So another * thread can continue add/delete the current list. However, * it should be noticed that two call to toArray() may return @@ -294,10 +294,10 @@ class WakeupIndexedList implements Cloneable, java.io.Serializable { /** * Returns an array containing elements starting from startElement - * all of the elements in this list. A new array of exact size + * all of the elements in this list. A new array of exact size * is always allocated. * - * @param startElement starting element to copy + * @param startElement starting element to copy * * @return an array containing elements starting from * startElement, null if element not found. @@ -329,7 +329,7 @@ class WakeupIndexedList implements Cloneable, java.io.Serializable { System.arraycopy(oldData, 0, elementData, 0, size); } } - + // Positional Access Operations @@ -367,7 +367,7 @@ class WakeupIndexedList implements Cloneable, java.io.Serializable { if (debug) { if (o.listIdx[univIdx][listType] != -1) { - System.err.println("Illegal use of UnorderIndexedList idx in set " + + System.err.println("Illegal use of UnorderIndexedList idx in set " + o.listIdx[univIdx][listType]); Thread.dumpStack(); } @@ -393,7 +393,7 @@ class WakeupIndexedList implements Cloneable, java.io.Serializable { System.arraycopy(oldData, 0, elementData, 0, size); } - + int univIdx = o.behav.getIdxUsed(univ); // System.err.println(this + " add " + o + " univ " + univIdx); if (debug) { @@ -412,7 +412,7 @@ class WakeupIndexedList implements Cloneable, java.io.Serializable { isDirty = true; } - + /** * Removes the element at the specified position in this list. * Replace the removed element by the last one. @@ -427,19 +427,19 @@ class WakeupIndexedList implements Cloneable, java.io.Serializable { if (debug) { if (elm.listIdx[univIdx][listType] != index) { - System.err.println("Inconsistent idx in remove, expect " + index + + System.err.println("Inconsistent idx in remove, expect " + index + " actual " + elm.listIdx[univIdx][listType]); - Thread.dumpStack(); - } + Thread.dumpStack(); + } } elm.listIdx[univIdx][listType] = -1; size--; if (index != size) { - elm = elementData[size]; + elm = elementData[size]; elm.listIdx[univIdx][listType] = index; elementData[index] = elm; - } + } elementData[size] = null; isDirty = true; /* @@ -449,7 +449,7 @@ class WakeupIndexedList implements Cloneable, java.io.Serializable { */ } - + /** * Removes the element at the last position in this list. * @return The element remove @@ -502,7 +502,7 @@ class WakeupIndexedList implements Cloneable, java.io.Serializable { o.listIdx[univIdx][listType] = -1; isDirty = true; return true; - } + } return false; } @@ -544,7 +544,7 @@ class WakeupIndexedList implements Cloneable, java.io.Serializable { StringBuffer sb = new StringBuffer(hashCode() + " Size = " + size + "["); int len = size-1; Object obj; - + for (int i=0; i < size; i++) { obj = elementData[i]; if (obj != null) { diff --git a/src/classes/share/javax/media/j3d/WakeupOnAWTEvent.java b/src/classes/share/javax/media/j3d/WakeupOnAWTEvent.java index 6627616..34a42ad 100644 --- a/src/classes/share/javax/media/j3d/WakeupOnAWTEvent.java +++ b/src/classes/share/javax/media/j3d/WakeupOnAWTEvent.java @@ -54,7 +54,7 @@ public final class WakeupOnAWTEvent extends WakeupCriterion { /** * Constructs a new WakeupOnAWTEvent object that informs the Java 3D - * scheduler to wake up the specified Behavior object whenever the + * scheduler to wake up the specified Behavior object whenever the * specified AWT event occurs. * @param AWTId the AWT ids that this behavior wishes to intercept */ @@ -87,7 +87,7 @@ public final class WakeupOnAWTEvent extends WakeupCriterion { synchronized (events) { eventArray = new AWTEvent[events.size()]; events.copyInto(eventArray); - events.removeAllElements(); + events.removeAllElements(); } return eventArray; @@ -103,9 +103,9 @@ public final class WakeupOnAWTEvent extends WakeupCriterion { this.setTriggered(); } - + /** - * This is a callback from BehaviorStructure. It is + * This is a callback from BehaviorStructure. It is * used to add wakeupCondition to behavior structure. */ void addBehaviorCondition(BehaviorStructure bs) { @@ -115,7 +115,7 @@ public final class WakeupOnAWTEvent extends WakeupCriterion { /** - * This is a callback from BehaviorStructure. It is + * This is a callback from BehaviorStructure. It is * used to remove wakeupCondition from behavior structure. */ void removeBehaviorCondition(BehaviorStructure bs) { @@ -141,9 +141,9 @@ public final class WakeupOnAWTEvent extends WakeupCriterion { (EventMask & AWTEvent.KEY_EVENT_MASK) != 0) { behav.universe.enableKeyEvents(); } - if ((AwtId >= MouseEvent.MOUSE_FIRST) && + if ((AwtId >= MouseEvent.MOUSE_FIRST) && (AwtId <= MouseEvent.MOUSE_LAST)) { - if ((AwtId == MouseEvent.MOUSE_DRAGGED) || + if ((AwtId == MouseEvent.MOUSE_DRAGGED) || (AwtId == MouseEvent.MOUSE_MOVED)) { behav.universe.enableMouseMotionEvents(); } diff --git a/src/classes/share/javax/media/j3d/WakeupOnActivation.java b/src/classes/share/javax/media/j3d/WakeupOnActivation.java index c977c92..67262a9 100644 --- a/src/classes/share/javax/media/j3d/WakeupOnActivation.java +++ b/src/classes/share/javax/media/j3d/WakeupOnActivation.java @@ -35,7 +35,7 @@ package javax.media.j3d; * Class specifying a wakeup the first time an active Viewplatform's * activation * volume intersects with this object's scheduling region. - * This gives the behavior an explicit means of executing code when + * This gives the behavior an explicit means of executing code when * it is activated. */ public final class WakeupOnActivation extends WakeupCriterion { @@ -54,7 +54,7 @@ public final class WakeupOnActivation extends WakeupCriterion { } /** - * This is a callback from BehaviorStructure. It is + * This is a callback from BehaviorStructure. It is * used to add wakeupCondition to behavior structure. */ void addBehaviorCondition(BehaviorStructure bs) { @@ -65,7 +65,7 @@ public final class WakeupOnActivation extends WakeupCriterion { /** - * This is a callback from BehaviorStructure. It is + * This is a callback from BehaviorStructure. It is * used to remove wakeupCondition from behavior structure. */ void removeBehaviorCondition(BehaviorStructure bs) { diff --git a/src/classes/share/javax/media/j3d/WakeupOnBehaviorPost.java b/src/classes/share/javax/media/j3d/WakeupOnBehaviorPost.java index 1018222..4de3977 100644 --- a/src/classes/share/javax/media/j3d/WakeupOnBehaviorPost.java +++ b/src/classes/share/javax/media/j3d/WakeupOnBehaviorPost.java @@ -50,10 +50,10 @@ public final class WakeupOnBehaviorPost extends WakeupCriterion { /** * Constructs a new WakeupOnBehaviorPost criterion. A behavior of null * specifies a wakeup from any behavior on the specified postId. A postId - * of 0 specifies a wakeup on any postId from the specified behavior. + * of 0 specifies a wakeup on any postId from the specified behavior. * A behavior of null AND a postId of 0 specify a wakeup on any postId * from any behavior. - * @param behavior the behavior that must be the source of the post, + * @param behavior the behavior that must be the source of the post, * if behavior == null, then any behavior posting the postId will cause * the wakeup. * @param postId the postId that will trigger a wakeup if posted by the @@ -67,7 +67,7 @@ public final class WakeupOnBehaviorPost extends WakeupCriterion { triggeringBehavior = null; WakeupIndexedList.init(this, TOTAL_INDEXED_UNORDER_SET_TYPES); } - + /** * Retrieve the WakeupCriterion's specified postId * @return the post id specified in this object's construction. @@ -88,8 +88,8 @@ public final class WakeupOnBehaviorPost extends WakeupCriterion { /** * Returns the postId that caused the behavior to wakeup. If the postId - * used to construct this wakeup criterion was not zero, then the - * triggering postId will always be equal to the postId used in the + * used to construct this wakeup criterion was not zero, then the + * triggering postId will always be equal to the postId used in the * constructor. */ public int getTriggeringPostId() { @@ -98,17 +98,17 @@ public final class WakeupOnBehaviorPost extends WakeupCriterion { /** - * Returns the behavior that triggered this wakeup. If the arming - * behavior used to construct this object was not null, then the + * Returns the behavior that triggered this wakeup. If the arming + * behavior used to construct this object was not null, then the * triggering behavior will be the same as the arming behavior. */ public Behavior getTriggeringBehavior() { return triggeringBehavior; } - + /** - * This is a callback from BehaviorStructure. It is + * This is a callback from BehaviorStructure. It is * used to add wakeupCondition to behavior structure. */ void addBehaviorCondition(BehaviorStructure bs) { @@ -117,7 +117,7 @@ public final class WakeupOnBehaviorPost extends WakeupCriterion { /** - * This is a callback from BehaviorStructure. It is + * This is a callback from BehaviorStructure. It is * used to remove wakeupCondition from behavior structure. */ void removeBehaviorCondition(BehaviorStructure bs) { diff --git a/src/classes/share/javax/media/j3d/WakeupOnCollisionEntry.java b/src/classes/share/javax/media/j3d/WakeupOnCollisionEntry.java index 95733cf..651f847 100644 --- a/src/classes/share/javax/media/j3d/WakeupOnCollisionEntry.java +++ b/src/classes/share/javax/media/j3d/WakeupOnCollisionEntry.java @@ -35,7 +35,7 @@ import java.util.*; /** * Class specifying a wakeup when the specified object - * collides with any other object in the scene graph. + * collides with any other object in the scene graph. * */ public final class WakeupOnCollisionEntry extends WakeupCriterion { @@ -72,7 +72,7 @@ public final class WakeupOnCollisionEntry extends WakeupCriterion { // Cached the arming Node being used when it is not BOUND NodeRetained armingNode; - // A transformed Bounds of Group/Bounds, use by + // A transformed Bounds of Group/Bounds, use by // BOUND, GROUP Bounds vwcBounds = null; @@ -91,19 +91,19 @@ public final class WakeupOnCollisionEntry extends WakeupCriterion { SceneGraphPath armingPath = null; Bounds armingBounds = null; - + // the following two references are set only after a collision // has occurred Bounds collidingBounds = null; SceneGraphPath collidingPath = null; /** - * Constructs a new WakeupOnCollisionEntry criterion with + * Constructs a new WakeupOnCollisionEntry criterion with * USE_BOUNDS for a speed hint. * @param armingPath the path used to <em>arm</em> collision * detection - * @exception IllegalArgumentException if object associated with the - * SceneGraphPath is other than a Group, Shape3D, Morph, or + * @exception IllegalArgumentException if object associated with the + * SceneGraphPath is other than a Group, Shape3D, Morph, or * BoundingLeaf node. */ public WakeupOnCollisionEntry(SceneGraphPath armingPath) { @@ -118,11 +118,11 @@ public final class WakeupOnCollisionEntry extends WakeupCriterion { * accurately Java 3D will perform collision detection * @exception IllegalArgumentException if hint is not one of * USE_GEOMETRY or USE_BOUNDS. - * @exception IllegalArgumentException if object associated with the - * SceneGraphPath is other than a Group, Shape3D, Morph, or + * @exception IllegalArgumentException if object associated with the + * SceneGraphPath is other than a Group, Shape3D, Morph, or * BoundingLeaf node. */ - public WakeupOnCollisionEntry(SceneGraphPath armingPath, + public WakeupOnCollisionEntry(SceneGraphPath armingPath, int speedHint) { this(new SceneGraphPath(armingPath), speedHint, null); } @@ -133,7 +133,7 @@ public final class WakeupOnCollisionEntry extends WakeupCriterion { * <em>arm</em> collision detection * @exception IllegalArgumentException if object is under a * SharedGroup node or object is other than a Group, Shape3D, - * Morph or BoundingLeaf node. + * Morph or BoundingLeaf node. */ public WakeupOnCollisionEntry(Node armingNode) { this(armingNode, USE_BOUNDS); @@ -149,7 +149,7 @@ public final class WakeupOnCollisionEntry extends WakeupCriterion { * USE_GEOMETRY or USE_BOUNDS. * @exception IllegalArgumentException if object is under a * SharedGroup node or object is other than a Group, Shape3D, - * Morph or BoundingLeaf node. + * Morph or BoundingLeaf node. */ public WakeupOnCollisionEntry(Node armingNode, int speedHint) { this(new SceneGraphPath(null, armingNode), speedHint, null); @@ -175,16 +175,16 @@ public final class WakeupOnCollisionEntry extends WakeupCriterion { * detection * @exception IllegalArgumentException if hint is not one of * USE_GEOMETRY or USE_BOUNDS. - * @exception IllegalArgumentException if object associated with the - * SceneGraphPath is other than a Group, Shape3D, Morph, or + * @exception IllegalArgumentException if object associated with the + * SceneGraphPath is other than a Group, Shape3D, Morph, or * BoundingLeaf node. */ - WakeupOnCollisionEntry(SceneGraphPath armingPath, + WakeupOnCollisionEntry(SceneGraphPath armingPath, int speedHint, Bounds armingBounds) { if (armingPath != null) { this.armingNode = (NodeRetained) armingPath.getObject().retained; - nodeType = getNodeType(armingNode, armingPath, - "WakeupOnCollisionEntry"); + nodeType = getNodeType(armingNode, armingPath, + "WakeupOnCollisionEntry"); this.armingPath = armingPath; validateSpeedHint(speedHint, "WakeupOnCollisionEntry4"); } else { @@ -201,7 +201,7 @@ public final class WakeupOnCollisionEntry extends WakeupCriterion { * criterion---null implies that a bounds object armed this criteria */ public SceneGraphPath getArmingPath() { - return (armingPath != null ? + return (armingPath != null ? new SceneGraphPath(armingPath) : null); } @@ -211,7 +211,7 @@ public final class WakeupOnCollisionEntry extends WakeupCriterion { * criterion---null implies that a SceneGraphPath armed this criteria */ public Bounds getArmingBounds() { - return (armingBounds != null ? + return (armingBounds != null ? (Bounds)armingBounds.clone() : null); } @@ -239,7 +239,7 @@ public final class WakeupOnCollisionEntry extends WakeupCriterion { /** * Retrieves the Bounds object that caused the collision * @return the colliding Bounds object. - * @exception IllegalStateException if not called from within the + * @exception IllegalStateException if not called from within the * a behavior's processStimulus method which was awoken by a collision. */ public Bounds getTriggeringBounds() { @@ -263,11 +263,11 @@ public final class WakeupOnCollisionEntry extends WakeupCriterion { * throw Exception if node is not legal. * @return nodeType */ - static int getNodeType(NodeRetained armingNode, + static int getNodeType(NodeRetained armingNode, SceneGraphPath armingPath, String s) throws IllegalArgumentException { - // check if SceneGraphPath is unique + // check if SceneGraphPath is unique // Note that graph may not live at this point so we // can't use node.inSharedGroup. if (!armingPath.validate()) { @@ -277,7 +277,7 @@ public final class WakeupOnCollisionEntry extends WakeupCriterion { if (armingNode.inBackgroundGroup) { throw new IllegalArgumentException(J3dI18N.getString(s + "1")); } - + // This should come before Shape3DRetained check if (armingNode instanceof OrientedShape3DRetained) { return ORIENTEDSHAPE3D; @@ -294,7 +294,7 @@ public final class WakeupOnCollisionEntry extends WakeupCriterion { if (armingNode instanceof GroupRetained) { return GROUP; } - + if (armingNode instanceof BoundingLeafRetained) { return BOUNDINGLEAF; } @@ -306,7 +306,7 @@ public final class WakeupOnCollisionEntry extends WakeupCriterion { * speedHint legality checker * throw Exception if speedHint is not legal */ - static void validateSpeedHint(int speedHint, String s) + static void validateSpeedHint(int speedHint, String s) throws IllegalArgumentException { if ((speedHint != USE_GEOMETRY) && (speedHint != USE_BOUNDS)) { throw new IllegalArgumentException(J3dI18N.getString(s)); @@ -316,11 +316,11 @@ public final class WakeupOnCollisionEntry extends WakeupCriterion { /** - * This is a callback from BehaviorStructure. It is + * This is a callback from BehaviorStructure. It is * used to add wakeupCondition to behavior structure. */ void addBehaviorCondition(BehaviorStructure bs) { - + switch (nodeType) { case SHAPE: // Use geometryAtoms[].collisionBounds case ORIENTEDSHAPE3D: @@ -330,7 +330,7 @@ public final class WakeupOnCollisionEntry extends WakeupCriterion { if (geometryAtoms == null) { geometryAtoms = new UnorderList(1, GeometryAtom.class); } - Shape3DRetained shape = (Shape3DRetained) armingNode; + Shape3DRetained shape = (Shape3DRetained) armingNode; geometryAtoms.add(Shape3DRetained.getGeomAtom(shape.getMirrorShape(armingPath))); break; case MORPH: // Use geometryAtoms[].collisionBounds @@ -362,16 +362,16 @@ public final class WakeupOnCollisionEntry extends WakeupCriterion { geometryAtoms = new UnorderList(1, GeometryAtom.class); } ((GroupRetained) armingNode).searchGeometryAtoms(geometryAtoms); - } + } // else use this.vwcBounds - default: + default: } behav.universe.geometryStructure.addWakeupOnCollision(this); } /** - * This is a callback from BehaviorStructure. It is + * This is a callback from BehaviorStructure. It is * used to remove wakeupCondition from behavior structure. */ void removeBehaviorCondition(BehaviorStructure bs) { @@ -384,21 +384,21 @@ public final class WakeupOnCollisionEntry extends WakeupCriterion { } - // Set collidingPath & collidingBounds + // Set collidingPath & collidingBounds void setTarget(BHLeafInterface leaf) { SceneGraphPath path; Bounds bound; - + if (leaf instanceof GeometryAtom) { // Find the triggered Path & Bounds for this geometry Atom GeometryAtom geomAtom = (GeometryAtom) leaf; Shape3DRetained shape = geomAtom.source; - path = getSceneGraphPath(shape.sourceNode, + path = getSceneGraphPath(shape.sourceNode, shape.key, shape.getCurrentLocalToVworld(0)); bound = getTriggeringBounds(shape); - + } else { // Find the triggered Path & Bounds for this alternative // collision target @@ -414,7 +414,7 @@ public final class WakeupOnCollisionEntry extends WakeupCriterion { collidingBounds = bound; } } - + // Invoke from GeometryStructure to update vwcBounds of GROUP void updateCollisionBounds(boolean reEvaluateGAs){ @@ -426,21 +426,21 @@ public final class WakeupOnCollisionEntry extends WakeupCriterion { // this may involve recursive tree traverse if // BoundsAutoCompute is true, we can't avoid // since the bound under it may change by transform - vwcBounds = group.getEffectiveBounds(); + vwcBounds = group.getEffectiveBounds(); } group.transformBounds(armingPath, vwcBounds); } else if (nodeType == BOUND) { vwcBounds.transform(armingBounds, behav.getCurrentLocalToVworld()); } - - if (reEvaluateGAs && - (nodeType == GROUP) && + + if (reEvaluateGAs && + (nodeType == GROUP) && (accuracyMode == USE_GEOMETRY)) { geometryAtoms.clear(); - ((GroupRetained) armingNode).searchGeometryAtoms(geometryAtoms); + ((GroupRetained) armingNode).searchGeometryAtoms(geometryAtoms); } - } - + } + /** * Return the TriggeringBounds for node @@ -451,19 +451,19 @@ public final class WakeupOnCollisionEntry extends WakeupCriterion { if (node instanceof Shape3DRetained) { Shape3DRetained shape = (Shape3DRetained) node; if (shape.collisionBound == null) { - // TODO: get bounds by copy + // TODO: get bounds by copy return shape.getEffectiveBounds(); - } - return shape.collisionBound; - } + } + return shape.collisionBound; + } MorphRetained morph = (MorphRetained) node; if (morph.collisionBound == null) { - // TODO: get bounds by copy + // TODO: get bounds by copy return morph.getEffectiveBounds(); - } - return morph.collisionBound; + } + return morph.collisionBound; } @@ -472,10 +472,10 @@ public final class WakeupOnCollisionEntry extends WakeupCriterion { */ static Bounds getTriggeringBounds(GroupRetained group) { if (group.collisionBound == null) { - // TODO: get bounds by copy + // TODO: get bounds by copy return group.getEffectiveBounds(); - } - return group.collisionBound; + } + return group.collisionBound; } static SceneGraphPath getSceneGraphPath(GroupRetained group) { @@ -501,7 +501,7 @@ public final class WakeupOnCollisionEntry extends WakeupCriterion { } /** - * return the SceneGraphPath of the geomAtom. + * return the SceneGraphPath of the geomAtom. * Find the alternative Collision target closest to the locale. */ static SceneGraphPath getSceneGraphPath(NodeRetained startNode, @@ -516,7 +516,7 @@ public final class WakeupOnCollisionEntry extends WakeupCriterion { String nodeId; Vector parents; NodeRetained linkR; - + if (nodeR.inSharedGroup) { // getlastNodeId() will destroy this key if (key != null) { @@ -525,14 +525,14 @@ public final class WakeupOnCollisionEntry extends WakeupCriterion { key = new HashKey(startNode.localToVworldKeys[0]); } } - + do { if (nodeR.source.getCapability(Node.ENABLE_COLLISION_REPORTING)){ - path.add(nodeR.source); + path.add(nodeR.source); } if (nodeR instanceof SharedGroupRetained) { - + // retrieve the last node ID nodeId = key.getLastNodeId(); parents = ((SharedGroupRetained) nodeR).parents; @@ -563,14 +563,14 @@ public final class WakeupOnCollisionEntry extends WakeupCriterion { } nodeR = nodeR.parent; } while (nodeR != null); // reach Locale - + Node nodes[]; if (target == startNode) { // in most case nodes = (Node []) path.toArray(false); } else { // alternativeCollisionTarget is set nodes = (Node []) path.toArray(target); } - SceneGraphPath sgpath = new SceneGraphPath(locale, + SceneGraphPath sgpath = new SceneGraphPath(locale, nodes, (Node) target.source); sgpath.setTransform(transform); diff --git a/src/classes/share/javax/media/j3d/WakeupOnCollisionExit.java b/src/classes/share/javax/media/j3d/WakeupOnCollisionExit.java index 83b8ea8..cf22d4e 100644 --- a/src/classes/share/javax/media/j3d/WakeupOnCollisionExit.java +++ b/src/classes/share/javax/media/j3d/WakeupOnCollisionExit.java @@ -63,7 +63,7 @@ public final class WakeupOnCollisionExit extends WakeupCriterion { // Cached the arming Node being used when it is not BOUND NodeRetained armingNode; - // A transformed Bounds of Group/Bounds + // A transformed Bounds of Group/Bounds // use by BOUND, GROUP Bounds vwcBounds; @@ -80,7 +80,7 @@ public final class WakeupOnCollisionExit extends WakeupCriterion { * Only use by SHAPE, MORPH, GROUP, ORIENTEDSHAPE */ UnorderList geometryAtoms = null; - + // one of GROUP, BOUNDINGLEAF, SHAPE, MORPH, BOUND int nodeType; @@ -124,7 +124,7 @@ public final class WakeupOnCollisionExit extends WakeupCriterion { * <em>arm</em> collision detection * @exception IllegalArgumentException if object is under a * SharedGroup node or object is other than a Group, Shape3D, - * Morph or BoundingLeaf node. + * Morph or BoundingLeaf node. */ public WakeupOnCollisionExit(Node armingNode) { this(armingNode, USE_BOUNDS); @@ -140,7 +140,7 @@ public final class WakeupOnCollisionExit extends WakeupCriterion { * USE_GEOMETRY or USE_BOUNDS. * @exception IllegalArgumentException if object is under a * SharedGroup node or object is other than a Group, Shape3D, - * Morph or BoundingLeaf node. + * Morph or BoundingLeaf node. */ public WakeupOnCollisionExit(Node armingNode, int speedHint) { this(new SceneGraphPath(null, armingNode), speedHint, null); @@ -169,7 +169,7 @@ public final class WakeupOnCollisionExit extends WakeupCriterion { * @exception IllegalArgumentException if object associated with the * SceneGraphPath is other than a Group, Shape3D, Morph, or BoundingLeaf node. */ - WakeupOnCollisionExit(SceneGraphPath armingPath, + WakeupOnCollisionExit(SceneGraphPath armingPath, int speedHint, Bounds armingBounds) { if (armingPath != null) { this.armingNode = (NodeRetained) armingPath.getObject().retained; @@ -179,8 +179,8 @@ public final class WakeupOnCollisionExit extends WakeupCriterion { WakeupOnCollisionEntry.validateSpeedHint(speedHint, "WakeupOnCollisionExit4"); } else { - this.armingBounds = armingBounds; - nodeType = WakeupOnCollisionEntry.BOUND; + this.armingBounds = armingBounds; + nodeType = WakeupOnCollisionEntry.BOUND; } accuracyMode = speedHint; WakeupIndexedList.init(this, TOTAL_INDEXED_UNORDER_SET_TYPES); @@ -192,7 +192,7 @@ public final class WakeupOnCollisionExit extends WakeupCriterion { * criterion---null implies that a bounds object armed this criteria */ public SceneGraphPath getArmingPath() { - return (armingPath != null ? + return (armingPath != null ? new SceneGraphPath(armingPath) : null); } @@ -202,14 +202,14 @@ public final class WakeupOnCollisionExit extends WakeupCriterion { * criterion---null implies that a SceneGraphPath armed this criteria */ public Bounds getArmingBounds() { - return (armingBounds != null ? + return (armingBounds != null ? (Bounds)armingBounds.clone() : null); } /** * Retrieves the path describing the object causing the collision. * @return the SceneGraphPath that describes the triggering object. - * @exception IllegalStateException if not called from within the + * @exception IllegalStateException if not called from within the * a behavior's processStimulus method which was awoken by a collision. */ public SceneGraphPath getTriggeringPath() { @@ -230,7 +230,7 @@ public final class WakeupOnCollisionExit extends WakeupCriterion { /** * Retrieves the Bounds object that caused the collision * @return the colliding Bounds object. - * @exception IllegalStateException if not called from within the + * @exception IllegalStateException if not called from within the * a behavior's processStimulus method which was awoken by a collision. */ public Bounds getTriggeringBounds() { @@ -249,7 +249,7 @@ public final class WakeupOnCollisionExit extends WakeupCriterion { } /** - * This is a callback from BehaviorStructure. It is + * This is a callback from BehaviorStructure. It is * used to add wakeupCondition to behavior structure. */ void addBehaviorCondition(BehaviorStructure bs) { @@ -263,7 +263,7 @@ public final class WakeupOnCollisionExit extends WakeupCriterion { if (geometryAtoms == null) { geometryAtoms = new UnorderList(1, GeometryAtom.class); } - Shape3DRetained shape = (Shape3DRetained) armingNode; + Shape3DRetained shape = (Shape3DRetained) armingNode; geometryAtoms.add(Shape3DRetained.getGeomAtom(shape.getMirrorShape(armingPath))); break; case WakeupOnCollisionEntry.MORPH: // Use geometryAtoms[].collisionBounds @@ -295,9 +295,9 @@ public final class WakeupOnCollisionExit extends WakeupCriterion { geometryAtoms = new UnorderList(1, GeometryAtom.class); } ((GroupRetained) armingNode).searchGeometryAtoms(geometryAtoms); - } + } // else use this.vwcBounds - default: + default: } behav.universe.geometryStructure.addWakeupOnCollision(this); @@ -305,7 +305,7 @@ public final class WakeupOnCollisionExit extends WakeupCriterion { /** - * This is a callback from BehaviorStructure. It is + * This is a callback from BehaviorStructure. It is * used to remove wakeupCondition from behavior structure. */ void removeBehaviorCondition(BehaviorStructure bs) { @@ -319,7 +319,7 @@ public final class WakeupOnCollisionExit extends WakeupCriterion { - // Set collidingPath & collidingBounds + // Set collidingPath & collidingBounds void setTarget(BHLeafInterface leaf) { SceneGraphPath path; Bounds bound; @@ -329,12 +329,12 @@ public final class WakeupOnCollisionExit extends WakeupCriterion { GeometryAtom geomAtom = (GeometryAtom) leaf; Shape3DRetained shape = geomAtom.source; path = WakeupOnCollisionEntry.getSceneGraphPath( - shape.sourceNode, + shape.sourceNode, shape.key, shape.getCurrentLocalToVworld(0)); bound = WakeupOnCollisionEntry.getTriggeringBounds(shape); - + } else { // Find the triggered Path & Bounds for this alternative // collision target @@ -362,21 +362,21 @@ public final class WakeupOnCollisionExit extends WakeupCriterion { // this may involve recursive tree traverse if // BoundsAutoCompute is true, we can't avoid // since the bound under it may change by transform - vwcBounds = group.getEffectiveBounds(); + vwcBounds = group.getEffectiveBounds(); } group.transformBounds(armingPath, vwcBounds); } else if (nodeType == WakeupOnCollisionEntry.BOUND) { vwcBounds.transform(armingBounds, behav.getCurrentLocalToVworld()); } - - if (reEvaluateGAs && - (nodeType == WakeupOnCollisionEntry.GROUP) && + + if (reEvaluateGAs && + (nodeType == WakeupOnCollisionEntry.GROUP) && (accuracyMode == USE_GEOMETRY)) { geometryAtoms.clear(); - ((GroupRetained) armingNode).searchGeometryAtoms(geometryAtoms); + ((GroupRetained) armingNode).searchGeometryAtoms(geometryAtoms); } - } - + } + void setTriggered(){ // if path not set, probably the branch is just detach. if (collidingPath != null) { diff --git a/src/classes/share/javax/media/j3d/WakeupOnCollisionMovement.java b/src/classes/share/javax/media/j3d/WakeupOnCollisionMovement.java index 608974e..919966b 100644 --- a/src/classes/share/javax/media/j3d/WakeupOnCollisionMovement.java +++ b/src/classes/share/javax/media/j3d/WakeupOnCollisionMovement.java @@ -63,7 +63,7 @@ public final class WakeupOnCollisionMovement extends WakeupCriterion { // Cached the arming Node being used when it is not BOUND NodeRetained armingNode; - // transformed Bounds of Group/Bounds, use by + // transformed Bounds of Group/Bounds, use by // BOUND, BOUNDINGLEAF, GROUP Bounds vwcBounds; @@ -77,7 +77,7 @@ public final class WakeupOnCollisionMovement extends WakeupCriterion { Bounds lastSrcBounds = null; Bounds lastDstBounds = null; boolean duplicateEvent = false; - + // Use by BoundingLeaf, point to mirror BoundingLeaf // transformedRegion under this leaf is used. BoundingLeafRetained boundingLeaf = null; @@ -103,11 +103,11 @@ public final class WakeupOnCollisionMovement extends WakeupCriterion { * Constructs a new WakeupOnCollisionMovement criterion. * @param armingPath the path used to <em>arm</em> collision * detection - * @exception IllegalArgumentException if object associated with the + * @exception IllegalArgumentException if object associated with the * SceneGraphPath is other than a Group, Shape3D, Morph, or BoundingLeaf node. */ public WakeupOnCollisionMovement(SceneGraphPath armingPath) { - this(armingPath, USE_BOUNDS); + this(armingPath, USE_BOUNDS); } /** @@ -118,10 +118,10 @@ public final class WakeupOnCollisionMovement extends WakeupCriterion { * accurately Java 3D will perform collision detection * @exception IllegalArgumentException if hint is not one of * USE_GEOMETRY or USE_BOUNDS. - * @exception IllegalArgumentException if object associated with the + * @exception IllegalArgumentException if object associated with the * SceneGraphPath is other than a Group, Shape3D, Morph, or BoundingLeaf node. */ - public WakeupOnCollisionMovement(SceneGraphPath armingPath, + public WakeupOnCollisionMovement(SceneGraphPath armingPath, int speedHint) { this(new SceneGraphPath(armingPath), speedHint, null); } @@ -132,7 +132,7 @@ public final class WakeupOnCollisionMovement extends WakeupCriterion { * <em>arm</em> collision detection * @exception IllegalArgumentException if object is under a * SharedGroup node or object is other than a Group, Shape3D, - * Morph or BoundingLeaf node. + * Morph or BoundingLeaf node. */ public WakeupOnCollisionMovement(Node armingNode) { this(armingNode, USE_BOUNDS); @@ -148,7 +148,7 @@ public final class WakeupOnCollisionMovement extends WakeupCriterion { * USE_GEOMETRY or USE_BOUNDS. * @exception IllegalArgumentException if object is under a * SharedGroup node or object is other than a Group, Shape3D, - * Morph or BoundingLeaf node. + * Morph or BoundingLeaf node. */ public WakeupOnCollisionMovement(Node armingNode, int speedHint) { this(new SceneGraphPath(null, armingNode), speedHint, null); @@ -174,7 +174,7 @@ public final class WakeupOnCollisionMovement extends WakeupCriterion { * detection * @exception IllegalArgumentException if hint is not one of * USE_GEOMETRY or USE_BOUNDS. - * @exception IllegalArgumentException if object associated with the + * @exception IllegalArgumentException if object associated with the * SceneGraphPath is other than a Group, Shape3D, Morph, or BoundingLeaf node. */ WakeupOnCollisionMovement(SceneGraphPath armingPath, @@ -184,13 +184,13 @@ public final class WakeupOnCollisionMovement extends WakeupCriterion { nodeType = WakeupOnCollisionEntry.getNodeType(armingNode, armingPath, "WakeupOnCollisionMovement"); this.armingPath = armingPath; - WakeupOnCollisionEntry.validateSpeedHint(speedHint, + WakeupOnCollisionEntry.validateSpeedHint(speedHint, "WakeupOnCollisionMovement4"); } else { this.armingBounds = armingBounds; - nodeType = WakeupOnCollisionEntry.BOUND; + nodeType = WakeupOnCollisionEntry.BOUND; } - accuracyMode = speedHint; + accuracyMode = speedHint; WakeupIndexedList.init(this, TOTAL_INDEXED_UNORDER_SET_TYPES); } @@ -200,7 +200,7 @@ public final class WakeupOnCollisionMovement extends WakeupCriterion { * criterion---null implies that a bounds object armed this criteria */ public SceneGraphPath getArmingPath() { - return (armingPath != null ? + return (armingPath != null ? new SceneGraphPath(armingPath) : null); } @@ -210,14 +210,14 @@ public final class WakeupOnCollisionMovement extends WakeupCriterion { * criterion---null implies that a SceneGraphPath armed this criteria */ public Bounds getArmingBounds() { - return (armingBounds != null ? + return (armingBounds != null ? (Bounds)armingBounds.clone() : null); } /** * Retrieves the path describing the object causing the collision. * @return the SceneGraphPath that describes the triggering object. - * @exception IllegalStateException if not called from within the + * @exception IllegalStateException if not called from within the * a behavior's processStimulus method which was awoken by a collision. */ public SceneGraphPath getTriggeringPath() { @@ -238,7 +238,7 @@ public final class WakeupOnCollisionMovement extends WakeupCriterion { /** * Retrieves the Bounds object that caused the collision * @return the colliding Bounds object. - * @exception IllegalStateException if not called from within the + * @exception IllegalStateException if not called from within the * a behavior's processStimulus method which was awoken by a collision. */ public Bounds getTriggeringBounds() { @@ -256,9 +256,9 @@ public final class WakeupOnCollisionMovement extends WakeupCriterion { (Bounds)(collidingBounds.clone()): null); } - + /** - * This is a callback from BehaviorStructure. It is + * This is a callback from BehaviorStructure. It is * used to add wakeupCondition to behavior structure. */ void addBehaviorCondition(BehaviorStructure bs) { @@ -272,7 +272,7 @@ public final class WakeupOnCollisionMovement extends WakeupCriterion { if (geometryAtoms == null) { geometryAtoms = new UnorderList(1, GeometryAtom.class); } - Shape3DRetained shape = (Shape3DRetained) armingNode; + Shape3DRetained shape = (Shape3DRetained) armingNode; geometryAtoms.add(Shape3DRetained.getGeomAtom(shape.getMirrorShape(armingPath))); break; case WakeupOnCollisionEntry.MORPH: // Use geometryAtoms[].collisionBounds @@ -304,9 +304,9 @@ public final class WakeupOnCollisionMovement extends WakeupCriterion { geometryAtoms = new UnorderList(1, GeometryAtom.class); } ((GroupRetained) armingNode).searchGeometryAtoms(geometryAtoms); - } + } // else use this.vwcBounds - default: + default: } behav.universe.geometryStructure.addWakeupOnCollision(this); @@ -314,7 +314,7 @@ public final class WakeupOnCollisionMovement extends WakeupCriterion { /** - * This is a callback from BehaviorStructure. It is + * This is a callback from BehaviorStructure. It is * used to remove wakeupCondition from behavior structure. */ void removeBehaviorCondition(BehaviorStructure bs) { @@ -327,7 +327,7 @@ public final class WakeupOnCollisionMovement extends WakeupCriterion { } - // Set collidingPath & collidingBounds + // Set collidingPath & collidingBounds void setTarget(BHLeafInterface leaf) { SceneGraphPath path; Bounds bound; @@ -337,11 +337,11 @@ public final class WakeupOnCollisionMovement extends WakeupCriterion { GeometryAtom geomAtom = (GeometryAtom) leaf; Shape3DRetained shape = geomAtom.source; path = WakeupOnCollisionEntry.getSceneGraphPath( - shape.sourceNode, + shape.sourceNode, shape.key, shape.getCurrentLocalToVworld(0)); bound = WakeupOnCollisionEntry.getTriggeringBounds(shape); - + } else { // Find the triggered Path & Bounds for this alternative // collision target @@ -368,21 +368,21 @@ public final class WakeupOnCollisionMovement extends WakeupCriterion { // this may involve recursive tree traverse if // BoundsAutoCompute is true, we can't avoid // since the bound under it may change by transform - vwcBounds = group.getEffectiveBounds(); + vwcBounds = group.getEffectiveBounds(); } group.transformBounds(armingPath, vwcBounds); } else if (nodeType == WakeupOnCollisionEntry.BOUND) { vwcBounds.transform(armingBounds, behav.getCurrentLocalToVworld()); } - - if (reEvaluateGAs && - (nodeType == WakeupOnCollisionEntry.GROUP) && + + if (reEvaluateGAs && + (nodeType == WakeupOnCollisionEntry.GROUP) && (accuracyMode == USE_GEOMETRY)) { geometryAtoms.clear(); - ((GroupRetained) armingNode).searchGeometryAtoms(geometryAtoms); + ((GroupRetained) armingNode).searchGeometryAtoms(geometryAtoms); } - } + } void setTriggered(){ // if path not set, probably the branch is just detach. diff --git a/src/classes/share/javax/media/j3d/WakeupOnDeactivation.java b/src/classes/share/javax/media/j3d/WakeupOnDeactivation.java index 467345e..e819aa1 100644 --- a/src/classes/share/javax/media/j3d/WakeupOnDeactivation.java +++ b/src/classes/share/javax/media/j3d/WakeupOnDeactivation.java @@ -34,7 +34,7 @@ package javax.media.j3d; /** * Class specifying a wakeup on first detection of a Viewplatform's * activation volume no longer intersecting with this object's scheduling - * region. This gives the behavior an explicit means of executing code + * region. This gives the behavior an explicit means of executing code * when it is deactivated. */ public final class WakeupOnDeactivation extends WakeupCriterion { @@ -67,7 +67,7 @@ public final class WakeupOnDeactivation extends WakeupCriterion { } /** - * This is a callback from BehaviorStructure. It is + * This is a callback from BehaviorStructure. It is * used to add wakeupCondition to behavior structure. */ void addBehaviorCondition(BehaviorStructure bs) { @@ -78,7 +78,7 @@ public final class WakeupOnDeactivation extends WakeupCriterion { /** - * This is a callback from BehaviorStructure. It is + * This is a callback from BehaviorStructure. It is * used to remove wakeupCondition from behavior structure. */ void removeBehaviorCondition(BehaviorStructure bs) { @@ -88,7 +88,7 @@ public final class WakeupOnDeactivation extends WakeupCriterion { } bs.wakeupOnDeactivation.remove(this); } - + /** * Perform task in addBehaviorCondition() that has to be * set every time the condition met. diff --git a/src/classes/share/javax/media/j3d/WakeupOnElapsedFrames.java b/src/classes/share/javax/media/j3d/WakeupOnElapsedFrames.java index 90b65d3..a3da0f1 100644 --- a/src/classes/share/javax/media/j3d/WakeupOnElapsedFrames.java +++ b/src/classes/share/javax/media/j3d/WakeupOnElapsedFrames.java @@ -139,11 +139,11 @@ public final class WakeupOnElapsedFrames extends WakeupCriterion { this.countdown--; } } - - + + /** - * This is a callback from BehaviorStructure. It is + * This is a callback from BehaviorStructure. It is * used to add wakeupCondition to behavior structure. */ void addBehaviorCondition(BehaviorStructure bs) { @@ -155,13 +155,13 @@ public final class WakeupOnElapsedFrames extends WakeupCriterion { // This is necessary to invoke this condition next time // Otherwise jftc won't work for static scene. - VirtualUniverse.mc.sendRunMessage(bs.universe, + VirtualUniverse.mc.sendRunMessage(bs.universe, J3dThread.UPDATE_BEHAVIOR); } /** - * This is a callback from BehaviorStructure. It is + * This is a callback from BehaviorStructure. It is * used to remove wakeupCondition from behavior structure. */ void removeBehaviorCondition(BehaviorStructure bs) { diff --git a/src/classes/share/javax/media/j3d/WakeupOnElapsedTime.java b/src/classes/share/javax/media/j3d/WakeupOnElapsedTime.java index 44ff9b7..6f762c6 100644 --- a/src/classes/share/javax/media/j3d/WakeupOnElapsedTime.java +++ b/src/classes/share/javax/media/j3d/WakeupOnElapsedTime.java @@ -61,12 +61,12 @@ public final class WakeupOnElapsedTime extends WakeupCriterion { * constructing this object. * @return the elapsed time specified when constructing this object */ - public long getElapsedFrameTime(){ + public long getElapsedFrameTime(){ return wait; } /** - * This is a callback from BehaviorStructure. It is + * This is a callback from BehaviorStructure. It is * used to add wakeupCondition to behavior structure. */ void addBehaviorCondition(BehaviorStructure bs) { @@ -78,7 +78,7 @@ public final class WakeupOnElapsedTime extends WakeupCriterion { /** - * This is a callback from BehaviorStructure. It is + * This is a callback from BehaviorStructure. It is * used to remove wakeupCondition from behavior structure. */ void removeBehaviorCondition(BehaviorStructure bs) { @@ -92,8 +92,8 @@ public final class WakeupOnElapsedTime extends WakeupCriterion { /** * This is invoked when Behavior processStimulus can't schedule * to run because behav.active = false. In this case we must - * reinsert the wakeupOnElapseTime condition back to the - * TimerThread wakeup heap + * reinsert the wakeupOnElapseTime condition back to the + * TimerThread wakeup heap */ void reInsertElapseTimeCond() { super.reInsertElapseTimeCond(); diff --git a/src/classes/share/javax/media/j3d/WakeupOnElapsedTimeHeap.java b/src/classes/share/javax/media/j3d/WakeupOnElapsedTimeHeap.java index 9ca3d03..637ec63 100644 --- a/src/classes/share/javax/media/j3d/WakeupOnElapsedTimeHeap.java +++ b/src/classes/share/javax/media/j3d/WakeupOnElapsedTimeHeap.java @@ -32,16 +32,16 @@ package javax.media.j3d; /** - * A Binary heap to store WakeupOnElapsedTime. It is arranged so that the + * A Binary heap to store WakeupOnElapsedTime. It is arranged so that the * smallest triggeredTime of the wakeup object is put at the top of the heap. - * Add/deletion takes O(log n) time. + * Add/deletion takes O(log n) time. * For better performance we can consider to use Fibonacci Heaps. * */ class WakeupOnElapsedTimeHeap implements Cloneable { // entry 0 is not used so index can be calculated more efficiently - WakeupOnElapsedTime data[]; + WakeupOnElapsedTime data[]; int size = 0; /** @@ -77,9 +77,9 @@ class WakeupOnElapsedTimeHeap implements Cloneable { * User has to make sure that size > 0 before it is called. */ final WakeupOnElapsedTime getMin() { - return data[1]; + return data[1]; } - + /** * Insert the key into the heap @@ -158,13 +158,13 @@ class WakeupOnElapsedTimeHeap implements Cloneable { l = i << 1; r = l+1; - if ((l <= size) && + if ((l <= size) && (data[l].triggeredTime < data[i].triggeredTime)) { smallest = l; } else { smallest = i; } - if ((r <= size) && + if ((r <= size) && (data[r].triggeredTime < data[smallest].triggeredTime)) { smallest = r; } @@ -176,14 +176,14 @@ class WakeupOnElapsedTimeHeap implements Cloneable { data[i] = temp; i = smallest; } while (true); - + return min; } /*** * Trims the capacity of this instance to be the - * list's current size. + * list's current size. */ final void trimToSize() { if (data.length > size+1) { @@ -197,22 +197,22 @@ class WakeupOnElapsedTimeHeap implements Cloneable { * Clone this heap */ protected final Object clone() { - try { + try { WakeupOnElapsedTimeHeap heap = (WakeupOnElapsedTimeHeap)super.clone(); heap.data = new WakeupOnElapsedTime[size+1]; System.arraycopy(data, 0, heap.data, 0, size+1); return heap; - } catch (CloneNotSupportedException e) { + } catch (CloneNotSupportedException e) { // this shouldn't happen, since we are Cloneable throw new InternalError(); } } - + public String toString() { StringBuffer sb = new StringBuffer("[ "); - + if (size > 0) { sb.append(data[1]); } diff --git a/src/classes/share/javax/media/j3d/WakeupOnSensorEntry.java b/src/classes/share/javax/media/j3d/WakeupOnSensorEntry.java index ecd6141..ab12793 100644 --- a/src/classes/share/javax/media/j3d/WakeupOnSensorEntry.java +++ b/src/classes/share/javax/media/j3d/WakeupOnSensorEntry.java @@ -45,7 +45,7 @@ public final class WakeupOnSensorEntry extends WakeupCriterion { static final int TOTAL_INDEXED_UNORDER_SET_TYPES = 2; Bounds region; - + // Transformed region used by BehaviorStructure Bounds transformedRegion; @@ -68,7 +68,7 @@ public final class WakeupOnSensorEntry extends WakeupCriterion { public Bounds getBounds() { return (Bounds) region.clone(); } - + /** * Update the cached Transfrom Region, call from BehaviorStructure */ @@ -85,7 +85,7 @@ public final class WakeupOnSensorEntry extends WakeupCriterion { /** - * This is a callback from BehaviorStructure. It is + * This is a callback from BehaviorStructure. It is * used to add wakeupCondition to behavior structure. */ void addBehaviorCondition(BehaviorStructure bs) { @@ -97,7 +97,7 @@ public final class WakeupOnSensorEntry extends WakeupCriterion { /** - * This is a callback from BehaviorStructure. It is + * This is a callback from BehaviorStructure. It is * used to remove wakeupCondition from behavior structure. */ void removeBehaviorCondition(BehaviorStructure bs) { @@ -119,7 +119,7 @@ public final class WakeupOnSensorEntry extends WakeupCriterion { * * @return the triggering Sensor object * - * @exception IllegalStateException if not called from within + * @exception IllegalStateException if not called from within * a behavior's processStimulus method which was awoken by a sensor * entry. * diff --git a/src/classes/share/javax/media/j3d/WakeupOnSensorExit.java b/src/classes/share/javax/media/j3d/WakeupOnSensorExit.java index de71d0d..5f0ba6a 100644 --- a/src/classes/share/javax/media/j3d/WakeupOnSensorExit.java +++ b/src/classes/share/javax/media/j3d/WakeupOnSensorExit.java @@ -32,7 +32,7 @@ package javax.media.j3d; /** - * Class specifying a wakeup on first detection of sensors no + * Class specifying a wakeup on first detection of sensors no * longer intersecting the specified boundary. */ public final class WakeupOnSensorExit extends WakeupCriterion { @@ -59,7 +59,7 @@ public final class WakeupOnSensorExit extends WakeupCriterion { this.region = (Bounds)region.clone(); WakeupIndexedList.init(this, TOTAL_INDEXED_UNORDER_SET_TYPES); } - + /** * Returns this object's bounds specification * @return the bounds used in constructing this WakeupCriterion. @@ -83,7 +83,7 @@ public final class WakeupOnSensorExit extends WakeupCriterion { } /** - * This is a callback from BehaviorStructure. It is + * This is a callback from BehaviorStructure. It is * used to add wakeupCondition to behavior structure. */ void addBehaviorCondition(BehaviorStructure bs) { @@ -95,7 +95,7 @@ public final class WakeupOnSensorExit extends WakeupCriterion { /** - * This is a callback from BehaviorStructure. It is + * This is a callback from BehaviorStructure. It is * used to remove wakeupCondition from behavior structure. */ void removeBehaviorCondition(BehaviorStructure bs) { @@ -118,7 +118,7 @@ public final class WakeupOnSensorExit extends WakeupCriterion { * * @return the triggering Sensor object * - * @exception IllegalStateException if not called from within + * @exception IllegalStateException if not called from within * a behavior's processStimulus method which was awoken by a sensor * exit. * diff --git a/src/classes/share/javax/media/j3d/WakeupOnTransformChange.java b/src/classes/share/javax/media/j3d/WakeupOnTransformChange.java index 34e0cbb..fd53d17 100644 --- a/src/classes/share/javax/media/j3d/WakeupOnTransformChange.java +++ b/src/classes/share/javax/media/j3d/WakeupOnTransformChange.java @@ -58,7 +58,7 @@ public final class WakeupOnTransformChange extends WakeupCriterion { if (transform.transformChange == null) { transform.transformChange = new WakeupIndexedList(1, WakeupOnTransformChange.class, - WakeupOnTransformChange.COND_IN_BS_LIST, + WakeupOnTransformChange.COND_IN_BS_LIST, transform.universe); } } @@ -74,7 +74,7 @@ public final class WakeupOnTransformChange extends WakeupCriterion { } /** - * This is a callback from BehaviorStructure. It is + * This is a callback from BehaviorStructure. It is * used to add wakeupCondition to behavior structure. */ void addBehaviorCondition(BehaviorStructure bs) { @@ -83,7 +83,7 @@ public final class WakeupOnTransformChange extends WakeupCriterion { /** - * This is a callback from BehaviorStructure. It is + * This is a callback from BehaviorStructure. It is * used to remove wakeupCondition from behavior structure. */ void removeBehaviorCondition(BehaviorStructure bs) { diff --git a/src/classes/share/javax/media/j3d/WakeupOnViewPlatformEntry.java b/src/classes/share/javax/media/j3d/WakeupOnViewPlatformEntry.java index f981fd1..ae4ad6c 100644 --- a/src/classes/share/javax/media/j3d/WakeupOnViewPlatformEntry.java +++ b/src/classes/share/javax/media/j3d/WakeupOnViewPlatformEntry.java @@ -55,7 +55,7 @@ public final class WakeupOnViewPlatformEntry extends WakeupCriterion { * ViewPlatform that triggered this wakeup condition. */ ViewPlatformRetained triggeredVP; - + /** * Constructs a new WakeupOnEntry criterion. * @param region the region that will trigger a wakeup if a ViewPlatform @@ -65,7 +65,7 @@ public final class WakeupOnViewPlatformEntry extends WakeupCriterion { this.region = (Bounds)region.clone(); WakeupIndexedList.init(this, TOTAL_INDEXED_UNORDER_SET_TYPES); } - + /** * Returns this object's bounds specification * @return the bounds used in constructing this WakeupCriterion. @@ -79,7 +79,7 @@ public final class WakeupOnViewPlatformEntry extends WakeupCriterion { * * @return the triggering ViewPlatform node * - * @exception IllegalStateException if not called from within + * @exception IllegalStateException if not called from within * a behavior's processStimulus method that was awoken by a * view platform entry. * @@ -115,7 +115,7 @@ public final class WakeupOnViewPlatformEntry extends WakeupCriterion { } /** - * This is a callback from BehaviorStructure. It is + * This is a callback from BehaviorStructure. It is * used to add wakeupCondition to behavior structure. */ void addBehaviorCondition(BehaviorStructure bs) { @@ -127,7 +127,7 @@ public final class WakeupOnViewPlatformEntry extends WakeupCriterion { /** - * This is a callback from BehaviorStructure. It is + * This is a callback from BehaviorStructure. It is * used to remove wakeupCondition from behavior structure. */ void removeBehaviorCondition(BehaviorStructure bs) { diff --git a/src/classes/share/javax/media/j3d/WakeupOnViewPlatformExit.java b/src/classes/share/javax/media/j3d/WakeupOnViewPlatformExit.java index 73836b2..ba2b753 100644 --- a/src/classes/share/javax/media/j3d/WakeupOnViewPlatformExit.java +++ b/src/classes/share/javax/media/j3d/WakeupOnViewPlatformExit.java @@ -81,7 +81,7 @@ public final class WakeupOnViewPlatformExit extends WakeupCriterion { * * @return the triggering ViewPlatform node * - * @exception IllegalStateException if not called from within + * @exception IllegalStateException if not called from within * a behavior's processStimulus method that was awoken by a * view platform exit. * @@ -116,9 +116,9 @@ public final class WakeupOnViewPlatformExit extends WakeupCriterion { transformedRegion.transform(b.getCurrentLocalToVworld(null)); } - + /** - * This is a callback from BehaviorStructure. It is + * This is a callback from BehaviorStructure. It is * used to add wakeupCondition to behavior structure. */ void addBehaviorCondition(BehaviorStructure bs) { @@ -130,7 +130,7 @@ public final class WakeupOnViewPlatformExit extends WakeupCriterion { /** - * This is a callback from BehaviorStructure. It is + * This is a callback from BehaviorStructure. It is * used to remove wakeupCondition from behavior structure. */ void removeBehaviorCondition(BehaviorStructure bs) { diff --git a/src/classes/share/javax/media/j3d/WakeupOr.java b/src/classes/share/javax/media/j3d/WakeupOr.java index 56fe129..823d252 100644 --- a/src/classes/share/javax/media/j3d/WakeupOr.java +++ b/src/classes/share/javax/media/j3d/WakeupOr.java @@ -35,8 +35,8 @@ import java.util.Vector; /** * Class specifying any number of wakeup conditions ORed together. - * This WakeupCondition object specifies that Java 3D should awaken - * this Behavior when any of the WakeupCondition's constituent wakeup + * This WakeupCondition object specifies that Java 3D should awaken + * this Behavior when any of the WakeupCondition's constituent wakeup * criteria becomes valid. * <p> * Note that a unique WakeupCriterion object must be used @@ -58,7 +58,7 @@ public final class WakeupOr extends WakeupCondition { this.conditions[i] = conditions[i]; } } - + /** * This sets the bit for the given child, then checks if the full condition is met */ @@ -69,21 +69,21 @@ public final class WakeupOr extends WakeupCondition { parent.setConditionMet(this.id, checkSchedulingRegion); } } - + /** * This gets called when this condition is added to the AndOr tree. */ void buildTree(WakeupCondition parent, int id, BehaviorRetained b) { super.buildTree(parent, id, b); - + for(int i = 0; i < conditions.length; i++) { if (conditions[i] != null) { conditions[i].buildTree(this, i, b); } } } - + /** * This goes through the AndOr tree to remove the various criterion from the * BehaviorStructure lists @@ -104,7 +104,7 @@ public final class WakeupOr extends WakeupCondition { } /** - * This goes through the AndOr tree to remove the various criterion from the + * This goes through the AndOr tree to remove the various criterion from the * BehaviorStructure. */ void resetTree() { @@ -115,5 +115,5 @@ public final class WakeupOr extends WakeupCondition { } } } - + } diff --git a/src/classes/share/javax/media/j3d/WakeupOrOfAnds.java b/src/classes/share/javax/media/j3d/WakeupOrOfAnds.java index 59c254f..5caa89a 100644 --- a/src/classes/share/javax/media/j3d/WakeupOrOfAnds.java +++ b/src/classes/share/javax/media/j3d/WakeupOrOfAnds.java @@ -35,7 +35,7 @@ import java.util.Vector; /** * Class specifying any number of AND wakeup conditions ORed together. - * This WakeupCondition object specifies that Java 3D should awaken + * This WakeupCondition object specifies that Java 3D should awaken * this Behavior when any of the WakeupCondition's constituent WakeupAnd * conditions becomes valid. * <p> @@ -59,7 +59,7 @@ public final class WakeupOrOfAnds extends WakeupCondition { } } - + /** * This sets the bit for the given child, then checks if the full condition is met */ @@ -70,20 +70,20 @@ public final class WakeupOrOfAnds extends WakeupCondition { parent.setConditionMet(this.id, checkSchedulingRegion); } } - + /** * This gets called when this condition is added to the AndOr tree. */ void buildTree(WakeupCondition parent, int id, BehaviorRetained b) { super.buildTree(parent, id, b); - + for(int i = 0; i < conditions.length; i++) { if (conditions[i] != null) { conditions[i].buildTree(this, i, b); } } } - + /** * This goes through the AndOr tree to remove the various criterion from the * BehaviorStructure lists @@ -102,9 +102,9 @@ public final class WakeupOrOfAnds extends WakeupCondition { } } } - + /** - * This goes through the AndOr tree to remove the various criterion from the + * This goes through the AndOr tree to remove the various criterion from the * BehaviorStructure. */ void resetTree() { @@ -115,5 +115,5 @@ public final class WakeupOrOfAnds extends WakeupCondition { } } } - + } diff --git a/src/classes/x11/javax/media/j3d/X11NativeConfigTemplate3D.java b/src/classes/x11/javax/media/j3d/X11NativeConfigTemplate3D.java index fe97730..5f7a3b3 100644 --- a/src/classes/x11/javax/media/j3d/X11NativeConfigTemplate3D.java +++ b/src/classes/x11/javax/media/j3d/X11NativeConfigTemplate3D.java @@ -87,7 +87,7 @@ class X11NativeConfigTemplate3D extends NativeConfigTemplate3D { System.out.println(" display " + display + " screen " + screen); System.out.println(" configuration count: " + gc.length); for (int i = 0 ; i < gc.length ; i++) { - System.out.println(" visual id at index " + i + ": " + + System.out.println(" visual id at index " + i + ": " + ((X11GraphicsConfig)gc[i]).getVisual()); } } @@ -120,7 +120,7 @@ class X11NativeConfigTemplate3D extends NativeConfigTemplate3D { attrList[STEREO] = template.getStereo(); attrList[ANTIALIASING] = template.getSceneAntialiasing(); attrList[STENCIL_SIZE] = template.getStencilSize(); - // System.out.println("X11NativeConfigTemplate3D : getStencilSize " + + // System.out.println("X11NativeConfigTemplate3D : getStencilSize " + // attrList[STENCIL_SIZE]); long[] fbConfig = new long[1]; @@ -165,7 +165,7 @@ class X11NativeConfigTemplate3D extends NativeConfigTemplate3D { } else { freeFBConfig(fbConfig[0]); } - } + } return gc1; } @@ -202,16 +202,16 @@ class X11NativeConfigTemplate3D extends NativeConfigTemplate3D { attrList[STEREO] = template.getStereo(); attrList[ANTIALIASING] = template.getSceneAntialiasing(); attrList[STENCIL_SIZE] = template.getStencilSize(); - // System.out.println("X11NativeConfigTemplate3D : getStencilSize " + + // System.out.println("X11NativeConfigTemplate3D : getStencilSize " + // attrList[STENCIL_SIZE]); - + long[] fbConfig = new long[1]; int visID = chooseOglVisual(display, screen, attrList, fbConfig); - + if (visID == 0 || fbConfig[0] == 0) return false; // no valid visual was found else - return true; + return true; } @@ -290,7 +290,7 @@ class X11NativeConfigTemplate3D extends NativeConfigTemplate3D { return isSceneAntialiasingMultisampleAvailable(display, screen, vid); } - + // Ensure that the native libraries are loaded static { VirtualUniverse.loadLibraries(); diff --git a/src/classes/x11/javax/media/j3d/X11NativeScreenInfo.java b/src/classes/x11/javax/media/j3d/X11NativeScreenInfo.java index 7e95e81..ce076e2 100644 --- a/src/classes/x11/javax/media/j3d/X11NativeScreenInfo.java +++ b/src/classes/x11/javax/media/j3d/X11NativeScreenInfo.java @@ -50,7 +50,7 @@ class X11NativeScreenInfo extends NativeScreenInfo { } // Fix for issue 20. - // This method will return true if glx version is 1.3 or higher, + // This method will return true if glx version is 1.3 or higher, // else return false. static synchronized boolean isGLX13() { if (!glxChecked) { |