Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGaia Clary <gaia.clary@machinimatrix.org>2015-03-05 21:33:59 +0300
committerGaia Clary <gaia.clary@machinimatrix.org>2015-03-05 21:44:23 +0300
commit37d7b2d3b620bcd9dc5d0c5e6aa99968c5bb51ef (patch)
tree5ba73cfb926acad327b655dfab9cf919365bd103 /source/blender/collada/EffectExporter.cpp
parente2d4a93a008429ecd95a65a08bb48edfc6fdd305 (diff)
Revert "COLLADA - support for shadeless material (SHADER_CONSTANT)"
This reverts commit 04b0a9f4b885e8e3b0b3207f3b3cda74b936df3e.
Diffstat (limited to 'source/blender/collada/EffectExporter.cpp')
-rw-r--r--source/blender/collada/EffectExporter.cpp73
1 files changed, 26 insertions, 47 deletions
diff --git a/source/blender/collada/EffectExporter.cpp b/source/blender/collada/EffectExporter.cpp
index f0ef0cb7c20..13dc1eda580 100644
--- a/source/blender/collada/EffectExporter.cpp
+++ b/source/blender/collada/EffectExporter.cpp
@@ -173,44 +173,37 @@ void EffectsExporter::writeTextures(COLLADASW::EffectProfile &ep,
void EffectsExporter::operator()(Material *ma, Object *ob)
{
- bool is_shadeless = ma->mode & MA_SHLESS;
// create a list of indices to textures of type TEX_IMAGE
std::vector<int> tex_indices;
if (this->export_settings->include_material_textures)
createTextureIndices(ma, tex_indices);
openEffect(translate_id(id_name(ma)) + "-effect");
-
+
COLLADASW::EffectProfile ep(mSW);
ep.setProfileType(COLLADASW::EffectProfile::COMMON);
ep.openProfile();
-
- /* set shader type */
- if (is_shadeless) {
- ep.setShaderType(COLLADASW::EffectProfile::CONSTANT);
+ // set shader type - one of three blinn, phong or lambert
+ if (ma->spec > 0.0f) {
+ if (ma->spec_shader == MA_SPEC_BLINN) {
+ writeBlinn(ep, ma);
+ }
+ else {
+ // \todo figure out handling of all spec+diff shader combos blender has, for now write phong
+ // for now set phong in case spec shader is not blinn
+ writePhong(ep, ma);
+ }
}
else {
- if (ma->spec > 0.0f) {
- if (ma->spec_shader == MA_SPEC_BLINN) {
- writeBlinn(ep, ma);
- }
- else {
- // \todo figure out handling of all spec+diff shader combos blender has, for now write phong
- // for now set phong in case spec shader is not blinn
- writePhong(ep, ma);
- }
+ if (ma->diff_shader == MA_DIFF_LAMBERT) {
+ writeLambert(ep, ma);
}
else {
- if (ma->diff_shader == MA_DIFF_LAMBERT) {
- writeLambert(ep, ma);
- }
- else {
- // \todo figure out handling of all spec+diff shader combos blender has, for now write phong
- writePhong(ep, ma);
- }
+ // \todo figure out handling of all spec+diff shader combos blender has, for now write phong
+ writePhong(ep, ma);
}
}
-
+
// index of refraction
if (ma->mode & MA_RAYTRANSP) {
ep.setIndexOfRefraction(ma->ang, false, "index_of_refraction");
@@ -223,40 +216,28 @@ void EffectsExporter::operator()(Material *ma, Object *ob)
// transparency
if (ma->mode & MA_TRANSP) {
- // Todo: because we are in A_ONE mode transparency is calculated like this:
+ // Tod: because we are in A_ONE mode transparency is calculated like this:
ep.setTransparency(ma->alpha, false, "transparency");
// cot = getcol(1.0f, 1.0f, 1.0f, 1.0f);
// ep.setTransparent(cot);
}
// emission
- if (is_shadeless) {
- cot = getcol(ma->r, ma->g, ma->b, 1.0f);
- }
- else {
- cot = getcol(ma->emit, ma->emit, ma->emit, 1.0f);
- }
+ cot = getcol(ma->emit, ma->emit, ma->emit, 1.0f);
ep.setEmission(cot, false, "emission");
// diffuse multiplied by diffuse intensity
- if (!is_shadeless) {
- cot = getcol(ma->r * ma->ref, ma->g * ma->ref, ma->b * ma->ref, 1.0f);
- ep.setDiffuse(cot, false, "diffuse");
- }
-
+ cot = getcol(ma->r * ma->ref, ma->g * ma->ref, ma->b * ma->ref, 1.0f);
+ ep.setDiffuse(cot, false, "diffuse");
// ambient
/* ma->ambX is calculated only on render, so lets do it here manually and not rely on ma->ambX. */
- if (is_shadeless)
+ if (this->scene->world)
+ cot = getcol(this->scene->world->ambr * ma->amb, this->scene->world->ambg * ma->amb, this->scene->world->ambb * ma->amb, 1.0f);
+ else
cot = getcol(ma->amb, ma->amb, ma->amb, 1.0f);
- else {
- if (this->scene->world)
- 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
if (ma->mode & MA_RAYMIRROR) {
@@ -272,10 +253,8 @@ void EffectsExporter::operator()(Material *ma, Object *ob)
// specular
if (ep.getShaderType() != COLLADASW::EffectProfile::LAMBERT) {
- if (!is_shadeless) {
- cot = getcol(ma->specr * ma->spec, ma->specg * ma->spec, ma->specb * ma->spec, 1.0f);
- ep.setSpecular(cot, false, "specular");
- }
+ cot = getcol(ma->specr * ma->spec, ma->specg * ma->spec, ma->specb * ma->spec, 1.0f);
+ ep.setSpecular(cot, false, "specular");
}
// XXX make this more readable if possible