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
3e1db41a
Commit
3e1db41a
authored
4 years ago
by
Yoel
Browse files
Options
Downloads
Patches
Plain Diff
Main changes
parent
1f86f54a
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/Main.cpp
+12
-4
12 additions, 4 deletions
RayTracer/Main.cpp
with
12 additions
and
4 deletions
RayTracer/Main.cpp
+
12
−
4
View file @
3e1db41a
...
@@ -36,7 +36,7 @@ using namespace shapes;
...
@@ -36,7 +36,7 @@ using namespace shapes;
using
namespace
std
;
using
namespace
std
;
int
main
()
{
int
main
()
{
if
(
fals
e
)
{
if
(
tru
e
)
{
cout
<<
"Start"
<<
endl
;
cout
<<
"Start"
<<
endl
;
// Image img = Image (100, 100);
// Image img = Image (100, 100);
...
@@ -78,6 +78,14 @@ int main() {
...
@@ -78,6 +78,14 @@ int main() {
std
::
ifstream
is
(
"Tower_Base.obj"
);
std
::
ifstream
is
(
"Tower_Base.obj"
);
auto
mesh
=
make_shared
<
TriangleMesh
>
(
is
,
sphere_colo
);
auto
mesh
=
make_shared
<
TriangleMesh
>
(
is
,
sphere_colo
);
cout
<<
"triangles: "
<<
mesh
->
triangles
.
size
()
<<
endl
;
cout
<<
"leaves: "
<<
mesh
->
leaves
.
size
()
<<
endl
;
cout
<<
"hierarchy: "
<<
mesh
->
hierarchy
.
size
()
<<
endl
;
for
(
auto
hier
:
mesh
->
hierarchy
)
{
cout
<<
"{"
<<
hier
.
left
<<
" "
<<
hier
.
right
<<
" "
<<
hier
.
leaves_i
<<
" "
<<
hier
.
leaves_size
<<
"}"
<<
endl
;
}
shape_group
.
add
(
ShapeSingleGroup
(
ident
,
mesh
));
shape_group
.
add
(
ShapeSingleGroup
(
ident
,
mesh
));
/*for (auto pos : mesh->vertices) {
/*for (auto pos : mesh->vertices) {
std::cout << pos.position << std::endl;
std::cout << pos.position << std::endl;
...
@@ -92,13 +100,13 @@ int main() {
...
@@ -92,13 +100,13 @@ int main() {
std
::
vector
<
std
::
shared_ptr
<
Light
>>
lights
=
{
lightGroup
};
std
::
vector
<
std
::
shared_ptr
<
Light
>>
lights
=
{
lightGroup
};
auto
sc
=
std
::
make_shared
<
Scene
>
(
Scene
(
group
,
lights
,
obs
,
8
));
auto
sc
=
std
::
make_shared
<
Scene
>
(
Scene
(
group
,
lights
,
obs
,
8
));
size_t
n
=
3
;
size_t
n
=
1
;
clock_t
clkStart
;
clock_t
clkStart
;
clock_t
clkFinish
;
clock_t
clkFinish
;
cout
<<
"Start render"
<<
endl
;
cout
<<
"Start render"
<<
endl
;
clkStart
=
clock
();
clkStart
=
clock
();
Image
img
=
raytrace
(
4
,
obs
,
sc
,
n
*
n
);
Image
img
=
raytrace
(
1
,
obs
,
sc
,
n
*
n
);
clkFinish
=
clock
();
clkFinish
=
clock
();
cout
<<
"Start imaging"
<<
endl
;
cout
<<
"Start imaging"
<<
endl
;
writeBmp
(
"results/aaa.bmp"
,
img
);
writeBmp
(
"results/aaa.bmp"
,
img
);
...
@@ -112,7 +120,7 @@ int main() {
...
@@ -112,7 +120,7 @@ int main() {
// test::shape_test();
// test::shape_test();
test
::
axisalignedboundingbox_test
();
test
::
axisalignedboundingbox_test
();
}
else
{
}
else
{
std
::
ifstream
is
(
"
Cube
.obj"
);
std
::
ifstream
is
(
"
Tower_Top
.obj"
);
TriangleMesh
mesh
(
is
,
nullptr
);
TriangleMesh
mesh
(
is
,
nullptr
);
cout
<<
"triangles: "
<<
mesh
.
triangles
.
size
()
<<
endl
;
cout
<<
"triangles: "
<<
mesh
.
triangles
.
size
()
<<
endl
;
cout
<<
"leaves: "
<<
mesh
.
leaves
.
size
()
<<
endl
;
cout
<<
"leaves: "
<<
mesh
.
leaves
.
size
()
<<
endl
;
...
...
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