Blender V5.3
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
8
9#pragma once
10
12
13#include "DNA_node_types.h"
14
15namespace blender {
16
17struct Material;
18
19namespace io::obj {
20
34extern const char *tex_map_type_to_socket_id[];
35
36struct MTLTexMap {
37 bool is_valid() const
38 {
39 return !image_path.empty();
40 }
41
42 /* Target socket which this texture node connects to. */
45 /* Only Flat and Sphere projections are supported. */
47 std::string image_path;
48 std::string mtl_dir_path;
49};
50
56 {
57 return texture_maps[int(key)];
58 }
60 {
61 return texture_maps[int(key)];
62 }
63
64 std::string name;
65 /* Always check for negative values while importing or exporting. Use defaults if
66 * any value is negative. */
67 float spec_exponent{-1.0f}; /* `Ns` */
68 float3 ambient_color{-1.0f}; /* `Ka` */
69 float3 color{-1.0f}; /* `Kd` */
70 float3 spec_color{-1.0f}; /* `Ks` */
71 float3 emission_color{-1.0f}; /* `Ke` */
72 float ior{-1.0f}; /* `Ni` */
73 float alpha{-1.0f}; /* `d` */
74 float3 transmit_color{-1.0f}; /* `Kt` / `Tf` */
75 float roughness{-1.0f}; /* `Pr` */
76 float metallic{-1.0f}; /* `Pm` */
77 float sheen{-1.0f}; /* `Ps` */
78 float cc_thickness{-1.0f}; /* `Pc` */
79 float cc_roughness{-1.0f}; /* `Pcr` */
80 float aniso{-1.0f}; /* `aniso` */
81 float aniso_rot{-1.0f}; /* `anisor` */
82
83 int illum_mode{-1};
85 /* Only used for Normal Map node: `map_Bump`. */
86 float normal_strength{-1.0f};
87};
88
89MTLMaterial mtlmaterial_for_material(const Material *material);
90} // namespace io::obj
91} // namespace blender
const char * tex_map_type_to_socket_id[]
MTLMaterial mtlmaterial_for_material(const Material *material)
BMesh Iterators.
VecBase< float, 3 > float3
MTLTexMap & tex_map_of_type(MTLTexMapType key)
const MTLTexMap & tex_map_of_type(MTLTexMapType key) const
MTLTexMap texture_maps[int(MTLTexMapType::Count)]