Commit Graph

262 Commits

Author SHA1 Message Date
Luke Street 58c8a902ac CVector3f/CVector2f: Fix isZero 2020-09-16 00:41:47 -04:00
Lioncash 5520001117 General: Mark file-scope constexpr variables as inline
Allows the compiler to unify all usages of these constants down to a
single address if they're ODR used, rather than creating an individual
copy within each translation unit.

Unfortunately all file-scope variables don't have inline implied for
them by default (only for static class member variables).

Shrinks the size of the emitted binary a little bit.
2020-04-19 03:22:13 -04:00
Lioncash 81f9b4a4ee General: Mark functions as nodiscard where applicable
Given this aims to be a general purpose math library for use in various
other libraries applications for axiodl, we can annotate functions that
return by value or reference with [[nodiscard]] where it's very obvious
that not making use of the return value is a bug.

This allows the compiler to diagnose and emit warnings for these API
misuses at compile-time, preventing silent bugs from occurring.

Any cases where not using the return value is desirable may still be
casted to void in order to silence warnings.
2020-03-04 03:07:54 -05:00
Phillip Stephens 82c2a2d85b
Minor fixes 2020-03-03 16:47:59 -08:00
Lioncash 9045766c52 CVector2i: Make CVector2f-related constructor non-constexpr
These make use of SIMD accessors, which aren't constexpr.
2019-09-06 02:25:33 -04:00
Phillip Stephens 63ecd31813
Merge pull request #16 from lioncash/rot
Global: Remove unused rotr/rotl functions
2019-09-04 19:35:25 -07:00
Phillip Stephens 4d0e4f21ab
Merge pull request #15 from lioncash/noexcept
Global: Mark hash_combine_impl() as noexcept
2019-09-04 19:33:47 -07:00
Lioncash 29399159e9 CMatrix4f: Make copy assignment constexpr
Matches the constexpr copy constructor.
2019-09-04 11:59:53 -04:00
Lioncash 76a7129d80 Global: Remove unused rotr/rotl functions
These don't appear to be used by anything, so they can be removed.
2019-09-04 10:37:21 -04:00
Lioncash 3d14be889c Global: Mark hash_combine_impl() as noexcept
This is used with hashes that are declared noexcept, so this should also
be noexcept.
2019-09-04 10:35:27 -04:00
Lioncash 890c1e28e0 CVector2i: Add static assert for enforcing vector size
Provides compile-time guarantees about struct layout.
2019-09-04 03:05:28 -04:00
Lioncash c39186d3ba CVector2i: Make conversions to float explicit 2019-09-04 02:53:29 -04:00
Lioncash 056515b2d3 CVector2i: Make interface constexpr where applicable
These are just manipulating two integral values, so they can be made
constexpr. While we're at it, we can also apply the noexcept specifier.
2019-09-04 02:53:06 -04:00
Lioncash 3083285c79 CVector2i: Implement operator!= in terms of operator==
Same behavior, but without duplicated inverted logic.
2019-09-04 02:42:58 -04:00
Lioncash 5f892dda81 CVector2i: Remove use of union and unnamed struct
Nothing uses the v data array, so we can remove it entirely. This
removes the use of a compiler extension (anonymous struct), and
simplifies the underlying data within the vector.
2019-09-04 02:41:28 -04:00
Phillip Stephens 35127116f8
Merge pull request #9 from lioncash/docs
General: Amend documentation comments
2019-09-03 19:52:56 -07:00
Phillip Stephens f0a7db2282
Merge pull request #10 from lioncash/using
CColor: Use using where applicable
2019-09-03 19:52:07 -07:00
Phillip Stephens 55ead1bada
Merge pull request #11 from lioncash/array
CFrustum: Use std::array where applicable
2019-09-03 19:51:16 -07:00
Phillip Stephens 7e737b7e26
Merge pull request #13 from lioncash/rel-angle
CRelAngle: Make member functions constexpr where applicable
2019-09-03 19:50:46 -07:00
Lioncash a88e50e296 CRelAngle: Make member functions constexpr where applicable
Many of these member functions can be made constexpr, given their
manipulation of a simple internal float.
2019-09-03 16:32:50 -04:00
Lioncash dca23c69d2 CMatrix4f: Use std::array where applicable
Makes for stronger typing and also allows querying the size directly.
2019-09-03 15:06:35 -04:00
Lioncash f03714bdbd CMatrix3f: Use std::array where applicable 2019-09-03 14:49:28 -04:00
Lioncash 0e516b9f0b CFrustum: Use std::array where applicable
Makes the array stronger-typed. We can also use it to convert a few
loops into algorithms.
2019-09-03 14:29:36 -04:00
Lioncash 9058b6bbcc CColor: Use using where applicable
We can also simplify RGBA32's declaration. This also allows the type to
be forward declared.
2019-09-03 14:11:56 -04:00
Lioncash 53ac7d96b0 General: Amend documentation comments
Silences a few trivial -Wdocumentation warnings
2019-09-03 14:05:27 -04:00
Lioncash f6854d8e82 General: Mark member functions as const where applicable
These don't modify internal member state, so they can be const.
2019-09-01 21:53:57 -04:00
Phillip Stephens 050e86aae8
Merge pull request #7 from lioncash/include
zeus: Amend inclusions
2019-09-01 11:06:45 -07:00
Lioncash dafc850598 zeus: Amend inclusions
Trims out unused headers and ensures the necessary includes are
included.
2019-09-01 04:30:53 -04:00
Lioncash 61fc6c6fd2 CSphere: Make intersects() a const member function
This member function doesn't modify instance state, so it can be made
const.
2019-09-01 03:59:26 -04:00
Jack Andersen c5d90a5d5e Make simd_floats use std::array for storage 2019-07-20 22:42:27 -10:00
Jack Andersen 48073c783b Move some quaternion functions in-header 2019-06-14 14:38:56 -10:00
Jack Andersen c81eb93b6d Better CMake dependency handling 2019-06-11 16:04:52 -10:00
Jack Andersen 6c13d089fe CColor hash 2019-05-07 17:49:27 -10:00
Jack Andersen 92733a3bb7 Fix some compilation warnings 2019-04-06 19:01:22 -10:00
Jack Andersen 617875531a Implement CAABox::getTri 2019-04-02 18:30:18 -10:00
Jack Andersen 2edc75f793 CColor clamp for all arithmetic ops 2019-03-23 22:06:25 -10:00
Jack Andersen a240b39a11 COBBox::FromAABox fix 2019-03-07 18:15:58 -10:00
Jack Andersen 855869b5b1 Windows build fixes 2019-02-23 22:41:50 -10:00
Jack Andersen b854e76dc9 constexpr refactor 2019-02-23 21:15:32 -10:00
Jack Andersen 9b4434e6e0 Ensure correct namespace in simd subsystem 2019-02-17 19:47:20 -10:00
Jack Andersen 31b437e784 GCC simd fix 2019-02-15 15:31:42 -10:00
Jack Andersen 2041ec3156 More flexible conversion constructior from CVector2f->CVector3f 2019-02-10 10:58:27 -10:00
Jack Andersen e32914074a CAABox intersectRadius fixes 2019-02-07 21:56:15 -10:00
Jack Andersen df5e71cde5 CRelAngle visibility fix 2019-01-28 22:27:23 -10:00
Jack Andersen 841c876a66 Add CAABox::projectedPointTest 2019-01-19 20:41:51 -10:00
Jack Andersen 4524fe2dcf Correct CRelAngle behavior 2018-12-16 17:51:14 -10:00
Jack Andersen e6265e3c81 Make CRelAngle use [0,2pi] range 2018-12-15 20:31:17 -10:00
Jack Andersen 4352f0d4a9 Add identity transform constant 2018-12-14 20:29:14 -10:00
Jack Andersen 7df9f9b7ec Correct CVector3f::slerp implementation 2018-12-12 21:36:29 -10:00
Jack Andersen 9799353b35 Windows fixes 2018-12-07 20:44:51 -10:00