Skip to content

Commit 98f8ee6

Browse files
committed
Engine Examples updated to official RenderTarget constructor form
1 parent d93f290 commit 98f8ee6

File tree

5 files changed

+22
-6
lines changed

5 files changed

+22
-6
lines changed

examples/graphics/model-outline.html

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,10 @@
7070
minFilter: pc.FILTER_LINEAR,
7171
magFilter: pc.FILTER_LINEAR
7272
});
73-
var renderTarget = new pc.RenderTarget(this.app.graphicsDevice, texture, { depth: true });
73+
var renderTarget = new pc.RenderTarget({
74+
colorBuffer: texture,
75+
depth: true
76+
});
7477

7578
// create a layer for rendering to texture, and add it to the beginning of layers to render into it first
7679
var outlineLayer = new pc.Layer({ name: "OutlineLayer" });
@@ -142,7 +145,10 @@
142145
magFilter: pc.FILTER_LINEAR
143146
});
144147
renderTarget.destroy();
145-
renderTarget = new pc.RenderTarget(this.app.graphicsDevice, texture, { depth: true });
148+
renderTarget = new pc.RenderTarget({
149+
colorBuffer: texture,
150+
depth: true
151+
});
146152
outlineLayer.renderTarget = renderTarget;
147153

148154
app.scene.layers.insert(outlineLayer, 0);

examples/graphics/painter.html

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,10 @@
6767
minFilter: pc.FILTER_LINEAR,
6868
magFilter: pc.FILTER_LINEAR
6969
});
70-
var renderTarget = new pc.RenderTarget(this.app.graphicsDevice, texture, { depth: false });
70+
var renderTarget = new pc.RenderTarget({
71+
colorBuffer: texture,
72+
depth: false
73+
});
7174

7275
// create a layer for rendering to texture, and add it to the beginning of layers to render into it first
7376
var paintLayer = new pc.Layer({ name: "paintLayer" });

examples/graphics/render-to-texture.html

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,10 @@
8181
addressU: pc.ADDRESS_CLAMP_TO_EDGE,
8282
addressV: pc.ADDRESS_CLAMP_TO_EDGE
8383
});
84-
var renderTarget = new pc.RenderTarget(this.app.graphicsDevice, texture, { depth: true });
84+
var renderTarget = new pc.RenderTarget({
85+
colorBuffer: texture,
86+
depth: true
87+
});
8588

8689
// create a layer for object that do not render into texture
8790
var excludedLayer = new pc.Layer({ name: "Excluded" });

scripts/posteffects/posteffect-bloom.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,10 @@ function BloomEffect(graphicsDevice) {
187187
colorBuffer.addressU = pc.ADDRESS_CLAMP_TO_EDGE;
188188
colorBuffer.addressV = pc.ADDRESS_CLAMP_TO_EDGE;
189189
colorBuffer.name = 'pe-bloom';
190-
var target = new pc.RenderTarget(graphicsDevice, colorBuffer, { depth: false });
190+
var target = new pc.RenderTarget({
191+
colorBuffer: colorBuffer,
192+
depth: false
193+
});
191194

192195
this.targets.push(target);
193196
}

scripts/utils/cubemap-renderer.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@ CubemapRenderer.prototype.initialize = function () {
6969
for (var i = 0; i < 6; i++) {
7070

7171
// render target, connected to cubemap texture face
72-
var renderTarget = new pc.RenderTarget(this.app.graphicsDevice, this.cubeMap, {
72+
var renderTarget = new pc.RenderTarget({
73+
colorBuffer: this.cubeMap,
7374
depth: this.depth,
7475
face: i
7576
});

0 commit comments

Comments
 (0)