minor refactor of some properties for readability

0.6.0-stable
Sean Dague 2008-05-15 15:10:13 +00:00
parent 8e7f2d6d0e
commit 0c509ecdde
4 changed files with 50 additions and 50 deletions

View File

@ -68,27 +68,27 @@ namespace OpenSim.Framework
public readonly static int VISUALPARAM_COUNT = 218; public readonly static int VISUALPARAM_COUNT = 218;
protected LLUUID m_scenePresenceID; protected LLUUID m_owner;
public LLUUID ScenePresenceID public LLUUID Owner
{ {
get { return m_scenePresenceID; } get { return m_owner; }
set { m_scenePresenceID = value; } set { m_owner = value; }
} }
protected int m_wearablesSerial = 1; protected int m_serial = 1;
public int WearablesSerial public int Serial
{ {
get { return m_wearablesSerial; } get { return m_serial; }
set { m_wearablesSerial = value; } set { m_serial = value; }
} }
protected byte[] m_visualParams; protected byte[] m_visualparams;
public byte[] VisualParams public byte[] VisualParams
{ {
get { return m_visualParams; } get { return m_visualparams; }
set { m_visualParams = value; } set { m_visualparams = value; }
} }
protected AvatarWearable[] m_wearables; protected AvatarWearable[] m_wearables;
@ -99,12 +99,12 @@ namespace OpenSim.Framework
set { m_wearables = value; } set { m_wearables = value; }
} }
protected LLObject.TextureEntry m_textureEntry; protected LLObject.TextureEntry m_texture;
public LLObject.TextureEntry TextureEntry public LLObject.TextureEntry Texture
{ {
get { return m_textureEntry; } get { return m_texture; }
set { m_textureEntry = value; } set { m_texture = value; }
} }
protected float m_avatarHeight = 0; protected float m_avatarHeight = 0;
@ -123,18 +123,18 @@ namespace OpenSim.Framework
// this makes them all null // this makes them all null
m_wearables[i] = new AvatarWearable(); m_wearables[i] = new AvatarWearable();
} }
m_wearablesSerial = 0; m_serial = 0;
m_scenePresenceID = LLUUID.Zero; m_owner = LLUUID.Zero;
m_visualParams = new byte[VISUALPARAM_COUNT]; m_visualparams = new byte[VISUALPARAM_COUNT];
} }
public AvatarAppearance(LLUUID avatarID, AvatarWearable[] wearables, byte[] visualParams) public AvatarAppearance(LLUUID avatarID, AvatarWearable[] wearables, byte[] visualParams)
{ {
m_scenePresenceID = avatarID; m_owner = avatarID;
m_wearablesSerial = 1; m_serial = 1;
m_wearables = wearables; m_wearables = wearables;
m_visualParams = visualParams; m_visualparams = visualParams;
m_textureEntry = GetDefaultTextureEntry(); m_texture = GetDefaultTexture();
} }
/// <summary> /// <summary>
@ -145,15 +145,15 @@ namespace OpenSim.Framework
public void SetAppearance(byte[] texture, List<byte> visualParam) public void SetAppearance(byte[] texture, List<byte> visualParam)
{ {
LLObject.TextureEntry textureEnt = new LLObject.TextureEntry(texture, 0, texture.Length); LLObject.TextureEntry textureEnt = new LLObject.TextureEntry(texture, 0, texture.Length);
m_textureEntry = textureEnt; m_texture = textureEnt;
m_visualParams = visualParam.ToArray(); m_visualparams = visualParam.ToArray();
// Teravus : Nifty AV Height Getting Maaaaagical formula. Oh how we love turning 0-255 into meters. // Teravus : Nifty AV Height Getting Maaaaagical formula. Oh how we love turning 0-255 into meters.
// (float)m_visualParams[25] = Height // (float)m_visualParams[25] = Height
// (float)m_visualParams[125] = LegLength // (float)m_visualParams[125] = LegLength
m_avatarHeight = (1.50856f + (((float) m_visualParams[25]/255.0f)*(2.525506f - 1.50856f))) m_avatarHeight = (1.50856f + (((float) m_visualparams[25]/255.0f)*(2.525506f - 1.50856f)))
+ (((float) m_visualParams[125]/255.0f)/1.5f); + (((float) m_visualparams[125]/255.0f)/1.5f);
} }
public void SetWearable(int wearableId, AvatarWearable wearable) public void SetWearable(int wearableId, AvatarWearable wearable)
@ -161,7 +161,7 @@ namespace OpenSim.Framework
m_wearables[wearableId] = wearable; m_wearables[wearableId] = wearable;
} }
public static LLObject.TextureEntry GetDefaultTextureEntry() public static LLObject.TextureEntry GetDefaultTexture()
{ {
LLObject.TextureEntry textu = new LLObject.TextureEntry(new LLUUID("C228D1CF-4B5D-4BA8-84F4-899A0796AA97")); LLObject.TextureEntry textu = new LLObject.TextureEntry(new LLUUID("C228D1CF-4B5D-4BA8-84F4-899A0796AA97"));
textu.CreateFace(0).TextureID = new LLUUID("00000000-0000-1111-9999-000000000012"); textu.CreateFace(0).TextureID = new LLUUID("00000000-0000-1111-9999-000000000012");
@ -183,13 +183,13 @@ namespace OpenSim.Framework
throw new ArgumentNullException("info"); throw new ArgumentNullException("info");
} }
m_scenePresenceID = new LLUUID((Guid)info.GetValue("m_scenePresenceID", typeof(Guid))); m_owner = new LLUUID((Guid)info.GetValue("m_scenePresenceID", typeof(Guid)));
m_wearablesSerial = (int)info.GetValue("m_wearablesSerial", typeof(int)); m_serial = (int)info.GetValue("m_wearablesSerial", typeof(int));
m_visualParams = (byte[])info.GetValue("m_visualParams", typeof(byte[])); m_visualparams = (byte[])info.GetValue("m_visualParams", typeof(byte[]));
m_wearables = (AvatarWearable[])info.GetValue("m_wearables", typeof(AvatarWearable[])); m_wearables = (AvatarWearable[])info.GetValue("m_wearables", typeof(AvatarWearable[]));
byte[] m_textureEntry_work = (byte[])info.GetValue("m_textureEntry", typeof(byte[])); byte[] m_textureEntry_work = (byte[])info.GetValue("m_textureEntry", typeof(byte[]));
m_textureEntry = new LLObject.TextureEntry(m_textureEntry_work, 0, m_textureEntry_work.Length); m_texture = new LLObject.TextureEntry(m_textureEntry_work, 0, m_textureEntry_work.Length);
m_avatarHeight = (float)info.GetValue("m_avatarHeight", typeof(float)); m_avatarHeight = (float)info.GetValue("m_avatarHeight", typeof(float));
@ -206,11 +206,11 @@ namespace OpenSim.Framework
throw new ArgumentNullException("info"); throw new ArgumentNullException("info");
} }
info.AddValue("m_scenePresenceID", m_scenePresenceID.UUID); info.AddValue("m_scenePresenceID", m_owner.UUID);
info.AddValue("m_wearablesSerial", m_wearablesSerial); info.AddValue("m_wearablesSerial", m_serial);
info.AddValue("m_visualParams", m_visualParams); info.AddValue("m_visualParams", m_visualparams);
info.AddValue("m_wearables", m_wearables); info.AddValue("m_wearables", m_wearables);
info.AddValue("m_textureEntry", m_textureEntry.ToBytes()); info.AddValue("m_textureEntry", m_texture.ToBytes());
info.AddValue("m_avatarHeight", m_avatarHeight); info.AddValue("m_avatarHeight", m_avatarHeight);
} }
} }

View File

@ -1415,7 +1415,7 @@ namespace OpenSim.Region.Environment.Scenes
public void SendFullUpdateToOtherClient(ScenePresence remoteAvatar) public void SendFullUpdateToOtherClient(ScenePresence remoteAvatar)
{ {
remoteAvatar.m_controllingClient.SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_uuid, remoteAvatar.m_controllingClient.SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_uuid,
LocalId, m_pos, m_appearance.TextureEntry.ToBytes(), LocalId, m_pos, m_appearance.Texture.ToBytes(),
m_parentID); m_parentID);
m_scene.AddAgentUpdates(1); m_scene.AddAgentUpdates(1);
} }
@ -1451,7 +1451,7 @@ namespace OpenSim.Region.Environment.Scenes
public void SendInitialData() public void SendInitialData()
{ {
m_controllingClient.SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_uuid, LocalId, m_controllingClient.SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_uuid, LocalId,
m_pos, m_appearance.TextureEntry.ToBytes(), m_parentID); m_pos, m_appearance.Texture.ToBytes(), m_parentID);
if (!m_isChildAgent) if (!m_isChildAgent)
{ {
m_scene.InformClientOfNeighbours(this); m_scene.InformClientOfNeighbours(this);
@ -1465,7 +1465,7 @@ namespace OpenSim.Region.Environment.Scenes
public void SetWearable(IClientAPI client, int wearableId, AvatarWearable wearable) public void SetWearable(IClientAPI client, int wearableId, AvatarWearable wearable)
{ {
m_appearance.SetWearable(wearableId, wearable); m_appearance.SetWearable(wearableId, wearable);
client.SendWearables(m_appearance.Wearables, m_appearance.WearablesSerial++); client.SendWearables(m_appearance.Wearables, m_appearance.Serial++);
} }
/// <summary> /// <summary>
@ -1474,7 +1474,7 @@ namespace OpenSim.Region.Environment.Scenes
/// <param name="client"></param> /// <param name="client"></param>
public void SendOwnAppearance() public void SendOwnAppearance()
{ {
ControllingClient.SendWearables(m_appearance.Wearables, m_appearance.WearablesSerial++); ControllingClient.SendWearables(m_appearance.Wearables, m_appearance.Serial++);
} }
/// <summary> /// <summary>
@ -1497,9 +1497,9 @@ namespace OpenSim.Region.Environment.Scenes
public void SendAppearanceToOtherAgent(ScenePresence avatar) public void SendAppearanceToOtherAgent(ScenePresence avatar)
{ {
avatar.ControllingClient.SendAppearance( avatar.ControllingClient.SendAppearance(
m_appearance.ScenePresenceID, m_appearance.Owner,
m_appearance.VisualParams, m_appearance.VisualParams,
m_appearance.TextureEntry.ToBytes() m_appearance.Texture.ToBytes()
); );
} }
@ -1804,7 +1804,7 @@ namespace OpenSim.Region.Environment.Scenes
static ScenePresence() static ScenePresence()
{ {
LLObject.TextureEntry textu = AvatarAppearance.GetDefaultTextureEntry(); LLObject.TextureEntry textu = AvatarAppearance.GetDefaultTexture();
DefaultTexture = textu.ToBytes(); DefaultTexture = textu.ToBytes();
} }
@ -1983,7 +1983,7 @@ namespace OpenSim.Region.Environment.Scenes
*/ */
if (DefaultTexture == null) if (DefaultTexture == null)
{ {
LLObject.TextureEntry textu = AvatarAppearance.GetDefaultTextureEntry(); LLObject.TextureEntry textu = AvatarAppearance.GetDefaultTexture();
DefaultTexture = textu.ToBytes(); DefaultTexture = textu.ToBytes();
} }
} }
@ -2064,7 +2064,7 @@ namespace OpenSim.Region.Environment.Scenes
*/ */
if (DefaultTexture == null) if (DefaultTexture == null)
{ {
LLObject.TextureEntry textu = AvatarAppearance.GetDefaultTextureEntry(); LLObject.TextureEntry textu = AvatarAppearance.GetDefaultTexture();
DefaultTexture = textu.ToBytes(); DefaultTexture = textu.ToBytes();
} }

View File

@ -50,12 +50,12 @@ namespace OpenSim.Region.Modules.AvatarFactory
m_schema = rowMapperSchema; m_schema = rowMapperSchema;
m_keyFieldMapper = rowMapperSchema.AddMapping<Guid>("UUID", m_keyFieldMapper = rowMapperSchema.AddMapping<Guid>("UUID",
delegate(AppearanceRowMapper mapper) { return mapper.Object.ScenePresenceID.UUID; }, delegate(AppearanceRowMapper mapper) { return mapper.Object.Owner.UUID; },
delegate(AppearanceRowMapper mapper, Guid value) { mapper.Object.ScenePresenceID = new LLUUID(value.ToString()); }); delegate(AppearanceRowMapper mapper, Guid value) { mapper.Object.Owner = new LLUUID(value.ToString()); });
rowMapperSchema.AddMapping<uint>("Serial", rowMapperSchema.AddMapping<uint>("Serial",
delegate(AppearanceRowMapper mapper) { return (uint)mapper.Object.WearablesSerial; }, delegate(AppearanceRowMapper mapper) { return (uint)mapper.Object.Serial; },
delegate(AppearanceRowMapper mapper, uint value) { mapper.Object.WearablesSerial = (int)value; }); delegate(AppearanceRowMapper mapper, uint value) { mapper.Object.Serial = (int)value; });
rowMapperSchema.AddMapping<Guid>("WearableItem0", rowMapperSchema.AddMapping<Guid>("WearableItem0",
delegate(AppearanceRowMapper mapper) { return mapper.Object.Wearables[0].ItemID.UUID; }, delegate(AppearanceRowMapper mapper) { return mapper.Object.Wearables[0].ItemID.UUID; },
@ -196,7 +196,7 @@ namespace OpenSim.Region.Modules.AvatarFactory
public bool Update(Guid userID, AvatarAppearance appearance) public bool Update(Guid userID, AvatarAppearance appearance)
{ {
AppearanceRowMapper mapper = CreateRowMapper(appearance); AppearanceRowMapper mapper = CreateRowMapper(appearance);
return Update(appearance.ScenePresenceID.UUID, mapper); return Update(appearance.Owner.UUID, mapper);
} }
protected AppearanceRowMapper CreateRowMapper(AvatarAppearance appearance) protected AppearanceRowMapper CreateRowMapper(AvatarAppearance appearance)

View File

@ -182,7 +182,7 @@ namespace OpenSim.Region.Modules.AvatarFactory
if (m_appearanceMapper.TryGetValue(avatarId.UUID, out appearance)) if (m_appearanceMapper.TryGetValue(avatarId.UUID, out appearance))
{ {
appearance.VisualParams = GetDefaultVisualParams(); appearance.VisualParams = GetDefaultVisualParams();
appearance.TextureEntry = AvatarAppearance.GetDefaultTextureEntry(); appearance.Texture = AvatarAppearance.GetDefaultTexture();
lock (m_avatarsAppearance) lock (m_avatarsAppearance)
{ {
m_avatarsAppearance[avatarId] = appearance; m_avatarsAppearance[avatarId] = appearance;