mirror of
https://github.com/HandmadeMath/HandmadeMath.git
synced 2025-09-07 18:58:19 +00:00
Version 1.0
This commit is contained in:
@@ -1,89 +1,89 @@
|
|||||||
/*
|
/*
|
||||||
HandmadeMath.h v0.7
|
HandmadeMath.h v1.0
|
||||||
|
|
||||||
This is a single header file with a bunch of useful functions for
|
This is a single header file with a bunch of useful functions for
|
||||||
basic game math operations.
|
basic game math operations.
|
||||||
|
|
||||||
==========================================================================
|
==========================================================================
|
||||||
|
|
||||||
You MUST
|
You MUST
|
||||||
|
|
||||||
#define HANDMADE_MATH_IMPLEMENTATION
|
#define HANDMADE_MATH_IMPLEMENTATION
|
||||||
|
|
||||||
in EXACTLY one C or C++ file that includes this header, BEFORE the
|
in EXACTLY one C or C++ file that includes this header, BEFORE the
|
||||||
include, like this:
|
include, like this:
|
||||||
|
|
||||||
#define HANDMADE_MATH_IMPLEMENTATION
|
#define HANDMADE_MATH_IMPLEMENTATION
|
||||||
#include "HandmadeMath.h"
|
#include "HandmadeMath.h"
|
||||||
|
|
||||||
All other files should just #include "HandmadeMath.h" without the #define.
|
All other files should just #include "HandmadeMath.h" without the #define.
|
||||||
|
|
||||||
==========================================================================
|
==========================================================================
|
||||||
|
|
||||||
For overloaded and operator overloaded versions of the base C functions,
|
For overloaded and operator overloaded versions of the base C functions,
|
||||||
you MUST
|
you MUST
|
||||||
|
|
||||||
#define HANDMADE_MATH_CPP_MODE
|
#define HANDMADE_MATH_CPP_MODE
|
||||||
|
|
||||||
in EXACTLY one C or C++ file that includes this header, BEFORE the
|
in EXACTLY one C or C++ file that includes this header, BEFORE the
|
||||||
include, like this:
|
include, like this:
|
||||||
|
|
||||||
#define HANDMADE_MATH_IMPLEMENTATION
|
#define HANDMADE_MATH_IMPLEMENTATION
|
||||||
#define HANDMADE_MATH_CPP_MODE
|
#define HANDMADE_MATH_CPP_MODE
|
||||||
#include "HandmadeMath.h"
|
#include "HandmadeMath.h"
|
||||||
|
|
||||||
All other files should just #include "HandmadeMath.h" without the #define.
|
All other files should just #include "HandmadeMath.h" without the #define.
|
||||||
|
|
||||||
==========================================================================
|
==========================================================================
|
||||||
|
|
||||||
To disable SSE intrinsics, you MUST
|
To disable SSE intrinsics, you MUST
|
||||||
|
|
||||||
#define HANDMADE_MATH_NO_SSE
|
#define HANDMADE_MATH_NO_SSE
|
||||||
|
|
||||||
in EXACTLY one C or C++ file that includes this header, BEFORE the
|
in EXACTLY one C or C++ file that includes this header, BEFORE the
|
||||||
include, like this:
|
include, like this:
|
||||||
|
|
||||||
#define HANDMADE_MATH_IMPLEMENTATION
|
#define HANDMADE_MATH_IMPLEMENTATION
|
||||||
#define HANDMADE_MATH_CPP_MODE
|
#define HANDMADE_MATH_CPP_MODE
|
||||||
#define HANDMADE_MATH_NO_SSE
|
#define HANDMADE_MATH_NO_SSE
|
||||||
#include "HandmadeMath.h"
|
#include "HandmadeMath.h"
|
||||||
|
|
||||||
or
|
or
|
||||||
|
|
||||||
#define HANDMADE_MATH_IMPLEMENTATION
|
#define HANDMADE_MATH_IMPLEMENTATION
|
||||||
#define HANDMADE_MATH_NO_SSE
|
#define HANDMADE_MATH_NO_SSE
|
||||||
#include "HandmadeMath.h"
|
#include "HandmadeMath.h"
|
||||||
|
|
||||||
==========================================================================
|
==========================================================================
|
||||||
|
|
||||||
To disable inlining functions, you MUST
|
To disable inlining functions, you MUST
|
||||||
|
|
||||||
#define HANDMADE_MATH_NO_INLINE
|
#define HANDMADE_MATH_NO_INLINE
|
||||||
|
|
||||||
in EXACTLY one C or C++ file that includes this header, BEFORE the
|
in EXACTLY one C or C++ file that includes this header, BEFORE the
|
||||||
include, like this:
|
include, like this:
|
||||||
|
|
||||||
#define HANDMADE_MATH_IMPLEMENTATION
|
#define HANDMADE_MATH_IMPLEMENTATION
|
||||||
#define HANDMADE_MATH_CPP_MODE
|
#define HANDMADE_MATH_CPP_MODE
|
||||||
#define HANDMADE_MATH_NO_INLINE
|
#define HANDMADE_MATH_NO_INLINE
|
||||||
#include "HandmadeMath.h"
|
#include "HandmadeMath.h"
|
||||||
|
|
||||||
All other files should just #include "HandmadeMath.h" without the #define.
|
All other files should just #include "HandmadeMath.h" without the #define.
|
||||||
|
|
||||||
==========================================================================
|
==========================================================================
|
||||||
|
|
||||||
To Disable the CRT, you MUST
|
To Disable the CRT, you MUST
|
||||||
|
|
||||||
#define HMM_SINF MySinF
|
#define HMM_SINF MySinF
|
||||||
#define HMM_COSF MyCosF
|
#define HMM_COSF MyCosF
|
||||||
#define HMM_TANF MyTanF
|
#define HMM_TANF MyTanF
|
||||||
#define HMM_EXPF MyExpF
|
#define HMM_EXPF MyExpF
|
||||||
#define HMM_LOGF MyLogF
|
#define HMM_LOGF MyLogF
|
||||||
|
|
||||||
Provide your own implementations of SinF, CosF, TanF, ExpF and LogF
|
Provide your own implementations of SinF, CosF, TanF, ExpF and LogF
|
||||||
in EXACTLY one C or C++ file that includes this header, BEFORE the
|
in EXACTLY one C or C++ file that includes this header, BEFORE the
|
||||||
include, like this:
|
include, like this:
|
||||||
|
|
||||||
#define HMM_SINF MySinF
|
#define HMM_SINF MySinF
|
||||||
#define HMM_COSF MyCosF
|
#define HMM_COSF MyCosF
|
||||||
#define HMM_TANF MyTanF
|
#define HMM_TANF MyTanF
|
||||||
@@ -92,12 +92,12 @@
|
|||||||
#define HANDMADE_MATH_IMPLEMENTATION
|
#define HANDMADE_MATH_IMPLEMENTATION
|
||||||
#define HANDMADE_MATH_CPP_MODE
|
#define HANDMADE_MATH_CPP_MODE
|
||||||
#include "HandmadeMath.h"
|
#include "HandmadeMath.h"
|
||||||
|
|
||||||
If you do not define all five of these, HandmadeMath.h will use the
|
If you do not define all five of these, HandmadeMath.h will use the
|
||||||
versions of these functions that are provided by the CRT.
|
versions of these functions that are provided by the CRT.
|
||||||
|
|
||||||
==========================================================================
|
==========================================================================
|
||||||
|
|
||||||
Version History:
|
Version History:
|
||||||
0.2 (*) Updated documentation
|
0.2 (*) Updated documentation
|
||||||
(*) Better C compliance
|
(*) Better C compliance
|
||||||
@@ -145,24 +145,26 @@
|
|||||||
(*) Added HMM_LengthVec4
|
(*) Added HMM_LengthVec4
|
||||||
(*) Added HMM_NormalizeVec2
|
(*) Added HMM_NormalizeVec2
|
||||||
(*) Added HMM_NormalizeVec4
|
(*) Added HMM_NormalizeVec4
|
||||||
|
1.0
|
||||||
|
(*) Lots of testing!
|
||||||
|
|
||||||
LICENSE
|
LICENSE
|
||||||
|
|
||||||
This software is in the public domain. Where that dedication is not
|
This software is in the public domain. Where that dedication is not
|
||||||
recognized, you are granted a perpetual, irrevocable license to copy,
|
recognized, you are granted a perpetual, irrevocable license to copy,
|
||||||
distribute, and modify this file as you see fit.
|
distribute, and modify this file as you see fit.
|
||||||
|
|
||||||
CREDITS
|
CREDITS
|
||||||
|
|
||||||
Written by Zakary Strange (zak@handmade.network && @strangezak)
|
Written by Zakary Strange (zak@handmade.network && @strangezak)
|
||||||
|
|
||||||
Functionality:
|
Functionality:
|
||||||
Matt Mascarenhas (@miblo_)
|
Matt Mascarenhas (@miblo_)
|
||||||
Aleph
|
Aleph
|
||||||
FieryDrake (@fierydrake)
|
FieryDrake (@fierydrake)
|
||||||
Gingerbill (@TheGingerBill)
|
Gingerbill (@TheGingerBill)
|
||||||
Ben Visness (@bvisness)
|
Ben Visness (@bvisness)
|
||||||
|
|
||||||
Fixes:
|
Fixes:
|
||||||
Jeroen van Rijn (@J_vanRijn)
|
Jeroen van Rijn (@J_vanRijn)
|
||||||
Kiljacken (@Kiljacken)
|
Kiljacken (@Kiljacken)
|
||||||
|
@@ -12,6 +12,7 @@ _This library is free and will stay free, but if you would like to support devel
|
|||||||
|
|
||||||
Version | Changes |
|
Version | Changes |
|
||||||
----------------|----------------|
|
----------------|----------------|
|
||||||
|
**1.0** | Lots of testing |
|
||||||
**0.7** | Added HMM_Vec2, and HMM_Vec4 versions of HMM_LengthSquared, HMM_Length, and HMM_Normalize. |
|
**0.7** | Added HMM_Vec2, and HMM_Vec4 versions of HMM_LengthSquared, HMM_Length, and HMM_Normalize. |
|
||||||
**0.6** | Made HMM_Power faster, Fixed possible efficiency problem with HMM_Normalize, RENAMED HMM_LengthSquareRoot to HMM_LengthSquared, RENAMED HMM_RSqrtF to HMM_RSquareRootF, RENAMED HMM_SqrtF to HMM_SquareRootF, REMOVED Inner function (user should use Dot now), REMOVED HMM_FastInverseSquareRoot function declaration |
|
**0.6** | Made HMM_Power faster, Fixed possible efficiency problem with HMM_Normalize, RENAMED HMM_LengthSquareRoot to HMM_LengthSquared, RENAMED HMM_RSqrtF to HMM_RSquareRootF, RENAMED HMM_SqrtF to HMM_SquareRootF, REMOVED Inner function (user should use Dot now), REMOVED HMM_FastInverseSquareRoot function declaration |
|
||||||
**0.5.2** | Fixed SSE code in HMM_SqrtF and HMM_RSqrtF |
|
**0.5.2** | Fixed SSE code in HMM_SqrtF and HMM_RSqrtF |
|
||||||
|
Reference in New Issue
Block a user