Blender V4.3
EffectExporter.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
9#pragma once
10
11#include <string>
12#include <vector>
13
14#include "COLLADASWColorOrTexture.h"
15#include "COLLADASWLibraryEffects.h"
16#include "COLLADASWSampler.h"
17#include "COLLADASWStreamWriter.h"
18
19#include "DNA_image_types.h"
20#include "DNA_material_types.h"
21#include "DNA_object_types.h"
22#include "DNA_scene_types.h"
23
24#include "ExportSettings.h"
25#include "collada_utils.h"
26
27class EffectsExporter : COLLADASW::LibraryEffects {
28 public:
29 EffectsExporter(COLLADASW::StreamWriter *sw,
30 BCExportSettings &export_settings,
31 KeyImageMap &key_image_map);
32 void exportEffects(bContext *C, Scene *sce);
33
34 void operator()(Material *ma, Object *ob);
35
36 COLLADASW::ColorOrTexture createTexture(Image *ima,
37 std::string &uv_layer_name,
38 COLLADASW::Sampler *sampler
39 /*COLLADASW::Surface *surface*/);
40
41 COLLADASW::ColorOrTexture getcol(float r, float g, float b, float a);
42
43 private:
44 void set_shader_type(COLLADASW::EffectProfile &ep, Material *ma);
45
46 void set_diffuse_color(COLLADASW::EffectProfile &ep, Material *ma);
47 void set_emission(COLLADASW::EffectProfile &ep, Material *ma);
48 void set_ior(COLLADASW::EffectProfile &ep, Material *ma);
49 void set_shininess(COLLADASW::EffectProfile &ep, Material *ma);
50 void set_reflectivity(COLLADASW::EffectProfile &ep, Material *ma);
51 void set_transparency(COLLADASW::EffectProfile &ep, Material *ma);
52 void set_ambient(COLLADASW::EffectProfile &ep, Material *ma);
53 void set_specular(COLLADASW::EffectProfile &ep, Material *ma);
54 void set_reflective(COLLADASW::EffectProfile &ep, Material *ma);
55
56 void get_images(Material *ma, KeyImageMap &material_image_map);
57 void create_image_samplers(COLLADASW::EffectProfile &ep,
58 KeyImageMap &material_image_map,
59 std::string &active_uv);
60
61 void writeTextures(COLLADASW::EffectProfile &ep,
62 std::string &key,
63 COLLADASW::Sampler *sampler,
64 MTex *t,
65 Image *ima,
66 std::string &uvname);
67
68 bool hasEffects(Scene *sce);
69
70 BCExportSettings &export_settings;
71 KeyImageMap &key_image_map;
72 Scene *scene;
73 bContext *mContext;
74};
Object is a sort of wrapper for general info.
EffectsExporter(COLLADASW::StreamWriter *sw, BCExportSettings &export_settings, KeyImageMap &key_image_map)
COLLADASW::ColorOrTexture createTexture(Image *ima, std::string &uv_layer_name, COLLADASW::Sampler *sampler)
COLLADASW::ColorOrTexture getcol(float r, float g, float b, float a)
void operator()(Material *ma, Object *ob)
void exportEffects(bContext *C, Scene *sce)
std::map< std::string, Image * > KeyImageMap
local_group_size(16, 16) .push_constant(Type local_group_size(16, 16) .push_constant(Type input_tx sampler(1, ImageType::FLOAT_2D, "matte_tx") .image(0
local_group_size(16, 16) .push_constant(Type b