Beispiel #1
0
   def step(self):
      x,y,z = self.vortex.step()

      self.points.append([x, y, z-self.height])
      self.points.append([x, y, z+self.height])
      self.points.pop(0)
      self.points.pop(0)   # need pop twice (empirically)

      self.buffer = Buffer(self.points)
      self.buffer.loadTexCoordData(self.coords)
      self.buffer.renderMode('triangles:strip')
Beispiel #2
0
   def __init__(self, lifetime):
      BaseParticle.__init__(self, lifetime, None)

      points, texcoords = Vortex.image_strip()
      self.dream = Buffer(points)
      self.dream.loadTexCoordData(texcoords)
      self.dream.renderMode('triangles:strip')

      self.texture = get_dream()

      self.color = [1.0, 1.0, 1.0, 0.0]
Beispiel #3
0
class DreamImage(BaseParticle):
   
   def __init__(self, lifetime):
      BaseParticle.__init__(self, lifetime, None)

      points, texcoords = Vortex.image_strip()
      self.dream = Buffer(points)
      self.dream.loadTexCoordData(texcoords)
      self.dream.renderMode('triangles:strip')

      self.texture = get_dream()

      self.color = [1.0, 1.0, 1.0, 0.0]

   def step(self):
      #self.vortex.step()
      if self.age < 150:
         self.color[3] += 1.0/150.0
      elif (self.lifetime - self.age) < 150:
         self.color[3] -= 1.0/150.0

   def draw(self):
      color(self.color)
      self.texture.bind()
      self.dream.draw(style='solid')
      self.texture.unbind()
Beispiel #4
0
   def step(self):
      x,y,z = self.vortex.step()
      
      self.points.append([x, y, z-self.height])
      self.points.append([x, y, z+self.height])
      self.points.pop(0)
      self.points.pop(0)   # need pop twice to remove the last two points

      self.buffer = Buffer(self.points)
      self.buffer.loadTexCoordData(self.coords)
      self.buffer.renderMode('triangles:strip')
      
      self.age += 1
Beispiel #5
0
class BrushStroke(BaseParticle):
   
   def __init__(self, lifetime, vortex):
      BaseParticle.__init__(self, lifetime, vortex)

      self.points = []
      self.coords = []

      self.history = randint(15, 30)
      self.height = uniform(0.5, 3.25)

      c = random()
      self.color = [c, c, c, 1.0]

      self.initialize()
      self.step()

   def initialize(self):
      r = self.vortex.a + self.vortex.b * self.vortex.theta
      x = r * cos(self.vortex.theta)
      y = r * sin(self.vortex.theta)

      x = 0.0
      dx = 1.0 / self.history

      for _ in range(self.history):
         self.points.append([x, y, -self.height])
         self.points.append([x, y,  self.height])

         self.coords.append([x, 0.0])
         self.coords.append([x, 1.0])
         x += dx

      self.points.append([x, y, -self.height])
      self.points.append([x, y,  self.height])

      self.coords.append([1.0, 0.0])
      self.coords.append([1.0, 1.0])

   def step(self):
      x,y,z = self.vortex.step()

      self.points.append([x, y, z-self.height])
      self.points.append([x, y, z+self.height])
      self.points.pop(0)
      self.points.pop(0)

      self.buffer = Buffer(self.points)
      self.buffer.loadTexCoordData(self.coords)
      self.buffer.renderMode('triangles:strip')

   def draw(self):
      if self.age < self.history:
         return
      color(self.color)
      self.buffer.draw(style='solid')
Beispiel #6
0
   def __init__(self, lifetime):
      BaseItem.__init__(self, lifetime, None)

      points, texcoords = Vortex.image_strip()
#      print len(points)
      delta_x = -points[6][0] + randrange(-10,10)   #- points[7][0]
      delta_y = -points[6][1] + randrange(-10,10)   #- points[7][1]
      delta_z = - points[0][2]   
      
      # Added to move dreams down in the space - messes up rendering w/ vortex
      for i in range(len(points)):
         points[i][0] = points[i][0] + delta_x
         points[i][1] = points[i][1] + delta_y
         points[i][2] = points[i][2] + delta_z
      
      self.dream = Buffer(points)
      self.dream.loadTexCoordData(texcoords)
      self.dream.renderMode('triangles:strip')

      self.texture = get_dream()

      self.color = [1.0, 1.0, 1.0, 0.0]
Beispiel #7
0
class DreamImage(BaseItem):
   
   def __init__(self, lifetime):
      BaseItem.__init__(self, lifetime, None)

      points, texcoords = Vortex.image_strip()
#      print len(points)
      delta_x = -points[6][0] + randrange(-10,10)   #- points[7][0]
      delta_y = -points[6][1] + randrange(-10,10)   #- points[7][1]
      delta_z = - points[0][2]   
      
      # Added to move dreams down in the space - messes up rendering w/ vortex
      for i in range(len(points)):
         points[i][0] = points[i][0] + delta_x
         points[i][1] = points[i][1] + delta_y
         points[i][2] = points[i][2] + delta_z
      
      self.dream = Buffer(points)
      self.dream.loadTexCoordData(texcoords)
      self.dream.renderMode('triangles:strip')

      self.texture = get_dream()

      self.color = [1.0, 1.0, 1.0, 0.0]
         
#      self.dream.move_to([0.,0.,0.])

   def step(self):
      #self.vortex.step()
      
      # The following lines fade in and out the dreams
      if self.age < 150:
         self.color[3] += 1.0/150.0
      elif (self.lifetime - self.age) < 150:
         self.color[3] -= 1.0/150.0
         
#      self.dream.move_to([0.,0.,0.])


   def draw(self):
      color(self.color)
      self.texture.bind()
      self.dream.draw(style='solid')
      self.texture.unbind()
Beispiel #8
0
class Emblem(BaseItem):
   
   def __init__(self, lifetime, vortex):
      BaseItem.__init__(self, lifetime, vortex)

      self.points = []
      self.coords = []

      self.history = 20
      self.height = 1.
      
      self.color = [1., 1., 1.]   
      
      # Puts a random dream on the emblem
      self.texture = get_emblem()
      
      self.vortex.a = 1.      # to put the emblem in the middle of the vortex
      self.vortex.b = 0
      self.vortex.z_step = self.vortex.z_step/5.         # to make it rise slowly
      self.vortex.theta_step = self.vortex.theta_step/2. # to make it rise slowly

      self.initialize()
      self.step()     # This step() results in self.buffer() being defined
      self.vortex.a = 1.      # to put the emblem in the middle of the vortex

   def initialize(self):

      x_tex = 0.0                                  #orig x
      dx = 1.0 / self.history
      theta_step = settings['delta-theta']         #added
      
      # z_b, z_t used to place the strip below the floor & have it emerge
      z_step = self.vortex.z_step
      z_b = -2*self.height - (self.history * z_step)
      z_t = -self.history * z_step

      for _ in range(self.history):
         r = self.vortex.a + self.vortex.b * self.vortex.theta #added
         x = r * cos(self.vortex.theta)                        #added
         y = r * sin(self.vortex.theta)                        #added
         
         self.points.append([x, y, z_b])             #orig z = -self.height
         self.points.append([x, y, z_t])             #orig z = self.height

         self.coords.append([x_tex, 0.0])          #orig used x
         self.coords.append([x_tex, 1.0])
         
         x_tex += dx
         self.vortex.theta += theta_step           #added
         z_b += z_step
         z_t += z_step

      self.points.append([x, y, z_b])              #orig z = -self.height
      self.points.append([x, y, z_t])              #orig z = self.height

      self.coords.append([1.0, 0.0])
      self.coords.append([1.0, 1.0])
      
      self.vortex.pos[2] = - self.height
#      print self.points[0], self.points[1]

   def step(self):
      x,y,z = self.vortex.step()

      self.points.append([x, y, z-self.height])
      self.points.append([x, y, z+self.height])
      self.points.pop(0)
      self.points.pop(0)   # need pop twice (empirically)

      self.buffer = Buffer(self.points)
      self.buffer.loadTexCoordData(self.coords)
      self.buffer.renderMode('triangles:strip')

   def draw(self):
         
      color(self.color)
      self.buffer.draw(style='solid')
Beispiel #9
0
class ParticleTrail:
   def __init__(self, lifetime, vortex):
      self.lifetime = lifetime
      self.vortex = vortex

      self.points = []
      self.coords = []

      self.age = 0

      self.history = randint(15, 30)
      self.height = uniform(0.5, 3.25)

      c = random()
      self.color = [c, c, c, 0.4]

      self.initialize()
      self.step()

   def initialize(self):
      r = self.vortex.a + self.vortex.b * self.vortex.theta
      x = r * cos(self.vortex.theta)
      y = r * sin(self.vortex.theta)

      x = 0.0
      dx = 1.0 / self.history

      for _ in range(self.history):
         self.points.append([x, y, -self.height])
         self.points.append([x, y,  self.height])

         self.coords.append([x, 0.0])
         self.coords.append([x, 1.0])
         x += dx

      self.points.append([x, y, -self.height])
      self.points.append([x, y,  self.height])

      self.coords.append([1.0, 0.0])
      self.coords.append([1.0, 1.0])

   def expired(self):
      return self.age > self.lifetime

   def step(self):
      x,y,z = self.vortex.step()

      self.points.append([x, y, z-self.height])
      self.points.append([x, y, z+self.height])
      self.points.pop(0)
      self.points.pop(0)

      self.buffer = Buffer(self.points)
      self.buffer.loadTexCoordData(self.coords)
      self.buffer.renderMode('triangles:strip')

   def draw(self):
      if self.age < self.history:
         return
      color(self.color)
      self.buffer.draw(style='solid')

   @staticmethod
   def RandomParticleTrail():
      return ParticleTrail(randint(400, 550), Vortex.random_vortex())
Beispiel #10
0
class Strip(BaseItem):
   
   def __init__(self):
      
      lifetime = randint(300, 400)
      vortex = Vortex.random_vortex()
      
      BaseItem.__init__(self, lifetime, vortex)

      self.points = []
      self.coords = []

      self.history = randint(15, 30)
      self.height = uniform(0.5, 3.25)
 
      c = uniform(0.0005, 0.8)   # 0.0001 to 0.8 for vortex
      self.color = [c, c, c, 1.0]   # gives the strips various intensities
            
      # Initializes the texture (for donna's as well)
      try:
         self.texture = get_strip()
      except:
         self.texture = get_dancer()
         
      self.initialize()
      self.step()     # This step() results in self.buffer() being defined
      
      self.transforms = [[0.,0.,0.],[0.,0.,0.],1.]
      self.pos = [0.,0.,0.]

   def initialize(self):

      x_tex = 0.0                            # used for texture mapping
      dx = 1.0 / self.history                # incremental step between texture coords
      theta_step = settings['delta-theta']   # incremental step in angle
      
      # reassign z-value to below the floor
      z_step = self.vortex.z_step
      self.vortex.pos[2] = -self.height
            
      # z_b, z_t describe the bottom and top of the strip, respectively
      z_b = self.vortex.pos[2] - self.height - ((self.history+1) * z_step)
      z_t = self.vortex.pos[2] + self.height - ((self.history+1) * z_step)

      for i in range(self.history+1):
         r = self.vortex.a + self.vortex.b * self.vortex.theta # radius
         x = r * cos(self.vortex.theta)                        # x-position
         y = r * sin(self.vortex.theta)                        # y-position
         
         self.points.append([x, y, z_b])     # append location of strip points
         self.points.append([x, y, z_t])

         self.coords.append([x_tex, 0.0])    # append texture coordinates
         self.coords.append([x_tex, 1.0])
         
         x_tex += dx                         # increment texture coordinate
         self.vortex.theta += theta_step     # increment vortex angle
         z_b += z_step                       # increment vertical position
         z_t += z_step
         
   def step(self):
      x,y,z = self.vortex.step()
      
      self.points.append([x, y, z-self.height])
      self.points.append([x, y, z+self.height])
      self.points.pop(0)
      self.points.pop(0)   # need pop twice to remove the last two points

      self.buffer = Buffer(self.points)
      self.buffer.loadTexCoordData(self.coords)
      self.buffer.renderMode('triangles:strip')
      
      self.age += 1

   def draw(self):
      transparency(True)      # should be True for vortex

      glBlendFunc(GL_SRC_ALPHA, GL_ONE); 

      # the following 3 lines are necessary to get backs drawn on strips
      glDepthMask(GL_FALSE)     
      glDisable(GL_CULL_FACE)
      glCullFace(GL_BACK)
      
      self.texture.bind()
      color(self.color)
      self.buffer.draw(style='solid')
      self.texture.unbind()