コード例 #1
0
    def move(self, dt = -1, profile = 0):
        if Mover.Profile and not profile:

            def func(doMove = self.move):
                for i in xrange(10000):
                    doMove(dt, profile=1)

            __builtin__.func = func
            PythonUtil.startProfile(cmd='func()', filename='profile', sorts=['cumulative'], callInfo=0)
            del __builtin__.func
            return
        if Mover.Pstats:
            self.pscCpp.start()
        CMover.processCImpulses(self, dt)
        if Mover.Pstats:
            self.pscCpp.stop()
            self.pscPy.start()
        for impulse in self.impulses.values():
            impulse._process(self.getDt())

        if Mover.Pstats:
            self.pscPy.stop()
            self.pscInt.start()
        CMover.integrate(self)
        if Mover.Pstats:
            self.pscInt.stop()
コード例 #2
0
    def move(self, dt=-1, profile=0):
        if Mover.Profile and not profile:

            def func(doMove=self.move):
                for i in xrange(10000):
                    doMove(dt, profile=1)

            __builtin__.func = func
            PythonUtil.startProfile(cmd='func()',
                                    filename='profile',
                                    sorts=['cumulative'],
                                    callInfo=0)
            del __builtin__.func
            return
        if Mover.Pstats:
            self.pscCpp.start()
        CMover.processCImpulses(self, dt)
        if Mover.Pstats:
            self.pscCpp.stop()
            self.pscPy.start()
        for impulse in self.impulses.values():
            impulse._process(self.getDt())

        if Mover.Pstats:
            self.pscPy.stop()
            self.pscInt.start()
        CMover.integrate(self)
        if Mover.Pstats:
            self.pscInt.stop()
コード例 #3
0
 def __init__(self, objNodePath, fwdSpeed = 1, rotSpeed = 1):
     CMover.__init__(self, objNodePath, fwdSpeed, rotSpeed)
     self.serialNum = Mover.SerialNum
     Mover.SerialNum += 1
     self.VecType = Vec3
     self.impulses = {}
     if Mover.Pstats:
         self.pscCpp = PStatCollector(Mover.PSCCpp)
         self.pscPy = PStatCollector(Mover.PSCPy)
         self.pscInt = PStatCollector(Mover.PSCInt)
コード例 #4
0
 def __init__(self, objNodePath, fwdSpeed=1, rotSpeed=1):
     CMover.__init__(self, objNodePath, fwdSpeed, rotSpeed)
     self.serialNum = Mover.SerialNum
     Mover.SerialNum += 1
     self.VecType = Vec3
     self.impulses = {}
     if Mover.Pstats:
         self.pscCpp = PStatCollector(Mover.PSCCpp)
         self.pscPy = PStatCollector(Mover.PSCPy)
         self.pscInt = PStatCollector(Mover.PSCInt)
コード例 #5
0
 def removeImpulse(self, name):
     if name not in self.impulses:
         if not CMover.removeCImpulse(self, name):
             Mover.notify.warning("Mover.removeImpulse: unknown impulse '%s'" % name)
         return
     self.impulses[name]._clearMover(self)
     del self.impulses[name]
コード例 #6
0
ファイル: Mover.py プロジェクト: perpi06/ttoffline
 def removeImpulse(self, name):
     if name not in self.impulses:
         if not CMover.removeCImpulse(self, name):
             Mover.notify.warning("Mover.removeImpulse: unknown impulse '%s'" % name)
         return
     self.impulses[name]._clearMover(self)
     del self.impulses[name]
コード例 #7
0
ファイル: Mover.py プロジェクト: satire6/Anesidora
    def __init__(self, objNodePath, fwdSpeed=1, rotSpeed=1):
        """objNodePath: nodepath to be moved"""
        CMover.__init__(self, objNodePath, fwdSpeed, rotSpeed)

        self.serialNum = Mover.SerialNum
        Mover.SerialNum += 1

        self.VecType = Vec3
        #self.VecType = PyVec3

        # dict of python impulses
        self.impulses = {}

        if Mover.Pstats:
            self.pscCpp = PStatCollector(Mover.PSCCpp)
            self.pscPy  = PStatCollector(Mover.PSCPy)
            self.pscInt = PStatCollector(Mover.PSCInt)
コード例 #8
0
ファイル: Mover.py プロジェクト: satire6/Anesidora
    def move(self, dt=-1, profile=0):
        # TODO: account for movement that we didn't cause?

        if Mover.Profile and (not profile):
            # profile
            def func(doMove=self.move):
                for i in xrange(10000):
                    doMove(dt, profile=1)
            __builtin__.func = func
            PythonUtil.startProfile(cmd='func()', filename='profile', sorts=['cumulative'], callInfo=0)
            del __builtin__.func
            return

        if Mover.Pstats:
            self.pscCpp.start()

        # do C++ impulses first
        CMover.processCImpulses(self, dt)

        if Mover.Pstats:
            self.pscCpp.stop()
            self.pscPy.start()

        # now do Python impulses
        for impulse in self.impulses.values():
            impulse._process(self.getDt())

        if Mover.Pstats:
            self.pscPy.stop()
            self.pscInt.start()

        # lastly, do the integration
        CMover.integrate(self)

        if Mover.Pstats:
            self.pscInt.stop()
コード例 #9
0
 def addImpulse(self, name, impulse):
     if impulse.isCpp():
         CMover.addCImpulse(self, name, impulse)
     else:
         self.impulses[name] = impulse
         impulse._setMover(self)
コード例 #10
0
 def addImpulse(self, name, impulse):
     if impulse.isCpp():
         CMover.addCImpulse(self, name, impulse)
     else:
         self.impulses[name] = impulse
         impulse._setMover(self)