aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework
diff options
context:
space:
mode:
authorMic Bowman2013-05-24 13:18:16 -0700
committerMic Bowman2013-05-24 13:18:16 -0700
commit681fbda4b6b9700421b82dc639f954c60871542e (patch)
treedb292ba79bf73f77c9fa9e72262d299a7115c201 /OpenSim/Framework
parentchange a hull debugging message to Debug instead of Info (diff)
downloadopensim-SC_OLD-681fbda4b6b9700421b82dc639f954c60871542e.zip
opensim-SC_OLD-681fbda4b6b9700421b82dc639f954c60871542e.tar.gz
opensim-SC_OLD-681fbda4b6b9700421b82dc639f954c60871542e.tar.bz2
opensim-SC_OLD-681fbda4b6b9700421b82dc639f954c60871542e.tar.xz
This is an experimental patch that adds support for comparing texture
hashes for the purpose of accurately responding to AgentTextureCached packets. There is a change to IClientAPI to report the wearbles hashes that come in through the SetAppearance packet. Added storage of the texture hashes in the appearance. While these are added to the Pack/Unpack (with support for missing values) routines (which means Simian will store them properly), they are not currently persisted in Robust.
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r--OpenSim/Framework/AvatarAppearance.cs98
-rw-r--r--OpenSim/Framework/IClientAPI.cs2
2 files changed, 67 insertions, 33 deletions
diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs
index 494ae5e..157feb5 100644
--- a/OpenSim/Framework/AvatarAppearance.cs
+++ b/OpenSim/Framework/AvatarAppearance.cs
@@ -53,6 +53,7 @@ namespace OpenSim.Framework
53 protected AvatarWearable[] m_wearables; 53 protected AvatarWearable[] m_wearables;
54 protected Dictionary<int, List<AvatarAttachment>> m_attachments; 54 protected Dictionary<int, List<AvatarAttachment>> m_attachments;
55 protected float m_avatarHeight = 0; 55 protected float m_avatarHeight = 0;
56 protected UUID[] m_texturehashes;
56 57
57 public virtual int Serial 58 public virtual int Serial
58 { 59 {
@@ -98,6 +99,8 @@ namespace OpenSim.Framework
98 SetDefaultParams(); 99 SetDefaultParams();
99 SetHeight(); 100 SetHeight();
100 m_attachments = new Dictionary<int, List<AvatarAttachment>>(); 101 m_attachments = new Dictionary<int, List<AvatarAttachment>>();
102
103 ResetTextureHashes();
101 } 104 }
102 105
103 public AvatarAppearance(OSDMap map) 106 public AvatarAppearance(OSDMap map)
@@ -108,32 +111,6 @@ namespace OpenSim.Framework
108 SetHeight(); 111 SetHeight();
109 } 112 }
110 113
111 public AvatarAppearance(AvatarWearable[] wearables, Primitive.TextureEntry textureEntry, byte[] visualParams)
112 {
113// m_log.WarnFormat("[AVATAR APPEARANCE] create initialized appearance");
114
115 m_serial = 0;
116
117 if (wearables != null)
118 m_wearables = wearables;
119 else
120 SetDefaultWearables();
121
122 if (textureEntry != null)
123 m_texture = textureEntry;
124 else
125 SetDefaultTexture();
126
127 if (visualParams != null)
128 m_visualparams = visualParams;
129 else
130 SetDefaultParams();
131
132 SetHeight();
133
134 m_attachments = new Dictionary<int, List<AvatarAttachment>>();
135 }
136
137 public AvatarAppearance(AvatarAppearance appearance) : this(appearance, true) 114 public AvatarAppearance(AvatarAppearance appearance) : this(appearance, true)
138 { 115 {
139 } 116 }
@@ -151,6 +128,8 @@ namespace OpenSim.Framework
151 SetHeight(); 128 SetHeight();
152 m_attachments = new Dictionary<int, List<AvatarAttachment>>(); 129 m_attachments = new Dictionary<int, List<AvatarAttachment>>();
153 130
131 ResetTextureHashes();
132
154 return; 133 return;
155 } 134 }
156 135
@@ -166,6 +145,10 @@ namespace OpenSim.Framework
166 SetWearable(i,appearance.Wearables[i]); 145 SetWearable(i,appearance.Wearables[i]);
167 } 146 }
168 147
148 m_texturehashes = new UUID[AvatarAppearance.TEXTURE_COUNT];
149 for (int i = 0; i < AvatarAppearance.TEXTURE_COUNT; i++)
150 m_texturehashes[i] = new UUID(appearance.m_texturehashes[i]);
151
169 m_texture = null; 152 m_texture = null;
170 if (appearance.Texture != null) 153 if (appearance.Texture != null)
171 { 154 {
@@ -200,6 +183,37 @@ namespace OpenSim.Framework
200 } 183 }
201 } 184 }
202 185
186 public void ResetTextureHashes()
187 {
188 m_texturehashes = new UUID[AvatarAppearance.TEXTURE_COUNT];
189 for (uint i = 0; i < AvatarAppearance.TEXTURE_COUNT; i++)
190 m_texturehashes[i] = UUID.Zero;
191 }
192
193 public UUID GetTextureHash(int textureIndex)
194 {
195 return m_texturehashes[NormalizeBakedTextureIndex(textureIndex)];
196 }
197
198 public void SetTextureHash(int textureIndex, UUID textureHash)
199 {
200 m_texturehashes[NormalizeBakedTextureIndex(textureIndex)] = new UUID(textureHash);
201 }
202
203 /// <summary>
204 /// Normalizes the texture index to the actual bake index, this is done to
205 /// accommodate older viewers that send the BAKE_INDICES index rather than
206 /// the actual texture index
207 /// </summary>
208 private int NormalizeBakedTextureIndex(int textureIndex)
209 {
210 // Earlier viewer send the index into the baked index array, just trying to be careful here
211 if (textureIndex < BAKE_INDICES.Length)
212 return BAKE_INDICES[textureIndex];
213
214 return textureIndex;
215 }
216
203 public void ClearWearables() 217 public void ClearWearables()
204 { 218 {
205 m_wearables = new AvatarWearable[AvatarWearable.MAX_WEARABLES]; 219 m_wearables = new AvatarWearable[AvatarWearable.MAX_WEARABLES];
@@ -223,12 +237,7 @@ namespace OpenSim.Framework
223 m_serial = 0; 237 m_serial = 0;
224 238
225 SetDefaultTexture(); 239 SetDefaultTexture();
226 240 ResetTextureHashes();
227 //for (int i = 0; i < BAKE_INDICES.Length; i++)
228 // {
229 // int idx = BAKE_INDICES[i];
230 // m_texture.FaceTextures[idx].TextureID = UUID.Zero;
231 // }
232 } 241 }
233 242
234 protected virtual void SetDefaultParams() 243 protected virtual void SetDefaultParams()
@@ -598,6 +607,12 @@ namespace OpenSim.Framework
598 data["serial"] = OSD.FromInteger(m_serial); 607 data["serial"] = OSD.FromInteger(m_serial);
599 data["height"] = OSD.FromReal(m_avatarHeight); 608 data["height"] = OSD.FromReal(m_avatarHeight);
600 609
610 // Hashes
611 OSDArray hashes = new OSDArray(AvatarAppearance.TEXTURE_COUNT);
612 for (uint i = 0; i < AvatarAppearance.TEXTURE_COUNT; i++)
613 hashes.Add(OSD.FromUUID(m_texturehashes[i]));
614 data["hashes"] = hashes;
615
601 // Wearables 616 // Wearables
602 OSDArray wears = new OSDArray(AvatarWearable.MAX_WEARABLES); 617 OSDArray wears = new OSDArray(AvatarWearable.MAX_WEARABLES);
603 for (int i = 0; i < AvatarWearable.MAX_WEARABLES; i++) 618 for (int i = 0; i < AvatarWearable.MAX_WEARABLES; i++)
@@ -642,6 +657,25 @@ namespace OpenSim.Framework
642 657
643 try 658 try
644 { 659 {
660 // Hashes
661 m_texturehashes = new UUID[AvatarAppearance.TEXTURE_COUNT];
662 if ((data != null) && (data["hashes"] != null) && (data["hashes"]).Type == OSDType.Array)
663 {
664 OSDArray hashes = (OSDArray)(data["hashes"]);
665 for (int i = 0; i < AvatarAppearance.TEXTURE_COUNT; i++)
666 {
667 UUID hashID = UUID.Zero;
668 if (i < hashes.Count && hashes[i] != null)
669 hashID = hashes[i].AsUUID();
670 m_texturehashes[i] = hashID;
671 }
672 }
673 else
674 {
675 for (uint i = 0; i < AvatarAppearance.TEXTURE_COUNT; i++)
676 m_texturehashes[i] = UUID.Zero;
677 }
678
645 // Wearables 679 // Wearables
646 SetDefaultWearables(); 680 SetDefaultWearables();
647 if ((data != null) && (data["wearables"] != null) && (data["wearables"]).Type == OSDType.Array) 681 if ((data != null) && (data["wearables"] != null) && (data["wearables"]).Type == OSDType.Array)
diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs
index 59ce2c4..1fffeff 100644
--- a/OpenSim/Framework/IClientAPI.cs
+++ b/OpenSim/Framework/IClientAPI.cs
@@ -66,7 +66,7 @@ namespace OpenSim.Framework
66 66
67 public delegate void CachedTextureRequest(IClientAPI remoteClient, int serial, List<CachedTextureRequestArg> cachedTextureRequest); 67 public delegate void CachedTextureRequest(IClientAPI remoteClient, int serial, List<CachedTextureRequestArg> cachedTextureRequest);
68 68
69 public delegate void SetAppearance(IClientAPI remoteClient, Primitive.TextureEntry textureEntry, byte[] visualParams); 69 public delegate void SetAppearance(IClientAPI remoteClient, Primitive.TextureEntry textureEntry, byte[] visualParams, List<CachedTextureRequestArg> cachedTextureData);
70 70
71 public delegate void StartAnim(IClientAPI remoteClient, UUID animID); 71 public delegate void StartAnim(IClientAPI remoteClient, UUID animID);
72 72