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


Python PNMImage.getBlue方法代码示例

本文整理汇总了Python中panda3d.core.PNMImage.getBlue方法的典型用法代码示例。如果您正苦于以下问题:Python PNMImage.getBlue方法的具体用法?Python PNMImage.getBlue怎么用?Python PNMImage.getBlue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在panda3d.core.PNMImage的用法示例。


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

示例1: __map_Colours

# 需要导入模块: from panda3d.core import PNMImage [as 别名]
# 或者: from panda3d.core.PNMImage import getBlue [as 别名]
 def __map_Colours(self, planet, model, rec, pts=[]):
     col_map_path = planet.colour_map.replace(".","_low.")
     col_map_fn = Filename("{}/maps/{}".format(planet.path, col_map_path))
     col_map = PNMImage()
     col_map.read(col_map_fn)
     _cu_size = col_map.getXSize()-1
     _cv_size = col_map.getYSize()-1
    
     cols = []
     if not pts: pts = model.read("vertex")
     for pt in pts:
         u, v = self.__get_Pt_Uv(pt, _cu_size, _cv_size)
         r = col_map.getRed(u, v)
         g = col_map.getGreen(u, v)
         b = col_map.getBlue(u, v)
         pt_col = (r, g, b, 1)
         cols.append(pt_col)
     model.modify("color", cols)
开发者ID:svfgit,项目名称:solex,代码行数:20,代码来源:model.py

示例2: paintAvatar

# 需要导入模块: from panda3d.core import PNMImage [as 别名]
# 或者: from panda3d.core.PNMImage import getBlue [as 别名]
    def paintAvatar(self, entry):
        """ Paints onto an avatar.  Returns true on success, false on
        failure (because there are no avatar pixels under the mouse,
        for instance). """

        # First, we have to render the avatar in its false-color
        # image, to determine which part of its texture is under the
        # mouse.
        if not self.avbuf:
            return False

        #mpos = base.mouseWatcherNode.getMouse()
        mpos = entry.getSurfacePoint(self.player)
        ppos = entry.getSurfacePoint(render)

        self.player.showThrough(BitMask32.bit(1))
        self.avbuf.setActive(True)
        base.graphicsEngine.renderFrame()
        self.player.show(BitMask32.bit(1))
        self.avbuf.setActive(False)

        # Now we have the rendered image in self.avbufTex.
        if not self.avbufTex.hasRamImage():
            print "Weird, no image in avbufTex."
            return False
        p = PNMImage()
        self.avbufTex.store(p)
        ix = int((1 + mpos.getX()) * p.getXSize() * 0.5)
        iy = int((1 - mpos.getY()) * p.getYSize() * 0.5)
        x = 1
        if ix >= 0 and ix < p.getXSize() and iy >= 0 and iy < p.getYSize():
            s = p.getBlue(ix, iy)
            t = p.getGreen(ix, iy)
            x = p.getRed(ix, iy)
        if x > 0.5:
            # Off the avatar.
            return False

        # At point (s, t) on the avatar's map.

        self.__paint(s, t)
        return True
开发者ID:grimfang,项目名称:Paintball,代码行数:44,代码来源:playerBase.py


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