assimp-ruby 1.0.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.
@@ -0,0 +1,475 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Generated from Assimp 5.4 headers by generator/generate.rb.
4
+ # Do not edit this file directly.
5
+
6
+ require "ffi"
7
+
8
+ module Assimp
9
+ module Native
10
+
11
+ class Buffer < FFI::Struct
12
+ layout :data, :pointer,
13
+ :end, :pointer
14
+ end
15
+
16
+ class Color3D < FFI::Struct
17
+ layout :r, :float,
18
+ :g, :float,
19
+ :b, :float
20
+ end
21
+
22
+ class Color4D < FFI::Struct
23
+ layout :r, :float,
24
+ :g, :float,
25
+ :b, :float,
26
+ :a, :float
27
+ end
28
+
29
+ class Face < FFI::Struct
30
+ layout :num_indices, :uint,
31
+ :indices, :pointer
32
+ end
33
+
34
+ class ImporterDesc < FFI::Struct
35
+ layout :name, :pointer,
36
+ :author, :pointer,
37
+ :maintainer, :pointer,
38
+ :comments, :pointer,
39
+ :flags, :uint,
40
+ :min_major, :uint,
41
+ :min_minor, :uint,
42
+ :max_major, :uint,
43
+ :max_minor, :uint,
44
+ :file_extensions, :pointer
45
+ end
46
+
47
+ class LogStream < FFI::Struct
48
+ layout :callback, :pointer,
49
+ :user, :pointer
50
+ end
51
+
52
+ class Material < FFI::Struct
53
+ layout :properties, :pointer,
54
+ :num_properties, :uint,
55
+ :num_allocated, :uint
56
+ end
57
+
58
+ class Matrix3x3 < FFI::Struct
59
+ layout :a1, :float,
60
+ :a2, :float,
61
+ :a3, :float,
62
+ :b1, :float,
63
+ :b2, :float,
64
+ :b3, :float,
65
+ :c1, :float,
66
+ :c2, :float,
67
+ :c3, :float
68
+ end
69
+
70
+ class Matrix4x4 < FFI::Struct
71
+ layout :a1, :float,
72
+ :a2, :float,
73
+ :a3, :float,
74
+ :a4, :float,
75
+ :b1, :float,
76
+ :b2, :float,
77
+ :b3, :float,
78
+ :b4, :float,
79
+ :c1, :float,
80
+ :c2, :float,
81
+ :c3, :float,
82
+ :c4, :float,
83
+ :d1, :float,
84
+ :d2, :float,
85
+ :d3, :float,
86
+ :d4, :float
87
+ end
88
+
89
+ class MemoryInfo < FFI::Struct
90
+ layout :textures, :uint,
91
+ :materials, :uint,
92
+ :meshes, :uint,
93
+ :nodes, :uint,
94
+ :animations, :uint,
95
+ :cameras, :uint,
96
+ :lights, :uint,
97
+ :total, :uint
98
+ end
99
+
100
+ class MeshKey < FFI::Struct
101
+ layout :time, :double,
102
+ :value, :uint
103
+ end
104
+
105
+ class MeshMorphKey < FFI::Struct
106
+ layout :time, :double,
107
+ :values, :pointer,
108
+ :weights, :pointer,
109
+ :num_values_and_weights, :uint
110
+ end
111
+
112
+ class Metadata < FFI::Struct
113
+ layout :num_properties, :uint,
114
+ :keys, :pointer,
115
+ :values, :pointer
116
+ end
117
+
118
+ class MetadataEntry < FFI::Struct
119
+ layout :type, :int,
120
+ :data, :pointer
121
+ end
122
+
123
+ class Plane < FFI::Struct
124
+ layout :a, :float,
125
+ :b, :float,
126
+ :c, :float,
127
+ :d, :float
128
+ end
129
+
130
+ class PropertyStore < FFI::Struct
131
+ layout :sentinel, :char
132
+ end
133
+
134
+ class Quaternion < FFI::Struct
135
+ layout :w, :float,
136
+ :x, :float,
137
+ :y, :float,
138
+ :z, :float
139
+ end
140
+
141
+ class StringValue < FFI::Struct
142
+ layout :length, :uint,
143
+ :data, [:char, 1024]
144
+ end
145
+
146
+ class Texel < FFI::Struct
147
+ layout :b, :uchar,
148
+ :g, :uchar,
149
+ :r, :uchar,
150
+ :a, :uchar
151
+ end
152
+
153
+ class Vector2D < FFI::Struct
154
+ layout :x, :float,
155
+ :y, :float
156
+ end
157
+
158
+ class Vector3D < FFI::Struct
159
+ layout :x, :float,
160
+ :y, :float,
161
+ :z, :float
162
+ end
163
+
164
+ class VertexWeight < FFI::Struct
165
+ layout :vertex_id, :uint,
166
+ :weight, :float
167
+ end
168
+
169
+ class AABB < FFI::Struct
170
+ layout :min, Vector3D.by_value,
171
+ :max, Vector3D.by_value
172
+ end
173
+
174
+ class AnimMesh < FFI::Struct
175
+ layout :name, StringValue.by_value,
176
+ :vertices, :pointer,
177
+ :normals, :pointer,
178
+ :tangents, :pointer,
179
+ :bitangents, :pointer,
180
+ :colors, [:pointer, 8],
181
+ :texture_coords, [:pointer, 8],
182
+ :num_vertices, :uint,
183
+ :weight, :float
184
+ end
185
+
186
+ class Animation < FFI::Struct
187
+ layout :name, StringValue.by_value,
188
+ :duration, :double,
189
+ :ticks_per_second, :double,
190
+ :num_channels, :uint,
191
+ :channels, :pointer,
192
+ :num_mesh_channels, :uint,
193
+ :mesh_channels, :pointer,
194
+ :num_morph_mesh_channels, :uint,
195
+ :morph_mesh_channels, :pointer
196
+ end
197
+
198
+ class Bone < FFI::Struct
199
+ layout :name, StringValue.by_value,
200
+ :num_weights, :uint,
201
+ :armature, :pointer,
202
+ :node, :pointer,
203
+ :weights, :pointer,
204
+ :offset_matrix, Matrix4x4.by_value
205
+ end
206
+
207
+ class Camera < FFI::Struct
208
+ layout :name, StringValue.by_value,
209
+ :position, Vector3D.by_value,
210
+ :up, Vector3D.by_value,
211
+ :look_at, Vector3D.by_value,
212
+ :horizontal_fov, :float,
213
+ :clip_plane_near, :float,
214
+ :clip_plane_far, :float,
215
+ :aspect, :float,
216
+ :orthographic_width, :float
217
+ end
218
+
219
+ class Light < FFI::Struct
220
+ layout :name, StringValue.by_value,
221
+ :type, :int,
222
+ :position, Vector3D.by_value,
223
+ :direction, Vector3D.by_value,
224
+ :up, Vector3D.by_value,
225
+ :attenuation_constant, :float,
226
+ :attenuation_linear, :float,
227
+ :attenuation_quadratic, :float,
228
+ :color_diffuse, Color3D.by_value,
229
+ :color_specular, Color3D.by_value,
230
+ :color_ambient, Color3D.by_value,
231
+ :angle_inner_cone, :float,
232
+ :angle_outer_cone, :float,
233
+ :size, Vector2D.by_value
234
+ end
235
+
236
+ class MaterialProperty < FFI::Struct
237
+ layout :key, StringValue.by_value,
238
+ :semantic, :uint,
239
+ :index, :uint,
240
+ :data_length, :uint,
241
+ :type, :int,
242
+ :data, :pointer
243
+ end
244
+
245
+ class MeshAnim < FFI::Struct
246
+ layout :name, StringValue.by_value,
247
+ :num_keys, :uint,
248
+ :keys, :pointer
249
+ end
250
+
251
+ class MeshMorphAnim < FFI::Struct
252
+ layout :name, StringValue.by_value,
253
+ :num_keys, :uint,
254
+ :keys, :pointer
255
+ end
256
+
257
+ class Node < FFI::Struct
258
+ layout :name, StringValue.by_value,
259
+ :transformation, Matrix4x4.by_value,
260
+ :parent, :pointer,
261
+ :num_children, :uint,
262
+ :children, :pointer,
263
+ :num_meshes, :uint,
264
+ :meshes, :pointer,
265
+ :meta_data, :pointer
266
+ end
267
+
268
+ class NodeAnim < FFI::Struct
269
+ layout :node_name, StringValue.by_value,
270
+ :num_position_keys, :uint,
271
+ :position_keys, :pointer,
272
+ :num_rotation_keys, :uint,
273
+ :rotation_keys, :pointer,
274
+ :num_scaling_keys, :uint,
275
+ :scaling_keys, :pointer,
276
+ :pre_state, :int,
277
+ :post_state, :int
278
+ end
279
+
280
+ class QuatKey < FFI::Struct
281
+ layout :time, :double,
282
+ :value, Quaternion.by_value,
283
+ :interpolation, :int
284
+ end
285
+
286
+ class Ray < FFI::Struct
287
+ layout :pos, Vector3D.by_value,
288
+ :dir, Vector3D.by_value
289
+ end
290
+
291
+ class Scene < FFI::Struct
292
+ layout :flags, :uint,
293
+ :root_node, :pointer,
294
+ :num_meshes, :uint,
295
+ :meshes, :pointer,
296
+ :num_materials, :uint,
297
+ :materials, :pointer,
298
+ :num_animations, :uint,
299
+ :animations, :pointer,
300
+ :num_textures, :uint,
301
+ :textures, :pointer,
302
+ :num_lights, :uint,
303
+ :lights, :pointer,
304
+ :num_cameras, :uint,
305
+ :cameras, :pointer,
306
+ :meta_data, :pointer,
307
+ :name, StringValue.by_value,
308
+ :num_skeletons, :uint,
309
+ :skeletons, :pointer,
310
+ :private, :pointer
311
+ end
312
+
313
+ class Skeleton < FFI::Struct
314
+ layout :name, StringValue.by_value,
315
+ :num_bones, :uint,
316
+ :bones, :pointer
317
+ end
318
+
319
+ class SkeletonBone < FFI::Struct
320
+ layout :parent, :int,
321
+ :armature, :pointer,
322
+ :node, :pointer,
323
+ :numn_weights, :uint,
324
+ :mesh_id, :pointer,
325
+ :weights, :pointer,
326
+ :offset_matrix, Matrix4x4.by_value,
327
+ :local_matrix, Matrix4x4.by_value
328
+ end
329
+
330
+ class Texture < FFI::Struct
331
+ layout :width, :uint,
332
+ :height, :uint,
333
+ :format_hint, [:char, 9],
334
+ :data, :pointer,
335
+ :filename, StringValue.by_value
336
+ end
337
+
338
+ class UVTransform < FFI::Struct
339
+ layout :translation, Vector2D.by_value,
340
+ :scaling, Vector2D.by_value,
341
+ :rotation, :float
342
+ end
343
+
344
+ class VectorKey < FFI::Struct
345
+ layout :time, :double,
346
+ :value, Vector3D.by_value,
347
+ :interpolation, :int
348
+ end
349
+
350
+ class Mesh < FFI::Struct
351
+ layout :primitive_types, :uint,
352
+ :num_vertices, :uint,
353
+ :num_faces, :uint,
354
+ :vertices, :pointer,
355
+ :normals, :pointer,
356
+ :tangents, :pointer,
357
+ :bitangents, :pointer,
358
+ :colors, [:pointer, 8],
359
+ :texture_coords, [:pointer, 8],
360
+ :num_uv_components, [:uint, 8],
361
+ :faces, :pointer,
362
+ :num_bones, :uint,
363
+ :bones, :pointer,
364
+ :material_index, :uint,
365
+ :name, StringValue.by_value,
366
+ :num_anim_meshes, :uint,
367
+ :anim_meshes, :pointer,
368
+ :method, :int,
369
+ :aabb, AABB.by_value,
370
+ :texture_coords_names, :pointer
371
+ end
372
+
373
+ ENUMS = {
374
+ "aiAnimBehaviour" => { "aiAnimBehaviour_DEFAULT" => 0, "aiAnimBehaviour_CONSTANT" => 1, "aiAnimBehaviour_LINEAR" => 2, "aiAnimBehaviour_REPEAT" => 3, "_aiAnimBehaviour_Force32Bit" => 2147483647 }.freeze,
375
+ "aiAnimInterpolation" => { "aiAnimInterpolation_Step" => 0, "aiAnimInterpolation_Linear" => 1, "aiAnimInterpolation_Spherical_Linear" => 2, "aiAnimInterpolation_Cubic_Spline" => 3, "_aiAnimInterpolation_Force32Bit" => 2147483647 }.freeze,
376
+ "aiBlendMode" => { "aiBlendMode_Default" => 0, "aiBlendMode_Additive" => 1, "_aiBlendMode_Force32Bit" => 2147483647 }.freeze,
377
+ "aiDefaultLogStream" => { "aiDefaultLogStream_FILE" => 1, "aiDefaultLogStream_STDOUT" => 2, "aiDefaultLogStream_STDERR" => 4, "aiDefaultLogStream_DEBUGGER" => 8, "_AI_DLS_ENFORCE_ENUM_SIZE" => 2147483647 }.freeze,
378
+ "aiImporterFlags" => { "aiImporterFlags_SupportTextFlavour" => 1, "aiImporterFlags_SupportBinaryFlavour" => 2, "aiImporterFlags_SupportCompressedFlavour" => 4, "aiImporterFlags_LimitedSupport" => 8, "aiImporterFlags_Experimental" => 16 }.freeze,
379
+ "aiLightSourceType" => { "aiLightSource_UNDEFINED" => 0, "aiLightSource_DIRECTIONAL" => 1, "aiLightSource_POINT" => 2, "aiLightSource_SPOT" => 3, "aiLightSource_AMBIENT" => 4, "aiLightSource_AREA" => 5, "_aiLightSource_Force32Bit" => 2147483647 }.freeze,
380
+ "aiMetadataType" => { "AI_BOOL" => 0, "AI_INT32" => 1, "AI_UINT64" => 2, "AI_FLOAT" => 3, "AI_DOUBLE" => 4, "AI_AISTRING" => 5, "AI_AIVECTOR3D" => 6, "AI_AIMETADATA" => 7, "AI_INT64" => 8, "AI_UINT32" => 9, "AI_META_MAX" => 10, "FORCE_32BIT" => 2147483647 }.freeze,
381
+ "aiMorphingMethod" => { "aiMorphingMethod_UNKNOWN" => 0, "aiMorphingMethod_VERTEX_BLEND" => 1, "aiMorphingMethod_MORPH_NORMALIZED" => 2, "aiMorphingMethod_MORPH_RELATIVE" => 3, "_aiMorphingMethod_Force32Bit" => 2147483647 }.freeze,
382
+ "aiOrigin" => { "aiOrigin_SET" => 0, "aiOrigin_CUR" => 1, "aiOrigin_END" => 2, "_AI_ORIGIN_ENFORCE_ENUM_SIZE" => 2147483647 }.freeze,
383
+ "aiPostProcessSteps" => { "aiProcess_CalcTangentSpace" => 1, "aiProcess_JoinIdenticalVertices" => 2, "aiProcess_MakeLeftHanded" => 4, "aiProcess_Triangulate" => 8, "aiProcess_RemoveComponent" => 16, "aiProcess_GenNormals" => 32, "aiProcess_GenSmoothNormals" => 64, "aiProcess_SplitLargeMeshes" => 128, "aiProcess_PreTransformVertices" => 256, "aiProcess_LimitBoneWeights" => 512, "aiProcess_ValidateDataStructure" => 1024, "aiProcess_ImproveCacheLocality" => 2048, "aiProcess_RemoveRedundantMaterials" => 4096, "aiProcess_FixInfacingNormals" => 8192, "aiProcess_PopulateArmatureData" => 16384, "aiProcess_SortByPType" => 32768, "aiProcess_FindDegenerates" => 65536, "aiProcess_FindInvalidData" => 131072, "aiProcess_GenUVCoords" => 262144, "aiProcess_TransformUVCoords" => 524288, "aiProcess_FindInstances" => 1048576, "aiProcess_OptimizeMeshes" => 2097152, "aiProcess_OptimizeGraph" => 4194304, "aiProcess_FlipUVs" => 8388608, "aiProcess_FlipWindingOrder" => 16777216, "aiProcess_SplitByBoneCount" => 33554432, "aiProcess_Debone" => 67108864, "aiProcess_GlobalScale" => 134217728, "aiProcess_EmbedTextures" => 268435456, "aiProcess_ForceGenNormals" => 536870912, "aiProcess_DropNormals" => 1073741824, "aiProcess_GenBoundingBoxes" => -2147483648 }.freeze,
384
+ "aiPrimitiveType" => { "aiPrimitiveType_POINT" => 1, "aiPrimitiveType_LINE" => 2, "aiPrimitiveType_TRIANGLE" => 4, "aiPrimitiveType_POLYGON" => 8, "aiPrimitiveType_NGONEncodingFlag" => 16, "_aiPrimitiveType_Force32Bit" => 2147483647 }.freeze,
385
+ "aiPropertyTypeInfo" => { "aiPTI_Float" => 1, "aiPTI_Double" => 2, "aiPTI_String" => 3, "aiPTI_Integer" => 4, "aiPTI_Buffer" => 5, "_aiPTI_Force32Bit" => 2147483647 }.freeze,
386
+ "aiReturn" => { "aiReturn_SUCCESS" => 0, "aiReturn_FAILURE" => -1, "aiReturn_OUTOFMEMORY" => -3, "_AI_ENFORCE_ENUM_SIZE" => 2147483647 }.freeze,
387
+ "aiShadingMode" => { "aiShadingMode_Flat" => 1, "aiShadingMode_Gouraud" => 2, "aiShadingMode_Phong" => 3, "aiShadingMode_Blinn" => 4, "aiShadingMode_Toon" => 5, "aiShadingMode_OrenNayar" => 6, "aiShadingMode_Minnaert" => 7, "aiShadingMode_CookTorrance" => 8, "aiShadingMode_NoShading" => 9, "aiShadingMode_Unlit" => 9, "aiShadingMode_Fresnel" => 10, "aiShadingMode_PBR_BRDF" => 11, "_aiShadingMode_Force32Bit" => 2147483647 }.freeze,
388
+ "aiTextureFlags" => { "aiTextureFlags_Invert" => 1, "aiTextureFlags_UseAlpha" => 2, "aiTextureFlags_IgnoreAlpha" => 4, "_aiTextureFlags_Force32Bit" => 2147483647 }.freeze,
389
+ "aiTextureMapMode" => { "aiTextureMapMode_Wrap" => 0, "aiTextureMapMode_Clamp" => 1, "aiTextureMapMode_Decal" => 3, "aiTextureMapMode_Mirror" => 2, "_aiTextureMapMode_Force32Bit" => 2147483647 }.freeze,
390
+ "aiTextureMapping" => { "aiTextureMapping_UV" => 0, "aiTextureMapping_SPHERE" => 1, "aiTextureMapping_CYLINDER" => 2, "aiTextureMapping_BOX" => 3, "aiTextureMapping_PLANE" => 4, "aiTextureMapping_OTHER" => 5, "_aiTextureMapping_Force32Bit" => 2147483647 }.freeze,
391
+ "aiTextureOp" => { "aiTextureOp_Multiply" => 0, "aiTextureOp_Add" => 1, "aiTextureOp_Subtract" => 2, "aiTextureOp_Divide" => 3, "aiTextureOp_SmoothAdd" => 4, "aiTextureOp_SignedAdd" => 5, "_aiTextureOp_Force32Bit" => 2147483647 }.freeze,
392
+ "aiTextureType" => { "aiTextureType_NONE" => 0, "aiTextureType_DIFFUSE" => 1, "aiTextureType_SPECULAR" => 2, "aiTextureType_AMBIENT" => 3, "aiTextureType_EMISSIVE" => 4, "aiTextureType_HEIGHT" => 5, "aiTextureType_NORMALS" => 6, "aiTextureType_SHININESS" => 7, "aiTextureType_OPACITY" => 8, "aiTextureType_DISPLACEMENT" => 9, "aiTextureType_LIGHTMAP" => 10, "aiTextureType_REFLECTION" => 11, "aiTextureType_BASE_COLOR" => 12, "aiTextureType_NORMAL_CAMERA" => 13, "aiTextureType_EMISSION_COLOR" => 14, "aiTextureType_METALNESS" => 15, "aiTextureType_DIFFUSE_ROUGHNESS" => 16, "aiTextureType_AMBIENT_OCCLUSION" => 17, "aiTextureType_UNKNOWN" => 18, "aiTextureType_SHEEN" => 19, "aiTextureType_CLEARCOAT" => 20, "aiTextureType_TRANSMISSION" => 21, "aiTextureType_MAYA_BASE" => 22, "aiTextureType_MAYA_SPECULAR" => 23, "aiTextureType_MAYA_SPECULAR_COLOR" => 24, "aiTextureType_MAYA_SPECULAR_ROUGHNESS" => 25, "_aiTextureType_Force32Bit" => 2147483647 }.freeze,
393
+ }.freeze
394
+
395
+ POST_PROCESS = {
396
+ calc_tangent_space: 1,
397
+ join_identical_vertices: 2,
398
+ make_left_handed: 4,
399
+ triangulate: 8,
400
+ remove_component: 0x10,
401
+ gen_normals: 0x20,
402
+ gen_smooth_normals: 0x40,
403
+ split_large_meshes: 0x80,
404
+ pre_transform_vertices: 0x100,
405
+ limit_bone_weights: 0x200,
406
+ validate_data_structure: 0x400,
407
+ improve_cache_locality: 0x800,
408
+ remove_redundant_materials: 0x1000,
409
+ fix_infacing_normals: 0x2000,
410
+ populate_armature_data: 0x4000,
411
+ sort_by_p_type: 0x8000,
412
+ find_degenerates: 0x1_0000,
413
+ find_invalid_data: 0x2_0000,
414
+ gen_uv_coords: 0x4_0000,
415
+ transform_uv_coords: 0x8_0000,
416
+ find_instances: 0x10_0000,
417
+ optimize_meshes: 0x20_0000,
418
+ optimize_graph: 0x40_0000,
419
+ flip_uvs: 0x80_0000,
420
+ flip_winding_order: 0x100_0000,
421
+ split_by_bone_count: 0x200_0000,
422
+ debone: 0x400_0000,
423
+ global_scale: 0x800_0000,
424
+ embed_textures: 0x1000_0000,
425
+ force_gen_normals: 0x2000_0000,
426
+ drop_normals: 0x4000_0000,
427
+ gen_bounding_boxes: 0x8000_0000,
428
+ }.freeze
429
+
430
+ HEADER_LAYOUTS = {
431
+ "aiBuffer" => [16, { data: 0, end: 8 }.freeze],
432
+ "aiColor3D" => [12, { r: 0, g: 4, b: 8 }.freeze],
433
+ "aiColor4D" => [16, { r: 0, g: 4, b: 8, a: 12 }.freeze],
434
+ "aiFace" => [16, { num_indices: 0, indices: 8 }.freeze],
435
+ "aiImporterDesc" => [64, { name: 0, author: 8, maintainer: 16, comments: 24, flags: 32, min_major: 36, min_minor: 40, max_major: 44, max_minor: 48, file_extensions: 56 }.freeze],
436
+ "aiLogStream" => [16, { callback: 0, user: 8 }.freeze],
437
+ "aiMaterial" => [16, { properties: 0, num_properties: 8, num_allocated: 12 }.freeze],
438
+ "aiMatrix3x3" => [36, { a1: 0, a2: 4, a3: 8, b1: 12, b2: 16, b3: 20, c1: 24, c2: 28, c3: 32 }.freeze],
439
+ "aiMatrix4x4" => [64, { a1: 0, a2: 4, a3: 8, a4: 12, b1: 16, b2: 20, b3: 24, b4: 28, c1: 32, c2: 36, c3: 40, c4: 44, d1: 48, d2: 52, d3: 56, d4: 60 }.freeze],
440
+ "aiMemoryInfo" => [32, { textures: 0, materials: 4, meshes: 8, nodes: 12, animations: 16, cameras: 20, lights: 24, total: 28 }.freeze],
441
+ "aiMeshKey" => [16, { time: 0, value: 8 }.freeze],
442
+ "aiMeshMorphKey" => [32, { time: 0, values: 8, weights: 16, num_values_and_weights: 24 }.freeze],
443
+ "aiMetadata" => [24, { num_properties: 0, keys: 8, values: 16 }.freeze],
444
+ "aiMetadataEntry" => [16, { type: 0, data: 8 }.freeze],
445
+ "aiPlane" => [16, { a: 0, b: 4, c: 8, d: 12 }.freeze],
446
+ "aiPropertyStore" => [1, { sentinel: 0 }.freeze],
447
+ "aiQuaternion" => [16, { w: 0, x: 4, y: 8, z: 12 }.freeze],
448
+ "aiString" => [1028, { length: 0, data: 4 }.freeze],
449
+ "aiTexel" => [4, { b: 0, g: 1, r: 2, a: 3 }.freeze],
450
+ "aiVector2D" => [8, { x: 0, y: 4 }.freeze],
451
+ "aiVector3D" => [12, { x: 0, y: 4, z: 8 }.freeze],
452
+ "aiVertexWeight" => [8, { vertex_id: 0, weight: 4 }.freeze],
453
+ "aiAABB" => [24, { min: 0, max: 12 }.freeze],
454
+ "aiAnimMesh" => [1200, { name: 0, vertices: 1032, normals: 1040, tangents: 1048, bitangents: 1056, colors: 1064, texture_coords: 1128, num_vertices: 1192, weight: 1196 }.freeze],
455
+ "aiAnimation" => [1096, { name: 0, duration: 1032, ticks_per_second: 1040, num_channels: 1048, channels: 1056, num_mesh_channels: 1064, mesh_channels: 1072, num_morph_mesh_channels: 1080, morph_mesh_channels: 1088 }.freeze],
456
+ "aiBone" => [1120, { name: 0, num_weights: 1028, armature: 1032, node: 1040, weights: 1048, offset_matrix: 1056 }.freeze],
457
+ "aiCamera" => [1084, { name: 0, position: 1028, up: 1040, look_at: 1052, horizontal_fov: 1064, clip_plane_near: 1068, clip_plane_far: 1072, aspect: 1076, orthographic_width: 1080 }.freeze],
458
+ "aiLight" => [1132, { name: 0, type: 1028, position: 1032, direction: 1044, up: 1056, attenuation_constant: 1068, attenuation_linear: 1072, attenuation_quadratic: 1076, color_diffuse: 1080, color_specular: 1092, color_ambient: 1104, angle_inner_cone: 1116, angle_outer_cone: 1120, size: 1124 }.freeze],
459
+ "aiMaterialProperty" => [1056, { key: 0, semantic: 1028, index: 1032, data_length: 1036, type: 1040, data: 1048 }.freeze],
460
+ "aiMeshAnim" => [1040, { name: 0, num_keys: 1028, keys: 1032 }.freeze],
461
+ "aiMeshMorphAnim" => [1040, { name: 0, num_keys: 1028, keys: 1032 }.freeze],
462
+ "aiNode" => [1144, { name: 0, transformation: 1028, parent: 1096, num_children: 1104, children: 1112, num_meshes: 1120, meshes: 1128, meta_data: 1136 }.freeze],
463
+ "aiNodeAnim" => [1080, { node_name: 0, num_position_keys: 1028, position_keys: 1032, num_rotation_keys: 1040, rotation_keys: 1048, num_scaling_keys: 1056, scaling_keys: 1064, pre_state: 1072, post_state: 1076 }.freeze],
464
+ "aiQuatKey" => [32, { time: 0, value: 8, interpolation: 24 }.freeze],
465
+ "aiRay" => [24, { pos: 0, dir: 12 }.freeze],
466
+ "aiScene" => [1168, { flags: 0, root_node: 8, num_meshes: 16, meshes: 24, num_materials: 32, materials: 40, num_animations: 48, animations: 56, num_textures: 64, textures: 72, num_lights: 80, lights: 88, num_cameras: 96, cameras: 104, meta_data: 112, name: 120, num_skeletons: 1148, skeletons: 1152, private: 1160 }.freeze],
467
+ "aiSkeleton" => [1040, { name: 0, num_bones: 1028, bones: 1032 }.freeze],
468
+ "aiSkeletonBone" => [176, { parent: 0, armature: 8, node: 16, numn_weights: 24, mesh_id: 32, weights: 40, offset_matrix: 48, local_matrix: 112 }.freeze],
469
+ "aiTexture" => [1064, { width: 0, height: 4, format_hint: 8, data: 24, filename: 32 }.freeze],
470
+ "aiUVTransform" => [20, { translation: 0, scaling: 8, rotation: 16 }.freeze],
471
+ "aiVectorKey" => [24, { time: 0, value: 8, interpolation: 20 }.freeze],
472
+ "aiMesh" => [1320, { primitive_types: 0, num_vertices: 4, num_faces: 8, vertices: 16, normals: 24, tangents: 32, bitangents: 40, colors: 48, texture_coords: 112, num_uv_components: 176, faces: 208, num_bones: 216, bones: 224, material_index: 232, name: 236, num_anim_meshes: 1264, anim_meshes: 1272, method: 1280, aabb: 1284, texture_coords_names: 1312 }.freeze],
473
+ }.freeze
474
+ end
475
+ end
@@ -0,0 +1,67 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "rbconfig"
4
+
5
+ module Assimp
6
+ module Native
7
+ module Platform
8
+ module_function
9
+
10
+ def tag(cpu: RbConfig::CONFIG.fetch("host_cpu"), os: RbConfig::CONFIG.fetch("host_os"))
11
+ case os
12
+ when /darwin/
13
+ "#{darwin_cpu(cpu)}-darwin"
14
+ when /linux/
15
+ "#{linux_cpu(cpu)}-linux"
16
+ when /mswin|mingw/
17
+ "#{windows_cpu(cpu)}-mingw-ucrt"
18
+ else
19
+ "#{cpu}-#{os}".downcase.gsub(/[^a-z0-9._-]+/, "-")
20
+ end
21
+ end
22
+
23
+ def library_names(os: RbConfig::CONFIG.fetch("host_os"))
24
+ case os
25
+ when /darwin/ then %w[libassimp.5.dylib libassimp.dylib]
26
+ when /mswin|mingw/ then %w[assimp-vc143-mt.dll assimp-vc142-mt.dll assimp.dll]
27
+ else %w[libassimp.so.5 libassimp.so]
28
+ end
29
+ end
30
+
31
+ def packaged_library_name(os: RbConfig::CONFIG.fetch("host_os"))
32
+ case os
33
+ when /darwin/ then "libassimp.5.dylib"
34
+ when /mswin|mingw/ then "assimp.dll"
35
+ else "libassimp.so.5"
36
+ end
37
+ end
38
+
39
+ def darwin_cpu(cpu)
40
+ case cpu
41
+ when "arm64", "aarch64" then "arm64"
42
+ when "x86_64", "amd64" then "x86_64"
43
+ else cpu
44
+ end
45
+ end
46
+ private_class_method :darwin_cpu
47
+
48
+ def linux_cpu(cpu)
49
+ case cpu
50
+ when "arm64", "aarch64" then "aarch64"
51
+ when "x64", "amd64", "x86_64" then "x86_64"
52
+ else cpu
53
+ end
54
+ end
55
+ private_class_method :linux_cpu
56
+
57
+ def windows_cpu(cpu)
58
+ case cpu
59
+ when "x64", "amd64", "x86_64" then "x64"
60
+ when "arm64", "aarch64" then "arm64"
61
+ else cpu
62
+ end
63
+ end
64
+ private_class_method :windows_cpu
65
+ end
66
+ end
67
+ end
@@ -0,0 +1,60 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "generated"
4
+
5
+ module Assimp
6
+ module Native
7
+ class StringValue
8
+ AI_MAXLEN = 1024
9
+
10
+ def to_s
11
+ size = [self[:length], AI_MAXLEN - 1].min
12
+ self[:data].to_ptr.read_string_length(size).force_encoding(Encoding::UTF_8)
13
+ end
14
+ end
15
+
16
+ class Vector3D
17
+ def to_a
18
+ [self[:x], self[:y], self[:z]]
19
+ end
20
+ end
21
+
22
+ class Quaternion
23
+ def to_a
24
+ [self[:x], self[:y], self[:z], self[:w]]
25
+ end
26
+ end
27
+
28
+ class Color4D
29
+ def to_a
30
+ [self[:r], self[:g], self[:b], self[:a]]
31
+ end
32
+ end
33
+
34
+ class Matrix4x4
35
+ FIELDS = %i[a1 a2 a3 a4 b1 b2 b3 b4 c1 c2 c3 c4 d1 d2 d3 d4].freeze
36
+ COLUMN_MAJOR_FIELDS = %i[a1 b1 c1 d1 a2 b2 c2 d2 a3 b3 c3 d3 a4 b4 c4 d4].freeze
37
+
38
+ def to_column_major
39
+ COLUMN_MAJOR_FIELDS.map { |field| self[field] }
40
+ end
41
+ end
42
+
43
+ class LegacyBone < FFI::Struct
44
+ layout :name, StringValue.by_value,
45
+ :num_weights, :uint,
46
+ :weights, :pointer,
47
+ :offset_matrix, Matrix4x4.by_value
48
+ end
49
+
50
+ class LegacyVectorKey < FFI::Struct
51
+ layout :time, :double,
52
+ :value, Vector3D.by_value
53
+ end
54
+
55
+ class LegacyQuatKey < FFI::Struct
56
+ layout :time, :double,
57
+ :value, Quaternion.by_value
58
+ end
59
+ end
60
+ end