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
b96a808b
Commit
b96a808b
authored
2 years ago
by
Yoel
Browse files
Options
Downloads
Patches
Plain Diff
Tree depth search
parent
04a18b1a
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
RayTracer/Main.cpp
+21
-5
21 additions, 5 deletions
RayTracer/Main.cpp
with
21 additions
and
5 deletions
RayTracer/Main.cpp
+
21
−
5
View file @
b96a808b
...
...
@@ -36,6 +36,20 @@ using namespace cam;
using
namespace
shapes
;
using
namespace
std
;
int
tree_recurs
(
const
std
::
vector
<
shapes
::
TriMeshNode
>&
hierarchy
,
shapes
::
TriMeshNode
r
)
{
int
ld
=
1
;
int
rd
=
1
;
if
(
r
.
left
!=
-
1
)
{
ld
+=
tree_recurs
(
hierarchy
,
hierarchy
[
r
.
left
]);
}
if
(
r
.
right
!=
-
1
)
{
rd
+=
tree_recurs
(
hierarchy
,
hierarchy
[
r
.
right
]);
}
int
d
=
max
<
int
>
(
rd
,
ld
);
// if (d != 0) cout << d << endl;
return
d
;
}
int
main
()
{
#if true
cout
<<
"Start"
<<
endl
;
...
...
@@ -109,15 +123,17 @@ int main() {
cout
<<
"halfed"
<<
endl
;
writeBmp
(
"results/aaa.bmp"
,
x
);
#elif true
cout
<<
config
::
fnme
<<
endl
;
#elif false
std
::
ifstream
is
(
"Extended_Cube.obj"
);
std
::
ifstream
is
(
"Cube.obj"
);
TriangleMesh
mesh
(
is
,
nullptr
);
cout
<<
"leaves: "
<<
mesh
.
leaves
.
size
()
<<
endl
;
cout
<<
"hierarchy: "
<<
mesh
.
hierarchy
.
size
()
<<
endl
;
int
i
=
0
;
for
(
auto
hier
:
mesh
.
hierarchy
)
{
cout
<<
"{"
<<
hier
.
left
<<
" "
<<
hier
.
right
<<
" "
<<
hier
.
leaves_i
<<
" "
<<
hier
.
leaves_size
<<
"}"
<<
endl
;
cout
<<
i
<<
" {"
<<
hier
.
left
<<
" "
<<
hier
.
right
<<
" "
<<
hier
.
leaves_i
<<
" "
<<
hier
.
leaves_size
<<
"}"
<<
endl
;
i
++
;
}
cout
<<
tree_recurs
(
mesh
.
hierarchy
,
mesh
.
hierarchy
[
0
])
<<
endl
;
#endif
};
\ No newline at end of file
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