Changeset View
Changeset View
Standalone View
Standalone View
source/blender/collada/DocumentImporter.cpp
| Context not available. | |||||
| else if (shader == COLLADAFW::EffectCommon::SHADER_LAMBERT) { | else if (shader == COLLADAFW::EffectCommon::SHADER_LAMBERT) { | ||||
gaiaclary: reduce redundancy:
else if (shader == COLLADAFW::EffectCommon::SHADER_CONSTANT) {
ma… | |||||
| ma->diff_shader = MA_DIFF_LAMBERT; | ma->diff_shader = MA_DIFF_LAMBERT; | ||||
| } | } | ||||
| else if (shader == COLLADAFW::EffectCommon::SHADER_CONSTANT) { | |||||
| ma->mode = MA_SHLESS; | |||||
| } | |||||
| // default - lambert | // default - lambert | ||||
| else { | else { | ||||
| ma->diff_shader = MA_DIFF_LAMBERT; | ma->diff_shader = MA_DIFF_LAMBERT; | ||||
| Context not available. | |||||
| COLLADAFW::Texture ctex = ef->getEmission().getTexture(); | COLLADAFW::Texture ctex = ef->getEmission().getTexture(); | ||||
| mtex = create_texture(ef, ctex, ma, i, texindex_texarray_map); | mtex = create_texture(ef, ctex, ma, i, texindex_texarray_map); | ||||
| if (mtex != NULL) { | if (mtex != NULL) { | ||||
| mtex->mapto = MAP_EMIT; | if(shader == COLLADAFW::EffectCommon::SHADER_CONSTANT) | ||||
| mtex->mapto = MAP_COL; | |||||
| else | |||||
| mtex->mapto = MAP_EMIT; | |||||
| i++; | i++; | ||||
| } | } | ||||
| } | } | ||||
| Context not available. | |||||
| } | } | ||||
| } | } | ||||
| #endif | #endif | ||||
| /** <constant> cannot have diffuse, ambient, specular, shininnes as its child so color is solely based on | |||||
| * the emission color, so we map emission color to material's color */ | |||||
| if (shader == COLLADAFW::EffectCommon::SHADER_CONSTANT) { | |||||
Not Done Inline ActionsWould think variable names can be improved here, also perhaps using array instead of decoupled variables. Like: int emission[3]; sergey: Would think variable names can be improved here, also perhaps using array instead of decoupled… | |||||
Not Done Inline Actionsfloat emission[3]; gaiaclary: float emission[3];
float ambience[3];
Then you maybe can make use of the Blender's vector… | |||||
| COLLADAFW::Color col_emmission; | |||||
| if(ef->getEmission().isValid()) { | |||||
| col_emmission = ef->getEmission().getColor(); | |||||
Not Done Inline ActionsSpace between "if" and "(". sergey: Space between "if" and "(". | |||||
| ma->r = col_emmission.getRed(); | |||||
Not Done Inline ActionsIndentation seems to be broken. sergey: Indentation seems to be broken. | |||||
| ma->g = col_emmission.getGreen(); | |||||
| ma->b = col_emmission.getBlue(); | |||||
| } | |||||
| } | |||||
| material_texture_mapping_map[ma] = texindex_texarray_map; | material_texture_mapping_map[ma] = texindex_texarray_map; | ||||
| } | } | ||||
Not Done Inline ActionsSame. sergey: Same. | |||||
| Context not available. | |||||
Not Done Inline ActionsWhat happens when ambient and emission are defined? then the sum could become > 1. What will blender do in that case? is this possible after all? (maybe the collada specifications tell how to merge ambient and emission... Could you add some minimal comment here please?) gaiaclary: What happens when ambient and emission are defined? then the sum could become > 1. What will… | |||||
reduce redundancy:
else if (shader == COLLADAFW::EffectCommon::SHADER_CONSTANT) { ma->mode = MA_SHLESS; } else { // default - lambert ma->diff_shader = MA_DIFF_LAMBERT; }