257 Commits

Author SHA1 Message Date
Ben Visness
142ba3cd9d Align backslashes for great aesthetics (very important) 2025-02-24 17:45:35 -06:00
Ben Visness
8c2ac269ba Redo test scripts 2025-02-23 20:33:06 -06:00
Ben Visness
736ebaaf23 Test and fix _Generic 2025-02-23 20:33:06 -06:00
Ben Visness
bdc7dd2a51 Merge pull request #172 from jonasgf/whitespace
Remove trailing whitespace and extra newlines at end of file
2024-05-28 09:46:45 -05:00
Ben Visness
b4ce44823b Merge pull request #171 from jonasgf/missing-braces
Ignore missing braces warning for all GCC versions
2024-05-28 09:46:22 -05:00
Jonas
2901e70ca3 Remove trailing whitespace and extra newlines at end of file 2024-04-27 22:56:11 +02:00
Jonas
21b4a0d209 Ignore missing braces warning for all GCC versions 2024-04-27 22:46:15 +02:00
Ben Visness
43836aa3a6 Merge pull request #170 from B-Y-P/master
Add HMM_QFromNormPair() and HMM_QFromVecPair()
2024-04-11 11:08:32 -05:00
BYP
bdc04881de Add HMM_QFromNormPair() and HMM_QFromVecPair() 2024-04-08 21:21:54 -04:00
Ben Visness
322826bcee Merge pull request #169 from Jack-Punter/neon_support
Neon support
2023-12-15 20:14:20 -06:00
jack punter
4e1e97522d Address Ben's changes 2023-12-14 21:39:50 +00:00
Jack Punter
6603c796cc Update test Makefile to use NO_SIMD over NO_SSE 2023-12-12 01:53:43 +00:00
Jack Punter
623215b228 NEON Quaternion Multiply 2023-12-12 01:47:01 +00:00
Jack Punter
fcc510f767 Fix scalar 2023-12-12 01:42:37 +00:00
Jack Punter
133a595b6f Better Neon tranpose
vld can de-interleave up to 4-float element structures in one go into multiple registers. This allows us to load each column of the matrix and put each element into a corresponding vector, essentially doing the entire transpose in 1 instruction

Fixed it
2023-12-12 01:42:37 +00:00
Jack Punter
5f20d693c9 Add Neon implementations for all but Quaternion multiply 2023-12-11 22:57:19 +00:00
Ben Visness
e210d8729b Add HMM_RotateV2 2023-11-03 11:34:49 -05:00
dev_dwarf
a1c84320f9 Style tweaks to RotateV3Q + axis angle variant 2023-10-31 13:09:20 -06:00
Olivier Perret
8df5da57f5 Clean trailing whitespace in HandmadeMath.h 2023-10-29 18:33:31 +01:00
Olivier Perret
149c18d449 Add HMM_RotateQV3(), for rotating a vec3 by a quaternion 2023-10-29 18:32:09 +01:00
Olivier Perret
98748f702c Provide const versions of operator[] (#166)
This makes it possible use to do something like

const HMM_Vec3 v{1,2,3};
float val = v[1];
2023-10-27 13:15:58 -05:00
Logan Forman
6cf6226c57 remove most references from operators (#164) 2023-08-05 12:57:56 -04:00
Ben Visness
aaa767bf0b Update README.md 2023-02-20 13:29:24 -06:00
Ben Visness
422bc588e9 Fix inverse perspective v2.0.0 2023-02-20 13:03:46 -06:00
Ben Visness
beb837a3c6 Tweak docs, add tests, find bugs 2023-02-02 19:18:24 -06:00
Ben Visness
50ab55b3bc Rewrite the update tool in Python
Less than 200 lines, properly cross platform, actually outputs error
messages if things break, better flag handling. Everyone has
Python anyway.
v2.0.0-rc2
2023-01-27 03:39:38 -06:00
Ben Visness
22d743ce3d Change naming convention for NO/ZO (the update tool needs updating) 2023-01-26 22:27:09 -06:00
Logan Forman
d4918a514e Drop Projection Matrix Config; Make explicit. (#154)
* Add N0/Z0 projection

Remove configuration macro

* Update update_hmm.c

Co-authored-by: Ben Visness <bvisness@users.noreply.github.com>
2023-01-26 21:01:31 -06:00
Logan Forman
37aa3fa6a0 Unroll sse (#153)
* Unroll loops and SSE consistency

* Fix tranposes
2023-01-26 20:56:28 -06:00
dev_dwarf
7e493a5481 Fix LH perspective matrix
Off by a sign before.
2023-01-26 19:55:21 -06:00
Ben Visness
f106a0f5f3 Style and docs pass for release
Remove V2I, V3I, V4I (and style changes)

Totally useless.

Add update tool, update docs

Tweak docs

Create ci.yml

Big style pass

Maybe fix CI on Windows

Report coverage errors

Fix a missing coverage case

Try setting up MSVC another way

Update readmes

Fix remaining use of the name UpdateTool
2.0.0-rc1
2023-01-22 21:46:22 -06:00
Logan Forman
c24e4ff873 HMM2.0 (#149)
These changes were all made by @dev-dwarf. Many thanks for his work on this!

* Renaming

* First Pass on 2.0UpdateTool

* Another pass on UpdateTool, changed name

* Another pass on UpdateTool, changed name

* Do Renaming

* Working on Angles Consistency

* Passing Coverage

* Remove unused arc-tangent functions

* Change macro defaults

By default if user is overriding trig functions assume their input and internal units are the same.

* wrap in AngleDeg instead of AngleRad

* Remove HMM_PREFIX configuration

* Fix for Slerp

https://discord.com/channels/239737791225790464/489148972305350656/1055167647274246265

Justified by most implementations of Slerp. EX: http://number-none.com/product/Understanding%20Slerp,%20Then%20Not%20Using%20It/

* Handedness Changes

* More renaming. C11 _Generics

Generics enable by default when available (see lines 97-104). User can also force them by defining HANDMADE_MATH_C11_GENERICS

Also fixed some missed things w.r.t renaming. My old tool didn't catch cases like HMM_MultiplyVec3f needing to be HMM_MulV3F instead of HMM_MulV3f.

* Reuse more SSE codepaths for Quaternions

Also improved quaternion tests. More work could be done here, see discussion here about optimizing slerp: https://discord.com/channels/239737791225790464/489148972305350656/1055167647274246265

* Just saving these alternate versions of SLerp

* Reduce V4/M4 Linear Comb. codepaths

* Simple implementation of 2x2 and 3x3 basic matrix operations.

Also renamed Transpose to TransposeM4, so that we can have TransposeM2,M3

* Norm is dead! Long live Norm!

As can be seen from the tests, precision has declined quite a bit from using the FastNorm implementations for various things. We can only guarantee about 0.001f precision for anything where a norm happens now. If this is undesired we can change back easily.

* Started work on Matrix Inverses

TODO: Tests for simple 4x4 Inverses

* Matrix Inverses + Tests

* Generics for Matrices and Rename MXd/f functions

* Fixes + Better Output for UpdateTool

* I think I count as a contributor : )

* Ported UpdateTool, Inlined my library code.

* Moved tool to different repo

https://github.com/dev-dwarf/HMM2.0UpdateTool

* Remove small test change

* Found some more references to atan functions

* Standardize angle function names, use short names

* Remove other slerp comments

* woops that wasnt meant to be commited.

* Finish changing ToRadians to ToRad

* Fix [] overloads

per https://discord.com/channels/239737791225790464/600063880533770251/1051600188302692402

* Tests for 2x2, 3x3 Matrices and Other Matrix Ops

* Add an option to use Z: [0, 1] range for projection matrices.

This will make HMM more convenient to use with other graphics APIs such as Direct3d and Metal.

* Update test imports

* #if should've been #ifdef!

* Implement requested changes
2023-01-22 17:34:50 -06:00
Zak Strange
ba5405ac0f Update README.md v1.13.0 2021-08-31 17:11:42 -07:00
Zak Strange
d69a859d73 Fully inlined HandmadeMath.h (#139)
* Fully inlined HandmadeMath.h, renamed test.bat to run_test_msvc.bat, and introduced run_test_clang.bat

* General Cleanup
2021-08-31 17:10:46 -07:00
strangezak
8c18186b3b Removed Unnecessary Square Root from InverseQuaternion. Closes #136 2021-08-31 09:28:02 -07:00
Tim Gates
5f816bf9b3 docs: fix simple typo, percision -> precision (#137)
There is a small typo in README.md.

Should read `precision` rather than `percision`.
2021-08-31 09:22:29 -07:00
Jørgen P. Tjernø
c5bc802042 Suppress two warnings on clang 12 (#138)
Building with clang 12 with -Wextra, the following two warnings are
generated:

```
HandmadeMath.h:1167:25: warning: missing field 'Y' initializer [-Wmissing-field-initializers]
    hmm_vec2 Result = {0};
                        ^
HandmadeMath.h:1167:24: warning: suggest braces around initialization of subobject [-Wmissing-braces]
```

This expands the `-Wmissing-braces` ignore to also target clang, and adds an
ignore for `-Wmissing-field-initializers`
2021-08-31 09:37:54 -05:00
Ben Visness
43afc87fa7 Remove non-functioning issue link 2021-03-24 10:04:17 -05:00
Ben Visness
5bbac2167e Update version and changelog 2021-03-24 10:02:08 -05:00
Wayde Reitsma
655c662528 Add brackets around HMM_MIN, HMM_MAX, and HMM_MOD (#133)
* Add brackets around HMM_MIN and HMM_MAX

* Add brackets around HMM_MOD
2021-03-24 09:54:13 -05:00
Zak Strange
1f0c6ba493 Update Docs. 2021-03-09 16:37:00 -08:00
Zak Strange
1d82b4f0bc Unary minus vectors (#130)
* Unary Minus operator for vec2, vec3, and vec4

* Update README.md

Co-authored-by: zak <zak@DESKTOP-V1AQ0IT>
1.12.0
2021-03-06 18:39:17 -06:00
Zak Strange
2fa0b36715 Add HMM_STATIC option to statically link instead of extern (#127)
Co-authored-by: zak <zak@DESKTOP-V1AQ0IT>
2021-02-17 19:36:05 -08:00
Ben Visness
ad169e649c Make HMM_Clamp branchless in optimized builds (#122) 2020-12-22 11:19:58 -06:00
Zak Strange
1900cc9275 Updated email in HandmadeMath.h 2020-07-09 18:22:22 -07:00
Ben Visness
ddb9971e71 Update README 1.11.1 2020-07-09 08:51:53 -05:00
GsxCasper
341a376a17 Added HMM_PREFIX macro to function implementations (#120) 2020-07-08 16:32:29 -05:00
Ben Visness
c825fe48cf Update version and release notes 1.11.0 2020-04-06 10:02:16 -05:00
Ben Visness
15bef820db Add ability to customize HMM_ prefix (#114)
* Add prefix macro and use it everywhere

* Add lightweight test for prefix

* Add a little doc blurb
2020-04-06 09:57:10 -05:00
Ben Visness
fe32f081f2 Suppress float equality warnings (#113)
* Add a macro to help with deprecations

* Suppress warnings about float equality
2020-04-06 09:55:40 -05:00