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