|
From: <tre...@us...> - 2008-02-21 00:00:06
|
Revision: 760
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=760&view=rev
Author: trevorolio
Date: 2008-02-20 16:00:09 -0800 (Wed, 20 Feb 2008)
Log Message:
-----------
Attempt to alleviate some of the problems where two avatars appear for one user, though there is still a race condition between addUser and addListener.
Modified Paths:
--------------
maven/trunk/ogoglio-common/src/main/java/com/ogoglio/client/model/Space.java
maven/trunk/ogoglio-common/src/main/java/com/ogoglio/viewer/j3d/J3DRenderer.java
Modified: maven/trunk/ogoglio-common/src/main/java/com/ogoglio/client/model/Space.java
===================================================================
--- maven/trunk/ogoglio-common/src/main/java/com/ogoglio/client/model/Space.java 2008-02-20 21:58:37 UTC (rev 759)
+++ maven/trunk/ogoglio-common/src/main/java/com/ogoglio/client/model/Space.java 2008-02-21 00:00:09 UTC (rev 760)
@@ -59,7 +59,7 @@
private Context spaceContext = null;
private Color3f backgroundColor = null;
-
+
public Space(Context spaceContext, long spaceID, String displayName, String ownerUsername, boolean displaySea, double seaLevel, Color3f backgroundColor) {
ArgumentUtils.assertNotNull(spaceContext);
this.spaceContext = spaceContext;
@@ -78,8 +78,8 @@
ArgumentUtils.assertNotNull(backgroundColor);
this.backgroundColor = backgroundColor;
}
-
- public Color3f getBackgroundColor(){
+
+ public Color3f getBackgroundColor() {
return backgroundColor;
}
@@ -113,24 +113,31 @@
return;
}
+ Template[] templates = null;
+ Thing[] things = null;
+ User[] users = null;
+ Door[] doors = null;
+
+ synchronized (this) {
+ templates = getTemplates();
+ things = getThings();
+ users = getUsers();
+ doors = getDoors();
+ }
+
// This is a little weird.
// We load all the templates and one Thing before any users.
// This allows thing 1 to be a landscape.
- Template[] templates = getTemplates();
for (int i = 0; i < templates.length; i++) {
listener.templateAdded(templates[i]);
}
- Thing[] things = getThings();
Arrays.sort(things, new DistanceComparator());
-
if (things.length > 0) {
listener.thingAdded(things[0]);
}
- User[] users = getUsers();
-
//We can't show seated users until after the things are loaded, but we should show as many as possible
for (int i = 0; i < users.length; i++) {
if (users[i].getSeat() == null) {
@@ -149,11 +156,9 @@
}
}
- Door[] doors = getDoors();
for (int i = 0; i < doors.length; i++) {
listener.doorAdded(doors[i]);
}
-
}
private class DistanceComparator implements Comparator {
@@ -393,7 +398,7 @@
synchronized (this) {
User[] users = getUsers();
for (int i = 0; i < users.length; i++) {
- if(users[i].getSeat() == thing){
+ if (users[i].getSeat() == thing) {
users[i].setSeat(null);
}
}
Modified: maven/trunk/ogoglio-common/src/main/java/com/ogoglio/viewer/j3d/J3DRenderer.java
===================================================================
--- maven/trunk/ogoglio-common/src/main/java/com/ogoglio/viewer/j3d/J3DRenderer.java 2008-02-20 21:58:37 UTC (rev 759)
+++ maven/trunk/ogoglio-common/src/main/java/com/ogoglio/viewer/j3d/J3DRenderer.java 2008-02-21 00:00:09 UTC (rev 760)
@@ -407,7 +407,7 @@
}
public void userAdded(User user) {
- if (rendererStopped) {
+ if (rendererStopped || getUserRenderable(user.getUsername()) != null) {
return;
}
try {
@@ -427,7 +427,9 @@
renderable.playAnimation(BodyConstants.SIT_ANIMATION_NAME, false, false);
return;
}
-
+ if(getUserRenderable(user.getUsername()) != null){
+ return;
+ }
usersGroup.addChild(renderable);
SplinePath path = user.getSplinePath();
if (path != null) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|