Skip to content

Commit 811ffc4

Browse files
committed
make post effect work with shader editor
1 parent 06ea0fb commit 811ffc4

File tree

2 files changed

+30
-13
lines changed

2 files changed

+30
-13
lines changed

src/framework/components/camera/post-effect-queue.js

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -162,19 +162,25 @@ Object.assign(PostEffectQueue.prototype, {
162162
var order = 0;
163163
var i;
164164
var start = layerList.length - 1;
165-
for (i = start; i >= 0; i--) {
166-
if (layerList[i].id === LAYERID_UI) {
167-
start = i - 1;
168-
169-
this._origOverrideClear = layerList[i].overrideClear;
170-
this._origClearColorBuffer = layerList[i].clearColorBuffer;
171-
this._origDepthColorBuffer = layerList[i].clearDepthBuffer;
172-
this._origStencilColorBuffer = layerList[i].clearStencilBuffer;
173-
174-
layerList[i].overrideClear = true;
175-
layerList[i].clearColorBuffer = false;
176-
layerList[i].clearDepthBuffer = this.camera.clearDepthBuffer;
177-
layerList[i].clearStencilBuffer = this.camera.clearStencilBuffer;
165+
for (i = start; i >= 0; i--)
166+
{
167+
if (this.camera.layers.indexOf(layerList[i].id) != -1)
168+
{
169+
if (layerList[i].id === LAYERID_UI)
170+
{
171+
start = i - 1;
172+
173+
this._origOverrideClear = layerList[i].overrideClear;
174+
this._origClearColorBuffer = layerList[i].clearColorBuffer;
175+
this._origDepthColorBuffer = layerList[i].clearDepthBuffer;
176+
this._origStencilColorBuffer = layerList[i].clearStencilBuffer;
177+
178+
layerList[i].overrideClear = true;
179+
layerList[i].clearColorBuffer = false;
180+
layerList[i].clearDepthBuffer = this.camera.clearDepthBuffer;
181+
layerList[i].clearStencilBuffer = this.camera.clearStencilBuffer;
182+
183+
}
178184
break;
179185
}
180186
}

src/graphics/program-lib/programs/node.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,12 +148,23 @@ var node = {
148148

149149
// FRAGMENT SHADER DECLARATIONS
150150
code += 'uniform vec3 view_position;\n';
151+
if (options.previewPort)
152+
{
153+
code += '#define PREVIEW_MAT;\n';
154+
}
151155

152156
code += 'varying vec3 vPosition;\n';
153157
code += 'varying vec3 vNormal;\n';
154158
code += 'varying vec4 vColor;\n';
155159
code += 'varying vec2 vUv0;\n';
156160

161+
if (options.pass === 'PP' || options.previewPort)
162+
{
163+
code += "uniform sampler2D uColorBuffer;\n";
164+
//code += "uniform sampler2D uDepthMap;\n";
165+
code += chunks.screenDepthPS;
166+
}
167+
157168
if (options.fog) {
158169
code += fogCode(options.fog);
159170
}

0 commit comments

Comments
 (0)