|
From: <tre...@us...> - 2007-10-02 02:28:30
|
Revision: 465
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=465&view=rev
Author: trevorolio
Date: 2007-10-01 19:28:33 -0700 (Mon, 01 Oct 2007)
Log Message:
-----------
THIS CHECKIN REQUIRES A DB DROP
Introducing a new world of user configurable body settings. Ditched the old BodyRecord and created three new record types:
BodyDataRecords: hold information about the wadges of data which make up a body's base (e.g. mesh, morphs, textures...)
BodyConfigurationRecords: a user level representation of a body configuration, with a display name and a set of...
BodySettingRecords: morph interpolation values for a given body configuration (e.g. height, 0.9 or chin width, 0.2)
Halfway through documentifying and RESTifying these records. I can smell the day when this is autogenerated from annotated classes.
Modified Paths:
--------------
maven/trunk/ogoglio-common/src/main/java/com/ogoglio/client/SpaceClient.java
maven/trunk/ogoglio-common/src/main/java/com/ogoglio/client/WebAPIClient.java
maven/trunk/ogoglio-common/src/main/java/com/ogoglio/client/WebAPIDescriptor.java
maven/trunk/ogoglio-common/src/main/java/com/ogoglio/client/model/Space.java
maven/trunk/ogoglio-common/src/main/java/com/ogoglio/client/model/User.java
maven/trunk/ogoglio-common/src/main/java/com/ogoglio/message/PayloadFactory.java
maven/trunk/ogoglio-common/src/main/java/com/ogoglio/util/ArgumentUtils.java
maven/trunk/ogoglio-common/src/main/java/com/ogoglio/viewer/j3d/J3DUserRenderable.java
maven/trunk/ogoglio-common/src/main/java/com/ogoglio/viewer/j3d/body/Skin.java
maven/trunk/ogoglio-common/src/main/java/com/ogoglio/viewer/j3d/body/SkinLoader.java
maven/trunk/ogoglio-common/src/main/java/com/ogoglio/xml/AccountDocument.java
maven/trunk/ogoglio-common/src/main/java/com/ogoglio/xml/UserDocument.java
maven/trunk/ogoglio-common/src/test/java/com/ogoglio/xml/test/XMLTest.java
Added Paths:
-----------
maven/trunk/ogoglio-common/src/main/java/com/ogoglio/xml/BodyConfigurationDocument.java
maven/trunk/ogoglio-common/src/main/java/com/ogoglio/xml/BodyDataDocument.java
maven/trunk/ogoglio-common/src/main/java/com/ogoglio/xml/BodySettingDocument.java
Removed Paths:
-------------
maven/trunk/ogoglio-common/src/main/java/com/ogoglio/client/model/Body.java
maven/trunk/ogoglio-common/src/main/java/com/ogoglio/xml/BodyDocument.java
Modified: maven/trunk/ogoglio-common/src/main/java/com/ogoglio/client/SpaceClient.java
===================================================================
--- maven/trunk/ogoglio-common/src/main/java/com/ogoglio/client/SpaceClient.java 2007-10-02 02:28:24 UTC (rev 464)
+++ maven/trunk/ogoglio-common/src/main/java/com/ogoglio/client/SpaceClient.java 2007-10-02 02:28:33 UTC (rev 465)
@@ -40,9 +40,7 @@
import com.ogoglio.message.TCPChannel;
import com.ogoglio.util.ArgumentUtils;
import com.ogoglio.util.Log;
-import com.ogoglio.util.UIConstants;
import com.ogoglio.xml.AccountDocument;
-import com.ogoglio.xml.BodyDocument;
import com.ogoglio.xml.DoorDocument;
import com.ogoglio.xml.PageDocument;
import com.ogoglio.xml.ShapeDocument;
@@ -127,7 +125,7 @@
//can't use spaceDoc list of users because it doesn't include the user that just authed (me!)
UserDocument[] userDocs = webClient.getUserDocuments(spaceID);
for (int i = 0; i < userDocs.length; i++) {
- space.addUser(new User(space, userDocs[i].getUsername(), userDocs[i].getTransform(), userDocs[i].getBodyID()));
+ space.addUser(new User(space, userDocs[i].getUsername(), userDocs[i].getTransform()));
}
ThingDocument[] thingDocs = spaceDoc.getThingDocuments();
@@ -291,7 +289,7 @@
if (message.getPayload() instanceof PayloadFactory.SpaceEventPayload) {
SpaceEvent event = ((PayloadFactory.SpaceEventPayload) message.getPayload()).getSpaceEvent();
if (SpaceEvent.ADD_USER_EVENT.equals(event.getName())) {
- User user = new User(space, event.getStringProperty(SpaceEvent.USERNAME), event.getTransform(), event.getLongProperty(SpaceEvent.BODY_ID).longValue());
+ User user = new User(space, event.getStringProperty(SpaceEvent.USERNAME), event.getTransform());
space.addUser(user);
} else if (SpaceEvent.REMOVE_USER_EVENT.equals(event.getName())) {
User user = space.getUser(event.getStringProperty(SpaceEvent.USERNAME));
@@ -693,10 +691,6 @@
}
}
- public BodyDocument getBodyDocument(String username, long bodyID) throws IOException {
- return webClient.getBodyDocument(username, bodyID);
- }
-
public WebAPIClient getWebClient() {
return webClient;
}
Modified: maven/trunk/ogoglio-common/src/main/java/com/ogoglio/client/WebAPIClient.java
===================================================================
--- maven/trunk/ogoglio-common/src/main/java/com/ogoglio/client/WebAPIClient.java 2007-10-02 02:28:24 UTC (rev 464)
+++ maven/trunk/ogoglio-common/src/main/java/com/ogoglio/client/WebAPIClient.java 2007-10-02 02:28:33 UTC (rev 465)
@@ -29,7 +29,7 @@
import com.ogoglio.util.StreamUtils;
import com.ogoglio.xml.AccountDocument;
import com.ogoglio.xml.AuthDocument;
-import com.ogoglio.xml.BodyDocument;
+import com.ogoglio.xml.BodyDataDocument;
import com.ogoglio.xml.DoorDocument;
import com.ogoglio.xml.PageDocument;
import com.ogoglio.xml.PossessionDocument;
@@ -59,7 +59,7 @@
}
public AccountDocument createAccount(String username, String accountLevel, String firstName, String lastName, String homepage, String email, String password) throws IOException {
- AccountDocument newAccountDoc = new AccountDocument(username, accountLevel, firstName, lastName, homepage, password, email, AccountDocument.NO_TIME_VALUE, null, AccountDocument.NO_TIME_VALUE, -1);
+ AccountDocument newAccountDoc = new AccountDocument(username, accountLevel, firstName, lastName, homepage, password, email, AccountDocument.NO_TIME_VALUE, null, AccountDocument.NO_TIME_VALUE);
try {
XMLElement result = wire.sendAuthenticatedXML(descriptor.getAccountURI(), newAccountDoc.toString(), "POST", authenticator.getAuthCookie());
return new AccountDocument(result);
@@ -464,50 +464,20 @@
return wire.sendDelete(descriptor.getSettingURI(spaceID, key), authenticator.getAuthCookie());
}
- public BodyDocument getBodyDocument(String username, long bodyID) throws IOException {
- return new BodyDocument(wire.fetchAuthenticatedXML(descriptor.getBodyURI(username, bodyID), authenticator.getAuthCookie()));
+ public BodyDataDocument createBodyData(String displayName, String fileName) throws IOException {
+ BodyDataDocument doc = new BodyDataDocument(-1, displayName, fileName);
+ XMLElement result = wire.sendAuthenticatedXML(descriptor.getBodiesURI(), doc.toString(), "POST", authenticator.getAuthCookie());
+ return new BodyDataDocument(result);
}
- public BodyDocument[] getBodyDocuments(String username) throws IOException {
- Vector results = new Vector();
-
- XMLElement list = wire.fetchAuthenticatedXML(descriptor.getBodiesURI(username), authenticator.getAuthCookie());
- XMLElement[] children = (XMLElement[]) list.getChildren().toArray(new XMLElement[0]);
- for (int i = 0; i < children.length; i++) {
- results.add(new BodyDocument(children[i]));
- }
-
- return (BodyDocument[]) results.toArray(new BodyDocument[0]);
+ public BodyDataDocument getBodyDataDocument(long bodyDataID) throws IOException {
+ return new BodyDataDocument(wire.fetchAuthenticatedXML(descriptor.getBodyDataDocumentURI(bodyDataID), authenticator.getAuthCookie()));
}
- public BodyDocument createBody(String bodyName) throws IOException {
- BodyDocument bodyDoc = new BodyDocument(-1, authenticator.getUsername(), bodyName, 0, 0, 0, 0, 0, false, 2, 1);
- XMLElement element = wire.postAuthenticatedXML(descriptor.getBodiesURI(authenticator.getUsername()), bodyDoc.toString(), authenticator.getAuthCookie());
- if (element == null) {
- return null;
- }
- return new BodyDocument(element);
+ public void deleteBodyData(long bodyDataID) throws IOException {
+ wire.sendDelete(descriptor.getBodyDataDocumentURI(bodyDataID), authenticator.getAuthCookie());
}
- public BodyDocument updateBody(BodyDocument bodyDoc) throws IOException {
- XMLElement xml = wire.postAuthenticatedXML(descriptor.getBodyURI(bodyDoc.getOwnerUsername(), bodyDoc.getBodyID()), bodyDoc.toString(), authenticator.getAuthCookie());
- return new BodyDocument(xml);
- }
-
- public AccountDocument setDefaultBody(long bodyID) throws IOException {
- AccountDocument newDoc = new AccountDocument(authenticator.getUsername());
- newDoc.setDefaultBodyID(bodyID);
- XMLElement element = wire.postAuthenticatedXML(descriptor.getAccountURI(newDoc.getUsername()), newDoc.toString(), authenticator.getAuthCookie());
- if (element == null) {
- return null;
- }
- return new AccountDocument(element);
- }
-
- public boolean deleteBody(long bodyID) throws IOException {
- return wire.sendDelete(descriptor.getBodyURI(authenticator.getUsername(), bodyID), authenticator.getAuthCookie());
- }
-
public ZipInputStream getBodyData(String bodyName) throws IOException {
InputStream stream = wire.fetchAuthenticatedStream(descriptor.getBodyDataURI(bodyName), authenticator.getAuthCookie());
if(stream == null){
Modified: maven/trunk/ogoglio-common/src/main/java/com/ogoglio/client/WebAPIDescriptor.java
===================================================================
--- maven/trunk/ogoglio-common/src/main/java/com/ogoglio/client/WebAPIDescriptor.java 2007-10-02 02:28:24 UTC (rev 464)
+++ maven/trunk/ogoglio-common/src/main/java/com/ogoglio/client/WebAPIDescriptor.java 2007-10-02 02:28:33 UTC (rev 465)
@@ -115,12 +115,12 @@
return WebAPIUtil.appendToURI(getSpaceURI(spaceID), "user/");
}
- public URI getBodiesURI(String username) {
- return WebAPIUtil.appendToURI(getAccountURI(username), "body/");
+ public URI getBodiesURI() {
+ return WebAPIUtil.appendToURI(getSpacesURI(), "body/");
}
- public URI getBodyURI(String username, long bodyID) {
- return WebAPIUtil.appendToURI(getBodiesURI(username), bodyID + "/");
+ public URI getBodyDataDocumentURI(long bodyDataID) {
+ return WebAPIUtil.appendToURI(getBodiesURI(), bodyDataID + "/");
}
public URI getBodyDataURI(String bodyName) {
Deleted: maven/trunk/ogoglio-common/src/main/java/com/ogoglio/client/model/Body.java
===================================================================
--- maven/trunk/ogoglio-common/src/main/java/com/ogoglio/client/model/Body.java 2007-10-02 02:28:24 UTC (rev 464)
+++ maven/trunk/ogoglio-common/src/main/java/com/ogoglio/client/model/Body.java 2007-10-02 02:28:33 UTC (rev 465)
@@ -1,86 +0,0 @@
-package com.ogoglio.client.model;
-
-public class Body {
-
- private long bodyID = -1;
-
- private int hair = -1;
-
- private int eyes = -1;
-
- private int nose = -1;
-
- private int mouth = -1;
-
- private int face = -1;
-
- private boolean male = false;
-
- private float height = 2;
-
- private float girth = 1;
-
- public Body(long bodyID, int hair, int eyes, int nose, int mouth, int face, boolean isMale, float height, float girth) {
- this.bodyID = bodyID;
- this.hair = hair;
- this.eyes = eyes;
- this.nose = nose;
- this.mouth = mouth;
- this.face = face;
- this.male = isMale;
- this.height = height;
- this.girth = girth;
- }
-
- public long getBodyID() {
- return bodyID;
- }
-
- public int getEyes() {
- return eyes;
- }
-
- public int getFace() {
- return face;
- }
-
- public int getHair() {
- return hair;
- }
-
- public int getMouth() {
- return mouth;
- }
-
- public int getNose() {
- return nose;
- }
-
- public void set(int hairIndex, int eyesIndex, int noseIndex, int mouthIndex, int faceIndex) {
- this.hair = hairIndex;
- this.eyes = eyesIndex;
- this.nose = noseIndex;
- this.mouth = mouthIndex;
- this.face = faceIndex;
- }
-
- public boolean isMale() {
- return male;
- }
-
- public float getHeight() {
- return height;
- }
-
- public void setHeight(float height) {
- this.height = height;
- }
-
- public float getGirth() {
- return girth;
- }
-
- public void setMale(boolean male) {
- this.male = male;
- }
-}
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 2007-10-02 02:28:24 UTC (rev 464)
+++ maven/trunk/ogoglio-common/src/main/java/com/ogoglio/client/model/Space.java 2007-10-02 02:28:33 UTC (rev 465)
@@ -26,8 +26,6 @@
import javax.vecmath.Vector3d;
import com.ogoglio.util.ArgumentUtils;
-import com.ogoglio.util.Log;
-import com.ogoglio.xml.BodyDocument;
public class Space {
@@ -212,8 +210,6 @@
public InputStream getPageContentStream(long thingID, long pageID);
- public BodyDocument getBodyDocument(String username, long bodyID) throws IOException;
-
}
public long getSpaceID() {
@@ -501,12 +497,4 @@
public InputStream getPageContentStream(long thingID, long pageID) throws IOException {
return spaceContext.getPageContentStream(thingID, pageID);
}
-
- public Body getBody(String username, long bodyID) throws IOException {
- if (bodyID < 0) {
- return new Body(-1, 0, 0, 0, 0, 0, false, 2, 0);
- }
- BodyDocument bodyDoc = spaceContext.getBodyDocument(username, bodyID);
- return new Body(bodyDoc.getBodyID(), bodyDoc.getHairIndex(), bodyDoc.getEyesIndex(), bodyDoc.getNoseIndex(), bodyDoc.getMouthIndex(), bodyDoc.getFaceIndex(), bodyDoc.isMale(), bodyDoc.getHeight(), bodyDoc.getGirth());
- }
}
Modified: maven/trunk/ogoglio-common/src/main/java/com/ogoglio/client/model/User.java
===================================================================
--- maven/trunk/ogoglio-common/src/main/java/com/ogoglio/client/model/User.java 2007-10-02 02:28:24 UTC (rev 464)
+++ maven/trunk/ogoglio-common/src/main/java/com/ogoglio/client/model/User.java 2007-10-02 02:28:33 UTC (rev 465)
@@ -28,25 +28,17 @@
private Transform3D position = null;
- private Body body = null;
-
private long pathStarted = -1;
private SplinePath path = null;
- public User(Space space, String username, Transform3D position, long bodyID) {
+ public User(Space space, String username, Transform3D position) {
ArgumentUtils.assertNotNull(space);
this.space = space;
ArgumentUtils.assertNotNull(username);
this.username = username;
ArgumentUtils.assertNotNull(position);
this.position = position;
- try {
- body = space.getBody(username, bodyID);
- } catch (IOException e) {
- e.printStackTrace();
- body = new Body(-1, 0, 0, 0, 0, 0, false, 2, 1);
- }
}
public void startMotion(SplinePath path) {
@@ -74,10 +66,6 @@
return position;
}
- public Body getBody() {
- return body;
- }
-
public Space getSpace() {
return space;
}
Modified: maven/trunk/ogoglio-common/src/main/java/com/ogoglio/message/PayloadFactory.java
===================================================================
--- maven/trunk/ogoglio-common/src/main/java/com/ogoglio/message/PayloadFactory.java 2007-10-02 02:28:24 UTC (rev 464)
+++ maven/trunk/ogoglio-common/src/main/java/com/ogoglio/message/PayloadFactory.java 2007-10-02 02:28:33 UTC (rev 465)
@@ -238,10 +238,8 @@
public static final String USERNAME = "username";
- public static final String BODY_ID = "bodyID";
-
- public AuthenticatedPayload(String username, long bodyID) {
- super(create(username, bodyID));
+ public AuthenticatedPayload(String username) {
+ super(create(username));
}
public AuthenticatedPayload(XMLElement data) {
@@ -252,16 +250,11 @@
return getData().getStringAttribute(USERNAME);
}
- public static XMLElement create(String username, long bodyID) {
+ public static XMLElement create(String username) {
XMLElement data = new XMLElement(NAME);
data.setAttribute(USERNAME, username);
- data.setAttribute(BODY_ID, bodyID);
return data;
}
-
- public long getBodyID() {
- return getData().getLongAttribute(BODY_ID);
- }
}
// This is sent to the space simulator when a client logs out
Modified: maven/trunk/ogoglio-common/src/main/java/com/ogoglio/util/ArgumentUtils.java
===================================================================
--- maven/trunk/ogoglio-common/src/main/java/com/ogoglio/util/ArgumentUtils.java 2007-10-02 02:28:24 UTC (rev 464)
+++ maven/trunk/ogoglio-common/src/main/java/com/ogoglio/util/ArgumentUtils.java 2007-10-02 02:28:33 UTC (rev 465)
@@ -37,8 +37,8 @@
}
}
- public static void assertNotNegative(float skinRed) {
- if (skinRed < 0) {
+ public static void assertNotNegative(float value) {
+ if (value < 0) {
throw new IllegalArgumentException("Argument was less than zero");
}
}
Modified: maven/trunk/ogoglio-common/src/main/java/com/ogoglio/viewer/j3d/J3DUserRenderable.java
===================================================================
--- maven/trunk/ogoglio-common/src/main/java/com/ogoglio/viewer/j3d/J3DUserRenderable.java 2007-10-02 02:28:24 UTC (rev 464)
+++ maven/trunk/ogoglio-common/src/main/java/com/ogoglio/viewer/j3d/J3DUserRenderable.java 2007-10-02 02:28:33 UTC (rev 465)
@@ -19,14 +19,12 @@
import javax.media.j3d.Billboard;
import javax.media.j3d.BoundingSphere;
import javax.media.j3d.BranchGroup;
-import javax.media.j3d.GeometryArray;
import javax.media.j3d.Transform3D;
import javax.media.j3d.TransformGroup;
import javax.vecmath.Color3f;
import javax.vecmath.Vector3d;
import javax.vecmath.Vector3f;
-import com.ogoglio.client.model.Body;
import com.ogoglio.client.model.User;
import com.ogoglio.util.ArgumentUtils;
import com.ogoglio.util.BodyConstants;
@@ -37,7 +35,6 @@
import com.ogoglio.viewer.j3d.body.SkinLoader;
import com.ogoglio.viewer.j3d.bvh.Bvh;
import com.ogoglio.viewer.j3d.smap.SkinMap;
-import com.ogoglio.viewer.j3d.smap.SkinMapParser;
import com.ogoglio.viewer.render.Camera;
import com.ogoglio.viewer.render.UserRenderable;
import com.sun.j3d.utils.geometry.Text2D;
@@ -95,7 +92,7 @@
private void initBody() {
bodyGroup.removeAllChildren();
- skin = new SkinLoader(bodyData, user.getBody()).generateSkin();
+ skin = new SkinLoader(bodyData).generateSkin();
userHeight = skin.getHeight();
skinMap = bodyData.getSkinMap();
@@ -225,8 +222,7 @@
}
public void repaintSkinTexture() {
- Body body = user.getBody();
- skin.updateTexture(body.getHair(), body.getEyes(), body.getNose(), body.getMouth(), body.getFace(), body.isMale());
+ skin.updateTexture();
}
public synchronized void stopAnimation() {
Modified: maven/trunk/ogoglio-common/src/main/java/com/ogoglio/viewer/j3d/body/Skin.java
===================================================================
--- maven/trunk/ogoglio-common/src/main/java/com/ogoglio/viewer/j3d/body/Skin.java 2007-10-02 02:28:24 UTC (rev 464)
+++ maven/trunk/ogoglio-common/src/main/java/com/ogoglio/viewer/j3d/body/Skin.java 2007-10-02 02:28:33 UTC (rev 465)
@@ -53,7 +53,7 @@
private SkinUpdater skinUpdater = null;
- public Skin(int hair, int eyes, int nose, int mouth, int face, boolean isMale, BufferedImage baseImage) {
+ public Skin(BufferedImage baseImage) {
setCapability(Skin.ALLOW_APPEARANCE_WRITE);
setCapability(Skin.ALLOW_PICKABLE_READ);
setCapability(Skin.ALLOW_GEOMETRY_READ);
@@ -68,7 +68,7 @@
texture.getImage(0).setCapability(ImageComponent.ALLOW_IMAGE_READ);
texture.getImage(0).setCapability(ImageComponent.ALLOW_IMAGE_WRITE);
- updateTexture(hair, eyes, nose, mouth, face, isMale);
+ updateTexture();
Appearance appearance = new Appearance();
TextureAttributes textureAtts = new TextureAttributes();
@@ -88,17 +88,7 @@
private class TextureUpdater implements ImageComponent2D.Updater {
- int hair, eyes, nose, mouth, face;
-
- boolean isMale = false;
-
- public TextureUpdater(int hair, int eyes, int nose, int mouth, int face, boolean isMale) {
- this.hair = hair;
- this.eyes = eyes;
- this.nose = nose;
- this.mouth = mouth;
- this.face = face;
- this.isMale = isMale;
+ public TextureUpdater() {
}
public void updateData(ImageComponent2D imageComp, int arg1, int arg2, int arg3, int arg4) {
@@ -107,32 +97,16 @@
}
Graphics g = imageComp.getImage().getGraphics();
g.drawImage(baseImage, 0, 0, null);
-
- /*
- Image[] baseTextures = isMale ? BodyConstants.MALE_BASE_SKIN_TEXTURES : BodyConstants.FEMALE_BASE_SKIN_TEXTURES;
- if (face >= 0 && face < baseTextures.length) {
- g.drawImage(baseTextures[face], 0, 0, null);
- }
- if (eyes >= 0 && eyes < BodyConstants.EYES.length) {
- g.drawImage(BodyConstants.EYES[eyes], 111, 90, 75, 37, null);
- }
- if (nose >= 0 && nose < BodyConstants.NOSES.length) {
- g.drawImage(BodyConstants.NOSES[nose], 135, 105, 25, 50, null);
- }
- if (mouth >= 0 && mouth < BodyConstants.MOUTHES.length) {
- g.drawImage(BodyConstants.MOUTHES[mouth], 121, 151, 50, 25, null);
- }
- */
}
}
- public void updateTexture(int hair, int eyes, int nose, int mouth, int face, boolean isMale) {
+ public void updateTexture() {
if(baseImage == null){
return;
}
ImageComponent2D imageComp = (ImageComponent2D) texture.getImage(0);
- imageComp.updateData(new TextureUpdater(hair, eyes, nose, mouth, face, isMale), 0, 0, baseImage.getWidth(), baseImage.getHeight());
+ imageComp.updateData(new TextureUpdater(), 0, 0, baseImage.getWidth(), baseImage.getHeight());
}
public void setGeometry(Geometry geo) {
Modified: maven/trunk/ogoglio-common/src/main/java/com/ogoglio/viewer/j3d/body/SkinLoader.java
===================================================================
--- maven/trunk/ogoglio-common/src/main/java/com/ogoglio/viewer/j3d/body/SkinLoader.java 2007-10-02 02:28:24 UTC (rev 464)
+++ maven/trunk/ogoglio-common/src/main/java/com/ogoglio/viewer/j3d/body/SkinLoader.java 2007-10-02 02:28:33 UTC (rev 465)
@@ -19,24 +19,22 @@
import javax.media.j3d.GeometryArray;
import javax.vecmath.Vector3f;
-import com.ogoglio.client.model.Body;
import com.ogoglio.viewer.j3d.J3DBodyData;
public class SkinLoader {
+
+ public static final float AVATAR_SIZE = 2; //this will eventually be changable
private GeometryArray geometry = null;
- private Body body = null;
-
private BufferedImage baseImage;
private MorphDeltaMap[] morphDeltaMaps = null;
- public SkinLoader(J3DBodyData bodyData, Body body) {
+ public SkinLoader(J3DBodyData bodyData) {
this.geometry = bodyData.cloneBodyGeometry();
this.morphDeltaMaps = bodyData.getMorphDeltaMaps();
this.baseImage = bodyData.getBaseTexture();
- this.body = body;
}
public Skin generateSkin() {
@@ -64,7 +62,7 @@
maxY = vertices[i];
}
}
- float heightScale = body.getHeight() / Math.abs(maxY - minY);
+ float heightScale = AVATAR_SIZE / Math.abs(maxY - minY);
if (Math.abs(heightScale) > 0.1) {
for (int i = 0; i < vertices.length - 2; i += 3) {
vertices[i] = vertices[i] * heightScale;
@@ -73,7 +71,7 @@
}
}
- Skin skin = new Skin(body.getHair(), body.getEyes(), body.getNose(), body.getMouth(), body.getFace(), body.isMale(), baseImage);
+ Skin skin = new Skin(baseImage);
skin.setGeometry(geometry);
return skin;
Modified: maven/trunk/ogoglio-common/src/main/java/com/ogoglio/xml/AccountDocument.java
===================================================================
--- maven/trunk/ogoglio-common/src/main/java/com/ogoglio/xml/AccountDocument.java 2007-10-02 02:28:24 UTC (rev 464)
+++ maven/trunk/ogoglio-common/src/main/java/com/ogoglio/xml/AccountDocument.java 2007-10-02 02:28:33 UTC (rev 465)
@@ -53,11 +53,9 @@
public static final String FROZEN_UNTIL = "frozenuntil";
- private static final String DEFAULT_BODY_ID = "defaultbodyid";
-
XMLElement data = null;
- public AccountDocument(String username, String accountLevel, String firstName, String lastName, String homepage, String password, String email, long creationDate, String cookie, long frozenUntil, long defaultBodyID) {
+ public AccountDocument(String username, String accountLevel, String firstName, String lastName, String homepage, String password, String email, long creationDate, String cookie, long frozenUntil) {
data = new XMLElement(NAME);
if (username == null) {
@@ -86,8 +84,6 @@
data.setAttribute(CREATION_DATE, creationDate);
if (frozenUntil!=AccountDocument.NO_TIME_VALUE)
data.setAttribute(FROZEN_UNTIL, frozenUntil);
- if(defaultBodyID > -1)
- data.setAttribute(DEFAULT_BODY_ID, defaultBodyID);
}
public AccountDocument(XMLElement data) {
@@ -101,7 +97,7 @@
}
public AccountDocument(String username) { //used when updating the document, with absent items indicating no change
- this(username, null, null, null, null, null, null, AccountDocument.NO_TIME_VALUE, null, AccountDocument.NO_TIME_VALUE, 1);
+ this(username, null, null, null, null, null, null, AccountDocument.NO_TIME_VALUE, null, AccountDocument.NO_TIME_VALUE);
}
public XMLElement toElement() {
@@ -172,18 +168,6 @@
}
}
- public long getDefaultBodyID() {
- return data.getLongAttribute(DEFAULT_BODY_ID, -1);
- }
-
- public void setDefaultBodyID(long bodyID) {
- if(bodyID != -1) {
- data.setAttribute(DEFAULT_BODY_ID, bodyID);
- } else {
- data.removeAttribute(DEFAULT_BODY_ID);
- }
- }
-
public int hashCode() {
return getUsername().hashCode();
}
Added: maven/trunk/ogoglio-common/src/main/java/com/ogoglio/xml/BodyConfigurationDocument.java
===================================================================
--- maven/trunk/ogoglio-common/src/main/java/com/ogoglio/xml/BodyConfigurationDocument.java (rev 0)
+++ maven/trunk/ogoglio-common/src/main/java/com/ogoglio/xml/BodyConfigurationDocument.java 2007-10-02 02:28:33 UTC (rev 465)
@@ -0,0 +1,88 @@
+/* Copyright 2007 Transmutable (http://transmutable.com/)
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License. */
+package com.ogoglio.xml;
+
+import nanoxml.XMLElement;
+
+import com.ogoglio.util.ArgumentUtils;
+
+public class BodyConfigurationDocument {
+
+ public static final String NAME = "bodyconfiguration";
+
+ private static final String BODY_CONFIGURATION_ID = "bodyconfigurationid";
+
+ private static final String OWNER_USERNAME = "ownerusername";
+
+ public static final String DISPLAY_NAME = "displayname";
+
+ public static final String BODY_DATA_ID = "bodydataid";
+
+ private XMLElement data = null;
+
+ public BodyConfigurationDocument(long bodyConfigurationID, String ownerUsername, String displayName, long bodyDataID) {
+ data = new XMLElement(NAME);
+ data.setAttribute(BODY_CONFIGURATION_ID, bodyDataID);
+ ArgumentUtils.assertNotEmpty(ownerUsername);
+ data.setAttribute(OWNER_USERNAME, ownerUsername);
+ ArgumentUtils.assertNotNull(displayName);
+ data.setAttribute(DISPLAY_NAME, displayName);
+ ArgumentUtils.assertNotNegative(bodyDataID);
+ data.setAttribute(BODY_DATA_ID, bodyDataID);
+ }
+
+ public BodyConfigurationDocument(XMLElement data) {
+ if (!NAME.equals(data.getName())) {
+ throw new IllegalArgumentException("data is not named " + NAME + ": " + data);
+ }
+ this.data = data;
+ }
+
+ public long getBodyConfigurationID(){
+ return data.getLongAttribute(BODY_CONFIGURATION_ID);
+ }
+
+ public String getDisplayName(){
+ return data.getStringAttribute(DISPLAY_NAME);
+ }
+
+ public String getOwnerUsername(){
+ return data.getStringAttribute(OWNER_USERNAME);
+ }
+
+ public long getBodyDataID(){
+ return data.getLongAttribute(BODY_CONFIGURATION_ID);
+ }
+
+ public void addBodySetting(long bodySettingID, String settingName, long setting) {
+ data.addChild(new BodySettingDocument(bodySettingID, getBodyConfigurationID(), settingName, setting).toElement());
+ }
+
+ public BodySettingDocument[] getBodySettingDocuments() {
+ XMLElement[] elements = data.getChildren(BodySettingDocument.NAME);
+ BodySettingDocument[] results = new BodySettingDocument[elements.length];
+ for (int i = 0; i < results.length; i++) {
+ results[i] = new BodySettingDocument(elements[i]);
+ }
+ return results;
+ }
+
+ public XMLElement toElement(){
+ return data;
+ }
+
+ public String toString(){
+ return data.toString();
+ }
+}
Added: maven/trunk/ogoglio-common/src/main/java/com/ogoglio/xml/BodyDataDocument.java
===================================================================
--- maven/trunk/ogoglio-common/src/main/java/com/ogoglio/xml/BodyDataDocument.java (rev 0)
+++ maven/trunk/ogoglio-common/src/main/java/com/ogoglio/xml/BodyDataDocument.java 2007-10-02 02:28:33 UTC (rev 465)
@@ -0,0 +1,67 @@
+/* Copyright 2007 Transmutable (http://transmutable.com/)
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License. */
+package com.ogoglio.xml;
+
+import nanoxml.XMLElement;
+
+import com.ogoglio.util.ArgumentUtils;
+
+public class BodyDataDocument {
+
+ public static final String NAME = "bodydata";
+
+ private static final String BODY_DATA_ID = "bodydataid";
+
+ private static final String DISPLAY_NAME = "displayname";
+
+ private static final String FILE_NAME = "filename";
+
+ private XMLElement data = null;
+
+ public BodyDataDocument(long bodyDataID, String displayName, String fileName) {
+ data = new XMLElement(NAME);
+ data.setAttribute(BODY_DATA_ID, bodyDataID);
+ ArgumentUtils.assertNotNull(displayName);
+ data.setAttribute(DISPLAY_NAME, displayName);
+ ArgumentUtils.assertNotNull(fileName);
+ data.setAttribute(FILE_NAME, fileName);
+ }
+
+ public BodyDataDocument(XMLElement data) {
+ if (!NAME.equals(data.getName())) {
+ throw new IllegalArgumentException("data is not named " + NAME + ": " + data);
+ }
+ this.data = data;
+ }
+
+ public String getDisplayName() {
+ return data.getStringAttribute(DISPLAY_NAME);
+ }
+
+ public String getFileName() {
+ return data.getStringAttribute(FILE_NAME);
+ }
+
+ public long getBodyDataID() {
+ return data.getLongAttribute(BODY_DATA_ID);
+ }
+
+ public XMLElement toElement() {
+ return data;
+ }
+
+ public String toString() {
+ return data.toString();
+ }
+}
Deleted: maven/trunk/ogoglio-common/src/main/java/com/ogoglio/xml/BodyDocument.java
===================================================================
--- maven/trunk/ogoglio-common/src/main/java/com/ogoglio/xml/BodyDocument.java 2007-10-02 02:28:24 UTC (rev 464)
+++ maven/trunk/ogoglio-common/src/main/java/com/ogoglio/xml/BodyDocument.java 2007-10-02 02:28:33 UTC (rev 465)
@@ -1,178 +0,0 @@
-/* Copyright 2007 Transmutable (http://transmutable.com/)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License. */
-package com.ogoglio.xml;
-
-import nanoxml.XMLElement;
-
-import com.ogoglio.util.ArgumentUtils;
-
-public class BodyDocument {
-
- public static final String NAME = "body";
-
- public static final String BODY_ID = "bodyid";
-
- public static final String OWNER_USERNAME = "ownerusername";
-
- public static final String DISPLAY_NAME = "displayname";
-
- public static final String HAIR_INDEX = "hair";
-
- public static final String EYES_INDEX = "eyes";
-
- public static final String NOSE_INDEX = "nose";
-
- public static final String MOUTH_INDEX = "mouth";
-
- public static final String FACE_INDEX = "face";
-
- public static final String IS_MALE = "ismale";
-
- public static final String HEIGHT = "height";
-
- public static final String GIRTH = "girth";
-
- XMLElement data = null;
-
- public BodyDocument(long bodyID, String ownerUsername, String displayName, int hair, int eyes, int nose, int mouth, int face, boolean isMale, float height, float girth) {
- data = new XMLElement(NAME);
-
- data.setAttribute(BODY_ID, bodyID);
- ArgumentUtils.assertNotNull(ownerUsername);
- data.setAttribute(OWNER_USERNAME, ownerUsername);
- ArgumentUtils.assertNotNull(displayName);
- data.setAttribute(DISPLAY_NAME, displayName);
- ArgumentUtils.assertNotNegative(hair);
- data.setAttribute(HAIR_INDEX, hair);
- ArgumentUtils.assertNotNegative(eyes);
- data.setAttribute(EYES_INDEX, eyes);
- ArgumentUtils.assertNotNegative(nose);
- data.setAttribute(NOSE_INDEX, nose);
- ArgumentUtils.assertNotNegative(mouth);
- data.setAttribute(MOUTH_INDEX, mouth);
- ArgumentUtils.assertNotNegative(face);
- data.setAttribute(FACE_INDEX, face);
- data.setAttribute(IS_MALE, isMale);
- data.setAttribute(HEIGHT, height);
- data.setAttribute(GIRTH, girth);
- }
-
- public BodyDocument(XMLElement data) {
- ArgumentUtils.assertNotNull(data);
- if (!NAME.equals(data.getName())) {
- throw new IllegalArgumentException("data is not named " + NAME + ": " + data);
- }
- ArgumentUtils.assertNotNegative(data.getLongAttribute(BODY_ID, -1));
- ArgumentUtils.assertNotNull(data.getStringAttribute(OWNER_USERNAME));
- ArgumentUtils.assertNotNull(data.getStringAttribute(DISPLAY_NAME));
- this.data = data;
- }
-
- public XMLElement toElement() {
- return data;
- }
-
- public String toString() {
- return data.toString();
- }
-
- public long getBodyID() {
- return data.getLongAttribute(BODY_ID);
- }
-
- public String getOwnerUsername() {
- return data.getStringAttribute(OWNER_USERNAME);
- }
-
- public String getDisplayName() {
- return data.getStringAttribute(DISPLAY_NAME);
- }
-
- public int getHairIndex() {
- return data.getIntAttribute(HAIR_INDEX);
- }
-
- public void setHairIndex(int index) {
- ArgumentUtils.assertNotNegative(index);
- data.setAttribute(HAIR_INDEX, index);
- }
-
- public int getEyesIndex() {
- return data.getIntAttribute(EYES_INDEX);
- }
-
- public void setEyesIndex(int index) {
- ArgumentUtils.assertNotNegative(index);
- data.setAttribute(EYES_INDEX, index);
- }
-
- public int getNoseIndex() {
- return data.getIntAttribute(NOSE_INDEX);
- }
-
- public void setNoseIndex(int index) {
- ArgumentUtils.assertNotNegative(index);
- data.setAttribute(NOSE_INDEX, index);
- }
-
- public int getMouthIndex() {
- return data.getIntAttribute(MOUTH_INDEX);
- }
-
- public void setMouthIndex(int index) {
- ArgumentUtils.assertNotNegative(index);
- data.setAttribute(MOUTH_INDEX, index);
- }
-
- public int getFaceIndex() {
- return data.getIntAttribute(FACE_INDEX);
- }
-
- public void setFaceIndex(int index) {
- ArgumentUtils.assertNotNegative(index);
- data.setAttribute(FACE_INDEX, index);
- }
-
- public boolean isMale() {
- return data.getBooleanAttribute(IS_MALE);
- }
-
- public float getHeight() {
- return data.getFloatAttribute(HEIGHT);
- }
-
- public void setHeight(float newHeight) {
- data.setAttribute(HEIGHT, newHeight);
- }
-
- public float getGirth() {
- return data.getFloatAttribute(GIRTH);
- }
-
- public void setGirth(float girth) {
- data.setAttribute(GIRTH, girth);
- }
-
- public boolean equals(Object obj) {
- if (obj == null || !(obj instanceof BodyDocument)) {
- return false;
- }
- return ((BodyDocument) obj).getBodyID() == getBodyID();
- }
-
- public int hashCode() {
- return ("BodyDocument-" + getBodyID()).hashCode();
- }
-
-}
\ No newline at end of file
Added: maven/trunk/ogoglio-common/src/main/java/com/ogoglio/xml/BodySettingDocument.java
===================================================================
--- maven/trunk/ogoglio-common/src/main/java/com/ogoglio/xml/BodySettingDocument.java (rev 0)
+++ maven/trunk/ogoglio-common/src/main/java/com/ogoglio/xml/BodySettingDocument.java 2007-10-02 02:28:33 UTC (rev 465)
@@ -0,0 +1,63 @@
+package com.ogoglio.xml;
+
+import nanoxml.XMLElement;
+
+import com.ogoglio.util.ArgumentUtils;
+
+public class BodySettingDocument {
+
+ public static final String NAME = "bodysetting";
+
+ private static final String BODY_SETTING_ID = "bodysettingid";
+
+ private static final String BODY_CONFIGURATION_ID = "bodyconfigurationid";
+
+ private static final String SETTING_NAME = "settingname";
+
+ private static final String SETTING = "setting";
+
+ private XMLElement data = null;
+
+ public BodySettingDocument(long bodySettingID, long bodyConfigurationID, String settingName, long setting) {
+ data = new XMLElement(NAME);
+ data.setAttribute(BODY_SETTING_ID, bodySettingID);
+ ArgumentUtils.assertNotNegative(bodyConfigurationID);
+ data.setAttribute(BODY_CONFIGURATION_ID, bodyConfigurationID);
+ ArgumentUtils.assertNotEmpty(settingName);
+ data.setAttribute(SETTING_NAME, settingName);
+ ArgumentUtils.assertNotNegative(setting);
+ data.setAttribute(SETTING, setting);
+ }
+
+ public BodySettingDocument(XMLElement data) {
+ if (!NAME.equals(data.getName())) {
+ throw new IllegalArgumentException("data is not named " + NAME + ": " + data);
+ }
+ this.data = data;
+ }
+
+ public long getBodySettingID() {
+ return data.getLongAttribute(BODY_SETTING_ID);
+ }
+
+ public long getBodyConfigurationID() {
+ return data.getLongAttribute(BODY_CONFIGURATION_ID);
+ }
+
+ public String getSettingName() {
+ return data.getStringAttribute(SETTING_NAME);
+ }
+
+ public float getSetting() {
+ return data.getFloatAttribute(SETTING);
+ }
+
+ public XMLElement toElement() {
+ return data;
+ }
+
+ public String toString() {
+ return data.toString();
+ }
+
+}
Modified: maven/trunk/ogoglio-common/src/main/java/com/ogoglio/xml/UserDocument.java
===================================================================
--- maven/trunk/ogoglio-common/src/main/java/com/ogoglio/xml/UserDocument.java 2007-10-02 02:28:24 UTC (rev 464)
+++ maven/trunk/ogoglio-common/src/main/java/com/ogoglio/xml/UserDocument.java 2007-10-02 02:28:33 UTC (rev 465)
@@ -26,17 +26,14 @@
public static final String USERNAME = "username";
- public static final String BODY_ID = "bodyid";
-
public UserDocument(User user) {
- this(user.getUsername(), user.getPosition(), user.getSplinePath(), user.getBody().getBodyID());
+ this(user.getUsername(), user.getPosition(), user.getSplinePath());
}
- public UserDocument(String username, Transform3D transform, SplinePath splinePath, long bodyID) {
+ public UserDocument(String username, Transform3D transform, SplinePath splinePath) {
super(NAME, transform, splinePath);
ArgumentUtils.assertNotNull(username);
getData().setAttribute(USERNAME, username);
- getData().setAttribute(BODY_ID, bodyID);
}
public UserDocument(XMLElement data) {
@@ -50,8 +47,4 @@
public String getUsername() {
return getData().getStringAttribute(USERNAME);
}
-
- public long getBodyID() {
- return getData().getLongAttribute(BODY_ID, -1);
- }
}
Modified: maven/trunk/ogoglio-common/src/test/java/com/ogoglio/xml/test/XMLTest.java
===================================================================
--- maven/trunk/ogoglio-common/src/test/java/com/ogoglio/xml/test/XMLTest.java 2007-10-02 02:28:24 UTC (rev 464)
+++ maven/trunk/ogoglio-common/src/test/java/com/ogoglio/xml/test/XMLTest.java 2007-10-02 02:28:33 UTC (rev 465)
@@ -17,7 +17,6 @@
import com.ogoglio.viewer.j3d.J3DSplinePath;
import com.ogoglio.xml.AccountDocument;
import com.ogoglio.xml.AuthDocument;
-import com.ogoglio.xml.BodyDocument;
import com.ogoglio.xml.DoorDocument;
import com.ogoglio.xml.PossessionDocument;
import com.ogoglio.xml.ShapeDocument;
@@ -87,7 +86,7 @@
}
public void testAccountDocument() {
- AccountDocument doc1 = new AccountDocument(username1, accountLevel1, firstName1, lastName1, company1, password1, email1, creationDate1, cookie1, frozenUntil1, 2);
+ AccountDocument doc1 = new AccountDocument(username1, accountLevel1, firstName1, lastName1, company1, password1, email1, creationDate1, cookie1, frozenUntil1);
XMLElement element = new XMLElement();
element.parseString(doc1.toString());
AccountDocument doc2 = new AccountDocument(element);
@@ -190,7 +189,7 @@
assertEquals(0, shapeMove1.getSplinePath().getSplineKeyFrames()[1].getKnot(), keyFrames[1].getKnot());
assertEquals(shapeMove1.getShapeName(), "a_shape");
- UserDocument userDoc = new UserDocument(username, new Transform3D(), null, 1);
+ UserDocument userDoc = new UserDocument(username, new Transform3D(), null);
assertEquals(username, userDoc.getUsername());
userDoc = new UserDocument(XMLElement.parseElementFromString(userDoc.toString()));
@@ -210,24 +209,6 @@
assertEquals(uri1, door1.getLink());
}
- public void testBodyDocument() {
- String displayName = "Hot Angry Ant";
- String ownerUsername = "trevor";
- long bodyID = 42;
- BodyDocument doc1 = new BodyDocument(bodyID, ownerUsername, displayName, 0, 1, 2, 3, 4, false, 2, 1);
- assertEquals(displayName, doc1.getDisplayName());
- assertEquals(ownerUsername, doc1.getOwnerUsername());
- assertEquals(bodyID, doc1.getBodyID());
-
- doc1 = new BodyDocument(XMLElement.parseElementFromString(doc1.toString()));
- assertEquals(displayName, doc1.getDisplayName());
- assertEquals(ownerUsername, doc1.getOwnerUsername());
- assertEquals(bodyID, doc1.getBodyID());
-
- BodyDocument doc2 = new BodyDocument(XMLElement.parseElementFromString(doc1.toString()));
- assertEquals(doc1, doc2);
- }
-
public void testSpaceDocuments() {
DateFormat fmt=DateFormat.getDateTimeInstance(DateFormat.FULL,
DateFormat.FULL, Locale.US);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|