This adds an archive step to `build.sh` and adds `build/web`.
The archive is a tgz that contains the contents of `public`, which only consists of the files needed for a simple static web server.
The files in `build/web` are almost identical to the mac build, except that they use the `/web/` path and install the emscripten SDK.
This removes the trick of drawing to a 2D canvas. It was corrupting the
alpha in RGBM images, which caused subtle banding in the Suzanne
reflection. Moreover it added complexity to the demo code.
This commit will increase the pre-zipped WASM size by 17k, but I think
it's worth it.
This also removes one of the cmgen passes in the WebGL build; we were
using PNG instead of RGBM for the skybox to work around the banding
issue that this fixes.
Some browsers complain about missing charset metadata etc, so this makes
our HTML samples a bit more legit.
Also, using an opaque canvas improves performance and makes it easier to
diagnose bugs.
* Auto-convert MaterialGraphComponent to Kotlin
* Introduce new view rendering
* Add expressionMap to graph
* Show data width on slots
* Compile all nodes when compiling, even unconnected nodes
* Remove old views
* Exclude comments from brace parsing in vertex/fragment blocks
If a comment contained an opening brace { but not the matching
closing one, matc would not count braces properly and not find
the proper end of a vertex/fragment block.
* Add test
* Introduce dimensions to Expression
* Rename to setExpressionForSlot and add redComponent function
* Add Expression helpers to aid with differing data widths
* Add Float2ConstantNode
* Single-line functions when possible
* Properly initialize VulkanBinder::mDescriptorKey
Previously, the contents of mDescriptorKey were not being initialized during VulkanBinder construction. This could leads to bugs, such as getOrCreateDescriptor finding false entries inside the DescriptorKey::uniformBuffers or DescriptorKey::samplers arrays.
* Spaces instead of tabs
For shame ;(
This uses "foreach" in order to create proper dependencies for each
cubemap face and miplevel.
It also adds a custom command for the mesh and envmap assets, similar to
how we already handle materials. This seems to work properly and
rebuilds the assets only when upstream dependencies have been dirtied,
or when downstream dependencies have been deleted.
* Introduce two WebGL samples: triangle and suzanne.
This commit has no effect on mobile / desktop builds, it only adds new
targets to the `-p webgl` build.
We will eventually expose a proper JavaScript API, but for now these
samples use a (somewhat under-engineered) `filaweb` framework whereby
the WebAssembly module exposes a small number of C entry points: launch,
render, and resize.
Each sample has two source files: a cpp file and an html file. The cpp
file generates js / wasm pair. The generated js is simply a loader for
the wasm.
The CMake script creates a pristine "public" folder which contains the
minimal set of files needed to serve the web application using a simple
static file server. The public folder like this:
/suzanne.js built by em++ from suzanne.cpp
/suzanne.wasm built by em++ from suzanne.cpp
/suzanne.html copied from REPO/samples/web
/filaweb.js copied from REPO/samples/web
/favicon.png copied from REPO/samples/web
/monkey/*.png copied from REPO/assets/models
/monkey/*.filamesh built by filamesh
/desert/* built by cmgen
To decode PNG textures, we use the somewhat unusual approach of using
JavaScript to draw them into a hidden 2D canvas, then reading back the
pixels. This allows us to avoid fattening up the wasm file with a PNG
decoder. An alternative idea would be to pass a DOM Image directly into
glTexImage2D, but this would require some #ifdefing and/or JS injection
in Filament's OpenGL backend.
* Optimize the suzanne material.
According to the spec, an attribute declared as an integer (ivec* or uvec* in the shaders) but be bound using `glVertexAttribIPointer` instead of `glVertexAttribPointer`. This means we were not binding bone indices correctly for GPU skinning. This issue was hidden by lenient drivers, particularly on Android.
wglMakeCurrent requires the pixel format match between the HGLRC and HDC. Previously, the pixel format of the HDC wasn't explicitly set, and on most implementations, this leads to a failure.
There's also the option of stashing off the pixel format index, but this minimizes state stashed.