-
Notifications
You must be signed in to change notification settings - Fork 2
/
Primitive.h
44 lines (35 loc) · 1.08 KB
/
Primitive.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
//
// Created by lazycal on 2017/6/11.
//
#ifndef RAY_TRACING_PRIMITIVE_H
#define RAY_TRACING_PRIMITIVE_H
//#include "World.h"
#include <ostream>
#include "Collision.h"
#include "Ray.h"
#include "Picture.h"
#include "header.h"
class Primitive {
public:
static int cnt;
friend std::ostream &operator<<(std::ostream &os, const Primitive &primitive);
virtual Color getColor(const Vector3 &P);
private:
friend class World;
public:
virtual void init(){}
Color color, absor; //物品色彩、透明物品吸收的色光
int hashId, id;
double refl, refr; //反射、折射
double diff, spec; //漫反射、镜面漫反射的百分比
double rindex; //折射率
Picture texture;
virtual Collision collide(const Ray &ray) = 0;
virtual void input(const std::string &var, std::stringstream &ss);
//double BRDF(const Vector3 &N, const Vector3 &L, const Vector3 &V) const;
virtual void generateMeshes(std::vector<Vector3> &points, std::vector<int4> &meshes);
protected:
Primitive();
virtual ~Primitive();
};
#endif //RAY_TRACING_PRIMITIVE_H