Example #1
0
void DumpFaceInfo(const Ptex::FaceInfo& f)
{
    Ptex::Res res = f.res;
    std::cout << "  res: " << int(res.ulog2) << ' ' << int(res.vlog2)
              << " (" << res.u() << " x " << res.v() << ")"
              << "  adjface: " 
              << f.adjfaces[0] << ' '
              << f.adjfaces[1] << ' '
              << f.adjfaces[2] << ' '
              << f.adjfaces[3]
              << "  adjedge: " 
              << f.adjedge(0) << ' '
              << f.adjedge(1) << ' '
              << f.adjedge(2) << ' '
              << f.adjedge(3)
              << "  flags:";
    // output flag names
    if (f.flags == 0) std::cout << " (none)";
    else {
        if (f.isSubface()) std::cout << " subface";
        if (f.isConstant()) std::cout << " constant";
        if (f.isNeighborhoodConstant()) std::cout << " nbconstant";
        if (f.hasEdits()) std::cout << " hasedits";
    }
    std::cout << std::endl;
}
Example #2
0
void PtexTriangleFilter::applyAcrossEdge(PtexTriangleKernel& k,
                                         const Ptex::FaceInfo& f, int eid)
{
    int afid = f.adjface(eid), aeid = f.adjedge(eid);
    const Ptex::FaceInfo& af = _tx->getFaceInfo(afid);
    k.reorient(eid, aeid);
    splitAndApply(k, afid, af);
}
void PtexSeparableFilter::applyAcrossEdge(PtexSeparableKernel& k, 
					  int faceid, const Ptex::FaceInfo& f, int eid)
{
    int afid = f.adjface(eid), aeid = f.adjedge(eid);
    const Ptex::FaceInfo* af = &_tx->getFaceInfo(afid);
    int rot = eid - aeid + 2;

    // adjust uv coord and res for face/subface boundary
    bool fIsSubface = f.isSubface(), afIsSubface = af->isSubface();
    if (fIsSubface != afIsSubface) {
	if (afIsSubface) {
	    // main face to subface transition
	    // adjust res and offset uv coord for primary subface
	    bool primary = k.adjustMainToSubface(eid);
	    if (!primary) {
		// advance ajacent face and edge id to secondary subface
		int neid = (aeid + 3) % 4;
		afid = af->adjface(neid);
		aeid = af->adjedge(neid);
		af = &_tx->getFaceInfo(afid);
		rot += neid - aeid + 2;
	    }
	}
	else {
	    // subface to main face transition
	    // Note: the transform depends on which subface the kernel is
	    // coming from.  The "primary" subface is the one the main
	    // face is pointing at.  The secondary subface adjustment
	    // happens to be the same as for the primary subface for the
	    // next edge, so the cases can be combined.
	    bool primary = (af->adjface(aeid) == faceid);
	    k.adjustSubfaceToMain(eid - primary);
	}
    }

    // rotate and apply (resplit if going to a subface)
    k.rotate(rot);
    if (afIsSubface) splitAndApply(k, afid, *af);
    else apply(k, afid, *af);
}