Blender V4.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
9#pragma once
10
12
13#include "DNA_node_types.h"
14struct Material;
15
16namespace blender::io::obj {
17
18enum class MTLTexMapType {
19 Color = 0,
24 Sheen,
27 Alpha,
28 Normal,
29 Count
30};
31extern const char *tex_map_type_to_socket_id[];
32
33struct MTLTexMap {
34 bool is_valid() const
35 {
36 return !image_path.empty();
37 }
38
39 /* Target socket which this texture node connects to. */
41 float3 scale{1.0f};
42 /* Only Flat and Sphere projections are supported. */
44 std::string image_path;
45 std::string mtl_dir_path;
46};
47
53 {
54 return texture_maps[int(key)];
55 }
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};
82 /* Only used for Normal Map node: `map_Bump`. */
83 float normal_strength{-1.0f};
84};
85
86MTLMaterial mtlmaterial_for_material(const Material *material);
87} // namespace blender::io::obj
@ SHD_PROJ_FLAT
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
const char * tex_map_type_to_socket_id[]
MTLMaterial mtlmaterial_for_material(const Material *material)
MTLTexMap & tex_map_of_type(MTLTexMapType key)
const MTLTexMap & tex_map_of_type(MTLTexMapType key) const
MTLTexMap texture_maps[int(MTLTexMapType::Count)]