Compare commits
2368
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
031cd302dd | ||
|
|
87351097ad | ||
|
|
694766682f | ||
|
|
c946ebd1e6 | ||
|
|
25a8291101 | ||
|
|
60c689688d | ||
|
|
763bc1f34a | ||
|
|
ef07638eef | ||
|
|
0aa0efe159 | ||
|
|
ef7bcd1e19 | ||
|
|
702ceda82a | ||
|
|
66b78074de | ||
|
|
8d440cea17 | ||
|
|
3ab8e4d725 | ||
|
|
97f20afdd7 | ||
|
|
42989e76d7 | ||
|
|
ad45cc9092 | ||
|
|
04669f6ab9 | ||
|
|
c3c0dde82f | ||
|
|
ecd5b681d0 | ||
|
|
66081e6cc1 | ||
|
|
aa6e94a128 | ||
|
|
098be2e115 | ||
|
|
17caf6cae9 | ||
|
|
26952631a3 | ||
|
|
fc7b6447b7 | ||
|
|
6c0db37919 | ||
|
|
69f78dbcbe | ||
|
|
c0389ac54c | ||
|
|
c0db909c13 | ||
|
|
46e4e966b9 | ||
|
|
288b59a348 | ||
|
|
1c7293db8d | ||
|
|
6006b47c44 | ||
|
|
6bb29f6e01 | ||
|
|
f1b160db04 | ||
|
|
3bb52f083b | ||
|
|
88337ab358 | ||
|
|
0935fe3fe3 | ||
|
|
96ed19549e | ||
|
|
945e9a2cb5 | ||
|
|
4d703e3807 | ||
|
|
f537f62adf | ||
|
|
7840404132 | ||
|
|
afad361cac | ||
|
|
58b23c290c | ||
|
|
12a73137d7 | ||
|
|
7a136eec5d | ||
|
|
e9bd9ab3a6 | ||
|
|
083bff62e3 | ||
|
|
f713316541 | ||
|
|
bcfdf2f70d | ||
|
|
018d6f877f | ||
|
|
1e4172b820 | ||
|
|
6b6827b70d | ||
|
|
96cccc83c6 | ||
|
|
2468a3a854 | ||
|
|
f68825f2ed | ||
|
|
2a12f71f96 | ||
|
|
74b64a5451 | ||
|
|
7d01e0349b | ||
|
|
80014bf2b1 | ||
|
|
adf3421f4a | ||
|
|
51c65ccfdc | ||
|
|
5d37d08cf8 | ||
|
|
eb18d75b2e | ||
|
|
549c582287 | ||
|
|
6c05029a9f | ||
|
|
b2278986dd | ||
|
|
98a2b8f159 | ||
|
|
0ba891fb14 | ||
|
|
042cd670aa | ||
|
|
95c7e4d02b | ||
|
|
d302525674 | ||
|
|
3dbb7298f8 | ||
|
|
0ed71ab53b | ||
|
|
b1491ae5b1 | ||
|
|
03b8dc8027 | ||
|
|
e3568cd89f | ||
|
|
b35e24daa7 | ||
|
|
f506b27a31 | ||
|
|
9452d5be1d | ||
|
|
ea3f449a08 | ||
|
|
dc9510fe25 | ||
|
|
731dd761d9 | ||
|
|
6726ccb2fb | ||
|
|
5fce0f9ecf | ||
|
|
ad03fc4118 | ||
|
|
3f77ff8815 | ||
|
|
26b5fa1e38 | ||
|
|
24286e6016 | ||
|
|
626577fe3d | ||
|
|
176915b59c | ||
|
|
0b60933c2a | ||
|
|
0e31d6936a | ||
|
|
78d9c43ef1 | ||
|
|
ce253a9563 | ||
|
|
18c3c36727 | ||
|
|
4e6f6a4579 | ||
|
|
84487f4d8d | ||
|
|
45f5a07989 | ||
|
|
0061883dbf | ||
|
|
47e3be11f0 | ||
|
|
420f4000c2 | ||
|
|
4582ce8769 | ||
|
|
3beb39f30b | ||
|
|
b72d6c058a | ||
|
|
0c8f367b29 | ||
|
|
50045edb4f | ||
|
|
f538d1aa43 | ||
|
|
4bd8d2a3b7 | ||
|
|
9fa952d968 | ||
|
|
1edad92d73 | ||
|
|
52282baeff | ||
|
|
85ab9d211d | ||
|
|
6e99a4dcfc | ||
|
|
35c91827af | ||
|
|
5c11b237f3 | ||
|
|
432b5d0427 | ||
|
|
b8b1fadfa1 | ||
|
|
74f5d8a066 | ||
|
|
09aeeccfa7 | ||
|
|
094abdc194 | ||
|
|
f4b97028b0 | ||
|
|
e14cbf2163 | ||
|
|
032cbab7b0 | ||
|
|
e306856c4f | ||
|
|
c1f164190b | ||
|
|
8030a078ff | ||
|
|
11adcbed25 | ||
|
|
c2b10859c9 | ||
|
|
e0e2c76d2f | ||
|
|
b0238c1560 | ||
|
|
5ffb52a17d | ||
|
|
6b34e72418 | ||
|
|
d43c632e55 | ||
|
|
d55dfdebde | ||
|
|
4b12876ebc | ||
|
|
3e12449b8f | ||
|
|
fdc3f302d9 | ||
|
|
07642fec83 | ||
|
|
4ce93232c3 | ||
|
|
ccea370cd9 | ||
|
|
8f6885689b | ||
|
|
64b15fafe2 | ||
|
|
d891acb8c0 | ||
|
|
de0bc718be | ||
|
|
283a06e200 | ||
|
|
3cfb2f8339 | ||
|
|
21164885e8 | ||
|
|
0d745c4fea | ||
|
|
0e2f8b5dda | ||
|
|
321777e8c1 | ||
|
|
aa9f0a4ca3 | ||
|
|
bee8862897 | ||
|
|
fed69025d2 | ||
|
|
f953488a31 | ||
|
|
25708e8082 | ||
|
|
a8afa91b7d | ||
|
|
2806221eda | ||
|
|
a9763376b7 | ||
|
|
153dc08aa7 | ||
|
|
332b924325 | ||
|
|
b2ee4e93d4 | ||
|
|
fda62e0065 | ||
|
|
faafb1464c | ||
|
|
edfd06eaef | ||
|
|
1a83083651 | ||
|
|
5cb3b16f36 | ||
|
|
3aa6913538 | ||
|
|
2c6f723317 | ||
|
|
ddfeaef2ca | ||
|
|
a71baef5d3 | ||
|
|
e63ec23922 | ||
|
|
da17b6f867 | ||
|
|
002becdc4f | ||
|
|
2ade1778b1 | ||
|
|
f6c8ce1fd1 | ||
|
|
8aa1435fbd | ||
|
|
3e29b6e443 | ||
|
|
1a138aea1a | ||
|
|
d40712937d | ||
|
|
cfe1abec08 | ||
|
|
719ed28d7e | ||
|
|
aa1773d633 | ||
|
|
9b8b882818 | ||
|
|
17664d294e | ||
|
|
2ae4ee85e0 | ||
|
|
70bb08a93a | ||
|
|
88f6360321 | ||
|
|
f7538342df | ||
|
|
8e6d5d11b6 | ||
|
|
ac74f09dc8 | ||
|
|
f47265e9c5 | ||
|
|
9243887a3a | ||
|
|
4efac2c0fa | ||
|
|
f3e1d5592a | ||
|
|
c67d9ce09b | ||
|
|
27ee90a56d | ||
|
|
41ccbdbf17 | ||
|
|
17fc3c23ed | ||
|
|
fdb0798f28 | ||
|
|
b4d842c342 | ||
|
|
7cddd832aa | ||
|
|
6a10753267 | ||
|
|
38dba5394e | ||
|
|
108cdd4242 | ||
|
|
228aa6c631 | ||
|
|
8936b3aa66 | ||
|
|
6558448eae | ||
|
|
88be599c2e | ||
|
|
cf1bbf63fc | ||
|
|
4e888d142b | ||
|
|
a5e6d9ef3d | ||
|
|
5e58af466c | ||
|
|
899c15f023 | ||
|
|
861da7b5c9 | ||
|
|
b62cf698a5 | ||
|
|
b928e5c4dc | ||
|
|
b748ea7239 | ||
|
|
bd9ba1139e | ||
|
|
5ed25aa327 | ||
|
|
7f51f21512 | ||
|
|
c24cc726e8 | ||
|
|
7b90a8f921 | ||
|
|
9fb96cd200 | ||
|
|
f881b59d60 | ||
|
|
ebb07520c0 | ||
|
|
29d5ae621a | ||
|
|
6e275514ad | ||
|
|
08503943f4 | ||
|
|
0c547748bf | ||
|
|
19ab9f0403 | ||
|
|
c895554a22 | ||
|
|
968c2c40fa | ||
|
|
de845d2885 | ||
|
|
0e1f57d712 | ||
|
|
6b3dfbc635 | ||
|
|
5e2b4dec99 | ||
|
|
0cd4a143ab | ||
|
|
c7ad9acc79 | ||
|
|
afeaf90d0d | ||
|
|
3603aaafa6 | ||
|
|
6cab8d2cd4 | ||
|
|
ca2f3d76e6 | ||
|
|
a2beaf0582 | ||
|
|
4a116e6791 | ||
|
|
040fc64583 | ||
|
|
e19011d0e0 | ||
|
|
8d3b395e86 | ||
|
|
2d1d8a6eec | ||
|
|
498a355fb2 | ||
|
|
944031af14 | ||
|
|
ee9d427526 | ||
|
|
9b98ae66ce | ||
|
|
126ba44719 | ||
|
|
503e3ba555 | ||
|
|
c264d26edd | ||
|
|
185c68c55b | ||
|
|
4624b0d1a1 | ||
|
|
5fe0a50c99 | ||
|
|
a484fe1de3 | ||
|
|
e48690bdf9 | ||
|
|
bc40ff7f19 | ||
|
|
30979124b5 | ||
|
|
6eb4c5e356 | ||
|
|
38ede3719f | ||
|
|
4503ad1e34 | ||
|
|
9fc6b0d654 | ||
|
|
d00223332e | ||
|
|
d3013ae151 | ||
|
|
b2fc46c320 | ||
|
|
53aac259a0 | ||
|
|
af35b87d5b | ||
|
|
0171452b02 | ||
|
|
065a33c846 | ||
|
|
90601b9471 | ||
|
|
327f630ed7 | ||
|
|
96acc6900d | ||
|
|
91cc36f1ec | ||
|
|
575e54e5d6 | ||
|
|
9a2fd38f33 | ||
|
|
7cba0da0a2 | ||
|
|
d8eb48c9de | ||
|
|
3ccd592eab | ||
|
|
a157546d82 | ||
|
|
3ec704b91c | ||
|
|
331af7bf35 | ||
|
|
473aff9093 | ||
|
|
6ff08f2ac1 | ||
|
|
3db7f6675e | ||
|
|
e501a15ef2 | ||
|
|
4e8974bcd9 | ||
|
|
7914372707 | ||
|
|
3c794247c3 | ||
|
|
ae12e3a51c | ||
|
|
fdc2ab30c0 | ||
|
|
122541eedc | ||
|
|
7e54bc8bcd | ||
|
|
e1ebe97eb5 | ||
|
|
9fed30af55 | ||
|
|
4fd02d7e75 | ||
|
|
e30a99f692 | ||
|
|
b891c52d9b | ||
|
|
74eb8a77e5 | ||
|
|
ba59d6d1b7 | ||
|
|
46efeb7fa8 | ||
|
|
673c1104b2 | ||
|
|
7cca872af5 | ||
|
|
3cef1991b2 | ||
|
|
64493d8636 | ||
|
|
df78322bdc | ||
|
|
f1a967d631 | ||
|
|
ec48dfa453 | ||
|
|
5881a13b20 | ||
|
|
efd9e875db | ||
|
|
6f25e8ae5a | ||
|
|
449519c1b4 | ||
|
|
e2e5f7cee9 | ||
|
|
9d30233a38 | ||
|
|
d684fc4096 | ||
|
|
5f3f3f1b24 | ||
|
|
6aa2a2b89b | ||
|
|
47135164ee | ||
|
|
5a75fb9b53 | ||
|
|
7933b08e85 | ||
|
|
a6809b4550 | ||
|
|
8f77308bca | ||
|
|
65f1e64812 | ||
|
|
79942b3bea | ||
|
|
9ee41b9b6a | ||
|
|
21995e4ac9 | ||
|
|
8dc871c86e | ||
|
|
78785a5bca | ||
|
|
662b4b5ca3 | ||
|
|
bee96d1cf1 | ||
|
|
122ebe1ccb | ||
|
|
e741e165ae | ||
|
|
d38dc24915 | ||
|
|
d12612f091 | ||
|
|
e6d73135c1 | ||
|
|
816612cf0a | ||
|
|
7ca8ba272c | ||
|
|
d337a6d019 | ||
|
|
f79c4c6080 | ||
|
|
2e7fc6229b | ||
|
|
fc724575fa | ||
|
|
84716610b8 | ||
|
|
29983772ed | ||
|
|
d100e628c2 | ||
|
|
94f121f37d | ||
|
|
d9266ba61c | ||
|
|
8389056d2d | ||
|
|
26b8cb238a | ||
|
|
f8d4690cd8 | ||
|
|
c2e2f80945 | ||
|
|
e9efcdf191 | ||
|
|
8ea159520d | ||
|
|
337e18051a | ||
|
|
3c4e094990 | ||
|
|
71e6f3d037 | ||
|
|
d2690bf75a | ||
|
|
44f002a5a1 | ||
|
|
f8442c9ec0 | ||
|
|
b3513c7d1f | ||
|
|
a82e813333 | ||
|
|
dd246aeee4 | ||
|
|
1653d3615b | ||
|
|
4847b00f9e | ||
|
|
d613145c1a | ||
|
|
a788f66e18 | ||
|
|
9ca3a7456c | ||
|
|
5cec001058 | ||
|
|
2fb42f5144 | ||
|
|
02c22a668c | ||
|
|
a7bf90f5be | ||
|
|
f71e90fae0 | ||
|
|
8afb11128d | ||
|
|
2e0c238cc6 | ||
|
|
03b89b4327 | ||
|
|
a878d1f39c | ||
|
|
4a09e13e9d | ||
|
|
0b4d32bf98 | ||
|
|
b940fc9c48 | ||
|
|
2eb0dd7153 | ||
|
|
101c7db9a2 | ||
|
|
032ace2051 | ||
|
|
5754b9907d | ||
|
|
ffb8203ae7 | ||
|
|
906da033dd | ||
|
|
1077405bc1 | ||
|
|
e37df8fc89 | ||
|
|
3799e219fc | ||
|
|
eab14da30e | ||
|
|
84e999fe57 | ||
|
|
f22ff6a340 | ||
|
|
d9d0b93306 | ||
|
|
09248cd451 | ||
|
|
73880428dc | ||
|
|
2a049d1324 | ||
|
|
51cbd74235 | ||
|
|
45246b6109 | ||
|
|
d3956adca8 | ||
|
|
298e54c32a | ||
|
|
4c82f0259d | ||
|
|
d0c043c7ff | ||
|
|
20cbecfd7c | ||
|
|
194defdb1b | ||
|
|
5017cbe67e | ||
|
|
4c4201cb72 | ||
|
|
3ee635f8e4 | ||
|
|
4c2dabffd6 | ||
|
|
185c83dae2 | ||
|
|
15d124b225 | ||
|
|
9c474c5b08 | ||
|
|
f92f283e00 | ||
|
|
f6b94614e8 | ||
|
|
978517b057 | ||
|
|
d911640809 | ||
|
|
473e610430 | ||
|
|
3b9b725406 | ||
|
|
fa742bc6bf | ||
|
|
6a02dd0993 | ||
|
|
243d10f864 | ||
|
|
bbe46071f3 | ||
|
|
8ded184ea3 | ||
|
|
ce407ba844 | ||
|
|
ddb6a7fa93 | ||
|
|
72bba47880 | ||
|
|
0c38b1e3f9 | ||
|
|
8de3de235b | ||
|
|
24e1eef56e | ||
|
|
378fb92434 | ||
|
|
c7c184d952 | ||
|
|
6f7d203adb | ||
|
|
8d608830d4 | ||
|
|
6734dc6f43 | ||
|
|
5343d504c4 | ||
|
|
f8684beba2 | ||
|
|
c88277a898 | ||
|
|
1f0b988472 | ||
|
|
60c264a2e7 | ||
|
|
7724219f1e | ||
|
|
1d5ce4d1c2 | ||
|
|
9ff4a311ef | ||
|
|
2f0bdd9c39 | ||
|
|
e1ba37b910 | ||
|
|
7448e7c3c5 | ||
|
|
ee6612ecfa | ||
|
|
aa5504aad3 | ||
|
|
1523edd519 | ||
|
|
190d6faa67 | ||
|
|
9f97ff4ced | ||
|
|
989e6c9198 | ||
|
|
9c19e746a4 | ||
|
|
0a20be7097 | ||
|
|
0d72a0904b | ||
|
|
7f9e7a4566 | ||
|
|
48d9f44291 | ||
|
|
b5d197dfe3 | ||
|
|
1d387d04fd | ||
|
|
4215ba6476 | ||
|
|
5b2a92a5c4 | ||
|
|
9661cd4c3a | ||
|
|
cc2580230f | ||
|
|
2a69a892b0 | ||
|
|
34e5865941 | ||
|
|
07464c967b | ||
|
|
c2fcaf7a6b | ||
|
|
d8c9391498 | ||
|
|
78554d2319 | ||
|
|
c2711d643e | ||
|
|
913e3d32ee | ||
|
|
f0b9c5fff4 | ||
|
|
fe67404fd5 | ||
|
|
555ed96918 | ||
|
|
fc74154ffe | ||
|
|
74e8ddaf95 | ||
|
|
f05c7f1141 | ||
|
|
565d385132 | ||
|
|
e2384f59a2 | ||
|
|
f619b62877 | ||
|
|
22e5d15a17 | ||
|
|
77fcf4d260 | ||
|
|
46a8b242a8 | ||
|
|
901d255026 | ||
|
|
b3cf555eb2 | ||
|
|
594cce35c7 | ||
|
|
8b96af8e3f | ||
|
|
641a0bda9e | ||
|
|
b1e438e141 | ||
|
|
a61338ff8b | ||
|
|
82da7dc999 | ||
|
|
9f7bb14bd1 | ||
|
|
6ec5fd86fa | ||
|
|
cf16bbe64b | ||
|
|
3da450a019 | ||
|
|
66276710f4 | ||
|
|
957380b258 | ||
|
|
fe3f16924d | ||
|
|
ffc3128377 | ||
|
|
c05e2ec47d | ||
|
|
9768f49714 | ||
|
|
6c54cfe88a | ||
|
|
2dc8d6bcc0 | ||
|
|
08dc398452 | ||
|
|
cd180c9a44 | ||
|
|
0a7fe52124 | ||
|
|
b71faf47cc | ||
|
|
67babceb73 | ||
|
|
8e13fc86d5 | ||
|
|
351c8e0972 | ||
|
|
dc44e20be0 | ||
|
|
e64b498d6e | ||
|
|
31ab4a13c9 | ||
|
|
e9728dcc8d | ||
|
|
40a3644086 | ||
|
|
41ef71abdf | ||
|
|
3b40e52c98 | ||
|
|
de8c7969f3 | ||
|
|
f2c049222b | ||
|
|
be30ac1fcb | ||
|
|
c5cc7fe26a | ||
|
|
d04b0a5c73 | ||
|
|
72ab2aef0a | ||
|
|
1527bb7ad3 | ||
|
|
8cb26fc9ac | ||
|
|
c21794d0a0 | ||
|
|
1a6338569a | ||
|
|
c5ebe1a88a | ||
|
|
a3f2028ae4 | ||
|
|
c393ee4591 | ||
|
|
83a82ae10e | ||
|
|
676694e458 | ||
|
|
2ca218928f | ||
|
|
776ce223fc | ||
|
|
0d4d1f55c9 | ||
|
|
d6dba71ace | ||
|
|
61ee11ae6c | ||
|
|
90f32e7277 | ||
|
|
b85d9afdb3 | ||
|
|
4297d43d9a | ||
|
|
cfcf714c21 | ||
|
|
f7cfc6a65e | ||
|
|
4ead3bcebf | ||
|
|
21e0677039 | ||
|
|
107b5a4854 | ||
|
|
9761b65137 | ||
|
|
b1831d2786 | ||
|
|
977d369e40 | ||
|
|
5cf5b25175 | ||
|
|
e75c3020c8 | ||
|
|
aeb0a4008d | ||
|
|
2d43ad59ec | ||
|
|
f86ec07c45 | ||
|
|
fc012d6d65 | ||
|
|
6b71232e38 | ||
|
|
e157023fc1 | ||
|
|
6e38db882f | ||
|
|
09600699cb | ||
|
|
6a5e74f031 | ||
|
|
795bd1e995 | ||
|
|
784416f658 | ||
|
|
b151afe567 | ||
|
|
117ae1d648 | ||
|
|
7165d8aa54 | ||
|
|
6b461b2d89 | ||
|
|
affc5be840 | ||
|
|
e3ff5616ef | ||
|
|
d9a401d57e | ||
|
|
acd5823953 | ||
|
|
9b13565750 | ||
|
|
734d8ff85c | ||
|
|
a02ef1a6c7 | ||
|
|
f13bf11d0f | ||
|
|
7d0b5fed8f | ||
|
|
e1f51f04c1 | ||
|
|
f6d74be123 | ||
|
|
50a1935b68 | ||
|
|
694ecce150 | ||
|
|
3e3bd2722f | ||
|
|
44fdf83e4c | ||
|
|
99c4ce67e4 | ||
|
|
71aceec4cf | ||
|
|
98e4cdbd4c | ||
|
|
86ef0109f4 | ||
|
|
b4142261c2 | ||
|
|
359624e8eb | ||
|
|
5bcc11d9e8 | ||
|
|
5aa414dd24 | ||
|
|
1e51b03971 | ||
|
|
fc484bd319 | ||
|
|
9c4783142e | ||
|
|
4dc03318e8 | ||
|
|
15ba54c4c5 | ||
|
|
342138aecb | ||
|
|
9f53c62e06 | ||
|
|
2d996033e3 | ||
|
|
9fa6dc4131 | ||
|
|
4930227743 | ||
|
|
fbfcce563d | ||
|
|
7f5ad3743b | ||
|
|
981020e72b | ||
|
|
7c1a705a07 | ||
|
|
3d53ae583f | ||
|
|
dc9f03cbd0 | ||
|
|
de7bca7ef8 | ||
|
|
f151f56a2e | ||
|
|
fe3d1713a4 | ||
|
|
2cad3be7a3 | ||
|
|
5262512eea | ||
|
|
fabba73b1e | ||
|
|
d291ec739b | ||
|
|
0dc0bbd4f3 | ||
|
|
984a029ce4 | ||
|
|
1cbc1f30a6 | ||
|
|
08fb39a1e4 | ||
|
|
d8a71ce195 | ||
|
|
13986c12bc | ||
|
|
cc64704a82 | ||
|
|
df2ad99260 | ||
|
|
fb1f277b9a | ||
|
|
0388161464 | ||
|
|
e989d5603f | ||
|
|
defaa0d008 | ||
|
|
e161ba80f2 | ||
|
|
034aaff56c | ||
|
|
b0fb52c5f4 | ||
|
|
a05f9c172f | ||
|
|
adde936d18 | ||
|
|
feda999eb3 | ||
|
|
8dae181c2f | ||
|
|
8cdac431a6 | ||
|
|
0ecf5118ba | ||
|
|
f21638a1e2 | ||
|
|
8dc16494a7 | ||
|
|
a8765b1dc0 | ||
|
|
d346b94b8a | ||
|
|
c4abe4f46a | ||
|
|
ad6a5eb4e1 | ||
|
|
c84834d666 | ||
|
|
334fe70d6c | ||
|
|
3b4fbaccc9 | ||
|
|
58401e0b6e | ||
|
|
3496f3a8ba | ||
|
|
441708ea12 | ||
|
|
ba8abb9031 | ||
|
|
2718a22f64 | ||
|
|
85fb4be37e | ||
|
|
f772c92eed | ||
|
|
cd58d39eb9 | ||
|
|
2d730a4618 | ||
|
|
da6d17531c | ||
|
|
37b9b182b1 | ||
|
|
eaa86060e2 | ||
|
|
5e128214fa | ||
|
|
9a7b967889 | ||
|
|
5e498e7442 | ||
|
|
25990ecd37 | ||
|
|
ead5a97871 | ||
|
|
a66495b2e0 | ||
|
|
f83172f9f9 | ||
|
|
80a957c1e3 | ||
|
|
e983169b35 | ||
|
|
b21d633c0c | ||
|
|
f538d028d5 | ||
|
|
4e15b7abc2 | ||
|
|
e80ea5eae2 | ||
|
|
6215050086 | ||
|
|
1fdb44ff42 | ||
|
|
1768a2f8b7 | ||
|
|
2f26ef0873 | ||
|
|
ac61fd7ba4 | ||
|
|
a886166489 | ||
|
|
2073a9f3e5 | ||
|
|
be12049a87 | ||
|
|
de7dfc2ea6 | ||
|
|
7337a467b9 | ||
|
|
8118b4a774 | ||
|
|
b295743330 | ||
|
|
4f8d7092e0 | ||
|
|
2701e57779 | ||
|
|
f9375d5c33 | ||
|
|
d04f049fa3 | ||
|
|
8b8e724761 | ||
|
|
45e8c57f77 | ||
|
|
d01b3301d0 | ||
|
|
a7a55c7617 | ||
|
|
0695c12420 | ||
|
|
4af533c010 | ||
|
|
6a28d2b81c | ||
|
|
54769a2ad3 | ||
|
|
87cece8379 | ||
|
|
fe3790cb9c | ||
|
|
39cb238065 | ||
|
|
2182149b7a | ||
|
|
006e0548c1 | ||
|
|
8257fbdbf3 | ||
|
|
f57224952a | ||
|
|
3c982cae64 | ||
|
|
3ffe63c02c | ||
|
|
7aa5d4a375 | ||
|
|
1d06dd630a | ||
|
|
f630fb6732 | ||
|
|
df3ea47a3c | ||
|
|
6ceb122ae8 | ||
|
|
ec92a0c458 | ||
|
|
60294c2514 | ||
|
|
94f72ea137 | ||
|
|
9b7295fd8f | ||
|
|
c93b49e714 | ||
|
|
a81b9a0f09 | ||
|
|
82d9d2a016 | ||
|
|
d529a7514a | ||
|
|
a5c91a6ed4 | ||
|
|
357000a0e7 | ||
|
|
80e26ba4af | ||
|
|
6310a15650 | ||
|
|
5909215967 | ||
|
|
f0eb1c59b1 | ||
|
|
22aa429059 | ||
|
|
3cc5f38da2 | ||
|
|
83985ba910 | ||
|
|
263d4bfc1e | ||
|
|
8c608cdce5 | ||
|
|
ceea495da1 | ||
|
|
a0af0a98cb | ||
|
|
9e99cfef61 | ||
|
|
b6e6733361 | ||
|
|
d3cf84680c | ||
|
|
8dc6fde588 | ||
|
|
1938c8239a | ||
|
|
bf43c61a05 | ||
|
|
1e3ddd612e | ||
|
|
bb5d82fce9 | ||
|
|
b2ec57776d | ||
|
|
7c092a8714 | ||
|
|
53350bbec0 | ||
|
|
c6502054e9 | ||
|
|
35204faa6b | ||
|
|
9e87a312ab | ||
|
|
e1911eef3a | ||
|
|
e0c11cfeed | ||
|
|
b9efd4fbf0 | ||
|
|
38ca4ceb52 | ||
|
|
bfe8a8aa18 | ||
|
|
430f060db2 | ||
|
|
62cffc51bb | ||
|
|
75004e9d3e | ||
|
|
efba9a636a | ||
|
|
e2161fa3af | ||
|
|
6d6e9f965b | ||
|
|
9307422e54 | ||
|
|
df5b763d33 | ||
|
|
90ff85b04d | ||
|
|
c1505f3513 | ||
|
|
1bd4a15d5c | ||
|
|
7a2ecf8435 | ||
|
|
3c7ff0ee19 | ||
|
|
d3073a8ebd | ||
|
|
59e9f36e25 | ||
|
|
7e21db1de1 | ||
|
|
1f451777b4 | ||
|
|
832442d092 | ||
|
|
7101757bff | ||
|
|
3090ed1523 | ||
|
|
1dd2b32a1f | ||
|
|
f75e37cf83 | ||
|
|
3fba6754c5 | ||
|
|
d4e2d7f07f | ||
|
|
7917f74bc8 | ||
|
|
7d086beb3f | ||
|
|
37cd7d6944 | ||
|
|
5b71274fa5 | ||
|
|
971df18b3c | ||
|
|
841ea86cea | ||
|
|
f79e703861 | ||
|
|
6f9d69e410 | ||
|
|
e0eaaf4fb9 | ||
|
|
b9b4b7c64d | ||
|
|
47d58aa484 | ||
|
|
1e87c68435 | ||
|
|
54106962fe | ||
|
|
ec2fee7a4e | ||
|
|
27aed0a951 | ||
|
|
ec5738c651 | ||
|
|
050ffdd585 | ||
|
|
7169c4e386 | ||
|
|
4b7fa63722 | ||
|
|
bff0d1dcf4 | ||
|
|
1ac469f340 | ||
|
|
3b4c10f952 | ||
|
|
07d2b5ce12 | ||
|
|
fd2fc23885 | ||
|
|
bf051657ed | ||
|
|
baecec9a37 | ||
|
|
805e7a10d1 | ||
|
|
646dfa8b70 | ||
|
|
bf8b0d8843 | ||
|
|
41b5b997a7 | ||
|
|
881867be71 | ||
|
|
4afd0c5456 | ||
|
|
ec74cc2d39 | ||
|
|
88b29b9eb7 | ||
|
|
3974a548d3 | ||
|
|
90f508e89d | ||
|
|
d70cee7fec | ||
|
|
9c542791ef | ||
|
|
2d1d6ffb2c | ||
|
|
9cc7fe97c5 | ||
|
|
61fb5a588e | ||
|
|
815d202f6d | ||
|
|
2b57ec476d | ||
|
|
eb1b700ef7 | ||
|
|
efc88fbc6f | ||
|
|
0ba0591e19 | ||
|
|
385608648f | ||
|
|
7d170ee391 | ||
|
|
5906d144dd | ||
|
|
6a1cc3abe9 | ||
|
|
6aa11e5ceb | ||
|
|
ce33fda6ec | ||
|
|
88768e8003 | ||
|
|
4f1dd8b304 | ||
|
|
42cae27992 | ||
|
|
13f646025b | ||
|
|
e7c9197d07 | ||
|
|
7afd5e5963 | ||
|
|
d73453863d | ||
|
|
8b88638232 | ||
|
|
677cdc1239 | ||
|
|
a4d3ffe7d4 | ||
|
|
3ada971d8a | ||
|
|
6588cc30ea | ||
|
|
09f188659a | ||
|
|
ea3553ceb7 | ||
|
|
a64b1eccdf | ||
|
|
eda2b7955d | ||
|
|
6bc0e032fc | ||
|
|
9ce797eee8 | ||
|
|
ab2a90374b | ||
|
|
10cf45dd6b | ||
|
|
0ac9ecb823 | ||
|
|
4096a46547 | ||
|
|
a4ac9bf088 | ||
|
|
ecede1e947 | ||
|
|
130053dfad | ||
|
|
e3932f6e65 | ||
|
|
05792fa5f4 | ||
|
|
3469e9f4a8 | ||
|
|
c839a66958 | ||
|
|
31757203eb | ||
|
|
3f5ed476a6 | ||
|
|
97f8b8aa60 | ||
|
|
16af12b58c | ||
|
|
1b11c90f2b | ||
|
|
3b71cb13b1 | ||
|
|
439bcb59cf | ||
|
|
0e9cbeb340 | ||
|
|
f48a02949c | ||
|
|
4eea8a5c07 | ||
|
|
a9a420f0eb | ||
|
|
b90cf971d9 | ||
|
|
1ac57038d9 | ||
|
|
fe3be06c2c | ||
|
|
1ff57e66aa | ||
|
|
036c1706f5 | ||
|
|
467f0acdb4 | ||
|
|
c910cab7a3 | ||
|
|
74346d0046 | ||
|
|
eceb72f609 | ||
|
|
aad782a15f | ||
|
|
378600dc79 | ||
|
|
d4cc63f120 | ||
|
|
b99fd143f2 | ||
|
|
8c74430466 | ||
|
|
fc9608a392 | ||
|
|
ad731aebcb | ||
|
|
15406825aa | ||
|
|
1e17afbefa | ||
|
|
83334f7567 | ||
|
|
7275957947 | ||
|
|
74765f05bc | ||
|
|
bae32a1a5f | ||
|
|
347642985f | ||
|
|
6ebaad28b3 | ||
|
|
9508bf2a0c | ||
|
|
68c6253b3f | ||
|
|
803ce07701 | ||
|
|
95d3b19ced | ||
|
|
cc97a62587 | ||
|
|
434144eef2 | ||
|
|
adf894a5bc | ||
|
|
5e4025bd4c | ||
|
|
9f8af21ad7 | ||
|
|
61e117beaa | ||
|
|
ec86fe4e33 | ||
|
|
3c29ec5c8e | ||
|
|
de32fc83a4 | ||
|
|
51e8a83234 | ||
|
|
b8163b7949 | ||
|
|
30dbd3ac4f | ||
|
|
0ae83a6c97 | ||
|
|
5ee54aa4ef | ||
|
|
56e7ae1d56 | ||
|
|
39332a92ed | ||
|
|
6a82f8090e | ||
|
|
5860e7fdce | ||
|
|
22c3ba2466 | ||
|
|
4e260ba3dc | ||
|
|
49674c39e8 | ||
|
|
23174d56f5 | ||
|
|
5ff3e85d10 | ||
|
|
2242ddfbec | ||
|
|
69ec5f9720 | ||
|
|
6162782bee | ||
|
|
599b2ef377 | ||
|
|
7aa3b1a6ee | ||
|
|
718e7ab064 | ||
|
|
991fa0cf7d | ||
|
|
e81d053f35 | ||
|
|
211cf2b64c | ||
|
|
5837adf45f | ||
|
|
9bb6ce5f1d | ||
|
|
ab9dbb22cc | ||
|
|
2a84fe052c | ||
|
|
140ebbf10d | ||
|
|
00ecba67b5 | ||
|
|
beb8fd9893 | ||
|
|
cc7d88c033 | ||
|
|
f85103af9d | ||
|
|
6471efb3a5 | ||
|
|
f2e36c35a4 | ||
|
|
2eaacd7cb8 | ||
|
|
cc51d478f8 | ||
|
|
a844dc96eb | ||
|
|
e92a684b26 | ||
|
|
a5648de486 | ||
|
|
88dc25229b | ||
|
|
ddd93874cc | ||
|
|
609c0482be | ||
|
|
92acdff6cb | ||
|
|
292fd7d41f | ||
|
|
1af76638cf | ||
|
|
bf875554e1 | ||
|
|
2b91799ee0 | ||
|
|
2947229d40 | ||
|
|
648314d730 | ||
|
|
fc3c3376b7 | ||
|
|
fcbc6d43a1 | ||
|
|
a01fa21209 | ||
|
|
60a6d4a348 | ||
|
|
6c740f060e | ||
|
|
5a8bf42ddb | ||
|
|
c8cc74e384 | ||
|
|
c82ae6a3a7 | ||
|
|
fbc43d24fe | ||
|
|
c0f8f3bdfe | ||
|
|
3461ec863b | ||
|
|
035f162ebc | ||
|
|
6754885795 | ||
|
|
42e4e5e3ae | ||
|
|
71a0f46b73 | ||
|
|
5f52afdc08 | ||
|
|
54706ad65e | ||
|
|
a96d5932a8 | ||
|
|
41c5615201 | ||
|
|
719427764c | ||
|
|
887fb82cf2 | ||
|
|
0c78e91aed | ||
|
|
62a234a8f9 | ||
|
|
29086cee14 | ||
|
|
16369255e2 | ||
|
|
b3e9940625 | ||
|
|
c04f3e4f00 | ||
|
|
13f7c71bf2 | ||
|
|
eae55c1be8 | ||
|
|
d6588bd382 | ||
|
|
3343f2459d | ||
|
|
78679338d7 | ||
|
|
c049a1bfff | ||
|
|
f311453aed | ||
|
|
c67e5b6047 | ||
|
|
7ed315e8ab | ||
|
|
1d223498cb | ||
|
|
cbcaae6537 | ||
|
|
b8705198c0 | ||
|
|
bef3c85ebf | ||
|
|
2709533fb1 | ||
|
|
e3854f5c58 | ||
|
|
edb9ca71e5 | ||
|
|
ad9ce72f61 | ||
|
|
78f2065b6f | ||
|
|
a18013c8f4 | ||
|
|
b7787b9a1a | ||
|
|
63cfb817d7 | ||
|
|
a572a10ef7 | ||
|
|
e2255e45d8 | ||
|
|
0e5ba60cb6 | ||
|
|
f78d131015 | ||
|
|
bf63baad53 | ||
|
|
f229aaa7c4 | ||
|
|
bf34ee6e22 | ||
|
|
a68a478bf3 | ||
|
|
626beee345 | ||
|
|
f40ef6209b | ||
|
|
c4c8399247 | ||
|
|
7baffe34ac | ||
|
|
434dce2b9f | ||
|
|
a76e74fb09 | ||
|
|
f39815393a | ||
|
|
9031babd92 | ||
|
|
c608f6ad79 | ||
|
|
efec4e1adc | ||
|
|
ebd5f150c1 | ||
|
|
156dcb54e8 | ||
|
|
88ef76989c | ||
|
|
fc284af684 | ||
|
|
3a8685cd15 | ||
|
|
f035655f5b | ||
|
|
f498e08d1e | ||
|
|
db3186a65f | ||
|
|
248815a3e0 | ||
|
|
ebb62b5d55 | ||
|
|
b9a5ad205a | ||
|
|
100986d8d9 | ||
|
|
b7c9a36d57 | ||
|
|
d76551ab28 | ||
|
|
92bc0752d1 | ||
|
|
657c251463 | ||
|
|
b6b8fee483 | ||
|
|
be5b60f895 | ||
|
|
681d31758f | ||
|
|
80dc2f5c9d | ||
|
|
ce7dd7a1fb | ||
|
|
85617c96a2 | ||
|
|
58760adb6a | ||
|
|
4ef0b72773 | ||
|
|
45631c3b81 | ||
|
|
6f6dde2579 | ||
|
|
e0acbe42cf | ||
|
|
4f137ccf89 | ||
|
|
04010e7dd9 | ||
|
|
f4f9f331c0 | ||
|
|
dada291f6b | ||
|
|
18f2f8b6d4 | ||
|
|
d4117ac968 | ||
|
|
eccbc8c242 | ||
|
|
3cdf24f515 | ||
|
|
d91faf9df8 | ||
|
|
d950efa6ea | ||
|
|
861d69ea7c | ||
|
|
b2cc904fab | ||
|
|
3f87b520bb | ||
|
|
135a362176 | ||
|
|
391ebc3702 | ||
|
|
b4d1443720 | ||
|
|
c06737aca2 | ||
|
|
f847232296 | ||
|
|
89f06b8923 | ||
|
|
90a2b1f3c9 | ||
|
|
059f51338d | ||
|
|
d3cea5121e | ||
|
|
c37301d2dc | ||
|
|
aa16778fbd | ||
|
|
ee499ad2ca | ||
|
|
958dd5bb27 | ||
|
|
f988b75999 | ||
|
|
e3ccb4bb3c | ||
|
|
3f0dc6f7e6 | ||
|
|
c212dd5bc7 | ||
|
|
1eceab0040 | ||
|
|
ab9d1e5956 | ||
|
|
c906290416 | ||
|
|
d52a24b6e9 | ||
|
|
9aeec3a759 | ||
|
|
550fcfe2e3 | ||
|
|
b2cdf9f2b4 | ||
|
|
19a3fe3dce | ||
|
|
754abbf78e | ||
|
|
9b855e9a03 | ||
|
|
2534fdf92d | ||
|
|
dab02e915e | ||
|
|
68da1a25eb | ||
|
|
c67b363576 | ||
|
|
5c0e7d8211 | ||
|
|
3d57c60840 | ||
|
|
8ab2725a79 | ||
|
|
ff27f8109c | ||
|
|
8e09d8bd71 | ||
|
|
d6df4cd03a | ||
|
|
df03fdf3d7 | ||
|
|
6c59945395 | ||
|
|
d16cc50561 | ||
|
|
e667484a94 | ||
|
|
71e5e6c6c0 | ||
|
|
c1df902593 | ||
|
|
3c3320a2ba | ||
|
|
35753bc6c2 | ||
|
|
5f7967d09c | ||
|
|
404b6e8af3 | ||
|
|
898c20e584 | ||
|
|
f278b76b04 | ||
|
|
6353f17635 | ||
|
|
9cae34babf | ||
|
|
c37cc61b30 | ||
|
|
9aced8e9b8 | ||
|
|
dde060bf4d | ||
|
|
b60518caa5 | ||
|
|
69000ef1f2 | ||
|
|
39d6106ef2 | ||
|
|
96a1cbe69f | ||
|
|
09fe495384 | ||
|
|
8457d6092d | ||
|
|
72c16e07ed | ||
|
|
12b96cba04 | ||
|
|
e4d943e942 | ||
|
|
7fa66325f3 | ||
|
|
e188a7875e | ||
|
|
ac9822b8c8 | ||
|
|
edb5fddd03 | ||
|
|
35f4a97e32 | ||
|
|
487b10fdda | ||
|
|
271cda88aa | ||
|
|
25b73ddcfa | ||
|
|
35b8146a87 | ||
|
|
091e5a33ac | ||
|
|
ffe4b7390d | ||
|
|
604d3e34a4 | ||
|
|
e116dd4aec | ||
|
|
d53614fb0a | ||
|
|
c91e5df117 | ||
|
|
96574816b3 | ||
|
|
b43a609ebc | ||
|
|
2c490ec799 | ||
|
|
fbb08d338a | ||
|
|
8e1718458a | ||
|
|
6bcd709320 | ||
|
|
1a6e3ec88e | ||
|
|
f5f50eca06 | ||
|
|
886fb7fb94 | ||
|
|
a82b3bedb2 | ||
|
|
d879bbc80a | ||
|
|
bf437b7933 | ||
|
|
49dff3c439 | ||
|
|
0d6c017cfb | ||
|
|
ba042db3f4 | ||
|
|
faeba6ad95 | ||
|
|
163e28ca7a | ||
|
|
3dbc168d76 | ||
|
|
fe49946852 | ||
|
|
6310ea46e3 | ||
|
|
ef8e3e5224 | ||
|
|
26cc722f74 | ||
|
|
043fdf7a51 | ||
|
|
c01105b49a | ||
|
|
f56f5a300c | ||
|
|
8b79f3683e | ||
|
|
319bd123ce | ||
|
|
e23243a65b | ||
|
|
c4261a8c10 | ||
|
|
009b58537e | ||
|
|
e51709a4e8 | ||
|
|
78813ed9b7 | ||
|
|
2e649a9f16 | ||
|
|
d36783cd1d | ||
|
|
101a59138c | ||
|
|
3809259f47 | ||
|
|
e103b28b41 | ||
|
|
8e7d0c0df9 | ||
|
|
d8845e5fcc | ||
|
|
b2ed544ee8 | ||
|
|
a40ee77326 | ||
|
|
85135e60c7 | ||
|
|
bee9f160fa | ||
|
|
64c67258b0 | ||
|
|
49e0f484e9 | ||
|
|
dbc78ff0aa | ||
|
|
ebca955682 | ||
|
|
d8ea26e305 | ||
|
|
37aafdd912 | ||
|
|
edf78afa8e | ||
|
|
1df4218deb | ||
|
|
1c5715824f | ||
|
|
6da46b3b62 | ||
|
|
e8d8080928 | ||
|
|
e7934314ad | ||
|
|
c79fcf6d8d | ||
|
|
3eb2a20c7f | ||
|
|
da99fe63be | ||
|
|
d9067af3a3 | ||
|
|
f10bedf186 | ||
|
|
19b0ad2605 | ||
|
|
6e7af103d3 | ||
|
|
8a91723dcf | ||
|
|
47e30c337e | ||
|
|
fb627d8b66 | ||
|
|
1cb59685c5 | ||
|
|
2b395f1d89 | ||
|
|
e9718fa346 | ||
|
|
81fc2c1d23 | ||
|
|
dc60f57a9a | ||
|
|
5c4f12fa00 | ||
|
|
00ffd9ca74 | ||
|
|
166f859c72 | ||
|
|
1969186fe1 | ||
|
|
e1e7854d97 | ||
|
|
9d5220e28e | ||
|
|
fc0b41d587 | ||
|
|
e4cb861817 | ||
|
|
640f080ea6 | ||
|
|
eed4b3b839 | ||
|
|
f48dafe87e | ||
|
|
daff8fea9f | ||
|
|
51b4a38e20 | ||
|
|
2171e372ce | ||
|
|
1a30709121 | ||
|
|
2ed9b11f50 | ||
|
|
1797ff5d90 | ||
|
|
8c46e6de9b | ||
|
|
613adfa342 | ||
|
|
684b0622eb | ||
|
|
426f345f19 | ||
|
|
f80df6e061 | ||
|
|
e2177e8b36 | ||
|
|
37353cca55 | ||
|
|
c72817fc25 | ||
|
|
81c1d3ed1a | ||
|
|
0e1234c57d | ||
|
|
50fa816a6e | ||
|
|
07f4211dd3 | ||
|
|
44a433398f | ||
|
|
6821cb60b5 | ||
|
|
b8788bc390 | ||
|
|
94c59d9d97 | ||
|
|
5201b5a1ba | ||
|
|
215ef460ef | ||
|
|
90be8ebfa2 | ||
|
|
f62d58bd45 | ||
|
|
9e5da2d75f | ||
|
|
e12f079ac1 | ||
|
|
3c0f18753f | ||
|
|
a0e4d3df32 | ||
|
|
4f590e3326 | ||
|
|
6fdfe606e6 | ||
|
|
1baab6c3ae | ||
|
|
61e67a2766 | ||
|
|
8277015785 | ||
|
|
97952e0ddc | ||
|
|
b80d73f3cf | ||
|
|
a1bf6a427d | ||
|
|
67144bec73 | ||
|
|
f801763e6b | ||
|
|
542dd331d7 | ||
|
|
4ac3454dc6 | ||
|
|
23b578ef89 | ||
|
|
b6c26ab4e4 | ||
|
|
4fbcfc3168 | ||
|
|
9d0aab4d21 | ||
|
|
6420bc6dd8 | ||
|
|
9fa41d06d6 | ||
|
|
805227d6fc | ||
|
|
67d4632868 | ||
|
|
7efe967add | ||
|
|
a8cdfc6b23 | ||
|
|
7964ebf3c5 | ||
|
|
49b8e5e5d2 | ||
|
|
54e6b6b24a | ||
|
|
0fe6cfb224 | ||
|
|
0ee540df9c | ||
|
|
249f0a80d8 | ||
|
|
b3368a3fb2 | ||
|
|
327576274f | ||
|
|
0e7004a7f8 | ||
|
|
ca8549549c | ||
|
|
fa6d9a4b01 | ||
|
|
3693e4909b | ||
|
|
697a8370cb | ||
|
|
155a362d60 | ||
|
|
fed95d70b0 | ||
|
|
cd126138e0 | ||
|
|
7e7398aa92 | ||
|
|
ede7c579f9 | ||
|
|
67aa6f1913 | ||
|
|
80eba1de10 | ||
|
|
5e05a23e94 | ||
|
|
8c8061a637 | ||
|
|
9ef3c59698 | ||
|
|
5f7c6c2fbf | ||
|
|
991360da97 | ||
|
|
50d9fb2b5b | ||
|
|
001a3e3dc8 | ||
|
|
b6eca61786 | ||
|
|
cc75eb3aa2 | ||
|
|
f5fda88cf6 | ||
|
|
e99f13b14d | ||
|
|
08e809bf75 | ||
|
|
1d6aeb5de1 | ||
|
|
d13ccd1c26 | ||
|
|
54482e6451 | ||
|
|
9491b36a25 | ||
|
|
d387e14d4c | ||
|
|
5c41b332ad | ||
|
|
fd69c7ed75 | ||
|
|
3ff8d6dc22 | ||
|
|
af6fd21e11 | ||
|
|
5bd5c50c8d | ||
|
|
2c8d296044 | ||
|
|
df6a100fcb | ||
|
|
3f6188edff | ||
|
|
cc0486b3cc | ||
|
|
8314bafc0e | ||
|
|
764c695e4e | ||
|
|
808ca42992 | ||
|
|
4a8428318b | ||
|
|
c93059783b | ||
|
|
d21f092645 | ||
|
|
9844803b26 | ||
|
|
2e0ace5026 | ||
|
|
b8725ffa22 | ||
|
|
d2da478923 | ||
|
|
0b3e557b65 | ||
|
|
0d2faa4573 | ||
|
|
1924810c17 | ||
|
|
6ab45a4cf0 | ||
|
|
5e2c94c31a | ||
|
|
c1a99921b0 | ||
|
|
4a0dbbce12 | ||
|
|
7398183d6f | ||
|
|
edf405c8fd | ||
|
|
4cc8f88a21 | ||
|
|
5dba7fdae0 | ||
|
|
e2b8573bd7 | ||
|
|
6eeb4c9d3a | ||
|
|
996981b102 | ||
|
|
4f4330c95e | ||
|
|
e48f54a863 | ||
|
|
2aa8ea4687 | ||
|
|
cde055e5bf | ||
|
|
19729db982 | ||
|
|
2029c9584e | ||
|
|
d9cbe60ca6 | ||
|
|
04337fdb68 | ||
|
|
a43b17716f | ||
|
|
63032ed0a6 | ||
|
|
b6cd6668a6 | ||
|
|
dee41e6120 | ||
|
|
7b03cb9b76 | ||
|
|
8aa83d4886 | ||
|
|
c17b3756ea | ||
|
|
73e339b05d | ||
|
|
42172c7395 | ||
|
|
fbc0b8dab5 | ||
|
|
91b45d2890 | ||
|
|
9df13c1cd2 | ||
|
|
5a3853a442 | ||
|
|
70e14a1757 | ||
|
|
4c4a93d9b5 | ||
|
|
001dcefd8a | ||
|
|
d114d547be | ||
|
|
6403e0ce44 | ||
|
|
41cf507746 | ||
|
|
c49fcf9018 | ||
|
|
354c39be6b | ||
|
|
26bbe8ade1 | ||
|
|
1952f0a1f7 | ||
|
|
61fdc0d375 | ||
|
|
4060b558c7 | ||
|
|
a783df39ba | ||
|
|
a9ccaf2ffb | ||
|
|
f40b08d826 | ||
|
|
9fd0397d45 | ||
|
|
69fb7170a7 | ||
|
|
b69546c229 | ||
|
|
45054eece9 | ||
|
|
785f7de25d | ||
|
|
509fb4ad23 | ||
|
|
6577519bd7 | ||
|
|
43948421d7 | ||
|
|
328650df17 | ||
|
|
b657ccd75a | ||
|
|
11cbb3d395 | ||
|
|
c21d7c3f5e | ||
|
|
975665c9c9 | ||
|
|
613e1052c7 | ||
|
|
ba9e7fa17f | ||
|
|
fa54bdd682 | ||
|
|
1678d02c87 | ||
|
|
5e535165a6 | ||
|
|
3de427b74f | ||
|
|
15899af7cf | ||
|
|
443181c719 | ||
|
|
02f96e2a1e | ||
|
|
67e0aa5488 | ||
|
|
c969005bcc | ||
|
|
5417d0953b | ||
|
|
ddb4865ceb | ||
|
|
7b5cac6d4f | ||
|
|
fb76f8ed80 | ||
|
|
4b572cf065 | ||
|
|
3e3fc76688 | ||
|
|
700b4d5d38 | ||
|
|
9e29d042b9 | ||
|
|
13f3ebca89 | ||
|
|
3e30632b8c | ||
|
|
a8d72bb226 | ||
|
|
bf3f7e0aef | ||
|
|
0fb04c576d | ||
|
|
caaa404d96 | ||
|
|
2fa6e6d031 | ||
|
|
62bb25b26d | ||
|
|
8d1402d37b | ||
|
|
afd657d6af | ||
|
|
27a5158147 | ||
|
|
dead7ab2ac | ||
|
|
352acff396 | ||
|
|
00d9c6921d | ||
|
|
6805940bbf | ||
|
|
954f9112e4 | ||
|
|
6465b9ade8 | ||
|
|
b67963176b | ||
|
|
fb1eb35ba5 | ||
|
|
047543a4a6 | ||
|
|
5e0615040d | ||
|
|
1ceed1519b | ||
|
|
a1a3adf8af | ||
|
|
620a693c11 | ||
|
|
4511af6f9e | ||
|
|
214e54f2ad | ||
|
|
2eefbe11ae | ||
|
|
74ea3d50c2 | ||
|
|
9a8159ab04 | ||
|
|
2f3aac29da | ||
|
|
9d7f5f593e | ||
|
|
2596273a94 | ||
|
|
210a8c2260 | ||
|
|
eaefaf8e59 | ||
|
|
7873e6f5aa | ||
|
|
251abf0545 | ||
|
|
b5c4b30ff6 | ||
|
|
eb941a0868 | ||
|
|
304ffe0049 | ||
|
|
88edbc7df8 | ||
|
|
6fa82ea73d | ||
|
|
92e7ff3de7 | ||
|
|
2739eb146a | ||
|
|
59ccc3021f | ||
|
|
36e9fa42f4 | ||
|
|
8111c50a5a | ||
|
|
0e5e7e940c | ||
|
|
9f75d34bb8 | ||
|
|
df42213daf | ||
|
|
b73caceb1f | ||
|
|
c91f28b6be | ||
|
|
078de4e422 | ||
|
|
332d5681e6 | ||
|
|
de1281dd9f | ||
|
|
f3849a1f57 | ||
|
|
3fd63b1b3d | ||
|
|
3a33220dad | ||
|
|
09a9deafc0 | ||
|
|
4de3470de5 | ||
|
|
f03d654862 | ||
|
|
b8a39c2f3d | ||
|
|
291b5dcec5 | ||
|
|
087f29c6c9 | ||
|
|
aac3ac579c | ||
|
|
c275f61aeb | ||
|
|
f297948216 | ||
|
|
dbe1386785 | ||
|
|
687f4aff13 | ||
|
|
dd4853bcc5 | ||
|
|
ffbfc13530 | ||
|
|
2aa160a98c | ||
|
|
477a3a8771 | ||
|
|
c0e8686297 | ||
|
|
01f18caf53 | ||
|
|
56971520a2 | ||
|
|
f5e38b1198 | ||
|
|
984ef2a089 | ||
|
|
ad960c73b6 | ||
|
|
0dcc631aa8 | ||
|
|
af9b670cfd | ||
|
|
519ae4d143 | ||
|
|
8d72869437 | ||
|
|
2cbacb532a | ||
|
|
1da2bf2f7a | ||
|
|
802bc7a5dc | ||
|
|
8875806c5d | ||
|
|
c9df807f1f | ||
|
|
3feef4e84b | ||
|
|
15001524bd | ||
|
|
c1713e7501 | ||
|
|
0181584735 | ||
|
|
df06e8dc41 | ||
|
|
b0ce077ace | ||
|
|
9d29d2e32c | ||
|
|
a29b438161 | ||
|
|
50a042bb16 | ||
|
|
f690015a88 | ||
|
|
342deb5a64 | ||
|
|
fdc480ff6e | ||
|
|
378b7cd4dd | ||
|
|
f779fc7a0e | ||
|
|
fe11f495d6 | ||
|
|
265876c849 | ||
|
|
c9c52518c0 | ||
|
|
96c9ac6f8b | ||
|
|
bdeb30a847 | ||
|
|
d67210155b | ||
|
|
ae92c50cee | ||
|
|
43429dc0ec | ||
|
|
04cf92a27f | ||
|
|
57a57f50f6 | ||
|
|
5e5a75e6c5 | ||
|
|
109c86aaf7 | ||
|
|
10e7e7727a | ||
|
|
a39775050a | ||
|
|
157c0264af | ||
|
|
9bacfdb390 | ||
|
|
f9aaf5c42e | ||
|
|
21db695e79 | ||
|
|
cf917f1093 | ||
|
|
a8d3a61c25 | ||
|
|
80f13a8149 | ||
|
|
e172f3a67f | ||
|
|
c382c0a9cc | ||
|
|
78b29fe967 | ||
|
|
81fa33abeb | ||
|
|
af7f87e19b | ||
|
|
3073b03d56 | ||
|
|
23dab0a013 | ||
|
|
fd68144ba2 | ||
|
|
51e92cd142 | ||
|
|
50f33f7196 | ||
|
|
1182d30fb9 | ||
|
|
095179eeb3 | ||
|
|
69b48eaadb | ||
|
|
4031c6f0d3 | ||
|
|
7a22f7dfc5 | ||
|
|
728ebf5023 | ||
|
|
62476d2f06 | ||
|
|
5fea428243 | ||
|
|
9a3c9ccbf3 | ||
|
|
ef4dfcecd6 | ||
|
|
5943382d23 | ||
|
|
1dcf347b87 | ||
|
|
47714007f7 | ||
|
|
54277572d2 | ||
|
|
52f2c0e107 | ||
|
|
59abc8cc20 | ||
|
|
e15796b348 | ||
|
|
1711eaa4d6 | ||
|
|
acbd6a5ca8 | ||
|
|
775090fdda | ||
|
|
0915b86927 | ||
|
|
c10f7b01f4 | ||
|
|
84142ac506 | ||
|
|
ff190847a1 | ||
|
|
3ceec28189 | ||
|
|
481038152f | ||
|
|
60bd72730d | ||
|
|
eabfd08473 | ||
|
|
a66af0ac58 | ||
|
|
15187e9d99 | ||
|
|
681e8f8b59 | ||
|
|
fbb406ca7d | ||
|
|
aacaf5055e | ||
|
|
a5dbddfd12 | ||
|
|
764a0df669 | ||
|
|
f04864c216 | ||
|
|
11a1b31a4c | ||
|
|
fb86a77cf8 | ||
|
|
d512357928 | ||
|
|
b850bc827e | ||
|
|
0229077293 | ||
|
|
23f2679bbe | ||
|
|
e6243b3df3 | ||
|
|
375b46d866 | ||
|
|
4577c8d57f | ||
|
|
24d1e9c3d2 | ||
|
|
f7a630d614 | ||
|
|
1c1cb11cf5 | ||
|
|
3ac8a6a21c | ||
|
|
c524c39867 | ||
|
|
e203edc12a | ||
|
|
5447baab00 | ||
|
|
904989f7f4 | ||
|
|
4846ccd86d | ||
|
|
0fd1c3182e | ||
|
|
7d80052dae | ||
|
|
b71ee48477 | ||
|
|
7a285dc55a | ||
|
|
a0f3a4d9bb | ||
|
|
304090d39f | ||
|
|
510f51d934 | ||
|
|
47c9fd67e2 | ||
|
|
1f403fdae0 | ||
|
|
1a3cee9da9 | ||
|
|
3acfd6fc78 | ||
|
|
83a9bb3a6f | ||
|
|
0744876327 | ||
|
|
8b92519113 | ||
|
|
1980107925 | ||
|
|
409a84be1f | ||
|
|
b2fef7988e | ||
|
|
82623c8fd4 | ||
|
|
552a3ab103 | ||
|
|
52c376a8a7 | ||
|
|
dd3b7ca65c | ||
|
|
9776a38d48 | ||
|
|
ceeccde92c | ||
|
|
1a8550e8e0 | ||
|
|
2feb0ad325 | ||
|
|
7f2c9c2326 | ||
|
|
9e5f4be85d | ||
|
|
b5874af40b | ||
|
|
cc70b827a8 | ||
|
|
9ff195ce19 | ||
|
|
8e7aaaa662 | ||
|
|
77a744b20b | ||
|
|
51fd1ef645 | ||
|
|
3500cc693d | ||
|
|
807b9882c5 | ||
|
|
b2920a68fb | ||
|
|
f4ef283908 | ||
|
|
09a38f4e43 | ||
|
|
04acd1885a | ||
|
|
d9fde833b4 | ||
|
|
378ba4e1df | ||
|
|
4522ce342b | ||
|
|
04402ed412 | ||
|
|
dc3cf5df49 | ||
|
|
9261769c5a | ||
|
|
f5e74f8d5a | ||
|
|
e87c140255 | ||
|
|
00d36110d5 | ||
|
|
c11364b89f | ||
|
|
89f8b8663c | ||
|
|
6734cdd923 | ||
|
|
3bf4ff78d9 | ||
|
|
b52cef2fd0 | ||
|
|
66747e69c5 | ||
|
|
4085336db5 | ||
|
|
c666a79d12 | ||
|
|
22a464f76f | ||
|
|
60e88a6069 | ||
|
|
ff3a9a46cc | ||
|
|
8c53ad0906 | ||
|
|
93cc32f34d | ||
|
|
dd764d2c3f | ||
|
|
5a7ae8f1c7 | ||
|
|
4ed5085422 | ||
|
|
0e574f3fce | ||
|
|
dcfc27857f | ||
|
|
b04c398202 | ||
|
|
fe8e1d0734 | ||
|
|
9f5d6e79da | ||
|
|
9b06ab6084 | ||
|
|
76d4fc08f1 | ||
|
|
90548a148b | ||
|
|
270bbe4218 | ||
|
|
3f26c8b893 | ||
|
|
9cea332f61 | ||
|
|
93ce14659a | ||
|
|
2d49b36b3e | ||
|
|
ab9d132964 | ||
|
|
b30e4f9a4b | ||
|
|
22afc3a93b | ||
|
|
8aba6f0dcd | ||
|
|
97cee30383 | ||
|
|
7f4832706b | ||
|
|
5f16fe45b1 | ||
|
|
8c8e0ce8a3 | ||
|
|
1b9dea5b75 | ||
|
|
7ed073ec3f | ||
|
|
e2c5bb025b | ||
|
|
a86077e9fe | ||
|
|
cd903b412f | ||
|
|
dd914066f3 | ||
|
|
7af07a1c0f | ||
|
|
b980d0a7fd | ||
|
|
5f10ab56bc | ||
|
|
383da5f661 | ||
|
|
8f0591c9a6 | ||
|
|
afb0ceac57 | ||
|
|
fc2660eb39 | ||
|
|
1b8f4b97dd | ||
|
|
3671469046 | ||
|
|
53d4fa3095 | ||
|
|
94999e55e1 | ||
|
|
ba9415b514 | ||
|
|
abb6ae304c | ||
|
|
885a69710e | ||
|
|
e7bebcdea9 | ||
|
|
5ef234153d | ||
|
|
bbee5599f1 | ||
|
|
a4212d5ace | ||
|
|
6d0e719e06 | ||
|
|
3fa9b08a52 | ||
|
|
4b1a451804 | ||
|
|
f9d7d60f7d | ||
|
|
aaf9d95411 | ||
|
|
90d1ebefae | ||
|
|
a7e4a759e9 | ||
|
|
283992088f | ||
|
|
75c9ee5982 | ||
|
|
4d88ff116c | ||
|
|
cf3cc37392 | ||
|
|
f804c9e346 | ||
|
|
4e33e9c3d1 | ||
|
|
18ac9fd0cc | ||
|
|
d0f28a48a8 | ||
|
|
706780e3a6 | ||
|
|
b5f9c66503 | ||
|
|
41f34b8d55 | ||
|
|
04731b937a | ||
|
|
7278e5b5ba | ||
|
|
891184bc77 | ||
|
|
3d51f9ab23 | ||
|
|
35c0092b84 | ||
|
|
d249f70750 | ||
|
|
0dc25cd2a8 | ||
|
|
91b5cc4bea | ||
|
|
af6f19e390 | ||
|
|
47446e6cfd | ||
|
|
8fada7d6c7 | ||
|
|
8a81486f5d | ||
|
|
e483699fba | ||
|
|
ae40a12f54 | ||
|
|
73d4279f00 | ||
|
|
a0e2f722f6 | ||
|
|
5c0da86e04 | ||
|
|
37d8f96927 | ||
|
|
e9e3ce78ca | ||
|
|
2dadad1e87 | ||
|
|
8c36e6d95f | ||
|
|
2b6d99f5e7 | ||
|
|
6f29358cb6 | ||
|
|
4e9dcb45ea | ||
|
|
282b6f72c1 | ||
|
|
cd48be5265 | ||
|
|
3cba26a4c5 | ||
|
|
dd2119268b | ||
|
|
5e51ff78d9 | ||
|
|
6bf27c7356 | ||
|
|
3abd4fdf09 | ||
|
|
432434e7e9 | ||
|
|
ba68ea89cd | ||
|
|
26661375ae | ||
|
|
f45b7626eb | ||
|
|
2aa21e2a43 | ||
|
|
ad876b91e7 | ||
|
|
73514f6c91 | ||
|
|
385a05d197 | ||
|
|
306f6e1ca3 | ||
|
|
41baa7bcf0 | ||
|
|
694204d54a | ||
|
|
85bc1c1758 | ||
|
|
0c9cb72e53 | ||
|
|
d113c0f01f | ||
|
|
98b8871f34 | ||
|
|
7cb16afcb5 | ||
|
|
1a79e5463f | ||
|
|
fd444b2fd0 | ||
|
|
15db005dc6 | ||
|
|
a26b05bbbb | ||
|
|
12b9ee46b9 | ||
|
|
ce1eb83a0e | ||
|
|
27529730ca | ||
|
|
7b398c01f6 | ||
|
|
cdb0bb9490 | ||
|
|
ee82f76846 | ||
|
|
b77a23ff9d | ||
|
|
0d8cdab4e4 | ||
|
|
67b53d0115 | ||
|
|
c3291d0137 | ||
|
|
7f2ebd25bc | ||
|
|
fc32fa3a78 | ||
|
|
a3cf2ee61a | ||
|
|
cc287386aa | ||
|
|
9ea1dbad93 | ||
|
|
4a849c7caf | ||
|
|
a77a9ade29 | ||
|
|
090d23434c | ||
|
|
83850c8201 | ||
|
|
d306bfe147 | ||
|
|
adfc4a5b0c | ||
|
|
6b249bde4b | ||
|
|
1036759f39 | ||
|
|
302c07048c | ||
|
|
2686b0bbac | ||
|
|
cece128bb9 | ||
|
|
3e5471d32a | ||
|
|
272f786f35 | ||
|
|
0dd04f6e73 | ||
|
|
a5221fc816 | ||
|
|
29f6616cee | ||
|
|
0d08402004 | ||
|
|
64c2ab7048 | ||
|
|
26a54ba86a | ||
|
|
32b3f16573 | ||
|
|
4080a0a5d5 | ||
|
|
17d67f2a39 | ||
|
|
9c20efd235 | ||
|
|
b46833680d | ||
|
|
4bcd862c0e | ||
|
|
c414ba9b2f | ||
|
|
27a070c8f9 | ||
|
|
c8aea02d7d | ||
|
|
46ff9a433c | ||
|
|
c135b4aa19 | ||
|
|
89d5f4a418 | ||
|
|
003fe86ffb | ||
|
|
94c250a241 | ||
|
|
f1a69c8c36 | ||
|
|
2bd8faaef5 | ||
|
|
94a25452e8 | ||
|
|
505cb39e1c | ||
|
|
127dd8f675 | ||
|
|
fc5837b1b6 | ||
|
|
46e3d10e62 | ||
|
|
64c5dc63ab | ||
|
|
31adb1213e | ||
|
|
0344de57e9 | ||
|
|
750252b297 | ||
|
|
4f28734042 | ||
|
|
4289c03ce5 | ||
|
|
bdbc85773c | ||
|
|
0a2fa36d5a | ||
|
|
0c244bc2ac | ||
|
|
67a49e5770 | ||
|
|
a98395bee7 | ||
|
|
26c9732b4e | ||
|
|
62787de97b | ||
|
|
830c379958 | ||
|
|
1a24de8735 | ||
|
|
121489f2af | ||
|
|
0e7295a469 | ||
|
|
602b3d0796 | ||
|
|
fda06fe8a0 | ||
|
|
92628ade8e | ||
|
|
b399d64024 | ||
|
|
a8e8c04c7b | ||
|
|
313b9944fd | ||
|
|
5a61d28eee | ||
|
|
4eb0937d21 | ||
|
|
a082e94235 | ||
|
|
9bd3684893 | ||
|
|
0cd9fd9ad9 | ||
|
|
efcc690f42 | ||
|
|
1ed1a5efb6 | ||
|
|
2d7de6ecc0 | ||
|
|
4a1edc4281 | ||
|
|
d6b32e5923 | ||
|
|
105ae8abb6 | ||
|
|
1f33dad675 | ||
|
|
90ee59512b | ||
|
|
7f2a189641 | ||
|
|
1ab59ca35a | ||
|
|
5c0826963e | ||
|
|
7555fe6196 | ||
|
|
1dbb9c7ded | ||
|
|
ac798c1350 | ||
|
|
00682bd911 | ||
|
|
ceced43e93 | ||
|
|
55fdc47e66 | ||
|
|
53a92451e6 | ||
|
|
77016f34a5 | ||
|
|
19db911d46 | ||
|
|
46a88c7ed8 | ||
|
|
ca3b841974 | ||
|
|
e9ff2157bc | ||
|
|
d270c42109 | ||
|
|
f4558fee1d | ||
|
|
86461663d8 | ||
|
|
fcca62ec6a | ||
|
|
f6dde81a16 | ||
|
|
d77e66d1e8 | ||
|
|
702f906d49 | ||
|
|
2f257b54e7 | ||
|
|
c1b9e47a90 | ||
|
|
a93e10308c | ||
|
|
204fc0359c | ||
|
|
eb483281dc | ||
|
|
b841709729 | ||
|
|
6307fb3563 | ||
|
|
35b3542b2e | ||
|
|
0fa5ca9a6a | ||
|
|
36285f2ca5 | ||
|
|
9e19a1aca4 | ||
|
|
19c7949cc4 | ||
|
|
36d7f6ff94 | ||
|
|
e7b90f9c12 | ||
|
|
8bd499c60c | ||
|
|
0d61d47f28 | ||
|
|
4b5dc5b3af | ||
|
|
61bf472426 | ||
|
|
ef6199a792 | ||
|
|
7bd0b45a2b | ||
|
|
eb0c346969 | ||
|
|
bf2938f345 | ||
|
|
c7e4116154 | ||
|
|
db521e0e5e | ||
|
|
a219629ead | ||
|
|
ba10393f48 | ||
|
|
091e399d0f | ||
|
|
5de6779d72 | ||
|
|
4b3a983b23 | ||
|
|
1b53e78ea7 | ||
|
|
ef08323b25 | ||
|
|
24c6917267 | ||
|
|
9ab25fa19e | ||
|
|
d5f785ff41 | ||
|
|
f2a8e2aef7 | ||
|
|
7bdd1fe096 | ||
|
|
f677eef422 | ||
|
|
70f3824b14 | ||
|
|
11b980832c | ||
|
|
300e853646 | ||
|
|
a403279fa6 | ||
|
|
8f6f831d5b | ||
|
|
599077b54c | ||
|
|
9b7414b60c | ||
|
|
78430858fe | ||
|
|
fe8528a963 | ||
|
|
f365cb965b | ||
|
|
2b38cf4c65 | ||
|
|
2e9080a179 | ||
|
|
0a50ee989e | ||
|
|
c9c9103ede | ||
|
|
1ce9e96490 | ||
|
|
1f9c802e10 | ||
|
|
c6fda8385a | ||
|
|
d0664bc119 | ||
|
|
e7ed85ec94 | ||
|
|
5d1d4ff4d6 | ||
|
|
57040ebb22 | ||
|
|
03b018e7f3 | ||
|
|
04ada346b0 | ||
|
|
f53c7723fb | ||
|
|
0a6a74c78c | ||
|
|
b40982d579 | ||
|
|
2605633e1e | ||
|
|
2f7e873137 | ||
|
|
bb9e23519d | ||
|
|
acfae2882d | ||
|
|
180eb61620 | ||
|
|
a92bb87cd8 | ||
|
|
2c967b821b | ||
|
|
abe9a9731d | ||
|
|
2837a48001 | ||
|
|
4aef84342d | ||
|
|
9be6153875 | ||
|
|
444640afb7 | ||
|
|
122908587b | ||
|
|
c1654537e2 | ||
|
|
984a172cec | ||
|
|
ee2767875c | ||
|
|
fa0a41e62e | ||
|
|
edaf718281 | ||
|
|
7cd5963d3a | ||
|
|
60f5512c5f | ||
|
|
d1b9a1b996 | ||
|
|
1bd91e7e94 | ||
|
|
5e2f73c74e | ||
|
|
4a269e37c5 | ||
|
|
3eceaf20a2 | ||
|
|
bbc4f4f21d | ||
|
|
c5ef1d6252 | ||
|
|
a4280881d5 | ||
|
|
8ef4c54712 | ||
|
|
5ebc8c3e1a | ||
|
|
cbcb3e95c6 | ||
|
|
02a8cffb18 | ||
|
|
d53f7ecd6a | ||
|
|
e297f65d8c | ||
|
|
5356f65040 | ||
|
|
5056abc357 | ||
|
|
46029acd14 | ||
|
|
28e414c9a5 | ||
|
|
29c036d826 | ||
|
|
831a6d9480 | ||
|
|
fb2a95470a | ||
|
|
4d73583f86 | ||
|
|
9a24c4001f | ||
|
|
4c9ae9dd91 | ||
|
|
384d6921f6 | ||
|
|
e0a8284fcf | ||
|
|
eafbf699a2 | ||
|
|
4d3f10477a | ||
|
|
9a83805f19 | ||
|
|
6fcc2b579d | ||
|
|
e04a3d7d3a | ||
|
|
be61ea2dc8 | ||
|
|
c594d6a07e | ||
|
|
ee7feff9cc | ||
|
|
02ce911405 | ||
|
|
f12ee8f54c | ||
|
|
81a98c6769 | ||
|
|
e3f626934f | ||
|
|
94ff2ea6b1 | ||
|
|
cc6201b0db | ||
|
|
d079df9ce5 | ||
|
|
6a2c944bbd | ||
|
|
266fea5e6c | ||
|
|
6da3f85362 | ||
|
|
1d58892fed | ||
|
|
ff1b6d28a8 | ||
|
|
ff935e05f2 | ||
|
|
d378f5e4bb | ||
|
|
44eee6550c | ||
|
|
260b8fb672 | ||
|
|
2f240acc43 | ||
|
|
189b528b3d | ||
|
|
2b265d54a1 | ||
|
|
c61d67301f | ||
|
|
5f3d8096f3 | ||
|
|
6e5b05d0b5 | ||
|
|
6bbae681ef | ||
|
|
097fac4cca | ||
|
|
97515b0d7d | ||
|
|
3500101816 | ||
|
|
1cebf51672 | ||
|
|
3b59dff577 | ||
|
|
cd01ad06fd | ||
|
|
331332fab0 | ||
|
|
f3572876a1 | ||
|
|
c827004821 | ||
|
|
786eee4eb9 | ||
|
|
92d2de5279 | ||
|
|
f4070f3fb5 | ||
|
|
856a6567a1 | ||
|
|
363edb1427 | ||
|
|
c209232950 | ||
|
|
3f9120b129 | ||
|
|
b1f0f905e5 | ||
|
|
c71c7c70d4 | ||
|
|
613ae56cc1 | ||
|
|
6607002939 | ||
|
|
2e40bb46e7 | ||
|
|
720288c420 | ||
|
|
97651a0ff4 | ||
|
|
3125c44ce1 | ||
|
|
d909b38d57 | ||
|
|
5572ef8574 | ||
|
|
3c4192bd0e | ||
|
|
3fc9dc3684 | ||
|
|
a06e01a196 | ||
|
|
034b6892f4 | ||
|
|
bd8ea711fd | ||
|
|
c1347e55cb | ||
|
|
afbd6e6606 | ||
|
|
d6c5cb7778 | ||
|
|
43d47745dd | ||
|
|
f0d99070e4 | ||
|
|
6a49d67c6c | ||
|
|
6b7c1b21cb | ||
|
|
b7d1b4ca1a | ||
|
|
8a04d5761b | ||
|
|
8d8729be8e | ||
|
|
d4325de47d | ||
|
|
e29c76465b | ||
|
|
a220407aef | ||
|
|
4df214003e | ||
|
|
182250b9c0 | ||
|
|
59a6758fce | ||
|
|
73aa996444 | ||
|
|
08769ec35e | ||
|
|
3aa18eafb3 | ||
|
|
8d4a0e5aa9 | ||
|
|
e8183d09c2 | ||
|
|
5f1da1dfc0 | ||
|
|
c1c5776439 | ||
|
|
da418fc7f2 | ||
|
|
fcaae825b7 | ||
|
|
f5ee074674 | ||
|
|
0c787b94b8 | ||
|
|
02f5f07db0 | ||
|
|
a97591a193 | ||
|
|
80485bf520 | ||
|
|
401bd8ce73 | ||
|
|
c23a7343d4 | ||
|
|
75a24ee41f | ||
|
|
7e9a69df64 | ||
|
|
12bf8d9659 | ||
|
|
d1c8d42bd2 | ||
|
|
c0fe2d1c09 | ||
|
|
812f0d577b | ||
|
|
4a25ba1111 | ||
|
|
0b4f3f76fc | ||
|
|
e7e19a88e6 | ||
|
|
4295eaa311 | ||
|
|
43e78f7a93 | ||
|
|
0a305a710a | ||
|
|
ef45d695d0 | ||
|
|
ac50cb69f7 | ||
|
|
9fc6e398c6 | ||
|
|
e06b948343 | ||
|
|
28ca9df5a0 | ||
|
|
c66915209e | ||
|
|
cb4ffe39f4 | ||
|
|
e07f91ce8b | ||
|
|
03fcbfea62 | ||
|
|
f9d05a879a | ||
|
|
7a8dd52c4c | ||
|
|
ef48cad322 | ||
|
|
c39d692757 | ||
|
|
4c1d8f310a | ||
|
|
1e1542fe16 | ||
|
|
647ac34c8c | ||
|
|
ea34691625 | ||
|
|
4557255ce1 | ||
|
|
4cb951461b | ||
|
|
750dcbb9d8 | ||
|
|
459f70f7b4 | ||
|
|
61748fa7dc | ||
|
|
a36d432b88 | ||
|
|
b3f43eea13 | ||
|
|
df3c7e2c1c | ||
|
|
cbc4c75a7e | ||
|
|
e068d8b698 | ||
|
|
06e9a3d31f | ||
|
|
e5ac49f86d | ||
|
|
7fdc63b6ae | ||
|
|
808abdb6d7 | ||
|
|
037982a0ef | ||
|
|
5f86233218 | ||
|
|
8bd73a44c9 | ||
|
|
f1984b19cc | ||
|
|
c2330fe55a | ||
|
|
dc56408d5f | ||
|
|
f5adbbddb8 | ||
|
|
036bfa9b20 | ||
|
|
2d9064d2bf | ||
|
|
6f948c101f | ||
|
|
9c123a59ab | ||
|
|
4006018907 | ||
|
|
02c1e1dc60 | ||
|
|
03d74f1313 | ||
|
|
4f2460a23c | ||
|
|
f68dbe1902 | ||
|
|
d589634968 | ||
|
|
9914eb84a4 | ||
|
|
0a6886e43b | ||
|
|
bcd4b65f7d | ||
|
|
820717df0e | ||
|
|
6178ba4a6b | ||
|
|
6f14c1fa91 | ||
|
|
6a94c77b1e | ||
|
|
c3d6c853ab | ||
|
|
9575a7453e | ||
|
|
cfd9689444 | ||
|
|
c819265597 | ||
|
|
0427787cb7 | ||
|
|
e372cc25f2 | ||
|
|
b98d9dcff3 | ||
|
|
91b08705da | ||
|
|
503abb3c94 | ||
|
|
4b8d98af8c | ||
|
|
ced6c3de1f | ||
|
|
f8ced1170e | ||
|
|
a166fcdcdf | ||
|
|
faac96730a | ||
|
|
4929f11793 | ||
|
|
b1d877e7db | ||
|
|
3f09e62f23 | ||
|
|
03bc9926dd | ||
|
|
e64e8927ce | ||
|
|
0643b9e7dd | ||
|
|
032ce5ff83 | ||
|
|
623833a5d6 | ||
|
|
f7eb55f2f5 | ||
|
|
b095e65e28 | ||
|
|
98fd95440f | ||
|
|
5f00e715ea | ||
|
|
64187ebe8a | ||
|
|
1ab127ff03 | ||
|
|
3c09d8784a | ||
|
|
31ec6550ec | ||
|
|
24b88219fa | ||
|
|
5c437d9163 | ||
|
|
09bda8a1dc | ||
|
|
f76084213c | ||
|
|
b8ed546555 | ||
|
|
9553786cd5 | ||
|
|
7ef79ad626 | ||
|
|
0ac2fe02dc | ||
|
|
c994ab9f60 | ||
|
|
600600b9af | ||
|
|
1b870a55e2 | ||
|
|
965e845133 | ||
|
|
7107afbf0f | ||
|
|
cbb809e535 | ||
|
|
c5169a431b | ||
|
|
6b798ec274 | ||
|
|
1cde9b326c | ||
|
|
4b9ab66ce7 | ||
|
|
ba7ebf5ea6 | ||
|
|
afdc3d068c | ||
|
|
941e81b3aa | ||
|
|
de7075ff8f | ||
|
|
5deed8dc5a | ||
|
|
93f0d0576d | ||
|
|
ec339b0282 | ||
|
|
a67505bbe2 | ||
|
|
8fd1cefcdf | ||
|
|
03f7ac6ef4 | ||
|
|
274e227f49 | ||
|
|
9302a2e711 | ||
|
|
ee9d87b543 | ||
|
|
391cf2487a | ||
|
|
914503a30e | ||
|
|
17b8717557 | ||
|
|
4f49cdbd1e | ||
|
|
24c5cbac68 | ||
|
|
befc1de389 | ||
|
|
45522f24c9 | ||
|
|
1bd0bb9b81 | ||
|
|
4229610f05 | ||
|
|
c062cd9914 | ||
|
|
449a5907d1 | ||
|
|
9130ef5451 | ||
|
|
82fcb656d9 | ||
|
|
a139d7fc01 | ||
|
|
3242fbaf20 | ||
|
|
037a783e07 | ||
|
|
8c714d5a1f | ||
|
|
3fbc4f2915 | ||
|
|
e29bfc2c86 | ||
|
|
8a34f3c289 | ||
|
|
951802dd73 | ||
|
|
b95d91a65e | ||
|
|
fe94f935f1 | ||
|
|
6b529bb231 | ||
|
|
c2fabbf9d9 | ||
|
|
7d604cd05b | ||
|
|
57f1932744 | ||
|
|
891fb65daa | ||
|
|
f35be05e76 | ||
|
|
bd4a207b37 | ||
|
|
e19dff18c3 | ||
|
|
deee5d2815 | ||
|
|
53f5fd91b7 | ||
|
|
0969cec45d | ||
|
|
ded542a543 | ||
|
|
385a17b8a5 | ||
|
|
0a0588aec8 | ||
|
|
9af62251b6 | ||
|
|
819878a1da | ||
|
|
e7364cdcb3 | ||
|
|
e5bfe81d0c | ||
|
|
c4eb790065 | ||
|
|
ac56efcd95 | ||
|
|
9fcb8ccb9e | ||
|
|
67a936d845 | ||
|
|
d11f3f7d5a | ||
|
|
625c4d8968 | ||
|
|
239b933d5e | ||
|
|
3161f6a8f1 | ||
|
|
d2bff95c90 | ||
|
|
a0e7c26a63 | ||
|
|
5bfa9633d2 | ||
|
|
ff5ecb17ea | ||
|
|
83ba56d3e7 | ||
|
|
2d398c2398 | ||
|
|
cf070c6bc7 | ||
|
|
3c577b6191 | ||
|
|
acb2da7759 | ||
|
|
a0c2edd1a2 | ||
|
|
ad555d897d | ||
|
|
4a6e62070b | ||
|
|
0c081d4295 | ||
|
|
04ff2fb806 | ||
|
|
4fb9ee4470 | ||
|
|
3d2734b163 | ||
|
|
c4a12fe48a | ||
|
|
40b8667aef | ||
|
|
cb9578327b | ||
|
|
7b0a8cf2c2 | ||
|
|
4197afba49 | ||
|
|
495fb14b9c | ||
|
|
4de1b0de2d | ||
|
|
abcf4010dd | ||
|
|
65928612b1 | ||
|
|
a33c85bdd4 | ||
|
|
3ec3f222c5 | ||
|
|
e9a43e7344 | ||
|
|
fc835aebc6 | ||
|
|
a3504bd9b6 | ||
|
|
7c604623e6 | ||
|
|
3d3f19aa71 | ||
|
|
00f4b45df6 | ||
|
|
07140cf2fa | ||
|
|
28acd0fa6a | ||
|
|
0b91f3d785 | ||
|
|
1bb18f5f0a | ||
|
|
2e1d88caae | ||
|
|
a59f4dd3fc | ||
|
|
46b356cb2c | ||
|
|
a20ae75d11 | ||
|
|
8d78b1f2e1 | ||
|
|
9030abaa89 | ||
|
|
e8b16d600e | ||
|
|
24121a4734 | ||
|
|
6eabe0491c | ||
|
|
20b0972130 | ||
|
|
98da09b247 | ||
|
|
cc13420e31 | ||
|
|
fd55da0319 | ||
|
|
240d9d0919 | ||
|
|
41634a301e | ||
|
|
cf75b11cba | ||
|
|
81bba4644a | ||
|
|
f7e92b0ee3 | ||
|
|
1e58fd4842 | ||
|
|
fa7ad8d867 | ||
|
|
eb40fa753f | ||
|
|
dc36b228d6 | ||
|
|
11e3eff009 | ||
|
|
52abe75cfd | ||
|
|
8065d18f54 | ||
|
|
1b3684933d | ||
|
|
e657921b5a | ||
|
|
91ce5c785b | ||
|
|
676b0542c4 | ||
|
|
dced766999 | ||
|
|
eb0b5d16bf | ||
|
|
2845f37ac7 | ||
|
|
922ce83f48 | ||
|
|
7445d80202 | ||
|
|
4d6f3ad392 | ||
|
|
c4ac8a9f06 | ||
|
|
b554a68186 | ||
|
|
b7ad20249d | ||
|
|
65f4b600bc | ||
|
|
03945b88c8 | ||
|
|
24583332a2 | ||
|
|
ce26801a91 | ||
|
|
7fd5b65f3b | ||
|
|
61b1542468 | ||
|
|
d740378277 | ||
|
|
0815adf722 | ||
|
|
ef1eacf22e | ||
|
|
fc896f81f0 | ||
|
|
884d5c1b87 | ||
|
|
627186abc8 | ||
|
|
30b0f39a36 | ||
|
|
c3c2a732cd | ||
|
|
5cc8ebd3e1 | ||
|
|
9ceb3b016c | ||
|
|
76e18475d3 | ||
|
|
2964e99175 | ||
|
|
1189c9e294 | ||
|
|
50799f3760 | ||
|
|
4b580b6eb1 | ||
|
|
8d6e794486 | ||
|
|
7fa2053c55 | ||
|
|
cb7f81ccd6 | ||
|
|
6227496478 | ||
|
|
74aa7d3c87 | ||
|
|
bc107e7def | ||
|
|
09e05ae00d | ||
|
|
1921536f90 | ||
|
|
1a9334e818 | ||
|
|
bc6acd5c5a | ||
|
|
3a15756c78 | ||
|
|
f1fd96983b |
@@ -4,6 +4,8 @@ about: Create a report to help us improve
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
⚠️ **Issues not using this template will be systematically closed.**
|
||||||
|
|
||||||
**Describe the bug**
|
**Describe the bug**
|
||||||
A clear and concise description of what the bug is.
|
A clear and concise description of what the bug is.
|
||||||
|
|
||||||
@@ -17,6 +19,10 @@ A clear and concise description of what you expected to happen.
|
|||||||
**Screenshots**
|
**Screenshots**
|
||||||
If applicable, add screenshots to help explain your problem.
|
If applicable, add screenshots to help explain your problem.
|
||||||
|
|
||||||
|
**Logs**
|
||||||
|
If applicable, copy **full** logs from your console here. Please *do not*
|
||||||
|
use screenshots of logs, copy them as text, use gist or attach an *uncompressed* file.
|
||||||
|
|
||||||
**Desktop (please complete the following information):**
|
**Desktop (please complete the following information):**
|
||||||
- OS: [e.g. iOS]
|
- OS: [e.g. iOS]
|
||||||
- GPU: [e.g. NVIDIA GTX 1080]
|
- GPU: [e.g. NVIDIA GTX 1080]
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
FROM python:3.10.4
|
||||||
|
|
||||||
|
RUN pip3 install pygithub==1.55
|
||||||
|
|
||||||
|
ENV PYTHONUNBUFFERED=1
|
||||||
|
|
||||||
|
COPY verify_release_notes.py /verify_release_notes.py
|
||||||
|
|
||||||
|
RUN chmod +x /verify_release_notes.py
|
||||||
|
ENTRYPOINT [ "/verify_release_notes.py" ]
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
name: 'Verify Release Notes'
|
||||||
|
description: 'Verifies that a RELEASE_NOTES file has been modified'
|
||||||
|
inputs:
|
||||||
|
repo-token:
|
||||||
|
description: 'The GitHub token'
|
||||||
|
required: true
|
||||||
|
pull-request-number:
|
||||||
|
description: 'The Pull Request number'
|
||||||
|
required: true
|
||||||
|
bypass-label-name:
|
||||||
|
description: 'The Label used to bypass this check'
|
||||||
|
required: false
|
||||||
|
default: 'internal'
|
||||||
|
release-notes-file:
|
||||||
|
description: 'The path to the RELEASE_NOTES file'
|
||||||
|
required: false
|
||||||
|
default: 'RELEASE_NOTES.md'
|
||||||
|
pull-request-repo-full-name:
|
||||||
|
description: 'The full name of the Pull Request repo'
|
||||||
|
required: false
|
||||||
|
default: ${{ github.event.pull_request.head.repo.full_name }}
|
||||||
|
pull-request-head-ref:
|
||||||
|
description: 'The HEAD ref of the Pull Request'
|
||||||
|
required: false
|
||||||
|
default: ${{ github.event.pull_request.head.ref }}
|
||||||
|
runs:
|
||||||
|
using: 'docker'
|
||||||
|
image: 'Dockerfile'
|
||||||
|
args:
|
||||||
|
- ${{ inputs.repo-token }}
|
||||||
|
- ${{ inputs.pull-request-number }}
|
||||||
|
- ${{ inputs.bypass-label-name }}
|
||||||
|
- ${{ inputs.release-notes-file }}
|
||||||
|
- ${{ inputs.pull-request-repo-full-name }}
|
||||||
|
- ${{ inputs.pull-request-head-ref }}
|
||||||
@@ -0,0 +1,100 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
# Copyright (C) 2022 The Android Open Source Project
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
from github import Github
|
||||||
|
import sys, os
|
||||||
|
|
||||||
|
def print_usage():
|
||||||
|
print('Verify that a GitHub pull request modifies a RELEASE_NOTES file')
|
||||||
|
print()
|
||||||
|
print('Usage:')
|
||||||
|
print(' verify_release_notes.py [arguments]')
|
||||||
|
print()
|
||||||
|
print('Arguments:')
|
||||||
|
print('1. github token')
|
||||||
|
print('2. pull request number')
|
||||||
|
print('3. bypass label name')
|
||||||
|
print('4. release notes file path')
|
||||||
|
print('5. pull request repo full name')
|
||||||
|
print('6. pull request head ref')
|
||||||
|
print()
|
||||||
|
print('The GITHUB_REPOSITORY environment variable must be set (e.g., google/filament).')
|
||||||
|
|
||||||
|
def leave_single_comment(pull_request, comment_body):
|
||||||
|
""" Leaves a comment on a PR once, without leaving a duplicate comment. """
|
||||||
|
# To avoid spamming the PR author, we'll use this comment tag (which will render invisibly on
|
||||||
|
# GitHub) to check if we've already left a comment on this PR.
|
||||||
|
COMMENT_TAG = '<!-- verify_release_notes -->\n'
|
||||||
|
comments = pull_request.get_issue_comments()
|
||||||
|
for comment in comments:
|
||||||
|
if comment.body.find(COMMENT_TAG) != -1:
|
||||||
|
return
|
||||||
|
# The GitHub token may not have WRITE permissions to leave a comment (for example, for 3P
|
||||||
|
# contributors). In that case, we simply won't leave a comment.
|
||||||
|
try:
|
||||||
|
pull_request.create_issue_comment(f'{COMMENT_TAG}{comment_body}')
|
||||||
|
except:
|
||||||
|
print("Unable to leave comment. Continuing.")
|
||||||
|
|
||||||
|
# The first argument is the path to this script.
|
||||||
|
if len(sys.argv) != 7:
|
||||||
|
print_usage()
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
authentication_token = sys.argv[1]
|
||||||
|
pull_number = sys.argv[2]
|
||||||
|
bypass_label_name = sys.argv[3]
|
||||||
|
release_notes_file = sys.argv[4]
|
||||||
|
pr_repo_full_name = sys.argv[5]
|
||||||
|
pr_head_ref = sys.argv[6]
|
||||||
|
|
||||||
|
g = Github(authentication_token)
|
||||||
|
|
||||||
|
repo_name = os.environ.get('GITHUB_REPOSITORY')
|
||||||
|
if repo_name is None:
|
||||||
|
print("The GITHUB_REPOSITORY environment variable must be set.")
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
repo = g.get_repo(repo_name)
|
||||||
|
|
||||||
|
pull_request = repo.get_pull(int(pull_number))
|
||||||
|
|
||||||
|
# First check if the PR has the "bypass" label. This label is used for PRs that don't need to update
|
||||||
|
# RELEASE_NOTES. If so, we can exit immediately.
|
||||||
|
labels = [l.name for l in pull_request.labels]
|
||||||
|
if bypass_label_name in labels:
|
||||||
|
print(f"PR number {pull_number} in repo {repo_name} contains the '{bypass_label_name}' label.")
|
||||||
|
print("Exiting with success.")
|
||||||
|
sys.exit(0)
|
||||||
|
|
||||||
|
# Next, check if the release notes file (RELEASE_NOTES.md or similar) has been modified.
|
||||||
|
files = pull_request.get_files()
|
||||||
|
for file in files:
|
||||||
|
if file.filename == release_notes_file:
|
||||||
|
print(f"PR number {pull_number} in repo {repo_name} modifies '{release_notes_file}'.")
|
||||||
|
print("Exiting with success.")
|
||||||
|
sys.exit(0)
|
||||||
|
|
||||||
|
# At this point, we issue a warning to the PR author to remember to modify the release notes, and
|
||||||
|
# exit with failure.
|
||||||
|
edit_url = f"https://github.com/{pr_repo_full_name}/edit/{pr_head_ref}/{release_notes_file}"
|
||||||
|
comment = (f"Please add a release note line to [{release_notes_file}]({edit_url}). "
|
||||||
|
f"If this PR does not warrant a release note, add the '{bypass_label_name}' label "
|
||||||
|
f"to this PR.")
|
||||||
|
print(comment)
|
||||||
|
leave_single_comment(pull_request, comment)
|
||||||
|
|
||||||
|
sys.exit(1)
|
||||||
@@ -13,7 +13,11 @@ jobs:
|
|||||||
runs-on: macos-latest
|
runs-on: macos-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2.0.0
|
- uses: actions/checkout@v3.3.0
|
||||||
|
- uses: actions/setup-java@v3
|
||||||
|
with:
|
||||||
|
distribution: 'temurin'
|
||||||
|
java-version: '17'
|
||||||
- name: Run build script
|
- name: Run build script
|
||||||
run: |
|
run: |
|
||||||
cd build/android && printf "y" | ./build.sh continuous
|
cd build/android && printf "y" | ./build.sh continuous
|
||||||
@@ -33,10 +37,6 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
name: gltfio-android-release
|
name: gltfio-android-release
|
||||||
path: out/gltfio-android-release.aar
|
path: out/gltfio-android-release.aar
|
||||||
- uses: actions/upload-artifact@v1.0.0
|
|
||||||
with:
|
|
||||||
name: gltfio-android-lite-release
|
|
||||||
path: out/gltfio-android-lite-release.aar
|
|
||||||
- uses: actions/upload-artifact@v1.0.0
|
- uses: actions/upload-artifact@v1.0.0
|
||||||
with:
|
with:
|
||||||
name: filament-utils-android-release
|
name: filament-utils-android-release
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ jobs:
|
|||||||
runs-on: macos-latest
|
runs-on: macos-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2.0.0
|
- uses: actions/checkout@v3.3.0
|
||||||
- name: Run build script
|
- name: Run build script
|
||||||
run: |
|
run: |
|
||||||
cd build/ios && printf "y" | ./build.sh continuous
|
cd build/ios && printf "y" | ./build.sh continuous
|
||||||
|
|||||||
@@ -10,10 +10,10 @@ on:
|
|||||||
jobs:
|
jobs:
|
||||||
build-linux:
|
build-linux:
|
||||||
name: build-linux
|
name: build-linux
|
||||||
runs-on: ubuntu-18.04
|
runs-on: ubuntu-22.04
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2.0.0
|
- uses: actions/checkout@v3.3.0
|
||||||
- name: Run build script
|
- name: Run build script
|
||||||
run: |
|
run: |
|
||||||
cd build/linux && printf "y" | ./build.sh continuous
|
cd build/linux && printf "y" | ./build.sh continuous
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ jobs:
|
|||||||
runs-on: macos-latest
|
runs-on: macos-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2.0.0
|
- uses: actions/checkout@v3.3.0
|
||||||
- name: Run build script
|
- name: Run build script
|
||||||
run: |
|
run: |
|
||||||
cd build/mac && printf "y" | ./build.sh continuous
|
cd build/mac && printf "y" | ./build.sh continuous
|
||||||
@@ -21,3 +21,6 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
name: filament-mac
|
name: filament-mac
|
||||||
path: out/filament-release-darwin.tgz
|
path: out/filament-release-darwin.tgz
|
||||||
|
- name: Check public headers
|
||||||
|
run: |
|
||||||
|
build/common/check-headers.sh out/release/filament/include
|
||||||
|
|||||||
@@ -1,6 +1,12 @@
|
|||||||
name: Presubmit
|
name: Presubmit
|
||||||
|
|
||||||
on: [pull_request]
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-desktop:
|
build-desktop:
|
||||||
@@ -9,10 +15,10 @@ jobs:
|
|||||||
|
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
os: [macos-latest, ubuntu-18.04]
|
os: [macos-latest, ubuntu-22.04]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2.0.0
|
- uses: actions/checkout@v3.3.0
|
||||||
- name: Run build script
|
- name: Run build script
|
||||||
run: |
|
run: |
|
||||||
WORKFLOW_OS=`echo \`uname\` | sed "s/Darwin/mac/" | tr [:upper:] [:lower:]`
|
WORKFLOW_OS=`echo \`uname\` | sed "s/Darwin/mac/" | tr [:upper:] [:lower:]`
|
||||||
@@ -23,10 +29,10 @@ jobs:
|
|||||||
|
|
||||||
build-windows:
|
build-windows:
|
||||||
name: build-windows
|
name: build-windows
|
||||||
runs-on: windows-latest
|
runs-on: windows-2019
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2.0.0
|
- uses: actions/checkout@v3.3.0
|
||||||
- name: Run build script
|
- name: Run build script
|
||||||
run: |
|
run: |
|
||||||
build\windows\build-github.bat presubmit
|
build\windows\build-github.bat presubmit
|
||||||
@@ -37,7 +43,11 @@ jobs:
|
|||||||
runs-on: macos-latest
|
runs-on: macos-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2.0.0
|
- uses: actions/checkout@v3.3.0
|
||||||
|
- uses: actions/setup-java@v3
|
||||||
|
with:
|
||||||
|
distribution: 'temurin'
|
||||||
|
java-version: '17'
|
||||||
- name: Run build script
|
- name: Run build script
|
||||||
run: |
|
run: |
|
||||||
cd build/android && printf "y" | ./build.sh presubmit
|
cd build/android && printf "y" | ./build.sh presubmit
|
||||||
@@ -47,7 +57,7 @@ jobs:
|
|||||||
runs-on: macos-latest
|
runs-on: macos-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2.0.0
|
- uses: actions/checkout@v3.3.0
|
||||||
- name: Run build script
|
- name: Run build script
|
||||||
run: |
|
run: |
|
||||||
cd build/ios && printf "y" | ./build.sh presubmit
|
cd build/ios && printf "y" | ./build.sh presubmit
|
||||||
@@ -60,7 +70,7 @@ jobs:
|
|||||||
runs-on: macos-latest
|
runs-on: macos-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2.0.0
|
- uses: actions/checkout@v3.3.0
|
||||||
- name: Run build script
|
- name: Run build script
|
||||||
run: |
|
run: |
|
||||||
cd build/web && printf "y" | ./build.sh presubmit
|
cd build/web && printf "y" | ./build.sh presubmit
|
||||||
|
|||||||
+115
-68
@@ -1,14 +1,25 @@
|
|||||||
name: Release
|
name: Release
|
||||||
|
|
||||||
# This Workflow can be triggered two ways:
|
# This Workflow can be triggered two ways:
|
||||||
# 1. A GitHub release is created (using the GitHub web UI). This triggers all of the platforms to build and upload assets.
|
# 1. A GitHub release is created (using the GitHub web UI). This triggers all of the platforms to
|
||||||
# 2. A repository_dispatch API event is sent. This triggers a build for only the platform specified in the dispatch event.
|
# build and upload assets.
|
||||||
|
# 2. A workflow_dispatch event is triggered from the GitHub web UI. This triggers a build for only
|
||||||
|
# the platform specified in the dispatch event.
|
||||||
|
|
||||||
env:
|
env:
|
||||||
RELEASE_TAG: ${{ github.event.client_payload.release_tag }}
|
RELEASE_TAG: ${{ github.event.inputs.release_tag }}
|
||||||
|
|
||||||
on:
|
on:
|
||||||
repository_dispatch:
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
platform:
|
||||||
|
description: 'Platform to build (desktop, web, android, ios, windows)'
|
||||||
|
required: true
|
||||||
|
default: 'desktop'
|
||||||
|
release_tag:
|
||||||
|
description: 'Release tag to build (e.g., v1.13.0)'
|
||||||
|
required: true
|
||||||
|
default: 'v1.13.0'
|
||||||
release:
|
release:
|
||||||
types: [created]
|
types: [created]
|
||||||
|
|
||||||
@@ -16,11 +27,11 @@ jobs:
|
|||||||
build-desktop:
|
build-desktop:
|
||||||
name: build-desktop
|
name: build-desktop
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
if: github.event_name == 'release' || github.event.client_payload.platform == 'desktop'
|
if: github.event_name == 'release' || github.event.inputs.platform == 'desktop'
|
||||||
|
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
os: [macos-latest, ubuntu-18.04]
|
os: [macos-latest, ubuntu-22.04]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Decide Git ref
|
- name: Decide Git ref
|
||||||
@@ -28,30 +39,34 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
REF=${RELEASE_TAG:-${GITHUB_REF}}
|
REF=${RELEASE_TAG:-${GITHUB_REF}}
|
||||||
TAG=${REF##*/}
|
TAG=${REF##*/}
|
||||||
echo ::set-output name=ref::${REF}
|
echo "ref=${REF}" >> $GITHUB_OUTPUT
|
||||||
echo ::set-output name=tag::${TAG}
|
echo "tag=${TAG}" >> $GITHUB_OUTPUT
|
||||||
- uses: actions/checkout@v2.0.0
|
- uses: actions/checkout@v3.3.0
|
||||||
with:
|
with:
|
||||||
ref: ${{ steps.git_ref.outputs.ref }}
|
ref: ${{ steps.git_ref.outputs.ref }}
|
||||||
- name: Run build script
|
- name: Run build script
|
||||||
|
env:
|
||||||
|
TAG: ${{ steps.git_ref.outputs.tag }}
|
||||||
run: |
|
run: |
|
||||||
WORKFLOW_OS=`echo \`uname\` | sed "s/Darwin/mac/" | tr [:upper:] [:lower:]`
|
WORKFLOW_OS=`echo \`uname\` | sed "s/Darwin/mac/" | tr [:upper:] [:lower:]`
|
||||||
cd build/$WORKFLOW_OS && printf "y" | ./build.sh release
|
cd build/$WORKFLOW_OS && printf "y" | ./build.sh release
|
||||||
- name: Upload release assets
|
cd ../..
|
||||||
run: |
|
|
||||||
pip3 install setuptools
|
|
||||||
pip3 install PyGithub
|
|
||||||
if [ -f out/filament-release-darwin.tgz ]; then mv out/filament-release-darwin.tgz out/filament-${TAG}-mac.tgz; fi;
|
if [ -f out/filament-release-darwin.tgz ]; then mv out/filament-release-darwin.tgz out/filament-${TAG}-mac.tgz; fi;
|
||||||
if [ -f out/filament-release-linux.tgz ]; then mv out/filament-release-linux.tgz out/filament-${TAG}-linux.tgz; fi;
|
if [ -f out/filament-release-linux.tgz ]; then mv out/filament-release-linux.tgz out/filament-${TAG}-linux.tgz; fi;
|
||||||
python3 build/common/upload-assets.py ${TAG} out/*.tgz
|
- uses: actions/github-script@v6
|
||||||
env:
|
env:
|
||||||
TAG: ${{ steps.git_ref.outputs.tag }}
|
TAG: ${{ steps.git_ref.outputs.tag }}
|
||||||
GITHUB_API_KEY: ${{ secrets.GITHUB_API_KEY }}
|
with:
|
||||||
|
script: |
|
||||||
|
const upload = require('./build/common/upload-release-assets');
|
||||||
|
const { TAG } = process.env;
|
||||||
|
const globber = await glob.create('out/*.tgz');
|
||||||
|
await upload({ github, context }, await globber.glob(), TAG);
|
||||||
|
|
||||||
build-web:
|
build-web:
|
||||||
name: build-web
|
name: build-web
|
||||||
runs-on: macos-latest
|
runs-on: macos-latest
|
||||||
if: github.event_name == 'release' || github.event.client_payload.platform == 'web'
|
if: github.event_name == 'release' || github.event.inputs.platform == 'web'
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Decide Git ref
|
- name: Decide Git ref
|
||||||
@@ -59,28 +74,32 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
REF=${RELEASE_TAG:-${GITHUB_REF}}
|
REF=${RELEASE_TAG:-${GITHUB_REF}}
|
||||||
TAG=${REF##*/}
|
TAG=${REF##*/}
|
||||||
echo ::set-output name=ref::${REF}
|
echo "ref=${REF}" >> $GITHUB_OUTPUT
|
||||||
echo ::set-output name=tag::${TAG}
|
echo "tag=${TAG}" >> $GITHUB_OUTPUT
|
||||||
- uses: actions/checkout@v2.0.0
|
- uses: actions/checkout@v3.3.0
|
||||||
with:
|
with:
|
||||||
ref: ${{ steps.git_ref.outputs.ref }}
|
ref: ${{ steps.git_ref.outputs.ref }}
|
||||||
- name: Run build script
|
- name: Run build script
|
||||||
run: |
|
|
||||||
cd build/web && printf "y" | ./build.sh release
|
|
||||||
- name: Upload release assets
|
|
||||||
run: |
|
|
||||||
pip3 install setuptools
|
|
||||||
pip3 install PyGithub
|
|
||||||
mv out/filament-release-web.tgz out/filament-${TAG}-web.tgz
|
|
||||||
python3 build/common/upload-assets.py ${TAG} out/*.tgz
|
|
||||||
env:
|
env:
|
||||||
TAG: ${{ steps.git_ref.outputs.tag }}
|
TAG: ${{ steps.git_ref.outputs.tag }}
|
||||||
GITHUB_API_KEY: ${{ secrets.GITHUB_API_KEY }}
|
run: |
|
||||||
|
cd build/web && printf "y" | ./build.sh release
|
||||||
|
cd ../..
|
||||||
|
mv out/filament-release-web.tgz out/filament-${TAG}-web.tgz
|
||||||
|
- uses: actions/github-script@v6
|
||||||
|
env:
|
||||||
|
TAG: ${{ steps.git_ref.outputs.tag }}
|
||||||
|
with:
|
||||||
|
script: |
|
||||||
|
const upload = require('./build/common/upload-release-assets');
|
||||||
|
const { TAG } = process.env;
|
||||||
|
const globber = await glob.create('out/*.tgz');
|
||||||
|
await upload({ github, context }, await globber.glob(), TAG);
|
||||||
|
|
||||||
build-android:
|
build-android:
|
||||||
name: build-android
|
name: build-android
|
||||||
runs-on: macos-latest
|
runs-on: macos-latest
|
||||||
if: github.event_name == 'release' || github.event.client_payload.platform == 'android'
|
if: github.event_name == 'release' || github.event.inputs.platform == 'android'
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Decide Git ref
|
- name: Decide Git ref
|
||||||
@@ -88,34 +107,54 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
REF=${RELEASE_TAG:-${GITHUB_REF}}
|
REF=${RELEASE_TAG:-${GITHUB_REF}}
|
||||||
TAG=${REF##*/}
|
TAG=${REF##*/}
|
||||||
echo ::set-output name=ref::${REF}
|
echo "ref=${REF}" >> $GITHUB_OUTPUT
|
||||||
echo ::set-output name=tag::${TAG}
|
echo "tag=${TAG}" >> $GITHUB_OUTPUT
|
||||||
- uses: actions/checkout@v2.0.0
|
- uses: actions/checkout@v3.3.0
|
||||||
with:
|
with:
|
||||||
ref: ${{ steps.git_ref.outputs.ref }}
|
ref: ${{ steps.git_ref.outputs.ref }}
|
||||||
|
- uses: actions/setup-java@v3
|
||||||
|
with:
|
||||||
|
distribution: 'temurin'
|
||||||
|
java-version: '17'
|
||||||
- name: Run build script
|
- name: Run build script
|
||||||
|
env:
|
||||||
|
TAG: ${{ steps.git_ref.outputs.tag }}
|
||||||
run: |
|
run: |
|
||||||
cd build/android && printf "y" | ./build.sh release
|
cd build/android && printf "y" | ./build.sh release
|
||||||
- name: Upload release assets
|
cd ../..
|
||||||
run: |
|
|
||||||
pip3 install setuptools
|
|
||||||
pip3 install PyGithub
|
|
||||||
mv out/filament-android-release.aar out/filament-${TAG}-android.aar
|
mv out/filament-android-release.aar out/filament-${TAG}-android.aar
|
||||||
mv out/filamat-android-release.aar out/filamat-${TAG}-android.aar
|
mv out/filamat-android-release.aar out/filamat-${TAG}-android.aar
|
||||||
mv out/filamat-android-lite-release.aar out/filamat-${TAG}-lite-android.aar
|
mv out/filamat-android-lite-release.aar out/filamat-${TAG}-lite-android.aar
|
||||||
mv out/gltfio-android-release.aar out/gltfio-${TAG}-android.aar
|
mv out/gltfio-android-release.aar out/gltfio-${TAG}-android.aar
|
||||||
mv out/gltfio-android-lite-release.aar out/gltfio-${TAG}-lite-android.aar
|
|
||||||
mv out/filament-utils-android-release.aar out/filament-utils-${TAG}-android.aar
|
mv out/filament-utils-android-release.aar out/filament-utils-${TAG}-android.aar
|
||||||
mv out/filament-utils-android-lite-release.aar out/filament-utils-${TAG}-lite-android.aar
|
- name: Sign sample-gltf-viewer
|
||||||
python3 build/common/upload-assets.py ${TAG} out/*.aar
|
run: |
|
||||||
|
echo "${APK_KEYSTORE_BASE64}" > filament.jks.base64
|
||||||
|
base64 --decode filament.jks.base64 > filament.jks
|
||||||
|
BUILD_TOOLS_VERSION=$(ls ${ANDROID_HOME}/build-tools | sort -V | tail -n 1)
|
||||||
|
APKSIGNER=${ANDROID_HOME}/build-tools/${BUILD_TOOLS_VERSION}/apksigner
|
||||||
|
IN_FILE="out/sample-gltf-viewer-release.apk"
|
||||||
|
OUT_FILE="out/filament-gltf-viewer-${TAG}-android.apk"
|
||||||
|
${APKSIGNER} sign --ks filament.jks --key-pass=pass:${APK_KEYSTORE_PASS} --ks-pass=pass:${APK_KEYSTORE_PASS} --in ${IN_FILE} --out ${OUT_FILE}
|
||||||
|
rm "${IN_FILE}"
|
||||||
env:
|
env:
|
||||||
TAG: ${{ steps.git_ref.outputs.tag }}
|
TAG: ${{ steps.git_ref.outputs.tag }}
|
||||||
GITHUB_API_KEY: ${{ secrets.GITHUB_API_KEY }}
|
APK_KEYSTORE_BASE64: ${{ secrets.APK_KEYSTORE_BASE64 }}
|
||||||
|
APK_KEYSTORE_PASS: ${{ secrets.APK_KEYSTORE_PASS }}
|
||||||
|
- uses: actions/github-script@v6
|
||||||
|
env:
|
||||||
|
TAG: ${{ steps.git_ref.outputs.tag }}
|
||||||
|
with:
|
||||||
|
script: |
|
||||||
|
const upload = require('./build/common/upload-release-assets');
|
||||||
|
const { TAG } = process.env;
|
||||||
|
const globber = await glob.create(['out/*.aar', 'out/*.apk'].join('\n'));
|
||||||
|
await upload({ github, context }, await globber.glob(), TAG);
|
||||||
|
|
||||||
build-ios:
|
build-ios:
|
||||||
name: build-ios
|
name: build-ios
|
||||||
runs-on: macos-latest
|
runs-on: macos-latest
|
||||||
if: github.event_name == 'release' || github.event.client_payload.platform == 'ios'
|
if: github.event_name == 'release' || github.event.inputs.platform == 'ios'
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Decide Git ref
|
- name: Decide Git ref
|
||||||
@@ -123,28 +162,32 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
REF=${RELEASE_TAG:-${GITHUB_REF}}
|
REF=${RELEASE_TAG:-${GITHUB_REF}}
|
||||||
TAG=${REF##*/}
|
TAG=${REF##*/}
|
||||||
echo ::set-output name=ref::${REF}
|
echo "ref=${REF}" >> $GITHUB_OUTPUT
|
||||||
echo ::set-output name=tag::${TAG}
|
echo "tag=${TAG}" >> $GITHUB_OUTPUT
|
||||||
- uses: actions/checkout@v2.0.0
|
- uses: actions/checkout@v3.3.0
|
||||||
with:
|
with:
|
||||||
ref: ${{ steps.git_ref.outputs.ref }}
|
ref: ${{ steps.git_ref.outputs.ref }}
|
||||||
- name: Run build script
|
- name: Run build script
|
||||||
run: |
|
|
||||||
cd build/ios && printf "y" | ./build.sh release
|
|
||||||
- name: Upload release assets
|
|
||||||
run: |
|
|
||||||
pip3 install setuptools
|
|
||||||
pip3 install PyGithub
|
|
||||||
mv out/filament-release-ios.tgz out/filament-${TAG}-ios.tgz
|
|
||||||
python3 build/common/upload-assets.py ${TAG} out/*.tgz
|
|
||||||
env:
|
env:
|
||||||
TAG: ${{ steps.git_ref.outputs.tag }}
|
TAG: ${{ steps.git_ref.outputs.tag }}
|
||||||
GITHUB_API_KEY: ${{ secrets.GITHUB_API_KEY }}
|
run: |
|
||||||
|
cd build/ios && printf "y" | ./build.sh release
|
||||||
|
cd ../..
|
||||||
|
mv out/filament-release-ios.tgz out/filament-${TAG}-ios.tgz
|
||||||
|
- uses: actions/github-script@v6
|
||||||
|
env:
|
||||||
|
TAG: ${{ steps.git_ref.outputs.tag }}
|
||||||
|
with:
|
||||||
|
script: |
|
||||||
|
const upload = require('./build/common/upload-release-assets');
|
||||||
|
const { TAG } = process.env;
|
||||||
|
const globber = await glob.create('out/*.tgz');
|
||||||
|
await upload({ github, context }, await globber.glob(), TAG);
|
||||||
|
|
||||||
build-windows:
|
build-windows:
|
||||||
name: build-windows
|
name: build-windows
|
||||||
runs-on: windows-latest
|
runs-on: windows-2019
|
||||||
if: github.event_name == 'release' || github.event.client_payload.platform == 'windows'
|
if: github.event_name == 'release' || github.event.inputs.platform == 'windows'
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Decide Git ref
|
- name: Decide Git ref
|
||||||
@@ -152,22 +195,26 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
REF=${RELEASE_TAG:-${GITHUB_REF}}
|
REF=${RELEASE_TAG:-${GITHUB_REF}}
|
||||||
TAG=${REF##*/}
|
TAG=${REF##*/}
|
||||||
echo ::set-output name=ref::${REF}
|
echo "ref=${REF}" >> $GITHUB_OUTPUT
|
||||||
echo ::set-output name=tag::${TAG}
|
echo "tag=${TAG}" >> $GITHUB_OUTPUT
|
||||||
shell: bash
|
shell: bash
|
||||||
- uses: actions/checkout@v2.0.0
|
- uses: actions/checkout@v3.3.0
|
||||||
with:
|
with:
|
||||||
ref: ${{ steps.git_ref.outputs.ref }}
|
ref: ${{ steps.git_ref.outputs.ref }}
|
||||||
- name: Run build script
|
- name: Run build script
|
||||||
run: |
|
|
||||||
build\windows\build-github.bat release
|
|
||||||
shell: cmd
|
|
||||||
- name: Upload release assets
|
|
||||||
run: |
|
|
||||||
pip3 install PyGithub
|
|
||||||
mv out/filament-windows.tgz out/filament-${TAG}-windows.tgz
|
|
||||||
python build/common/upload-assets.py ${TAG} out/*.tgz
|
|
||||||
shell: bash
|
|
||||||
env:
|
env:
|
||||||
TAG: ${{ steps.git_ref.outputs.tag }}
|
TAG: ${{ steps.git_ref.outputs.tag }}
|
||||||
GITHUB_API_KEY: ${{ secrets.GITHUB_API_KEY }}
|
run: |
|
||||||
|
build\windows\build-github.bat release
|
||||||
|
cd ..\..
|
||||||
|
move out\filament-windows.tgz out\filament-%TAG%-windows.tgz
|
||||||
|
shell: cmd
|
||||||
|
- uses: actions/github-script@v6
|
||||||
|
env:
|
||||||
|
TAG: ${{ steps.git_ref.outputs.tag }}
|
||||||
|
with:
|
||||||
|
script: |
|
||||||
|
const upload = require('./build/common/upload-release-assets');
|
||||||
|
const { TAG } = process.env;
|
||||||
|
const globber = await glob.create('out/*.tgz');
|
||||||
|
await upload({ github, context }, await globber.glob(), TAG);
|
||||||
|
|||||||
@@ -0,0 +1,27 @@
|
|||||||
|
name: Verify Release Notes
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
types: [opened, synchronize, reopened, labeled]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
verify-release-notes:
|
||||||
|
name: Verify Release Notes
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
# We *only* need to check out the .github/ directory.
|
||||||
|
# The verify RELEASE_NOTES script uses the GitHub API to verify that RELEASE_NOTES was
|
||||||
|
# modified.
|
||||||
|
- name: Check out action
|
||||||
|
uses: Bhacaz/checkout-files@73e17cfbe8d7e0c6b2672b20cb05a718e20d18d4
|
||||||
|
with:
|
||||||
|
files: .github
|
||||||
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
- name: Verify release notes
|
||||||
|
uses: ./.github/actions/verify-release-notes
|
||||||
|
with:
|
||||||
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
pull-request-number: ${{ github.event.pull_request.number }}
|
||||||
|
release-notes-file: 'NEW_RELEASE_NOTES.md'
|
||||||
@@ -13,7 +13,7 @@ jobs:
|
|||||||
runs-on: macos-latest
|
runs-on: macos-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2.0.0
|
- uses: actions/checkout@v3.3.0
|
||||||
- name: Run build script
|
- name: Run build script
|
||||||
run: |
|
run: |
|
||||||
cd build/web && printf "y" | ./build.sh continuous
|
cd build/web && printf "y" | ./build.sh continuous
|
||||||
|
|||||||
@@ -10,10 +10,10 @@ on:
|
|||||||
jobs:
|
jobs:
|
||||||
build-windows:
|
build-windows:
|
||||||
name: build-windows
|
name: build-windows
|
||||||
runs-on: windows-latest
|
runs-on: windows-2019
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2.0.0
|
- uses: actions/checkout@v3.3.0
|
||||||
- name: Run build script
|
- name: Run build script
|
||||||
run: |
|
run: |
|
||||||
build\windows\build-github.bat continuous
|
build\windows\build-github.bat continuous
|
||||||
|
|||||||
+33
-54
@@ -4,29 +4,24 @@
|
|||||||
|
|
||||||
To build Filament, you must first install the following tools:
|
To build Filament, you must first install the following tools:
|
||||||
|
|
||||||
- CMake 3.10 (or more recent)
|
- CMake 3.19 (or more recent)
|
||||||
- clang 7.0 (or more recent)
|
- clang 14.0 (or more recent)
|
||||||
- [ninja 1.8](https://github.com/ninja-build/ninja/wiki/Pre-built-Ninja-packages) (or more recent)
|
- [ninja 1.10](https://github.com/ninja-build/ninja/wiki/Pre-built-Ninja-packages) (or more recent)
|
||||||
|
|
||||||
To build the Java based components of the project you can optionally install (recommended):
|
|
||||||
|
|
||||||
- OpenJDK 1.8 (or more recent)
|
|
||||||
|
|
||||||
Additional dependencies may be required for your operating system. Please refer to the appropriate
|
Additional dependencies may be required for your operating system. Please refer to the appropriate
|
||||||
section below.
|
section below.
|
||||||
|
|
||||||
To build Filament for Android you must also install the following:
|
To build Filament for Android you must also install the following:
|
||||||
|
|
||||||
- Android Studio 4.1.0 or more recent
|
- Android Studio Flamingo or more recent
|
||||||
- Android SDK
|
- Android SDK
|
||||||
- Android NDK "side-by-side" 22.0 or higher
|
- Android NDK 25.1 or higher
|
||||||
|
- Java 17
|
||||||
|
|
||||||
### Environment variables
|
### Environment variables
|
||||||
|
|
||||||
Make sure the environment variable `ANDROID_HOME` points to the location of your Android SDK.
|
To build Filament for Android, make sure the environment variable `ANDROID_HOME` points to the
|
||||||
|
location of your Android SDK.
|
||||||
By default our build system will attempt to compile the Java bindings. To do so, the environment
|
|
||||||
variable `JAVA_HOME` should point to the location of your JDK.
|
|
||||||
|
|
||||||
When building for WebGL, you'll also need to set `EMSDK`. See [WebAssembly](#webassembly).
|
When building for WebGL, you'll also need to set `EMSDK`. See [WebAssembly](#webassembly).
|
||||||
|
|
||||||
@@ -65,25 +60,13 @@ To install the libraries and executables in `out/debug/` and `out/release/`, add
|
|||||||
You can force a clean build by adding the `-c` flag. The script offers more features described
|
You can force a clean build by adding the `-c` flag. The script offers more features described
|
||||||
by executing `build.sh -h`.
|
by executing `build.sh -h`.
|
||||||
|
|
||||||
### Disabling Java builds
|
|
||||||
|
|
||||||
By default our build system will attempt to compile the Java bindings. If you wish to skip this
|
|
||||||
compilation step simply pass the `-j` flag to `build.sh`:
|
|
||||||
|
|
||||||
```
|
|
||||||
$ ./build.sh -j release
|
|
||||||
```
|
|
||||||
|
|
||||||
If you use CMake directly instead of the build script, pass `-DFILAMENT_ENABLE_JAVA=OFF`
|
|
||||||
to CMake instead.
|
|
||||||
|
|
||||||
### Filament-specific CMake Options
|
### Filament-specific CMake Options
|
||||||
|
|
||||||
The following CMake options are boolean options specific to Filament:
|
The following CMake options are boolean options specific to Filament:
|
||||||
|
|
||||||
- `FILAMENT_ENABLE_JAVA`: Compile Java projects: requires a JDK and the JAVA_HOME env var
|
|
||||||
- `FILAMENT_ENABLE_LTO`: Enable link-time optimizations if supported by the compiler
|
- `FILAMENT_ENABLE_LTO`: Enable link-time optimizations if supported by the compiler
|
||||||
- `FILAMENT_BUILD_FILAMAT`: Build filamat and JNI buildings
|
- `FILAMENT_BUILD_FILAMAT`: Build filamat and JNI buildings
|
||||||
|
- `FILAMENT_SUPPORTS_OPENGL`: Include the OpenGL backend
|
||||||
- `FILAMENT_SUPPORTS_METAL`: Include the Metal backend
|
- `FILAMENT_SUPPORTS_METAL`: Include the Metal backend
|
||||||
- `FILAMENT_SUPPORTS_VULKAN`: Include the Vulkan backend
|
- `FILAMENT_SUPPORTS_VULKAN`: Include the Vulkan backend
|
||||||
- `FILAMENT_INSTALL_BACKEND_TEST`: Install the backend test library so it can be consumed on iOS
|
- `FILAMENT_INSTALL_BACKEND_TEST`: Install the backend test library so it can be consumed on iOS
|
||||||
@@ -95,7 +78,7 @@ To turn an option on or off:
|
|||||||
|
|
||||||
```
|
```
|
||||||
$ cd <cmake-build-directory>
|
$ cd <cmake-build-directory>
|
||||||
$ cmake . -DOPTION=ON # Relace OPTION with the option name, set to ON / OFF
|
$ cmake . -DOPTION=ON # Replace OPTION with the option name, set to ON / OFF
|
||||||
```
|
```
|
||||||
|
|
||||||
Options can also be set with the CMake GUI.
|
Options can also be set with the CMake GUI.
|
||||||
@@ -104,12 +87,14 @@ Options can also be set with the CMake GUI.
|
|||||||
|
|
||||||
Make sure you've installed the following dependencies:
|
Make sure you've installed the following dependencies:
|
||||||
|
|
||||||
- `clang-7` or higher
|
- `clang-14` or higher
|
||||||
- `libglu1-mesa-dev`
|
- `libglu1-mesa-dev`
|
||||||
- `libc++-7-dev` (`libcxx-devel` and `libcxx-static` on Fedora) or higher
|
- `libc++-14-dev` (`libcxx-devel` and `libcxx-static` on Fedora) or higher
|
||||||
- `libc++abi-7-dev` (`libcxxabi-static` on Fedora) or higher
|
- `libc++abi-14-dev` (`libcxxabi-static` on Fedora) or higher
|
||||||
- `ninja-build`
|
- `ninja-build`
|
||||||
- `libxi-dev`
|
- `libxi-dev`
|
||||||
|
- `libxcomposite-dev` (`libXcomposite-devel` on Fedora)
|
||||||
|
- `libxxf86vm-dev` (`libXxf86vm-devel` on Fedora)
|
||||||
|
|
||||||
After dependencies have been installed, we highly recommend using the [easy build](#easy-build)
|
After dependencies have been installed, we highly recommend using the [easy build](#easy-build)
|
||||||
script.
|
script.
|
||||||
@@ -129,7 +114,7 @@ Your Linux distribution might default to `gcc` instead of `clang`, if that's the
|
|||||||
```
|
```
|
||||||
$ mkdir out/cmake-release
|
$ mkdir out/cmake-release
|
||||||
$ cd out/cmake-release
|
$ cd out/cmake-release
|
||||||
# Or use a specific version of clang, for instance /usr/bin/clang-7
|
# Or use a specific version of clang, for instance /usr/bin/clang-14
|
||||||
$ CC=/usr/bin/clang CXX=/usr/bin/clang++ CXXFLAGS=-stdlib=libc++ \
|
$ CC=/usr/bin/clang CXX=/usr/bin/clang++ CXXFLAGS=-stdlib=libc++ \
|
||||||
cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../release/filament ../..
|
cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../release/filament ../..
|
||||||
```
|
```
|
||||||
@@ -139,8 +124,8 @@ solution is to use `update-alternatives` to both change the default compiler, an
|
|||||||
specific version of clang:
|
specific version of clang:
|
||||||
|
|
||||||
```
|
```
|
||||||
$ update-alternatives --install /usr/bin/clang clang /usr/bin/clang-7 100
|
$ update-alternatives --install /usr/bin/clang clang /usr/bin/clang-14 100
|
||||||
$ update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-7 100
|
$ update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-14 100
|
||||||
$ update-alternatives --install /usr/bin/cc cc /usr/bin/clang 100
|
$ update-alternatives --install /usr/bin/cc cc /usr/bin/clang 100
|
||||||
$ update-alternatives --install /usr/bin/c++ c++ /usr/bin/clang++ 100
|
$ update-alternatives --install /usr/bin/c++ c++ /usr/bin/clang++ 100
|
||||||
```
|
```
|
||||||
@@ -162,13 +147,8 @@ make sure the command line tools are setup by running:
|
|||||||
$ xcode-select --install
|
$ xcode-select --install
|
||||||
```
|
```
|
||||||
|
|
||||||
After installing Java 1.8 you must also ensure that your `JAVA_HOME` environment variable is
|
If you wish to run the Vulkan backend instead of the default Metal backend, you must install
|
||||||
properly set. If it doesn't already point to the appropriate JDK, you can simply add the following
|
the LunarG SDK, enable "System Global Components", and reboot your machine.
|
||||||
to your `.profile`:
|
|
||||||
|
|
||||||
```
|
|
||||||
export JAVA_HOME="$(/usr/libexec/java_home)"
|
|
||||||
```
|
|
||||||
|
|
||||||
Then run `cmake` and `ninja` to trigger a build:
|
Then run `cmake` and `ninja` to trigger a build:
|
||||||
|
|
||||||
@@ -201,7 +181,7 @@ Install the following components:
|
|||||||
- [Python 3.7](https://www.python.org/ftp/python/3.7.0/python-3.7.0.exe)
|
- [Python 3.7](https://www.python.org/ftp/python/3.7.0/python-3.7.0.exe)
|
||||||
- [CMake 3.14 or later](https://github.com/Kitware/CMake/releases/download/v3.14.7/cmake-3.14.7-win64-x64.msi)
|
- [CMake 3.14 or later](https://github.com/Kitware/CMake/releases/download/v3.14.7/cmake-3.14.7-win64-x64.msi)
|
||||||
|
|
||||||
The latest Windows SDK can also by installed by opening Visual Studio and selecting _Get Tools and
|
The latest Windows SDK can also be installed by opening Visual Studio and selecting _Get Tools and
|
||||||
Features..._ under the _Tools_ menu.
|
Features..._ under the _Tools_ menu.
|
||||||
|
|
||||||
By default, Windows treats the file system as case insensitive. Please do not enable case
|
By default, Windows treats the file system as case insensitive. Please do not enable case
|
||||||
@@ -317,11 +297,11 @@ Alternatively you can build the AAR from the command line by executing the follo
|
|||||||
`android/` directory:
|
`android/` directory:
|
||||||
|
|
||||||
```
|
```
|
||||||
$ ./gradlew -Pfilament_dist_dir=../../out/android-release/filament assembleRelease
|
$ ./gradlew -Pcom.google.android.filament.dist-dir=../../out/android-release/filament assembleRelease
|
||||||
```
|
```
|
||||||
|
|
||||||
The `-Pfilament_dist_dir` can be used to specify a different installation directory (it must match
|
The `-Pcom.google.android.filament.dist-dir` can be used to specify a different installation
|
||||||
the CMake install prefix used in the previous steps).
|
directory (it must match the CMake install prefix used in the previous steps).
|
||||||
|
|
||||||
#### Using Filament's AAR
|
#### Using Filament's AAR
|
||||||
|
|
||||||
@@ -375,7 +355,7 @@ same version that our continuous builds use.
|
|||||||
|
|
||||||
```
|
```
|
||||||
cd <your chosen parent folder for the emscripten SDK>
|
cd <your chosen parent folder for the emscripten SDK>
|
||||||
curl -L https://github.com/emscripten-core/emsdk/archive/2.0.12.zip > emsdk.zip
|
curl -L https://github.com/emscripten-core/emsdk/archive/refs/tags/3.1.15.zip > emsdk.zip
|
||||||
unzip emsdk.zip ; mv emsdk-* emsdk ; cd emsdk
|
unzip emsdk.zip ; mv emsdk-* emsdk ; cd emsdk
|
||||||
python ./emsdk.py install latest
|
python ./emsdk.py install latest
|
||||||
python ./emsdk.py activate latest
|
python ./emsdk.py activate latest
|
||||||
@@ -391,13 +371,11 @@ export EMSDK=<your chosen home for the emscripten SDK>
|
|||||||
|
|
||||||
The EMSDK variable is required so that the build script can find the Emscripten SDK. The build
|
The EMSDK variable is required so that the build script can find the Emscripten SDK. The build
|
||||||
creates a `samples` folder that can be used as the root of a simple static web server. Note that you
|
creates a `samples` folder that can be used as the root of a simple static web server. Note that you
|
||||||
cannot open the HTML directly from the filesystem due to CORS. One way to deal with this is to
|
cannot open the HTML directly from the filesystem due to CORS. We recommend using the emrun tool
|
||||||
use Python to create a quick localhost server:
|
to create a quick localhost server:
|
||||||
|
|
||||||
```
|
```
|
||||||
cd out/cmake-webgl-release/web/samples
|
emrun out/cmake-webgl-release/web/samples --no_browser --port 8000
|
||||||
python3 -m http.server # Python 3
|
|
||||||
python -m SimpleHTTPServer # Python 2.7
|
|
||||||
```
|
```
|
||||||
|
|
||||||
You can then open http://localhost:8000/suzanne.html in your web browser.
|
You can then open http://localhost:8000/suzanne.html in your web browser.
|
||||||
@@ -422,12 +400,13 @@ filamesh ./assets/models/monkey/monkey.obj monkey.filamesh
|
|||||||
```
|
```
|
||||||
|
|
||||||
Most samples accept an IBL that must be generated using the `cmgen` tool (`./tools/filamesh/cmgen`
|
Most samples accept an IBL that must be generated using the `cmgen` tool (`./tools/filamesh/cmgen`
|
||||||
in your build directory). These sample apps expect a path to a directory containing the '.rgb32f'
|
in your build directory). These sample apps expect a path to a directory containing the `.rgb32f`
|
||||||
files for the IBL (which are PNGs containing `R11F_G11F_B10F` data). To generate an IBL simply use
|
files for the IBL (which are PNGs containing `R11F_G11F_B10F` data) or a path to a directory
|
||||||
this command:
|
containing two `.ktx` files (one for the IBL itself, one for the skybox). To generate an IBL
|
||||||
|
simply use this command:
|
||||||
|
|
||||||
```
|
```
|
||||||
cmgen -x ./ibls/ my_ibl.exr
|
cmgen -f ktx -x ./ibls/ my_ibl.exr
|
||||||
```
|
```
|
||||||
|
|
||||||
The source environment map can be a PNG (8 or 16 bit), a PSD (16 or 32 bit), an HDR or an OpenEXR
|
The source environment map can be a PNG (8 or 16 bit), a PSD (16 or 32 bit), an HDR or an OpenEXR
|
||||||
|
|||||||
+204
-100
@@ -1,7 +1,7 @@
|
|||||||
# ==================================================================================================
|
# ==================================================================================================
|
||||||
# CMake
|
# CMake
|
||||||
# ==================================================================================================
|
# ==================================================================================================
|
||||||
cmake_minimum_required(VERSION 3.10)
|
cmake_minimum_required(VERSION 3.19)
|
||||||
|
|
||||||
# ==================================================================================================
|
# ==================================================================================================
|
||||||
# Project declaration
|
# Project declaration
|
||||||
@@ -11,8 +11,6 @@ project(TNT)
|
|||||||
# ==================================================================================================
|
# ==================================================================================================
|
||||||
# Options
|
# Options
|
||||||
# ==================================================================================================
|
# ==================================================================================================
|
||||||
option(FILAMENT_ENABLE_JAVA "Compile Java projects, requires a JDK and the JAVA_HOME env var" ON)
|
|
||||||
|
|
||||||
option(FILAMENT_USE_EXTERNAL_GLES3 "Experimental: Compile Filament against OpenGL ES 3" OFF)
|
option(FILAMENT_USE_EXTERNAL_GLES3 "Experimental: Compile Filament against OpenGL ES 3" OFF)
|
||||||
|
|
||||||
option(FILAMENT_USE_SWIFTSHADER "Compile Filament against SwiftShader" OFF)
|
option(FILAMENT_USE_SWIFTSHADER "Compile Filament against SwiftShader" OFF)
|
||||||
@@ -25,20 +23,38 @@ option(FILAMENT_SUPPORTS_XCB "Include XCB support in Linux builds" ON)
|
|||||||
|
|
||||||
option(FILAMENT_SUPPORTS_XLIB "Include XLIB support in Linux builds" ON)
|
option(FILAMENT_SUPPORTS_XLIB "Include XLIB support in Linux builds" ON)
|
||||||
|
|
||||||
set(FILAMENT_PER_RENDER_PASS_ARENA_SIZE_IN_MB "2" CACHE STRING
|
option(FILAMENT_SUPPORTS_EGL_ON_LINUX "Use EGL for OpenGL in Linux builds" OFF)
|
||||||
"Per render pass arena size. Must be roughly 1 MB larger than FILAMENT_PER_FRAME_COMMANDS_SIZE_IN_MB, default 2."
|
|
||||||
|
option(FILAMENT_SUPPORTS_WAYLAND "Include Wayland support in Linux builds" OFF)
|
||||||
|
|
||||||
|
option(FILAMENT_SKIP_SDL2 "Skip dependencies of SDL2, and SDL2" OFF)
|
||||||
|
|
||||||
|
option(FILAMENT_LINUX_IS_MOBILE "Treat Linux as Mobile" OFF)
|
||||||
|
|
||||||
|
option(FILAMENT_ENABLE_ASAN_UBSAN "Enable Address and Undefined Behavior Sanitizers" OFF)
|
||||||
|
|
||||||
|
set(FILAMENT_NDK_VERSION "" CACHE STRING
|
||||||
|
"Android NDK version or version prefix to be used when building for Android."
|
||||||
)
|
)
|
||||||
|
|
||||||
set(FILAMENT_PER_FRAME_COMMANDS_SIZE_IN_MB "1" CACHE STRING
|
set(FILAMENT_PER_RENDER_PASS_ARENA_SIZE_IN_MB "3" CACHE STRING
|
||||||
"Size of the high-level draw commands buffer. Rule of thumb, 1 MB less than FILAMENT_PER_RENDER_PASS_ARENA_SIZE_IN_MB, default 1."
|
"Per render pass arena size. Must be roughly 1 MB larger than FILAMENT_PER_FRAME_COMMANDS_SIZE_IN_MB, default 3."
|
||||||
)
|
)
|
||||||
|
|
||||||
set(FILAMENT_MIN_COMMAND_BUFFERS_SIZE_IN_MB "1" CACHE STRING
|
set(FILAMENT_PER_FRAME_COMMANDS_SIZE_IN_MB "2" CACHE STRING
|
||||||
"Size of the command-stream buffer. As a rule of thumb use the same value as FILAMENT_PER_FRRAME_COMMANDS_SIZE_IN_MB, default 1."
|
"Size of the high-level draw commands buffer. Rule of thumb, 1 MB less than FILAMENT_PER_RENDER_PASS_ARENA_SIZE_IN_MB, default 2."
|
||||||
)
|
)
|
||||||
|
|
||||||
set(FILAMENT_OPENGL_HANDLE_ARENA_SIZE_IN_MB "2" CACHE STRING
|
set(FILAMENT_MIN_COMMAND_BUFFERS_SIZE_IN_MB "2" CACHE STRING
|
||||||
"Size of the OpenGL handle arena, default 2."
|
"Size of the command-stream buffer. As a rule of thumb use the same value as FILAMENT_PER_FRRAME_COMMANDS_SIZE_IN_MB, default 2."
|
||||||
|
)
|
||||||
|
|
||||||
|
set(FILAMENT_OPENGL_HANDLE_ARENA_SIZE_IN_MB "4" CACHE STRING
|
||||||
|
"Size of the OpenGL handle arena, default 4."
|
||||||
|
)
|
||||||
|
|
||||||
|
set(FILAMENT_METAL_HANDLE_ARENA_SIZE_IN_MB "8" CACHE STRING
|
||||||
|
"Size of the Metal handle arena, default 8."
|
||||||
)
|
)
|
||||||
|
|
||||||
# ==================================================================================================
|
# ==================================================================================================
|
||||||
@@ -53,25 +69,30 @@ endif()
|
|||||||
# ==================================================================================================
|
# ==================================================================================================
|
||||||
find_program(CCACHE_PROGRAM ccache)
|
find_program(CCACHE_PROGRAM ccache)
|
||||||
if (CCACHE_PROGRAM)
|
if (CCACHE_PROGRAM)
|
||||||
set(C_LAUNCHER "${CCACHE_PROGRAM}")
|
if (WIN32)
|
||||||
set(CXX_LAUNCHER "${CCACHE_PROGRAM}")
|
set(CMAKE_C_COMPILER_LAUNCHER "${CCACHE_PROGRAM}")
|
||||||
|
set(CMAKE_CXX_COMPILER_LAUNCHER "${CCACHE_PROGRAM}")
|
||||||
configure_file(build/launch-c.in launch-c)
|
|
||||||
configure_file(build/launch-cxx.in launch-cxx)
|
|
||||||
|
|
||||||
execute_process(COMMAND chmod a+rx
|
|
||||||
"${CMAKE_BINARY_DIR}/launch-c"
|
|
||||||
"${CMAKE_BINARY_DIR}/launch-cxx"
|
|
||||||
)
|
|
||||||
|
|
||||||
if (CMAKE_GENERATOR STREQUAL "Xcode")
|
|
||||||
set(CMAKE_XCODE_ATTRIBUTE_CC "${CMAKE_BINARY_DIR}/launch-c")
|
|
||||||
set(CMAKE_XCODE_ATTRIBUTE_CXX "${CMAKE_BINARY_DIR}/launch-cxx")
|
|
||||||
set(CMAKE_XCODE_ATTRIBUTE_LD "${CMAKE_BINARY_DIR}/launch-c")
|
|
||||||
set(CMAKE_XCODE_ATTRIBUTE_LDPLUSPLUS "${CMAKE_BINARY_DIR}/launch-cxx")
|
|
||||||
else()
|
else()
|
||||||
set(CMAKE_C_COMPILER_LAUNCHER "${CMAKE_BINARY_DIR}/launch-c")
|
set(C_LAUNCHER "${CCACHE_PROGRAM}")
|
||||||
set(CMAKE_CXX_COMPILER_LAUNCHER "${CMAKE_BINARY_DIR}/launch-cxx")
|
set(CXX_LAUNCHER "${CCACHE_PROGRAM}")
|
||||||
|
|
||||||
|
configure_file(build/launch-c.in launch-c)
|
||||||
|
configure_file(build/launch-cxx.in launch-cxx)
|
||||||
|
|
||||||
|
execute_process(COMMAND chmod a+rx
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/launch-c"
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/launch-cxx"
|
||||||
|
)
|
||||||
|
|
||||||
|
if (CMAKE_GENERATOR STREQUAL "Xcode")
|
||||||
|
set(CMAKE_XCODE_ATTRIBUTE_CC "${CMAKE_CURRENT_BINARY_DIR}/launch-c")
|
||||||
|
set(CMAKE_XCODE_ATTRIBUTE_CXX "${CMAKE_CURRENT_BINARY_DIR}/launch-cxx")
|
||||||
|
set(CMAKE_XCODE_ATTRIBUTE_LD "${CMAKE_CURRENT_BINARY_DIR}/launch-c")
|
||||||
|
set(CMAKE_XCODE_ATTRIBUTE_LDPLUSPLUS "${CMAKE_CURRENT_BINARY_DIR}/launch-cxx")
|
||||||
|
else()
|
||||||
|
set(CMAKE_C_COMPILER_LAUNCHER "${CMAKE_CURRENT_BINARY_DIR}/launch-c")
|
||||||
|
set(CMAKE_CXX_COMPILER_LAUNCHER "${CMAKE_CURRENT_BINARY_DIR}/launch-cxx")
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@@ -85,23 +106,49 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
|||||||
# ==================================================================================================
|
# ==================================================================================================
|
||||||
if (UNIX AND NOT APPLE AND NOT ANDROID AND NOT WEBGL)
|
if (UNIX AND NOT APPLE AND NOT ANDROID AND NOT WEBGL)
|
||||||
set(LINUX TRUE)
|
set(LINUX TRUE)
|
||||||
|
else()
|
||||||
|
# since cmake 3.25 LINUX is automatically set based on CMAKE_SYSTEM_NAME, which the android
|
||||||
|
# cmake files are setting to "Linux".
|
||||||
|
set(LINUX FALSE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (LINUX)
|
if (LINUX)
|
||||||
if (FILAMENT_SUPPORTS_XCB)
|
if (FILAMENT_SUPPORTS_WAYLAND)
|
||||||
add_definitions(-DFILAMENT_SUPPORTS_XCB)
|
add_definitions(-DFILAMENT_SUPPORTS_WAYLAND)
|
||||||
endif()
|
set(FILAMENT_SUPPORTS_X11 FALSE)
|
||||||
|
elseif (FILAMENT_SUPPORTS_EGL_ON_LINUX)
|
||||||
|
add_definitions(-DFILAMENT_SUPPORTS_EGL_ON_LINUX)
|
||||||
|
set(FILAMENT_SUPPORTS_X11 FALSE)
|
||||||
|
else ()
|
||||||
|
if (FILAMENT_SUPPORTS_XCB)
|
||||||
|
add_definitions(-DFILAMENT_SUPPORTS_XCB)
|
||||||
|
endif()
|
||||||
|
|
||||||
if (FILAMENT_SUPPORTS_XLIB)
|
# Default Swiftshader build does not enable the xlib extension
|
||||||
add_definitions(-DFILAMENT_SUPPORTS_XLIB)
|
if (FILAMENT_SUPPORTS_XLIB AND FILAMENT_USE_SWIFTSHADER)
|
||||||
|
set(FILAMENT_SUPPORTS_XLIB OFF)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (FILAMENT_SUPPORTS_XLIB)
|
||||||
|
add_definitions(-DFILAMENT_SUPPORTS_XLIB)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (FILAMENT_SUPPORTS_XCB OR FILAMENT_SUPPORTS_XLIB)
|
||||||
|
add_definitions(-DFILAMENT_SUPPORTS_X11)
|
||||||
|
set(FILAMENT_SUPPORTS_X11 TRUE)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (ANDROID OR WEBGL OR IOS)
|
if (ANDROID OR WEBGL OR IOS OR FILAMENT_LINUX_IS_MOBILE)
|
||||||
set(IS_MOBILE_TARGET TRUE)
|
set(IS_MOBILE_TARGET TRUE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (NOT ANDROID AND NOT WEBGL AND NOT IOS)
|
if (ANDROID)
|
||||||
|
add_definitions(-D__ANDROID_UNAVAILABLE_SYMBOLS_ARE_WEAK__)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (NOT ANDROID AND NOT WEBGL AND NOT IOS AND NOT FILAMENT_LINUX_IS_MOBILE)
|
||||||
set(IS_HOST_PLATFORM TRUE)
|
set(IS_HOST_PLATFORM TRUE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@@ -125,27 +172,35 @@ if (WIN32)
|
|||||||
# __declspec(dllexport) in front of each functions).
|
# __declspec(dllexport) in front of each functions).
|
||||||
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
|
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
|
||||||
|
|
||||||
|
# The CMAKE_CXX_FLAGS vars can be overriden by some Visual Studio generators, so we use an alternative
|
||||||
|
# global method here:
|
||||||
if (${USE_STATIC_CRT})
|
if (${USE_STATIC_CRT})
|
||||||
set(CRT_FLAGS_RELEASE "/MT")
|
add_compile_options(
|
||||||
set(CRT_FLAGS_DEBUG "/MTd")
|
$<$<CONFIG:>:/MT>
|
||||||
|
$<$<CONFIG:Debug>:/MTd>
|
||||||
|
$<$<CONFIG:Release>:/MT>
|
||||||
|
)
|
||||||
else()
|
else()
|
||||||
set(CRT_FLAGS_RELEASE "/MD")
|
add_compile_options(
|
||||||
set(CRT_FLAGS_DEBUG "/MDd")
|
$<$<CONFIG:>:/MD>
|
||||||
|
$<$<CONFIG:Debug>:/MDd>
|
||||||
|
$<$<CONFIG:Release>:/MD>
|
||||||
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# TODO: Figure out why pdb generation messes with incremental compilaton.
|
# TODO: Figure out why pdb generation messes with incremental compilaton.
|
||||||
# IN RELEASE_WITH_DEBUG_INFO, generate debug info in .obj, no in pdb.
|
# IN RELEASE_WITH_DEBUG_INFO, generate debug info in .obj, no in pdb.
|
||||||
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} ${CRT_FLAGS_RELEASE} /Z7")
|
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /Z7")
|
||||||
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} ${CRT_FLAGS_RELEASE} /Z7")
|
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} /Z7")
|
||||||
|
|
||||||
# In RELEASE, also generate PDBs.
|
# In RELEASE, also generate PDBs.
|
||||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${CRT_FLAGS_RELEASE} /Zi")
|
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Zi")
|
||||||
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} ${CRT_FLAGS_RELEASE} /Zi")
|
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /Zi")
|
||||||
|
|
||||||
# In DEBUG, avoid generating a PDB file which seems to mess with incremental compilation.
|
# In DEBUG, avoid generating a PDB file which seems to mess with incremental compilation.
|
||||||
# Instead generate debug info directly inside obj files.
|
# Instead generate debug info directly inside obj files.
|
||||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${CRT_FLAGS_DEBUG} /Z7")
|
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /Z7")
|
||||||
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${CRT_FLAGS_DEBUG} /Z7")
|
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /Z7")
|
||||||
|
|
||||||
# Special settings when building on CI.
|
# Special settings when building on CI.
|
||||||
if (${FILAMENT_WINDOWS_CI_BUILD})
|
if (${FILAMENT_WINDOWS_CI_BUILD})
|
||||||
@@ -234,13 +289,17 @@ if (MSVC)
|
|||||||
set(CXX_STANDARD "/std:c++latest")
|
set(CXX_STANDARD "/std:c++latest")
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXX_STANDARD} /W0 /Zc:__cplusplus")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXX_STANDARD} /W0 /Zc:__cplusplus")
|
||||||
else()
|
else()
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXX_STANDARD} -fstrict-aliasing -Wno-unknown-pragmas -Wno-unused-function")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXX_STANDARD} -fstrict-aliasing -Wno-unknown-pragmas -Wno-unused-function -Wno-deprecated-declarations")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (FILAMENT_USE_EXTERNAL_GLES3)
|
if (FILAMENT_USE_EXTERNAL_GLES3)
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DUSE_EXTERNAL_GLES3")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DUSE_EXTERNAL_GLES3")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if (FILAMENT_SUPPORTS_EGL_ON_LINUX)
|
||||||
|
set(EGL TRUE)
|
||||||
|
endif()
|
||||||
|
|
||||||
if (FILAMENT_USE_SWIFTSHADER)
|
if (FILAMENT_USE_SWIFTSHADER)
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DFILAMENT_USE_SWIFTSHADER")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DFILAMENT_USE_SWIFTSHADER")
|
||||||
endif()
|
endif()
|
||||||
@@ -265,7 +324,7 @@ if (LINUX)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (ANDROID)
|
if (ANDROID)
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -Werror=unguarded-availability")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (CYGWIN)
|
if (CYGWIN)
|
||||||
@@ -285,22 +344,38 @@ if (UNIX AND CMAKE_GENERATOR STREQUAL "Ninja")
|
|||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fcolor-diagnostics")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fcolor-diagnostics")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# Use hidden by default and expose what we need.
|
||||||
|
if (NOT WIN32)
|
||||||
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden")
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden")
|
||||||
|
endif()
|
||||||
|
|
||||||
# ==================================================================================================
|
# ==================================================================================================
|
||||||
# Release compiler flags
|
# Release compiler flags
|
||||||
# ==================================================================================================
|
# ==================================================================================================
|
||||||
if (NOT MSVC)
|
if (NOT MSVC AND NOT IOS)
|
||||||
|
# Omitting stack frame pointers prevents the generation of readable stack traces in crash reports on iOS
|
||||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fomit-frame-pointer")
|
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fomit-frame-pointer")
|
||||||
|
|
||||||
# These aren't compatible with -fembed-bitcode (and seem to have no effect on Apple platforms anyway)
|
# These aren't compatible with -fembed-bitcode (and seem to have no effect on Apple platforms anyway)
|
||||||
if (NOT IOS)
|
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -ffunction-sections -fdata-sections")
|
||||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -ffunction-sections -fdata-sections")
|
|
||||||
endif()
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# On Android RELEASE builds, we disable exceptions and RTTI to save some space (about 75 KiB
|
# On Android RELEASE builds, we disable exceptions and RTTI to save some space (about 75 KiB
|
||||||
# saved by -fno-exception and 10 KiB saved by -fno-rtti).
|
# saved by -fno-exception and 10 KiB saved by -fno-rtti).
|
||||||
if (ANDROID OR WEBGL)
|
if (ANDROID OR IOS OR WEBGL)
|
||||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-rtti")
|
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fno-exceptions -fno-rtti")
|
||||||
|
|
||||||
|
if (ANDROID OR WEBGL)
|
||||||
|
# Omitting unwind info prevents the generation of readable stack traces in crash reports on iOS
|
||||||
|
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fno-unwind-tables -fno-asynchronous-unwind-tables")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Turn off exceptions on iOS debug as well. This fixes an availability error we see when using
|
||||||
|
# std::visit, which is not supported on iOS 11.0 when exceptions are enabled.
|
||||||
|
if (IOS)
|
||||||
|
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fno-exceptions")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# With WebGL, we disable RTTI even for debug builds because we pass emscripten::val back and forth
|
# With WebGL, we disable RTTI even for debug builds because we pass emscripten::val back and forth
|
||||||
@@ -310,13 +385,17 @@ if (WEBGL)
|
|||||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fno-rtti")
|
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fno-rtti")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if (WEBGL_PTHREADS)
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread")
|
||||||
|
endif()
|
||||||
|
|
||||||
# ==================================================================================================
|
# ==================================================================================================
|
||||||
# Debug compiler flags
|
# Debug compiler flags
|
||||||
# ==================================================================================================
|
# ==================================================================================================
|
||||||
# ASAN is deactivated for now because:
|
if (FILAMENT_ENABLE_ASAN_UBSAN)
|
||||||
# -fsanitize=undefined causes extremely long link times
|
set(EXTRA_SANITIZE_OPTIONS "-fsanitize=address -fsanitize=undefined")
|
||||||
# -fsanitize=address causes a crash with assimp, which we can't explain for now
|
endif()
|
||||||
#set(EXTRA_SANITIZE_OPTIONS "-fsanitize=undefined -fsanitize=address")
|
|
||||||
if (NOT MSVC AND NOT WEBGL)
|
if (NOT MSVC AND NOT WEBGL)
|
||||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fstack-protector")
|
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fstack-protector")
|
||||||
endif()
|
endif()
|
||||||
@@ -352,8 +431,8 @@ endif()
|
|||||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${GC_SECTIONS}")
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${GC_SECTIONS}")
|
||||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${GC_SECTIONS} ${B_SYMBOLIC_FUNCTIONS}")
|
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${GC_SECTIONS} ${B_SYMBOLIC_FUNCTIONS}")
|
||||||
|
|
||||||
if (WEBGL)
|
if (WEBGL_PTHREADS)
|
||||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s USE_WEBGL2=1")
|
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -pthread")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# ==================================================================================================
|
# ==================================================================================================
|
||||||
@@ -365,6 +444,12 @@ if (CMAKE_BUILD_TYPE STREQUAL "Debug" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebIn
|
|||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DTNT_DEV")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DTNT_DEV")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# By default, build with support for OpenGL on all platforms.
|
||||||
|
option(FILAMENT_SUPPORTS_OPENGL "Include the OpenGL backend" ON)
|
||||||
|
if (FILAMENT_SUPPORTS_OPENGL)
|
||||||
|
add_definitions(-DFILAMENT_SUPPORTS_OPENGL)
|
||||||
|
endif()
|
||||||
|
|
||||||
# By default, build with Vulkan support on desktop platforms, although clients must request to use
|
# By default, build with Vulkan support on desktop platforms, although clients must request to use
|
||||||
# it at run time.
|
# it at run time.
|
||||||
if (WIN32 OR WEBGL OR IOS)
|
if (WIN32 OR WEBGL OR IOS)
|
||||||
@@ -400,6 +485,13 @@ else()
|
|||||||
option(FILAMENT_ENABLE_MATDBG "Enable the material debugger" OFF)
|
option(FILAMENT_ENABLE_MATDBG "Enable the material debugger" OFF)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# Only optimize materials in Release mode (so error message lines match the source code)
|
||||||
|
if (CMAKE_BUILD_TYPE MATCHES Release)
|
||||||
|
option(FILAMENT_DISABLE_MATOPT "Disable material optimizations" OFF)
|
||||||
|
else()
|
||||||
|
option(FILAMENT_DISABLE_MATOPT "Disable material optimizations" ON)
|
||||||
|
endif()
|
||||||
|
|
||||||
# ==================================================================================================
|
# ==================================================================================================
|
||||||
# Material compilation flags
|
# Material compilation flags
|
||||||
# ==================================================================================================
|
# ==================================================================================================
|
||||||
@@ -413,9 +505,9 @@ endif()
|
|||||||
|
|
||||||
set(MATC_API_FLAGS )
|
set(MATC_API_FLAGS )
|
||||||
|
|
||||||
# TODO: Add a flag to build Filament without support for OpenGL.
|
if (FILAMENT_SUPPORTS_OPENGL)
|
||||||
set(MATC_API_FLAGS ${MATC_API_FLAGS} -a opengl)
|
set(MATC_API_FLAGS ${MATC_API_FLAGS} -a opengl)
|
||||||
|
endif()
|
||||||
if (FILAMENT_SUPPORTS_VULKAN)
|
if (FILAMENT_SUPPORTS_VULKAN)
|
||||||
set(MATC_API_FLAGS ${MATC_API_FLAGS} -a vulkan)
|
set(MATC_API_FLAGS ${MATC_API_FLAGS} -a vulkan)
|
||||||
endif()
|
endif()
|
||||||
@@ -423,9 +515,14 @@ if (FILAMENT_SUPPORTS_METAL)
|
|||||||
set(MATC_API_FLAGS ${MATC_API_FLAGS} -a metal)
|
set(MATC_API_FLAGS ${MATC_API_FLAGS} -a metal)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Only optimize materials in Release mode (so error message lines match the source code)
|
# Enable debug info (preserves names in SPIR-V)
|
||||||
if (NOT CMAKE_BUILD_TYPE MATCHES Release)
|
if (FILAMENT_ENABLE_MATDBG)
|
||||||
set(MATC_OPT_FLAGS -g)
|
set(MATC_OPT_FLAGS ${MATC_OPT_FLAGS} -d)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Disable optimizations
|
||||||
|
if (FILAMENT_DISABLE_MATOPT)
|
||||||
|
set(MATC_OPT_FLAGS ${MATC_OPT_FLAGS} -g)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(MATC_BASE_FLAGS ${MATC_API_FLAGS} -p ${MATC_TARGET} ${MATC_OPT_FLAGS})
|
set(MATC_BASE_FLAGS ${MATC_API_FLAGS} -p ${MATC_TARGET} ${MATC_OPT_FLAGS})
|
||||||
@@ -443,11 +540,15 @@ if (NOT DIST_ARCH)
|
|||||||
if (CMAKE_OSX_ARCHITECTURES MATCHES ".*;.*")
|
if (CMAKE_OSX_ARCHITECTURES MATCHES ".*;.*")
|
||||||
set(DIST_ARCH "universal")
|
set(DIST_ARCH "universal")
|
||||||
else()
|
else()
|
||||||
if (NOT CMAKE_OSX_ARCHITECTURES STREQUAL "")
|
if (NOT "${CMAKE_OSX_ARCHITECTURES}" STREQUAL "")
|
||||||
set(DIST_ARCH "${CMAKE_OSX_ARCHITECTURES}")
|
set(DIST_ARCH "${CMAKE_OSX_ARCHITECTURES}")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
endif()
|
endif()
|
||||||
|
# On Windows machines, the host processor is set to 'AMD64', which we'll interpret as x86_64.
|
||||||
|
string(TOLOWER "${DIST_ARCH}" DIST_ARCH)
|
||||||
|
string(REPLACE "amd64" "x86_64" DIST_ARCH "${DIST_ARCH}")
|
||||||
if (NOT DIST_DIR)
|
if (NOT DIST_DIR)
|
||||||
set(DIST_DIR "${DIST_ARCH}")
|
set(DIST_DIR "${DIST_ARCH}")
|
||||||
endif()
|
endif()
|
||||||
@@ -465,14 +566,18 @@ function(list_licenses OUTPUT MODULES)
|
|||||||
foreach(module ${_MODULES})
|
foreach(module ${_MODULES})
|
||||||
set(license_path "../../third_party/${module}/LICENSE")
|
set(license_path "../../third_party/${module}/LICENSE")
|
||||||
get_filename_component(fullname "${license_path}" ABSOLUTE)
|
get_filename_component(fullname "${license_path}" ABSOLUTE)
|
||||||
string(APPEND CONTENT "${STR_OPENER}License and copyrights for ${module}:\n${STR_CLOSER},\n")
|
if(EXISTS ${fullname})
|
||||||
file(READ ${license_path} license_long)
|
string(APPEND CONTENT "${STR_OPENER}License and copyrights for ${module}:\n${STR_CLOSER},\n")
|
||||||
string(REPLACE "\n" "${STR_CLOSER},\n${STR_OPENER}" license ${license_long})
|
file(READ ${license_path} license_long)
|
||||||
string(APPEND CONTENT ${STR_OPENER}${license}\n${STR_CLOSER},)
|
string(REPLACE "\n" "${STR_CLOSER},\n${STR_OPENER}" license ${license_long})
|
||||||
string(APPEND CONTENT "\n\n")
|
string(APPEND CONTENT ${STR_OPENER}${license}\n${STR_CLOSER},)
|
||||||
|
string(APPEND CONTENT "\n\n")
|
||||||
|
else()
|
||||||
|
message(AUTHOR_WARNING "${license_path} not found. You can ignore this warning if you have devendored ${module}.")
|
||||||
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
configure_file(${FILAMENT}/build/licenses.inc.in ${OUTPUT})
|
configure_file(${FILAMENT}/build/licenses.inc.in ${OUTPUT})
|
||||||
endfunction(list_licenses)
|
endfunction()
|
||||||
|
|
||||||
set(COMBINE_SCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/build/linux/combine-static-libs.sh")
|
set(COMBINE_SCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/build/linux/combine-static-libs.sh")
|
||||||
if (WIN32)
|
if (WIN32)
|
||||||
@@ -485,7 +590,12 @@ function(combine_static_libs TARGET OUTPUT DEPS)
|
|||||||
# Loop through the dependent libraries and query their location on disk.
|
# Loop through the dependent libraries and query their location on disk.
|
||||||
set(DEPS_FILES )
|
set(DEPS_FILES )
|
||||||
foreach(DEPENDENCY ${DEPS})
|
foreach(DEPENDENCY ${DEPS})
|
||||||
list(APPEND DEPS_FILES "$<TARGET_FILE:${DEPENDENCY}>")
|
if(TARGET ${DEPENDENCY})
|
||||||
|
get_property(dep_type TARGET ${DEPENDENCY} PROPERTY TYPE)
|
||||||
|
if(dep_type STREQUAL "STATIC_LIBRARY")
|
||||||
|
list(APPEND DEPS_FILES "$<TARGET_FILE:${DEPENDENCY}>")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
@@ -518,13 +628,6 @@ if (FILAMENT_USE_SWIFTSHADER)
|
|||||||
find_library(SWIFTSHADER_VK NAMES vk_swiftshader HINTS "$ENV{SWIFTSHADER_LD_LIBRARY_PATH}")
|
find_library(SWIFTSHADER_VK NAMES vk_swiftshader HINTS "$ENV{SWIFTSHADER_LD_LIBRARY_PATH}")
|
||||||
message(STATUS "Found SwiftShader VK library in: ${SWIFTSHADER_VK}.")
|
message(STATUS "Found SwiftShader VK library in: ${SWIFTSHADER_VK}.")
|
||||||
add_definitions(-DFILAMENT_VKLIBRARY_PATH=\"${SWIFTSHADER_VK}\")
|
add_definitions(-DFILAMENT_VKLIBRARY_PATH=\"${SWIFTSHADER_VK}\")
|
||||||
elseif (FILAMENT_SUPPORTS_VULKAN AND APPLE)
|
|
||||||
find_library(Vulkan_LIBRARY NAMES vulkan HINTS "$ENV{VULKAN_SDK}/lib" "$ENV{VULKAN_SDK}/macOS/lib")
|
|
||||||
if (Vulkan_LIBRARY)
|
|
||||||
set(Vulkan_FOUND ON)
|
|
||||||
message(STATUS "Found Vulkan library in SDK: ${Vulkan_LIBRARY}.")
|
|
||||||
add_definitions(-DFILAMENT_VKLIBRARY_PATH=\"${Vulkan_LIBRARY}\")
|
|
||||||
endif()
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# ==================================================================================================
|
# ==================================================================================================
|
||||||
@@ -572,23 +675,33 @@ add_subdirectory(${EXTERNAL}/libgtest/tnt)
|
|||||||
add_subdirectory(${LIBRARIES}/camutils)
|
add_subdirectory(${LIBRARIES}/camutils)
|
||||||
add_subdirectory(${LIBRARIES}/filabridge)
|
add_subdirectory(${LIBRARIES}/filabridge)
|
||||||
add_subdirectory(${LIBRARIES}/filaflat)
|
add_subdirectory(${LIBRARIES}/filaflat)
|
||||||
|
add_subdirectory(${LIBRARIES}/filagui)
|
||||||
add_subdirectory(${LIBRARIES}/filameshio)
|
add_subdirectory(${LIBRARIES}/filameshio)
|
||||||
add_subdirectory(${LIBRARIES}/geometry)
|
add_subdirectory(${LIBRARIES}/geometry)
|
||||||
add_subdirectory(${LIBRARIES}/gltfio)
|
add_subdirectory(${LIBRARIES}/gltfio)
|
||||||
add_subdirectory(${LIBRARIES}/ibl)
|
add_subdirectory(${LIBRARIES}/ibl)
|
||||||
|
add_subdirectory(${LIBRARIES}/iblprefilter)
|
||||||
add_subdirectory(${LIBRARIES}/image)
|
add_subdirectory(${LIBRARIES}/image)
|
||||||
|
add_subdirectory(${LIBRARIES}/ktxreader)
|
||||||
add_subdirectory(${LIBRARIES}/math)
|
add_subdirectory(${LIBRARIES}/math)
|
||||||
add_subdirectory(${LIBRARIES}/mathio)
|
add_subdirectory(${LIBRARIES}/mathio)
|
||||||
|
add_subdirectory(${LIBRARIES}/uberz)
|
||||||
add_subdirectory(${LIBRARIES}/utils)
|
add_subdirectory(${LIBRARIES}/utils)
|
||||||
|
add_subdirectory(${LIBRARIES}/viewer)
|
||||||
add_subdirectory(${FILAMENT}/filament)
|
add_subdirectory(${FILAMENT}/filament)
|
||||||
add_subdirectory(${FILAMENT}/shaders)
|
add_subdirectory(${FILAMENT}/shaders)
|
||||||
|
add_subdirectory(${EXTERNAL}/basisu/tnt)
|
||||||
|
add_subdirectory(${EXTERNAL}/civetweb/tnt)
|
||||||
add_subdirectory(${EXTERNAL}/hat-trie/tnt)
|
add_subdirectory(${EXTERNAL}/hat-trie/tnt)
|
||||||
|
add_subdirectory(${EXTERNAL}/imgui/tnt)
|
||||||
add_subdirectory(${EXTERNAL}/robin-map/tnt)
|
add_subdirectory(${EXTERNAL}/robin-map/tnt)
|
||||||
add_subdirectory(${EXTERNAL}/smol-v/tnt)
|
add_subdirectory(${EXTERNAL}/smol-v/tnt)
|
||||||
add_subdirectory(${EXTERNAL}/benchmark/tnt)
|
add_subdirectory(${EXTERNAL}/benchmark/tnt)
|
||||||
add_subdirectory(${EXTERNAL}/meshoptimizer)
|
add_subdirectory(${EXTERNAL}/meshoptimizer/tnt)
|
||||||
|
add_subdirectory(${EXTERNAL}/mikktspace)
|
||||||
add_subdirectory(${EXTERNAL}/cgltf/tnt)
|
add_subdirectory(${EXTERNAL}/cgltf/tnt)
|
||||||
add_subdirectory(${EXTERNAL}/draco/tnt)
|
add_subdirectory(${EXTERNAL}/draco/tnt)
|
||||||
|
add_subdirectory(${EXTERNAL}/jsmn/tnt)
|
||||||
add_subdirectory(${EXTERNAL}/stb/tnt)
|
add_subdirectory(${EXTERNAL}/stb/tnt)
|
||||||
add_subdirectory(${EXTERNAL}/getopt)
|
add_subdirectory(${EXTERNAL}/getopt)
|
||||||
|
|
||||||
@@ -602,7 +715,6 @@ if (FILAMENT_BUILD_FILAMAT OR IS_HOST_PLATFORM)
|
|||||||
|
|
||||||
# the material debugger requires filamat
|
# the material debugger requires filamat
|
||||||
if (FILAMENT_ENABLE_MATDBG OR IS_HOST_PLATFORM)
|
if (FILAMENT_ENABLE_MATDBG OR IS_HOST_PLATFORM)
|
||||||
add_subdirectory(${EXTERNAL}/civetweb/tnt)
|
|
||||||
add_subdirectory(${LIBRARIES}/matdbg)
|
add_subdirectory(${LIBRARIES}/matdbg)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
@@ -612,10 +724,6 @@ if (FILAMENT_SUPPORTS_VULKAN)
|
|||||||
add_subdirectory(${EXTERNAL}/vkmemalloc/tnt)
|
add_subdirectory(${EXTERNAL}/vkmemalloc/tnt)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (APPLE)
|
|
||||||
add_subdirectory(${EXTERNAL}/moltenvk/tnt)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set(FILAMENT_SAMPLES_BINARY_DIR ${PROJECT_BINARY_DIR}/samples)
|
set(FILAMENT_SAMPLES_BINARY_DIR ${PROJECT_BINARY_DIR}/samples)
|
||||||
|
|
||||||
if (WEBGL)
|
if (WEBGL)
|
||||||
@@ -624,22 +732,16 @@ if (WEBGL)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (IS_HOST_PLATFORM)
|
if (IS_HOST_PLATFORM)
|
||||||
add_subdirectory(${LIBRARIES}/bluegl)
|
if (FILAMENT_SUPPORTS_OPENGL)
|
||||||
add_subdirectory(${LIBRARIES}/filamentapp)
|
add_subdirectory(${LIBRARIES}/bluegl)
|
||||||
add_subdirectory(${LIBRARIES}/filagui)
|
endif()
|
||||||
|
if (NOT FILAMENT_SKIP_SDL2)
|
||||||
|
add_subdirectory(${LIBRARIES}/filamentapp)
|
||||||
|
endif()
|
||||||
add_subdirectory(${LIBRARIES}/imageio)
|
add_subdirectory(${LIBRARIES}/imageio)
|
||||||
add_subdirectory(${LIBRARIES}/viewer)
|
|
||||||
|
|
||||||
add_subdirectory(${FILAMENT}/java/filamat)
|
|
||||||
add_subdirectory(${FILAMENT}/java/filament)
|
|
||||||
add_subdirectory(${FILAMENT}/java/gltfio)
|
|
||||||
|
|
||||||
add_subdirectory(${FILAMENT}/samples)
|
add_subdirectory(${FILAMENT}/samples)
|
||||||
|
|
||||||
add_subdirectory(${EXTERNAL}/astcenc/tnt)
|
|
||||||
add_subdirectory(${EXTERNAL}/etc2comp)
|
|
||||||
add_subdirectory(${EXTERNAL}/imgui/tnt)
|
|
||||||
add_subdirectory(${EXTERNAL}/jsmn/tnt)
|
|
||||||
add_subdirectory(${EXTERNAL}/libassimp/tnt)
|
add_subdirectory(${EXTERNAL}/libassimp/tnt)
|
||||||
add_subdirectory(${EXTERNAL}/libpng/tnt)
|
add_subdirectory(${EXTERNAL}/libpng/tnt)
|
||||||
add_subdirectory(${EXTERNAL}/libsdl2/tnt)
|
add_subdirectory(${EXTERNAL}/libsdl2/tnt)
|
||||||
@@ -655,11 +757,13 @@ if (IS_HOST_PLATFORM)
|
|||||||
add_subdirectory(${TOOLS}/mipgen)
|
add_subdirectory(${TOOLS}/mipgen)
|
||||||
add_subdirectory(${TOOLS}/normal-blending)
|
add_subdirectory(${TOOLS}/normal-blending)
|
||||||
add_subdirectory(${TOOLS}/resgen)
|
add_subdirectory(${TOOLS}/resgen)
|
||||||
|
add_subdirectory(${TOOLS}/rgb-to-lmsr)
|
||||||
add_subdirectory(${TOOLS}/roughness-prefilter)
|
add_subdirectory(${TOOLS}/roughness-prefilter)
|
||||||
add_subdirectory(${TOOLS}/specular-color)
|
add_subdirectory(${TOOLS}/specular-color)
|
||||||
|
add_subdirectory(${TOOLS}/uberz)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Generate exported executables for cross-compiled builds (Android, WebGL, and iOS)
|
# Generate exported executables for cross-compiled builds (Android, WebGL, and iOS)
|
||||||
if (NOT CMAKE_CROSSCOMPILING)
|
if (NOT CMAKE_CROSSCOMPILING)
|
||||||
export(TARGETS matc cmgen filamesh mipgen resgen glslminifier FILE ${IMPORT_EXECUTABLES})
|
export(TARGETS matc cmgen filamesh mipgen resgen uberz glslminifier FILE ${IMPORT_EXECUTABLES})
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
+1
-2
@@ -164,8 +164,7 @@ private:
|
|||||||
|
|
||||||
### Strings
|
### Strings
|
||||||
|
|
||||||
- Never use `std::string` in the Filament core renderer. Prefer `utils::CString` or
|
- Never use `std::string` in the Filament core renderer. Prefer `utils::CString` or `std::string_view`.
|
||||||
`utils::StaticString`.
|
|
||||||
- When using `std::string` in tools, always include the `std::` qualifier to disambiguate it
|
- When using `std::string` in tools, always include the `std::` qualifier to disambiguate it
|
||||||
from other string types.
|
from other string types.
|
||||||
|
|
||||||
|
|||||||
@@ -187,7 +187,7 @@
|
|||||||
same "printed page" as the copyright notice for easier
|
same "printed page" as the copyright notice for easier
|
||||||
identification within third-party archives.
|
identification within third-party archives.
|
||||||
|
|
||||||
Copyright [yyyy] [name of copyright owner]
|
Copyright 2023 The Android Open Source Project
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
# Filament Release Notes log
|
||||||
|
|
||||||
|
**If you are merging a PR into main**: please add the release note below, under the *Release notes
|
||||||
|
for next branch cut* header.
|
||||||
|
|
||||||
|
**If you are cherry-picking a commit into an rc/ branch**: add the release note under the
|
||||||
|
appropriate header in [RELEASE_NOTES.md](./RELEASE_NOTES.md).
|
||||||
|
|
||||||
|
## Release notes for next branch cut
|
||||||
|
|
||||||
|
- Fix possible NPE when updating fog options from Java/Kotlin
|
||||||
|
- The `emissive` property was not applied properly to `MASKED` materials, and could cause
|
||||||
|
dark fringes to appear (recompile materials)
|
||||||
|
- Allow glTF materials with transmission/volume extensions to choose their alpha mode
|
||||||
|
instead of forcing `MASKED`
|
||||||
@@ -31,39 +31,27 @@ repositories {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation 'com.google.android.filament:filament-android:1.9.14'
|
implementation 'com.google.android.filament:filament-android:1.42.0'
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
Here are all the libraries available in the group `com.google.android.filament`:
|
Here are all the libraries available in the group `com.google.android.filament`:
|
||||||
|
|
||||||
[](https://maven-badges.herokuapp.com/maven-central/com.google.android.filament/filament-android)
|
| Artifact | Description |
|
||||||
The Filament rendering engine itself.
|
| ------------- | ------------- |
|
||||||
|
| [](https://maven-badges.herokuapp.com/maven-central/com.google.android.filament/filament-android) | The Filament rendering engine itself. |
|
||||||
[](https://maven-badges.herokuapp.com/maven-central/com.google.android.filament/gltfio-android)
|
| [](https://maven-badges.herokuapp.com/maven-central/com.google.android.filament/filament-android-debug) | Debug version of `filament-android`. |
|
||||||
A glTF 2.0 loader for Filament, depends on `filament-android` .
|
| [](https://maven-badges.herokuapp.com/maven-central/com.google.android.filament/gltfio-android) | A glTF 2.0 loader for Filament, depends on `filament-android`. |
|
||||||
|
| [](https://maven-badges.herokuapp.com/maven-central/com.google.android.filament/filament-utils-android) | KTX loading, Kotlin math, and camera utilities, depends on `gltfio-android`. |
|
||||||
[](https://maven-badges.herokuapp.com/maven-central/com.google.android.filament/gltfio-android-lite)
|
| [](https://maven-badges.herokuapp.com/maven-central/com.google.android.filament/filamat-android) | A runtime material builder/compiler. This library is large but contains a full shader compiler/validator/optimizer and supports both OpenGL and Vulkan. |
|
||||||
Trimmed version of `gltfio` that does not support some glTF features.
|
| [](https://maven-badges.herokuapp.com/maven-central/com.google.android.filament/filamat-android-lite) | A much smaller alternative to `filamat-android` that can only generate OpenGL shaders. It does not provide validation or optimizations. |
|
||||||
|
|
||||||
[](https://maven-badges.herokuapp.com/maven-central/com.google.android.filament/filament-utils-android)
|
|
||||||
KTX loading, Kotlin math, and camera utilities, depends on `gltfio-android`.
|
|
||||||
|
|
||||||
[](https://maven-badges.herokuapp.com/maven-central/com.google.android.filament/filament-utils-android-lite)
|
|
||||||
Trimmed version of `filament-utils` that does not support some glTF features.
|
|
||||||
|
|
||||||
[](https://maven-badges.herokuapp.com/maven-central/com.google.android.filament/filamat-android)
|
|
||||||
A runtime material builder/compiler. This library is large but contains a full shader compiler/validator/optimizer.
|
|
||||||
|
|
||||||
[](https://maven-badges.herokuapp.com/maven-central/com.google.android.filament/filamat-android-lite)
|
|
||||||
A much smaller alternative to `filamat-android` that can only generate OpenGL shaders. It does not provide validation or optimizations.
|
|
||||||
|
|
||||||
### iOS
|
### iOS
|
||||||
|
|
||||||
iOS projects can use CocoaPods to install the latest release:
|
iOS projects can use CocoaPods to install the latest release:
|
||||||
|
|
||||||
```
|
```
|
||||||
pod 'Filament', '~> 1.9.14'
|
pod 'Filament', '~> 1.42.0'
|
||||||
```
|
```
|
||||||
|
|
||||||
### Snapshots
|
### Snapshots
|
||||||
@@ -74,7 +62,7 @@ steps:
|
|||||||
1. Find the [commit](https://github.com/google/filament/commits/main) you're interested in.
|
1. Find the [commit](https://github.com/google/filament/commits/main) you're interested in.
|
||||||
2. Click the green check mark under the commit message.
|
2. Click the green check mark under the commit message.
|
||||||
3. Click on the _Details_ link for the platform you're interested in.
|
3. Click on the _Details_ link for the platform you're interested in.
|
||||||
4. On the top right, click on the _Artifacts_ dropdown and choose an artifact.
|
4. On the top left click _Summary_, then in the _Artifacts_ section choose the desired artifact.
|
||||||
|
|
||||||
## Documentation
|
## Documentation
|
||||||
|
|
||||||
@@ -97,25 +85,12 @@ steps:
|
|||||||

|

|
||||||

|

|
||||||
|
|
||||||
|
|
||||||
### Applications
|
|
||||||
|
|
||||||
Here are a few screenshots of applications that use Filament in production:
|
|
||||||
|
|
||||||
#### Google Maps AR Navigation
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
#### Google Search 3D/AR Viewer on Android
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
### APIs
|
### APIs
|
||||||
|
|
||||||
- Native C++ API for Android, iOS, Linux, macOS and Windows
|
- Native C++ API for Android, iOS, Linux, macOS and Windows
|
||||||
- Java/JNI API for Android, Linux, macOS and Windows
|
- Java/JNI API for Android
|
||||||
- JavaScript API
|
- JavaScript API
|
||||||
|
|
||||||
### Backends
|
### Backends
|
||||||
@@ -131,6 +106,7 @@ Here are a few screenshots of applications that use Filament in production:
|
|||||||
- Clustered forward renderer
|
- Clustered forward renderer
|
||||||
- Cook-Torrance microfacet specular BRDF
|
- Cook-Torrance microfacet specular BRDF
|
||||||
- Lambertian diffuse BRDF
|
- Lambertian diffuse BRDF
|
||||||
|
- Custom lighting/surface shading
|
||||||
- HDR/linear lighting
|
- HDR/linear lighting
|
||||||
- Metallic workflow
|
- Metallic workflow
|
||||||
- Clear coat
|
- Clear coat
|
||||||
@@ -141,21 +117,29 @@ Here are a few screenshots of applications that use Filament in production:
|
|||||||
- Image-based lighting
|
- Image-based lighting
|
||||||
- Physically-based camera (shutter speed, sensitivity and aperture)
|
- Physically-based camera (shutter speed, sensitivity and aperture)
|
||||||
- Physical light units
|
- Physical light units
|
||||||
- Point lights, spot lights and directional light
|
- Point lights, spot lights, and directional light
|
||||||
- Spot and directional light shadows
|
- Specular anti-aliasing
|
||||||
|
- Point, spot, and directional light shadows
|
||||||
- Cascaded shadows
|
- Cascaded shadows
|
||||||
- VSM or PCF shadows
|
- EVSM, PCSS, DPCF, or PCF shadows
|
||||||
|
- Transparent shadows
|
||||||
- Contact shadows
|
- Contact shadows
|
||||||
- Screen-space ambient occlusion
|
- Screen-space ambient occlusion
|
||||||
|
- Screen-space reflections
|
||||||
- Screen-space refraction
|
- Screen-space refraction
|
||||||
- Global fog
|
- Global fog
|
||||||
|
- Dynamic resolution (with support for AMD FidelityFX FSR)
|
||||||
|
|
||||||
|
### Post processing
|
||||||
|
|
||||||
- HDR bloom
|
- HDR bloom
|
||||||
- Depth of field bokeh
|
- Depth of field bokeh
|
||||||
- Multiple tone mappers: ACES, filmic, etc.
|
- Multiple tone mappers: generic (customizable), ACES, filmic, etc.
|
||||||
- Color grading: white balance, channel mixer, shadows/mid-tones/highlights, ASC CDL,
|
- Color and tone management: luminance scaling, gamut mapping
|
||||||
contrast, saturation, etc.
|
- Color grading: exposure, night adaptation, white balance, channel mixer,
|
||||||
- TAA, FXAA, MSAA and specular anti-aliasing
|
shadows/mid-tones/highlights, ASC CDL, contrast, saturation, etc.
|
||||||
- Dynamic resolution
|
- TAA, FXAA, MSAA
|
||||||
|
- Screen-space lens flares
|
||||||
|
|
||||||
### glTF 2.0
|
### glTF 2.0
|
||||||
|
|
||||||
@@ -167,9 +151,9 @@ Here are a few screenshots of applications that use Filament in production:
|
|||||||
- [x] Points
|
- [x] Points
|
||||||
- [x] Lines
|
- [x] Lines
|
||||||
- [ ] Line Loop
|
- [ ] Line Loop
|
||||||
- [ ] Line Strip
|
- [x] Line Strip
|
||||||
- [x] Triangles
|
- [x] Triangles
|
||||||
- [ ] Triangle Strip
|
- [x] Triangle Strip
|
||||||
- [ ] Triangle Fan
|
- [ ] Triangle Fan
|
||||||
|
|
||||||
- Animation
|
- Animation
|
||||||
@@ -184,12 +168,18 @@ Here are a few screenshots of applications that use Filament in production:
|
|||||||
- [x] KHR_draco_mesh_compression
|
- [x] KHR_draco_mesh_compression
|
||||||
- [x] KHR_lights_punctual
|
- [x] KHR_lights_punctual
|
||||||
- [x] KHR_materials_clearcoat
|
- [x] KHR_materials_clearcoat
|
||||||
|
- [x] KHR_materials_emissive_strength
|
||||||
|
- [x] KHR_materials_ior
|
||||||
- [x] KHR_materials_pbrSpecularGlossiness
|
- [x] KHR_materials_pbrSpecularGlossiness
|
||||||
- [x] KHR_materials_sheen
|
- [x] KHR_materials_sheen
|
||||||
- [x] KHR_materials_transmission
|
- [x] KHR_materials_transmission
|
||||||
- [x] KHR_materials_unlit
|
- [x] KHR_materials_unlit
|
||||||
|
- [x] KHR_materials_variants
|
||||||
|
- [x] KHR_materials_volume
|
||||||
- [x] KHR_mesh_quantization
|
- [x] KHR_mesh_quantization
|
||||||
|
- [x] KHR_texture_basisu
|
||||||
- [x] KHR_texture_transform
|
- [x] KHR_texture_transform
|
||||||
|
- [x] EXT_meshopt_compression
|
||||||
|
|
||||||
|
|
||||||
## Rendering with Filament
|
## Rendering with Filament
|
||||||
@@ -255,22 +245,11 @@ if (renderer->beginFrame(swapChain)) {
|
|||||||
```
|
```
|
||||||
|
|
||||||
For complete examples of Linux, macOS and Windows Filament applications, look at the source files
|
For complete examples of Linux, macOS and Windows Filament applications, look at the source files
|
||||||
in the `samples/` directory. These samples are all based on `samples/app/` which contains the code
|
in the `samples/` directory. These samples are all based on `libs/filamentapp/` which contains the
|
||||||
that creates a native window with SDL2 and initializes the Filament engine, renderer and views.
|
code that creates a native window with SDL2 and initializes the Filament engine, renderer and views.
|
||||||
|
|
||||||
### Java on Linux, macOS and Windows
|
For more information on how to prepare environment maps for image-based lighting please refer to
|
||||||
|
[BUILDING.md](https://github.com/google/filament/blob/main/BUILDING.md#running-the-native-samples).
|
||||||
After building Filament, you can use `filament-java.jar` and its companion `filament-jni` native
|
|
||||||
library to use Filament in desktop Java applications.
|
|
||||||
|
|
||||||
You must always first initialize Filament by calling `Filament.init()`.
|
|
||||||
|
|
||||||
You can use Filament either with AWT or Swing, using respectively a `FilamentCanvas` or a
|
|
||||||
`FilamentPanel`.
|
|
||||||
|
|
||||||
Following the steps above (how to use Filament from native code), create an `Engine` and a
|
|
||||||
`Renderer`, but instead of calling `beginFrame` and `endFrame` on the renderer itself, call
|
|
||||||
these methods on `FilamentCanvas` or `FilamentPanel`.
|
|
||||||
|
|
||||||
### Android
|
### Android
|
||||||
|
|
||||||
@@ -301,6 +280,10 @@ To get started you can use the textures and environment maps found respectively
|
|||||||
`third_party/textures` and `third_party/environments`. These assets are under CC0 license. Please
|
`third_party/textures` and `third_party/environments`. These assets are under CC0 license. Please
|
||||||
refer to their respective `URL.txt` files to know more about the original authors.
|
refer to their respective `URL.txt` files to know more about the original authors.
|
||||||
|
|
||||||
|
Environments must be pre-processed using
|
||||||
|
[`cmgen`](https://github.com/google/filament/blob/main/BUILDING.md#running-the-native-samples) or
|
||||||
|
using the `libiblprefilter` library.
|
||||||
|
|
||||||
## How to make contributions
|
## How to make contributions
|
||||||
|
|
||||||
Please read and follow the steps in [CONTRIBUTING.md](/CONTRIBUTING.md). Make sure you are
|
Please read and follow the steps in [CONTRIBUTING.md](/CONTRIBUTING.md). Make sure you are
|
||||||
@@ -323,9 +306,9 @@ and tools.
|
|||||||
- `docs`: Documentation
|
- `docs`: Documentation
|
||||||
- `math`: Mathematica notebooks used to explore BRDFs, equations, etc.
|
- `math`: Mathematica notebooks used to explore BRDFs, equations, etc.
|
||||||
- `filament`: Filament rendering engine (minimal dependencies)
|
- `filament`: Filament rendering engine (minimal dependencies)
|
||||||
|
- `backend`: Rendering backends/drivers (Vulkan, Metal, OpenGL/ES)
|
||||||
- `ide`: Configuration files for IDEs (CLion, etc.)
|
- `ide`: Configuration files for IDEs (CLion, etc.)
|
||||||
- `ios`: Sample projects for iOS
|
- `ios`: Sample projects for iOS
|
||||||
- `java`: Java bindings for Filament libraries
|
|
||||||
- `libs`: Libraries
|
- `libs`: Libraries
|
||||||
- `bluegl`: OpenGL bindings for macOS, Linux and Windows
|
- `bluegl`: OpenGL bindings for macOS, Linux and Windows
|
||||||
- `bluevk`: Vulkan bindings for macOS, Linux, Windows and Android
|
- `bluevk`: Vulkan bindings for macOS, Linux, Windows and Android
|
||||||
@@ -345,6 +328,7 @@ and tools.
|
|||||||
- `math`: Math library
|
- `math`: Math library
|
||||||
- `mathio`: Math types support for output streams
|
- `mathio`: Math types support for output streams
|
||||||
- `utils`: Utility library (threads, memory, data structures, etc.)
|
- `utils`: Utility library (threads, memory, data structures, etc.)
|
||||||
|
- `viewer`: glTF viewer library (requires gltfio)
|
||||||
- `samples`: Sample desktop applications
|
- `samples`: Sample desktop applications
|
||||||
- `shaders`: Shaders used by `filamat` and `matc`
|
- `shaders`: Shaders used by `filamat` and `matc`
|
||||||
- `third_party`: External libraries and assets
|
- `third_party`: External libraries and assets
|
||||||
|
|||||||
+52
-60
@@ -9,26 +9,15 @@ Before starting, ensure that each of these branches is up-to-date with origin:
|
|||||||
- rc/$RELEASE
|
- rc/$RELEASE
|
||||||
- main
|
- main
|
||||||
|
|
||||||
## 0. Make sure the rc/$RELEASE branch has the correct version.
|
## 0. Check versions.
|
||||||
|
|
||||||
It should have the version corresponding to its name, $RELEASE.
|
Make sure the rc/$RELEASE branch has the correct Filament version. It should have the version
|
||||||
|
corresponding to its name, $RELEASE.
|
||||||
|
|
||||||
## 1. Update RELEASE_NOTES.md on the rc branch.
|
Make sure `MATERIAL_VERSION` has been bumped to a new version if this is a MAJOR or MINOR release
|
||||||
|
(first two version numbers).
|
||||||
|
|
||||||
Checkout the rc/$RELEASE branch. In RELEASE_NOTES.md, locate the header corresponding to $RELEASE
|
## 1. Bump Filament versions on main to $RELEASE.
|
||||||
and write release notes. To see which commits make up the release, run:
|
|
||||||
|
|
||||||
```
|
|
||||||
build/common/release.sh -c rc/$RELEASE
|
|
||||||
```
|
|
||||||
|
|
||||||
Commit the changes to rc/$RELEASE with the title:
|
|
||||||
|
|
||||||
```
|
|
||||||
Update RELEASE_NOTES for $RELEASE
|
|
||||||
```
|
|
||||||
|
|
||||||
## 2. Bump versions on main to $RELEASE.
|
|
||||||
|
|
||||||
Checkout main and run the following command to bump Filament's version to $RELEASE:
|
Checkout main and run the following command to bump Filament's version to $RELEASE:
|
||||||
|
|
||||||
@@ -39,54 +28,24 @@ build/common/bump-version.sh $RELEASE
|
|||||||
Commit changes to main with the title:
|
Commit changes to main with the title:
|
||||||
|
|
||||||
```
|
```
|
||||||
Bump version to $RELEASE
|
Release Filament $RELEASE
|
||||||
```
|
```
|
||||||
|
|
||||||
Do not push to origin yet.
|
Do not push to origin yet.
|
||||||
|
|
||||||
## 3. Cherry-pick RELEASE_NOTES change from rc branch to main.
|
## 2. Update RELEASE_NOTES.md on main.
|
||||||
|
|
||||||
```
|
Create a new header in RELEASE_NOTES.md for $NEXT_RELEASE. Copy the release notes in
|
||||||
git cherry-pick rc/$RELEASE
|
NEW_RELEASE_NOTES.md to RELEASE_NOTES.md under the new header. Clear NEW_RELEASE_NOTES.md.
|
||||||
```
|
|
||||||
|
|
||||||
Update the headers. The "Next release" header becomes a header for $NEXT_RELEASE, and a new "Next
|
Amend these changes to the "Release Filament $RELEASE" commit.
|
||||||
release" header is added.
|
|
||||||
|
|
||||||
For example, this:
|
|
||||||
|
|
||||||
```
|
|
||||||
## Next release (main branch)
|
|
||||||
- foo
|
|
||||||
- bar
|
|
||||||
|
|
||||||
## v1.9.3
|
|
||||||
- baz
|
|
||||||
- bat
|
|
||||||
```
|
|
||||||
|
|
||||||
becomes:
|
|
||||||
|
|
||||||
```
|
|
||||||
## Next release (main branch)
|
|
||||||
|
|
||||||
## v1.9.4
|
|
||||||
- foo
|
|
||||||
- bar
|
|
||||||
|
|
||||||
## v1.9.3
|
|
||||||
- baz
|
|
||||||
- bat
|
|
||||||
```
|
|
||||||
|
|
||||||
Ammend these changes to the cherry-picked change.
|
|
||||||
|
|
||||||
```
|
```
|
||||||
git add -u
|
git add -u
|
||||||
git commit --amend --no-edit
|
git commit --amend --no-edit
|
||||||
```
|
```
|
||||||
|
|
||||||
## 4. Run release script.
|
## 3. Run release script.
|
||||||
|
|
||||||
```
|
```
|
||||||
build/common/release.sh rc/$RELEASE rc/$NEXT_RELEASE
|
build/common/release.sh rc/$RELEASE rc/$NEXT_RELEASE
|
||||||
@@ -95,24 +54,26 @@ build/common/release.sh rc/$RELEASE rc/$NEXT_RELEASE
|
|||||||
This script will merge rc/$RELEASE into release, delete the rc branch, and create a new rc
|
This script will merge rc/$RELEASE into release, delete the rc branch, and create a new rc
|
||||||
branch called rc/$NEXT_RELEASE. Verify that everything looks okay locally.
|
branch called rc/$NEXT_RELEASE. Verify that everything looks okay locally.
|
||||||
|
|
||||||
## 5. Push the release branch.
|
## 4. Push the release branch.
|
||||||
|
|
||||||
```
|
```
|
||||||
git push origin release
|
git push origin release
|
||||||
```
|
```
|
||||||
|
|
||||||
## 6. Create the GitHub release.
|
## 5. Create the GitHub release.
|
||||||
|
|
||||||
Use the GitHub UI to create a GitHub release corresponding to $RELEASE version.
|
Use the GitHub UI to create a GitHub release corresponding to $RELEASE version.
|
||||||
Make sure the target is set to the release branch.
|
Make sure the target is set to the release branch.
|
||||||
|
|
||||||
## 7. Delete the old rc branch.
|
## 6. Delete the old rc branch (optional).
|
||||||
|
|
||||||
|
This step is optional. The old rc branch may be left alive for a few weeks for posterity.
|
||||||
|
|
||||||
```
|
```
|
||||||
git push origin --delete rc/$RELEASE
|
git push origin --delete rc/$RELEASE
|
||||||
```
|
```
|
||||||
|
|
||||||
## 8. Bump the version on the new rc branch to $NEXT_RELEASE.
|
## 7. Bump the version on the new rc branch to $NEXT_RELEASE.
|
||||||
|
|
||||||
```
|
```
|
||||||
git checkout rc/$NEXT_RELEASE
|
git checkout rc/$NEXT_RELEASE
|
||||||
@@ -125,14 +86,45 @@ Commit the changes to rc/$NEXT_RELEASE with the title:
|
|||||||
Bump version to $NEXT_RELEASE
|
Bump version to $NEXT_RELEASE
|
||||||
```
|
```
|
||||||
|
|
||||||
## 9. Push main.
|
## 8. Push main.
|
||||||
|
|
||||||
```
|
```
|
||||||
git push origin main
|
git push origin main
|
||||||
```
|
```
|
||||||
|
|
||||||
## 10. Push the new rc branch.
|
## 9. Push the new rc branch.
|
||||||
|
|
||||||
```
|
```
|
||||||
git push origin rc/$NEXT_RELEASE
|
git push origin -u rc/$NEXT_RELEASE
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## 10. Rebuild the GitHub release (if failed).
|
||||||
|
|
||||||
|
Sometimes the GitHub release job will fail. In this case, you can manually re-run the release job.
|
||||||
|
|
||||||
|
### Remove any assets uploaded to the release (if needed).
|
||||||
|
|
||||||
|
For example, if rebuilding the Mac release, ensure that the `filament-<version>-mac.tgz` artifact
|
||||||
|
is removed from the release assets.
|
||||||
|
|
||||||
|
### Update the release branch (if needed).
|
||||||
|
|
||||||
|
If you need to add one or more new commits to the release, perform the following:
|
||||||
|
|
||||||
|
First, push the new commit(s) to the `release` branch.
|
||||||
|
|
||||||
|
Then, with the release branch checked out with the new commit(s), run
|
||||||
|
|
||||||
|
```
|
||||||
|
git tag -f -a <release tagname>
|
||||||
|
git push origin -f <release tagname>
|
||||||
|
```
|
||||||
|
|
||||||
|
This will update and force push the tag.
|
||||||
|
|
||||||
|
### Re-run the GitHub release workflow
|
||||||
|
|
||||||
|
Navigate to [Filament's release
|
||||||
|
workflow](https://github.com/google/filament/actions/workflows/release.yml). Hit the _Run workflow_
|
||||||
|
dropdown. Modify _Platform to build_ and _Release tag to build_, then hit _Run workflow_. This will
|
||||||
|
initiate a new release run.
|
||||||
|
|||||||
+859
-1
@@ -3,7 +3,865 @@
|
|||||||
This file contains one line summaries of commits that are worthy of mentioning in release notes.
|
This file contains one line summaries of commits that are worthy of mentioning in release notes.
|
||||||
A new header is inserted each time a *tag* is created.
|
A new header is inserted each time a *tag* is created.
|
||||||
|
|
||||||
## Next release (main branch)
|
**Do not edit this file unless you are performing a release or cherry-picking into an rc/ branch.**
|
||||||
|
Instead, if you are authoring a PR for the main branch, add your release note to
|
||||||
|
[NEW_RELEASE_NOTES.md](./NEW_RELEASE_NOTES.md).
|
||||||
|
|
||||||
|
## v1.42.1
|
||||||
|
|
||||||
|
## v1.42.0
|
||||||
|
|
||||||
|
- engine: add preliminary support for instanced stereoscopic rendering [⚠️ **Recompile materials**]
|
||||||
|
|
||||||
|
## v1.41.0
|
||||||
|
|
||||||
|
- backend: fix #6997 : picking can fail on Adreno [⚠️ **New Material Version**]
|
||||||
|
- backend: A partial workaround for PowerVR devices (#5118, b/190221124) [⚠️ **Recompile Materials**]
|
||||||
|
|
||||||
|
## v1.40.5
|
||||||
|
|
||||||
|
- backend: Disable timer queries on all Mali GPUs (fixes b/233754398)
|
||||||
|
- engine: Add a way to query the validity of most filament objects (see `Engine::isValid`)
|
||||||
|
- opengl: fix b/290388359 : possible crash when shutting down the engine
|
||||||
|
- engine: Improve precision of frame time measurement when using emulated TimerQueries
|
||||||
|
- backend: Improve frame pacing on Android and Vulkan.
|
||||||
|
- backend: workaround b/291140208 (gltf_viewer crashes on Nexus 6P)
|
||||||
|
- engine: support `setDepthFunc` for `MaterialInstance`
|
||||||
|
- web: Added setDepthFunc()/getDepthFunc() to MaterialInstance
|
||||||
|
- android: Added setDepthFunc()/getDepthFunc() to MaterialInstance
|
||||||
|
|
||||||
|
## v1.40.4
|
||||||
|
|
||||||
|
- gltfio: fix crash when compute morph target without material
|
||||||
|
- matc: fix buggy `variant-filter` flag
|
||||||
|
- web: Added missing setMat3Parameter()/setMat4Parameter() to MaterialInstance
|
||||||
|
- opengl: fix b/290670707 : crash when using the blob cache
|
||||||
|
- engine: fix a crash with `Material::compile()` when a callback is specified
|
||||||
|
|
||||||
|
## v1.40.3
|
||||||
|
|
||||||
|
## v1.40.2
|
||||||
|
|
||||||
|
- rendering: dynamic resolution would not work with a translucent render target and quality > low
|
||||||
|
- Java/Kotlin: user callbacks were not invoked on successful texture upload
|
||||||
|
|
||||||
|
## v1.40.1
|
||||||
|
|
||||||
|
## v1.40.0
|
||||||
|
|
||||||
|
- matc: fix VSM high precision option on mobile [⚠️ **Recompile materials**]
|
||||||
|
- vulkan: support sRGB swap chain
|
||||||
|
- Add new `getMaxAutomaticInstances()` API on `Engine` to get max supported automatic instances.
|
||||||
|
- UiHelper: fix jank when a `TextureView` is resized (fixes b\282220665)
|
||||||
|
- backend: parallel shader compilation support. This breaks and improves the recent `Material::compile` API.
|
||||||
|
|
||||||
|
## v1.39.0
|
||||||
|
|
||||||
|
- matc: workaround a bug in spirv-tools causing vsm to fail [⚠️ **Recompile materials**]
|
||||||
|
|
||||||
|
## v1.38.0
|
||||||
|
|
||||||
|
- engine: a new feature to set a transform on the global-scale fog [⚠️ **Recompile materials**]
|
||||||
|
- engine: large-scale fog can now be opted-out on a per-renderable basis
|
||||||
|
- engine: improve froxelizer resource efficiency [⚠️ **Recompile materials**]
|
||||||
|
- matc: better accounting and validation of used samplers in user materials
|
||||||
|
- engine: add support for sampling fog color from a custom texture [⚠️ **Recompile materials**]
|
||||||
|
- vulkan: introduce new custom swapchain API
|
||||||
|
- vulkan: new context sharing API
|
||||||
|
|
||||||
|
## v1.37.0
|
||||||
|
|
||||||
|
- backend: added `Platform` blob cache APIs, typically used to cache programs [⚠️ **Recompile materials**]
|
||||||
|
|
||||||
|
## v1.36.0
|
||||||
|
|
||||||
|
- engine: a local transform can now be supplied for each GPU instance [⚠️ **Recompile materials**]
|
||||||
|
- everything: Add limited support for OpenGL ES 2.0 devices. [⚠️ **Recompile Materials**]
|
||||||
|
- platform: New virtual on `OpenGLPlatform` to preserve ancillary buffers
|
||||||
|
|
||||||
|
## v1.35.0
|
||||||
|
|
||||||
|
- materials: Materials can now access up to 4 global `vec4` visible by all materials [⚠️ **Recompile Materials**]
|
||||||
|
|
||||||
|
## v1.34.0
|
||||||
|
|
||||||
|
- materials: picking is done in float (prepare for ES2) [⚠️ **New Material Version**]
|
||||||
|
- materials: postLightingBlending is now applied before the fog [⚠️ **Recompile materials**]
|
||||||
|
- vulkan: fix adreno optimized material artifacts [⚠️ **Recompile Materials**]
|
||||||
|
|
||||||
|
## v1.33.0
|
||||||
|
|
||||||
|
- materials: prepare ES2 support [⚠️ **New Material Version**]
|
||||||
|
|
||||||
|
## v1.32.4
|
||||||
|
|
||||||
|
- engine: Add support for _constant parameters_, which are constants that can be specialized after material compilation.
|
||||||
|
- materials: improved size reduction of OpenGL/Metal shaders by ~65% when compiling materials with
|
||||||
|
size optimizations (`matc -S`) [⚠️ **Recompile Materials**]
|
||||||
|
- engine: fix potential crash on Metal devices with A8X GPU (iPad Air 2) [⚠️ **Recompile Materials**]
|
||||||
|
- opengl: support the external image on macOS
|
||||||
|
|
||||||
|
## v1.32.3
|
||||||
|
|
||||||
|
- fog: added an option to disable the fog after a certain distance [⚠️ **Recompile Materials**].
|
||||||
|
- fog: fog color now takes exposure and IBL intensity into account [⚠️ **Recompile Materials**].
|
||||||
|
- materials: implement cascades debugging as a post-process [⚠️ **Recompile Materials**].
|
||||||
|
- materials: use 9 digits or less for floats [⚠️ **Recompile Materials**].
|
||||||
|
- gltfio: fix skinning when objects are far from the origin
|
||||||
|
- materials: remove 4 unneeded variants from `unlit` materials [⚠️ **Recompile Materials**].
|
||||||
|
|
||||||
|
## v1.32.2
|
||||||
|
|
||||||
|
- lighting: the sun disc was computed in low/medium quality instead of high quality. This will
|
||||||
|
provide performance improvements to mobile devices [⚠️ **Recompile Materials**]
|
||||||
|
|
||||||
|
## v1.32.1
|
||||||
|
|
||||||
|
## v1.32.0
|
||||||
|
|
||||||
|
- fog: fixed fog height falloff and computation precision on mobile [⚠️ **Recompile Materials**]
|
||||||
|
- materials: new alphaToCoverage property can be used to control alpha to coverage behavior
|
||||||
|
- materials: added `getUserWorldFromWorldMatrix()` and `getUserWorldPosition()` to retrieve the
|
||||||
|
API-level (user) world position in materials. Deprecated `getWorldOffset()`. [⚠️ **Recompile
|
||||||
|
Materials**]
|
||||||
|
- engine: fix precision issue with `shading_view` in large scenes
|
||||||
|
- vulkan: readPixels is now async (#6560)
|
||||||
|
|
||||||
|
## v1.31.7
|
||||||
|
|
||||||
|
## v1.31.6
|
||||||
|
|
||||||
|
- engine: the default render channel is now 2 instead of 0
|
||||||
|
- gltfio: Fix crash when a MIME type has no texture provider
|
||||||
|
|
||||||
|
## v1.31.5
|
||||||
|
|
||||||
|
- gltfio: fix potential early freeing of data provided with `ResourceLoader::addResourceData`.
|
||||||
|
|
||||||
|
## v1.31.4
|
||||||
|
|
||||||
|
- engine: fix broken picking [⚠️ **Recompile Materials to get the fix**]
|
||||||
|
- engine: added support for sRGB swapchains. See `SwapChain.h`
|
||||||
|
- bluegl: support Windows32
|
||||||
|
|
||||||
|
## v1.31.3
|
||||||
|
|
||||||
|
- vulkan: fix memory leak in readPixels
|
||||||
|
- engine: added support for draw-commands channels (stronger ordering of commands/renderables)
|
||||||
|
|
||||||
|
## v1.31.2
|
||||||
|
|
||||||
|
## v1.31.1
|
||||||
|
|
||||||
|
- gltfio: expose joint inverse bind matrices via method on FilamentInstance
|
||||||
|
- filamesh: add error when uv coords size does not match num of vertices. (#6351)
|
||||||
|
|
||||||
|
## v1.31.0
|
||||||
|
|
||||||
|
- java: fix confusing typo in Camera documentation
|
||||||
|
- engine: the output color space can be set on `ColorGrading`. This API currently has limitations,
|
||||||
|
please refer to the documentation for more details
|
||||||
|
- Support for RGTC and BPTC texture compression
|
||||||
|
- engine: fix TransformManager high precision mode when using transactions
|
||||||
|
- web: added TypeScript definition for `Engine.destroy`
|
||||||
|
- materials: `getNormalizedViewportCoord()` now returns the logical (i.e. user) viewport
|
||||||
|
normalized position and keeps z reversed [⚠️ **Recompile Materials**]
|
||||||
|
- backend: workaround Adreno shader compiler bug (#6355) [⚠️ **Recompile Materials**]
|
||||||
|
- geometry: change computing tangent basis from normal vector to use Frisvad's method
|
||||||
|
|
||||||
|
## v1.30.0
|
||||||
|
|
||||||
|
- engine: optimize per-shadow UBO [⚠️ **Recompile Materials**]
|
||||||
|
- engine: fix potential memory corruption with larger scenes
|
||||||
|
- engine: VSM's MSAA setting is now per-view instead of per-light [⚠️ **API Change**]
|
||||||
|
|
||||||
|
## v1.29.0
|
||||||
|
|
||||||
|
- gltfio: calculate primitive's AABB correctly.
|
||||||
|
- gltfio: recompute bounding boxes with morph targets
|
||||||
|
- engine: add missing getters on `MaterialInstance`
|
||||||
|
- WebGL: add missing `ColorGrading` JS bindings
|
||||||
|
- engine: improvements/cleanup of Shadow mapping code [⚠️ **Recompile Materials**]
|
||||||
|
|
||||||
|
## v1.28.3
|
||||||
|
|
||||||
|
|
||||||
|
- backend: add support for GGP platform
|
||||||
|
- engine: primitives with `CullingMode::FRONT_AND_BACK` are now skipped.
|
||||||
|
|
||||||
|
## v1.28.2
|
||||||
|
|
||||||
|
- gltfio: support EXT_meshopt_compression
|
||||||
|
- release packaging: fixed location of default IBL file
|
||||||
|
|
||||||
|
## v1.28.1
|
||||||
|
|
||||||
|
- gltfio: fix reloading crash in ubershader mode
|
||||||
|
- Vulkan: improve performance in the readPixels path
|
||||||
|
- engine: raise the spot shadows limit to 64, from 14.
|
||||||
|
- engine: add experimental support for point light shadows.
|
||||||
|
- gltfio: fix ubershader issues with assignment of dummy textures
|
||||||
|
- gltfio: material instances and variants are now accessed via `FilamentInstance` [⚠️ **API Change**]
|
||||||
|
- gltfio: the animator can now only be accessed via `FilamentInstance` [⚠️ **API Change**]
|
||||||
|
- engine: fix "stable" shadows and make the default cascade splits logarithmic.
|
||||||
|
- engine: Add new quality options to EVSM shadows + rendering fixes
|
||||||
|
|
||||||
|
## v1.28.0
|
||||||
|
|
||||||
|
- engine: LiSPSM is now a user settable option
|
||||||
|
- engine: get the morph target buffer to the given primitive
|
||||||
|
- Java: Fix TransformManager.getChildren()
|
||||||
|
- Metal: newer devices are no longer limited to 16 samplers per Material.
|
||||||
|
- gltfio: fix interpretation of occlusion strength
|
||||||
|
- engine: minsdk is now 21 instead of 19. This allows the use of OpenGL ES 3.1
|
||||||
|
- Vulkan: fix black screen regression
|
||||||
|
|
||||||
|
## v1.27.2
|
||||||
|
|
||||||
|
- gltfio: punctual lights are now duplicated when adding new asset instances
|
||||||
|
- gltfio: FilamentInstance getAsset method now returns an immutable asset
|
||||||
|
- gltfio: allow zero-instance assets
|
||||||
|
- gltfio: fix regression with meshes that have no material
|
||||||
|
- gltfio: fix regression with recomputeBoundingBoxes()
|
||||||
|
- filamesh / matinfo: fix minor ASAN issues
|
||||||
|
- engine: Added `Engine::resetBackendState()`, available only in WebGL builds
|
||||||
|
|
||||||
|
## v1.27.1
|
||||||
|
|
||||||
|
- Java: add methods for TransformManager.getChildCount(), TransformManager.getChildren() and Scene.hasEntity()
|
||||||
|
- engine: Fix stencil buffer writes with OpenGL backend.
|
||||||
|
- gltfio: add new virtual method to MaterialProvider that all plugins must implement
|
||||||
|
- gltfio: add an assert for inconsistent sRGB flags among usages of a particular texture
|
||||||
|
- engine: improve scissor documentation
|
||||||
|
- backend: scissor is no longer clipped to the viewport (done on filament side)
|
||||||
|
- samples: add debug overdraw visualization to gltf_viewer
|
||||||
|
|
||||||
|
## v1.27.0
|
||||||
|
|
||||||
|
- WebGL: reduce max instance count to work around Chrome issues [⚠️ **Recompile Materials**]
|
||||||
|
- engine: rework material/shader sampler binding code [⚠️ **Recompile Materials**]
|
||||||
|
- gltfio: move the API for `recomputeBoundingBoxes` [⚠️ **API Change**]
|
||||||
|
- engine: add support for specialization constants [⚠️ **Recompile Materials**]
|
||||||
|
- gltfio: fix spotlight regression
|
||||||
|
- gltfio: clear the MaterialInstance cache when creating new instances
|
||||||
|
|
||||||
|
## v1.26.0
|
||||||
|
|
||||||
|
- engine: new feature level APIs, see `Engine::getSupportedFeatureLevel()`
|
||||||
|
- engine: add new stencil API to `View` and stencil state APIs to `MaterialInstance` [**NEW API**].
|
||||||
|
- engine: Fix guard bands and TAA with `vertexDomain:Device` [⚠️ **Recompile Materials**]
|
||||||
|
- engine: `clipSpaceTransform` is now only available with `vertexDomain:Device` [⚠️ **API Change**]
|
||||||
|
- gltfio: add unified `AssetLoader::createAsset()` method [⚠️ **API Change**]
|
||||||
|
- gltfio: all assets are now "instanced" [⚠️ **API Change**]
|
||||||
|
|
||||||
|
## v1.25.6
|
||||||
|
|
||||||
|
- engine: Add `CONFIG_MINSPEC_UBO_SIZE` as a nicer way to allow exceeding the ES3.0 minspec.
|
||||||
|
- gltfio: minor efficiency improvement for Android and WebGL builds.
|
||||||
|
- gltfio: add support for concurrent texture downloading and decoding.
|
||||||
|
|
||||||
|
## v1.25.5
|
||||||
|
|
||||||
|
- WebGL: upgraded the JS bindings to work with emsdk 3.1.15
|
||||||
|
- WebGL: added missing IBL builder to TypeScript annotations
|
||||||
|
- engine: Fix incorrect precision restoration when computing accurate world translations
|
||||||
|
- engine: make `MaterialInstance` public API friendly to `std::string_view` parameters
|
||||||
|
- gltfio: add 'detach' methods to allow ownership transfer of entities and components
|
||||||
|
|
||||||
|
## v1.25.4
|
||||||
|
|
||||||
|
- backend: streamline texture upload APIs [⚠️ **API Change**]
|
||||||
|
|
||||||
|
## v1.25.3
|
||||||
|
|
||||||
|
- engine: Fix Adreno gpu crash introduced by gpu morph target change
|
||||||
|
- engine: Add optional memory configuration parameters to Engine initialization
|
||||||
|
|
||||||
|
## v1.25.2
|
||||||
|
|
||||||
|
- engine: `Camera::getNear()` and `Camera::getCullingFar()` now return `doubles`
|
||||||
|
- Metal: implement scissor support.
|
||||||
|
- engine: `Renderer::getUserTime()` now returns seconds as documented (#5722) [⚠️ **API Fix**]
|
||||||
|
|
||||||
|
## v1.25.1
|
||||||
|
|
||||||
|
- engine: add support for automatic instancing. Must be enabled with `Engine::setAutomaticInstancingEnabled(bool)`
|
||||||
|
|
||||||
|
## v1.25.0
|
||||||
|
|
||||||
|
- Vulkan: smol-v blobs are now 8-byte aligned within the filamat archive. [⚠️ **Recompile Materials**]
|
||||||
|
- backend: added support for EGL on linux (headless)
|
||||||
|
- uberz tool: add --append and --template arguments.
|
||||||
|
- matc tool: add --template argument.
|
||||||
|
|
||||||
|
## v1.24.0
|
||||||
|
|
||||||
|
- ImGuiHelper: add support for Y flip.
|
||||||
|
- Metal: ignore `MTLTexture` formatting when importing external textures.
|
||||||
|
- materials: add a new `instanced` material parameter that is now mandatory in order to call `getInstanceIndex()`
|
||||||
|
- gltfio: UbershaderProvider now takes the ubershader archive in its constructor [⚠️ **API Change**]
|
||||||
|
- gltfio: Fix morphing with sparse accessors.
|
||||||
|
- gltfio: Fix models that use signed integers for morphing.
|
||||||
|
- engine: Documentation improvements regarding SkinningBuffer and fix an off-by-one assert when setting a SkinningBuffer.
|
||||||
|
- picking is now exposed to JavaScript
|
||||||
|
- gltf_viewer: Exercise picking functionality.
|
||||||
|
- OpenGL: add WebGL support for ReadPixels
|
||||||
|
- Vulkan: add assert and error message for OOM (debug builds)
|
||||||
|
- Vulkan: fix crash with picking and 2-component ReadPixels.
|
||||||
|
- backend: workaround broken GLES timer query on some Mali-Gxx old drivers
|
||||||
|
- backend: revert c049a1 & reenable b2cdf9 ("don't issue a flush systematically after framegraph's execute")
|
||||||
|
- gltfio: namespace now lives under Filament [⚠️ **API Change**]
|
||||||
|
- gltfio: UbershaderLoader renamed to UbershaderProvider [⚠️ **API Change**]
|
||||||
|
- gltfio: MaterialGenerator renamed to JitShaderProvider [⚠️ **API Change**]
|
||||||
|
|
||||||
|
## v1.23.2
|
||||||
|
|
||||||
|
- gltfio: Fix morphing for un-packed accessors.
|
||||||
|
- gltfio: Ubershaders are now packaged into flexible archives.
|
||||||
|
- gltfio: Remove poorly maintained lite flavor.
|
||||||
|
- engine: Disable user scissor while rendering the Shadow Maps.
|
||||||
|
- engine: Merge identical backend `RenderPrimitives` together.
|
||||||
|
- engine: Improve `ResourceAllocator` performance a bit by reserving 128 cache entries.
|
||||||
|
- utils: Remove `std::hash<T>` definitions for `libutils` types. Use `T::Hasher` explicitly instead. [⚠️ **API Change**]
|
||||||
|
- backend: Fix WGL context attributes.
|
||||||
|
- Metal: Fix potential invalid shaders when using gltfio in Ubershader mode. [⚠️ **Recompile Materials to get the fix**]
|
||||||
|
|
||||||
|
## v1.23.1
|
||||||
|
|
||||||
|
- gltfio: support skinning with bones that do not belong to any scene.
|
||||||
|
- gltfio: add `attachSkin` / `detachSkin` method to FilamentAsset.
|
||||||
|
- gltfio: ubershader mode: set sheen to `OPAQUE`.
|
||||||
|
- Metal: fix issues seen with dynamic resolution on M1 Macs.
|
||||||
|
- engine: add a "global" mode for render primitive's `blendOrder`.
|
||||||
|
- engine: remove `RenderManager::setGeometryAt(index, count)`. [⚠️ **API Change**]
|
||||||
|
- engine: fix overallocation by about 17MB.
|
||||||
|
- WebGL: Add JS bindings for Texture class methods.
|
||||||
|
|
||||||
|
## v1.23.0
|
||||||
|
|
||||||
|
- engine: Changed UBOs layout [⚠️ **Material breakage**].
|
||||||
|
- engine: Normals on morphed models have been fixed (core Filament change).
|
||||||
|
- Java: View has several minor changes due to generated code, such as field ordering.
|
||||||
|
- gltfio: Fix crash when reloading glTF assets.
|
||||||
|
- gltfio: introduce cross-fade animation API [**NEW API**].
|
||||||
|
|
||||||
|
## v1.22.2
|
||||||
|
|
||||||
|
- Java: Minor API change: rename `ssctStartTraceDistance` to `ssctShadowDistance`. [⚠️ **API Change**]
|
||||||
|
- Java: Minor API change: rename `blendingMode` to `blendMode`. [⚠️ **API Change**]
|
||||||
|
- engine: Fix some memory leaks.
|
||||||
|
|
||||||
|
## v1.22.1
|
||||||
|
|
||||||
|
- Metal: Shaders now use `half` floating-point arithmetic when possible for improved performance. [⚠️ **Recompile Materials**]
|
||||||
|
- engine: add support for presentation time in `Renderer`
|
||||||
|
- engine: added guard bands support for screen-space effects
|
||||||
|
- gltfio: Add multi-scene support.
|
||||||
|
- gltfio: Various glTF-related cleanup and enhancements.
|
||||||
|
- gltfio: Add support for KHR_texture_basisu.
|
||||||
|
|
||||||
|
## v1.22.0
|
||||||
|
|
||||||
|
- engine: Changed UBOs layout [⚠️ **Material breakage**].
|
||||||
|
- engine: Improve effects relying on mipmapping
|
||||||
|
- engine: Fix assert seen with VSM shadows.
|
||||||
|
- WebGL: Fix `isTextureFormatSupported` for ETC2 formats.
|
||||||
|
|
||||||
|
## v1.21.3
|
||||||
|
|
||||||
|
- Java: Renamed the `KTXLoader` Kotlin class to `KTX1Loader`. [⚠️ **API Change**].
|
||||||
|
- libs: Added `Ktx2Reader` and `BasisEncoder` to support Basis-encoded KTX2 files.
|
||||||
|
- engine: Remove deprecated `Stream` APIs, see `Texture::import()` for an alternative [⚠️ **API Change**].
|
||||||
|
- tools: Removed KTX1 compression support from mipgen. [⚠️ **API Change**].
|
||||||
|
- tools: Added support for KTX2 to mipgen.
|
||||||
|
- gltfio: Added `resetBoneMatrices()` method.
|
||||||
|
- gltfio: Introduced `TextureProvider` interface. [⚠️ **API Change**].
|
||||||
|
- gltfio: Fix progress indicator when error occurs.
|
||||||
|
- samples: Desktop and Web Suzanne samples now use KTX2 instead of KTX1.
|
||||||
|
- samples: Fix regression with sample-gltf-viewer and zip files.
|
||||||
|
|
||||||
|
## v1.21.2
|
||||||
|
|
||||||
|
- Java: Add Java binding to get skins in `FilamentAsset`.
|
||||||
|
- libs: Add libs/ktxreader [⚠️ **API Change**].
|
||||||
|
- mipgen: fixups / clarification regarding sRGB.
|
||||||
|
- WebGL: fix intermittent 'detached ArrayBuffer' errors.
|
||||||
|
|
||||||
|
## v1.21.1
|
||||||
|
|
||||||
|
- engine: Allow both screen-space refraction and screen-space reflections on the same object [⚠️ **Material breakage**].
|
||||||
|
- engine: Optimizations for screen-space reflections.
|
||||||
|
- engine: Remove `Viewport::scale()` [⚠️ **API Change**].
|
||||||
|
- engine: Fix 12x overallocation of memory in `MorphTargetBuffer`.
|
||||||
|
- Metal: Fix validation error when reading from default `SwapChain`.
|
||||||
|
|
||||||
|
## v1.21.0
|
||||||
|
|
||||||
|
- engine: OpenGL performance improvements with some drivers.
|
||||||
|
- engine: Fix incorrect shadows with some custom projection matrices.
|
||||||
|
- engine: Fix low frame rates seen with a lot of morph targets.
|
||||||
|
- gltfio: Add support for KHR_materials_variants.
|
||||||
|
- gltfio: Add support for KHR_materials_emissive_strength.
|
||||||
|
- gltfio: Java now exposes morph target names as an array for consistency [⚠️ **API Change**].
|
||||||
|
|
||||||
|
## v1.20.5
|
||||||
|
|
||||||
|
- engine: New behavior for MASKED to work with translucent views. [⚠️ **Recompile Materials** to get the fix]
|
||||||
|
- engine: Fix screen-space reflections when post-processing and MSAA are off.
|
||||||
|
- engine: Update MAX_MORPH_TARGETS constant to 256.
|
||||||
|
- engine: Fix point light lighting with ortho projection.
|
||||||
|
- libs: BlueGL symbols are now prefixed with `bluegl` on all platforms.
|
||||||
|
- gltfio: Add skinning getters to `FilamentAsset`.
|
||||||
|
|
||||||
|
## v1.20.4
|
||||||
|
|
||||||
|
- gltfio: Java clients must now destroy the MaterialProvider [⚠️ **API Change**].
|
||||||
|
- gltfio: Fix, bone pose not applied if glTF model doesn't have animations.
|
||||||
|
- libs: Added `math::quat::fromDirectedRotation` [**NEW API**].
|
||||||
|
- WebGL: Restore GL state when frame ends.
|
||||||
|
|
||||||
|
## v1.20.3
|
||||||
|
|
||||||
|
- Java: Fix URI bug in Android Viewer sample when dropping some zips.
|
||||||
|
- Vulkan: Fix "uninitialized texture" warnings from the Vulkan backend.
|
||||||
|
|
||||||
|
## v1.20.2
|
||||||
|
|
||||||
|
- engine: Binary size optimizations.
|
||||||
|
- engine: Fix, Mat4 from Quaternion was transposed.
|
||||||
|
- Vulkan: Internal bug fixes and robustness improvements.
|
||||||
|
- Vulkan: Reduced log spam.
|
||||||
|
|
||||||
|
## v1.20.1
|
||||||
|
|
||||||
|
- engine: Binary size improvements.
|
||||||
|
- engine: Add basic support for instanced renderables [**NEW API**].
|
||||||
|
- engine: Fix, first imaged passsed to `Stream::SetAcquiredImage` is ignored and leaked.
|
||||||
|
- Vulkan: Robustness improvements.
|
||||||
|
- Java: Fix, lookAt z axis negated.
|
||||||
|
- gltfio: Be graceful when model has > 4 weights per vert.
|
||||||
|
|
||||||
|
## v1.20.0
|
||||||
|
|
||||||
|
- engine: Support rough screen-space reflections [⚠️ **Material breakage**].
|
||||||
|
- engine: Added `Scene::forEach` API to iterate through a scene's entities.
|
||||||
|
- engine: Fix incorrect normals with skinned models.
|
||||||
|
- Vulkan: Fix segfault during shutdown.
|
||||||
|
- WebGL: Support web apps that have multiple `FilamentViewer`s.
|
||||||
|
- gltfio: Performance enhancements when loading models.
|
||||||
|
|
||||||
|
## v1.19.0
|
||||||
|
|
||||||
|
- engine: Support 256 morph targets.
|
||||||
|
- engine: Screen-space reflection improvements.
|
||||||
|
- engine: Morphing improvements and bug fixes.
|
||||||
|
- gltfio: Generate morphing normals when they are missing.
|
||||||
|
- gltfio: Support material extras.
|
||||||
|
- Java: Add bindings for new morphing API.
|
||||||
|
- Vulkan: Fix segfault on macOS.
|
||||||
|
|
||||||
|
## v1.18.0
|
||||||
|
|
||||||
|
- engine: Add support separate samplers in fragment and vertex shaders [⚠️ **Material breakage**].
|
||||||
|
- engine: Support legacy morphing mode with vertex attributes.
|
||||||
|
- engine: Allow more flexible quality settings for the ColorGrading LUT.
|
||||||
|
- engine: Improve screen-space reflections quality and allow reflections and refractions together.
|
||||||
|
- Vulkan: Bug fixes and improvements.
|
||||||
|
|
||||||
|
## v1.17.0
|
||||||
|
|
||||||
|
- engine: Add experimental glossy screen-space reflections.
|
||||||
|
- engine: Add support for GPU morphing and 128 morph targets.
|
||||||
|
- engine: Fix crash with non-shadow receiving renderables and VSM.
|
||||||
|
- engine: Bring back the 3x3 filter for PCF shadows.
|
||||||
|
- engine: Correct AABB calculation for skinned glTF models.
|
||||||
|
|
||||||
|
## v1.16.1
|
||||||
|
|
||||||
|
- engine: Added line/triangle strip support.
|
||||||
|
|
||||||
|
## v1.16.0
|
||||||
|
|
||||||
|
- engine: Fixes skinning calculations (#4887) [⚠️ **Material breakage**].
|
||||||
|
- engine: Add support for the glTF extension KHR_materials_emissive_strength.
|
||||||
|
- engine: Improvements and fixes to skinning calculations.
|
||||||
|
- engine: Fix debug checks for compressed textures.
|
||||||
|
- Metal: Fix `readPixels` when dimensions are greater than the render target's.
|
||||||
|
|
||||||
|
## v1.15.2
|
||||||
|
|
||||||
|
- engine: Add support for PCSS (Percentage Closer Soft Shadows).
|
||||||
|
- engine: Fix spotlight shadow bias.
|
||||||
|
- samples: Avoid leaking IBLs in Android sample-gltf-viewer.
|
||||||
|
- libs: Fix `libibl` on mobile.
|
||||||
|
|
||||||
|
## v1.15.1
|
||||||
|
|
||||||
|
- engine: add support for DPCF (PCF shadows with contact hardening).
|
||||||
|
- engine: add support for Wayland and Vulkan.
|
||||||
|
- engine: Fade lights out when close to light far plane.
|
||||||
|
- Java: Add missing `Engine#destroySkinningBuffer` method.
|
||||||
|
|
||||||
|
## v1.15.0
|
||||||
|
|
||||||
|
- engine: Fix spotlights normal bias calculation [⚠️ **Material breakage**].
|
||||||
|
- libimage: Fix loading spherical harmonics on certain locals.
|
||||||
|
|
||||||
|
## v1.14.2
|
||||||
|
|
||||||
|
- Metal: Fix validation error when rendering to `RenderTarget` without depth attachment.
|
||||||
|
- engine: Fix rendering glitch with zero-scale bone transforms.
|
||||||
|
|
||||||
|
## v1.14.1
|
||||||
|
|
||||||
|
- engine: Improvements to shadowing.
|
||||||
|
|
||||||
|
## v1.14.0
|
||||||
|
|
||||||
|
- engine: Internal materials can use structures as parameters [⚠️ **Material breakage**].
|
||||||
|
- engine: `readPixels` on a `SwapChain` must be called within `beginFrame` / `endFrame` [⚠️ **API
|
||||||
|
Change**].
|
||||||
|
- engine: Fix normal bias and improve spotlight quality.
|
||||||
|
- Java: Fix shadow biases.
|
||||||
|
|
||||||
|
## v1.13.0
|
||||||
|
|
||||||
|
- Android: Gradle configuration caching is now enabled.
|
||||||
|
- Android: Filament's Gradle properties have all been renamed to `com.google.android.filament.xxx`
|
||||||
|
where `xxx` is the property name. See `android/build.gradle` for a complete list [⚠️]
|
||||||
|
- Android: The Gradle property `filament_tools_dir` (now called
|
||||||
|
`com.google.android.filament.tools-dir`) does not have a default value anymore. Please specify one
|
||||||
|
in your `gradle.properties` if you reuse the Gradle plugin in your projects [⚠️]
|
||||||
|
- engine: Fix spotlights direction and falloff [⚠️ **Material breakage**].
|
||||||
|
- engine: Improvements to VSM and spotlight shadows.
|
||||||
|
|
||||||
|
## v1.12.11
|
||||||
|
|
||||||
|
- Metal: Color grading performance improvement on M1 devices.
|
||||||
|
- samples: Fix glitchy animation seen in gltf-viewer iOS sample.
|
||||||
|
|
||||||
|
## v1.12.10
|
||||||
|
|
||||||
|
- engine: rewrite dynamic resolution scaling controller for better accuracy and less jittering.
|
||||||
|
- Java: fix missing ASTC texture enum.
|
||||||
|
- tools: Fix normal map issues in mipgen.
|
||||||
|
- WebGL: expose some `SurfaceOrientation` functions.
|
||||||
|
|
||||||
|
## v1.12.9
|
||||||
|
|
||||||
|
- engine: New API: `MultiSampleAntiAliasingOptions` and HDR-aware MSAA resolve. When `customResolve`
|
||||||
|
is enabled, improves anti-aliasing quality [**NEW API**].
|
||||||
|
- engine: Fixes and improvements for FSR.
|
||||||
|
- engine: All APIs that take a callback as argument now also take a `CallbackHandler*`, a new
|
||||||
|
interface that provides more flexibility around callback dispatch [**NEW API**].
|
||||||
|
- Android: Fix JNI bindings for `DepthOfFieldOptions`.
|
||||||
|
- Android: workarounds for Adreno-specific fraembuffer issue.
|
||||||
|
- JavaScript: updates to JS bindings.
|
||||||
|
|
||||||
|
## v1.12.8
|
||||||
|
|
||||||
|
- engine: Added picking API to `View` [⚠️ **Materials need to be rebuilt to access this new feature**].
|
||||||
|
- engine: A new `Engine::pumpMessageQueues()` method can be used to trigger all pending user
|
||||||
|
callbacks right away [**NEW API**].
|
||||||
|
- engine: new inline helpers to more easily use lambdas, functors and method callbacks with
|
||||||
|
`{Pixel}BufferDescriptor`.
|
||||||
|
- Vulkan: fix vertical offset for `readPixels`.
|
||||||
|
- Vulkan: various internal improvements.
|
||||||
|
- Metal: support integer formats with `readPixels`.
|
||||||
|
|
||||||
|
## v1.12.7
|
||||||
|
|
||||||
|
- engine: Fix, apply emissive after shadowing.
|
||||||
|
|
||||||
|
## v1.12.6
|
||||||
|
|
||||||
|
- engine: Added concept of lod bias to materials.
|
||||||
|
[⚠️ **Materials need to be rebuilt to access this new feature**].
|
||||||
|
- engine: Fix, BGRA ordering respected for external images with OpenGL on iOS.
|
||||||
|
- engine: Use more sensible defaults for spot light inner outer cone angles.
|
||||||
|
- engine: Fix potential race condition that caused stalls in `endFrame`.
|
||||||
|
- gltfio: Improved handling of transparent materials.
|
||||||
|
- Metal: Fix potential crash on earlier versions of iOS (<= 13.0).
|
||||||
|
- Android: Fix `filament-utils-android` 'lite' flavor.
|
||||||
|
- Java: Fix potential crash with `IBLPrefilter`.
|
||||||
|
|
||||||
|
## v1.12.5
|
||||||
|
|
||||||
|
- engine: work around a job scheduling issue in `endFrame` that caused stuttering on some Android
|
||||||
|
devices.
|
||||||
|
|
||||||
|
## v1.12.4
|
||||||
|
|
||||||
|
- engine: New night adaptation API on `ColorGrading`. This API can be used to create an effect that
|
||||||
|
that simulates color and brightness shifts in human vision in low-light conditions.
|
||||||
|
- engine: improved performance of AMD FidelityFX FSR1 by 4.6x, it now runs in about 2ms in 4K.
|
||||||
|
- engine: Dynamic resolution quality `MEDIUM`, `HIGH` and `ULTRA` now all use AMD FidelityFX FSR1.
|
||||||
|
- engine: Fix crash when duplicating material instances.
|
||||||
|
- gltfio: generate tangents if requested by the material.
|
||||||
|
|
||||||
|
## v1.12.3
|
||||||
|
|
||||||
|
- engine: Support AMD FidelityFX Super Resolution for dynamic resolution scaling
|
||||||
|
|
||||||
|
## v1.12.2
|
||||||
|
|
||||||
|
- engine: New API on `ColorGrading` to enable or disable gamut mapping at will [**New API**].
|
||||||
|
- engine: Fix typo causing ShadowOptions::shadowFar to not work properly.
|
||||||
|
- engine: Fix, CSM glitch when using shadowMultiplier materials.
|
||||||
|
- engine: Improve precision when computing camera projection.
|
||||||
|
- engine: Increase the number of supported spot shadows to 14 (from 6).
|
||||||
|
- Metal: Add texture swizzling support for external textures.
|
||||||
|
|
||||||
|
## v1.12.1
|
||||||
|
|
||||||
|
- engine: `double` precision translation support in TransformManager. Disabled by default.
|
||||||
|
Augment model (and view) matrix on `Camera` to accept double precision matrices. When enabled,
|
||||||
|
double precision translations allow filament to handle a very large world space [**New API**].
|
||||||
|
- engine: Fix, Views with custom render targets are now blendable.
|
||||||
|
|
||||||
|
## v1.12.0
|
||||||
|
|
||||||
|
- engine: Option to automatically compute bent normals from SSAO & apply to specular AO
|
||||||
|
[⚠️ **Material breakage**].
|
||||||
|
- engine: New APIs: Light channels. Geometry and lights now have a channel associated to them, at
|
||||||
|
least one channel must match for lighting to occur [⚠️ **Material breakage**].
|
||||||
|
- engine: Fix potential GPU crash with punctual lights near the far clipping plane.
|
||||||
|
- materials: The `inverseTonemap` API is now an exact inverse of the Filmic tonemapper.
|
||||||
|
- Metal: Better support for texture formats on M1 Macs.
|
||||||
|
|
||||||
|
## v1.11.2
|
||||||
|
|
||||||
|
- engine: New API: `ColorGrading::Builder::toneMapper(const ToneMapper*)`.
|
||||||
|
- engine: New tone mapper: `GenericToneMapper`, a configurable tone mapper.
|
||||||
|
- engine: `ColorGrading::Builder::toneMapping(ColorGrading::ToneMapping)` is now deprecated.
|
||||||
|
- engine: Removed `REINHARD` tonemap operator[⚠️ **API Change**].
|
||||||
|
- engine: Improve s3tc_srgb detection on desktop.
|
||||||
|
- engine: Add bilateral threshold in SSAO options.
|
||||||
|
- gltfio: Fix AssetLoader leak, remove unwanted destructor.
|
||||||
|
- Metal/Vulkan: Fix uploading texture data with padding or offset.
|
||||||
|
- Metal: fix GPU crash seen with large amounts of geometry.
|
||||||
|
|
||||||
|
## v1.11.1
|
||||||
|
|
||||||
|
- engine: Luminance scaling can now be used with any tone mapping operator. It was previously tied
|
||||||
|
to the "EVILS" tone mapping operator.
|
||||||
|
- engine: Removed the "EVILS" tone mapping operator [⚠️ **API Change**].
|
||||||
|
- engine: Improvements to Skinning. A new `SkinningBuffer` API allows bone sharing between
|
||||||
|
renderables.
|
||||||
|
- engine: Improvements to internal memory allocation for Metal and Vulkan backends.
|
||||||
|
- engine: Default to OpenGL backend when Windows does not support Vulkan.
|
||||||
|
- samples: Add new sample app: image_viewer.
|
||||||
|
|
||||||
|
## v1.11.0
|
||||||
|
|
||||||
|
- engine: Added support for transparent shadows. Add `transparentShadow : true` in the material file.
|
||||||
|
- engine: honor user-defined precision in material files for non-samplers, rename `SamplerPrecision`
|
||||||
|
to `ParameterPrecicion`. [⚠️ **API Change**]
|
||||||
|
- engine: Work around Qualcomm issue with point lights.
|
||||||
|
- engine: Allow MSAA when post-processing is disabled.
|
||||||
|
- engine: enable up to 6 spot-light shadows.
|
||||||
|
- gltfio: Added support for `KHR_materials_volume`.
|
||||||
|
- gltfio: fix precision in KHR_texture_transform.
|
||||||
|
- java: Removed support for Java desktop targets (macOS, Linux, and Windows) [⚠️ **API Change**].
|
||||||
|
|
||||||
|
## v1.10.7
|
||||||
|
|
||||||
|
- engine: Spot-light position calculation moved to fragment shader.
|
||||||
|
- engine: Small shadow mapping fixes and improvements.
|
||||||
|
- gltfio: Add fast path for native material providers.
|
||||||
|
- gltfio: Allow Java / Kotlin clients to customize MaterialProvider.
|
||||||
|
- engine: Fix out of bounds access with `RenderTarget` java bindings.
|
||||||
|
- Metal: `TextureFormat::DEPTH24_STENCIL8` now maps to a 32 bit depth format on iOS.
|
||||||
|
|
||||||
|
## v1.10.6
|
||||||
|
|
||||||
|
- engine: Use exponential VSM and improve VSM user settings [⚠️ **Recompile Materials for VSM**].
|
||||||
|
- engine: Optional blurring of VSM shadowmaps.
|
||||||
|
- engine: Fix a crash when using lens flares.
|
||||||
|
- engine: Fix backend crashes when using an unsupported sample count.
|
||||||
|
- gltfio: Add new `getAsset`API to `FilamentInstance`.
|
||||||
|
- gltfio: Introduce support for extras strings.
|
||||||
|
- OpenGL: Increase OpenGL backend handle arena from 2 to 4 MiB.
|
||||||
|
- Vulkan: Fix Texture swizzle support.
|
||||||
|
|
||||||
|
## v1.10.5
|
||||||
|
|
||||||
|
- android: AAR libraries now properly include their ProGuard rules.
|
||||||
|
- engine: User materials can now provide custom lighting/surface shading, please consult
|
||||||
|
the [materials documentation](https://google.github.io/filament/Materials.html) for details.
|
||||||
|
- engine: `Backend::DEFAULT` now selects the most appropriate backend for the platform, rather than
|
||||||
|
always `OPENGL`. On Android the default is `OPENGL`, on Apple platforms the default is `METAL` and
|
||||||
|
on all other platforms that default is `VULKAN`.
|
||||||
|
- engine: Fix a potential memory corruption when using more than 4 render targets.
|
||||||
|
- engine: Fix a possible crash when bloom is enabled.
|
||||||
|
- engine: Fix and refactor support for S3TC + SRGB with OpenGL.
|
||||||
|
- engine: Fix automatic clearing of rendertargets.
|
||||||
|
- engine: Fix imported render target discard and clear flags.
|
||||||
|
- engine: Fix opaque blit with imported render targets.
|
||||||
|
|
||||||
|
## v1.10.4
|
||||||
|
|
||||||
|
- engine: improvements to internal job system.
|
||||||
|
- Vulkan: performance improvements on Mali.
|
||||||
|
- gltfio: improvements to load time for large models.
|
||||||
|
- WebGL: remove bogus stride argument, fix `BindingType` TypeScript definition.
|
||||||
|
|
||||||
|
## v1.10.3
|
||||||
|
|
||||||
|
- android: use `debug.filament.backend` system property to select the desired backend.
|
||||||
|
- engine: fix `LightManager::getFalloff`.
|
||||||
|
- gltfio: fix crash with non-triangles.
|
||||||
|
- macOS: fix main thread checker warnings with OpenGL.
|
||||||
|
- vulkan: fix crash on Windows machines with NVIDIA GPUs.
|
||||||
|
|
||||||
|
## v1.10.2
|
||||||
|
|
||||||
|
- Vulkan: validation and diagnostic improvements
|
||||||
|
- engine: improvements for scenes with many renderables.
|
||||||
|
- gltfio: added support for `KHR_materials_ior`.
|
||||||
|
- java: Add bindings for `IBLPrefilterContext`.
|
||||||
|
- java: add `KTXLoader.getSphericalHarmonics` JNI binding
|
||||||
|
- libimage: fix, respect sRGB option for compressed formats.
|
||||||
|
- sample-gltf-viewer: fix lifetime cycle for RemoteServer.
|
||||||
|
|
||||||
|
## v1.10.1
|
||||||
|
|
||||||
|
- engine: Add `getPlatform` API to Engine.
|
||||||
|
- engine: Add a new cone angles API to `LightManager`.
|
||||||
|
- engine: Attachments of custom RendereTargets are not systematically discarded.
|
||||||
|
- engine: Fix a crash when using custom rendertargets.
|
||||||
|
- engine: New API to duplicate a `MaterialInstance`.
|
||||||
|
- filagui: fix support for custom images in ImGuiHelper.
|
||||||
|
- java: Add bindings for HDRLoader.
|
||||||
|
|
||||||
|
## v1.10.0
|
||||||
|
|
||||||
|
- engine: User materials can now use 9 samplers instead of 8 [⚠️ **Material breakage**].
|
||||||
|
- engine: Remove `populateTangentQuaternions` [⚠️ **API change**].
|
||||||
|
- engine: Deprecate `Stream::Builder::stream(intptr_t)` [⚠️ **API Change**].
|
||||||
|
- engine: Remove deprecated APIs: `Camera::setScaling`, `Engine::destroy(Camera*)`,
|
||||||
|
`Engine::createCamera`, `Renderer::beginFrame(SwapChain*, uint64_t,
|
||||||
|
backend::FrameScheduledCallback, void*)`, and `View::setShadowsEnabled` [⚠️ **API Change**].
|
||||||
|
- engine: Remove `focusDistance` from `View::BloomOptions` [⚠️ **API Change**].
|
||||||
|
- engine: Add a `FILAMENT_SUPPORTS_OPENGL` CMake option to enable/disable OpenGL support.
|
||||||
|
- Vulkan: fixes and improvements for large scenes.
|
||||||
|
- gltfio: fix morphing bugs uncovered by MorphStressTest.
|
||||||
|
- Java: add API for `Texture::Builder::import()`.
|
||||||
|
- WebGL: Fix a potential INVALID_OPERATION.
|
||||||
|
|
||||||
|
## v1.9.25
|
||||||
|
|
||||||
|
- NEW API: Screen-space lens flare effect.
|
||||||
|
- engine: Fix several memory leaks in the GL backend.
|
||||||
|
- Vulkan: General bug fixes and improvements.
|
||||||
|
- Vulkan: Fix some problems seen on Mali devices.
|
||||||
|
- ios: Fix VSM shadows not working.
|
||||||
|
- webgl: Fix black screen seen with some samples.
|
||||||
|
|
||||||
|
## v1.9.24
|
||||||
|
|
||||||
|
- engine: Fix memory leaks in OpenGL driver.
|
||||||
|
- engine: new experimental tone mapper, `EVILS` (name will most likely change).
|
||||||
|
- engine: Improvements to Vulkan backend.
|
||||||
|
- engine: Fix incorrect units documented for `LightManager.getIntensity`.
|
||||||
|
- engine: fix high quality upsampling for SSAO.
|
||||||
|
- engine: implement accurate normal reconstruction for SSAO.
|
||||||
|
- engine: improve LOW and HIGH quality levels for SSAO.
|
||||||
|
- libs: improvements to `libiblprefilter`.
|
||||||
|
- materials: New `quality` property.
|
||||||
|
- samples: Add new gltf-viewer iOS sample.
|
||||||
|
- samples: clear the background in lightbulb sample.
|
||||||
|
|
||||||
|
## v1.9.23
|
||||||
|
|
||||||
|
- Vulkan: various fixes.
|
||||||
|
- android: fix crash seen using VSM with MSAA on Adreno devices.
|
||||||
|
- engine: Add `Engine::getEntityManager()`.
|
||||||
|
- engine: Fix desktop crash seen with some GPU drivers.
|
||||||
|
- engine: improve importance sampling.
|
||||||
|
- gltfio: robustness improvements for Draco meshes.
|
||||||
|
- libs: Add new Transcoder API for C++ clients (part of `libgeometry`).
|
||||||
|
- libs: New `iblprefilter` library to compute IBL pre-integration on the GPU using filament.
|
||||||
|
- materials: Fix documentation for `getNormalizedViewportCoord`.
|
||||||
|
- samples: fix rendertarget sample crash on launch.
|
||||||
|
|
||||||
|
## v1.9.22
|
||||||
|
|
||||||
|
- NEW API: `Renderer::renderStandaloneView()` is a new method that can be used outside of
|
||||||
|
beginFrame/endFrame on Views that have a RenderTarget associated. This can be used as a
|
||||||
|
pseudo-compute API.
|
||||||
|
- Vulkan: bug fixes and improvements.
|
||||||
|
- engine: RenderTarget API can now use MRT.
|
||||||
|
- sample-gltf-viewer: improvements for reading zip files.
|
||||||
|
- sample-gltf-viewer: enable contact-shadows functionality in mobile gltf-viewer.
|
||||||
|
- windows: fix build error in filament_framegraph_test.
|
||||||
|
|
||||||
|
## v1.9.21
|
||||||
|
|
||||||
|
- JavaScript: add missing TextureSampler bindings.
|
||||||
|
- Metal: Fix texture swizzling crash with older Nvidia GPUs.
|
||||||
|
- Vulkan: fix image layout validation error on Android.
|
||||||
|
- android: fix MSAA w/ multisampled_render_to_texture on Mali.
|
||||||
|
- engine: better anisotropic filtering with various drivers.
|
||||||
|
- gltfio: Use BufferObject API, simplify MorphHelper.
|
||||||
|
- gltfio: honor stride in normalizeSkinningWeights.
|
||||||
|
- samples: Add web component demo.
|
||||||
|
|
||||||
|
## v1.9.20
|
||||||
|
|
||||||
|
- Android: Fix VSM.
|
||||||
|
- engine: Introduce BufferObject API.
|
||||||
|
- engine: Add new isTextureSwizzleSupported API on Texture.
|
||||||
|
- engine: Add support to Metal and Vulkan backends for texture swizzling.
|
||||||
|
- engine: Add new DoF settings (native/half res, gather kernel ring counts, CoC radius clamp).
|
||||||
|
- engine: DoF quality and performance improvements.
|
||||||
|
- engine: Fix high-quality upsampling issue with SSAO.
|
||||||
|
- Java: Expose `TransformManager.getParent(int)`.
|
||||||
|
- samples: Add Metal and Vulkan backend support to Suzanne sample.
|
||||||
|
- WebGL: expose fitIntoUnitCube to JS.
|
||||||
|
- WebGL: support for multiple `<canvas>` elements.
|
||||||
|
|
||||||
|
## v1.9.19
|
||||||
|
|
||||||
|
- engine: Fix Metal bug when setGeometryAt is called multiple times.
|
||||||
|
- engine: Improvements to DoF.
|
||||||
|
- engine: Fix RenderTarget NPE when depth is not present.
|
||||||
|
- engine: Improvements to Camera APIs. Move focus distance from DofOptions to Camera.
|
||||||
|
- engine: VSM shadows now support `shadowMultiplier`.
|
||||||
|
- java: Expose several MaterialInstance APIs (setColorWrite, setDepthWrite, setDepthCulling) that
|
||||||
|
should have been public.
|
||||||
|
- java: fix bug with Texture::setImage buffer size calculation.
|
||||||
|
|
||||||
|
## v1.9.18
|
||||||
|
|
||||||
|
- engine: Fix a DoF bug that caused black dots around the fast tiles.
|
||||||
|
- engine: Minor DoF optimizations.
|
||||||
|
- engine: Fix blanking windows not being drawn into on macOS.
|
||||||
|
- gltfio: Add support for data:// in image URI's.
|
||||||
|
- gltfio: Add internal MorphHelper, enable up to 255 targets.
|
||||||
|
- engine: Fix a hang in JobSystem.
|
||||||
|
- samples: Fix rendertarget sample app.
|
||||||
|
|
||||||
|
## v1.9.17
|
||||||
|
|
||||||
|
- engine: New shift parameter on `Camera` to translate the viewport and emulate a tilt/shift lens.
|
||||||
|
- engine: `Camera::setCustomProjection()` now allows to set a different projection for culling and rendering.
|
||||||
|
- engine: Fixed depth of field rendering with custom projection matrices.
|
||||||
|
- engine: Fix a rare indefinite hang.
|
||||||
|
- gltfio: `SimpleViewer` now exposes more rendering parameters, including `ColorGrading`.
|
||||||
|
- gltfio: Fix tangents when morphing is enabled.
|
||||||
|
- Metal/Vulkan: fix incorrect dominant light shadows rendering.
|
||||||
|
- Fixe some issues with imported rendertargets.
|
||||||
|
|
||||||
|
## v1.9.16
|
||||||
|
|
||||||
|
gltfio: Add ResourceLoader evict API.
|
||||||
|
gltfio: Fix ResourceLoader cache bug.
|
||||||
|
iOS: Disable exceptions to reduce binary size.
|
||||||
|
|
||||||
|
## v1.9.15
|
||||||
|
|
||||||
|
- filamat/matc: fix sporadic crash.
|
||||||
|
|
||||||
## v1.9.14
|
## v1.9.14
|
||||||
|
|
||||||
|
|||||||
+5
-5
@@ -122,20 +122,20 @@ The Gradle project used to generate the AAR is located at `<filament>\android`.
|
|||||||
|
|
||||||
```
|
```
|
||||||
cd android
|
cd android
|
||||||
gradlew -Pfilament_dist_dir=..\out\android-release\filament assembleRelease
|
gradlew -Pcom.google.android.filament.dist-dir=..\out\android-release\filament assembleRelease
|
||||||
copy filament-android\build\outputs\aar\filament-android-release.aar ..\..\out\
|
copy filament-android\build\outputs\aar\filament-android-release.aar ..\..\out\
|
||||||
```
|
```
|
||||||
|
|
||||||
If you're only interested in building for a single ABI, you'll need to pass a `filament_abis` parameter:
|
If you're only interested in building for a single ABI, you'll need to pass a `com.google.android.filament.abis` parameter:
|
||||||
|
|
||||||
```
|
```
|
||||||
gradlew -Pfilament_dist_dir=..\out\android-release\filament assembleRelease -Pfilament_abis=x86
|
gradlew -Pcom.google.android.filament.dist-dir=..\out\android-release\filament assembleRelease -Pcom.google.android.filament.abis=x86
|
||||||
```
|
```
|
||||||
|
|
||||||
If you're only interested in building SDK, you may skip samples build by passing a `filament_skip_samples` flag:
|
If you're only interested in building SDK, you may skip samples build by passing a `com.google.android.filament.skip-samples` flag:
|
||||||
|
|
||||||
```
|
```
|
||||||
gradlew -Pfilament_dist_dir=..\out\android-release\filament assembleRelease -Pfilament_skip_samples
|
gradlew -Pcom.google.android.filament.dist-dir=..\out\android-release\filament assembleRelease -Pcom.google.android.filament.skip-samples
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+85
-47
@@ -1,38 +1,43 @@
|
|||||||
// This script accepts the following parameters:
|
// This script accepts the following parameters:
|
||||||
//
|
//
|
||||||
// filament_dist_dir
|
// com.google.android.filament.dist-dir
|
||||||
// Path to the Filament distribution/install directory for Android
|
// Path to the Filament distribution/install directory for Android
|
||||||
// (produced by make/ninja install). This directory must contain lib/arm64-v8a/ etc.
|
// (produced by make/ninja install). This directory must contain lib/arm64-v8a/ etc.
|
||||||
//
|
//
|
||||||
// filament_tools_dir
|
// com.google.android.filament.tools-dir
|
||||||
// Path to the Filament distribution/install directory for desktop.
|
// Path to the Filament distribution/install directory for desktop.
|
||||||
// This directory must contain bin/matc.
|
// This directory must contain bin/matc.
|
||||||
//
|
//
|
||||||
// filament_exclude_vulkan
|
// com.google.android.filament.exclude-vulkan
|
||||||
// When set, support for Vulkan will be excluded.
|
// When set, support for Vulkan will be excluded.
|
||||||
//
|
//
|
||||||
// filament_skip_samples
|
// com.google.android.filament.matdbg
|
||||||
|
// When set, enables matdbg
|
||||||
|
//
|
||||||
|
// com.google.android.filament.matnopt
|
||||||
|
// When set, disable shader optimizations.
|
||||||
|
//
|
||||||
|
// com.google.android.filament.skip-samples
|
||||||
// Exclude samples from the project. Useful to speed up compilation.
|
// Exclude samples from the project. Useful to speed up compilation.
|
||||||
//
|
//
|
||||||
// filament_abis
|
// com.google.android.filament.abis
|
||||||
// List of supported ABIs to build as a comma separated list. Available options are:
|
// List of supported ABIs to build as a comma separated list. Available options are:
|
||||||
// arm64-v8a, armeabi-v7a, x86_64, x86, all
|
// arm64-v8a, armeabi-v7a, x86_64, x86, all
|
||||||
// Defaults to all.
|
// Defaults to all.
|
||||||
//
|
//
|
||||||
// Example:
|
// Example:
|
||||||
// ./gradlew -Pfilament_dist_dir=../dist-android-release assembleRelease -Pfilament_abis=x86
|
// ./gradlew -Pcom.google.android.filament.dist-dir=../dist-android-release \
|
||||||
|
// -Pcom.google.android.filament.abis=x86 \
|
||||||
|
// assembleRelease
|
||||||
|
|
||||||
// Publishing to Maven Central:
|
// Publishing to Maven Central:
|
||||||
// - Build and upload artifacts with ./gradlew publish
|
// - Build and upload artifacts with ./gradlew publish
|
||||||
// - Close and release staging repo on Nexus with ./gradlew closeAndReleaseRepository
|
// - Close and release staging repo on Nexus with ./gradlew closeAndReleaseStagingRepository
|
||||||
//
|
//
|
||||||
// The following is needed in ~/gradle/gradle.properties:
|
// The following is needed in ~/gradle/gradle.properties:
|
||||||
//
|
//
|
||||||
// SONATYPE_NEXUS_USERNAME=nexus_user
|
// sonatypeUsername=nexus_user
|
||||||
// SONATYPE_NEXUS_PASSWORD=nexus_password
|
// sonatypePassword=nexus_password
|
||||||
//
|
|
||||||
// nexusUsername=nexus_user
|
|
||||||
// nexusPassword=nexus_password
|
|
||||||
//
|
//
|
||||||
// signing.keyId=pgp_key_id
|
// signing.keyId=pgp_key_id
|
||||||
// signing.password=pgp_key_password
|
// signing.password=pgp_key_password
|
||||||
@@ -40,75 +45,102 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
def filamentPath = file("../out/android-release/filament").absolutePath
|
def path = providers
|
||||||
if (project.hasProperty("filament_dist_dir")) {
|
.gradleProperty("com.google.android.filament.dist-dir")
|
||||||
filamentPath = file(project.property("filament_dist_dir")).absolutePath
|
.get()
|
||||||
}
|
|
||||||
|
def directory = objects.fileProperty().fileValue(new File(path)).getAsFile().get()
|
||||||
|
def filamentPath = directory.absolutePath
|
||||||
|
|
||||||
// Our CMake scripts require a forward-slash path for the FILAMENT_DIST_DIR
|
// Our CMake scripts require a forward-slash path for the FILAMENT_DIST_DIR
|
||||||
// variable, so here we convert the native path to a forward-slash path.
|
// variable, so here we convert the native path to a forward-slash path.
|
||||||
filamentPath = filamentPath.replace(File.separator, '/')
|
filamentPath = filamentPath.replace(File.separator, '/')
|
||||||
|
|
||||||
// Warning: changing this property does not work well with incremental builds.
|
// Warning: changing this property does not work well with incremental builds.
|
||||||
def excludeVulkan = project.hasProperty("filament_exclude_vulkan")
|
def excludeVulkan = providers
|
||||||
|
.gradleProperty("com.google.android.filament.exclude-vulkan")
|
||||||
|
.isPresent()
|
||||||
|
|
||||||
|
def matdbg = providers
|
||||||
|
.gradleProperty("com.google.android.filament.matdbg")
|
||||||
|
.isPresent()
|
||||||
|
|
||||||
|
def matnopt = providers
|
||||||
|
.gradleProperty("com.google.android.filament.matnopt")
|
||||||
|
.isPresent()
|
||||||
|
|
||||||
def abis = ["arm64-v8a", "armeabi-v7a", "x86_64", "x86"]
|
def abis = ["arm64-v8a", "armeabi-v7a", "x86_64", "x86"]
|
||||||
if (project.hasProperty("filament_abis")) {
|
def newAbis = providers
|
||||||
def newAbis = project.property("filament_abis").split(',')
|
.gradleProperty("com.google.android.filament.abis")
|
||||||
if (!newAbis.contains("all")) {
|
.get()
|
||||||
abis = newAbis
|
.split(',')
|
||||||
}
|
if (!newAbis.contains("all")) {
|
||||||
|
abis = newAbis
|
||||||
}
|
}
|
||||||
|
|
||||||
// Our minSdkVersion is 19.
|
|
||||||
ext.versions = [
|
ext.versions = [
|
||||||
|
'jdk': 17,
|
||||||
'minSdk': 19,
|
'minSdk': 19,
|
||||||
'targetSdk': 30,
|
'targetSdk': 33,
|
||||||
'compileSdk': 30,
|
'compileSdk': 33,
|
||||||
'kotlin': '1.4.30',
|
'kotlin': '1.9.0',
|
||||||
'buildTools': '30.0.3',
|
'kotlin_coroutines': '1.7.2',
|
||||||
'ndk': '22.0.7026061'
|
'buildTools': '34.0.0',
|
||||||
|
'ndk': '25.1.8937393',
|
||||||
|
'androidx_core': '1.10.1',
|
||||||
|
'androidx_annotations': '1.6.0'
|
||||||
]
|
]
|
||||||
|
|
||||||
ext.deps = [
|
ext.deps = [
|
||||||
'androidx': [
|
'androidx': [
|
||||||
'annotations': "androidx.annotation:annotation:1.1.0",
|
'annotations': "androidx.annotation:annotation:${versions.androidx_annotations}",
|
||||||
'core': "androidx.core:core:1.3.0",
|
'core': "androidx.core:core:${versions.androidx_core}",
|
||||||
],
|
],
|
||||||
'kotlin': "org.jetbrains.kotlin:kotlin-stdlib-jdk8:${versions.kotlin}"
|
'kotlin': "org.jetbrains.kotlin:kotlin-stdlib-jdk8:${versions.kotlin}",
|
||||||
|
'coroutines': [
|
||||||
|
'core': "org.jetbrains.kotlinx:kotlinx-coroutines-core:${versions.kotlin_coroutines}",
|
||||||
|
'android': "org.jetbrains.kotlinx:kotlinx-coroutines-android:${versions.kotlin_coroutines}",
|
||||||
|
]
|
||||||
]
|
]
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:4.1.2'
|
classpath 'com.android.tools.build:gradle:8.1.0'
|
||||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${versions.kotlin}"
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${versions.kotlin}"
|
||||||
}
|
}
|
||||||
|
|
||||||
ext.cmakeArgs = [
|
ext.cmakeArgs = [
|
||||||
|
"--no-warn-unused-cli",
|
||||||
"-DANDROID_PIE=ON",
|
"-DANDROID_PIE=ON",
|
||||||
"-DANDROID_PLATFORM=21",
|
"-DANDROID_PLATFORM=21",
|
||||||
"-DANDROID_STL=c++_static",
|
"-DANDROID_STL=c++_static",
|
||||||
"-DFILAMENT_DIST_DIR=${filamentPath}".toString(),
|
"-DFILAMENT_DIST_DIR=${filamentPath}".toString(),
|
||||||
"-DFILAMENT_SUPPORTS_VULKAN=${excludeVulkan ? 'OFF' : 'ON'}".toString()
|
"-DFILAMENT_SUPPORTS_VULKAN=${excludeVulkan ? 'OFF' : 'ON'}".toString(),
|
||||||
|
"-DFILAMENT_ENABLE_MATDBG=${matdbg ? 'ON' : 'OFF'}".toString(),
|
||||||
|
"-DFILAMENT_DISABLE_MATOPT=${matnopt ? 'ON' : 'OFF'}".toString()
|
||||||
]
|
]
|
||||||
|
|
||||||
ext.cppFlags = [
|
ext.cppFlags = [
|
||||||
"-std=c++17",
|
"-std=c++17",
|
||||||
"-Wno-unused-command-line-argument",
|
|
||||||
// Required to support API levels below 23
|
|
||||||
"-Wl,--hash-style=both",
|
|
||||||
"-fno-stack-protector",
|
"-fno-stack-protector",
|
||||||
"-fno-exceptions",
|
"-fno-exceptions",
|
||||||
"-fno-unwind-tables",
|
"-fno-unwind-tables",
|
||||||
"-fno-asynchronous-unwind-tables",
|
"-fno-asynchronous-unwind-tables",
|
||||||
"-fno-rtti",
|
"-fno-rtti",
|
||||||
"-ffast-math",
|
"-ffast-math",
|
||||||
|
"-fno-finite-math-only",
|
||||||
"-ffp-contract=fast",
|
"-ffp-contract=fast",
|
||||||
"-fvisibility-inlines-hidden",
|
"-fvisibility-inlines-hidden",
|
||||||
"-fvisibility=hidden",
|
"-fvisibility=hidden",
|
||||||
"-fomit-frame-pointer",
|
"-fomit-frame-pointer",
|
||||||
"-ffunction-sections",
|
"-ffunction-sections",
|
||||||
"-fdata-sections",
|
"-fdata-sections",
|
||||||
|
"-no-canonical-prefixes",
|
||||||
|
"-Wformat",
|
||||||
|
"-Werror=format-security",
|
||||||
|
"-Wno-unused-command-line-argument",
|
||||||
"-Wl,--gc-sections",
|
"-Wl,--gc-sections",
|
||||||
"-Wl,-Bsymbolic-functions",
|
"-Wl,-Bsymbolic-functions",
|
||||||
|
"-Wl,--hash-style=both", // Required to support API levels below 23
|
||||||
]
|
]
|
||||||
|
|
||||||
ext.abis = abis
|
ext.abis = abis
|
||||||
@@ -116,19 +148,22 @@ buildscript {
|
|||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
google()
|
google()
|
||||||
jcenter()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id 'io.codearte.nexus-staging' version '0.22.0'
|
id "io.github.gradle-nexus.publish-plugin" version "1.3.0"
|
||||||
}
|
}
|
||||||
|
|
||||||
// Nexus Staging configuration
|
// See https://github.com/gradle-nexus/publish-plugin
|
||||||
// See https://github.com/Codearte/gradle-nexus-staging-plugin/
|
// Publish to https://oss.sonatype.org/ (not s01)
|
||||||
nexusStaging {
|
nexusPublishing {
|
||||||
packageGroup = 'com.google.android'
|
packageGroup = 'com.google.android'
|
||||||
stagingProfileId = '9a75a224a4f17b'
|
repositories {
|
||||||
|
sonatype {
|
||||||
|
stagingProfileId = '9a75a224a4f17b'
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
subprojects {
|
subprojects {
|
||||||
@@ -138,7 +173,6 @@ subprojects {
|
|||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
google()
|
google()
|
||||||
jcenter()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!name.startsWith("sample")) {
|
if (!name.startsWith("sample")) {
|
||||||
@@ -161,13 +195,16 @@ subprojects {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ndk {
|
ndk {
|
||||||
|
//noinspection ChromeOsAbiSupport
|
||||||
abiFilters(*rootProject.ext.abis)
|
abiFilters(*rootProject.ext.abis)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
consumerProguardFiles '../proguard-rules.pro'
|
||||||
|
}
|
||||||
|
|
||||||
externalNativeBuild {
|
externalNativeBuild {
|
||||||
cmake {
|
cmake {
|
||||||
|
version "3.19.0+"
|
||||||
path "CMakeLists.txt"
|
path "CMakeLists.txt"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -179,8 +216,8 @@ subprojects {
|
|||||||
}
|
}
|
||||||
|
|
||||||
compileOptions {
|
compileOptions {
|
||||||
sourceCompatibility JavaVersion.VERSION_1_8
|
sourceCompatibility versions.jdk
|
||||||
targetCompatibility JavaVersion.VERSION_1_8
|
targetCompatibility versions.jdk
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -189,7 +226,8 @@ subprojects {
|
|||||||
gradle.taskGraph.whenReady {
|
gradle.taskGraph.whenReady {
|
||||||
gradle.taskGraph.allTasks.each {
|
gradle.taskGraph.allTasks.each {
|
||||||
it.onlyIf {
|
it.onlyIf {
|
||||||
!it.project.ext.has('isSample') || !project.hasProperty('filament_skip_samples')
|
!it.project.ext.has('isSample') ||
|
||||||
|
!project.hasProperty('com.google.android.filament.skip-samples')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,16 @@
|
|||||||
|
plugins {
|
||||||
|
id 'groovy-gradle-plugin'
|
||||||
|
}
|
||||||
|
|
||||||
|
gradlePlugin {
|
||||||
|
plugins {
|
||||||
|
create("filament-tools-plugin") {
|
||||||
|
id = "filament-tools-plugin"
|
||||||
|
implementationClass = "FilamentToolsPlugin"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,56 +1,72 @@
|
|||||||
// This plugin accepts the following parameters:
|
// This plugin accepts the following parameters:
|
||||||
//
|
//
|
||||||
// filament_tools_dir
|
// com.google.android.filament.tools-dir
|
||||||
// Path to the Filament distribution/install directory for desktop.
|
// Path to the Filament distribution/install directory for desktop.
|
||||||
// This directory must contain bin/matc.
|
// This directory must contain bin/matc.
|
||||||
//
|
//
|
||||||
// filament_exclude_vulkan
|
// com.google.android.filament.exclude-vulkan
|
||||||
// When set, support for Vulkan will be excluded.
|
// When set, support for Vulkan will be excluded.
|
||||||
//
|
//
|
||||||
// Example:
|
// Example:
|
||||||
// ./gradlew -Pfilament_tools_dir=../../dist-release assembleDebug
|
// ./gradlew -Pcom.google.android.filament.tools-dir=../../dist-release assembleDebug
|
||||||
|
|
||||||
import org.gradle.api.DefaultTask
|
import org.gradle.api.DefaultTask
|
||||||
import org.gradle.api.GradleException
|
import org.gradle.api.GradleException
|
||||||
import org.gradle.api.Plugin
|
import org.gradle.api.Plugin
|
||||||
import org.gradle.api.Project
|
import org.gradle.api.Project
|
||||||
|
import org.gradle.api.provider.ProviderFactory
|
||||||
import org.gradle.api.file.DirectoryProperty
|
import org.gradle.api.file.DirectoryProperty
|
||||||
|
import org.gradle.api.file.FileSystemOperations
|
||||||
import org.gradle.api.file.FileType
|
import org.gradle.api.file.FileType
|
||||||
import org.gradle.api.file.RegularFileProperty
|
import org.gradle.api.file.RegularFileProperty
|
||||||
import org.gradle.api.logging.LogLevel
|
import org.gradle.api.logging.LogLevel
|
||||||
import org.gradle.api.logging.Logger
|
import org.gradle.api.logging.Logger
|
||||||
|
import org.gradle.api.provider.Property
|
||||||
|
import org.gradle.api.tasks.Input
|
||||||
import org.gradle.api.tasks.InputDirectory
|
import org.gradle.api.tasks.InputDirectory
|
||||||
import org.gradle.api.tasks.InputFile
|
import org.gradle.api.tasks.InputFile
|
||||||
|
import org.gradle.api.tasks.Optional
|
||||||
import org.gradle.api.tasks.OutputDirectory
|
import org.gradle.api.tasks.OutputDirectory
|
||||||
import org.gradle.api.tasks.TaskAction
|
import org.gradle.api.tasks.TaskAction
|
||||||
import org.gradle.api.tasks.incremental.InputFileDetails
|
import org.gradle.api.tasks.incremental.InputFileDetails
|
||||||
|
import org.gradle.api.model.ObjectFactory
|
||||||
import org.gradle.internal.os.OperatingSystem
|
import org.gradle.internal.os.OperatingSystem
|
||||||
|
import org.gradle.process.ExecOperations
|
||||||
import org.gradle.work.ChangeType
|
import org.gradle.work.ChangeType
|
||||||
import org.gradle.work.Incremental
|
import org.gradle.work.Incremental
|
||||||
import org.gradle.work.InputChanges
|
import org.gradle.work.InputChanges
|
||||||
|
|
||||||
import java.nio.file.Paths
|
import java.nio.file.Paths
|
||||||
|
|
||||||
class TaskWithBinary extends DefaultTask {
|
import javax.inject.Inject
|
||||||
|
|
||||||
|
abstract class TaskWithBinary extends DefaultTask {
|
||||||
private final String binaryName
|
private final String binaryName
|
||||||
private File binaryPath = null
|
private Property<String> binaryPath = null
|
||||||
|
|
||||||
TaskWithBinary(String name) {
|
TaskWithBinary(String name) {
|
||||||
binaryName = name
|
binaryName = name
|
||||||
}
|
}
|
||||||
|
|
||||||
String getBinaryName() {
|
@Inject abstract ObjectFactory getObjects()
|
||||||
return binaryName
|
@Inject abstract ProviderFactory getProviders()
|
||||||
}
|
|
||||||
|
|
||||||
File getBinary() {
|
@Input
|
||||||
|
Property<String> getBinary() {
|
||||||
if (binaryPath == null) {
|
if (binaryPath == null) {
|
||||||
def tool = ["/bin/${binaryName}.exe", "/bin/${binaryName}"]
|
def tool = ["/bin/${binaryName}.exe", "/bin/${binaryName}"]
|
||||||
def fullPath = tool.collect { path ->
|
def fullPath = tool.collect { path ->
|
||||||
Paths.get(project.ext.filamentToolsPath.absolutePath, path).toFile()
|
def filamentToolsPath = providers
|
||||||
|
.gradleProperty("com.google.android.filament.tools-dir")
|
||||||
|
.forUseAtConfigurationTime().get()
|
||||||
|
def directory = objects.fileProperty()
|
||||||
|
.fileValue(new File(filamentToolsPath)).getAsFile().get()
|
||||||
|
Paths.get(directory.absolutePath, path).toFile()
|
||||||
}
|
}
|
||||||
|
|
||||||
binaryPath = OperatingSystem.current().isWindows() ? fullPath[0] : fullPath[1]
|
binaryPath = objects.property(String.class)
|
||||||
|
binaryPath.set(
|
||||||
|
(OperatingSystem.current().isWindows() ? fullPath[0] : fullPath[1]).toString())
|
||||||
}
|
}
|
||||||
return binaryPath
|
return binaryPath
|
||||||
}
|
}
|
||||||
@@ -65,14 +81,6 @@ class LogOutputStream extends ByteArrayOutputStream {
|
|||||||
this.level = level
|
this.level = level
|
||||||
}
|
}
|
||||||
|
|
||||||
Logger getLogger() {
|
|
||||||
return logger
|
|
||||||
}
|
|
||||||
|
|
||||||
LogLevel getLevel() {
|
|
||||||
return level
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
void flush() {
|
void flush() {
|
||||||
logger.log(level, toString())
|
logger.log(level, toString())
|
||||||
@@ -85,10 +93,15 @@ class LogOutputStream extends ByteArrayOutputStream {
|
|||||||
abstract class MaterialCompiler extends TaskWithBinary {
|
abstract class MaterialCompiler extends TaskWithBinary {
|
||||||
@Incremental
|
@Incremental
|
||||||
@InputDirectory
|
@InputDirectory
|
||||||
final DirectoryProperty inputDir = project.objects.directoryProperty()
|
abstract DirectoryProperty getInputDir()
|
||||||
|
|
||||||
@OutputDirectory
|
@OutputDirectory
|
||||||
final DirectoryProperty outputDir = project.objects.directoryProperty()
|
abstract DirectoryProperty getOutputDir()
|
||||||
|
|
||||||
|
@Inject abstract FileSystemOperations getFs()
|
||||||
|
@Inject abstract ExecOperations getExec()
|
||||||
|
@Inject abstract ObjectFactory getObjects()
|
||||||
|
@Inject abstract ProviderFactory getProviders()
|
||||||
|
|
||||||
MaterialCompiler() {
|
MaterialCompiler() {
|
||||||
super("matc")
|
super("matc")
|
||||||
@@ -97,7 +110,9 @@ abstract class MaterialCompiler extends TaskWithBinary {
|
|||||||
@TaskAction
|
@TaskAction
|
||||||
void execute(InputChanges inputs) {
|
void execute(InputChanges inputs) {
|
||||||
if (!inputs.incremental) {
|
if (!inputs.incremental) {
|
||||||
project.delete(project.fileTree(outputDir.asFile.get()).matching { include '*.filamat' })
|
fs.delete({
|
||||||
|
delete(objects.fileTree().from(outputDir).matching { include '*.filamat' })
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
inputs.getFileChanges(inputDir).each { InputFileDetails change ->
|
inputs.getFileChanges(inputDir).each { InputFileDetails change ->
|
||||||
@@ -115,21 +130,32 @@ abstract class MaterialCompiler extends TaskWithBinary {
|
|||||||
out.write(header)
|
out.write(header)
|
||||||
out.flush()
|
out.flush()
|
||||||
|
|
||||||
if (!getBinary().exists()) {
|
if (!new File(binary.get()).exists()) {
|
||||||
throw new GradleException("Could not find ${getBinary()}." +
|
throw new GradleException("Could not find ${binary.get()}." +
|
||||||
" Ensure Filament has been built/installed before building this app.")
|
" Ensure Filament has been built/installed before building this app.")
|
||||||
}
|
}
|
||||||
|
|
||||||
def matcArgs = []
|
def matcArgs = []
|
||||||
if (!project.hasProperty("filament_exclude_vulkan")) {
|
def exclude_vulkan = providers
|
||||||
|
.gradleProperty("com.google.android.filament.exclude-vulkan")
|
||||||
|
.forUseAtConfigurationTime().present
|
||||||
|
if (!exclude_vulkan) {
|
||||||
matcArgs += ['-a', 'vulkan']
|
matcArgs += ['-a', 'vulkan']
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def mat_no_opt = providers
|
||||||
|
.gradleProperty("com.google.android.filament.matnopt")
|
||||||
|
.forUseAtConfigurationTime().present
|
||||||
|
if (mat_no_opt) {
|
||||||
|
matcArgs += ['-g']
|
||||||
|
}
|
||||||
|
|
||||||
matcArgs += ['-a', 'opengl', '-p', 'mobile', '-o', getOutputFile(file), file]
|
matcArgs += ['-a', 'opengl', '-p', 'mobile', '-o', getOutputFile(file), file]
|
||||||
|
|
||||||
project.exec {
|
exec.exec {
|
||||||
standardOutput out
|
standardOutput out
|
||||||
errorOutput err
|
errorOutput err
|
||||||
executable "${getBinary()}"
|
executable "${binary.get()}"
|
||||||
args matcArgs
|
args matcArgs
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -143,15 +169,21 @@ abstract class MaterialCompiler extends TaskWithBinary {
|
|||||||
|
|
||||||
// Custom task to process IBLs using cmgen
|
// Custom task to process IBLs using cmgen
|
||||||
// This task handles incremental builds
|
// This task handles incremental builds
|
||||||
class IblGenerator extends TaskWithBinary {
|
abstract class IblGenerator extends TaskWithBinary {
|
||||||
String cmgenArgs = null
|
@Input
|
||||||
|
@Optional
|
||||||
|
abstract Property<String> getCmgenArgs()
|
||||||
|
|
||||||
@Incremental
|
@Incremental
|
||||||
@InputFile
|
@InputFile
|
||||||
final RegularFileProperty inputFile = project.objects.fileProperty()
|
abstract RegularFileProperty getInputFile()
|
||||||
|
|
||||||
@OutputDirectory
|
@OutputDirectory
|
||||||
final DirectoryProperty outputDir = project.objects.directoryProperty()
|
abstract DirectoryProperty getOutputDir()
|
||||||
|
|
||||||
|
@Inject abstract FileSystemOperations getFs()
|
||||||
|
@Inject abstract ExecOperations getExec()
|
||||||
|
@Inject abstract ObjectFactory getObjects()
|
||||||
|
|
||||||
IblGenerator() {
|
IblGenerator() {
|
||||||
super("cmgen")
|
super("cmgen")
|
||||||
@@ -160,7 +192,9 @@ class IblGenerator extends TaskWithBinary {
|
|||||||
@TaskAction
|
@TaskAction
|
||||||
void execute(InputChanges inputs) {
|
void execute(InputChanges inputs) {
|
||||||
if (!inputs.incremental) {
|
if (!inputs.incremental) {
|
||||||
project.delete(project.fileTree(outputDir.asFile.get()).matching { include '*' })
|
fs.delete({
|
||||||
|
delete(objects.fileTree().from(outputDir).matching { include '*' })
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
inputs.getFileChanges(inputFile).each { InputFileDetails change ->
|
inputs.getFileChanges(inputFile).each { InputFileDetails change ->
|
||||||
@@ -178,23 +212,25 @@ class IblGenerator extends TaskWithBinary {
|
|||||||
out.write(header)
|
out.write(header)
|
||||||
out.flush()
|
out.flush()
|
||||||
|
|
||||||
if (!getBinary().exists()) {
|
if (!new File(binary.get()).exists()) {
|
||||||
throw new GradleException("Could not find ${getBinary()}." +
|
throw new GradleException("Could not find ${binary.get()}." +
|
||||||
" Ensure Filament has been built/installed before building this app.")
|
" Ensure Filament has been built/installed before building this app.")
|
||||||
}
|
}
|
||||||
|
|
||||||
def outputPath = outputDir.get().asFile
|
def outputPath = outputDir.get().asFile
|
||||||
project.exec {
|
def commandArgs = cmgenArgs.getOrNull()
|
||||||
|
if (commandArgs == null) {
|
||||||
|
commandArgs =
|
||||||
|
'-q -x ' + outputPath + ' --format=rgb32f ' +
|
||||||
|
'--extract-blur=0.08 --extract=' + outputPath.absolutePath
|
||||||
|
}
|
||||||
|
commandArgs = commandArgs + " " + file
|
||||||
|
|
||||||
|
exec.exec {
|
||||||
standardOutput out
|
standardOutput out
|
||||||
if (!cmgenArgs) {
|
|
||||||
cmgenArgs =
|
|
||||||
'-q -x ' + outputPath + ' --format=rgb32f ' +
|
|
||||||
'--extract-blur=0.08 --extract=' + outputPath.absolutePath
|
|
||||||
}
|
|
||||||
cmgenArgs = cmgenArgs + " " + file
|
|
||||||
errorOutput err
|
errorOutput err
|
||||||
executable "${getBinary()}"
|
executable "${binary.get()}"
|
||||||
args(cmgenArgs.split())
|
args(commandArgs.split())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -207,13 +243,16 @@ class IblGenerator extends TaskWithBinary {
|
|||||||
|
|
||||||
// Custom task to compile mesh files using filamesh
|
// Custom task to compile mesh files using filamesh
|
||||||
// This task handles incremental builds
|
// This task handles incremental builds
|
||||||
class MeshCompiler extends TaskWithBinary {
|
abstract class MeshCompiler extends TaskWithBinary {
|
||||||
@Incremental
|
@Incremental
|
||||||
@InputFile
|
@InputFile
|
||||||
final RegularFileProperty inputFile = project.objects.fileProperty()
|
abstract RegularFileProperty getInputFile()
|
||||||
|
|
||||||
@OutputDirectory
|
@OutputDirectory
|
||||||
final DirectoryProperty outputDir = project.objects.directoryProperty()
|
abstract DirectoryProperty getOutputDir()
|
||||||
|
|
||||||
|
@Inject abstract FileSystemOperations getFs()
|
||||||
|
@Inject abstract ExecOperations getExec()
|
||||||
|
|
||||||
MeshCompiler() {
|
MeshCompiler() {
|
||||||
super("filamesh")
|
super("filamesh")
|
||||||
@@ -222,7 +261,9 @@ class MeshCompiler extends TaskWithBinary {
|
|||||||
@TaskAction
|
@TaskAction
|
||||||
void execute(InputChanges inputs) {
|
void execute(InputChanges inputs) {
|
||||||
if (!inputs.incremental) {
|
if (!inputs.incremental) {
|
||||||
project.delete(project.fileTree(outputDir.asFile.get()).matching { include '*.filamesh' })
|
fs.delete({
|
||||||
|
delete(objects.fileTree().from(outputDir).matching { include '*.filamesh' })
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
inputs.getFileChanges(inputFile).each { InputFileDetails change ->
|
inputs.getFileChanges(inputFile).each { InputFileDetails change ->
|
||||||
@@ -240,15 +281,15 @@ class MeshCompiler extends TaskWithBinary {
|
|||||||
out.write(header)
|
out.write(header)
|
||||||
out.flush()
|
out.flush()
|
||||||
|
|
||||||
if (!getBinary().exists()) {
|
if (!new File(binary.get()).exists()) {
|
||||||
throw new GradleException("Could not find ${getBinary()}." +
|
throw new GradleException("Could not find ${binary.get()}." +
|
||||||
" Ensure Filament has been built/installed before building this app.")
|
" Ensure Filament has been built/installed before building this app.")
|
||||||
}
|
}
|
||||||
|
|
||||||
project.exec {
|
exec.exec {
|
||||||
standardOutput out
|
standardOutput out
|
||||||
errorOutput err
|
errorOutput err
|
||||||
executable "${getBinary()}"
|
executable "${binary.get()}"
|
||||||
args(file, getOutputFile(file))
|
args(file, getOutputFile(file))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -282,17 +323,12 @@ class FilamentToolsPlugin implements Plugin<Project> {
|
|||||||
extension.meshInputFile = project.objects.fileProperty()
|
extension.meshInputFile = project.objects.fileProperty()
|
||||||
extension.meshOutputDir = project.objects.directoryProperty()
|
extension.meshOutputDir = project.objects.directoryProperty()
|
||||||
|
|
||||||
project.ext.filamentToolsPath = project.file("../../../out/release/filament")
|
|
||||||
if (project.hasProperty("filament_tools_dir")) {
|
|
||||||
project.ext.filamentToolsPath = project.file(project.property("filament_tools_dir"))
|
|
||||||
}
|
|
||||||
|
|
||||||
project.tasks.register("filamentCompileMaterials", MaterialCompiler) {
|
project.tasks.register("filamentCompileMaterials", MaterialCompiler) {
|
||||||
enabled =
|
enabled =
|
||||||
extension.materialInputDir.isPresent() &&
|
extension.materialInputDir.isPresent() &&
|
||||||
extension.materialOutputDir.isPresent()
|
extension.materialOutputDir.isPresent()
|
||||||
inputDir = extension.materialInputDir.getOrNull()
|
inputDir.set(extension.materialInputDir.getOrNull())
|
||||||
outputDir = extension.materialOutputDir.getOrNull()
|
outputDir.set(extension.materialOutputDir.getOrNull())
|
||||||
}
|
}
|
||||||
|
|
||||||
project.preBuild.dependsOn "filamentCompileMaterials"
|
project.preBuild.dependsOn "filamentCompileMaterials"
|
||||||
|
|||||||
@@ -16,8 +16,10 @@
|
|||||||
|
|
||||||
#include "CallbackUtils.h"
|
#include "CallbackUtils.h"
|
||||||
|
|
||||||
|
#include "private/backend/VirtualMachineEnv.h"
|
||||||
|
|
||||||
void acquireCallbackJni(JNIEnv* env, CallbackJni& callbackUtils) {
|
void acquireCallbackJni(JNIEnv* env, CallbackJni& callbackUtils) {
|
||||||
#ifdef ANDROID
|
#ifdef __ANDROID__
|
||||||
callbackUtils.handlerClass = env->FindClass("android/os/Handler");
|
callbackUtils.handlerClass = env->FindClass("android/os/Handler");
|
||||||
callbackUtils.handlerClass = (jclass) env->NewGlobalRef(callbackUtils.handlerClass);
|
callbackUtils.handlerClass = (jclass) env->NewGlobalRef(callbackUtils.handlerClass);
|
||||||
callbackUtils.post = env->GetMethodID(callbackUtils.handlerClass,
|
callbackUtils.post = env->GetMethodID(callbackUtils.handlerClass,
|
||||||
@@ -32,7 +34,7 @@ void acquireCallbackJni(JNIEnv* env, CallbackJni& callbackUtils) {
|
|||||||
|
|
||||||
void releaseCallbackJni(JNIEnv* env, CallbackJni callbackUtils, jobject handler, jobject callback) {
|
void releaseCallbackJni(JNIEnv* env, CallbackJni callbackUtils, jobject handler, jobject callback) {
|
||||||
if (handler && callback) {
|
if (handler && callback) {
|
||||||
#ifdef ANDROID
|
#ifdef __ANDROID__
|
||||||
if (env->IsInstanceOf(handler, callbackUtils.handlerClass)) {
|
if (env->IsInstanceOf(handler, callbackUtils.handlerClass)) {
|
||||||
env->CallBooleanMethod(handler, callbackUtils.post, callback);
|
env->CallBooleanMethod(handler, callbackUtils.post, callback);
|
||||||
}
|
}
|
||||||
@@ -43,59 +45,12 @@ void releaseCallbackJni(JNIEnv* env, CallbackJni callbackUtils, jobject handler,
|
|||||||
}
|
}
|
||||||
env->DeleteGlobalRef(handler);
|
env->DeleteGlobalRef(handler);
|
||||||
env->DeleteGlobalRef(callback);
|
env->DeleteGlobalRef(callback);
|
||||||
#ifdef ANDROID
|
#ifdef __ANDROID__
|
||||||
env->DeleteGlobalRef(callbackUtils.handlerClass);
|
env->DeleteGlobalRef(callbackUtils.handlerClass);
|
||||||
#endif
|
#endif
|
||||||
env->DeleteGlobalRef(callbackUtils.executorClass);
|
env->DeleteGlobalRef(callbackUtils.executorClass);
|
||||||
}
|
}
|
||||||
|
|
||||||
JniBufferCallback* JniBufferCallback::make(filament::Engine* engine,
|
|
||||||
JNIEnv* env, jobject handler, jobject callback, AutoBuffer&& buffer) {
|
|
||||||
return new JniBufferCallback(env, handler, callback, std::move(buffer));
|
|
||||||
}
|
|
||||||
|
|
||||||
JniBufferCallback::JniBufferCallback(JNIEnv* env, jobject handler, jobject callback,
|
|
||||||
AutoBuffer&& buffer)
|
|
||||||
: mEnv(env)
|
|
||||||
, mHandler(env->NewGlobalRef(handler))
|
|
||||||
, mCallback(env->NewGlobalRef(callback))
|
|
||||||
, mBuffer(std::move(buffer)) {
|
|
||||||
acquireCallbackJni(env, mCallbackUtils);
|
|
||||||
}
|
|
||||||
|
|
||||||
JniBufferCallback::~JniBufferCallback() {
|
|
||||||
releaseCallbackJni(mEnv, mCallbackUtils, mHandler, mCallback);
|
|
||||||
}
|
|
||||||
|
|
||||||
void JniBufferCallback::invoke(void*, size_t, void* user) {
|
|
||||||
JniBufferCallback* data = reinterpret_cast<JniBufferCallback*>(user);
|
|
||||||
delete data;
|
|
||||||
}
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
JniImageCallback* JniImageCallback::make(filament::Engine* engine,
|
|
||||||
JNIEnv* env, jobject handler, jobject callback, long image) {
|
|
||||||
return new JniImageCallback(env, handler, callback, image);
|
|
||||||
}
|
|
||||||
|
|
||||||
JniImageCallback::JniImageCallback(JNIEnv* env, jobject handler, jobject callback, long image)
|
|
||||||
: mEnv(env)
|
|
||||||
, mHandler(env->NewGlobalRef(handler))
|
|
||||||
, mCallback(env->NewGlobalRef(callback))
|
|
||||||
, mImage(image) {
|
|
||||||
acquireCallbackJni(env, mCallbackUtils);
|
|
||||||
}
|
|
||||||
|
|
||||||
JniImageCallback::~JniImageCallback() {
|
|
||||||
releaseCallbackJni(mEnv, mCallbackUtils, mHandler, mCallback);
|
|
||||||
}
|
|
||||||
|
|
||||||
void JniImageCallback::invoke(void*, void* user) {
|
|
||||||
JniImageCallback* data = reinterpret_cast<JniImageCallback*>(user);
|
|
||||||
delete data;
|
|
||||||
}
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
JniCallback* JniCallback::make(JNIEnv* env, jobject handler, jobject callback) {
|
JniCallback* JniCallback::make(JNIEnv* env, jobject handler, jobject callback) {
|
||||||
@@ -103,17 +58,63 @@ JniCallback* JniCallback::make(JNIEnv* env, jobject handler, jobject callback) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
JniCallback::JniCallback(JNIEnv* env, jobject handler, jobject callback)
|
JniCallback::JniCallback(JNIEnv* env, jobject handler, jobject callback)
|
||||||
: mEnv(env)
|
: mHandler(env->NewGlobalRef(handler)),
|
||||||
, mHandler(env->NewGlobalRef(handler))
|
mCallback(env->NewGlobalRef(callback)) {
|
||||||
, mCallback(env->NewGlobalRef(callback)) {
|
|
||||||
acquireCallbackJni(env, mCallbackUtils);
|
acquireCallbackJni(env, mCallbackUtils);
|
||||||
}
|
}
|
||||||
|
|
||||||
JniCallback::~JniCallback() {
|
JniCallback::~JniCallback() = default;
|
||||||
releaseCallbackJni(mEnv, mCallbackUtils, mHandler, mCallback);
|
|
||||||
|
void JniCallback::post(void* user, filament::backend::CallbackHandler::Callback callback) {
|
||||||
|
callback(user);
|
||||||
}
|
}
|
||||||
|
|
||||||
void JniCallback::invoke(void* user) {
|
void JniCallback::postToJavaAndDestroy(JniCallback* callback) {
|
||||||
JniCallback* data = reinterpret_cast<JniCallback*>(user);
|
JNIEnv* env = filament::VirtualMachineEnv::get().getEnvironment();
|
||||||
delete data;
|
releaseCallbackJni(env, callback->mCallbackUtils, callback->mHandler, callback->mCallback);
|
||||||
|
delete callback;
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
JniBufferCallback* JniBufferCallback::make(filament::Engine*,
|
||||||
|
JNIEnv* env, jobject handler, jobject callback, AutoBuffer&& buffer) {
|
||||||
|
return new JniBufferCallback(env, handler, callback, std::move(buffer));
|
||||||
|
}
|
||||||
|
|
||||||
|
JniBufferCallback::JniBufferCallback(JNIEnv* env, jobject handler, jobject callback,
|
||||||
|
AutoBuffer&& buffer)
|
||||||
|
: JniCallback(env, handler, callback),
|
||||||
|
mBuffer(std::move(buffer)) {
|
||||||
|
}
|
||||||
|
|
||||||
|
JniBufferCallback::~JniBufferCallback() = default;
|
||||||
|
|
||||||
|
void JniBufferCallback::postToJavaAndDestroy(void*, size_t, void* user) {
|
||||||
|
JniBufferCallback* callback = (JniBufferCallback*)user;
|
||||||
|
JNIEnv* env = filament::VirtualMachineEnv::get().getEnvironment();
|
||||||
|
callback->mBuffer.attachToJniThread(env);
|
||||||
|
releaseCallbackJni(env, callback->mCallbackUtils, callback->mHandler, callback->mCallback);
|
||||||
|
delete callback;
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
JniImageCallback* JniImageCallback::make(filament::Engine*,
|
||||||
|
JNIEnv* env, jobject handler, jobject callback, long image) {
|
||||||
|
return new JniImageCallback(env, handler, callback, image);
|
||||||
|
}
|
||||||
|
|
||||||
|
JniImageCallback::JniImageCallback(JNIEnv* env, jobject handler, jobject callback, long image)
|
||||||
|
: JniCallback(env, handler, callback),
|
||||||
|
mImage(image) {
|
||||||
|
}
|
||||||
|
|
||||||
|
JniImageCallback::~JniImageCallback() = default;
|
||||||
|
|
||||||
|
void JniImageCallback::postToJavaAndDestroy(void*, void* user) {
|
||||||
|
JniImageCallback* callback = (JniImageCallback*)user;
|
||||||
|
JNIEnv* env = filament::VirtualMachineEnv::get().getEnvironment();
|
||||||
|
releaseCallbackJni(env, callback->mCallbackUtils, callback->mHandler, callback->mCallback);
|
||||||
|
delete callback;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,13 +18,14 @@
|
|||||||
|
|
||||||
#include <jni.h>
|
#include <jni.h>
|
||||||
|
|
||||||
#include "common/CallbackUtils.h"
|
|
||||||
#include "common/NioUtils.h"
|
#include "common/NioUtils.h"
|
||||||
|
|
||||||
|
#include <backend/CallbackHandler.h>
|
||||||
|
|
||||||
#include <filament/Engine.h>
|
#include <filament/Engine.h>
|
||||||
|
|
||||||
struct CallbackJni {
|
struct CallbackJni {
|
||||||
#ifdef ANDROID
|
#ifdef __ANDROID__
|
||||||
jclass handlerClass = nullptr;
|
jclass handlerClass = nullptr;
|
||||||
jmethodID post = nullptr;
|
jmethodID post = nullptr;
|
||||||
#endif
|
#endif
|
||||||
@@ -35,57 +36,60 @@ struct CallbackJni {
|
|||||||
void acquireCallbackJni(JNIEnv* env, CallbackJni& callbackUtils);
|
void acquireCallbackJni(JNIEnv* env, CallbackJni& callbackUtils);
|
||||||
void releaseCallbackJni(JNIEnv* env, CallbackJni callbackUtils, jobject handler, jobject callback);
|
void releaseCallbackJni(JNIEnv* env, CallbackJni callbackUtils, jobject handler, jobject callback);
|
||||||
|
|
||||||
struct JniBufferCallback {
|
struct JniCallback : private filament::backend::CallbackHandler {
|
||||||
|
JniCallback(JniCallback const &) = delete;
|
||||||
|
JniCallback(JniCallback&&) = delete;
|
||||||
|
JniCallback& operator=(JniCallback const &) = delete;
|
||||||
|
JniCallback& operator=(JniCallback&&) = delete;
|
||||||
|
|
||||||
|
// create a JniCallback
|
||||||
|
static JniCallback* make(JNIEnv* env, jobject handler, jobject runnable);
|
||||||
|
|
||||||
|
// execute the callback on the java thread and destroy ourselves
|
||||||
|
static void postToJavaAndDestroy(JniCallback* callback);
|
||||||
|
|
||||||
|
// CallbackHandler interface.
|
||||||
|
void post(void* user, Callback callback) override;
|
||||||
|
|
||||||
|
// Get the CallbackHandler interface
|
||||||
|
filament::backend::CallbackHandler* getHandler() noexcept { return this; }
|
||||||
|
|
||||||
|
jobject getCallbackObject() { return mCallback; }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
JniCallback(JNIEnv* env, jobject handler, jobject runnable);
|
||||||
|
explicit JniCallback() = default; // this version does nothing
|
||||||
|
virtual ~JniCallback();
|
||||||
|
jobject mHandler{};
|
||||||
|
jobject mCallback{};
|
||||||
|
CallbackJni mCallbackUtils{};
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
struct JniBufferCallback : public JniCallback {
|
||||||
|
// create a JniBufferCallback
|
||||||
static JniBufferCallback* make(filament::Engine* engine,
|
static JniBufferCallback* make(filament::Engine* engine,
|
||||||
JNIEnv* env, jobject handler, jobject callback, AutoBuffer&& buffer);
|
JNIEnv* env, jobject handler, jobject callback, AutoBuffer&& buffer);
|
||||||
|
|
||||||
static void invoke(void* buffer, size_t n, void* user);
|
// execute the callback on the java thread and destroy ourselves
|
||||||
|
static void postToJavaAndDestroy(void*, size_t, void* user);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
JniBufferCallback(JNIEnv* env, jobject handler, jobject callback, AutoBuffer&& buffer);
|
JniBufferCallback(JNIEnv* env, jobject handler, jobject callback, AutoBuffer&& buffer);
|
||||||
JniBufferCallback(JniBufferCallback const &) = delete;
|
virtual ~JniBufferCallback();
|
||||||
JniBufferCallback(JniBufferCallback&&) = delete;
|
|
||||||
~JniBufferCallback();
|
|
||||||
|
|
||||||
JNIEnv* mEnv;
|
|
||||||
jobject mHandler;
|
|
||||||
jobject mCallback;
|
|
||||||
AutoBuffer mBuffer;
|
AutoBuffer mBuffer;
|
||||||
CallbackJni mCallbackUtils;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct JniImageCallback {
|
struct JniImageCallback : public JniCallback {
|
||||||
|
// create a JniImageCallback
|
||||||
static JniImageCallback* make(filament::Engine* engine, JNIEnv* env, jobject handler,
|
static JniImageCallback* make(filament::Engine* engine, JNIEnv* env, jobject handler,
|
||||||
jobject runnable, long image);
|
jobject runnable, long image);
|
||||||
|
|
||||||
static void invoke(void* image, void* user);
|
// execute the callback on the java thread and destroy ourselves
|
||||||
|
static void postToJavaAndDestroy(void*, void* user);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
JniImageCallback(JNIEnv* env, jobject handler, jobject runnable, long image);
|
JniImageCallback(JNIEnv* env, jobject handler, jobject runnable, long image);
|
||||||
JniImageCallback(JniImageCallback const &) = delete;
|
virtual ~JniImageCallback();
|
||||||
JniImageCallback(JniImageCallback&&) = delete;
|
|
||||||
~JniImageCallback();
|
|
||||||
|
|
||||||
JNIEnv* mEnv;
|
|
||||||
jobject mHandler;
|
|
||||||
jobject mCallback;
|
|
||||||
long mImage;
|
long mImage;
|
||||||
CallbackJni mCallbackUtils;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct JniCallback {
|
|
||||||
static JniCallback* make(JNIEnv* env, jobject handler, jobject runnable);
|
|
||||||
|
|
||||||
static void invoke(void* user);
|
|
||||||
|
|
||||||
private:
|
|
||||||
JniCallback(JNIEnv* env, jobject handler, jobject runnable);
|
|
||||||
JniCallback(JniCallback const &) = delete;
|
|
||||||
JniCallback(JniCallback&&) = delete;
|
|
||||||
~JniCallback();
|
|
||||||
|
|
||||||
JNIEnv* mEnv;
|
|
||||||
jobject mHandler;
|
|
||||||
jobject mCallback;
|
|
||||||
CallbackJni mCallbackUtils;
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -38,6 +38,10 @@ public:
|
|||||||
AutoBuffer(AutoBuffer&& rhs) noexcept;
|
AutoBuffer(AutoBuffer&& rhs) noexcept;
|
||||||
~AutoBuffer() noexcept;
|
~AutoBuffer() noexcept;
|
||||||
|
|
||||||
|
void attachToJniThread(JNIEnv* env) noexcept {
|
||||||
|
mEnv = env;
|
||||||
|
}
|
||||||
|
|
||||||
void* getData() const noexcept {
|
void* getData() const noexcept {
|
||||||
return mUserData;
|
return mUserData;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
cmake_minimum_required(VERSION 3.6)
|
cmake_minimum_required(VERSION 3.19)
|
||||||
|
project(filamat-android)
|
||||||
|
|
||||||
option(FILAMENT_ENABLE_MATDBG "Enables Material debugger" OFF)
|
option(FILAMENT_ENABLE_MATDBG "Enables Material debugger" OFF)
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
android {
|
android {
|
||||||
|
namespace 'com.google.android.filament.filamat'
|
||||||
|
|
||||||
flavorDimensions "functionality"
|
flavorDimensions "functionality"
|
||||||
productFlavors {
|
productFlavors {
|
||||||
full {
|
full {
|
||||||
@@ -15,6 +17,17 @@ android {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
publishing {
|
||||||
|
singleVariant("fullRelease") {
|
||||||
|
withSourcesJar()
|
||||||
|
withJavadocJar()
|
||||||
|
}
|
||||||
|
singleVariant("liteRelease") {
|
||||||
|
withSourcesJar()
|
||||||
|
withJavadocJar()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
|||||||
@@ -123,19 +123,22 @@ Java_com_google_android_filament_filamat_MaterialBuilder_nMaterialBuilderInterpo
|
|||||||
|
|
||||||
extern "C" JNIEXPORT void JNICALL
|
extern "C" JNIEXPORT void JNICALL
|
||||||
Java_com_google_android_filament_filamat_MaterialBuilder_nMaterialBuilderUniformParameter(
|
Java_com_google_android_filament_filamat_MaterialBuilder_nMaterialBuilderUniformParameter(
|
||||||
JNIEnv* env, jclass, jlong nativeBuilder, jint uniformType, jstring name_) {
|
JNIEnv* env, jclass, jlong nativeBuilder, jint uniformType, jint precision, jstring name_) {
|
||||||
auto builder = (MaterialBuilder*) nativeBuilder;
|
auto builder = (MaterialBuilder*) nativeBuilder;
|
||||||
const char* name = env->GetStringUTFChars(name_, nullptr);
|
const char* name = env->GetStringUTFChars(name_, nullptr);
|
||||||
builder->parameter((MaterialBuilder::UniformType) uniformType, name);
|
builder->parameter(name, (MaterialBuilder::UniformType) uniformType,
|
||||||
|
(MaterialBuilder::ParameterPrecision) precision);
|
||||||
env->ReleaseStringUTFChars(name_, name);
|
env->ReleaseStringUTFChars(name_, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" JNIEXPORT void JNICALL
|
extern "C" JNIEXPORT void JNICALL
|
||||||
Java_com_google_android_filament_filamat_MaterialBuilder_nMaterialBuilderUniformParameterArray(
|
Java_com_google_android_filament_filamat_MaterialBuilder_nMaterialBuilderUniformParameterArray(
|
||||||
JNIEnv* env, jclass, jlong nativeBuilder, jint uniformType, jint size, jstring name_) {
|
JNIEnv* env, jclass, jlong nativeBuilder, jint uniformType, jint size, jint precision,
|
||||||
|
jstring name_) {
|
||||||
auto builder = (MaterialBuilder*) nativeBuilder;
|
auto builder = (MaterialBuilder*) nativeBuilder;
|
||||||
const char* name = env->GetStringUTFChars(name_, nullptr);
|
const char* name = env->GetStringUTFChars(name_, nullptr);
|
||||||
builder->parameter((MaterialBuilder::UniformType) uniformType, (size_t) size, name);
|
builder->parameter(name, (size_t) size, (MaterialBuilder::UniformType) uniformType,
|
||||||
|
(MaterialBuilder::ParameterPrecision) precision);
|
||||||
env->ReleaseStringUTFChars(name_, name);
|
env->ReleaseStringUTFChars(name_, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -145,9 +148,8 @@ Java_com_google_android_filament_filamat_MaterialBuilder_nMaterialBuilderSampler
|
|||||||
jint precision, jstring name_) {
|
jint precision, jstring name_) {
|
||||||
auto builder = (MaterialBuilder*) nativeBuilder;
|
auto builder = (MaterialBuilder*) nativeBuilder;
|
||||||
const char* name = env->GetStringUTFChars(name_, nullptr);
|
const char* name = env->GetStringUTFChars(name_, nullptr);
|
||||||
builder->parameter((MaterialBuilder::SamplerType) samplerType,
|
builder->parameter(name, (MaterialBuilder::SamplerType) samplerType,
|
||||||
(MaterialBuilder::SamplerFormat) format, (MaterialBuilder::SamplerPrecision) precision,
|
(MaterialBuilder::SamplerFormat) format, (MaterialBuilder::ParameterPrecision) precision);
|
||||||
name);
|
|
||||||
env->ReleaseStringUTFChars(name_, name);
|
env->ReleaseStringUTFChars(name_, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -248,6 +250,13 @@ Java_com_google_android_filament_filamat_MaterialBuilder_nMaterialBuilderMaskThr
|
|||||||
builder->maskThreshold(maskThreshold);
|
builder->maskThreshold(maskThreshold);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT void JNICALL
|
||||||
|
Java_com_google_android_filament_filamat_MaterialBuilder_nMaterialBuilderAlphaToCoverage(JNIEnv*,
|
||||||
|
jclass, jlong nativeBuilder, jboolean enable) {
|
||||||
|
auto builder = (MaterialBuilder*) nativeBuilder;
|
||||||
|
builder->alphaToCoverage(enable);
|
||||||
|
}
|
||||||
|
|
||||||
extern "C" JNIEXPORT void JNICALL
|
extern "C" JNIEXPORT void JNICALL
|
||||||
Java_com_google_android_filament_filamat_MaterialBuilder_nMaterialBuilderShadowMultiplier(
|
Java_com_google_android_filament_filamat_MaterialBuilder_nMaterialBuilderShadowMultiplier(
|
||||||
JNIEnv*, jclass, jlong nativeBuilder, jboolean shadowMultiplier) {
|
JNIEnv*, jclass, jlong nativeBuilder, jboolean shadowMultiplier) {
|
||||||
@@ -255,6 +264,13 @@ Java_com_google_android_filament_filamat_MaterialBuilder_nMaterialBuilderShadowM
|
|||||||
builder->shadowMultiplier(shadowMultiplier);
|
builder->shadowMultiplier(shadowMultiplier);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT void JNICALL
|
||||||
|
Java_com_google_android_filament_filamat_MaterialBuilder_nMaterialBuilderTransparentShadow(
|
||||||
|
JNIEnv*, jclass, jlong nativeBuilder, jboolean transparentShadow) {
|
||||||
|
auto builder = (MaterialBuilder*) nativeBuilder;
|
||||||
|
builder->transparentShadow(transparentShadow);
|
||||||
|
}
|
||||||
|
|
||||||
extern "C" JNIEXPORT void JNICALL
|
extern "C" JNIEXPORT void JNICALL
|
||||||
Java_com_google_android_filament_filamat_MaterialBuilder_nMaterialBuilderSpecularAntiAliasing(
|
Java_com_google_android_filament_filamat_MaterialBuilder_nMaterialBuilderSpecularAntiAliasing(
|
||||||
JNIEnv*, jclass, jlong nativeBuilder, jboolean specularAntiAliasing) {
|
JNIEnv*, jclass, jlong nativeBuilder, jboolean specularAntiAliasing) {
|
||||||
@@ -291,6 +307,13 @@ Java_com_google_android_filament_filamat_MaterialBuilder_nMaterialBuilderFlipUV(
|
|||||||
builder->flipUV(flipUV);
|
builder->flipUV(flipUV);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT void JNICALL
|
||||||
|
Java_com_google_android_filament_filamat_MaterialBuilder_nMaterialBuilderCustomSurfaceShading(JNIEnv*,
|
||||||
|
jclass, jlong nativeBuilder, jboolean customSurfaceShading) {
|
||||||
|
auto builder = (MaterialBuilder*) nativeBuilder;
|
||||||
|
builder->customSurfaceShading(customSurfaceShading);
|
||||||
|
}
|
||||||
|
|
||||||
extern "C" JNIEXPORT void JNICALL
|
extern "C" JNIEXPORT void JNICALL
|
||||||
Java_com_google_android_filament_filamat_MaterialBuilder_nMaterialBuilderMultiBounceAmbientOcclusion(
|
Java_com_google_android_filament_filamat_MaterialBuilder_nMaterialBuilderMultiBounceAmbientOcclusion(
|
||||||
JNIEnv*, jclass, jlong nativeBuilder, jboolean multiBounceAO) {
|
JNIEnv*, jclass, jlong nativeBuilder, jboolean multiBounceAO) {
|
||||||
@@ -353,3 +376,10 @@ Java_com_google_android_filament_filamat_MaterialBuilder_nMaterialBuilderVariant
|
|||||||
auto builder = (MaterialBuilder*) nativeBuilder;
|
auto builder = (MaterialBuilder*) nativeBuilder;
|
||||||
builder->variantFilter((uint8_t) variantFilter);
|
builder->variantFilter((uint8_t) variantFilter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT void JNICALL
|
||||||
|
Java_com_google_android_filament_filamat_MaterialBuilder_nMaterialBuilderUseLegacyMorphing(JNIEnv*,
|
||||||
|
jclass, jlong nativeBuilder) {
|
||||||
|
auto builder = (MaterialBuilder*) nativeBuilder;
|
||||||
|
builder->useLegacyMorphing();
|
||||||
|
}
|
||||||
|
|||||||
+61
-7
@@ -91,7 +91,7 @@ public class MaterialBuilder {
|
|||||||
SHADOW
|
SHADOW
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum SamplerPrecision {
|
public enum ParameterPrecision {
|
||||||
LOW,
|
LOW,
|
||||||
MEDIUM,
|
MEDIUM,
|
||||||
HIGH,
|
HIGH,
|
||||||
@@ -133,7 +133,7 @@ public class MaterialBuilder {
|
|||||||
FADE, // material is transparent and color is alpha-pre-multiplied,
|
FADE, // material is transparent and color is alpha-pre-multiplied,
|
||||||
// affects specular lighting
|
// affects specular lighting
|
||||||
MULTIPLY, // material darkens what's behind it
|
MULTIPLY, // material darkens what's behind it
|
||||||
SCREN // material brightens what's behind it
|
SCREEN // material brightens what's behind it
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum VertexDomain {
|
public enum VertexDomain {
|
||||||
@@ -247,19 +247,36 @@ public class MaterialBuilder {
|
|||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
public MaterialBuilder uniformParameter(@NonNull UniformType type, String name) {
|
public MaterialBuilder uniformParameter(@NonNull UniformType type, String name) {
|
||||||
nMaterialBuilderUniformParameter(mNativeObject, type.ordinal(), name);
|
nMaterialBuilderUniformParameter(mNativeObject, type.ordinal(),
|
||||||
|
ParameterPrecision.DEFAULT.ordinal(), name);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
public MaterialBuilder uniformParameter(@NonNull UniformType type,
|
||||||
|
ParameterPrecision precision, String name) {
|
||||||
|
nMaterialBuilderUniformParameter(mNativeObject, type.ordinal(), precision.ordinal(), name);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
public MaterialBuilder uniformParameterArray(@NonNull UniformType type, int size, String name) {
|
public MaterialBuilder uniformParameterArray(@NonNull UniformType type, int size, String name) {
|
||||||
nMaterialBuilderUniformParameterArray(mNativeObject, type.ordinal(), size, name);
|
nMaterialBuilderUniformParameterArray(mNativeObject, type.ordinal(), size,
|
||||||
|
ParameterPrecision.DEFAULT.ordinal(), name);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
public MaterialBuilder uniformParameterArray(@NonNull UniformType type, int size,
|
||||||
|
ParameterPrecision precision, String name) {
|
||||||
|
nMaterialBuilderUniformParameterArray(mNativeObject, type.ordinal(), size,
|
||||||
|
precision.ordinal(), name);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
public MaterialBuilder samplerParameter(@NonNull SamplerType type, SamplerFormat format,
|
public MaterialBuilder samplerParameter(@NonNull SamplerType type, SamplerFormat format,
|
||||||
SamplerPrecision precision, String name) {
|
ParameterPrecision precision, String name) {
|
||||||
nMaterialBuilderSamplerParameter(
|
nMaterialBuilderSamplerParameter(
|
||||||
mNativeObject, type.ordinal(), format.ordinal(), precision.ordinal(), name);
|
mNativeObject, type.ordinal(), format.ordinal(), precision.ordinal(), name);
|
||||||
return this;
|
return this;
|
||||||
@@ -343,12 +360,24 @@ public class MaterialBuilder {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
public MaterialBuilder alphaToCoverage(boolean enable) {
|
||||||
|
nMaterialBuilderAlphaToCoverage(mNativeObject, enable);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
public MaterialBuilder shadowMultiplier(boolean shadowMultiplier) {
|
public MaterialBuilder shadowMultiplier(boolean shadowMultiplier) {
|
||||||
nMaterialBuilderShadowMultiplier(mNativeObject, shadowMultiplier);
|
nMaterialBuilderShadowMultiplier(mNativeObject, shadowMultiplier);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
public MaterialBuilder transparentShadow(boolean transparentShadow) {
|
||||||
|
nMaterialBuilderTransparentShadow(mNativeObject, transparentShadow);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
public MaterialBuilder specularAntiAliasing(boolean specularAntiAliasing) {
|
public MaterialBuilder specularAntiAliasing(boolean specularAntiAliasing) {
|
||||||
nMaterialBuilderSpecularAntiAliasing(mNativeObject, specularAntiAliasing);
|
nMaterialBuilderSpecularAntiAliasing(mNativeObject, specularAntiAliasing);
|
||||||
@@ -391,6 +420,12 @@ public class MaterialBuilder {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
public MaterialBuilder customSurfaceShading(boolean customSurfaceShading) {
|
||||||
|
nMaterialBuilderCustomSurfaceShading(mNativeObject, customSurfaceShading);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
public MaterialBuilder multiBounceAmbientOcclusion(boolean multiBounceAO) {
|
public MaterialBuilder multiBounceAmbientOcclusion(boolean multiBounceAO) {
|
||||||
nMaterialBuilderMultiBounceAmbientOcclusion(mNativeObject, multiBounceAO);
|
nMaterialBuilderMultiBounceAmbientOcclusion(mNativeObject, multiBounceAO);
|
||||||
@@ -430,6 +465,19 @@ public class MaterialBuilder {
|
|||||||
@NonNull
|
@NonNull
|
||||||
public MaterialBuilder variantFilter(int variantFilter) {
|
public MaterialBuilder variantFilter(int variantFilter) {
|
||||||
nMaterialBuilderVariantFilter(mNativeObject, variantFilter);
|
nMaterialBuilderVariantFilter(mNativeObject, variantFilter);
|
||||||
|
useLegacyMorphing();
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Legacy morphing uses the data in the {@link VertexBuffer.VertexAttribute} slots
|
||||||
|
* (<code>MORPH_POSITION_0</code>, etc) and is limited to 4 morph targets.
|
||||||
|
*
|
||||||
|
* @see RenderableManager.Builder#morphing()
|
||||||
|
*/
|
||||||
|
@NonNull
|
||||||
|
public MaterialBuilder useLegacyMorphing() {
|
||||||
|
nMaterialBuilderUseLegacyMorphing(mNativeObject);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -523,9 +571,9 @@ public class MaterialBuilder {
|
|||||||
private static native void nMaterialBuilderShading(long nativeBuilder, int shading);
|
private static native void nMaterialBuilderShading(long nativeBuilder, int shading);
|
||||||
private static native void nMaterialBuilderInterpolation(long nativeBuilder, int interpolation);
|
private static native void nMaterialBuilderInterpolation(long nativeBuilder, int interpolation);
|
||||||
private static native void nMaterialBuilderUniformParameter(long nativeBuilder, int type,
|
private static native void nMaterialBuilderUniformParameter(long nativeBuilder, int type,
|
||||||
String name);
|
int precision, String name);
|
||||||
private static native void nMaterialBuilderUniformParameterArray(long nativeBuilder, int type,
|
private static native void nMaterialBuilderUniformParameterArray(long nativeBuilder, int type,
|
||||||
int size, String name);
|
int size, int precision, String name);
|
||||||
private static native void nMaterialBuilderSamplerParameter(long nativeBuilder, int type,
|
private static native void nMaterialBuilderSamplerParameter(long nativeBuilder, int type,
|
||||||
int format, int precision, String name);
|
int format, int precision, String name);
|
||||||
private static native void nMaterialBuilderVariable(long nativeBuilder, int variable,
|
private static native void nMaterialBuilderVariable(long nativeBuilder, int variable,
|
||||||
@@ -542,9 +590,12 @@ public class MaterialBuilder {
|
|||||||
private static native void nMaterialBuilderDepthCulling(long nativeBuilder, boolean enable);
|
private static native void nMaterialBuilderDepthCulling(long nativeBuilder, boolean enable);
|
||||||
private static native void nMaterialBuilderDoubleSided(long nativeBuilder, boolean doubleSided);
|
private static native void nMaterialBuilderDoubleSided(long nativeBuilder, boolean doubleSided);
|
||||||
private static native void nMaterialBuilderMaskThreshold(long nativeBuilder, float mode);
|
private static native void nMaterialBuilderMaskThreshold(long nativeBuilder, float mode);
|
||||||
|
private static native void nMaterialBuilderAlphaToCoverage(long nativeBuilder, boolean enable);
|
||||||
|
|
||||||
private static native void nMaterialBuilderShadowMultiplier(long mNativeObject,
|
private static native void nMaterialBuilderShadowMultiplier(long mNativeObject,
|
||||||
boolean shadowMultiplier);
|
boolean shadowMultiplier);
|
||||||
|
private static native void nMaterialBuilderTransparentShadow(long mNativeObject,
|
||||||
|
boolean transparentShadow);
|
||||||
private static native void nMaterialBuilderSpecularAntiAliasing(long mNativeObject,
|
private static native void nMaterialBuilderSpecularAntiAliasing(long mNativeObject,
|
||||||
boolean specularAntiAliasing);
|
boolean specularAntiAliasing);
|
||||||
private static native void nMaterialBuilderSpecularAntiAliasingVariance(long mNativeObject,
|
private static native void nMaterialBuilderSpecularAntiAliasingVariance(long mNativeObject,
|
||||||
@@ -556,6 +607,8 @@ public class MaterialBuilder {
|
|||||||
private static native void nMaterialBuilderClearCoatIorChange(long mNativeObject,
|
private static native void nMaterialBuilderClearCoatIorChange(long mNativeObject,
|
||||||
boolean clearCoatIorChange);
|
boolean clearCoatIorChange);
|
||||||
private static native void nMaterialBuilderFlipUV(long nativeBuilder, boolean flipUV);
|
private static native void nMaterialBuilderFlipUV(long nativeBuilder, boolean flipUV);
|
||||||
|
private static native void nMaterialBuilderCustomSurfaceShading(long nativeBuilder,
|
||||||
|
boolean customSurfaceShading);
|
||||||
private static native void nMaterialBuilderMultiBounceAmbientOcclusion(long nativeBuilder,
|
private static native void nMaterialBuilderMultiBounceAmbientOcclusion(long nativeBuilder,
|
||||||
boolean multiBounceAO);
|
boolean multiBounceAO);
|
||||||
private static native void nMaterialBuilderSpecularAmbientOcclusion(long nativeBuilder,
|
private static native void nMaterialBuilderSpecularAmbientOcclusion(long nativeBuilder,
|
||||||
@@ -566,4 +619,5 @@ public class MaterialBuilder {
|
|||||||
private static native void nMaterialBuilderOptimization(long nativeBuilder, int optimization);
|
private static native void nMaterialBuilderOptimization(long nativeBuilder, int optimization);
|
||||||
private static native void nMaterialBuilderVariantFilter(long nativeBuilder,
|
private static native void nMaterialBuilderVariantFilter(long nativeBuilder,
|
||||||
int variantFilter);
|
int variantFilter);
|
||||||
|
private static native void nMaterialBuilderUseLegacyMorphing(long nativeBuilder);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
cmake_minimum_required(VERSION 3.6)
|
cmake_minimum_required(VERSION 3.19)
|
||||||
|
project(filament-android)
|
||||||
|
|
||||||
option(FILAMENT_SUPPORTS_VULKAN "Enables Vulkan on Android" OFF)
|
option(FILAMENT_SUPPORTS_VULKAN "Enables Vulkan on Android" OFF)
|
||||||
option(FILAMENT_ENABLE_MATDBG "Enables Material debugger" OFF)
|
option(FILAMENT_ENABLE_MATDBG "Enables Material debugger" OFF)
|
||||||
|
option(FILAMENT_DISABLE_MATOPT "Disables material optimizations" OFF)
|
||||||
|
|
||||||
set(FILAMENT_DIR ${FILAMENT_DIST_DIR})
|
set(FILAMENT_DIR ${FILAMENT_DIST_DIR})
|
||||||
|
|
||||||
@@ -25,6 +27,10 @@ add_library(filaflat STATIC IMPORTED)
|
|||||||
set_target_properties(filaflat PROPERTIES IMPORTED_LOCATION
|
set_target_properties(filaflat PROPERTIES IMPORTED_LOCATION
|
||||||
${FILAMENT_DIR}/lib/${ANDROID_ABI}/libfilaflat.a)
|
${FILAMENT_DIR}/lib/${ANDROID_ABI}/libfilaflat.a)
|
||||||
|
|
||||||
|
add_library(filamat STATIC IMPORTED)
|
||||||
|
set_target_properties(filamat PROPERTIES IMPORTED_LOCATION
|
||||||
|
${FILAMENT_DIR}/lib/${ANDROID_ABI}/libfilamat.a)
|
||||||
|
|
||||||
add_library(geometry STATIC IMPORTED)
|
add_library(geometry STATIC IMPORTED)
|
||||||
set_target_properties(geometry PROPERTIES IMPORTED_LOCATION
|
set_target_properties(geometry PROPERTIES IMPORTED_LOCATION
|
||||||
${FILAMENT_DIR}/lib/${ANDROID_ABI}/libgeometry.a)
|
${FILAMENT_DIR}/lib/${ANDROID_ABI}/libgeometry.a)
|
||||||
@@ -55,6 +61,7 @@ set(VERSION_SCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/libfilament-jni.map")
|
|||||||
set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} -Wl,--version-script=${VERSION_SCRIPT}")
|
set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} -Wl,--version-script=${VERSION_SCRIPT}")
|
||||||
|
|
||||||
add_library(filament-jni SHARED
|
add_library(filament-jni SHARED
|
||||||
|
src/main/cpp/BufferObject.cpp
|
||||||
src/main/cpp/Camera.cpp
|
src/main/cpp/Camera.cpp
|
||||||
src/main/cpp/Colors.cpp
|
src/main/cpp/Colors.cpp
|
||||||
src/main/cpp/ColorGrading.cpp
|
src/main/cpp/ColorGrading.cpp
|
||||||
@@ -67,16 +74,19 @@ add_library(filament-jni SHARED
|
|||||||
src/main/cpp/Material.cpp
|
src/main/cpp/Material.cpp
|
||||||
src/main/cpp/MaterialInstance.cpp
|
src/main/cpp/MaterialInstance.cpp
|
||||||
src/main/cpp/MathUtils.cpp
|
src/main/cpp/MathUtils.cpp
|
||||||
|
src/main/cpp/MorphTargetBuffer.cpp
|
||||||
src/main/cpp/RenderableManager.cpp
|
src/main/cpp/RenderableManager.cpp
|
||||||
src/main/cpp/Renderer.cpp
|
src/main/cpp/Renderer.cpp
|
||||||
src/main/cpp/RenderTarget.cpp
|
src/main/cpp/RenderTarget.cpp
|
||||||
src/main/cpp/Scene.cpp
|
src/main/cpp/Scene.cpp
|
||||||
src/main/cpp/SkyBox.cpp
|
src/main/cpp/SkyBox.cpp
|
||||||
|
src/main/cpp/SkinningBuffer.cpp
|
||||||
src/main/cpp/Stream.cpp
|
src/main/cpp/Stream.cpp
|
||||||
src/main/cpp/SurfaceOrientation.cpp
|
src/main/cpp/SurfaceOrientation.cpp
|
||||||
src/main/cpp/SwapChain.cpp
|
src/main/cpp/SwapChain.cpp
|
||||||
src/main/cpp/Texture.cpp
|
src/main/cpp/Texture.cpp
|
||||||
src/main/cpp/TextureSampler.cpp
|
src/main/cpp/TextureSampler.cpp
|
||||||
|
src/main/cpp/ToneMapper.cpp
|
||||||
src/main/cpp/TransformManager.cpp
|
src/main/cpp/TransformManager.cpp
|
||||||
src/main/cpp/VertexBuffer.cpp
|
src/main/cpp/VertexBuffer.cpp
|
||||||
src/main/cpp/View.cpp
|
src/main/cpp/View.cpp
|
||||||
@@ -95,7 +105,6 @@ target_link_libraries(filament-jni
|
|||||||
PRIVATE backend
|
PRIVATE backend
|
||||||
PRIVATE filaflat
|
PRIVATE filaflat
|
||||||
PRIVATE filabridge
|
PRIVATE filabridge
|
||||||
PRIVATE geometry
|
|
||||||
PRIVATE ibl-lite
|
PRIVATE ibl-lite
|
||||||
PRIVATE log
|
PRIVATE log
|
||||||
PRIVATE GLESv3
|
PRIVATE GLESv3
|
||||||
@@ -103,7 +112,12 @@ target_link_libraries(filament-jni
|
|||||||
PRIVATE android
|
PRIVATE android
|
||||||
PRIVATE jnigraphics
|
PRIVATE jnigraphics
|
||||||
PRIVATE utils
|
PRIVATE utils
|
||||||
|
|
||||||
|
# libgeometry is PUBLIC because gltfio uses it.
|
||||||
|
PUBLIC geometry
|
||||||
|
|
||||||
$<$<STREQUAL:${FILAMENT_ENABLE_MATDBG},ON>:matdbg>
|
$<$<STREQUAL:${FILAMENT_ENABLE_MATDBG},ON>:matdbg>
|
||||||
|
$<$<STREQUAL:${FILAMENT_ENABLE_MATDBG},ON>:filamat>
|
||||||
$<$<STREQUAL:${FILAMENT_SUPPORTS_VULKAN},ON>:bluevk>
|
$<$<STREQUAL:${FILAMENT_SUPPORTS_VULKAN},ON>:bluevk>
|
||||||
$<$<STREQUAL:${FILAMENT_SUPPORTS_VULKAN},ON>:vkshaders>
|
$<$<STREQUAL:${FILAMENT_SUPPORTS_VULKAN},ON>:vkshaders>
|
||||||
$<$<STREQUAL:${FILAMENT_SUPPORTS_VULKAN},ON>:smol-v>
|
$<$<STREQUAL:${FILAMENT_SUPPORTS_VULKAN},ON>:smol-v>
|
||||||
@@ -112,6 +126,7 @@ target_link_libraries(filament-jni
|
|||||||
target_include_directories(filament-jni PRIVATE
|
target_include_directories(filament-jni PRIVATE
|
||||||
..
|
..
|
||||||
${FILAMENT_DIR}/include
|
${FILAMENT_DIR}/include
|
||||||
|
../../filament/backend/include
|
||||||
../../third_party/robin-map
|
../../third_party/robin-map
|
||||||
../../libs/utils/include)
|
../../libs/utils/include)
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,14 @@
|
|||||||
|
android {
|
||||||
|
namespace 'com.google.android.filament'
|
||||||
|
|
||||||
|
publishing {
|
||||||
|
singleVariant("release") {
|
||||||
|
withSourcesJar()
|
||||||
|
withJavadocJar()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation deps.androidx.annotations
|
implementation deps.androidx.annotations
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,9 @@ LIBFILAMENT {
|
|||||||
global:
|
global:
|
||||||
Java_com_google_android_filament_*;
|
Java_com_google_android_filament_*;
|
||||||
JNI*;
|
JNI*;
|
||||||
|
*filament*BufferObject*;
|
||||||
*filament*Camera*;
|
*filament*Camera*;
|
||||||
|
*filament*Color*;
|
||||||
*filament*Exposure*;
|
*filament*Exposure*;
|
||||||
*filament*Skybox*;
|
*filament*Skybox*;
|
||||||
*filament*Engine*;
|
*filament*Engine*;
|
||||||
@@ -10,10 +12,15 @@ LIBFILAMENT {
|
|||||||
*filament*Aabb*;
|
*filament*Aabb*;
|
||||||
*filament*IndirectLight*;
|
*filament*IndirectLight*;
|
||||||
*filament*LightManager*;
|
*filament*LightManager*;
|
||||||
|
*filament*Renderer*;
|
||||||
|
*filament*RenderTarget*;
|
||||||
|
*filament*Scene*;
|
||||||
|
*filament*ToneMapper*;
|
||||||
*filament*Transform*;
|
*filament*Transform*;
|
||||||
*filament*Material*;
|
*filament*Material*;
|
||||||
*filament*IndexBuffer*;
|
*filament*IndexBuffer*;
|
||||||
*filament*VertexBuffer*;
|
*filament*VertexBuffer*;
|
||||||
|
*filament*View*;
|
||||||
*filament*Texture*;
|
*filament*Texture*;
|
||||||
*filament*geometry*;
|
*filament*geometry*;
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,100 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2021 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <jni.h>
|
||||||
|
|
||||||
|
#include <functional>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <filament/BufferObject.h>
|
||||||
|
|
||||||
|
#include <backend/BufferDescriptor.h>
|
||||||
|
|
||||||
|
#include "common/CallbackUtils.h"
|
||||||
|
#include "common/NioUtils.h"
|
||||||
|
|
||||||
|
using namespace filament;
|
||||||
|
using namespace backend;
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT jlong JNICALL
|
||||||
|
Java_com_google_android_filament_BufferObject_nCreateBuilder(JNIEnv *env, jclass type) {
|
||||||
|
return (jlong) new BufferObject::Builder();
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT void JNICALL
|
||||||
|
Java_com_google_android_filament_BufferObject_nDestroyBuilder(JNIEnv *env, jclass type,
|
||||||
|
jlong nativeBuilder) {
|
||||||
|
BufferObject::Builder* builder = (BufferObject::Builder *) nativeBuilder;
|
||||||
|
delete builder;
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT void JNICALL
|
||||||
|
Java_com_google_android_filament_BufferObject_nBuilderSize(JNIEnv *env, jclass type,
|
||||||
|
jlong nativeBuilder, jint byteCount) {
|
||||||
|
BufferObject::Builder* builder = (BufferObject::Builder *) nativeBuilder;
|
||||||
|
builder->size((uint32_t) byteCount);
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT void JNICALL
|
||||||
|
Java_com_google_android_filament_BufferObject_nBuilderBindingType(JNIEnv *env, jclass type,
|
||||||
|
jlong nativeBuilder, jint bindingType) {
|
||||||
|
using BindingType = BufferObject::BindingType;
|
||||||
|
BufferObject::Builder* builder = (BufferObject::Builder *) nativeBuilder;
|
||||||
|
BindingType types[] = {BindingType::VERTEX};
|
||||||
|
builder->bindingType(types[bindingType]);
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT jlong JNICALL
|
||||||
|
Java_com_google_android_filament_BufferObject_nBuilderBuild(JNIEnv *env, jclass type,
|
||||||
|
jlong nativeBuilder, jlong nativeEngine) {
|
||||||
|
BufferObject::Builder* builder = (BufferObject::Builder *) nativeBuilder;
|
||||||
|
Engine *engine = (Engine *) nativeEngine;
|
||||||
|
return (jlong) builder->build(*engine);
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT jint JNICALL
|
||||||
|
Java_com_google_android_filament_BufferObject_nGetByteCount(JNIEnv *env, jclass type,
|
||||||
|
jlong nativeBufferObject) {
|
||||||
|
BufferObject *bufferObject = (BufferObject *) nativeBufferObject;
|
||||||
|
return (jint) bufferObject->getByteCount();
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT int JNICALL
|
||||||
|
Java_com_google_android_filament_BufferObject_nSetBuffer(JNIEnv *env, jclass type,
|
||||||
|
jlong nativeBufferObject, jlong nativeEngine, jobject buffer, int remaining,
|
||||||
|
jint destOffsetInBytes, jint count,
|
||||||
|
jobject handler, jobject runnable) {
|
||||||
|
BufferObject *bufferObject = (BufferObject *) nativeBufferObject;
|
||||||
|
Engine *engine = (Engine *) nativeEngine;
|
||||||
|
|
||||||
|
AutoBuffer nioBuffer(env, buffer, count);
|
||||||
|
void* data = nioBuffer.getData();
|
||||||
|
size_t sizeInBytes = nioBuffer.getSize();
|
||||||
|
if (sizeInBytes > (remaining << nioBuffer.getShift())) {
|
||||||
|
// BufferOverflowException
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto* callback = JniBufferCallback::make(engine, env, handler, runnable, std::move(nioBuffer));
|
||||||
|
|
||||||
|
BufferDescriptor desc(data, sizeInBytes,
|
||||||
|
callback->getHandler(), &JniBufferCallback::postToJavaAndDestroy, callback);
|
||||||
|
|
||||||
|
bufferObject->setBuffer(*engine, std::move(desc), (uint32_t) destOffsetInBytes);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
@@ -18,6 +18,8 @@
|
|||||||
|
|
||||||
#include <filament/Camera.h>
|
#include <filament/Camera.h>
|
||||||
|
|
||||||
|
#include <utils/Entity.h>
|
||||||
|
|
||||||
#include <math/mat4.h>
|
#include <math/mat4.h>
|
||||||
|
|
||||||
using namespace filament;
|
using namespace filament;
|
||||||
@@ -47,20 +49,31 @@ Java_com_google_android_filament_Camera_nSetLensProjection(JNIEnv*, jclass,
|
|||||||
|
|
||||||
extern "C" JNIEXPORT void JNICALL
|
extern "C" JNIEXPORT void JNICALL
|
||||||
Java_com_google_android_filament_Camera_nSetCustomProjection(JNIEnv *env, jclass,
|
Java_com_google_android_filament_Camera_nSetCustomProjection(JNIEnv *env, jclass,
|
||||||
jlong nativeCamera, jdoubleArray inMatrix_, jdouble near, jdouble far) {
|
jlong nativeCamera, jdoubleArray inProjection_, jdoubleArray inProjectionForCulling_,
|
||||||
|
jdouble near, jdouble far) {
|
||||||
Camera *camera = (Camera *) nativeCamera;
|
Camera *camera = (Camera *) nativeCamera;
|
||||||
jdouble *inMatrix = env->GetDoubleArrayElements(inMatrix_, NULL);
|
jdouble *inProjection = env->GetDoubleArrayElements(inProjection_, NULL);
|
||||||
camera->setCustomProjection(*reinterpret_cast<const filament::math::mat4 *>(inMatrix), near, far);
|
jdouble *inProjectionForCulling = env->GetDoubleArrayElements(inProjectionForCulling_, NULL);
|
||||||
env->ReleaseDoubleArrayElements(inMatrix_, inMatrix, JNI_ABORT);
|
camera->setCustomProjection(
|
||||||
|
*reinterpret_cast<const filament::math::mat4 *>(inProjection),
|
||||||
|
*reinterpret_cast<const filament::math::mat4 *>(inProjectionForCulling),
|
||||||
|
near, far);
|
||||||
|
env->ReleaseDoubleArrayElements(inProjection_, inProjection, JNI_ABORT);
|
||||||
|
env->ReleaseDoubleArrayElements(inProjectionForCulling_, inProjectionForCulling, JNI_ABORT);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" JNIEXPORT void JNICALL
|
extern "C" JNIEXPORT void JNICALL
|
||||||
Java_com_google_android_filament_Camera_nSetScaling(JNIEnv* env, jclass,
|
Java_com_google_android_filament_Camera_nSetScaling(JNIEnv* env, jclass,
|
||||||
jlong nativeCamera, jdoubleArray inScaling_) {
|
jlong nativeCamera, jdouble x, jdouble y) {
|
||||||
Camera *camera = (Camera *) nativeCamera;
|
Camera *camera = (Camera *) nativeCamera;
|
||||||
jdouble *inScaling = env->GetDoubleArrayElements(inScaling_, NULL);
|
camera->setScaling({(double)x, (double)y});
|
||||||
camera->setScaling(*reinterpret_cast<const filament::math::double4*>(inScaling));
|
}
|
||||||
env->ReleaseDoubleArrayElements(inScaling_, inScaling, JNI_ABORT);
|
|
||||||
|
extern "C" JNIEXPORT void JNICALL
|
||||||
|
Java_com_google_android_filament_Camera_nSetShift(JNIEnv* env, jclass,
|
||||||
|
jlong nativeCamera, jdouble x, jdouble y) {
|
||||||
|
Camera *camera = (Camera *) nativeCamera;
|
||||||
|
camera->setShift({(double)x, (double)y});
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" JNIEXPORT void JNICALL
|
extern "C" JNIEXPORT void JNICALL
|
||||||
@@ -71,13 +84,13 @@ Java_com_google_android_filament_Camera_nLookAt(JNIEnv*, jclass, jlong nativeCam
|
|||||||
camera->lookAt({eye_x, eye_y, eye_z}, {center_x, center_y, center_z}, {up_x, up_y, up_z});
|
camera->lookAt({eye_x, eye_y, eye_z}, {center_x, center_y, center_z}, {up_x, up_y, up_z});
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" JNIEXPORT jfloat JNICALL
|
extern "C" JNIEXPORT jdouble JNICALL
|
||||||
Java_com_google_android_filament_Camera_nGetNear(JNIEnv*, jclass, jlong nativeCamera) {
|
Java_com_google_android_filament_Camera_nGetNear(JNIEnv*, jclass, jlong nativeCamera) {
|
||||||
Camera *camera = (Camera *) nativeCamera;
|
Camera *camera = (Camera *) nativeCamera;
|
||||||
return camera->getNear();
|
return camera->getNear();
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" JNIEXPORT jfloat JNICALL
|
extern "C" JNIEXPORT jdouble JNICALL
|
||||||
Java_com_google_android_filament_Camera_nGetCullingFar(JNIEnv*, jclass,
|
Java_com_google_android_filament_Camera_nGetCullingFar(JNIEnv*, jclass,
|
||||||
jlong nativeCamera) {
|
jlong nativeCamera) {
|
||||||
Camera *camera = (Camera *) nativeCamera;
|
Camera *camera = (Camera *) nativeCamera;
|
||||||
@@ -89,10 +102,19 @@ Java_com_google_android_filament_Camera_nSetModelMatrix(JNIEnv *env, jclass,
|
|||||||
jlong nativeCamera, jfloatArray in_) {
|
jlong nativeCamera, jfloatArray in_) {
|
||||||
Camera* camera = (Camera *) nativeCamera;
|
Camera* camera = (Camera *) nativeCamera;
|
||||||
jfloat *in = env->GetFloatArrayElements(in_, NULL);
|
jfloat *in = env->GetFloatArrayElements(in_, NULL);
|
||||||
camera->setModelMatrix(*reinterpret_cast<const filament::math::mat4f*>(in));
|
camera->setModelMatrix((math::mat4)*reinterpret_cast<const filament::math::mat4f*>(in));
|
||||||
env->ReleaseFloatArrayElements(in_, in, JNI_ABORT);
|
env->ReleaseFloatArrayElements(in_, in, JNI_ABORT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT void JNICALL
|
||||||
|
Java_com_google_android_filament_Camera_nSetModelMatrixFp64(JNIEnv *env, jclass,
|
||||||
|
jlong nativeCamera, jdoubleArray in_) {
|
||||||
|
Camera* camera = (Camera *) nativeCamera;
|
||||||
|
jdouble *in = env->GetDoubleArrayElements(in_, NULL);
|
||||||
|
camera->setModelMatrix(*reinterpret_cast<const filament::math::mat4*>(in));
|
||||||
|
env->ReleaseDoubleArrayElements(in_, in, JNI_ABORT);
|
||||||
|
}
|
||||||
|
|
||||||
extern "C" JNIEXPORT void JNICALL
|
extern "C" JNIEXPORT void JNICALL
|
||||||
Java_com_google_android_filament_Camera_nGetProjectionMatrix(JNIEnv *env, jclass,
|
Java_com_google_android_filament_Camera_nGetProjectionMatrix(JNIEnv *env, jclass,
|
||||||
jlong nativeCamera, jdoubleArray out_) {
|
jlong nativeCamera, jdoubleArray out_) {
|
||||||
@@ -128,21 +150,41 @@ Java_com_google_android_filament_Camera_nGetModelMatrix(JNIEnv *env, jclass,
|
|||||||
jlong nativeCamera, jfloatArray out_) {
|
jlong nativeCamera, jfloatArray out_) {
|
||||||
Camera *camera = (Camera *) nativeCamera;
|
Camera *camera = (Camera *) nativeCamera;
|
||||||
jfloat *out = env->GetFloatArrayElements(out_, NULL);
|
jfloat *out = env->GetFloatArrayElements(out_, NULL);
|
||||||
const filament::math::mat4f& m = camera->getModelMatrix();
|
const filament::math::mat4f& m = (math::mat4f)camera->getModelMatrix();
|
||||||
std::copy_n(&m[0][0], 16, out);
|
std::copy_n(&m[0][0], 16, out);
|
||||||
env->ReleaseFloatArrayElements(out_, out, 0);
|
env->ReleaseFloatArrayElements(out_, out, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT void JNICALL
|
||||||
|
Java_com_google_android_filament_Camera_nGetModelMatrixFp64(JNIEnv *env, jclass,
|
||||||
|
jlong nativeCamera, jdoubleArray out_) {
|
||||||
|
Camera *camera = (Camera *) nativeCamera;
|
||||||
|
jdouble *out = env->GetDoubleArrayElements(out_, NULL);
|
||||||
|
const filament::math::mat4& m = camera->getModelMatrix();
|
||||||
|
std::copy_n(&m[0][0], 16, out);
|
||||||
|
env->ReleaseDoubleArrayElements(out_, out, 0);
|
||||||
|
}
|
||||||
|
|
||||||
extern "C" JNIEXPORT void JNICALL
|
extern "C" JNIEXPORT void JNICALL
|
||||||
Java_com_google_android_filament_Camera_nGetViewMatrix(JNIEnv *env, jclass, jlong nativeCamera,
|
Java_com_google_android_filament_Camera_nGetViewMatrix(JNIEnv *env, jclass, jlong nativeCamera,
|
||||||
jfloatArray out_) {
|
jfloatArray out_) {
|
||||||
Camera *camera = (Camera *) nativeCamera;
|
Camera *camera = (Camera *) nativeCamera;
|
||||||
jfloat *out = env->GetFloatArrayElements(out_, NULL);
|
jfloat *out = env->GetFloatArrayElements(out_, NULL);
|
||||||
const filament::math::mat4f& m = camera->getViewMatrix();
|
const filament::math::mat4f& m = (math::mat4f)camera->getViewMatrix();
|
||||||
std::copy_n(&m[0][0], 16, out);
|
std::copy_n(&m[0][0], 16, out);
|
||||||
env->ReleaseFloatArrayElements(out_, out, 0);
|
env->ReleaseFloatArrayElements(out_, out, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT void JNICALL
|
||||||
|
Java_com_google_android_filament_Camera_nGetViewMatrixFp64(JNIEnv *env, jclass, jlong nativeCamera,
|
||||||
|
jdoubleArray out_) {
|
||||||
|
Camera *camera = (Camera *) nativeCamera;
|
||||||
|
jdouble *out = env->GetDoubleArrayElements(out_, NULL);
|
||||||
|
const filament::math::mat4& m = camera->getViewMatrix();
|
||||||
|
std::copy_n(&m[0][0], 16, out);
|
||||||
|
env->ReleaseDoubleArrayElements(out_, out, 0);
|
||||||
|
}
|
||||||
|
|
||||||
extern "C" JNIEXPORT void JNICALL
|
extern "C" JNIEXPORT void JNICALL
|
||||||
Java_com_google_android_filament_Camera_nGetPosition(JNIEnv *env, jclass, jlong nativeCamera,
|
Java_com_google_android_filament_Camera_nGetPosition(JNIEnv *env, jclass, jlong nativeCamera,
|
||||||
jfloatArray out_) {
|
jfloatArray out_) {
|
||||||
@@ -205,3 +247,36 @@ Java_com_google_android_filament_Camera_nGetSensitivity(JNIEnv*, jclass,
|
|||||||
Camera *camera = (Camera *) nativeCamera;
|
Camera *camera = (Camera *) nativeCamera;
|
||||||
return camera->getSensitivity();
|
return camera->getSensitivity();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT void JNICALL
|
||||||
|
Java_com_google_android_filament_Camera_nSetFocusDistance(JNIEnv*, jclass,
|
||||||
|
jlong nativeCamera, jfloat focusDistance) {
|
||||||
|
Camera *camera = (Camera *) nativeCamera;
|
||||||
|
camera->setFocusDistance(focusDistance);
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT jfloat JNICALL
|
||||||
|
Java_com_google_android_filament_Camera_nGetFocusDistance(JNIEnv*, jclass,
|
||||||
|
jlong nativeCamera) {
|
||||||
|
Camera *camera = (Camera *) nativeCamera;
|
||||||
|
return camera->getFocusDistance();
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT jdouble JNICALL
|
||||||
|
Java_com_google_android_filament_Camera_nGetFocalLength(JNIEnv*, jclass,
|
||||||
|
jlong nativeCamera) {
|
||||||
|
Camera *camera = (Camera *) nativeCamera;
|
||||||
|
return camera->getFocalLength();
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT jdouble JNICALL
|
||||||
|
Java_com_google_android_filament_Camera_nComputeEffectiveFocalLength(JNIEnv*, jclass,
|
||||||
|
jdouble focalLength, jdouble focusDistance) {
|
||||||
|
return Camera::computeEffectiveFocalLength(focalLength, focusDistance);
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT jdouble JNICALL
|
||||||
|
Java_com_google_android_filament_Camera_nComputeEffectiveFov(JNIEnv*, jclass,
|
||||||
|
jdouble fovInDegrees, jdouble focusDistance) {
|
||||||
|
return Camera::computeEffectiveFov(fovInDegrees, focusDistance);
|
||||||
|
}
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
#include <jni.h>
|
#include <jni.h>
|
||||||
|
|
||||||
#include <filament/ColorGrading.h>
|
#include <filament/ColorGrading.h>
|
||||||
|
#include <filament/ToneMapper.h>
|
||||||
|
|
||||||
#include <math/vec3.h>
|
#include <math/vec3.h>
|
||||||
#include <math/vec4.h>
|
#include <math/vec4.h>
|
||||||
@@ -30,28 +31,48 @@ Java_com_google_android_filament_ColorGrading_nCreateBuilder(JNIEnv*, jclass) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
extern "C" JNIEXPORT void JNICALL
|
extern "C" JNIEXPORT void JNICALL
|
||||||
Java_com_google_android_filament_ColorGrading_nDestroyBuilder(JNIEnv*, jclass,
|
Java_com_google_android_filament_ColorGrading_nDestroyBuilder(JNIEnv*, jclass, jlong nativeBuilder) {
|
||||||
jlong nativeBuilder) {
|
|
||||||
ColorGrading::Builder* builder = (ColorGrading::Builder*) nativeBuilder;
|
ColorGrading::Builder* builder = (ColorGrading::Builder*) nativeBuilder;
|
||||||
delete builder;
|
delete builder;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" JNIEXPORT jlong JNICALL
|
extern "C" JNIEXPORT jlong JNICALL
|
||||||
Java_com_google_android_filament_ColorGrading_nBuilderBuild(JNIEnv*, jclass,
|
Java_com_google_android_filament_ColorGrading_nBuilderBuild(JNIEnv*, jclass, jlong nativeBuilder, jlong nativeEngine) {
|
||||||
jlong nativeBuilder, jlong nativeEngine) {
|
|
||||||
ColorGrading::Builder* builder = (ColorGrading::Builder*) nativeBuilder;
|
ColorGrading::Builder* builder = (ColorGrading::Builder*) nativeBuilder;
|
||||||
Engine *engine = (Engine *) nativeEngine;
|
Engine *engine = (Engine *) nativeEngine;
|
||||||
return (jlong) builder->build(*engine);
|
return (jlong) builder->build(*engine);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" JNIEXPORT void JNICALL
|
extern "C" JNIEXPORT void JNICALL
|
||||||
Java_com_google_android_filament_ColorGrading_nBuilderQuality(JNIEnv*, jclass,
|
Java_com_google_android_filament_ColorGrading_nBuilderQuality(JNIEnv*, jclass, jlong nativeBuilder, jint quality_) {
|
||||||
jlong nativeBuilder, jint quality_) {
|
|
||||||
ColorGrading::Builder* builder = (ColorGrading::Builder*) nativeBuilder;
|
ColorGrading::Builder* builder = (ColorGrading::Builder*) nativeBuilder;
|
||||||
ColorGrading::QualityLevel quality = (ColorGrading::QualityLevel) quality_;
|
ColorGrading::QualityLevel quality = (ColorGrading::QualityLevel) quality_;
|
||||||
builder->quality(quality);
|
builder->quality(quality);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT void JNICALL
|
||||||
|
Java_com_google_android_filament_ColorGrading_nBuilderFormat(JNIEnv*, jclass, jlong nativeBuilder, jint format_) {
|
||||||
|
ColorGrading::Builder* builder = (ColorGrading::Builder*) nativeBuilder;
|
||||||
|
ColorGrading::LutFormat format = (ColorGrading::LutFormat) format_;
|
||||||
|
builder->format(format);
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT void JNICALL
|
||||||
|
Java_com_google_android_filament_ColorGrading_nBuilderDimensions(JNIEnv*, jclass, jlong nativeBuilder, jint dim_) {
|
||||||
|
ColorGrading::Builder* builder = (ColorGrading::Builder*) nativeBuilder;
|
||||||
|
builder->dimensions((uint8_t)dim_);
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT void JNICALL
|
||||||
|
Java_com_google_android_filament_ColorGrading_nBuilderToneMapper(JNIEnv*, jclass,
|
||||||
|
jlong nativeBuilder, jlong toneMapper_) {
|
||||||
|
ColorGrading::Builder* builder = (ColorGrading::Builder*) nativeBuilder;
|
||||||
|
const ToneMapper* toneMapper = (const ToneMapper*) toneMapper_;
|
||||||
|
builder->toneMapper(toneMapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
#pragma clang diagnostic push
|
||||||
|
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||||
extern "C" JNIEXPORT void JNICALL
|
extern "C" JNIEXPORT void JNICALL
|
||||||
Java_com_google_android_filament_ColorGrading_nBuilderToneMapping(JNIEnv*, jclass,
|
Java_com_google_android_filament_ColorGrading_nBuilderToneMapping(JNIEnv*, jclass,
|
||||||
jlong nativeBuilder, jint toneMapping_) {
|
jlong nativeBuilder, jint toneMapping_) {
|
||||||
@@ -59,6 +80,35 @@ Java_com_google_android_filament_ColorGrading_nBuilderToneMapping(JNIEnv*, jclas
|
|||||||
ColorGrading::ToneMapping toneMapping = (ColorGrading::ToneMapping) toneMapping_;
|
ColorGrading::ToneMapping toneMapping = (ColorGrading::ToneMapping) toneMapping_;
|
||||||
builder->toneMapping(toneMapping);
|
builder->toneMapping(toneMapping);
|
||||||
}
|
}
|
||||||
|
#pragma clang diagnostic pop
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT void JNICALL
|
||||||
|
Java_com_google_android_filament_ColorGrading_nBuilderLuminanceScaling(JNIEnv*, jclass,
|
||||||
|
jlong nativeBuilder, jboolean luminanceScaling) {
|
||||||
|
ColorGrading::Builder* builder = (ColorGrading::Builder*) nativeBuilder;
|
||||||
|
builder->luminanceScaling(luminanceScaling);
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT void JNICALL
|
||||||
|
Java_com_google_android_filament_ColorGrading_nBuilderGamutMapping(JNIEnv*, jclass,
|
||||||
|
jlong nativeBuilder, jboolean gamutMapping) {
|
||||||
|
ColorGrading::Builder* builder = (ColorGrading::Builder*) nativeBuilder;
|
||||||
|
builder->gamutMapping(gamutMapping);
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT void JNICALL
|
||||||
|
Java_com_google_android_filament_ColorGrading_nBuilderExposure(JNIEnv*, jclass,
|
||||||
|
jlong nativeBuilder, jfloat exposure) {
|
||||||
|
ColorGrading::Builder* builder = (ColorGrading::Builder*) nativeBuilder;
|
||||||
|
builder->exposure(exposure);
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT void JNICALL
|
||||||
|
Java_com_google_android_filament_ColorGrading_nBuilderNightAdaptation(JNIEnv*, jclass,
|
||||||
|
jlong nativeBuilder, jfloat adaptation) {
|
||||||
|
ColorGrading::Builder* builder = (ColorGrading::Builder*) nativeBuilder;
|
||||||
|
builder->nightAdaptation(adaptation);
|
||||||
|
}
|
||||||
|
|
||||||
extern "C" JNIEXPORT void JNICALL
|
extern "C" JNIEXPORT void JNICALL
|
||||||
Java_com_google_android_filament_ColorGrading_nBuilderWhiteBalance(JNIEnv*, jclass,
|
Java_com_google_android_filament_ColorGrading_nBuilderWhiteBalance(JNIEnv*, jclass,
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
#include <jni.h>
|
#include <jni.h>
|
||||||
|
|
||||||
|
#include <filament/Camera.h>
|
||||||
#include <filament/Engine.h>
|
#include <filament/Engine.h>
|
||||||
|
|
||||||
#include <utils/Entity.h>
|
#include <utils/Entity.h>
|
||||||
@@ -44,12 +45,11 @@ extern "C" {
|
|||||||
// handle. Whatever object is returned from this method must match what is in
|
// handle. Whatever object is returned from this method must match what is in
|
||||||
// folder filament/src/driver/opengl/Context* in particular pay attention to
|
// folder filament/src/driver/opengl/Context* in particular pay attention to
|
||||||
// the object type in makeCurrent method.
|
// the object type in makeCurrent method.
|
||||||
extern void *getNativeWindow(JNIEnv *env, jclass, jobject surface);
|
extern void* getNativeWindow(JNIEnv* env, jclass, jobject surface);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" JNIEXPORT jlong JNICALL
|
extern "C" JNIEXPORT jlong JNICALL
|
||||||
Java_com_google_android_filament_Engine_nGetBackend(JNIEnv* env,
|
Java_com_google_android_filament_Engine_nGetBackend(JNIEnv*, jclass, jlong nativeEngine) {
|
||||||
jclass klass, jlong nativeEngine) {
|
|
||||||
Engine* engine = (Engine*) nativeEngine;
|
Engine* engine = (Engine*) nativeEngine;
|
||||||
return (jlong) engine->getBackend();
|
return (jlong) engine->getBackend();
|
||||||
}
|
}
|
||||||
@@ -63,8 +63,8 @@ Java_com_google_android_filament_Engine_nCreateSwapChain(JNIEnv* env,
|
|||||||
}
|
}
|
||||||
|
|
||||||
extern "C" JNIEXPORT jlong JNICALL
|
extern "C" JNIEXPORT jlong JNICALL
|
||||||
Java_com_google_android_filament_Engine_nCreateSwapChainHeadless(JNIEnv* env,
|
Java_com_google_android_filament_Engine_nCreateSwapChainHeadless(JNIEnv*,
|
||||||
jclass klass, jlong nativeEngine, jint width, jint height, jlong flags) {
|
jclass, jlong nativeEngine, jint width, jint height, jlong flags) {
|
||||||
Engine* engine = (Engine*) nativeEngine;
|
Engine* engine = (Engine*) nativeEngine;
|
||||||
return (jlong) engine->createSwapChain(width, height, (uint64_t) flags);
|
return (jlong) engine->createSwapChain(width, height, (uint64_t) flags);
|
||||||
}
|
}
|
||||||
@@ -80,7 +80,7 @@ extern "C" JNIEXPORT jboolean JNICALL
|
|||||||
Java_com_google_android_filament_Engine_nDestroySwapChain(JNIEnv*, jclass,
|
Java_com_google_android_filament_Engine_nDestroySwapChain(JNIEnv*, jclass,
|
||||||
jlong nativeEngine, jlong nativeSwapChain) {
|
jlong nativeEngine, jlong nativeSwapChain) {
|
||||||
Engine* engine = (Engine*) nativeEngine;
|
Engine* engine = (Engine*) nativeEngine;
|
||||||
SwapChain *swapChain = (SwapChain *) nativeSwapChain;
|
SwapChain* swapChain = (SwapChain*) nativeSwapChain;
|
||||||
return engine->destroy(swapChain);
|
return engine->destroy(swapChain);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -97,7 +97,7 @@ extern "C" JNIEXPORT jboolean JNICALL
|
|||||||
Java_com_google_android_filament_Engine_nDestroyView(JNIEnv*, jclass,
|
Java_com_google_android_filament_Engine_nDestroyView(JNIEnv*, jclass,
|
||||||
jlong nativeEngine, jlong nativeView) {
|
jlong nativeEngine, jlong nativeView) {
|
||||||
Engine* engine = (Engine*) nativeEngine;
|
Engine* engine = (Engine*) nativeEngine;
|
||||||
View *view = (View *) nativeView;
|
View* view = (View*) nativeView;
|
||||||
return engine->destroy(view);
|
return engine->destroy(view);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -114,21 +114,14 @@ extern "C" JNIEXPORT jboolean JNICALL
|
|||||||
Java_com_google_android_filament_Engine_nDestroyRenderer(JNIEnv*, jclass,
|
Java_com_google_android_filament_Engine_nDestroyRenderer(JNIEnv*, jclass,
|
||||||
jlong nativeEngine, jlong nativeRenderer) {
|
jlong nativeEngine, jlong nativeRenderer) {
|
||||||
Engine* engine = (Engine*) nativeEngine;
|
Engine* engine = (Engine*) nativeEngine;
|
||||||
Renderer *renderer = (Renderer *) nativeRenderer;
|
Renderer* renderer = (Renderer*) nativeRenderer;
|
||||||
return engine->destroy(renderer);
|
return engine->destroy(renderer);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Camera
|
// Camera
|
||||||
|
|
||||||
extern "C" [[deprecated]] JNIEXPORT jlong JNICALL
|
|
||||||
Java_com_google_android_filament_Engine_nCreateCamera(JNIEnv*, jclass,
|
|
||||||
jlong nativeEngine) {
|
|
||||||
Engine* engine = (Engine*) nativeEngine;
|
|
||||||
return (jlong) engine->createCamera();
|
|
||||||
}
|
|
||||||
|
|
||||||
extern "C" JNIEXPORT jlong JNICALL
|
extern "C" JNIEXPORT jlong JNICALL
|
||||||
Java_com_google_android_filament_Engine_nCreateCameraWithEntity(JNIEnv*, jclass,
|
Java_com_google_android_filament_Engine_nCreateCamera(JNIEnv*, jclass,
|
||||||
jlong nativeEngine, jint entity_) {
|
jlong nativeEngine, jint entity_) {
|
||||||
Engine* engine = (Engine*) nativeEngine;
|
Engine* engine = (Engine*) nativeEngine;
|
||||||
Entity& entity = *reinterpret_cast<Entity*>(&entity_);
|
Entity& entity = *reinterpret_cast<Entity*>(&entity_);
|
||||||
@@ -143,12 +136,12 @@ Java_com_google_android_filament_Engine_nGetCameraComponent(JNIEnv*, jclass,
|
|||||||
return (jlong) engine->getCameraComponent(entity);
|
return (jlong) engine->getCameraComponent(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" [[deprecated]] JNIEXPORT void JNICALL
|
extern "C" JNIEXPORT void JNICALL
|
||||||
Java_com_google_android_filament_Engine_nDestroyCamera(JNIEnv*, jclass,
|
Java_com_google_android_filament_Engine_nDestroyCameraComponent(JNIEnv*, jclass,
|
||||||
jlong nativeEngine, jlong nativeCamera) {
|
jlong nativeEngine, jint entity_) {
|
||||||
Engine* engine = (Engine*) nativeEngine;
|
Engine* engine = (Engine*) nativeEngine;
|
||||||
Camera *camera = (Camera *) nativeCamera;
|
Entity& entity = *reinterpret_cast<Entity*>(&entity_);
|
||||||
engine->destroy(camera);
|
engine->destroyCameraComponent(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Scene
|
// Scene
|
||||||
@@ -164,7 +157,7 @@ extern "C" JNIEXPORT jboolean JNICALL
|
|||||||
Java_com_google_android_filament_Engine_nDestroyScene(JNIEnv*, jclass,
|
Java_com_google_android_filament_Engine_nDestroyScene(JNIEnv*, jclass,
|
||||||
jlong nativeEngine, jlong nativeScene) {
|
jlong nativeEngine, jlong nativeScene) {
|
||||||
Engine* engine = (Engine*) nativeEngine;
|
Engine* engine = (Engine*) nativeEngine;
|
||||||
Scene *scene = (Scene *) nativeScene;
|
Scene* scene = (Scene*) nativeScene;
|
||||||
return engine->destroy(scene);
|
return engine->destroy(scene);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -181,7 +174,7 @@ extern "C" JNIEXPORT jboolean JNICALL
|
|||||||
Java_com_google_android_filament_Engine_nDestroyFence(JNIEnv*, jclass,
|
Java_com_google_android_filament_Engine_nDestroyFence(JNIEnv*, jclass,
|
||||||
jlong nativeEngine, jlong nativeFence) {
|
jlong nativeEngine, jlong nativeFence) {
|
||||||
Engine* engine = (Engine*) nativeEngine;
|
Engine* engine = (Engine*) nativeEngine;
|
||||||
Fence *fence = (Fence *) nativeFence;
|
Fence* fence = (Fence*) nativeFence;
|
||||||
return engine->destroy(fence);
|
return engine->destroy(fence);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -191,7 +184,7 @@ extern "C" JNIEXPORT jboolean JNICALL
|
|||||||
Java_com_google_android_filament_Engine_nDestroyStream(JNIEnv*, jclass,
|
Java_com_google_android_filament_Engine_nDestroyStream(JNIEnv*, jclass,
|
||||||
jlong nativeEngine, jlong nativeStream) {
|
jlong nativeEngine, jlong nativeStream) {
|
||||||
Engine* engine = (Engine*) nativeEngine;
|
Engine* engine = (Engine*) nativeEngine;
|
||||||
Stream *stream = (Stream *) nativeStream;
|
Stream* stream = (Stream*) nativeStream;
|
||||||
return engine->destroy(stream);
|
return engine->destroy(stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -201,7 +194,7 @@ extern "C" JNIEXPORT jboolean JNICALL
|
|||||||
Java_com_google_android_filament_Engine_nDestroyIndexBuffer(JNIEnv*, jclass,
|
Java_com_google_android_filament_Engine_nDestroyIndexBuffer(JNIEnv*, jclass,
|
||||||
jlong nativeEngine, jlong nativeIndexBuffer) {
|
jlong nativeEngine, jlong nativeIndexBuffer) {
|
||||||
Engine* engine = (Engine*) nativeEngine;
|
Engine* engine = (Engine*) nativeEngine;
|
||||||
IndexBuffer *indexBuffer = (IndexBuffer *) nativeIndexBuffer;
|
IndexBuffer* indexBuffer = (IndexBuffer*) nativeIndexBuffer;
|
||||||
return engine->destroy(indexBuffer);
|
return engine->destroy(indexBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -209,15 +202,23 @@ extern "C" JNIEXPORT jboolean JNICALL
|
|||||||
Java_com_google_android_filament_Engine_nDestroyVertexBuffer(JNIEnv*, jclass,
|
Java_com_google_android_filament_Engine_nDestroyVertexBuffer(JNIEnv*, jclass,
|
||||||
jlong nativeEngine, jlong nativeVertexBuffer) {
|
jlong nativeEngine, jlong nativeVertexBuffer) {
|
||||||
Engine* engine = (Engine*) nativeEngine;
|
Engine* engine = (Engine*) nativeEngine;
|
||||||
VertexBuffer *vertexBuffer = (VertexBuffer *) nativeVertexBuffer;
|
VertexBuffer* vertexBuffer = (VertexBuffer*) nativeVertexBuffer;
|
||||||
return engine->destroy(vertexBuffer);
|
return engine->destroy(vertexBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT jboolean JNICALL
|
||||||
|
Java_com_google_android_filament_Engine_nDestroySkinningBuffer(JNIEnv*, jclass,
|
||||||
|
jlong nativeEngine, jlong nativeSkinningBuffer) {
|
||||||
|
Engine* engine = (Engine*) nativeEngine;
|
||||||
|
SkinningBuffer* skinningBuffer = (SkinningBuffer*) nativeSkinningBuffer;
|
||||||
|
return engine->destroy(skinningBuffer);
|
||||||
|
}
|
||||||
|
|
||||||
extern "C" JNIEXPORT jboolean JNICALL
|
extern "C" JNIEXPORT jboolean JNICALL
|
||||||
Java_com_google_android_filament_Engine_nDestroyIndirectLight(JNIEnv*, jclass,
|
Java_com_google_android_filament_Engine_nDestroyIndirectLight(JNIEnv*, jclass,
|
||||||
jlong nativeEngine, jlong nativeIndirectLight) {
|
jlong nativeEngine, jlong nativeIndirectLight) {
|
||||||
Engine* engine = (Engine*) nativeEngine;
|
Engine* engine = (Engine*) nativeEngine;
|
||||||
IndirectLight *indirectLight = (IndirectLight *) nativeIndirectLight;
|
IndirectLight* indirectLight = (IndirectLight*) nativeIndirectLight;
|
||||||
return engine->destroy(indirectLight);
|
return engine->destroy(indirectLight);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -225,7 +226,7 @@ extern "C" JNIEXPORT jboolean JNICALL
|
|||||||
Java_com_google_android_filament_Engine_nDestroyMaterial(JNIEnv*, jclass,
|
Java_com_google_android_filament_Engine_nDestroyMaterial(JNIEnv*, jclass,
|
||||||
jlong nativeEngine, jlong nativeMaterial) {
|
jlong nativeEngine, jlong nativeMaterial) {
|
||||||
Engine* engine = (Engine*) nativeEngine;
|
Engine* engine = (Engine*) nativeEngine;
|
||||||
Material *material = (Material *) nativeMaterial;
|
Material* material = (Material*) nativeMaterial;
|
||||||
return engine->destroy(material);
|
return engine->destroy(material);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -241,7 +242,7 @@ extern "C" JNIEXPORT jboolean JNICALL
|
|||||||
Java_com_google_android_filament_Engine_nDestroySkybox(JNIEnv*, jclass,
|
Java_com_google_android_filament_Engine_nDestroySkybox(JNIEnv*, jclass,
|
||||||
jlong nativeEngine, jlong nativeSkybox) {
|
jlong nativeEngine, jlong nativeSkybox) {
|
||||||
Engine* engine = (Engine*) nativeEngine;
|
Engine* engine = (Engine*) nativeEngine;
|
||||||
Skybox *skybox = (Skybox *) nativeSkybox;
|
Skybox* skybox = (Skybox*) nativeSkybox;
|
||||||
return engine->destroy(skybox);
|
return engine->destroy(skybox);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -257,7 +258,7 @@ extern "C" JNIEXPORT jboolean JNICALL
|
|||||||
Java_com_google_android_filament_Engine_nDestroyTexture(JNIEnv*, jclass,
|
Java_com_google_android_filament_Engine_nDestroyTexture(JNIEnv*, jclass,
|
||||||
jlong nativeEngine, jlong nativeTexture) {
|
jlong nativeEngine, jlong nativeTexture) {
|
||||||
Engine* engine = (Engine*) nativeEngine;
|
Engine* engine = (Engine*) nativeEngine;
|
||||||
Texture *texture = (Texture *) nativeTexture;
|
Texture* texture = (Texture*) nativeTexture;
|
||||||
return engine->destroy(texture);
|
return engine->destroy(texture);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -277,8 +278,114 @@ Java_com_google_android_filament_Engine_nDestroyEntity(JNIEnv*, jclass,
|
|||||||
engine->destroy(entity);
|
engine->destroy(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT jboolean JNICALL
|
||||||
|
Java_com_google_android_filament_Engine_nIsValidRenderer(JNIEnv*, jclass,
|
||||||
|
jlong nativeEngine, jlong nativeRenderer) {
|
||||||
|
Engine* engine = (Engine *)nativeEngine;
|
||||||
|
return (jboolean)engine->isValid((Renderer*)nativeRenderer);
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT jboolean JNICALL
|
||||||
|
Java_com_google_android_filament_Engine_nIsValidView(JNIEnv*, jclass,
|
||||||
|
jlong nativeEngine, jlong nativeView) {
|
||||||
|
Engine* engine = (Engine *)nativeEngine;
|
||||||
|
return (jboolean)engine->isValid((View*)nativeView);
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT jboolean JNICALL
|
||||||
|
Java_com_google_android_filament_Engine_nIsValidScene(JNIEnv*, jclass,
|
||||||
|
jlong nativeEngine, jlong nativeScene) {
|
||||||
|
Engine* engine = (Engine *)nativeEngine;
|
||||||
|
return (jboolean)engine->isValid((Scene*)nativeScene);
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT jboolean JNICALL
|
||||||
|
Java_com_google_android_filament_Engine_nIsValidFence(JNIEnv*, jclass,
|
||||||
|
jlong nativeEngine, jlong nativeFence) {
|
||||||
|
Engine* engine = (Engine *)nativeEngine;
|
||||||
|
return (jboolean)engine->isValid((Fence*)nativeFence);
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT jboolean JNICALL
|
||||||
|
Java_com_google_android_filament_Engine_nIsValidStream(JNIEnv*, jclass,
|
||||||
|
jlong nativeEngine, jlong nativeStream) {
|
||||||
|
Engine* engine = (Engine *)nativeEngine;
|
||||||
|
return (jboolean)engine->isValid((Stream*)nativeStream);
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT jboolean JNICALL
|
||||||
|
Java_com_google_android_filament_Engine_nIsValidIndexBuffer(JNIEnv*, jclass,
|
||||||
|
jlong nativeEngine, jlong nativeIndexBuffer) {
|
||||||
|
Engine* engine = (Engine *)nativeEngine;
|
||||||
|
return (jboolean)engine->isValid((IndexBuffer*)nativeIndexBuffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT jboolean JNICALL
|
||||||
|
Java_com_google_android_filament_Engine_nIsValidVertexBuffer(JNIEnv*, jclass,
|
||||||
|
jlong nativeEngine, jlong nativeVertexBuffer) {
|
||||||
|
Engine* engine = (Engine *)nativeEngine;
|
||||||
|
return (jboolean)engine->isValid((VertexBuffer*)nativeVertexBuffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT jboolean JNICALL
|
||||||
|
Java_com_google_android_filament_Engine_nIsValidSkinningBuffer(JNIEnv*, jclass,
|
||||||
|
jlong nativeEngine, jlong nativeSkinningBuffer) {
|
||||||
|
Engine* engine = (Engine *)nativeEngine;
|
||||||
|
return (jboolean)engine->isValid((SkinningBuffer*)nativeSkinningBuffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT jboolean JNICALL
|
||||||
|
Java_com_google_android_filament_Engine_nIsValidIndirectLight(JNIEnv*, jclass,
|
||||||
|
jlong nativeEngine, jlong nativeIndirectLight) {
|
||||||
|
Engine* engine = (Engine *)nativeEngine;
|
||||||
|
return (jboolean)engine->isValid((IndirectLight*)nativeIndirectLight);
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT jboolean JNICALL
|
||||||
|
Java_com_google_android_filament_Engine_nIsValidMaterial(JNIEnv*, jclass,
|
||||||
|
jlong nativeEngine, jlong nativeMaterial) {
|
||||||
|
Engine* engine = (Engine *)nativeEngine;
|
||||||
|
return (jboolean)engine->isValid((Material*)nativeMaterial);
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT jboolean JNICALL
|
||||||
|
Java_com_google_android_filament_Engine_nIsValidSkybox(JNIEnv*, jclass,
|
||||||
|
jlong nativeEngine, jlong nativeSkybox) {
|
||||||
|
Engine* engine = (Engine *)nativeEngine;
|
||||||
|
return (jboolean)engine->isValid((Skybox*)nativeSkybox);
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT jboolean JNICALL
|
||||||
|
Java_com_google_android_filament_Engine_nIsValidColorGrading(JNIEnv*, jclass,
|
||||||
|
jlong nativeEngine, jlong nativeColorGrading) {
|
||||||
|
Engine* engine = (Engine *)nativeEngine;
|
||||||
|
return (jboolean)engine->isValid((ColorGrading*)nativeColorGrading);
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT jboolean JNICALL
|
||||||
|
Java_com_google_android_filament_Engine_nIsValidTexture(JNIEnv*, jclass,
|
||||||
|
jlong nativeEngine, jlong nativeTexture) {
|
||||||
|
Engine* engine = (Engine *)nativeEngine;
|
||||||
|
return (jboolean)engine->isValid((Texture*)nativeTexture);
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT jboolean JNICALL
|
||||||
|
Java_com_google_android_filament_Engine_nIsValidRenderTarget(JNIEnv*, jclass,
|
||||||
|
jlong nativeEngine, jlong nativeTarget) {
|
||||||
|
Engine* engine = (Engine *)nativeEngine;
|
||||||
|
return (jboolean)engine->isValid((RenderTarget*)nativeTarget);
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT jboolean JNICALL
|
||||||
|
Java_com_google_android_filament_Engine_nIsValidSwapChain(JNIEnv*, jclass,
|
||||||
|
jlong nativeEngine, jlong nativeSwapChain) {
|
||||||
|
Engine* engine = (Engine *)nativeEngine;
|
||||||
|
return (jboolean)engine->isValid((SwapChain*)nativeSwapChain);
|
||||||
|
}
|
||||||
|
|
||||||
extern "C" JNIEXPORT void JNICALL
|
extern "C" JNIEXPORT void JNICALL
|
||||||
Java_com_google_android_filament_Engine_nFlushAndWait(JNIEnv *env, jclass clazz,
|
Java_com_google_android_filament_Engine_nFlushAndWait(JNIEnv*, jclass,
|
||||||
jlong nativeEngine) {
|
jlong nativeEngine) {
|
||||||
Engine* engine = (Engine*) nativeEngine;
|
Engine* engine = (Engine*) nativeEngine;
|
||||||
engine->flushAndWait();
|
engine->flushAndWait();
|
||||||
@@ -287,22 +394,19 @@ Java_com_google_android_filament_Engine_nFlushAndWait(JNIEnv *env, jclass clazz,
|
|||||||
// Managers...
|
// Managers...
|
||||||
|
|
||||||
extern "C" JNIEXPORT jlong JNICALL
|
extern "C" JNIEXPORT jlong JNICALL
|
||||||
Java_com_google_android_filament_Engine_nGetTransformManager(JNIEnv*, jclass,
|
Java_com_google_android_filament_Engine_nGetTransformManager(JNIEnv*, jclass, jlong nativeEngine) {
|
||||||
jlong nativeEngine) {
|
|
||||||
Engine* engine = (Engine*) nativeEngine;
|
Engine* engine = (Engine*) nativeEngine;
|
||||||
return (jlong) &engine->getTransformManager();
|
return (jlong) &engine->getTransformManager();
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" JNIEXPORT jlong JNICALL
|
extern "C" JNIEXPORT jlong JNICALL
|
||||||
Java_com_google_android_filament_Engine_nGetLightManager(JNIEnv*, jclass,
|
Java_com_google_android_filament_Engine_nGetLightManager(JNIEnv*, jclass, jlong nativeEngine) {
|
||||||
jlong nativeEngine) {
|
|
||||||
Engine* engine = (Engine*) nativeEngine;
|
Engine* engine = (Engine*) nativeEngine;
|
||||||
return (jlong) &engine->getLightManager();
|
return (jlong) &engine->getLightManager();
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" JNIEXPORT jlong JNICALL
|
extern "C" JNIEXPORT jlong JNICALL
|
||||||
Java_com_google_android_filament_Engine_nGetRenderableManager(JNIEnv*, jclass,
|
Java_com_google_android_filament_Engine_nGetRenderableManager(JNIEnv*, jclass, jlong nativeEngine) {
|
||||||
jlong nativeEngine) {
|
|
||||||
Engine* engine = (Engine*) nativeEngine;
|
Engine* engine = (Engine*) nativeEngine;
|
||||||
return (jlong) &engine->getRenderableManager();
|
return (jlong) &engine->getRenderableManager();
|
||||||
}
|
}
|
||||||
@@ -312,3 +416,42 @@ Java_com_google_android_filament_Engine_nGetJobSystem(JNIEnv*, jclass, jlong nat
|
|||||||
Engine* engine = (Engine*) nativeEngine;
|
Engine* engine = (Engine*) nativeEngine;
|
||||||
return (jlong) &engine->getJobSystem();
|
return (jlong) &engine->getJobSystem();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT jlong JNICALL
|
||||||
|
Java_com_google_android_filament_Engine_nGetEntityManager(JNIEnv*, jclass, jlong nativeEngine) {
|
||||||
|
Engine* engine = (Engine*) nativeEngine;
|
||||||
|
return (jlong) &engine->getEntityManager();
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT void JNICALL
|
||||||
|
Java_com_google_android_filament_Engine_nSetAutomaticInstancingEnabled(JNIEnv*, jclass, jlong nativeEngine, jboolean enable) {
|
||||||
|
Engine* engine = (Engine*) nativeEngine;
|
||||||
|
engine->setAutomaticInstancingEnabled(enable);
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT jboolean JNICALL
|
||||||
|
Java_com_google_android_filament_Engine_nIsAutomaticInstancingEnabled(JNIEnv*, jclass, jlong nativeEngine) {
|
||||||
|
Engine* engine = (Engine*) nativeEngine;
|
||||||
|
return (jboolean)engine->isAutomaticInstancingEnabled();
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT jint JNICALL
|
||||||
|
Java_com_google_android_filament_Engine_nGetSupportedFeatureLevel(JNIEnv *, jclass,
|
||||||
|
jlong nativeEngine) {
|
||||||
|
Engine* engine = (Engine*) nativeEngine;
|
||||||
|
return (jint)engine->getSupportedFeatureLevel();
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT jint JNICALL
|
||||||
|
Java_com_google_android_filament_Engine_nSetActiveFeatureLevel(JNIEnv *, jclass,
|
||||||
|
jlong nativeEngine, jint ordinal) {
|
||||||
|
Engine* engine = (Engine*) nativeEngine;
|
||||||
|
return (jint)engine->setActiveFeatureLevel((Engine::FeatureLevel)ordinal);
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT jint JNICALL
|
||||||
|
Java_com_google_android_filament_Engine_nGetActiveFeatureLevel(JNIEnv *, jclass,
|
||||||
|
jlong nativeEngine) {
|
||||||
|
Engine* engine = (Engine*) nativeEngine;
|
||||||
|
return (jint)engine->getActiveFeatureLevel();
|
||||||
|
}
|
||||||
@@ -16,9 +16,7 @@
|
|||||||
|
|
||||||
#include <jni.h>
|
#include <jni.h>
|
||||||
|
|
||||||
namespace filament {
|
#include "private/backend/VirtualMachineEnv.h"
|
||||||
extern jint JNI_OnLoad(JavaVM* vm, void* reserved);
|
|
||||||
};
|
|
||||||
|
|
||||||
JNIEXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) {
|
JNIEXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) {
|
||||||
JNIEnv* env;
|
JNIEnv* env;
|
||||||
@@ -26,9 +24,9 @@ JNIEXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) {
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ANDROID
|
// This must be called when the library is loaded. We need this to get a reference to the
|
||||||
::filament::JNI_OnLoad(vm, reserved);
|
// global VM
|
||||||
#endif
|
::filament::VirtualMachineEnv::JNI_OnLoad(vm);
|
||||||
|
|
||||||
return JNI_VERSION_1_6;
|
return JNI_VERSION_1_6;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -91,7 +91,8 @@ Java_com_google_android_filament_IndexBuffer_nSetBuffer(JNIEnv *env, jclass type
|
|||||||
|
|
||||||
auto* callback = JniBufferCallback::make(engine, env, handler, runnable, std::move(nioBuffer));
|
auto* callback = JniBufferCallback::make(engine, env, handler, runnable, std::move(nioBuffer));
|
||||||
|
|
||||||
BufferDescriptor desc(data, sizeInBytes, &JniBufferCallback::invoke, callback);
|
BufferDescriptor desc(data, sizeInBytes,
|
||||||
|
callback->getHandler(), &JniBufferCallback::postToJavaAndDestroy, callback);
|
||||||
|
|
||||||
indexBuffer->setBuffer(*engine, std::move(desc), (uint32_t) destOffsetInBytes);
|
indexBuffer->setBuffer(*engine, std::move(desc), (uint32_t) destOffsetInBytes);
|
||||||
|
|
||||||
|
|||||||
@@ -76,8 +76,10 @@ extern "C" JNIEXPORT void JNICALL
|
|||||||
Java_com_google_android_filament_LightManager_nBuilderShadowOptions(JNIEnv* env, jclass,
|
Java_com_google_android_filament_LightManager_nBuilderShadowOptions(JNIEnv* env, jclass,
|
||||||
jlong nativeBuilder, jint mapSize, jint cascades, jfloatArray splitPositions,
|
jlong nativeBuilder, jint mapSize, jint cascades, jfloatArray splitPositions,
|
||||||
jfloat constantBias, jfloat normalBias, jfloat shadowFar, jfloat shadowNearHint,
|
jfloat constantBias, jfloat normalBias, jfloat shadowFar, jfloat shadowNearHint,
|
||||||
jfloat shadowFarHint, jboolean stable, jboolean screenSpaceContactShadows, jint stepCount,
|
jfloat shadowFarHint, jboolean stable, jboolean lispsm,
|
||||||
jfloat maxShadowDistance, jint vsmMsaaSamples) {
|
jfloat polygonOffsetConstant, jfloat polygonOffsetSlope,
|
||||||
|
jboolean screenSpaceContactShadows, jint stepCount,
|
||||||
|
jfloat maxShadowDistance, jboolean elvsm, jfloat blurWidth, jfloat shadowBulbRadius) {
|
||||||
LightManager::Builder *builder = (LightManager::Builder *) nativeBuilder;
|
LightManager::Builder *builder = (LightManager::Builder *) nativeBuilder;
|
||||||
LightManager::ShadowOptions shadowOptions {
|
LightManager::ShadowOptions shadowOptions {
|
||||||
.mapSize = (uint32_t)mapSize,
|
.mapSize = (uint32_t)mapSize,
|
||||||
@@ -88,12 +90,17 @@ Java_com_google_android_filament_LightManager_nBuilderShadowOptions(JNIEnv* env,
|
|||||||
.shadowNearHint = shadowNearHint,
|
.shadowNearHint = shadowNearHint,
|
||||||
.shadowFarHint = shadowFarHint,
|
.shadowFarHint = shadowFarHint,
|
||||||
.stable = (bool)stable,
|
.stable = (bool)stable,
|
||||||
|
.lispsm = (bool)lispsm,
|
||||||
|
.polygonOffsetConstant = polygonOffsetConstant,
|
||||||
|
.polygonOffsetSlope = polygonOffsetConstant,
|
||||||
.screenSpaceContactShadows = (bool)screenSpaceContactShadows,
|
.screenSpaceContactShadows = (bool)screenSpaceContactShadows,
|
||||||
.stepCount = uint8_t(stepCount),
|
.stepCount = uint8_t(stepCount),
|
||||||
.maxShadowDistance = maxShadowDistance,
|
.maxShadowDistance = maxShadowDistance,
|
||||||
.vsm = {
|
.vsm = {
|
||||||
.msaaSamples = (uint8_t) vsmMsaaSamples
|
.elvsm = (bool)elvsm,
|
||||||
}
|
.blurWidth = blurWidth
|
||||||
|
},
|
||||||
|
.shadowBulbRadius = shadowBulbRadius
|
||||||
};
|
};
|
||||||
jfloat *nativeSplits = env->GetFloatArrayElements(splitPositions, NULL);
|
jfloat *nativeSplits = env->GetFloatArrayElements(splitPositions, NULL);
|
||||||
const jsize splitCount = std::min((jsize) 3, env->GetArrayLength(splitPositions));
|
const jsize splitCount = std::min((jsize) 3, env->GetArrayLength(splitPositions));
|
||||||
@@ -188,6 +195,23 @@ Java_com_google_android_filament_LightManager_nBuilderHaloFalloff(JNIEnv*, jclas
|
|||||||
builder->sunHaloFalloff(haloFalloff);
|
builder->sunHaloFalloff(haloFalloff);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT void JNICALL
|
||||||
|
Java_com_google_android_filament_LightManager_nBuilderLightChannel(JNIEnv*, jclass,
|
||||||
|
jlong nativeBuilder, jint channel, jboolean enable) {
|
||||||
|
LightManager::Builder *builder = (LightManager::Builder *) nativeBuilder;
|
||||||
|
builder->lightChannel(channel, (bool)enable);
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT jboolean JNICALL
|
||||||
|
Java_com_google_android_filament_LightManager_nBuilderBuild(JNIEnv*, jclass,
|
||||||
|
jlong nativeBuilder, jlong nativeEngine, jint entity) {
|
||||||
|
LightManager::Builder *builder = (LightManager::Builder *) nativeBuilder;
|
||||||
|
Engine *engine = (Engine *) nativeEngine;
|
||||||
|
return jboolean(builder->build(*engine, (Entity &) entity) == LightManager::Builder::Success);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
extern "C" JNIEXPORT void JNICALL
|
extern "C" JNIEXPORT void JNICALL
|
||||||
Java_com_google_android_filament_LightManager_nComputeUniformSplits(JNIEnv* env, jclass,
|
Java_com_google_android_filament_LightManager_nComputeUniformSplits(JNIEnv* env, jclass,
|
||||||
jfloatArray splitPositions, jint cascades) {
|
jfloatArray splitPositions, jint cascades) {
|
||||||
@@ -212,13 +236,7 @@ Java_com_google_android_filament_LightManager_nComputePracticalSplits(JNIEnv* en
|
|||||||
env->ReleaseFloatArrayElements(splitPositions, nativeSplits, 0);
|
env->ReleaseFloatArrayElements(splitPositions, nativeSplits, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" JNIEXPORT jboolean JNICALL
|
// ------------------------------------------------------------------------------------------------
|
||||||
Java_com_google_android_filament_LightManager_nBuilderBuild(JNIEnv*, jclass,
|
|
||||||
jlong nativeBuilder, jlong nativeEngine, jint entity) {
|
|
||||||
LightManager::Builder *builder = (LightManager::Builder *) nativeBuilder;
|
|
||||||
Engine *engine = (Engine *) nativeEngine;
|
|
||||||
return jboolean(builder->build(*engine, (Entity &) entity) == LightManager::Builder::Success);
|
|
||||||
}
|
|
||||||
|
|
||||||
extern "C" JNIEXPORT jint JNICALL
|
extern "C" JNIEXPORT jint JNICALL
|
||||||
Java_com_google_android_filament_LightManager_nGetType(JNIEnv* env,
|
Java_com_google_android_filament_LightManager_nGetType(JNIEnv* env,
|
||||||
@@ -379,3 +397,31 @@ Java_com_google_android_filament_LightManager_nIsShadowCaster(JNIEnv*, jclass,
|
|||||||
LightManager *lm = (LightManager *) nativeLightManager;
|
LightManager *lm = (LightManager *) nativeLightManager;
|
||||||
return (jboolean)lm->isShadowCaster((LightManager::Instance) i);
|
return (jboolean)lm->isShadowCaster((LightManager::Instance) i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT jfloat JNICALL
|
||||||
|
Java_com_google_android_filament_LightManager_nGetOuterConeAngle(JNIEnv*, jclass,
|
||||||
|
jlong nativeLightManager, jint i) {
|
||||||
|
LightManager *lm = (LightManager *) nativeLightManager;
|
||||||
|
return (jfloat)lm->getSpotLightOuterCone((LightManager::Instance) i);
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT jfloat JNICALL
|
||||||
|
Java_com_google_android_filament_LightManager_nGetInnerConeAngle(JNIEnv*, jclass,
|
||||||
|
jlong nativeLightManager, jint i) {
|
||||||
|
LightManager *lm = (LightManager *) nativeLightManager;
|
||||||
|
return (jfloat)lm->getSpotLightInnerCone((LightManager::Instance) i);
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT void JNICALL
|
||||||
|
Java_com_google_android_filament_LightManager_nSetLightChannel(JNIEnv*, jclass,
|
||||||
|
jlong nativeLightManager, jint i, jint channel, jboolean enable) {
|
||||||
|
LightManager *lm = (LightManager *) nativeLightManager;
|
||||||
|
lm->setLightChannel((LightManager::Instance) i, channel, (bool)enable);
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT jboolean JNICALL
|
||||||
|
Java_com_google_android_filament_LightManager_nGetLightChannel(JNIEnv*, jclass,
|
||||||
|
jlong nativeLightManager, jint i, jint channel) {
|
||||||
|
LightManager const *lm = (LightManager const *) nativeLightManager;
|
||||||
|
return lm->getLightChannel((LightManager::Instance) i, channel);
|
||||||
|
}
|
||||||
|
|||||||
@@ -153,6 +153,14 @@ Java_com_google_android_filament_Material_nIsDoubleSided(JNIEnv*, jclass,
|
|||||||
return (jboolean) material->isDoubleSided();
|
return (jboolean) material->isDoubleSided();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C"
|
||||||
|
JNIEXPORT jboolean JNICALL
|
||||||
|
Java_com_google_android_filament_Material_nIsAlphaToCoverageEnabled(JNIEnv*, jclass,
|
||||||
|
jlong nativeMaterial) {
|
||||||
|
Material* material = (Material*) nativeMaterial;
|
||||||
|
return (jboolean) material->isAlphaToCoverageEnabled();
|
||||||
|
}
|
||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
JNIEXPORT jfloat JNICALL
|
JNIEXPORT jfloat JNICALL
|
||||||
Java_com_google_android_filament_Material_nGetMaskThreshold(JNIEnv*, jclass,
|
Java_com_google_android_filament_Material_nGetMaskThreshold(JNIEnv*, jclass,
|
||||||
|
|||||||
@@ -246,17 +246,21 @@ Java_com_google_android_filament_MaterialInstance_nSetFloatParameterArray(JNIEnv
|
|||||||
env->ReleaseStringUTFChars(name_, name);
|
env->ReleaseStringUTFChars(name_, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// defined in TextureSampler.cpp
|
||||||
|
namespace filament::JniUtils {
|
||||||
|
TextureSampler from_long(jlong params) noexcept;
|
||||||
|
} // TextureSamplerJniUtils
|
||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
JNIEXPORT void JNICALL
|
JNIEXPORT void JNICALL
|
||||||
Java_com_google_android_filament_MaterialInstance_nSetParameterTexture(
|
Java_com_google_android_filament_MaterialInstance_nSetParameterTexture(
|
||||||
JNIEnv *env, jclass, jlong nativeMaterialInstance, jstring name_,
|
JNIEnv *env, jclass, jlong nativeMaterialInstance, jstring name_,
|
||||||
jlong nativeTexture, jint sampler_) {
|
jlong nativeTexture, jlong sampler_) {
|
||||||
MaterialInstance* instance = (MaterialInstance*) nativeMaterialInstance;
|
MaterialInstance* instance = (MaterialInstance*) nativeMaterialInstance;
|
||||||
Texture* texture = (Texture*) nativeTexture;
|
Texture* texture = (Texture*) nativeTexture;
|
||||||
TextureSampler& sampler = reinterpret_cast<TextureSampler&>(sampler_);
|
|
||||||
|
|
||||||
const char *name = env->GetStringUTFChars(name_, 0);
|
const char *name = env->GetStringUTFChars(name_, 0);
|
||||||
instance->setParameter(name, texture, sampler);
|
instance->setParameter(name, texture, JniUtils::from_long(sampler_));
|
||||||
env->ReleaseStringUTFChars(name_, name);
|
env->ReleaseStringUTFChars(name_, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -341,6 +345,14 @@ Java_com_google_android_filament_MaterialInstance_nSetDepthWrite(JNIEnv*,
|
|||||||
instance->setDepthWrite(enable);
|
instance->setDepthWrite(enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C"
|
||||||
|
JNIEXPORT void JNICALL
|
||||||
|
Java_com_google_android_filament_MaterialInstance_nSetStencilWrite(JNIEnv*, jclass,
|
||||||
|
jlong nativeMaterialInstance, jboolean enable) {
|
||||||
|
MaterialInstance* instance = (MaterialInstance*) nativeMaterialInstance;
|
||||||
|
instance->setStencilWrite(enable);
|
||||||
|
}
|
||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
JNIEXPORT void JNICALL
|
JNIEXPORT void JNICALL
|
||||||
Java_com_google_android_filament_MaterialInstance_nSetDepthCulling(JNIEnv*,
|
Java_com_google_android_filament_MaterialInstance_nSetDepthCulling(JNIEnv*,
|
||||||
@@ -349,6 +361,78 @@ Java_com_google_android_filament_MaterialInstance_nSetDepthCulling(JNIEnv*,
|
|||||||
instance->setDepthCulling(enable);
|
instance->setDepthCulling(enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C"
|
||||||
|
JNIEXPORT void JNICALL
|
||||||
|
Java_com_google_android_filament_MaterialInstance_nSetDepthFunc(JNIEnv*,
|
||||||
|
jclass, jlong nativeMaterialInstance, jlong function) {
|
||||||
|
MaterialInstance* instance = (MaterialInstance*) nativeMaterialInstance;
|
||||||
|
instance->setDepthFunc(static_cast<MaterialInstance::DepthFunc>(function));
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C"
|
||||||
|
JNIEXPORT void JNICALL
|
||||||
|
Java_com_google_android_filament_MaterialInstance_nSetStencilCompareFunction(JNIEnv*, jclass,
|
||||||
|
jlong nativeMaterialInstance, jlong function, jlong face) {
|
||||||
|
MaterialInstance* instance = (MaterialInstance*) nativeMaterialInstance;
|
||||||
|
instance->setStencilCompareFunction(
|
||||||
|
static_cast<MaterialInstance::StencilCompareFunc>(function),
|
||||||
|
static_cast<MaterialInstance::StencilFace>(face));
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C"
|
||||||
|
JNIEXPORT void JNICALL
|
||||||
|
Java_com_google_android_filament_MaterialInstance_nSetStencilOpStencilFail(JNIEnv*, jclass,
|
||||||
|
jlong nativeMaterialInstance, jlong op, jlong face) {
|
||||||
|
MaterialInstance* instance = (MaterialInstance*) nativeMaterialInstance;
|
||||||
|
instance->setStencilOpStencilFail(
|
||||||
|
static_cast<MaterialInstance::StencilOperation>(op),
|
||||||
|
static_cast<MaterialInstance::StencilFace>(face));
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C"
|
||||||
|
JNIEXPORT void JNICALL
|
||||||
|
Java_com_google_android_filament_MaterialInstance_nSetStencilOpDepthFail(JNIEnv*, jclass,
|
||||||
|
jlong nativeMaterialInstance, jlong op, jlong face) {
|
||||||
|
MaterialInstance* instance = (MaterialInstance*) nativeMaterialInstance;
|
||||||
|
instance->setStencilOpDepthFail(
|
||||||
|
static_cast<MaterialInstance::StencilOperation>(op),
|
||||||
|
static_cast<MaterialInstance::StencilFace>(face));
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C"
|
||||||
|
JNIEXPORT void JNICALL
|
||||||
|
Java_com_google_android_filament_MaterialInstance_nSetStencilOpDepthStencilPass(JNIEnv*, jclass,
|
||||||
|
jlong nativeMaterialInstance, jlong op, jlong face) {
|
||||||
|
MaterialInstance* instance = (MaterialInstance*) nativeMaterialInstance;
|
||||||
|
instance->setStencilOpDepthStencilPass(
|
||||||
|
static_cast<MaterialInstance::StencilOperation>(op),
|
||||||
|
static_cast<MaterialInstance::StencilFace>(face));
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C"
|
||||||
|
JNIEXPORT void JNICALL
|
||||||
|
Java_com_google_android_filament_MaterialInstance_nSetStencilReferenceValue(JNIEnv*, jclass,
|
||||||
|
jlong nativeMaterialInstance, jint value, jlong face) {
|
||||||
|
MaterialInstance* instance = (MaterialInstance*) nativeMaterialInstance;
|
||||||
|
instance->setStencilReferenceValue(value, static_cast<MaterialInstance::StencilFace>(face));
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C"
|
||||||
|
JNIEXPORT void JNICALL
|
||||||
|
Java_com_google_android_filament_MaterialInstance_nSetStencilReadMask(JNIEnv*, jclass,
|
||||||
|
jlong nativeMaterialInstance, jint readMask, jlong face) {
|
||||||
|
MaterialInstance* instance = (MaterialInstance*) nativeMaterialInstance;
|
||||||
|
instance->setStencilReadMask(readMask, static_cast<MaterialInstance::StencilFace>(face));
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C"
|
||||||
|
JNIEXPORT void JNICALL
|
||||||
|
Java_com_google_android_filament_MaterialInstance_nSetStencilWriteMask(JNIEnv*, jclass,
|
||||||
|
jlong nativeMaterialInstance, jint writeMask, jlong face) {
|
||||||
|
MaterialInstance* instance = (MaterialInstance*) nativeMaterialInstance;
|
||||||
|
instance->setStencilWriteMask(writeMask, static_cast<MaterialInstance::StencilFace>(face));
|
||||||
|
}
|
||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
JNIEXPORT jstring JNICALL
|
JNIEXPORT jstring JNICALL
|
||||||
Java_com_google_android_filament_MaterialInstance_nGetName(JNIEnv* env, jclass,
|
Java_com_google_android_filament_MaterialInstance_nGetName(JNIEnv* env, jclass,
|
||||||
@@ -364,3 +448,99 @@ Java_com_google_android_filament_MaterialInstance_nGetMaterial(JNIEnv* env, jcla
|
|||||||
MaterialInstance* instance = (MaterialInstance*) nativeMaterialInstance;
|
MaterialInstance* instance = (MaterialInstance*) nativeMaterialInstance;
|
||||||
return (jlong) instance->getMaterial();
|
return (jlong) instance->getMaterial();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C"
|
||||||
|
JNIEXPORT jlong JNICALL
|
||||||
|
Java_com_google_android_filament_MaterialInstance_nDuplicate(JNIEnv* env, jclass clazz,
|
||||||
|
jlong otherNativeMaterialInstance, jstring name) {
|
||||||
|
MaterialInstance* other = (MaterialInstance*) otherNativeMaterialInstance;
|
||||||
|
const char *cstr = nullptr;
|
||||||
|
if (name != nullptr) {
|
||||||
|
cstr = env->GetStringUTFChars(name, nullptr);
|
||||||
|
}
|
||||||
|
MaterialInstance* mi = MaterialInstance::duplicate(other, cstr);
|
||||||
|
if (name != nullptr) {
|
||||||
|
env->ReleaseStringUTFChars(name, cstr);
|
||||||
|
}
|
||||||
|
return (jlong)mi;
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C"
|
||||||
|
JNIEXPORT jfloat JNICALL
|
||||||
|
Java_com_google_android_filament_MaterialInstance_nGetMaskThreshold(JNIEnv* env, jclass clazz,
|
||||||
|
jlong nativeMaterialInstance) {
|
||||||
|
MaterialInstance* instance = (MaterialInstance*)nativeMaterialInstance;
|
||||||
|
return instance->getMaskThreshold();
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C"
|
||||||
|
JNIEXPORT jfloat JNICALL
|
||||||
|
Java_com_google_android_filament_MaterialInstance_nGetSpecularAntiAliasingVariance(JNIEnv* env,
|
||||||
|
jclass clazz, jlong nativeMaterialInstance) {
|
||||||
|
MaterialInstance* instance = (MaterialInstance*)nativeMaterialInstance;
|
||||||
|
return instance->getSpecularAntiAliasingVariance();
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C"
|
||||||
|
JNIEXPORT jfloat JNICALL
|
||||||
|
Java_com_google_android_filament_MaterialInstance_nGetSpecularAntiAliasingThreshold(JNIEnv* env,
|
||||||
|
jclass clazz, jlong nativeMaterialInstance) {
|
||||||
|
MaterialInstance* instance = (MaterialInstance*)nativeMaterialInstance;
|
||||||
|
return instance->getSpecularAntiAliasingThreshold();
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C"
|
||||||
|
JNIEXPORT jboolean JNICALL
|
||||||
|
Java_com_google_android_filament_MaterialInstance_nIsDoubleSided(JNIEnv* env, jclass clazz,
|
||||||
|
jlong nativeMaterialInstance) {
|
||||||
|
MaterialInstance* instance = (MaterialInstance*)nativeMaterialInstance;
|
||||||
|
return instance->isDoubleSided();
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C"
|
||||||
|
JNIEXPORT jint JNICALL
|
||||||
|
Java_com_google_android_filament_MaterialInstance_nGetCullingMode(JNIEnv* env, jclass clazz,
|
||||||
|
jlong nativeMaterialInstance) {
|
||||||
|
MaterialInstance* instance = (MaterialInstance*)nativeMaterialInstance;
|
||||||
|
return (jint)instance->getCullingMode();
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C"
|
||||||
|
JNIEXPORT jboolean JNICALL
|
||||||
|
Java_com_google_android_filament_MaterialInstance_nIsColorWriteEnabled(JNIEnv* env, jclass clazz,
|
||||||
|
jlong nativeMaterialInstance) {
|
||||||
|
MaterialInstance* instance = (MaterialInstance*)nativeMaterialInstance;
|
||||||
|
return instance->isColorWriteEnabled();
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C"
|
||||||
|
JNIEXPORT jboolean JNICALL
|
||||||
|
Java_com_google_android_filament_MaterialInstance_nIsDepthWriteEnabled(JNIEnv* env, jclass clazz,
|
||||||
|
jlong nativeMaterialInstance) {
|
||||||
|
MaterialInstance* instance = (MaterialInstance*)nativeMaterialInstance;
|
||||||
|
return instance->isDepthWriteEnabled();
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C"
|
||||||
|
JNIEXPORT jboolean JNICALL
|
||||||
|
Java_com_google_android_filament_MaterialInstance_nIsStencilWriteEnabled(JNIEnv* env, jclass clazz,
|
||||||
|
jlong nativeMaterialInstance) {
|
||||||
|
MaterialInstance* instance = (MaterialInstance*)nativeMaterialInstance;
|
||||||
|
return instance->isStencilWriteEnabled();
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C"
|
||||||
|
JNIEXPORT jboolean JNICALL
|
||||||
|
Java_com_google_android_filament_MaterialInstance_nIsDepthCullingEnabled(JNIEnv* env, jclass clazz,
|
||||||
|
jlong nativeMaterialInstance) {
|
||||||
|
MaterialInstance* instance = (MaterialInstance*)nativeMaterialInstance;
|
||||||
|
return instance->isDepthCullingEnabled();
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C"
|
||||||
|
JNIEXPORT jint JNICALL
|
||||||
|
Java_com_google_android_filament_MaterialInstance_nGetDepthFunc(JNIEnv* env, jclass clazz,
|
||||||
|
jlong nativeMaterialInstance) {
|
||||||
|
MaterialInstance* instance = (MaterialInstance*)nativeMaterialInstance;
|
||||||
|
return (jint)instance->getDepthFunc();
|
||||||
|
}
|
||||||
|
|||||||
@@ -0,0 +1,114 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2021 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <jni.h>
|
||||||
|
|
||||||
|
#include <functional>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <filament/MorphTargetBuffer.h>
|
||||||
|
|
||||||
|
#include "common/CallbackUtils.h"
|
||||||
|
#include "common/NioUtils.h"
|
||||||
|
|
||||||
|
using namespace filament;
|
||||||
|
using namespace backend;
|
||||||
|
|
||||||
|
extern "C"
|
||||||
|
JNIEXPORT jlong JNICALL
|
||||||
|
Java_com_google_android_filament_MorphTargetBuffer_nCreateBuilder(JNIEnv*, jclass) {
|
||||||
|
return (jlong) new MorphTargetBuffer::Builder();
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C"
|
||||||
|
JNIEXPORT void JNICALL
|
||||||
|
Java_com_google_android_filament_MorphTargetBuffer_nDestroyBuilder(JNIEnv*, jclass,
|
||||||
|
jlong nativeBuilder) {
|
||||||
|
MorphTargetBuffer::Builder* builder = (MorphTargetBuffer::Builder *) nativeBuilder;
|
||||||
|
delete builder;
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C"
|
||||||
|
JNIEXPORT void JNICALL
|
||||||
|
Java_com_google_android_filament_MorphTargetBuffer_nBuilderVertexCount(JNIEnv*, jclass,
|
||||||
|
jlong nativeBuilder, jint vertexCount) {
|
||||||
|
MorphTargetBuffer::Builder* builder = (MorphTargetBuffer::Builder *) nativeBuilder;
|
||||||
|
builder->vertexCount((size_t) vertexCount);
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C"
|
||||||
|
JNIEXPORT void JNICALL
|
||||||
|
Java_com_google_android_filament_MorphTargetBuffer_nBuilderCount(JNIEnv*, jclass,
|
||||||
|
jlong nativeBuilder, jint count) {
|
||||||
|
MorphTargetBuffer::Builder* builder = (MorphTargetBuffer::Builder *) nativeBuilder;
|
||||||
|
builder->count((size_t) count);
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C"
|
||||||
|
JNIEXPORT jlong JNICALL
|
||||||
|
Java_com_google_android_filament_MorphTargetBuffer_nBuilderBuild(JNIEnv*, jclass,
|
||||||
|
jlong nativeBuilder, jlong nativeEngine) {
|
||||||
|
MorphTargetBuffer::Builder* builder = (MorphTargetBuffer::Builder *) nativeBuilder;
|
||||||
|
Engine *engine = (Engine *) nativeEngine;
|
||||||
|
return (jlong) builder->build(*engine);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
extern "C"
|
||||||
|
JNIEXPORT jint JNICALL
|
||||||
|
Java_com_google_android_filament_MorphTargetBuffer_nSetPositionsAt(JNIEnv* env, jclass,
|
||||||
|
jlong nativeObject, jlong nativeEngine,
|
||||||
|
jint targetIndex, jfloatArray positions, jint count) {
|
||||||
|
MorphTargetBuffer *morphTargetBuffer = (MorphTargetBuffer *) nativeObject;
|
||||||
|
Engine *engine = (Engine *) nativeEngine;
|
||||||
|
jfloat* data = env->GetFloatArrayElements(positions, NULL);
|
||||||
|
morphTargetBuffer->setPositionsAt(*engine, targetIndex,
|
||||||
|
(math::float4*) data, size_t(count));
|
||||||
|
env->ReleaseFloatArrayElements(positions, data, JNI_ABORT);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C"
|
||||||
|
JNIEXPORT jint JNICALL
|
||||||
|
Java_com_google_android_filament_MorphTargetBuffer_nSetTangentsAt(JNIEnv* env, jclass,
|
||||||
|
jlong nativeObject, jlong nativeEngine,
|
||||||
|
jint targetIndex, jshortArray tangents, jint count) {
|
||||||
|
MorphTargetBuffer *morphTargetBuffer = (MorphTargetBuffer *) nativeObject;
|
||||||
|
Engine *engine = (Engine *) nativeEngine;
|
||||||
|
jshort* data = env->GetShortArrayElements(tangents, NULL);
|
||||||
|
morphTargetBuffer->setTangentsAt(*engine, targetIndex,
|
||||||
|
(math::short4*) data, size_t(count));
|
||||||
|
env->ReleaseShortArrayElements(tangents, data, JNI_ABORT);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C"
|
||||||
|
JNIEXPORT jint JNICALL
|
||||||
|
Java_com_google_android_filament_MorphTargetBuffer_nGetVertexCount(JNIEnv*, jclass,
|
||||||
|
jlong nativeObject) {
|
||||||
|
MorphTargetBuffer *morphTargetBuffer = (MorphTargetBuffer *) nativeObject;
|
||||||
|
return (jint)morphTargetBuffer->getVertexCount();
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C"
|
||||||
|
JNIEXPORT jint JNICALL
|
||||||
|
Java_com_google_android_filament_MorphTargetBuffer_nGetCount(JNIEnv*, jclass,
|
||||||
|
jlong nativeObject) {
|
||||||
|
MorphTargetBuffer *morphTargetBuffer = (MorphTargetBuffer *) nativeObject;
|
||||||
|
return (jint)morphTargetBuffer->getCount();
|
||||||
|
}
|
||||||
@@ -120,6 +120,14 @@ Java_com_google_android_filament_RenderableManager_nBuilderBlendOrder(JNIEnv*, j
|
|||||||
builder->blendOrder((size_t) index, (uint16_t) blendOrder);
|
builder->blendOrder((size_t) index, (uint16_t) blendOrder);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C"
|
||||||
|
JNIEXPORT void JNICALL
|
||||||
|
Java_com_google_android_filament_RenderableManager_nBuilderGlobalBlendOrderEnabled(JNIEnv*, jclass,
|
||||||
|
jlong nativeBuilder, jint index, jboolean enabled) {
|
||||||
|
RenderableManager::Builder *builder = (RenderableManager::Builder *) nativeBuilder;
|
||||||
|
builder->globalBlendOrderEnabled((size_t) index, (bool) enabled);
|
||||||
|
}
|
||||||
|
|
||||||
extern "C" JNIEXPORT void JNICALL
|
extern "C" JNIEXPORT void JNICALL
|
||||||
Java_com_google_android_filament_RenderableManager_nBuilderBoundingBox(JNIEnv*, jclass,
|
Java_com_google_android_filament_RenderableManager_nBuilderBoundingBox(JNIEnv*, jclass,
|
||||||
jlong nativeBuilder, jfloat cx, jfloat cy, jfloat cz, jfloat ex, jfloat ey, jfloat ez) {
|
jlong nativeBuilder, jfloat cx, jfloat cy, jfloat cz, jfloat ex, jfloat ey, jfloat ez) {
|
||||||
@@ -142,6 +150,13 @@ Java_com_google_android_filament_RenderableManager_nBuilderPriority(JNIEnv*, jcl
|
|||||||
builder->priority((uint8_t) priority);
|
builder->priority((uint8_t) priority);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT void JNICALL
|
||||||
|
Java_com_google_android_filament_RenderableManager_nBuilderChannel(JNIEnv*, jclass,
|
||||||
|
jlong nativeBuilder, jint channel) {
|
||||||
|
RenderableManager::Builder *builder = (RenderableManager::Builder *) nativeBuilder;
|
||||||
|
builder->channel((uint8_t) channel);
|
||||||
|
}
|
||||||
|
|
||||||
extern "C" JNIEXPORT void JNICALL
|
extern "C" JNIEXPORT void JNICALL
|
||||||
Java_com_google_android_filament_RenderableManager_nBuilderCulling(JNIEnv*, jclass,
|
Java_com_google_android_filament_RenderableManager_nBuilderCulling(JNIEnv*, jclass,
|
||||||
jlong nativeBuilder, jboolean enabled) {
|
jlong nativeBuilder, jboolean enabled) {
|
||||||
@@ -170,6 +185,14 @@ Java_com_google_android_filament_RenderableManager_nBuilderScreenSpaceContactSha
|
|||||||
builder->screenSpaceContactShadows(enabled);
|
builder->screenSpaceContactShadows(enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT void JNICALL
|
||||||
|
Java_com_google_android_filament_RenderableManager_nBuilderSkinningBuffer(JNIEnv*, jclass,
|
||||||
|
jlong nativeBuilder, jlong nativeSkinningBuffer, jint boneCount, jint offset) {
|
||||||
|
RenderableManager::Builder *builder = (RenderableManager::Builder *) nativeBuilder;
|
||||||
|
SkinningBuffer *skinningBuffer = (SkinningBuffer *) nativeSkinningBuffer;
|
||||||
|
builder->skinning(skinningBuffer, boneCount, offset);
|
||||||
|
}
|
||||||
|
|
||||||
extern "C" JNIEXPORT void JNICALL
|
extern "C" JNIEXPORT void JNICALL
|
||||||
Java_com_google_android_filament_RenderableManager_nBuilderSkinning(JNIEnv*, jclass,
|
Java_com_google_android_filament_RenderableManager_nBuilderSkinning(JNIEnv*, jclass,
|
||||||
jlong nativeBuilder, jint boneCount) {
|
jlong nativeBuilder, jint boneCount) {
|
||||||
@@ -177,6 +200,20 @@ Java_com_google_android_filament_RenderableManager_nBuilderSkinning(JNIEnv*, jcl
|
|||||||
builder->skinning((size_t)boneCount);
|
builder->skinning((size_t)boneCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT void JNICALL
|
||||||
|
Java_com_google_android_filament_RenderableManager_nBuilderEnableSkinningBuffers(JNIEnv*, jclass,
|
||||||
|
jlong nativeBuilder, jboolean enabled) {
|
||||||
|
RenderableManager::Builder *builder = (RenderableManager::Builder *) nativeBuilder;
|
||||||
|
builder->enableSkinningBuffers(enabled);
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT void JNICALL
|
||||||
|
Java_com_google_android_filament_RenderableManager_nBuilderFog(JNIEnv*, jclass,
|
||||||
|
jlong nativeBuilder, jboolean enabled) {
|
||||||
|
RenderableManager::Builder *builder = (RenderableManager::Builder *) nativeBuilder;
|
||||||
|
builder->fog(enabled);
|
||||||
|
}
|
||||||
|
|
||||||
extern "C" JNIEXPORT jint JNICALL
|
extern "C" JNIEXPORT jint JNICALL
|
||||||
Java_com_google_android_filament_RenderableManager_nBuilderSkinningBones(JNIEnv* env, jclass,
|
Java_com_google_android_filament_RenderableManager_nBuilderSkinningBones(JNIEnv* env, jclass,
|
||||||
jlong nativeBuilder, jint boneCount, jobject bones, jint remaining) {
|
jlong nativeBuilder, jint boneCount, jobject bones, jint remaining) {
|
||||||
@@ -194,11 +231,43 @@ Java_com_google_android_filament_RenderableManager_nBuilderSkinningBones(JNIEnv*
|
|||||||
|
|
||||||
extern "C" JNIEXPORT void JNICALL
|
extern "C" JNIEXPORT void JNICALL
|
||||||
Java_com_google_android_filament_RenderableManager_nBuilderMorphing(JNIEnv*, jclass,
|
Java_com_google_android_filament_RenderableManager_nBuilderMorphing(JNIEnv*, jclass,
|
||||||
jlong nativeBuilder, jboolean enabled) {
|
jlong nativeBuilder, jint targetCount) {
|
||||||
RenderableManager::Builder *builder = (RenderableManager::Builder *) nativeBuilder;
|
RenderableManager::Builder *builder = (RenderableManager::Builder *) nativeBuilder;
|
||||||
builder->morphing(enabled);
|
builder->morphing(targetCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT void JNICALL
|
||||||
|
Java_com_google_android_filament_RenderableManager_nBuilderSetMorphTargetBufferAt(JNIEnv*, jclass,
|
||||||
|
jlong nativeBuilder, int level, int primitiveIndex, jlong nativeMorphTargetBuffer,
|
||||||
|
int offset, int count) {
|
||||||
|
RenderableManager::Builder *builder = (RenderableManager::Builder *) nativeBuilder;
|
||||||
|
MorphTargetBuffer *morphTargetBuffer = (MorphTargetBuffer *) nativeMorphTargetBuffer;
|
||||||
|
builder->morphing(level, primitiveIndex, morphTargetBuffer, offset, count);
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT void JNICALL
|
||||||
|
Java_com_google_android_filament_RenderableManager_nBuilderLightChannel(JNIEnv*, jclass,
|
||||||
|
jlong nativeBuilder, jint channel, jboolean enable) {
|
||||||
|
RenderableManager::Builder *builder = (RenderableManager::Builder *) nativeBuilder;
|
||||||
|
builder->lightChannel(channel, (bool)enable);
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT void JNICALL
|
||||||
|
Java_com_google_android_filament_RenderableManager_nBuilderInstances(JNIEnv*, jclass,
|
||||||
|
jlong nativeBuilder, jint instanceCount) {
|
||||||
|
RenderableManager::Builder *builder = (RenderableManager::Builder *) nativeBuilder;
|
||||||
|
builder->instances(instanceCount);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT void JNICALL
|
||||||
|
Java_com_google_android_filament_RenderableManager_nSetSkinningBuffer(JNIEnv*, jclass,
|
||||||
|
jlong nativeRenderableManager, jint i, jlong nativeSkinningBuffer, jint count, jint offset) {
|
||||||
|
RenderableManager *rm = (RenderableManager *) nativeRenderableManager;
|
||||||
|
SkinningBuffer *sb = (SkinningBuffer *) nativeSkinningBuffer;
|
||||||
|
rm->setSkinningBuffer(i, sb, count, offset);
|
||||||
|
}
|
||||||
|
|
||||||
extern "C" JNIEXPORT jint JNICALL
|
extern "C" JNIEXPORT jint JNICALL
|
||||||
Java_com_google_android_filament_RenderableManager_nSetBonesAsMatrices(JNIEnv* env, jclass,
|
Java_com_google_android_filament_RenderableManager_nSetBonesAsMatrices(JNIEnv* env, jclass,
|
||||||
@@ -236,12 +305,29 @@ Java_com_google_android_filament_RenderableManager_nSetBonesAsQuaternions(JNIEnv
|
|||||||
|
|
||||||
extern "C" JNIEXPORT void JNICALL
|
extern "C" JNIEXPORT void JNICALL
|
||||||
Java_com_google_android_filament_RenderableManager_nSetMorphWeights(JNIEnv* env, jclass,
|
Java_com_google_android_filament_RenderableManager_nSetMorphWeights(JNIEnv* env, jclass,
|
||||||
jlong nativeRenderableManager, jint instance, jfloatArray weights) {
|
jlong nativeRenderableManager, jint instance, jfloatArray weights, jint offset) {
|
||||||
RenderableManager *rm = (RenderableManager *) nativeRenderableManager;
|
RenderableManager *rm = (RenderableManager *) nativeRenderableManager;
|
||||||
jfloat* vec = env->GetFloatArrayElements(weights, NULL);
|
jfloat* vec = env->GetFloatArrayElements(weights, NULL);
|
||||||
math::float4 floatvec(vec[0], vec[1], vec[2], vec[3]);
|
jsize count = env->GetArrayLength(weights);
|
||||||
|
rm->setMorphWeights((RenderableManager::Instance)instance, vec, count, offset);
|
||||||
env->ReleaseFloatArrayElements(weights, vec, JNI_ABORT);
|
env->ReleaseFloatArrayElements(weights, vec, JNI_ABORT);
|
||||||
rm->setMorphWeights((RenderableManager::Instance)instance, floatvec);
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT void JNICALL
|
||||||
|
Java_com_google_android_filament_RenderableManager_nSetMorphTargetBufferAt(JNIEnv*,
|
||||||
|
jclass, jlong nativeRenderableManager, jint i, int level, jint primitiveIndex,
|
||||||
|
jlong nativeMorphTargetBuffer, jint offset, jint count) {
|
||||||
|
RenderableManager *rm = (RenderableManager *) nativeRenderableManager;
|
||||||
|
MorphTargetBuffer *morphTargetBuffer = (MorphTargetBuffer *) nativeMorphTargetBuffer;
|
||||||
|
rm->setMorphTargetBufferAt((RenderableManager::Instance) i, (uint8_t) level,
|
||||||
|
(size_t) primitiveIndex, morphTargetBuffer, (size_t) offset, (size_t) count);
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT jint JNICALL
|
||||||
|
Java_com_google_android_filament_RenderableManager_nGetMorphTargetCount(JNIEnv* env, jclass,
|
||||||
|
jlong nativeRenderableManager, jint instance) {
|
||||||
|
RenderableManager *rm = (RenderableManager *) nativeRenderableManager;
|
||||||
|
return rm->getMorphTargetCount((RenderableManager::Instance)instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" JNIEXPORT void JNICALL
|
extern "C" JNIEXPORT void JNICALL
|
||||||
@@ -267,6 +353,13 @@ Java_com_google_android_filament_RenderableManager_nSetPriority(JNIEnv*, jclass,
|
|||||||
rm->setPriority((RenderableManager::Instance) i, (uint8_t) priority);
|
rm->setPriority((RenderableManager::Instance) i, (uint8_t) priority);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT void JNICALL
|
||||||
|
Java_com_google_android_filament_RenderableManager_nSetChannel(JNIEnv*, jclass,
|
||||||
|
jlong nativeRenderableManager, jint i, jint channel) {
|
||||||
|
RenderableManager *rm = (RenderableManager *) nativeRenderableManager;
|
||||||
|
rm->setChannel((RenderableManager::Instance) i, (uint8_t) channel);
|
||||||
|
}
|
||||||
|
|
||||||
extern "C" JNIEXPORT void JNICALL
|
extern "C" JNIEXPORT void JNICALL
|
||||||
Java_com_google_android_filament_RenderableManager_nSetCulling(JNIEnv*, jclass,
|
Java_com_google_android_filament_RenderableManager_nSetCulling(JNIEnv*, jclass,
|
||||||
jlong nativeRenderableManager, jint i, jboolean enabled) {
|
jlong nativeRenderableManager, jint i, jboolean enabled) {
|
||||||
@@ -274,6 +367,20 @@ Java_com_google_android_filament_RenderableManager_nSetCulling(JNIEnv*, jclass,
|
|||||||
rm->setCulling((RenderableManager::Instance) i, enabled);
|
rm->setCulling((RenderableManager::Instance) i, enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT void JNICALL
|
||||||
|
Java_com_google_android_filament_RenderableManager_nSetFogEnabled(JNIEnv*, jclass,
|
||||||
|
jlong nativeRenderableManager, jint i, jboolean enabled) {
|
||||||
|
RenderableManager *rm = (RenderableManager *) nativeRenderableManager;
|
||||||
|
rm->setFogEnabled((RenderableManager::Instance) i, enabled);
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT jboolean JNICALL
|
||||||
|
Java_com_google_android_filament_RenderableManager_nGetFogEnabled(JNIEnv*, jclass,
|
||||||
|
jlong nativeRenderableManager, jint i) {
|
||||||
|
RenderableManager *rm = (RenderableManager *) nativeRenderableManager;
|
||||||
|
return (jboolean)rm->getFogEnabled((RenderableManager::Instance) i);
|
||||||
|
}
|
||||||
|
|
||||||
extern "C" JNIEXPORT void JNICALL
|
extern "C" JNIEXPORT void JNICALL
|
||||||
Java_com_google_android_filament_RenderableManager_nSetCastShadows(JNIEnv*, jclass,
|
Java_com_google_android_filament_RenderableManager_nSetCastShadows(JNIEnv*, jclass,
|
||||||
jlong nativeRenderableManager, jint i, jboolean enabled) {
|
jlong nativeRenderableManager, jint i, jboolean enabled) {
|
||||||
@@ -339,21 +446,13 @@ Java_com_google_android_filament_RenderableManager_nSetMaterialInstanceAt(JNIEnv
|
|||||||
materialInstance);
|
materialInstance);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" JNIEXPORT long JNICALL
|
extern "C" JNIEXPORT jlong JNICALL
|
||||||
Java_com_google_android_filament_RenderableManager_nGetMaterialInstanceAt(JNIEnv*, jclass,
|
Java_com_google_android_filament_RenderableManager_nGetMaterialInstanceAt(JNIEnv*, jclass,
|
||||||
jlong nativeRenderableManager, jint i, jint primitiveIndex) {
|
jlong nativeRenderableManager, jint i, jint primitiveIndex) {
|
||||||
RenderableManager *rm = (RenderableManager *) nativeRenderableManager;
|
RenderableManager *rm = (RenderableManager *) nativeRenderableManager;
|
||||||
return (long) rm->getMaterialInstanceAt((RenderableManager::Instance) i, (size_t) primitiveIndex);
|
return (long) rm->getMaterialInstanceAt((RenderableManager::Instance) i, (size_t) primitiveIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" JNIEXPORT long JNICALL
|
|
||||||
Java_com_google_android_filament_RenderableManager_nGetMaterialAt(JNIEnv*, jclass,
|
|
||||||
jlong nativeRenderableManager, jint i, jint primitiveIndex) {
|
|
||||||
RenderableManager *rm = (RenderableManager *) nativeRenderableManager;
|
|
||||||
MaterialInstance *mi = rm->getMaterialInstanceAt((RenderableManager::Instance) i, (size_t) primitiveIndex);
|
|
||||||
return (long) mi->getMaterial();
|
|
||||||
}
|
|
||||||
|
|
||||||
extern "C" JNIEXPORT void JNICALL
|
extern "C" JNIEXPORT void JNICALL
|
||||||
Java_com_google_android_filament_RenderableManager_nSetGeometryAt__JIIIJJII(JNIEnv*,
|
Java_com_google_android_filament_RenderableManager_nSetGeometryAt__JIIIJJII(JNIEnv*,
|
||||||
jclass, jlong nativeRenderableManager, jint i, jint primitiveIndex, jint primitiveType,
|
jclass, jlong nativeRenderableManager, jint i, jint primitiveIndex, jint primitiveType,
|
||||||
@@ -366,15 +465,6 @@ Java_com_google_android_filament_RenderableManager_nSetGeometryAt__JIIIJJII(JNIE
|
|||||||
(size_t) offset, (size_t) count);
|
(size_t) offset, (size_t) count);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" JNIEXPORT void JNICALL
|
|
||||||
Java_com_google_android_filament_RenderableManager_nSetGeometryAt__JIIIII(JNIEnv*, jclass,
|
|
||||||
jlong nativeRenderableManager, jint i, jint primitiveIndex, jint primitiveType, jint offset,
|
|
||||||
jint count) {
|
|
||||||
RenderableManager *rm = (RenderableManager *) nativeRenderableManager;
|
|
||||||
rm->setGeometryAt((RenderableManager::Instance) i, (size_t) primitiveIndex,
|
|
||||||
(RenderableManager::PrimitiveType) primitiveType, (size_t) offset, (size_t) count);
|
|
||||||
}
|
|
||||||
|
|
||||||
extern "C" JNIEXPORT void JNICALL
|
extern "C" JNIEXPORT void JNICALL
|
||||||
Java_com_google_android_filament_RenderableManager_nSetBlendOrderAt(JNIEnv*, jclass,
|
Java_com_google_android_filament_RenderableManager_nSetBlendOrderAt(JNIEnv*, jclass,
|
||||||
jlong nativeRenderableManager, jint i, jint primitiveIndex, jint blendOrder) {
|
jlong nativeRenderableManager, jint i, jint primitiveIndex, jint blendOrder) {
|
||||||
@@ -383,6 +473,14 @@ Java_com_google_android_filament_RenderableManager_nSetBlendOrderAt(JNIEnv*, jcl
|
|||||||
(uint16_t) blendOrder);
|
(uint16_t) blendOrder);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT void JNICALL
|
||||||
|
Java_com_google_android_filament_RenderableManager_nSetGlobalBlendOrderEnabledAt(JNIEnv*, jclass,
|
||||||
|
jlong nativeRenderableManager, jint i, jint primitiveIndex, jboolean enabled) {
|
||||||
|
RenderableManager *rm = (RenderableManager *) nativeRenderableManager;
|
||||||
|
rm->setGlobalBlendOrderEnabledAt((RenderableManager::Instance) i, (size_t) primitiveIndex,
|
||||||
|
(bool) enabled);
|
||||||
|
}
|
||||||
|
|
||||||
extern "C" JNIEXPORT jint JNICALL
|
extern "C" JNIEXPORT jint JNICALL
|
||||||
Java_com_google_android_filament_RenderableManager_nGetEnabledAttributesAt(JNIEnv*, jclass,
|
Java_com_google_android_filament_RenderableManager_nGetEnabledAttributesAt(JNIEnv*, jclass,
|
||||||
jlong nativeRenderableManager, jint i, jint primitiveIndex) {
|
jlong nativeRenderableManager, jint i, jint primitiveIndex) {
|
||||||
@@ -390,3 +488,17 @@ Java_com_google_android_filament_RenderableManager_nGetEnabledAttributesAt(JNIEn
|
|||||||
AttributeBitset enabled = rm->getEnabledAttributesAt((RenderableManager::Instance) i, (size_t) primitiveIndex);
|
AttributeBitset enabled = rm->getEnabledAttributesAt((RenderableManager::Instance) i, (size_t) primitiveIndex);
|
||||||
return enabled.getValue();
|
return enabled.getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT void JNICALL
|
||||||
|
Java_com_google_android_filament_RenderableManager_nSetLightChannel(JNIEnv*, jclass,
|
||||||
|
jlong nativeRenderableManager, jint i, jint channel, jboolean enable) {
|
||||||
|
RenderableManager *rm = (RenderableManager *) nativeRenderableManager;
|
||||||
|
rm->setLightChannel((RenderableManager::Instance) i, channel, (bool)enable);
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT jboolean JNICALL
|
||||||
|
Java_com_google_android_filament_RenderableManager_nGetLightChannel(JNIEnv*, jclass,
|
||||||
|
jlong nativeRenderableManager, jint i, jint channel) {
|
||||||
|
RenderableManager const *rm = (RenderableManager const *) nativeRenderableManager;
|
||||||
|
return rm->getLightChannel((RenderableManager::Instance) i, channel);
|
||||||
|
}
|
||||||
|
|||||||
@@ -50,6 +50,14 @@ Java_com_google_android_filament_Renderer_nRender(JNIEnv *, jclass, jlong native
|
|||||||
renderer->render(view);
|
renderer->render(view);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT void JNICALL
|
||||||
|
Java_com_google_android_filament_Renderer_nRenderStandaloneView(JNIEnv *, jclass, jlong nativeRenderer,
|
||||||
|
jlong nativeView) {
|
||||||
|
Renderer *renderer = (Renderer *) nativeRenderer;
|
||||||
|
View *view = (View *) nativeView;
|
||||||
|
renderer->renderStandaloneView(view);
|
||||||
|
}
|
||||||
|
|
||||||
extern "C" JNIEXPORT void JNICALL
|
extern "C" JNIEXPORT void JNICALL
|
||||||
Java_com_google_android_filament_Renderer_nCopyFrame(JNIEnv *, jclass, jlong nativeRenderer,
|
Java_com_google_android_filament_Renderer_nCopyFrame(JNIEnv *, jclass, jlong nativeRenderer,
|
||||||
jlong nativeDstSwapChain,
|
jlong nativeDstSwapChain,
|
||||||
@@ -89,7 +97,8 @@ Java_com_google_android_filament_Renderer_nReadPixels(JNIEnv *env, jclass,
|
|||||||
|
|
||||||
PixelBufferDescriptor desc(buffer, sizeInBytes, (backend::PixelDataFormat) format,
|
PixelBufferDescriptor desc(buffer, sizeInBytes, (backend::PixelDataFormat) format,
|
||||||
(backend::PixelDataType) type, (uint8_t) alignment, (uint32_t) left, (uint32_t) top,
|
(backend::PixelDataType) type, (uint8_t) alignment, (uint32_t) left, (uint32_t) top,
|
||||||
(uint32_t) stride, &JniBufferCallback::invoke, callback);
|
(uint32_t) stride,
|
||||||
|
callback->getHandler(), &JniBufferCallback::postToJavaAndDestroy, callback);
|
||||||
|
|
||||||
renderer->readPixels(uint32_t(xoffset), uint32_t(yoffset), uint32_t(width), uint32_t(height),
|
renderer->readPixels(uint32_t(xoffset), uint32_t(yoffset), uint32_t(width), uint32_t(height),
|
||||||
std::move(desc));
|
std::move(desc));
|
||||||
@@ -124,7 +133,8 @@ Java_com_google_android_filament_Renderer_nReadPixelsEx(JNIEnv *env, jclass,
|
|||||||
|
|
||||||
PixelBufferDescriptor desc(buffer, sizeInBytes, (backend::PixelDataFormat) format,
|
PixelBufferDescriptor desc(buffer, sizeInBytes, (backend::PixelDataFormat) format,
|
||||||
(backend::PixelDataType) type, (uint8_t) alignment, (uint32_t) left, (uint32_t) top,
|
(backend::PixelDataType) type, (uint8_t) alignment, (uint32_t) left, (uint32_t) top,
|
||||||
(uint32_t) stride, &JniBufferCallback::invoke, callback);
|
(uint32_t) stride,
|
||||||
|
callback->getHandler(), &JniBufferCallback::postToJavaAndDestroy, callback);
|
||||||
|
|
||||||
renderer->readPixels(renderTarget,
|
renderer->readPixels(renderTarget,
|
||||||
uint32_t(xoffset), uint32_t(yoffset), uint32_t(width), uint32_t(height),
|
uint32_t(xoffset), uint32_t(yoffset), uint32_t(width), uint32_t(height),
|
||||||
@@ -146,12 +156,9 @@ Java_com_google_android_filament_Renderer_nResetUserTime(JNIEnv*, jclass, jlong
|
|||||||
}
|
}
|
||||||
|
|
||||||
extern "C" JNIEXPORT void JNICALL
|
extern "C" JNIEXPORT void JNICALL
|
||||||
Java_com_google_android_filament_Renderer_nSetDisplayInfo(JNIEnv*, jclass, jlong nativeRenderer,
|
Java_com_google_android_filament_Renderer_nSetDisplayInfo(JNIEnv*, jclass, jlong nativeRenderer, jfloat refreshRate) {
|
||||||
jfloat refreshRate, jlong presentationDeadlineNanos, jlong vsyncOffsetNanos) {
|
|
||||||
Renderer *renderer = (Renderer *) nativeRenderer;
|
Renderer *renderer = (Renderer *) nativeRenderer;
|
||||||
renderer->setDisplayInfo({ .refreshRate = refreshRate,
|
renderer->setDisplayInfo({ .refreshRate = refreshRate });
|
||||||
.presentationDeadlineNanos = (uint64_t)presentationDeadlineNanos,
|
|
||||||
.vsyncOffsetNanos = (uint64_t)vsyncOffsetNanos });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" JNIEXPORT void JNICALL
|
extern "C" JNIEXPORT void JNICALL
|
||||||
@@ -173,3 +180,10 @@ Java_com_google_android_filament_Renderer_nSetClearOptions(JNIEnv *, jclass ,
|
|||||||
.clear = (bool) clear,
|
.clear = (bool) clear,
|
||||||
.discard = (bool) discard});
|
.discard = (bool) discard});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT void JNICALL
|
||||||
|
Java_com_google_android_filament_Renderer_nSetPresentationTime(JNIEnv *, jclass ,
|
||||||
|
jlong nativeRenderer, jlong monotonicClockNanos) {
|
||||||
|
Renderer *renderer = (Renderer *) nativeRenderer;
|
||||||
|
renderer->setPresentationTime(monotonicClockNanos);
|
||||||
|
}
|
||||||
|
|||||||
@@ -83,3 +83,11 @@ Java_com_google_android_filament_Scene_nGetLightCount(JNIEnv *env, jclass type,
|
|||||||
Scene* scene = (Scene*) nativeScene;
|
Scene* scene = (Scene*) nativeScene;
|
||||||
return (jint) scene->getLightCount();
|
return (jint) scene->getLightCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT jboolean JNICALL
|
||||||
|
Java_com_google_android_filament_Scene_nHasEntity(JNIEnv *env, jclass type, jlong nativeScene,
|
||||||
|
jint entityId) {
|
||||||
|
Scene* scene = (Scene*) nativeScene;
|
||||||
|
Entity entity = Entity::import(entityId);
|
||||||
|
return (jboolean) scene->hasEntity(entity);
|
||||||
|
}
|
||||||
|
|||||||
@@ -0,0 +1,116 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2021 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <jni.h>
|
||||||
|
|
||||||
|
#include <functional>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <filament/SkinningBuffer.h>
|
||||||
|
|
||||||
|
#include "common/CallbackUtils.h"
|
||||||
|
#include "common/NioUtils.h"
|
||||||
|
|
||||||
|
using namespace filament;
|
||||||
|
using namespace backend;
|
||||||
|
|
||||||
|
extern "C"
|
||||||
|
JNIEXPORT jlong JNICALL
|
||||||
|
Java_com_google_android_filament_SkinningBuffer_nCreateBuilder(JNIEnv*, jclass) {
|
||||||
|
return (jlong) new SkinningBuffer::Builder();
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C"
|
||||||
|
JNIEXPORT void JNICALL
|
||||||
|
Java_com_google_android_filament_SkinningBuffer_nDestroyBuilder(JNIEnv*, jclass,
|
||||||
|
jlong nativeBuilder) {
|
||||||
|
SkinningBuffer::Builder* builder = (SkinningBuffer::Builder *) nativeBuilder;
|
||||||
|
delete builder;
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C"
|
||||||
|
JNIEXPORT void JNICALL
|
||||||
|
Java_com_google_android_filament_SkinningBuffer_nBuilderBoneCount(JNIEnv*, jclass,
|
||||||
|
jlong nativeBuilder, jint boneCount) {
|
||||||
|
SkinningBuffer::Builder* builder = (SkinningBuffer::Builder *) nativeBuilder;
|
||||||
|
builder->boneCount((uint32_t)boneCount);
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C"
|
||||||
|
JNIEXPORT void JNICALL
|
||||||
|
Java_com_google_android_filament_SkinningBuffer_nBuilderInitialize(JNIEnv*, jclass,
|
||||||
|
jlong nativeBuilder, jboolean initialize) {
|
||||||
|
SkinningBuffer::Builder* builder = (SkinningBuffer::Builder *) nativeBuilder;
|
||||||
|
builder->initialize((bool)initialize);
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C"
|
||||||
|
JNIEXPORT jlong JNICALL
|
||||||
|
Java_com_google_android_filament_SkinningBuffer_nBuilderBuild(JNIEnv*, jclass,
|
||||||
|
jlong nativeBuilder, jlong nativeEngine) {
|
||||||
|
SkinningBuffer::Builder* builder = (SkinningBuffer::Builder *) nativeBuilder;
|
||||||
|
Engine *engine = (Engine *) nativeEngine;
|
||||||
|
return (jlong) builder->build(*engine);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
extern "C"
|
||||||
|
JNIEXPORT jint JNICALL
|
||||||
|
Java_com_google_android_filament_SkinningBuffer_nSetBonesAsMatrices(JNIEnv* env, jclass,
|
||||||
|
jlong nativeSkinningBuffer, jlong nativeEngine, jobject matrices, jint remaining, jint boneCount,
|
||||||
|
jint offset) {
|
||||||
|
SkinningBuffer *skinningBuffer = (SkinningBuffer *) nativeSkinningBuffer;
|
||||||
|
Engine *engine = (Engine *) nativeEngine;
|
||||||
|
AutoBuffer nioBuffer(env, matrices, boneCount * 16);
|
||||||
|
void* data = nioBuffer.getData();
|
||||||
|
size_t sizeInBytes = nioBuffer.getSize();
|
||||||
|
if (sizeInBytes > (remaining << nioBuffer.getShift())) {
|
||||||
|
// BufferOverflowException
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
skinningBuffer->setBones(*engine,
|
||||||
|
static_cast<filament::math::mat4f const *>(data), (size_t)boneCount, (size_t)offset);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C"
|
||||||
|
JNIEXPORT jint JNICALL
|
||||||
|
Java_com_google_android_filament_SkinningBuffer_nSetBonesAsQuaternions(JNIEnv* env, jclass,
|
||||||
|
jlong nativeSkinningBuffer, jlong nativeEngine, jobject quaternions, jint remaining,
|
||||||
|
jint boneCount, jint offset) {
|
||||||
|
SkinningBuffer *skinningBuffer = (SkinningBuffer *) nativeSkinningBuffer;
|
||||||
|
Engine *engine = (Engine *) nativeEngine;
|
||||||
|
AutoBuffer nioBuffer(env, quaternions, boneCount * 8);
|
||||||
|
void* data = nioBuffer.getData();
|
||||||
|
size_t sizeInBytes = nioBuffer.getSize();
|
||||||
|
if (sizeInBytes > (remaining << nioBuffer.getShift())) {
|
||||||
|
// BufferOverflowException
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
skinningBuffer->setBones(*engine,
|
||||||
|
static_cast<RenderableManager::Bone const *>(data), (size_t)boneCount, (size_t)offset);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C"
|
||||||
|
JNIEXPORT jint JNICALL
|
||||||
|
Java_com_google_android_filament_SkinningBuffer_nGetBoneCount(JNIEnv*, jclass,
|
||||||
|
jlong nativeSkinningBuffer) {
|
||||||
|
SkinningBuffer *skinningBuffer = (SkinningBuffer *) nativeSkinningBuffer;
|
||||||
|
return (jint)skinningBuffer->getBoneCount();
|
||||||
|
}
|
||||||
@@ -100,7 +100,7 @@ Java_com_google_android_filament_Skybox_nSetColor(JNIEnv *, jclass,
|
|||||||
}
|
}
|
||||||
|
|
||||||
extern "C" JNIEXPORT jlong JNICALL
|
extern "C" JNIEXPORT jlong JNICALL
|
||||||
Java_com_google_android_filament_Skybix_nGetTexture(JNIEnv* env, jclass,
|
Java_com_google_android_filament_Skybox_nGetTexture(JNIEnv* env, jclass,
|
||||||
jlong nativeSkybox) {
|
jlong nativeSkybox) {
|
||||||
Skybox *skybox = (Skybox *) nativeSkybox;
|
Skybox *skybox = (Skybox *) nativeSkybox;
|
||||||
Texture const *tex = skybox->getTexture();
|
Texture const *tex = skybox->getTexture();
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
#include "common/NioUtils.h"
|
#include "common/NioUtils.h"
|
||||||
#include "common/CallbackUtils.h"
|
#include "common/CallbackUtils.h"
|
||||||
|
|
||||||
#ifdef ANDROID
|
#ifdef __ANDROID__
|
||||||
|
|
||||||
#if __has_include(<android/hardware_buffer_jni.h>)
|
#if __has_include(<android/hardware_buffer_jni.h>)
|
||||||
#include <android/hardware_buffer_jni.h>
|
#include <android/hardware_buffer_jni.h>
|
||||||
@@ -98,13 +98,6 @@ Java_com_google_android_filament_Stream_nBuilderStreamSource(JNIEnv* env,
|
|||||||
builder->setStreamSource(env, streamSource);
|
builder->setStreamSource(env, streamSource);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" JNIEXPORT void JNICALL
|
|
||||||
Java_com_google_android_filament_Stream_nBuilderStream(JNIEnv*, jclass,
|
|
||||||
jlong nativeStreamBuilder, jlong externalTextureId) {
|
|
||||||
StreamBuilder* builder = (StreamBuilder*) nativeStreamBuilder;
|
|
||||||
builder->builder()->stream(externalTextureId);
|
|
||||||
}
|
|
||||||
|
|
||||||
extern "C" JNIEXPORT void JNICALL
|
extern "C" JNIEXPORT void JNICALL
|
||||||
Java_com_google_android_filament_Stream_nBuilderWidth(JNIEnv*, jclass,
|
Java_com_google_android_filament_Stream_nBuilderWidth(JNIEnv*, jclass,
|
||||||
jlong nativeStreamBuilder, jint width) {
|
jlong nativeStreamBuilder, jint width) {
|
||||||
@@ -140,40 +133,6 @@ Java_com_google_android_filament_Stream_nSetDimensions(JNIEnv*, jclass, jlong na
|
|||||||
stream->setDimensions((uint32_t) width, (uint32_t) height);
|
stream->setDimensions((uint32_t) width, (uint32_t) height);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" JNIEXPORT jint JNICALL
|
|
||||||
Java_com_google_android_filament_Stream_nReadPixels(JNIEnv *env, jclass,
|
|
||||||
jlong nativeStream, jlong nativeEngine,
|
|
||||||
jint xoffset, jint yoffset, jint width, jint height,
|
|
||||||
jobject storage, jint remaining,
|
|
||||||
jint left, jint top, jint type, jint alignment, jint stride, jint format,
|
|
||||||
jobject handler, jobject runnable) {
|
|
||||||
Stream *stream = (Stream *) nativeStream;
|
|
||||||
Engine *engine = (Engine *) nativeEngine;
|
|
||||||
|
|
||||||
stride = stride ? stride : width;
|
|
||||||
size_t sizeInBytes = PixelBufferDescriptor::computeDataSize(
|
|
||||||
(PixelDataFormat) format, (PixelDataType) type,
|
|
||||||
(size_t) stride, (size_t) (height + top), (size_t) alignment);
|
|
||||||
|
|
||||||
AutoBuffer nioBuffer(env, storage, 0);
|
|
||||||
if (sizeInBytes > (remaining << nioBuffer.getShift())) {
|
|
||||||
// BufferOverflowException
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
void *buffer = nioBuffer.getData();
|
|
||||||
auto *callback = JniBufferCallback::make(engine, env, handler, runnable, std::move(nioBuffer));
|
|
||||||
|
|
||||||
PixelBufferDescriptor desc(buffer, sizeInBytes, (backend::PixelDataFormat) format,
|
|
||||||
(backend::PixelDataType) type, (uint8_t) alignment, (uint32_t) left, (uint32_t) top,
|
|
||||||
(uint32_t) stride, &JniBufferCallback::invoke, callback);
|
|
||||||
|
|
||||||
stream->readPixels(uint32_t(xoffset), uint32_t(yoffset), uint32_t(width), uint32_t(height),
|
|
||||||
std::move(desc));
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
extern "C" JNIEXPORT jlong JNICALL
|
extern "C" JNIEXPORT jlong JNICALL
|
||||||
Java_com_google_android_filament_Stream_nGetTimestamp(JNIEnv*, jclass, jlong nativeStream) {
|
Java_com_google_android_filament_Stream_nGetTimestamp(JNIEnv*, jclass, jlong nativeStream) {
|
||||||
Stream *stream = (Stream *) nativeStream;
|
Stream *stream = (Stream *) nativeStream;
|
||||||
@@ -186,7 +145,7 @@ Java_com_google_android_filament_Stream_nSetAcquiredImage(JNIEnv* env, jclass, j
|
|||||||
Engine* engine = (Engine*) nativeEngine;
|
Engine* engine = (Engine*) nativeEngine;
|
||||||
Stream* stream = (Stream*) nativeStream;
|
Stream* stream = (Stream*) nativeStream;
|
||||||
|
|
||||||
#ifdef ANDROID
|
#ifdef __ANDROID__
|
||||||
|
|
||||||
// This function is not available before NDK 15 or before Android 8.
|
// This function is not available before NDK 15 or before Android 8.
|
||||||
if (UTILS_UNLIKELY(!AHardwareBuffer_fromHardwareBuffer_fn)) {
|
if (UTILS_UNLIKELY(!AHardwareBuffer_fromHardwareBuffer_fn)) {
|
||||||
@@ -197,8 +156,8 @@ Java_com_google_android_filament_Stream_nSetAcquiredImage(JNIEnv* env, jclass, j
|
|||||||
if (!AHardwareBuffer_fromHardwareBuffer_fn) {
|
if (!AHardwareBuffer_fromHardwareBuffer_fn) {
|
||||||
__android_log_print(ANDROID_LOG_WARN, "Filament", "AHardwareBuffer_fromHardwareBuffer is not available.");
|
__android_log_print(ANDROID_LOG_WARN, "Filament", "AHardwareBuffer_fromHardwareBuffer is not available.");
|
||||||
sHardwareBufferSupported = false;
|
sHardwareBufferSupported = false;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
AHardwareBuffer* nativeBuffer = AHardwareBuffer_fromHardwareBuffer_fn(env, hwbuffer);
|
AHardwareBuffer* nativeBuffer = AHardwareBuffer_fromHardwareBuffer_fn(env, hwbuffer);
|
||||||
@@ -218,5 +177,6 @@ Java_com_google_android_filament_Stream_nSetAcquiredImage(JNIEnv* env, jclass, j
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
stream->setAcquiredImage((void*) nativeBuffer, &JniImageCallback::invoke, callback);
|
stream->setAcquiredImage((void*) nativeBuffer,
|
||||||
|
callback->getHandler(), &JniImageCallback::postToJavaAndDestroy, callback);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
#include <jni.h>
|
#include <jni.h>
|
||||||
|
|
||||||
|
#include <filament/Engine.h>
|
||||||
#include <filament/SwapChain.h>
|
#include <filament/SwapChain.h>
|
||||||
|
|
||||||
#include "common/CallbackUtils.h"
|
#include "common/CallbackUtils.h"
|
||||||
@@ -26,6 +27,14 @@ extern "C" JNIEXPORT void JNICALL
|
|||||||
Java_com_google_android_filament_SwapChain_nSetFrameCompletedCallback(JNIEnv* env, jclass,
|
Java_com_google_android_filament_SwapChain_nSetFrameCompletedCallback(JNIEnv* env, jclass,
|
||||||
jlong nativeSwapChain, jobject handler, jobject runnable) {
|
jlong nativeSwapChain, jobject handler, jobject runnable) {
|
||||||
SwapChain* swapChain = (SwapChain*) nativeSwapChain;
|
SwapChain* swapChain = (SwapChain*) nativeSwapChain;
|
||||||
auto *callback = JniCallback::make(env, handler, runnable);
|
auto* callback = JniCallback::make(env, handler, runnable);
|
||||||
swapChain->setFrameCompletedCallback(&JniCallback::invoke, callback);
|
swapChain->setFrameCompletedCallback(nullptr, [callback](SwapChain* swapChain) {
|
||||||
|
JniCallback::postToJavaAndDestroy(callback);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT jboolean JNICALL
|
||||||
|
Java_com_google_android_filament_SwapChain_nIsSRGBSwapChainSupported(JNIEnv *, jclass, jlong nativeEngine) {
|
||||||
|
Engine* engine = (Engine*) nativeEngine;
|
||||||
|
return (bool)SwapChain::isSRGBSwapChainSupported(*engine);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
|
||||||
#ifdef ANDROID
|
#ifdef __ANDROID__
|
||||||
#include <android/bitmap.h>
|
#include <android/bitmap.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -31,15 +31,18 @@
|
|||||||
#include "common/CallbackUtils.h"
|
#include "common/CallbackUtils.h"
|
||||||
#include "common/NioUtils.h"
|
#include "common/NioUtils.h"
|
||||||
|
|
||||||
|
#include "private/backend/VirtualMachineEnv.h"
|
||||||
|
|
||||||
using namespace filament;
|
using namespace filament;
|
||||||
using namespace backend;
|
using namespace backend;
|
||||||
|
|
||||||
static size_t getTextureDataSize(const Texture *texture, size_t level,
|
static size_t getTextureDataSize(const Texture *texture,
|
||||||
Texture::Format format, Texture::Type type, size_t stride, size_t alignment) {
|
size_t level, Texture::Format format, Texture::Type type,
|
||||||
|
size_t stride, size_t height, size_t alignment) {
|
||||||
// Zero stride implies tight row-to-row packing.
|
// Zero stride implies tight row-to-row packing.
|
||||||
stride = stride == 0 ? texture->getWidth(level) : std::max(size_t(1), stride >> level);
|
stride = stride == 0 ? texture->getWidth(level) : std::max(size_t(1), stride >> level);
|
||||||
return Texture::computeTextureDataSize(format, type,
|
height = height == 0 ? texture->getHeight(level) : std::max(size_t(1), height >> level);
|
||||||
stride, texture->getHeight(level), alignment);
|
return Texture::computeTextureDataSize(format, type, stride, height, alignment);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" JNIEXPORT jboolean JNICALL
|
extern "C" JNIEXPORT jboolean JNICALL
|
||||||
@@ -50,6 +53,13 @@ Java_com_google_android_filament_Texture_nIsTextureFormatSupported(JNIEnv*, jcla
|
|||||||
(Texture::InternalFormat) internalFormat);
|
(Texture::InternalFormat) internalFormat);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT jboolean JNICALL
|
||||||
|
Java_com_google_android_filament_Texture_nIsTextureSwizzleSupported(JNIEnv*, jclass,
|
||||||
|
jlong nativeEngine) {
|
||||||
|
Engine *engine = (Engine *) nativeEngine;
|
||||||
|
return (jboolean) Texture::isTextureSwizzleSupported(*engine);
|
||||||
|
}
|
||||||
|
|
||||||
// Texture::Builder...
|
// Texture::Builder...
|
||||||
|
|
||||||
extern "C" JNIEXPORT jlong JNICALL
|
extern "C" JNIEXPORT jlong JNICALL
|
||||||
@@ -121,6 +131,13 @@ Java_com_google_android_filament_Texture_nBuilderSwizzle(JNIEnv *, jclass ,
|
|||||||
(Texture::Swizzle)r, (Texture::Swizzle)g, (Texture::Swizzle)b, (Texture::Swizzle)a);
|
(Texture::Swizzle)r, (Texture::Swizzle)g, (Texture::Swizzle)b, (Texture::Swizzle)a);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C"
|
||||||
|
JNIEXPORT void JNICALL
|
||||||
|
Java_com_google_android_filament_Texture_nBuilderImportTexture(JNIEnv*, jclass, jlong nativeBuilder, jlong id) {
|
||||||
|
Texture::Builder *builder = (Texture::Builder *) nativeBuilder;
|
||||||
|
builder->import((intptr_t)id);
|
||||||
|
}
|
||||||
|
|
||||||
extern "C" JNIEXPORT jlong JNICALL
|
extern "C" JNIEXPORT jlong JNICALL
|
||||||
Java_com_google_android_filament_Texture_nBuilderBuild(JNIEnv*, jclass,
|
Java_com_google_android_filament_Texture_nBuilderBuild(JNIEnv*, jclass,
|
||||||
jlong nativeBuilder, jlong nativeEngine) {
|
jlong nativeBuilder, jlong nativeEngine) {
|
||||||
@@ -171,82 +188,20 @@ Java_com_google_android_filament_Texture_nGetInternalFormat(JNIEnv*, jclass,
|
|||||||
return (jint) texture->getFormat();
|
return (jint) texture->getFormat();
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" JNIEXPORT jint JNICALL
|
|
||||||
Java_com_google_android_filament_Texture_nSetImage(JNIEnv* env, jclass, jlong nativeTexture,
|
|
||||||
jlong nativeEngine, jint level, jint xoffset, jint yoffset, jint width, jint height,
|
|
||||||
jobject storage, jint remaining,
|
|
||||||
jint left, jint bottom, jint type, jint alignment,
|
|
||||||
jint stride, jint format,
|
|
||||||
jobject handler, jobject runnable) {
|
|
||||||
Texture* texture = (Texture*) nativeTexture;
|
|
||||||
Engine* engine = (Engine*) nativeEngine;
|
|
||||||
|
|
||||||
size_t sizeInBytes = getTextureDataSize(texture, (size_t) level, (Texture::Format) format,
|
|
||||||
(Texture::Type) type, (size_t) stride, (size_t) alignment);
|
|
||||||
|
|
||||||
AutoBuffer nioBuffer(env, storage, 0);
|
|
||||||
if (sizeInBytes > (size_t(remaining) << nioBuffer.getShift())) {
|
|
||||||
// BufferOverflowException
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
void *buffer = nioBuffer.getData();
|
|
||||||
auto *callback = JniBufferCallback::make(engine, env, handler, runnable, std::move(nioBuffer));
|
|
||||||
|
|
||||||
Texture::PixelBufferDescriptor desc(buffer, sizeInBytes, (backend::PixelDataFormat) format,
|
|
||||||
(backend::PixelDataType) type, (uint8_t) alignment, (uint32_t) left, (uint32_t) bottom,
|
|
||||||
(uint32_t) stride, &JniBufferCallback::invoke, callback);
|
|
||||||
|
|
||||||
texture->setImage(*engine, (size_t) level, (uint32_t) xoffset, (uint32_t) yoffset,
|
|
||||||
(uint32_t) width, (uint32_t) height, std::move(desc));
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
extern "C" JNIEXPORT jint JNICALL
|
|
||||||
Java_com_google_android_filament_Texture_nSetImageCompressed(JNIEnv *env, jclass,
|
|
||||||
jlong nativeTexture, jlong nativeEngine, jint level, jint xoffset, jint yoffset,
|
|
||||||
jint width, jint height, jobject storage, jint remaining,
|
|
||||||
jint, jint, jint, jint, jint compressedSizeInBytes, jint compressedFormat,
|
|
||||||
jobject handler, jobject runnable) {
|
|
||||||
Texture *texture = (Texture *) nativeTexture;
|
|
||||||
Engine *engine = (Engine *) nativeEngine;
|
|
||||||
|
|
||||||
size_t sizeInBytes = (size_t) compressedSizeInBytes;
|
|
||||||
|
|
||||||
AutoBuffer nioBuffer(env, storage, 0);
|
|
||||||
if (sizeInBytes > (size_t(remaining) << nioBuffer.getShift())) {
|
|
||||||
// BufferOverflowException
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
void *buffer = nioBuffer.getData();
|
|
||||||
auto *callback = JniBufferCallback::make(engine, env, handler, runnable, std::move(nioBuffer));
|
|
||||||
|
|
||||||
Texture::PixelBufferDescriptor desc(buffer, sizeInBytes,
|
|
||||||
(backend::CompressedPixelDataType) compressedFormat, (uint32_t) compressedSizeInBytes,
|
|
||||||
&JniBufferCallback::invoke, callback);
|
|
||||||
|
|
||||||
texture->setImage(*engine, (size_t) level, (uint32_t) xoffset, (uint32_t) yoffset,
|
|
||||||
(uint32_t) width, (uint32_t) height, std::move(desc));
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
extern "C" JNIEXPORT jint JNICALL
|
extern "C" JNIEXPORT jint JNICALL
|
||||||
Java_com_google_android_filament_Texture_nSetImage3D(JNIEnv* env, jclass, jlong nativeTexture,
|
Java_com_google_android_filament_Texture_nSetImage3D(JNIEnv* env, jclass, jlong nativeTexture,
|
||||||
jlong nativeEngine, jint level,
|
jlong nativeEngine, jint level,
|
||||||
jint xoffset, jint yoffset, jint zoffset,
|
jint xoffset, jint yoffset, jint zoffset,
|
||||||
jint width, jint height, jint depth,
|
jint width, jint height, jint depth,
|
||||||
jobject storage, jint remaining,
|
jobject storage, jint remaining,
|
||||||
jint left, jint bottom, jint type, jint alignment,
|
jint left, jint top, jint type, jint alignment,
|
||||||
jint stride, jint format,
|
jint stride, jint format,
|
||||||
jobject handler, jobject runnable) {
|
jobject handler, jobject runnable) {
|
||||||
Texture* texture = (Texture*) nativeTexture;
|
Texture* texture = (Texture*) nativeTexture;
|
||||||
Engine* engine = (Engine*) nativeEngine;
|
Engine* engine = (Engine*) nativeEngine;
|
||||||
|
|
||||||
size_t sizeInBytes = getTextureDataSize(texture, (size_t) level, (Texture::Format) format,
|
size_t sizeInBytes = getTextureDataSize(texture, (size_t) level, (Texture::Format) format,
|
||||||
(Texture::Type) type, (size_t) stride, (size_t) alignment);
|
(Texture::Type) type, (size_t) stride, (size_t) height, (size_t) alignment) * depth;
|
||||||
|
|
||||||
AutoBuffer nioBuffer(env, storage, 0);
|
AutoBuffer nioBuffer(env, storage, 0);
|
||||||
if (sizeInBytes > (size_t(remaining) << nioBuffer.getShift())) {
|
if (sizeInBytes > (size_t(remaining) << nioBuffer.getShift())) {
|
||||||
@@ -258,8 +213,9 @@ Java_com_google_android_filament_Texture_nSetImage3D(JNIEnv* env, jclass, jlong
|
|||||||
auto *callback = JniBufferCallback::make(engine, env, handler, runnable, std::move(nioBuffer));
|
auto *callback = JniBufferCallback::make(engine, env, handler, runnable, std::move(nioBuffer));
|
||||||
|
|
||||||
Texture::PixelBufferDescriptor desc(buffer, sizeInBytes, (backend::PixelDataFormat) format,
|
Texture::PixelBufferDescriptor desc(buffer, sizeInBytes, (backend::PixelDataFormat) format,
|
||||||
(backend::PixelDataType) type, (uint8_t) alignment, (uint32_t) left, (uint32_t) bottom,
|
(backend::PixelDataType) type, (uint8_t) alignment, (uint32_t) left, (uint32_t) top,
|
||||||
(uint32_t) stride, &JniBufferCallback::invoke, callback);
|
(uint32_t) stride,
|
||||||
|
callback->getHandler(), &JniBufferCallback::postToJavaAndDestroy, callback);
|
||||||
|
|
||||||
texture->setImage(*engine, (size_t) level,
|
texture->setImage(*engine, (size_t) level,
|
||||||
(uint32_t) xoffset, (uint32_t) yoffset, (uint32_t) zoffset,
|
(uint32_t) xoffset, (uint32_t) yoffset, (uint32_t) zoffset,
|
||||||
@@ -293,7 +249,7 @@ Java_com_google_android_filament_Texture_nSetImage3DCompressed(JNIEnv *env, jcla
|
|||||||
|
|
||||||
Texture::PixelBufferDescriptor desc(buffer, sizeInBytes,
|
Texture::PixelBufferDescriptor desc(buffer, sizeInBytes,
|
||||||
(backend::CompressedPixelDataType) compressedFormat, (uint32_t) compressedSizeInBytes,
|
(backend::CompressedPixelDataType) compressedFormat, (uint32_t) compressedSizeInBytes,
|
||||||
&JniBufferCallback::invoke, callback);
|
callback->getHandler(), &JniBufferCallback::postToJavaAndDestroy, callback);
|
||||||
|
|
||||||
texture->setImage(*engine, (size_t) level,
|
texture->setImage(*engine, (size_t) level,
|
||||||
(uint32_t) xoffset, (uint32_t) yoffset, (uint32_t) zoffset,
|
(uint32_t) xoffset, (uint32_t) yoffset, (uint32_t) zoffset,
|
||||||
@@ -306,7 +262,7 @@ Java_com_google_android_filament_Texture_nSetImage3DCompressed(JNIEnv *env, jcla
|
|||||||
extern "C" JNIEXPORT jint JNICALL
|
extern "C" JNIEXPORT jint JNICALL
|
||||||
Java_com_google_android_filament_Texture_nSetImageCubemap(JNIEnv *env, jclass,
|
Java_com_google_android_filament_Texture_nSetImageCubemap(JNIEnv *env, jclass,
|
||||||
jlong nativeTexture, jlong nativeEngine, jint level, jobject storage, jint remaining,
|
jlong nativeTexture, jlong nativeEngine, jint level, jobject storage, jint remaining,
|
||||||
jint left, jint bottom, jint type, jint alignment, jint stride, jint format,
|
jint left, jint top, jint type, jint alignment, jint stride, jint format,
|
||||||
jintArray faceOffsetsInBytes_,
|
jintArray faceOffsetsInBytes_,
|
||||||
jobject handler, jobject runnable) {
|
jobject handler, jobject runnable) {
|
||||||
Texture *texture = (Texture *) nativeTexture;
|
Texture *texture = (Texture *) nativeTexture;
|
||||||
@@ -318,7 +274,7 @@ Java_com_google_android_filament_Texture_nSetImageCubemap(JNIEnv *env, jclass,
|
|||||||
env->ReleaseIntArrayElements(faceOffsetsInBytes_, faceOffsetsInBytes, JNI_ABORT);
|
env->ReleaseIntArrayElements(faceOffsetsInBytes_, faceOffsetsInBytes, JNI_ABORT);
|
||||||
|
|
||||||
size_t sizeInBytes = 6 * getTextureDataSize(texture, (size_t) level, (Texture::Format) format,
|
size_t sizeInBytes = 6 * getTextureDataSize(texture, (size_t) level, (Texture::Format) format,
|
||||||
(Texture::Type) type, (size_t) stride, (size_t) alignment);
|
(Texture::Type) type, (size_t) stride, 0, (size_t) alignment);
|
||||||
|
|
||||||
AutoBuffer nioBuffer(env, storage, 0);
|
AutoBuffer nioBuffer(env, storage, 0);
|
||||||
if (sizeInBytes > (size_t(remaining) << nioBuffer.getShift())) {
|
if (sizeInBytes > (size_t(remaining) << nioBuffer.getShift())) {
|
||||||
@@ -330,10 +286,14 @@ Java_com_google_android_filament_Texture_nSetImageCubemap(JNIEnv *env, jclass,
|
|||||||
auto *callback = JniBufferCallback::make(engine, env, handler, runnable, std::move(nioBuffer));
|
auto *callback = JniBufferCallback::make(engine, env, handler, runnable, std::move(nioBuffer));
|
||||||
|
|
||||||
Texture::PixelBufferDescriptor desc(buffer, sizeInBytes, (backend::PixelDataFormat) format,
|
Texture::PixelBufferDescriptor desc(buffer, sizeInBytes, (backend::PixelDataFormat) format,
|
||||||
(backend::PixelDataType) type, (uint8_t) alignment, (uint32_t) left, (uint32_t) bottom,
|
(backend::PixelDataType) type, (uint8_t) alignment, (uint32_t) left, (uint32_t) top,
|
||||||
(uint32_t) stride, &JniBufferCallback::invoke, callback);
|
(uint32_t) stride,
|
||||||
|
callback->getHandler(), &JniBufferCallback::postToJavaAndDestroy, callback);
|
||||||
|
|
||||||
|
#pragma clang diagnostic push
|
||||||
|
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||||
texture->setImage(*engine, (size_t) level, std::move(desc), faceOffsets);
|
texture->setImage(*engine, (size_t) level, std::move(desc), faceOffsets);
|
||||||
|
#pragma clang diagnostic pop
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -341,7 +301,7 @@ Java_com_google_android_filament_Texture_nSetImageCubemap(JNIEnv *env, jclass,
|
|||||||
extern "C" JNIEXPORT jint JNICALL
|
extern "C" JNIEXPORT jint JNICALL
|
||||||
Java_com_google_android_filament_Texture_nSetImageCubemapCompressed(JNIEnv *env, jclass,
|
Java_com_google_android_filament_Texture_nSetImageCubemapCompressed(JNIEnv *env, jclass,
|
||||||
jlong nativeTexture, jlong nativeEngine, jint level, jobject storage, jint remaining,
|
jlong nativeTexture, jlong nativeEngine, jint level, jobject storage, jint remaining,
|
||||||
jint left, jint bottom, jint type, jint alignment,
|
jint left, jint top, jint type, jint alignment,
|
||||||
jint compressedSizeInBytes, jint compressedFormat, jintArray faceOffsetsInBytes_,
|
jint compressedSizeInBytes, jint compressedFormat, jintArray faceOffsetsInBytes_,
|
||||||
jobject handler, jobject runnable) {
|
jobject handler, jobject runnable) {
|
||||||
|
|
||||||
@@ -366,9 +326,12 @@ Java_com_google_android_filament_Texture_nSetImageCubemapCompressed(JNIEnv *env,
|
|||||||
|
|
||||||
Texture::PixelBufferDescriptor desc(buffer, sizeInBytes,
|
Texture::PixelBufferDescriptor desc(buffer, sizeInBytes,
|
||||||
(backend::CompressedPixelDataType) compressedFormat, (uint32_t) compressedSizeInBytes,
|
(backend::CompressedPixelDataType) compressedFormat, (uint32_t) compressedSizeInBytes,
|
||||||
&JniBufferCallback::invoke, callback);
|
callback->getHandler(), &JniBufferCallback::postToJavaAndDestroy, callback);
|
||||||
|
|
||||||
|
#pragma clang diagnostic push
|
||||||
|
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||||
texture->setImage(*engine, (size_t) level, std::move(desc), faceOffsets);
|
texture->setImage(*engine, (size_t) level, std::move(desc), faceOffsets);
|
||||||
|
#pragma clang diagnostic pop
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -439,7 +402,7 @@ Java_com_google_android_filament_Texture_nGeneratePrefilterMipmap(JNIEnv *env, j
|
|||||||
Texture::PixelBufferDescriptor desc(buffer, sizeInBytes, (backend::PixelDataFormat) format,
|
Texture::PixelBufferDescriptor desc(buffer, sizeInBytes, (backend::PixelDataFormat) format,
|
||||||
(backend::PixelDataType) type, (uint8_t) alignment,
|
(backend::PixelDataType) type, (uint8_t) alignment,
|
||||||
(uint32_t) left, (uint32_t) top, (uint32_t) stride,
|
(uint32_t) left, (uint32_t) top, (uint32_t) stride,
|
||||||
&JniBufferCallback::invoke, callback);
|
callback->getHandler(), &JniBufferCallback::postToJavaAndDestroy, callback);
|
||||||
|
|
||||||
Texture::PrefilterOptions options;
|
Texture::PrefilterOptions options;
|
||||||
options.sampleCount = sampleCount;
|
options.sampleCount = sampleCount;
|
||||||
@@ -453,7 +416,7 @@ Java_com_google_android_filament_Texture_nGeneratePrefilterMipmap(JNIEnv *env, j
|
|||||||
// ANDROID SPECIFIC BITS
|
// ANDROID SPECIFIC BITS
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifdef ANDROID
|
#ifdef __ANDROID__
|
||||||
|
|
||||||
#define BITMAP_CONFIG_ALPHA_8 0
|
#define BITMAP_CONFIG_ALPHA_8 0
|
||||||
#define BITMAP_CONFIG_RGB_565 1
|
#define BITMAP_CONFIG_RGB_565 1
|
||||||
@@ -462,46 +425,37 @@ Java_com_google_android_filament_Texture_nGeneratePrefilterMipmap(JNIEnv *env, j
|
|||||||
#define BITMAP_CONFIG_RGBA_F16 4
|
#define BITMAP_CONFIG_RGBA_F16 4
|
||||||
#define BITMAP_CONFIG_HARDWARE 5
|
#define BITMAP_CONFIG_HARDWARE 5
|
||||||
|
|
||||||
class AutoBitmap {
|
class AutoBitmap : public JniCallback {
|
||||||
public:
|
private:
|
||||||
|
|
||||||
AutoBitmap(JNIEnv* env, jobject bitmap) noexcept
|
AutoBitmap(JNIEnv* env, jobject bitmap) noexcept
|
||||||
: mEnv(env)
|
: JniCallback(),
|
||||||
, mBitmap(env->NewGlobalRef(bitmap))
|
mBitmap(env->NewGlobalRef(bitmap)) {
|
||||||
{
|
|
||||||
if (mBitmap) {
|
if (mBitmap) {
|
||||||
AndroidBitmap_getInfo(mEnv, mBitmap, &mInfo);
|
AndroidBitmap_getInfo(env, mBitmap, &mInfo);
|
||||||
AndroidBitmap_lockPixels(mEnv, mBitmap, &mData);
|
AndroidBitmap_lockPixels(env, mBitmap, &mData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AutoBitmap(JNIEnv* env, jobject bitmap, jobject handler, jobject runnable) noexcept
|
AutoBitmap(JNIEnv* env, jobject bitmap, jobject handler, jobject runnable) noexcept
|
||||||
: mEnv(env)
|
: JniCallback(env, handler, runnable),
|
||||||
, mBitmap(env->NewGlobalRef(bitmap))
|
mBitmap(env->NewGlobalRef(bitmap)) {
|
||||||
, mHandler(env->NewGlobalRef(handler))
|
|
||||||
, mCallback(env->NewGlobalRef(runnable))
|
|
||||||
{
|
|
||||||
acquireCallbackJni(env, mCallbackUtils);
|
|
||||||
if (mBitmap) {
|
if (mBitmap) {
|
||||||
AndroidBitmap_getInfo(mEnv, mBitmap, &mInfo);
|
AndroidBitmap_getInfo(env, mBitmap, &mInfo);
|
||||||
AndroidBitmap_lockPixels(mEnv, mBitmap, &mData);
|
AndroidBitmap_lockPixels(env, mBitmap, &mData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
~AutoBitmap() noexcept {
|
void release(JNIEnv* env) {
|
||||||
releaseCallbackJni(mEnv, mCallbackUtils, mHandler, mCallback);
|
|
||||||
if (mBitmap) {
|
if (mBitmap) {
|
||||||
AndroidBitmap_unlockPixels(mEnv, mBitmap);
|
AndroidBitmap_unlockPixels(env, mBitmap);
|
||||||
mEnv->DeleteGlobalRef(mBitmap);
|
env->DeleteGlobalRef(mBitmap);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AutoBitmap(AutoBitmap &&rhs) noexcept {
|
~AutoBitmap() override = default;
|
||||||
mEnv = rhs.mEnv;
|
|
||||||
std::swap(mData, rhs.mData);
|
|
||||||
std::swap(mBitmap, rhs.mBitmap);
|
|
||||||
std::swap(mInfo, rhs.mInfo);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
public:
|
||||||
void* getData() const noexcept {
|
void* getData() const noexcept {
|
||||||
return mData;
|
return mData;
|
||||||
}
|
}
|
||||||
@@ -528,28 +482,37 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void invoke(void* buffer, size_t n, void* user) {
|
// create a AutoBitmap
|
||||||
AutoBitmap* data = reinterpret_cast<AutoBitmap*>(user);
|
static AutoBitmap* make(JNIEnv* env, jobject bitmap, jobject handler, jobject runnable) {
|
||||||
delete data;
|
|
||||||
}
|
|
||||||
|
|
||||||
static AutoBitmap* make(Engine* engine, JNIEnv* env, jobject bitmap) {
|
|
||||||
return new AutoBitmap(env, bitmap);
|
|
||||||
}
|
|
||||||
|
|
||||||
static AutoBitmap* make(Engine* engine, JNIEnv* env, jobject bitmap,
|
|
||||||
jobject handler, jobject runnable) {
|
|
||||||
return new AutoBitmap(env, bitmap, handler, runnable);
|
return new AutoBitmap(env, bitmap, handler, runnable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// execute the callback on the java thread and destroy ourselves
|
||||||
|
static void invoke(void*, size_t, void* user) {
|
||||||
|
auto* autoBitmap = reinterpret_cast<AutoBitmap*>(user);
|
||||||
|
JNIEnv* env = filament::VirtualMachineEnv::get().getEnvironment();
|
||||||
|
releaseCallbackJni(env, autoBitmap->mCallbackUtils, autoBitmap->mHandler, autoBitmap->mCallback);
|
||||||
|
autoBitmap->release(env);
|
||||||
|
delete autoBitmap;
|
||||||
|
}
|
||||||
|
|
||||||
|
// create a AutoBitmap without a handler
|
||||||
|
static AutoBitmap* make(JNIEnv* env, jobject bitmap) {
|
||||||
|
return new AutoBitmap(env, bitmap);
|
||||||
|
}
|
||||||
|
|
||||||
|
// just destroy ourselves
|
||||||
|
static void invokeNoCallback(void*, size_t, void* user) {
|
||||||
|
auto* autoBitmap = reinterpret_cast<AutoBitmap*>(user);
|
||||||
|
JNIEnv* env = filament::VirtualMachineEnv::get().getEnvironment();
|
||||||
|
autoBitmap->release(env);
|
||||||
|
delete autoBitmap;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
JNIEnv* mEnv;
|
|
||||||
void* mData = nullptr;
|
void* mData = nullptr;
|
||||||
jobject mBitmap = nullptr;
|
jobject mBitmap{};
|
||||||
jobject mHandler = nullptr;
|
AndroidBitmapInfo mInfo{};
|
||||||
jobject mCallback = nullptr;
|
|
||||||
AndroidBitmapInfo mInfo;
|
|
||||||
CallbackJni mCallbackUtils;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
@@ -560,14 +523,14 @@ Java_com_google_android_filament_android_TextureHelper_nSetBitmap(JNIEnv* env, j
|
|||||||
Texture* texture = (Texture*) nativeTexture;
|
Texture* texture = (Texture*) nativeTexture;
|
||||||
Engine *engine = (Engine *) nativeEngine;
|
Engine *engine = (Engine *) nativeEngine;
|
||||||
|
|
||||||
auto* autoBitmap = AutoBitmap::make(engine, env, bitmap);
|
auto* autoBitmap = AutoBitmap::make(env, bitmap);
|
||||||
|
|
||||||
Texture::PixelBufferDescriptor desc(
|
Texture::PixelBufferDescriptor desc(
|
||||||
autoBitmap->getData(),
|
autoBitmap->getData(),
|
||||||
autoBitmap->getSizeInBytes(),
|
autoBitmap->getSizeInBytes(),
|
||||||
autoBitmap->getFormat(format),
|
autoBitmap->getFormat(format),
|
||||||
autoBitmap->getType(format),
|
autoBitmap->getType(format),
|
||||||
&AutoBitmap::invoke, autoBitmap);
|
&AutoBitmap::invokeNoCallback, autoBitmap);
|
||||||
|
|
||||||
texture->setImage(*engine, (size_t) level,
|
texture->setImage(*engine, (size_t) level,
|
||||||
(uint32_t) xoffset, (uint32_t) yoffset,
|
(uint32_t) xoffset, (uint32_t) yoffset,
|
||||||
@@ -583,14 +546,14 @@ Java_com_google_android_filament_android_TextureHelper_nSetBitmapWithCallback(JN
|
|||||||
Texture* texture = (Texture*) nativeTexture;
|
Texture* texture = (Texture*) nativeTexture;
|
||||||
Engine *engine = (Engine *) nativeEngine;
|
Engine *engine = (Engine *) nativeEngine;
|
||||||
|
|
||||||
auto* autoBitmap = AutoBitmap::make(engine, env, bitmap, handler, runnable);
|
auto* autoBitmap = AutoBitmap::make(env, bitmap, handler, runnable);
|
||||||
|
|
||||||
Texture::PixelBufferDescriptor desc(
|
Texture::PixelBufferDescriptor desc(
|
||||||
autoBitmap->getData(),
|
autoBitmap->getData(),
|
||||||
autoBitmap->getSizeInBytes(),
|
autoBitmap->getSizeInBytes(),
|
||||||
autoBitmap->getFormat(format),
|
autoBitmap->getFormat(format),
|
||||||
autoBitmap->getType(format),
|
autoBitmap->getType(format),
|
||||||
&AutoBitmap::invoke, autoBitmap);
|
autoBitmap->getHandler(), &AutoBitmap::invoke, autoBitmap);
|
||||||
|
|
||||||
texture->setImage(*engine, (size_t) level,
|
texture->setImage(*engine, (size_t) level,
|
||||||
(uint32_t) xoffset, (uint32_t) yoffset,
|
(uint32_t) xoffset, (uint32_t) yoffset,
|
||||||
|
|||||||
@@ -18,142 +18,139 @@
|
|||||||
|
|
||||||
#include <filament/TextureSampler.h>
|
#include <filament/TextureSampler.h>
|
||||||
|
|
||||||
|
#include <utils/algorithm.h>
|
||||||
|
|
||||||
using namespace filament;
|
using namespace filament;
|
||||||
|
|
||||||
extern "C" JNIEXPORT jint JNICALL
|
namespace filament::JniUtils {
|
||||||
Java_com_google_android_filament_TextureSampler_nCreateSampler(JNIEnv *env, jclass type, jint min,
|
|
||||||
|
jlong to_long(TextureSampler const& sampler) noexcept {
|
||||||
|
return jlong(utils::bit_cast<uint32_t>(sampler.getSamplerParams()));
|
||||||
|
}
|
||||||
|
|
||||||
|
TextureSampler from_long(jlong params) noexcept {
|
||||||
|
return TextureSampler{
|
||||||
|
utils::bit_cast<backend::SamplerParams>(
|
||||||
|
static_cast<uint32_t>(params))};
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace filament::JniUtils
|
||||||
|
|
||||||
|
using namespace JniUtils;
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT jlong JNICALL
|
||||||
|
Java_com_google_android_filament_TextureSampler_nCreateSampler(JNIEnv *, jclass, jint min,
|
||||||
jint max, jint s, jint t, jint r) {
|
jint max, jint s, jint t, jint r) {
|
||||||
return TextureSampler(static_cast<TextureSampler::MinFilter>(min),
|
TextureSampler sampler(static_cast<TextureSampler::MinFilter>(min),
|
||||||
static_cast<TextureSampler::MagFilter>(max), static_cast<TextureSampler::WrapMode>(s),
|
static_cast<TextureSampler::MagFilter>(max),
|
||||||
static_cast<TextureSampler::WrapMode>(t),
|
static_cast<TextureSampler::WrapMode>(s),
|
||||||
static_cast<TextureSampler::WrapMode>(r)).getSamplerParams().u;
|
static_cast<TextureSampler::WrapMode>(t),
|
||||||
|
static_cast<TextureSampler::WrapMode>(r));
|
||||||
|
return to_long(sampler);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" JNIEXPORT jint JNICALL
|
extern "C" JNIEXPORT jlong JNICALL
|
||||||
Java_com_google_android_filament_TextureSampler_nCreateCompareSampler(JNIEnv *env, jclass type,
|
Java_com_google_android_filament_TextureSampler_nCreateCompareSampler(JNIEnv *, jclass,
|
||||||
jint mode, jint function) {
|
jint mode, jint function) {
|
||||||
return TextureSampler(static_cast<TextureSampler::CompareMode>(mode),
|
TextureSampler sampler(static_cast<TextureSampler::CompareMode>(mode),
|
||||||
static_cast<TextureSampler::CompareFunc>(function)).getSamplerParams().u;
|
static_cast<TextureSampler::CompareFunc>(function));
|
||||||
|
return to_long(sampler);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" JNIEXPORT jint JNICALL
|
extern "C" JNIEXPORT jint JNICALL
|
||||||
Java_com_google_android_filament_TextureSampler_nGetMinFilter(JNIEnv *env, jclass type,
|
Java_com_google_android_filament_TextureSampler_nGetMinFilter(JNIEnv *, jclass, jlong sampler) {
|
||||||
jint sampler_) {
|
return static_cast<jint>(from_long(sampler).getMinFilter());
|
||||||
TextureSampler &sampler = reinterpret_cast<TextureSampler &>(sampler_);
|
|
||||||
return static_cast<jint>(sampler.getMinFilter());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" JNIEXPORT jint JNICALL
|
extern "C" JNIEXPORT jlong JNICALL
|
||||||
Java_com_google_android_filament_TextureSampler_nSetMinFilter(JNIEnv *env, jclass type,
|
Java_com_google_android_filament_TextureSampler_nSetMinFilter(JNIEnv *, jclass, jlong sampler_, jint filter) {
|
||||||
jint sampler_, jint filter) {
|
TextureSampler sampler{from_long(sampler_)};
|
||||||
TextureSampler &sampler = reinterpret_cast<TextureSampler &>(sampler_);
|
|
||||||
sampler.setMinFilter(static_cast<TextureSampler::MinFilter>(filter));
|
sampler.setMinFilter(static_cast<TextureSampler::MinFilter>(filter));
|
||||||
return sampler.getSamplerParams().u;
|
return to_long(sampler);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" JNIEXPORT jint JNICALL
|
extern "C" JNIEXPORT jint JNICALL
|
||||||
Java_com_google_android_filament_TextureSampler_nGetMagFilter(JNIEnv *env, jclass type,
|
Java_com_google_android_filament_TextureSampler_nGetMagFilter(JNIEnv *, jclass, jlong sampler) {
|
||||||
jint sampler_) {
|
return static_cast<jint>(from_long(sampler).getMagFilter());
|
||||||
TextureSampler &sampler = reinterpret_cast<TextureSampler &>(sampler_);
|
|
||||||
return static_cast<jint>(sampler.getMagFilter());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" JNIEXPORT jint JNICALL
|
extern "C" JNIEXPORT jlong JNICALL
|
||||||
Java_com_google_android_filament_TextureSampler_nSetMagFilter(JNIEnv *env, jclass type,
|
Java_com_google_android_filament_TextureSampler_nSetMagFilter(JNIEnv *, jclass, jlong sampler_, jint filter) {
|
||||||
jint sampler_, jint filter) {
|
TextureSampler sampler{from_long(sampler_)};
|
||||||
TextureSampler &sampler = reinterpret_cast<TextureSampler &>(sampler_);
|
|
||||||
sampler.setMagFilter(static_cast<TextureSampler::MagFilter>(filter));
|
sampler.setMagFilter(static_cast<TextureSampler::MagFilter>(filter));
|
||||||
return sampler.getSamplerParams().u;
|
return to_long(sampler);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" JNIEXPORT jint JNICALL
|
extern "C" JNIEXPORT jint JNICALL
|
||||||
Java_com_google_android_filament_TextureSampler_nGetWrapModeS(JNIEnv *env, jclass type,
|
Java_com_google_android_filament_TextureSampler_nGetWrapModeS(JNIEnv *, jclass, jlong sampler) {
|
||||||
jint sampler_) {
|
return static_cast<jint>(from_long(sampler).getWrapModeS());
|
||||||
TextureSampler &sampler = reinterpret_cast<TextureSampler &>(sampler_);
|
|
||||||
return static_cast<jint>(sampler.getWrapModeS());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" JNIEXPORT jint JNICALL
|
extern "C" JNIEXPORT jlong JNICALL
|
||||||
Java_com_google_android_filament_TextureSampler_nSetWrapModeS(JNIEnv *env, jclass type,
|
Java_com_google_android_filament_TextureSampler_nSetWrapModeS(JNIEnv *, jclass, jlong sampler_, jint mode) {
|
||||||
jint sampler_, jint mode) {
|
TextureSampler sampler{from_long(sampler_)};
|
||||||
TextureSampler &sampler = reinterpret_cast<TextureSampler &>(sampler_);
|
|
||||||
sampler.setWrapModeS(static_cast<TextureSampler::WrapMode>(mode));
|
sampler.setWrapModeS(static_cast<TextureSampler::WrapMode>(mode));
|
||||||
return sampler.getSamplerParams().u;
|
return to_long(sampler);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" JNIEXPORT jint JNICALL
|
extern "C" JNIEXPORT jint JNICALL
|
||||||
Java_com_google_android_filament_TextureSampler_nGetWrapModeT(JNIEnv *env, jclass type,
|
Java_com_google_android_filament_TextureSampler_nGetWrapModeT(JNIEnv *, jclass, jlong sampler) {
|
||||||
jint sampler_) {
|
return static_cast<jint>(from_long(sampler).getWrapModeT());
|
||||||
TextureSampler &sampler = reinterpret_cast<TextureSampler &>(sampler_);
|
|
||||||
return static_cast<jint>(sampler.getWrapModeT());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" JNIEXPORT jint JNICALL
|
extern "C" JNIEXPORT jlong JNICALL
|
||||||
Java_com_google_android_filament_TextureSampler_nSetWrapModeT(JNIEnv *env, jclass type,
|
Java_com_google_android_filament_TextureSampler_nSetWrapModeT(JNIEnv *, jclass, jlong sampler_, jint mode) {
|
||||||
jint sampler_, jint mode) {
|
TextureSampler sampler{from_long(sampler_)};
|
||||||
TextureSampler &sampler = reinterpret_cast<TextureSampler &>(sampler_);
|
|
||||||
sampler.setWrapModeT(static_cast<TextureSampler::WrapMode>(mode));
|
sampler.setWrapModeT(static_cast<TextureSampler::WrapMode>(mode));
|
||||||
return sampler.getSamplerParams().u;
|
return to_long(sampler);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" JNIEXPORT jint JNICALL
|
extern "C" JNIEXPORT jint JNICALL
|
||||||
Java_com_google_android_filament_TextureSampler_nGetWrapModeR(JNIEnv *env, jclass type,
|
Java_com_google_android_filament_TextureSampler_nGetWrapModeR(JNIEnv *, jclass, jlong sampler) {
|
||||||
jint sampler_) {
|
return static_cast<jint>(from_long(sampler).getWrapModeR());
|
||||||
TextureSampler &sampler = reinterpret_cast<TextureSampler &>(sampler_);
|
|
||||||
return static_cast<jint>(sampler.getWrapModeR());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" JNIEXPORT jint JNICALL
|
extern "C" JNIEXPORT jlong JNICALL
|
||||||
Java_com_google_android_filament_TextureSampler_nSetWrapModeR(JNIEnv *env, jclass type,
|
Java_com_google_android_filament_TextureSampler_nSetWrapModeR(JNIEnv *, jclass, jlong sampler_, jint mode) {
|
||||||
jint sampler_, jint mode) {
|
TextureSampler sampler{from_long(sampler_)};
|
||||||
TextureSampler &sampler = reinterpret_cast<TextureSampler &>(sampler_);
|
|
||||||
sampler.setWrapModeR(static_cast<TextureSampler::WrapMode>(mode));
|
sampler.setWrapModeR(static_cast<TextureSampler::WrapMode>(mode));
|
||||||
return sampler.getSamplerParams().u;
|
return to_long(sampler);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" JNIEXPORT jint JNICALL
|
extern "C" JNIEXPORT jint JNICALL
|
||||||
Java_com_google_android_filament_TextureSampler_nGetCompareMode(JNIEnv *env, jclass type,
|
Java_com_google_android_filament_TextureSampler_nGetCompareMode(JNIEnv *, jclass, jlong sampler) {
|
||||||
jint sampler_) {
|
return static_cast<jint>(from_long(sampler).getCompareMode());
|
||||||
TextureSampler &sampler = reinterpret_cast<TextureSampler &>(sampler_);
|
|
||||||
return static_cast<jint>(sampler.getCompareMode());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" JNIEXPORT jint JNICALL
|
extern "C" JNIEXPORT jlong JNICALL
|
||||||
Java_com_google_android_filament_TextureSampler_nSetCompareMode(JNIEnv *env, jclass type,
|
Java_com_google_android_filament_TextureSampler_nSetCompareMode(JNIEnv *, jclass, jlong sampler_, jint mode) {
|
||||||
jint sampler_, jint mode) {
|
TextureSampler sampler{from_long(sampler_)};
|
||||||
TextureSampler &sampler = reinterpret_cast<TextureSampler &>(sampler_);
|
|
||||||
sampler.setCompareMode(static_cast<TextureSampler::CompareMode>(mode),
|
sampler.setCompareMode(static_cast<TextureSampler::CompareMode>(mode),
|
||||||
sampler.getCompareFunc());
|
sampler.getCompareFunc());
|
||||||
return sampler.getSamplerParams().u;
|
return to_long(sampler);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" JNIEXPORT jint JNICALL
|
extern "C" JNIEXPORT jint JNICALL
|
||||||
Java_com_google_android_filament_TextureSampler_nGetCompareFunction(JNIEnv *env, jclass type,
|
Java_com_google_android_filament_TextureSampler_nGetCompareFunction(JNIEnv *, jclass, jlong sampler) {
|
||||||
jint sampler_) {
|
return static_cast<jint>(from_long(sampler).getCompareFunc());
|
||||||
TextureSampler &sampler = reinterpret_cast<TextureSampler &>(sampler_);
|
|
||||||
return static_cast<jint>(sampler.getCompareFunc());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" JNIEXPORT jint JNICALL
|
extern "C" JNIEXPORT jlong JNICALL
|
||||||
Java_com_google_android_filament_TextureSampler_nSetCompareFunction(JNIEnv *env, jclass type,
|
Java_com_google_android_filament_TextureSampler_nSetCompareFunction(JNIEnv *, jclass, jlong sampler_, jint function) {
|
||||||
jint sampler_, jint function) {
|
TextureSampler sampler{from_long(sampler_)};
|
||||||
TextureSampler &sampler = reinterpret_cast<TextureSampler &>(sampler_);
|
|
||||||
sampler.setCompareMode(sampler.getCompareMode(),
|
sampler.setCompareMode(sampler.getCompareMode(),
|
||||||
static_cast<TextureSampler::CompareFunc>(function));
|
static_cast<TextureSampler::CompareFunc>(function));
|
||||||
return sampler.getSamplerParams().u;
|
return to_long(sampler);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" JNIEXPORT jfloat JNICALL
|
extern "C" JNIEXPORT jfloat JNICALL
|
||||||
Java_com_google_android_filament_TextureSampler_nGetAnisotropy(JNIEnv *env, jclass type,
|
Java_com_google_android_filament_TextureSampler_nGetAnisotropy(JNIEnv *, jclass, jlong sampler) {
|
||||||
jint sampler_) {
|
return from_long(sampler).getAnisotropy();
|
||||||
TextureSampler &sampler = reinterpret_cast<TextureSampler &>(sampler_);
|
|
||||||
return sampler.getAnisotropy();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" JNIEXPORT jint JNICALL
|
extern "C" JNIEXPORT jlong JNICALL
|
||||||
Java_com_google_android_filament_TextureSampler_nSetAnisotropy(JNIEnv *env, jclass type,
|
Java_com_google_android_filament_TextureSampler_nSetAnisotropy(JNIEnv *, jclass, jlong sampler_, jfloat anisotropy) {
|
||||||
jint sampler_, jfloat anisotropy) {
|
TextureSampler sampler{from_long(sampler_)};
|
||||||
TextureSampler &sampler = reinterpret_cast<TextureSampler &>(sampler_);
|
|
||||||
sampler.setAnisotropy(anisotropy);
|
sampler.setAnisotropy(anisotropy);
|
||||||
return sampler.getSamplerParams().u;
|
return to_long(sampler);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,98 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2021 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <jni.h>
|
||||||
|
|
||||||
|
#include <filament/ToneMapper.h>
|
||||||
|
|
||||||
|
using namespace filament;
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT void JNICALL
|
||||||
|
Java_com_google_android_filament_ToneMapper_nDestroyToneMapper(JNIEnv *env, jclass clazz,
|
||||||
|
jlong toneMapper_) {
|
||||||
|
ToneMapper* toneMapper = (ToneMapper*) toneMapper_;
|
||||||
|
delete toneMapper;
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT jlong JNICALL
|
||||||
|
Java_com_google_android_filament_ToneMapper_nCreateLinearToneMapper(JNIEnv*, jclass) {
|
||||||
|
return (jlong) new LinearToneMapper();
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT jlong JNICALL
|
||||||
|
Java_com_google_android_filament_ToneMapper_nCreateACESToneMapper(JNIEnv*, jclass) {
|
||||||
|
return (jlong) new ACESToneMapper();
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT jlong JNICALL
|
||||||
|
Java_com_google_android_filament_ToneMapper_nCreateACESLegacyToneMapper(JNIEnv*, jclass) {
|
||||||
|
return (jlong) new ACESLegacyToneMapper();
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT jlong JNICALL
|
||||||
|
Java_com_google_android_filament_ToneMapper_nCreateFilmicToneMapper(JNIEnv*, jclass) {
|
||||||
|
return (jlong) new FilmicToneMapper();
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT jlong JNICALL
|
||||||
|
Java_com_google_android_filament_ToneMapper_nCreateGenericToneMapper(JNIEnv*, jclass,
|
||||||
|
jfloat contrast, jfloat midGrayIn, jfloat midGrayOut, jfloat hdrMax) {
|
||||||
|
return (jlong) new GenericToneMapper(contrast, midGrayIn, midGrayOut, hdrMax);
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT jfloat JNICALL
|
||||||
|
Java_com_google_android_filament_ToneMapper_nGenericGetContrast(JNIEnv*, jclass, jlong nativeObject) {
|
||||||
|
return ((GenericToneMapper*) nativeObject)->getContrast();
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT jfloat JNICALL
|
||||||
|
Java_com_google_android_filament_ToneMapper_nGenericGetMidGrayIn(JNIEnv*, jclass, jlong nativeObject) {
|
||||||
|
return ((GenericToneMapper*) nativeObject)->getMidGrayIn();
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT jfloat JNICALL
|
||||||
|
Java_com_google_android_filament_ToneMapper_nGenericGetMidGrayOut(JNIEnv*, jclass, jlong nativeObject) {
|
||||||
|
return ((GenericToneMapper*) nativeObject)->getMidGrayOut();
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT jfloat JNICALL
|
||||||
|
Java_com_google_android_filament_ToneMapper_nGenericGetHdrMax(JNIEnv*, jclass, jlong nativeObject) {
|
||||||
|
return ((GenericToneMapper*) nativeObject)->getHdrMax();
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT void JNICALL
|
||||||
|
Java_com_google_android_filament_ToneMapper_nGenericSetContrast(JNIEnv*, jclass,
|
||||||
|
jlong nativeObject, jfloat contrast) {
|
||||||
|
((GenericToneMapper*) nativeObject)->setContrast(contrast);
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT void JNICALL
|
||||||
|
Java_com_google_android_filament_ToneMapper_nGenericSetMidGrayIn(JNIEnv*, jclass,
|
||||||
|
jlong nativeObject, jfloat midGrayIn) {
|
||||||
|
((GenericToneMapper*) nativeObject)->setMidGrayIn(midGrayIn);
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT void JNICALL
|
||||||
|
Java_com_google_android_filament_ToneMapper_nGenericSetMidGrayOut(JNIEnv*, jclass,
|
||||||
|
jlong nativeObject, jfloat midGrayOut) {
|
||||||
|
((GenericToneMapper*) nativeObject)->setMidGrayOut(midGrayOut);
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT void JNICALL
|
||||||
|
Java_com_google_android_filament_ToneMapper_nGenericSetHdrMax(JNIEnv*, jclass,
|
||||||
|
jlong nativeObject, jfloat hdrMax) {
|
||||||
|
((GenericToneMapper*) nativeObject)->setHdrMax(hdrMax);
|
||||||
|
}
|
||||||
@@ -70,6 +70,23 @@ Java_com_google_android_filament_TransformManager_nCreateArray(JNIEnv* env,
|
|||||||
return tm->getInstance(entity);
|
return tm->getInstance(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT jint JNICALL
|
||||||
|
Java_com_google_android_filament_TransformManager_nCreateArrayFp64(JNIEnv* env,
|
||||||
|
jclass, jlong nativeTransformManager, jint entity_, jint parent,
|
||||||
|
jdoubleArray localTransform_) {
|
||||||
|
TransformManager* tm = (TransformManager*) nativeTransformManager;
|
||||||
|
Entity& entity = *reinterpret_cast<Entity*>(&entity_);
|
||||||
|
if (localTransform_) {
|
||||||
|
jdouble *localTransform = env->GetDoubleArrayElements(localTransform_, NULL);
|
||||||
|
tm->create(entity, (TransformManager::Instance) parent,
|
||||||
|
*reinterpret_cast<const filament::math::mat4 *>(localTransform));
|
||||||
|
env->ReleaseDoubleArrayElements(localTransform_, localTransform, JNI_ABORT);
|
||||||
|
} else {
|
||||||
|
tm->create(entity, (TransformManager::Instance) parent);
|
||||||
|
}
|
||||||
|
return tm->getInstance(entity);
|
||||||
|
}
|
||||||
|
|
||||||
extern "C" JNIEXPORT void JNICALL
|
extern "C" JNIEXPORT void JNICALL
|
||||||
Java_com_google_android_filament_TransformManager_nDestroy(JNIEnv*, jclass,
|
Java_com_google_android_filament_TransformManager_nDestroy(JNIEnv*, jclass,
|
||||||
jlong nativeTransformManager, jint entity_) {
|
jlong nativeTransformManager, jint entity_) {
|
||||||
@@ -86,6 +103,33 @@ Java_com_google_android_filament_TransformManager_nSetParent(JNIEnv*, jclass,
|
|||||||
(TransformManager::Instance) newParent);
|
(TransformManager::Instance) newParent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT jint JNICALL
|
||||||
|
Java_com_google_android_filament_TransformManager_nGetParent(JNIEnv*, jclass,
|
||||||
|
jlong nativeTransformManager, jint i) {
|
||||||
|
TransformManager* tm = (TransformManager*) nativeTransformManager;
|
||||||
|
return tm->getParent((TransformManager::Instance) i).getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT jint JNICALL
|
||||||
|
Java_com_google_android_filament_TransformManager_nGetChildCount(JNIEnv*, jclass,
|
||||||
|
jlong nativeTransformManager, jint i) {
|
||||||
|
TransformManager* tm = (TransformManager*) nativeTransformManager;
|
||||||
|
return tm->getChildCount((TransformManager::Instance) i);
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT void JNICALL
|
||||||
|
Java_com_google_android_filament_TransformManager_nGetChildren(JNIEnv* env,
|
||||||
|
jclass, jlong nativeTransformManager, jint i,
|
||||||
|
jintArray outEntities_, jint count) {
|
||||||
|
TransformManager* tm = (TransformManager*) nativeTransformManager;
|
||||||
|
jint* entities = env->GetIntArrayElements(outEntities_, nullptr);
|
||||||
|
// This is very very gross, we just pretend Entity is just like an jint
|
||||||
|
// (which it is), but still.
|
||||||
|
tm->getChildren((TransformManager::Instance) i,
|
||||||
|
reinterpret_cast<Entity *>(entities), (size_t) count);
|
||||||
|
env->ReleaseIntArrayElements(outEntities_, entities, 0);
|
||||||
|
}
|
||||||
|
|
||||||
extern "C" JNIEXPORT void JNICALL
|
extern "C" JNIEXPORT void JNICALL
|
||||||
Java_com_google_android_filament_TransformManager_nSetTransform(JNIEnv* env,
|
Java_com_google_android_filament_TransformManager_nSetTransform(JNIEnv* env,
|
||||||
jclass, jlong nativeTransformManager, jint i,
|
jclass, jlong nativeTransformManager, jint i,
|
||||||
@@ -97,6 +141,17 @@ Java_com_google_android_filament_TransformManager_nSetTransform(JNIEnv* env,
|
|||||||
env->ReleaseFloatArrayElements(localTransform_, localTransform, JNI_ABORT);
|
env->ReleaseFloatArrayElements(localTransform_, localTransform, JNI_ABORT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT void JNICALL
|
||||||
|
Java_com_google_android_filament_TransformManager_nSetTransformFp64(JNIEnv* env,
|
||||||
|
jclass, jlong nativeTransformManager, jint i,
|
||||||
|
jdoubleArray localTransform_) {
|
||||||
|
TransformManager* tm = (TransformManager*) nativeTransformManager;
|
||||||
|
jdouble *localTransform = env->GetDoubleArrayElements(localTransform_, NULL);
|
||||||
|
tm->setTransform((TransformManager::Instance) i,
|
||||||
|
*reinterpret_cast<const filament::math::mat4 *>(localTransform));
|
||||||
|
env->ReleaseDoubleArrayElements(localTransform_, localTransform, JNI_ABORT);
|
||||||
|
}
|
||||||
|
|
||||||
extern "C" JNIEXPORT void JNICALL
|
extern "C" JNIEXPORT void JNICALL
|
||||||
Java_com_google_android_filament_TransformManager_nGetTransform(JNIEnv* env,
|
Java_com_google_android_filament_TransformManager_nGetTransform(JNIEnv* env,
|
||||||
jclass, jlong nativeTransformManager, jint i,
|
jclass, jlong nativeTransformManager, jint i,
|
||||||
@@ -108,6 +163,17 @@ Java_com_google_android_filament_TransformManager_nGetTransform(JNIEnv* env,
|
|||||||
env->ReleaseFloatArrayElements(outLocalTransform_, outLocalTransform, 0);
|
env->ReleaseFloatArrayElements(outLocalTransform_, outLocalTransform, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT void JNICALL
|
||||||
|
Java_com_google_android_filament_TransformManager_nGetTransformFp64(JNIEnv* env,
|
||||||
|
jclass, jlong nativeTransformManager, jint i,
|
||||||
|
jdoubleArray outLocalTransform_) {
|
||||||
|
TransformManager* tm = (TransformManager*) nativeTransformManager;
|
||||||
|
jdouble *outLocalTransform = env->GetDoubleArrayElements(outLocalTransform_, NULL);
|
||||||
|
*reinterpret_cast<filament::math::mat4 *>(outLocalTransform) = tm->getTransformAccurate(
|
||||||
|
(TransformManager::Instance) i);
|
||||||
|
env->ReleaseDoubleArrayElements(outLocalTransform_, outLocalTransform, 0);
|
||||||
|
}
|
||||||
|
|
||||||
extern "C" JNIEXPORT void JNICALL
|
extern "C" JNIEXPORT void JNICALL
|
||||||
Java_com_google_android_filament_TransformManager_nGetWorldTransform(JNIEnv* env,
|
Java_com_google_android_filament_TransformManager_nGetWorldTransform(JNIEnv* env,
|
||||||
jclass, jlong nativeTransformManager, jint i,
|
jclass, jlong nativeTransformManager, jint i,
|
||||||
@@ -119,6 +185,17 @@ Java_com_google_android_filament_TransformManager_nGetWorldTransform(JNIEnv* env
|
|||||||
env->ReleaseFloatArrayElements(outWorldTransform_, outWorldTransform, 0);
|
env->ReleaseFloatArrayElements(outWorldTransform_, outWorldTransform, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT void JNICALL
|
||||||
|
Java_com_google_android_filament_TransformManager_nGetWorldTransformFp64(JNIEnv* env,
|
||||||
|
jclass, jlong nativeTransformManager, jint i,
|
||||||
|
jdoubleArray outWorldTransform_) {
|
||||||
|
TransformManager* tm = (TransformManager*) nativeTransformManager;
|
||||||
|
jdouble *outWorldTransform = env->GetDoubleArrayElements(outWorldTransform_, NULL);
|
||||||
|
*reinterpret_cast<filament::math::mat4 *>(outWorldTransform) = tm->getWorldTransformAccurate(
|
||||||
|
(TransformManager::Instance) i);
|
||||||
|
env->ReleaseDoubleArrayElements(outWorldTransform_, outWorldTransform, 0);
|
||||||
|
}
|
||||||
|
|
||||||
extern "C" JNIEXPORT void JNICALL
|
extern "C" JNIEXPORT void JNICALL
|
||||||
Java_com_google_android_filament_TransformManager_nOpenLocalTransformTransaction(
|
Java_com_google_android_filament_TransformManager_nOpenLocalTransformTransaction(
|
||||||
JNIEnv*, jclass, jlong nativeTransformManager) {
|
JNIEnv*, jclass, jlong nativeTransformManager) {
|
||||||
@@ -132,3 +209,19 @@ Java_com_google_android_filament_TransformManager_nCommitLocalTransformTransacti
|
|||||||
TransformManager* tm = (TransformManager*) nativeTransformManager;
|
TransformManager* tm = (TransformManager*) nativeTransformManager;
|
||||||
tm->commitLocalTransformTransaction();
|
tm->commitLocalTransformTransaction();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C"
|
||||||
|
JNIEXPORT void JNICALL
|
||||||
|
Java_com_google_android_filament_TransformManager_nSetAccurateTranslationsEnabled(JNIEnv*,
|
||||||
|
jclass, jlong nativeTransformManager, jboolean enable) {
|
||||||
|
TransformManager* tm = (TransformManager*) nativeTransformManager;
|
||||||
|
tm->setAccurateTranslationsEnabled((bool)enable);
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C"
|
||||||
|
JNIEXPORT jboolean JNICALL
|
||||||
|
Java_com_google_android_filament_TransformManager_nIsAccurateTranslationsEnabled(JNIEnv*,
|
||||||
|
jclass, jlong nativeTransformManager) {
|
||||||
|
TransformManager* tm = (TransformManager*) nativeTransformManager;
|
||||||
|
return (jboolean)tm->isAccurateTranslationsEnabled();
|
||||||
|
}
|
||||||
|
|||||||
@@ -32,33 +32,40 @@ using namespace filament::math;
|
|||||||
using namespace backend;
|
using namespace backend;
|
||||||
|
|
||||||
extern "C" JNIEXPORT jlong JNICALL
|
extern "C" JNIEXPORT jlong JNICALL
|
||||||
Java_com_google_android_filament_VertexBuffer_nCreateBuilder(JNIEnv *env, jclass type) {
|
Java_com_google_android_filament_VertexBuffer_nCreateBuilder(JNIEnv*, jclass) {
|
||||||
return (jlong) new VertexBuffer::Builder();
|
return (jlong) new VertexBuffer::Builder();
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" JNIEXPORT void JNICALL
|
extern "C" JNIEXPORT void JNICALL
|
||||||
Java_com_google_android_filament_VertexBuffer_nDestroyBuilder(JNIEnv *env, jclass type,
|
Java_com_google_android_filament_VertexBuffer_nDestroyBuilder(JNIEnv*, jclass,
|
||||||
jlong nativeBuilder) {
|
jlong nativeBuilder) {
|
||||||
VertexBuffer::Builder* builder = (VertexBuffer::Builder *) nativeBuilder;
|
VertexBuffer::Builder* builder = (VertexBuffer::Builder *) nativeBuilder;
|
||||||
delete builder;
|
delete builder;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" JNIEXPORT void JNICALL
|
extern "C" JNIEXPORT void JNICALL
|
||||||
Java_com_google_android_filament_VertexBuffer_nBuilderVertexCount(JNIEnv *env, jclass type,
|
Java_com_google_android_filament_VertexBuffer_nBuilderVertexCount(JNIEnv*, jclass,
|
||||||
jlong nativeBuilder, jint vertexCount) {
|
jlong nativeBuilder, jint vertexCount) {
|
||||||
VertexBuffer::Builder* builder = (VertexBuffer::Builder *) nativeBuilder;
|
VertexBuffer::Builder* builder = (VertexBuffer::Builder *) nativeBuilder;
|
||||||
builder->vertexCount((uint32_t) vertexCount);
|
builder->vertexCount((uint32_t) vertexCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" JNIEXPORT void JNICALL
|
extern "C" JNIEXPORT void JNICALL
|
||||||
Java_com_google_android_filament_VertexBuffer_nBuilderBufferCount(JNIEnv *env, jclass type,
|
Java_com_google_android_filament_VertexBuffer_nBuilderEnableBufferObjects(JNIEnv*, jclass,
|
||||||
|
jlong nativeBuilder, jboolean enabled) {
|
||||||
|
VertexBuffer::Builder* builder = (VertexBuffer::Builder *) nativeBuilder;
|
||||||
|
builder->enableBufferObjects(enabled);
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT void JNICALL
|
||||||
|
Java_com_google_android_filament_VertexBuffer_nBuilderBufferCount(JNIEnv*, jclass,
|
||||||
jlong nativeBuilder, jint bufferCount) {
|
jlong nativeBuilder, jint bufferCount) {
|
||||||
VertexBuffer::Builder* builder = (VertexBuffer::Builder *) nativeBuilder;
|
VertexBuffer::Builder* builder = (VertexBuffer::Builder *) nativeBuilder;
|
||||||
builder->bufferCount((uint8_t) bufferCount);
|
builder->bufferCount((uint8_t) bufferCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" JNIEXPORT void JNICALL
|
extern "C" JNIEXPORT void JNICALL
|
||||||
Java_com_google_android_filament_VertexBuffer_nBuilderAttribute(JNIEnv *env, jclass type,
|
Java_com_google_android_filament_VertexBuffer_nBuilderAttribute(JNIEnv*, jclass,
|
||||||
jlong nativeBuilder, jint attribute, jint bufferIndex, jint attributeType, jint byteOffset,
|
jlong nativeBuilder, jint attribute, jint bufferIndex, jint attributeType, jint byteOffset,
|
||||||
jint byteStride) {
|
jint byteStride) {
|
||||||
VertexBuffer::Builder* builder = (VertexBuffer::Builder *) nativeBuilder;
|
VertexBuffer::Builder* builder = (VertexBuffer::Builder *) nativeBuilder;
|
||||||
@@ -68,14 +75,14 @@ Java_com_google_android_filament_VertexBuffer_nBuilderAttribute(JNIEnv *env, jcl
|
|||||||
}
|
}
|
||||||
|
|
||||||
extern "C" JNIEXPORT void JNICALL
|
extern "C" JNIEXPORT void JNICALL
|
||||||
Java_com_google_android_filament_VertexBuffer_nBuilderNormalized(JNIEnv *env, jclass type,
|
Java_com_google_android_filament_VertexBuffer_nBuilderNormalized(JNIEnv*, jclass,
|
||||||
jlong nativeBuilder, jint attribute, jboolean normalized) {
|
jlong nativeBuilder, jint attribute, jboolean normalized) {
|
||||||
VertexBuffer::Builder* builder = (VertexBuffer::Builder *) nativeBuilder;
|
VertexBuffer::Builder* builder = (VertexBuffer::Builder *) nativeBuilder;
|
||||||
builder->normalized((VertexAttribute) attribute, normalized);
|
builder->normalized((VertexAttribute) attribute, normalized);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" JNIEXPORT jlong JNICALL
|
extern "C" JNIEXPORT jlong JNICALL
|
||||||
Java_com_google_android_filament_VertexBuffer_nBuilderBuild(JNIEnv *env, jclass type,
|
Java_com_google_android_filament_VertexBuffer_nBuilderBuild(JNIEnv*, jclass,
|
||||||
jlong nativeBuilder, jlong nativeEngine) {
|
jlong nativeBuilder, jlong nativeEngine) {
|
||||||
VertexBuffer::Builder* builder = (VertexBuffer::Builder *) nativeBuilder;
|
VertexBuffer::Builder* builder = (VertexBuffer::Builder *) nativeBuilder;
|
||||||
Engine *engine = (Engine *) nativeEngine;
|
Engine *engine = (Engine *) nativeEngine;
|
||||||
@@ -83,14 +90,14 @@ Java_com_google_android_filament_VertexBuffer_nBuilderBuild(JNIEnv *env, jclass
|
|||||||
}
|
}
|
||||||
|
|
||||||
extern "C" JNIEXPORT jint JNICALL
|
extern "C" JNIEXPORT jint JNICALL
|
||||||
Java_com_google_android_filament_VertexBuffer_nGetVertexCount(JNIEnv *env, jclass type,
|
Java_com_google_android_filament_VertexBuffer_nGetVertexCount(JNIEnv*, jclass,
|
||||||
jlong nativeVertexBuffer) {
|
jlong nativeVertexBuffer) {
|
||||||
VertexBuffer *vertexBuffer = (VertexBuffer *) nativeVertexBuffer;
|
VertexBuffer *vertexBuffer = (VertexBuffer *) nativeVertexBuffer;
|
||||||
return (jint) vertexBuffer->getVertexCount();
|
return (jint) vertexBuffer->getVertexCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" JNIEXPORT jint JNICALL
|
extern "C" JNIEXPORT jint JNICALL
|
||||||
Java_com_google_android_filament_VertexBuffer_nSetBufferAt(JNIEnv *env, jclass type,
|
Java_com_google_android_filament_VertexBuffer_nSetBufferAt(JNIEnv *env, jclass,
|
||||||
jlong nativeVertexBuffer, jlong nativeEngine, jint bufferIndex,
|
jlong nativeVertexBuffer, jlong nativeEngine, jint bufferIndex,
|
||||||
jobject buffer, jint remaining,
|
jobject buffer, jint remaining,
|
||||||
jint destOffsetInBytes, jint count, jobject handler, jobject runnable) {
|
jint destOffsetInBytes, jint count, jobject handler, jobject runnable) {
|
||||||
@@ -107,7 +114,8 @@ Java_com_google_android_filament_VertexBuffer_nSetBufferAt(JNIEnv *env, jclass t
|
|||||||
|
|
||||||
auto* callback = JniBufferCallback::make(engine, env, handler, runnable, std::move(nioBuffer));
|
auto* callback = JniBufferCallback::make(engine, env, handler, runnable, std::move(nioBuffer));
|
||||||
|
|
||||||
BufferDescriptor desc(data, sizeInBytes, &JniBufferCallback::invoke, callback);
|
BufferDescriptor desc(data, sizeInBytes,
|
||||||
|
callback->getHandler(), &JniBufferCallback::postToJavaAndDestroy, callback);
|
||||||
|
|
||||||
vertexBuffer->setBufferAt(*engine, (uint8_t) bufferIndex, std::move(desc),
|
vertexBuffer->setBufferAt(*engine, (uint8_t) bufferIndex, std::move(desc),
|
||||||
(uint32_t) destOffsetInBytes);
|
(uint32_t) destOffsetInBytes);
|
||||||
@@ -115,42 +123,11 @@ Java_com_google_android_filament_VertexBuffer_nSetBufferAt(JNIEnv *env, jclass t
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" [[deprecated]] JNIEXPORT void JNICALL
|
extern "C" JNIEXPORT void JNICALL
|
||||||
Java_com_google_android_filament_VertexBuffer_nPopulateTangentQuaternions(JNIEnv *env,
|
Java_com_google_android_filament_VertexBuffer_nSetBufferObjectAt(JNIEnv*, jclass,
|
||||||
jclass type, jint quatType, jint quatCount, jobject outBuffer, jint outRemaining,
|
jlong nativeVertexBuffer, jlong nativeEngine, jint bufferIndex, jlong nativeBufferObject) {
|
||||||
jint outStride, jobject normals, jint normalsRemaining, jint normalsStride,
|
VertexBuffer *vertexBuffer = (VertexBuffer *) nativeVertexBuffer;
|
||||||
jobject tangents, jint tangentsRemaining, jint tangentsStride) {
|
Engine *engine = (Engine *) nativeEngine;
|
||||||
|
BufferObject *bufferObject = (BufferObject *) nativeBufferObject;
|
||||||
AutoBuffer outNioBuffer(env, outBuffer, outRemaining, true);
|
vertexBuffer->setBufferObjectAt(*engine, (uint8_t) bufferIndex, bufferObject);
|
||||||
void* outData = outNioBuffer.getData();
|
|
||||||
|
|
||||||
AutoBuffer normalsNioBuffer(env, normals, normalsRemaining);
|
|
||||||
auto normalsData = (const float3*) normalsNioBuffer.getData();
|
|
||||||
|
|
||||||
if (tangents) {
|
|
||||||
AutoBuffer tangentsNioBuffer(env, tangents, tangentsRemaining);
|
|
||||||
auto tangentsData = (const float4*) tangentsNioBuffer.getData();
|
|
||||||
VertexBuffer::populateTangentQuaternions({
|
|
||||||
.quatType = (VertexBuffer::QuatType) quatType,
|
|
||||||
.quatCount = (size_t) quatCount,
|
|
||||||
.outBuffer = outData,
|
|
||||||
.outStride = (size_t) outStride,
|
|
||||||
.normals = normalsData,
|
|
||||||
.normalsStride = (size_t) normalsStride,
|
|
||||||
.tangents = tangentsData,
|
|
||||||
.tangentsStride = (size_t) tangentsStride
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
VertexBuffer::populateTangentQuaternions({
|
|
||||||
.quatType = (VertexBuffer::QuatType) quatType,
|
|
||||||
.quatCount = (size_t) quatCount,
|
|
||||||
.outBuffer = outData,
|
|
||||||
.outStride = (size_t) outStride,
|
|
||||||
.normals = normalsData,
|
|
||||||
.normalsStride = (size_t) normalsStride,
|
|
||||||
.tangents = nullptr,
|
|
||||||
.tangentsStride = 0
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,6 +20,10 @@
|
|||||||
#include <filament/View.h>
|
#include <filament/View.h>
|
||||||
#include <filament/Viewport.h>
|
#include <filament/Viewport.h>
|
||||||
|
|
||||||
|
#include "common/CallbackUtils.h"
|
||||||
|
|
||||||
|
#include "private/backend/VirtualMachineEnv.h"
|
||||||
|
|
||||||
using namespace filament;
|
using namespace filament;
|
||||||
|
|
||||||
extern "C" JNIEXPORT void JNICALL
|
extern "C" JNIEXPORT void JNICALL
|
||||||
@@ -82,13 +86,19 @@ Java_com_google_android_filament_View_nSetRenderTarget(JNIEnv*, jclass,
|
|||||||
extern "C" JNIEXPORT void JNICALL
|
extern "C" JNIEXPORT void JNICALL
|
||||||
Java_com_google_android_filament_View_nSetSampleCount(JNIEnv*, jclass, jlong nativeView, jint count) {
|
Java_com_google_android_filament_View_nSetSampleCount(JNIEnv*, jclass, jlong nativeView, jint count) {
|
||||||
View* view = (View*) nativeView;
|
View* view = (View*) nativeView;
|
||||||
|
#pragma clang diagnostic push
|
||||||
|
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||||
view->setSampleCount((uint8_t) count);
|
view->setSampleCount((uint8_t) count);
|
||||||
|
#pragma clang diagnostic pop
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" JNIEXPORT jint JNICALL
|
extern "C" JNIEXPORT jint JNICALL
|
||||||
Java_com_google_android_filament_View_nGetSampleCount(JNIEnv*, jclass, jlong nativeView) {
|
Java_com_google_android_filament_View_nGetSampleCount(JNIEnv*, jclass, jlong nativeView) {
|
||||||
View* view = (View*) nativeView;
|
View* view = (View*) nativeView;
|
||||||
|
#pragma clang diagnostic push
|
||||||
|
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||||
return view->getSampleCount();
|
return view->getSampleCount();
|
||||||
|
#pragma clang diagnostic pop
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" JNIEXPORT void JNICALL
|
extern "C" JNIEXPORT void JNICALL
|
||||||
@@ -119,13 +129,14 @@ Java_com_google_android_filament_View_nGetDithering(JNIEnv*, jclass,
|
|||||||
extern "C" JNIEXPORT void JNICALL
|
extern "C" JNIEXPORT void JNICALL
|
||||||
Java_com_google_android_filament_View_nSetDynamicResolutionOptions(JNIEnv*, jclass, jlong nativeView,
|
Java_com_google_android_filament_View_nSetDynamicResolutionOptions(JNIEnv*, jclass, jlong nativeView,
|
||||||
jboolean enabled, jboolean homogeneousScaling,
|
jboolean enabled, jboolean homogeneousScaling,
|
||||||
jfloat minScale, jfloat maxScale, jint quality) {
|
jfloat minScale, jfloat maxScale, jfloat sharpness, jint quality) {
|
||||||
View* view = (View*)nativeView;
|
View* view = (View*)nativeView;
|
||||||
View::DynamicResolutionOptions options;
|
View::DynamicResolutionOptions options;
|
||||||
options.enabled = enabled;
|
options.enabled = enabled;
|
||||||
options.homogeneousScaling = homogeneousScaling;
|
options.homogeneousScaling = homogeneousScaling;
|
||||||
options.minScale = filament::math::float2{ minScale };
|
options.minScale = filament::math::float2{ minScale };
|
||||||
options.maxScale = filament::math::float2{ maxScale };
|
options.maxScale = filament::math::float2{ maxScale };
|
||||||
|
options.sharpness = sharpness;
|
||||||
options.quality = (View::QualityLevel)quality;
|
options.quality = (View::QualityLevel)quality;
|
||||||
view->setDynamicResolutionOptions(options);
|
view->setDynamicResolutionOptions(options);
|
||||||
}
|
}
|
||||||
@@ -138,13 +149,28 @@ Java_com_google_android_filament_View_nSetShadowType(JNIEnv*, jclass, jlong nati
|
|||||||
|
|
||||||
extern "C" JNIEXPORT void JNICALL
|
extern "C" JNIEXPORT void JNICALL
|
||||||
Java_com_google_android_filament_View_nSetVsmShadowOptions(JNIEnv*, jclass, jlong nativeView,
|
Java_com_google_android_filament_View_nSetVsmShadowOptions(JNIEnv*, jclass, jlong nativeView,
|
||||||
jint anisotropy) {
|
jint anisotropy, jboolean mipmapping, jboolean highPrecision, jfloat minVarianceScale,
|
||||||
|
jfloat lightBleedReduction) {
|
||||||
View* view = (View*) nativeView;
|
View* view = (View*) nativeView;
|
||||||
View::VsmShadowOptions options;
|
View::VsmShadowOptions options;
|
||||||
options.anisotropy = (uint8_t) anisotropy;
|
options.anisotropy = (uint8_t)anisotropy;
|
||||||
|
options.mipmapping = (bool)mipmapping;
|
||||||
|
options.highPrecision = (bool)highPrecision;
|
||||||
|
options.minVarianceScale = minVarianceScale;
|
||||||
|
options.lightBleedReduction = lightBleedReduction;
|
||||||
view->setVsmShadowOptions(options);
|
view->setVsmShadowOptions(options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT void JNICALL
|
||||||
|
Java_com_google_android_filament_View_nSetSoftShadowOptions(JNIEnv*, jclass, jlong nativeView,
|
||||||
|
jfloat penumbraScale, jfloat penumbraRatioScale) {
|
||||||
|
View* view = (View*) nativeView;
|
||||||
|
View::SoftShadowOptions options;
|
||||||
|
options.penumbraScale = penumbraScale;
|
||||||
|
options.penumbraRatioScale = penumbraRatioScale;
|
||||||
|
view->setSoftShadowOptions(options);
|
||||||
|
}
|
||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
JNIEXPORT void JNICALL
|
JNIEXPORT void JNICALL
|
||||||
Java_com_google_android_filament_View_nSetRenderQuality(JNIEnv*, jclass,
|
Java_com_google_android_filament_View_nSetRenderQuality(JNIEnv*, jclass,
|
||||||
@@ -211,7 +237,9 @@ Java_com_google_android_filament_View_nGetAmbientOcclusion(JNIEnv*, jclass, jlon
|
|||||||
extern "C" JNIEXPORT void JNICALL
|
extern "C" JNIEXPORT void JNICALL
|
||||||
Java_com_google_android_filament_View_nSetAmbientOcclusionOptions(JNIEnv*, jclass,
|
Java_com_google_android_filament_View_nSetAmbientOcclusionOptions(JNIEnv*, jclass,
|
||||||
jlong nativeView, jfloat radius, jfloat bias, jfloat power, jfloat resolution, jfloat intensity,
|
jlong nativeView, jfloat radius, jfloat bias, jfloat power, jfloat resolution, jfloat intensity,
|
||||||
jint quality, jint lowPassFilter, jint upsampling, jboolean enabled, jfloat minHorizonAngleRad) {
|
jfloat bilateralThreshold,
|
||||||
|
jint quality, jint lowPassFilter, jint upsampling, jboolean enabled, jboolean bentNormals,
|
||||||
|
jfloat minHorizonAngleRad) {
|
||||||
View* view = (View*) nativeView;
|
View* view = (View*) nativeView;
|
||||||
View::AmbientOcclusionOptions options = view->getAmbientOcclusionOptions();
|
View::AmbientOcclusionOptions options = view->getAmbientOcclusionOptions();
|
||||||
options.radius = radius;
|
options.radius = radius;
|
||||||
@@ -219,10 +247,12 @@ Java_com_google_android_filament_View_nSetAmbientOcclusionOptions(JNIEnv*, jclas
|
|||||||
options.bias = bias;
|
options.bias = bias;
|
||||||
options.resolution = resolution;
|
options.resolution = resolution;
|
||||||
options.intensity = intensity;
|
options.intensity = intensity;
|
||||||
|
options.bilateralThreshold = bilateralThreshold;
|
||||||
options.quality = (View::QualityLevel)quality;
|
options.quality = (View::QualityLevel)quality;
|
||||||
options.lowPassFilter = (View::QualityLevel)lowPassFilter;
|
options.lowPassFilter = (View::QualityLevel)lowPassFilter;
|
||||||
options.upsampling = (View::QualityLevel)upsampling;
|
options.upsampling = (View::QualityLevel)upsampling;
|
||||||
options.enabled = (bool)enabled;
|
options.enabled = (bool)enabled;
|
||||||
|
options.bentNormals = (bool)bentNormals;
|
||||||
options.minHorizonAngleRad = minHorizonAngleRad;
|
options.minHorizonAngleRad = minHorizonAngleRad;
|
||||||
view->setAmbientOcclusionOptions(options);
|
view->setAmbientOcclusionOptions(options);
|
||||||
}
|
}
|
||||||
@@ -230,14 +260,14 @@ Java_com_google_android_filament_View_nSetAmbientOcclusionOptions(JNIEnv*, jclas
|
|||||||
|
|
||||||
extern "C" JNIEXPORT void JNICALL
|
extern "C" JNIEXPORT void JNICALL
|
||||||
Java_com_google_android_filament_View_nSetSSCTOptions(JNIEnv *, jclass, jlong nativeView,
|
Java_com_google_android_filament_View_nSetSSCTOptions(JNIEnv *, jclass, jlong nativeView,
|
||||||
jfloat ssctLightConeRad, jfloat ssctStartTraceDistance, jfloat ssctContactDistanceMax,
|
jfloat ssctLightConeRad, jfloat ssctShadowDistance, jfloat ssctContactDistanceMax,
|
||||||
jfloat ssctIntensity, jfloat ssctLightDirX, jfloat ssctLightDirY, jfloat ssctLightDirZ,
|
jfloat ssctIntensity, jfloat ssctLightDirX, jfloat ssctLightDirY, jfloat ssctLightDirZ,
|
||||||
jfloat ssctDepthBias, jfloat ssctDepthSlopeBias, jint ssctSampleCount,
|
jfloat ssctDepthBias, jfloat ssctDepthSlopeBias, jint ssctSampleCount,
|
||||||
jint ssctRayCount, jboolean ssctEnabled) {
|
jint ssctRayCount, jboolean ssctEnabled) {
|
||||||
View* view = (View*) nativeView;
|
View* view = (View*) nativeView;
|
||||||
View::AmbientOcclusionOptions options = view->getAmbientOcclusionOptions();
|
View::AmbientOcclusionOptions options = view->getAmbientOcclusionOptions();
|
||||||
options.ssct.lightConeRad = ssctLightConeRad;
|
options.ssct.lightConeRad = ssctLightConeRad;
|
||||||
options.ssct.shadowDistance = ssctStartTraceDistance;
|
options.ssct.shadowDistance = ssctShadowDistance;
|
||||||
options.ssct.contactDistanceMax = ssctContactDistanceMax;
|
options.ssct.contactDistanceMax = ssctContactDistanceMax;
|
||||||
options.ssct.intensity = ssctIntensity;
|
options.ssct.intensity = ssctIntensity;
|
||||||
options.ssct.lightDirection = math::float3{ ssctLightDirX, ssctLightDirY, ssctLightDirZ };
|
options.ssct.lightDirection = math::float3{ ssctLightDirX, ssctLightDirY, ssctLightDirZ };
|
||||||
@@ -253,7 +283,10 @@ extern "C" JNIEXPORT void JNICALL
|
|||||||
Java_com_google_android_filament_View_nSetBloomOptions(JNIEnv*, jclass,
|
Java_com_google_android_filament_View_nSetBloomOptions(JNIEnv*, jclass,
|
||||||
jlong nativeView, jlong nativeTexture,
|
jlong nativeView, jlong nativeTexture,
|
||||||
jfloat dirtStrength, jfloat strength, jint resolution, jfloat anamorphism, jint levels,
|
jfloat dirtStrength, jfloat strength, jint resolution, jfloat anamorphism, jint levels,
|
||||||
jint blendMode, jboolean threshold, jboolean enabled, jfloat highlight) {
|
jint blendMode, jboolean threshold, jboolean enabled, jfloat highlight,
|
||||||
|
jboolean lensFlare, jboolean starburst, jfloat chromaticAberration, jint ghostCount,
|
||||||
|
jfloat ghostSpacing, jfloat ghostThreshold, jfloat haloThickness, jfloat haloRadius,
|
||||||
|
jfloat haloThreshold) {
|
||||||
View* view = (View*) nativeView;
|
View* view = (View*) nativeView;
|
||||||
Texture* dirt = (Texture*) nativeTexture;
|
Texture* dirt = (Texture*) nativeTexture;
|
||||||
View::BloomOptions options = {
|
View::BloomOptions options = {
|
||||||
@@ -266,19 +299,30 @@ Java_com_google_android_filament_View_nSetBloomOptions(JNIEnv*, jclass,
|
|||||||
.blendMode = (View::BloomOptions::BlendMode)blendMode,
|
.blendMode = (View::BloomOptions::BlendMode)blendMode,
|
||||||
.threshold = (bool)threshold,
|
.threshold = (bool)threshold,
|
||||||
.enabled = (bool)enabled,
|
.enabled = (bool)enabled,
|
||||||
.highlight = highlight
|
.highlight = highlight,
|
||||||
|
.lensFlare = (bool)lensFlare,
|
||||||
|
.starburst = (bool)starburst,
|
||||||
|
.chromaticAberration = chromaticAberration,
|
||||||
|
.ghostCount = (uint8_t)ghostCount,
|
||||||
|
.ghostSpacing = ghostSpacing,
|
||||||
|
.ghostThreshold = ghostThreshold,
|
||||||
|
.haloThickness = haloThickness,
|
||||||
|
.haloRadius = haloRadius,
|
||||||
|
.haloThreshold = haloThreshold
|
||||||
};
|
};
|
||||||
view->setBloomOptions(options);
|
view->setBloomOptions(options);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" JNIEXPORT void JNICALL
|
extern "C" JNIEXPORT void JNICALL
|
||||||
Java_com_google_android_filament_View_nSetFogOptions(JNIEnv *, jclass , jlong nativeView,
|
Java_com_google_android_filament_View_nSetFogOptions(JNIEnv *, jclass , jlong nativeView,
|
||||||
jfloat distance, jfloat maximumOpacity, jfloat height, jfloat heightFalloff, jfloat r,
|
jfloat distance, jfloat maximumOpacity, jfloat height, jfloat heightFalloff, jfloat cutOffDistance,
|
||||||
jfloat g, jfloat b, jfloat density, jfloat inScatteringStart,
|
jfloat r, jfloat g, jfloat b, jfloat density, jfloat inScatteringStart,
|
||||||
jfloat inScatteringSize, jboolean fogColorFromIbl, jboolean enabled) {
|
jfloat inScatteringSize, jboolean fogColorFromIbl, jlong skyColorNativeObject, jboolean enabled) {
|
||||||
View* view = (View*) nativeView;
|
View* view = (View*) nativeView;
|
||||||
|
Texture* skyColor = (Texture*) skyColorNativeObject;
|
||||||
View::FogOptions options = {
|
View::FogOptions options = {
|
||||||
.distance = distance,
|
.distance = distance,
|
||||||
|
.cutOffDistance = cutOffDistance,
|
||||||
.maximumOpacity = maximumOpacity,
|
.maximumOpacity = maximumOpacity,
|
||||||
.height = height,
|
.height = height,
|
||||||
.heightFalloff = heightFalloff,
|
.heightFalloff = heightFalloff,
|
||||||
@@ -287,6 +331,7 @@ Java_com_google_android_filament_View_nSetFogOptions(JNIEnv *, jclass , jlong na
|
|||||||
.inScatteringStart = inScatteringStart,
|
.inScatteringStart = inScatteringStart,
|
||||||
.inScatteringSize = inScatteringSize,
|
.inScatteringSize = inScatteringSize,
|
||||||
.fogColorFromIbl = (bool)fogColorFromIbl,
|
.fogColorFromIbl = (bool)fogColorFromIbl,
|
||||||
|
.skyColor = skyColor,
|
||||||
.enabled = (bool)enabled
|
.enabled = (bool)enabled
|
||||||
};
|
};
|
||||||
view->setFogOptions(options);
|
view->setFogOptions(options);
|
||||||
@@ -299,11 +344,25 @@ Java_com_google_android_filament_View_nSetBlendMode(JNIEnv *, jclass , jlong nat
|
|||||||
}
|
}
|
||||||
|
|
||||||
extern "C" JNIEXPORT void JNICALL
|
extern "C" JNIEXPORT void JNICALL
|
||||||
Java_com_google_android_filament_View_nSetDepthOfFieldOptions(JNIEnv *, jclass ,
|
Java_com_google_android_filament_View_nSetDepthOfFieldOptions(JNIEnv *, jclass,
|
||||||
jlong nativeView, jfloat focusDistance, jfloat cocScale, jfloat maxApertureDiameter, jboolean enabled) {
|
jlong nativeView, jfloat cocScale, jfloat maxApertureDiameter, jboolean enabled, jint filter,
|
||||||
|
jboolean nativeResolution, jint foregroundRingCount, jint backgroundRingCount, jint fastGatherRingCount,
|
||||||
|
jint maxForegroundCOC, jint maxBackgroundCOC) {
|
||||||
View* view = (View*) nativeView;
|
View* view = (View*) nativeView;
|
||||||
view->setDepthOfFieldOptions({.focusDistance = focusDistance, .cocScale = cocScale,
|
View::DepthOfFieldOptions::Filter eFilter{};
|
||||||
.maxApertureDiameter = maxApertureDiameter, .enabled = (bool)enabled});
|
if (filter == 1) {
|
||||||
|
// View::DepthOfFieldOptions::Filter::MEDIAN value is actually 2
|
||||||
|
eFilter = View::DepthOfFieldOptions::Filter::MEDIAN;
|
||||||
|
}
|
||||||
|
view->setDepthOfFieldOptions({.cocScale = cocScale,
|
||||||
|
.maxApertureDiameter = maxApertureDiameter, .enabled = (bool)enabled, .filter = eFilter,
|
||||||
|
.nativeResolution = (bool)nativeResolution,
|
||||||
|
.foregroundRingCount = (uint8_t)foregroundRingCount,
|
||||||
|
.backgroundRingCount = (uint8_t)backgroundRingCount,
|
||||||
|
.fastGatherRingCount = (uint8_t)fastGatherRingCount,
|
||||||
|
.maxForegroundCOC = (uint8_t)maxForegroundCOC,
|
||||||
|
.maxBackgroundCOC = (uint8_t)maxBackgroundCOC,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
@@ -315,6 +374,17 @@ Java_com_google_android_filament_View_nSetVignetteOptions(JNIEnv*, jclass, jlong
|
|||||||
.color = LinearColorA{r, g, b, a}, .enabled = (bool)enabled});
|
.color = LinearColorA{r, g, b, a}, .enabled = (bool)enabled});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C"
|
||||||
|
JNIEXPORT void JNICALL
|
||||||
|
Java_com_google_android_filament_View_nSetMultiSampleAntiAliasingOptions(JNIEnv* env, jclass clazz,
|
||||||
|
jlong nativeView, jboolean enabled, jint sampleCount, jboolean customResolve) {
|
||||||
|
View* view = (View*) nativeView;
|
||||||
|
view->setMultiSampleAntiAliasingOptions({
|
||||||
|
.enabled = (bool)enabled,
|
||||||
|
.sampleCount = (uint8_t)sampleCount,
|
||||||
|
.customResolve = (bool)customResolve});
|
||||||
|
}
|
||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
JNIEXPORT void JNICALL
|
JNIEXPORT void JNICALL
|
||||||
Java_com_google_android_filament_View_nSetTemporalAntiAliasingOptions(JNIEnv *, jclass,
|
Java_com_google_android_filament_View_nSetTemporalAntiAliasingOptions(JNIEnv *, jclass,
|
||||||
@@ -324,6 +394,16 @@ Java_com_google_android_filament_View_nSetTemporalAntiAliasingOptions(JNIEnv *,
|
|||||||
.filterWidth = filterWidth, .feedback = feedback, .enabled = (bool) enabled});
|
.filterWidth = filterWidth, .feedback = feedback, .enabled = (bool) enabled});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C"
|
||||||
|
JNIEXPORT void JNICALL
|
||||||
|
Java_com_google_android_filament_View_nSetScreenSpaceReflectionsOptions(JNIEnv*, jclass,
|
||||||
|
jlong nativeView, jfloat thickness, jfloat bias, jfloat maxDistance, jfloat stride, jboolean enabled) {
|
||||||
|
View* view = (View*) nativeView;
|
||||||
|
view->setScreenSpaceReflectionsOptions({.thickness = thickness, .bias = bias,
|
||||||
|
.maxDistance = maxDistance, .stride = stride, .enabled = (bool) enabled
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
JNIEXPORT jboolean JNICALL
|
JNIEXPORT jboolean JNICALL
|
||||||
Java_com_google_android_filament_View_nIsShadowingEnabled(JNIEnv *, jclass, jlong nativeView) {
|
Java_com_google_android_filament_View_nIsShadowingEnabled(JNIEnv *, jclass, jlong nativeView) {
|
||||||
@@ -346,3 +426,92 @@ Java_com_google_android_filament_View_nIsScreenSpaceRefractionEnabled(JNIEnv *,
|
|||||||
View* view = (View*) nativeView;
|
View* view = (View*) nativeView;
|
||||||
return (jboolean)view->isScreenSpaceRefractionEnabled();
|
return (jboolean)view->isScreenSpaceRefractionEnabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C"
|
||||||
|
JNIEXPORT void JNICALL
|
||||||
|
Java_com_google_android_filament_View_nPick(JNIEnv* env, jclass,
|
||||||
|
jlong nativeView,
|
||||||
|
jint x, jint y, jobject handler, jobject internalCallback) {
|
||||||
|
|
||||||
|
// jniState will be initialized the first time this method is called
|
||||||
|
static const struct JniState {
|
||||||
|
jclass internalOnPickCallbackClass;
|
||||||
|
jfieldID renderableFieldId;
|
||||||
|
jfieldID depthFieldId;
|
||||||
|
jfieldID fragCoordXFieldId;
|
||||||
|
jfieldID fragCoordYFieldId;
|
||||||
|
jfieldID fragCoordZFieldId;
|
||||||
|
explicit JniState(JNIEnv* env) noexcept {
|
||||||
|
internalOnPickCallbackClass = env->FindClass("com/google/android/filament/View$InternalOnPickCallback");
|
||||||
|
renderableFieldId = env->GetFieldID(internalOnPickCallbackClass, "mRenderable", "I");
|
||||||
|
depthFieldId = env->GetFieldID(internalOnPickCallbackClass, "mDepth", "F");
|
||||||
|
fragCoordXFieldId = env->GetFieldID(internalOnPickCallbackClass, "mFragCoordsX", "F");
|
||||||
|
fragCoordYFieldId = env->GetFieldID(internalOnPickCallbackClass, "mFragCoordsY", "F");
|
||||||
|
fragCoordZFieldId = env->GetFieldID(internalOnPickCallbackClass, "mFragCoordsZ", "F");
|
||||||
|
}
|
||||||
|
} jniState(env);
|
||||||
|
|
||||||
|
View* view = (View*) nativeView;
|
||||||
|
JniCallback *callback = JniCallback::make(env, handler, internalCallback);
|
||||||
|
view->pick(x, y, [callback](View::PickingQueryResult const& result) {
|
||||||
|
// this is executed on the backend/service thread
|
||||||
|
jobject obj = callback->getCallbackObject();
|
||||||
|
JNIEnv* env = filament::VirtualMachineEnv::get().getEnvironment();
|
||||||
|
env->SetIntField(obj, jniState.renderableFieldId, (jint)result.renderable.getId());
|
||||||
|
env->SetFloatField(obj, jniState.depthFieldId, result.depth);
|
||||||
|
env->SetFloatField(obj, jniState.fragCoordXFieldId, result.fragCoords.x);
|
||||||
|
env->SetFloatField(obj, jniState.fragCoordYFieldId, result.fragCoords.y);
|
||||||
|
env->SetFloatField(obj, jniState.fragCoordZFieldId, result.fragCoords.z);
|
||||||
|
JniCallback::postToJavaAndDestroy(callback);
|
||||||
|
}, callback->getHandler());
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C"
|
||||||
|
JNIEXPORT void JNICALL
|
||||||
|
Java_com_google_android_filament_View_nSetStencilBufferEnabled(JNIEnv *, jclass, jlong nativeView,
|
||||||
|
jboolean enabled) {
|
||||||
|
View* view = (View*) nativeView;
|
||||||
|
view->setStencilBufferEnabled(enabled);
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C"
|
||||||
|
JNIEXPORT jboolean JNICALL
|
||||||
|
Java_com_google_android_filament_View_nIsStencilBufferEnabled(JNIEnv *, jclass, jlong nativeView) {
|
||||||
|
View* view = (View*) nativeView;
|
||||||
|
return view->isStencilBufferEnabled();
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C"
|
||||||
|
JNIEXPORT void JNICALL
|
||||||
|
Java_com_google_android_filament_View_nSetGuardBandOptions(JNIEnv *, jclass,
|
||||||
|
jlong nativeView, jboolean enabled) {
|
||||||
|
View* view = (View*) nativeView;
|
||||||
|
view->setGuardBandOptions({ .enabled = (bool)enabled });
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C"
|
||||||
|
JNIEXPORT void JNICALL
|
||||||
|
Java_com_google_android_filament_View_nSetMaterialGlobal(JNIEnv * , jclass, jlong nativeView,
|
||||||
|
jint index, jfloat x, jfloat y, jfloat z, jfloat w) {
|
||||||
|
View *view = (View *) nativeView;
|
||||||
|
view->setMaterialGlobal((uint32_t)index, { x, y, z, w });
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C"
|
||||||
|
JNIEXPORT void JNICALL
|
||||||
|
Java_com_google_android_filament_View_nGetMaterialGlobal(JNIEnv *env, jclass clazz,
|
||||||
|
jlong nativeView, jint index, jfloatArray out_) {
|
||||||
|
jfloat* out = env->GetFloatArrayElements(out_, nullptr);
|
||||||
|
View *view = (View *) nativeView;
|
||||||
|
auto result = view->getMaterialGlobal(index);
|
||||||
|
std::copy_n(result.v, 4, out);
|
||||||
|
env->ReleaseFloatArrayElements(out_, out, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C"
|
||||||
|
JNIEXPORT int JNICALL
|
||||||
|
Java_com_google_android_filament_View_nGetFogEntity(JNIEnv *env, jclass clazz,
|
||||||
|
jlong nativeView) {
|
||||||
|
View *view = (View *) nativeView;
|
||||||
|
return (jint)view->getFogEntity().getId();
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,71 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2018 The Android Open Source Project
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
#include <jawt.h>
|
|
||||||
|
|
||||||
#if defined(__has_include)
|
|
||||||
#if __has_include(<darwin/jawt_md.h>)
|
|
||||||
#include <darwin/jawt_md.h>
|
|
||||||
#else
|
|
||||||
#include <jawt_md.h>
|
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
#include <darwin/jawt_md.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <filament/Engine.h>
|
|
||||||
#include "JAWTUtils.h"
|
|
||||||
|
|
||||||
#import <Cocoa/Cocoa.h>
|
|
||||||
|
|
||||||
#pragma clang diagnostic push
|
|
||||||
#pragma ide diagnostic ignored "NotReleasedValue"
|
|
||||||
extern "C" {
|
|
||||||
void *getNativeWindow(JNIEnv *env, jclass klass, jobject surface) {
|
|
||||||
void *win = nullptr;
|
|
||||||
JAWT_DrawingSurface *ds = nullptr;
|
|
||||||
JAWT_DrawingSurfaceInfo *dsi = nullptr;
|
|
||||||
|
|
||||||
if (!acquireDrawingSurface(env, surface, &ds, &dsi)) {
|
|
||||||
return win;
|
|
||||||
}
|
|
||||||
NSObject<JAWT_SurfaceLayers>* jawldsip = (NSObject<JAWT_SurfaceLayers>*)dsi->platformInfo;
|
|
||||||
// Use jawt_DrawingSurfaceInfo.bounds for frame dimension.
|
|
||||||
NSView *view = [[NSView alloc] initWithFrame:
|
|
||||||
NSMakeRect(dsi->bounds.x, dsi->bounds.y, dsi->bounds.width, dsi->bounds.height)];
|
|
||||||
view.wantsLayer = true;
|
|
||||||
[jawldsip setLayer:view.layer];
|
|
||||||
|
|
||||||
win = (void*) view;
|
|
||||||
releaseDrawingSurface(ds, dsi);
|
|
||||||
return win;
|
|
||||||
}
|
|
||||||
|
|
||||||
jlong createNativeSurface(jint width, jint height) {
|
|
||||||
NSView *view = [[NSView alloc] initWithFrame:NSMakeRect(0, 0, width, height)];
|
|
||||||
view.wantsLayer = true;
|
|
||||||
return (jlong) view;
|
|
||||||
}
|
|
||||||
|
|
||||||
void destroyNativeSurface(jlong surface) {
|
|
||||||
NSView *view = reinterpret_cast<NSView*>(surface);
|
|
||||||
[view release];
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
#pragma clang diagnostic pop
|
|
||||||
@@ -1,116 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2018 The Android Open Source Project
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "JAWTUtils.h"
|
|
||||||
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
static std::vector<int> jawtVersions = {
|
|
||||||
0x00010003,
|
|
||||||
0x00010004,
|
|
||||||
0x00010007,
|
|
||||||
0x00010009,
|
|
||||||
};
|
|
||||||
|
|
||||||
#pragma clang diagnostic push
|
|
||||||
#pragma clang diagnostic ignored "-Wuninitialized"
|
|
||||||
bool acquireDrawingSurface(JNIEnv* env, jobject surface,
|
|
||||||
JAWT_DrawingSurface** ods, JAWT_DrawingSurfaceInfo** odsi) {
|
|
||||||
|
|
||||||
JAWT awt;
|
|
||||||
JAWT_DrawingSurface* ds = nullptr;
|
|
||||||
JAWT_DrawingSurfaceInfo* dsi = nullptr;
|
|
||||||
|
|
||||||
// Search for a valid AWT
|
|
||||||
jboolean foundJawt = JNI_FALSE;
|
|
||||||
for (int jawtVersion : jawtVersions) {
|
|
||||||
awt.version = jawtVersion;
|
|
||||||
#if defined(__APPLE__) && defined(__aarch64__)
|
|
||||||
// FIXME: enable Apple Silicon build. The problem here is that we attempt to link an x86 jdk and that fails
|
|
||||||
// so JAWT_GetAWT doesn't exist at link time.
|
|
||||||
#warning "FIXME: JAWT_GetAWT() not supported"
|
|
||||||
foundJawt = {};
|
|
||||||
#else
|
|
||||||
foundJawt = JAWT_GetAWT(env, &awt);
|
|
||||||
#endif
|
|
||||||
if (foundJawt == JNI_TRUE) {
|
|
||||||
#ifndef NDEBUG
|
|
||||||
printf("Found valid AWT v%08x.\n", jawtVersion);
|
|
||||||
#endif
|
|
||||||
break;
|
|
||||||
} else {
|
|
||||||
#ifndef NDEBUG
|
|
||||||
printf("AWT v%08x not present.\n", jawtVersion);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#ifndef NDEBUG
|
|
||||||
fflush(stdout);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (foundJawt == JNI_FALSE) {
|
|
||||||
printf("AWT Not found\n");
|
|
||||||
fflush(stdout);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get the drawing surface
|
|
||||||
ds = awt.GetDrawingSurface(env, surface);
|
|
||||||
if (ds == nullptr) {
|
|
||||||
#ifndef NDEBUG
|
|
||||||
printf("NULL drawing surface\n");
|
|
||||||
fflush(stdout);
|
|
||||||
#endif
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Lock the drawing
|
|
||||||
jint lock = ds->Lock(ds);
|
|
||||||
if ((lock & JAWT_LOCK_ERROR) != 0) {
|
|
||||||
#ifndef NDEBUG
|
|
||||||
printf("Error locking surface\n");
|
|
||||||
fflush(stdout);
|
|
||||||
#endif
|
|
||||||
awt.FreeDrawingSurface(ds);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get the drawing surface info
|
|
||||||
dsi = ds->GetDrawingSurfaceInfo(ds);
|
|
||||||
if (dsi == nullptr) {
|
|
||||||
#ifndef NDEBUG
|
|
||||||
printf("Error getting surface info\n");
|
|
||||||
fflush(stdout);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
ds->Unlock(ds);
|
|
||||||
awt.FreeDrawingSurface(ds);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
*odsi = dsi;
|
|
||||||
*ods = ds;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
#pragma clang diagnostic pop
|
|
||||||
|
|
||||||
void releaseDrawingSurface(JAWT_DrawingSurface* ds, JAWT_DrawingSurfaceInfo* dsi) {
|
|
||||||
// Free the drawing surface info
|
|
||||||
ds->FreeDrawingSurfaceInfo(dsi);
|
|
||||||
// Unlock the drawing surface
|
|
||||||
ds->Unlock(ds);
|
|
||||||
}
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2018 The Android Open Source Project
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <jawt.h>
|
|
||||||
|
|
||||||
extern "C" {
|
|
||||||
bool acquireDrawingSurface(JNIEnv* env, jobject surface, JAWT_DrawingSurface** ods,
|
|
||||||
JAWT_DrawingSurfaceInfo** odsi);
|
|
||||||
void releaseDrawingSurface(JAWT_DrawingSurface* ds, JAWT_DrawingSurfaceInfo* dsi);
|
|
||||||
}
|
|
||||||
@@ -1,90 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2018 The Android Open Source Project
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
#include <jawt.h>
|
|
||||||
#include <linux/jawt_md.h>
|
|
||||||
|
|
||||||
#include "JAWTUtils.h"
|
|
||||||
#include<GL/glx.h>
|
|
||||||
|
|
||||||
extern "C" {
|
|
||||||
void *getNativeWindow(JNIEnv* env, jclass, jobject surface) {
|
|
||||||
void* win = nullptr;
|
|
||||||
JAWT_DrawingSurface* ds = nullptr;
|
|
||||||
JAWT_DrawingSurfaceInfo* dsi = nullptr;
|
|
||||||
|
|
||||||
if (!acquireDrawingSurface(env, surface, &ds, &dsi)) {
|
|
||||||
return win;
|
|
||||||
}
|
|
||||||
JAWT_X11DrawingSurfaceInfo* dsi_x11 = (JAWT_X11DrawingSurfaceInfo*) dsi->platformInfo;
|
|
||||||
|
|
||||||
win = (void*) dsi_x11->drawable;
|
|
||||||
releaseDrawingSurface(ds, dsi);
|
|
||||||
return win;
|
|
||||||
}
|
|
||||||
|
|
||||||
jlong createNativeSurface(jint width, jint height) {
|
|
||||||
Display* display = XOpenDisplay(nullptr);
|
|
||||||
int screen = DefaultScreen(display);
|
|
||||||
Window window = 0;
|
|
||||||
|
|
||||||
#ifndef NDEBUG
|
|
||||||
int major, minor;
|
|
||||||
glXQueryVersion(display, &major, &minor);
|
|
||||||
printf("Using GLX v%d.%d\n", major, minor); fflush(stdout);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static int visualAttributess[] = {
|
|
||||||
GLX_DRAWABLE_TYPE, GLX_WINDOW_BIT,
|
|
||||||
GLX_RENDER_TYPE, GLX_RGBA_BIT,
|
|
||||||
GLX_DOUBLEBUFFER, True,
|
|
||||||
GLX_RED_SIZE, 8,
|
|
||||||
GLX_GREEN_SIZE, 8,
|
|
||||||
GLX_BLUE_SIZE, 8,
|
|
||||||
GLX_DEPTH_SIZE, 24,
|
|
||||||
None
|
|
||||||
};
|
|
||||||
int numConfigs = 0;
|
|
||||||
GLXFBConfig* configs = glXChooseFBConfig( display, screen, visualAttributess, &numConfigs);
|
|
||||||
if (numConfigs == 0) {
|
|
||||||
printf("Unable to find a suitable Framebuffer Configuration.\n"); fflush(stdout);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int pbufferAttributes[] = {
|
|
||||||
GLX_PBUFFER_WIDTH, width,
|
|
||||||
GLX_PBUFFER_HEIGHT, height,
|
|
||||||
None
|
|
||||||
};
|
|
||||||
window = glXCreatePbuffer( display, configs[0], pbufferAttributes );
|
|
||||||
XFree(configs);
|
|
||||||
// Make sure pbuffer creation has not been buffered in the event queue (we need it NOW).
|
|
||||||
XFlush(display);
|
|
||||||
|
|
||||||
// Camouflage the pbuffer as a window which are both XID anyway.
|
|
||||||
return (jlong) window;
|
|
||||||
}
|
|
||||||
|
|
||||||
void destroyNativeSurface(jlong surface) {
|
|
||||||
const char* displayName = nullptr;
|
|
||||||
Display* display = XOpenDisplay(displayName);
|
|
||||||
GLXPbuffer pBuffer = (GLXPbuffer)surface;
|
|
||||||
glXDestroyPbuffer(display, pBuffer);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,67 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2018 The Android Open Source Project
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
#include <jawt.h>
|
|
||||||
#include <win32/jawt_md.h>
|
|
||||||
#include <windows.h>
|
|
||||||
|
|
||||||
#include <utils/unwindows.h>
|
|
||||||
|
|
||||||
#include "JAWTUtils.h"
|
|
||||||
#include <filament/Engine.h>
|
|
||||||
|
|
||||||
extern "C" {
|
|
||||||
|
|
||||||
void* getNativeWindow(JNIEnv* env, jclass, jobject surface) {
|
|
||||||
JAWT_DrawingSurface* ds = nullptr;
|
|
||||||
JAWT_DrawingSurfaceInfo* dsi = nullptr;
|
|
||||||
|
|
||||||
if (!acquireDrawingSurface(env, surface, &ds, &dsi)) {
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
JAWT_Win32DrawingSurfaceInfo* dsi_win32 = (JAWT_Win32DrawingSurfaceInfo*) dsi->platformInfo;
|
|
||||||
HWND hWnd = dsi_win32->hwnd;
|
|
||||||
|
|
||||||
releaseDrawingSurface(ds, dsi);
|
|
||||||
|
|
||||||
return (void*) hWnd;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
jlong createNativeSurface(jint width, jint height) {
|
|
||||||
// We need to adjust the window size so the "client area" matches width and height requested.
|
|
||||||
// Otherwise, the window itself will be of dimension width-height but the "client area" and the
|
|
||||||
// resulting surface will be smaller than requested.
|
|
||||||
RECT dimension = {0, 0, width, height};
|
|
||||||
AdjustWindowRect(&dimension, WS_OVERLAPPEDWINDOW, FALSE);
|
|
||||||
width = dimension.right - dimension.left;
|
|
||||||
height = dimension.bottom - dimension.top;
|
|
||||||
|
|
||||||
HWND window = CreateWindowA("STATIC", "dummy", 0, 0, 0, width, height, NULL, NULL, NULL, NULL);
|
|
||||||
SetWindowLong(window, GWL_STYLE, 0); //remove all window styles
|
|
||||||
|
|
||||||
return (jlong) window;
|
|
||||||
}
|
|
||||||
|
|
||||||
void destroyNativeSurface(jlong surface) {
|
|
||||||
HWND window = (HWND) surface;
|
|
||||||
DestroyWindow(window);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -63,12 +63,27 @@ final class Asserts {
|
|||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NonNull @Size(min = 16)
|
||||||
|
static double[] assertMat4(@Nullable double[] out) {
|
||||||
|
if (out == null) out = new double[16];
|
||||||
|
else if (out.length < 16) {
|
||||||
|
throw new ArrayIndexOutOfBoundsException("Array length must be at least 16");
|
||||||
|
}
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
static void assertMat4fIn(@NonNull @Size(min = 16) float[] in) {
|
static void assertMat4fIn(@NonNull @Size(min = 16) float[] in) {
|
||||||
if (in.length < 16) {
|
if (in.length < 16) {
|
||||||
throw new ArrayIndexOutOfBoundsException("Array length must be at least 16");
|
throw new ArrayIndexOutOfBoundsException("Array length must be at least 16");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void assertMat4In(@NonNull @Size(min = 16) double[] in) {
|
||||||
|
if (in.length < 16) {
|
||||||
|
throw new ArrayIndexOutOfBoundsException("Array length must be at least 16");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@NonNull @Size(min = 3)
|
@NonNull @Size(min = 3)
|
||||||
static float[] assertFloat3(@Nullable float[] out) {
|
static float[] assertFloat3(@Nullable float[] out) {
|
||||||
if (out == null) out = new float[3];
|
if (out == null) out = new float[3];
|
||||||
|
|||||||
@@ -0,0 +1,210 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2021 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.google.android.filament;
|
||||||
|
|
||||||
|
import androidx.annotation.IntRange;
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
|
import java.nio.Buffer;
|
||||||
|
import java.nio.BufferOverflowException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A generic GPU buffer containing data.
|
||||||
|
*
|
||||||
|
* Usage of this BufferObject is optional. For simple use cases it is not necessary. It is useful
|
||||||
|
* only when you need to share data between multiple VertexBuffer instances. It also allows you to
|
||||||
|
* efficiently swap-out the buffers in VertexBuffer.
|
||||||
|
*
|
||||||
|
* NOTE: For now this is only used for vertex data, but in the future we may use it for other things
|
||||||
|
* (e.g. compute).
|
||||||
|
*
|
||||||
|
* @see VertexBuffer
|
||||||
|
*/
|
||||||
|
public class BufferObject {
|
||||||
|
private long mNativeObject;
|
||||||
|
|
||||||
|
private BufferObject(long nativeBufferObject) {
|
||||||
|
mNativeObject = nativeBufferObject;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Builder {
|
||||||
|
@SuppressWarnings({"FieldCanBeLocal", "UnusedDeclaration"})
|
||||||
|
// Keep to finalize native resources
|
||||||
|
private final BuilderFinalizer mFinalizer;
|
||||||
|
private final long mNativeBuilder;
|
||||||
|
|
||||||
|
public enum BindingType {
|
||||||
|
VERTEX,
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder() {
|
||||||
|
mNativeBuilder = nCreateBuilder();
|
||||||
|
mFinalizer = new BuilderFinalizer(mNativeBuilder);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Size of the buffer in bytes.
|
||||||
|
*
|
||||||
|
* @param byteCount Maximum number of bytes the BufferObject can hold.
|
||||||
|
* @return A reference to this Builder for chaining calls.
|
||||||
|
*/
|
||||||
|
@NonNull
|
||||||
|
public Builder size(@IntRange(from = 1) int byteCount) {
|
||||||
|
nBuilderSize(mNativeBuilder, byteCount);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The binding type for this buffer object. (defaults to VERTEX)
|
||||||
|
*
|
||||||
|
* @param bindingType Distinguishes between SSBO, VBO, etc. For now this must be VERTEX.
|
||||||
|
* @return A reference to this Builder for chaining calls.
|
||||||
|
*/
|
||||||
|
@NonNull
|
||||||
|
public Builder bindingType(@NonNull BindingType bindingType) {
|
||||||
|
nBuilderBindingType(mNativeBuilder, bindingType.ordinal());
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates and returns the <code>BufferObject</code> object. After creation, the buffer
|
||||||
|
* is uninitialized. Use {@link #setBuffer} to initialize the <code>BufferObject</code>.
|
||||||
|
*
|
||||||
|
* @param engine reference to the {@link Engine} to associate this <code>BufferObject</code>
|
||||||
|
* with
|
||||||
|
*
|
||||||
|
* @return the newly created <code>BufferObject</code> object
|
||||||
|
*
|
||||||
|
* @exception IllegalStateException if the BufferObject could not be created
|
||||||
|
*
|
||||||
|
* @see #setBuffer
|
||||||
|
*/
|
||||||
|
@NonNull
|
||||||
|
public BufferObject build(@NonNull Engine engine) {
|
||||||
|
long nativeBufferObject = nBuilderBuild(mNativeBuilder, engine.getNativeObject());
|
||||||
|
if (nativeBufferObject == 0)
|
||||||
|
throw new IllegalStateException("Couldn't create BufferObject");
|
||||||
|
return new BufferObject(nativeBufferObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class BuilderFinalizer {
|
||||||
|
private final long mNativeObject;
|
||||||
|
|
||||||
|
BuilderFinalizer(long nativeObject) {
|
||||||
|
mNativeObject = nativeObject;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void finalize() {
|
||||||
|
try {
|
||||||
|
super.finalize();
|
||||||
|
} catch (Throwable t) { // Ignore
|
||||||
|
} finally {
|
||||||
|
nDestroyBuilder(mNativeObject);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the size of this <code>BufferObject</code> in elements.
|
||||||
|
*
|
||||||
|
* @return the number of bytes the <code>BufferObject</code> holds
|
||||||
|
*/
|
||||||
|
@IntRange(from = 0)
|
||||||
|
public int getByteCount() {
|
||||||
|
return nGetByteCount(getNativeObject());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Asynchronously copy-initializes this <code>BufferObject</code> from the data provided.
|
||||||
|
*
|
||||||
|
* @param engine reference to the {@link Engine} to associate this
|
||||||
|
* <code>BufferObject</code> with
|
||||||
|
* @param buffer a CPU-side {@link Buffer} with the data used to initialize the
|
||||||
|
* <code>BufferObject</code>.
|
||||||
|
*/
|
||||||
|
public void setBuffer(@NonNull Engine engine, @NonNull Buffer buffer) {
|
||||||
|
setBuffer(engine, buffer, 0, 0, null, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Asynchronously copy-initializes a region of this <code>BufferObject</code> from the data
|
||||||
|
* provided.
|
||||||
|
*
|
||||||
|
* @param engine reference to the {@link Engine} to associate this
|
||||||
|
* <code>BufferObject</code> with
|
||||||
|
* @param buffer a CPU-side {@link Buffer} with the data used to initialize the
|
||||||
|
* <code>BufferObject</code>.
|
||||||
|
* @param destOffsetInBytes offset in <i>bytes</i> into the <code>BufferObject</code>
|
||||||
|
* @param count number of bytes to consume, defaults to
|
||||||
|
* <code>buffer.remaining()</code>
|
||||||
|
*/
|
||||||
|
public void setBuffer(@NonNull Engine engine, @NonNull Buffer buffer,
|
||||||
|
@IntRange(from = 0) int destOffsetInBytes, @IntRange(from = 0) int count) {
|
||||||
|
setBuffer(engine, buffer, destOffsetInBytes, count, null, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Asynchronously copy-initializes a region of this <code>BufferObject</code> from the data
|
||||||
|
* provided.
|
||||||
|
*
|
||||||
|
* @param engine reference to the {@link Engine} to associate this
|
||||||
|
* <code>BufferObject</code> with
|
||||||
|
* @param buffer a CPU-side {@link Buffer} with the data used to initialize the
|
||||||
|
* <code>BufferObject</code>.
|
||||||
|
* @param destOffsetInBytes offset in <i>bytes</i> into the <code>BufferObject</code>
|
||||||
|
* @param count number of bytes to consume, defaults to
|
||||||
|
* <code>buffer.remaining()</code>
|
||||||
|
* @param handler an {@link java.util.concurrent.Executor Executor}. On Android this
|
||||||
|
* can also be a {@link android.os.Handler Handler}.
|
||||||
|
* @param callback a callback executed by <code>handler</code> when <code>buffer</code>
|
||||||
|
* is no longer needed.
|
||||||
|
*/
|
||||||
|
public void setBuffer(@NonNull Engine engine, @NonNull Buffer buffer,
|
||||||
|
@IntRange(from = 0) int destOffsetInBytes, @IntRange(from = 0) int count,
|
||||||
|
@Nullable Object handler, @Nullable Runnable callback) {
|
||||||
|
int result = nSetBuffer(getNativeObject(), engine.getNativeObject(), buffer, buffer.remaining(),
|
||||||
|
destOffsetInBytes, count == 0 ? buffer.remaining() : count, handler, callback);
|
||||||
|
if (result < 0) {
|
||||||
|
throw new BufferOverflowException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getNativeObject() {
|
||||||
|
if (mNativeObject == 0) {
|
||||||
|
throw new IllegalStateException("Calling method on destroyed BufferObject");
|
||||||
|
}
|
||||||
|
return mNativeObject;
|
||||||
|
}
|
||||||
|
|
||||||
|
void clearNativeObject() {
|
||||||
|
mNativeObject = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static native long nCreateBuilder();
|
||||||
|
private static native void nDestroyBuilder(long nativeBuilder);
|
||||||
|
private static native void nBuilderSize(long nativeBuilder, int byteCount);
|
||||||
|
private static native void nBuilderBindingType(long nativeBuilder, int bindingType);
|
||||||
|
private static native long nBuilderBuild(long nativeBuilder, long nativeEngine);
|
||||||
|
|
||||||
|
private static native int nGetByteCount(long nativeBufferObject);
|
||||||
|
private static native int nSetBuffer(long nativeBufferObject, long nativeEngine,
|
||||||
|
Buffer buffer, int remaining,
|
||||||
|
int destOffsetInBytes, int count, Object handler, Runnable callback);
|
||||||
|
}
|
||||||
@@ -29,7 +29,7 @@ import androidx.annotation.Size;
|
|||||||
*
|
*
|
||||||
* In Filament, Camera is a component that must be associated with an entity. To do so,
|
* In Filament, Camera is a component that must be associated with an entity. To do so,
|
||||||
* use {@link Engine#createCamera(int)}. A Camera component is destroyed using
|
* use {@link Engine#createCamera(int)}. A Camera component is destroyed using
|
||||||
* {@link Engine#destroyCamera(Camera)}.
|
* {@link Engine#destroyCameraComponent(int Entity)} ()}.
|
||||||
*
|
*
|
||||||
* <pre>
|
* <pre>
|
||||||
* Camera myCamera = engine.createCamera(myCameraEntity);
|
* Camera myCamera = engine.createCamera(myCameraEntity);
|
||||||
@@ -37,7 +37,7 @@ import androidx.annotation.Size;
|
|||||||
* myCamera.lookAt(0, 1.60, 1,
|
* myCamera.lookAt(0, 1.60, 1,
|
||||||
* 0, 0, 0,
|
* 0, 0, 0,
|
||||||
* 0, 1, 0);
|
* 0, 1, 0);
|
||||||
* engine.destroyCamera(myCamera);
|
* engine.destroyCameraComponent(myCameraEntity);
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
@@ -121,6 +121,9 @@ import androidx.annotation.Size;
|
|||||||
public class Camera {
|
public class Camera {
|
||||||
private long mNativeObject;
|
private long mNativeObject;
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
private final int mEntity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Denotes the projection type used by this camera.
|
* Denotes the projection type used by this camera.
|
||||||
* @see #setProjection
|
* @see #setProjection
|
||||||
@@ -143,8 +146,9 @@ public class Camera {
|
|||||||
HORIZONTAL
|
HORIZONTAL
|
||||||
}
|
}
|
||||||
|
|
||||||
Camera(long nativeCamera) {
|
Camera(long nativeCamera, @Entity int entity) {
|
||||||
mNativeObject = nativeCamera;
|
mNativeObject = nativeCamera;
|
||||||
|
mEntity = entity;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -248,9 +252,12 @@ public class Camera {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the projection matrix.
|
* Sets a custom projection matrix.
|
||||||
*
|
*
|
||||||
* @param inMatrix custom projection matrix.
|
* <p>The projection matrix must define an NDC system that must match the OpenGL convention,
|
||||||
|
* that is all 3 axis are mapped to [-1, 1].</p>
|
||||||
|
*
|
||||||
|
* @param inProjection custom projection matrix for rendering and culling
|
||||||
*
|
*
|
||||||
* @param near distance in world units from the camera to the near plane.
|
* @param near distance in world units from the camera to the near plane.
|
||||||
* The near plane's position in view space is z = -<code>near</code>.
|
* The near plane's position in view space is z = -<code>near</code>.
|
||||||
@@ -266,10 +273,74 @@ public class Camera {
|
|||||||
* <code>far</code> != <code>near</code>
|
* <code>far</code> != <code>near</code>
|
||||||
* for {@link Projection#ORTHO}.
|
* for {@link Projection#ORTHO}.
|
||||||
*/
|
*/
|
||||||
public void setCustomProjection(@NonNull @Size(min = 16) double[] inMatrix,
|
public void setCustomProjection(@NonNull @Size(min = 16) double[] inProjection,
|
||||||
double near, double far) {
|
double near, double far) {
|
||||||
Asserts.assertMat4dIn(inMatrix);
|
Asserts.assertMat4dIn(inProjection);
|
||||||
nSetCustomProjection(getNativeObject(), inMatrix, near, far);
|
nSetCustomProjection(getNativeObject(), inProjection, inProjection, near, far);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets a custom projection matrix.
|
||||||
|
*
|
||||||
|
* <p>The projection matrices must define an NDC system that must match the OpenGL convention,
|
||||||
|
* that is all 3 axis are mapped to [-1, 1].</p>
|
||||||
|
*
|
||||||
|
* @param inProjection custom projection matrix for rendering.
|
||||||
|
*
|
||||||
|
* @param inProjectionForCulling custom projection matrix for culling.
|
||||||
|
*
|
||||||
|
* @param near distance in world units from the camera to the near plane.
|
||||||
|
* The near plane's position in view space is z = -<code>near</code>.
|
||||||
|
* Precondition:
|
||||||
|
* <code>near</code> > 0 for {@link Projection#PERSPECTIVE} or
|
||||||
|
* <code>near</code> != <code>far</code> for {@link Projection#ORTHO}.
|
||||||
|
*
|
||||||
|
* @param far distance in world units from the camera to the far plane.
|
||||||
|
* The far plane's position in view space is z = -<code>far</code>.
|
||||||
|
* Precondition:
|
||||||
|
* <code>far</code> > <code>near</code>
|
||||||
|
* for {@link Projection#PERSPECTIVE} or
|
||||||
|
* <code>far</code> != <code>near</code>
|
||||||
|
* for {@link Projection#ORTHO}.
|
||||||
|
*/
|
||||||
|
public void setCustomProjection(
|
||||||
|
@NonNull @Size(min = 16) double[] inProjection,
|
||||||
|
@NonNull @Size(min = 16) double[] inProjectionForCulling,
|
||||||
|
double near, double far) {
|
||||||
|
Asserts.assertMat4dIn(inProjection);
|
||||||
|
Asserts.assertMat4dIn(inProjectionForCulling);
|
||||||
|
nSetCustomProjection(getNativeObject(), inProjection, inProjectionForCulling, near, far);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets an additional matrix that scales the projection matrix.
|
||||||
|
*
|
||||||
|
* <p>This is useful to adjust the aspect ratio of the camera independent from its projection.
|
||||||
|
* First, pass an aspect of 1.0 to setProjection. Then set the scaling with the desired aspect
|
||||||
|
* ratio:<br>
|
||||||
|
*
|
||||||
|
* <code>
|
||||||
|
* double aspect = width / height;
|
||||||
|
*
|
||||||
|
* // with Fov.HORIZONTAL passed to setProjection:
|
||||||
|
* camera.setScaling(1.0, aspect);
|
||||||
|
*
|
||||||
|
* // with Fov.VERTICAL passed to setProjection:
|
||||||
|
* camera.setScaling(1.0 / aspect, 1.0);
|
||||||
|
* </code>
|
||||||
|
*
|
||||||
|
* By default, this is an identity matrix.
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @param xscaling horizontal scaling to be applied after the projection matrix.
|
||||||
|
* @param yscaling vertical scaling to be applied after the projection matrix.
|
||||||
|
*
|
||||||
|
* @see Camera#setProjection
|
||||||
|
* @see Camera#setLensProjection
|
||||||
|
* @see Camera#setCustomProjection
|
||||||
|
*/
|
||||||
|
public void setScaling(double xscaling, double yscaling) {
|
||||||
|
nSetScaling(getNativeObject(), xscaling, yscaling);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -294,19 +365,42 @@ public class Camera {
|
|||||||
* By default, this is an identity matrix.
|
* By default, this is an identity matrix.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @param scaling diagonal of the scaling matrix to be applied after the projection matrix.
|
* @param inScaling diagonal of the scaling matrix to be applied after the projection matrix.
|
||||||
|
*
|
||||||
|
* @see Camera#setProjection
|
||||||
|
* @see Camera#setLensProjection
|
||||||
|
* @see Camera#setCustomProjection
|
||||||
|
*
|
||||||
|
* @deprecated use {@link #setScaling(double, double)}
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
public void setScaling(@NonNull @Size(min = 4) double[] inScaling) {
|
||||||
|
Asserts.assertDouble4In(inScaling);
|
||||||
|
setScaling(inScaling[0], inScaling[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets an additional matrix that shifts (translates) the projection matrix.
|
||||||
|
* <p>
|
||||||
|
* The shift parameters are specified in NDC coordinates, that is, if the translation must
|
||||||
|
* be specified in pixels, the xshift and yshift parameters be scaled by 1.0 / viewport.width
|
||||||
|
* and 1.0 / viewport.height respectively.
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @param xshift horizontal shift in NDC coordinates applied after the projection
|
||||||
|
* @param yshift vertical shift in NDC coordinates applied after the projection
|
||||||
*
|
*
|
||||||
* @see Camera#setProjection
|
* @see Camera#setProjection
|
||||||
* @see Camera#setLensProjection
|
* @see Camera#setLensProjection
|
||||||
* @see Camera#setCustomProjection
|
* @see Camera#setCustomProjection
|
||||||
*/
|
*/
|
||||||
public void setScaling(@NonNull @Size(min = 4) double[] inScaling) {
|
public void setShift(double xshift, double yshift) {
|
||||||
Asserts.assertDouble4In(inScaling);
|
nSetShift(getNativeObject(), xshift, yshift);
|
||||||
nSetScaling(getNativeObject(), inScaling);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the camera's view matrix.
|
* Sets the camera's model matrix.
|
||||||
* <p>
|
* <p>
|
||||||
* Helper method to set the camera's entity transform component.
|
* Helper method to set the camera's entity transform component.
|
||||||
* Remember that the Camera "looks" towards its -z axis.
|
* Remember that the Camera "looks" towards its -z axis.
|
||||||
@@ -315,18 +409,32 @@ public class Camera {
|
|||||||
*
|
*
|
||||||
* <pre>
|
* <pre>
|
||||||
* engine.getTransformManager().setTransform(
|
* engine.getTransformManager().setTransform(
|
||||||
* engine.getTransformManager().getInstance(camera->getEntity()), viewMatrix);
|
* engine.getTransformManager().getInstance(camera->getEntity()), modelMatrix);
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @param viewMatrix The camera position and orientation provided as a <b>rigid transform</b> matrix.
|
* @param modelMatrix The camera position and orientation provided as a <b>rigid transform</b> matrix.
|
||||||
*/
|
*/
|
||||||
public void setModelMatrix(@NonNull @Size(min = 16) float[] viewMatrix) {
|
public void setModelMatrix(@NonNull @Size(min = 16) float[] modelMatrix) {
|
||||||
Asserts.assertMat4fIn(viewMatrix);
|
Asserts.assertMat4fIn(modelMatrix);
|
||||||
nSetModelMatrix(getNativeObject(), viewMatrix);
|
nSetModelMatrix(getNativeObject(), modelMatrix);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the camera's view matrix.
|
* Sets the camera's model matrix.
|
||||||
|
* <p>
|
||||||
|
* Helper method to set the camera's entity transform component.
|
||||||
|
* Remember that the Camera "looks" towards its -z axis.
|
||||||
|
* <p>
|
||||||
|
*
|
||||||
|
* @param modelMatrix The camera position and orientation provided as a <b>rigid transform</b> matrix.
|
||||||
|
*/
|
||||||
|
public void setModelMatrix(@NonNull @Size(min = 16) double[] modelMatrix) {
|
||||||
|
Asserts.assertMat4In(modelMatrix);
|
||||||
|
nSetModelMatrixFp64(getNativeObject(), modelMatrix);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the camera's model matrix.
|
||||||
*
|
*
|
||||||
* @param eyeX x-axis position of the camera in world space
|
* @param eyeX x-axis position of the camera in world space
|
||||||
* @param eyeY y-axis position of the camera in world space
|
* @param eyeY y-axis position of the camera in world space
|
||||||
@@ -344,17 +452,19 @@ public class Camera {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Gets the distance to the near plane
|
||||||
* @return Distance to the near plane
|
* @return Distance to the near plane
|
||||||
*/
|
*/
|
||||||
public float getNear() {
|
public float getNear() {
|
||||||
return nGetNear(getNativeObject());
|
return (float)nGetNear(getNativeObject());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Gets the distance to the far plane
|
||||||
* @return Distance to the far plane
|
* @return Distance to the far plane
|
||||||
*/
|
*/
|
||||||
public float getCullingFar() {
|
public float getCullingFar() {
|
||||||
return nGetCullingFar(getNativeObject());
|
return (float)nGetCullingFar(getNativeObject());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -421,12 +531,28 @@ public class Camera {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves the camera's view matrix. The view matrix is the inverse of the model matrix.
|
* Retrieves the camera's model matrix. The model matrix encodes the camera position and
|
||||||
|
* orientation, or pose.
|
||||||
*
|
*
|
||||||
* @param out A 16-float array where the model view will be stored, or null in which
|
* @param out A 16-double array where the model matrix will be stored, or null in which
|
||||||
* case a new array is allocated.
|
* case a new array is allocated.
|
||||||
*
|
*
|
||||||
* @return A 16-float array containing the camera's view as a column-major matrix.
|
* @return A 16-double array containing the camera's pose as a column-major matrix.
|
||||||
|
*/
|
||||||
|
@NonNull @Size(min = 16)
|
||||||
|
public double[] getModelMatrix(@Nullable @Size(min = 16) double[] out) {
|
||||||
|
out = Asserts.assertMat4(out);
|
||||||
|
nGetModelMatrixFp64(getNativeObject(), out);
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves the camera's view matrix. The view matrix is the inverse of the model matrix.
|
||||||
|
*
|
||||||
|
* @param out A 16-float array where the view matrix will be stored, or null in which
|
||||||
|
* case a new array is allocated.
|
||||||
|
*
|
||||||
|
* @return A 16-float array containing the camera's column-major view matrix.
|
||||||
*/
|
*/
|
||||||
@NonNull @Size(min = 16)
|
@NonNull @Size(min = 16)
|
||||||
public float[] getViewMatrix(@Nullable @Size(min = 16) float[] out) {
|
public float[] getViewMatrix(@Nullable @Size(min = 16) float[] out) {
|
||||||
@@ -435,6 +561,21 @@ public class Camera {
|
|||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves the camera's view matrix. The view matrix is the inverse of the model matrix.
|
||||||
|
*
|
||||||
|
* @param out A 16-double array where the model view will be stored, or null in which
|
||||||
|
* case a new array is allocated.
|
||||||
|
*
|
||||||
|
* @return A 16-double array containing the camera's column-major view matrix.
|
||||||
|
*/
|
||||||
|
@NonNull @Size(min = 16)
|
||||||
|
public double[] getViewMatrix(@Nullable @Size(min = 16) double[] out) {
|
||||||
|
out = Asserts.assertMat4(out);
|
||||||
|
nGetViewMatrixFp64(getNativeObject(), out);
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves the camera position in world space.
|
* Retrieves the camera position in world space.
|
||||||
*
|
*
|
||||||
@@ -547,6 +688,7 @@ public class Camera {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Gets the aperture in f-stops
|
||||||
* @return Aperture in f-stops
|
* @return Aperture in f-stops
|
||||||
*/
|
*/
|
||||||
public float getAperture() {
|
public float getAperture() {
|
||||||
@@ -554,6 +696,7 @@ public class Camera {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Gets the shutter speed in seconds
|
||||||
* @return Shutter speed in seconds
|
* @return Shutter speed in seconds
|
||||||
*/
|
*/
|
||||||
public float getShutterSpeed() {
|
public float getShutterSpeed() {
|
||||||
@@ -561,12 +704,69 @@ public class Camera {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Gets the focal length in meters
|
||||||
|
* @return focal length in meters [m]
|
||||||
|
*/
|
||||||
|
public double getFocalLength() {
|
||||||
|
return nGetFocalLength(getNativeObject());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the camera focus distance in world units
|
||||||
|
* @param distance Distance from the camera to the focus plane in world units. Must be
|
||||||
|
* positive and larger than the camera's near clipping plane.
|
||||||
|
*/
|
||||||
|
public void setFocusDistance(float distance) {
|
||||||
|
nSetFocusDistance(getNativeObject(), distance);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the distance from the camera to the focus plane in world units
|
||||||
|
* @return Distance from the camera to the focus plane in world units
|
||||||
|
*/
|
||||||
|
public float getFocusDistance() {
|
||||||
|
return nGetFocusDistance(getNativeObject());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the sensitivity in ISO
|
||||||
* @return Sensitivity in ISO
|
* @return Sensitivity in ISO
|
||||||
*/
|
*/
|
||||||
public float getSensitivity() {
|
public float getSensitivity() {
|
||||||
return nGetSensitivity(getNativeObject());
|
return nGetSensitivity(getNativeObject());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the entity representing this Camera
|
||||||
|
* @return the entity this Camera component is attached to
|
||||||
|
*/
|
||||||
|
@Entity
|
||||||
|
public int getEntity() {
|
||||||
|
return mEntity;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper to compute the effective focal length taking into account the focus distance
|
||||||
|
*
|
||||||
|
* @param focalLength focal length in any unit (e.g. [m] or [mm])
|
||||||
|
* @param focusDistance focus distance in same unit as focalLength
|
||||||
|
* @return the effective focal length in same unit as focalLength
|
||||||
|
*/
|
||||||
|
static double computeEffectiveFocalLength(double focalLength, double focusDistance) {
|
||||||
|
return nComputeEffectiveFocalLength(focalLength, focusDistance);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper to compute the effective field-of-view taking into account the focus distance
|
||||||
|
*
|
||||||
|
* @param fovInDegrees full field of view in degrees
|
||||||
|
* @param focusDistance focus distance in meters [m]
|
||||||
|
* @return effective full field of view in degrees
|
||||||
|
*/
|
||||||
|
static double computeEffectiveFov(double fovInDegrees, double focusDistance) {
|
||||||
|
return nComputeEffectiveFov(fovInDegrees, focusDistance);
|
||||||
|
}
|
||||||
|
|
||||||
public long getNativeObject() {
|
public long getNativeObject() {
|
||||||
if (mNativeObject == 0) {
|
if (mNativeObject == 0) {
|
||||||
throw new IllegalStateException("Calling method on destroyed Camera");
|
throw new IllegalStateException("Calling method on destroyed Camera");
|
||||||
@@ -581,17 +781,21 @@ public class Camera {
|
|||||||
private static native void nSetProjection(long nativeCamera, int projection, double left, double right, double bottom, double top, double near, double far);
|
private static native void nSetProjection(long nativeCamera, int projection, double left, double right, double bottom, double top, double near, double far);
|
||||||
private static native void nSetProjectionFov(long nativeCamera, double fovInDegrees, double aspect, double near, double far, int fov);
|
private static native void nSetProjectionFov(long nativeCamera, double fovInDegrees, double aspect, double near, double far, int fov);
|
||||||
private static native void nSetLensProjection(long nativeCamera, double focalLength, double aspect, double near, double far);
|
private static native void nSetLensProjection(long nativeCamera, double focalLength, double aspect, double near, double far);
|
||||||
private static native void nSetCustomProjection(long nativeCamera, double[] inMatrix, double near, double far);
|
private static native void nSetCustomProjection(long nativeCamera, double[] inProjection, double[] inProjectionForCulling, double near, double far);
|
||||||
private static native void nSetScaling(long nativeCamera, double[] inScaling);
|
private static native void nSetScaling(long nativeCamera, double x, double y);
|
||||||
|
private static native void nSetShift(long nativeCamera, double x, double y);
|
||||||
private static native void nSetModelMatrix(long nativeCamera, float[] in);
|
private static native void nSetModelMatrix(long nativeCamera, float[] in);
|
||||||
|
private static native void nSetModelMatrixFp64(long nativeCamera, double[] in);
|
||||||
private static native void nLookAt(long nativeCamera, double eyeX, double eyeY, double eyeZ, double centerX, double centerY, double centerZ, double upX, double upY, double upZ);
|
private static native void nLookAt(long nativeCamera, double eyeX, double eyeY, double eyeZ, double centerX, double centerY, double centerZ, double upX, double upY, double upZ);
|
||||||
private static native float nGetNear(long nativeCamera);
|
private static native double nGetNear(long nativeCamera);
|
||||||
private static native float nGetCullingFar(long nativeCamera);
|
private static native double nGetCullingFar(long nativeCamera);
|
||||||
private static native void nGetProjectionMatrix(long nativeCamera, double[] out);
|
private static native void nGetProjectionMatrix(long nativeCamera, double[] out);
|
||||||
private static native void nGetCullingProjectionMatrix(long nativeCamera, double[] out);
|
private static native void nGetCullingProjectionMatrix(long nativeCamera, double[] out);
|
||||||
private static native void nGetScaling(long nativeCamera, double[] out);
|
private static native void nGetScaling(long nativeCamera, double[] out);
|
||||||
private static native void nGetModelMatrix(long nativeCamera, float[] out);
|
private static native void nGetModelMatrix(long nativeCamera, float[] out);
|
||||||
|
private static native void nGetModelMatrixFp64(long nativeCamera, double[] out);
|
||||||
private static native void nGetViewMatrix(long nativeCamera, float[] out);
|
private static native void nGetViewMatrix(long nativeCamera, float[] out);
|
||||||
|
private static native void nGetViewMatrixFp64(long nativeCamera, double[] out);
|
||||||
private static native void nGetPosition(long nativeCamera, float[] out);
|
private static native void nGetPosition(long nativeCamera, float[] out);
|
||||||
private static native void nGetLeftVector(long nativeCamera, float[] out);
|
private static native void nGetLeftVector(long nativeCamera, float[] out);
|
||||||
private static native void nGetUpVector(long nativeCamera, float[] out);
|
private static native void nGetUpVector(long nativeCamera, float[] out);
|
||||||
@@ -600,4 +804,9 @@ public class Camera {
|
|||||||
private static native float nGetAperture(long nativeCamera);
|
private static native float nGetAperture(long nativeCamera);
|
||||||
private static native float nGetShutterSpeed(long nativeCamera);
|
private static native float nGetShutterSpeed(long nativeCamera);
|
||||||
private static native float nGetSensitivity(long nativeCamera);
|
private static native float nGetSensitivity(long nativeCamera);
|
||||||
|
private static native void nSetFocusDistance(long nativeCamera, float distance);
|
||||||
|
private static native float nGetFocusDistance(long nativeCamera);
|
||||||
|
private static native double nGetFocalLength(long nativeCamera);
|
||||||
|
private static native double nComputeEffectiveFocalLength(double focalLength, double focusDistance);
|
||||||
|
private static native double nComputeEffectiveFov(double fovInDegrees, double focusDistance);
|
||||||
}
|
}
|
||||||
|
|||||||
+151
-9
@@ -54,6 +54,8 @@ import static com.google.android.filament.Asserts.assertFloat4In;
|
|||||||
*
|
*
|
||||||
* The various transforms held by ColorGrading are applied in the following order:
|
* The various transforms held by ColorGrading are applied in the following order:
|
||||||
* <ul>
|
* <ul>
|
||||||
|
* <li>Exposure</li>
|
||||||
|
* <li>Night adaptation</li>
|
||||||
* <li>White balance</li>
|
* <li>White balance</li>
|
||||||
* <li>Channel mixer</li>
|
* <li>Channel mixer</li>
|
||||||
* <li>Shadows/mid-tones/highlights</li>
|
* <li>Shadows/mid-tones/highlights</li>
|
||||||
@@ -63,12 +65,16 @@ import static com.google.android.filament.Asserts.assertFloat4In;
|
|||||||
* <li>Saturation</li>
|
* <li>Saturation</li>
|
||||||
* <li>Curves</li>
|
* <li>Curves</li>
|
||||||
* <li>Tone mapping</li>
|
* <li>Tone mapping</li>
|
||||||
|
* <li>Luminance scaling</li>
|
||||||
|
* <li>Gamut mapping</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
*
|
*
|
||||||
* <h1>Defaults</h1>
|
* <h1>Defaults</h1>
|
||||||
*
|
*
|
||||||
* Here are the default color grading options:
|
* Here are the default color grading options:
|
||||||
* <ul>
|
* <ul>
|
||||||
|
* <li>Exposure: 0.0</li>
|
||||||
|
* <li>Night adaptation: 0.0</li>
|
||||||
* <li>White balance: temperature <code>0.0</code>, and tint <code>0.0</code></li>
|
* <li>White balance: temperature <code>0.0</code>, and tint <code>0.0</code></li>
|
||||||
* <li>Channel mixer: red <code>{1,0,0}</code>, green <code>{0,1,0}</code>, blue <code>{0,0,1}</code></li>
|
* <li>Channel mixer: red <code>{1,0,0}</code>, green <code>{0,1,0}</code>, blue <code>{0,0,1}</code></li>
|
||||||
* <li>Shadows/mid-tones/highlights: shadows <code>{1,1,1,0}</code>, mid-tones <code>{1,1,1,0}</code>,
|
* <li>Shadows/mid-tones/highlights: shadows <code>{1,1,1,0}</code>, mid-tones <code>{1,1,1,0}</code>,
|
||||||
@@ -78,11 +84,13 @@ import static com.google.android.filament.Asserts.assertFloat4In;
|
|||||||
* <li>Vibrance: <code>1.0</code></li>
|
* <li>Vibrance: <code>1.0</code></li>
|
||||||
* <li>Saturation: <code>1.0</code></li>
|
* <li>Saturation: <code>1.0</code></li>
|
||||||
* <li>Curves: gamma <code>{1,1,1}</code>, midPoint <code>{1,1,1}</code>, and scale <code>{1,1,1}</code></li>
|
* <li>Curves: gamma <code>{1,1,1}</code>, midPoint <code>{1,1,1}</code>, and scale <code>{1,1,1}</code></li>
|
||||||
* <li>Tone mapping: {@link ToneMapping#ACES_LEGACY}</li>
|
* <li>Tone mapping: {@link ToneMapper.ACESLegacy}</li>
|
||||||
|
* <li>Luminance scaling: false</li>
|
||||||
|
* <li>Gamut mapping: false</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
*
|
*
|
||||||
* @see View
|
* @see View
|
||||||
* @see ToneMapping
|
* @see ToneMapper
|
||||||
*/
|
*/
|
||||||
public class ColorGrading {
|
public class ColorGrading {
|
||||||
long mNativeObject;
|
long mNativeObject;
|
||||||
@@ -98,8 +106,19 @@ public class ColorGrading {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List of available tone-mapping operators.
|
* Color grading LUT format.
|
||||||
*/
|
*/
|
||||||
|
public enum LutFormat {
|
||||||
|
INTEGER,
|
||||||
|
FLOAT
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List of available tone-mapping operators.
|
||||||
|
*
|
||||||
|
* @deprecated Use {@link ColorGrading.Builder#toneMapper(ToneMapper)}
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
public enum ToneMapping {
|
public enum ToneMapping {
|
||||||
/** Linear tone mapping (i.e. no tone mapping). */
|
/** Linear tone mapping (i.e. no tone mapping). */
|
||||||
LINEAR,
|
LINEAR,
|
||||||
@@ -109,15 +128,12 @@ public class ColorGrading {
|
|||||||
ACES,
|
ACES,
|
||||||
/** Filmic tone mapping, modelled after ACES but applied in sRGB space. */
|
/** Filmic tone mapping, modelled after ACES but applied in sRGB space. */
|
||||||
FILMIC,
|
FILMIC,
|
||||||
/** Filmic tone mapping, with more contrast and saturation. */
|
|
||||||
UCHIMURA,
|
|
||||||
/** Reinhard luma-based tone mapping. */
|
|
||||||
REINHARD,
|
|
||||||
/** Tone mapping used to validate/debug scene exposure. */
|
/** Tone mapping used to validate/debug scene exposure. */
|
||||||
DISPLAY_RANGE,
|
DISPLAY_RANGE,
|
||||||
}
|
}
|
||||||
|
|
||||||
ColorGrading(long colorGrading) {
|
// NOTE: This constructor is public only so that filament-utils can use it.
|
||||||
|
public ColorGrading(long colorGrading) {
|
||||||
mNativeObject = colorGrading;
|
mNativeObject = colorGrading;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -155,6 +171,55 @@ public class ColorGrading {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* When color grading is implemented using a 3D LUT, this sets the texture format of
|
||||||
|
* of the LUT. This overrides the value set by quality().
|
||||||
|
*
|
||||||
|
* The default is INTEGER
|
||||||
|
*
|
||||||
|
* @param format The desired format of the 3D LUT.
|
||||||
|
*
|
||||||
|
* @return This Builder, for chaining calls
|
||||||
|
*/
|
||||||
|
public Builder format(LutFormat format) {
|
||||||
|
nBuilderFormat(mNativeBuilder, format.ordinal());
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* When color grading is implemented using a 3D LUT, this sets the dimension of the LUT.
|
||||||
|
* This overrides the value set by quality().
|
||||||
|
*
|
||||||
|
* The default is 32
|
||||||
|
*
|
||||||
|
* @param dim The desired dimension of the LUT. Between 16 and 64.
|
||||||
|
*
|
||||||
|
* @return This Builder, for chaining calls
|
||||||
|
*/
|
||||||
|
public Builder dimensions(int dim) {
|
||||||
|
nBuilderDimensions(mNativeBuilder, dim);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Selects the tone mapping operator to apply to the HDR color buffer as the last
|
||||||
|
* operation of the color grading post-processing step.
|
||||||
|
*
|
||||||
|
* The default tone mapping operator is {@link ToneMapper.ACESLegacy}.
|
||||||
|
*
|
||||||
|
* The specified tone mapper must have a lifecycle that exceeds the lifetime of
|
||||||
|
* this builder. Since the build(Engine&) method is synchronous, it is safe to
|
||||||
|
* delete the tone mapper object after that finishes executing.
|
||||||
|
*
|
||||||
|
* @param toneMapper The tone mapping operator to apply to the HDR color buffer
|
||||||
|
*
|
||||||
|
* @return This Builder, for chaining calls
|
||||||
|
*/
|
||||||
|
public Builder toneMapper(ToneMapper toneMapper) {
|
||||||
|
nBuilderToneMapper(mNativeBuilder, toneMapper.getNativeObject());
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Selects the tone mapping operator to apply to the HDR color buffer as the last
|
* Selects the tone mapping operator to apply to the HDR color buffer as the last
|
||||||
* operation of the color grading post-processing step.
|
* operation of the color grading post-processing step.
|
||||||
@@ -164,12 +229,82 @@ public class ColorGrading {
|
|||||||
* @param toneMapping The tone mapping operator to apply to the HDR color buffer
|
* @param toneMapping The tone mapping operator to apply to the HDR color buffer
|
||||||
*
|
*
|
||||||
* @return This Builder, for chaining calls
|
* @return This Builder, for chaining calls
|
||||||
|
*
|
||||||
|
* @deprecated Use {@link #toneMapper(ToneMapper)}
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public Builder toneMapping(ToneMapping toneMapping) {
|
public Builder toneMapping(ToneMapping toneMapping) {
|
||||||
nBuilderToneMapping(mNativeBuilder, toneMapping.ordinal());
|
nBuilderToneMapping(mNativeBuilder, toneMapping.ordinal());
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables or disables the luminance scaling component (LICH) from the exposure value
|
||||||
|
* invariant luminance system (EVILS). When this setting is enabled, pixels with high
|
||||||
|
* chromatic values will roll-off to white to offer a more natural rendering. This step
|
||||||
|
* also helps avoid undesirable hue skews caused by out of gamut colors clipped
|
||||||
|
* to the destination color gamut.
|
||||||
|
*
|
||||||
|
* When luminance scaling is enabled, tone mapping is performed on the luminance of each
|
||||||
|
* pixel instead of per-channel.
|
||||||
|
*
|
||||||
|
* @param luminanceScaling Enables or disables EVILS post-tone mapping
|
||||||
|
*
|
||||||
|
* @return This Builder, for chaining calls
|
||||||
|
*/
|
||||||
|
public Builder luminanceScaling(boolean luminanceScaling) {
|
||||||
|
nBuilderLuminanceScaling(mNativeBuilder, luminanceScaling);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables or disables gamut mapping to the destination color space's gamut. When gamut
|
||||||
|
* mapping is turned off, out-of-gamut colors are clipped to the destination's gamut,
|
||||||
|
* which may produce hue skews (blue skewing to purple, green to yellow, etc.). When
|
||||||
|
* gamut mapping is enabled, out-of-gamut colors are brought back in gamut by trying to
|
||||||
|
* preserve the perceived chroma and lightness of the original values.
|
||||||
|
*
|
||||||
|
* @param gamutMapping Enables or disables gamut mapping
|
||||||
|
*
|
||||||
|
* @return This Builder, for chaining calls
|
||||||
|
*/
|
||||||
|
public Builder gamutMapping(boolean gamutMapping) {
|
||||||
|
nBuilderGamutMapping(mNativeBuilder, gamutMapping);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adjusts the exposure of this image. The exposure is specified in stops:
|
||||||
|
* each stop brightens (positive values) or darkens (negative values) the image by
|
||||||
|
* a factor of 2. This means that an exposure of 3 will brighten the image 8 times
|
||||||
|
* more than an exposure of 0 (2^3 = 8 and 2^0 = 1). Contrary to the camera's exposure,
|
||||||
|
* this setting is applied after all post-processing (bloom, etc.) are applied.
|
||||||
|
*
|
||||||
|
* @param exposure Value in EV stops. Can be negative, 0, or positive.
|
||||||
|
*
|
||||||
|
* @return This Builder, for chaining calls
|
||||||
|
*/
|
||||||
|
public Builder exposure(float exposure) {
|
||||||
|
nBuilderExposure(mNativeBuilder, exposure);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Controls the amount of night adaptation to replicate a more natural representation of
|
||||||
|
* low-light conditions as perceived by the human vision system. In low-light conditions,
|
||||||
|
* peak luminance sensitivity of the eye shifts toward the blue end of the color spectrum:
|
||||||
|
* darker tones appear brighter, reducing contrast, and colors are blue shifted (the darker
|
||||||
|
* the more intense the effect).
|
||||||
|
*
|
||||||
|
* @param adaptation Amount of adaptation, between 0 (no adaptation) and 1 (full adaptation).
|
||||||
|
*
|
||||||
|
* @return This Builder, for chaining calls
|
||||||
|
*/
|
||||||
|
public Builder nightAdaptation(float adaptation) {
|
||||||
|
nBuilderNightAdaptation(mNativeBuilder, adaptation);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adjusts the while balance of the image. This can be used to remove color casts
|
* Adjusts the while balance of the image. This can be used to remove color casts
|
||||||
* and correct the appearance of the white point in the scene, or to alter the
|
* and correct the appearance of the white point in the scene, or to alter the
|
||||||
@@ -462,7 +597,14 @@ public class ColorGrading {
|
|||||||
private static native void nDestroyBuilder(long nativeBuilder);
|
private static native void nDestroyBuilder(long nativeBuilder);
|
||||||
|
|
||||||
private static native void nBuilderQuality(long nativeBuilder, int quality);
|
private static native void nBuilderQuality(long nativeBuilder, int quality);
|
||||||
private static native void nBuilderToneMapping(long nativeBuilder, int toneMapper);
|
private static native void nBuilderFormat(long nativeBuilder, int format);
|
||||||
|
private static native void nBuilderDimensions(long nativeBuilder, int dim);
|
||||||
|
private static native void nBuilderToneMapper(long nativeBuilder, long toneMapper);
|
||||||
|
private static native void nBuilderToneMapping(long nativeBuilder, int toneMapping);
|
||||||
|
private static native void nBuilderLuminanceScaling(long nativeBuilder, boolean luminanceScaling);
|
||||||
|
private static native void nBuilderGamutMapping(long nativeBuilder, boolean gamutMapping);
|
||||||
|
private static native void nBuilderExposure(long nativeBuilder, float exposure);
|
||||||
|
private static native void nBuilderNightAdaptation(long nativeBuilder, float adaptation);
|
||||||
private static native void nBuilderWhiteBalance(long nativeBuilder, float temperature, float tint);
|
private static native void nBuilderWhiteBalance(long nativeBuilder, float temperature, float tint);
|
||||||
private static native void nBuilderChannelMixer(long nativeBuilder, float[] outRed, float[] outGreen, float[] outBlue);
|
private static native void nBuilderChannelMixer(long nativeBuilder, float[] outRed, float[] outGreen, float[] outBlue);
|
||||||
private static native void nBuilderShadowsMidtonesHighlights(long nativeBuilder, float[] shadows, float[] midtones, float[] highlights, float[] ranges);
|
private static native void nBuilderShadowsMidtonesHighlights(long nativeBuilder, float[] shadows, float[] midtones, float[] highlights, float[] ranges);
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ import com.google.android.filament.proguard.UsedByReflection;
|
|||||||
* <pre>
|
* <pre>
|
||||||
* import com.google.android.filament.*
|
* import com.google.android.filament.*
|
||||||
*
|
*
|
||||||
* Engin engine = Engine.create();
|
* Engine engine = Engine.create();
|
||||||
* SwapChain swapChain = engine.createSwapChain(nativeWindow);
|
* SwapChain swapChain = engine.createSwapChain(nativeWindow);
|
||||||
* Renderer renderer = engine.createRenderer();
|
* Renderer renderer = engine.createRenderer();
|
||||||
* Scene scene = engine.createScene();
|
* Scene scene = engine.createScene();
|
||||||
@@ -106,10 +106,15 @@ import com.google.android.filament.proguard.UsedByReflection;
|
|||||||
* @see Renderer
|
* @see Renderer
|
||||||
*/
|
*/
|
||||||
public class Engine {
|
public class Engine {
|
||||||
|
private static final Backend[] sBackendValues = Backend.values();
|
||||||
|
private static final FeatureLevel[] sFeatureLevelValues = FeatureLevel.values();
|
||||||
|
|
||||||
private long mNativeObject;
|
private long mNativeObject;
|
||||||
|
|
||||||
@NonNull private final TransformManager mTransformManager;
|
@NonNull private final TransformManager mTransformManager;
|
||||||
@NonNull private final LightManager mLightManager;
|
@NonNull private final LightManager mLightManager;
|
||||||
@NonNull private final RenderableManager mRenderableManager;
|
@NonNull private final RenderableManager mRenderableManager;
|
||||||
|
@NonNull private final EntityManager mEntityManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Denotes a backend
|
* Denotes a backend
|
||||||
@@ -137,11 +142,24 @@ public class Engine {
|
|||||||
NOOP,
|
NOOP,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Defines the backend's feature levels.
|
||||||
|
*/
|
||||||
|
public enum FeatureLevel {
|
||||||
|
/** Reserved, don't use */
|
||||||
|
FEATURE_LEVEL_0,
|
||||||
|
/** OpenGL ES 3.0 features (default) */
|
||||||
|
FEATURE_LEVEL_1,
|
||||||
|
/** OpenGL ES 3.1 features + 31 textures units + cubemap arrays */
|
||||||
|
FEATURE_LEVEL_2
|
||||||
|
};
|
||||||
|
|
||||||
private Engine(long nativeEngine) {
|
private Engine(long nativeEngine) {
|
||||||
mNativeObject = nativeEngine;
|
mNativeObject = nativeEngine;
|
||||||
mTransformManager = new TransformManager(nGetTransformManager(nativeEngine));
|
mTransformManager = new TransformManager(nGetTransformManager(nativeEngine));
|
||||||
mLightManager = new LightManager(nGetLightManager(nativeEngine));
|
mLightManager = new LightManager(nGetLightManager(nativeEngine));
|
||||||
mRenderableManager = new RenderableManager(nGetRenderableManager(nativeEngine));
|
mRenderableManager = new RenderableManager(nGetRenderableManager(nativeEngine));
|
||||||
|
mEntityManager = new EntityManager(nGetEntityManager(nativeEngine));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -250,9 +268,91 @@ public class Engine {
|
|||||||
*/
|
*/
|
||||||
@NonNull
|
@NonNull
|
||||||
public Backend getBackend() {
|
public Backend getBackend() {
|
||||||
return Backend.values()[(int) nGetBackend(getNativeObject())];
|
return sBackendValues[(int) nGetBackend(getNativeObject())];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper to enable accurate translations.
|
||||||
|
* If you need this Engine to handle a very large world space, one way to achieve this
|
||||||
|
* automatically is to enable accurate translations in the TransformManager. This helper
|
||||||
|
* provides a convenient way of doing that.
|
||||||
|
* This is typically called once just after creating the Engine.
|
||||||
|
*/
|
||||||
|
public void enableAccurateTranslations() {
|
||||||
|
getTransformManager().setAccurateTranslationsEnabled(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Query the feature level supported by the selected backend.
|
||||||
|
*
|
||||||
|
* A specific feature level needs to be set before the corresponding features can be used.
|
||||||
|
*
|
||||||
|
* @return FeatureLevel supported the selected backend.
|
||||||
|
* @see #setActiveFeatureLevel
|
||||||
|
*/
|
||||||
|
@NonNull
|
||||||
|
public FeatureLevel getSupportedFeatureLevel() {
|
||||||
|
return sFeatureLevelValues[(int) nGetSupportedFeatureLevel(getNativeObject())];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Activate all features of a given feature level. By default FeatureLevel::FEATURE_LEVEL_1 is
|
||||||
|
* active. The selected feature level must not be higher than the value returned by
|
||||||
|
* getActiveFeatureLevel() and it's not possible lower the active feature level.
|
||||||
|
*
|
||||||
|
* @param featureLevel the feature level to activate. If featureLevel is lower than
|
||||||
|
* getActiveFeatureLevel(), the current (higher) feature level is kept.
|
||||||
|
* If featureLevel is higher than getSupportedFeatureLevel(), an exception
|
||||||
|
* is thrown, or the program is terminated if exceptions are disabled.
|
||||||
|
*
|
||||||
|
* @return the active feature level.
|
||||||
|
*
|
||||||
|
* @see #getSupportedFeatureLevel
|
||||||
|
* @see #getActiveFeatureLevel
|
||||||
|
*/
|
||||||
|
@NonNull
|
||||||
|
public FeatureLevel setActiveFeatureLevel(@NonNull FeatureLevel featureLevel) {
|
||||||
|
return sFeatureLevelValues[(int) nSetActiveFeatureLevel(getNativeObject(), featureLevel.ordinal())];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the currently active feature level.
|
||||||
|
* @return currently active feature level
|
||||||
|
* @see #getSupportedFeatureLevel
|
||||||
|
* @see #setActiveFeatureLevel
|
||||||
|
*/
|
||||||
|
@NonNull
|
||||||
|
public FeatureLevel getActiveFeatureLevel() {
|
||||||
|
return sFeatureLevelValues[(int) nGetActiveFeatureLevel(getNativeObject())];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables or disables automatic instancing of render primitives. Instancing of render primitive
|
||||||
|
* can greatly reduce CPU overhead but requires the instanced primitives to be identical
|
||||||
|
* (i.e. use the same geometry) and use the same MaterialInstance. If it is known that the
|
||||||
|
* scene doesn't contain any identical primitives, automatic instancing can have some
|
||||||
|
* overhead and it is then best to disable it.
|
||||||
|
*
|
||||||
|
* Disabled by default.
|
||||||
|
*
|
||||||
|
* @param enable true to enable, false to disable automatic instancing.
|
||||||
|
*
|
||||||
|
* @see RenderableManager
|
||||||
|
* @see MaterialInstance
|
||||||
|
*/
|
||||||
|
public void setAutomaticInstancingEnabled(boolean enable) {
|
||||||
|
nSetAutomaticInstancingEnabled(getNativeObject(), enable);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return true if automatic instancing is enabled, false otherwise.
|
||||||
|
* @see #setAutomaticInstancingEnabled
|
||||||
|
*/
|
||||||
|
public boolean isAutomaticInstancingEnabled() {
|
||||||
|
return nIsAutomaticInstancingEnabled(getNativeObject());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// SwapChain
|
// SwapChain
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -349,6 +449,141 @@ public class Engine {
|
|||||||
swapChain.clearNativeObject();
|
swapChain.clearNativeObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns whether the object is valid.
|
||||||
|
* @param object Object to check for validity
|
||||||
|
* @return returns true if the specified object is valid.
|
||||||
|
*/
|
||||||
|
public boolean isValidRenderer(@NonNull Renderer object) {
|
||||||
|
return nIsValidRenderer(getNativeObject(), object.getNativeObject());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns whether the object is valid.
|
||||||
|
* @param object Object to check for validity
|
||||||
|
* @return returns true if the specified object is valid.
|
||||||
|
*/
|
||||||
|
public boolean isValidView(@NonNull View object) {
|
||||||
|
return nIsValidView(getNativeObject(), object.getNativeObject());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns whether the object is valid.
|
||||||
|
* @param object Object to check for validity
|
||||||
|
* @return returns true if the specified object is valid.
|
||||||
|
*/
|
||||||
|
public boolean isValidScene(@NonNull Scene object) {
|
||||||
|
return nIsValidScene(getNativeObject(), object.getNativeObject());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns whether the object is valid.
|
||||||
|
* @param object Object to check for validity
|
||||||
|
* @return returns true if the specified object is valid.
|
||||||
|
*/
|
||||||
|
public boolean isValidFence(@NonNull Fence object) {
|
||||||
|
return nIsValidFence(getNativeObject(), object.getNativeObject());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns whether the object is valid.
|
||||||
|
* @param object Object to check for validity
|
||||||
|
* @return returns true if the specified object is valid.
|
||||||
|
*/
|
||||||
|
public boolean isValidStream(@NonNull Stream object) {
|
||||||
|
return nIsValidStream(getNativeObject(), object.getNativeObject());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns whether the object is valid.
|
||||||
|
* @param object Object to check for validity
|
||||||
|
* @return returns true if the specified object is valid.
|
||||||
|
*/
|
||||||
|
public boolean isValidIndexBuffer(@NonNull IndexBuffer object) {
|
||||||
|
return nIsValidIndexBuffer(getNativeObject(), object.getNativeObject());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns whether the object is valid.
|
||||||
|
* @param object Object to check for validity
|
||||||
|
* @return returns true if the specified object is valid.
|
||||||
|
*/
|
||||||
|
public boolean isValidVertexBuffer(@NonNull VertexBuffer object) {
|
||||||
|
return nIsValidVertexBuffer(getNativeObject(), object.getNativeObject());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns whether the object is valid.
|
||||||
|
* @param object Object to check for validity
|
||||||
|
* @return returns true if the specified object is valid.
|
||||||
|
*/
|
||||||
|
public boolean isValidSkinningBuffer(@NonNull SkinningBuffer object) {
|
||||||
|
return nIsValidSkinningBuffer(getNativeObject(), object.getNativeObject());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns whether the object is valid.
|
||||||
|
* @param object Object to check for validity
|
||||||
|
* @return returns true if the specified object is valid.
|
||||||
|
*/
|
||||||
|
public boolean isValidIndirectLight(@NonNull IndirectLight object) {
|
||||||
|
return nIsValidIndirectLight(getNativeObject(), object.getNativeObject());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns whether the object is valid.
|
||||||
|
* @param object Object to check for validity
|
||||||
|
* @return returns true if the specified object is valid.
|
||||||
|
*/
|
||||||
|
public boolean isValidMaterial(@NonNull Material object) {
|
||||||
|
return nIsValidMaterial(getNativeObject(), object.getNativeObject());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns whether the object is valid.
|
||||||
|
* @param object Object to check for validity
|
||||||
|
* @return returns true if the specified object is valid.
|
||||||
|
*/
|
||||||
|
public boolean isValidSkybox(@NonNull Skybox object) {
|
||||||
|
return nIsValidSkybox(getNativeObject(), object.getNativeObject());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns whether the object is valid.
|
||||||
|
* @param object Object to check for validity
|
||||||
|
* @return returns true if the specified object is valid.
|
||||||
|
*/
|
||||||
|
public boolean isValidColorGrading(@NonNull ColorGrading object) {
|
||||||
|
return nIsValidColorGrading(getNativeObject(), object.getNativeObject());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns whether the object is valid.
|
||||||
|
* @param object Object to check for validity
|
||||||
|
* @return returns true if the specified object is valid.
|
||||||
|
*/
|
||||||
|
public boolean isValidTexture(@NonNull Texture object) {
|
||||||
|
return nIsValidTexture(getNativeObject(), object.getNativeObject());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns whether the object is valid.
|
||||||
|
* @param object Object to check for validity
|
||||||
|
* @return returns true if the specified object is valid.
|
||||||
|
*/
|
||||||
|
public boolean isValidRenderTarget(@NonNull RenderTarget object) {
|
||||||
|
return nIsValidRenderTarget(getNativeObject(), object.getNativeObject());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns whether the object is valid.
|
||||||
|
* @param object Object to check for validity
|
||||||
|
* @return returns true if the specified object is valid.
|
||||||
|
*/
|
||||||
|
public boolean isValidSwapChain(@NonNull SwapChain object) {
|
||||||
|
return nIsValidSwapChain(getNativeObject(), object.getNativeObject());
|
||||||
|
}
|
||||||
|
|
||||||
// View
|
// View
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -397,19 +632,6 @@ public class Engine {
|
|||||||
|
|
||||||
// Camera
|
// Camera
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a new <code>entity</code> and adds a {@link Camera} component to it.
|
|
||||||
*
|
|
||||||
* @return A newly created {@link Camera}
|
|
||||||
* @exception IllegalStateException can be thrown if the {@link Camera} couldn't be created
|
|
||||||
*/
|
|
||||||
@NonNull
|
|
||||||
public Camera createCamera() {
|
|
||||||
long nativeCamera = nCreateCamera(getNativeObject());
|
|
||||||
if (nativeCamera == 0) throw new IllegalStateException("Couldn't create Camera");
|
|
||||||
return new Camera(nativeCamera);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates and adds a {@link Camera} component to a given <code>entity</code>.
|
* Creates and adds a {@link Camera} component to a given <code>entity</code>.
|
||||||
*
|
*
|
||||||
@@ -419,9 +641,9 @@ public class Engine {
|
|||||||
*/
|
*/
|
||||||
@NonNull
|
@NonNull
|
||||||
public Camera createCamera(@Entity int entity) {
|
public Camera createCamera(@Entity int entity) {
|
||||||
long nativeCamera = nCreateCameraWithEntity(getNativeObject(), entity);
|
long nativeCamera = nCreateCamera(getNativeObject(), entity);
|
||||||
if (nativeCamera == 0) throw new IllegalStateException("Couldn't create Camera");
|
if (nativeCamera == 0) throw new IllegalStateException("Couldn't create Camera");
|
||||||
return new Camera(nativeCamera);
|
return new Camera(nativeCamera, entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -435,16 +657,16 @@ public class Engine {
|
|||||||
public Camera getCameraComponent(@Entity int entity) {
|
public Camera getCameraComponent(@Entity int entity) {
|
||||||
long nativeCamera = nGetCameraComponent(getNativeObject(), entity);
|
long nativeCamera = nGetCameraComponent(getNativeObject(), entity);
|
||||||
if (nativeCamera == 0) return null;
|
if (nativeCamera == 0) return null;
|
||||||
return new Camera(nativeCamera);
|
return new Camera(nativeCamera, entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Destroys a {@link Camera} component and frees all its associated resources.
|
* Destroys the {@link Camera} component associated with the given entity.
|
||||||
* @param camera the {@link Camera} to destroy
|
*
|
||||||
|
* @param entity an entity
|
||||||
*/
|
*/
|
||||||
public void destroyCamera(@NonNull Camera camera) {
|
public void destroyCameraComponent(@Entity int entity) {
|
||||||
nDestroyCamera(getNativeObject(), camera.getNativeObject());
|
nDestroyCameraComponent(getNativeObject(), entity);
|
||||||
camera.clearNativeObject();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Scene
|
// Scene
|
||||||
@@ -524,6 +746,15 @@ public class Engine {
|
|||||||
vertexBuffer.clearNativeObject();
|
vertexBuffer.clearNativeObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Destroys a {@link SkinningBuffer} and frees all its associated resources.
|
||||||
|
* @param skinningBuffer the {@link SkinningBuffer} to destroy
|
||||||
|
*/
|
||||||
|
public void destroySkinningBuffer(@NonNull SkinningBuffer skinningBuffer) {
|
||||||
|
assertDestroy(nDestroySkinningBuffer(getNativeObject(), skinningBuffer.getNativeObject()));
|
||||||
|
skinningBuffer.clearNativeObject();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Destroys a {@link IndirectLight} and frees all its associated resources.
|
* Destroys a {@link IndirectLight} and frees all its associated resources.
|
||||||
* @param ibl the {@link IndirectLight} to destroy
|
* @param ibl the {@link IndirectLight} to destroy
|
||||||
@@ -592,8 +823,11 @@ public class Engine {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Destroys an <code>entity</code> and all its components.
|
* Destroys all Filament-known components from this <code>entity</code>.
|
||||||
* <p>
|
* <p>
|
||||||
|
* This method destroys Filament components only, not the <code>entity</code> itself. To destroy
|
||||||
|
* the <code>entity</code> use <code>EntityManager#destroy</code>.
|
||||||
|
*
|
||||||
* It is recommended to destroy components individually before destroying their
|
* It is recommended to destroy components individually before destroying their
|
||||||
* <code>entity</code>, this gives more control as to when the destruction really happens.
|
* <code>entity</code>, this gives more control as to when the destruction really happens.
|
||||||
* Otherwise, orphaned components are garbage collected, which can happen at a later time.
|
* Otherwise, orphaned components are garbage collected, which can happen at a later time.
|
||||||
@@ -632,9 +866,17 @@ public class Engine {
|
|||||||
return mRenderableManager;
|
return mRenderableManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the {@link EntityManager} used by this {@link Engine}
|
||||||
|
*/
|
||||||
|
@NonNull
|
||||||
|
public EntityManager getEntityManager() {
|
||||||
|
return mEntityManager;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Kicks the hardware thread (e.g.: the OpenGL, Vulkan or Metal thread) and blocks until
|
* Kicks the hardware thread (e.g.: the OpenGL, Vulkan or Metal thread) and blocks until
|
||||||
* all commands to this point are executed. Note that this doesn't guarantee that the
|
* all commands to this point are executed. Note that this does guarantee that the
|
||||||
* hardware is actually finished.
|
* hardware is actually finished.
|
||||||
*
|
*
|
||||||
* <p>This is typically used right after destroying the <code>SwapChain</code>,
|
* <p>This is typically used right after destroying the <code>SwapChain</code>,
|
||||||
@@ -678,22 +920,22 @@ public class Engine {
|
|||||||
private static native long nCreateSwapChain(long nativeEngine, Object nativeWindow, long flags);
|
private static native long nCreateSwapChain(long nativeEngine, Object nativeWindow, long flags);
|
||||||
private static native long nCreateSwapChainHeadless(long nativeEngine, int width, int height, long flags);
|
private static native long nCreateSwapChainHeadless(long nativeEngine, int width, int height, long flags);
|
||||||
private static native long nCreateSwapChainFromRawPointer(long nativeEngine, long pointer, long flags);
|
private static native long nCreateSwapChainFromRawPointer(long nativeEngine, long pointer, long flags);
|
||||||
private static native boolean nDestroySwapChain(long nativeEngine, long nativeSwapChain);
|
|
||||||
private static native long nCreateView(long nativeEngine);
|
private static native long nCreateView(long nativeEngine);
|
||||||
private static native boolean nDestroyView(long nativeEngine, long nativeView);
|
|
||||||
private static native long nCreateRenderer(long nativeEngine);
|
private static native long nCreateRenderer(long nativeEngine);
|
||||||
private static native boolean nDestroyRenderer(long nativeEngine, long nativeRenderer);
|
private static native long nCreateCamera(long nativeEngine, int entity);
|
||||||
private static native long nCreateCamera(long nativeEngine);
|
|
||||||
private static native long nCreateCameraWithEntity(long nativeEngine, int entity);
|
|
||||||
private static native long nGetCameraComponent(long nativeEngine, int entity);
|
private static native long nGetCameraComponent(long nativeEngine, int entity);
|
||||||
private static native void nDestroyCamera(long nativeEngine, long nativeCamera);
|
private static native void nDestroyCameraComponent(long nativeEngine, int entity);
|
||||||
private static native long nCreateScene(long nativeEngine);
|
private static native long nCreateScene(long nativeEngine);
|
||||||
private static native boolean nDestroyScene(long nativeEngine, long nativeScene);
|
|
||||||
private static native long nCreateFence(long nativeEngine);
|
private static native long nCreateFence(long nativeEngine);
|
||||||
|
|
||||||
|
private static native boolean nDestroyRenderer(long nativeEngine, long nativeRenderer);
|
||||||
|
private static native boolean nDestroyView(long nativeEngine, long nativeView);
|
||||||
|
private static native boolean nDestroyScene(long nativeEngine, long nativeScene);
|
||||||
private static native boolean nDestroyFence(long nativeEngine, long nativeFence);
|
private static native boolean nDestroyFence(long nativeEngine, long nativeFence);
|
||||||
private static native boolean nDestroyStream(long nativeEngine, long nativeStream);
|
private static native boolean nDestroyStream(long nativeEngine, long nativeStream);
|
||||||
private static native boolean nDestroyIndexBuffer(long nativeEngine, long nativeIndexBuffer);
|
private static native boolean nDestroyIndexBuffer(long nativeEngine, long nativeIndexBuffer);
|
||||||
private static native boolean nDestroyVertexBuffer(long nativeEngine, long nativeVertexBuffer);
|
private static native boolean nDestroyVertexBuffer(long nativeEngine, long nativeVertexBuffer);
|
||||||
|
private static native boolean nDestroySkinningBuffer(long nativeEngine, long nativeSkinningBuffer);
|
||||||
private static native boolean nDestroyIndirectLight(long nativeEngine, long nativeIndirectLight);
|
private static native boolean nDestroyIndirectLight(long nativeEngine, long nativeIndirectLight);
|
||||||
private static native boolean nDestroyMaterial(long nativeEngine, long nativeMaterial);
|
private static native boolean nDestroyMaterial(long nativeEngine, long nativeMaterial);
|
||||||
private static native boolean nDestroyMaterialInstance(long nativeEngine, long nativeMaterialInstance);
|
private static native boolean nDestroyMaterialInstance(long nativeEngine, long nativeMaterialInstance);
|
||||||
@@ -701,10 +943,32 @@ public class Engine {
|
|||||||
private static native boolean nDestroyColorGrading(long nativeEngine, long nativeColorGrading);
|
private static native boolean nDestroyColorGrading(long nativeEngine, long nativeColorGrading);
|
||||||
private static native boolean nDestroyTexture(long nativeEngine, long nativeTexture);
|
private static native boolean nDestroyTexture(long nativeEngine, long nativeTexture);
|
||||||
private static native boolean nDestroyRenderTarget(long nativeEngine, long nativeTarget);
|
private static native boolean nDestroyRenderTarget(long nativeEngine, long nativeTarget);
|
||||||
|
private static native boolean nDestroySwapChain(long nativeEngine, long nativeSwapChain);
|
||||||
|
private static native boolean nIsValidRenderer(long nativeEngine, long nativeRenderer);
|
||||||
|
private static native boolean nIsValidView(long nativeEngine, long nativeView);
|
||||||
|
private static native boolean nIsValidScene(long nativeEngine, long nativeScene);
|
||||||
|
private static native boolean nIsValidFence(long nativeEngine, long nativeFence);
|
||||||
|
private static native boolean nIsValidStream(long nativeEngine, long nativeStream);
|
||||||
|
private static native boolean nIsValidIndexBuffer(long nativeEngine, long nativeIndexBuffer);
|
||||||
|
private static native boolean nIsValidVertexBuffer(long nativeEngine, long nativeVertexBuffer);
|
||||||
|
private static native boolean nIsValidSkinningBuffer(long nativeEngine, long nativeSkinningBuffer);
|
||||||
|
private static native boolean nIsValidIndirectLight(long nativeEngine, long nativeIndirectLight);
|
||||||
|
private static native boolean nIsValidMaterial(long nativeEngine, long nativeMaterial);
|
||||||
|
private static native boolean nIsValidSkybox(long nativeEngine, long nativeSkybox);
|
||||||
|
private static native boolean nIsValidColorGrading(long nativeEngine, long nativeColorGrading);
|
||||||
|
private static native boolean nIsValidTexture(long nativeEngine, long nativeTexture);
|
||||||
|
private static native boolean nIsValidRenderTarget(long nativeEngine, long nativeTarget);
|
||||||
|
private static native boolean nIsValidSwapChain(long nativeEngine, long nativeSwapChain);
|
||||||
private static native void nDestroyEntity(long nativeEngine, int entity);
|
private static native void nDestroyEntity(long nativeEngine, int entity);
|
||||||
private static native void nFlushAndWait(long nativeEngine);
|
private static native void nFlushAndWait(long nativeEngine);
|
||||||
private static native long nGetTransformManager(long nativeEngine);
|
private static native long nGetTransformManager(long nativeEngine);
|
||||||
private static native long nGetLightManager(long nativeEngine);
|
private static native long nGetLightManager(long nativeEngine);
|
||||||
private static native long nGetRenderableManager(long nativeEngine);
|
private static native long nGetRenderableManager(long nativeEngine);
|
||||||
private static native long nGetJobSystem(long nativeEngine);
|
private static native long nGetJobSystem(long nativeEngine);
|
||||||
|
private static native long nGetEntityManager(long nativeEngine);
|
||||||
|
private static native void nSetAutomaticInstancingEnabled(long nativeEngine, boolean enable);
|
||||||
|
private static native boolean nIsAutomaticInstancingEnabled(long nativeEngine);
|
||||||
|
private static native int nGetSupportedFeatureLevel(long nativeEngine);
|
||||||
|
private static native int nSetActiveFeatureLevel(long nativeEngine, int ordinal);
|
||||||
|
private static native int nGetActiveFeatureLevel(long nativeEngine);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,6 +31,10 @@ public class EntityManager {
|
|||||||
private EntityManager() {
|
private EntityManager() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EntityManager(long nativeEntityManager) {
|
||||||
|
mNativeObject = nativeEntityManager;
|
||||||
|
}
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
public static EntityManager get() {
|
public static EntityManager get() {
|
||||||
return Holder.INSTANCE;
|
return Holder.INSTANCE;
|
||||||
|
|||||||
+6
-10
@@ -21,8 +21,6 @@ import androidx.annotation.NonNull;
|
|||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.annotation.Size;
|
import androidx.annotation.Size;
|
||||||
|
|
||||||
import com.google.android.filament.proguard.UsedByReflection;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <code>IndirectLight</code> is used to simulate environment lighting, a form of global illumination.
|
* <code>IndirectLight</code> is used to simulate environment lighting, a form of global illumination.
|
||||||
*
|
*
|
||||||
@@ -86,11 +84,7 @@ import com.google.android.filament.proguard.UsedByReflection;
|
|||||||
public class IndirectLight {
|
public class IndirectLight {
|
||||||
long mNativeObject;
|
long mNativeObject;
|
||||||
|
|
||||||
public IndirectLight(Engine engine, long indirectLight) {
|
public IndirectLight(long indirectLight) {
|
||||||
mNativeObject = indirectLight;
|
|
||||||
}
|
|
||||||
|
|
||||||
IndirectLight(long indirectLight) {
|
|
||||||
mNativeObject = indirectLight;
|
mNativeObject = indirectLight;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -288,7 +282,7 @@ public class IndirectLight {
|
|||||||
* range can be adjusted with this method.</p>
|
* range can be adjusted with this method.</p>
|
||||||
*
|
*
|
||||||
* @param envIntensity Scale factor applied to the environment and irradiance such that
|
* @param envIntensity Scale factor applied to the environment and irradiance such that
|
||||||
* the result is in cd/m^2 (lux) units (default = 30000)
|
* the result is in <i>lux</i>, or <i>lumen/m^2</i> (default = 30000)
|
||||||
*
|
*
|
||||||
* @return This Builder, for chaining calls.
|
* @return This Builder, for chaining calls.
|
||||||
*/
|
*/
|
||||||
@@ -354,14 +348,14 @@ public class IndirectLight {
|
|||||||
* range can be adjusted with this method.</p>
|
* range can be adjusted with this method.</p>
|
||||||
*
|
*
|
||||||
* @param intensity Scale factor applied to the environment and irradiance such that
|
* @param intensity Scale factor applied to the environment and irradiance such that
|
||||||
* the result is in cd/m^2 units (default = 30000)
|
* the result is in <i>lux</i>, or <i>lumen/m^2</i> (default = 30000)
|
||||||
*/
|
*/
|
||||||
public void setIntensity(float intensity) {
|
public void setIntensity(float intensity) {
|
||||||
nSetIntensity(getNativeObject(), intensity);
|
nSetIntensity(getNativeObject(), intensity);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the environment's intensity in cd/m<sup>2</sup>.
|
* Returns the environment's intensity in <i>lux</i>, or <i>lumen/m^2</i>.
|
||||||
*/
|
*/
|
||||||
public float getIntensity() {
|
public float getIntensity() {
|
||||||
return nGetIntensity(getNativeObject());
|
return nGetIntensity(getNativeObject());
|
||||||
@@ -430,6 +424,7 @@ public class IndirectLight {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** @deprecated */
|
/** @deprecated */
|
||||||
|
@Deprecated
|
||||||
@NonNull @Size(min = 3)
|
@NonNull @Size(min = 3)
|
||||||
public float[] getDirectionEstimate(@Nullable @Size(min = 3) float[] direction) {
|
public float[] getDirectionEstimate(@Nullable @Size(min = 3) float[] direction) {
|
||||||
direction = Asserts.assertFloat3(direction);
|
direction = Asserts.assertFloat3(direction);
|
||||||
@@ -472,6 +467,7 @@ public class IndirectLight {
|
|||||||
|
|
||||||
|
|
||||||
/** @deprecated */
|
/** @deprecated */
|
||||||
|
@Deprecated
|
||||||
@NonNull @Size(min = 4)
|
@NonNull @Size(min = 4)
|
||||||
public float[] getColorEstimate(@Nullable @Size(min = 4) float[] colorIntensity, float x, float y, float z) {
|
public float[] getColorEstimate(@Nullable @Size(min = 4) float[] colorIntensity, float x, float y, float z) {
|
||||||
colorIntensity = Asserts.assertFloat4(colorIntensity);
|
colorIntensity = Asserts.assertFloat4(colorIntensity);
|
||||||
|
|||||||
+123
-27
@@ -117,6 +117,8 @@ import androidx.annotation.Size;
|
|||||||
* </ul>
|
* </ul>
|
||||||
*/
|
*/
|
||||||
public class LightManager {
|
public class LightManager {
|
||||||
|
private static final Type[] sTypeValues = Type.values();
|
||||||
|
|
||||||
private long mNativeObject;
|
private long mNativeObject;
|
||||||
|
|
||||||
LightManager(long nativeLightManager) {
|
LightManager(long nativeLightManager) {
|
||||||
@@ -188,7 +190,7 @@ public class LightManager {
|
|||||||
* Control the quality / performance of the shadow map associated to this light
|
* Control the quality / performance of the shadow map associated to this light
|
||||||
*/
|
*/
|
||||||
public static class ShadowOptions {
|
public static class ShadowOptions {
|
||||||
/** Size of the shadow map in texels. Must be a power-of-two. */
|
/** Size of the shadow map in texels. Must be a power-of-two and larger or equal to 8. */
|
||||||
public int mapSize = 1024;
|
public int mapSize = 1024;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -238,19 +240,21 @@ public class LightManager {
|
|||||||
*/
|
*/
|
||||||
@NonNull
|
@NonNull
|
||||||
@Size(min = 3)
|
@Size(min = 3)
|
||||||
public float[] cascadeSplitPositions = { 0.25f, 0.50f, 0.75f };
|
public float[] cascadeSplitPositions = { 0.125f, 0.25f, 0.50f };
|
||||||
|
|
||||||
/** Constant bias in world units (e.g. meters) by which shadows are moved away from the
|
/** Constant bias in world units (e.g. meters) by which shadows are moved away from the
|
||||||
* light. 1mm by default.
|
* light. 1mm by default.
|
||||||
|
* This is ignored when the View's ShadowType is set to VSM.
|
||||||
*/
|
*/
|
||||||
public float constantBias = 0.05f;
|
public float constantBias = 0.001f;
|
||||||
|
|
||||||
/** Amount by which the maximum sampling error is scaled. The resulting value is used
|
/** Amount by which the maximum sampling error is scaled. The resulting value is used
|
||||||
* to move the shadow away from the fragment normal. Should be 1.0.
|
* to move the shadow away from the fragment normal. Should be 1.0.
|
||||||
|
* This is ignored when the View's ShadowType is set to VSM.
|
||||||
*/
|
*/
|
||||||
public float normalBias = 0.4f;
|
public float normalBias = 1.0f;
|
||||||
|
|
||||||
/** Distance from the camera after which shadows are clipped. this is used to clip
|
/** Distance from the camera after which shadows are clipped. This is used to clip
|
||||||
* shadows that are too far and wouldn't contribute to the scene much, improving
|
* shadows that are too far and wouldn't contribute to the scene much, improving
|
||||||
* performance and quality. This value is always positive.
|
* performance and quality. This value is always positive.
|
||||||
* Use 0.0f to use the camera far distance.
|
* Use 0.0f to use the camera far distance.
|
||||||
@@ -276,8 +280,41 @@ public class LightManager {
|
|||||||
* Controls whether the shadow map should be optimized for resolution or stability.
|
* Controls whether the shadow map should be optimized for resolution or stability.
|
||||||
* When set to true, all resolution enhancing features that can affect stability are
|
* When set to true, all resolution enhancing features that can affect stability are
|
||||||
* disabling, resulting in significantly lower resolution shadows, albeit stable ones.
|
* disabling, resulting in significantly lower resolution shadows, albeit stable ones.
|
||||||
|
*
|
||||||
|
* Setting this flag to true always disables LiSPSM (see below).
|
||||||
*/
|
*/
|
||||||
public boolean stable = true;
|
public boolean stable = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* LiSPSM, or light-space perspective shadow-mapping is a technique allowing to better
|
||||||
|
* optimize the use of the shadow-map texture. When enabled the effective resolution of
|
||||||
|
* shadows is greatly improved and yields result similar to using cascades without the
|
||||||
|
* extra cost. LiSPSM comes with some drawbacks however, in particular it is incompatible
|
||||||
|
* with blurring because it effectively affects the blur kernel size.
|
||||||
|
*
|
||||||
|
* Blurring is only an issue when using ShadowType.VSM with a large blur or with
|
||||||
|
* ShadowType.PCSS however.
|
||||||
|
*
|
||||||
|
* If these blurring artifacts become problematic, this flag can be used to disable LiSPSM.
|
||||||
|
*/
|
||||||
|
public boolean lispsm = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constant bias in depth-resolution units by which shadows are moved away from the
|
||||||
|
* light. The default value of 0.5 is used to round depth values up.
|
||||||
|
* Generally this value shouldn't be changed or at least be small and positive.
|
||||||
|
* This is ignored when the View's ShadowType is set to VSM.
|
||||||
|
*/
|
||||||
|
float polygonOffsetConstant = 0.5f;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Bias based on the change in depth in depth-resolution units by which shadows are moved
|
||||||
|
* away from the light. The default value of 2.0 works well with SHADOW_SAMPLING_PCF_LOW.
|
||||||
|
* Generally this value is between 0.5 and the size in texel of the PCF filter.
|
||||||
|
* Setting this value correctly is essential for LISPSM shadow-maps.
|
||||||
|
* This is ignored when the View's ShadowType is set to VSM.
|
||||||
|
*/
|
||||||
|
float polygonOffsetSlope = 2.0f;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether screen-space contact shadows are used. This applies regardless of whether a
|
* Whether screen-space contact shadows are used. This applies regardless of whether a
|
||||||
@@ -313,17 +350,24 @@ public class LightManager {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The number of MSAA samples to use when rendering VSM shadow maps.
|
* When elvsm is set to true, "Exponential Layered VSM without Layers" are used. It is
|
||||||
* Must be a power-of-two and greater than or equal to 1. A value of 1 effectively turns
|
* an improvement to the default EVSM which suffers important light leaks. Enabling
|
||||||
* off MSAA.
|
* ELVSM for a single shadowmap doubles the memory usage of all shadow maps.
|
||||||
* Higher values may not be available depending on the underlying hardware.
|
* ELVSM is mostly useful when large blurs are used.
|
||||||
*
|
|
||||||
* <p>
|
|
||||||
* <strong>Warning: This API is still experimental and subject to change.</strong>
|
|
||||||
* </p>
|
|
||||||
*/
|
*/
|
||||||
@IntRange(from = 1)
|
public boolean elvsm = false;
|
||||||
public int vsmMsaaSamples = 1;
|
|
||||||
|
/**
|
||||||
|
* Blur width for the VSM blur. Zero do disable.
|
||||||
|
* The maximum value is 125.
|
||||||
|
*/
|
||||||
|
public float blurWidth = 0.0f;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Light bulb radius used for soft shadows. Currently this is only used when DPCF is
|
||||||
|
* enabled. (2cm by default).
|
||||||
|
*/
|
||||||
|
public float shadowBulbRadius = 0.02f;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class ShadowCascades {
|
public static class ShadowCascades {
|
||||||
@@ -423,12 +467,19 @@ public class LightManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether this Light casts shadows (disabled by default)
|
* Enables or disables a light channel. Light channel 0 is enabled by default.
|
||||||
*
|
*
|
||||||
* <p>
|
* @param channel Light channel to enable or disable, between 0 and 7.
|
||||||
* <b>warning:</b>
|
* @param enable Whether to enable or disable the light channel.
|
||||||
* {@link Type#POINT} lights cannot cast shadows.
|
*/
|
||||||
* </p>
|
@NonNull
|
||||||
|
public Builder lightChannel(@IntRange(from = 0, to = 7) int channel, boolean enable) {
|
||||||
|
nBuilderLightChannel(mNativeBuilder, channel, enable);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether this Light casts shadows (disabled by default)
|
||||||
*
|
*
|
||||||
* @param enable Enables or disables casting shadows from this Light.
|
* @param enable Enables or disables casting shadows from this Light.
|
||||||
*
|
*
|
||||||
@@ -451,8 +502,11 @@ public class LightManager {
|
|||||||
nBuilderShadowOptions(mNativeBuilder,
|
nBuilderShadowOptions(mNativeBuilder,
|
||||||
options.mapSize, options.shadowCascades, options.cascadeSplitPositions,
|
options.mapSize, options.shadowCascades, options.cascadeSplitPositions,
|
||||||
options.constantBias, options.normalBias, options.shadowFar, options.shadowNearHint,
|
options.constantBias, options.normalBias, options.shadowFar, options.shadowNearHint,
|
||||||
options.shadowFarHint, options.stable, options.screenSpaceContactShadows,
|
options.shadowFarHint, options.stable, options.lispsm,
|
||||||
options.stepCount, options.maxShadowDistance, options.vsmMsaaSamples);
|
options.polygonOffsetConstant, options.polygonOffsetSlope,
|
||||||
|
options.screenSpaceContactShadows,
|
||||||
|
options.stepCount, options.maxShadowDistance,
|
||||||
|
options.elvsm, options.blurWidth, options.shadowBulbRadius);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -741,7 +795,7 @@ public class LightManager {
|
|||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
public Type getType(@EntityInstance int i) {
|
public Type getType(@EntityInstance int i) {
|
||||||
return Type.values()[nGetType(mNativeObject, i)];
|
return sTypeValues[nGetType(mNativeObject, i)];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -776,6 +830,30 @@ public class LightManager {
|
|||||||
return type == Type.SPOT || type == Type.FOCUSED_SPOT;
|
return type == Type.SPOT || type == Type.FOCUSED_SPOT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables or disables a light channel.
|
||||||
|
* Light channel 0 is enabled by default.
|
||||||
|
*
|
||||||
|
* @param i Instance of the component obtained from getInstance().
|
||||||
|
* @param channel Light channel to set
|
||||||
|
* @param enable true to enable, false to disable
|
||||||
|
*
|
||||||
|
* @see Builder#lightChannel
|
||||||
|
*/
|
||||||
|
public void setLightChannel(@EntityInstance int i, @IntRange(from = 0, to = 7) int channel, boolean enable) {
|
||||||
|
nSetLightChannel(mNativeObject, i, channel, enable);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns whether a light channel is enabled on a specified renderable.
|
||||||
|
* @param i Instance of the component obtained from getInstance().
|
||||||
|
* @param channel Light channel to query
|
||||||
|
* @return true if the light channel is enabled, false otherwise
|
||||||
|
*/
|
||||||
|
public boolean getLightChannel(@EntityInstance int i, @IntRange(from = 0, to = 7) int channel) {
|
||||||
|
return nGetLightChannel(mNativeObject, i, channel);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dynamically updates the light's position.
|
* Dynamically updates the light's position.
|
||||||
*
|
*
|
||||||
@@ -926,8 +1004,6 @@ public class LightManager {
|
|||||||
* lightbulbs.
|
* lightbulbs.
|
||||||
*
|
*
|
||||||
* @param efficiency Efficiency in percent. This depends on the type of lightbulb used.
|
* @param efficiency Efficiency in percent. This depends on the type of lightbulb used.
|
||||||
*
|
|
||||||
* @return This Builder, for chaining calls.
|
|
||||||
*/
|
*/
|
||||||
public void setIntensity(@EntityInstance int i, float watts, float efficiency) {
|
public void setIntensity(@EntityInstance int i, float watts, float efficiency) {
|
||||||
nSetIntensity(mNativeObject, i , watts, efficiency);
|
nSetIntensity(mNativeObject, i , watts, efficiency);
|
||||||
@@ -1065,6 +1141,14 @@ public class LightManager {
|
|||||||
return nIsShadowCaster(mNativeObject, i);
|
return nIsShadowCaster(mNativeObject, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public float getOuterConeAngle(@EntityInstance int i) {
|
||||||
|
return nGetOuterConeAngle(mNativeObject, i);
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getInnerConeAngle(@EntityInstance int i) {
|
||||||
|
return nGetInnerConeAngle(mNativeObject, i);
|
||||||
|
}
|
||||||
|
|
||||||
public long getNativeObject() {
|
public long getNativeObject() {
|
||||||
return mNativeObject;
|
return mNativeObject;
|
||||||
}
|
}
|
||||||
@@ -1078,7 +1162,14 @@ public class LightManager {
|
|||||||
private static native void nDestroyBuilder(long nativeBuilder);
|
private static native void nDestroyBuilder(long nativeBuilder);
|
||||||
private static native boolean nBuilderBuild(long nativeBuilder, long nativeEngine, int entity);
|
private static native boolean nBuilderBuild(long nativeBuilder, long nativeEngine, int entity);
|
||||||
private static native void nBuilderCastShadows(long nativeBuilder, boolean enable);
|
private static native void nBuilderCastShadows(long nativeBuilder, boolean enable);
|
||||||
private static native void nBuilderShadowOptions(long nativeBuilder, int mapSize, int cascades, float[] splitPositions, float constantBias, float normalBias, float shadowFar, float shadowNearHint, float shadowFarhint, boolean stable, boolean screenSpaceContactShadows, int stepCount, float maxShadowDistance, int vsmMsaaSamples);
|
private static native void nBuilderShadowOptions(long nativeBuilder, int mapSize,
|
||||||
|
int cascades, float[] splitPositions,
|
||||||
|
float constantBias, float normalBias,
|
||||||
|
float shadowFar, float shadowNearHint, float shadowFarhint,
|
||||||
|
boolean stable, boolean lispsm,
|
||||||
|
float polygonOffsetConstant, float polygonOffsetSlope,
|
||||||
|
boolean screenSpaceContactShadows, int stepCount, float maxShadowDistance,
|
||||||
|
boolean elvsm, float blurWidth, float shadowBulbRadius);
|
||||||
private static native void nBuilderCastLight(long nativeBuilder, boolean enabled);
|
private static native void nBuilderCastLight(long nativeBuilder, boolean enabled);
|
||||||
private static native void nBuilderPosition(long nativeBuilder, float x, float y, float z);
|
private static native void nBuilderPosition(long nativeBuilder, float x, float y, float z);
|
||||||
private static native void nBuilderDirection(long nativeBuilder, float x, float y, float z);
|
private static native void nBuilderDirection(long nativeBuilder, float x, float y, float z);
|
||||||
@@ -1091,6 +1182,7 @@ public class LightManager {
|
|||||||
private static native void nBuilderAngularRadius(long nativeBuilder, float angularRadius);
|
private static native void nBuilderAngularRadius(long nativeBuilder, float angularRadius);
|
||||||
private static native void nBuilderHaloSize(long nativeBuilder, float haloSize);
|
private static native void nBuilderHaloSize(long nativeBuilder, float haloSize);
|
||||||
private static native void nBuilderHaloFalloff(long nativeBuilder, float haloFalloff);
|
private static native void nBuilderHaloFalloff(long nativeBuilder, float haloFalloff);
|
||||||
|
private static native void nBuilderLightChannel(long nativeBuilder, int channel, boolean enable);
|
||||||
|
|
||||||
private static native void nComputeUniformSplits(float[] splitPositions, int cascades);
|
private static native void nComputeUniformSplits(float[] splitPositions, int cascades);
|
||||||
private static native void nComputeLogSplits(float[] splitPositions, int cascades, float near, float far);
|
private static native void nComputeLogSplits(float[] splitPositions, int cascades, float near, float far);
|
||||||
@@ -1118,4 +1210,8 @@ public class LightManager {
|
|||||||
private static native float nGetSunHaloFalloff(long nativeLightManager, int i);
|
private static native float nGetSunHaloFalloff(long nativeLightManager, int i);
|
||||||
private static native void nSetShadowCaster(long nativeLightManager, int i, boolean shadowCaster);
|
private static native void nSetShadowCaster(long nativeLightManager, int i, boolean shadowCaster);
|
||||||
private static native boolean nIsShadowCaster(long nativeLightManager, int i);
|
private static native boolean nIsShadowCaster(long nativeLightManager, int i);
|
||||||
|
private static native float nGetOuterConeAngle(long nativeLightManager, int i);
|
||||||
|
private static native float nGetInnerConeAngle(long nativeLightManager, int i);
|
||||||
|
private static native void nSetLightChannel(long nativeLightManager, int i, int channel, boolean enable);
|
||||||
|
private static native boolean nGetLightChannel(long nativeLightManager, int i, int channel);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,7 +36,22 @@ import java.util.Set;
|
|||||||
*
|
*
|
||||||
* @see <a href="https://google.github.io/filament/Materials.html">Filament Materials Guide</a>
|
* @see <a href="https://google.github.io/filament/Materials.html">Filament Materials Guide</a>
|
||||||
*/
|
*/
|
||||||
|
@UsedByNative("AssetLoader.cpp")
|
||||||
public class Material {
|
public class Material {
|
||||||
|
static final class EnumCache {
|
||||||
|
private EnumCache() { }
|
||||||
|
|
||||||
|
static final Shading[] sShadingValues = Shading.values();
|
||||||
|
static final Interpolation[] sInterpolationValues = Interpolation.values();
|
||||||
|
static final BlendingMode[] sBlendingModeValues = BlendingMode.values();
|
||||||
|
static final RefractionMode[] sRefractionModeValues = RefractionMode.values();
|
||||||
|
static final RefractionType[] sRefractionTypeValues = RefractionType.values();
|
||||||
|
static final VertexDomain[] sVertexDomainValues = VertexDomain.values();
|
||||||
|
static final CullingMode[] sCullingModeValues = CullingMode.values();
|
||||||
|
static final VertexBuffer.VertexAttribute[] sVertexAttributeValues =
|
||||||
|
VertexBuffer.VertexAttribute.values();
|
||||||
|
}
|
||||||
|
|
||||||
private long mNativeObject;
|
private long mNativeObject;
|
||||||
private final MaterialInstance mDefaultInstance;
|
private final MaterialInstance mDefaultInstance;
|
||||||
|
|
||||||
@@ -210,6 +225,8 @@ public class Material {
|
|||||||
|
|
||||||
@UsedByNative("Material.cpp")
|
@UsedByNative("Material.cpp")
|
||||||
public static class Parameter {
|
public static class Parameter {
|
||||||
|
private static final Type[] sTypeValues = Type.values();
|
||||||
|
|
||||||
public enum Type {
|
public enum Type {
|
||||||
BOOL,
|
BOOL,
|
||||||
BOOL2,
|
BOOL2,
|
||||||
@@ -275,11 +292,11 @@ public class Material {
|
|||||||
@IntRange(from = 0) int type, @IntRange(from = 0) int precision,
|
@IntRange(from = 0) int type, @IntRange(from = 0) int precision,
|
||||||
@IntRange(from = 1) int count) {
|
@IntRange(from = 1) int count) {
|
||||||
parameters.add(
|
parameters.add(
|
||||||
new Parameter(name, Type.values()[type], Precision.values()[precision], count));
|
new Parameter(name, sTypeValues[type], Precision.values()[precision], count));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Material(long nativeMaterial) {
|
public Material(long nativeMaterial) {
|
||||||
mNativeObject = nativeMaterial;
|
mNativeObject = nativeMaterial;
|
||||||
long nativeDefaultInstance = nGetDefaultInstance(nativeMaterial);
|
long nativeDefaultInstance = nGetDefaultInstance(nativeMaterial);
|
||||||
mDefaultInstance = new MaterialInstance(this, nativeDefaultInstance);
|
mDefaultInstance = new MaterialInstance(this, nativeDefaultInstance);
|
||||||
@@ -373,7 +390,7 @@ public class Material {
|
|||||||
* Material Models</a>
|
* Material Models</a>
|
||||||
*/
|
*/
|
||||||
public Shading getShading() {
|
public Shading getShading() {
|
||||||
return Shading.values()[nGetShading(getNativeObject())];
|
return EnumCache.sShadingValues[nGetShading(getNativeObject())];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -384,7 +401,7 @@ public class Material {
|
|||||||
* Vertex and attributes: interpolation</a>
|
* Vertex and attributes: interpolation</a>
|
||||||
*/
|
*/
|
||||||
public Interpolation getInterpolation() {
|
public Interpolation getInterpolation() {
|
||||||
return Interpolation.values()[nGetInterpolation(getNativeObject())];
|
return EnumCache.sInterpolationValues[nGetInterpolation(getNativeObject())];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -395,7 +412,7 @@ public class Material {
|
|||||||
* Blending and transparency: blending</a>
|
* Blending and transparency: blending</a>
|
||||||
*/
|
*/
|
||||||
public BlendingMode getBlendingMode() {
|
public BlendingMode getBlendingMode() {
|
||||||
return BlendingMode.values()[nGetBlendingMode(getNativeObject())];
|
return EnumCache.sBlendingModeValues[nGetBlendingMode(getNativeObject())];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -406,7 +423,7 @@ public class Material {
|
|||||||
* Blending and transparency: refraction</a>
|
* Blending and transparency: refraction</a>
|
||||||
*/
|
*/
|
||||||
public RefractionMode getRefractionMode() {
|
public RefractionMode getRefractionMode() {
|
||||||
return RefractionMode.values()[nGetRefractionMode(getNativeObject())];
|
return EnumCache.sRefractionModeValues[nGetRefractionMode(getNativeObject())];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -417,10 +434,9 @@ public class Material {
|
|||||||
* Blending and transparency: refractionType</a>
|
* Blending and transparency: refractionType</a>
|
||||||
*/
|
*/
|
||||||
public RefractionType getRefractionType() {
|
public RefractionType getRefractionType() {
|
||||||
return RefractionType.values()[nGetRefractionType(getNativeObject())];
|
return EnumCache.sRefractionTypeValues[nGetRefractionType(getNativeObject())];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the vertex domain of this material.
|
* Returns the vertex domain of this material.
|
||||||
*
|
*
|
||||||
@@ -429,7 +445,7 @@ public class Material {
|
|||||||
* Vertex and attributes: vertexDomain</a>
|
* Vertex and attributes: vertexDomain</a>
|
||||||
*/
|
*/
|
||||||
public VertexDomain getVertexDomain() {
|
public VertexDomain getVertexDomain() {
|
||||||
return VertexDomain.values()[nGetVertexDomain(getNativeObject())];
|
return EnumCache.sVertexDomainValues[nGetVertexDomain(getNativeObject())];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -440,7 +456,7 @@ public class Material {
|
|||||||
* Rasterization: culling</a>
|
* Rasterization: culling</a>
|
||||||
*/
|
*/
|
||||||
public CullingMode getCullingMode() {
|
public CullingMode getCullingMode() {
|
||||||
return CullingMode.values()[nGetCullingMode(getNativeObject())];
|
return EnumCache.sCullingModeValues[nGetCullingMode(getNativeObject())];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -487,6 +503,17 @@ public class Material {
|
|||||||
return nIsDoubleSided(getNativeObject());
|
return nIsDoubleSided(getNativeObject());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates whether instances of this material will use alpha to coverage.
|
||||||
|
*
|
||||||
|
* @see
|
||||||
|
* <a href="https://google.github.io/filament/Materials.html#materialdefinitions/materialblock/rasterization:alphatocoverage">
|
||||||
|
* Rasterization: alphaToCoverage</a>
|
||||||
|
*/
|
||||||
|
public boolean isAlphaToCoverageEnabled() {
|
||||||
|
return nIsAlphaToCoverageEnabled(getNativeObject());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the alpha mask threshold used when the blending mode is set to masked.
|
* Returns the alpha mask threshold used when the blending mode is set to masked.
|
||||||
*
|
*
|
||||||
@@ -531,7 +558,7 @@ public class Material {
|
|||||||
if (mRequiredAttributes == null) {
|
if (mRequiredAttributes == null) {
|
||||||
int bitSet = nGetRequiredAttributes(getNativeObject());
|
int bitSet = nGetRequiredAttributes(getNativeObject());
|
||||||
mRequiredAttributes = EnumSet.noneOf(VertexBuffer.VertexAttribute.class);
|
mRequiredAttributes = EnumSet.noneOf(VertexBuffer.VertexAttribute.class);
|
||||||
VertexBuffer.VertexAttribute[] values = VertexBuffer.VertexAttribute.values();
|
VertexBuffer.VertexAttribute[] values = EnumCache.sVertexAttributeValues;
|
||||||
for (int i = 0; i < values.length; i++) {
|
for (int i = 0; i < values.length; i++) {
|
||||||
if ((bitSet & (1 << i)) != 0) {
|
if ((bitSet & (1 << i)) != 0) {
|
||||||
mRequiredAttributes.add(values[i]);
|
mRequiredAttributes.add(values[i]);
|
||||||
@@ -760,7 +787,7 @@ public class Material {
|
|||||||
* @param name name of the parameter array as defined by this Material
|
* @param name name of the parameter array as defined by this Material
|
||||||
* @param type the number of components for each individual parameter
|
* @param type the number of components for each individual parameter
|
||||||
* @param v array of values to set to the named parameter array
|
* @param v array of values to set to the named parameter array
|
||||||
* @param offset the number of elements to skip
|
* @param offset the number of elements in <code>v</code> to skip
|
||||||
* @param count the number of elements in the parameter array to set
|
* @param count the number of elements in the parameter array to set
|
||||||
*
|
*
|
||||||
* <p>For example, to set a parameter array of 4 bool4s:
|
* <p>For example, to set a parameter array of 4 bool4s:
|
||||||
@@ -768,11 +795,6 @@ public class Material {
|
|||||||
* boolean[] a = new boolean[4 * 4];
|
* boolean[] a = new boolean[4 * 4];
|
||||||
* material.setDefaultParameter("param", MaterialInstance.BooleanElement.BOOL4, a, 0, 4);
|
* material.setDefaultParameter("param", MaterialInstance.BooleanElement.BOOL4, a, 0, 4);
|
||||||
* }</pre>
|
* }</pre>
|
||||||
* To only set the last 3 elements, specify an offset of 1 and a count of 3:
|
|
||||||
* <pre>{@code
|
|
||||||
* boolean[] a = new boolean[4 * 3];
|
|
||||||
* material.setDefaultParameter("param", MaterialInstance.BooleanElement.BOOL4, a, 1, 3);
|
|
||||||
* }</pre>
|
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @see Material#getDefaultInstance()
|
* @see Material#getDefaultInstance()
|
||||||
@@ -789,7 +811,7 @@ public class Material {
|
|||||||
* @param name name of the parameter array as defined by this Material
|
* @param name name of the parameter array as defined by this Material
|
||||||
* @param type the number of components for each individual parameter
|
* @param type the number of components for each individual parameter
|
||||||
* @param v array of values to set to the named parameter array
|
* @param v array of values to set to the named parameter array
|
||||||
* @param offset the number of elements to skip
|
* @param offset the number of elements in <code>v</code> to skip
|
||||||
* @param count the number of elements in the parameter array to set
|
* @param count the number of elements in the parameter array to set
|
||||||
*
|
*
|
||||||
* <p>For example, to set a parameter array of 4 int4s:
|
* <p>For example, to set a parameter array of 4 int4s:
|
||||||
@@ -797,11 +819,6 @@ public class Material {
|
|||||||
* int[] a = new int[4 * 4];
|
* int[] a = new int[4 * 4];
|
||||||
* material.setDefaultParameter("param", MaterialInstance.IntElement.INT4, a, 0, 4);
|
* material.setDefaultParameter("param", MaterialInstance.IntElement.INT4, a, 0, 4);
|
||||||
* }</pre>
|
* }</pre>
|
||||||
* To only set the last 3 elements, specify an offset of 1 and a count of 3:
|
|
||||||
* <pre>{@code
|
|
||||||
* int[] a = new int[4 * 3];
|
|
||||||
* material.setDefaultParameter("param", MaterialInstance.IntElement.INT4, a, 1, 3);
|
|
||||||
* }</pre>
|
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @see Material#getDefaultInstance()
|
* @see Material#getDefaultInstance()
|
||||||
@@ -818,7 +835,7 @@ public class Material {
|
|||||||
* @param name name of the parameter array as defined by this Material
|
* @param name name of the parameter array as defined by this Material
|
||||||
* @param type the number of components for each individual parameter
|
* @param type the number of components for each individual parameter
|
||||||
* @param v array of values to set to the named parameter array
|
* @param v array of values to set to the named parameter array
|
||||||
* @param offset the number of elements to skip
|
* @param offset the number of elements in <code>v</code> to skip
|
||||||
* @param count the number of elements in the parameter array to set
|
* @param count the number of elements in the parameter array to set
|
||||||
*
|
*
|
||||||
* <p>For example, to set a parameter array of 4 float4s:
|
* <p>For example, to set a parameter array of 4 float4s:
|
||||||
@@ -826,11 +843,6 @@ public class Material {
|
|||||||
* float[] a = new float[4 * 4];
|
* float[] a = new float[4 * 4];
|
||||||
* material.setDefaultParameter("param", MaterialInstance.FloatElement.FLOAT4, a, 0, 4);
|
* material.setDefaultParameter("param", MaterialInstance.FloatElement.FLOAT4, a, 0, 4);
|
||||||
* }</pre>
|
* }</pre>
|
||||||
* To only set the last 3 elements, specify an offset of 1 and a count of 3:
|
|
||||||
* <pre>{@code
|
|
||||||
* float[] a = new float[4 * 3];
|
|
||||||
* material.setDefaultParameter("param", MaterialInstance.FloatElement.FLOAT4, a, 1, 3);
|
|
||||||
* }</pre>
|
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @see Material#getDefaultInstance()
|
* @see Material#getDefaultInstance()
|
||||||
@@ -914,6 +926,7 @@ public class Material {
|
|||||||
private static native boolean nIsDepthWriteEnabled(long nativeMaterial);
|
private static native boolean nIsDepthWriteEnabled(long nativeMaterial);
|
||||||
private static native boolean nIsDepthCullingEnabled(long nativeMaterial);
|
private static native boolean nIsDepthCullingEnabled(long nativeMaterial);
|
||||||
private static native boolean nIsDoubleSided(long nativeMaterial);
|
private static native boolean nIsDoubleSided(long nativeMaterial);
|
||||||
|
private static native boolean nIsAlphaToCoverageEnabled(long nativeMaterial);
|
||||||
private static native float nGetMaskThreshold(long nativeMaterial);
|
private static native float nGetMaskThreshold(long nativeMaterial);
|
||||||
private static native float nGetSpecularAntiAliasingVariance(long nativeMaterial);
|
private static native float nGetSpecularAntiAliasingVariance(long nativeMaterial);
|
||||||
private static native float nGetSpecularAntiAliasingThreshold(long nativeMaterial);
|
private static native float nGetSpecularAntiAliasingThreshold(long nativeMaterial);
|
||||||
|
|||||||
+430
-27
@@ -20,7 +20,11 @@ import androidx.annotation.IntRange;
|
|||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Size;
|
import androidx.annotation.Size;
|
||||||
|
|
||||||
|
import com.google.android.filament.proguard.UsedByNative;
|
||||||
|
|
||||||
|
@UsedByNative("AssetLoader.cpp")
|
||||||
public class MaterialInstance {
|
public class MaterialInstance {
|
||||||
|
private static final Material.CullingMode[] sCullingModeValues = Material.CullingMode.values();
|
||||||
private Material mMaterial;
|
private Material mMaterial;
|
||||||
private String mName;
|
private String mName;
|
||||||
private long mNativeObject;
|
private long mNativeObject;
|
||||||
@@ -49,6 +53,54 @@ public class MaterialInstance {
|
|||||||
MAT4
|
MAT4
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Operations that control how the stencil buffer is updated.
|
||||||
|
*/
|
||||||
|
public enum StencilOperation {
|
||||||
|
/**
|
||||||
|
* Keeps the current value.
|
||||||
|
*/
|
||||||
|
KEEP,
|
||||||
|
/**
|
||||||
|
* Sets the value to 0.
|
||||||
|
*/
|
||||||
|
ZERO,
|
||||||
|
/**
|
||||||
|
* Sets the value to the stencil reference value.
|
||||||
|
*/
|
||||||
|
REPLACE,
|
||||||
|
/**
|
||||||
|
* Increments the current value. Clamps to the maximum representable unsigned value.
|
||||||
|
*/
|
||||||
|
INCR_CLAMP,
|
||||||
|
/**
|
||||||
|
* Increments the current value. Wraps value to zero when incrementing the maximum
|
||||||
|
* representable unsigned value.
|
||||||
|
*/
|
||||||
|
INCR_WRAP,
|
||||||
|
/**
|
||||||
|
* Decrements the current value. Clamps to 0.
|
||||||
|
*/
|
||||||
|
DECR_CLAMP,
|
||||||
|
/**
|
||||||
|
* Decrements the current value. Wraps value to the maximum representable unsigned value
|
||||||
|
* when decrementing a value of zero.
|
||||||
|
*/
|
||||||
|
DECR_WRAP,
|
||||||
|
/**
|
||||||
|
* Bitwise inverts the current value.
|
||||||
|
*/
|
||||||
|
INVERT,
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum StencilFace {
|
||||||
|
FRONT,
|
||||||
|
BACK,
|
||||||
|
FRONT_AND_BACK
|
||||||
|
}
|
||||||
|
// Converts the StencilFace enum ordinal to Filament's equivalent bit field.
|
||||||
|
static final int[] sStencilFaceMapping = {0x1, 0x2, 0x3};
|
||||||
|
|
||||||
public MaterialInstance(Engine engine, long nativeMaterialInstance) {
|
public MaterialInstance(Engine engine, long nativeMaterialInstance) {
|
||||||
mNativeObject = nativeMaterialInstance;
|
mNativeObject = nativeMaterialInstance;
|
||||||
mNativeMaterial = nGetMaterial(mNativeObject);
|
mNativeMaterial = nGetMaterial(mNativeObject);
|
||||||
@@ -56,6 +108,7 @@ public class MaterialInstance {
|
|||||||
|
|
||||||
MaterialInstance(@NonNull Material material, long nativeMaterialInstance) {
|
MaterialInstance(@NonNull Material material, long nativeMaterialInstance) {
|
||||||
mMaterial = material;
|
mMaterial = material;
|
||||||
|
mNativeMaterial = material.getNativeObject();
|
||||||
mNativeObject = nativeMaterialInstance;
|
mNativeObject = nativeMaterialInstance;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -64,6 +117,22 @@ public class MaterialInstance {
|
|||||||
mNativeMaterial = nGetMaterial(mNativeObject);
|
mNativeMaterial = nGetMaterial(mNativeObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new {@link #MaterialInstance} using another {@link #MaterialInstance} as a template for initialization.
|
||||||
|
* The new {@link #MaterialInstance} is an instance of the same {@link Material} of the template instance and
|
||||||
|
* must be destroyed just like any other {@link #MaterialInstance}.
|
||||||
|
*
|
||||||
|
* @param other A {@link #MaterialInstance} to use as a template for initializing a new instance
|
||||||
|
* @param name A name for the new {@link #MaterialInstance} or nullptr to use the template's name
|
||||||
|
* @return A new {@link #MaterialInstance}
|
||||||
|
*/
|
||||||
|
@NonNull
|
||||||
|
public static MaterialInstance duplicate(@NonNull MaterialInstance other, String name) {
|
||||||
|
long nativeInstance = nDuplicate(other.mNativeObject, name);
|
||||||
|
if (nativeInstance == 0) throw new IllegalStateException("Couldn't duplicate MaterialInstance");
|
||||||
|
return new MaterialInstance(other.getMaterial(), nativeInstance);
|
||||||
|
}
|
||||||
|
|
||||||
/** @return the {@link Material} associated with this instance */
|
/** @return the {@link Material} associated with this instance */
|
||||||
@NonNull
|
@NonNull
|
||||||
public Material getMaterial() {
|
public Material getMaterial() {
|
||||||
@@ -222,6 +291,10 @@ public class MaterialInstance {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets a texture and sampler parameter on this material's default instance.
|
* Sets a texture and sampler parameter on this material's default instance.
|
||||||
|
* <p>
|
||||||
|
* Note: Depth textures can't be sampled with a linear filter unless the comparison mode is set
|
||||||
|
* to COMPARE_TO_TEXTURE.
|
||||||
|
* </p>
|
||||||
*
|
*
|
||||||
* @param name The name of the material texture parameter
|
* @param name The name of the material texture parameter
|
||||||
* @param texture The texture to set as parameter
|
* @param texture The texture to set as parameter
|
||||||
@@ -238,7 +311,7 @@ public class MaterialInstance {
|
|||||||
* @param name name of the parameter array as defined by this Material
|
* @param name name of the parameter array as defined by this Material
|
||||||
* @param type the number of components for each individual parameter
|
* @param type the number of components for each individual parameter
|
||||||
* @param v array of values to set to the named parameter array
|
* @param v array of values to set to the named parameter array
|
||||||
* @param offset the number of elements to skip
|
* @param offset the number of elements in <code>v</code> to skip
|
||||||
* @param count the number of elements in the parameter array to set
|
* @param count the number of elements in the parameter array to set
|
||||||
*
|
*
|
||||||
* <p>For example, to set a parameter array of 4 bool4s:
|
* <p>For example, to set a parameter array of 4 bool4s:
|
||||||
@@ -246,11 +319,6 @@ public class MaterialInstance {
|
|||||||
* boolean[] a = new boolean[4 * 4];
|
* boolean[] a = new boolean[4 * 4];
|
||||||
* instance.setParameter("param", MaterialInstance.BooleanElement.BOOL4, a, 0, 4);
|
* instance.setParameter("param", MaterialInstance.BooleanElement.BOOL4, a, 0, 4);
|
||||||
* }</pre>
|
* }</pre>
|
||||||
* To only set the last 3 elements, specify an offset of 1 and a count of 3:
|
|
||||||
* <pre>{@code
|
|
||||||
* boolean[] a = new boolean[4 * 3];
|
|
||||||
* instance.setParameter("param", MaterialInstance.BooleanElement.BOOL4, a, 1, 3);
|
|
||||||
* }</pre>
|
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
public void setParameter(@NonNull String name,
|
public void setParameter(@NonNull String name,
|
||||||
@@ -265,7 +333,7 @@ public class MaterialInstance {
|
|||||||
* @param name name of the parameter array as defined by this Material
|
* @param name name of the parameter array as defined by this Material
|
||||||
* @param type the number of components for each individual parameter
|
* @param type the number of components for each individual parameter
|
||||||
* @param v array of values to set to the named parameter array
|
* @param v array of values to set to the named parameter array
|
||||||
* @param offset the number of elements to skip
|
* @param offset the number of elements in <code>v</code> to skip
|
||||||
* @param count the number of elements in the parameter array to set
|
* @param count the number of elements in the parameter array to set
|
||||||
*
|
*
|
||||||
* <p>For example, to set a parameter array of 4 int4s:
|
* <p>For example, to set a parameter array of 4 int4s:
|
||||||
@@ -273,11 +341,6 @@ public class MaterialInstance {
|
|||||||
* int[] a = new int[4 * 4];
|
* int[] a = new int[4 * 4];
|
||||||
* instance.setParameter("param", MaterialInstance.IntElement.INT4, a, 0, 4);
|
* instance.setParameter("param", MaterialInstance.IntElement.INT4, a, 0, 4);
|
||||||
* }</pre>
|
* }</pre>
|
||||||
* To only set the last 3 elements, specify an offset of 1 and a count of 3:
|
|
||||||
* <pre>{@code
|
|
||||||
* int[] a = new int[4 * 3];
|
|
||||||
* instance.setParameter("param", MaterialInstance.IntElement.INT4, a, 1, 3);
|
|
||||||
* }</pre>
|
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
public void setParameter(@NonNull String name,
|
public void setParameter(@NonNull String name,
|
||||||
@@ -292,7 +355,7 @@ public class MaterialInstance {
|
|||||||
* @param name name of the parameter array as defined by this Material
|
* @param name name of the parameter array as defined by this Material
|
||||||
* @param type the number of components for each individual parameter
|
* @param type the number of components for each individual parameter
|
||||||
* @param v array of values to set to the named parameter array
|
* @param v array of values to set to the named parameter array
|
||||||
* @param offset the number of elements to skip
|
* @param offset the number of elements in <code>v</code> to skip
|
||||||
* @param count the number of elements in the parameter array to set
|
* @param count the number of elements in the parameter array to set
|
||||||
*
|
*
|
||||||
* <p>For example, to set a parameter array of 4 float4s:
|
* <p>For example, to set a parameter array of 4 float4s:
|
||||||
@@ -300,11 +363,6 @@ public class MaterialInstance {
|
|||||||
* float[] a = new float[4 * 4];
|
* float[] a = new float[4 * 4];
|
||||||
* material.setDefaultParameter("param", MaterialInstance.FloatElement.FLOAT4, a, 0, 4);
|
* material.setDefaultParameter("param", MaterialInstance.FloatElement.FLOAT4, a, 0, 4);
|
||||||
* }</pre>
|
* }</pre>
|
||||||
* To only set the last 3 elements, specify an offset of 1 and a count of 3:
|
|
||||||
* <pre>{@code
|
|
||||||
* float[] a = new float[4 * 3];
|
|
||||||
* material.setDefaultParameter("param", MaterialInstance.FloatElement.FLOAT4, a, 1, 3);
|
|
||||||
* }</pre>
|
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
public void setParameter(@NonNull String name,
|
public void setParameter(@NonNull String name,
|
||||||
@@ -345,19 +403,40 @@ public class MaterialInstance {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set up a custom scissor rectangle; by default this encompasses the View.
|
* Set-up a custom scissor rectangle; by default it is disabled.
|
||||||
*
|
*
|
||||||
* @param left left coordinate of the scissor box
|
* <p>
|
||||||
* @param bottom bottom coordinate of the scissor box
|
* The scissor rectangle gets clipped by the View's viewport, in other words, the scissor
|
||||||
|
* cannot affect fragments outside of the View's Viewport.
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* <p>
|
||||||
|
* Currently the scissor is not compatible with dynamic resolution and should always be
|
||||||
|
* disabled when dynamic resolution is used.
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @param left left coordinate of the scissor box relative to the viewport
|
||||||
|
* @param bottom bottom coordinate of the scissor box relative to the viewport
|
||||||
* @param width width of the scissor box
|
* @param width width of the scissor box
|
||||||
* @param height height of the scissor box
|
* @param height height of the scissor box
|
||||||
|
*
|
||||||
|
* @see #unsetScissor
|
||||||
|
* @see View#setViewport
|
||||||
|
* @see View#setDynamicResolutionOptions
|
||||||
*/
|
*/
|
||||||
public void setScissor(@IntRange(from = 0) int left, @IntRange(from = 0) int bottom,
|
public void setScissor(@IntRange(from = 0) int left, @IntRange(from = 0) int bottom,
|
||||||
@IntRange(from = 0) int width, @IntRange(from = 0) int height) {
|
@IntRange(from = 0) int width, @IntRange(from = 0) int height) {
|
||||||
nSetScissor(getNativeObject(), left, bottom, width, height);
|
nSetScissor(getNativeObject(), left, bottom, width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns the scissor rectangle to its default setting, which encompasses the View. */
|
/**
|
||||||
|
* Returns the scissor rectangle to its default disabled setting.
|
||||||
|
* <p>
|
||||||
|
* Currently the scissor is not compatible with dynamic resolution and should always be
|
||||||
|
* disabled when dynamic resolution is used.
|
||||||
|
* </p>
|
||||||
|
* @see View#setDynamicResolutionOptions
|
||||||
|
*/
|
||||||
public void unsetScissor() {
|
public void unsetScissor() {
|
||||||
nUnsetScissor(getNativeObject());
|
nUnsetScissor(getNativeObject());
|
||||||
}
|
}
|
||||||
@@ -395,6 +474,14 @@ public class MaterialInstance {
|
|||||||
nSetMaskThreshold(getNativeObject(), threshold);
|
nSetMaskThreshold(getNativeObject(), threshold);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the minimum alpha value a fragment must have to not be discarded when the blend
|
||||||
|
* mode is MASKED
|
||||||
|
*/
|
||||||
|
public float getMaskThreshold() {
|
||||||
|
return nGetMaskThreshold(getNativeObject());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the screen space variance of the filter kernel used when applying specular
|
* Sets the screen space variance of the filter kernel used when applying specular
|
||||||
* anti-aliasing. The default value is set to 0.15. The specified value should be between
|
* anti-aliasing. The default value is set to 0.15. The specified value should be between
|
||||||
@@ -408,6 +495,14 @@ public class MaterialInstance {
|
|||||||
nSetSpecularAntiAliasingVariance(getNativeObject(), variance);
|
nSetSpecularAntiAliasingVariance(getNativeObject(), variance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the screen space variance of the filter kernel used when applying specular
|
||||||
|
* anti-aliasing.
|
||||||
|
*/
|
||||||
|
public float getSpecularAntiAliasingVariance() {
|
||||||
|
return nGetSpecularAntiAliasingVariance(getNativeObject());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the clamping threshold used to suppress estimation errors when applying specular
|
* Sets the clamping threshold used to suppress estimation errors when applying specular
|
||||||
* anti-aliasing. The default value is set to 0.2. The specified value should be between 0
|
* anti-aliasing. The default value is set to 0.2. The specified value should be between 0
|
||||||
@@ -421,6 +516,14 @@ public class MaterialInstance {
|
|||||||
nSetSpecularAntiAliasingThreshold(getNativeObject(), threshold);
|
nSetSpecularAntiAliasingThreshold(getNativeObject(), threshold);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the clamping threshold used to suppress estimation errors when applying specular
|
||||||
|
* anti-aliasing.
|
||||||
|
*/
|
||||||
|
public float getSpecularAntiAliasingThreshold() {
|
||||||
|
return nGetSpecularAntiAliasingThreshold(getNativeObject());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enables or disables double-sided lighting if the parent Material has double-sided capability,
|
* Enables or disables double-sided lighting if the parent Material has double-sided capability,
|
||||||
* otherwise prints a warning. If double-sided lighting is enabled, backface culling is
|
* otherwise prints a warning. If double-sided lighting is enabled, backface culling is
|
||||||
@@ -434,6 +537,14 @@ public class MaterialInstance {
|
|||||||
nSetDoubleSided(getNativeObject(), doubleSided);
|
nSetDoubleSided(getNativeObject(), doubleSided);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns whether double-sided lighting is enabled when the parent Material has double-sided
|
||||||
|
* capability.
|
||||||
|
*/
|
||||||
|
public boolean isDoubleSided() {
|
||||||
|
return nIsDoubleSided(getNativeObject());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Overrides the default triangle culling state that was set on the material.
|
* Overrides the default triangle culling state that was set on the material.
|
||||||
*
|
*
|
||||||
@@ -441,10 +552,18 @@ public class MaterialInstance {
|
|||||||
* <a href="https://google.github.io/filament/Materials.html#materialdefinitions/materialblock/rasterization:culling">
|
* <a href="https://google.github.io/filament/Materials.html#materialdefinitions/materialblock/rasterization:culling">
|
||||||
* Rasterization: culling</a>
|
* Rasterization: culling</a>
|
||||||
*/
|
*/
|
||||||
public void setCullingMode(Material.CullingMode mode) {
|
public void setCullingMode(@NonNull Material.CullingMode mode) {
|
||||||
nSetCullingMode(getNativeObject(), mode.ordinal());
|
nSetCullingMode(getNativeObject(), mode.ordinal());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the face culling mode.
|
||||||
|
*/
|
||||||
|
@NonNull
|
||||||
|
public Material.CullingMode getCullingMode() {
|
||||||
|
return sCullingModeValues[nGetCullingMode(getNativeObject())];
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Overrides the default color-buffer write state that was set on the material.
|
* Overrides the default color-buffer write state that was set on the material.
|
||||||
*
|
*
|
||||||
@@ -452,10 +571,17 @@ public class MaterialInstance {
|
|||||||
* <a href="https://google.github.io/filament/Materials.html#materialdefinitions/materialblock/rasterization:colorWrite">
|
* <a href="https://google.github.io/filament/Materials.html#materialdefinitions/materialblock/rasterization:colorWrite">
|
||||||
* Rasterization: colorWrite</a>
|
* Rasterization: colorWrite</a>
|
||||||
*/
|
*/
|
||||||
void setColorWrite(boolean enable) {
|
public void setColorWrite(boolean enable) {
|
||||||
nSetColorWrite(getNativeObject(), enable);
|
nSetColorWrite(getNativeObject(), enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns whether color write is enabled.
|
||||||
|
*/
|
||||||
|
public boolean isColorWriteEnabled() {
|
||||||
|
return nIsColorWriteEnabled(getNativeObject());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Overrides the default depth-buffer write state that was set on the material.
|
* Overrides the default depth-buffer write state that was set on the material.
|
||||||
*
|
*
|
||||||
@@ -463,10 +589,31 @@ public class MaterialInstance {
|
|||||||
* <a href="https://google.github.io/filament/Materials.html#materialdefinitions/materialblock/rasterization:depthWrite">
|
* <a href="https://google.github.io/filament/Materials.html#materialdefinitions/materialblock/rasterization:depthWrite">
|
||||||
* Rasterization: depthWrite</a>
|
* Rasterization: depthWrite</a>
|
||||||
*/
|
*/
|
||||||
void setDepthWrite(boolean enable) {
|
public void setDepthWrite(boolean enable) {
|
||||||
nSetDepthWrite(getNativeObject(), enable);
|
nSetDepthWrite(getNativeObject(), enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns whether depth write is enabled.
|
||||||
|
*/
|
||||||
|
public boolean isDepthWriteEnabled() {
|
||||||
|
return nIsDepthWriteEnabled(getNativeObject());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables or Disable stencil writes
|
||||||
|
*/
|
||||||
|
public void setStencilWrite(boolean enable) {
|
||||||
|
nSetStencilWrite(getNativeObject(), enable);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns whether stencil write is enabled.
|
||||||
|
*/
|
||||||
|
public boolean isStencilWriteEnabled() {
|
||||||
|
return nIsStencilWriteEnabled(getNativeObject());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Overrides the default depth testing state that was set on the material.
|
* Overrides the default depth testing state that was set on the material.
|
||||||
*
|
*
|
||||||
@@ -474,10 +621,235 @@ public class MaterialInstance {
|
|||||||
* <a href="https://google.github.io/filament/Materials.html#materialdefinitions/materialblock/rasterization:depthCulling">
|
* <a href="https://google.github.io/filament/Materials.html#materialdefinitions/materialblock/rasterization:depthCulling">
|
||||||
* Rasterization: depthCulling</a>
|
* Rasterization: depthCulling</a>
|
||||||
*/
|
*/
|
||||||
void setDepthCulling(boolean enable) {
|
public void setDepthCulling(boolean enable) {
|
||||||
nSetDepthCulling(getNativeObject(), enable);
|
nSetDepthCulling(getNativeObject(), enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the depth comparison function (default is {@link TextureSampler.CompareFunction#GE}).
|
||||||
|
*
|
||||||
|
* @param func the depth comparison function
|
||||||
|
*/
|
||||||
|
public void setDepthFunc(TextureSampler.CompareFunction func) {
|
||||||
|
nSetDepthFunc(getNativeObject(), func.ordinal());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns whether depth culling is enabled.
|
||||||
|
*/
|
||||||
|
public boolean isDepthCullingEnabled() {
|
||||||
|
return nIsDepthCullingEnabled(getNativeObject());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the depth comparison function.
|
||||||
|
*/
|
||||||
|
public TextureSampler.CompareFunction getDepthFunc() {
|
||||||
|
return TextureSampler.EnumCache.sCompareFunctionValues[nGetDepthFunc(getNativeObject())];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the stencil comparison function (default is {@link TextureSampler.CompareFunction#ALWAYS}).
|
||||||
|
*
|
||||||
|
* <p>
|
||||||
|
* It's possible to set separate stencil comparison functions; one for front-facing polygons,
|
||||||
|
* and one for back-facing polygons. The face parameter determines the comparison function(s)
|
||||||
|
* updated by this call.
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @param func the stencil comparison function
|
||||||
|
* @param face the faces to update the comparison function for
|
||||||
|
*/
|
||||||
|
public void setStencilCompareFunction(TextureSampler.CompareFunction func, StencilFace face) {
|
||||||
|
nSetStencilCompareFunction(getNativeObject(), func.ordinal(),
|
||||||
|
sStencilFaceMapping[face.ordinal()]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the stencil comparison function for both front and back-facing polygons.
|
||||||
|
* @see #setStencilCompareFunction(TextureSampler.CompareFunction, StencilFace)
|
||||||
|
*/
|
||||||
|
public void setStencilCompareFunction(TextureSampler.CompareFunction func) {
|
||||||
|
setStencilCompareFunction(func, StencilFace.FRONT_AND_BACK);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the stencil fail operation (default is {@link StencilOperation#KEEP}).
|
||||||
|
*
|
||||||
|
* <p>
|
||||||
|
* The stencil fail operation is performed to update values in the stencil buffer when the
|
||||||
|
* stencil test fails.
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* <p>
|
||||||
|
* It's possible to set separate stencil fail operations; one for front-facing polygons, and one
|
||||||
|
* for back-facing polygons. The face parameter determines the stencil fail operation(s) updated
|
||||||
|
* by this call.
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @param op the stencil fail operation
|
||||||
|
* @param face the faces to update the stencil fail operation for
|
||||||
|
*/
|
||||||
|
public void setStencilOpStencilFail(StencilOperation op, StencilFace face) {
|
||||||
|
nSetStencilOpStencilFail(getNativeObject(), op.ordinal(),
|
||||||
|
sStencilFaceMapping[face.ordinal()]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the stencil fail operation for both front and back-facing polygons.
|
||||||
|
* @see #setStencilOpStencilFail(StencilOperation, StencilFace)
|
||||||
|
*/
|
||||||
|
public void setStencilOpStencilFail(StencilOperation op) {
|
||||||
|
setStencilOpStencilFail(op, StencilFace.FRONT_AND_BACK);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the depth fail operation (default is {@link StencilOperation#KEEP}).
|
||||||
|
*
|
||||||
|
* <p>
|
||||||
|
* The depth fail operation is performed to update values in the stencil buffer when the depth
|
||||||
|
* test fails.
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* <p>
|
||||||
|
* It's possible to set separate depth fail operations; one for front-facing polygons, and one
|
||||||
|
* for back-facing polygons. The face parameter determines the depth fail operation(s) updated
|
||||||
|
* by this call.
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @param op the depth fail operation
|
||||||
|
* @param face the faces to update the depth fail operation for
|
||||||
|
*/
|
||||||
|
public void setStencilOpDepthFail(StencilOperation op, StencilFace face) {
|
||||||
|
nSetStencilOpDepthFail(getNativeObject(), op.ordinal(),
|
||||||
|
sStencilFaceMapping[face.ordinal()]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the depth fail operation for both front and back-facing polygons.
|
||||||
|
* @see #setStencilOpDepthFail(StencilOperation, StencilFace)
|
||||||
|
*/
|
||||||
|
public void setStencilOpDepthFail(StencilOperation op) {
|
||||||
|
setStencilOpDepthFail(op, StencilFace.FRONT_AND_BACK);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the depth-stencil pass operation (default is {@link StencilOperation#KEEP}).
|
||||||
|
*
|
||||||
|
* <p>
|
||||||
|
* The depth-stencil pass operation is performed to update values in the stencil buffer when
|
||||||
|
* both the stencil test and depth test pass.
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* <p>
|
||||||
|
* It's possible to set separate depth-stencil pass operations; one for front-facing polygons,
|
||||||
|
* and one for back-facing polygons. The face parameter determines the depth-stencil pass
|
||||||
|
* operation(s) updated by this call.
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @param op the depth-stencil pass operation
|
||||||
|
* @param face the faces to update the depth-stencil operation for
|
||||||
|
*/
|
||||||
|
public void setStencilOpDepthStencilPass(StencilOperation op, StencilFace face) {
|
||||||
|
nSetStencilOpDepthStencilPass(getNativeObject(), op.ordinal(),
|
||||||
|
sStencilFaceMapping[face.ordinal()]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the depth-stencil pass operation for both front and back-facing polygons.
|
||||||
|
* @see #setStencilOpDepthStencilPass(StencilOperation, StencilFace)
|
||||||
|
*/
|
||||||
|
public void setStencilOpDepthStencilPass(StencilOperation op) {
|
||||||
|
setStencilOpDepthStencilPass(op, StencilFace.FRONT_AND_BACK);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the stencil reference value (default is 0).
|
||||||
|
*
|
||||||
|
* <p>
|
||||||
|
* The stencil reference value is the left-hand side for stencil comparison tests. It's also
|
||||||
|
* used as the replacement stencil value when {@link StencilOperation} is
|
||||||
|
* {@link StencilOperation#REPLACE}.
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* <p>
|
||||||
|
* It's possible to set separate stencil reference values; one for front-facing polygons, and
|
||||||
|
* one for back-facing polygons. The face parameter determines the reference value(s) updated by
|
||||||
|
* this call.
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @param value the stencil reference value (only the least significant 8 bits are used)
|
||||||
|
* @param face the faces to update the reference value for
|
||||||
|
*/
|
||||||
|
public void setStencilReferenceValue(@IntRange(from = 0, to = 255) int value, StencilFace face) {
|
||||||
|
nSetStencilReferenceValue(getNativeObject(), value, sStencilFaceMapping[face.ordinal()]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the stencil reference value for both front and back-facing polygons.
|
||||||
|
* @see #setStencilReferenceValue(int, StencilFace)
|
||||||
|
*/
|
||||||
|
public void setStencilReferenceValue(@IntRange(from = 0, to = 255) int value) {
|
||||||
|
setStencilReferenceValue(value, StencilFace.FRONT_AND_BACK);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the stencil read mask (default is 0xFF).
|
||||||
|
*
|
||||||
|
* <p>
|
||||||
|
* The stencil read mask masks the bits of the values participating in the stencil comparison
|
||||||
|
* test- both the value read from the stencil buffer and the reference value.
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* <p>
|
||||||
|
* It's possible to set separate stencil read masks; one for front-facing polygons, and one for
|
||||||
|
* back-facing polygons. The face parameter determines the stencil read mask(s) updated by this
|
||||||
|
* call.
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @param readMask the read mask (only the least significant 8 bits are used)
|
||||||
|
* @param face the faces to update the read mask for
|
||||||
|
*/
|
||||||
|
public void setStencilReadMask(@IntRange(from = 0, to = 255) int readMask, StencilFace face) {
|
||||||
|
nSetStencilReadMask(getNativeObject(), readMask, sStencilFaceMapping[face.ordinal()]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the stencil read mask for both front and back-facing polygons.
|
||||||
|
* @see #setStencilReadMask(int, StencilFace)
|
||||||
|
*/
|
||||||
|
public void setStencilReadMask(@IntRange(from = 0, to = 255) int readMask) {
|
||||||
|
setStencilReadMask(readMask, StencilFace.FRONT_AND_BACK);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the stencil write mask (default is 0xFF).
|
||||||
|
*
|
||||||
|
* <p>
|
||||||
|
* The stencil write mask masks the bits in the stencil buffer updated by stencil operations.
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* <p>
|
||||||
|
* It's possible to set separate stencil write masks; one for front-facing polygons, and one for
|
||||||
|
* back-facing polygons. The face parameter determines the stencil write mask(s) updated by this
|
||||||
|
* call.
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @param writeMask the write mask (only the least significant 8 bits are used)
|
||||||
|
* @param face the faces to update the read mask for
|
||||||
|
*/
|
||||||
|
public void setStencilWriteMask(@IntRange(from = 0, to = 255) int writeMask, StencilFace face) {
|
||||||
|
nSetStencilWriteMask(getNativeObject(), writeMask, sStencilFaceMapping[face.ordinal()]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the stencil write mask for both front and back-facing polygons.
|
||||||
|
* @see #setStencilWriteMask(int, StencilFace)
|
||||||
|
*/
|
||||||
|
public void setStencilWriteMask(int writeMask) {
|
||||||
|
setStencilWriteMask(writeMask, StencilFace.FRONT_AND_BACK);
|
||||||
|
}
|
||||||
|
|
||||||
public long getNativeObject() {
|
public long getNativeObject() {
|
||||||
if (mNativeObject == 0) {
|
if (mNativeObject == 0) {
|
||||||
throw new IllegalStateException("Calling method on destroyed MaterialInstance");
|
throw new IllegalStateException("Calling method on destroyed MaterialInstance");
|
||||||
@@ -528,7 +900,7 @@ public class MaterialInstance {
|
|||||||
@IntRange(from = 0) int offset, @IntRange(from = 1) int count);
|
@IntRange(from = 0) int offset, @IntRange(from = 1) int count);
|
||||||
|
|
||||||
private static native void nSetParameterTexture(long nativeMaterialInstance,
|
private static native void nSetParameterTexture(long nativeMaterialInstance,
|
||||||
@NonNull String name, long nativeTexture, int sampler);
|
@NonNull String name, long nativeTexture, long sampler);
|
||||||
|
|
||||||
private static native void nSetScissor(long nativeMaterialInstance,
|
private static native void nSetScissor(long nativeMaterialInstance,
|
||||||
@IntRange(from = 0) int left, @IntRange(from = 0) int bottom,
|
@IntRange(from = 0) int left, @IntRange(from = 0) int bottom,
|
||||||
@@ -550,8 +922,39 @@ public class MaterialInstance {
|
|||||||
private static native void nSetCullingMode(long nativeMaterialInstance, long mode);
|
private static native void nSetCullingMode(long nativeMaterialInstance, long mode);
|
||||||
private static native void nSetColorWrite(long nativeMaterialInstance, boolean enable);
|
private static native void nSetColorWrite(long nativeMaterialInstance, boolean enable);
|
||||||
private static native void nSetDepthWrite(long nativeMaterialInstance, boolean enable);
|
private static native void nSetDepthWrite(long nativeMaterialInstance, boolean enable);
|
||||||
|
private static native void nSetStencilWrite(long nativeMaterialInstance, boolean enable);
|
||||||
private static native void nSetDepthCulling(long nativeMaterialInstance, boolean enable);
|
private static native void nSetDepthCulling(long nativeMaterialInstance, boolean enable);
|
||||||
|
private static native void nSetDepthFunc(long nativeMaterialInstance, long function);
|
||||||
|
|
||||||
|
private static native void nSetStencilCompareFunction(long nativeMaterialInstance,
|
||||||
|
long function, long face);
|
||||||
|
private static native void nSetStencilOpStencilFail(long nativeMaterialInstance, long op,
|
||||||
|
long face);
|
||||||
|
private static native void nSetStencilOpDepthFail(long nativeMaterialInstance, long op,
|
||||||
|
long face);
|
||||||
|
private static native void nSetStencilOpDepthStencilPass(long nativeMaterialInstance, long op,
|
||||||
|
long face);
|
||||||
|
private static native void nSetStencilReferenceValue(long nativeMaterialInstance, int value,
|
||||||
|
long face);
|
||||||
|
private static native void nSetStencilReadMask(long nativeMaterialInstance, int readMask,
|
||||||
|
long face);
|
||||||
|
private static native void nSetStencilWriteMask(long nativeMaterialInstance, int writeMask,
|
||||||
|
long face);
|
||||||
|
|
||||||
private static native String nGetName(long nativeMaterialInstance);
|
private static native String nGetName(long nativeMaterialInstance);
|
||||||
private static native long nGetMaterial(long nativeMaterialInstance);
|
private static native long nGetMaterial(long nativeMaterialInstance);
|
||||||
|
|
||||||
|
private static native long nDuplicate(long otherNativeMaterialInstance, String name);
|
||||||
|
|
||||||
|
|
||||||
|
private static native float nGetMaskThreshold(long nativeMaterialInstance);
|
||||||
|
private static native float nGetSpecularAntiAliasingVariance(long nativeMaterialInstance);
|
||||||
|
private static native float nGetSpecularAntiAliasingThreshold(long nativeMaterialInstance);
|
||||||
|
private static native boolean nIsDoubleSided(long nativeMaterialInstance);
|
||||||
|
private static native int nGetCullingMode(long nativeMaterialInstance);
|
||||||
|
private static native boolean nIsColorWriteEnabled(long nativeMaterialInstance);
|
||||||
|
private static native boolean nIsDepthWriteEnabled(long nativeMaterialInstance);
|
||||||
|
private static native boolean nIsStencilWriteEnabled(long nativeMaterialInstance);
|
||||||
|
private static native boolean nIsDepthCullingEnabled(long nativeMaterialInstance);
|
||||||
|
private static native int nGetDepthFunc(long nativeMaterialInstance);
|
||||||
}
|
}
|
||||||
|
|||||||
+180
@@ -0,0 +1,180 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2022 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.google.android.filament;
|
||||||
|
|
||||||
|
import androidx.annotation.IntRange;
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
|
import java.nio.Buffer;
|
||||||
|
import java.nio.BufferOverflowException;
|
||||||
|
import java.nio.FloatBuffer;
|
||||||
|
|
||||||
|
public class MorphTargetBuffer {
|
||||||
|
private long mNativeObject;
|
||||||
|
private MorphTargetBuffer(long nativeMorphTargetBuffer) {
|
||||||
|
mNativeObject = nativeMorphTargetBuffer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Builder {
|
||||||
|
@SuppressWarnings({"FieldCanBeLocal", "UnusedDeclaration"})
|
||||||
|
// Keep to finalize native resources
|
||||||
|
private final MorphTargetBuffer.Builder.BuilderFinalizer mFinalizer;
|
||||||
|
private final long mNativeBuilder;
|
||||||
|
|
||||||
|
public Builder() {
|
||||||
|
mNativeBuilder = nCreateBuilder();
|
||||||
|
mFinalizer = new MorphTargetBuffer.Builder.BuilderFinalizer(mNativeBuilder);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Size of the morph targets in vertex counts.
|
||||||
|
*
|
||||||
|
* @param vertexCount Number of vertex counts the morph targets can hold.
|
||||||
|
* @return this <code>Builder</code> object for chaining calls
|
||||||
|
*/
|
||||||
|
@NonNull
|
||||||
|
public Builder vertexCount(@IntRange(from = 1) int vertexCount) {
|
||||||
|
nBuilderVertexCount(mNativeBuilder, vertexCount);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Size of the morph targets in targets.
|
||||||
|
*
|
||||||
|
* @param count Number of targets the morph targets can hold.
|
||||||
|
* @return this <code>Builder</code> object for chaining calls
|
||||||
|
*/
|
||||||
|
@NonNull
|
||||||
|
public Builder count(@IntRange(from = 1) int count) {
|
||||||
|
nBuilderCount(mNativeBuilder, count);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates and returns the <code>MorphTargetBuffer</code> object.
|
||||||
|
*
|
||||||
|
* @param engine reference to the {@link Engine} to associate this <code>MorphTargetBuffer</code>
|
||||||
|
* with.
|
||||||
|
*
|
||||||
|
* @return the newly created <code>MorphTargetBuffer</code> object
|
||||||
|
*
|
||||||
|
* @exception IllegalStateException if the MorphTargetBuffer could not be created
|
||||||
|
*
|
||||||
|
* @see #setMorphTargetBufferAt
|
||||||
|
*/
|
||||||
|
@NonNull
|
||||||
|
public MorphTargetBuffer build(@NonNull Engine engine) {
|
||||||
|
long nativeMorphTargetBuffer = nBuilderBuild(mNativeBuilder, engine.getNativeObject());
|
||||||
|
if (nativeMorphTargetBuffer == 0)
|
||||||
|
throw new IllegalStateException("Couldn't create MorphTargetBuffer");
|
||||||
|
return new MorphTargetBuffer(nativeMorphTargetBuffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class BuilderFinalizer {
|
||||||
|
private final long mNativeObject;
|
||||||
|
|
||||||
|
BuilderFinalizer(long nativeObject) {
|
||||||
|
mNativeObject = nativeObject;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void finalize() {
|
||||||
|
try {
|
||||||
|
super.finalize();
|
||||||
|
} catch (Throwable t) { // Ignore
|
||||||
|
} finally {
|
||||||
|
nDestroyBuilder(mNativeObject);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates float4 positions for the given morph target.
|
||||||
|
*
|
||||||
|
* @param engine {@link Engine} instance
|
||||||
|
* @param targetIndex The index of morph target to be updated
|
||||||
|
* @param positions An array with at least count*4 floats
|
||||||
|
* @param count Number of float4 vectors in positions to be consumed
|
||||||
|
*/
|
||||||
|
public void setPositionsAt(@NonNull Engine engine,
|
||||||
|
@IntRange(from = 0) int targetIndex,
|
||||||
|
@NonNull float[] positions, @IntRange(from = 0, to = 125) int count) {
|
||||||
|
int result = nSetPositionsAt(mNativeObject, engine.getNativeObject(), targetIndex,
|
||||||
|
positions, count);
|
||||||
|
if (result < 0) {
|
||||||
|
throw new BufferOverflowException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates tangents for the given morph target.
|
||||||
|
*
|
||||||
|
* These quaternions must be represented as signed shorts, where real numbers in the [-1,+1]
|
||||||
|
* range multiplied by 32767.
|
||||||
|
*
|
||||||
|
* @param engine {@link Engine} instance
|
||||||
|
* @param targetIndex The index of morph target to be updated
|
||||||
|
* @param tangents An array with at least "count*4" shorts
|
||||||
|
* @param count number of short4 quaternions in tangents
|
||||||
|
*/
|
||||||
|
public void setTangentsAt(@NonNull Engine engine,
|
||||||
|
@IntRange(from = 0) int targetIndex,
|
||||||
|
@NonNull short[] tangents, @IntRange(from = 0, to = 125) int count) {
|
||||||
|
int result = nSetTangentsAt(mNativeObject, engine.getNativeObject(), targetIndex,
|
||||||
|
tangents, count);
|
||||||
|
if (result < 0) {
|
||||||
|
throw new BufferOverflowException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return number of vertices in this {@link MorphTargetBuffer}
|
||||||
|
*/
|
||||||
|
public int getVertexCount() {
|
||||||
|
return nGetVertexCount(mNativeObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return number of morph targets in this {@link MorphTargetBuffer}
|
||||||
|
*/
|
||||||
|
public int getCount() {
|
||||||
|
return nGetCount(mNativeObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getNativeObject() {
|
||||||
|
if (mNativeObject == 0) {
|
||||||
|
throw new IllegalStateException("Calling method on destroyed MorphTargetBuffer");
|
||||||
|
}
|
||||||
|
return mNativeObject;
|
||||||
|
}
|
||||||
|
|
||||||
|
void clearNativeObject() {
|
||||||
|
mNativeObject = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static native long nCreateBuilder();
|
||||||
|
private static native void nDestroyBuilder(long nativeBuilder);
|
||||||
|
private static native void nBuilderVertexCount(long nativeBuilder, int vertexCount);
|
||||||
|
private static native void nBuilderCount(long nativeBuilder, int count);
|
||||||
|
private static native long nBuilderBuild(long nativeBuilder, long nativeEngine);
|
||||||
|
|
||||||
|
private static native int nSetPositionsAt(long nativeObject, long nativeEngine, int targetIndex, float[] positions, int count);
|
||||||
|
private static native int nSetTangentsAt(long nativeObject, long nativeEngine, int targetIndex, short[] tangents, int count);
|
||||||
|
private static native int nGetVertexCount(long nativeObject);
|
||||||
|
private static native int nGetCount(long nativeObject);
|
||||||
|
}
|
||||||
+15
-8
@@ -31,13 +31,15 @@ import androidx.annotation.Nullable;
|
|||||||
* @see View
|
* @see View
|
||||||
*/
|
*/
|
||||||
public class RenderTarget {
|
public class RenderTarget {
|
||||||
|
private static final int ATTACHMENT_COUNT = AttachmentPoint.values().length;
|
||||||
|
private static final Texture.CubemapFace[] sCubemapFaceValues = Texture.CubemapFace.values();
|
||||||
|
|
||||||
private long mNativeObject;
|
private long mNativeObject;
|
||||||
private final Texture[] mTextures = new Texture[2];
|
private final Texture[] mTextures = new Texture[ATTACHMENT_COUNT];
|
||||||
|
|
||||||
private RenderTarget(long nativeRenderTarget, Builder builder) {
|
private RenderTarget(long nativeRenderTarget, Builder builder) {
|
||||||
mNativeObject = nativeRenderTarget;
|
mNativeObject = nativeRenderTarget;
|
||||||
mTextures[0] = builder.mTextures[0];
|
System.arraycopy(builder.mTextures, 0, mTextures, 0, ATTACHMENT_COUNT);
|
||||||
mTextures[1] = builder.mTextures[1];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getNativeObject() {
|
public long getNativeObject() {
|
||||||
@@ -52,7 +54,14 @@ public class RenderTarget {
|
|||||||
*/
|
*/
|
||||||
public enum AttachmentPoint {
|
public enum AttachmentPoint {
|
||||||
COLOR,
|
COLOR,
|
||||||
DEPTH,
|
COLOR1,
|
||||||
|
COLOR2,
|
||||||
|
COLOR3,
|
||||||
|
COLOR4,
|
||||||
|
COLOR5,
|
||||||
|
COLOR6,
|
||||||
|
COLOR7,
|
||||||
|
DEPTH
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -62,7 +71,7 @@ public class RenderTarget {
|
|||||||
@SuppressWarnings({"FieldCanBeLocal", "UnusedDeclaration"})
|
@SuppressWarnings({"FieldCanBeLocal", "UnusedDeclaration"})
|
||||||
private final BuilderFinalizer mFinalizer;
|
private final BuilderFinalizer mFinalizer;
|
||||||
private final long mNativeBuilder;
|
private final long mNativeBuilder;
|
||||||
private final Texture[] mTextures = new Texture[2];
|
private final Texture[] mTextures = new Texture[ATTACHMENT_COUNT];
|
||||||
|
|
||||||
public Builder() {
|
public Builder() {
|
||||||
mNativeBuilder = nCreateBuilder();
|
mNativeBuilder = nCreateBuilder();
|
||||||
@@ -72,8 +81,6 @@ public class RenderTarget {
|
|||||||
/**
|
/**
|
||||||
* Sets a texture to a given attachment point.
|
* Sets a texture to a given attachment point.
|
||||||
*
|
*
|
||||||
* <p>All RenderTargets must have a non-null <code>COLOR</code> attachment.</p>
|
|
||||||
*
|
|
||||||
* @param attachment The attachment point of the texture.
|
* @param attachment The attachment point of the texture.
|
||||||
* @param texture The associated texture object.
|
* @param texture The associated texture object.
|
||||||
* @return A reference to this Builder for chaining calls.
|
* @return A reference to this Builder for chaining calls.
|
||||||
@@ -187,7 +194,7 @@ public class RenderTarget {
|
|||||||
* a cubemap.
|
* a cubemap.
|
||||||
*/
|
*/
|
||||||
public Texture.CubemapFace getFace(AttachmentPoint attachment) {
|
public Texture.CubemapFace getFace(AttachmentPoint attachment) {
|
||||||
return Texture.CubemapFace.values()[nGetFace(getNativeObject(), attachment.ordinal())];
|
return sCubemapFaceValues[nGetFace(getNativeObject(), attachment.ordinal())];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
+372
-36
@@ -58,6 +58,10 @@ import java.util.Set;
|
|||||||
*/
|
*/
|
||||||
public class RenderableManager {
|
public class RenderableManager {
|
||||||
private static final String LOG_TAG = "Filament";
|
private static final String LOG_TAG = "Filament";
|
||||||
|
|
||||||
|
private static final VertexBuffer.VertexAttribute[] sVertexAttributeValues =
|
||||||
|
VertexBuffer.VertexAttribute.values();
|
||||||
|
|
||||||
private long mNativeObject;
|
private long mNativeObject;
|
||||||
|
|
||||||
RenderableManager(long nativeRenderableManager) {
|
RenderableManager(long nativeRenderableManager) {
|
||||||
@@ -92,7 +96,9 @@ public class RenderableManager {
|
|||||||
public enum PrimitiveType {
|
public enum PrimitiveType {
|
||||||
POINTS(0),
|
POINTS(0),
|
||||||
LINES(1),
|
LINES(1),
|
||||||
TRIANGLES(4);
|
LINE_STRIP(3),
|
||||||
|
TRIANGLES(4),
|
||||||
|
TRIANGLE_STRIP(5);
|
||||||
|
|
||||||
private final int mType;
|
private final int mType;
|
||||||
PrimitiveType(int value) { mType = value; }
|
PrimitiveType(int value) { mType = value; }
|
||||||
@@ -113,7 +119,7 @@ public class RenderableManager {
|
|||||||
* @param count the number of primitives that will be supplied to the builder
|
* @param count the number of primitives that will be supplied to the builder
|
||||||
*
|
*
|
||||||
* Note that builders typically do not have a long lifetime since clients should discard
|
* Note that builders typically do not have a long lifetime since clients should discard
|
||||||
* them after calling build(). For a usage example, see {@link RenderableManager}.
|
* them after calling {@link #build}. For a usage example, see {@link RenderableManager}.
|
||||||
*/
|
*/
|
||||||
public Builder(@IntRange(from = 1) int count) {
|
public Builder(@IntRange(from = 1) int count) {
|
||||||
mNativeBuilder = nCreateBuilder(count);
|
mNativeBuilder = nCreateBuilder(count);
|
||||||
@@ -128,7 +134,7 @@ public class RenderableManager {
|
|||||||
* <code>geometry()</code> and <code>material()</code>.
|
* <code>geometry()</code> and <code>material()</code>.
|
||||||
*
|
*
|
||||||
* @param index zero-based index of the primitive, must be less than the count passed to Builder constructor
|
* @param index zero-based index of the primitive, must be less than the count passed to Builder constructor
|
||||||
* @param type specifies the topology of the primitive (e.g., PrimitiveType.TRIANGLES)
|
* @param type specifies the topology of the primitive (e.g., {@link PrimitiveType#TRIANGLES})
|
||||||
* @param vertices specifies the vertex buffer, which in turn specifies a set of attributes
|
* @param vertices specifies the vertex buffer, which in turn specifies a set of attributes
|
||||||
* @param indices specifies the index buffer (either u16 or u32)
|
* @param indices specifies the index buffer (either u16 or u32)
|
||||||
* @param offset specifies where in the index buffer to start reading (expressed as a number of indices)
|
* @param offset specifies where in the index buffer to start reading (expressed as a number of indices)
|
||||||
@@ -147,7 +153,7 @@ public class RenderableManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* For details, see the {@link RenderableManager.Builder#geometry primary overload}.
|
* For details, see the {@link RenderableManager.Builder#geometry} primary overload.
|
||||||
*/
|
*/
|
||||||
@NonNull
|
@NonNull
|
||||||
public Builder geometry(@IntRange(from = 0) int index, @NonNull PrimitiveType type,
|
public Builder geometry(@IntRange(from = 0) int index, @NonNull PrimitiveType type,
|
||||||
@@ -159,7 +165,7 @@ public class RenderableManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* For details, see the {@link RenderableManager.Builder#geometry primary overload}.
|
* For details, see the {@link RenderableManager.Builder#geometry} primary overload.
|
||||||
*/
|
*/
|
||||||
@NonNull
|
@NonNull
|
||||||
public Builder geometry(@IntRange(from = 0) int index, @NonNull PrimitiveType type,
|
public Builder geometry(@IntRange(from = 0) int index, @NonNull PrimitiveType type,
|
||||||
@@ -185,7 +191,9 @@ public class RenderableManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets an ordering index for blended primitives that all live at the same Z value.
|
* Sets the drawing order for blended primitives. The drawing order is either global or
|
||||||
|
* local (default) to this Renderable. In either case, the Renderable priority takes
|
||||||
|
* precedence.
|
||||||
*
|
*
|
||||||
* @param index the primitive of interest
|
* @param index the primitive of interest
|
||||||
* @param blendOrder draw order number (0 by default). Only the lowest 15 bits are used.
|
* @param blendOrder draw order number (0 by default). Only the lowest 15 bits are used.
|
||||||
@@ -197,6 +205,18 @@ public class RenderableManager {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets whether the blend order is global or local to this Renderable (by default).
|
||||||
|
*
|
||||||
|
* @param index the primitive of interest
|
||||||
|
* @param enabled true for global, false for local blend ordering.
|
||||||
|
*/
|
||||||
|
@NonNull
|
||||||
|
public Builder globalBlendOrderEnabled(@IntRange(from = 0) int index, boolean enabled) {
|
||||||
|
nBuilderGlobalBlendOrderEnabled(mNativeBuilder, index, enabled);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The axis-aligned bounding box of the renderable.
|
* The axis-aligned bounding box of the renderable.
|
||||||
*
|
*
|
||||||
@@ -237,23 +257,79 @@ public class RenderableManager {
|
|||||||
* Provides coarse-grained control over draw order.
|
* Provides coarse-grained control over draw order.
|
||||||
*
|
*
|
||||||
* <p>In general Filament reserves the right to re-order renderables to allow for efficient
|
* <p>In general Filament reserves the right to re-order renderables to allow for efficient
|
||||||
* rendering. However clients can control ordering at a coarse level using <em>priority</em>.</p>
|
* rendering. However clients can control ordering at a coarse level using \em priority.
|
||||||
|
* The priority is applied separately for opaque and translucent objects, that is, opaque
|
||||||
|
* objects are always drawn before translucent objects regardless of the priority.</p>
|
||||||
*
|
*
|
||||||
* <p>For example, this could be used to draw a semitransparent HUD, if a client wishes to
|
* <p>For example, this could be used to draw a semitransparent HUD, if a client wishes to
|
||||||
* avoid using a separate View for the HUD. Note that priority is completely orthogonal to
|
* avoid using a separate View for the HUD. Note that priority is completely orthogonal to
|
||||||
* {@link Builder#layerMask}, which merely controls visibility.</p>
|
* {@link Builder#layerMask}, which merely controls visibility.</p>
|
||||||
|
|
||||||
|
* <p>The Skybox always using the lowest priority, so it's drawn last, which may improve
|
||||||
|
* performance.</p>
|
||||||
*
|
*
|
||||||
* <p>The priority is clamped to the range [0..7], defaults to 4; 7 is lowest priority
|
* <p>The priority is clamped to the range [0..7], defaults to 4; 7 is lowest priority
|
||||||
* (rendered last).</p>
|
* (rendered last).</p>
|
||||||
*
|
*
|
||||||
* @see Builder#blendOrder
|
* @see Builder#blendOrder
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides coarse-grained control over draw order.
|
||||||
|
*
|
||||||
|
* <p>In general Filament reserves the right to re-order renderables to allow for efficient
|
||||||
|
* rendering. However clients can control ordering at a coarse level using priority.
|
||||||
|
* The priority is applied separately for opaque and translucent objects, that is, opaque
|
||||||
|
* objects are always drawn before translucent objects regardless of the priority.</p>
|
||||||
|
*
|
||||||
|
* <p>For example, this could be used to draw a semitransparent HUD, if a client wishes to
|
||||||
|
* avoid using a separate View for the HUD. Note that priority is completely orthogonal to
|
||||||
|
* {@link Builder#layerMask}, which merely controls visibility.</p>
|
||||||
|
|
||||||
|
* <p>The Skybox always using the lowest priority, so it's drawn last, which may improve
|
||||||
|
* performance.</p>
|
||||||
|
*
|
||||||
|
* @param priority clamped to the range [0..7], defaults to 4; 7 is lowest priority
|
||||||
|
* (rendered last).
|
||||||
|
*
|
||||||
|
* @return Builder reference for chaining calls.
|
||||||
|
*
|
||||||
|
* @see Builder#channel
|
||||||
|
* @see Builder#blendOrder
|
||||||
|
* @see #setPriority
|
||||||
|
* @see #setBlendOrderAt
|
||||||
|
*/
|
||||||
@NonNull
|
@NonNull
|
||||||
public Builder priority(@IntRange(from = 0, to = 7) int priority) {
|
public Builder priority(@IntRange(from = 0, to = 7) int priority) {
|
||||||
nBuilderPriority(mNativeBuilder, priority);
|
nBuilderPriority(mNativeBuilder, priority);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the channel this renderable is associated to. There can be 4 channels.
|
||||||
|
*
|
||||||
|
* <p>All renderables in a given channel are rendered together, regardless of anything else.
|
||||||
|
* They are sorted as usual within a channel.</p>
|
||||||
|
* <p>Channels work similarly to priorities, except that they enforce the strongest
|
||||||
|
* ordering.</p>
|
||||||
|
*
|
||||||
|
* <p>Channels 0 and 1 may not have render primitives using a material with `refractionType`
|
||||||
|
* set to `screenspace`.</p>
|
||||||
|
*
|
||||||
|
* @param channel clamped to the range [0..3], defaults to 2.
|
||||||
|
*
|
||||||
|
* @return Builder reference for chaining calls.
|
||||||
|
*
|
||||||
|
* @see Builder::blendOrder()
|
||||||
|
* @see Builder::priority()
|
||||||
|
* @see RenderableManager::setBlendOrderAt()
|
||||||
|
*/
|
||||||
|
@NonNull
|
||||||
|
public Builder channel(@IntRange(from = 0, to = 3) int channel) {
|
||||||
|
nBuilderChannel(mNativeBuilder, channel);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Controls frustum culling, true by default.
|
* Controls frustum culling, true by default.
|
||||||
*
|
*
|
||||||
@@ -266,6 +342,34 @@ public class RenderableManager {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables or disables a light channel. Light channel 0 is enabled by default.
|
||||||
|
*
|
||||||
|
* @param channel Light channel to enable or disable, between 0 and 7.
|
||||||
|
* @param enable Whether to enable or disable the light channel.
|
||||||
|
*/
|
||||||
|
@NonNull
|
||||||
|
public Builder lightChannel(@IntRange(from = 0, to = 7) int channel, boolean enable) {
|
||||||
|
nBuilderLightChannel(mNativeBuilder, channel, enable);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Specifies the number of draw instance of this renderable. The default is 1 instance and
|
||||||
|
* the maximum number of instances allowed is 32767. 0 is invalid.
|
||||||
|
* All instances are culled using the same bounding box, so care must be taken to make
|
||||||
|
* sure all instances render inside the specified bounding box.
|
||||||
|
* The material can use getInstanceIndex() in the vertex shader to get the instance index and
|
||||||
|
* possibly adjust the position or transform.
|
||||||
|
*
|
||||||
|
* @param instanceCount the number of instances silently clamped between 1 and 32767.
|
||||||
|
*/
|
||||||
|
@NonNull
|
||||||
|
public Builder instances(@IntRange(from = 1, to = 32767) int instanceCount) {
|
||||||
|
nBuilderInstances(mNativeBuilder, instanceCount);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Controls if this renderable casts shadows, false by default.
|
* Controls if this renderable casts shadows, false by default.
|
||||||
*
|
*
|
||||||
@@ -303,6 +407,62 @@ public class RenderableManager {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Allows bones to be swapped out and shared using SkinningBuffer.
|
||||||
|
*
|
||||||
|
* If skinning buffer mode is enabled, clients must call #setSkinningBuffer() rather than
|
||||||
|
* #setBonesAsQuaternions(). This allows sharing of data between renderables.
|
||||||
|
*
|
||||||
|
* @param enabled If true, enables buffer object mode. False by default.
|
||||||
|
*/
|
||||||
|
@NonNull
|
||||||
|
public Builder enableSkinningBuffers(boolean enabled) {
|
||||||
|
nBuilderEnableSkinningBuffers(mNativeBuilder, enabled);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Controls if this renderable is affected by the large-scale fog.
|
||||||
|
* @param enabled If true, enables large-scale fog on this object. Disables it otherwise.
|
||||||
|
* True by default.
|
||||||
|
* @return this <code>Builder</code> object for chaining calls
|
||||||
|
*/
|
||||||
|
@NonNull
|
||||||
|
public Builder fog(boolean enabled) {
|
||||||
|
nBuilderFog(mNativeBuilder, enabled);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables GPU vertex skinning for up to 255 bones, 0 by default.
|
||||||
|
*
|
||||||
|
*<p>Skinning Buffer mode must be enabled.</p>
|
||||||
|
*
|
||||||
|
*<p>Each vertex can be affected by up to 4 bones simultaneously. The attached
|
||||||
|
* VertexBuffer must provide data in the BONE_INDICES slot (uvec4) and the
|
||||||
|
* BONE_WEIGHTS slot (float4).</p>
|
||||||
|
*
|
||||||
|
*<p>See also {@link #setSkinningBuffer}, {@link SkinningBuffer#setBonesAsMatrices}
|
||||||
|
* or {@link SkinningBuffer#setBonesAsQuaternions},
|
||||||
|
* which can be called on a per-frame basis to advance the animation.</p>
|
||||||
|
*
|
||||||
|
* @see #setSkinningBuffer
|
||||||
|
* @see SkinningBuffer#setBonesAsMatrices
|
||||||
|
* @see SkinningBuffer#setBonesAsQuaternions
|
||||||
|
*
|
||||||
|
* @param skinningBuffer null to disable, otherwise the {@link SkinningBuffer} to use
|
||||||
|
* @param boneCount 0 to disable, otherwise the number of bone transforms (up to 255)
|
||||||
|
* @param offset offset in the {@link SkinningBuffer}
|
||||||
|
* @return this <code>Builder</code> object for chaining calls
|
||||||
|
*/
|
||||||
|
@NonNull
|
||||||
|
public Builder skinning(SkinningBuffer skinningBuffer,
|
||||||
|
@IntRange(from = 0, to = 255) int boneCount, int offset) {
|
||||||
|
nBuilderSkinningBuffer(mNativeBuilder,
|
||||||
|
skinningBuffer != null ? skinningBuffer.getNativeObject() : 0, boneCount, offset);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
public Builder skinning(@IntRange(from = 0, to = 255) int boneCount) {
|
public Builder skinning(@IntRange(from = 0, to = 255) int boneCount) {
|
||||||
nBuilderSkinning(mNativeBuilder, boneCount);
|
nBuilderSkinning(mNativeBuilder, boneCount);
|
||||||
@@ -312,6 +472,8 @@ public class RenderableManager {
|
|||||||
/**
|
/**
|
||||||
* Enables GPU vertex skinning for up to 255 bones, 0 by default.
|
* Enables GPU vertex skinning for up to 255 bones, 0 by default.
|
||||||
*
|
*
|
||||||
|
* <p>Skinning Buffer mode must be disabled.</p>
|
||||||
|
*
|
||||||
* <p>Each vertex can be affected by up to 4 bones simultaneously. The attached
|
* <p>Each vertex can be affected by up to 4 bones simultaneously. The attached
|
||||||
* VertexBuffer must provide data in the <code>BONE_INDICES</code> slot (uvec4) and the
|
* VertexBuffer must provide data in the <code>BONE_INDICES</code> slot (uvec4) and the
|
||||||
* <code>BONE_WEIGHTS</code> slot (float4).</p>
|
* <code>BONE_WEIGHTS</code> slot (float4).</p>
|
||||||
@@ -319,6 +481,8 @@ public class RenderableManager {
|
|||||||
* <p>See also {@link RenderableManager#setBonesAsMatrices}, which can be called on a per-frame basis
|
* <p>See also {@link RenderableManager#setBonesAsMatrices}, which can be called on a per-frame basis
|
||||||
* to advance the animation.</p>
|
* to advance the animation.</p>
|
||||||
*
|
*
|
||||||
|
* @see SkinningBuffer#setBonesAsMatrices
|
||||||
|
*
|
||||||
* @param boneCount Number of bones associated with this component
|
* @param boneCount Number of bones associated with this component
|
||||||
* @param bones A FloatBuffer containing boneCount transforms. Each transform consists of 8 float.
|
* @param bones A FloatBuffer containing boneCount transforms. Each transform consists of 8 float.
|
||||||
* float 0 to 3 encode a unit quaternion w+ix+jy+kz stored as x,y,z,w.
|
* float 0 to 3 encode a unit quaternion w+ix+jy+kz stored as x,y,z,w.
|
||||||
@@ -334,17 +498,67 @@ public class RenderableManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Controls if the renderable has vertex morphing targets, false by default.
|
* Controls if the renderable has vertex morphing targets, zero by default. This is
|
||||||
|
* required to enable GPU morphing.
|
||||||
*
|
*
|
||||||
* <p>This is required to enable GPU morphing for up to 4 attributes. The attached VertexBuffer
|
* <p>Filament supports two morphing modes: standard (default) and legacy.</p>
|
||||||
* must provide data in the appropriate VertexAttribute slots (<code>MORPH_POSITION_0</code> etc).</p>
|
*
|
||||||
|
* <p>For standard morphing, A {@link MorphTargetBuffer} must be created and provided via
|
||||||
|
* {@link RenderableManager#setMorphTargetBufferAt}. Standard morphing supports up to
|
||||||
|
* <code>CONFIG_MAX_MORPH_TARGET_COUNT</code> morph targets.</p>
|
||||||
|
*
|
||||||
|
* For legacy morphing, the attached {@link VertexBuffer} must provide data in the
|
||||||
|
* appropriate {@link VertexBuffer.VertexAttribute} slots (<code>MORPH_POSITION_0</code> etc).
|
||||||
|
* Legacy morphing only supports up to 4 morph targets and will be deprecated in the future.
|
||||||
|
* Legacy morphing must be enabled on the material definition: either via the
|
||||||
|
* <code>legacyMorphing</code> material attribute or by calling
|
||||||
|
* {@link MaterialBuilder::useLegacyMorphing}.
|
||||||
*
|
*
|
||||||
* <p>See also {@link RenderableManager#setMorphWeights}, which can be called on a per-frame basis
|
* <p>See also {@link RenderableManager#setMorphWeights}, which can be called on a per-frame basis
|
||||||
* to advance the animation.</p>
|
* to advance the animation.</p>
|
||||||
*/
|
*/
|
||||||
@NonNull
|
@NonNull
|
||||||
public Builder morphing(boolean enabled) {
|
public Builder morphing(@IntRange(from = 0, to = 255) int targetCount) {
|
||||||
nBuilderMorphing(mNativeBuilder, enabled);
|
nBuilderMorphing(mNativeBuilder, targetCount);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Specifies the morph target buffer for a primitive.
|
||||||
|
*
|
||||||
|
* The morph target buffer must have an associated renderable and geometry. Two conditions
|
||||||
|
* must be met:
|
||||||
|
* 1. The number of morph targets in the buffer must equal the renderable's morph target
|
||||||
|
* count.
|
||||||
|
* 2. The vertex count of each morph target must equal the geometry's vertex count.
|
||||||
|
*
|
||||||
|
* @param level the level of detail (lod), only 0 can be specified
|
||||||
|
* @param primitiveIndex zero-based index of the primitive, must be less than the count passed to Builder constructor
|
||||||
|
* @param morphTargetBuffer specifies the morph target buffer
|
||||||
|
* @param offset specifies where in the morph target buffer to start reading (expressed as a number of vertices)
|
||||||
|
* @param count number of vertices in the morph target buffer to read, must equal the geometry's count (for triangles, this should be a multiple of 3)
|
||||||
|
*/
|
||||||
|
@NonNull
|
||||||
|
public Builder morphing(@IntRange(from = 0) int level,
|
||||||
|
@IntRange(from = 0) int primitiveIndex,
|
||||||
|
@NonNull MorphTargetBuffer morphTargetBuffer,
|
||||||
|
@IntRange(from = 0) int offset,
|
||||||
|
@IntRange(from = 0) int count) {
|
||||||
|
nBuilderSetMorphTargetBufferAt(mNativeBuilder, level, primitiveIndex,
|
||||||
|
morphTargetBuffer.getNativeObject(), offset, count);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Utility method to specify morph target buffer for a primitive.
|
||||||
|
* For details, see the {@link RenderableManager.Builder#morphing}.
|
||||||
|
*/
|
||||||
|
@NonNull
|
||||||
|
public Builder morphing(@IntRange(from = 0) int level,
|
||||||
|
@IntRange(from = 0) int primitiveIndex,
|
||||||
|
@NonNull MorphTargetBuffer morphTargetBuffer) {
|
||||||
|
nBuilderSetMorphTargetBufferAt(mNativeBuilder, level, primitiveIndex,
|
||||||
|
morphTargetBuffer.getNativeObject(), 0, morphTargetBuffer.getVertexCount());
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -379,9 +593,22 @@ public class RenderableManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Associates a {@link SkinningBuffer} to a renderable instance
|
||||||
|
* @param i Instance of the Renderable
|
||||||
|
* @param skinningBuffer {@link SkinningBuffer} to use
|
||||||
|
* @param count Numbers of bones to set
|
||||||
|
* @param offset Offset in the {@link SkinningBuffer}
|
||||||
|
*/
|
||||||
|
public void setSkinningBuffer(@EntityInstance int i, @NonNull SkinningBuffer skinningBuffer,
|
||||||
|
int count, int offset) {
|
||||||
|
nSetSkinningBuffer(mNativeObject, i, skinningBuffer.getNativeObject(), count, offset);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the transforms associated with each bone of a Renderable.
|
* Sets the transforms associated with each bone of a Renderable.
|
||||||
*
|
*
|
||||||
* @param i Instance of the Renderable
|
* @param i Instance of the Renderable
|
||||||
* @param matrices A FloatBuffer containing boneCount 4x4 packed matrices (i.e. 16 floats each matrix and no gap between matrices)
|
* @param matrices A FloatBuffer containing boneCount 4x4 packed matrices (i.e. 16 floats each matrix and no gap between matrices)
|
||||||
* @param boneCount Number of bones to set
|
* @param boneCount Number of bones to set
|
||||||
@@ -418,15 +645,50 @@ public class RenderableManager {
|
|||||||
/**
|
/**
|
||||||
* Updates the vertex morphing weights on a renderable, all zeroes by default.
|
* Updates the vertex morphing weights on a renderable, all zeroes by default.
|
||||||
*
|
*
|
||||||
* <p>This is specified using a 4-tuple, one float per morph target. If the renderable has fewer
|
* <p>The renderable must be built with morphing enabled. In legacy morphing mode, only the
|
||||||
* than 4 morph targets, then clients should fill the unused components with zeroes.</p>
|
* first 4 weights are considered.</p>
|
||||||
|
*
|
||||||
|
* @see Builder#morphing
|
||||||
|
*/
|
||||||
|
public void setMorphWeights(@EntityInstance int i, @NonNull float[] weights, @IntRange(from = 0) int offset) {
|
||||||
|
nSetMorphWeights(mNativeObject, i, weights, offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Changes the morph target buffer for the given primitive.
|
||||||
*
|
*
|
||||||
* <p>The renderable must be built with morphing enabled.</p>
|
* <p>The renderable must be built with morphing enabled.</p>
|
||||||
*
|
*
|
||||||
* @see Builder#morphing
|
* @see Builder#morphing
|
||||||
*/
|
*/
|
||||||
public void setMorphWeights(@EntityInstance int i, @NonNull @Size(min = 4) float[] weights) {
|
public void setMorphTargetBufferAt(@EntityInstance int i,
|
||||||
nSetMorphWeights(mNativeObject, i, weights);
|
@IntRange(from = 0) int level,
|
||||||
|
@IntRange(from = 0) int primitiveIndex,
|
||||||
|
@NonNull MorphTargetBuffer morphTargetBuffer,
|
||||||
|
@IntRange(from = 0) int offset,
|
||||||
|
@IntRange(from = 0) int count) {
|
||||||
|
nSetMorphTargetBufferAt(mNativeObject, i, level, primitiveIndex,
|
||||||
|
morphTargetBuffer.getNativeObject(), offset, count);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Utility method to change morph target buffer for the given primitive.
|
||||||
|
* For details, see the {@link RenderableManager#setMorphTargetBufferAt}.
|
||||||
|
*/
|
||||||
|
public void setMorphTargetBufferAt(@EntityInstance int i,
|
||||||
|
@IntRange(from = 0) int level,
|
||||||
|
@IntRange(from = 0) int primitiveIndex,
|
||||||
|
@NonNull MorphTargetBuffer morphTargetBuffer) {
|
||||||
|
nSetMorphTargetBufferAt(mNativeObject, i, level, primitiveIndex,
|
||||||
|
morphTargetBuffer.getNativeObject(), 0, morphTargetBuffer.getVertexCount());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the morph target count on a renderable.
|
||||||
|
*/
|
||||||
|
@IntRange(from = 0)
|
||||||
|
public int getMorphTargetCount(@EntityInstance int i) {
|
||||||
|
return nGetMorphTargetCount(mNativeObject, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -461,6 +723,15 @@ public class RenderableManager {
|
|||||||
nSetPriority(mNativeObject, i, priority);
|
nSetPriority(mNativeObject, i, priority);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Changes the channel of a renderable
|
||||||
|
*
|
||||||
|
* @see Builder#channel
|
||||||
|
*/
|
||||||
|
public void setChannel(@EntityInstance int i, @IntRange(from = 0, to = 3) int channel) {
|
||||||
|
nSetChannel(mNativeObject, i, channel);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Changes whether or not frustum culling is on.
|
* Changes whether or not frustum culling is on.
|
||||||
*
|
*
|
||||||
@@ -470,6 +741,47 @@ public class RenderableManager {
|
|||||||
nSetCulling(mNativeObject, i, enabled);
|
nSetCulling(mNativeObject, i, enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Changes whether or not the large-scale fog is applied to this renderable
|
||||||
|
* @see Builder#fog
|
||||||
|
*/
|
||||||
|
public void setFogEnabled(@EntityInstance int i, boolean enabled) {
|
||||||
|
nSetFogEnabled(mNativeObject, i, enabled);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns whether large-scale fog is enabled for this renderable.
|
||||||
|
* @return True if fog is enabled for this renderable.
|
||||||
|
* @see Builder#fog
|
||||||
|
*/
|
||||||
|
public boolean getFogEnabled(@EntityInstance int i) {
|
||||||
|
return nGetFogEnabled(mNativeObject, i);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables or disables a light channel.
|
||||||
|
* Light channel 0 is enabled by default.
|
||||||
|
*
|
||||||
|
* @param i Instance of the component obtained from getInstance().
|
||||||
|
* @param channel Light channel to set
|
||||||
|
* @param enable true to enable, false to disable
|
||||||
|
*
|
||||||
|
* @see Builder#lightChannel
|
||||||
|
*/
|
||||||
|
public void setLightChannel(@EntityInstance int i, @IntRange(from = 0, to = 7) int channel, boolean enable) {
|
||||||
|
nSetLightChannel(mNativeObject, i, channel, enable);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns whether a light channel is enabled on a specified renderable.
|
||||||
|
* @param i Instance of the component obtained from getInstance().
|
||||||
|
* @param channel Light channel to query
|
||||||
|
* @return true if the light channel is enabled, false otherwise
|
||||||
|
*/
|
||||||
|
public boolean getLightChannel(@EntityInstance int i, @IntRange(from = 0, to = 7) int channel) {
|
||||||
|
return nGetLightChannel(mNativeObject, i, channel);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Changes whether or not the renderable casts shadows.
|
* Changes whether or not the renderable casts shadows.
|
||||||
*
|
*
|
||||||
@@ -588,18 +900,9 @@ public class RenderableManager {
|
|||||||
0, indices.getIndexCount());
|
0, indices.getIndexCount());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Changes the geometry for the given primitive.
|
* Changes the drawing order for blended primitives. The drawing order is either global or
|
||||||
*
|
* local (default) to this Renderable. In either case, the Renderable priority takes precedence.
|
||||||
* @see Builder#geometry Builder.geometry
|
|
||||||
*/
|
|
||||||
public void setGeometryAt(@EntityInstance int i, @IntRange(from = 0) int primitiveIndex,
|
|
||||||
@NonNull PrimitiveType type, @IntRange(from = 0) int offset, @IntRange(from = 0) int count) {
|
|
||||||
nSetGeometryAt(mNativeObject, i, primitiveIndex, type.getValue(), offset, count);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Changes the ordering index for blended primitives that all live at the same Z value.
|
|
||||||
*
|
*
|
||||||
* @see Builder#blendOrder
|
* @see Builder#blendOrder
|
||||||
*
|
*
|
||||||
@@ -612,18 +915,36 @@ public class RenderableManager {
|
|||||||
nSetBlendOrderAt(mNativeObject, instance, primitiveIndex, blendOrder);
|
nSetBlendOrderAt(mNativeObject, instance, primitiveIndex, blendOrder);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Changes whether the blend order is global or local to this Renderable (by default).
|
||||||
|
*
|
||||||
|
* @see Builder#globalBlendOrderEnabled
|
||||||
|
*
|
||||||
|
* @param instance the renderable of interest
|
||||||
|
* @param primitiveIndex the primitive of interest
|
||||||
|
* @param enabled true for global, false for local blend ordering.
|
||||||
|
*/
|
||||||
|
public void setGlobalBlendOrderEnabledAt(@EntityInstance int instance, @IntRange(from = 0) int primitiveIndex,
|
||||||
|
boolean enabled) {
|
||||||
|
nSetGlobalBlendOrderEnabledAt(mNativeObject, instance, primitiveIndex, enabled);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves the set of enabled attribute slots in the given primitive's VertexBuffer.
|
* Retrieves the set of enabled attribute slots in the given primitive's VertexBuffer.
|
||||||
*/
|
*/
|
||||||
public Set<VertexBuffer.VertexAttribute> getEnabledAttributesAt(@EntityInstance int i, @IntRange(from = 0) int primitiveIndex) {
|
public Set<VertexBuffer.VertexAttribute> getEnabledAttributesAt(
|
||||||
|
@EntityInstance int i, @IntRange(from = 0) int primitiveIndex) {
|
||||||
int bitSet = nGetEnabledAttributesAt(mNativeObject, i, primitiveIndex);
|
int bitSet = nGetEnabledAttributesAt(mNativeObject, i, primitiveIndex);
|
||||||
Set<VertexBuffer.VertexAttribute> requiredAttributes = EnumSet.noneOf(VertexBuffer.VertexAttribute.class);
|
Set<VertexBuffer.VertexAttribute> requiredAttributes =
|
||||||
VertexBuffer.VertexAttribute[] values = VertexBuffer.VertexAttribute.values();
|
EnumSet.noneOf(VertexBuffer.VertexAttribute.class);
|
||||||
|
VertexBuffer.VertexAttribute[] values = sVertexAttributeValues;
|
||||||
|
|
||||||
for (int j = 0; j < values.length; j++) {
|
for (int j = 0; j < values.length; j++) {
|
||||||
if ((bitSet & (1 << j)) != 0) {
|
if ((bitSet & (1 << j)) != 0) {
|
||||||
requiredAttributes.add(values[j]);
|
requiredAttributes.add(values[j]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
requiredAttributes = Collections.unmodifiableSet(requiredAttributes);
|
requiredAttributes = Collections.unmodifiableSet(requiredAttributes);
|
||||||
return requiredAttributes;
|
return requiredAttributes;
|
||||||
}
|
}
|
||||||
@@ -645,24 +966,40 @@ public class RenderableManager {
|
|||||||
private static native void nBuilderGeometry(long nativeBuilder, int index, int value, long nativeVertexBuffer, long nativeIndexBuffer, int offset, int minIndex, int maxIndex, int count);
|
private static native void nBuilderGeometry(long nativeBuilder, int index, int value, long nativeVertexBuffer, long nativeIndexBuffer, int offset, int minIndex, int maxIndex, int count);
|
||||||
private static native void nBuilderMaterial(long nativeBuilder, int index, long nativeMaterialInstance);
|
private static native void nBuilderMaterial(long nativeBuilder, int index, long nativeMaterialInstance);
|
||||||
private static native void nBuilderBlendOrder(long nativeBuilder, int index, int blendOrder);
|
private static native void nBuilderBlendOrder(long nativeBuilder, int index, int blendOrder);
|
||||||
|
private static native void nBuilderGlobalBlendOrderEnabled(long nativeBuilder, int index, boolean enabled);
|
||||||
private static native void nBuilderBoundingBox(long nativeBuilder, float cx, float cy, float cz, float ex, float ey, float ez);
|
private static native void nBuilderBoundingBox(long nativeBuilder, float cx, float cy, float cz, float ex, float ey, float ez);
|
||||||
private static native void nBuilderLayerMask(long nativeBuilder, int select, int value);
|
private static native void nBuilderLayerMask(long nativeBuilder, int select, int value);
|
||||||
private static native void nBuilderPriority(long nativeBuilder, int priority);
|
private static native void nBuilderPriority(long nativeBuilder, int priority);
|
||||||
|
private static native void nBuilderChannel(long nativeBuilder, int channel);
|
||||||
private static native void nBuilderCulling(long nativeBuilder, boolean enabled);
|
private static native void nBuilderCulling(long nativeBuilder, boolean enabled);
|
||||||
private static native void nBuilderCastShadows(long nativeBuilder, boolean enabled);
|
private static native void nBuilderCastShadows(long nativeBuilder, boolean enabled);
|
||||||
private static native void nBuilderReceiveShadows(long nativeBuilder, boolean enabled);
|
private static native void nBuilderReceiveShadows(long nativeBuilder, boolean enabled);
|
||||||
private static native void nBuilderScreenSpaceContactShadows(long nativeBuilder, boolean enabled);
|
private static native void nBuilderScreenSpaceContactShadows(long nativeBuilder, boolean enabled);
|
||||||
private static native void nBuilderSkinning(long nativeBuilder, int boneCount);
|
private static native void nBuilderSkinning(long nativeBuilder, int boneCount);
|
||||||
private static native int nBuilderSkinningBones(long nativeBuilder, int boneCount, Buffer bones, int remaining);
|
private static native int nBuilderSkinningBones(long nativeBuilder, int boneCount, Buffer bones, int remaining);
|
||||||
private static native void nBuilderMorphing(long nativeBuilder, boolean enabled);
|
private static native void nBuilderSkinningBuffer(long nativeBuilder, long nativeSkinningBuffer, int boneCount, int offset);
|
||||||
|
private static native void nBuilderMorphing(long nativeBuilder, int targetCount);
|
||||||
|
private static native void nBuilderSetMorphTargetBufferAt(long nativeBuilder, int level, int primitiveIndex, long nativeMorphTargetBuffer, int offset, int count);
|
||||||
|
private static native void nBuilderEnableSkinningBuffers(long nativeBuilder, boolean enabled);
|
||||||
|
private static native void nBuilderFog(long nativeBuilder, boolean enabled);
|
||||||
|
private static native void nBuilderLightChannel(long nativeRenderableManager, int channel, boolean enable);
|
||||||
|
private static native void nBuilderInstances(long nativeRenderableManager, int instances);
|
||||||
|
|
||||||
|
private static native void nSetSkinningBuffer(long nativeObject, int i, long nativeSkinningBuffer, int count, int offset);
|
||||||
private static native int nSetBonesAsMatrices(long nativeObject, int i, Buffer matrices, int remaining, int boneCount, int offset);
|
private static native int nSetBonesAsMatrices(long nativeObject, int i, Buffer matrices, int remaining, int boneCount, int offset);
|
||||||
private static native int nSetBonesAsQuaternions(long nativeObject, int i, Buffer quaternions, int remaining, int boneCount, int offset);
|
private static native int nSetBonesAsQuaternions(long nativeObject, int i, Buffer quaternions, int remaining, int boneCount, int offset);
|
||||||
private static native void nSetMorphWeights(long nativeObject, int instance, float[] weights);
|
private static native void nSetMorphWeights(long nativeObject, int instance, float[] weights, int offset);
|
||||||
|
private static native void nSetMorphTargetBufferAt(long nativeObject, int i, int level, int primitiveIndex, long nativeMorphTargetBuffer, int offset, int count);
|
||||||
|
private static native int nGetMorphTargetCount(long nativeObject, int i);
|
||||||
private static native void nSetAxisAlignedBoundingBox(long nativeRenderableManager, int i, float cx, float cy, float cz, float ex, float ey, float ez);
|
private static native void nSetAxisAlignedBoundingBox(long nativeRenderableManager, int i, float cx, float cy, float cz, float ex, float ey, float ez);
|
||||||
private static native void nSetLayerMask(long nativeRenderableManager, int i, int select, int value);
|
private static native void nSetLayerMask(long nativeRenderableManager, int i, int select, int value);
|
||||||
private static native void nSetPriority(long nativeRenderableManager, int i, int priority);
|
private static native void nSetPriority(long nativeRenderableManager, int i, int priority);
|
||||||
|
private static native void nSetChannel(long nativeRenderableManager, int i, int channel);
|
||||||
private static native void nSetCulling(long nativeRenderableManager, int i, boolean enabled);
|
private static native void nSetCulling(long nativeRenderableManager, int i, boolean enabled);
|
||||||
|
private static native void nSetFogEnabled(long nativeRenderableManager, int i, boolean enabled);
|
||||||
|
private static native boolean nGetFogEnabled(long nativeRenderableManager, int i);
|
||||||
|
private static native void nSetLightChannel(long nativeRenderableManager, int i, int channel, boolean enable);
|
||||||
|
private static native boolean nGetLightChannel(long nativeRenderableManager, int i, int channel);
|
||||||
private static native void nSetCastShadows(long nativeRenderableManager, int i, boolean enabled);
|
private static native void nSetCastShadows(long nativeRenderableManager, int i, boolean enabled);
|
||||||
private static native void nSetReceiveShadows(long nativeRenderableManager, int i, boolean enabled);
|
private static native void nSetReceiveShadows(long nativeRenderableManager, int i, boolean enabled);
|
||||||
private static native void nSetScreenSpaceContactShadows(long nativeRenderableManager, int i, boolean enabled);
|
private static native void nSetScreenSpaceContactShadows(long nativeRenderableManager, int i, boolean enabled);
|
||||||
@@ -672,9 +1009,8 @@ public class RenderableManager {
|
|||||||
private static native int nGetPrimitiveCount(long nativeRenderableManager, int i);
|
private static native int nGetPrimitiveCount(long nativeRenderableManager, int i);
|
||||||
private static native void nSetMaterialInstanceAt(long nativeRenderableManager, int i, int primitiveIndex, long nativeMaterialInstance);
|
private static native void nSetMaterialInstanceAt(long nativeRenderableManager, int i, int primitiveIndex, long nativeMaterialInstance);
|
||||||
private static native long nGetMaterialInstanceAt(long nativeRenderableManager, int i, int primitiveIndex);
|
private static native long nGetMaterialInstanceAt(long nativeRenderableManager, int i, int primitiveIndex);
|
||||||
private static native long nGetMaterialAt(long nativeRenderableManager, int i, int primitiveIndex);
|
|
||||||
private static native void nSetGeometryAt(long nativeRenderableManager, int i, int primitiveIndex, int primitiveType, long nativeVertexBuffer, long nativeIndexBuffer, int offset, int count);
|
private static native void nSetGeometryAt(long nativeRenderableManager, int i, int primitiveIndex, int primitiveType, long nativeVertexBuffer, long nativeIndexBuffer, int offset, int count);
|
||||||
private static native void nSetGeometryAt(long nativeRenderableManager, int i, int primitiveIndex, int primitiveType, int offset, int count);
|
|
||||||
private static native void nSetBlendOrderAt(long nativeRenderableManager, int i, int primitiveIndex, int blendOrder);
|
private static native void nSetBlendOrderAt(long nativeRenderableManager, int i, int primitiveIndex, int blendOrder);
|
||||||
|
private static native void nSetGlobalBlendOrderEnabledAt(long nativeRenderableManager, int i, int primitiveIndex, boolean enabled);
|
||||||
private static native int nGetEnabledAttributesAt(long nativeRenderableManager, int i, int primitiveIndex);
|
private static native int nGetEnabledAttributesAt(long nativeRenderableManager, int i, int primitiveIndex);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,13 +61,17 @@ public class Renderer {
|
|||||||
/**
|
/**
|
||||||
* How far in advance a buffer must be queued for presentation at a given time in ns
|
* How far in advance a buffer must be queued for presentation at a given time in ns
|
||||||
* On Android you can use {@link android.view.Display#getPresentationDeadlineNanos()}.
|
* On Android you can use {@link android.view.Display#getPresentationDeadlineNanos()}.
|
||||||
|
* @deprecated this value is ignored
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public long presentationDeadlineNanos = 0;
|
public long presentationDeadlineNanos = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Offset by which vsyncSteadyClockTimeNano provided in beginFrame() is offset in ns
|
* Offset by which vsyncSteadyClockTimeNano provided in beginFrame() is offset in ns
|
||||||
* On Android you can use {@link android.view.Display#getAppVsyncOffsetNanos()}.
|
* On Android you can use {@link android.view.Display#getAppVsyncOffsetNanos()}.
|
||||||
|
* @deprecated this value is ignored
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public long vsyncOffsetNanos = 0;
|
public long vsyncOffsetNanos = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -107,12 +111,12 @@ public class Renderer {
|
|||||||
/**
|
/**
|
||||||
* Rate at which the scale will change to reach the target frame rate.
|
* Rate at which the scale will change to reach the target frame rate.
|
||||||
*/
|
*/
|
||||||
public float scaleRate = 0.125f;
|
public float scaleRate = 1.0f / 15.0f;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* History size. higher values, tend to filter more (clamped to 30).
|
* History size. higher values, tend to filter more (clamped to 31).
|
||||||
*/
|
*/
|
||||||
public int history = 9;
|
public int history = 15;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -120,7 +124,24 @@ public class Renderer {
|
|||||||
*/
|
*/
|
||||||
public static class ClearOptions {
|
public static class ClearOptions {
|
||||||
/**
|
/**
|
||||||
* Color to use to clear the SwapChain
|
* Color (sRGB linear) to use to clear the RenderTarget (typically the SwapChain).
|
||||||
|
*
|
||||||
|
* The RenderTarget is cleared using this color, which won't be tone-mapped since
|
||||||
|
* tone-mapping is part of View rendering (this is not).
|
||||||
|
*
|
||||||
|
* When a View is rendered, there are 3 scenarios to consider:
|
||||||
|
* - Pixels rendered by the View replace the clear color (or blend with it in
|
||||||
|
* `BlendMode.TRANSLUCENT` mode).
|
||||||
|
*
|
||||||
|
* - With blending mode set to `BlendMode.TRANSLUCENT`, Pixels untouched by the View
|
||||||
|
* are considered fulling transparent and let the clear color show through.
|
||||||
|
*
|
||||||
|
* - With blending mode set to `BlendMode.OPAQUE`, Pixels untouched by the View
|
||||||
|
* are set to the clear color. However, because it is now used in the context of a View,
|
||||||
|
* it will go through the post-processing stage, which includes tone-mapping.
|
||||||
|
*
|
||||||
|
* For consistency, it is recommended to always use a Skybox to clear an opaque View's
|
||||||
|
* background, or to use black or fully-transparent (i.e. {0,0,0,0}) as the clear color.
|
||||||
*/
|
*/
|
||||||
@NonNull
|
@NonNull
|
||||||
public float[] clearColor = { 0.0f, 0.0f, 0.0f, 0.0f };
|
public float[] clearColor = { 0.0f, 0.0f, 0.0f, 0.0f };
|
||||||
@@ -175,8 +196,7 @@ public class Renderer {
|
|||||||
*/
|
*/
|
||||||
public void setDisplayInfo(@NonNull DisplayInfo info) {
|
public void setDisplayInfo(@NonNull DisplayInfo info) {
|
||||||
mDisplayInfo = info;
|
mDisplayInfo = info;
|
||||||
nSetDisplayInfo(getNativeObject(),
|
nSetDisplayInfo(getNativeObject(), info.refreshRate);
|
||||||
info.refreshRate, info.presentationDeadlineNanos, info.vsyncOffsetNanos);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -247,6 +267,23 @@ public class Renderer {
|
|||||||
return mEngine;
|
return mEngine;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the time at which the frame must be presented to the display.
|
||||||
|
* <p>
|
||||||
|
* This must be called between {@link #beginFrame} and {@link #endFrame}.
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @param monotonicClockNanos The time in nanoseconds corresponding to the system monotonic
|
||||||
|
* up-time clock. The presentation time is typically set in the
|
||||||
|
* middle of the period of interest and cannot be too far in the
|
||||||
|
* future as it is limited by how many buffers are available in
|
||||||
|
* the display sub-system. Typically it is set to 1 or 2 vsync
|
||||||
|
* periods away.
|
||||||
|
*/
|
||||||
|
public void setPresentationTime(long monotonicClockNanos) {
|
||||||
|
nSetPresentationTime(getNativeObject(), monotonicClockNanos);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets up a frame for this <code>Renderer</code>.
|
* Sets up a frame for this <code>Renderer</code>.
|
||||||
* <p><code>beginFrame</code> manages frame pacing, and returns whether or not a frame should be
|
* <p><code>beginFrame</code> manages frame pacing, and returns whether or not a frame should be
|
||||||
@@ -309,13 +346,13 @@ public class Renderer {
|
|||||||
*
|
*
|
||||||
* <p><code>render()</code> generates commands for each of the following stages:</p>
|
* <p><code>render()</code> generates commands for each of the following stages:</p>
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li>Shadow map pass, if needed (currently only a single shadow map is supported)</li>
|
* <li>Shadow map passes, if needed</li>
|
||||||
* <li>Depth pre-pass</li>
|
* <li>Depth pre-pass</li>
|
||||||
* <li>SSAO pass, if enabled</li>
|
* <li>SSAO pass, if enabled</li>
|
||||||
* <li>Color pass</li>
|
* <li>Color pass</li>
|
||||||
* <li>Post-processing pass</li>
|
* <li>Post-processing pass</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
*
|
* <p>
|
||||||
* A typical render loop looks like this:
|
* A typical render loop looks like this:
|
||||||
*
|
*
|
||||||
* <pre>
|
* <pre>
|
||||||
@@ -331,31 +368,58 @@ public class Renderer {
|
|||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* <ul>
|
* <ul>
|
||||||
*<li><code>render()</code> must be called <b>after</b> {@link #beginFrame} and <b>before</b>
|
* <li><code>render()</code> must be called <b>after</b> {@link #beginFrame} and <b>before</b>
|
||||||
*{@link #endFrame}.</li>
|
* {@link #endFrame}.</li>
|
||||||
*
|
*
|
||||||
*<li><code>render()</code> must be called from the {@link Engine}'s main thread
|
* <li><code>render()</code> must be called from the {@link Engine}'s main thread
|
||||||
*(or external synchronization must be provided). In particular, calls to <code>render()</code>
|
* (or external synchronization must be provided). In particular, calls to <code>render()</code>
|
||||||
*on different <code>Renderer</code> instances <b>must</b> be synchronized.</li>
|
* on different <code>Renderer</code> instances <b>must</b> be synchronized.</li>
|
||||||
*
|
*
|
||||||
*<li><code>render()</code> performs potentially heavy computations and cannot be multi-threaded.
|
* <li><code>render()</code> performs potentially heavy computations and cannot be multi-threaded.
|
||||||
*However, internally, it is highly multi-threaded to both improve performance and mitigate
|
* However, internally, it is highly multi-threaded to both improve performance and mitigate
|
||||||
*the call's latency.</li>
|
* the call's latency.</li>
|
||||||
*
|
*
|
||||||
*<li><code>render()</code> is typically called once per frame (but not necessarily).</li>
|
* <li><code>render()</code> is typically called once per frame (but not necessarily).</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
*
|
*
|
||||||
* @param view the {@link View} to render
|
* @param view the {@link View} to render
|
||||||
*
|
|
||||||
* @see #beginFrame
|
* @see #beginFrame
|
||||||
* @see #endFrame
|
* @see #endFrame
|
||||||
* @see View
|
* @see View
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public void render(@NonNull View view) {
|
public void render(@NonNull View view) {
|
||||||
nRender(getNativeObject(), view.getNativeObject());
|
nRender(getNativeObject(), view.getNativeObject());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Renders a standalone {@link View} into its associated <code>RenderTarget</code>.
|
||||||
|
*
|
||||||
|
* <p>
|
||||||
|
* This call is mostly equivalent to calling {@link #render(View)} inside a
|
||||||
|
* {@link #beginFrame} / {@link #endFrame} block, but incurs less overhead. It can be used
|
||||||
|
* as a poor man's compute API.
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* <ul>
|
||||||
|
* <li><code>renderStandaloneView()</code> must be called <b>outside</b> of
|
||||||
|
* {@link #beginFrame} / {@link #endFrame}.</li>
|
||||||
|
*
|
||||||
|
* <li><code>renderStandaloneView()</code> must be called from the {@link Engine}'s main thread
|
||||||
|
* (or external synchronization must be provided). In particular, calls to
|
||||||
|
* <code>renderStandaloneView()</code> on different <code>Renderer</code> instances <b>must</b>
|
||||||
|
* be synchronized.</li>
|
||||||
|
*
|
||||||
|
* <li><code>renderStandaloneView()</code> performs potentially heavy computations and cannot be
|
||||||
|
* multi-threaded. However, internally, it is highly multi-threaded to both improve performance
|
||||||
|
* and mitigate the call's latency.</li>
|
||||||
|
*
|
||||||
|
* @param view the {@link View} to render. This View must have an associated {@link RenderTarget}
|
||||||
|
* @see View
|
||||||
|
*/
|
||||||
|
public void renderStandaloneView(@NonNull View view) {
|
||||||
|
nRenderStandaloneView(getNativeObject(), view.getNativeObject());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copies the currently rendered {@link View} to the indicated {@link SwapChain}, using the
|
* Copies the currently rendered {@link View} to the indicated {@link SwapChain}, using the
|
||||||
* indicated source and destination rectangle.
|
* indicated source and destination rectangle.
|
||||||
@@ -410,8 +474,9 @@ public class Renderer {
|
|||||||
*</pre>
|
*</pre>
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* <p>Typically <code>readPixels</code> will be called after {@link #render} and before
|
* <p><code>readPixels</code> must be called within a frame, meaning after {@link #beginFrame}
|
||||||
* {@link #endFrame}.</p>
|
* and before {@link #endFrame}. Typically, <code>readPixels</code> will be called after
|
||||||
|
* {@link #render}.</p>
|
||||||
* <br>
|
* <br>
|
||||||
* <p>After calling this method, the callback associated with <code>buffer</code>
|
* <p>After calling this method, the callback associated with <code>buffer</code>
|
||||||
* will be invoked on the main thread, indicating that the read-back has completed.
|
* will be invoked on the main thread, indicating that the read-back has completed.
|
||||||
@@ -503,6 +568,10 @@ public class Renderer {
|
|||||||
* Typically, this will happen after multiple calls to {@link #beginFrame},
|
* Typically, this will happen after multiple calls to {@link #beginFrame},
|
||||||
* {@link #render}, {@link #endFrame}.</p>
|
* {@link #render}, {@link #endFrame}.</p>
|
||||||
* <br>
|
* <br>
|
||||||
|
* <p>OpenGL only: if issuing a <code>readPixels</code> on a {@link RenderTarget} backed by a
|
||||||
|
* {@link Texture} that had data uploaded to it via {@link Texture#setImage}, the data returned
|
||||||
|
* from <code>readPixels</code> will be y-flipped with respect to the {@link Texture#setImage}
|
||||||
|
* call.</p>
|
||||||
* <p><code>readPixels</code> is intended for debugging and testing.
|
* <p><code>readPixels</code> is intended for debugging and testing.
|
||||||
* It will impact performance significantly.</p>
|
* It will impact performance significantly.</p>
|
||||||
*
|
*
|
||||||
@@ -632,9 +701,11 @@ public class Renderer {
|
|||||||
mNativeObject = 0;
|
mNativeObject = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static native void nSetPresentationTime(long nativeObject, long monotonicClockNanos);
|
||||||
private static native boolean nBeginFrame(long nativeRenderer, long nativeSwapChain, long frameTimeNanos);
|
private static native boolean nBeginFrame(long nativeRenderer, long nativeSwapChain, long frameTimeNanos);
|
||||||
private static native void nEndFrame(long nativeRenderer);
|
private static native void nEndFrame(long nativeRenderer);
|
||||||
private static native void nRender(long nativeRenderer, long nativeView);
|
private static native void nRender(long nativeRenderer, long nativeView);
|
||||||
|
private static native void nRenderStandaloneView(long nativeRenderer, long nativeView);
|
||||||
private static native void nCopyFrame(long nativeRenderer, long nativeDstSwapChain,
|
private static native void nCopyFrame(long nativeRenderer, long nativeDstSwapChain,
|
||||||
int dstLeft, int dstBottom, int dstWidth, int dstHeight,
|
int dstLeft, int dstBottom, int dstWidth, int dstHeight,
|
||||||
int srcLeft, int srcBottom, int srcWidth, int srcHeight,
|
int srcLeft, int srcBottom, int srcWidth, int srcHeight,
|
||||||
@@ -652,8 +723,7 @@ public class Renderer {
|
|||||||
Object handler, Runnable callback);
|
Object handler, Runnable callback);
|
||||||
private static native double nGetUserTime(long nativeRenderer);
|
private static native double nGetUserTime(long nativeRenderer);
|
||||||
private static native void nResetUserTime(long nativeRenderer);
|
private static native void nResetUserTime(long nativeRenderer);
|
||||||
private static native void nSetDisplayInfo(long nativeRenderer,
|
private static native void nSetDisplayInfo(long nativeRenderer, float refreshRate);
|
||||||
float refreshRate, long presentationDeadlineNanos, long vsyncOffsetNanos);
|
|
||||||
private static native void nSetFrameRateOptions(long nativeRenderer,
|
private static native void nSetFrameRateOptions(long nativeRenderer,
|
||||||
float interval, float headRoomRatio, float scaleRate, int history);
|
float interval, float headRoomRatio, float scaleRate, int history);
|
||||||
private static native void nSetClearOptions(long nativeRenderer,
|
private static native void nSetClearOptions(long nativeRenderer,
|
||||||
|
|||||||
@@ -128,6 +128,7 @@ public class Scene {
|
|||||||
/**
|
/**
|
||||||
* @deprecated See {@link #removeEntity(int)}
|
* @deprecated See {@link #removeEntity(int)}
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public void remove(@Entity int entity) {
|
public void remove(@Entity int entity) {
|
||||||
removeEntity(entity);
|
removeEntity(entity);
|
||||||
}
|
}
|
||||||
@@ -162,6 +163,15 @@ public class Scene {
|
|||||||
return nGetLightCount(getNativeObject());
|
return nGetLightCount(getNativeObject());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if the given entity is in the Scene.
|
||||||
|
*
|
||||||
|
* @return Whether the given entity is in the Scene.
|
||||||
|
*/
|
||||||
|
public boolean hasEntity(@Entity int entity) {
|
||||||
|
return nHasEntity(getNativeObject(), entity);
|
||||||
|
}
|
||||||
|
|
||||||
public long getNativeObject() {
|
public long getNativeObject() {
|
||||||
if (mNativeObject == 0) {
|
if (mNativeObject == 0) {
|
||||||
throw new IllegalStateException("Calling method on destroyed Scene");
|
throw new IllegalStateException("Calling method on destroyed Scene");
|
||||||
@@ -181,4 +191,5 @@ public class Scene {
|
|||||||
private static native void nRemoveEntities(long nativeScene, int[] entities);
|
private static native void nRemoveEntities(long nativeScene, int[] entities);
|
||||||
private static native int nGetRenderableCount(long nativeScene);
|
private static native int nGetRenderableCount(long nativeScene);
|
||||||
private static native int nGetLightCount(long nativeScene);
|
private static native int nGetLightCount(long nativeScene);
|
||||||
|
private static native boolean nHasEntity(long nativeScene, int entity);
|
||||||
}
|
}
|
||||||
|
|||||||
+177
@@ -0,0 +1,177 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2021 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.google.android.filament;
|
||||||
|
|
||||||
|
import androidx.annotation.IntRange;
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
|
import java.nio.Buffer;
|
||||||
|
import java.nio.BufferOverflowException;
|
||||||
|
import java.nio.FloatBuffer;
|
||||||
|
|
||||||
|
public class SkinningBuffer {
|
||||||
|
private long mNativeObject;
|
||||||
|
private SkinningBuffer(long nativeSkinningBuffer) {
|
||||||
|
mNativeObject = nativeSkinningBuffer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Builder {
|
||||||
|
@SuppressWarnings({"FieldCanBeLocal", "UnusedDeclaration"})
|
||||||
|
// Keep to finalize native resources
|
||||||
|
private final SkinningBuffer.Builder.BuilderFinalizer mFinalizer;
|
||||||
|
private final long mNativeBuilder;
|
||||||
|
|
||||||
|
public Builder() {
|
||||||
|
mNativeBuilder = nCreateBuilder();
|
||||||
|
mFinalizer = new SkinningBuffer.Builder.BuilderFinalizer(mNativeBuilder);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Size of the skinning buffer in bones.
|
||||||
|
*
|
||||||
|
* <p>Due to limitation in the GLSL, the SkinningBuffer must always by a multiple of
|
||||||
|
* 256, this adjustment is done automatically, but can cause
|
||||||
|
* some memory overhead. This memory overhead can be mitigated by using the same
|
||||||
|
* {@link SkinningBuffer} to store the bone information for multiple RenderPrimitives.</p>
|
||||||
|
*
|
||||||
|
* @param boneCount Number of bones the skinning buffer can hold.
|
||||||
|
* @return this <code>Builder</code> object for chaining calls
|
||||||
|
*/
|
||||||
|
@NonNull
|
||||||
|
public Builder boneCount(@IntRange(from = 1) int boneCount) {
|
||||||
|
nBuilderBoneCount(mNativeBuilder, boneCount);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The new buffer is created with identity bones
|
||||||
|
*
|
||||||
|
* @param initialize true to initializing the buffer, false to not.
|
||||||
|
* @return A reference to this Builder for chaining calls.
|
||||||
|
*/
|
||||||
|
@NonNull
|
||||||
|
public Builder initialize(boolean initialize) {
|
||||||
|
nBuilderInitialize(mNativeBuilder, initialize);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates and returns the <code>SkinningBuffer</code> object.
|
||||||
|
*
|
||||||
|
* @param engine reference to the {@link Engine} to associate this <code>SkinningBuffer</code>
|
||||||
|
* with.
|
||||||
|
*
|
||||||
|
* @return the newly created <code>SkinningBuffer</code> object
|
||||||
|
*
|
||||||
|
* @exception IllegalStateException if the SkinningBuffer could not be created
|
||||||
|
*
|
||||||
|
* @see #setBonesAsMatrices
|
||||||
|
* @see #setBonesAsQuaternions
|
||||||
|
*/
|
||||||
|
@NonNull
|
||||||
|
public SkinningBuffer build(@NonNull Engine engine) {
|
||||||
|
long nativeSkinningBuffer = nBuilderBuild(mNativeBuilder, engine.getNativeObject());
|
||||||
|
if (nativeSkinningBuffer == 0)
|
||||||
|
throw new IllegalStateException("Couldn't create SkinningBuffer");
|
||||||
|
return new SkinningBuffer(nativeSkinningBuffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class BuilderFinalizer {
|
||||||
|
private final long mNativeObject;
|
||||||
|
|
||||||
|
BuilderFinalizer(long nativeObject) {
|
||||||
|
mNativeObject = nativeObject;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void finalize() {
|
||||||
|
try {
|
||||||
|
super.finalize();
|
||||||
|
} catch (Throwable t) { // Ignore
|
||||||
|
} finally {
|
||||||
|
nDestroyBuilder(mNativeObject);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates the bone transforms in the range [offset, offset + boneCount).
|
||||||
|
*
|
||||||
|
* @param engine {@link Engine} instance
|
||||||
|
* @param matrices A {@link FloatBuffer} containing boneCount 4x4 packed matrices (i.e. 16 floats each matrix and no gap between matrices)
|
||||||
|
* @param boneCount Number of bones to set
|
||||||
|
* @param offset Index of the first bone to set
|
||||||
|
*/
|
||||||
|
public void setBonesAsMatrices(@NonNull Engine engine,
|
||||||
|
@NonNull Buffer matrices, @IntRange(from = 0, to = 255) int boneCount,
|
||||||
|
@IntRange(from = 0) int offset) {
|
||||||
|
int result = nSetBonesAsMatrices(mNativeObject, engine.getNativeObject(),
|
||||||
|
matrices, matrices.remaining(), boneCount, offset);
|
||||||
|
if (result < 0) {
|
||||||
|
throw new BufferOverflowException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates the bone transforms in the range [offset, offset + boneCount).
|
||||||
|
*
|
||||||
|
* @param engine {@link Engine} instance
|
||||||
|
* @param quaternions A {@link FloatBuffer} containing boneCount transforms. Each transform consists of 8 float.
|
||||||
|
* float 0 to 3 encode a unit quaternion <code>w+ix+jy+kz</code> stored as <code>x,y,z,w</code>.
|
||||||
|
* float 4 to 7 encode a translation stored as <code>x,y,z,1</code>.
|
||||||
|
* @param boneCount Number of bones to set
|
||||||
|
* @param offset Index of the first bone to set
|
||||||
|
*/
|
||||||
|
public void setBonesAsQuaternions(@NonNull Engine engine,
|
||||||
|
@NonNull Buffer quaternions, @IntRange(from = 0, to = 255) int boneCount,
|
||||||
|
@IntRange(from = 0) int offset) {
|
||||||
|
int result = nSetBonesAsQuaternions(mNativeObject, engine.getNativeObject(),
|
||||||
|
quaternions, quaternions.remaining(), boneCount, offset);
|
||||||
|
if (result < 0) {
|
||||||
|
throw new BufferOverflowException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return number of bones in this {@link SkinningBuffer}
|
||||||
|
*/
|
||||||
|
public int getBoneCount() {
|
||||||
|
return nGetBoneCount(mNativeObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getNativeObject() {
|
||||||
|
if (mNativeObject == 0) {
|
||||||
|
throw new IllegalStateException("Calling method on destroyed IndexBuffer");
|
||||||
|
}
|
||||||
|
return mNativeObject;
|
||||||
|
}
|
||||||
|
|
||||||
|
void clearNativeObject() {
|
||||||
|
mNativeObject = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static native long nCreateBuilder();
|
||||||
|
private static native void nDestroyBuilder(long nativeBuilder);
|
||||||
|
private static native void nBuilderBoneCount(long nativeBuilder, int boneCount);
|
||||||
|
private static native void nBuilderInitialize(long nativeBuilder, boolean initialize);
|
||||||
|
private static native long nBuilderBuild(long nativeBuilder, long nativeEngine);
|
||||||
|
|
||||||
|
private static native int nSetBonesAsMatrices(long nativeObject, long nativeEngine, Buffer matrices, int remaining, int boneCount, int offset);
|
||||||
|
private static native int nSetBonesAsQuaternions(long nativeObject, long nativeEngine, Buffer quaternions, int remaining, int boneCount, int offset);
|
||||||
|
private static native int nGetBoneCount(long nativeObject);
|
||||||
|
}
|
||||||
@@ -23,8 +23,6 @@ import androidx.annotation.Size;
|
|||||||
|
|
||||||
import static com.google.android.filament.Colors.LinearColor;
|
import static com.google.android.filament.Colors.LinearColor;
|
||||||
|
|
||||||
import com.google.android.filament.proguard.UsedByReflection;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Skybox
|
* Skybox
|
||||||
* <p>When added to a {@link Scene}, the <code>Skybox</code> fills all untouched pixels.</p>
|
* <p>When added to a {@link Scene}, the <code>Skybox</code> fills all untouched pixels.</p>
|
||||||
@@ -53,11 +51,7 @@ import com.google.android.filament.proguard.UsedByReflection;
|
|||||||
public class Skybox {
|
public class Skybox {
|
||||||
private long mNativeObject;
|
private long mNativeObject;
|
||||||
|
|
||||||
public Skybox(Engine engine, long nativeSkybox) {
|
public Skybox(long nativeSkybox) {
|
||||||
mNativeObject = nativeSkybox;
|
|
||||||
}
|
|
||||||
|
|
||||||
Skybox(long nativeSkybox) {
|
|
||||||
mNativeObject = nativeSkybox;
|
mNativeObject = nativeSkybox;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -115,13 +109,14 @@ public class Skybox {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the <code>Skybox</code> intensity when no {@link IndirectLight} is set
|
* Sets the <code>Skybox</code> intensity when no {@link IndirectLight} is set on the
|
||||||
|
* {@link Scene}.
|
||||||
*
|
*
|
||||||
* <p>This call is ignored when an {@link IndirectLight} is set, otherwise it is used in
|
* <p>This call is ignored when an {@link IndirectLight} is set on the {@link Scene}, and
|
||||||
* its place.</p>
|
* the intensity of the {@link IndirectLight} is used instead.</p>
|
||||||
*
|
*
|
||||||
* @param envIntensity Scale factor applied to the skybox texel values such that
|
* @param envIntensity Scale factor applied to the skybox texel values such that
|
||||||
* the result is in cd/m<sup>2</sup> (lux) units (default = 30000)
|
* the result is in <i>lux</i>, or <i>lumen/m^2</i> (default = 30000)
|
||||||
*
|
*
|
||||||
* @return This Builder, for chaining calls.
|
* @return This Builder, for chaining calls.
|
||||||
*
|
*
|
||||||
@@ -237,7 +232,7 @@ public class Skybox {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the <code>Skybox</code>'s intensity in cd/m<sup>2</sup>.
|
* Returns the <code>Skybox</code>'s intensity in <i>lux</i>, or <i>lumen/m^2</i>.
|
||||||
*/
|
*/
|
||||||
public float getIntensity() { return nGetIntensity(getNativeObject()); }
|
public float getIntensity() { return nGetIntensity(getNativeObject()); }
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,6 @@ import java.nio.ReadOnlyBufferException;
|
|||||||
* Stream supports three different configurations:
|
* Stream supports three different configurations:
|
||||||
*
|
*
|
||||||
* <dl>
|
* <dl>
|
||||||
* <dt>TEXTURE_ID</dt> <dd>takes an OpenGL texture ID and incurs a copy</dd>
|
|
||||||
* <dt>ACQUIRED</dt> <dd>connects to an Android AHardwareBuffer</dd>
|
* <dt>ACQUIRED</dt> <dd>connects to an Android AHardwareBuffer</dd>
|
||||||
* <dt>NATIVE</dt> <dd>connects to an Android SurfaceTexture</dd>
|
* <dt>NATIVE</dt> <dd>connects to an Android SurfaceTexture</dd>
|
||||||
* </dl>
|
* </dl>
|
||||||
@@ -66,12 +65,6 @@ import java.nio.ReadOnlyBufferException;
|
|||||||
* </ul>
|
* </ul>
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* The <b>TEXTURE_ID</b> configuration achieves synchronization automatically. In this mode,
|
|
||||||
* Filament performs a copy on the main thread during beginFrame by blitting the external image into
|
|
||||||
* an internal round-robin queue of images. This copy has a run-time cost.
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* <p>
|
|
||||||
* For <b>ACQUIRED</b> streams, there is no need to perform the copy because Filament explictly
|
* For <b>ACQUIRED</b> streams, there is no need to perform the copy because Filament explictly
|
||||||
* acquires the stream, then releases it later via a callback function. This configuration is
|
* acquires the stream, then releases it later via a callback function. This configuration is
|
||||||
* especially useful when the Vulkan backend is enabled.
|
* especially useful when the Vulkan backend is enabled.
|
||||||
@@ -91,6 +84,8 @@ import java.nio.ReadOnlyBufferException;
|
|||||||
* @see Engine#destroyStream
|
* @see Engine#destroyStream
|
||||||
*/
|
*/
|
||||||
public class Stream {
|
public class Stream {
|
||||||
|
private static final StreamType[] sStreamTypeValues = StreamType.values();
|
||||||
|
|
||||||
private long mNativeObject;
|
private long mNativeObject;
|
||||||
private long mNativeEngine;
|
private long mNativeEngine;
|
||||||
|
|
||||||
@@ -101,9 +96,6 @@ public class Stream {
|
|||||||
/** Not synchronized but copy-free. Good for video. */
|
/** Not synchronized but copy-free. Good for video. */
|
||||||
NATIVE,
|
NATIVE,
|
||||||
|
|
||||||
/** Synchronized, but GL-only and incurs copies. Good for AR on devices before API 26. */
|
|
||||||
TEXTURE_ID,
|
|
||||||
|
|
||||||
/** Synchronized, copy-free, and take a release callback. Good for AR but requires API 26+. */
|
/** Synchronized, copy-free, and take a release callback. Good for AR but requires API 26+. */
|
||||||
ACQUIRED,
|
ACQUIRED,
|
||||||
};
|
};
|
||||||
@@ -119,8 +111,7 @@ public class Stream {
|
|||||||
* By default, Stream objects are {@link StreamType#ACQUIRED ACQUIRED} and must have external images pushed to them via
|
* By default, Stream objects are {@link StreamType#ACQUIRED ACQUIRED} and must have external images pushed to them via
|
||||||
* {@link #setAcquiredImage}.
|
* {@link #setAcquiredImage}.
|
||||||
*
|
*
|
||||||
* To create a {@link StreamType#NATIVE NATIVE} or {@link StreamType#TEXTURE_ID TEXTURE_ID} stream, call one of the <pre>stream</pre> methods
|
* To create a {@link StreamType#NATIVE NATIVE} stream, call the <pre>stream</pre> method on the builder.
|
||||||
* on the builder.
|
|
||||||
*/
|
*/
|
||||||
public static class Builder {
|
public static class Builder {
|
||||||
@SuppressWarnings({"FieldCanBeLocal", "UnusedDeclaration"}) // Keep to finalize native resources
|
@SuppressWarnings({"FieldCanBeLocal", "UnusedDeclaration"}) // Keep to finalize native resources
|
||||||
@@ -154,25 +145,6 @@ public class Stream {
|
|||||||
throw new IllegalArgumentException("Invalid stream source: " + streamSource);
|
throw new IllegalArgumentException("Invalid stream source: " + streamSource);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a {@link StreamType#TEXTURE_ID TEXTURE_ID} stream. A copy stream will sample data from the supplied
|
|
||||||
* external texture and copy it into an internal private texture.
|
|
||||||
*
|
|
||||||
* <p>Currently only OpenGL external texture ids are supported.</p>
|
|
||||||
*
|
|
||||||
* @param externalTextureId An opaque texture id (typically a GLuint created with
|
|
||||||
* <code>glGenTextures()</code>) in a context shared with
|
|
||||||
* filament -- in that case this texture's target must be
|
|
||||||
* <code>GL_TEXTURE_EXTERNAL_OES.</code>
|
|
||||||
* @return This Builder, for chaining calls.
|
|
||||||
* @see Texture#setExternalStream
|
|
||||||
*/
|
|
||||||
@NonNull
|
|
||||||
public Builder stream(long externalTextureId) {
|
|
||||||
nBuilderStream(mNativeBuilder, externalTextureId);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param width initial width of the incoming stream. Whether this value is used is
|
* @param width initial width of the incoming stream. Whether this value is used is
|
||||||
* stream dependent. On Android, it must be set when using
|
* stream dependent. On Android, it must be set when using
|
||||||
@@ -231,10 +203,10 @@ public class Stream {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Indicates whether this <code>Stream</code> is NATIVE, TEXTURE_ID, or ACQUIRED.
|
* Indicates whether this <code>Stream</code> is NATIVE or ACQUIRED.
|
||||||
*/
|
*/
|
||||||
public StreamType getStreamType() {
|
public StreamType getStreamType() {
|
||||||
return StreamType.values()[nGetStreamType(getNativeObject())];
|
return sStreamTypeValues[nGetStreamType(getNativeObject())];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -250,7 +222,7 @@ public class Stream {
|
|||||||
* also where the callback is invoked. This method can only be used for streams that were
|
* also where the callback is invoked. This method can only be used for streams that were
|
||||||
* constructed without calling the {@link Builder.stream} method.
|
* constructed without calling the {@link Builder.stream} method.
|
||||||
*
|
*
|
||||||
* See {@link Stream} for more information about NATIVE, TEXTURE_ID, and ACQUIRED configurations.
|
* See {@link Stream} for more information about NATIVE and ACQUIRED configurations.
|
||||||
*
|
*
|
||||||
* @param hwbuffer {@link android.hardware.HardwareBuffer HardwareBuffer} (requires API level 26)
|
* @param hwbuffer {@link android.hardware.HardwareBuffer HardwareBuffer} (requires API level 26)
|
||||||
* @param handler {@link java.util.concurrent.Executor Executor} or {@link android.os.Handler Handler}.
|
* @param handler {@link java.util.concurrent.Executor Executor} or {@link android.os.Handler Handler}.
|
||||||
@@ -272,92 +244,6 @@ public class Stream {
|
|||||||
nSetDimensions(getNativeObject(), width, height);
|
nSetDimensions(getNativeObject(), width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Reads back the content of the last frame of a <code>Stream</code> since the last call to
|
|
||||||
* {@link Renderer#beginFrame}.
|
|
||||||
*
|
|
||||||
* <p>The Stream must be a copy stream, which can be checked with {@link #getStreamType()}.
|
|
||||||
* This function is a no-op otherwise.</p>
|
|
||||||
*
|
|
||||||
* <pre>
|
|
||||||
*
|
|
||||||
* Stream buffer User buffer (PixelBufferDescriptor)
|
|
||||||
* +--------------------+
|
|
||||||
* | | .stride .alignment
|
|
||||||
* | | ----------------------->-->
|
|
||||||
* | | O----------------------+--+ low addresses
|
|
||||||
* | | | | | |
|
|
||||||
* | w | | | .top | |
|
|
||||||
* | <---------> | | V | |
|
|
||||||
* | +---------+ | | +---------+ | |
|
|
||||||
* | | ^ | | ======> | | | | |
|
|
||||||
* | x | h| | | |.left| | | |
|
|
||||||
* +------>| v | | +---->| | | |
|
|
||||||
* | +.........+ | | +.........+ | |
|
|
||||||
* | ^ | | | |
|
|
||||||
* | y | | +----------------------+--+ high addresses
|
|
||||||
* O------------+-------+
|
|
||||||
*
|
|
||||||
* </pre>
|
|
||||||
*
|
|
||||||
* <p>Typically readPixels() will be called after {@link Renderer#beginFrame}.</p>
|
|
||||||
*
|
|
||||||
* <p>After calling this method, the callback associated with <code>buffer</code>
|
|
||||||
* will be invoked on the main thread, indicating that the read-back has completed.
|
|
||||||
* Typically, this will happen after multiple calls to {@link Renderer#beginFrame},
|
|
||||||
* {@link Renderer#render}, {@link Renderer#endFrame}.</p>
|
|
||||||
*
|
|
||||||
* <p><code>readPixels</code> is intended for debugging and testing.
|
|
||||||
* It will impact performance significantly.</p>
|
|
||||||
*
|
|
||||||
* @param xoffset left offset of the sub-region to read back
|
|
||||||
* @param yoffset bottom offset of the sub-region to read back
|
|
||||||
* @param width width of the sub-region to read back
|
|
||||||
* @param height height of the sub-region to read back
|
|
||||||
* @param buffer client-side buffer where the read-back will be written
|
|
||||||
*
|
|
||||||
* <p>
|
|
||||||
* The following format are always supported:
|
|
||||||
* <li>{@link Texture.Format#RGBA}</li>
|
|
||||||
* <li>{@link Texture.Format#RGBA_INTEGER}</li>
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* <p>
|
|
||||||
* The following types are always supported:
|
|
||||||
* <li>{@link Texture.Type#UBYTE}</li>
|
|
||||||
* <li>{@link Texture.Type#UINT}</li>
|
|
||||||
* <li>{@link Texture.Type#INT}</li>
|
|
||||||
* <li>{@link Texture.Type#FLOAT}</li>
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* <p>Other combination of format/type may be supported. If a combination is
|
|
||||||
* not supported, this operation may fail silently. Use a DEBUG build
|
|
||||||
* to get some logs about the failure.</p>
|
|
||||||
*
|
|
||||||
* @exception BufferOverflowException if the specified parameters would result in reading
|
|
||||||
* outside of <code>buffer</code>.
|
|
||||||
*/
|
|
||||||
public void readPixels(
|
|
||||||
@IntRange(from = 0) int xoffset, @IntRange(from = 0) int yoffset,
|
|
||||||
@IntRange(from = 0) int width, @IntRange(from = 0) int height,
|
|
||||||
@NonNull Texture.PixelBufferDescriptor buffer) {
|
|
||||||
|
|
||||||
if (buffer.storage.isReadOnly()) {
|
|
||||||
throw new ReadOnlyBufferException();
|
|
||||||
}
|
|
||||||
|
|
||||||
int result = nReadPixels(getNativeObject(), mNativeEngine,
|
|
||||||
xoffset, yoffset, width, height,
|
|
||||||
buffer.storage, buffer.storage.remaining(),
|
|
||||||
buffer.left, buffer.top, buffer.type.ordinal(), buffer.alignment,
|
|
||||||
buffer.stride, buffer.format.ordinal(),
|
|
||||||
buffer.handler, buffer.callback);
|
|
||||||
|
|
||||||
if (result < 0) {
|
|
||||||
throw new BufferOverflowException();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the presentation time of the currently displayed frame in nanosecond.
|
* Returns the presentation time of the currently displayed frame in nanosecond.
|
||||||
*
|
*
|
||||||
@@ -383,7 +269,6 @@ public class Stream {
|
|||||||
private static native long nCreateBuilder();
|
private static native long nCreateBuilder();
|
||||||
private static native void nDestroyBuilder(long nativeStreamBuilder);
|
private static native void nDestroyBuilder(long nativeStreamBuilder);
|
||||||
private static native void nBuilderStreamSource(long nativeStreamBuilder, Object streamSource);
|
private static native void nBuilderStreamSource(long nativeStreamBuilder, Object streamSource);
|
||||||
private static native void nBuilderStream(long nativeStreamBuilder, long externalTextureId);
|
|
||||||
private static native void nBuilderWidth(long nativeStreamBuilder, int width);
|
private static native void nBuilderWidth(long nativeStreamBuilder, int width);
|
||||||
private static native void nBuilderHeight(long nativeStreamBuilder, int height);
|
private static native void nBuilderHeight(long nativeStreamBuilder, int height);
|
||||||
private static native long nBuilderBuild(long nativeStreamBuilder, long nativeEngine);
|
private static native long nBuilderBuild(long nativeStreamBuilder, long nativeEngine);
|
||||||
|
|||||||
@@ -91,11 +91,34 @@ public class SwapChain {
|
|||||||
*/
|
*/
|
||||||
public static final long CONFIG_ENABLE_XCB = 0x4;
|
public static final long CONFIG_ENABLE_XCB = 0x4;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates that the SwapChain must automatically perform linear to sRGB encoding.
|
||||||
|
*
|
||||||
|
* This flag is ignored if isSRGBSwapChainSupported() is false.
|
||||||
|
*
|
||||||
|
* When using this flag, post-processing should be disabled.
|
||||||
|
*
|
||||||
|
* @see SwapChain#isSRGBSwapChainSupported
|
||||||
|
* @see View#setPostProcessingEnabled
|
||||||
|
*/
|
||||||
|
public static final long CONFIG_SRGB_COLORSPACE = 0x10;
|
||||||
|
|
||||||
SwapChain(long nativeSwapChain, Object surface) {
|
SwapChain(long nativeSwapChain, Object surface) {
|
||||||
mNativeObject = nativeSwapChain;
|
mNativeObject = nativeSwapChain;
|
||||||
mSurface = surface;
|
mSurface = surface;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return whether createSwapChain supports the SWAP_CHAIN_CONFIG_SRGB_COLORSPACE flag.
|
||||||
|
* The default implementation returns false.
|
||||||
|
*
|
||||||
|
* @param engine A reference to the filament Engine
|
||||||
|
* @return true if SWAP_CHAIN_CONFIG_SRGB_COLORSPACE is supported, false otherwise.
|
||||||
|
*/
|
||||||
|
public static boolean isSRGBSwapChainSupported(@NonNull Engine engine) {
|
||||||
|
return nIsSRGBSwapChainSupported(engine.getNativeObject());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the native <code>Object</code> this <code>SwapChain</code> was created from or null
|
* @return the native <code>Object</code> this <code>SwapChain</code> was created from or null
|
||||||
* for a headless SwapChain.
|
* for a headless SwapChain.
|
||||||
@@ -114,10 +137,6 @@ public class SwapChain {
|
|||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* The FrameCompletedCallback is guaranteed to be called on the main Filament thread.
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* <p>
|
|
||||||
* Warning: Only Filament's Metal backend supports frame callbacks. Other backends ignore the
|
* Warning: Only Filament's Metal backend supports frame callbacks. Other backends ignore the
|
||||||
* callback (which will never be called) and proceed normally.
|
* callback (which will never be called) and proceed normally.
|
||||||
* </p>
|
* </p>
|
||||||
@@ -141,4 +160,5 @@ public class SwapChain {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static native void nSetFrameCompletedCallback(long nativeSwapChain, Object handler, Runnable callback);
|
private static native void nSetFrameCompletedCallback(long nativeSwapChain, Object handler, Runnable callback);
|
||||||
|
private static native boolean nIsSRGBSwapChainSupported(long nativeEngine);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,13 +71,12 @@ import static com.google.android.filament.Texture.Type.COMPRESSED;
|
|||||||
* @see MaterialInstance#setParameter(String, Texture, TextureSampler)
|
* @see MaterialInstance#setParameter(String, Texture, TextureSampler)
|
||||||
*/
|
*/
|
||||||
public class Texture {
|
public class Texture {
|
||||||
|
private static final Sampler[] sSamplerValues = Sampler.values();
|
||||||
|
private static final InternalFormat[] sInternalFormatValues = InternalFormat.values();
|
||||||
|
|
||||||
private long mNativeObject;
|
private long mNativeObject;
|
||||||
|
|
||||||
Texture(long nativeTexture) {
|
public Texture(long nativeTexture) {
|
||||||
mNativeObject = nativeTexture;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Texture(Engine engine, long nativeTexture) {
|
|
||||||
mNativeObject = nativeTexture;
|
mNativeObject = nativeTexture;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -220,7 +219,50 @@ public class Texture {
|
|||||||
ETC2_EAC_RGBA8, ETC2_EAC_SRGBA8,
|
ETC2_EAC_RGBA8, ETC2_EAC_SRGBA8,
|
||||||
|
|
||||||
// Available everywhere except Android/iOS
|
// Available everywhere except Android/iOS
|
||||||
DXT1_RGB, DXT1_RGBA, DXT3_RGBA, DXT5_RGBA
|
DXT1_RGB, DXT1_RGBA, DXT3_RGBA, DXT5_RGBA,
|
||||||
|
DXT1_SRGB, DXT1_SRGBA, DXT3_SRGBA, DXT5_SRGBA,
|
||||||
|
|
||||||
|
// ASTC formats are available with a GLES extension
|
||||||
|
RGBA_ASTC_4x4,
|
||||||
|
RGBA_ASTC_5x4,
|
||||||
|
RGBA_ASTC_5x5,
|
||||||
|
RGBA_ASTC_6x5,
|
||||||
|
RGBA_ASTC_6x6,
|
||||||
|
RGBA_ASTC_8x5,
|
||||||
|
RGBA_ASTC_8x6,
|
||||||
|
RGBA_ASTC_8x8,
|
||||||
|
RGBA_ASTC_10x5,
|
||||||
|
RGBA_ASTC_10x6,
|
||||||
|
RGBA_ASTC_10x8,
|
||||||
|
RGBA_ASTC_10x10,
|
||||||
|
RGBA_ASTC_12x10,
|
||||||
|
RGBA_ASTC_12x12,
|
||||||
|
SRGB8_ALPHA8_ASTC_4x4,
|
||||||
|
SRGB8_ALPHA8_ASTC_5x4,
|
||||||
|
SRGB8_ALPHA8_ASTC_5x5,
|
||||||
|
SRGB8_ALPHA8_ASTC_6x5,
|
||||||
|
SRGB8_ALPHA8_ASTC_6x6,
|
||||||
|
SRGB8_ALPHA8_ASTC_8x5,
|
||||||
|
SRGB8_ALPHA8_ASTC_8x6,
|
||||||
|
SRGB8_ALPHA8_ASTC_8x8,
|
||||||
|
SRGB8_ALPHA8_ASTC_10x5,
|
||||||
|
SRGB8_ALPHA8_ASTC_10x6,
|
||||||
|
SRGB8_ALPHA8_ASTC_10x8,
|
||||||
|
SRGB8_ALPHA8_ASTC_10x10,
|
||||||
|
SRGB8_ALPHA8_ASTC_12x10,
|
||||||
|
SRGB8_ALPHA8_ASTC_12x12,
|
||||||
|
|
||||||
|
// RGTC formats available with a GLES extension
|
||||||
|
RED_RGTC1, // BC4 unsigned
|
||||||
|
SIGNED_RED_RGTC1, // BC4 signed
|
||||||
|
RED_GREEN_RGTC2, // BC5 unsigned
|
||||||
|
SIGNED_RED_GREEN_RGTC2, // BC5 signed
|
||||||
|
|
||||||
|
// BPTC formats available with a GLES extension
|
||||||
|
RGB_BPTC_SIGNED_FLOAT, // BC6H signed
|
||||||
|
RGB_BPTC_UNSIGNED_FLOAT,// BC6H unsigned
|
||||||
|
RGBA_BPTC_UNORM, // BC7
|
||||||
|
SRGB_ALPHA_BPTC_UNORM // BC7 sRGB
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -235,7 +277,50 @@ public class Texture {
|
|||||||
ETC2_EAC_RGBA8, ETC2_EAC_SRGBA8,
|
ETC2_EAC_RGBA8, ETC2_EAC_SRGBA8,
|
||||||
|
|
||||||
// Available everywhere except Android/iOS
|
// Available everywhere except Android/iOS
|
||||||
DXT1_RGB, DXT1_RGBA, DXT3_RGBA, DXT5_RGBA
|
DXT1_RGB, DXT1_RGBA, DXT3_RGBA, DXT5_RGBA,
|
||||||
|
DXT1_SRGB, DXT1_SRGBA, DXT3_SRGBA, DXT5_SRGBA,
|
||||||
|
|
||||||
|
// ASTC formats are available with a GLES extension
|
||||||
|
RGBA_ASTC_4x4,
|
||||||
|
RGBA_ASTC_5x4,
|
||||||
|
RGBA_ASTC_5x5,
|
||||||
|
RGBA_ASTC_6x5,
|
||||||
|
RGBA_ASTC_6x6,
|
||||||
|
RGBA_ASTC_8x5,
|
||||||
|
RGBA_ASTC_8x6,
|
||||||
|
RGBA_ASTC_8x8,
|
||||||
|
RGBA_ASTC_10x5,
|
||||||
|
RGBA_ASTC_10x6,
|
||||||
|
RGBA_ASTC_10x8,
|
||||||
|
RGBA_ASTC_10x10,
|
||||||
|
RGBA_ASTC_12x10,
|
||||||
|
RGBA_ASTC_12x12,
|
||||||
|
SRGB8_ALPHA8_ASTC_4x4,
|
||||||
|
SRGB8_ALPHA8_ASTC_5x4,
|
||||||
|
SRGB8_ALPHA8_ASTC_5x5,
|
||||||
|
SRGB8_ALPHA8_ASTC_6x5,
|
||||||
|
SRGB8_ALPHA8_ASTC_6x6,
|
||||||
|
SRGB8_ALPHA8_ASTC_8x5,
|
||||||
|
SRGB8_ALPHA8_ASTC_8x6,
|
||||||
|
SRGB8_ALPHA8_ASTC_8x8,
|
||||||
|
SRGB8_ALPHA8_ASTC_10x5,
|
||||||
|
SRGB8_ALPHA8_ASTC_10x6,
|
||||||
|
SRGB8_ALPHA8_ASTC_10x8,
|
||||||
|
SRGB8_ALPHA8_ASTC_10x10,
|
||||||
|
SRGB8_ALPHA8_ASTC_12x10,
|
||||||
|
SRGB8_ALPHA8_ASTC_12x12,
|
||||||
|
|
||||||
|
// RGTC formats available with a GLES extension
|
||||||
|
RED_RGTC1, // BC4 unsigned
|
||||||
|
SIGNED_RED_RGTC1, // BC4 signed
|
||||||
|
RED_GREEN_RGTC2, // BC5 unsigned
|
||||||
|
SIGNED_RED_GREEN_RGTC2, // BC5 signed
|
||||||
|
|
||||||
|
// BPTC formats available with a GLES extension
|
||||||
|
RGB_BPTC_SIGNED_FLOAT, // BC6H signed
|
||||||
|
RGB_BPTC_UNSIGNED_FLOAT,// BC6H unsigned
|
||||||
|
RGBA_BPTC_UNORM, // BC7
|
||||||
|
SRGB_ALPHA_BPTC_UNORM // BC7 sRGB
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -481,7 +566,7 @@ public class Texture {
|
|||||||
* @param alignment Alignment in bytes.
|
* @param alignment Alignment in bytes.
|
||||||
* @return Size of the buffer in bytes.
|
* @return Size of the buffer in bytes.
|
||||||
*/
|
*/
|
||||||
static int computeDataSize(@NonNull Format format, @NonNull Type type,
|
public static int computeDataSize(@NonNull Format format, @NonNull Type type,
|
||||||
int stride, int height, @IntRange(from = 1, to = 8) int alignment) {
|
int stride, int height, @IntRange(from = 1, to = 8) int alignment) {
|
||||||
if (type == Type.COMPRESSED) {
|
if (type == Type.COMPRESSED) {
|
||||||
return 0;
|
return 0;
|
||||||
@@ -509,12 +594,15 @@ public class Texture {
|
|||||||
case RGBA_INTEGER:
|
case RGBA_INTEGER:
|
||||||
n = 4;
|
n = 4;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
default: throw new IllegalStateException("unsupported format enum");
|
||||||
}
|
}
|
||||||
|
|
||||||
int bpp = n;
|
int bpp = n;
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case UBYTE:
|
case UBYTE:
|
||||||
case BYTE:
|
case BYTE:
|
||||||
|
case COMPRESSED:
|
||||||
// nothing to do
|
// nothing to do
|
||||||
break;
|
break;
|
||||||
case USHORT:
|
case USHORT:
|
||||||
@@ -531,6 +619,9 @@ public class Texture {
|
|||||||
// Special case, format must be RGB and uses 4 bytes
|
// Special case, format must be RGB and uses 4 bytes
|
||||||
bpp = 4;
|
bpp = 4;
|
||||||
break;
|
break;
|
||||||
|
case USHORT_565:
|
||||||
|
bpp = 2;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
int bpr = bpp * stride;
|
int bpr = bpp * stride;
|
||||||
@@ -562,6 +653,17 @@ public class Texture {
|
|||||||
return nIsTextureFormatSupported(engine.getNativeObject(), format.ordinal());
|
return nIsTextureFormatSupported(engine.getNativeObject(), format.ordinal());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks whether texture swizzling is supported in this {@link Engine}.
|
||||||
|
* This depends on the selected backend.
|
||||||
|
*
|
||||||
|
* @param engine {@link Engine}
|
||||||
|
* @return <code>true</code> if texture swizzling.
|
||||||
|
*/
|
||||||
|
public static boolean isTextureSwizzleSupported(@NonNull Engine engine) {
|
||||||
|
return nIsTextureSwizzleSupported(engine.getNativeObject());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Use <code>Builder</code> to construct a <code>Texture</code> object instance.
|
* Use <code>Builder</code> to construct a <code>Texture</code> object instance.
|
||||||
*/
|
*/
|
||||||
@@ -678,6 +780,26 @@ public class Texture {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Specify a native texture to import as a Filament texture.
|
||||||
|
* <p>
|
||||||
|
* The texture id is backend-specific:
|
||||||
|
* <ul>
|
||||||
|
* <li> OpenGL: GLuint texture ID </li>
|
||||||
|
* </ul>
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @param id a backend specific texture identifier
|
||||||
|
*
|
||||||
|
* @return This Builder, for chaining calls.
|
||||||
|
*/
|
||||||
|
@NonNull
|
||||||
|
public Builder importTexture(long id) {
|
||||||
|
nBuilderImportTexture(mNativeBuilder, id);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new <code>Texture</code> instance.
|
* Creates a new <code>Texture</code> instance.
|
||||||
* @param engine The {@link Engine} to associate this <code>Texture</code> with.
|
* @param engine The {@link Engine} to associate this <code>Texture</code> with.
|
||||||
@@ -772,7 +894,7 @@ public class Texture {
|
|||||||
*/
|
*/
|
||||||
@NonNull
|
@NonNull
|
||||||
public Sampler getTarget() {
|
public Sampler getTarget() {
|
||||||
return Sampler.values()[nGetTarget(getNativeObject())];
|
return sSamplerValues[nGetTarget(getNativeObject())];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -780,13 +902,13 @@ public class Texture {
|
|||||||
*/
|
*/
|
||||||
@NonNull
|
@NonNull
|
||||||
public InternalFormat getFormat() {
|
public InternalFormat getFormat() {
|
||||||
return InternalFormat.values()[nGetInternalFormat(getNativeObject())];
|
return sInternalFormatValues[nGetInternalFormat(getNativeObject())];
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: add a setImage() version that takes an android Bitmap
|
// TODO: add a setImage() version that takes an android Bitmap
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <code>setImage</code> is used to modify the whole content of the texure from a CPU-buffer.
|
* <code>setImage</code> is used to modify the whole content of the texture from a CPU-buffer.
|
||||||
*
|
*
|
||||||
* <p>This <code>Texture</code> instance must use {@link Sampler#SAMPLER_2D SAMPLER_2D} or
|
* <p>This <code>Texture</code> instance must use {@link Sampler#SAMPLER_2D SAMPLER_2D} or
|
||||||
* {@link Sampler#SAMPLER_EXTERNAL SAMPLER_EXTERNAL}. If the later is specified
|
* {@link Sampler#SAMPLER_EXTERNAL SAMPLER_EXTERNAL}. If the later is specified
|
||||||
@@ -814,7 +936,7 @@ public class Texture {
|
|||||||
public void setImage(@NonNull Engine engine,
|
public void setImage(@NonNull Engine engine,
|
||||||
@IntRange(from = 0) int level,
|
@IntRange(from = 0) int level,
|
||||||
@NonNull PixelBufferDescriptor buffer) {
|
@NonNull PixelBufferDescriptor buffer) {
|
||||||
setImage(engine, level, 0, 0, getWidth(level), getHeight(level), buffer);
|
setImage(engine, level, 0, 0, 0, getWidth(level), getHeight(level), 1, buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -849,40 +971,22 @@ public class Texture {
|
|||||||
@IntRange(from = 0) int xoffset, @IntRange(from = 0) int yoffset,
|
@IntRange(from = 0) int xoffset, @IntRange(from = 0) int yoffset,
|
||||||
@IntRange(from = 0) int width, @IntRange(from = 0) int height,
|
@IntRange(from = 0) int width, @IntRange(from = 0) int height,
|
||||||
@NonNull PixelBufferDescriptor buffer) {
|
@NonNull PixelBufferDescriptor buffer) {
|
||||||
int result;
|
setImage(engine, level, xoffset, yoffset, 0, width, height, 1, buffer);
|
||||||
if (buffer.type == COMPRESSED) {
|
|
||||||
result = nSetImageCompressed(getNativeObject(), engine.getNativeObject(), level,
|
|
||||||
xoffset, yoffset, width, height,
|
|
||||||
buffer.storage, buffer.storage.remaining(),
|
|
||||||
buffer.left, buffer.top, buffer.type.ordinal(), buffer.alignment,
|
|
||||||
buffer.compressedSizeInBytes, buffer.compressedFormat.ordinal(),
|
|
||||||
buffer.handler, buffer.callback);
|
|
||||||
} else {
|
|
||||||
result = nSetImage(getNativeObject(), engine.getNativeObject(), level,
|
|
||||||
xoffset, yoffset, width, height,
|
|
||||||
buffer.storage, buffer.storage.remaining(),
|
|
||||||
buffer.left, buffer.top, buffer.type.ordinal(), buffer.alignment,
|
|
||||||
buffer.stride, buffer.format.ordinal(),
|
|
||||||
buffer.handler, buffer.callback);
|
|
||||||
}
|
|
||||||
if (result < 0) {
|
|
||||||
throw new BufferOverflowException();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <code>setImage</code> is used to modify a sub-region of the 3D texture or 2D texture array
|
* <code>setImage</code> is used to modify a sub-region of a 3D texture, 2D texture array or
|
||||||
* from a CPU-buffer.
|
* cubemap from a CPU-buffer. Cubemaps are treated like a 2D array of six layers.
|
||||||
*
|
*
|
||||||
* <p>This <code>Texture</code> instance must use {@link Sampler#SAMPLER_2D_ARRAY SAMPLER_2D_ARRAY} or
|
* <p>This <code>Texture</code> instance must use {@link Sampler#SAMPLER_2D_ARRAY SAMPLER_2D_ARRAY},
|
||||||
* {@link Sampler#SAMPLER_3D SAMPLER_3D}.</p>
|
* {@link Sampler#SAMPLER_3D SAMPLER_3D} or {@link Sampler#SAMPLER_CUBEMAP SAMPLER_CUBEMAP}.</p>
|
||||||
*
|
*
|
||||||
* @param engine {@link Engine} this texture is associated to. Must be the
|
* @param engine {@link Engine} this texture is associated to. Must be the
|
||||||
* instance passed to {@link Builder#build Builder.build()}.
|
* instance passed to {@link Builder#build Builder.build()}.
|
||||||
* @param level Level to set the image for. Must be less than {@link #getLevels()}.
|
* @param level Level to set the image for. Must be less than {@link #getLevels()}.
|
||||||
* @param xoffset x-offset in texel of the region to modify
|
* @param xoffset x-offset in texel of the region to modify
|
||||||
* @param yoffset y-offset in texel of the region to modify
|
* @param yoffset y-offset in texel of the region to modify
|
||||||
* @param yoffset z-offset in texel of the region to modify
|
* @param zoffset z-offset in texel of the region to modify
|
||||||
* @param width width in texel of the region to modify
|
* @param width width in texel of the region to modify
|
||||||
* @param height height in texel of the region to modify
|
* @param height height in texel of the region to modify
|
||||||
* @param depth depth in texel or index of the region to modify
|
* @param depth depth in texel or index of the region to modify
|
||||||
@@ -948,7 +1052,9 @@ public class Texture {
|
|||||||
*
|
*
|
||||||
* @see Builder#sampler
|
* @see Builder#sampler
|
||||||
* @see PixelBufferDescriptor
|
* @see PixelBufferDescriptor
|
||||||
|
* @deprecated use {@link #setImage(Engine, int, int, int, int, int, int, int, PixelBufferDescriptor)}
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public void setImage(@NonNull Engine engine, @IntRange(from = 0) int level,
|
public void setImage(@NonNull Engine engine, @IntRange(from = 0) int level,
|
||||||
@NonNull PixelBufferDescriptor buffer,
|
@NonNull PixelBufferDescriptor buffer,
|
||||||
@NonNull @Size(min = 6) int[] faceOffsetsInBytes) {
|
@NonNull @Size(min = 6) int[] faceOffsetsInBytes) {
|
||||||
@@ -1137,6 +1243,7 @@ public class Texture {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static native boolean nIsTextureFormatSupported(long nativeEngine, int internalFormat);
|
private static native boolean nIsTextureFormatSupported(long nativeEngine, int internalFormat);
|
||||||
|
private static native boolean nIsTextureSwizzleSupported(long nativeEngine);
|
||||||
|
|
||||||
private static native long nCreateBuilder();
|
private static native long nCreateBuilder();
|
||||||
private static native void nDestroyBuilder(long nativeBuilder);
|
private static native void nDestroyBuilder(long nativeBuilder);
|
||||||
@@ -1149,6 +1256,7 @@ public class Texture {
|
|||||||
private static native void nBuilderFormat(long nativeBuilder, int format);
|
private static native void nBuilderFormat(long nativeBuilder, int format);
|
||||||
private static native void nBuilderUsage(long nativeBuilder, int flags);
|
private static native void nBuilderUsage(long nativeBuilder, int flags);
|
||||||
private static native void nBuilderSwizzle(long nativeBuilder, int r, int g, int b, int a);
|
private static native void nBuilderSwizzle(long nativeBuilder, int r, int g, int b, int a);
|
||||||
|
private static native void nBuilderImportTexture(long nativeBuilder, long id);
|
||||||
private static native long nBuilderBuild(long nativeBuilder, long nativeEngine);
|
private static native long nBuilderBuild(long nativeBuilder, long nativeEngine);
|
||||||
|
|
||||||
private static native int nGetWidth(long nativeTexture, int level);
|
private static native int nGetWidth(long nativeTexture, int level);
|
||||||
@@ -1158,37 +1266,25 @@ public class Texture {
|
|||||||
private static native int nGetTarget(long nativeTexture);
|
private static native int nGetTarget(long nativeTexture);
|
||||||
private static native int nGetInternalFormat(long nativeTexture);
|
private static native int nGetInternalFormat(long nativeTexture);
|
||||||
|
|
||||||
private static native int nSetImage(long nativeTexture, long nativeEngine,
|
|
||||||
int level, int xoffset, int yoffset, int width, int height,
|
|
||||||
Buffer storage, int remaining, int left, int bottom, int type, int alignment,
|
|
||||||
int stride, int format,
|
|
||||||
Object handler, Runnable callback);
|
|
||||||
|
|
||||||
private static native int nSetImageCompressed(long nativeTexture, long nativeEngine,
|
|
||||||
int level, int xoffset, int yoffset, int width, int height,
|
|
||||||
Buffer storage, int remaining, int left, int bottom, int type, int alignment,
|
|
||||||
int compressedSizeInBytes, int compressedFormat,
|
|
||||||
Object handler, Runnable callback);
|
|
||||||
|
|
||||||
private static native int nSetImage3D(long nativeTexture, long nativeEngine,
|
private static native int nSetImage3D(long nativeTexture, long nativeEngine,
|
||||||
int level, int xoffset, int yoffset, int zoffset, int width, int height, int depth,
|
int level, int xoffset, int yoffset, int zoffset, int width, int height, int depth,
|
||||||
Buffer storage, int remaining, int left, int bottom, int type, int alignment,
|
Buffer storage, int remaining, int left, int top, int type, int alignment,
|
||||||
int stride, int format,
|
int stride, int format,
|
||||||
Object handler, Runnable callback);
|
Object handler, Runnable callback);
|
||||||
|
|
||||||
private static native int nSetImage3DCompressed(long nativeTexture, long nativeEngine,
|
private static native int nSetImage3DCompressed(long nativeTexture, long nativeEngine,
|
||||||
int level, int xoffset, int yoffset, int zoffset, int width, int height, int depth,
|
int level, int xoffset, int yoffset, int zoffset, int width, int height, int depth,
|
||||||
Buffer storage, int remaining, int left, int bottom, int type, int alignment,
|
Buffer storage, int remaining, int left, int top, int type, int alignment,
|
||||||
int compressedSizeInBytes, int compressedFormat,
|
int compressedSizeInBytes, int compressedFormat,
|
||||||
Object handler, Runnable callback);
|
Object handler, Runnable callback);
|
||||||
|
|
||||||
private static native int nSetImageCubemap(long nativeTexture, long nativeEngine,
|
private static native int nSetImageCubemap(long nativeTexture, long nativeEngine,
|
||||||
int level, Buffer storage, int remaining, int left, int bottom, int type,
|
int level, Buffer storage, int remaining, int left, int top, int type,
|
||||||
int alignment, int stride, int format,
|
int alignment, int stride, int format,
|
||||||
int[] faceOffsetsInBytes, Object handler, Runnable callback);
|
int[] faceOffsetsInBytes, Object handler, Runnable callback);
|
||||||
|
|
||||||
private static native int nSetImageCubemapCompressed(long nativeTexture, long nativeEngine,
|
private static native int nSetImageCubemapCompressed(long nativeTexture, long nativeEngine,
|
||||||
int level, Buffer storage, int remaining, int left, int bottom, int type,
|
int level, Buffer storage, int remaining, int left, int top, int type,
|
||||||
int alignment, int compressedSizeInBytes, int compressedFormat,
|
int alignment, int compressedSizeInBytes, int compressedFormat,
|
||||||
int[] faceOffsetsInBytes, Object handler, Runnable callback);
|
int[] faceOffsetsInBytes, Object handler, Runnable callback);
|
||||||
|
|
||||||
|
|||||||
+35
-27
@@ -22,6 +22,14 @@ import androidx.annotation.NonNull;
|
|||||||
* <code>TextureSampler</code> defines how a texture is accessed.
|
* <code>TextureSampler</code> defines how a texture is accessed.
|
||||||
*/
|
*/
|
||||||
public class TextureSampler {
|
public class TextureSampler {
|
||||||
|
static final class EnumCache {
|
||||||
|
static final MinFilter[] sMinFilterValues = MinFilter.values();
|
||||||
|
static final MagFilter[] sMagFilterValues = MagFilter.values();
|
||||||
|
static final WrapMode[] sWrapModeValues = WrapMode.values();
|
||||||
|
static final CompareMode[] sCompareModeValues = CompareMode.values();
|
||||||
|
static final CompareFunction[] sCompareFunctionValues = CompareFunction.values();
|
||||||
|
}
|
||||||
|
|
||||||
public enum WrapMode {
|
public enum WrapMode {
|
||||||
/**
|
/**
|
||||||
* The edge of the texture extends to infinity.
|
* The edge of the texture extends to infinity.
|
||||||
@@ -118,7 +126,7 @@ public class TextureSampler {
|
|||||||
NEVER
|
NEVER
|
||||||
}
|
}
|
||||||
|
|
||||||
int mSampler = 0; // bit field used by native
|
long mSampler = 0; // bit field used by native
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes the <code>TextureSampler</code> with default values.
|
* Initializes the <code>TextureSampler</code> with default values.
|
||||||
@@ -202,7 +210,7 @@ public class TextureSampler {
|
|||||||
* @return the minification filter
|
* @return the minification filter
|
||||||
*/
|
*/
|
||||||
public MinFilter getMinFilter() {
|
public MinFilter getMinFilter() {
|
||||||
return MinFilter.values()[nGetMinFilter(mSampler)];
|
return EnumCache.sMinFilterValues[nGetMinFilter(mSampler)];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -218,7 +226,7 @@ public class TextureSampler {
|
|||||||
* @return the magnification filter
|
* @return the magnification filter
|
||||||
*/
|
*/
|
||||||
public MagFilter getMagFilter() {
|
public MagFilter getMagFilter() {
|
||||||
return MagFilter.values()[nGetMagFilter(mSampler)];
|
return EnumCache.sMagFilterValues[nGetMagFilter(mSampler)];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -234,7 +242,7 @@ public class TextureSampler {
|
|||||||
* @return the wrapping mode in the s (horizontal) direction
|
* @return the wrapping mode in the s (horizontal) direction
|
||||||
*/
|
*/
|
||||||
public WrapMode getWrapModeS() {
|
public WrapMode getWrapModeS() {
|
||||||
return WrapMode.values()[nGetWrapModeS(mSampler)];
|
return EnumCache.sWrapModeValues[nGetWrapModeS(mSampler)];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -249,7 +257,7 @@ public class TextureSampler {
|
|||||||
* @return the wrapping mode in the t (vertical) direction
|
* @return the wrapping mode in the t (vertical) direction
|
||||||
*/
|
*/
|
||||||
public WrapMode getWrapModeT() {
|
public WrapMode getWrapModeT() {
|
||||||
return WrapMode.values()[nGetWrapModeT(mSampler)];
|
return EnumCache.sWrapModeValues[nGetWrapModeT(mSampler)];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -264,11 +272,11 @@ public class TextureSampler {
|
|||||||
* @return the wrapping mode in the r (depth) direction
|
* @return the wrapping mode in the r (depth) direction
|
||||||
*/
|
*/
|
||||||
public WrapMode getWrapModeR() {
|
public WrapMode getWrapModeR() {
|
||||||
return WrapMode.values()[nGetWrapModeR(mSampler)];
|
return EnumCache.sWrapModeValues[nGetWrapModeR(mSampler)];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the wrapping mode in the t (depth) direction.
|
* Sets the wrapping mode in the r (depth) direction.
|
||||||
* @param mode wrapping mode
|
* @param mode wrapping mode
|
||||||
*/
|
*/
|
||||||
public void setWrapModeR(WrapMode mode) {
|
public void setWrapModeR(WrapMode mode) {
|
||||||
@@ -297,7 +305,7 @@ public class TextureSampler {
|
|||||||
* @return the comparison mode
|
* @return the comparison mode
|
||||||
*/
|
*/
|
||||||
public CompareMode getCompareMode() {
|
public CompareMode getCompareMode() {
|
||||||
return CompareMode.values()[nGetCompareMode(mSampler)];
|
return EnumCache.sCompareModeValues[nGetCompareMode(mSampler)];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -313,7 +321,7 @@ public class TextureSampler {
|
|||||||
* @return the comparison function
|
* @return the comparison function
|
||||||
*/
|
*/
|
||||||
public CompareFunction getCompareFunction() {
|
public CompareFunction getCompareFunction() {
|
||||||
return CompareFunction.values()[nGetCompareFunction(mSampler)];
|
return EnumCache.sCompareFunctionValues[nGetCompareFunction(mSampler)];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -334,26 +342,26 @@ public class TextureSampler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static native int nCreateSampler(int min, int max, int s, int t, int r);
|
private static native long nCreateSampler(int min, int max, int s, int t, int r);
|
||||||
private static native int nCreateCompareSampler(int mode, int function);
|
private static native long nCreateCompareSampler(int mode, int function);
|
||||||
|
|
||||||
private static native int nGetMinFilter(int sampler);
|
private static native int nGetMinFilter(long sampler);
|
||||||
private static native int nSetMinFilter(int sampler, int filter);
|
private static native long nSetMinFilter(long sampler, int filter);
|
||||||
private static native int nGetMagFilter(int sampler);
|
private static native int nGetMagFilter(long sampler);
|
||||||
private static native int nSetMagFilter(int sampler, int filter);
|
private static native long nSetMagFilter(long sampler, int filter);
|
||||||
|
|
||||||
private static native int nGetWrapModeS(int sampler);
|
private static native int nGetWrapModeS(long sampler);
|
||||||
private static native int nSetWrapModeS(int sampler, int mode);
|
private static native long nSetWrapModeS(long sampler, int mode);
|
||||||
private static native int nGetWrapModeT(int sampler);
|
private static native int nGetWrapModeT(long sampler);
|
||||||
private static native int nSetWrapModeT(int sampler, int mode);
|
private static native long nSetWrapModeT(long sampler, int mode);
|
||||||
private static native int nGetWrapModeR(int sampler);
|
private static native int nGetWrapModeR(long sampler);
|
||||||
private static native int nSetWrapModeR(int sampler, int mode);
|
private static native long nSetWrapModeR(long sampler, int mode);
|
||||||
|
|
||||||
private static native int nGetCompareMode(int sampler);
|
private static native int nGetCompareMode(long sampler);
|
||||||
private static native int nSetCompareMode(int sampler, int mode);
|
private static native long nSetCompareMode(long sampler, int mode);
|
||||||
private static native int nGetCompareFunction(int sampler);
|
private static native int nGetCompareFunction(long sampler);
|
||||||
private static native int nSetCompareFunction(int sampler, int function);
|
private static native long nSetCompareFunction(long sampler, int function);
|
||||||
|
|
||||||
private static native float nGetAnisotropy(int sampler);
|
private static native float nGetAnisotropy(long sampler);
|
||||||
private static native int nSetAnisotropy(int sampler, float anisotropy);
|
private static native long nSetAnisotropy(long sampler, float anisotropy);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,210 @@
|
|||||||
|
package com.google.android.filament;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Interface for tone mapping operators. A tone mapping operator, or tone mapper,
|
||||||
|
* is responsible for compressing the dynamic range of the rendered scene to a
|
||||||
|
* dynamic range suitable for display.
|
||||||
|
*
|
||||||
|
* In Filament, tone mapping is a color grading step. ToneMapper instances are
|
||||||
|
* created and passed to the ColorGrading::Builder to produce a 3D LUT that will
|
||||||
|
* be used during post-processing to prepare the final color buffer for display.
|
||||||
|
*
|
||||||
|
* Filament provides several default tone mapping operators that fall into three
|
||||||
|
* categories:
|
||||||
|
*
|
||||||
|
* <ul>
|
||||||
|
* <li>Configurable tone mapping operators</li>
|
||||||
|
* <ul>
|
||||||
|
* <li>GenericToneMapper</li>
|
||||||
|
* </ul>
|
||||||
|
* <li>Fixed-aesthetic tone mapping operators</li>
|
||||||
|
* <ul>
|
||||||
|
* <li>ACESToneMapper</li>
|
||||||
|
* <li>ACESLegacyToneMapper</li>
|
||||||
|
* <li>FilmicToneMapper</li>
|
||||||
|
* </ul>
|
||||||
|
* <li>Debug/validation tone mapping operators</li>
|
||||||
|
* <ul>
|
||||||
|
* <li>LinearToneMapper</li>
|
||||||
|
* <li>DisplayRangeToneMapper</li>
|
||||||
|
* </ul>
|
||||||
|
* </ul>
|
||||||
|
*
|
||||||
|
* You can create custom tone mapping operators by subclassing ToneMapper.
|
||||||
|
*/
|
||||||
|
public class ToneMapper {
|
||||||
|
private final long mNativeObject;
|
||||||
|
|
||||||
|
private ToneMapper(long nativeObject) {
|
||||||
|
mNativeObject = nativeObject;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getNativeObject() {
|
||||||
|
if (mNativeObject == 0) {
|
||||||
|
throw new IllegalStateException("Calling method on destroyed ToneMapper");
|
||||||
|
}
|
||||||
|
return mNativeObject;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void finalize() throws Throwable {
|
||||||
|
try {
|
||||||
|
super.finalize();
|
||||||
|
} finally {
|
||||||
|
nDestroyToneMapper(mNativeObject);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Linear tone mapping operator that returns the input color but clamped to
|
||||||
|
* the 0..1 range. This operator is mostly useful for debugging.
|
||||||
|
*/
|
||||||
|
public static class Linear extends ToneMapper {
|
||||||
|
public Linear() {
|
||||||
|
super(nCreateLinearToneMapper());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ACES tone mapping operator. This operator is an implementation of the
|
||||||
|
* ACES Reference Rendering Transform (RRT) combined with the Output Device
|
||||||
|
* Transform (ODT) for sRGB monitors (dim surround, 100 nits).
|
||||||
|
*/
|
||||||
|
public static class ACES extends ToneMapper {
|
||||||
|
public ACES() {
|
||||||
|
super(nCreateACESToneMapper());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ACES tone mapping operator, modified to match the perceived brightness
|
||||||
|
* of FilmicToneMapper. This operator is the same as ACESToneMapper but
|
||||||
|
* applies a brightness multiplier of ~1.6 to the input color value to
|
||||||
|
* target brighter viewing environments.
|
||||||
|
*/
|
||||||
|
public static class ACESLegacy extends ToneMapper {
|
||||||
|
public ACESLegacy() {
|
||||||
|
super(nCreateACESLegacyToneMapper());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* "Filmic" tone mapping operator. This tone mapper was designed to
|
||||||
|
* approximate the aesthetics of the ACES RRT + ODT for Rec.709
|
||||||
|
* and historically Filament's default tone mapping operator. It exists
|
||||||
|
* only for backward compatibility purposes and is not otherwise recommended.
|
||||||
|
*/
|
||||||
|
public static class Filmic extends ToneMapper {
|
||||||
|
public Filmic() {
|
||||||
|
super(nCreateFilmicToneMapper());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generic tone mapping operator that gives control over the tone mapping
|
||||||
|
* curve. This operator can be used to control the aesthetics of the final
|
||||||
|
* image. This operator also allows to control the dynamic range of the
|
||||||
|
* scene referred values.
|
||||||
|
*
|
||||||
|
* The tone mapping curve is defined by 5 parameters:
|
||||||
|
* <ul>
|
||||||
|
* <li>contrast: controls the contrast of the curve</li>
|
||||||
|
* referred values map to output white</li>
|
||||||
|
* <li>midGrayIn: sets the input middle gray</li>
|
||||||
|
* <li>midGrayOut: sets the output middle gray</li>
|
||||||
|
* <li>hdrMax: defines the maximum input value that will be mapped to
|
||||||
|
* output white</li>
|
||||||
|
* </ul>
|
||||||
|
*/
|
||||||
|
public static class Generic extends ToneMapper {
|
||||||
|
/**
|
||||||
|
* Builds a new generic tone mapper parameterized to closely approximate
|
||||||
|
* the {@link ACESLegacy} tone mapper. The default values are:
|
||||||
|
*
|
||||||
|
* <ul>
|
||||||
|
* <li>contrast = 1.55f</li>
|
||||||
|
* <li>midGrayIn = 0.18f</li>
|
||||||
|
* <li>midGrayOut = 0.215f</li>
|
||||||
|
* <li>hdrMax = 10.0f</li>
|
||||||
|
* </ul>
|
||||||
|
*/
|
||||||
|
public Generic() {
|
||||||
|
this(1.55f, 0.18f, 0.215f, 10.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Builds a new generic tone mapper.
|
||||||
|
*
|
||||||
|
* @param contrast: controls the contrast of the curve, must be > 0.0, values
|
||||||
|
* in the range 0.5..2.0 are recommended.
|
||||||
|
* @param midGrayIn: sets the input middle gray, between 0.0 and 1.0.
|
||||||
|
* @param midGrayOut: sets the output middle gray, between 0.0 and 1.0.
|
||||||
|
* @param hdrMax: defines the maximum input value that will be mapped to
|
||||||
|
* output white. Must be >= 1.0.
|
||||||
|
*/
|
||||||
|
public Generic(
|
||||||
|
float contrast, float midGrayIn, float midGrayOut, float hdrMax) {
|
||||||
|
super(nCreateGenericToneMapper(contrast, midGrayIn, midGrayOut, hdrMax));
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Returns the contrast of the curve as a strictly positive value. */
|
||||||
|
public float getContrast() {
|
||||||
|
return nGenericGetContrast(getNativeObject());
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Sets the contrast of the curve, must be > 0.0, values in the range 0.5..2.0 are recommended. */
|
||||||
|
public void setContrast(float contrast) {
|
||||||
|
nGenericSetContrast(getNativeObject(), contrast);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Returns the middle gray point for input values as a value between 0.0 and 1.0. */
|
||||||
|
public float getMidGrayIn() {
|
||||||
|
return nGenericGetMidGrayIn(getNativeObject());
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Sets the input middle gray, between 0.0 and 1.0. */
|
||||||
|
public void setMidGrayIn(float midGrayIn) {
|
||||||
|
nGenericSetMidGrayIn(getNativeObject(), midGrayIn);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Returns the middle gray point for output values as a value between 0.0 and 1.0. */
|
||||||
|
public float getMidGrayOut() {
|
||||||
|
return nGenericGetMidGrayOut(getNativeObject());
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Sets the output middle gray, between 0.0 and 1.0. */
|
||||||
|
public void setMidGrayOut(float midGrayOut) {
|
||||||
|
nGenericSetMidGrayOut(getNativeObject(), midGrayOut);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Returns the maximum input value that will map to output white, as a value >= 1.0. */
|
||||||
|
public float getHdrMax() {
|
||||||
|
return nGenericGetHdrMax(getNativeObject());
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Defines the maximum input value that will be mapped to output white. Must be >= 1.0. */
|
||||||
|
public void setHdrMax(float hdrMax) {
|
||||||
|
nGenericSetHdrMax(getNativeObject(), hdrMax);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static native void nDestroyToneMapper(long nativeObject);
|
||||||
|
|
||||||
|
private static native long nCreateLinearToneMapper();
|
||||||
|
private static native long nCreateACESToneMapper();
|
||||||
|
private static native long nCreateACESLegacyToneMapper();
|
||||||
|
private static native long nCreateFilmicToneMapper();
|
||||||
|
private static native long nCreateGenericToneMapper(
|
||||||
|
float contrast, float midGrayIn, float midGrayOut, float hdrMax);
|
||||||
|
|
||||||
|
// Generic tone mappper
|
||||||
|
private static native float nGenericGetContrast(long nativeObject);
|
||||||
|
private static native float nGenericGetMidGrayIn(long nativeObject);
|
||||||
|
private static native float nGenericGetMidGrayOut(long nativeObject);
|
||||||
|
private static native float nGenericGetHdrMax(long nativeObject);
|
||||||
|
|
||||||
|
private static native void nGenericSetContrast(long nativeObject, float contrast);
|
||||||
|
private static native void nGenericSetMidGrayIn(long nativeObject, float midGrayIn);
|
||||||
|
private static native void nGenericSetMidGrayOut(long nativeObject, float midGrayOut);
|
||||||
|
private static native void nGenericSetHdrMax(long nativeObject, float hdrMax);
|
||||||
|
}
|
||||||
+157
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
package com.google.android.filament;
|
package com.google.android.filament;
|
||||||
|
|
||||||
|
import androidx.annotation.IntRange;
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.annotation.Size;
|
import androidx.annotation.Size;
|
||||||
@@ -83,6 +84,35 @@ import androidx.annotation.Size;
|
|||||||
return nGetInstance(mNativeObject, entity);
|
return nGetInstance(mNativeObject, entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables or disable the accurate translation mode. Disabled by default.
|
||||||
|
*
|
||||||
|
* When accurate translation mode is active, the translation component of all transforms is
|
||||||
|
* maintained at double precision. This is only useful if the mat4 version of setTransform()
|
||||||
|
* is used, as well as getTransformAccurate().
|
||||||
|
*
|
||||||
|
* @param enable true to enable the accurate translation mode, false to disable.
|
||||||
|
*
|
||||||
|
* @see #isAccurateTranslationsEnabled
|
||||||
|
* @see #create(int, int, double[])
|
||||||
|
* @see #setTransform(int, double[])
|
||||||
|
* @see #getTransform(int, double[])
|
||||||
|
* @see #getWorldTransform(int, double[])
|
||||||
|
*/
|
||||||
|
public void setAccurateTranslationsEnabled(boolean enable) {
|
||||||
|
nSetAccurateTranslationsEnabled(mNativeObject, enable);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns whether the high precision translation mode is active.
|
||||||
|
*
|
||||||
|
* @return true if accurate translations mode is active, false otherwise
|
||||||
|
* @see #setAccurateTranslationsEnabled
|
||||||
|
*/
|
||||||
|
public boolean isAccurateTranslationsEnabled() {
|
||||||
|
return nIsAccurateTranslationsEnabled(mNativeObject);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a transform component and associates it with the given entity. The component is
|
* Creates a transform component and associates it with the given entity. The component is
|
||||||
* initialized with the identity transform.
|
* initialized with the identity transform.
|
||||||
@@ -114,6 +144,23 @@ import androidx.annotation.Size;
|
|||||||
return nCreateArray(mNativeObject, entity, parent, localTransform);
|
return nCreateArray(mNativeObject, entity, parent, localTransform);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a transform component with a parent and associates it with the given entity.
|
||||||
|
* If this component already exists on the given entity, it is first
|
||||||
|
* destroyed as if {@link #destroy} was called.
|
||||||
|
*
|
||||||
|
* @param entity an {@link Entity} to associate a transform component to.
|
||||||
|
* @param parent the {@link EntityInstance} of the parent transform
|
||||||
|
* @param localTransform the transform, relative to the parent, to initialize the transform
|
||||||
|
* component with.
|
||||||
|
* @see #destroy
|
||||||
|
*/
|
||||||
|
@EntityInstance
|
||||||
|
public int create(@Entity int entity, @EntityInstance int parent,
|
||||||
|
@Nullable @Size(min = 16) double[] localTransform) {
|
||||||
|
return nCreateArrayFp64(mNativeObject, entity, parent, localTransform);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Destroys this component from the given entity, children are orphaned.
|
* Destroys this component from the given entity, children are orphaned.
|
||||||
*
|
*
|
||||||
@@ -140,6 +187,49 @@ import androidx.annotation.Size;
|
|||||||
nSetParent(mNativeObject, i, newParent);
|
nSetParent(mNativeObject, i, newParent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the actual parent entity of an {@link EntityInstance} originally defined
|
||||||
|
* by {@link #setParent(int, int)}.
|
||||||
|
*
|
||||||
|
* @param i the {@link EntityInstance} of the transform component to get the parent from.
|
||||||
|
* @return the parent {@link Entity}.
|
||||||
|
* @see #getInstance
|
||||||
|
*/
|
||||||
|
@Entity
|
||||||
|
public int getParent(@EntityInstance int i) {
|
||||||
|
return nGetParent(mNativeObject, i);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the number of children of an {@link EntityInstance}.
|
||||||
|
*
|
||||||
|
* @param i the {@link EntityInstance} of the transform component to query.
|
||||||
|
* @return The number of children of the queried component.
|
||||||
|
*/
|
||||||
|
public int getChildCount(@EntityInstance int i) {
|
||||||
|
return nGetChildCount(mNativeObject, i);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets a list of children for a transform component.
|
||||||
|
*
|
||||||
|
* @param i the {@link EntityInstance} of the transform component to get the children
|
||||||
|
* from.
|
||||||
|
* @param outEntities array to receive the result sized to the maximum number of children to
|
||||||
|
* retrieve. If <code>null</code> is given, a new suitable array sized to
|
||||||
|
* {@link #getChildCount(int)} is allocated.
|
||||||
|
* @return Array of retrieved children {@link Entity}.
|
||||||
|
*/
|
||||||
|
public @Entity @NonNull int[] getChildren(@EntityInstance int i, @Nullable int[] outEntities) {
|
||||||
|
if (outEntities == null) {
|
||||||
|
outEntities = new int[getChildCount(i)];
|
||||||
|
}
|
||||||
|
if (outEntities.length > 0) {
|
||||||
|
nGetChildren(mNativeObject, i, outEntities, outEntities.length);
|
||||||
|
}
|
||||||
|
return outEntities;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets a local transform of a transform component.
|
* Sets a local transform of a transform component.
|
||||||
* <p>This operation can be slow if the hierarchy of transform is too deep, and this
|
* <p>This operation can be slow if the hierarchy of transform is too deep, and this
|
||||||
@@ -157,6 +247,24 @@ import androidx.annotation.Size;
|
|||||||
nSetTransform(mNativeObject, i, localTransform);
|
nSetTransform(mNativeObject, i, localTransform);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets a local transform of a transform component.
|
||||||
|
* <p>This operation can be slow if the hierarchy of transform is too deep, and this
|
||||||
|
* will be particularly bad when updating a lot of transforms. In that case,
|
||||||
|
* consider using {@link #openLocalTransformTransaction} / {@link #commitLocalTransformTransaction}.</p>
|
||||||
|
*
|
||||||
|
* @param i the {@link EntityInstance} of the transform component to set the local
|
||||||
|
* transform to.
|
||||||
|
* @param localTransform the local transform (i.e. relative to the parent).
|
||||||
|
* @see #getTransform(int, double[])
|
||||||
|
* @see #getWorldTransform(int, double[])
|
||||||
|
*/
|
||||||
|
public void setTransform(@EntityInstance int i,
|
||||||
|
@NonNull @Size(min = 16) double[] localTransform) {
|
||||||
|
Asserts.assertMat4In(localTransform);
|
||||||
|
nSetTransformFp64(mNativeObject, i, localTransform);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the local transform of a transform component.
|
* Returns the local transform of a transform component.
|
||||||
*
|
*
|
||||||
@@ -177,6 +285,26 @@ import androidx.annotation.Size;
|
|||||||
return outLocalTransform;
|
return outLocalTransform;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the local transform of a transform component.
|
||||||
|
*
|
||||||
|
* @param i the {@link EntityInstance} of the transform component to query the
|
||||||
|
* local transform from.
|
||||||
|
* @param outLocalTransform a 16 <code>float</code> array to receive the result.
|
||||||
|
* If <code>null</code> is given, a new suitable array is allocated.
|
||||||
|
* @return the local transform of the component (i.e. relative to the parent). This always
|
||||||
|
* returns the value set by setTransform().
|
||||||
|
* @see #setTransform
|
||||||
|
*/
|
||||||
|
@NonNull
|
||||||
|
@Size(min = 16)
|
||||||
|
public double[] getTransform(@EntityInstance int i,
|
||||||
|
@Nullable @Size(min = 16) double[] outLocalTransform) {
|
||||||
|
outLocalTransform = Asserts.assertMat4(outLocalTransform);
|
||||||
|
nGetTransformFp64(mNativeObject, i, outLocalTransform);
|
||||||
|
return outLocalTransform;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the world transform of a transform component.
|
* Returns the world transform of a transform component.
|
||||||
*
|
*
|
||||||
@@ -197,6 +325,26 @@ import androidx.annotation.Size;
|
|||||||
return outWorldTransform;
|
return outWorldTransform;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the world transform of a transform component.
|
||||||
|
*
|
||||||
|
* @param i the {@link EntityInstance} of the transform component to query the
|
||||||
|
* world transform from.
|
||||||
|
* @param outWorldTransform a 16 <code>float</code> array to receive the result.
|
||||||
|
* If <code>null</code> is given, a new suitable array is allocated
|
||||||
|
* @return The world transform of the component (i.e. relative to the root). This is the
|
||||||
|
* composition of this component's local transform with its parent's world transform.
|
||||||
|
* @see #setTransform
|
||||||
|
*/
|
||||||
|
@NonNull
|
||||||
|
@Size(min = 16)
|
||||||
|
public double[] getWorldTransform(@EntityInstance int i,
|
||||||
|
@Nullable @Size(min = 16) double[] outWorldTransform) {
|
||||||
|
outWorldTransform = Asserts.assertMat4(outWorldTransform);
|
||||||
|
nGetWorldTransformFp64(mNativeObject, i, outWorldTransform);
|
||||||
|
return outWorldTransform;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Opens a local transform transaction. During a transaction, {@link #getWorldTransform} can
|
* Opens a local transform transaction. During a transaction, {@link #getWorldTransform} can
|
||||||
* return an invalid transform until {@link #commitLocalTransformTransaction} is called.
|
* return an invalid transform until {@link #commitLocalTransformTransaction} is called.
|
||||||
@@ -239,11 +387,20 @@ import androidx.annotation.Size;
|
|||||||
private static native int nGetInstance(long nativeTransformManager, int entity);
|
private static native int nGetInstance(long nativeTransformManager, int entity);
|
||||||
private static native int nCreate(long nativeTransformManager, int entity);
|
private static native int nCreate(long nativeTransformManager, int entity);
|
||||||
private static native int nCreateArray(long mNativeObject, int entity, int parent, float[] localTransform);
|
private static native int nCreateArray(long mNativeObject, int entity, int parent, float[] localTransform);
|
||||||
|
private static native int nCreateArrayFp64(long mNativeObject, int entity, int parent, double[] localTransform);
|
||||||
private static native void nDestroy(long nativeTransformManager, int entity);
|
private static native void nDestroy(long nativeTransformManager, int entity);
|
||||||
private static native void nSetParent(long nativeTransformManager, int i, int newParent);
|
private static native void nSetParent(long nativeTransformManager, int i, int newParent);
|
||||||
|
private static native int nGetParent(long nativeTransformManager, int i);
|
||||||
|
private static native int nGetChildCount(long nativeTransformManager, int i);
|
||||||
|
private static native void nGetChildren(long nativeEntityManager, int i, int[] outEntities, int count);
|
||||||
private static native void nSetTransform(long nativeTransformManager, int i, float[] localTransform);
|
private static native void nSetTransform(long nativeTransformManager, int i, float[] localTransform);
|
||||||
|
private static native void nSetTransformFp64(long nativeTransformManager, int i, double[] localTransform);
|
||||||
private static native void nGetTransform(long nativeTransformManager, int i, float[] outLocalTransform);
|
private static native void nGetTransform(long nativeTransformManager, int i, float[] outLocalTransform);
|
||||||
|
private static native void nGetTransformFp64(long nativeTransformManager, int i, double[] outLocalTransform);
|
||||||
private static native void nGetWorldTransform(long nativeTransformManager, int i, float[] outWorldTransform);
|
private static native void nGetWorldTransform(long nativeTransformManager, int i, float[] outWorldTransform);
|
||||||
|
private static native void nGetWorldTransformFp64(long nativeTransformManager, int i, double[] outWorldTransform);
|
||||||
private static native void nOpenLocalTransformTransaction(long nativeTransformManager);
|
private static native void nOpenLocalTransformTransaction(long nativeTransformManager);
|
||||||
private static native void nCommitLocalTransformTransaction(long nativeTransformManager);
|
private static native void nCommitLocalTransformTransaction(long nativeTransformManager);
|
||||||
|
private static native void nSetAccurateTranslationsEnabled(long nativeTransformManager, boolean enable);
|
||||||
|
private static native boolean nIsAccurateTranslationsEnabled(long nativeTransformManager);
|
||||||
}
|
}
|
||||||
|
|||||||
+29
-71
@@ -104,48 +104,6 @@ public class VertexBuffer {
|
|||||||
HALF3,
|
HALF3,
|
||||||
HALF4,
|
HALF4,
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* Specifies the quaternion type for the {@link #populateTangentQuaternions} utility.
|
|
||||||
*/
|
|
||||||
public enum QuatType {
|
|
||||||
/** 2 bytes per component as half-floats (8 bytes per quat) */
|
|
||||||
HALF4,
|
|
||||||
|
|
||||||
/** 2 bytes per component as normalized integers (8 bytes per quat) */
|
|
||||||
SHORT4,
|
|
||||||
|
|
||||||
/** 4 bytes per component as floats (16 bytes per quat) */
|
|
||||||
FLOAT4,
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Specifies the parameters for the {@link #populateTangentQuaternions} utility.
|
|
||||||
*/
|
|
||||||
public static class QuatTangentContext {
|
|
||||||
/** desired quaternion type (required) */
|
|
||||||
public QuatType quatType;
|
|
||||||
|
|
||||||
/** number of quaternions (required) */
|
|
||||||
public int quatCount;
|
|
||||||
|
|
||||||
/** pre-allocated output buffer (required) */
|
|
||||||
public Buffer outBuffer;
|
|
||||||
|
|
||||||
/** desired stride in bytes (optional) */
|
|
||||||
public int outStride;
|
|
||||||
|
|
||||||
/** source normals (required) */
|
|
||||||
public Buffer normals;
|
|
||||||
|
|
||||||
/** normals stride in bytes (optional) */
|
|
||||||
public int normalsStride;
|
|
||||||
|
|
||||||
/** source tangents (optional) */
|
|
||||||
public Buffer tangents;
|
|
||||||
|
|
||||||
/** tangents stride in bytes (optional) */
|
|
||||||
public int tangentsStride;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class Builder {
|
public static class Builder {
|
||||||
@SuppressWarnings({"FieldCanBeLocal", "UnusedDeclaration"}) // Keep to finalize native resources
|
@SuppressWarnings({"FieldCanBeLocal", "UnusedDeclaration"}) // Keep to finalize native resources
|
||||||
@@ -170,6 +128,21 @@ public class VertexBuffer {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Allows buffers to be swapped out and shared using BufferObject.
|
||||||
|
*
|
||||||
|
* If buffer objects mode is enabled, clients must call setBufferObjectAt rather than
|
||||||
|
* setBufferAt. This allows sharing of data between VertexBuffer objects, but it may
|
||||||
|
* slightly increase the memory footprint of Filament's internal bookkeeping.
|
||||||
|
*
|
||||||
|
* @param enabled If true, enables buffer object mode. False by default.
|
||||||
|
*/
|
||||||
|
@NonNull
|
||||||
|
public Builder enableBufferObjects(boolean enabled) {
|
||||||
|
nBuilderEnableBufferObjects(mNativeBuilder, enabled);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Defines how many buffers will be created in this vertex buffer set. These buffers are
|
* Defines how many buffers will be created in this vertex buffer set. These buffers are
|
||||||
* later referenced by index from 0 to <code>bufferCount</code> - 1.
|
* later referenced by index from 0 to <code>bufferCount</code> - 1.
|
||||||
@@ -397,36 +370,21 @@ public class VertexBuffer {
|
|||||||
throw new BufferOverflowException();
|
throw new BufferOverflowException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convenience function that consumes normal vectors (and, optionally, tangent vectors) and
|
* Swaps in the given buffer object.
|
||||||
* produces quaternions that can be passed into a TANGENTS buffer.
|
|
||||||
*
|
*
|
||||||
* <p>
|
* To use this, you must first call enableBufferObjects() on the Builder.
|
||||||
* The given output buffer must be preallocated with at least quatCount * outStride bytes.
|
|
||||||
* <p>
|
|
||||||
*
|
*
|
||||||
* <p>
|
* @param engine Reference to the filament::Engine to associate this VertexBuffer with.
|
||||||
* Normals are required but tangents are optional, in which case this function tries to generate
|
* @param bufferIndex Index of the buffer to initialize. Must be between 0
|
||||||
* reasonable tangents. The given normals should be unit length.
|
* and Builder::bufferCount() - 1.
|
||||||
* </p>
|
* @param bufferObject The handle to the GPU data that will be used in this buffer slot.
|
||||||
*
|
|
||||||
* <p>
|
|
||||||
* If supplied, the tangent vectors should be unit length and should be orthogonal to the
|
|
||||||
* normals. The w component of the tangent is a sign (-1 or +1) indicating handedness of the
|
|
||||||
* basis.
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @deprecated Instead please use SurfaceOrientation since it has additional capabilities and a
|
|
||||||
* builder-style API.
|
|
||||||
*
|
|
||||||
* @param context an initialized QuatTangentContext object
|
|
||||||
*/
|
*/
|
||||||
public static void populateTangentQuaternions(@NonNull QuatTangentContext context) {
|
public void setBufferObjectAt(@NonNull Engine engine, int bufferIndex,
|
||||||
nPopulateTangentQuaternions(context.quatType.ordinal(), context.quatCount,
|
@NonNull BufferObject bufferObject) {
|
||||||
context.outBuffer, context.outBuffer.remaining(), context.outStride,
|
nSetBufferObjectAt(getNativeObject(), engine.getNativeObject(), bufferIndex,
|
||||||
context.normals, context.normals.remaining(), context.normalsStride,
|
bufferObject.getNativeObject());
|
||||||
context.tangents, context.tangents != null ? context.tangents.remaining() : 0,
|
|
||||||
context.tangentsStride);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getNativeObject() {
|
public long getNativeObject() {
|
||||||
@@ -443,6 +401,7 @@ public class VertexBuffer {
|
|||||||
private static native long nCreateBuilder();
|
private static native long nCreateBuilder();
|
||||||
private static native void nDestroyBuilder(long nativeBuilder);
|
private static native void nDestroyBuilder(long nativeBuilder);
|
||||||
private static native void nBuilderVertexCount(long nativeBuilder, int vertexCount);
|
private static native void nBuilderVertexCount(long nativeBuilder, int vertexCount);
|
||||||
|
private static native void nBuilderEnableBufferObjects(long nativeBuilder, boolean enabled);
|
||||||
private static native void nBuilderBufferCount(long nativeBuilder, int bufferCount);
|
private static native void nBuilderBufferCount(long nativeBuilder, int bufferCount);
|
||||||
private static native void nBuilderAttribute(long nativeBuilder, int attribute,
|
private static native void nBuilderAttribute(long nativeBuilder, int attribute,
|
||||||
int bufferIndex, int attributeType, int byteOffset, int byteStride);
|
int bufferIndex, int attributeType, int byteOffset, int byteStride);
|
||||||
@@ -455,7 +414,6 @@ public class VertexBuffer {
|
|||||||
int bufferIndex, Buffer buffer, int remaining, int destOffsetInBytes, int count,
|
int bufferIndex, Buffer buffer, int remaining, int destOffsetInBytes, int count,
|
||||||
Object handler, Runnable callback);
|
Object handler, Runnable callback);
|
||||||
|
|
||||||
private static native void nPopulateTangentQuaternions(int quatType, int quatCount,
|
private static native void nSetBufferObjectAt(long nativeVertexBuffer, long nativeEngine,
|
||||||
Buffer outBuffer, int outRemaining, int outStride, Buffer normals, int normalsRemaining,
|
int bufferIndex, long nativeBufferObject);
|
||||||
int normalsStride, Buffer tangents, int tangentsRemaining, int tangentsStride);
|
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
-2
@@ -157,8 +157,6 @@ public class DisplayHelper {
|
|||||||
info = new Renderer.DisplayInfo();
|
info = new Renderer.DisplayInfo();
|
||||||
}
|
}
|
||||||
info.refreshRate = DisplayHelper.getRefreshRate(display);
|
info.refreshRate = DisplayHelper.getRefreshRate(display);
|
||||||
info.presentationDeadlineNanos = DisplayHelper.getPresentationDeadlineNanos(display);
|
|
||||||
info.vsyncOffsetNanos = DisplayHelper.getAppVsyncOffsetNanos(display);
|
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+60
@@ -0,0 +1,60 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2023 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.google.android.filament.android;
|
||||||
|
|
||||||
|
import com.google.android.filament.Engine;
|
||||||
|
import com.google.android.filament.Fence;
|
||||||
|
|
||||||
|
public class FilamentHelper {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Wait for all pending frames to be processed before returning. This is to avoid a race
|
||||||
|
* between the surface being resized before pending frames are rendered into it.
|
||||||
|
* <p>
|
||||||
|
* For {@link android.view.TextureView} this must be called before the texture's size is
|
||||||
|
* reconfigured, which unfortunately is done by the Android framework before
|
||||||
|
* {@link UiHelper} listeners are invoked. Therefore <code>synchronizePendingFrames</code>
|
||||||
|
* cannot be called from
|
||||||
|
* {@link android.view.TextureView.SurfaceTextureListener#onSurfaceTextureSizeChanged}; instead
|
||||||
|
* a subclass of {@link android.view.TextureView} must be used in order to call it from
|
||||||
|
* {@link android.view.TextureView#onSizeChanged}:
|
||||||
|
* </p>
|
||||||
|
* <pre>
|
||||||
|
* public class MyTextureView extends TextureView {
|
||||||
|
* private Engine engine;
|
||||||
|
* protected void onSizeChanged(int w, int h, int oldw, int oldh) {
|
||||||
|
* FilamentHelper.synchronizePendingFrames(engine);
|
||||||
|
* super.onSizeChanged(w, h, oldw, oldh);
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* Otherwise, this is typically called from {@link UiHelper.RendererCallback#onResized},
|
||||||
|
* {@link android.view.SurfaceHolder.Callback#surfaceChanged}.
|
||||||
|
*
|
||||||
|
* @param engine Filament engine to synchronize
|
||||||
|
*
|
||||||
|
* @see UiHelper.RendererCallback#onResized
|
||||||
|
* @see android.view.SurfaceHolder.Callback#surfaceChanged
|
||||||
|
* @see android.view.TextureView#onSizeChanged
|
||||||
|
*/
|
||||||
|
static public void synchronizePendingFrames(Engine engine) {
|
||||||
|
Fence fence = engine.createFence();
|
||||||
|
fence.wait(Fence.Mode.FLUSH, Fence.WAIT_FOR_EVER);
|
||||||
|
engine.destroyFence(fence);
|
||||||
|
}
|
||||||
|
}
|
||||||
-2
@@ -23,8 +23,6 @@ import androidx.annotation.NonNull;
|
|||||||
import com.google.android.filament.Engine;
|
import com.google.android.filament.Engine;
|
||||||
import com.google.android.filament.Texture;
|
import com.google.android.filament.Texture;
|
||||||
|
|
||||||
import java.lang.reflect.Method;
|
|
||||||
|
|
||||||
public final class TextureHelper {
|
public final class TextureHelper {
|
||||||
// Keep in sync with Texture.cpp
|
// Keep in sync with Texture.cpp
|
||||||
private static final int BITMAP_CONFIG_ALPHA_8 = 0;
|
private static final int BITMAP_CONFIG_ALPHA_8 = 0;
|
||||||
|
|||||||
+23
-3
@@ -84,6 +84,14 @@ import com.google.android.filament.SwapChain;
|
|||||||
* // The native surface has changed size. This is always called at least once
|
* // The native surface has changed size. This is always called at least once
|
||||||
* // after the surface is created (after onNativeWindowChanged() is invoked).
|
* // after the surface is created (after onNativeWindowChanged() is invoked).
|
||||||
* public void onResized(int width, int height) {
|
* public void onResized(int width, int height) {
|
||||||
|
*
|
||||||
|
* // Wait for all pending frames to be processed before returning. This is to
|
||||||
|
* // avoid a race between the surface being resized before pending frames are
|
||||||
|
* // rendered into it.
|
||||||
|
* Fence fence = mEngine.createFence();
|
||||||
|
* fence.wait(Fence.Mode.FLUSH, Fence.WAIT_FOR_EVER);
|
||||||
|
* mEngine.destroyFence(fence);
|
||||||
|
*
|
||||||
* // Compute camera projection and set the viewport on the view
|
* // Compute camera projection and set the viewport on the view
|
||||||
* }
|
* }
|
||||||
* });
|
* });
|
||||||
@@ -175,7 +183,7 @@ public class UiHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static class SurfaceViewHandler implements RenderSurface {
|
private static class SurfaceViewHandler implements RenderSurface {
|
||||||
private SurfaceView mSurfaceView;
|
private final SurfaceView mSurfaceView;
|
||||||
|
|
||||||
SurfaceViewHandler(SurfaceView surface) {
|
SurfaceViewHandler(SurfaceView surface) {
|
||||||
mSurfaceView = surface;
|
mSurfaceView = surface;
|
||||||
@@ -192,7 +200,7 @@ public class UiHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static class SurfaceHolderHandler implements RenderSurface {
|
private static class SurfaceHolderHandler implements RenderSurface {
|
||||||
private SurfaceHolder mSurfaceHolder;
|
private final SurfaceHolder mSurfaceHolder;
|
||||||
|
|
||||||
SurfaceHolderHandler(SurfaceHolder surface) {
|
SurfaceHolderHandler(SurfaceHolder surface) {
|
||||||
mSurfaceHolder = surface;
|
mSurfaceHolder = surface;
|
||||||
@@ -209,7 +217,7 @@ public class UiHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private class TextureViewHandler implements RenderSurface {
|
private class TextureViewHandler implements RenderSurface {
|
||||||
private TextureView mTextureView;
|
private final TextureView mTextureView;
|
||||||
private Surface mSurface;
|
private Surface mSurface;
|
||||||
|
|
||||||
TextureViewHandler(TextureView surface) { mTextureView = surface; }
|
TextureViewHandler(TextureView surface) { mTextureView = surface; }
|
||||||
@@ -236,6 +244,10 @@ public class UiHelper {
|
|||||||
}
|
}
|
||||||
mSurface = surface;
|
mSurface = surface;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Surface getSurface() {
|
||||||
|
return mSurface;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -481,6 +493,14 @@ public class UiHelper {
|
|||||||
} else {
|
} else {
|
||||||
mRenderCallback.onResized(width, height);
|
mRenderCallback.onResized(width, height);
|
||||||
}
|
}
|
||||||
|
// We must recreate the SwapChain to guarantee that it sees the new size.
|
||||||
|
// More precisely, for an EGL client, the EGLSurface must be recreated. For
|
||||||
|
// a Vulkan client, the SwapChain must be recreated. Calling
|
||||||
|
// onNativeWindowChanged() will accomplish that.
|
||||||
|
// This requirement comes from SurfaceTexture.setDefaultBufferSize()
|
||||||
|
// documentation.
|
||||||
|
TextureViewHandler textureViewHandler = (TextureViewHandler) mRenderSurface;
|
||||||
|
mRenderCallback.onNativeWindowChanged(textureViewHandler.getSurface());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
cmake_minimum_required(VERSION 3.6)
|
cmake_minimum_required(VERSION 3.19)
|
||||||
|
project(filament-utils-android)
|
||||||
|
|
||||||
set(FILAMENT_DIR ${FILAMENT_DIST_DIR})
|
set(FILAMENT_DIR ${FILAMENT_DIST_DIR})
|
||||||
|
set(IMAGEIO_DIR ../../libs/imageio)
|
||||||
|
|
||||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../gltfio-android ${CMAKE_CURRENT_BINARY_DIR}/gltfio-android)
|
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../gltfio-android ${CMAKE_CURRENT_BINARY_DIR}/gltfio-android)
|
||||||
|
|
||||||
@@ -12,27 +14,60 @@ add_library(image STATIC IMPORTED)
|
|||||||
set_target_properties(image PROPERTIES IMPORTED_LOCATION
|
set_target_properties(image PROPERTIES IMPORTED_LOCATION
|
||||||
${FILAMENT_DIR}/lib/${ANDROID_ABI}/libimage.a)
|
${FILAMENT_DIR}/lib/${ANDROID_ABI}/libimage.a)
|
||||||
|
|
||||||
include_directories(${FILAMENT_DIR}/include
|
add_library(ktxreader STATIC IMPORTED)
|
||||||
..
|
set_target_properties(ktxreader PROPERTIES IMPORTED_LOCATION
|
||||||
../../libs/utils/include)
|
${FILAMENT_DIR}/lib/${ANDROID_ABI}/libktxreader.a)
|
||||||
|
|
||||||
|
add_library(viewer STATIC IMPORTED)
|
||||||
|
set_target_properties(viewer PROPERTIES IMPORTED_LOCATION
|
||||||
|
${FILAMENT_DIR}/lib/${ANDROID_ABI}/libviewer.a)
|
||||||
|
|
||||||
|
add_library(civetweb STATIC IMPORTED)
|
||||||
|
set_target_properties(civetweb PROPERTIES IMPORTED_LOCATION
|
||||||
|
${FILAMENT_DIR}/lib/${ANDROID_ABI}/libcivetweb.a)
|
||||||
|
|
||||||
|
add_library(iblprefilter STATIC IMPORTED)
|
||||||
|
set_target_properties(iblprefilter PROPERTIES IMPORTED_LOCATION
|
||||||
|
${FILAMENT_DIR}/lib/${ANDROID_ABI}/libfilament-iblprefilter.a)
|
||||||
|
|
||||||
set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} -Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/libfilament-utils-jni.map")
|
set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} -Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/libfilament-utils-jni.map")
|
||||||
|
|
||||||
add_library(filament-utils-jni SHARED
|
add_library(filament-utils-jni SHARED
|
||||||
|
src/main/cpp/AutomationEngine.cpp
|
||||||
src/main/cpp/Bookmark.cpp
|
src/main/cpp/Bookmark.cpp
|
||||||
|
src/main/cpp/HDRLoader.cpp
|
||||||
|
src/main/cpp/IBLPrefilterContext.cpp
|
||||||
src/main/cpp/Utils.cpp
|
src/main/cpp/Utils.cpp
|
||||||
src/main/cpp/Manipulator.cpp
|
src/main/cpp/Manipulator.cpp
|
||||||
|
src/main/cpp/RemoteServer.cpp
|
||||||
|
|
||||||
|
${IMAGEIO_DIR}/include/imageio/ImageDecoder.h
|
||||||
|
${IMAGEIO_DIR}/include/imageio/HDRDecoder.h
|
||||||
|
${IMAGEIO_DIR}/src/HDRDecoder.cpp
|
||||||
|
|
||||||
../common/CallbackUtils.cpp
|
../common/CallbackUtils.cpp
|
||||||
../common/NioUtils.cpp
|
../common/NioUtils.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
|
target_compile_definitions(filament-utils-jni PUBLIC IMAGEIO_LITE=1)
|
||||||
|
|
||||||
|
target_include_directories(filament-utils-jni PRIVATE
|
||||||
|
${FILAMENT_DIR}/include
|
||||||
|
..
|
||||||
|
../../filament/backend/include
|
||||||
|
${IMAGEIO_DIR}/include
|
||||||
|
../../libs/utils/include)
|
||||||
|
|
||||||
set_target_properties(filament-utils-jni PROPERTIES LINK_DEPENDS
|
set_target_properties(filament-utils-jni PROPERTIES LINK_DEPENDS
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/libfilament-utils-jni.symbols)
|
${CMAKE_CURRENT_SOURCE_DIR}/libfilament-utils-jni.symbols)
|
||||||
|
|
||||||
# The ordering in the following list is important because CMake does not have dependency information.
|
# The ordering in the following list is important because CMake does not have dependency information.
|
||||||
target_link_libraries(filament-utils-jni
|
target_link_libraries(filament-utils-jni
|
||||||
gltfio-jni
|
gltfio-jni
|
||||||
|
civetweb
|
||||||
camutils
|
camutils
|
||||||
|
iblprefilter
|
||||||
image
|
image
|
||||||
|
ktxreader
|
||||||
|
viewer
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,16 +1,10 @@
|
|||||||
apply plugin: 'kotlin-android'
|
apply plugin: 'kotlin-android'
|
||||||
|
kotlin {
|
||||||
|
jvmToolchain(versions.jdk)
|
||||||
|
}
|
||||||
|
|
||||||
android {
|
android {
|
||||||
flavorDimensions "functionality"
|
namespace 'com.google.android.filament.utils'
|
||||||
productFlavors {
|
|
||||||
full {
|
|
||||||
dimension "functionality"
|
|
||||||
}
|
|
||||||
|
|
||||||
lite {
|
|
||||||
dimension "functionality"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sourceSets {
|
sourceSets {
|
||||||
main {
|
main {
|
||||||
@@ -18,24 +12,23 @@ android {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// No need to package up the following shared libs, which arise as a side effect of our
|
defaultConfig {
|
||||||
// externalNativeBuild dependencies. When clients pick and choose from project-level gradle
|
missingDimensionStrategy 'functionality', 'full'
|
||||||
// dependencies, these shared libs already get pulled in, so we need to avoid the error:
|
}
|
||||||
// "More than one file was found with OS independent path ..."
|
|
||||||
packagingOptions {
|
packagingOptions {
|
||||||
exclude 'lib/*/libfilament-jni.so'
|
// No need to package up the following shared libs, which arise as a side effect of our
|
||||||
exclude 'lib/*/libgltfio-jni.so'
|
// externalNativeBuild dependencies. When clients pick and choose from project-level gradle
|
||||||
|
// dependencies, these shared libs already get pulled in, so we need to avoid the error:
|
||||||
|
// "More than one file was found with OS independent path ..."
|
||||||
|
jniLibs {
|
||||||
|
excludes += ['lib/*/libfilament-jni.so', 'lib/*/libgltfio-jni.so']
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
configurations.all { config ->
|
publishing {
|
||||||
// Hack to preserve the version of the dependencies
|
singleVariant("release") {
|
||||||
if (!config.name.endsWith('Publication')) {
|
withSourcesJar()
|
||||||
resolutionStrategy {
|
withJavadocJar()
|
||||||
dependencySubstitution {
|
|
||||||
substitute(module("com.google.android.filament:gltfio-android:${VERSION_NAME}")).with(project(":gltfio-android"))
|
|
||||||
substitute(module("com.google.android.filament:gltfio-android-lite:${VERSION_NAME}")).with(project(":gltfio-android"))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -43,13 +36,12 @@ configurations.all { config ->
|
|||||||
dependencies {
|
dependencies {
|
||||||
implementation deps.kotlin
|
implementation deps.kotlin
|
||||||
implementation deps.androidx.annotations
|
implementation deps.androidx.annotations
|
||||||
implementation project(':filament-android')
|
|
||||||
|
|
||||||
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.3'
|
implementation deps.coroutines.core
|
||||||
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.3'
|
implementation deps.coroutines.android
|
||||||
|
|
||||||
fullImplementation module("com.google.android.filament:gltfio-android:${VERSION_NAME}")
|
api project(':filament-android')
|
||||||
liteImplementation module("com.google.android.filament:gltfio-android-lite:${VERSION_NAME}")
|
api project(':gltfio-android')
|
||||||
}
|
}
|
||||||
|
|
||||||
apply from: rootProject.file('gradle/gradle-mvn-push.gradle')
|
apply from: rootProject.file('gradle/gradle-mvn-push.gradle')
|
||||||
@@ -57,14 +49,9 @@ apply from: rootProject.file('gradle/gradle-mvn-push.gradle')
|
|||||||
afterEvaluate {
|
afterEvaluate {
|
||||||
publishing {
|
publishing {
|
||||||
publications {
|
publications {
|
||||||
fullRelease(MavenPublication) {
|
release(MavenPublication) {
|
||||||
artifactId = POM_ARTIFACT_ID_FULL
|
artifactId = POM_ARTIFACT_ID
|
||||||
from components.fullRelease
|
from components.release
|
||||||
}
|
|
||||||
|
|
||||||
liteRelease(MavenPublication) {
|
|
||||||
artifactId = POM_ARTIFACT_ID_LITE
|
|
||||||
from components.liteRelease
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
POM_NAME=Filament Android Utilities
|
POM_NAME=Filament Android Utilities
|
||||||
POM_ARTIFACT_ID_FULL=filament-utils-android
|
POM_ARTIFACT_ID=filament-utils-android
|
||||||
POM_ARTIFACT_ID_LITE=filament-utils-android-lite
|
|
||||||
POM_PACKAGING=aar
|
POM_PACKAGING=aar
|
||||||
|
|||||||
@@ -0,0 +1,222 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2021 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <jni.h>
|
||||||
|
|
||||||
|
#include <viewer/AutomationEngine.h>
|
||||||
|
|
||||||
|
using namespace filament;
|
||||||
|
using namespace filament::viewer;
|
||||||
|
using namespace utils;
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT jlong JNICALL
|
||||||
|
Java_com_google_android_filament_utils_AutomationEngine_nCreateAutomationEngine(JNIEnv* env, jclass,
|
||||||
|
jstring spec_) {
|
||||||
|
const char* spec = env->GetStringUTFChars(spec_, 0);
|
||||||
|
jlong result = (jlong) AutomationEngine::createFromJSON(spec, strlen(spec));
|
||||||
|
env->ReleaseStringUTFChars(spec_, spec);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT jlong JNICALL
|
||||||
|
Java_com_google_android_filament_utils_AutomationEngine_nCreateDefaultAutomationEngine(JNIEnv* env,
|
||||||
|
jclass klass) {
|
||||||
|
return (jlong) AutomationEngine::createDefault();
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT void JNICALL
|
||||||
|
Java_com_google_android_filament_utils_AutomationEngine_nSetOptions(JNIEnv* env, jclass klass,
|
||||||
|
jlong nativeAutomation, jfloat sleepDuration, jint minFrameCount, jboolean verbose) {
|
||||||
|
AutomationEngine* automation = (AutomationEngine*) nativeAutomation;
|
||||||
|
AutomationEngine::Options options = {
|
||||||
|
.sleepDuration = sleepDuration,
|
||||||
|
.minFrameCount = minFrameCount,
|
||||||
|
.verbose = (bool) verbose,
|
||||||
|
|
||||||
|
// Since they write to the filesystem, we do not currently support exporting screenshots
|
||||||
|
// and JSON files on Android.
|
||||||
|
.exportScreenshots = false,
|
||||||
|
.exportSettings = false,
|
||||||
|
};
|
||||||
|
automation->setOptions(options);
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT void JNICALL
|
||||||
|
Java_com_google_android_filament_utils_AutomationEngine_nStartRunning(JNIEnv* env, jclass klass,
|
||||||
|
jlong nativeAutomation) {
|
||||||
|
AutomationEngine* automation = (AutomationEngine*) nativeAutomation;
|
||||||
|
automation->startRunning();
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT void JNICALL
|
||||||
|
Java_com_google_android_filament_utils_AutomationEngine_nStartBatchMode(JNIEnv* env, jclass klass,
|
||||||
|
jlong nativeAutomation) {
|
||||||
|
AutomationEngine* automation = (AutomationEngine*) nativeAutomation;
|
||||||
|
automation->startBatchMode();
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT void JNICALL
|
||||||
|
Java_com_google_android_filament_utils_AutomationEngine_nTick(JNIEnv* env, jclass klass,
|
||||||
|
jlong nativeAutomation, jlong nativeEngine,
|
||||||
|
jlong view, jlongArray materials, jlong renderer, jfloat deltaTime) {
|
||||||
|
using MaterialPointer = MaterialInstance*;
|
||||||
|
jsize materialCount = 0;
|
||||||
|
jlong* longMaterials = nullptr;
|
||||||
|
MaterialPointer* ptrMaterials = nullptr;
|
||||||
|
if (materials) {
|
||||||
|
materialCount = env->GetArrayLength(materials);
|
||||||
|
ptrMaterials = new MaterialPointer[materialCount];
|
||||||
|
longMaterials = env->GetLongArrayElements(materials, nullptr);
|
||||||
|
for (jsize i = 0; i < materialCount; i++) {
|
||||||
|
ptrMaterials[i] = (MaterialPointer) longMaterials[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
AutomationEngine* automation = (AutomationEngine*) nativeAutomation;
|
||||||
|
AutomationEngine::ViewerContent content = {
|
||||||
|
.view = (View*) view,
|
||||||
|
.renderer = (Renderer*) renderer,
|
||||||
|
.materials = ptrMaterials,
|
||||||
|
.materialCount = (size_t) materialCount,
|
||||||
|
};
|
||||||
|
Engine* engine = (Engine*)nativeEngine;
|
||||||
|
automation->tick(engine, content, deltaTime);
|
||||||
|
if (longMaterials) {
|
||||||
|
env->ReleaseLongArrayElements(materials, longMaterials, 0);
|
||||||
|
delete[] ptrMaterials;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT void JNICALL
|
||||||
|
Java_com_google_android_filament_utils_AutomationEngine_nApplySettings(JNIEnv* env, jclass klass,
|
||||||
|
jlong nativeAutomation, jlong nativeEngine,
|
||||||
|
jstring json, jlong view, jlongArray materials, jlong nativeIbl,
|
||||||
|
jint sunlightEntity, jintArray assetLights, jlong nativeLm, jlong scene, jlong renderer) {
|
||||||
|
using MaterialPointer = MaterialInstance*;
|
||||||
|
|
||||||
|
jsize materialCount = 0;
|
||||||
|
jlong* longMaterials = nullptr;
|
||||||
|
MaterialPointer* ptrMaterials = nullptr;
|
||||||
|
if (materials) {
|
||||||
|
materialCount = env->GetArrayLength(materials);
|
||||||
|
ptrMaterials = new MaterialPointer[materialCount];
|
||||||
|
longMaterials = env->GetLongArrayElements(materials, nullptr);
|
||||||
|
for (jsize i = 0; i < materialCount; i++) {
|
||||||
|
ptrMaterials[i] = (MaterialPointer) longMaterials[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
jsize lightCount = 0;
|
||||||
|
jint* intLights = nullptr;
|
||||||
|
if (assetLights) {
|
||||||
|
lightCount = env->GetArrayLength(assetLights);
|
||||||
|
intLights = env->GetIntArrayElements(assetLights, nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
static_assert(sizeof(jint) == sizeof(Entity));
|
||||||
|
|
||||||
|
AutomationEngine* automation = (AutomationEngine*) nativeAutomation;
|
||||||
|
const char* nativeJson = env->GetStringUTFChars(json, 0);
|
||||||
|
size_t jsonLength = env->GetStringUTFLength(json);
|
||||||
|
|
||||||
|
AutomationEngine::ViewerContent content = {
|
||||||
|
.view = (View*) view,
|
||||||
|
.renderer = (Renderer*) renderer,
|
||||||
|
.materials = ptrMaterials,
|
||||||
|
.materialCount = (size_t) materialCount,
|
||||||
|
.lightManager = (LightManager*) nativeLm,
|
||||||
|
.scene = (Scene*) scene,
|
||||||
|
.indirectLight = (IndirectLight*) nativeIbl,
|
||||||
|
.sunlight = (Entity&) sunlightEntity,
|
||||||
|
.assetLights = (Entity*) intLights,
|
||||||
|
.assetLightCount = (size_t) lightCount,
|
||||||
|
};
|
||||||
|
Engine* engine = (Engine*)nativeEngine;
|
||||||
|
automation->applySettings(engine, nativeJson, jsonLength, content);
|
||||||
|
env->ReleaseStringUTFChars(json, nativeJson);
|
||||||
|
if (longMaterials) {
|
||||||
|
env->ReleaseLongArrayElements(materials, longMaterials, 0);
|
||||||
|
delete[] ptrMaterials;
|
||||||
|
}
|
||||||
|
if (intLights) {
|
||||||
|
env->ReleaseIntArrayElements(assetLights, intLights, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT void JNICALL
|
||||||
|
Java_com_google_android_filament_utils_AutomationEngine_nGetViewerOptions(JNIEnv* env, jclass,
|
||||||
|
jlong nativeObject, jobject result) {
|
||||||
|
AutomationEngine* automation = (AutomationEngine*) nativeObject;
|
||||||
|
auto options = automation->getViewerOptions();
|
||||||
|
|
||||||
|
const jclass klass = env->GetObjectClass(result);
|
||||||
|
|
||||||
|
const jfieldID cameraAperture = env->GetFieldID(klass, "cameraAperture", "F");
|
||||||
|
const jfieldID cameraSpeed = env->GetFieldID(klass, "cameraSpeed", "F");
|
||||||
|
const jfieldID cameraISO = env->GetFieldID(klass, "cameraISO", "F");
|
||||||
|
const jfieldID cameraNear = env->GetFieldID(klass, "cameraNear", "F");
|
||||||
|
const jfieldID cameraFar = env->GetFieldID(klass, "cameraFar", "F");
|
||||||
|
const jfieldID groundShadowStrength = env->GetFieldID(klass, "groundShadowStrength", "F");
|
||||||
|
const jfieldID groundPlaneEnabled = env->GetFieldID(klass, "groundPlaneEnabled", "Z");
|
||||||
|
const jfieldID skyboxEnabled = env->GetFieldID(klass, "skyboxEnabled", "Z");
|
||||||
|
const jfieldID cameraFocalLength = env->GetFieldID(klass, "cameraFocalLength", "F");
|
||||||
|
const jfieldID cameraFocusDistance = env->GetFieldID(klass, "cameraFocusDistance", "F");
|
||||||
|
const jfieldID autoScaleEnabled = env->GetFieldID(klass, "autoScaleEnabled", "Z");
|
||||||
|
const jfieldID autoInstancingEnabled = env->GetFieldID(klass, "autoInstancingEnabled", "Z");
|
||||||
|
|
||||||
|
env->SetFloatField(result, cameraAperture, options.cameraAperture);
|
||||||
|
env->SetFloatField(result, cameraSpeed, options.cameraSpeed);
|
||||||
|
env->SetFloatField(result, cameraISO, options.cameraISO);
|
||||||
|
env->SetFloatField(result, cameraNear, options.cameraNear);
|
||||||
|
env->SetFloatField(result, cameraFar, options.cameraFar);
|
||||||
|
env->SetFloatField(result, groundShadowStrength, options.groundShadowStrength);
|
||||||
|
env->SetBooleanField(result, groundPlaneEnabled, options.groundPlaneEnabled);
|
||||||
|
env->SetBooleanField(result, skyboxEnabled, options.skyboxEnabled);
|
||||||
|
env->SetFloatField(result, cameraFocalLength, options.cameraFocalLength);
|
||||||
|
env->SetFloatField(result, cameraFocusDistance, options.cameraFocusDistance);
|
||||||
|
env->SetBooleanField(result, autoScaleEnabled, options.autoScaleEnabled);
|
||||||
|
env->SetBooleanField(result, autoInstancingEnabled, options.autoInstancingEnabled);
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT jlong JNICALL
|
||||||
|
Java_com_google_android_filament_utils_AutomationEngine_nGetColorGrading(JNIEnv*, jclass,
|
||||||
|
jlong nativeObject, jlong nativeEngine) {
|
||||||
|
AutomationEngine* automation = (AutomationEngine*) nativeObject;
|
||||||
|
return (jlong) automation->getColorGrading((Engine*) nativeEngine);
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT void JNICALL
|
||||||
|
Java_com_google_android_filament_utils_AutomationEngine_nSignalBatchMode(JNIEnv*, jclass, jlong native) {
|
||||||
|
AutomationEngine* automation = (AutomationEngine*) native;
|
||||||
|
automation->signalBatchMode();
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT void JNICALL
|
||||||
|
Java_com_google_android_filament_utils_AutomationEngine_nStopRunning(JNIEnv*, jclass, jlong native) {
|
||||||
|
AutomationEngine* automation = (AutomationEngine*) native;
|
||||||
|
automation->stopRunning();
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT jboolean JNICALL
|
||||||
|
Java_com_google_android_filament_utils_AutomationEngine_nShouldClose(JNIEnv*, jclass, jlong native) {
|
||||||
|
AutomationEngine* automation = (AutomationEngine*) native;
|
||||||
|
return automation->shouldClose();
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT void JNICALL
|
||||||
|
Java_com_google_android_filament_utils_AutomationEngine_nDestroy(JNIEnv*, jclass, jlong native) {
|
||||||
|
AutomationEngine* automation = (AutomationEngine*) native;
|
||||||
|
delete automation;
|
||||||
|
}
|
||||||
@@ -0,0 +1,91 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2021 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <jni.h>
|
||||||
|
|
||||||
|
#include <filament/Engine.h>
|
||||||
|
#include <filament/Texture.h>
|
||||||
|
|
||||||
|
#include <imageio/HDRDecoder.h>
|
||||||
|
|
||||||
|
#include <utils/Log.h>
|
||||||
|
|
||||||
|
#include <sstream>
|
||||||
|
|
||||||
|
#include "common/NioUtils.h"
|
||||||
|
|
||||||
|
using namespace filament;
|
||||||
|
using namespace image;
|
||||||
|
using namespace utils;
|
||||||
|
|
||||||
|
using PixelBufferDescriptor = Texture::PixelBufferDescriptor;
|
||||||
|
|
||||||
|
jlong nCreateHDRTexture(JNIEnv* env, jclass,
|
||||||
|
jlong nativeEngine, jobject javaBuffer, jint remaining, jint internalFormat) {
|
||||||
|
|
||||||
|
Engine* engine = (Engine*) nativeEngine;
|
||||||
|
AutoBuffer buffer(env, javaBuffer, remaining);
|
||||||
|
Texture::InternalFormat textureFormat = (Texture::InternalFormat) internalFormat;
|
||||||
|
|
||||||
|
auto dataPtr = (char const*) buffer.getData();
|
||||||
|
const size_t byteCount = buffer.getSize();
|
||||||
|
|
||||||
|
// This creates a copy but it's the easest way to create a memory stream.
|
||||||
|
std::string ins(dataPtr, byteCount);
|
||||||
|
std::istringstream in(ins);
|
||||||
|
|
||||||
|
LinearImage* image = new LinearImage(ImageDecoder::decode(in, "memory.hdr"));
|
||||||
|
|
||||||
|
// This can happen if a decoding error occurs.
|
||||||
|
if (image->getChannels() != 3) {
|
||||||
|
delete image;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
Texture* texture = Texture::Builder()
|
||||||
|
.width(image->getWidth())
|
||||||
|
.height(image->getHeight())
|
||||||
|
.levels(0xff)
|
||||||
|
.sampler(Texture::Sampler::SAMPLER_2D)
|
||||||
|
.format(textureFormat)
|
||||||
|
.build(*engine);
|
||||||
|
|
||||||
|
if (texture == nullptr) {
|
||||||
|
slog.e << "Unable to create Filament Texture from HDR image." << io::endl;
|
||||||
|
delete image;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
PixelBufferDescriptor::Callback freeCallback = [](void* buf, size_t, void* userdata) {
|
||||||
|
delete (LinearImage*) userdata;
|
||||||
|
};
|
||||||
|
|
||||||
|
PixelBufferDescriptor pbd(
|
||||||
|
(void const* ) image->getPixelRef(),
|
||||||
|
image->getWidth() * image->getHeight() * 3 * sizeof(float),
|
||||||
|
PixelBufferDescriptor::PixelDataFormat::RGB,
|
||||||
|
PixelBufferDescriptor::PixelDataType::FLOAT,
|
||||||
|
freeCallback,
|
||||||
|
image);
|
||||||
|
|
||||||
|
// Note that the setImage call could fail (e.g. due to an invalid combination of internal format
|
||||||
|
// and PixelDataFormat) but there is no way of detecting such a failure.
|
||||||
|
texture->setImage(*engine, 0, std::move(pbd));
|
||||||
|
|
||||||
|
texture->generateMipmaps(*engine);
|
||||||
|
|
||||||
|
return (jlong) texture;
|
||||||
|
}
|
||||||
@@ -0,0 +1,75 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2021 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <jni.h>
|
||||||
|
|
||||||
|
#include <filament-iblprefilter/IBLPrefilterContext.h>
|
||||||
|
|
||||||
|
#include <filament/Engine.h>
|
||||||
|
#include <filament/Texture.h>
|
||||||
|
|
||||||
|
using namespace filament;
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT jlong JNICALL
|
||||||
|
Java_com_google_android_filament_utils_IBLPrefilterContext_nCreate(JNIEnv* env, jclass,
|
||||||
|
jlong nativeEngine) {
|
||||||
|
Engine* engine = (Engine*) nativeEngine;
|
||||||
|
return (jlong) new IBLPrefilterContext(*engine);
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT void JNICALL
|
||||||
|
Java_com_google_android_filament_utils_IBLPrefilterContext_nDestroy(JNIEnv*, jclass, jlong native) {
|
||||||
|
IBLPrefilterContext* context = (IBLPrefilterContext*) native;
|
||||||
|
delete context;
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT long JNICALL
|
||||||
|
Java_com_google_android_filament_utils_IBLPrefilterContext_nCreateEquirectHelper(JNIEnv* env, jclass, jlong nativeContext) {
|
||||||
|
IBLPrefilterContext* context = (IBLPrefilterContext*) nativeContext;
|
||||||
|
return (long) new IBLPrefilterContext::EquirectangularToCubemap(*context);
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT long JNICALL
|
||||||
|
Java_com_google_android_filament_utils_IBLPrefilterContext_nEquirectHelperRun(JNIEnv* env, jclass, jlong nativeHelper, long nativeEquirect) {
|
||||||
|
auto helper = (IBLPrefilterContext::EquirectangularToCubemap*) nativeHelper;
|
||||||
|
auto texture = (filament::Texture*) nativeEquirect;
|
||||||
|
auto result = (*helper)(texture);
|
||||||
|
return (long) result;
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT void JNICALL
|
||||||
|
Java_com_google_android_filament_utils_IBLPrefilterContext_nDestroyEquirectHelper(JNIEnv* env, jclass, jlong nativeObject) {
|
||||||
|
delete (IBLPrefilterContext::EquirectangularToCubemap*) nativeObject;
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT long JNICALL
|
||||||
|
Java_com_google_android_filament_utils_IBLPrefilterContext_nCreateSpecularFilter(JNIEnv* env, jclass, jlong nativeContext) {
|
||||||
|
IBLPrefilterContext* context = (IBLPrefilterContext*) nativeContext;
|
||||||
|
return (long) new IBLPrefilterContext::SpecularFilter(*context);
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT long JNICALL
|
||||||
|
Java_com_google_android_filament_utils_IBLPrefilterContext_nSpecularFilterRun(JNIEnv* env, jclass, jlong nativeHelper, long nativeSkybox) {
|
||||||
|
auto helper = (IBLPrefilterContext::SpecularFilter*) nativeHelper;
|
||||||
|
auto texture = (filament::Texture*) nativeSkybox;
|
||||||
|
auto result = (*helper)(texture);
|
||||||
|
return (long) result;
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT void JNICALL
|
||||||
|
Java_com_google_android_filament_utils_IBLPrefilterContext_nDestroySpecularFilter(JNIEnv* env, jclass, jlong nativeObject) {
|
||||||
|
delete (IBLPrefilterContext::SpecularFilter*) nativeObject;
|
||||||
|
}
|
||||||
@@ -0,0 +1,77 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2021 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <jni.h>
|
||||||
|
|
||||||
|
#include <viewer/RemoteServer.h>
|
||||||
|
|
||||||
|
using namespace filament::viewer;
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT jlong JNICALL
|
||||||
|
Java_com_google_android_filament_utils_RemoteServer_nCreate(JNIEnv* env, jclass, jint port) {
|
||||||
|
RemoteServer* server = new RemoteServer(port);
|
||||||
|
if (!server->isValid()) {
|
||||||
|
delete server;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return (jlong) server;
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT void JNICALL
|
||||||
|
Java_com_google_android_filament_utils_RemoteServer_nDestroy(JNIEnv*, jclass, jlong native) {
|
||||||
|
RemoteServer* server = (RemoteServer*) native;
|
||||||
|
delete server;
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT jstring JNICALL
|
||||||
|
Java_com_google_android_filament_utils_RemoteServer_nPeekIncomingLabel(JNIEnv* env, jclass, jlong native) {
|
||||||
|
RemoteServer* server = (RemoteServer*) native;
|
||||||
|
char const* label = server->peekIncomingLabel();
|
||||||
|
return label ? env->NewStringUTF(label) : nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT jstring JNICALL
|
||||||
|
Java_com_google_android_filament_utils_RemoteServer_nPeekReceivedLabel(JNIEnv* env, jclass, jlong native) {
|
||||||
|
RemoteServer* server = (RemoteServer*) native;
|
||||||
|
ReceivedMessage const* msg = server->peekReceivedMessage();
|
||||||
|
return msg ? env->NewStringUTF(msg->label) : nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT jint JNICALL
|
||||||
|
Java_com_google_android_filament_utils_RemoteServer_nPeekReceivedBufferLength(JNIEnv* env, jclass, jlong native) {
|
||||||
|
RemoteServer* server = (RemoteServer*) native;
|
||||||
|
ReceivedMessage const* msg = server->peekReceivedMessage();
|
||||||
|
return msg ? msg->bufferByteCount : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT void JNICALL
|
||||||
|
Java_com_google_android_filament_utils_RemoteServer_nAcquireReceivedMessage(JNIEnv* env, jclass, jlong native, jobject buffer, jint length) {
|
||||||
|
RemoteServer* server = (RemoteServer*) native;
|
||||||
|
ReceivedMessage const* msg = server->acquireReceivedMessage();
|
||||||
|
if (msg == nullptr) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
void* address = env->GetDirectBufferAddress(buffer);
|
||||||
|
if (address == nullptr) {
|
||||||
|
// This should never happen because the Java layer does allocateDirect.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
memcpy(address, msg->buffer, length);
|
||||||
|
server->releaseReceivedMessage(msg);
|
||||||
|
}
|
||||||
|
|
||||||
@@ -20,21 +20,25 @@
|
|||||||
#include <filament/IndirectLight.h>
|
#include <filament/IndirectLight.h>
|
||||||
#include <filament/Skybox.h>
|
#include <filament/Skybox.h>
|
||||||
|
|
||||||
#include <image/KtxUtility.h>
|
#include <ktxreader/Ktx1Reader.h>
|
||||||
|
|
||||||
#include "common/NioUtils.h"
|
#include "common/NioUtils.h"
|
||||||
|
|
||||||
using namespace filament;
|
using namespace filament;
|
||||||
using namespace filament::math;
|
using namespace filament::math;
|
||||||
using namespace image;
|
using namespace image;
|
||||||
|
using namespace ktxreader;
|
||||||
|
|
||||||
static jlong nCreateTexture(JNIEnv* env, jclass,
|
jlong nCreateHDRTexture(JNIEnv* env, jclass,
|
||||||
|
jlong nativeEngine, jobject javaBuffer, jint remaining, jint internalFormat);
|
||||||
|
|
||||||
|
static jlong nCreateKTXTexture(JNIEnv* env, jclass,
|
||||||
jlong nativeEngine, jobject javaBuffer, jint remaining, jboolean srgb) {
|
jlong nativeEngine, jobject javaBuffer, jint remaining, jboolean srgb) {
|
||||||
Engine* engine = (Engine*) nativeEngine;
|
Engine* engine = (Engine*) nativeEngine;
|
||||||
AutoBuffer buffer(env, javaBuffer, remaining);
|
AutoBuffer buffer(env, javaBuffer, remaining);
|
||||||
KtxBundle* bundle = new KtxBundle((const uint8_t*) buffer.getData(), buffer.getSize());
|
Ktx1Bundle* bundle = new Ktx1Bundle((const uint8_t*) buffer.getData(), buffer.getSize());
|
||||||
return (jlong) ktx::createTexture(engine, *bundle, srgb, [](void* userdata) {
|
return (jlong) Ktx1Reader::createTexture(engine, *bundle, srgb, [](void* userdata) {
|
||||||
KtxBundle* bundle = (KtxBundle*) userdata;
|
Ktx1Bundle* bundle = (Ktx1Bundle*) userdata;
|
||||||
delete bundle;
|
delete bundle;
|
||||||
}, bundle);
|
}, bundle);
|
||||||
}
|
}
|
||||||
@@ -43,9 +47,9 @@ static jlong nCreateIndirectLight(JNIEnv* env, jclass,
|
|||||||
jlong nativeEngine, jobject javaBuffer, jint remaining, jboolean srgb) {
|
jlong nativeEngine, jobject javaBuffer, jint remaining, jboolean srgb) {
|
||||||
Engine* engine = (Engine*) nativeEngine;
|
Engine* engine = (Engine*) nativeEngine;
|
||||||
AutoBuffer buffer(env, javaBuffer, remaining);
|
AutoBuffer buffer(env, javaBuffer, remaining);
|
||||||
KtxBundle* bundle = new KtxBundle((const uint8_t*) buffer.getData(), buffer.getSize());
|
Ktx1Bundle* bundle = new Ktx1Bundle((const uint8_t*) buffer.getData(), buffer.getSize());
|
||||||
Texture* cubemap = ktx::createTexture(engine, *bundle, srgb, [](void* userdata) {
|
Texture* cubemap = Ktx1Reader::createTexture(engine, *bundle, srgb, [](void* userdata) {
|
||||||
KtxBundle* bundle = (KtxBundle*) userdata;
|
Ktx1Bundle* bundle = (Ktx1Bundle*) userdata;
|
||||||
delete bundle;
|
delete bundle;
|
||||||
}, bundle);
|
}, bundle);
|
||||||
|
|
||||||
@@ -65,14 +69,27 @@ static jlong nCreateSkybox(JNIEnv* env, jclass,
|
|||||||
jlong nativeEngine, jobject javaBuffer, jint remaining, jboolean srgb) {
|
jlong nativeEngine, jobject javaBuffer, jint remaining, jboolean srgb) {
|
||||||
Engine* engine = (Engine*) nativeEngine;
|
Engine* engine = (Engine*) nativeEngine;
|
||||||
AutoBuffer buffer(env, javaBuffer, remaining);
|
AutoBuffer buffer(env, javaBuffer, remaining);
|
||||||
KtxBundle* bundle = new KtxBundle((const uint8_t*) buffer.getData(), buffer.getSize());
|
Ktx1Bundle* bundle = new Ktx1Bundle((const uint8_t*) buffer.getData(), buffer.getSize());
|
||||||
Texture* cubemap = ktx::createTexture(engine, *bundle, srgb, [](void* userdata) {
|
Texture* cubemap = Ktx1Reader::createTexture(engine, *bundle, srgb, [](void* userdata) {
|
||||||
KtxBundle* bundle = (KtxBundle*) userdata;
|
Ktx1Bundle* bundle = (Ktx1Bundle*) userdata;
|
||||||
delete bundle;
|
delete bundle;
|
||||||
}, bundle);
|
}, bundle);
|
||||||
return (jlong) Skybox::Builder().environment(cubemap).showSun(true).build(*engine);
|
return (jlong) Skybox::Builder().environment(cubemap).showSun(true).build(*engine);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static jboolean nGetSphericalHarmonics(JNIEnv* env, jclass, jobject javaBuffer, jint remaining,
|
||||||
|
jfloatArray outSphericalHarmonics_) {
|
||||||
|
AutoBuffer buffer(env, javaBuffer, remaining);
|
||||||
|
Ktx1Bundle bundle((const uint8_t*) buffer.getData(), buffer.getSize());
|
||||||
|
|
||||||
|
jfloat* outSphericalHarmonics = env->GetFloatArrayElements(outSphericalHarmonics_, nullptr);
|
||||||
|
const auto success = bundle.getSphericalHarmonics(
|
||||||
|
reinterpret_cast<filament::math::float3*>(outSphericalHarmonics)
|
||||||
|
);
|
||||||
|
env->ReleaseFloatArrayElements(outSphericalHarmonics_, outSphericalHarmonics, JNI_ABORT);
|
||||||
|
|
||||||
|
return success ? JNI_TRUE : JNI_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
JNIEXPORT jint JNI_OnLoad(JavaVM* vm, void*) {
|
JNIEXPORT jint JNI_OnLoad(JavaVM* vm, void*) {
|
||||||
JNIEnv* env;
|
JNIEnv* env;
|
||||||
@@ -80,15 +97,27 @@ JNIEXPORT jint JNI_OnLoad(JavaVM* vm, void*) {
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
jclass c = env->FindClass("com/google/android/filament/utils/KtxLoader");
|
int rc;
|
||||||
if (c == nullptr) return JNI_ERR;
|
|
||||||
|
|
||||||
static const JNINativeMethod methods[] = {
|
// KTX1Loader
|
||||||
{"nCreateTexture", "(JLjava/nio/Buffer;IZ)J", reinterpret_cast<void*>(nCreateTexture)},
|
jclass ktxloaderClass = env->FindClass("com/google/android/filament/utils/KTX1Loader");
|
||||||
{"nCreateIndirectLight", "(JLjava/nio/Buffer;IZ)J", reinterpret_cast<void*>(nCreateIndirectLight)},
|
if (ktxloaderClass == nullptr) return JNI_ERR;
|
||||||
{"nCreateSkybox", "(JLjava/nio/Buffer;IZ)J", reinterpret_cast<void*>(nCreateSkybox)},
|
static const JNINativeMethod ktxMethods[] = {
|
||||||
|
{(char*)"nCreateKTXTexture", (char*)"(JLjava/nio/Buffer;IZ)J", reinterpret_cast<void*>(nCreateKTXTexture)},
|
||||||
|
{(char*)"nCreateIndirectLight", (char*)"(JLjava/nio/Buffer;IZ)J", reinterpret_cast<void*>(nCreateIndirectLight)},
|
||||||
|
{(char*)"nCreateSkybox", (char*)"(JLjava/nio/Buffer;IZ)J", reinterpret_cast<void*>(nCreateSkybox)},
|
||||||
|
{(char*)"nGetSphericalHarmonics", (char*)"(Ljava/nio/Buffer;I[F)Z", reinterpret_cast<void*>(nGetSphericalHarmonics)},
|
||||||
};
|
};
|
||||||
int rc = env->RegisterNatives(c, methods, sizeof(methods) / sizeof(JNINativeMethod));
|
rc = env->RegisterNatives(ktxloaderClass, ktxMethods, sizeof(ktxMethods) / sizeof(JNINativeMethod));
|
||||||
|
if (rc != JNI_OK) return rc;
|
||||||
|
|
||||||
|
// HDRLoader
|
||||||
|
jclass hdrloaderClass = env->FindClass("com/google/android/filament/utils/HDRLoader");
|
||||||
|
if (hdrloaderClass == nullptr) return JNI_ERR;
|
||||||
|
static const JNINativeMethod hdrMethods[] = {
|
||||||
|
{(char*)"nCreateHDRTexture", (char*)"(JLjava/nio/Buffer;II)J", reinterpret_cast<void*>(nCreateHDRTexture)},
|
||||||
|
};
|
||||||
|
rc = env->RegisterNatives(hdrloaderClass, hdrMethods, sizeof(hdrMethods) / sizeof(JNINativeMethod));
|
||||||
if (rc != JNI_OK) return rc;
|
if (rc != JNI_OK) return rc;
|
||||||
|
|
||||||
return JNI_VERSION_1_6;
|
return JNI_VERSION_1_6;
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user