本文整理汇总了Python中Camera.setTarget方法的典型用法代码示例。如果您正苦于以下问题:Python Camera.setTarget方法的具体用法?Python Camera.setTarget怎么用?Python Camera.setTarget使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Camera
的用法示例。
在下文中一共展示了Camera.setTarget方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: GameState
# 需要导入模块: import Camera [as 别名]
# 或者: from Camera import setTarget [as 别名]
#.........这里部分代码省略.........
self.drawScene()
# Copy the contents of the frame buffer into our blur texture
self.blurTexture.bind()
glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0,
self.blurTexture.getTexWidth(),
self.blurTexture.getTexHeight(),
0)
self.blurTexture.unbind()
# Clear the fram buffer again
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
glPopAttrib()
# Blend in the motion blur with the background color
self.drawMotionBlur(self.player.drunkAmount)
# Draw the scene on top of the motion blur
self.drawScene()
def update(self, dt):
'''
Updates the game simulation based on the amount of time that has passed
since the previous frame.
'''
# Update the input system
self.updateInput(dt)
# Update the avatar
self.player.update(dt)
# Update the camera
self.camera.setTarget(self.player.pos, self.player.rot)
self.camera.update(dt)
for i in range(len(self.npcs)):
self.npcs[i].update(dt)
# Calculate the FPS
self.numFrames += 1
self.frameTime += dt
if self.frameTime > 0.5:
self.fps = float(self.numFrames) / self.frameTime
self.frameTime = 0.0
self.numFrames = 0
print 'FPS: %f' % (self.fps)
def updateInput(self, dt):
'''
Updates the state of the input system and processes all currently active
actions.
'''
# Update the input manager
self.inputMgr.update(dt)
# Movement
speed = 5
accel = gmtl.Vec3f(0, 0, speed)
reverse = gmtl.Vec3f(0, 0, -speed * 0.7)
sleft = gmtl.Vec3f( speed * 0.9, 0, 0)
sright = gmtl.Vec3f(-speed * 0.9, 0, 0)
# vel_change = gmtl.Vec3f(0,0,0)
self.vel_change = self.vel_change + accel * self.actionForward.getEdgeState()