本文整理汇总了C++中ogre::MeshPtr::buildTangentVectors方法的典型用法代码示例。如果您正苦于以下问题:C++ MeshPtr::buildTangentVectors方法的具体用法?C++ MeshPtr::buildTangentVectors怎么用?C++ MeshPtr::buildTangentVectors使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ogre::MeshPtr
的用法示例。
在下文中一共展示了MeshPtr::buildTangentVectors方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ListboxTextItem
void OgreSample8App::setupModes()
{
StringVector matNames;
matNames.push_back("Examples/BumpMapping/MultiLight");
matNames.push_back("Examples/BumpMapping/MultiLightSpecular");
matNames.push_back("Examples/OffsetMapping/Specular");
matNames.push_back("Examples/ShowUV");
matNames.push_back("Examples/ShowNormals");
matNames.push_back("Examples/ShowTangents");
matNames.push_back("RTSS/NormalMapping_SinglePass");
matNames.push_back("RTSS/NormalMapping_MultiPass");
mPossibilities["ogrehead.mesh"] = matNames;
mPossibilities["knot.mesh"] = matNames;
matNames.clear();
matNames.push_back("Examples/Athene/NormalMapped");
matNames.push_back("Examples/Athene/NormalMappedSpecular");
matNames.push_back("Examples/Athene/NormalMappedSpecular");
matNames.push_back("Examples/ShowUV");
matNames.push_back("Examples/ShowNormals");
matNames.push_back("Examples/ShowTangents");
matNames.push_back("RTSS/Athene/NormalMapping_SinglePass");
matNames.push_back("RTSS/Athene/NormalMapping_MultiPass");
mPossibilities["athene.mesh"] = matNames;
for (std::map<Ogre::String,Ogre::StringVector>::iterator it = mPossibilities.begin(); it != mPossibilities.end(); it++)
{
Ogre::MeshPtr mesh = MeshManager::getSingleton().load(it->first,ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,HardwareBuffer::HBU_DYNAMIC_WRITE_ONLY);
unsigned short src,dest;
if (!mesh->suggestTangentVectorBuildParams(VES_TANGENT,src,dest))
{
mesh->buildTangentVectors(VES_TANGENT,src,dest);
}
Entity* ent = mSceneMgr->createEntity(mesh->getName(),mesh->getName());
ent->setMaterialName(it->second.front());
}
mMeshMenu->addItem(new CEGUI::ListboxTextItem("athene.mesh"));
mMeshMenu->addItem(new CEGUI::ListboxTextItem("ogrehead.mesh"));
mMeshMenu->addItem(new CEGUI::ListboxTextItem("knot.mesh"));
mMeshMenu->setItemSelectState(size_t(0),true);
const char * a = mMeshMenu->getSelectedItem()->getText().c_str();
Ogre::StringVector::iterator it = mPossibilities[a].begin();
Ogre::StringVector::iterator itEnd = mPossibilities[mMeshMenu->getSelectedItem()->getText().c_str()].end();
for (; it != itEnd; it++)
{
mMaterialMenu->addItem(new ListboxTextItem(it->c_str()));
}
mMaterialMenu->setItemSelectState(size_t(0),true);
mSceneMgr->getEntity(mMeshMenu->getSelectedItem()->getText().c_str())->setMaterialName(mMaterialMenu->getSelectedItem()->getText().c_str());
}
示例2: NxEntity
NxEntity * NxNode::CreateNxBox( const std::string & BoxName, const Nx::Vector3 & Dimensions, const Nx::Vector3 & NumSegments )
{
Ogre::MeshPtr NxMesh = NxMeshManager::getSingleton().CreateBox( BoxName, Dimensions, NumSegments );
unsigned short src, dest;
if (!NxMesh->suggestTangentVectorBuildParams(VES_TANGENT, src, dest)){
NxMesh->buildTangentVectors(VES_TANGENT, src, dest);
}
NxEntity * c = new NxEntity( this, BoxName );
mNxEntities.insert( NxEntityList::value_type( BoxName, c ) );
return c;
}
示例3: doExportMesh
//.........这里部分代码省略.........
// Vertex normals
// For the moment, ignore any discrepancies per vertex
msTriangleEx_GetNormal(pTriangleEx, k, &Normal[0]);
msTriangleEx_GetTexCoord(pTriangleEx, k, &uv[0]);
pTex[(vertIdx*2)]=uv[0];
pTex[(vertIdx*2)+1]=uv[1];
pNorm[(vertIdx*3)] = Normal[0];
pNorm[(vertIdx*3)+1] = Normal[1];
pNorm[(vertIdx*3)+2] = Normal[2];
}
} // Faces
nbuf->unlock();
ibuf->unlock();
tbuf->unlock();
// Now use Ogre's ability to reorganise the vertex buffers the best way
Ogre::VertexDeclaration* newDecl =
ogreSubMesh->vertexData->vertexDeclaration->getAutoOrganisedDeclaration(
foundBoneAssignment, false);
Ogre::BufferUsageList bufferUsages;
for (size_t u = 0; u <= newDecl->getMaxSource(); ++u)
bufferUsages.push_back(Ogre::HardwareBuffer::HBU_STATIC_WRITE_ONLY);
ogreSubMesh->vertexData->reorganiseBuffers(newDecl, bufferUsages);
logMgr.logMessage("Geometry done.");
} // SubMesh
// Set bounds
ogreMesh->_setBoundingSphereRadius(Ogre::Math::Sqrt(maxSquaredRadius));
ogreMesh->_setBounds(Ogre::AxisAlignedBox(min, max), false);
// Keep hold of a Skeleton pointer for deletion later
// Mesh uses Skeleton pointer for skeleton name
Ogre::SkeletonPtr pSkel;
if (exportSkeleton && foundBoneAssignment)
{
// export skeleton, also update mesh to point to it
pSkel = doExportSkeleton(pModel, ogreMesh);
}
else if (!exportSkeleton && foundBoneAssignment)
{
// We've found bone assignments, but skeleton is not to be exported
// Prompt the user to find the skeleton
if (!locateSkeleton(ogreMesh))
return;
}
// Export
logMgr.logMessage("Creating MeshSerializer..");
Ogre::MeshSerializer serializer;
logMgr.logMessage("MeshSerializer created.");
// Generate LODs if required
if (generateLods)
{
// Build LOD depth list
Ogre::Mesh::LodDistanceList distList;
float depth = 0;
for (unsigned short depthidx = 0; depthidx < numLods; ++depthidx)
{
depth += lodDepthIncrement;
distList.push_back(depth);
}
ogreMesh->generateLodLevels(distList, lodReductionMethod, lodReductionAmount);
}
if (generateEdgeLists)
{
ogreMesh->buildEdgeList();
}
if (generateTangents)
{
unsigned short src, dest;
ogreMesh->suggestTangentVectorBuildParams(tangentSemantic, src, dest);
ogreMesh->buildTangentVectors(tangentSemantic, src, dest, tangentsSplitMirrored, tangentsSplitRotated, tangentsUseParity);
}
// Export
Ogre::String msg;
msg = "Exporting mesh data to file '" + Ogre::String(szFile) + "'";
logMgr.logMessage(msg);
serializer.exportMesh(ogreMesh.getPointer(), szFile);
logMgr.logMessage("Export successful");
Ogre::MeshManager::getSingleton().remove(ogreMesh->getHandle());
if (!pSkel.isNull())
Ogre::SkeletonManager::getSingleton().remove(pSkel->getHandle());
if (exportMaterials && msModel_GetMaterialCount(pModel) > 0)
{
doExportMaterials(pModel);
}
}