示例#1
1
文件: esp.py 项目: powergun/EHF
    def _run(self):
        # delayed init
        self.delayedInit()
        
        # figure out the time interval
        worldTransform = ehfmaths_functions.getIdMatrix()
        viewTransform = ehfmaths_functions.getViewMatrix(
                                                         self.appVars["upVec"], 
                                                         self.appVars["rightVec"], 
                                                         self.appVars["forwardVec"], 
                                                         self.appVars["viewOrigin"]
                                                         )
        viewOrigin = self.appVars["viewOrigin"].toPointVector4()
        
        if not self.miniMap:
            self.miniMap = widgets.SimpleMiniMap( 
                 # location control
                 centerX=200, centerY=200, boundaryX=160, boundaryY=160,
                 # color/drawing style
                 borderWidth=3, lineWidth=3, selfColor=0xFF00FF00, teamColor=0xFF1111FF, enemyColor=0xFFFF1111, boundaryColor=0xFFFF1111,
                 # size/scale control
                 scale=2, spotSize=3,
                 # other attributes
                 vecForward=self.appVars["forwardVec"]
                 )
        else:
            self.miniMap.setVecForward(self.appVars["forwardVec"])
            self.miniMap.setViewAxisZ(self.appVars["forwardVec"])

        self.miniMap.drawBoundary(self.getLine())
        self.miniMap.drawSelf(self.getLine())
        
        projectionTransform = ehfmaths_functions.getProjectionMatrix(
                                                                     self.appVars["zn"], 
                                                                     self.appVars["zf"], 
                                                                     self.appVars["fov_x"], 
                                                                     self.appVars["fov_y"]
                                                                     )
        
        hintColor = 0xFFFF11FF
        
        # loop through simple player objects
        for player in self.appVars["players"]:
            # don't draw "self"
            if player.address == self.appVars["localPlayerAddress"]:
                continue
            
            # skip team players
            if player.teamId == self.appVars["localPlayerTeamId"]:
                continue
                
            if not self._validatePlayer(player):
                continue
            
            _color = self.colorTeammate if player.teamId == self.appVars["localPlayerTeamId"] \
                                        else self.colorEnemy
            pos4 = player.position.toPointVector4()
            pos4TankAimAssist = player.position.toPointVector4()
            
            distant = (pos4 - viewOrigin)._length()
            deltaY = pos4.y - viewOrigin.y
            
            _posV = pos4.multToMat(worldTransform).multToMat(viewTransform)
            _posVP = _posV.multToMat(projectionTransform)
            _posV.x *= -1
            
            # ----------------get bullet drop
            aimCompensationY = naiveGetBulletDrop(distant, deltaY, GRAVITY, SPEED)
            # ----------------done getting bullet drop
            
            pos4TankAimAssist.y += aimCompensationY 
            posVTankAimAssist = pos4TankAimAssist.multToMat(worldTransform).multToMat(viewTransform)
            posVTankAimAssist = posVTankAimAssist.multToMat(projectionTransform)
            
            self.miniMap.drawPlayer(self.getLine(), _posV, player.teamId == self.appVars["localPlayerTeamId"])

            if abs(_posVP.w) < 0.001:
                continue
            if _posVP.z > 0:
                continue
            x = self.screenCenterX*(1+_posVP.x/_posVP.w)
            y = self.screenCenterY*(1+_posVP.y/_posVP.w)
            
            xAim = self.screenCenterX*(1+posVTankAimAssist.x/posVTankAimAssist.w)
            yAim = self.screenCenterY*(1+posVTankAimAssist.y/posVTankAimAssist.w)
            
            
            # ---------- draw player distance hint text ---------
            if player.teamId != self.appVars["localPlayerTeamId"]:
                ehfgraphics.drawStringLeft(self.getFont(), 
                                           x+5, 
                                           y+5, 
                                           10, 
                                           40, 
                                           _color, 
                                           "%0.1f" % distant)

            # ---------- draw a spot for tank aim assist -----------
                ehfgraphics.drawSpot(self.getLine(),
                                     xAim,
                                     yAim, 
                                     _color,
                                     size=1.5)
                
                ehfgraphics.drawLine(self.getLine(), x , y, xAim-x, yAim-y, 0.5, color=_color)
                
            # ---------- draw boxed esp -------------
            _width, _height = self.getWidthHeight(distant)
            if player.poseType:
                y = y + _height/2.0
            x = x - _width/2.0
            ehfgraphics.drawBox(self.getLine(), 
                                x, 
                                y, 
                                _width, 
                                _height, 
                                2, 
                                _color)
示例#2
0
文件: tests.py 项目: powergun/EHF
def simpleTest1():
    proj = ehfmaths_functions.getProjectionMatrix(nz=0.06, fz=2000.0601, fovH=1.2870, fovV=1.8546)
    print proj
#    idMat = SimpleMatrix()
#    idMat.setM(0,0,1.0)
#    idMat.setM(1,1,1.0)
#    idMat.setM(2,2,1.0)
#    idMat.setM(3,3,1.0)
    a = VECTOR3(0.0, 0.0, 1.0)
    b = VECTOR3(1.0, 0.0, 0.0)
    #   0.0       0.0       0.0    1.0000    0.9177       0.0   -0.3972       0.0
    #   -0.0366    0.9957   -0.0847       0.0    0.3955    0.0923    0.9138       0.0
    #   -123.5014   60.9055 -183.5093       0.0       0.0       inf    1.2870    0.9599
    upVec = VECTOR3(-0.0366,    0.9957,   -0.0847)
    forwardVec = VECTOR3(0.3955,    0.0923,    0.9138)
    transVec = VECTOR3(-123.5014,   60.9055, -183.5093)
    #print x
    #print y
    #print z
    viewM = ehfmaths_functions.getViewMatrix(forwardVec, transVec, upVec)
    print "\n\n", viewM
    
    print "\n\n", proj.multTo(viewM)
示例#3
0
文件: esp.py 项目: powergun/EHF
    def _run(self):
        # delayed init
        self.delayedInit()
        worldTransform = ehfmaths_functions.getIdMatrix()
        viewTransform = ehfmaths_functions.getViewMatrix(
                                                         self.appVars["upVec"], 
                                                         self.appVars["rightVec"], 
                                                         self.appVars["forwardVec"], 
                                                         self.appVars["viewOrigin"]
                                                         )
        
        if not self.miniMap:
            self.miniMap = widgets.SimpleMiniMap( 
                 # location control
                 centerX=200, centerY=200, boundaryX=160, boundaryY=160,
                 # color/drawing style
                 borderWidth=3, lineWidth=3, selfColor=0xFF00FF00, teamColor=0xFF1111FF, enemyColor=0xFFFF1111, boundaryColor=0xFFFF1111,
                 # size/scale control
                 scale=2, spotSize=3,
                 # other attributes
                 vecForward=self.appVars["forwardVec"]
                 )
        else:
            self.miniMap.setVecForward(self.appVars["forwardVec"])
            self.miniMap.setViewAxisZ(self.appVars["forwardVec"])

        self.miniMap.drawBoundary(self.getLine())
        self.miniMap.drawSelf(self.getLine())
        
        projectionTransform = ehfmaths_functions.getProjectionMatrix(
                                                                     self.appVars["zn"], 
                                                                     self.appVars["zf"], 
                                                                     self.appVars["fov_x"], 
                                                                     self.appVars["fov_y"]
                                                                     )

        # loop through simple player objects
        for player in self.appVars["players"]:
            # don't draw "self"
            if player.address == self.appVars["localPlayerAddress"]:
                continue
            
            if not self._validatePlayer(player):
                continue
            _color = self.colorTeammate if player.teamId == self.appVars["localPlayerTeamId"] \
                                        else self.colorEnemy
            pos4 = player.position.toPointVector4()
            _posV = pos4.multToMat(worldTransform).multToMat(viewTransform)
            _posVP = _posV.multToMat(projectionTransform)
            _posV.x = _posV.x * -1
            self.miniMap.drawPlayer(self.getLine(), _posV, player.teamId == self.appVars["localPlayerTeamId"])

            if abs(_posVP.w) < 0.001:
                continue
            if _posVP.z > 0:
                continue
            x = self.screenCenterX*(1+_posVP.x/_posVP.w)
            y = self.screenCenterY*(1+_posVP.y/_posVP.w)
            ehfgraphics.drawSpot(self.getLine(),
                                 x,
                                 y, 
                                 _color,
                                 size=4)