houdini hdk 笔记

const GU_Detail *bgdp = inputGeo(1);
const GA_Attribute *bp = bgdp->findAttribute(GA_ATTRIB_POINT, "P");
const GA_AIFTuple *tuple = bp->getAIFTuple();
UT_Vector3 n;
if(tuple)
{
    for(GA_Iterator it(bgdp->getPointRange());!it.atEnd();++it)//循环
    {
        GA_Offset offs = *it;
        tuple->get(bp, offs, n.data(), 3);
    }
}
float haha = n.x();

遍历的情况,逻辑的不对的地方可以无视。

const GU_Detail *bgdp = inputGeo(1);
const GA_Attribute *bp = bgdp->findAttribute(GA_ATTRIB_POINT, "P");
const GA_AIFTuple *tuple = bp->getAIFTuple();
UT_Vector3 n;
if(tuple)
{
    GA_Offset offs = bgdp->pointOffset(GA_Index(0));//单独选择点
    tuple->get(bp, offs, n.data(), 3);
}
float haha = n.x();

单独选择一点情况

你可能感兴趣的:(houdini hdk 笔记)