本文整理汇总了C++中GeometryUnrecPtr::setIndex方法的典型用法代码示例。如果您正苦于以下问题:C++ GeometryUnrecPtr::setIndex方法的具体用法?C++ GeometryUnrecPtr::setIndex怎么用?C++ GeometryUnrecPtr::setIndex使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GeometryUnrecPtr
的用法示例。
在下文中一共展示了GeometryUnrecPtr::setIndex方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: read
//.........这里部分代码省略.........
// [...]
// Some faces contain texture coords and others do not.
// The old version did just skip this geometry.
// This version should continue if there's at least
// the vertex index
// I've seen the change in the maskIndex only after a smooth group,
// so it's perhaps smarter to not ignore the smooth group further up in this code
if( !(indexMask & 1) )
{
// if there are vertex indices there's no reason to get in here
FFATAL (( "IndexMask unmatch, can not create geo\n"));
meshIndexMask = 0;
break;
}
else
{
// consider the minimum similarities of mesh masks
meshIndexMask &= indexMask;
}
}
}
}
else
{
FWARNING (("Mesh with empty faceList\n"));
}
// fill the geo properties
if (meshIndexMask)
{
geoPtr->setPositions ( coordPtr );
posIndexPtr = GeoUInt32Property::create();
if(!isSingleIndex)
geoPtr->setIndex(posIndexPtr, Geometry::PositionsIndex);
geoPtr->setLengths ( lensPtr );
geoPtr->setTypes ( typePtr );
if ( (meshIndexMask & 2) && texCoordPtr->size() > 0 )
{
geoPtr->setTexCoords ( texCoordPtr );
texIndexPtr = GeoUInt32Property::create();
if(!isSingleIndex)
geoPtr->setIndex(texIndexPtr, Geometry::TexCoordsIndex);
}
else
{
geoPtr->setTexCoords ( NULL );
}
if ( (meshIndexMask & 4) && normalPtr->size() > 0 )
{
geoPtr->setNormals ( normalPtr );
normalIndexPtr = GeoUInt32Property::create();
if(!isSingleIndex)
geoPtr->setIndex(normalIndexPtr, Geometry::NormalsIndex);
}
else
{
geoPtr->setNormals ( NULL );
}
if (meshI->mtlPtr == NULL)
{
meshI->mtlPtr = SimpleTexturedMaterial::create();
meshI->mtlPtr->setDiffuse( Color3f( .8f, .8f, .8f ) );
meshI->mtlPtr->setSpecular( Color3f( 1.f, 1.f, 1.f ) );
示例2: read
NodeTransitPtr RAWSceneFileType::read( std::istream &is,
const Char8 *,
Resolver ) const
{
NodeTransitPtr root;
GeometryUnrecPtr geo;
GeoPnt3fPropertyUnrecPtr points;
GeoVec3fPropertyUnrecPtr normals;
GeoIntegralPropertyUnrecPtr index;
GeoIntegralPropertyUnrecPtr lens;
GeoIntegralPropertyUnrecPtr type;
Vec3f vec[3];
UInt32 i = 0, n, triCount = 0;
Real32 x,y,z;
if(is)
{
root = Node ::create();
geo = Geometry::create();
root->setCore( geo );
points = GeoPnt3fProperty::create();
geo->setPositions(points);
normals = GeoVec3fProperty::create();
geo->setNormals(normals);
triCount = i = 0;
while(1)
{
is >> x >> y >> z;
if(is.eof())
{
break;
}
else
{
points->editFieldPtr()->push_back(Pnt3f(x, y, z));
vec[i].setValues(x,y,z);
std::cerr << x << " " << y << " " << z << std::endl;
if(i == 2)
{
vec[0] -= vec[1];
vec[1] -= vec[2];
vec[0].crossThis(vec[1]);
vec[0].normalize();
normals->editFieldPtr()->push_back(vec[0]);
normals->editFieldPtr()->push_back(vec[0]);
normals->editFieldPtr()->push_back(vec[0]);
i = 0;
triCount++;
}
else
{
i++;
}
}
}
if(triCount != 0)
{
index = GeoUInt32Property::create();
geo->setIndex(index, Geometry::PositionsIndex);
geo->setIndex(index, Geometry::NormalsIndex );
n = triCount * 3;
for(i = 0; i < n; i++)
index->push_back(i);
lens = GeoUInt32Property::create();
geo->setLengths(lens);
lens->push_back(n);
type = GeoUInt8Property::create();
geo->setTypes(type);
type->push_back(GL_TRIANGLES);
}
//.........这里部分代码省略.........