aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/UbitOdePlugin/drawstuff.cs
diff options
context:
space:
mode:
authorUbitUmarov2012-02-08 15:24:10 +0000
committerUbitUmarov2012-02-08 15:24:10 +0000
commit815f3af1d7b3bf16e81dd3a03e0c69c8e49f2f91 (patch)
tree84a2cd2a6c76c23923388d629b54eab4b49b4cf7 /OpenSim/Region/Physics/UbitOdePlugin/drawstuff.cs
parentPush more NPC stuff into threads (diff)
downloadopensim-SC-815f3af1d7b3bf16e81dd3a03e0c69c8e49f2f91.zip
opensim-SC-815f3af1d7b3bf16e81dd3a03e0c69c8e49f2f91.tar.gz
opensim-SC-815f3af1d7b3bf16e81dd3a03e0c69c8e49f2f91.tar.bz2
opensim-SC-815f3af1d7b3bf16e81dd3a03e0c69c8e49f2f91.tar.xz
UbitODE plugin initial commit
Diffstat (limited to 'OpenSim/Region/Physics/UbitOdePlugin/drawstuff.cs')
-rw-r--r--OpenSim/Region/Physics/UbitOdePlugin/drawstuff.cs99
1 files changed, 99 insertions, 0 deletions
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/drawstuff.cs b/OpenSim/Region/Physics/UbitOdePlugin/drawstuff.cs
new file mode 100644
index 0000000..aefad3a
--- /dev/null
+++ b/OpenSim/Region/Physics/UbitOdePlugin/drawstuff.cs
@@ -0,0 +1,99 @@
1/*
2 * Copyright ODE
3 * Ode.NET - .NET bindings for ODE
4 * Jason Perkins (starkos@industriousone.com)
5 * Licensed under the New BSD
6 * Part of the OpenDynamicsEngine
7Open Dynamics Engine
8Copyright (c) 2001-2007, Russell L. Smith.
9All rights reserved.
10
11Redistribution and use in source and binary forms, with or without
12modification, are permitted provided that the following conditions
13are met:
14
15Redistributions of source code must retain the above copyright notice,
16this list of conditions and the following disclaimer.
17
18Redistributions in binary form must reproduce the above copyright notice,
19this list of conditions and the following disclaimer in the documentation
20and/or other materials provided with the distribution.
21
22Neither the names of ODE's copyright owner nor the names of its
23contributors may be used to endorse or promote products derived from
24this software without specific prior written permission.
25
26THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
27"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
28LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
29FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
30OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
31SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
32TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
33PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
34LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
35NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
36SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37 *
38 *
39 */
40
41using System;
42using System.Runtime.InteropServices;
43using OdeAPI;
44
45namespace ODEDrawstuff
46{
47/*#if dDOUBLE
48 using dReal = System.Double;
49#else
50 */
51 using dReal = System.Single;
52//#endif
53
54 public static class ds
55 {
56 public const int VERSION = 2;
57
58 public enum Texture
59 {
60 None,
61 Wood
62 }
63
64 [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
65 public delegate void CallbackFunction(int arg);
66
67 [StructLayout(LayoutKind.Sequential)]
68 public struct Functions
69 {
70 public int version;
71 public CallbackFunction start;
72 public CallbackFunction step;
73 public CallbackFunction command;
74 public CallbackFunction stop;
75 public string path_to_textures;
76 }
77
78 [DllImport("drawstuff", EntryPoint = "dsDrawBox")]
79 public static extern void DrawBox(ref d.Vector3 pos, ref d.Matrix3 R, ref d.Vector3 sides);
80
81 [DllImport("drawstuff", EntryPoint = "dsDrawCapsule")]
82 public static extern void DrawCapsule(ref d.Vector3 pos, ref d.Matrix3 R, dReal length, dReal radius);
83
84 [DllImport("drawstuff", EntryPoint = "dsDrawConvex")]
85 public static extern void DrawConvex(ref d.Vector3 pos, ref d.Matrix3 R, dReal[] planes, int planeCount, dReal[] points, int pointCount, int[] polygons);
86
87 [DllImport("drawstuff", EntryPoint = "dsSetColor")]
88 public static extern void SetColor(float red, float green, float blue);
89
90 [DllImport("drawstuff", EntryPoint = "dsSetTexture")]
91 public static extern void SetTexture(Texture texture);
92
93 [DllImport("drawstuff", EntryPoint = "dsSetViewpoint")]
94 public static extern void SetViewpoint(ref d.Vector3 xyz, ref d.Vector3 hpr);
95
96 [DllImport("drawstuff", EntryPoint = "dsSimulationLoop")]
97 public static extern void SimulationLoop(int argc, string[] argv, int window_width, int window_height, ref Functions fn);
98 }
99}