*** empty log message ***

This commit is contained in:
Mike Goslin 2001-03-05 20:41:41 +00:00
parent b3776c71b3
commit 189b58fcd3

View File

@ -8,16 +8,20 @@ class LerpInterval(Interval):
# special methods # special methods
def __init__(self, name, duration, functor, blendType='noBlend'): def __init__(self, name, duration, functorFunc, blendType='noBlend'):
"""__init__(name, duration, functor, blendType) """__init__(name, duration, functorFunc, blendType)
""" """
self.lerp = Lerp.Lerp(functor, duration, self.__getBlend(blendType)) self.functorFunc = functorFunc
self.blendType = self.__getBlend(blendType)
Interval.__init__(self, name, duration) Interval.__init__(self, name, duration)
def setT(self, t, entry=0): def setT(self, t, entry=0):
""" setT(t) """ setT(t)
""" """
assert(t >= 0.0) assert(t >= 0.0)
if (entry == 1):
self.lerp = Lerp.Lerp(self.functorFunc(), self.duration,
self.blendType)
if (entry == 1) and (t > self.duration): if (entry == 1) and (t > self.duration):
self.lerp.setT(self.duration) self.lerp.setT(self.duration)
else: else:
@ -50,26 +54,29 @@ class LerpPosHprInterval(LerpInterval):
""" __init__(node, duration, pos, hpr, startPos, startHpr, """ __init__(node, duration, pos, hpr, startPos, startHpr,
other, blendType, name) other, blendType, name)
""" """
import PosHprLerpFunctor def functorFunc(self=self, node=node, pos=pos, hpr=hpr,
startPos=startPos, startHpr=startHpr, other=other):
import PosHprLerpFunctor
assert(not node.isEmpty()) assert(not node.isEmpty())
if (other != None): if (other != None):
# lerp wrt other # lerp wrt other
if (startPos == None): if (startPos == None):
startPos = node.getPos(other) startPos = node.getPos(other)
if (startHpr == None): if (startHpr == None):
startHpr = node.getHpr(other) startHpr = node.getHpr(other)
functor = PosHprLerpFunctor.PosHprLerpFunctor( functor = PosHprLerpFunctor.PosHprLerpFunctor(
node, startPos, pos, node, startPos, pos,
startHpr, hpr, other) startHpr, hpr, other)
else: else:
if (startPos == None): if (startPos == None):
startPos = node.getPos() startPos = node.getPos()
if (startHpr == None): if (startHpr == None):
startHpr = node.getHpr() startHpr = node.getHpr()
functor = PosHprLerpFunctor.PosHprLerpFunctor( functor = PosHprLerpFunctor.PosHprLerpFunctor(
node, startPos, pos, node, startPos, pos,
startHpr, hpr) startHpr, hpr)
return functor
if (name == None): if (name == None):
n = 'LerpPosHpr-%d' % self.lerpPosHprNum n = 'LerpPosHpr-%d' % self.lerpPosHprNum
@ -77,7 +84,7 @@ class LerpPosHprInterval(LerpInterval):
else: else:
n = name n = name
LerpInterval.__init__(self, n, duration, functor, blendType) LerpInterval.__init__(self, n, duration, functorFunc, blendType)
class LerpPosInterval(LerpInterval): class LerpPosInterval(LerpInterval):
@ -88,20 +95,23 @@ class LerpPosInterval(LerpInterval):
other=None, blendType='noBlend', name=None): other=None, blendType='noBlend', name=None):
""" __init__(node, duration, pos, startPos, other, blendType, name) """ __init__(node, duration, pos, startPos, other, blendType, name)
""" """
import PosLerpFunctor def functorFunc(self=self, node=node, pos=pos, startPos=startPos,
other=other):
import PosLerpFunctor
assert(not node.isEmpty()) assert(not node.isEmpty())
if (other != None): if (other != None):
# lerp wrt other # lerp wrt other
if (startPos == None): if (startPos == None):
startPos = node.getPos(other) startPos = node.getPos(other)
functor = PosLerpFunctor.PosLerpFunctor( functor = PosLerpFunctor.PosLerpFunctor(
node, startPos, pos, other) node, startPos, pos, other)
else: else:
if (startPos == None): if (startPos == None):
startPos = node.getPos() startPos = node.getPos()
functor = PosLerpFunctor.PosLerpFunctor( functor = PosLerpFunctor.PosLerpFunctor(
node, startPos, pos) node, startPos, pos)
return functor
if (name == None): if (name == None):
n = 'LerpPos-%d' % self.lerpPosNum n = 'LerpPos-%d' % self.lerpPosNum
@ -109,7 +119,7 @@ class LerpPosInterval(LerpInterval):
else: else:
n = name n = name
LerpInterval.__init__(self, n, duration, functor, blendType) LerpInterval.__init__(self, n, duration, functorFunc, blendType)
class LerpHprInterval(LerpInterval): class LerpHprInterval(LerpInterval):
@ -119,22 +129,23 @@ class LerpHprInterval(LerpInterval):
other=None, blendType='noBlend', name=None): other=None, blendType='noBlend', name=None):
""" __init__(node, duration, hpr, startHpr, other, blendType, name) """ __init__(node, duration, hpr, startHpr, other, blendType, name)
""" """
import HprLerpFunctor def functorFunc(self=self, node=node, hpr=hpr, startHpr=startHpr,
other=other):
import HprLerpFunctor
assert(not node.isEmpty()) assert(not node.isEmpty())
if (other != None): if (other != None):
# lerp wrt other # lerp wrt other
if (startHpr == None): if (startHpr == None):
startHpr = node.getHpr(other) startHpr = node.getHpr(other)
functor = HprLerpFunctor.HprLerpFunctor( functor = HprLerpFunctor.HprLerpFunctor(
node, startHpr, hpr, other) node, startHpr, hpr, other)
else: else:
if (startHpr == None): if (startHpr == None):
startHpr = node.getHpr() startHpr = node.getHpr()
self.fhpr = startHpr functor = HprLerpFunctor.HprLerpFunctor(
self.thpr = hpr
functor = HprLerpFunctor.HprLerpFunctor(
node, startHpr, hpr) node, startHpr, hpr)
return functor
if (name == None): if (name == None):
n = 'LerpHpr-%d' % self.lerpHprNum n = 'LerpHpr-%d' % self.lerpHprNum
@ -142,4 +153,4 @@ class LerpHprInterval(LerpInterval):
else: else:
n = name n = name
LerpInterval.__init__(self, n, duration, functor, blendType) LerpInterval.__init__(self, n, duration, functorFunc, blendType)