mcc
a86935a39b
Allow ffi.metatype to fail so that "busted" unit tests work
...
On Github we run unit tests inside "busted". At the start of each test "busted" does some sort of trick (clearing package.loaded)? Which causes "require" to run again for all lua files. This breaks ffi.metatype with error "cannot change a protected metatable" if it is called twice with a single type name, since this is true global state. To work around this this patch wraps ffi.metatype calls in a xpcall() so that failure is silently ignored.
2019-11-29 21:13:30 -05:00
mcc
b5beacffc7
component_min(a,b) and component_max(a,b) functions for vector classes
2018-01-26 10:06:01 -05:00
Colby Klein
b122e4d726
fix typo
2017-03-29 05:32:16 -07:00
karai17
08b23e394b
Updated tests, fixed couple bugs
2016-12-15 19:57:31 -04:00
karai17
b3be2a154a
unfactor quat
2016-12-14 20:22:22 -04:00
karai17
8df45859e4
unfactor vec2 and vec3
2016-12-14 03:44:34 -04:00
Colby Klein
5fffa2f9d8
don't give NaN's when normalizing 0
2016-12-13 15:10:09 -08:00
karai17
799e1607bc
Updated to work outside of a sanitized environment.
2016-08-14 03:36:36 -03:00
karai17
20f9625ae2
Fixed vec2 and vec3 mul/div/scale
2016-08-14 01:29:24 -03:00
karai17
52eb8af61d
More LDoc tidying
2016-07-24 20:57:59 -03:00
karai17
871b86b4ab
Updated LDoc data for vec2 and vec3
2016-07-24 20:26:56 -03:00
karai17
5f7a7f29fa
Added quaternion tests
...
* Fixed an issue with is_quat, is_vec3, is_vec2, and is_mat4 methods
* Fixed a minor issue with local variables being declared too late
2016-07-21 20:04:32 -03:00
karai17
78b34590c5
vec2 and vec3 100% test coverage
2016-07-21 13:52:35 -03:00
karai17
2950352ac8
Updated color module, etc.
2016-07-20 22:17:25 -03:00
karai17
2aa0e7fcb6
Cleaned up internal code to be less verbose
2016-07-20 18:24:54 -03:00
karai17
4f9bc17bf4
Refactored mat4
...
Did some tidying up on quat, vec2, vec3, and utils
2016-07-19 23:55:21 -03:00
karai17
46f8261ea0
Refactored mat4 (in progress)
...
Cleaned up vec2, vec3, quat
2016-07-18 06:17:42 -03:00
karai17
add0a71c05
Added tests for vec2 and vec3
2016-07-15 22:07:48 -03:00
Landon Manning
437ac9135e
Reimplemented quat*vec3, quat/quat, and quat/number
...
Fixed a few minor things in vec2 and vec3
2015-12-28 10:15:05 -04:00
Matthew Blanchard
c5d02e0683
Updated vec3 doc comments. Brought vec2 in line with vec3. Doc commented vec2.
2015-12-25 18:35:03 -05:00
Matthew Blanchard
4302b2b5dc
Added unit vectors.
2015-12-24 16:49:21 -05:00
Matthew Blanchard
2b35d4ae57
Removed defaults. Added trim. Reworked __call so it works correctly. Made all functions return out.
2015-12-24 16:46:58 -05:00
Matthew Blanchard
6116576ad0
Fixed a small typo in vec3
2015-12-23 04:50:53 -05:00
Matthew Blanchard
94ef22b643
Fixed issues with ffi and cloning.
...
Fixed the ffi check to now work correctly and moved the ffi local up a
scope so that it could be used later in the file. Made clone simply call
new().
2015-12-23 03:19:09 -05:00
Matthew Blanchard
bb78a486b0
Fixed merge conflicts. Refactored reflect and refract.
2015-12-22 18:05:39 -05:00
Matthew Blanchard
57704e9dba
Added standard Lua fallback and documentation.
2015-12-22 17:55:59 -05:00
Colby Klein
b9e004dc1a
Add vec3.reflect and vec3.refract
2015-12-20 22:55:38 -08:00
Colby Klein
82f336a7f4
Fix broken vec2/vec3 clone.
2015-12-20 22:38:36 -08:00
Landon Manning
870a3c5129
Updated vec2 to match new vec3
...
Fixed code consistency in vec3 as well.
2015-12-20 06:09:09 -04:00
Matthew Blanchard
aba6b9b1c1
Corrected an issue with vec3
2015-12-19 23:56:56 -05:00
Matthew Blanchard
1531bf4abb
Refactored the vec3 class.
2015-12-19 23:49:03 -05:00
Landon Manning
cda145629d
I'm an idiot
...
the order in which a and b appear actually matters in add/sub.
2015-12-13 06:44:02 -04:00
Landon Manning
c72efbad3c
buncha goodies
...
* Changed add/sub in vec2/vec3 to allow for integer math
* Fixed a string display error in quat
* Other stuff that @shakesoda probably did
2015-12-13 06:16:57 -04:00
Colby Klein
4a4ad08a35
Add vec2.lerp, tests, and fix some minor bugs.
...
- Added missing vec2 lerp (same as vec3's)
- Added lerp to vec2 and vec3 metatable
- Added tests for vec2 (incomplete)
- Fixed vec2/number being the same as number/vec2
- Fixed vec2 constructor to match vec3's
2015-09-15 07:05:22 -07:00
Colby Klein
6a5771348c
Minor doc/test updates for vec3
2015-09-13 05:51:13 -07:00
Colby Klein
fb1778e45c
Update vec3 docs
2015-09-11 13:39:19 -07:00
Colby Klein
78989682cf
Add LDoc documentation. Utils done.
2015-09-11 07:59:05 -07:00
Landon Manning
449bf861d4
Added ability to divide a number over a vector.
...
Example: `local s = 1/scale`
2015-09-09 23:14:33 -03:00
Colby Klein
d198d7f97f
Backout some FFI code - didn't work.
2015-08-25 11:10:18 -07:00
Colby Klein
cb41f1c4a7
Don't explode if the module has been hot reloaded.
...
Argh, struct redefinition errors. I'm glad that you can pcall this at
least.
2015-08-19 14:30:48 -07:00
Colby Klein
54daab8ce2
Fix vec3 test failures, add unit vectors.
2015-08-15 01:06:32 -07:00
Colby Klein
871c9246d0
Back vec2 and vec3 with FFI types if possible.
2015-08-10 18:56:48 -07:00
Colby Klein
59e844dd34
Remove vec3.tuple (again?). It's a dupe of unpack
2015-07-25 19:29:11 -07:00
Colby Klein
2869d51035
Fix vec2/vec3.angle_to
...
I'm not sure of this is technically more correct, actually, but after
this fix I get the expected results.
2015-07-25 07:19:53 -07:00
Colby Klein
e6fdd92553
Add vec3.tuple, remove some dead code
2015-07-10 12:33:31 -07:00
Colby Klein
58b3b30b4b
Cleaner tostring output for vec3
2015-05-05 01:59:41 -07:00
Colby Klein
f60a7a144c
remove vec3.tuple (dupe of unpack)
2015-04-25 05:50:22 -07:00
Landon Manning
00c01a985a
Fixed consistancy
2015-01-16 03:54:41 -05:00
Landon Manning
d2d3c6c12f
Fixed some stuff
2014-12-08 05:42:21 -04:00
Colby Klein
2b41e8debb
Fix quaternion (THIS IS WHY WE NEED TESTS). Also gave vec3 a table constructor.
2014-11-11 03:46:25 -08:00