Skip to content
Snippets Groups Projects
Commit 14e1b579 authored by DESKTOP-4VVM4VC\Dominik's avatar DESKTOP-4VVM4VC\Dominik
Browse files

Changed minor details to make code more readable

parent 5b46ac7c
No related branches found
No related tags found
No related merge requests found
...@@ -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));
} }
} }
// ==================================================================== // ====================================================================
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment