本文整理汇总了Python中Camera.Camera.translate方法的典型用法代码示例。如果您正苦于以下问题:Python Camera.translate方法的具体用法?Python Camera.translate怎么用?Python Camera.translate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Camera.Camera
的用法示例。
在下文中一共展示了Camera.translate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: LivePlot
# 需要导入模块: from Camera import Camera [as 别名]
# 或者: from Camera.Camera import translate [as 别名]
#.........这里部分代码省略.........
area_color_cycle = [[1.0, 0.3, 0.3, 0.5], \
[0.3, 1.0, 0.3, 0.5], \
[0.3, 0.3, 1.0, 0.5]]
verts = []
colors = []
for cam in d:
v,c = drawCameraCone(cam, cone_color_cycle[0], area_color_cycle[0])
verts += v
colors += c
cone_color_cycle = cone_color_cycle[1:] + cone_color_cycle[:1]
area_color_cycle = area_color_cycle[1:] + area_color_cycle[:1]
self.camera_cones.resize(len(verts) // 3)
self.camera_cones.vertices = verts
self.camera_cones.colors = colors
elif t == "markers":
markers = []
for m in d:
markers += list(m['mark'])
self.markers.resize(len(d))
self.markers.vertices = markers
self.markers.colors = [0, 0, 1, 1] * len(d)
vc = np.array([[6000 * dt], [6000 * dt], [6000 * dt]])
vc *= np.array([[self.keyboard[key.W] - self.keyboard[key.S]], \
[self.keyboard[key.D] - self.keyboard[key.A]], \
[self.keyboard[key.LSHIFT] - self.keyboard[key.LCTRL]]])
self.camera.translate(vc)
# Hack for pyglet bug
try:
self.switch_to()
self.dispatch_event('on_draw')
self.flip()
except AttributeError:
pass
## Rendering --------------------------------------------------------------
def render(self):
w,h = self.get_size()
self.camera.prerender(w, h)
rot = time.time() * 0.5
glLineWidth(1)
glPointSize(10)
glDisable(GL_DEPTH_TEST)
self.batch.draw()
self.camera.postrender()
def render_2d(self):
glMatrixMode(GL_PROJECTION)
glPushMatrix()
glLoadIdentity()
w,h = self.get_size()
glOrtho(0, w, 0, h, -1.0, 2.0)