forked from bartvdbraak/blender
Fix [#28614] Collada Exporter does not export Ambient term
reported by Steiner Bernhard ma->ambX is calculated only on a render, so instead of relying on those values compute them manually.
This commit is contained in:
parent
e16ba13251
commit
1dcf9c636c
@ -37,6 +37,7 @@
|
|||||||
|
|
||||||
#include "DNA_mesh_types.h"
|
#include "DNA_mesh_types.h"
|
||||||
#include "DNA_texture_types.h"
|
#include "DNA_texture_types.h"
|
||||||
|
#include "DNA_world_types.h"
|
||||||
|
|
||||||
#include "BKE_customdata.h"
|
#include "BKE_customdata.h"
|
||||||
|
|
||||||
@ -81,6 +82,7 @@ bool EffectsExporter::hasEffects(Scene *sce)
|
|||||||
void EffectsExporter::exportEffects(Scene *sce)
|
void EffectsExporter::exportEffects(Scene *sce)
|
||||||
{
|
{
|
||||||
if(hasEffects(sce)) {
|
if(hasEffects(sce)) {
|
||||||
|
this->scene = sce;
|
||||||
openLibrary();
|
openLibrary();
|
||||||
MaterialFunctor mf;
|
MaterialFunctor mf;
|
||||||
mf.forEachMaterialInScene<EffectsExporter>(sce, *this, this->export_settings->selected);
|
mf.forEachMaterialInScene<EffectsExporter>(sce, *this, this->export_settings->selected);
|
||||||
@ -175,7 +177,8 @@ void EffectsExporter::operator()(Material *ma, Object *ob)
|
|||||||
ep.setDiffuse(cot, false , "diffuse");
|
ep.setDiffuse(cot, false , "diffuse");
|
||||||
|
|
||||||
// ambient
|
// ambient
|
||||||
cot = getcol(ma->ambr, ma->ambg, ma->ambb, 1.0f);
|
/* ma->ambX is calculated only on render, so lets do it here manually and not rely on ma->ambX. */
|
||||||
|
cot = getcol(this->scene->world->ambr*ma->amb, this->scene->world->ambg*ma->amb, this->scene->world->ambb*ma->amb, 1.0f);
|
||||||
ep.setAmbient(cot, false , "ambient");
|
ep.setAmbient(cot, false , "ambient");
|
||||||
|
|
||||||
// reflective, reflectivity
|
// reflective, reflectivity
|
||||||
|
@ -70,6 +70,8 @@ private:
|
|||||||
bool hasEffects(Scene *sce);
|
bool hasEffects(Scene *sce);
|
||||||
|
|
||||||
const ExportSettings *export_settings;
|
const ExportSettings *export_settings;
|
||||||
|
|
||||||
|
Scene *scene;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user