pixi-cull icon indicating copy to clipboard operation
pixi-cull copied to clipboard

Import without Node.js

Open gburlet opened this issue 4 years ago • 4 comments

First of all, thanks for the library! Really important for optimization so thanks for putting this together and maintaining.

I started setting this up last night following the code snippet in the README and it's not quite working as presented for non Node.js users like myself.

README setup tutorial:

or grab the latest release and use it:
<script src="/directory-to-file/pixi.js"></script>
<script src="/directory-to-file/pixi-cull.min.js"></script>
<script>
    var SimpleCull = new PIXI.extras.Cull.Simple();
</script>

☝️ the latest release link in README maps to pixi-viewport, not the releases for pixi-cull btw

Running this setup, it can't find Cull in PIXI.extras. In fact, the PIXI object does not have extras. I can't see anywhere in the source where this gets added to PIXI.extras - it looks like it just creates classes Simple and SpatialHash in the global scope, so I tried calling those. Constructing Simple using var viewFrustumCuller = new Simple(); also results in an error:

Uncaught ReferenceError: Simple is not defined
    at setupUI (pixibox.js:61)
    at t.value (mini-signals.js:93)
    at e._onComplete (resource-loader.esm.js:2233)
    at resource-loader.esm.js:2271

To get this to load I had to rip out all of the top-level export wrappers in the pixi-cull.js build. It now loads but not sure if it's working yet.

So my question here is: is this a bug or am I setting this up incorrectly?

Mirroring #3 and reopening because issue still remains. Perhaps it's just a matter of updating the docs for ease of understanding how to set this up. Would be great if this was namespace scoped like other pixi libraries: for example, pixi-filters when I include pixi-filters.js I can access everything with PIXI.filters.GlowFilter.

Using latest version of PIXI: 6.0.0-rc.3 on WebGL 2

gburlet avatar Mar 01 '21 18:03 gburlet

PIXI moved away from supporting PIXI.extras. Have you tried pixi-cull with import or require() instead? That's how I usually use it. If needed, i can go back and ensure it's properly exporting to the window object. Let me know.

davidfig avatar Mar 04 '21 01:03 davidfig

Having the same exact issue here

Vardan92 avatar Mar 31 '21 09:03 Vardan92

The bundling system for pixi-cull is old. I need to redo it. I'll try to get it to it this week.

davidfig avatar Apr 02 '21 00:04 davidfig

I updated the projected to v2.0.1. It is now accessible via the window.Cull variable. See the README.md for more information. Let me know if you run into any problems!

davidfig avatar Apr 08 '21 23:04 davidfig