Listing the "Blender Foundation" as copyright holder implied the Blender Foundation holds copyright to files which may include work from many developers. While keeping copyright on headers makes sense for isolated libraries, Blender's own code may be refactored or moved between files in a way that makes the per file copyright holders less meaningful. Copyright references to the "Blender Foundation" have been replaced with "Blender Authors", with the exception of `./extern/` since these this contains libraries which are more isolated, any changed to license headers there can be handled on a case-by-case basis. Some directories in `./intern/` have also been excluded: - `./intern/cycles/` it's own `AUTHORS` file is planned. - `./intern/opensubdiv/`. An "AUTHORS" file has been added, using the chromium projects authors file as a template. Design task: #110784 Ref !110783.
99 lines
2.2 KiB
C++
99 lines
2.2 KiB
C++
/* SPDX-FileCopyrightText: 2023 Blender Authors
|
|
*
|
|
* 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
|