remove drawstuff from ubitode

avinationmerge
UbitUmarov 2012-02-11 19:25:41 +00:00
parent f168fefb79
commit 6fd6919a0b
4 changed files with 1 additions and 256 deletions

View File

@ -126,7 +126,7 @@ namespace OpenSim.Region.Physics.OdePlugin
public IntPtr Shell = IntPtr.Zero;
public IntPtr Amotor = IntPtr.Zero;
public d.Mass ShellMass;
public bool collidelock = false;
// public bool collidelock = false;
private bool m_haseventsubscription = false;
public int m_eventsubscription = 0;

View File

@ -2025,9 +2025,6 @@ namespace OpenSim.Region.Physics.OdePlugin
SetInStaticSpace(this);
}
// m_building = false; // REMOVE THIS LATER
if (m_isphysical && Body == IntPtr.Zero)
{
/*

View File

@ -25,7 +25,6 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
//#define USE_DRAWSTUFF
//#define SPAM
using System;
@ -38,9 +37,6 @@ using System.Diagnostics;
using log4net;
using Nini.Config;
using OdeAPI;
#if USE_DRAWSTUFF
using ODEDrawstuff;
#endif
using OpenSim.Framework;
using OpenSim.Region.Physics.Manager;
using OpenMetaverse;
@ -366,31 +362,11 @@ namespace OpenSim.Region.Physics.OdePlugin
//contactgroup
d.WorldSetAutoDisableFlag(world, false);
#if USE_DRAWSTUFF
Thread viewthread = new Thread(new ParameterizedThreadStart(startvisualization));
viewthread.Start();
#endif
}
_watermap = new float[258 * 258];
}
#if USE_DRAWSTUFF
public void startvisualization(object o)
{
ds.Functions fn;
fn.version = ds.VERSION;
fn.start = new ds.CallbackFunction(start);
fn.step = new ds.CallbackFunction(step);
fn.command = new ds.CallbackFunction(command);
fn.stop = null;
fn.path_to_textures = "./textures";
string[] args = new string[0];
ds.SimulationLoop(args.Length, args, 352, 288, ref fn);
}
#endif
// Initialize the mesh plugin
// public override void Initialise(IMesher meshmerizer, IConfigSource config, RegionInfo region )
public override void Initialise(IMesher meshmerizer, IConfigSource config)
@ -2560,134 +2536,5 @@ namespace OpenSim.Region.Physics.OdePlugin
}
return new List<ContactResult>();
}
#if USE_DRAWSTUFF
// Keyboard callback
public void command(int cmd)
{
IntPtr geom;
d.Mass mass;
d.Vector3 sides = new d.Vector3(d.RandReal() * 0.5f + 0.1f, d.RandReal() * 0.5f + 0.1f, d.RandReal() * 0.5f + 0.1f);
Char ch = Char.ToLower((Char)cmd);
switch ((Char)ch)
{
case 'w':
try
{
Vector3 rotate = (new Vector3(1, 0, 0) * Quaternion.CreateFromEulers(hpr.Z * Utils.DEG_TO_RAD, hpr.Y * Utils.DEG_TO_RAD, hpr.X * Utils.DEG_TO_RAD));
xyz.X += rotate.X; xyz.Y += rotate.Y; xyz.Z += rotate.Z;
ds.SetViewpoint(ref xyz, ref hpr);
}
catch (ArgumentException)
{ hpr.X = 0; }
break;
case 'a':
hpr.X++;
ds.SetViewpoint(ref xyz, ref hpr);
break;
case 's':
try
{
Vector3 rotate2 = (new Vector3(-1, 0, 0) * Quaternion.CreateFromEulers(hpr.Z * Utils.DEG_TO_RAD, hpr.Y * Utils.DEG_TO_RAD, hpr.X * Utils.DEG_TO_RAD));
xyz.X += rotate2.X; xyz.Y += rotate2.Y; xyz.Z += rotate2.Z;
ds.SetViewpoint(ref xyz, ref hpr);
}
catch (ArgumentException)
{ hpr.X = 0; }
break;
case 'd':
hpr.X--;
ds.SetViewpoint(ref xyz, ref hpr);
break;
case 'r':
xyz.Z++;
ds.SetViewpoint(ref xyz, ref hpr);
break;
case 'f':
xyz.Z--;
ds.SetViewpoint(ref xyz, ref hpr);
break;
case 'e':
xyz.Y++;
ds.SetViewpoint(ref xyz, ref hpr);
break;
case 'q':
xyz.Y--;
ds.SetViewpoint(ref xyz, ref hpr);
break;
}
}
public void step(int pause)
{
ds.SetColor(1.0f, 1.0f, 0.0f);
ds.SetTexture(ds.Texture.Wood);
lock (_prims)
{
foreach (OdePrim prm in _prims)
{
//IntPtr body = d.GeomGetBody(prm.prim_geom);
if (prm.prim_geom != IntPtr.Zero)
{
d.Vector3 pos;
d.GeomCopyPosition(prm.prim_geom, out pos);
//d.BodyCopyPosition(body, out pos);
d.Matrix3 R;
d.GeomCopyRotation(prm.prim_geom, out R);
//d.BodyCopyRotation(body, out R);
d.Vector3 sides = new d.Vector3();
sides.X = prm.Size.X;
sides.Y = prm.Size.Y;
sides.Z = prm.Size.Z;
ds.DrawBox(ref pos, ref R, ref sides);
}
}
}
ds.SetColor(1.0f, 0.0f, 0.0f);
lock (_characters)
{
foreach (OdeCharacter chr in _characters)
{
if (chr.Shell != IntPtr.Zero)
{
IntPtr body = d.GeomGetBody(chr.Shell);
d.Vector3 pos;
d.GeomCopyPosition(chr.Shell, out pos);
//d.BodyCopyPosition(body, out pos);
d.Matrix3 R;
d.GeomCopyRotation(chr.Shell, out R);
//d.BodyCopyRotation(body, out R);
ds.DrawCapsule(ref pos, ref R, chr.Size.Z, 0.35f);
d.Vector3 sides = new d.Vector3();
sides.X = 0.5f;
sides.Y = 0.5f;
sides.Z = 0.5f;
ds.DrawBox(ref pos, ref R, ref sides);
}
}
}
}
public void start(int unused)
{
ds.SetViewpoint(ref xyz, ref hpr);
}
#endif
}
}

View File

@ -1,99 +0,0 @@
/*
* Copyright ODE
* Ode.NET - .NET bindings for ODE
* Jason Perkins (starkos@industriousone.com)
* Licensed under the New BSD
* Part of the OpenDynamicsEngine
Open Dynamics Engine
Copyright (c) 2001-2007, Russell L. Smith.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
Neither the names of ODE's copyright owner nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*
*/
using System;
using System.Runtime.InteropServices;
using OdeAPI;
namespace ODEDrawstuff
{
/*#if dDOUBLE
using dReal = System.Double;
#else
*/
using dReal = System.Single;
//#endif
public static class ds
{
public const int VERSION = 2;
public enum Texture
{
None,
Wood
}
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void CallbackFunction(int arg);
[StructLayout(LayoutKind.Sequential)]
public struct Functions
{
public int version;
public CallbackFunction start;
public CallbackFunction step;
public CallbackFunction command;
public CallbackFunction stop;
public string path_to_textures;
}
[DllImport("drawstuff", EntryPoint = "dsDrawBox")]
public static extern void DrawBox(ref d.Vector3 pos, ref d.Matrix3 R, ref d.Vector3 sides);
[DllImport("drawstuff", EntryPoint = "dsDrawCapsule")]
public static extern void DrawCapsule(ref d.Vector3 pos, ref d.Matrix3 R, dReal length, dReal radius);
[DllImport("drawstuff", EntryPoint = "dsDrawConvex")]
public static extern void DrawConvex(ref d.Vector3 pos, ref d.Matrix3 R, dReal[] planes, int planeCount, dReal[] points, int pointCount, int[] polygons);
[DllImport("drawstuff", EntryPoint = "dsSetColor")]
public static extern void SetColor(float red, float green, float blue);
[DllImport("drawstuff", EntryPoint = "dsSetTexture")]
public static extern void SetTexture(Texture texture);
[DllImport("drawstuff", EntryPoint = "dsSetViewpoint")]
public static extern void SetViewpoint(ref d.Vector3 xyz, ref d.Vector3 hpr);
[DllImport("drawstuff", EntryPoint = "dsSimulationLoop")]
public static extern void SimulationLoop(int argc, string[] argv, int window_width, int window_height, ref Functions fn);
}
}