Tue Dec 13 15:35:52 2011 +0100
SIMRESERVOIR-3849: Use textMaterial to color the text when using an SmTextureText2Collector, as is done otherwise.
| lib/SmallChange/nodekits/SmAnnotationAxis.cpp | file | annotate | diff | revisions |
1.1 --- a/lib/SmallChange/nodekits/SmAnnotationAxis.cpp Mon Nov 07 15:12:04 2011 +0100 1.2 +++ b/lib/SmallChange/nodekits/SmAnnotationAxis.cpp Tue Dec 13 15:35:52 2011 +0100 1.3 @@ -30,7 +30,6 @@ 1.4 #include <Inventor/elements/SoViewportRegionElement.h> 1.5 #include <Inventor/elements/SoViewVolumeElement.h> 1.6 #include <Inventor/elements/SoCullElement.h> 1.7 -#include <Inventor/elements/SoLazyElement.h> 1.8 #include <Inventor/actions/SoGLRenderAction.h> 1.9 #include <Inventor/actions/SoGetBoundingBoxAction.h> 1.10 #include <Inventor/nodes/SoSwitch.h> 1.11 @@ -191,26 +190,26 @@ 1.12 } 1.13 if (SmTextureText2CollectorElement::isCollecting(state)) { 1.14 if (this->annotation.getNum()) { 1.15 - SmTextureText2 * t = static_cast<SmTextureText2*>(this->getAnyPart("text", TRUE)); 1.16 + SoMaterial * material = static_cast<SoMaterial*>(this->getAnyPart("textMaterial", TRUE)); 1.17 + SmTextureText2 * text = static_cast<SmTextureText2*>(this->getAnyPart("text", TRUE)); 1.18 SbMatrix modelmatrix = SoModelMatrixElement::get(state); 1.19 SbVec3f pos; 1.20 - SbColor4f col(SoLazyElement::getDiffuse(state, 0), 1.21 - 1.0f - SoLazyElement::getTransparency(state, 0)); 1.22 + SbColor4f col(material->diffuseColor[0], 1.0f - material->transparency[0]); 1.23 1.24 for (int i = 0; i < l1.getLength(); i++) { 1.25 pos = this->annotationPos[l1[i]] + this->annotationOffset.getValue(); 1.26 modelmatrix.multVecMatrix(pos, pos); 1.27 1.28 SmTextureText2CollectorElement::add(state, 1.29 - this->annotation.getValues(0)[l1[i]%this->annotation.getNum()], 1.30 + this->annotation.getValues(0)[l1[i] % this->annotation.getNum()], 1.31 SmTextureFontElement::get(state), 1.32 pos, 1.33 -1.0, 1.34 col, 1.35 - static_cast<SmTextureText2::Justification>(t->justification.getValue()), 1.36 - static_cast<SmTextureText2::VerticalJustification>(t->verticalJustification.getValue())); 1.37 + static_cast<SmTextureText2::Justification>(text->justification.getValue()), 1.38 + static_cast<SmTextureText2::VerticalJustification>(text->verticalJustification.getValue())); 1.39 1.40 - if (t->string.getNum()) t->string.setNum(0); 1.41 + if (text->string.getNum()) text->string.setNum(0); 1.42 } 1.43 } 1.44 }