Robert Osfield wrote on Monday, March 05, 2007 3:17 AM:
> Hi Peter,
> 
> osg::Sphere is a sublcass from osg::Shape, not a subclass from
> osg::Drawable, so its not approrpriate to cast a drawable to a Sphere,
> I would expect at least a crash from what you are doing.
> 
> Robert.
> 
> On 3/4/07, Peter Steibert <[EMAIL PROTECTED]> wrote:
>> struct DrawableUpdateCallback : public osg::Drawable::UpdateCallback
>>     { float _angle;
>> 
>>     virtual void update(osg::NodeVisitor*, osg::Drawable* drawable) 
>>         { if (drawable->getName() == "Sphere")
>>         {
>>             osg::Sphere* sphereShape = (osg::Sphere*)
>>             drawable->getShape(); _angle = _angle + 0.02;
>>             float radius = abs(30*cos(_angle));
>>             sphereShape->setRadius(radius);
>>         }
>>     }
>> };

Actually, he calls getShape() on the drawable, so that's not a problem.
Unless the drawable has no shape or its shape isn't a Sphere ;)

-- 
Bryan Thrall
FlightSafety International
[EMAIL PROTECTED]


_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

Reply via email to