Time for action—fading in
We already had experience of making a scene object translucent using osg::BlendFunc
class and rendering orders. The fourth component of the color vector, called the alpha value, will do the trick for us. But what will happen if we have a continuously-changing alpha? The object will be completely transparent (invisible) when alpha is 0, and completely opaque when it is 1.0. The animating process from 0.0 to 1.0 will therefore cause the object to gradually appear to viewers, that is, the fade-in effect.
The update callback can be used in this task. It is no problem to create an osg::NodeCallback
based class and set it to the node that will be fading in. But the state attribute callback, osg::StateAttributeCallback
, is also ...
Get OpenSceneGraph 3.0 now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.