Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
Scotty3D
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Courses
Scotty3D
Commits
42d39f97
Commit
42d39f97
authored
4 years ago
by
TheNumbat
Browse files
Options
Downloads
Patches
Plain Diff
use is leaf in bvh
parent
24b1cee1
Branches
Branches containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/rays/bvh.h
+2
-0
2 additions, 0 deletions
src/rays/bvh.h
src/student/bvh.inl
+3
-1
3 additions, 1 deletion
src/student/bvh.inl
with
5 additions
and
1 deletion
src/rays/bvh.h
+
2
−
0
View file @
42d39f97
...
@@ -31,9 +31,11 @@ public:
...
@@ -31,9 +31,11 @@ public:
private:
private:
class
Node
{
class
Node
{
BBox
bbox
;
BBox
bbox
;
size_t
start
,
size
,
l
,
r
;
size_t
start
,
size
,
l
,
r
;
// A node is a leaf if l == r, since all interior nodes must have distinct children
bool
is_leaf
()
const
;
bool
is_leaf
()
const
;
friend
class
BVH
<
Primitive
>
;
friend
class
BVH
<
Primitive
>
;
};
};
...
...
This diff is collapsed.
Click to expand it.
src/student/bvh.inl
+
3
−
1
View file @
42d39f97
...
@@ -77,6 +77,8 @@ template<typename Primitive> BVH<Primitive> BVH<Primitive>::copy() const {
...
@@ -77,6 +77,8 @@ template<typename Primitive> BVH<Primitive> BVH<Primitive>::copy() const {
}
}
template<typename Primitive> bool BVH<Primitive>::Node::is_leaf() const {
template<typename Primitive> bool BVH<Primitive>::Node::is_leaf() const {
// A node is a leaf if l == r, since all interior nodes must have distinct children
return l == r;
return l == r;
}
}
...
@@ -145,7 +147,7 @@ size_t BVH<Primitive>::visualize(GL::Lines& lines, GL::Lines& active, size_t lev
...
@@ -145,7 +147,7 @@ size_t BVH<Primitive>::visualize(GL::Lines& lines, GL::Lines& active, size_t lev
edge(Vec3{max.x, min.y, min.z}, Vec3{max.x, max.y, min.z});
edge(Vec3{max.x, min.y, min.z}, Vec3{max.x, max.y, min.z});
edge(Vec3{max.x, min.y, min.z}, Vec3{max.x, min.y, max.z});
edge(Vec3{max.x, min.y, min.z}, Vec3{max.x, min.y, max.z});
if(node.
l && node.r
) {
if(
!
node.
is_leaf()
) {
tstack.push({node.l, lvl + 1});
tstack.push({node.l, lvl + 1});
tstack.push({node.r, lvl + 1});
tstack.push({node.r, lvl + 1});
} else {
} else {
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment