Beispiel #1
0
void PtexTriangleFilter::splitAndApply(PtexTriangleKernel& k, int faceid, const Ptex::FaceInfo& f)
{
    // do we need to split? if so, split kernel and apply across edge(s)
    if (k.u1 < 0 && f.adjface(2) >= 0) {
        PtexTriangleKernel ka;
        k.splitU(ka);
        applyAcrossEdge(ka, f, 2);
    }
    if (k.v1 < 0 && f.adjface(0) >= 0) {
        PtexTriangleKernel ka;
        k.splitV(ka);
        applyAcrossEdge(ka, f, 0);
    }
    if (k.w1 < 0 && f.adjface(1) >= 0) {
        PtexTriangleKernel ka;
        k.splitW(ka);
        applyAcrossEdge(ka, f, 1);
    }
    // apply to local face
    apply(k, faceid, f);
}
void PtexSeparableFilter::splitAndApply(PtexSeparableKernel& k, int faceid, const Ptex::FaceInfo& f)
{
    // do we need to split? (i.e. does kernel span an edge?)
    bool splitR = (k.u+k.uw > k.res.u()), splitL = (k.u < 0);
    bool splitT = (k.v+k.vw > k.res.v()), splitB = (k.v < 0);

#ifdef NOEDGEBLEND
    // for debugging only
    if (splitR) k.mergeR(_uMode);
    if (splitL) k.mergeL(_uMode);
    if (splitT) k.mergeT(_vMode);
    if (splitB) k.mergeB(_vMode);
#else
    if (splitR || splitL || splitT || splitB) { 
	PtexSeparableKernel ka, kc;
	if (splitR) {
	    if (f.adjface(e_right) >= 0) {
		k.splitR(ka);
		if (splitT) {
		    if (f.adjface(e_top) >= 0) {
			ka.splitT(kc);
			applyToCorner(kc, faceid, f, e_top);
		    }
		    else ka.mergeT(_vMode);
		}
		if (splitB) {
		    if (f.adjface(e_bottom) >= 0) {
			ka.splitB(kc);
			applyToCorner(kc, faceid, f, e_right);
		    }
		    else ka.mergeB(_vMode);
		}
		applyAcrossEdge(ka, faceid, f, e_right);
	    }
	    else k.mergeR(_uMode);
	}
	if (splitL) {
	    if (f.adjface(e_left) >= 0) {
		k.splitL(ka);
		if (splitT) {
		    if (f.adjface(e_top) >= 0) {
			ka.splitT(kc);
			applyToCorner(kc, faceid, f, e_left);
		    }
		    else ka.mergeT(_vMode);
		}
		if (splitB) {
		    if (f.adjface(e_bottom) >= 0) {
			ka.splitB(kc);
			applyToCorner(kc, faceid, f, e_bottom);
		    }
		    else ka.mergeB(_vMode);
		}
		applyAcrossEdge(ka, faceid, f, e_left);
	    }
	    else k.mergeL(_uMode);
	}
	if (splitT) {
	    if (f.adjface(e_top) >= 0) {
		k.splitT(ka);
		applyAcrossEdge(ka, faceid, f, e_top);
	    }
	    else k.mergeT(_vMode);
	}
	if (splitB) {
	    if (f.adjface(e_bottom) >= 0) {
		k.splitB(ka);
		applyAcrossEdge(ka, faceid, f, e_bottom);
	    }
	    else k.mergeB(_vMode);
	}
    }
#endif

    // do local face
    apply(k, faceid, f); 
}