Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
CppRaytracer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model 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
Show more breadcrumbs
Yoel
CppRaytracer
Commits
8678445a
Commit
8678445a
authored
4 years ago
by
Yoel
Browse files
Options
Downloads
Patches
Plain Diff
Fixed the bounds-function to return the member, added check for BoundingVolume in intersect
parent
266bcb05
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
RayTracer/shape/Group.cpp
+9
-7
9 additions, 7 deletions
RayTracer/shape/Group.cpp
with
9 additions
and
7 deletions
RayTracer/shape/Group.cpp
+
9
−
7
View file @
8678445a
...
@@ -20,12 +20,14 @@ std::shared_ptr<cam::Hit> Group::intersect(const cam::Ray& r) const {
...
@@ -20,12 +20,14 @@ std::shared_ptr<cam::Hit> Group::intersect(const cam::Ray& r) const {
std
::
shared_ptr
<
cam
::
Hit
>
result
;
std
::
shared_ptr
<
cam
::
Hit
>
result
;
for
(
std
::
shared_ptr
<
Shape
>
s
:
shapeList
)
{
for
(
std
::
shared_ptr
<
Shape
>
s
:
shapeList
)
{
std
::
shared_ptr
<
cam
::
Hit
>
temp
=
s
->
intersect
(
imagR
);
if
(
s
->
bounds
().
intersects
(
imagR
))
{
if
(
temp
!=
nullptr
)
{
std
::
shared_ptr
<
cam
::
Hit
>
temp
=
s
->
intersect
(
imagR
);
if
(
result
==
nullptr
)
{
if
(
temp
!=
nullptr
)
{
result
=
temp
;
if
(
result
==
nullptr
)
{
}
else
if
(
result
->
t
>
temp
->
t
)
{
result
=
temp
;
result
=
temp
;
}
else
if
(
result
->
t
>
temp
->
t
)
{
result
=
temp
;
}
}
}
}
}
}
}
...
@@ -38,7 +40,7 @@ std::shared_ptr<cam::Hit> Group::intersect(const cam::Ray& r) const {
...
@@ -38,7 +40,7 @@ std::shared_ptr<cam::Hit> Group::intersect(const cam::Ray& r) const {
return
result
;
return
result
;
}
}
util
::
AxisAlignedBoundingBox
Group
::
bounds
()
const
{
util
::
AxisAlignedBoundingBox
Group
::
bounds
()
const
{
return
util
::
AxisAlignedB
ounding
Box
()
;
return
b
ounding
Volume
;
}
}
void
Group
::
add
(
const
std
::
shared_ptr
<
Shape
>&
shape
)
{
void
Group
::
add
(
const
std
::
shared_ptr
<
Shape
>&
shape
)
{
shapeList
.
push_back
(
shape
);
shapeList
.
push_back
(
shape
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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