Commit Graph

530 Commits

Author SHA1 Message Date
Philip Rideout
bb0c21b8ea Rename filamentjs to filament-js to follow convention. 2018-11-01 17:05:30 -07:00
Philip Rideout
c46ecc6e05 Port the Suzanne demo to JavaScript. 2018-11-01 17:05:30 -07:00
Philip Rideout
fffb2c8c97 Add samples to the new web directory. 2018-11-01 17:05:30 -07:00
Philip Rideout
a42dcd2291 JavaScript code re-org (#443)
This removes the old CPP-based web samples in favor of the new JS API.

The `web/samples` folder will be added in a subsequent commit.
2018-11-01 17:05:30 -07:00
Romain Guy
4e3a88bbab Cleanup and documentation (#445) 2018-11-01 16:36:52 -07:00
Mathias Agopian
02d45d464c Never use QCOM_tiled_rendering
It turns out that it degrades performance even in cases where we
thought it would help. It seems to always trigger a "glFlush"
and has a very large CPU overhead. It looks like
glInvalidateFramebuffer() does a better job.
2018-11-01 11:30:38 -07:00
Mathias Agopian
c758b53f00 Factor out the UBO uploading code
This is just so that in the future we could reuse that
code for other buffers as it's not specific to UBOs.
2018-11-01 11:30:38 -07:00
Mathias Agopian
4e3c2582e0 Rename loadFoo() to updateFoo() in the driverAPI
Now all buffer updating methods are called updateXXX().
2018-11-01 11:30:38 -07:00
Mathias Agopian
cc1ba4fac7 Reorder methods in OpenGLDriver to match declaration
This change just reorder the load/update buffer/textures
methods so they match the declaration in DriverAPI.inc,
and are grouped together.
2018-11-01 11:30:38 -07:00
Mathias Agopian
f52087ec1e Attempt to upload streaming ubo data more efficiently
IF an UBO is marked as STREAM, meaning that data will
change every frame and the buffer content is invalidated
as well, then we use map/unmap buffer in asynchronous
mode to copy the data into the buffer.

This assumes the buffer is sized to be significantly
larger than the average amount of data used every
frame.
2018-11-01 11:30:38 -07:00
Mathias Agopian
2ac04c27d8 Add support for ANDROID_get_frame_timestamps
We don't make use of it yet, though.
2018-11-01 11:30:38 -07:00
Mathias Agopian
211eddfbe0 Add a couple missing DEBUG_MARKER() calls
Also, store a couple useful glGet*()
2018-11-01 11:30:38 -07:00
Philip Rideout
522a8bedb8 Update filamentjs test runner. 2018-10-30 16:50:24 -07:00
Philip Rideout
8ad655766b JavaScript: concise setBuffer API 2018-10-29 18:09:45 -07:00
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
0deafea0da Add requirements.txt for Python scripts. 2018-10-29 17:53:09 -07:00
Philip Rideout
69e379cf90 Test for JS leaks using emcc --memoryprofiler. 2018-10-29 17:53:09 -07:00
Philip Rideout
e8fddba494 New JS test for memory leaks.
This test recreates a renderable every few frames and dumps the heap
pointer to the console so we can check if it increases over time.

Also simplified the personal web server script so that it uses twisted
and avoid doing a chdir, seems to be more reliable this way.
2018-10-29 17:53:09 -07:00
Romain Guy
31b9801f17 Move textures to nodpi to avoid upscales (#437) 2018-10-29 17:40:34 -07:00
Philip Rideout
4860ff816f JavaScript PNG utility now has SRGB flag. 2018-10-29 17:38:02 -07:00
Philip Rideout
82e61ddc88 Fix the JS IcoSphere tangents.
We were not normalizing one of the orthonormal basis vectors, causing
the visual aberration reported in #423.

This CL also add a "back light" to the redball demo to lighten up the
dark area in the IBL.

Fixes #423
2018-10-29 17:37:42 -07:00
Romain Guy
3a9f3a1984 Update to Kotlin 1.3 (#436) 2018-10-29 17:37:21 -07:00
Philip Rideout
3b793a7994 Fix bad memory access in JS wood demo. 2018-10-26 16:29:26 -07:00
Ben Doherty
e2777b9100 Update libs/filamentjs/tests/test_parquet.js
Co-Authored-By: prideout <philiprideout@gmail.com>
2018-10-26 10:30:44 -07:00
Ben Doherty
96cb5d5951 Update libs/filamentjs/tests/test_parquet.js
Co-Authored-By: prideout <philiprideout@gmail.com>
2018-10-26 10:30:44 -07:00
Ben Doherty
e6bb8a6235 Update libs/filamentjs/tests/test_parquet.js
Co-Authored-By: prideout <philiprideout@gmail.com>
2018-10-26 10:30:44 -07:00
Ben Doherty
934b75e68b Update libs/filamentjs/tests/test_parquet.js
Co-Authored-By: prideout <philiprideout@gmail.com>
2018-10-26 10:30:44 -07:00
Philip Rideout
58f36d1a7f New JS test: draw shaderball with parquet wood texture.
Shameless recreation of the Android `textured-android` sample. I will
make this into a tutorial soon.

Also made some improvements to the test-builder Python script. Really,
this script exists only to make iteration easier; we need a better
solution for automated tests...
2018-10-26 10:30:44 -07:00
Philip Rideout
83e4402e90 JS: fix use-before-free for PNG data. 2018-10-26 10:05:18 -07:00
Philip Rideout
c6a1900beb Add JS utility for PNG files. 2018-10-26 10:05:18 -07:00
Ben Doherty
17021a1167 Retry installing llvm on Kokoro Windows if failure (#400) 2018-10-25 13:31:43 -07:00
Philip Rideout
f0fbdaec28 JS users no longer need to call loadMathExtensions() 2018-10-25 08:16:32 -07:00
Philip Rideout
b73f58e6ef Expose MeshIO to JavaScript clients. 2018-10-25 08:12:53 -07:00
Mathias Agopian
254e3db215 More per-scene renderable UBO to View... for now
If a scene was used in several views, we would update the renderable
ubo several times per frame, which is not desirable. So we now have
such a UBO per-view. This could change in the future, depending
how we want to manage it.
2018-10-24 15:11:54 -07:00
Mathias Agopian
d9df864de4 Get rid of RangeSet. 2018-10-24 15:11:54 -07:00
Mathias Agopian
995b8361b8 Don't use RangeSet anymore.
It was used only in one place, always with a single range. For now,
we just always upload the whole froxel record buffer (64K).
2018-10-24 15:11:54 -07:00
Mathias Agopian
a61af02038 Pass View& instead of View* around 2018-10-24 15:11:54 -07:00
Mathias Agopian
84bfbac5fa The lights UBO must be per-View
We used to have a UBO for lights per scene, however it's better to 
have one per view, since it depends on the camera heavily and is 
limited in size.
Not doing so, could force us to upload the same UBO multiple times
per frame, for e.g. if the same scene was used in multiple views.
2018-10-24 15:11:54 -07:00
Mathias Agopian
912b301790 Try to bring some sanity to our UBO structures
- move UBO declarations in UibGenerator, i.e. next
  to their Uniform Interface Block definition.
  This should help forgetting to update one but
  not the other.

- move UniformInterfaceBlock.h and SamplerInferfaceBlock.h under
  private/filament/.

- do the same things for samplers
2018-10-24 15:11:54 -07:00
Mathias Agopian
b707027401 Avoid a light UBO data copy
We use the command stream to store the lights
ubo data (16K max), which avoid a copy and simplifies
the implementation. we can get rid of GpuLightBuffer.
2018-10-24 15:11:54 -07:00
Philip Rideout
68dfb5ae80 Introduce reference page for JS.
The docgen script now looks for /// comments in the binding definitions,
and generates markdown from those. The reference page has three
sections: classes, free functions, and enums.
2018-10-24 10:05:08 -07:00
Philip Rideout
ab3770d281 Fix JS docgen script for Kokoro. 2018-10-24 09:33:44 -07:00
Philip Rideout
28c56eb354 build.sh: the web archive now includes JS docs
Before this CL, the web archive had two folders: "public" (which
contained web demos written in C++) and "filamentjs" (for the barebones
WASM).

After this CL, the web archive will instead have "dist" and "docs". The
dist folder will have the WASM and accompanying JS file, while the docs
folder has the tutorials and their accompanying demos.

If your machine has Python 3 installed, then "build -ap webgl" will
attempt to generate the JavaScript docs. If Python 3 isn't available,
this build step will be skipped. Note that our Kokoro macOS machines
already have Python 3 pre-installed.

Also removed the pipenv file to simplify the Kokoro Python environment.

Fixes #394.
2018-10-24 08:55:14 -07:00
Ben Doherty
30eccc78b6 Add support for iOS simulator (#398)
* Add support for iOS simulator

* Use correct case for include
2018-10-23 10:30:01 -07:00
Philip Rideout
ab24665396 Allow JS clients to configure FXAA and WebGL context. 2018-10-23 07:58:16 -07:00
Philip Rideout
9e7b589d0a Fix FXAA pixel alignment.
Fixes #397.
2018-10-19 16:42:01 -07:00
Ben Doherty
979b6f00fd Default to Java 9 on Windows Kokoro (#413) 2018-10-19 15:17:16 -07:00
Ben Doherty
0754edbf9b Fix broken iOS build (#411) 2018-10-19 12:51:53 -07:00
Philip Rideout
9916af3ab1 Simplify docgen script per code review. 2018-10-19 12:40:38 -07:00
Philip Rideout
dcfbe694b1 Add fullscreen button to embedded JS demos. 2018-10-19 12:40:38 -07:00