Blender
V4.3
source
blender
io
wavefront_obj
exporter
obj_export_mtl.hh
Go to the documentation of this file.
1
/* SPDX-FileCopyrightText: 2023 Blender Authors
2
*
3
* SPDX-License-Identifier: GPL-2.0-or-later */
4
9
#pragma once
10
11
#include "
BLI_math_vector_types.hh
"
12
13
#include "
DNA_node_types.h
"
14
struct
Material
;
15
16
namespace
blender::io::obj
{
17
18
enum class
MTLTexMapType
{
19
Color = 0,
20
Metallic
,
21
Specular
,
22
SpecularExponent
,
23
Roughness
,
24
Sheen
,
25
Reflection
,
26
Emission
,
27
Alpha
,
28
Normal
,
29
Count
30
};
31
extern
const
char
*
tex_map_type_to_socket_id
[];
32
33
struct
MTLTexMap
{
34
bool
is_valid
()
const
35
{
36
return
!
image_path
.empty();
37
}
38
39
/* Target socket which this texture node connects to. */
40
float3
translation
{0.0f};
41
float3
scale{1.0f};
42
/* Only Flat and Sphere projections are supported. */
43
int
projection_type
=
SHD_PROJ_FLAT
;
44
std::string
image_path
;
45
std::string
mtl_dir_path
;
46
};
47
51
struct
MTLMaterial
{
52
const
MTLTexMap
&
tex_map_of_type
(
MTLTexMapType
key)
const
53
{
54
return
texture_maps
[
int
(key)];
55
}
56
MTLTexMap
&
tex_map_of_type
(
MTLTexMapType
key)
57
{
58
return
texture_maps
[
int
(key)];
59
}
60
61
std::string
name
;
62
/* Always check for negative values while importing or exporting. Use defaults if
63
* any value is negative. */
64
float
spec_exponent
{-1.0f};
/* `Ns` */
65
float3
ambient_color
{-1.0f};
/* `Ka` */
66
float3
color{-1.0f};
/* `Kd` */
67
float3
spec_color
{-1.0f};
/* `Ks` */
68
float3
emission_color
{-1.0f};
/* `Ke` */
69
float
ior
{-1.0f};
/* `Ni` */
70
float
alpha{-1.0f};
/* `d` */
71
float3
transmit_color
{-1.0f};
/* `Kt` / `Tf` */
72
float
roughness
{-1.0f};
/* `Pr` */
73
float
metallic{-1.0f};
/* `Pm` */
74
float
sheen
{-1.0f};
/* `Ps` */
75
float
cc_thickness
{-1.0f};
/* `Pc` */
76
float
cc_roughness
{-1.0f};
/* `Pcr` */
77
float
aniso
{-1.0f};
/* `aniso` */
78
float
aniso_rot
{-1.0f};
/* `anisor` */
79
80
int
illum_mode
{-1};
81
MTLTexMap
texture_maps
[
int
(
MTLTexMapType::Count
)];
82
/* Only used for Normal Map node: `map_Bump`. */
83
float
normal_strength
{-1.0f};
84
};
85
86
MTLMaterial
mtlmaterial_for_material
(
const
Material
*material);
87
}
// namespace blender::io::obj
BLI_math_vector_types.hh
DNA_node_types.h
SHD_PROJ_FLAT
@ SHD_PROJ_FLAT
Definition
DNA_node_types.h:2392
int
draw_view push_constant(Type::INT, "radiance_src") .push_constant(Type capture_info_buf storage_buf(1, Qualifier::READ, "ObjectBounds", "bounds_buf[]") .push_constant(Type draw_view int
Definition
eevee_lightprobe_volume_info.hh:143
blender::io::obj
Definition
obj_export_file_writer.cc:31
blender::io::obj::tex_map_type_to_socket_id
const char * tex_map_type_to_socket_id[]
Definition
obj_export_mtl.cc:27
blender::io::obj::mtlmaterial_for_material
MTLMaterial mtlmaterial_for_material(const Material *material)
Definition
obj_export_mtl.cc:377
blender::io::obj::MTLTexMapType
MTLTexMapType
Definition
obj_export_mtl.hh:18
blender::io::obj::MTLTexMapType::Sheen
@ Sheen
blender::io::obj::MTLTexMapType::Metallic
@ Metallic
blender::io::obj::MTLTexMapType::Specular
@ Specular
blender::io::obj::MTLTexMapType::Alpha
@ Alpha
blender::io::obj::MTLTexMapType::SpecularExponent
@ SpecularExponent
blender::io::obj::MTLTexMapType::Roughness
@ Roughness
blender::io::obj::MTLTexMapType::Normal
@ Normal
blender::io::obj::MTLTexMapType::Reflection
@ Reflection
blender::io::obj::MTLTexMapType::Count
@ Count
blender::io::obj::MTLTexMapType::Emission
@ Emission
Material
Definition
DNA_material_types.h:164
blender::VecBase< float, 3 >
blender::io::obj::MTLMaterial
Definition
obj_export_mtl.hh:51
blender::io::obj::MTLMaterial::tex_map_of_type
MTLTexMap & tex_map_of_type(MTLTexMapType key)
Definition
obj_export_mtl.hh:56
blender::io::obj::MTLMaterial::emission_color
float3 emission_color
Definition
obj_export_mtl.hh:68
blender::io::obj::MTLMaterial::roughness
float roughness
Definition
obj_export_mtl.hh:72
blender::io::obj::MTLMaterial::aniso_rot
float aniso_rot
Definition
obj_export_mtl.hh:78
blender::io::obj::MTLMaterial::cc_roughness
float cc_roughness
Definition
obj_export_mtl.hh:76
blender::io::obj::MTLMaterial::spec_color
float3 spec_color
Definition
obj_export_mtl.hh:67
blender::io::obj::MTLMaterial::tex_map_of_type
const MTLTexMap & tex_map_of_type(MTLTexMapType key) const
Definition
obj_export_mtl.hh:52
blender::io::obj::MTLMaterial::aniso
float aniso
Definition
obj_export_mtl.hh:77
blender::io::obj::MTLMaterial::transmit_color
float3 transmit_color
Definition
obj_export_mtl.hh:71
blender::io::obj::MTLMaterial::texture_maps
MTLTexMap texture_maps[int(MTLTexMapType::Count)]
Definition
obj_export_mtl.hh:81
blender::io::obj::MTLMaterial::ambient_color
float3 ambient_color
Definition
obj_export_mtl.hh:65
blender::io::obj::MTLMaterial::normal_strength
float normal_strength
Definition
obj_export_mtl.hh:83
blender::io::obj::MTLMaterial::name
std::string name
Definition
obj_export_mtl.hh:61
blender::io::obj::MTLMaterial::sheen
float sheen
Definition
obj_export_mtl.hh:74
blender::io::obj::MTLMaterial::illum_mode
int illum_mode
Definition
obj_export_mtl.hh:80
blender::io::obj::MTLMaterial::ior
float ior
Definition
obj_export_mtl.hh:69
blender::io::obj::MTLMaterial::cc_thickness
float cc_thickness
Definition
obj_export_mtl.hh:75
blender::io::obj::MTLMaterial::spec_exponent
float spec_exponent
Definition
obj_export_mtl.hh:64
blender::io::obj::MTLTexMap
Definition
obj_export_mtl.hh:33
blender::io::obj::MTLTexMap::projection_type
int projection_type
Definition
obj_export_mtl.hh:43
blender::io::obj::MTLTexMap::image_path
std::string image_path
Definition
obj_export_mtl.hh:44
blender::io::obj::MTLTexMap::translation
float3 translation
Definition
obj_export_mtl.hh:40
blender::io::obj::MTLTexMap::mtl_dir_path
std::string mtl_dir_path
Definition
obj_export_mtl.hh:45
blender::io::obj::MTLTexMap::is_valid
bool is_valid() const
Definition
obj_export_mtl.hh:34
Generated on Thu Feb 6 2025 07:36:39 for Blender by
doxygen
1.11.0