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:
authorTon Roosendaal <ton@blender.org>2018-04-19 18:34:44 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2018-04-19 18:35:25 +0300
commit51b796ff1528c52cc8b4079fab1003671652a4d9 (patch)
tree0dfc2d2dabe5e77959264f5b6667897569290a41 /source/blender/collada/EffectExporter.cpp
parent785e8a636a293941a4295e669cb5aeecfafae039 (diff)
Remove Blender Internal and legacy viewport from Blender 2.8.
Brecht authored this commit, but he gave me the honours to actually do it. Here it goes; Blender Internal. Bye bye, you did great! * Point density, voxel data, ocean, environment map textures were removed, as these only worked within BI rendering. Note that the ocean modifier and the Cycles point density shader node continue to work. * Dynamic paint using material shading was removed, as this only worked with BI. If we ever wanted to support this again probably it should go through the baking API. * GPU shader export through the Python API was removed. This only worked for the old BI GLSL shaders, which no longer exists. Doing something similar for Eevee would be significantly more complicated because it uses a lot of multiplass rendering and logic outside the shader, it's probably impractical. * Collada material import / export code is mostly gone, as it only worked for BI materials. We need to add Cycles / Eevee material support at some point. * The mesh noise operator was removed since it only worked with BI material texture slots. A displacement modifier can be used instead. * The delete texture paint slot operator was removed since it only worked for BI material texture slots. Could be added back with node support. * Not all legacy viewport features are supported in the new viewport, but their code was removed. If we need to bring anything back we can look at older git revisions. * There is some legacy viewport code that I could not remove yet, and some that I probably missed. * Shader node execution code was left mostly intact, even though it is not used anywhere now. We may eventually use this to replace the texture nodes with Cycles / Eevee shader nodes. * The Cycles Bake panel now includes settings for baking multires normal and displacement maps. The underlying code needs to be merged properly, and we plan to add back support for multires AO baking and add support to Cycles baking for features like vertex color, displacement, and other missing baking features. * This commit removes DNA and the Python API for BI material, lamp, world and scene settings. This breaks a lot of addons. * There is more DNA that can be removed or renamed, where Cycles or Eevee are reusing some old BI properties but the names are not really correct anymore. * Texture slots for materials, lamps and world were removed. They remain for brushes, particles and freestyle linestyles. * 'BLENDER_RENDER' remains in the COMPAT_ENGINES of UI panels. Cycles and other renderers use this to find all panels to show, minus a few panels that they have their own replacement for.
Diffstat (limited to 'source/blender/collada/EffectExporter.cpp')
-rw-r--r--source/blender/collada/EffectExporter.cpp157
1 files changed, 11 insertions, 146 deletions
diff --git a/source/blender/collada/EffectExporter.cpp b/source/blender/collada/EffectExporter.cpp
index 66f3f81f71f..dbcdfd01a9c 100644
--- a/source/blender/collada/EffectExporter.cpp
+++ b/source/blender/collada/EffectExporter.cpp
@@ -41,7 +41,6 @@
extern "C" {
#include "DNA_mesh_types.h"
- #include "DNA_texture_types.h"
#include "DNA_world_types.h"
#include "BKE_collection.h"
@@ -95,128 +94,27 @@ void EffectsExporter::exportEffects(Scene *sce)
}
}
-void EffectsExporter::writeBlinn(COLLADASW::EffectProfile &ep, Material *ma)
-{
- COLLADASW::ColorOrTexture cot;
- ep.setShaderType(COLLADASW::EffectProfile::BLINN);
- // shininess
- ep.setShininess(ma->har, false, "shininess");
- // specular
- cot = getcol(ma->specr, ma->specg, ma->specb, 1.0f);
- ep.setSpecular(cot, false, "specular");
-}
-
void EffectsExporter::writeLambert(COLLADASW::EffectProfile &ep, Material *ma)
{
COLLADASW::ColorOrTexture cot;
ep.setShaderType(COLLADASW::EffectProfile::LAMBERT);
}
-void EffectsExporter::writePhong(COLLADASW::EffectProfile &ep, Material *ma)
-{
- COLLADASW::ColorOrTexture cot;
- ep.setShaderType(COLLADASW::EffectProfile::PHONG);
- // shininess
- ep.setShininess(ma->har, false, "shininess");
- // specular
- cot = getcol(ma->specr, ma->specg, ma->specb, 1.0f);
- ep.setSpecular(cot, false, "specular");
-}
-
-void EffectsExporter::writeTextures(
- COLLADASW::EffectProfile &ep,
- std::string &key,
- COLLADASW::Sampler *sampler,
- MTex *t, Image *ima,
- std::string &uvname )
-{
- // Image not set for texture
- if (!ima) return;
-
- // color
- if (t->mapto & MAP_COL) {
- ep.setDiffuse(createTexture(ima, uvname, sampler), false, "diffuse");
- }
- // ambient
- if (t->mapto & MAP_AMB) {
- ep.setAmbient(createTexture(ima, uvname, sampler), false, "ambient");
- }
- // specular
- if (t->mapto & (MAP_SPEC | MAP_COLSPEC)) {
- ep.setSpecular(createTexture(ima, uvname, sampler), false, "specular");
- }
- // emission
- if (t->mapto & MAP_EMIT) {
- ep.setEmission(createTexture(ima, uvname, sampler), false, "emission");
- }
- // reflective
- if (t->mapto & MAP_REF) {
- ep.setReflective(createTexture(ima, uvname, sampler));
- }
- // alpha
- if (t->mapto & MAP_ALPHA) {
- ep.setTransparent(createTexture(ima, uvname, sampler));
- }
- // extension:
- // Normal map --> Must be stored with <extra> tag as different technique,
- // since COLLADA doesn't support normal maps, even in current COLLADA 1.5.
- if (t->mapto & MAP_NORM) {
- COLLADASW::Texture texture(key);
- texture.setTexcoord(uvname);
- texture.setSampler(*sampler);
- // technique FCOLLADA, with the <bump> tag, is most likely the best understood,
- // most widespread de-facto standard.
- texture.setProfileName("FCOLLADA");
- texture.setChildElementName("bump");
- ep.addExtraTechniqueColorOrTexture(COLLADASW::ColorOrTexture(texture));
- }
-}
-
void EffectsExporter::operator()(Material *ma, Object *ob)
{
- // 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);
+ // TODO: add back texture and extended material parameter support
openEffect(translate_id(id_name(ma)) + "-effect");
COLLADASW::EffectProfile ep(mSW);
ep.setProfileType(COLLADASW::EffectProfile::COMMON);
ep.openProfile();
- // 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->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);
- }
- }
+ writeLambert(ep, ma);
- // index of refraction
- if (ma->mode & MA_RAYTRANSP) {
- ep.setIndexOfRefraction(ma->ang, false, "index_of_refraction");
- }
- else {
- ep.setIndexOfRefraction(1.0f, false, "index_of_refraction");
- }
-
COLLADASW::ColorOrTexture cot;
// transparency
- if (ma->mode & MA_TRANSP) {
+ if (ma->alpha != 1.0f) {
// Tod: because we are in A_ONE mode transparency is calculated like this:
cot = getcol(1.0f, 1.0f, 1.0f, ma->alpha);
ep.setTransparent(cot);
@@ -224,34 +122,14 @@ void EffectsExporter::operator()(Material *ma, Object *ob)
}
// emission
+#if 0
cot = getcol(ma->emit, ma->emit, ma->emit, 1.0f);
- ep.setEmission(cot, false, "emission");
+#endif
- // diffuse multiplied by diffuse intensity
- cot = getcol(ma->r * ma->ref, ma->g * ma->ref, ma->b * ma->ref, 1.0f);
+ // diffuse
+ cot = getcol(ma->r, ma->g, ma->b, 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 (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);
-
- ep.setAmbient(cot, false, "ambient");
-
- // reflective, reflectivity
- if (ma->mode & MA_RAYMIRROR) {
- cot = getcol(ma->mirr, ma->mirg, ma->mirb, 1.0f);
- ep.setReflective(cot);
- ep.setReflectivity(ma->ray_mirror);
- }
- // else {
- // cot = getcol(ma->specr, ma->specg, ma->specb, 1.0f);
- // ep.setReflective(cot);
- // ep.setReflectivity(ma->spec);
- // }
-
// specular
if (ep.getShaderType() != COLLADASW::EffectProfile::LAMBERT) {
cot = getcol(ma->specr * ma->spec, ma->specg * ma->spec, ma->specb * ma->spec, 1.0f);
@@ -260,6 +138,7 @@ void EffectsExporter::operator()(Material *ma, Object *ob)
// XXX make this more readable if possible
+#if 0
// create <sampler> and <surface> for each image
COLLADASW::Sampler samplers[MAX_MTEX];
//COLLADASW::Surface surfaces[MAX_MTEX];
@@ -310,6 +189,7 @@ void EffectsExporter::operator()(Material *ma, Object *ob)
b++;
}
}
+#endif
// used as fallback when MTex->uvname is "" (this is pretty common)
// it is indeed the correct value to use in that case
@@ -317,6 +197,7 @@ void EffectsExporter::operator()(Material *ma, Object *ob)
// write textures
// XXX very slow
+#if 0
for (a = 0; a < tex_indices.size(); a++) {
MTex *t = ma->mtex[tex_indices[a]];
Image *ima = t->tex->ima;
@@ -332,6 +213,7 @@ void EffectsExporter::operator()(Material *ma, Object *ob)
COLLADASW::Sampler *sampler = (COLLADASW::Sampler *)samp_surf[i];
writeTextures(ep, key, sampler, t, ima, uvname);
}
+#endif
// performs the actual writing
ep.addProfileElements();
@@ -372,20 +254,3 @@ COLLADASW::ColorOrTexture EffectsExporter::getcol(float r, float g, float b, flo
COLLADASW::ColorOrTexture cot(color);
return cot;
}
-
-//returns the array of mtex indices which have image
-//need this for exporting textures
-void EffectsExporter::createTextureIndices(Material *ma, std::vector<int> &indices)
-{
- indices.clear();
-
- for (int a = 0; a < MAX_MTEX; a++) {
- if (ma->mtex[a] &&
- ma->mtex[a]->tex &&
- ma->mtex[a]->tex->type == TEX_IMAGE &&
- ma->mtex[a]->texco == TEXCO_UV)
- {
- indices.push_back(a);
- }
- }
-}