tidying dev-console ui controls

This commit is contained in:
Eric 2024-09-05 16:01:41 -07:00
parent 7122180847
commit fd16eade8d
No known key found for this signature in database
GPG Key ID: 89C93F0F8D6D5A98
11 changed files with 127 additions and 249 deletions

56
.efrocachemap generated
View File

@ -4096,26 +4096,26 @@
"build/assets/windows/Win32/ucrtbased.dll": "2def5335207d41b21b9823f6805997f1",
"build/assets/windows/Win32/vc_redist.x86.exe": "b08a55e2e77623fe657bea24f223a3ae",
"build/assets/windows/Win32/vcruntime140d.dll": "865b2af4d1e26a1a8073c89acb06e599",
"build/prefab/full/linux_arm64_gui/debug/ballisticakit": "8e1c1a6865e87aa0c5a02e65ac3bb8ec",
"build/prefab/full/linux_arm64_gui/release/ballisticakit": "25f7b1b98a98bb2a3e7b5e12362808cb",
"build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "a8573cbcbe45d27f715c25d4394a23fd",
"build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "98b5f12ea27a9af8827b768143e7edb5",
"build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "1ced073c261bb7f4cac0a54b6472b508",
"build/prefab/full/linux_x86_64_gui/release/ballisticakit": "4621ac4aa53d2babf5c67ee13f417e79",
"build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "587ac9f0678caf5d0b7479bffe50db08",
"build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "d20e0fa4d8fd8304b91fd8c3270bf499",
"build/prefab/full/mac_arm64_gui/debug/ballisticakit": "1b3aee01e605c52a6ddafdc77b701e0e",
"build/prefab/full/mac_arm64_gui/release/ballisticakit": "ed2d598a1de3249179b752b1bf3c75a8",
"build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "99e743acc7b9d8d5d849395e0ee726eb",
"build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "d774b4a8a18083262846d41f2db544ea",
"build/prefab/full/mac_x86_64_gui/debug/ballisticakit": "cf4c11956d06b23583cfad2e946b1502",
"build/prefab/full/mac_x86_64_gui/release/ballisticakit": "38a6b5eaa4ef30f400f72b71f69cdd6e",
"build/prefab/full/mac_x86_64_server/debug/dist/ballisticakit_headless": "982a33f7b34f0a2a95a4fe072c7ad561",
"build/prefab/full/mac_x86_64_server/release/dist/ballisticakit_headless": "dd0468ae96203b6af6529612a18e262a",
"build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "d9f152f41b712aa9969fad60d54a5dbd",
"build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "d569374c7e05a01fdd1bfb2b8f622b71",
"build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "703229ffb3bd1e0dd025225bad85d90c",
"build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "3dcf01a911a98b1d01bbd8614e8bef8f",
"build/prefab/full/linux_arm64_gui/debug/ballisticakit": "95dd83eeba34a46aae069cf53222cf26",
"build/prefab/full/linux_arm64_gui/release/ballisticakit": "3ea066eb5a531ac568ea7ddae3f06d74",
"build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "b2947b0b5befc5a49c6ffb6e8e4fadaa",
"build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "fd993504ac5e887197ddc801a08fa067",
"build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "231c01850994ee9c96f322b6bec55112",
"build/prefab/full/linux_x86_64_gui/release/ballisticakit": "15ae4cfab312216ce326fd513a7a72c9",
"build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "0a75e93a21ffb4cf4b888289188e6cb2",
"build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "f2e1c250004f0f028a93f4497ae82dfd",
"build/prefab/full/mac_arm64_gui/debug/ballisticakit": "50653816eac879c6e0d0787ffec6045c",
"build/prefab/full/mac_arm64_gui/release/ballisticakit": "91aa009738cbd48525048f3050c496e6",
"build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "b72e781565fbfe06848f6c38c65691ff",
"build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "252ebec577b0dd2accf3bc0d35d7974e",
"build/prefab/full/mac_x86_64_gui/debug/ballisticakit": "d9e2e578711787da9627acc4be514430",
"build/prefab/full/mac_x86_64_gui/release/ballisticakit": "0a5e4d6b0c9278b4b6adb48b816bae2e",
"build/prefab/full/mac_x86_64_server/debug/dist/ballisticakit_headless": "bf90751a34c9b11ed6b9b9a80a8e7ad2",
"build/prefab/full/mac_x86_64_server/release/dist/ballisticakit_headless": "8d0d41802c8daa56262a49db49f72094",
"build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "44286b725dbe9c9f03d8cd47b48e2ed1",
"build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "f58bc022f7ef2c64cbe5ac395c928552",
"build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "50995542eb1479baeb19454f2f4c73e4",
"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/release/libballisticaplus.a": "fa659b5d6119acba6570c92ce4d35ae2",
"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_server/debug/libballisticaplus.a": "1659535e95e3047fda529543e265ac97",
"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.pdb": "d239aa7f1abe82ab3920147375b5e714",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.lib": "7583533059df43d719c9b0446f282fa3",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.pdb": "dac29b15a3eb1294079ea002d93ec3b1",
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib": "e19618713c795246c4aa64c455235d15",
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb": "7260b697de1753e10a7e8677c787fd16",
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.lib": "b18e673dde3c97d97e74b45467fb23b0",
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.pdb": "60abcbb58579c047ba673519a5029857",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.lib": "c0485c893482ed8d4cd58cca89a91bef",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb": "ff7845b253a5b54a9e3768d2071b945d",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.lib": "a49f3aa9afddcc2408807fd275399868",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.pdb": "2fac5b977c68f28c20f2bb230e15fdac",
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib": "17c44e22e015d13824f1e98f1f632335",
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb": "0237ab1e6ce1d8bea03b85757cd01d8b",
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.lib": "eedd20534754d746b0ec6c1db4d1af6f",
"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/enums.py": "794d258d59fd17a61752843a9a0551ad",
"src/ballistica/base/mgen/pyembed/binding_base.inc": "efa61468cf098f77cc6a234461d8b86d",

View File

@ -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
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.

View File

@ -652,12 +652,6 @@ class App:
'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:
from babase._appmode import AppMode

View File

@ -36,7 +36,7 @@ class DevConsoleTab:
h_anchor: Literal['left', 'center', 'right'] = 'center',
label_scale: float = 1.0,
corner_radius: float = 8.0,
style: Literal['normal', 'dark'] = 'normal',
style: Literal['normal', 'light'] = 'normal',
) -> None:
"""Add a button to the tab being refreshed."""
assert _babase.app.devconsole.is_refreshing
@ -152,30 +152,41 @@ class DevConsoleTabUI(DevConsoleTab):
def refresh(self) -> None:
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(
'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'
' that follow screen edges).',
scale=0.8,
pos=(15, 55),
' that follow screen edges).\n'
'Note that some UI elements'
' may not reflect scale changes until recreated.',
scale=0.6,
pos=(15, 70),
h_anchor='left',
h_align='left',
v_align='none',
v_align='center',
)
ui_overlay = _babase.get_draw_ui_bounds()
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),
size=(200, 30),
h_anchor='left',
label_scale=0.6,
call=self.toggle_ui_overlay,
style='light' if ui_overlay else 'normal',
)
x = 320
x = 300
self.text(
'UI Scale:',
pos=(x - 10, 15),
'UI Scale',
pos=(x - 5, 15),
h_anchor='left',
h_align='right',
v_align='none',
@ -185,14 +196,17 @@ class DevConsoleTabUI(DevConsoleTab):
bwidth = 100
for scale in UIScale:
self.button(
scale.name,
scale.name.lower(),
pos=(x, 10),
size=(bwidth, 30),
h_anchor='left',
label_scale=0.6,
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:
"""Toggle UI overlay drawing."""
@ -221,7 +235,7 @@ class DevConsoleTabTest(DevConsoleTab):
size=(100, 30),
h_anchor='left',
label_scale=0.6,
style='dark',
style='light',
)
self.text(
'TestText',

View File

@ -52,7 +52,7 @@ if TYPE_CHECKING:
# Build number and version of the ballistica binary we expect to be
# using.
TARGET_BALLISTICA_BUILD = 21995
TARGET_BALLISTICA_BUILD = 21997
TARGET_BALLISTICA_VERSION = '1.7.37'

View File

@ -254,42 +254,6 @@ void RendererGL::CheckGLCapabilities_() {
// On Android, look at the GL version and try to get gl3 funcs to
// determine if we're running ES3 or not.
#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;
@ -300,75 +264,7 @@ void RendererGL::CheckGLCapabilities_() {
assert(gl_version_major() == 3);
is_speedy_android_device_ = gl_version_minor() >= 2;
// is_extra_speedy_android_device_ = false;
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
@ -407,15 +303,11 @@ void RendererGL::CheckGLCapabilities_() {
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.
BA_DEBUG_CHECK_GL_ERROR;
// Anisotropic sampling is still an extension as of both GL 3 and ES 3,
// so we need to test for it.
// Anisotropic sampling is still an extension as of both GL 3 and ES 3, so
// we need to test for it.
anisotropic_support_ =
CheckGLExtension(extensions, "texture_filter_anisotropic");
if (anisotropic_support_) {
@ -436,8 +328,8 @@ void RendererGL::CheckGLCapabilities_() {
combined_texture_image_unit_count_ =
GLGetInt(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS);
// If we're running ES3, ask about our max multisample counts and whether we
// can enable MSAA.
// If we're running ES3, ask about our max multisample counts and whether
// we can enable MSAA.
msaa_max_samples_rgb565_ = msaa_max_samples_rgb8_ = 0; // start pessimistic
bool have_gl_get_internal_format_iv{};
@ -850,12 +742,6 @@ void RendererGL::SyncGLState_() {
glFrontFace(GL_CCW);
}
BA_DEBUG_CHECK_GL_ERROR;
// if (time(nullptr)%2 == 0) {
// glEnable(GL_FRAMEBUFFER_SRGB);
// } else {
// glDisable(GL_FRAMEBUFFER_SRGB);
// }
#endif // BA_RIFT_BUILD
active_tex_unit_ = -1; // force a set next time
@ -948,8 +834,8 @@ void RendererGL::SyncGLState_() {
assert(VAR&& VAR == dynamic_cast<TYPE*>(buffer->Get())); \
buffer++
// Takes all latest mesh data from the client side and applies it
// to our gl implementations.
// Takes all latest mesh data from the client side and applies it to our gl
// implementations.
void RendererGL::UpdateMeshes(
const std::vector<Object::Ref<MeshDataClientHandle> >& meshes,
const std::vector<int8_t>& index_sizes,
@ -1193,7 +1079,8 @@ void RendererGL::ProcessRenderCommandBuffer(RenderCommandBuffer* buffer,
const TextureAsset* t = buffer->GetTexture();
const TextureAsset* t_mask = buffer->GetTexture();
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,
std::max(0.0f, shadow_blur), shadow_opacity);
p->SetMaskUV2Texture(t_mask);
@ -1215,7 +1102,8 @@ void RendererGL::ProcessRenderCommandBuffer(RenderCommandBuffer* buffer,
const TextureAsset* t = buffer->GetTexture();
const TextureAsset* t_mask = buffer->GetTexture();
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,
std::max(0.0f, shadow_blur), shadow_opacity);
p->SetMaskUV2Texture(t_mask);
@ -1612,7 +1500,7 @@ void RendererGL::ProcessRenderCommandBuffer(RenderCommandBuffer* buffer,
buffer->GetFloats(&r, &g, &b, &reflect_r, &reflect_g, &reflect_b);
ProgramObjectGL* p;
// Testing why reflection is wonky..
// Testing why reflection is wonky.
if (explicit_bool(false)) {
p = world_space ? obj_lightshad_worldspace_prog_
: obj_lightshad_prog_;
@ -1928,8 +1816,8 @@ void RendererGL::ProcessRenderCommandBuffer(RenderCommandBuffer* buffer,
case ShadingType::kSpecial: {
SetDoubleSided_(false);
// if we ever need to use non-blend version
// of this in real renders, we should split off a non-blend version
// If we ever need to use non-blend version of this in real
// renders, we should split off a non-blend version.
SetBlend(true);
SetBlendPremult(true);
auto source = (SpecialComponent::Source)buffer->GetInt();
@ -2211,8 +2099,8 @@ void RendererGL::BlitBuffer(RenderTarget* src_in, RenderTarget* dst_in,
bool do_shader_blit{true};
// If they want depth we *MUST* use glBlitFramebuffer and can't have linear
// interp.
// If they want depth we *MUST* use glBlitFramebuffer and can't have
// linear interp.
if (depth) {
assert(!force_shader_mode);
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->SetOrthoProjection(-1, 1, -1, 1, -1, 1);
// Copied from ShadingType::kSimpleColor
// Copied from ShadingType::kSimpleColor.
SetDoubleSided_(false);
SetBlend(false);
ProgramSimpleGL* p = simple_tex_prog_;
@ -2554,14 +2442,6 @@ auto RendererGL::GetFunkyDepthIssue_() -> bool {
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
std::string RendererGL::GetAutoAndroidRes() {
assert(g_base->app_adapter->InGraphicsContext());
@ -2759,9 +2639,9 @@ void RendererGL::Load() {
p = shield_prog_ = new ProgramShieldGL(this, 0);
RetainShader_(p);
// Conditional seems to be a *very* slight win on some architectures (A7), a
// loss on some (A5) and a wash on some (Adreno 320).
// Gonna wait before a clean win before turning it on.
// Conditional seems to be a *very* slight win on some architectures (A7),
// a loss on some (A5) and a wash on some (Adreno 320). Gonna wait before
// a clean win before turning it on.
p = postprocess_prog_ = new ProgramPostProcessGL(this, high_qual_pp_flag);
RetainShader_(p);
if (g_base->graphics_server->quality() >= GraphicsQuality::kHigher) {
@ -2805,8 +2685,8 @@ void RendererGL::Load() {
UpdateVignetteTex_(true);
}
// Let's pre-fill our recyclable mesh-datas list to reduce the need to make
// more which could cause hitches.
// Let's pre-fill our recyclable mesh-datas list to reduce the need to
// make more which could cause hitches.
assert(recycle_mesh_datas_simple_split_.empty());
for (int i = 0; i < 10; i++) {
recycle_mesh_datas_simple_split_.push_back(new MeshDataSimpleSplitGL(this));
@ -2958,7 +2838,7 @@ auto RendererGL::NewMeshData(MeshDataType mesh_type,
switch (mesh_type) {
case MeshDataType::kIndexedSimpleSplit: {
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();
if (i != recycle_mesh_datas_simple_split_.rend()) {
data = *i;
@ -2971,7 +2851,7 @@ auto RendererGL::NewMeshData(MeshDataType mesh_type,
}
case MeshDataType::kIndexedObjectSplit: {
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();
if (i != recycle_mesh_datas_object_split_.rend()) {
data = *i;
@ -2984,7 +2864,7 @@ auto RendererGL::NewMeshData(MeshDataType mesh_type,
}
case MeshDataType::kIndexedSimpleFull: {
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();
if (i != recycle_mesh_datas_simple_full_.rend()) {
data = *i;
@ -2998,7 +2878,7 @@ auto RendererGL::NewMeshData(MeshDataType mesh_type,
}
case MeshDataType::kIndexedDualTextureFull: {
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();
if (i != recycle_mesh_datas_dual_texture_full_.rend()) {
data = *i;
@ -3012,7 +2892,7 @@ auto RendererGL::NewMeshData(MeshDataType mesh_type,
}
case MeshDataType::kIndexedSmokeFull: {
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();
if (i != recycle_mesh_datas_smoke_full_.rend()) {
data = *i;
@ -3026,7 +2906,7 @@ auto RendererGL::NewMeshData(MeshDataType mesh_type,
}
case MeshDataType::kSprite: {
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();
if (i != recycle_mesh_datas_sprite_.rend()) {
data = *i;
@ -3046,10 +2926,9 @@ auto RendererGL::NewMeshData(MeshDataType mesh_type,
void RendererGL::DeleteMeshData(MeshRendererData* source_in,
MeshDataType mesh_type) {
// When we're done with mesh-data we keep it around for recycling.
// It seems that killing off VAO/VBOs can be hitchy (on mac at least).
// Hmmm should we have some sort of threshold at which point we kill off
// some?
// When we're done with mesh-data we keep it around for recycling. It
// seems that killing off VAO/VBOs can be hitchy (on mac at least). Hmmm
// should we have some sort of threshold at which point we kill off some?
switch (mesh_type) {
case MeshDataType::kIndexedSimpleSplit: {
@ -3105,8 +2984,8 @@ void RendererGL::DeleteMeshData(MeshRendererData* source_in,
}
void RendererGL::CheckForErrors() {
// lets only check periodically.. i doubt it hurts to run this all the time
// but just in case...
// Lets only check periodically. I doubt it hurts to run this all the time
// but just in case.
error_check_counter_++;
if (error_check_counter_ > 120) {
error_check_counter_ = 0;
@ -3201,8 +3080,8 @@ void RendererGL::GenerateCameraBufferBlurPasses() {
true, // linear_interp
false, // depth
true, // tex
false, // depthTex
high_quality_fbos, // highQuality
false, // depth_tex
high_quality_fbos, // high_quality
false, // msaa
false // alpha
)); // NOLINT(whitespace/parens)
@ -3215,8 +3094,8 @@ void RendererGL::GenerateCameraBufferBlurPasses() {
true, // linear_interp
false, // depth
true, // tex
false, // depthTex
false, // highQuality
false, // depth_tex
false, // high_quality
false, // msaa
false // alpha
)); // NOLINT(whitespace/parens)
@ -3263,9 +3142,9 @@ void RendererGL::CardboardEnableScissor() { glEnable(GL_SCISSOR_TEST); }
void RendererGL::VREyeRenderBegin() {
assert(g_core->vr_mode());
// On rift we need to turn off srgb conversion for each eye render
// so we can dump our linear data into oculus' srgb buffer as-is.
// (we really should add proper srgb support to the engine at some point)
// On rift we need to turn off srgb conversion for each eye render so we
// can dump our linear data into oculus' srgb buffer as-is. (we really
// should add proper srgb support to the engine at some point).
#if BA_RIFT_BUILD
glDisable(GL_FRAMEBUFFER_SRGB);
#endif // BA_RIFT_BUILD
@ -3275,7 +3154,7 @@ void RendererGL::VREyeRenderBegin() {
#if BA_VR_BUILD
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_();
}
#endif // BA_VR_BUILD

View File

@ -7,8 +7,6 @@
#include <string>
#include <vector>
#include "ballistica/shared/ballistica.h"
#if BA_ENABLE_OPENGL
#include "ballistica/base/graphics/gl/gl_sys.h"
@ -27,13 +25,6 @@
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
// perhaps can reconsider that since the 3gs was 15 years ago.
constexpr int kMaxGLTexUnitsUsed = 5;
@ -227,7 +218,6 @@ class RendererGL : public Renderer {
private:
static auto GetFunkyDepthIssue_() -> bool;
// static auto GetDrawsShieldsFunny_()->bool;
void CheckFunkyDepthIssue_();
auto GetMSAASamplesForFramebuffer_(int width, int height) -> int;
void UpdateMSAAEnabled_() override;
@ -248,8 +238,8 @@ class RendererGL : public Renderer {
void ScissorPop_(RenderTarget* render_target);
void BindVertexArray_(GLuint v);
// Note: This is only for use when VAOs aren't supported.
// void SetVertexAttributeArrayEnabled_(GLuint i, bool enabled);
// Note: This is only for use when VAOs aren't supported. void
// SetVertexAttributeArrayEnabled_(GLuint i, bool enabled);
void BindTexture_(GLuint type, const TextureAsset* t, GLuint tex_unit = 0);
void BindTexture_(GLuint type, GLuint tex, GLuint tex_unit = 0);
void BindTextureUnit(uint32_t tex_unit);
@ -276,8 +266,6 @@ class RendererGL : public Renderer {
bool double_sided_{};
bool invalidate_framebuffer_support_{};
bool checked_gl_version_{};
GLint gl_version_major_{};
GLint gl_version_minor_{};
int last_blur_res_count_{};
float last_cam_buffer_width_{};
float last_cam_buffer_height_{};
@ -289,13 +277,15 @@ class RendererGL : public Renderer {
float vignette_tex_inner_b_{};
float depth_range_min_{};
float depth_range_max_{};
GLint gl_version_major_{};
GLint gl_version_minor_{};
GLint screen_framebuffer_{};
GLuint random_tex_{};
GLuint vignette_tex_{};
GLint viewport_x_{};
GLint viewport_y_{};
GLint viewport_width_{};
GLint viewport_height_{};
GLuint vignette_tex_{};
millisecs_t dof_update_time_{};
std::vector<Object::Ref<FramebufferObjectGL> > blur_buffers_;
std::vector<std::unique_ptr<ProgramGL> > shaders_;

View File

@ -472,13 +472,13 @@ void RenderPass::SetFrustum(float near_val, float far_val) {
} else {
// Old angle-based stuff:
float x;
float angleY = (cam_fov_y_ / 2.0f) * kPi / 180.0f;
float y = near_val * tanf(angleY);
float angle_y = (cam_fov_y_ / 2.0f) * kPi / 180.0f;
float y = near_val * tanf(angle_y);
// Fov-x < 0 implies to use aspect ratio.
if (cam_fov_x_ > 0.0f) {
float angleX = (cam_fov_x_ / 2.0f) * kPi / 180.0f;
x = near_val * tanf(angleX);
float angle_x = (cam_fov_x_ / 2.0f) * kPi / 180.0f;
x = near_val * tanf(angle_x);
} else {
x = y * GetPhysicalAspectRatio();
}

View File

@ -328,10 +328,10 @@ void Camera::UpdatePosition() {
x_clamped_focus, y_clamped_focus, z_clamped_focus);
}
// Now, for camera aiming purposes, add some of their velocity and
// clamp to the bounds, taking their radius into account. if our AOI
// sphere is bigger than a given dimension, center it; otherwise
// clamp to the box inset by our radius.
// Now, for camera aiming purposes, add some of their velocity
// and clamp to the bounds, taking their radius into account. if
// our AOI sphere is bigger than a given dimension, center it;
// otherwise clamp to the box inset by our radius.
float x_clamped, y_clamped, z_clamped, x_mirrored_clamped;
float diameter = i.radius() * 2.0f;
@ -371,9 +371,9 @@ void Camera::UpdatePosition() {
i.position().z));
}
// Let's also do a version mirrored across the camera's x coordinate
// (adding this to our tracked point set causes us zoom out instead
// of rotating generally)
// Let's also do a version mirrored across the camera's x
// coordinate (adding this to our tracked point set causes us
// zoom out instead of rotating generally)
float x_mirrored = position_.x - (i.position().x - position_.x);
if (diameter
> (area_of_interest_bounds_[3] - area_of_interest_bounds_[0])) {
@ -395,8 +395,8 @@ void Camera::UpdatePosition() {
z_clamped - position_.z};
// For sample 0, subtract AOI radius in camera-space x and y.
// For sample 1, add them.
// this way we should get the whole sphere.
// For sample 1, add them. this way we should get the whole
// sphere.
if (sample == 0) {
to_point -= corner_offs;
} else if (sample == 1) {
@ -607,7 +607,6 @@ void Camera::Update(millisecs_t elapsed) {
float damping2 = 0.006f;
float xy_blend_speed = 0.0002f;
time_ += elapsed;
// millisecs_t real_time = g_core->GetAppTimeMillisecs();
// Prevent camera "explosions" if we've been unable to update for a while.
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());
}
// If we have no important areas of interest, keep our camera from moving too
// fast.
// If we have no important areas of interest, keep our camera from moving
// too fast.
if (!have_real_areas_of_interest_) {
speed *= 0.5f;
}
@ -952,7 +951,9 @@ void Camera::ApplyToFrameDef(FrameDef* frame_def) {
float final_fov_y2 = final_fov_x / render_ratio;
// 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
// so that we don't see a hitch when it switches.

View File

@ -31,11 +31,11 @@ const float kDevConsoleTabButtonCornerRadius{16.0f};
const double kTransitionSeconds{0.15};
enum class DevConsoleHAnchor_ { kLeft, kCenter, kRight };
enum class DevButtonStyle_ { kNormal, kDark };
enum class DevButtonStyle_ { kNormal, kLight };
static auto DevButtonStyleFromStr_(const char* strval) {
if (!strcmp(strval, "dark")) {
return DevButtonStyle_::kDark;
if (!strcmp(strval, "light")) {
return DevButtonStyle_::kLight;
}
assert(!strcmp(strval, "normal"));
return DevButtonStyle_::kNormal;
@ -247,11 +247,11 @@ class DevConsole::Button_ : public DevConsole::Widget_ {
Vector3f fgcolor;
Vector3f bgcolor;
switch (style) {
case DevButtonStyle_::kDark:
case DevButtonStyle_::kLight:
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 =
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;
default:
assert(style == DevButtonStyle_::kNormal);

View File

@ -39,7 +39,7 @@ auto main(int argc, char** argv) -> int {
namespace ballistica {
// 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 int kEngineApiVersion = 9;