예제 #1
0
def buildBackBufferCopyPhase(renderTarget):
    global backBufferCopyCache
    if renderTarget == None:
        from RenderTargets import rt
        renderTarget = rt('PostProcessing/backBufferCopy')
    if backBufferCopyCache.has_key(renderTarget):
        return backBufferCopyCache[renderTarget]
    else:
        c = CopyBackBuffer()
        c.renderTarget = renderTarget
        backBufferCopyCache[renderTarget] = c
        return c
예제 #2
0
def buildPhase(input, output, fxFile, sampleProvider = straightTransfer4Tap, srcBlend = BW_BLEND_ONE, destBlend = BW_BLEND_ZERO):
    if input == None:
        from RenderTargets import rt
        input = rt('PostProcessing/backBufferCopy').texture
    if sampleProvider == straightTransfer4Tap:
        f = TransferQuad()
    else:
        f = FilterQuad()
        f.samples = sampleProvider()
    p = Phase()
    m = Material(fxFile)
    m.inputTexture = input
    p.filterQuad = f
    p.material = m
    p.material.srcBlend = srcBlend
    p.material.destBlend = destBlend
    p.renderTarget = output
    p.clearRenderTarget = False
    return p