nuclear@2: #ifndef GEOMOBJ_H_ nuclear@2: #define GEOMOBJ_H_ nuclear@2: nuclear@3: #include nuclear@2: #include "object.h" nuclear@4: #include "material.h" nuclear@2: #include "brdf.h" nuclear@2: nuclear@2: class GeomObject : public Object { nuclear@2: public: nuclear@4: Material mtl; nuclear@2: Reflectance *brdf; nuclear@2: nuclear@4: GeomObject(); nuclear@4: nuclear@2: ObjType get_type() const override; nuclear@2: nuclear@2: bool intersect(const Ray &ray, RayHit *hit = 0) const override; nuclear@2: }; nuclear@2: nuclear@2: class Sphere : public GeomObject { nuclear@2: public: nuclear@2: bool intersect(const Ray &ray, RayHit *hit = 0) const override; nuclear@2: }; nuclear@2: nuclear@2: class Box : public GeomObject { nuclear@2: public: nuclear@2: bool intersect(const Ray &ray, RayHit *hit = 0) const override; nuclear@2: }; nuclear@2: nuclear@2: class Triangle : public GeomObject { nuclear@2: public: nuclear@2: Vector3 v[3]; nuclear@2: Vector3 normal; nuclear@2: Vector3 vnorm[3]; nuclear@2: Vector2 vtex[3]; nuclear@2: nuclear@2: bool intersect(const Ray &ray, RayHit *hit = 0) const override; nuclear@2: }; nuclear@2: nuclear@2: class Mesh : public GeomObject { nuclear@2: private: nuclear@2: std::vector faces; nuclear@2: nuclear@2: public: nuclear@2: void begin(); nuclear@2: void vertex(float x, float y, float z); nuclear@2: void normal(float x, float y, float z); nuclear@2: void texcoord(float u, float v); nuclear@2: void end(); nuclear@2: nuclear@2: bool intersect(const Ray &ray, RayHit *hit = 0) const override; nuclear@2: }; nuclear@2: nuclear@2: #endif // GEOMOBJ_H_