Browse Source

*** empty log message ***

Mike Goslin 25 years ago
parent
commit
e88ae413d0
2 changed files with 26 additions and 28 deletions
  1. 4 1
      direct/src/interval/IntervalTest.py
  2. 22 27
      direct/src/interval/LerpInterval.py

+ 4 - 1
direct/src/interval/IntervalTest.py

@@ -31,7 +31,10 @@ dockLerp = LerpPosHprInterval('lerp', dock, pos, hpr, 5.0)
 dockPos = PosHprInterval('dockpos', dock, dock.getPos(), dock.getHpr(), 1.0)
 dockPos = PosHprInterval('dockpos', dock, dock.getPos(), dock.getHpr(), 1.0)
 dockUpTime = BOAT_END - dockLerp.getDuration()
 dockUpTime = BOAT_END - dockLerp.getDuration()
 dockLerp.setStartTime(dockUpTime, TRACK_START)
 dockLerp.setStartTime(dockUpTime, TRACK_START)
-dockTrack = Track.Track([dockPos, dockLerp], 'docktrack')
+hpr2 = Vec3(90.0, 90.0, 90.0)
+dockLerp2 = LerpHprInterval('hpr-lerp', dock, hpr2, 3.0)
+dockLerp2.setStartTime(BOAT_START, TRACK_START)
+dockTrack = Track.Track([dockLerp2, dockPos, dockLerp], 'docktrack')
 
 
 # Start the water sound 5 seconds after the boat starts moving
 # Start the water sound 5 seconds after the boat starts moving
 waterStartTime = BOAT_START + 5.0
 waterStartTime = BOAT_START + 5.0

+ 22 - 27
direct/src/interval/LerpInterval.py

@@ -7,12 +7,11 @@ class LerpInterval(Interval.Interval):
 
 
     # special methods
     # special methods
     
     
-    def __init__(self, name, node, duration, functor, t0=0.0, 
+    def __init__(self, name, duration, functor, t0=0.0, 
 			type=Interval.PREVIOUS_END, blendType='noBlend'):
 			type=Interval.PREVIOUS_END, blendType='noBlend'):
-        """__init__(name, node, duration, functor, t0, type, blendType)
+        """__init__(name, duration, functor, t0, type, blendType)
         """
         """
 	self.name = name
 	self.name = name
-	self.node = node	
 	self.duration = duration
 	self.duration = duration
 	self.startTime = t0
 	self.startTime = t0
 	self.type = type
 	self.type = type
@@ -54,24 +53,22 @@ class LerpPosHprInterval(LerpInterval):
 	"""
 	"""
         import PosHprLerpFunctor
         import PosHprLerpFunctor
 
 
-	self.node = node
-	self.pos = pos
-	self.hpr = hpr
+	assert(not node.isEmpty())
         if (other != None):
         if (other != None):
             # lerp wrt other
             # lerp wrt other
-            startPos = self.node.getPos(other)
-            startHpr = self.node.getHpr(other)
+            startPos = node.getPos(other)
+            startHpr = node.getHpr(other)
             functor = PosHprLerpFunctor.PosHprLerpFunctor(
             functor = PosHprLerpFunctor.PosHprLerpFunctor(
-                    self.node, startPos, pos,
+                    node, startPos, pos,
                     startHpr, hpr, other)
                     startHpr, hpr, other)
         else:
         else:
-            startPos = self.node.getPos()
-            startHpr = self.node.getHpr()
+            startPos = node.getPos()
+            startHpr = node.getHpr()
             functor = PosHprLerpFunctor.PosHprLerpFunctor(
             functor = PosHprLerpFunctor.PosHprLerpFunctor(
-                    self.node, startPos, pos,
+                    node, startPos, pos,
                     startHpr, hpr)
                     startHpr, hpr)
 
 
-	LerpInterval.__init__(self, name, node, duration, functor, t0, 
+	LerpInterval.__init__(self, name, duration, functor, t0, 
 						type, blendType)
 						type, blendType)
 
 
 
 
@@ -83,19 +80,18 @@ class LerpPosInterval(LerpInterval):
 	"""
 	"""
         import PosLerpFunctor
         import PosLerpFunctor
 
 
-	self.node = node
-	self.pos = pos
+	assert(not node.isEmpty())
         if (other != None):
         if (other != None):
             # lerp wrt other
             # lerp wrt other
-            startPos = self.node.getPos(other)
+            startPos = node.getPos(other)
             functor = PosLerpFunctor.PosLerpFunctor(
             functor = PosLerpFunctor.PosLerpFunctor(
-                    self.node, startPos, pos, other)
+                    node, startPos, pos, other)
         else:
         else:
-            startPos = self.node.getPos()
+            startPos = node.getPos()
             functor = PosLerpFunctor.PosLerpFunctor(
             functor = PosLerpFunctor.PosLerpFunctor(
-                    self.node, startPos, pos)
+                    node, startPos, pos)
 
 
-	LerpInterval.__init__(self, name, node, duration, functor, t0, 
+	LerpInterval.__init__(self, name, duration, functor, t0, 
 							type, blendType)
 							type, blendType)
 
 
 class LerpHprInterval(LerpInterval):
 class LerpHprInterval(LerpInterval):
@@ -106,17 +102,16 @@ class LerpHprInterval(LerpInterval):
 	"""
 	"""
         import HprLerpFunctor
         import HprLerpFunctor
 
 
-	self.node = node
-	self.hpr = hpr
+	assert(not node.isEmpty())
         if (other != None):
         if (other != None):
             # lerp wrt other
             # lerp wrt other
-            startHpr = self.node.getHpr(other)
+            startHpr = node.getHpr(other)
             functor = HprLerpFunctor.HprLerpFunctor(
             functor = HprLerpFunctor.HprLerpFunctor(
-                    self.node, startHpr, hpr, other)
+                    node, startHpr, hpr, other)
         else:
         else:
-            startHpr = self.node.getHpr()
+            startHpr = node.getHpr()
             functor = HprLerpFunctor.HprLerpFunctor(
             functor = HprLerpFunctor.HprLerpFunctor(
-                    self.node, startHpr, hpr)
+                    node, startHpr, hpr)
 
 
-	LerpInterval.__init__(self, name, node, duration, functor, t0, 
+	LerpInterval.__init__(self, name, duration, functor, t0, 
 							type, blendType)
 							type, blendType)