aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Scenes/AvatarAppearance.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/AvatarAppearance.cs')
-rw-r--r--OpenSim/Region/Environment/Scenes/AvatarAppearance.cs123
1 files changed, 61 insertions, 62 deletions
diff --git a/OpenSim/Region/Environment/Scenes/AvatarAppearance.cs b/OpenSim/Region/Environment/Scenes/AvatarAppearance.cs
index 860399c..8f29507 100644
--- a/OpenSim/Region/Environment/Scenes/AvatarAppearance.cs
+++ b/OpenSim/Region/Environment/Scenes/AvatarAppearance.cs
@@ -37,54 +37,14 @@ 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;
41 protected LLUUID m_scenePresenceID; 40 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 }
82 41
83 public LLUUID ScenePresenceID 42 public LLUUID ScenePresenceID
84 { 43 {
85 get { return m_scenePresenceID; } 44 get { return m_scenePresenceID; }
86 set { m_scenePresenceID = value; } 45 set { m_scenePresenceID = value; }
87 } 46 }
47 protected int m_wearablesSerial = 1;
88 48
89 public int WearablesSerial 49 public int WearablesSerial
90 { 50 {
@@ -92,51 +52,50 @@ namespace OpenSim.Region.Environment.Scenes
92 set { m_wearablesSerial = value; } 52 set { m_wearablesSerial = value; }
93 } 53 }
94 54
55 protected byte[] m_visualParams;
56
95 public byte[] VisualParams 57 public byte[] VisualParams
96 { 58 {
97 get { return m_visualParams; } 59 get { return m_visualParams; }
98 set { m_visualParams = value; } 60 set { m_visualParams = value; }
99 } 61 }
100 62
63 protected AvatarWearable[] m_wearables;
64
101 public AvatarWearable[] Wearables 65 public AvatarWearable[] Wearables
102 { 66 {
103 get { return m_wearables; } 67 get { return m_wearables; }
104 set { m_wearables = value; } 68 set { m_wearables = value; }
105 } 69 }
106 70
71 protected LLObject.TextureEntry m_textureEntry;
72
107 public LLObject.TextureEntry TextureEntry 73 public LLObject.TextureEntry TextureEntry
108 { 74 {
109 get { return m_textureEntry; } 75 get { return m_textureEntry; }
110 set { m_textureEntry = value; } 76 set { m_textureEntry = value; }
111 } 77 }
112 78
79 protected float m_avatarHeight = 0;
80
113 public float AvatarHeight 81 public float AvatarHeight
114 { 82 {
115 get { return m_avatarHeight; } 83 get { return m_avatarHeight; }
116 set { m_avatarHeight = value; } 84 set { m_avatarHeight = value; }
117 } 85 }
118 86
119 #region ISerializable Members 87 public AvatarAppearance()
120
121 [SecurityPermission(SecurityAction.LinkDemand,
122 Flags = SecurityPermissionFlag.SerializationFormatter)]
123 public virtual void GetObjectData(
124 SerializationInfo info, StreamingContext context)
125 { 88 {
126 if (info == null)
127 {
128 throw new ArgumentNullException("info");
129 }
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);
137 } 89 }
138 90
139 #endregion 91 public AvatarAppearance(LLUUID avatarID, AvatarWearable[] wearables, byte[] visualParams)
92 {
93 m_scenePresenceID = avatarID;
94 m_wearablesSerial = 1;
95 m_wearables = wearables;
96 m_visualParams = visualParams;
97 m_textureEntry = GetDefaultTextureEntry();
98 }
140 99
141 /// <summary> 100 /// <summary>
142 /// 101 ///
@@ -156,8 +115,8 @@ namespace OpenSim.Region.Environment.Scenes
156 // Teravus : Nifty AV Height Getting Maaaaagical formula. Oh how we love turning 0-255 into meters. 115 // Teravus : Nifty AV Height Getting Maaaaagical formula. Oh how we love turning 0-255 into meters.
157 // (float)m_visualParams[25] = Height 116 // (float)m_visualParams[25] = Height
158 // (float)m_visualParams[125] = LegLength 117 // (float)m_visualParams[125] = LegLength
159 m_avatarHeight = (1.50856f + ((m_visualParams[25] / 255.0f) * (2.525506f - 1.50856f))) 118 m_avatarHeight = (1.50856f + (((float) m_visualParams[25]/255.0f)*(2.525506f - 1.50856f)))
160 + ((m_visualParams[125] / 255.0f) / 1.5f); 119 + (((float) m_visualParams[125]/255.0f)/1.5f);
161 } 120 }
162 121
163 /// <summary> 122 /// <summary>
@@ -193,5 +152,45 @@ namespace OpenSim.Region.Environment.Scenes
193 textu.CreateFace(6).TextureID = new LLUUID("00000000-0000-1111-9999-000000000011"); 152 textu.CreateFace(6).TextureID = new LLUUID("00000000-0000-1111-9999-000000000011");
194 return textu; 153 return textu;
195 } 154 }
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 }
196 } 195 }
197} \ No newline at end of file 196}