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