Commit Graph

7 Commits

Author SHA1 Message Date
Philip Rideout
5da454f652 JavaScript: concise texture creation functions
This makes our createTexture* helpers more consistent with the
createMaterial helper, and extends the wrapped Engine class with new
methods.

Before, clients did something like this:

    const ao = Filament.createTextureFromPng(Filament.assets['foo.png'], engine);
    ...
    engine.destroyTexture(ao);

Now, they can do:

    const ao = engine.createTextureFromPng('foo.png');
    ...
    engine.destroyTexture(ao);

This is more symmetric and concise. In general the JS API now supports a
class of "buffer-like" objects which exploit dynamic typing in order to
accept any of the following: BufferDescriptor, asset string, or
Uint8Array.
2018-10-29 18:09:45 -07:00
Philip Rideout
605a836565 Add JavaScript utility functions to reduce boilerplate. (#406)
* JS utilities: simplified render method.

* redball tutorial now rotates camera.

* JS utilities: add createTextureFromKtx.

* JS utilities: add createIblFromKtx.

* Repair testwasm.

* Update libs/filamentjs/docs/tutorial_redball.md

Co-Authored-By: prideout <philiprideout@gmail.com>

* Update libs/filamentjs/docs/tutorial_redball.md

Co-Authored-By: prideout <philiprideout@gmail.com>

* Update libs/filamentjs/docs/tutorial_redball.md

Co-Authored-By: prideout <philiprideout@gmail.com>
2018-10-18 18:19:05 -07:00
Philip Rideout
83de0fc3e8 The redball tutorial now describes matc and cmgen.
This commit also adds a help option to `build.py` and allows
customization of the output folder.
2018-10-18 16:46:15 -07:00
Philip Rideout
356c3a2c24 Flesh out the JavaScript tutorials. 2018-10-18 12:29:22 -07:00
Philip Rideout
d324dc724a Start another literate tutorial / demo for JavaScript.
Unlike the triangle tutorial, this is more focused on materials and 3D
rendering. While much of the verbiage is still TBD, the code snippets
already produce a functional demo after being glued together by the
tangler script.
2018-10-18 12:29:22 -07:00
Philip Rideout
d3e7f40398 Add IBL to jsbinding and testwasm. 2018-10-17 16:13:53 -07:00
Philip Rideout
e7777ef330 Add literate JavaScript tutorial and Python tangler.
This commit contains a markdown file for a "hello triangle" tutorial
as well as a Python script that does two things:

1) Extracts JavaScript code blocks from the markdown to generate the
   code for the demo.

2) Converts the markdown into a nicely-rendered web page.

After we invoke the Python script for the first time, it will create
a set of files in the root docs folder, which will automatically be
published via GitHub Pages to the following URL.

    https://google.github.io/filament/webgl

This gives us an official place to host the latest web demos and
tutorials.

The tutorial can be previewed
[here](https://prideout.net/prototype/webgl/tutorial_triangle.html).
More JavaScript tutorials are forthcoming.
2018-10-15 12:42:13 -07:00