blakjak44 Posted September 20, 2021 Share Posted September 20, 2021 I'm trying to create a display object that can act as a view of a scene so that I can create multiple views of the same data. I know I can do something like this: const scene = new PIXI.Container() // Add some objects to the scene const rt_0 = PIXI.createRenderTexture({ width: 100, height: 100 }) const rt_1 = PIXI.createRenderTexture({ width: 100, height: 100 }) const view_0 = PIXI.Sprite(rt_0) const view_1 = PIXI.Sprite(rt_1) app.stage.addChild(view0, view_1) app.renderer.render(scene, view0) app.renderer.render(scene, view1) app.render(app.stage) But I would rather create each view as a custom DisplayObject so that I can update the RenderTexture whenever the view's `_render()` method is called. I've tried implementing this but I'm having some difficulty understanding how to update the transform of the scene per view. The transforms that I apply to one view seem to persist when the next view is rendered, which I don't want. I have a playground example below. Any help would be appreciated! https://www.pixiplayground.com/#/edit/Rng2NS_oI7xgw4jxH9HpF Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted September 21, 2021 Share Posted September 21, 2021 so far you can only apply different "transforms" , see this parameter for "render" function. // I would have thought that the transform I apply here // would override any previous transforms this.scene.transform = this.camera.transform Oh shit. Here you stumbled across "updateID"s. You cant just re-assign transform, because nothing will be done if its worldID is not greater than worldID of previous transform. Pleas look in "transform" fields, there's something like i describe there Quote Link to comment Share on other sites More sharing options...
blakjak44 Posted September 28, 2021 Author Share Posted September 28, 2021 @ivan.popelyshevAh ok that makes sense. I ended up going with a different solution where I just apply the transform to the scene in the renderer.render() call. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.