Skip to content

Commit 92eca8d

Browse files
committed
Use the new Camera post pipeline feature
1 parent 06c9013 commit 92eca8d

1 file changed

Lines changed: 11 additions & 99 deletions

File tree

src/renderer/webgl/WebGLRenderer.js

Lines changed: 11 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -2125,6 +2125,8 @@ var WebGLRenderer = new Class({
21252125

21262126
var color = camera.backgroundColor;
21272127

2128+
this.pipelines.preBatch(camera);
2129+
21282130
this.pushScissor(cx, cy, cw, ch);
21292131

21302132
if (camera.mask)
@@ -2146,64 +2148,10 @@ var WebGLRenderer = new Class({
21462148
);
21472149
}
21482150

2149-
/*
2150-
if (camera.renderToTexture)
2151+
if (camera.postPipeline)
21512152
{
2152-
this.flush();
2153-
2154-
this.pushScissor(cx, cy, cw, -ch);
2155-
2156-
this.setFramebuffer(camera.framebuffer);
2157-
2158-
var gl = this.gl;
2159-
2160-
gl.clearColor(0, 0, 0, 0);
2161-
2162-
gl.clear(gl.COLOR_BUFFER_BIT);
2163-
2164-
ProjectOrtho(MultiPipeline, cx, cw + cx, cy, ch + cy, -1000, 1000);
2165-
2166-
if (camera.mask)
2167-
{
2168-
this.currentCameraMask.mask = camera.mask;
2169-
this.currentCameraMask.camera = camera._maskCamera;
2170-
2171-
camera.mask.preRenderWebGL(this, camera, camera._maskCamera);
2172-
}
2173-
2174-
if (color.alphaGL > 0)
2175-
{
2176-
MultiPipeline.drawFillRect(
2177-
cx, cy, cw + cx, ch + cy,
2178-
Utils.getTintFromFloats(color.redGL, color.greenGL, color.blueGL, 1),
2179-
color.alphaGL
2180-
);
2181-
}
2182-
21832153
camera.emit(CameraEvents.PRE_RENDER, camera);
21842154
}
2185-
else
2186-
{
2187-
this.pushScissor(cx, cy, cw, ch);
2188-
2189-
if (camera.mask)
2190-
{
2191-
this.currentCameraMask.mask = camera.mask;
2192-
this.currentCameraMask.camera = camera._maskCamera;
2193-
2194-
camera.mask.preRenderWebGL(this, camera, camera._maskCamera);
2195-
}
2196-
2197-
// if (color.alphaGL > 0)
2198-
// {
2199-
// MultiPipeline.drawFillRect(
2200-
// cx, cy, cw , ch,
2201-
// Utils.getTintFromFloats(color.redGL, color.greenGL, color.blueGL, 1),
2202-
// color.alphaGL
2203-
// );
2204-
// }
2205-
}
2206-
*/
22072155
},
22082156

22092157
/**
@@ -2255,56 +2203,20 @@ var WebGLRenderer = new Class({
22552203

22562204
this.popScissor();
22572205

2258-
/*
2259-
if (camera.renderToTexture)
2206+
if (camera.mask)
22602207
{
2261-
multiPipeline.flush();
2262-
2263-
this.setFramebuffer(null);
2264-
2265-
camera.emit(CameraEvents.POST_RENDER, camera);
2266-
2267-
if (camera.renderToGame)
2268-
{
2269-
ProjectOrtho(multiPipeline, 0, multiPipeline.width, multiPipeline.height, 0, -1000.0, 1000.0);
2270-
2271-
var getTint = Utils.getTintAppendFloatAlpha;
2272-
2273-
var pipeline = (camera.pipeline) ? camera.pipeline : multiPipeline;
2274-
2275-
pipeline.batchTexture(
2276-
camera,
2277-
camera.glTexture,
2278-
camera.width, camera.height,
2279-
camera.x, camera.y,
2280-
camera.width, camera.height,
2281-
1, 1,
2282-
0,
2283-
camera.flipX, !camera.flipY,
2284-
1, 1,
2285-
0, 0,
2286-
0, 0, camera.width, camera.height,
2287-
getTint(camera.tintTopLeft, camera._alphaTL),
2288-
getTint(camera.tintTopRight, camera._alphaTR),
2289-
getTint(camera.tintBottomLeft, camera._alphaBL),
2290-
getTint(camera.tintBottomRight, camera._alphaBR),
2291-
camera.tintFill,
2292-
0, 0,
2293-
this.defaultCamera,
2294-
null
2295-
);
2296-
}
2208+
this.currentCameraMask.mask = null;
22972209

2298-
// Force clear the current texture so that items next in the batch (like Graphics) don't try and use it
2299-
this.setBlankTexture(true);
2210+
camera.mask.postRenderWebGL(this, camera._maskCamera);
23002211
}
2301-
*/
23022212

2303-
if (camera.mask)
2213+
if (camera.postPipeline)
23042214
{
2305-
this.currentCameraMask.mask = null;
2215+
camera.emit(CameraEvents.POST_RENDER, camera);
23062216

2307-
camera.mask.postRenderWebGL(this, camera._maskCamera);
2217+
this.pipelines.postBatch(camera);
2218+
2219+
this.resetTextures();
23082220
}
23092221
},
23102222

0 commit comments

Comments
 (0)