Beispiel #1
0
 def timer_func(self, value):
     if self.bAnimate:
         curr_time = time.clock()
         elapsed_time = (curr_time - self.prev_time) * 1000.
         if(elapsed_time >= self.animation_timer_ms):
             self.animate_view()
             self.prev_time = curr_time
             
     if(hasattr(View, 'timer_func')):
         View.timer_func(self, value)
Beispiel #2
0
 def keyboard(self, key, x, y):
     ''' 
     Since FlythroughCamera is a child of GLUTWindow, this function will get
     called whenever there's a keyboard event.
     '''
     if key == 'p' or key == 'P':
         self.add_keyframe()
     elif key == 'g' or key == 'G':
         if self.NSeg < 1:
             self.bAnimate = False
         else:
             self.bAnimate = not self.bAnimate
         self.reset_position()
     elif key == 'c' or key == 'C':
         self.init_flythrough()
     # if View class happens to implement any keyboard functionality then
     # call it as well.
     if(hasattr(View, 'keyboard')):
         View.keyboard(key, x, y)    
Beispiel #3
0
 def __init__(self, child, camera_spec, path_model, num_steps = 101, MAX_FPS = 40):
     View.__init__(self, child, camera_spec)
     self.path_model = path_model
     self.num_steps = num_steps
     self.MAX_FPS = MAX_FPS
     self.init_flythrough()
Beispiel #4
0
 def draw_camera_frame(self):
     View.draw_camera_frame(self)
     if self.NSeg > 0:
         self.path_model.draw_scene(False)