From 1dcf9c636ce3eef99279925c3ea87a34c46ec7c4 Mon Sep 17 00:00:00 2001 From: Nathan Letwory Date: Mon, 12 Sep 2011 13:20:24 +0000 Subject: [PATCH] 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. --- source/blender/collada/EffectExporter.cpp | 5 ++++- source/blender/collada/EffectExporter.h | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/source/blender/collada/EffectExporter.cpp b/source/blender/collada/EffectExporter.cpp index ed37dada195..b4cc88ee3b8 100644 --- a/source/blender/collada/EffectExporter.cpp +++ b/source/blender/collada/EffectExporter.cpp @@ -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(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 diff --git a/source/blender/collada/EffectExporter.h b/source/blender/collada/EffectExporter.h index dc1f4c4474b..25d7ed15bc3 100644 --- a/source/blender/collada/EffectExporter.h +++ b/source/blender/collada/EffectExporter.h @@ -70,6 +70,8 @@ private: bool hasEffects(Scene *sce); const ExportSettings *export_settings; + + Scene *scene; }; #endif