Blender V4.3
Materials.h
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
5#pragma once
6
7#include <map>
8#include <string>
9
10#include "BKE_context.hh"
11#include "BKE_node.hh"
12#include "BLI_listbase.h"
13#include "DNA_material_types.h"
14#include "DNA_node_types.h"
15
16#include "COLLADAFWEffectCommon.h"
17#include "collada_utils.h"
18
19typedef std::map<std::string, bNode *> NodeMap;
20
22
23 private:
24 bContext *mContext;
25 Material *material;
26 COLLADAFW::EffectCommon *effect;
27 UidImageMap *uid_image_map = nullptr;
28 KeyImageMap *key_image_map = nullptr;
29
30 NodeMap node_map;
31 bNodeTree *ntree;
32
33 bNode *shader_node;
34 bNode *output_node;
35
37 bNodeTree *prepare_material_nodetree();
38 bNode *add_node(int node_type, int locx, int locy, std::string label);
39 void add_link(bNode *from_node, int from_index, bNode *to_node, int to_index);
40 void add_link(bNode *from_node, const char *from_label, bNode *to_node, const char *to_label);
41 bNode *add_texture_node(COLLADAFW::ColorOrTexture &cot, int locx, int locy, std::string label);
42 void setShaderType();
43
44 public:
45 MaterialNode(bContext *C, COLLADAFW::EffectCommon *ef, Material *ma, UidImageMap &uid_image_map);
46 MaterialNode(bContext *C, Material *ma, KeyImageMap &key_image_map);
48
49 void set_diffuse(COLLADAFW::ColorOrTexture &cot);
50 void set_specular(COLLADAFW::ColorOrTexture &cot);
51 void set_ambient(COLLADAFW::ColorOrTexture &cot);
52 void set_reflective(COLLADAFW::ColorOrTexture &cot);
53 void set_emission(COLLADAFW::ColorOrTexture &cot);
54 void set_opacity(COLLADAFW::ColorOrTexture &cot);
55 void set_reflectivity(COLLADAFW::FloatOrParam &val);
56 void set_shininess(COLLADAFW::FloatOrParam &val);
57 void set_ior(COLLADAFW::FloatOrParam &val);
58 void set_alpha(COLLADAFW::EffectCommon::OpaqueMode mode,
59 COLLADAFW::ColorOrTexture &cot,
60 COLLADAFW::FloatOrParam &val);
61
63};
std::map< std::string, bNode * > NodeMap
Definition Materials.h:19
void set_reflectivity(COLLADAFW::FloatOrParam &val)
void set_shininess(COLLADAFW::FloatOrParam &val)
void set_specular(COLLADAFW::ColorOrTexture &cot)
void update_material_nodetree()
void set_ior(COLLADAFW::FloatOrParam &val)
void set_reflective(COLLADAFW::ColorOrTexture &cot)
void set_emission(COLLADAFW::ColorOrTexture &cot)
Image * get_diffuse_image()
MaterialNode(bContext *C, COLLADAFW::EffectCommon *ef, Material *ma, UidImageMap &uid_image_map)
Definition Materials.cpp:24
void set_opacity(COLLADAFW::ColorOrTexture &cot)
void set_alpha(COLLADAFW::EffectCommon::OpaqueMode mode, COLLADAFW::ColorOrTexture &cot, COLLADAFW::FloatOrParam &val)
void set_diffuse(COLLADAFW::ColorOrTexture &cot)
void set_ambient(COLLADAFW::ColorOrTexture &cot)
std::map< std::string, Image * > KeyImageMap
std::map< COLLADAFW::UniqueId, Image * > UidImageMap
const char * label