En Fri, 18 Sep 2009 03:12:46 -0300, rantingrick <rantingr...@gmail.com> escribió:

I am creating geometry with OpenGL. When you create a face you must
specify a winding order (clockwise or counter clockwise) this winding
order controls which side of the face will be visible (since only one
side of a face is rendered). So to create a two sided face you must
create two faces that share the exact same points, BUT have opposite
windings, hence the need to create a face with a "backface" attribute
that contains the mirrored face instance. So now i can move the
frontface around and i have a handy reference to the backface so i can
make it follow!


class Face:
  def __init__(self, pts, nested=True):
   if nested:
     newpts = reverse(pts)
     self.backface = Face(pts, nested=False)
  def translate(self, v):
    #offset front and back face by vector

two sided faces, yippie!

I'd use a factory:

class Face:
  otherside = None
  def __init__(self, pts):
    self.pts = pts

class BiFace(Face):
  otherside = None

def BiFaceFactory(pts):
  front = BiFace(pts)
  back = BiFace(list(reversed(pts)))
  front.otherside = back
  back.otherside = front
  return front, back

And so ends another long day of coding. This is addicting. Does
anybody know of a good Coders Anonymous group, i think i may have an
addiction. 16 hours of strait coding with 4hrs sleep last night and
only stopping for one meal (lunch) still have not ate dinner yet!
Gheez! ;)

Remember, there is a whole world out there!

--
Gabriel Genellina

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to