Skip to content

Commit

Permalink
Merge branch 'main' into alpha
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuaellis committed Mar 21, 2021
2 parents 08e9a0a + cc0d10f commit 5f0afe8
Showing 1 changed file with 37 additions and 28 deletions.
Original file line number Diff line number Diff line change
@@ -1,31 +1,40 @@
import { Color } from 'three'
import { Pass } from '../postprocessing/Pass'

var RenderPass = function (scene, camera, overrideMaterial, clearColor, clearAlpha) {
Pass.call(this)

this.scene = scene
this.camera = camera

this.overrideMaterial = overrideMaterial

this.clearColor = clearColor
this.clearAlpha = clearAlpha !== undefined ? clearAlpha : 0

this.clear = true
this.clearDepth = false
this.needsSwap = false
this._oldClearColor = new Color()
}

RenderPass.prototype = Object.assign(Object.create(Pass.prototype), {
constructor: RenderPass,

render: function (renderer, writeBuffer, readBuffer /*, deltaTime, maskActive */) {
var oldAutoClear = renderer.autoClear
import { Camera, Color, Material, Scene, WebGLRenderTarget, WebGLRenderer } from 'three'
import { Pass } from './Pass'

class RenderPass extends Pass {
public scene: Scene
public camera: Camera
public overrideMaterial: Material | undefined
public clearColor: Color | undefined
public clearAlpha: number
public clearDepth = false
private _oldClearColor = new Color()

constructor(scene: Scene, camera: Camera, overrideMaterial?: Material, clearColor?: Color, clearAlpha = 0) {
super()

this.scene = scene
this.camera = camera

this.overrideMaterial = overrideMaterial

this.clearColor = clearColor
this.clearAlpha = clearAlpha

this.clear = true
this.needsSwap = false
}

public render(
renderer: WebGLRenderer,
writeBuffer: WebGLRenderTarget,
readBuffer: WebGLRenderTarget /*, deltaTime, maskActive */,
): void {
let oldAutoClear = renderer.autoClear
renderer.autoClear = false

var oldClearAlpha, oldOverrideMaterial
let oldClearAlpha
let oldOverrideMaterial: Material | null = null

if (this.overrideMaterial !== undefined) {
oldOverrideMaterial = this.scene.overrideMaterial
Expand Down Expand Up @@ -59,7 +68,7 @@ RenderPass.prototype = Object.assign(Object.create(Pass.prototype), {
}

renderer.autoClear = oldAutoClear
},
})
}
}

export { RenderPass }

0 comments on commit 5f0afe8

Please sign in to comment.