Commit Graph

117 Commits

Author SHA1 Message Date
IJzerbaard
eb5c659148 Improve HMM_MultiplyMat4 (#76)
Remove all transposes, (AT BT)T = BA
2018-02-10 17:59:07 -06:00
Ben Visness
4981d5ab89 Convert everything to new inline scheme (#57) (#72)
* Convert everything to new inline scheme

* Add both extern and inline for some SSE vs. non-SSE functions

Some functions had nice, compact SSE implementations but bulky non-SSE
implementations, so this commit inlines just the implementations that make
sense. Also updated documentation.

* Convert HINLINE and HEXTERN to HMM_INLINE and HMM_EXTERN
2017-10-31 10:16:36 -05:00
strangezak
a08262b2d9 Removed old instructions 2017-10-14 19:34:51 -07:00
StrangeZak
48bd24b05e Updated docs 2017-10-01 10:32:53 -07:00
Zak Strange
064baeb5b9 V1.4 - SSE upgrades and bug fixes (#70)
* Fixed bug when using handmademath in C mode

* SSEd vec4 operations

* Fixed hmm_vec4 for non-sse builds. Added SSE option for HMM_Vec4 to load in one instruction

* Whoops. We were loading in the wrong order

* SSEd more things

* SSEd more functions

* Minor fixups

* SSE'd hmm_vec4 initialization

* Removed zeroing

* Vector normalization should be zero'd

* Removed old comments
2017-09-30 14:38:28 -07:00
Ben Visness
afd726ab0b Automatically include C++ definitions (#67) 2017-08-02 10:12:06 -05:00
strangezak
98fffbd7cc Forgot to update version 2017-07-16 21:29:26 -07:00
Ben Visness
efd9f2f4b7 Matrix Multiply SSE (#65)
* SSEd HMM_MultiplyMat4 and HMM_Transpose. And added HMM_LinearCombineSSE

* Maybe Travis doesn't support SSE?

* Fix compile process so the SSE option is consistently defined

* Fix link error

* Documentation

* Added function prototype for operator ==

* Added != operator for hmm_vec2, hmm_vec3, hmm_vec4

* Add C versions of equality checks

Also made the C++ tests actually run...😳

* Update documentation
2017-07-16 21:19:34 -07:00
Zak Strange
70ac2b7e5b 1.1.5 (#64)
* Added Width, and Height to hmm_vec2, and fixed SqrtF when compiling without the CRT

* Syntax error

* Test all the vector access methods
2017-06-14 20:49:44 -07:00
Ben Visness
924ee43923 Update history to include @DanielGibson's SSE fixes 2017-06-13 11:39:42 -05:00
Ben Visness
440b885d59 Update version to 1.1.4 2017-06-13 11:26:46 -05:00
Emil Lauridsen
98f535aeec Handle zero-vector normalization. (#63)
* Handle zero-vector normalization.

When normalizing a vectors, we have to check whether vector length is
not zero, to avoid dividing by zero when normalizing zero-vectors.

* Test for normalization of zero vectors
2017-06-13 11:21:55 -05:00
Emil Lauridsen
be30046a5a C89 style comments (#62) 2017-06-11 10:32:46 -07:00
Daniel Gibson
ff4513ff33 Make it usable on non-SSE platforms (#60)
* at one place HANDMADE_NO_SSE instead of HANDMADE_MATH_NO_SSE was used
* introduce HANDMADE_MATH__USE_SSE for the SSE #ifdefs throughout code
  - use #ifdef HANDMADE_MATH_NO_SSE at only one place
* only use SSE (#define HANDMADE_MATH__USE_SSE) if the targetplatform
  actually supports it
  => users don't have to #define HANDMADE_MATH_NO_SSE on ARM etc
* at one place HMM_SqrtF instead of HMM_SquareRootF was used
2017-06-09 17:14:24 -07:00
Ben Visness
cf606db217 Test in both C and C++ (#58)
* Switch to custom unit testing that is compatible with C

* Remove Google Test framework

* Attempt to fix missing math functions

* Link against C math library

* Try forcing c99 again

* Include -lm at compile time

* Move -lm argument to the end

* Update README and gitignore
2017-04-07 08:47:54 -05:00
Ben Visness
67b84dece7 Fix invalid HMMDEF's in function definitions (#56)
* Fix invalid HMMDEF's in function definitions

* Update version number and readme
2017-03-29 16:19:25 -07:00
Ben Visness
666f7e3325 Restrict struct warning suppression to clang only (#50)
* Restrict struct warning suppression to clang only

* Update changelist

* Move gcc diagnostic pop inside header section
2017-01-15 09:50:53 -08:00
Ben Visness
ad3039186d Initial quaternion implementation (#49)
* Various changes, and started work on Quaternions

* Worked on Quaternions (#46)

* Working on quaternions

* Finished operations, onto slerp

* Working on slerp

* Finished slerp implementation, next is NLerp

* Cleaned HandmadeMath.cpp

* Removed gbmath includes

* fixed minor issue.

* Fixed function names

* Fixed DotQuat call

* Did a style check

* Double Style Check

* Triple Style Check

* Fixed all the bullshit I did wrong

* Fixed more bs

* Added new functions

* Finished function implements

* Fixed some compile errors

* Fixed UTF-8 Error

* Added in most operator overrides

* Changed instances of HMM_PI to HMM_Pi32

* Fixed a warning

* Fixed a major issue with quaternion to matrix function where rotations about the y axis caused strange warping.

* Revert "Fixed a warning"

This reverts commit 043decab0d.

* Revert repo

* Fixed Quaternion to Matrix function.

* Fixed some prevalent issues, and now pulls triganometric funcitions from the std instead of implementing them.

* Fixed tab formatting, added in reverse multiplication function with Quaternions

* Removed error suppression cleanup, as it was causing more warnings. . .

* Added documentation

* Changed ATanf2 to ATan2f

* Fixed some typos and added additional documentation (#48)

* Add tests for quaternions

* Remove (very wrong) quaternion division in favor of multiplying by inverse

* Put back newlines at ends of files

* Make tweaks for PR

* Add assigning arithmetic operators for quaternions

* Add NLerp

Just to make Jonathan Blow happy: http://number-none.com/product/Understanding%20Slerp,%20Then%20Not%20Using%20It/

* Rearrange parameters of HMM_Slerp

It now matches HMM_Lerp and HMM_NLerp.

* Update README.md
2017-01-04 16:25:12 -08:00
Zak Strange
c89c435e3a Fixed HMM_PowerF 2016-11-14 20:05:07 -07:00
Zak Strange
aed68cc894 Version 1.0 2016-11-02 14:27:13 -07:00
Kevin Moran
bebbe211bc Suppress GCC anonymous struct warning 2016-09-21 09:23:07 +10:00
Zak Strange
64830b6bbd 0.7 initial commit 2016-09-05 21:04:30 -07:00
Matt Mascarenhas
7e42f3d7c8 Allow HMM_PowerF to try and compute negative bases 2016-08-31 03:16:13 +01:00
Matt Mascarenhas
bb03df3fc6 Merge remote-tracking branch 'upstream/master' 2016-08-31 02:16:51 +01:00
Matt Mascarenhas
774630b7cf Add wrappers for expf and logf 2016-08-31 02:10:39 +01:00
Matt Mascarenhas
24caf7e8dd Add header for HMM_PowerF() 2016-08-31 01:35:24 +01:00
Zak Strange
59db096948 Merge pull request #42 from StrangeZak/lerp
Add header and test for HMM_Lerp
2016-08-30 20:32:07 -04:00
Ben Visness
2d729a3b34 Add header and test for HMM_Lerp 2016-08-30 19:19:04 -05:00
Ben Visness
5ddb0ed10d Tweak whitespace 2016-08-30 19:14:31 -05:00
Ben Visness
2ea471b3ce Add HMM_Transpose 2016-08-30 18:53:53 -05:00
Matt Mascarenhas
224d543d79 Introduce HMM_PowerF() 2016-08-31 00:44:14 +01:00
Zak Strange
de08310dbd Fixed HMM_Vec4 2016-08-30 13:46:50 -07:00
Zak Strange
8578602799 Fixed issues in last commit and added a function overloaded HMM_Dot 2016-08-30 13:24:55 -07:00
Zak Strange
b087efc561 Added HMM_DotVec2, HMM_DotVec3, and HMM_DotVec4 2016-08-30 12:05:33 -07:00
Zak Strange
712e5aa6db Fixed issue #33, #32, #27, #30 2016-08-30 11:58:26 -07:00
Matt Mascarenhas
cad7efa639 Accelerate HMM_Power() with the squaring technique
Thanks to @mmozeiko for the algorithm
2016-08-30 01:19:47 +01:00
Zak Strange
c58043db84 Merge pull request #26 from bvisness/bug-fixes
Fix issues that came up in testing
2016-08-29 11:27:22 -04:00
Ben Visness
44be431b65 Fix issues that came up in testing
Refs #25
2016-08-28 23:27:24 -05:00
Zak Strange
b638056bcd Updated README.md and Fixed SSE code 2016-08-25 16:11:03 -07:00
Ben Visness
bcf7937eec Ensure column-major order for matrices and fix HMM_Translate
Most of the changes in this patch are cosmetic (such as looping by
columns first.) HMM_Translate was incorrectly producing row-major
matrices, which should now be fixed.

Fixes #22
2016-08-25 14:14:22 -05:00
Ben Visness
c9ec065fd5 Add documentation for v0.5 2016-08-23 18:20:59 -05:00
Ben Visness
077bdcd346 Initialize structs the Zak way
And generally make formatting consistent throughout.

Refs #20
2016-08-23 17:57:07 -05:00
Ben Visness
99bad6fd6e Clean up C++ versions of functions
Prefixed functions that needed it, added functions to match all new
operators, and ensured that headers were accurate.

Fixes #20
2016-08-23 15:39:35 -05:00
Ben Visness
c55baa9086 Ensure that all Result variables are initialized 2016-08-23 15:11:03 -05:00
Ben Visness
fb652d1467 Add lots and lots of missing operations
- Scalar multiplication of vectors and matrices
  - This was present for only vec2's and vec3's using operator
    overloading. In addition, there was only operator overloading for
    [structure] * float, not float * [structure].
  - Additionally, the two operators that were already defined were
    updated to use the new C-style functions that were defined.
- Scalar division of vectors and matrices
- Matrix subtraction
- += operator for matrices
2016-08-23 09:43:27 -05:00
Ben Visness
2c265f0e1d Add missing headers for operators
And flip the order of those two other operators, because having vec2
after vec3 was bugging me.
2016-08-22 19:00:04 -05:00
Ben Visness
a85eb07b3d Merge branch 'vec4v' 2016-08-20 19:50:08 -05:00
Ben Visness
83aa7f404a Merge branch 'add-mat4' 2016-08-20 19:49:57 -05:00
Ben Visness
6259f1b47f Add ability to construct vec4 from vec3 and float
This is very useful for applications using homogeneous coordinates, since I can
take a vec3 representing a position or normal, and construct the appropriate
vec4 in homogeneous coordinates.
2016-08-20 19:46:07 -05:00
Ben Visness
31a6bd200b Implement addition for mat4's 2016-08-20 19:30:08 -05:00