57 |
.25 + .5 * yrelp |
.25 + .5 * yrelp |
58 |
); |
); |
59 |
coords1.vertex(p); |
coords1.vertex(p); |
60 |
DBG(dbg_irregularquad) << "Vert: " << q<<p<<coords1.transform(p) <<"\\n"; |
DBG(dbg_irregularquad) << "Vert: " << q<<p<<coords1.transform(p) <<"\n"; |
61 |
} |
} |
62 |
|
|
63 |
|
|
112 |
|
|
113 |
|
|
114 |
template<class T> void render(const T &coords1, const T &coords2) const { |
template<class T> void render(const T &coords1, const T &coords2) const { |
115 |
DBG(dbg_irregularquad) << "Irregular quad\\n"; |
DBG(dbg_irregularquad) << "Irregular quad\n"; |
116 |
|
|
|
glCallList(setup); |
|
|
GLERR; |
|
|
|
|
|
|
|
117 |
// Normalize tearaway part unit vectors in paper coords to get border widths |
// Normalize tearaway part unit vectors in paper coords to get border widths |
118 |
// Note: we assume that coords2 is an affine transform so that the border (ripple) width |
// Note: we assume that coords2 is an affine transform so that the border (ripple) width |
119 |
// is translation invariant |
// is translation invariant |
122 |
ZVec yvec = (coords2.transform(ZPt(0,1,0)) - coords2.transform(ZPt(0,0,0))).normalized(); |
ZVec yvec = (coords2.transform(ZPt(0,1,0)) - coords2.transform(ZPt(0,0,0))).normalized(); |
123 |
|
|
124 |
//cout << (coords2.transform(ZPt(1,0,0)) - coords2.transform(ZPt(0,0,0))) |
//cout << (coords2.transform(ZPt(1,0,0)) - coords2.transform(ZPt(0,0,0))) |
125 |
// << (coords2.transform(ZPt(0,1,0)) - coords2.transform(ZPt(0,0,0))) << "\\n"; |
// << (coords2.transform(ZPt(0,1,0)) - coords2.transform(ZPt(0,0,0))) << "\n"; |
126 |
|
|
127 |
float bx = border * (cs2inv.transform(ZPt(0,0,0) + xvec) - cs2inv.transform(ZPt(0,0,0))).length(); |
float bx = border * (cs2inv.transform(ZPt(0,0,0) + xvec) - cs2inv.transform(ZPt(0,0,0))).length(); |
128 |
float by = border * (cs2inv.transform(ZPt(0,0,0) + yvec) - cs2inv.transform(ZPt(0,0,0))).length(); |
float by = border * (cs2inv.transform(ZPt(0,0,0) + yvec) - cs2inv.transform(ZPt(0,0,0))).length(); |
129 |
|
|
130 |
//cout << bx << "," << by << "\\n"; |
//cout << bx << "," << by << "\n"; |
131 |
|
|
132 |
float x0 = 1; |
float x0 = 1; |
133 |
float x1 = 1 - bx; |
float x1 = 1 - bx; |
188 |
*/ |
*/ |
189 |
float texf = 0.5; |
float texf = 0.5; |
190 |
|
|
191 |
DBG(dbg_irregularquad) << "Dice: " << dicex << " " << dicey << " " << diceb << "\\n"; |
DBG(dbg_irregularquad) << "Dice: " << dicex << " " << dicey << " " << diceb << "\n"; |
192 |
|
|
193 |
|
if (diceb <= 0 || dicex <= 0 || dicey <= 0) { |
194 |
|
DBG(dbg_irregularquad) << "Skipping IrregularQuad because of invalid geometry\n"; |
195 |
|
return; |
196 |
|
} |
197 |
|
|
198 |
|
glCallList(setup); |
199 |
|
GLERR; |
200 |
|
|
201 |
for (int pass = 0; pass < ((flags & IRREGU_SHIFTS) ? 4 : 1); pass++) { |
for (int pass = 0; pass < ((flags & IRREGU_SHIFTS) ? 4 : 1); pass++) { |
202 |
|
|
274 |
|
|
275 |
glPopAttrib(); |
glPopAttrib(); |
276 |
|
|
277 |
DBG(dbg_irregularquad) << "IrregularQuad done\\n"; |
DBG(dbg_irregularquad) << "IrregularQuad done\n"; |
278 |
} |
} |
279 |
}; |
}; |
280 |
|
|
456 |
|
|
457 |
glPopAttrib(); |
glPopAttrib(); |
458 |
GLERR; |
GLERR; |
459 |
DBG(dbg_irregularquad) << "IrregularEdge done\\n"; |
DBG(dbg_irregularquad) << "IrregularEdge done\n"; |
460 |
} |
} |
461 |
}; |
}; |
462 |
|
|