-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtexture.h
More file actions
56 lines (46 loc) · 971 Bytes
/
texture.h
File metadata and controls
56 lines (46 loc) · 971 Bytes
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
45
46
47
48
49
50
51
52
53
54
55
56
#ifndef RAYTRACINGWEEKEND_TEXTURE_H
#define RAYTRACINGWEEKEND_TEXTURE_H
#include "color.h"
#include "vec3.h"
enum texture_type
{
Color,
Image,
Perlin,
UV,
Checker
};
[[nodiscard]] inline std::string texture_get_human_type(texture_type type)
{
switch (type)
{
case Color:
return "Solid color";
case Image:
return "Image texture";
case Perlin:
return "Perlin noise";
case UV:
return "UV (DEBUG)";
case Checker:
return "Checker pattern";
}
return "Unknown";
}
class texture
{
public:
std::string name;
virtual ~texture() = default;
virtual color value(double u, double v, const point3& p) const = 0;
/// UI: Displays texture-specific inspector UI
///
/// Returns: True if mat is modified
virtual bool inspector_ui(viewport& _viewport, scene& _scene) {return false;}
virtual texture_type get_type() const = 0;
std::string get_human_type()
{
return texture_get_human_type(get_type());
}
};
#endif //RAYTRACINGWEEKEND_TEXTURE_H