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


Python TextureStage.setColor方法代码示例

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


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

示例1: __init__

# 需要导入模块: from pandac.PandaModules import TextureStage [as 别名]
# 或者: from pandac.PandaModules.TextureStage import setColor [as 别名]
class ShipFactory:
    notify = DirectNotifyGlobal.directNotify.newCategory("ShipFactory")

    def __init__(self, phasedLoading=False):
        self.wantProws = config.GetBool("want-sprits", 0)
        self.hulls = {}
        self.texInfo = ({}, {}, {})
        self.models = {}
        self.mastSets = {}
        ShipBlueprints.setupWheel()
        ShipBlueprints.setupShipTextures()
        self.preprocessMast(ShipGlobals.Masts.Main_Tri)
        self.preprocessMast(ShipGlobals.Masts.Fore_Tri)
        self.preprocessHull(ShipGlobals.INTERCEPTORL1)
        self.preprocessMast(ShipGlobals.Masts.Skel_Main_A)
        self.preprocessMast(ShipGlobals.Masts.Skel_Main_B)
        self.preprocessMast(ShipGlobals.Masts.Skel_Tri)
        self.preprocessMast(ShipGlobals.Masts.Skel_Fore)
        self.preprocessMast(ShipGlobals.Masts.Skel_Aft)
        self.preprocessHull(ShipGlobals.SKEL_INTERCEPTORL3)
        self.preprocessHull(ShipGlobals.SKEL_WARSHIPL3)
        if not phasedLoading:
            self.handlePhase4()
            self.handlePhase5()

        self.baseLayer = TextureStage("base")
        self.colorLayer = TextureStage("color")
        self.logoLayer = TextureStage("logo")
        self.logoLayerNoColor = TextureStage("logoNoColor")
        self.vertLayer = TextureStage("vertex")
        self.colorLayer.setSort(1)
        self.colorLayer.setCombineRgb(TextureStage.CMReplace, TextureStage.CSTexture, TextureStage.COSrcColor)
        self.colorLayer.setCombineAlpha(TextureStage.CMReplace, TextureStage.CSTexture, TextureStage.COSrcAlpha)
        self.colorLayer.setTexcoordName("uvColor")
        self.logoLayer.setSort(2)
        self.logoLayer.setCombineRgb(
            TextureStage.CMInterpolate,
            TextureStage.CSTexture,
            TextureStage.COSrcColor,
            TextureStage.CSPrevious,
            TextureStage.COSrcColor,
            TextureStage.CSTexture,
            TextureStage.COSrcAlpha,
        )
        self.logoLayer.setCombineAlpha(TextureStage.CMReplace, TextureStage.CSPrevious, TextureStage.COSrcAlpha)
        self.logoLayer.setTexcoordName("uvLogo")
        self.logoLayerNoColor.setSort(2)
        self.logoLayerNoColor.setCombineRgb(
            TextureStage.CMInterpolate,
            TextureStage.CSTexture,
            TextureStage.COSrcColor,
            TextureStage.CSConstant,
            TextureStage.COSrcColor,
            TextureStage.CSTexture,
            TextureStage.COSrcAlpha,
        )
        self.logoLayerNoColor.setCombineAlpha(TextureStage.CMReplace, TextureStage.CSPrevious, TextureStage.COSrcAlpha)
        self.logoLayerNoColor.setTexcoordName("uvLogo")
        self.logoLayerNoColor.setColor((1, 1, 1, 1))
        self.vertLayer.setSort(3)
        self.vertLayer.setCombineRgb(
            TextureStage.CMModulate,
            TextureStage.CSPrevious,
            TextureStage.COSrcColor,
            TextureStage.CSPrimaryColor,
            TextureStage.COSrcColor,
        )
        self.vertLayer.setCombineAlpha(TextureStage.CMReplace, TextureStage.CSPrimaryColor, TextureStage.COSrcAlpha)
        self.baseLayer.setSort(4)
        self.baseLayer.setCombineRgb(
            TextureStage.CMModulate,
            TextureStage.CSTexture,
            TextureStage.COSrcColor,
            TextureStage.CSPrevious,
            TextureStage.COSrcColor,
        )
        self.baseLayer.setCombineAlpha(
            TextureStage.CMModulate,
            TextureStage.CSTexture,
            TextureStage.COSrcAlpha,
            TextureStage.CSPrevious,
            TextureStage.COSrcAlpha,
        )

    def handlePhase4(self):
        self.preprocessHull(ShipGlobals.INTERCEPTORL2)
        self.preprocessHull(ShipGlobals.INTERCEPTORL3)
        self.preprocessMast(ShipGlobals.Masts.Main_Square)
        self.preprocessMast(ShipGlobals.Masts.Aft_Tri)
        self.preprocessMast(ShipGlobals.Masts.Fore_Multi)
        self.preprocessHull(ShipGlobals.WARSHIPL1)
        self.preprocessHull(ShipGlobals.WARSHIPL2)
        self.preprocessHull(ShipGlobals.WARSHIPL3)
        self.preprocessHull(ShipGlobals.MERCHANTL1)
        self.preprocessHull(ShipGlobals.MERCHANTL2)
        self.preprocessHull(ShipGlobals.MERCHANTL3)
        self.preprocessHull(ShipGlobals.QUEEN_ANNES_REVENGE)
        self.sprits = ShipBlueprints.preprocessSprits()

    def handlePhase5(self):
#.........这里部分代码省略.........
开发者ID:PiratesOnline,项目名称:PiratesOfTheCarribeanOnline,代码行数:103,代码来源:ShipFactory.py

示例2: CloudLayer

# 需要导入模块: from pandac.PandaModules import TextureStage [as 别名]
# 或者: from pandac.PandaModules.TextureStage import setColor [as 别名]
class CloudLayer(ColoredByTime):
    def __init__(self):

        tex1 = loader.loadTexture('textures/clouds.jpg')
        tex1.setMagfilter(Texture.FTLinearMipmapLinear)
        tex1.setMinfilter(Texture.FTLinearMipmapLinear)
        tex1.setAnisotropicDegree(2)
        tex1.setWrapU(Texture.WMRepeat)
        tex1.setWrapV(Texture.WMRepeat)
        tex1.setFormat(Texture.FAlpha)
        self.ts1 = TextureStage('clouds')
        #self.ts1.setMode(TextureStage.MBlend)
        self.ts1.setColor(Vec4(1, 1, 1, 1))

        #self.plane(-2000, -2000, 2000, 2000, 100)
        self.sphere(10000, -9600)

        self.clouds.setTransparency(TransparencyAttrib.MDual)
        self.clouds.setTexture(self.ts1, tex1)

        self.clouds.setBin('background', 3)
        self.clouds.setDepthWrite(False)
        self.clouds.setDepthTest(False)
        self.clouds.setTwoSided(True)
        self.clouds.setLightOff(1)
        self.clouds.setShaderOff(1)
        self.clouds.setFogOff(1)
        self.clouds.hide(BitMask32.bit(2)) # Hide from the volumetric lighting camera

        self.speed = 0.003
        self.time = 0
        self.dayColor = Vec4(0.98, 0.98, 0.95, 1.0)
        self.nightColor = Vec4(-0.5, -0.3, .0, 1.0)
        self.sunsetColor = Vec4(0.75, .60, .65, 1.0)
        ColoredByTime.__init__(self)
        self.setColor = self.clouds.setColor

    def plane(self, x1, y1, x2, y2, z):
        self.z = z
        maker = CardMaker('clouds')
        maker.setFrame(x1, x2, y1, y2)
        self.clouds = render.attachNewNode(maker.generate())
        self.clouds.setHpr(0, 90, 0)
        self.clouds.setTexOffset(self.ts1, 0, 1)
        self.clouds.setTexScale(self.ts1, 10, 10)

    def sphere(self, scale, z):
        self.z = z
        self.clouds = loader.loadModel("models/sphere")
        self.clouds.reparentTo(render)
        self.clouds.setHpr(0, 90, 0)
        self.clouds.setScale(scale)
        self.clouds.setTexOffset(self.ts1, 0, 1)
        self.clouds.setTexScale(self.ts1, 30, 12)

    def setTime(self, time):
        self.colorize(time)
        self.clouds.setTexOffset(self.ts1, self.time * self.speed, self.time * self.speed);

    def update(self, elapsed):
        self.time += elapsed
        self.clouds.setPos(base.cam.getPos(render) + Vec3(0, 0, self.z))
开发者ID:StephenLujan,项目名称:Panda-3d-Procedural-Terrain-Engine,代码行数:64,代码来源:sky.py


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