本文整理汇总了Python中Camera.Camera.translateSceneRightAndUp方法的典型用法代码示例。如果您正苦于以下问题:Python Camera.translateSceneRightAndUp方法的具体用法?Python Camera.translateSceneRightAndUp怎么用?Python Camera.translateSceneRightAndUp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Camera.Camera
的用法示例。
在下文中一共展示了Camera.translateSceneRightAndUp方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: GLWidget
# 需要导入模块: from Camera import Camera [as 别名]
# 或者: from Camera.Camera import translateSceneRightAndUp [as 别名]
#.........这里部分代码省略.........
texture = None
if self.selTexture in self.textures:
texture = self.textures[self.selTexture]
shader = self.shaders[str(self.canvasModel.__class__)+"_inv_proj"]
shader.use()
self.canvasModel.shaderSettings(shader)
self.projectors.shaderSettings(shader)
shader.set(proj_multi = ("4f",[[1.0,1.0,1.0,1.0]]))
self.canvasModel.draw(mode,texture,colors,None,self.selectedProj)
shader.unuse()
drawProjectorImage()
glFlush()
def resizeGL(self, widthInPixels, heightInPixels):
self.camera.setViewportDimensions(widthInPixels, heightInPixels)
glViewport(0, 0, widthInPixels, heightInPixels)
def initializeGL(self):
glClearColor(0.0, 0.0, 0.0, 1.0)
glClearDepth(1.0)
domeStr = "CanvasModel.Dome"
self.shaders[domeStr+"_proj"] = Shader("shaders/dome_proj.vert","shaders/dome_4proj.frag")
self.shaders[domeStr+"_edgeblend"] = Shader("shaders/dome_edgeblend.vert","shaders/dome_edgeblend_4proj.frag")
self.shaders[domeStr+"_inv_proj"] = Shader("shaders/dome_inv_proj.vert","shaders/dome_inv_proj.frag")
# cycloramaStr = "CanvasModel.Cyclorama"
# self.shaders[cycloramaStr+"_proj"] = Shader("shaders/cyclorama_proj.vert","shaders/dome_proj.frag")
# self.shaders[cycloramaStr+"_edgeblend"] = Shader("shaders/cyclorama_edgeblend.vert","shaders/cyclorama_edgeblend.frag")
# self.shaders[cycloramaStr+"_inv_proj"] = Shader("shaders/dome_inv_proj.vert","shaders/dome_inv_proj.frag")
for textureFile in self.textureFiles:
texFile = os.path.join(TEXTURE_PATH,textureFile)
self.textures[textureFile[:-4]] = Texture(texFile)
def mouseMoveEvent(self, mouseEvent):
if int(mouseEvent.buttons()) != QtCore.Qt.NoButton :
# user is dragging
delta_x = mouseEvent.x() - self.oldx
delta_y = self.oldy - mouseEvent.y()
if int(mouseEvent.buttons()) & QtCore.Qt.LeftButton :
if int(mouseEvent.buttons()) & QtCore.Qt.MidButton :
self.camera.dollyCameraForward( 3*(delta_x+delta_y), False )
else:
self.camera.orbit(self.oldx,self.oldy,mouseEvent.x(),mouseEvent.y())
elif int(mouseEvent.buttons()) & QtCore.Qt.MidButton :
self.camera.translateSceneRightAndUp( delta_x, delta_y )
self.update()
self.oldx = mouseEvent.x()
self.oldy = mouseEvent.y()
def getSelectedProj(self):
proj = None
if self.selectedProj == 0:
proj = self.projectors.a
elif self.selectedProj == 1:
proj = self.projectors.b
elif self.selectedProj == 2:
proj = self.projectors.c
return proj
def setShowProjectorImages(self, value):
self.showProjectorImages = value
self.update()
def setEdgeBlending(self, value):
self.edgeBlending = value
self.update()
def setProjImagesFullscreen(self,value):
self.projImagesFullscreen = value
self.update()
#def mouseDoubleClickEvent(self, mouseEvent):
# print "double click"
def setSelTexture(self, value):
self.selTexture = str(value)
self.update()
def wheelEvent(self,event):
if int(event.modifiers()) == (QtCore.Qt.ControlModifier):
fov = self.camera.FIELD_OF_VIEW_IN_DEGREES
fov += float(event.delta()) / 180
if fov > 120: fov = 120
if fov < 5: fov = 5
self.camera.FIELD_OF_VIEW_IN_DEGREES = fov
else: # Change distance of camera
self.camera.dollyCameraForward(event.delta() * 10.0 / self.camera.FIELD_OF_VIEW_IN_DEGREES,False)
self.update()
def mousePressEvent(self, e):
self.isPressed = True
def mouseReleaseEvent(self, e):
self.isPressed = False