diff --git a/importprimscript/importprimscript.cs b/importprimscript/importprimscript.cs index 497c820f..d006ab48 100644 --- a/importprimscript/importprimscript.cs +++ b/importprimscript/importprimscript.cs @@ -152,7 +152,7 @@ namespace importprimscript volume.Material = LLObject.MaterialType.Wood; volume.PathScaleY = 0.5f; volume.PathCurve = LLObject.PathCurve.Circle; - volume.ProfileCurve = LLObject.ProfileCurve.ProfileCircle; + volume.ProfileCurve = LLObject.ProfileCurve.Circle; // Rez this prim CurrentSculpt = sculpties[i]; diff --git a/libsecondlife/NetworkManager.cs b/libsecondlife/NetworkManager.cs index 8e2b8392..695cf230 100644 --- a/libsecondlife/NetworkManager.cs +++ b/libsecondlife/NetworkManager.cs @@ -559,7 +559,7 @@ namespace libsecondlife } // Clear out all of the packets that never had time to process - lock (PacketInbox) PacketInbox.Clear(); + PacketInbox.Close(); connected = false; diff --git a/libsecondlife/ObjectManager.cs b/libsecondlife/ObjectManager.cs index 9e2fca46..0f36e9c7 100644 --- a/libsecondlife/ObjectManager.cs +++ b/libsecondlife/ObjectManager.cs @@ -2208,9 +2208,11 @@ namespace libsecondlife prim.Material = LLObject.MaterialType.Wood; prim.ProfileCurve = LLObject.ProfileCurve.Square; prim.PathCurve = LLObject.PathCurve.Line; - prim.ProfileEnd = 1.0f; - prim.PathEnd = 1.0f; - prim.PathRevolutions = 1.0f; + prim.ProfileEnd = 1f; + prim.PathEnd = 1f; + prim.PathScaleX = 1f; + prim.PathScaleY = 1f; + prim.PathRevolutions = 1f; return prim; } diff --git a/libsecondlife/Types.cs b/libsecondlife/Types.cs index 7f8e6469..43299c38 100644 --- a/libsecondlife/Types.cs +++ b/libsecondlife/Types.cs @@ -719,7 +719,13 @@ namespace libsecondlife LLVector3 axis = Norm(crossProduct); float s = (float)Math.Sin(angle / 2); - return new LLQuaternion(axis.X * s, axis.Y * s, axis.Z * s, (float)Math.Cos(angle / 2)); + LLQuaternion quat = new LLQuaternion(); + quat.X = axis.X * s; + quat.Y = axis.Y * s; + quat.Z = axis.Z * s; + quat.W = (float)Math.Cos(angle / 2); + + return quat; } /// @@ -811,23 +817,11 @@ namespace libsecondlife #region Operators - /// - /// - /// - /// - /// - /// public static bool operator==(LLVector3 lhs, LLVector3 rhs) { return (lhs.X == rhs.X && lhs.Y == rhs.Y && lhs.Z == rhs.Z); } - /// - /// - /// - /// - /// - /// public static bool operator!=(LLVector3 lhs, LLVector3 rhs) { return !(lhs == rhs); @@ -838,58 +832,38 @@ namespace libsecondlife return new LLVector3(lhs.X + rhs.X, lhs.Y + rhs.Y, lhs.Z + rhs.Z); } - /// - /// - /// - /// - /// - /// public static LLVector3 operator -(LLVector3 lhs, LLVector3 rhs) { return new LLVector3(lhs.X - rhs.X,lhs.Y - rhs.Y, lhs.Z - rhs.Z); } - /// - /// - /// - /// - /// - /// public static LLVector3 operator *(LLVector3 vec, float val) { return new LLVector3(vec.X * val, vec.Y * val, vec.Z * val); } - /// - /// - /// - /// - /// - /// public static LLVector3 operator *(float val, LLVector3 vec) { return new LLVector3(vec.X * val, vec.Y * val, vec.Z * val); } - /// - /// - /// - /// - /// - /// public static LLVector3 operator *(LLVector3 lhs, LLVector3 rhs) { return new LLVector3(lhs.X * rhs.X, lhs.Y * rhs.Y, lhs.Z * rhs.Z); } - public static LLVector3 operator *(LLVector3 vec, LLQuaternion quat) + public static LLVector3 operator *(LLVector3 vec, LLQuaternion rot) { - LLQuaternion vq = new LLQuaternion(vec.X, vec.Y, vec.Z, 0); - LLQuaternion nq = new LLQuaternion(-quat.X, -quat.Y, -quat.Z, quat.W); + float rw = -rot.X * vec.X - rot.Y * vec.Y - rot.Z * vec.Z; + float rx = rot.W * vec.X + rot.Y * vec.Z - rot.Z * vec.Y; + float ry = rot.W * vec.Y + rot.Z * vec.X - rot.X * vec.Z; + float rz = rot.W * vec.Z + rot.X * vec.Y - rot.Y * vec.X; - LLQuaternion result = (quat * vq) * nq; + float nx = -rw * rot.X + rx * rot.W - ry * rot.Z + rz * rot.Y; + float ny = -rw * rot.Y + ry * rot.W - rz * rot.X + rx * rot.Z; + float nz = -rw * rot.Z + rz * rot.W - rx * rot.Y + ry * rot.X; - return new LLVector3(result.X, result.Y, result.Z); + return new LLVector3(nx, ny, nz); } #endregion Operators @@ -1645,13 +1619,13 @@ namespace libsecondlife /// Y value /// Z value /// W value - public LLQuaternion(float x, float y, float z, float w) - { - X = x; - Y = y; - Z = z; - W = w; - } + public LLQuaternion(float x, float y, float z, float w) + { + X = x; + Y = y; + Z = z; + W = w; + } /// /// Build a quaternion from an angle and a vector @@ -1735,11 +1709,11 @@ namespace libsecondlife if (array.Count == 4) { - return new LLQuaternion( - (float)array[0].AsReal(), - (float)array[1].AsReal(), - (float)array[2].AsReal(), - (float)array[3].AsReal()); + LLQuaternion quat = new LLQuaternion(); + quat.X = (float)array[0].AsReal(); + quat.Y = (float)array[1].AsReal(); + quat.Z = (float)array[2].AsReal(); + quat.W = (float)array[3].AsReal(); } } @@ -1821,6 +1795,30 @@ namespace libsecondlife return m; } + public static LLQuaternion SetQuaternion(float angle, float x, float y, float z) + { + LLVector3 vec = new LLVector3(x, y, z); + return SetQuaternion(angle, vec); + } + + public static LLQuaternion SetQuaternion(float angle, LLVector3 vec) + { + LLQuaternion quat = new LLQuaternion(); + vec = LLVector3.Norm(vec); + + angle *= 0.5f; + float c = (float)Math.Cos(angle); + float s = (float)Math.Sin(angle); + + quat.X = vec.X * s; + quat.Y = vec.Y * s; + quat.Z = vec.Z * s; + quat.W = c; + + quat = LLQuaternion.Norm(quat); + return quat; + } + #endregion Static Methods #region Overrides diff --git a/libsecondlife/examples/TestClient/TestClient.cs b/libsecondlife/examples/TestClient/TestClient.cs index b27d8265..9eee8e4e 100644 --- a/libsecondlife/examples/TestClient/TestClient.cs +++ b/libsecondlife/examples/TestClient/TestClient.cs @@ -18,8 +18,6 @@ namespace libsecondlife.TestClient public LLUUID MasterKey = LLUUID.Zero; public ClientManager ClientManager; - //internal libsecondlife.InventorySystem.InventoryFolder currentDirectory; - private LLQuaternion bodyRotation = LLQuaternion.Identity; private LLVector3 forward = new LLVector3(0, 0.9999f, 0); private LLVector3 left = new LLVector3(0.9999f, 0, 0);