1use crate::ode::ds::{dsFunctions_C, Tdrawstuff};
5
6use std::ffi::{c_uint, c_int, c_char};
7
8pub use drawstuff::drawstuff::*;
9
10pub struct Drawstuff {
12}
13
14impl Tdrawstuff for Drawstuff {
16 fn Debug(&self, msg: *const c_char) {
18unsafe {
19 dsDebug(msg); }
21 }
23 fn Error(&self, msg: *const c_char) {
25unsafe {
26 dsError(msg); }
28 }
30 fn Print(&self, msg: *const c_char) {
32unsafe {
33 dsPrint(msg); }
35 }
37
38 fn DrawBox(&self, pos: *const f32, rot: *const f32, lxyz: *const f32) {
40unsafe {
41 dsDrawBox(pos, rot, lxyz);
42}
43 }
44 fn DrawBoxD(&self, pos: *const f64, rot: *const f64, lxyz: *const f64) {
46unsafe {
47 dsDrawBoxD(pos, rot, lxyz);
48}
49 }
50 fn DrawCapsule(&self, pos: *const f32, rot: *const f32, l: f32, r: f32) {
52unsafe {
53 dsDrawCapsule(pos, rot, l, r);
54}
55 }
56 fn DrawCapsuleD(&self, pos: *const f64, rot: *const f64, l: f32, r: f32) {
58unsafe {
59 dsDrawCapsuleD(pos, rot, l, r);
60}
61 }
62 fn DrawConvex(&self, pos: *const f32, rot: *const f32,
64 planes: *const f32, planecount: c_uint,
65 points: *const f32, pointcount: c_uint,
66 polygons: *const c_uint) {
67unsafe {
68 dsDrawConvex(pos, rot, planes, planecount, points, pointcount, polygons);
69}
70 }
71 fn DrawConvexD(&self, pos: *const f64, rot: *const f64,
73 planes: *const f64, planecount: c_uint,
74 points: *const f64, pointcount: c_uint,
75 polygons: *const c_uint) {
76unsafe {
77 dsDrawConvexD(pos, rot, planes, planecount, points, pointcount, polygons);
78}
79 }
80 fn DrawCylinder(&self, pos: *const f32, rot: *const f32, l: f32, r: f32) {
82unsafe {
83 dsDrawCylinder(pos, rot, l, r);
84}
85 }
86 fn DrawCylinderD(&self, pos: *const f64, rot: *const f64, l: f32, r: f32) {
88unsafe {
89 dsDrawCylinderD(pos, rot, l, r);
90}
91 }
92 fn DrawLine(&self, pos1: *const f32, pos2: *const f32) {
94unsafe {
95 dsDrawLine(pos1, pos2);
96}
97 }
98 fn DrawLineD(&self, pos1: *const f64, pos2: *const f64) {
100unsafe {
101 dsDrawLineD(pos1, pos2);
102}
103 }
104 fn DrawSphere(&self, pos: *const f32, rot: *const f32, radius: f32) {
106unsafe {
107 dsDrawSphere(pos, rot, radius);
108}
109 }
110 fn DrawSphereD(&self, pos: *const f64, rot: *const f64, radius: f32) {
112unsafe {
113 dsDrawSphereD(pos, rot, radius);
114}
115 }
116 fn DrawTriangle(&self, pos: *const f32, rot: *const f32,
118 v0: *const f32, v1: *const f32, v2: *const f32, solid: c_int) {
119unsafe {
120 dsDrawTriangle(pos, rot, v0, v1, v2, solid);
121}
122 }
123 fn DrawTriangleD(&self, pos: *const f64, rot: *const f64,
125 v0: *const f64, v1: *const f64, v2: *const f64, solid: c_int) {
126unsafe {
127 dsDrawTriangleD(pos, rot, v0, v1, v2, solid);
128}
129 }
130 fn DrawTriangles(&self, pos: *const f32, rot: *const f32,
132 v: *const f32, n: c_int, solid: c_int) {
133unsafe {
134 dsDrawTriangles(pos, rot, v, n, solid);
135}
136 }
137 fn DrawTrianglesD(&self, pos: *const f64, rot: *const f64,
139 v: *const f64, n: c_int, solid: c_int) {
140unsafe {
141 dsDrawTrianglesD(pos, rot, v, n, solid);
142}
143 }
144 fn ElapsedTime(&self) -> f64 {
146unsafe {
147 dsElapsedTime()
148}
149 }
150 fn GetViewpoint(&self, xyz: *mut f32, hpr: *mut f32) {
152unsafe {
153 dsGetViewpoint(xyz, hpr);
154}
155 }
156 fn SetCapsuleQuality(&self, n: c_int) {
158unsafe {
159 dsSetCapsuleQuality(n);
160}
161 }
162 fn SetColor(&self, red: f32, green: f32, blue: f32) {
164unsafe {
165 dsSetColor(red, green, blue);
166}
167 }
168 fn SetColorAlpha(&self, red: f32, green: f32, blue: f32, alpha: f32) {
170unsafe {
171 dsSetColorAlpha(red, green, blue, alpha);
172}
173 }
174 fn SetDrawMode(&self, mode: c_int) {
176unsafe {
177 dsSetDrawMode(mode);
178}
179 }
180 fn SetSphereQuality(&self, n: c_int) {
182unsafe {
183 dsSetSphereQuality(n);
184}
185 }
186 fn SetTexture(&self, texture_number: c_int) {
188unsafe {
189 dsSetTexture(texture_number);
190}
191 }
192 fn SetViewpoint(&self, xyz: *mut f32, hpr: *mut f32) {
194unsafe {
195 dsSetViewpoint(xyz, hpr);
196}
197 }
198 fn SimulationLoop(&self, argc: c_int, argv: *mut *mut c_char,
200 window_width: c_int, window_height: c_int, functions: *mut dsFunctions_C) {
201unsafe {
202 dsSimulationLoop(argc, argv, window_width, window_height,
203 functions as *mut dsFunctions); }
205 }
206 fn Stop(&self) {
208unsafe {
209 dsStop();
210}
211 }
212}
213
214impl Drawstuff {
216 pub fn new() -> Self {
218 Drawstuff{}
219 }
220 pub fn dispose(&mut self) {
222 ()
223 }
224}
225
226impl Drop for Drawstuff {
228 fn drop(&mut self) {
230 self.dispose();
231 }
232}