aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/AvatarAppearance.cs
diff options
context:
space:
mode:
authorMelanie2012-12-14 03:57:31 +0100
committerMelanie2012-12-14 03:57:31 +0100
commit1d713bcdb8f63bc8c83a06acc90c2adf5d0d8992 (patch)
tree1e61c0c72389710bdf48875d38624ee1411a4f08 /OpenSim/Framework/AvatarAppearance.cs
parentPrevent a failed user relogi from throwing exceptions in poll services (diff)
parentright fix this time ?? (diff)
downloadopensim-SC-1d713bcdb8f63bc8c83a06acc90c2adf5d0d8992.zip
opensim-SC-1d713bcdb8f63bc8c83a06acc90c2adf5d0d8992.tar.gz
opensim-SC-1d713bcdb8f63bc8c83a06acc90c2adf5d0d8992.tar.bz2
opensim-SC-1d713bcdb8f63bc8c83a06acc90c2adf5d0d8992.tar.xz
Merge branch 'ubitwork' into avination
Diffstat (limited to 'OpenSim/Framework/AvatarAppearance.cs')
-rw-r--r--OpenSim/Framework/AvatarAppearance.cs78
1 files changed, 70 insertions, 8 deletions
diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs
index 1638541..2183fb6 100644
--- a/OpenSim/Framework/AvatarAppearance.cs
+++ b/OpenSim/Framework/AvatarAppearance.cs
@@ -40,6 +40,13 @@ namespace OpenSim.Framework
40 /// </summary> 40 /// </summary>
41 public class AvatarAppearance 41 public class AvatarAppearance
42 { 42 {
43 // SL box diferent to size
44 const float AVBOXAJUST = 0.2f;
45 // constrains for ubitode physics
46 const float AVBOXMINX = 0.2f;
47 const float AVBOXMINY = 0.3f;
48 const float AVBOXMINZ = 1.2f;
49
43 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 50 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
44 51
45 // this is viewer capabilities and weared things dependent 52 // this is viewer capabilities and weared things dependent
@@ -55,6 +62,10 @@ namespace OpenSim.Framework
55 protected AvatarWearable[] m_wearables; 62 protected AvatarWearable[] m_wearables;
56 protected Dictionary<int, List<AvatarAttachment>> m_attachments; 63 protected Dictionary<int, List<AvatarAttachment>> m_attachments;
57 protected float m_avatarHeight = 0; 64 protected float m_avatarHeight = 0;
65 protected Vector3 m_avatarSize = new Vector3(0.45f, 0.6f, 1.9f); // sl Z cloud value
66 protected Vector3 m_avatarBoxSize = new Vector3(0.45f, 0.6f, 1.9f);
67 protected float m_avatarFeetOffset = 0;
68 protected float m_avatarAnimOffset = 0;
58 69
59 public virtual int Serial 70 public virtual int Serial
60 { 71 {
@@ -68,6 +79,21 @@ namespace OpenSim.Framework
68 set { m_visualparams = value; } 79 set { m_visualparams = value; }
69 } 80 }
70 81
82 public virtual Vector3 AvatarSize
83 {
84 get { return m_avatarSize; }
85 }
86
87 public virtual Vector3 AvatarBoxSize
88 {
89 get { return m_avatarBoxSize; }
90 }
91
92 public virtual float AvatarFeetOffset
93 {
94 get { return m_avatarFeetOffset + m_avatarAnimOffset; }
95 }
96
71 public virtual Primitive.TextureEntry Texture 97 public virtual Primitive.TextureEntry Texture
72 { 98 {
73 get { return m_texture; } 99 get { return m_texture; }
@@ -98,7 +124,8 @@ namespace OpenSim.Framework
98 SetDefaultWearables(); 124 SetDefaultWearables();
99 SetDefaultTexture(); 125 SetDefaultTexture();
100 SetDefaultParams(); 126 SetDefaultParams();
101 SetHeight(); 127// SetHeight();
128 SetSize(new Vector3(0.45f,0.6f,1.9f));
102 m_attachments = new Dictionary<int, List<AvatarAttachment>>(); 129 m_attachments = new Dictionary<int, List<AvatarAttachment>>();
103 } 130 }
104 131
@@ -107,7 +134,7 @@ namespace OpenSim.Framework
107// m_log.WarnFormat("[AVATAR APPEARANCE]: create appearance from OSDMap"); 134// m_log.WarnFormat("[AVATAR APPEARANCE]: create appearance from OSDMap");
108 135
109 Unpack(map); 136 Unpack(map);
110 SetHeight(); 137// SetHeight(); done in Unpack
111 } 138 }
112 139
113 public AvatarAppearance(AvatarWearable[] wearables, Primitive.TextureEntry textureEntry, byte[] visualParams) 140 public AvatarAppearance(AvatarWearable[] wearables, Primitive.TextureEntry textureEntry, byte[] visualParams)
@@ -131,7 +158,9 @@ namespace OpenSim.Framework
131 else 158 else
132 SetDefaultParams(); 159 SetDefaultParams();
133 160
134 SetHeight(); 161// SetHeight();
162 if(m_avatarHeight == 0)
163 SetSize(new Vector3(0.45f,0.6f,1.9f));
135 164
136 m_attachments = new Dictionary<int, List<AvatarAttachment>>(); 165 m_attachments = new Dictionary<int, List<AvatarAttachment>>();
137 } 166 }
@@ -150,7 +179,8 @@ namespace OpenSim.Framework
150 SetDefaultWearables(); 179 SetDefaultWearables();
151 SetDefaultTexture(); 180 SetDefaultTexture();
152 SetDefaultParams(); 181 SetDefaultParams();
153 SetHeight(); 182// SetHeight();
183 SetSize(new Vector3(0.45f, 0.6f, 1.9f));
154 m_attachments = new Dictionary<int, List<AvatarAttachment>>(); 184 m_attachments = new Dictionary<int, List<AvatarAttachment>>();
155 185
156 return; 186 return;
@@ -179,7 +209,8 @@ namespace OpenSim.Framework
179 if (appearance.VisualParams != null) 209 if (appearance.VisualParams != null)
180 m_visualparams = (byte[])appearance.VisualParams.Clone(); 210 m_visualparams = (byte[])appearance.VisualParams.Clone();
181 211
182 m_avatarHeight = appearance.m_avatarHeight; 212// m_avatarHeight = appearance.m_avatarHeight;
213 SetSize(appearance.AvatarSize);
183 214
184 // Copy the attachment, force append mode since that ensures consistency 215 // Copy the attachment, force append mode since that ensures consistency
185 m_attachments = new Dictionary<int, List<AvatarAttachment>>(); 216 m_attachments = new Dictionary<int, List<AvatarAttachment>>();
@@ -346,8 +377,8 @@ namespace OpenSim.Framework
346 } 377 }
347 } 378 }
348 // Reset the height if the visual parameters actually changed 379 // Reset the height if the visual parameters actually changed
349 if (changed) 380// if (changed)
350 SetHeight(); 381// SetHeight();
351 382
352 return changed; 383 return changed;
353 } 384 }
@@ -363,6 +394,7 @@ namespace OpenSim.Framework
363 /// </summary> 394 /// </summary>
364 public virtual void SetHeight() 395 public virtual void SetHeight()
365 { 396 {
397/*
366 // Start with shortest possible female avatar height 398 // Start with shortest possible female avatar height
367 m_avatarHeight = 1.14597f; 399 m_avatarHeight = 1.14597f;
368 // Add offset for male avatars 400 // Add offset for male avatars
@@ -375,6 +407,35 @@ namespace OpenSim.Framework
375 + 0.07f * (float)m_visualparams[(int)VPElement.SHOES_PLATFORM_HEIGHT] / 255.0f 407 + 0.07f * (float)m_visualparams[(int)VPElement.SHOES_PLATFORM_HEIGHT] / 255.0f
376 + 0.08f * (float)m_visualparams[(int)VPElement.SHOES_HEEL_HEIGHT] / 255.0f 408 + 0.08f * (float)m_visualparams[(int)VPElement.SHOES_HEEL_HEIGHT] / 255.0f
377 + 0.076f * (float)m_visualparams[(int)VPElement.SHAPE_NECK_LENGTH] / 255.0f; 409 + 0.076f * (float)m_visualparams[(int)VPElement.SHAPE_NECK_LENGTH] / 255.0f;
410*/
411 }
412
413 public void SetSize(Vector3 avSize)
414 {
415 if (avSize.X > 32f)
416 avSize.X = 32f;
417 else if (avSize.X < 0.1f)
418 avSize.X = 0.1f;
419
420 if (avSize.Y > 32f)
421 avSize.Y = 32f;
422 else if (avSize.Y < 0.1f)
423 avSize.Y = 0.1f;
424 if (avSize.Z > 32f)
425 avSize.Z = 32f;
426 else if (avSize.Z < 0.1f)
427 avSize.Z = 0.1f;
428
429 m_avatarSize = avSize;
430 m_avatarBoxSize = avSize;
431 m_avatarBoxSize.Z += AVBOXAJUST;
432 if (m_avatarBoxSize.X < AVBOXMINX)
433 m_avatarBoxSize.X = AVBOXMINX;
434 if (m_avatarBoxSize.Y < AVBOXMINY)
435 m_avatarBoxSize.Y = AVBOXMINY;
436 if (m_avatarBoxSize.Z < AVBOXMINZ)
437 m_avatarBoxSize.Z = AVBOXMINZ;
438 m_avatarHeight = m_avatarSize.Z;
378 } 439 }
379 440
380 public virtual void SetWearable(int wearableId, AvatarWearable wearable) 441 public virtual void SetWearable(int wearableId, AvatarWearable wearable)
@@ -649,7 +710,8 @@ namespace OpenSim.Framework
649 if ((data != null) && (data["serial"] != null)) 710 if ((data != null) && (data["serial"] != null))
650 m_serial = data["serial"].AsInteger(); 711 m_serial = data["serial"].AsInteger();
651 if ((data != null) && (data["height"] != null)) 712 if ((data != null) && (data["height"] != null))
652 m_avatarHeight = (float)data["height"].AsReal(); 713// m_avatarHeight = (float)data["height"].AsReal();
714 SetSize(new Vector3(0.45f,0.6f, (float)data["height"].AsReal()));
653 715
654 try 716 try
655 { 717 {