Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
CG_Assignments
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
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
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Dominik Waigum
CG_Assignments
Commits
14e1b579
Commit
14e1b579
authored
Dec 4, 2023
by
DESKTOP-4VVM4VC\Dominik
Browse files
Options
Downloads
Patches
Plain Diff
Changed minor details to make code more readable
parent
5b46ac7c
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
assignment01/assignment.cc
+8
-7
8 additions, 7 deletions
assignment01/assignment.cc
with
8 additions
and
7 deletions
assignment01/assignment.cc
+
8
−
7
View file @
14e1b579
...
@@ -44,6 +44,7 @@ float evaluateF(const glm::vec2& p1, const glm::vec2& p2, const glm::vec2& p)
...
@@ -44,6 +44,7 @@ float evaluateF(const glm::vec2& p1, const glm::vec2& p2, const glm::vec2& p)
// Add your code here:
// Add your code here:
// ====================================================================
// ====================================================================
glm
::
vec2
difference
=
p2
-
p1
;
glm
::
vec2
difference
=
p2
-
p1
;
// Where in the lecture does the -dy*x stuff happen???
float
valueF
=
difference
.
y
*
p
.
x
-
difference
.
x
*
p
.
y
-
difference
.
y
*
p1
.
x
+
difference
.
x
*
p1
.
y
;
float
valueF
=
difference
.
y
*
p
.
x
-
difference
.
x
*
p
.
y
-
difference
.
y
*
p1
.
x
+
difference
.
x
*
p1
.
y
;
return
valueF
;
return
valueF
;
...
@@ -82,10 +83,10 @@ void drawTriangle(const glm::vec4& p0_in, const glm::vec4& p1_in, const glm::vec
...
@@ -82,10 +83,10 @@ void drawTriangle(const glm::vec4& p0_in, const glm::vec4& p1_in, const glm::vec
// Bounding box computed by using the minima (maxima) of the different points.
// Bounding box computed by using the minima (maxima) of the different points.
// min/max(0,...) prevents value from being outside window.
// min/max(0,...) prevents value from being outside window.
minX
=
std
::
max
(
0.f
,
std
::
min
(
p0_in
.
x
,
std
::
min
(
p1_in
.
x
,
p2_in
.
x
)
));
minX
=
std
::
max
(
0.f
,
std
::
min
(
{
p0_in
.
x
,
p1_in
.
x
,
p2_in
.
x
}
));
maxX
=
std
::
min
(
static_cast
<
float
>
(
windowWidth
),
std
::
max
(
p0_in
.
x
,
std
::
max
(
p1_in
.
x
,
p2_in
.
x
)
));
maxX
=
std
::
min
(
static_cast
<
float
>
(
windowWidth
),
std
::
max
(
{
p0_in
.
x
,
p1_in
.
x
,
p2_in
.
x
}
));
minY
=
std
::
max
(
0.f
,
std
::
min
(
p0_in
.
y
,
std
::
min
(
p1_in
.
y
,
p2_in
.
y
)
));
minY
=
std
::
max
(
0.f
,
std
::
min
(
{
p0_in
.
y
,
p1_in
.
y
,
p2_in
.
y
}
));
maxY
=
std
::
min
(
static_cast
<
float
>
(
windowHeight
),
std
::
max
(
p0_in
.
y
,
std
::
max
(
p1_in
.
y
,
p2_in
.
y
)
));
maxY
=
std
::
min
(
static_cast
<
float
>
(
windowHeight
),
std
::
max
(
{
p0_in
.
y
,
p1_in
.
y
,
p2_in
.
y
}
));
// ====================================================================
// ====================================================================
// End Exercise code
// End Exercise code
...
@@ -157,11 +158,11 @@ void task::drawScene(int _scene, float _runTime)
...
@@ -157,11 +158,11 @@ void task::drawScene(int _scene, float _runTime)
// Assignment section e
// Assignment section e
// Add your code here:
// Add your code here:
// ====================================================================
// ====================================================================
for
(
int
i
=
0
;
i
<
windowWidth
;
i
++
)
for
(
int
x
=
0
;
x
<
windowWidth
;
x
++
)
{
{
for
(
int
j
=
0
;
j
<
windowHeight
;
j
++
)
for
(
int
y
=
0
;
y
<
windowHeight
;
y
++
)
{
{
setPixel
(
i
,
j
,
glm
::
vec3
(
0.f
));
setPixel
(
x
,
y
,
glm
::
vec3
(
0.f
));
}
}
}
}
// ====================================================================
// ====================================================================
...
...
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