本文整理汇总了Python中Camera.setPosition方法的典型用法代码示例。如果您正苦于以下问题:Python Camera.setPosition方法的具体用法?Python Camera.setPosition怎么用?Python Camera.setPosition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Camera
的用法示例。
在下文中一共展示了Camera.setPosition方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Game
# 需要导入模块: import Camera [as 别名]
# 或者: from Camera import setPosition [as 别名]
class Game(object):
def __init__(self):
self.display_init()
self.running = True
self.clock = pygame.time.Clock()
self.skybox = Skybox('textures/skybox/minecraft','png')
self.camera = Camera()
self.camera.setPosition((level.playerX,level.playerY,level.playerZ))
#self.camera.setPosition(cn.level.playerPos)
#self.camera.setPosition((0,20,0))
self.plane = glGenLists(1)
self.ID = 3
glNewList(self.plane,GL_COMPILE)
glPushMatrix()
glColor3ub(66,66,66)
tes = Tessellator.instance
tes.startDrawing(GL_LINES)
for i in range(-50,50):
tes.addVertex(-50, 0, i)
tes.addVertex(50, 0, i)
tes.addVertex(i, 0,-50)
tes.addVertex(i, 0, 50)
tes.draw()
glPopMatrix()
glEndList()
self.groundpos = None
self.cubepos = Vector3()
self.near = Vector3()
self.far = Vector3()
self.lasttime = time.time()
self.cloudTickCounter = 0
self.hit = None
def run(self):
while self.running:
delta = time.time()-self.lasttime
self.lasttime += delta
world.timeChange(delta*10)
self.event_handler(pygame.event.get())
self.key_handler(pygame.key.get_pressed())
self.mouse_handler(pygame.mouse.get_pressed())
self.renderScene(delta)
self.timer()
pygame.display.flip()
pygame.quit()
def display_init(self):
#self.screen = pygame.display.set_mode(SCREEN_SIZE,SCREEN_FLAG)
glClearColor(*BLACK)
glClearDepth(1)
w = SCREEN_SIZE[0]
h = SCREEN_SIZE[1]
aspectRatio= w/h
glViewport(0,0,w,h)
glMatrixMode(GL_PROJECTION)
glLoadIdentity()
gluPerspective(35.0, w/h, 0.5 , 10000.0)
glMatrixMode(GL_MODELVIEW)
glLoadIdentity()
pygame.mouse.set_visible(True)
pygame.mouse.set_pos((w//2,h//2))
glEnable(GL_LIGHTING)
glLightfv(GL_LIGHT1, GL_AMBIENT,(0,0,0,1,0 ))
glLightfv(GL_LIGHT1, GL_DIFFUSE, (0.95,0.95,0.95,1.0))
glLightfv(GL_LIGHT1, GL_SPECULAR, (0.95,0.95,0.95,1.0))
glLightfv(GL_LIGHT1, GL_POSITION, (128, 128.0 , 2.0, 1.0 ))
glEnable(GL_LIGHT1)
#glEnable(GL_FOG)
glFogfv(GL_FOG_COLOR, (GLfloat * 4)(0.5, 0.69, 1.0, 1))
glHint(GL_FOG_HINT, GL_DONT_CARE)
glFogi(GL_FOG_MODE, GL_LINEAR)
glFogf(GL_FOG_DENSITY, 0.35)
glFogf(GL_FOG_START, 20.0)
glFogf(GL_FOG_END, 60.0)
print(glGetString(GL_VERSION))
glFrontFace(GL_CW)
glEnable(GL_ALPHA_TEST)
glEnable (GL_DEPTH_TEST)
glMaterialfv(GL_FRONT, GL_SPECULAR, (0.1,0.1,0.1, 1.0));
glMaterialfv(GL_FRONT, GL_SHININESS, (10.0));
glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE);
glEnable(GL_COLOR_MATERIAL);
#.........这里部分代码省略.........