diff --git a/.gitattributes b/.gitattributes index 8a282d2..619cd29 100644 --- a/.gitattributes +++ b/.gitattributes @@ -10,3 +10,4 @@ *.khe filter=lfs diff=lfs merge=lfs -text *.7z filter=lfs diff=lfs merge=lfs -text *.zip filter=lfs diff=lfs merge=lfs -text +*.xcf filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore index 25d1c42..435241a 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,5 @@ build* *.user deploy/config.ini deploy/imgui.ini -deploy/*.exe \ No newline at end of file +deploy/*.exe +deploy/libstdc++-6.dll \ No newline at end of file diff --git a/deploy/data/ambient/1_posX.tga b/deploy/data/ambient/1_posX.tga deleted file mode 100644 index 4f6fe3d..0000000 --- a/deploy/data/ambient/1_posX.tga +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:45812db95bd21535b6a14db30c949d67aa39545b9dd1866c103da6b74e1c62b1 -size 49196 diff --git a/deploy/data/ambient/2_negX.tga b/deploy/data/ambient/2_negX.tga deleted file mode 100644 index 97c95c7..0000000 --- a/deploy/data/ambient/2_negX.tga +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:daf58d6d059395121cfff3340645b1790fce56c988d5414b29d393e5f64c90cc -size 49196 diff --git a/deploy/data/ambient/3_posY.tga b/deploy/data/ambient/3_posY.tga deleted file mode 100644 index a4aaddf..0000000 --- a/deploy/data/ambient/3_posY.tga +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:904069dc6c60ed9823d6379827fe6434b3a05a7331631a508f6f4b96eb208a7a -size 49196 diff --git a/deploy/data/ambient/4_negY.tga b/deploy/data/ambient/4_negY.tga deleted file mode 100644 index 7623b5e..0000000 --- a/deploy/data/ambient/4_negY.tga +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:3f4864454868b3c5b7625e82584e6a28adb1b8727e96266984c4dfc23850f25d -size 49196 diff --git a/deploy/data/ambient/5_posZ.tga b/deploy/data/ambient/5_posZ.tga deleted file mode 100644 index f6df846..0000000 --- a/deploy/data/ambient/5_posZ.tga +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:08a8539cdb09329b5404e2aef67265c4bade0d7761474cd650450d94cb2b9493 -size 49196 diff --git a/deploy/data/ambient/6_negZ.tga b/deploy/data/ambient/6_negZ.tga deleted file mode 100644 index 295f66a..0000000 --- a/deploy/data/ambient/6_negZ.tga +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:d835a097cb53d3e43ffb3e4be852c2047c8fdfed8c9d8eb218cefb2147bf3f74 -size 49196 diff --git a/deploy/data/leather-normal.jpg b/deploy/data/leather-normal.jpg new file mode 100644 index 0000000..a0a89ad --- /dev/null +++ b/deploy/data/leather-normal.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c2744d10d39572868f161f77fee1e6c6114348b31bd735d0535119d956df330e +size 442368 diff --git a/deploy/data/leather.jpg b/deploy/data/leather.jpg index 929af90..a759ddb 100644 --- a/deploy/data/leather.jpg +++ b/deploy/data/leather.jpg @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:fdfb67810a152660d7ddaa702e1bf8ead86cefe3f44cef45f97b34f2f8d8e00b -size 9673 +oid sha256:5d2bc01b2b7aaf394acb0ec5338516465e1c9e2780cd8452330f5d287c6a271e +size 90112 diff --git a/deploy/data/texture.png b/deploy/data/placeholder_albedo.png similarity index 100% rename from deploy/data/texture.png rename to deploy/data/placeholder_albedo.png diff --git a/deploy/data/placeholder_metallic.png b/deploy/data/placeholder_metallic.png new file mode 100644 index 0000000..244efcf --- /dev/null +++ b/deploy/data/placeholder_metallic.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:46fdfe7d35070b6fa17278940d2ae07ba6fe7201872151921f563dcd3645f510 +size 964 diff --git a/deploy/data/placeholder_roughness.png b/deploy/data/placeholder_roughness.png new file mode 100644 index 0000000..4508324 --- /dev/null +++ b/deploy/data/placeholder_roughness.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:551ab4cecfd1b0089fe8b50a209e5cbc1081926ff942cbb0ab30b4d093d37dc2 +size 976 diff --git a/deploy/data/sandbox.mtl b/deploy/data/sandbox.mtl index 8bdd151..855eef0 100644 --- a/deploy/data/sandbox.mtl +++ b/deploy/data/sandbox.mtl @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8e2729d1b53d001080f0e4709b597a8103a98564c7e8b40753158c7a8c0744a2 -size 75 +oid sha256:14a8c4e1ff1636ce10365e4346a7525228929c5dec6c4edc61c3158200174abc +size 135 diff --git a/deploy/data/sandbox.obj b/deploy/data/sandbox.obj index 579657e..fc163c3 100644 --- a/deploy/data/sandbox.obj +++ b/deploy/data/sandbox.obj @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:84dd7a98e4102ce03cd8067bca5b395f63129ab68fd21f6e5114bb4ba7e085c8 -size 365831 +oid sha256:99a23ed6dc26e87d4b9e21addfdc636288211764879582a5299e39f5cc488a10 +size 161050 diff --git a/deploy/data/skybox/1_posX.tga b/deploy/data/skybox/1_posX.tga deleted file mode 100644 index 3ea5b7f..0000000 --- a/deploy/data/skybox/1_posX.tga +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:936d3c5ea0589cb0600ae0d7116cafd2792e025055e0a3b7eb4ecfda2291e93b -size 12582930 diff --git a/deploy/data/skybox/2_negX.tga b/deploy/data/skybox/2_negX.tga deleted file mode 100644 index 89bd1e8..0000000 --- a/deploy/data/skybox/2_negX.tga +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:68288c1a11df99056d5009ddf67accc5f52677ceff0c990152ef4b643ee2e8c4 -size 12582930 diff --git a/deploy/data/skybox/3_posY.tga b/deploy/data/skybox/3_posY.tga deleted file mode 100644 index 8dc3621..0000000 --- a/deploy/data/skybox/3_posY.tga +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:4ce096e0ce8da69464a183c9d80ea9e7937b4e960ef2774237f2a6ade2bddf50 -size 241711 diff --git a/deploy/data/skybox/4_negY.tga b/deploy/data/skybox/4_negY.tga deleted file mode 100644 index de517e4..0000000 --- a/deploy/data/skybox/4_negY.tga +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:7bce18ac878bf0df16f9a55d881ab076a074c257b7c24f40249ddd77d43d36c6 -size 2848272 diff --git a/deploy/data/skybox/5_posZ.tga b/deploy/data/skybox/5_posZ.tga deleted file mode 100644 index aeec736..0000000 --- a/deploy/data/skybox/5_posZ.tga +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:58192d9fa5dcbc58884d90db48469197561b4b8d49d7a39c71b4521743fdc4b2 -size 12582930 diff --git a/deploy/data/skybox/6_negZ.tga b/deploy/data/skybox/6_negZ.tga deleted file mode 100644 index e8c245e..0000000 --- a/deploy/data/skybox/6_negZ.tga +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:087883d665611ebec43e4b3e10abb10595a40bdd1084dbd350c1f0b4f59f542e -size 12582930 diff --git a/deploy/data/skybox/craterlake_bk.tga b/deploy/data/skybox/craterlake_bk.tga deleted file mode 100644 index ac7bff3..0000000 --- a/deploy/data/skybox/craterlake_bk.tga +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:e916551b97b12ebd31228fe8ccc06523cc7ac98eee1daa76032b8fee1b0cee11 -size 769437 diff --git a/deploy/data/skybox/craterlake_dn.tga b/deploy/data/skybox/craterlake_dn.tga deleted file mode 100644 index 0c3146e..0000000 --- a/deploy/data/skybox/craterlake_dn.tga +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:47a24fd77edac34fbd9b9031754624e1fca3c047830b0820654b74e202969891 -size 757939 diff --git a/deploy/data/skybox/craterlake_ft.tga b/deploy/data/skybox/craterlake_ft.tga deleted file mode 100644 index 10dfccb..0000000 --- a/deploy/data/skybox/craterlake_ft.tga +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:b7b25f9cfdaa42f9ea37596e07edc120df9261c0c695ab3cead68d7c646c2a73 -size 737349 diff --git a/deploy/data/skybox/craterlake_lf.tga b/deploy/data/skybox/craterlake_lf.tga deleted file mode 100644 index e7224de..0000000 --- a/deploy/data/skybox/craterlake_lf.tga +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:c1d5aee7e0a4041674f1ce844fbfd194972e6968002e05570c098e65530c862b -size 766552 diff --git a/deploy/data/skybox/craterlake_rt.tga b/deploy/data/skybox/craterlake_rt.tga deleted file mode 100644 index f415f14..0000000 --- a/deploy/data/skybox/craterlake_rt.tga +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:037b77efe579a762a1acc920388d4da1d16658893179502324ee89598eb69cff -size 704063 diff --git a/deploy/data/skybox/craterlake_up.tga b/deploy/data/skybox/craterlake_up.tga deleted file mode 100644 index cdd495e..0000000 --- a/deploy/data/skybox/craterlake_up.tga +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:cc2c22f138ad728700079827f0202a91dcd7c5be10d683c887c0b2970def5d95 -size 626448 diff --git a/deploy/data/skybox/irradiance/output_iem_negx.tga b/deploy/data/skybox/irradiance/output_iem_negx.tga new file mode 100644 index 0000000..69ca94d --- /dev/null +++ b/deploy/data/skybox/irradiance/output_iem_negx.tga @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c1baaa3242ba7698b15abc9aaf5c7c3204e58292f59228824279fa52cdb89b05 +size 49196 diff --git a/deploy/data/skybox/irradiance/output_iem_negy.tga b/deploy/data/skybox/irradiance/output_iem_negy.tga new file mode 100644 index 0000000..9afc39c --- /dev/null +++ b/deploy/data/skybox/irradiance/output_iem_negy.tga @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8f4b359239337835920df3a5daccce444dcf460042b98d2fa3939fe9547b8b80 +size 49196 diff --git a/deploy/data/skybox/irradiance/output_iem_negz.tga b/deploy/data/skybox/irradiance/output_iem_negz.tga new file mode 100644 index 0000000..7348027 --- /dev/null +++ b/deploy/data/skybox/irradiance/output_iem_negz.tga @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f4121e8341bfab6af25dfdb1c7a53fe21fd43f2096dc36418c0d6829575b609a +size 49196 diff --git a/deploy/data/skybox/irradiance/output_iem_posx.tga b/deploy/data/skybox/irradiance/output_iem_posx.tga new file mode 100644 index 0000000..1f6f314 --- /dev/null +++ b/deploy/data/skybox/irradiance/output_iem_posx.tga @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f7e278b2b3ca38f5dd9cd23e8f515414c164674f423a0647d370235691de6392 +size 49196 diff --git a/deploy/data/skybox/irradiance/output_iem_posy.tga b/deploy/data/skybox/irradiance/output_iem_posy.tga new file mode 100644 index 0000000..1867640 --- /dev/null +++ b/deploy/data/skybox/irradiance/output_iem_posy.tga @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:00b22806b3a4c783ef2940a41b737e3cc3514f61c132d572570b667cec9fe267 +size 49196 diff --git a/deploy/data/skybox/irradiance/output_iem_posz.tga b/deploy/data/skybox/irradiance/output_iem_posz.tga new file mode 100644 index 0000000..3041e53 --- /dev/null +++ b/deploy/data/skybox/irradiance/output_iem_posz.tga @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bc714292c57032f7b2240406895e1ac615e4a6712e20d8eea7bf6bda9f06fe80 +size 49196 diff --git a/deploy/data/skybox/negx.jpg b/deploy/data/skybox/negx.jpg new file mode 100644 index 0000000..e504e3d --- /dev/null +++ b/deploy/data/skybox/negx.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6efcbf14235195b091b931afe485161faec35e00387d09f26f95bc11a7576d7f +size 984770 diff --git a/deploy/data/skybox/negy.jpg b/deploy/data/skybox/negy.jpg new file mode 100644 index 0000000..771b5ce --- /dev/null +++ b/deploy/data/skybox/negy.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ebfc03ca277689fa7599d13bd68e87504f6a5a567096b87ca3bd275612ef110c +size 920695 diff --git a/deploy/data/skybox/negz.jpg b/deploy/data/skybox/negz.jpg new file mode 100644 index 0000000..ac6ee27 --- /dev/null +++ b/deploy/data/skybox/negz.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:01b5ffa6298bbf3ce0c18ac64a6a0f26fc41b9e0f97f621c0e1ce24912571335 +size 969866 diff --git a/deploy/data/skybox/posx.jpg b/deploy/data/skybox/posx.jpg new file mode 100644 index 0000000..201d031 --- /dev/null +++ b/deploy/data/skybox/posx.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8a0859370df4e5c0344b4aac3b3d560a2c2028e3d39157a5b4b9c73a13558c2f +size 828251 diff --git a/deploy/data/skybox/posy.jpg b/deploy/data/skybox/posy.jpg new file mode 100644 index 0000000..ed70687 --- /dev/null +++ b/deploy/data/skybox/posy.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:64d1fe87044df58be2684c6e23d22bb26bade269967b696c329fd2aa8f1e9c15 +size 441172 diff --git a/deploy/data/skybox/posz.jpg b/deploy/data/skybox/posz.jpg new file mode 100644 index 0000000..6421671 --- /dev/null +++ b/deploy/data/skybox/posz.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f54c2adf921ff84237b09192cb4264ea61702930f5c7359b13561f4b19ee08e1 +size 874231 diff --git a/deploy/data/skybox/radiance/output_pmrem_negx_0_256x256.tga b/deploy/data/skybox/radiance/output_pmrem_negx_0_256x256.tga new file mode 100644 index 0000000..56d7f05 --- /dev/null +++ b/deploy/data/skybox/radiance/output_pmrem_negx_0_256x256.tga @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:333fecf8797a6544af2e52322d1eb008157dd85e94e6f79db041a6ba4f9336d2 +size 196652 diff --git a/deploy/data/skybox/radiance/output_pmrem_negx_1_128x128.tga b/deploy/data/skybox/radiance/output_pmrem_negx_1_128x128.tga new file mode 100644 index 0000000..c561a7c --- /dev/null +++ b/deploy/data/skybox/radiance/output_pmrem_negx_1_128x128.tga @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:08f71d708e9d5d59a494950c75449dc28c67b6506d870402f8a666cf7a997efe +size 49196 diff --git a/deploy/data/skybox/radiance/output_pmrem_negx_2_64x64.tga b/deploy/data/skybox/radiance/output_pmrem_negx_2_64x64.tga new file mode 100644 index 0000000..1e7a584 --- /dev/null +++ b/deploy/data/skybox/radiance/output_pmrem_negx_2_64x64.tga @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2c25024509999c76ad9efe170738e1483ea17ca2db9b8524e052956eeeaaedbf +size 12332 diff --git a/deploy/data/skybox/radiance/output_pmrem_negx_3_32x32.tga b/deploy/data/skybox/radiance/output_pmrem_negx_3_32x32.tga new file mode 100644 index 0000000..d8c189b --- /dev/null +++ b/deploy/data/skybox/radiance/output_pmrem_negx_3_32x32.tga @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7097ad8a89a6f3af9647f700f0d26ac087840e52a84099510e1b80fb003fa84d +size 3116 diff --git a/deploy/data/skybox/radiance/output_pmrem_negx_4_16x16.tga b/deploy/data/skybox/radiance/output_pmrem_negx_4_16x16.tga new file mode 100644 index 0000000..7de3845 --- /dev/null +++ b/deploy/data/skybox/radiance/output_pmrem_negx_4_16x16.tga @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4a7a2b4e2292d84840020583caa71c402ca126ae6428351fda4f035327487090 +size 812 diff --git a/deploy/data/skybox/radiance/output_pmrem_negx_5_8x8.tga b/deploy/data/skybox/radiance/output_pmrem_negx_5_8x8.tga new file mode 100644 index 0000000..80c89cb --- /dev/null +++ b/deploy/data/skybox/radiance/output_pmrem_negx_5_8x8.tga @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7b56b99b2544af4ee9d59c8a8dba10187da143f25402b3acdb139995ff52cbfd +size 236 diff --git a/deploy/data/skybox/radiance/output_pmrem_negx_6_4x4.tga b/deploy/data/skybox/radiance/output_pmrem_negx_6_4x4.tga new file mode 100644 index 0000000..9bce9fd --- /dev/null +++ b/deploy/data/skybox/radiance/output_pmrem_negx_6_4x4.tga @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:416310b4a3f4d37ed6504457bb8190d20b5272d75c12eb1413a5bae8cd74c48e +size 92 diff --git a/deploy/data/skybox/radiance/output_pmrem_negy_0_256x256.tga b/deploy/data/skybox/radiance/output_pmrem_negy_0_256x256.tga new file mode 100644 index 0000000..21133c0 --- /dev/null +++ b/deploy/data/skybox/radiance/output_pmrem_negy_0_256x256.tga @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:373f8428acfefda452bf911c1ebfb2f350df3209b1e4b282992fa10105588c60 +size 196652 diff --git a/deploy/data/skybox/radiance/output_pmrem_negy_1_128x128.tga b/deploy/data/skybox/radiance/output_pmrem_negy_1_128x128.tga new file mode 100644 index 0000000..74a846d --- /dev/null +++ b/deploy/data/skybox/radiance/output_pmrem_negy_1_128x128.tga @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5af91cbc5db96a8b88bb4e551d0ba0dea7bb5bf45b8c1c72c1653de7286427fa +size 49196 diff --git a/deploy/data/skybox/radiance/output_pmrem_negy_2_64x64.tga b/deploy/data/skybox/radiance/output_pmrem_negy_2_64x64.tga new file mode 100644 index 0000000..6206388 --- /dev/null +++ b/deploy/data/skybox/radiance/output_pmrem_negy_2_64x64.tga @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2377e72db989c13092b75a315578e6db558fc3b321457d4de4c15df97abc7540 +size 12332 diff --git a/deploy/data/skybox/radiance/output_pmrem_negy_3_32x32.tga b/deploy/data/skybox/radiance/output_pmrem_negy_3_32x32.tga new file mode 100644 index 0000000..6878a7f --- /dev/null +++ b/deploy/data/skybox/radiance/output_pmrem_negy_3_32x32.tga @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e651764a88659811d324142561ac6aa1af3f7715101ecde0d4f6bf543c0e903a +size 3116 diff --git a/deploy/data/skybox/radiance/output_pmrem_negy_4_16x16.tga b/deploy/data/skybox/radiance/output_pmrem_negy_4_16x16.tga new file mode 100644 index 0000000..2bbef15 --- /dev/null +++ b/deploy/data/skybox/radiance/output_pmrem_negy_4_16x16.tga @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5a3ada5ab96b4527391564c32623de9edacaf3e9b09bd85bd5124a3c55825ae6 +size 812 diff --git a/deploy/data/skybox/radiance/output_pmrem_negy_5_8x8.tga b/deploy/data/skybox/radiance/output_pmrem_negy_5_8x8.tga new file mode 100644 index 0000000..c864964 --- /dev/null +++ b/deploy/data/skybox/radiance/output_pmrem_negy_5_8x8.tga @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3b72bde41cea39f7bb135c7e8a417b77c18d43adcc22d5c6b25cd70dd6eda69f +size 236 diff --git a/deploy/data/skybox/radiance/output_pmrem_negy_6_4x4.tga b/deploy/data/skybox/radiance/output_pmrem_negy_6_4x4.tga new file mode 100644 index 0000000..a3910e1 --- /dev/null +++ b/deploy/data/skybox/radiance/output_pmrem_negy_6_4x4.tga @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3bf3ffc2ea6e6c26aeae7c5604ed5faa2e34c645c0dd93008a7de2a6cec15019 +size 92 diff --git a/deploy/data/skybox/radiance/output_pmrem_negz_0_256x256.tga b/deploy/data/skybox/radiance/output_pmrem_negz_0_256x256.tga new file mode 100644 index 0000000..455fc22 --- /dev/null +++ b/deploy/data/skybox/radiance/output_pmrem_negz_0_256x256.tga @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4e45c458624b60f6643b792bae38d9fdb0e2ce09e0017e57413cac6d088526a6 +size 196652 diff --git a/deploy/data/skybox/radiance/output_pmrem_negz_1_128x128.tga b/deploy/data/skybox/radiance/output_pmrem_negz_1_128x128.tga new file mode 100644 index 0000000..0483d03 --- /dev/null +++ b/deploy/data/skybox/radiance/output_pmrem_negz_1_128x128.tga @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:93dc1b44a9e8c4d97936a3d6905f1f05487c9d7f40a06b1671aea4b63687629f +size 49196 diff --git a/deploy/data/skybox/radiance/output_pmrem_negz_2_64x64.tga b/deploy/data/skybox/radiance/output_pmrem_negz_2_64x64.tga new file mode 100644 index 0000000..a3174e4 --- /dev/null +++ b/deploy/data/skybox/radiance/output_pmrem_negz_2_64x64.tga @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:88ab3af933739bbaa9249e0280fef5133e9880c72cb8ffd37bc9dacc4c71b691 +size 12332 diff --git a/deploy/data/skybox/radiance/output_pmrem_negz_3_32x32.tga b/deploy/data/skybox/radiance/output_pmrem_negz_3_32x32.tga new file mode 100644 index 0000000..5aec11c --- /dev/null +++ b/deploy/data/skybox/radiance/output_pmrem_negz_3_32x32.tga @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5d421cb3efd11a343e14d2a6554c68c70c8f6dbb290bfe6bf360d63d052a5823 +size 3116 diff --git a/deploy/data/skybox/radiance/output_pmrem_negz_4_16x16.tga b/deploy/data/skybox/radiance/output_pmrem_negz_4_16x16.tga new file mode 100644 index 0000000..9aad878 --- /dev/null +++ b/deploy/data/skybox/radiance/output_pmrem_negz_4_16x16.tga @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:947ea79f3e73b0abf28be86765cd856a6fb563aabe32c5da5d501b20dac95d7a +size 812 diff --git a/deploy/data/skybox/radiance/output_pmrem_negz_5_8x8.tga b/deploy/data/skybox/radiance/output_pmrem_negz_5_8x8.tga new file mode 100644 index 0000000..743272d --- /dev/null +++ b/deploy/data/skybox/radiance/output_pmrem_negz_5_8x8.tga @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d28cbd7ebddab169c2173978c9c81e74061b224e5855b199ca6537bf3a239e70 +size 236 diff --git a/deploy/data/skybox/radiance/output_pmrem_negz_6_4x4.tga b/deploy/data/skybox/radiance/output_pmrem_negz_6_4x4.tga new file mode 100644 index 0000000..beeece3 --- /dev/null +++ b/deploy/data/skybox/radiance/output_pmrem_negz_6_4x4.tga @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6d472dfce75085ff25ba3e23829f23d2447b247b78c615ad8cec10da04169558 +size 92 diff --git a/deploy/data/skybox/radiance/output_pmrem_posx_0_256x256.tga b/deploy/data/skybox/radiance/output_pmrem_posx_0_256x256.tga new file mode 100644 index 0000000..143116e --- /dev/null +++ b/deploy/data/skybox/radiance/output_pmrem_posx_0_256x256.tga @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:60be6c064bcb36d3d762547e8698e5f68f084071a3ed66721c915afc9a8e6f21 +size 196652 diff --git a/deploy/data/skybox/radiance/output_pmrem_posx_1_128x128.tga b/deploy/data/skybox/radiance/output_pmrem_posx_1_128x128.tga new file mode 100644 index 0000000..e6031ed --- /dev/null +++ b/deploy/data/skybox/radiance/output_pmrem_posx_1_128x128.tga @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c277d76ba3899b71db2e4eae36a23188db4537aaeeaa8332c2e2a3332458a5fd +size 49196 diff --git a/deploy/data/skybox/radiance/output_pmrem_posx_2_64x64.tga b/deploy/data/skybox/radiance/output_pmrem_posx_2_64x64.tga new file mode 100644 index 0000000..73a94cc --- /dev/null +++ b/deploy/data/skybox/radiance/output_pmrem_posx_2_64x64.tga @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:29e252f5dc01e7268af321662d983fd04ae034ff95c87da1a84352b6c39cea8a +size 12332 diff --git a/deploy/data/skybox/radiance/output_pmrem_posx_3_32x32.tga b/deploy/data/skybox/radiance/output_pmrem_posx_3_32x32.tga new file mode 100644 index 0000000..461cc00 --- /dev/null +++ b/deploy/data/skybox/radiance/output_pmrem_posx_3_32x32.tga @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e6329d770f72439a9972be6c7924f62815894a21dd64fcb5d9655319a32d01f1 +size 3116 diff --git a/deploy/data/skybox/radiance/output_pmrem_posx_4_16x16.tga b/deploy/data/skybox/radiance/output_pmrem_posx_4_16x16.tga new file mode 100644 index 0000000..db6e89d --- /dev/null +++ b/deploy/data/skybox/radiance/output_pmrem_posx_4_16x16.tga @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b0f067a63e0a07bb3b46d1aa41b7e9af4bc9c9a646d891390c12dceb4789fcf3 +size 812 diff --git a/deploy/data/skybox/radiance/output_pmrem_posx_5_8x8.tga b/deploy/data/skybox/radiance/output_pmrem_posx_5_8x8.tga new file mode 100644 index 0000000..6205fe1 --- /dev/null +++ b/deploy/data/skybox/radiance/output_pmrem_posx_5_8x8.tga @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7013ee41b72266d21185a7dd0a9befa330687db228b13e63a4a08b9f4b1016ec +size 236 diff --git a/deploy/data/skybox/radiance/output_pmrem_posx_6_4x4.tga b/deploy/data/skybox/radiance/output_pmrem_posx_6_4x4.tga new file mode 100644 index 0000000..ae7a1eb --- /dev/null +++ b/deploy/data/skybox/radiance/output_pmrem_posx_6_4x4.tga @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ea743089b0a17b78595995eda9a52e2915585c22bb1489b00a72c0a8bd4e53e6 +size 92 diff --git a/deploy/data/skybox/radiance/output_pmrem_posy_0_256x256.tga b/deploy/data/skybox/radiance/output_pmrem_posy_0_256x256.tga new file mode 100644 index 0000000..51b4a61 --- /dev/null +++ b/deploy/data/skybox/radiance/output_pmrem_posy_0_256x256.tga @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3d5beee5ddf88e9adeba84cb7210e6855f8f8cbb9b902afdf4dbd06419a53537 +size 196652 diff --git a/deploy/data/skybox/radiance/output_pmrem_posy_1_128x128.tga b/deploy/data/skybox/radiance/output_pmrem_posy_1_128x128.tga new file mode 100644 index 0000000..4074cbb --- /dev/null +++ b/deploy/data/skybox/radiance/output_pmrem_posy_1_128x128.tga @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a0449d6dbafc88beb246817625317893b9926ee9cf10860b3a10ddf43d239f2b +size 49196 diff --git a/deploy/data/skybox/radiance/output_pmrem_posy_2_64x64.tga b/deploy/data/skybox/radiance/output_pmrem_posy_2_64x64.tga new file mode 100644 index 0000000..c76b178 --- /dev/null +++ b/deploy/data/skybox/radiance/output_pmrem_posy_2_64x64.tga @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6f1808e3adc6abfbab52e9d972cccd9ffd04f4903ebd3e794d628bdd62030e2a +size 12332 diff --git a/deploy/data/skybox/radiance/output_pmrem_posy_3_32x32.tga b/deploy/data/skybox/radiance/output_pmrem_posy_3_32x32.tga new file mode 100644 index 0000000..5f5972c --- /dev/null +++ b/deploy/data/skybox/radiance/output_pmrem_posy_3_32x32.tga @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7f4eac30e58b0dc2d05d392b8fe3c4019012e41a8745bbdf104903490efec650 +size 3116 diff --git a/deploy/data/skybox/radiance/output_pmrem_posy_4_16x16.tga b/deploy/data/skybox/radiance/output_pmrem_posy_4_16x16.tga new file mode 100644 index 0000000..ab82d2e --- /dev/null +++ b/deploy/data/skybox/radiance/output_pmrem_posy_4_16x16.tga @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bb236d64b7e41e297e6b5553c9660fcee9eaf6dde03da8f642102dff163b7cf0 +size 812 diff --git a/deploy/data/skybox/radiance/output_pmrem_posy_5_8x8.tga b/deploy/data/skybox/radiance/output_pmrem_posy_5_8x8.tga new file mode 100644 index 0000000..7070c7f --- /dev/null +++ b/deploy/data/skybox/radiance/output_pmrem_posy_5_8x8.tga @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f742960ac07dba64a8ca5fc8e1b8c73565e175b8e35b19ad61a316cd48fb4ab5 +size 236 diff --git a/deploy/data/skybox/radiance/output_pmrem_posy_6_4x4.tga b/deploy/data/skybox/radiance/output_pmrem_posy_6_4x4.tga new file mode 100644 index 0000000..81b6fb0 --- /dev/null +++ b/deploy/data/skybox/radiance/output_pmrem_posy_6_4x4.tga @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:18d6f1b5259741b319bfea4736da0832448beb1e02dcdbff108bd87125f2ae31 +size 92 diff --git a/deploy/data/skybox/radiance/output_pmrem_posz_0_256x256.tga b/deploy/data/skybox/radiance/output_pmrem_posz_0_256x256.tga new file mode 100644 index 0000000..b93407a --- /dev/null +++ b/deploy/data/skybox/radiance/output_pmrem_posz_0_256x256.tga @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:10d29620fed7c07a8106501d3079f917e64b66447850f3f3d89069f9e0a4be72 +size 196652 diff --git a/deploy/data/skybox/radiance/output_pmrem_posz_1_128x128.tga b/deploy/data/skybox/radiance/output_pmrem_posz_1_128x128.tga new file mode 100644 index 0000000..48a81fc --- /dev/null +++ b/deploy/data/skybox/radiance/output_pmrem_posz_1_128x128.tga @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:28b757b41ad55e7b008e599832063c3e206f14b3d1cd10c3c1e531ef08b03f54 +size 49196 diff --git a/deploy/data/skybox/radiance/output_pmrem_posz_2_64x64.tga b/deploy/data/skybox/radiance/output_pmrem_posz_2_64x64.tga new file mode 100644 index 0000000..95ba362 --- /dev/null +++ b/deploy/data/skybox/radiance/output_pmrem_posz_2_64x64.tga @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4032c4118ba7c21636405a9cd70d82e210de016090b155be5f5546b637c6abb4 +size 12332 diff --git a/deploy/data/skybox/radiance/output_pmrem_posz_3_32x32.tga b/deploy/data/skybox/radiance/output_pmrem_posz_3_32x32.tga new file mode 100644 index 0000000..01a4eef --- /dev/null +++ b/deploy/data/skybox/radiance/output_pmrem_posz_3_32x32.tga @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1ad4a9a7848931af6d42719cc8ee1f6347a8f20621e4e14b7519c4ae072ad202 +size 3116 diff --git a/deploy/data/skybox/radiance/output_pmrem_posz_4_16x16.tga b/deploy/data/skybox/radiance/output_pmrem_posz_4_16x16.tga new file mode 100644 index 0000000..6ddfa87 --- /dev/null +++ b/deploy/data/skybox/radiance/output_pmrem_posz_4_16x16.tga @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bd569691d35e6968f8a0baa4326b4ca4af2602880ad879d0b853fee97124c101 +size 812 diff --git a/deploy/data/skybox/radiance/output_pmrem_posz_5_8x8.tga b/deploy/data/skybox/radiance/output_pmrem_posz_5_8x8.tga new file mode 100644 index 0000000..8f4b803 --- /dev/null +++ b/deploy/data/skybox/radiance/output_pmrem_posz_5_8x8.tga @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1251d21c9e3f07f0f1c27c09b17be7b5aeaae51d60809a4432007d5f5ca6463c +size 236 diff --git a/deploy/data/skybox/radiance/output_pmrem_posz_6_4x4.tga b/deploy/data/skybox/radiance/output_pmrem_posz_6_4x4.tga new file mode 100644 index 0000000..d64d8c6 --- /dev/null +++ b/deploy/data/skybox/radiance/output_pmrem_posz_6_4x4.tga @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f6b1b62b71cb4d758b1f0712a227e23795346d94ccd101b57a4a31be9ac044ff +size 92 diff --git a/deploy/data/skybox/skybox.xcf b/deploy/data/skybox/skybox.xcf new file mode 100644 index 0000000..234c122 Binary files /dev/null and b/deploy/data/skybox/skybox.xcf differ diff --git a/deploy/data/slipperystonework_albedo.png b/deploy/data/slipperystonework_albedo.png new file mode 100644 index 0000000..25807b0 --- /dev/null +++ b/deploy/data/slipperystonework_albedo.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:162ceea8b3cc087aa4bcb25db70a88b433649e6e8a7f491ba50cc2581585bf47 +size 7314341 diff --git a/deploy/data/slipperystonework_metallic.png b/deploy/data/slipperystonework_metallic.png new file mode 100644 index 0000000..fa88b15 --- /dev/null +++ b/deploy/data/slipperystonework_metallic.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:16ab4394f49880fe64b2a6405592a0325367f184d4829d8219612aef91c05f18 +size 15009 diff --git a/deploy/data/slipperystonework_normal.png b/deploy/data/slipperystonework_normal.png new file mode 100644 index 0000000..c88630f --- /dev/null +++ b/deploy/data/slipperystonework_normal.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ce7fa8504ccc7ef77e9dcb16bd1e1043797de43783dfbe472bf52ffb6e65da56 +size 7533234 diff --git a/deploy/data/slipperystonework_roughness.png b/deploy/data/slipperystonework_roughness.png new file mode 100644 index 0000000..6bd8a2c --- /dev/null +++ b/deploy/data/slipperystonework_roughness.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3c3f730b52ba57e9b5f64490b27a702b38222d043264d3e414722dbe5bac6bd1 +size 4799103 diff --git a/deploy/data/steel.jpg b/deploy/data/steel.jpg deleted file mode 100644 index d57cafc..0000000 --- a/deploy/data/steel.jpg +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:40ba8f1ef59a9cfda99149b0aca367e9211f130da99a9fdfc547cedfa1a4bcb4 -size 6474 diff --git a/deploy/data/streakedmetal_albedo.png b/deploy/data/streakedmetal_albedo.png new file mode 100644 index 0000000..2cecab1 --- /dev/null +++ b/deploy/data/streakedmetal_albedo.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4c21a445fb923a8c0afe279135470f1da0290dd43b4f0ebcdcad458374fcb536 +size 1335112 diff --git a/deploy/data/streakedmetal_metallic.png b/deploy/data/streakedmetal_metallic.png new file mode 100644 index 0000000..fb50e22 --- /dev/null +++ b/deploy/data/streakedmetal_metallic.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:07f3c88595d842cf1cd40d4c9bebb4e82e97ae850d9a80500d4fd56a785e902b +size 19626 diff --git a/deploy/data/streakedmetal_roughness.png b/deploy/data/streakedmetal_roughness.png new file mode 100644 index 0000000..a1bd67c --- /dev/null +++ b/deploy/data/streakedmetal_roughness.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5c7f0e3e6fc1725c71257cf4192792ef03c79d98cf0fa515189dadb04bb785cd +size 2982336 diff --git a/deploy/data/sword.mtl b/deploy/data/sword.mtl index 88e8262..a026cb8 100644 --- a/deploy/data/sword.mtl +++ b/deploy/data/sword.mtl @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:21173927cb0e81a2acbc0e4e8382293c08d8e633f47caa3ce76f870b56b6d561 -size 129 +oid sha256:e27f98dd3a63a908e4afdbeddba84670faf89d31e7a25c0dcaf642cda5cf7c37 +size 229 diff --git a/deploy/data/woodbox.pack b/deploy/data/woodbox.pack new file mode 100644 index 0000000..c7eb6ca --- /dev/null +++ b/deploy/data/woodbox.pack @@ -0,0 +1,38 @@ +{ + "TextureResource": [ + { + "woodbox albedo", + "woodframe_albedo.png", + 24, + 1, + 1 + } + { + "woodbox roughness", + "woodframe_roughness.png", + 8, + 1, + 1 + } + { + "woodbox metallic", + "woodframe_metallic.png", + 8, + 1, + 1 + } + { + "woodbox normals", + "woodframe_normal.png", + 24, + 1, + 1 + } + ], + "ResourcePack": [ + { + "woodbox", + [{"TextureResource", 0}] + } + ] +} diff --git a/deploy/data/woodframe_albedo.png b/deploy/data/woodframe_albedo.png new file mode 100644 index 0000000..b4d73c6 --- /dev/null +++ b/deploy/data/woodframe_albedo.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6bad25466e6184902ee2c2ec7d47f8ae112943d3c92fca387a5b41da0b42a2a5 +size 6976127 diff --git a/deploy/data/woodframe_metallic.png b/deploy/data/woodframe_metallic.png new file mode 100644 index 0000000..68da9ea --- /dev/null +++ b/deploy/data/woodframe_metallic.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:289e65cf6fa41d6c00a62cde57ffb20dbe5f1de6b3e6a3ef4d8a7de8f41524bd +size 15007 diff --git a/deploy/data/woodframe_normal.png b/deploy/data/woodframe_normal.png new file mode 100644 index 0000000..984fed4 --- /dev/null +++ b/deploy/data/woodframe_normal.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:25c6e56846639f176e8d9ef756b5df8329cba6cd0117812dc79dfa2892ccf560 +size 6869334 diff --git a/deploy/data/woodframe_roughness.png b/deploy/data/woodframe_roughness.png new file mode 100644 index 0000000..532fb92 --- /dev/null +++ b/deploy/data/woodframe_roughness.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f714f443197a22e6f7148004b344f0081f9c7667b85429472d38b9190af43d79 +size 1822076 diff --git a/deploy/libstdc++-6.dll b/deploy/libstdc++-6.dll deleted file mode 100644 index 6d3d90e..0000000 --- a/deploy/libstdc++-6.dll +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:544d488fcfd76749c5ef2cd6bf9f73cc9fe59a86a819d369d710cca6e43cf4b1 -size 1540622 diff --git a/src/defaultkeysmap.h b/src/defaultkeysmap.h index bf8724c..caed570 100644 --- a/src/defaultkeysmap.h +++ b/src/defaultkeysmap.h @@ -6,9 +6,9 @@ class DefaultKeysMap : public IKeysMap { public: - enum{MAIN_ACTION, SECONDARY_ACTION, TERTIARY_ACTION, MOVE_FORWARD, MOVE_BACKWARD, STRAFE_LEFT, STRAFE_RIGHT, JUMP, + enum{MAIN_ACTION, SECONDARY_ACTION, TERTIARY_ACTION, MOVE_FORWARD, MOVE_BACKWARD, STRAFE_LEFT, STRAFE_RIGHT, JUMP,RUN, TOGGLE_NOCLIP, TOGGLE_PHYSICS_DEBUG, TOGGLE_CONSOLE, - MOVE_CURSOR_LEFT, MOVE_CURSOR_RIGHT, TOGGLE_MOUSE_CURSOR, LEFT_CLICK, + MOVE_CURSOR_LEFT, MOVE_CURSOR_RIGHT, HISTORY_UP,HISTORY_DOWN, TOGGLE_MOUSE_CURSOR, LEFT_CLICK, EXIT_GAME,LAST_DEFAULT_ACTION}; DefaultKeysMap(){ @@ -16,15 +16,18 @@ public: keys.push_back( {{SECONDARY_ACTION,input::MOUSE}, sf::Mouse::Right, IKeysMap::PRESSED} ); keys.push_back( {{TERTIARY_ACTION,input::MOUSE}, sf::Mouse::Middle, IKeysMap::PRESSED} ); keys.push_back( {{MOVE_FORWARD,input::KEYBOARD}, sf::Keyboard::Z, IKeysMap::HOLD} ); - keys.push_back( {{MOVE_BACKWARD,input::KEYBOARD}, sf::Keyboard::S, IKeysMap::HOLD} ); + keys.push_back( {{MOVE_BACKWARD,input::KEYBOARD}, sf::Keyboard::S, IKeysMap::HOLD} ); keys.push_back( {{STRAFE_LEFT,input::KEYBOARD}, sf::Keyboard::Q, IKeysMap::HOLD} ); keys.push_back( {{STRAFE_RIGHT,input::KEYBOARD}, sf::Keyboard::D, IKeysMap::HOLD} ); + keys.push_back( {{RUN,input::KEYBOARD}, sf::Keyboard::LShift,IKeysMap::HOLD} ); keys.push_back( {{JUMP,input::KEYBOARD}, sf::Keyboard::Space, IKeysMap::PRESSED} ); keys.push_back( {{TOGGLE_NOCLIP,input::KEYBOARD}, sf::Keyboard::G, IKeysMap::PRESSED} ); keys.push_back( {{TOGGLE_PHYSICS_DEBUG,input::KEYBOARD},sf::Keyboard::P, IKeysMap::PRESSED} ); keys.push_back( {{TOGGLE_CONSOLE,input::KEYBOARD}, sf::Keyboard::F3, IKeysMap::PRESSED} ); keys.push_back( {{MOVE_CURSOR_LEFT,input::KEYBOARD}, sf::Keyboard::Left, IKeysMap::PRESSED} ); keys.push_back( {{MOVE_CURSOR_RIGHT,input::KEYBOARD}, sf::Keyboard::Right, IKeysMap::PRESSED} ); + keys.push_back( {{HISTORY_UP,input::KEYBOARD}, sf::Keyboard::Up, IKeysMap::PRESSED} ); + keys.push_back( {{HISTORY_DOWN,input::KEYBOARD}, sf::Keyboard::Down, IKeysMap::PRESSED} ); keys.push_back( {{TOGGLE_MOUSE_CURSOR,input::KEYBOARD}, sf::Keyboard::M, IKeysMap::PRESSED} ); keys.push_back( {{EXIT_GAME,input::KEYBOARD}, sf::Keyboard::Escape,IKeysMap::PRESSED} ); keys.push_back( {{LEFT_CLICK,input::MOUSE}, sf::Mouse::Left, IKeysMap::PRESSED} ); @@ -41,6 +44,7 @@ public: {STRAFE_LEFT,input::KEYBOARD}, {STRAFE_RIGHT,input::KEYBOARD}, {JUMP,input::KEYBOARD}, + {RUN,input::KEYBOARD}, {TOGGLE_NOCLIP,input::KEYBOARD}, {TOGGLE_PHYSICS_DEBUG,input::KEYBOARD}, {TOGGLE_MOUSE_CURSOR,input::KEYBOARD}, @@ -55,7 +59,9 @@ public: {TOGGLE_CONSOLE,input::KEYBOARD}, {EXIT_GAME,input::KEYBOARD}, {MOVE_CURSOR_LEFT,input::KEYBOARD}, - {MOVE_CURSOR_RIGHT,input::KEYBOARD} + {MOVE_CURSOR_RIGHT,input::KEYBOARD}, + {HISTORY_UP,input::KEYBOARD}, + {HISTORY_DOWN,input::KEYBOARD} }; } diff --git a/src/engine.cpp b/src/engine.cpp index ecf45d8..1b84644 100644 --- a/src/engine.cpp +++ b/src/engine.cpp @@ -13,6 +13,8 @@ #include "scene/physicsdebugnode.h" #include "imgui/imgui.h" #include "tools/loader.h" +#include "guitools.h" +#include "tools/loadingthread.h" Engine::Engine() : m_window(nullptr), @@ -23,7 +25,8 @@ Engine::Engine() : m_toggleShellAction(NO_ACTION), m_exitGameAction(NO_ACTION), m_showMouseAction(NO_ACTION), - m_mouseVisible(true) + m_mouseVisible(true), + m_pickerEnabled(false) { m_clock = new sf::Clock(); m_clock->restart(); @@ -32,6 +35,7 @@ Engine::Engine() : Engine::~Engine() { + LoadingThread::destroy(); delete m_clock; delete m_renderer; if(m_window != NULL) @@ -62,6 +66,8 @@ void Engine::createWindow(std::string title, m_input = new Input(m_window); m_renderer->initGL(w, h); m_sparrowshell = new SparrowShell(m_window); + m_guiTools = new GuiTools(); + m_loadingThread = LoadingThread::init(); } void Engine::initPhysics() @@ -88,13 +94,12 @@ void Engine::update() io.DeltaTime = float(getDeltaTime()) / 1000.; ImGui::NewFrame(); - // test gui + // settings gui { - static bool testGuiOpen = true; - if(testGuiOpen) + static bool settingsGuiOpen = true; + if(settingsGuiOpen) { - ImGui::Begin("Test imgui Window", &testGuiOpen); - ImGui::Text("Hello, world!"); + ImGui::Begin("Window Settings", &settingsGuiOpen); ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / io.Framerate, io.Framerate); bool physicsDebugEnabled = (m_physicsDebugNode != nullptr); if(ImGui::Checkbox("Toggle physics debug", &physicsDebugEnabled)) @@ -107,11 +112,7 @@ void Engine::update() bool isMouseVisible = m_mouseVisible; if(ImGui::Checkbox("Mouse cursor ( shortcut : [M] )", &isMouseVisible)) toggleMouseVisibility(); - if(ImGui::Button("EXIT GAME")) - stop(); - float gravity = - m_world->getGravity().y(); - if(ImGui::SliderFloat("Gravity", &gravity, 0.f, 100.f)) - m_world->setGravity(btVector3(0, -gravity, 0)); + ImGui::ProgressBar(m_loadingThread->getTotalProgress()); ImGui::End(); } } @@ -124,11 +125,13 @@ void Engine::update() { m_physicsDebugNode->clearBuffers(); m_world->debugDrawWorld(); + getScene()->registerMeshType(m_physicsDebugNode->getFlags()); } } // update Scene getScene()->update(); + getScene()->updateShaders(); // update Display if(m_input->isResized()) @@ -176,10 +179,13 @@ void Engine::setScene(std::string scene) } previous_scene->getRootObject()->removeChild(m_sparrowshell); + previous_scene->getRootObject()->removeChild(m_guiTools); + m_renderer->setScene(new_scene); m_renderer->resizeGL(m_window->getSize().x, m_window->getSize().y); + new_scene->getRootObject()->addChild(m_sparrowshell); - new_scene->updateShaders(); + new_scene->getRootObject()->addChild(m_guiTools); } void Engine::enablePhysicsDebug() @@ -190,7 +196,6 @@ void Engine::enablePhysicsDebug() getScene()->addToIndex(m_physicsDebugNode); m_world->setDebugDrawer(m_physicsDebugNode); m_world->getDebugDrawer()->setDebugMode(btIDebugDraw::DBG_DrawWireframe); - getScene()->updateShaders(); } } @@ -205,6 +210,7 @@ void Engine::disablePhysicsDebug() } } + void Engine::toggleMouseVisibility() { m_mouseVisible = !m_mouseVisible; @@ -263,7 +269,7 @@ void Engine::checkSpecialInputs() void Engine::createScene(std::string scene_name) { - RESOURCE_ADD(new SceneTree(*this),SceneTree,scene_name); + RESOURCE_ADD(new SceneTree(*this), SceneTree, scene_name); //return new SceneTree(*this); } diff --git a/src/engine.h b/src/engine.h index 6ca9c1b..810fe24 100644 --- a/src/engine.h +++ b/src/engine.h @@ -8,6 +8,8 @@ class SparrowRenderer; class SceneTree; class SparrowShell; class PhysicsDebugNode; +class GuiTools; +class LoadingThread; namespace sf { @@ -34,6 +36,7 @@ public: void disablePhysicsDebug(); void toggleMouseVisibility(); + bool isMouseGrabbed() const { return !m_mouseVisible; } // special inputs void setTogglePhysicsDebugAction(int action); @@ -49,11 +52,14 @@ public: SparrowRenderer* getRenderer() const {return m_renderer;} btDiscreteDynamicsWorld* getPhysics() const {return m_world;} SparrowShell* getShell() const {return m_sparrowshell;} + GuiTools* getGuiTools() const {return m_guiTools;} + LoadingThread* getLoadingThread() const {return m_loadingThread;} SceneTree* getScene() const; unsigned int getTime() const; unsigned int getDeltaTime() const; + // SceneTree* createScene(); void createScene(std::string scene_name); //void setCurrentScene(std::string scene_name){m_current_scene = scene_name;} @@ -73,6 +79,8 @@ private: btDiscreteDynamicsWorld* m_world; PhysicsDebugNode *m_physicsDebugNode; SparrowRenderer* m_renderer; + GuiTools* m_guiTools; + LoadingThread* m_loadingThread; void update(); @@ -81,6 +89,7 @@ private: int m_exitGameAction; int m_showMouseAction; bool m_mouseVisible; + bool m_pickerEnabled; void checkSpecialInputs(); }; diff --git a/src/guitools.cpp b/src/guitools.cpp new file mode 100644 index 0000000..14cc4ca --- /dev/null +++ b/src/guitools.cpp @@ -0,0 +1,116 @@ +#include "guitools.h" + +#include "engine.h" +#include "tools/scenepicker.h" +#include "scene/scenetree.h" +#include "tools/resourcepack.h" + +#include + +#include +#include +#include + +#include + +GuiTools::GuiTools() : + m_pickerNode(new ScenePicker()), + m_selectedMesh(nullptr), + m_editedResourcePack(nullptr), + m_pickerEnabled(false), + m_materialEditorEnabled(false) +{ + addChild(m_pickerNode); + m_pickerNode->setVisible(false); +} + +GuiTools::~GuiTools() +{ + delete m_pickerNode; +} + +void GuiTools::update() +{ + // no automatic update of children, we want to update them manually + // ContainerNode::update(); + + if(m_pickerEnabled) + m_pickerNode->update(); + + if(m_materialEditorEnabled) + materialGui(); + + if(m_editedResourcePack != nullptr) + m_editedResourcePack->gui(); +} + +void GuiTools::materialGui() +{ + static int selectedOption = 0; + + ImGui::Begin("Material Editor", &m_materialEditorEnabled); + std::string options; + std::vector meshes; + options += "None\n"; + meshes.push_back(nullptr); + int i = 1; + for(SceneIterator* geometryIt = m_scene->getGeometry(); geometryIt->isValid(); geometryIt->next()) + { + options += geometryIt->getItem()->mesh->getName(); + options += '\n'; + meshes.push_back(geometryIt->getItem()->mesh); + if(geometryIt->getItem()->mesh == m_selectedMesh) + selectedOption = i; + } + + for(char &c : options) + { + if(c == '\n') + c = '\0'; + } + if(ImGui::Combo("Mesh", &selectedOption, options.c_str())) + { + m_selectedMesh = meshes[selectedOption]; + } + + if(m_selectedMesh == nullptr) + ImGui::Text("No mesh selected"); + else + { + PBRMaterial* mat = dynamic_cast(m_selectedMesh->getMaterial()); + ImGui::ColorEdit3("albedo", &mat->albedo.r); + ImGui::ColorEdit3("emission", &mat->emission.r); + ImGui::SliderFloat("metallic", &mat->metallic, 0, 1); + ImGui::SliderFloat("roughness", &mat->roughness, 0, 1); + } + + ImGui::End(); +} + +void GuiTools::togglePicker() +{ + m_pickerEnabled = !m_pickerEnabled; + m_pickerNode->setVisible(m_pickerEnabled); +} + +void GuiTools::toggleMaterialEditor() +{ + m_materialEditorEnabled = !m_materialEditorEnabled; +} + +void GuiTools::toggleRenderingPipelineGui() +{ + DeferredPipeline* pipeline = dynamic_cast(m_scene->getPipeline()); + pipeline->toggleDebugGui(); +} + +void GuiTools::toggleResourcePackGui() +{ + if(m_editedResourcePack == nullptr) + m_editedResourcePack = new ResourcePack(); + else + { + delete m_editedResourcePack; + m_editedResourcePack = nullptr; + } +} diff --git a/src/guitools.h b/src/guitools.h new file mode 100644 index 0000000..b9cff1a --- /dev/null +++ b/src/guitools.h @@ -0,0 +1,29 @@ +#ifndef GUITOOLS_H +#define GUITOOLS_H + +#include "scene/containernode.h" + +class Engine; +class ScenePicker; +class ResourcePack; +class Mesh; + +class GuiTools : public ContainerNode +{ + ScenePicker* m_pickerNode; + Mesh* m_selectedMesh; + ResourcePack* m_editedResourcePack; + bool m_pickerEnabled; + bool m_materialEditorEnabled; +public: + GuiTools(); + ~GuiTools(); + void update(); + void materialGui(); + void togglePicker(); + void toggleMaterialEditor(); + void toggleRenderingPipelineGui(); + void toggleResourcePackGui(); +}; + +#endif // GUITOOLS_H diff --git a/src/scene/gibgeneratornode.cpp b/src/scene/gibgeneratornode.cpp index 963fcb5..d965aa7 100644 --- a/src/scene/gibgeneratornode.cpp +++ b/src/scene/gibgeneratornode.cpp @@ -26,7 +26,6 @@ void GibGeneratorNode::createGib(GraphicalNode* graphicalPart, m_gibs.push_back(new Gib(body, graphicalPart, getEngine().getTime()+lifeSpan)); addChild(graphicalPart); - m_scene->updateShaders(); // TODO : optimisations needed } } diff --git a/src/scene/graphicalnode.cpp b/src/scene/graphicalnode.cpp index 0902be1..a8f8960 100644 --- a/src/scene/graphicalnode.cpp +++ b/src/scene/graphicalnode.cpp @@ -3,7 +3,8 @@ #include "glm/ext.hpp" #include -void GraphicalNode::setSceneTree(SceneTree *tree){ +void GraphicalNode::setSceneTree(SceneTree *tree) +{ if(isVisible()) { if(m_scene != nullptr) @@ -14,7 +15,8 @@ void GraphicalNode::setSceneTree(SceneTree *tree){ m_scene = tree; } -void GraphicalNode::resetTransform(){ +void GraphicalNode::resetTransform() +{ setTransform(glm::mat4()); } diff --git a/src/scene/gui/buttonnode.cpp b/src/scene/gui/buttonnode.cpp index ca7d0f8..fc62010 100644 --- a/src/scene/gui/buttonnode.cpp +++ b/src/scene/gui/buttonnode.cpp @@ -43,7 +43,6 @@ void ButtonNode::update() if(m_label->wasUpdated()){ m_label->setPosition(m_shape->getDimension()/glm::vec2(2,2) - m_label->getDimension()/glm::vec2(2,2)); - getEngine().getScene()->updateShaders(); } for (auto action : input->getActions()) diff --git a/src/scene/gui/textinputnode.cpp b/src/scene/gui/textinputnode.cpp index 1103a7d..efe6cd5 100644 --- a/src/scene/gui/textinputnode.cpp +++ b/src/scene/gui/textinputnode.cpp @@ -10,9 +10,19 @@ TextInputNode::TextInputNode(glm::vec2 dimension): m_dimension(dimension), + m_hasFocus(false), m_font_size(16.f), + m_text_mesh(nullptr), + m_text(""), + m_text_updated(false), m_text_color(glm::vec3(1,1,1)), - m_cursor_pos(0) + m_cursor_mesh(nullptr), + m_cursor_pos(0), + m_cursor_pos_updated(false), + m_move_cursor_left(NO_ACTION), + m_move_cursor_right(NO_ACTION), + m_callback(nullptr), + m_tab_callback(nullptr) { // Font *shellfont = RESOURCE_GET(Font,"shellfont"); Mesh* mesh = new Mesh(); @@ -31,21 +41,19 @@ void TextInputNode::update() if(!m_hasFocus) return; std::wstring text = getEngine().getInput()->getText(); - bool input_string_updated = false; - bool cursor_pos_updated = false; auto input = getEngine().getInput(); for(auto action : input->getActions()){ if (action.action == m_move_cursor_left){ if (m_cursor_pos > 0){ m_cursor_pos--; - cursor_pos_updated=true; + m_cursor_pos_updated=true; } } else if(action.action == m_move_cursor_right){ if(m_cursor_pos < m_text.length()){ m_cursor_pos++; - cursor_pos_updated=true; + m_cursor_pos_updated=true; } } } @@ -56,17 +64,17 @@ void TextInputNode::update() case 8: if(m_cursor_pos > 0) m_text.erase(--m_cursor_pos,1); - input_string_updated = true; - cursor_pos_updated=true; + m_text_updated = true; + m_cursor_pos_updated=true; break; case 13: if (!m_text.empty()) { if(m_callback) m_callback->exec(); - input_string_updated = true; + m_text_updated = true; m_cursor_pos = 0; - cursor_pos_updated=true; + m_cursor_pos_updated=true; } break; case 9: @@ -74,48 +82,64 @@ void TextInputNode::update() { if(m_tab_callback) m_tab_callback->exec(); - input_string_updated = true; - cursor_pos_updated=true; + m_text_updated = true; + m_cursor_pos_updated=true; } break; case 127: m_text.erase(m_cursor_pos,1); - input_string_updated = true; + m_text_updated = true; break; default: m_text.insert(m_cursor_pos++,std::string(1,c)); - input_string_updated = true; - cursor_pos_updated=true; + m_text_updated = true; + m_cursor_pos_updated=true; } } - Font *shellfont = RESOURCE_GET(Font,"shellfont"); - if(cursor_pos_updated){ - m_cursor_mesh->moveTo2D(glm::vec2(m_cursor_pos*shellfont->getXAdvance()*(m_font_size/shellfont->getLineHeight()),0)); - } + if(m_cursor_pos_updated) + updateCursorMesh(); + + if(m_text_updated) + updateTextMesh(); - if(input_string_updated) - { - if(m_text_mesh){ - this->removeChild(m_text_mesh); -// delete(m_text_mesh); - } - m_text_mesh = shellfont->getTextNode(m_text,m_text_color,m_font_size,false); - if(m_text_mesh){ - m_text_mesh->setTransform(glm::mat4()); - m_text_mesh->setDepth(15); - this->addChild(m_text_mesh); - m_text_mesh->setVisible(true); - } - } GUINode::update(); } +void TextInputNode::updateCursorMesh(){ + Font *shellfont = RESOURCE_GET(Font,"shellfont"); + m_cursor_mesh->moveTo2D(glm::vec2(m_cursor_pos*shellfont->getXAdvance()*(m_font_size/shellfont->getLineHeight()),0)); + m_cursor_pos_updated = false; +} + +void TextInputNode::updateTextMesh(){ + Font *shellfont = RESOURCE_GET(Font,"shellfont"); + if(m_text_mesh){ + this->removeChild(m_text_mesh); + delete(m_text_mesh); + } + m_text_mesh = shellfont->getTextNode(m_text,m_text_color,m_font_size,false); + if(m_text_mesh){ + m_text_mesh->setTransform(glm::mat4()); + m_text_mesh->setDepth(15); + this->addChild(m_text_mesh); + m_text_mesh->setVisible(true); + } + m_text_updated = false; +} + void TextInputNode::setFocus(bool focus) { m_hasFocus = focus; m_cursor_mesh->setVisible(focus); } +void TextInputNode::setText(std::string text){ + m_text = text; + m_text_updated = true; + m_cursor_pos = text.length(); + m_cursor_pos_updated = true; +} + void TextInputNode::setTextColor(glm::vec3 color) { m_text_color = color; @@ -126,6 +150,3 @@ std::string TextInputNode::getText() return m_text; } - - - diff --git a/src/scene/gui/textinputnode.h b/src/scene/gui/textinputnode.h index 5501ee7..a53789b 100644 --- a/src/scene/gui/textinputnode.h +++ b/src/scene/gui/textinputnode.h @@ -15,10 +15,12 @@ class TextInputNode : public GUINode TextNode* m_text_mesh; std::string m_text; + bool m_text_updated; glm::vec3 m_text_color; MeshNode* m_cursor_mesh; unsigned int m_cursor_pos; + bool m_cursor_pos_updated; int m_move_cursor_left; int m_move_cursor_right; @@ -29,10 +31,13 @@ class TextInputNode : public GUINode public: TextInputNode(glm::vec2 dimension); void update(); + void updateCursorMesh(); + void updateTextMesh(); glm::vec2 getDimension(){return m_dimension;} void setFocus(bool focus); void setTextColor(glm::vec3 color); + void setText(std::string text); std::string getText(); void setCallBack(CallBack* callback){m_callback = callback;} void setTabCallBack(CallBack* callback){m_tab_callback = callback;} diff --git a/src/scene/lightnode.cpp b/src/scene/lightnode.cpp index d8748f7..c198a64 100644 --- a/src/scene/lightnode.cpp +++ b/src/scene/lightnode.cpp @@ -3,6 +3,13 @@ #include #include +void LightNode::setSceneTree(SceneTree *tree) +{ + GraphicalNode::setSceneTree(tree); + if(m_scene != nullptr) + m_scene->registerLightType(m_light->getFlags()); +} + void LightNode::update() { if(m_transformChanged) diff --git a/src/scene/lightnode.h b/src/scene/lightnode.h index 8cb11a1..49d343a 100644 --- a/src/scene/lightnode.h +++ b/src/scene/lightnode.h @@ -11,6 +11,8 @@ class LightNode : public GraphicalNode public: LightNode(Light* light) : m_light(light) {} + virtual void setSceneTree(SceneTree* tree); + virtual void update(); virtual Light* getLight() { return m_light; } diff --git a/src/scene/meshnode.cpp b/src/scene/meshnode.cpp index 72b8c92..d0dca2a 100644 --- a/src/scene/meshnode.cpp +++ b/src/scene/meshnode.cpp @@ -6,6 +6,13 @@ #include #include +void MeshNode::setSceneTree(SceneTree *tree) +{ + GraphicalNode::setSceneTree(tree); + if(m_scene != nullptr) + m_scene->registerMeshType(m_geometry.mesh->getFlags()); +} + void MeshNode::setDepth(float depth){ m_geometry.mesh->setDepth(depth); } diff --git a/src/scene/meshnode.h b/src/scene/meshnode.h index a214855..e1aeae6 100644 --- a/src/scene/meshnode.h +++ b/src/scene/meshnode.h @@ -26,6 +26,8 @@ public: // this behaviour allows the use of the same meshes in multiple nodes MeshNode(Mesh* mesh, bool visible = true) : GraphicalNode(visible), m_geometry(mesh, glm::mat4()), m_rigidBody(nullptr) {} + virtual void setSceneTree(SceneTree* tree); + virtual void update(); void setDepth(float depth); diff --git a/src/scene/physicsdebugnode.cpp b/src/scene/physicsdebugnode.cpp index d12f02c..e13b50b 100644 --- a/src/scene/physicsdebugnode.cpp +++ b/src/scene/physicsdebugnode.cpp @@ -17,6 +17,11 @@ PhysicsDebugNode::PhysicsDebugNode() : m_geometry.mesh->updateFlags(); } +PhysicsDebugNode::~PhysicsDebugNode() +{ + delete m_geometry.mesh; +} + void PhysicsDebugNode::drawLine(const btVector3& from, const btVector3& to, const btVector3& color) { glm::vec3 glColor(color.x(), color.y(), color.z()); diff --git a/src/scene/physicsdebugnode.h b/src/scene/physicsdebugnode.h index 2d2b43a..038b859 100644 --- a/src/scene/physicsdebugnode.h +++ b/src/scene/physicsdebugnode.h @@ -2,15 +2,16 @@ #define PHYSICSDEBUGNODE_H #include "meshnode.h" +#include #include class PhysicsDebugNode : public MeshNode, public btIDebugDraw { - Mesh* m_debugMesh; int m_debugMode; public: PhysicsDebugNode(); + ~PhysicsDebugNode(); virtual void drawLine(const btVector3& from,const btVector3& to,const btVector3& color); @@ -26,6 +27,8 @@ public: virtual void setDebugMode(int debugMode) { m_debugMode = debugMode; } virtual int getDebugMode() const { return m_debugMode; } + unsigned int getFlags() { m_geometry.mesh->getFlags(); } + void clearBuffers(); }; diff --git a/src/scene/playercharacternode.cpp b/src/scene/playercharacternode.cpp index 0bc2edf..7796ba8 100644 --- a/src/scene/playercharacternode.cpp +++ b/src/scene/playercharacternode.cpp @@ -11,6 +11,7 @@ #include #define DEFAULT_ROTATION_SPEED 0.001f +#define TRIGGER_VALUE 15 void FirstPersonCamera::computeView() { @@ -55,12 +56,14 @@ void FirstPersonCamera::setUpVector(const glm::vec3 &up) } const float WALK_SPEED = 5.f; +const float RUNNING_MULTIPLIER = 2.f; const float TORSO_RADIUS = 0.30f; const float TORSO_HEIGHT = 0.8f; const float LEGS_HEIGHT = 1.f; const float EYES_OFFSET = 0.3f; const float JUMP_VELOCITY = 5.f; + PlayerCharacterNode::PlayerCharacterNode(bool noClip) : m_jumping(false), m_noclipMode(noClip), @@ -92,13 +95,14 @@ PlayerCharacterNode::~PlayerCharacterNode() delete m_playerLight; } -void PlayerCharacterNode::setInputs(int forward, int backward, int strafeLeft, int strafeRight, int jump, int toggleNoClip) +void PlayerCharacterNode::setInputs(int forward, int backward, int strafeLeft, int strafeRight, int jump, int run, int toggleNoClip) { m_inputActions[FORWARD] = forward; m_inputActions[BACKWARD] = backward; m_inputActions[STRAFE_LEFT] = strafeLeft; m_inputActions[STRAFE_RIGHT] = strafeRight; m_inputActions[JUMP] = jump; + m_inputActions[RUN] = run; m_inputActions[TOGGLE_NOCLIP] = toggleNoClip; } @@ -117,29 +121,52 @@ void PlayerCharacterNode::update() Input *input = getEngine().getInput(); float deltaTime = getEngine().getDeltaTime(); - // get events - int walk = 0; - int strafe = 0; + float walk = 0; + float strafe = 0; bool jump = false; - for(Action action : input->getActions()) - { - if(action.action == m_inputActions[FORWARD]) - ++walk; - else if(action.action == m_inputActions[BACKWARD]) - --walk; - else if(action.action == m_inputActions[STRAFE_LEFT]) - --strafe; - else if(action.action == m_inputActions[STRAFE_RIGHT]) - ++strafe; - else if(action.action == m_inputActions[JUMP]) - jump = true; - else if(action.action == m_inputActions[TOGGLE_NOCLIP]) - toggleNoClip(); - } + bool run = false; - // update camera rotation - glm::vec2 diff = input->getDeltaPosition(); - m_fpsCamera.rotate(diff.x, diff.y); + if(getEngine().isMouseGrabbed()) + { + // get events + for(Action action : input->getActions()) + { + if(action.action == m_inputActions[FORWARD]) + ++walk; + else if(action.action == m_inputActions[BACKWARD]) + --walk; + else if(action.action == m_inputActions[STRAFE_LEFT]) + --strafe; + else if(action.action == m_inputActions[STRAFE_RIGHT]) + ++strafe; + else if(action.action == m_inputActions[JUMP]) + jump = true; + else if(action.action == m_inputActions[RUN]) + run = true; + else if(action.action == m_inputActions[TOGGLE_NOCLIP]) + toggleNoClip(); + } + glm::vec2 rotatecam = glm::vec2(0.f,0.f); + std::vector controllers = input->getControllersConnected(); + for (auto controller : controllers){ + float strafe_joy = input->getAxisPosition(controller, input::LEFT_JOYSTICK_HORIZONTAL); + if (abs(strafe_joy) > TRIGGER_VALUE) + strafe = strafe_joy; + float forward = input->getAxisPosition(controller, input::LEFT_JOYSTICK_VERTICAL); + if (abs(forward) > TRIGGER_VALUE) + walk = -forward; + float pitch_joy = input->getAxisPosition(controller,input::RIGHT_JOYSTICK_HORIZONTAL); + if (abs(pitch_joy) > TRIGGER_VALUE) + rotatecam.x = pitch_joy; + float yaw_joy = input->getAxisPosition(controller,input::RIGHT_JOYSTICK_VERTICAL); + if (abs(yaw_joy) > TRIGGER_VALUE) + rotatecam.y = yaw_joy; + } + m_fpsCamera.rotate(rotatecam.x,rotatecam.y); + // update camera rotation + glm::vec2 diff = input->getDeltaPosition(); + m_fpsCamera.rotate(diff.x, diff.y); + } // update camera position btVector3 pos = m_rigidBody->getCenterOfMassPosition(); @@ -150,9 +177,10 @@ void PlayerCharacterNode::update() const glm::vec3 &glmDir = m_fpsCamera.getDirection(); const btVector3 &velocity = m_rigidBody->getLinearVelocity(); btVector3 targetVelocity(0.f, velocity.getY(), 0.f); + glm::vec3 moveDir; if(walk != 0 || strafe != 0) { - glm::vec3 moveDir = glm::normalize(glmDir*walk + glm::cross(glmDir, glm::vec3(0, 1, 0))*strafe); + moveDir = glm::normalize(glmDir*walk + glm::cross(glmDir, glm::vec3(0, 1, 0))*strafe); if (m_noclipMode) { btVector3 dir(moveDir.x, moveDir.y, moveDir.z); @@ -161,10 +189,12 @@ void PlayerCharacterNode::update() else { glm::vec2 hPos = glm::normalize(glm::vec2(moveDir.x, moveDir.z))*WALK_SPEED; + if(run) hPos *= RUNNING_MULTIPLIER; targetVelocity.setX(hPos.x); targetVelocity.setZ(hPos.y); } } + // apply movements if(m_noclipMode) { @@ -176,14 +206,53 @@ void PlayerCharacterNode::update() else { bool onGround = false; - btVector3 start(pos); - start.setY(start.y() - TORSO_HEIGHT/2.f); - btVector3 end(start); - end.setY(end.y() - (LEGS_HEIGHT*2.f)); - btCollisionWorld::ClosestRayResultCallback RayCallback(start, end); - getEngine().getPhysics()->rayTest(start, end, RayCallback); - float controlRatio = 0.f; // 1 = total control, 0 = no control, can be seen as a slipperiness factor - if(RayCallback.hasHit()) // if ground is nearby + btVector3 dir(moveDir.x/2.f,0.f,moveDir.z/2.f); + btVector3 start_front(pos+dir); + start_front.setY(pos.y() - TORSO_HEIGHT/2.f); + btVector3 end_front(start_front); + end_front.setY(end_front.y() - (LEGS_HEIGHT*2.f)); + btCollisionWorld::ClosestRayResultCallback RayCallback_front(start_front, end_front); + + btVector3 start_back(pos); + start_back.setY(pos.y() - TORSO_HEIGHT/2.f); + btVector3 end_back(start_back); + end_back.setY(end_back.y() - (LEGS_HEIGHT)); + btCollisionWorld::ClosestRayResultCallback RayCallback_back(start_back, end_back); + + getEngine().getPhysics()->rayTest(start_front, end_front, RayCallback_front); + getEngine().getPhysics()->rayTest(start_back, end_back, RayCallback_back); + + float controlRatio = 0.2f; // 1 = total control, 0 = no control, can be seen as a slipperiness factor + + if(RayCallback_back.hasHit()){ + onGround = true; + + //btVector3 normal_front = RayCallback_front.m_hitNormalWorld; + btVector3 normal_back = RayCallback_back.m_hitNormalWorld; + + float slope = normal_back.dot(btVector3(0,1,0)); + controlRatio = slope > 0.4f ? 0.2f * slope : 0.f; + + if (RayCallback_front.hasHit()) + { + float displacement = RayCallback_front.m_hitPointWorld.y() - (end_front.y() + start_front.y())/2.f; + if(abs(displacement) > 0.1f) + pos.setY(pos.y() + deltaTime*0.01f*(displacement > 0 ? 1 : -1)); + else + pos.setY(pos.y() + displacement/4); + + btTransform transform = btTransform::getIdentity(); + transform.setOrigin(pos); + m_rigidBody->setWorldTransform(transform); + } + + if(jump) + m_jumping = true; + else + m_jumping = false; + } + + /* if(RayCallback.hasHit() ) // if ground is nearby { onGround = true; btVector3 normal = RayCallback.m_hitNormalWorld; @@ -193,10 +262,13 @@ void PlayerCharacterNode::update() if(onGround) { float displacement = RayCallback.m_hitPointWorld.y() - (end.y() + start.y())/2.f; - if(abs(displacement) > 0.1f) - pos.setY(pos.y() + deltaTime*0.01f*(displacement > 0 ? 1 : -1)); - else - pos.setY(pos.y() + displacement/4); + //if (m_last_displacement > displacement){ + if(abs(displacement) > 0.1f) + pos.setY(pos.y() + deltaTime*0.01f*(displacement > 0 ? 1 : -1)); + else + pos.setY(pos.y() + displacement/4); + //} + //m_last_displacement = displacement; btTransform transform = btTransform::getIdentity(); transform.setOrigin(pos); m_rigidBody->setWorldTransform(transform); @@ -206,7 +278,7 @@ void PlayerCharacterNode::update() else m_jumping = false; } - +*/ btVector3 newVelocity = velocity*(1.f-controlRatio) + targetVelocity*controlRatio; if(onGround) { diff --git a/src/scene/playercharacternode.h b/src/scene/playercharacternode.h index e83659c..8a9bca9 100644 --- a/src/scene/playercharacternode.h +++ b/src/scene/playercharacternode.h @@ -47,13 +47,15 @@ class PlayerCharacterNode : public CameraNode std::vector m_inputActions; - enum PlayerAction {FORWARD, BACKWARD, STRAFE_LEFT, STRAFE_RIGHT, JUMP, TOGGLE_NOCLIP}; + float m_last_displacement; + + enum PlayerAction {FORWARD, BACKWARD, STRAFE_LEFT, STRAFE_RIGHT, JUMP, RUN, TOGGLE_NOCLIP}; public: PlayerCharacterNode(bool noClip = true); ~PlayerCharacterNode(); - void setInputs(int forward, int backward, int strafe_left, int strafe_right, int jump = NO_ACTION, int toggleNoClip = NO_ACTION); + void setInputs(int forward, int backward, int strafe_left, int strafe_right, int jump = NO_ACTION, int run= NO_ACTION, int toggleNoClip = NO_ACTION); void setPosition(float x, float y, float z); diff --git a/src/scene/scenetree.cpp b/src/scene/scenetree.cpp index e3df85c..6a6fc08 100644 --- a/src/scene/scenetree.cpp +++ b/src/scene/scenetree.cpp @@ -13,7 +13,8 @@ SceneTree::SceneTree(const Engine &engine) : Scene(), m_engine(engine), - m_skybox(NULL) + m_shaderRefreshRequired(false), + m_camera(nullptr) { DeferredPipeline *pipeline = new DeferredPipeline(); m_pipeline = pipeline; @@ -28,9 +29,10 @@ SceneTree::~SceneTree() void SceneTree::setMainCamera(CameraNode *camNode) { - ((DeferredPipeline*)m_pipeline)->setCamera(camNode->getCamera()); + m_camera = camNode->getCamera(); + ((DeferredPipeline*)m_pipeline)->setCamera(m_camera); sf::Vector2u size = getEngine().getWindow()->getSize(); - camNode->getCamera()->resize(size.x, size.y); + m_camera->resize(size.x, size.y); } SceneIterator* SceneTree::getLights() @@ -43,11 +45,37 @@ SceneIterator* SceneTree::getGeometry() return new ArrayIterator(m_geometries); } +void SceneTree::getMeshTypes(std::vector &meshTypes) +{ + for(unsigned int type : m_meshTypes) + meshTypes.push_back(type); +} + +void SceneTree::getLightTypes(std::vector &lightTypes) +{ + for(unsigned int type : m_lightTypes) + lightTypes.push_back(type); +} + void SceneTree::update() { m_root.update(); } +void SceneTree::registerMeshType(unsigned int meshType) +{ + auto ret = m_meshTypes.emplace(meshType); + if(ret.second) + m_shaderRefreshRequired = true; +} + +void SceneTree::registerLightType(unsigned int lightType) +{ + auto ret = m_lightTypes.emplace(lightType); + if(ret.second) + m_shaderRefreshRequired = true; +} + void SceneTree::addToIndex(SceneNode* node){ Light *light = node->getLight(); GeometryNode *geometrynode = node->getGeometryNode(); @@ -80,5 +108,9 @@ void SceneTree::removeFromIndex(SceneNode *node){ void SceneTree::updateShaders() { - ((DeferredPipeline*) m_pipeline)->refreshScene(this); + if(m_shaderRefreshRequired) + { + ((DeferredPipeline*) m_pipeline)->refreshScene(this); + m_shaderRefreshRequired = false; + } } diff --git a/src/scene/scenetree.h b/src/scene/scenetree.h index eb23d51..dede801 100644 --- a/src/scene/scenetree.h +++ b/src/scene/scenetree.h @@ -3,6 +3,7 @@ #include #include +#include #include "SparrowRenderer/scene.h" #include "containernode.h" #include "engine.h" @@ -23,14 +24,17 @@ public: virtual SceneIterator* getLights(); virtual SceneIterator* getGeometry(); + virtual void getMeshTypes(std::vector &meshTypes); + virtual void getLightTypes(std::vector &lightTypes); + void update(); - Texture* getSkybox() {return m_skybox;} - void setSkybox(Texture* skybox) {m_skybox = skybox;} - void setMainCamera(CameraNode *camNode); + Camera* getCamera() const { return m_camera; } ContainerNode* getRootObject(){return &m_root;} + void registerMeshType(unsigned int meshType); + void registerLightType(unsigned int lightType); void addToIndex(SceneNode* node); void removeFromIndex(SceneNode *node); void updateShaders(); @@ -47,7 +51,10 @@ private: ContainerNode m_root; std::vector m_lights; std::vector m_geometries; - Texture* m_skybox; + std::unordered_set m_meshTypes; + std::unordered_set m_lightTypes; + bool m_shaderRefreshRequired; + Camera* m_camera; }; #endif // SCENETREE_H diff --git a/src/sparrowshell/scriptnode.cpp b/src/sparrowshell/scriptnode.cpp index 1940eea..e422bc5 100644 --- a/src/sparrowshell/scriptnode.cpp +++ b/src/sparrowshell/scriptnode.cpp @@ -3,11 +3,13 @@ #include "sparrowshell/sparrowshell.h" #include #include +#include #include "Version.h" #include "SparrowInput/Version.h" #include "SparrowRenderer/Version.h" #include "SparrowSerializer/Version.h" #include "tools/utils.h" +#include "guitools.h" #define LUA_DEFINE(var) S[#var]=var #define LUA_SET_FUN(var) m_script.set_function(#var,&ScriptNode::var,this);this->functions_name.push_back(#var); @@ -22,12 +24,22 @@ ScriptNode::ScriptNode() LUA_SET_FUN(print); LUA_SET_FUN(version); LUA_SET_FUN(clear); + LUA_SET_FUN(picker); + LUA_SET_FUN(materialEditor); + LUA_SET_FUN(rendering); + LUA_SET_FUN(resourcePackEditor); + + m_script.new_usertype("Engine", + "time",&Engine::getTime + ); } void ScriptNode::update(){ static bool test = true; - if(test) + if(test && m_scene!= nullptr){ + m_script["engine"] = getEngine(); test=false; + } } void ScriptNode::execute(std::string to_execute){ @@ -72,3 +84,32 @@ void ScriptNode::clear(){ float ScriptNode::getDeltaTime(){ return this->getEngine().getDeltaTime()/1000.; } + +void ScriptNode::testfunc(int i, float x=0.f,float y=0.f, float z=0.f){ + std::string s; + s= "Pop item "; + s+= std::to_string(i)+" at position ("; + s+=std::to_string(x); + s+=","; + s+=std::to_string(y); + s+=","; + s+=std::to_string(z); + s+=")"; + this->getEngine().getShell()->out(s.append("\n")); +} + +void ScriptNode::picker(){ + this->getEngine().getGuiTools()->togglePicker(); +} + +void ScriptNode::materialEditor(){ + this->getEngine().getGuiTools()->toggleMaterialEditor(); +} + +void ScriptNode::rendering(){ + this->getEngine().getGuiTools()->toggleRenderingPipelineGui(); +} + +void ScriptNode::resourcePackEditor(){ + this->getEngine().getGuiTools()->toggleResourcePackGui(); +} diff --git a/src/sparrowshell/scriptnode.h b/src/sparrowshell/scriptnode.h index 4290d6b..9bbeafc 100644 --- a/src/sparrowshell/scriptnode.h +++ b/src/sparrowshell/scriptnode.h @@ -6,7 +6,6 @@ class ScriptNode : public GraphicalNode { - sol::state m_script; std::vector functions_name; @@ -15,15 +14,19 @@ public: void update(); void execute(std::string); std::vector possibleCompletion(std::string); - + sol::state& getScriptEngine() { return m_script; } + void addAutoCompletionSymbol(const std::string& symbolName) { functions_name.push_back(symbolName); } + /* -- LUA function -- */ void print(std::string); void version(); void clear(); float getDeltaTime(); - sol::state& getScriptEngine() { return m_script; } - void addAutoCompletionSymbol(const std::string& symbolName) { functions_name.push_back(symbolName); } - + void testfunc(int, float,float,float); + void picker(); + void materialEditor(); + void rendering(); + void resourcePackEditor(); }; #endif // SCRIPTNODE_H diff --git a/src/sparrowshell/sparrowshell.cpp b/src/sparrowshell/sparrowshell.cpp index 7f4477a..593fcaa 100644 --- a/src/sparrowshell/sparrowshell.cpp +++ b/src/sparrowshell/sparrowshell.cpp @@ -24,7 +24,8 @@ const float SparrowShell::DEFAULT_FONT_SIZE = 16.f; SparrowShell::SparrowShell(sf::Window* window): m_buffer(new ShellBuffer(BUFFER_MAX_LENGTH)), - m_text_color(glm::vec3(0.7,1,0.3)) + m_text_color(glm::vec3(0.7,1,0.3)), + m_inputActions({NO_ACTION, NO_ACTION, NO_ACTION, NO_ACTION}) { sf::Vector2u size = window->getSize(); m_dimension = glm::ivec2(size.x,DEFAULT_FONT_SIZE*(BUFFER_DISPLAYED_LINES+1)); @@ -122,14 +123,13 @@ void SparrowShell::scrollDown() } } -void SparrowShell::setMoveCursorLeftAction(int action) -{ - m_input_node->setMoveCursorLeft(action); -} - -void SparrowShell::setMoveCursorRightAction(int action) -{ - m_input_node->setMoveCursorRight(action); +void SparrowShell::setInputs(int cursor_left, int cursor_right, int history_up, int history_down){ + m_inputActions[MOVE_CURSOR_LEFT] = cursor_left; + m_inputActions[MOVE_CURSOR_RIGHT] = cursor_right; + m_inputActions[HISTORY_PREVIOUS] = history_up; + m_inputActions[HISTORY_NEXT] = history_down; + m_input_node->setMoveCursorLeft(cursor_left); + m_input_node->setMoveCursorRight(cursor_right); } void SparrowShell::toggleShell() @@ -147,7 +147,6 @@ void SparrowShell::toggleShell() // for(auto child : m_children) // child->toggleVisibility(); // m_buffer->toggleBuffer(); - m_scene->updateShaders(); } void SparrowShell::update() diff --git a/src/sparrowshell/sparrowshell.h b/src/sparrowshell/sparrowshell.h index aab45c2..7f3eaab 100644 --- a/src/sparrowshell/sparrowshell.h +++ b/src/sparrowshell/sparrowshell.h @@ -60,6 +60,10 @@ private: int m_move_cursor_right; std::string m_previous_context; + std::vector m_inputActions; + + enum ShellAction {MOVE_CURSOR_LEFT=0,MOVE_CURSOR_RIGHT,HISTORY_PREVIOUS,HISTORY_NEXT}; + public: static const unsigned int BUFFER_MAX_LENGTH; static const unsigned int BUFFER_DISPLAYED_LINES; @@ -82,8 +86,7 @@ public: unsigned int getIndex(){return m_buffer->getIndex();} ShellBuffer* getBuffer(){return m_buffer;} - void setMoveCursorLeftAction(int action); - void setMoveCursorRightAction(int action); + void setInputs(int cursor_left, int cursor_right, int history_up, int history_down); bool isEnabled(){return m_shellEnabled;} diff --git a/src/test/main.cpp b/src/test/main.cpp index 2ffaf5a..7584e85 100644 --- a/src/test/main.cpp +++ b/src/test/main.cpp @@ -90,6 +90,8 @@ void generateTerrain(SceneTree *scene, btDiscreteDynamicsWorld *world) TestGen gen; PBRMaterial *mat = new PBRMaterial(); mat->albedo = glm::vec3(0.1f, 0.4f, 0.2f); + mat->metallic = 0.2f; + mat->roughness = 0.95f; for(int x=-3; x<3; ++x) for(int y=-2; y<2; ++y) @@ -192,7 +194,7 @@ public: void initScene(){ //player m_player = new PlayerCharacterNode(false); - m_player->setInputs(DefaultKeysMap::MOVE_FORWARD, DefaultKeysMap::MOVE_BACKWARD, DefaultKeysMap::STRAFE_LEFT, DefaultKeysMap::STRAFE_RIGHT, DefaultKeysMap::JUMP, DefaultKeysMap::TOGGLE_NOCLIP); + m_player->setInputs(DefaultKeysMap::MOVE_FORWARD, DefaultKeysMap::MOVE_BACKWARD, DefaultKeysMap::STRAFE_LEFT, DefaultKeysMap::STRAFE_RIGHT, DefaultKeysMap::JUMP, DefaultKeysMap::RUN, DefaultKeysMap::TOGGLE_NOCLIP); SceneTree* scene = RESOURCE_GET(SceneTree, m_demo_scene); scene->getRootObject()->addChild(m_player); scene->setMainCamera(m_player); @@ -202,18 +204,17 @@ public: scene->getRootObject()->addChild(potator); //lighting - Texture* skyboxTexture = RESOURCE_GET(Texture, "skybox"); - Texture* ambientTexture = RESOURCE_GET(Texture, "ambient"); + Texture* skyboxTexture = RESOURCE_GET(Texture, "radiance"); + Texture* ambientTexture = RESOURCE_GET(Texture, "irradiance"); LightNode *ambientLight = new LightNode(new AmbientLight(ambientTexture, skyboxTexture)); DeferredPipeline* pipeline = dynamic_cast(scene->getPipeline()); - pipeline->setSkybox(RESOURCE_GET(Texture, "craterlake")); + pipeline->setSkybox(RESOURCE_GET(Texture, "skybox")); - DirectionnalLight* sun = new DirectionnalLight(glm::vec3(5, 8, -2), glm::vec3(0.9f)); + DirectionnalLight* sun = new DirectionnalLight(glm::vec3(5, 8, -2), glm::vec3(4.f)); LightNode *sunLight = new LightNode(sun); scene->getRootObject()->addChild(ambientLight); - scene->getRootObject()->addChild(sunLight); if(m_config->scene == "sponza") { @@ -244,10 +245,11 @@ public: sandboxContainer->addChild(node); m_engine->getPhysics()->addRigidBody(node->buildStaticCollider()); } - m_player->setPosition(0.f, 3.f, 0.f); + m_player->setPosition(0.f, 1.4f, 0.f); sun->setShadowView(glm::vec3(80)); } + scene->getRootObject()->addChild(sunLight); } std::string getScene(){return m_demo_scene;} @@ -263,7 +265,6 @@ public: void exec(){ m_demo->initScene(); - m_engine->getShell()->out("button!"); m_engine->setScene(m_demo->getScene()); m_engine->getInput()->setCurrentContext("default"); m_engine->getInput()->setMouseGrabbed(true); @@ -319,37 +320,37 @@ int main(){ engine.getWindow()->setVerticalSyncEnabled(config->vsync); // opengl context is created, we can initialize the global textures used by the rendering pipeline - Image* img = Loader::loadImage("ibl_brdf_lut.png", 24, false); - AmbientLight::setBrdfLut(new Texture(img, false)); + Image* img = Loader::loadImage("ibl_brdf_lut.png", 24, true); + AmbientLight::setBrdfLut(new Texture(img)); delete img; Image * imgs[6]; - imgs[0] = Loader::loadImage("skybox/craterlake_rt.tga", 24, false); // right - imgs[1] = Loader::loadImage("skybox/craterlake_lf.tga", 24, false); // left - imgs[2] = Loader::loadImage("skybox/craterlake_up.tga", 24, false); // top - imgs[3] = Loader::loadImage("skybox/craterlake_dn.tga", 24, false); // bottom - imgs[4] = Loader::loadImage("skybox/craterlake_ft.tga", 24, false); // front - imgs[5] = Loader::loadImage("skybox/craterlake_bk.tga", 24, false); // back - RESOURCE_ADD(new Texture(imgs), Texture, "craterlake"); - for(int i=0; i<6; ++i) - delete imgs[i]; - - imgs[0] = Loader::loadImage("skybox/1_posX.tga", 24, false); // right - imgs[1] = Loader::loadImage("skybox/2_negX.tga", 24, false); // left - imgs[2] = Loader::loadImage("skybox/3_posY.tga", 24, false); // top - imgs[3] = Loader::loadImage("skybox/4_negY.tga", 24, false); // bottom - imgs[4] = Loader::loadImage("skybox/5_posZ.tga", 24, false); // front - imgs[5] = Loader::loadImage("skybox/6_negZ.tga", 24, false); // back + imgs[0] = Loader::loadImage("skybox/posx.jpg", 24, false); // right + imgs[1] = Loader::loadImage("skybox/negx.jpg", 24, false); // left + imgs[2] = Loader::loadImage("skybox/posy.jpg", 24, false); // top + imgs[3] = Loader::loadImage("skybox/negy.jpg", 24, false); // bottom + imgs[4] = Loader::loadImage("skybox/posz.jpg", 24, false); // front + imgs[5] = Loader::loadImage("skybox/negz.jpg", 24, false); // back RESOURCE_ADD(new Texture(imgs), Texture, "skybox"); for(int i=0; i<6; ++i) delete imgs[i]; - imgs[0] = Loader::loadImage("ambient/1_posX.tga", 24, false); // right - imgs[1] = Loader::loadImage("ambient/2_negX.tga", 24, false); // left - imgs[2] = Loader::loadImage("ambient/3_posY.tga", 24, false); // top - imgs[3] = Loader::loadImage("ambient/4_negY.tga", 24, false); // bottom - imgs[4] = Loader::loadImage("ambient/5_posZ.tga", 24, false); // front - imgs[5] = Loader::loadImage("ambient/6_negZ.tga", 24, false); // back - RESOURCE_ADD(new Texture(imgs), Texture, "ambient"); + imgs[0] = Loader::loadImage("skybox/irradiance/output_iem_posx.tga", 24, false); // right + imgs[1] = Loader::loadImage("skybox/irradiance/output_iem_negx.tga", 24, false); // left + imgs[2] = Loader::loadImage("skybox/irradiance/output_iem_posy.tga", 24, false); // top + imgs[3] = Loader::loadImage("skybox/irradiance/output_iem_negy.tga", 24, false); // bottom + imgs[4] = Loader::loadImage("skybox/irradiance/output_iem_posz.tga", 24, false); // front + imgs[5] = Loader::loadImage("skybox/irradiance/output_iem_negz.tga", 24, false); // back + RESOURCE_ADD(new Texture(imgs, false), Texture, "irradiance"); + for(int i=0; i<6; ++i) + delete imgs[i]; + + imgs[0] = Loader::loadImage("skybox/radiance/output_pmrem_posx_0_256x256.tga", 24, false); // right + imgs[1] = Loader::loadImage("skybox/radiance/output_pmrem_negx_0_256x256.tga", 24, false); // left + imgs[2] = Loader::loadImage("skybox/radiance/output_pmrem_posy_0_256x256.tga", 24, false); // top + imgs[3] = Loader::loadImage("skybox/radiance/output_pmrem_negy_0_256x256.tga", 24, false); // bottom + imgs[4] = Loader::loadImage("skybox/radiance/output_pmrem_posz_0_256x256.tga", 24, false); // front + imgs[5] = Loader::loadImage("skybox/radiance/output_pmrem_negz_0_256x256.tga", 24, false); // back + RESOURCE_ADD(new Texture(imgs), Texture, "radiance"); for(int i=0; i<6; ++i) delete imgs[i]; @@ -373,9 +374,7 @@ int main(){ //c'est un goup SparrowShell SparrowShell* shell = engine.getShell(); - shell->setMoveCursorLeftAction(DefaultKeysMap::MOVE_CURSOR_LEFT); - shell->setMoveCursorRightAction(DefaultKeysMap::MOVE_CURSOR_RIGHT); - //shell->setPlopTest(DefaultKeysMap::PLOP_TEST); + shell->setInputs(DefaultKeysMap::MOVE_CURSOR_LEFT,DefaultKeysMap::MOVE_CURSOR_RIGHT,DefaultKeysMap::HISTORY_UP,DefaultKeysMap::HISTORY_DOWN); input->addContext(Context("shell",DefaultKeysMap::getShellContext())); input->updateKeyBindings(); @@ -448,7 +447,6 @@ int main(){ // engine.getScene()->getRootObject()->addChild(bgrn); // preparing shaders and launching the engine - engine.getScene()->updateShaders(); engine.start(); // pathfinding tests diff --git a/src/test/potator.cpp b/src/test/potator.cpp index 5421fd9..e342077 100644 --- a/src/test/potator.cpp +++ b/src/test/potator.cpp @@ -7,8 +7,11 @@ #include "SparrowRenderer/pbrmaterial.h" #include "scene/meshnode.h" #include "tools/loader.h" +#include "tools/loadingthread.h" #include "SparrowRenderer/texture.h" #include "scene/graphicalcontainernode.h" +#include "resourcemanager.h" +#include #define PHYSICS_OFFSET 0.01f @@ -27,7 +30,7 @@ Potator::Potator(PlayerCharacterNode * player, float density = 1.f; // creating cube - m_cubeMesh = new Mesh(); + m_cubeMesh = new Mesh("woodBox"); m_cubeMesh->addVertex(glm::vec3(-1*s.x, -1*s.y, 1*s.z),glm::vec3(0, 0, 1),glm::vec2(0, 0)); m_cubeMesh->addVertex(glm::vec3(-1*s.x, 1*s.y, 1*s.z),glm::vec3(0, 0, 1),glm::vec2(0, 1)); m_cubeMesh->addVertex(glm::vec3( 1*s.x, -1*s.y, 1*s.z),glm::vec3(0, 0, 1),glm::vec2(1, 0)); @@ -66,14 +69,18 @@ Potator::Potator(PlayerCharacterNode * player, m_cubeMesh->addTriangle(id+7, id+5, id+6); } - Image* wood = Loader::loadImage("woodbox.jpg", 24); - PBRMaterial *mat = new PBRMaterial(); - mat->setTexture(PBRMaterial::ALBEDO_SLOT, new Texture(wood), "wood_texture"); - mat->roughness = 0.8f; - mat->metallic = 0.1f; + PBRMaterial *mat = new PBRMaterial(); /* + Image* img = Loader::loadImage("woodframe_albedo.png", 24); + mat->setTexture(PBRMaterial::ALBEDO_SLOT, new Texture(img)); + img = Loader::loadImage("woodframe_metallic.png", 8); + mat->setTexture(PBRMaterial::METALLIC_SLOT, new Texture(img)); + img = Loader::loadImage("woodframe_roughness.png", 8); + mat->setTexture(PBRMaterial::ROUGHNESS_SLOT, new Texture(img)); + img = Loader::loadImage("woodframe_normal.png", 24); + mat->setTexture(PBRMaterial::NORMALS_SLOT, new Texture(img)); */ m_cubeMesh->setMaterial(mat); - + m_cubeMesh->computeTangents(); m_cubeMesh->initGL(); btVector3 halfExtents(s.x+PHYSICS_OFFSET, s.y+PHYSICS_OFFSET, s.z+PHYSICS_OFFSET); @@ -83,13 +90,19 @@ Potator::Potator(PlayerCharacterNode * player, // creating sphere mat = new PBRMaterial(); - mat->albedo = glm::vec3(0.1f); - mat->roughness = 0.1f; - mat->metallic = 0.9f; + Image* img = Loader::loadImage("slipperystonework_albedo.png", 24); + mat->setTexture(PBRMaterial::ALBEDO_SLOT, new Texture(img)); + img = Loader::loadImage("slipperystonework_metallic.png", 8); + mat->setTexture(PBRMaterial::METALLIC_SLOT, new Texture(img)); + img = Loader::loadImage("slipperystonework_roughness.png", 8); + mat->setTexture(PBRMaterial::ROUGHNESS_SLOT, new Texture(img)); + img = Loader::loadImage("slipperystonework_normal.png", 24); + mat->setTexture(PBRMaterial::NORMALS_SLOT, new Texture(img)); SphereGenerator sphereGen; - m_sphereMesh = sphereGen.generateGeodesicMesh(mat, 2, sphereRadius); + m_sphereMesh = sphereGen.generateParametricMesh(mat, 20, 20, sphereRadius); m_sphereMesh->computeNormals(); + m_sphereMesh->computeTangents(); m_sphereMesh->mergeVertices(); m_sphereMesh->initGL(); @@ -164,14 +177,32 @@ void Potator::throwSword() void Potator::update() { GibGeneratorNode::update(); - Input *input = getEngine().getInput(); - for(Action action : input->getActions()) + + if(getEngine().isMouseGrabbed()) { - if(action.action == m_throwCubeAction) - throwCube(); - else if(action.action == m_throwSphereAction) - throwSphere(); - else if(action.action == m_throwObjectAction) - throwSword(); + Input *input = getEngine().getInput(); + for(Action action : input->getActions()) + { + if(action.action == m_throwCubeAction) + throwCube(); + else if(action.action == m_throwSphereAction) + throwSphere(); + else if(action.action == m_throwObjectAction) + throwSword(); + } } + + ImGui::Begin("Potator"); + if(ImGui::Button("Load pack")) + LoadingThread::get()->loadResourcePack("woodbox"); + if(ImGui::Button("apply textures")) + { + PBRMaterial* mat = dynamic_cast(m_cubeMesh->getMaterial()); + mat->setTexture(PBRMaterial::ALBEDO_SLOT, RESOURCE_GET(Texture, "woodbox albedo")); + mat->setTexture(PBRMaterial::METALLIC_SLOT, RESOURCE_GET(Texture, "woodbox metallic")); + mat->setTexture(PBRMaterial::ROUGHNESS_SLOT, RESOURCE_GET(Texture, "woodbox roughness")); + mat->setTexture(PBRMaterial::NORMALS_SLOT, RESOURCE_GET(Texture, "woodbox normals")); + m_scene->registerMeshType(m_cubeMesh->getFlags()); + } + ImGui::End(); } diff --git a/src/tools/loader.h b/src/tools/loader.h index 59d6f18..a8b9a02 100644 --- a/src/tools/loader.h +++ b/src/tools/loader.h @@ -19,7 +19,7 @@ class Loader public: static std::string* loadTextFile(const std::string &filename); static std::unordered_map* loadConfigFile(const std::string &filename); - static Image* loadImage(const std::string &filename, int depth = 32, bool reversed = true); + static Image* loadImage(const std::string &filename, int depth = 24, bool reversed = true); static std::vector loadMesh(const std::string &filename); static Font* loadFont(const std::string &texture, const std::string &description); static bool loadMTL(const std::string &filename); diff --git a/src/tools/loadingthread.cpp b/src/tools/loadingthread.cpp new file mode 100644 index 0000000..86b5c83 --- /dev/null +++ b/src/tools/loadingthread.cpp @@ -0,0 +1,113 @@ +#include "loadingthread.h" + +#include +#include + +#include +#include + +#include + +#include + +LoadingThread* LoadingThread::singleton = nullptr; +std::thread* LoadingThread::thread = nullptr; + +LoadingThread::LoadingThread() : + m_currentTask(nullptr), + m_running(true), + m_taskProgress(0), + m_nbTaskProcessed(0) +{ +} + +LoadingThread* LoadingThread::init() +{ + if(singleton == nullptr) + { + singleton = new LoadingThread(); + thread = new std::thread(LoadingThread::run); + } + return singleton; +} + +void LoadingThread::destroy() +{ + if(singleton != nullptr) + { + singleton->m_running = false; + thread->join(); + delete singleton; + singleton = nullptr; + thread = nullptr; + } +} + +void LoadingThread::run() +{ + sf::Context openglContext; + singleton->processTasks(); +} + +void LoadingThread::processTasks() +{ + while(m_running) + { + if(m_resourceQueue.empty()) + sf::sleep(sf::milliseconds(500)); // wait for half a second + else + { + ResourceInterface* res = m_resourceQueue.front(); + m_resourceQueue.pop_front(); + res->load(m_taskProgress); + glFlush(); + if(m_taskProgress < 1.0) + fprintf(stderr, "failed to process the following task : %s\n", res->m_name.c_str()); + else + ++m_nbTaskProcessed; + } + } +} + +const std::string& LoadingThread::getCurrentTaskName() +{ + const static std::string noTask = "No current task"; + if(m_currentTask != nullptr) + return m_currentTask->m_name; + else + return noTask; +} + +void LoadingThread::loadResourcePack(const std::string& name) +{ + std::fstream file; + file.open("data/" + name + ".pack", std::ios_base::in); + ObjectLoader loader; + loader.loadAscii(file); + file.close(); + const std::vector& packVec = loader.getObjects(); + ResourcePack* pack = packVec[0]; + m_packs[name] = pack; + for(ResourceInterface* res : pack->m_resources) + { + if((m_references[res->m_name] += 1) == 1) + m_resourceQueue.push_back(res); + else + delete res; + } +} + +void LoadingThread::freeResourcePack(const std::string& name) +{ + ResourcePack* pack = m_packs[name]; + for(ResourceInterface* res : pack->m_resources) + { + if((m_references[res->m_name] -= 1) == 0) + { + m_references.erase(res->m_name); + delete res; + } + } + m_packs.erase(name); + delete pack; +} diff --git a/src/tools/loadingthread.h b/src/tools/loadingthread.h new file mode 100644 index 0000000..8f92a9a --- /dev/null +++ b/src/tools/loadingthread.h @@ -0,0 +1,44 @@ +#ifndef LOADINGTHREAD_H +#define LOADINGTHREAD_H + +#include +#include +#include + +#include "resourcepack.h" + +class LoadingThread +{ + static LoadingThread* singleton; + static std::thread* thread; + + std::deque m_resourceQueue; + std::unordered_map m_packs; + std::unordered_map m_references; + ResourceInterface* m_currentTask; + bool m_running; + float m_taskProgress; + int m_nbTaskProcessed; + + LoadingThread(); + void processTasks(); + +public: + static LoadingThread *init(); + static void destroy(); + static void run(); + + static LoadingThread* get() { return singleton; } + + float getTotalProgress() { return float(m_nbTaskProcessed)/float(m_resourceQueue.size() + m_nbTaskProcessed); } + void resetTotalProgress() { m_nbTaskProcessed = 0; } + float getCurrentTaskProgress() { return m_taskProgress; } + const std::string& getCurrentTaskName(); + + void loadResourcePack(const std::string& name); + + // please don't call this if the queue isn't empty + void freeResourcePack(const std::string& name); +}; + +#endif // LOADINGTHREAD_H diff --git a/src/tools/resourcepack.cpp b/src/tools/resourcepack.cpp new file mode 100644 index 0000000..8aec89f --- /dev/null +++ b/src/tools/resourcepack.cpp @@ -0,0 +1,149 @@ +#include "resourcepack.h" + +#include "loader.h" +#include "resourcemanager.h" + +#include + +#include +#include + +#include + +#include + +INIT_SERIALIZABLE(ResourcePack) + +void ResourcePack::gui() +{ + static ResourceInterface* currentResource = nullptr; + + ImGui::Begin("ResourcePack"); + char buf[1024] = {0}; + strcpy(buf, m_name.c_str()); + if(ImGui::InputText("Pack name", buf, 1024)) + m_name = buf; + + if(ImGui::Button("Save resource pack")) + { + std::fstream file; + ObjectSaver saver; + saver.addObject(this); + file.open("data/" + m_name + ".pack", std::ios_base::out); + saver.saveAscii(file); + file.close(); + } + if(ImGui::Button("Load resource pack")) + { + std::fstream file; + file.open("data/" + m_name + ".pack", std::ios_base::in); + ObjectLoader loader; + loader.loadAscii(file); + file.close(); + const std::vector& packVec = loader.getObjects(); + for(ResourceInterface* res : m_resources) + delete res; + m_resources = packVec[0]->m_resources; + delete packVec[0]; + } + + if(ImGui::Button("Add a texture")) + { + TextureResource* resource = new TextureResource(); + m_resources.push_back(resource); + } + + for(ResourceInterface* res : m_resources) + { + if(ImGui::Button(res->m_name.c_str())) + currentResource = res; + } + ImGui::End(); + + if(currentResource != nullptr) + { + bool opened = true; + ImGui::Begin("Resource Editor", &opened); + + char resBuf[1024] = {0}; + strcpy(resBuf, currentResource->m_name.c_str()); + if(ImGui::InputText("Name (should be unique)", resBuf, 1024)) + currentResource->m_name = resBuf; + + currentResource->gui(); + if(ImGui::Button("Delete resource")) + { + for(unsigned int i=0; i + +class Texture; + +/** + * @brief The ResourceInterface struct holds a resource, it handles its loading and its destruction + */ +struct ResourceInterface : public Serializable +{ + P_STRING(m_name) + + virtual void load(float & progress) = 0; + + virtual void destroy() = 0; + + virtual void gui() {} +}; + +/** + * @brief The ResourcePack class is just a container of LoadTask, it only exists for serialization purposes + */ +struct ResourcePack : public Serializable +{ + P_STRING(m_name) + P_VECTOR_REFERENCE(ResourceInterface, m_resources) + + ResourcePack() {} + + void gui(); + + SERIALIZABLE(ResourcePack, CAST(m_name), CAST(m_resources)) +}; + +// +// Some LoadTask implementations +// + +class TextureResource : public ResourceInterface +{ + P_STRING(m_path) + P_INT(m_bitsPerPixel) + P_BOOL(m_isVerticallyReversed) + P_BOOL(m_needsMipMaps) + + Texture* m_texture; + +public: + TextureResource(); + virtual ~TextureResource(); + + SERIALIZABLE(TextureResource, CAST(m_name), CAST(m_path), CAST(m_bitsPerPixel), CAST(m_isVerticallyReversed), CAST(m_needsMipMaps)) + + void load(float & progress); + + void destroy(); + + void gui(); +}; + +#endif // RESOURCEPACK_H diff --git a/src/tools/scenepicker.cpp b/src/tools/scenepicker.cpp new file mode 100644 index 0000000..d16b920 --- /dev/null +++ b/src/tools/scenepicker.cpp @@ -0,0 +1,92 @@ +#include "scenepicker.h" + +#include "engine.h" +#include "guitools.h" +#include "scene/scenetree.h" +#include "scene/playercharacternode.h" + +#include +#include +#include + +#include + +#include +#include +#include + +Mesh* ScenePicker::generateMesh() +{ + SphereGenerator generator; + PBRMaterial* mat = new PBRMaterial(); + mat->albedo = glm::vec3(1, 0, 0); // red + mat->emission = glm::vec3(0.3, 0, 0); // emits some red + mat->metallic = 0.6f; + mat->roughness = 0.3f; // quite shiny + Mesh* m = generator.generateGeodesicMesh(mat, 2, 0.3f); + m->computeNormals(); + m->setName("scenePicker"); + m->initGL(); + return m; +} + +ScenePicker::ScenePicker() : + MeshNode(generateMesh()), + m_pickSucceeded(false) +{ +} + +ScenePicker::~ScenePicker() +{ + delete m_geometry.mesh->getMaterial(); + delete m_geometry.mesh; +} + +void ScenePicker::update() +{ + pick(); + + bool isEnabled = true; + ImGui::Begin("Picker", &isEnabled); + if(m_pickSucceeded) + { + ImGui::Text("Intersection : ( %.3f, %.3f, %.3f )", m_pickedPos.x, m_pickedPos.y, m_pickedPos.z); + if(!isVisible()) setVisible(m_pickSucceeded); + } + else + { + ImGui::Text("No intesection"); + if(isVisible()) setVisible(m_pickSucceeded); + } + // if(ImGui::Button("Teleport")) + //move player to target coordinate + ImGui::End(); + + if(!isEnabled) + getEngine().getGuiTools()->togglePicker(); +} + +void ScenePicker::pick() +{ + FirstPersonCamera* cam = dynamic_cast(getEngine().getScene()->getCamera()); + if(cam != nullptr) + { + glm::vec3 dir_cam = cam->getDirection()*100; + btVector3 start(cam->getEyePosition().x, cam->getEyePosition().y, cam->getEyePosition().z); + btVector3 end = start; + end += btVector3(start.x() + dir_cam.x, start.y() + dir_cam.y, start.z() + dir_cam.z); + btCollisionWorld::ClosestRayResultCallback RayCallback(start, end); + getEngine().getPhysics()->rayTest(start,end,RayCallback); + + m_pickSucceeded = RayCallback.hasHit(); + if(m_pickSucceeded) + { + btVector3 target = RayCallback.m_hitPointWorld; + m_pickedPos = glm::vec3(target.x(), target.y(), target.z()); + m_geometry.modelMatrix = glm::translate(glm::mat4(), m_pickedPos); + } + } + else + m_pickSucceeded = false; +} + diff --git a/src/tools/scenepicker.h b/src/tools/scenepicker.h new file mode 100644 index 0000000..41ab04d --- /dev/null +++ b/src/tools/scenepicker.h @@ -0,0 +1,26 @@ +#ifndef SCENEPICKER_H +#define SCENEPICKER_H + +#include "scene/meshnode.h" + +class ScenePicker : public MeshNode +{ + static Mesh* generateMesh(); + + glm::vec3 m_pickedPos; + bool m_pickSucceeded; + +public: + ScenePicker(); + + virtual ~ScenePicker(); + + virtual void update(); + + void pick(); + + glm::vec3 getIntersection() { return m_pickedPos; } + bool getTraceSucceeded() { m_pickSucceeded; } +}; + +#endif // SCENEPICKER_H