Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
U
uva
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Taddeüs Kroes
uva
Commits
58f4aefb
Commit
58f4aefb
authored
Nov 11, 2010
by
Sander Mathijs van Veen
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
ssh://vo20.nl/git/uva
parents
5d2d6f63
20795120
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
12 deletions
+38
-12
graphics/ass7/.gitignore
graphics/ass7/.gitignore
+1
-0
graphics/ass7/main
graphics/ass7/main
+0
-0
graphics/ass7/main.c
graphics/ass7/main.c
+37
-12
No files found.
graphics/ass7/.gitignore
0 → 100644
View file @
58f4aefb
main
graphics/ass7/main
deleted
100755 → 0
View file @
5d2d6f63
File deleted
graphics/ass7/main.c
View file @
58f4aefb
...
@@ -158,9 +158,9 @@ void
...
@@ -158,9 +158,9 @@ void
ray_trace
(
void
)
ray_trace
(
void
)
{
{
vec3
forward_vector
,
right_vector
,
up_vector
;
vec3
forward_vector
,
right_vector
,
up_vector
;
int
i
,
j
;
int
i
,
j
,
k
,
l
;
vec3
right_step
,
down_step
;
vec3
right_step
,
down_step
;
float
image_plane_width
,
image_plane_height
;
float
image_plane_width
,
image_plane_height
,
diff
[
2
]
=
{
0
.
25
,
0
.
75
}
;
vec3
image_plane_topleft
,
image_plane_point
;
vec3
image_plane_topleft
,
image_plane_point
;
vec3
ray_direction
;
vec3
ray_direction
;
vec3
color
;
vec3
color
;
...
@@ -203,16 +203,41 @@ ray_trace(void)
...
@@ -203,16 +203,41 @@ ray_trace(void)
{
{
for
(
i
=
0
;
i
<
framebuffer_width
;
i
++
)
for
(
i
=
0
;
i
<
framebuffer_width
;
i
++
)
{
{
// Compute corresponding point on image plane
if
(
do_antialiasing
)
image_plane_point
=
v3_add
(
image_plane_topleft
,
v3_multiply
(
right_step
,
i
+
0
.
5
));
{
image_plane_point
=
v3_add
(
image_plane_point
,
v3_multiply
(
down_step
,
j
+
0
.
5
));
color
.
x
=
color
.
y
=
color
.
z
=
0
;
// Compute direction for shooting the ray
for
(
k
=
0
;
k
<
2
;
k
++
)
ray_direction
=
v3_subtract
(
image_plane_point
,
scene_camera_position
);
{
for
(
l
=
0
;
l
<
2
;
l
++
)
// Determine ray color
{
color
=
ray_color
(
0
,
scene_camera_position
,
ray_direction
);
// Compute corresponding point on image plane
image_plane_point
=
v3_add
(
image_plane_topleft
,
v3_multiply
(
right_step
,
i
+
diff
[
k
]));
image_plane_point
=
v3_add
(
image_plane_point
,
v3_multiply
(
down_step
,
j
+
diff
[
l
]));
// Compute direction for shooting the ray
ray_direction
=
v3_subtract
(
image_plane_point
,
scene_camera_position
);
// Determine ray color
color
=
v3_add
(
color
,
ray_color
(
0
,
scene_camera_position
,
ray_direction
));
}
}
color
=
v3_multiply
(
color
,
0
.
25
);
}
else
{
// Compute corresponding point on image plane
image_plane_point
=
v3_add
(
image_plane_topleft
,
v3_multiply
(
right_step
,
i
+
0
.
5
));
image_plane_point
=
v3_add
(
image_plane_point
,
v3_multiply
(
down_step
,
j
+
0
.
5
));
// Compute direction for shooting the ray
ray_direction
=
v3_subtract
(
image_plane_point
,
scene_camera_position
);
// Determine ray color
color
=
ray_color
(
0
,
scene_camera_position
,
ray_direction
);
}
// Output pixel color
// Output pixel color
put_pixel
(
i
,
j
,
color
.
x
,
color
.
y
,
color
.
z
);
put_pixel
(
i
,
j
,
color
.
x
,
color
.
y
,
color
.
z
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment