From 7d89e122930be39e84a6d174548fa2d12ac0484a Mon Sep 17 00:00:00 2001
From: Teravus Ovares
Date: Sat, 6 Sep 2008 07:52:41 +0000
Subject: * This is the fabled LibOMV update with all of the libOMV types from
JHurliman * This is a HUGE OMG update and will definitely have unknown side
effects.. so this is really only for the strong hearted at this point.
Regular people should let the dust settle. * This has been tested to work
with most basic functions. However.. make sure you back up 'everything'
before using this. It's that big! * Essentially we're back at square 1 in
the testing phase.. so lets identify things that broke.
---
.../BasicPhysicsPlugin/BasicPhysicsPlugin.cs | 2 +-
.../Region/Physics/BulletXPlugin/BulletXPlugin.cs | 58 ++++++-----
OpenSim/Region/Physics/Manager/PhysicsActor.cs | 2 +-
.../Region/Physics/Manager/PhysicsPluginManager.cs | 88 +++++++++++------
OpenSim/Region/Physics/Manager/PhysicsScene.cs | 2 +-
OpenSim/Region/Physics/Manager/PhysicsVector.cs | 2 +-
OpenSim/Region/Physics/Meshing/Extruder.cs | 13 +--
OpenSim/Region/Physics/Meshing/HelperTypes.cs | 110 +++++----------------
OpenSim/Region/Physics/Meshing/Meshmerizer.cs | 3 +-
OpenSim/Region/Physics/Meshing/PrimMesher.cs | 11 ++-
OpenSim/Region/Physics/Meshing/SculptMesh.cs | 7 +-
OpenSim/Region/Physics/OdePlugin/ODECharacter.cs | 3 +-
OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | 96 +++++++++---------
OpenSim/Region/Physics/OdePlugin/ODETestClass.cs | 4 +-
OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | 51 +++++-----
OpenSim/Region/Physics/POSPlugin/POSCharacter.cs | 2 +-
OpenSim/Region/Physics/POSPlugin/POSPlugin.cs | 1 -
OpenSim/Region/Physics/POSPlugin/POSPrim.cs | 2 +-
OpenSim/Region/Physics/POSPlugin/POSScene.cs | 17 ++--
OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs | 12 +--
20 files changed, 226 insertions(+), 260 deletions(-)
(limited to 'OpenSim/Region/Physics')
diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs
index 3bf0956..e38a12b 100644
--- a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs
+++ b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs
@@ -26,8 +26,8 @@
*/
using System.Collections.Generic;
-using Axiom.Math;
using Nini.Config;
+using OpenMetaverse;
using OpenSim.Framework;
using OpenSim.Region.Physics.Manager;
diff --git a/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs b/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs
index cc55f6e..c969f9a 100644
--- a/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs
+++ b/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs
@@ -29,13 +29,15 @@
using System;
using System.Collections.Generic;
+using OpenMetaverse;
using MonoXnaCompactMaths;
using OpenSim.Framework;
using OpenSim.Region.Physics.Manager;
using XnaDevRu.BulletX;
using XnaDevRu.BulletX.Dynamics;
using Nini.Config;
-using AxiomQuaternion = Axiom.Math.Quaternion;
+using Vector3 = MonoXnaCompactMaths.Vector3;
+using Quaternion = MonoXnaCompactMaths.Quaternion;
#endregion
@@ -61,14 +63,14 @@ namespace OpenSim.Region.Physics.BulletXPlugin
}
//Quaternion
- public static Quaternion AxiomQuaternionToXnaQuaternion(AxiomQuaternion axiomQuaternion)
+ public static Quaternion QuaternionToXnaQuaternion(OpenMetaverse.Quaternion quaternion)
{
- return new Quaternion(axiomQuaternion.x, axiomQuaternion.y, axiomQuaternion.z, axiomQuaternion.w);
+ return new Quaternion(quaternion.X, quaternion.Y, quaternion.Z, quaternion.W);
}
- public static AxiomQuaternion XnaQuaternionToAxiomQuaternion(Quaternion xnaQuaternion)
+ public static OpenMetaverse.Quaternion XnaQuaternionToQuaternion(Quaternion xnaQuaternion)
{
- return new AxiomQuaternion(xnaQuaternion.W, xnaQuaternion.X, xnaQuaternion.Y, xnaQuaternion.Z);
+ return new OpenMetaverse.Quaternion(xnaQuaternion.W, xnaQuaternion.X, xnaQuaternion.Y, xnaQuaternion.Z);
}
//Next methods are extracted from XnaDevRu.BulletX(See 3rd party license):
@@ -92,7 +94,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
internal static Quaternion GetRotation(Matrix m)
{
- Quaternion q = new Quaternion();
+ Quaternion q;
float trace = m.M11 + m.M22 + m.M33;
@@ -108,6 +110,8 @@ namespace OpenSim.Region.Physics.BulletXPlugin
}
else
{
+ q.X = q.Y = q.Z = q.W = 0f;
+
int i = m.M11 < m.M22
?
(m.M22 < m.M33 ? 2 : 1)
@@ -601,13 +605,13 @@ namespace OpenSim.Region.Physics.BulletXPlugin
}
public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position,
- PhysicsVector size, AxiomQuaternion rotation)
+ PhysicsVector size, OpenMetaverse.Quaternion rotation)
{
return AddPrimShape(primName, pbs, position, size, rotation, false);
}
public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position,
- PhysicsVector size, AxiomQuaternion rotation, bool isPhysical)
+ PhysicsVector size, OpenMetaverse.Quaternion rotation, bool isPhysical)
{
PhysicsActor result;
@@ -634,7 +638,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
return result;
}
- public PhysicsActor AddPrim(String name, PhysicsVector position, PhysicsVector size, AxiomQuaternion rotation,
+ public PhysicsActor AddPrim(String name, PhysicsVector position, PhysicsVector size, OpenMetaverse.Quaternion rotation,
IMesh mesh, PrimitiveBaseShape pbs, bool isPhysical)
{
BulletXPrim newPrim = null;
@@ -680,7 +684,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
//Try to remove garbage
RemoveForgottenRigidBodies();
//End of remove
- MoveAllObjects(timeStep);
+ MoveAPrimitives(timeStep);
fps = (timeStep*simulationSubSteps);
@@ -694,7 +698,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
return fps;
}
- private void MoveAllObjects(float timeStep)
+ private void MoveAPrimitives(float timeStep)
{
foreach (BulletXCharacter actor in _characters.Values)
{
@@ -867,7 +871,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
protected PhysicsVector _velocity;
protected PhysicsVector _size;
protected PhysicsVector _acceleration;
- protected AxiomQuaternion _orientation;
+ protected OpenMetaverse.Quaternion _orientation;
protected PhysicsVector m_rotationalVelocity = PhysicsVector.Zero;
protected RigidBody rigidBody;
protected int m_PhysicsActorType;
@@ -972,7 +976,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
get { return _acceleration; }
}
- public override AxiomQuaternion Orientation
+ public override OpenMetaverse.Quaternion Orientation
{
get { return _orientation; }
set
@@ -1148,10 +1152,10 @@ namespace OpenSim.Region.Physics.BulletXPlugin
ReOrient(_orientation);
}
- protected internal void ReOrient(AxiomQuaternion _newOrient)
+ protected internal void ReOrient(OpenMetaverse.Quaternion _newOrient)
{
Quaternion _newOrientation;
- _newOrientation = BulletXMaths.AxiomQuaternionToXnaQuaternion(_newOrient);
+ _newOrientation = BulletXMaths.QuaternionToXnaQuaternion(_newOrient);
Matrix _comTransform = rigidBody.CenterOfMassTransform;
BulletXMaths.SetRotation(ref _comTransform, _newOrientation);
rigidBody.CenterOfMassTransform = _comTransform;
@@ -1206,12 +1210,12 @@ namespace OpenSim.Region.Physics.BulletXPlugin
public BulletXCharacter(String avName, BulletXScene parent_scene, PhysicsVector pos)
: this(avName, parent_scene, pos, new PhysicsVector(), new PhysicsVector(), new PhysicsVector(),
- AxiomQuaternion.Identity)
+ OpenMetaverse.Quaternion.Identity)
{
}
public BulletXCharacter(String avName, BulletXScene parent_scene, PhysicsVector pos, PhysicsVector velocity,
- PhysicsVector size, PhysicsVector acceleration, AxiomQuaternion orientation)
+ PhysicsVector size, PhysicsVector acceleration, OpenMetaverse.Quaternion orientation)
: base(avName)
{
//This fields will be removed. They're temporal
@@ -1289,7 +1293,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
get { return base.Acceleration; }
}
- public override AxiomQuaternion Orientation
+ public override OpenMetaverse.Quaternion Orientation
{
get { return base.Orientation; }
set { base.Orientation = value; }
@@ -1404,7 +1408,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
public BulletXPrim(String primName, BulletXScene parent_scene, PhysicsVector pos, PhysicsVector size,
- AxiomQuaternion rotation, IMesh mesh, PrimitiveBaseShape pbs, bool isPhysical)
+ OpenMetaverse.Quaternion rotation, IMesh mesh, PrimitiveBaseShape pbs, bool isPhysical)
: this(
primName, parent_scene, pos, new PhysicsVector(), size, new PhysicsVector(), rotation, mesh, pbs,
isPhysical)
@@ -1413,12 +1417,14 @@ namespace OpenSim.Region.Physics.BulletXPlugin
public BulletXPrim(String primName, BulletXScene parent_scene, PhysicsVector pos, PhysicsVector velocity,
PhysicsVector size,
- PhysicsVector acceleration, AxiomQuaternion rotation, IMesh mesh, PrimitiveBaseShape pbs,
+ PhysicsVector acceleration, OpenMetaverse.Quaternion rotation, IMesh mesh, PrimitiveBaseShape pbs,
bool isPhysical)
: base(primName)
{
- if ((size.X == 0) || (size.Y == 0) || (size.Z == 0)) throw new Exception("Size 0");
- if (rotation.Norm == 0f) rotation = AxiomQuaternion.Identity;
+ if ((size.X == 0) || (size.Y == 0) || (size.Z == 0))
+ throw new Exception("Size 0");
+ if (OpenMetaverse.Quaternion.Normalize(rotation).Length() == 0f)
+ rotation = OpenMetaverse.Quaternion.Identity;
_position = pos;
_physical = isPhysical;
@@ -1468,7 +1474,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
get { return base.Acceleration; }
}
- public override AxiomQuaternion Orientation
+ public override OpenMetaverse.Quaternion Orientation
{
get { return base.Orientation; }
set { base.Orientation = value; }
@@ -1565,7 +1571,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
_position = BulletXMaths.XnaVector3ToPhysicsVector(rigidBody.CenterOfMassPosition);
_velocity = BulletXMaths.XnaVector3ToPhysicsVector(rigidBody.LinearVelocity);
- _orientation = BulletXMaths.XnaQuaternionToAxiomQuaternion(rigidBody.Orientation);
+ _orientation = BulletXMaths.XnaQuaternionToQuaternion(rigidBody.Orientation);
if ((Math.Abs(m_prev_position.X - _position.X) < 0.03)
&& (Math.Abs(m_prev_position.Y - _position.Y) < 0.03)
@@ -1687,7 +1693,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
{
private PhysicsVector _staticPosition;
// private PhysicsVector _staticVelocity;
-// private AxiomQuaternion _staticOrientation;
+// private OpenMetaverse.Quaternion _staticOrientation;
private float _mass;
// private BulletXScene _parentscene;
internal float[] _heightField;
@@ -1702,7 +1708,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
{
_staticPosition = new PhysicsVector(BulletXScene.MaxXY/2, BulletXScene.MaxXY/2, 0);
// _staticVelocity = new PhysicsVector();
-// _staticOrientation = AxiomQuaternion.Identity;
+// _staticOrientation = OpenMetaverse.Quaternion.Identity;
_mass = 0; //No active
// _parentscene = parent_scene;
_heightField = heightField;
diff --git a/OpenSim/Region/Physics/Manager/PhysicsActor.cs b/OpenSim/Region/Physics/Manager/PhysicsActor.cs
index d4af271..482b478 100644
--- a/OpenSim/Region/Physics/Manager/PhysicsActor.cs
+++ b/OpenSim/Region/Physics/Manager/PhysicsActor.cs
@@ -27,8 +27,8 @@
using System;
using System.Collections.Generic;
-using Axiom.Math;
using OpenSim.Framework;
+using OpenMetaverse;
namespace OpenSim.Region.Physics.Manager
{
diff --git a/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs b/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs
index 3d9207f..db41251 100644
--- a/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs
+++ b/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs
@@ -115,43 +115,73 @@ namespace OpenSim.Region.Physics.Manager
// that the LoadFrom context be avoided. This can be done by installing assemblies in the
// Global Assembly Cache or in the ApplicationBase directory and using Assembly.
// Load when explicitly loading assemblies.
- Assembly pluginAssembly = Assembly.LoadFrom(FileName);
+ Assembly pluginAssembly = null;
+ Type[] types = null;
- foreach (Type pluginType in pluginAssembly.GetTypes())
+ try
{
- if (pluginType.IsPublic)
- {
- if (!pluginType.IsAbstract)
- {
- Type physTypeInterface = pluginType.GetInterface("IPhysicsPlugin", true);
-
- if (physTypeInterface != null)
- {
- IPhysicsPlugin plug =
- (IPhysicsPlugin) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
- plug.Init();
- if (!_PhysPlugins.ContainsKey(plug.GetName()))
- {
- _PhysPlugins.Add(plug.GetName(), plug);
- m_log.Info("[PHYSICS]: Added physics engine: " + plug.GetName());
- }
- }
+ pluginAssembly = Assembly.LoadFrom(FileName);
+ }
+ catch (Exception ex)
+ {
+ m_log.Error("Failed to load plugin from " + FileName, ex);
+ }
- Type meshTypeInterface = pluginType.GetInterface("IMeshingPlugin", true);
+ if (pluginAssembly != null)
+ {
+ try
+ {
+ types = pluginAssembly.GetTypes();
+ }
+ catch (ReflectionTypeLoadException ex)
+ {
+ m_log.Error("[PHYSICS]: Failed to enumerate types in plugin from " + FileName + ": " +
+ ex.LoaderExceptions[0].Message, ex);
+ }
+ catch (Exception ex)
+ {
+ m_log.Error("[PHYSICS]: Failed to enumerate types in plugin from " + FileName, ex);
+ }
- if (meshTypeInterface != null)
+ if (types != null)
+ {
+ foreach (Type pluginType in types)
+ {
+ if (pluginType.IsPublic)
{
- IMeshingPlugin plug =
- (IMeshingPlugin) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
- if (!_MeshPlugins.ContainsKey(plug.GetName()))
+ if (!pluginType.IsAbstract)
{
- _MeshPlugins.Add(plug.GetName(), plug);
- m_log.Info("[PHYSICS]: Added meshing engine: " + plug.GetName());
+ Type physTypeInterface = pluginType.GetInterface("IPhysicsPlugin", true);
+
+ if (physTypeInterface != null)
+ {
+ IPhysicsPlugin plug =
+ (IPhysicsPlugin)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
+ plug.Init();
+ if (!_PhysPlugins.ContainsKey(plug.GetName()))
+ {
+ _PhysPlugins.Add(plug.GetName(), plug);
+ m_log.Info("[PHYSICS]: Added physics engine: " + plug.GetName());
+ }
+ }
+
+ Type meshTypeInterface = pluginType.GetInterface("IMeshingPlugin", true);
+
+ if (meshTypeInterface != null)
+ {
+ IMeshingPlugin plug =
+ (IMeshingPlugin)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
+ if (!_MeshPlugins.ContainsKey(plug.GetName()))
+ {
+ _MeshPlugins.Add(plug.GetName(), plug);
+ m_log.Info("[PHYSICS]: Added meshing engine: " + plug.GetName());
+ }
+ }
+
+ physTypeInterface = null;
+ meshTypeInterface = null;
}
}
-
- physTypeInterface = null;
- meshTypeInterface = null;
}
}
}
diff --git a/OpenSim/Region/Physics/Manager/PhysicsScene.cs b/OpenSim/Region/Physics/Manager/PhysicsScene.cs
index f9d990b..3575a51 100644
--- a/OpenSim/Region/Physics/Manager/PhysicsScene.cs
+++ b/OpenSim/Region/Physics/Manager/PhysicsScene.cs
@@ -27,10 +27,10 @@
using System.Collections.Generic;
using System.Reflection;
-using Axiom.Math;
using log4net;
using Nini.Config;
using OpenSim.Framework;
+using OpenMetaverse;
namespace OpenSim.Region.Physics.Manager
{
diff --git a/OpenSim/Region/Physics/Manager/PhysicsVector.cs b/OpenSim/Region/Physics/Manager/PhysicsVector.cs
index adf4715..bbd6464 100644
--- a/OpenSim/Region/Physics/Manager/PhysicsVector.cs
+++ b/OpenSim/Region/Physics/Manager/PhysicsVector.cs
@@ -60,7 +60,7 @@ namespace OpenSim.Region.Physics.Manager
}
///
- /// These routines are the easiest way to store XYZ values in an LLVector3 without requiring 3 calls.
+ /// These routines are the easiest way to store XYZ values in an Vector3 without requiring 3 calls.
///
///
public byte[] GetBytes()
diff --git a/OpenSim/Region/Physics/Meshing/Extruder.cs b/OpenSim/Region/Physics/Meshing/Extruder.cs
index a47b6ae..1fc65e3 100644
--- a/OpenSim/Region/Physics/Meshing/Extruder.cs
+++ b/OpenSim/Region/Physics/Meshing/Extruder.cs
@@ -26,6 +26,7 @@
*/
//#define SPAM
+using OpenMetaverse;
using OpenSim.Region.Physics.Manager;
namespace OpenSim.Region.Physics.Meshing
@@ -72,9 +73,6 @@ namespace OpenSim.Region.Physics.Meshing
{
Mesh result = new Mesh();
- // Quaternion tt = new Quaternion();
- // Vertex v2 = new Vertex(0, 0, 0);
-
Mesh newLayer;
Mesh lastLayer = null;
@@ -163,7 +161,7 @@ namespace OpenSim.Region.Physics.Meshing
// apply twist rotation to the profile layer and position the layer in the prim
- Quaternion profileRot = new Quaternion(new Vertex(0.0f, 0.0f, 1.0f), twist);
+ Quaternion profileRot = Quaternion.CreateFromAxisAngle(new Vector3(0.0f, 0.0f, 1.0f), twist);
foreach (Vertex v in newLayer.vertices)
{
if (v != null)
@@ -259,9 +257,6 @@ namespace OpenSim.Region.Physics.Meshing
{
Mesh result = new Mesh();
- // Quaternion tt = new Quaternion();
- // Vertex v2 = new Vertex(0, 0, 0);
-
Mesh newLayer;
Mesh lastLayer = null;
@@ -377,7 +372,7 @@ namespace OpenSim.Region.Physics.Meshing
// next apply twist rotation to the profile layer
if (twistTotal != 0.0f || twistBot != 0.0f)
{
- Quaternion profileRot = new Quaternion(new Vertex(0.0f, 0.0f, 1.0f), twist);
+ Quaternion profileRot = new Quaternion(new Vector3(0.0f, 0.0f, 1.0f), twist);
foreach (Vertex v in newLayer.vertices)
{
if (v != null)
@@ -392,7 +387,7 @@ namespace OpenSim.Region.Physics.Meshing
// now orient the rotation of the profile layer relative to it's position on the path
// adding pushY to the angle used to generate the quat appears to approximate the viewer
- Quaternion layerRot = new Quaternion(new Vertex(1.0f, 0.0f, 0.0f), (float)angle + pushY * 0.9f);
+ Quaternion layerRot = Quaternion.CreateFromAxisAngle(new Vector3(1.0f, 0.0f, 0.0f), (float)angle + pushY * 0.9f);
foreach (Vertex v in newLayer.vertices)
{
if (v != null)
diff --git a/OpenSim/Region/Physics/Meshing/HelperTypes.cs b/OpenSim/Region/Physics/Meshing/HelperTypes.cs
index 2cb8d04..7491782 100644
--- a/OpenSim/Region/Physics/Meshing/HelperTypes.cs
+++ b/OpenSim/Region/Physics/Meshing/HelperTypes.cs
@@ -29,70 +29,10 @@ using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
+using OpenMetaverse;
using OpenSim.Region.Physics.Manager;
using OpenSim.Region.Physics.Meshing;
-public class Quaternion
-{
- public float x = 0;
- public float y = 0;
- public float z = 0;
- public float w = 1;
-
- public Quaternion()
- {
-
- }
- public Quaternion(float x1, float y1, float z1, float w1)
- {
- x = x1; y = y1; z = z1; w = w1;
- }
- public Quaternion(Vertex axis, float angle)
- {
- // using (* 0.5) instead of (/2)
- w = (float)Math.Cos(angle * 0.5f);
- float sin = (float)Math.Sin(angle * 0.5f);
- //x = axis.X * (float)Math.Sin(angle * 0.5f);
- //y = axis.Y * (float)Math.Sin(angle * 0.5f);
- //z = axis.Z * (float)Math.Sin(angle * 0.5f);
- x = axis.X * sin;
- y = axis.Y * sin;
- z = axis.Z * sin;
- normalize();
- }
- public static Quaternion operator *(Quaternion a, Quaternion b)
- {
- Quaternion c = new Quaternion();
- c.x = a.w * b.x + a.x * b.w + a.y * b.z - a.z * b.y;
- c.y = a.w * b.y + a.y * b.w + a.z * b.x - a.x * b.z;
- c.z = a.w * b.z + a.z * b.w + a.x * b.y - a.y * b.x;
- c.w = a.w * b.w - a.x * b.x - a.y * b.y - a.z * b.z;
- return c;
- }
-
- public void normalize()
- {
- //float mag = length();
-
- //w /= mag;
- //x /= mag;
- //y /= mag;
- //z /= mag;
- float iMag = 1.0f / length();
-
- w *= iMag;
- x *= iMag;
- y *= iMag;
- z *= iMag;
- }
- public float length()
- {
- return (float)Math.Sqrt(w * w + x * x + y * y + z * z);
- }
-}
-
-
-
public class Vertex : PhysicsVector, IComparable
{
public Vertex(float x, float y, float z)
@@ -129,34 +69,34 @@ public class Vertex : PhysicsVector, IComparable
Vertex v2 = new Vertex(0f, 0f, 0f);
- v2.X = q.w * q.w * v.X +
- 2f * q.y * q.w * v.Z -
- 2f * q.z * q.w * v.Y +
- q.x * q.x * v.X +
- 2f * q.y * q.x * v.Y +
- 2f * q.z * q.x * v.Z -
- q.z * q.z * v.X -
- q.y * q.y * v.X;
+ v2.X = q.W * q.W * v.X +
+ 2f * q.Y * q.W * v.Z -
+ 2f * q.Z * q.W * v.Y +
+ q.X * q.X * v.X +
+ 2f * q.Y * q.X * v.Y +
+ 2f * q.Z * q.X * v.Z -
+ q.Z * q.Z * v.X -
+ q.Y * q.Y * v.X;
v2.Y =
- 2f * q.x * q.y * v.X +
- q.y * q.y * v.Y +
- 2f * q.z * q.y * v.Z +
- 2f * q.w * q.z * v.X -
- q.z * q.z * v.Y +
- q.w * q.w * v.Y -
- 2f * q.x * q.w * v.Z -
- q.x * q.x * v.Y;
+ 2f * q.X * q.Y * v.X +
+ q.Y * q.Y * v.Y +
+ 2f * q.Z * q.Y * v.Z +
+ 2f * q.W * q.Z * v.X -
+ q.Z * q.Z * v.Y +
+ q.W * q.W * v.Y -
+ 2f * q.X * q.W * v.Z -
+ q.X * q.X * v.Y;
v2.Z =
- 2f * q.x * q.z * v.X +
- 2f * q.y * q.z * v.Y +
- q.z * q.z * v.Z -
- 2f * q.w * q.y * v.X -
- q.y * q.y * v.Z +
- 2f * q.w * q.x * v.Y -
- q.x * q.x * v.Z +
- q.w * q.w * v.Z;
+ 2f * q.X * q.Z * v.X +
+ 2f * q.Y * q.Z * v.Y +
+ q.Z * q.Z * v.Z -
+ 2f * q.W * q.Y * v.X -
+ q.Y * q.Y * v.Z +
+ 2f * q.W * q.X * v.Y -
+ q.X * q.X * v.Z +
+ q.W * q.W * v.Z;
return v2;
}
diff --git a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs
index ecde92a..f955c52 100644
--- a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs
+++ b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs
@@ -30,6 +30,7 @@ using System;
using System.Collections.Generic;
using OpenSim.Framework;
using OpenSim.Region.Physics.Manager;
+using OpenMetaverse;
namespace OpenSim.Region.Physics.Meshing
{
@@ -1559,7 +1560,7 @@ namespace OpenSim.Region.Physics.Meshing
if ((primShape.ProfileCurve & 0x07) == (byte)ProfileShape.Circle)
{
- Quaternion zFlip = new Quaternion(new Vertex(0.0f, 0.0f, 1.0f), (float)Math.PI);
+ Quaternion zFlip = Quaternion.CreateFromAxisAngle(new Vector3(0.0f, 0.0f, 1.0f), (float)Math.PI);
Vertex vTmp = new Vertex(0.0f, 0.0f, 0.0f);
foreach (Vertex v in cuttedHull.getVertices())
if (v != null)
diff --git a/OpenSim/Region/Physics/Meshing/PrimMesher.cs b/OpenSim/Region/Physics/Meshing/PrimMesher.cs
index 86bdabc..08b2d10 100644
--- a/OpenSim/Region/Physics/Meshing/PrimMesher.cs
+++ b/OpenSim/Region/Physics/Meshing/PrimMesher.cs
@@ -29,6 +29,7 @@ using System;
using System.Collections.Generic;
using System.IO;
using OpenSim.Region.Physics.Manager;
+using OpenMetaverse;
namespace OpenSim.Region.Physics.Meshing
{
@@ -783,7 +784,7 @@ angles24 = [
Profile profile = new Profile(this.sides, this.profileStart, this.profileEnd, hollow, this.hollowSides);
if (initialProfileRot != 0.0f)
- profile.AddRot(new Quaternion(new Vertex(0.0f, 0.0f, 1.0f), initialProfileRot));
+ profile.AddRot(Quaternion.CreateFromAxisAngle(new Vector3(0.0f, 0.0f, 1.0f), initialProfileRot));
bool done = false;
while (!done)
@@ -807,7 +808,7 @@ angles24 = [
float twist = twistBegin + twistTotal * percentOfPath;
if (twist != 0.0f)
- newLayer.AddRot(new Quaternion(new Vertex(0.0f, 0.0f, 1.0f), twist));
+ newLayer.AddRot(Quaternion.CreateFromAxisAngle(new Vector3(0.0f, 0.0f, 1.0f), twist));
newLayer.AddPos(xOffset, yOffset, zOffset);
@@ -948,7 +949,7 @@ angles24 = [
Profile profile = new Profile(this.sides, this.profileStart, this.profileEnd, hollow, this.hollowSides);
if (initialProfileRot != 0.0f)
- profile.AddRot(new Quaternion(new Vertex(0.0f, 0.0f, 1.0f), initialProfileRot));
+ profile.AddRot(Quaternion.CreateFromAxisAngle(new Vector3(0.0f, 0.0f, 1.0f), initialProfileRot));
bool done = false;
while (!done) // loop through the length of the path and add the layers
@@ -991,12 +992,12 @@ angles24 = [
// next apply twist rotation to the profile layer
if (twistTotal != 0.0f || twistBegin != 0.0f)
- newLayer.AddRot(new Quaternion(new Vertex(0.0f, 0.0f, 1.0f), twist));
+ newLayer.AddRot(Quaternion.CreateFromAxisAngle(new Vector3(0.0f, 0.0f, 1.0f), twist));
// now orient the rotation of the profile layer relative to it's position on the path
// adding taperY to the angle used to generate the quat appears to approximate the viewer
//newLayer.AddRot(new Quaternion(new Vertex(1.0f, 0.0f, 0.0f), angle + this.topShearY * 0.9f));
- newLayer.AddRot(new Quaternion(new Vertex(1.0f, 0.0f, 0.0f), angle + this.topShearY));
+ newLayer.AddRot(Quaternion.CreateFromAxisAngle(new Vector3(1.0f, 0.0f, 0.0f), angle + this.topShearY));
newLayer.AddPos(xOffset, yOffset, zOffset);
if (angle == startAngle)
diff --git a/OpenSim/Region/Physics/Meshing/SculptMesh.cs b/OpenSim/Region/Physics/Meshing/SculptMesh.cs
index 360b2f7..707c0e3 100644
--- a/OpenSim/Region/Physics/Meshing/SculptMesh.cs
+++ b/OpenSim/Region/Physics/Meshing/SculptMesh.cs
@@ -30,14 +30,14 @@ using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Imaging;
using System.Text;
-using OpenJPEGNet;
-using Image = System.Drawing.Image;
+using OpenMetaverse.Imaging;
namespace OpenSim.Region.Physics.Meshing
{
// This functionality based on the XNA SculptPreview by John Hurliman.
public class SculptMesh : Mesh
{
+ ManagedImage managedImage;
Image idata = null;
Bitmap bLOD = null;
Bitmap bBitmap = null;
@@ -55,7 +55,7 @@ namespace OpenSim.Region.Physics.Meshing
try
{
- idata = OpenJPEG.DecodeToImage(jpegData);
+ OpenJPEG.DecodeToImage(jpegData, out managedImage, out idata);
//int i = 0;
//i = i / i;
}
@@ -64,6 +64,7 @@ namespace OpenSim.Region.Physics.Meshing
System.Console.WriteLine("[PHYSICS]: Unable to generate a Sculpty physics proxy. Sculpty texture decode failed!");
return;
}
+
if (idata != null)
{
bBitmap = new Bitmap(idata);
diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
index 5d3e986..38d4060 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
@@ -26,7 +26,7 @@
*/
using System;
-using Axiom.Math;
+using OpenMetaverse;
using Ode.NET;
using OpenSim.Framework;
using OpenSim.Region.Physics.Manager;
@@ -587,7 +587,6 @@ namespace OpenSim.Region.Physics.OdePlugin
//Matrix3 or = Orientation.ToRotationMatrix();
//d.Matrix3 ord = new d.Matrix3(or.m00, or.m10, or.m20, or.m01, or.m11, or.m21, or.m02, or.m12, or.m22);
//d.BodySetRotation(Body, ref ord);
-
}
}
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
index eafce5a..21e514b 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
@@ -30,8 +30,8 @@ using System.Collections.Generic;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Threading;
-using Axiom.Math;
using log4net;
+using OpenMetaverse;
using Ode.NET;
using OpenSim.Framework;
using OpenSim.Region.Physics.Manager;
@@ -294,10 +294,10 @@ namespace OpenSim.Region.Physics.OdePlugin
setMass();
d.BodySetPosition(Body, _position.X, _position.Y, _position.Z);
d.Quaternion myrot = new d.Quaternion();
- myrot.W = _orientation.w;
- myrot.X = _orientation.x;
- myrot.Y = _orientation.y;
- myrot.Z = _orientation.z;
+ myrot.X = _orientation.X;
+ myrot.Y = _orientation.Y;
+ myrot.Z = _orientation.Z;
+ myrot.W = _orientation.W;
d.BodySetQuaternion(Body, ref myrot);
d.GeomSetBody(prim_geom, Body);
m_collisionCategories |= CollisionCategories.Body;
@@ -1021,10 +1021,10 @@ namespace OpenSim.Region.Physics.OdePlugin
{
d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z);
d.Quaternion myrot = new d.Quaternion();
- myrot.W = _orientation.w;
- myrot.X = _orientation.x;
- myrot.Y = _orientation.y;
- myrot.Z = _orientation.z;
+ myrot.X = _orientation.X;
+ myrot.Y = _orientation.Y;
+ myrot.Z = _orientation.Z;
+ myrot.W = _orientation.W;
d.GeomSetQuaternion(prim_geom, ref myrot);
}
@@ -1220,10 +1220,10 @@ namespace OpenSim.Region.Physics.OdePlugin
public void rotate(float timestep)
{
d.Quaternion myrot = new d.Quaternion();
- myrot.W = _orientation.w;
- myrot.X = _orientation.x;
- myrot.Y = _orientation.y;
- myrot.Z = _orientation.z;
+ myrot.X = _orientation.X;
+ myrot.Y = _orientation.Y;
+ myrot.Z = _orientation.Z;
+ myrot.W = _orientation.W;
d.GeomSetQuaternion(prim_geom, ref myrot);
if (m_isphysical && Body != (IntPtr) 0)
{
@@ -1339,10 +1339,10 @@ namespace OpenSim.Region.Physics.OdePlugin
setMesh(_parent_scene, mesh);
d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z);
d.Quaternion myrot = new d.Quaternion();
- myrot.W = _orientation.w;
- myrot.X = _orientation.x;
- myrot.Y = _orientation.y;
- myrot.Z = _orientation.z;
+ myrot.X = _orientation.X;
+ myrot.Y = _orientation.Y;
+ myrot.Z = _orientation.Z;
+ myrot.W = _orientation.W;
d.GeomSetQuaternion(prim_geom, ref myrot);
//d.GeomBoxSetLengths(prim_geom, _size.X, _size.Y, _size.Z);
@@ -1388,10 +1388,10 @@ namespace OpenSim.Region.Physics.OdePlugin
//prim_geom = d.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z);
d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z);
d.Quaternion myrot = new d.Quaternion();
- myrot.W = _orientation.w;
- myrot.X = _orientation.x;
- myrot.Y = _orientation.y;
- myrot.Z = _orientation.z;
+ myrot.X = _orientation.X;
+ myrot.Y = _orientation.Y;
+ myrot.Z = _orientation.Z;
+ myrot.W = _orientation.W;
d.GeomSetQuaternion(prim_geom, ref myrot);
}
}
@@ -1452,9 +1452,9 @@ namespace OpenSim.Region.Physics.OdePlugin
// d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z);
// d.Quaternion myrot = new d.Quaternion();
// myrot.W = _orientation.w;
- // myrot.X = _orientation.x;
- // myrot.Y = _orientation.y;
- // myrot.Z = _orientation.z;
+ // myrot.X = _orientation.X;
+ // myrot.Y = _orientation.Y;
+ // myrot.Z = _orientation.Z;
// d.GeomSetQuaternion(prim_geom, ref myrot);
// //d.GeomBoxSetLengths(prim_geom, _size.X, _size.Y, _size.Z);
@@ -1512,9 +1512,9 @@ namespace OpenSim.Region.Physics.OdePlugin
// d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z);
// d.Quaternion myrot = new d.Quaternion();
// myrot.W = _orientation.w;
- // myrot.X = _orientation.x;
- // myrot.Y = _orientation.y;
- // myrot.Z = _orientation.z;
+ // myrot.X = _orientation.X;
+ // myrot.Y = _orientation.Y;
+ // myrot.Z = _orientation.Z;
// d.GeomSetQuaternion(prim_geom, ref myrot);
// }
// }
@@ -1553,9 +1553,9 @@ namespace OpenSim.Region.Physics.OdePlugin
// d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z);
// d.Quaternion myrot = new d.Quaternion();
// myrot.W = _orientation.w;
- // myrot.X = _orientation.x;
- // myrot.Y = _orientation.y;
- // myrot.Z = _orientation.z;
+ // myrot.X = _orientation.X;
+ // myrot.Y = _orientation.Y;
+ // myrot.Z = _orientation.Z;
// d.GeomSetQuaternion(prim_geom, ref myrot);
// //d.GeomBoxSetLengths(prim_geom, _size.X, _size.Y, _size.Z);
@@ -1626,10 +1626,10 @@ namespace OpenSim.Region.Physics.OdePlugin
setMesh(_parent_scene, mesh);
d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z);
d.Quaternion myrot = new d.Quaternion();
- myrot.W = _orientation.w;
- myrot.X = _orientation.x;
- myrot.Y = _orientation.y;
- myrot.Z = _orientation.z;
+ myrot.X = _orientation.X;
+ myrot.Y = _orientation.Y;
+ myrot.Z = _orientation.Z;
+ myrot.W = _orientation.W;
d.GeomSetQuaternion(prim_geom, ref myrot);
//d.GeomBoxSetLengths(prim_geom, _size.X, _size.Y, _size.Z);
@@ -1684,10 +1684,10 @@ namespace OpenSim.Region.Physics.OdePlugin
//prim_geom = d.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z);
d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z);
d.Quaternion myrot = new d.Quaternion();
- myrot.W = _orientation.w;
- myrot.X = _orientation.x;
- myrot.Y = _orientation.y;
- myrot.Z = _orientation.z;
+ myrot.X = _orientation.X;
+ myrot.Y = _orientation.Y;
+ myrot.Z = _orientation.Z;
+ myrot.W = _orientation.W;
d.GeomSetQuaternion(prim_geom, ref myrot);
}
}
@@ -1726,9 +1726,9 @@ namespace OpenSim.Region.Physics.OdePlugin
// d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z);
// d.Quaternion myrot = new d.Quaternion();
// myrot.W = _orientation.w;
- // myrot.X = _orientation.x;
- // myrot.Y = _orientation.y;
- // myrot.Z = _orientation.z;
+ // myrot.X = _orientation.X;
+ // myrot.Y = _orientation.Y;
+ // myrot.Z = _orientation.Z;
// d.GeomSetQuaternion(prim_geom, ref myrot);
// //d.GeomBoxSetLengths(prim_geom, _size.X, _size.Y, _size.Z);
@@ -2106,9 +2106,9 @@ namespace OpenSim.Region.Physics.OdePlugin
_acceleration.Z = 0;
//_orientation.w = 0f;
- //_orientation.x = 0f;
- //_orientation.y = 0f;
- //_orientation.z = 0f;
+ //_orientation.X = 0f;
+ //_orientation.Y = 0f;
+ //_orientation.Z = 0f;
m_rotationalVelocity.X = 0;
m_rotationalVelocity.Y = 0;
m_rotationalVelocity.Z = 0;
@@ -2154,10 +2154,10 @@ namespace OpenSim.Region.Physics.OdePlugin
}
//System.Console.WriteLine("ODE: " + m_rotationalVelocity.ToString());
- _orientation.w = ori.W;
- _orientation.x = ori.X;
- _orientation.y = ori.Y;
- _orientation.z = ori.Z;
+ _orientation.X = ori.X;
+ _orientation.Y = ori.Y;
+ _orientation.Z = ori.Z;
+ _orientation.W = ori.W;
m_lastUpdateSent = false;
if (!m_throttleUpdates || throttleCounter > _parent_scene.geomUpdatesPerThrottledUpdate)
{
diff --git a/OpenSim/Region/Physics/OdePlugin/ODETestClass.cs b/OpenSim/Region/Physics/OdePlugin/ODETestClass.cs
index 074170a..606134a 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODETestClass.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODETestClass.cs
@@ -26,9 +26,9 @@
*/
using System;
-using Axiom.Math;
using Nini.Config;
using NUnit.Framework;
+using OpenMetaverse;
using OpenSim.Framework;
using OpenSim.Region.Physics.Manager;
@@ -74,7 +74,7 @@ namespace OpenSim.Region.Physics.OdePlugin
PrimitiveBaseShape newcube = PrimitiveBaseShape.CreateBox();
PhysicsVector position = new PhysicsVector(128, 128, 128);
PhysicsVector size = new PhysicsVector(0.5f, 0.5f, 0.5f);
- Quaternion rot = new Quaternion(1, 0, 0, 0);
+ Quaternion rot = Quaternion.Identity;
PhysicsActor prim = ps.AddPrimShape("CoolShape", newcube, position, size, rot, true);
OdePrim oprim = (OdePrim)prim;
OdeScene pscene = (OdeScene) ps;
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
index f285911..5a501ef 100644
--- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
+++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
@@ -31,13 +31,12 @@ using System.Reflection;
using System.Runtime.InteropServices;
using System.Threading;
using System.IO;
-using Axiom.Math;
using log4net;
using Nini.Config;
using Ode.NET;
using OpenSim.Framework;
using OpenSim.Region.Physics.Manager;
-using libsecondlife;
+using OpenMetaverse;
//using OpenSim.Region.Physics.OdePlugin.Meshing;
@@ -1129,11 +1128,7 @@ namespace OpenSim.Region.Physics.OdePlugin
siz.X = size.X;
siz.Y = size.Y;
siz.Z = size.Z;
- Quaternion rot = new Quaternion();
- rot.w = rotation.w;
- rot.x = rotation.x;
- rot.y = rotation.y;
- rot.z = rotation.z;
+ Quaternion rot = rotation;
OdePrim newPrim;
lock (OdeLock)
@@ -1524,8 +1519,8 @@ namespace OpenSim.Region.Physics.OdePlugin
// but we still need to check for sculptie meshing being enabled so this is the most
// convenient place to do it for now...
- // //if (pbs.PathCurve == (byte)LLObject.PathCurve.Circle && pbs.ProfileCurve == (byte)LLObject.ProfileCurve.Circle && pbs.PathScaleY <= 0.75f)
- // //Console.WriteLine("needsMeshing: " + " pathCurve: " + pbs.PathCurve.ToString() + " profileCurve: " + pbs.ProfileCurve.ToString() + " pathScaleY: " + LLObject.UnpackPathScale(pbs.PathScaleY).ToString());
+ // //if (pbs.PathCurve == (byte)Primitive.PathCurve.Circle && pbs.ProfileCurve == (byte)Primitive.ProfileCurve.Circle && pbs.PathScaleY <= 0.75f)
+ // //Console.WriteLine("needsMeshing: " + " pathCurve: " + pbs.PathCurve.ToString() + " profileCurve: " + pbs.ProfileCurve.ToString() + " pathScaleY: " + Primitive.UnpackPathScale(pbs.PathScaleY).ToString());
if (pbs.SculptEntry && !meshSculptedPrim)
{
return false;
@@ -1555,19 +1550,19 @@ namespace OpenSim.Region.Physics.OdePlugin
// return true;
// // test for torus
- // if (pbs.PathCurve == (byte)LLObject.PathCurve.Circle
- // && (pbs.ProfileCurve & 0x07) == (byte)LLObject.ProfileCurve.Circle
- // && LLObject.UnpackPathScale(pbs.PathScaleY) <= 0.75f)
+ // if (pbs.PathCurve == (byte)Primitive.PathCurve.Circle
+ // && (pbs.ProfileCurve & 0x07) == (byte)Primitive.ProfileCurve.Circle
+ // && Primitive.UnpackPathScale(pbs.PathScaleY) <= 0.75f)
// return true;
// // test for tube
- // if (pbs.PathCurve == (byte)LLObject.PathCurve.Circle
- // && (pbs.ProfileCurve & 0x07) == (byte)LLObject.ProfileCurve.EqualTriangle)
+ // if (pbs.PathCurve == (byte)Primitive.PathCurve.Circle
+ // && (pbs.ProfileCurve & 0x07) == (byte)Primitive.ProfileCurve.EqualTriangle)
// return true;
// // test for ring
- // if (pbs.PathCurve == (byte)LLObject.PathCurve.Circle
- // && (pbs.ProfileCurve & 0x07) == (byte)LLObject.ProfileCurve.EqualTriangle)
+ // if (pbs.PathCurve == (byte)Primitive.PathCurve.Circle
+ // && (pbs.ProfileCurve & 0x07) == (byte)Primitive.ProfileCurve.EqualTriangle)
// return true;
// if (pbs.ProfileShape == ProfileShape.EquilateralTriangle)
@@ -2132,17 +2127,17 @@ namespace OpenSim.Region.Physics.OdePlugin
d.Matrix3 R = new d.Matrix3();
- Quaternion q1 = Quaternion.FromAngleAxis(1.5707f, new Vector3(1, 0, 0));
- Quaternion q2 = Quaternion.FromAngleAxis(1.5707f, new Vector3(0, 1, 0));
+ Quaternion q1 = Quaternion.CreateFromAxisAngle(new Vector3(1, 0, 0), 1.5707f);
+ Quaternion q2 = Quaternion.CreateFromAxisAngle(new Vector3(0, 1, 0), 1.5707f);
//Axiom.Math.Quaternion q3 = Axiom.Math.Quaternion.FromAngleAxis(3.14f, new Axiom.Math.Vector3(0, 0, 1));
q1 = q1*q2;
//q1 = q1 * q3;
- Vector3 v3 = new Vector3();
- float angle = 0;
- q1.ToAngleAxis(ref angle, ref v3);
+ Vector3 v3;
+ float angle;
+ q1.GetAxisAngle(out v3, out angle);
- d.RFromAxisAndAngle(out R, v3.x, v3.y, v3.z, angle);
+ d.RFromAxisAndAngle(out R, v3.X, v3.Y, v3.Z, angle);
d.GeomSetRotation(LandGeom, ref R);
d.GeomSetPosition(LandGeom, 128, 128, 0);
}
@@ -2197,17 +2192,17 @@ namespace OpenSim.Region.Physics.OdePlugin
d.Matrix3 R = new d.Matrix3();
- Quaternion q1 = Quaternion.FromAngleAxis(1.5707f, new Vector3(1, 0, 0));
- Quaternion q2 = Quaternion.FromAngleAxis(1.5707f, new Vector3(0, 1, 0));
+ Quaternion q1 = Quaternion.CreateFromAxisAngle(new Vector3(1, 0, 0), 1.5707f);
+ Quaternion q2 = Quaternion.CreateFromAxisAngle(new Vector3(0, 1, 0), 1.5707f);
//Axiom.Math.Quaternion q3 = Axiom.Math.Quaternion.FromAngleAxis(3.14f, new Axiom.Math.Vector3(0, 0, 1));
q1 = q1 * q2;
//q1 = q1 * q3;
- Vector3 v3 = new Vector3();
- float angle = 0;
- q1.ToAngleAxis(ref angle, ref v3);
+ Vector3 v3;
+ float angle;
+ q1.GetAxisAngle(out v3, out angle);
- d.RFromAxisAndAngle(out R, v3.x, v3.y, v3.z, angle);
+ d.RFromAxisAndAngle(out R, v3.X, v3.Y, v3.Z, angle);
d.GeomSetRotation(WaterGeom, ref R);
d.GeomSetPosition(WaterGeom, 128, 128, 0);
}
diff --git a/OpenSim/Region/Physics/POSPlugin/POSCharacter.cs b/OpenSim/Region/Physics/POSPlugin/POSCharacter.cs
index c674d15..400280f 100644
--- a/OpenSim/Region/Physics/POSPlugin/POSCharacter.cs
+++ b/OpenSim/Region/Physics/POSPlugin/POSCharacter.cs
@@ -27,8 +27,8 @@
using System;
using System.Collections.Generic;
-using Axiom.Math;
using Nini.Config;
+using OpenMetaverse;
using OpenSim.Framework;
using OpenSim.Region.Physics.Manager;
diff --git a/OpenSim/Region/Physics/POSPlugin/POSPlugin.cs b/OpenSim/Region/Physics/POSPlugin/POSPlugin.cs
index 65f10f9..c8cbcf5 100644
--- a/OpenSim/Region/Physics/POSPlugin/POSPlugin.cs
+++ b/OpenSim/Region/Physics/POSPlugin/POSPlugin.cs
@@ -27,7 +27,6 @@
using System;
using System.Collections.Generic;
-using Axiom.Math;
using Nini.Config;
using OpenSim.Framework;
using OpenSim.Region.Physics.Manager;
diff --git a/OpenSim/Region/Physics/POSPlugin/POSPrim.cs b/OpenSim/Region/Physics/POSPlugin/POSPrim.cs
index fed67dd..69cd19c 100644
--- a/OpenSim/Region/Physics/POSPlugin/POSPrim.cs
+++ b/OpenSim/Region/Physics/POSPlugin/POSPrim.cs
@@ -27,8 +27,8 @@
using System;
using System.Collections.Generic;
-using Axiom.Math;
using Nini.Config;
+using OpenMetaverse;
using OpenSim.Framework;
using OpenSim.Region.Physics.Manager;
diff --git a/OpenSim/Region/Physics/POSPlugin/POSScene.cs b/OpenSim/Region/Physics/POSPlugin/POSScene.cs
index a32021d..9771a62 100644
--- a/OpenSim/Region/Physics/POSPlugin/POSScene.cs
+++ b/OpenSim/Region/Physics/POSPlugin/POSScene.cs
@@ -27,8 +27,8 @@
using System;
using System.Collections.Generic;
-using Axiom.Math;
using Nini.Config;
+using OpenMetaverse;
using OpenSim.Framework;
using OpenSim.Region.Physics.Manager;
@@ -109,14 +109,13 @@ namespace OpenSim.Region.Physics.POSPlugin
private bool isColliding(POSCharacter c, POSPrim p)
{
- Vector3 rotatedPos = p.Orientation.Inverse() *
- new Vector3(c.Position.X - p.Position.X, c.Position.Y - p.Position.Y,
- c.Position.Z - p.Position.Z);
- Vector3 avatarSize = p.Orientation.Inverse()*new Vector3(c.Size.X, c.Size.Y, c.Size.Z);
-
- if (Math.Abs(rotatedPos.x) >= (p.Size.X*0.5 + Math.Abs(avatarSize.x)) ||
- Math.Abs(rotatedPos.y) >= (p.Size.Y*0.5 + Math.Abs(avatarSize.y)) ||
- Math.Abs(rotatedPos.z) >= (p.Size.Z*0.5 + Math.Abs(avatarSize.z)))
+ Vector3 rotatedPos = new Vector3(c.Position.X - p.Position.X, c.Position.Y - p.Position.Y,
+ c.Position.Z - p.Position.Z) * Quaternion.Inverse(p.Orientation);
+ Vector3 avatarSize = new Vector3(c.Size.X, c.Size.Y, c.Size.Z) * Quaternion.Inverse(p.Orientation);
+
+ if (Math.Abs(rotatedPos.X) >= (p.Size.X*0.5 + Math.Abs(avatarSize.X)) ||
+ Math.Abs(rotatedPos.Y) >= (p.Size.Y*0.5 + Math.Abs(avatarSize.Y)) ||
+ Math.Abs(rotatedPos.Z) >= (p.Size.Z*0.5 + Math.Abs(avatarSize.Z)))
{
return false;
}
diff --git a/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs b/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs
index 197da0a..37e2a2f 100644
--- a/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs
+++ b/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs
@@ -31,7 +31,7 @@ using Nini.Config;
using OpenSim.Framework;
using OpenSim.Region.Physics.Manager;
using PhysXWrapper;
-using Quaternion=Axiom.Math.Quaternion;
+using Quaternion=OpenMetaverse.Quaternion;
namespace OpenSim.Region.Physics.PhysXPlugin
{
@@ -614,12 +614,12 @@ namespace OpenSim.Region.Physics.PhysXPlugin
{
get
{
- Quaternion res = new Quaternion();
+ Quaternion res;
PhysXWrapper.Quaternion quat = _prim.GetOrientation();
- res.w = quat.W;
- res.x = quat.X;
- res.y = quat.Y;
- res.z = quat.Z;
+ res.W = quat.W;
+ res.X = quat.X;
+ res.Y = quat.Y;
+ res.Z = quat.Z;
return res;
}
set { }
--
cgit v1.1