bug in ... X_GETFACE example?

Previous topic - Next topic

bigsofty

Code (glbasic) Select
LOCAL face[]
   X_LOADOBJ "wumbo.ddd", 0

   X_MAKE3D 1,500,45
   X_CAMERA 10,2,-1, 0,2,0
   X_DRAWOBJ 0, 2
   count = X_NUMFACES(0)
   FOR i=0 TO count-1
      X_GETFACE 0, 2, i, face[]
      // face[node 0..2][x,y,z,tx,ty,col]
      X_LINE face[0][0], face[0][1], face[0][2], face[1][0], face[1][1], face[1][2], 4, RGB(0,0,255)
      X_LINE face[2][0], face[2][1], face[2][2], face[1][0], face[1][1], face[1][2], 4, RGB(0,0,255)
      X_LINE face[0][0], face[0][1], face[0][2], face[2][0], face[2][1], face[2][2], 4, RGB(0,0,255)
     
      X_DOT face[0][0], face[0][1], face[0][2], 8, RGB(0,255,0)
      X_DOT face[1][0], face[1][1], face[1][2], 8, RGB(0,255,0)
      X_DOT face[2][0], face[2][1], face[2][2], 8, RGB(0,255,0)
   NEXT

   SHOWSCREEN
   MOUSEWAIT
This line ...
Code (glbasic) Select
  FOR i=0 TO count-1needs to be changed to...
Code (glbasic) Select
  FOR i=0 TO count-1 STEP 3Run it, you can see the difference... could be revealing a bug, as there not strictly dealing with faces...?
Cheers,

Ian.

"It is practically impossible to teach good programming style to students that have had prior exposure to BASIC.  As potential programmers, they are mentally mutilated beyond hope of regeneration."
(E. W. Dijkstra)

Kitty Hello

Perfeclty right. Thanks a lot for pointing it out.

bigsofty

No problem, Gernot, X_GETFACE is a great little function for sniffing around a model.
Cheers,

Ian.

"It is practically impossible to teach good programming style to students that have had prior exposure to BASIC.  As potential programmers, they are mentally mutilated beyond hope of regeneration."
(E. W. Dijkstra)