From c7253d8bf9ed1902ca1a23990fdc4ff056778ee7 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 20 Apr 2022 01:37:25 +0100 Subject: [PATCH] send all animations to self again... --- .../Scenes/Animation/ScenePresenceAnimator.cs | 8 +- OpenSim/Region/PhysicsModules/ubOde/ODEApi.cs | 6 +- .../Region/PhysicsModules/ubOde/ODEModule.cs | 1 - .../Region/PhysicsModules/ubOde/ODEPrim.cs | 80 ++++++------------ .../Region/PhysicsModules/ubOde/ODEScene.cs | 83 +++++++++---------- 5 files changed, 72 insertions(+), 106 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs index 9c39eae81c..722f57a9e0 100644 --- a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs +++ b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs @@ -866,11 +866,11 @@ namespace OpenSim.Region.Framework.Scenes.Animation m_animations.GetArrays(out animIDs, out sequenceNums, out objectIDs); - // SendAnimPack(animIDs, sequenceNums, objectIDs); - if(selfIncluded) + //SendAnimPack(animIDs, sequenceNums, objectIDs); + //if(selfIncluded) m_scenePresence.SendAnimPack(animIDs, sequenceNums, objectIDs); - else - m_scenePresence.SendAnimPackToOthers(animIDs, sequenceNums, objectIDs); + //else + // m_scenePresence.SendAnimPackToOthers(animIDs, sequenceNums, objectIDs); } public string GetAnimName(UUID animId) diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODEApi.cs b/OpenSim/Region/PhysicsModules/ubOde/ODEApi.cs index 6a5e5e0d0b..83a69e40dd 100644 --- a/OpenSim/Region/PhysicsModules/ubOde/ODEApi.cs +++ b/OpenSim/Region/PhysicsModules/ubOde/ODEApi.cs @@ -347,15 +347,15 @@ namespace OpenSim.Region.PhysicsModule.ubOde } - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Sequential, Size = 16)] internal struct Vector3 { internal Vector3(dReal x, dReal y, dReal z) { - X = x; Y = y; Z = z; _w = 0.0f; + X = x; Y = y; Z = z; //_w = 0.0f; } internal dReal X, Y, Z; - private dReal _w; + //private readonly dReal _w; } diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODEModule.cs b/OpenSim/Region/PhysicsModules/ubOde/ODEModule.cs index 8b3b5ebef9..292de465fe 100644 --- a/OpenSim/Region/PhysicsModules/ubOde/ODEModule.cs +++ b/OpenSim/Region/PhysicsModules/ubOde/ODEModule.cs @@ -55,7 +55,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde //throw new Exception("Invalid physics meshing option"); } - if (Util.IsWindows()) Util.LoadArchSpecificWindowsDll("ode.dll"); diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs b/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs index 9cbab1ef98..c49166c3d9 100644 --- a/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs +++ b/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs @@ -580,7 +580,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde // if(childPrim) we only know about physical linksets return Ptot; -/* + /* float tmass = _mass; Ptot *= tmass; @@ -600,7 +600,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde Ptot *= tmass; return Ptot; -*/ + */ } else return m_position; @@ -612,7 +612,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde { set { -// AddChange(changes.Shape, value); + //AddChange(changes.Shape, value); m_parentScene.m_meshWorker.ChangeActorPhysRep(this, value, m_size, m_fakeShapetype); } } @@ -955,10 +955,10 @@ namespace OpenSim.Region.PhysicsModule.ubOde { if (force.IsFinite()) { -// if(pushforce) for now applyrotationimpulse seems more happy applied as a force + //if(pushforce) for now applyrotationimpulse seems more happy applied as a force AddChange(changes.AddAngForce, force); -// else // a impulse -// AddChange(changes.AddAngForce, force * m_invTimeStep); + //else // a impulse + //AddChange(changes.AddAngForce, force * m_invTimeStep); } else { @@ -1051,10 +1051,10 @@ namespace OpenSim.Region.PhysicsModule.ubOde } set { - float old = m_density; + //float old = m_density; m_density = value / 100f; - // if(m_density != old) - // UpdatePrimBodyData(); + //if(m_density != old) + // UpdatePrimBodyData(); } } public override float GravModifier @@ -1221,7 +1221,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde if (ncolisions == 0) { SentEmptyCollisionsEvent = true; -// _parent_scene.RemoveCollisionEventReporting(this); + //_parent_scene.RemoveCollisionEventReporting(this); } else if(Body == IntPtr.Zero || (SafeNativeMethods.BodyIsEnabled(Body) && m_bodydisablecontrol >= 0 )) { @@ -1600,8 +1600,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde UpdatePrimBodyData(); m_parentScene.actor_name_map[m_prim_geom] = this; -/* -// debug + /* + // debug d.AABB aabb; d.GeomGetAABB(prim_geom, out aabb); float x = aabb.MaxX - aabb.MinX; @@ -1613,7 +1613,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde else if (x < 0.001f || y < 0.001f || z < 0.001f) m_log.WarnFormat("[PHYSICS]: small prim geo {0},size {1}, AABBsize <{2},{3},{4}, mesh {5} at {6}", Name, _size.ToString(), x, y, z, _pbs.SculptEntry ? _pbs.SculptTexture.ToString() : "primMesh", _position.ToString()); -*/ + */ } else @@ -2525,13 +2525,15 @@ namespace OpenSim.Region.PhysicsModule.ubOde m_orientation.Y = qtmp.Y; m_orientation.Z = qtmp.Z; m_orientation.W = qtmp.W; -/* -// Debug + + /* + // Debug float qlen = _orientation.Length(); if (qlen > 1.01f || qlen < 0.99) m_log.WarnFormat("[PHYSICS]: Got nonnorm quaternion from geom in Object {0} norm {1}", Name, qlen); -// -*/ + + */ + m_orientation.Normalize(); SafeNativeMethods.Vector3 lpos = SafeNativeMethods.GeomGetPosition(m_prim_geom); @@ -2581,7 +2583,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde childrenPrim.Remove(odePrim); odePrim.childPrim = false; odePrim._parent = null; - // odePrim.UpdateDataFromGeom(); + //odePrim.UpdateDataFromGeom(); if (remakebodies) odePrim.MakeBody(); } @@ -2703,10 +2705,10 @@ namespace OpenSim.Region.PhysicsModule.ubOde { if (!childPrim) { -// m_force = Vector3.Zero; + //m_force = Vector3.Zero; m_forceacc = Vector3.Zero; m_angularForceacc = Vector3.Zero; -// m_torque = Vector3.Zero; + //m_torque = Vector3.Zero; _velocity = Vector3.Zero; m_acceleration = Vector3.Zero; m_rotationalVelocity = Vector3.Zero; @@ -2735,31 +2737,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde ApplyCollisionCatFlags(); } -/* not in use - internal void ChildSelectedChange(bool childSelect) - { - if(childPrim) - return; - - if (childSelect == m_isSelected) - return; - - if (childSelect) - { - DoSelectedStatus(true); - } - - else - { - foreach (OdePrim prm in childrenPrim) - { - if (prm.m_isSelected) - return; - } - DoSelectedStatus(false); - } - } -*/ private void changeSelectedStatus(bool newval) { if (m_lastdoneSelected == newval) @@ -2816,10 +2793,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde prm.m_delaySelect = false; } } -// else if (_parent != null) -// ((OdePrim)_parent).ChildSelectedChange(true); - - + if (m_prim_geom != IntPtr.Zero) { if (m_NoColide) @@ -2862,8 +2836,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde SafeNativeMethods.BodyEnable(Body); } } -// else if (_parent != null) -// ((OdePrim)_parent).ChildSelectedChange(false); UpdateCollisionCatFlags(); ApplyCollisionCatFlags(); @@ -2928,7 +2900,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde m_givefakepos--; if (m_givefakepos < 0) m_givefakepos = 0; -// changeSelectedStatus(); + //changeSelectedStatus(); resetCollisionAccounting(); } @@ -2943,14 +2915,14 @@ namespace OpenSim.Region.PhysicsModule.ubOde { m_orientation = newOri; } -/* + /* else if (m_forcePosOrRotation && _orientation != newOri && Body != IntPtr.Zero) { FixInertia(_position, newOri); if (!d.BodyIsEnabled(Body)) d.BodyEnable(Body); } -*/ + */ } else { diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs b/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs index 0c61d09ce2..9ae49aed4f 100644 --- a/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs +++ b/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs @@ -625,15 +625,11 @@ namespace OpenSim.Region.PhysicsModule.ubOde if (SafeNativeMethods.GeomGetCategoryBits(g1) == (uint)CollisionCategories.VolumeDtc || SafeNativeMethods.GeomGetCategoryBits(g2) == (uint)CollisionCategories.VolumeDtc) { - int cflags; - unchecked - { - cflags = (int)(1 | SafeNativeMethods.CONTACTS_UNIMPORTANT); - } + int cflags = unchecked ((int)(1 | SafeNativeMethods.CONTACTS_UNIMPORTANT)); count = SafeNativeMethods.CollidePtr(g1, g2, cflags, ContactgeomsArray, SafeNativeMethods.ContactGeom.unmanagedSizeOf); } else - count = SafeNativeMethods.CollidePtr(g1, g2, (contactsPerCollision & 0xffff), ContactgeomsArray, SafeNativeMethods.ContactGeom.unmanagedSizeOf); + count = SafeNativeMethods.CollidePtr(g1, g2, contactsPerCollision, ContactgeomsArray, SafeNativeMethods.ContactGeom.unmanagedSizeOf); } catch (SEHException) { @@ -671,7 +667,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde return; } - ContactPoint maxDepthContact = new ContactPoint(); + ContactPoint maxDepthContact; // do volume detection case if ((p1.IsVolumeDtc || p2.IsVolumeDtc)) @@ -687,10 +683,9 @@ namespace OpenSim.Region.PhysicsModule.ubOde } // big messy collision analises - float mu = 0; float bounce = 0; -// bool IgnoreNegSides = false; + //bool IgnoreNegSides = false; ContactData contactdata1 = new ContactData(0, 0, false); ContactData contactdata2 = new ContactData(0, 0, false); @@ -739,8 +734,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde bounce = contactdata1.bounce * contactdata2.bounce; mu = (float)Math.Sqrt(contactdata1.mu * contactdata2.mu); -// if (relVlenSQ > 0.01f) -// mu *= frictionMovementMult; + //if (relVlenSQ > 0.01f) + // mu *= frictionMovementMult; if(SafeNativeMethods.GeomGetClass(g2) == SafeNativeMethods.GeomClassID.TriMeshClass && SafeNativeMethods.GeomGetClass(g1) == SafeNativeMethods.GeomClassID.TriMeshClass) @@ -752,9 +747,9 @@ namespace OpenSim.Region.PhysicsModule.ubOde bounce = contactdata1.bounce * TerrainBounce; mu = (float)Math.Sqrt(contactdata1.mu * TerrainFriction); -// Vector3 v1 = p1.rootVelocity; -// if (Math.Abs(v1.X) > 0.1f || Math.Abs(v1.Y) > 0.1f) -// mu *= frictionMovementMult; + //Vector3 v1 = p1.rootVelocity; + //if (Math.Abs(v1.X) > 0.1f || Math.Abs(v1.Y) > 0.1f) + // mu *= frictionMovementMult; p1.CollidingGround = true; if(SafeNativeMethods.GeomGetClass(g1) == SafeNativeMethods.GeomClassID.TriMeshClass) @@ -777,11 +772,11 @@ namespace OpenSim.Region.PhysicsModule.ubOde bounce = contactdata2.bounce * TerrainBounce; mu = (float)Math.Sqrt(contactdata2.mu * TerrainFriction); -// if (curContact.side1 > 0) // should be 2 ? -// IgnoreNegSides = true; -// Vector3 v2 = p2.rootVelocity; -// if (Math.Abs(v2.X) > 0.1f || Math.Abs(v2.Y) > 0.1f) -// mu *= frictionMovementMult; + //if (curContact.side1 > 0) // should be 2 ? + // IgnoreNegSides = true; + //Vector3 v2 = p2.rootVelocity; + //if (Math.Abs(v2.X) > 0.1f || Math.Abs(v2.Y) > 0.1f) + // mu *= frictionMovementMult; if(SafeNativeMethods.GeomGetClass(g2) == SafeNativeMethods.GeomClassID.TriMeshClass) smoothMesh = true; @@ -1556,20 +1551,21 @@ namespace OpenSim.Region.PhysicsModule.ubOde aprim.Move(); } } - // moveTime += Util.GetTimeStampMS() - tmpTime; - // tmpTime = Util.GetTimeStampMS(); + //moveTime += Util.GetTimeStampMS() - tmpTime; + //tmpTime = Util.GetTimeStampMS(); lock (SimulationLock) { m_rayCastManager.ProcessQueuedRequests(); - // rayTime += Util.GetTimeStampMS() - tmpTime; - // tmpTime = Util.GetTimeStampMS(); + //rayTime += Util.GetTimeStampMS() - tmpTime; + //tmpTime = Util.GetTimeStampMS(); + collision_optimized(); } - // collisionTime += Util.GetTimeStampMS() - tmpTime; + //collisionTime += Util.GetTimeStampMS() - tmpTime; + //tmpTime = Util.GetTimeStampMS(); - // tmpTime = Util.GetTimeStampMS(); lock(_collisionEventPrimRemove) { foreach (PhysicsActor obj in _collisionEventPrimRemove) @@ -1610,7 +1606,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde sleepers.Clear(); // collisonRepo += Util.GetTimeStampMS() - tmpTime; - // do a ode simulation step // tmpTime = Util.GetTimeStampMS(); lock (SimulationLock) @@ -1618,7 +1613,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde SafeNativeMethods.WorldQuickStep(world, ODE_STEPSIZE); SafeNativeMethods.JointGroupEmpty(contactgroup); } - // qstepTIme += Util.GetTimeStampMS() - tmpTime; + //qstepTIme += Util.GetTimeStampMS() - tmpTime; // update managed ideia of physical data and do updates to core /* @@ -1681,12 +1676,12 @@ namespace OpenSim.Region.PhysicsModule.ubOde } } - /* + // information block for in debug breakpoint only - - int ntopactivegeoms = d.SpaceGetNumGeoms(ActiveSpace); - int ntopstaticgeoms = d.SpaceGetNumGeoms(StaticSpace); - int ngroundgeoms = d.SpaceGetNumGeoms(GroundSpace); + /* + int ntopactivegeoms = SafeNativeMethods.SpaceGetNumGeoms(ActiveSpace); + int ntopstaticgeoms = SafeNativeMethods.SpaceGetNumGeoms(StaticSpace); + int ngroundgeoms = SafeNativeMethods.SpaceGetNumGeoms(GroundSpace); int nactivegeoms = 0; int nactivespaces = 0; @@ -1697,11 +1692,11 @@ namespace OpenSim.Region.PhysicsModule.ubOde for (int i = 0; i < ntopactivegeoms; i++) { - sp = d.SpaceGetGeom(ActiveSpace, i); - if (d.GeomIsSpace(sp)) + sp = SafeNativeMethods.SpaceGetGeom(ActiveSpace, i); + if (SafeNativeMethods.GeomIsSpace(sp)) { nactivespaces++; - nactivegeoms += d.SpaceGetNumGeoms(sp); + nactivegeoms += SafeNativeMethods.SpaceGetNumGeoms(sp); } else nactivegeoms++; @@ -1709,25 +1704,25 @@ namespace OpenSim.Region.PhysicsModule.ubOde for (int i = 0; i < ntopstaticgeoms; i++) { - sp = d.SpaceGetGeom(StaticSpace, i); - if (d.GeomIsSpace(sp)) + sp = SafeNativeMethods.SpaceGetGeom(StaticSpace, i); + if (SafeNativeMethods.GeomIsSpace(sp)) { nstaticspaces++; - nstaticgeoms += d.SpaceGetNumGeoms(sp); + nstaticgeoms += SafeNativeMethods.SpaceGetNumGeoms(sp); } else nstaticgeoms++; } - - int ntopgeoms = d.SpaceGetNumGeoms(TopSpace); + + int ntopgeoms = SafeNativeMethods.SpaceGetNumGeoms(TopSpace); int totgeoms = nstaticgeoms + nactivegeoms + ngroundgeoms + 1; // one ray - int nbodies = d.NTotalBodies; - int ngeoms = d.NTotalGeoms; + int nbodies = SafeNativeMethods.NTotalBodies; + int ngeoms = SafeNativeMethods.NTotalGeoms; */ /* - looptimeMS /= nodeframes; + //looptimeMS /= nodeframes; collisionTime /= nodeframes; qstepTIme /= nodeframes; changestot /= nodeframes; @@ -1736,7 +1731,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde moveTime /= nodeframes; rayTime /= nodeframes; - if(looptimeMS > .05) + //if(looptimeMS > .05) {