View Single Post
  #3  
Old 08-26-2009, 04:59 PM
Arandia Arandia is offline
Member
 
Join Date: Aug 2009
Posts: 2
Hi Farshizzo,

Thanks for the response. Fortunately, I think I've found a way to do what I was wanting to do. Turns out the problem wasn't to do with how I was linking the things together; rather, it was that I needed to do a viz.MainWindow.move() command in addition to moving the cave walls to get the effect I needed.

In any case - I noticed that the 'spi' module gives me access to a 'frustum' method, much like viz.MainWindow. And in fact, I've been using the viz.MainWindow.frustum() method directly rather than the cave module. Can I not get a very similar effect for the spi module by simply playing with these clipping planes? Clearly there will be some accuracy issues when projecting things onto the curved Elumens dish, but I'm thinking that some semblance of headtracking is better than none.

Instead of using cave, this is essentially what I'm doing. Edited quite heavily for succinctness and clarity, and in no ways finished yet.
Code:
class bird:
  def __init__(self):
    if DISTORT:
      import spi
      self.window = spi
      self.frustum = {'left':-1, 'right':1, 'bottom':-1, 'top':1, 'near':.1, 'far':100}
    else:
      self.window = viz.MainWindow
      self.frustum = {'left':-.041, 'right':.041, 'bottom':-.0365, 'top':.0365, 'near':.1, 'far':100}

  def modify(self):
    '''This gets called on every screen update...'''
    # Get the data from the Flock of Birds
    pos, ori = self.getData() # This isn't an issue...

    dPos = [FLOCK_SCALE*(pos[i] - self.__lastPos[i]) for i in range(3)]
    dPos[0] *= -1
    dPos[2] *= -1

    self.__lastPos = pos

    # Don't update the view if we just had a sudden jump, like switching hemispheres...
    if max(dPos) > FLOCK_JUMP_LIM or min(dPos) < -FLOCK_JUMP_LIM: return

    # Move the camera in the *opposite* direction...
    viz.MainView.move(*dPos)

    # Account for left/right shifts
    self.frustum['left'] -= FRUSTUM_RATIO*dPos[0]
    self.frustum['right'] -= FRUSTUM_RATIO*dPos[0]
    # Account for up/down shifts
    self.frustum['top'] -= FRUSTUM_RATIO*dPos[1]
    self.frustum['bottom'] -= FRUSTUM_RATIO*dPos[1]
    # Readjust the frustum
    self.window.frustum(**self.frustum)

Last edited by Arandia; 08-26-2009 at 05:07 PM.
Reply With Quote