raylib-bindings 0.0.10 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/ChangeLog +214 -209
- data/LICENSE.txt +0 -0
- data/README.md +143 -122
- data/examples/template.rb +146 -0
- data/lib/libraylib.dylib +0 -0
- data/lib/physac.dylib +0 -0
- data/lib/physac.rb +178 -178
- data/lib/raygui.dylib +0 -0
- data/lib/raygui.rb +559 -559
- data/lib/raylib.rb +178 -154
- data/lib/raylib_main.rb +2199 -2199
- data/lib/raymath.rb +388 -388
- data/lib/rlgl.rb +658 -658
- metadata +4 -3
data/lib/raymath.rb
CHANGED
@@ -1,388 +1,388 @@
|
|
1
|
-
# Yet another raylib wrapper for Ruby
|
2
|
-
#
|
3
|
-
# * https://github.com/vaiorabbit/raylib-bindings
|
4
|
-
#
|
5
|
-
# [NOTICE] This is an automatically generated file.
|
6
|
-
|
7
|
-
require 'ffi'
|
8
|
-
|
9
|
-
module Raylib
|
10
|
-
extend FFI::Library
|
11
|
-
# Define/Macro
|
12
|
-
|
13
|
-
EPSILON = 0.000001
|
14
|
-
|
15
|
-
# Enum
|
16
|
-
|
17
|
-
|
18
|
-
# Typedef
|
19
|
-
|
20
|
-
|
21
|
-
# Struct
|
22
|
-
|
23
|
-
class Float3 < FFI::Struct
|
24
|
-
layout(
|
25
|
-
:v, [:float, 3],
|
26
|
-
)
|
27
|
-
end
|
28
|
-
|
29
|
-
class Float16 < FFI::Struct
|
30
|
-
layout(
|
31
|
-
:v, [:float, 16],
|
32
|
-
)
|
33
|
-
end
|
34
|
-
|
35
|
-
|
36
|
-
# Function
|
37
|
-
|
38
|
-
def self.setup_raymath_symbols()
|
39
|
-
symbols = [
|
40
|
-
:Clamp,
|
41
|
-
:Lerp,
|
42
|
-
:Normalize,
|
43
|
-
:Remap,
|
44
|
-
:Wrap,
|
45
|
-
:FloatEquals,
|
46
|
-
:Vector2Zero,
|
47
|
-
:Vector2One,
|
48
|
-
:Vector2Add,
|
49
|
-
:Vector2AddValue,
|
50
|
-
:Vector2Subtract,
|
51
|
-
:Vector2SubtractValue,
|
52
|
-
:Vector2Length,
|
53
|
-
:Vector2LengthSqr,
|
54
|
-
:Vector2DotProduct,
|
55
|
-
:Vector2Distance,
|
56
|
-
:Vector2DistanceSqr,
|
57
|
-
:Vector2Angle,
|
58
|
-
:Vector2Scale,
|
59
|
-
:Vector2Multiply,
|
60
|
-
:Vector2Negate,
|
61
|
-
:Vector2Divide,
|
62
|
-
:Vector2Normalize,
|
63
|
-
:Vector2Transform,
|
64
|
-
:Vector2Lerp,
|
65
|
-
:Vector2Reflect,
|
66
|
-
:Vector2Rotate,
|
67
|
-
:Vector2MoveTowards,
|
68
|
-
:Vector2Invert,
|
69
|
-
:Vector2Clamp,
|
70
|
-
:Vector2ClampValue,
|
71
|
-
:Vector2Equals,
|
72
|
-
:Vector3Zero,
|
73
|
-
:Vector3One,
|
74
|
-
:Vector3Add,
|
75
|
-
:Vector3AddValue,
|
76
|
-
:Vector3Subtract,
|
77
|
-
:Vector3SubtractValue,
|
78
|
-
:Vector3Scale,
|
79
|
-
:Vector3Multiply,
|
80
|
-
:Vector3CrossProduct,
|
81
|
-
:Vector3Perpendicular,
|
82
|
-
:Vector3Length,
|
83
|
-
:Vector3LengthSqr,
|
84
|
-
:Vector3DotProduct,
|
85
|
-
:Vector3Distance,
|
86
|
-
:Vector3DistanceSqr,
|
87
|
-
:Vector3Angle,
|
88
|
-
:Vector3Negate,
|
89
|
-
:Vector3Divide,
|
90
|
-
:Vector3Normalize,
|
91
|
-
:Vector3OrthoNormalize,
|
92
|
-
:Vector3Transform,
|
93
|
-
:Vector3RotateByQuaternion,
|
94
|
-
:Vector3RotateByAxisAngle,
|
95
|
-
:Vector3Lerp,
|
96
|
-
:Vector3Reflect,
|
97
|
-
:Vector3Min,
|
98
|
-
:Vector3Max,
|
99
|
-
:Vector3Barycenter,
|
100
|
-
:Vector3Unproject,
|
101
|
-
:Vector3ToFloatV,
|
102
|
-
:Vector3Invert,
|
103
|
-
:Vector3Clamp,
|
104
|
-
:Vector3ClampValue,
|
105
|
-
:Vector3Equals,
|
106
|
-
:Vector3Refract,
|
107
|
-
:MatrixDeterminant,
|
108
|
-
:MatrixTrace,
|
109
|
-
:MatrixTranspose,
|
110
|
-
:MatrixInvert,
|
111
|
-
:MatrixIdentity,
|
112
|
-
:MatrixAdd,
|
113
|
-
:MatrixSubtract,
|
114
|
-
:MatrixMultiply,
|
115
|
-
:MatrixTranslate,
|
116
|
-
:MatrixRotate,
|
117
|
-
:MatrixRotateX,
|
118
|
-
:MatrixRotateY,
|
119
|
-
:MatrixRotateZ,
|
120
|
-
:MatrixRotateXYZ,
|
121
|
-
:MatrixRotateZYX,
|
122
|
-
:MatrixScale,
|
123
|
-
:MatrixFrustum,
|
124
|
-
:MatrixPerspective,
|
125
|
-
:MatrixOrtho,
|
126
|
-
:MatrixLookAt,
|
127
|
-
:MatrixToFloatV,
|
128
|
-
:QuaternionAdd,
|
129
|
-
:QuaternionAddValue,
|
130
|
-
:QuaternionSubtract,
|
131
|
-
:QuaternionSubtractValue,
|
132
|
-
:QuaternionIdentity,
|
133
|
-
:QuaternionLength,
|
134
|
-
:QuaternionNormalize,
|
135
|
-
:QuaternionInvert,
|
136
|
-
:QuaternionMultiply,
|
137
|
-
:QuaternionScale,
|
138
|
-
:QuaternionDivide,
|
139
|
-
:QuaternionLerp,
|
140
|
-
:QuaternionNlerp,
|
141
|
-
:QuaternionSlerp,
|
142
|
-
:QuaternionFromVector3ToVector3,
|
143
|
-
:QuaternionFromMatrix,
|
144
|
-
:QuaternionToMatrix,
|
145
|
-
:QuaternionFromAxisAngle,
|
146
|
-
:QuaternionToAxisAngle,
|
147
|
-
:QuaternionFromEuler,
|
148
|
-
:QuaternionToEuler,
|
149
|
-
:QuaternionTransform,
|
150
|
-
:QuaternionEquals,
|
151
|
-
]
|
152
|
-
args = {
|
153
|
-
:Clamp => [:float, :float, :float],
|
154
|
-
:Lerp => [:float, :float, :float],
|
155
|
-
:Normalize => [:float, :float, :float],
|
156
|
-
:Remap => [:float, :float, :float, :float, :float],
|
157
|
-
:Wrap => [:float, :float, :float],
|
158
|
-
:FloatEquals => [:float, :float],
|
159
|
-
:Vector2Zero => [],
|
160
|
-
:Vector2One => [],
|
161
|
-
:Vector2Add => [Vector2.by_value, Vector2.by_value],
|
162
|
-
:Vector2AddValue => [Vector2.by_value, :float],
|
163
|
-
:Vector2Subtract => [Vector2.by_value, Vector2.by_value],
|
164
|
-
:Vector2SubtractValue => [Vector2.by_value, :float],
|
165
|
-
:Vector2Length => [Vector2.by_value],
|
166
|
-
:Vector2LengthSqr => [Vector2.by_value],
|
167
|
-
:Vector2DotProduct => [Vector2.by_value, Vector2.by_value],
|
168
|
-
:Vector2Distance => [Vector2.by_value, Vector2.by_value],
|
169
|
-
:Vector2DistanceSqr => [Vector2.by_value, Vector2.by_value],
|
170
|
-
:Vector2Angle => [Vector2.by_value, Vector2.by_value],
|
171
|
-
:Vector2Scale => [Vector2.by_value, :float],
|
172
|
-
:Vector2Multiply => [Vector2.by_value, Vector2.by_value],
|
173
|
-
:Vector2Negate => [Vector2.by_value],
|
174
|
-
:Vector2Divide => [Vector2.by_value, Vector2.by_value],
|
175
|
-
:Vector2Normalize => [Vector2.by_value],
|
176
|
-
:Vector2Transform => [Vector2.by_value, Matrix.by_value],
|
177
|
-
:Vector2Lerp => [Vector2.by_value, Vector2.by_value, :float],
|
178
|
-
:Vector2Reflect => [Vector2.by_value, Vector2.by_value],
|
179
|
-
:Vector2Rotate => [Vector2.by_value, :float],
|
180
|
-
:Vector2MoveTowards => [Vector2.by_value, Vector2.by_value, :float],
|
181
|
-
:Vector2Invert => [Vector2.by_value],
|
182
|
-
:Vector2Clamp => [Vector2.by_value, Vector2.by_value, Vector2.by_value],
|
183
|
-
:Vector2ClampValue => [Vector2.by_value, :float, :float],
|
184
|
-
:Vector2Equals => [Vector2.by_value, Vector2.by_value],
|
185
|
-
:Vector3Zero => [],
|
186
|
-
:Vector3One => [],
|
187
|
-
:Vector3Add => [Vector3.by_value, Vector3.by_value],
|
188
|
-
:Vector3AddValue => [Vector3.by_value, :float],
|
189
|
-
:Vector3Subtract => [Vector3.by_value, Vector3.by_value],
|
190
|
-
:Vector3SubtractValue => [Vector3.by_value, :float],
|
191
|
-
:Vector3Scale => [Vector3.by_value, :float],
|
192
|
-
:Vector3Multiply => [Vector3.by_value, Vector3.by_value],
|
193
|
-
:Vector3CrossProduct => [Vector3.by_value, Vector3.by_value],
|
194
|
-
:Vector3Perpendicular => [Vector3.by_value],
|
195
|
-
:Vector3Length => [Vector3.by_value],
|
196
|
-
:Vector3LengthSqr => [Vector3.by_value],
|
197
|
-
:Vector3DotProduct => [Vector3.by_value, Vector3.by_value],
|
198
|
-
:Vector3Distance => [Vector3.by_value, Vector3.by_value],
|
199
|
-
:Vector3DistanceSqr => [Vector3.by_value, Vector3.by_value],
|
200
|
-
:Vector3Angle => [Vector3.by_value, Vector3.by_value],
|
201
|
-
:Vector3Negate => [Vector3.by_value],
|
202
|
-
:Vector3Divide => [Vector3.by_value, Vector3.by_value],
|
203
|
-
:Vector3Normalize => [Vector3.by_value],
|
204
|
-
:Vector3OrthoNormalize => [:pointer, :pointer],
|
205
|
-
:Vector3Transform => [Vector3.by_value, Matrix.by_value],
|
206
|
-
:Vector3RotateByQuaternion => [Vector3.by_value, Quaternion.by_value],
|
207
|
-
:Vector3RotateByAxisAngle => [Vector3.by_value, Vector3.by_value, :float],
|
208
|
-
:Vector3Lerp => [Vector3.by_value, Vector3.by_value, :float],
|
209
|
-
:Vector3Reflect => [Vector3.by_value, Vector3.by_value],
|
210
|
-
:Vector3Min => [Vector3.by_value, Vector3.by_value],
|
211
|
-
:Vector3Max => [Vector3.by_value, Vector3.by_value],
|
212
|
-
:Vector3Barycenter => [Vector3.by_value, Vector3.by_value, Vector3.by_value, Vector3.by_value],
|
213
|
-
:Vector3Unproject => [Vector3.by_value, Matrix.by_value, Matrix.by_value],
|
214
|
-
:Vector3ToFloatV => [Vector3.by_value],
|
215
|
-
:Vector3Invert => [Vector3.by_value],
|
216
|
-
:Vector3Clamp => [Vector3.by_value, Vector3.by_value, Vector3.by_value],
|
217
|
-
:Vector3ClampValue => [Vector3.by_value, :float, :float],
|
218
|
-
:Vector3Equals => [Vector3.by_value, Vector3.by_value],
|
219
|
-
:Vector3Refract => [Vector3.by_value, Vector3.by_value, :float],
|
220
|
-
:MatrixDeterminant => [Matrix.by_value],
|
221
|
-
:MatrixTrace => [Matrix.by_value],
|
222
|
-
:MatrixTranspose => [Matrix.by_value],
|
223
|
-
:MatrixInvert => [Matrix.by_value],
|
224
|
-
:MatrixIdentity => [],
|
225
|
-
:MatrixAdd => [Matrix.by_value, Matrix.by_value],
|
226
|
-
:MatrixSubtract => [Matrix.by_value, Matrix.by_value],
|
227
|
-
:MatrixMultiply => [Matrix.by_value, Matrix.by_value],
|
228
|
-
:MatrixTranslate => [:float, :float, :float],
|
229
|
-
:MatrixRotate => [Vector3.by_value, :float],
|
230
|
-
:MatrixRotateX => [:float],
|
231
|
-
:MatrixRotateY => [:float],
|
232
|
-
:MatrixRotateZ => [:float],
|
233
|
-
:MatrixRotateXYZ => [Vector3.by_value],
|
234
|
-
:MatrixRotateZYX => [Vector3.by_value],
|
235
|
-
:MatrixScale => [:float, :float, :float],
|
236
|
-
:MatrixFrustum => [:double, :double, :double, :double, :double, :double],
|
237
|
-
:MatrixPerspective => [:double, :double, :double, :double],
|
238
|
-
:MatrixOrtho => [:double, :double, :double, :double, :double, :double],
|
239
|
-
:MatrixLookAt => [Vector3.by_value, Vector3.by_value, Vector3.by_value],
|
240
|
-
:MatrixToFloatV => [Matrix.by_value],
|
241
|
-
:QuaternionAdd => [Quaternion.by_value, Quaternion.by_value],
|
242
|
-
:QuaternionAddValue => [Quaternion.by_value, :float],
|
243
|
-
:QuaternionSubtract => [Quaternion.by_value, Quaternion.by_value],
|
244
|
-
:QuaternionSubtractValue => [Quaternion.by_value, :float],
|
245
|
-
:QuaternionIdentity => [],
|
246
|
-
:QuaternionLength => [Quaternion.by_value],
|
247
|
-
:QuaternionNormalize => [Quaternion.by_value],
|
248
|
-
:QuaternionInvert => [Quaternion.by_value],
|
249
|
-
:QuaternionMultiply => [Quaternion.by_value, Quaternion.by_value],
|
250
|
-
:QuaternionScale => [Quaternion.by_value, :float],
|
251
|
-
:QuaternionDivide => [Quaternion.by_value, Quaternion.by_value],
|
252
|
-
:QuaternionLerp => [Quaternion.by_value, Quaternion.by_value, :float],
|
253
|
-
:QuaternionNlerp => [Quaternion.by_value, Quaternion.by_value, :float],
|
254
|
-
:QuaternionSlerp => [Quaternion.by_value, Quaternion.by_value, :float],
|
255
|
-
:QuaternionFromVector3ToVector3 => [Vector3.by_value, Vector3.by_value],
|
256
|
-
:QuaternionFromMatrix => [Matrix.by_value],
|
257
|
-
:QuaternionToMatrix => [Quaternion.by_value],
|
258
|
-
:QuaternionFromAxisAngle => [Vector3.by_value, :float],
|
259
|
-
:QuaternionToAxisAngle => [Quaternion.by_value, :pointer, :pointer],
|
260
|
-
:QuaternionFromEuler => [:float, :float, :float],
|
261
|
-
:QuaternionToEuler => [Quaternion.by_value],
|
262
|
-
:QuaternionTransform => [Quaternion.by_value, Matrix.by_value],
|
263
|
-
:QuaternionEquals => [Quaternion.by_value, Quaternion.by_value],
|
264
|
-
}
|
265
|
-
retvals = {
|
266
|
-
:Clamp => :float,
|
267
|
-
:Lerp => :float,
|
268
|
-
:Normalize => :float,
|
269
|
-
:Remap => :float,
|
270
|
-
:Wrap => :float,
|
271
|
-
:FloatEquals => :int,
|
272
|
-
:Vector2Zero => Vector2.by_value,
|
273
|
-
:Vector2One => Vector2.by_value,
|
274
|
-
:Vector2Add => Vector2.by_value,
|
275
|
-
:Vector2AddValue => Vector2.by_value,
|
276
|
-
:Vector2Subtract => Vector2.by_value,
|
277
|
-
:Vector2SubtractValue => Vector2.by_value,
|
278
|
-
:Vector2Length => :float,
|
279
|
-
:Vector2LengthSqr => :float,
|
280
|
-
:Vector2DotProduct => :float,
|
281
|
-
:Vector2Distance => :float,
|
282
|
-
:Vector2DistanceSqr => :float,
|
283
|
-
:Vector2Angle => :float,
|
284
|
-
:Vector2Scale => Vector2.by_value,
|
285
|
-
:Vector2Multiply => Vector2.by_value,
|
286
|
-
:Vector2Negate => Vector2.by_value,
|
287
|
-
:Vector2Divide => Vector2.by_value,
|
288
|
-
:Vector2Normalize => Vector2.by_value,
|
289
|
-
:Vector2Transform => Vector2.by_value,
|
290
|
-
:Vector2Lerp => Vector2.by_value,
|
291
|
-
:Vector2Reflect => Vector2.by_value,
|
292
|
-
:Vector2Rotate => Vector2.by_value,
|
293
|
-
:Vector2MoveTowards => Vector2.by_value,
|
294
|
-
:Vector2Invert => Vector2.by_value,
|
295
|
-
:Vector2Clamp => Vector2.by_value,
|
296
|
-
:Vector2ClampValue => Vector2.by_value,
|
297
|
-
:Vector2Equals => :int,
|
298
|
-
:Vector3Zero => Vector3.by_value,
|
299
|
-
:Vector3One => Vector3.by_value,
|
300
|
-
:Vector3Add => Vector3.by_value,
|
301
|
-
:Vector3AddValue => Vector3.by_value,
|
302
|
-
:Vector3Subtract => Vector3.by_value,
|
303
|
-
:Vector3SubtractValue => Vector3.by_value,
|
304
|
-
:Vector3Scale => Vector3.by_value,
|
305
|
-
:Vector3Multiply => Vector3.by_value,
|
306
|
-
:Vector3CrossProduct => Vector3.by_value,
|
307
|
-
:Vector3Perpendicular => Vector3.by_value,
|
308
|
-
:Vector3Length => :float,
|
309
|
-
:Vector3LengthSqr => :float,
|
310
|
-
:Vector3DotProduct => :float,
|
311
|
-
:Vector3Distance => :float,
|
312
|
-
:Vector3DistanceSqr => :float,
|
313
|
-
:Vector3Angle => :float,
|
314
|
-
:Vector3Negate => Vector3.by_value,
|
315
|
-
:Vector3Divide => Vector3.by_value,
|
316
|
-
:Vector3Normalize => Vector3.by_value,
|
317
|
-
:Vector3OrthoNormalize => :void,
|
318
|
-
:Vector3Transform => Vector3.by_value,
|
319
|
-
:Vector3RotateByQuaternion => Vector3.by_value,
|
320
|
-
:Vector3RotateByAxisAngle => Vector3.by_value,
|
321
|
-
:Vector3Lerp => Vector3.by_value,
|
322
|
-
:Vector3Reflect => Vector3.by_value,
|
323
|
-
:Vector3Min => Vector3.by_value,
|
324
|
-
:Vector3Max => Vector3.by_value,
|
325
|
-
:Vector3Barycenter => Vector3.by_value,
|
326
|
-
:Vector3Unproject => Vector3.by_value,
|
327
|
-
:Vector3ToFloatV => Float3.by_value,
|
328
|
-
:Vector3Invert => Vector3.by_value,
|
329
|
-
:Vector3Clamp => Vector3.by_value,
|
330
|
-
:Vector3ClampValue => Vector3.by_value,
|
331
|
-
:Vector3Equals => :int,
|
332
|
-
:Vector3Refract => Vector3.by_value,
|
333
|
-
:MatrixDeterminant => :float,
|
334
|
-
:MatrixTrace => :float,
|
335
|
-
:MatrixTranspose => Matrix.by_value,
|
336
|
-
:MatrixInvert => Matrix.by_value,
|
337
|
-
:MatrixIdentity => Matrix.by_value,
|
338
|
-
:MatrixAdd => Matrix.by_value,
|
339
|
-
:MatrixSubtract => Matrix.by_value,
|
340
|
-
:MatrixMultiply => Matrix.by_value,
|
341
|
-
:MatrixTranslate => Matrix.by_value,
|
342
|
-
:MatrixRotate => Matrix.by_value,
|
343
|
-
:MatrixRotateX => Matrix.by_value,
|
344
|
-
:MatrixRotateY => Matrix.by_value,
|
345
|
-
:MatrixRotateZ => Matrix.by_value,
|
346
|
-
:MatrixRotateXYZ => Matrix.by_value,
|
347
|
-
:MatrixRotateZYX => Matrix.by_value,
|
348
|
-
:MatrixScale => Matrix.by_value,
|
349
|
-
:MatrixFrustum => Matrix.by_value,
|
350
|
-
:MatrixPerspective => Matrix.by_value,
|
351
|
-
:MatrixOrtho => Matrix.by_value,
|
352
|
-
:MatrixLookAt => Matrix.by_value,
|
353
|
-
:MatrixToFloatV => Float16.by_value,
|
354
|
-
:QuaternionAdd => Quaternion.by_value,
|
355
|
-
:QuaternionAddValue => Quaternion.by_value,
|
356
|
-
:QuaternionSubtract => Quaternion.by_value,
|
357
|
-
:QuaternionSubtractValue => Quaternion.by_value,
|
358
|
-
:QuaternionIdentity => Quaternion.by_value,
|
359
|
-
:QuaternionLength => :float,
|
360
|
-
:QuaternionNormalize => Quaternion.by_value,
|
361
|
-
:QuaternionInvert => Quaternion.by_value,
|
362
|
-
:QuaternionMultiply => Quaternion.by_value,
|
363
|
-
:QuaternionScale => Quaternion.by_value,
|
364
|
-
:QuaternionDivide => Quaternion.by_value,
|
365
|
-
:QuaternionLerp => Quaternion.by_value,
|
366
|
-
:QuaternionNlerp => Quaternion.by_value,
|
367
|
-
:QuaternionSlerp => Quaternion.by_value,
|
368
|
-
:QuaternionFromVector3ToVector3 => Quaternion.by_value,
|
369
|
-
:QuaternionFromMatrix => Quaternion.by_value,
|
370
|
-
:QuaternionToMatrix => Matrix.by_value,
|
371
|
-
:QuaternionFromAxisAngle => Quaternion.by_value,
|
372
|
-
:QuaternionToAxisAngle => :void,
|
373
|
-
:QuaternionFromEuler => Quaternion.by_value,
|
374
|
-
:QuaternionToEuler => Vector3.by_value,
|
375
|
-
:QuaternionTransform => Quaternion.by_value,
|
376
|
-
:QuaternionEquals => :int,
|
377
|
-
}
|
378
|
-
symbols.each do |sym|
|
379
|
-
begin
|
380
|
-
attach_function sym, args[sym], retvals[sym]
|
381
|
-
rescue FFI::NotFoundError => error
|
382
|
-
$stderr.puts("[Warning] Failed to import #{sym} (#{error}).")
|
383
|
-
end
|
384
|
-
end
|
385
|
-
end
|
386
|
-
|
387
|
-
end
|
388
|
-
|
1
|
+
# Yet another raylib wrapper for Ruby
|
2
|
+
#
|
3
|
+
# * https://github.com/vaiorabbit/raylib-bindings
|
4
|
+
#
|
5
|
+
# [NOTICE] This is an automatically generated file.
|
6
|
+
|
7
|
+
require 'ffi'
|
8
|
+
|
9
|
+
module Raylib
|
10
|
+
extend FFI::Library
|
11
|
+
# Define/Macro
|
12
|
+
|
13
|
+
EPSILON = 0.000001
|
14
|
+
|
15
|
+
# Enum
|
16
|
+
|
17
|
+
|
18
|
+
# Typedef
|
19
|
+
|
20
|
+
|
21
|
+
# Struct
|
22
|
+
|
23
|
+
class Float3 < FFI::Struct
|
24
|
+
layout(
|
25
|
+
:v, [:float, 3],
|
26
|
+
)
|
27
|
+
end
|
28
|
+
|
29
|
+
class Float16 < FFI::Struct
|
30
|
+
layout(
|
31
|
+
:v, [:float, 16],
|
32
|
+
)
|
33
|
+
end
|
34
|
+
|
35
|
+
|
36
|
+
# Function
|
37
|
+
|
38
|
+
def self.setup_raymath_symbols()
|
39
|
+
symbols = [
|
40
|
+
:Clamp,
|
41
|
+
:Lerp,
|
42
|
+
:Normalize,
|
43
|
+
:Remap,
|
44
|
+
:Wrap,
|
45
|
+
:FloatEquals,
|
46
|
+
:Vector2Zero,
|
47
|
+
:Vector2One,
|
48
|
+
:Vector2Add,
|
49
|
+
:Vector2AddValue,
|
50
|
+
:Vector2Subtract,
|
51
|
+
:Vector2SubtractValue,
|
52
|
+
:Vector2Length,
|
53
|
+
:Vector2LengthSqr,
|
54
|
+
:Vector2DotProduct,
|
55
|
+
:Vector2Distance,
|
56
|
+
:Vector2DistanceSqr,
|
57
|
+
:Vector2Angle,
|
58
|
+
:Vector2Scale,
|
59
|
+
:Vector2Multiply,
|
60
|
+
:Vector2Negate,
|
61
|
+
:Vector2Divide,
|
62
|
+
:Vector2Normalize,
|
63
|
+
:Vector2Transform,
|
64
|
+
:Vector2Lerp,
|
65
|
+
:Vector2Reflect,
|
66
|
+
:Vector2Rotate,
|
67
|
+
:Vector2MoveTowards,
|
68
|
+
:Vector2Invert,
|
69
|
+
:Vector2Clamp,
|
70
|
+
:Vector2ClampValue,
|
71
|
+
:Vector2Equals,
|
72
|
+
:Vector3Zero,
|
73
|
+
:Vector3One,
|
74
|
+
:Vector3Add,
|
75
|
+
:Vector3AddValue,
|
76
|
+
:Vector3Subtract,
|
77
|
+
:Vector3SubtractValue,
|
78
|
+
:Vector3Scale,
|
79
|
+
:Vector3Multiply,
|
80
|
+
:Vector3CrossProduct,
|
81
|
+
:Vector3Perpendicular,
|
82
|
+
:Vector3Length,
|
83
|
+
:Vector3LengthSqr,
|
84
|
+
:Vector3DotProduct,
|
85
|
+
:Vector3Distance,
|
86
|
+
:Vector3DistanceSqr,
|
87
|
+
:Vector3Angle,
|
88
|
+
:Vector3Negate,
|
89
|
+
:Vector3Divide,
|
90
|
+
:Vector3Normalize,
|
91
|
+
:Vector3OrthoNormalize,
|
92
|
+
:Vector3Transform,
|
93
|
+
:Vector3RotateByQuaternion,
|
94
|
+
:Vector3RotateByAxisAngle,
|
95
|
+
:Vector3Lerp,
|
96
|
+
:Vector3Reflect,
|
97
|
+
:Vector3Min,
|
98
|
+
:Vector3Max,
|
99
|
+
:Vector3Barycenter,
|
100
|
+
:Vector3Unproject,
|
101
|
+
:Vector3ToFloatV,
|
102
|
+
:Vector3Invert,
|
103
|
+
:Vector3Clamp,
|
104
|
+
:Vector3ClampValue,
|
105
|
+
:Vector3Equals,
|
106
|
+
:Vector3Refract,
|
107
|
+
:MatrixDeterminant,
|
108
|
+
:MatrixTrace,
|
109
|
+
:MatrixTranspose,
|
110
|
+
:MatrixInvert,
|
111
|
+
:MatrixIdentity,
|
112
|
+
:MatrixAdd,
|
113
|
+
:MatrixSubtract,
|
114
|
+
:MatrixMultiply,
|
115
|
+
:MatrixTranslate,
|
116
|
+
:MatrixRotate,
|
117
|
+
:MatrixRotateX,
|
118
|
+
:MatrixRotateY,
|
119
|
+
:MatrixRotateZ,
|
120
|
+
:MatrixRotateXYZ,
|
121
|
+
:MatrixRotateZYX,
|
122
|
+
:MatrixScale,
|
123
|
+
:MatrixFrustum,
|
124
|
+
:MatrixPerspective,
|
125
|
+
:MatrixOrtho,
|
126
|
+
:MatrixLookAt,
|
127
|
+
:MatrixToFloatV,
|
128
|
+
:QuaternionAdd,
|
129
|
+
:QuaternionAddValue,
|
130
|
+
:QuaternionSubtract,
|
131
|
+
:QuaternionSubtractValue,
|
132
|
+
:QuaternionIdentity,
|
133
|
+
:QuaternionLength,
|
134
|
+
:QuaternionNormalize,
|
135
|
+
:QuaternionInvert,
|
136
|
+
:QuaternionMultiply,
|
137
|
+
:QuaternionScale,
|
138
|
+
:QuaternionDivide,
|
139
|
+
:QuaternionLerp,
|
140
|
+
:QuaternionNlerp,
|
141
|
+
:QuaternionSlerp,
|
142
|
+
:QuaternionFromVector3ToVector3,
|
143
|
+
:QuaternionFromMatrix,
|
144
|
+
:QuaternionToMatrix,
|
145
|
+
:QuaternionFromAxisAngle,
|
146
|
+
:QuaternionToAxisAngle,
|
147
|
+
:QuaternionFromEuler,
|
148
|
+
:QuaternionToEuler,
|
149
|
+
:QuaternionTransform,
|
150
|
+
:QuaternionEquals,
|
151
|
+
]
|
152
|
+
args = {
|
153
|
+
:Clamp => [:float, :float, :float],
|
154
|
+
:Lerp => [:float, :float, :float],
|
155
|
+
:Normalize => [:float, :float, :float],
|
156
|
+
:Remap => [:float, :float, :float, :float, :float],
|
157
|
+
:Wrap => [:float, :float, :float],
|
158
|
+
:FloatEquals => [:float, :float],
|
159
|
+
:Vector2Zero => [],
|
160
|
+
:Vector2One => [],
|
161
|
+
:Vector2Add => [Vector2.by_value, Vector2.by_value],
|
162
|
+
:Vector2AddValue => [Vector2.by_value, :float],
|
163
|
+
:Vector2Subtract => [Vector2.by_value, Vector2.by_value],
|
164
|
+
:Vector2SubtractValue => [Vector2.by_value, :float],
|
165
|
+
:Vector2Length => [Vector2.by_value],
|
166
|
+
:Vector2LengthSqr => [Vector2.by_value],
|
167
|
+
:Vector2DotProduct => [Vector2.by_value, Vector2.by_value],
|
168
|
+
:Vector2Distance => [Vector2.by_value, Vector2.by_value],
|
169
|
+
:Vector2DistanceSqr => [Vector2.by_value, Vector2.by_value],
|
170
|
+
:Vector2Angle => [Vector2.by_value, Vector2.by_value],
|
171
|
+
:Vector2Scale => [Vector2.by_value, :float],
|
172
|
+
:Vector2Multiply => [Vector2.by_value, Vector2.by_value],
|
173
|
+
:Vector2Negate => [Vector2.by_value],
|
174
|
+
:Vector2Divide => [Vector2.by_value, Vector2.by_value],
|
175
|
+
:Vector2Normalize => [Vector2.by_value],
|
176
|
+
:Vector2Transform => [Vector2.by_value, Matrix.by_value],
|
177
|
+
:Vector2Lerp => [Vector2.by_value, Vector2.by_value, :float],
|
178
|
+
:Vector2Reflect => [Vector2.by_value, Vector2.by_value],
|
179
|
+
:Vector2Rotate => [Vector2.by_value, :float],
|
180
|
+
:Vector2MoveTowards => [Vector2.by_value, Vector2.by_value, :float],
|
181
|
+
:Vector2Invert => [Vector2.by_value],
|
182
|
+
:Vector2Clamp => [Vector2.by_value, Vector2.by_value, Vector2.by_value],
|
183
|
+
:Vector2ClampValue => [Vector2.by_value, :float, :float],
|
184
|
+
:Vector2Equals => [Vector2.by_value, Vector2.by_value],
|
185
|
+
:Vector3Zero => [],
|
186
|
+
:Vector3One => [],
|
187
|
+
:Vector3Add => [Vector3.by_value, Vector3.by_value],
|
188
|
+
:Vector3AddValue => [Vector3.by_value, :float],
|
189
|
+
:Vector3Subtract => [Vector3.by_value, Vector3.by_value],
|
190
|
+
:Vector3SubtractValue => [Vector3.by_value, :float],
|
191
|
+
:Vector3Scale => [Vector3.by_value, :float],
|
192
|
+
:Vector3Multiply => [Vector3.by_value, Vector3.by_value],
|
193
|
+
:Vector3CrossProduct => [Vector3.by_value, Vector3.by_value],
|
194
|
+
:Vector3Perpendicular => [Vector3.by_value],
|
195
|
+
:Vector3Length => [Vector3.by_value],
|
196
|
+
:Vector3LengthSqr => [Vector3.by_value],
|
197
|
+
:Vector3DotProduct => [Vector3.by_value, Vector3.by_value],
|
198
|
+
:Vector3Distance => [Vector3.by_value, Vector3.by_value],
|
199
|
+
:Vector3DistanceSqr => [Vector3.by_value, Vector3.by_value],
|
200
|
+
:Vector3Angle => [Vector3.by_value, Vector3.by_value],
|
201
|
+
:Vector3Negate => [Vector3.by_value],
|
202
|
+
:Vector3Divide => [Vector3.by_value, Vector3.by_value],
|
203
|
+
:Vector3Normalize => [Vector3.by_value],
|
204
|
+
:Vector3OrthoNormalize => [:pointer, :pointer],
|
205
|
+
:Vector3Transform => [Vector3.by_value, Matrix.by_value],
|
206
|
+
:Vector3RotateByQuaternion => [Vector3.by_value, Quaternion.by_value],
|
207
|
+
:Vector3RotateByAxisAngle => [Vector3.by_value, Vector3.by_value, :float],
|
208
|
+
:Vector3Lerp => [Vector3.by_value, Vector3.by_value, :float],
|
209
|
+
:Vector3Reflect => [Vector3.by_value, Vector3.by_value],
|
210
|
+
:Vector3Min => [Vector3.by_value, Vector3.by_value],
|
211
|
+
:Vector3Max => [Vector3.by_value, Vector3.by_value],
|
212
|
+
:Vector3Barycenter => [Vector3.by_value, Vector3.by_value, Vector3.by_value, Vector3.by_value],
|
213
|
+
:Vector3Unproject => [Vector3.by_value, Matrix.by_value, Matrix.by_value],
|
214
|
+
:Vector3ToFloatV => [Vector3.by_value],
|
215
|
+
:Vector3Invert => [Vector3.by_value],
|
216
|
+
:Vector3Clamp => [Vector3.by_value, Vector3.by_value, Vector3.by_value],
|
217
|
+
:Vector3ClampValue => [Vector3.by_value, :float, :float],
|
218
|
+
:Vector3Equals => [Vector3.by_value, Vector3.by_value],
|
219
|
+
:Vector3Refract => [Vector3.by_value, Vector3.by_value, :float],
|
220
|
+
:MatrixDeterminant => [Matrix.by_value],
|
221
|
+
:MatrixTrace => [Matrix.by_value],
|
222
|
+
:MatrixTranspose => [Matrix.by_value],
|
223
|
+
:MatrixInvert => [Matrix.by_value],
|
224
|
+
:MatrixIdentity => [],
|
225
|
+
:MatrixAdd => [Matrix.by_value, Matrix.by_value],
|
226
|
+
:MatrixSubtract => [Matrix.by_value, Matrix.by_value],
|
227
|
+
:MatrixMultiply => [Matrix.by_value, Matrix.by_value],
|
228
|
+
:MatrixTranslate => [:float, :float, :float],
|
229
|
+
:MatrixRotate => [Vector3.by_value, :float],
|
230
|
+
:MatrixRotateX => [:float],
|
231
|
+
:MatrixRotateY => [:float],
|
232
|
+
:MatrixRotateZ => [:float],
|
233
|
+
:MatrixRotateXYZ => [Vector3.by_value],
|
234
|
+
:MatrixRotateZYX => [Vector3.by_value],
|
235
|
+
:MatrixScale => [:float, :float, :float],
|
236
|
+
:MatrixFrustum => [:double, :double, :double, :double, :double, :double],
|
237
|
+
:MatrixPerspective => [:double, :double, :double, :double],
|
238
|
+
:MatrixOrtho => [:double, :double, :double, :double, :double, :double],
|
239
|
+
:MatrixLookAt => [Vector3.by_value, Vector3.by_value, Vector3.by_value],
|
240
|
+
:MatrixToFloatV => [Matrix.by_value],
|
241
|
+
:QuaternionAdd => [Quaternion.by_value, Quaternion.by_value],
|
242
|
+
:QuaternionAddValue => [Quaternion.by_value, :float],
|
243
|
+
:QuaternionSubtract => [Quaternion.by_value, Quaternion.by_value],
|
244
|
+
:QuaternionSubtractValue => [Quaternion.by_value, :float],
|
245
|
+
:QuaternionIdentity => [],
|
246
|
+
:QuaternionLength => [Quaternion.by_value],
|
247
|
+
:QuaternionNormalize => [Quaternion.by_value],
|
248
|
+
:QuaternionInvert => [Quaternion.by_value],
|
249
|
+
:QuaternionMultiply => [Quaternion.by_value, Quaternion.by_value],
|
250
|
+
:QuaternionScale => [Quaternion.by_value, :float],
|
251
|
+
:QuaternionDivide => [Quaternion.by_value, Quaternion.by_value],
|
252
|
+
:QuaternionLerp => [Quaternion.by_value, Quaternion.by_value, :float],
|
253
|
+
:QuaternionNlerp => [Quaternion.by_value, Quaternion.by_value, :float],
|
254
|
+
:QuaternionSlerp => [Quaternion.by_value, Quaternion.by_value, :float],
|
255
|
+
:QuaternionFromVector3ToVector3 => [Vector3.by_value, Vector3.by_value],
|
256
|
+
:QuaternionFromMatrix => [Matrix.by_value],
|
257
|
+
:QuaternionToMatrix => [Quaternion.by_value],
|
258
|
+
:QuaternionFromAxisAngle => [Vector3.by_value, :float],
|
259
|
+
:QuaternionToAxisAngle => [Quaternion.by_value, :pointer, :pointer],
|
260
|
+
:QuaternionFromEuler => [:float, :float, :float],
|
261
|
+
:QuaternionToEuler => [Quaternion.by_value],
|
262
|
+
:QuaternionTransform => [Quaternion.by_value, Matrix.by_value],
|
263
|
+
:QuaternionEquals => [Quaternion.by_value, Quaternion.by_value],
|
264
|
+
}
|
265
|
+
retvals = {
|
266
|
+
:Clamp => :float,
|
267
|
+
:Lerp => :float,
|
268
|
+
:Normalize => :float,
|
269
|
+
:Remap => :float,
|
270
|
+
:Wrap => :float,
|
271
|
+
:FloatEquals => :int,
|
272
|
+
:Vector2Zero => Vector2.by_value,
|
273
|
+
:Vector2One => Vector2.by_value,
|
274
|
+
:Vector2Add => Vector2.by_value,
|
275
|
+
:Vector2AddValue => Vector2.by_value,
|
276
|
+
:Vector2Subtract => Vector2.by_value,
|
277
|
+
:Vector2SubtractValue => Vector2.by_value,
|
278
|
+
:Vector2Length => :float,
|
279
|
+
:Vector2LengthSqr => :float,
|
280
|
+
:Vector2DotProduct => :float,
|
281
|
+
:Vector2Distance => :float,
|
282
|
+
:Vector2DistanceSqr => :float,
|
283
|
+
:Vector2Angle => :float,
|
284
|
+
:Vector2Scale => Vector2.by_value,
|
285
|
+
:Vector2Multiply => Vector2.by_value,
|
286
|
+
:Vector2Negate => Vector2.by_value,
|
287
|
+
:Vector2Divide => Vector2.by_value,
|
288
|
+
:Vector2Normalize => Vector2.by_value,
|
289
|
+
:Vector2Transform => Vector2.by_value,
|
290
|
+
:Vector2Lerp => Vector2.by_value,
|
291
|
+
:Vector2Reflect => Vector2.by_value,
|
292
|
+
:Vector2Rotate => Vector2.by_value,
|
293
|
+
:Vector2MoveTowards => Vector2.by_value,
|
294
|
+
:Vector2Invert => Vector2.by_value,
|
295
|
+
:Vector2Clamp => Vector2.by_value,
|
296
|
+
:Vector2ClampValue => Vector2.by_value,
|
297
|
+
:Vector2Equals => :int,
|
298
|
+
:Vector3Zero => Vector3.by_value,
|
299
|
+
:Vector3One => Vector3.by_value,
|
300
|
+
:Vector3Add => Vector3.by_value,
|
301
|
+
:Vector3AddValue => Vector3.by_value,
|
302
|
+
:Vector3Subtract => Vector3.by_value,
|
303
|
+
:Vector3SubtractValue => Vector3.by_value,
|
304
|
+
:Vector3Scale => Vector3.by_value,
|
305
|
+
:Vector3Multiply => Vector3.by_value,
|
306
|
+
:Vector3CrossProduct => Vector3.by_value,
|
307
|
+
:Vector3Perpendicular => Vector3.by_value,
|
308
|
+
:Vector3Length => :float,
|
309
|
+
:Vector3LengthSqr => :float,
|
310
|
+
:Vector3DotProduct => :float,
|
311
|
+
:Vector3Distance => :float,
|
312
|
+
:Vector3DistanceSqr => :float,
|
313
|
+
:Vector3Angle => :float,
|
314
|
+
:Vector3Negate => Vector3.by_value,
|
315
|
+
:Vector3Divide => Vector3.by_value,
|
316
|
+
:Vector3Normalize => Vector3.by_value,
|
317
|
+
:Vector3OrthoNormalize => :void,
|
318
|
+
:Vector3Transform => Vector3.by_value,
|
319
|
+
:Vector3RotateByQuaternion => Vector3.by_value,
|
320
|
+
:Vector3RotateByAxisAngle => Vector3.by_value,
|
321
|
+
:Vector3Lerp => Vector3.by_value,
|
322
|
+
:Vector3Reflect => Vector3.by_value,
|
323
|
+
:Vector3Min => Vector3.by_value,
|
324
|
+
:Vector3Max => Vector3.by_value,
|
325
|
+
:Vector3Barycenter => Vector3.by_value,
|
326
|
+
:Vector3Unproject => Vector3.by_value,
|
327
|
+
:Vector3ToFloatV => Float3.by_value,
|
328
|
+
:Vector3Invert => Vector3.by_value,
|
329
|
+
:Vector3Clamp => Vector3.by_value,
|
330
|
+
:Vector3ClampValue => Vector3.by_value,
|
331
|
+
:Vector3Equals => :int,
|
332
|
+
:Vector3Refract => Vector3.by_value,
|
333
|
+
:MatrixDeterminant => :float,
|
334
|
+
:MatrixTrace => :float,
|
335
|
+
:MatrixTranspose => Matrix.by_value,
|
336
|
+
:MatrixInvert => Matrix.by_value,
|
337
|
+
:MatrixIdentity => Matrix.by_value,
|
338
|
+
:MatrixAdd => Matrix.by_value,
|
339
|
+
:MatrixSubtract => Matrix.by_value,
|
340
|
+
:MatrixMultiply => Matrix.by_value,
|
341
|
+
:MatrixTranslate => Matrix.by_value,
|
342
|
+
:MatrixRotate => Matrix.by_value,
|
343
|
+
:MatrixRotateX => Matrix.by_value,
|
344
|
+
:MatrixRotateY => Matrix.by_value,
|
345
|
+
:MatrixRotateZ => Matrix.by_value,
|
346
|
+
:MatrixRotateXYZ => Matrix.by_value,
|
347
|
+
:MatrixRotateZYX => Matrix.by_value,
|
348
|
+
:MatrixScale => Matrix.by_value,
|
349
|
+
:MatrixFrustum => Matrix.by_value,
|
350
|
+
:MatrixPerspective => Matrix.by_value,
|
351
|
+
:MatrixOrtho => Matrix.by_value,
|
352
|
+
:MatrixLookAt => Matrix.by_value,
|
353
|
+
:MatrixToFloatV => Float16.by_value,
|
354
|
+
:QuaternionAdd => Quaternion.by_value,
|
355
|
+
:QuaternionAddValue => Quaternion.by_value,
|
356
|
+
:QuaternionSubtract => Quaternion.by_value,
|
357
|
+
:QuaternionSubtractValue => Quaternion.by_value,
|
358
|
+
:QuaternionIdentity => Quaternion.by_value,
|
359
|
+
:QuaternionLength => :float,
|
360
|
+
:QuaternionNormalize => Quaternion.by_value,
|
361
|
+
:QuaternionInvert => Quaternion.by_value,
|
362
|
+
:QuaternionMultiply => Quaternion.by_value,
|
363
|
+
:QuaternionScale => Quaternion.by_value,
|
364
|
+
:QuaternionDivide => Quaternion.by_value,
|
365
|
+
:QuaternionLerp => Quaternion.by_value,
|
366
|
+
:QuaternionNlerp => Quaternion.by_value,
|
367
|
+
:QuaternionSlerp => Quaternion.by_value,
|
368
|
+
:QuaternionFromVector3ToVector3 => Quaternion.by_value,
|
369
|
+
:QuaternionFromMatrix => Quaternion.by_value,
|
370
|
+
:QuaternionToMatrix => Matrix.by_value,
|
371
|
+
:QuaternionFromAxisAngle => Quaternion.by_value,
|
372
|
+
:QuaternionToAxisAngle => :void,
|
373
|
+
:QuaternionFromEuler => Quaternion.by_value,
|
374
|
+
:QuaternionToEuler => Vector3.by_value,
|
375
|
+
:QuaternionTransform => Quaternion.by_value,
|
376
|
+
:QuaternionEquals => :int,
|
377
|
+
}
|
378
|
+
symbols.each do |sym|
|
379
|
+
begin
|
380
|
+
attach_function sym, args[sym], retvals[sym]
|
381
|
+
rescue FFI::NotFoundError => error
|
382
|
+
$stderr.puts("[Warning] Failed to import #{sym} (#{error}).")
|
383
|
+
end
|
384
|
+
end
|
385
|
+
end
|
386
|
+
|
387
|
+
end
|
388
|
+
|