本文整理汇总了Python中Camera.Camera.reset方法的典型用法代码示例。如果您正苦于以下问题:Python Camera.reset方法的具体用法?Python Camera.reset怎么用?Python Camera.reset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Camera.Camera
的用法示例。
在下文中一共展示了Camera.reset方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: IncantusLayer
# 需要导入模块: from Camera import Camera [as 别名]
# 或者: from Camera.Camera import reset [as 别名]
#.........这里部分代码省略.........
glViewport(0, 0, width, height)
glMatrixMode(GL_PROJECTION)
glLoadIdentity()
gluPerspective(80., width/float(height), 0.1, 3000.)
glMatrixMode(GL_MODELVIEW)
offset = 5
self.phase_bar.pos = euclid.Vector3(offset+self.phase_bar.width/2,offset+self.phase_bar.height/2, 0)
self.msg_dialog.pos = euclid.Vector3(offset+self.msg_dialog.width/2, 2*offset+self.phase_bar.height+self.msg_dialog.height/2,0)
self.mainplayer_status.pos = euclid.Vector3(offset, 3*offset+self.phase_bar.height+self.msg_dialog.height, 0)
self.mainplayer_status.resize(width, height)
self.otherplayer_status.pos = euclid.Vector3(offset, height-self.otherplayer_status.height-offset, 0)
self.otherplayer_status.resize(width, height)
self.stack.pos = euclid.Vector3(150,height/2,0)
self.player_hand.resize(width, height, width-self.msg_dialog.width)
self.otherplayer_hand.resize(width, height, width-self.otherplayer_status.width)
#self.game_status.resize(width, height, self.mainplayer_status.width)
self.phase_status.resize(width, height)
self.selection.pos = euclid.Vector3(width/2., height/2., 0)
def draw(self):
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_FALSE)
self.camera.setup()
glEnable(GL_LIGHTING)
glEnable(GL_DEPTH_TEST)
self.table.draw()
glClear(GL_DEPTH_BUFFER_BIT)
self.mainplay.render()
self.otherplay.render()
self.zone_animator.render3d()
glDisable(GL_LIGHTING)
glDisable(GL_DEPTH_TEST)
self.draw_overlay()
self.camera.reset()
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE)
def draw_overlay(self):
# draw left mask
self.set_2d(-50, 50)
self.phase_status.render()
self.phase_bar.render()
self.otherplayer_hand.render()
self.player_hand.render()
self.stack.render()
self.otherplayer_status.render()
self.mainplayer_status.render()
#self.game_status.render()
self.zone_animator.render2d()
self.msg_dialog.render()
self.selection.render()
#glDisable(GL_TEXTURE_2D)
self.unset_2d()
def on_key_press(self, symbol, modifiers):
if symbol == key.ENTER:
self.process_action(engine.Action.PassPriority())
elif symbol == key.ESCAPE:
self.process_action(engine.Action.CancelAction())
#elif symbol == key.L and modifiers & key.MOD_SHIFT:
# self.game_status.toggle_gamelog()
elif symbol == key.D and modifiers & key.MOD_SHIFT:
import pdb
pdb.set_trace()
elif symbol == key.V and modifiers & key.MOD_SHIFT:
self.camera.switch_viewpoint()
elif symbol == key.F:
示例2: GLWidget
# 需要导入模块: from Camera import Camera [as 别名]
# 或者: from Camera.Camera import reset [as 别名]
class GLWidget(QGLWidget):
def __init__(self, parent):
QGLWidget.__init__(self, parent)
self.setMouseTracking(True)
self.selectedProj = -1
self.canvasModel = CanvasModel.Dome(23.0,11.5,11.5,0.0,1.0)
self.showCanvas = True
self.projectors = Projectors4(
Projector(11.5),
Projector(11.5),
Projector(11.5),
Projector(11.5),
0.0, # Tower Height
25.0, # Pitch Angle
0.0) # Yaw Angle
self.edgeBlending = True
self.showProjectorImages = True
self.projImagesFullscreen = False
# self.setMinimumSize(500, 500)
self.camera = Camera()
self.camera.setSceneRadius( 30 )
self.camera.reset()
self.isPressed = False
self.oldx = self.oldy = 0
self.textureFiles = os.listdir(TEXTURE_PATH)
self.textures = dict()
self.shaders = dict()
self.selTexture = "spherical_small"
def paintGL(self):
def paintProjectorImage(proj,offset,size,alpha):
glColor(1.0,1.0,1.0,alpha)
ar = 1.0 / proj.aspectRatio * 4.0
className = str(self.canvasModel.__class__)
projShader = self.shaders[className+"_proj"]
# if self.selTexture in self.textures:
glActiveTexture(GL_TEXTURE0); # use first texturing unit
projShader.use()
projShader.set(proj_texture = ("1i",[0]),
alpha_value = ("1f",[alpha]))
self.canvasModel.shaderSettings(projShader)
self.projectors.shaderSettings(projShader)
self.textures[self.selTexture].setup()
glBegin( GL_QUADS )
glTexCoord2f(0.0, 0.0); glVertex2fv(offset)
glTexCoord2f(1.0, 0.0); glVertex2f(offset[0]+ar*size,offset[1])
glTexCoord2f(1.0, 1.0); glVertex2f(offset[0]+ar*size,offset[1]+size)
glTexCoord2f(0.0, 1.0); glVertex2f(offset[0],offset[1]+size)
glEnd()
projShader.unuse()
if self.edgeBlending:
edgeBlendShader = self.shaders[className+"_edgeblend"]
edgeBlendShader.use()
# edgeBlendShader.set(proj_texture = ("1i",[0]),
# alpha_value = ("1f",[alpha]))
self.canvasModel.shaderSettings(edgeBlendShader)
self.projectors.shaderSettings(edgeBlendShader)
self.projectors.edgeBlendShaderSettings(edgeBlendShader)
glBegin( GL_QUADS )
glTexCoord2f(0.0, 0.0); glVertex2fv(offset)
glTexCoord2f(1.0, 0.0); glVertex2f(offset[0]+ar*size,offset[1])
glTexCoord2f(1.0, 1.0); glVertex2f(offset[0]+ar*size,offset[1]+size)
glTexCoord2f(0.0, 1.0); glVertex2f(offset[0],offset[1]+size)
glEnd()
edgeBlendShader.unuse()
def drawProjectorImage():
glLoadIdentity()
glMatrixMode(GL_PROJECTION)
glLoadIdentity()
gluOrtho2D(0,1 / float(self.height()) * self.width(),0,1)
glMatrixMode(GL_MODELVIEW)
glLoadIdentity()
glDisable( GL_DEPTH_TEST )
glDisable( GL_CULL_FACE )
if self.projImagesFullscreen and self.selectedProj != -1:
paintProjectorImage(self.projectors[self.selectedProj],[0.0,0.0],1.0,0.5)
else:
bottom = 0.05
size = 0.2
xOffset = 0.05
proj = self.projectors
paintProjectorImage(proj,[xOffset,bottom],size,1.0)
xOffset += size / proj.aspectRatio + 0.05
glDisable(GL_TEXTURE_2D)
light0 = Light(GL_LIGHT0,Point3D(0.0,-20.0,-20.0))
light1 = Light(GL_LIGHT1,Point3D(0.0,20.0,20.0))
#.........这里部分代码省略.........