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