diff --git a/.efrocachemap b/.efrocachemap index c59702fc..29edee20 100644 --- a/.efrocachemap +++ b/.efrocachemap @@ -3995,26 +3995,26 @@ "assets/src/ba_data/python/ba/_generated/__init__.py": "https://files.ballistica.net/cache/ba1/ee/e8/cad05aa531c7faf7ff7b96db7f6e", "assets/src/ba_data/python/ba/_generated/enums.py": "https://files.ballistica.net/cache/ba1/b2/e5/0ee0561e16257a32830645239f34", "ballisticacore-windows/Generic/BallisticaCore.ico": "https://files.ballistica.net/cache/ba1/89/c0/e32c7d2a35dc9aef57cc73b0911a", - "build/prefab/full/linux_arm64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/91/e4/e85f3feee6640ce65027660e5590", - "build/prefab/full/linux_arm64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/dd/50/db8d4e087b3fe272e9575b95996b", - "build/prefab/full/linux_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/e8/2f/1c8653ee8f0bad9cded74ebf5100", - "build/prefab/full/linux_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/2e/86/b9fb1d80caf79d23b785327a0cc7", - "build/prefab/full/linux_x86_64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/0f/4e/67f2eea7fa848b12994d487893dc", - "build/prefab/full/linux_x86_64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/b2/c4/d9555b8a060d11e6b1346cd82d12", - "build/prefab/full/linux_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/59/41/3aafb5bd7c6dddad37c89f304fb9", - "build/prefab/full/linux_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/cc/c1/a7cbdc71810ee752746eda33dd31", - "build/prefab/full/mac_arm64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/36/67/6a8b809011b4023533712d2df7b6", - "build/prefab/full/mac_arm64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/11/8c/172381e8a477cc11ee0e24460901", - "build/prefab/full/mac_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/79/ab/05c53d0807929316235d6e7382cd", - "build/prefab/full/mac_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/18/c2/415efdababdd14553c3adbeaaf7b", - "build/prefab/full/mac_x86_64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/3a/2d/863cc304f4856e34c81093b59db1", - "build/prefab/full/mac_x86_64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/33/fd/00a992c1d496ff85a99d381c6498", - "build/prefab/full/mac_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/e4/58/ac07183ee59eedbb78dcf2f0e91f", - "build/prefab/full/mac_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/cf/cb/91d2181102f6045e4d19cc73a18d", - "build/prefab/full/windows_x86_gui/debug/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/ce/f8/3e7a2452dae94b5cd857424e31fa", - "build/prefab/full/windows_x86_gui/release/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/04/f8/46d2bcc4f5d5b7c7d9bcc7b91418", - "build/prefab/full/windows_x86_server/debug/dist/BallisticaCoreHeadless.exe": "https://files.ballistica.net/cache/ba1/3b/10/9c15dbfbca54c1260b146de3029b", - "build/prefab/full/windows_x86_server/release/dist/BallisticaCoreHeadless.exe": "https://files.ballistica.net/cache/ba1/26/90/d2f4b8212b12508ed222609c7a7d", + "build/prefab/full/linux_arm64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/33/fa/2b4dc04a7e94af821486c0baaadd", + "build/prefab/full/linux_arm64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/39/c0/0a8c20d90b3bb0b605f56cf57cd6", + "build/prefab/full/linux_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/9d/9e/36bc9196a661b7ac730309363b25", + "build/prefab/full/linux_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/78/61/3ee51d8c85ac897cb48326059f4f", + "build/prefab/full/linux_x86_64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/41/24/ea579f7f46ee8764b99aa1f740e6", + "build/prefab/full/linux_x86_64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/d7/79/db7ba776fe53a432f501cc524f29", + "build/prefab/full/linux_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/67/8c/fd54c4640fe9574c819eb93235de", + "build/prefab/full/linux_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/d0/23/0ed4f59b045bd996e9e8c3adac25", + "build/prefab/full/mac_arm64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/7b/7a/65e4a1a866aa716f339934316888", + "build/prefab/full/mac_arm64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/4c/96/40086b7256c6b69500231234816f", + "build/prefab/full/mac_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/25/4e/65658e3b1137e29c26e5a250cb7f", + "build/prefab/full/mac_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/a4/d3/9e94f9f4a3f326ab3fb4563605e8", + "build/prefab/full/mac_x86_64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/70/82/54ac546d3d6404259c025e4697a6", + "build/prefab/full/mac_x86_64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/8c/71/35e658ed48d1732ac1ace9a651d0", + "build/prefab/full/mac_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/cb/c1/66f115696b5694b203d2a3e3f3b6", + "build/prefab/full/mac_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/76/7e/ef8ca6f4baae2d3540658a43238e", + "build/prefab/full/windows_x86_gui/debug/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/e5/01/48f01b3bfb0e11dfa298809751d6", + "build/prefab/full/windows_x86_gui/release/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/4e/35/3e14be7308b3b8a4d7ee00223d02", + "build/prefab/full/windows_x86_server/debug/dist/BallisticaCoreHeadless.exe": "https://files.ballistica.net/cache/ba1/2f/8d/5bf66b9999ac4a0b109ce6a93ee9", + "build/prefab/full/windows_x86_server/release/dist/BallisticaCoreHeadless.exe": "https://files.ballistica.net/cache/ba1/6f/ba/6814ccb61a86032c381b59092b92", "build/prefab/lib/linux_arm64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/e0/b3/7ccccfd8721033582cabdfe11f73", "build/prefab/lib/linux_arm64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/86/d2/d18cbc017a7d64001f96718cc5ed", "build/prefab/lib/linux_arm64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/64/9b/78cdb9eda7b30611774769859caa", @@ -4031,14 +4031,14 @@ "build/prefab/lib/mac_x86_64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/c8/d2/5df66f66e26c1beb8a1e2b1f0613", "build/prefab/lib/mac_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/7e/57/593e8ceeee37a65972f1fb30d2cd", "build/prefab/lib/mac_x86_64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/2f/fc/a2ac394899e6527f8def0cad4d8a", - "build/prefab/lib/windows/Debug_Win32/BallisticaCoreGenericInternal.lib": "https://files.ballistica.net/cache/ba1/20/4e/9afc0e73bb26d63032c3525d9373", - "build/prefab/lib/windows/Debug_Win32/BallisticaCoreGenericInternal.pdb": "https://files.ballistica.net/cache/ba1/f2/ab/eac71319d5184a3dd6b2ad74cf92", - "build/prefab/lib/windows/Debug_Win32/BallisticaCoreHeadlessInternal.lib": "https://files.ballistica.net/cache/ba1/ad/20/97feffa58fcbc8ac2ed2d9892326", - "build/prefab/lib/windows/Debug_Win32/BallisticaCoreHeadlessInternal.pdb": "https://files.ballistica.net/cache/ba1/0a/d8/6e58979b57cf74c0d675508b207f", - "build/prefab/lib/windows/Release_Win32/BallisticaCoreGenericInternal.lib": "https://files.ballistica.net/cache/ba1/79/c7/cb4590d0e233fa0455f9bd3158b0", - "build/prefab/lib/windows/Release_Win32/BallisticaCoreGenericInternal.pdb": "https://files.ballistica.net/cache/ba1/2a/14/99b6932f7e20e988d67faa4327d9", - "build/prefab/lib/windows/Release_Win32/BallisticaCoreHeadlessInternal.lib": "https://files.ballistica.net/cache/ba1/b0/77/b85ef1b5a280aa2426a613e76ec5", - "build/prefab/lib/windows/Release_Win32/BallisticaCoreHeadlessInternal.pdb": "https://files.ballistica.net/cache/ba1/b9/22/020a23ba4dba0b5871f78622bd67", + "build/prefab/lib/windows/Debug_Win32/BallisticaCoreGenericInternal.lib": "https://files.ballistica.net/cache/ba1/b9/00/54be93a362cac005b111902cf725", + "build/prefab/lib/windows/Debug_Win32/BallisticaCoreGenericInternal.pdb": "https://files.ballistica.net/cache/ba1/cf/33/0aba47dbe0848b9a0fe65e3fe5ac", + "build/prefab/lib/windows/Debug_Win32/BallisticaCoreHeadlessInternal.lib": "https://files.ballistica.net/cache/ba1/7f/a5/705f0b9b047d439d7b8805e684a1", + "build/prefab/lib/windows/Debug_Win32/BallisticaCoreHeadlessInternal.pdb": "https://files.ballistica.net/cache/ba1/e1/11/91da47c90faced11f80ce365e6ca", + "build/prefab/lib/windows/Release_Win32/BallisticaCoreGenericInternal.lib": "https://files.ballistica.net/cache/ba1/f0/47/fec8d08adc467bc46516ce39423a", + "build/prefab/lib/windows/Release_Win32/BallisticaCoreGenericInternal.pdb": "https://files.ballistica.net/cache/ba1/c0/cb/36553e332fb3297e8f632387fdbb", + "build/prefab/lib/windows/Release_Win32/BallisticaCoreHeadlessInternal.lib": "https://files.ballistica.net/cache/ba1/a7/96/f19a4cc19386511d732533ead3d3", + "build/prefab/lib/windows/Release_Win32/BallisticaCoreHeadlessInternal.pdb": "https://files.ballistica.net/cache/ba1/0c/23/5d5da73cd643d4fb344849768bf3", "src/ballistica/generated/python_embedded/binding.inc": "https://files.ballistica.net/cache/ba1/7d/3e/229a581cb2454ed856f1d8b564a7", "src/ballistica/generated/python_embedded/bootstrap.inc": "https://files.ballistica.net/cache/ba1/98/12/571b2160d69d42580e8f31fa6a8d" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index f472ce3f..ccf592e0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -### 1.7.7 (build 20803, api 7, 2022-09-10) +### 1.7.7 (build 20806, api 7, 2022-09-10) - Added `ba.app.meta.load_exported_classes()` for loading classes discovered by the meta subsystem cleanly in a background thread. - Improved logging of missing playlist game types. - Some ba.Lstr functionality can now be used in background threads. @@ -20,6 +20,8 @@ - There is now a `_bainternal.py` dummy-module alongside the existing `_ba.py` one. Be sure to exclude it from any script collections used by the game (the same as `_ba.py`). - Added checks to make sure _ba or _bainternal arent used outside of ba. Any 'internal' functionality needed outside of ba should be exposed through ba.internal. _ba and _bainternal are internal implementation details. - Removed C++ Module class and simplified Thread class. The Module class was an old relic of long ago before C++ had lambdas and its existence was pretty pointless and confusing these days. +- Renamed C++ App to AppFlavor and AppGlobals to App +- Renamed C++ Media to Assets ### 1.7.6 (build 20687, api 7, 2022-08-11) - Cleaned up da MetaSubsystem code. diff --git a/assets/src/ba_data/python/._bainternal_sources_hash b/assets/src/ba_data/python/._bainternal_sources_hash index 595ac638..4f751038 100644 --- a/assets/src/ba_data/python/._bainternal_sources_hash +++ b/assets/src/ba_data/python/._bainternal_sources_hash @@ -1 +1 @@ -250920245305497630480226719424525454078 \ No newline at end of file +319717366410279141138094934973337011486 \ No newline at end of file diff --git a/assets/src/ba_data/python/ba/_bootstrap.py b/assets/src/ba_data/python/ba/_bootstrap.py index 6c34fe48..bb1b9804 100644 --- a/assets/src/ba_data/python/ba/_bootstrap.py +++ b/assets/src/ba_data/python/ba/_bootstrap.py @@ -38,7 +38,7 @@ def bootstrap() -> None: # Give a soft warning if we're being used with a different binary # version than we expect. - expected_build = 20803 + expected_build = 20806 running_build: int = env['build_number'] if running_build != expected_build: print( diff --git a/ballisticacore-cmake/CMakeLists.txt b/ballisticacore-cmake/CMakeLists.txt index a807d3e3..68b79db8 100644 --- a/ballisticacore-cmake/CMakeLists.txt +++ b/ballisticacore-cmake/CMakeLists.txt @@ -210,6 +210,40 @@ add_executable(ballisticacore ${BA_SRC_ROOT}/ballistica/app/app_flavor_vr.h ${BA_SRC_ROOT}/ballistica/app/stress_test.cc ${BA_SRC_ROOT}/ballistica/app/stress_test.h + ${BA_SRC_ROOT}/ballistica/assets/assets.cc + ${BA_SRC_ROOT}/ballistica/assets/assets.h + ${BA_SRC_ROOT}/ballistica/assets/assets_server.cc + ${BA_SRC_ROOT}/ballistica/assets/assets_server.h + ${BA_SRC_ROOT}/ballistica/assets/component/asset_component.cc + ${BA_SRC_ROOT}/ballistica/assets/component/asset_component.h + ${BA_SRC_ROOT}/ballistica/assets/component/collide_model.cc + ${BA_SRC_ROOT}/ballistica/assets/component/collide_model.h + ${BA_SRC_ROOT}/ballistica/assets/component/cube_map_texture.cc + ${BA_SRC_ROOT}/ballistica/assets/component/cube_map_texture.h + ${BA_SRC_ROOT}/ballistica/assets/component/data.cc + ${BA_SRC_ROOT}/ballistica/assets/component/data.h + ${BA_SRC_ROOT}/ballistica/assets/component/model.cc + ${BA_SRC_ROOT}/ballistica/assets/component/model.h + ${BA_SRC_ROOT}/ballistica/assets/component/sound.cc + ${BA_SRC_ROOT}/ballistica/assets/component/sound.h + ${BA_SRC_ROOT}/ballistica/assets/component/texture.cc + ${BA_SRC_ROOT}/ballistica/assets/component/texture.h + ${BA_SRC_ROOT}/ballistica/assets/data/asset_component_data.cc + ${BA_SRC_ROOT}/ballistica/assets/data/asset_component_data.h + ${BA_SRC_ROOT}/ballistica/assets/data/collide_model_data.cc + ${BA_SRC_ROOT}/ballistica/assets/data/collide_model_data.h + ${BA_SRC_ROOT}/ballistica/assets/data/data_data.cc + ${BA_SRC_ROOT}/ballistica/assets/data/data_data.h + ${BA_SRC_ROOT}/ballistica/assets/data/model_data.cc + ${BA_SRC_ROOT}/ballistica/assets/data/model_data.h + ${BA_SRC_ROOT}/ballistica/assets/data/model_renderer_data.h + ${BA_SRC_ROOT}/ballistica/assets/data/sound_data.cc + ${BA_SRC_ROOT}/ballistica/assets/data/sound_data.h + ${BA_SRC_ROOT}/ballistica/assets/data/texture_data.cc + ${BA_SRC_ROOT}/ballistica/assets/data/texture_data.h + ${BA_SRC_ROOT}/ballistica/assets/data/texture_preload_data.cc + ${BA_SRC_ROOT}/ballistica/assets/data/texture_preload_data.h + ${BA_SRC_ROOT}/ballistica/assets/data/texture_renderer_data.h ${BA_SRC_ROOT}/ballistica/audio/al_sys.cc ${BA_SRC_ROOT}/ballistica/audio/al_sys.h ${BA_SRC_ROOT}/ballistica/audio/audio.cc @@ -466,40 +500,6 @@ add_executable(ballisticacore ${BA_SRC_ROOT}/ballistica/math/vector3f.cc ${BA_SRC_ROOT}/ballistica/math/vector3f.h ${BA_SRC_ROOT}/ballistica/math/vector4f.h - ${BA_SRC_ROOT}/ballistica/media/component/collide_model.cc - ${BA_SRC_ROOT}/ballistica/media/component/collide_model.h - ${BA_SRC_ROOT}/ballistica/media/component/cube_map_texture.cc - ${BA_SRC_ROOT}/ballistica/media/component/cube_map_texture.h - ${BA_SRC_ROOT}/ballistica/media/component/data.cc - ${BA_SRC_ROOT}/ballistica/media/component/data.h - ${BA_SRC_ROOT}/ballistica/media/component/media_component.cc - ${BA_SRC_ROOT}/ballistica/media/component/media_component.h - ${BA_SRC_ROOT}/ballistica/media/component/model.cc - ${BA_SRC_ROOT}/ballistica/media/component/model.h - ${BA_SRC_ROOT}/ballistica/media/component/sound.cc - ${BA_SRC_ROOT}/ballistica/media/component/sound.h - ${BA_SRC_ROOT}/ballistica/media/component/texture.cc - ${BA_SRC_ROOT}/ballistica/media/component/texture.h - ${BA_SRC_ROOT}/ballistica/media/data/collide_model_data.cc - ${BA_SRC_ROOT}/ballistica/media/data/collide_model_data.h - ${BA_SRC_ROOT}/ballistica/media/data/data_data.cc - ${BA_SRC_ROOT}/ballistica/media/data/data_data.h - ${BA_SRC_ROOT}/ballistica/media/data/media_component_data.cc - ${BA_SRC_ROOT}/ballistica/media/data/media_component_data.h - ${BA_SRC_ROOT}/ballistica/media/data/model_data.cc - ${BA_SRC_ROOT}/ballistica/media/data/model_data.h - ${BA_SRC_ROOT}/ballistica/media/data/model_renderer_data.h - ${BA_SRC_ROOT}/ballistica/media/data/sound_data.cc - ${BA_SRC_ROOT}/ballistica/media/data/sound_data.h - ${BA_SRC_ROOT}/ballistica/media/data/texture_data.cc - ${BA_SRC_ROOT}/ballistica/media/data/texture_data.h - ${BA_SRC_ROOT}/ballistica/media/data/texture_preload_data.cc - ${BA_SRC_ROOT}/ballistica/media/data/texture_preload_data.h - ${BA_SRC_ROOT}/ballistica/media/data/texture_renderer_data.h - ${BA_SRC_ROOT}/ballistica/media/media.cc - ${BA_SRC_ROOT}/ballistica/media/media.h - ${BA_SRC_ROOT}/ballistica/media/media_server.cc - ${BA_SRC_ROOT}/ballistica/media/media_server.h ${BA_SRC_ROOT}/ballistica/networking/network_reader.cc ${BA_SRC_ROOT}/ballistica/networking/network_reader.h ${BA_SRC_ROOT}/ballistica/networking/network_writer.cc @@ -557,14 +557,14 @@ add_executable(ballisticacore ${BA_SRC_ROOT}/ballistica/python/class/python_class_widget.h ${BA_SRC_ROOT}/ballistica/python/methods/python_methods_app.cc ${BA_SRC_ROOT}/ballistica/python/methods/python_methods_app.h + ${BA_SRC_ROOT}/ballistica/python/methods/python_methods_assets.cc + ${BA_SRC_ROOT}/ballistica/python/methods/python_methods_assets.h ${BA_SRC_ROOT}/ballistica/python/methods/python_methods_gameplay.cc ${BA_SRC_ROOT}/ballistica/python/methods/python_methods_gameplay.h ${BA_SRC_ROOT}/ballistica/python/methods/python_methods_graphics.cc ${BA_SRC_ROOT}/ballistica/python/methods/python_methods_graphics.h ${BA_SRC_ROOT}/ballistica/python/methods/python_methods_input.cc ${BA_SRC_ROOT}/ballistica/python/methods/python_methods_input.h - ${BA_SRC_ROOT}/ballistica/python/methods/python_methods_media.cc - ${BA_SRC_ROOT}/ballistica/python/methods/python_methods_media.h ${BA_SRC_ROOT}/ballistica/python/methods/python_methods_networking.cc ${BA_SRC_ROOT}/ballistica/python/methods/python_methods_networking.h ${BA_SRC_ROOT}/ballistica/python/methods/python_methods_system.cc diff --git a/ballisticacore-windows/Generic/BallisticaCoreGeneric.vcxproj b/ballisticacore-windows/Generic/BallisticaCoreGeneric.vcxproj index 4c34c25e..82c02cee 100644 --- a/ballisticacore-windows/Generic/BallisticaCoreGeneric.vcxproj +++ b/ballisticacore-windows/Generic/BallisticaCoreGeneric.vcxproj @@ -201,6 +201,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -457,40 +491,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -548,14 +548,14 @@ + + - - diff --git a/ballisticacore-windows/Generic/BallisticaCoreGeneric.vcxproj.filters b/ballisticacore-windows/Generic/BallisticaCoreGeneric.vcxproj.filters index 8f86a56f..3644f340 100644 --- a/ballisticacore-windows/Generic/BallisticaCoreGeneric.vcxproj.filters +++ b/ballisticacore-windows/Generic/BallisticaCoreGeneric.vcxproj.filters @@ -37,6 +37,108 @@ ballistica\app + + ballistica\assets + + + ballistica\assets + + + ballistica\assets + + + ballistica\assets + + + ballistica\assets\component + + + ballistica\assets\component + + + ballistica\assets\component + + + ballistica\assets\component + + + ballistica\assets\component + + + ballistica\assets\component + + + ballistica\assets\component + + + ballistica\assets\component + + + ballistica\assets\component + + + ballistica\assets\component + + + ballistica\assets\component + + + ballistica\assets\component + + + ballistica\assets\component + + + ballistica\assets\component + + + ballistica\assets\data + + + ballistica\assets\data + + + ballistica\assets\data + + + ballistica\assets\data + + + ballistica\assets\data + + + ballistica\assets\data + + + ballistica\assets\data + + + ballistica\assets\data + + + ballistica\assets\data + + + ballistica\assets\data + + + ballistica\assets\data + + + ballistica\assets\data + + + ballistica\assets\data + + + ballistica\assets\data + + + ballistica\assets\data + + + ballistica\assets\data + ballistica\audio @@ -805,108 +907,6 @@ ballistica\math - - ballistica\media\component - - - ballistica\media\component - - - ballistica\media\component - - - ballistica\media\component - - - ballistica\media\component - - - ballistica\media\component - - - ballistica\media\component - - - ballistica\media\component - - - ballistica\media\component - - - ballistica\media\component - - - ballistica\media\component - - - ballistica\media\component - - - ballistica\media\component - - - ballistica\media\component - - - ballistica\media\data - - - ballistica\media\data - - - ballistica\media\data - - - ballistica\media\data - - - ballistica\media\data - - - ballistica\media\data - - - ballistica\media\data - - - ballistica\media\data - - - ballistica\media\data - - - ballistica\media\data - - - ballistica\media\data - - - ballistica\media\data - - - ballistica\media\data - - - ballistica\media\data - - - ballistica\media\data - - - ballistica\media\data - - - ballistica\media - - - ballistica\media - - - ballistica\media - - - ballistica\media - ballistica\networking @@ -1078,6 +1078,12 @@ ballistica\python\methods + + ballistica\python\methods + + + ballistica\python\methods + ballistica\python\methods @@ -1096,12 +1102,6 @@ ballistica\python\methods - - ballistica\python\methods - - - ballistica\python\methods - ballistica\python\methods @@ -1646,6 +1646,9 @@ + + + @@ -1666,9 +1669,6 @@ - - - diff --git a/ballisticacore-windows/Headless/BallisticaCoreHeadless.vcxproj b/ballisticacore-windows/Headless/BallisticaCoreHeadless.vcxproj index c8692ebb..cca83bf4 100644 --- a/ballisticacore-windows/Headless/BallisticaCoreHeadless.vcxproj +++ b/ballisticacore-windows/Headless/BallisticaCoreHeadless.vcxproj @@ -196,6 +196,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -452,40 +486,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -543,14 +543,14 @@ + + - - diff --git a/ballisticacore-windows/Headless/BallisticaCoreHeadless.vcxproj.filters b/ballisticacore-windows/Headless/BallisticaCoreHeadless.vcxproj.filters index 8f86a56f..3644f340 100644 --- a/ballisticacore-windows/Headless/BallisticaCoreHeadless.vcxproj.filters +++ b/ballisticacore-windows/Headless/BallisticaCoreHeadless.vcxproj.filters @@ -37,6 +37,108 @@ ballistica\app + + ballistica\assets + + + ballistica\assets + + + ballistica\assets + + + ballistica\assets + + + ballistica\assets\component + + + ballistica\assets\component + + + ballistica\assets\component + + + ballistica\assets\component + + + ballistica\assets\component + + + ballistica\assets\component + + + ballistica\assets\component + + + ballistica\assets\component + + + ballistica\assets\component + + + ballistica\assets\component + + + ballistica\assets\component + + + ballistica\assets\component + + + ballistica\assets\component + + + ballistica\assets\component + + + ballistica\assets\data + + + ballistica\assets\data + + + ballistica\assets\data + + + ballistica\assets\data + + + ballistica\assets\data + + + ballistica\assets\data + + + ballistica\assets\data + + + ballistica\assets\data + + + ballistica\assets\data + + + ballistica\assets\data + + + ballistica\assets\data + + + ballistica\assets\data + + + ballistica\assets\data + + + ballistica\assets\data + + + ballistica\assets\data + + + ballistica\assets\data + ballistica\audio @@ -805,108 +907,6 @@ ballistica\math - - ballistica\media\component - - - ballistica\media\component - - - ballistica\media\component - - - ballistica\media\component - - - ballistica\media\component - - - ballistica\media\component - - - ballistica\media\component - - - ballistica\media\component - - - ballistica\media\component - - - ballistica\media\component - - - ballistica\media\component - - - ballistica\media\component - - - ballistica\media\component - - - ballistica\media\component - - - ballistica\media\data - - - ballistica\media\data - - - ballistica\media\data - - - ballistica\media\data - - - ballistica\media\data - - - ballistica\media\data - - - ballistica\media\data - - - ballistica\media\data - - - ballistica\media\data - - - ballistica\media\data - - - ballistica\media\data - - - ballistica\media\data - - - ballistica\media\data - - - ballistica\media\data - - - ballistica\media\data - - - ballistica\media\data - - - ballistica\media - - - ballistica\media - - - ballistica\media - - - ballistica\media - ballistica\networking @@ -1078,6 +1078,12 @@ ballistica\python\methods + + ballistica\python\methods + + + ballistica\python\methods + ballistica\python\methods @@ -1096,12 +1102,6 @@ ballistica\python\methods - - ballistica\python\methods - - - ballistica\python\methods - ballistica\python\methods @@ -1646,6 +1646,9 @@ + + + @@ -1666,9 +1669,6 @@ - - - diff --git a/src/ballistica/app/stress_test.cc b/src/ballistica/app/stress_test.cc index 0dbea11a..d7f22d39 100644 --- a/src/ballistica/app/stress_test.cc +++ b/src/ballistica/app/stress_test.cc @@ -76,11 +76,11 @@ void StressTest::Update() { uint32_t texture_count = 0; uint32_t sound_count = 0; uint32_t node_count = 0; - if (g_media) { - model_count = g_media->total_model_count(); - collide_model_count = g_media->total_collide_model_count(); - texture_count = g_media->total_texture_count(); - sound_count = g_media->total_sound_count(); + if (g_assets) { + model_count = g_assets->total_model_count(); + collide_model_count = g_assets->total_collide_model_count(); + texture_count = g_assets->total_texture_count(); + sound_count = g_assets->total_sound_count(); } assert(g_game); std::string mem_usage = g_platform->GetMemUsageInfo(); diff --git a/src/ballistica/media/media.cc b/src/ballistica/assets/assets.cc similarity index 81% rename from src/ballistica/media/media.cc rename to src/ballistica/assets/assets.cc index eb1ec6f2..190be948 100644 --- a/src/ballistica/media/media.cc +++ b/src/ballistica/assets/assets.cc @@ -1,23 +1,23 @@ // Released under the MIT License. See LICENSE for details. -#include "ballistica/media/media.h" +#include "ballistica/assets/assets.h" #if !BA_OSTYPE_WINDOWS #include #endif +#include "ballistica/assets/assets_server.h" +#include "ballistica/assets/component/collide_model.h" +#include "ballistica/assets/component/data.h" +#include "ballistica/assets/component/model.h" +#include "ballistica/assets/component/texture.h" +#include "ballistica/assets/data/sound_data.h" #include "ballistica/audio/audio_server.h" #include "ballistica/core/thread.h" #include "ballistica/game/game.h" #include "ballistica/generic/timer.h" #include "ballistica/graphics/graphics_server.h" #include "ballistica/graphics/text/text_packer.h" -#include "ballistica/media/component/collide_model.h" -#include "ballistica/media/component/data.h" -#include "ballistica/media/component/model.h" -#include "ballistica/media/component/texture.h" -#include "ballistica/media/data/sound_data.h" -#include "ballistica/media/media_server.h" #include "ballistica/python/python_sys.h" namespace ballistica { @@ -26,8 +26,8 @@ namespace ballistica { #define BA_SHOW_LOADS_UNLOADS 0 #define SHOW_PRUNING_INFO 0 -// Standard prune time for unused media: 10 minutes (1000ms * 60 * 10). -#define STANDARD_MEDIA_PRUNE_TIME 600000 +// Standard prune time for unused assets: 10 minutes (1000ms * 60 * 10). +#define STANDARD_ASSET_PRUNE_TIME 600000 // More aggressive prune time for dynamically-generated text-textures: 10 // seconds. @@ -35,53 +35,53 @@ namespace ballistica { #define QR_TEXTURE_PRUNE_TIME 10000 -// How long we should spend loading media in each runPendingLoads() call. +// How long we should spend loading assets in each runPendingLoads() call. #define PENDING_LOAD_PROCESS_TIME 5 -Media::Media() { - media_paths_.emplace_back("ba_data"); +Assets::Assets() { + asset_paths_.emplace_back("ba_data"); for (bool& have_pending_load : have_pending_loads_) { have_pending_load = false; } } -void Media::LoadSystemTexture(SystemTextureID id, const char* name) { - assert(media_lists_locked_); +void Assets::LoadSystemTexture(SystemTextureID id, const char* name) { + assert(asset_lists_locked_); system_textures_.push_back(GetTextureData(name)); assert(system_textures_.size() == static_cast(id) + 1); } -void Media::LoadSystemCubeMapTexture(SystemCubeMapTextureID id, - const char* name) { - assert(media_lists_locked_); +void Assets::LoadSystemCubeMapTexture(SystemCubeMapTextureID id, + const char* name) { + assert(asset_lists_locked_); system_cube_map_textures_.push_back(GetCubeMapTextureData(name)); assert(system_cube_map_textures_.size() == static_cast(id) + 1); } -void Media::LoadSystemSound(SystemSoundID id, const char* name) { +void Assets::LoadSystemSound(SystemSoundID id, const char* name) { system_sounds_.push_back(GetSoundData(name)); assert(system_sounds_.size() == static_cast(id) + 1); } -void Media::LoadSystemData(SystemDataID id, const char* name) { +void Assets::LoadSystemData(SystemDataID id, const char* name) { system_datas_.push_back(GetDataData(name)); assert(system_datas_.size() == static_cast(id) + 1); } -void Media::LoadSystemModel(SystemModelID id, const char* name) { +void Assets::LoadSystemModel(SystemModelID id, const char* name) { system_models_.push_back(GetModelData(name)); assert(system_models_.size() == static_cast(id) + 1); } -void Media::LoadSystemMedia() { +void Assets::LoadSystemAssets() { assert(InLogicThread()); - assert(g_audio_server && g_media_server && g_graphics_server); + assert(g_audio_server && g_assets_server && g_graphics_server); assert(g_graphics_server && g_graphics_server->texture_compression_types_are_set()); assert(g_graphics && g_graphics_server->texture_quality_set()); // Just grab the lock once for all this stuff for efficiency. - MediaListsLock lock; + AssetListLock lock; // System textures: LoadSystemTexture(SystemTextureID::kUIAtlas, "uiAtlas"); @@ -280,24 +280,24 @@ void Media::LoadSystemMedia() { LoadSystemModel(SystemModelID::kWing, "wing"); // Hooray! - system_media_loaded_ = true; + system_assets_loaded_ = true; } -void Media::PrintLoadInfo() { +void Assets::PrintLoadInfo() { std::string s; char buffer[256]; int num = 1; // Need to lock lists while iterating over them. - MediaListsLock lock; - s = "Media load results: (all times in milliseconds):\n"; + AssetListLock lock; + s = "Assets load results: (all times in milliseconds):\n"; snprintf(buffer, sizeof(buffer), " %-50s %10s %10s", "FILE", "PRELOAD_TIME", "LOAD_TIME"); s += buffer; Log(s, true, false); millisecs_t total_preload_time = 0; millisecs_t total_load_time = 0; - assert(media_lists_locked_); + assert(asset_lists_locked_); for (auto&& i : models_) { millisecs_t preload_time = i.second->preload_time(); millisecs_t load_time = i.second->load_time(); @@ -310,7 +310,7 @@ void Media::PrintLoadInfo() { Log(buffer, true, false); num++; } - assert(media_lists_locked_); + assert(asset_lists_locked_); for (auto&& i : collide_models_) { millisecs_t preload_time = i.second->preload_time(); millisecs_t load_time = i.second->load_time(); @@ -323,7 +323,7 @@ void Media::PrintLoadInfo() { Log(buffer, true, false); num++; } - assert(media_lists_locked_); + assert(asset_lists_locked_); for (auto&& i : sounds_) { millisecs_t preload_time = i.second->preload_time(); millisecs_t load_time = i.second->load_time(); @@ -336,7 +336,7 @@ void Media::PrintLoadInfo() { Log(buffer, true, false); num++; } - assert(media_lists_locked_); + assert(asset_lists_locked_); for (auto&& i : datas_) { millisecs_t preload_time = i.second->preload_time(); millisecs_t load_time = i.second->load_time(); @@ -349,7 +349,7 @@ void Media::PrintLoadInfo() { Log(buffer, true, false); num++; } - assert(media_lists_locked_); + assert(asset_lists_locked_); for (auto&& i : textures_) { millisecs_t preload_time = i.second->preload_time(); millisecs_t load_time = i.second->load_time(); @@ -370,96 +370,97 @@ void Media::PrintLoadInfo() { Log(buffer, true, false); } -void Media::MarkAllMediaForLoad() { +void Assets::MarkAllAssetsForLoad() { assert(InLogicThread()); // Need to keep lists locked while iterating over them. - MediaListsLock m_lock; + AssetListLock m_lock; for (auto&& i : textures_) { if (!i.second->preloaded()) { - MediaComponentData::LockGuard lock(i.second.get()); - have_pending_loads_[static_cast(MediaType::kTexture)] = true; + AssetComponentData::LockGuard lock(i.second.get()); + have_pending_loads_[static_cast(AssetType::kTexture)] = true; MarkComponentForLoad(i.second.get()); } } for (auto&& i : text_textures_) { if (!i.second->preloaded()) { - MediaComponentData::LockGuard lock(i.second.get()); - have_pending_loads_[static_cast(MediaType::kTexture)] = true; + AssetComponentData::LockGuard lock(i.second.get()); + have_pending_loads_[static_cast(AssetType::kTexture)] = true; MarkComponentForLoad(i.second.get()); } } for (auto&& i : qr_textures_) { if (!i.second->preloaded()) { - MediaComponentData::LockGuard lock(i.second.get()); - have_pending_loads_[static_cast(MediaType::kTexture)] = true; + AssetComponentData::LockGuard lock(i.second.get()); + have_pending_loads_[static_cast(AssetType::kTexture)] = true; MarkComponentForLoad(i.second.get()); } } for (auto&& i : models_) { if (!i.second->preloaded()) { - MediaComponentData::LockGuard lock(i.second.get()); - have_pending_loads_[static_cast(MediaType::kModel)] = true; + AssetComponentData::LockGuard lock(i.second.get()); + have_pending_loads_[static_cast(AssetType::kModel)] = true; MarkComponentForLoad(i.second.get()); } } } // Call this from the graphics thread to immediately unload all -// media used by it. (for when GL context gets lost, etc). -void Media::UnloadRendererBits(bool do_textures, bool do_models) { +// assets used by it. (for when GL context gets lost, etc). +void Assets::UnloadRendererBits(bool do_textures, bool do_models) { assert(InGraphicsThread()); // need to keep lists locked while iterating over them.. - MediaListsLock m_lock; + AssetListLock m_lock; if (do_textures) { - assert(media_lists_locked_); + assert(asset_lists_locked_); for (auto&& i : textures_) { - MediaComponentData::LockGuard lock(i.second.get()); + AssetComponentData::LockGuard lock(i.second.get()); i.second->Unload(true); } for (auto&& i : text_textures_) { - MediaComponentData::LockGuard lock(i.second.get()); + AssetComponentData::LockGuard lock(i.second.get()); i.second->Unload(true); } for (auto&& i : qr_textures_) { - MediaComponentData::LockGuard lock(i.second.get()); + AssetComponentData::LockGuard lock(i.second.get()); i.second->Unload(true); } } if (do_models) { for (auto&& i : models_) { - MediaComponentData::LockGuard lock(i.second.get()); + AssetComponentData::LockGuard lock(i.second.get()); i.second->Unload(true); } } } -auto Media::GetModelData(const std::string& file_name) +auto Assets::GetModelData(const std::string& file_name) -> Object::Ref { return GetComponentData(file_name, &models_); } -auto Media::GetSoundData(const std::string& file_name) +auto Assets::GetSoundData(const std::string& file_name) -> Object::Ref { return GetComponentData(file_name, &sounds_); } -auto Media::GetDataData(const std::string& file_name) -> Object::Ref { +auto Assets::GetDataData(const std::string& file_name) + -> Object::Ref { return GetComponentData(file_name, &datas_); } -auto Media::GetCollideModelData(const std::string& file_name) +auto Assets::GetCollideModelData(const std::string& file_name) -> Object::Ref { return GetComponentData(file_name, &collide_models_); } template -auto Media::GetComponentData( +auto Assets::GetComponentData( const std::string& file_name, std::unordered_map >* c_list) -> Object::Ref { assert(InLogicThread()); - assert(media_lists_locked_); + assert(asset_lists_locked_); auto i = c_list->find(file_name); if (i != c_list->end()) { return Object::Ref(i->second.get()); @@ -467,8 +468,8 @@ auto Media::GetComponentData( auto d(Object::New(file_name)); (*c_list)[file_name] = d; { - MediaComponentData::LockGuard lock(d.get()); - have_pending_loads_[static_cast(d->GetMediaType())] = true; + AssetComponentData::LockGuard lock(d.get()); + have_pending_loads_[static_cast(d->GetAssetType())] = true; MarkComponentForLoad(d.get()); } d->set_last_used_time(GetRealTime()); @@ -476,9 +477,9 @@ auto Media::GetComponentData( } } -auto Media::GetTextureData(TextPacker* packer) -> Object::Ref { +auto Assets::GetTextureData(TextPacker* packer) -> Object::Ref { assert(InLogicThread()); - assert(media_lists_locked_); + assert(asset_lists_locked_); const std::string& hash(packer->hash()); auto i = text_textures_.find(hash); if (i != text_textures_.end()) { @@ -487,8 +488,8 @@ auto Media::GetTextureData(TextPacker* packer) -> Object::Ref { auto d(Object::New(packer)); text_textures_[hash] = d; { - MediaComponentData::LockGuard lock(d.get()); - have_pending_loads_[static_cast(d->GetMediaType())] = true; + AssetComponentData::LockGuard lock(d.get()); + have_pending_loads_[static_cast(d->GetAssetType())] = true; MarkComponentForLoad(d.get()); } d->set_last_used_time(GetRealTime()); @@ -496,10 +497,10 @@ auto Media::GetTextureData(TextPacker* packer) -> Object::Ref { } } -auto Media::GetTextureDataQRCode(const std::string& url) +auto Assets::GetTextureDataQRCode(const std::string& url) -> Object::Ref { assert(InLogicThread()); - assert(media_lists_locked_); + assert(asset_lists_locked_); auto i = qr_textures_.find(url); if (i != qr_textures_.end()) { return Object::Ref(i->second.get()); @@ -507,8 +508,8 @@ auto Media::GetTextureDataQRCode(const std::string& url) auto d(Object::New(url)); qr_textures_[url] = d; { - MediaComponentData::LockGuard lock(d.get()); - have_pending_loads_[static_cast(d->GetMediaType())] = true; + AssetComponentData::LockGuard lock(d.get()); + have_pending_loads_[static_cast(d->GetAssetType())] = true; MarkComponentForLoad(d.get()); } d->set_last_used_time(GetRealTime()); @@ -518,10 +519,10 @@ auto Media::GetTextureDataQRCode(const std::string& url) // Eww can't recycle GetComponent here since we need extra stuff (tex-type arg) // ..should fix. -auto Media::GetCubeMapTextureData(const std::string& file_name) +auto Assets::GetCubeMapTextureData(const std::string& file_name) -> Object::Ref { assert(InLogicThread()); - assert(media_lists_locked_); + assert(asset_lists_locked_); auto i = textures_.find(file_name); if (i != textures_.end()) { return Object::Ref(i->second.get()); @@ -530,8 +531,8 @@ auto Media::GetCubeMapTextureData(const std::string& file_name) TextureMinQuality::kLow)); textures_[file_name] = d; { - MediaComponentData::LockGuard lock(d.get()); - have_pending_loads_[static_cast(d->GetMediaType())] = true; + AssetComponentData::LockGuard lock(d.get()); + have_pending_loads_[static_cast(d->GetAssetType())] = true; MarkComponentForLoad(d.get()); } d->set_last_used_time(GetRealTime()); @@ -541,10 +542,10 @@ auto Media::GetCubeMapTextureData(const std::string& file_name) // Eww; can't recycle GetComponent here since we need extra stuff (quality // settings, etc). Should fix. -auto Media::GetTextureData(const std::string& file_name) +auto Assets::GetTextureData(const std::string& file_name) -> Object::Ref { assert(InLogicThread()); - assert(media_lists_locked_); + assert(asset_lists_locked_); auto i = textures_.find(file_name); if (i != textures_.end()) { return Object::Ref(i->second.get()); @@ -586,8 +587,8 @@ auto Media::GetTextureData(const std::string& file_name) auto d(Object::New(file_name, TextureType::k2D, min_quality)); textures_[file_name] = d; { - MediaComponentData::LockGuard lock(d.get()); - have_pending_loads_[static_cast(d->GetMediaType())] = true; + AssetComponentData::LockGuard lock(d.get()); + have_pending_loads_[static_cast(d->GetAssetType())] = true; MarkComponentForLoad(d.get()); } d->set_last_used_time(GetRealTime()); @@ -595,7 +596,7 @@ auto Media::GetTextureData(const std::string& file_name) } } -void Media::MarkComponentForLoad(MediaComponentData* c) { +void Assets::MarkComponentForLoad(AssetComponentData* c) { assert(InLogicThread()); assert(c->locked()); @@ -606,19 +607,19 @@ void Media::MarkComponentForLoad(MediaComponentData* c) { // once it makes it back to us we can delete the ref (in // ClearPendingLoadsDoneList) - auto media_ptr = new Object::Ref(c); + auto asset_ptr = new Object::Ref(c); - g_media_server->thread()->PushCall([media_ptr] { - assert(InMediaThread()); + g_assets_server->thread()->PushCall([asset_ptr] { + assert(InAssetsThread()); // add our pointer to one of the preload lists and shake our preload thread // to wake it up - if ((**media_ptr).GetMediaType() == MediaType::kSound) { - g_media_server->pending_preloads_audio_.push_back(media_ptr); + if ((**asset_ptr).GetAssetType() == AssetType::kSound) { + g_assets_server->pending_preloads_audio_.push_back(asset_ptr); } else { - g_media_server->pending_preloads_.push_back(media_ptr); + g_assets_server->pending_preloads_.push_back(asset_ptr); } - g_media_server->process_timer_->SetLength(0); + g_assets_server->process_timer_->SetLength(0); }); } @@ -626,102 +627,102 @@ void Media::MarkComponentForLoad(MediaComponentData* c) { #pragma ide diagnostic ignored "UnreachableCode" #pragma ide diagnostic ignored "ConstantFunctionResult" -auto Media::GetModelPendingLoadCount() -> int { - if (!have_pending_loads_[static_cast(MediaType::kModel)]) { +auto Assets::GetModelPendingLoadCount() -> int { + if (!have_pending_loads_[static_cast(AssetType::kModel)]) { return 0; } - MediaListsLock lock; - int total = GetComponentPendingLoadCount(&models_, MediaType::kModel); + AssetListLock lock; + int total = GetComponentPendingLoadCount(&models_, AssetType::kModel); if (total == 0) { // When fully loaded, stop counting. - have_pending_loads_[static_cast(MediaType::kModel)] = false; + have_pending_loads_[static_cast(AssetType::kModel)] = false; } return total; } -auto Media::GetTexturePendingLoadCount() -> int { - if (!have_pending_loads_[static_cast(MediaType::kTexture)]) { +auto Assets::GetTexturePendingLoadCount() -> int { + if (!have_pending_loads_[static_cast(AssetType::kTexture)]) { return 0; } - MediaListsLock lock; + AssetListLock lock; int total = - (GetComponentPendingLoadCount(&textures_, MediaType::kTexture) - + GetComponentPendingLoadCount(&text_textures_, MediaType::kTexture) - + GetComponentPendingLoadCount(&qr_textures_, MediaType::kTexture)); + (GetComponentPendingLoadCount(&textures_, AssetType::kTexture) + + GetComponentPendingLoadCount(&text_textures_, AssetType::kTexture) + + GetComponentPendingLoadCount(&qr_textures_, AssetType::kTexture)); if (total == 0) { // When fully loaded, stop counting. - have_pending_loads_[static_cast(MediaType::kTexture)] = false; + have_pending_loads_[static_cast(AssetType::kTexture)] = false; } return total; } -auto Media::GetSoundPendingLoadCount() -> int { - if (!have_pending_loads_[static_cast(MediaType::kSound)]) { +auto Assets::GetSoundPendingLoadCount() -> int { + if (!have_pending_loads_[static_cast(AssetType::kSound)]) { return 0; } - MediaListsLock lock; - int total = GetComponentPendingLoadCount(&sounds_, MediaType::kSound); + AssetListLock lock; + int total = GetComponentPendingLoadCount(&sounds_, AssetType::kSound); if (total == 0) { // When fully loaded, stop counting. - have_pending_loads_[static_cast(MediaType::kSound)] = false; + have_pending_loads_[static_cast(AssetType::kSound)] = false; } return total; } -auto Media::GetDataPendingLoadCount() -> int { - if (!have_pending_loads_[static_cast(MediaType::kData)]) { +auto Assets::GetDataPendingLoadCount() -> int { + if (!have_pending_loads_[static_cast(AssetType::kData)]) { return 0; } - MediaListsLock lock; - int total = GetComponentPendingLoadCount(&datas_, MediaType::kData); + AssetListLock lock; + int total = GetComponentPendingLoadCount(&datas_, AssetType::kData); if (total == 0) { // When fully loaded, stop counting. - have_pending_loads_[static_cast(MediaType::kData)] = false; + have_pending_loads_[static_cast(AssetType::kData)] = false; } return total; } -auto Media::GetCollideModelPendingLoadCount() -> int { - if (!have_pending_loads_[static_cast(MediaType::kCollideModel)]) { +auto Assets::GetCollideModelPendingLoadCount() -> int { + if (!have_pending_loads_[static_cast(AssetType::kCollideModel)]) { return 0; } - MediaListsLock lock; + AssetListLock lock; int total = - GetComponentPendingLoadCount(&collide_models_, MediaType::kCollideModel); + GetComponentPendingLoadCount(&collide_models_, AssetType::kCollideModel); if (total == 0) { // When fully loaded, stop counting. - have_pending_loads_[static_cast(MediaType::kCollideModel)] = false; + have_pending_loads_[static_cast(AssetType::kCollideModel)] = false; } return total; } #pragma clang diagnostic pop -auto Media::GetGraphicalPendingLoadCount() -> int { - // Each of these calls lock the media-lists so we don't. +auto Assets::GetGraphicalPendingLoadCount() -> int { + // Each of these calls lock the asset-lists so we don't. return GetModelPendingLoadCount() + GetTexturePendingLoadCount(); } -auto Media::GetPendingLoadCount() -> int { - // Each of these calls lock the media-lists so we don't. +auto Assets::GetPendingLoadCount() -> int { + // Each of these calls lock the asset-lists so we don't. return GetModelPendingLoadCount() + GetTexturePendingLoadCount() + GetDataPendingLoadCount() + GetSoundPendingLoadCount() + GetCollideModelPendingLoadCount(); } template -auto Media::GetComponentPendingLoadCount( - std::unordered_map >* t_list, MediaType type) +auto Assets::GetComponentPendingLoadCount( + std::unordered_map >* t_list, AssetType type) -> int { assert(InLogicThread()); - assert(media_lists_locked_); + assert(asset_lists_locked_); int c = 0; for (auto&& i : (*t_list)) { if (i.second.exists()) { if (i.second->TryLock()) { - MediaComponentData::LockGuard lock( - i.second.get(), MediaComponentData::LockGuard::Type::kInheritLock); + AssetComponentData::LockGuard lock( + i.second.get(), AssetComponentData::LockGuard::Type::kInheritLock); if (!i.second->loaded()) { c++; } @@ -734,26 +735,26 @@ auto Media::GetComponentPendingLoadCount( } // Runs the pending loads that need to run from the audio thread. -auto Media::RunPendingAudioLoads() -> bool { +auto Assets::RunPendingAudioLoads() -> bool { assert(InAudioThread()); return RunPendingLoadList(&pending_loads_sounds_); } // Runs the pending loads that need to run from the graphics thread. -auto Media::RunPendingGraphicsLoads() -> bool { +auto Assets::RunPendingGraphicsLoads() -> bool { assert(InGraphicsThread()); return RunPendingLoadList(&pending_loads_graphics_); } // Runs the pending loads that run in the main thread. Also clears the list of // done loads. -auto Media::RunPendingLoadsLogicThread() -> bool { +auto Assets::RunPendingLoadsLogicThread() -> bool { assert(InLogicThread()); return RunPendingLoadList(&pending_loads_other_); } template -auto Media::RunPendingLoadList(std::vector*>* c_list) -> bool { +auto Assets::RunPendingLoadList(std::vector*>* c_list) -> bool { bool flush = false; millisecs_t starttime = GetRealTime(); @@ -830,31 +831,31 @@ auto Media::RunPendingLoadList(std::vector*>* c_list) -> bool { return (!l.empty()); } -void Media::Prune(int level) { +void Assets::Prune(int level) { assert(InLogicThread()); millisecs_t current_time = GetRealTime(); // need lists locked while accessing/modifying them - MediaListsLock lock; + AssetListLock lock; // we can specify level for more aggressive pruning (during memory warnings // and whatnot) - millisecs_t standard_media_prune_time = STANDARD_MEDIA_PRUNE_TIME; + millisecs_t standard_asset_prune_time = STANDARD_ASSET_PRUNE_TIME; millisecs_t text_texture_prune_time = TEXT_TEXTURE_PRUNE_TIME; millisecs_t qr_texture_prune_time = QR_TEXTURE_PRUNE_TIME; switch (level) { case 1: - standard_media_prune_time = 120000; // 2 min + standard_asset_prune_time = 120000; // 2 min text_texture_prune_time = 1000; // 1 sec qr_texture_prune_time = 1000; // 1 sec break; case 2: - standard_media_prune_time = 30000; // 30 sec + standard_asset_prune_time = 30000; // 30 sec text_texture_prune_time = 1000; // 1 sec qr_texture_prune_time = 1000; // 1 sec break; case 3: - standard_media_prune_time = 5000; // 5 sec + standard_asset_prune_time = 5000; // 5 sec text_texture_prune_time = 1000; // 1 sec qr_texture_prune_time = 1000; // 1 sec break; @@ -862,11 +863,11 @@ void Media::Prune(int level) { break; } - std::vector*> graphics_thread_unloads; - std::vector*> audio_thread_unloads; + std::vector*> graphics_thread_unloads; + std::vector*> audio_thread_unloads; #if SHOW_PRUNING_INFO - assert(media_lists_locked_); + assert(asset_lists_locked_); int old_texture_count = textures_.size(); int old_text_texture_count = text_textures_.size(); int old_qr_texture_count = qr_textures_.size(); @@ -876,13 +877,13 @@ void Media::Prune(int level) { #endif // SHOW_PRUNING_INFO // prune textures.. - assert(media_lists_locked_); + assert(asset_lists_locked_); for (auto i = textures_.begin(); i != textures_.end();) { TextureData* texture_data = i->second.get(); // attempt to prune if there are no references remaining except our own and // its been a while since it was used if (current_time - texture_data->last_used_time() - > standard_media_prune_time + > standard_asset_prune_time && (texture_data->object_strong_ref_count() <= 1)) { // if its preloaded/loaded we need to ask the graphics thread to unload it // first @@ -890,7 +891,7 @@ void Media::Prune(int level) { // allocate a reference to keep this texture_data alive while the unload // is happening graphics_thread_unloads.push_back( - new Object::Ref(texture_data)); + new Object::Ref(texture_data)); auto i_next = i; i_next++; textures_.erase(i); @@ -904,7 +905,7 @@ void Media::Prune(int level) { // prune text-textures more aggressively since we may generate lots of them // FIXME - we may want to prune based on total number of these instead of // time.. - assert(media_lists_locked_); + assert(asset_lists_locked_); for (auto i = text_textures_.begin(); i != text_textures_.end();) { TextureData* texture_data = i->second.get(); // attempt to prune if there are no references remaining except our own and @@ -917,7 +918,7 @@ void Media::Prune(int level) { // allocate a reference to keep this texture_data alive while the unload // is happening graphics_thread_unloads.push_back( - new Object::Ref(texture_data)); + new Object::Ref(texture_data)); auto i_next = i; i_next++; text_textures_.erase(i); @@ -929,7 +930,7 @@ void Media::Prune(int level) { } // prune textures - assert(media_lists_locked_); + assert(asset_lists_locked_); for (auto i = qr_textures_.begin(); i != qr_textures_.end();) { TextureData* texture_data = i->second.get(); // attempt to prune if there are no references remaining except our own and @@ -942,7 +943,7 @@ void Media::Prune(int level) { // allocate a reference to keep this texture_data alive while the unload // is happening graphics_thread_unloads.push_back( - new Object::Ref(texture_data)); + new Object::Ref(texture_data)); auto i_next = i; i_next++; qr_textures_.erase(i); @@ -954,12 +955,12 @@ void Media::Prune(int level) { } // prune models.. - assert(media_lists_locked_); + assert(asset_lists_locked_); for (auto i = models_.begin(); i != models_.end();) { ModelData* model_data = i->second.get(); // attempt to prune if there are no references remaining except our own and // its been a while since it was used - if (current_time - model_data->last_used_time() > standard_media_prune_time + if (current_time - model_data->last_used_time() > standard_asset_prune_time && (model_data->object_strong_ref_count() <= 1)) { // if its preloaded/loaded we need to ask the graphics thread to unload it // first @@ -967,7 +968,7 @@ void Media::Prune(int level) { // allocate a reference to keep this model_data alive while the unload // is happening graphics_thread_unloads.push_back( - new Object::Ref(model_data)); + new Object::Ref(model_data)); auto i_next = i; i_next++; models_.erase(i); @@ -979,14 +980,14 @@ void Media::Prune(int level) { } // Prune collide-models. - assert(media_lists_locked_); + assert(asset_lists_locked_); for (auto i = collide_models_.begin(); i != collide_models_.end();) { CollideModelData* collide_model_data = i->second.get(); // attempt to prune if there are no references remaining except our own and - // its been a while since it was used (unlike other media we never prune + // its been a while since it was used (unlike other assets we never prune // these if there's still references to them if (current_time - collide_model_data->last_used_time() - > standard_media_prune_time + > standard_asset_prune_time && (collide_model_data->object_strong_ref_count() <= 1)) { // we can unload it immediately since that happens in the game thread... collide_model_data->Unload(); @@ -1004,13 +1005,13 @@ void Media::Prune(int level) { // sounds are still in active use by OpenAL and ensure references exist for // them somewhere while that is the case if (explicit_bool(false)) { - assert(media_lists_locked_); + assert(asset_lists_locked_); for (auto i = sounds_.begin(); i != sounds_.end();) { SoundData* sound_data = i->second.get(); // Attempt to prune if there are no references remaining except our own // and its been a while since it was used. if (current_time - sound_data->last_used_time() - > standard_media_prune_time + > standard_asset_prune_time && (sound_data->object_strong_ref_count() <= 1)) { // If its preloaded/loaded we need to ask the graphics thread to unload // it first. @@ -1018,7 +1019,7 @@ void Media::Prune(int level) { // Allocate a reference to keep this sound_data alive while the unload // is happening. audio_thread_unloads.push_back( - new Object::Ref(sound_data)); + new Object::Ref(sound_data)); auto i_next = i; i_next++; sounds_.erase(i); @@ -1038,7 +1039,7 @@ void Media::Prune(int level) { } #if SHOW_PRUNING_INFO - assert(media_lists_locked_); + assert(asset_lists_locked_); if (textures_.size() != old_texture_count) { Log("Textures pruned from " + std::to_string(old_texture_count) + " to " + std::to_string(textures_.size())); @@ -1066,7 +1067,7 @@ void Media::Prune(int level) { #endif // SHOW_PRUNING_INFO } -auto Media::FindMediaFile(FileType type, const std::string& name) +auto Assets::FindAssetFile(FileType type, const std::string& name) -> std::string { std::string file_out; @@ -1136,9 +1137,9 @@ auto Media::FindMediaFile(FileType type, const std::string& name) break; } - const std::vector& media_paths_used = media_paths_; + const std::vector& asset_paths_used = asset_paths_; - for (auto&& i : media_paths_used) { + for (auto&& i : asset_paths_used) { struct BA_STAT stats {}; file_out = i + "/" + prefix + name + ext; // NOLINT int result; @@ -1163,26 +1164,26 @@ auto Media::FindMediaFile(FileType type, const std::string& name) // We wanna fail gracefully for some types. if (type == FileType::kSound && name != "blank") { Log("Unable to load audio: '" + name + "'; trying fallback..."); - return FindMediaFile(type, "blank"); + return FindAssetFile(type, "blank"); } else if (type == FileType::kTexture && name != "white") { Log("Unable to load texture: '" + name + "'; trying fallback..."); - return FindMediaFile(type, "white"); + return FindAssetFile(type, "white"); } - throw Exception("Can't find media: \"" + name + "\""); + throw Exception("Can't find asset: \"" + name + "\""); // return file_out; } -void Media::AddPendingLoad(Object::Ref* c) { - switch ((**c).GetMediaType()) { - case MediaType::kTexture: - case MediaType::kModel: { +void Assets::AddPendingLoad(Object::Ref* c) { + switch ((**c).GetAssetType()) { + case AssetType::kTexture: + case AssetType::kModel: { // Tell the graphics thread there's pending loads... std::scoped_lock lock(pending_load_list_mutex_); pending_loads_graphics_.push_back(c); break; } - case MediaType::kSound: { + case AssetType::kSound: { // Tell the audio thread there's pending loads. { std::scoped_lock lock(pending_load_list_mutex_); @@ -1203,7 +1204,7 @@ void Media::AddPendingLoad(Object::Ref* c) { } } -void Media::ClearPendingLoadsDoneList() { +void Assets::ClearPendingLoadsDoneList() { assert(InLogicThread()); std::scoped_lock lock(pending_load_list_mutex_); @@ -1213,13 +1214,13 @@ void Media::ClearPendingLoadsDoneList() { // We can now kill the reference knowing that it's safe for this component // to die at any time (anyone needing it to be alive now should be holding a // reference themselves). - for (Object::Ref* i : pending_loads_done_) { + for (Object::Ref* i : pending_loads_done_) { delete i; } pending_loads_done_.clear(); } -void Media::AddPackage(const std::string& name, const std::string& path) { +void Assets::AddPackage(const std::string& name, const std::string& path) { // we don't protect package-path access so make sure its always from here.. assert(InLogicThread()); #if BA_DEBUG_BUILD @@ -1230,18 +1231,18 @@ void Media::AddPackage(const std::string& name, const std::string& path) { packages_[name] = path; } -Media::MediaListsLock::MediaListsLock() { +Assets::AssetListLock::AssetListLock() { BA_DEBUG_FUNCTION_TIMER_BEGIN(); - g_media->media_lists_mutex_.lock(); - assert(!g_media->media_lists_locked_); - g_media->media_lists_locked_ = true; + g_assets->asset_lists_mutex_.lock(); + assert(!g_assets->asset_lists_locked_); + g_assets->asset_lists_locked_ = true; BA_DEBUG_FUNCTION_TIMER_END_THREAD(20); } -Media::MediaListsLock::~MediaListsLock() { - assert(g_media->media_lists_locked_); - g_media->media_lists_locked_ = false; - g_media->media_lists_mutex_.unlock(); +Assets::AssetListLock::~AssetListLock() { + assert(g_assets->asset_lists_locked_); + g_assets->asset_lists_locked_ = false; + g_assets->asset_lists_mutex_.unlock(); } } // namespace ballistica diff --git a/src/ballistica/media/media.h b/src/ballistica/assets/assets.h similarity index 75% rename from src/ballistica/media/media.h rename to src/ballistica/assets/assets.h index f9f1e7df..529d4856 100644 --- a/src/ballistica/media/media.h +++ b/src/ballistica/assets/assets.h @@ -1,7 +1,7 @@ // Released under the MIT License. See LICENSE for details. -#ifndef BALLISTICA_MEDIA_MEDIA_H_ -#define BALLISTICA_MEDIA_MEDIA_H_ +#ifndef BALLISTICA_ASSETS_ASSETS_H_ +#define BALLISTICA_ASSETS_ASSETS_H_ #include #include @@ -12,15 +12,15 @@ namespace ballistica { -/// Global media wrangling class. -class Media { +/// Global assets wrangling class. +class Assets { public: - Media(); + Assets(); - /// Handy function to try to return a bit of media from a std::unordered_map + /// Handy function to try to return an asset from a std::unordered_map /// of weak-refs, loading/adding it if need be. template - static auto GetMedia( + static auto GetAsset( std::unordered_map >* list, const std::string& name, Scene* scene) -> Object::Ref { assert(InLogicThread()); @@ -43,7 +43,7 @@ class Media { auto AddPackage(const std::string& name, const std::string& path) -> void; auto Prune(int level = 0) -> void; - /// Finish loading any media that has been preloaded but still needs to be + /// Finish loading any assets that have been preloaded but still need to be /// loaded by the proper thread. auto RunPendingLoadsLogicThread() -> bool; @@ -58,9 +58,9 @@ class Media { /// This function takes a newly allocated pointer which /// is deleted once the load is completed. - auto AddPendingLoad(Object::Ref* c) -> void; + auto AddPendingLoad(Object::Ref* c) -> void; enum class FileType { kModel, kCollisionModel, kTexture, kSound, kData }; - auto FindMediaFile(FileType fileType, const std::string& file_in) + auto FindAssetFile(FileType fileType, const std::string& file_in) -> std::string; /// Unload renderer-specific bits only (gl display lists, etc) - used when @@ -68,8 +68,8 @@ class Media { auto UnloadRendererBits(bool textures, bool models) -> void; /// Should be called from the game thread after UnloadRendererBits(); - /// kicks off bg loads for all existing unloaded media. - auto MarkAllMediaForLoad() -> void; + /// kicks off bg loads for all existing unloaded assets. + auto MarkAllAssetsForLoad() -> void; auto PrintLoadInfo() -> void; auto GetModelPendingLoadCount() -> int; @@ -85,13 +85,13 @@ class Media { auto GetPendingLoadCount() -> int; /// You must hold one of these locks while calling Get*Data() below. - class MediaListsLock { + class AssetListLock { public: - MediaListsLock(); - ~MediaListsLock(); + AssetListLock(); + ~AssetListLock(); }; - /// Load/cache media (make sure you hold a MediaListsLock). + /// Load/cache assets (make sure you hold a AssetListLock). auto GetTextureData(const std::string& file_name) -> Object::Ref; auto GetTextureData(TextPacker* packer) -> Object::Ref; auto GetTextureDataQRCode(const std::string& file_name) @@ -106,32 +106,32 @@ class Media { // Get system assets. auto GetTexture(SystemTextureID id) -> TextureData* { - BA_PRECONDITION_FATAL(system_media_loaded_); // Revert to assert later. + BA_PRECONDITION_FATAL(system_assets_loaded_); // Revert to assert later. assert(InLogicThread()); assert(static_cast(id) < system_textures_.size()); return system_textures_[static_cast(id)].get(); } auto GetCubeMapTexture(SystemCubeMapTextureID id) -> TextureData* { - BA_PRECONDITION_FATAL(system_media_loaded_); // Revert to assert later. + BA_PRECONDITION_FATAL(system_assets_loaded_); // Revert to assert later. assert(InLogicThread()); assert(static_cast(id) < system_cube_map_textures_.size()); return system_cube_map_textures_[static_cast(id)].get(); } auto GetSound(SystemSoundID id) -> SoundData* { - BA_PRECONDITION_FATAL(system_media_loaded_); // Revert to assert later. + BA_PRECONDITION_FATAL(system_assets_loaded_); // Revert to assert later. assert(InLogicThread()); assert(static_cast(id) < system_sounds_.size()); return system_sounds_[static_cast(id)].get(); } auto GetModel(SystemModelID id) -> ModelData* { - BA_PRECONDITION_FATAL(system_media_loaded_); // Revert to assert later. + BA_PRECONDITION_FATAL(system_assets_loaded_); // Revert to assert later. assert(InLogicThread()); assert(static_cast(id) < system_models_.size()); return system_models_[static_cast(id)].get(); } - /// Load up hard-coded media for interface, etc. - auto LoadSystemMedia() -> void; + /// Load up hard-coded assets for interface, etc. + auto LoadSystemAssets() -> void; auto total_model_count() const -> uint32_t { return static_cast(models_.size()); @@ -148,7 +148,7 @@ class Media { } private: - static auto MarkComponentForLoad(MediaComponentData* c) -> void; + static auto MarkComponentForLoad(AssetComponentData* c) -> void; auto LoadSystemTexture(SystemTextureID id, const char* name) -> void; auto LoadSystemCubeMapTexture(SystemCubeMapTextureID id, const char* name) -> void; @@ -158,7 +158,7 @@ class Media { template auto GetComponentPendingLoadCount( - std::unordered_map >* t_list, MediaType type) + std::unordered_map >* t_list, AssetType type) -> int; template @@ -167,26 +167,26 @@ class Media { std::unordered_map >* c_list) -> Object::Ref; - std::vector media_paths_; - bool have_pending_loads_[static_cast(MediaType::kLast)]{}; + std::vector asset_paths_; + bool have_pending_loads_[static_cast(AssetType::kLast)]{}; std::unordered_map packages_; - // For use by MediaListsLock; don't manually acquire - std::mutex media_lists_mutex_; + // For use by AssetListLock; don't manually acquire + std::mutex asset_lists_mutex_; - // Will be true while a MediaListsLock exists. Good to debug-verify this - // during any media list access. - bool media_lists_locked_{}; + // Will be true while a AssetListLock exists. Good to debug-verify this + // during any asset list access. + bool asset_lists_locked_{}; - // 'hard-wired' internal media - bool system_media_loaded_{}; + // 'hard-wired' internal assets + bool system_assets_loaded_{}; std::vector > system_textures_; std::vector > system_cube_map_textures_; std::vector > system_sounds_; std::vector > system_datas_; std::vector > system_models_; - // All existing media by filename (including internal). + // All existing assets by filename (including internal). std::unordered_map > textures_; std::unordered_map > text_textures_; std::unordered_map > qr_textures_; @@ -198,13 +198,13 @@ class Media { // Components that have been preloaded but need to be loaded. std::mutex pending_load_list_mutex_; - std::vector*> pending_loads_graphics_; - std::vector*> pending_loads_sounds_; - std::vector*> pending_loads_datas_; - std::vector*> pending_loads_other_; - std::vector*> pending_loads_done_; + std::vector*> pending_loads_graphics_; + std::vector*> pending_loads_sounds_; + std::vector*> pending_loads_datas_; + std::vector*> pending_loads_other_; + std::vector*> pending_loads_done_; }; } // namespace ballistica -#endif // BALLISTICA_MEDIA_MEDIA_H_ +#endif // BALLISTICA_ASSETS_ASSETS_H_ diff --git a/src/ballistica/media/media_server.cc b/src/ballistica/assets/assets_server.cc similarity index 88% rename from src/ballistica/media/media_server.cc rename to src/ballistica/assets/assets_server.cc index 5592b1b6..aba5b502 100644 --- a/src/ballistica/media/media_server.cc +++ b/src/ballistica/assets/assets_server.cc @@ -1,34 +1,34 @@ // Released under the MIT License. See LICENSE for details. -#include "ballistica/media/media_server.h" +#include "ballistica/assets/assets_server.h" +#include "ballistica/assets/assets.h" +#include "ballistica/assets/data/asset_component_data.h" #include "ballistica/core/thread.h" #include "ballistica/generic/huffman.h" #include "ballistica/generic/timer.h" #include "ballistica/generic/utils.h" #include "ballistica/graphics/graphics_server.h" -#include "ballistica/media/data/media_component_data.h" -#include "ballistica/media/media.h" namespace ballistica { -MediaServer::MediaServer(Thread* thread) +AssetsServer::AssetsServer(Thread* thread) : thread_(thread), writing_replay_(false), replay_message_bytes_(0), replays_broken_(false), replay_out_file_(nullptr) { - assert(g_media_server == nullptr); - g_media_server = this; + assert(g_assets_server == nullptr); + g_assets_server = this; // get our thread to give us periodic processing time... process_timer_ = this->thread()->NewTimer( 1000, true, NewLambdaRunnable([this] { Process(); })); } -MediaServer::~MediaServer() = default; +AssetsServer::~AssetsServer() = default; -void MediaServer::PushBeginWriteReplayCall() { +void AssetsServer::PushBeginWriteReplayCall() { thread()->PushCall([this] { if (replays_broken_) { return; @@ -37,7 +37,7 @@ void MediaServer::PushBeginWriteReplayCall() { // we only allow writing one replay at once; make sure that's actually the // case if (writing_replay_) { - Log("MediaServer got BeginWriteReplayCall while already writing"); + Log("AssetsServer got BeginWriteReplayCall while already writing"); WriteReplayMessages(); if (replay_out_file_) { fclose(replay_out_file_); @@ -75,11 +75,12 @@ void MediaServer::PushBeginWriteReplayCall() { // trigger our process timer to go off immediately // (we may need to wake it up) - g_media_server->process_timer_->SetLength(0); + g_assets_server->process_timer_->SetLength(0); }); } -void MediaServer::PushAddMessageToReplayCall(const std::vector& data) { +void AssetsServer::PushAddMessageToReplayCall( + const std::vector& data) { thread()->PushCall([this, data] { if (replays_broken_) { return; @@ -87,7 +88,7 @@ void MediaServer::PushAddMessageToReplayCall(const std::vector& data) { // sanity check.. if (!writing_replay_) { - Log("MediaServer got AddMessageToReplayCall while not writing replay"); + Log("AssetsServer got AddMessageToReplayCall while not writing replay"); replays_broken_ = true; return; } @@ -110,7 +111,7 @@ void MediaServer::PushAddMessageToReplayCall(const std::vector& data) { }); } -void MediaServer::PushEndWriteReplayCall() { +void AssetsServer::PushEndWriteReplayCall() { thread()->PushCall([this] { if (replays_broken_) { return; @@ -134,7 +135,7 @@ void MediaServer::PushEndWriteReplayCall() { }); } -void MediaServer::WriteReplayMessages() { +void AssetsServer::WriteReplayMessages() { if (replay_out_file_) { for (auto&& i : replay_messages_) { std::vector data_compressed = g_utils->huffman()->compress(i); @@ -194,10 +195,10 @@ void MediaServer::WriteReplayMessages() { } } -void MediaServer::Process() { +void AssetsServer::Process() { // make sure we don't do any loading until we know what kind/quality of // textures we'll be loading - if (!g_media || !g_graphics_server + if (!g_assets || !g_graphics_server || !g_graphics_server->texture_compression_types_are_set() // NOLINT || !g_graphics_server->texture_quality_set()) { return; @@ -209,12 +210,12 @@ void MediaServer::Process() { if (!pending_preloads_.empty()) { (**pending_preloads_.back()).Preload(); // pass the ref-pointer along to the load queue - g_media->AddPendingLoad(pending_preloads_.back()); + g_assets->AddPendingLoad(pending_preloads_.back()); pending_preloads_.pop_back(); } else if (!pending_preloads_audio_.empty()) { (**pending_preloads_audio_.back()).Preload(); // pass the ref-pointer along to the load queue - g_media->AddPendingLoad(pending_preloads_audio_.back()); + g_assets->AddPendingLoad(pending_preloads_audio_.back()); pending_preloads_audio_.pop_back(); } diff --git a/src/ballistica/media/media_server.h b/src/ballistica/assets/assets_server.h similarity index 67% rename from src/ballistica/media/media_server.h rename to src/ballistica/assets/assets_server.h index cff7007e..3c831129 100644 --- a/src/ballistica/media/media_server.h +++ b/src/ballistica/assets/assets_server.h @@ -1,7 +1,7 @@ // Released under the MIT License. See LICENSE for details. -#ifndef BALLISTICA_MEDIA_MEDIA_SERVER_H_ -#define BALLISTICA_MEDIA_MEDIA_SERVER_H_ +#ifndef BALLISTICA_ASSETS_ASSETS_SERVER_H_ +#define BALLISTICA_ASSETS_ASSETS_SERVER_H_ #include #include @@ -10,10 +10,10 @@ namespace ballistica { -class MediaServer { +class AssetsServer { public: - explicit MediaServer(Thread* thread); - ~MediaServer(); + explicit AssetsServer(Thread* thread); + ~AssetsServer(); void PushBeginWriteReplayCall(); void PushEndWriteReplayCall(); void PushAddMessageToReplayCall(const std::vector& data); @@ -30,12 +30,12 @@ class MediaServer { std::list > replay_messages_; size_t replay_message_bytes_{}; Timer* process_timer_{}; - std::vector*> pending_preloads_; - std::vector*> pending_preloads_audio_; + std::vector*> pending_preloads_; + std::vector*> pending_preloads_audio_; friend struct PreloadRunnable; - friend class Media; + friend class Assets; }; } // namespace ballistica -#endif // BALLISTICA_MEDIA_MEDIA_SERVER_H_ +#endif // BALLISTICA_ASSETS_ASSETS_SERVER_H_ diff --git a/src/ballistica/media/component/media_component.cc b/src/ballistica/assets/component/asset_component.cc similarity index 60% rename from src/ballistica/media/component/media_component.cc rename to src/ballistica/assets/component/asset_component.cc index 049aedf9..9e7ace5e 100644 --- a/src/ballistica/media/component/media_component.cc +++ b/src/ballistica/assets/component/asset_component.cc @@ -1,16 +1,16 @@ // Released under the MIT License. See LICENSE for details. -#include "ballistica/media/component/media_component.h" +#include "ballistica/assets/component/asset_component.h" #include "ballistica/python/python_sys.h" #include "ballistica/scene/scene.h" namespace ballistica { -MediaComponent::MediaComponent(std::string name, Scene* scene) +AssetComponent::AssetComponent(std::string name, Scene* scene) : name_(std::move(name)), scene_(scene) {} -auto MediaComponent::GetPyRef(bool new_ref) -> PyObject* { +auto AssetComponent::GetPyRef(bool new_ref) -> PyObject* { if (!py_object_) { // if we have no python object, create it py_object_ = CreatePyObject(); @@ -22,11 +22,11 @@ auto MediaComponent::GetPyRef(bool new_ref) -> PyObject* { return py_object_; } -auto MediaComponent::GetObjectDescription() const -> std::string { - return ""; +auto AssetComponent::GetObjectDescription() const -> std::string { + return ""; } -void MediaComponent::ClearPyObject() { +void AssetComponent::ClearPyObject() { assert(py_object_ != nullptr); py_object_ = nullptr; } diff --git a/src/ballistica/media/component/media_component.h b/src/ballistica/assets/component/asset_component.h similarity index 82% rename from src/ballistica/media/component/media_component.h rename to src/ballistica/assets/component/asset_component.h index 84887de1..335f39c0 100644 --- a/src/ballistica/media/component/media_component.h +++ b/src/ballistica/assets/component/asset_component.h @@ -1,7 +1,7 @@ // Released under the MIT License. See LICENSE for details. -#ifndef BALLISTICA_MEDIA_COMPONENT_MEDIA_COMPONENT_H_ -#define BALLISTICA_MEDIA_COMPONENT_MEDIA_COMPONENT_H_ +#ifndef BALLISTICA_ASSETS_COMPONENT_ASSET_COMPONENT_H_ +#define BALLISTICA_ASSETS_COMPONENT_ASSET_COMPONENT_H_ #include @@ -10,9 +10,9 @@ namespace ballistica { -class MediaComponent : public Object { +class AssetComponent : public Object { public: - MediaComponent(std::string name, Scene* scene); + AssetComponent(std::string name, Scene* scene); auto name() const -> std::string { return name_; } // Returns true if this texture was created in the UI context. @@ -41,7 +41,7 @@ class MediaComponent : public Object { } protected: - virtual auto GetMediaComponentTypeName() const -> std::string = 0; + virtual auto GetAssetComponentTypeName() const -> std::string = 0; // Create a python representation of this object. virtual auto CreatePyObject() -> PyObject* = 0; @@ -60,4 +60,4 @@ class MediaComponent : public Object { } // namespace ballistica -#endif // BALLISTICA_MEDIA_COMPONENT_MEDIA_COMPONENT_H_ +#endif // BALLISTICA_ASSETS_COMPONENT_ASSET_COMPONENT_H_ diff --git a/src/ballistica/media/component/collide_model.cc b/src/ballistica/assets/component/collide_model.cc similarity index 81% rename from src/ballistica/media/component/collide_model.cc rename to src/ballistica/assets/component/collide_model.cc index d24731b4..b86d5778 100644 --- a/src/ballistica/media/component/collide_model.cc +++ b/src/ballistica/assets/component/collide_model.cc @@ -1,6 +1,6 @@ // Released under the MIT License. See LICENSE for details. -#include "ballistica/media/component/collide_model.h" +#include "ballistica/assets/component/collide_model.h" #include "ballistica/game/game_stream.h" #include "ballistica/python/class/python_class_collide_model.h" @@ -9,7 +9,7 @@ namespace ballistica { CollideModel::CollideModel(const std::string& name, Scene* scene) - : MediaComponent(name, scene), dead_(false) { + : AssetComponent(name, scene), dead_(false) { assert(InLogicThread()); if (scene) { if (GameStream* os = scene->GetGameStream()) { @@ -17,8 +17,8 @@ CollideModel::CollideModel(const std::string& name, Scene* scene) } } { - Media::MediaListsLock lock; - collide_model_data_ = g_media->GetCollideModelData(name); + Assets::AssetListLock lock; + collide_model_data_ = g_assets->GetCollideModelData(name); } assert(collide_model_data_.exists()); } diff --git a/src/ballistica/media/component/collide_model.h b/src/ballistica/assets/component/collide_model.h similarity index 63% rename from src/ballistica/media/component/collide_model.h rename to src/ballistica/assets/component/collide_model.h index 7b8fa1e8..09671fa3 100644 --- a/src/ballistica/media/component/collide_model.h +++ b/src/ballistica/assets/component/collide_model.h @@ -1,18 +1,18 @@ // Released under the MIT License. See LICENSE for details. -#ifndef BALLISTICA_MEDIA_COMPONENT_COLLIDE_MODEL_H_ -#define BALLISTICA_MEDIA_COMPONENT_COLLIDE_MODEL_H_ +#ifndef BALLISTICA_ASSETS_COMPONENT_COLLIDE_MODEL_H_ +#define BALLISTICA_ASSETS_COMPONENT_COLLIDE_MODEL_H_ #include -#include "ballistica/media/component/media_component.h" -#include "ballistica/media/data/collide_model_data.h" -#include "ballistica/media/media.h" +#include "ballistica/assets/assets.h" +#include "ballistica/assets/component/asset_component.h" +#include "ballistica/assets/data/collide_model_data.h" namespace ballistica { // user-facing collide_model class -class CollideModel : public MediaComponent { +class CollideModel : public AssetComponent { public: CollideModel(const std::string& name, Scene* scene); ~CollideModel() override; @@ -23,7 +23,7 @@ class CollideModel : public MediaComponent { auto collide_model_data() const -> CollideModelData* { return collide_model_data_.get(); } - auto GetMediaComponentTypeName() const -> std::string override { + auto GetAssetComponentTypeName() const -> std::string override { return "CollideModel"; } void MarkDead(); @@ -38,4 +38,4 @@ class CollideModel : public MediaComponent { } // namespace ballistica -#endif // BALLISTICA_MEDIA_COMPONENT_COLLIDE_MODEL_H_ +#endif // BALLISTICA_ASSETS_COMPONENT_COLLIDE_MODEL_H_ diff --git a/src/ballistica/media/component/cube_map_texture.cc b/src/ballistica/assets/component/cube_map_texture.cc similarity index 59% rename from src/ballistica/media/component/cube_map_texture.cc rename to src/ballistica/assets/component/cube_map_texture.cc index 6116bf58..6af4d80b 100644 --- a/src/ballistica/media/component/cube_map_texture.cc +++ b/src/ballistica/assets/component/cube_map_texture.cc @@ -1,19 +1,19 @@ // Released under the MIT License. See LICENSE for details. -#include "ballistica/media/component/cube_map_texture.h" +#include "ballistica/assets/component/cube_map_texture.h" -#include "ballistica/media/media.h" +#include "ballistica/assets/assets.h" namespace ballistica { CubeMapTexture::CubeMapTexture(const std::string& name, Scene* scene) - : MediaComponent(name, scene) { + : AssetComponent(name, scene) { assert(InLogicThread()); // cant currently add these to scenes so nothing to do here.. { - Media::MediaListsLock lock; - texture_data_ = g_media->GetCubeMapTextureData(name); + Assets::AssetListLock lock; + texture_data_ = g_assets->GetCubeMapTextureData(name); } assert(texture_data_.exists()); } diff --git a/src/ballistica/media/component/cube_map_texture.h b/src/ballistica/assets/component/cube_map_texture.h similarity index 59% rename from src/ballistica/media/component/cube_map_texture.h rename to src/ballistica/assets/component/cube_map_texture.h index c72e4623..db5ed159 100644 --- a/src/ballistica/media/component/cube_map_texture.h +++ b/src/ballistica/assets/component/cube_map_texture.h @@ -1,17 +1,17 @@ // Released under the MIT License. See LICENSE for details. -#ifndef BALLISTICA_MEDIA_COMPONENT_CUBE_MAP_TEXTURE_H_ -#define BALLISTICA_MEDIA_COMPONENT_CUBE_MAP_TEXTURE_H_ +#ifndef BALLISTICA_ASSETS_COMPONENT_CUBE_MAP_TEXTURE_H_ +#define BALLISTICA_ASSETS_COMPONENT_CUBE_MAP_TEXTURE_H_ #include -#include "ballistica/media/component/media_component.h" -#include "ballistica/media/data/texture_data.h" +#include "ballistica/assets/component/asset_component.h" +#include "ballistica/assets/data/texture_data.h" namespace ballistica { // user-facing texture class -class CubeMapTexture : public MediaComponent { +class CubeMapTexture : public AssetComponent { public: CubeMapTexture(const std::string& name, Scene* s); @@ -19,7 +19,7 @@ class CubeMapTexture : public MediaComponent { // note that a texture's data can change over time as different // versions are spooled in/out/etc auto GetTextureData() const -> TextureData* { return texture_data_.get(); } - auto GetMediaComponentTypeName() const -> std::string override { + auto GetAssetComponentTypeName() const -> std::string override { return "CubeMapTexture"; } @@ -29,4 +29,4 @@ class CubeMapTexture : public MediaComponent { } // namespace ballistica -#endif // BALLISTICA_MEDIA_COMPONENT_CUBE_MAP_TEXTURE_H_ +#endif // BALLISTICA_ASSETS_COMPONENT_CUBE_MAP_TEXTURE_H_ diff --git a/src/ballistica/media/component/data.cc b/src/ballistica/assets/component/data.cc similarity index 81% rename from src/ballistica/media/component/data.cc rename to src/ballistica/assets/component/data.cc index cf3dec87..1f760ebb 100644 --- a/src/ballistica/media/component/data.cc +++ b/src/ballistica/assets/component/data.cc @@ -1,6 +1,6 @@ // Released under the MIT License. See LICENSE for details. -#include "ballistica/media/component/data.h" +#include "ballistica/assets/component/data.h" #include "ballistica/game/game_stream.h" #include "ballistica/python/class/python_class_data.h" @@ -9,7 +9,7 @@ namespace ballistica { Data::Data(const std::string& name, Scene* scene) - : MediaComponent(name, scene), dead_(false) { + : AssetComponent(name, scene), dead_(false) { assert(InLogicThread()); if (scene) { @@ -18,8 +18,8 @@ Data::Data(const std::string& name, Scene* scene) } } { - Media::MediaListsLock lock; - data_data_ = g_media->GetDataData(name); + Assets::AssetListLock lock; + data_data_ = g_assets->GetDataData(name); } assert(data_data_.exists()); } diff --git a/src/ballistica/media/component/data.h b/src/ballistica/assets/component/data.h similarity index 62% rename from src/ballistica/media/component/data.h rename to src/ballistica/assets/component/data.h index 30e926a2..fe3e917d 100644 --- a/src/ballistica/media/component/data.h +++ b/src/ballistica/assets/component/data.h @@ -1,22 +1,22 @@ // Released under the MIT License. See LICENSE for details. -#ifndef BALLISTICA_MEDIA_COMPONENT_DATA_H_ -#define BALLISTICA_MEDIA_COMPONENT_DATA_H_ +#ifndef BALLISTICA_ASSETS_COMPONENT_DATA_H_ +#define BALLISTICA_ASSETS_COMPONENT_DATA_H_ #include #include +#include "ballistica/assets/assets.h" +#include "ballistica/assets/component/asset_component.h" +#include "ballistica/assets/data/asset_component_data.h" +#include "ballistica/assets/data/data_data.h" #include "ballistica/ballistica.h" #include "ballistica/core/object.h" -#include "ballistica/media/component/media_component.h" -#include "ballistica/media/data/data_data.h" -#include "ballistica/media/data/media_component_data.h" -#include "ballistica/media/media.h" namespace ballistica { // user-facing data class -class Data : public MediaComponent { +class Data : public AssetComponent { public: Data(const std::string& name, Scene* scene); ~Data() override; @@ -25,7 +25,7 @@ class Data : public MediaComponent { // note that a data's data can change over time as different // versions are spooled in/out/etc. auto data_data() const -> DataData* { return data_data_.get(); } - auto GetMediaComponentTypeName() const -> std::string override { + auto GetAssetComponentTypeName() const -> std::string override { return "Data"; } void MarkDead(); @@ -40,4 +40,4 @@ class Data : public MediaComponent { } // namespace ballistica -#endif // BALLISTICA_MEDIA_COMPONENT_DATA_H_ +#endif // BALLISTICA_ASSETS_COMPONENT_DATA_H_ diff --git a/src/ballistica/media/component/model.cc b/src/ballistica/assets/component/model.cc similarity index 81% rename from src/ballistica/media/component/model.cc rename to src/ballistica/assets/component/model.cc index 77b60aef..88679733 100644 --- a/src/ballistica/media/component/model.cc +++ b/src/ballistica/assets/component/model.cc @@ -1,6 +1,6 @@ // Released under the MIT License. See LICENSE for details. -#include "ballistica/media/component/model.h" +#include "ballistica/assets/component/model.h" #include "ballistica/game/game_stream.h" #include "ballistica/python/class/python_class_model.h" @@ -9,7 +9,7 @@ namespace ballistica { Model::Model(const std::string& name, Scene* scene) - : MediaComponent(name, scene), dead_(false) { + : AssetComponent(name, scene), dead_(false) { assert(InLogicThread()); if (scene) { @@ -18,8 +18,8 @@ Model::Model(const std::string& name, Scene* scene) } } { - Media::MediaListsLock lock; - model_data_ = g_media->GetModelData(name); + Assets::AssetListLock lock; + model_data_ = g_assets->GetModelData(name); } assert(model_data_.exists()); } diff --git a/src/ballistica/media/component/model.h b/src/ballistica/assets/component/model.h similarity index 59% rename from src/ballistica/media/component/model.h rename to src/ballistica/assets/component/model.h index c7a8968b..239813a0 100644 --- a/src/ballistica/media/component/model.h +++ b/src/ballistica/assets/component/model.h @@ -1,23 +1,23 @@ // Released under the MIT License. See LICENSE for details. -#ifndef BALLISTICA_MEDIA_COMPONENT_MODEL_H_ -#define BALLISTICA_MEDIA_COMPONENT_MODEL_H_ +#ifndef BALLISTICA_ASSETS_COMPONENT_MODEL_H_ +#define BALLISTICA_ASSETS_COMPONENT_MODEL_H_ #include #include +#include "ballistica/assets/assets.h" +#include "ballistica/assets/component/asset_component.h" +#include "ballistica/assets/data/asset_component_data.h" +#include "ballistica/assets/data/model_data.h" +#include "ballistica/assets/data/model_renderer_data.h" #include "ballistica/ballistica.h" #include "ballistica/core/object.h" -#include "ballistica/media/component/media_component.h" -#include "ballistica/media/data/media_component_data.h" -#include "ballistica/media/data/model_data.h" -#include "ballistica/media/data/model_renderer_data.h" -#include "ballistica/media/media.h" namespace ballistica { // user-facing model class -class Model : public MediaComponent { +class Model : public AssetComponent { public: Model(const std::string& name, Scene* scene); ~Model() override; @@ -26,7 +26,7 @@ class Model : public MediaComponent { // note that a model's data can change over time as different // versions are spooled in/out/etc auto model_data() const -> ModelData* { return model_data_.get(); } - auto GetMediaComponentTypeName() const -> std::string override { + auto GetAssetComponentTypeName() const -> std::string override { return "Model"; } void MarkDead(); @@ -41,4 +41,4 @@ class Model : public MediaComponent { } // namespace ballistica -#endif // BALLISTICA_MEDIA_COMPONENT_MODEL_H_ +#endif // BALLISTICA_ASSETS_COMPONENT_MODEL_H_ diff --git a/src/ballistica/media/component/sound.cc b/src/ballistica/assets/component/sound.cc similarity index 75% rename from src/ballistica/media/component/sound.cc rename to src/ballistica/assets/component/sound.cc index babf5200..7f4962df 100644 --- a/src/ballistica/media/component/sound.cc +++ b/src/ballistica/assets/component/sound.cc @@ -1,17 +1,17 @@ // Released under the MIT License. See LICENSE for details. -#include "ballistica/media/component/sound.h" +#include "ballistica/assets/component/sound.h" +#include "ballistica/assets/assets.h" +#include "ballistica/assets/data/sound_data.h" #include "ballistica/game/game_stream.h" -#include "ballistica/media/data/sound_data.h" -#include "ballistica/media/media.h" #include "ballistica/python/class/python_class_sound.h" #include "ballistica/scene/scene.h" namespace ballistica { Sound::Sound(const std::string& name, Scene* scene) - : MediaComponent(name, scene) { + : AssetComponent(name, scene) { assert(InLogicThread()); if (scene) { if (GameStream* os = scene->GetGameStream()) { @@ -19,8 +19,8 @@ Sound::Sound(const std::string& name, Scene* scene) } } { - Media::MediaListsLock lock; - sound_data_ = g_media->GetSoundData(name); + Assets::AssetListLock lock; + sound_data_ = g_assets->GetSoundData(name); } assert(sound_data_.exists()); } diff --git a/src/ballistica/media/component/sound.h b/src/ballistica/assets/component/sound.h similarity index 68% rename from src/ballistica/media/component/sound.h rename to src/ballistica/assets/component/sound.h index e712cced..ff0295b7 100644 --- a/src/ballistica/media/component/sound.h +++ b/src/ballistica/assets/component/sound.h @@ -1,16 +1,16 @@ // Released under the MIT License. See LICENSE for details. -#ifndef BALLISTICA_MEDIA_COMPONENT_SOUND_H_ -#define BALLISTICA_MEDIA_COMPONENT_SOUND_H_ +#ifndef BALLISTICA_ASSETS_COMPONENT_SOUND_H_ +#define BALLISTICA_ASSETS_COMPONENT_SOUND_H_ #include #include -#include "ballistica/media/component/media_component.h" +#include "ballistica/assets/component/asset_component.h" namespace ballistica { -class Sound : public MediaComponent { +class Sound : public AssetComponent { public: Sound(const std::string& name, Scene* scene); ~Sound() override; @@ -19,7 +19,7 @@ class Sound : public MediaComponent { // Note that a sound's data can change over time as different // versions are spooled in/out/etc. auto GetSoundData() const -> SoundData* { return sound_data_.get(); } - auto GetMediaComponentTypeName() const -> std::string override { + auto GetAssetComponentTypeName() const -> std::string override { return "Sound"; } void MarkDead(); @@ -34,4 +34,4 @@ class Sound : public MediaComponent { } // namespace ballistica -#endif // BALLISTICA_MEDIA_COMPONENT_SOUND_H_ +#endif // BALLISTICA_ASSETS_COMPONENT_SOUND_H_ diff --git a/src/ballistica/media/component/texture.cc b/src/ballistica/assets/component/texture.cc similarity index 74% rename from src/ballistica/media/component/texture.cc rename to src/ballistica/assets/component/texture.cc index 6a8c31d0..4a350773 100644 --- a/src/ballistica/media/component/texture.cc +++ b/src/ballistica/assets/component/texture.cc @@ -1,6 +1,6 @@ // Released under the MIT License. See LICENSE for details. -#include "ballistica/media/component/texture.h" +#include "ballistica/assets/component/texture.h" #include "ballistica/game/game_stream.h" #include "ballistica/graphics/renderer.h" @@ -10,7 +10,7 @@ namespace ballistica { Texture::Texture(const std::string& name, Scene* scene) - : MediaComponent(name, scene), dead_(false) { + : AssetComponent(name, scene), dead_(false) { assert(InLogicThread()); // Add to the provided scene to get a numeric ID. @@ -20,18 +20,18 @@ Texture::Texture(const std::string& name, Scene* scene) } } { - Media::MediaListsLock lock; - texture_data_ = g_media->GetTextureData(name); + Assets::AssetListLock lock; + texture_data_ = g_assets->GetTextureData(name); } assert(texture_data_.exists()); } // qrcode version -Texture::Texture(const std::string& qr_url) : MediaComponent(qr_url, nullptr) { +Texture::Texture(const std::string& qr_url) : AssetComponent(qr_url, nullptr) { assert(InLogicThread()); { - Media::MediaListsLock lock; - texture_data_ = g_media->GetTextureDataQRCode(qr_url); + Assets::AssetListLock lock; + texture_data_ = g_assets->GetTextureDataQRCode(qr_url); } assert(texture_data_.exists()); } diff --git a/src/ballistica/media/component/texture.h b/src/ballistica/assets/component/texture.h similarity index 67% rename from src/ballistica/media/component/texture.h rename to src/ballistica/assets/component/texture.h index d03ed2e5..892767ee 100644 --- a/src/ballistica/media/component/texture.h +++ b/src/ballistica/assets/component/texture.h @@ -1,17 +1,17 @@ // Released under the MIT License. See LICENSE for details. -#ifndef BALLISTICA_MEDIA_COMPONENT_TEXTURE_H_ -#define BALLISTICA_MEDIA_COMPONENT_TEXTURE_H_ +#ifndef BALLISTICA_ASSETS_COMPONENT_TEXTURE_H_ +#define BALLISTICA_ASSETS_COMPONENT_TEXTURE_H_ #include -#include "ballistica/media/component/media_component.h" -#include "ballistica/media/data/texture_data.h" +#include "ballistica/assets/component/asset_component.h" +#include "ballistica/assets/data/texture_data.h" namespace ballistica { // User-facing texture class. -class Texture : public MediaComponent { +class Texture : public AssetComponent { public: Texture(const std::string& name, Scene* scene); explicit Texture(const std::string& qr_url); @@ -21,7 +21,7 @@ class Texture : public MediaComponent { // Note that a texture's data can change over time as different // versions are spooled in/out/etc. auto texture_data() const -> TextureData* { return texture_data_.get(); } - auto GetMediaComponentTypeName() const -> std::string override { + auto GetAssetComponentTypeName() const -> std::string override { return "Texture"; } void MarkDead(); @@ -36,4 +36,4 @@ class Texture : public MediaComponent { } // namespace ballistica -#endif // BALLISTICA_MEDIA_COMPONENT_TEXTURE_H_ +#endif // BALLISTICA_ASSETS_COMPONENT_TEXTURE_H_ diff --git a/src/ballistica/media/data/media_component_data.cc b/src/ballistica/assets/data/asset_component_data.cc similarity index 84% rename from src/ballistica/media/data/media_component_data.cc rename to src/ballistica/assets/data/asset_component_data.cc index ed5f79c6..bb7e96ed 100644 --- a/src/ballistica/media/data/media_component_data.cc +++ b/src/ballistica/assets/data/asset_component_data.cc @@ -1,25 +1,25 @@ // Released under the MIT License. See LICENSE for details. -#include "ballistica/media/data/media_component_data.h" +#include "ballistica/assets/data/asset_component_data.h" namespace ballistica { -MediaComponentData::MediaComponentData() { +AssetComponentData::AssetComponentData() { assert(InLogicThread()); - assert(g_media); + assert(g_assets); last_used_time_ = GetRealTime(); } -MediaComponentData::~MediaComponentData() { +AssetComponentData::~AssetComponentData() { // at the moment whoever owns the last reference to us // needs to make sure to unload us before we die.. // I feel like there should be a more elegant solution to that. - assert(g_media); + assert(g_assets); assert(!locked()); assert(!loaded()); } -void MediaComponentData::Preload(bool already_locked) { +void AssetComponentData::Preload(bool already_locked) { LockGuard lock(this, already_locked ? LockGuard::Type::kDontLock : LockGuard::Type::kLock); if (!preloaded_) { @@ -35,7 +35,7 @@ void MediaComponentData::Preload(bool already_locked) { } } -void MediaComponentData::Load(bool already_locked) { +void AssetComponentData::Load(bool already_locked) { LockGuard lock(this, already_locked ? LockGuard::Type::kDontLock : LockGuard::Type::kLock); if (!preloaded_) { @@ -57,7 +57,7 @@ void MediaComponentData::Load(bool already_locked) { } } -void MediaComponentData::Unload(bool already_locked) { +void AssetComponentData::Unload(bool already_locked) { LockGuard lock(this, already_locked ? LockGuard::Type::kDontLock : LockGuard::Type::kLock); @@ -80,7 +80,7 @@ void MediaComponentData::Unload(bool already_locked) { } } -MediaComponentData::LockGuard::LockGuard(MediaComponentData* data, Type type) +AssetComponentData::LockGuard::LockGuard(AssetComponentData* data, Type type) : data_(data) { switch (type) { case kLock: { @@ -100,7 +100,7 @@ MediaComponentData::LockGuard::LockGuard(MediaComponentData* data, Type type) } } -MediaComponentData::LockGuard::~LockGuard() { +AssetComponentData::LockGuard::~LockGuard() { if (holds_lock_) { data_->Unlock(); } diff --git a/src/ballistica/media/data/media_component_data.h b/src/ballistica/assets/data/asset_component_data.h similarity index 88% rename from src/ballistica/media/data/media_component_data.h rename to src/ballistica/assets/data/asset_component_data.h index 7ab99e25..4a2f91e8 100644 --- a/src/ballistica/media/data/media_component_data.h +++ b/src/ballistica/assets/data/asset_component_data.h @@ -1,7 +1,7 @@ // Released under the MIT License. See LICENSE for details. -#ifndef BALLISTICA_MEDIA_DATA_MEDIA_COMPONENT_DATA_H_ -#define BALLISTICA_MEDIA_DATA_MEDIA_COMPONENT_DATA_H_ +#ifndef BALLISTICA_ASSETS_DATA_ASSET_COMPONENT_DATA_H_ +#define BALLISTICA_ASSETS_DATA_ASSET_COMPONENT_DATA_H_ #include #include @@ -11,17 +11,17 @@ namespace ballistica { -/// Base class for loadable media components. -class MediaComponentData : public Object { +/// Base class for loadable asset components. +class AssetComponentData : public Object { public: - MediaComponentData(); - ~MediaComponentData() override; + AssetComponentData(); + ~AssetComponentData() override; void Preload(bool already_locked = false); void Load(bool already_locked = false); void Unload(bool already_locked = false); auto preloaded() const -> bool { return preloaded_; } auto loaded() const -> bool { return preloaded_ && loaded_; } - virtual auto GetMediaType() const -> MediaType = 0; + virtual auto GetAssetType() const -> AssetType = 0; // Return name or another identifier. For debugging purposes. virtual auto GetName() const -> std::string { return "invalid"; } @@ -35,14 +35,14 @@ class MediaComponentData : public Object { class LockGuard { public: enum Type { kLock, kInheritLock, kDontLock }; - explicit LockGuard(MediaComponentData* data, Type type = kLock); + explicit LockGuard(AssetComponentData* data, Type type = kLock); ~LockGuard(); // Does this guard hold a lock? auto holds_lock() const -> bool { return holds_lock_; } private: - MediaComponentData* data_ = nullptr; + AssetComponentData* data_ = nullptr; bool holds_lock_ = false; }; @@ -128,9 +128,9 @@ class MediaComponentData : public Object { bool preloaded_ = false; bool loaded_ = false; std::mutex mutex_; - BA_DISALLOW_CLASS_COPIES(MediaComponentData); + BA_DISALLOW_CLASS_COPIES(AssetComponentData); }; } // namespace ballistica -#endif // BALLISTICA_MEDIA_DATA_MEDIA_COMPONENT_DATA_H_ +#endif // BALLISTICA_ASSETS_DATA_ASSET_COMPONENT_DATA_H_ diff --git a/src/ballistica/media/data/collide_model_data.cc b/src/ballistica/assets/data/collide_model_data.cc similarity index 95% rename from src/ballistica/media/data/collide_model_data.cc rename to src/ballistica/assets/data/collide_model_data.cc index 6a19aeac..763a6d23 100644 --- a/src/ballistica/media/data/collide_model_data.cc +++ b/src/ballistica/assets/data/collide_model_data.cc @@ -1,15 +1,15 @@ // Released under the MIT License. See LICENSE for details. -#include "ballistica/media/data/collide_model_data.h" +#include "ballistica/assets/data/collide_model_data.h" -#include "ballistica/media/media.h" +#include "ballistica/assets/assets.h" namespace ballistica { CollideModelData::CollideModelData(const std::string& file_name_in) : file_name_(file_name_in) { file_name_full_ = - g_media->FindMediaFile(Media::FileType::kCollisionModel, file_name_in); + g_assets->FindAssetFile(Assets::FileType::kCollisionModel, file_name_in); valid_ = true; } diff --git a/src/ballistica/media/data/collide_model_data.h b/src/ballistica/assets/data/collide_model_data.h similarity index 71% rename from src/ballistica/media/data/collide_model_data.h rename to src/ballistica/assets/data/collide_model_data.h index 3e3223d3..0dba9bfd 100644 --- a/src/ballistica/media/data/collide_model_data.h +++ b/src/ballistica/assets/data/collide_model_data.h @@ -1,26 +1,26 @@ // Released under the MIT License. See LICENSE for details. -#ifndef BALLISTICA_MEDIA_DATA_COLLIDE_MODEL_DATA_H_ -#define BALLISTICA_MEDIA_DATA_COLLIDE_MODEL_DATA_H_ +#ifndef BALLISTICA_ASSETS_DATA_COLLIDE_MODEL_DATA_H_ +#define BALLISTICA_ASSETS_DATA_COLLIDE_MODEL_DATA_H_ #include #include -#include "ballistica/media/data/media_component_data.h" +#include "ballistica/assets/data/asset_component_data.h" #include "ode/ode.h" namespace ballistica { // Loadable model for collision detection. -class CollideModelData : public MediaComponentData { +class CollideModelData : public AssetComponentData { public: CollideModelData() = default; explicit CollideModelData(const std::string& file_name_in); void DoPreload() override; void DoLoad() override; void DoUnload() override; - auto GetMediaType() const -> MediaType override { - return MediaType::kCollideModel; + auto GetAssetType() const -> AssetType override { + return AssetType::kCollideModel; } auto GetName() const -> std::string override { if (!file_name_full_.empty()) { @@ -44,4 +44,4 @@ class CollideModelData : public MediaComponentData { } // namespace ballistica -#endif // BALLISTICA_MEDIA_DATA_COLLIDE_MODEL_DATA_H_ +#endif // BALLISTICA_ASSETS_DATA_COLLIDE_MODEL_DATA_H_ diff --git a/src/ballistica/media/data/data_data.cc b/src/ballistica/assets/data/data_data.cc similarity index 90% rename from src/ballistica/media/data/data_data.cc rename to src/ballistica/assets/data/data_data.cc index 360d0d14..770899e6 100644 --- a/src/ballistica/media/data/data_data.cc +++ b/src/ballistica/assets/data/data_data.cc @@ -1,8 +1,8 @@ // Released under the MIT License. See LICENSE for details. -#include "ballistica/media/data/data_data.h" +#include "ballistica/assets/data/data_data.h" -#include "ballistica/media/media.h" +#include "ballistica/assets/assets.h" #include "ballistica/python/python.h" #include "ballistica/python/python_sys.h" @@ -10,7 +10,7 @@ namespace ballistica { DataData::DataData(const std::string& file_name_in) : file_name_(file_name_in) { file_name_full_ = - g_media->FindMediaFile(Media::FileType::kData, file_name_in); + g_assets->FindAssetFile(Assets::FileType::kData, file_name_in); valid_ = true; } diff --git a/src/ballistica/media/data/data_data.h b/src/ballistica/assets/data/data_data.h similarity index 75% rename from src/ballistica/media/data/data_data.h rename to src/ballistica/assets/data/data_data.h index 11888623..57baa42b 100644 --- a/src/ballistica/media/data/data_data.h +++ b/src/ballistica/assets/data/data_data.h @@ -1,16 +1,16 @@ // Released under the MIT License. See LICENSE for details. -#ifndef BALLISTICA_MEDIA_DATA_DATA_DATA_H_ -#define BALLISTICA_MEDIA_DATA_DATA_DATA_H_ +#ifndef BALLISTICA_ASSETS_DATA_DATA_DATA_H_ +#define BALLISTICA_ASSETS_DATA_DATA_DATA_H_ #include -#include "ballistica/media/data/media_component_data.h" +#include "ballistica/assets/data/asset_component_data.h" #include "ballistica/python/python_ref.h" namespace ballistica { -class DataData : public MediaComponentData { +class DataData : public AssetComponentData { public: DataData() = default; explicit DataData(const std::string& file_name_in); @@ -19,7 +19,7 @@ class DataData : public MediaComponentData { void DoLoad() override; void DoUnload() override; - auto GetMediaType() const -> MediaType override { return MediaType::kData; } + auto GetAssetType() const -> AssetType override { return AssetType::kData; } auto GetName() const -> std::string override { if (!file_name_full_.empty()) { return file_name_full_; @@ -44,4 +44,4 @@ class DataData : public MediaComponentData { } // namespace ballistica -#endif // BALLISTICA_MEDIA_DATA_DATA_DATA_H_ +#endif // BALLISTICA_ASSETS_DATA_DATA_DATA_H_ diff --git a/src/ballistica/media/data/model_data.cc b/src/ballistica/assets/data/model_data.cc similarity index 96% rename from src/ballistica/media/data/model_data.cc rename to src/ballistica/assets/data/model_data.cc index 637e4153..48e2cf99 100644 --- a/src/ballistica/media/data/model_data.cc +++ b/src/ballistica/assets/data/model_data.cc @@ -1,6 +1,6 @@ // Released under the MIT License. See LICENSE for details. -#include "ballistica/media/data/model_data.h" +#include "ballistica/assets/data/model_data.h" #include "ballistica/graphics/graphics_server.h" #include "ballistica/graphics/renderer.h" @@ -10,7 +10,7 @@ namespace ballistica { ModelData::ModelData(const std::string& file_name_in) : file_name_(file_name_in) { file_name_full_ = - g_media->FindMediaFile(Media::FileType::kModel, file_name_in); + g_assets->FindAssetFile(Assets::FileType::kModel, file_name_in); valid_ = true; } diff --git a/src/ballistica/media/data/model_data.h b/src/ballistica/assets/data/model_data.h similarity index 81% rename from src/ballistica/media/data/model_data.h rename to src/ballistica/assets/data/model_data.h index cb155c6c..e5388922 100644 --- a/src/ballistica/media/data/model_data.h +++ b/src/ballistica/assets/data/model_data.h @@ -1,24 +1,24 @@ // Released under the MIT License. See LICENSE for details. -#ifndef BALLISTICA_MEDIA_DATA_MODEL_DATA_H_ -#define BALLISTICA_MEDIA_DATA_MODEL_DATA_H_ +#ifndef BALLISTICA_ASSETS_DATA_MODEL_DATA_H_ +#define BALLISTICA_ASSETS_DATA_MODEL_DATA_H_ #include #include -#include "ballistica/media/data/media_component_data.h" -#include "ballistica/media/data/model_renderer_data.h" +#include "ballistica/assets/data/asset_component_data.h" +#include "ballistica/assets/data/model_renderer_data.h" namespace ballistica { -class ModelData : public MediaComponentData { +class ModelData : public AssetComponentData { public: ModelData() = default; explicit ModelData(const std::string& file_name_in); void DoPreload() override; void DoLoad() override; void DoUnload() override; - auto GetMediaType() const -> MediaType override { return MediaType::kModel; } + auto GetAssetType() const -> AssetType override { return AssetType::kModel; } auto GetName() const -> std::string override { if (!file_name_full_.empty()) { return file_name_full_; @@ -64,4 +64,4 @@ class ModelData : public MediaComponentData { } // namespace ballistica -#endif // BALLISTICA_MEDIA_DATA_MODEL_DATA_H_ +#endif // BALLISTICA_ASSETS_DATA_MODEL_DATA_H_ diff --git a/src/ballistica/media/data/model_renderer_data.h b/src/ballistica/assets/data/model_renderer_data.h similarity index 70% rename from src/ballistica/media/data/model_renderer_data.h rename to src/ballistica/assets/data/model_renderer_data.h index ad23080a..d2ac255b 100644 --- a/src/ballistica/media/data/model_renderer_data.h +++ b/src/ballistica/assets/data/model_renderer_data.h @@ -1,7 +1,7 @@ // Released under the MIT License. See LICENSE for details. -#ifndef BALLISTICA_MEDIA_DATA_MODEL_RENDERER_DATA_H_ -#define BALLISTICA_MEDIA_DATA_MODEL_RENDERER_DATA_H_ +#ifndef BALLISTICA_ASSETS_DATA_MODEL_RENDERER_DATA_H_ +#define BALLISTICA_ASSETS_DATA_MODEL_RENDERER_DATA_H_ #include "ballistica/core/object.h" @@ -18,4 +18,4 @@ class ModelRendererData : public Object { } // namespace ballistica -#endif // BALLISTICA_MEDIA_DATA_MODEL_RENDERER_DATA_H_ +#endif // BALLISTICA_ASSETS_DATA_MODEL_RENDERER_DATA_H_ diff --git a/src/ballistica/media/data/sound_data.cc b/src/ballistica/assets/data/sound_data.cc similarity index 98% rename from src/ballistica/media/data/sound_data.cc rename to src/ballistica/assets/data/sound_data.cc index e5c2ab40..804b7fb9 100644 --- a/src/ballistica/media/data/sound_data.cc +++ b/src/ballistica/assets/data/sound_data.cc @@ -1,6 +1,6 @@ // Released under the MIT License. See LICENSE for details. -#include "ballistica/media/data/sound_data.h" +#include "ballistica/assets/data/sound_data.h" #if BA_ENABLE_AUDIO #if BA_USE_TREMOR_VORBIS @@ -10,8 +10,8 @@ #endif #endif // BA_ENABLE_AUDIO +#include "ballistica/assets/assets.h" #include "ballistica/audio/audio_server.h" -#include "ballistica/media/media.h" #include "ballistica/python/python.h" // Need to move away from OpenAL on Apple stuff. @@ -248,7 +248,7 @@ SoundData::SoundData(const std::string& file_name_in) #endif // BA_ENABLE_AUDIO last_play_time_(0) { file_name_full_ = - g_media->FindMediaFile(Media::FileType::kSound, file_name_in); + g_assets->FindAssetFile(Assets::FileType::kSound, file_name_in); valid_ = true; } diff --git a/src/ballistica/media/data/sound_data.h b/src/ballistica/assets/data/sound_data.h similarity index 82% rename from src/ballistica/media/data/sound_data.h rename to src/ballistica/assets/data/sound_data.h index f1bc3092..d24172de 100644 --- a/src/ballistica/media/data/sound_data.h +++ b/src/ballistica/assets/data/sound_data.h @@ -1,17 +1,17 @@ // Released under the MIT License. See LICENSE for details. -#ifndef BALLISTICA_MEDIA_DATA_SOUND_DATA_H_ -#define BALLISTICA_MEDIA_DATA_SOUND_DATA_H_ +#ifndef BALLISTICA_ASSETS_DATA_SOUND_DATA_H_ +#define BALLISTICA_ASSETS_DATA_SOUND_DATA_H_ #include #include +#include "ballistica/assets/data/asset_component_data.h" #include "ballistica/audio/al_sys.h" -#include "ballistica/media/data/media_component_data.h" namespace ballistica { -class SoundData : public MediaComponentData { +class SoundData : public AssetComponentData { public: SoundData() = default; explicit SoundData(const std::string& file_name_in); @@ -20,7 +20,7 @@ class SoundData : public MediaComponentData { // FIXME: Should make sure the sound_data isn't in use before unloading it. void DoUnload() override; - auto GetMediaType() const -> MediaType override { return MediaType::kSound; } + auto GetAssetType() const -> AssetType override { return AssetType::kSound; } auto GetName() const -> std::string override { if (!file_name_full_.empty()) return file_name_full_; @@ -55,4 +55,4 @@ class SoundData : public MediaComponentData { } // namespace ballistica -#endif // BALLISTICA_MEDIA_DATA_SOUND_DATA_H_ +#endif // BALLISTICA_ASSETS_DATA_SOUND_DATA_H_ diff --git a/src/ballistica/media/data/texture_data.cc b/src/ballistica/assets/data/texture_data.cc similarity index 98% rename from src/ballistica/media/data/texture_data.cc rename to src/ballistica/assets/data/texture_data.cc index d931abfd..11aa82f7 100644 --- a/src/ballistica/media/data/texture_data.cc +++ b/src/ballistica/assets/data/texture_data.cc @@ -1,7 +1,9 @@ // Released under the MIT License. See LICENSE for details. -#include "ballistica/media/data/texture_data.h" +#include "ballistica/assets/data/texture_data.h" +#include "ballistica/assets/data/texture_preload_data.h" +#include "ballistica/assets/data/texture_renderer_data.h" #include "ballistica/graphics/graphics.h" #include "ballistica/graphics/graphics_server.h" #include "ballistica/graphics/renderer.h" @@ -9,8 +11,6 @@ #include "ballistica/graphics/texture/dds.h" #include "ballistica/graphics/texture/ktx.h" #include "ballistica/graphics/texture/pvr.h" -#include "ballistica/media/data/texture_preload_data.h" -#include "ballistica/media/data/texture_renderer_data.h" #include "external/qr_code_generator/QrCode.hpp" namespace ballistica { @@ -43,7 +43,8 @@ TextureData::TextureData() = default; TextureData::TextureData(const std::string& file_in, TextureType type_in, TextureMinQuality min_quality_in) : file_name_(file_in), type_(type_in), min_quality_(min_quality_in) { - file_name_full_ = g_media->FindMediaFile(Media::FileType::kTexture, file_in); + file_name_full_ = + g_assets->FindAssetFile(Assets::FileType::kTexture, file_in); valid_ = true; } diff --git a/src/ballistica/media/data/texture_data.h b/src/ballistica/assets/data/texture_data.h similarity index 84% rename from src/ballistica/media/data/texture_data.h rename to src/ballistica/assets/data/texture_data.h index 1083f101..e1ce22db 100644 --- a/src/ballistica/media/data/texture_data.h +++ b/src/ballistica/assets/data/texture_data.h @@ -1,17 +1,17 @@ // Released under the MIT License. See LICENSE for details. -#ifndef BALLISTICA_MEDIA_DATA_TEXTURE_DATA_H_ -#define BALLISTICA_MEDIA_DATA_TEXTURE_DATA_H_ +#ifndef BALLISTICA_ASSETS_DATA_TEXTURE_DATA_H_ +#define BALLISTICA_ASSETS_DATA_TEXTURE_DATA_H_ #include #include -#include "ballistica/media/data/media_component_data.h" +#include "ballistica/assets/data/asset_component_data.h" namespace ballistica { // Loadable texture media component. -class TextureData : public MediaComponentData { +class TextureData : public AssetComponentData { public: TextureData(); ~TextureData() override; @@ -28,8 +28,8 @@ class TextureData : public MediaComponentData { auto GetNameFull() const -> std::string override { return file_name_full(); } auto file_name() const -> const std::string& { return file_name_; } auto file_name_full() const -> const std::string& { return file_name_full_; } - auto GetMediaType() const -> MediaType override { - return MediaType::kTexture; + auto GetAssetType() const -> AssetType override { + return AssetType::kTexture; } void DoPreload() override; void DoLoad() override; @@ -59,4 +59,4 @@ class TextureData : public MediaComponentData { } // namespace ballistica -#endif // BALLISTICA_MEDIA_DATA_TEXTURE_DATA_H_ +#endif // BALLISTICA_ASSETS_DATA_TEXTURE_DATA_H_ diff --git a/src/ballistica/media/data/texture_preload_data.cc b/src/ballistica/assets/data/texture_preload_data.cc similarity index 99% rename from src/ballistica/media/data/texture_preload_data.cc rename to src/ballistica/assets/data/texture_preload_data.cc index 3f54a7d4..eda797fa 100644 --- a/src/ballistica/media/data/texture_preload_data.cc +++ b/src/ballistica/assets/data/texture_preload_data.cc @@ -1,13 +1,13 @@ // Released under the MIT License. See LICENSE for details. -#include "ballistica/media/data/texture_preload_data.h" +#include "ballistica/assets/data/texture_preload_data.h" #if BA_OSTYPE_LINUX #include #endif +#include "ballistica/assets/component/texture.h" #include "ballistica/graphics/texture/ktx.h" -#include "ballistica/media/component/texture.h" namespace ballistica { diff --git a/src/ballistica/media/data/texture_preload_data.h b/src/ballistica/assets/data/texture_preload_data.h similarity index 86% rename from src/ballistica/media/data/texture_preload_data.h rename to src/ballistica/assets/data/texture_preload_data.h index db0454df..03c9d5c4 100644 --- a/src/ballistica/media/data/texture_preload_data.h +++ b/src/ballistica/assets/data/texture_preload_data.h @@ -1,7 +1,7 @@ // Released under the MIT License. See LICENSE for details. -#ifndef BALLISTICA_MEDIA_DATA_TEXTURE_PRELOAD_DATA_H_ -#define BALLISTICA_MEDIA_DATA_TEXTURE_PRELOAD_DATA_H_ +#ifndef BALLISTICA_ASSETS_DATA_TEXTURE_PRELOAD_DATA_H_ +#define BALLISTICA_ASSETS_DATA_TEXTURE_PRELOAD_DATA_H_ #include "ballistica/ballistica.h" @@ -37,4 +37,4 @@ class TexturePreloadData { } // namespace ballistica -#endif // BALLISTICA_MEDIA_DATA_TEXTURE_PRELOAD_DATA_H_ +#endif // BALLISTICA_ASSETS_DATA_TEXTURE_PRELOAD_DATA_H_ diff --git a/src/ballistica/media/data/texture_renderer_data.h b/src/ballistica/assets/data/texture_renderer_data.h similarity index 78% rename from src/ballistica/media/data/texture_renderer_data.h rename to src/ballistica/assets/data/texture_renderer_data.h index ca7a71de..2538132c 100644 --- a/src/ballistica/media/data/texture_renderer_data.h +++ b/src/ballistica/assets/data/texture_renderer_data.h @@ -1,7 +1,7 @@ // Released under the MIT License. See LICENSE for details. -#ifndef BALLISTICA_MEDIA_DATA_TEXTURE_RENDERER_DATA_H_ -#define BALLISTICA_MEDIA_DATA_TEXTURE_RENDERER_DATA_H_ +#ifndef BALLISTICA_ASSETS_DATA_TEXTURE_RENDERER_DATA_H_ +#define BALLISTICA_ASSETS_DATA_TEXTURE_RENDERER_DATA_H_ namespace ballistica { @@ -24,4 +24,4 @@ class TextureRendererData : public Object { } // namespace ballistica -#endif // BALLISTICA_MEDIA_DATA_TEXTURE_RENDERER_DATA_H_ +#endif // BALLISTICA_ASSETS_DATA_TEXTURE_RENDERER_DATA_H_ diff --git a/src/ballistica/audio/audio.cc b/src/ballistica/audio/audio.cc index 95238edc..09f43eb5 100644 --- a/src/ballistica/audio/audio.cc +++ b/src/ballistica/audio/audio.cc @@ -2,10 +2,10 @@ #include "ballistica/audio/audio.h" +#include "ballistica/assets/data/sound_data.h" #include "ballistica/audio/audio_server.h" #include "ballistica/audio/audio_source.h" #include "ballistica/core/thread.h" -#include "ballistica/media/data/sound_data.h" namespace ballistica { diff --git a/src/ballistica/audio/audio_server.cc b/src/ballistica/audio/audio_server.cc index 5e3f4727..6282e89a 100644 --- a/src/ballistica/audio/audio_server.cc +++ b/src/ballistica/audio/audio_server.cc @@ -3,6 +3,8 @@ #include "ballistica/audio/audio_server.h" #include "ballistica/app/app.h" +#include "ballistica/assets/assets.h" +#include "ballistica/assets/data/sound_data.h" #include "ballistica/audio/al_sys.h" #include "ballistica/audio/audio.h" #include "ballistica/audio/audio_source.h" @@ -12,8 +14,6 @@ #include "ballistica/game/game.h" #include "ballistica/generic/timer.h" #include "ballistica/math/vector3f.h" -#include "ballistica/media/data/sound_data.h" -#include "ballistica/media/media.h" // Need to move away from OpenAL on Apple stuff. #if __clang__ @@ -601,7 +601,7 @@ void AudioServer::Process() { // If we're paused we don't do nothin'. if (!paused_) { // Do some loading... - have_pending_loads_ = g_media->RunPendingAudioLoads(); + have_pending_loads_ = g_assets->RunPendingAudioLoads(); // Keep that available-sources list filled. UpdateAvailableSources(); @@ -666,7 +666,7 @@ void AudioServer::FadeSoundOut(uint32_t play_id, uint32_t time) { std::make_pair(play_id, SoundFadeNode(play_id, time, true))); } -void AudioServer::DeleteMediaComponent(MediaComponentData* c) { +void AudioServer::DeleteAssetComponent(AssetComponentData* c) { assert(InAudioThread()); c->Unload(); delete c; @@ -1033,7 +1033,7 @@ void AudioServer::ThreadSource::Stop() { // to free up... // (we can't kill media-refs outside the main thread) if (source_sound_) { - assert(g_media); + assert(g_assets); g_audio_server->AddSoundRefDelete(source_sound_); source_sound_ = nullptr; } @@ -1094,7 +1094,7 @@ void AudioServer::PushSetPausedCall(bool pause) { } void AudioServer::PushComponentUnloadCall( - const std::vector*>& components) { + const std::vector*>& components) { thread()->PushCall([this, components] { // Unload all components we were passed... for (auto&& i : components) { @@ -1102,7 +1102,7 @@ void AudioServer::PushComponentUnloadCall( } // ...and then ship these pointers back to the game thread, so it can free // the references. - g_game->PushFreeMediaComponentRefsCall(components); + g_game->PushFreeAssetComponentRefsCall(components); }); } diff --git a/src/ballistica/audio/audio_server.h b/src/ballistica/audio/audio_server.h index d747b98e..75abe5b0 100644 --- a/src/ballistica/audio/audio_server.h +++ b/src/ballistica/audio/audio_server.h @@ -37,7 +37,7 @@ class AudioServer { void PushResetCall(); void PushHavePendingLoadsCall(); void PushComponentUnloadCall( - const std::vector*>& components); + const std::vector*>& components); /// For use by g_game_module(). void ClearSoundRefDeleteList(); @@ -89,7 +89,7 @@ class AudioServer { void Process(); /// Send a component to the audio thread to delete. - void DeleteMediaComponent(MediaComponentData* c); + void DeleteAssetComponent(AssetComponentData* c); void UpdateTimerInterval(); void UpdateAvailableSources(); diff --git a/src/ballistica/audio/audio_source.cc b/src/ballistica/audio/audio_source.cc index 88c16257..492fd0ec 100644 --- a/src/ballistica/audio/audio_source.cc +++ b/src/ballistica/audio/audio_source.cc @@ -2,10 +2,10 @@ #include "ballistica/audio/audio_source.h" +#include "ballistica/assets/data/sound_data.h" #include "ballistica/audio/audio.h" #include "ballistica/audio/audio_server.h" #include "ballistica/math/vector3f.h" -#include "ballistica/media/data/sound_data.h" namespace ballistica { diff --git a/src/ballistica/ballistica.cc b/src/ballistica/ballistica.cc index 171ece0f..e0d92007 100644 --- a/src/ballistica/ballistica.cc +++ b/src/ballistica/ballistica.cc @@ -5,6 +5,8 @@ #include #include "ballistica/app/app_flavor.h" +#include "ballistica/assets/assets.h" +#include "ballistica/assets/assets_server.h" #include "ballistica/audio/audio_server.h" #include "ballistica/core/fatal_error.h" #include "ballistica/core/logging.h" @@ -13,8 +15,6 @@ #include "ballistica/game/v1_account.h" #include "ballistica/graphics/graphics_server.h" #include "ballistica/internal/app_internal.h" -#include "ballistica/media/media.h" -#include "ballistica/media/media_server.h" #include "ballistica/networking/network_writer.h" #include "ballistica/platform/platform.h" #include "ballistica/python/python.h" @@ -23,7 +23,7 @@ namespace ballistica { // These are set automatically via script; don't modify them here. -const int kAppBuildNumber = 20803; +const int kAppBuildNumber = 20806; const char* kAppVersion = "1.7.7"; // Our standalone globals. @@ -45,8 +45,8 @@ Graphics* g_graphics{}; GraphicsServer* g_graphics_server{}; Input* g_input{}; Thread* g_main_thread{}; -Media* g_media{}; -MediaServer* g_media_server{}; +Assets* g_assets{}; +AssetsServer* g_assets_server{}; NetworkReader* g_network_reader{}; Networking* g_networking{}; NetworkWriteModule* g_network_writer{}; @@ -65,12 +65,12 @@ Utils* g_utils{}; // This event kicks off an initial-screen-creation message sent to the // graphics-server thread. Other systems are informed that bootstrapping // is complete and that they are free to talk to each other. Initial -// input-devices are added, media loads can begin (at least ones not +// input-devices are added, asset loads can begin (at least ones not // dependent on the screen/renderer), etc. // 3: The initial screen is created on the graphics-server thread in response // to the message sent from the game thread. A completion notice is sent // back to the game thread when done. -// 4: Back on the game thread, any renderer-dependent media-loads/etc. can begin +// 4: Back on the game thread, any renderer-dependent asset-loads/etc. can begin // and lastly the initial game session is kicked off. auto BallisticaMain(int argc, char** argv) -> int { @@ -107,12 +107,12 @@ auto BallisticaMain(int argc, char** argv) -> int { // Various other subsystems. g_v1_account = new V1Account(); g_utils = new Utils(); - g_media = new Media(); + g_assets = new Assets(); Scene::Init(); // Spin up our other standard threads. - auto* media_thread{new Thread(ThreadIdentifier::kMedia)}; - g_app->pausable_threads.push_back(media_thread); + auto* assets_thread{new Thread(ThreadIdentifier::kAssets)}; + g_app->pausable_threads.push_back(assets_thread); auto* audio_thread{new Thread(ThreadIdentifier::kAudio)}; g_app->pausable_threads.push_back(audio_thread); auto* logic_thread{new Thread(ThreadIdentifier::kLogic)}; @@ -126,8 +126,8 @@ auto BallisticaMain(int argc, char** argv) -> int { network_write_thread->PushCallSynchronous([network_write_thread] { new NetworkWriteModule(network_write_thread); }); - media_thread->PushCallSynchronous( - [media_thread] { new MediaServer(media_thread); }); + assets_thread->PushCallSynchronous( + [assets_thread] { new AssetsServer(assets_thread); }); new GraphicsServer(g_main_thread); audio_thread->PushCallSynchronous( [audio_thread] { new AudioServer(audio_thread); }); @@ -277,8 +277,8 @@ auto InBGDynamicsThread() -> bool { return (g_bg_dynamics_server && g_bg_dynamics_server->thread()->IsCurrent()); } -auto InMediaThread() -> bool { - return (g_media_server && g_media_server->thread()->IsCurrent()); +auto InAssetsThread() -> bool { + return (g_assets_server && g_assets_server->thread()->IsCurrent()); } auto InNetworkWriteThread() -> bool { diff --git a/src/ballistica/ballistica.h b/src/ballistica/ballistica.h index 6b290d95..163a5fcf 100644 --- a/src/ballistica/ballistica.h +++ b/src/ballistica/ballistica.h @@ -118,8 +118,8 @@ extern Graphics* g_graphics; extern GraphicsServer* g_graphics_server; extern Input* g_input; extern Thread* g_main_thread; -extern Media* g_media; -extern MediaServer* g_media_server; +extern Assets* g_assets; +extern AssetsServer* g_assets_server; extern Networking* g_networking; extern NetworkReader* g_network_reader; extern NetworkWriteModule* g_network_writer; @@ -158,7 +158,7 @@ auto InGraphicsThread() -> bool; // (main and graphics are same currently) auto InLogicThread() -> bool; auto InAudioThread() -> bool; auto InBGDynamicsThread() -> bool; -auto InMediaThread() -> bool; +auto InAssetsThread() -> bool; auto InNetworkWriteThread() -> bool; /// Return a human-readable name for the current thread. diff --git a/src/ballistica/core/object.cc b/src/ballistica/core/object.cc index 15634bcf..26b77b8b 100644 --- a/src/ballistica/core/object.cc +++ b/src/ballistica/core/object.cc @@ -150,8 +150,8 @@ static auto GetCurrentThreadIdentifier() -> ThreadIdentifier { return ThreadIdentifier::kAudio; } else if (InNetworkWriteThread()) { return ThreadIdentifier::kNetworkWrite; - } else if (InMediaThread()) { - return ThreadIdentifier::kMedia; + } else if (InAssetsThread()) { + return ThreadIdentifier::kAssets; } else if (InBGDynamicsThread()) { return ThreadIdentifier::kBGDynamics; } else { @@ -209,9 +209,9 @@ auto Object::ObjectThreadCheck() -> void { DO_FAIL("NetworkWrite"); } break; - case ThreadIdentifier::kMedia: - if (!InMediaThread()) { - DO_FAIL("Media"); + case ThreadIdentifier::kAssets: + if (!InAssetsThread()) { + DO_FAIL("Assets"); } break; case ThreadIdentifier::kBGDynamics: diff --git a/src/ballistica/core/thread.cc b/src/ballistica/core/thread.cc index a5490b52..e23d1213 100644 --- a/src/ballistica/core/thread.cc +++ b/src/ballistica/core/thread.cc @@ -59,7 +59,7 @@ auto Thread::RunStdInputThread(void* data) -> int { return static_cast(data)->ThreadMain(); } -auto Thread::RunMediaThread(void* data) -> int { +auto Thread::RunAssetsThread(void* data) -> int { return static_cast(data)->ThreadMain(); } @@ -221,8 +221,8 @@ Thread::Thread(ThreadIdentifier identifier_in, ThreadType type_in) case ThreadIdentifier::kLogic: func = RunLogicThread; break; - case ThreadIdentifier::kMedia: - func = RunMediaThread; + case ThreadIdentifier::kAssets: + func = RunAssetsThread; break; case ThreadIdentifier::kMain: // Shouldn't happen; this thread gets wrapped; not launched. @@ -288,9 +288,9 @@ auto Thread::ThreadMain() -> int { name = "stdin"; id_string = "ballistica stdin"; break; - case ThreadIdentifier::kMedia: - name = "media"; - id_string = "ballistica media"; + case ThreadIdentifier::kAssets: + name = "assets"; + id_string = "ballistica assets"; break; case ThreadIdentifier::kFileOut: name = "fileout"; diff --git a/src/ballistica/core/thread.h b/src/ballistica/core/thread.h index 4feabd0d..cfc2f0d4 100644 --- a/src/ballistica/core/thread.h +++ b/src/ballistica/core/thread.h @@ -152,7 +152,7 @@ class Thread { static auto RunBGDynamicThread(void* data) -> int; static auto RunNetworkWriteThread(void* data) -> int; static auto RunStdInputThread(void* data) -> int; - static auto RunMediaThread(void* data) -> int; + static auto RunAssetsThread(void* data) -> int; auto ThreadMain() -> int; auto GetThreadMessages(std::list* messages) -> void; diff --git a/src/ballistica/core/types.h b/src/ballistica/core/types.h index 1143e129..b6d1d74d 100644 --- a/src/ballistica/core/types.h +++ b/src/ballistica/core/types.h @@ -39,6 +39,7 @@ class AppConfig; class App; class AppInternal; class AreaOfInterest; +class Assets; class Audio; class AudioServer; class AudioStreamer; @@ -102,9 +103,8 @@ class MaterialComponent; class MaterialConditionNode; class MaterialContext; class Matrix44f; -class Media; -class MediaComponentData; -class MediaServer; +class AssetComponentData; +class AssetsServer; class MeshBufferBase; class MeshBufferVertexSprite; class MeshBufferVertexSimpleFull; @@ -403,7 +403,7 @@ enum class SpecialChar { kLast // Sentinel }; -enum class MediaType { kTexture, kCollideModel, kModel, kSound, kData, kLast }; +enum class AssetType { kTexture, kCollideModel, kModel, kSound, kData, kLast }; /// Python exception types we can raise from our own exceptions. enum class PyExcType { @@ -999,7 +999,7 @@ enum class ThreadType { enum class ThreadIdentifier { kInvalid, kLogic, - kMedia, + kAssets, kFileOut, kMain, kAudio, diff --git a/src/ballistica/dynamics/bg/bg_dynamics.cc b/src/ballistica/dynamics/bg/bg_dynamics.cc index dacfbce6..7f6aad21 100644 --- a/src/ballistica/dynamics/bg/bg_dynamics.cc +++ b/src/ballistica/dynamics/bg/bg_dynamics.cc @@ -2,6 +2,7 @@ #include "ballistica/dynamics/bg/bg_dynamics.h" +#include "ballistica/assets/component/collide_model.h" #include "ballistica/core/thread.h" #include "ballistica/dynamics/bg/bg_dynamics_draw_snapshot.h" #include "ballistica/dynamics/bg/bg_dynamics_fuse_data.h" @@ -10,7 +11,6 @@ #include "ballistica/graphics/component/object_component.h" #include "ballistica/graphics/component/smoke_component.h" #include "ballistica/graphics/component/sprite_component.h" -#include "ballistica/media/component/collide_model.h" namespace ballistica { @@ -188,7 +188,7 @@ void BGDynamics::Draw(FrameDef* frame_def) { c.SetCameraAligned(true); c.SetColor(2.0f, 2.0f, 2.0f, 1.0f); c.SetOverlay(draw_in_overlay); - c.SetTexture(g_media->GetTexture(SystemTextureID::kSparks)); + c.SetTexture(g_assets->GetTexture(SystemTextureID::kSparks)); c.DrawMesh(sparks_mesh_.get(), kModelDrawFlagNoReflection); c.Submit(); } @@ -203,7 +203,7 @@ void BGDynamics::Draw(FrameDef* frame_def) { lights_mesh_->SetData( Object::Ref>(ds->light_vertices)); SpriteComponent c(frame_def->light_shadow_pass()); - c.SetTexture(g_media->GetTexture(SystemTextureID::kLightSoft)); + c.SetTexture(g_assets->GetTexture(SystemTextureID::kLightSoft)); c.DrawMesh(lights_mesh_.get()); c.Submit(); } @@ -216,7 +216,7 @@ void BGDynamics::Draw(FrameDef* frame_def) { shadows_mesh_->SetData( Object::Ref>(ds->shadow_vertices)); SpriteComponent c(frame_def->light_shadow_pass()); - c.SetTexture(g_media->GetTexture(SystemTextureID::kLight)); + c.SetTexture(g_assets->GetTexture(SystemTextureID::kLight)); c.DrawMesh(shadows_mesh_.get()); c.Submit(); } @@ -268,7 +268,7 @@ void BGDynamics::Draw(FrameDef* frame_def) { Object::Ref>(ds->fuse_vertices)); { // Draw! ObjectComponent c(frame_def->beauty_pass()); - c.SetTexture(g_media->GetTexture(SystemTextureID::kFuse)); + c.SetTexture(g_assets->GetTexture(SystemTextureID::kFuse)); c.DrawMesh(fuses_mesh_.get(), kModelDrawFlagNoReflection); c.Submit(); } @@ -286,16 +286,16 @@ void BGDynamics::DrawChunks(FrameDef* frame_def, ModelData* model; switch (chunk_type) { case BGDynamicsChunkType::kFlagStand: - model = g_media->GetModel(SystemModelID::kFlagStand); + model = g_assets->GetModel(SystemModelID::kFlagStand); break; case BGDynamicsChunkType::kSplinter: - model = g_media->GetModel(SystemModelID::kShrapnelBoard); + model = g_assets->GetModel(SystemModelID::kShrapnelBoard); break; case BGDynamicsChunkType::kSlime: - model = g_media->GetModel(SystemModelID::kShrapnelSlime); + model = g_assets->GetModel(SystemModelID::kShrapnelSlime); break; default: - model = g_media->GetModel(SystemModelID::kShrapnel1); + model = g_assets->GetModel(SystemModelID::kShrapnel1); break; } ObjectComponent c(frame_def->beauty_pass()); @@ -303,20 +303,20 @@ void BGDynamics::DrawChunks(FrameDef* frame_def, // Set up shading. switch (chunk_type) { case BGDynamicsChunkType::kRock: { - c.SetTexture(g_media->GetTexture(SystemTextureID::kShrapnel1)); + c.SetTexture(g_assets->GetTexture(SystemTextureID::kShrapnel1)); c.SetReflection(ReflectionType::kSoft); c.SetReflectionScale(0.2f, 0.2f, 0.2f); c.SetColor(0.6f, 0.6f, 0.5f); break; } case BGDynamicsChunkType::kIce: { - c.SetTexture(g_media->GetTexture(SystemTextureID::kShrapnel1)); + c.SetTexture(g_assets->GetTexture(SystemTextureID::kShrapnel1)); c.SetReflection(ReflectionType::kSharp); c.SetAddColor(0.5f, 0.5f, 0.9f); break; } case BGDynamicsChunkType::kSlime: { - c.SetTexture(g_media->GetTexture(SystemTextureID::kShrapnel1)); + c.SetTexture(g_assets->GetTexture(SystemTextureID::kShrapnel1)); c.SetReflection(ReflectionType::kSharper); c.SetReflectionScale(3.0f, 3.0f, 3.0f); c.SetColor(0.0f, 0.0f, 0.0f); @@ -324,13 +324,13 @@ void BGDynamics::DrawChunks(FrameDef* frame_def, break; } case BGDynamicsChunkType::kMetal: { - c.SetTexture(g_media->GetTexture(SystemTextureID::kShrapnel1)); + c.SetTexture(g_assets->GetTexture(SystemTextureID::kShrapnel1)); c.SetReflection(ReflectionType::kPowerup); c.SetColor(0.5f, 0.5f, 0.55f); break; } case BGDynamicsChunkType::kSpark: { - c.SetTexture(g_media->GetTexture(SystemTextureID::kShrapnel1)); + c.SetTexture(g_assets->GetTexture(SystemTextureID::kShrapnel1)); c.SetReflection(ReflectionType::kSharp); c.SetColor(0.0f, 0.0f, 0.0f, 1.0f); c.SetReflectionScale(4.0f, 3.0f, 2.0f); @@ -338,7 +338,7 @@ void BGDynamics::DrawChunks(FrameDef* frame_def, break; } case BGDynamicsChunkType::kSplinter: { - c.SetTexture(g_media->GetTexture(SystemTextureID::kShrapnel1)); + c.SetTexture(g_assets->GetTexture(SystemTextureID::kShrapnel1)); c.SetReflection(ReflectionType::kSoft); c.SetColor(1.0f, 0.8f, 0.5f); break; @@ -347,7 +347,7 @@ void BGDynamics::DrawChunks(FrameDef* frame_def, c.SetTransparent(true); c.SetPremultiplied(true); c.SetLightShadow(LightShadowType::kNone); - c.SetTexture(g_media->GetTexture(SystemTextureID::kShrapnel1)); + c.SetTexture(g_assets->GetTexture(SystemTextureID::kShrapnel1)); c.SetReflection(ReflectionType::kSharp); c.SetReflectionScale(0.5f, 0.4f, 0.3f); c.SetColor(0.2f, 0.15f, 0.15f, 0.07f); @@ -355,7 +355,7 @@ void BGDynamics::DrawChunks(FrameDef* frame_def, break; } case BGDynamicsChunkType::kFlagStand: { - c.SetTexture(g_media->GetTexture(SystemTextureID::kFlagPole)); + c.SetTexture(g_assets->GetTexture(SystemTextureID::kFlagPole)); c.SetReflection(ReflectionType::kSharp); c.SetColor(0.9f, 0.6f, 0.3f, 1.0f); break; diff --git a/src/ballistica/dynamics/bg/bg_dynamics_server.cc b/src/ballistica/dynamics/bg/bg_dynamics_server.cc index 427d0edd..6c959e77 100644 --- a/src/ballistica/dynamics/bg/bg_dynamics_server.cc +++ b/src/ballistica/dynamics/bg/bg_dynamics_server.cc @@ -2,6 +2,7 @@ #include "ballistica/dynamics/bg/bg_dynamics_server.h" +#include "ballistica/assets/component/collide_model.h" #include "ballistica/core/thread.h" #include "ballistica/dynamics/bg/bg_dynamics_draw_snapshot.h" #include "ballistica/dynamics/bg/bg_dynamics_fuse_data.h" @@ -12,7 +13,6 @@ #include "ballistica/game/game.h" #include "ballistica/generic/utils.h" #include "ballistica/graphics/graphics_server.h" -#include "ballistica/media/component/collide_model.h" namespace ballistica { diff --git a/src/ballistica/dynamics/collision_cache.cc b/src/ballistica/dynamics/collision_cache.cc index dc3306d1..5c9a6ead 100644 --- a/src/ballistica/dynamics/collision_cache.cc +++ b/src/ballistica/dynamics/collision_cache.cc @@ -36,7 +36,7 @@ void CollisionCache::Draw(FrameDef* frame_def) { c.Scale(x_max_ - x_min_, 1, z_max_ - z_min_); c.PushTransform(); c.Scale(1, 0.01f, 1); - c.DrawModel(g_media->GetModel(SystemModelID::kBox)); + c.DrawModel(g_assets->GetModel(SystemModelID::kBox)); c.PopTransform(); c.Translate(-0.5f + 0.5f * cell_width, 0, -0.5f + 0.5f * cell_height); for (int x = 0; x < grid_width_; x++) { @@ -53,7 +53,7 @@ void CollisionCache::Draw(FrameDef* frame_def) { cells_[cell_index].height_confirmed_collide_, static_cast(z) / static_cast(grid_height_)); c.Scale(0.95f * cell_width, 0.01f, 0.95f * cell_height); - c.DrawModel(g_media->GetModel(SystemModelID::kBox)); + c.DrawModel(g_assets->GetModel(SystemModelID::kBox)); c.PopTransform(); if (glow_[cell_index]) { c.SetColor(1, 1, 1, 0.2f); @@ -65,7 +65,7 @@ void CollisionCache::Draw(FrameDef* frame_def) { cells_[cell_index].height_confirmed_empty_, static_cast(z) / static_cast(grid_height_)); c.Scale(0.95f * cell_width, 0.01f, 0.95f * cell_height); - c.DrawModel(g_media->GetModel(SystemModelID::kBox)); + c.DrawModel(g_assets->GetModel(SystemModelID::kBox)); c.PopTransform(); glow_[cell_index] = 0; } @@ -84,7 +84,7 @@ void CollisionCache::Draw(FrameDef* frame_def) { c2.Scale(x_max_ - x_min_, 1, z_max_ - z_min_); c2.PushTransform(); c2.Scale(1, 0.01f, 1); - c2.DrawModel(g_media->GetModel(SystemModelID::kBox)); + c2.DrawModel(g_assets->GetModel(SystemModelID::kBox)); c2.PopTransform(); c2.Translate(-0.5f + 0.5f * cell_width2, 0, -0.5f + 0.5f * cell_height2); for (int x = 0; x < grid_width_; x++) { @@ -101,7 +101,7 @@ void CollisionCache::Draw(FrameDef* frame_def) { cells_[cell_index].height_confirmed_empty_, static_cast(z) / static_cast(grid_height_)); c2.Scale(0.95f * cell_width2, 0.01f, 0.95f * cell_height2); - c2.DrawModel(g_media->GetModel(SystemModelID::kBox)); + c2.DrawModel(g_assets->GetModel(SystemModelID::kBox)); c2.PopTransform(); if (glow_[cell_index]) { c2.SetColor(1, 1, 1, 0.2f); @@ -113,7 +113,7 @@ void CollisionCache::Draw(FrameDef* frame_def) { cells_[cell_index].height_confirmed_collide_, static_cast(z) / static_cast(grid_height_)); c2.Scale(0.95f * cell_width2, 0.01f, 0.95f * cell_height2); - c2.DrawModel(g_media->GetModel(SystemModelID::kBox)); + c2.DrawModel(g_assets->GetModel(SystemModelID::kBox)); c2.PopTransform(); glow_[cell_index] = 0; diff --git a/src/ballistica/dynamics/dynamics.cc b/src/ballistica/dynamics/dynamics.cc index 813f1814..c5e69ed9 100644 --- a/src/ballistica/dynamics/dynamics.cc +++ b/src/ballistica/dynamics/dynamics.cc @@ -2,6 +2,7 @@ #include "ballistica/dynamics/dynamics.h" +#include "ballistica/assets/component/sound.h" #include "ballistica/audio/audio.h" #include "ballistica/audio/audio_source.h" #include "ballistica/dynamics/collision.h" @@ -9,7 +10,6 @@ #include "ballistica/dynamics/material/material_action.h" #include "ballistica/dynamics/part.h" #include "ballistica/graphics/renderer.h" -#include "ballistica/media/component/sound.h" #include "ballistica/scene/scene.h" #include "ode/ode_collision_kernel.h" #include "ode/ode_collision_util.h" @@ -157,7 +157,7 @@ void Dynamics::Draw(FrameDef* frame_def) { c.PushTransform(); c.Translate(i.x(), i.y(), i.z()); c.scaleUniform(0.05f); - c.DrawModel(g_media->GetModel(Media::BOX_MODEL)); + c.DrawModel(g_assets->GetModel(Assets::BOX_MODEL)); c.PopTransform(); } c.Submit(); diff --git a/src/ballistica/dynamics/material/impact_sound_material_action.h b/src/ballistica/dynamics/material/impact_sound_material_action.h index b64368c9..f7d18f9f 100644 --- a/src/ballistica/dynamics/material/impact_sound_material_action.h +++ b/src/ballistica/dynamics/material/impact_sound_material_action.h @@ -5,9 +5,9 @@ #include +#include "ballistica/assets/component/sound.h" #include "ballistica/ballistica.h" #include "ballistica/dynamics/material/material_action.h" -#include "ballistica/media/component/sound.h" namespace ballistica { diff --git a/src/ballistica/dynamics/material/material_context.cc b/src/ballistica/dynamics/material/material_context.cc index 9f26a4f9..6d50a332 100644 --- a/src/ballistica/dynamics/material/material_context.cc +++ b/src/ballistica/dynamics/material/material_context.cc @@ -2,10 +2,10 @@ #include "ballistica/dynamics/material/material_context.h" +#include "ballistica/assets/component/sound.h" #include "ballistica/audio/audio.h" #include "ballistica/dynamics/dynamics.h" #include "ballistica/dynamics/material/material_action.h" -#include "ballistica/media/component/sound.h" #include "ballistica/scene/scene.h" namespace ballistica { diff --git a/src/ballistica/dynamics/material/roll_sound_material_action.cc b/src/ballistica/dynamics/material/roll_sound_material_action.cc index feffbaef..9d371db1 100644 --- a/src/ballistica/dynamics/material/roll_sound_material_action.cc +++ b/src/ballistica/dynamics/material/roll_sound_material_action.cc @@ -2,13 +2,13 @@ #include "ballistica/dynamics/material/roll_sound_material_action.h" +#include "ballistica/assets/component/sound.h" #include "ballistica/dynamics/dynamics.h" #include "ballistica/dynamics/material/material_context.h" #include "ballistica/game/game_stream.h" #include "ballistica/game/session/client_session.h" #include "ballistica/generic/utils.h" #include "ballistica/graphics/graphics_server.h" -#include "ballistica/media/component/sound.h" namespace ballistica { diff --git a/src/ballistica/dynamics/material/roll_sound_material_action.h b/src/ballistica/dynamics/material/roll_sound_material_action.h index 37716c92..691c9298 100644 --- a/src/ballistica/dynamics/material/roll_sound_material_action.h +++ b/src/ballistica/dynamics/material/roll_sound_material_action.h @@ -3,9 +3,9 @@ #ifndef BALLISTICA_DYNAMICS_MATERIAL_ROLL_SOUND_MATERIAL_ACTION_H_ #define BALLISTICA_DYNAMICS_MATERIAL_ROLL_SOUND_MATERIAL_ACTION_H_ +#include "ballistica/assets/component/sound.h" #include "ballistica/ballistica.h" #include "ballistica/dynamics/material/material_action.h" -#include "ballistica/media/component/sound.h" namespace ballistica { diff --git a/src/ballistica/dynamics/material/skid_sound_material_action.h b/src/ballistica/dynamics/material/skid_sound_material_action.h index 2179e426..3bfe9058 100644 --- a/src/ballistica/dynamics/material/skid_sound_material_action.h +++ b/src/ballistica/dynamics/material/skid_sound_material_action.h @@ -3,9 +3,9 @@ #ifndef BALLISTICA_DYNAMICS_MATERIAL_SKID_SOUND_MATERIAL_ACTION_H_ #define BALLISTICA_DYNAMICS_MATERIAL_SKID_SOUND_MATERIAL_ACTION_H_ +#include "ballistica/assets/component/sound.h" #include "ballistica/ballistica.h" #include "ballistica/dynamics/material/material_action.h" -#include "ballistica/media/component/sound.h" namespace ballistica { diff --git a/src/ballistica/dynamics/material/sound_material_action.h b/src/ballistica/dynamics/material/sound_material_action.h index ddd46745..8d7a0bc7 100644 --- a/src/ballistica/dynamics/material/sound_material_action.h +++ b/src/ballistica/dynamics/material/sound_material_action.h @@ -3,9 +3,9 @@ #ifndef BALLISTICA_DYNAMICS_MATERIAL_SOUND_MATERIAL_ACTION_H_ #define BALLISTICA_DYNAMICS_MATERIAL_SOUND_MATERIAL_ACTION_H_ +#include "ballistica/assets/component/sound.h" #include "ballistica/ballistica.h" #include "ballistica/dynamics/material/material_action.h" -#include "ballistica/media/component/sound.h" namespace ballistica { diff --git a/src/ballistica/dynamics/rigid_body.cc b/src/ballistica/dynamics/rigid_body.cc index 62ed4fc0..2bbf37f3 100644 --- a/src/ballistica/dynamics/rigid_body.cc +++ b/src/ballistica/dynamics/rigid_body.cc @@ -2,11 +2,11 @@ #include "ballistica/dynamics/rigid_body.h" +#include "ballistica/assets/component/collide_model.h" #include "ballistica/dynamics/dynamics.h" #include "ballistica/dynamics/part.h" #include "ballistica/generic/utils.h" #include "ballistica/graphics/renderer.h" -#include "ballistica/media/component/collide_model.h" #include "ballistica/scene/scene.h" #include "ode/ode_collision_util.h" diff --git a/src/ballistica/game/connection/connection_to_client.cc b/src/ballistica/game/connection/connection_to_client.cc index 05fb2b42..d98d0af1 100644 --- a/src/ballistica/game/connection/connection_to_client.cc +++ b/src/ballistica/game/connection/connection_to_client.cc @@ -2,6 +2,7 @@ #include "ballistica/game/connection/connection_to_client.h" +#include "ballistica/assets/assets.h" #include "ballistica/audio/audio.h" #include "ballistica/game/client_controller_interface.h" #include "ballistica/game/connection/connection_set.h" @@ -11,7 +12,6 @@ #include "ballistica/generic/json.h" #include "ballistica/input/device/client_input_device.h" #include "ballistica/internal/app_internal.h" -#include "ballistica/media/media.h" #include "ballistica/networking/networking.h" #include "ballistica/python/python.h" #include "ballistica/python/python_sys.h" @@ -73,7 +73,7 @@ ConnectionToClient::~ConnectionToClient() { std::string s = g_game->GetResourceString("playerLeftPartyText"); Utils::StringReplaceOne(&s, "${NAME}", peer_spec().GetDisplayString()); ScreenMessage(s, {1, 0.5f, 0.0f}); - g_audio->PlaySound(g_media->GetSound(SystemSoundID::kCorkPop)); + g_audio->PlaySound(g_assets->GetSound(SystemSoundID::kCorkPop)); } } @@ -215,7 +215,7 @@ void ConnectionToClient::HandleGamePacket(const std::vector& data) { Utils::StringReplaceOne(&s, "${NAME}", peer_spec().GetDisplayString()); ScreenMessage(s, {0.5f, 1, 0.5f}); - g_audio->PlaySound(g_media->GetSound(SystemSoundID::kGunCock)); + g_audio->PlaySound(g_assets->GetSound(SystemSoundID::kGunCock)); } // Also mark the time for flashing the 'someone just joined your diff --git a/src/ballistica/game/connection/connection_to_host.cc b/src/ballistica/game/connection/connection_to_host.cc index ac401990..371a0a81 100644 --- a/src/ballistica/game/connection/connection_to_host.cc +++ b/src/ballistica/game/connection/connection_to_host.cc @@ -2,6 +2,7 @@ #include "ballistica/game/connection/connection_to_host.h" +#include "ballistica/assets/assets.h" #include "ballistica/audio/audio.h" #include "ballistica/game/game.h" #include "ballistica/game/session/net_client_session.h" @@ -10,7 +11,6 @@ #include "ballistica/input/input.h" #include "ballistica/internal/app_internal.h" #include "ballistica/math/vector3f.h" -#include "ballistica/media/media.h" #include "ballistica/networking/networking.h" #include "ballistica/platform/platform.h" #include "ballistica/python/python.h" @@ -39,7 +39,7 @@ ConnectionToHost::~ConnectionToHost() { Utils::StringReplaceOne(&s, "${NAME}", peer_spec().GetDisplayString()); } ScreenMessage(s, {1, 0.5f, 0.0f}); - g_audio->PlaySound(g_media->GetSound(SystemSoundID::kCorkPop)); + g_audio->PlaySound(g_assets->GetSound(SystemSoundID::kCorkPop)); } else { ScreenMessage(g_game->GetResourceString("connectionRejectedText"), {1, 0, 0}); @@ -376,7 +376,7 @@ void ConnectionToHost::HandleMessagePacket(const std::vector& buffer) { Utils::StringReplaceOne( &s, "${NAME}", PlayerSpec(str_buffer.data()).GetDisplayString()); ScreenMessage(s, {0.5f, 1.0f, 0.5f}); - g_audio->PlaySound(g_media->GetSound(SystemSoundID::kGunCock)); + g_audio->PlaySound(g_assets->GetSound(SystemSoundID::kGunCock)); } break; } @@ -391,7 +391,7 @@ void ConnectionToHost::HandleMessagePacket(const std::vector& buffer) { Utils::StringReplaceOne( &s, "${NAME}", PlayerSpec(&(str_buffer[0])).GetDisplayString()); ScreenMessage(s, {1, 0.5f, 0.0f}); - g_audio->PlaySound(g_media->GetSound(SystemSoundID::kCorkPop)); + g_audio->PlaySound(g_assets->GetSound(SystemSoundID::kCorkPop)); } break; } @@ -486,7 +486,7 @@ void ConnectionToHost::HandleMessagePacket(const std::vector& buffer) { Utils::StringReplaceOne(&s, "${NAME}", peer_spec().GetDisplayString()); } ScreenMessage(s, {0.5f, 1, 0.5f}); - g_audio->PlaySound(g_media->GetSound(SystemSoundID::kGunCock)); + g_audio->PlaySound(g_assets->GetSound(SystemSoundID::kGunCock)); printed_connect_message_ = true; } diff --git a/src/ballistica/game/game.cc b/src/ballistica/game/game.cc index a5455895..07ac3ec9 100644 --- a/src/ballistica/game/game.cc +++ b/src/ballistica/game/game.cc @@ -262,7 +262,7 @@ void Game::PushVRHandsState(const VRHandsState& state) { void Game::PushMediaPruneCall(int level) { thread()->PushCall([level] { assert(InLogicThread()); - g_media->Prune(level); + g_assets->Prune(level); }); } @@ -288,7 +288,7 @@ void Game::InitialScreenCreated() { // We can now let the media thread go to town pre-loading system media // while we wait. - g_media->LoadSystemMedia(); + g_assets->LoadSystemAssets(); // FIXME: ideally we should create this as part of bootstrapping, but // we need it to be possible to load textures/etc. before the renderer @@ -315,7 +315,7 @@ void Game::InitialScreenCreated() { RunAppLaunchCommands(); } -void Game::PruneMedia() { g_media->Prune(); } +void Game::PruneMedia() { g_assets->Prune(); } // Launch into main menu or whatever else. void Game::RunAppLaunchCommands() { @@ -1188,7 +1188,8 @@ void Game::ScoresToBeatResponse(bool success, } void Game::PushPlaySoundCall(SystemSoundID sound) { - thread()->PushCall([sound] { g_audio->PlaySound(g_media->GetSound(sound)); }); + thread()->PushCall( + [sound] { g_audio->PlaySound(g_assets->GetSound(sound)); }); } void Game::PushFriendScoreSetCall(const FriendScoreSet& score_set) { @@ -1214,7 +1215,7 @@ void Game::PushConfirmQuitCall() { // this needs to be run in the UI context ScopedSetContext cp(GetUIContextTarget()); - g_audio->PlaySound(g_media->GetSound(SystemSoundID::kSwish)); + g_audio->PlaySound(g_assets->GetSound(SystemSoundID::kSwish)); g_python->obj(Python::ObjID::kQuitWindowCall).Call(); // if we have a keyboard, give it UI ownership @@ -1443,8 +1444,8 @@ void Game::PushRemoveGraphicsServerRenderHoldCall() { }); } -void Game::PushFreeMediaComponentRefsCall( - const std::vector*>& components) { +void Game::PushFreeAssetComponentRefsCall( + const std::vector*>& components) { thread()->PushCall([components] { for (auto&& i : components) { delete i; @@ -1453,7 +1454,7 @@ void Game::PushFreeMediaComponentRefsCall( } void Game::PushHavePendingLoadsDoneCall() { - thread()->PushCall([] { g_media->ClearPendingLoadsDoneList(); }); + thread()->PushCall([] { g_assets->ClearPendingLoadsDoneList(); }); } void Game::ToggleConsole() { @@ -1548,7 +1549,7 @@ void Game::SetRealTimerLength(int timer_id, millisecs_t length) { } void Game::Process() { - have_pending_loads_ = g_media->RunPendingLoadsLogicThread(); + have_pending_loads_ = g_assets->RunPendingLoadsLogicThread(); UpdateProcessTimer(); } @@ -1886,7 +1887,7 @@ void Game::LocalDisplayChatMessage(const std::vector& buffer) { g_python->HandleLocalChatMessage(final_message); } if (!chat_muted_) { - g_audio->PlaySound(g_media->GetSound(SystemSoundID::kTap)); + g_audio->PlaySound(g_assets->GetSound(SystemSoundID::kTap)); } } } diff --git a/src/ballistica/game/game.h b/src/ballistica/game/game.h index acd50155..226e451f 100644 --- a/src/ballistica/game/game.h +++ b/src/ballistica/game/game.h @@ -61,8 +61,8 @@ class Game { auto PushToggleDebugInfoDisplayCall() -> void; auto PushToggleManualCameraCall() -> void; auto PushHavePendingLoadsDoneCall() -> void; - auto PushFreeMediaComponentRefsCall( - const std::vector*>& components) -> void; + auto PushFreeAssetComponentRefsCall( + const std::vector*>& components) -> void; auto PushHavePendingLoadsCall() -> void; auto PushShutdownCall(bool soft) -> void; diff --git a/src/ballistica/game/game_stream.cc b/src/ballistica/game/game_stream.cc index 71beb4e3..4f2c7437 100644 --- a/src/ballistica/game/game_stream.cc +++ b/src/ballistica/game/game_stream.cc @@ -3,6 +3,12 @@ #include "ballistica/game/game_stream.h" #include "ballistica/app/app.h" +#include "ballistica/assets/assets_server.h" +#include "ballistica/assets/component/collide_model.h" +#include "ballistica/assets/component/data.h" +#include "ballistica/assets/component/model.h" +#include "ballistica/assets/component/sound.h" +#include "ballistica/assets/component/texture.h" #include "ballistica/dynamics/bg/bg_dynamics.h" #include "ballistica/dynamics/material/material.h" #include "ballistica/dynamics/material/material_action.h" @@ -12,12 +18,6 @@ #include "ballistica/game/connection/connection_set.h" #include "ballistica/game/connection/connection_to_client.h" #include "ballistica/game/session/host_session.h" -#include "ballistica/media/component/collide_model.h" -#include "ballistica/media/component/data.h" -#include "ballistica/media/component/model.h" -#include "ballistica/media/component/sound.h" -#include "ballistica/media/component/texture.h" -#include "ballistica/media/media_server.h" #include "ballistica/networking/networking.h" #include "ballistica/scene/node/node_attribute.h" #include "ballistica/scene/node/node_type.h" @@ -37,8 +37,8 @@ GameStream::GameStream(HostSession* host_session, bool save_replay) if (g_app->replay_open) { Log("ERROR: g_replay_open true at replay start; shouldn't happen."); } - assert(g_media_server); - g_media_server->PushBeginWriteReplayCall(); + assert(g_assets_server); + g_assets_server->PushBeginWriteReplayCall(); writing_replay_ = true; g_app->replay_open = true; } @@ -60,8 +60,8 @@ GameStream::~GameStream() { Log("ERROR: g_replay_open false at replay close; shouldn't happen."); } g_app->replay_open = false; - assert(g_media_server); - g_media_server->PushEndWriteReplayCall(); + assert(g_assets_server); + g_assets_server->PushEndWriteReplayCall(); writing_replay_ = false; } @@ -192,8 +192,8 @@ void GameStream::Fail() { if (!g_app->replay_open) { Log("ERROR: g_replay_open false at replay close; shouldn't happen."); } - assert(g_media_server); - g_media_server->PushEndWriteReplayCall(); + assert(g_assets_server); + g_assets_server->PushEndWriteReplayCall(); writing_replay_ = false; g_app->replay_open = false; } @@ -374,7 +374,7 @@ void GameStream::ShipSessionCommandsMessage() { void GameStream::AddMessageToReplay(const std::vector& message) { assert(writing_replay_); - assert(g_media_server); + assert(g_assets_server); assert(!message.empty()); if (g_buildconfig.debug_build()) { @@ -389,7 +389,7 @@ void GameStream::AddMessageToReplay(const std::vector& message) { } } - g_media_server->PushAddMessageToReplayCall(message); + g_assets_server->PushAddMessageToReplayCall(message); } void GameStream::SendPhysicsCorrection(bool blend) { diff --git a/src/ballistica/game/host_activity.cc b/src/ballistica/game/host_activity.cc index 3d097d7e..82a83bd0 100644 --- a/src/ballistica/game/host_activity.cc +++ b/src/ballistica/game/host_activity.cc @@ -2,6 +2,11 @@ #include "ballistica/game/host_activity.h" +#include "ballistica/assets/component/collide_model.h" +#include "ballistica/assets/component/data.h" +#include "ballistica/assets/component/model.h" +#include "ballistica/assets/component/sound.h" +#include "ballistica/assets/component/texture.h" #include "ballistica/dynamics/material/material.h" #include "ballistica/game/game_stream.h" #include "ballistica/game/player.h" @@ -9,11 +14,6 @@ #include "ballistica/generic/lambda_runnable.h" #include "ballistica/generic/timer.h" #include "ballistica/input/device/input_device.h" -#include "ballistica/media/component/collide_model.h" -#include "ballistica/media/component/data.h" -#include "ballistica/media/component/model.h" -#include "ballistica/media/component/sound.h" -#include "ballistica/media/component/texture.h" #include "ballistica/python/python.h" #include "ballistica/python/python_context_call.h" #include "ballistica/python/python_sys.h" @@ -183,28 +183,28 @@ auto HostActivity::GetTexture(const std::string& name) -> Object::Ref { if (shutting_down_) { throw Exception("can't load assets during activity shutdown"); } - return Media::GetMedia(&textures_, name, scene()); + return Assets::GetAsset(&textures_, name, scene()); } auto HostActivity::GetSound(const std::string& name) -> Object::Ref { if (shutting_down_) { throw Exception("can't load assets during activity shutdown"); } - return Media::GetMedia(&sounds_, name, scene()); + return Assets::GetAsset(&sounds_, name, scene()); } auto HostActivity::GetData(const std::string& name) -> Object::Ref { if (shutting_down_) { throw Exception("can't load assets during activity shutdown"); } - return Media::GetMedia(&datas_, name, scene()); + return Assets::GetAsset(&datas_, name, scene()); } auto HostActivity::GetModel(const std::string& name) -> Object::Ref { if (shutting_down_) { throw Exception("can't load assets during activity shutdown"); } - return Media::GetMedia(&models_, name, scene()); + return Assets::GetAsset(&models_, name, scene()); } auto HostActivity::GetCollideModel(const std::string& name) @@ -212,7 +212,7 @@ auto HostActivity::GetCollideModel(const std::string& name) if (shutting_down_) { throw Exception("can't load assets during activity shutdown"); } - return Media::GetMedia(&collide_models_, name, scene()); + return Assets::GetAsset(&collide_models_, name, scene()); } void HostActivity::SetPaused(bool val) { diff --git a/src/ballistica/game/session/client_session.cc b/src/ballistica/game/session/client_session.cc index 30453ffe..4cd0d1b6 100644 --- a/src/ballistica/game/session/client_session.cc +++ b/src/ballistica/game/session/client_session.cc @@ -3,6 +3,10 @@ #include "ballistica/game/session/client_session.h" #include "ballistica/app/app.h" +#include "ballistica/assets/component/collide_model.h" +#include "ballistica/assets/component/model.h" +#include "ballistica/assets/component/sound.h" +#include "ballistica/assets/component/texture.h" #include "ballistica/audio/audio.h" #include "ballistica/dynamics/bg/bg_dynamics.h" #include "ballistica/dynamics/material/material.h" @@ -12,10 +16,6 @@ #include "ballistica/dynamics/rigid_body.h" #include "ballistica/game/game_stream.h" #include "ballistica/graphics/graphics.h" -#include "ballistica/media/component/collide_model.h" -#include "ballistica/media/component/model.h" -#include "ballistica/media/component/sound.h" -#include "ballistica/media/component/texture.h" #include "ballistica/networking/networking.h" #include "ballistica/python/python.h" #include "ballistica/scene/node/node_attribute.h" diff --git a/src/ballistica/game/session/host_session.cc b/src/ballistica/game/session/host_session.cc index b3dfa82b..21035c87 100644 --- a/src/ballistica/game/session/host_session.cc +++ b/src/ballistica/game/session/host_session.cc @@ -2,6 +2,10 @@ #include "ballistica/game/session/host_session.h" +#include "ballistica/assets/component/data.h" +#include "ballistica/assets/component/model.h" +#include "ballistica/assets/component/sound.h" +#include "ballistica/assets/component/texture.h" #include "ballistica/game/game_stream.h" #include "ballistica/game/host_activity.h" #include "ballistica/game/player.h" @@ -9,10 +13,6 @@ #include "ballistica/generic/timer.h" #include "ballistica/graphics/graphics.h" #include "ballistica/input/device/input_device.h" -#include "ballistica/media/component/data.h" -#include "ballistica/media/component/model.h" -#include "ballistica/media/component/sound.h" -#include "ballistica/media/component/texture.h" #include "ballistica/python/python.h" #include "ballistica/python/python_command.h" #include "ballistica/python/python_context_call.h" @@ -206,27 +206,27 @@ auto HostSession::GetSound(const std::string& name) -> Object::Ref { if (shutting_down_) { throw Exception("can't load assets during session shutdown"); } - return Media::GetMedia(&sounds_, name, scene()); + return Assets::GetAsset(&sounds_, name, scene()); } auto HostSession::GetData(const std::string& name) -> Object::Ref { if (shutting_down_) { throw Exception("can't load assets during session shutdown"); } - return Media::GetMedia(&datas_, name, scene()); + return Assets::GetAsset(&datas_, name, scene()); } auto HostSession::GetTexture(const std::string& name) -> Object::Ref { if (shutting_down_) { throw Exception("can't load assets during session shutdown"); } - return Media::GetMedia(&textures_, name, scene()); + return Assets::GetAsset(&textures_, name, scene()); } auto HostSession::GetModel(const std::string& name) -> Object::Ref { if (shutting_down_) { throw Exception("can't load media during session shutdown"); } - return Media::GetMedia(&models_, name, scene()); + return Assets::GetAsset(&models_, name, scene()); } auto HostSession::GetForegroundContext() -> Context { diff --git a/src/ballistica/game/session/net_client_session.cc b/src/ballistica/game/session/net_client_session.cc index 477d1c89..4826a057 100644 --- a/src/ballistica/game/session/net_client_session.cc +++ b/src/ballistica/game/session/net_client_session.cc @@ -3,10 +3,10 @@ #include "ballistica/game/session/net_client_session.h" #include "ballistica/app/app.h" +#include "ballistica/assets/assets_server.h" #include "ballistica/game/connection/connection_to_host.h" #include "ballistica/graphics/graphics.h" #include "ballistica/graphics/net_graph.h" -#include "ballistica/media/media_server.h" namespace ballistica { @@ -15,8 +15,8 @@ NetClientSession::NetClientSession() { if (g_app->replay_open) { Log("ERROR: g_replay_open true at netclient start; shouldn't happen."); } - assert(g_media_server); - g_media_server->PushBeginWriteReplayCall(); + assert(g_assets_server); + g_assets_server->PushBeginWriteReplayCall(); writing_replay_ = true; g_app->replay_open = true; } @@ -28,8 +28,8 @@ NetClientSession::~NetClientSession() { Log("ERROR: g_replay_open false at net-client close; shouldn't happen."); } g_app->replay_open = false; - assert(g_media_server); - g_media_server->PushEndWriteReplayCall(); + assert(g_assets_server); + g_assets_server->PushEndWriteReplayCall(); writing_replay_ = false; } } @@ -192,8 +192,8 @@ void NetClientSession::HandleSessionMessage( ClientSession::HandleSessionMessage(message); if (writing_replay_) { - assert(g_media_server); - g_media_server->PushAddMessageToReplayCall(message); + assert(g_assets_server); + g_assets_server->PushAddMessageToReplayCall(message); } } diff --git a/src/ballistica/graphics/component/object_component.cc b/src/ballistica/graphics/component/object_component.cc index 0058b61c..e8d1a6bd 100644 --- a/src/ballistica/graphics/component/object_component.cc +++ b/src/ballistica/graphics/component/object_component.cc @@ -9,7 +9,7 @@ void ObjectComponent::WriteConfig() { // This is not a common case and easier than forking all our shaders to // create non-textured versions. if (!texture_.exists()) { - texture_ = g_media->GetTexture(SystemTextureID::kWhite); + texture_ = g_assets->GetTexture(SystemTextureID::kWhite); } if (reflection_ == ReflectionType::kNone) { assert(!double_sided_); // Unsupported combo. @@ -58,7 +58,7 @@ void ObjectComponent::WriteConfig() { cmd_buffer_->PutTexture(texture_); SystemCubeMapTextureID r = Graphics::CubeMapFromReflectionType(reflection_); - cmd_buffer_->PutCubeMapTexture(g_media->GetCubeMapTexture(r)); + cmd_buffer_->PutCubeMapTexture(g_assets->GetCubeMapTexture(r)); } else { ConfigForShading(ShadingType::kObjectReflectTransparent); cmd_buffer_->PutInt(premultiplied_); @@ -68,7 +68,7 @@ void ObjectComponent::WriteConfig() { cmd_buffer_->PutTexture(texture_); SystemCubeMapTextureID r = Graphics::CubeMapFromReflectionType(reflection_); - cmd_buffer_->PutCubeMapTexture(g_media->GetCubeMapTexture(r)); + cmd_buffer_->PutCubeMapTexture(g_assets->GetCubeMapTexture(r)); } } else { ConfigForShading(ShadingType::kObjectReflect); @@ -79,7 +79,7 @@ void ObjectComponent::WriteConfig() { cmd_buffer_->PutTexture(texture_); SystemCubeMapTextureID r = Graphics::CubeMapFromReflectionType(reflection_); - cmd_buffer_->PutCubeMapTexture(g_media->GetCubeMapTexture(r)); + cmd_buffer_->PutCubeMapTexture(g_assets->GetCubeMapTexture(r)); } } else { // With add. @@ -100,7 +100,7 @@ void ObjectComponent::WriteConfig() { cmd_buffer_->PutTexture(colorize_texture_); SystemCubeMapTextureID r = Graphics::CubeMapFromReflectionType(reflection_); - cmd_buffer_->PutCubeMapTexture(g_media->GetCubeMapTexture(r)); + cmd_buffer_->PutCubeMapTexture(g_assets->GetCubeMapTexture(r)); } else { ConfigForShading(ShadingType::kObjectReflectLightShadowColorized); cmd_buffer_->PutInt(static_cast(light_shadow_)); @@ -112,7 +112,7 @@ void ObjectComponent::WriteConfig() { cmd_buffer_->PutTexture(colorize_texture_); SystemCubeMapTextureID r = Graphics::CubeMapFromReflectionType(reflection_); - cmd_buffer_->PutCubeMapTexture(g_media->GetCubeMapTexture(r)); + cmd_buffer_->PutCubeMapTexture(g_assets->GetCubeMapTexture(r)); } } else { if (double_sided_) { @@ -125,7 +125,7 @@ void ObjectComponent::WriteConfig() { cmd_buffer_->PutTexture(texture_); SystemCubeMapTextureID r = Graphics::CubeMapFromReflectionType(reflection_); - cmd_buffer_->PutCubeMapTexture(g_media->GetCubeMapTexture(r)); + cmd_buffer_->PutCubeMapTexture(g_assets->GetCubeMapTexture(r)); } else { ConfigForShading(ShadingType::kObjectReflectLightShadow); cmd_buffer_->PutInt(static_cast(light_shadow_)); @@ -136,7 +136,7 @@ void ObjectComponent::WriteConfig() { cmd_buffer_->PutTexture(texture_); SystemCubeMapTextureID r = Graphics::CubeMapFromReflectionType(reflection_); - cmd_buffer_->PutCubeMapTexture(g_media->GetCubeMapTexture(r)); + cmd_buffer_->PutCubeMapTexture(g_assets->GetCubeMapTexture(r)); } } } else { @@ -157,7 +157,7 @@ void ObjectComponent::WriteConfig() { cmd_buffer_->PutTexture(colorize_texture_); SystemCubeMapTextureID r = Graphics::CubeMapFromReflectionType(reflection_); - cmd_buffer_->PutCubeMapTexture(g_media->GetCubeMapTexture(r)); + cmd_buffer_->PutCubeMapTexture(g_assets->GetCubeMapTexture(r)); } else { ConfigForShading( ShadingType::kObjectReflectLightShadowAddColorized); @@ -171,7 +171,7 @@ void ObjectComponent::WriteConfig() { cmd_buffer_->PutTexture(colorize_texture_); SystemCubeMapTextureID r = Graphics::CubeMapFromReflectionType(reflection_); - cmd_buffer_->PutCubeMapTexture(g_media->GetCubeMapTexture(r)); + cmd_buffer_->PutCubeMapTexture(g_assets->GetCubeMapTexture(r)); } } else { ConfigForShading(ShadingType::kObjectReflectLightShadowAdd); @@ -183,7 +183,7 @@ void ObjectComponent::WriteConfig() { cmd_buffer_->PutTexture(texture_); SystemCubeMapTextureID r = Graphics::CubeMapFromReflectionType(reflection_); - cmd_buffer_->PutCubeMapTexture(g_media->GetCubeMapTexture(r)); + cmd_buffer_->PutCubeMapTexture(g_assets->GetCubeMapTexture(r)); } } } diff --git a/src/ballistica/graphics/component/simple_component.cc b/src/ballistica/graphics/component/simple_component.cc index 0b31e541..b6816201 100644 --- a/src/ballistica/graphics/component/simple_component.cc +++ b/src/ballistica/graphics/component/simple_component.cc @@ -132,7 +132,7 @@ void SimpleComponent::WriteConfig() { colorize_color2_g_, colorize_color2_b_); cmd_buffer_->PutTexture(texture_); cmd_buffer_->PutTexture( - g_media->GetTexture(SystemTextureID::kBlack)); + g_assets->GetTexture(SystemTextureID::kBlack)); cmd_buffer_->PutTexture(mask_texture_); } else { ConfigForShading( @@ -203,7 +203,8 @@ void SimpleComponent::WriteConfig() { colorize_color_b_, colorize_color2_r_, colorize_color2_g_, colorize_color2_b_); cmd_buffer_->PutTexture(texture_); - cmd_buffer_->PutTexture(g_media->GetTexture(SystemTextureID::kBlack)); + cmd_buffer_->PutTexture( + g_assets->GetTexture(SystemTextureID::kBlack)); cmd_buffer_->PutTexture(mask_texture_); } else { // if no color was provided we can do a super-cheap version diff --git a/src/ballistica/graphics/component/smoke_component.cc b/src/ballistica/graphics/component/smoke_component.cc index 9d7aaa35..617c9053 100644 --- a/src/ballistica/graphics/component/smoke_component.cc +++ b/src/ballistica/graphics/component/smoke_component.cc @@ -8,11 +8,11 @@ void SmokeComponent::WriteConfig() { if (overlay_) { ConfigForShading(ShadingType::kSmokeOverlay); cmd_buffer_->PutFloats(color_r_, color_g_, color_b_, color_a_); - cmd_buffer_->PutTexture(g_media->GetTexture(SystemTextureID::kSmoke)); + cmd_buffer_->PutTexture(g_assets->GetTexture(SystemTextureID::kSmoke)); } else { ConfigForShading(ShadingType::kSmoke); cmd_buffer_->PutFloats(color_r_, color_g_, color_b_, color_a_); - cmd_buffer_->PutTexture(g_media->GetTexture(SystemTextureID::kSmoke)); + cmd_buffer_->PutTexture(g_assets->GetTexture(SystemTextureID::kSmoke)); } } diff --git a/src/ballistica/graphics/component/sprite_component.cc b/src/ballistica/graphics/component/sprite_component.cc index d9f052bc..32a2ade4 100644 --- a/src/ballistica/graphics/component/sprite_component.cc +++ b/src/ballistica/graphics/component/sprite_component.cc @@ -9,7 +9,7 @@ void SpriteComponent::WriteConfig() { // this is not a common case and easier than forking all our shaders // to create non-textured versions. if (!texture_.exists()) { - texture_ = g_media->GetTexture(SystemTextureID::kWhite); + texture_ = g_assets->GetTexture(SystemTextureID::kWhite); } if (exponent_ == 1) { ConfigForShading(ShadingType::kSprite); diff --git a/src/ballistica/graphics/frame_def.h b/src/ballistica/graphics/frame_def.h index 5df6de21..8e794ea0 100644 --- a/src/ballistica/graphics/frame_def.h +++ b/src/ballistica/graphics/frame_def.h @@ -6,9 +6,9 @@ #include #include +#include "ballistica/assets/data/asset_component_data.h" #include "ballistica/math/matrix44f.h" #include "ballistica/math/vector2f.h" -#include "ballistica/media/data/media_component_data.h" namespace ballistica { @@ -101,7 +101,7 @@ class FrameDef { auto has_depth_texture() const -> bool { return (quality_ >= GraphicsQuality::kHigh); } - void AddComponent(const Object::Ref& component) { + void AddComponent(const Object::Ref& component) { // Add a reference to this component only if we havn't yet. if (component->last_frame_def_num() != frame_number_) { component->set_last_frame_def_num(frame_number_); @@ -156,7 +156,7 @@ class FrameDef { return mesh_index_sizes_; } auto media_components() const - -> const std::vector>& { + -> const std::vector>& { return media_components_; } @@ -189,7 +189,7 @@ class FrameDef { std::vector> meshes_; std::vector> mesh_buffers_; std::vector mesh_index_sizes_; - std::vector> media_components_; + std::vector> media_components_; #if BA_DEBUG_BUILD // Sanity checking: make sure components are completely submitted diff --git a/src/ballistica/graphics/gl/renderer_gl.cc b/src/ballistica/graphics/gl/renderer_gl.cc index 5bbaf731..9c803eee 100644 --- a/src/ballistica/graphics/gl/renderer_gl.cc +++ b/src/ballistica/graphics/gl/renderer_gl.cc @@ -3,11 +3,11 @@ #if BA_ENABLE_OPENGL #include "ballistica/graphics/gl/renderer_gl.h" +#include "ballistica/assets/data/texture_preload_data.h" +#include "ballistica/assets/data/texture_renderer_data.h" #include "ballistica/graphics/component/special_component.h" #include "ballistica/graphics/graphics_server.h" #include "ballistica/graphics/mesh/mesh_renderer_data.h" -#include "ballistica/media/data/texture_preload_data.h" -#include "ballistica/media/data/texture_renderer_data.h" #if BA_OSTYPE_IOS_TVOS #include "ballistica/platform/apple/apple_utils.h" diff --git a/src/ballistica/graphics/graphics.cc b/src/ballistica/graphics/graphics.cc index ef1949db..ca13b656 100644 --- a/src/ballistica/graphics/graphics.cc +++ b/src/ballistica/graphics/graphics.cc @@ -449,7 +449,7 @@ void Graphics::DrawMiscOverlays(RenderPass* pass) { { SimpleComponent c(pass); c.SetTransparent(true); - c.SetTexture(g_media->GetTexture(SystemTextureID::kSoftRectVertical)); + c.SetTexture(g_assets->GetTexture(SystemTextureID::kSoftRectVertical)); float screen_width = g_graphics->screen_virtual_width(); @@ -533,7 +533,7 @@ void Graphics::DrawMiscOverlays(RenderPass* pass) { // Align our bottom with where we just scaled from. c.Translate(0, 0.5f, 0); } - c.DrawModel(g_media->GetModel(SystemModelID::kImage1x1)); + c.DrawModel(g_assets->GetModel(SystemModelID::kImage1x1)); c.PopTransform(); v += scale * (36 + str_height); @@ -690,14 +690,14 @@ void Graphics::DrawMiscOverlays(RenderPass* pass) { c2.SetColorizeColor(i->tint.x, i->tint.y, i->tint.z); c2.SetColorizeColor2(i->tint2.x, i->tint2.y, i->tint2.z); c2.SetMaskTexture( - g_media->GetTexture(SystemTextureID::kCharacterIconMask)); + g_assets->GetTexture(SystemTextureID::kCharacterIconMask)); } c2.SetColor(1, 1, 1, a); c2.PushTransform(); c2.Translate(h - 14, v_base + 10 + i->v_smoothed, kScreenMessageZDepth); c2.Scale(22.0f * s_extra, 22.0f * s_extra); - c2.DrawModel(g_media->GetModel(SystemModelID::kImage1x1)); + c2.DrawModel(g_assets->GetModel(SystemModelID::kImage1x1)); c2.PopTransform(); c2.Submit(); } @@ -898,7 +898,7 @@ void Graphics::DrawLoadDot(RenderPass* pass) { // Draw red if we've got graphics stuff loading. Green if only other stuff // left. - if (g_media->GetGraphicalPendingLoadCount() > 0) { + if (g_assets->GetGraphicalPendingLoadCount() > 0) { c.SetColor(0.2f, 0, 0, 1); } else { c.SetColor(0, 0.2f, 0, 1); @@ -1076,7 +1076,7 @@ void Graphics::BuildAndPushFrameDef() { } } - if (g_media->GetPendingLoadCount() > 0) { + if (g_assets->GetPendingLoadCount() > 0) { DrawLoadDot(overlay_pass); } @@ -1124,7 +1124,7 @@ void Graphics::DrawBoxingGlovesTest(FrameDef* frame_def) { c.Translate(0, 7, -3.3f); c.Scale(10, 10, 10); c.Rotate(a, 0, 0, 1); - c.DrawModel(g_media->GetModel(SystemModelID::kBoxingGlove)); + c.DrawModel(g_assets->GetModel(SystemModelID::kBoxingGlove)); c.PopTransform(); c.Submit(); } @@ -1132,14 +1132,14 @@ void Graphics::DrawBoxingGlovesTest(FrameDef* frame_def) { // Beauty. if (explicit_bool(false)) { ObjectComponent c(frame_def->beauty_pass()); - c.SetTexture(g_media->GetTexture(SystemTextureID::kBoxingGlove)); + c.SetTexture(g_assets->GetTexture(SystemTextureID::kBoxingGlove)); c.SetReflection(ReflectionType::kSoft); c.SetReflectionScale(0.4f, 0.4f, 0.4f); c.PushTransform(); c.Translate(0.0f, 3.7f, -3.3f); c.Scale(10.0f, 10.0f, 10.0f); c.Rotate(a, 0.0f, 0.0f, 1.0f); - c.DrawModel(g_media->GetModel(SystemModelID::kBoxingGlove)); + c.DrawModel(g_assets->GetModel(SystemModelID::kBoxingGlove)); c.PopTransform(); c.Submit(); } @@ -1153,7 +1153,7 @@ void Graphics::DrawBoxingGlovesTest(FrameDef* frame_def) { c.Translate(0.0f, 3.7f, -3.3f); c.Scale(10.0f, 10.0f, 10.0f); c.Rotate(a, 0.0f, 0.0f, 1.0f); - c.DrawModel(g_media->GetModel(SystemModelID::kBoxingGlove)); + c.DrawModel(g_assets->GetModel(SystemModelID::kBoxingGlove)); c.PopTransform(); c.Submit(); } @@ -1168,7 +1168,7 @@ void Graphics::DrawDebugBuffers(RenderPass* pass) { c.PushTransform(); c.Translate(70, 400, kDebugImgZDepth); c.Scale(csize, csize); - c.DrawModel(g_media->GetModel(SystemModelID::kImage1x1)); + c.DrawModel(g_assets->GetModel(SystemModelID::kImage1x1)); c.PopTransform(); c.Submit(); } @@ -1178,7 +1178,7 @@ void Graphics::DrawDebugBuffers(RenderPass* pass) { c.PushTransform(); c.Translate(70, 250, kDebugImgZDepth); c.Scale(csize, csize); - c.DrawModel(g_media->GetModel(SystemModelID::kImage1x1)); + c.DrawModel(g_assets->GetModel(SystemModelID::kImage1x1)); c.PopTransform(); c.Submit(); } @@ -1190,18 +1190,18 @@ void Graphics::UpdateAndDrawProgressBar(FrameDef* frame_def, RenderPass* pass = frame_def->overlay_pass(); UpdateProgressBarProgress( 1.0f - - static_cast(g_media->GetGraphicalPendingLoadCount()) + - static_cast(g_assets->GetGraphicalPendingLoadCount()) / static_cast(progress_bar_loads_)); DrawProgressBar(pass, 1.0f); // If we were drawing a progress bar, see if everything is now loaded.. if // so, start rendering normally next frame. - int count = g_media->GetGraphicalPendingLoadCount(); + int count = g_assets->GetGraphicalPendingLoadCount(); if (count <= 0) { progress_bar_ = false; progress_bar_end_time_ = real_time; } - if (g_media->GetPendingLoadCount() > 0) { + if (g_assets->GetPendingLoadCount() > 0) { DrawLoadDot(pass); } } @@ -1294,7 +1294,7 @@ void Graphics::DrawFades(FrameDef* frame_def, millisecs_t real_time) { float inv_a = 1.0f - a; float s = 100.0f * inv_a + 5.0f * a; c.Scale(s, s, s); - c.DrawModel(g_media->GetModel(SystemModelID::kVRFade)); + c.DrawModel(g_assets->GetModel(SystemModelID::kVRFade)); c.PopTransform(); c.Submit(); #else // BA_VR_BUILD @@ -1347,7 +1347,7 @@ void Graphics::DrawCursor(RenderPass* pass, millisecs_t real_time) { SimpleComponent c(pass); c.SetTransparent(true); float csize = 50.0f; - c.SetTexture(g_media->GetTexture(SystemTextureID::kCursor)); + c.SetTexture(g_assets->GetTexture(SystemTextureID::kCursor)); c.PushTransform(); // Note: we don't plug in known cursor position values here; we tell the @@ -1356,7 +1356,7 @@ void Graphics::DrawCursor(RenderPass* pass, millisecs_t real_time) { c.CursorTranslate(); c.Translate(csize * 0.44f, csize * -0.44f, kCursorZDepth); c.Scale(csize, csize); - c.DrawModel(g_media->GetModel(SystemModelID::kImage1x1)); + c.DrawModel(g_assets->GetModel(SystemModelID::kImage1x1)); c.PopTransform(); c.Submit(); } @@ -1372,7 +1372,7 @@ void Graphics::DrawBlotches(FrameDef* frame_def) { this->shadow_blotch_mesh_->SetData(Object::New>( this->blotch_verts_.size(), &this->blotch_verts_[0])); SpriteComponent c(frame_def->light_shadow_pass()); - c.SetTexture(g_media->GetTexture(SystemTextureID::kLight)); + c.SetTexture(g_assets->GetTexture(SystemTextureID::kLight)); c.DrawMesh(this->shadow_blotch_mesh_.get()); c.Submit(); } @@ -1385,7 +1385,7 @@ void Graphics::DrawBlotches(FrameDef* frame_def) { Object::New>(this->blotch_soft_verts_.size(), &this->blotch_soft_verts_[0])); SpriteComponent c(frame_def->light_shadow_pass()); - c.SetTexture(g_media->GetTexture(SystemTextureID::kLightSoft)); + c.SetTexture(g_assets->GetTexture(SystemTextureID::kLightSoft)); c.DrawMesh(this->shadow_blotch_soft_mesh_.get()); c.Submit(); } @@ -1401,7 +1401,7 @@ void Graphics::DrawBlotches(FrameDef* frame_def) { this->blotch_soft_obj_verts_.size(), &this->blotch_soft_obj_verts_[0])); SpriteComponent c(frame_def->light_pass()); - c.SetTexture(g_media->GetTexture(SystemTextureID::kLightSoft)); + c.SetTexture(g_assets->GetTexture(SystemTextureID::kLightSoft)); c.DrawMesh(this->shadow_blotch_soft_obj_mesh_.get()); c.Submit(); } @@ -1448,7 +1448,7 @@ void Graphics::AddMeshDataDestroy(MeshData* d) { void Graphics::EnableProgressBar(bool fade_in) { assert(InLogicThread()); - progress_bar_loads_ = g_media->GetGraphicalPendingLoadCount(); + progress_bar_loads_ = g_assets->GetGraphicalPendingLoadCount(); assert(progress_bar_loads_ >= 0); if (progress_bar_loads_ > 0) { progress_bar_ = true; diff --git a/src/ballistica/graphics/graphics_server.cc b/src/ballistica/graphics/graphics_server.cc index fe7b7862..8af8e73f 100644 --- a/src/ballistica/graphics/graphics_server.cc +++ b/src/ballistica/graphics/graphics_server.cc @@ -11,10 +11,10 @@ #include "ballistica/platform/sdl/sdl_app.h" #else #include "ballistica/app/app_flavor.h" +#include "ballistica/assets/assets.h" #include "ballistica/graphics/frame_def.h" #include "ballistica/graphics/mesh/mesh_data.h" #include "ballistica/graphics/renderer.h" -#include "ballistica/media/media.h" #include "ballistica/platform/platform.h" #endif @@ -75,7 +75,7 @@ auto GraphicsServer::GetRenderFrameDef() -> FrameDef* { } // Do some incremental loading every time we try to render. - g_media->RunPendingGraphicsLoads(); + g_assets->RunPendingGraphicsLoads(); // Spin and wait for a short bit for a frame_def to appear. If it does, we // grab it, render it, and also message the game thread to start generating @@ -185,7 +185,7 @@ void GraphicsServer::ReloadMedia() { // Immediately unload all renderer data here in this thread. if (renderer_) { - g_media->UnloadRendererBits(true, true); + g_assets->UnloadRendererBits(true, true); } // Set a render-hold so we ignore all frame_defs up until the point at which @@ -199,7 +199,7 @@ void GraphicsServer::ReloadMedia() { // progress bar drawing, and then tell the graphics thread to stop ignoring // frame-defs. g_game->thread()->PushCall([this] { - g_media->MarkAllMediaForLoad(); + g_assets->MarkAllAssetsForLoad(); g_graphics->EnableProgressBar(false); PushRemoveRenderHoldCall(); }); @@ -219,7 +219,7 @@ void GraphicsServer::RebuildLostContext() { set_renderer_context_lost(true); // Unload all texture and model data here in the render thread. - g_media->UnloadRendererBits(true, true); + g_assets->UnloadRendererBits(true, true); // Also unload dynamic meshes. for (auto&& i : mesh_datas_) { @@ -250,7 +250,7 @@ void GraphicsServer::RebuildLostContext() { // Now tell the game thread to kick off loads for everything, flip on progress // bar drawing, and then tell the graphics thread to stop ignoring frame-defs. g_game->thread()->PushCall([this] { - g_media->MarkAllMediaForLoad(); + g_assets->MarkAllAssetsForLoad(); g_graphics->EnableProgressBar(false); PushRemoveRenderHoldCall(); }); @@ -373,7 +373,7 @@ void GraphicsServer::HandleFullContextScreenRebuild( if (renderer_) { // Unload all textures and models.. these will be reloaded as-needed // automatically for the new context.. - g_media->UnloadRendererBits(true, true); + g_assets->UnloadRendererBits(true, true); // Also unload all dynamic meshes. for (auto&& i : mesh_datas_) { @@ -464,7 +464,7 @@ void GraphicsServer::HandleFullContextScreenRebuild( // progress bar drawing, and then tell the graphics thread to stop ignoring // frame-defs. g_game->thread()->PushCall([this] { - g_media->MarkAllMediaForLoad(); + g_assets->MarkAllAssetsForLoad(); g_graphics->set_internal_components_inited(false); g_graphics->EnableProgressBar(false); PushRemoveRenderHoldCall(); @@ -768,7 +768,7 @@ void GraphicsServer::PushSetVSyncCall(bool sync, bool auto_sync) { } void GraphicsServer::PushComponentUnloadCall( - const std::vector*>& components) { + const std::vector*>& components) { thread()->PushCall([this, components] { // Unload all components we were passed. for (auto&& i : components) { @@ -776,7 +776,7 @@ void GraphicsServer::PushComponentUnloadCall( } // ..and then ship these pointers back to the game thread so it can free the // references. - g_game->PushFreeMediaComponentRefsCall(components); + g_game->PushFreeAssetComponentRefsCall(components); }); } diff --git a/src/ballistica/graphics/graphics_server.h b/src/ballistica/graphics/graphics_server.h index 79cb989d..53edecfa 100644 --- a/src/ballistica/graphics/graphics_server.h +++ b/src/ballistica/graphics/graphics_server.h @@ -29,7 +29,7 @@ class GraphicsServer { auto PushReloadMediaCall() -> void; auto PushRemoveRenderHoldCall() -> void; auto PushComponentUnloadCall( - const std::vector*>& components) -> void; + const std::vector*>& components) -> void; auto SetRenderHold() -> void; // Used by the game thread to pass frame-defs to the graphics server diff --git a/src/ballistica/graphics/render_command_buffer.h b/src/ballistica/graphics/render_command_buffer.h index 27f8af98..691100f7 100644 --- a/src/ballistica/graphics/render_command_buffer.h +++ b/src/ballistica/graphics/render_command_buffer.h @@ -5,12 +5,12 @@ #include +#include "ballistica/assets/component/model.h" +#include "ballistica/assets/component/texture.h" #include "ballistica/ballistica.h" #include "ballistica/graphics/frame_def.h" #include "ballistica/graphics/mesh/mesh.h" #include "ballistica/math/matrix44f.h" -#include "ballistica/media/component/model.h" -#include "ballistica/media/component/texture.h" namespace ballistica { @@ -258,14 +258,14 @@ class RenderCommandBuffer { void PutModel(ModelData* model) { assert(frame_def_); assert(!finalized_); - frame_def_->AddComponent(Object::Ref(model)); + frame_def_->AddComponent(Object::Ref(model)); models_.push_back(model); } void PutTexture(TextureData* texture) { assert(frame_def_); assert(!finalized_); - frame_def_->AddComponent(Object::Ref(texture)); + frame_def_->AddComponent(Object::Ref(texture)); textures_.push_back(texture); } @@ -277,7 +277,7 @@ class RenderCommandBuffer { void PutCubeMapTexture(TextureData* texture) { assert(frame_def_); assert(!finalized_); - frame_def_->AddComponent(Object::Ref(texture)); + frame_def_->AddComponent(Object::Ref(texture)); textures_.push_back(texture); } diff --git a/src/ballistica/graphics/renderer.cc b/src/ballistica/graphics/renderer.cc index f5fe3ed4..43c9ddb1 100644 --- a/src/ballistica/graphics/renderer.cc +++ b/src/ballistica/graphics/renderer.cc @@ -650,7 +650,7 @@ void Renderer::UpdatePixelScaleAndBackingBuffer(FrameDef* frame_def) { void Renderer::LoadMedia(FrameDef* frame_def) { millisecs_t t = GetRealTime(); for (auto&& i : frame_def->media_components()) { - MediaComponentData* mc = i.get(); + AssetComponentData* mc = i.get(); assert(mc); mc->Load(); diff --git a/src/ballistica/graphics/renderer.h b/src/ballistica/graphics/renderer.h index b0ff2946..ccf7a257 100644 --- a/src/ballistica/graphics/renderer.h +++ b/src/ballistica/graphics/renderer.h @@ -7,6 +7,9 @@ #include #include +#include "ballistica/assets/assets.h" +#include "ballistica/assets/component/texture.h" +#include "ballistica/assets/data/model_data.h" #include "ballistica/core/object.h" #include "ballistica/graphics/frame_def.h" #include "ballistica/graphics/framebuffer.h" @@ -38,9 +41,6 @@ #include "ballistica/graphics/text/text_group.h" #include "ballistica/math/matrix44f.h" #include "ballistica/math/vector3f.h" -#include "ballistica/media/component/texture.h" -#include "ballistica/media/data/model_data.h" -#include "ballistica/media/media.h" namespace ballistica { diff --git a/src/ballistica/graphics/text/text_group.cc b/src/ballistica/graphics/text/text_group.cc index 43aee897..63e4e619 100644 --- a/src/ballistica/graphics/text/text_group.cc +++ b/src/ballistica/graphics/text/text_group.cc @@ -33,7 +33,7 @@ void TextGroup::SetText(const std::string& text, TextMesh::HAlign alignment_h, entry->max_flatness = 1.0f; entry->mesh.SetText(text, alignment_h, alignment_v, true, 0, 65535, TextMeshEntryType::kRegular, nullptr); - entry->tex = g_media->GetTexture(SystemTextureID::kFontBig); + entry->tex = g_assets->GetTexture(SystemTextureID::kFontBig); entries_.push_back(std::move(entry)); } else { @@ -109,8 +109,8 @@ void TextGroup::SetText(const std::string& text, TextMesh::HAlign alignment_h, // There should only ever be one of these. assert(!os_texture_.exists()); { - Media::MediaListsLock lock; - os_texture_ = g_media->GetTextureData(packer.get()); + Assets::AssetListLock lock; + os_texture_ = g_assets->GetTextureData(packer.get()); } // We also need to know what uv-scales to use for shadows/etc. @@ -122,43 +122,43 @@ void TextGroup::SetText(const std::string& text, TextMesh::HAlign alignment_h, } switch (*i) { case 0: - entry->tex = g_media->GetTexture(SystemTextureID::kFontSmall0); + entry->tex = g_assets->GetTexture(SystemTextureID::kFontSmall0); break; case 1: - entry->tex = g_media->GetTexture(SystemTextureID::kFontSmall1); + entry->tex = g_assets->GetTexture(SystemTextureID::kFontSmall1); break; case 2: - entry->tex = g_media->GetTexture(SystemTextureID::kFontSmall2); + entry->tex = g_assets->GetTexture(SystemTextureID::kFontSmall2); break; case 3: - entry->tex = g_media->GetTexture(SystemTextureID::kFontSmall3); + entry->tex = g_assets->GetTexture(SystemTextureID::kFontSmall3); break; case 4: - entry->tex = g_media->GetTexture(SystemTextureID::kFontSmall4); + entry->tex = g_assets->GetTexture(SystemTextureID::kFontSmall4); break; case 5: - entry->tex = g_media->GetTexture(SystemTextureID::kFontSmall5); + entry->tex = g_assets->GetTexture(SystemTextureID::kFontSmall5); break; case 6: - entry->tex = g_media->GetTexture(SystemTextureID::kFontSmall6); + entry->tex = g_assets->GetTexture(SystemTextureID::kFontSmall6); break; case 7: - entry->tex = g_media->GetTexture(SystemTextureID::kFontSmall7); + entry->tex = g_assets->GetTexture(SystemTextureID::kFontSmall7); break; case static_cast(TextGraphics::FontPage::kOSRendered): entry->tex = os_texture_; break; case static_cast(TextGraphics::FontPage::kExtras1): - entry->tex = g_media->GetTexture(SystemTextureID::kFontExtras); + entry->tex = g_assets->GetTexture(SystemTextureID::kFontExtras); break; case static_cast(TextGraphics::FontPage::kExtras2): - entry->tex = g_media->GetTexture(SystemTextureID::kFontExtras2); + entry->tex = g_assets->GetTexture(SystemTextureID::kFontExtras2); break; case static_cast(TextGraphics::FontPage::kExtras3): - entry->tex = g_media->GetTexture(SystemTextureID::kFontExtras3); + entry->tex = g_assets->GetTexture(SystemTextureID::kFontExtras3); break; case static_cast(TextGraphics::FontPage::kExtras4): - entry->tex = g_media->GetTexture(SystemTextureID::kFontExtras4); + entry->tex = g_assets->GetTexture(SystemTextureID::kFontExtras4); break; default: throw Exception(); diff --git a/src/ballistica/graphics/text/text_group.h b/src/ballistica/graphics/text/text_group.h index a9756e25..36081d75 100644 --- a/src/ballistica/graphics/text/text_group.h +++ b/src/ballistica/graphics/text/text_group.h @@ -7,10 +7,10 @@ #include #include +#include "ballistica/assets/assets.h" +#include "ballistica/assets/data/texture_data.h" #include "ballistica/core/object.h" #include "ballistica/graphics/mesh/text_mesh.h" -#include "ballistica/media/data/texture_data.h" -#include "ballistica/media/media.h" namespace ballistica { @@ -50,10 +50,10 @@ class TextGroup : public Object { } auto GetElementMaskUV2Texture(int index) const -> TextureData* { assert(index < static_cast(entries_.size())); - return g_media->GetTexture(entries_[index]->type - == TextMeshEntryType::kOSRendered - ? SystemTextureID::kSoftRect2 - : SystemTextureID::kSoftRect); + return g_assets->GetTexture(entries_[index]->type + == TextMeshEntryType::kOSRendered + ? SystemTextureID::kSoftRect2 + : SystemTextureID::kSoftRect); } void SetText(const std::string& text, TextMesh::HAlign alignment_h = TextMesh::HAlign::kLeft, diff --git a/src/ballistica/graphics/vr_graphics.cc b/src/ballistica/graphics/vr_graphics.cc index ebb6a81e..8bf2a90b 100644 --- a/src/ballistica/graphics/vr_graphics.cc +++ b/src/ballistica/graphics/vr_graphics.cc @@ -241,7 +241,7 @@ void VRGraphics::DrawVROverlay(FrameDef* frame_def) { c.Scale(kBaseVirtualResX * (1.0f + kVRBorder), kBaseVirtualResY * (1.0f + kVRBorder), kBaseVirtualResX * (1.0f + kVRBorder)); - c.DrawModel(g_media->GetModel(SystemModelID::kVROverlay)); + c.DrawModel(g_assets->GetModel(SystemModelID::kVROverlay)); c.PopTransform(); c.Submit(); } @@ -258,7 +258,7 @@ void VRGraphics::DrawOverlayBounds(RenderPass* pass) { // Slight offset in z to reduce z fighting. c.Translate(0.5f * width, 0.5f * height, 1.0f); c.Scale(width, height, 100.0f); - c.DrawModel(g_media->GetModel(SystemModelID::kOverlayGuide)); + c.DrawModel(g_assets->GetModel(SystemModelID::kOverlayGuide)); c.PopTransform(); c.Submit(); } @@ -277,14 +277,14 @@ void VRGraphics::DrawVRControllers(FrameDef* frame_def) { if (false) { ObjectComponent c(frame_def->beauty_pass()); c.SetColor(1, 0, 0); - c.SetTexture(g_media->GetTexture(SystemTextureID::kBoxingGlove)); + c.SetTexture(g_assets->GetTexture(SystemTextureID::kBoxingGlove)); c.SetReflection(ReflectionType::kSoft); c.SetReflectionScale(0.4f, 0.4f, 0.4f); c.PushTransform(); c.VRTransformToHead(); c.Translate(0, 0, 5); c.Scale(2, 2, 2); - c.DrawModel(g_media->GetModel(SystemModelID::kBoxingGlove)); + c.DrawModel(g_assets->GetModel(SystemModelID::kBoxingGlove)); c.PopTransform(); c.Submit(); } @@ -297,13 +297,13 @@ void VRGraphics::DrawVRControllers(FrameDef* frame_def) { case VRHandType::kDaydreamRemote: { ObjectComponent c(frame_def->beauty_pass()); c.SetColor(0, 1, 0); - c.SetTexture(g_media->GetTexture(SystemTextureID::kBoxingGlove)); + c.SetTexture(g_assets->GetTexture(SystemTextureID::kBoxingGlove)); c.SetReflection(ReflectionType::kSoft); c.SetReflectionScale(0.4f, 0.4f, 0.4f); c.PushTransform(); c.VRTransformToRightHand(); c.Scale(10, 10, 10); - c.DrawModel(g_media->GetModel(SystemModelID::kBoxingGlove)); + c.DrawModel(g_assets->GetModel(SystemModelID::kBoxingGlove)); c.PopTransform(); c.Submit(); break; @@ -316,13 +316,13 @@ void VRGraphics::DrawVRControllers(FrameDef* frame_def) { case VRHandType::kOculusTouchL: { ObjectComponent c(frame_def->beauty_pass()); c.SetColor(0, 0, 1); - c.SetTexture(g_media->GetTexture(SystemTextureID::kBoxingGlove)); + c.SetTexture(g_assets->GetTexture(SystemTextureID::kBoxingGlove)); c.SetReflection(ReflectionType::kSoft); c.SetReflectionScale(0.4f, 0.4f, 0.4f); c.PushTransform(); c.VRTransformToLeftHand(); c.Scale(10, 10, 10); - c.DrawModel(g_media->GetModel(SystemModelID::kBoxingGlove)); + c.DrawModel(g_assets->GetModel(SystemModelID::kBoxingGlove)); c.PopTransform(); c.Submit(); break; diff --git a/src/ballistica/input/device/touch_input.cc b/src/ballistica/input/device/touch_input.cc index 500b699e..a75e1dd6 100644 --- a/src/ballistica/input/device/touch_input.cc +++ b/src/ballistica/input/device/touch_input.cc @@ -429,7 +429,7 @@ void TouchInput::Draw(FrameDef* frame_def) { if (movement_control_type_ == MovementControlType::kSwipe) sc2 *= 0.6f; if (movement_control_type_ == MovementControlType::kSwipe) { - c.SetTexture(g_media->GetTexture(SystemTextureID::kTouchArrows)); + c.SetTexture(g_assets->GetTexture(SystemTextureID::kTouchArrows)); if (editing_) { float val = 1.5f + sinf(static_cast(real_time) * 0.02f); c.SetColor(val, val, 1.0f, 1.0f); @@ -442,7 +442,7 @@ void TouchInput::Draw(FrameDef* frame_def) { val = 0.35f; } c.SetColor(0.5f, 0.3f, 0.8f, val); - c.SetTexture(g_media->GetTexture(SystemTextureID::kCircle)); + c.SetTexture(g_assets->GetTexture(SystemTextureID::kCircle)); } float x_offs = @@ -453,7 +453,7 @@ void TouchInput::Draw(FrameDef* frame_def) { c.PushTransform(); c.Translate(d_pad_base_x_ + x_offs, d_pad_base_y_ + y_offs, kDrawDepth); c.Scale(sc2, sc2); - c.DrawModel(g_media->GetModel(SystemModelID::kImage1x1)); + c.DrawModel(g_assets->GetModel(SystemModelID::kImage1x1)); c.PopTransform(); if (movement_control_type_ == MovementControlType::kJoystick) { @@ -467,7 +467,7 @@ void TouchInput::Draw(FrameDef* frame_def) { c.PushTransform(); c.Translate(d_pad_x_ + x_offs, d_pad_y_ + y_offs, kDrawDepth); c.Scale(sc_move * 0.5f, sc_move * 0.5f); - c.DrawModel(g_media->GetModel(SystemModelID::kImage1x1)); + c.DrawModel(g_assets->GetModel(SystemModelID::kImage1x1)); c.PopTransform(); } } @@ -475,7 +475,7 @@ void TouchInput::Draw(FrameDef* frame_def) { if (!buttons_touch_ && action_control_type_ == ActionControlType::kSwipe && !swipe_controls_hidden_) { float sc2{sc_actions * 0.6f}; - c.SetTexture(g_media->GetTexture(SystemTextureID::kTouchArrowsActions)); + c.SetTexture(g_assets->GetTexture(SystemTextureID::kTouchArrowsActions)); if (editing_) { float val = 1.5f + sinf(static_cast(real_time) * 0.02f); c.SetColor(val, val, 1.0f, 1.0f); @@ -489,7 +489,7 @@ void TouchInput::Draw(FrameDef* frame_def) { height * (-0.1f - buttons_default_frac_y_) * (1.0f - presence_); c.Translate(buttons_x_ + x_offs, buttons_y_ + y_offs, kDrawDepth); c.Scale(sc2, sc2); - c.DrawModel(g_media->GetModel(SystemModelID::kImage1x1)); + c.DrawModel(g_assets->GetModel(SystemModelID::kImage1x1)); c.PopTransform(); } c.Submit(); @@ -539,7 +539,7 @@ void TouchInput::Draw(FrameDef* frame_def) { base_fade = 0.25f; } else { base_fade = 0.8f; - c.SetTexture(g_media->GetTexture(SystemTextureID::kActionButtons)); + c.SetTexture(g_assets->GetTexture(SystemTextureID::kActionButtons)); } float x_offs; @@ -632,7 +632,7 @@ void TouchInput::Draw(FrameDef* frame_def) { } else { c.Scale(b_width, b_width); } - c.DrawModel(g_media->GetModel(SystemModelID::kActionButtonRight)); + c.DrawModel(g_assets->GetModel(SystemModelID::kActionButtonRight)); c.PopTransform(); } @@ -659,7 +659,7 @@ void TouchInput::Draw(FrameDef* frame_def) { } else { c.Scale(b_width, b_width); } - c.DrawModel(g_media->GetModel(SystemModelID::kActionButtonLeft)); + c.DrawModel(g_assets->GetModel(SystemModelID::kActionButtonLeft)); c.PopTransform(); } @@ -685,7 +685,7 @@ void TouchInput::Draw(FrameDef* frame_def) { } else { c.Scale(b_width, b_width); } - c.DrawModel(g_media->GetModel(SystemModelID::kActionButtonBottom)); + c.DrawModel(g_assets->GetModel(SystemModelID::kActionButtonBottom)); c.PopTransform(); } @@ -713,13 +713,13 @@ void TouchInput::Draw(FrameDef* frame_def) { } else { c.Scale(b_width, b_width); } - c.DrawModel(g_media->GetModel(SystemModelID::kActionButtonTop)); + c.DrawModel(g_assets->GetModel(SystemModelID::kActionButtonTop)); c.PopTransform(); } // Center point. if (buttons_touch_ && action_control_type_ == ActionControlType::kSwipe) { - c.SetTexture(g_media->GetTexture(SystemTextureID::kCircle)); + c.SetTexture(g_assets->GetTexture(SystemTextureID::kCircle)); c.SetColor(1.0f, 1.0f, 0.0f, 0.8f); c.PushTransform(); @@ -744,7 +744,7 @@ void TouchInput::Draw(FrameDef* frame_def) { kDrawDepth); } c.Scale(b_width * 0.3f, b_width * 0.3f); - c.DrawModel(g_media->GetModel(SystemModelID::kImage1x1)); + c.DrawModel(g_assets->GetModel(SystemModelID::kImage1x1)); c.PopTransform(); } c.PopTransform(); @@ -784,7 +784,7 @@ void TouchInput::Draw(FrameDef* frame_def) { dist = 0.05f; } - c2.SetTexture(g_media->GetTexture(SystemTextureID::kArrow)); + c2.SetTexture(g_assets->GetTexture(SystemTextureID::kArrow)); Matrix44f orient = Matrix44fOrient(d_pad_draw_dir_, Vector3f(0.0f, 1.0f, 0.0f)); c2.PushTransform(); @@ -816,13 +816,13 @@ void TouchInput::Draw(FrameDef* frame_def) { c2.PushTransform(); c2.Translate(0.0f, dist * -0.5f, 0.0f); c2.Scale(0.15f, dist, 0.2f); - c2.DrawModel(g_media->GetModel(SystemModelID::kArrowBack)); + c2.DrawModel(g_assets->GetModel(SystemModelID::kArrowBack)); c2.PopTransform(); c2.PushTransform(); c2.Translate(0.0f, dist * -1.0f - 0.15f, 0.0f); c2.Scale(0.45f, 0.3f, 0.3f); - c2.DrawModel(g_media->GetModel(SystemModelID::kArrowFront)); + c2.DrawModel(g_assets->GetModel(SystemModelID::kArrowFront)); c2.PopTransform(); c2.PopTransform(); diff --git a/src/ballistica/input/input.cc b/src/ballistica/input/input.cc index 9af81231..7d3d166d 100644 --- a/src/ballistica/input/input.cc +++ b/src/ballistica/input/input.cc @@ -495,7 +495,7 @@ void Input::AnnounceConnects() { newly_connected_controllers_.front()); ScreenMessage(s); } - g_audio->PlaySound(g_media->GetSound(SystemSoundID::kGunCock)); + g_audio->PlaySound(g_assets->GetSound(SystemSoundID::kGunCock)); } newly_connected_controllers_.clear(); @@ -515,7 +515,7 @@ void Input::AnnounceDisconnects() { newly_disconnected_controllers_.front()); ScreenMessage(s); } - g_audio->PlaySound(g_media->GetSound(SystemSoundID::kCorkPop)); + g_audio->PlaySound(g_assets->GetSound(SystemSoundID::kCorkPop)); newly_disconnected_controllers_.clear(); } diff --git a/src/ballistica/input/remote_app.cc b/src/ballistica/input/remote_app.cc index b76a7fac..28c70dfe 100644 --- a/src/ballistica/input/remote_app.cc +++ b/src/ballistica/input/remote_app.cc @@ -10,11 +10,11 @@ #endif #include "ballistica/app/app.h" +#include "ballistica/assets/assets.h" #include "ballistica/game/game.h" #include "ballistica/generic/utils.h" #include "ballistica/input/input.h" #include "ballistica/math/vector3f.h" -#include "ballistica/media/media.h" #include "ballistica/networking/network_reader.h" #include "ballistica/platform/min_sdl.h" #include "ballistica/platform/platform.h" diff --git a/src/ballistica/python/class/python_class_collide_model.cc b/src/ballistica/python/class/python_class_collide_model.cc index 15da88cc..7ca5e787 100644 --- a/src/ballistica/python/class/python_class_collide_model.cc +++ b/src/ballistica/python/class/python_class_collide_model.cc @@ -2,9 +2,9 @@ #include "ballistica/python/class/python_class_collide_model.h" +#include "ballistica/assets/component/collide_model.h" #include "ballistica/core/thread.h" #include "ballistica/game/game.h" -#include "ballistica/media/component/collide_model.h" #include "ballistica/python/python.h" namespace ballistica { diff --git a/src/ballistica/python/class/python_class_data.cc b/src/ballistica/python/class/python_class_data.cc index 88791137..79bf242e 100644 --- a/src/ballistica/python/class/python_class_data.cc +++ b/src/ballistica/python/class/python_class_data.cc @@ -2,9 +2,9 @@ #include "ballistica/python/class/python_class_data.h" +#include "ballistica/assets/component/data.h" #include "ballistica/core/thread.h" #include "ballistica/game/game.h" -#include "ballistica/media/component/data.h" #include "ballistica/python/python.h" namespace ballistica { diff --git a/src/ballistica/python/class/python_class_model.cc b/src/ballistica/python/class/python_class_model.cc index 55e2b090..5fd51ccc 100644 --- a/src/ballistica/python/class/python_class_model.cc +++ b/src/ballistica/python/class/python_class_model.cc @@ -2,9 +2,9 @@ #include "ballistica/python/class/python_class_model.h" +#include "ballistica/assets/component/model.h" #include "ballistica/core/thread.h" #include "ballistica/game/game.h" -#include "ballistica/media/component/model.h" #include "ballistica/python/python.h" namespace ballistica { diff --git a/src/ballistica/python/class/python_class_sound.cc b/src/ballistica/python/class/python_class_sound.cc index 4186668e..5025c3a6 100644 --- a/src/ballistica/python/class/python_class_sound.cc +++ b/src/ballistica/python/class/python_class_sound.cc @@ -2,9 +2,9 @@ #include "ballistica/python/class/python_class_sound.h" +#include "ballistica/assets/component/sound.h" #include "ballistica/core/thread.h" #include "ballistica/game/game.h" -#include "ballistica/media/component/sound.h" #include "ballistica/python/python.h" namespace ballistica { diff --git a/src/ballistica/python/class/python_class_texture.cc b/src/ballistica/python/class/python_class_texture.cc index 396440dc..aeb27dda 100644 --- a/src/ballistica/python/class/python_class_texture.cc +++ b/src/ballistica/python/class/python_class_texture.cc @@ -2,9 +2,9 @@ #include "ballistica/python/class/python_class_texture.h" +#include "ballistica/assets/component/texture.h" #include "ballistica/core/thread.h" #include "ballistica/game/game.h" -#include "ballistica/media/component/texture.h" #include "ballistica/python/python.h" namespace ballistica { diff --git a/src/ballistica/python/methods/python_methods_app.cc b/src/ballistica/python/methods/python_methods_app.cc index 2b2fa725..3bb4d412 100644 --- a/src/ballistica/python/methods/python_methods_app.cc +++ b/src/ballistica/python/methods/python_methods_app.cc @@ -4,6 +4,7 @@ #include "ballistica/app/app.h" #include "ballistica/app/app_flavor.h" +#include "ballistica/assets/component/texture.h" #include "ballistica/core/logging.h" #include "ballistica/game/connection/connection_set.h" #include "ballistica/game/game_stream.h" @@ -11,7 +12,6 @@ #include "ballistica/game/session/host_session.h" #include "ballistica/game/session/replay_client_session.h" #include "ballistica/graphics/graphics.h" -#include "ballistica/media/component/texture.h" #include "ballistica/python/class/python_class_activity_data.h" #include "ballistica/python/class/python_class_session_data.h" #include "ballistica/python/python.h" diff --git a/src/ballistica/python/methods/python_methods_media.cc b/src/ballistica/python/methods/python_methods_assets.cc similarity index 98% rename from src/ballistica/python/methods/python_methods_media.cc rename to src/ballistica/python/methods/python_methods_assets.cc index 98d73a24..cc516ffe 100644 --- a/src/ballistica/python/methods/python_methods_media.cc +++ b/src/ballistica/python/methods/python_methods_assets.cc @@ -1,19 +1,19 @@ // Released under the MIT License. See LICENSE for details. -#include "ballistica/python/methods/python_methods_media.h" +#include "ballistica/python/methods/python_methods_assets.h" #include #if 0 // Cpplint errs w/o this, CLion errs with it. Hard to please everybody. #include #endif +#include "ballistica/assets/component/collide_model.h" +#include "ballistica/assets/component/data.h" +#include "ballistica/assets/component/model.h" +#include "ballistica/assets/component/sound.h" +#include "ballistica/assets/component/texture.h" #include "ballistica/game/host_activity.h" #include "ballistica/graphics/graphics_server.h" -#include "ballistica/media/component/collide_model.h" -#include "ballistica/media/component/data.h" -#include "ballistica/media/component/model.h" -#include "ballistica/media/component/sound.h" -#include "ballistica/media/component/texture.h" #include "ballistica/python/python.h" #include "ballistica/python/python_sys.h" #include "ballistica/ui/ui.h" diff --git a/src/ballistica/python/methods/python_methods_media.h b/src/ballistica/python/methods/python_methods_assets.h similarity index 64% rename from src/ballistica/python/methods/python_methods_media.h rename to src/ballistica/python/methods/python_methods_assets.h index abf6713b..eb91a052 100644 --- a/src/ballistica/python/methods/python_methods_media.h +++ b/src/ballistica/python/methods/python_methods_assets.h @@ -1,7 +1,7 @@ // Released under the MIT License. See LICENSE for details. -#ifndef BALLISTICA_PYTHON_METHODS_PYTHON_METHODS_MEDIA_H_ -#define BALLISTICA_PYTHON_METHODS_PYTHON_METHODS_MEDIA_H_ +#ifndef BALLISTICA_PYTHON_METHODS_PYTHON_METHODS_ASSETS_H_ +#define BALLISTICA_PYTHON_METHODS_PYTHON_METHODS_ASSETS_H_ #include @@ -17,4 +17,4 @@ class PythonMethodsMedia { } // namespace ballistica -#endif // BALLISTICA_PYTHON_METHODS_PYTHON_METHODS_MEDIA_H_ +#endif // BALLISTICA_PYTHON_METHODS_PYTHON_METHODS_ASSETS_H_ diff --git a/src/ballistica/python/methods/python_methods_gameplay.cc b/src/ballistica/python/methods/python_methods_gameplay.cc index 8b59b903..25fc1f9c 100644 --- a/src/ballistica/python/methods/python_methods_gameplay.cc +++ b/src/ballistica/python/methods/python_methods_gameplay.cc @@ -5,6 +5,7 @@ #include #include "ballistica/app/app_flavor.h" +#include "ballistica/assets/component/sound.h" #include "ballistica/dynamics/bg/bg_dynamics.h" #include "ballistica/dynamics/collision.h" #include "ballistica/dynamics/dynamics.h" @@ -17,7 +18,6 @@ #include "ballistica/graphics/graphics.h" #include "ballistica/input/device/input_device.h" #include "ballistica/internal/app_internal.h" -#include "ballistica/media/component/sound.h" #include "ballistica/platform/platform.h" #include "ballistica/python/python.h" #include "ballistica/python/python_context_call_runnable.h" diff --git a/src/ballistica/python/methods/python_methods_system.cc b/src/ballistica/python/methods/python_methods_system.cc index 4081c087..4500fedd 100644 --- a/src/ballistica/python/methods/python_methods_system.cc +++ b/src/ballistica/python/methods/python_methods_system.cc @@ -8,6 +8,8 @@ #include "ballistica/app/app.h" #include "ballistica/app/app_config.h" #include "ballistica/app/app_flavor.h" +#include "ballistica/assets/assets.h" +#include "ballistica/assets/component/texture.h" #include "ballistica/game/game_stream.h" #include "ballistica/game/host_activity.h" #include "ballistica/game/session/host_session.h" @@ -15,8 +17,6 @@ #include "ballistica/graphics/camera.h" #include "ballistica/graphics/graphics.h" #include "ballistica/input/input.h" -#include "ballistica/media/component/texture.h" -#include "ballistica/media/media.h" #include "ballistica/python/python.h" #include "ballistica/python/python_context_call_runnable.h" #include "ballistica/python/python_sys.h" @@ -362,7 +362,7 @@ auto PyPrintContext(PyObject* self, PyObject* args, PyObject* keywds) auto PyPrintLoadInfo(PyObject* self, PyObject* args, PyObject* keywds) -> PyObject* { BA_PYTHON_TRY; - g_media->PrintLoadInfo(); + g_assets->PrintLoadInfo(); Py_RETURN_NONE; BA_PYTHON_CATCH; } diff --git a/src/ballistica/python/python.cc b/src/ballistica/python/python.cc index e7540d64..80ccd37c 100644 --- a/src/ballistica/python/python.cc +++ b/src/ballistica/python/python.cc @@ -3,6 +3,10 @@ #include "ballistica/python/python.h" #include "ballistica/app/app.h" +#include "ballistica/assets/component/collide_model.h" +#include "ballistica/assets/component/model.h" +#include "ballistica/assets/component/sound.h" +#include "ballistica/assets/component/texture.h" #include "ballistica/audio/audio.h" #include "ballistica/core/thread.h" #include "ballistica/dynamics/material/material.h" @@ -16,10 +20,6 @@ #include "ballistica/input/device/joystick.h" #include "ballistica/input/device/keyboard_input.h" #include "ballistica/internal/app_internal.h" -#include "ballistica/media/component/collide_model.h" -#include "ballistica/media/component/model.h" -#include "ballistica/media/component/sound.h" -#include "ballistica/media/component/texture.h" #include "ballistica/python/class/python_class_activity_data.h" #include "ballistica/python/class/python_class_collide_model.h" #include "ballistica/python/class/python_class_context.h" @@ -37,10 +37,10 @@ #include "ballistica/python/class/python_class_vec3.h" #include "ballistica/python/class/python_class_widget.h" #include "ballistica/python/methods/python_methods_app.h" +#include "ballistica/python/methods/python_methods_assets.h" #include "ballistica/python/methods/python_methods_gameplay.h" #include "ballistica/python/methods/python_methods_graphics.h" #include "ballistica/python/methods/python_methods_input.h" -#include "ballistica/python/methods/python_methods_media.h" #include "ballistica/python/methods/python_methods_networking.h" #include "ballistica/python/methods/python_methods_system.h" #include "ballistica/python/methods/python_methods_ui.h" @@ -2045,7 +2045,7 @@ void Python::LaunchStringEdit(TextWidget* w) { BA_PRECONDITION(w); ScopedSetContext cp(g_game->GetUIContext()); - g_audio->PlaySound(g_media->GetSound(SystemSoundID::kSwish)); + g_audio->PlaySound(g_assets->GetSound(SystemSoundID::kSwish)); // Gotta run this in the next cycle. PythonRef args(Py_BuildValue("(Osi)", w->BorrowPyRef(), diff --git a/src/ballistica/scene/node/bomb_node.cc b/src/ballistica/scene/node/bomb_node.cc index 6620a487..844267c1 100644 --- a/src/ballistica/scene/node/bomb_node.cc +++ b/src/ballistica/scene/node/bomb_node.cc @@ -2,8 +2,8 @@ #include "ballistica/scene/node/bomb_node.h" +#include "ballistica/assets/component/collide_model.h" #include "ballistica/graphics/graphics.h" -#include "ballistica/media/component/collide_model.h" #include "ballistica/scene/scene.h" namespace ballistica { diff --git a/src/ballistica/scene/node/explosion_node.cc b/src/ballistica/scene/node/explosion_node.cc index 60fbcb38..27f6367e 100644 --- a/src/ballistica/scene/node/explosion_node.cc +++ b/src/ballistica/scene/node/explosion_node.cc @@ -143,7 +143,7 @@ void ExplosionNode::Draw(FrameDef* frame_def) { 1.0f + s * 0.8f * 0.0015f * age, 1.0f + s * 0.8f * 0.025f * age); c.Scale(0.7f, 0.7f, 0.7f); - c.DrawModel(g_media->GetModel(SystemModelID::kShockWave), + c.DrawModel(g_assets->GetModel(SystemModelID::kShockWave), kModelDrawFlagNoReflection); c.PopTransform(); c.Submit(); @@ -161,7 +161,7 @@ void ExplosionNode::Draw(FrameDef* frame_def) { 1.0f + s * 0.8f * 0.0015f * age, 1.0f + s * 0.8f * 0.025f * age); c.Scale(0.7f, 0.7f, 0.7f); - c.DrawModel(g_media->GetModel(SystemModelID::kShockWave), + c.DrawModel(g_assets->GetModel(SystemModelID::kShockWave), kModelDrawFlagNoReflection); c.PopTransform(); c.Submit(); @@ -198,7 +198,7 @@ void ExplosionNode::Draw(FrameDef* frame_def) { c.SetTransparent(true); c.SetLightShadow(LightShadowType::kNone); c.SetPremultiplied(true); - c.SetTexture(g_media->GetTexture(SystemTextureID::kExplosion)); + c.SetTexture(g_assets->GetTexture(SystemTextureID::kExplosion)); c.SetColor(1.3f * o * color_[0] * b, o * color_[1] * b, o * color_[2] * b, 0.0f); c.PushTransform(); @@ -211,13 +211,13 @@ void ExplosionNode::Draw(FrameDef* frame_def) { Matrix44f om = Matrix44fOrient(right, to_cam, up); c.MultMatrix((om * m).m); c.Scale(0.9f * s, 0.9f * s, 0.9f * s); - c.DrawModel(g_media->GetModel(SystemModelID::kShield), + c.DrawModel(g_assets->GetModel(SystemModelID::kShield), kModelDrawFlagNoReflection); c.Scale(0.6f, 0.6f, 0.6f); c.Rotate(33, 0, 1, 0); c.SetColor(o * 7.0f * color_[0], o * 7.0f * color_[1], o * 7.0f * color_[2], 0); - c.DrawModel(g_media->GetModel(SystemModelID::kShield), + c.DrawModel(g_assets->GetModel(SystemModelID::kShield), kModelDrawFlagNoReflection); c.PopTransform(); c.Submit(); diff --git a/src/ballistica/scene/node/flag_node.cc b/src/ballistica/scene/node/flag_node.cc index 20c6b4cd..b67367a4 100644 --- a/src/ballistica/scene/node/flag_node.cc +++ b/src/ballistica/scene/node/flag_node.cc @@ -307,7 +307,7 @@ void FlagNode::Draw(FrameDef* frame_def) { float s_scale, s_density; SimpleComponent c(frame_def->light_shadow_pass()); - c.SetTexture(g_media->GetTexture(SystemTextureID::kShadow)); + c.SetTexture(g_assets->GetTexture(SystemTextureID::kShadow)); c.SetTransparent(true); FullShadowSet* full_shadows = full_shadow_set_.get(); @@ -353,12 +353,12 @@ void FlagNode::Draw(FrameDef* frame_def) { // Flag pole. { ObjectComponent c(frame_def->beauty_pass()); - c.SetTexture(g_media->GetTexture(SystemTextureID::kFlagPole)); + c.SetTexture(g_assets->GetTexture(SystemTextureID::kFlagPole)); c.SetReflection(ReflectionType::kSharp); c.SetReflectionScale(0.1f, 0.1f, 0.1f); c.PushTransform(); c.TransformToBody(*body_); - c.DrawModel(g_media->GetModel(SystemModelID::kFlagPole)); + c.DrawModel(g_assets->GetModel(SystemModelID::kFlagPole)); c.PopTransform(); c.Submit(); } diff --git a/src/ballistica/scene/node/flash_node.cc b/src/ballistica/scene/node/flash_node.cc index 326b4692..dd1bf589 100644 --- a/src/ballistica/scene/node/flash_node.cc +++ b/src/ballistica/scene/node/flash_node.cc @@ -50,7 +50,7 @@ void FlashNode::Draw(FrameDef* frame_def) { c.Translate(position_[0], position_[1], position_[2]); c.Scale(size_, size_, size_); c.Rotate(RandomFloat() * 360.0f, 1, 1, 0); - c.DrawModel(g_media->GetModel(SystemModelID::kFlash)); + c.DrawModel(g_assets->GetModel(SystemModelID::kFlash)); c.PopTransform(); c.Submit(); } diff --git a/src/ballistica/scene/node/image_node.cc b/src/ballistica/scene/node/image_node.cc index c9e1d723..fd312a88 100644 --- a/src/ballistica/scene/node/image_node.cc +++ b/src/ballistica/scene/node/image_node.cc @@ -331,7 +331,7 @@ void ImageNode::Draw(FrameDef* frame_def) { if (vr && fill_screen_) { #if BA_VR_BUILD model_opaque_used = - g_media->GetModel(SystemModelID::kImage1x1VRFullScreen); + g_assets->GetModel(SystemModelID::kImage1x1VRFullScreen); #else throw Exception(); #endif // BA_VR_BUILD @@ -339,9 +339,9 @@ void ImageNode::Draw(FrameDef* frame_def) { SystemModelID m = fill_screen_ ? SystemModelID::kImage1x1FullScreen : SystemModelID::kImage1x1; if (has_alpha_channel) { - model_transparent_used = g_media->GetModel(m); + model_transparent_used = g_assets->GetModel(m); } else { - model_opaque_used = g_media->GetModel(m); + model_opaque_used = g_assets->GetModel(m); } } } diff --git a/src/ballistica/scene/node/image_node.h b/src/ballistica/scene/node/image_node.h index 813f9b5b..689d8280 100644 --- a/src/ballistica/scene/node/image_node.h +++ b/src/ballistica/scene/node/image_node.h @@ -6,8 +6,8 @@ #include #include -#include "ballistica/media/component/model.h" -#include "ballistica/media/component/texture.h" +#include "ballistica/assets/component/model.h" +#include "ballistica/assets/component/texture.h" #include "ballistica/scene/node/node.h" namespace ballistica { diff --git a/src/ballistica/scene/node/locator_node.cc b/src/ballistica/scene/node/locator_node.cc index 319ed2b3..d54c3d54 100644 --- a/src/ballistica/scene/node/locator_node.cc +++ b/src/ballistica/scene/node/locator_node.cc @@ -140,11 +140,11 @@ void LocatorNode::Draw(FrameDef* frame_def) { c.SetTransparent(true); } c.SetColor(color_[0], color_[1], color_[2], opacity_); - c.SetTexture(g_media->GetTexture(texture)); + c.SetTexture(g_assets->GetTexture(texture)); c.PushTransform(); c.Translate(position_[0], position_[1], position_[2]); c.Scale(size_[0], size_[1], size_[2]); - c.DrawModel(g_media->GetModel(model)); + c.DrawModel(g_assets->GetModel(model)); c.PopTransform(); c.Submit(); } @@ -164,11 +164,11 @@ void LocatorNode::Draw(FrameDef* frame_def) { } else { c.SetColor(color_[0], color_[1], color_[2], opacity_); } - c.SetTexture(g_media->GetTexture(texture)); + c.SetTexture(g_assets->GetTexture(texture)); c.PushTransform(); c.Translate(position_[0], position_[1], position_[2]); c.Scale(size_[0], size_[1], size_[2]); - c.DrawModel(g_media->GetModel(model)); + c.DrawModel(g_assets->GetModel(model)); c.PopTransform(); c.Submit(); } else { @@ -179,7 +179,7 @@ void LocatorNode::Draw(FrameDef* frame_def) { c.PushTransform(); c.Translate(position_[0], position_[1], position_[2]); c.Scale(size_[0], size_[1], size_[2]); - c.DrawModel(g_media->GetModel(model)); + c.DrawModel(g_assets->GetModel(model)); c.PopTransform(); c.Submit(); } diff --git a/src/ballistica/scene/node/prop_node.h b/src/ballistica/scene/node/prop_node.h index b8ea5684..d50c5122 100644 --- a/src/ballistica/scene/node/prop_node.h +++ b/src/ballistica/scene/node/prop_node.h @@ -6,10 +6,10 @@ #include #include +#include "ballistica/assets/component/model.h" +#include "ballistica/assets/component/texture.h" #include "ballistica/dynamics/bg/bg_dynamics_shadow.h" #include "ballistica/dynamics/part.h" -#include "ballistica/media/component/model.h" -#include "ballistica/media/component/texture.h" #include "ballistica/scene/node/node.h" #include "ballistica/scene/node/node_attribute.h" #include "ballistica/scene/node/node_type.h" diff --git a/src/ballistica/scene/node/scorch_node.cc b/src/ballistica/scene/node/scorch_node.cc index 2c468287..a3d025f7 100644 --- a/src/ballistica/scene/node/scorch_node.cc +++ b/src/ballistica/scene/node/scorch_node.cc @@ -66,14 +66,14 @@ void ScorchNode::Draw(FrameDef* frame_def) { SimpleComponent c(frame_def->light_shadow_pass()); c.SetTransparent(true); c.SetColor(color_[0], color_[1], color_[2], o * 0.35f); - c.SetTexture(g_media->GetTexture(big_ ? SystemTextureID::kScorchBig - : SystemTextureID::kScorch)); + c.SetTexture(g_assets->GetTexture(big_ ? SystemTextureID::kScorchBig + : SystemTextureID::kScorch)); c.PushTransform(); c.Translate(position_[0], position_[1], position_[2]); c.Scale(o * size_ * rand_size_[0], o * size_ * rand_size_[1], o * size_ * rand_size_[2]); c.Rotate(Utils::precalc_rand_1(id() % kPrecalcRandsCount) * 360.0f, 0, 1, 0); - c.DrawModel(g_media->GetModel(SystemModelID::kScorch)); + c.DrawModel(g_assets->GetModel(SystemModelID::kScorch)); c.PopTransform(); c.Submit(); } diff --git a/src/ballistica/scene/node/shield_node.cc b/src/ballistica/scene/node/shield_node.cc index c52f859d..44db758c 100644 --- a/src/ballistica/scene/node/shield_node.cc +++ b/src/ballistica/scene/node/shield_node.cc @@ -174,25 +174,25 @@ void ShieldNode::Draw(FrameDef* frame_def) { c.PushTransform(); c.Translate(0.5f, half_height); c.Scale(1.1f, height + 0.1f); - c.DrawModel(g_media->GetModel(SystemModelID::kImage1x1)); + c.DrawModel(g_assets->GetModel(SystemModelID::kImage1x1)); c.PopTransform(); c.SetColor(0.4f * o, 0.4f * o, 0.8f * o, 0.0f * o); c.PushTransform(); c.Translate(p_left * 0.5f, half_height); c.Scale(p_left, height); - c.DrawModel(g_media->GetModel(SystemModelID::kImage1x1)); + c.DrawModel(g_assets->GetModel(SystemModelID::kImage1x1)); c.PopTransform(); c.SetColor(1.0f * o, 1.0f * o, 1.0f * o, 0.0f); c.PushTransform(); c.Translate((p_left + p_right) * 0.5f, half_height); c.Scale(p_right - p_left, height); - c.DrawModel(g_media->GetModel(SystemModelID::kImage1x1)); + c.DrawModel(g_assets->GetModel(SystemModelID::kImage1x1)); c.PopTransform(); c.SetColor(0.1f * o, 0.1f * o, 0.2f * o, 0.4f * o); c.PushTransform(); c.Translate((p_right + 1.0f) * 0.5f, half_height); c.Scale(1.0f - p_right, height); - c.DrawModel(g_media->GetModel(SystemModelID::kImage1x1)); + c.DrawModel(g_assets->GetModel(SystemModelID::kImage1x1)); c.PopTransform(); c.PopTransform(); c.Submit(); @@ -224,7 +224,7 @@ void ShieldNode::Draw(FrameDef* frame_def) { c.SetLightShadow(LightShadowType::kNone); c.SetReflection(ReflectionType::kSharp); c.SetReflectionScale(0.34f * o, 0.34f * o, 0.34f * o); - c.SetTexture(g_media->GetTexture(SystemTextureID::kShield)); + c.SetTexture(g_assets->GetTexture(SystemTextureID::kShield)); c.SetColor(col[0], col[1], col[2], 0.13f * o); c.PushTransform(); Vector3f to_cam = @@ -245,7 +245,7 @@ void ShieldNode::Draw(FrameDef* frame_def) { * (0.97f + 0.05f * Utils::precalc_rand_2(rot_count_ % kPrecalcRandsCount)); c.Scale(r2, r2, r2); - c.DrawModel(g_media->GetModel(SystemModelID::kShield), + c.DrawModel(g_assets->GetModel(SystemModelID::kShield), kModelDrawFlagNoReflection); c.PopTransform(); c.Submit(); @@ -259,7 +259,7 @@ void ShieldNode::Draw(FrameDef* frame_def) { c2.Rotate(Utils::precalc_rand_1(rot_count_ % kPrecalcRandsCount) * 360, 0, 1, 0); c2.Scale(r2, r2, r2); - c2.DrawModel(g_media->GetModel(SystemModelID::kShield)); + c2.DrawModel(g_assets->GetModel(SystemModelID::kShield)); c2.PopTransform(); c2.Submit(); } @@ -273,7 +273,7 @@ void ShieldNode::Draw(FrameDef* frame_def) { 1, 0); float sc = r2 * 1.1f; c2.Scale(sc, sc, sc); - c2.DrawModel(g_media->GetModel(SystemModelID::kShield)); + c2.DrawModel(g_assets->GetModel(SystemModelID::kShield)); c2.PopTransform(); c2.Submit(); } diff --git a/src/ballistica/scene/node/sound_node.cc b/src/ballistica/scene/node/sound_node.cc index 75cc6e8e..a34e70b2 100644 --- a/src/ballistica/scene/node/sound_node.cc +++ b/src/ballistica/scene/node/sound_node.cc @@ -2,9 +2,9 @@ #include "ballistica/scene/node/sound_node.h" +#include "ballistica/assets/component/sound.h" #include "ballistica/audio/audio.h" #include "ballistica/audio/audio_source.h" -#include "ballistica/media/component/sound.h" #include "ballistica/scene/node/node_attribute.h" #include "ballistica/scene/node/node_type.h" #include "ballistica/scene/scene.h" diff --git a/src/ballistica/scene/node/spaz_node.cc b/src/ballistica/scene/node/spaz_node.cc index 1e2386a5..26ef2b15 100644 --- a/src/ballistica/scene/node/spaz_node.cc +++ b/src/ballistica/scene/node/spaz_node.cc @@ -2,6 +2,7 @@ #include "ballistica/scene/node/spaz_node.h" +#include "ballistica/assets/component/sound.h" #include "ballistica/audio/audio.h" #include "ballistica/audio/audio_source.h" #include "ballistica/dynamics/bg/bg_dynamics_shadow.h" @@ -17,7 +18,6 @@ #include "ballistica/graphics/graphics_server.h" #include "ballistica/graphics/text/text_graphics.h" #include "ballistica/input/device/input_device.h" -#include "ballistica/media/component/sound.h" #include "ballistica/python/python.h" #include "ballistica/scene/node/node_attribute.h" #include "ballistica/scene/node/node_type.h" @@ -1839,7 +1839,7 @@ void SpazNode::DoFlyPress() { } else { s_id = SystemSoundID::kSparkle3; } - s->Play(g_media->GetSound(s_id)); + s->Play(g_assets->GetSound(s_id)); s->End(); } } @@ -4000,9 +4000,9 @@ void SpazNode::DrawEyeBalls(RenderComponent* c, ObjectComponent* oc, if (blink_smooth_ < 0.9f) { if (shading) { oc->SetLightShadow(LightShadowType::kObject); - oc->SetTexture(g_media->GetTexture(SystemTextureID::kEye)); + oc->SetTexture(g_assets->GetTexture(SystemTextureID::kEye)); oc->SetColorizeColor(eye_color_red_, eye_color_green_, eye_color_blue_); - oc->SetColorizeTexture(g_media->GetTexture(SystemTextureID::kEyeTint)); + oc->SetColorizeTexture(g_assets->GetTexture(SystemTextureID::kEyeTint)); oc->SetReflection(ReflectionType::kSharpest); oc->SetReflectionScale(3, 3, 3); oc->SetAddColor(add_color[0], add_color[1], add_color[2]); @@ -4020,12 +4020,12 @@ void SpazNode::DrawEyeBalls(RenderComponent* c, ObjectComponent* oc, if (death_scale != 1.0f) c->Scale(death_scale, death_scale, death_scale); if (!frosty_ && !eyeless_) { - c->DrawModel(g_media->GetModel(SystemModelID::kEyeBall)); + c->DrawModel(g_assets->GetModel(SystemModelID::kEyeBall)); if (shading) { oc->SetReflectionScale(2, 2, 2); } if (death_scale != 1.0f) c->Scale(death_scale, death_scale, death_scale); - c->DrawModel(g_media->GetModel(SystemModelID::kEyeBallIris)); + c->DrawModel(g_assets->GetModel(SystemModelID::kEyeBallIris)); } c->PopTransform(); @@ -4040,12 +4040,12 @@ void SpazNode::DrawEyeBalls(RenderComponent* c, ObjectComponent* oc, c->Rotate(eyes_lr_smooth_, 0, 1, 0); c->Scale(0.09f, 0.09f, 0.09f); if (death_scale != 1.0f) c->Scale(death_scale, death_scale, death_scale); - c->DrawModel(g_media->GetModel(SystemModelID::kEyeBall)); + c->DrawModel(g_assets->GetModel(SystemModelID::kEyeBall)); if (death_scale != 1.0f) c->Scale(death_scale, death_scale, death_scale); if (shading) { oc->SetReflectionScale(2, 2, 2); } - c->DrawModel(g_media->GetModel(SystemModelID::kEyeBallIris)); + c->DrawModel(g_assets->GetModel(SystemModelID::kEyeBallIris)); c->PopTransform(); } c->PopTransform(); @@ -4054,7 +4054,7 @@ void SpazNode::DrawEyeBalls(RenderComponent* c, ObjectComponent* oc, void SpazNode::SetupEyeLidShading(ObjectComponent* c, float death_fade, float* add_color) { - c->SetTexture(g_media->GetTexture(SystemTextureID::kEye)); + c->SetTexture(g_assets->GetTexture(SystemTextureID::kEye)); c->SetColorizeTexture(nullptr); float r, g, b; r = eye_lid_color_red_; @@ -4097,7 +4097,7 @@ void SpazNode::DrawEyeLids(RenderComponent* c, float death_fade, } if (!frosty_ && !eyeless_) { - c->DrawModel(g_media->GetModel(SystemModelID::kEyeLid)); + c->DrawModel(g_assets->GetModel(SystemModelID::kEyeLid)); } c->PopTransform(); @@ -4117,7 +4117,7 @@ void SpazNode::DrawEyeLids(RenderComponent* c, float death_fade, c->Scale(-0.09f, 0.09f, 0.09f); if (death_scale != 1.0f) c->Scale(death_scale, death_scale, death_scale); if (!pirate_ && !frosty_ && !eyeless_) - c->DrawModel(g_media->GetModel(SystemModelID::kEyeLid)); + c->DrawModel(g_assets->GetModel(SystemModelID::kEyeLid)); c->PopTransform(); c->FlipCullFace(); // back to normal } @@ -4179,7 +4179,7 @@ void SpazNode::DrawBodyParts(ObjectComponent* c, bool shading, float death_fade, if (death_scale != 1.0f) { c->Scale(death_scale, death_scale, death_scale); } - c->DrawModel(g_media->GetModel(SystemModelID::kHairTuft1)); + c->DrawModel(g_assets->GetModel(SystemModelID::kHairTuft1)); c->PopTransform(); // Hair tuft 1b; just reuse tuft 1 with some extra translating. @@ -4193,7 +4193,7 @@ void SpazNode::DrawBodyParts(ObjectComponent* c, bool shading, float death_fade, if (death_scale != 1.0f) { c->Scale(death_scale, death_scale, death_scale); } - c->DrawModel(g_media->GetModel(SystemModelID::kHairTuft1b)); + c->DrawModel(g_assets->GetModel(SystemModelID::kHairTuft1b)); c->PopTransform(); } @@ -4202,7 +4202,7 @@ void SpazNode::DrawBodyParts(ObjectComponent* c, bool shading, float death_fade, c->PushTransform(); c->TransformToBody(*hair_front_left_body_); if (death_scale != 1.0f) c->Scale(death_scale, death_scale, death_scale); - c->DrawModel(g_media->GetModel(SystemModelID::kHairTuft2)); + c->DrawModel(g_assets->GetModel(SystemModelID::kHairTuft2)); c->PopTransform(); } @@ -4213,7 +4213,7 @@ void SpazNode::DrawBodyParts(ObjectComponent* c, bool shading, float death_fade, if (death_scale != 1.0f) { c->Scale(death_scale, death_scale, death_scale); } - c->DrawModel(g_media->GetModel(SystemModelID::kHairTuft3)); + c->DrawModel(g_assets->GetModel(SystemModelID::kHairTuft3)); c->PopTransform(); } @@ -4224,7 +4224,7 @@ void SpazNode::DrawBodyParts(ObjectComponent* c, bool shading, float death_fade, if (death_scale != 1.0f) { c->Scale(death_scale, death_scale, death_scale); } - c->DrawModel(g_media->GetModel(SystemModelID::kHairTuft4)); + c->DrawModel(g_assets->GetModel(SystemModelID::kHairTuft4)); c->PopTransform(); } @@ -4864,7 +4864,7 @@ void SpazNode::Draw(FrameDef* frame_def) { c.Translate(torso_pos[0] - 0.3f, torso_pos[1] + 1.47f, torso_pos[2] - 0.2f); c.Scale(1.5f * 0.2f, 1.5f * 0.2f, 1.5f * 0.2f); - c.DrawModel(g_media->GetModel(SystemModelID::kImage1x1)); + c.DrawModel(g_assets->GetModel(SystemModelID::kImage1x1)); c.PopTransform(); c.Submit(); } @@ -4966,7 +4966,7 @@ void SpazNode::Draw(FrameDef* frame_def) { c.PushTransform(); c.Translate(pos[0], pos[1] + 1.6f, pos[2] - 0.2f); c.Scale(2.3f * 0.2f * s, 2.3f * 0.2f * s, 2.3f * 0.2f * s); - c.DrawModel(g_media->GetModel(SystemModelID::kImage1x1)); + c.DrawModel(g_assets->GetModel(SystemModelID::kImage1x1)); c.PopTransform(); c.Submit(); @@ -4980,7 +4980,7 @@ void SpazNode::Draw(FrameDef* frame_def) { c2.PushTransform(); c2.Translate(pos[0], pos[1] + 1.6f, pos[2] - 0.2f); c2.Scale(2.3f * 0.2f * s, 2.3f * 0.2f * s, 2.3f * 0.2f * s); - c2.DrawModel(g_media->GetModel(SystemModelID::kCrossOut)); + c2.DrawModel(g_assets->GetModel(SystemModelID::kCrossOut)); c2.PopTransform(); c2.Submit(); } @@ -5028,7 +5028,7 @@ void SpazNode::Draw(FrameDef* frame_def) { c.PushTransform(); c.Translate(0.5f, half_height); c.Scale(1.1f, height + 0.1f); - c.DrawModel(g_media->GetModel(SystemModelID::kImage1x1)); + c.DrawModel(g_assets->GetModel(SystemModelID::kImage1x1)); c.PopTransform(); c.SetColor(0, 0.35f * o, 0, 0.3f * o); @@ -5036,7 +5036,7 @@ void SpazNode::Draw(FrameDef* frame_def) { c.PushTransform(); c.Translate(p_left * 0.5f, half_height); c.Scale(p_left, height); - c.DrawModel(g_media->GetModel(SystemModelID::kImage1x1)); + c.DrawModel(g_assets->GetModel(SystemModelID::kImage1x1)); c.PopTransform(); if (dead_ && scene()->stepnum() % 10 < 5) { @@ -5048,7 +5048,7 @@ void SpazNode::Draw(FrameDef* frame_def) { c.PushTransform(); c.Translate((p_left + p_right) * 0.5f, half_height); c.Scale(p_right - p_left, height); - c.DrawModel(g_media->GetModel(SystemModelID::kImage1x1)); + c.DrawModel(g_assets->GetModel(SystemModelID::kImage1x1)); c.PopTransform(); c.SetColor((dead_ && scene()->stepnum() % 10 < 5) ? 0.55f * o : 0.01f * o, @@ -5057,7 +5057,7 @@ void SpazNode::Draw(FrameDef* frame_def) { c.PushTransform(); c.Translate((p_right + 1.0f) * 0.5f, half_height); c.Scale(1.0f - p_right, height); - c.DrawModel(g_media->GetModel(SystemModelID::kImage1x1)); + c.DrawModel(g_assets->GetModel(SystemModelID::kImage1x1)); c.PopTransform(); c.PopTransform(); @@ -5098,7 +5098,7 @@ void SpazNode::Draw(FrameDef* frame_def) { c.SetColor(1, 1, 1, 1.0f); c.SetReflection(ReflectionType::kSoft); c.SetReflectionScale(0.4f, 0.4f, 0.4f); - c.SetTexture(g_media->GetTexture(SystemTextureID::kWings)); + c.SetTexture(g_assets->GetTexture(SystemTextureID::kWings)); // Fade to reddish on death. if (dead_ && !frozen_) { @@ -5118,14 +5118,14 @@ void SpazNode::Draw(FrameDef* frame_def) { c.PushTransform(); c.Translate(p_wing_l[0], p_wing_l[1], p_wing_l[2]); c.Scale(0.05f, 0.05f, 0.05f); - c.DrawModel(g_media->GetModel(SystemModelID::kBox)); + c.DrawModel(g_assets->GetModel(SystemModelID::kBox)); c.PopTransform(); // Draw wing point. c.PushTransform(); c.Translate(wing_pos_left_.x, wing_pos_left_.y, wing_pos_left_.z); c.Scale(0.1f, 0.1f, 0.1f); - c.DrawModel(g_media->GetModel(SystemModelID::kBox)); + c.DrawModel(g_assets->GetModel(SystemModelID::kBox)); c.PopTransform(); // Draw target. @@ -5134,14 +5134,14 @@ void SpazNode::Draw(FrameDef* frame_def) { c.PushTransform(); c.Translate(p_wing_r[0], p_wing_r[1], p_wing_r[2]); c.Scale(0.05f, 0.05f, 0.05f); - c.DrawModel(g_media->GetModel(SystemModelID::kBox)); + c.DrawModel(g_assets->GetModel(SystemModelID::kBox)); c.PopTransform(); // Draw wing point. c.PushTransform(); c.Translate(wing_pos_right_.x, wing_pos_right_.y, wing_pos_right_.z); c.Scale(0.1f, 0.1f, 0.1f); - c.DrawModel(g_media->GetModel(SystemModelID::kBox)); + c.DrawModel(g_assets->GetModel(SystemModelID::kBox)); c.PopTransform(); } @@ -5167,7 +5167,7 @@ void SpazNode::Draw(FrameDef* frame_def) { if (death_scale != 1.0f) { c.Scale(death_scale, death_scale, death_scale); } - c.DrawModel(g_media->GetModel(SystemModelID::kWing)); + c.DrawModel(g_assets->GetModel(SystemModelID::kWing)); c.PopTransform(); Vector3f to_right_wing = wing_pos_right_ - torso_pos2; @@ -5185,7 +5185,7 @@ void SpazNode::Draw(FrameDef* frame_def) { if (death_scale != 1.0f) { c.Scale(death_scale, death_scale, death_scale); } - c.DrawModel(g_media->GetModel(SystemModelID::kWing)); + c.DrawModel(g_assets->GetModel(SystemModelID::kWing)); c.PopTransform(); c.Submit(); } @@ -5222,14 +5222,14 @@ void SpazNode::Draw(FrameDef* frame_def) { } } c.SetLightShadow(LightShadowType::kObject); - c.SetTexture(g_media->GetTexture(SystemTextureID::kBoxingGlove)); + c.SetTexture(g_assets->GetTexture(SystemTextureID::kBoxingGlove)); c.PushTransform(); c.TransformToBody(*lower_right_arm_body_); if (death_scale != 1.0f) { c.Scale(death_scale, death_scale, death_scale); } - c.DrawModel(g_media->GetModel(SystemModelID::kBoxingGlove)); + c.DrawModel(g_assets->GetModel(SystemModelID::kBoxingGlove)); c.PopTransform(); c.FlipCullFace(); @@ -5239,7 +5239,7 @@ void SpazNode::Draw(FrameDef* frame_def) { if (death_scale != 1.0f) { c.Scale(death_scale, death_scale, death_scale); } - c.DrawModel(g_media->GetModel(SystemModelID::kBoxingGlove)); + c.DrawModel(g_assets->GetModel(SystemModelID::kBoxingGlove)); c.FlipCullFace(); c.PopTransform(); c.Submit(); @@ -6149,7 +6149,7 @@ void SpazNode::SetCurseDeathTime(millisecs_t val) { const dReal* p_head = dGeomGetPosition(body_head_->geom()); s->SetPosition(p_head[0], p_head[1], p_head[2]); tick_play_id_ = - s->Play(g_media->GetSound(SystemSoundID::kTickingCrazy)); + s->Play(g_assets->GetSound(SystemSoundID::kTickingCrazy)); s->End(); } } diff --git a/src/ballistica/scene/node/terrain_node.cc b/src/ballistica/scene/node/terrain_node.cc index 338975f6..b8b831ad 100644 --- a/src/ballistica/scene/node/terrain_node.cc +++ b/src/ballistica/scene/node/terrain_node.cc @@ -2,10 +2,10 @@ #include "ballistica/scene/node/terrain_node.h" +#include "ballistica/assets/component/collide_model.h" #include "ballistica/dynamics/bg/bg_dynamics.h" #include "ballistica/dynamics/material/material.h" #include "ballistica/graphics/component/object_component.h" -#include "ballistica/media/component/collide_model.h" #include "ballistica/scene/node/node_attribute.h" #include "ballistica/scene/node/node_type.h" #include "ballistica/scene/scene.h" diff --git a/src/ballistica/scene/node/texture_sequence_node.cc b/src/ballistica/scene/node/texture_sequence_node.cc index 6644f9dd..e5bc8821 100644 --- a/src/ballistica/scene/node/texture_sequence_node.cc +++ b/src/ballistica/scene/node/texture_sequence_node.cc @@ -2,7 +2,7 @@ #include "ballistica/scene/node/texture_sequence_node.h" -#include "ballistica/media/component/texture.h" +#include "ballistica/assets/component/texture.h" #include "ballistica/scene/node/node_attribute.h" #include "ballistica/scene/node/node_type.h" #include "ballistica/scene/scene.h" diff --git a/src/ballistica/scene/scene.cc b/src/ballistica/scene/scene.cc index 9bc1d71a..39fc3544 100644 --- a/src/ballistica/scene/scene.cc +++ b/src/ballistica/scene/scene.cc @@ -3,6 +3,7 @@ #include "ballistica/scene/scene.h" #include "ballistica/app/app.h" +#include "ballistica/assets/component/sound.h" #include "ballistica/audio/audio.h" #include "ballistica/dynamics/bg/bg_dynamics.h" #include "ballistica/dynamics/dynamics.h" @@ -12,7 +13,6 @@ #include "ballistica/graphics/camera.h" #include "ballistica/graphics/graphics.h" #include "ballistica/input/device/input_device.h" -#include "ballistica/media/component/sound.h" #include "ballistica/networking/networking.h" #include "ballistica/python/python_context_call.h" #include "ballistica/scene/node/anim_curve_node.h" diff --git a/src/ballistica/ui/console.cc b/src/ballistica/ui/console.cc index cc9ffc5a..a40bcec0 100644 --- a/src/ballistica/ui/console.cc +++ b/src/ballistica/ui/console.cc @@ -153,7 +153,7 @@ void Console::ToggleState() { state_ = State::kInactive; break; } - g_audio->PlaySound(g_media->GetSound(SystemSoundID::kBlip)); + g_audio->PlaySound(g_assets->GetSound(SystemSoundID::kBlip)); transition_start_ = GetRealTime(); } @@ -312,7 +312,7 @@ void Console::Draw(RenderPass* pass) { c.Translate(19.0f + g_text_graphics->GetStringWidth(input_string_) * 0.5f, bottom + 23.0f, kConsoleZDepth); c.Scale(5, 11, 1.0f); - c.DrawModel(g_media->GetModel(SystemModelID::kImage1x1)); + c.DrawModel(g_assets->GetModel(SystemModelID::kImage1x1)); c.PopTransform(); c.Submit(); } diff --git a/src/ballistica/ui/root_ui.cc b/src/ballistica/ui/root_ui.cc index 7b1e4705..8f13411b 100644 --- a/src/ballistica/ui/root_ui.cc +++ b/src/ballistica/ui/root_ui.cc @@ -176,7 +176,7 @@ void RootUI::Draw(FrameDef* frame_def) { if (draw_menu_button) { SimpleComponent c(frame_def->overlay_pass()); c.SetTransparent(true); - c.SetTexture(g_media->GetTexture(SystemTextureID::kMenuButton)); + c.SetTexture(g_assets->GetTexture(SystemTextureID::kMenuButton)); // Draw menu button. float width = g_graphics->screen_virtual_width(); @@ -191,7 +191,7 @@ void RootUI::Draw(FrameDef* frame_def) { c.Translate(width - menu_button_size_ * 0.5f, height - menu_button_size_ * 0.38f, kMenuButtonDrawDepth); c.Scale(menu_button_size_ * 0.8f, menu_button_size_ * 0.8f); - c.DrawModel(g_media->GetModel(SystemModelID::kImage1x1)); + c.DrawModel(g_assets->GetModel(SystemModelID::kImage1x1)); c.PopTransform(); c.Submit(); } @@ -224,7 +224,7 @@ void RootUI::Draw(FrameDef* frame_def) { SimpleComponent c(frame_def->overlay_pass()); c.SetTransparent(true); - c.SetTexture(g_media->GetTexture(SystemTextureID::kUsersButton)); + c.SetTexture(g_assets->GetTexture(SystemTextureID::kUsersButton)); // Draw button. float width = g_graphics->screen_virtual_width(); @@ -245,7 +245,7 @@ void RootUI::Draw(FrameDef* frame_def) { if (flash && frame_def->base_time() % 250 < 125) { c.SetColor(1.0f, 1.4f, 1.0f); } - c.DrawModel(g_media->GetModel(SystemModelID::kImage1x1)); + c.DrawModel(g_assets->GetModel(SystemModelID::kImage1x1)); c.PopTransform(); c.Submit(); diff --git a/src/ballistica/ui/ui.cc b/src/ballistica/ui/ui.cc index 967a96a9..d0cf6d51 100644 --- a/src/ballistica/ui/ui.cc +++ b/src/ballistica/ui/ui.cc @@ -3,13 +3,13 @@ #include "ballistica/ui/ui.h" #include "ballistica/app/app.h" +#include "ballistica/assets/component/data.h" +#include "ballistica/assets/component/sound.h" #include "ballistica/audio/audio.h" #include "ballistica/generic/lambda_runnable.h" #include "ballistica/graphics/component/empty_component.h" #include "ballistica/input/device/input_device.h" #include "ballistica/input/input.h" -#include "ballistica/media/component/data.h" -#include "ballistica/media/component/sound.h" #include "ballistica/python/python.h" #include "ballistica/scene/scene.h" #include "ballistica/ui/root_ui.h" @@ -292,7 +292,7 @@ auto UI::GetWidgetForInput(InputDevice* input_device) -> Widget* { // they're not the chosen one. if (time - last_widget_input_reject_err_sound_time_ > 5000) { last_widget_input_reject_err_sound_time_ = time; - g_audio->PlaySound(g_media->GetSound(SystemSoundID::kErrorBeep)); + g_audio->PlaySound(g_assets->GetSound(SystemSoundID::kErrorBeep)); print_menu_owner = true; } ret_val = nullptr; // Rejected! @@ -341,19 +341,19 @@ auto UI::GetWidgetForInput(InputDevice* input_device) -> Widget* { } auto UI::GetModel(const std::string& name) -> Object::Ref { - return Media::GetMedia(&models_, name, scene()); + return Assets::GetAsset(&models_, name, scene()); } auto UI::GetTexture(const std::string& name) -> Object::Ref { - return Media::GetMedia(&textures_, name, scene()); + return Assets::GetAsset(&textures_, name, scene()); } auto UI::GetSound(const std::string& name) -> Object::Ref { - return Media::GetMedia(&sounds_, name, scene()); + return Assets::GetAsset(&sounds_, name, scene()); } auto UI::GetData(const std::string& name) -> Object::Ref { - return Media::GetMedia(&datas_, name, scene()); + return Assets::GetAsset(&datas_, name, scene()); } auto UI::GetAsUIContext() -> UI* { return this; } diff --git a/src/ballistica/ui/widget/button_widget.cc b/src/ballistica/ui/widget/button_widget.cc index 434c47ef..de09fb05 100644 --- a/src/ballistica/ui/widget/button_widget.cc +++ b/src/ballistica/ui/widget/button_widget.cc @@ -262,7 +262,7 @@ void ButtonWidget::Draw(RenderPass* pass, bool draw_transparent) { // Custom button texture. if (texture_.exists()) { if (!custom_model.exists()) { - model = g_media->GetModel(SystemModelID::kImage1x1); + model = g_assets->GetModel(SystemModelID::kImage1x1); } else { model = custom_model->model_data(); } @@ -374,8 +374,8 @@ void ButtonWidget::Draw(RenderPass* pass, bool draw_transparent) { break; } } - c.SetTexture(g_media->GetTexture(tex_id)); - model = g_media->GetModel(model_id); + c.SetTexture(g_assets->GetTexture(tex_id)); + model = g_assets->GetModel(model_id); } if (doDraw) { c.PushTransform(); @@ -392,20 +392,20 @@ void ButtonWidget::Draw(RenderPass* pass, bool draw_transparent) { if (icon_type_ == IconType::kStart) { c.SetColor(1.4f * mult * (color_red_), 1.4f * mult * (color_green_), 1.4f * mult * (color_blue_), 1.0f); - c.SetTexture(g_media->GetTexture(SystemTextureID::kStartButton)); + c.SetTexture(g_assets->GetTexture(SystemTextureID::kStartButton)); } else if (icon_type_ == IconType::kCancel) { if (remote_icons) { c.SetColor(1.0f * mult * (1.0f), 1.0f * mult * (1.0f), 1.0f * mult * (1.0f), 1.0f); - c.SetTexture(g_media->GetTexture(SystemTextureID::kBackIcon)); + c.SetTexture(g_assets->GetTexture(SystemTextureID::kBackIcon)); } else if (ouya_icons) { c.SetColor(1.0f * mult * (1.0f), 1.0f * mult * (1.0f), 1.0f * mult * (1.0f), 1.0f); - c.SetTexture(g_media->GetTexture(SystemTextureID::kOuyaAButton)); + c.SetTexture(g_assets->GetTexture(SystemTextureID::kOuyaAButton)); } else { c.SetColor(1.5f * mult * (color_red_), 1.5f * mult * (color_green_), 1.5f * mult * (color_blue_), 1.0f); - c.SetTexture(g_media->GetTexture(SystemTextureID::kBombButton)); + c.SetTexture(g_assets->GetTexture(SystemTextureID::kBombButton)); } } else if (icon_.exists()) { c.SetColor(icon_color_red_ @@ -425,7 +425,7 @@ void ButtonWidget::Draw(RenderPass* pass, bool draw_transparent) { } } else { c.SetColor(1, 1, 1); - c.SetTexture(g_media->GetTexture(SystemTextureID::kCircle)); + c.SetTexture(g_assets->GetTexture(SystemTextureID::kCircle)); } if (doDrawIcon) { c.PushTransform(); @@ -433,7 +433,7 @@ void ButtonWidget::Draw(RenderPass* pass, bool draw_transparent) { - (string_width * string_scale) * 0.5f - 5.0f, (b + t) * 0.5f + extra_offs_y, 0.001f); c.Scale(34.0f * icon_scale_, 34.f * icon_scale_, 1.0f); - c.DrawModel(g_media->GetModel(SystemModelID::kImage1x1)); + c.DrawModel(g_assets->GetModel(SystemModelID::kImage1x1)); c.PopTransform(); } } @@ -565,11 +565,11 @@ void ButtonWidget::DoActivate(bool isRepeat) { if (sound_enabled_) { int r = rand() % 3; // NOLINT if (r == 0) { - g_audio->PlaySound(g_media->GetSound(SystemSoundID::kSwish)); + g_audio->PlaySound(g_assets->GetSound(SystemSoundID::kSwish)); } else if (r == 1) { - g_audio->PlaySound(g_media->GetSound(SystemSoundID::kSwish2)); + g_audio->PlaySound(g_assets->GetSound(SystemSoundID::kSwish2)); } else { - g_audio->PlaySound(g_media->GetSound(SystemSoundID::kSwish3)); + g_audio->PlaySound(g_assets->GetSound(SystemSoundID::kSwish3)); } } if (on_activate_call_.exists()) { diff --git a/src/ballistica/ui/widget/check_box_widget.cc b/src/ballistica/ui/widget/check_box_widget.cc index 13c8aaa4..f45ecafd 100644 --- a/src/ballistica/ui/widget/check_box_widget.cc +++ b/src/ballistica/ui/widget/check_box_widget.cc @@ -88,11 +88,11 @@ void CheckBoxWidget::Draw(RenderPass* pass, bool draw_transparent) { c.SetTransparent(true); c.SetPremultiplied(true); c.SetColor(0.25f * m, 0.3f * m, 0, 0.3f * m); - c.SetTexture(g_media->GetTexture(SystemTextureID::kGlow)); + c.SetTexture(g_assets->GetTexture(SystemTextureID::kGlow)); c.PushTransform(); c.Translate(highlight_center_x_, highlight_center_y_); c.Scale(highlight_width_, highlight_height_); - c.DrawModel(g_media->GetModel(SystemModelID::kImage4x1)); + c.DrawModel(g_assets->GetModel(SystemModelID::kImage4x1)); c.PopTransform(); c.Submit(); } @@ -132,14 +132,14 @@ void CheckBoxWidget::Draw(RenderPass* pass, bool draw_transparent) { c.SetTransparent(draw_transparent); c.SetColor(glow_amt * color_r_, glow_amt * color_g_, glow_amt * color_b_, 1); - c.SetTexture(g_media->GetTexture(SystemTextureID::kUIAtlas)); + c.SetTexture(g_assets->GetTexture(SystemTextureID::kUIAtlas)); c.PushTransform(); c.Translate(box_center_x_ + extra_offs_x, box_center_y_ + extra_offs_y, 0.1f); c.Scale(box_width_, box_height_, 0.4f); - c.DrawModel(g_media->GetModel(draw_transparent - ? SystemModelID::kButtonSmallTransparent - : SystemModelID::kButtonSmallOpaque)); + c.DrawModel(g_assets->GetModel( + draw_transparent ? SystemModelID::kButtonSmallTransparent + : SystemModelID::kButtonSmallOpaque)); c.PopTransform(); c.Submit(); } @@ -171,9 +171,9 @@ void CheckBoxWidget::Draw(RenderPass* pass, bool draw_transparent) { SimpleComponent c(pass); c.SetTransparent(draw_transparent); if (is_radio_button_) { - c.SetTexture(g_media->GetTexture(SystemTextureID::kNub)); + c.SetTexture(g_assets->GetTexture(SystemTextureID::kNub)); } else { - c.SetTexture(g_media->GetTexture(SystemTextureID::kUIAtlas)); + c.SetTexture(g_assets->GetTexture(SystemTextureID::kUIAtlas)); } if (mouse_over_ && g_platform->IsRunningOnDesktop()) { @@ -188,12 +188,12 @@ void CheckBoxWidget::Draw(RenderPass* pass, bool draw_transparent) { check_center_y_ + 2 + 3.0f * extra_offs_y, 0.5f); c.Scale(check_width_ * 0.45f, check_height_ * 0.45f, 0.5f); c.Translate(-0.17f, -0.17f, 0.5f); - c.DrawModel(g_media->GetModel(SystemModelID::kImage1x1)); + c.DrawModel(g_assets->GetModel(SystemModelID::kImage1x1)); } else { c.Translate(check_center_x_ + 3.0f * extra_offs_x, check_center_y_ + 3.0f * extra_offs_y, 0.5f); c.Scale(check_width_, check_height_, 0.5f); - c.DrawModel(g_media->GetModel(SystemModelID::kCheckTransparent)); + c.DrawModel(g_assets->GetModel(SystemModelID::kCheckTransparent)); } c.PopTransform(); c.Submit(); @@ -235,7 +235,7 @@ void CheckBoxWidget::SetValue(bool value) { } void CheckBoxWidget::Activate() { - g_audio->PlaySound(g_media->GetSound(SystemSoundID::kSwish3)); + g_audio->PlaySound(g_assets->GetSound(SystemSoundID::kSwish3)); checked_ = !checked_; check_dirty_ = true; last_change_time_ = GetRealTime(); diff --git a/src/ballistica/ui/widget/container_widget.cc b/src/ballistica/ui/widget/container_widget.cc index 2cc0edb6..dbd41b05 100644 --- a/src/ballistica/ui/widget/container_widget.cc +++ b/src/ballistica/ui/widget/container_widget.cc @@ -596,7 +596,7 @@ auto ContainerWidget::HandleMessage(const WidgetMessage& m) -> bool { // First click just selects. if (click_count == 1) { - g_audio->PlaySound(g_media->GetSound(SystemSoundID::kTap)); + g_audio->PlaySound(g_assets->GetSound(SystemSoundID::kTap)); } } else { // Special case: If we've got a child text widget that's @@ -948,7 +948,7 @@ void ContainerWidget::Draw(RenderPass* pass, bool draw_transparent) { bg_center_x_ = l - l_border + bg_width_ * 0.5f; bg_center_y_ = b - b_border + bg_height_ * 0.5f; if (background_) { - tex_ = g_media->GetTexture(tex_id); + tex_ = g_assets->GetTexture(tex_id); } bg_dirty_ = false; } @@ -974,8 +974,8 @@ void ContainerWidget::Draw(RenderPass* pass, bool draw_transparent) { c.PushTransform(); c.Translate(bg_center_x_, bg_center_y_); c.Scale(bg_width_ * transition_scale_, bg_height_ * transition_scale_); - c.DrawModel(g_media->GetModel(draw_transparent ? bg_model_transparent_i_d_ - : bg_model_opaque_i_d_)); + c.DrawModel(g_assets->GetModel( + draw_transparent ? bg_model_transparent_i_d_ : bg_model_opaque_i_d_)); c.PopTransform(); c.Submit(); } @@ -1005,12 +1005,12 @@ void ContainerWidget::Draw(RenderPass* pass, bool draw_transparent) { SimpleComponent c(pass); c.SetTransparent(true); c.SetPremultiplied(true); - c.SetTexture(g_media->GetTexture(SystemTextureID::kGlow)); + c.SetTexture(g_assets->GetTexture(SystemTextureID::kGlow)); c.SetColor(0.25f * m, 0.25f * m, 0, 0.3f * m); c.PushTransform(); c.Translate(glow_center_x_, glow_center_y_); c.Scale(glow_width_, glow_height_); - c.DrawModel(g_media->GetModel(SystemModelID::kImage4x1)); + c.DrawModel(g_assets->GetModel(SystemModelID::kImage4x1)); c.PopTransform(); c.Submit(); } @@ -1582,7 +1582,7 @@ void ContainerWidget::SelectDownWidget() { // Avoid tap sounds and whatnot if we're just re-selecting ourself. if (w != selected_widget_) { w->GlobalSelect(); - g_audio->PlaySound(g_media->GetSound(SystemSoundID::kTap)); + g_audio->PlaySound(g_assets->GetSound(SystemSoundID::kTap)); } } } else { @@ -1646,7 +1646,7 @@ void ContainerWidget::SelectUpWidget() { // Avoid tap sounds and whatnot if we're just re-selecting ourself. if (w != selected_widget_) { w->GlobalSelect(); - g_audio->PlaySound(g_media->GetSound(SystemSoundID::kTap)); + g_audio->PlaySound(g_assets->GetSound(SystemSoundID::kTap)); } } } else { @@ -1697,7 +1697,7 @@ void ContainerWidget::SelectLeftWidget() { // Avoid tap sounds and whatnot if we're just re-selecting ourself. if (w != selected_widget_) { w->GlobalSelect(); - g_audio->PlaySound(g_media->GetSound(SystemSoundID::kTap)); + g_audio->PlaySound(g_assets->GetSound(SystemSoundID::kTap)); } } } else { @@ -1748,7 +1748,7 @@ void ContainerWidget::SelectRightWidget() { // Avoid tap sounds and whatnot if we're just re-selecting ourself. if (w != selected_widget_) { w->GlobalSelect(); - g_audio->PlaySound(g_media->GetSound(SystemSoundID::kTap)); + g_audio->PlaySound(g_assets->GetSound(SystemSoundID::kTap)); } } } else { @@ -1828,7 +1828,7 @@ void ContainerWidget::SelectNextWidget() { } if ((**i).IsSelectable() && (**i).IsSelectableViaKeys()) { SelectWidget(&(**i), SelectionCause::NEXT_SELECTED); - g_audio->PlaySound(g_media->GetSound(SystemSoundID::kTap)); + g_audio->PlaySound(g_assets->GetSound(SystemSoundID::kTap)); return; } i++; @@ -1843,7 +1843,7 @@ void ContainerWidget::PrintExitListInstructions( if ((t - old_last_prev_next_time > 250) && (t - last_list_exit_instructions_print_time_ > 5000)) { last_list_exit_instructions_print_time_ = t; - g_audio->PlaySound(g_media->GetSound(SystemSoundID::kErrorBeep)); + g_audio->PlaySound(g_assets->GetSound(SystemSoundID::kErrorBeep)); std::string s = g_game->GetResourceString("arrowsToExitListText"); { // Left arrow. @@ -1915,7 +1915,7 @@ void ContainerWidget::SelectPrevWidget() { if ((**i).IsSelectable() && (**i).IsSelectableViaKeys()) { SelectWidget(&(**i), SelectionCause::PREV_SELECTED); - g_audio->PlaySound(g_media->GetSound(SystemSoundID::kTap)); + g_audio->PlaySound(g_assets->GetSound(SystemSoundID::kTap)); return; } i++; diff --git a/src/ballistica/ui/widget/h_scroll_widget.cc b/src/ballistica/ui/widget/h_scroll_widget.cc index d23164db..27aecc66 100644 --- a/src/ballistica/ui/widget/h_scroll_widget.cc +++ b/src/ballistica/ui/widget/h_scroll_widget.cc @@ -625,12 +625,12 @@ void HScrollWidget::Draw(RenderPass* pass, bool draw_transparent) { SimpleComponent c(pass); c.SetTransparent(true); c.SetColor(1, 1, 1, border_opacity_); - c.SetTexture(g_media->GetTexture(SystemTextureID::kUIAtlas)); + c.SetTexture(g_assets->GetTexture(SystemTextureID::kUIAtlas)); c.PushTransform(); c.Translate(trough_center_x_, trough_center_y_, 0.7f); c.Scale(trough_width_, trough_height_, 0.1f); c.Rotate(-90, 0, 0, 1); - c.DrawModel(g_media->GetModel(SystemModelID::kScrollBarTroughTransparent)); + c.DrawModel(g_assets->GetModel(SystemModelID::kScrollBarTroughTransparent)); c.PopTransform(); c.Submit(); } @@ -710,20 +710,21 @@ void HScrollWidget::Draw(RenderPass* pass, bool draw_transparent) { // on touch, just draw these transiently #if 1 if (draw_transparent) { - c.DrawModel(g_media->GetModel( + c.DrawModel(g_assets->GetModel( sb_thumb_width > 100 ? SystemModelID::kScrollBarThumbSimple : SystemModelID::kScrollBarThumbShortSimple)); } #else if (draw_transparent) { - c.DrawModel(g_media->GetModel( + c.DrawModel(g_assets->GetModel( sb_thumb_width > 100 - ? Media::SCROLL_BAR_THUMB_TRANSPARENT_MODEL - : Media::SCROLL_BAR_THUMB_SHORT_TRANSPARENT_MODEL)); + ? Assets::SCROLL_BAR_THUMB_TRANSPARENT_MODEL + : Assets::SCROLL_BAR_THUMB_SHORT_TRANSPARENT_MODEL)); } else { - c.DrawModel(g_media->GetModel( - sb_thumb_width > 100 ? Media::SCROLL_BAR_THUMB_OPAQUE_MODEL - : Media::SCROLL_BAR_THUMB_SHORT_OPAQUE_MODEL)); + c.DrawModel(g_assets->GetModel( + sb_thumb_width > 100 + ? Assets::SCROLL_BAR_THUMB_OPAQUE_MODEL + : Assets::SCROLL_BAR_THUMB_SHORT_OPAQUE_MODEL)); } #endif @@ -755,11 +756,11 @@ void HScrollWidget::Draw(RenderPass* pass, bool draw_transparent) { SimpleComponent c(pass); c.SetTransparent(true); c.SetColor(1, 1, 1, border_opacity_); - c.SetTexture(g_media->GetTexture(SystemTextureID::kScrollWidget)); + c.SetTexture(g_assets->GetTexture(SystemTextureID::kScrollWidget)); c.PushTransform(); c.Translate(outline_center_x_, outline_center_y_, 0.9f); c.Scale(outline_width_, outline_height_, 0.1f); - c.DrawModel(g_media->GetModel(SystemModelID::kSoftEdgeOutside)); + c.DrawModel(g_assets->GetModel(SystemModelID::kSoftEdgeOutside)); c.PopTransform(); c.Submit(); } @@ -792,11 +793,11 @@ void HScrollWidget::Draw(RenderPass* pass, bool draw_transparent) { c.SetTransparent(true); c.SetPremultiplied(true); c.SetColor(0.4f * m, 0.5f * m, 0.05f * m, 0.0f); - c.SetTexture(g_media->GetTexture(SystemTextureID::kScrollWidgetGlow)); + c.SetTexture(g_assets->GetTexture(SystemTextureID::kScrollWidgetGlow)); c.PushTransform(); c.Translate(glow_center_x_, glow_center_y_, 0.9f); c.Scale(glow_width_, glow_height_, 0.1f); - c.DrawModel(g_media->GetModel(SystemModelID::kSoftEdgeOutside)); + c.DrawModel(g_assets->GetModel(SystemModelID::kSoftEdgeOutside)); c.PopTransform(); c.Submit(); } diff --git a/src/ballistica/ui/widget/image_widget.cc b/src/ballistica/ui/widget/image_widget.cc index 3dd117a7..75c63b86 100644 --- a/src/ballistica/ui/widget/image_widget.cc +++ b/src/ballistica/ui/widget/image_widget.cc @@ -70,13 +70,13 @@ void ImageWidget::Draw(RenderPass* pass, bool draw_transparent) { draw_radial_transparent = true; } else { model_transparent_used = - g_media->GetModel(SystemModelID::kImage1x1); + g_assets->GetModel(SystemModelID::kImage1x1); } } else { if (radial_amount_ < 1.0f) { draw_radial_opaque = true; } else { - model_opaque_used = g_media->GetModel(SystemModelID::kImage1x1); + model_opaque_used = g_assets->GetModel(SystemModelID::kImage1x1); } } } diff --git a/src/ballistica/ui/widget/image_widget.h b/src/ballistica/ui/widget/image_widget.h index 00979437..18dc66a2 100644 --- a/src/ballistica/ui/widget/image_widget.h +++ b/src/ballistica/ui/widget/image_widget.h @@ -5,8 +5,8 @@ #include -#include "ballistica/media/component/model.h" -#include "ballistica/media/component/texture.h" +#include "ballistica/assets/component/model.h" +#include "ballistica/assets/component/texture.h" #include "ballistica/ui/widget/widget.h" namespace ballistica { diff --git a/src/ballistica/ui/widget/scroll_widget.cc b/src/ballistica/ui/widget/scroll_widget.cc index d479ac94..3e9ba042 100644 --- a/src/ballistica/ui/widget/scroll_widget.cc +++ b/src/ballistica/ui/widget/scroll_widget.cc @@ -696,11 +696,11 @@ void ScrollWidget::Draw(RenderPass* pass, bool draw_transparent) { SimpleComponent c(pass); c.SetTransparent(true); c.SetColor(1, 1, 1, border_opacity_); - c.SetTexture(g_media->GetTexture(SystemTextureID::kUIAtlas)); + c.SetTexture(g_assets->GetTexture(SystemTextureID::kUIAtlas)); c.PushTransform(); c.Translate(trough_center_x_, trough_center_y_, 0.7f); c.Scale(trough_width_, trough_height_, 0.1f); - c.DrawModel(g_media->GetModel(SystemModelID::kScrollBarTroughTransparent)); + c.DrawModel(g_assets->GetModel(SystemModelID::kScrollBarTroughTransparent)); c.PopTransform(); c.Submit(); } @@ -748,19 +748,19 @@ void ScrollWidget::Draw(RenderPass* pass, bool draw_transparent) { c.SetColor(color_red_ * c_scale, color_green_ * c_scale, color_blue_ * c_scale, 1.0f); - c.SetTexture(g_media->GetTexture(SystemTextureID::kUIAtlas)); + c.SetTexture(g_assets->GetTexture(SystemTextureID::kUIAtlas)); c.ScissorPush(Rect(l + border_width_, b + border_height_ + 1, l + (width()), b + (height() * 0.995f))); c.PushTransform(); c.Translate(thumb_center_x_, thumb_center_y_, 0.8f); c.Scale(thumb_width_, thumb_height_, 0.1f); if (draw_transparent) { - c.DrawModel(g_media->GetModel( + c.DrawModel(g_assets->GetModel( sb_thumb_height > 100 ? SystemModelID::kScrollBarThumbTransparent : SystemModelID::kScrollBarThumbShortTransparent)); } else { - c.DrawModel(g_media->GetModel( + c.DrawModel(g_assets->GetModel( sb_thumb_height > 100 ? SystemModelID::kScrollBarThumbOpaque : SystemModelID::kScrollBarThumbShortOpaque)); } @@ -791,11 +791,11 @@ void ScrollWidget::Draw(RenderPass* pass, bool draw_transparent) { SimpleComponent c(pass); c.SetTransparent(true); c.SetColor(1, 1, 1, border_opacity_); - c.SetTexture(g_media->GetTexture(SystemTextureID::kScrollWidget)); + c.SetTexture(g_assets->GetTexture(SystemTextureID::kScrollWidget)); c.PushTransform(); c.Translate(outline_center_x_, outline_center_y_, 0.9f); c.Scale(outline_width_, outline_height_, 0.1f); - c.DrawModel(g_media->GetModel(SystemModelID::kSoftEdgeOutside)); + c.DrawModel(g_assets->GetModel(SystemModelID::kSoftEdgeOutside)); c.PopTransform(); c.Submit(); } @@ -827,11 +827,11 @@ void ScrollWidget::Draw(RenderPass* pass, bool draw_transparent) { c.SetTransparent(true); c.SetPremultiplied(true); c.SetColor(0.4f * m, 0.5f * m, 0.05f * m, 0.0f); - c.SetTexture(g_media->GetTexture(SystemTextureID::kScrollWidgetGlow)); + c.SetTexture(g_assets->GetTexture(SystemTextureID::kScrollWidgetGlow)); c.PushTransform(); c.Translate(glow_center_x_, glow_center_y_, 0.9f); c.Scale(glow_width_, glow_height_, 0.1f); - c.DrawModel(g_media->GetModel(SystemModelID::kSoftEdgeOutside)); + c.DrawModel(g_assets->GetModel(SystemModelID::kSoftEdgeOutside)); c.PopTransform(); c.Submit(); } diff --git a/src/ballistica/ui/widget/text_widget.cc b/src/ballistica/ui/widget/text_widget.cc index 064d3323..795a009d 100644 --- a/src/ballistica/ui/widget/text_widget.cc +++ b/src/ballistica/ui/widget/text_widget.cc @@ -177,11 +177,11 @@ void TextWidget::Draw(RenderPass* pass, bool draw_transparent) { c.SetTransparent(true); c.SetPremultiplied(true); c.SetColor(0.25f * m, 0.3f * m, 0, 0.3f * m); - c.SetTexture(g_media->GetTexture(SystemTextureID::kGlow)); + c.SetTexture(g_assets->GetTexture(SystemTextureID::kGlow)); c.PushTransform(); c.Translate(highlight_center_x_, highlight_center_y_, 0.1f); c.Scale(highlight_width_, highlight_height_); - c.DrawModel(g_media->GetModel(SystemModelID::kImage4x1)); + c.DrawModel(g_assets->GetModel(SystemModelID::kImage4x1)); c.PopTransform(); c.Submit(); } @@ -202,11 +202,11 @@ void TextWidget::Draw(RenderPass* pass, bool draw_transparent) { SimpleComponent c(pass); c.SetTransparent(true); c.SetColor(1, 1, 1, 1); - c.SetTexture(g_media->GetTexture(SystemTextureID::kUIAtlas)); + c.SetTexture(g_assets->GetTexture(SystemTextureID::kUIAtlas)); c.PushTransform(); c.Translate(outline_center_x_, outline_center_y_, 0.1f); c.Scale(outline_width_, outline_height_); - c.DrawModel(g_media->GetModel(SystemModelID::kTextBoxTransparent)); + c.DrawModel(g_assets->GetModel(SystemModelID::kTextBoxTransparent)); c.PopTransform(); c.Submit(); } @@ -221,7 +221,7 @@ void TextWidget::Draw(RenderPass* pass, bool draw_transparent) { } else { c.SetColor(0.5f, 0.5f, 0.5f, 1); } - c.SetTexture(g_media->GetTexture(SystemTextureID::kTextClearButton)); + c.SetTexture(g_assets->GetTexture(SystemTextureID::kTextClearButton)); c.PushTransform(); c.Translate(r - 20, b * 0.5f + t * 0.5f, 0.1f); if (g_ui->scale() == UIScale::kSmall) { @@ -229,7 +229,7 @@ void TextWidget::Draw(RenderPass* pass, bool draw_transparent) { } else { c.Scale(25, 25); } - c.DrawModel(g_media->GetModel(SystemModelID::kImage1x1)); + c.DrawModel(g_assets->GetModel(SystemModelID::kImage1x1)); c.PopTransform(); c.Submit(); } @@ -401,10 +401,10 @@ void TextWidget::Draw(RenderPass* pass, bool draw_transparent) { c.Scale(max_width_height_scale, max_width_height_scale); c.Translate(h + 4, v + 17.0f); c.Scale(6, 27); - c.DrawModel(g_media->GetModel(SystemModelID::kImage1x1)); + c.DrawModel(g_assets->GetModel(SystemModelID::kImage1x1)); c.SetColor(1, 1, 1, 0); c.Scale(0.3f, 0.8f); - c.DrawModel(g_media->GetModel(SystemModelID::kImage1x1)); + c.DrawModel(g_assets->GetModel(SystemModelID::kImage1x1)); c.PopTransform(); c.Submit(); } @@ -617,7 +617,7 @@ auto TextWidget::HandleMessage(const WidgetMessage& m) -> bool { case SDLK_KP_ENTER: if (g_buildconfig.ostype_ios_tvos() || g_buildconfig.ostype_android()) { // On mobile, return currently just deselects us. - g_audio->PlaySound(g_media->GetSound(SystemSoundID::kSwish)); + g_audio->PlaySound(g_assets->GetSound(SystemSoundID::kSwish)); parent_widget()->SelectWidget(nullptr); return true; } else { @@ -838,7 +838,7 @@ auto TextWidget::HandleMessage(const WidgetMessage& m) -> bool { pressed_activate_ = (click_count == 2 || click_activate_) && !editable_; if (click_count == 1) { - g_audio->PlaySound(g_media->GetSound(SystemSoundID::kTap)); + g_audio->PlaySound(g_assets->GetSound(SystemSoundID::kTap)); } } return true; @@ -861,7 +861,7 @@ auto TextWidget::HandleMessage(const WidgetMessage& m) -> bool { carat_position_ = 0; text_group_dirty_ = true; clear_pressed_ = false; - g_audio->PlaySound(g_media->GetSound(SystemSoundID::kTap)); + g_audio->PlaySound(g_assets->GetSound(SystemSoundID::kTap)); return true; } clear_pressed_ = false;