aboutsummaryrefslogtreecommitdiffstats
path: root/src/classes/share
diff options
context:
space:
mode:
authorHarvey Harrison <[email protected]>2012-03-05 10:00:56 -0800
committerHarvey Harrison <[email protected]>2012-03-05 10:00:56 -0800
commit61786dc4398fcd9c6726b4f66eb2693b4cf95d49 (patch)
treef516e94c954b83bec42d02cec377b4a9feedf5ec /src/classes/share
parentb0eee1722abe419e5956595f5f2274bfc6094122 (diff)
j3dcore: annotate PhysicalEnvironment::users list as holding Views
Signed-off-by: Harvey Harrison <[email protected]>
Diffstat (limited to 'src/classes/share')
-rw-r--r--src/classes/share/javax/media/j3d/BehaviorStructure.java56
-rw-r--r--src/classes/share/javax/media/j3d/MasterControl.java2
-rw-r--r--src/classes/share/javax/media/j3d/PhysicalEnvironment.java38
3 files changed, 45 insertions, 51 deletions
diff --git a/src/classes/share/javax/media/j3d/BehaviorStructure.java b/src/classes/share/javax/media/j3d/BehaviorStructure.java
index d817c07..6244bad 100644
--- a/src/classes/share/javax/media/j3d/BehaviorStructure.java
+++ b/src/classes/share/javax/media/j3d/BehaviorStructure.java
@@ -1281,7 +1281,7 @@ void reEvaluatePhysicalEnvironments() {
View v = views[j];
if (!v.active)
continue;
-
+
if (!physicalEnvironments.contains(v.physicalEnvironment)) {
physicalEnvironments.add(v.physicalEnvironment);
}
@@ -1342,44 +1342,44 @@ void reEvaluatePhysicalEnvironments() {
}
- /**
- * return the Senor that intersect with behregion or null
- */
- Sensor sensorIntersect(Bounds behregion) {
+/**
+ * return the Sensor that intersect with behregion or null
+ */
+Sensor sensorIntersect(Bounds behregion) {
if (behregion == null)
- return null;
+ return null;
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();
- if (sensors != null) {
- for (int j= env[i].users.size()-1; j>=0; j--) {
- v = (View) env[i].users.get(j);
+ for (int i = physicalEnvironments.arraySize() - 1; i >= 0; i--) {
+ if (env[i].activeViewRef <= 0)
+ continue;
+
+ Sensor[] sensors = env[i].getSensorList();
+ if (sensors == null)
+ continue;
+
+ for (int j = env[i].users.size() - 1; j >= 0; j--) {
+ View v = env[i].users.get(j);
synchronized (sensors) {
- for (int k=sensors.length-1; k >=0; k--) {
- s = sensors[k];
- if (s != null) {
- v.getSensorToVworld(s, sensorTransform);
- sensorTransform.get(sensorLoc);
- ptSensorLoc.set(sensorLoc);
- if (behregion.intersect(ptSensorLoc)) {
- return s;
- }
+ for (int k = sensors.length - 1; k >= 0; k--) {
+ Sensor s = sensors[k];
+ if (s == null)
+ continue;
+
+ v.getSensorToVworld(s, sensorTransform);
+ sensorTransform.get(sensorLoc);
+ ptSensorLoc.set(sensorLoc);
+ if (behregion.intersect(ptSensorLoc)) {
+ return s;
+ }
}
- }
}
- }
}
- }
}
return null;
- }
+}
/**
diff --git a/src/classes/share/javax/media/j3d/MasterControl.java b/src/classes/share/javax/media/j3d/MasterControl.java
index ab91f12..272bcb4 100644
--- a/src/classes/share/javax/media/j3d/MasterControl.java
+++ b/src/classes/share/javax/media/j3d/MasterControl.java
@@ -2086,7 +2086,7 @@ class MasterControl {
InputDeviceScheduler sched = (InputDeviceScheduler)
PhysicalEnvironment.physicalEnvMap.get(phyEnv);
for (i=phyEnv.users.size()-1; i>=0; i--) {
- if (views.contains((View) phyEnv.users.get(i))) {
+ if (views.contains(phyEnv.users.get(i))) {
// at least one register view refer to it.
break;
}
diff --git a/src/classes/share/javax/media/j3d/PhysicalEnvironment.java b/src/classes/share/javax/media/j3d/PhysicalEnvironment.java
index 9d3e33e..d0c68c1 100644
--- a/src/classes/share/javax/media/j3d/PhysicalEnvironment.java
+++ b/src/classes/share/javax/media/j3d/PhysicalEnvironment.java
@@ -126,8 +126,8 @@ public class PhysicalEnvironment extends Object {
Sensor[] sensorList = null;
- // A list of View Objects that refer to this
- ArrayList users = new ArrayList();
+// A list of View Objects that refer to this
+ArrayList<View> users = new ArrayList<View>();
// Scheduler for input devices
InputDeviceScheduler inputsched;
@@ -163,29 +163,23 @@ public class PhysicalEnvironment extends Object {
this(3);
}
- // Add a user to the list of users
- synchronized void removeUser(View view) {
- int idx = users.indexOf(view);
- if (idx >= 0) {
- users.remove(idx);
- }
- }
+// Add a user to the list of users
+synchronized void removeUser(View view) {
+ users.remove(view);
+}
- // Add a user to the list of users
- synchronized void addUser(View view) {
- int idx = users.indexOf(view);
- if (idx < 0) {
- users.add(view);
- }
- }
+// Add a user to the list of users
+synchronized void addUser(View view) {
+ if (!users.contains(view))
+ users.add(view);
+}
- // Add a user to the list of users
- synchronized void notifyUsers() {
- for (int i=users.size()-1; i>=0; i--) {
- View view = (View)users.get(i);
- view.repaint();
+// Add a user to the list of users
+synchronized void notifyUsers() {
+ for (int i = users.size() - 1; i >= 0; i--) {
+ users.get(i).repaint();
}
- }
+}
/**
* Constructs and initializes a PhysicalEnvironment object with