* 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.
This commit is contained in:
Teravus Ovares
2008-09-06 07:52:41 +00:00
parent cbec2bf22b
commit 7d89e12293
388 changed files with 6811 additions and 7138 deletions

View File

@@ -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)

View File

@@ -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<Vertex>
{
public Vertex(float x, float y, float z)
@@ -129,34 +69,34 @@ public class Vertex : PhysicsVector, IComparable<Vertex>
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;
}

View File

@@ -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)

View File

@@ -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)

View File

@@ -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);