Azamantes Posted December 5, 2015 Share Posted December 5, 2015 I am new to Pixi.js and I can't figure out what is this GraphicsData and how could I possibly make use of it.I noticed PIXI.Graphics() method called drawShape and that it returns PIXI.GraphicsData thing.I cannot draw it to a Graphics container, I cannot add it to the Stage with addChild() method. ParticleContainer also doesn't seem to work with it. What's the purpose of GraphicsData and how do I use it? Looks like a way to reuse once drawn graphics thus important. Quote Link to comment Share on other sites More sharing options...
mattstyles Posted December 5, 2015 Share Posted December 5, 2015 I just had a 5 minute poke through the code and they all get added to an array of graphics data, I bet if I poked through the renderer code I'd find something that handles graphics objects in the pipeline and that it would take all the graphics data (maybe optimise it if possible?) and then batch all the drawing together. Not sure what you could do with it, you could probably cache it somewhere, then if you altered your graphics data by drawing new stuff you could retrieve previous state. You could try adding it to the existing graphics data array but it would already be in there. edit: I did have a poke through the renderer, the main optimisation seems to be that it diffs state (kind of) so it'll only redraw when necessary (via the dirty flag). Quote Link to comment Share on other sites More sharing options...
xerver Posted December 9, 2015 Share Posted December 9, 2015 The GraphicsData object is an object that olds information about how to draw a Graphics object. It is used internally, you don't need to do anything to it. Azamantes 1 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.