Taz Posted April 8, 2017 Share Posted April 8, 2017 Hi, I'm looking at the documentation for Rope and Plane to try to see the difference and different use cases, but the use-case description and example construction are the same. It looks like the documentation for Plane is incorrect: the Plane constructor takes three arguments (texture, verticesX, verticesY), but the example passes only two arguments (texture, points). Shrug, I guess the Plane's use-case description and example were copied from Rope and never updated? So does anyone know when Plane is useful and maybe have a little example of creating one? Thanks in advance! EDIT: I guess the plane is for stretching a texture across a rectangle, but I still wonder how to convert the width and height from pixels to number of vertices. Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted April 9, 2017 Share Posted April 9, 2017 You can use this branch: https://github.com/pixijs/pixi.js/pull/3842 , https://pixijs.download/dev-mesh-update/pixi.js , look at the plane: https://github.com/pixijs/pixi.js/blob/dev-mesh-update/src/mesh/Plane.js It allows to use texture width/height as pixels width/height. It also allows to override "_refreshVertices", change coordinates of every vertex based on grid coords. Quote Link to comment Share on other sites More sharing options...
Taz Posted April 9, 2017 Author Share Posted April 9, 2017 Okay, looks like I just set the width and height properties and verticesX/Y don't affect the plane's dimensions at all. It seems like since Plane and Sprite both just use Container's width and height setters (which use scaling), then why would anyone use Plane instead of Sprite? Does setting verticesX and verticesY give control over the quality and that's its use case? The dev branch doesn't use scaling to set the width and height so I guess a use case would be higher-quality scaling/stretching of a texture (vs scaling a Sprite). And from your comment, I guess a new use case would be breaking the texture into parts and rearranging the locations of parts? Are there any other use cases / 'neat things' people are doing with the Plane class? Thanks for the links and info @ivan.popelyshev Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted April 9, 2017 Share Posted April 9, 2017 Current dev version cant rearrange parts, only scale/stretch parts of texture. Basically, you can swap Sprite to Plane and make geometry effects on it, like waves. New rope is also a subclass of Plane: it respects texture width/height to make default arrangement of points, then you can change them. Taz 1 Quote Link to comment Share on other sites More sharing options...
Taz Posted April 9, 2017 Author Share Posted April 9, 2017 That clears it up Thanks @ivan.popelyshev! P.S. updating the documentation for Plane to say that you can use it for geometry effects like waves would be awesome! Right now it still just repeats Rope's use case verbatim, but maybe that's a todo for when the new meshes get merged.. 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.