refactor: make SceneObjectGroup.GroupScale() a property rather than a mehod

bulletsim
Justin Clark-Casey (justincc) 2011-07-16 03:30:14 +01:00
parent 0f9882db5b
commit df2a59d31b
2 changed files with 38 additions and 33 deletions

View File

@ -129,7 +129,7 @@ namespace OpenSim.Region.ClientStack.Linden
/// <summary> /// <summary>
/// Parses ad request /// Parses add request
/// </summary> /// </summary>
/// <param name="request"></param> /// <param name="request"></param>
/// <param name="AgentId"></param> /// <param name="AgentId"></param>
@ -312,11 +312,11 @@ namespace OpenSim.Region.ClientStack.Linden
primFace.RepeatV = face.ScaleT; primFace.RepeatV = face.ScaleT;
primFace.TexMapType = (MappingType) (face.MediaFlags & 6); primFace.TexMapType = (MappingType) (face.MediaFlags & 6);
} }
pbs.TextureEntry = tmp.GetBytes(); pbs.TextureEntry = tmp.GetBytes();
prim.Shape = pbs; prim.Shape = pbs;
prim.Scale = obj.Scale; prim.Scale = obj.Scale;
SceneObjectGroup grp = new SceneObjectGroup(); SceneObjectGroup grp = new SceneObjectGroup();
grp.SetRootPart(prim); grp.SetRootPart(prim);
@ -339,8 +339,8 @@ namespace OpenSim.Region.ClientStack.Linden
m_scene.AddSceneObject(grp); m_scene.AddSceneObject(grp);
grp.AbsolutePosition = obj.Position; grp.AbsolutePosition = obj.Position;
} }
allparts[i] = grp; allparts[i] = grp;
} }
for (int j = 1; j < allparts.Length; j++) for (int j = 1; j < allparts.Length; j++)
@ -351,7 +351,9 @@ namespace OpenSim.Region.ClientStack.Linden
} }
rootGroup.ScheduleGroupForFullUpdate(); rootGroup.ScheduleGroupForFullUpdate();
pos = m_scene.GetNewRezLocation(Vector3.Zero, rootpos, UUID.Zero, rot, (byte)1, 1, true, allparts[0].GroupScale(), false); pos
= m_scene.GetNewRezLocation(
Vector3.Zero, rootpos, UUID.Zero, rot, (byte)1, 1, true, allparts[0].GroupScale, false);
responsedata["int_response_code"] = 200; //501; //410; //404; responsedata["int_response_code"] = 200; //501; //410; //404;
responsedata["content_type"] = "text/plain"; responsedata["content_type"] = "text/plain";

View File

@ -236,6 +236,38 @@ namespace OpenSim.Region.Framework.Scenes
get { return m_rootPart.RotationOffset; } get { return m_rootPart.RotationOffset; }
} }
public Vector3 GroupScale
{
get
{
Vector3 minScale = new Vector3(Constants.RegionSize, Constants.RegionSize, Constants.RegionSize);
Vector3 maxScale = Vector3.Zero;
Vector3 finalScale = new Vector3(0.5f, 0.5f, 0.5f);
SceneObjectPart[] parts = m_parts.GetArray();
for (int i = 0; i < parts.Length; i++)
{
SceneObjectPart part = parts[i];
Vector3 partscale = part.Scale;
Vector3 partoffset = part.OffsetPosition;
minScale.X = (partscale.X + partoffset.X < minScale.X) ? partscale.X + partoffset.X : minScale.X;
minScale.Y = (partscale.Y + partoffset.Y < minScale.Y) ? partscale.Y + partoffset.Y : minScale.Y;
minScale.Z = (partscale.Z + partoffset.Z < minScale.Z) ? partscale.Z + partoffset.Z : minScale.Z;
maxScale.X = (partscale.X + partoffset.X > maxScale.X) ? partscale.X + partoffset.X : maxScale.X;
maxScale.Y = (partscale.Y + partoffset.Y > maxScale.Y) ? partscale.Y + partoffset.Y : maxScale.Y;
maxScale.Z = (partscale.Z + partoffset.Z > maxScale.Z) ? partscale.Z + partoffset.Z : maxScale.Z;
}
finalScale.X = (minScale.X > maxScale.X) ? minScale.X : maxScale.X;
finalScale.Y = (minScale.Y > maxScale.Y) ? minScale.Y : maxScale.Y;
finalScale.Z = (minScale.Z > maxScale.Z) ? minScale.Z : maxScale.Z;
return finalScale;
}
}
public UUID GroupID public UUID GroupID
{ {
get { return m_rootPart.GroupID; } get { return m_rootPart.GroupID; }
@ -592,35 +624,6 @@ namespace OpenSim.Region.Framework.Scenes
//ScheduleGroupForFullUpdate(); //ScheduleGroupForFullUpdate();
} }
public Vector3 GroupScale()
{
Vector3 minScale = new Vector3(Constants.RegionSize, Constants.RegionSize, Constants.RegionSize);
Vector3 maxScale = Vector3.Zero;
Vector3 finalScale = new Vector3(0.5f, 0.5f, 0.5f);
SceneObjectPart[] parts = m_parts.GetArray();
for (int i = 0; i < parts.Length; i++)
{
SceneObjectPart part = parts[i];
Vector3 partscale = part.Scale;
Vector3 partoffset = part.OffsetPosition;
minScale.X = (partscale.X + partoffset.X < minScale.X) ? partscale.X + partoffset.X : minScale.X;
minScale.Y = (partscale.Y + partoffset.Y < minScale.Y) ? partscale.Y + partoffset.Y : minScale.Y;
minScale.Z = (partscale.Z + partoffset.Z < minScale.Z) ? partscale.Z + partoffset.Z : minScale.Z;
maxScale.X = (partscale.X + partoffset.X > maxScale.X) ? partscale.X + partoffset.X : maxScale.X;
maxScale.Y = (partscale.Y + partoffset.Y > maxScale.Y) ? partscale.Y + partoffset.Y : maxScale.Y;
maxScale.Z = (partscale.Z + partoffset.Z > maxScale.Z) ? partscale.Z + partoffset.Z : maxScale.Z;
}
finalScale.X = (minScale.X > maxScale.X) ? minScale.X : maxScale.X;
finalScale.Y = (minScale.Y > maxScale.Y) ? minScale.Y : maxScale.Y;
finalScale.Z = (minScale.Z > maxScale.Z) ? minScale.Z : maxScale.Z;
return finalScale;
}
public EntityIntersection TestIntersection(Ray hRay, bool frontFacesOnly, bool faceCenters) public EntityIntersection TestIntersection(Ray hRay, bool frontFacesOnly, bool faceCenters)
{ {
// We got a request from the inner_scene to raytrace along the Ray hRay // We got a request from the inner_scene to raytrace along the Ray hRay