当前位置: 首页>>代码示例>>Python>>正文


Python Transform.cube_vertices方法代码示例

本文整理汇总了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))
开发者ID:gentoomaniac,项目名称:Minecraft,代码行数:29,代码来源:Model.py

示例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)
开发者ID:gentoomaniac,项目名称:Minecraft,代码行数:17,代码来源:engine.py


注:本文中的Transform.cube_vertices方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。