Commit Graph

11 Commits

Author SHA1 Message Date
Mathias Agopian
1c1cb11cf5 Use the new CallbackHandler in the java bindings
Java callbacks are now directly dispatched to their handler, instead
of first going through filament's opportunistic dispatch, reducing
callback latency.
2021-10-04 10:56:43 -07:00
Mathias Agopian
43d47745dd API CHANGE: remove deprecated populateTangentQuaternions 2021-05-14 13:35:25 -07:00
Philip Rideout
ded542a543 Introduce BufferObject API.
NOTE: after Metal and Vulkan support lands, we can potentially simplify
the Driver API by removing some of the old VertexBuffer entry points.

This introduces a new API-level object called `BufferObject`, and a new
backend-level object called `HwBufferObject`. This encapsulates a single
VBO. It's especially useful when clients need to share data between
multiple VertexBuffer objects. (e.g. for morphing).

In the future, buffer objects could perhaps be used for non-vertex data
(e.g. for compute).

The existing `VertexBuffer` class can now be configured to use buffer
objects by calling `enableBufferObjects` on the builder. By default its
API is unchanged. If buffer objects are enabled, then clients should use
`setBufferObjectAt` (which takes a buffer object) rather than
`setBufferAt` (which takes CPU data).

OpenGL is the trickiest backend for this, due to existence of VAOs.
The implementation in this PR uses a version-tracking scheme to
figure out when to update the VAO.
2021-04-01 14:52:06 -07:00
Ben Doherty
a6872c840c Silence more deprecation warnings (#2750) 2020-06-30 10:14:57 -07:00
Philip Rideout
94b4f92bc5 Android: move JNI C++ utils into a common folder.
No need for a proper library, this is just a common location to simplify
JNI bindings in other projects like filamat and gltfio.

There is no need to move the one Java source file (`NioUtils.java`)
since downstream libraries will have a dependency on Filament, and
FindClass should work fine.
2019-06-17 08:47:27 -07:00
Mathias Agopian
b26684deed rename namespace filament::driver -> filament::backend 2019-03-26 11:47:47 -07:00
Mathias Agopian
8ffba072b2 remove the "byteSize" parameter from update[Vertex|Index]Buffer
It was redundant with BufferDescriptor::size.
2019-03-11 18:27:06 -07:00
Philip Rideout
691daeb45d JNI enhancement: allow mutation of non-direct buffers.
The bug was reproduced and the fix was verified by copying the following
code snippet into one of our Android samples:

    val norm = floatArrayOf(1.0f, 0.0f, 0.0f)
    val tang = floatArrayOf(0.0f, 1.0f, 0.0f, 1.0f)
    val expected = floatArrayOf(0.5f, 0.5f, 0.5f, 0.5f)
    val resultBuffer = FloatBuffer.allocate(4)
    val qtc = VertexBuffer.QuatTangentContext()
    qtc.quatCount = 1
    qtc.quatType = VertexBuffer.QuatType.FLOAT4
    qtc.outBuffer = resultBuffer
    qtc.normals = FloatBuffer.wrap(norm)
    qtc.tangents = FloatBuffer.wrap(tang)
    VertexBuffer.populateTangentQuaternions(qtc)
    Log.e("Filament", "${expected[0]} == ${resultBuffer[0]}")

Fixes #695.
2019-02-11 14:50:14 -08:00
Philip Rideout
40fe6628d0 Expose tangent utility to Java / Kotlin.
This also improves the comments and allows 0 for output stride.
2019-02-11 12:50:19 -08:00
Philip Rideout
2f35f26148 VertexBuffer builder normalized now accepts "false". 2019-01-17 06:09:17 -08:00
Romain Guy
b3d758f3b3 Initial commit 2018-08-03 10:38:22 -07:00