Commit Graph
291 Commits
Author SHA1 Message Date
Mathias Agopian 9d78f1a54e cleanup regarding SamplerBuffer and UniformBuffer
- UniformBuffer::toBufferDescriptor() now cleans the dirty flags
- SamplerBuffer move ctor and operator now clean the dirty flags of the
  moved (source) buffer.
- SamplerBuffer::toCommandStream() can be used to more efficiently copy
  a SamplerBuffer into the command stream -- this saves a copy.
- simplified SamplerBuffer's copy and move ctor/operator
- added a few constexpr here and there
2019-02-27 11:47:57 -08:00
Mathias Agopian 1ec8fc16a4 more support for 2D texture arrays in the driver
Very much untested, but it should work!
2019-02-27 11:47:38 -08:00
Romain Guy 705c1969b2 Add clearCoatIorChange property to materials (#890)
This property can be used to control the darkening of the base layer
due to a change in index of refraction when going through the clear
coat layer.
2019-02-27 10:30:46 -08:00
Philip Rideout ace38eff24 SurfaceOrientation cleanup per code review. 2019-02-27 08:47:24 -08:00
Philip Rideout 6d1e0ed6f4 Introduce SurfaceOrientation helper class.
This moves our existing VertexBuffer utility into a new "geometry"
library and adds new functionality for computing tangents based on UV's.
The UV-based method comes from Eric Lengyel.

We considered mikktspace (which thankfully has a zlib-style license) but
it would require re-indexing via meshoptimizer and is therefore a bit
heavyweight.

The new library has no dependencies and will add only 7 KB to Filament's
Android aar file.

Fixes #858 and preps for #528.
2019-02-27 08:47:24 -08:00
Philip Rideout c65e561c59 Fix nans in math::slerp, second attempt.
My earlier fix (3b373e5) was insufficient in some cases, this new
approach is cribbed from glMatrix.
2019-02-26 21:03:49 -08:00
Adrian Perez 38a6d047c9 Add a public method for creating atlas textures (#844) 2019-02-25 15:32:14 -08:00
Philip Rideout 147dafb4c1 Fix webgl on kokoro. 2019-02-25 12:02:47 -08:00
Philip Rideout e9430dd07f Do not use CMAKE_SOURCE_DIR.
This is one of those CMake gotchas, we should always use
CMAKE_CURRENT_SOURCE_DIR instead of CMAKE_SOURCE_DIR to allow
Filament to exist as a subproject.

In particular, this was causing the following build error when trying to
build Filament as a nested project.

    combine-static-libs.sh: No such file or directory

Fixes #861.
2019-02-22 15:38:52 -08:00
Ben Doherty d22e2f2834 Fix wrong init method being called (#846) 2019-02-20 11:05:55 -08:00
Ben Doherty 52ebfb1665 Add Init and Shutdown methods to MaterialBuilder (#840) 2019-02-20 10:44:12 -08:00
Philip Rideout 91ce2f412b Bump MATERIAL_VERSION. 2019-02-19 15:54:58 -08:00
Philip Rideout e60744a6e4 Introduce MATERIAL_VERSION and panic.
Material archives already contain two version chunks (post process and
normal) but the renderer was ignoring these. The change makes it so that
matc writes a new MaterialEnums value into these chunks, and the engine
panics when receiving a material version that it does not expect.

This also adds a --version option to matc. No changes were necessary
to matinfo because it already prints out these values.

Fixes #796.
2019-02-19 15:54:58 -08:00
Ben Doherty 08a71bf2f0 Install requirements for linking against filameshio (#818) 2019-02-15 12:08:28 -08:00
Philip Rideout 3b373e5d05 Fix nans in math::slerp. 2019-02-14 20:54:56 -08:00
Mathias Agopian e98b413eb5 don't default initialize driver::Viewport/RenderPassFlags
instead we initialize them to zero in RenderPassParams.
2019-02-14 18:08:40 -08:00
Mathias Agopian 147e4d2189 Flags must be zero by default 2019-02-14 18:08:40 -08:00
Mathias Agopian 26468d9532 Split RenderPassParams into multiple structs
We split out Viewport and RenderPassFlags.
2019-02-14 18:08:40 -08:00
prideout 5ee359cf40 Move math namespace to fix #746. 2019-02-07 09:23:07 -08:00
prideout 72a987057e Move MeshReader into filamesh namespace.
This class will not extend well to glTF so this cordons it off into the
filamesh namespace, which is an already-existing namespace that we use
for the things related to the filamesh file format.

For glTF we might create a new library with its own MeshReader so
this will mitigate confusion.
2019-02-06 12:59:48 -08:00
Ben Doherty a827f4528a Install filamat and dependencies as single static library (#775) 2019-02-04 11:08:45 -08:00
Mathias Agopian 8298520f0a TextureUsage is now a bitmask, which makes it more flexible. 2019-02-01 17:10:45 -08:00
Philip Rideout 69de626ead Rename built-in shader inputs to "inputs" instead of "variables".
In the public docs and materials API, Filament "variables" are custom
interpolants (outputs of VS, inputs of FS). However we internally used
"variables" to also refer to built-in VS inputs.

CodeGenerator had a generateVariable method and a generateVariables
method, which did something completely different. :)
2019-02-01 13:20:13 -08:00
Mathias Agopian d1aecf864f allocator's free() must take 2 parameters 2019-01-31 17:36:19 -08:00
Adrian Perez 7ba46ef5f1 Add explicit includes for types not implied in all stdlib impls 2019-01-30 16:08:57 -08:00
Benjamin Doherty 21f0aa5fb4 Enable custom allocator test for Windows 2019-01-30 16:05:49 -08:00
Mathias Agopian 8bdae79536 added rebind copy-ctor to STLAllocator
this should fix the build on windows debug
2019-01-30 16:05:49 -08:00
Mathias Agopian 0bdb6b8a8a workaround a compile error with some compilers 2019-01-30 16:05:49 -08:00
Mathias Agopian ae6ab66af4 fix #755: a race condition cousing a deadlock
This reverts a JobSystem optimization that attempted to avoid signaling
a condition when there was no waiters. Unfortunately, there was a
race that caused the the signaling thread to miss that the waiter flag
was set, thus not signaling.
2019-01-29 15:40:25 -08:00
Ben Doherty 7be3994c96 Add Metal shading language compilation to matc (#752) 2019-01-29 12:44:58 -07:00
Romain Guy 66d71be300 Fix HDR ImageDecoder for width < 8 or > 32767 2019-01-28 15:16:53 -08:00
Romain Guy 614a832be0 Code cleanup in ImageDecoder.cpp 2019-01-28 15:16:53 -08:00
Ben Doherty 92de93bfb8 Add Metal skeleton code (#714) 2019-01-28 15:29:37 -07:00
Romain Guy c1b7f2ac27 Property write small .hdr files (#750)
* Cleanup ImageEncoder code

* Properly write HDR files when width < 8 or > 32767

A little oddity in the original Radiance file format encoding.
2019-01-28 14:02:28 -08:00
Mathias Agopian 07c1dbb5f4 fix typo causing a memory corruption in STLAllocator<>
We were allocating n*sizeof(n) instead of n*sizeof(T). Thankfully, 
we were not using STLAllocator anywhere.
2019-01-23 19:14:28 -08:00
Mathias Agopian 373e519292 slog.* << io::hex now prefixes values with 0x 2019-01-22 10:49:22 -08:00
prideout 98d39b7e7e Revert "Fix depth prepass (#722)"
This reverts commit 896c85c324.
2019-01-18 13:59:22 -08:00
Mathias Agopian 8c8cfb6528 Frame graph API
This is only the guts of the frame graph implementation. It supports
culling of passes, but doesn't create real resources yet.

API still in flux.
2019-01-18 13:07:54 -08:00
Romain Guy 896c85c324 Fix depth prepass (#722)
The engine tries to be smart by using a single vertex shader when
rendering unskinned, non-alpha masked, non-customized materials.
This leads to a lot of issues when laying down the depth prepass.
This change simply gets rid of this optimization (which wasn't
properly profiled anyway). Correctness is more important.

Fixes #645
2019-01-17 17:57:43 -08:00
Romain Guy f3752a42c8 Document UV flipping behavior and add control attribute (#720)
Materials can disbale this behavior by setting flipUV: false
in the header section of the material definition.

Fixes #672
2019-01-17 11:12:16 -08:00
Philip Rideout 2f35f26148 VertexBuffer builder normalized now accepts "false". 2019-01-17 06:09:17 -08:00
Romain Guy 0394aeb23b Add specular anti-aliasing properties to materials (#697)
* Add specular anti-aliasing properties to materials

curvatureToRoughness
limitOverInterpolation

These techiques were supposed to be enabled by default on
desktop but it turns out they were broken. They must now
be enabled manually on each material instead (and work on
mobile).

* Update docs/Materials.md.html
2019-01-14 12:25:51 -08:00
Romain Guy 8029ad5cc3 Add missing getWorldFromClip() API (#692)
Fixes #671
2019-01-10 16:35:00 -08:00
Philip Rideout 0158e7e858 JS API: loadFilamesh can now return material names.
See issue #663
2019-01-10 07:48:19 +05:30
Ben Doherty c6444fb502 Move sampler bindings outside of material blobs (#682) 2019-01-09 11:25:51 -08:00
Romain Guy 3be10d816a Cleanup recent change to ImageOps (#678)
* Cleanup recent change to ImageOps

* Add missing sign
2019-01-08 07:20:20 -08:00
Romain Guy 9ce88e6e23 Improve skygen (#679)
Bring back the normalization and gamma correction command line flags,
render the ground in the lower half of the image.
2019-01-08 07:19:50 -08:00
nicebyte 83c40e6664 Make 4-channel versions of certain image operations. (#676)
Background: with the Vulkan backend, RGB8 textures do
not work (at least not on my hadrware). This makes me unable to run some
examples, because they use normal maps in RGB8 format.

It appears that the following commit addresses the problem by adding a
special command line option to mipgen:
https://github.com/google/filament/commit/8dda07bf2c19f9ebd8ab499ca2c3849d7b1f031f

However, processing normal maps with this option does not work: certain
assertions in the image library fail.

This PR changes these functions in the image library to handle 4-channel
images instead of failing.
2019-01-07 15:16:00 -08:00
gstanlo 28f2806beb Improves linear to srgb conversion functions (#675)
* Improves linear to s/rgb

Adds rounding to nearest whole integer, supports copying over an alpha channel for linear to srgb conversion. Code would previously incorrectly apply sRGB conversion to alpha.

* reformatting previous change
2019-01-04 10:46:20 -08:00
shartte f676d3d3ea Add constexpr constructor to StaticString (#659)
Fixes a header usage problem for MSVC, which complains about StaticString not having a constexpr constructor thus making the "make" method not constexpr.
2018-12-24 08:51:18 +01:00