void Object3D::setTransparencyOn() { ref_ptr<BlendColor> bc = dynamic_cast< BlendColor* > (_objectStateSet->getAttribute(StateAttribute::BLENDCOLOR)); Vec4 consCol = bc->getConstantColor(); bc->setConstantColor(Vec4f(consCol.r(),consCol.g(),consCol.b(),_transparencyValue)); _objectStateSet->setMode(GL_BLEND,StateAttribute::ON|StateAttribute::OVERRIDE); _objectStateSet->setRenderingHint(StateSet::TRANSPARENT_BIN|StateAttribute::OVERRIDE); }
void Object3D::updateTransparency(float value) { if (isTransparent()) { _transparencyValue = value; ref_ptr<BlendColor> bc = dynamic_cast< BlendColor* > (_objectStateSet->getAttribute(StateAttribute::BLENDCOLOR)); Vec4 consCol = bc->getConstantColor(); bc->setConstantColor(Vec4f(consCol.r(),consCol.g(),consCol.b(),_transparencyValue)); } }