Giter Club home page Giter Club logo

Comments (7)

englercj avatar englercj commented on May 18, 2024

The unfortunate part about this is that all other tooling related to writing these shaders breaks (syntax highlighting, compilation checking, etc).

from filters.

bigtimebuddy avatar bigtimebuddy commented on May 18, 2024

@finscn's approach is useful if you need to compose multiple fragments. It can help reduce common code and to create better maintainability and encapsulation of functionality. The tradeoff, like @englercj is that it makes the shaders less friendly with outside tools.

Since we don't have a big need to compose multiple fragments (other than maybe Godray #40), there isn't really a big need to convert .frag files to JS modules for the purpose of templating. And the common code eliminated is so small, the tradeoff doesn't seem worth it.

Interesting approach, but not the right choice for pixi-filters.

from filters.

finscn avatar finscn commented on May 18, 2024

@bigtimebuddy @englercj , I think we could Create a tool to convert the pure .frag / .vert files to js file .frag.js / .vert.js.

And import the .frag.js and .vert.js in filter js.

when build pixi , run the convert tool first , then do ES6 compile.

the convert tool fetch all .frag and .vert files that start with // convert-js (just a flag) , then add

export default ` 

and

`;

to the files , then create new files .frag.js and .vert.js.

The files don't start with // convert-js won't be converted.

And I think we can add this feature to pixify , the gulp script could do the work.

from filters.

bigtimebuddy avatar bigtimebuddy commented on May 18, 2024

@finscn, you are proposing more complexity for little reward. Introducing a lot of hidden magic into the build process is not a big win.

What problem are you trying to solve? If you want to chop a bunch of small files into even smaller files so that you can reuse single lines (e.g., varying vec2 vTextureCoord;), that's not worth the effort. If your goal is to compose fragments, doing a simple JS string replace with a token will do the same thing without a lot of custom build operations or plugins.

I agree with you that glslify or babel-plugin-static-fs are not great solutions for PixiJS. But Rollup allows us to easily import non-JS as strings and has lots of benefits over Browserify and works with Webpack and browsers.

from filters.

finscn avatar finscn commented on May 18, 2024

I don't want to solve any problem.
I just love standard ES script.
So I don't like that there are some non-ES-feature in pixi's JS file.

When will you use Rollup for pixi.js ? Is there a roadmap or plan ?

from filters.

bigtimebuddy avatar bigtimebuddy commented on May 18, 2024

As soon as @GoodBoyDigital finishes merging dev into next then I'm going to start implementing Rollup and Lerna for v5. I'm hoping sometime in the next few weeks.

from filters.

finscn avatar finscn commented on May 18, 2024

Waiting that pixi.js uses Rollup and Lerna.

from filters.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.