[osg-users] Animation problem
Julie Green
laroux92 at mail.ru
Fri Aug 28 02:00:00 PDT 2015
Hi,
Can't figure out what is the problem. I'm trying to modify geometry depending on time. But I'm getting an exception "std::__non_rtti_object at memory location.." or application triggers a breakpoint.
Code:
void SurfaceCalculationThread::run()
{
while (!done)
reCalculateSurface();
};
float SurfaceCalculationThread::calculateZ(float x, float y, float t)
{
float z;
z = sqrt(((x*x) / (B*B)) + ((y*y) / ((A*A)*(sin(t)*sin(t)))) + 1);
return z;
}
void SurfaceCalculationThread::reCalculateSurface()
{
float x, y, z;
int i = 0;
float something = (sqrt(Npolygon) / 2)*1.00;
t=time->elapsedTime_n();
for (x = -something; x <= something; x += 1.0f)
{
for (y = -something; y <= something; y += 1.0f)
{
(*vertices2)[i].set((*vertices)[i]);
z = calculateZ(x, y, t);
(*vertices)[i].set(osg::Vec3f(x, y, z));
i++;
}
}
geometry->setVertexArray(vertices2);
geometry->setUpdateCallback(new UpdateSurfaceCallback(vertices));
}
Thank you!
Cheers,
Julie
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=64930#64930
More information about the osg-users
mailing list