diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index b3c643dcca..01a323ee9e 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -2121,12 +2121,6 @@ namespace OpenSim.Region.Framework.Scenes if (localGlobalTF) { -/* - Quaternion grot = GetWorldRotation(); - Quaternion AXgrot = grot; - Vector3 AXimpulsei = impulsei; - Vector3 newimpulse = AXimpulsei * AXgrot; - */ torque *= GetWorldRotation(); } @@ -2265,16 +2259,8 @@ namespace OpenSim.Region.Framework.Scenes if (userExposed) { -/* - if (dupe.m_shape.SculptEntry && dupe.m_shape.SculptTexture != UUID.Zero) - { - ParentGroup.Scene.AssetService.Get( - dupe.m_shape.SculptTexture.ToString(), dupe, dupe.AssetReceived); - } -*/ bool UsePhysics = ((dupe.Flags & PrimFlags.Physics) != 0); dupe.DoPhysicsPropertyUpdate(UsePhysics, true); -// dupe.UpdatePhysicsSubscribedEvents(); // not sure... } if (dupe.PhysActor != null) @@ -2287,23 +2273,6 @@ namespace OpenSim.Region.Framework.Scenes return dupe; } - /// - /// Called back by asynchronous asset fetch. - /// - /// ID of asset received - /// Register - /// -/* - protected void AssetReceived(string id, Object sender, AssetBase asset) - { - if (asset != null) - SculptTextureCallback(asset); -// else -// m_log.WarnFormat( -// "[SCENE OBJECT PART]: Part {0} {1} requested mesh/sculpt data for asset id {2} from asset service but received no data", -// Name, UUID, id); - } -*/ /// /// Do a physics property update for a NINJA joint. /// @@ -3285,39 +3254,6 @@ namespace OpenSim.Region.Framework.Scenes ParentGroup.ScriptSetPhysicsStatus(UsePhysics); } - /// - /// Set sculpt and mesh data, and tell the physics engine to process the change. - /// - /// The mesh itself. -/* - public void SculptTextureCallback(AssetBase texture) - { - if (m_shape.SculptEntry) - { - // commented out for sculpt map caching test - null could mean a cached sculpt map has been found - //if (texture != null) - { - if (texture != null) - { -// m_log.DebugFormat( -// "[SCENE OBJECT PART]: Setting sculpt data for {0} on SculptTextureCallback()", Name); - - m_shape.SculptData = texture.Data; - } - - PhysicsActor pa = PhysActor; - - if (pa != null) - { - // Update the physics actor with the new loaded sculpt data and set the taint signal. - pa.Shape = m_shape; - - ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(pa); - } - } - } - } -*/ /// /// Send a full update to the client for the given part /// @@ -4058,103 +3994,6 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter } } - public EntityIntersection TestIntersection(Ray iray, Quaternion parentrot) - { - // In this case we're using a sphere with a radius of the largest dimension of the prim - // TODO: Change to take shape into account - - EntityIntersection result = new EntityIntersection(); - Vector3 vAbsolutePosition = AbsolutePosition; - Vector3 vScale = Scale; - Vector3 rOrigin = iray.Origin; - Vector3 rDirection = iray.Direction; - - //rDirection = rDirection.Normalize(); - // Buidling the first part of the Quadratic equation - Vector3 r2ndDirection = rDirection*rDirection; - float itestPart1 = r2ndDirection.X + r2ndDirection.Y + r2ndDirection.Z; - - // Buidling the second part of the Quadratic equation - Vector3 tmVal2 = rOrigin - vAbsolutePosition; - Vector3 r2Direction = rDirection*2.0f; - Vector3 tmVal3 = r2Direction*tmVal2; - - float itestPart2 = tmVal3.X + tmVal3.Y + tmVal3.Z; - - // Buidling the third part of the Quadratic equation - Vector3 tmVal4 = rOrigin*rOrigin; - Vector3 tmVal5 = vAbsolutePosition*vAbsolutePosition; - - Vector3 tmVal6 = vAbsolutePosition*rOrigin; - - // Set Radius to the largest dimension of the prim - float radius = 0f; - if (vScale.X > radius) - radius = vScale.X; - if (vScale.Y > radius) - radius = vScale.Y; - if (vScale.Z > radius) - radius = vScale.Z; - - // the second part of this is the default prim size - // once we factor in the aabb of the prim we're adding we can - // change this to; - // radius = (radius / 2) - 0.01f; - // - radius = (radius / 2) + (0.5f / 2) - 0.1f; - - //radius = radius; - - float itestPart3 = tmVal4.X + tmVal4.Y + tmVal4.Z + tmVal5.X + tmVal5.Y + tmVal5.Z - - (2.0f*(tmVal6.X + tmVal6.Y + tmVal6.Z + (radius*radius))); - - // Yuk Quadradrics.. Solve first - float rootsqr = (itestPart2*itestPart2) - (4.0f*itestPart1*itestPart3); - if (rootsqr < 0.0f) - { - // No intersection - return result; - } - float root = ((-itestPart2) - (float) Math.Sqrt((double) rootsqr))/(itestPart1*2.0f); - - if (root < 0.0f) - { - // perform second quadratic root solution - root = ((-itestPart2) + (float) Math.Sqrt((double) rootsqr))/(itestPart1*2.0f); - - // is there any intersection? - if (root < 0.0f) - { - // nope, no intersection - return result; - } - } - - // We got an intersection. putting together an EntityIntersection object with the - // intersection information - Vector3 ipoint = - new Vector3(iray.Origin.X + (iray.Direction.X*root), iray.Origin.Y + (iray.Direction.Y*root), - iray.Origin.Z + (iray.Direction.Z*root)); - - result.HitTF = true; - result.ipoint = ipoint; - - // Normal is calculated by the difference and then normalizing the result - Vector3 normalpart = ipoint - vAbsolutePosition; - result.normal = normalpart / normalpart.Length(); - - // It's funny how the Vector3 object has a Distance function, but the Axiom.Math object doesn't. - // I can write a function to do it.. but I like the fact that this one is Static. - - Vector3 distanceConvert1 = new Vector3(iray.Origin.X, iray.Origin.Y, iray.Origin.Z); - Vector3 distanceConvert2 = new Vector3(ipoint.X, ipoint.Y, ipoint.Z); - float distance = (float) Util.GetDistanceTo(distanceConvert1, distanceConvert2); - - result.distance = distance; - - return result; - } - public EntityIntersection TestIntersectionOBB(Ray iray, Quaternion parentrot, bool frontFacesOnly, bool faceCenters) { // In this case we're using a rectangular prism, which has 6 faces and therefore 6 planes @@ -4522,15 +4361,7 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter public void UpdateExtraParam(ushort type, bool inUse, byte[] data) { m_shape.ReadInUpdateExtraParam(type, inUse, data); -/* - if (type == 0x30) - { - if (m_shape.SculptEntry && m_shape.SculptTexture != UUID.Zero) - { - ParentGroup.Scene.AssetService.Get(m_shape.SculptTexture.ToString(), this, AssetReceived); - } - } -*/ + if (ParentGroup != null) { ParentGroup.HasGroupChanged = true; @@ -5088,42 +4919,6 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter } } - /// - /// If the part is a sculpt/mesh, retrieve the mesh data and reinsert it into the shape so that the physics - /// engine can use it. - /// - /// - /// When the physics engine has finished with it, the sculpt data is discarded to save memory. - /// -/* - public void CheckSculptAndLoad() - { -// m_log.DebugFormat("Processing CheckSculptAndLoad for {0} {1}", Name, LocalId); - - return; - - if (ParentGroup.IsDeleted) - return; - - if ((ParentGroup.RootPart.GetEffectiveObjectFlags() & (uint)PrimFlags.Phantom) != 0) - return; - - if (Shape.SculptEntry && Shape.SculptTexture != UUID.Zero) - { - // check if a previously decoded sculpt map has been cached - // We don't read the file here - the meshmerizer will do that later. - // TODO: Could we simplify the meshmerizer code by reading and setting the data here? - if (File.Exists(System.IO.Path.Combine("j2kDecodeCache", "smap_" + Shape.SculptTexture.ToString()))) - { - SculptTextureCallback(null); - } - else - { - ParentGroup.Scene.AssetService.Get(Shape.SculptTexture.ToString(), this, AssetReceived); - } - } - } -*/ /// /// Update the texture entry for this part. /// @@ -5299,41 +5094,8 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter { objectflagupdate |= (uint) PrimFlags.AllowInventoryDrop; } -/* - PhysicsActor pa = PhysActor; - if (pa != null) - { - if ( -// ((AggregateScriptEvents & scriptEvents.collision) != 0) || -// ((AggregateScriptEvents & scriptEvents.collision_end) != 0) || -// ((AggregateScriptEvents & scriptEvents.collision_start) != 0) || -// ((AggregateScriptEvents & scriptEvents.land_collision_start) != 0) || -// ((AggregateScriptEvents & scriptEvents.land_collision) != 0) || -// ((AggregateScriptEvents & scriptEvents.land_collision_end) != 0) || - ((AggregateScriptEvents & PhysicsNeededSubsEvents) != 0) || ((ParentGroup.RootPart.AggregateScriptEvents & PhysicsNeededSubsEvents) != 0) || (CollisionSound != UUID.Zero) - ) - { - // subscribe to physics updates. - pa.OnCollisionUpdate += PhysicsCollision; - pa.SubscribeEvents(1000); - } - else - { - pa.UnSubscribeEvents(); - pa.OnCollisionUpdate -= PhysicsCollision; - } - } - */ - UpdatePhysicsSubscribedEvents(); - //if ((GetEffectiveObjectFlags() & (uint)PrimFlags.Scripted) != 0) - //{ - // ParentGroup.Scene.EventManager.OnScriptTimerEvent += handleTimerAccounting; - //} - //else - //{ - // ParentGroup.Scene.EventManager.OnScriptTimerEvent -= handleTimerAccounting; - //} + UpdatePhysicsSubscribedEvents(); LocalFlags = (PrimFlags)objectflagupdate;