erebus

diff liberebus/src/geomobj.h @ 0:4abdce1361b9

initial commit
author John Tsiombikas <nuclear@member.fsf.org>
date Sun, 27 Apr 2014 16:02:47 +0300
parents
children 474a0244f57d
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/liberebus/src/geomobj.h	Sun Apr 27 16:02:47 2014 +0300
     1.3 @@ -0,0 +1,50 @@
     1.4 +#ifndef GEOMOBJ_H_
     1.5 +#define GEOMOBJ_H_
     1.6 +
     1.7 +#include "object.h"
     1.8 +#include "brdf.h"
     1.9 +
    1.10 +class GeomObject : public Object {
    1.11 +public:
    1.12 +	Reflectance *brdf;
    1.13 +
    1.14 +	ObjType get_type() const override;
    1.15 +
    1.16 +	bool intersect(const Ray &ray, RayHit *hit = 0) const override;
    1.17 +};
    1.18 +
    1.19 +class Sphere : public GeomObject {
    1.20 +public:
    1.21 +	bool intersect(const Ray &ray, RayHit *hit = 0) const override;
    1.22 +};
    1.23 +
    1.24 +class Box : public GeomObject {
    1.25 +public:
    1.26 +	bool intersect(const Ray &ray, RayHit *hit = 0) const override;
    1.27 +};
    1.28 +
    1.29 +class Triangle : public GeomObject {
    1.30 +public:
    1.31 +	Vector3 v[3];
    1.32 +	Vector3 normal;
    1.33 +	Vector3 vnorm[3];
    1.34 +	Vector2 vtex[3];
    1.35 +
    1.36 +	bool intersect(const Ray &ray, RayHit *hit = 0) const override;
    1.37 +};
    1.38 +
    1.39 +class Mesh : public GeomObject {
    1.40 +private:
    1.41 +	std::vector<Triangle> faces;
    1.42 +
    1.43 +public:
    1.44 +	void begin();
    1.45 +	void vertex(float x, float y, float z);
    1.46 +	void normal(float x, float y, float z);
    1.47 +	void texcoord(float u, float v);
    1.48 +	void end();
    1.49 +
    1.50 +	bool intersect(const Ray &ray, RayHit *hit = 0) const override;
    1.51 +};
    1.52 +
    1.53 +#endif	// GEOMOBJ_H_
    1.54 \ No newline at end of file