Commit Graph

32 Commits

Author SHA1 Message Date
Philip Rideout
898ed70aa0 Remove <iostream> from math headers.
This speeds up our build time by using <iosfwd> and un-inlining the
vector print functions.
2020-01-06 15:09:06 -08:00
Philip Rideout
fd4d6c0d44 Use std::move in MeshAssimp.
Tested this via material_sandbox, seems to be fine.

Fixes #1366.
2019-07-02 14:20:55 -07:00
Mathias Agopian
b26684deed rename namespace filament::driver -> filament::backend 2019-03-26 11:47:47 -07:00
Mathias Agopian
639d05374b update layering: libbackend is now at the bottom
We now have:

backend -> filabridge -> filaflat -> filament
                      -> filamat

Instead of backend depending on filabridge.
2019-03-26 11:47:47 -07:00
Mathias Agopian
2b5f6cafa6 Separate src/driver into its own library
In this first step, we just "blindly" move everything under src/driver
to a new library libbackend.a. And all headers are moved under
private/backend.

Note that "driver" is renamed "backend", but namespaces are unchanged for now.

Later we'll have to untangle the actual private headers from public
ones and ideally not have any private headers.
2019-03-22 09:45:51 -07:00
Philip Rideout
186920e8d0 Fix up emissive energy compensation for glTF. 2019-02-25 14:32:58 -08:00
Philip Rideout
d538e71959 Repair gltf_viewer by calling Material::init. 2019-02-20 14:39:30 -08:00
Philip Rideout
84eb9547f5 Tangent-related fixups in MeshAssimp.
Assimp's CalcTangentSpace deviates from de facto glTF 2.0 so we were
compensating for this with an unconditional fixup in MeshAssimp. However
the fixup should apply only when CalcTangentSpace is active, i.e. when
the model is missing tangents.

This makes it so that NormalTangentMirrorTest (has tangents) and
NormalTangentTest (needs tangents) both look reasonable.

I also noticed that MeshAssimp was inexplicably applying
aiProcess_CalcTangentSpace twice: once as a flag, and once as a
post-process. I removed the latter.

This will be fixed in the upcoming cgltf-based loader, which will
use our officially-sanctioned utility method in VertexBuffer.

See #528
2019-02-20 13:29:44 -08:00
Philip Rideout
26ce90483a MeshAssimp: fix glTF material hash function.
I noticed this while working on the new lighter weight loader.
2019-02-15 10:32:33 -08:00
prideout
5ee359cf40 Move math namespace to fix #746. 2019-02-07 09:23:07 -08:00
Romain Guy
c8f5190099 Fix Windows build 2019-01-15 15:13:13 -08:00
Romain Guy
28ab087f79 Revert doubleSided hack in glTF loading 2019-01-15 14:17:22 -08:00
Romain Guy
e66aeb0c94 Fix a couple of glTF issues: (#706)
- baseColorFactor.a was not taken into account
- Some glTF files do not set `doubleSided` properly, so here we assume
  that non-opaque materials are double-sided. We may need to revisit
  this decision later...
2019-01-15 10:26:20 -08:00
Philip Rideout
f96501215b Reduce number of texture lookups in gltf_viewer. 2019-01-10 08:17:30 +05:30
magicwhale
4be93cbdd6 Added warning about textures using the pbrSpecularGlossiness gltf extension in MeshAssimp (#597) 2018-12-07 14:33:00 -08:00
magicwhale
2633edf2c4 Changed MeshAssimp to use snorm16 if uv values are in the range [-1, 1] (#592)
* grouped MeshAssimp arguments into struct

* added snormuv optimization to MeshAssimp and changed snormuv optimization range from [0, 1] to [-1, 1] in filamesh
2018-12-07 13:03:18 -08:00
magicwhale
27f8dbef21 Added support to gltf_viewer for multiple UV coordinates (#578)
gltf_viewer can now display models that use both UV0 and UV1 coordinates for textures.
2018-12-05 12:35:26 -08:00
magicwhale
b902a90285 Changed MeshAssimp to dynamically generate materials with filamat (#563) 2018-12-03 10:15:47 -08:00
Philip Rideout
0b84425bd0 Fix up tangents in MeshAssimp to help with #528.
We started to write our own implementation of mikktspace, but it
required an unindexed mesh for input. This was awkward because assimp is
already applying a pipeline of operations that includes tangent
generation and indexing. It felt reduandant to add our own pipeline on
top of that (unindexing => tangentgen => reindexing).

Since assimp's CalcTangentsProcess method is already producing
tangents that follow the orientation implied by texture coordinates,
this simply needs to be tweaked to match glTF. (flip the bitangent)

Also fixed a bug for the case where models have neither UV's nor
tangents, where we were calling norm instead of normalize. :)
2018-11-28 15:46:04 -08:00
magicwhale
2a5e978f2e Changed MeshAssimp to use constants defined in assimp header files 2018-11-28 12:15:24 -08:00
magicwhale
ad1f3cf133 Added support for different min and mag filter samplers in gltf_viewer (#539)
Modified MeshAssimp.cpp to support different min and mag filter types for gltf files.
2018-11-28 10:03:07 -08:00
Philip Rideout
0011b1bba3 Use resgen in samples and MeshAssimp. 2018-11-28 08:35:44 -08:00
Romain Guy
588ce8fe3f More code style cleanup 2018-11-26 14:07:07 -08:00
Romain Guy
44c4362edb Code style cleanups 2018-11-26 14:04:43 -08:00
Romain Guy
20ffb52dc2 Re-enable glTF support (#505)
* Revert "Rollback MeshAssimp enhancements."

This reverts commit b3dce967eb.

* Re-enable glTF support

* Start looking for texture ids at 1, not 0

* Detect if the importer is glTF

* glTF and regular materials both work
2018-11-26 13:14:28 -08:00
Philip Rideout
b3dce967eb Rollback MeshAssimp enhancements.
This caused regressions with some of our samples like vk_hellopbr:

- For the new 1x1 textures, RGB isn't accepted by Vulkan and Metal.
  Currently these platforms require RGBA, although we plan on adding
  reshaping functionality for the future.
- Too many texture samplers in a single shader, this causes a run time
  error. This could be alleviated by creating an atlas.
- vk_hellopbr assumes that all materials have a "metallic" param.

Going forward, we plan on creating a new library that avoids MeshAssimp,
so for now let's just disable gltf_viewer.
2018-11-19 14:18:12 -08:00
magicwhale
fc0d587b40 Added support for more features in gltf_viewer sample 2018-11-19 09:27:08 -08:00
magicwhale
1d392d38bd updated assimp 2018-11-19 09:27:08 -08:00
magicwhale
bc38c8a773 Edited MeshAssimp and added gltf_viewer sample code 2018-11-19 09:27:08 -08:00
Romain Guy
a779e92b99 Fix clang-tidy warnings (#158) 2018-08-27 14:30:12 -07:00
Romain Guy
c429af310e Cleanup sample code 2018-08-13 17:01:04 -07:00
Romain Guy
b3d758f3b3 Initial commit 2018-08-03 10:38:22 -07:00