本文整理汇总了Python中Camera.Camera.setSceneRadius方法的典型用法代码示例。如果您正苦于以下问题:Python Camera.setSceneRadius方法的具体用法?Python Camera.setSceneRadius怎么用?Python Camera.setSceneRadius使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Camera.Camera
的用法示例。
在下文中一共展示了Camera.setSceneRadius方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: GLWidget
# 需要导入模块: from Camera import Camera [as 别名]
# 或者: from Camera.Camera import setSceneRadius [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))
#.........这里部分代码省略.........