raylib 4.5.0.alpha1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE.txt +16 -0
- data/README.md +97 -0
- data/lib/raylib/core/callbacks.rb +19 -0
- data/lib/raylib/core/colors.rb +32 -0
- data/lib/raylib/core/enums.rb +694 -0
- data/lib/raylib/core/functions.rb +1552 -0
- data/lib/raylib/core/structs/audio_stream.rb +71 -0
- data/lib/raylib/core/structs/bone_info.rb +38 -0
- data/lib/raylib/core/structs/bounding_box.rb +38 -0
- data/lib/raylib/core/structs/camera2_d.rb +60 -0
- data/lib/raylib/core/structs/camera3_d.rb +74 -0
- data/lib/raylib/core/structs/color.rb +60 -0
- data/lib/raylib/core/structs/file_path_list.rb +51 -0
- data/lib/raylib/core/structs/font.rb +82 -0
- data/lib/raylib/core/structs/glyph_info.rb +71 -0
- data/lib/raylib/core/structs/image.rb +71 -0
- data/lib/raylib/core/structs/material.rb +49 -0
- data/lib/raylib/core/structs/material_map.rb +49 -0
- data/lib/raylib/core/structs/matrix.rb +192 -0
- data/lib/raylib/core/structs/mesh.rb +181 -0
- data/lib/raylib/core/structs/model.rb +115 -0
- data/lib/raylib/core/structs/model_animation.rb +60 -0
- data/lib/raylib/core/structs/music.rb +71 -0
- data/lib/raylib/core/structs/n_patch_info.rb +82 -0
- data/lib/raylib/core/structs/ray.rb +38 -0
- data/lib/raylib/core/structs/ray_collision.rb +60 -0
- data/lib/raylib/core/structs/rectangle.rb +60 -0
- data/lib/raylib/core/structs/render_texture.rb +52 -0
- data/lib/raylib/core/structs/shader.rb +38 -0
- data/lib/raylib/core/structs/sound.rb +38 -0
- data/lib/raylib/core/structs/texture.rb +77 -0
- data/lib/raylib/core/structs/transform.rb +49 -0
- data/lib/raylib/core/structs/vector2.rb +38 -0
- data/lib/raylib/core/structs/vector3.rb +49 -0
- data/lib/raylib/core/structs/vector4.rb +63 -0
- data/lib/raylib/core/structs/vr_device_info.rb +126 -0
- data/lib/raylib/core/structs/vr_stereo_config.rb +104 -0
- data/lib/raylib/core/structs/wave.rb +71 -0
- data/lib/raylib/core/structs.rb +32 -0
- data/lib/raylib/core.rb +5 -0
- data/lib/raylib/dsl.rb +2 -0
- data/lib/raylib/raymath/functions.rb +337 -0
- data/lib/raylib/raymath/structs/float16.rb +27 -0
- data/lib/raylib/raymath/structs/float3.rb +27 -0
- data/lib/raylib/raymath/structs.rb +2 -0
- data/lib/raylib/raymath.rb +2 -0
- data/lib/raylib/rlgl/callbacks.rb +4 -0
- data/lib/raylib/rlgl/enums.rb +270 -0
- data/lib/raylib/rlgl/functions.rb +448 -0
- data/lib/raylib/rlgl/structs/rl_draw_call.rb +60 -0
- data/lib/raylib/rlgl/structs/rl_render_batch.rb +82 -0
- data/lib/raylib/rlgl/structs/rl_vertex_buffer.rb +93 -0
- data/lib/raylib/rlgl/structs.rb +3 -0
- data/lib/raylib/rlgl.rb +4 -0
- data/lib/raylib/version.rb +5 -0
- data/lib/raylib.rb +12 -0
- metadata +162 -0
@@ -0,0 +1,49 @@
|
|
1
|
+
module Raylib
|
2
|
+
# MaterialMap
|
3
|
+
class MaterialMap < FFI::Struct
|
4
|
+
layout(
|
5
|
+
:texture, Texture2D, # Material map texture,
|
6
|
+
:color, Color, # Material map color,
|
7
|
+
:value, :float, # Material map value
|
8
|
+
)
|
9
|
+
|
10
|
+
def self.create(texture, color, value)
|
11
|
+
new.tap do |instance|
|
12
|
+
instance[:texture] = texture
|
13
|
+
instance[:color] = color
|
14
|
+
instance[:value] = value
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def to_s
|
19
|
+
"Raylib::MaterialMap##{object_id} texture=#{texture} color=#{color} value=#{value}"
|
20
|
+
end
|
21
|
+
|
22
|
+
# Material map texture
|
23
|
+
# @return [Texture2D] texture
|
24
|
+
def texture = self[:texture]
|
25
|
+
|
26
|
+
# Sets Material map texture
|
27
|
+
def texture=(new_texture)
|
28
|
+
self[:texture] = new_texture
|
29
|
+
end
|
30
|
+
|
31
|
+
# Material map color
|
32
|
+
# @return [Color] color
|
33
|
+
def color = self[:color]
|
34
|
+
|
35
|
+
# Sets Material map color
|
36
|
+
def color=(new_color)
|
37
|
+
self[:color] = new_color
|
38
|
+
end
|
39
|
+
|
40
|
+
# Material map value
|
41
|
+
# @return [Float] value
|
42
|
+
def value = self[:value]
|
43
|
+
|
44
|
+
# Sets Material map value
|
45
|
+
def value=(new_value)
|
46
|
+
self[:value] = new_value
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,192 @@
|
|
1
|
+
module Raylib
|
2
|
+
# Matrix, 4x4 components, column major, OpenGL style, right-handed
|
3
|
+
class Matrix < FFI::Struct
|
4
|
+
layout(
|
5
|
+
:m0, :float, # Matrix first row (4 components),
|
6
|
+
:m4, :float, # Matrix first row (4 components),
|
7
|
+
:m8, :float, # Matrix first row (4 components),
|
8
|
+
:m12, :float, # Matrix first row (4 components),
|
9
|
+
:m1, :float, # Matrix second row (4 components),
|
10
|
+
:m5, :float, # Matrix second row (4 components),
|
11
|
+
:m9, :float, # Matrix second row (4 components),
|
12
|
+
:m13, :float, # Matrix second row (4 components),
|
13
|
+
:m2, :float, # Matrix third row (4 components),
|
14
|
+
:m6, :float, # Matrix third row (4 components),
|
15
|
+
:m10, :float, # Matrix third row (4 components),
|
16
|
+
:m14, :float, # Matrix third row (4 components),
|
17
|
+
:m3, :float, # Matrix fourth row (4 components),
|
18
|
+
:m7, :float, # Matrix fourth row (4 components),
|
19
|
+
:m11, :float, # Matrix fourth row (4 components),
|
20
|
+
:m15, :float, # Matrix fourth row (4 components)
|
21
|
+
)
|
22
|
+
|
23
|
+
def self.create(m0, m4, m8, m12, m1, m5, m9, m13, m2, m6, m10, m14, m3, m7, m11, m15)
|
24
|
+
new.tap do |instance|
|
25
|
+
instance[:m0] = m0
|
26
|
+
instance[:m4] = m4
|
27
|
+
instance[:m8] = m8
|
28
|
+
instance[:m12] = m12
|
29
|
+
instance[:m1] = m1
|
30
|
+
instance[:m5] = m5
|
31
|
+
instance[:m9] = m9
|
32
|
+
instance[:m13] = m13
|
33
|
+
instance[:m2] = m2
|
34
|
+
instance[:m6] = m6
|
35
|
+
instance[:m10] = m10
|
36
|
+
instance[:m14] = m14
|
37
|
+
instance[:m3] = m3
|
38
|
+
instance[:m7] = m7
|
39
|
+
instance[:m11] = m11
|
40
|
+
instance[:m15] = m15
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def to_s
|
45
|
+
"Raylib::Matrix##{object_id} m0=#{m0} m4=#{m4} m8=#{m8} m12=#{m12} m1=#{m1} m5=#{m5} m9=#{m9} m13=#{m13} m2=#{m2} m6=#{m6} m10=#{m10} m14=#{m14} m3=#{m3} m7=#{m7} m11=#{m11} m15=#{m15}"
|
46
|
+
end
|
47
|
+
|
48
|
+
# Matrix first row (4 components)
|
49
|
+
# @return [Float] m0
|
50
|
+
def m0 = self[:m0]
|
51
|
+
|
52
|
+
# Sets Matrix first row (4 components)
|
53
|
+
def m0=(new_m0)
|
54
|
+
self[:m0] = new_m0
|
55
|
+
end
|
56
|
+
|
57
|
+
# Matrix first row (4 components)
|
58
|
+
# @return [Float] m4
|
59
|
+
def m4 = self[:m4]
|
60
|
+
|
61
|
+
# Sets Matrix first row (4 components)
|
62
|
+
def m4=(new_m4)
|
63
|
+
self[:m4] = new_m4
|
64
|
+
end
|
65
|
+
|
66
|
+
# Matrix first row (4 components)
|
67
|
+
# @return [Float] m8
|
68
|
+
def m8 = self[:m8]
|
69
|
+
|
70
|
+
# Sets Matrix first row (4 components)
|
71
|
+
def m8=(new_m8)
|
72
|
+
self[:m8] = new_m8
|
73
|
+
end
|
74
|
+
|
75
|
+
# Matrix first row (4 components)
|
76
|
+
# @return [Float] m12
|
77
|
+
def m12 = self[:m12]
|
78
|
+
|
79
|
+
# Sets Matrix first row (4 components)
|
80
|
+
def m12=(new_m12)
|
81
|
+
self[:m12] = new_m12
|
82
|
+
end
|
83
|
+
|
84
|
+
# Matrix second row (4 components)
|
85
|
+
# @return [Float] m1
|
86
|
+
def m1 = self[:m1]
|
87
|
+
|
88
|
+
# Sets Matrix second row (4 components)
|
89
|
+
def m1=(new_m1)
|
90
|
+
self[:m1] = new_m1
|
91
|
+
end
|
92
|
+
|
93
|
+
# Matrix second row (4 components)
|
94
|
+
# @return [Float] m5
|
95
|
+
def m5 = self[:m5]
|
96
|
+
|
97
|
+
# Sets Matrix second row (4 components)
|
98
|
+
def m5=(new_m5)
|
99
|
+
self[:m5] = new_m5
|
100
|
+
end
|
101
|
+
|
102
|
+
# Matrix second row (4 components)
|
103
|
+
# @return [Float] m9
|
104
|
+
def m9 = self[:m9]
|
105
|
+
|
106
|
+
# Sets Matrix second row (4 components)
|
107
|
+
def m9=(new_m9)
|
108
|
+
self[:m9] = new_m9
|
109
|
+
end
|
110
|
+
|
111
|
+
# Matrix second row (4 components)
|
112
|
+
# @return [Float] m13
|
113
|
+
def m13 = self[:m13]
|
114
|
+
|
115
|
+
# Sets Matrix second row (4 components)
|
116
|
+
def m13=(new_m13)
|
117
|
+
self[:m13] = new_m13
|
118
|
+
end
|
119
|
+
|
120
|
+
# Matrix third row (4 components)
|
121
|
+
# @return [Float] m2
|
122
|
+
def m2 = self[:m2]
|
123
|
+
|
124
|
+
# Sets Matrix third row (4 components)
|
125
|
+
def m2=(new_m2)
|
126
|
+
self[:m2] = new_m2
|
127
|
+
end
|
128
|
+
|
129
|
+
# Matrix third row (4 components)
|
130
|
+
# @return [Float] m6
|
131
|
+
def m6 = self[:m6]
|
132
|
+
|
133
|
+
# Sets Matrix third row (4 components)
|
134
|
+
def m6=(new_m6)
|
135
|
+
self[:m6] = new_m6
|
136
|
+
end
|
137
|
+
|
138
|
+
# Matrix third row (4 components)
|
139
|
+
# @return [Float] m10
|
140
|
+
def m10 = self[:m10]
|
141
|
+
|
142
|
+
# Sets Matrix third row (4 components)
|
143
|
+
def m10=(new_m10)
|
144
|
+
self[:m10] = new_m10
|
145
|
+
end
|
146
|
+
|
147
|
+
# Matrix third row (4 components)
|
148
|
+
# @return [Float] m14
|
149
|
+
def m14 = self[:m14]
|
150
|
+
|
151
|
+
# Sets Matrix third row (4 components)
|
152
|
+
def m14=(new_m14)
|
153
|
+
self[:m14] = new_m14
|
154
|
+
end
|
155
|
+
|
156
|
+
# Matrix fourth row (4 components)
|
157
|
+
# @return [Float] m3
|
158
|
+
def m3 = self[:m3]
|
159
|
+
|
160
|
+
# Sets Matrix fourth row (4 components)
|
161
|
+
def m3=(new_m3)
|
162
|
+
self[:m3] = new_m3
|
163
|
+
end
|
164
|
+
|
165
|
+
# Matrix fourth row (4 components)
|
166
|
+
# @return [Float] m7
|
167
|
+
def m7 = self[:m7]
|
168
|
+
|
169
|
+
# Sets Matrix fourth row (4 components)
|
170
|
+
def m7=(new_m7)
|
171
|
+
self[:m7] = new_m7
|
172
|
+
end
|
173
|
+
|
174
|
+
# Matrix fourth row (4 components)
|
175
|
+
# @return [Float] m11
|
176
|
+
def m11 = self[:m11]
|
177
|
+
|
178
|
+
# Sets Matrix fourth row (4 components)
|
179
|
+
def m11=(new_m11)
|
180
|
+
self[:m11] = new_m11
|
181
|
+
end
|
182
|
+
|
183
|
+
# Matrix fourth row (4 components)
|
184
|
+
# @return [Float] m15
|
185
|
+
def m15 = self[:m15]
|
186
|
+
|
187
|
+
# Sets Matrix fourth row (4 components)
|
188
|
+
def m15=(new_m15)
|
189
|
+
self[:m15] = new_m15
|
190
|
+
end
|
191
|
+
end
|
192
|
+
end
|
@@ -0,0 +1,181 @@
|
|
1
|
+
module Raylib
|
2
|
+
# Mesh, vertex data and vao/vbo
|
3
|
+
class Mesh < FFI::Struct
|
4
|
+
layout(
|
5
|
+
:vertexCount, :int, # Number of vertices stored in arrays,
|
6
|
+
:triangleCount, :int, # Number of triangles stored (indexed or not),
|
7
|
+
:vertices, :pointer, # Vertex position (XYZ - 3 components per vertex) (shader-location = 0),
|
8
|
+
:texcoords, :pointer, # Vertex texture coordinates (UV - 2 components per vertex) (shader-location = 1),
|
9
|
+
:texcoords2, :pointer, # Vertex texture second coordinates (UV - 2 components per vertex) (shader-location = 5),
|
10
|
+
:normals, :pointer, # Vertex normals (XYZ - 3 components per vertex) (shader-location = 2),
|
11
|
+
:tangents, :pointer, # Vertex tangents (XYZW - 4 components per vertex) (shader-location = 4),
|
12
|
+
:colors, :pointer, # Vertex colors (RGBA - 4 components per vertex) (shader-location = 3),
|
13
|
+
:indices, :pointer, # Vertex indices (in case vertex data comes indexed),
|
14
|
+
:animVertices, :pointer, # Animated vertex positions (after bones transformations),
|
15
|
+
:animNormals, :pointer, # Animated normals (after bones transformations),
|
16
|
+
:boneIds, :pointer, # Vertex bone ids, max 255 bone ids, up to 4 bones influence by vertex (skinning),
|
17
|
+
:boneWeights, :pointer, # Vertex bone weight, up to 4 bones influence by vertex (skinning),
|
18
|
+
:vaoId, :uint, # OpenGL Vertex Array Object id,
|
19
|
+
:vboId, :pointer, # OpenGL Vertex Buffer Objects id (default vertex data)
|
20
|
+
)
|
21
|
+
|
22
|
+
def self.create(vertex_count, triangle_count, vertices, texcoords, texcoords2, normals, tangents, colors, indices, anim_vertices, anim_normals, bone_ids, bone_weights, vao_id, vbo_id)
|
23
|
+
new.tap do |instance|
|
24
|
+
instance[:vertexCount] = vertex_count
|
25
|
+
instance[:triangleCount] = triangle_count
|
26
|
+
instance[:vertices] = vertices
|
27
|
+
instance[:texcoords] = texcoords
|
28
|
+
instance[:texcoords2] = texcoords2
|
29
|
+
instance[:normals] = normals
|
30
|
+
instance[:tangents] = tangents
|
31
|
+
instance[:colors] = colors
|
32
|
+
instance[:indices] = indices
|
33
|
+
instance[:animVertices] = anim_vertices
|
34
|
+
instance[:animNormals] = anim_normals
|
35
|
+
instance[:boneIds] = bone_ids
|
36
|
+
instance[:boneWeights] = bone_weights
|
37
|
+
instance[:vaoId] = vao_id
|
38
|
+
instance[:vboId] = vbo_id
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def to_s
|
43
|
+
"Raylib::Mesh##{object_id} vertex_count=#{vertex_count} triangle_count=#{triangle_count} vertices=#{vertices} texcoords=#{texcoords} texcoords2=#{texcoords2} normals=#{normals} tangents=#{tangents} colors=#{colors} indices=#{indices} anim_vertices=#{anim_vertices} anim_normals=#{anim_normals} bone_ids=#{bone_ids} bone_weights=#{bone_weights} vao_id=#{vao_id} vbo_id=#{vbo_id}"
|
44
|
+
end
|
45
|
+
|
46
|
+
# Number of vertices stored in arrays
|
47
|
+
# @return [Integer] vertexCount
|
48
|
+
def vertex_count = self[:vertexCount]
|
49
|
+
|
50
|
+
# Sets Number of vertices stored in arrays
|
51
|
+
def vertex_count=(new_vertex_count)
|
52
|
+
self[:vertexCount] = new_vertex_count
|
53
|
+
end
|
54
|
+
|
55
|
+
# Number of triangles stored (indexed or not)
|
56
|
+
# @return [Integer] triangleCount
|
57
|
+
def triangle_count = self[:triangleCount]
|
58
|
+
|
59
|
+
# Sets Number of triangles stored (indexed or not)
|
60
|
+
def triangle_count=(new_triangle_count)
|
61
|
+
self[:triangleCount] = new_triangle_count
|
62
|
+
end
|
63
|
+
|
64
|
+
# Vertex position (XYZ - 3 components per vertex) (shader-location = 0)
|
65
|
+
# @return [float *] vertices
|
66
|
+
def vertices = self[:vertices]
|
67
|
+
|
68
|
+
# Sets Vertex position (XYZ - 3 components per vertex) (shader-location = 0)
|
69
|
+
def vertices=(new_vertices)
|
70
|
+
self[:vertices] = new_vertices
|
71
|
+
end
|
72
|
+
|
73
|
+
# Vertex texture coordinates (UV - 2 components per vertex) (shader-location = 1)
|
74
|
+
# @return [float *] texcoords
|
75
|
+
def texcoords = self[:texcoords]
|
76
|
+
|
77
|
+
# Sets Vertex texture coordinates (UV - 2 components per vertex) (shader-location = 1)
|
78
|
+
def texcoords=(new_texcoords)
|
79
|
+
self[:texcoords] = new_texcoords
|
80
|
+
end
|
81
|
+
|
82
|
+
# Vertex texture second coordinates (UV - 2 components per vertex) (shader-location = 5)
|
83
|
+
# @return [float *] texcoords2
|
84
|
+
def texcoords2 = self[:texcoords2]
|
85
|
+
|
86
|
+
# Sets Vertex texture second coordinates (UV - 2 components per vertex) (shader-location = 5)
|
87
|
+
def texcoords2=(new_texcoords2)
|
88
|
+
self[:texcoords2] = new_texcoords2
|
89
|
+
end
|
90
|
+
|
91
|
+
# Vertex normals (XYZ - 3 components per vertex) (shader-location = 2)
|
92
|
+
# @return [float *] normals
|
93
|
+
def normals = self[:normals]
|
94
|
+
|
95
|
+
# Sets Vertex normals (XYZ - 3 components per vertex) (shader-location = 2)
|
96
|
+
def normals=(new_normals)
|
97
|
+
self[:normals] = new_normals
|
98
|
+
end
|
99
|
+
|
100
|
+
# Vertex tangents (XYZW - 4 components per vertex) (shader-location = 4)
|
101
|
+
# @return [float *] tangents
|
102
|
+
def tangents = self[:tangents]
|
103
|
+
|
104
|
+
# Sets Vertex tangents (XYZW - 4 components per vertex) (shader-location = 4)
|
105
|
+
def tangents=(new_tangents)
|
106
|
+
self[:tangents] = new_tangents
|
107
|
+
end
|
108
|
+
|
109
|
+
# Vertex colors (RGBA - 4 components per vertex) (shader-location = 3)
|
110
|
+
# @return [unsigned char *] colors
|
111
|
+
def colors = self[:colors]
|
112
|
+
|
113
|
+
# Sets Vertex colors (RGBA - 4 components per vertex) (shader-location = 3)
|
114
|
+
def colors=(new_colors)
|
115
|
+
self[:colors] = new_colors
|
116
|
+
end
|
117
|
+
|
118
|
+
# Vertex indices (in case vertex data comes indexed)
|
119
|
+
# @return [unsigned short *] indices
|
120
|
+
def indices = self[:indices]
|
121
|
+
|
122
|
+
# Sets Vertex indices (in case vertex data comes indexed)
|
123
|
+
def indices=(new_indices)
|
124
|
+
self[:indices] = new_indices
|
125
|
+
end
|
126
|
+
|
127
|
+
# Animated vertex positions (after bones transformations)
|
128
|
+
# @return [float *] animVertices
|
129
|
+
def anim_vertices = self[:animVertices]
|
130
|
+
|
131
|
+
# Sets Animated vertex positions (after bones transformations)
|
132
|
+
def anim_vertices=(new_anim_vertices)
|
133
|
+
self[:animVertices] = new_anim_vertices
|
134
|
+
end
|
135
|
+
|
136
|
+
# Animated normals (after bones transformations)
|
137
|
+
# @return [float *] animNormals
|
138
|
+
def anim_normals = self[:animNormals]
|
139
|
+
|
140
|
+
# Sets Animated normals (after bones transformations)
|
141
|
+
def anim_normals=(new_anim_normals)
|
142
|
+
self[:animNormals] = new_anim_normals
|
143
|
+
end
|
144
|
+
|
145
|
+
# Vertex bone ids, max 255 bone ids, up to 4 bones influence by vertex (skinning)
|
146
|
+
# @return [unsigned char *] boneIds
|
147
|
+
def bone_ids = self[:boneIds]
|
148
|
+
|
149
|
+
# Sets Vertex bone ids, max 255 bone ids, up to 4 bones influence by vertex (skinning)
|
150
|
+
def bone_ids=(new_bone_ids)
|
151
|
+
self[:boneIds] = new_bone_ids
|
152
|
+
end
|
153
|
+
|
154
|
+
# Vertex bone weight, up to 4 bones influence by vertex (skinning)
|
155
|
+
# @return [float *] boneWeights
|
156
|
+
def bone_weights = self[:boneWeights]
|
157
|
+
|
158
|
+
# Sets Vertex bone weight, up to 4 bones influence by vertex (skinning)
|
159
|
+
def bone_weights=(new_bone_weights)
|
160
|
+
self[:boneWeights] = new_bone_weights
|
161
|
+
end
|
162
|
+
|
163
|
+
# OpenGL Vertex Array Object id
|
164
|
+
# @return [Integer] vaoId
|
165
|
+
def vao_id = self[:vaoId]
|
166
|
+
|
167
|
+
# Sets OpenGL Vertex Array Object id
|
168
|
+
def vao_id=(new_vao_id)
|
169
|
+
self[:vaoId] = new_vao_id
|
170
|
+
end
|
171
|
+
|
172
|
+
# OpenGL Vertex Buffer Objects id (default vertex data)
|
173
|
+
# @return [unsigned int *] vboId
|
174
|
+
def vbo_id = self[:vboId]
|
175
|
+
|
176
|
+
# Sets OpenGL Vertex Buffer Objects id (default vertex data)
|
177
|
+
def vbo_id=(new_vbo_id)
|
178
|
+
self[:vboId] = new_vbo_id
|
179
|
+
end
|
180
|
+
end
|
181
|
+
end
|
@@ -0,0 +1,115 @@
|
|
1
|
+
module Raylib
|
2
|
+
# Model, meshes, materials and animation data
|
3
|
+
class Model < FFI::Struct
|
4
|
+
layout(
|
5
|
+
:transform, Matrix, # Local transform matrix,
|
6
|
+
:meshCount, :int, # Number of meshes,
|
7
|
+
:materialCount, :int, # Number of materials,
|
8
|
+
:meshes, :pointer, # Meshes array,
|
9
|
+
:materials, :pointer, # Materials array,
|
10
|
+
:meshMaterial, :pointer, # Mesh material number,
|
11
|
+
:boneCount, :int, # Number of bones,
|
12
|
+
:bones, :pointer, # Bones information (skeleton),
|
13
|
+
:bindPose, :pointer, # Bones base transformation (pose)
|
14
|
+
)
|
15
|
+
|
16
|
+
def self.create(transform, mesh_count, material_count, meshes, materials, mesh_material, bone_count, bones, bind_pose)
|
17
|
+
new.tap do |instance|
|
18
|
+
instance[:transform] = transform
|
19
|
+
instance[:meshCount] = mesh_count
|
20
|
+
instance[:materialCount] = material_count
|
21
|
+
instance[:meshes] = meshes
|
22
|
+
instance[:materials] = materials
|
23
|
+
instance[:meshMaterial] = mesh_material
|
24
|
+
instance[:boneCount] = bone_count
|
25
|
+
instance[:bones] = bones
|
26
|
+
instance[:bindPose] = bind_pose
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def to_s
|
31
|
+
"Raylib::Model##{object_id} transform=#{transform} mesh_count=#{mesh_count} material_count=#{material_count} meshes=#{meshes} materials=#{materials} mesh_material=#{mesh_material} bone_count=#{bone_count} bones=#{bones} bind_pose=#{bind_pose}"
|
32
|
+
end
|
33
|
+
|
34
|
+
# Local transform matrix
|
35
|
+
# @return [Matrix] transform
|
36
|
+
def transform = self[:transform]
|
37
|
+
|
38
|
+
# Sets Local transform matrix
|
39
|
+
def transform=(new_transform)
|
40
|
+
self[:transform] = new_transform
|
41
|
+
end
|
42
|
+
|
43
|
+
# Number of meshes
|
44
|
+
# @return [Integer] meshCount
|
45
|
+
def mesh_count = self[:meshCount]
|
46
|
+
|
47
|
+
# Sets Number of meshes
|
48
|
+
def mesh_count=(new_mesh_count)
|
49
|
+
self[:meshCount] = new_mesh_count
|
50
|
+
end
|
51
|
+
|
52
|
+
# Number of materials
|
53
|
+
# @return [Integer] materialCount
|
54
|
+
def material_count = self[:materialCount]
|
55
|
+
|
56
|
+
# Sets Number of materials
|
57
|
+
def material_count=(new_material_count)
|
58
|
+
self[:materialCount] = new_material_count
|
59
|
+
end
|
60
|
+
|
61
|
+
# Meshes array
|
62
|
+
# @return [Mesh *] meshes
|
63
|
+
def meshes = self[:meshes]
|
64
|
+
|
65
|
+
# Sets Meshes array
|
66
|
+
def meshes=(new_meshes)
|
67
|
+
self[:meshes] = new_meshes
|
68
|
+
end
|
69
|
+
|
70
|
+
# Materials array
|
71
|
+
# @return [Material *] materials
|
72
|
+
def materials = self[:materials]
|
73
|
+
|
74
|
+
# Sets Materials array
|
75
|
+
def materials=(new_materials)
|
76
|
+
self[:materials] = new_materials
|
77
|
+
end
|
78
|
+
|
79
|
+
# Mesh material number
|
80
|
+
# @return [int *] meshMaterial
|
81
|
+
def mesh_material = self[:meshMaterial]
|
82
|
+
|
83
|
+
# Sets Mesh material number
|
84
|
+
def mesh_material=(new_mesh_material)
|
85
|
+
self[:meshMaterial] = new_mesh_material
|
86
|
+
end
|
87
|
+
|
88
|
+
# Number of bones
|
89
|
+
# @return [Integer] boneCount
|
90
|
+
def bone_count = self[:boneCount]
|
91
|
+
|
92
|
+
# Sets Number of bones
|
93
|
+
def bone_count=(new_bone_count)
|
94
|
+
self[:boneCount] = new_bone_count
|
95
|
+
end
|
96
|
+
|
97
|
+
# Bones information (skeleton)
|
98
|
+
# @return [BoneInfo *] bones
|
99
|
+
def bones = self[:bones]
|
100
|
+
|
101
|
+
# Sets Bones information (skeleton)
|
102
|
+
def bones=(new_bones)
|
103
|
+
self[:bones] = new_bones
|
104
|
+
end
|
105
|
+
|
106
|
+
# Bones base transformation (pose)
|
107
|
+
# @return [Transform *] bindPose
|
108
|
+
def bind_pose = self[:bindPose]
|
109
|
+
|
110
|
+
# Sets Bones base transformation (pose)
|
111
|
+
def bind_pose=(new_bind_pose)
|
112
|
+
self[:bindPose] = new_bind_pose
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
module Raylib
|
2
|
+
# ModelAnimation
|
3
|
+
class ModelAnimation < FFI::Struct
|
4
|
+
layout(
|
5
|
+
:boneCount, :int, # Number of bones,
|
6
|
+
:frameCount, :int, # Number of animation frames,
|
7
|
+
:bones, :pointer, # Bones information (skeleton),
|
8
|
+
:framePoses, :pointer, # Poses array by frame
|
9
|
+
)
|
10
|
+
|
11
|
+
def self.create(bone_count, frame_count, bones, frame_poses)
|
12
|
+
new.tap do |instance|
|
13
|
+
instance[:boneCount] = bone_count
|
14
|
+
instance[:frameCount] = frame_count
|
15
|
+
instance[:bones] = bones
|
16
|
+
instance[:framePoses] = frame_poses
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def to_s
|
21
|
+
"Raylib::ModelAnimation##{object_id} bone_count=#{bone_count} frame_count=#{frame_count} bones=#{bones} frame_poses=#{frame_poses}"
|
22
|
+
end
|
23
|
+
|
24
|
+
# Number of bones
|
25
|
+
# @return [Integer] boneCount
|
26
|
+
def bone_count = self[:boneCount]
|
27
|
+
|
28
|
+
# Sets Number of bones
|
29
|
+
def bone_count=(new_bone_count)
|
30
|
+
self[:boneCount] = new_bone_count
|
31
|
+
end
|
32
|
+
|
33
|
+
# Number of animation frames
|
34
|
+
# @return [Integer] frameCount
|
35
|
+
def frame_count = self[:frameCount]
|
36
|
+
|
37
|
+
# Sets Number of animation frames
|
38
|
+
def frame_count=(new_frame_count)
|
39
|
+
self[:frameCount] = new_frame_count
|
40
|
+
end
|
41
|
+
|
42
|
+
# Bones information (skeleton)
|
43
|
+
# @return [BoneInfo *] bones
|
44
|
+
def bones = self[:bones]
|
45
|
+
|
46
|
+
# Sets Bones information (skeleton)
|
47
|
+
def bones=(new_bones)
|
48
|
+
self[:bones] = new_bones
|
49
|
+
end
|
50
|
+
|
51
|
+
# Poses array by frame
|
52
|
+
# @return [Transform **] framePoses
|
53
|
+
def frame_poses = self[:framePoses]
|
54
|
+
|
55
|
+
# Sets Poses array by frame
|
56
|
+
def frame_poses=(new_frame_poses)
|
57
|
+
self[:framePoses] = new_frame_poses
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
module Raylib
|
2
|
+
# Music, audio stream, anything longer than ~10 seconds should be streamed
|
3
|
+
class Music < FFI::Struct
|
4
|
+
layout(
|
5
|
+
:stream, AudioStream, # Audio stream,
|
6
|
+
:frameCount, :uint, # Total number of frames (considering channels),
|
7
|
+
:looping, :bool, # Music looping enable,
|
8
|
+
:ctxType, :int, # Type of music context (audio filetype),
|
9
|
+
:ctxData, :pointer, # Audio context data, depends on type
|
10
|
+
)
|
11
|
+
|
12
|
+
def self.create(stream, frame_count, looping, ctx_type, ctx_data)
|
13
|
+
new.tap do |instance|
|
14
|
+
instance[:stream] = stream
|
15
|
+
instance[:frameCount] = frame_count
|
16
|
+
instance[:looping] = looping
|
17
|
+
instance[:ctxType] = ctx_type
|
18
|
+
instance[:ctxData] = ctx_data
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def to_s
|
23
|
+
"Raylib::Music##{object_id} stream=#{stream} frame_count=#{frame_count} looping=#{looping} ctx_type=#{ctx_type} ctx_data=#{ctx_data}"
|
24
|
+
end
|
25
|
+
|
26
|
+
# Audio stream
|
27
|
+
# @return [AudioStream] stream
|
28
|
+
def stream = self[:stream]
|
29
|
+
|
30
|
+
# Sets Audio stream
|
31
|
+
def stream=(new_stream)
|
32
|
+
self[:stream] = new_stream
|
33
|
+
end
|
34
|
+
|
35
|
+
# Total number of frames (considering channels)
|
36
|
+
# @return [Integer] frameCount
|
37
|
+
def frame_count = self[:frameCount]
|
38
|
+
|
39
|
+
# Sets Total number of frames (considering channels)
|
40
|
+
def frame_count=(new_frame_count)
|
41
|
+
self[:frameCount] = new_frame_count
|
42
|
+
end
|
43
|
+
|
44
|
+
# Music looping enable
|
45
|
+
# @return [bool] looping
|
46
|
+
def looping = self[:looping]
|
47
|
+
|
48
|
+
# Sets Music looping enable
|
49
|
+
def looping=(new_looping)
|
50
|
+
self[:looping] = new_looping
|
51
|
+
end
|
52
|
+
|
53
|
+
# Type of music context (audio filetype)
|
54
|
+
# @return [Integer] ctxType
|
55
|
+
def ctx_type = self[:ctxType]
|
56
|
+
|
57
|
+
# Sets Type of music context (audio filetype)
|
58
|
+
def ctx_type=(new_ctx_type)
|
59
|
+
self[:ctxType] = new_ctx_type
|
60
|
+
end
|
61
|
+
|
62
|
+
# Audio context data, depends on type
|
63
|
+
# @return [void *] ctxData
|
64
|
+
def ctx_data = self[:ctxData]
|
65
|
+
|
66
|
+
# Sets Audio context data, depends on type
|
67
|
+
def ctx_data=(new_ctx_data)
|
68
|
+
self[:ctxData] = new_ctx_data
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|