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:
Nathan Letwory 2011-09-12 13:20:24 +00:00
parent e16ba13251
commit 1dcf9c636c
2 changed files with 6 additions and 1 deletions

@ -37,6 +37,7 @@
#include "DNA_mesh_types.h"
#include "DNA_texture_types.h"
#include "DNA_world_types.h"
#include "BKE_customdata.h"
@ -81,6 +82,7 @@ bool EffectsExporter::hasEffects(Scene *sce)
void EffectsExporter::exportEffects(Scene *sce)
{
if(hasEffects(sce)) {
this->scene = sce;
openLibrary();
MaterialFunctor mf;
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");
// 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");
// reflective, reflectivity

@ -70,6 +70,8 @@ private:
bool hasEffects(Scene *sce);
const ExportSettings *export_settings;
Scene *scene;
};
#endif