Compare commits
575 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
0851960397 | ||
![]() |
a31784759d | ||
![]() |
453a5b49a0 | ||
![]() |
e7f24ade0b | ||
![]() |
e14c6441ce | ||
![]() |
d18f3fca30 | ||
![]() |
7f4ae653f3 | ||
![]() |
703df42586 | ||
![]() |
13376de059 | ||
![]() |
677f5b0795 | ||
![]() |
d32bbabe0e | ||
![]() |
c3d32c156c | ||
![]() |
1aaa55c38e | ||
![]() |
de0fca51a8 | ||
![]() |
5e3db0aa83 | ||
![]() |
fadef24b62 | ||
![]() |
689a534c66 | ||
![]() |
9d93ca6fc8 | ||
![]() |
86d3e68d55 | ||
![]() |
9e17134949 | ||
![]() |
290d68c11e | ||
![]() |
2c8bc8ad47 | ||
![]() |
de070ba25f | ||
![]() |
e930ad3102 | ||
![]() |
2fe488a71c | ||
![]() |
0af2c139e2 | ||
![]() |
191e8cf02b | ||
![]() |
8737d697dc | ||
![]() |
765a31597a | ||
![]() |
70a2118c49 | ||
![]() |
b02e737074 | ||
![]() |
fdb7cd0587 | ||
![]() |
bba035c20c | ||
![]() |
be361ed3dc | ||
![]() |
8c0f9c7f5a | ||
![]() |
8abba960c7 | ||
![]() |
8649032428 | ||
![]() |
6e8387468f | ||
![]() |
27987f3fe6 | ||
![]() |
ef32377336 | ||
![]() |
a2b69c0905 | ||
![]() |
1fac09d0f4 | ||
![]() |
f090f5444c | ||
![]() |
2bb4d36c43 | ||
![]() |
b7240d6a36 | ||
![]() |
65076464d5 | ||
![]() |
72758de6ea | ||
![]() |
25642cff36 | ||
![]() |
cd61463d23 | ||
![]() |
0171bdfb9c | ||
![]() |
daeccd03ac | ||
![]() |
086f76ba7a | ||
![]() |
e5cdfab97d | ||
![]() |
affb707dd9 | ||
![]() |
4c497779a2 | ||
![]() |
08441e8b2d | ||
![]() |
d02310e8ce | ||
![]() |
62965aa6d7 | ||
![]() |
04a4efb591 | ||
![]() |
c4f0e80895 | ||
![]() |
ebee8ba3bb | ||
![]() |
8f5bd3e185 | ||
![]() |
fcc6a61d9e | ||
![]() |
ae13f438ba | ||
![]() |
18db2c4f01 | ||
![]() |
1fd8052527 | ||
![]() |
6ce38e599a | ||
![]() |
83b6cd00c6 | ||
![]() |
1883343944 | ||
![]() |
ebad28d831 | ||
![]() |
befdb5963e | ||
![]() |
83cd22ee5a | ||
![]() |
dd6e006d78 | ||
![]() |
cbeb29d9d1 | ||
![]() |
317db34059 | ||
![]() |
1d61be5804 | ||
![]() |
13bb656a91 | ||
![]() |
16f5a04983 | ||
![]() |
9afda9359b | ||
![]() |
2d82788e42 | ||
![]() |
5761bf7e19 | ||
![]() |
fba117478d | ||
![]() |
8e599908d9 | ||
![]() |
ae7127232d | ||
![]() |
2e151408bb | ||
![]() |
fec0ce34c5 | ||
![]() |
719c1551cc | ||
![]() |
9f2ff3e4d6 | ||
![]() |
963021d393 | ||
![]() |
7763ccd8ad | ||
![]() |
d8e0b2e27c | ||
![]() |
6ac3043e88 | ||
![]() |
2ec8ce649a | ||
![]() |
bc47d36e90 | ||
![]() |
1c9093fd24 | ||
![]() |
0543f897a9 | ||
![]() |
b28e353626 | ||
![]() |
a3f9ba8704 | ||
![]() |
ccf4329792 | ||
![]() |
a6fb2dafc6 | ||
![]() |
7a16834124 | ||
![]() |
628e6e52f3 | ||
![]() |
f437f7b405 | ||
![]() |
cf12992b6a | ||
![]() |
67a1e84859 | ||
![]() |
6243466770 | ||
![]() |
0f8caeb186 | ||
![]() |
c20df9aa47 | ||
![]() |
c41e0f0c45 | ||
![]() |
16d015d81e | ||
![]() |
d47d7c0001 | ||
![]() |
c87e91d27a | ||
![]() |
99f6707e2c | ||
![]() |
e36dc01b91 | ||
![]() |
8523d13683 | ||
![]() |
dba29e4405 | ||
![]() |
0aefe256d0 | ||
![]() |
1b793e76dc | ||
![]() |
226c0e362c | ||
![]() |
84edd22612 | ||
![]() |
2a6bd973bd | ||
![]() |
d7266ea8f3 | ||
![]() |
ef858b0dbb | ||
![]() |
588131c9d5 | ||
![]() |
52c1a4e7d0 | ||
![]() |
f9c8e31ed7 | ||
![]() |
9ac5a96408 | ||
![]() |
8a5bc933de | ||
![]() |
3e604a8645 | ||
![]() |
83b3478fe4 | ||
![]() |
51b147cd32 | ||
![]() |
4390d3a122 | ||
![]() |
a77afd5c8f | ||
![]() |
32c9d411b2 | ||
![]() |
1350361f58 | ||
![]() |
e545286369 | ||
![]() |
942731cc22 | ||
![]() |
4e88160e78 | ||
![]() |
a1db0220a1 | ||
![]() |
f9d4601057 | ||
![]() |
f1659d78d3 | ||
![]() |
007e840be1 | ||
![]() |
d92531b81d | ||
![]() |
670eab8b17 | ||
![]() |
252bd22738 | ||
![]() |
0b0711027a | ||
![]() |
e168c6dd81 | ||
![]() |
526e68afa8 | ||
![]() |
1b91ac0b0d | ||
![]() |
599d6e810f | ||
![]() |
75b5cc0084 | ||
![]() |
9a568654be | ||
![]() |
4a1bd12e2d | ||
![]() |
282ec9bb76 | ||
![]() |
a91f61262e | ||
![]() |
f8719e7ec3 | ||
![]() |
7c36f3f6b8 | ||
![]() |
3d6d5558c9 | ||
![]() |
a39a44c12f | ||
![]() |
60bedb4f87 | ||
![]() |
62554db48d | ||
![]() |
94650f0def | ||
![]() |
33ed452439 | ||
![]() |
bb2763cc1f | ||
![]() |
3e71232a04 | ||
![]() |
700d448d75 | ||
![]() |
8722ff7043 | ||
![]() |
8d7f97ee04 | ||
![]() |
9a4fb25285 | ||
![]() |
7439c7547b | ||
![]() |
c8b16d72e2 | ||
![]() |
b972b8d324 | ||
![]() |
67de7c4483 | ||
![]() |
9f4a839853 | ||
![]() |
6541895901 | ||
![]() |
5d8c477d12 | ||
![]() |
79f36799e7 | ||
![]() |
369cb0a3c5 | ||
![]() |
9b3d74db6b | ||
![]() |
92417c4485 | ||
![]() |
22345ff62a | ||
![]() |
3fc4a4c974 | ||
![]() |
03a88678da | ||
![]() |
f60e0e6c94 | ||
![]() |
9fce26bb06 | ||
![]() |
f869229b7f | ||
![]() |
239c37246a | ||
![]() |
9882796df0 | ||
![]() |
e34c0911f9 | ||
![]() |
93efa565f9 | ||
![]() |
dfbb134bfe | ||
![]() |
92f6290dbb | ||
![]() |
2474d50dba | ||
![]() |
e40ece55d5 | ||
![]() |
18c92b3104 | ||
![]() |
dd7d65a6b4 | ||
![]() |
206e1def6f | ||
![]() |
b7063ab879 | ||
![]() |
10d7718011 | ||
![]() |
ddc1fdf6d5 | ||
![]() |
7fa521fae4 | ||
![]() |
08ea5e419e | ||
![]() |
00a763ea44 | ||
![]() |
dcd289d931 | ||
![]() |
025246620f | ||
![]() |
19ef765382 | ||
![]() |
9607ea5c0a | ||
![]() |
8a434b4fd4 | ||
![]() |
0e037555fe | ||
![]() |
de173a93c8 | ||
![]() |
37c047eabc | ||
![]() |
c1432386a5 | ||
![]() |
b5f281bacd | ||
![]() |
23b827b66c | ||
![]() |
d851208413 | ||
![]() |
3caa15e696 | ||
![]() |
99ab4d6cb8 | ||
![]() |
8b3d054408 | ||
![]() |
7d995d95eb | ||
![]() |
a09311a8fc | ||
![]() |
339fdf4c31 | ||
![]() |
c96de3a23a | ||
![]() |
1627f34032 | ||
![]() |
59cabc7d11 | ||
![]() |
89f031673b | ||
![]() |
3c55f067a8 | ||
![]() |
23fabb1d67 | ||
![]() |
e9d3d4fa1f | ||
![]() |
024adc2538 | ||
![]() |
72983d4e20 | ||
![]() |
b63c2619e3 | ||
![]() |
40ec7a6236 | ||
![]() |
352ea80a1f | ||
![]() |
a422d2fc8b | ||
![]() |
803094f41f | ||
![]() |
2c13e43c32 | ||
![]() |
18d73eef19 | ||
![]() |
7bf31dd468 | ||
![]() |
1a6adc5f74 | ||
![]() |
b15715ca80 | ||
![]() |
8d3ff3fda8 | ||
![]() |
24a38dbd3f | ||
![]() |
4120f12375 | ||
![]() |
dfc465ca6d | ||
![]() |
93168304cd | ||
![]() |
9ff8ad853c | ||
![]() |
59e7275464 | ||
![]() |
fa79ae8a3d | ||
![]() |
9362eaf9c6 | ||
![]() |
dfadb3ee37 | ||
![]() |
6e76baa6a9 | ||
![]() |
a0f8682905 | ||
![]() |
e8fa7ceb79 | ||
![]() |
68bcfa1192 | ||
![]() |
d98e61c6eb | ||
![]() |
66c6ec4465 | ||
![]() |
936199d8de | ||
![]() |
18af18479f | ||
![]() |
b7ae0df3d9 | ||
![]() |
cac856119c | ||
![]() |
1286bc076f | ||
![]() |
3d33c559e7 | ||
![]() |
14e443afba | ||
![]() |
7749a2805c | ||
![]() |
a04dbe7ffd | ||
![]() |
913f185f82 | ||
![]() |
6575d31379 | ||
![]() |
7c1889c282 | ||
![]() |
45fd75952d | ||
![]() |
51fbde178f | ||
![]() |
b154bc33f5 | ||
![]() |
d98779abef | ||
![]() |
aefdb9f9cf | ||
![]() |
ff523d55ac | ||
![]() |
6d20430ccc | ||
![]() |
a5beb940f8 | ||
![]() |
f3385b6ad2 | ||
![]() |
ef8526ae36 | ||
![]() |
92a13878dc | ||
![]() |
1b4c58b66f | ||
![]() |
e203fb58c6 | ||
![]() |
462e7aec52 | ||
![]() |
aae60e1e44 | ||
![]() |
848cdb267a | ||
![]() |
760cfd361e | ||
![]() |
092435d51c | ||
![]() |
1dff5814be | ||
![]() |
26db391576 | ||
![]() |
ce3214b82d | ||
![]() |
621a8766a8 | ||
![]() |
b6541b7a55 | ||
![]() |
7e27c2ffa8 | ||
![]() |
b55418effd | ||
![]() |
5a259fa10f | ||
![]() |
0ba49cce45 | ||
![]() |
b54422c970 | ||
![]() |
ef9fdd0fa5 | ||
![]() |
e3f0a11053 | ||
![]() |
311fe8f35b | ||
![]() |
a135d9c25d | ||
![]() |
ee72497eef | ||
![]() |
5e63cd3c97 | ||
![]() |
e6fe8169c2 | ||
![]() |
7ca9131fd4 | ||
![]() |
07e0b10515 | ||
![]() |
aa67903f96 | ||
![]() |
5b6d83b533 | ||
![]() |
3e75a2109d | ||
![]() |
7013e60926 | ||
![]() |
559f1919c6 | ||
![]() |
73c8ddc8bf | ||
![]() |
b805754aa1 | ||
![]() |
0f8cfd6031 | ||
![]() |
dffd1435e9 | ||
![]() |
a8e9e1387f | ||
![]() |
1613057881 | ||
![]() |
b4fddf146b | ||
![]() |
aeb1a0da84 | ||
![]() |
71373ee524 | ||
![]() |
1cc25d1a2d | ||
![]() |
bd70a22412 | ||
![]() |
8b7f43f89b | ||
![]() |
58e9a0894f | ||
![]() |
6ef3ab3d3a | ||
![]() |
a9f6ff6fe3 | ||
![]() |
cd1464390c | ||
![]() |
d8ca13f4c6 | ||
![]() |
8fecf45f4c | ||
![]() |
96aadec503 | ||
![]() |
c219fc02cd | ||
![]() |
75d675ab4d | ||
![]() |
69a82c7a0d | ||
![]() |
0c3902b543 | ||
![]() |
7c7ee1cdc8 | ||
![]() |
0c17d1e14f | ||
![]() |
0352aa2094 | ||
![]() |
a9230a6c07 | ||
![]() |
c706b33b30 | ||
![]() |
e9c7ab925f | ||
![]() |
70ed52dd5d | ||
![]() |
4e363b5479 | ||
![]() |
9839ea6667 | ||
![]() |
87b542085b | ||
![]() |
647b54a2dc | ||
![]() |
548961aea1 | ||
![]() |
00911b0842 | ||
![]() |
ff2b8d6db1 | ||
![]() |
0fa295c72d | ||
![]() |
4a01139c8d | ||
![]() |
64e786fe28 | ||
![]() |
5c76c33d7d | ||
![]() |
53bb87c8fb | ||
![]() |
9aaf7a8057 | ||
![]() |
56cab4b6a9 | ||
![]() |
c4804c4c0c | ||
![]() |
8809ae66c6 | ||
![]() |
85dc2cc03a | ||
![]() |
db4cfc9fbd | ||
![]() |
7d2845a661 | ||
![]() |
30a3dae8a6 | ||
![]() |
59acb6dbea | ||
![]() |
8277597bcf | ||
![]() |
8a46b5e6c0 | ||
![]() |
ae230dae46 | ||
![]() |
7062415aec | ||
![]() |
5ed814e950 | ||
![]() |
2156cd4a84 | ||
![]() |
3a74534c39 | ||
![]() |
4d438ed68d | ||
![]() |
bfff2c432c | ||
![]() |
bcf3ad87e8 | ||
![]() |
a958cebdd9 | ||
![]() |
e6aa713a37 | ||
![]() |
e18aad0653 | ||
![]() |
9aedfbec69 | ||
![]() |
c0ca8a74bc | ||
![]() |
63b1860010 | ||
![]() |
0c78b8d182 | ||
![]() |
4e79e23a20 | ||
![]() |
dbb2bbf207 | ||
![]() |
64916ba232 | ||
![]() |
8a7812f1f5 | ||
![]() |
d432d03aea | ||
![]() |
c15d08d6ec | ||
![]() |
f8753bda01 | ||
![]() |
652b17d68d | ||
![]() |
efba81442a | ||
![]() |
1aec0a90bc | ||
![]() |
f81dfce19f | ||
![]() |
2a70638e26 | ||
![]() |
1fe137db44 | ||
![]() |
fe8dad48e2 | ||
![]() |
2cda1502a3 | ||
![]() |
a6728a2203 | ||
![]() |
9e7ca41f58 | ||
![]() |
0776f1e106 | ||
![]() |
de4611ecf6 | ||
![]() |
ee24d17895 | ||
![]() |
da8d76d826 | ||
![]() |
6f30a19dd7 | ||
![]() |
2911cf2a48 | ||
![]() |
e5cf3f9555 | ||
![]() |
5f03201616 | ||
![]() |
8eb7cf1fee | ||
![]() |
0624af09fd | ||
![]() |
2f75657350 | ||
![]() |
00c8795385 | ||
![]() |
89708edf7f | ||
![]() |
71700254b4 | ||
![]() |
aa86e9d399 | ||
![]() |
4b6e6ce20e | ||
![]() |
7cbfca8bd1 | ||
![]() |
e0720a0a55 | ||
![]() |
d4c03b47ec | ||
![]() |
a226e11aac | ||
![]() |
d3d362090c | ||
![]() |
f3eff740ce | ||
![]() |
f4c171aa45 | ||
![]() |
953882e86f | ||
![]() |
46ad7b87e8 | ||
![]() |
4e9afac2a5 | ||
![]() |
2cce5a24c9 | ||
![]() |
43efe92e21 | ||
![]() |
f7a6b94f46 | ||
![]() |
7203acdef9 | ||
![]() |
3db26f82ea | ||
![]() |
716e26aa37 | ||
![]() |
f989048bda | ||
![]() |
49d2897b24 | ||
![]() |
6f60622619 | ||
![]() |
429c5a9a9a | ||
![]() |
7f2a071c51 | ||
![]() |
2efb50cc63 | ||
![]() |
9095dd9e82 | ||
![]() |
30a0f6f292 | ||
![]() |
52f1c7df6d | ||
![]() |
906c7f591e | ||
![]() |
115cc7dede | ||
![]() |
96d5dd24aa | ||
![]() |
28093c46a8 | ||
![]() |
c37f776e87 | ||
![]() |
1dd9fbae94 | ||
![]() |
8be5ec2288 | ||
![]() |
1a420b77e3 | ||
![]() |
0e65e5877f | ||
![]() |
e07054d0d4 | ||
![]() |
b733e76c86 | ||
![]() |
19b71f5f13 | ||
![]() |
ab032919df | ||
![]() |
68e408474d | ||
![]() |
942657fc7c | ||
![]() |
4decbb2586 | ||
![]() |
f3d38018cd | ||
![]() |
3ae40c35e6 | ||
![]() |
4b93feb172 | ||
![]() |
d875891a3c | ||
![]() |
3e68059556 | ||
![]() |
213c990eda | ||
![]() |
929fa5780d | ||
![]() |
7d03048f1d | ||
![]() |
ae9cea03f0 | ||
![]() |
de7b8ad551 | ||
![]() |
4dd5643402 | ||
![]() |
0b8e0f05a7 | ||
![]() |
b188008a1c | ||
![]() |
7bc2e922c9 | ||
![]() |
b0dcdf688f | ||
![]() |
d3387c952a | ||
![]() |
3643974949 | ||
![]() |
8980bcfe4b | ||
![]() |
e1babab3cc | ||
![]() |
97b074ac26 | ||
![]() |
76a907bb79 | ||
![]() |
9681a072d0 | ||
![]() |
32f3f53718 | ||
![]() |
246798a0ba | ||
![]() |
88a8395b8e | ||
![]() |
e95d8bc655 | ||
![]() |
6445200a93 | ||
![]() |
e00d2439b9 | ||
![]() |
7e68e733f5 | ||
![]() |
0565fb9fb6 | ||
![]() |
121c689b78 | ||
![]() |
edeaff4bd4 | ||
![]() |
2370af598e | ||
![]() |
deaa84d28d | ||
![]() |
2efb5a36ca | ||
![]() |
d1ac38171c | ||
![]() |
1a7dace57e | ||
![]() |
0870295a7c | ||
![]() |
5e3cf28642 | ||
![]() |
23398f0198 | ||
![]() |
e991fefb89 | ||
![]() |
d39d26f275 | ||
![]() |
9cc2cee936 | ||
![]() |
b359a1575e | ||
![]() |
8f4261e9d4 | ||
![]() |
565319184c | ||
![]() |
2760304d66 | ||
![]() |
9bd3d78374 | ||
![]() |
1c5de9721a | ||
![]() |
7bcb2ad4f1 | ||
![]() |
89e734de6b | ||
![]() |
cc4de1d1f9 | ||
![]() |
71995d52b3 | ||
![]() |
a178a2170b | ||
![]() |
3c1c13b660 | ||
![]() |
0369ec9adf | ||
![]() |
c828e481fb | ||
![]() |
e3ba11bead | ||
![]() |
beeac18eb1 | ||
![]() |
470574517a | ||
![]() |
c5ef96272f | ||
![]() |
1c7c8c682c | ||
![]() |
ded6754de4 | ||
![]() |
05aff1e097 | ||
![]() |
7959d95db0 | ||
![]() |
6fe0a229e2 | ||
![]() |
9f45fea31e | ||
![]() |
e5e401c640 | ||
![]() |
6c874feb7b | ||
![]() |
03710c9d8e | ||
![]() |
cb698dd37d | ||
![]() |
b36422083e | ||
![]() |
5765b7895c | ||
![]() |
4aa680d6d3 | ||
![]() |
60ca8acd0a | ||
![]() |
352db3a183 | ||
![]() |
4a099c3658 | ||
![]() |
23a08a483e | ||
![]() |
f33cec64aa | ||
![]() |
e401d5c48e | ||
![]() |
9360e4e2c1 | ||
![]() |
7b6b87ec5b | ||
![]() |
b90ac7bd31 | ||
![]() |
a84e98ba6c | ||
![]() |
232378ed2d | ||
![]() |
3baba7ffe8 | ||
![]() |
45b0dc63cd | ||
![]() |
fff06d24da | ||
![]() |
6c56fe2670 | ||
![]() |
dbe1c9c6e6 | ||
![]() |
d8e1a77da5 | ||
![]() |
6bd63de8d0 | ||
![]() |
ac204a11f7 | ||
![]() |
4ab28fffb4 | ||
![]() |
e39e45824d | ||
![]() |
5d831f3f18 | ||
![]() |
1d0767022d | ||
![]() |
2545f62565 | ||
![]() |
2565c01158 | ||
![]() |
133e6f097d | ||
![]() |
b62c86572e | ||
![]() |
c82d9cb89a | ||
![]() |
1269ce8a6f | ||
![]() |
a41ed986bd | ||
![]() |
c4eaf0076d | ||
![]() |
e5708a8f36 | ||
![]() |
2015828fc6 | ||
![]() |
4c1af4cc90 | ||
![]() |
ecc00357b4 | ||
![]() |
a3e7664dcf | ||
![]() |
ffadeeeb84 | ||
![]() |
f516f4099b | ||
![]() |
d6708de7b0 | ||
![]() |
a113d3326b | ||
![]() |
fe607323aa | ||
![]() |
131672f199 | ||
![]() |
9b6a005819 | ||
![]() |
399894ac90 | ||
![]() |
89d5b3df44 | ||
![]() |
6ebe76cba7 | ||
![]() |
1aa8a4ff90 | ||
![]() |
fcf3a04825 | ||
![]() |
5751776a73 |
13
.github/workflows/android.yml
vendored
@@ -1,8 +1,18 @@
|
||||
name: Android
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
workflow_dispatch:
|
||||
paths:
|
||||
- 'src/**'
|
||||
- 'examples/**'
|
||||
- '.github/workflows/android.yml'
|
||||
pull_request:
|
||||
paths:
|
||||
- 'src/**'
|
||||
- 'examples/**'
|
||||
- '.github/workflows/android.yml'
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
@@ -50,6 +60,9 @@ jobs:
|
||||
- name: Generate Artifacts
|
||||
run: |
|
||||
cp -v ./src/raylib.h ./build/${{ env.RELEASE_NAME }}/include
|
||||
cp -v ./src/raymath.h ./build/${{ env.RELEASE_NAME }}/include
|
||||
cp -v ./src/rlgl.h ./build/${{ env.RELEASE_NAME }}/include
|
||||
cp -v ./src/extras/raygui.h ./build/${{ env.RELEASE_NAME }}/include
|
||||
cp -v ./README.md ./build/${{ env.RELEASE_NAME }}/README.md
|
||||
cp -v ./LICENSE ./build/${{ env.RELEASE_NAME }}/LICENSE
|
||||
cd build
|
||||
|
15
.github/workflows/cmake.yml
vendored
@@ -1,8 +1,23 @@
|
||||
name: CMakeBuilds
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
paths:
|
||||
- 'src/**'
|
||||
- 'examples/**'
|
||||
- '.github/workflows/cmake.yml'
|
||||
- 'CMakeList.txt'
|
||||
- 'CMakeOptions.txt'
|
||||
- 'cmake/**'
|
||||
pull_request:
|
||||
paths:
|
||||
- 'src/**'
|
||||
- 'examples/**'
|
||||
- '.github/workflows/cmake.yml'
|
||||
- 'CMakeList.txt'
|
||||
- 'CMakeOptions.txt'
|
||||
- 'cmake/**'
|
||||
|
||||
env:
|
||||
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
|
||||
|
16
.github/workflows/linux.yml
vendored
@@ -1,8 +1,17 @@
|
||||
name: Linux
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
paths:
|
||||
- 'src/**'
|
||||
- 'examples/**'
|
||||
- '.github/workflows/linux.yml'
|
||||
pull_request:
|
||||
paths:
|
||||
- 'src/**'
|
||||
- 'examples/**'
|
||||
- '.github/workflows/linux.yml'
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
@@ -55,7 +64,7 @@ jobs:
|
||||
- name: Build Library
|
||||
run: |
|
||||
cd src
|
||||
make PLATFORM=PLATFORM_DESKTOP CC=gcc RAYLIB_LIBTYPE=STATIC RAYLIB_RELEASE_PATH="../build/${{ env.RELEASE_NAME }}/lib" CFLAGS="-m32"
|
||||
make PLATFORM=PLATFORM_DESKTOP CC=gcc RAYLIB_LIBTYPE=STATIC RAYLIB_RELEASE_PATH="../build/${{ env.RELEASE_NAME }}/lib" CFLAGS="-m32" -B
|
||||
# make PLATFORM=PLATFORM_DESKTOP CC=gcc RAYLIB_LIBTYPE=SHARED RAYLIB_RELEASE_PATH="../build/${{ env.RELEASE_NAME }}/lib" -B
|
||||
cd ..
|
||||
if: matrix.bits == 32
|
||||
@@ -63,7 +72,7 @@ jobs:
|
||||
- name: Build Library
|
||||
run: |
|
||||
cd src
|
||||
make PLATFORM=PLATFORM_DESKTOP CC=gcc RAYLIB_LIBTYPE=STATIC RAYLIB_RELEASE_PATH="../build/${{ env.RELEASE_NAME }}/lib"
|
||||
make PLATFORM=PLATFORM_DESKTOP CC=gcc RAYLIB_LIBTYPE=STATIC RAYLIB_RELEASE_PATH="../build/${{ env.RELEASE_NAME }}/lib" -B
|
||||
make PLATFORM=PLATFORM_DESKTOP CC=gcc RAYLIB_LIBTYPE=SHARED RAYLIB_RELEASE_PATH="../build/${{ env.RELEASE_NAME }}/lib" -B
|
||||
cd ..
|
||||
if: matrix.bits == 64
|
||||
@@ -71,6 +80,9 @@ jobs:
|
||||
- name: Generate Artifacts
|
||||
run: |
|
||||
cp -v ./src/raylib.h ./build/${{ env.RELEASE_NAME }}/include
|
||||
cp -v ./src/raymath.h ./build/${{ env.RELEASE_NAME }}/include
|
||||
cp -v ./src/rlgl.h ./build/${{ env.RELEASE_NAME }}/include
|
||||
cp -v ./src/extras/raygui.h ./build/${{ env.RELEASE_NAME }}/include
|
||||
cp -v ./README.md ./build/${{ env.RELEASE_NAME }}/README.md
|
||||
cp -v ./LICENSE ./build/${{ env.RELEASE_NAME }}/LICENSE
|
||||
cd build
|
||||
|
7
.github/workflows/linux_examples.yml
vendored
@@ -1,11 +1,18 @@
|
||||
name: Linux Examples
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
paths:
|
||||
- 'src/**'
|
||||
- 'examples/**'
|
||||
- '.github/workflows/linux_examples.yml'
|
||||
pull_request:
|
||||
branches: [ master ]
|
||||
paths:
|
||||
- 'src/**'
|
||||
- 'examples/**'
|
||||
- '.github/workflows/linux_examples.yml'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
16
.github/workflows/macos.yml
vendored
@@ -1,8 +1,17 @@
|
||||
name: macOS
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
paths:
|
||||
- 'src/**'
|
||||
- 'examples/**'
|
||||
- '.github/workflows/macos.yml'
|
||||
pull_request:
|
||||
paths:
|
||||
- 'src/**'
|
||||
- 'examples/**'
|
||||
- '.github/workflows/macos.yml'
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
@@ -40,12 +49,12 @@ jobs:
|
||||
run: |
|
||||
cd src
|
||||
clang --version
|
||||
make PLATFORM=PLATFORM_DESKTOP RAYLIB_LIBTYPE=STATIC RAYLIB_RELEASE_PATH="../build/${{ env.RELEASE_NAME }}/lib" CFLAGS="-target x86_64-apple-macos10.12 -DGL_SILENCE_DEPRECATION"
|
||||
make PLATFORM=PLATFORM_DESKTOP RAYLIB_LIBTYPE=STATIC RAYLIB_RELEASE_PATH="../build/${{ env.RELEASE_NAME }}/lib" CFLAGS="-target x86_64-apple-macos10.12 -DGL_SILENCE_DEPRECATION" -B
|
||||
# make PLATFORM=PLATFORM_DESKTOP RAYLIB_LIBTYPE=STATIC RAYLIB_LIB_NAME=raylib_x86_64 CFLAGS="-target x86_64-apple-macos10.12 -DGL_SILENCE_DEPRECATION"
|
||||
# make PLATFORM=PLATFORM_DESKTOP RAYLIB_LIBTYPE=STATIC RAYLIB_LIB_NAME=raylib_arm64 CFLAGS="-target arm64-apple-macos11 -DGL_SILENCE_DEPRECATION" -B
|
||||
# lipo -create -output ../build/${{ env.RELEASE_NAME }}/lib/libraylib.a libraylib_x86_64.a libraylib_arm64.a
|
||||
make clean
|
||||
make PLATFORM=PLATFORM_DESKTOP RAYLIB_LIBTYPE=SHARED RAYLIB_RELEASE_PATH="../build/${{ env.RELEASE_NAME }}/lib" CFLAGS="-target x86_64-apple-macos10.12 -DGL_SILENCE_DEPRECATION"
|
||||
make PLATFORM=PLATFORM_DESKTOP RAYLIB_LIBTYPE=SHARED RAYLIB_RELEASE_PATH="../build/${{ env.RELEASE_NAME }}/lib" CFLAGS="-target x86_64-apple-macos10.12 -DGL_SILENCE_DEPRECATION" -B
|
||||
# make PLATFORM=PLATFORM_DESKTOP RAYLIB_LIBTYPE=SHARED RAYLIB_LIB_NAME=raylib_x86_64 CFLAGS="-target x86_64-apple-macos10.12 -DGL_SILENCE_DEPRECATION" -B
|
||||
# make PLATFORM=PLATFORM_DESKTOP RAYLIB_LIBTYPE=SHARED RAYLIB_LIB_NAME=raylib_arm64 CFLAGS="-target i686-apple-macos -DGL_SILENCE_DEPRECATION" -B
|
||||
# lipo -create -output ../build/${{ env.RELEASE_NAME }}/lib/libraylib.3.1.0.dylib libraylib_x86_64.3.1.0.dylib libraylib_arm64.3.1.0.dylib
|
||||
@@ -56,6 +65,9 @@ jobs:
|
||||
- name: Generate Artifacts
|
||||
run: |
|
||||
cp -v ./src/raylib.h ./build/${{ env.RELEASE_NAME }}/include
|
||||
cp -v ./src/raymath.h ./build/${{ env.RELEASE_NAME }}/include
|
||||
cp -v ./src/rlgl.h ./build/${{ env.RELEASE_NAME }}/include
|
||||
cp -v ./src/extras/raygui.h ./build/${{ env.RELEASE_NAME }}/include
|
||||
cp -v ./README.md ./build/${{ env.RELEASE_NAME }}/README.md
|
||||
cp -v ./LICENSE ./build/${{ env.RELEASE_NAME }}/LICENSE
|
||||
cd build
|
||||
|
16
.github/workflows/webassembly.yml
vendored
@@ -1,8 +1,17 @@
|
||||
name: WebAssembly
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
paths:
|
||||
- 'src/**'
|
||||
- 'examples/**'
|
||||
- '.github/workflows/webassembly.yml'
|
||||
pull_request:
|
||||
paths:
|
||||
- 'src/**'
|
||||
- 'examples/**'
|
||||
- '.github/workflows/webassembly.yml'
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
@@ -18,7 +27,7 @@ jobs:
|
||||
uses: actions/checkout@master
|
||||
|
||||
- name: Setup emsdk
|
||||
uses: mymindstorm/setup-emsdk@v7
|
||||
uses: mymindstorm/setup-emsdk@v9
|
||||
with:
|
||||
version: 2.0.0
|
||||
actions-cache-folder: 'emsdk-cache'
|
||||
@@ -43,12 +52,15 @@ jobs:
|
||||
run: |
|
||||
cd src
|
||||
emcc -v
|
||||
make PLATFORM=PLATFORM_WEB EMSDK_PATH="D:/a/raylib/raylib/emsdk-cache/emsdk-master" RAYLIB_RELEASE_PATH="../build/${{ env.RELEASE_NAME }}/lib"
|
||||
make PLATFORM=PLATFORM_WEB EMSDK_PATH="D:/a/raylib/raylib/emsdk-cache/emsdk-master" RAYLIB_RELEASE_PATH="../build/${{ env.RELEASE_NAME }}/lib" -B
|
||||
cd ..
|
||||
|
||||
- name: Generate Artifacts
|
||||
run: |
|
||||
copy /Y .\src\raylib.h .\build\${{ env.RELEASE_NAME }}\include\raylib.h
|
||||
copy /Y .\src\raymath.h .\build\${{ env.RELEASE_NAME }}\include\raymath.h
|
||||
copy /Y .\src\rlgl.h .\build\${{ env.RELEASE_NAME }}\include\rlgl.h
|
||||
copy /Y .\src\extras\raygui.h .\build\${{ env.RELEASE_NAME }}\include\raygui.h
|
||||
copy /Y .\README.md .\build\${{ env.RELEASE_NAME }}\README.md
|
||||
copy /Y .\LICENSE .\build\${{ env.RELEASE_NAME }}\LICENSE
|
||||
cd build
|
||||
|
12
.github/workflows/windows.yml
vendored
@@ -1,8 +1,17 @@
|
||||
name: Windows
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
paths:
|
||||
- 'src/**'
|
||||
- 'examples/**'
|
||||
- '.github/workflows/windows.yml'
|
||||
pull_request:
|
||||
paths:
|
||||
- 'src/**'
|
||||
- 'examples/**'
|
||||
- '.github/workflows/windows.yml'
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
@@ -93,6 +102,9 @@ jobs:
|
||||
- name: Generate Artifacts
|
||||
run: |
|
||||
copy /Y .\src\raylib.h .\build\${{ env.RELEASE_NAME }}\include\raylib.h
|
||||
copy /Y .\src\raymath.h .\build\${{ env.RELEASE_NAME }}\include\raymath.h
|
||||
copy /Y .\src\rlgl.h .\build\${{ env.RELEASE_NAME }}\include\rlgl.h
|
||||
copy /Y .\src\extras\raygui.h .\build\${{ env.RELEASE_NAME }}\include\raygui.h
|
||||
copy /Y .\README.md .\build\${{ env.RELEASE_NAME }}\README.md
|
||||
copy /Y .\LICENSE .\build\${{ env.RELEASE_NAME }}\LICENSE
|
||||
cd build
|
||||
|
7
.github/workflows/windows_examples.yml
vendored
@@ -1,11 +1,18 @@
|
||||
name: Windows Examples
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
paths:
|
||||
- 'src/**'
|
||||
- 'examples/**'
|
||||
- '.github/workflows/windows_examples.yml'
|
||||
pull_request:
|
||||
branches: [ master ]
|
||||
paths:
|
||||
- 'src/**'
|
||||
- 'examples/**'
|
||||
- '.github/workflows/windows_examples.yml'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
29
.gitignore
vendored
@@ -45,6 +45,7 @@ ipch/
|
||||
*.db
|
||||
*.opendb
|
||||
packages/
|
||||
!examples/models/resources/models/obj/
|
||||
|
||||
# Ignore compiled binaries
|
||||
*.o
|
||||
@@ -52,19 +53,13 @@ packages/
|
||||
*.a
|
||||
*.bc
|
||||
*.so
|
||||
*.so.*
|
||||
|
||||
# Ignore all examples files
|
||||
examples/*
|
||||
# Unignore all examples dirs
|
||||
!examples/*/
|
||||
# Unignore all examples files with extension
|
||||
!examples/*.c
|
||||
!examples/*.png
|
||||
# Unignore examples Makefile
|
||||
!examples/Makefile
|
||||
!examples/Makefile.Android
|
||||
!examples/raylib_compile_execute.bat
|
||||
!examples/raylib_makefile_example.bat
|
||||
# Ignore wasm data in examples/
|
||||
examples/**/*.wasm
|
||||
examples/**/*.data
|
||||
examples/**/*.js
|
||||
examples/**/*.html
|
||||
|
||||
# Ignore files build by xcode
|
||||
*.mode*v*
|
||||
@@ -95,10 +90,14 @@ compile_commands.json
|
||||
CTestTestfile.cmake
|
||||
build
|
||||
|
||||
# Unignore These makefiles...
|
||||
!examples/CMakeLists.txt
|
||||
|
||||
# Ignore GNU global tags
|
||||
GPATH
|
||||
GRTAGS
|
||||
GTAGS
|
||||
|
||||
# Zig programming language
|
||||
zig-cache/
|
||||
zig-out/
|
||||
build/
|
||||
build-*/
|
||||
docgen_tmp/
|
||||
|
137
BINDINGS.md
@@ -1,68 +1,92 @@
|
||||
## raylib bindings
|
||||
# raylib bindings and wrappers
|
||||
|
||||
Some people ported raylib to other languages in form of bindings or wrappers to the library.
|
||||
Some people ported raylib to other languages in form of bindings or wrappers to the library. Here it is alist with all the ports available. Feel free to send a PR if you know of any binding/wrapper not in this list.
|
||||
|
||||
Here it is a list with the ones I'm aware of:
|
||||
### Language Bindings
|
||||
|
||||
| name | raylib version | language | repo |
|
||||
|:------------------:|:-------------: | :--------:|----------------------------------------------------------------------|
|
||||
| raylib | **3.5** | [C](https://en.wikipedia.org/wiki/C_(programming_language)) | https://github.com/raysan5/raylib |
|
||||
| raylib-cpp | 3.5 | [C++](https://en.wikipedia.org/wiki/C%2B%2B) | https://github.com/robloach/raylib-cpp |
|
||||
| Raylib-cs | 3.5 | [C#](https://en.wikipedia.org/wiki/C_Sharp_(programming_language)) | https://github.com/ChrisDill/Raylib-cs |
|
||||
| raylib-cppsharp | 2.5 | [C#](https://en.wikipedia.org/wiki/C_Sharp_(programming_language)) | https://github.com/phxvyper/raylib-cppsharp |
|
||||
| raylib-boo | 3.5 | [Boo](http://boo-language.github.io/) | https://github.com/Rabios/raylib-boo |
|
||||
| RaylibFS | 2.5 | [F#](https://fsharp.org/) | https://github.com/dallinbeutler/RaylibFS |
|
||||
| raylib_d | 2.5 | [D](https://dlang.org/) | https://github.com/Sepheus/raylib_d |
|
||||
| raylib-d | 3.0 | [D](https://dlang.org/) | https://github.com/onroundit/raylib-d |
|
||||
| bindbc-raylib | 3.0 | [D](https://dlang.org/) | https://github.com/o3o/bindbc-raylib |
|
||||
| raylib | **3.7** | [C/C++](https://en.wikipedia.org/wiki/C_(programming_language)) | https://github.com/raysan5/raylib |
|
||||
| Raylib-cs | 3.7 | [C#](https://en.wikipedia.org/wiki/C_Sharp_(programming_language)) | https://github.com/ChrisDill/Raylib-cs |
|
||||
| raylib-boo | 3.7 | [Boo](http://boo-language.github.io/) | https://github.com/Rabios/raylib-boo |
|
||||
| dray | 3.5 | [D](https://dlang.org/) | https://github.com/xdrie/dray |
|
||||
| raylib-go | 3.0 | [Go](https://golang.org/) | https://github.com/gen2brain/raylib-go |
|
||||
| raylib-goplus | 2.6-dev | [Go](https://golang.org/) | https://github.com/Lachee/raylib-goplus |
|
||||
| ray-go | 2.6-dev | [Go](https://golang.org/) | https://github.com/hecate-tech/ray-go |
|
||||
| go-raylib | 3.5 | [Go](https://golang.org/) | https://github.com/chunqian/go-raylib |
|
||||
| raylib-go | 4.0-dev | [Go](https://golang.org/) | https://github.com/gen2brain/raylib-go |
|
||||
| raylib-rs | 3.5 | [Rust](https://www.rust-lang.org/) | https://github.com/deltaphc/raylib-rs |
|
||||
| raylib-lua | 1.7 | [Lua](http://www.lua.org/) | https://github.com/raysan5/raylib-lua |
|
||||
| raylib-lua-ffi | 2.0 | [Lua](http://www.lua.org/) | https://github.com/raysan5/raylib/issues/693 |
|
||||
| raylib-lua-sol | 2.5 | [Lua](http://www.lua.org/) | https://github.com/RobLoach/raylib-lua-sol |
|
||||
| raylib-lua | 3.5 | [Lua](http://www.lua.org/) | https://github.com/TSnake41/raylib-lua |
|
||||
| raylib-luamore | 3.0 | [Lua](http://www.lua.org/) | https://github.com/HDPLocust/raylib-luamore |
|
||||
| raylua | 3.5 | [Lua](http://www.lua.org/) | https://github.com/Rabios/raylua |
|
||||
| LuaJIT-Raylib | 2.6 | [Lua](http://www.lua.org/) | https://github.com/Bambofy/LuaJIT-Raylib |
|
||||
| raylib-nelua | 3.0 | [Nelua](https://nelua.io/) | https://github.com/Andre-LA/raylib-nelua |
|
||||
| raylib-Nim | 1.7 | [Nim](https://nim-lang.org/) | https://gitlab.com/define-private-public/raylib-Nim |
|
||||
| raylib-nim | 2.0 | [Nim](https://nim-lang.org/) | https://github.com/Skrylar/raylib-nim |
|
||||
| raylib-Forever | 3.1-dev | [Nim](https://nim-lang.org/) | https://github.com/Guevara-chan/Raylib-Forever |
|
||||
| nim-raylib | 3.1-dev | [Nim](https://nim-lang.org/) | https://github.com/tomc1998/nim-raylib |
|
||||
| NimraylibNow! | 3.5-dev | [Nim](https://nim-lang.org/) | https://github.com/greenfork/nimraylib_now |
|
||||
| raylib-haskell | 2.0 | [Haskell](https://www.haskell.org/) | https://github.com/DevJac/raylib-haskell |
|
||||
| raylib-cr | 2.5-dev | [Crystal](https://crystal-lang.org/) | https://github.com/AregevDev/raylib-cr |
|
||||
| cray | 1.8 | [Crystal](https://crystal-lang.org/) | https://gitlab.com/Zatherz/cray |
|
||||
| raylib.cr | 2.0 | [Crystal](https://crystal-lang.org/) | https://github.com/sam0x17/raylib.cr |
|
||||
| raylib-pascal | 2.0 | [Pascal](https://en.wikipedia.org/wiki/Pascal_(programming_language)) | https://github.com/drezgames/raylib-pascal |
|
||||
| raylib-pas | 3.0 | [Pascal](https://en.wikipedia.org/wiki/Pascal_(programming_language)) | https://github.com/tazdij/raylib-pas |
|
||||
| Ray4Laz | 3.5 | [Pascal](https://en.wikipedia.org/wiki/Pascal_(programming_language)) | https://github.com/GuvaCode/Ray4Laz |
|
||||
| Graphics-Raylib | 1.4 | [Perl](https://www.perl.org/) | https://github.com/athreef/Graphics-Raylib |
|
||||
| raylib-ruby-ffi | 2.0 | [Ruby](https://www.ruby-lang.org/en/) | https://github.com/D3nX/raylib-ruby-ffi |
|
||||
| raylib-ruby | 2.6 | [Ruby](https://www.ruby-lang.org/en/) | https://github.com/a0/raylib-ruby |
|
||||
| raylib-mruby | 2.5-dev | [mruby](https://github.com/mruby/mruby) | https://github.com/lihaochen910/raylib-mruby |
|
||||
| raylib-py | 2.0 | [Python](https://www.python.org/) | https://github.com/overdev/raylib-py |
|
||||
| raylib-python-cffi | 3.5 | [Python](https://www.python.org/) | https://github.com/electronstudio/raylib-python-cffi |
|
||||
| raylib-py-ctbg | 2.6 | [Python](https://www.python.org/) | https://github.com/overdev/raylib-py-ctbg |
|
||||
| jaylib | 3.0 | [Java](https://en.wikipedia.org/wiki/Java_(programming_language)) | https://github.com/electronstudio/jaylib/ |
|
||||
| raylib-java | 2.0 | [Java](https://en.wikipedia.org/wiki/Java_(programming_language)) | https://github.com/XoanaIO/raylib-java |
|
||||
| clj-raylib | 3.0 | [Clojure](https://clojure.org/) | https://github.com/lsevero/clj-raylib |
|
||||
| raylib-lua | 3.7 | [Lua](http://www.lua.org/) | https://github.com/TSnake41/raylib-lua |
|
||||
| raylua | 3.7 | [Lua](http://www.lua.org/) | https://github.com/Rabios/raylua |
|
||||
| nelua-raylib | 3.7 | [nelua](https://nelua.io/) | https://github.com/AKDev21/nelua-raylib |
|
||||
| NimraylibNow! | 3.7 | [Nim](https://nim-lang.org/) | https://github.com/greenfork/nimraylib_now |
|
||||
| raylib-Forever | auto | [Nim](https://nim-lang.org/) | https://github.com/Guevara-chan/Raylib-Forever |
|
||||
| Ray4Laz | 3.7 | [Pascal](https://en.wikipedia.org/wiki/Pascal_(programming_language)) | https://github.com/GuvaCode/Ray4Laz |
|
||||
| pyraylib | 3.7 | [Python](https://www.python.org/) | https://github.com/Ho011/pyraylib |
|
||||
| raylib-python-cffi | 3.7 | [Python](https://www.python.org/) | https://github.com/electronstudio/raylib-python-cffi |
|
||||
| jaylib | 3.7 | [Java](https://en.wikipedia.org/wiki/Java_(programming_language)) | https://github.com/electronstudio/jaylib/ |
|
||||
| node-raylib | 3.5 | [Node.js](https://nodejs.org/en/) | https://github.com/RobLoach/node-raylib |
|
||||
| QuickJS-raylib | 3.0 | [QuickJS](https://bellard.org/quickjs/) | https://github.com/sntg-p/QuickJS-raylib |
|
||||
| raylib-duktape | 2.6 | [JavaScript (Duktape)](https://en.wikipedia.org/wiki/JavaScript) | https://github.com/RobLoach/raylib-duktape |
|
||||
| raylib-v7 | 3.5 | [JavaScript (v7)](https://en.wikipedia.org/wiki/JavaScript) | https://github.com/Rabios/raylib-v7 |
|
||||
| raylib-chaiscript | 2.6 | [ChaiScript](http://chaiscript.com/) | https://github.com/RobLoach/raylib-chaiscript |
|
||||
| raylib-squirrel | 2.5 | [Squirrel](http://www.squirrel-lang.org/) | https://github.com/RobLoach/raylib-squirrel |
|
||||
| racket-raylib-2d | 2.5 | [Racket](https://racket-lang.org/) | https://github.com/arvyy/racket-raylib-2d |
|
||||
| raylib-php | 3.5 | [PHP](https://en.wikipedia.org/wiki/PHP) | https://github.com/joseph-montanez/raylib-php |
|
||||
| raylib-php-ffi | 2.4-dev | [PHP](https://en.wikipedia.org/wiki/PHP) | https://github.com/oraoto/raylib-php-ffi |
|
||||
| raylib-phpcpp | 3.5 | [PHP](https://en.wikipedia.org/wiki/PHP) | https://github.com/oraoto/raylib-phpcpp |
|
||||
| raylib-factor | 3.5 | [Factor](https://factorcode.org/) | https://github.com/ArnautDaniel/raylib-factor |
|
||||
| gforth-raylib | 3.5 | [Gforth](https://gforth.org/) | https://github.com/ArnautDaniel/gforth-raylib |
|
||||
| hxRaylib | 3.7 | [Haxe](https://haxe.org/) | https://github.com/ForeignSasquatch/hxRaylib |
|
||||
| raylib-wren | 3.7 | [Wren](http://wren.io/) | https://github.com/TSnake41/raylib-wren |
|
||||
| raylib_odin_bindings | 4.0-dev | [Odin](https://odin-lang.org/) | https://github.com/Deathbat2190/raylib_odin_bindings |
|
||||
| raylib-odin | 3.7| [Odin](https://odin-lang.org/) | https://github.com/odin-lang/Odin/tree/master/vendor/raylib |
|
||||
| raylib.v | 3.7 | [V](https://vlang.io/) | https://github.com/irishgreencitrus/raylib.v |
|
||||
| raylib-ocaml | 3.7 | [OCaml](https://ocaml.org/) | https://github.com/tjammer/raylib-ocaml |
|
||||
| raylib-swift | 3.7 | [Swift](https://swift.org/) | https://github.com/STREGAsGate/Raylib |
|
||||
| hb-raylib | 3.5 | [Harbour](https://harbour.github.io) | https://github.com/MarcosLeonardoMendezGerencir/hb-raylib |
|
||||
| Relib | 3.5 | [ReCT](https://github.com/RedCubeDev-ByteSpace/ReCT) | https://github.com/RedCubeDev-ByteSpace/Relib |
|
||||
| rayex | 3.7 | [elixir](https://elixir-lang.org/) | https://github.com/shiryel/rayex |
|
||||
| kaylib | 3.7 | [Kotlin/native](https://kotlinlang.org) | https://github.com/electronstudio/kaylib |
|
||||
| dlang_raylib | 3.7 | [D](https://dlang.org) | https://github.com/rc-05/dlang_raylib |
|
||||
|
||||
### Utility Wrapers
|
||||
These are utility wrappers for specific languages, they are not required to use raylib in the language but may adapt the raylib API to be more inline with the language's pardigm.
|
||||
| name | raylib version | language | repo |
|
||||
|:------------------:|:-------------: | :--------:|----------------------------------------------------------------------|
|
||||
| raylib-cpp | 3.7 | [C++](https://en.wikipedia.org/wiki/C%2B%2B) | https://github.com/robloach/raylib-cpp |
|
||||
|
||||
### Older or Unmaintained Language Bindings
|
||||
These are older raylib bindings that are more than 2 versions old or have not been maintained.
|
||||
| name | raylib version | language | repo |
|
||||
|:------------------:|:-------------: | :--------:|----------------------------------------------------------------------|
|
||||
| raylib-cppsharp | 2.5 | [C#](https://en.wikipedia.org/wiki/C_Sharp_(programming_language)) | https://github.com/phxvyper/raylib-cppsharp |
|
||||
| RaylibFS | 2.5 | [F#](https://fsharp.org/) | https://github.com/dallinbeutler/RaylibFS |
|
||||
| raylib_d | 2.5 | [D](https://dlang.org/) | https://github.com/Sepheus/raylib_d |
|
||||
| bindbc-raylib | 3.0 | [D](https://dlang.org/) | https://github.com/o3o/bindbc-raylib |
|
||||
| go-raylib | 3.5 | [Go](https://golang.org/) | https://github.com/chunqian/go-raylib |
|
||||
| raylib-goplus | 2.6-dev | [Go](https://golang.org/) | https://github.com/Lachee/raylib-goplus |
|
||||
| ray-go | 2.6-dev | [Go](https://golang.org/) | https://github.com/hecate-tech/ray-go |
|
||||
| raylib-luamore | 3.0 | [Lua](http://www.lua.org/) | https://github.com/HDPLocust/raylib-luamore |
|
||||
| LuaJIT-Raylib | 2.6 | [Lua](http://www.lua.org/) | https://github.com/Bambofy/LuaJIT-Raylib |
|
||||
| raylib-lua-sol | 2.5 | [Lua](http://www.lua.org/) | https://github.com/RobLoach/raylib-lua-sol |
|
||||
| raylib-lua-ffi | 2.0 | [Lua](http://www.lua.org/) | https://github.com/raysan5/raylib/issues/693 |
|
||||
| raylib-lua | 1.7 | [Lua](http://www.lua.org/) | https://github.com/raysan5/raylib-lua |
|
||||
| raylib-nelua | 3.0 | [Nelua](https://nelua.io/) | https://github.com/Andre-LA/raylib-nelua |
|
||||
| raylib-nim | 2.0 | [Nim](https://nim-lang.org/) | https://github.com/Skrylar/raylib-nim |
|
||||
| raylib-Nim | 1.7 | [Nim](https://nim-lang.org/) | https://gitlab.com/define-private-public/raylib-Nim |
|
||||
| nim-raylib | 3.1-dev | [Nim](https://nim-lang.org/) | https://github.com/tomc1998/nim-raylib |
|
||||
| raylib-haskell | 2.0 | [Haskell](https://www.haskell.org/) | https://github.com/DevJac/raylib-haskell |
|
||||
| raylib-cr | 2.5-dev | [Crystal](https://crystal-lang.org/) | https://github.com/AregevDev/raylib-cr |
|
||||
| raylib.cr | 2.0 | [Crystal](https://crystal-lang.org/) | https://github.com/sam0x17/raylib.cr |
|
||||
| cray | 1.8 | [Crystal](https://crystal-lang.org/) | https://gitlab.com/Zatherz/cray |
|
||||
| raylib-pas | 3.0 | [Pascal](https://en.wikipedia.org/wiki/Pascal_(programming_language)) | https://github.com/tazdij/raylib-pas |
|
||||
| raylib-pascal | 2.0 | [Pascal](https://en.wikipedia.org/wiki/Pascal_(programming_language)) | https://github.com/drezgames/raylib-pascal |
|
||||
| Graphics-Raylib | 1.4 | [Perl](https://www.perl.org/) | https://github.com/athreef/Graphics-Raylib |
|
||||
| raylib-ruby | 2.6 | [Ruby](https://www.ruby-lang.org/en/) | https://github.com/a0/raylib-ruby |
|
||||
| raylib-ruby-ffi | 2.0 | [Ruby](https://www.ruby-lang.org/en/) | https://github.com/D3nX/raylib-ruby-ffi |
|
||||
| raylib-mruby | 2.5-dev | [mruby](https://github.com/mruby/mruby) | https://github.com/lihaochen910/raylib-mruby |
|
||||
| raylib-py-ctbg | 2.6 | [Python](https://www.python.org/) | https://github.com/overdev/raylib-py-ctbg |
|
||||
| raylib-py | 2.0 | [Python](https://www.python.org/) | https://github.com/overdev/raylib-py |
|
||||
| raylib-java | 2.0 | [Java](https://en.wikipedia.org/wiki/Java_(programming_language)) | https://github.com/XoanaIO/raylib-java |
|
||||
| raylib-j | 3.5 | [Java](https://en.wikipedia.org/wiki/Java_(programming_language)) | https://github.com/CreedVI/Raylib-J |
|
||||
| clj-raylib | 3.0 | [Clojure](https://clojure.org/) | https://github.com/lsevero/clj-raylib |
|
||||
| QuickJS-raylib | 3.0 | [QuickJS](https://bellard.org/quickjs/) | https://github.com/sntg-p/QuickJS-raylib |
|
||||
| raylib-duktape | 2.6 | [JavaScript (Duktape)](https://en.wikipedia.org/wiki/JavaScript) | https://github.com/RobLoach/raylib-duktape |
|
||||
| raylib-chaiscript | 2.6 | [ChaiScript](http://chaiscript.com/) | https://github.com/RobLoach/raylib-chaiscript |
|
||||
| raylib-squirrel | 2.5 | [Squirrel](http://www.squirrel-lang.org/) | https://github.com/RobLoach/raylib-squirrel |
|
||||
| racket-raylib-2d | 2.5 | [Racket](https://racket-lang.org/) | https://github.com/arvyy/racket-raylib-2d |
|
||||
| raylib-php-ffi | 2.4-dev | [PHP](https://en.wikipedia.org/wiki/PHP) | https://github.com/oraoto/raylib-php-ffi |
|
||||
| raylib-haxe | 2.4 | [Haxe](https://haxe.org/) | https://github.com/ibilon/raylib-haxe |
|
||||
| ringraylib | 2.6 | [Ring](http://ring-lang.sourceforge.net/) | https://github.com/ringpackages/ringraylib |
|
||||
| cl-raylib | 3.0 | [Common Lisp](https://common-lisp.net/) | https://github.com/longlene/cl-raylib |
|
||||
@@ -70,17 +94,15 @@ Here it is a list with the ones I'm aware of:
|
||||
| raylib-chibi | 2.5 | [Chibi-Scheme](https://github.com/ashinn/chibi-scheme) | https://github.com/VincentToups/raylib-chibi |
|
||||
| raylib-gambit-scheme | 3.1-dev | [Gambit Scheme](https://github.com/gambit/gambit) | https://github.com/georgjz/raylib-gambit-scheme |
|
||||
| Euraylib | 3.0 | [Euphoria](https://openeuphoria.org/) | https://github.com/gAndy50/Euraylib |
|
||||
| raylib-wren | 3.0 | [Wren](http://wren.io/) | https://github.com/TSnake41/raylib-wren |
|
||||
| raylib-odin | 3.0 | [Odin](https://odin-lang.org/) | https://github.com/kevinw/raylib-odin |
|
||||
| vraylib | 3.5 | [V](https://vlang.io/) | https://github.com/waotzi/vraylib |
|
||||
| raylib-zig | 3.0 | [Zig](https://ziglang.org/) | https://github.com/Not-Nik/raylib-zig |
|
||||
| raylib-jai | 3.1-dev | [Jai](https://github.com/BSVino/JaiPrimer/blob/master/JaiPrimer.md) | https://github.com/kevinw/raylib-jai |
|
||||
| ray.zig | 2.5 | [Zig](https://ziglang.org/) | https://github.com/BitPuffin/zig-raylib-experiments |
|
||||
| raylib-Ada | 3.0 | [Ada](https://www.adacore.com/about-ada) | https://github.com/mimo/raylib-Ada |
|
||||
| jaylib | 3.0 | [Janet](https://janet-lang.org/) | https://github.com/janet-lang/jaylib |
|
||||
| raykit | ? | [Kit](https://www.kitlang.org/) | https://github.com/Gamerfiend/raykit |
|
||||
| vraylib | 3.5 | [V](https://vlang.io/) | https://github.com/waotzi/vraylib |
|
||||
| ray.mod | 3.0 | [BlitzMax](https://blitzmax.org/) | https://github.com/bmx-ng/ray.mod |
|
||||
| ray-ocaml | 3.0 | [OCaml](https://ocaml.org/) | https://github.com/tjammer/raylib-ocaml |
|
||||
| raylib-mosaic | 3.0 | [Mosaic](https://github.com/sal55/langs/tree/master/Mosaic) | https://github.com/pluckyporcupine/raylib-mosaic |
|
||||
| raylib-xdpw | 2.6 | [XD Pascal](https://github.com/vtereshkov/xdpw) | https://github.com/vtereshkov/raylib-xdpw |
|
||||
| raylib-carp | 3.0 | [Carp](https://github.com/carp-lang/Carp) | https://github.com/pluckyporcupine/raylib-carp |
|
||||
@@ -91,11 +113,10 @@ Here it is a list with the ones I'm aware of:
|
||||
| raylib-beef | 3.0 | [Beef](https://www.beeflang.org/) | https://github.com/M0n7y5/raylib-beef |
|
||||
| raylib-never | 3.0 | [Never](https://github.com/never-lang/never) | https://github.com/never-lang/raylib-never |
|
||||
| raylib.cbl | 2.0 | [COBOL](https://en.wikipedia.org/wiki/COBOL) | *[code examples](https://github.com/Martinfx/Cobol/tree/master/OpenCobol/Games/raylib)* |
|
||||
| Relib | 3.5 | [ReCT](https://github.com/RedCubeDev-ByteSpace/ReCT) | https://github.com/RedCubeDev-ByteSpace/Relib |
|
||||
| Harbour | 3.5 | [Harbour](https://harbour.github.io) | https://github.com/MarcosLeonardoMendezGerencir/hb-raylib |
|
||||
|
||||
|
||||
Missing some language? Feel free to create a new binding! :)
|
||||
|
||||
Missing some language or wrapper? Feel free to create a new one! :)
|
||||
|
||||
Usually, raylib bindings follow the convention: `raylib-{language}`
|
||||
|
||||
|
146
CHANGELOG
@@ -1,7 +1,151 @@
|
||||
changelog
|
||||
---------
|
||||
|
||||
Current Release: raylib 3.7.0 (26 April 2021)
|
||||
Current Release: raylib 4.0.0 (05 November 2021)
|
||||
|
||||
-------------------------------------------------------------------------
|
||||
Release: raylib 4.0 - 8th Anniversary Edition (05 November 2021)
|
||||
-------------------------------------------------------------------------
|
||||
KEY CHANGES:
|
||||
- Naming consistency and coherency: Complete review of the library: sintax, naming, comments, decriptions, logs...
|
||||
- Event Automation System: Support for input events recording and automatic re-playing, useful for automated testing and more!
|
||||
- Custom game-loop control: Intended for advance users that want to control the events polling and the timming mechanisms
|
||||
- rlgl 4.0: Completely decoupling from platform layer and raylib, intended for standalone usage as single-file header-only
|
||||
- raymath 1.5: Complete review following new conventions, to make it more portable and self-contained
|
||||
- raygui 3.0: Complete review and official new release, more portable and self-contained, intended for tools development
|
||||
- raylib_parser: New tool to parse raylib.h and extract all required info into custom output formats (TXT, XML, JSON...)
|
||||
- Zig and Odin official support
|
||||
|
||||
Detailed changes:
|
||||
[core] ADDED: Support canvas resizing on web (#1840) by @skylersaleh
|
||||
[core] ADDED: GetMouseDelta() (#1832) by @adricoin2010
|
||||
[core] ADDED: Support additional mouse buttons (#1753) by @lambertwang
|
||||
[core] ADDED: SetRandomSeed() (#1994) by @TommiSinivuo
|
||||
[core] ADDED: GetTouchPointId() #1972
|
||||
[core] ADDED: EncodeDataBase64() and DecodeDataBase64()
|
||||
[core] REMOVED: PLATFORM_UWP, difficult to maintain
|
||||
[core] REMOVED: IsGamepadName()
|
||||
[core] RENAMED: SwapBuffers() to SwapScreenBuffer()
|
||||
[core] RENAMED: Wait() to WaitTime()
|
||||
[core] RENAMED: RayHitInfo to RayCollision (#1781)
|
||||
[core] RENAMED: GetRayCollisionGround() to GetRayCollisionQuad() (#1781)
|
||||
[core] REVIEWED: Support mouse wheel on x-axis (#1948)
|
||||
[core] REVIEWED: DisableCursor() on web by registering an empty mouse click event function in emscripten (#1900) by @grenappels
|
||||
[core] REVIEWED: LoadShader() and default locations and descriptions
|
||||
[core] REVIEWED: LoadShaderFromMemory() (#1851) by @Ruminant
|
||||
[core] REVIEWED: WaitTime(), avoid global variables dependency to make the function is self-contained (#1841)
|
||||
[core] REVIEWED: SetWindowSize() to work on web (#1847) by @nikki93
|
||||
[core] REVIEWED: Raspberry RPI/DRM keyboard blocking render loop (#1879) @luizpestana
|
||||
[core] REVIEWED: Android multi-touch (#1869) by @humbe
|
||||
[core] REVIEWED: Implemented GetGamepadName() for emscripten by @nbarkhina
|
||||
[core] REVIEWED: HighDPI support (#1987) by @ArnaudValensi
|
||||
[core] REVIEWED: KeyCallback(), register keys independently of the actions
|
||||
[rlgl] ADDED: GRAPHIC_API_OPENGL_43
|
||||
[rlgl] ADDED: rlUpdateVertexBufferElements() (#1915)
|
||||
[rlgl] ADDED: rlActiveDrawBuffers() (#1911)
|
||||
[rlgl] ADDED: rlEnableColorBlend()/rlDisableColorBlend()
|
||||
[rlgl] ADDED: rlGetPixelFormatName()
|
||||
[rlgl] REVIEWED: rlUpdateVertexBuffer (#1914) by @630Studios
|
||||
[rlgl] REVIEWED: rlDrawVertexArrayElements() (#1891)
|
||||
[rlgl] REVIEWED: Wrong normal matrix calculation (#1870)
|
||||
[raymath] ADDED: Vector3Angle()
|
||||
[raymath] REVIEWED: QuaternionFromAxisAngle() (#1892)
|
||||
[raymath] REVIEWED: QuaternionToMatrix() returning transposed result. (#1793) by @object71
|
||||
[shapes] ADDED: RenderPolyLinesEx() (#1758) by @lambertwang
|
||||
[shapes] ADDED: DrawLineBezierCubic() (#2021) by @SAOMDVN
|
||||
[textures] ADDED: GetImageColor() #2024
|
||||
[textures] REMOVED: GenImagePerlinNoise()
|
||||
[textures] RENAMED: GetTextureData() to LoadImageFromTexture()
|
||||
[textures] RENAMED: GetScreenData() to LoadImageFromScreen()
|
||||
[textures] REVIEWED: ExportImage() to use SaveFileData() (#1779)
|
||||
[textures] REVIEWED: LoadImageAnim() #2005
|
||||
[text] ADDED: Security check in case of not valid font
|
||||
[text] ADDED: `GetGlyphInfo()` to get glyph info for a specific codepoint
|
||||
[text] ADDED: `GetGlyphAtlasRec()` to get glyph rectangle within the generated font atlas
|
||||
[text] ADDED: DrawTextPro() with text rotation support, WARNING: DrawTextPro() requires including `rlgl.h`, before it was only dependant on `textures` module.
|
||||
[text] ADDED: UnloadCodepoints() to safely free loaded codepoints
|
||||
[text] REMOVED: DrawTextRec() and DrawTextRecEx(), moved to example, those functions could be very specific depending on user needs so it's better to give the user the full source in case of special requirements instead of allowing a function with +10 input parameters.
|
||||
[text] RENAMED: struct `CharInfo` to `GlyphInfo`, actually that's the correct naming for the data contained. It contains the character glyph metrics and the glyph image; in the past it also contained rectangle within the font atlas but that data has been moved to `Font` struct directly, so, `GlyphInfo` is a more correct name.
|
||||
[text] RENAMED: `CodepointToUtf8()` to `CodepointToUTF8()`, capitalization of UTF-8 is the correct form, it would also require de hyphen but it can be omitted in this case.
|
||||
[text] RENAMED: `TextToUtf8()` to `TextCodepointsToUTF8` for consistency and more detail on the functionality.
|
||||
[text] RENAMED: GetCodepoints() to LoadCodepoints(), now codepoint array data is loaded dynamically instead of reusing a limited static buffer.
|
||||
[text] RENAMED: GetNextCodepoint() to GetCodepoint()
|
||||
[models] ADDED: MagikaVoxel VOX models loading
|
||||
[models] ADDED: GenMeshCone() (#1903)
|
||||
[models] ADDED: GetModelBoundingBox()
|
||||
[models] ADDED: DrawBillboardPro() (#1759) by @nobytesgiven
|
||||
[models] ADDED: DrawCubeTextureRec() (#2001) by @tdgroot
|
||||
[models] ADDED: DrawCylinderEx() and DrawCylinderWiresEx() (#2049) by @Horrowind
|
||||
[models] REMOVED: DrawBillboardEx()
|
||||
[models] RENAMED: MeshBoundingBox() to GetMeshBoundingBox()
|
||||
[models] RENAMED: MeshTangents() to GenMeshTangents()
|
||||
[models] RENAMED: MeshBinormals() to GenMeshBinormals()
|
||||
[models] REVIEWED: GenMeshTangents() (#1877) by @630Studios
|
||||
[models] REVIEWED: CheckCollisionBoxSphere() by @Crydsch
|
||||
[models] REVIEWED: GetRayCollisionQuad() by @Crydsch
|
||||
[models] REVIEWED: LoadGLTF(), fixed missing transformations and nonroot skinning by @MrDiver
|
||||
[models] REVIEWED: LoadGLTF(), rewriten from scratch, removed animations support (broken)
|
||||
[models] REVIEWED: Decouple DrawMesh() and DrawMeshInstanced() (#1958)
|
||||
[models] REVIEWED: Support vertex color attribute for GLTF and IQM (#1790) by @object71
|
||||
[models] REVIEWED: DrawBillboardPro() (#1941) by @GithubPrankster
|
||||
[models] REDESIGNED: Major review of glTF loading functionality (#1849) by @object71
|
||||
[audio] ADDED: SeekMusicStream() (#2006) by @GithubPrankster
|
||||
[audio] REMOVED: GetAudioStreamBufferSizeDefault()
|
||||
[audio] RENAMED: InitAudioStream() to LoadAudioStream()
|
||||
[audio] RENAMED: CloseAudioStream() to UnloadAudioStream()
|
||||
[audio] RENAMED: IsMusicPlaying() to IsMusicStreamPlaying()
|
||||
[audio] REVIEWED: ExportWaveAsCode()
|
||||
[audio] REDESIGNED: Use frameCount on audio instead of sampleCount
|
||||
[utils] REVIEWED: exit() on LOG_FATAL instead of LOG_ERROR (#1796)
|
||||
[examples] ADDED: core_custom_frame_control
|
||||
[examples] ADDED: core_basic_screen_manager
|
||||
[examples] ADDED: core_split_screen (#1806) by @JeffM2501
|
||||
[examples] ADDED: core_smooth_pixelperfect (#1771) by @NotManyIdeasDev
|
||||
[examples] ADDED: shaders_texture_outline (#1883) by @GoldenThumbs
|
||||
[examples] ADDED: models_loading_vox (#1940) by @procfxgen
|
||||
[examples] ADDED: rlgl_compute_shader by @TSnake41 (#2088)
|
||||
[examples] REMOVED: models_material_pbr
|
||||
[examples] REMOVED: models_gltf_animation
|
||||
[examples] REVIEWED: core_3d_picking
|
||||
[examples] REVIEWED: core_input_mouse
|
||||
[examples] REVIEWED: core_vr_simulator, RenderTexture usage
|
||||
[examples] REVIEWED: core_window_letterbox, RenderTexture usage
|
||||
[examples] REVIEWED: shapes_basic_shapes
|
||||
[examples] REVIEWED: shapes_logo_raylib_anim
|
||||
[examples] REVIEWED: textures_to_image
|
||||
[examples] REVIEWED: text_rectangle_bounds
|
||||
[examples] REVIEWED: text_unicode
|
||||
[examples] REVIEWED: text_draw_3d
|
||||
[examples] REVIEWED: models_loading
|
||||
[examples] REVIEWED: models_skybox (#1792) (#1778)
|
||||
[examples] REVIEWED: models_mesh_picking
|
||||
[examples] REVIEWED: models_yaw_pitch_roll
|
||||
[examples] REVIEWED: models_rlgl_solar_system
|
||||
[examples] REVIEWED: shaders_custom_uniform, RenderTexture usage
|
||||
[examples] REVIEWED: shaders_eratosthenes, RenderTexture usage
|
||||
[examples] REVIEWED: shaders_julia_set, RenderTexture usage
|
||||
[examples] REVIEWED: shaders_postprocessing, RenderTexture usage
|
||||
[examples] REVIEWED: shaders_basic_lighting, simplified (#1865)
|
||||
[examples] REVIEWED: audio_raw_stream.c
|
||||
[examples] REVIEWED: raudio_standalone
|
||||
[examples] REVIEWED: raylib_opengl_interop
|
||||
[examples] REVIEWED: rlgl_standalone.c
|
||||
[examples] REVIEWED: Resources licenses
|
||||
[examples] REVIEWED: models resources reorganization
|
||||
[templates] REMOVED: Moved to a separate repo: https://github.com/raysan5/raylib-game-template
|
||||
[build] ADDED: Zig build file (#2014) by @TommiSinivuo
|
||||
[build] ADDED: Android VS2019 solution (#2013) by @Kronka
|
||||
[build] REMOVED: VS2017 project, outdated
|
||||
[build] RENAMED: All raylib modules prefixed with 'r' (core -> rcore)
|
||||
[build] RENAMED: SUPPORT_MOUSE_CURSOR_NATIVE to SUPPORT_MOUSE_CURSOR_POINT
|
||||
[build] REVIEWED: examples/examples_template.c
|
||||
[build] REVIEWED: Makefile to latest Emscripten SDK r23
|
||||
[build] REVIEWED: Makefile for latest Android NDK r32 LTS
|
||||
[build] REVIEWED: raylib resource files
|
||||
[build] Moved some extra raylib libraries to /extras/ directory
|
||||
[*] UPDATED: Multiple bindings to latest version
|
||||
[*] UPDATED: Most external libraries to latest versions (except GLFW)
|
||||
[*] Multiple code improvements and fixes by multiple contributors!
|
||||
|
||||
-------------------------------------------------------------------------
|
||||
Release: raylib 3.7 (26 April 2021)
|
||||
|
@@ -4,7 +4,7 @@ include(EnumOption)
|
||||
|
||||
enum_option(PLATFORM "Desktop;Web;Android;Raspberry Pi;DRM" "Platform to build for.")
|
||||
|
||||
enum_option(OPENGL_VERSION "OFF;3.3;2.1;1.1;ES 2.0" "Force a specific OpenGL Version?")
|
||||
enum_option(OPENGL_VERSION "OFF;4.3;3.3;2.1;1.1;ES 2.0" "Force a specific OpenGL Version?")
|
||||
|
||||
# Configuration options
|
||||
option(BUILD_EXAMPLES "Build the examples." ${RAYLIB_IS_MAIN})
|
||||
@@ -27,9 +27,9 @@ endif()
|
||||
option(INCLUDE_EVERYTHING "Include everything disabled by default (for CI usage" OFF)
|
||||
set(OFF ${INCLUDE_EVERYTHING} CACHE INTERNAL "Replace any OFF by default with \${OFF} to have it covered by this option")
|
||||
|
||||
# core.c
|
||||
cmake_dependent_option(SUPPORT_CAMERA_SYSTEM "Provide camera module (camera.h) with multiple predefined cameras: free, 1st/3rd person, orbital" ON CUSTOMIZE_BUILD ON)
|
||||
cmake_dependent_option(SUPPORT_GESTURES_SYSTEM "Gestures module is included (gestures.h) to support gestures detection: tap, hold, swipe, drag" ON CUSTOMIZE_BUILD ON)
|
||||
# rcore.c
|
||||
cmake_dependent_option(SUPPORT_CAMERA_SYSTEM "Provide camera module (rcamera.h) with multiple predefined cameras: free, 1st/3rd person, orbital" ON CUSTOMIZE_BUILD ON)
|
||||
cmake_dependent_option(SUPPORT_GESTURES_SYSTEM "Gestures module is included (rgestures.h) to support gestures detection: tap, hold, swipe, drag" ON CUSTOMIZE_BUILD ON)
|
||||
cmake_dependent_option(SUPPORT_MOUSE_GESTURES "Mouse gestures are directly mapped like touches and processed by gestures system" ON CUSTOMIZE_BUILD ON)
|
||||
cmake_dependent_option(SUPPORT_SSH_KEYBOARD_RPI "Reconfigure standard input to receive key inputs, works with SSH connection" OFF CUSTOMIZE_BUILD OFF)
|
||||
cmake_dependent_option(SUPPORT_DEFAULT_FONT "Default font is loaded on window initialization to be available for the user to render simple text. If enabled, uses external module functions to load default raylib font (module: text)" ON CUSTOMIZE_BUILD ON)
|
||||
@@ -41,10 +41,10 @@ cmake_dependent_option(SUPPORT_WINMM_HIGHRES_TIMER "Setting a higher resolution
|
||||
cmake_dependent_option(SUPPORT_DATA_STORAGE "Support for persistent data storage" ON CUSTOMIZE_BUILD ON)
|
||||
cmake_dependent_option(SUPPORT_COMPRESSION_API "Support for compression API" ON CUSTOMIZE_BUILD ON)
|
||||
|
||||
# shapes.c
|
||||
# rshapes.c
|
||||
cmake_dependent_option(SUPPORT_QUADS_DRAW_MODE "Use QUADS instead of TRIANGLES for drawing when possible. Some lines-based shapes could still use lines" ON CUSTOMIZE_BUILD ON)
|
||||
|
||||
# textures.c
|
||||
# rtextures.c
|
||||
cmake_dependent_option(SUPPORT_IMAGE_EXPORT "Support image exporting to file" ON CUSTOMIZE_BUILD ON)
|
||||
cmake_dependent_option(SUPPORT_IMAGE_GENERATION "Support procedural image generation functionality (gradient, spot, perlin-noise, cellular)" ON CUSTOMIZE_BUILD ON)
|
||||
cmake_dependent_option(SUPPORT_IMAGE_MANIPULATION "Support multiple image editing functions to scale, adjust colors, flip, draw on images, crop... If not defined only three image editing functions supported: ImageFormat(), ImageAlphaMask(), ImageToPOT()" ON CUSTOMIZE_BUILD ON)
|
||||
@@ -61,17 +61,18 @@ cmake_dependent_option(SUPPORT_FILEFORMAT_PSD "Support loading PSD as textures"
|
||||
cmake_dependent_option(SUPPORT_FILEFORMAT_PKM "Support loading PKM as textures" ${OFF} CUSTOMIZE_BUILD OFF)
|
||||
cmake_dependent_option(SUPPORT_FILEFORMAT_PVR "Support loading PVR as textures" ${OFF} CUSTOMIZE_BUILD OFF)
|
||||
|
||||
# text.c
|
||||
# rtext.c
|
||||
cmake_dependent_option(SUPPORT_FILEFORMAT_FNT "Support loading fonts in FNT format" ON CUSTOMIZE_BUILD ON)
|
||||
cmake_dependent_option(SUPPORT_FILEFORMAT_TTF "Support loading font in TTF/OTF format" ON CUSTOMIZE_BUILD ON)
|
||||
cmake_dependent_option(SUPPORT_TEXT_MANIPULATION "Support text manipulation functions" ON CUSTOMIZE_BUILD ON)
|
||||
|
||||
# models.c
|
||||
# rmodels.c
|
||||
cmake_dependent_option(SUPPORT_MESH_GENERATION "Support procedural mesh generation functions, uses external par_shapes.h library. NOTE: Some generated meshes DO NOT include generated texture coordinates" ON CUSTOMIZE_BUILD ON)
|
||||
cmake_dependent_option(SUPPORT_FILEFORMAT_OBJ "Support loading OBJ file format" ON CUSTOMIZE_BUILD ON)
|
||||
cmake_dependent_option(SUPPORT_FILEFORMAT_MTL "Support loading MTL file format" ON CUSTOMIZE_BUILD ON)
|
||||
cmake_dependent_option(SUPPORT_FILEFORMAT_IQM "Support loading IQM file format" ON CUSTOMIZE_BUILD ON)
|
||||
cmake_dependent_option(SUPPORT_FILEFORMAT_GLTF "Support loading GLTF file format" ON CUSTOMIZE_BUILD ON)
|
||||
cmake_dependent_option(SUPPORT_FILEFORMAT_VOX "Support loading VOX file format" ON CUSTOMIZE_BUILD ON)
|
||||
|
||||
# raudio.c
|
||||
cmake_dependent_option(SUPPORT_FILEFORMAT_WAV "Support loading WAV for sound" ON CUSTOMIZE_BUILD ON)
|
||||
|
95
CONVENTIONS.md
Normal file
@@ -0,0 +1,95 @@
|
||||
## C Coding Style Conventions
|
||||
|
||||
Here it is a list with some of the code conventions used by raylib:
|
||||
|
||||
Code element | Convention | Example
|
||||
--- | :---: | ---
|
||||
Defines | ALL_CAPS | `#define PLATFORM_DESKTOP`
|
||||
Macros | ALL_CAPS | `#define MIN(a,b) (((a)<(b))?(a):(b))`
|
||||
Variables | lowerCase | `int screenWidth = 0;`, `float targetFrameTime = 0.016f;`
|
||||
Local variables | lowerCase | `Vector2 playerPosition = { 0 };`
|
||||
Global variables | lowerCase | `bool windowReady = false;`
|
||||
Constants | lowerCase | `const int maxValue = 8;`
|
||||
Pointers | MyType *pointer | `Texture2D *array = NULL;`
|
||||
float values | always x.xf | `float gravity = 10.0f`
|
||||
Operators | value1*value2 | `int product = value*6;`
|
||||
Operators | value1/value2 | `int division = value/4;`
|
||||
Operators | value1 + value2 | `int sum = value + 10;`
|
||||
Operators | value1 - value2 | `int res = value - 5;`
|
||||
Enum | TitleCase | `enum TextureFormat`
|
||||
Enum members | ALL_CAPS | `PIXELFORMAT_UNCOMPRESSED_R8G8B8`
|
||||
Struct | TitleCase | `struct Texture2D`, `struct Material`
|
||||
Struct members |lowerCase | `texture.width`, `color.r`
|
||||
Functions | TitleCase | `InitWindow()`, `LoadImageFromMemory()`
|
||||
Functions params | lowerCase | `width`, `height`
|
||||
Ternary Operator | (condition)? result1 : result2 | `printf("Value is 0: %s", (value == 0)? "yes" : "no");`
|
||||
|
||||
Some other conventions to follow:
|
||||
- **ALWAYS** initialize all defined variables.
|
||||
- **Do not use TABS**, use 4 spaces instead.
|
||||
- Avoid trailing spaces, please, avoid them
|
||||
- Control flow statements always are followed **by a space**:
|
||||
```c
|
||||
if (condition) value = 0;
|
||||
|
||||
while (!WindowShouldClose())
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
for (int i = 0; i < NUM_VALUES; i++) printf("%i", i);
|
||||
|
||||
// Be careful with the switch formatting!
|
||||
switch (value)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
|
||||
} break;
|
||||
case 2: break;
|
||||
default: break;
|
||||
}
|
||||
```
|
||||
- All conditions checks are **always between parenthesis** but not boolean values:
|
||||
```c
|
||||
if ((value > 1) && (value < 50) && valueActive))
|
||||
{
|
||||
|
||||
}
|
||||
```
|
||||
- When dealing with braces or curly brackets, open-close them in aligned mode:
|
||||
```c
|
||||
void SomeFunction()
|
||||
{
|
||||
// TODO: Do something here!
|
||||
}
|
||||
```
|
||||
|
||||
**If proposing new functions, please try to use a clear naming for function-name and functions-parameters, in case of doubt, open an issue for discussion.**
|
||||
|
||||
## Files and Directories Naming Conventions
|
||||
|
||||
- Directories will be named using `snake_case`: `resources/models`, `resources/fonts`
|
||||
|
||||
- Files will be named using `snake_case`: `main_title.png`, `cubicmap.png`, `sound.wav`
|
||||
|
||||
_NOTE: Avoid any space or special character in the files/dir naming!_
|
||||
|
||||
## Games/Examples Directories Organization Conventions
|
||||
|
||||
- Data files should be organized by context and usage in the game, think about the loading requirements for data and put all the resources that need to be loaded at the same time together.
|
||||
- Use descriptive names for the files, it would be perfect if just reading the name of the file, it was possible to know what is that file and where fits in the game.
|
||||
- Here it is an example, note that some resources require to be loaded all at once while other require to be loaded only at initialization (gui, font).
|
||||
|
||||
```
|
||||
resources/audio/fx/long_jump.wav
|
||||
resources/audio/music/main_theme.ogg
|
||||
resources/screens/logo/logo.png
|
||||
resources/screens/title/title.png
|
||||
resources/screens/gameplay/background.png
|
||||
resources/characters/player.png
|
||||
resources/characters/enemy_slime.png
|
||||
resources/common/font_arial.ttf
|
||||
resources/common/gui.png
|
||||
```
|
||||
|
54
HISTORY.md
@@ -33,7 +33,7 @@ Lots of code changes and lot of testing have concluded in this amazing new rayli
|
||||
notes on raylib 1.2
|
||||
-------------------
|
||||
|
||||
On September 2014, after 5 month of raylib 1.1 release, it comes raylib 1.2. Again, this version presents a complete internal redesign of [core](https://github.com/raysan5/raylib/blob/master/src/core.c) module to support two new platforms: [Android](http://www.android.com/) and [Raspberry Pi](http://www.raspberrypi.org/).
|
||||
On September 2014, after 5 month of raylib 1.1 release, it comes raylib 1.2. Again, this version presents a complete internal redesign of [core](https://github.com/raysan5/raylib/blob/master/src/rcore.c) module to support two new platforms: [Android](http://www.android.com/) and [Raspberry Pi](http://www.raspberrypi.org/).
|
||||
|
||||
It's been some month of really hard work to accomodate raylib to those new platforms while keeping it easy for the users. On Android, raylib manages internally the activity cicle, as well as the inputs; on Raspberry Pi, a complete raw input system has been written from scratch.
|
||||
|
||||
@@ -54,9 +54,9 @@ On September 2015, after 1 year of raylib 1.2 release, arrives raylib 1.3. This
|
||||
|
||||
- Textures module has grown to support most of the internal texture formats available in OpenGL (RGB565, RGB888, RGBA5551, RGBA4444, etc.), including compressed texture formats (DXT, ETC1, ETC2, ASTC, PVRT); raylib 1.3 can load .dds, .pkm, .ktx, .astc and .pvr files.
|
||||
|
||||
- A brand new [camera](https://github.com/raysan5/raylib/blob/master/src/camera.c) module offers to the user multiple preconfigured ready-to-use camera systems (free camera, 1st person, 3rd person). Camera modes are very easy to use, just check examples: [core_3d_camera_free.c](https://github.com/raysan5/raylib/blob/master/examples/core_3d_camera_free.c) and [core_3d_camera_first_person.c](https://github.com/raysan5/raylib/blob/master/examples/core_3d_camera_first_person.c).
|
||||
- A brand new [camera](https://github.com/raysan5/raylib/blob/master/src/rcamera.c) module offers to the user multiple preconfigured ready-to-use camera systems (free camera, 1st person, 3rd person). Camera modes are very easy to use, just check examples: [core_3d_camera_free.c](https://github.com/raysan5/raylib/blob/master/examples/core_3d_camera_free.c) and [core_3d_camera_first_person.c](https://github.com/raysan5/raylib/blob/master/examples/core_3d_camera_first_person.c).
|
||||
|
||||
- New [gestures](https://github.com/raysan5/raylib/blob/master/src/gestures.h) module simplifies gestures detection on Android and HTML5 programs.
|
||||
- New [gestures](https://github.com/raysan5/raylib/blob/master/src/rgestures.h) module simplifies gestures detection on Android and HTML5 programs.
|
||||
|
||||
- [raygui](https://github.com/raysan5/raylib/blob/master/src/raygui.h), the new immediate-mode GUI module offers a set of functions to create simple user interfaces, primary intended for tools development. It's still in experimental state but already fully functional.
|
||||
|
||||
@@ -77,7 +77,7 @@ On February 2016, after 4 months of raylib 1.3 release, it comes raylib 1.4. For
|
||||
|
||||
- [raymath](https://github.com/raysan5/raylib/blob/master/src/raymath.h) module has been reviewed; some bugs have been solved and the module has been converted to a header-only file for easier portability, optionally, functions can also be used as inline.
|
||||
|
||||
- [gestures](https://github.com/raysan5/raylib/blob/master/src/gestures.c) module has redesigned and simplified, now it can process touch events from any source, including mouse. This way, gestures system can be used on any platform providing an unified way to work with inputs and allowing the user to create multiplatform games with only one source code.
|
||||
- [gestures](https://github.com/raysan5/raylib/blob/master/src/rgestures.c) module has redesigned and simplified, now it can process touch events from any source, including mouse. This way, gestures system can be used on any platform providing an unified way to work with inputs and allowing the user to create multiplatform games with only one source code.
|
||||
|
||||
- Raspberry Pi input system has been redesigned to better read raw inputs using generic Linux event handlers (keyboard:`stdin`, mouse:`/dev/input/mouse0`, gamepad:`/dev/input/js0`). Gamepad support has also been added (experimental).
|
||||
|
||||
@@ -106,7 +106,7 @@ On July 2016, after 5 months of raylib 1.4 release, arrives raylib 1.5. This new
|
||||
|
||||
- Audio chiptunese support and mixing channels: Added support for module audio music (.xm, .mod) loading and playing. Multiple mixing channels are now also supported. All this features thanks to the amazing work of @kd7tck.
|
||||
|
||||
Other additions include a [2D camera system](https://github.com/raysan5/raylib/blob/master/examples/core_2d_camera.c), render textures for offline render (and most comprehensive [postprocessing](https://github.com/raysan5/raylib/blob/master/examples/shaders_postprocessing.c)) or support for legacy OpenGL 2.1 on desktop platforms.
|
||||
Other additions include a [2D camera system](https://github.com/raysan5/raylib/blob/master/examples/core_2d_rcamera.c), render textures for offline render (and most comprehensive [postprocessing](https://github.com/raysan5/raylib/blob/master/examples/shaders_postprocessing.c)) or support for legacy OpenGL 2.1 on desktop platforms.
|
||||
|
||||
This new version is so massive that is difficult to list all the improvements, most of raylib modules have been reviewed and [rlgl](https://github.com/raysan5/raylib/blob/master/src/rlgl.c) module has been completely redesigned to accomodate to new material-lighting systems and stereo rendering. You can check [CHANGELOG](https://github.com/raysan5/raylib/blob/master/CHANGELOG) file for a more detailed list of changes.
|
||||
|
||||
@@ -255,8 +255,8 @@ It has been **10 months of improvements** to create the best raylib ever.
|
||||
|
||||
Welcome to **raylib 3.0**.
|
||||
|
||||
notes on raylib 3.5
|
||||
-------------------
|
||||
notes on raylib 3.5 - 7th Anniversary Edition
|
||||
---------------------------------------------
|
||||
|
||||
It's December 25th... this crazy 2020 is about to finish and finally the holidays gave me some time to put a new version of raylib. It's been **9 months since last release** and last November raylib become 7 years old... I was not able to release this new version back then but here it is. Many changes and improvements have happened in those months and, even, last August, raylib was awarded with an [Epic Megagrant](https://www.unrealengine.com/en-US/blog/epic-megagrants-fall-2020-update)! Bindings list kept growing to [+50 programming languages](BINDINGS.md) and some new platforms have been supported. Let's see this new version details:
|
||||
|
||||
@@ -322,3 +322,43 @@ Highlights for `raylib 3.7`:
|
||||
Beside those key changes, many functions have been reviewed with improvements and bug fixes, many of them contributed by the community! Thanks! And again, this release sets a **new milestone for raylib library**. Make sure to check [CHANGELOG](CHANGELOG) for detailed list of changes! Hope you enjoy this new raylib installment!
|
||||
|
||||
Happy **gamedev/tools/graphics** programming! :)
|
||||
|
||||
notes on raylib 4.0 - 8th Anniversary Edition
|
||||
---------------------------------------------
|
||||
|
||||
It's been about 6 months since last raylib release and it's been **8 years since I started with this project**, what an adventure! It's time for a new release: `raylib 4.0`, **the biggest release ever** and an inflexion point for the library. Many hours have been put in this release to make it special, **many library details have been polished**: syntax, naming conventions, code comments, functions descriptions, log outputs... Almost all the issues have been closed (only 3 remain open at the moment of this writing) and some amazing new features have been added. I expect this **`raylib 4.0`** to be a long term version (LTS), stable and complete enough for any new graphic/game/tool application development.
|
||||
|
||||
Let's start with some numbers:
|
||||
|
||||
- **+130** closed issues (for a TOTAL of **+1030**!)
|
||||
- **+550** commits since previous RELEASE
|
||||
- **+20** functions ADDED to raylib API
|
||||
- **+60** functions ADDED to rlgl API
|
||||
- **+40** functions RENAMED/REVIEWED/REDESIGNED
|
||||
- **+60** new contributors (for a TOTAL of **+275**!)
|
||||
|
||||
Highlights for `raylib 4.0`:
|
||||
|
||||
- **Naming consistency and coherency**: `raylib` API has been completely reviewed to be consistent on naming conventions for data structures and functions, comments and descriptions have been reviewed, also the sintax of many symbols for consistency; some functions and structs have been renamed (i.e. `struct CharInfo` to `struct GlyphInfo`). Output log messages have been also improved to show more info to the users. Several articles have been writen in this process: [raylib_syntax analysis](https://github.com/raysan5/raylib/wiki/raylib-syntax-analysis) and [raylib API usage analysis](https://gist.github.com/raysan5/7c0c9fff1b6c19af24bb4a51b7383f1e). In general, a big polishment of the library to make it more consistent and coherent.
|
||||
|
||||
- **Event Automation System**: This new _experimental_ feature has been added for future usage, it allows to **record input events and re-play them automatically**. This feature could be very useful to automatize examples testing but also for tutorials with assited game playing, in-game cinematics, speedruns, AI playing and more! Note this feature is still experimental.
|
||||
|
||||
- **Custom game-loop control**: As requested by some advance users, **the game-loop control can be exposed** compiling raylib with the config flag: `SUPPORT_CUSTOM_FRAME_CONTROL`. It's intended for advance users that want to control the events polling and also the timming mechanisms of their games.
|
||||
|
||||
- [**`rlgl 4.0`**](https://github.com/raysan5/raylib/blob/master/src/rlgl.h): This module has been completely **decoupled from platform layer** and raylib, now `rlgl` single-file header-only library only depends on the multiple OpenGL backends supported, even the dependency on `raymath` has been removed. Additionally, **support for OpenGL 4.3** has been added, supporting compute shaders and Shader Storage Buffer Objects (SSBO). Now `rlgl` can be used as a complete standalone portable library to wrap several OpenGL version and providing **a simple and easy-to-use pseudo-OpenGL immediate-mode API**.
|
||||
|
||||
- [**`raymath 1.5`**](https://github.com/raysan5/raylib/blob/master/src/raymath.h): This module has been reviewed and some new conventions have been adopted to make it **more portable and self-contained**:
|
||||
- Functions are self-contained, no function use other raymath function inside, required code is directly re-implemented
|
||||
- Functions input parameters are always received by value
|
||||
- Functions use always a "result" variable for return
|
||||
- Angles are always in radians (`DEG2RAD`/`RAD2DEG` macros provided for convenience)
|
||||
|
||||
- [**`raygui 3.0`**](https://github.com/raysan5/raygui): The **official raylib immediate-mode gui library** (included in `raylib/src/extras`) has been updated to a new version, embedding the icons collection and adding mulstiple improvements. It has been simplified and constrained for a better focus on its task: provide a simple and easy-to-use immediate-mode-gui library for small tools development.
|
||||
|
||||
- [**`raylib_parser`**](https://github.com/raysan5/raylib/tree/master/parser): Added **new tool to parse `raylib.h`** and tokenize its enums, structs and functions, extracting all required info (name, params, descriptions...) into custom output formats (TXT, XML, JSON...) for further processing. This tool is specially useful to **automatize bindings generation**. Hopefully, this tool will make life easier to binding creators to update their bindings for raylib 4.0 or adding new ones!
|
||||
|
||||
- **Zig and Odin official support for raylib**: Those two new amazing programming languages are officially supporting raylib, `Zig` lists raylib as an [official example for C interoperatibility](https://ziglang.org/learn/samples/#c-interoperability) and Odin [officially supports raylib as a vendor library](https://github.com/odin-lang/Odin/tree/master/vendor/raylib). Both languages also have several bingings to raylib. Additionally, Zig build system supported has been added to compile raylib library and examples.
|
||||
|
||||
Those are some of the key features for this new release but actually there is way more! **Support for `VOX` ([MagikaVoxel](https://ephtracy.github.io/)) 3d model format** has been added, **new [raylib_game_template](https://github.com/raysan5/raylib-game-template)** repo shared, **new `EncodeDataBase64()` and `DecodeDataBase64()` functions** added, **improved HiDPI support**, new `DrawTextPro()` with support for text rotations, completely **reviewed `glTF` models loading**, added **`SeekMusicStream()` for music seeking**, many new examples and +20 examples reviewed... **hundreds of improvements and bug fixes**! Make sure to check [CHANGELOG](CHANGELOG) for a detailed list of changes!
|
||||
|
||||
Undoubtely, **this is the best raylib ever**. Enjoy gamedev/tools/graphics programming! :)
|
||||
|
36
README.md
@@ -4,7 +4,7 @@
|
||||
|
||||
raylib is highly inspired by Borland BGI graphics lib and by XNA framework and it's specially well suited for prototyping, tooling, graphical applications, embedded systems and education.
|
||||
|
||||
*NOTE for ADVENTURERS: raylib is a programming library to enjoy videogames programming; no fancy interface, no visual helpers, no auto-debugging... just coding in the most pure spartan-programmers way.*
|
||||
*NOTE for ADVENTURERS: raylib is a programming library to enjoy videogames programming; no fancy interface, no visual helpers, no debug button... just coding in the most pure spartan-programmers way.*
|
||||
|
||||
Ready to learn? Jump to [code examples!](http://www.raylib.com/examples.html)
|
||||
|
||||
@@ -14,7 +14,7 @@ Ready to learn? Jump to [code examples!](http://www.raylib.com/examples.html)
|
||||
|
||||
[](https://github.com/raysan5/raylib/graphs/contributors)
|
||||
[](https://github.com/raysan5/raylib/releases)
|
||||
[](https://github.com/raysan5/raylib/commits/master)
|
||||
[](https://github.com/raysan5/raylib/commits/master)
|
||||
[](LICENSE)
|
||||
|
||||
[](https://discord.gg/raylib)
|
||||
@@ -37,13 +37,13 @@ features
|
||||
- **NO external dependencies**, all required libraries are [bundled into raylib](https://github.com/raysan5/raylib/tree/master/src/external)
|
||||
- Multiple platforms supported: **Windows, Linux, MacOS, RPI, Android, HTML5... and more!**
|
||||
- Written in plain C code (C99) in PascalCase/camelCase notation
|
||||
- Hardware accelerated with OpenGL (**1.1, 2.1, 3.3 or ES 2.0**)
|
||||
- Hardware accelerated with OpenGL (**1.1, 2.1, 3.3, 4.3 or ES 2.0**)
|
||||
- **Unique OpenGL abstraction layer** (usable as standalone module): [rlgl](https://github.com/raysan5/raylib/blob/master/src/rlgl.h)
|
||||
- Multiple **Fonts** formats supported (TTF, XNA fonts, AngelCode fonts)
|
||||
- Multiple texture formats supported, including **compressed formats** (DXT, ETC, ASTC)
|
||||
- **Full 3D support**, including 3D Shapes, Models, Billboards, Heightmaps and more!
|
||||
- Flexible Materials system, supporting classic maps and **PBR maps**
|
||||
- **Animated 3D models** supported (skeletal bones animation) (IQM, glTF)
|
||||
- **Animated 3D models** supported (skeletal bones animation) (IQM)
|
||||
- Shaders support, including model and **postprocessing** shaders.
|
||||
- **Powerful math module** for Vector, Matrix and Quaternion operations: [raymath](https://github.com/raysan5/raylib/blob/master/src/raymath.h)
|
||||
- Audio loading and playing with streaming support (WAV, OGG, MP3, FLAC, XM, MOD)
|
||||
@@ -52,11 +52,9 @@ features
|
||||
- Bindings to [+50 programming languages](https://github.com/raysan5/raylib/blob/master/BINDINGS.md)!
|
||||
- **Free and open source**.
|
||||
|
||||
raylib uses internally some libraries for window/graphics/inputs management and also to support different fileformats loading, all those libraries are embedded with raylib and are available in [src/external](https://github.com/raysan5/raylib/tree/master/src/external) directory. Check [raylib dependencies](https://github.com/raysan5/raylib/wiki/raylib-dependencies) on [raylib Wiki](https://github.com/raysan5/raylib/wiki) for a detailed list.
|
||||
|
||||
basic example
|
||||
--------------
|
||||
This is a basic raylib example, it creates a window and it draws the text `"Congrats! You created your first window!"` in the middle of the screen. Check this example [running live on web here](https://www.raylib.com/examples/web/core/loader.html?name=core_basic_window).
|
||||
This is a basic raylib example, it creates a window and it draws the text `"Congrats! You created your first window!"` in the middle of the screen. Check this example [running live on web here](https://www.raylib.com/examples/core/loader.html?name=core_basic_window).
|
||||
```c
|
||||
#include "raylib.h"
|
||||
|
||||
@@ -81,30 +79,10 @@ int main(void)
|
||||
build and installation
|
||||
----------------------
|
||||
|
||||
raylib binary releases for Windows, Linux and macOS are available at the [Github Releases page](https://github.com/raysan5/raylib/releases).
|
||||
raylib binary releases for Windows, Linux, macOS, Android and HTML5 are available at the [Github Releases page](https://github.com/raysan5/raylib/releases).
|
||||
|
||||
raylib is also available via multiple [package managers](https://github.com/raysan5/raylib/issues/613) on multiple OS distributions.
|
||||
|
||||
#### Installing and building raylib via vcpkg
|
||||
|
||||
You can download and install raylib using the [vcpkg](https://github.com/Microsoft/vcpkg) dependency manager:
|
||||
|
||||
git clone https://github.com/Microsoft/vcpkg.git
|
||||
cd vcpkg
|
||||
./bootstrap-vcpkg.sh
|
||||
./vcpkg integrate install
|
||||
vcpkg install raylib
|
||||
|
||||
*The raylib port in vcpkg is kept up to date by Microsoft team members and community contributors. If the version is out of date, please [create an issue or pull request](https://github.com/Microsoft/vcpkg) on the vcpkg repository.*
|
||||
|
||||
#### Installing and building raylib via conan
|
||||
|
||||
You can download and install raylib using the [conan](https://conan.io) dependency manager:
|
||||
|
||||
https://docs.conan.io/en/latest/getting_started.html
|
||||
|
||||
*The raylib recipe in conan is kept up to date by conan team members and community contributors. If the version is out of date, please [create an issue or pull request](https://github.com/conan-io/conan-center-index) on the conan-center-index repository.*
|
||||
|
||||
#### Installing and building raylib on multiple platforms
|
||||
|
||||
[raylib Wiki](https://github.com/raysan5/raylib/wiki#development-platforms) contains detailed instructions on building and usage on multiple platforms.
|
||||
@@ -159,3 +137,5 @@ license
|
||||
-------
|
||||
|
||||
raylib is licensed under an unmodified zlib/libpng license, which is an OSI-certified, BSD-like license that allows static linking with closed source software. Check [LICENSE](LICENSE) for further details.
|
||||
|
||||
raylib uses internally some libraries for window/graphics/inputs management and also to support different fileformats loading, all those libraries are embedded with and are available in [src/external](https://github.com/raysan5/raylib/tree/master/src/external) directory. Check [raylib dependencies LICENSES](https://github.com/raysan5/raylib/wiki/raylib-dependencies) on raylib Wiki for details.
|
||||
|
28
ROADMAP.md
@@ -1,19 +1,27 @@
|
||||
roadmap
|
||||
-------
|
||||
# raylib roadmap
|
||||
|
||||
Here it is a wish-list with features and ideas to improve the library. Note that features listed here are usually long term additions for the library. Current version of raylib is complete and functional but there is a lot of room for improvement.
|
||||
Here it is a wish-list with features and ideas to improve the library. Note that features listed here are usually long term improvements or just describe a route to follow for the library. There are also some additional places to look for raylib improvements of ideas:
|
||||
|
||||
Also note that [raylib source code](https://github.com/raysan5/raylib/tree/master/src) has multiple *TODO* comments around code with pending things to review or improve. Check also [GitHub Issues](https://github.com/raysan5/raylib/issues) for further details!
|
||||
- [GitHub Issues](https://github.com/raysan5/raylib/issues) has several open issues for possible improvements or bugs to fix.
|
||||
- [raylib source code](https://github.com/raysan5/raylib/tree/master/src) has multiple *TODO* comments around code with pending things to review or improve.
|
||||
- [raylib wishlist](https://github.com/raysan5/raylib/discussions/1502) is open to everyone to ask for improvements, feel free to check and comment.
|
||||
|
||||
There is also a [Discussions Wishlist](https://github.com/raysan5/raylib/discussions/1502) open to everyone, feel free to check and comment.
|
||||
_Current version of raylib is complete and functional but, as always, there is lot of room for improvement._
|
||||
|
||||
**raylib 4.x**
|
||||
- [ ] Redesign camera module (more flexible) ([#1143](https://github.com/raysan5/raylib/issues/1143))
|
||||
- [ ] Redesign gestures system, improve touch inputs management
|
||||
- [ ] Better documentation and improved examples
|
||||
- [ ] Focus on HTML5 and embedded platforms
|
||||
- [ ] Additional support libraries: [raygui](https://github.com/raysan5/raygui), [rres](https://github.com/raysan5/rres)...
|
||||
|
||||
**raylib 4.0**
|
||||
- [ ] Network module (UDP): `rnet` ([#753](https://github.com/raysan5/raylib/issues/753))
|
||||
- [ ] Custom raylib resource packer: `rres` ([link](https://github.com/raysan5/rres))
|
||||
- [ ] Basic CPU/GPU stats system (memory, draws, time...) ([#1295](https://github.com/raysan5/raylib/issues/1295))
|
||||
- [ ] Software rendering backend (avoiding OpenGL) ([#1370](https://github.com/raysan5/raylib/issues/1370))
|
||||
- [ ] Redesigned camera module (more flexible) ([#1143](https://github.com/raysan5/raylib/issues/1143))
|
||||
- [x] Improved consistency and coherency in raylib API
|
||||
- [x] Continuous Deployment using GitHub Actions
|
||||
- [x] rlgl improvements for standalone usage (avoid raylib coupling)
|
||||
- Basic CPU/GPU stats system (memory, draws, time...) ([#1295](https://github.com/raysan5/raylib/issues/1295)) - _DISCARDED_
|
||||
- Software rendering backend (avoiding OpenGL) ([#1370](https://github.com/raysan5/raylib/issues/1370)) - _DISCARDED_
|
||||
- Network module (UDP): `rnet` ([#753](https://github.com/raysan5/raylib/issues/753)) - _DISCARDED_ - Use [nbnet](https://github.com/nathhB/nbnet).
|
||||
|
||||
**raylib 3.0**
|
||||
- [x] Custom memory allocators support
|
||||
|
39
SPONSORS.md
@@ -1,21 +1,14 @@
|
||||
## raylib GitHub Sponsors
|
||||
|
||||
### Current raylib GitHub Sponsors
|
||||
### Current raylib GitHub Sponsors (raylib 4.0 release)
|
||||
|
||||
The following people is currently [**sponsoring raylib**](https://github.com/sponsors/raysan5) with a generous donation to allow improving and growing the project!
|
||||
|
||||
Note that Sponsors donations vary between sponsors, I just decided not to make any distinction while listing them.
|
||||
The following people are currently [**sponsoring raylib**](https://github.com/sponsors/raysan5) with a generous donation to allow improving and growing the project!
|
||||
|
||||
- Eric J. ([@ProfJski](https://github.com/ProfJski))
|
||||
- devdad ([@devdad](https://github.com/devdad))
|
||||
- Zach Geis ([@zacgeis](https://github.com/zacgeis))
|
||||
- minirop ([@minirop](https://github.com/minirop))
|
||||
- Daniel Gómez ([@Koocachookies](https://github.com/Koocachookies))
|
||||
- Sergio ([@anidealgift](https://github.com/anidealgift))
|
||||
- Marc Agüera ([@maguera93](https://github.com/maguera93))
|
||||
- Pau Fernández ([@pauek](https://github.com/pauek))
|
||||
- Snowminx ([@Gamerfiend](https://github.com/Gamerfiend))
|
||||
- NimbusFox ([@NimbusFox](https://github.com/NimbusFox))
|
||||
- Robin Mattheussen ([@romatthe](https://github.com/romatthe))
|
||||
- Grant Haywood ([@cinterloper](https://github.com/cinterloper))
|
||||
- Terry Nguyen ([@terrehbyte](https://github.com/terrehbyte))
|
||||
@@ -25,9 +18,17 @@ Note that Sponsors donations vary between sponsors, I just decided not to make a
|
||||
- cob ([@majorcob](https://github.com/majorcob))
|
||||
- Samuel Batista ([@gamedevsam](https://github.com/gamedevsam))
|
||||
- Merlyn Morgan-Graham ([@kavika13](https://github.com/kavika13))
|
||||
- Toby4213 ([@Toby4213](https://github.com/Toby4213))
|
||||
- linus ([@hochbaum](https://github.com/hochbaum))
|
||||
|
||||
- Níckolas Daniel da Silva ([@nawarian](https://github.com/nawarian) - [thephp.website](https://thephp.website/))
|
||||
- kenzie ([@sme-ek](https://github.com/sme-ek))
|
||||
- Allan Regush ([@AllanRegush](https://github.com/AllanRegush))
|
||||
- Jeffery Myers ([@JeffM2501](https://github.com/ProfJski))
|
||||
- Ryan Roden-Corrent ([@rcorre](https://github.com/ProfJski))
|
||||
- michaelfiber ([@michaelfiber](https://github.com/ProfJski))
|
||||
- Nikhilesh S ([@nikki93](https://github.com/ProfJski))
|
||||
- kevinabraun ([@kevinabraun](https://github.com/ProfJski))
|
||||
- Matthew Owens ([@MatthewOwens](https://github.com/ProfJski))
|
||||
- Tim Eilers ([@eilerstim](https://github.com/ProfJski))
|
||||
|
||||
### Past raylib GitHub Sponsors
|
||||
|
||||
@@ -48,10 +49,20 @@ The following people has **sponsored raylib** in the past, allowing the project
|
||||
- James Ghawaly ([@jghawaly](https://github.com/jghawaly))
|
||||
- jack ([@Jack-Ji](https://github.com/Jack-Ji))
|
||||
- Guido Offermans ([@jghawaly](https://github.com/GuidoOffermans))
|
||||
- devdad ([@devdad](https://github.com/devdad))
|
||||
- Pau Fernández ([@pauek](https://github.com/pauek))
|
||||
- Sergio ([@anidealgift](https://github.com/anidealgift))
|
||||
- Snowminx ([@Gamerfiend](https://github.com/Gamerfiend))
|
||||
- NimbusFox ([@NimbusFox](https://github.com/NimbusFox))
|
||||
- Shylie ([@Shylie](https://github.com/Shylie))
|
||||
- Livio Dal Maso ([@Humeur](https://github.com/Humeur))
|
||||
- Diego Vaccher ([@denny0754](https://github.com/denny0754))
|
||||
- Ricardo Alcantara ([@ricardoalcantara](https://github.com/ricardoalcantara))
|
||||
- Toby4213 ([@Toby4213](https://github.com/Toby4213))
|
||||
|
||||
### Notes for Current/Past raylib Sponsor
|
||||
|
||||
- **If you are not on the list, feel free to send a PR to add you if desired.**
|
||||
- **If you want your personal webpage listed along your GitHub account, feel free to send a PR to add it.**
|
||||
- **If you prefer not to listed in this list, feel free to send a PR to remove it.**
|
||||
- If you are not on the list, feel free to send a PR to be added (if desired).
|
||||
- If you want your personal webpage or project listed, feel free to send a PR to be added.
|
||||
- If you prefer not to be in this list, feel free to send a PR to be remove.
|
||||
|
||||
|
@@ -1,8 +1,8 @@
|
||||
|
||||
if(USE_EXTERNAL_GLFW STREQUAL "ON")
|
||||
find_package(glfw3 3.2.1 REQUIRED)
|
||||
find_package(glfw3 3.3.3 REQUIRED)
|
||||
elseif(USE_EXTERNAL_GLFW STREQUAL "IF_POSSIBLE")
|
||||
find_package(glfw3 3.2.1 QUIET)
|
||||
find_package(glfw3 3.3.3 QUIET)
|
||||
endif()
|
||||
if (glfw3_FOUND)
|
||||
set(LIBS_PRIVATE ${LIBS_PRIVATE} glfw)
|
||||
@@ -26,7 +26,7 @@ if(NOT glfw3_FOUND AND NOT USE_EXTERNAL_GLFW STREQUAL "ON" AND "${PLATFORM}" MAT
|
||||
set(BUILD_SHARED_LIBS ${WAS_SHARED} CACHE BOOL " " FORCE)
|
||||
unset(WAS_SHARED)
|
||||
|
||||
list(APPEND raylib_sources $<TARGET_OBJECTS:glfw_objlib>)
|
||||
list(APPEND raylib_sources $<TARGET_OBJECTS:glfw>)
|
||||
include_directories(BEFORE SYSTEM external/glfw/include)
|
||||
else()
|
||||
MESSAGE(STATUS "Using external GLFW")
|
||||
|
@@ -14,7 +14,8 @@ if (${PLATFORM} MATCHES "Desktop")
|
||||
endif ()
|
||||
elseif (WIN32)
|
||||
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
|
||||
set(LIBS_PRIVATE ${LIBS_PRIVATE} winmm)
|
||||
find_package(OpenGL QUIET)
|
||||
set(LIBS_PRIVATE ${OPENGL_LIBRARIES} winmm)
|
||||
else ()
|
||||
find_library(pthread NAMES pthread)
|
||||
find_package(OpenGL QUIET)
|
||||
|
@@ -73,7 +73,6 @@ if (${PLATFORM} MATCHES "Android")
|
||||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/core/core_world_screen.c)
|
||||
|
||||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/models/models_mesh_picking.c)
|
||||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/models/models_material_pbr.c)
|
||||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/models/models_cubicmap.c)
|
||||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/models/models_skybox.c)
|
||||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/models/models_mesh_picking.c)
|
||||
@@ -86,6 +85,8 @@ if (${PLATFORM} MATCHES "Android")
|
||||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/models/models_obj_viewer.c)
|
||||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/models/models_animation.c)
|
||||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/models/models_first_person_maze.c)
|
||||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/models/models_magicavoxel_loading.c)
|
||||
|
||||
|
||||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/shaders/shaders_custom_uniform.c)
|
||||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/shaders/shaders_model_shader.c)
|
||||
|
@@ -25,7 +25,7 @@
|
||||
|
||||
# Define required raylib variables
|
||||
PROJECT_NAME ?= raylib_examples
|
||||
RAYLIB_VERSION ?= 3.5.0
|
||||
RAYLIB_VERSION ?= 4.0.0
|
||||
RAYLIB_PATH ?= ..
|
||||
|
||||
# Define default options
|
||||
@@ -126,8 +126,8 @@ ifeq ($(PLATFORM),PLATFORM_WEB)
|
||||
EMSDK_PATH ?= C:/emsdk
|
||||
EMSCRIPTEN_PATH ?= $(EMSDK_PATH)/upstream/emscripten
|
||||
CLANG_PATH = $(EMSDK_PATH)/upstream/bin
|
||||
PYTHON_PATH = $(EMSDK_PATH)/python/3.7.4-pywin32_64bit
|
||||
NODE_PATH = $(EMSDK_PATH)/node/12.18.1_64bit/bin
|
||||
PYTHON_PATH = $(EMSDK_PATH)/python/3.9.2-1_64bit
|
||||
NODE_PATH = $(EMSDK_PATH)/node/14.15.5_64bit/bin
|
||||
export PATH = $(EMSDK_PATH);$(EMSCRIPTEN_PATH);$(CLANG_PATH);$(NODE_PATH);$(PYTHON_PATH);C:\raylib\MinGW\bin:$$(PATH)
|
||||
endif
|
||||
|
||||
@@ -185,6 +185,12 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
||||
MAKE = mingw32-make
|
||||
endif
|
||||
endif
|
||||
ifeq ($(PLATFORM),PLATFORM_ANDROID)
|
||||
MAKE = mingw32-make
|
||||
endif
|
||||
ifeq ($(PLATFORM),PLATFORM_WEB)
|
||||
MAKE = mingw32-make
|
||||
endif
|
||||
|
||||
# Define compiler flags:
|
||||
# -O1 defines optimization level
|
||||
@@ -195,7 +201,7 @@ endif
|
||||
# -std=gnu99 defines C language mode (GNU C from 1999 revision)
|
||||
# -Wno-missing-braces ignore invalid warning (GCC bug 53119)
|
||||
# -D_DEFAULT_SOURCE use with -std=c99 on Linux and PLATFORM_WEB, required for timespec
|
||||
CFLAGS += -Wall -std=c99 -D_DEFAULT_SOURCE -Wno-missing-braces
|
||||
CFLAGS += -Wall -std=c99 -D_DEFAULT_SOURCE -Wno-missing-braces -Wunused-result
|
||||
|
||||
ifeq ($(BUILD_MODE),DEBUG)
|
||||
CFLAGS += -g
|
||||
@@ -229,36 +235,10 @@ endif
|
||||
ifeq ($(PLATFORM),PLATFORM_DRM)
|
||||
CFLAGS += -std=gnu99 -DEGL_NO_X11
|
||||
endif
|
||||
ifeq ($(PLATFORM),PLATFORM_WEB)
|
||||
# -Os # size optimization
|
||||
# -O2 # optimization level 2, if used, also set --memory-init-file 0
|
||||
# -s USE_GLFW=3 # Use glfw3 library (context/input management)
|
||||
# -s ALLOW_MEMORY_GROWTH=1 # to allow memory resizing -> WARNING: Audio buffers could FAIL!
|
||||
# -s TOTAL_MEMORY=16777216 # to specify heap memory size (default = 16MB)
|
||||
# -s USE_PTHREADS=1 # multithreading support
|
||||
# -s WASM=0 # disable Web Assembly, emitted by default
|
||||
# -s ASYNCIFY # lets synchronous C/C++ code interact with asynchronous JS
|
||||
# -s FORCE_FILESYSTEM=1 # force filesystem to load/save files data
|
||||
# -s ASSERTIONS=1 # enable runtime checks for common memory allocation errors (-O1 and above turn it off)
|
||||
# --profiling # include information for code profiling
|
||||
# --memory-init-file 0 # to avoid an external memory initialization code file (.mem)
|
||||
# --preload-file resources # specify a resources folder for data compilation
|
||||
# --source-map-base # allow debugging in browser with source map
|
||||
CFLAGS += -s USE_GLFW=3 -s ASYNCIFY -s TOTAL_MEMORY=67108864 -s FORCE_FILESYSTEM=1 $(dir $<)resources@resources
|
||||
|
||||
# NOTE: Simple raylib examples are compiled to be interpreter with asyncify, that way,
|
||||
# we can compile same code for ALL platforms with no change required, but, working on bigger
|
||||
# projects, code needs to be refactored to avoid a blocking while() loop, moving Update and Draw
|
||||
# logic to a self contained function: UpdateDrawFrame(), check core_basic_window_web.c for reference.
|
||||
|
||||
# Define a custom shell .html and output extension
|
||||
CFLAGS += --shell-file $(RAYLIB_PATH)/src/shell.html
|
||||
EXT = .html
|
||||
endif
|
||||
|
||||
# Define include paths for required headers
|
||||
# NOTE: Several external required libraries (stb and others)
|
||||
INCLUDE_PATHS = -I. -I$(RAYLIB_PATH)/src -I$(RAYLIB_PATH)/src/external
|
||||
# NOTE: Some external/extras libraries could be required (stb, physac, easings...)
|
||||
INCLUDE_PATHS = -I. -I$(RAYLIB_PATH)/src -I$(RAYLIB_PATH)/src/external -I$(RAYLIB_PATH)/src/extras
|
||||
|
||||
# Define additional directories containing required header files
|
||||
ifeq ($(PLATFORM),PLATFORM_RPI)
|
||||
@@ -277,7 +257,7 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
||||
INCLUDE_PATHS += -I/usr/local/include
|
||||
endif
|
||||
ifeq ($(PLATFORM_OS),LINUX)
|
||||
INCLUDE_PATHS = -I$(RAYLIB_H_INSTALL_PATH) -I. -I$(RAYLIB_PATH)/src -I$(RAYLIB_PATH)/src/external
|
||||
INCLUDE_PATHS += -I$(RAYLIB_H_INSTALL_PATH)
|
||||
endif
|
||||
endif
|
||||
|
||||
@@ -303,7 +283,32 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
||||
LDFLAGS = -L. -L$(RAYLIB_INSTALL_PATH) -L$(RAYLIB_RELEASE_PATH) -L$(RAYLIB_PATH)
|
||||
endif
|
||||
endif
|
||||
ifeq ($(PLATFORM),PLATFORM_WEB)
|
||||
# -Os # size optimization
|
||||
# -O2 # optimization level 2, if used, also set --memory-init-file 0
|
||||
# -s USE_GLFW=3 # Use glfw3 library (context/input management)
|
||||
# -s ALLOW_MEMORY_GROWTH=1 # to allow memory resizing -> WARNING: Audio buffers could FAIL!
|
||||
# -s TOTAL_MEMORY=16777216 # to specify heap memory size (default = 16MB) (67108864 = 64MB)
|
||||
# -s USE_PTHREADS=1 # multithreading support
|
||||
# -s WASM=0 # disable Web Assembly, emitted by default
|
||||
# -s ASYNCIFY # lets synchronous C/C++ code interact with asynchronous JS
|
||||
# -s FORCE_FILESYSTEM=1 # force filesystem to load/save files data
|
||||
# -s ASSERTIONS=1 # enable runtime checks for common memory allocation errors (-O1 and above turn it off)
|
||||
# --profiling # include information for code profiling
|
||||
# --memory-init-file 0 # to avoid an external memory initialization code file (.mem)
|
||||
# --preload-file resources # specify a resources folder for data compilation
|
||||
# --source-map-base # allow debugging in browser with source map
|
||||
LDFLAGS += -s USE_GLFW=3 -s ASYNCIFY -s TOTAL_MEMORY=67108864 -s FORCE_FILESYSTEM=1 --preload-file $(dir $<)resources@resources
|
||||
|
||||
# NOTE: Simple raylib examples are compiled to be interpreter with asyncify, that way,
|
||||
# we can compile same code for ALL platforms with no change required, but, working on bigger
|
||||
# projects, code needs to be refactored to avoid a blocking while() loop, moving Update and Draw
|
||||
# logic to a self contained function: UpdateDrawFrame(), check core_basic_window_web.c for reference.
|
||||
|
||||
# Define a custom shell .html and output extension
|
||||
LDFLAGS += --shell-file $(RAYLIB_PATH)/src/shell.html
|
||||
EXT = .html
|
||||
endif
|
||||
ifeq ($(PLATFORM),PLATFORM_RPI)
|
||||
LDFLAGS += -L/opt/vc/lib
|
||||
endif
|
||||
@@ -373,6 +378,7 @@ endif
|
||||
# Define all object files required
|
||||
CORE = \
|
||||
core/core_basic_window \
|
||||
core/core_basic_screen_manager \
|
||||
core/core_input_keys \
|
||||
core/core_input_mouse \
|
||||
core/core_input_mouse_wheel \
|
||||
@@ -395,7 +401,10 @@ CORE = \
|
||||
core/core_vr_simulator \
|
||||
core/core_loading_thread \
|
||||
core/core_quat_conversion \
|
||||
core/core_window_flags
|
||||
core/core_window_flags \
|
||||
core/core_split_screen \
|
||||
core/core_smooth_pixelperfect \
|
||||
core/core_custom_frame_control
|
||||
|
||||
SHAPES = \
|
||||
shapes/shapes_basic_shapes \
|
||||
@@ -434,7 +443,7 @@ TEXTURES = \
|
||||
textures/textures_bunnymark \
|
||||
textures/textures_blend_modes \
|
||||
textures/textures_draw_tiled \
|
||||
textures/textures_poly
|
||||
textures/textures_polygon
|
||||
|
||||
TEXT = \
|
||||
text/text_raylib_fonts \
|
||||
@@ -456,10 +465,11 @@ MODELS = \
|
||||
models/models_cubicmap \
|
||||
models/models_first_person_maze \
|
||||
models/models_geometric_shapes \
|
||||
models/models_material_pbr \
|
||||
models/models_mesh_generation \
|
||||
models/models_mesh_picking \
|
||||
models/models_loading \
|
||||
models/models_loading_vox \
|
||||
models/models_loading_gltf \
|
||||
models/models_orthographic_projection \
|
||||
models/models_rlgl_solar_system \
|
||||
models/models_skybox \
|
||||
@@ -476,6 +486,7 @@ SHADERS = \
|
||||
shaders/shaders_raymarching \
|
||||
shaders/shaders_texture_drawing \
|
||||
shaders/shaders_texture_waves \
|
||||
shaders/shaders_texture_outline \
|
||||
shaders/shaders_julia_set \
|
||||
shaders/shaders_eratosthenes \
|
||||
shaders/shaders_basic_lighting \
|
||||
|
1053
examples/Makefile.Web
Normal file
@@ -1,3 +1,21 @@
|
||||
## Building the Examples
|
||||
|
||||
The examples assume you have already built the `raylib` library in `../src`.
|
||||
|
||||
### With GNU make
|
||||
|
||||
- `make` builds all examples
|
||||
- `make [module]` builds all examples for a particular module (e.g `make core`)
|
||||
|
||||
### With Zig
|
||||
|
||||
The [Zig](https://ziglang.org/) toolchain can compile `C` and `C++` in addition to `Zig`.
|
||||
You may find it easier to use than other toolchains, especially when it comes to cross-compiling.
|
||||
|
||||
- `zig build` to compile all examples
|
||||
- `zig build [module]` to compile all examples for a module (e.g. `zig build core`)
|
||||
- `zig build [example]` to compile _and run_ a particular example (e.g. `zig build core_basic_window`)
|
||||
|
||||
## EXAMPLES LIST
|
||||
|
||||
### category: core
|
||||
@@ -110,7 +128,7 @@ Examples using raylib models functionality, including models loading/generation
|
||||
| 72 | [models_cubicmap](models/models_cubicmap.c) | <img src="models/models_cubicmap.png" alt="models_cubicmap" width="200"> | ray | |
|
||||
| 73 | [models_first_person_maze](models/models_first_person_maze.c) | <img src="models/models_first_person_maze.png" alt="models_first_person_maze" width="200"> | ray | |
|
||||
| 74 | [models_geometric_shapes](models/models_geometric_shapes.c) | <img src="models/models_geometric_shapes.png" alt="models_geometric_shapes" width="200"> | ray | |
|
||||
| 75 | [models_material_pbr](models/models_material_pbr.c) | <img src="models/models_material_pbr.png" alt="models_material_pbr" width="200"> | ray | |
|
||||
| 75 | [...]() | | ray | |
|
||||
| 76 | [models_mesh_generation](models/models_mesh_generation.c) | <img src="models/models_mesh_generation.png" alt="models_mesh_generation" width="200"> | ray | |
|
||||
| 77 | [models_mesh_picking](models/models_mesh_picking.c) | <img src="models/models_mesh_picking.png" alt="models_mesh_picking" width="200"> | [Joel Davis](https://github.com/joeld42) | |
|
||||
| 78 | [models_loading](models/models_loading.c) | <img src="models/models_loading.png" alt="models_loading" width="200"> | ray | |
|
||||
@@ -170,22 +188,6 @@ Examples showing physics functionality with raylib. This functionality is provid
|
||||
| 110 | [physics_restitution](physics/physics_restitution.c) | <img src="physics/physics_restitution.png" alt="physics_restitution" width="200"> | [Victor Fisac](https://github.com/victorfisac) | |
|
||||
| 111 | [physics_shatter](physics/physics_shatter.c) | <img src="physics/physics_shatter.png" alt="physics_shatter" width="200"> | [Victor Fisac](https://github.com/victorfisac) | |
|
||||
|
||||
### category: network
|
||||
|
||||
Examples showing raylib network functionality. This functionality is provided by [rnet](../src/rnet.h) module.
|
||||
|
||||
**Note that rnet module is under development and not ready yet.**
|
||||
|
||||
| ## | example | image | developer | new |
|
||||
|----|----------|--------|:----------:|:---:|
|
||||
| 112 | [network_ping_pong](network/network_ping_pong.c) | | [Jak Barnes](https://github.com/syphonx) | |
|
||||
| 113 | [network_resolve_host](network/network_resolve_host.c) | | [Jak Barnes](https://github.com/syphonx) | |
|
||||
| 114 | [network_tcp_client](network/network_tcp_client.c) | | [Jak Barnes](https://github.com/syphonx) | |
|
||||
| 115 | [network_tcp_server](network/network_tcp_server.c) | | [Jak Barnes](https://github.com/syphonx) | |
|
||||
| 116 | [network_test](network/network_test.c) | | [Jak Barnes](https://github.com/syphonx) | |
|
||||
| 117 | [network_udp_client](network/network_udp_client.c) | | [Jak Barnes](https://github.com/syphonx) | |
|
||||
| 118 | [network_udp_server](network/network_udp_server.c) | | [Jak Barnes](https://github.com/syphonx) | |
|
||||
|
||||
### category: others
|
||||
|
||||
Examples showing raylib misc functionality that does not fit in other categories, like standalone modules usage or examples integrating external libraries.
|
||||
|
@@ -31,8 +31,10 @@ int main(void)
|
||||
|
||||
InitAudioDevice(); // Initialize audio device
|
||||
|
||||
SetAudioStreamBufferSizeDefault(MAX_SAMPLES_PER_UPDATE);
|
||||
|
||||
// Init raw audio stream (sample rate: 22050, sample size: 16bit-short, channels: 1-mono)
|
||||
AudioStream stream = InitAudioStream(22050, 16, 1);
|
||||
AudioStream stream = LoadAudioStream(44100, 16, 1);
|
||||
|
||||
// Buffer for the single cycle waveform we are synthesizing
|
||||
short *data = (short *)malloc(sizeof(short)*MAX_SAMPLES);
|
||||
@@ -71,7 +73,7 @@ int main(void)
|
||||
// Sample mouse input.
|
||||
mousePosition = GetMousePosition();
|
||||
|
||||
if (IsMouseButtonDown(MOUSE_LEFT_BUTTON))
|
||||
if (IsMouseButtonDown(MOUSE_BUTTON_LEFT))
|
||||
{
|
||||
float fp = (float)(mousePosition.y);
|
||||
frequency = 40.0f + (float)(fp);
|
||||
@@ -155,7 +157,7 @@ int main(void)
|
||||
free(data); // Unload sine wave data
|
||||
free(writeBuf); // Unload write buffer
|
||||
|
||||
CloseAudioStream(stream); // Close raw audio stream and delete buffers from RAM
|
||||
UnloadAudioStream(stream); // Close raw audio stream and delete buffers from RAM
|
||||
CloseAudioDevice(); // Close audio device (music streaming is automatically stopped)
|
||||
|
||||
CloseWindow(); // Close window and OpenGL context
|
||||
|
@@ -3,8 +3,8 @@
|
||||
| country.mp3 | [@emegeme](https://github.com/emegeme) | [CC0](https://creativecommons.org/publicdomain/zero/1.0/) | Originally created for "DART that TARGET" game |
|
||||
| target.ogg | [@emegeme](https://github.com/emegeme) | [CC0](https://creativecommons.org/publicdomain/zero/1.0/) | Originally created for "DART that TARGET" game |
|
||||
| target.flac | [@emegeme](https://github.com/emegeme) | [CC0](https://creativecommons.org/publicdomain/zero/1.0/) | Originally created for "DART that TARGET" game |
|
||||
| coin.wav | [@raysan5](https://github.com/raysan5) | [CC0](https://creativecommons.org/publicdomain/zero/1.0/) | Created using [rFXGen](https://raylibtech.itch.io/rfxgen) |
|
||||
| sound.wav | [@raysan5](https://github.com/raysan5) | [CC0](https://creativecommons.org/publicdomain/zero/1.0/) | Created using [rFXGen](https://raylibtech.itch.io/rfxgen) |
|
||||
| spring.wav | [@raysan5](https://github.com/raysan5) | [CC0](https://creativecommons.org/publicdomain/zero/1.0/) | Created using [rFXGen](https://raylibtech.itch.io/rfxgen) |
|
||||
| weird.wav | [@raysan5](https://github.com/raysan5) | [CC0](https://creativecommons.org/publicdomain/zero/1.0/) | Created using [rFXGen](https://raylibtech.itch.io/rfxgen) |
|
||||
| coin.wav | [@raysan5](https://github.com/raysan5) | [CC0](https://creativecommons.org/publicdomain/zero/1.0/) | Made with [rFXGen](https://raylibtech.itch.io/rfxgen) |
|
||||
| sound.wav | [@raysan5](https://github.com/raysan5) | [CC0](https://creativecommons.org/publicdomain/zero/1.0/) | Made with [rFXGen](https://raylibtech.itch.io/rfxgen) |
|
||||
| spring.wav | [@raysan5](https://github.com/raysan5) | [CC0](https://creativecommons.org/publicdomain/zero/1.0/) | Made with [rFXGen](https://raylibtech.itch.io/rfxgen) |
|
||||
| weird.wav | [@raysan5](https://github.com/raysan5) | [CC0](https://creativecommons.org/publicdomain/zero/1.0/) | Made with [rFXGen](https://raylibtech.itch.io/rfxgen) |
|
||||
| mini1111.xm | [tPORt](https://modarchive.org/index.php?request=view_by_moduleid&query=51891) | [Mod Archive Distribution license](https://modarchive.org/index.php?terms-upload) | - |
|
||||
|
86
examples/build.zig
Normal file
@@ -0,0 +1,86 @@
|
||||
const std = @import("std");
|
||||
const builtin = @import("builtin");
|
||||
|
||||
fn add_module(comptime module: []const u8, b: *std.build.Builder, target: std.zig.CrossTarget) !*std.build.Step {
|
||||
// Standard release options allow the person running `zig build` to select
|
||||
// between Debug, ReleaseSafe, ReleaseFast, and ReleaseSmall.
|
||||
const mode = b.standardReleaseOptions();
|
||||
|
||||
const all = b.step(module, "All " ++ module ++ " examples");
|
||||
const dir = try std.fs.cwd().openDir(
|
||||
module,
|
||||
.{ .iterate = true },
|
||||
);
|
||||
var iter = dir.iterate();
|
||||
while (try iter.next()) |entry| {
|
||||
if (entry.kind != .File) continue;
|
||||
const extension_idx = std.mem.lastIndexOf(u8, entry.name, ".c") orelse continue;
|
||||
const name = entry.name[0..extension_idx];
|
||||
const path = try std.fs.path.join(b.allocator, &.{ module, entry.name });
|
||||
|
||||
// zig's mingw headers do not include pthread.h
|
||||
if (std.mem.eql(u8, "core_loading_thread", name) and target.getOsTag() == .windows) continue;
|
||||
|
||||
const exe = b.addExecutable(name, path);
|
||||
exe.setTarget(target);
|
||||
exe.setBuildMode(mode);
|
||||
exe.linkLibC();
|
||||
exe.addObjectFile(switch (target.getOsTag()) {
|
||||
.windows => "../src/raylib.lib",
|
||||
.linux => "../src/libraylib.a",
|
||||
else => @panic("Unsupported OS"),
|
||||
});
|
||||
|
||||
exe.addIncludeDir("../src");
|
||||
exe.addIncludeDir("../src/external");
|
||||
exe.addIncludeDir("../src/external/glfw/include");
|
||||
|
||||
switch (exe.target.toTarget().os.tag) {
|
||||
.windows => {
|
||||
exe.linkSystemLibrary("winmm");
|
||||
exe.linkSystemLibrary("gdi32");
|
||||
exe.linkSystemLibrary("opengl32");
|
||||
exe.addIncludeDir("external/glfw/deps/mingw");
|
||||
},
|
||||
.linux => {
|
||||
exe.linkSystemLibrary("GL");
|
||||
exe.linkSystemLibrary("rt");
|
||||
exe.linkSystemLibrary("dl");
|
||||
exe.linkSystemLibrary("m");
|
||||
exe.linkSystemLibrary("X11");
|
||||
},
|
||||
else => {
|
||||
@panic("Unsupported OS");
|
||||
},
|
||||
}
|
||||
|
||||
exe.setOutputDir(module);
|
||||
|
||||
var run = exe.run();
|
||||
run.step.dependOn(&b.addInstallArtifact(exe).step);
|
||||
run.cwd = module;
|
||||
b.step(name, name).dependOn(&run.step);
|
||||
all.dependOn(&exe.step);
|
||||
}
|
||||
return all;
|
||||
}
|
||||
|
||||
pub fn build(b: *std.build.Builder) !void {
|
||||
// Standard target options allows the person running `zig build` to choose
|
||||
// what target to build for. Here we do not override the defaults, which
|
||||
// means any target is allowed, and the default is native. Other options
|
||||
// for restricting supported target set are available.
|
||||
const target = b.standardTargetOptions(.{});
|
||||
|
||||
const all = b.getInstallStep();
|
||||
|
||||
all.dependOn(try add_module("audio", b, target));
|
||||
all.dependOn(try add_module("core", b, target));
|
||||
all.dependOn(try add_module("models", b, target));
|
||||
all.dependOn(try add_module("others", b, target));
|
||||
all.dependOn(try add_module("physics", b, target));
|
||||
all.dependOn(try add_module("shaders", b, target));
|
||||
all.dependOn(try add_module("shapes", b, target));
|
||||
all.dependOn(try add_module("text", b, target));
|
||||
all.dependOn(try add_module("textures", b, target));
|
||||
}
|
BIN
examples/core/core_2d_camera_smooth_pixelperfect.png
Normal file
After Width: | Height: | Size: 16 KiB |
@@ -33,7 +33,7 @@ int main(void)
|
||||
|
||||
Ray ray = { 0 }; // Picking line ray
|
||||
|
||||
bool collision = false;
|
||||
RayCollision collision = { 0 };
|
||||
|
||||
SetCameraMode(camera, CAMERA_FREE); // Set a free camera mode
|
||||
|
||||
@@ -47,18 +47,18 @@ int main(void)
|
||||
//----------------------------------------------------------------------------------
|
||||
UpdateCamera(&camera); // Update camera
|
||||
|
||||
if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON))
|
||||
if (IsMouseButtonPressed(MOUSE_BUTTON_LEFT))
|
||||
{
|
||||
if (!collision)
|
||||
if (!collision.hit)
|
||||
{
|
||||
ray = GetMouseRay(GetMousePosition(), camera);
|
||||
|
||||
// Check collision between ray and box
|
||||
collision = CheckCollisionRayBox(ray,
|
||||
collision = GetRayCollisionBox(ray,
|
||||
(BoundingBox){(Vector3){ cubePosition.x - cubeSize.x/2, cubePosition.y - cubeSize.y/2, cubePosition.z - cubeSize.z/2 },
|
||||
(Vector3){ cubePosition.x + cubeSize.x/2, cubePosition.y + cubeSize.y/2, cubePosition.z + cubeSize.z/2 }});
|
||||
}
|
||||
else collision = false;
|
||||
else collision.hit = false;
|
||||
}
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
@@ -70,7 +70,7 @@ int main(void)
|
||||
|
||||
BeginMode3D(camera);
|
||||
|
||||
if (collision)
|
||||
if (collision.hit)
|
||||
{
|
||||
DrawCube(cubePosition, cubeSize.x, cubeSize.y, cubeSize.z, RED);
|
||||
DrawCubeWires(cubePosition, cubeSize.x, cubeSize.y, cubeSize.z, MAROON);
|
||||
@@ -90,7 +90,7 @@ int main(void)
|
||||
|
||||
DrawText("Try selecting the box with mouse!", 240, 10, 20, DARKGRAY);
|
||||
|
||||
if (collision) DrawText("BOX SELECTED", (screenWidth - MeasureText("BOX SELECTED", 30)) / 2, (int)(screenHeight * 0.1f), 30, GREEN);
|
||||
if (collision.hit) DrawText("BOX SELECTED", (screenWidth - MeasureText("BOX SELECTED", 30)) / 2, (int)(screenHeight * 0.1f), 30, GREEN);
|
||||
|
||||
DrawFPS(10, 10);
|
||||
|
||||
|
@@ -1,35 +1,34 @@
|
||||
/*******************************************************************************************
|
||||
*
|
||||
* raylib - Simple Game template
|
||||
* raylib [core] examples - basic screen manager
|
||||
*
|
||||
* <Game title>
|
||||
* <Game description>
|
||||
* This example illustrates a very simple screen manager based on a states machines
|
||||
*
|
||||
* This game has been created using raylib (www.raylib.com)
|
||||
* This test has been created using raylib 1.1 (www.raylib.com)
|
||||
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||
*
|
||||
* Copyright (c) 2014-2021 Ramon Santamaria (@raysan5)
|
||||
* Copyright (c) 2021 Ramon Santamaria (@raysan5)
|
||||
*
|
||||
********************************************************************************************/
|
||||
|
||||
#include "raylib.h"
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------------------
|
||||
// Types and Structures Definition
|
||||
//----------------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------------------
|
||||
typedef enum GameScreen { LOGO = 0, TITLE, GAMEPLAY, ENDING } GameScreen;
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------------------
|
||||
// Main entry point
|
||||
//----------------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------------------
|
||||
int main(void)
|
||||
{
|
||||
// Initialization (Note windowTitle is unused on Android)
|
||||
// Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
const int screenWidth = 800;
|
||||
const int screenHeight = 450;
|
||||
|
||||
InitWindow(screenWidth, screenHeight, "raylib template - simple game");
|
||||
InitWindow(screenWidth, screenHeight, "raylib [core] example - basic screen manager");
|
||||
|
||||
GameScreen currentScreen = LOGO;
|
||||
|
BIN
examples/core/core_basic_screen_manager.png
Normal file
After Width: | Height: | Size: 15 KiB |
125
examples/core/core_custom_frame_control.c
Normal file
@@ -0,0 +1,125 @@
|
||||
/*******************************************************************************************
|
||||
*
|
||||
* raylib [core] example - custom frame control
|
||||
*
|
||||
* WARNING: This is an example for advance users willing to have full control over
|
||||
* the frame processes. By default, EndDrawing() calls the following processes:
|
||||
* 1. Draw remaining batch data: rlDrawRenderBatchActive()
|
||||
* 2. SwapScreenBuffer()
|
||||
* 3. Frame time control: WaitTime()
|
||||
* 4. PollInputEvents()
|
||||
*
|
||||
* To avoid steps 2, 3 and 4, flag SUPPORT_CUSTOM_FRAME_CONTROL can be enabled in
|
||||
* config.h (it requires recompiling raylib). This way those steps are up to the user.
|
||||
*
|
||||
* Note that enabling this flag invalidates some functions:
|
||||
* - GetFrameTime()
|
||||
* - SetTargetFPS()
|
||||
* - GetFPS()
|
||||
*
|
||||
* This example has been created using raylib 3.8 (www.raylib.com)
|
||||
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||
*
|
||||
* Copyright (c) 2021 Ramon Santamaria (@raysan5)
|
||||
*
|
||||
********************************************************************************************/
|
||||
|
||||
#include "raylib.h"
|
||||
|
||||
int main(void)
|
||||
{
|
||||
// Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
const int screenWidth = 800;
|
||||
const int screenHeight = 450;
|
||||
|
||||
InitWindow(screenWidth, screenHeight, "raylib [core] example - custom frame control");
|
||||
|
||||
// Custom timming variables
|
||||
double previousTime = GetTime(); // Previous time measure
|
||||
double currentTime = 0.0; // Current time measure
|
||||
double updateDrawTime = 0.0; // Update + Draw time
|
||||
double waitTime = 0.0; // Wait time (if target fps required)
|
||||
float deltaTime = 0.0f; // Frame time (Update + Draw + Wait time)
|
||||
|
||||
float timeCounter = 0.0f; // Accumulative time counter (seconds)
|
||||
float position = 0.0f; // Circle position
|
||||
bool pause = false; // Pause control flag
|
||||
|
||||
int targetFPS = 60; // Our initial target fps
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
// Main game loop
|
||||
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||
{
|
||||
// Update
|
||||
//----------------------------------------------------------------------------------
|
||||
PollInputEvents(); // Poll input events (SUPPORT_CUSTOM_FRAME_CONTROL)
|
||||
|
||||
if (IsKeyPressed(KEY_SPACE)) pause = !pause;
|
||||
|
||||
if (IsKeyPressed(KEY_UP)) targetFPS += 20;
|
||||
else if (IsKeyPressed(KEY_DOWN)) targetFPS -= 20;
|
||||
|
||||
if (targetFPS < 0) targetFPS = 0;
|
||||
|
||||
if (!pause)
|
||||
{
|
||||
position += 200*deltaTime; // We move at 200 pixels per second
|
||||
if (position >= GetScreenWidth()) position = 0;
|
||||
timeCounter += deltaTime; // We count time (seconds)
|
||||
}
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
// Draw
|
||||
//----------------------------------------------------------------------------------
|
||||
BeginDrawing();
|
||||
|
||||
ClearBackground(RAYWHITE);
|
||||
|
||||
for (int i = 0; i < GetScreenWidth()/200; i++) DrawRectangle(200*i, 0, 1, GetScreenHeight(), SKYBLUE);
|
||||
|
||||
DrawCircle((int)position, GetScreenHeight()/2 - 25, 50, RED);
|
||||
|
||||
DrawText(TextFormat("%03.0f ms", timeCounter*1000.0f), position - 40, GetScreenHeight()/2 - 100, 20, MAROON);
|
||||
DrawText(TextFormat("PosX: %03.0f", position), position - 50, GetScreenHeight()/2 + 40, 20, BLACK);
|
||||
|
||||
DrawText("Circle is moving at a constant 200 pixels/sec,\nindependently of the frame rate.", 10, 10, 20, DARKGRAY);
|
||||
DrawText("PRESS SPACE to PAUSE MOVEMENT", 10, GetScreenHeight() - 60, 20, GRAY);
|
||||
DrawText("PRESS UP | DOWN to CHANGE TARGET FPS", 10, GetScreenHeight() - 30, 20, GRAY);
|
||||
DrawText(TextFormat("TARGET FPS: %i", targetFPS), GetScreenWidth() - 220, 10, 20, LIME);
|
||||
DrawText(TextFormat("CURRENT FPS: %i", (int)(1.0f/deltaTime)), GetScreenWidth() - 220, 40, 20, GREEN);
|
||||
|
||||
EndDrawing();
|
||||
|
||||
// NOTE: In case raylib is configured to SUPPORT_CUSTOM_FRAME_CONTROL,
|
||||
// Events polling, screen buffer swap and frame time control must be managed by the user
|
||||
|
||||
SwapScreenBuffer(); // Flip the back buffer to screen (front buffer)
|
||||
|
||||
currentTime = GetTime();
|
||||
updateDrawTime = currentTime - previousTime;
|
||||
|
||||
if (targetFPS > 0) // We want a fixed frame rate
|
||||
{
|
||||
waitTime = (1.0f/(float)targetFPS) - updateDrawTime;
|
||||
if (waitTime > 0.0)
|
||||
{
|
||||
WaitTime((float)waitTime*1000.0f);
|
||||
currentTime = GetTime();
|
||||
deltaTime = (float)(currentTime - previousTime);
|
||||
}
|
||||
}
|
||||
else deltaTime = updateDrawTime; // Framerate could be variable
|
||||
|
||||
previousTime = currentTime;
|
||||
//----------------------------------------------------------------------------------
|
||||
}
|
||||
|
||||
// De-Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
CloseWindow(); // Close window and OpenGL context
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
return 0;
|
||||
}
|
BIN
examples/core/core_custom_frame_control.png
Normal file
After Width: | Height: | Size: 17 KiB |
@@ -62,7 +62,7 @@ int main(void)
|
||||
{
|
||||
DrawText(TextFormat("GP1: %s", GetGamepadName(0)), 10, 10, 10, BLACK);
|
||||
|
||||
if (IsGamepadName(0, XBOX360_NAME_ID) || IsGamepadName(0, XBOX360_LEGACY_NAME_ID))
|
||||
if (TextIsEqual(GetGamepadName(0), XBOX360_NAME_ID) || TextIsEqual(GetGamepadName(0), XBOX360_LEGACY_NAME_ID))
|
||||
{
|
||||
DrawTexture(texXboxPad, 0, 0, DARKGRAY);
|
||||
|
||||
@@ -110,7 +110,7 @@ int main(void)
|
||||
//DrawText(TextFormat("Xbox axis LT: %02.02f", GetGamepadAxisMovement(0, GAMEPAD_AXIS_LEFT_TRIGGER)), 10, 40, 10, BLACK);
|
||||
//DrawText(TextFormat("Xbox axis RT: %02.02f", GetGamepadAxisMovement(0, GAMEPAD_AXIS_RIGHT_TRIGGER)), 10, 60, 10, BLACK);
|
||||
}
|
||||
else if (IsGamepadName(0, PS3_NAME_ID))
|
||||
else if (TextIsEqual(GetGamepadName(0), PS3_NAME_ID))
|
||||
{
|
||||
DrawTexture(texPs3Pad, 0, 0, DARKGRAY);
|
||||
|
||||
|
@@ -33,9 +33,13 @@ int main(void)
|
||||
//----------------------------------------------------------------------------------
|
||||
ballPosition = GetMousePosition();
|
||||
|
||||
if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) ballColor = MAROON;
|
||||
else if (IsMouseButtonPressed(MOUSE_MIDDLE_BUTTON)) ballColor = LIME;
|
||||
else if (IsMouseButtonPressed(MOUSE_RIGHT_BUTTON)) ballColor = DARKBLUE;
|
||||
if (IsMouseButtonPressed(MOUSE_BUTTON_LEFT)) ballColor = MAROON;
|
||||
else if (IsMouseButtonPressed(MOUSE_BUTTON_MIDDLE)) ballColor = LIME;
|
||||
else if (IsMouseButtonPressed(MOUSE_BUTTON_RIGHT)) ballColor = DARKBLUE;
|
||||
else if (IsMouseButtonPressed(MOUSE_BUTTON_SIDE)) ballColor = PURPLE;
|
||||
else if (IsMouseButtonPressed(MOUSE_BUTTON_EXTRA)) ballColor = YELLOW;
|
||||
else if (IsMouseButtonPressed(MOUSE_BUTTON_FORWARD)) ballColor = ORANGE;
|
||||
else if (IsMouseButtonPressed(MOUSE_BUTTON_BACK)) ballColor = BEIGE;
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
// Draw
|
||||
|
@@ -24,11 +24,7 @@ int main(void)
|
||||
|
||||
InitWindow(screenWidth, screenHeight, "raylib [core] example - input multitouch");
|
||||
|
||||
Vector2 ballPosition = { -100.0f, -100.0f };
|
||||
Color ballColor = BEIGE;
|
||||
|
||||
int touchCounter = 0;
|
||||
Vector2 touchPosition = { 0 };
|
||||
Vector2 touchPositions[MAX_TOUCH_POINTS] = { 0 };
|
||||
|
||||
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||
//---------------------------------------------------------------------------------------
|
||||
@@ -38,19 +34,8 @@ int main(void)
|
||||
{
|
||||
// Update
|
||||
//----------------------------------------------------------------------------------
|
||||
ballPosition = GetMousePosition();
|
||||
|
||||
ballColor = BEIGE;
|
||||
|
||||
if (IsMouseButtonDown(MOUSE_LEFT_BUTTON)) ballColor = MAROON;
|
||||
if (IsMouseButtonDown(MOUSE_MIDDLE_BUTTON)) ballColor = LIME;
|
||||
if (IsMouseButtonDown(MOUSE_RIGHT_BUTTON)) ballColor = DARKBLUE;
|
||||
|
||||
if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) touchCounter = 10;
|
||||
if (IsMouseButtonPressed(MOUSE_MIDDLE_BUTTON)) touchCounter = 10;
|
||||
if (IsMouseButtonPressed(MOUSE_RIGHT_BUTTON)) touchCounter = 10;
|
||||
|
||||
if (touchCounter > 0) touchCounter--;
|
||||
// Get multiple touchpoints
|
||||
for (int i = 0; i < MAX_TOUCH_POINTS; ++i) touchPositions[i] = GetTouchPosition(i);
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
// Draw
|
||||
@@ -59,24 +44,18 @@ int main(void)
|
||||
|
||||
ClearBackground(RAYWHITE);
|
||||
|
||||
// Multitouch
|
||||
for (int i = 0; i < MAX_TOUCH_POINTS; ++i)
|
||||
{
|
||||
touchPosition = GetTouchPosition(i); // Get the touch point
|
||||
|
||||
if ((touchPosition.x >= 0) && (touchPosition.y >= 0)) // Make sure point is not (-1,-1) as this means there is no touch for it
|
||||
// Make sure point is not (0, 0) as this means there is no touch for it
|
||||
if ((touchPositions[i].x > 0) && (touchPositions[i].y > 0))
|
||||
{
|
||||
// Draw circle and touch index number
|
||||
DrawCircleV(touchPosition, 34, ORANGE);
|
||||
DrawText(TextFormat("%d", i), (int)touchPosition.x - 10, (int)touchPosition.y - 70, 40, BLACK);
|
||||
DrawCircleV(touchPositions[i], 34, ORANGE);
|
||||
DrawText(TextFormat("%d", i), (int)touchPositions[i].x - 10, (int)touchPositions[i].y - 70, 40, BLACK);
|
||||
}
|
||||
}
|
||||
|
||||
// Draw the normal mouse location
|
||||
DrawCircleV(ballPosition, 30 + (touchCounter*3.0f), ballColor);
|
||||
|
||||
DrawText("move ball with mouse and click mouse button to change color", 10, 10, 20, DARKGRAY);
|
||||
DrawText("touch the screen at multiple locations to get multiple balls", 10, 30, 20, DARKGRAY);
|
||||
DrawText("touch the screen at multiple locations to get multiple balls", 10, 10, 20, DARKGRAY);
|
||||
|
||||
EndDrawing();
|
||||
//----------------------------------------------------------------------------------
|
||||
|
@@ -10,7 +10,7 @@
|
||||
*
|
||||
* Example contributed by Chris Camacho (@chriscamacho) and reviewed by Ramon Santamaria (@raysan5)
|
||||
*
|
||||
* Copyright (c) 2020 Chris Camacho (@chriscamacho) and Ramon Santamaria (@raysan5)
|
||||
* Copyright (c) 2020-2021 Chris Camacho (@chriscamacho) and Ramon Santamaria (@raysan5)
|
||||
*
|
||||
********************************************************************************************/
|
||||
|
||||
@@ -34,13 +34,21 @@ int main(void)
|
||||
camera.fovy = 45.0f; // Camera field-of-view Y
|
||||
camera.projection = CAMERA_PERSPECTIVE; // Camera mode type
|
||||
|
||||
Mesh mesh = GenMeshCylinder(0.2f, 1.0f, 32);
|
||||
Model model = LoadModelFromMesh(mesh);
|
||||
// Load a cylinder model for testing
|
||||
Model model = LoadModelFromMesh(GenMeshCylinder(0.2f, 1.0f, 32));
|
||||
|
||||
// Some required variables
|
||||
// Generic quaternion for operations
|
||||
Quaternion q1 = { 0 };
|
||||
Matrix m1 = { 0 }, m2 = { 0 }, m3 = { 0 }, m4 = { 0 };
|
||||
Vector3 v1 = { 0 }, v2 = { 0 };
|
||||
|
||||
// Transform matrices required to draw 4 cylinders
|
||||
Matrix m1 = { 0 };
|
||||
Matrix m2 = { 0 };
|
||||
Matrix m3 = { 0 };
|
||||
Matrix m4 = { 0 };
|
||||
|
||||
// Generic vectors for rotations
|
||||
Vector3 v1 = { 0 };
|
||||
Vector3 v2 = { 0 };
|
||||
|
||||
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||
//--------------------------------------------------------------------------------------
|
||||
@@ -50,6 +58,10 @@ int main(void)
|
||||
{
|
||||
// Update
|
||||
//--------------------------------------------------------------------------------------
|
||||
if (v2.x < 0) v2.x += PI*2;
|
||||
if (v2.y < 0) v2.y += PI*2;
|
||||
if (v2.z < 0) v2.z += PI*2;
|
||||
|
||||
if (!IsKeyDown(KEY_SPACE))
|
||||
{
|
||||
v1.x += 0.01f;
|
||||
@@ -68,10 +80,7 @@ int main(void)
|
||||
q1 = QuaternionFromMatrix(m1);
|
||||
m3 = QuaternionToMatrix(q1);
|
||||
|
||||
v2 = QuaternionToEuler(q1);
|
||||
v2.x *= DEG2RAD;
|
||||
v2.y *= DEG2RAD;
|
||||
v2.z *= DEG2RAD;
|
||||
v2 = QuaternionToEuler(q1); // Angles returned in radians
|
||||
|
||||
m4 = MatrixRotateZYX(v2);
|
||||
//--------------------------------------------------------------------------------------
|
||||
@@ -86,10 +95,13 @@ int main(void)
|
||||
|
||||
model.transform = m1;
|
||||
DrawModel(model, (Vector3){ -1, 0, 0 }, 1.0f, RED);
|
||||
|
||||
model.transform = m2;
|
||||
DrawModel(model, (Vector3){ 1, 0, 0 }, 1.0f, RED);
|
||||
|
||||
model.transform = m3;
|
||||
DrawModel(model, (Vector3){ 0, 0, 0 }, 1.0f, RED);
|
||||
|
||||
model.transform = m4;
|
||||
DrawModel(model, (Vector3){ 0, 0, -1 }, 1.0f, RED);
|
||||
|
||||
@@ -97,23 +109,13 @@ int main(void)
|
||||
|
||||
EndMode3D();
|
||||
|
||||
if (v2.x < 0) v2.x += PI*2;
|
||||
if (v2.y < 0) v2.y += PI*2;
|
||||
if (v2.z < 0) v2.z += PI*2;
|
||||
DrawText(TextFormat("%2.3f", v1.x), 20, 20, 20, (v1.x == v2.x)? GREEN: BLACK);
|
||||
DrawText(TextFormat("%2.3f", v1.y), 20, 40, 20, (v1.y == v2.y)? GREEN: BLACK);
|
||||
DrawText(TextFormat("%2.3f", v1.z), 20, 60, 20, (v1.z == v2.z)? GREEN: BLACK);
|
||||
|
||||
Color cx,cy,cz;
|
||||
cx = cy = cz = BLACK;
|
||||
if (v1.x == v2.x) cx = GREEN;
|
||||
if (v1.y == v2.y) cy = GREEN;
|
||||
if (v1.z == v2.z) cz = GREEN;
|
||||
|
||||
DrawText(TextFormat("%2.3f", v1.x), 20, 20, 20, cx);
|
||||
DrawText(TextFormat("%2.3f", v1.y), 20, 40, 20, cy);
|
||||
DrawText(TextFormat("%2.3f", v1.z), 20, 60, 20, cz);
|
||||
|
||||
DrawText(TextFormat("%2.3f", v2.x), 200, 20, 20, cx);
|
||||
DrawText(TextFormat("%2.3f", v2.y), 200, 40, 20, cy);
|
||||
DrawText(TextFormat("%2.3f", v2.z), 200, 60, 20, cz);
|
||||
DrawText(TextFormat("%2.3f", v2.x), 200, 20, 20, (v1.x == v2.x)? GREEN: BLACK);
|
||||
DrawText(TextFormat("%2.3f", v2.y), 200, 40, 20, (v1.y == v2.y)? GREEN: BLACK);
|
||||
DrawText(TextFormat("%2.3f", v2.z), 200, 60, 20, (v1.z == v2.z)? GREEN: BLACK);
|
||||
|
||||
EndDrawing();
|
||||
//----------------------------------------------------------------------------------
|
||||
|
@@ -20,10 +20,12 @@ int main(void)
|
||||
|
||||
InitWindow(screenWidth, screenHeight, "raylib [core] example - generate random values");
|
||||
|
||||
int framesCounter = 0; // Variable used to count frames
|
||||
// SetRandomSeed(0xaabbccff); // Set a custom random seed if desired, by default: "time(NULL)"
|
||||
|
||||
int randValue = GetRandomValue(-8, 5); // Get a random integer number between -8 and 5 (both included)
|
||||
|
||||
int framesCounter = 0; // Variable used to count frames
|
||||
|
||||
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
|
117
examples/core/core_smooth_pixelperfect.c
Normal file
@@ -0,0 +1,117 @@
|
||||
/*******************************************************************************************
|
||||
*
|
||||
* raylib [core] example - smooth pixel-perfect camera
|
||||
*
|
||||
* This example has been created using raylib 3.7 (www.raylib.com)
|
||||
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||
*
|
||||
* Example contributed by Giancamillo Alessandroni (@NotManyIdeasDev) and
|
||||
* reviewed by Ramon Santamaria (@raysan5)
|
||||
*
|
||||
* Copyright (c) 2021 Giancamillo Alessandroni (@NotManyIdeasDev) and Ramon Santamaria (@raysan5)
|
||||
*
|
||||
********************************************************************************************/
|
||||
|
||||
#include "raylib.h"
|
||||
|
||||
#include <math.h> // Required for: sinf(), cosf()
|
||||
|
||||
int main(void)
|
||||
{
|
||||
// Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
const int screenWidth = 800;
|
||||
const int screenHeight = 450;
|
||||
|
||||
const int virtualScreenWidth = 160;
|
||||
const int virtualScreenHeight = 90;
|
||||
|
||||
const float virtualRatio = (float)screenWidth/(float)virtualScreenWidth;
|
||||
|
||||
InitWindow(screenWidth, screenHeight, "raylib [core] example - smooth pixel-perfect camera");
|
||||
|
||||
Camera2D worldSpaceCamera = { 0 }; // Game world camera
|
||||
worldSpaceCamera.zoom = 1.0f;
|
||||
|
||||
Camera2D screenSpaceCamera = { 0 }; // Smoothing camera
|
||||
screenSpaceCamera.zoom = 1.0f;
|
||||
|
||||
RenderTexture2D target = LoadRenderTexture(virtualScreenWidth, virtualScreenHeight); // This is where we'll draw all our objects.
|
||||
|
||||
Rectangle rec01 = { 70.0f, 35.0f, 20.0f, 20.0f };
|
||||
Rectangle rec02 = { 90.0f, 55.0f, 30.0f, 10.0f };
|
||||
Rectangle rec03 = { 80.0f, 65.0f, 15.0f, 25.0f };
|
||||
|
||||
// The target's height is flipped (in the source Rectangle), due to OpenGL reasons
|
||||
Rectangle sourceRec = { 0.0f, 0.0f, (float)target.texture.width, -(float)target.texture.height };
|
||||
Rectangle destRec = { -virtualRatio, -virtualRatio, screenWidth + (virtualRatio*2), screenHeight + (virtualRatio*2) };
|
||||
|
||||
Vector2 origin = { 0.0f, 0.0f };
|
||||
|
||||
float rotation = 0.0f;
|
||||
|
||||
float cameraX = 0.0f;
|
||||
float cameraY = 0.0f;
|
||||
|
||||
SetTargetFPS(60);
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
// Main game loop
|
||||
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||
{
|
||||
// Update
|
||||
//----------------------------------------------------------------------------------
|
||||
rotation += 60.0f*GetFrameTime(); // Rotate the rectangles, 60 degrees per second
|
||||
|
||||
// Make the camera move to demonstrate the effect
|
||||
cameraX = (sinf(GetTime())*50.0f) - 10.0f;
|
||||
cameraY = cosf(GetTime())*30.0f;
|
||||
|
||||
// Set the camera's target to the values computed above
|
||||
screenSpaceCamera.target = (Vector2){ cameraX, cameraY };
|
||||
|
||||
// Round worldSpace coordinates, keep decimals into screenSpace coordinates
|
||||
worldSpaceCamera.target.x = (int)screenSpaceCamera.target.x;
|
||||
screenSpaceCamera.target.x -= worldSpaceCamera.target.x;
|
||||
screenSpaceCamera.target.x *= virtualRatio;
|
||||
|
||||
worldSpaceCamera.target.y = (int)screenSpaceCamera.target.y;
|
||||
screenSpaceCamera.target.y -= worldSpaceCamera.target.y;
|
||||
screenSpaceCamera.target.y *= virtualRatio;
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
// Draw
|
||||
//----------------------------------------------------------------------------------
|
||||
BeginTextureMode(target);
|
||||
ClearBackground(RAYWHITE);
|
||||
|
||||
BeginMode2D(worldSpaceCamera);
|
||||
DrawRectanglePro(rec01, origin, rotation, BLACK);
|
||||
DrawRectanglePro(rec02, origin, -rotation, RED);
|
||||
DrawRectanglePro(rec03, origin, rotation + 45.0f, BLUE);
|
||||
EndMode2D();
|
||||
EndTextureMode();
|
||||
|
||||
BeginDrawing();
|
||||
ClearBackground(RED);
|
||||
|
||||
BeginMode2D(screenSpaceCamera);
|
||||
DrawTexturePro(target.texture, sourceRec, destRec, origin, 0.0f, WHITE);
|
||||
EndMode2D();
|
||||
|
||||
DrawText(TextFormat("Screen resolution: %ix%i", screenWidth, screenHeight), 10, 10, 20, DARKBLUE);
|
||||
DrawText(TextFormat("World resolution: %ix%i", virtualScreenWidth, virtualScreenHeight), 10, 40, 20, DARKGREEN);
|
||||
DrawFPS(GetScreenWidth() - 95, 10);
|
||||
EndDrawing();
|
||||
//----------------------------------------------------------------------------------
|
||||
}
|
||||
|
||||
// De-Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
UnloadRenderTexture(target); // Unload render texture
|
||||
|
||||
CloseWindow(); // Close window and OpenGL context
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
return 0;
|
||||
}
|
BIN
examples/core/core_smooth_pixelperfect.png
Normal file
After Width: | Height: | Size: 15 KiB |
155
examples/core/core_split_screen.c
Normal file
@@ -0,0 +1,155 @@
|
||||
/*******************************************************************************************
|
||||
*
|
||||
* raylib [core] example - split screen
|
||||
*
|
||||
* This example has been created using raylib 3.7 (www.raylib.com)
|
||||
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||
*
|
||||
* Example contributed by Jeffery Myers (@JeffM2501) and reviewed by Ramon Santamaria (@raysan5)
|
||||
*
|
||||
* Copyright (c) 2021 Jeffery Myers (@JeffM2501)
|
||||
*
|
||||
********************************************************************************************/
|
||||
|
||||
#include "raylib.h"
|
||||
|
||||
Texture2D textureGrid = { 0 };
|
||||
Camera cameraPlayer1 = { 0 };
|
||||
Camera cameraPlayer2 = { 0 };
|
||||
|
||||
// Scene drawing
|
||||
void DrawScene(void)
|
||||
{
|
||||
int count = 5;
|
||||
float spacing = 4;
|
||||
|
||||
// Grid of cube trees on a plane to make a "world"
|
||||
DrawPlane((Vector3){ 0, 0, 0 }, (Vector2){ 50, 50 }, BEIGE); // Simple world plane
|
||||
|
||||
for (float x = -count*spacing; x <= count*spacing; x += spacing)
|
||||
{
|
||||
for (float z = -count*spacing; z <= count*spacing; z += spacing)
|
||||
{
|
||||
DrawCubeTexture(textureGrid, (Vector3) { x, 1.5f, z }, 1, 1, 1, GREEN);
|
||||
DrawCubeTexture(textureGrid, (Vector3) { x, 0.5f, z }, 0.25f, 1, 0.25f, BROWN);
|
||||
}
|
||||
}
|
||||
|
||||
// Draw a cube at each player's position
|
||||
DrawCube(cameraPlayer1.position, 1, 1, 1, RED);
|
||||
DrawCube(cameraPlayer2.position, 1, 1, 1, BLUE);
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
// Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
const int screenWidth = 800;
|
||||
const int screenHeight = 450;
|
||||
|
||||
InitWindow(screenWidth, screenHeight, "raylib [core] example - split screen");
|
||||
|
||||
// Generate a simple texture to use for trees
|
||||
Image img = GenImageChecked(256, 256, 32, 32, DARKGRAY, WHITE);
|
||||
textureGrid = LoadTextureFromImage(img);
|
||||
UnloadImage(img);
|
||||
SetTextureFilter(textureGrid, TEXTURE_FILTER_ANISOTROPIC_16X);
|
||||
SetTextureWrap(textureGrid, TEXTURE_WRAP_CLAMP);
|
||||
|
||||
// Setup player 1 camera and screen
|
||||
cameraPlayer1.fovy = 45.0f;
|
||||
cameraPlayer1.up.y = 1.0f;
|
||||
cameraPlayer1.target.y = 1.0f;
|
||||
cameraPlayer1.position.z = -3.0f;
|
||||
cameraPlayer1.position.y = 1.0f;
|
||||
|
||||
RenderTexture screenPlayer1 = LoadRenderTexture(screenWidth/2, screenHeight);
|
||||
|
||||
// Setup player two camera and screen
|
||||
cameraPlayer2.fovy = 45.0f;
|
||||
cameraPlayer2.up.y = 1.0f;
|
||||
cameraPlayer2.target.y = 3.0f;
|
||||
cameraPlayer2.position.x = -3.0f;
|
||||
cameraPlayer2.position.y = 3.0f;
|
||||
|
||||
RenderTexture screenPlayer2 = LoadRenderTexture(screenWidth / 2, screenHeight);
|
||||
|
||||
// Build a flipped rectangle the size of the split view to use for drawing later
|
||||
Rectangle splitScreenRect = { 0.0f, 0.0f, (float)screenPlayer1.texture.width, (float)-screenPlayer1.texture.height };
|
||||
|
||||
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
// Main game loop
|
||||
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||
{
|
||||
// Update
|
||||
//----------------------------------------------------------------------------------
|
||||
// If anyone moves this frame, how far will they move based on the time since the last frame
|
||||
// this moves thigns at 10 world units per second, regardless of the actual FPS
|
||||
float offsetThisFrame = 10.0f*GetFrameTime();
|
||||
|
||||
// Move Player1 forward and backwards (no turning)
|
||||
if (IsKeyDown(KEY_W))
|
||||
{
|
||||
cameraPlayer1.position.z += offsetThisFrame;
|
||||
cameraPlayer1.target.z += offsetThisFrame;
|
||||
}
|
||||
else if (IsKeyDown(KEY_S))
|
||||
{
|
||||
cameraPlayer1.position.z -= offsetThisFrame;
|
||||
cameraPlayer1.target.z -= offsetThisFrame;
|
||||
}
|
||||
|
||||
// Move Player2 forward and backwards (no turning)
|
||||
if (IsKeyDown(KEY_UP))
|
||||
{
|
||||
cameraPlayer2.position.x += offsetThisFrame;
|
||||
cameraPlayer2.target.x += offsetThisFrame;
|
||||
}
|
||||
else if (IsKeyDown(KEY_DOWN))
|
||||
{
|
||||
cameraPlayer2.position.x -= offsetThisFrame;
|
||||
cameraPlayer2.target.x -= offsetThisFrame;
|
||||
}
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
// Draw
|
||||
//----------------------------------------------------------------------------------
|
||||
// Draw Player1 view to the render texture
|
||||
BeginTextureMode(screenPlayer1);
|
||||
ClearBackground(SKYBLUE);
|
||||
BeginMode3D(cameraPlayer1);
|
||||
DrawScene();
|
||||
EndMode3D();
|
||||
DrawText("PLAYER1 W/S to move", 10, 10, 20, RED);
|
||||
EndTextureMode();
|
||||
|
||||
// Draw Player2 view to the render texture
|
||||
BeginTextureMode(screenPlayer2);
|
||||
ClearBackground(SKYBLUE);
|
||||
BeginMode3D(cameraPlayer2);
|
||||
DrawScene();
|
||||
EndMode3D();
|
||||
DrawText("PLAYER2 UP/DOWN to move", 10, 10, 20, BLUE);
|
||||
EndTextureMode();
|
||||
|
||||
// Draw both views render textures to the screen side by side
|
||||
BeginDrawing();
|
||||
ClearBackground(BLACK);
|
||||
DrawTextureRec(screenPlayer1.texture, splitScreenRect, (Vector2){ 0, 0 }, WHITE);
|
||||
DrawTextureRec(screenPlayer2.texture, splitScreenRect, (Vector2){ screenWidth/2.0f, 0 }, WHITE);
|
||||
EndDrawing();
|
||||
}
|
||||
|
||||
// De-Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
UnloadRenderTexture(screenPlayer1); // Unload render texture
|
||||
UnloadRenderTexture(screenPlayer2); // Unload render texture
|
||||
UnloadTexture(textureGrid); // Unload texture
|
||||
|
||||
CloseWindow(); // Close window and OpenGL context
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
return 0;
|
||||
}
|
BIN
examples/core/core_split_screen.png
Normal file
After Width: | Height: | Size: 21 KiB |
@@ -105,10 +105,6 @@ int main(void)
|
||||
|
||||
// Draw
|
||||
//----------------------------------------------------------------------------------
|
||||
BeginDrawing();
|
||||
|
||||
ClearBackground(RAYWHITE);
|
||||
|
||||
BeginTextureMode(target);
|
||||
ClearBackground(RAYWHITE);
|
||||
BeginVrStereoMode(config);
|
||||
@@ -122,13 +118,13 @@ int main(void)
|
||||
EndVrStereoMode();
|
||||
EndTextureMode();
|
||||
|
||||
BeginDrawing();
|
||||
ClearBackground(RAYWHITE);
|
||||
BeginShaderMode(distortion);
|
||||
DrawTextureRec(target.texture, (Rectangle){ 0, 0, (float)target.texture.width,
|
||||
(float)-target.texture.height }, (Vector2){ 0.0f, 0.0f }, WHITE);
|
||||
EndShaderMode();
|
||||
|
||||
DrawFPS(10, 10);
|
||||
|
||||
EndDrawing();
|
||||
//----------------------------------------------------------------------------------
|
||||
}
|
||||
|
@@ -43,7 +43,7 @@ int main(void)
|
||||
|
||||
// Render texture initialization, used to hold the rendering result so we can easily resize it
|
||||
RenderTexture2D target = LoadRenderTexture(gameScreenWidth, gameScreenHeight);
|
||||
SetTextureFilter(target.texture, FILTER_BILINEAR); // Texture scale filter to use
|
||||
SetTextureFilter(target.texture, TEXTURE_FILTER_BILINEAR); // Texture scale filter to use
|
||||
|
||||
Color colors[10] = { 0 };
|
||||
for (int i = 0; i < 10; i++) colors[i] = (Color){ GetRandomValue(100, 250), GetRandomValue(50, 150), GetRandomValue(10, 100), 255 };
|
||||
@@ -79,28 +79,24 @@ int main(void)
|
||||
|
||||
// Draw
|
||||
//----------------------------------------------------------------------------------
|
||||
BeginDrawing();
|
||||
ClearBackground(BLACK);
|
||||
|
||||
// Draw everything in the render texture, note this will not be rendered on screen, yet
|
||||
BeginTextureMode(target);
|
||||
|
||||
ClearBackground(RAYWHITE); // Clear render texture background color
|
||||
|
||||
for (int i = 0; i < 10; i++) DrawRectangle(0, (gameScreenHeight/10)*i, gameScreenWidth, gameScreenHeight/10, colors[i]);
|
||||
|
||||
DrawText("If executed inside a window,\nyou can resize the window,\nand see the screen scaling!", 10, 25, 20, WHITE);
|
||||
|
||||
DrawText(TextFormat("Default Mouse: [%i , %i]", (int)mouse.x, (int)mouse.y), 350, 25, 20, GREEN);
|
||||
DrawText(TextFormat("Virtual Mouse: [%i , %i]", (int)virtualMouse.x, (int)virtualMouse.y), 350, 55, 20, YELLOW);
|
||||
|
||||
EndTextureMode();
|
||||
|
||||
// Draw RenderTexture2D to window, properly scaled
|
||||
BeginDrawing();
|
||||
ClearBackground(BLACK); // Clear screen background
|
||||
|
||||
// Draw render texture to screen, properly scaled
|
||||
DrawTexturePro(target.texture, (Rectangle){ 0.0f, 0.0f, (float)target.texture.width, (float)-target.texture.height },
|
||||
(Rectangle){ (GetScreenWidth() - ((float)gameScreenWidth*scale))*0.5f, (GetScreenHeight() - ((float)gameScreenHeight*scale))*0.5f,
|
||||
(float)gameScreenWidth*scale, (float)gameScreenHeight*scale }, (Vector2){ 0, 0 }, 0.0f, WHITE);
|
||||
|
||||
EndDrawing();
|
||||
//--------------------------------------------------------------------------------------
|
||||
}
|
||||
|
@@ -17,7 +17,7 @@ uniform vec2 leftScreenCenter;
|
||||
uniform vec2 rightScreenCenter;
|
||||
uniform vec2 scale;
|
||||
uniform vec2 scaleIn;
|
||||
uniform vec4 hmdWarpParam;
|
||||
uniform vec4 deviceWarpParam;
|
||||
uniform vec4 chromaAbParam;
|
||||
|
||||
void main()
|
||||
@@ -27,7 +27,7 @@ void main()
|
||||
vec2 screenCenter = fragTexCoord.x < 0.5? leftScreenCenter : rightScreenCenter;
|
||||
vec2 theta = (fragTexCoord - lensCenter)*scaleIn;
|
||||
float rSq = theta.x*theta.x + theta.y*theta.y;
|
||||
vec2 theta1 = theta*(hmdWarpParam.x + hmdWarpParam.y*rSq + hmdWarpParam.z*rSq*rSq + hmdWarpParam.w*rSq*rSq*rSq);
|
||||
vec2 theta1 = theta*(deviceWarpParam.x + deviceWarpParam.y*rSq + deviceWarpParam.z*rSq*rSq + deviceWarpParam.w*rSq*rSq*rSq);
|
||||
vec2 thetaBlue = theta1*(chromaAbParam.z + chromaAbParam.w*rSq);
|
||||
vec2 tcBlue = lensCenter + scale*thetaBlue;
|
||||
|
||||
|
@@ -18,7 +18,7 @@ uniform vec2 leftScreenCenter = vec2(0.25, 0.5);
|
||||
uniform vec2 rightScreenCenter = vec2(0.75, 0.5);
|
||||
uniform vec2 scale = vec2(0.25, 0.45);
|
||||
uniform vec2 scaleIn = vec2(4, 2.2222);
|
||||
uniform vec4 hmdWarpParam = vec4(1, 0.22, 0.24, 0);
|
||||
uniform vec4 deviceWarpParam = vec4(1, 0.22, 0.24, 0);
|
||||
uniform vec4 chromaAbParam = vec4(0.996, -0.004, 1.014, 0.0);
|
||||
|
||||
void main()
|
||||
@@ -28,7 +28,7 @@ void main()
|
||||
vec2 screenCenter = fragTexCoord.x < 0.5? leftScreenCenter : rightScreenCenter;
|
||||
vec2 theta = (fragTexCoord - lensCenter)*scaleIn;
|
||||
float rSq = theta.x*theta.x + theta.y*theta.y;
|
||||
vec2 theta1 = theta*(hmdWarpParam.x + hmdWarpParam.y*rSq + hmdWarpParam.z*rSq*rSq + hmdWarpParam.w*rSq*rSq*rSq);
|
||||
vec2 theta1 = theta*(deviceWarpParam.x + deviceWarpParam.y*rSq + deviceWarpParam.z*rSq*rSq + deviceWarpParam.w*rSq*rSq*rSq);
|
||||
vec2 thetaBlue = theta1*(chromaAbParam.z + chromaAbParam.w*rSq);
|
||||
vec2 tcBlue = lensCenter + scale*thetaBlue;
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
WELCOME raylib EXAMPLES CONTRIBUTOR!
|
||||
|
||||
This is a bsasic template to anyone ready to contribute with some code example for the library,
|
||||
This is a basic template to anyone ready to contribute with some code example for the library,
|
||||
here there are some guidelines on how to create an example to be included in raylib
|
||||
|
||||
1. File naming: <module>_<description> - Lower case filename, words separated by underscore,
|
||||
@@ -41,16 +41,18 @@
|
||||
*
|
||||
* raylib [core] example - Basic window
|
||||
*
|
||||
* This example has been created using raylib 2.5 (www.raylib.com)
|
||||
* This example has been created using raylib 3.8 (www.raylib.com)
|
||||
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||
*
|
||||
* Copyright (c) 2019 Ramon Santamaria (@raysan5)
|
||||
* Example contributed by <user_name> (@<user_github>) and reviewed by Ramon Santamaria (@raysan5)
|
||||
*
|
||||
* Copyright (c) 2021 <user_name> (@<user_github>)
|
||||
*
|
||||
********************************************************************************************/
|
||||
|
||||
#include "raylib.h"
|
||||
|
||||
int main()
|
||||
int main(void)
|
||||
{
|
||||
// Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
@@ -39,15 +39,15 @@ int main(void)
|
||||
camera.fovy = 45.0f; // Camera field-of-view Y
|
||||
camera.projection = CAMERA_PERSPECTIVE; // Camera mode type
|
||||
|
||||
Model model = LoadModel("resources/guy/guy.iqm"); // Load the animated model mesh and basic data
|
||||
Texture2D texture = LoadTexture("resources/guy/guytex.png"); // Load model texture and set material
|
||||
SetMaterialTexture(&model.materials[0], MAP_DIFFUSE, texture); // Set model material map texture
|
||||
Model model = LoadModel("resources/models/iqm/guy.iqm"); // Load the animated model mesh and basic data
|
||||
Texture2D texture = LoadTexture("resources/models/iqm/guytex.png"); // Load model texture and set material
|
||||
SetMaterialTexture(&model.materials[0], MATERIAL_MAP_DIFFUSE, texture); // Set model material map texture
|
||||
|
||||
Vector3 position = { 0.0f, 0.0f, 0.0f }; // Set model position
|
||||
|
||||
// Load animation data
|
||||
int animsCount = 0;
|
||||
ModelAnimation *anims = LoadModelAnimations("resources/guy/guyanim.iqm", &animsCount);
|
||||
unsigned int animsCount = 0;
|
||||
ModelAnimation *anims = LoadModelAnimations("resources/models/iqm/guyanim.iqm", &animsCount);
|
||||
int animFrameCounter = 0;
|
||||
|
||||
SetCameraMode(camera, CAMERA_FREE); // Set free camera mode
|
||||
@@ -102,7 +102,7 @@ int main(void)
|
||||
UnloadTexture(texture); // Unload texture
|
||||
|
||||
// Unload model animations data
|
||||
for (int i = 0; i < animsCount; i++) UnloadModelAnimation(anims[i]);
|
||||
for (unsigned int i = 0; i < animsCount; i++) UnloadModelAnimation(anims[i]);
|
||||
RL_FREE(anims);
|
||||
|
||||
UnloadModel(model); // Unload model
|
||||
|
@@ -1,122 +0,0 @@
|
||||
/*******************************************************************************************
|
||||
*
|
||||
* raylib [models] example - Load 3d gltf model with animations and play them
|
||||
*
|
||||
* This example has been created using raylib 3.5 (www.raylib.com)
|
||||
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||
*
|
||||
* Example contributed by Hristo Stamenov (@object71) and reviewed by Ramon Santamaria (@raysan5)
|
||||
*
|
||||
* Copyright (c) 2021 Hristo Stamenov (@object71) and Ramon Santamaria (@raysan5)
|
||||
*
|
||||
********************************************************************************************
|
||||
*
|
||||
* To export a model from blender, make sure it is not posed, the vertices need to be in the
|
||||
* same position as they would be in edit mode.
|
||||
* and that the scale of your models is set to 0. Scaling can be done from the export menu.
|
||||
*
|
||||
********************************************************************************************/
|
||||
|
||||
#include "raylib.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
int main(void)
|
||||
{
|
||||
// Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
const int screenWidth = 800;
|
||||
const int screenHeight = 450;
|
||||
|
||||
InitWindow(screenWidth, screenHeight, "raylib [models] example - model animation");
|
||||
|
||||
// Define the camera to look into our 3d world
|
||||
Camera camera = { 0 };
|
||||
camera.position = (Vector3){ 10.0f, 10.0f, 10.0f }; // Camera position
|
||||
camera.target = (Vector3){ 0.0f, 0.0f, 0.0f }; // Camera looking at point
|
||||
camera.up = (Vector3){ 0.0f, 1.0f, 0.0f }; // Camera up vector (rotation towards target)
|
||||
camera.fovy = 45.0f; // Camera field-of-view Y
|
||||
camera.projection = CAMERA_PERSPECTIVE; // Camera mode type
|
||||
|
||||
Model model = LoadModel("resources/gltf/rigged_figure.glb"); // Load the animated model mesh and
|
||||
// basic data
|
||||
// Texture2D texture = LoadTexture("resources/guy/guytex.png"); // Load model texture and set material
|
||||
// SetMaterialTexture(&model.materials[0], MAP_DIFFUSE, texture); // Set model material map texture
|
||||
|
||||
Vector3 position = { 0.0f, 0.0f, 0.0f }; // Set model position
|
||||
|
||||
// Load animation data
|
||||
int animsCount = 0;
|
||||
ModelAnimation *anims = LoadModelAnimations("resources/gltf/rigged_figure.glb", &animsCount);
|
||||
int animFrameCounter = 0;
|
||||
int animationDirection = 1;
|
||||
|
||||
SetCameraMode(camera, CAMERA_FREE); // Set free camera mode
|
||||
|
||||
SetTargetFPS(30); // Set our game to run at 60 frames-per-second
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
// Main game loop
|
||||
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||
{
|
||||
// Update
|
||||
//----------------------------------------------------------------------------------
|
||||
UpdateCamera(&camera);
|
||||
|
||||
// Play animation when spacebar is held down
|
||||
if (IsKeyDown(KEY_SPACE))
|
||||
{
|
||||
animFrameCounter += animationDirection;
|
||||
|
||||
if (animFrameCounter >= anims[0].frameCount || animFrameCounter <= 0)
|
||||
{
|
||||
animationDirection *= -1;
|
||||
animFrameCounter += animationDirection;
|
||||
}
|
||||
|
||||
UpdateModelAnimation(model, anims[0], animFrameCounter);
|
||||
}
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
// Draw
|
||||
//----------------------------------------------------------------------------------
|
||||
BeginDrawing();
|
||||
|
||||
ClearBackground(RAYWHITE);
|
||||
|
||||
BeginMode3D(camera);
|
||||
|
||||
DrawModelEx(model, position, (Vector3){ 1.0f, 0.0f, 0.0f }, -90.0f, (Vector3){ 1.0f, 1.0f, 1.0f }, WHITE);
|
||||
|
||||
for (int i = 0; i < model.boneCount; i++)
|
||||
{
|
||||
DrawSphere(anims[0].framePoses[animFrameCounter][i].translation, 0.01f, RED);
|
||||
}
|
||||
|
||||
DrawGrid(10, 1.0f); // Draw a grid
|
||||
|
||||
EndMode3D();
|
||||
|
||||
DrawText("PRESS SPACE to PLAY MODEL ANIMATION", 10, 10, 20, MAROON);
|
||||
DrawText("(cc4) Rigged Figure by @Cesium", screenWidth - 200, screenHeight - 20, 10, GRAY);
|
||||
|
||||
EndDrawing();
|
||||
//----------------------------------------------------------------------------------
|
||||
}
|
||||
|
||||
// De-Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
// UnloadTexture(texture); // Unload texture
|
||||
|
||||
// Unload model animations data
|
||||
for (int i = 0; i < animsCount; i++) UnloadModelAnimation(anims[i]);
|
||||
RL_FREE(anims);
|
||||
|
||||
UnloadModel(model); // Unload model
|
||||
|
||||
CloseWindow(); // Close window and OpenGL context
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
return 0;
|
||||
}
|
@@ -4,17 +4,19 @@
|
||||
*
|
||||
* raylib supports multiple models file formats:
|
||||
*
|
||||
* - OBJ > Text file, must include vertex position-texcoords-normals information,
|
||||
* if files references some .mtl materials file, it will be loaded (or try to)
|
||||
* - GLTF > Modern text/binary file format, includes lot of information and it could
|
||||
* also reference external files, raylib will try loading mesh and materials data
|
||||
* - IQM > Binary file format including mesh vertex data but also animation data,
|
||||
* - OBJ > Text file format. Must include vertex position-texcoords-normals information,
|
||||
* if files references some .mtl materials file, it will be loaded (or try to).
|
||||
* - GLTF > Text/binary file format. Includes lot of information and it could
|
||||
* also reference external files, raylib will try loading mesh and materials data.
|
||||
* - IQM > Binary file format. Includes mesh vertex data but also animation data,
|
||||
* raylib can load .iqm animations.
|
||||
* - VOX > Binary file format. MagikaVoxel mesh format:
|
||||
* https://github.com/ephtracy/voxel-model/blob/master/MagicaVoxel-file-format-vox.txt
|
||||
*
|
||||
* This example has been created using raylib 2.6 (www.raylib.com)
|
||||
* This example has been created using raylib 4.0 (www.raylib.com)
|
||||
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||
*
|
||||
* Copyright (c) 2014-2019 Ramon Santamaria (@raysan5)
|
||||
* Copyright (c) 2014-2021 Ramon Santamaria (@raysan5)
|
||||
*
|
||||
********************************************************************************************/
|
||||
|
||||
@@ -37,13 +39,13 @@ int main(void)
|
||||
camera.fovy = 45.0f; // Camera field-of-view Y
|
||||
camera.projection = CAMERA_PERSPECTIVE; // Camera mode type
|
||||
|
||||
Model model = LoadModel("resources/models/castle.obj"); // Load model
|
||||
Texture2D texture = LoadTexture("resources/models/castle_diffuse.png"); // Load model texture
|
||||
Model model = LoadModel("resources/models/obj/castle.obj"); // Load model
|
||||
Texture2D texture = LoadTexture("resources/models/obj/castle_diffuse.png"); // Load model texture
|
||||
model.materials[0].maps[MATERIAL_MAP_DIFFUSE].texture = texture; // Set map diffuse texture
|
||||
|
||||
Vector3 position = { 0.0f, 0.0f, 0.0f }; // Set model position
|
||||
|
||||
BoundingBox bounds = MeshBoundingBox(model.meshes[0]); // Set model bounds
|
||||
BoundingBox bounds = GetMeshBoundingBox(model.meshes[0]); // Set model bounds
|
||||
|
||||
// NOTE: bounds are calculated from the original size of the model,
|
||||
// if model is scaled on drawing, bounds must be also scaled
|
||||
@@ -72,13 +74,15 @@ int main(void)
|
||||
{
|
||||
if (IsFileExtension(droppedFiles[0], ".obj") ||
|
||||
IsFileExtension(droppedFiles[0], ".gltf") ||
|
||||
IsFileExtension(droppedFiles[0], ".glb") ||
|
||||
IsFileExtension(droppedFiles[0], ".vox") ||
|
||||
IsFileExtension(droppedFiles[0], ".iqm")) // Model file formats supported
|
||||
{
|
||||
UnloadModel(model); // Unload previous model
|
||||
model = LoadModel(droppedFiles[0]); // Load new model
|
||||
model.materials[0].maps[MATERIAL_MAP_DIFFUSE].texture = texture; // Set current map diffuse texture
|
||||
|
||||
bounds = MeshBoundingBox(model.meshes[0]);
|
||||
bounds = GetMeshBoundingBox(model.meshes[0]);
|
||||
|
||||
// TODO: Move camera position from target enough distance to visualize model properly
|
||||
}
|
||||
@@ -95,10 +99,10 @@ int main(void)
|
||||
}
|
||||
|
||||
// Select model on mouse click
|
||||
if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON))
|
||||
if (IsMouseButtonPressed(MOUSE_BUTTON_LEFT))
|
||||
{
|
||||
// Check collision between ray and box
|
||||
if (CheckCollisionRayBox(GetMouseRay(GetMousePosition(), camera), bounds)) selected = !selected;
|
||||
if (GetRayCollisionBox(GetMouseRay(GetMousePosition(), camera), bounds).hit) selected = !selected;
|
||||
else selected = false;
|
||||
}
|
||||
//----------------------------------------------------------------------------------
|
||||
|
@@ -1,27 +1,24 @@
|
||||
/*******************************************************************************************
|
||||
*
|
||||
* raylib [models] example - Load 3d gltf model
|
||||
* raylib [models] example - Load models gltf
|
||||
*
|
||||
* This example has been created using raylib 3.5 (www.raylib.com)
|
||||
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||
*
|
||||
* NOTE: To export a model from Blender, make sure it is not posed, the vertices need to be
|
||||
* in the same position as they would be in edit mode.
|
||||
* Also make sure the scale parameter of your models is set to 0.0,
|
||||
* scaling can be applied from the export menu.
|
||||
*
|
||||
* Example contributed by Hristo Stamenov (@object71) and reviewed by Ramon Santamaria (@raysan5)
|
||||
*
|
||||
* Copyright (c) 2021 Hristo Stamenov (@object71) and Ramon Santamaria (@raysan5)
|
||||
*
|
||||
********************************************************************************************
|
||||
*
|
||||
* To export a model from blender, make sure it is not posed, the vertices need to be in the
|
||||
* same position as they would be in edit mode.
|
||||
* and that the scale of your models is set to 0. Scaling can be done from the export menu.
|
||||
*
|
||||
********************************************************************************************/
|
||||
|
||||
#include "raylib.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#define MAX_MODELS 6
|
||||
#define MAX_GLTF_MODELS 8
|
||||
|
||||
int main(void)
|
||||
{
|
||||
@@ -30,7 +27,7 @@ int main(void)
|
||||
const int screenWidth = 800;
|
||||
const int screenHeight = 450;
|
||||
|
||||
InitWindow(screenWidth, screenHeight, "raylib [models] example - model animation");
|
||||
InitWindow(screenWidth, screenHeight, "raylib [models] example - model");
|
||||
|
||||
// Define the camera to look into our 3d world
|
||||
Camera camera = { 0 };
|
||||
@@ -40,14 +37,16 @@ int main(void)
|
||||
camera.fovy = 45.0f; // Camera field-of-view Y
|
||||
camera.projection = CAMERA_PERSPECTIVE; // Camera mode type
|
||||
|
||||
Model model[MAX_MODELS] = { 0 };
|
||||
|
||||
model[0] = LoadModel("resources/gltf/raylib_32x32.glb");
|
||||
model[1] = LoadModel("resources/gltf/rigged_figure.glb");
|
||||
model[2] = LoadModel("resources/gltf/GearboxAssy.glb");
|
||||
model[3] = LoadModel("resources/gltf/BoxAnimated.glb");
|
||||
model[4] = LoadModel("resources/gltf/AnimatedTriangle.gltf");
|
||||
model[5] = LoadModel("resources/gltf/AnimatedMorphCube.glb");
|
||||
// Load some models
|
||||
Model model[MAX_GLTF_MODELS] = { 0 };
|
||||
model[0] = LoadModel("resources/models/gltf/raylib_32x32.glb");
|
||||
model[1] = LoadModel("resources/models/gltf/rigged_figure.glb");
|
||||
model[2] = LoadModel("resources/models/gltf/GearboxAssy.glb");
|
||||
model[3] = LoadModel("resources/models/gltf/BoxAnimated.glb");
|
||||
model[4] = LoadModel("resources/models/gltf/AnimatedTriangle.gltf");
|
||||
model[5] = LoadModel("resources/models/gltf/AnimatedMorphCube.glb");
|
||||
model[6] = LoadModel("resources/models/gltf/vertex_colored_object.glb");
|
||||
model[7] = LoadModel("resources/models/gltf/girl.glb");
|
||||
|
||||
int currentModel = 0;
|
||||
|
||||
@@ -63,19 +62,20 @@ int main(void)
|
||||
{
|
||||
// Update
|
||||
//----------------------------------------------------------------------------------
|
||||
UpdateCamera(&camera);
|
||||
UpdateCamera(&camera); // Update our camera with inputs
|
||||
|
||||
if (IsKeyReleased(KEY_RIGHT))
|
||||
{
|
||||
currentModel++;
|
||||
if (currentModel == MAX_MODELS) currentModel = 0;
|
||||
if (currentModel == MAX_GLTF_MODELS) currentModel = 0;
|
||||
}
|
||||
|
||||
if (IsKeyReleased(KEY_LEFT))
|
||||
{
|
||||
currentModel--;
|
||||
if (currentModel < 0) currentModel = MAX_MODELS - 1;
|
||||
if (currentModel < 0) currentModel = MAX_GLTF_MODELS - 1;
|
||||
}
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
// Draw
|
||||
//----------------------------------------------------------------------------------
|
||||
@@ -85,8 +85,7 @@ int main(void)
|
||||
|
||||
BeginMode3D(camera);
|
||||
|
||||
DrawModelEx(model[currentModel], position, (Vector3){ 0.0f, 1.0f, 0.0f }, 180.0f, (Vector3){ 2.0f, 2.0f, 2.0f }, WHITE);
|
||||
|
||||
DrawModel(model[currentModel], position, 1.0f, WHITE);
|
||||
DrawGrid(10, 1.0f); // Draw a grid
|
||||
|
||||
EndMode3D();
|
||||
@@ -97,7 +96,7 @@ int main(void)
|
||||
|
||||
// De-Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
for(int i = 0; i < MAX_MODELS; i++) UnloadModel(model[i]); // Unload models
|
||||
for (int i = 0; i < MAX_GLTF_MODELS; i++) UnloadModel(model[i]); // Unload models
|
||||
|
||||
CloseWindow(); // Close window and OpenGL context
|
||||
//--------------------------------------------------------------------------------------
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 21 KiB |
130
examples/models/models_loading_vox.c
Normal file
@@ -0,0 +1,130 @@
|
||||
/*******************************************************************************************
|
||||
*
|
||||
* raylib [models] example - Load models vox (MagicaVoxel)
|
||||
*
|
||||
* This example has been created using raylib 4.0 (www.raylib.com)
|
||||
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||
*
|
||||
* Example contributed by Johann Nadalutti (@procfxgen) and reviewed by Ramon Santamaria (@raysan5)
|
||||
*
|
||||
* Copyright (c) 2021 Johann Nadalutti (@procfxgen) and Ramon Santamaria (@raysan5)
|
||||
*
|
||||
********************************************************************************************/
|
||||
|
||||
#include "raylib.h"
|
||||
|
||||
#include "raymath.h" // Required for: MatrixTranslate()
|
||||
|
||||
#define MAX_VOX_FILES 3
|
||||
|
||||
int main(void)
|
||||
{
|
||||
// Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
const int screenWidth = 800;
|
||||
const int screenHeight = 450;
|
||||
|
||||
const char *voxFileNames[] = {
|
||||
"resources/models/vox/chr_knight.vox",
|
||||
"resources/models/vox/chr_sword.vox",
|
||||
"resources/models/vox/monu9.vox"
|
||||
};
|
||||
|
||||
InitWindow(screenWidth, screenHeight, "raylib [models] example - magicavoxel loading");
|
||||
|
||||
// Define the camera to look into our 3d world
|
||||
Camera camera = { 0 };
|
||||
camera.position = (Vector3){ 10.0f, 10.0f, 10.0f }; // Camera position
|
||||
camera.target = (Vector3){ 0.0f, 0.0f, 0.0f }; // Camera looking at point
|
||||
camera.up = (Vector3){ 0.0f, 1.0f, 0.0f }; // Camera up vector (rotation towards target)
|
||||
camera.fovy = 45.0f; // Camera field-of-view Y
|
||||
camera.projection = CAMERA_PERSPECTIVE; // Camera mode type
|
||||
|
||||
// Load MagicaVoxel files
|
||||
Model models[MAX_VOX_FILES] = { 0 };
|
||||
|
||||
for (int i = 0; i < MAX_VOX_FILES; i++)
|
||||
{
|
||||
// Load VOX file and measure time
|
||||
double t0 = GetTime()*1000.0;
|
||||
models[i] = LoadModel(voxFileNames[i]);
|
||||
double t1 = GetTime()*1000.0;
|
||||
|
||||
TraceLog(LOG_WARNING, TextFormat("[%s] File loaded in %.3f ms", voxFileNames[i], t1 - t0));
|
||||
|
||||
// Compute model translation matrix to center model on draw position (0, 0 , 0)
|
||||
BoundingBox bb = GetModelBoundingBox(models[i]);
|
||||
Vector3 center = { 0 };
|
||||
center.x = bb.min.x + (((bb.max.x - bb.min.x)/2));
|
||||
center.z = bb.min.z + (((bb.max.z - bb.min.z)/2));
|
||||
|
||||
Matrix matTranslate = MatrixTranslate(-center.x, 0, -center.z);
|
||||
models[i].transform = matTranslate;
|
||||
}
|
||||
|
||||
int currentModel = 0;
|
||||
|
||||
SetCameraMode(camera, CAMERA_ORBITAL); // Set a orbital camera mode
|
||||
|
||||
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
// Main game loop
|
||||
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||
{
|
||||
// Update
|
||||
//----------------------------------------------------------------------------------
|
||||
UpdateCamera(&camera); // Update our camera to orbit
|
||||
|
||||
// Cycle between models on mouse click
|
||||
if (IsMouseButtonPressed(MOUSE_BUTTON_LEFT)) currentModel = (currentModel + 1)%MAX_VOX_FILES;
|
||||
|
||||
// Cycle between models on key pressed
|
||||
if (IsKeyPressed(KEY_RIGHT))
|
||||
{
|
||||
currentModel++;
|
||||
if (currentModel >= MAX_VOX_FILES) currentModel = 0;
|
||||
}
|
||||
else if (IsKeyPressed(KEY_LEFT))
|
||||
{
|
||||
currentModel--;
|
||||
if (currentModel < 0) currentModel = MAX_VOX_FILES - 1;
|
||||
}
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
// Draw
|
||||
//----------------------------------------------------------------------------------
|
||||
BeginDrawing();
|
||||
|
||||
ClearBackground(RAYWHITE);
|
||||
|
||||
// Draw 3D model
|
||||
BeginMode3D(camera);
|
||||
|
||||
DrawModel(models[currentModel], (Vector3){ 0, 0, 0 }, 1.0f, WHITE);
|
||||
DrawGrid(10, 1.0);
|
||||
|
||||
EndMode3D();
|
||||
|
||||
// Display info
|
||||
DrawRectangle(10, 400, 310, 30, Fade(SKYBLUE, 0.5f));
|
||||
DrawRectangleLines(10, 400, 310, 30, Fade(DARKBLUE, 0.5f));
|
||||
DrawText("MOUSE LEFT BUTTON to CYCLE VOX MODELS", 40, 410, 10, BLUE);
|
||||
DrawText(TextFormat("File: %s", GetFileName(voxFileNames[currentModel])), 10, 10, 20, GRAY);
|
||||
|
||||
EndDrawing();
|
||||
//----------------------------------------------------------------------------------
|
||||
}
|
||||
|
||||
// De-Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
// Unload models data (GPU VRAM)
|
||||
for (int i = 0; i < MAX_VOX_FILES; i++) UnloadModel(models[i]);
|
||||
|
||||
CloseWindow(); // Close window and OpenGL context
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
BIN
examples/models/models_loading_vox.png
Normal file
After Width: | Height: | Size: 23 KiB |
@@ -1,529 +0,0 @@
|
||||
/*******************************************************************************************
|
||||
*
|
||||
* raylib [models] example - PBR material
|
||||
*
|
||||
* NOTE: This example requires raylib OpenGL 3.3 for shaders support and only #version 330
|
||||
* is currently supported. OpenGL ES 2.0 platforms are not supported at the moment.
|
||||
*
|
||||
* This example has been created using raylib 1.8 (www.raylib.com)
|
||||
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||
*
|
||||
* Copyright (c) 2017 Ramon Santamaria (@raysan5)
|
||||
*
|
||||
********************************************************************************************/
|
||||
|
||||
#include "raylib.h"
|
||||
#include "raymath.h"
|
||||
#include "rlgl.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#define RLIGHTS_IMPLEMENTATION
|
||||
#include "rlights.h"
|
||||
|
||||
#if defined(PLATFORM_DESKTOP)
|
||||
#define GLSL_VERSION 330
|
||||
#else // PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB
|
||||
#define GLSL_VERSION 100
|
||||
#endif
|
||||
|
||||
#define CUBEMAP_SIZE 1024 // Cubemap texture size
|
||||
#define IRRADIANCE_SIZE 32 // Irradiance texture size
|
||||
#define PREFILTERED_SIZE 256 // Prefiltered HDR environment texture size
|
||||
#define BRDF_SIZE 512 // BRDF LUT texture size
|
||||
#define LIGHT_DISTANCE 1000.0f
|
||||
#define LIGHT_HEIGHT 1.0f
|
||||
|
||||
// PBR texture maps generation
|
||||
static TextureCubemap GenTextureCubemap(Shader shader, Texture2D panorama, int size, int format); // Generate cubemap (6 faces) from equirectangular (panorama) texture
|
||||
static TextureCubemap GenTextureIrradiance(Shader shader, TextureCubemap cubemap, int size); // Generate irradiance cubemap using cubemap texture
|
||||
static TextureCubemap GenTexturePrefilter(Shader shader, TextureCubemap cubemap, int size); // Generate prefilter cubemap using cubemap texture
|
||||
static Texture2D GenTextureBRDF(Shader shader, int size); // Generate a generic BRDF texture
|
||||
|
||||
// PBR material loading
|
||||
static Material LoadMaterialPBR(Color albedo, float metalness, float roughness);
|
||||
|
||||
int main(void)
|
||||
{
|
||||
// Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
const int screenWidth = 800;
|
||||
const int screenHeight = 450;
|
||||
|
||||
SetConfigFlags(FLAG_MSAA_4X_HINT); // Enable Multi Sampling Anti Aliasing 4x (if available)
|
||||
InitWindow(screenWidth, screenHeight, "raylib [models] example - pbr material");
|
||||
|
||||
// Define the camera to look into our 3d world
|
||||
Camera camera = { 0 };
|
||||
camera.position = (Vector3){ 4.0f, 4.0f, 4.0f }; // Camera position
|
||||
camera.target = (Vector3){ 0.0f, 0.5f, 0.0f }; // Camera looking at point
|
||||
camera.up = (Vector3){ 0.0f, 1.0f, 0.0f }; // Camera up vector (rotation towards target)
|
||||
camera.fovy = 45.0f; // Camera field-of-view Y
|
||||
camera.projection = CAMERA_PERSPECTIVE; // Camera mode type
|
||||
|
||||
// Load model and PBR material
|
||||
Model model = LoadModel("resources/pbr/trooper.obj");
|
||||
|
||||
// Mesh tangents are generated... and uploaded to GPU
|
||||
// NOTE: New VBO for tangents is generated at default location and also binded to mesh VAO
|
||||
//MeshTangents(&model.meshes[0]);
|
||||
|
||||
model.materials[0] = LoadMaterialPBR((Color){ 255, 255, 255, 255 }, 1.0f, 1.0f);
|
||||
|
||||
// Create lights
|
||||
// NOTE: Lights are added to an internal lights pool automatically
|
||||
CreateLight(LIGHT_POINT, (Vector3){ LIGHT_DISTANCE, LIGHT_HEIGHT, 0.0f }, (Vector3){ 0.0f, 0.0f, 0.0f }, (Color){ 255, 0, 0, 255 }, model.materials[0].shader);
|
||||
CreateLight(LIGHT_POINT, (Vector3){ 0.0f, LIGHT_HEIGHT, LIGHT_DISTANCE }, (Vector3){ 0.0f, 0.0f, 0.0f }, (Color){ 0, 255, 0, 255 }, model.materials[0].shader);
|
||||
CreateLight(LIGHT_POINT, (Vector3){ -LIGHT_DISTANCE, LIGHT_HEIGHT, 0.0f }, (Vector3){ 0.0f, 0.0f, 0.0f }, (Color){ 0, 0, 255, 255 }, model.materials[0].shader);
|
||||
CreateLight(LIGHT_DIRECTIONAL, (Vector3){ 0.0f, LIGHT_HEIGHT*2.0f, -LIGHT_DISTANCE }, (Vector3){ 0.0f, 0.0f, 0.0f }, (Color){ 255, 0, 255, 255 }, model.materials[0].shader);
|
||||
|
||||
SetCameraMode(camera, CAMERA_ORBITAL); // Set an orbital camera mode
|
||||
|
||||
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
// Main game loop
|
||||
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||
{
|
||||
// Update
|
||||
//----------------------------------------------------------------------------------
|
||||
UpdateCamera(&camera); // Update camera
|
||||
|
||||
// Send to material PBR shader camera view position
|
||||
float cameraPos[3] = { camera.position.x, camera.position.y, camera.position.z };
|
||||
SetShaderValue(model.materials[0].shader, model.materials[0].shader.locs[SHADER_LOC_VECTOR_VIEW], cameraPos, SHADER_UNIFORM_VEC3);
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
// Draw
|
||||
//----------------------------------------------------------------------------------
|
||||
BeginDrawing();
|
||||
|
||||
ClearBackground(RAYWHITE);
|
||||
|
||||
BeginMode3D(camera);
|
||||
|
||||
DrawModel(model, Vector3Zero(), 1.0f, WHITE);
|
||||
|
||||
DrawGrid(10, 1.0f);
|
||||
|
||||
EndMode3D();
|
||||
|
||||
DrawFPS(10, 10);
|
||||
|
||||
EndDrawing();
|
||||
//----------------------------------------------------------------------------------
|
||||
}
|
||||
|
||||
// De-Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
UnloadMaterial(model.materials[0]); // Unload material: shader and textures
|
||||
|
||||
UnloadModel(model); // Unload model
|
||||
|
||||
CloseWindow(); // Close window and OpenGL context
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Load PBR material (Supports: ALBEDO, NORMAL, METALNESS, ROUGHNESS, AO, EMMISIVE, HEIGHT maps)
|
||||
// NOTE: PBR shader is loaded inside this function
|
||||
static Material LoadMaterialPBR(Color albedo, float metalness, float roughness)
|
||||
{
|
||||
Material mat = LoadMaterialDefault(); // Initialize material to default
|
||||
|
||||
// Load PBR shader (requires several maps)
|
||||
mat.shader = LoadShader(TextFormat("resources/shaders/glsl%i/pbr.vs", GLSL_VERSION),
|
||||
TextFormat("resources/shaders/glsl%i/pbr.fs", GLSL_VERSION));
|
||||
|
||||
// Get required locations points for PBR material
|
||||
// NOTE: Those location names must be available and used in the shader code
|
||||
mat.shader.locs[SHADER_LOC_MAP_ALBEDO] = GetShaderLocation(mat.shader, "albedo.sampler");
|
||||
mat.shader.locs[SHADER_LOC_MAP_METALNESS] = GetShaderLocation(mat.shader, "metalness.sampler");
|
||||
mat.shader.locs[SHADER_LOC_MAP_NORMAL] = GetShaderLocation(mat.shader, "normals.sampler");
|
||||
mat.shader.locs[SHADER_LOC_MAP_ROUGHNESS] = GetShaderLocation(mat.shader, "roughness.sampler");
|
||||
mat.shader.locs[SHADER_LOC_MAP_OCCLUSION] = GetShaderLocation(mat.shader, "occlusion.sampler");
|
||||
//mat.shader.locs[SHADER_LOC_MAP_EMISSION] = GetShaderLocation(mat.shader, "emission.sampler");
|
||||
//mat.shader.locs[SHADER_LOC_MAP_HEIGHT] = GetShaderLocation(mat.shader, "height.sampler");
|
||||
mat.shader.locs[SHADER_LOC_MAP_IRRADIANCE] = GetShaderLocation(mat.shader, "irradianceMap");
|
||||
mat.shader.locs[SHADER_LOC_MAP_PREFILTER] = GetShaderLocation(mat.shader, "prefilterMap");
|
||||
mat.shader.locs[SHADER_LOC_MAP_BRDF] = GetShaderLocation(mat.shader, "brdfLUT");
|
||||
|
||||
// Set view matrix location
|
||||
mat.shader.locs[SHADER_LOC_MATRIX_MODEL] = GetShaderLocation(mat.shader, "matModel");
|
||||
//mat.shader.locs[SHADER_LOC_MATRIX_VIEW] = GetShaderLocation(mat.shader, "view");
|
||||
mat.shader.locs[SHADER_LOC_VECTOR_VIEW] = GetShaderLocation(mat.shader, "viewPos");
|
||||
|
||||
// Set PBR standard maps
|
||||
mat.maps[MATERIAL_MAP_ALBEDO].texture = LoadTexture("resources/pbr/trooper_albedo.png");
|
||||
mat.maps[MATERIAL_MAP_NORMAL].texture = LoadTexture("resources/pbr/trooper_normals.png");
|
||||
mat.maps[MATERIAL_MAP_METALNESS].texture = LoadTexture("resources/pbr/trooper_metalness.png");
|
||||
mat.maps[MATERIAL_MAP_ROUGHNESS].texture = LoadTexture("resources/pbr/trooper_roughness.png");
|
||||
mat.maps[MATERIAL_MAP_OCCLUSION].texture = LoadTexture("resources/pbr/trooper_ao.png");
|
||||
|
||||
// Set textures filtering for better quality
|
||||
SetTextureFilter(mat.maps[MATERIAL_MAP_ALBEDO].texture, FILTER_BILINEAR);
|
||||
SetTextureFilter(mat.maps[MATERIAL_MAP_NORMAL].texture, FILTER_BILINEAR);
|
||||
SetTextureFilter(mat.maps[MATERIAL_MAP_METALNESS].texture, FILTER_BILINEAR);
|
||||
SetTextureFilter(mat.maps[MATERIAL_MAP_ROUGHNESS].texture, FILTER_BILINEAR);
|
||||
SetTextureFilter(mat.maps[MATERIAL_MAP_OCCLUSION].texture, FILTER_BILINEAR);
|
||||
|
||||
// Enable sample usage in shader for assigned textures
|
||||
SetShaderValue(mat.shader, GetShaderLocation(mat.shader, "albedo.useSampler"), (int[1]){ 1 }, SHADER_UNIFORM_INT);
|
||||
SetShaderValue(mat.shader, GetShaderLocation(mat.shader, "normals.useSampler"), (int[1]){ 1 }, SHADER_UNIFORM_INT);
|
||||
SetShaderValue(mat.shader, GetShaderLocation(mat.shader, "metalness.useSampler"), (int[1]){ 1 }, SHADER_UNIFORM_INT);
|
||||
SetShaderValue(mat.shader, GetShaderLocation(mat.shader, "roughness.useSampler"), (int[1]){ 1 }, SHADER_UNIFORM_INT);
|
||||
SetShaderValue(mat.shader, GetShaderLocation(mat.shader, "occlusion.useSampler"), (int[1]){ 1 }, SHADER_UNIFORM_INT);
|
||||
|
||||
int renderModeLoc = GetShaderLocation(mat.shader, "renderMode");
|
||||
SetShaderValue(mat.shader, renderModeLoc, (int[1]){ 0 }, SHADER_UNIFORM_INT);
|
||||
|
||||
// Set up material properties color
|
||||
mat.maps[MATERIAL_MAP_ALBEDO].color = albedo;
|
||||
mat.maps[MATERIAL_MAP_NORMAL].color = (Color){ 128, 128, 255, 255 };
|
||||
mat.maps[MATERIAL_MAP_METALNESS].value = metalness;
|
||||
mat.maps[MATERIAL_MAP_ROUGHNESS].value = roughness;
|
||||
mat.maps[MATERIAL_MAP_OCCLUSION].value = 1.0f;
|
||||
mat.maps[MATERIAL_MAP_EMISSION].value = 0.5f;
|
||||
mat.maps[MATERIAL_MAP_HEIGHT].value = 0.5f;
|
||||
|
||||
// Generate cubemap from panorama texture
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
Texture2D panorama = LoadTexture("resources/dresden_square_2k.hdr");
|
||||
|
||||
// Load equirectangular to cubemap shader
|
||||
Shader shdrCubemap = LoadShader(TextFormat("resources/shaders/glsl%i/pbr.vs", GLSL_VERSION),
|
||||
TextFormat("resources/shaders/glsl%i/pbr.fs", GLSL_VERSION));
|
||||
|
||||
SetShaderValue(shdrCubemap, GetShaderLocation(shdrCubemap, "equirectangularMap"), (int[1]){ 0 }, SHADER_UNIFORM_INT);
|
||||
TextureCubemap cubemap = GenTextureCubemap(shdrCubemap, panorama, CUBEMAP_SIZE, PIXELFORMAT_UNCOMPRESSED_R32G32B32);
|
||||
UnloadTexture(panorama);
|
||||
UnloadShader(shdrCubemap);
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
|
||||
// Generate irradiance map from cubemap texture
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
// Load irradiance (GI) calculation shader
|
||||
Shader shdrIrradiance = LoadShader(TextFormat("resources/shaders/glsl%i/skybox.vs", GLSL_VERSION),
|
||||
TextFormat("resources/shaders/glsl%i/irradiance.fs", GLSL_VERSION));
|
||||
|
||||
SetShaderValue(shdrIrradiance, GetShaderLocation(shdrIrradiance, "environmentMap"), (int[1]){ 0 }, SHADER_UNIFORM_INT);
|
||||
mat.maps[MATERIAL_MAP_IRRADIANCE].texture = GenTextureIrradiance(shdrIrradiance, cubemap, IRRADIANCE_SIZE);
|
||||
UnloadShader(shdrIrradiance);
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
|
||||
// Generate prefilter map from cubemap texture
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
// Load reflection prefilter calculation shader
|
||||
Shader shdrPrefilter = LoadShader(TextFormat("resources/shaders/glsl%i/skybox.vs", GLSL_VERSION),
|
||||
TextFormat("resources/shaders/glsl%i/prefilter.fs", GLSL_VERSION));
|
||||
|
||||
SetShaderValue(shdrPrefilter, GetShaderLocation(shdrPrefilter, "environmentMap"), (int[1]){ 0 }, SHADER_UNIFORM_INT);
|
||||
mat.maps[MATERIAL_MAP_PREFILTER].texture = GenTexturePrefilter(shdrPrefilter, cubemap, PREFILTERED_SIZE);
|
||||
UnloadTexture(cubemap);
|
||||
UnloadShader(shdrPrefilter);
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
|
||||
// Generate BRDF (bidirectional reflectance distribution function) texture (using shader)
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
Shader shdrBRDF = LoadShader(TextFormat("resources/shaders/glsl%i/brdf.vs", GLSL_VERSION),
|
||||
TextFormat("resources/shaders/glsl%i/brdf.fs", GLSL_VERSION));
|
||||
|
||||
mat.maps[MATERIAL_MAP_BRDG].texture = GenTextureBRDF(shdrBRDF, BRDF_SIZE);
|
||||
UnloadShader(shdrBRDF);
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
|
||||
return mat;
|
||||
}
|
||||
|
||||
// Texture maps generation (PBR)
|
||||
//-------------------------------------------------------------------------------------------
|
||||
// Generate cubemap texture from HDR texture
|
||||
static TextureCubemap GenTextureCubemap(Shader shader, Texture2D panorama, int size, int format)
|
||||
{
|
||||
TextureCubemap cubemap = { 0 };
|
||||
|
||||
rlDisableBackfaceCulling(); // Disable backface culling to render inside the cube
|
||||
|
||||
// STEP 1: Setup framebuffer
|
||||
//------------------------------------------------------------------------------------------
|
||||
unsigned int rbo = rlLoadTextureDepth(size, size, true);
|
||||
cubemap.id = rlLoadTextureCubemap(NULL, size, format);
|
||||
|
||||
unsigned int fbo = rlLoadFramebuffer(size, size);
|
||||
rlFramebufferAttach(fbo, rbo, RL_ATTACHMENT_DEPTH, RL_ATTACHMENT_RENDERBUFFER, 0);
|
||||
rlFramebufferAttach(fbo, cubemap.id, RL_ATTACHMENT_COLOR_CHANNEL0, RL_ATTACHMENT_CUBEMAP_POSITIVE_X, 0);
|
||||
|
||||
// Check if framebuffer is complete with attachments (valid)
|
||||
if (rlFramebufferComplete(fbo)) TraceLog(LOG_INFO, "FBO: [ID %i] Framebuffer object created successfully", fbo);
|
||||
//------------------------------------------------------------------------------------------
|
||||
|
||||
// STEP 2: Draw to framebuffer
|
||||
//------------------------------------------------------------------------------------------
|
||||
// NOTE: Shader is used to convert HDR equirectangular environment map to cubemap equivalent (6 faces)
|
||||
rlEnableShader(shader.id);
|
||||
|
||||
// Define projection matrix and send it to shader
|
||||
Matrix matFboProjection = MatrixPerspective(90.0*DEG2RAD, 1.0, RL_CULL_DISTANCE_NEAR, RL_CULL_DISTANCE_FAR);
|
||||
rlSetUniformMatrix(shader.locs[SHADER_LOC_MATRIX_PROJECTION], matFboProjection);
|
||||
|
||||
// Define view matrix for every side of the cubemap
|
||||
Matrix fboViews[6] = {
|
||||
MatrixLookAt((Vector3){ 0.0f, 0.0f, 0.0f }, (Vector3){ 1.0f, 0.0f, 0.0f }, (Vector3){ 0.0f, -1.0f, 0.0f }),
|
||||
MatrixLookAt((Vector3){ 0.0f, 0.0f, 0.0f }, (Vector3){ -1.0f, 0.0f, 0.0f }, (Vector3){ 0.0f, -1.0f, 0.0f }),
|
||||
MatrixLookAt((Vector3){ 0.0f, 0.0f, 0.0f }, (Vector3){ 0.0f, 1.0f, 0.0f }, (Vector3){ 0.0f, 0.0f, 1.0f }),
|
||||
MatrixLookAt((Vector3){ 0.0f, 0.0f, 0.0f }, (Vector3){ 0.0f, -1.0f, 0.0f }, (Vector3){ 0.0f, 0.0f, -1.0f }),
|
||||
MatrixLookAt((Vector3){ 0.0f, 0.0f, 0.0f }, (Vector3){ 0.0f, 0.0f, 1.0f }, (Vector3){ 0.0f, -1.0f, 0.0f }),
|
||||
MatrixLookAt((Vector3){ 0.0f, 0.0f, 0.0f }, (Vector3){ 0.0f, 0.0f, -1.0f }, (Vector3){ 0.0f, -1.0f, 0.0f })
|
||||
};
|
||||
|
||||
rlViewport(0, 0, size, size); // Set viewport to current fbo dimensions
|
||||
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
rlSetUniformMatrix(shader.locs[SHADER_LOC_MATRIX_VIEW], fboViews[i]);
|
||||
rlFramebufferAttach(fbo, cubemap.id, RL_ATTACHMENT_COLOR_CHANNEL0, RL_ATTACHMENT_CUBEMAP_POSITIVE_X + i, 0);
|
||||
|
||||
rlEnableFramebuffer(fbo);
|
||||
rlSetTexture(panorama.id); // WARNING: It must be called after enabling current framebuffer if using internal batch system!
|
||||
|
||||
rlClearScreenBuffers();
|
||||
DrawCubeV(Vector3Zero(), Vector3One(), WHITE);
|
||||
rlDrawRenderBatchActive();
|
||||
}
|
||||
//------------------------------------------------------------------------------------------
|
||||
|
||||
// STEP 3: Unload framebuffer and reset state
|
||||
//------------------------------------------------------------------------------------------
|
||||
rlDisableShader(); // Unbind shader
|
||||
rlDisableTexture(); // Unbind texture
|
||||
rlDisableFramebuffer(); // Unbind framebuffer
|
||||
rlUnloadFramebuffer(fbo); // Unload framebuffer (and automatically attached depth texture/renderbuffer)
|
||||
|
||||
// Reset viewport dimensions to default
|
||||
rlViewport(0, 0, rlGetFramebufferWidth(), rlGetFramebufferHeight());
|
||||
rlEnableBackfaceCulling();
|
||||
//------------------------------------------------------------------------------------------
|
||||
|
||||
cubemap.width = size;
|
||||
cubemap.height = size;
|
||||
cubemap.mipmaps = 1;
|
||||
cubemap.format = PIXELFORMAT_UNCOMPRESSED_R32G32B32;
|
||||
|
||||
return cubemap;
|
||||
}
|
||||
|
||||
// Generate irradiance texture using cubemap data
|
||||
static TextureCubemap GenTextureIrradiance(Shader shader, TextureCubemap cubemap, int size)
|
||||
{
|
||||
TextureCubemap irradiance = { 0 };
|
||||
|
||||
rlDisableBackfaceCulling(); // Disable backface culling to render inside the cube
|
||||
|
||||
// STEP 1: Setup framebuffer
|
||||
//------------------------------------------------------------------------------------------
|
||||
unsigned int rbo = rlLoadTextureDepth(size, size, true);
|
||||
irradiance.id = rlLoadTextureCubemap(NULL, size, PIXELFORMAT_UNCOMPRESSED_R32G32B32);
|
||||
|
||||
unsigned int fbo = rlLoadFramebuffer(size, size);
|
||||
rlFramebufferAttach(fbo, rbo, RL_ATTACHMENT_DEPTH, RL_ATTACHMENT_RENDERBUFFER, 0);
|
||||
rlFramebufferAttach(fbo, cubemap.id, RL_ATTACHMENT_COLOR_CHANNEL0, RL_ATTACHMENT_CUBEMAP_POSITIVE_X, 0);
|
||||
//------------------------------------------------------------------------------------------
|
||||
|
||||
// STEP 2: Draw to framebuffer
|
||||
//------------------------------------------------------------------------------------------
|
||||
// NOTE: Shader is used to solve diffuse integral by convolution to create an irradiance cubemap
|
||||
rlEnableShader(shader.id);
|
||||
|
||||
// Define projection matrix and send it to shader
|
||||
Matrix matFboProjection = MatrixPerspective(90.0*DEG2RAD, 1.0, RL_CULL_DISTANCE_NEAR, RL_CULL_DISTANCE_FAR);
|
||||
rlSetUniformMatrix(shader.locs[SHADER_LOC_MATRIX_PROJECTION], matFboProjection);
|
||||
|
||||
// Define view matrix for every side of the cubemap
|
||||
Matrix fboViews[6] = {
|
||||
MatrixLookAt((Vector3){ 0.0f, 0.0f, 0.0f }, (Vector3){ 1.0f, 0.0f, 0.0f }, (Vector3){ 0.0f, -1.0f, 0.0f }),
|
||||
MatrixLookAt((Vector3){ 0.0f, 0.0f, 0.0f }, (Vector3){ -1.0f, 0.0f, 0.0f }, (Vector3){ 0.0f, -1.0f, 0.0f }),
|
||||
MatrixLookAt((Vector3){ 0.0f, 0.0f, 0.0f }, (Vector3){ 0.0f, 1.0f, 0.0f }, (Vector3){ 0.0f, 0.0f, 1.0f }),
|
||||
MatrixLookAt((Vector3){ 0.0f, 0.0f, 0.0f }, (Vector3){ 0.0f, -1.0f, 0.0f }, (Vector3){ 0.0f, 0.0f, -1.0f }),
|
||||
MatrixLookAt((Vector3){ 0.0f, 0.0f, 0.0f }, (Vector3){ 0.0f, 0.0f, 1.0f }, (Vector3){ 0.0f, -1.0f, 0.0f }),
|
||||
MatrixLookAt((Vector3){ 0.0f, 0.0f, 0.0f }, (Vector3){ 0.0f, 0.0f, -1.0f }, (Vector3){ 0.0f, -1.0f, 0.0f })
|
||||
};
|
||||
|
||||
rlActiveTextureSlot(0);
|
||||
rlEnableTextureCubemap(cubemap.id);
|
||||
|
||||
rlViewport(0, 0, size, size); // Set viewport to current fbo dimensions
|
||||
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
rlSetUniformMatrix(shader.locs[SHADER_LOC_MATRIX_VIEW], fboViews[i]);
|
||||
rlFramebufferAttach(fbo, irradiance.id, RL_ATTACHMENT_COLOR_CHANNEL0, RL_ATTACHMENT_CUBEMAP_POSITIVE_X + i, 0);
|
||||
|
||||
rlEnableFramebuffer(fbo);
|
||||
rlClearScreenBuffers();
|
||||
rlLoadDrawCube();
|
||||
}
|
||||
//------------------------------------------------------------------------------------------
|
||||
|
||||
// STEP 3: Unload framebuffer and reset state
|
||||
//------------------------------------------------------------------------------------------
|
||||
rlDisableShader(); // Unbind shader
|
||||
rlDisableTexture(); // Unbind texture
|
||||
rlDisableFramebuffer(); // Unbind framebuffer
|
||||
rlUnloadFramebuffer(fbo); // Unload framebuffer (and automatically attached depth texture/renderbuffer)
|
||||
|
||||
// Reset viewport dimensions to default
|
||||
rlViewport(0, 0, rlGetFramebufferWidth(), rlGetFramebufferHeight());
|
||||
rlEnableBackfaceCulling();
|
||||
//------------------------------------------------------------------------------------------
|
||||
|
||||
irradiance.width = size;
|
||||
irradiance.height = size;
|
||||
irradiance.mipmaps = 1;
|
||||
irradiance.format = PIXELFORMAT_UNCOMPRESSED_R32G32B32;
|
||||
|
||||
return irradiance;
|
||||
}
|
||||
|
||||
// Generate prefilter texture using cubemap data
|
||||
static TextureCubemap GenTexturePrefilter(Shader shader, TextureCubemap cubemap, int size)
|
||||
{
|
||||
TextureCubemap prefilter = { 0 };
|
||||
|
||||
rlDisableBackfaceCulling(); // Disable backface culling to render inside the cube
|
||||
|
||||
// STEP 1: Setup framebuffer
|
||||
//------------------------------------------------------------------------------------------
|
||||
unsigned int rbo = rlLoadTextureDepth(size, size, true);
|
||||
prefilter.id = rlLoadTextureCubemap(NULL, size, PIXELFORMAT_UNCOMPRESSED_R32G32B32);
|
||||
rlTextureParameters(prefilter.id, RL_TEXTURE_MIN_FILTER, RL_TEXTURE_FILTER_MIP_LINEAR);
|
||||
|
||||
unsigned int fbo = rlLoadFramebuffer(size, size);
|
||||
rlFramebufferAttach(fbo, rbo, RL_ATTACHMENT_DEPTH, RL_ATTACHMENT_RENDERBUFFER, 0);
|
||||
rlFramebufferAttach(fbo, cubemap.id, RL_ATTACHMENT_COLOR_CHANNEL0, RL_ATTACHMENT_CUBEMAP_POSITIVE_X, 0);
|
||||
//------------------------------------------------------------------------------------------
|
||||
|
||||
// Generate mipmaps for the prefiltered HDR texture
|
||||
//glGenerateMipmap(GL_TEXTURE_CUBE_MAP); // TODO!
|
||||
|
||||
// STEP 2: Draw to framebuffer
|
||||
//------------------------------------------------------------------------------------------
|
||||
// NOTE: Shader is used to prefilter HDR and store data into mipmap levels
|
||||
|
||||
// Define projection matrix and send it to shader
|
||||
Matrix fboProjection = MatrixPerspective(90.0*DEG2RAD, 1.0, RL_CULL_DISTANCE_NEAR, RL_CULL_DISTANCE_FAR);
|
||||
rlEnableShader(shader.id);
|
||||
rlSetUniformMatrix(shader.locs[SHADER_LOC_MATRIX_PROJECTION], fboProjection);
|
||||
|
||||
// Define view matrix for every side of the cubemap
|
||||
Matrix fboViews[6] = {
|
||||
MatrixLookAt((Vector3){ 0.0f, 0.0f, 0.0f }, (Vector3){ 1.0f, 0.0f, 0.0f }, (Vector3){ 0.0f, -1.0f, 0.0f }),
|
||||
MatrixLookAt((Vector3){ 0.0f, 0.0f, 0.0f }, (Vector3){ -1.0f, 0.0f, 0.0f }, (Vector3){ 0.0f, -1.0f, 0.0f }),
|
||||
MatrixLookAt((Vector3){ 0.0f, 0.0f, 0.0f }, (Vector3){ 0.0f, 1.0f, 0.0f }, (Vector3){ 0.0f, 0.0f, 1.0f }),
|
||||
MatrixLookAt((Vector3){ 0.0f, 0.0f, 0.0f }, (Vector3){ 0.0f, -1.0f, 0.0f }, (Vector3){ 0.0f, 0.0f, -1.0f }),
|
||||
MatrixLookAt((Vector3){ 0.0f, 0.0f, 0.0f }, (Vector3){ 0.0f, 0.0f, 1.0f }, (Vector3){ 0.0f, -1.0f, 0.0f }),
|
||||
MatrixLookAt((Vector3){ 0.0f, 0.0f, 0.0f }, (Vector3){ 0.0f, 0.0f, -1.0f }, (Vector3){ 0.0f, -1.0f, 0.0f })
|
||||
};
|
||||
|
||||
rlActiveTextureSlot(0);
|
||||
rlEnableTextureCubemap(cubemap.id);
|
||||
|
||||
// TODO: Locations should be taken out of this function... too shader dependant...
|
||||
int roughnessLoc = rlGetLocationUniform(shader.id, "roughness");
|
||||
|
||||
rlEnableFramebuffer(fbo);
|
||||
|
||||
#define MAX_MIPMAP_LEVELS 5 // Max number of prefilter texture mipmaps
|
||||
|
||||
for (int mip = 0; mip < MAX_MIPMAP_LEVELS; mip++)
|
||||
{
|
||||
// Resize framebuffer according to mip-level size.
|
||||
unsigned int mipWidth = size*(int)powf(0.5f, (float)mip);
|
||||
unsigned int mipHeight = size*(int)powf(0.5f, (float)mip);
|
||||
|
||||
rlViewport(0, 0, mipWidth, mipHeight);
|
||||
|
||||
//glBindRenderbuffer(GL_RENDERBUFFER, rbo);
|
||||
//glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT24, mipWidth, mipHeight);
|
||||
|
||||
float roughness = (float)mip/(float)(MAX_MIPMAP_LEVELS - 1);
|
||||
rlSetUniform(roughnessLoc, &roughness, SHADER_UNIFORM_FLOAT, 1);
|
||||
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
rlSetUniformMatrix(shader.locs[SHADER_LOC_MATRIX_VIEW], fboViews[i]);
|
||||
rlFramebufferAttach(fbo, prefilter.id, RL_ATTACHMENT_COLOR_CHANNEL0, RL_ATTACHMENT_CUBEMAP_POSITIVE_X + i, mip);
|
||||
|
||||
rlClearScreenBuffers();
|
||||
rlLoadDrawCube();
|
||||
}
|
||||
}
|
||||
//------------------------------------------------------------------------------------------
|
||||
|
||||
// STEP 3: Unload framebuffer and reset state
|
||||
//------------------------------------------------------------------------------------------
|
||||
rlDisableShader(); // Unbind shader
|
||||
rlDisableTexture(); // Unbind texture
|
||||
rlDisableFramebuffer(); // Unbind framebuffer
|
||||
rlUnloadFramebuffer(fbo); // Unload framebuffer (and automatically attached depth texture/renderbuffer)
|
||||
|
||||
// Reset viewport dimensions to default
|
||||
rlViewport(0, 0, rlGetFramebufferWidth(), rlGetFramebufferHeight());
|
||||
rlEnableBackfaceCulling();
|
||||
//------------------------------------------------------------------------------------------
|
||||
|
||||
prefilter.width = size;
|
||||
prefilter.height = size;
|
||||
prefilter.mipmaps = MAX_MIPMAP_LEVELS;
|
||||
prefilter.format = PIXELFORMAT_UNCOMPRESSED_R32G32B32;
|
||||
|
||||
return prefilter;
|
||||
}
|
||||
|
||||
// Generate BRDF texture using cubemap data
|
||||
// TODO: Review implementation: https://github.com/HectorMF/BRDFGenerator
|
||||
static Texture2D GenTextureBRDF(Shader shader, int size)
|
||||
{
|
||||
Texture2D brdf = { 0 };
|
||||
|
||||
// STEP 1: Setup framebuffer
|
||||
//------------------------------------------------------------------------------------------
|
||||
unsigned int rbo = rlLoadTextureDepth(size, size, true);
|
||||
brdf.id = rlLoadTexture(NULL, size, size, PIXELFORMAT_UNCOMPRESSED_R32G32B32, 1);
|
||||
|
||||
unsigned int fbo = rlLoadFramebuffer(size, size);
|
||||
rlFramebufferAttach(fbo, rbo, RL_ATTACHMENT_DEPTH, RL_ATTACHMENT_RENDERBUFFER, 0);
|
||||
rlFramebufferAttach(fbo, brdf.id, RL_ATTACHMENT_COLOR_CHANNEL0, RL_ATTACHMENT_TEXTURE2D, 0);
|
||||
//------------------------------------------------------------------------------------------
|
||||
|
||||
// STEP 2: Draw to framebuffer
|
||||
//------------------------------------------------------------------------------------------
|
||||
// NOTE: Render BRDF LUT into a quad using FBO
|
||||
rlEnableShader(shader.id);
|
||||
|
||||
rlViewport(0, 0, size, size);
|
||||
|
||||
rlEnableFramebuffer(fbo);
|
||||
rlClearScreenBuffers();
|
||||
|
||||
rlLoadDrawQuad();
|
||||
//------------------------------------------------------------------------------------------
|
||||
|
||||
// STEP 3: Unload framebuffer and reset state
|
||||
//------------------------------------------------------------------------------------------
|
||||
rlDisableShader(); // Unbind shader
|
||||
rlDisableTexture(); // Unbind texture
|
||||
rlDisableFramebuffer(); // Unbind framebuffer
|
||||
rlUnloadFramebuffer(fbo); // Unload framebuffer (and automatically attached depth texture/renderbuffer)
|
||||
|
||||
// Reset viewport dimensions to default
|
||||
rlViewport(0, 0, rlGetFramebufferWidth(), rlGetFramebufferHeight());
|
||||
//------------------------------------------------------------------------------------------
|
||||
|
||||
brdf.width = size;
|
||||
brdf.height = size;
|
||||
brdf.mipmaps = 1;
|
||||
brdf.format = PIXELFORMAT_UNCOMPRESSED_R32G32B32;
|
||||
|
||||
return brdf;
|
||||
}
|
Before Width: | Height: | Size: 317 KiB |
@@ -113,7 +113,7 @@ int main(void)
|
||||
//----------------------------------------------------------------------------------
|
||||
UpdateCamera(&camera); // Update internal camera and our camera
|
||||
|
||||
if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON))
|
||||
if (IsMouseButtonPressed(MOUSE_BUTTON_LEFT))
|
||||
{
|
||||
currentModel = (currentModel + 1)%NUM_MODELS; // Cycle between the textures
|
||||
}
|
||||
|
@@ -35,22 +35,30 @@ int main(void)
|
||||
|
||||
Ray ray = { 0 }; // Picking ray
|
||||
|
||||
Model tower = LoadModel("resources/models/turret.obj"); // Load OBJ model
|
||||
Texture2D texture = LoadTexture("resources/models/turret_diffuse.png"); // Load model texture
|
||||
Model tower = LoadModel("resources/models/obj/turret.obj"); // Load OBJ model
|
||||
Texture2D texture = LoadTexture("resources/models/obj/turret_diffuse.png"); // Load model texture
|
||||
tower.materials[0].maps[MATERIAL_MAP_DIFFUSE].texture = texture; // Set model diffuse texture
|
||||
|
||||
Vector3 towerPos = { 0.0f, 0.0f, 0.0f }; // Set model position
|
||||
BoundingBox towerBBox = MeshBoundingBox(tower.meshes[0]); // Get mesh bounding box
|
||||
bool hitMeshBBox = false;
|
||||
bool hitTriangle = false;
|
||||
BoundingBox towerBBox = GetMeshBoundingBox(tower.meshes[0]); // Get mesh bounding box
|
||||
|
||||
// Ground quad
|
||||
Vector3 g0 = (Vector3){ -50.0f, 0.0f, -50.0f };
|
||||
Vector3 g1 = (Vector3){ -50.0f, 0.0f, 50.0f };
|
||||
Vector3 g2 = (Vector3){ 50.0f, 0.0f, 50.0f };
|
||||
Vector3 g3 = (Vector3){ 50.0f, 0.0f, -50.0f };
|
||||
|
||||
// Test triangle
|
||||
Vector3 ta = (Vector3){ -25.0, 0.5, 0.0 };
|
||||
Vector3 tb = (Vector3){ -4.0, 2.5, 1.0 };
|
||||
Vector3 tc = (Vector3){ -8.0, 6.5, 0.0 };
|
||||
Vector3 ta = (Vector3){ -25.0f, 0.5f, 0.0f };
|
||||
Vector3 tb = (Vector3){ -4.0f, 2.5f, 1.0f };
|
||||
Vector3 tc = (Vector3){ -8.0f, 6.5f, 0.0f };
|
||||
|
||||
Vector3 bary = { 0.0f, 0.0f, 0.0f };
|
||||
|
||||
// Test sphere
|
||||
Vector3 sp = (Vector3){ -30.0f, 5.0f, 5.0f };
|
||||
float sr = 4.0f;
|
||||
|
||||
SetCameraMode(camera, CAMERA_FREE); // Set a free camera mode
|
||||
|
||||
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||
@@ -63,59 +71,67 @@ int main(void)
|
||||
UpdateCamera(&camera); // Update camera
|
||||
|
||||
// Display information about closest hit
|
||||
RayHitInfo nearestHit = { 0 };
|
||||
RayCollision collision = { 0 };
|
||||
char *hitObjectName = "None";
|
||||
nearestHit.distance = FLT_MAX;
|
||||
nearestHit.hit = false;
|
||||
collision.distance = FLT_MAX;
|
||||
collision.hit = false;
|
||||
Color cursorColor = WHITE;
|
||||
|
||||
// Get ray and test against ground, triangle, and mesh
|
||||
// Get ray and test against objects
|
||||
ray = GetMouseRay(GetMousePosition(), camera);
|
||||
|
||||
// Check ray collision aginst ground plane
|
||||
RayHitInfo groundHitInfo = GetCollisionRayGround(ray, 0.0f);
|
||||
// Check ray collision against ground quad
|
||||
RayCollision groundHitInfo = GetRayCollisionQuad(ray, g0, g1, g2, g3);
|
||||
|
||||
if ((groundHitInfo.hit) && (groundHitInfo.distance < nearestHit.distance))
|
||||
if ((groundHitInfo.hit) && (groundHitInfo.distance < collision.distance))
|
||||
{
|
||||
nearestHit = groundHitInfo;
|
||||
collision = groundHitInfo;
|
||||
cursorColor = GREEN;
|
||||
hitObjectName = "Ground";
|
||||
}
|
||||
|
||||
// Check ray collision against test triangle
|
||||
RayHitInfo triHitInfo = GetCollisionRayTriangle(ray, ta, tb, tc);
|
||||
RayCollision triHitInfo = GetRayCollisionTriangle(ray, ta, tb, tc);
|
||||
|
||||
if ((triHitInfo.hit) && (triHitInfo.distance < nearestHit.distance))
|
||||
if ((triHitInfo.hit) && (triHitInfo.distance < collision.distance))
|
||||
{
|
||||
nearestHit = triHitInfo;
|
||||
collision = triHitInfo;
|
||||
cursorColor = PURPLE;
|
||||
hitObjectName = "Triangle";
|
||||
|
||||
bary = Vector3Barycenter(nearestHit.position, ta, tb, tc);
|
||||
hitTriangle = true;
|
||||
bary = Vector3Barycenter(collision.point, ta, tb, tc);
|
||||
}
|
||||
else hitTriangle = false;
|
||||
|
||||
RayHitInfo meshHitInfo = { 0 };
|
||||
// Check ray collision against test sphere
|
||||
RayCollision sphereHitInfo = GetRayCollisionSphere(ray, sp, sr);
|
||||
|
||||
if ((sphereHitInfo.hit) && (sphereHitInfo.distance < collision.distance))
|
||||
{
|
||||
collision = sphereHitInfo;
|
||||
cursorColor = ORANGE;
|
||||
hitObjectName = "Sphere";
|
||||
}
|
||||
|
||||
// Check ray collision against bounding box first, before trying the full ray-mesh test
|
||||
if (CheckCollisionRayBox(ray, towerBBox))
|
||||
RayCollision boxHitInfo = GetRayCollisionBox(ray, towerBBox);
|
||||
|
||||
if ((boxHitInfo.hit) && (boxHitInfo.distance < collision.distance))
|
||||
{
|
||||
hitMeshBBox = true;
|
||||
collision = boxHitInfo;
|
||||
cursorColor = ORANGE;
|
||||
hitObjectName = "Box";
|
||||
|
||||
// Check ray collision against model
|
||||
// NOTE: It considers model.transform matrix!
|
||||
meshHitInfo = GetCollisionRayModel(ray, tower);
|
||||
RayCollision meshHitInfo = GetRayCollisionModel(ray, tower);
|
||||
|
||||
if ((meshHitInfo.hit) && (meshHitInfo.distance < nearestHit.distance))
|
||||
if (meshHitInfo.hit)
|
||||
{
|
||||
nearestHit = meshHitInfo;
|
||||
collision = meshHitInfo;
|
||||
cursorColor = ORANGE;
|
||||
hitObjectName = "Mesh";
|
||||
}
|
||||
}
|
||||
|
||||
hitMeshBBox = false;
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
// Draw
|
||||
@@ -128,7 +144,7 @@ int main(void)
|
||||
|
||||
// Draw the tower
|
||||
// WARNING: If scale is different than 1.0f,
|
||||
// not considered by GetCollisionRayModel()
|
||||
// not considered by GetRayCollisionModel()
|
||||
DrawModel(tower, towerPos, 1.0f, WHITE);
|
||||
|
||||
// Draw the test triangle
|
||||
@@ -136,21 +152,24 @@ int main(void)
|
||||
DrawLine3D(tb, tc, PURPLE);
|
||||
DrawLine3D(tc, ta, PURPLE);
|
||||
|
||||
// Draw the test sphere
|
||||
DrawSphereWires(sp, sr, 8, 8, PURPLE);
|
||||
|
||||
// Draw the mesh bbox if we hit it
|
||||
if (hitMeshBBox) DrawBoundingBox(towerBBox, LIME);
|
||||
if (boxHitInfo.hit) DrawBoundingBox(towerBBox, LIME);
|
||||
|
||||
// If we hit something, draw the cursor at the hit point
|
||||
if (nearestHit.hit)
|
||||
if (collision.hit)
|
||||
{
|
||||
DrawCube(nearestHit.position, 0.3f, 0.3f, 0.3f, cursorColor);
|
||||
DrawCubeWires(nearestHit.position, 0.3f, 0.3f, 0.3f, RED);
|
||||
DrawCube(collision.point, 0.3f, 0.3f, 0.3f, cursorColor);
|
||||
DrawCubeWires(collision.point, 0.3f, 0.3f, 0.3f, RED);
|
||||
|
||||
Vector3 normalEnd;
|
||||
normalEnd.x = nearestHit.position.x + nearestHit.normal.x;
|
||||
normalEnd.y = nearestHit.position.y + nearestHit.normal.y;
|
||||
normalEnd.z = nearestHit.position.z + nearestHit.normal.z;
|
||||
normalEnd.x = collision.point.x + collision.normal.x;
|
||||
normalEnd.y = collision.point.y + collision.normal.y;
|
||||
normalEnd.z = collision.point.z + collision.normal.z;
|
||||
|
||||
DrawLine3D(nearestHit.position, normalEnd, RED);
|
||||
DrawLine3D(collision.point, normalEnd, RED);
|
||||
}
|
||||
|
||||
DrawRay(ray, MAROON);
|
||||
@@ -162,23 +181,24 @@ int main(void)
|
||||
// Draw some debug GUI text
|
||||
DrawText(TextFormat("Hit Object: %s", hitObjectName), 10, 50, 10, BLACK);
|
||||
|
||||
if (nearestHit.hit)
|
||||
if (collision.hit)
|
||||
{
|
||||
int ypos = 70;
|
||||
|
||||
DrawText(TextFormat("Distance: %3.2f", nearestHit.distance), 10, ypos, 10, BLACK);
|
||||
DrawText(TextFormat("Distance: %3.2f", collision.distance), 10, ypos, 10, BLACK);
|
||||
|
||||
DrawText(TextFormat("Hit Pos: %3.2f %3.2f %3.2f",
|
||||
nearestHit.position.x,
|
||||
nearestHit.position.y,
|
||||
nearestHit.position.z), 10, ypos + 15, 10, BLACK);
|
||||
collision.point.x,
|
||||
collision.point.y,
|
||||
collision.point.z), 10, ypos + 15, 10, BLACK);
|
||||
|
||||
DrawText(TextFormat("Hit Norm: %3.2f %3.2f %3.2f",
|
||||
nearestHit.normal.x,
|
||||
nearestHit.normal.y,
|
||||
nearestHit.normal.z), 10, ypos + 30, 10, BLACK);
|
||||
collision.normal.x,
|
||||
collision.normal.y,
|
||||
collision.normal.z), 10, ypos + 30, 10, BLACK);
|
||||
|
||||
if (hitTriangle) DrawText(TextFormat("Barycenter: %3.2f %3.2f %3.2f", bary.x, bary.y, bary.z), 10, ypos + 45, 10, BLACK);
|
||||
if (triHitInfo.hit && TextIsEqual(hitObjectName, "Triangle"))
|
||||
DrawText(TextFormat("Barycenter: %3.2f %3.2f %3.2f", bary.x, bary.y, bary.z), 10, ypos + 45, 10, BLACK);
|
||||
}
|
||||
|
||||
DrawText("Use Mouse to Move Camera", 10, 430, 10, GRAY);
|
||||
|
@@ -14,6 +14,8 @@
|
||||
#include "raylib.h"
|
||||
#include "rlgl.h"
|
||||
|
||||
#include <math.h> // Required for: cosf(), sinf()
|
||||
|
||||
//------------------------------------------------------------------------------------
|
||||
// Module Functions Declaration
|
||||
//------------------------------------------------------------------------------------
|
||||
@@ -86,7 +88,6 @@ int main(void)
|
||||
rlPushMatrix();
|
||||
rlRotatef(earthOrbitRotation, 0.0f, 1.0f, 0.0f); // Rotation for Earth orbit around Sun
|
||||
rlTranslatef(earthOrbitRadius, 0.0f, 0.0f); // Translation for Earth orbit
|
||||
rlRotatef(-earthOrbitRotation, 0.0f, 1.0f, 0.0f); // Rotation for Earth orbit around Sun inverted
|
||||
|
||||
rlPushMatrix();
|
||||
rlRotatef(earthRotation, 0.25, 1.0, 0.0); // Rotation for Earth itself
|
||||
@@ -97,7 +98,6 @@ int main(void)
|
||||
|
||||
rlRotatef(moonOrbitRotation, 0.0f, 1.0f, 0.0f); // Rotation for Moon orbit around Earth
|
||||
rlTranslatef(moonOrbitRadius, 0.0f, 0.0f); // Translation for Moon orbit
|
||||
rlRotatef(-moonOrbitRotation, 0.0f, 1.0f, 0.0f); // Rotation for Moon orbit around Earth inverted
|
||||
rlRotatef(moonRotation, 0.0f, 1.0f, 0.0f); // Rotation for Moon itself
|
||||
rlScalef(moonRadius, moonRadius, moonRadius); // Scale Moon
|
||||
|
||||
|
@@ -10,7 +10,9 @@
|
||||
********************************************************************************************/
|
||||
|
||||
#include "raylib.h"
|
||||
|
||||
#include "rlgl.h"
|
||||
#include "raymath.h" // Required for: MatrixPerspective(), MatrixLookAt()
|
||||
|
||||
#if defined(PLATFORM_DESKTOP)
|
||||
#define GLSL_VERSION 330
|
||||
@@ -37,7 +39,7 @@ int main(void)
|
||||
Mesh cube = GenMeshCube(1.0f, 1.0f, 1.0f);
|
||||
Model skybox = LoadModelFromMesh(cube);
|
||||
|
||||
bool useHDR = false;
|
||||
bool useHDR = true;
|
||||
|
||||
// Load skybox shader and set required locations
|
||||
// NOTE: Some locations are automatically set at shader loading
|
||||
@@ -56,12 +58,14 @@ int main(void)
|
||||
|
||||
char skyboxFileName[256] = { 0 };
|
||||
|
||||
Texture2D panorama;
|
||||
|
||||
if (useHDR)
|
||||
{
|
||||
TextCopy(skyboxFileName, "resources/dresden_square_2k.hdr");
|
||||
|
||||
// Load HDR panorama (sphere) texture
|
||||
Texture2D panorama = panorama = LoadTexture(skyboxFileName);
|
||||
panorama = LoadTexture(skyboxFileName);
|
||||
|
||||
// Generate cubemap (texture with 6 quads-cube-mapping) from panorama HDR texture
|
||||
// NOTE 1: New texture is generated rendering to texture, shader calculates the sphere->cube coordinates mapping
|
||||
@@ -69,7 +73,7 @@ int main(void)
|
||||
// despite texture can be successfully created.. so using PIXELFORMAT_UNCOMPRESSED_R8G8B8A8 instead of PIXELFORMAT_UNCOMPRESSED_R32G32B32A32
|
||||
skybox.materials[0].maps[MATERIAL_MAP_CUBEMAP].texture = GenTextureCubemap(shdrCubemap, panorama, 1024, PIXELFORMAT_UNCOMPRESSED_R8G8B8A8);
|
||||
|
||||
UnloadTexture(panorama); // Texture not required anymore, cubemap already generated
|
||||
//UnloadTexture(panorama); // Texture not required anymore, cubemap already generated
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -144,10 +148,10 @@ int main(void)
|
||||
|
||||
EndMode3D();
|
||||
|
||||
if (useHDR)
|
||||
DrawText(TextFormat("Panorama image from hdrihaven.com: %s", GetFileName(skyboxFileName)), 10, GetScreenHeight() - 20, 10, BLACK);
|
||||
else
|
||||
DrawText(TextFormat(": %s", GetFileName(skyboxFileName)), 10, GetScreenHeight() - 20, 10, BLACK);
|
||||
//DrawTextureEx(panorama, (Vector2){ 0, 0 }, 0.0f, 0.5f, WHITE);
|
||||
|
||||
if (useHDR) DrawText(TextFormat("Panorama image from hdrihaven.com: %s", GetFileName(skyboxFileName)), 10, GetScreenHeight() - 20, 10, BLACK);
|
||||
else DrawText(TextFormat(": %s", GetFileName(skyboxFileName)), 10, GetScreenHeight() - 20, 10, BLACK);
|
||||
|
||||
DrawFPS(10, 10);
|
||||
|
||||
@@ -209,17 +213,31 @@ static TextureCubemap GenTextureCubemap(Shader shader, Texture2D panorama, int s
|
||||
|
||||
rlViewport(0, 0, size, size); // Set viewport to current fbo dimensions
|
||||
|
||||
// Activate and enable texture for drawing to cubemap faces
|
||||
rlActiveTextureSlot(0);
|
||||
rlEnableTexture(panorama.id);
|
||||
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
// Set the view matrix for the current cube face
|
||||
rlSetUniformMatrix(shader.locs[SHADER_LOC_MATRIX_VIEW], fboViews[i]);
|
||||
|
||||
// Select the current cubemap face attachment for the fbo
|
||||
// WARNING: This function by default enables->attach->disables fbo!!!
|
||||
rlFramebufferAttach(fbo, cubemap.id, RL_ATTACHMENT_COLOR_CHANNEL0, RL_ATTACHMENT_CUBEMAP_POSITIVE_X + i, 0);
|
||||
|
||||
rlEnableFramebuffer(fbo);
|
||||
rlSetTexture(panorama.id); // WARNING: It must be called after enabling current framebuffer if using internal batch system!
|
||||
|
||||
// Load and draw a cube, it uses the current enabled texture
|
||||
rlClearScreenBuffers();
|
||||
DrawCubeV(Vector3Zero(), Vector3One(), WHITE);
|
||||
rlDrawRenderBatchActive();
|
||||
rlLoadDrawCube();
|
||||
|
||||
// ALTERNATIVE: Try to use internal batch system to draw the cube instead of rlLoadDrawCube
|
||||
// for some reason this method does not work, maybe due to cube triangles definition? normals pointing out?
|
||||
// TODO: Investigate this issue...
|
||||
//rlSetTexture(panorama.id); // WARNING: It must be called after enabling current framebuffer if using internal batch system!
|
||||
//rlClearScreenBuffers();
|
||||
//DrawCubeV(Vector3Zero(), Vector3One(), WHITE);
|
||||
//rlDrawRenderBatchActive();
|
||||
}
|
||||
//------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -238,7 +256,7 @@ static TextureCubemap GenTextureCubemap(Shader shader, Texture2D panorama, int s
|
||||
cubemap.width = size;
|
||||
cubemap.height = size;
|
||||
cubemap.mipmaps = 1;
|
||||
cubemap.format = PIXELFORMAT_UNCOMPRESSED_R32G32B32;
|
||||
cubemap.format = format;
|
||||
|
||||
return cubemap;
|
||||
}
|
||||
|
@@ -7,12 +7,13 @@
|
||||
*
|
||||
* Example contributed by Berni (@Berni8k) and reviewed by Ramon Santamaria (@raysan5)
|
||||
*
|
||||
* Copyright (c) 2017 Berni (@Berni8k) and Ramon Santamaria (@raysan5)
|
||||
* Copyright (c) 2017-2021 Berni (@Berni8k) and Ramon Santamaria (@raysan5)
|
||||
*
|
||||
********************************************************************************************/
|
||||
|
||||
#include "raylib.h"
|
||||
#include "raymath.h"
|
||||
|
||||
#include "raymath.h" // Required for: MatrixRotateXYZ()
|
||||
|
||||
int main(void)
|
||||
{
|
||||
@@ -31,9 +32,9 @@ int main(void)
|
||||
camera.fovy = 30.0f; // Camera field-of-view Y
|
||||
camera.projection = CAMERA_PERSPECTIVE; // Camera type
|
||||
|
||||
// Model loading
|
||||
// NOTE: Diffuse map loaded automatically
|
||||
Model model = LoadModel("resources/plane/plane.gltf");
|
||||
Model model = LoadModel("resources/models/obj/plane.obj"); // Load model
|
||||
Texture2D texture = LoadTexture("resources/models/obj/plane_diffuse.png"); // Load model texture
|
||||
model.materials[0].maps[MATERIAL_MAP_DIFFUSE].texture = texture; // Set map diffuse texture
|
||||
|
||||
float pitch = 0.0f;
|
||||
float roll = 0.0f;
|
||||
@@ -78,7 +79,6 @@ int main(void)
|
||||
model.transform = MatrixRotateXYZ((Vector3){ DEG2RAD*pitch, DEG2RAD*yaw, DEG2RAD*roll });
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
|
||||
// Draw
|
||||
//----------------------------------------------------------------------------------
|
||||
BeginDrawing();
|
||||
@@ -88,7 +88,7 @@ int main(void)
|
||||
// Draw 3D model (recomended to draw 3D always before 2D)
|
||||
BeginMode3D(camera);
|
||||
|
||||
DrawModel(model, (Vector3){ 0.0f, 0.0f, 15.0f }, 0.25f, WHITE); // Draw 3d model with texture
|
||||
DrawModel(model, (Vector3){ 0.0f, -8.0f, 0.0f }, 1.0f, WHITE); // Draw 3d model with texture
|
||||
DrawGrid(10, 10.0f);
|
||||
|
||||
EndMode3D();
|
||||
|
23
examples/models/resources/LICENSE.md
Normal file
@@ -0,0 +1,23 @@
|
||||
| resource | author | licence | notes |
|
||||
| :------------------- | :---------: | :------ | :---- |
|
||||
| models/obj/castle.obj,<br>models/castle_diffuse.png | [Alberto Cano](https://www.artstation.com/albertocano) | [CC-BY-NC](https://creativecommons.org/licenses/by-nc/4.0/legalcode) | - |
|
||||
| models/obj/bridge.obj,<br>models/bridge_diffuse.png | [Alberto Cano](https://www.artstation.com/albertocano) | [CC-BY-NC](https://creativecommons.org/licenses/by-nc/4.0/legalcode) | - |
|
||||
| models/obj/house.obj,<br>models/house_diffuse.png | [Alberto Cano](https://www.artstation.com/albertocano) | [CC-BY-NC](https://creativecommons.org/licenses/by-nc/4.0/legalcode) | - |
|
||||
| models/obj/market.obj,<br>models/market_diffuse.png | [Alberto Cano](https://www.artstation.com/albertocano) | [CC-BY-NC](https://creativecommons.org/licenses/by-nc/4.0/legalcode) | - |
|
||||
| models/obj/turret.obj,<br>models/turret_diffuse.png | [Alberto Cano](https://www.artstation.com/albertocano) | [CC-BY-NC](https://creativecommons.org/licenses/by-nc/4.0/legalcode) | - |
|
||||
| models/obj/well.obj,<br>models/well_diffuse.png | [Alberto Cano](https://www.artstation.com/albertocano) | [CC-BY-NC](https://creativecommons.org/licenses/by-nc/4.0/legalcode) | - |
|
||||
| models/obj/cube.obj,<br>models/cube_diffuse.png | [@raysan5](https://github.com/raysan5) | [CC0](https://creativecommons.org/publicdomain/zero/1.0/) | - |
|
||||
| models/obj/plane.gltf,<br>models/gltf/plane/plane.bin,<br>models/gltf/plane/plane_diffuse.png | [GiaHanLam](https://sketchfab.com/GiaHanLam) | [CC-BY](https://creativecommons.org/licenses/by/4.0/) | Used by: [`models_yaw_pitch_roll.c`](https://github.com/raysan5/raylib/blob/master/examples/models/models_yaw_pitch_roll.c)
|
||||
| models/iqm/guy.iqm,<br>models/iqm/guyanim.iqm,<br>models/iqm/guytex.png,<br>models/iqm/guy.blend | [@culacant](https://github.com/culacant) | [CC0](https://creativecommons.org/publicdomain/zero/1.0/) | - |
|
||||
| models/iqm/vertex_colored_object.iqm | ❔ | ❔ | - |
|
||||
| models/gltf/... | _various_ | Check [LICENSE](https://github.com/raysan5/raylib/blob/master/examples/models/resources/models/gltf/LICENSE) | - |
|
||||
| models/vox/chr_knight.vox | ❔ | ❔ | - |
|
||||
| models/vox/chr_sword.vox | ❔ | ❔ | - |
|
||||
| models/vox/monu9.vox | ❔ | ❔ | - |
|
||||
| billboard.png | [@emegeme](https://github.com/emegeme) | [CC0](https://creativecommons.org/publicdomain/zero/1.0/) | - |
|
||||
| cubicmap.png | [@raysan5](https://github.com/raysan5) | [CC0](https://creativecommons.org/publicdomain/zero/1.0/) | - |
|
||||
| cubicmap_atlas.png | [@emegeme](https://github.com/emegeme) | [CC0](https://creativecommons.org/publicdomain/zero/1.0/) | - |
|
||||
| heightmap.png | [@raysan5](https://github.com/raysan5) | [CC0](https://creativecommons.org/publicdomain/zero/1.0/) | - |
|
||||
| dresden_square_1k.hdr | [HDRIHaven](https://hdrihaven.com/hdri/?h=dresden_square) | [CC0](https://hdrihaven.com/p/license.php) | - |
|
||||
| dresden_square_2k.hdr | [HDRIHaven](https://hdrihaven.com/hdri/?h=dresden_square) | [CC0](https://hdrihaven.com/p/license.php) | - |
|
||||
| skybox.png | ❔ | ❔ | - |
|
@@ -1,4 +0,0 @@
|
||||
Medieval City models and textures have been created by Alberto Cano,
|
||||
and licensed as Creative Commons Attribution-NonCommercial 4.0.
|
||||
|
||||
Check for details: https://creativecommons.org/licenses/by-nc/4.0/legalcode
|
@@ -15,6 +15,9 @@ Animated Triangle model is licensed as CC0 Universal Public Domain
|
||||
Gearbox Assy model has been provided by Okino Computer Graphics, using Okino Polytrans Software.
|
||||
no license information was provided
|
||||
|
||||
Girl model has been provided by Hristo Stamenov (https://thatonegamedev.com/)
|
||||
and licensed as CC0 Universal Public Domain
|
||||
|
||||
Check for details on CC0: https://creativecommons.org/publicdomain/zero/1.0/
|
||||
Check for details on CC4: http://creativecommons.org/licenses/by/4.0/
|
||||
GLTF sample models for testing are taken from: https://github.com/KhronosGroup/glTF-Sample-Models/
|
BIN
examples/models/resources/models/gltf/girl.glb
Normal file
BIN
examples/models/resources/models/gltf/vertex_colored_object.glb
Normal file
Before Width: | Height: | Size: 295 KiB After Width: | Height: | Size: 295 KiB |
BIN
examples/models/resources/models/iqm/vertex_colored_object.iqm
Normal file
Before Width: | Height: | Size: 311 KiB After Width: | Height: | Size: 311 KiB |
Before Width: | Height: | Size: 434 KiB After Width: | Height: | Size: 434 KiB |
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 23 KiB |
Before Width: | Height: | Size: 383 KiB After Width: | Height: | Size: 383 KiB |
Before Width: | Height: | Size: 380 KiB After Width: | Height: | Size: 380 KiB |
10858
examples/models/resources/models/obj/plane.obj
Normal file
Before Width: | Height: | Size: 804 KiB After Width: | Height: | Size: 804 KiB |
Before Width: | Height: | Size: 371 KiB After Width: | Height: | Size: 371 KiB |
Before Width: | Height: | Size: 334 KiB After Width: | Height: | Size: 334 KiB |
9
examples/models/resources/models/vox/LICENSE
Normal file
@@ -0,0 +1,9 @@
|
||||
The following models are provided by the official github repo of voxel-model format by MagikaVoxel developer @ephtracy
|
||||
|
||||
GitHub official repo: https://github.com/ephtracy/voxel-model
|
||||
|
||||
- chr_knight.vox - https://github.com/ephtracy/voxel-model/blob/master/vox/character/chr_knight.vox
|
||||
- chr_sword.vox - https://github.com/ephtracy/voxel-model/blob/master/vox/character/chr_sword.vox
|
||||
- monu9.vox - https://github.com/ephtracy/voxel-model/blob/master/vox/monument/monu9.vox
|
||||
|
||||
Worth mentioning there is no license specified for the models yet: https://github.com/ephtracy/voxel-model/issues/22
|
BIN
examples/models/resources/models/vox/chr_knight.vox
Normal file
BIN
examples/models/resources/models/vox/chr_sword.vox
Normal file
BIN
examples/models/resources/models/vox/monu9.vox
Normal file
Before Width: | Height: | Size: 1.8 MiB |
Before Width: | Height: | Size: 547 KiB |