// (c) Tuomas J. Lukka and Asko Soukka #include #define DBG(cname) if(!cname);else (std::cout << "CallGL: ") namespace Vob { Coorder::Coorder() : cs1_tmp(0), cs2_tmp(0) { } Coorder::~Coorder() { DBG(dbg) << "Deleting coordset "<= interpinds[0]) return false; int par2 = inds2[cs2+1+i]; int par1interpsto = (par1 > 0 ? interpinds[par1] : 0); if(par1interpsto != par2) return false; } DBG(dbg) << "DO interpolate\n"; return true; } void Coorder::setPoints( int ninds, int *inds1, float *points1, int *interpinds, int *inds2, float *points2, float fract, bool show1) { DBG(dbg) << "Set points "<x = x; ASG(ninds) ASG(inds1) ASG(points1) ASG(interpinds) ASG(inds2) ASG(points2) params.resize(0); DBG(dbg) << "Resized\n"; params.reserve(3*ninds); DBG(dbg) << "Reserved\n"; cs.resize(ninds); DBG(dbg) << "Resized2\n"; cs[0] = new RootCoords(); DBG(dbg) << "setroot\n"; int lastIndSize = 1; DBG(dbg) << "Removing tmps "<maxcs = ninds; for(int i=1; i 0) { t2 = inds2[csind2] & ~CSFLAGS; ind2 = inds2[csind2 + 1 + nprevious(t2)]; } // We need to interpolate. Check the structural constraints: // If // 1) both are of same type // 2) all parents interpolate to each other exactly // then use parameter interpolation // Else, use pointwise interpolation if(csind2 <= 0 || (t2 == tp && shouldInterpolate(i, csind2, nprev))) { if(csind2 <= 0) { if(show1) { for(int j = 0; jsetSuper(prev); c->setParams(&(params[0]) + parind); } else { // Now, the hairy case. DBG(dbg) << "It got hairy now: "<setPoints(ninds, inds1, points1, 0, 0, 0, 0, true); } if(!cs2_tmp) { int maxind = 0; for(int k = 1; k maxind) maxind = interpinds[k]; cs2_tmp = new Coorder(); cs2_tmp->setPoints(maxind+1, inds2, points2, 0, 0, 0, 0, true); } Transform *cs1_non = cs1_tmp->get(i); Transform *cs2_non = cs2_tmp->get(csind2); if(!cs1_non || !cs2_non) goto nextInd; c = new PointInterpCoordSys(cs1_non, cs2_non, fract); } { cs[i] = c; if (!cs[i]->shouldBeDrawn()) { DBG(dbg) << "CS should not be drawn... freeing it with delete.\n"; delete cs[i]; // Must be deleted, because created with "new" in factories. cs[i] = NULL; } } nextInd:; } DBG(dbg) << "end: "<