master
ブランチ master
ShaderPlayground / deps / glm / glm / gtx / fast_square_root.hpp
2.8 KB、92行 生 Blame 履歴
1/// @ref gtx_fast_square_root
2/// @file glm/gtx/fast_square_root.hpp
3///
4/// @see core (dependence)
5///
6/// @defgroup gtx_fast_square_root GLM_GTX_fast_square_root
7/// @ingroup gtx
8///
9/// Include <glm/gtx/fast_square_root.hpp> to use the features of this extension.
10///
11/// Fast but less accurate implementations of square root based functions.
12/// - Sqrt optimisation based on Newton's method,
13/// www.gamedev.net/community/forums/topic.asp?topic id=139956
14
15#pragma once
16
17// Dependency:
18#include "../common.hpp"
19#include "../exponential.hpp"
20#include "../geometric.hpp"
21
22#ifndef GLM_ENABLE_EXPERIMENTAL
23# error "GLM: GLM_GTX_fast_square_root is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it."
24#endif
25
26#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
27# pragma message("GLM: GLM_GTX_fast_square_root extension included")
28#endif
29
30namespace glm
31{
32 /// @addtogroup gtx_fast_square_root
33 /// @{
34
35 /// Faster than the common sqrt function but less accurate.
36 ///
37 /// @see gtx_fast_square_root extension.
38 template<typename genType>
39 GLM_FUNC_DECL genType fastSqrt(genType x);
40
41 /// Faster than the common sqrt function but less accurate.
42 ///
43 /// @see gtx_fast_square_root extension.
44 template<length_t L, typename T, qualifier Q>
45 GLM_FUNC_DECL vec<L, T, Q> fastSqrt(vec<L, T, Q> const& x);
46
47 /// Faster than the common inversesqrt function but less accurate.
48 ///
49 /// @see gtx_fast_square_root extension.
50 template<typename genType>
51 GLM_FUNC_DECL genType fastInverseSqrt(genType x);
52
53 /// Faster than the common inversesqrt function but less accurate.
54 ///
55 /// @see gtx_fast_square_root extension.
56 template<length_t L, typename T, qualifier Q>
57 GLM_FUNC_DECL vec<L, T, Q> fastInverseSqrt(vec<L, T, Q> const& x);
58
59 /// Faster than the common length function but less accurate.
60 ///
61 /// @see gtx_fast_square_root extension.
62 template<typename genType>
63 GLM_FUNC_DECL genType fastLength(genType x);
64
65 /// Faster than the common length function but less accurate.
66 ///
67 /// @see gtx_fast_square_root extension.
68 template<length_t L, typename T, qualifier Q>
69 GLM_FUNC_DECL T fastLength(vec<L, T, Q> const& x);
70
71 /// Faster than the common distance function but less accurate.
72 ///
73 /// @see gtx_fast_square_root extension.
74 template<typename genType>
75 GLM_FUNC_DECL genType fastDistance(genType x, genType y);
76
77 /// Faster than the common distance function but less accurate.
78 ///
79 /// @see gtx_fast_square_root extension.
80 template<length_t L, typename T, qualifier Q>
81 GLM_FUNC_DECL T fastDistance(vec<L, T, Q> const& x, vec<L, T, Q> const& y);
82
83 /// Faster than the common normalize function but less accurate.
84 ///
85 /// @see gtx_fast_square_root extension.
86 template<typename genType>
87 GLM_FUNC_DECL genType fastNormalize(genType const& x);
88
89 /// @}
90}// namespace glm
91
92#include "fast_square_root.inl"