Mantis#3218. Thank you kindly, TLaukkan (Tommil) for a patch that:

* Added log4net dependency to physxplugin in prebuild.xml.
* Added missing m_log fields to classes.
* Replaced Console.WriteLine with appropriate m_log.Xxxx
* Tested that nant test target runs succesfully.
* Tested that local opensim sandbox starts up without errors.
This commit is contained in:
Charles Krinke
2009-02-22 20:52:55 +00:00
parent 913654f2c9
commit 8f55b9d735
117 changed files with 580 additions and 409 deletions

View File

@@ -35,6 +35,8 @@ using OpenMetaverse.Imaging;
using System.Drawing;
using System.Drawing.Imaging;
using PrimMesher;
using log4net;
using System.Reflection;
namespace OpenSim.Region.Physics.Meshing
{
@@ -57,6 +59,7 @@ namespace OpenSim.Region.Physics.Meshing
public class Meshmerizer : IMesher
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
//private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
// Setting baseDir to a path will enable the dumping of raw files
@@ -155,9 +158,9 @@ namespace OpenSim.Region.Physics.Meshing
private void ReportPrimError(string message, string primName, PrimMesh primMesh)
{
Console.WriteLine(message);
Console.WriteLine("\nPrim Name: " + primName);
Console.WriteLine("****** PrimMesh Parameters ******\n" + primMesh.ParamsToDisplayString());
m_log.Error(message);
m_log.Error("\nPrim Name: " + primName);
m_log.Error("****** PrimMesh Parameters ******\n" + primMesh.ParamsToDisplayString());
}
@@ -185,17 +188,17 @@ namespace OpenSim.Region.Physics.Meshing
}
catch (DllNotFoundException)
{
System.Console.WriteLine("[PHYSICS]: OpenJpeg is not installed correctly on this system. Physics Proxy generation failed. Often times this is because of an old version of GLIBC. You must have version 2.4 or above!");
m_log.Error("[PHYSICS]: OpenJpeg is not installed correctly on this system. Physics Proxy generation failed. Often times this is because of an old version of GLIBC. You must have version 2.4 or above!");
return null;
}
catch (IndexOutOfRangeException)
{
System.Console.WriteLine("[PHYSICS]: OpenJpeg was unable to decode this. Physics Proxy generation failed");
m_log.Error("[PHYSICS]: OpenJpeg was unable to decode this. Physics Proxy generation failed");
return null;
}
catch (Exception)
{
System.Console.WriteLine("[PHYSICS]: Unable to generate a Sculpty physics proxy. Sculpty texture decode failed!");
m_log.Error("[PHYSICS]: Unable to generate a Sculpty physics proxy. Sculpty texture decode failed!");
return null;
}
@@ -285,7 +288,7 @@ namespace OpenSim.Region.Physics.Meshing
if (profileEnd > 1.0f) profileEnd = 1.0f;
}
#if SPAM
Console.WriteLine("****** PrimMesh Parameters (Linear) ******\n" + primMesh.ParamsToDisplayString());
m_log.Debug("****** PrimMesh Parameters (Linear) ******\n" + primMesh.ParamsToDisplayString());
#endif
try
{
@@ -316,7 +319,7 @@ namespace OpenSim.Region.Physics.Meshing
if (profileEnd > 1.0f) profileEnd = 1.0f;
}
#if SPAM
Console.WriteLine("****** PrimMesh Parameters (Circular) ******\n" + primMesh.ParamsToDisplayString());
m_log.Debug("****** PrimMesh Parameters (Circular) ******\n" + primMesh.ParamsToDisplayString());
#endif
try
{
@@ -378,7 +381,7 @@ namespace OpenSim.Region.Physics.Meshing
if ((!isPhysical) && size.X < minSizeForComplexMesh && size.Y < minSizeForComplexMesh && size.Z < minSizeForComplexMesh)
{
#if SPAM
Console.WriteLine("Meshmerizer: prim " + primName + " has a size of " + size.ToString() + " which is below threshold of " +
m_log.Debug("Meshmerizer: prim " + primName + " has a size of " + size.ToString() + " which is below threshold of " +
minSizeForComplexMesh.ToString() + " - creating simple bounding box" );
#endif

View File

@@ -29,6 +29,8 @@ using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using log4net;
using System.Reflection;
namespace PrimMesher
{
@@ -576,6 +578,7 @@ namespace PrimMesher
/// </summary>
internal class Profile
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private const float twoPi = 2.0f * (float)Math.PI;
internal List<Coord> coords;
@@ -643,8 +646,8 @@ namespace PrimMesher
try { angles.makeAngles(sides, startAngle, stopAngle); }
catch (Exception ex)
{
Console.WriteLine("makeAngles failed: Exception: " + ex.ToString());
Console.WriteLine("sides: " + sides.ToString() + " startAngle: " + startAngle.ToString() + " stopAngle: " + stopAngle.ToString());
m_log.Error("makeAngles failed: Exception: " + ex.ToString());
m_log.Error("sides: " + sides.ToString() + " startAngle: " + startAngle.ToString() + " stopAngle: " + stopAngle.ToString());
return;
}
@@ -663,8 +666,8 @@ namespace PrimMesher
try { hollowAngles.makeAngles(hollowSides, startAngle, stopAngle); }
catch (Exception ex)
{
Console.WriteLine("makeAngles failed: Exception: " + ex.ToString());
Console.WriteLine("sides: " + sides.ToString() + " startAngle: " + startAngle.ToString() + " stopAngle: " + stopAngle.ToString());
m_log.Error("makeAngles failed: Exception: " + ex.ToString());
m_log.Error("sides: " + sides.ToString() + " startAngle: " + startAngle.ToString() + " stopAngle: " + stopAngle.ToString());
return;
}
}

View File

@@ -669,7 +669,7 @@ namespace OpenSim.Region.Physics.OdePlugin
m_pidControllerActive = false;
force *= 100f;
doForce(force);
//System.Console.WriteLine("Push!");
//m_log.Debug("Push!");
//_target_velocity.X += force.X;
// _target_velocity.Y += force.Y;
//_target_velocity.Z += force.Z;

View File

@@ -2507,7 +2507,7 @@ namespace OpenSim.Region.Physics.OdePlugin
}
else
{
//System.Console.WriteLine(Math.Abs(m_lastposition.X - l_position.X).ToString());
//m_log.Debug(Math.Abs(m_lastposition.X - l_position.X).ToString());
_zeroFlag = false;
}
@@ -2569,7 +2569,7 @@ namespace OpenSim.Region.Physics.OdePlugin
m_rotationalVelocity.setValues(rotvel.X, rotvel.Y, rotvel.Z);
}
//System.Console.WriteLine("ODE: " + m_rotationalVelocity.ToString());
//m_log.Debug("ODE: " + m_rotationalVelocity.ToString());
_orientation.X = ori.X;
_orientation.Y = ori.Y;
_orientation.Z = ori.Z;

View File

@@ -31,12 +31,16 @@ using NUnit.Framework;
using OpenMetaverse;
using OpenSim.Framework;
using OpenSim.Region.Physics.Manager;
using log4net;
using System.Reflection;
namespace OpenSim.Region.Physics.OdePlugin
{
[TestFixture]
public class ODETestClass
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private OdePlugin cbt;
private PhysicsScene ps;
private IMeshingPlugin imp;
@@ -92,18 +96,18 @@ namespace OpenSim.Region.Physics.OdePlugin
Assert.That(oprim.m_targetSpace != (IntPtr)0);
//Assert.That(oprim.m_targetSpace == pscene.space);
Console.WriteLine("TargetSpace: " + oprim.m_targetSpace + " - SceneMainSpace: " + pscene.space);
m_log.Info("TargetSpace: " + oprim.m_targetSpace + " - SceneMainSpace: " + pscene.space);
Assert.That(!oprim.m_taintadd);
Console.WriteLine("Prim Position (" + oprim.m_localID + "): " + prim.Position.ToString());
m_log.Info("Prim Position (" + oprim.m_localID + "): " + prim.Position.ToString());
// Make sure we're above the ground
//Assert.That(prim.Position.Z > 20f);
//Console.WriteLine("PrimCollisionScore (" + oprim.m_localID + "): " + oprim.m_collisionscore);
//m_log.Info("PrimCollisionScore (" + oprim.m_localID + "): " + oprim.m_collisionscore);
// Make sure we've got a Body
Assert.That(oprim.Body != (IntPtr)0);
//Console.WriteLine(
//m_log.Info(
}
// Make sure we're not somewhere above the ground

View File

@@ -579,7 +579,7 @@ namespace OpenSim.Region.Physics.OdePlugin
//if (id == d.GeomClassId.TriMeshClass)
//{
// m_log.InfoFormat("near: A collision was detected between {1} and {2}", 0, name1, name2);
//System.Console.WriteLine("near: A collision was detected between {1} and {2}", 0, name1, name2);
//m_log.Debug("near: A collision was detected between {1} and {2}", 0, name1, name2);
//}
// Figure out how many contact points we have
@@ -945,8 +945,8 @@ namespace OpenSim.Region.Physics.OdePlugin
// so lets throttle them and send them again after it's somewhat sorted out.
p2.ThrottleUpdates = true;
}
//System.Console.WriteLine(count.ToString());
//System.Console.WriteLine("near: A collision was detected between {1} and {2}", 0, name1, name2);
//m_log.Debug(count.ToString());
//m_log.Debug("near: A collision was detected between {1} and {2}", 0, name1, name2);
}
}
@@ -2095,7 +2095,7 @@ namespace OpenSim.Region.Physics.OdePlugin
// convenient place to do it for now...
// //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());
// //m_log.Debug("needsMeshing: " + " pathCurve: " + pbs.PathCurve.ToString() + " profileCurve: " + pbs.ProfileCurve.ToString() + " pathScaleY: " + Primitive.UnpackPathScale(pbs.PathScaleY).ToString());
int iPropertiesNotSupportedDefault = 0;
if (pbs.SculptEntry && !meshSculptedPrim)

View File

@@ -32,6 +32,8 @@ using OpenSim.Framework;
using OpenSim.Region.Physics.Manager;
using PhysXWrapper;
using Quaternion=OpenMetaverse.Quaternion;
using System.Reflection;
using log4net;
namespace OpenSim.Region.Physics.PhysXPlugin
{
@@ -40,6 +42,7 @@ namespace OpenSim.Region.Physics.PhysXPlugin
/// </summary>
public class PhysXPlugin : IPhysicsPlugin
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private PhysXScene _mScene;
public PhysXPlugin()
@@ -72,6 +75,7 @@ namespace OpenSim.Region.Physics.PhysXPlugin
public class PhysXScene : PhysicsScene
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private List<PhysXCharacter> _characters = new List<PhysXCharacter>();
private List<PhysXPrim> _prims = new List<PhysXPrim>();
private float[] _heightMap = null;
@@ -84,7 +88,7 @@ namespace OpenSim.Region.Physics.PhysXPlugin
//sceneIdentifier = _sceneIdentifier;
mySdk = NxPhysicsSDK.CreateSDK();
Console.WriteLine("Sdk created - now creating scene");
m_log.Info("Sdk created - now creating scene");
scene = mySdk.CreateScene();
}
@@ -174,7 +178,7 @@ namespace OpenSim.Region.Physics.PhysXPlugin
}
catch (Exception e)
{
Console.WriteLine(e.Message);
m_log.Error(e.Message);
}
return fps;
}
@@ -193,7 +197,7 @@ namespace OpenSim.Region.Physics.PhysXPlugin
{
if (_heightMap != null)
{
Console.WriteLine("PhysX - deleting old terrain");
m_log.Debug("PhysX - deleting old terrain");
scene.DeleteTerrain();
}
_heightMap = heightMap;