mirror of
https://github.com/RYDE-WORK/ballistica.git
synced 2026-02-05 06:53:18 +08:00
tidying dev-console ui controls
This commit is contained in:
parent
7122180847
commit
fd16eade8d
56
.efrocachemap
generated
56
.efrocachemap
generated
@ -4096,26 +4096,26 @@
|
|||||||
"build/assets/windows/Win32/ucrtbased.dll": "2def5335207d41b21b9823f6805997f1",
|
"build/assets/windows/Win32/ucrtbased.dll": "2def5335207d41b21b9823f6805997f1",
|
||||||
"build/assets/windows/Win32/vc_redist.x86.exe": "b08a55e2e77623fe657bea24f223a3ae",
|
"build/assets/windows/Win32/vc_redist.x86.exe": "b08a55e2e77623fe657bea24f223a3ae",
|
||||||
"build/assets/windows/Win32/vcruntime140d.dll": "865b2af4d1e26a1a8073c89acb06e599",
|
"build/assets/windows/Win32/vcruntime140d.dll": "865b2af4d1e26a1a8073c89acb06e599",
|
||||||
"build/prefab/full/linux_arm64_gui/debug/ballisticakit": "8e1c1a6865e87aa0c5a02e65ac3bb8ec",
|
"build/prefab/full/linux_arm64_gui/debug/ballisticakit": "95dd83eeba34a46aae069cf53222cf26",
|
||||||
"build/prefab/full/linux_arm64_gui/release/ballisticakit": "25f7b1b98a98bb2a3e7b5e12362808cb",
|
"build/prefab/full/linux_arm64_gui/release/ballisticakit": "3ea066eb5a531ac568ea7ddae3f06d74",
|
||||||
"build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "a8573cbcbe45d27f715c25d4394a23fd",
|
"build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "b2947b0b5befc5a49c6ffb6e8e4fadaa",
|
||||||
"build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "98b5f12ea27a9af8827b768143e7edb5",
|
"build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "fd993504ac5e887197ddc801a08fa067",
|
||||||
"build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "1ced073c261bb7f4cac0a54b6472b508",
|
"build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "231c01850994ee9c96f322b6bec55112",
|
||||||
"build/prefab/full/linux_x86_64_gui/release/ballisticakit": "4621ac4aa53d2babf5c67ee13f417e79",
|
"build/prefab/full/linux_x86_64_gui/release/ballisticakit": "15ae4cfab312216ce326fd513a7a72c9",
|
||||||
"build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "587ac9f0678caf5d0b7479bffe50db08",
|
"build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "0a75e93a21ffb4cf4b888289188e6cb2",
|
||||||
"build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "d20e0fa4d8fd8304b91fd8c3270bf499",
|
"build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "f2e1c250004f0f028a93f4497ae82dfd",
|
||||||
"build/prefab/full/mac_arm64_gui/debug/ballisticakit": "1b3aee01e605c52a6ddafdc77b701e0e",
|
"build/prefab/full/mac_arm64_gui/debug/ballisticakit": "50653816eac879c6e0d0787ffec6045c",
|
||||||
"build/prefab/full/mac_arm64_gui/release/ballisticakit": "ed2d598a1de3249179b752b1bf3c75a8",
|
"build/prefab/full/mac_arm64_gui/release/ballisticakit": "91aa009738cbd48525048f3050c496e6",
|
||||||
"build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "99e743acc7b9d8d5d849395e0ee726eb",
|
"build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "b72e781565fbfe06848f6c38c65691ff",
|
||||||
"build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "d774b4a8a18083262846d41f2db544ea",
|
"build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "252ebec577b0dd2accf3bc0d35d7974e",
|
||||||
"build/prefab/full/mac_x86_64_gui/debug/ballisticakit": "cf4c11956d06b23583cfad2e946b1502",
|
"build/prefab/full/mac_x86_64_gui/debug/ballisticakit": "d9e2e578711787da9627acc4be514430",
|
||||||
"build/prefab/full/mac_x86_64_gui/release/ballisticakit": "38a6b5eaa4ef30f400f72b71f69cdd6e",
|
"build/prefab/full/mac_x86_64_gui/release/ballisticakit": "0a5e4d6b0c9278b4b6adb48b816bae2e",
|
||||||
"build/prefab/full/mac_x86_64_server/debug/dist/ballisticakit_headless": "982a33f7b34f0a2a95a4fe072c7ad561",
|
"build/prefab/full/mac_x86_64_server/debug/dist/ballisticakit_headless": "bf90751a34c9b11ed6b9b9a80a8e7ad2",
|
||||||
"build/prefab/full/mac_x86_64_server/release/dist/ballisticakit_headless": "dd0468ae96203b6af6529612a18e262a",
|
"build/prefab/full/mac_x86_64_server/release/dist/ballisticakit_headless": "8d0d41802c8daa56262a49db49f72094",
|
||||||
"build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "d9f152f41b712aa9969fad60d54a5dbd",
|
"build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "44286b725dbe9c9f03d8cd47b48e2ed1",
|
||||||
"build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "d569374c7e05a01fdd1bfb2b8f622b71",
|
"build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "f58bc022f7ef2c64cbe5ac395c928552",
|
||||||
"build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "703229ffb3bd1e0dd025225bad85d90c",
|
"build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "50995542eb1479baeb19454f2f4c73e4",
|
||||||
"build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "3dcf01a911a98b1d01bbd8614e8bef8f",
|
"build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "fff08091342f8b0d0525df053d4d80e0",
|
||||||
"build/prefab/lib/linux_arm64_gui/debug/libballisticaplus.a": "73ad3303fe1a82005918fbc5dae3446c",
|
"build/prefab/lib/linux_arm64_gui/debug/libballisticaplus.a": "73ad3303fe1a82005918fbc5dae3446c",
|
||||||
"build/prefab/lib/linux_arm64_gui/release/libballisticaplus.a": "fa659b5d6119acba6570c92ce4d35ae2",
|
"build/prefab/lib/linux_arm64_gui/release/libballisticaplus.a": "fa659b5d6119acba6570c92ce4d35ae2",
|
||||||
"build/prefab/lib/linux_arm64_server/debug/libballisticaplus.a": "73ad3303fe1a82005918fbc5dae3446c",
|
"build/prefab/lib/linux_arm64_server/debug/libballisticaplus.a": "73ad3303fe1a82005918fbc5dae3446c",
|
||||||
@ -4132,14 +4132,14 @@
|
|||||||
"build/prefab/lib/mac_x86_64_gui/release/libballisticaplus.a": "3e5c5fd0a09f55ba7b05ce1e2ec7171e",
|
"build/prefab/lib/mac_x86_64_gui/release/libballisticaplus.a": "3e5c5fd0a09f55ba7b05ce1e2ec7171e",
|
||||||
"build/prefab/lib/mac_x86_64_server/debug/libballisticaplus.a": "1659535e95e3047fda529543e265ac97",
|
"build/prefab/lib/mac_x86_64_server/debug/libballisticaplus.a": "1659535e95e3047fda529543e265ac97",
|
||||||
"build/prefab/lib/mac_x86_64_server/release/libballisticaplus.a": "3e5c5fd0a09f55ba7b05ce1e2ec7171e",
|
"build/prefab/lib/mac_x86_64_server/release/libballisticaplus.a": "3e5c5fd0a09f55ba7b05ce1e2ec7171e",
|
||||||
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.lib": "ad1d2ca70c9784c46fd9a079b6bfeacd",
|
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.lib": "c0485c893482ed8d4cd58cca89a91bef",
|
||||||
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb": "d239aa7f1abe82ab3920147375b5e714",
|
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb": "ff7845b253a5b54a9e3768d2071b945d",
|
||||||
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.lib": "7583533059df43d719c9b0446f282fa3",
|
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.lib": "a49f3aa9afddcc2408807fd275399868",
|
||||||
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.pdb": "dac29b15a3eb1294079ea002d93ec3b1",
|
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.pdb": "2fac5b977c68f28c20f2bb230e15fdac",
|
||||||
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib": "e19618713c795246c4aa64c455235d15",
|
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib": "17c44e22e015d13824f1e98f1f632335",
|
||||||
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb": "7260b697de1753e10a7e8677c787fd16",
|
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb": "0237ab1e6ce1d8bea03b85757cd01d8b",
|
||||||
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.lib": "b18e673dde3c97d97e74b45467fb23b0",
|
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.lib": "eedd20534754d746b0ec6c1db4d1af6f",
|
||||||
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.pdb": "60abcbb58579c047ba673519a5029857",
|
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.pdb": "f9978fd4147952019a8b643a240fd36e",
|
||||||
"src/assets/ba_data/python/babase/_mgen/__init__.py": "f885fed7f2ed98ff2ba271f9dbe3391c",
|
"src/assets/ba_data/python/babase/_mgen/__init__.py": "f885fed7f2ed98ff2ba271f9dbe3391c",
|
||||||
"src/assets/ba_data/python/babase/_mgen/enums.py": "794d258d59fd17a61752843a9a0551ad",
|
"src/assets/ba_data/python/babase/_mgen/enums.py": "794d258d59fd17a61752843a9a0551ad",
|
||||||
"src/ballistica/base/mgen/pyembed/binding_base.inc": "efa61468cf098f77cc6a234461d8b86d",
|
"src/ballistica/base/mgen/pyembed/binding_base.inc": "efa61468cf098f77cc6a234461d8b86d",
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
### 1.7.37 (build 21995, api 9, 2024-09-05)
|
### 1.7.37 (build 21997, api 9, 2024-09-05)
|
||||||
- Bumping api version to 9. As you'll see below, there's some UI changes that
|
- Bumping api version to 9. As you'll see below, there's some UI changes that
|
||||||
will require a bit of work for any UI mods to adapt to. If your mods don't
|
will require a bit of work for any UI mods to adapt to. If your mods don't
|
||||||
touch UI stuff at all you can simply bump your api version and call it a day.
|
touch UI stuff at all you can simply bump your api version and call it a day.
|
||||||
|
|||||||
@ -652,12 +652,6 @@ class App:
|
|||||||
'Error in on_screen_change() for subsystem %s.', subsystem
|
'Error in on_screen_change() for subsystem %s.', subsystem
|
||||||
)
|
)
|
||||||
|
|
||||||
# Note to the user that this is currently an imperfect system.
|
|
||||||
_babase.screenmessage(
|
|
||||||
f'UI Scale is now {scale.name}.\n'
|
|
||||||
f' NOTE: some UI elements may not respond to this currently.'
|
|
||||||
)
|
|
||||||
|
|
||||||
def _set_intent(self, intent: AppIntent) -> None:
|
def _set_intent(self, intent: AppIntent) -> None:
|
||||||
from babase._appmode import AppMode
|
from babase._appmode import AppMode
|
||||||
|
|
||||||
|
|||||||
@ -36,7 +36,7 @@ class DevConsoleTab:
|
|||||||
h_anchor: Literal['left', 'center', 'right'] = 'center',
|
h_anchor: Literal['left', 'center', 'right'] = 'center',
|
||||||
label_scale: float = 1.0,
|
label_scale: float = 1.0,
|
||||||
corner_radius: float = 8.0,
|
corner_radius: float = 8.0,
|
||||||
style: Literal['normal', 'dark'] = 'normal',
|
style: Literal['normal', 'light'] = 'normal',
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Add a button to the tab being refreshed."""
|
"""Add a button to the tab being refreshed."""
|
||||||
assert _babase.app.devconsole.is_refreshing
|
assert _babase.app.devconsole.is_refreshing
|
||||||
@ -152,30 +152,41 @@ class DevConsoleTabUI(DevConsoleTab):
|
|||||||
def refresh(self) -> None:
|
def refresh(self) -> None:
|
||||||
from babase._mgen.enums import UIScale
|
from babase._mgen.enums import UIScale
|
||||||
|
|
||||||
|
# self.text(
|
||||||
|
# 'UI Testing',
|
||||||
|
# scale=0.8,
|
||||||
|
# pos=(15, 77),
|
||||||
|
# h_anchor='left',
|
||||||
|
# h_align='left',
|
||||||
|
# v_align='center',
|
||||||
|
# )
|
||||||
self.text(
|
self.text(
|
||||||
'UI Testing: Make sure all static UI fits in the'
|
'Make sure all static UI fits in the'
|
||||||
' virtual screen at all UI scales (not counting things'
|
' virtual screen at all UI scales (not counting things'
|
||||||
' that follow screen edges).',
|
' that follow screen edges).\n'
|
||||||
scale=0.8,
|
'Note that some UI elements'
|
||||||
pos=(15, 55),
|
' may not reflect scale changes until recreated.',
|
||||||
|
scale=0.6,
|
||||||
|
pos=(15, 70),
|
||||||
h_anchor='left',
|
h_anchor='left',
|
||||||
h_align='left',
|
h_align='left',
|
||||||
v_align='none',
|
v_align='center',
|
||||||
)
|
)
|
||||||
|
|
||||||
ui_overlay = _babase.get_draw_ui_bounds()
|
ui_overlay = _babase.get_draw_ui_bounds()
|
||||||
self.button(
|
self.button(
|
||||||
'Hide Virtual Screen' if ui_overlay else 'Show Virtual Screen',
|
'Virtual Bounds ON' if ui_overlay else 'Virtual Bounds OFF',
|
||||||
pos=(10, 10),
|
pos=(10, 10),
|
||||||
size=(200, 30),
|
size=(200, 30),
|
||||||
h_anchor='left',
|
h_anchor='left',
|
||||||
label_scale=0.6,
|
label_scale=0.6,
|
||||||
call=self.toggle_ui_overlay,
|
call=self.toggle_ui_overlay,
|
||||||
|
style='light' if ui_overlay else 'normal',
|
||||||
)
|
)
|
||||||
x = 320
|
x = 300
|
||||||
self.text(
|
self.text(
|
||||||
'UI Scale:',
|
'UI Scale',
|
||||||
pos=(x - 10, 15),
|
pos=(x - 5, 15),
|
||||||
h_anchor='left',
|
h_anchor='left',
|
||||||
h_align='right',
|
h_align='right',
|
||||||
v_align='none',
|
v_align='none',
|
||||||
@ -185,14 +196,17 @@ class DevConsoleTabUI(DevConsoleTab):
|
|||||||
bwidth = 100
|
bwidth = 100
|
||||||
for scale in UIScale:
|
for scale in UIScale:
|
||||||
self.button(
|
self.button(
|
||||||
scale.name,
|
scale.name.lower(),
|
||||||
pos=(x, 10),
|
pos=(x, 10),
|
||||||
size=(bwidth, 30),
|
size=(bwidth, 30),
|
||||||
h_anchor='left',
|
h_anchor='left',
|
||||||
label_scale=0.6,
|
label_scale=0.6,
|
||||||
call=partial(_babase.app.set_ui_scale, scale),
|
call=partial(_babase.app.set_ui_scale, scale),
|
||||||
|
style=(
|
||||||
|
'light' if scale is _babase.app.ui_v1.uiscale else 'normal'
|
||||||
|
),
|
||||||
)
|
)
|
||||||
x += bwidth + 10
|
x += bwidth + 2
|
||||||
|
|
||||||
def toggle_ui_overlay(self) -> None:
|
def toggle_ui_overlay(self) -> None:
|
||||||
"""Toggle UI overlay drawing."""
|
"""Toggle UI overlay drawing."""
|
||||||
@ -221,7 +235,7 @@ class DevConsoleTabTest(DevConsoleTab):
|
|||||||
size=(100, 30),
|
size=(100, 30),
|
||||||
h_anchor='left',
|
h_anchor='left',
|
||||||
label_scale=0.6,
|
label_scale=0.6,
|
||||||
style='dark',
|
style='light',
|
||||||
)
|
)
|
||||||
self.text(
|
self.text(
|
||||||
'TestText',
|
'TestText',
|
||||||
|
|||||||
@ -52,7 +52,7 @@ if TYPE_CHECKING:
|
|||||||
|
|
||||||
# Build number and version of the ballistica binary we expect to be
|
# Build number and version of the ballistica binary we expect to be
|
||||||
# using.
|
# using.
|
||||||
TARGET_BALLISTICA_BUILD = 21995
|
TARGET_BALLISTICA_BUILD = 21997
|
||||||
TARGET_BALLISTICA_VERSION = '1.7.37'
|
TARGET_BALLISTICA_VERSION = '1.7.37'
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -254,42 +254,6 @@ void RendererGL::CheckGLCapabilities_() {
|
|||||||
// On Android, look at the GL version and try to get gl3 funcs to
|
// On Android, look at the GL version and try to get gl3 funcs to
|
||||||
// determine if we're running ES3 or not.
|
// determine if we're running ES3 or not.
|
||||||
#if BA_OSTYPE_ANDROID
|
#if BA_OSTYPE_ANDROID
|
||||||
// bool have_es3;
|
|
||||||
// #if BA_USE_ES3_INCLUDES
|
|
||||||
// have_es3 = true;
|
|
||||||
// #else
|
|
||||||
// have_es3 = (strstr(version_str, "OpenGL ES 3.") && gl3stubInit());
|
|
||||||
// #endif // BA_OSTYPE_ANDROID
|
|
||||||
|
|
||||||
// if (have_es3) {
|
|
||||||
// g_running_es3 = true;
|
|
||||||
// } else {
|
|
||||||
// #if !BA_USE_ES3_INCLUDES
|
|
||||||
// g_running_es3 = false;
|
|
||||||
|
|
||||||
// // Can still support some stuff like framebuffer-blit with es2
|
|
||||||
// extensions. assert(glBlitFramebuffer == nullptr ||
|
|
||||||
// !first_extension_check_); glBlitFramebuffer =
|
|
||||||
// (decltype(glBlitFramebuffer))eglGetProcAddress("glBlitFramebufferNV");
|
|
||||||
// assert(glRenderbufferStorageMultisample == nullptr
|
|
||||||
// || !first_extension_check_);
|
|
||||||
// glRenderbufferStorageMultisample =
|
|
||||||
// (decltype(glRenderbufferStorageMultisample))eglGetProcAddress(
|
|
||||||
// "glRenderbufferStorageMultisampleNV");
|
|
||||||
|
|
||||||
// assert(glGenVertexArrays == nullptr || !first_extension_check_);
|
|
||||||
// glGenVertexArrays =
|
|
||||||
// (decltype(glGenVertexArrays))eglGetProcAddress("glGenVertexArraysOES");
|
|
||||||
// assert(glDeleteVertexArrays == nullptr || !first_extension_check_);
|
|
||||||
// glDeleteVertexArrays =
|
|
||||||
// (decltype(glDeleteVertexArrays))eglGetProcAddress(
|
|
||||||
// "glDeleteVertexArraysOES");
|
|
||||||
// assert(glBindVertexArray == nullptr || !first_extension_check_);
|
|
||||||
// glBindVertexArray =
|
|
||||||
// (decltype(glBindVertexArray))eglGetProcAddress("glBindVertexArrayOES");
|
|
||||||
|
|
||||||
// #endif // BA_USE_ES3_INCLUDES
|
|
||||||
// }
|
|
||||||
|
|
||||||
BA_DEBUG_CHECK_GL_ERROR;
|
BA_DEBUG_CHECK_GL_ERROR;
|
||||||
|
|
||||||
@ -300,75 +264,7 @@ void RendererGL::CheckGLCapabilities_() {
|
|||||||
assert(gl_version_major() == 3);
|
assert(gl_version_major() == 3);
|
||||||
is_speedy_android_device_ = gl_version_minor() >= 2;
|
is_speedy_android_device_ = gl_version_minor() >= 2;
|
||||||
|
|
||||||
// is_extra_speedy_android_device_ = false;
|
|
||||||
is_adreno_ = (strstr(renderer, "Adreno") != nullptr);
|
is_adreno_ = (strstr(renderer, "Adreno") != nullptr);
|
||||||
// draws_shields_funny_ = false; // Start optimistic.
|
|
||||||
|
|
||||||
// Ali tv box.
|
|
||||||
// if (!strcmp(renderer, "Mali-450 MP")) {
|
|
||||||
// is_speedy_android_device_ = true; // this is borderline
|
|
||||||
// speedy/extra-speedy
|
|
||||||
// // draws_shields_funny_ = true;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// Firetv, etc.. lets enable MSAA.
|
|
||||||
// if (!strcmp(renderer, "Adreno (TM) 320")) {
|
|
||||||
// is_recent_adreno_ = true;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// This is right on the borderline, but lets go with extra-speedy I guess.
|
|
||||||
// if (!strcmp(renderer, "Adreno (TM) 330")) {
|
|
||||||
// is_recent_adreno_ = true;
|
|
||||||
// is_extra_speedy_android_device_ = true;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// *any* of the 4xx or 5xx series are extra-speedy.
|
|
||||||
// if (strstr(renderer, "Adreno (TM) 4") || strstr(renderer, "Adreno (TM) 5")
|
|
||||||
// || strstr(renderer, "Adreno (TM) 6")) {
|
|
||||||
// is_extra_speedy_android_device_ = true;
|
|
||||||
// is_recent_adreno_ = true;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// Some speedy malis (Galaxy S6 / Galaxy S7-ish).
|
|
||||||
// if (strstr(renderer, "Mali-T760") || strstr(renderer, "Mali-T860")
|
|
||||||
// || strstr(renderer, "Mali-T880")) {
|
|
||||||
// is_extra_speedy_android_device_ = true;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// Note 8 is speed-tastic
|
|
||||||
// if (!strcmp(renderer, "Mali-G71") || !strcmp(renderer, "Mali-G72")) {
|
|
||||||
// is_extra_speedy_android_device_ = true;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// Covers Nexus player.
|
|
||||||
// HMM Scratch that - this winds up being too slow for phones using this chip.
|
|
||||||
// if (strstr(renderer, "PowerVR Rogue G6430")) {
|
|
||||||
// is_extra_speedy_android_device_ = true;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// Figure out if we're a Tegra 4/K1/etc since we do some special stuff on
|
|
||||||
// those...
|
|
||||||
// if (!strcmp(renderer, "NVIDIA Tegra")) {
|
|
||||||
// // tegra 4 won't have ES3 but will have framebuffer_multisample
|
|
||||||
// if (!g_running_es3 && CheckGLExtension(ex, "framebuffer_multisample")) {
|
|
||||||
// is_tegra_4_ = true;
|
|
||||||
// is_speedy_android_device_ = true;
|
|
||||||
// } else if (g_running_es3) {
|
|
||||||
// // running ES3 - must be a K1 (for now)
|
|
||||||
// is_tegra_k1_ = true;
|
|
||||||
// is_extra_speedy_android_device_ = true;
|
|
||||||
// } else {
|
|
||||||
// // looks like Tegra-2 era stuff was just "NVIDIA Tegra" as well...
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// Also store this globally for a few other bits of the app to use..
|
|
||||||
// g_core->platform->set_is_tegra_k1(is_tegra_k1_);
|
|
||||||
|
|
||||||
// Extra-speedy implies speedy too..
|
|
||||||
// if (is_extra_speedy_android_device_) {
|
|
||||||
// is_speedy_android_device_ = true;
|
|
||||||
// }
|
|
||||||
|
|
||||||
#endif // BA_OSTYPE_ANDROID
|
#endif // BA_OSTYPE_ANDROID
|
||||||
|
|
||||||
@ -407,15 +303,11 @@ void RendererGL::CheckGLCapabilities_() {
|
|||||||
|
|
||||||
g_base->graphics_server->SetTextureCompressionTypes(c_types);
|
g_base->graphics_server->SetTextureCompressionTypes(c_types);
|
||||||
|
|
||||||
// Both GL 3 and GL ES 3.0 support depth textures (and thus our high
|
|
||||||
// quality mode) as a core feature.
|
|
||||||
// g_base->graphics->SetSupportsHighQualityGraphics(true);
|
|
||||||
|
|
||||||
// Store the tex-compression type we support.
|
// Store the tex-compression type we support.
|
||||||
BA_DEBUG_CHECK_GL_ERROR;
|
BA_DEBUG_CHECK_GL_ERROR;
|
||||||
|
|
||||||
// Anisotropic sampling is still an extension as of both GL 3 and ES 3,
|
// Anisotropic sampling is still an extension as of both GL 3 and ES 3, so
|
||||||
// so we need to test for it.
|
// we need to test for it.
|
||||||
anisotropic_support_ =
|
anisotropic_support_ =
|
||||||
CheckGLExtension(extensions, "texture_filter_anisotropic");
|
CheckGLExtension(extensions, "texture_filter_anisotropic");
|
||||||
if (anisotropic_support_) {
|
if (anisotropic_support_) {
|
||||||
@ -436,8 +328,8 @@ void RendererGL::CheckGLCapabilities_() {
|
|||||||
combined_texture_image_unit_count_ =
|
combined_texture_image_unit_count_ =
|
||||||
GLGetInt(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS);
|
GLGetInt(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS);
|
||||||
|
|
||||||
// If we're running ES3, ask about our max multisample counts and whether we
|
// If we're running ES3, ask about our max multisample counts and whether
|
||||||
// can enable MSAA.
|
// we can enable MSAA.
|
||||||
msaa_max_samples_rgb565_ = msaa_max_samples_rgb8_ = 0; // start pessimistic
|
msaa_max_samples_rgb565_ = msaa_max_samples_rgb8_ = 0; // start pessimistic
|
||||||
|
|
||||||
bool have_gl_get_internal_format_iv{};
|
bool have_gl_get_internal_format_iv{};
|
||||||
@ -850,12 +742,6 @@ void RendererGL::SyncGLState_() {
|
|||||||
glFrontFace(GL_CCW);
|
glFrontFace(GL_CCW);
|
||||||
}
|
}
|
||||||
BA_DEBUG_CHECK_GL_ERROR;
|
BA_DEBUG_CHECK_GL_ERROR;
|
||||||
|
|
||||||
// if (time(nullptr)%2 == 0) {
|
|
||||||
// glEnable(GL_FRAMEBUFFER_SRGB);
|
|
||||||
// } else {
|
|
||||||
// glDisable(GL_FRAMEBUFFER_SRGB);
|
|
||||||
// }
|
|
||||||
#endif // BA_RIFT_BUILD
|
#endif // BA_RIFT_BUILD
|
||||||
|
|
||||||
active_tex_unit_ = -1; // force a set next time
|
active_tex_unit_ = -1; // force a set next time
|
||||||
@ -948,8 +834,8 @@ void RendererGL::SyncGLState_() {
|
|||||||
assert(VAR&& VAR == dynamic_cast<TYPE*>(buffer->Get())); \
|
assert(VAR&& VAR == dynamic_cast<TYPE*>(buffer->Get())); \
|
||||||
buffer++
|
buffer++
|
||||||
|
|
||||||
// Takes all latest mesh data from the client side and applies it
|
// Takes all latest mesh data from the client side and applies it to our gl
|
||||||
// to our gl implementations.
|
// implementations.
|
||||||
void RendererGL::UpdateMeshes(
|
void RendererGL::UpdateMeshes(
|
||||||
const std::vector<Object::Ref<MeshDataClientHandle> >& meshes,
|
const std::vector<Object::Ref<MeshDataClientHandle> >& meshes,
|
||||||
const std::vector<int8_t>& index_sizes,
|
const std::vector<int8_t>& index_sizes,
|
||||||
@ -1193,7 +1079,8 @@ void RendererGL::ProcessRenderCommandBuffer(RenderCommandBuffer* buffer,
|
|||||||
const TextureAsset* t = buffer->GetTexture();
|
const TextureAsset* t = buffer->GetTexture();
|
||||||
const TextureAsset* t_mask = buffer->GetTexture();
|
const TextureAsset* t_mask = buffer->GetTexture();
|
||||||
p->SetColorTexture(t);
|
p->SetColorTexture(t);
|
||||||
// If this isn't a full-res texture, ramp down the blurring we do.
|
// If this isn't a full-res texture, ramp down the blurring we
|
||||||
|
// do.
|
||||||
p->SetShadow(shadow_offset_x, shadow_offset_y,
|
p->SetShadow(shadow_offset_x, shadow_offset_y,
|
||||||
std::max(0.0f, shadow_blur), shadow_opacity);
|
std::max(0.0f, shadow_blur), shadow_opacity);
|
||||||
p->SetMaskUV2Texture(t_mask);
|
p->SetMaskUV2Texture(t_mask);
|
||||||
@ -1215,7 +1102,8 @@ void RendererGL::ProcessRenderCommandBuffer(RenderCommandBuffer* buffer,
|
|||||||
const TextureAsset* t = buffer->GetTexture();
|
const TextureAsset* t = buffer->GetTexture();
|
||||||
const TextureAsset* t_mask = buffer->GetTexture();
|
const TextureAsset* t_mask = buffer->GetTexture();
|
||||||
p->SetColorTexture(t);
|
p->SetColorTexture(t);
|
||||||
// If this isn't a full-res texture, ramp down the blurring we do.
|
// If this isn't a full-res texture, ramp down the blurring we
|
||||||
|
// do.
|
||||||
p->SetShadow(shadow_offset_x, shadow_offset_y,
|
p->SetShadow(shadow_offset_x, shadow_offset_y,
|
||||||
std::max(0.0f, shadow_blur), shadow_opacity);
|
std::max(0.0f, shadow_blur), shadow_opacity);
|
||||||
p->SetMaskUV2Texture(t_mask);
|
p->SetMaskUV2Texture(t_mask);
|
||||||
@ -1612,7 +1500,7 @@ void RendererGL::ProcessRenderCommandBuffer(RenderCommandBuffer* buffer,
|
|||||||
buffer->GetFloats(&r, &g, &b, &reflect_r, &reflect_g, &reflect_b);
|
buffer->GetFloats(&r, &g, &b, &reflect_r, &reflect_g, &reflect_b);
|
||||||
ProgramObjectGL* p;
|
ProgramObjectGL* p;
|
||||||
|
|
||||||
// Testing why reflection is wonky..
|
// Testing why reflection is wonky.
|
||||||
if (explicit_bool(false)) {
|
if (explicit_bool(false)) {
|
||||||
p = world_space ? obj_lightshad_worldspace_prog_
|
p = world_space ? obj_lightshad_worldspace_prog_
|
||||||
: obj_lightshad_prog_;
|
: obj_lightshad_prog_;
|
||||||
@ -1928,8 +1816,8 @@ void RendererGL::ProcessRenderCommandBuffer(RenderCommandBuffer* buffer,
|
|||||||
case ShadingType::kSpecial: {
|
case ShadingType::kSpecial: {
|
||||||
SetDoubleSided_(false);
|
SetDoubleSided_(false);
|
||||||
|
|
||||||
// if we ever need to use non-blend version
|
// If we ever need to use non-blend version of this in real
|
||||||
// of this in real renders, we should split off a non-blend version
|
// renders, we should split off a non-blend version.
|
||||||
SetBlend(true);
|
SetBlend(true);
|
||||||
SetBlendPremult(true);
|
SetBlendPremult(true);
|
||||||
auto source = (SpecialComponent::Source)buffer->GetInt();
|
auto source = (SpecialComponent::Source)buffer->GetInt();
|
||||||
@ -2211,8 +2099,8 @@ void RendererGL::BlitBuffer(RenderTarget* src_in, RenderTarget* dst_in,
|
|||||||
|
|
||||||
bool do_shader_blit{true};
|
bool do_shader_blit{true};
|
||||||
|
|
||||||
// If they want depth we *MUST* use glBlitFramebuffer and can't have linear
|
// If they want depth we *MUST* use glBlitFramebuffer and can't have
|
||||||
// interp.
|
// linear interp.
|
||||||
if (depth) {
|
if (depth) {
|
||||||
assert(!force_shader_mode);
|
assert(!force_shader_mode);
|
||||||
linear_interpolation = false;
|
linear_interpolation = false;
|
||||||
@ -2250,7 +2138,7 @@ void RendererGL::BlitBuffer(RenderTarget* src_in, RenderTarget* dst_in,
|
|||||||
g_base->graphics_server->ModelViewReset();
|
g_base->graphics_server->ModelViewReset();
|
||||||
g_base->graphics_server->SetOrthoProjection(-1, 1, -1, 1, -1, 1);
|
g_base->graphics_server->SetOrthoProjection(-1, 1, -1, 1, -1, 1);
|
||||||
|
|
||||||
// Copied from ShadingType::kSimpleColor
|
// Copied from ShadingType::kSimpleColor.
|
||||||
SetDoubleSided_(false);
|
SetDoubleSided_(false);
|
||||||
SetBlend(false);
|
SetBlend(false);
|
||||||
ProgramSimpleGL* p = simple_tex_prog_;
|
ProgramSimpleGL* p = simple_tex_prog_;
|
||||||
@ -2554,14 +2442,6 @@ auto RendererGL::GetFunkyDepthIssue_() -> bool {
|
|||||||
return funky_depth_issue_;
|
return funky_depth_issue_;
|
||||||
}
|
}
|
||||||
|
|
||||||
// auto RendererGL::GetDrawsShieldsFunny_() -> bool {
|
|
||||||
// if (!draws_shields_funny_set_) {
|
|
||||||
// BA_LOG_ONCE(LogLevel::kError,
|
|
||||||
// "fetching draws-shields-funny value but not set");
|
|
||||||
// }
|
|
||||||
// return draws_shields_funny_;
|
|
||||||
// }
|
|
||||||
|
|
||||||
#if BA_OSTYPE_ANDROID
|
#if BA_OSTYPE_ANDROID
|
||||||
std::string RendererGL::GetAutoAndroidRes() {
|
std::string RendererGL::GetAutoAndroidRes() {
|
||||||
assert(g_base->app_adapter->InGraphicsContext());
|
assert(g_base->app_adapter->InGraphicsContext());
|
||||||
@ -2759,9 +2639,9 @@ void RendererGL::Load() {
|
|||||||
p = shield_prog_ = new ProgramShieldGL(this, 0);
|
p = shield_prog_ = new ProgramShieldGL(this, 0);
|
||||||
RetainShader_(p);
|
RetainShader_(p);
|
||||||
|
|
||||||
// Conditional seems to be a *very* slight win on some architectures (A7), a
|
// Conditional seems to be a *very* slight win on some architectures (A7),
|
||||||
// loss on some (A5) and a wash on some (Adreno 320).
|
// a loss on some (A5) and a wash on some (Adreno 320). Gonna wait before
|
||||||
// Gonna wait before a clean win before turning it on.
|
// a clean win before turning it on.
|
||||||
p = postprocess_prog_ = new ProgramPostProcessGL(this, high_qual_pp_flag);
|
p = postprocess_prog_ = new ProgramPostProcessGL(this, high_qual_pp_flag);
|
||||||
RetainShader_(p);
|
RetainShader_(p);
|
||||||
if (g_base->graphics_server->quality() >= GraphicsQuality::kHigher) {
|
if (g_base->graphics_server->quality() >= GraphicsQuality::kHigher) {
|
||||||
@ -2805,8 +2685,8 @@ void RendererGL::Load() {
|
|||||||
UpdateVignetteTex_(true);
|
UpdateVignetteTex_(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Let's pre-fill our recyclable mesh-datas list to reduce the need to make
|
// Let's pre-fill our recyclable mesh-datas list to reduce the need to
|
||||||
// more which could cause hitches.
|
// make more which could cause hitches.
|
||||||
assert(recycle_mesh_datas_simple_split_.empty());
|
assert(recycle_mesh_datas_simple_split_.empty());
|
||||||
for (int i = 0; i < 10; i++) {
|
for (int i = 0; i < 10; i++) {
|
||||||
recycle_mesh_datas_simple_split_.push_back(new MeshDataSimpleSplitGL(this));
|
recycle_mesh_datas_simple_split_.push_back(new MeshDataSimpleSplitGL(this));
|
||||||
@ -2958,7 +2838,7 @@ auto RendererGL::NewMeshData(MeshDataType mesh_type,
|
|||||||
switch (mesh_type) {
|
switch (mesh_type) {
|
||||||
case MeshDataType::kIndexedSimpleSplit: {
|
case MeshDataType::kIndexedSimpleSplit: {
|
||||||
MeshDataSimpleSplitGL* data;
|
MeshDataSimpleSplitGL* data;
|
||||||
// use a recycled one if we've got one.. otherwise create a new one
|
// Use a recycled one if we've got one; otherwise create a new one.
|
||||||
auto i = recycle_mesh_datas_simple_split_.rbegin();
|
auto i = recycle_mesh_datas_simple_split_.rbegin();
|
||||||
if (i != recycle_mesh_datas_simple_split_.rend()) {
|
if (i != recycle_mesh_datas_simple_split_.rend()) {
|
||||||
data = *i;
|
data = *i;
|
||||||
@ -2971,7 +2851,7 @@ auto RendererGL::NewMeshData(MeshDataType mesh_type,
|
|||||||
}
|
}
|
||||||
case MeshDataType::kIndexedObjectSplit: {
|
case MeshDataType::kIndexedObjectSplit: {
|
||||||
MeshDataObjectSplitGL* data;
|
MeshDataObjectSplitGL* data;
|
||||||
// use a recycled one if we've got one.. otherwise create a new one
|
// Use a recycled one if we've got one; otherwise create a new one.
|
||||||
auto i = recycle_mesh_datas_object_split_.rbegin();
|
auto i = recycle_mesh_datas_object_split_.rbegin();
|
||||||
if (i != recycle_mesh_datas_object_split_.rend()) {
|
if (i != recycle_mesh_datas_object_split_.rend()) {
|
||||||
data = *i;
|
data = *i;
|
||||||
@ -2984,7 +2864,7 @@ auto RendererGL::NewMeshData(MeshDataType mesh_type,
|
|||||||
}
|
}
|
||||||
case MeshDataType::kIndexedSimpleFull: {
|
case MeshDataType::kIndexedSimpleFull: {
|
||||||
MeshDataSimpleFullGL* data;
|
MeshDataSimpleFullGL* data;
|
||||||
// use a recycled one if we've got one.. otherwise create a new one
|
// Use a recycled one if we've got one; otherwise create a new one.
|
||||||
auto i = recycle_mesh_datas_simple_full_.rbegin();
|
auto i = recycle_mesh_datas_simple_full_.rbegin();
|
||||||
if (i != recycle_mesh_datas_simple_full_.rend()) {
|
if (i != recycle_mesh_datas_simple_full_.rend()) {
|
||||||
data = *i;
|
data = *i;
|
||||||
@ -2998,7 +2878,7 @@ auto RendererGL::NewMeshData(MeshDataType mesh_type,
|
|||||||
}
|
}
|
||||||
case MeshDataType::kIndexedDualTextureFull: {
|
case MeshDataType::kIndexedDualTextureFull: {
|
||||||
MeshDataDualTextureFullGL* data;
|
MeshDataDualTextureFullGL* data;
|
||||||
// use a recycled one if we've got one.. otherwise create a new one
|
// Use a recycled one if we've got one; otherwise create a new one.
|
||||||
auto i = recycle_mesh_datas_dual_texture_full_.rbegin();
|
auto i = recycle_mesh_datas_dual_texture_full_.rbegin();
|
||||||
if (i != recycle_mesh_datas_dual_texture_full_.rend()) {
|
if (i != recycle_mesh_datas_dual_texture_full_.rend()) {
|
||||||
data = *i;
|
data = *i;
|
||||||
@ -3012,7 +2892,7 @@ auto RendererGL::NewMeshData(MeshDataType mesh_type,
|
|||||||
}
|
}
|
||||||
case MeshDataType::kIndexedSmokeFull: {
|
case MeshDataType::kIndexedSmokeFull: {
|
||||||
MeshDataSmokeFullGL* data;
|
MeshDataSmokeFullGL* data;
|
||||||
// use a recycled one if we've got one.. otherwise create a new one
|
// Use a recycled one if we've got one; otherwise create a new one.
|
||||||
auto i = recycle_mesh_datas_smoke_full_.rbegin();
|
auto i = recycle_mesh_datas_smoke_full_.rbegin();
|
||||||
if (i != recycle_mesh_datas_smoke_full_.rend()) {
|
if (i != recycle_mesh_datas_smoke_full_.rend()) {
|
||||||
data = *i;
|
data = *i;
|
||||||
@ -3026,7 +2906,7 @@ auto RendererGL::NewMeshData(MeshDataType mesh_type,
|
|||||||
}
|
}
|
||||||
case MeshDataType::kSprite: {
|
case MeshDataType::kSprite: {
|
||||||
MeshDataSpriteGL* data;
|
MeshDataSpriteGL* data;
|
||||||
// use a recycled one if we've got one.. otherwise create a new one
|
// Use a recycled one if we've got one; otherwise create a new one.
|
||||||
auto i = recycle_mesh_datas_sprite_.rbegin();
|
auto i = recycle_mesh_datas_sprite_.rbegin();
|
||||||
if (i != recycle_mesh_datas_sprite_.rend()) {
|
if (i != recycle_mesh_datas_sprite_.rend()) {
|
||||||
data = *i;
|
data = *i;
|
||||||
@ -3046,10 +2926,9 @@ auto RendererGL::NewMeshData(MeshDataType mesh_type,
|
|||||||
|
|
||||||
void RendererGL::DeleteMeshData(MeshRendererData* source_in,
|
void RendererGL::DeleteMeshData(MeshRendererData* source_in,
|
||||||
MeshDataType mesh_type) {
|
MeshDataType mesh_type) {
|
||||||
// When we're done with mesh-data we keep it around for recycling.
|
// When we're done with mesh-data we keep it around for recycling. It
|
||||||
// It seems that killing off VAO/VBOs can be hitchy (on mac at least).
|
// seems that killing off VAO/VBOs can be hitchy (on mac at least). Hmmm
|
||||||
// Hmmm should we have some sort of threshold at which point we kill off
|
// should we have some sort of threshold at which point we kill off some?
|
||||||
// some?
|
|
||||||
|
|
||||||
switch (mesh_type) {
|
switch (mesh_type) {
|
||||||
case MeshDataType::kIndexedSimpleSplit: {
|
case MeshDataType::kIndexedSimpleSplit: {
|
||||||
@ -3105,8 +2984,8 @@ void RendererGL::DeleteMeshData(MeshRendererData* source_in,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void RendererGL::CheckForErrors() {
|
void RendererGL::CheckForErrors() {
|
||||||
// lets only check periodically.. i doubt it hurts to run this all the time
|
// Lets only check periodically. I doubt it hurts to run this all the time
|
||||||
// but just in case...
|
// but just in case.
|
||||||
error_check_counter_++;
|
error_check_counter_++;
|
||||||
if (error_check_counter_ > 120) {
|
if (error_check_counter_ > 120) {
|
||||||
error_check_counter_ = 0;
|
error_check_counter_ = 0;
|
||||||
@ -3201,8 +3080,8 @@ void RendererGL::GenerateCameraBufferBlurPasses() {
|
|||||||
true, // linear_interp
|
true, // linear_interp
|
||||||
false, // depth
|
false, // depth
|
||||||
true, // tex
|
true, // tex
|
||||||
false, // depthTex
|
false, // depth_tex
|
||||||
high_quality_fbos, // highQuality
|
high_quality_fbos, // high_quality
|
||||||
false, // msaa
|
false, // msaa
|
||||||
false // alpha
|
false // alpha
|
||||||
)); // NOLINT(whitespace/parens)
|
)); // NOLINT(whitespace/parens)
|
||||||
@ -3215,8 +3094,8 @@ void RendererGL::GenerateCameraBufferBlurPasses() {
|
|||||||
true, // linear_interp
|
true, // linear_interp
|
||||||
false, // depth
|
false, // depth
|
||||||
true, // tex
|
true, // tex
|
||||||
false, // depthTex
|
false, // depth_tex
|
||||||
false, // highQuality
|
false, // high_quality
|
||||||
false, // msaa
|
false, // msaa
|
||||||
false // alpha
|
false // alpha
|
||||||
)); // NOLINT(whitespace/parens)
|
)); // NOLINT(whitespace/parens)
|
||||||
@ -3263,9 +3142,9 @@ void RendererGL::CardboardEnableScissor() { glEnable(GL_SCISSOR_TEST); }
|
|||||||
void RendererGL::VREyeRenderBegin() {
|
void RendererGL::VREyeRenderBegin() {
|
||||||
assert(g_core->vr_mode());
|
assert(g_core->vr_mode());
|
||||||
|
|
||||||
// On rift we need to turn off srgb conversion for each eye render
|
// On rift we need to turn off srgb conversion for each eye render so we
|
||||||
// so we can dump our linear data into oculus' srgb buffer as-is.
|
// can dump our linear data into oculus' srgb buffer as-is. (we really
|
||||||
// (we really should add proper srgb support to the engine at some point)
|
// should add proper srgb support to the engine at some point).
|
||||||
#if BA_RIFT_BUILD
|
#if BA_RIFT_BUILD
|
||||||
glDisable(GL_FRAMEBUFFER_SRGB);
|
glDisable(GL_FRAMEBUFFER_SRGB);
|
||||||
#endif // BA_RIFT_BUILD
|
#endif // BA_RIFT_BUILD
|
||||||
@ -3275,7 +3154,7 @@ void RendererGL::VREyeRenderBegin() {
|
|||||||
|
|
||||||
#if BA_VR_BUILD
|
#if BA_VR_BUILD
|
||||||
void RendererGL::VRSyncRenderStates() {
|
void RendererGL::VRSyncRenderStates() {
|
||||||
// GL state has been mucked with outside of our code; let's resync stuff..
|
// GL state has been mucked with outside of our code; let's resync stuff.
|
||||||
SyncGLState_();
|
SyncGLState_();
|
||||||
}
|
}
|
||||||
#endif // BA_VR_BUILD
|
#endif // BA_VR_BUILD
|
||||||
|
|||||||
@ -7,8 +7,6 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "ballistica/shared/ballistica.h"
|
|
||||||
|
|
||||||
#if BA_ENABLE_OPENGL
|
#if BA_ENABLE_OPENGL
|
||||||
|
|
||||||
#include "ballistica/base/graphics/gl/gl_sys.h"
|
#include "ballistica/base/graphics/gl/gl_sys.h"
|
||||||
@ -27,13 +25,6 @@
|
|||||||
|
|
||||||
namespace ballistica::base {
|
namespace ballistica::base {
|
||||||
|
|
||||||
// extern int g_msaa_max_samples_rgb565;
|
|
||||||
// extern int g_msaa_max_samples_rgb8;
|
|
||||||
// extern bool g_vao_support;
|
|
||||||
// extern bool g_running_es3;
|
|
||||||
// extern bool g_anisotropic_support;
|
|
||||||
// extern float g_max_anisotropy;
|
|
||||||
|
|
||||||
// For now lets not go above 8 since that's what the iPhone 3gs has. ...haha
|
// For now lets not go above 8 since that's what the iPhone 3gs has. ...haha
|
||||||
// perhaps can reconsider that since the 3gs was 15 years ago.
|
// perhaps can reconsider that since the 3gs was 15 years ago.
|
||||||
constexpr int kMaxGLTexUnitsUsed = 5;
|
constexpr int kMaxGLTexUnitsUsed = 5;
|
||||||
@ -227,7 +218,6 @@ class RendererGL : public Renderer {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
static auto GetFunkyDepthIssue_() -> bool;
|
static auto GetFunkyDepthIssue_() -> bool;
|
||||||
// static auto GetDrawsShieldsFunny_()->bool;
|
|
||||||
void CheckFunkyDepthIssue_();
|
void CheckFunkyDepthIssue_();
|
||||||
auto GetMSAASamplesForFramebuffer_(int width, int height) -> int;
|
auto GetMSAASamplesForFramebuffer_(int width, int height) -> int;
|
||||||
void UpdateMSAAEnabled_() override;
|
void UpdateMSAAEnabled_() override;
|
||||||
@ -248,8 +238,8 @@ class RendererGL : public Renderer {
|
|||||||
void ScissorPop_(RenderTarget* render_target);
|
void ScissorPop_(RenderTarget* render_target);
|
||||||
void BindVertexArray_(GLuint v);
|
void BindVertexArray_(GLuint v);
|
||||||
|
|
||||||
// Note: This is only for use when VAOs aren't supported.
|
// Note: This is only for use when VAOs aren't supported. void
|
||||||
// void SetVertexAttributeArrayEnabled_(GLuint i, bool enabled);
|
// SetVertexAttributeArrayEnabled_(GLuint i, bool enabled);
|
||||||
void BindTexture_(GLuint type, const TextureAsset* t, GLuint tex_unit = 0);
|
void BindTexture_(GLuint type, const TextureAsset* t, GLuint tex_unit = 0);
|
||||||
void BindTexture_(GLuint type, GLuint tex, GLuint tex_unit = 0);
|
void BindTexture_(GLuint type, GLuint tex, GLuint tex_unit = 0);
|
||||||
void BindTextureUnit(uint32_t tex_unit);
|
void BindTextureUnit(uint32_t tex_unit);
|
||||||
@ -276,8 +266,6 @@ class RendererGL : public Renderer {
|
|||||||
bool double_sided_{};
|
bool double_sided_{};
|
||||||
bool invalidate_framebuffer_support_{};
|
bool invalidate_framebuffer_support_{};
|
||||||
bool checked_gl_version_{};
|
bool checked_gl_version_{};
|
||||||
GLint gl_version_major_{};
|
|
||||||
GLint gl_version_minor_{};
|
|
||||||
int last_blur_res_count_{};
|
int last_blur_res_count_{};
|
||||||
float last_cam_buffer_width_{};
|
float last_cam_buffer_width_{};
|
||||||
float last_cam_buffer_height_{};
|
float last_cam_buffer_height_{};
|
||||||
@ -289,13 +277,15 @@ class RendererGL : public Renderer {
|
|||||||
float vignette_tex_inner_b_{};
|
float vignette_tex_inner_b_{};
|
||||||
float depth_range_min_{};
|
float depth_range_min_{};
|
||||||
float depth_range_max_{};
|
float depth_range_max_{};
|
||||||
|
GLint gl_version_major_{};
|
||||||
|
GLint gl_version_minor_{};
|
||||||
GLint screen_framebuffer_{};
|
GLint screen_framebuffer_{};
|
||||||
GLuint random_tex_{};
|
GLuint random_tex_{};
|
||||||
GLuint vignette_tex_{};
|
|
||||||
GLint viewport_x_{};
|
GLint viewport_x_{};
|
||||||
GLint viewport_y_{};
|
GLint viewport_y_{};
|
||||||
GLint viewport_width_{};
|
GLint viewport_width_{};
|
||||||
GLint viewport_height_{};
|
GLint viewport_height_{};
|
||||||
|
GLuint vignette_tex_{};
|
||||||
millisecs_t dof_update_time_{};
|
millisecs_t dof_update_time_{};
|
||||||
std::vector<Object::Ref<FramebufferObjectGL> > blur_buffers_;
|
std::vector<Object::Ref<FramebufferObjectGL> > blur_buffers_;
|
||||||
std::vector<std::unique_ptr<ProgramGL> > shaders_;
|
std::vector<std::unique_ptr<ProgramGL> > shaders_;
|
||||||
|
|||||||
@ -472,13 +472,13 @@ void RenderPass::SetFrustum(float near_val, float far_val) {
|
|||||||
} else {
|
} else {
|
||||||
// Old angle-based stuff:
|
// Old angle-based stuff:
|
||||||
float x;
|
float x;
|
||||||
float angleY = (cam_fov_y_ / 2.0f) * kPi / 180.0f;
|
float angle_y = (cam_fov_y_ / 2.0f) * kPi / 180.0f;
|
||||||
float y = near_val * tanf(angleY);
|
float y = near_val * tanf(angle_y);
|
||||||
|
|
||||||
// Fov-x < 0 implies to use aspect ratio.
|
// Fov-x < 0 implies to use aspect ratio.
|
||||||
if (cam_fov_x_ > 0.0f) {
|
if (cam_fov_x_ > 0.0f) {
|
||||||
float angleX = (cam_fov_x_ / 2.0f) * kPi / 180.0f;
|
float angle_x = (cam_fov_x_ / 2.0f) * kPi / 180.0f;
|
||||||
x = near_val * tanf(angleX);
|
x = near_val * tanf(angle_x);
|
||||||
} else {
|
} else {
|
||||||
x = y * GetPhysicalAspectRatio();
|
x = y * GetPhysicalAspectRatio();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -328,10 +328,10 @@ void Camera::UpdatePosition() {
|
|||||||
x_clamped_focus, y_clamped_focus, z_clamped_focus);
|
x_clamped_focus, y_clamped_focus, z_clamped_focus);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now, for camera aiming purposes, add some of their velocity and
|
// Now, for camera aiming purposes, add some of their velocity
|
||||||
// clamp to the bounds, taking their radius into account. if our AOI
|
// and clamp to the bounds, taking their radius into account. if
|
||||||
// sphere is bigger than a given dimension, center it; otherwise
|
// our AOI sphere is bigger than a given dimension, center it;
|
||||||
// clamp to the box inset by our radius.
|
// otherwise clamp to the box inset by our radius.
|
||||||
float x_clamped, y_clamped, z_clamped, x_mirrored_clamped;
|
float x_clamped, y_clamped, z_clamped, x_mirrored_clamped;
|
||||||
float diameter = i.radius() * 2.0f;
|
float diameter = i.radius() * 2.0f;
|
||||||
|
|
||||||
@ -371,9 +371,9 @@ void Camera::UpdatePosition() {
|
|||||||
i.position().z));
|
i.position().z));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Let's also do a version mirrored across the camera's x coordinate
|
// Let's also do a version mirrored across the camera's x
|
||||||
// (adding this to our tracked point set causes us zoom out instead
|
// coordinate (adding this to our tracked point set causes us
|
||||||
// of rotating generally)
|
// zoom out instead of rotating generally)
|
||||||
float x_mirrored = position_.x - (i.position().x - position_.x);
|
float x_mirrored = position_.x - (i.position().x - position_.x);
|
||||||
if (diameter
|
if (diameter
|
||||||
> (area_of_interest_bounds_[3] - area_of_interest_bounds_[0])) {
|
> (area_of_interest_bounds_[3] - area_of_interest_bounds_[0])) {
|
||||||
@ -395,8 +395,8 @@ void Camera::UpdatePosition() {
|
|||||||
z_clamped - position_.z};
|
z_clamped - position_.z};
|
||||||
|
|
||||||
// For sample 0, subtract AOI radius in camera-space x and y.
|
// For sample 0, subtract AOI radius in camera-space x and y.
|
||||||
// For sample 1, add them.
|
// For sample 1, add them. this way we should get the whole
|
||||||
// this way we should get the whole sphere.
|
// sphere.
|
||||||
if (sample == 0) {
|
if (sample == 0) {
|
||||||
to_point -= corner_offs;
|
to_point -= corner_offs;
|
||||||
} else if (sample == 1) {
|
} else if (sample == 1) {
|
||||||
@ -607,7 +607,6 @@ void Camera::Update(millisecs_t elapsed) {
|
|||||||
float damping2 = 0.006f;
|
float damping2 = 0.006f;
|
||||||
float xy_blend_speed = 0.0002f;
|
float xy_blend_speed = 0.0002f;
|
||||||
time_ += elapsed;
|
time_ += elapsed;
|
||||||
// millisecs_t real_time = g_core->GetAppTimeMillisecs();
|
|
||||||
|
|
||||||
// Prevent camera "explosions" if we've been unable to update for a while.
|
// Prevent camera "explosions" if we've been unable to update for a while.
|
||||||
elapsed = std::min(millisecs_t{100}, elapsed);
|
elapsed = std::min(millisecs_t{100}, elapsed);
|
||||||
@ -676,8 +675,8 @@ void Camera::Update(millisecs_t elapsed) {
|
|||||||
elapsedf * rand_component * 4.0f * (-0.5f + RandomFloat());
|
elapsedf * rand_component * 4.0f * (-0.5f + RandomFloat());
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we have no important areas of interest, keep our camera from moving too
|
// If we have no important areas of interest, keep our camera from moving
|
||||||
// fast.
|
// too fast.
|
||||||
if (!have_real_areas_of_interest_) {
|
if (!have_real_areas_of_interest_) {
|
||||||
speed *= 0.5f;
|
speed *= 0.5f;
|
||||||
}
|
}
|
||||||
@ -952,7 +951,9 @@ void Camera::ApplyToFrameDef(FrameDef* frame_def) {
|
|||||||
float final_fov_y2 = final_fov_x / render_ratio;
|
float final_fov_y2 = final_fov_x / render_ratio;
|
||||||
|
|
||||||
// If we're not smoothing this frame, snap immediately.
|
// If we're not smoothing this frame, snap immediately.
|
||||||
if (!smooth_next_frame_) xy_constrain_blend_ = x_constrained_ ? 1.0f : 0.0f;
|
if (!smooth_next_frame_) {
|
||||||
|
xy_constrain_blend_ = x_constrained_ ? 1.0f : 0.0f;
|
||||||
|
}
|
||||||
|
|
||||||
// We smoothly blend between our x-constrained and non-x-constrained y values
|
// We smoothly blend between our x-constrained and non-x-constrained y values
|
||||||
// so that we don't see a hitch when it switches.
|
// so that we don't see a hitch when it switches.
|
||||||
|
|||||||
@ -31,11 +31,11 @@ const float kDevConsoleTabButtonCornerRadius{16.0f};
|
|||||||
const double kTransitionSeconds{0.15};
|
const double kTransitionSeconds{0.15};
|
||||||
|
|
||||||
enum class DevConsoleHAnchor_ { kLeft, kCenter, kRight };
|
enum class DevConsoleHAnchor_ { kLeft, kCenter, kRight };
|
||||||
enum class DevButtonStyle_ { kNormal, kDark };
|
enum class DevButtonStyle_ { kNormal, kLight };
|
||||||
|
|
||||||
static auto DevButtonStyleFromStr_(const char* strval) {
|
static auto DevButtonStyleFromStr_(const char* strval) {
|
||||||
if (!strcmp(strval, "dark")) {
|
if (!strcmp(strval, "light")) {
|
||||||
return DevButtonStyle_::kDark;
|
return DevButtonStyle_::kLight;
|
||||||
}
|
}
|
||||||
assert(!strcmp(strval, "normal"));
|
assert(!strcmp(strval, "normal"));
|
||||||
return DevButtonStyle_::kNormal;
|
return DevButtonStyle_::kNormal;
|
||||||
@ -247,11 +247,11 @@ class DevConsole::Button_ : public DevConsole::Widget_ {
|
|||||||
Vector3f fgcolor;
|
Vector3f fgcolor;
|
||||||
Vector3f bgcolor;
|
Vector3f bgcolor;
|
||||||
switch (style) {
|
switch (style) {
|
||||||
case DevButtonStyle_::kDark:
|
case DevButtonStyle_::kLight:
|
||||||
fgcolor =
|
fgcolor =
|
||||||
pressed ? Vector3f{0.0f, 0.0f, 0.0f} : Vector3f{0.8f, 0.7f, 0.8f};
|
pressed ? Vector3f{0.0f, 0.0f, 0.0f} : Vector3f{0.9f, 0.8f, 0.9f};
|
||||||
bgcolor =
|
bgcolor =
|
||||||
pressed ? Vector3f{0.6f, 0.5f, 0.6f} : Vector3f{0.16, 0.07f, 0.18f};
|
pressed ? Vector3f{0.8f, 0.7f, 0.8f} : Vector3f{0.4, 0.33f, 0.5f};
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
assert(style == DevButtonStyle_::kNormal);
|
assert(style == DevButtonStyle_::kNormal);
|
||||||
|
|||||||
@ -39,7 +39,7 @@ auto main(int argc, char** argv) -> int {
|
|||||||
namespace ballistica {
|
namespace ballistica {
|
||||||
|
|
||||||
// These are set automatically via script; don't modify them here.
|
// These are set automatically via script; don't modify them here.
|
||||||
const int kEngineBuildNumber = 21995;
|
const int kEngineBuildNumber = 21997;
|
||||||
const char* kEngineVersion = "1.7.37";
|
const char* kEngineVersion = "1.7.37";
|
||||||
const int kEngineApiVersion = 9;
|
const int kEngineApiVersion = 9;
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user