• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python mceutils.loadPNGTexture函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中mceutils.loadPNGTexture函数的典型用法代码示例。如果您正苦于以下问题:Python loadPNGTexture函数的具体用法?Python loadPNGTexture怎么用?Python loadPNGTexture使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了loadPNGTexture函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: drawSelf

    def drawSelf(self):
        if self._tex is None:
            if self.small:
                filename = "compass_small.png"
            else:
                filename = "compass.png"

            self._tex = loadPNGTexture("toolicons/" + filename)#, minFilter=GL.GL_LINEAR, magFilter=GL.GL_LINEAR)

        self._tex.bind()
        size = 0.075

        with gl.glPushMatrix(GL.GL_MODELVIEW):
            GL.glLoadIdentity()

            yaw, pitch = self.yawPitch
            GL.glTranslatef(1.-size, size, 0.0)  # position on upper right corner
            GL.glRotatef(180-yaw, 0., 0., 1.)  # adjust to north
            GL.glColor3f(1., 1., 1.)

            with gl.glEnableClientState(GL.GL_TEXTURE_COORD_ARRAY):
                GL.glVertexPointer(2, GL.GL_FLOAT, 0, makeQuad(-size, -size, 2*size, 2*size))
                GL.glTexCoordPointer(2, GL.GL_FLOAT, 0, makeQuad(0, 0, 256, 256))

                with gl.glEnable(GL.GL_BLEND, GL.GL_TEXTURE_2D):
                    GL.glDrawArrays(GL.GL_QUADS, 0, 4)
开发者ID:2neo,项目名称:mcedit,代码行数:26,代码来源:compass.py


示例2: drawSelf

    def drawSelf(self):
        if self._tex is None:
            filename = os.path.join("toolicons", "compass.png")

            self._tex = loadPNGTexture(filename)

        self._tex.bind()
        size = 0.001 * config.settings.compassSize.get()

        with gl.glPushMatrix(GL.GL_MODELVIEW):
            GL.glLoadIdentity()

            yaw, pitch = self.yawPitch
            if config.settings.viewMode.get() == "Chunk":
                yaw = -180
            GL.glTranslatef(1. - (size + self.x), size + self.y, 0.0)  # position on upper right corner
            GL.glRotatef(180 - yaw, 0., 0., 1.)  # adjust to north
            GL.glColor3f(1., 1., 1.)

            with gl.glEnableClientState(GL.GL_TEXTURE_COORD_ARRAY):
                GL.glVertexPointer(2, GL.GL_FLOAT, 0, makeQuad(-size, -size, 2 * size, 2 * size))
                GL.glTexCoordPointer(2, GL.GL_FLOAT, 0, makeQuad(0, 0, 256, 256))

                with gl.glEnable(GL.GL_BLEND, GL.GL_TEXTURE_2D):
                    GL.glDrawArrays(GL.GL_QUADS, 0, 4)
开发者ID:Pumpkin-Framework,项目名称:MCEdit-Unified,代码行数:25,代码来源:compass.py


示例3: perform

    def perform(self, recordUndo=True):
        self.player = input_text_buttons("Enter a Player Name: ", 160)
        if not self.player:
            return
        if len(self.player) > 16:
            alert("Name to long. Maximum name length is 16.")
            return
        elif len(self.player) < 4:
            alert("Name to short. Minimum name length is 4.")
            return
        try:
            self.uuid = version_utils.getUUIDFromPlayerName(self.player)
            self.player = version_utils.getPlayerNameFromUUID(self.uuid) #Case Corrected
        except:
            action = ask("Could not get {}'s UUID. Please make sure that you are connected to the internet and that the player {} exists.".format(self.player, self.player), ["Enter UUID manually", "Cancel"])
            if action != "Enter UUID manually":
            	return
            self.uuid = input_text_buttons("Enter a Player UUID: ", 160)
            if not self.uuid:
                return
            self.player = version_utils.getPlayerNameFromUUID(self.uuid)
            if self.player == self.uuid.replace("-", ""):
                if ask("UUID was not found. Continue anyways?") == "Cancel":
                    return
        if self.uuid in self.level.players:
            alert("Player already exists in this World.")
            return

        self.playerTag = self.newPlayer()

        if self.tool.panel:
            self.tool.panel.players.append(self.player)

        if self.level.oldPlayerFolderFormat:
            self.level.playerTagCache[self.level.getPlayerPath(self.player)] = self.playerTag

            self.level.players.append(self.player)
            if self.tool.panel: 
                self.tool.panel.player_UUID[self.player] = self.player

        else:
            self.level.playerTagCache[self.level.getPlayerPath(self.uuid)] = self.playerTag

            self.level.players.append(self.uuid)
            if self.tool.panel:
                self.tool.panel.player_UUID[self.player] = self.uuid

        self.tool.playerPos[(0,0,0)] = self.uuid
        self.tool.revPlayerPos[self.uuid] = (0,0,0)
        self.tool.playerTexture[self.uuid] = loadPNGTexture(version_utils.getPlayerSkin(self.uuid, force=False))
        self.tool.markerList.invalidate()
        self.tool.recordMove = False
        self.tool.movingPlayer = self.uuid
        if self.tool.panel:
            self.tool.hidePanel()
            self.tool.showPanel()
        self.canUndo = True
开发者ID:Alexhb61,项目名称:MCEdit-Unified,代码行数:57,代码来源:player.py


示例4: reloadSkins

 def reloadSkins(self):
     #result = ask("This pulls skins from the online server, so this may take a while", ["Ok", "Cancel"])
     #if result == "Ok":
     try:
         for player in self.editor.level.players:
             if player != "Player" and player in self.playerTexture.keys():
                 del self.playerTexture[player]
                 self.playerTexture[player] = loadPNGTexture(version_utils.getPlayerSkin(player, force=True, instance=self))
     except:
         raise Exception("Could not connect to the skins server, please check your Internet connection and try again.")
开发者ID:Estevo-Aleixo,项目名称:MCEdit-Unified,代码行数:10,代码来源:player.py


示例5: reloadSkins

    def reloadSkins(self):
        #result = ask("This pulls skins from the online server, so this may take a while", ["Ok", "Cancel"])
        #if result == "Ok":
        try:
            for player in self.editor.level.players:
                if player != "Player" and player in self.playerTexture.keys():
                    del self.playerTexture[player]
#                     print 6
                    r = self.playercache.getPlayerSkin(player, force_download=True, instance=self)
                    if isinstance(r, (str, unicode)):
                        r = r.join()
                    self.playerTexture[player] = loadPNGTexture(r)
            #self.markerList.call(self._drawToolMarkers)
        except:
            raise Exception("Could not connect to the skins server, please check your Internet connection and try again.")
开发者ID:Iciciliser,项目名称:MCEdit-Unified,代码行数:15,代码来源:player.py


示例6: redo

    def redo(self):
        if not (self.playerTag is None):
            self.level.playerTagCache[self.level.getPlayerPath(self.uuid)] = self.playerTag

            self.level.players.append(self.uuid)
            if self.tool.panel:
                self.tool.panel.players.append(self.player)
                self.tool.panel.player_UUID[self.player] = self.uuid
            self.tool.playerTexture[self.uuid] = loadPNGTexture(version_utils.getPlayerSkin(self.uuid))
            self.tool.playerPos[(0,0,0)] = self.uuid
            self.tool.revPlayerPos[self.uuid] = (0,0,0)
            self.playerTag.save(self.level.getPlayerPath(self.uuid))
            self.tool.nonSavedPlayers.append(self.level.getPlayerPath(self.uuid))

        self.tool.markerList.invalidate()
开发者ID:Estevo-Aleixo,项目名称:MCEdit-Unified,代码行数:15,代码来源:player.py


示例7: _drawToolMarkers

    def _drawToolMarkers(self):
        GL.glColor(1.0, 1.0, 1.0, 0.5)

        GL.glEnable(GL.GL_DEPTH_TEST)
        GL.glMatrixMode(GL.GL_MODELVIEW)
        for player in self.editor.level.players:
            try:
                pos = self.editor.level.getPlayerPosition(player)
                yaw, pitch = self.editor.level.getPlayerOrientation(player)
                dim = self.editor.level.getPlayerDimension(player)
                
                self.inOtherDimension[dim].append(player)
                self.playerPos[dim][pos] = player
                self.revPlayerPos[dim][player] = pos
                
                if player != "Player" and config.settings.downloadPlayerSkins.get():
#                     print 7
                    r = self.playercache.getPlayerSkin(player, force_download=False)
                    if not isinstance(r, (str, unicode)):
                        r = r.join()
                    self.playerTexture[player] = loadPNGTexture(r)
                else:
                    self.playerTexture[player] = self.charTex
                    
                if dim != self.editor.level.dimNo:
                    continue

                x, y, z = pos
                GL.glPushMatrix()
                GL.glTranslate(x, y, z)
                GL.glRotate(-yaw, 0, 1, 0)
                GL.glRotate(pitch, 1, 0, 0)
                GL.glColor(1, 1, 1, 1)
                self.drawCharacterHead(0, 0, 0, (x,y,z), self.editor.level.dimNo)
                GL.glPopMatrix()
                # GL.glEnable(GL.GL_BLEND)
                drawTerrainCuttingWire(FloatBox((x - .5, y - .5, z - .5), (1, 1, 1)),
                                       c0=(0.3, 0.9, 0.7, 1.0),
                                       c1=(0, 0, 0, 0),
                )

                #GL.glDisable(GL.GL_BLEND)

            except Exception, e:
                print "Exception in editortools.player.PlayerPositionTool._drawToolMarkers:", repr(e)
                import traceback
                print traceback.format_exc()
                continue
开发者ID:Iciciliser,项目名称:MCEdit-Unified,代码行数:48,代码来源:player.py


示例8: loadTextures

    def loadTextures(self):
        self.terrainTextures = {}

        def makeTerrainTexture(mats):
            w, h = 1, 1
            teximage = numpy.zeros((w, h, 4), dtype='uint8')
            teximage[:] = 127, 127, 127, 255

            GL.glTexImage2D(
                GL.GL_TEXTURE_2D,
                0,
                GL.GL_RGBA8,
                w,
                h,
                0,
                GL.GL_RGBA,
                GL.GL_UNSIGNED_BYTE,
                teximage
            )

        textures = (
            (pymclevel.classicMaterials, 'terrain-classic.png'),
            (pymclevel.indevMaterials, 'terrain-classic.png'),
            (pymclevel.alphaMaterials, resource_packs.packs.get_selected_resource_pack().terrain_path()),
            (pymclevel.pocketMaterials, 'terrain-pocket.png')
        )

        for mats, matFile in textures:
            try:
                if mats.name == 'Alpha':
                    tex = mceutils.loadAlphaTerrainTexture()
                else:
                    tex = mceutils.loadPNGTexture(matFile)
                self.terrainTextures[mats.name] = tex
            except Exception, e:
                logging.warning(
                    'Unable to load terrain from {0}, using flat colors.'
                    'Error was: {1!r}'.format(matFile, e)
                )
                self.terrainTextures[mats.name] = glutils.Texture(
                    functools.partial(makeTerrainTexture, mats)
                )
            mats.terrainTexture = self.terrainTextures[mats.name]
开发者ID:MG-5,项目名称:MCEdit-Unified,代码行数:43,代码来源:gl_display_context.py


示例9: _drawToolMarkers

    def _drawToolMarkers(self):
        GL.glColor(1.0, 1.0, 1.0, 0.5)

        GL.glEnable(GL.GL_DEPTH_TEST)
        GL.glMatrixMode(GL.GL_MODELVIEW)
        for player in self.editor.level.players:
            try:
                pos = self.editor.level.getPlayerPosition(player)
                yaw, pitch = self.editor.level.getPlayerOrientation(player)
                dim = self.editor.level.getPlayerDimension(player)
                
                self.inOtherDimension[dim].append(player)
                self.playerPos[dim][pos] = player
                self.revPlayerPos[dim][player] = pos
                
                if player != "Player" and config.settings.downloadPlayerSkins.get():
                    self.playerTexture[player] = loadPNGTexture(version_utils.getPlayerSkin(player, force=False))
                else:
                    self.playerTexture[player] = self.charTex
                    
                if dim != self.editor.level.dimNo:
                    continue

                x, y, z = pos
                GL.glPushMatrix()
                GL.glTranslate(x, y, z)
                GL.glRotate(-yaw, 0, 1, 0)
                GL.glRotate(pitch, 1, 0, 0)
                GL.glColor(1, 1, 1, 1)
                self.drawCharacterHead(0, 0, 0, (x,y,z), self.editor.level.dimNo)
                GL.glPopMatrix()
                # GL.glEnable(GL.GL_BLEND)
                drawTerrainCuttingWire(FloatBox((x - .5, y - .5, z - .5), (1, 1, 1)),
                                       c0=(0.3, 0.9, 0.7, 1.0),
                                       c1=(0, 0, 0, 0),
                )

                #GL.glDisable(GL.GL_BLEND)

            except Exception, e:
                print repr(e)
                continue
开发者ID:Estevo-Aleixo,项目名称:MCEdit-Unified,代码行数:42,代码来源:player.py


示例10: redo

    def redo(self):
        if not (self.playerTag is None):
            self.level.playerTagCache[self.level.getPlayerPath(self.uuid)] = self.playerTag

            self.level.players.append(self.uuid)
            if self.tool.panel:
                #self.tool.panel.players.append(self.uuid)
                #self.tool.panel.player_UUID[self.player] = self.uuid
                self.tool.panel.player_UUID["UUID"].append(self.uuid)
                self.tool.panel.player_UUID["Name"].append(self.player)
#             print 4
            r = self.playercache.getPlayerSkin(self.uuid)
            if isinstance(r, (str, unicode)):
                r = r.join()
            self.tool.playerTexture[self.uuid] = loadPNGTexture(r)
            self.tool.playerPos[(0,0,0)] = self.uuid
            self.tool.revPlayerPos[self.uuid] = (0,0,0)
            self.playerTag.save(self.level.getPlayerPath(self.uuid))
            self.tool.nonSavedPlayers.append(self.level.getPlayerPath(self.uuid))

        self.tool.markerList.invalidate()
开发者ID:Iciciliser,项目名称:MCEdit-Unified,代码行数:21,代码来源:player.py


示例11: reloadTextures

 def reloadTextures(self):
     self.charTex = loadPNGTexture('char.png')
开发者ID:Iciciliser,项目名称:MCEdit-Unified,代码行数:2,代码来源:player.py


示例12: perform

    def perform(self, recordUndo=True):
        initial = ""
        allowed_chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_"
        while True:
            self.player = input_text_buttons("Enter a Player Name: ", 160, initial=initial, allowed_chars=allowed_chars)
            if self.player is None:
                return
            elif len(self.player) > 16:
                alert("Name too long. Maximum name length is 16.")
                initial = self.player
            elif len(self.player) < 1:
                alert("Name too short. Minimum name length is 1.")
                initial = self.player
            else:
                break
            
#         print 1
        data = self.playercache.getPlayerInfo(self.player)
        if "<Unknown UUID>" not in data and "Server not ready" not in data:
            self.uuid = data[0]
            self.player = data[1]
        else:
            action = ask("Could not get {}'s UUID. Please make sure that you are connected to the internet and that the player \"{}\" exists.".format(self.player, self.player), ["Enter UUID manually", "Cancel"])
            if action != "Enter UUID manually":
                return
            self.uuid = input_text_buttons("Enter a Player UUID: ", 160)
            if not self.uuid:
                return
#             print 2
            self.player = self.playercache.getPlayerInfo(self.uuid)
            if self.player == self.uuid.replace("-", ""):
                if ask("UUID was not found. Continue anyways?") == "Cancel":
                    return
#         print "PlayerAddOperation.perform::self.uuid", self.uuid
        if self.uuid in self.level.players:
            alert("Player already exists in this World.")
            return

        self.playerTag = self.newPlayer()

        #if self.tool.panel:
        #    self.tool.panel.players.append(self.player)

        if self.level.oldPlayerFolderFormat:
            self.level.playerTagCache[self.level.getPlayerPath(self.player)] = self.playerTag
            
            self.level.players.append(self.player)
            #if self.tool.panel:
                #self.tool.panel.player_UUID[self.player] = self.player

        else:
            self.level.playerTagCache[self.level.getPlayerPath(self.uuid)] = self.playerTag
            
            self.level.players.append(self.uuid)
            if self.tool.panel:
                self.tool.panel.player_UUID["UUID"].append(self.uuid)
                self.tool.panel.player_UUID["Name"].append(self.player)

        self.tool.playerPos[self.editor.level.dimNo][(0,0,0)] = self.uuid
        self.tool.revPlayerPos[self.editor.level.dimNo][self.uuid] = (0,0,0)
#         print 3
        r = self.playercache.getPlayerSkin(self.uuid, force_download=False)
        if not isinstance(r, (str, unicode)):
#             print 'r 1', r
            r = r.join()
#             print 'r 2', r
        self.tool.playerTexture[self.uuid] = loadPNGTexture(r)
        self.tool.markerList.invalidate()
        self.tool.recordMove = False
        self.tool.movingPlayer = self.uuid
        if self.tool.panel:
            self.tool.hidePanel()
            self.tool.showPanel()
        self.canUndo = True
        self.playerTag.save(self.level.getPlayerPath(self.uuid))
        self.tool.nonSavedPlayers.append(self.level.getPlayerPath(self.uuid))
        self.tool.inOtherDimension[self.editor.level.dimNo].append(self.uuid)
开发者ID:Iciciliser,项目名称:MCEdit-Unified,代码行数:77,代码来源:player.py


示例13: delete_skin

 def delete_skin(self, uuid):
     del self.playerTexture[uuid]
     self.playerTexture[uuid] = loadPNGTexture('char.png')
开发者ID:Estevo-Aleixo,项目名称:MCEdit-Unified,代码行数:3,代码来源:player.py


示例14: perform

    def perform(self, recordUndo=True):
        initial = ""
        allowed_chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_"
        while True:
            self.player = input_text_buttons("Enter a Player Name: ", 160, initial=initial, allowed_chars=allowed_chars)
            if self.player is None:
                return
            elif len(self.player) > 16:
                alert("Name too long. Maximum name length is 16.")
                initial = self.player
            elif len(self.player) < 1:
                alert("Name too short. Minimum name length is 1.")
                initial = self.player
            else:
                break
        try:
            '''
            print "Player: \""+str(self.player)+"\""
            self.uuid = version_utils.playercache.getPlayerFromPlayername(self.player)
            print "UUID: \""+str(self.uuid)+"\""
            self.player = version_utils.playercache.getPlayerFromUUID(self.uuid)  #Case Corrected
            '''
            data = version_utils.playercache.getPlayerInfo(self.player, force=True)
            if isinstance(data, tuple):
                self.uuid = data[0]
                self.player = data[1]
            else:
                self.uuid = data
        except:
            action = ask("Could not get {}'s UUID. Please make sure that you are connected to the internet and that the player {} exists.".format(self.player, self.player), ["Enter UUID manually", "Cancel"])
            if action != "Enter UUID manually":
                return
            self.uuid = input_text_buttons("Enter a Player UUID: ", 160)
            if not self.uuid:
                return
            self.player = version_utils.playercache.getPlayerFromUUID(self.uuid)
            if self.player == self.uuid.replace("-", ""):
                if ask("UUID was not found. Continue anyways?") == "Cancel":
                    return
        if self.uuid in self.level.players:
            alert("Player already exists in this World.")
            return

        self.playerTag = self.newPlayer()

        if self.tool.panel:
            self.tool.panel.players.append(self.player)

        if self.level.oldPlayerFolderFormat:
            self.level.playerTagCache[self.level.getPlayerPath(self.player)] = self.playerTag

            self.level.players.append(self.player)
            if self.tool.panel:
                self.tool.panel.player_UUID[self.player] = self.player

        else:
            self.level.playerTagCache[self.level.getPlayerPath(self.uuid)] = self.playerTag

            self.level.players.append(self.uuid)
            if self.tool.panel:
                self.tool.panel.player_UUID[self.player] = self.uuid

        self.tool.playerPos[(0,0,0)] = self.uuid
        self.tool.revPlayerPos[self.uuid] = (0,0,0)
        self.tool.playerTexture[self.uuid] = loadPNGTexture(version_utils.getPlayerSkin(self.uuid, force=False))
        self.tool.markerList.invalidate()
        self.tool.recordMove = False
        self.tool.movingPlayer = self.uuid
        if self.tool.panel:
            self.tool.hidePanel()
            self.tool.showPanel()
        self.canUndo = True
        self.playerTag.save(self.level.getPlayerPath(self.uuid))
        self.tool.nonSavedPlayers.append(self.level.getPlayerPath(self.uuid))
        self.tool.inOtherDimension[self.editor.level.dimNo].append(self.uuid)
开发者ID:Estevo-Aleixo,项目名称:MCEdit-Unified,代码行数:75,代码来源:player.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python mceutils.setWindowCaption函数代码示例发布时间:2022-05-27
下一篇:
Python util.exhaust函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap