本文整理汇总了C++中Patch::ctrlAt方法的典型用法代码示例。如果您正苦于以下问题:C++ Patch::ctrlAt方法的具体用法?C++ Patch::ctrlAt怎么用?C++ Patch::ctrlAt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Patch
的用法示例。
在下文中一共展示了Patch::ctrlAt方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createDecals
void createDecals() {
for (FaceInstanceList::iterator i = _faceInstances.begin(); i != _faceInstances.end(); ++i) {
// Get the winding
const Winding& winding = (*i)->getFace().getWinding();
// Create a new decal patch
scene::INodePtr patchNode = GlobalPatchCreator(DEF3).createPatch();
if (patchNode == NULL) {
gtkutil::errorDialog(_("Could not create patch."), GlobalMainFrame().getTopLevelWindow());
return;
}
Patch* patch = Node_getPatch(patchNode);
assert(patch != NULL); // must not fail
// Set the tesselation of that 3x3 patch
patch->setDims(3,3);
patch->setFixedSubdivisions(true, Subdivisions(1,1));
// Set the coordinates
patch->ctrlAt(0,0).vertex = winding[0].vertex;
patch->ctrlAt(2,0).vertex = winding[1].vertex;
patch->ctrlAt(1,0).vertex = (patch->ctrlAt(0,0).vertex + patch->ctrlAt(2,0).vertex)/2;
patch->ctrlAt(0,1).vertex = (winding[0].vertex + winding[3].vertex)/2;
patch->ctrlAt(2,1).vertex = (winding[1].vertex + winding[2].vertex)/2;
patch->ctrlAt(1,1).vertex = (patch->ctrlAt(0,1).vertex + patch->ctrlAt(2,1).vertex)/2;
patch->ctrlAt(2,2).vertex = winding[2].vertex;
patch->ctrlAt(0,2).vertex = winding[3].vertex;
patch->ctrlAt(1,2).vertex = (patch->ctrlAt(2,2).vertex + patch->ctrlAt(0,2).vertex)/2;
// Use the texture in the clipboard, if it's a decal texture
Texturable& clipboard = GlobalShaderClipboard().getSource();
if (!clipboard.empty())
{
if (clipboard.getShader().find("decals") != std::string::npos)
{
patch->setShader(clipboard.getShader());
}
}
// Fit the texture on it
patch->SetTextureRepeat(1,1);
patch->FlipTexture(1);
// Insert the patch into worldspawn
scene::INodePtr worldSpawnNode = GlobalMap().getWorldspawn();
assert(worldSpawnNode != NULL); // This must be non-NULL, otherwise we won't have faces
worldSpawnNode->addChildNode(patchNode);
// Deselect the face instance
(*i)->setSelected(SelectionSystem::eFace, false);
// Select the patch
Node_setSelected(patchNode, true);
}
}