Simplified the TangentSpaceGenerator so that is automatically converts any models

with indices to one without indices and then runs the tangent space generation code on the result.
This commit is contained in:
Robert Osfield
2005-11-22 21:14:26 +00:00
parent 48a8f14ae7
commit f78a37be9c
4 changed files with 62 additions and 369 deletions

View File

@@ -589,7 +589,9 @@ bool BumpMapping::define_techniques()
void BumpMapping::prepareGeometry(osg::Geometry* geo)
{
osg::ref_ptr<osgUtil::TangentSpaceGenerator> tsg = new osgUtil::TangentSpaceGenerator;
tsg->generate(geo, _normal_unit);
if (!geo->getVertexAttribArray(6))
geo->setVertexAttribData(6, osg::Geometry::ArrayData(tsg->getTangentArray(), osg::Geometry::BIND_PER_VERTEX,GL_FALSE));
if (!geo->getVertexAttribArray(7))