Skip to content
Snippets Groups Projects
Commit cbe1993b authored by Yoel's avatar Yoel
Browse files

ShapeSingleGroup refactor: Everything works

parent 6e7017d9
No related branches found
No related tags found
No related merge requests found
...@@ -28,11 +28,15 @@ std::optional<cam::Hit> ShapeSingleGroup::intersect(const cam::Ray& r) const { ...@@ -28,11 +28,15 @@ std::optional<cam::Hit> ShapeSingleGroup::intersect(const cam::Ray& r) const {
if (result) { if (result) {
result = std::optional<cam::Hit>( result = std::optional<cam::Hit>(
{transform.toWorld.transformPoint(result->point()), {transform.toWorld.transformPoint(result->point()),
transform.toWorldN.transformDir(result->normal()), transform.toWorldN.transformDir(result->normal()), result->texel(),
result->scalar(), result->material}); result->scalar(), result->material});
} }
return result; return result;
} }
std::pair<float, float> ShapeSingleGroup::texture_coordinates(
const util::Vec3& pos) const {
return std::pair<float, float>({0, 0});
}
util::AxisAlignedBoundingBox ShapeSingleGroup::bounds() const { util::AxisAlignedBoundingBox ShapeSingleGroup::bounds() const {
return boundingVolume; return boundingVolume;
} }
......
...@@ -12,6 +12,8 @@ class ShapeSingleGroup : public Shape { ...@@ -12,6 +12,8 @@ class ShapeSingleGroup : public Shape {
ShapeSingleGroup(const util::Mat4& matrix, std::shared_ptr<Shape> shape); ShapeSingleGroup(const util::Mat4& matrix, std::shared_ptr<Shape> shape);
std::optional<cam::Hit> intersect(const cam::Ray& r) const override; std::optional<cam::Hit> intersect(const cam::Ray& r) const override;
std::pair<float, float> texture_coordinates(
const util::Vec3& pos) const override;
util::AxisAlignedBoundingBox bounds() const override; util::AxisAlignedBoundingBox bounds() const override;
private: private:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment