Jump to content

Multiple views of same scene.


Recommended Posts

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)


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!


Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...