From 429daaad496c5e8bc0f7c6197e1dcce19fc7435b Mon Sep 17 00:00:00 2001 From: Harvey Harrison Date: Mon, 28 Jan 2013 00:15:01 -0800 Subject: j3dcore: remove a pile of unneeded casts, mostly to Bounds Signed-off-by: Harvey Harrison --- .../javax/media/j3d/AlternateAppearanceRetained.java | 4 ++-- src/classes/share/javax/media/j3d/BehaviorRetained.java | 2 +- src/classes/share/javax/media/j3d/Billboard.java | 5 ++--- src/classes/share/javax/media/j3d/ClipRetained.java | 4 ++-- src/classes/share/javax/media/j3d/FogRetained.java | 6 +++--- src/classes/share/javax/media/j3d/GroupRetained.java | 4 ++-- src/classes/share/javax/media/j3d/LightRetained.java | 10 ++++------ src/classes/share/javax/media/j3d/ModelClipRetained.java | 9 +++------ src/classes/share/javax/media/j3d/MorphRetained.java | 6 +++--- src/classes/share/javax/media/j3d/Shape3DRetained.java | 16 ++++++++-------- src/classes/share/javax/media/j3d/SwitchRetained.java | 8 ++++---- 11 files changed, 34 insertions(+), 40 deletions(-) (limited to 'src') diff --git a/src/classes/share/javax/media/j3d/AlternateAppearanceRetained.java b/src/classes/share/javax/media/j3d/AlternateAppearanceRetained.java index 7240b18..afbf12a 100644 --- a/src/classes/share/javax/media/j3d/AlternateAppearanceRetained.java +++ b/src/classes/share/javax/media/j3d/AlternateAppearanceRetained.java @@ -441,7 +441,7 @@ Enumeration getAllScopes() { mirrorAltApp.regionOfInfluence = (Bounds) objs[2]; if (mirrorAltApp.boundingLeaf == null) { if (objs[2] != null) { - mirrorAltApp.region = (Bounds)mirrorAltApp.regionOfInfluence.copy(mirrorAltApp.region); + mirrorAltApp.region = mirrorAltApp.regionOfInfluence.copy(mirrorAltApp.region); mirrorAltApp.region.transform( mirrorAltApp.regionOfInfluence, getCurrentLocalToVworld()); @@ -454,7 +454,7 @@ Enumeration getAllScopes() { else if ((component & BOUNDINGLEAF_CHANGED) != 0) { mirrorAltApp.boundingLeaf = (BoundingLeafRetained)objs[2]; if (objs[2] != null) { - mirrorAltApp.region = (Bounds)mirrorAltApp.boundingLeaf.transformedRegion; + mirrorAltApp.region = mirrorAltApp.boundingLeaf.transformedRegion; } else { if (mirrorAltApp.regionOfInfluence != null) { diff --git a/src/classes/share/javax/media/j3d/BehaviorRetained.java b/src/classes/share/javax/media/j3d/BehaviorRetained.java index d94a95b..e245408 100644 --- a/src/classes/share/javax/media/j3d/BehaviorRetained.java +++ b/src/classes/share/javax/media/j3d/BehaviorRetained.java @@ -489,7 +489,7 @@ class BehaviorRetained extends LeafRetained { // Note: This routine will only to update the object's // transformed region void updateBoundingLeaf(long refTime) { - transformedRegion = (Bounds)boundingLeaf.mirrorBoundingLeaf.transformedRegion; + transformedRegion = boundingLeaf.mirrorBoundingLeaf.transformedRegion; } diff --git a/src/classes/share/javax/media/j3d/Billboard.java b/src/classes/share/javax/media/j3d/Billboard.java index 8c65976..d17e3d6 100644 --- a/src/classes/share/javax/media/j3d/Billboard.java +++ b/src/classes/share/javax/media/j3d/Billboard.java @@ -310,8 +310,7 @@ public class Billboard extends Behavior { */ public void processStimulus(Enumeration criteria) { double angle = 0.0; - double mag,sign; - double tx,ty,tz; + double sign; if( tg == null ){ wakeupOn(wakeupFrame); @@ -324,7 +323,7 @@ public class Billboard extends Behavior { wakeupOn(wakeupFrame); return; } - Canvas3D canvas = (Canvas3D)v.getCanvas3D(0); + Canvas3D canvas = v.getCanvas3D(0); boolean status; Transform3D xform = new Transform3D(); diff --git a/src/classes/share/javax/media/j3d/ClipRetained.java b/src/classes/share/javax/media/j3d/ClipRetained.java index a94f327..fbd39fc 100644 --- a/src/classes/share/javax/media/j3d/ClipRetained.java +++ b/src/classes/share/javax/media/j3d/ClipRetained.java @@ -281,7 +281,7 @@ class ClipRetained extends LeafRetained { Transform3D lastLocalToVworld = getLastLocalToVworld(); if (boundingLeaf != null) { - transformedRegion = (Bounds)boundingLeaf.mirrorBoundingLeaf.transformedRegion; + transformedRegion = boundingLeaf.mirrorBoundingLeaf.transformedRegion; } else { // Evaluate applicationRegion if not null if (applicationRegion != null) { @@ -322,7 +322,7 @@ class ClipRetained extends LeafRetained { else { // Evaluate applicationRegion if not null Bounds appRegion = (Bounds)objs[3]; if (appRegion != null) { - transformedRegion = ((Bounds)appRegion).copy(transformedRegion); + transformedRegion = appRegion.copy(transformedRegion); transformedRegion.transform(appRegion, currentLocalToVworld); } diff --git a/src/classes/share/javax/media/j3d/FogRetained.java b/src/classes/share/javax/media/j3d/FogRetained.java index c633544..036c4f6 100644 --- a/src/classes/share/javax/media/j3d/FogRetained.java +++ b/src/classes/share/javax/media/j3d/FogRetained.java @@ -477,7 +477,7 @@ Vector scopes = new Vector(); mirrorFog.regionOfInfluence = (Bounds) objs[2]; if (mirrorFog.boundingLeaf == null) { if (objs[2] != null) { - mirrorFog.region = ((Bounds)mirrorFog.regionOfInfluence).copy(mirrorFog.region); + mirrorFog.region = mirrorFog.regionOfInfluence.copy(mirrorFog.region); mirrorFog.region.transform( mirrorFog.regionOfInfluence, getCurrentLocalToVworld()); @@ -490,11 +490,11 @@ Vector scopes = new Vector(); else if ((component & BOUNDINGLEAF_CHANGED) != 0) { mirrorFog.boundingLeaf = (BoundingLeafRetained)objs[2]; if (objs[2] != null) { - mirrorFog.region = (Bounds)mirrorFog.boundingLeaf.transformedRegion; + mirrorFog.region = mirrorFog.boundingLeaf.transformedRegion; } else { if (mirrorFog.regionOfInfluence != null) { - mirrorFog.region = ((Bounds)mirrorFog.regionOfInfluence).copy(mirrorFog.region); + mirrorFog.region = mirrorFog.regionOfInfluence.copy(mirrorFog.region); mirrorFog.region.transform( mirrorFog.regionOfInfluence, getCurrentLocalToVworld()); diff --git a/src/classes/share/javax/media/j3d/GroupRetained.java b/src/classes/share/javax/media/j3d/GroupRetained.java index 85026e2..db0c1a8 100644 --- a/src/classes/share/javax/media/j3d/GroupRetained.java +++ b/src/classes/share/javax/media/j3d/GroupRetained.java @@ -2499,11 +2499,11 @@ synchronized void setAltAppScope() { for (int i = children.size() - 1; i >= 0; i--) { NodeRetained child = children.get(i); if (child != null) { - child.computeCombineBounds((Bounds) boundingObject); + child.computeCombineBounds(boundingObject); } } - return (Bounds) boundingObject; + return boundingObject; } return super.getBounds(); } diff --git a/src/classes/share/javax/media/j3d/LightRetained.java b/src/classes/share/javax/media/j3d/LightRetained.java index d767ae8..89b50dc 100644 --- a/src/classes/share/javax/media/j3d/LightRetained.java +++ b/src/classes/share/javax/media/j3d/LightRetained.java @@ -599,8 +599,7 @@ Vector scopes = new Vector(); mLgts[i].regionOfInfluence = (Bounds) objs[4]; if (mLgts[i].boundingLeaf == null) { if (objs[4] != null) { - mLgts[i].region = - ((Bounds)mLgts[i].regionOfInfluence).copy(mLgts[i].region); + mLgts[i].region = mLgts[i].regionOfInfluence.copy(mLgts[i].region); mLgts[i].region.transform(mLgts[i].regionOfInfluence, mLgts[i].getCurrentLocalToVworld()); } @@ -614,12 +613,11 @@ Vector scopes = new Vector(); for (int i = 0; i < numLgts; i++) { mLgts[i].boundingLeaf=((BoundingLeafRetained)objs[4]); if (objs[4] != null) { - mLgts[i].region = (Bounds)mLgts[i].boundingLeaf.transformedRegion; + mLgts[i].region = mLgts[i].boundingLeaf.transformedRegion; } else { // evaluate regionOfInfluence if not null if (mLgts[i].regionOfInfluence != null) { - mLgts[i].region = - ((Bounds)mLgts[i].regionOfInfluence).copy(mLgts[i].region); + mLgts[i].region = mLgts[i].regionOfInfluence.copy(mLgts[i].region); mLgts[i].region.transform(mLgts[i].regionOfInfluence, mLgts[i].getCurrentLocalToVworld()); } @@ -653,7 +651,7 @@ Vector scopes = new Vector(); mLgts[i].isScoped = isScoped; for (j = 0; j < removeList.size(); j++) { Shape3DRetained obj = ((GeometryAtom)removeList.get(j)).source; - ((Shape3DRetained)obj).removeLight(mLgts[i]); + obj.removeLight(mLgts[i]); } } } diff --git a/src/classes/share/javax/media/j3d/ModelClipRetained.java b/src/classes/share/javax/media/j3d/ModelClipRetained.java index ec72258..20ec58d 100644 --- a/src/classes/share/javax/media/j3d/ModelClipRetained.java +++ b/src/classes/share/javax/media/j3d/ModelClipRetained.java @@ -687,13 +687,11 @@ void update(Context ctx, int enableMask, Transform3D trans) { if ((component & BOUNDINGLEAF_CHANGED) != 0) { mirrorModelClip.boundingLeaf = (BoundingLeafRetained)objs[2]; if (objs[2] != null) { - mirrorModelClip.region = - (Bounds)mirrorModelClip.boundingLeaf.transformedRegion; + mirrorModelClip.region = mirrorModelClip.boundingLeaf.transformedRegion; } else { if (mirrorModelClip.regionOfInfluence != null) { - mirrorModelClip.region = - ((Bounds)mirrorModelClip.regionOfInfluence).copy(mirrorModelClip.region); + mirrorModelClip.region = mirrorModelClip.regionOfInfluence.copy(mirrorModelClip.region); mirrorModelClip.region.transform(mirrorModelClip.regionOfInfluence, getCurrentLocalToVworld()); } @@ -708,8 +706,7 @@ void update(Context ctx, int enableMask, Transform3D trans) { mirrorModelClip.regionOfInfluence = (Bounds) objs[2]; if (mirrorModelClip.boundingLeaf == null) { if (objs[2] != null) { - mirrorModelClip.region = - ((Bounds)mirrorModelClip.regionOfInfluence).copy(mirrorModelClip.region); + mirrorModelClip.region = mirrorModelClip.regionOfInfluence.copy(mirrorModelClip.region); mirrorModelClip.region.transform(mirrorModelClip.regionOfInfluence, getCurrentLocalToVworld()); diff --git a/src/classes/share/javax/media/j3d/MorphRetained.java b/src/classes/share/javax/media/j3d/MorphRetained.java index 5da01a4..3abdc89 100644 --- a/src/classes/share/javax/media/j3d/MorphRetained.java +++ b/src/classes/share/javax/media/j3d/MorphRetained.java @@ -652,13 +652,13 @@ class MorphRetained extends LeafRetained implements GeometryUpdater { (GeometryArrayRetained)morphedGeometryArray.retained; if (mga != null) { synchronized(mga.geoBounds) { - bounds.combine((Bounds) mga.geoBounds); + bounds.combine(mga.geoBounds); } } } else { // Should this be lock too ? ( MT safe ? ) synchronized(localBounds) { - bounds.combine((Bounds) localBounds); + bounds.combine(localBounds); } } } @@ -709,7 +709,7 @@ class MorphRetained extends LeafRetained implements GeometryUpdater { normal[] = new float[3], texCoord[] = new float[3]; vFormat = geometryArrays[0].vertexFormat; - geoType = ((GeometryArrayRetained)geometryArrays[0]).geoType; + geoType = geometryArrays[0].geoType; texCoordSetCount = geometryArrays[0].getTexCoordSetCount(); diff --git a/src/classes/share/javax/media/j3d/Shape3DRetained.java b/src/classes/share/javax/media/j3d/Shape3DRetained.java index bfb18fb..9f7df98 100644 --- a/src/classes/share/javax/media/j3d/Shape3DRetained.java +++ b/src/classes/share/javax/media/j3d/Shape3DRetained.java @@ -867,7 +867,7 @@ Enumeration getAllGeometries(int id) { } } } - return (Bounds) bbox; + return bbox; } else { return null; @@ -914,9 +914,9 @@ Enumeration getAllGeometries(int id) { if (staticTransform != null) { bbox.set(geometry.geoBounds); bbox.transform(staticTransform.transform); - bounds.combine((Bounds)bbox); + bounds.combine(bbox); } else { - bounds.combine((Bounds)geometry.geoBounds); + bounds.combine(geometry.geoBounds); } } } @@ -937,9 +937,9 @@ Enumeration getAllGeometries(int id) { if (staticTransform != null) { bbox.set(geometry.geoBounds); bbox.transform(staticTransform.transform); - cachedBounds.combine((Bounds)bbox); + cachedBounds.combine(bbox); } else { - cachedBounds.combine((Bounds)geometry.geoBounds); + cachedBounds.combine(geometry.geoBounds); } } } @@ -952,7 +952,7 @@ Enumeration getAllGeometries(int id) { // Should this be lock too ? ( MT safe ? ) synchronized(localBounds) { - bounds.combine((Bounds) localBounds); + bounds.combine(localBounds); } } } @@ -2503,9 +2503,9 @@ final static ArrayList> getGeomAtomsList(ArrayList userL if (staticTransform != null) { bbox.set(geometry.geoBounds); bbox.transform(staticTransform.transform); - bounds.combine((Bounds)bbox); + bounds.combine(bbox); } else { - bounds.combine((Bounds)geometry.geoBounds); + bounds.combine(geometry.geoBounds); } } } diff --git a/src/classes/share/javax/media/j3d/SwitchRetained.java b/src/classes/share/javax/media/j3d/SwitchRetained.java index 66db1ab..c82d810 100644 --- a/src/classes/share/javax/media/j3d/SwitchRetained.java +++ b/src/classes/share/javax/media/j3d/SwitchRetained.java @@ -721,7 +721,7 @@ void updateSwitchChild(int child, boolean switchOn, ArrayList updat for (int i = 0; i < children.size(); i++) { NodeRetained child = children.get(i); if (child != null) { - child.computeCombineBounds((Bounds) boundingObject); + child.computeCombineBounds(boundingObject); } } } else if (whichChild == Switch.CHILD_MASK) { @@ -729,7 +729,7 @@ void updateSwitchChild(int child, boolean switchOn, ArrayList updat if (childMask.get(i)) { NodeRetained child = children.get(i); if (child != null) { - child.computeCombineBounds((Bounds) boundingObject); + child.computeCombineBounds(boundingObject); } } } @@ -739,11 +739,11 @@ void updateSwitchChild(int child, boolean switchOn, ArrayList updat NodeRetained child = children.get(whichChild); if (child != null) { - child.computeCombineBounds((Bounds) boundingObject); + child.computeCombineBounds(boundingObject); } } - return (Bounds) boundingObject; + return boundingObject; } else { return super.getBounds(); } -- cgit v1.2.3