Error output:
C2065 : 'Shape':undeclared identifier | file: Scene.h
I searched around for an hour and I can't seem to solve this basic error. I'm lost a this point. I'm sure It's something basic and I'm going to get -1 for it, but I really don't see the problem.
Scene.h
#pragma once
#include <vector>
#include <memory>
#include "Shape.h"
class Scene {
protected:
std::vector<std::unique_ptr<Shape>> m_shape_ptrs; // <<<<< HERE
//std::vector<std::shared_ptr<Light>> m_light_ptrs;
public:
inline Shape& get_shape(int i) { return *m_shape_ptrs[i].get(); }
std::pair<Shape*, float> intersect(const Ray& ray) const;
};
Shape.h
#pragma once
#include "Ray.h"
#include "Vector.h"
#include "Material.h"
class Shape {
public:
Material material;
virtual float intersect(const Ray& ray) const = 0;
virtual Vec3f get_normal(const Vec3f& p) const = 0;
};
Material.h
#pragma once
#include "bitmap.hpp"
#include "Renderer.h"
#include "Shape.h" // <<< HERE IT IS A CIRCULAR DEPENDENCY
#include "Ray.h"
class Material {
public:
enum class TYPE : unsigned char
{
NULL_MATERIAL = 0,
MIRROR,
TRANSPARENT,
PHONG,
DIFFUSE
};
TYPE type;
rgb_t get_color(const Shape& shape, const Ray& incident, const Renderer& renderer) const;
};