my code:
bool GraphicSceneClass::RSetTexturePosition(std::string ObjectName,
float dx, float dy, unsigned int UnitNumber)
{
//Находим объект
osg::ref_ptr<FindNamedNodeVisitor> fnnv = new
FindNamedNodeVisitor(ObjectName);
root->accept(*fnnv.get());
//Если такой объект есть, ищем анимацию
if (!fnnv->_foundNodes.empty())
{
if (fnnv->_foundNodes.size()>1) std::cout << "Warning: Duplicate
names - " << ObjectName << std::endl;
osg::ref_ptr<FindGeometryVisitor> zzz = new
FindGeometryVisitor();
fnnv->_foundNodes.front().get()->accept (*zzz.get());
//Если геометрия найдена
if (!zzz->geom.get())
{
std::cout << "geometry NOT found";
//delete zzz;
//delete fnnv;
return false;
}
//MOVE TEXTURE COORDINATES
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!1
osg::ref_ptr<osg::Vec2Array> vertices2 =
dynamic_cast<osg::Vec2Array*>
(zzz->geom->getTexCoordArray(UnitNumber)) ;
for (unsigned int u =0 ; u < vertices2->size(); u++)
{
vertices2->at(u).x() += dx;
vertices2->at(u).y() += dy;
}
//Чистим мусор
//delete zzz;
}
else
{
std::cout << "Find objects in Root - FALSE! " << ObjectName <<
std::endl;
//delete fnnv;
return false;
}
//Чистим мусор
//delete fnnv;
return true;
}
2011/5/20 Marc Wahl <[email protected]>:
> Yes, that was also my first approach, but I need a resulting Texture2D.
>
> I'm working with an external painting lib, which requires a Texture2D as a
> brush.
>
> I'm painting tire tracks and the used painter draws on each animation cycle.
> Therefore i use the tire rotation to calculate the current tire track
> (normal&bump map).
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=39565#39565
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
--
Maxim Gammer
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org