cglm 0.1.0 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -1
- data/Gemfile.lock +18 -16
- data/README.md +2 -0
- data/cglm.gemspec +3 -3
- data/ext/cglm/cglm-0.6.2/include/cglm/affine-mat.h +168 -0
- data/ext/cglm/cglm-0.6.2/include/cglm/affine.h +490 -0
- data/ext/cglm/cglm-0.6.2/include/cglm/applesimd.h +95 -0
- data/ext/cglm/cglm-0.6.2/include/cglm/bezier.h +154 -0
- data/ext/cglm/cglm-0.6.2/include/cglm/box.h +279 -0
- data/ext/cglm/cglm-0.6.2/include/cglm/call/affine.h +117 -0
- data/ext/cglm/cglm-0.6.2/include/cglm/call/bezier.h +31 -0
- data/ext/cglm/cglm-0.6.2/include/cglm/call/box.h +79 -0
- data/ext/cglm/cglm-0.6.2/include/cglm/call/cam.h +143 -0
- data/ext/cglm/cglm-0.6.2/include/cglm/call/curve.h +23 -0
- data/ext/cglm/cglm-0.6.2/include/cglm/call/ease.h +143 -0
- data/ext/cglm/cglm-0.6.2/include/cglm/call/euler.h +55 -0
- data/ext/cglm/cglm-0.6.2/include/cglm/call/frustum.h +41 -0
- data/ext/cglm/cglm-0.6.2/include/cglm/call/io.h +44 -0
- data/ext/cglm/cglm-0.6.2/include/cglm/call/mat3.h +86 -0
- data/ext/cglm/cglm-0.6.2/include/cglm/call/mat4.h +127 -0
- data/ext/cglm/cglm-0.6.2/include/cglm/call/plane.h +23 -0
- data/ext/cglm/cglm-0.6.2/include/cglm/call/project.h +33 -0
- data/ext/cglm/cglm-0.6.2/include/cglm/call/quat.h +159 -0
- data/ext/cglm/cglm-0.6.2/include/cglm/call/sphere.h +39 -0
- data/ext/cglm/cglm-0.6.2/include/cglm/call/vec3.h +312 -0
- data/ext/cglm/cglm-0.6.2/include/cglm/call/vec4.h +290 -0
- data/ext/cglm/cglm-0.6.2/include/cglm/call.h +36 -0
- data/ext/cglm/cglm-0.6.2/include/cglm/cam.h +585 -0
- data/ext/cglm/cglm-0.6.2/include/cglm/cglm.h +32 -0
- data/ext/cglm/cglm-0.6.2/include/cglm/color.h +26 -0
- data/ext/cglm/cglm-0.6.2/include/cglm/common.h +37 -0
- data/ext/cglm/cglm-0.6.2/include/cglm/curve.h +40 -0
- data/ext/cglm/cglm-0.6.2/include/cglm/ease.h +317 -0
- data/ext/cglm/cglm-0.6.2/include/cglm/euler.h +453 -0
- data/ext/cglm/cglm-0.6.2/include/cglm/frustum.h +255 -0
- data/ext/cglm/cglm-0.6.2/include/cglm/io.h +203 -0
- data/ext/cglm/cglm-0.6.2/include/cglm/mat3.h +422 -0
- data/ext/cglm/cglm-0.6.2/include/cglm/mat4.h +726 -0
- data/ext/cglm/cglm-0.6.2/include/cglm/plane.h +36 -0
- data/ext/cglm/cglm-0.6.2/include/cglm/project.h +118 -0
- data/ext/cglm/cglm-0.6.2/include/cglm/quat.h +828 -0
- data/ext/cglm/cglm-0.6.2/include/cglm/simd/arm.h +83 -0
- data/ext/cglm/cglm-0.6.2/include/cglm/simd/avx/affine.h +66 -0
- data/ext/cglm/cglm-0.6.2/include/cglm/simd/avx/mat4.h +66 -0
- data/ext/cglm/cglm-0.6.2/include/cglm/simd/intrin.h +90 -0
- data/ext/cglm/cglm-0.6.2/include/cglm/simd/neon/mat4.h +57 -0
- data/ext/cglm/cglm-0.6.2/include/cglm/simd/sse2/affine.h +111 -0
- data/ext/cglm/cglm-0.6.2/include/cglm/simd/sse2/mat3.h +59 -0
- data/ext/cglm/cglm-0.6.2/include/cglm/simd/sse2/mat4.h +405 -0
- data/ext/cglm/cglm-0.6.2/include/cglm/simd/sse2/quat.h +46 -0
- data/ext/cglm/cglm-0.6.2/include/cglm/simd/x86.h +192 -0
- data/ext/cglm/cglm-0.6.2/include/cglm/sphere.h +99 -0
- data/ext/cglm/cglm-0.6.2/include/cglm/struct/affine.h +337 -0
- data/ext/cglm/cglm-0.6.2/include/cglm/struct/box.h +256 -0
- data/ext/cglm/cglm-0.6.2/include/cglm/struct/cam.h +451 -0
- data/ext/cglm/cglm-0.6.2/include/cglm/struct/color.h +27 -0
- data/ext/cglm/cglm-0.6.2/include/cglm/struct/curve.h +40 -0
- data/ext/cglm/cglm-0.6.2/include/cglm/struct/euler.h +152 -0
- data/ext/cglm/cglm-0.6.2/include/cglm/struct/frustum.h +155 -0
- data/ext/cglm/cglm-0.6.2/include/cglm/struct/io.h +82 -0
- data/ext/cglm/cglm-0.6.2/include/cglm/struct/mat3.h +285 -0
- data/ext/cglm/cglm-0.6.2/include/cglm/struct/mat4.h +459 -0
- data/ext/cglm/cglm-0.6.2/include/cglm/struct/plane.h +40 -0
- data/ext/cglm/cglm-0.6.2/include/cglm/struct/project.h +104 -0
- data/ext/cglm/cglm-0.6.2/include/cglm/struct/quat.h +532 -0
- data/ext/cglm/cglm-0.6.2/include/cglm/struct/sphere.h +93 -0
- data/ext/cglm/cglm-0.6.2/include/cglm/struct/vec3-ext.h +257 -0
- data/ext/cglm/cglm-0.6.2/include/cglm/struct/vec3.h +970 -0
- data/ext/cglm/cglm-0.6.2/include/cglm/struct/vec4-ext.h +257 -0
- data/ext/cglm/cglm-0.6.2/include/cglm/struct/vec4.h +814 -0
- data/ext/cglm/cglm-0.6.2/include/cglm/struct.h +36 -0
- data/ext/cglm/cglm-0.6.2/include/cglm/types-struct.h +129 -0
- data/ext/cglm/cglm-0.6.2/include/cglm/types.h +76 -0
- data/ext/cglm/cglm-0.6.2/include/cglm/util.h +328 -0
- data/ext/cglm/cglm-0.6.2/include/cglm/vec3-ext.h +272 -0
- data/ext/cglm/cglm-0.6.2/include/cglm/vec3.h +1078 -0
- data/ext/cglm/cglm-0.6.2/include/cglm/vec4-ext.h +315 -0
- data/ext/cglm/cglm-0.6.2/include/cglm/vec4.h +1078 -0
- data/ext/cglm/cglm-0.6.2/include/cglm/version.h +15 -0
- data/ext/cglm/extconf.rb +2 -3
- data/ext/cglm/rb_cglm.h +5 -3
- data/ext/cglm/rb_cglm_mat3.c +3 -3
- data/ext/cglm/rb_cglm_mat4.c +3 -3
- data/ext/cglm/rb_cglm_quat.c +2 -2
- data/ext/cglm/rb_cglm_vec3.c +63 -61
- data/ext/cglm/rb_cglm_vec4.c +2 -0
- data/ext/cglm/ruby_pre27.h +35 -0
- data/lib/cglm/vec3.rb +2 -2
- data/lib/cglm/vec4.rb +2 -2
- data/lib/cglm/vector_type.rb +15 -0
- data/lib/cglm/version.rb +1 -1
- metadata +89 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d1b055efd84ea5f04fd2db0580fbc15df485b59c45afe73c41aa8e0eff9701d1
|
4
|
+
data.tar.gz: 5a65edbb6ee9a569fa87459f630e40c6b98d94c705658b9c365accdcc0c304b2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 66ad4516dc605c3fe302ce923ad2a54f027b7ee7d2601b4b65d2e1bf6f4ca681fd344a137baed3c12ea5c01f4124cf3bd6d6d0d5c89c3b4b46fd15690a9d1ed5
|
7
|
+
data.tar.gz: 975f418d0f8c3a9e74f726bd8423bd078a43f268d6263edb5198c06c45471d1215f4c78057c7d5fd0930158916606d1538de7838741d4794f89ce56be008b54f
|
data/.travis.yml
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,39 +1,41 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
cglm (0.1.
|
4
|
+
cglm (0.1.3)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
8
8
|
specs:
|
9
|
-
docile (1.
|
10
|
-
github-markup (
|
11
|
-
|
12
|
-
|
13
|
-
rake (
|
14
|
-
rake-compiler (1.0.5)
|
9
|
+
docile (1.4.0)
|
10
|
+
github-markup (4.0.0)
|
11
|
+
minitest (5.15.0)
|
12
|
+
rake (13.0.6)
|
13
|
+
rake-compiler (1.1.9)
|
15
14
|
rake
|
16
|
-
redcarpet (3.
|
17
|
-
simplecov (0.
|
15
|
+
redcarpet (3.5.1)
|
16
|
+
simplecov (0.21.2)
|
18
17
|
docile (~> 1.1)
|
19
|
-
|
20
|
-
|
21
|
-
simplecov-html (0.
|
22
|
-
|
18
|
+
simplecov-html (~> 0.11)
|
19
|
+
simplecov_json_formatter (~> 0.1)
|
20
|
+
simplecov-html (0.12.3)
|
21
|
+
simplecov_json_formatter (0.1.4)
|
22
|
+
webrick (1.7.0)
|
23
|
+
yard (0.9.27)
|
24
|
+
webrick (~> 1.7.0)
|
23
25
|
|
24
26
|
PLATFORMS
|
25
27
|
ruby
|
26
28
|
|
27
29
|
DEPENDENCIES
|
28
|
-
bundler (~> 1
|
30
|
+
bundler (~> 2.1)
|
29
31
|
cglm!
|
30
32
|
github-markup
|
31
33
|
minitest (~> 5.0)
|
32
|
-
rake (~>
|
34
|
+
rake (~> 13.0)
|
33
35
|
rake-compiler
|
34
36
|
redcarpet
|
35
37
|
simplecov
|
36
38
|
yard (~> 0.9)
|
37
39
|
|
38
40
|
BUNDLED WITH
|
39
|
-
|
41
|
+
2.2.3
|
data/README.md
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# CGLM
|
2
2
|
|
3
|
+
[![Build Status](https://travis-ci.org/sinisterchipmunk/cglm-ruby.svg?branch=master)](https://travis-ci.org/sinisterchipmunk/cglm-ruby)
|
4
|
+
|
3
5
|
Ruby bindings for [CGLM](https://github.com/recp/cglm), a high performance math library for OpenGL.
|
4
6
|
|
5
7
|
[CGLM](https://github.com/recp/cglm) provides support for SIMD on CPUs that support it in order to deliver better performance. This requires the variables to be aligned to 8-, 16- and 32-byte boundaries, but this gem automatically handles this requirement so you don't have to think about that.
|
data/cglm.gemspec
CHANGED
@@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
|
|
9
9
|
spec.authors = ["Colin MacKenzie IV"]
|
10
10
|
spec.email = ["sinisterchipmunk@gmail.com"]
|
11
11
|
|
12
|
-
spec.summary = %q{
|
12
|
+
spec.summary = %q{Ruby bindings for CGLM (https://github.com/recp/cglm), a high performance math library for graphics applications.}
|
13
13
|
spec.homepage = "https://github.com/sinisterchipmunk/cglm-ruby"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
@@ -35,8 +35,8 @@ Gem::Specification.new do |spec|
|
|
35
35
|
spec.require_paths = ["lib"]
|
36
36
|
spec.extensions = ["ext/cglm/extconf.rb"]
|
37
37
|
|
38
|
-
spec.add_development_dependency "bundler", "~> 1
|
39
|
-
spec.add_development_dependency "rake", "~>
|
38
|
+
spec.add_development_dependency "bundler", "~> 2.1"
|
39
|
+
spec.add_development_dependency "rake", "~> 13.0"
|
40
40
|
spec.add_development_dependency "rake-compiler"
|
41
41
|
spec.add_development_dependency "minitest", "~> 5.0"
|
42
42
|
spec.add_development_dependency "yard", "~> 0.9"
|
@@ -0,0 +1,168 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright (c), Recep Aslantas.
|
3
|
+
*
|
4
|
+
* MIT License (MIT), http://opensource.org/licenses/MIT
|
5
|
+
* Full license can be found in the LICENSE file
|
6
|
+
*/
|
7
|
+
|
8
|
+
/*
|
9
|
+
Functions:
|
10
|
+
CGLM_INLINE void glm_mul(mat4 m1, mat4 m2, mat4 dest);
|
11
|
+
CGLM_INLINE void glm_inv_tr(mat4 mat);
|
12
|
+
*/
|
13
|
+
|
14
|
+
#ifndef cglm_affine_mat_h
|
15
|
+
#define cglm_affine_mat_h
|
16
|
+
|
17
|
+
#include "common.h"
|
18
|
+
#include "mat4.h"
|
19
|
+
#include "mat3.h"
|
20
|
+
|
21
|
+
#ifdef CGLM_SSE_FP
|
22
|
+
# include "simd/sse2/affine.h"
|
23
|
+
#endif
|
24
|
+
|
25
|
+
#ifdef CGLM_AVX_FP
|
26
|
+
# include "simd/avx/affine.h"
|
27
|
+
#endif
|
28
|
+
|
29
|
+
/*!
|
30
|
+
* @brief this is similar to glm_mat4_mul but specialized to affine transform
|
31
|
+
*
|
32
|
+
* Matrix format should be:
|
33
|
+
* R R R X
|
34
|
+
* R R R Y
|
35
|
+
* R R R Z
|
36
|
+
* 0 0 0 W
|
37
|
+
*
|
38
|
+
* this reduces some multiplications. It should be faster than mat4_mul.
|
39
|
+
* if you are not sure about matrix format then DON'T use this! use mat4_mul
|
40
|
+
*
|
41
|
+
* @param[in] m1 affine matrix 1
|
42
|
+
* @param[in] m2 affine matrix 2
|
43
|
+
* @param[out] dest result matrix
|
44
|
+
*/
|
45
|
+
CGLM_INLINE
|
46
|
+
void
|
47
|
+
glm_mul(mat4 m1, mat4 m2, mat4 dest) {
|
48
|
+
#ifdef __AVX__
|
49
|
+
glm_mul_avx(m1, m2, dest);
|
50
|
+
#elif defined( __SSE__ ) || defined( __SSE2__ )
|
51
|
+
glm_mul_sse2(m1, m2, dest);
|
52
|
+
#else
|
53
|
+
float a00 = m1[0][0], a01 = m1[0][1], a02 = m1[0][2], a03 = m1[0][3],
|
54
|
+
a10 = m1[1][0], a11 = m1[1][1], a12 = m1[1][2], a13 = m1[1][3],
|
55
|
+
a20 = m1[2][0], a21 = m1[2][1], a22 = m1[2][2], a23 = m1[2][3],
|
56
|
+
a30 = m1[3][0], a31 = m1[3][1], a32 = m1[3][2], a33 = m1[3][3],
|
57
|
+
|
58
|
+
b00 = m2[0][0], b01 = m2[0][1], b02 = m2[0][2],
|
59
|
+
b10 = m2[1][0], b11 = m2[1][1], b12 = m2[1][2],
|
60
|
+
b20 = m2[2][0], b21 = m2[2][1], b22 = m2[2][2],
|
61
|
+
b30 = m2[3][0], b31 = m2[3][1], b32 = m2[3][2], b33 = m2[3][3];
|
62
|
+
|
63
|
+
dest[0][0] = a00 * b00 + a10 * b01 + a20 * b02;
|
64
|
+
dest[0][1] = a01 * b00 + a11 * b01 + a21 * b02;
|
65
|
+
dest[0][2] = a02 * b00 + a12 * b01 + a22 * b02;
|
66
|
+
dest[0][3] = a03 * b00 + a13 * b01 + a23 * b02;
|
67
|
+
|
68
|
+
dest[1][0] = a00 * b10 + a10 * b11 + a20 * b12;
|
69
|
+
dest[1][1] = a01 * b10 + a11 * b11 + a21 * b12;
|
70
|
+
dest[1][2] = a02 * b10 + a12 * b11 + a22 * b12;
|
71
|
+
dest[1][3] = a03 * b10 + a13 * b11 + a23 * b12;
|
72
|
+
|
73
|
+
dest[2][0] = a00 * b20 + a10 * b21 + a20 * b22;
|
74
|
+
dest[2][1] = a01 * b20 + a11 * b21 + a21 * b22;
|
75
|
+
dest[2][2] = a02 * b20 + a12 * b21 + a22 * b22;
|
76
|
+
dest[2][3] = a03 * b20 + a13 * b21 + a23 * b22;
|
77
|
+
|
78
|
+
dest[3][0] = a00 * b30 + a10 * b31 + a20 * b32 + a30 * b33;
|
79
|
+
dest[3][1] = a01 * b30 + a11 * b31 + a21 * b32 + a31 * b33;
|
80
|
+
dest[3][2] = a02 * b30 + a12 * b31 + a22 * b32 + a32 * b33;
|
81
|
+
dest[3][3] = a03 * b30 + a13 * b31 + a23 * b32 + a33 * b33;
|
82
|
+
#endif
|
83
|
+
}
|
84
|
+
|
85
|
+
/*!
|
86
|
+
* @brief this is similar to glm_mat4_mul but specialized to affine transform
|
87
|
+
*
|
88
|
+
* Right Matrix format should be:
|
89
|
+
* R R R 0
|
90
|
+
* R R R 0
|
91
|
+
* R R R 0
|
92
|
+
* 0 0 0 1
|
93
|
+
*
|
94
|
+
* this reduces some multiplications. It should be faster than mat4_mul.
|
95
|
+
* if you are not sure about matrix format then DON'T use this! use mat4_mul
|
96
|
+
*
|
97
|
+
* @param[in] m1 affine matrix 1
|
98
|
+
* @param[in] m2 affine matrix 2
|
99
|
+
* @param[out] dest result matrix
|
100
|
+
*/
|
101
|
+
CGLM_INLINE
|
102
|
+
void
|
103
|
+
glm_mul_rot(mat4 m1, mat4 m2, mat4 dest) {
|
104
|
+
#if defined( __SSE__ ) || defined( __SSE2__ )
|
105
|
+
glm_mul_rot_sse2(m1, m2, dest);
|
106
|
+
#else
|
107
|
+
float a00 = m1[0][0], a01 = m1[0][1], a02 = m1[0][2], a03 = m1[0][3],
|
108
|
+
a10 = m1[1][0], a11 = m1[1][1], a12 = m1[1][2], a13 = m1[1][3],
|
109
|
+
a20 = m1[2][0], a21 = m1[2][1], a22 = m1[2][2], a23 = m1[2][3],
|
110
|
+
a30 = m1[3][0], a31 = m1[3][1], a32 = m1[3][2], a33 = m1[3][3],
|
111
|
+
|
112
|
+
b00 = m2[0][0], b01 = m2[0][1], b02 = m2[0][2],
|
113
|
+
b10 = m2[1][0], b11 = m2[1][1], b12 = m2[1][2],
|
114
|
+
b20 = m2[2][0], b21 = m2[2][1], b22 = m2[2][2];
|
115
|
+
|
116
|
+
dest[0][0] = a00 * b00 + a10 * b01 + a20 * b02;
|
117
|
+
dest[0][1] = a01 * b00 + a11 * b01 + a21 * b02;
|
118
|
+
dest[0][2] = a02 * b00 + a12 * b01 + a22 * b02;
|
119
|
+
dest[0][3] = a03 * b00 + a13 * b01 + a23 * b02;
|
120
|
+
|
121
|
+
dest[1][0] = a00 * b10 + a10 * b11 + a20 * b12;
|
122
|
+
dest[1][1] = a01 * b10 + a11 * b11 + a21 * b12;
|
123
|
+
dest[1][2] = a02 * b10 + a12 * b11 + a22 * b12;
|
124
|
+
dest[1][3] = a03 * b10 + a13 * b11 + a23 * b12;
|
125
|
+
|
126
|
+
dest[2][0] = a00 * b20 + a10 * b21 + a20 * b22;
|
127
|
+
dest[2][1] = a01 * b20 + a11 * b21 + a21 * b22;
|
128
|
+
dest[2][2] = a02 * b20 + a12 * b21 + a22 * b22;
|
129
|
+
dest[2][3] = a03 * b20 + a13 * b21 + a23 * b22;
|
130
|
+
|
131
|
+
dest[3][0] = a30;
|
132
|
+
dest[3][1] = a31;
|
133
|
+
dest[3][2] = a32;
|
134
|
+
dest[3][3] = a33;
|
135
|
+
#endif
|
136
|
+
}
|
137
|
+
|
138
|
+
/*!
|
139
|
+
* @brief inverse orthonormal rotation + translation matrix (ridig-body)
|
140
|
+
*
|
141
|
+
* @code
|
142
|
+
* X = | R T | X' = | R' -R'T |
|
143
|
+
* | 0 1 | | 0 1 |
|
144
|
+
* @endcode
|
145
|
+
*
|
146
|
+
* @param[in,out] mat matrix
|
147
|
+
*/
|
148
|
+
CGLM_INLINE
|
149
|
+
void
|
150
|
+
glm_inv_tr(mat4 mat) {
|
151
|
+
#if defined( __SSE__ ) || defined( __SSE2__ )
|
152
|
+
glm_inv_tr_sse2(mat);
|
153
|
+
#else
|
154
|
+
CGLM_ALIGN_MAT mat3 r;
|
155
|
+
CGLM_ALIGN(8) vec3 t;
|
156
|
+
|
157
|
+
/* rotate */
|
158
|
+
glm_mat4_pick3t(mat, r);
|
159
|
+
glm_mat4_ins3(r, mat);
|
160
|
+
|
161
|
+
/* translate */
|
162
|
+
glm_mat3_mulv(r, mat[3], t);
|
163
|
+
glm_vec3_negate(t);
|
164
|
+
glm_vec3_copy(t, mat[3]);
|
165
|
+
#endif
|
166
|
+
}
|
167
|
+
|
168
|
+
#endif /* cglm_affine_mat_h */
|