google / filament

Filament is a real-time physically based rendering engine for Android, iOS, Windows, Linux, macOS, and WebGL2
https://google.github.io/filament/
Apache License 2.0
17.82k stars 1.89k forks source link

[Web] "Module is not defined" #2715

Closed segefjord closed 4 years ago

segefjord commented 4 years ago

Filament web v1.7.0

ReferenceError: Module is not defined
filament.js:638
ReferenceError: Module is not defined
filament.js:654

I'm completely new to WASM and Filament, but i figured, that line 6 in filament.js would be the wasm-loader, but minified. Looking into the end of that line, it seems like it returns Filament rather than Module - looking a bit into emscripten, i was able to figure out that changing "Module" to "Filament" on line 638 and 654, would resolve the issue, and i was then able to load the sample succesfully with no erros in console! 🤠 ✅

Tried first with the original file from //unpkg as suggested by the tutorial - later downloaded the web version from releases v1.7.0 so i could change it.

Being new to Filament, and wanting to set up a production environment, i am worried if i'm doing something wrong, or if this is simply a bug. Please let me know 🙏

To Reproduce Follow the guide on https://google.github.io/filament/webgl/tutorial_redball.html

Expected behavior Expected to load redball.html demo with no errors in console.

Screenshots

Skærmbillede 2020-06-20 kl  11 26 11 PM

Thank you for this amazing engine!

segefjord commented 4 years ago

After changing Module to Filament on line 638 and 654, everything works fine, even suzanne:

Skærmbillede 2020-06-21 kl  12 27 23 AM
prideout commented 4 years ago

Thanks for the bug report, I'll see if I can repro. The live demos work right now, and I recently updated them. However they use a checked-in wasm file rather than unpkg. I will change that, it will help catch issues.

prideout commented 4 years ago

This was fixed in https://github.com/google/filament/commit/242e8d1b567bef920f6535fea393f44ed28a4de5#diff-5f50d59dee9fdfd4b554f60e760a525d

segefjord commented 4 years ago

Amazing work, thank you for maintaining Filament 💯