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


Python Texture.setupCubeMap方法代码示例

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


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

示例1: ScatteringCubemapPass

# 需要导入模块: from panda3d.core import Texture [as 别名]
# 或者: from panda3d.core.Texture import setupCubeMap [as 别名]
class ScatteringCubemapPass(RenderPass):

    """ This pass computes the scattering to a cubemap """

    def __init__(self):
        RenderPass.__init__(self)
        self.cubemapSize = 256

    def getID(self):
        return "ScatteringCubemapPass"

    def getRequiredInputs(self):
        return {

            # Scattering
            "transmittanceSampler": ["Variables.transmittanceSampler", "Variables.emptyTextureWhite"],
            "inscatterSampler": ["Variables.inscatterSampler", "Variables.emptyTextureWhite"],
            "scatteringOptions": ["Variables.scatteringOptions", "Variables.null"],

            "mainRender": "Variables.mainRender",
            "cameraPosition": "Variables.cameraPosition",
            "mainCam": "Variables.mainCam",

            "wsPositionTex": "DeferredScenePass.wsPosition",
            "wsNormalTex": "DeferredScenePass.wsNormal",
            "basecolorTex": "DeferredScenePass.data3",
            # "viewSpacePosition": "ViewSpacePass.position"

            "cloudsTex": ["CloudRenderPass.resultTex", "Variables.emptyTextureWhite"]
        }

    def create(self):

        self.cubemap = Texture("Scattering Cubemap")
        self.cubemap.setupCubeMap(self.cubemapSize, Texture.TFloat, Texture.FRgba16)
        self.cubemap.setMinfilter(Texture.FTLinearMipmapLinear)
        self.cubemap.setMagfilter(Texture.FTLinearMipmapLinear)
        self.cubemap.setKeepRamImage(False)

        self.target = RenderTarget("ScatteringCubemap")
        self.target.setSize(self.cubemapSize * 6, self.cubemapSize)
        self.target.addColorTexture()
        # self.target.addAuxTexture()
        # self.target.setAuxBits(16)
        # self.target.setColorBits(16)
        self.target.prepareOffscreenBuffer()
        self.target.setShaderInput("cubemapSize", self.cubemapSize)
        self.target.setShaderInput("cubemapDest", self.cubemap)

    def setShaders(self):
        shader = Shader.load(Shader.SLGLSL, 
            "Shader/DefaultPostProcess.vertex",
            "Shader/ScatteringCubemapPass.fragment")
        self.target.setShader(shader)
        return [shader]

    def getOutputs(self):
        return {
            "ScatteringCubemapPass.resultCubemap": lambda: self.cubemap,
        }
开发者ID:rimij405,项目名称:RenderPipeline,代码行数:62,代码来源:ScatteringCubemapPass.py

示例2: ScatteringCubemapPass

# 需要导入模块: from panda3d.core import Texture [as 别名]
# 或者: from panda3d.core.Texture import setupCubeMap [as 别名]
class ScatteringCubemapPass(RenderPass):

    """ This pass computes the scattering to a cubemap """

    def __init__(self, pipeline):
        RenderPass.__init__(self)
        self.cubemapSize = pipeline.settings.scatteringCubemapSize
        self.pipeline = pipeline

    def getID(self):
        return "ScatteringCubemapPass"

    def getRequiredInputs(self):
        return {
            "transmittanceSampler": ["Variables.transmittanceSampler", "Variables.emptyTextureWhite"],
            "inscatterSampler": ["Variables.inscatterSampler", "Variables.emptyTextureWhite"],
            "scatteringOptions": ["Variables.scatteringOptions", "Variables.null"],
        }

    def create(self):
        self.cubemap = Texture("Scattering Cubemap")
        self.cubemap.setupCubeMap(self.cubemapSize, Texture.TFloat, Texture.FRgba16)
        self.cubemap.setMinfilter(Texture.FTLinearMipmapLinear)
        self.cubemap.setMagfilter(Texture.FTLinear)

        self.target = RenderTarget("ScatteringCubemap")
        self.target.setSize(self.cubemapSize * 6, self.cubemapSize)

        if self.pipeline.settings.useDebugAttachments:
            self.target.addColorTexture()
        
        self.target.prepareOffscreenBuffer()
        self.target.setShaderInput("cubemapSize", self.cubemapSize)
        self.target.setShaderInput("cubemapDest", self.cubemap)

    def setShaders(self):
        shader = Shader.load(Shader.SLGLSL, 
            "Shader/DefaultPostProcess.vertex",
            "Shader/ScatteringCubemapPass.fragment")
        self.target.setShader(shader)
        return [shader]

    def getOutputs(self):
        return {
            "ScatteringCubemapPass.resultCubemap": lambda: self.cubemap,
        }
开发者ID:cesarmarinhorj,项目名称:RenderPipeline,代码行数:48,代码来源:ScatteringCubemapPass.py


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