snow-math 0.0.2 → 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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 69bcab44215ebbcc4cddd9cd6128e606dd3badf2
4
- data.tar.gz: f302d2bb8d7a3895bb84473f605b691e88038f60
3
+ metadata.gz: 06c2a2a9cd139c807ff150d18ca76fd89bee201c
4
+ data.tar.gz: 8c85e6d28b419162c6ded6d66bddd2ed7aae2af7
5
5
  SHA512:
6
- metadata.gz: a7695e785485cb2e0dfad66d044bed4e9e92e82ab74a6bb0d1210de6c31e1fdca9a84f1c2265ac55160873104ef011d3bfe16e52f54cb73a0e2f3c60edba55de
7
- data.tar.gz: 520dda557d59c66f7660406f88cead654645d1b481202649e112833df966c15f91aa937a37efbcefdc15e344326d51e1c1dbf60ab11caf0d9929fb6c8123fa78
6
+ metadata.gz: 83c7950be8b9393e58e9ddb6549e1ab34ac30cc26abdd6e91651aa6753641522edc141159e5c658f3b4e4048d96ee97537b8d4f721449a698f96dc6721886ca8
7
+ data.tar.gz: 95666f511d19d35cadb78bec99051f536cb3a825c00fbbbc1437ca532a6b8fa749204173d1ccb31a1cf90db4c052a73d9e05d5b076f599f70155c5220ddbb3ac
data/lib/snow-math.rb CHANGED
@@ -10,5 +10,6 @@ require 'snow-math/quat'
10
10
  require 'snow-math/swizzle'
11
11
  require 'snow-math/inspect'
12
12
  require 'snow-math/to_a'
13
+ require 'snow-math/array_cache'
13
14
 
14
15
  module Snow ; end
@@ -0,0 +1,26 @@
1
+ require 'snow-math/bindings'
2
+
3
+ module Snow
4
+
5
+ [:Vec3Array, :Vec4Array, :QuatArray, :Mat4Array].each {
6
+ |klass_sym|
7
+ if const_defined?(klass_sym)
8
+ const_get(klass_sym).class_exec {
9
+ alias_method :__fetch__, :fetch
10
+ alias_method :__array_cache_initialize__, :initialize
11
+
12
+ def initialize(*args)
13
+ @__cache__ = []
14
+ __array_cache_initialize__(*args)
15
+ end
16
+
17
+ def fetch(index)
18
+ @__cache__[index] || (@__cache__[index] = __fetch__(index))
19
+ end
20
+
21
+ alias_method :[], :fetch
22
+ }
23
+ end
24
+ }
25
+
26
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: snow-math
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Noel Raymond Cower
@@ -17,6 +17,7 @@ extensions:
17
17
  - ext/extconf.rb
18
18
  extra_rdoc_files: []
19
19
  files:
20
+ - lib/snow-math/array_cache.rb
20
21
  - lib/snow-math/inspect.rb
21
22
  - lib/snow-math/line.rb
22
23
  - lib/snow-math/mat3.rb
@@ -55,7 +56,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
55
56
  requirements:
56
57
  - - '>='
57
58
  - !ruby/object:Gem::Version
58
- version: '0'
59
+ version: 2.0.0
59
60
  required_rubygems_version: !ruby/object:Gem::Requirement
60
61
  requirements:
61
62
  - - '>='