diff options
author | UbitUmarov | 2012-02-08 15:24:10 +0000 |
---|---|---|
committer | UbitUmarov | 2012-02-08 15:24:10 +0000 |
commit | 815f3af1d7b3bf16e81dd3a03e0c69c8e49f2f91 (patch) | |
tree | 84a2cd2a6c76c23923388d629b54eab4b49b4cf7 /OpenSim/Region/Physics/UbitOdePlugin/drawstuff.cs | |
parent | Push more NPC stuff into threads (diff) | |
download | opensim-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 '')
-rw-r--r-- | OpenSim/Region/Physics/UbitOdePlugin/drawstuff.cs | 99 |
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 | ||
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 OdeAPI; | ||
44 | |||
45 | namespace 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 | } | ||