Skip to content

Commit aa69c17

Browse files
committed
Moved registration of types to cpp files; Fixed a nasty typo in CMake; TVector maintenance; Reflected canonical vectors as constants
1 parent 0a48be5 commit aa69c17

File tree

133 files changed

+800
-844
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

133 files changed

+800
-844
lines changed

CMakeLists.txt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,20 @@ if(PROJECT_IS_TOP_LEVEL OR NOT LANGULUS)
2424
fetch_langulus_module(Flow GIT_TAG 8f4af5ea3da65d8a2f7c58d8a78a2c8db0e955cc)
2525
endif()
2626

27+
file(GLOB_RECURSE
28+
LANGULUS_MATH_SOURCES
29+
LIST_DIRECTORIES FALSE CONFIGURE_DEPENDS
30+
source/*.cpp
31+
)
32+
2733
# Build and install Math library
2834
add_library(LangulusMath ${LANGULUS_LIBRARY_TYPE}
2935
$<TARGET_OBJECTS:LangulusLogger>
3036
$<TARGET_OBJECTS:LangulusRTTI>
3137
$<$<BOOL:${LANGULUS_FEATURE_MANAGED_MEMORY}>:$<TARGET_OBJECTS:LangulusFractalloc>>
3238
$<TARGET_OBJECTS:LangulusAnyness>
3339
$<TARGET_OBJECTS:LangulusFlow>
40+
${LANGULUS_MATH_SOURCES}
3441
)
3542

3643
target_include_directories(LangulusMath PUBLIC include
@@ -47,7 +54,7 @@ target_link_libraries(LangulusMath
4754
fmt
4855
)
4956

50-
target_compile_definitions(LangulusFlow
57+
target_compile_definitions(LangulusMath
5158
PRIVATE LANGULUS_EXPORT_ALL
5259
)
5360

include/Math/Angle.hpp

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -3,35 +3,7 @@
33
/// Copyright (c) 2014 Dimo Markov <[email protected]>
44
/// Part of the Langulus framework, see https://langulus.com
55
///
6-
/// Distributed under GNU General Public License v3+
7-
/// See LICENSE file, or https://www.gnu.org/licenses
6+
/// SPDX-License-Identifier: GPL-3.0-or-later
87
///
98
#pragma once
10-
#include "../../source/Numbers/TAngle.inl"
11-
12-
13-
namespace Langulus::Math
14-
{
15-
16-
/// Register angle types
17-
inline void RegisterAngles() {
18-
(void) MetaOf<Degrees>();
19-
(void) MetaOf<Radians>();
20-
21-
(void) MetaOf<Yawdf>();
22-
(void) MetaOf<Yawdd>();
23-
(void) MetaOf<Yawrf>();
24-
(void) MetaOf<Yawrd>();
25-
26-
(void) MetaOf<Pitchdf>();
27-
(void) MetaOf<Pitchdd>();
28-
(void) MetaOf<Pitchrf>();
29-
(void) MetaOf<Pitchrd>();
30-
31-
(void) MetaOf<Rolldf>();
32-
(void) MetaOf<Rolldd>();
33-
(void) MetaOf<Rollrf>();
34-
(void) MetaOf<Rollrd>();
35-
}
36-
37-
} // namespace Langulus::Math
9+
#include "../../source/Numbers/TAngle.inl"

include/Math/Blend.hpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
/// Copyright (c) 2014 Dimo Markov <[email protected]>
44
/// Part of the Langulus framework, see https://langulus.com
55
///
6-
/// Distributed under GNU General Public License v3+
7-
/// See LICENSE file, or https://www.gnu.org/licenses
6+
/// SPDX-License-Identifier: GPL-3.0-or-later
87
///
98
#pragma once
109
#include "../../source/Blend.hpp"

include/Math/Color.hpp

Lines changed: 1 addition & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -3,49 +3,7 @@
33
/// Copyright (c) 2014 Dimo Markov <[email protected]>
44
/// Part of the Langulus framework, see https://langulus.com
55
///
6-
/// Distributed under GNU General Public License v3+
7-
/// See LICENSE file, or https://www.gnu.org/licenses
6+
/// SPDX-License-Identifier: GPL-3.0-or-later
87
///
98
#pragma once
109
#include "../../source/Colors/TColor.inl"
11-
12-
13-
namespace Langulus::Math
14-
{
15-
16-
/// Luma weights for BT.601 standard, used for convertion to grayscale
17-
constexpr Vec3 LumaBT601 {0.299, 0.587, 0.114 };
18-
19-
/// Luma weights for BT.709 standard, used for convertion to grayscale
20-
constexpr Vec3 LumaBT709 {0.2126, 0.7152, 0.0722};
21-
22-
/// Luma weights for BT.2100 standard, used for convertion to grayscale
23-
constexpr Vec3 LumaBT2100 {0.2627, 0.6780, 0.0593};
24-
25-
} // namespace Langulus::Math
26-
27-
namespace Langulus
28-
{
29-
namespace Colors
30-
{
31-
32-
using ::Langulus::Math::RGBA;
33-
34-
constexpr RGBA White { 255, 255, 255, 255 };
35-
constexpr RGBA Black { 0, 0, 0, 255 };
36-
constexpr RGBA Grey { 127, 127, 127, 255 };
37-
constexpr RGBA Red { 255, 0, 0, 255 };
38-
constexpr RGBA Green { 0, 255, 0, 255 };
39-
constexpr RGBA DarkGreen { 0, 128, 0, 255 };
40-
constexpr RGBA Blue { 0, 0, 255, 255 };
41-
constexpr RGBA DarkBlue { 0, 0, 128, 255 };
42-
constexpr RGBA Cyan { 128, 128, 255, 255 };
43-
constexpr RGBA DarkCyan { 80, 80, 128, 255 };
44-
constexpr RGBA Orange { 128, 128, 0, 255 };
45-
constexpr RGBA Yellow { 255, 255, 0, 255 };
46-
constexpr RGBA Purple { 255, 0, 255, 255 };
47-
constexpr RGBA DarkPurple { 128, 0, 128, 255 };
48-
49-
} // namespace Langulus::Colors
50-
51-
} // namespace Langulus

include/Math/Config.hpp

Lines changed: 2 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
/// Copyright (c) 2014 Dimo Markov <[email protected]>
44
/// Part of the Langulus framework, see https://langulus.com
55
///
6-
/// Distributed under GNU General Public License v3+
7-
/// See LICENSE file, or https://www.gnu.org/licenses
6+
/// SPDX-License-Identifier: GPL-3.0-or-later
87
///
98
#pragma once
109
#include "../../source/Common.hpp"
@@ -16,63 +15,4 @@
1615
#include "../../source/Verbs/Modulate.inl"
1716
#include "../../source/Verbs/Multiply.inl"
1817
#include "../../source/Verbs/Randomize.inl"
19-
#include "../../source/Verbs/Move.inl"
20-
21-
22-
namespace Langulus::Math
23-
{
24-
25-
using RTTI::MetaVerb;
26-
27-
/// Register traits
28-
inline void RegisterTraits() {
29-
(void)MetaOf<Traits::X>();
30-
(void)MetaOf<Traits::Y>();
31-
(void)MetaOf<Traits::Z>();
32-
(void)MetaOf<Traits::W>();
33-
34-
(void)MetaOf<Traits::U>();
35-
(void)MetaOf<Traits::V>();
36-
(void)MetaOf<Traits::S>();
37-
(void)MetaOf<Traits::T>();
38-
39-
(void)MetaOf<Traits::R>();
40-
(void)MetaOf<Traits::G>();
41-
(void)MetaOf<Traits::B>();
42-
(void)MetaOf<Traits::A>();
43-
(void)MetaOf<Traits::D>();
44-
45-
(void)MetaOf<Traits::Transform>();
46-
(void)MetaOf<Traits::View>();
47-
(void)MetaOf<Traits::Projection>();
48-
(void)MetaOf<Traits::Solid>();
49-
(void)MetaOf<Traits::Pickable>();
50-
(void)MetaOf<Traits::Signed>();
51-
(void)MetaOf<Traits::Bilateral>();
52-
(void)MetaOf<Traits::Static>();
53-
(void)MetaOf<Traits::Boundness>();
54-
(void)MetaOf<Traits::Relative>();
55-
(void)MetaOf<Traits::Place>();
56-
(void)MetaOf<Traits::Size>();
57-
(void)MetaOf<Traits::Aim>();
58-
(void)MetaOf<Traits::Velocity>();
59-
(void)MetaOf<Traits::Acceleration>();
60-
(void)MetaOf<Traits::Sampler>();
61-
(void)MetaOf<Traits::Level>();
62-
(void)MetaOf<Traits::Interpolator>();
63-
(void)MetaOf<Traits::Perspective>();
64-
}
65-
66-
/// Register verbs
67-
inline void RegisterVerbs() {
68-
(void)MetaOf<Verbs::Exponent>();
69-
(void)MetaOf<Verbs::Multiply>();
70-
(void)MetaOf<Verbs::Modulate>();
71-
(void)MetaOf<Verbs::Randomize>();
72-
(void)MetaOf<Verbs::Add>();
73-
(void)MetaOf<Verbs::Lerp>();
74-
(void)MetaOf<Verbs::Cerp>();
75-
(void)MetaOf<Verbs::Move>();
76-
}
77-
78-
} // namespace Langulus::Math
18+
#include "../../source/Verbs/Move.inl"

include/Math/Gradient.hpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
/// Copyright (c) 2014 Dimo Markov <[email protected]>
44
/// Part of the Langulus framework, see https://langulus.com
55
///
6-
/// Distributed under GNU General Public License v3+
7-
/// See LICENSE file, or https://www.gnu.org/licenses
6+
/// SPDX-License-Identifier: GPL-3.0-or-later
87
///
98
#pragma once
109
#include "../../source/TGradient.inl"

include/Math/Instance.hpp

Lines changed: 2 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -3,44 +3,7 @@
33
/// Copyright (c) 2014 Dimo Markov <[email protected]>
44
/// Part of the Langulus framework, see https://langulus.com
55
///
6-
/// Distributed under GNU General Public License v3+
7-
/// See LICENSE file, or https://www.gnu.org/licenses
6+
/// SPDX-License-Identifier: GPL-3.0-or-later
87
///
98
#pragma once
10-
#include "../../source/TInstance.inl"
11-
12-
13-
namespace Langulus::Math
14-
{
15-
namespace Inner
16-
{
17-
18-
/// Combines S and T... to form a vector type
19-
/// @tparam S - size of the vector
20-
template<Count S>
21-
struct VectorTypeGenerator {
22-
template<class... T>
23-
static void Register(Types<T...>&&) {
24-
(((void) MetaOf<TVector<T, S>>()), ...);
25-
}
26-
};
27-
28-
} // namespace Langulus::Math::Inner
29-
30-
31-
/// Register all commonly used vector types, so they can be instantiated
32-
/// from a flow
33-
inline void RegisterVectors() {
34-
using AllTypes = Types<
35-
::std::uint8_t, ::std::uint16_t, ::std::uint32_t, ::std::uint64_t,
36-
::std::int8_t, ::std::int16_t, ::std::int32_t, ::std::int64_t,
37-
Float, Double
38-
>;
39-
40-
Inner::VectorTypeGenerator<1>::Register(AllTypes {});
41-
Inner::VectorTypeGenerator<2>::Register(AllTypes {});
42-
Inner::VectorTypeGenerator<3>::Register(AllTypes {});
43-
Inner::VectorTypeGenerator<4>::Register(AllTypes {});
44-
}
45-
46-
} // namespace Langulus::Math
9+
#include "../../source/TInstance.inl"

include/Math/LOD.hpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
/// Copyright (c) 2014 Dimo Markov <[email protected]>
44
/// Part of the Langulus framework, see https://langulus.com
55
///
6-
/// Distributed under GNU General Public License v3+
7-
/// See LICENSE file, or https://www.gnu.org/licenses
6+
/// SPDX-License-Identifier: GPL-3.0-or-later
87
///
98
#pragma once
109
#include "../../source/LOD.inl"

include/Math/Level.hpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
/// Copyright (c) 2014 Dimo Markov <[email protected]>
44
/// Part of the Langulus framework, see https://langulus.com
55
///
6-
/// Distributed under GNU General Public License v3+
7-
/// See LICENSE file, or https://www.gnu.org/licenses
6+
/// SPDX-License-Identifier: GPL-3.0-or-later
87
///
98
#pragma once
109
#include "../../source/Numbers/Level.inl"

include/Math/Mapping.hpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
/// Copyright (c) 2014 Dimo Markov <[email protected]>
44
/// Part of the Langulus framework, see https://langulus.com
55
///
6-
/// Distributed under GNU General Public License v3+
7-
/// See LICENSE file, or https://www.gnu.org/licenses
6+
/// SPDX-License-Identifier: GPL-3.0-or-later
87
///
98
#pragma once
109
#include "../../source/Mapping.hpp"

include/Math/Matrix.hpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
/// Copyright (c) 2014 Dimo Markov <[email protected]>
44
/// Part of the Langulus framework, see https://langulus.com
55
///
6-
/// Distributed under GNU General Public License v3+
7-
/// See LICENSE file, or https://www.gnu.org/licenses
6+
/// SPDX-License-Identifier: GPL-3.0-or-later
87
///
98
#pragma once
109
#include "../../source/Matrices/TMatrix.inl"

include/Math/Normal.hpp

Lines changed: 2 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -3,36 +3,7 @@
33
/// Copyright (c) 2014 Dimo Markov <[email protected]>
44
/// Part of the Langulus framework, see https://langulus.com
55
///
6-
/// Distributed under GNU General Public License v3+
7-
/// See LICENSE file, or https://www.gnu.org/licenses
6+
/// SPDX-License-Identifier: GPL-3.0-or-later
87
///
98
#pragma once
10-
#include "../../source/Vectors/TVector.inl"
11-
#include "../../source/Vectors/TNormal.hpp"
12-
13-
14-
namespace Langulus::Math
15-
{
16-
namespace Inner
17-
{
18-
/// Combines S and T... to form a normal type
19-
/// @tparam S - size of the vector
20-
template<Count S>
21-
struct NormalTypeGenerator {
22-
template<class... T>
23-
static void Register(Types<T...>&&) {
24-
(((void)MetaOf<TNormal<TVector<T, S>>>()), ...);
25-
}
26-
};
27-
} // namespace Langulus::Math::Inner
28-
29-
/// Register all normal types
30-
inline void RegisterNormals() {
31-
using RealTypes = Types<Float, Double>;
32-
33-
Inner::NormalTypeGenerator<2>::Register(RealTypes {});
34-
Inner::NormalTypeGenerator<3>::Register(RealTypes {});
35-
Inner::NormalTypeGenerator<4>::Register(RealTypes {});
36-
}
37-
38-
} // namespace Langulus::Math
9+
#include "../../source/Vectors/TNormal.hpp"

include/Math/Number.hpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
/// Copyright (c) 2014 Dimo Markov <[email protected]>
44
/// Part of the Langulus framework, see https://langulus.com
55
///
6-
/// Distributed under GNU General Public License v3+
7-
/// See LICENSE file, or https://www.gnu.org/licenses
6+
/// SPDX-License-Identifier: GPL-3.0-or-later
87
///
98
#pragma once
109
#include "../../source/Numbers/TNumber.inl"

0 commit comments

Comments
 (0)