--------------------------
| 540 | |
| 541 | // -------------------------- |
| 542 | void EffectImporter::importReflectShaderAttributes ( |
| 543 | const ShaderType& shaderType, |
| 544 | MayaDM::Reflect* shaderNode, |
| 545 | const COLLADAFW::Effect* effect, |
| 546 | const COLLADAFW::EffectCommon* commonEffect ) |
| 547 | { |
| 548 | // Reflective |
| 549 | const COLLADAFW::ColorOrTexture& reflective = commonEffect->getReflective (); |
| 550 | if ( reflective.isColor () ) |
| 551 | { |
| 552 | // Get the color and set it into the shader node (if it is a valid color). |
| 553 | const COLLADAFW::Color& color = reflective.getColor (); |
| 554 | if ( color.isValid () && color != COLLADAFW::Color::BLACK ) |
| 555 | shaderNode->setReflectedColor ( MayaDM::float3 ( (float)color.getRed (), (float)color.getGreen (), (float)color.getBlue ()) ); |
| 556 | |
| 557 | // Push the animation id in a map, if it exist. |
| 558 | const COLLADAFW::UniqueId& animationListId = color.getAnimationList (); |
| 559 | if ( animationListId.isValid () ) |
| 560 | { |
| 561 | EffectAnimation effectAnimation; |
| 562 | effectAnimation.setAnimationListId ( animationListId ); |
| 563 | effectAnimation.setAnimationSourceId ( effect->getUniqueId () ); |
| 564 | effectAnimation.setAnimatedValueType ( EffectAnimation::COLOR_OR_TEXTURE_REFLECTED ); |
| 565 | |
| 566 | mEffectAnimationMap [animationListId] = effectAnimation; |
| 567 | } |
| 568 | } |
| 569 | else if ( reflective.isTexture () ) |
| 570 | { |
| 571 | // Get the texure and the current shader attribute. |
| 572 | const COLLADAFW::Texture& texture = reflective.getTexture (); |
| 573 | ShaderAttribute shaderAttribute = ATTR_REFLECTIVE; |
| 574 | |
| 575 | // Create a shader node attribute and append it on the list of shader node |
| 576 | // attributes to the current sampler file id. |
| 577 | appendTextureInfo ( effect, texture, shaderType, shaderAttribute, shaderNode ); |
| 578 | } |
| 579 | else |
| 580 | { |
| 581 | // The maya default color is grey. The framework/collada uses black. |
| 582 | shaderNode->setReflectedColor ( MayaDM::float3 ( 0.0f,0.0f,0.0f ) ); |
| 583 | } |
| 584 | |
| 585 | // Reflectivity |
| 586 | const COLLADAFW::FloatOrParam& reflectivityFoP = commonEffect->getReflectivity (); |
| 587 | if ( reflectivityFoP.getType () == COLLADAFW::FloatOrParam::FLOAT ) |
| 588 | { |
| 589 | float reflectivity = reflectivityFoP.getFloatValue (); |
| 590 | if ( reflectivity > 0 ) |
| 591 | { |
| 592 | shaderNode->setReflectivity ( reflectivity ); |
| 593 | |
| 594 | // Push the animation id in a map, if it exist. |
| 595 | const COLLADAFW::UniqueId& animationListId = reflectivityFoP.getAnimationList (); |
| 596 | if ( animationListId.isValid () ) |
| 597 | { |
| 598 | EffectAnimation effectAnimation; |
| 599 | effectAnimation.setAnimationListId ( animationListId ); |
nothing calls this directly
no test coverage detected