cosmetics

0.9.1.0-post-fixes
UbitUmarov 2019-01-31 12:03:14 +00:00
parent e0b06d4b6b
commit 44e6f45ed6
5 changed files with 96 additions and 108 deletions

View File

@ -1558,13 +1558,12 @@ namespace OpenSim.Region.PhysicsModule.ubOde
// tmpTime = Util.GetTimeStampMS(); // tmpTime = Util.GetTimeStampMS();
lock (SimulationLock)
{
// Move characters // Move characters
lock (_characters) lock (_characters)
{ {
foreach (OdeCharacter actor in _characters) foreach (OdeCharacter actor in _characters)
{ {
lock (SimulationLock)
actor.Move(); actor.Move();
} }
} }
@ -1574,17 +1573,21 @@ namespace OpenSim.Region.PhysicsModule.ubOde
{ {
foreach (OdePrim aprim in _activegroups) foreach (OdePrim aprim in _activegroups)
{ {
lock (SimulationLock)
aprim.Move(); aprim.Move();
} }
} }
// moveTime += Util.GetTimeStampMS() - tmpTime; // moveTime += Util.GetTimeStampMS() - tmpTime;
// tmpTime = Util.GetTimeStampMS(); // tmpTime = Util.GetTimeStampMS();
lock (SimulationLock)
{
m_rayCastManager.ProcessQueuedRequests(); m_rayCastManager.ProcessQueuedRequests();
// rayTime += Util.GetTimeStampMS() - tmpTime; // rayTime += Util.GetTimeStampMS() - tmpTime;
// tmpTime = Util.GetTimeStampMS(); // tmpTime = Util.GetTimeStampMS();
collision_optimized(); collision_optimized();
} }
// collisionTime += Util.GetTimeStampMS() - tmpTime; // collisionTime += Util.GetTimeStampMS() - tmpTime;
// tmpTime = Util.GetTimeStampMS(); // tmpTime = Util.GetTimeStampMS();
@ -1655,7 +1658,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
} }
*/ */
// tmpTime = Util.GetTimeStampMS(); // tmpTime = Util.GetTimeStampMS();
lock (SimulationLock) //lock (SimulationLock)
{ {
lock (_activegroups) lock (_activegroups)
{ {
@ -1664,6 +1667,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
{ {
if (actor.IsPhysical) if (actor.IsPhysical)
{ {
lock (SimulationLock)
actor.UpdatePositionAndVelocity(framecount); actor.UpdatePositionAndVelocity(framecount);
} }
} }

View File

@ -218,7 +218,6 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing
m_bdata.m_obbZmax = z; m_bdata.m_obbZmax = z;
if (z < m_bdata.m_obbZmin) if (z < m_bdata.m_obbZmin)
m_bdata.m_obbZmin = z; m_bdata.m_obbZmin = z;
} }
public void Add(Triangle triangle) public void Add(Triangle triangle)
@ -324,13 +323,15 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing
if (m_bdata.m_vertices == null) if (m_bdata.m_vertices == null)
throw new NotSupportedException(); throw new NotSupportedException();
float[] result = new float[m_bdata.m_vertices.Count * 3]; float[] result = new float[m_bdata.m_vertices.Count * 3];
int k = 0;
foreach (KeyValuePair<Vertex, int> kvp in m_bdata.m_vertices) foreach (KeyValuePair<Vertex, int> kvp in m_bdata.m_vertices)
{ {
Vertex v = kvp.Key; Vertex v = kvp.Key;
int i = kvp.Value; int i = kvp.Value;
result[3 * i + 0] = v.X; k = 3 * i;
result[3 * i + 1] = v.Y; result[k] = v.X;
result[3 * i + 2] = v.Z; result[k + 1] = v.Y;
result[k + 2] = v.Z;
} }
return result; return result;
} }
@ -364,12 +365,14 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing
if (m_bdata.m_triangles == null) if (m_bdata.m_triangles == null)
throw new NotSupportedException(); throw new NotSupportedException();
int[] result = new int[m_bdata.m_triangles.Count * 3]; int[] result = new int[m_bdata.m_triangles.Count * 3];
int k;
for (int i = 0; i < m_bdata.m_triangles.Count; i++) for (int i = 0; i < m_bdata.m_triangles.Count; i++)
{ {
k= 3 * i;
Triangle t = m_bdata.m_triangles[i]; Triangle t = m_bdata.m_triangles[i];
result[3 * i + 0] = m_bdata.m_vertices[t.v1]; result[k] = m_bdata.m_vertices[t.v1];
result[3 * i + 1] = m_bdata.m_vertices[t.v2]; result[k + 1] = m_bdata.m_vertices[t.v2];
result[3 * i + 2] = m_bdata.m_vertices[t.v3]; result[k + 2] = m_bdata.m_vertices[t.v3];
} }
return result; return result;
} }

View File

@ -945,7 +945,7 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing
#endif #endif
try try
{ {
primMesh.ExtrudeLinear(); primMesh.Extrude(PathType.Linear); ;
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -978,7 +978,7 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing
#endif #endif
try try
{ {
primMesh.ExtrudeCircular(); primMesh.Extrude(PathType.Circular);
} }
catch (Exception ex) catch (Exception ex)
{ {

View File

@ -212,14 +212,34 @@ namespace PrimMesher
public static Coord operator *(Coord v, Quat q) public static Coord operator *(Coord v, Quat q)
{ {
float rx = q.W * v.X + q.Y * v.Z - q.Z * v.Y; float x = q.X;
float ry = q.W * v.Y + q.Z * v.X - q.X * v.Z; float y = q.Y;
float rz = q.W * v.Z + q.X * v.Y - q.Y * v.X; float x2 = x + x;
float z = q.Z;
float y2 = y + y;
float w = q.W;
float z2 = z + z;
float zz2 = z * z2;
float xx2 = x * x2;
float xy2 = x * y2;
float xz2 = x * z2;
z = v.Z;
float yy2 = y * y2;
float yz2 = y * z2;
x = v.X;
float wx2 = w * x2;
float wy2 = w * y2;
float wz2 = w * z2;
y = v.Y;
return new Coord( return new Coord(
2.0f * (rz * q.Y - ry * q.Z) + v.X, x * (1.0f - yy2 - zz2) + y * (xy2 - wz2) + z * (xz2 + wy2),
2.0f * (rx * q.Z - rz * q.X) + v.Y, x * (xy2 + wz2) + y * (1.0f - xx2 - zz2) + z * (yz2 - wx2),
2.0f * (ry * q.X - rx * q.Y) + v.Z ); x * (xz2 - wy2) + y * (yz2 + wx2) + z * (1.0f - xx2 - yy2));
} }
} }
@ -248,9 +268,9 @@ namespace PrimMesher
internal float X; internal float X;
internal float Y; internal float Y;
internal Angle(float angle, float x, float y) internal Angle(float _angle, float x, float y)
{ {
this.angle = angle; // 1 is 2pi angle = _angle; // 1 is 2pi
X = x; // cos X = x; // cos
Y = y; // sin Y = y; // sin
} }
@ -359,8 +379,8 @@ namespace PrimMesher
{ {
angles = new List<Angle>(); angles = new List<Angle>();
const float twoPi = (float)(Math.PI * 2.0); const float twoPi = 2.0f * (float)Math.PI;
const float twoPiInv = (float)(0.5 / Math.PI); const float twoPiInv = 0.5f / (float)Math.PI;
if (sides < 1) if (sides < 1)
throw new Exception("number of sides not greater than zero"); throw new Exception("number of sides not greater than zero");
@ -479,7 +499,7 @@ namespace PrimMesher
/// </summary> /// </summary>
public class Profile public class Profile
{ {
private const float twoPi = (float)(2.0 * Math.PI); private const float twoPi = 2.0f * (float)Math.PI;
public string errorMessage = null; public string errorMessage = null;
@ -533,7 +553,6 @@ namespace PrimMesher
try { angles.makeAngles(sides, startAngle, stopAngle,hasProfileCut); } try { angles.makeAngles(sides, startAngle, stopAngle,hasProfileCut); }
catch (Exception ex) catch (Exception ex)
{ {
errorMessage = "makeAngles failed: Exception: " + ex.ToString() errorMessage = "makeAngles failed: Exception: " + ex.ToString()
+ "\nsides: " + sides.ToString() + " startAngle: " + startAngle.ToString() + " stopAngle: " + stopAngle.ToString(); + "\nsides: " + sides.ToString() + " startAngle: " + startAngle.ToString() + " stopAngle: " + stopAngle.ToString();
@ -791,7 +810,6 @@ namespace PrimMesher
} }
} }
hollowCoords = null; hollowCoords = null;
} }
@ -833,7 +851,7 @@ namespace PrimMesher
vert.X += x; vert.X += x;
vert.Y += y; vert.Y += y;
vert.Z += z; vert.Z += z;
this.coords[i] = vert; coords[i] = vert;
} }
} }
@ -1228,7 +1246,6 @@ namespace PrimMesher
get { return hasHollow; } get { return hasHollow; }
} }
/// <summary> /// <summary>
/// Constructs a PrimMesh object and creates the profile for extrusion. /// Constructs a PrimMesh object and creates the profile for extrusion.
/// </summary> /// </summary>
@ -1257,13 +1274,13 @@ namespace PrimMesher
profileStart = 0.0f; profileStart = 0.0f;
if (profileEnd > 1.0f) if (profileEnd > 1.0f)
profileEnd = 1.0f; profileEnd = 1.0f;
if (profileEnd < 0.02f) else if (profileEnd < 0.02f)
profileEnd = 0.02f; profileEnd = 0.02f;
if (profileStart >= profileEnd) if (profileStart >= profileEnd)
profileStart = profileEnd - 0.02f; profileStart = profileEnd - 0.02f;
if (hollow > 0.99f) if (hollow > 0.99f)
hollow = 0.99f; hollow = 0.99f;
if (hollow < 0.0f) else if (hollow < 0.0f)
hollow = 0.0f; hollow = 0.0f;
} }
@ -1281,9 +1298,7 @@ namespace PrimMesher
float length = pathCutEnd - pathCutBegin; float length = pathCutEnd - pathCutBegin;
hasProfileCut = this.profileEnd - this.profileStart < 0.9999f; hasProfileCut = profileEnd - profileStart < 0.9999f;
hasHollow = (this.hollow > 0.001f);
float twistTotal = twistEnd - twistBegin; float twistTotal = twistEnd - twistBegin;
float twistTotalAbs = Math.Abs(twistTotal); float twistTotalAbs = Math.Abs(twistTotal);
@ -1291,6 +1306,8 @@ namespace PrimMesher
steps += (int)(twistTotalAbs * 3.66); // dahlia's magic number steps += (int)(twistTotalAbs * 3.66); // dahlia's magic number
float hollow = this.hollow; float hollow = this.hollow;
hasHollow = hollow > 0.001f;
float initialProfileRot = 0.0f; float initialProfileRot = 0.0f;
if (pathType == PathType.Circular) if (pathType == PathType.Circular)
@ -1516,29 +1533,6 @@ namespace PrimMesher
// more cleanup will be done at Meshmerizer.cs // more cleanup will be done at Meshmerizer.cs
} }
/// <summary>
/// DEPRICATED - use Extrude(PathType.Linear) instead
/// Extrudes a profile along a straight line path. Used for prim types box, cylinder, and prism.
/// </summary>
///
public void ExtrudeLinear()
{
Extrude(PathType.Linear);
}
/// <summary>
/// DEPRICATED - use Extrude(PathType.Circular) instead
/// Extrude a profile into a circular path prim mesh. Used for prim types torus, tube, and ring.
/// </summary>
///
public void ExtrudeCircular()
{
Extrude(PathType.Circular);
}
private Coord SurfaceNormal(Coord c1, Coord c2, Coord c3) private Coord SurfaceNormal(Coord c1, Coord c2, Coord c3)
{ {
Coord edge1 = new Coord(c2.X - c1.X, c2.Y - c1.Y, c2.Z - c1.Z); Coord edge1 = new Coord(c2.X - c1.X, c2.Y - c1.Y, c2.Z - c1.Z);
@ -1553,7 +1547,7 @@ namespace PrimMesher
private Coord SurfaceNormal(Face face) private Coord SurfaceNormal(Face face)
{ {
return SurfaceNormal(this.coords[face.v1], this.coords[face.v2], this.coords[face.v3]); return SurfaceNormal(coords[face.v1], coords[face.v2], coords[face.v3]);
} }
/// <summary> /// <summary>
@ -1563,11 +1557,11 @@ namespace PrimMesher
/// <returns></returns> /// <returns></returns>
public Coord SurfaceNormal(int faceIndex) public Coord SurfaceNormal(int faceIndex)
{ {
int numFaces = this.faces.Count; int numFaces = faces.Count;
if (faceIndex < 0 || faceIndex >= numFaces) if (faceIndex < 0 || faceIndex >= numFaces)
throw new Exception("faceIndex out of range"); throw new Exception("faceIndex out of range");
return SurfaceNormal(this.faces[faceIndex]); return SurfaceNormal(faces[faceIndex]);
} }
/// <summary> /// <summary>
@ -1612,16 +1606,16 @@ namespace PrimMesher
public void AddPos(float x, float y, float z) public void AddPos(float x, float y, float z)
{ {
int i; int i;
int numVerts = this.coords.Count; int numVerts = coords.Count;
Coord vert; Coord vert;
for (i = 0; i < numVerts; i++) for (i = 0; i < numVerts; i++)
{ {
vert = this.coords[i]; vert = coords[i];
vert.X += x; vert.X += x;
vert.Y += y; vert.Y += y;
vert.Z += z; vert.Z += z;
this.coords[i] = vert; coords[i] = vert;
} }
} }
@ -1632,19 +1626,12 @@ namespace PrimMesher
public void AddRot(Quat q) public void AddRot(Quat q)
{ {
int i; int i;
int numVerts = this.coords.Count; int numVerts = coords.Count;
for (i = 0; i < numVerts; i++) for (i = 0; i < numVerts; i++)
this.coords[i] *= q; coords[i] *= q;
} }
#if VERTEX_INDEXER
public VertexIndexer GetVertexIndexer()
{
return null;
}
#endif
/// <summary> /// <summary>
/// Scales the mesh /// Scales the mesh
/// </summary> /// </summary>
@ -1659,7 +1646,7 @@ namespace PrimMesher
Coord m = new Coord(x, y, z); Coord m = new Coord(x, y, z);
for (i = 0; i < numVerts; i++) for (i = 0; i < numVerts; i++)
this.coords[i] *= m; coords[i] *= m;
} }
/// <summary> /// <summary>
@ -1674,18 +1661,15 @@ namespace PrimMesher
return; return;
String fileName = name + "_" + title + ".raw"; String fileName = name + "_" + title + ".raw";
String completePath = System.IO.Path.Combine(path, fileName); String completePath = System.IO.Path.Combine(path, fileName);
StreamWriter sw = new StreamWriter(completePath); using (StreamWriter sw = new StreamWriter(completePath))
{
for (int i = 0; i < this.faces.Count; i++) for (int i = 0; i < this.faces.Count; i++)
{ {
string s = this.coords[this.faces[i].v1].ToString(); sw.Write(coords[faces[i].v1].ToString());
s += " " + this.coords[this.faces[i].v2].ToString(); sw.Write(coords[faces[i].v2].ToString());
s += " " + this.coords[this.faces[i].v3].ToString(); sw.WriteLine(coords[faces[i].v3].ToString());
}
sw.WriteLine(s); }
}
sw.Close();
} }
} }
} }

View File

@ -165,8 +165,8 @@ namespace PrimMesher
f2 = new Face(p1, p4, p2); f2 = new Face(p1, p4, p2);
} }
this.faces.Add(f1); faces.Add(f1);
this.faces.Add(f2); faces.Add(f2);
} }
} }
} }
@ -203,18 +203,15 @@ namespace PrimMesher
return; return;
String fileName = name + "_" + title + ".raw"; String fileName = name + "_" + title + ".raw";
String completePath = System.IO.Path.Combine(path, fileName); String completePath = System.IO.Path.Combine(path, fileName);
StreamWriter sw = new StreamWriter(completePath); using(StreamWriter sw = new StreamWriter(completePath))
for (int i = 0; i < this.faces.Count; i++)
{ {
string s = this.coords[this.faces[i].v1].ToString(); for (int i = 0; i < faces.Count; i++)
s += " " + this.coords[this.faces[i].v2].ToString(); {
s += " " + this.coords[this.faces[i].v3].ToString(); sw.Write(coords[faces[i].v1].ToString());
sw.Write(coords[faces[i].v2].ToString());
sw.WriteLine(s); sw.WriteLine(coords[faces[i].v3].ToString());
} }
}
sw.Close();
} }
} }
} }