blob: 56f0c3accee889fc19be881756461ea0fa0d38d3 (
plain)
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
|
/* SPDX-License-Identifier: GPL-2.0-or-later */
#include "BLI_assert.h"
#include "DNA_object_types.h"
#include "DNA_view3d_enums.h"
namespace blender::workbench {
enum class eGeometryType {
MESH = 0,
CURVES,
POINTCLOUD,
};
static constexpr int geometry_type_len = static_cast<int>(eGeometryType::POINTCLOUD) + 1;
static inline const char *get_name(eGeometryType type)
{
switch (type) {
case eGeometryType::MESH:
return "Mesh";
case eGeometryType::CURVES:
return "Curves";
case eGeometryType::POINTCLOUD:
return "PointCloud";
default:
BLI_assert_unreachable();
return "";
}
}
static inline eGeometryType geometry_type_from_object(Object *ob)
{
switch (ob->type) {
case OB_CURVES:
return eGeometryType::CURVES;
case OB_POINTCLOUD:
return eGeometryType::POINTCLOUD;
default:
return eGeometryType::MESH;
}
}
enum class ePipelineType {
OPAQUE = 0,
TRANSPARENT,
SHADOW,
};
static constexpr int pipeline_type_len = static_cast<int>(ePipelineType::SHADOW) + 1;
enum class eLightingType {
FLAT = 0,
STUDIO,
MATCAP,
};
static constexpr int lighting_type_len = static_cast<int>(eLightingType::MATCAP) + 1;
static inline eLightingType lighting_type_from_v3d_lighting(char lighting)
{
switch (lighting) {
case V3D_LIGHTING_FLAT:
return eLightingType::FLAT;
case V3D_LIGHTING_MATCAP:
return eLightingType::MATCAP;
case V3D_LIGHTING_STUDIO:
return eLightingType::STUDIO;
default:
BLI_assert_unreachable();
return static_cast<eLightingType>(-1);
}
}
enum class eShaderType {
MATERIAL = 0,
TEXTURE,
};
static constexpr int shader_type_len = static_cast<int>(eShaderType::TEXTURE) + 1;
static inline eShaderType shader_type_from_v3d_shading(char shading)
{
return shading == V3D_SHADING_TEXTURE_COLOR ? eShaderType::TEXTURE : eShaderType::MATERIAL;
}
static inline const char *get_name(eShaderType type)
{
switch (type) {
case eShaderType::MATERIAL:
return "Material";
case eShaderType::TEXTURE:
return "Texture";
default:
BLI_assert_unreachable();
return "";
}
}
} // namespace blender::workbench
|