diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 242 |
1 files changed, 2 insertions, 240 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index b3c643d..01a323e 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -2121,12 +2121,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2121 | 2121 | ||
2122 | if (localGlobalTF) | 2122 | if (localGlobalTF) |
2123 | { | 2123 | { |
2124 | /* | ||
2125 | Quaternion grot = GetWorldRotation(); | ||
2126 | Quaternion AXgrot = grot; | ||
2127 | Vector3 AXimpulsei = impulsei; | ||
2128 | Vector3 newimpulse = AXimpulsei * AXgrot; | ||
2129 | */ | ||
2130 | torque *= GetWorldRotation(); | 2124 | torque *= GetWorldRotation(); |
2131 | } | 2125 | } |
2132 | 2126 | ||
@@ -2265,16 +2259,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2265 | 2259 | ||
2266 | if (userExposed) | 2260 | if (userExposed) |
2267 | { | 2261 | { |
2268 | /* | ||
2269 | if (dupe.m_shape.SculptEntry && dupe.m_shape.SculptTexture != UUID.Zero) | ||
2270 | { | ||
2271 | ParentGroup.Scene.AssetService.Get( | ||
2272 | dupe.m_shape.SculptTexture.ToString(), dupe, dupe.AssetReceived); | ||
2273 | } | ||
2274 | */ | ||
2275 | bool UsePhysics = ((dupe.Flags & PrimFlags.Physics) != 0); | 2262 | bool UsePhysics = ((dupe.Flags & PrimFlags.Physics) != 0); |
2276 | dupe.DoPhysicsPropertyUpdate(UsePhysics, true); | 2263 | dupe.DoPhysicsPropertyUpdate(UsePhysics, true); |
2277 | // dupe.UpdatePhysicsSubscribedEvents(); // not sure... | ||
2278 | } | 2264 | } |
2279 | 2265 | ||
2280 | if (dupe.PhysActor != null) | 2266 | if (dupe.PhysActor != null) |
@@ -2288,23 +2274,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2288 | } | 2274 | } |
2289 | 2275 | ||
2290 | /// <summary> | 2276 | /// <summary> |
2291 | /// Called back by asynchronous asset fetch. | ||
2292 | /// </summary> | ||
2293 | /// <param name="id">ID of asset received</param> | ||
2294 | /// <param name="sender">Register</param> | ||
2295 | /// <param name="asset"></param> | ||
2296 | /* | ||
2297 | protected void AssetReceived(string id, Object sender, AssetBase asset) | ||
2298 | { | ||
2299 | if (asset != null) | ||
2300 | SculptTextureCallback(asset); | ||
2301 | // else | ||
2302 | // m_log.WarnFormat( | ||
2303 | // "[SCENE OBJECT PART]: Part {0} {1} requested mesh/sculpt data for asset id {2} from asset service but received no data", | ||
2304 | // Name, UUID, id); | ||
2305 | } | ||
2306 | */ | ||
2307 | /// <summary> | ||
2308 | /// Do a physics property update for a NINJA joint. | 2277 | /// Do a physics property update for a NINJA joint. |
2309 | /// </summary> | 2278 | /// </summary> |
2310 | /// <param name="UsePhysics"></param> | 2279 | /// <param name="UsePhysics"></param> |
@@ -3286,39 +3255,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
3286 | } | 3255 | } |
3287 | 3256 | ||
3288 | /// <summary> | 3257 | /// <summary> |
3289 | /// Set sculpt and mesh data, and tell the physics engine to process the change. | ||
3290 | /// </summary> | ||
3291 | /// <param name="texture">The mesh itself.</param> | ||
3292 | /* | ||
3293 | public void SculptTextureCallback(AssetBase texture) | ||
3294 | { | ||
3295 | if (m_shape.SculptEntry) | ||
3296 | { | ||
3297 | // commented out for sculpt map caching test - null could mean a cached sculpt map has been found | ||
3298 | //if (texture != null) | ||
3299 | { | ||
3300 | if (texture != null) | ||
3301 | { | ||
3302 | // m_log.DebugFormat( | ||
3303 | // "[SCENE OBJECT PART]: Setting sculpt data for {0} on SculptTextureCallback()", Name); | ||
3304 | |||
3305 | m_shape.SculptData = texture.Data; | ||
3306 | } | ||
3307 | |||
3308 | PhysicsActor pa = PhysActor; | ||
3309 | |||
3310 | if (pa != null) | ||
3311 | { | ||
3312 | // Update the physics actor with the new loaded sculpt data and set the taint signal. | ||
3313 | pa.Shape = m_shape; | ||
3314 | |||
3315 | ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(pa); | ||
3316 | } | ||
3317 | } | ||
3318 | } | ||
3319 | } | ||
3320 | */ | ||
3321 | /// <summary> | ||
3322 | /// Send a full update to the client for the given part | 3258 | /// Send a full update to the client for the given part |
3323 | /// </summary> | 3259 | /// </summary> |
3324 | /// <param name="remoteClient"></param> | 3260 | /// <param name="remoteClient"></param> |
@@ -4058,103 +3994,6 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter | |||
4058 | } | 3994 | } |
4059 | } | 3995 | } |
4060 | 3996 | ||
4061 | public EntityIntersection TestIntersection(Ray iray, Quaternion parentrot) | ||
4062 | { | ||
4063 | // In this case we're using a sphere with a radius of the largest dimension of the prim | ||
4064 | // TODO: Change to take shape into account | ||
4065 | |||
4066 | EntityIntersection result = new EntityIntersection(); | ||
4067 | Vector3 vAbsolutePosition = AbsolutePosition; | ||
4068 | Vector3 vScale = Scale; | ||
4069 | Vector3 rOrigin = iray.Origin; | ||
4070 | Vector3 rDirection = iray.Direction; | ||
4071 | |||
4072 | //rDirection = rDirection.Normalize(); | ||
4073 | // Buidling the first part of the Quadratic equation | ||
4074 | Vector3 r2ndDirection = rDirection*rDirection; | ||
4075 | float itestPart1 = r2ndDirection.X + r2ndDirection.Y + r2ndDirection.Z; | ||
4076 | |||
4077 | // Buidling the second part of the Quadratic equation | ||
4078 | Vector3 tmVal2 = rOrigin - vAbsolutePosition; | ||
4079 | Vector3 r2Direction = rDirection*2.0f; | ||
4080 | Vector3 tmVal3 = r2Direction*tmVal2; | ||
4081 | |||
4082 | float itestPart2 = tmVal3.X + tmVal3.Y + tmVal3.Z; | ||
4083 | |||
4084 | // Buidling the third part of the Quadratic equation | ||
4085 | Vector3 tmVal4 = rOrigin*rOrigin; | ||
4086 | Vector3 tmVal5 = vAbsolutePosition*vAbsolutePosition; | ||
4087 | |||
4088 | Vector3 tmVal6 = vAbsolutePosition*rOrigin; | ||
4089 | |||
4090 | // Set Radius to the largest dimension of the prim | ||
4091 | float radius = 0f; | ||
4092 | if (vScale.X > radius) | ||
4093 | radius = vScale.X; | ||
4094 | if (vScale.Y > radius) | ||
4095 | radius = vScale.Y; | ||
4096 | if (vScale.Z > radius) | ||
4097 | radius = vScale.Z; | ||
4098 | |||
4099 | // the second part of this is the default prim size | ||
4100 | // once we factor in the aabb of the prim we're adding we can | ||
4101 | // change this to; | ||
4102 | // radius = (radius / 2) - 0.01f; | ||
4103 | // | ||
4104 | radius = (radius / 2) + (0.5f / 2) - 0.1f; | ||
4105 | |||
4106 | //radius = radius; | ||
4107 | |||
4108 | float itestPart3 = tmVal4.X + tmVal4.Y + tmVal4.Z + tmVal5.X + tmVal5.Y + tmVal5.Z - | ||
4109 | (2.0f*(tmVal6.X + tmVal6.Y + tmVal6.Z + (radius*radius))); | ||
4110 | |||
4111 | // Yuk Quadradrics.. Solve first | ||
4112 | float rootsqr = (itestPart2*itestPart2) - (4.0f*itestPart1*itestPart3); | ||
4113 | if (rootsqr < 0.0f) | ||
4114 | { | ||
4115 | // No intersection | ||
4116 | return result; | ||
4117 | } | ||
4118 | float root = ((-itestPart2) - (float) Math.Sqrt((double) rootsqr))/(itestPart1*2.0f); | ||
4119 | |||
4120 | if (root < 0.0f) | ||
4121 | { | ||
4122 | // perform second quadratic root solution | ||
4123 | root = ((-itestPart2) + (float) Math.Sqrt((double) rootsqr))/(itestPart1*2.0f); | ||
4124 | |||
4125 | // is there any intersection? | ||
4126 | if (root < 0.0f) | ||
4127 | { | ||
4128 | // nope, no intersection | ||
4129 | return result; | ||
4130 | } | ||
4131 | } | ||
4132 | |||
4133 | // We got an intersection. putting together an EntityIntersection object with the | ||
4134 | // intersection information | ||
4135 | Vector3 ipoint = | ||
4136 | new Vector3(iray.Origin.X + (iray.Direction.X*root), iray.Origin.Y + (iray.Direction.Y*root), | ||
4137 | iray.Origin.Z + (iray.Direction.Z*root)); | ||
4138 | |||
4139 | result.HitTF = true; | ||
4140 | result.ipoint = ipoint; | ||
4141 | |||
4142 | // Normal is calculated by the difference and then normalizing the result | ||
4143 | Vector3 normalpart = ipoint - vAbsolutePosition; | ||
4144 | result.normal = normalpart / normalpart.Length(); | ||
4145 | |||
4146 | // It's funny how the Vector3 object has a Distance function, but the Axiom.Math object doesn't. | ||
4147 | // I can write a function to do it.. but I like the fact that this one is Static. | ||
4148 | |||
4149 | Vector3 distanceConvert1 = new Vector3(iray.Origin.X, iray.Origin.Y, iray.Origin.Z); | ||
4150 | Vector3 distanceConvert2 = new Vector3(ipoint.X, ipoint.Y, ipoint.Z); | ||
4151 | float distance = (float) Util.GetDistanceTo(distanceConvert1, distanceConvert2); | ||
4152 | |||
4153 | result.distance = distance; | ||
4154 | |||
4155 | return result; | ||
4156 | } | ||
4157 | |||
4158 | public EntityIntersection TestIntersectionOBB(Ray iray, Quaternion parentrot, bool frontFacesOnly, bool faceCenters) | 3997 | public EntityIntersection TestIntersectionOBB(Ray iray, Quaternion parentrot, bool frontFacesOnly, bool faceCenters) |
4159 | { | 3998 | { |
4160 | // In this case we're using a rectangular prism, which has 6 faces and therefore 6 planes | 3999 | // 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 | |||
4522 | public void UpdateExtraParam(ushort type, bool inUse, byte[] data) | 4361 | public void UpdateExtraParam(ushort type, bool inUse, byte[] data) |
4523 | { | 4362 | { |
4524 | m_shape.ReadInUpdateExtraParam(type, inUse, data); | 4363 | m_shape.ReadInUpdateExtraParam(type, inUse, data); |
4525 | /* | 4364 | |
4526 | if (type == 0x30) | ||
4527 | { | ||
4528 | if (m_shape.SculptEntry && m_shape.SculptTexture != UUID.Zero) | ||
4529 | { | ||
4530 | ParentGroup.Scene.AssetService.Get(m_shape.SculptTexture.ToString(), this, AssetReceived); | ||
4531 | } | ||
4532 | } | ||
4533 | */ | ||
4534 | if (ParentGroup != null) | 4365 | if (ParentGroup != null) |
4535 | { | 4366 | { |
4536 | ParentGroup.HasGroupChanged = true; | 4367 | ParentGroup.HasGroupChanged = true; |
@@ -5089,42 +4920,6 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter | |||
5089 | } | 4920 | } |
5090 | 4921 | ||
5091 | /// <summary> | 4922 | /// <summary> |
5092 | /// If the part is a sculpt/mesh, retrieve the mesh data and reinsert it into the shape so that the physics | ||
5093 | /// engine can use it. | ||
5094 | /// </summary> | ||
5095 | /// <remarks> | ||
5096 | /// When the physics engine has finished with it, the sculpt data is discarded to save memory. | ||
5097 | /// </remarks> | ||
5098 | /* | ||
5099 | public void CheckSculptAndLoad() | ||
5100 | { | ||
5101 | // m_log.DebugFormat("Processing CheckSculptAndLoad for {0} {1}", Name, LocalId); | ||
5102 | |||
5103 | return; | ||
5104 | |||
5105 | if (ParentGroup.IsDeleted) | ||
5106 | return; | ||
5107 | |||
5108 | if ((ParentGroup.RootPart.GetEffectiveObjectFlags() & (uint)PrimFlags.Phantom) != 0) | ||
5109 | return; | ||
5110 | |||
5111 | if (Shape.SculptEntry && Shape.SculptTexture != UUID.Zero) | ||
5112 | { | ||
5113 | // check if a previously decoded sculpt map has been cached | ||
5114 | // We don't read the file here - the meshmerizer will do that later. | ||
5115 | // TODO: Could we simplify the meshmerizer code by reading and setting the data here? | ||
5116 | if (File.Exists(System.IO.Path.Combine("j2kDecodeCache", "smap_" + Shape.SculptTexture.ToString()))) | ||
5117 | { | ||
5118 | SculptTextureCallback(null); | ||
5119 | } | ||
5120 | else | ||
5121 | { | ||
5122 | ParentGroup.Scene.AssetService.Get(Shape.SculptTexture.ToString(), this, AssetReceived); | ||
5123 | } | ||
5124 | } | ||
5125 | } | ||
5126 | */ | ||
5127 | /// <summary> | ||
5128 | /// Update the texture entry for this part. | 4923 | /// Update the texture entry for this part. |
5129 | /// </summary> | 4924 | /// </summary> |
5130 | /// <param name="serializedTextureEntry"></param> | 4925 | /// <param name="serializedTextureEntry"></param> |
@@ -5299,41 +5094,8 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter | |||
5299 | { | 5094 | { |
5300 | objectflagupdate |= (uint) PrimFlags.AllowInventoryDrop; | 5095 | objectflagupdate |= (uint) PrimFlags.AllowInventoryDrop; |
5301 | } | 5096 | } |
5302 | /* | ||
5303 | PhysicsActor pa = PhysActor; | ||
5304 | if (pa != null) | ||
5305 | { | ||
5306 | if ( | ||
5307 | // ((AggregateScriptEvents & scriptEvents.collision) != 0) || | ||
5308 | // ((AggregateScriptEvents & scriptEvents.collision_end) != 0) || | ||
5309 | // ((AggregateScriptEvents & scriptEvents.collision_start) != 0) || | ||
5310 | // ((AggregateScriptEvents & scriptEvents.land_collision_start) != 0) || | ||
5311 | // ((AggregateScriptEvents & scriptEvents.land_collision) != 0) || | ||
5312 | // ((AggregateScriptEvents & scriptEvents.land_collision_end) != 0) || | ||
5313 | ((AggregateScriptEvents & PhysicsNeededSubsEvents) != 0) || ((ParentGroup.RootPart.AggregateScriptEvents & PhysicsNeededSubsEvents) != 0) || (CollisionSound != UUID.Zero) | ||
5314 | ) | ||
5315 | { | ||
5316 | // subscribe to physics updates. | ||
5317 | pa.OnCollisionUpdate += PhysicsCollision; | ||
5318 | pa.SubscribeEvents(1000); | ||
5319 | } | ||
5320 | else | ||
5321 | { | ||
5322 | pa.UnSubscribeEvents(); | ||
5323 | pa.OnCollisionUpdate -= PhysicsCollision; | ||
5324 | } | ||
5325 | } | ||
5326 | */ | ||
5327 | UpdatePhysicsSubscribedEvents(); | ||
5328 | 5097 | ||
5329 | //if ((GetEffectiveObjectFlags() & (uint)PrimFlags.Scripted) != 0) | 5098 | UpdatePhysicsSubscribedEvents(); |
5330 | //{ | ||
5331 | // ParentGroup.Scene.EventManager.OnScriptTimerEvent += handleTimerAccounting; | ||
5332 | //} | ||
5333 | //else | ||
5334 | //{ | ||
5335 | // ParentGroup.Scene.EventManager.OnScriptTimerEvent -= handleTimerAccounting; | ||
5336 | //} | ||
5337 | 5099 | ||
5338 | LocalFlags = (PrimFlags)objectflagupdate; | 5100 | LocalFlags = (PrimFlags)objectflagupdate; |
5339 | 5101 | ||