/[libvob]/libvob/include/vob/irregu/Irregu.hxx
ViewVC logotype

Diff of /libvob/include/vob/irregu/Irregu.hxx

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.2 by jvk, Wed Apr 9 14:47:28 2003 UTC revision 1.3 by tjl, Sat Apr 19 19:37:32 2003 UTC
# Line 35  namespace Vob { Line 35  namespace Vob {
35  // XXX: name  // XXX: name
36  namespace Irregu {  namespace Irregu {
37    
38    PREDBGVAR(dbg_irregu);
39    
40      inline void setDotVec(float angle, int angles, float dotvec[]) {      inline void setDotVec(float angle, int angles, float dotvec[]) {
41          float a = (angle + M_PI) * angles * (1 / M_PI);          float a = (angle + M_PI) * angles * (1 / M_PI);
42          int ind = (int)a;          int ind = (int)a;
# Line 182  namespace Irregu { Line 184  namespace Irregu {
184                const float c0[], const float c1[],                const float c0[], const float c1[],
185                int angles, int multi,                int angles, int multi,
186                unsigned flags) {                unsigned flags) {
187    
188            DBG(dbg_irregu) << "Irregu draw "<<pt.size() <<" "<<norm.size()<<"\n";
189            
190          if (pt.size() < 2) return;          if (pt.size() < 2) return;
191    
# Line 207  namespace Irregu { Line 211  namespace Irregu {
211          }          }
212    
213          if (flags & INSIDE) {          if (flags & INSIDE) {
214                DBG(dbg_irregu) << "Inside\n";
215              colorfv(c0);              colorfv(c0);
216              glBegin(GL_POLYGON);              glBegin(GL_POLYGON);
217              for (unsigned i = 0; i < pt.size(); i++) {              for (unsigned i = 0; i < pt.size(); i++) {
# Line 219  namespace Irregu { Line 224  namespace Irregu {
224          }          }
225    
226          if ((flags & SLICE_2D) && !(flags & SLICE_1D)) {          if ((flags & SLICE_2D) && !(flags & SLICE_1D)) {
227                DBG(dbg_irregu) << "Slice2D\n";
228              glBegin(GL_QUAD_STRIP);              glBegin(GL_QUAD_STRIP);
229              for (unsigned i = 0; i < pt.size(); i++) {              for (unsigned i = 0; i < pt.size(); i++) {
230    
# Line 244  namespace Irregu { Line 250  namespace Irregu {
250          }          }
251                    
252          if (flags & SLICE_1D) {          if (flags & SLICE_1D) {
253                DBG(dbg_irregu) << "Slice1D\n";
254              glBegin(GL_QUADS);              glBegin(GL_QUADS);
255              for (unsigned i = 0, j = 1; j < pt.size(); i++, j++) {              for (unsigned i = 0, j = 1; j < pt.size(); i++, j++) {
256                    DBG(dbg_irregu) << "Slice1D loop "<<i<<" "<<j<<"\n";
257    
258                  ZVec dv0 = vert[i][0] - vert[j][0];                  ZVec dv0 = vert[i][0] - vert[j][0];
259                  ZVec dv1 = vert[i][1] - vert[j][1];                  ZVec dv1 = vert[i][1] - vert[j][1];
# Line 257  namespace Irregu { Line 265  namespace Irregu {
265                  float scale0=0, scale1=0;                  float scale0=0, scale1=0;
266    
267                  if (multi > 0 || (flags & SHIFTS+SHIFTS8)) {                  if (multi > 0 || (flags & SHIFTS+SHIFTS8)) {
268                        DBG(dbg_irregu) << "Slice1D loop opt1\n";
269                      dv0t = vert2[j][0] - vert2[i][0];                      dv0t = vert2[j][0] - vert2[i][0];
270                      dv1t = vert2[j][1] - vert2[i][1];                      dv1t = vert2[j][1] - vert2[i][1];
271    
# Line 293  namespace Irregu { Line 302  namespace Irregu {
302                  if (flags & SHIFTS8) numshifts = 8;                  if (flags & SHIFTS8) numshifts = 8;
303                  for (int s = 0; s < numshifts; s++) {                  for (int s = 0; s < numshifts; s++) {
304                  if (flags & SHIFTS+SHIFTS8) {                  if (flags & SHIFTS+SHIFTS8) {
305                        DBG(dbg_irregu) << "Slice1D loop opt2 "<<
306                            s<<"\n";
307                      switch (s) {                      switch (s) {
308                      case 0: shift0 = scale1 * dv0t.normalized().cw90(); break;                      case 0: shift0 = scale1 * dv0t.normalized().cw90(); break;
309                      case 1: shift0 = scale1 * dv1t.normalized(); break;                      case 1: shift0 = scale1 * dv1t.normalized(); break;
# Line 306  namespace Irregu { Line 317  namespace Irregu {
317                      shift1 = shift0;                      shift1 = shift0;
318                  }                  }
319    
320                    DBG(dbg_irregu) << "Slice1D loop pos 3 \n";
321    
322                  if (flags & DOTVEC_COLOR) {                  if (flags & DOTVEC_COLOR) {
323                        DBG(dbg_irregu) << "Slice1D loop opt3 \n";
324                      float angle = flags & INTERP_DOTVEC ?                      float angle = flags & INTERP_DOTVEC ?
325                          atan2(-norm[i].x, norm[i].y) :                          atan2(-norm[i].x, norm[i].y) :
326                          atan2(pt[j].y - pt[i].y,                          atan2(pt[j].y - pt[i].y,
# Line 343  namespace Irregu { Line 357  namespace Irregu {
357                  vertex(vert2[i][0] + shift0);                  vertex(vert2[i][0] + shift0);
358    
359                  if ((flags & DOTVEC_COLOR) && (flags & INTERP_DOTVEC)) {                  if ((flags & DOTVEC_COLOR) && (flags & INTERP_DOTVEC)) {
360                        DBG(dbg_irregu) << "Slice1D loop opt4 \n";
361                      float angle = atan2(-norm[j].x, norm[j].y);                      float angle = atan2(-norm[j].x, norm[j].y);
362                      float dotvec[4] = {0,0,0,0};                      float dotvec[4] = {0,0,0,0};
363                      setDotVec(angle, angles, dotvec);                      setDotVec(angle, angles, dotvec);

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26