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/Framework/Scenes/SceneObjectGroup.cs | |
parent | minor: add a log warning if a sculpt/mesh async asset request returns no data (diff) | |
download | opensim-SC-df2a59d31b1ae21f99c1b18976b8d799b935a762.zip opensim-SC-df2a59d31b1ae21f99c1b18976b8d799b935a762.tar.gz opensim-SC-df2a59d31b1ae21f99c1b18976b8d799b935a762.tar.bz2 opensim-SC-df2a59d31b1ae21f99c1b18976b8d799b935a762.tar.xz |
refactor: make SceneObjectGroup.GroupScale() a property rather than a mehod
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 61 |
1 files changed, 32 insertions, 29 deletions
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 |