-
Notifications
You must be signed in to change notification settings - Fork 52
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
base: master
Are you sure you want to change the base?
Assignment2 #3
Conversation
@@ -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; |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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; | |||
} |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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
No description provided.