本文整理汇总了C++中GeometryUnrecPtr::setNormals方法的典型用法代码示例。如果您正苦于以下问题:C++ GeometryUnrecPtr::setNormals方法的具体用法?C++ GeometryUnrecPtr::setNormals怎么用?C++ GeometryUnrecPtr::setNormals使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GeometryUnrecPtr
的用法示例。
在下文中一共展示了GeometryUnrecPtr::setNormals方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: read
//.........这里部分代码省略.........
}
}
}
}
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 ) );
meshI->mtlPtr->setShininess( 20.f );
}
geoPtr->setMaterial ( meshI->mtlPtr );
for ( faceI = meshI->faceList.begin();
faceI != meshI->faceList.end(); faceI++)
{
n = UInt32(faceI->tieVec.size());
// add the lens entry
lensPtr->push_back(n);
// add the type entry
typePtr->push_back(GL_POLYGON);
// create the index values
for (i = 0; i < n; i++)
{
示例2: main
//.........这里部分代码省略.........
norms->push_back(Vec3f( 0.0,1.0,0.0));
norms->push_back(Vec3f( 0.0,1.0,0.0));
norms->push_back(Vec3f( 0.0,1.0,0.0));
norms->push_back(Vec3f( 0.0,1.0,0.0));
//Right Hip
norms->push_back(Vec3f( 0.0,0.0,1.0));
norms->push_back(Vec3f( 0.0,0.0,1.0));
norms->push_back(Vec3f( 0.0,0.0,1.0));
norms->push_back(Vec3f( 0.0,0.0,1.0));
//Right Femur
norms->push_back(Vec3f( 0.0,0.0,1.0));
norms->push_back(Vec3f( 0.0,0.0,1.0));
norms->push_back(Vec3f( 0.0,0.0,1.0));
norms->push_back(Vec3f( 0.0,0.0,1.0));
//Right Tibia
norms->push_back(Vec3f( 0.0,0.0,1.0));
norms->push_back(Vec3f( 0.0,0.0,1.0));
norms->push_back(Vec3f( 0.0,0.0,1.0));
norms->push_back(Vec3f( 0.0,0.0,1.0));
//Right Foot
norms->push_back(Vec3f( 0.0,1.0,0.0));
norms->push_back(Vec3f( 0.0,1.0,0.0));
norms->push_back(Vec3f( 0.0,1.0,0.0));
norms->push_back(Vec3f( 0.0,1.0,0.0));
//Tell the geometry (geo) to use the points and normals we just defined
geo->setTypes (type);
geo->setLengths (lens);
geo->setPositions(pnts);
geo->setNormals(norms);
// assign a material to the geometry to make it visible. The details
// of materials are defined later.
geo->setMaterial(getDefaultMaterial());
//Create unbound geometry node (for displaying mesh in its bind pose)
UnboundGeometry = Node::create();
UnboundGeometry->setCore(geo);
UnboundGeometry->setTravMask(0); //By default, we won't show the mesh's bind pose
//SkeletonDrawer
SkeletonDrawableUnrecPtr ExampleSkeletonDrawable = SkeletonDrawable::create();
ExampleSkeletonDrawable->setSkeleton(ExampleSkeleton);
ExampleSkeletonDrawable->setMaterial(ExampleMaterial);
ExampleSkeletonDrawable->setDrawBindPose(false); //By default, we don't draw the skeleton's bind pose
ExampleSkeletonDrawable->setBindPoseColor(Color4f(0.0, 1.0, 0.0, 1.0)); //When drawn, the skeleton's bind pose renders green
ExampleSkeletonDrawable->setDrawPose(true); //By default, we do draw the skeleton's current pose
ExampleSkeletonDrawable->setPoseColor(Color4f(0.0, 0.0, 1.0, 1.0)); //The skeleton's current pose renders blue
//Skeleton Node
SkeletonNode = Node::create();
SkeletonNode->setCore(ExampleSkeletonDrawable);
// Skeleton Blended Geometry
// Here we are attaching the "skin" to the skeleton so that when the skeleton is animated, the skin moves with it
ExampleSkeleton->setBaseGeometry(geo);
示例3: initGeometries
void VTKPolyDataMapper::initGeometries(void)
{
NodeUnrecPtr pRoot = Node::create();
pRoot->setCore(Group::create());
setRoot(pRoot);
for(UInt32 i = 0; i < 4; ++i)
{
GeometryUnrecPtr pGeo = Geometry::create();
ChunkMaterialUnrecPtr pMat = ChunkMaterial::create();
MaterialChunkUnrecPtr pMatChunk = MaterialChunk::create();
GeoPnt3fPropertyUnrecPtr pPoints = GeoPnt3fProperty ::create();
GeoUInt32PropertyUnrecPtr pLengths = GeoUInt32Property ::create();
GeoUInt8PropertyUnrecPtr pTypes = GeoUInt8Property ::create();
GeoColor4fPropertyUnrecPtr pColors = GeoColor4fProperty::create();
GeoVec3fPropertyUnrecPtr pNormals = GeoVec3fProperty ::create();
if(i < 2)
{
pMatChunk->setLit(false);
}
pMatChunk->setDiffuse (OSG::Color4f(1.0, 1.0, 1.0, 1.0));
pMatChunk->setSpecular (OSG::Color4f(0.0, 0.0, 0.0, 1.0));
pMatChunk->setShininess(10.0f);
pMat->addChunk(pMatChunk);
TwoSidedLightingChunkUnrecPtr pTSLChunk =
TwoSidedLightingChunk::create();
pMat->addChunk(pTSLChunk);
pGeo->setDlistCache(false );
pGeo->setMaterial (pMat );
pGeo->setPositions (pPoints );
pGeo->setLengths (pLengths);
pGeo->setTypes (pTypes );
pGeo->setColors (pColors );
if(i > 1)
{
pGeo->setNormals(pNormals);
}
OSG::NodeUnrecPtr pGeoRoot = OSG::Node::create();
pGeoRoot->setCore (pGeo);
pGeoRoot->setTravMask(0 );
pRoot->addChild(pGeoRoot);
this->pushToGeometries (pGeo );
this->pushToMaterials (pMat );
this->pushToMaterialChunks(pMatChunk);
this->pushToPositions (pPoints );
this->pushToLength (pLengths );
this->pushToTypes (pTypes );
this->pushToColors (pColors );
this->pushToNormals (pNormals );
this->pushToGeoRoots (pGeoRoot );
}
}
示例4: 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);
}
//.........这里部分代码省略.........