當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。