Commit Graph

354 Commits

Author SHA1 Message Date
Romain Guy
2e22a26ca5 Fix filamat build (#1005)
Filamat public headers were including a private header. This PR fixes
this problem. It also forces filamat to always be compiled to avoid
breaking filamat without noticing. The flag `-l` is not available
anymore in build.sh as a result.
2019-03-18 18:40:48 -07:00
Mathias Agopian
289b889a1a oops fix build, missed file.
remove dependency on JobSystem.h in public header
this should fix #995
2019-03-15 17:07:29 -07:00
Mathias Agopian
d25dd6234c remove dependency on JobSystem.h in public header
this should fix #995
2019-03-15 16:58:03 -07:00
Ben Doherty
38e08131bc Update libs/utils/include/utils/compiler.h
Co-Authored-By: pixelflinger <pixelflinger@gmail.com>
2019-03-15 15:42:28 -07:00
Mathias Agopian
5383174df4 Use proper "restrict" syntax on visual studio 2019-03-15 15:42:28 -07:00
prideout
b4270909c4 Reduce watermark console spew. 2019-03-14 16:18:28 -07:00
Mathias Agopian
2f34f9f857 remove vector comparison operators
they're dangerous as they will make things like
std::min() work, but probably won't do the
right thing.
2019-03-14 13:13:57 -07:00
Philip Rideout
df9791faaf gltf_viewer: add stats and view controls. 2019-03-14 12:18:56 -07:00
Romain Guy
6b39569c14 Defend against Windows' near/far defines (#985) 2019-03-14 11:49:43 -07:00
Philip Rideout
06850cf934 Add Engine::getBackend, fix gltf_viewer + Vulkan. 2019-03-14 10:55:08 -07:00
Philip Rideout
e3e7073f74 gltf_viewer: add support for drag-and-drop.
You can now drop gltf or glb files into the app.

Note that we will soon be migrating from SDL to GLFW, which also
has support for drag-and-drop.
2019-03-14 10:06:44 -07:00
Philip Rideout
7bc6b3c818 Replace gltf_viewer and introduce gltfio::SimpleViewer.
The new gltf_viewer app has an optional zero-arguments mode whereby it
loads a resgen-embedded binary model, which is useful for quick
sanity testing. If you don't specify an IBL, it loads a compressed
version of the pillars IBL.
2019-03-13 16:21:58 -07:00
Mathias Agopian
a8a37a537a simplify a lot libibl's Image class 2019-03-13 13:45:43 -07:00
Mathias Agopian
13d3ade5bb libibl doesn't need to depend on libimage 2019-03-13 13:45:43 -07:00
Mathias Agopian
54d292bc8a move all libibl APIs in namespace filament::ibl 2019-03-12 22:36:54 -07:00
Mathias Agopian
43ac656a38 Cleanup libibl a bit. Add some basic documentation. 2019-03-12 22:36:54 -07:00
Mathias Agopian
f8fc2dd808 split cmgen into an exe + libibl.a 2019-03-12 22:36:54 -07:00
Philip Rideout
0102489748 gltfio: add UbershaderLoader, an implemention of MaterialProvider. 2019-03-12 15:29:17 -07:00
Philip Rideout
ce50ea17c0 Avoid NaN when normal is colinear with fake axis.
I reproduced the issue by hacking our redball demo and visually
verified the fix.

cc @AdrianAtGoogle
2019-03-12 14:30:25 -07:00
Mathias Agopian
ca79e9d420 More doxygen documentation 2019-03-12 13:35:58 -07:00
Mathias Agopian
07bb62490b Add an option to turn dithering on/off 2019-03-12 13:32:28 -07:00
Philip Rideout
39c63146e0 gltfio: add ubershader template.
We will need 6 pre-compiled materials (lit vs nonlit and the 3 blend
modes). This uses CMake's "configure_file" functionality to generate 6
mat files, then invokes matc on each one. They are then combined using
resgen.
2019-03-12 08:16:55 -07:00
Philip Rideout
8628c43fbf gltfio: material generator cleanup. 2019-03-10 15:11:58 -07:00
Philip Rideout
af9b3a99e0 gltfio: introduce MaterialProvider interface.
This prepares for an alternate "sans filamat" implementation of
MaterialProvider, which will be especially useful for web.
2019-03-10 11:59:47 -07:00
Philip Rideout
7a2924738c gltfio: transparency fixups
- rename gltfio::AlphaMode to use glTF nomenclature
- keep depth writes enabled for transparent renderables
2019-03-09 18:58:04 -08:00
Philip Rideout
0e4ca0bc7b Fix falling streetcar / quaternion slerp. 2019-03-08 17:50:15 -08:00
Philip Rideout
c98ac44827 gltfio: fix UV set issue seen in littlest_tokyo 2019-03-08 11:31:22 -08:00
Mathias Agopian
1836377753 don't have two version of SamplerFormat
Instead, alias one on the other.
Also sort aliases in the header.
2019-03-07 16:42:02 -08:00
Philip Rideout
b14759a0a4 gltfio: add wireframe functionality.
This makes it easy to draw a transformed box around each renderable for
diagnostic purposes. The API is similar to Animator in that it is
exposed through FilamentAsset but is created lazily and is implementated
outside of FilamentAsset.
2019-03-07 15:03:43 -08:00
Philip Rideout
1ccf2d6a08 gltfio: fix up and enhance AABB functionality.
gltfio computes two types of bounding boxes: one for renderables (used
for frustum culling) and one for the overall asset (used for
positioning the camera or asset).

Both of these are based on the min+max attributes in the glTF file, but
the asset-level box was incorrect because only two corners of the
transformed AABB were considered.

This CL also adds optional computation of bounding boxes that crawls
through the vertex positions. This is useful when diagnosing potential
issues with the asset's min+max info.

These enhancements are motivated by a culling issue seen with the voxel
Cathedral on sketchfab.
2019-03-07 14:11:21 -08:00
Mathias Agopian
d2afc27703 Address review comments 2019-03-07 13:43:27 -08:00
Mathias Agopian
91738d0513 Remove the 'group' parameter from SamplerBindingMap 2019-03-07 13:43:27 -08:00
Mathias Agopian
2a72e8aee8 break dependency of Program on SamplerInterfaceBlock and SamplerBindingMap
Instead of passing SamplerInterfaceBlocks and a SamplerBindingMap to
Program, we now set a 'sampler group' per binding point:

Program::addSamplerGroup(...)

A sampler group here consists of a list of N 'Sampler' and a 'Sampler'
is just a unique name (unifrom name in the shader) and binding point in
the shader.

That's all the driver layer needs.

With this change we get rid of the code that re-created the uniform
names in the driver -- this should never have been done there. And we
also remove the hash-map lookups in vulkan and metal drivers.
2019-03-07 13:43:27 -08:00
Mathias Agopian
50d8a8a2d8 fix SamplerBindingMap for non postprocess materials
This fixes #935

SamplerBindingMap was always adding the post-process samplers to the
map -- but matc doesn't generate those. This led the vulkan backend
to believe there was a post-process sampler bound, when there wasn't.

This is also technically a bug in the Vulkan backend because it should
have used the SamplerInterfaceBlock to determine which shaders are
actually used instead of blindly going through the whole list and 
trusting SamplerBindingMap.

The fix is kind of a hack, but the whole SamplerBindingMap is kind of a
hack anyways.
2019-03-06 18:26:08 -08:00
Philip Rideout
8d979a7cb8 Resurrect quat slerp NaN protection.
In my previous NaN-related commit, I added a conditional similar to the
one seen in glMatrix, but this was insufficient for the interpolation
seen in a glTF skinning test because a divide-by-zero was occuring later
in the function. This commit simply adds back the previous protection.
2019-03-06 12:36:20 -08:00
Pixelflinger
46e3326b81 move getSamplerBindingsStart() to SibGenerator
This is a bit more logical to have it there because SibGenerator
is about about what filament needs, whereas SamplerInterfaceBlock.h
is generic.
2019-03-06 11:47:26 -08:00
Pixelflinger
413f6a97b1 Engine.h doesn't need to store the per-view/post-process Sib
It's only used to get the size of the SamplerGroup.
Actually, Engine also uses the post-process Sib to create the
post-process material, but this should go away when we have
material domains -- so pretend it's not there.
2019-03-06 11:47:26 -08:00
Pixelflinger
1597b6f572 rename SamplerBuffer to SamplerGroup
This is the first part of a larger rework:
- Rename SamplerBuffer to SamplerGroup
- remove dependency on SamplerInterfaceGroup
2019-03-06 11:47:26 -08:00
Mathias Agopian
7d81d9bb51 cleanup filamat namespace 2019-03-05 17:54:37 -08:00
Mathias Agopian
4abe017bc5 cleanup MaterialChunkType.h 2019-03-05 17:54:37 -08:00
Mathias Agopian
0f6f53d501 MaterialChunk doesn't expose the Unflattener in its API
this makes the API more robust, because now it's not possible
to mess up the call to getShader(), by construction.
2019-03-05 17:54:37 -08:00
Mathias Agopian
084fd95489 Factorize all the various getShader() methods
This removes a lot of code and complexity. MaterialParser now has 
a single, generic getShader() method.
2019-03-05 17:54:37 -08:00
Mathias Agopian
ff53515295 Merge [Spirv|Text]DictionaryReadder into DictionaryReader 2019-03-05 17:54:37 -08:00
Mathias Agopian
f2ba48f4a7 Program::shader() now only takes a void* + size
Program::shader() was taking a string before which didn't make sense
for spirv.  Now it's just a blob, in the case of GL/Metal, the blob
must be a null terminated c-string, and the size must include the
terminating null character.

This fixes an out-of-bound access in ShaderBuilder::getShader() (which
doesn't exist anymore), because it was creating a CString passing
a size that included the null terminating char, which is not was CString
expects. CString can now assert() in that case.


driver::Program now uses a std::vector<> for storage, which we should
fix at some point (b/c it's a public header). CString was not suited to
store binary blobs.
2019-03-04 19:00:26 -08:00
Mathias Agopian
955ab2d2f3 Cleanup in MaterialParser 2019-03-04 19:00:26 -08:00
Mathias Agopian
561726b938 remove unneeded dependency on SamplerBindingMap.h 2019-03-04 15:52:46 -08:00
Mathias Agopian
7b3475f1da API change: rename matrix factory functions
scale() -> scaling()
translate() -> translation()
rotate() -> rotation()

These static functions create a matrix, they don't modify it.
Fixes #826
2019-03-04 14:34:02 -08:00
Mathias Agopian
3297c9bc78 More headers clean-up
- EngineEnums.h is not a private headers as it contained mostly private
stuff

- MaterialEnums.h is still public, but now only contains public stuff.
Private parts were moved to MaterialEnums.h or MaterialBuilder.h

- And finally SamplerBinderMap is moved under private/ as well, since
it's certainly not a public API.

With this change, the public headers of filabridge become more reasonable
and limited.
2019-03-02 00:21:09 -08:00
Philip Rideout
6c75c6436e Add support for glb files.
Tested with DamagedHelmet.glb
2019-03-02 00:02:40 -08:00
Philip Rideout
16d878186c Finalize Animator implementation.
- Add support for CUBICSPLINE and STEP interpolation methods.
- Use cgltf_accessor_read_float() instead of manually unpacking values.
- Fix potential NaN in decomposeMatrix.
- Reduce malloc churn by stashing the vector of bone matrices.
2019-03-01 12:35:55 -08:00