aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Scenes/AvatarAppearance.cs
diff options
context:
space:
mode:
authorAdam Frisby2008-05-01 16:35:00 +0000
committerAdam Frisby2008-05-01 16:35:00 +0000
commit13526097f24b7a8ad63b1d482c44b44397fa055f (patch)
tree7a82c20ed7c63e2aea5ad3863325e37f64e1cbea /OpenSim/Region/Environment/Scenes/AvatarAppearance.cs
parent* Breaking all the code, breaking all the code..! (diff)
downloadopensim-SC-13526097f24b7a8ad63b1d482c44b44397fa055f.zip
opensim-SC-13526097f24b7a8ad63b1d482c44b44397fa055f.tar.gz
opensim-SC-13526097f24b7a8ad63b1d482c44b44397fa055f.tar.bz2
opensim-SC-13526097f24b7a8ad63b1d482c44b44397fa055f.tar.xz
* Spring cleaning on Region.Environment.
* Converted a large number of read-only fields to be actually, readonly. * Reformatted code sections. * Removed redundant code.
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Environment/Scenes/AvatarAppearance.cs123
1 files changed, 62 insertions, 61 deletions
diff --git a/OpenSim/Region/Environment/Scenes/AvatarAppearance.cs b/OpenSim/Region/Environment/Scenes/AvatarAppearance.cs
index 8f29507..860399c 100644
--- a/OpenSim/Region/Environment/Scenes/AvatarAppearance.cs
+++ b/OpenSim/Region/Environment/Scenes/AvatarAppearance.cs
@@ -37,14 +37,54 @@ namespace OpenSim.Region.Environment.Scenes
37 [Serializable] 37 [Serializable]
38 public class AvatarAppearance : ISerializable 38 public class AvatarAppearance : ISerializable
39 { 39 {
40 protected float m_avatarHeight;
40 protected LLUUID m_scenePresenceID; 41 protected LLUUID m_scenePresenceID;
42 protected LLObject.TextureEntry m_textureEntry;
43 protected byte[] m_visualParams;
44 protected AvatarWearable[] m_wearables;
45
46 protected int m_wearablesSerial = 1;
47
48 public AvatarAppearance()
49 {
50 }
51
52 public AvatarAppearance(LLUUID avatarID, AvatarWearable[] wearables, byte[] visualParams)
53 {
54 m_scenePresenceID = avatarID;
55 m_wearablesSerial = 1;
56 m_wearables = wearables;
57 m_visualParams = visualParams;
58 m_textureEntry = GetDefaultTextureEntry();
59 }
60
61 protected AvatarAppearance(SerializationInfo info, StreamingContext context)
62 {
63 //System.Console.WriteLine("AvatarAppearance Deserialize BGN");
64
65 if (info == null)
66 {
67 throw new ArgumentNullException("info");
68 }
69
70 m_scenePresenceID = new LLUUID((Guid) info.GetValue("m_scenePresenceID", typeof (Guid)));
71 m_wearablesSerial = (int) info.GetValue("m_wearablesSerial", typeof (int));
72 m_visualParams = (byte[]) info.GetValue("m_visualParams", typeof (byte[]));
73 m_wearables = (AvatarWearable[]) info.GetValue("m_wearables", typeof (AvatarWearable[]));
74
75 byte[] m_textureEntry_work = (byte[]) info.GetValue("m_textureEntry", typeof (byte[]));
76 m_textureEntry = new LLObject.TextureEntry(m_textureEntry_work, 0, m_textureEntry_work.Length);
77
78 m_avatarHeight = (float) info.GetValue("m_avatarHeight", typeof (float));
79
80 //System.Console.WriteLine("AvatarAppearance Deserialize END");
81 }
41 82
42 public LLUUID ScenePresenceID 83 public LLUUID ScenePresenceID
43 { 84 {
44 get { return m_scenePresenceID; } 85 get { return m_scenePresenceID; }
45 set { m_scenePresenceID = value; } 86 set { m_scenePresenceID = value; }
46 } 87 }
47 protected int m_wearablesSerial = 1;
48 88
49 public int WearablesSerial 89 public int WearablesSerial
50 { 90 {
@@ -52,51 +92,52 @@ namespace OpenSim.Region.Environment.Scenes
52 set { m_wearablesSerial = value; } 92 set { m_wearablesSerial = value; }
53 } 93 }
54 94
55 protected byte[] m_visualParams;
56
57 public byte[] VisualParams 95 public byte[] VisualParams
58 { 96 {
59 get { return m_visualParams; } 97 get { return m_visualParams; }
60 set { m_visualParams = value; } 98 set { m_visualParams = value; }
61 } 99 }
62 100
63 protected AvatarWearable[] m_wearables;
64
65 public AvatarWearable[] Wearables 101 public AvatarWearable[] Wearables
66 { 102 {
67 get { return m_wearables; } 103 get { return m_wearables; }
68 set { m_wearables = value; } 104 set { m_wearables = value; }
69 } 105 }
70 106
71 protected LLObject.TextureEntry m_textureEntry;
72
73 public LLObject.TextureEntry TextureEntry 107 public LLObject.TextureEntry TextureEntry
74 { 108 {
75 get { return m_textureEntry; } 109 get { return m_textureEntry; }
76 set { m_textureEntry = value; } 110 set { m_textureEntry = value; }
77 } 111 }
78 112
79 protected float m_avatarHeight = 0;
80
81 public float AvatarHeight 113 public float AvatarHeight
82 { 114 {
83 get { return m_avatarHeight; } 115 get { return m_avatarHeight; }
84 set { m_avatarHeight = value; } 116 set { m_avatarHeight = value; }
85 } 117 }
86 118
87 public AvatarAppearance() 119 #region ISerializable Members
88 {
89 }
90 120
91 public AvatarAppearance(LLUUID avatarID, AvatarWearable[] wearables, byte[] visualParams) 121 [SecurityPermission(SecurityAction.LinkDemand,
122 Flags = SecurityPermissionFlag.SerializationFormatter)]
123 public virtual void GetObjectData(
124 SerializationInfo info, StreamingContext context)
92 { 125 {
93 m_scenePresenceID = avatarID; 126 if (info == null)
94 m_wearablesSerial = 1; 127 {
95 m_wearables = wearables; 128 throw new ArgumentNullException("info");
96 m_visualParams = visualParams; 129 }
97 m_textureEntry = GetDefaultTextureEntry(); 130
131 info.AddValue("m_scenePresenceID", m_scenePresenceID.UUID);
132 info.AddValue("m_wearablesSerial", m_wearablesSerial);
133 info.AddValue("m_visualParams", m_visualParams);
134 info.AddValue("m_wearables", m_wearables);
135 info.AddValue("m_textureEntry", m_textureEntry.ToBytes());
136 info.AddValue("m_avatarHeight", m_avatarHeight);
98 } 137 }
99 138
139 #endregion
140
100 /// <summary> 141 /// <summary>
101 /// 142 ///
102 /// </summary> 143 /// </summary>
@@ -115,8 +156,8 @@ namespace OpenSim.Region.Environment.Scenes
115 // Teravus : Nifty AV Height Getting Maaaaagical formula. Oh how we love turning 0-255 into meters. 156 // Teravus : Nifty AV Height Getting Maaaaagical formula. Oh how we love turning 0-255 into meters.
116 // (float)m_visualParams[25] = Height 157 // (float)m_visualParams[25] = Height
117 // (float)m_visualParams[125] = LegLength 158 // (float)m_visualParams[125] = LegLength
118 m_avatarHeight = (1.50856f + (((float) m_visualParams[25]/255.0f)*(2.525506f - 1.50856f))) 159 m_avatarHeight = (1.50856f + ((m_visualParams[25] / 255.0f) * (2.525506f - 1.50856f)))
119 + (((float) m_visualParams[125]/255.0f)/1.5f); 160 + ((m_visualParams[125] / 255.0f) / 1.5f);
120 } 161 }
121 162
122 /// <summary> 163 /// <summary>
@@ -152,45 +193,5 @@ namespace OpenSim.Region.Environment.Scenes
152 textu.CreateFace(6).TextureID = new LLUUID("00000000-0000-1111-9999-000000000011"); 193 textu.CreateFace(6).TextureID = new LLUUID("00000000-0000-1111-9999-000000000011");
153 return textu; 194 return textu;
154 } 195 }
155
156 protected AvatarAppearance(SerializationInfo info, StreamingContext context)
157 {
158 //System.Console.WriteLine("AvatarAppearance Deserialize BGN");
159
160 if (info == null)
161 {
162 throw new ArgumentNullException("info");
163 }
164
165 m_scenePresenceID = new LLUUID((Guid)info.GetValue("m_scenePresenceID", typeof(Guid)));
166 m_wearablesSerial = (int)info.GetValue("m_wearablesSerial", typeof(int));
167 m_visualParams = (byte[])info.GetValue("m_visualParams", typeof(byte[]));
168 m_wearables = (AvatarWearable[])info.GetValue("m_wearables", typeof(AvatarWearable[]));
169
170 byte[] m_textureEntry_work = (byte[])info.GetValue("m_textureEntry", typeof(byte[]));
171 m_textureEntry = new LLObject.TextureEntry(m_textureEntry_work, 0, m_textureEntry_work.Length);
172
173 m_avatarHeight = (float)info.GetValue("m_avatarHeight", typeof(float));
174
175 //System.Console.WriteLine("AvatarAppearance Deserialize END");
176 }
177
178 [SecurityPermission(SecurityAction.LinkDemand,
179 Flags = SecurityPermissionFlag.SerializationFormatter)]
180 public virtual void GetObjectData(
181 SerializationInfo info, StreamingContext context)
182 {
183 if (info == null)
184 {
185 throw new ArgumentNullException("info");
186 }
187
188 info.AddValue("m_scenePresenceID", m_scenePresenceID.UUID);
189 info.AddValue("m_wearablesSerial", m_wearablesSerial);
190 info.AddValue("m_visualParams", m_visualParams);
191 info.AddValue("m_wearables", m_wearables);
192 info.AddValue("m_textureEntry", m_textureEntry.ToBytes());
193 info.AddValue("m_avatarHeight", m_avatarHeight);
194 }
195 } 196 }
196} 197} \ No newline at end of file