1 | using System; |
---|
2 | using System.Runtime.InteropServices; |
---|
3 | using Ode.NET; |
---|
4 | |
---|
5 | namespace Drawstuff.NET |
---|
6 | { |
---|
7 | #if dDOUBLE |
---|
8 | using dReal = System.Double; |
---|
9 | #else |
---|
10 | using dReal = System.Single; |
---|
11 | #endif |
---|
12 | |
---|
13 | public static class ds |
---|
14 | { |
---|
15 | public const int VERSION = 2; |
---|
16 | |
---|
17 | public enum Texture |
---|
18 | { |
---|
19 | None, |
---|
20 | Wood |
---|
21 | } |
---|
22 | |
---|
23 | [UnmanagedFunctionPointer(CallingConvention.Cdecl)] |
---|
24 | public delegate void CallbackFunction(int arg); |
---|
25 | |
---|
26 | [StructLayout(LayoutKind.Sequential)] |
---|
27 | public struct Functions |
---|
28 | { |
---|
29 | public int version; |
---|
30 | public CallbackFunction start; |
---|
31 | public CallbackFunction step; |
---|
32 | public CallbackFunction command; |
---|
33 | public CallbackFunction stop; |
---|
34 | public string path_to_textures; |
---|
35 | } |
---|
36 | |
---|
37 | [DllImport("drawstuff", EntryPoint="dsDrawBox")] |
---|
38 | public static extern void DrawBox(ref d.Vector3 pos, ref d.Matrix3 R, ref d.Vector3 sides); |
---|
39 | |
---|
40 | [DllImport("drawstuff", EntryPoint = "dsDrawCapsule")] |
---|
41 | public static extern void DrawCapsule(ref d.Vector3 pos, ref d.Matrix3 R, dReal length, dReal radius); |
---|
42 | |
---|
43 | [DllImport("drawstuff", EntryPoint = "dsDrawConvex")] |
---|
44 | public static extern void DrawConvex(ref d.Vector3 pos, ref d.Matrix3 R, dReal[] planes, int planeCount, dReal[] points, int pointCount, int[] polygons); |
---|
45 | |
---|
46 | [DllImport("drawstuff", EntryPoint="dsSetColor")] |
---|
47 | public static extern void SetColor(float red, float green, float blue); |
---|
48 | |
---|
49 | [DllImport("drawstuff", EntryPoint="dsSetTexture")] |
---|
50 | public static extern void SetTexture(Texture texture); |
---|
51 | |
---|
52 | [DllImport("drawstuff", EntryPoint="dsSetViewpoint")] |
---|
53 | public static extern void SetViewpoint(ref d.Vector3 xyz, ref d.Vector3 hpr); |
---|
54 | |
---|
55 | [DllImport("drawstuff", EntryPoint="dsSimulationLoop")] |
---|
56 | public static extern void SimulationLoop(int argc, string[] argv, int window_width, int window_height, ref Functions fn); |
---|
57 | } |
---|
58 | } |
---|