Merge -c 29280 from COLLADA branch into trunk.

This commit is contained in:
2010-06-06 19:32:12 +00:00
parent ce9d2b8eb4
commit 05188c26ce

View File

@@ -1578,18 +1578,27 @@ public:
else { else {
ep.setIndexOfRefraction(1.0f); ep.setIndexOfRefraction(1.0f);
} }
COLLADASW::ColorOrTexture cot;
// transparency // transparency
ep.setTransparency(ma->alpha); // Tod: because we are in A_ONE mode transparency is calculated like this:
// emission ep.setTransparency(1.0f);
COLLADASW::ColorOrTexture cot = getcol(0.0f, 0.0f, 0.0f, 1.0f); cot = getcol(0.0f, 0.0f, 0.0f, ma->alpha);
ep.setEmission(cot);
ep.setTransparent(cot); ep.setTransparent(cot);
// emission
cot=getcol(ma->emit, ma->emit, ma->emit, 1.0f);
ep.setEmission(cot);
// diffuse // diffuse
cot = getcol(ma->r, ma->g, ma->b, 1.0f); cot = getcol(ma->r, ma->g, ma->b, 1.0f);
ep.setDiffuse(cot); ep.setDiffuse(cot);
// ambient // ambient
cot = getcol(ma->ambr, ma->ambg, ma->ambb, 1.0f); cot = getcol(ma->ambr, ma->ambg, ma->ambb, 1.0f);
ep.setAmbient(cot); ep.setAmbient(cot);
// reflective, reflectivity // reflective, reflectivity
if (ma->mode & MA_RAYMIRROR) { if (ma->mode & MA_RAYMIRROR) {
cot = getcol(ma->mirr, ma->mirg, ma->mirb, 1.0f); cot = getcol(ma->mirr, ma->mirg, ma->mirb, 1.0f);
@@ -1597,15 +1606,16 @@ public:
ep.setReflectivity(ma->ray_mirror); ep.setReflectivity(ma->ray_mirror);
} }
else { else {
cot = getcol(0.0f, 0.0f, 0.0f, 1.0f); cot = getcol(ma->specr, ma->specg, ma->specb, 1.0f);
ep.setReflective(cot); ep.setReflective(cot);
ep.setReflectivity(0.0f); ep.setReflectivity(ma->spec);
} }
// specular // specular
if (ep.getShaderType() != COLLADASW::EffectProfile::LAMBERT) { if (ep.getShaderType() != COLLADASW::EffectProfile::LAMBERT) {
cot = getcol(ma->specr, ma->specg, ma->specb, 1.0f); cot = getcol(ma->specr, ma->specg, ma->specb, 1.0f);
ep.setSpecular(cot); ep.setSpecular(cot);
} }
// XXX make this more readable if possible // XXX make this more readable if possible
@@ -1714,7 +1724,19 @@ public:
} }
// performs the actual writing // performs the actual writing
ep.addProfileElements(); ep.addProfileElements();
bool twoSided = false;
if (ob->type == OB_MESH && ob->data) {
Mesh *me = (Mesh*)ob->data;
if (me->flag & ME_TWOSIDED)
twoSided = true;
}
if (twoSided)
ep.addExtraTechniqueParameter("GOOGLEEARTH", "double_sided", 1);
ep.addExtraTechniques(mSW);
ep.closeProfile(); ep.closeProfile();
if (twoSided)
mSW->appendTextBlock("<extra><technique profile=\"MAX3D\"><double_sided>1</double_sided></technique></extra>");
closeEffect(); closeEffect();
} }