Fixed AABB Sizing issue.
Fixed is a strong word. TODO: I have solved the problem by using isEmpty to tell when it's a fresh AABB and just returing the passed AABB as the new expanded AABB. This feels lazy and I expect it'll cause issues in the future. Plus it isn't truely correct and the context which uses it could just use the first obj AABB since there is only 1 objectmain
parent
a28d49b132
commit
17c7942405
Binary file not shown.
|
@ -2,25 +2,82 @@
|
|||
374 3235 1668323538168825062 CMakeFiles/Step_3.dir/src/graphics/imgui/imgui_tables.cpp.o f6dab204e07e8dcf
|
||||
2 2022 1668323499583713805 CMakeFiles/Step_3.dir/src/graphics/gl/gl.c.o 30ab06816e8637c1
|
||||
4 3390 1668323512856096078 CMakeFiles/Step_3.dir/src/graphics/imgui/imgui_demo.cpp.o 7798aba97da63e31
|
||||
2 1773 1668466039063176140 CMakeFiles/Step_3.dir/src/engine/world.cpp.o 6470df278966c4
|
||||
13 1984 1668489872732758544 CMakeFiles/Step_3.dir/src/engine/world.cpp.o 6470df278966c4
|
||||
2 1641 1668366223598629532 CMakeFiles/Step_3.dir/src/engine/util/debug.cpp.o d86a254d2bce8f74
|
||||
1 7895 1668377853507218742 CMakeFiles/Step_3.dir/src/engine/image/image.cpp.o 1c68ba16e6b4d09b
|
||||
1 6863 1668489146695541389 CMakeFiles/Step_3.dir/src/engine/image/image.cpp.o 1c68ba16e6b4d09b
|
||||
2 1301 1668366223258619732 CMakeFiles/Step_3.dir/src/graphics/debug_gui.cpp.o 9493619f74acd06a
|
||||
4 605 1668323535536749264 CMakeFiles/Step_3.dir/src/graphics/imgui/imgui_impl_x11.cpp.o d1e9a2fcb31e2ec8
|
||||
0 26 1668358519550031316 build.ninja ccb5de0c063412ab
|
||||
1 1129 1668448492108683969 CMakeFiles/Step_3.dir/src/engine/globals.cpp.o 4ef77d2224f86511
|
||||
1 996 1668448491972679960 CMakeFiles/Step_3.dir/src/engine/math/colliders.cpp.o 39e9f435096d066b
|
||||
1 1294 1668465885880220128 CMakeFiles/Step_3.dir/src/engine/util/models.cpp.o 164394d360c43072
|
||||
1 1034 1668489140867427595 CMakeFiles/Step_3.dir/src/engine/globals.cpp.o 4ef77d2224f86511
|
||||
1 1244 1668489141075431646 CMakeFiles/Step_3.dir/src/engine/math/colliders.cpp.o 39e9f435096d066b
|
||||
2 1373 1668489872120742440 CMakeFiles/Step_3.dir/src/engine/util/models.cpp.o 164394d360c43072
|
||||
3 6633 1668323516100189511 CMakeFiles/Step_3.dir/src/graphics/imgui/imgui.cpp.o 55e7538fd27b47be
|
||||
1930 1998 1668466411374360550 Step_3 f055ce2b85635598
|
||||
2275 2350 1668489873096768119 Step_3 f055ce2b85635598
|
||||
4 521 1668323535452746847 CMakeFiles/Step_3.dir/src/graphics/imgui/imgui_impl_glfw.cpp.o 6aef9db88eb3d76d
|
||||
1 1719 1668466319832594099 CMakeFiles/Step_3.dir/src/engine/raytracing.cpp.o 11f0e227e9fda9ca
|
||||
2 1850 1668489872596754964 CMakeFiles/Step_3.dir/src/engine/raytracing.cpp.o 11f0e227e9fda9ca
|
||||
1 827 1668366742693637470 CMakeFiles/Step_3.dir/src/graphics/input.cpp.o 510001b0955ab019
|
||||
5 4715 1668323514180134213 CMakeFiles/Step_3.dir/src/graphics/imgui/imgui_draw.cpp.o f89fa3d7b779872a
|
||||
2 1366 1668466038659168342 CMakeFiles/Step_3.dir/src/graphics/graphics.cpp.o ce988de97a5cb51d
|
||||
521 6249 1668323541180911801 CMakeFiles/Step_3.dir/src/graphics/imgui/imgui_widgets.cpp.o 84017388bc7af144
|
||||
2 1340 1668448492316690097 CMakeFiles/Step_3.dir/src/graphics/gl/gl.cpp.o 330ad35a6abf06c3
|
||||
13 1419 1668489872168743705 CMakeFiles/Step_3.dir/src/graphics/graphics.cpp.o ce988de97a5cb51d
|
||||
2 1717 1668489141551440921 CMakeFiles/Step_3.dir/src/graphics/gl/gl.cpp.o 330ad35a6abf06c3
|
||||
4 374 1668323535308742700 CMakeFiles/Step_3.dir/src/graphics/imgui/imgui_impl_opengl3.cpp.o 1b5f0fbe3cf8ce4e
|
||||
2 1790 1668377847399042915 CMakeFiles/Step_3.dir/src/graphics/gl/shader.cpp.o 2553d57dba16057b
|
||||
1 1930 1668466411306359238 CMakeFiles/Step_3.dir/src/engine/main.cpp.o 641dce3f86933e2e
|
||||
2 1655 1668489141487439674 CMakeFiles/Step_3.dir/src/graphics/gl/shader.cpp.o 2553d57dba16057b
|
||||
1 2275 1668489873024766225 CMakeFiles/Step_3.dir/src/engine/main.cpp.o 641dce3f86933e2e
|
||||
2 2095 1668366224050642556 CMakeFiles/Step_3.dir/src/engine/util/parser.cpp.o 1007c86c207ac940
|
||||
2 1303 1668489957751009761 CMakeFiles/Step_3.dir/src/engine/util/models.cpp.o 164394d360c43072
|
||||
2 1330 1668489957775010400 CMakeFiles/Step_3.dir/src/graphics/graphics.cpp.o ce988de97a5cb51d
|
||||
2 1652 1668489958099019032 CMakeFiles/Step_3.dir/src/engine/world.cpp.o 6470df278966c4
|
||||
2 1717 1668489958163020738 CMakeFiles/Step_3.dir/src/engine/raytracing.cpp.o 11f0e227e9fda9ca
|
||||
1 2233 1668489958679034483 CMakeFiles/Step_3.dir/src/engine/main.cpp.o 641dce3f86933e2e
|
||||
2233 2297 1668489958743036189 Step_3 f055ce2b85635598
|
||||
1 1328 1668490081042319128 CMakeFiles/Step_3.dir/src/engine/util/models.cpp.o 164394d360c43072
|
||||
1 1374 1668490081086320317 CMakeFiles/Step_3.dir/src/graphics/graphics.cpp.o ce988de97a5cb51d
|
||||
1 1640 1668490081354327561 CMakeFiles/Step_3.dir/src/engine/world.cpp.o 6470df278966c4
|
||||
1 1726 1668490081438329831 CMakeFiles/Step_3.dir/src/engine/raytracing.cpp.o 11f0e227e9fda9ca
|
||||
1 2239 1668490081950343672 CMakeFiles/Step_3.dir/src/engine/main.cpp.o 641dce3f86933e2e
|
||||
2239 2302 1668490082014345402 Step_3 f055ce2b85635598
|
||||
2 1256 1668491007091920404 CMakeFiles/Step_3.dir/src/engine/util/models.cpp.o 164394d360c43072
|
||||
2 1303 1668491007139921206 CMakeFiles/Step_3.dir/src/graphics/graphics.cpp.o ce988de97a5cb51d
|
||||
2 1588 1668491007423925947 CMakeFiles/Step_3.dir/src/engine/world.cpp.o 6470df278966c4
|
||||
2 1684 1668491007519927550 CMakeFiles/Step_3.dir/src/engine/raytracing.cpp.o 11f0e227e9fda9ca
|
||||
1 2245 1668491008079936900 CMakeFiles/Step_3.dir/src/engine/main.cpp.o 641dce3f86933e2e
|
||||
2245 2308 1668491008143937971 Step_3 f055ce2b85635598
|
||||
1 1258 1668491031264329637 CMakeFiles/Step_3.dir/src/engine/util/models.cpp.o 164394d360c43072
|
||||
1 1307 1668491031312330460 CMakeFiles/Step_3.dir/src/graphics/graphics.cpp.o ce988de97a5cb51d
|
||||
1 1588 1668491031592335269 CMakeFiles/Step_3.dir/src/engine/world.cpp.o 6470df278966c4
|
||||
1 1666 1668491031672336643 CMakeFiles/Step_3.dir/src/engine/raytracing.cpp.o 11f0e227e9fda9ca
|
||||
1 2226 1668491032232346264 CMakeFiles/Step_3.dir/src/engine/main.cpp.o 641dce3f86933e2e
|
||||
2226 2286 1668491032292347296 Step_3 f055ce2b85635598
|
||||
1 1248 1668491266864840576 CMakeFiles/Step_3.dir/src/engine/util/models.cpp.o 164394d360c43072
|
||||
1 1301 1668491266920841745 CMakeFiles/Step_3.dir/src/graphics/graphics.cpp.o ce988de97a5cb51d
|
||||
1 1581 1668491267200847580 CMakeFiles/Step_3.dir/src/engine/world.cpp.o 6470df278966c4
|
||||
1 1660 1668491267276849164 CMakeFiles/Step_3.dir/src/engine/raytracing.cpp.o 11f0e227e9fda9ca
|
||||
1 2223 1668491267840860925 CMakeFiles/Step_3.dir/src/engine/main.cpp.o 641dce3f86933e2e
|
||||
2223 2284 1668491267900862176 Step_3 f055ce2b85635598
|
||||
2 1275 1668491276045032437 CMakeFiles/Step_3.dir/src/engine/util/models.cpp.o 164394d360c43072
|
||||
2 1285 1668491276057032688 CMakeFiles/Step_3.dir/src/graphics/graphics.cpp.o ce988de97a5cb51d
|
||||
2 1604 1668491276373039313 CMakeFiles/Step_3.dir/src/engine/world.cpp.o 6470df278966c4
|
||||
1 1655 1668491276425040402 CMakeFiles/Step_3.dir/src/engine/raytracing.cpp.o 11f0e227e9fda9ca
|
||||
1 2261 1668491277033053146 CMakeFiles/Step_3.dir/src/engine/main.cpp.o 641dce3f86933e2e
|
||||
2261 2322 1668491277093054405 Step_3 f055ce2b85635598
|
||||
2 1357 1668491283805195413 CMakeFiles/Step_3.dir/src/graphics/graphics.cpp.o ce988de97a5cb51d
|
||||
1 1532 1668491283981199118 CMakeFiles/Step_3.dir/src/engine/util/models.cpp.o 164394d360c43072
|
||||
2 1651 1668491284097201557 CMakeFiles/Step_3.dir/src/engine/world.cpp.o 6470df278966c4
|
||||
1 1723 1668491284169203075 CMakeFiles/Step_3.dir/src/engine/raytracing.cpp.o 11f0e227e9fda9ca
|
||||
1 2530 1668491284977220089 CMakeFiles/Step_3.dir/src/engine/main.cpp.o 641dce3f86933e2e
|
||||
2531 2593 1668491285041221437 Step_3 f055ce2b85635598
|
||||
1 1314 1668491300465547709 CMakeFiles/Step_3.dir/src/engine/util/models.cpp.o 164394d360c43072
|
||||
1 1439 1668491300589550343 CMakeFiles/Step_3.dir/src/graphics/graphics.cpp.o ce988de97a5cb51d
|
||||
1 1634 1668491300785554506 CMakeFiles/Step_3.dir/src/engine/world.cpp.o 6470df278966c4
|
||||
1 1684 1668491300837555611 CMakeFiles/Step_3.dir/src/engine/raytracing.cpp.o 11f0e227e9fda9ca
|
||||
1 2282 1668491301433568277 CMakeFiles/Step_3.dir/src/engine/main.cpp.o 641dce3f86933e2e
|
||||
2282 2342 1668491301493569552 Step_3 f055ce2b85635598
|
||||
1 945 1668491473161369910 CMakeFiles/Step_3.dir/src/engine/globals.cpp.o 4ef77d2224f86511
|
||||
2 1141 1668491473361374498 CMakeFiles/Step_3.dir/src/graphics/gl/gl.cpp.o 330ad35a6abf06c3
|
||||
1 1161 1668491473377374863 CMakeFiles/Step_3.dir/src/engine/math/colliders.cpp.o 39e9f435096d066b
|
||||
2 1346 1668491473565379176 CMakeFiles/Step_3.dir/src/graphics/graphics.cpp.o ce988de97a5cb51d
|
||||
2 1656 1668491473873386239 CMakeFiles/Step_3.dir/src/engine/world.cpp.o 6470df278966c4
|
||||
2 1688 1668491473905386973 CMakeFiles/Step_3.dir/src/engine/util/models.cpp.o 164394d360c43072
|
||||
1 1730 1668491473949387979 CMakeFiles/Step_3.dir/src/engine/raytracing.cpp.o 11f0e227e9fda9ca
|
||||
1 2359 1668491474577402387 CMakeFiles/Step_3.dir/src/engine/main.cpp.o 641dce3f86933e2e
|
||||
2359 2426 1668491474641403855 Step_3 f055ce2b85635598
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1,3 +1,3 @@
|
|||
Start testing: Nov 14 20:44 EST
|
||||
Start testing: Nov 15 00:51 EST
|
||||
----------------------------------------------------------
|
||||
End testing: Nov 14 20:44 EST
|
||||
End testing: Nov 15 00:51 EST
|
||||
|
|
|
@ -9,7 +9,7 @@ Size=550,680
|
|||
Collapsed=1
|
||||
|
||||
[Window][Debug Menu]
|
||||
Pos=13,12
|
||||
Pos=-6,23
|
||||
Size=339,226
|
||||
Collapsed=0
|
||||
|
||||
|
@ -74,8 +74,8 @@ Size=324,211
|
|||
Collapsed=0
|
||||
|
||||
[Window][BVH Data ]
|
||||
Pos=930,180
|
||||
Size=397,473
|
||||
Pos=913,184
|
||||
Size=522,476
|
||||
Collapsed=0
|
||||
|
||||
[Window][Example: Long text display]
|
||||
|
@ -83,7 +83,17 @@ Pos=60,60
|
|||
Size=520,600
|
||||
Collapsed=0
|
||||
|
||||
[Window][Example: Log]
|
||||
Pos=60,60
|
||||
Size=500,400
|
||||
Collapsed=0
|
||||
|
||||
[Table][0xD0F0C6E3,2]
|
||||
Column 0 Weight=1.0000
|
||||
Column 1 Weight=1.0000
|
||||
|
||||
[Table][0xC9935533,3]
|
||||
Column 0 Weight=1.0000
|
||||
Column 1 Weight=1.0000
|
||||
Column 2 Weight=1.0000
|
||||
|
||||
|
|
|
@ -9,9 +9,12 @@
|
|||
#include "engine/util/std.h"
|
||||
#include "engine/types.h"
|
||||
#include <config.h>
|
||||
|
||||
#ifdef COMPILE_GUI
|
||||
|
||||
#include <graphics/gl/gl.h>
|
||||
#include <graphics/imgui/imgui.h>
|
||||
|
||||
#endif
|
||||
|
||||
#include <utility>
|
||||
|
@ -64,10 +67,16 @@ namespace Raytracing {
|
|||
worldShader.setVec3("color", {1.0, 1.0, 1.0});
|
||||
if (selected == index) {
|
||||
worldShader.setVec3("color", {0.0, 0.0, 1.0});
|
||||
if (ImGui::BeginListBox("")){
|
||||
if (ImGui::BeginListBox("", ImVec2(250, 350))) {
|
||||
std::stringstream strs;
|
||||
strs << aabb;
|
||||
ImGui::Text("%s", strs.str().c_str());
|
||||
for (const auto& item: objs) {
|
||||
auto pos = item.ptr->getPosition();
|
||||
ImGui::Text("%s", (std::to_string(pos.x()) + " " + std::to_string(pos.y()) + " " + std::to_string(pos.z())).c_str());
|
||||
std::stringstream stm;
|
||||
stm << item.aabb;
|
||||
ImGui::Text("%s,\n\t%s", (std::to_string(pos.x()) + " " + std::to_string(pos.y()) + " " + std::to_string(pos.z())).c_str(),
|
||||
stm.str().c_str());
|
||||
}
|
||||
ImGui::EndListBox();
|
||||
}
|
||||
|
@ -92,7 +101,18 @@ namespace Raytracing {
|
|||
}
|
||||
}
|
||||
void gui() const {
|
||||
if (ImGui::Selectable(("S: " + std::to_string(objs.size()) + " I: " + std::to_string(index)).c_str(), selected == index))
|
||||
int c1 = -1;
|
||||
int c2 = -1;
|
||||
if (left != nullptr)
|
||||
c1 = left->index;
|
||||
if (right != nullptr)
|
||||
c2 = right->index;
|
||||
std::string t;
|
||||
if (c1 == -1 && c2 == -1)
|
||||
t = " LEAF";
|
||||
else
|
||||
t = " L: " + std::to_string(c1) + " R: " + std::to_string(c2);
|
||||
if (ImGui::Selectable(("S: " + std::to_string(objs.size()) + " I: " + std::to_string(index) + t).c_str(), selected == index))
|
||||
selected = index;
|
||||
}
|
||||
#endif
|
||||
|
@ -111,40 +131,32 @@ namespace Raytracing {
|
|||
static BVHPartitionedSpace partition(const std::pair<AABB, AABB>& aabbs, const std::vector<BVHObject>& objs) {
|
||||
BVHPartitionedSpace space;
|
||||
for (const auto& obj: objs) {
|
||||
// if this object doesn't have an AABB, we cannot use a BVH on it
|
||||
// If this ever fails we have a problem with the implementation.
|
||||
// if this object doesn't have an AABB, we cannot use a BVH on it. If this ever fails we have a problem with the implementation.
|
||||
RTAssert(!obj.aabb.isEmpty());
|
||||
if (aabbs.first.intersects(obj.aabb)) {
|
||||
if (aabbs.first.intersects(obj.aabb))
|
||||
space.left.push_back(obj);
|
||||
tlog << "left\n";
|
||||
}
|
||||
if (aabbs.second.intersects(obj.aabb)) {
|
||||
else if (aabbs.second.intersects(obj.aabb))
|
||||
space.right.push_back(obj);
|
||||
tlog << "right\n";
|
||||
}
|
||||
}
|
||||
return space;
|
||||
}
|
||||
|
||||
BVHNode* addObjectsRecur(const std::vector<BVHObject>& objects, long prevSize) {
|
||||
ilog << "size: " << objects.size() << " " << prevSize << "\n";
|
||||
// prevSize was required to solve some really weird bugs
|
||||
// which are a TODO:
|
||||
if ((objects.size() <= 1 && !objects.empty()) || prevSize == objects.size()) {
|
||||
AABB local;
|
||||
for (const auto& obj: objects)
|
||||
local = local.expand(obj.aabb);
|
||||
return new BVHNode(objects, local, nullptr, nullptr);
|
||||
} else if (objects.empty()) // should never reach here!!
|
||||
return nullptr;
|
||||
// create a volume for the entire world.
|
||||
// yes, we could use the recursion provided AABB,
|
||||
// but that wouldn't be minimum, only half.
|
||||
// this ensures that we have a minimum AABB.
|
||||
AABB world;
|
||||
for (const auto& obj: objects) {
|
||||
for (const auto& obj: objects)
|
||||
world = world.expand(obj.aabb);
|
||||
}
|
||||
// prevSize was required to solve some really weird bugs
|
||||
// which are a TODO:
|
||||
if ((objects.size() <= 1 && !objects.empty()) || prevSize == objects.size()) {
|
||||
return new BVHNode(objects, world, nullptr, nullptr);
|
||||
} else if (objects.empty()) // should never reach here!!
|
||||
return nullptr;
|
||||
|
||||
// then split and partition the world
|
||||
auto splitAABBs = world.splitByLongestAxis();
|
||||
auto partitionedObjs = partition(splitAABBs, objects);
|
||||
|
@ -172,7 +184,7 @@ namespace Raytracing {
|
|||
// divide and conquer and so on
|
||||
if (node->right != nullptr)
|
||||
if (node->right->aabb.intersects(ray, min, max))
|
||||
return traverseFindRayIntersection(node->left, ray, min, max);
|
||||
return traverseFindRayIntersection(node->right, ray, min, max);
|
||||
// return the objects of the lowest BVH node we can find
|
||||
// if this is implemented properly this should only contain one, maybe two objects
|
||||
// which is much faster! (especially when dealing with triangles)
|
||||
|
@ -211,8 +223,7 @@ namespace Raytracing {
|
|||
// move all the object's aabb's into world position
|
||||
std::vector<BVHObject> objs;
|
||||
for (auto* obj: objects) {
|
||||
// we don't want to store all the AABBs which don't exist
|
||||
// ie spheres
|
||||
// we don't want to store all the AABBs which don't exist: ie spheres
|
||||
if (obj->getAABB().isEmpty()) {
|
||||
noAABBObjects.push_back(obj);
|
||||
continue;
|
||||
|
@ -240,14 +251,17 @@ namespace Raytracing {
|
|||
worldShader.setInt("useWhite", 1);
|
||||
worldShader.setVec3("color", {1.0, 1.0, 1.0});
|
||||
{
|
||||
ImGui::BeginChild("left pane", ImVec2(150, 0), true);
|
||||
ImGui::BeginChild("left pane", ImVec2(180, 0), true);
|
||||
guiNodesRecur(root);
|
||||
ImGui::EndChild();
|
||||
}
|
||||
ImGui::SameLine();
|
||||
{
|
||||
ImGui::BeginGroup();
|
||||
ImGui::BeginChild("item view", ImVec2(0, -ImGui::GetFrameHeightWithSpacing()), true, ImGuiWindowFlags_AlwaysAutoResize); // Leave room for 1 line below us
|
||||
ImGui::BeginChild("item view",
|
||||
ImVec2(0, -ImGui::GetFrameHeightWithSpacing()),
|
||||
true,
|
||||
ImGuiWindowFlags_AlwaysAutoResize); // Leave room for 1 line below us
|
||||
drawNodesRecur(worldShader, root);
|
||||
ImGui::EndChild();
|
||||
ImGui::EndGroup();
|
||||
|
|
|
@ -41,6 +41,11 @@ namespace Raytracing {
|
|||
|
||||
// returns an expanded version of this AABB is the other AABB is larger then this AABB
|
||||
[[nodiscard]] AABB expand(const AABB& other) const {
|
||||
// terrible hack
|
||||
// a 0 init AABB was having issues when being "expanded" to a place which is larger
|
||||
// this should prevent that by side stepping the issue. Which is a TODO:
|
||||
if (isEmpty())
|
||||
return other;
|
||||
PRECISION_TYPE minX = std::min(min.x(), other.min.x());
|
||||
PRECISION_TYPE minY = std::min(min.y(), other.min.y());
|
||||
PRECISION_TYPE minZ = std::min(min.z(), other.min.z());
|
||||
|
|
|
@ -43,6 +43,7 @@
|
|||
// mul
|
||||
// 70.9977ms normal
|
||||
// 286.656ms avx
|
||||
|
||||
#ifdef COMPILER_DEBUG_ENABLED
|
||||
#define USE_SIMD_CPU
|
||||
#endif
|
||||
|
|
|
@ -87,19 +87,29 @@ namespace Raytracing {
|
|||
tmin = std::min(tmin, std::min(tx1, tx2));
|
||||
tmax = std::max(tmax, std::max(tx1, tx2));
|
||||
|
||||
// gives us an early exit if we know it's outside the bounds.
|
||||
if (tmax <= tmin)
|
||||
return false;
|
||||
|
||||
PRECISION_TYPE ty1 = (min.y() - ray.getStartingPoint().y())*ray.getInverseDirection().y();
|
||||
PRECISION_TYPE ty2 = (max.y() - ray.getStartingPoint().y())*ray.getInverseDirection().y();
|
||||
|
||||
tmin = std::max(tmin, std::min(ty1, ty2));
|
||||
tmax = std::min(tmax, std::max(ty1, ty2));
|
||||
|
||||
if (tmax <= tmin)
|
||||
return false;
|
||||
|
||||
PRECISION_TYPE tz1 = (min.z() - ray.getStartingPoint().z())*ray.getInverseDirection().z();
|
||||
PRECISION_TYPE tz2 = (max.z() - ray.getStartingPoint().z())*ray.getInverseDirection().z();
|
||||
|
||||
tmin = std::max(tmin, std::min(tz1, tz2));
|
||||
tmax = std::min(tmax, std::max(tz1, tz2));
|
||||
|
||||
return tmax > std::max(tmin, 0.0);
|
||||
if (tmax <= tmin)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AABB::intersects(const Ray& ray, PRECISION_TYPE tmin, PRECISION_TYPE tmax) {
|
||||
|
|
Loading…
Reference in New Issue