-
Notifications
You must be signed in to change notification settings - Fork 320
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Phaser 3 support and npm package publishing #66
Comments
Thank you! I am interested to take a look and see how this is progressing! |
Ok I looked over some of your issues. firstly these items:
I can see in these three situations you need a reference to the current scene. I want to show you the basic plugin boilerplate I started with : https://github.com/simiancraft/create-phaser-app/blob/dragonbones-and-plugin-approach/src/plugins/dragonbones.js So here is the important part. Ideally you would write this as a plugin, which means to include this plugin in Phaser, you do this in your game config object
this means that the
I've written that in es6, but I imagine is should map naturally to TypeScript That is how to get the scene reference. Here is a demo of a simple scene plugin: More examples here: http://labs.phaser.io/index.html?dir=plugins/&q= As for the remaining items you posted, how would you get triangles or skew things? This I am less sure about, but I am certain you can create a custom pipeline to access webgl functionality. I will show you what I know and I hope the information is useful. So here is how you can do that from Phaser's custom pipeline system:
Inside the custom pipeline: (see [here] (https://github.com/simiancraft/create-phaser-app/tree/dragonbones-and-plugin-approach/src/rendering-pipelines)) in the main file:
and the vert and frag data:
TextureTint.frag:
To use this 'new' pipeline on something, you target it in your scene.. which you should have access to in the plugin:
I know that second answer isn't exactly how you'd use it for your plugin, but perhaps there is a way to register a custom pipeline that you can access in your plugin,and you can do anything you'd need to do in there. If you want a demo of custom pipeline rendering, here is a demo |
Just to cover my bases on how to achieve a skew in Phaser 3, I did come across this demo here: Maybe a similar effect to |
I still don't know much about the phaser 3. I will try to improve it later :) |
@akdcl I appreciate your effort! I also wanted to tell you that a new version of phaser 3 was released today as well : https://phaser.io/download/release/3.10.0 |
@the-simian new db for phaser3 is ready, it will soon be merged to master. |
Excellent! We are eager to see it! |
About the phaser mesh.index problem, can you kindly add a workaround for it? When updating the slot frame and mesh, you can simply iterate through the indices array of DB slot mesh data, fetch vertex and uv from vertices and uvs array according to current index value, then append them to the phaser mesh - That means, 'do indexing manually'. Although its performance can not reach the hardware indicing way, but we can then use DB mesh skin animation in phaser now and it will be very fine. Even if in the future phaser may add indices to their mesh object, you only need to modify a little iteration codes to fit it. |
@Arthur3DLHC thank you. actually it was queued: but it depends, as currently busy on other project, I'm sorry. |
Thanks for your reply. I can understand and I' keep waiting : ) |
Hi |
@pavels thank you, these changes are applied here in my local proj already, they'll be pulled with other changes together but have to wait till a version is merged into the master branch so that users can choose to use Phaser 3.12 or 3.13+. |
@jcyuan the renamed method is already in phaser 3.12 - https://github.com/photonstorm/phaser/blob/v3.12.0/src/renderer/webgl/pipelines/TextureTintPipeline.js the rename happened between 3.11 ( |
@pavels LOL, yep... sorry, messed up. |
@jcyuan one more thing - now if youload assets in different scene than you want to use them (you have preloader scene where you load assets and main game scene where you use them) it doesn't work. Do you have fix for that? If not i can look into this issue. |
please do it, PR for dev branch please |
Hi - i have also done the mesh implementation (indicies are computed in code as Phaser has no support for them at the moment) - i have it done just locally now |
Thanks for everyone's work on this. Phaser 3 support would be a great help. I wanted to point out that Phaser's 3.15 release just dropped a couple days ago, and it includes Spine support. It may be of help to some here to take a look at the source to see if there's any common problems that have been solved there. For the time being, simply exporting from Dragonbones to Spine format may be an easy workaround for anyone wanting to use DB with Phaser. |
@wsrast yes noticed that. thanks for the suggestion. I'll look into it to see if something helps. @pavels thank you for your effort, I guess there will be a big change later as what @wsrast said. really busy these days though... |
Very true. I'd much rather see DragonBones supported directly in Phaser! |
@pavels please provide minimal example how load and show exported DB objects in Phaser 3! Thanks! |
@gritsenko demos are already updated for phaser 3 (https://github.com/DragonBones/DragonBonesJS/tree/dev/Phaser/Demos) - @jcyuan did that already |
it's merged, thanks for you efforts, will do more tests later.
Another thing: |
Phaser 3 is released and I was wondering if you would consider supporting it, and publishing the module on npm. if you wanted to release all your JS plugins, you could consider a tool like lerna. This way you can keep your monorepo, but released the different run-times seperately
I am working on a boilerplate called
create-phaser-app
. I'd love to include this in the "templated project" because its free and open source.If you released a Phaser 3 plugin could also support CommonJs modules? Module-tree-shaking and similar technology can work to reduce the size of the package. In Phaser 3, modules are fully supported, instead of relying only on global namespaces. Maybe something with this structure
I spent some time last night taking a try to port the code. Yet, the
dragonbones-runtime
andcommon-module
are more complex than I expected. I saw that you extended the Slot and the BaseFactory inside of your .ts files, yet a many of the methods deprecated in 5.5. For example theDataParser
methodes. I wasn't completely sure what was the right approachHere are some thing that might help to know:
Let me know if there's anything I can do to help, thank you!
The text was updated successfully, but these errors were encountered: