本文整理汇总了Python中Transform.cube_vertices方法的典型用法代码示例。如果您正苦于以下问题:Python Transform.cube_vertices方法的具体用法?Python Transform.cube_vertices怎么用?Python Transform.cube_vertices使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Transform
的用法示例。
在下文中一共展示了Transform.cube_vertices方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _paint_block
# 需要导入模块: import Transform [as 别名]
# 或者: from Transform import cube_vertices [as 别名]
def _paint_block(self, position):
""" Creates vertexes for the block.
Parameters
----------
position : tuple of len 3
The (x, y, z) position of the block to show.
"""
x, y, z = position
try:
block = self.world.getBlock(position)
if block.getVertex():
return
vertex_data = Transform.cube_vertices(x, y, z, 0.5)
texture_data = list(block.getTexture())
# create vertex list
# FIXME Maybe `add_indexed()` should be used instead
block.setVertex(self.batch.add(24, GL_QUADS, self._materialFactory.getMaterial(block.getMaterial()).textureGroup,
('v3f/static', vertex_data),
('t2f/static', texture_data)))
#self.log.debug('Block at %s made visible' % (position,))
except Exception, e:
self.log.error("Painting block at %s failed: %s" % (position, e))
示例2: draw_focused_block
# 需要导入模块: import Transform [as 别名]
# 或者: from Transform import cube_vertices [as 别名]
def draw_focused_block(self):
""" Draw black edges around the block that is currently under the
crosshairs.
"""
vector = self.get_sight_vector()
block = self.model.hit_test(self._player.position, vector)[0]
if block:
x, y, z = block
self.focusedBlock = block
vertex_data = Transform.cube_vertices(x, y, z, 0.51)
glColor3d(0, 0, 0)
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE)
pyglet.graphics.draw(24, GL_QUADS, ('v3f/static', vertex_data))
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL)