Foundation
Loading...
Searching...
No Matches
Metadata.hpp
Go to the documentation of this file.
1#pragma once
2#include <Math/Math.hpp>
3#include <cfloat>
4
5using namespace Foundation::Math;
12
14{
15 float3 min{0.0f, 0.0f, 0.0f};
16 float3 max{0.0f, 0.0f, 0.0f};
17
19 {
20 return {
21 .min = float3(FLT_MAX),
22 .max = float3(-FLT_MAX),
23 };
24 }
25
26 [[nodiscard]] bool IsValid() const
27 {
28 return min.x <= max.x && min.y <= max.y && min.z <= max.z;
29 }
30
32 {
33 min = Foundation::Math::min(min, point);
34 max = Foundation::Math::max(max, point);
35 return *this;
36 }
37
39 {
40 if (!bounds.IsValid())
41 return *this;
42 Include(bounds.min);
43 Include(bounds.max);
44 return *this;
45 }
46
48 {
49 return Include(point);
50 }
51
53 {
54 return Include(bounds);
55 }
56};
Definition Decompose.hpp:4
vec3 float3
Definition Math.hpp:26
Definition Metadata.hpp:14
FSerializedBounds & Include(float3 const &point)
Definition Metadata.hpp:31
FSerializedBounds & Include(FSerializedBounds const &bounds)
Definition Metadata.hpp:38
float3 max
Definition Metadata.hpp:16
bool IsValid() const
Definition Metadata.hpp:26
static FSerializedBounds Empty()
Definition Metadata.hpp:18
float3 min
Definition Metadata.hpp:15
FSerializedBounds & operator+=(FSerializedBounds const &bounds)
Definition Metadata.hpp:52
FSerializedBounds & operator+=(float3 const &point)
Definition Metadata.hpp:47
Definition Metadata.hpp:7
float3 transform
Definition Metadata.hpp:8
quat rotation
Definition Metadata.hpp:9
float3 scale
Definition Metadata.hpp:10