Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assignment2 #3

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

katvonseggern
Copy link

No description provided.

@@ -46,6 +48,8 @@ class CScene
void add(const ptr_camera_t pCamera)
{
// --- PUT YOUR CODE HERE ---
m_vpCameras.push_back(pCamera);
m_activeCamera = m_activeCamera + 1;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is valid approach, but only in case, when you initialize m_activeCamera to be equal to -1 on construction. This also requires to have m_activeCamera variable of type int, not size_t.
How it is implemented now, it shows an error on execution.

if (pPrim->intersect(ray)) {
hit = true;
}
}
return false;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is obviously wrong. You return false all the time - so nothing can be rendered! Did you even check any results?

@@ -87,7 +105,8 @@ class CScene
Vec3f RayTrace(Ray& ray) const
{
// --- PUT YOUR CODE HERE ---
return Vec3f();
//return Vec3f();
return intersect(ray) ? ray.hit->getShader()->shade(ray) : m_bgColor;
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getShader() causes error here, because you never initialize ray.hit in the intersection algorithms

@@ -27,7 +27,44 @@ class CShaderPhong : public CShaderFlat
virtual Vec3f shade(const Ray& ray) const override
{
// --- PUT YOUR CODE HERE ---
return RGB(0, 0, 0);
//return RGB(0, 0, 0);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Phong images are too dark
No shadows are rendered

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants