本文整理汇总了C++中osg::Geometry::getTexCoordArrayList方法的典型用法代码示例。如果您正苦于以下问题:C++ Geometry::getTexCoordArrayList方法的具体用法?C++ Geometry::getTexCoordArrayList怎么用?C++ Geometry::getTexCoordArrayList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类osg::Geometry
的用法示例。
在下文中一共展示了Geometry::getTexCoordArrayList方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: handleNewVertices
void Tessellator::handleNewVertices(osg::Geometry& geom,VertexPtrToIndexMap &vertexPtrToIndexMap)
{
if (!_newVertexList.empty())
{
osg::Vec3Array* vertices = dynamic_cast<osg::Vec3Array*>(geom.getVertexArray());
osg::Vec3Array* normals = NULL;
if (geom.getNormalBinding()==osg::Geometry::BIND_PER_VERTEX)
{
normals = dynamic_cast<osg::Vec3Array*>(geom.getNormalArray());
}
typedef std::vector<osg::Array*> ArrayList;
ArrayList arrays;
if (geom.getColorBinding()==osg::Geometry::BIND_PER_VERTEX)
{
arrays.push_back(geom.getColorArray());
}
if (geom.getSecondaryColorBinding()==osg::Geometry::BIND_PER_VERTEX)
{
arrays.push_back(geom.getSecondaryColorArray());
}
if (geom.getFogCoordBinding()==osg::Geometry::BIND_PER_VERTEX)
{
arrays.push_back(geom.getFogCoordArray());
}
osg::Geometry::ArrayDataList& tcal = geom.getTexCoordArrayList();
for(osg::Geometry::ArrayDataList::iterator tcalItr=tcal.begin();
tcalItr!=tcal.end();
++tcalItr)
{
if (tcalItr->array.valid())
{
arrays.push_back(tcalItr->array.get());
}
}
// now add any new vertices that are required.
for(NewVertexList::iterator itr=_newVertexList.begin();
itr!=_newVertexList.end();
++itr)
{
NewVertex& newVertex = (*itr);
osg::Vec3* vertex = newVertex._vpos;
// assign vertex.
vertexPtrToIndexMap[vertex]=vertices->size();
vertices->push_back(*vertex);
// assign normals
if (normals)
{
osg::Vec3 norm(0.0f,0.0f,0.0f);
if (newVertex._v1) norm += (*normals)[vertexPtrToIndexMap[newVertex._v1]] * newVertex._f1;
if (newVertex._v2) norm += (*normals)[vertexPtrToIndexMap[newVertex._v2]] * newVertex._f2;
if (newVertex._v3) norm += (*normals)[vertexPtrToIndexMap[newVertex._v3]] * newVertex._f3;
if (newVertex._v4) norm += (*normals)[vertexPtrToIndexMap[newVertex._v4]] * newVertex._f4;
norm.normalize();
normals->push_back(norm);
}
if (!arrays.empty())
{
InsertNewVertices inv(newVertex._f1,vertexPtrToIndexMap[newVertex._v1],
newVertex._f2,vertexPtrToIndexMap[newVertex._v2],
newVertex._f3,vertexPtrToIndexMap[newVertex._v3],
newVertex._f4,vertexPtrToIndexMap[newVertex._v4]);
// assign the rest of the attributes.
for(ArrayList::iterator aItr=arrays.begin();
aItr!=arrays.end();
++aItr)
{
(*aItr)->accept(inv);
}
}
}
}
}