forked from mmp/pbrt-v4
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request mmp#134 from Tom94/cpp20
C++20 usage & other improvements
- Loading branch information
Showing
63 changed files
with
2,119 additions
and
1,125 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,9 @@ | |
# Python cache | ||
__pycache__ | ||
|
||
# macOS | ||
.DS_Store | ||
|
||
# Development project files | ||
*.sublime-project | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule eigen
deleted from
a45d28
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
// This file was developed by Thomas Müller <[email protected]>. | ||
// It is published under the BSD 3-Clause License within the LICENSE file. | ||
|
||
#pragma once | ||
|
||
#include <tev/Common.h> | ||
|
||
|
||
TEV_NAMESPACE_BEGIN | ||
|
||
template <typename T, uint32_t N_DIMS> | ||
struct Box { | ||
using Vector = nanogui::Array<T, N_DIMS>; | ||
|
||
Box(const Vector& min, const Vector& max) : min{min}, max{max} {} | ||
Box(const Vector& max) : Box{Vector{(T)0}, max} {} | ||
Box() : Box{Vector{std::numeric_limits<T>::max()}, Vector{std::numeric_limits<T>::min()}} {} | ||
|
||
// Casting boxes of other types to this one | ||
template <typename U> | ||
Box(const Box<U, N_DIMS>& other) : min{other.min}, max{other.max} {} | ||
|
||
Vector size() const { | ||
return max - min; | ||
} | ||
|
||
Vector middle() const { | ||
return (min + max) / (T)2; | ||
} | ||
|
||
bool isValid() const { | ||
bool result = true; | ||
for (uint32_t i = 0; i < N_DIMS; ++i) { | ||
result &= max[i] >= min[i]; | ||
} | ||
return result; | ||
} | ||
|
||
bool operator==(const Box& other) const { | ||
return min == other.min && max == other.max; | ||
} | ||
|
||
Box<T, N_DIMS> inflate(T amount) const { | ||
return {min - Vector{amount}, max + Vector{amount}}; | ||
} | ||
|
||
Vector min, max; | ||
}; | ||
|
||
using Box2f = Box<float, 2>; | ||
using Box3f = Box<float, 3>; | ||
using Box4f = Box<float, 4>; | ||
using Box2i = Box<int32_t, 2>; | ||
using Box3i = Box<int32_t, 3>; | ||
using Box4i = Box<int32_t, 4>; | ||
|
||
TEV_NAMESPACE_END |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.