Commit Graph
224 Commits
Author SHA1 Message Date
Ben Doherty 29119c7248 Add iOS support to Filament (#360) 2018-10-18 12:42:13 -07:00
Philip Rideout 356c3a2c24 Flesh out the JavaScript tutorials. 2018-10-18 12:29:22 -07:00
Philip Rideout b0853b5eb6 jsbindings: fix buffer lifetime bug.
This is a fix-up to f5319f2.
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 f5319f2492 jsbindings: fix buffer lifetime bug.
In order to match its JavaScript counterpart, the Buffer wrapper needs
to use reference counting, and the easiest way to achieve that is
with shared_ptr.
2018-10-17 16:13:53 -07:00
Philip Rideout e00ba80561 jsbindings: add JS utilities, enhance testwasm. 2018-10-17 10:17:04 -07:00
Philip Rideout d15e275de0 Add glMatrix to third_party.
Some of our web tests and demos will make use of this library, and it's
useful to leverage a local copy instead of a CDN during development.
2018-10-17 09:57:08 -07:00
Mathias Agopian 8452c4f8f2 Add usage hints to the driver 2018-10-16 16:23:24 -07:00
Mathias Agopian b374340ebb skinning allows 256 bones again, but disallow skews. 2018-10-16 15:56:30 -07:00
Philip Rideout 9e5f44bd34 Consolidate two filamesh readers into a lib. 2018-10-16 13:31:16 -07:00
Philip Rideout d9204052c8 Fix potential issue with detached ArrayBuffer. 2018-10-15 18:35:53 -07:00
Philip Rideout 5a8d4d818c Remove bad exception handler from wasmloader.
It is incorrect to assume that any exception thrown during onReady
must be due to a faulty download.
2018-10-15 18:35:53 -07:00
Philip Rideout cd84980c84 Add tests for filamentjs. 2018-10-15 18:35:53 -07:00
Philip Rideout 9b8d5fdf12 Add JS bindings for Texture, PixelBufferDescriptor, et al. 2018-10-15 18:35: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
Philip Rideout 0326d60d0a jsbindings: simplify BufferDescriptor wrapper.
The JS BufferDescriptor wrapper is used in two directions: JS => WASM
and WASM => JS. In both cases, it needs to be sure to delete the
underlying driver::BufferDescriptor. This is safe because the contents
of the underlying descriptor are always moved to its final destination
before the wrapper is destroyed.
2018-10-15 12:16:02 -07:00
Philip Rideout 473824b15e Introduce JavaScript API using embind.
This adds filamentjs to libs, which builds a Filament-only WASM file.
Unlike our existing web demos, this WASM file contains no application
code.

These bindings are by no means complete, but they are sufficient for a
"hello triangle" demo that I have working locally. Sneak peak of the
Triangle JS app code:

    https://gist.github.com/prideout/e9d6dd0e312146c8a287d2d109affa4d

This commit merely adds the bindings to the build. Demos and docs are
forthcoming.
2018-10-12 17:09:52 -07:00
Mathias Agopian b4c77166b7 fix normals when skinning with non-uniform scales 2018-10-11 18:46:42 -07:00
Mathias Agopian 7485cc5fd0 Skinning now supports non-rigid transforms
A full 3x3 + translate matrix is supported.
2018-10-09 18:17:44 -07:00
Philip Rideout fc672aa8a4 API CHANGE: remove deprecated RGBM enum. 2018-10-09 12:41:39 -07:00
Adrian Perez aa980682e6 Remove using std::string (#356) 2018-10-09 10:34:12 -07:00
Philip Rideout c6cef9ff9c NEW API: add RGBM flag to Texture.
This change will allow the skybox use a compressed texture format.

For now, the old internal format "RGBM" is still honored, but in a
forthcoming change we will replace the enum with UNUSED.
2018-10-08 11:33:06 -07:00
Philip Rideout 06fc8e2f4c Add compression support to cmgen. 2018-10-08 09:25:09 -07:00
Philip Rideout 5ac2c96cb5 Fix typo in ETC compression string. 2018-10-05 15:25:06 -07:00
tpsiaki 9516080d21 Add support for mirroring the current view to a different swap chain. (#339)
* Add support for save/replay of the current view.

* Add support for having distinct draw/read surfaces.

Adds support to egl & glx drivers for distring draw/read surfaces and
uses this support to implement mirrorFrame using a single blit.

* Use src/dst, Viewport, clean up apis.

* Add SwapChain READABLE Config.

* Commit & setPresentationTime optional on mirror.

* Fix flag check.

* Add documentation for READABLE swap chain config.

* Fix missed s/ExternalContext/Platform/ cases.

* Build break fix.
2018-10-06 00:04:07 +02:00
Philip Rideout da698f2e36 Add high level compression API to prep for cmgen integration. 2018-10-05 10:11:48 -07:00
Philip Rideout eed2f72466 Implement TODO items for ASTC encoding.
These presets are copied over from the ARM standalone tool. I have not
tested them but they seem reasonable.
2018-10-04 14:29:18 -07:00
Philip Rideout 23efe17380 mipgen: fix dark miplevels in normal maps.
When using GAUSSIAN_NORMALS, image::resampleImage automatically unitizes
its output. This means that clients (e.g. mipgen) need to ensure that
the source image is in [-1,+1] rather than [0,+1].
2018-10-04 14:28:44 -07:00
Philip Rideout 551fe7ef8b Suzanne now uses LINEAR_MIPMAP_LINEAR. 2018-10-04 08:02:53 -07:00
prideout e74a306df2 Fix utils::Path concat for relative paths.
Concating with an empty path should not prepend a slash since doing so
implies that the user wants to access the system's root folder.

Fixes #332
2018-10-04 07:31:25 -07:00
Mathias Agopian 4302d9dcc3 reduce our dependency to the STL in public headers 2018-10-03 20:13:17 -07:00
Philip Rideout 37a42ee854 Enable ETC for Suzanne normal map.
Due to an assertion in etc2comp, this unfortunately uses RGB8 instead of
RG11 but it still helps quite a bit (3.3 MB savings in the unzipped KTX
size).
2018-10-03 12:35:34 -07:00
Philip Rideout cc61e4649b Add ETC support to mipgen / imageio / suzanne.
This shrinks file size as follows, although it seems to darken the
rendered result.

```
  1398209 Oct  2 16:22 ao.ktx
   699172 Oct  2 16:20 ao_etc.ktx
  1398209 Oct  2 16:22 metallic.ktx
   699172 Oct  2 16:19 metallic_etc.ktx
  1398209 Oct  2 16:22 roughness.ktx
   699172 Oct  2 16:20 roughness_etc.ktx
```
2018-10-02 21:57:22 -07:00
Mathias Agopian eaf82961de Don’t use GLES 3.1 features on GLES 3.0 contextes
Fixes #309

- remove some currently unused code that requires
  GLES 3.1 headers. It’s not technically a problem,
  but it makes the code less confusing. We can
  put that back, when we need it.

- Turn off multi-sampling on GLES 3.0

- Add support for EXT_multisampled_render_to_texture
2018-10-02 15:19:38 -07:00
Mathias Agopian 69bdb6d1c9 don’t use stderr, this causes some linking problems on Android. 2018-10-02 14:45:06 -07:00
Philip Rideout 70a4c4f887 Add etc2comp to third_party. 2018-10-02 12:32:23 -07:00
Philip Rideout 3ad0574878 Add ASTC support to Suzanne. 2018-10-02 07:46:51 -07:00
Philip Rideout 3185d0f237 Add S3TC support to imageio and Suzanne.
At build time, mipgen now creates several compressed and non-compressed
variants for albedo.

For ASTC we use the ARM encoder, for S3TC we use the STB encoder. The
latter is somewhat limited so we may wish to investigate other libraries
in the future (e.g., AMD Compressenator).

At run time, we detect which of these variants to download, based on
available WebGL extensions. In practice, this means that desktop
browsers will use the S3TC variant and mobile browsers will use the ASTC
variant.

The makes unzipped albedo go from ~4 MB to 682 KB using S3TC.

Mobile support (ASTC and ETC2) is coming in a future PR, stay tuned.
2018-10-01 14:34:21 -07:00
Romain Guy 4ddfd52ad8 Fix warnings with recent Android NDK 2018-09-29 15:11:05 -07:00
Philip Rideout 6ed331d74c Add compression to mipgen and change bitrate to block size.
The compression API now takes block size instead of bit rate. Otherwise
it is quite possible for the encoder to generate a block size that is
not one of the valid block sizes that graphics API's can actually
consume.
2018-09-28 16:33:41 -07:00
Philip Rideout 17cfd55d3c Introduce compression API to imageio.
This wraps ARM's open source encoder with a reasonable interface.
2018-09-28 09:42:09 -07:00
Philip Rideout ec31a55094 Add astcenc from ARM to third_party.
This was designed as a standalone tool rather than a library, so we are
renaming their "main" function to "standalone_main", which is described
in the tnt README.

We'll also be adding a wrapper to our imageio library.
2018-09-28 09:42:09 -07:00
Philip Rideout 462f55e2b4 Add KTX support to roughness-prefilter. 2018-09-25 15:56:12 -07:00
Ben Doherty 804c974819 Fix, Vulkan samples not compiling on Windows (#306) 2018-09-25 13:28:32 -07:00
prideout be04ea843c Fix test by add missing code to recent commit. 2018-09-25 12:54:00 -07:00
Philip Rideout fc7b5872a0 Add metadata support to KtxBundle.
The KTX spec allows for arbitrary key-value pairs, we are interested in
using this to stash spherical harmonics coefficients.
2018-09-25 11:53:48 -07:00
prideout 3c59ed2c4b Fix bad size in KTX reader. 2018-09-21 10:45:51 -07:00
Philip Rideout 46b99b7565 KtxBundle now uses contiguous memory for blobs.
This will make uploading KTX cubemaps to the GPU easier and more
efficient.
2018-09-20 17:39:43 -07:00
Philip Rideout 01590fde91 Combine some ColorTransform funcs with a template.
Tested this with "./build -u" and mipgen.
2018-09-19 12:28:50 -07:00