mirror of
https://github.com/opensim/opensim.git
synced 2026-08-07 17:55:48 +08:00
revert introduction of some in arguments
This commit is contained in:
@@ -448,11 +448,13 @@ namespace OpenSim.Region.PhysicsModules.SharedBase
|
||||
|
||||
public virtual PhysicsInertiaData GetInertiaData()
|
||||
{
|
||||
PhysicsInertiaData data = new PhysicsInertiaData();
|
||||
data.TotalMass = this.Mass;
|
||||
data.CenterOfMass = CenterOfMass - Position;
|
||||
data.Inertia = Vector3.Zero;
|
||||
data.InertiaRotation = Vector4.Zero;
|
||||
PhysicsInertiaData data = new()
|
||||
{
|
||||
TotalMass = Mass,
|
||||
CenterOfMass = CenterOfMass - Position,
|
||||
Inertia = Vector3.Zero,
|
||||
InertiaRotation = Vector4.Zero
|
||||
};
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
@@ -1629,7 +1629,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void round(ref Vector3 v, int digits)
|
||||
public static void round(ref Vector3 v, int digits)
|
||||
{
|
||||
v.X = MathF.Round(v.X, digits);
|
||||
v.Y = MathF.Round(v.Y, digits);
|
||||
@@ -1880,10 +1880,12 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||
changePhysicsStatus(false);
|
||||
}
|
||||
|
||||
/*
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
private void changeShape(PrimitiveBaseShape arg)
|
||||
{
|
||||
}
|
||||
*/
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
private void changeAvatarSize(strAvatarSize st)
|
||||
@@ -2036,7 +2038,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||
if (Body != IntPtr.Zero)
|
||||
SafeNativeMethods.BodyEnable(Body);
|
||||
}
|
||||
|
||||
/*
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
private void changeSetTorque(Vector3 newTorque)
|
||||
{
|
||||
@@ -2081,6 +2083,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||
private void changeBuilding(bool arg)
|
||||
{
|
||||
}
|
||||
*/
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
private void setFreeMove()
|
||||
@@ -2174,7 +2177,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||
return false;
|
||||
}
|
||||
|
||||
// nasty switch
|
||||
switch (what)
|
||||
{
|
||||
case changes.Add:
|
||||
@@ -2192,6 +2194,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||
changeOrientation((Quaternion)arg);
|
||||
break;
|
||||
|
||||
/*
|
||||
case changes.PosOffset:
|
||||
donullchange();
|
||||
break;
|
||||
@@ -2199,7 +2202,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||
case changes.OriOffset:
|
||||
donullchange();
|
||||
break;
|
||||
|
||||
*/
|
||||
case changes.Velocity:
|
||||
changeVelocity((Vector3)arg);
|
||||
break;
|
||||
@@ -2208,17 +2211,19 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||
changeTargetVelocity((Vector3)arg);
|
||||
break;
|
||||
|
||||
//case changes.Acceleration:
|
||||
// changeacceleration((Vector3)arg);
|
||||
// break;
|
||||
//case changes.AngVelocity:
|
||||
// changeangvelocity((Vector3)arg);
|
||||
// break;
|
||||
/*
|
||||
case changes.Acceleration:
|
||||
changeacceleration((Vector3)arg);
|
||||
break;
|
||||
|
||||
case changes.AngVelocity:
|
||||
changeangvelocity((Vector3)arg);
|
||||
break;
|
||||
*/
|
||||
case changes.Force:
|
||||
changeForce((Vector3)arg);
|
||||
break;
|
||||
|
||||
/*
|
||||
case changes.Torque:
|
||||
changeSetTorque((Vector3)arg);
|
||||
break;
|
||||
@@ -2234,7 +2239,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||
case changes.AngLock:
|
||||
changeAngularLock((byte)arg);
|
||||
break;
|
||||
|
||||
*/
|
||||
case changes.Size:
|
||||
changeSize((Vector3)arg);
|
||||
break;
|
||||
@@ -2263,7 +2268,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||
changePIDHoverActive((bool)arg);
|
||||
break;
|
||||
|
||||
/* not in use for now
|
||||
/*
|
||||
case changes.Shape:
|
||||
changeShape((PrimitiveBaseShape)arg);
|
||||
break;
|
||||
@@ -2275,11 +2280,11 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||
case changes.VolumeDtc:
|
||||
changeVolumedetetion((bool)arg);
|
||||
break;
|
||||
|
||||
*/
|
||||
case changes.Physical:
|
||||
changePhysicsStatus((bool)arg);
|
||||
break;
|
||||
|
||||
/*
|
||||
case changes.Selected:
|
||||
changeSelectedStatus((bool)arg);
|
||||
break;
|
||||
@@ -2292,12 +2297,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||
changeBuilding((bool)arg);
|
||||
break;
|
||||
*/
|
||||
case changes.Null:
|
||||
donullchange();
|
||||
break;
|
||||
|
||||
//case changes.Null:
|
||||
default:
|
||||
donullchange();
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -666,7 +666,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||
m_ffactor = 1f;
|
||||
}
|
||||
|
||||
public static Vector3 Xrot(in Quaternion rot)
|
||||
public static Vector3 Xrot(Quaternion rot)
|
||||
{
|
||||
Vector3 vec;
|
||||
rot.Normalize(); // just in case
|
||||
@@ -676,7 +676,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||
return vec;
|
||||
}
|
||||
|
||||
public static Vector3 Zrot(in Quaternion rot)
|
||||
public static Vector3 Zrot(Quaternion rot)
|
||||
{
|
||||
Vector3 vec;
|
||||
rot.Normalize(); // just in case
|
||||
@@ -690,7 +690,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||
private const float pi = MathF.PI;
|
||||
private const float halfpi = 0.5f * MathF.PI;
|
||||
|
||||
public static Vector3 ubRot2Euler(in Quaternion rot)
|
||||
public static Vector3 ubRot2Euler(Quaternion rot)
|
||||
{
|
||||
// returns roll in X
|
||||
// pitch in Y
|
||||
@@ -732,7 +732,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||
return vec;
|
||||
}
|
||||
|
||||
public static void GetRollPitch(in Quaternion rot, out float roll, out float pitch)
|
||||
public static void GetRollPitch(Quaternion rot, out float roll, out float pitch)
|
||||
{
|
||||
// assuming rot is normalised
|
||||
// rot.Normalize();
|
||||
|
||||
@@ -100,7 +100,7 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing
|
||||
|
||||
public unsafe Mesh Scale(Vector3 scale)
|
||||
{
|
||||
Mesh result = new Mesh(false);
|
||||
Mesh result = new(false);
|
||||
|
||||
float x = scale.X;
|
||||
float y = scale.Y;
|
||||
@@ -154,7 +154,7 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing
|
||||
|
||||
public Mesh Clone()
|
||||
{
|
||||
Mesh result = new Mesh(false);
|
||||
Mesh result = new(false);
|
||||
|
||||
if (m_bdata != null)
|
||||
{
|
||||
@@ -209,7 +209,6 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing
|
||||
if (m_indicesPtr != IntPtr.Zero || m_verticesPtr != IntPtr.Zero)
|
||||
throw new NotSupportedException("Attempt to Add to a pinned Mesh");
|
||||
|
||||
|
||||
triangle.v1.X = (float)Math.Round(triangle.v1.X, 6);
|
||||
triangle.v1.Y = (float)Math.Round(triangle.v1.Y, 6);
|
||||
triangle.v1.Z = (float)Math.Round(triangle.v1.Z, 6);
|
||||
@@ -294,7 +293,7 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing
|
||||
|
||||
public List<Vector3> getVertexList()
|
||||
{
|
||||
List<Vector3> result = new List<Vector3>();
|
||||
List<Vector3> result = new(m_bdata.m_vertices.Count);
|
||||
foreach (Vertex v in m_bdata.m_vertices.Keys)
|
||||
{
|
||||
result.Add(new Vector3(v.X, v.Y, v.Z));
|
||||
@@ -307,7 +306,7 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing
|
||||
if (m_bdata.m_vertices == null)
|
||||
throw new NotSupportedException();
|
||||
float[] result = new float[m_bdata.m_vertices.Count * 3];
|
||||
int k = 0;
|
||||
int k;
|
||||
foreach (KeyValuePair<Vertex, int> kvp in m_bdata.m_vertices)
|
||||
{
|
||||
Vertex v = kvp.Key;
|
||||
@@ -432,10 +431,10 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing
|
||||
if (m_indicesPtr != IntPtr.Zero || m_verticesPtr != IntPtr.Zero)
|
||||
throw new NotSupportedException("Attempt to Append to a pinned Mesh");
|
||||
|
||||
if (!(newMesh is Mesh))
|
||||
if (newMesh is not Mesh nmesh)
|
||||
return;
|
||||
|
||||
foreach (Triangle t in ((Mesh)newMesh).m_bdata.m_triangles)
|
||||
foreach (Triangle t in nmesh.m_bdata.m_triangles)
|
||||
Add(t);
|
||||
}
|
||||
|
||||
@@ -461,20 +460,18 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing
|
||||
|
||||
public void DumpRaw(String path, String name, String title)
|
||||
{
|
||||
if (path == null)
|
||||
if (path is null)
|
||||
return;
|
||||
if (m_bdata == null)
|
||||
if (m_bdata is null)
|
||||
return;
|
||||
String fileName = name + "_" + title + ".raw";
|
||||
String completePath = System.IO.Path.Combine(path, fileName);
|
||||
StreamWriter sw = new StreamWriter(completePath);
|
||||
|
||||
string completePath = System.IO.Path.Combine(path, $"{name}_{title}.raw");
|
||||
using StreamWriter sw = new(completePath);
|
||||
foreach (Triangle t in m_bdata.m_triangles)
|
||||
{
|
||||
String s = t.ToStringRaw();
|
||||
sw.WriteLine(s);
|
||||
sw.WriteLine(t.ToStringRaw());
|
||||
}
|
||||
sw.Close();
|
||||
}
|
||||
}
|
||||
|
||||
public void TrimExcess()
|
||||
{
|
||||
@@ -543,24 +540,22 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing
|
||||
|
||||
try
|
||||
{
|
||||
using(BinaryWriter bw = new BinaryWriter(st))
|
||||
{
|
||||
bw.Write(m_vertexCount);
|
||||
bw.Write(m_indexCount);
|
||||
using BinaryWriter bw = new(st);
|
||||
bw.Write(m_vertexCount);
|
||||
bw.Write(m_indexCount);
|
||||
|
||||
for (int i = 0; i < 3 * m_vertexCount; i++)
|
||||
bw.Write(vertices[i]);
|
||||
for (int i = 0; i < m_indexCount; i++)
|
||||
bw.Write(indexes[i]);
|
||||
bw.Write(m_obb.X);
|
||||
bw.Write(m_obb.Y);
|
||||
bw.Write(m_obb.Z);
|
||||
bw.Write(m_obboffset.X);
|
||||
bw.Write(m_obboffset.Y);
|
||||
bw.Write(m_obboffset.Z);
|
||||
bw.Flush();
|
||||
bw.Close();
|
||||
}
|
||||
for (int i = 0; i < 3 * m_vertexCount; i++)
|
||||
bw.Write(vertices[i]);
|
||||
for (int i = 0; i < m_indexCount; i++)
|
||||
bw.Write(indexes[i]);
|
||||
bw.Write(m_obb.X);
|
||||
bw.Write(m_obb.Y);
|
||||
bw.Write(m_obb.Z);
|
||||
bw.Write(m_obboffset.X);
|
||||
bw.Write(m_obboffset.Y);
|
||||
bw.Write(m_obboffset.Z);
|
||||
bw.Flush();
|
||||
bw.Close();
|
||||
}
|
||||
catch
|
||||
{
|
||||
@@ -572,33 +567,31 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing
|
||||
|
||||
public static Mesh FromStream(Stream st, AMeshKey key)
|
||||
{
|
||||
Mesh mesh = new Mesh(false);
|
||||
Mesh mesh = new(false);
|
||||
|
||||
bool ok = true;
|
||||
try
|
||||
{
|
||||
using(BinaryReader br = new BinaryReader(st))
|
||||
{
|
||||
mesh.m_vertexCount = br.ReadInt32();
|
||||
mesh.m_indexCount = br.ReadInt32();
|
||||
using BinaryReader br = new(st);
|
||||
mesh.m_vertexCount = br.ReadInt32();
|
||||
mesh.m_indexCount = br.ReadInt32();
|
||||
|
||||
int n = 3 * mesh.m_vertexCount;
|
||||
mesh.vertices = new float[n];
|
||||
for (int i = 0; i < n; i++)
|
||||
mesh.vertices[i] = br.ReadSingle();
|
||||
int n = 3 * mesh.m_vertexCount;
|
||||
mesh.vertices = new float[n];
|
||||
for (int i = 0; i < n; i++)
|
||||
mesh.vertices[i] = br.ReadSingle();
|
||||
|
||||
mesh.indexes = new int[mesh.m_indexCount];
|
||||
for (int i = 0; i < mesh.m_indexCount; i++)
|
||||
mesh.indexes[i] = br.ReadInt32();
|
||||
mesh.indexes = new int[mesh.m_indexCount];
|
||||
for (int i = 0; i < mesh.m_indexCount; i++)
|
||||
mesh.indexes[i] = br.ReadInt32();
|
||||
|
||||
mesh.m_obb.X = br.ReadSingle();
|
||||
mesh.m_obb.Y = br.ReadSingle();
|
||||
mesh.m_obb.Z = br.ReadSingle();
|
||||
mesh.m_obb.X = br.ReadSingle();
|
||||
mesh.m_obb.Y = br.ReadSingle();
|
||||
mesh.m_obb.Z = br.ReadSingle();
|
||||
|
||||
mesh.m_obboffset.X = br.ReadSingle();
|
||||
mesh.m_obboffset.Y = br.ReadSingle();
|
||||
mesh.m_obboffset.Z = br.ReadSingle();
|
||||
}
|
||||
mesh.m_obboffset.X = br.ReadSingle();
|
||||
mesh.m_obboffset.Y = br.ReadSingle();
|
||||
mesh.m_obboffset.Z = br.ReadSingle();
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user