diff options
author | Justin Clark-Casey (justincc) | 2011-07-16 03:30:14 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2011-07-16 03:30:14 +0100 |
commit | df2a59d31b1ae21f99c1b18976b8d799b935a762 (patch) | |
tree | 1078daff7523bee2606affdb146f251b0e06e2dd /OpenSim/Region | |
parent | minor: add a log warning if a sculpt/mesh async asset request returns no data (diff) | |
download | opensim-SC_OLD-df2a59d31b1ae21f99c1b18976b8d799b935a762.zip opensim-SC_OLD-df2a59d31b1ae21f99c1b18976b8d799b935a762.tar.gz opensim-SC_OLD-df2a59d31b1ae21f99c1b18976b8d799b935a762.tar.bz2 opensim-SC_OLD-df2a59d31b1ae21f99c1b18976b8d799b935a762.tar.xz |
refactor: make SceneObjectGroup.GroupScale() a property rather than a mehod
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/UploadObjectAssetModule.cs | 10 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 61 |
2 files changed, 38 insertions, 33 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/UploadObjectAssetModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/UploadObjectAssetModule.cs index 15ed3b3..8189518 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/UploadObjectAssetModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/UploadObjectAssetModule.cs | |||
@@ -129,7 +129,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
129 | 129 | ||
130 | 130 | ||
131 | /// <summary> | 131 | /// <summary> |
132 | /// Parses ad request | 132 | /// Parses add request |
133 | /// </summary> | 133 | /// </summary> |
134 | /// <param name="request"></param> | 134 | /// <param name="request"></param> |
135 | /// <param name="AgentId"></param> | 135 | /// <param name="AgentId"></param> |
@@ -312,11 +312,11 @@ namespace OpenSim.Region.ClientStack.Linden | |||
312 | primFace.RepeatV = face.ScaleT; | 312 | primFace.RepeatV = face.ScaleT; |
313 | primFace.TexMapType = (MappingType) (face.MediaFlags & 6); | 313 | primFace.TexMapType = (MappingType) (face.MediaFlags & 6); |
314 | } | 314 | } |
315 | |||
315 | pbs.TextureEntry = tmp.GetBytes(); | 316 | pbs.TextureEntry = tmp.GetBytes(); |
316 | prim.Shape = pbs; | 317 | prim.Shape = pbs; |
317 | prim.Scale = obj.Scale; | 318 | prim.Scale = obj.Scale; |
318 | 319 | ||
319 | |||
320 | SceneObjectGroup grp = new SceneObjectGroup(); | 320 | SceneObjectGroup grp = new SceneObjectGroup(); |
321 | 321 | ||
322 | grp.SetRootPart(prim); | 322 | grp.SetRootPart(prim); |
@@ -339,8 +339,8 @@ namespace OpenSim.Region.ClientStack.Linden | |||
339 | m_scene.AddSceneObject(grp); | 339 | m_scene.AddSceneObject(grp); |
340 | grp.AbsolutePosition = obj.Position; | 340 | grp.AbsolutePosition = obj.Position; |
341 | } | 341 | } |
342 | |||
342 | allparts[i] = grp; | 343 | allparts[i] = grp; |
343 | |||
344 | } | 344 | } |
345 | 345 | ||
346 | for (int j = 1; j < allparts.Length; j++) | 346 | for (int j = 1; j < allparts.Length; j++) |
@@ -351,7 +351,9 @@ namespace OpenSim.Region.ClientStack.Linden | |||
351 | } | 351 | } |
352 | 352 | ||
353 | rootGroup.ScheduleGroupForFullUpdate(); | 353 | rootGroup.ScheduleGroupForFullUpdate(); |
354 | pos = m_scene.GetNewRezLocation(Vector3.Zero, rootpos, UUID.Zero, rot, (byte)1, 1, true, allparts[0].GroupScale(), false); | 354 | pos |
355 | = m_scene.GetNewRezLocation( | ||
356 | Vector3.Zero, rootpos, UUID.Zero, rot, (byte)1, 1, true, allparts[0].GroupScale, false); | ||
355 | 357 | ||
356 | responsedata["int_response_code"] = 200; //501; //410; //404; | 358 | responsedata["int_response_code"] = 200; //501; //410; //404; |
357 | responsedata["content_type"] = "text/plain"; | 359 | responsedata["content_type"] = "text/plain"; |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 8ffe84b..7aa7831 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -236,6 +236,38 @@ namespace OpenSim.Region.Framework.Scenes | |||
236 | get { return m_rootPart.RotationOffset; } | 236 | get { return m_rootPart.RotationOffset; } |
237 | } | 237 | } |
238 | 238 | ||
239 | public Vector3 GroupScale | ||
240 | { | ||
241 | get | ||
242 | { | ||
243 | Vector3 minScale = new Vector3(Constants.RegionSize, Constants.RegionSize, Constants.RegionSize); | ||
244 | Vector3 maxScale = Vector3.Zero; | ||
245 | Vector3 finalScale = new Vector3(0.5f, 0.5f, 0.5f); | ||
246 | |||
247 | SceneObjectPart[] parts = m_parts.GetArray(); | ||
248 | for (int i = 0; i < parts.Length; i++) | ||
249 | { | ||
250 | SceneObjectPart part = parts[i]; | ||
251 | Vector3 partscale = part.Scale; | ||
252 | Vector3 partoffset = part.OffsetPosition; | ||
253 | |||
254 | minScale.X = (partscale.X + partoffset.X < minScale.X) ? partscale.X + partoffset.X : minScale.X; | ||
255 | minScale.Y = (partscale.Y + partoffset.Y < minScale.Y) ? partscale.Y + partoffset.Y : minScale.Y; | ||
256 | minScale.Z = (partscale.Z + partoffset.Z < minScale.Z) ? partscale.Z + partoffset.Z : minScale.Z; | ||
257 | |||
258 | maxScale.X = (partscale.X + partoffset.X > maxScale.X) ? partscale.X + partoffset.X : maxScale.X; | ||
259 | maxScale.Y = (partscale.Y + partoffset.Y > maxScale.Y) ? partscale.Y + partoffset.Y : maxScale.Y; | ||
260 | maxScale.Z = (partscale.Z + partoffset.Z > maxScale.Z) ? partscale.Z + partoffset.Z : maxScale.Z; | ||
261 | } | ||
262 | |||
263 | finalScale.X = (minScale.X > maxScale.X) ? minScale.X : maxScale.X; | ||
264 | finalScale.Y = (minScale.Y > maxScale.Y) ? minScale.Y : maxScale.Y; | ||
265 | finalScale.Z = (minScale.Z > maxScale.Z) ? minScale.Z : maxScale.Z; | ||
266 | |||
267 | return finalScale; | ||
268 | } | ||
269 | } | ||
270 | |||
239 | public UUID GroupID | 271 | public UUID GroupID |
240 | { | 272 | { |
241 | get { return m_rootPart.GroupID; } | 273 | get { return m_rootPart.GroupID; } |
@@ -592,35 +624,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
592 | //ScheduleGroupForFullUpdate(); | 624 | //ScheduleGroupForFullUpdate(); |
593 | } | 625 | } |
594 | 626 | ||
595 | public Vector3 GroupScale() | ||
596 | { | ||
597 | Vector3 minScale = new Vector3(Constants.RegionSize, Constants.RegionSize, Constants.RegionSize); | ||
598 | Vector3 maxScale = Vector3.Zero; | ||
599 | Vector3 finalScale = new Vector3(0.5f, 0.5f, 0.5f); | ||
600 | |||
601 | SceneObjectPart[] parts = m_parts.GetArray(); | ||
602 | for (int i = 0; i < parts.Length; i++) | ||
603 | { | ||
604 | SceneObjectPart part = parts[i]; | ||
605 | Vector3 partscale = part.Scale; | ||
606 | Vector3 partoffset = part.OffsetPosition; | ||
607 | |||
608 | minScale.X = (partscale.X + partoffset.X < minScale.X) ? partscale.X + partoffset.X : minScale.X; | ||
609 | minScale.Y = (partscale.Y + partoffset.Y < minScale.Y) ? partscale.Y + partoffset.Y : minScale.Y; | ||
610 | minScale.Z = (partscale.Z + partoffset.Z < minScale.Z) ? partscale.Z + partoffset.Z : minScale.Z; | ||
611 | |||
612 | maxScale.X = (partscale.X + partoffset.X > maxScale.X) ? partscale.X + partoffset.X : maxScale.X; | ||
613 | maxScale.Y = (partscale.Y + partoffset.Y > maxScale.Y) ? partscale.Y + partoffset.Y : maxScale.Y; | ||
614 | maxScale.Z = (partscale.Z + partoffset.Z > maxScale.Z) ? partscale.Z + partoffset.Z : maxScale.Z; | ||
615 | } | ||
616 | |||
617 | finalScale.X = (minScale.X > maxScale.X) ? minScale.X : maxScale.X; | ||
618 | finalScale.Y = (minScale.Y > maxScale.Y) ? minScale.Y : maxScale.Y; | ||
619 | finalScale.Z = (minScale.Z > maxScale.Z) ? minScale.Z : maxScale.Z; | ||
620 | |||
621 | return finalScale; | ||
622 | } | ||
623 | |||
624 | public EntityIntersection TestIntersection(Ray hRay, bool frontFacesOnly, bool faceCenters) | 627 | public EntityIntersection TestIntersection(Ray hRay, bool frontFacesOnly, bool faceCenters) |
625 | { | 628 | { |
626 | // We got a request from the inner_scene to raytrace along the Ray hRay | 629 | // We got a request from the inner_scene to raytrace along the Ray hRay |