snow-math 1.5.1 → 1.5.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5f5696ed257e851e8ed109d5fbf527841504d090
4
- data.tar.gz: dc7f9f39fae35757d29bda44a1d1c3c27c5e619f
3
+ metadata.gz: 3a51bb323669b2f4f06bba42373bee886ff6fe5b
4
+ data.tar.gz: 89770e67ef087bd254efd4138ffa60acf345baac
5
5
  SHA512:
6
- metadata.gz: d14a2833f14fa0be4ce7e6c3a3a5de78d070d5018b8f5908c2be9eb9ad352e5fc4faaf946ea8b6a57602d8ca5bf5faa6dda12356d622139939d351a3abd9ead8
7
- data.tar.gz: a2269af59520da80c1a950d39d46e1264f13f29bd08a720e773a0a71d8cda5d7039156c31db3c593ce9a211155a55bf453762e4136d9b3c4a8ea41faaf2ea7d5
6
+ metadata.gz: c88c4b0e95a1791b79ce954cd5411e17468a37fa603c00066fdd80133ee4b5275299afed4f0705962bc211d2d2f0c4c2ac6ee550be226a15df313af36386853a
7
+ data.tar.gz: 39428e2b13941b242a1b642c901751bf857ca08740b57e602c5f8b42653490543a7834e3c9ebf756a48f107bb363589c2cc1e9e43e9696a1748ec3418b42e82a
data/README.md CHANGED
@@ -8,7 +8,7 @@
8
8
 
9
9
  snow-math is a small, fairly simple library of 3D math routines implemented in
10
10
  C with Ruby bindings. It's intended for use with OpenGL and such. Currently, it
11
- provides four 3D math types:
11
+ provides six 3D math types:
12
12
 
13
13
  - Snow::Vec2
14
14
  - Snow::Vec3
@@ -235,15 +235,15 @@ void mat4_frustum(s_float_t left, s_float_t right, s_float_t bottom, s_float_t t
235
235
  const s_float_t xdelta = right - left;
236
236
  const s_float_t ydelta = top - bottom;
237
237
  const s_float_t zdelta = far - near;
238
- const s_float_t neardouble = s_float_lit(2.0) * near;
238
+ const s_float_t two_near = s_float_lit(2.0) * near;
239
239
 
240
- out[0] = neardouble / xdelta;
240
+ out[0] = two_near / xdelta;
241
241
  out[2] = (right + left) / xdelta;
242
- out[5] = neardouble / ydelta;
242
+ out[5] = two_near / ydelta;
243
243
  out[6] = (top + bottom) / ydelta;
244
244
  out[10] = -((far + near) / zdelta);
245
245
  out[11] = s_float_lit(-1.0);
246
- out[14] = -((neardouble * far) / zdelta);
246
+ out[14] = -((two_near * far) / zdelta);
247
247
  out[1] = out[3] = out[4] =
248
248
  out[7] = out[8] = out[9] =
249
249
  out[12] = out[13] = out[15] = s_float_lit(0.0);
@@ -269,16 +269,12 @@ void mat4_orthographic(s_float_t left, s_float_t right, s_float_t bottom, s_floa
269
269
 
270
270
  void mat4_perspective(s_float_t fov_y, s_float_t aspect, s_float_t near, s_float_t far, mat4_t out)
271
271
  {
272
- const s_float_t r = s_tan(fov_y * s_float_lit(0.5) * S_DEG2RAD);
273
- const s_float_t left = -r * aspect;
274
- const s_float_t right = r * aspect;
275
- const s_float_t bottom = -r;
276
- const s_float_t top = r;
272
+ const s_float_t cotan = s_float_lit(1.0) / s_tan(fov_y * s_float_lit(0.5) * S_DEG2RAD);
277
273
  const s_float_t two_near = s_float_lit(2.0) * near;
278
274
  const s_float_t zdelta = s_float_lit(1.0) / (near - far);
279
275
 
280
- out[0] = two_near * (right - left);
281
- out[5] = two_near / (top - bottom);
276
+ out[0] = cotan / aspect;
277
+ out[5] = cotan;
282
278
  out[10] = (far + near) * zdelta;
283
279
  out[11] = s_float_lit(-1.0);
284
280
  out[14] = (two_near * far) * zdelta;
@@ -2,6 +2,7 @@
2
2
  # Copyright (c) 2013 Noel Raymond Cower. All rights reserved.
3
3
  # See COPYING for license details.
4
4
 
5
+ require 'snow-math/version'
5
6
  require 'snow-math/bindings'
6
7
  require 'snow-math/vec2'
7
8
  require 'snow-math/vec3'
@@ -13,15 +14,3 @@ require 'snow-math/swizzle'
13
14
  require 'snow-math/inspect'
14
15
  require 'snow-math/to_a'
15
16
  require 'snow-math/marshal'
16
-
17
- #
18
- # Snow module -- covers Snow-related classes and methods.
19
- #
20
- module Snow
21
-
22
- #
23
- # snow-math bindings version string.
24
- #
25
- SNOW_MATH_VERSION = '1.5.1'
26
-
27
- end
@@ -0,0 +1,12 @@
1
+ # This file is part of ruby-snowmath.
2
+ # Copyright (c) 2013 Noel Raymond Cower. All rights reserved.
3
+ # See COPYING for license details.
4
+
5
+ module Snow
6
+
7
+ #
8
+ # snow-math bindings version string.
9
+ #
10
+ SNOW_MATH_VERSION = '1.5.3'
11
+
12
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: snow-math
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.1
4
+ version: 1.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Noel Raymond Cower
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-07-15 00:00:00.000000000 Z
11
+ date: 2013-07-24 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Math types built on the SnowPalm math code
14
14
  email: ncower@gmail.com
@@ -31,6 +31,7 @@ files:
31
31
  - lib/snow-math/vec2.rb
32
32
  - lib/snow-math/vec3.rb
33
33
  - lib/snow-math/vec4.rb
34
+ - lib/snow-math/version.rb
34
35
  - lib/snow-math.rb
35
36
  - ext/snow-math/mat3.c
36
37
  - ext/snow-math/mat4.c