Jump to content

Sprite object re-init for Pooling


bvalosek
 Share

Recommended Posts

I am in the process of bolting PixiJS onto an existing JS game engine. 

 

Currently the engine uses object pooling comprehensively for all components and game entities, and I was planning on having the engine's Sprite component contain a PIXI.js sprite that is used during rendering.

 

My main question is this: What is the proper way to go about "re-initializing" A PixiJS sprite if I were to pool them? Are theres some general pooling strategies that I should use (e.g, only re-use Sprite objects if the Texture is going to be the same, make sure to reset some underlying cached state... etc).

 

I know I'll have to (re)set the position, rotation, etc properties, but was wondering if there are some larger caveats I need to be aware of.

 

I am only using the WebGL renderer and not making any use of interactivity, if it matters.

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.

Guest
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.

Loading...
 Share

  • Recently Browsing   0 members

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