From 3090e018eac74d87c01c672b602cbcf63ccf450a Mon Sep 17 00:00:00 2001 From: Cosmic Linden Date: Mon, 23 Sep 2024 15:55:05 -0700 Subject: secondlife/viewer#2638: Remove pointless assert and cast --- indra/newview/llviewerobject.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index 86440fca48..bc6a343e89 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -5097,8 +5097,7 @@ void LLViewerObject::updateTEMaterialTextures(U8 te) LLUUID mat_id = getRenderMaterialID(te); if (mat == nullptr && mat_id.notNull()) { - mat = (LLFetchedGLTFMaterial*) gGLTFMaterialList.getMaterial(mat_id); - llassert(mat == nullptr || dynamic_cast(gGLTFMaterialList.getMaterial(mat_id)) != nullptr); + mat = gGLTFMaterialList.getMaterial(mat_id); if (mat->isFetching()) { // material is not loaded yet, rebuild draw info when the object finishes loading mat->onMaterialComplete([id=getID()] -- cgit v1.2.3 From 86446c7b55c4265b3dd90919e4d1cd4a4d30ea6a Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Tue, 24 Sep 2024 18:31:48 +0300 Subject: viewer#2648 Fix issues with day offset value --- indra/newview/llenvironment.cpp | 1 + indra/newview/llpanelenvironment.cpp | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/indra/newview/llenvironment.cpp b/indra/newview/llenvironment.cpp index 05bd704556..722c565300 100644 --- a/indra/newview/llenvironment.cpp +++ b/indra/newview/llenvironment.cpp @@ -2087,6 +2087,7 @@ void LLEnvironment::coroUpdateEnvironment(S32 parcel_id, S32 track_no, UpdateInf body[KEY_ENVIRONMENT][KEY_DAYLENGTH] = updates->mDayLength; } + // server only allows positive values if (updates->mDayOffset > 0) { body[KEY_ENVIRONMENT][KEY_DAYOFFSET] = updates->mDayOffset; diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp index 423ca376d1..7dd9f6e86e 100644 --- a/indra/newview/llpanelenvironment.cpp +++ b/indra/newview/llpanelenvironment.cpp @@ -287,7 +287,7 @@ void LLPanelEnvironmentInfo::refresh() F32Hours daylength(mCurrentEnvironment->mDayLength); F32Hours dayoffset(mCurrentEnvironment->mDayOffset); - if (dayoffset.value() > 12.0f) + while (dayoffset.value() >= daylength.value()) dayoffset -= daylength; mSliderDayLength->setValue(daylength.value()); @@ -734,8 +734,8 @@ void LLPanelEnvironmentInfo::onSldDayOffsetChanged(F32 value) { F32Hours dayoffset(value); - if (dayoffset.value() <= 0.0f) - // if day cycle is 5 hours long, we want -1h offset to result in 4h + // server only allows positive values + while (dayoffset.value() <= 0.0f) dayoffset += mCurrentEnvironment->mDayLength; mCurrentEnvironment->mDayOffset = dayoffset; -- cgit v1.2.3 From a2e9a0caf32003253766efe528329fdd11f28b0b Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Tue, 24 Sep 2024 22:20:35 +0300 Subject: viewer-private#291 Object floating text does not update without moving camera --- indra/newview/llhudtext.cpp | 16 +++++++++++++++- indra/newview/llhudtext.h | 4 +++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/indra/newview/llhudtext.cpp b/indra/newview/llhudtext.cpp index 92f09c34a0..818474a0cb 100644 --- a/indra/newview/llhudtext.cpp +++ b/indra/newview/llhudtext.cpp @@ -185,6 +185,15 @@ void LLHUDText::renderText() LLVector3 render_position = mPositionAgent + (x_pixel_vec * screen_offset.mV[VX]) + (y_pixel_vec * screen_offset.mV[VY]); + bool reset_buffers = false; + const F32 treshold = 0.000001f; + if (abs(mLastRenderPosition.mV[VX] - render_position.mV[VX]) > treshold + || abs(mLastRenderPosition.mV[VY] - render_position.mV[VY]) > treshold + || abs(mLastRenderPosition.mV[VZ] - render_position.mV[VZ]) > treshold) + { + reset_buffers = true; + mLastRenderPosition = render_position; + } F32 y_offset = (F32)mOffsetY; @@ -208,6 +217,11 @@ void LLHUDText::renderText() for (std::vector::iterator segment_iter = mTextSegments.begin() + start_segment; segment_iter != mTextSegments.end(); ++segment_iter ) { + if (reset_buffers) + { + segment_iter->mFontBufferText.reset(); + } + const LLFontGL* fontp = segment_iter->mFont; y_offset -= fontp->getLineHeight() - 1; // correction factor to match legacy font metrics @@ -231,7 +245,7 @@ void LLHUDText::renderText() } text_color.mV[VALPHA] *= alpha_factor; - hud_render_text(segment_iter->getText(), render_position, &mFontBuffer, *fontp, style, shadow, x_offset, y_offset, text_color, mOnHUDAttachment); + hud_render_text(segment_iter->getText(), render_position, &segment_iter->mFontBufferText, *fontp, style, shadow, x_offset, y_offset, text_color, mOnHUDAttachment); } } /// Reset the default color to white. The renderer expects this to be the default. diff --git a/indra/newview/llhudtext.h b/indra/newview/llhudtext.h index 224677736c..4c850e2d91 100644 --- a/indra/newview/llhudtext.h +++ b/indra/newview/llhudtext.h @@ -67,6 +67,8 @@ protected: LLColor4 mColor; LLFontGL::StyleFlags mStyle; const LLFontGL* mFont; + LLFontVertexBuffer mFontBuffer; + LLFontVertexBuffer mFontBufferText; private: LLWString mText; std::map mFontWidthMap; @@ -152,6 +154,7 @@ private: const LLFontGL* mBoldFontp; LLRectf mSoftScreenRect; LLVector3 mPositionAgent; + LLVector3 mLastRenderPosition; LLVector2 mPositionOffset; LLVector2 mTargetPositionOffset; F32 mMass; @@ -162,7 +165,6 @@ private: ETextAlignment mTextAlignment; EVertAlignment mVertAlignment; bool mHidden; - LLFontVertexBuffer mFontBuffer; static bool sDisplayText ; static std::set > sTextObjects; -- cgit v1.2.3 From cd8b0a4fc9062e2ea03c41c7c83dbbfde0755d8c Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Tue, 24 Sep 2024 20:15:50 +0300 Subject: Revert "viewer#2413 Remove obsolete alert about expiring voice morphs" This reverts commit 5c16ae13758bdfe8fe1f13d5f67eabbb6eaa30a1. Fix is correct, but should wait untill server sided fix gets deployed. --- indra/newview/app_settings/settings.xml | 11 +++++++ indra/newview/llvoicevivox.cpp | 34 ++++++++++++++++++++++ indra/newview/llvoicevivox.h | 1 + .../newview/skins/default/xui/da/notifications.xml | 4 +++ .../newview/skins/default/xui/de/notifications.xml | 4 +++ .../newview/skins/default/xui/en/notifications.xml | 15 ++++++++++ .../newview/skins/default/xui/es/notifications.xml | 4 +++ .../newview/skins/default/xui/fr/notifications.xml | 4 +++ .../newview/skins/default/xui/it/notifications.xml | 4 +++ .../newview/skins/default/xui/ja/notifications.xml | 11 +++++++ .../newview/skins/default/xui/pl/notifications.xml | 5 ++++ .../newview/skins/default/xui/pt/notifications.xml | 4 +++ .../newview/skins/default/xui/ru/notifications.xml | 6 ++++ .../newview/skins/default/xui/tr/notifications.xml | 6 ++++ .../newview/skins/default/xui/zh/notifications.xml | 6 ++++ 15 files changed, 119 insertions(+) diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 82eb98b06b..3163f5a849 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -13202,6 +13202,17 @@ Value 0 + VoiceEffectExpiryWarningTime + + Comment + How much notice to give of Voice Morph subscriptions expiry, in seconds. + Persist + 1 + Type + S32 + Value + 259200 + VoiceMorphingEnabled Comment diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp index 1e934ade59..e25f914c47 100644 --- a/indra/newview/llvoicevivox.cpp +++ b/indra/newview/llvoicevivox.cpp @@ -6458,6 +6458,7 @@ LLVivoxVoiceClient::voiceFontEntry::voiceFontEntry(LLUUID& id) : mIsNew(false) { mExpiryTimer.stop(); + mExpiryWarningTimer.stop(); } LLVivoxVoiceClient::voiceFontEntry::~voiceFontEntry() @@ -6568,6 +6569,20 @@ void LLVivoxVoiceClient::addVoiceFont(const S32 font_index, font->mExpiryTimer.start(); font->mExpiryTimer.setExpiryAt(expiration_date.secondsSinceEpoch() - VOICE_FONT_EXPIRY_INTERVAL); + // Set the warning timer to some interval before actual expiry. + S32 warning_time = gSavedSettings.getS32("VoiceEffectExpiryWarningTime"); + if (warning_time != 0) + { + font->mExpiryWarningTimer.start(); + F64 expiry_time = (expiration_date.secondsSinceEpoch() - (F64)warning_time); + font->mExpiryWarningTimer.setExpiryAt(expiry_time - VOICE_FONT_EXPIRY_INTERVAL); + } + else + { + // Disable the warning timer. + font->mExpiryWarningTimer.stop(); + } + // Only flag new session fonts after the first time we have fetched the list. if (mVoiceFontsReceived) { @@ -6609,6 +6624,7 @@ void LLVivoxVoiceClient::expireVoiceFonts() // than checking each font individually. bool have_expired = false; + bool will_expire = false; bool expired_in_use = false; LLUUID current_effect = LLVoiceClient::instance().getVoiceEffectDefault(); @@ -6618,6 +6634,7 @@ void LLVivoxVoiceClient::expireVoiceFonts() { voiceFontEntry* voice_font = iter->second; LLFrameTimer& expiry_timer = voice_font->mExpiryTimer; + LLFrameTimer& warning_timer = voice_font->mExpiryWarningTimer; // Check for expired voice fonts if (expiry_timer.getStarted() && expiry_timer.hasExpired()) @@ -6634,6 +6651,14 @@ void LLVivoxVoiceClient::expireVoiceFonts() deleteVoiceFont(voice_font->mID); have_expired = true; } + + // Check for voice fonts that will expire in less that the warning time + if (warning_timer.getStarted() && warning_timer.hasExpired()) + { + LL_DEBUGS("VoiceFont") << "Voice Font " << voice_font->mName << " will expire soon." << LL_ENDL; + will_expire = true; + warning_timer.stop(); + } } LLSD args; @@ -6655,6 +6680,15 @@ void LLVivoxVoiceClient::expireVoiceFonts() // Refresh voice font lists in the UI. notifyVoiceFontObservers(); } + + // Give a warning notification if any voice fonts are due to expire. + if (will_expire) + { + S32Seconds seconds(gSavedSettings.getS32("VoiceEffectExpiryWarningTime")); + args["INTERVAL"] = llformat("%d", LLUnit(seconds).value()); + + LLNotificationsUtil::add("VoiceEffectsWillExpire", args); + } } void LLVivoxVoiceClient::deleteVoiceFont(const LLUUID& id) diff --git a/indra/newview/llvoicevivox.h b/indra/newview/llvoicevivox.h index 3167705528..7862e492b2 100644 --- a/indra/newview/llvoicevivox.h +++ b/indra/newview/llvoicevivox.h @@ -880,6 +880,7 @@ private: bool mIsNew; LLFrameTimer mExpiryTimer; + LLFrameTimer mExpiryWarningTimer; }; bool mVoiceFontsReceived; diff --git a/indra/newview/skins/default/xui/da/notifications.xml b/indra/newview/skins/default/xui/da/notifications.xml index 4a4b7269dc..283a7b2a43 100644 --- a/indra/newview/skins/default/xui/da/notifications.xml +++ b/indra/newview/skins/default/xui/da/notifications.xml @@ -1572,6 +1572,10 @@ Klik på Acceptér for at deltage eller Afvis for at afvise invitationen. Klik p Den aktive stemme "morph" er udløbet og din normale stemme opsætning er genaktiveret. +[[URL] Click here] for at forny dit abbonnement. + + + En eller flere af dine stemme "morphs" vil udløbe om mindre end [INTERVAL] dage. [[URL] Click here] for at forny dit abbonnement. diff --git a/indra/newview/skins/default/xui/de/notifications.xml b/indra/newview/skins/default/xui/de/notifications.xml index 76bebedeec..6ad71e0ad1 100644 --- a/indra/newview/skins/default/xui/de/notifications.xml +++ b/indra/newview/skins/default/xui/de/notifications.xml @@ -2465,6 +2465,10 @@ Wenn Sie Premium-Mitglied sind, [[PREMIUM_URL] klicken Sie hier], um Ihren Voice Das aktive Voice-Morph-Abo ist abgelaufen. Ihre normalen Voice-Einstellungen werden angewendet. [[URL] Klicken Sie hier], um Ihr Abo zu erneuern. +Wenn Sie Premium-Mitglied sind, [[PREMIUM_URL] klicken Sie hier], um Ihren Voice-Morphing-Vorteil zu nutzen. + Ein oder mehrere Ihrer Voice-Morph-Abos laufen in weniger als [INTERVAL] Tagen ab. +[[URL] Klicken Sie hier], um Ihr Abo zu erneuern. + Wenn Sie Premium-Mitglied sind, [[PREMIUM_URL] klicken Sie hier], um Ihren Voice-Morphing-Vorteil zu nutzen. Neue Voice-Morph-Effekte sind erhältlich! Nur Mitglieder einer bestimmten Gruppe dürfen diesen Bereich betreten. diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index 848d9aca7c..5ce73b2cfa 100644 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -8858,6 +8858,21 @@ If you are a Premium Member, [[PREMIUM_URL] click here] to receive your voice mo voice + + +One or more of your Voice Morphs will expire in less than [INTERVAL] days. +[[URL] Click here] to renew your subscription. + +If you are a Premium Member, [[PREMIUM_URL] click here] to receive your voice morphing perk. + fail + voice + + La transformación de voz activa ha caducado y se ha aplicado tu configuración de voz normal. [[URL] Pulsa aquí] para renovar la suscripción. +Si eres un miembro Premium [[PREMIUM_URL] pulsa aquí] para recibir tu beneficio de transformación de voz. + Una o más de tus transformaciones de voz caducarán en menos de [INTERVAL] días. +[[URL] Pulsa aquí] para renovar la suscripción + Si eres un miembro Premium [[PREMIUM_URL] pulsa aquí] para recibir tu beneficio de transformación de voz. Están disponibles nuevas transformaciones de voz. Sólo los miembros de un grupo determinado pueden visitar esta zona. diff --git a/indra/newview/skins/default/xui/fr/notifications.xml b/indra/newview/skins/default/xui/fr/notifications.xml index 17cf18633f..587c88faad 100644 --- a/indra/newview/skins/default/xui/fr/notifications.xml +++ b/indra/newview/skins/default/xui/fr/notifications.xml @@ -2451,6 +2451,10 @@ Si vous êtes un membre Premium, [[PREMIUM_URL] cliquez ici] pour recevoir votr [[URL] Cliquez ici] pour renouveler votre abonnement. Si vous êtes un membre Premium, [[PREMIUM_URL] cliquez ici] pour recevoir votre effet de voix. + Au moins l'un de vos effets de voix expirera dans moins de [INTERVAL] jours. +[[URL] Cliquez ici] pour renouveler votre abonnement. + +Si vous êtes un membre Premium, [[PREMIUM_URL] cliquez ici] pour recevoir votre effet de voix. De nouveaux effets de voix sont disponibles ! Seuls les membres d'un certain groupe peuvent visiter cette zone. Vous ne pouvez pas pénétrer sur ce terrain car l'accès vous y est interdit. diff --git a/indra/newview/skins/default/xui/it/notifications.xml b/indra/newview/skins/default/xui/it/notifications.xml index 1c40e7304a..f79cc1515b 100644 --- a/indra/newview/skins/default/xui/it/notifications.xml +++ b/indra/newview/skins/default/xui/it/notifications.xml @@ -2453,6 +2453,10 @@ Se sei un membro Premium, [[PREMIUM_URL] fai clic qui] per ricevere in regalo la Poiché la manipolazione vocale attiva è scaduta, sono state applicate le tue impostazioni normali. [[URL] Fai clic qui] per rinnovare l'abbonamento. +Se sei un membro Premium, [[PREMIUM_URL] fai clic qui] per ricevere in regalo la manipolazione vocale. + Almeno una delle tue manipolazioni vocali scadrà tra meno di [INTERVAL] giorni. +[[URL] Fai clic qui] per rinnovare l'abbonamento. + Se sei un membro Premium, [[PREMIUM_URL] fai clic qui] per ricevere in regalo la manipolazione vocale. Sono disponibili nuove manipolazioni vocali. Soltanto i membri di un determinato gruppo possono visitare questa zona. diff --git a/indra/newview/skins/default/xui/ja/notifications.xml b/indra/newview/skins/default/xui/ja/notifications.xml index fbd56e118c..123e95df04 100644 --- a/indra/newview/skins/default/xui/ja/notifications.xml +++ b/indra/newview/skins/default/xui/ja/notifications.xml @@ -4655,6 +4655,17 @@ Webページにリンクすると、他人がこの場所に簡単にアクセ ボイスモーフィング効果の有効期限が終了したため、あなたの通常のボイス設定が適用されました。 期限を延長・更新するには[[URL] ここ]をクリックしてください。 +プレミアム会員の方は、[[PREMIUM_URL] ここ]をクリックしてボイスモーフィング特典をお受け取りください。 + + fail + + + voice + + + ボイスモーフィング効果の1つ、または複数の有効期限が[INTERVAL]日以内に終了します。 +期限を延長・更新するには[[URL] ここ]をクリックしてください。 + プレミアム会員の方は、[[PREMIUM_URL] ここ]をクリックしてボイスモーフィング特典をお受け取りください。 fail diff --git a/indra/newview/skins/default/xui/pl/notifications.xml b/indra/newview/skins/default/xui/pl/notifications.xml index 17c11bc75f..e668c6cc20 100644 --- a/indra/newview/skins/default/xui/pl/notifications.xml +++ b/indra/newview/skins/default/xui/pl/notifications.xml @@ -3116,6 +3116,11 @@ Jeśli jesteś użytkownikiem premium, to [[PREMIUM_URL] kliknij tutaj] aby otrz Czas aktywności Przekształcenia Głosu wygasł, normalne ustawienia Twojego głosu zostały zastosowane. [[URL] Kliknij tutaj] aby odnowić subskrypcję. +Jeśli jesteś użytkownikiem premium, to [[PREMIUM_URL] kliknij tutaj] aby otrzymać swój perk Przekształceń Głosu. + + + Jedno lub więcej z Twoich Przekształceń Głosu wygaśnie za mniej niż [INTERVAL] dni. +[[URL] Kliknij tutaj] aby odnowić subskrypcję. Jeśli jesteś użytkownikiem premium, to [[PREMIUM_URL] kliknij tutaj] aby otrzymać swój perk Przekształceń Głosu. diff --git a/indra/newview/skins/default/xui/pt/notifications.xml b/indra/newview/skins/default/xui/pt/notifications.xml index 0390239669..a3220bca54 100644 --- a/indra/newview/skins/default/xui/pt/notifications.xml +++ b/indra/newview/skins/default/xui/pt/notifications.xml @@ -2440,6 +2440,10 @@ Se você é um Membro Premium, [[PREMIUM_URL] clique aqui] para receber o seu ap A Distorção de voz ativa expirou. Suas configurações de voz padrão foram ativadas. [[URL] Clique aqui] para renovar o serviço. +Se você é um Membro Premium, [[PREMIUM_URL] clique aqui] para receber o seu app de distorção de voz. + Uma ou mais das suas distorções de voz tem vencimento em menos de [INTERVAL] dias. +[[URL] Clique aqui] para renovar o serviço. + Se você é um Membro Premium, [[PREMIUM_URL] clique aqui] para receber o seu app de distorção de voz. Novas Distorções de voz! Só membros de um grupo podem acessar esta área. diff --git a/indra/newview/skins/default/xui/ru/notifications.xml b/indra/newview/skins/default/xui/ru/notifications.xml index bde18edc23..e75fd1fd82 100644 --- a/indra/newview/skins/default/xui/ru/notifications.xml +++ b/indra/newview/skins/default/xui/ru/notifications.xml @@ -3230,6 +3230,12 @@ Истек срок действия анимационного изменения голоса, действуют настройки вашего обычного голоса. [[URL] Щелкните здесь], чтобы обновить подписку. +Если вы - владелец премиум-аккаунта, [[PREMIUM_URL] щелкните здесь], чтобы получить право на анимационное изменение голоса. + + + Срок действия одного или нескольких ваших типов анимационного изменения голоса истекает через [INTERVAL] дней или раньше. +[[URL] Щелкните здесь], чтобы обновить подписку. + Если вы - владелец премиум-аккаунта, [[PREMIUM_URL] щелкните здесь], чтобы получить право на анимационное изменение голоса. diff --git a/indra/newview/skins/default/xui/tr/notifications.xml b/indra/newview/skins/default/xui/tr/notifications.xml index 30aa0c0342..17d2969d19 100644 --- a/indra/newview/skins/default/xui/tr/notifications.xml +++ b/indra/newview/skins/default/xui/tr/notifications.xml @@ -3230,6 +3230,12 @@ Aboneliğinizi yenilemek için [[URL] buraya tıklayın]. Etkin Ses Dönüşümünün süresi dolmuş, normal ses ayarlarınız uygulandı. Aboneliğinizi yenilemek için [[URL] buraya tıklayın]. +Özel Üye iseniz, ses dönüştürme özelliğini almak için [[PREMIUM_URL] buraya tıklayın]. + + + Ses Dönüşümlerinizden birinin ya da daha fazlasının süresi [INTERVAL] günden daha az bir zamanda dolacak. +Aboneliğinizi yenilemek için [[URL] buraya tıklayın]. + Özel Üye iseniz, ses dönüştürme özelliğini almak için [[PREMIUM_URL] buraya tıklayın]. diff --git a/indra/newview/skins/default/xui/zh/notifications.xml b/indra/newview/skins/default/xui/zh/notifications.xml index 3ebea7dc27..4d0f1cb85b 100644 --- a/indra/newview/skins/default/xui/zh/notifications.xml +++ b/indra/newview/skins/default/xui/zh/notifications.xml @@ -3214,6 +3214,12 @@ SHA1 指紋:[MD5_DIGEST] 使用中的變聲效果已經過期,已用你平時的聲音設定取代。 [[URL] 點按這裡]繼續訂用。 +付費用戶請[[PREMIUM_URL] 點按這裡]領取免費變聲工具。 + + + 至少一個你訂用的變聲效果將在 [INTERVAL] 天後到期。 +[[URL] 點按這裡]繼續訂用。 + 付費用戶請[[PREMIUM_URL] 點按這裡]領取免費變聲工具。 -- cgit v1.2.3 From d73395a0aa8ab4d2bb4623487be106690714524e Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Tue, 24 Sep 2024 20:23:06 +0300 Subject: viewer#2413 Add 'ignore' checkbox to expiring voice morphs --- indra/newview/skins/default/xui/en/notifications.xml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index 5ce73b2cfa..a03259bd1b 100644 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -8870,7 +8870,11 @@ One or more of your Voice Morphs will expire in less than [INTERVAL] days. If you are a Premium Member, [[PREMIUM_URL] click here] to receive your voice morphing perk. fail - voice + voice + Date: Wed, 25 Sep 2024 18:14:45 +0300 Subject: viewer#2413 Partially remove obsolete alert about expiring voice morphs VoiceEffectsWillExpire can be triggered externally. Don't remove the notification, only viewer's code that triggers it so that external notification keeps working. --- indra/newview/app_settings/settings.xml | 11 ----------- indra/newview/llvoicevivox.cpp | 34 --------------------------------- indra/newview/llvoicevivox.h | 1 - 3 files changed, 46 deletions(-) diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 3163f5a849..82eb98b06b 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -13202,17 +13202,6 @@ Value 0 - VoiceEffectExpiryWarningTime - - Comment - How much notice to give of Voice Morph subscriptions expiry, in seconds. - Persist - 1 - Type - S32 - Value - 259200 - VoiceMorphingEnabled Comment diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp index e25f914c47..1e934ade59 100644 --- a/indra/newview/llvoicevivox.cpp +++ b/indra/newview/llvoicevivox.cpp @@ -6458,7 +6458,6 @@ LLVivoxVoiceClient::voiceFontEntry::voiceFontEntry(LLUUID& id) : mIsNew(false) { mExpiryTimer.stop(); - mExpiryWarningTimer.stop(); } LLVivoxVoiceClient::voiceFontEntry::~voiceFontEntry() @@ -6569,20 +6568,6 @@ void LLVivoxVoiceClient::addVoiceFont(const S32 font_index, font->mExpiryTimer.start(); font->mExpiryTimer.setExpiryAt(expiration_date.secondsSinceEpoch() - VOICE_FONT_EXPIRY_INTERVAL); - // Set the warning timer to some interval before actual expiry. - S32 warning_time = gSavedSettings.getS32("VoiceEffectExpiryWarningTime"); - if (warning_time != 0) - { - font->mExpiryWarningTimer.start(); - F64 expiry_time = (expiration_date.secondsSinceEpoch() - (F64)warning_time); - font->mExpiryWarningTimer.setExpiryAt(expiry_time - VOICE_FONT_EXPIRY_INTERVAL); - } - else - { - // Disable the warning timer. - font->mExpiryWarningTimer.stop(); - } - // Only flag new session fonts after the first time we have fetched the list. if (mVoiceFontsReceived) { @@ -6624,7 +6609,6 @@ void LLVivoxVoiceClient::expireVoiceFonts() // than checking each font individually. bool have_expired = false; - bool will_expire = false; bool expired_in_use = false; LLUUID current_effect = LLVoiceClient::instance().getVoiceEffectDefault(); @@ -6634,7 +6618,6 @@ void LLVivoxVoiceClient::expireVoiceFonts() { voiceFontEntry* voice_font = iter->second; LLFrameTimer& expiry_timer = voice_font->mExpiryTimer; - LLFrameTimer& warning_timer = voice_font->mExpiryWarningTimer; // Check for expired voice fonts if (expiry_timer.getStarted() && expiry_timer.hasExpired()) @@ -6651,14 +6634,6 @@ void LLVivoxVoiceClient::expireVoiceFonts() deleteVoiceFont(voice_font->mID); have_expired = true; } - - // Check for voice fonts that will expire in less that the warning time - if (warning_timer.getStarted() && warning_timer.hasExpired()) - { - LL_DEBUGS("VoiceFont") << "Voice Font " << voice_font->mName << " will expire soon." << LL_ENDL; - will_expire = true; - warning_timer.stop(); - } } LLSD args; @@ -6680,15 +6655,6 @@ void LLVivoxVoiceClient::expireVoiceFonts() // Refresh voice font lists in the UI. notifyVoiceFontObservers(); } - - // Give a warning notification if any voice fonts are due to expire. - if (will_expire) - { - S32Seconds seconds(gSavedSettings.getS32("VoiceEffectExpiryWarningTime")); - args["INTERVAL"] = llformat("%d", LLUnit(seconds).value()); - - LLNotificationsUtil::add("VoiceEffectsWillExpire", args); - } } void LLVivoxVoiceClient::deleteVoiceFont(const LLUUID& id) diff --git a/indra/newview/llvoicevivox.h b/indra/newview/llvoicevivox.h index 7862e492b2..3167705528 100644 --- a/indra/newview/llvoicevivox.h +++ b/indra/newview/llvoicevivox.h @@ -880,7 +880,6 @@ private: bool mIsNew; LLFrameTimer mExpiryTimer; - LLFrameTimer mExpiryWarningTimer; }; bool mVoiceFontsReceived; -- cgit v1.2.3 From 49a2c136f99cf90abc94f1ce84d3c6f2be2815d0 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Wed, 25 Sep 2024 21:35:20 +0300 Subject: viewer#2646 Fix viewer ignoring Physics Shape Type changes asStringRef is only valid for strings --- indra/llui/llcombobox.cpp | 2 +- indra/llui/llscrolllistctrl.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/indra/llui/llcombobox.cpp b/indra/llui/llcombobox.cpp index a1c16ccdec..f3876ef695 100644 --- a/indra/llui/llcombobox.cpp +++ b/indra/llui/llcombobox.cpp @@ -365,7 +365,7 @@ void LLComboBox::setValue(const LLSD& value) if (LLScrollListItem* item = mList->getFirstSelected()) { LLSD item_value = item->getValue(); - if (item_value.asStringRef() == value.asStringRef()) + if (item_value.asString() == value.asString()) return; } diff --git a/indra/llui/llscrolllistctrl.cpp b/indra/llui/llscrolllistctrl.cpp index 445377d3a2..93bd3c6bed 100644 --- a/indra/llui/llscrolllistctrl.cpp +++ b/indra/llui/llscrolllistctrl.cpp @@ -490,12 +490,12 @@ std::vector LLScrollListCtrl::getAllData() const // returns first matching item LLScrollListItem* LLScrollListCtrl::getItem(const LLSD& sd) const { - const std::string& string_val = sd.asStringRef(); + std::string string_val = sd.asString(); for (LLScrollListItem* item : mItemList) { // assumes string representation is good enough for comparison - if (item->getValue().asStringRef() == string_val) + if (item->getValue().asString() == string_val) { return item; } -- cgit v1.2.3 From 9bf8fb38b3348da47caa26ac89072590ddec1d99 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Wed, 25 Sep 2024 18:03:57 -0700 Subject: Issue #2687: Honor flag sent by server indicating server side autopilot is engaged. When flag is set allow sever to update local avatar rotation. --- indra/llprimitive/object_flags.h | 12 ++++++------ indra/newview/llviewerobject.cpp | 6 ++++++ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/indra/llprimitive/object_flags.h b/indra/llprimitive/object_flags.h index e2cdba072a..06e216ba49 100644 --- a/indra/llprimitive/object_flags.h +++ b/indra/llprimitive/object_flags.h @@ -57,16 +57,16 @@ const U32 FLAGS_CAMERA_SOURCE = (1U << 22); //const U32 FLAGS_UNUSED_001 = (1U << 23); // was FLAGS_CAST_SHADOWS -//const U32 FLAGS_UNUSED_002 = (1U << 24); -//const U32 FLAGS_UNUSED_003 = (1U << 25); -//const U32 FLAGS_UNUSED_004 = (1U << 26); -//const U32 FLAGS_UNUSED_005 = (1U << 27); +const U32 FLAGS_SERVER_AUTOPILOT = (1U << 24); // Update was for an agent AND that agent is being autopiloted from the server +//const U32 FLAGS_UNUSED_002 = (1U << 25); +//const U32 FLAGS_UNUSED_003 = (1U << 26); +//const U32 FLAGS_UNUSED_004 = (1U << 27); const U32 FLAGS_OBJECT_OWNER_MODIFY = (1U << 28); const U32 FLAGS_TEMPORARY_ON_REZ = (1U << 29); -//const U32 FLAGS_UNUSED_006 = (1U << 30); // was FLAGS_TEMPORARY -//const U32 FLAGS_UNUSED_007 = (1U << 31); // was FLAGS_ZLIB_COMPRESSED +//const U32 FLAGS_UNUSED_005 = (1U << 30); // was FLAGS_TEMPORARY +//const U32 FLAGS_UNUSED_006 = (1U << 31); // was FLAGS_ZLIB_COMPRESSED const U32 FLAGS_LOCAL = FLAGS_ANIM_SOURCE | FLAGS_CAMERA_SOURCE; const U32 FLAGS_WORLD = FLAGS_USE_PHYSICS | FLAGS_PHANTOM | FLAGS_TEMPORARY_ON_REZ; diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index 41b2c4b44b..6456c98093 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -2325,6 +2325,12 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, // Set the rotation of the object followed by adjusting for the accumulated angular velocity (llSetTargetOmega) setRotation(new_rot * mAngularVelocityRot); + if ((mFlags & FLAGS_SERVER_AUTOPILOT) && asAvatar() && asAvatar()->isSelf()) + { + gAgent.resetAxes(); + gAgent.rotate(new_rot); + gAgentCamera.resetView(); + } setChanged(ROTATED | SILHOUETTE); } -- cgit v1.2.3 From b6cbad1cf6c6ae6293825da776ce2191175d4632 Mon Sep 17 00:00:00 2001 From: Mnikolenko Productengine Date: Mon, 16 Sep 2024 20:29:53 +0300 Subject: Lua api for autopilot functions --- indra/newview/llagentlistener.cpp | 56 ++++++++++++++++++--------- indra/newview/scripts/lua/require/LLAgent.lua | 49 +++++++++++++++++++++++ 2 files changed, 86 insertions(+), 19 deletions(-) diff --git a/indra/newview/llagentlistener.cpp b/indra/newview/llagentlistener.cpp index d9002bf073..120e52402d 100644 --- a/indra/newview/llagentlistener.cpp +++ b/indra/newview/llagentlistener.cpp @@ -87,14 +87,15 @@ LLAgentListener::LLAgentListener(LLAgent &agent) add("startAutoPilot", "Start the autopilot system using the following parameters:\n" "[\"target_global\"]: array of target global {x, y, z} position\n" - "[\"stop_distance\"]: target maxiumum distance from target [default: autopilot guess]\n" + "[\"stop_distance\"]: target maximum distance from target [default: autopilot guess]\n" "[\"target_rotation\"]: array of [x, y, z, w] quaternion values [default: no target]\n" "[\"rotation_threshold\"]: target maximum angle from target facing rotation [default: 0.03 radians]\n" "[\"behavior_name\"]: name of the autopilot behavior [default: \"\"]" "[\"allow_flying\"]: allow flying during autopilot [default: True]", //"[\"callback_pump\"]: pump to send success/failure and callback data to [default: none]\n" //"[\"callback_data\"]: data to send back during a callback [default: none]", - &LLAgentListener::startAutoPilot); + &LLAgentListener::startAutoPilot, + llsd::map("target_global", LLSD())); add("getAutoPilot", "Send information about current state of the autopilot system to [\"reply\"]:\n" "[\"enabled\"]: boolean indicating whether or not autopilot is enabled\n" @@ -107,13 +108,14 @@ LLAgentListener::LLAgentListener(LLAgent &agent) "[\"rotation_threshold\"]: target maximum angle from target facing rotation\n" "[\"behavior_name\"]: name of the autopilot behavior", &LLAgentListener::getAutoPilot, - LLSDMap("reply", LLSD())); + llsd::map("reply", LLSD())); add("startFollowPilot", "[\"leader_id\"]: uuid of target to follow using the autopilot system (optional with avatar_name)\n" "[\"avatar_name\"]: avatar name to follow using the autopilot system (optional with leader_id)\n" "[\"allow_flying\"]: allow flying during autopilot [default: True]\n" - "[\"stop_distance\"]: target maxiumum distance from target [default: autopilot guess]", - &LLAgentListener::startFollowPilot); + "[\"stop_distance\"]: target maximum distance from target [default: autopilot guess]", + &LLAgentListener::startFollowPilot, + llsd::map("reply", LLSD())); add("setAutoPilotTarget", "Update target for currently running autopilot:\n" "[\"target_global\"]: array of target global {x, y, z} position", @@ -205,7 +207,7 @@ void LLAgentListener::requestSit(LLSD const & event_data) const //mAgent.getAvatarObject()->sitOnObject(); // shamelessly ripped from llviewermenu.cpp:handle_sit_or_stand() // *TODO - find a permanent place to share this code properly. - + Response response(LLSD(), event_data); LLViewerObject *object = NULL; if (event_data.has("obj_uuid")) { @@ -216,6 +218,12 @@ void LLAgentListener::requestSit(LLSD const & event_data) const LLVector3 target_position = ll_vector3_from_sd(event_data["position"]); object = findObjectClosestTo(target_position); } + else + { + //just sit on the ground + mAgent.setControlFlags(AGENT_CONTROL_SIT_ON_GROUND); + return; + } if (object && object->getPCode() == LL_PCODE_VOLUME) { @@ -231,8 +239,7 @@ void LLAgentListener::requestSit(LLSD const & event_data) const } else { - LL_WARNS() << "LLAgent requestSit could not find the sit target: " - << event_data << LL_ENDL; + response.error("requestSit could not find the sit target"); } } @@ -354,11 +361,10 @@ void LLAgentListener::getPosition(const LLSD& event_data) const void LLAgentListener::startAutoPilot(LLSD const & event_data) { - LLQuaternion target_rotation_value; LLQuaternion* target_rotation = NULL; if (event_data.has("target_rotation")) { - target_rotation_value = ll_quaternion_from_sd(event_data["target_rotation"]); + LLQuaternion target_rotation_value = ll_quaternion_from_sd(event_data["target_rotation"]); target_rotation = &target_rotation_value; } // *TODO: Use callback_pump and callback_data @@ -381,11 +387,17 @@ void LLAgentListener::startAutoPilot(LLSD const & event_data) stop_distance = (F32)event_data["stop_distance"].asReal(); } + std::string behavior_name = LLCoros::getName(); + if (event_data.has("behavior_name")) + { + behavior_name = event_data["behavior_name"].asString(); + } + // Clear follow target, this is doing a path mFollowTarget.setNull(); mAgent.startAutoPilotGlobal(ll_vector3d_from_sd(event_data["target_global"]), - event_data["behavior_name"], + behavior_name, target_rotation, NULL, NULL, stop_distance, @@ -395,7 +407,7 @@ void LLAgentListener::startAutoPilot(LLSD const & event_data) void LLAgentListener::getAutoPilot(const LLSD& event_data) const { - LLSD reply = LLSD::emptyMap(); + Response reply(LLSD(), event_data); LLSD::Boolean enabled = mAgent.getAutoPilot(); reply["enabled"] = enabled; @@ -424,12 +436,11 @@ void LLAgentListener::getAutoPilot(const LLSD& event_data) const reply["rotation_threshold"] = mAgent.getAutoPilotRotationThreshold(); reply["behavior_name"] = mAgent.getAutoPilotBehaviorName(); reply["fly"] = (LLSD::Boolean) mAgent.getFlying(); - - sendReply(reply, event_data); } void LLAgentListener::startFollowPilot(LLSD const & event_data) { + Response response(LLSD(), event_data); LLUUID target_id; bool allow_flying = true; @@ -463,6 +474,10 @@ void LLAgentListener::startFollowPilot(LLSD const & event_data) } } } + else + { + return response.error("'leader_id' or 'avatar_name' should be specified"); + } F32 stop_distance = 0.f; if (event_data.has("stop_distance")) @@ -470,13 +485,16 @@ void LLAgentListener::startFollowPilot(LLSD const & event_data) stop_distance = (F32)event_data["stop_distance"].asReal(); } - if (target_id.notNull()) + if (!gObjectList.findObject(target_id)) { - mAgent.setFlying(allow_flying); - mFollowTarget = target_id; // Save follow target so we can report distance later - - mAgent.startFollowPilot(target_id, allow_flying, stop_distance); + std::string target_info = event_data.has("leader_id") ? event_data["target_id"] : event_data["avatar_name"]; + return response.error(stringize("Target ", std::quoted(target_info), " was not found")); } + + mAgent.setFlying(allow_flying); + mFollowTarget = target_id; // Save follow target so we can report distance later + + mAgent.startFollowPilot(target_id, allow_flying, stop_distance); } void LLAgentListener::setAutoPilotTarget(LLSD const & event_data) const diff --git a/indra/newview/scripts/lua/require/LLAgent.lua b/indra/newview/scripts/lua/require/LLAgent.lua index 5cee998fcd..7b12493acc 100644 --- a/indra/newview/scripts/lua/require/LLAgent.lua +++ b/indra/newview/scripts/lua/require/LLAgent.lua @@ -80,4 +80,53 @@ function LLAgent.teleport(...) return leap.request('LLTeleportHandler', args).message end +function LLAgent.requestSit(...) + local args = mapargs('obj_uuid,position', ...) + args.op = 'requestSit' + return leap.request('LLAgent', args) +end + +function LLAgent.requestStand() + leap.send('LLAgent', {op = 'requestStand'}) +end + +-- Start the autopilot to move to "target_global" location using specified parameters +-- LLAgent.startAutoPilot{ target_global array of target global {x, y, z} position +-- [, allow_flying] allow flying during autopilot [default: true] +-- [, stop_distance] target maximum distance from target [default: autopilot guess] +-- [, behavior_name] name of the autopilot behavior [default: (script name)] +-- [, target_rotation] array of [x, y, z, w] quaternion values [default: no target] +-- [, rotation_threshold] target maximum angle from target facing rotation [default: 0.03 radians] +function LLAgent.startAutoPilot(...) + local args = mapargs('target_global,allow_flying,stop_distance,behavior_name,target_rotation,rotation_threshold', ...) + args.op = 'startAutoPilot' + leap.send('LLAgent', args) +end + +-- Update target location for currently running autopilot +function LLAgent.setAutoPilotTarget(target_global) + leap.send('LLAgent', {op = 'setAutoPilotTarget', target_global=target_global}) +end + +-- Start the autopilot to move to the specified target location +-- either "leader_id" (uuid of target) or "avatar_name" (avatar full name) should be specified +-- "allow_flying" [default: true], "stop_distance" [default: autopilot guess] +function LLAgent.startFollowPilot(...) + local args = mapargs('leader_id,avatar_name,allow_flying,stop_distance', ...) + args.op = 'startFollowPilot' + return leap.request('LLAgent', args) +end + +-- Stop the autopilot system: "user_cancel" indicates whether or not to act as though user canceled autopilot [default: false] +function LLAgent.stopAutoPilot(...) + local args = mapargs('user_cancel', ...) + args.op = 'stopAutoPilot' + leap.send('LLAgent', args) +end + +-- Get information about current state of the autopilot +function LLAgent.getAutoPilot() + return leap.request('LLAgent', {op = 'getAutoPilot'}) +end + return LLAgent -- cgit v1.2.3 From ed7603bfe63ce5e8c1ff1101270e0406de01dc92 Mon Sep 17 00:00:00 2001 From: Mnikolenko Productengine Date: Tue, 17 Sep 2024 12:37:17 +0300 Subject: Use event pump to get autopilot status, when it's terminated; add demo script --- indra/newview/llagentlistener.cpp | 29 ++++++++----- indra/newview/llagentlistener.h | 2 +- indra/newview/scripts/lua/require/LLAgent.lua | 13 +++++- indra/newview/scripts/lua/require/LLChat.lua | 1 + .../newview/scripts/lua/require/LLChatListener.lua | 48 --------------------- indra/newview/scripts/lua/require/LLListener.lua | 50 ++++++++++++++++++++++ indra/newview/scripts/lua/test_LLChatListener.lua | 6 +-- indra/newview/scripts/lua/test_autopilot.lua | 22 ++++++++++ 8 files changed, 108 insertions(+), 63 deletions(-) delete mode 100644 indra/newview/scripts/lua/require/LLChatListener.lua create mode 100644 indra/newview/scripts/lua/require/LLListener.lua create mode 100644 indra/newview/scripts/lua/test_autopilot.lua diff --git a/indra/newview/llagentlistener.cpp b/indra/newview/llagentlistener.cpp index 120e52402d..10f56c4eb3 100644 --- a/indra/newview/llagentlistener.cpp +++ b/indra/newview/llagentlistener.cpp @@ -90,10 +90,9 @@ LLAgentListener::LLAgentListener(LLAgent &agent) "[\"stop_distance\"]: target maximum distance from target [default: autopilot guess]\n" "[\"target_rotation\"]: array of [x, y, z, w] quaternion values [default: no target]\n" "[\"rotation_threshold\"]: target maximum angle from target facing rotation [default: 0.03 radians]\n" - "[\"behavior_name\"]: name of the autopilot behavior [default: \"\"]" - "[\"allow_flying\"]: allow flying during autopilot [default: True]", - //"[\"callback_pump\"]: pump to send success/failure and callback data to [default: none]\n" - //"[\"callback_data\"]: data to send back during a callback [default: none]", + "[\"behavior_name\"]: name of the autopilot behavior [default: \"\"]\n" + "[\"allow_flying\"]: allow flying during autopilot [default: True]\n" + "event with [\"success\"] flag is sent to 'LLAutopilot' event pump, when auto pilot is terminated", &LLAgentListener::startAutoPilot, llsd::map("target_global", LLSD())); add("getAutoPilot", @@ -216,7 +215,7 @@ void LLAgentListener::requestSit(LLSD const & event_data) const else if (event_data.has("position")) { LLVector3 target_position = ll_vector3_from_sd(event_data["position"]); - object = findObjectClosestTo(target_position); + object = findObjectClosestTo(target_position, true); } else { @@ -249,7 +248,7 @@ void LLAgentListener::requestStand(LLSD const & event_data) const } -LLViewerObject * LLAgentListener::findObjectClosestTo( const LLVector3 & position ) const +LLViewerObject * LLAgentListener::findObjectClosestTo(const LLVector3 & position, bool sit_target) const { LLViewerObject *object = NULL; @@ -260,8 +259,13 @@ LLViewerObject * LLAgentListener::findObjectClosestTo( const LLVector3 & positio while (cur_index < num_objects) { LLViewerObject * cur_object = gObjectList.getObject(cur_index++); - if (cur_object) - { // Calculate distance from the target position + if (cur_object && !cur_object->isAttachment()) + { + if(sit_target && (cur_object->getPCode() != LL_PCODE_VOLUME)) + { + continue; + } + // Calculate distance from the target position LLVector3 target_diff = cur_object->getPositionRegion() - position; F32 distance_to_target = target_diff.length(); if (distance_to_target < min_distance) @@ -367,7 +371,7 @@ void LLAgentListener::startAutoPilot(LLSD const & event_data) LLQuaternion target_rotation_value = ll_quaternion_from_sd(event_data["target_rotation"]); target_rotation = &target_rotation_value; } - // *TODO: Use callback_pump and callback_data + F32 rotation_threshold = 0.03f; if (event_data.has("rotation_threshold")) { @@ -396,10 +400,15 @@ void LLAgentListener::startAutoPilot(LLSD const & event_data) // Clear follow target, this is doing a path mFollowTarget.setNull(); + auto finish_cb = [](bool success, void*) + { + LLEventPumps::instance().obtain("LLAutopilot").post(llsd::map("success", success)); + }; + mAgent.startAutoPilotGlobal(ll_vector3d_from_sd(event_data["target_global"]), behavior_name, target_rotation, - NULL, NULL, + finish_cb, NULL, stop_distance, rotation_threshold, allow_flying); diff --git a/indra/newview/llagentlistener.h b/indra/newview/llagentlistener.h index 2765bb5b66..05724ff443 100644 --- a/indra/newview/llagentlistener.h +++ b/indra/newview/llagentlistener.h @@ -67,7 +67,7 @@ private: void stopAnimation(LLSD const &event_data); void getAnimationInfo(LLSD const &event_data); - LLViewerObject * findObjectClosestTo( const LLVector3 & position ) const; + LLViewerObject * findObjectClosestTo( const LLVector3 & position, bool sit_target = false ) const; private: LLAgent & mAgent; diff --git a/indra/newview/scripts/lua/require/LLAgent.lua b/indra/newview/scripts/lua/require/LLAgent.lua index 7b12493acc..4a1132fe7e 100644 --- a/indra/newview/scripts/lua/require/LLAgent.lua +++ b/indra/newview/scripts/lua/require/LLAgent.lua @@ -80,6 +80,11 @@ function LLAgent.teleport(...) return leap.request('LLTeleportHandler', args).message end +-- Call with no arguments to sit on the ground. +-- Otherwise specify "obj_uuid" to sit on, +-- or region "position" {x, y, z} where to find closest object to sit on. +-- For example: LLAgent.requestSit{position=LLAgent.getRegionPosition()} +-- Your avatar should be close enough to the object you want to sit on function LLAgent.requestSit(...) local args = mapargs('obj_uuid,position', ...) args.op = 'requestSit' @@ -90,6 +95,11 @@ function LLAgent.requestStand() leap.send('LLAgent', {op = 'requestStand'}) end +-- *************************************************************************** +-- Autopilot +-- *************************************************************************** +LLAgent.autoPilotPump = "LLAutopilot" + -- Start the autopilot to move to "target_global" location using specified parameters -- LLAgent.startAutoPilot{ target_global array of target global {x, y, z} position -- [, allow_flying] allow flying during autopilot [default: true] @@ -97,6 +107,7 @@ end -- [, behavior_name] name of the autopilot behavior [default: (script name)] -- [, target_rotation] array of [x, y, z, w] quaternion values [default: no target] -- [, rotation_threshold] target maximum angle from target facing rotation [default: 0.03 radians] +-- an event with "success" flag is sent to "LLAutopilot" event pump, when auto pilot is terminated function LLAgent.startAutoPilot(...) local args = mapargs('target_global,allow_flying,stop_distance,behavior_name,target_rotation,rotation_threshold', ...) args.op = 'startAutoPilot' @@ -109,7 +120,7 @@ function LLAgent.setAutoPilotTarget(target_global) end -- Start the autopilot to move to the specified target location --- either "leader_id" (uuid of target) or "avatar_name" (avatar full name) should be specified +-- either "leader_id" (uuid of target) or "avatar_name" (avatar full name: use just first name for 'Resident') should be specified -- "allow_flying" [default: true], "stop_distance" [default: autopilot guess] function LLAgent.startFollowPilot(...) local args = mapargs('leader_id,avatar_name,allow_flying,stop_distance', ...) diff --git a/indra/newview/scripts/lua/require/LLChat.lua b/indra/newview/scripts/lua/require/LLChat.lua index bc0fc86d22..3ac3bab746 100644 --- a/indra/newview/scripts/lua/require/LLChat.lua +++ b/indra/newview/scripts/lua/require/LLChat.lua @@ -5,6 +5,7 @@ local LLChat = {} -- *************************************************************************** -- Nearby chat -- *************************************************************************** +LLChat.nearbyChatPump = "LLNearbyChat" -- 0 is public nearby channel, other channels are used to communicate with LSL scripts function LLChat.sendNearby(msg, channel) diff --git a/indra/newview/scripts/lua/require/LLChatListener.lua b/indra/newview/scripts/lua/require/LLChatListener.lua deleted file mode 100644 index 82b28966ce..0000000000 --- a/indra/newview/scripts/lua/require/LLChatListener.lua +++ /dev/null @@ -1,48 +0,0 @@ -local fiber = require 'fiber' -local inspect = require 'inspect' -local leap = require 'leap' -local util = require 'util' - -local LLChatListener = {} -local waitfor = {} -local listener_name = {} - -function LLChatListener:new() - local obj = setmetatable({}, self) - self.__index = self - obj.name = 'Chat_listener' - - return obj -end - -util.classctor(LLChatListener) - -function LLChatListener:handleMessages(event_data) - print(inspect(event_data)) - return true -end - -function LLChatListener:start() - waitfor = leap.WaitFor(-1, self.name) - function waitfor:filter(pump, data) - if pump == "LLNearbyChat" then - return data - end - end - - fiber.launch(self.name, function() - event = waitfor:wait() - while event and self:handleMessages(event) do - event = waitfor:wait() - end - end) - - listener_name = leap.request(leap.cmdpump(), {op='listen', source='LLNearbyChat', listener="ChatListener", tweak=true}).listener -end - -function LLChatListener:stop() - leap.send(leap.cmdpump(), {op='stoplistening', source='LLNearbyChat', listener=listener_name}) - waitfor:close() -end - -return LLChatListener diff --git a/indra/newview/scripts/lua/require/LLListener.lua b/indra/newview/scripts/lua/require/LLListener.lua new file mode 100644 index 0000000000..e3bfb6b358 --- /dev/null +++ b/indra/newview/scripts/lua/require/LLListener.lua @@ -0,0 +1,50 @@ +local fiber = require 'fiber' +local inspect = require 'inspect' +local leap = require 'leap' +local util = require 'util' + +local LLListener = {} +local waitfor = {} +local listener_name = {} +local pump = {} + +function LLListener:new() + local obj = setmetatable({}, self) + self.__index = self + obj.name = 'Listener' + + return obj +end + +util.classctor(LLListener) + +function LLListener:handleMessages(event_data) + print(inspect(event_data)) + return true +end + +function LLListener:start(pump_name) + pump = pump_name + waitfor = leap.WaitFor(-1, self.name) + function waitfor:filter(pump_, data) + if pump == pump_ then + return data + end + end + + fiber.launch(self.name, function() + event = waitfor:wait() + while event and self:handleMessages(event) do + event = waitfor:wait() + end + end) + + listener_name = leap.request(leap.cmdpump(), {op='listen', source=pump, listener="LLListener", tweak=true}).listener +end + +function LLListener:stop() + leap.send(leap.cmdpump(), {op='stoplistening', source=pump, listener=listener_name}) + waitfor:close() +end + +return LLListener diff --git a/indra/newview/scripts/lua/test_LLChatListener.lua b/indra/newview/scripts/lua/test_LLChatListener.lua index 4a4d40bee5..1df2880f3d 100644 --- a/indra/newview/scripts/lua/test_LLChatListener.lua +++ b/indra/newview/scripts/lua/test_LLChatListener.lua @@ -1,4 +1,4 @@ -local LLChatListener = require 'LLChatListener' +local LLListener = require 'LLListener' local LLChat = require 'LLChat' local UI = require 'UI' @@ -22,7 +22,7 @@ function openOrEcho(message) end end -local listener = LLChatListener() +local listener = LLListener() function listener:handleMessages(event_data) if string.find(event_data.message, '[LUA]') then @@ -36,4 +36,4 @@ function listener:handleMessages(event_data) return true end -listener:start() +listener:start(LLChat.nearbyChatPump) diff --git a/indra/newview/scripts/lua/test_autopilot.lua b/indra/newview/scripts/lua/test_autopilot.lua new file mode 100644 index 0000000000..0560477d38 --- /dev/null +++ b/indra/newview/scripts/lua/test_autopilot.lua @@ -0,0 +1,22 @@ +local LLAgent = require 'LLAgent' +local LLListener = require 'LLListener' + +local pos = LLAgent.getGlobalPosition() +pos[1]+=10 -- delta x +pos[2]+=5 -- delta y +LLAgent.requestStand() +LLAgent.startAutoPilot{target_global=pos,allow_flying=false,stop_distance=1} + +local listener = LLListener() + +function listener:handleMessages(event_data) + if event_data.success then + print('Destination is reached') + LLAgent.requestSit() + else + print('Failed to reach destination') + end + return false +end + +listener:start(LLAgent.autoPilotPump) -- cgit v1.2.3 From 80066449b9cbee018dd1c874c02579b1cbd3d348 Mon Sep 17 00:00:00 2001 From: Mnikolenko Productengine Date: Thu, 26 Sep 2024 17:20:47 +0300 Subject: update LLListener and related scripts --- indra/newview/llagentlistener.cpp | 8 ++++---- indra/newview/scripts/lua/require/LLListener.lua | 18 +++++++++--------- indra/newview/scripts/lua/test_LLChatListener.lua | 4 ++-- indra/newview/scripts/lua/test_autopilot.lua | 4 ++-- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/indra/newview/llagentlistener.cpp b/indra/newview/llagentlistener.cpp index 10f56c4eb3..14e443ec4e 100644 --- a/indra/newview/llagentlistener.cpp +++ b/indra/newview/llagentlistener.cpp @@ -87,7 +87,7 @@ LLAgentListener::LLAgentListener(LLAgent &agent) add("startAutoPilot", "Start the autopilot system using the following parameters:\n" "[\"target_global\"]: array of target global {x, y, z} position\n" - "[\"stop_distance\"]: target maximum distance from target [default: autopilot guess]\n" + "[\"stop_distance\"]: maximum stop distance from target [default: autopilot guess]\n" "[\"target_rotation\"]: array of [x, y, z, w] quaternion values [default: no target]\n" "[\"rotation_threshold\"]: target maximum angle from target facing rotation [default: 0.03 radians]\n" "[\"behavior_name\"]: name of the autopilot behavior [default: \"\"]\n" @@ -100,7 +100,7 @@ LLAgentListener::LLAgentListener(LLAgent &agent) "[\"enabled\"]: boolean indicating whether or not autopilot is enabled\n" "[\"target_global\"]: array of target global {x, y, z} position\n" "[\"leader_id\"]: uuid of target autopilot is following\n" - "[\"stop_distance\"]: target maximum distance from target\n" + "[\"stop_distance\"]: maximum stop distance from target\n" "[\"target_distance\"]: last known distance from target\n" "[\"use_rotation\"]: boolean indicating if autopilot has a target facing rotation\n" "[\"target_facing\"]: array of {x, y} target direction to face\n" @@ -112,7 +112,7 @@ LLAgentListener::LLAgentListener(LLAgent &agent) "[\"leader_id\"]: uuid of target to follow using the autopilot system (optional with avatar_name)\n" "[\"avatar_name\"]: avatar name to follow using the autopilot system (optional with leader_id)\n" "[\"allow_flying\"]: allow flying during autopilot [default: True]\n" - "[\"stop_distance\"]: target maximum distance from target [default: autopilot guess]", + "[\"stop_distance\"]: maximum stop distance from target [default: autopilot guess]", &LLAgentListener::startFollowPilot, llsd::map("reply", LLSD())); add("setAutoPilotTarget", @@ -496,7 +496,7 @@ void LLAgentListener::startFollowPilot(LLSD const & event_data) if (!gObjectList.findObject(target_id)) { - std::string target_info = event_data.has("leader_id") ? event_data["target_id"] : event_data["avatar_name"]; + std::string target_info = event_data.has("leader_id") ? event_data["leader_id"] : event_data["avatar_name"]; return response.error(stringize("Target ", std::quoted(target_info), " was not found")); } diff --git a/indra/newview/scripts/lua/require/LLListener.lua b/indra/newview/scripts/lua/require/LLListener.lua index e3bfb6b358..b05f966097 100644 --- a/indra/newview/scripts/lua/require/LLListener.lua +++ b/indra/newview/scripts/lua/require/LLListener.lua @@ -6,12 +6,12 @@ local util = require 'util' local LLListener = {} local waitfor = {} local listener_name = {} -local pump = {} -function LLListener:new() +function LLListener:new(pump_name) local obj = setmetatable({}, self) self.__index = self - obj.name = 'Listener' + obj.name = 'Listener:' .. pump_name + obj._pump = pump_name return obj end @@ -23,11 +23,11 @@ function LLListener:handleMessages(event_data) return true end -function LLListener:start(pump_name) - pump = pump_name +function LLListener:start() + _pump = self._pump waitfor = leap.WaitFor(-1, self.name) - function waitfor:filter(pump_, data) - if pump == pump_ then + function waitfor:filter(pump, data) + if _pump == pump then return data end end @@ -39,11 +39,11 @@ function LLListener:start(pump_name) end end) - listener_name = leap.request(leap.cmdpump(), {op='listen', source=pump, listener="LLListener", tweak=true}).listener + listener_name = leap.request(leap.cmdpump(), {op='listen', source=_pump, listener="LLListener", tweak=true}).listener end function LLListener:stop() - leap.send(leap.cmdpump(), {op='stoplistening', source=pump, listener=listener_name}) + leap.send(leap.cmdpump(), {op='stoplistening', source=self._pump, listener=listener_name}) waitfor:close() end diff --git a/indra/newview/scripts/lua/test_LLChatListener.lua b/indra/newview/scripts/lua/test_LLChatListener.lua index 1df2880f3d..0f269b54e6 100644 --- a/indra/newview/scripts/lua/test_LLChatListener.lua +++ b/indra/newview/scripts/lua/test_LLChatListener.lua @@ -22,7 +22,7 @@ function openOrEcho(message) end end -local listener = LLListener() +local listener = LLListener(LLChat.nearbyChatPump) function listener:handleMessages(event_data) if string.find(event_data.message, '[LUA]') then @@ -36,4 +36,4 @@ function listener:handleMessages(event_data) return true end -listener:start(LLChat.nearbyChatPump) +listener:start() diff --git a/indra/newview/scripts/lua/test_autopilot.lua b/indra/newview/scripts/lua/test_autopilot.lua index 0560477d38..09c85c140a 100644 --- a/indra/newview/scripts/lua/test_autopilot.lua +++ b/indra/newview/scripts/lua/test_autopilot.lua @@ -7,7 +7,7 @@ pos[2]+=5 -- delta y LLAgent.requestStand() LLAgent.startAutoPilot{target_global=pos,allow_flying=false,stop_distance=1} -local listener = LLListener() +local listener = LLListener(LLAgent.autoPilotPump) function listener:handleMessages(event_data) if event_data.success then @@ -19,4 +19,4 @@ function listener:handleMessages(event_data) return false end -listener:start(LLAgent.autoPilotPump) +listener:start() -- cgit v1.2.3 From 440c7b20dab3aa09c04bf3e72b4997181e585cbb Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Thu, 26 Sep 2024 18:09:32 +0300 Subject: #2411 Allow disabling and enabling LLFontVertexBuffer for testing purposes --- indra/llrender/llfontvertexbuffer.cpp | 7 +++++++ indra/llrender/llfontvertexbuffer.h | 4 ++++ indra/newview/app_settings/settings.xml | 11 +++++++++++ indra/newview/pipeline.cpp | 14 +++++++++++++- indra/newview/skins/default/xui/en/menu_viewer.xml | 10 ++++++++++ 5 files changed, 45 insertions(+), 1 deletion(-) diff --git a/indra/llrender/llfontvertexbuffer.cpp b/indra/llrender/llfontvertexbuffer.cpp index 392f235aad..f5d6b03cd6 100644 --- a/indra/llrender/llfontvertexbuffer.cpp +++ b/indra/llrender/llfontvertexbuffer.cpp @@ -31,6 +31,8 @@ #include "llvertexbuffer.h" +bool LLFontVertexBuffer::sEnableBufferCollection = true; + LLFontVertexBuffer::LLFontVertexBuffer() { } @@ -119,6 +121,11 @@ S32 LLFontVertexBuffer::render( { return static_cast(text.length()); } + if (!sEnableBufferCollection) + { + // For debug purposes and performance testing + return fontp->render(text, begin_offset, x, y, color, halign, valign, style, shadow, max_chars, max_pixels, right_x, use_ellipses, use_color); + } if (mBufferList.empty()) { genBuffers(fontp, text, begin_offset, x, y, color, halign, valign, diff --git a/indra/llrender/llfontvertexbuffer.h b/indra/llrender/llfontvertexbuffer.h index 67cf2ca13c..59cb536b74 100644 --- a/indra/llrender/llfontvertexbuffer.h +++ b/indra/llrender/llfontvertexbuffer.h @@ -78,6 +78,8 @@ public: F32* right_x = NULL, bool use_ellipses = false, bool use_color = true); + + static void enableBufferCollection(bool enable) { sEnableBufferCollection = enable; } private: void genBuffers(const LLFontGL* fontp, @@ -114,6 +116,8 @@ private: F32 mLastScaleX = 1.f; F32 mLastScaleY = 1.f; LLCoordGL mLastOrigin; + + static bool sEnableBufferCollection; }; #endif diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 82eb98b06b..7c9cfb94fa 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -9564,6 +9564,17 @@ Value 0 + CollectFontVertexBuffers + + Comment + When enabled some UI elements with cache buffers generated by fonts and reuse them. When disabled general cahce will be used with a significant overhead for hash, but it regenerates vertices each frame so it's always up to date. + Persist + 0 + Type + Boolean + Value + 1 + ShowMyComplexityChanges Comment diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index fe02742aac..39652ff6af 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -35,6 +35,7 @@ #include "llviewercontrol.h" #include "llfasttimer.h" #include "llfontgl.h" +#include "llfontvertexbuffer.h" #include "llnamevalue.h" #include "llpointer.h" #include "llprimitive.h" @@ -579,7 +580,16 @@ void LLPipeline::init() connectRefreshCachedSettingsSafe("RenderMirrors"); connectRefreshCachedSettingsSafe("RenderHeroProbeUpdateRate"); connectRefreshCachedSettingsSafe("RenderHeroProbeConservativeUpdateMultiplier"); - gSavedSettings.getControl("RenderAutoHideSurfaceAreaLimit")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings)); + connectRefreshCachedSettingsSafe("RenderAutoHideSurfaceAreaLimit"); + + LLPointer cntrl_ptr = gSavedSettings.getControl("CollectFontVertexBuffers"); + if (cntrl_ptr.notNull()) + { + cntrl_ptr->getCommitSignal()->connect([](LLControlVariable* control, const LLSD& value, const LLSD& previous) + { + LLFontVertexBuffer::enableBufferCollection(control->getValue().asBoolean()); + }); + } } LLPipeline::~LLPipeline() @@ -1096,6 +1106,8 @@ void LLPipeline::refreshCachedSettings() LLVOAvatar::sMaxNonImpostors = 1; LLVOAvatar::updateImpostorRendering(LLVOAvatar::sMaxNonImpostors); } + + LLFontVertexBuffer::enableBufferCollection(gSavedSettings.getBOOL("CollectFontVertexBuffers")); } void LLPipeline::releaseGLBuffers() diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml index 324e868bd5..77aa73a4c9 100644 --- a/indra/newview/skins/default/xui/en/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en/menu_viewer.xml @@ -3435,6 +3435,16 @@ function="World.EnvPreset" function="Advanced.HandleAttachedLightParticles" parameter="RenderAttachedParticles" /> + + + + Date: Thu, 26 Sep 2024 21:26:59 +0300 Subject: #2519 Move "MediaSoundsEarLocation" and "VoiceEarLocation" toggles to the Communicate menu (#2707) --- indra/newview/skins/default/xui/en/menu_viewer.xml | 37 +++++++++++----------- 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml index 43cdf30ba0..a0d3a5e960 100644 --- a/indra/newview/skins/default/xui/en/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en/menu_viewer.xml @@ -465,24 +465,6 @@ - - - - - - - - - + + + + + + + + + + Date: Thu, 26 Sep 2024 21:26:48 +0300 Subject: #2411 Disable LLFontVertexBuffer for HUD It needs a rework --- indra/newview/llhudnametag.cpp | 23 ++-------------------- indra/newview/llhudnametag.h | 3 --- indra/newview/llhudrender.cpp | 13 ++---------- indra/newview/llhudrender.h | 2 -- indra/newview/llhudtext.cpp | 16 +-------------- indra/newview/llhudtext.h | 2 -- indra/newview/llmanip.cpp | 10 +++++----- indra/newview/llmaniprotate.cpp | 4 ++-- indra/newview/llmanipscale.cpp | 4 ++-- indra/newview/llmaniptranslate.cpp | 4 ++-- indra/newview/skins/default/xui/en/menu_viewer.xml | 4 ++-- 11 files changed, 18 insertions(+), 67 deletions(-) diff --git a/indra/newview/llhudnametag.cpp b/indra/newview/llhudnametag.cpp index 19ae35813c..11f049564a 100644 --- a/indra/newview/llhudnametag.cpp +++ b/indra/newview/llhudnametag.cpp @@ -290,15 +290,6 @@ void LLHUDNameTag::renderText() LLVector3 render_position = mPositionAgent + (x_pixel_vec * screen_offset.mV[VX]) + (y_pixel_vec * screen_offset.mV[VY]); - bool reset_buffers = false; - const F32 treshold = 0.000001f; - if (abs(mLastRenderPosition.mV[VX] - render_position.mV[VX]) > treshold - || abs(mLastRenderPosition.mV[VY] - render_position.mV[VY]) > treshold - || abs(mLastRenderPosition.mV[VZ] - render_position.mV[VZ]) > treshold) - { - reset_buffers = true; - mLastRenderPosition = render_position; - } LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE); LLRect screen_rect; @@ -322,11 +313,6 @@ void LLHUDNameTag::renderText() for(std::vector::iterator segment_iter = mLabelSegments.begin(); segment_iter != mLabelSegments.end(); ++segment_iter ) { - if (reset_buffers) - { - segment_iter->mFontBufferLabel.reset(); - } - // Label segments use default font const LLFontGL* fontp = (segment_iter->mStyle == LLFontGL::BOLD) ? mBoldFontp : mFontp; y_offset -= fontp->getLineHeight(); @@ -342,7 +328,7 @@ void LLHUDNameTag::renderText() } LLColor4 label_color(0.f, 0.f, 0.f, alpha_factor); - hud_render_text(segment_iter->getText(), render_position, &segment_iter->mFontBufferLabel, *fontp, segment_iter->mStyle, LLFontGL::NO_SHADOW, x_offset, y_offset, label_color, false); + hud_render_text(segment_iter->getText(), render_position, *fontp, segment_iter->mStyle, LLFontGL::NO_SHADOW, x_offset, y_offset, label_color, false); } } @@ -364,11 +350,6 @@ void LLHUDNameTag::renderText() for (std::vector::iterator segment_iter = mTextSegments.begin() + start_segment; segment_iter != mTextSegments.end(); ++segment_iter ) { - if (reset_buffers) - { - segment_iter->mFontBufferText.reset(); - } - const LLFontGL* fontp = segment_iter->mFont; y_offset -= fontp->getLineHeight(); y_offset -= LINE_PADDING; @@ -392,7 +373,7 @@ void LLHUDNameTag::renderText() text_color = segment_iter->mColor; text_color.mV[VALPHA] *= alpha_factor; - hud_render_text(segment_iter->getText(), render_position, &segment_iter->mFontBufferText, *fontp, style, shadow, x_offset, y_offset, text_color, false); + hud_render_text(segment_iter->getText(), render_position, *fontp, style, shadow, x_offset, y_offset, text_color, false); } } /// Reset the default color to white. The renderer expects this to be the default. diff --git a/indra/newview/llhudnametag.h b/indra/newview/llhudnametag.h index b48a606982..ee66187345 100644 --- a/indra/newview/llhudnametag.h +++ b/indra/newview/llhudnametag.h @@ -68,8 +68,6 @@ protected: LLColor4 mColor; LLFontGL::StyleFlags mStyle; const LLFontGL* mFont; - LLFontVertexBuffer mFontBufferLabel; - LLFontVertexBuffer mFontBufferText; private: LLWString mText; std::map mFontWidthMap; @@ -177,7 +175,6 @@ private: S32 mMaxLines; S32 mOffsetY; F32 mRadius; - LLVector3 mLastRenderPosition; std::vector mTextSegments; std::vector mLabelSegments; // LLFrameTimer mResizeTimer; diff --git a/indra/newview/llhudrender.cpp b/indra/newview/llhudrender.cpp index 4180e49e94..135fba7897 100644 --- a/indra/newview/llhudrender.cpp +++ b/indra/newview/llhudrender.cpp @@ -42,7 +42,6 @@ #include void hud_render_utf8text(const std::string &str, const LLVector3 &pos_agent, - LLFontVertexBuffer *font_buffer, const LLFontGL &font, const U8 style, const LLFontGL::ShadowType shadow, @@ -51,11 +50,10 @@ void hud_render_utf8text(const std::string &str, const LLVector3 &pos_agent, const bool orthographic) { LLWString wstr(utf8str_to_wstring(str)); - hud_render_text(wstr, pos_agent, font_buffer, font, style, shadow, x_offset, y_offset, color, orthographic); + hud_render_text(wstr, pos_agent, font, style, shadow, x_offset, y_offset, color, orthographic); } void hud_render_text(const LLWString &wstr, const LLVector3 &pos_agent, - LLFontVertexBuffer *font_buffer, const LLFontGL &font, const U8 style, const LLFontGL::ShadowType shadow, @@ -127,14 +125,7 @@ void hud_render_text(const LLWString &wstr, const LLVector3 &pos_agent, LLUI::translate((F32) win_coord.x*1.0f/LLFontGL::sScaleX, (F32) win_coord.y*1.0f/(LLFontGL::sScaleY), -(((F32) win_coord.z*2.f)-1.f)); F32 right_x; - if (font_buffer) - { - font_buffer->render(&font, wstr, 0, 0, 1, color, LLFontGL::LEFT, LLFontGL::BASELINE, style, shadow, static_cast(wstr.length()), 1000, &right_x, /*use_ellipses*/false, /*use_color*/true); - } - else - { - font.render(wstr, 0, 0, 1, color, LLFontGL::LEFT, LLFontGL::BASELINE, style, shadow, static_cast(wstr.length()), 1000, &right_x, /*use_ellipses*/false, /*use_color*/true); - } + font.render(wstr, 0, 0, 1, color, LLFontGL::LEFT, LLFontGL::BASELINE, style, shadow, static_cast(wstr.length()), 1000, &right_x, /*use_ellipses*/false, /*use_color*/true); LLUI::popMatrix(); gGL.popMatrix(); diff --git a/indra/newview/llhudrender.h b/indra/newview/llhudrender.h index be9fc7f084..3c71acb271 100644 --- a/indra/newview/llhudrender.h +++ b/indra/newview/llhudrender.h @@ -36,7 +36,6 @@ class LLFontGL; // Utility classes for rendering HUD elements void hud_render_text(const LLWString &wstr, const LLVector3 &pos_agent, - LLFontVertexBuffer *font_buffer, const LLFontGL &font, const U8 style, const LLFontGL::ShadowType, @@ -48,7 +47,6 @@ void hud_render_text(const LLWString &wstr, // Legacy, slower void hud_render_utf8text(const std::string &str, const LLVector3 &pos_agent, - LLFontVertexBuffer *font_buffer, const LLFontGL &font, const U8 style, const LLFontGL::ShadowType, diff --git a/indra/newview/llhudtext.cpp b/indra/newview/llhudtext.cpp index 818474a0cb..fd0d8b696f 100644 --- a/indra/newview/llhudtext.cpp +++ b/indra/newview/llhudtext.cpp @@ -185,15 +185,6 @@ void LLHUDText::renderText() LLVector3 render_position = mPositionAgent + (x_pixel_vec * screen_offset.mV[VX]) + (y_pixel_vec * screen_offset.mV[VY]); - bool reset_buffers = false; - const F32 treshold = 0.000001f; - if (abs(mLastRenderPosition.mV[VX] - render_position.mV[VX]) > treshold - || abs(mLastRenderPosition.mV[VY] - render_position.mV[VY]) > treshold - || abs(mLastRenderPosition.mV[VZ] - render_position.mV[VZ]) > treshold) - { - reset_buffers = true; - mLastRenderPosition = render_position; - } F32 y_offset = (F32)mOffsetY; @@ -217,11 +208,6 @@ void LLHUDText::renderText() for (std::vector::iterator segment_iter = mTextSegments.begin() + start_segment; segment_iter != mTextSegments.end(); ++segment_iter ) { - if (reset_buffers) - { - segment_iter->mFontBufferText.reset(); - } - const LLFontGL* fontp = segment_iter->mFont; y_offset -= fontp->getLineHeight() - 1; // correction factor to match legacy font metrics @@ -245,7 +231,7 @@ void LLHUDText::renderText() } text_color.mV[VALPHA] *= alpha_factor; - hud_render_text(segment_iter->getText(), render_position, &segment_iter->mFontBufferText, *fontp, style, shadow, x_offset, y_offset, text_color, mOnHUDAttachment); + hud_render_text(segment_iter->getText(), render_position, *fontp, style, shadow, x_offset, y_offset, text_color, mOnHUDAttachment); } } /// Reset the default color to white. The renderer expects this to be the default. diff --git a/indra/newview/llhudtext.h b/indra/newview/llhudtext.h index 4c850e2d91..3bc33f1478 100644 --- a/indra/newview/llhudtext.h +++ b/indra/newview/llhudtext.h @@ -68,7 +68,6 @@ protected: LLFontGL::StyleFlags mStyle; const LLFontGL* mFont; LLFontVertexBuffer mFontBuffer; - LLFontVertexBuffer mFontBufferText; private: LLWString mText; std::map mFontWidthMap; @@ -154,7 +153,6 @@ private: const LLFontGL* mBoldFontp; LLRectf mSoftScreenRect; LLVector3 mPositionAgent; - LLVector3 mLastRenderPosition; LLVector2 mPositionOffset; LLVector2 mTargetPositionOffset; F32 mMass; diff --git a/indra/newview/llmanip.cpp b/indra/newview/llmanip.cpp index 9a0b1bfcd6..0d617753c8 100644 --- a/indra/newview/llmanip.cpp +++ b/indra/newview/llmanip.cpp @@ -519,9 +519,9 @@ void LLManip::renderTickText(const LLVector3& pos, const std::string& text, cons LLColor4 shadow_color = LLColor4::black; shadow_color.mV[VALPHA] = color.mV[VALPHA] * 0.5f; gViewerWindow->setup3DViewport(1, -1); - hud_render_utf8text(text, render_pos, nullptr, *big_fontp, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, -0.5f * big_fontp->getWidthF32(text), 3.f, shadow_color, mObjectSelection->getSelectType() == SELECT_TYPE_HUD); + hud_render_utf8text(text, render_pos, *big_fontp, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, -0.5f * big_fontp->getWidthF32(text), 3.f, shadow_color, mObjectSelection->getSelectType() == SELECT_TYPE_HUD); gViewerWindow->setup3DViewport(); - hud_render_utf8text(text, render_pos, nullptr, *big_fontp, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, -0.5f * big_fontp->getWidthF32(text), 3.f, color, mObjectSelection->getSelectType() == SELECT_TYPE_HUD); + hud_render_utf8text(text, render_pos, *big_fontp, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, -0.5f * big_fontp->getWidthF32(text), 3.f, color, mObjectSelection->getSelectType() == SELECT_TYPE_HUD); gGL.popMatrix(); } @@ -581,12 +581,12 @@ void LLManip::renderTickValue(const LLVector3& pos, F32 value, const std::string { fraction_string = llformat("%c%02d%s", LLResMgr::getInstance()->getDecimalPoint(), fractional_portion, suffix.c_str()); - hud_render_utf8text(val_string, render_pos, nullptr, *big_fontp, LLFontGL::NORMAL, LLFontGL::DROP_SHADOW, -1.f * big_fontp->getWidthF32(val_string), 3.f, color, hud_selection); - hud_render_utf8text(fraction_string, render_pos, nullptr, *small_fontp, LLFontGL::NORMAL, LLFontGL::DROP_SHADOW, 1.f, 3.f, color, hud_selection); + hud_render_utf8text(val_string, render_pos, *big_fontp, LLFontGL::NORMAL, LLFontGL::DROP_SHADOW, -1.f * big_fontp->getWidthF32(val_string), 3.f, color, hud_selection); + hud_render_utf8text(fraction_string, render_pos, *small_fontp, LLFontGL::NORMAL, LLFontGL::DROP_SHADOW, 1.f, 3.f, color, hud_selection); } else { - hud_render_utf8text(val_string, render_pos, nullptr, *big_fontp, LLFontGL::NORMAL, LLFontGL::DROP_SHADOW, -0.5f * big_fontp->getWidthF32(val_string), 3.f, color, hud_selection); + hud_render_utf8text(val_string, render_pos, *big_fontp, LLFontGL::NORMAL, LLFontGL::DROP_SHADOW, -0.5f * big_fontp->getWidthF32(val_string), 3.f, color, hud_selection); } } gGL.popMatrix(); diff --git a/indra/newview/llmaniprotate.cpp b/indra/newview/llmaniprotate.cpp index 0d80b8d8ba..5bdf3f81b5 100644 --- a/indra/newview/llmaniprotate.cpp +++ b/indra/newview/llmaniprotate.cpp @@ -1169,10 +1169,10 @@ void LLManipRotate::renderSnapGuides() std::string help_text = LLTrans::getString("manip_hint1"); LLColor4 help_text_color = LLColor4::white; help_text_color.mV[VALPHA] = clamp_rescale(mHelpTextTimer.getElapsedTimeF32(), sHelpTextVisibleTime, sHelpTextVisibleTime + sHelpTextFadeTime, line_alpha, 0.f); - hud_render_utf8text(help_text, help_text_pos, nullptr, *big_fontp, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, -0.5f * big_fontp->getWidthF32(help_text), 3.f, help_text_color, false); + hud_render_utf8text(help_text, help_text_pos, *big_fontp, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, -0.5f * big_fontp->getWidthF32(help_text), 3.f, help_text_color, false); help_text = LLTrans::getString("manip_hint2"); help_text_pos -= offset_dir * mRadiusMeters * 0.4f; - hud_render_utf8text(help_text, help_text_pos, nullptr, *big_fontp, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, -0.5f * big_fontp->getWidthF32(help_text), 3.f, help_text_color, false); + hud_render_utf8text(help_text, help_text_pos, *big_fontp, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, -0.5f * big_fontp->getWidthF32(help_text), 3.f, help_text_color, false); } } } diff --git a/indra/newview/llmanipscale.cpp b/indra/newview/llmanipscale.cpp index 9966a8eedb..66420d1cad 100644 --- a/indra/newview/llmanipscale.cpp +++ b/indra/newview/llmanipscale.cpp @@ -1844,10 +1844,10 @@ void LLManipScale::renderSnapGuides(const LLBBox& bbox) std::string help_text = LLTrans::getString("manip_hint1"); LLColor4 help_text_color = LLColor4::white; help_text_color.mV[VALPHA] = clamp_rescale(mHelpTextTimer.getElapsedTimeF32(), sHelpTextVisibleTime, sHelpTextVisibleTime + sHelpTextFadeTime, grid_alpha, 0.f); - hud_render_utf8text(help_text, help_text_pos, nullptr, *big_fontp, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, -0.5f * big_fontp->getWidthF32(help_text), 3.f, help_text_color, false); + hud_render_utf8text(help_text, help_text_pos, *big_fontp, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, -0.5f * big_fontp->getWidthF32(help_text), 3.f, help_text_color, false); help_text = LLTrans::getString("manip_hint2"); help_text_pos -= LLViewerCamera::getInstance()->getUpAxis() * mSnapRegimeOffset * 0.4f; - hud_render_utf8text(help_text, help_text_pos, nullptr, *big_fontp, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, -0.5f * big_fontp->getWidthF32(help_text), 3.f, help_text_color, false); + hud_render_utf8text(help_text, help_text_pos, *big_fontp, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, -0.5f * big_fontp->getWidthF32(help_text), 3.f, help_text_color, false); } } } diff --git a/indra/newview/llmaniptranslate.cpp b/indra/newview/llmaniptranslate.cpp index 060fe0d600..0888f630e8 100644 --- a/indra/newview/llmaniptranslate.cpp +++ b/indra/newview/llmaniptranslate.cpp @@ -1449,10 +1449,10 @@ void LLManipTranslate::renderSnapGuides() std::string help_text = LLTrans::getString("manip_hint1"); LLColor4 help_text_color = LLColor4::white; help_text_color.mV[VALPHA] = clamp_rescale(mHelpTextTimer.getElapsedTimeF32(), sHelpTextVisibleTime, sHelpTextVisibleTime + sHelpTextFadeTime, line_alpha, 0.f); - hud_render_utf8text(help_text, help_text_pos, nullptr, *big_fontp, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, -0.5f * big_fontp->getWidthF32(help_text), 3.f, help_text_color, false); + hud_render_utf8text(help_text, help_text_pos, *big_fontp, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, -0.5f * big_fontp->getWidthF32(help_text), 3.f, help_text_color, false); help_text = LLTrans::getString("manip_hint2"); help_text_pos -= LLViewerCamera::getInstance()->getUpAxis() * mSnapOffsetMeters * 0.2f; - hud_render_utf8text(help_text, help_text_pos, nullptr, *big_fontp, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, -0.5f * big_fontp->getWidthF32(help_text), 3.f, help_text_color, false); + hud_render_utf8text(help_text, help_text_pos, *big_fontp, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, -0.5f * big_fontp->getWidthF32(help_text), 3.f, help_text_color, false); } } } diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml index 77aa73a4c9..6f0c391cf3 100644 --- a/indra/newview/skins/default/xui/en/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en/menu_viewer.xml @@ -3436,8 +3436,8 @@ function="World.EnvPreset" parameter="RenderAttachedParticles" /> + label="Collect Font Vertex Buffers" + name="Collect Font Vertex Buffers"> -- cgit v1.2.3 From e74b48e67842c5c745f9ab0be2e33d7d077001e3 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Thu, 26 Sep 2024 22:03:45 +0300 Subject: viewer#2709 Fix loose triangle --- indra/llrender/llrender2dutils.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/indra/llrender/llrender2dutils.cpp b/indra/llrender/llrender2dutils.cpp index 20ad0275bd..c3d5da0914 100644 --- a/indra/llrender/llrender2dutils.cpp +++ b/indra/llrender/llrender2dutils.cpp @@ -1712,10 +1712,10 @@ void gl_segmented_rect_3d_tex(const LLRectf& clip_rect, const LLRectf& center_uv gGL.vertex3fv((center_draw_rect.mRight * width_vec + height_vec).mV); gGL.texCoord2f(center_uv_rect.mLeft, center_uv_rect.mTop); - gGL.vertex3fv((center_draw_rect.mLeft* width_vec + center_draw_rect.mTop * height_vec).mV); + gGL.vertex3fv((center_draw_rect.mLeft * width_vec + center_draw_rect.mTop * height_vec).mV); - gGL.texCoord2f(center_uv_rect.mRight, center_uv_rect.mTop); - gGL.vertex3fv((center_draw_rect.mRight* width_vec + center_draw_rect.mTop * height_vec).mV); + gGL.texCoord2f(center_uv_rect.mRight, clip_rect.mTop); + gGL.vertex3fv((center_draw_rect.mRight* width_vec + height_vec).mV); gGL.texCoord2f(center_uv_rect.mLeft, clip_rect.mTop); gGL.vertex3fv((center_draw_rect.mLeft * width_vec + height_vec).mV); -- cgit v1.2.3 From 34af8cc936eba7f058bf02819f736f1547c39525 Mon Sep 17 00:00:00 2001 From: Mnikolenko Productengine Date: Thu, 26 Sep 2024 22:39:02 +0300 Subject: get rid of extra LL in help text --- indra/llcommon/lua_function.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/indra/llcommon/lua_function.cpp b/indra/llcommon/lua_function.cpp index a9f88f3170..33666964f7 100644 --- a/indra/llcommon/lua_function.cpp +++ b/indra/llcommon/lua_function.cpp @@ -1150,7 +1150,7 @@ lua_function(check_stop, "check_stop(): ensure that a Lua script responds to vie * help() *****************************************************************************/ lua_function(help, - "LL.help(): list viewer's Lua functions\n" + "help(): list viewer's Lua functions\n" "LL.help(function): show help string for specific function") { auto& luapump{ LLEventPumps::instance().obtain("lua output") }; @@ -1210,7 +1210,7 @@ lua_function(help, *****************************************************************************/ lua_function( leaphelp, - "LL.leaphelp(): list viewer's LEAP APIs\n" + "leaphelp(): list viewer's LEAP APIs\n" "LL.leaphelp(api): show help for specific api string name") { LLSD request; -- cgit v1.2.3 From 6ebd6494a75d9b3d34e45655d79d0027fbba3898 Mon Sep 17 00:00:00 2001 From: Cosmic Linden Date: Thu, 26 Sep 2024 17:23:06 -0700 Subject: secondlife/viewer#2638: Don't clear big render target if all pixels will be replaced --- indra/llrender/llrendertarget.cpp | 9 ++++++++- indra/llrender/llrendertarget.h | 9 ++++++++- indra/newview/app_settings/settings.xml | 11 +++++++++++ indra/newview/pipeline.cpp | 25 ++++++++++--------------- 4 files changed, 37 insertions(+), 17 deletions(-) diff --git a/indra/llrender/llrendertarget.cpp b/indra/llrender/llrendertarget.cpp index 38bc5ff331..c72f8fa2ba 100644 --- a/indra/llrender/llrendertarget.cpp +++ b/indra/llrender/llrendertarget.cpp @@ -51,6 +51,7 @@ void check_framebuffer_status() } bool LLRenderTarget::sUseFBO = false; +bool LLRenderTarget::sClearOnInvalidate = false; U32 LLRenderTarget::sCurFBO = 0; @@ -473,6 +474,13 @@ void LLRenderTarget::clear(U32 mask_in) } } +void LLRenderTarget::invalidate(U32 mask_in) +{ + LL_PROFILE_ZONE_SCOPED_CATEGORY_DISPLAY; + if (!sClearOnInvalidate) { return; } + clear(mask_in); +} + U32 LLRenderTarget::getTexture(U32 attachment) const { if (attachment >= mTex.size()) @@ -584,7 +592,6 @@ void LLRenderTarget::swapFBORefs(LLRenderTarget& other) llassert(!other.isBoundInStack()); // Must be same type - llassert(sUseFBO == other.sUseFBO); llassert(mResX == other.mResX); llassert(mResY == other.mResY); llassert(mInternalFormat == other.mInternalFormat); diff --git a/indra/llrender/llrendertarget.h b/indra/llrender/llrendertarget.h index cd3290cf66..f066534cf4 100644 --- a/indra/llrender/llrendertarget.h +++ b/indra/llrender/llrendertarget.h @@ -63,6 +63,7 @@ class LLRenderTarget public: // Whether or not to use FBO implementation static bool sUseFBO; + static bool sClearOnInvalidate; static U32 sBytesAllocated; static U32 sCurFBO; static U32 sCurResX; @@ -128,11 +129,17 @@ public: // Asserts that this target is not currently bound in the stack void bindTarget(); - //clear render targer, clears depth buffer if present, + //clear render target, clears depth buffer if present, //uses scissor rect if in copy-to-texture mode // asserts that this target is currently bound void clear(U32 mask = 0xFFFFFFFF); + //same as clear, except may be a no-op depending on configuration + //useful to indicate the buffer is about to be overwritten and we + //don't care about its previous contents + //depending on the GPU, one may be more expensive than the other + void invalidate(U32 mask = 0xFFFFFFFF); + //get applied viewport void getViewport(S32* viewport); diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 82eb98b06b..2cbb493b91 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -7330,6 +7330,17 @@ Value -1 + RenderBufferClearOnInvalidate + + Comment + Whether to call glClear on render buffers that will be fully overwritten with new contents + Persist + 1 + Type + Boolean + Value + 0 + RenderCompressTextures Comment diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index fe02742aac..19868d2eef 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -576,6 +576,7 @@ void LLPipeline::init() connectRefreshCachedSettingsSafe("RenderScreenSpaceReflectionAdaptiveStepMultiplier"); connectRefreshCachedSettingsSafe("RenderScreenSpaceReflectionGlossySamples"); connectRefreshCachedSettingsSafe("RenderBufferVisualization"); + connectRefreshCachedSettingsSafe("RenderBufferClearOnInvalidate"); connectRefreshCachedSettingsSafe("RenderMirrors"); connectRefreshCachedSettingsSafe("RenderHeroProbeUpdateRate"); connectRefreshCachedSettingsSafe("RenderHeroProbeConservativeUpdateMultiplier"); @@ -1084,6 +1085,7 @@ void LLPipeline::refreshCachedSettings() RenderScreenSpaceReflectionAdaptiveStepMultiplier = gSavedSettings.getF32("RenderScreenSpaceReflectionAdaptiveStepMultiplier"); RenderScreenSpaceReflectionGlossySamples = gSavedSettings.getS32("RenderScreenSpaceReflectionGlossySamples"); RenderBufferVisualization = gSavedSettings.getS32("RenderBufferVisualization"); + LLRenderTarget::sClearOnInvalidate = gSavedSettings.getBOOL("RenderBufferClearOnInvalidate"); RenderMirrors = gSavedSettings.getBOOL("RenderMirrors"); RenderHeroProbeUpdateRate = gSavedSettings.getS32("RenderHeroProbeUpdateRate"); RenderHeroProbeConservativeUpdateMultiplier = gSavedSettings.getS32("RenderHeroProbeConservativeUpdateMultiplier"); @@ -7147,7 +7149,7 @@ void LLPipeline::copyScreenSpaceReflections(LLRenderTarget* src, LLRenderTarget* LLRenderTarget& depth_src = mRT->deferredScreen; dst->bindTarget(); - dst->clear(); + dst->invalidate(); gCopyDepthProgram.bind(); S32 diff_map = gCopyDepthProgram.getTextureChannel(LLShaderMgr::DIFFUSE_MAP); @@ -7334,7 +7336,7 @@ void LLPipeline::applyFXAA(LLRenderTarget* src, LLRenderTarget* dst) // bake out texture2D with RGBL for FXAA shader mFXAAMap.bindTarget(); - mFXAAMap.clear(GL_COLOR_BUFFER_BIT); + mFXAAMap.invalidate(GL_COLOR_BUFFER_BIT); shader = &gGlowCombineFXAAProgram; shader->bind(); @@ -7433,7 +7435,7 @@ void LLPipeline::generateSMAABuffers(LLRenderTarget* src) LLGLSLShader& edge_shader = gSMAAEdgeDetectProgram[fsaa_quality]; dest.bindTarget(); - dest.clear(GL_COLOR_BUFFER_BIT); + dest.invalidate(GL_COLOR_BUFFER_BIT); edge_shader.bind(); edge_shader.uniform4fv(sSmaaRTMetrics, 1, rt_metrics); @@ -7476,7 +7478,7 @@ void LLPipeline::generateSMAABuffers(LLRenderTarget* src) LLGLSLShader& blend_weights_shader = gSMAABlendWeightsProgram[fsaa_quality]; dest.bindTarget(); - dest.clear(GL_COLOR_BUFFER_BIT); + dest.invalidate(GL_COLOR_BUFFER_BIT); blend_weights_shader.bind(); blend_weights_shader.uniform4fv(sSmaaRTMetrics, 1, rt_metrics); @@ -7552,7 +7554,7 @@ void LLPipeline::applySMAA(LLRenderTarget* src, LLRenderTarget* dst) LLGLSLShader& blend_shader = gSMAANeighborhoodBlendProgram[fsaa_quality]; bound_target->bindTarget(); - bound_target->clear(GL_COLOR_BUFFER_BIT); + bound_target->invalidate(GL_COLOR_BUFFER_BIT); blend_shader.bind(); blend_shader.uniform4fv(sSmaaRTMetrics, 1, rt_metrics); @@ -8330,9 +8332,7 @@ void LLPipeline::renderDeferredLighting() LLGLSLShader& sun_shader = gCubeSnapshot ? gDeferredSunProbeProgram : gDeferredSunProgram; bindDeferredShader(sun_shader, deferred_light_target); mScreenTriangleVB->setBuffer(); - glClearColor(1, 1, 1, 1); - deferred_light_target->clear(GL_COLOR_BUFFER_BIT); - glClearColor(0, 0, 0, 0); + deferred_light_target->invalidate(GL_COLOR_BUFFER_BIT); sun_shader.uniform2f(LLShaderMgr::DEFERRED_SCREEN_RES, (GLfloat)deferred_light_target->getWidth(), @@ -8356,9 +8356,7 @@ void LLPipeline::renderDeferredLighting() LL_PROFILE_GPU_ZONE("soften shadow"); // blur lightmap screen_target->bindTarget(); - glClearColor(1, 1, 1, 1); - screen_target->clear(GL_COLOR_BUFFER_BIT); - glClearColor(0, 0, 0, 0); + screen_target->invalidate(GL_COLOR_BUFFER_BIT); bindDeferredShader(gDeferredBlurLightProgram); @@ -8410,11 +8408,8 @@ void LLPipeline::renderDeferredLighting() deferred_light_target->flush(); unbindDeferredShader(gDeferredBlurLightProgram); } - screen_target->bindTarget(); - // clear color buffer here - zeroing alpha (glow) is important or it will accumulate against sky - glClearColor(0, 0, 0, 0); - screen_target->clear(GL_COLOR_BUFFER_BIT); + screen_target->invalidate(GL_COLOR_BUFFER_BIT); if (RenderDeferredAtmospheric) { // apply sunlight contribution -- cgit v1.2.3 From e36452483744b41c4af7f5ac2240083b1cba0738 Mon Sep 17 00:00:00 2001 From: Alexander Gavriliuk Date: Thu, 26 Sep 2024 14:14:27 +0200 Subject: #2674 Optimize LLWorld::renderPropertyLines() - use vertexBatchPreTransformed() --- indra/llmath/v3math.h | 15 +++-- indra/llrender/llfontgl.cpp | 6 +- indra/llrender/llfontgl.h | 2 +- indra/llrender/llrender.cpp | 90 ++++++++++++++++++++-------- indra/llrender/llrender.h | 18 ++++-- indra/llrender/llrender2dutils.cpp | 2 +- indra/newview/llviewerparceloverlay.cpp | 102 ++++++++++++++++++-------------- indra/newview/llviewerparceloverlay.h | 5 +- 8 files changed, 156 insertions(+), 84 deletions(-) diff --git a/indra/llmath/v3math.h b/indra/llmath/v3math.h index d063b15c74..4fc7585a46 100644 --- a/indra/llmath/v3math.h +++ b/indra/llmath/v3math.h @@ -459,10 +459,17 @@ inline const LLVector3& operator*=(LLVector3 &a, const LLVector3 &b) inline const LLVector3& operator/=(LLVector3 &a, F32 k) { - F32 t = 1.f / k; - a.mV[0] *= t; - a.mV[1] *= t; - a.mV[2] *= t; + a.mV[0] /= k; + a.mV[1] /= k; + a.mV[2] /= k; + return a; +} + +inline const LLVector3& operator/=(LLVector3& a, const LLVector3& b) +{ + a.mV[0] /= b.mV[0]; + a.mV[1] /= b.mV[1]; + a.mV[2] /= b.mV[2]; return a; } diff --git a/indra/llrender/llfontgl.cpp b/indra/llrender/llfontgl.cpp index 94daba0817..a012d57b5a 100644 --- a/indra/llrender/llfontgl.cpp +++ b/indra/llrender/llfontgl.cpp @@ -270,7 +270,7 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons const LLFontGlyphInfo* next_glyph = NULL; - static constexpr S32 GLYPH_BATCH_SIZE = 30; + static constexpr U32 GLYPH_BATCH_SIZE = 30; static thread_local LLVector4a vertices[GLYPH_BATCH_SIZE * 6]; static thread_local LLVector2 uvs[GLYPH_BATCH_SIZE * 6]; static thread_local LLColor4U colors[GLYPH_BATCH_SIZE * 6]; @@ -281,7 +281,7 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons LLColor4U emoji_color(255, 255, 255, text_color.mV[VALPHA]); std::pair bitmap_entry = std::make_pair(EFontGlyphType::Grayscale, -1); - S32 glyph_count = 0; + U32 glyph_count = 0; for (i = begin_offset; i < begin_offset + length; i++) { llwchar wch = wstr[i]; @@ -1262,7 +1262,7 @@ void LLFontGL::renderTriangle(LLVector4a* vertex_out, LLVector2* uv_out, LLColor colors_out[index] = color; } -void LLFontGL::drawGlyph(S32& glyph_count, LLVector4a* vertex_out, LLVector2* uv_out, LLColor4U* colors_out, const LLRectf& screen_rect, const LLRectf& uv_rect, const LLColor4U& color, U8 style, ShadowType shadow, F32 drop_shadow_strength) const +void LLFontGL::drawGlyph(U32& glyph_count, LLVector4a* vertex_out, LLVector2* uv_out, LLColor4U* colors_out, const LLRectf& screen_rect, const LLRectf& uv_rect, const LLColor4U& color, U8 style, ShadowType shadow, F32 drop_shadow_strength) const { F32 slant_offset; slant_offset = ((style & ITALIC) ? ( -mFontFreetype->getAscenderHeight() * 0.2f) : 0.f); diff --git a/indra/llrender/llfontgl.h b/indra/llrender/llfontgl.h index 4bb6c55c65..a257d94512 100644 --- a/indra/llrender/llfontgl.h +++ b/indra/llrender/llfontgl.h @@ -239,7 +239,7 @@ private: LLPointer mFontFreetype; void renderTriangle(LLVector4a* vertex_out, LLVector2* uv_out, LLColor4U* colors_out, const LLRectf& screen_rect, const LLRectf& uv_rect, const LLColor4U& color, F32 slant_amt) const; - void drawGlyph(S32& glyph_count, LLVector4a* vertex_out, LLVector2* uv_out, LLColor4U* colors_out, const LLRectf& screen_rect, const LLRectf& uv_rect, const LLColor4U& color, U8 style, ShadowType shadow, F32 drop_shadow_fade) const; + void drawGlyph(U32& glyph_count, LLVector4a* vertex_out, LLVector2* uv_out, LLColor4U* colors_out, const LLRectf& screen_rect, const LLRectf& uv_rect, const LLColor4U& color, U8 style, ShadowType shadow, F32 drop_shadow_fade) const; // Registry holds all instantiated fonts. static LLFontRegistry* sFontRegistry; diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp index e182b870dc..19bbed35a4 100644 --- a/indra/llrender/llrender.cpp +++ b/indra/llrender/llrender.cpp @@ -1279,9 +1279,7 @@ void LLRender::translateUI(F32 x, F32 y, F32 z) LL_ERRS() << "Need to push a UI translation frame before offsetting" << LL_ENDL; } - mUIOffset.back().mV[0] += x; - mUIOffset.back().mV[1] += y; - mUIOffset.back().mV[2] += z; + mUIOffset.back().add(LLVector4a(x, y, z)); } void LLRender::scaleUI(F32 x, F32 y, F32 z) @@ -1291,14 +1289,14 @@ void LLRender::scaleUI(F32 x, F32 y, F32 z) LL_ERRS() << "Need to push a UI transformation frame before scaling." << LL_ENDL; } - mUIScale.back().scaleVec(LLVector3(x,y,z)); + mUIScale.back().mul(LLVector4a(x, y, z)); } void LLRender::pushUIMatrix() { if (mUIOffset.empty()) { - mUIOffset.emplace_back(0.f,0.f,0.f); + mUIOffset.emplace_back(0.f); } else { @@ -1307,7 +1305,7 @@ void LLRender::pushUIMatrix() if (mUIScale.empty()) { - mUIScale.emplace_back(1.f,1.f,1.f); + mUIScale.emplace_back(1.f); } else { @@ -1329,18 +1327,20 @@ LLVector3 LLRender::getUITranslation() { if (mUIOffset.empty()) { - return LLVector3(0,0,0); + return LLVector3::zero; } - return mUIOffset.back(); + + return LLVector3(mUIOffset.back().getF32ptr()); } LLVector3 LLRender::getUIScale() { if (mUIScale.empty()) { - return LLVector3(1,1,1); + return LLVector3::all_one; } - return mUIScale.back(); + + return LLVector3(mUIScale.back().getF32ptr()); } @@ -1350,8 +1350,9 @@ void LLRender::loadUIIdentity() { LL_ERRS() << "Need to push UI translation frame before clearing offset." << LL_ENDL; } - mUIOffset.back().setVec(0,0,0); - mUIScale.back().setVec(1,1,1); + + mUIOffset.back().clear(); + mUIScale.back().splat(1); } void LLRender::setColorMask(bool writeColor, bool writeAlpha) @@ -1772,23 +1773,64 @@ void LLRender::vertex3f(const GLfloat& x, const GLfloat& y, const GLfloat& z) return; } - if (mUIOffset.empty()) + LLVector4a vert(x, y, z); + transform(vert); + mVerticesp[mCount] = vert; + + mCount++; + mVerticesp[mCount] = vert; + mColorsp[mCount] = mColorsp[mCount-1]; + mTexcoordsp[mCount] = mTexcoordsp[mCount-1]; +} + +void LLRender::transform(LLVector3& vert) +{ + if (!mUIOffset.empty()) { - mVerticesp[mCount].set(x,y,z); + vert += LLVector3(mUIOffset.back().getF32ptr()); + vert *= LLVector3(mUIScale.back().getF32ptr()); } - else +} + +void LLRender::transform(LLVector4a& vert) +{ + if (!mUIOffset.empty()) { - LLVector3 vert = (LLVector3(x,y,z)+mUIOffset.back()).scaledVec(mUIScale.back()); - mVerticesp[mCount].set(vert.mV[VX], vert.mV[VY], vert.mV[VZ]); + vert.add(mUIOffset.back()); + vert.mul(mUIScale.back()); } +} - mCount++; - mVerticesp[mCount] = mVerticesp[mCount-1]; - mColorsp[mCount] = mColorsp[mCount-1]; - mTexcoordsp[mCount] = mTexcoordsp[mCount-1]; +void LLRender::untransform(LLVector3& vert) +{ + if (!mUIOffset.empty()) + { + vert /= LLVector3(mUIScale.back().getF32ptr()); + vert -= LLVector3(mUIOffset.back().getF32ptr()); + } +} + +void LLRender::batchTransform(LLVector4a* verts, U32 vert_count) +{ + if (!mUIOffset.empty()) + { + const LLVector4a& offset = mUIOffset.back(); + const LLVector4a& scale = mUIScale.back(); + + for (U32 i = 0; i < vert_count; ++i) + { + verts[i].add(offset); + verts[i].mul(scale); + } + } +} + +void LLRender::vertexBatchPreTransformed(const std::vector& verts) +{ + vertexBatchPreTransformed(verts.data(), verts.size()); } -void LLRender::vertexBatchPreTransformed(LLVector4a* verts, S32 vert_count) +void LLRender::vertexBatchPreTransformed(const LLVector4a* verts, std::size_t vert_count) { if (mCount + vert_count > 4094) { @@ -1809,7 +1851,7 @@ void LLRender::vertexBatchPreTransformed(LLVector4a* verts, S32 vert_count) mVerticesp[mCount] = mVerticesp[mCount-1]; } -void LLRender::vertexBatchPreTransformed(LLVector4a* verts, LLVector2* uvs, S32 vert_count) +void LLRender::vertexBatchPreTransformed(const LLVector4a* verts, const LLVector2* uvs, std::size_t vert_count) { if (mCount + vert_count > 4094) { @@ -1833,7 +1875,7 @@ void LLRender::vertexBatchPreTransformed(LLVector4a* verts, LLVector2* uvs, S32 } } -void LLRender::vertexBatchPreTransformed(LLVector4a* verts, LLVector2* uvs, LLColor4U* colors, S32 vert_count) +void LLRender::vertexBatchPreTransformed(const LLVector4a* verts, const LLVector2* uvs, const LLColor4U* colors, std::size_t vert_count) { if (mCount + vert_count > 4094) { diff --git a/indra/llrender/llrender.h b/indra/llrender/llrender.h index fc7c5ccc18..8c7126420e 100644 --- a/indra/llrender/llrender.h +++ b/indra/llrender/llrender.h @@ -46,6 +46,7 @@ #include #include +#include class LLVertexBuffer; class LLCubeMap; @@ -449,9 +450,16 @@ public: void diffuseColor4ubv(const U8* c); void diffuseColor4ub(U8 r, U8 g, U8 b, U8 a); - void vertexBatchPreTransformed(LLVector4a* verts, S32 vert_count); - void vertexBatchPreTransformed(LLVector4a* verts, LLVector2* uvs, S32 vert_count); - void vertexBatchPreTransformed(LLVector4a* verts, LLVector2* uvs, LLColor4U*, S32 vert_count); + void transform(LLVector3& vert); + void transform(LLVector4a& vert); + void untransform(LLVector3& vert); + + void batchTransform(LLVector4a* verts, U32 vert_count); + + void vertexBatchPreTransformed(const std::vector& verts); + void vertexBatchPreTransformed(const LLVector4a* verts, std::size_t vert_count); + void vertexBatchPreTransformed(const LLVector4a* verts, const LLVector2* uvs, std::size_t vert_count); + void vertexBatchPreTransformed(const LLVector4a* verts, const LLVector2* uvs, const LLColor4U*, std::size_t vert_count); void setColorMask(bool writeColor, bool writeAlpha); void setColorMask(bool writeColorR, bool writeColorG, bool writeColorB, bool writeAlpha); @@ -525,8 +533,8 @@ private: eBlendFactor mCurrBlendAlphaSFactor; eBlendFactor mCurrBlendAlphaDFactor; - std::vector mUIOffset; - std::vector mUIScale; + std::vector mUIOffset; + std::vector mUIScale; }; extern F32 gGLModelView[16]; diff --git a/indra/llrender/llrender2dutils.cpp b/indra/llrender/llrender2dutils.cpp index 20ad0275bd..0cd0c5fe6e 100644 --- a/indra/llrender/llrender2dutils.cpp +++ b/indra/llrender/llrender2dutils.cpp @@ -450,7 +450,7 @@ void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 width, S32 height, LLTex gGL.color4fv(color.mV); - constexpr S32 NUM_VERTICES = 9 * 2 * 3; // 9 quads, 2 triangles per quad, 3 vertices per triangle + constexpr U32 NUM_VERTICES = 9 * 2 * 3; // 9 quads, 2 triangles per quad, 3 vertices per triangle static thread_local LLVector2 uv[NUM_VERTICES]; static thread_local LLVector4a pos[NUM_VERTICES]; diff --git a/indra/newview/llviewerparceloverlay.cpp b/indra/newview/llviewerparceloverlay.cpp index 2077cbdd08..019e870829 100755 --- a/indra/newview/llviewerparceloverlay.cpp +++ b/indra/newview/llviewerparceloverlay.cpp @@ -555,51 +555,52 @@ void LLViewerParcelOverlay::addPropertyLine(F32 start_x, F32 start_y, F32 dx, F3 inside_z = land.resolveHeightRegion(inside_x, inside_y); }; - auto split = [&](U32 lod, const LLVector3& start, F32 x, F32 y, F32 z, F32 part) + auto split = [&](U32 lod, const LLVector4a& start, F32 x, F32 y, F32 z, F32 part) { - F32 new_x = start.mV[VX] + (x - start.mV[VX]) * part; - F32 new_y = start.mV[VY] + (y - start.mV[VY]) * part; - F32 new_z = start.mV[VZ] + (z - start.mV[VZ]) * part; - edge.vertices[lod].emplace_back(new_x, new_y, new_z); + F32 new_x = start[VX] + (x - start[VX]) * part; + F32 new_y = start[VY] + (y - start[VY]) * part; + F32 new_z = start[VZ] + (z - start[VZ]) * part; + edge.pushVertex(lod, new_x, new_y, new_z, water_z); }; auto checkForSplit = [&](U32 lod) { - const std::vector& vertices = edge.vertices[lod]; - const LLVector3& last_outside = vertices.back(); - F32 z0 = last_outside.mV[VZ]; + const std::vector& vertices = edge.verticesUnderWater[lod]; + const LLVector4a& last_outside = vertices.back(); + F32 z0 = last_outside[VZ]; F32 z1 = outside_z; if ((z0 >= water_z && z1 >= water_z) || (z0 < water_z && z1 < water_z)) return; F32 part = (water_z - z0) / (z1 - z0); - const LLVector3& last_inside = vertices[vertices.size() - 2]; + const LLVector4a& last_inside = vertices[vertices.size() - 2]; split(lod, last_inside, inside_x, inside_y, inside_z, part); split(lod, last_outside, outside_x, outside_y, outside_z, part); }; auto pushTwoVertices = [&](U32 lod) { + LLVector3 out(outside_x, outside_y, outside_z); + LLVector3 in(inside_x, inside_y, inside_z); if (fabs(inside_z - outside_z) < LINE_WIDTH / 5) { - edge.vertices[lod].emplace_back(inside_x, inside_y, inside_z); + edge.pushVertex(lod, inside_x, inside_y, inside_z, water_z); } else { // Make the line thinner if heights differ too much - LLVector3 out(outside_x, outside_y, outside_z); - LLVector3 in(inside_x, inside_y, inside_z); LLVector3 dist(in - out); F32 coef = dist.length() / LINE_WIDTH; - edge.vertices[lod].emplace_back(out + dist / coef); + LLVector3 new_in(out + dist / coef); + edge.pushVertex(lod, new_in[VX], new_in[VY], new_in[VZ], water_z); } - edge.vertices[lod].emplace_back(outside_x, outside_y, outside_z); + edge.pushVertex(lod, outside_x, outside_y, outside_z, water_z); }; // Point A simplified (first two vertices) pushTwoVertices(1); // Point A detailized (only one vertex) - edge.vertices[0].emplace_back(outside_x, outside_y, outside_z); + edge.pushVertex(0, outside_x, outside_y, outside_z, water_z); // Point B (two vertices) move(LINE_WIDTH); @@ -627,7 +628,23 @@ void LLViewerParcelOverlay::addPropertyLine(F32 start_x, F32 start_y, F32 dx, F3 pushTwoVertices(1); // Point G detailized (only one vertex) - edge.vertices[0].emplace_back(outside_x, outside_y, outside_z); + edge.pushVertex(0, outside_x, outside_y, outside_z, water_z); +} + +void LLViewerParcelOverlay::Edge::pushVertex(U32 lod, F32 x, F32 y, F32 z, F32 water_z) +{ + verticesUnderWater[lod].emplace_back(x, y, z); + gGL.transform(verticesUnderWater[lod].back()); + + if (z >= water_z) + { + verticesAboveWater[lod].push_back(verticesUnderWater[lod].back()); + } + else + { + verticesAboveWater[lod].emplace_back(x, y, water_z); + gGL.transform(verticesAboveWater[lod].back()); + } } void LLViewerParcelOverlay::setDirty() @@ -707,6 +724,8 @@ void LLViewerParcelOverlay::renderPropertyLines() // Stomp the camera into two dimensions LLVector3 camera_region = mRegion->getPosRegionFromGlobal( gAgentCamera.getCameraPositionGlobal() ); + bool draw_underwater = camera_region.mV[VZ] < water_z || + !gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_WATER); // Set up a cull plane 2 * PARCEL_GRID_STEP_METERS behind // the camera. The cull plane normal is the camera's at axis. @@ -714,17 +733,22 @@ void LLViewerParcelOverlay::renderPropertyLines() cull_plane_point *= -2.f * PARCEL_GRID_STEP_METERS; cull_plane_point += camera_region; - bool render_hidden = LLSelectMgr::sRenderHiddenSelections && LLFloaterReg::instanceVisible("build"); + bool render_hidden = !draw_underwater && + LLSelectMgr::sRenderHiddenSelections && + LLFloaterReg::instanceVisible("build"); constexpr F32 PROPERTY_LINE_CLIP_DIST_SQUARED = 256.f * 256.f; constexpr F32 PROPERTY_LINE_LOD0_DIST_SQUARED = PROPERTY_LINE_CLIP_DIST_SQUARED / 25.f; for (const Edge& edge : mEdges) { - const std::vector& vertices0 = edge.vertices[0]; - LLVector3 center = (vertices0.front() + vertices0.back()) / 2; - F32 dist_squared = dist_vec_squared(center, camera_region); + const std::vector& vertices0 = edge.verticesAboveWater[0]; + const F32* first = vertices0.front().getF32ptr(); + const F32* last = vertices0.back().getF32ptr(); + LLVector3 center((first[VX] + last[VX]) / 2, (first[VY] + last[VY]) / 2, (first[VZ] + last[VZ]) / 2); + gGL.untransform(center); + F32 dist_squared = dist_vec_squared(center, camera_region); if (dist_squared > PROPERTY_LINE_CLIP_DIST_SQUARED) { continue; @@ -745,39 +769,27 @@ void LLViewerParcelOverlay::renderPropertyLines() gGL.color4ubv(edge.color.mV); - for (const LLVector3& vertex : edge.vertices[lod]) + if (draw_underwater) { - if (render_hidden || camera_z < water_z || vertex.mV[2] >= water_z) - { - gGL.vertex3fv(vertex.mV); - } - else - { - LLVector3 visible = vertex; - visible.mV[VZ] = water_z; - gGL.vertex3fv(visible.mV); - } + gGL.vertexBatchPreTransformed(edge.verticesUnderWater[lod]); } - - gGL.end(); - - if (render_hidden) + else { - LLGLDepthTest depth(GL_TRUE, GL_FALSE, GL_GREATER); + gGL.vertexBatchPreTransformed(edge.verticesAboveWater[lod]); - gGL.begin(LLRender::TRIANGLE_STRIP); + if (render_hidden) + { + LLGLDepthTest depth(GL_TRUE, GL_FALSE, GL_GREATER); - LLColor4U color = edge.color; - color.mV[VALPHA] /= 4; - gGL.color4ubv(color.mV); + LLColor4U color = edge.color; + color.mV[VALPHA] /= 4; + gGL.color4ubv(color.mV); - for (const LLVector3& vertex : edge.vertices[lod]) - { - gGL.vertex3fv(vertex.mV); + gGL.vertexBatchPreTransformed(edge.verticesUnderWater[lod]); } - - gGL.end(); } + + gGL.end(); } gGL.popMatrix(); diff --git a/indra/newview/llviewerparceloverlay.h b/indra/newview/llviewerparceloverlay.h index 68900d16a6..7271c85701 100644 --- a/indra/newview/llviewerparceloverlay.h +++ b/indra/newview/llviewerparceloverlay.h @@ -116,7 +116,10 @@ private: struct Edge { - std::vector vertices[2]; // 0 - detailized, 1 - simplified + void pushVertex(U32 lod, F32 x, F32 y, F32 z, F32 water_z); + // LOD: 0 - detailized, 1 - simplified + std::vector verticesAboveWater[2]; + std::vector verticesUnderWater[2]; LLColor4U color; }; -- cgit v1.2.3 From 167d740d0267db3dfdec1510d8ea82c2fe6a7efe Mon Sep 17 00:00:00 2001 From: Alexander Gavriliuk Date: Thu, 26 Sep 2024 16:47:11 +0200 Subject: #2674 Optimize LLWorld::renderPropertyLines() - LLRender class code formatting --- indra/llrender/llrender.cpp | 283 +++++++++++++++++++++++--------------------- 1 file changed, 148 insertions(+), 135 deletions(-) diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp index 19bbed35a4..565071ff0d 100644 --- a/indra/llrender/llrender.cpp +++ b/indra/llrender/llrender.cpp @@ -151,7 +151,8 @@ void LLTexUnit::refreshState(void) void LLTexUnit::activate(void) { - if (mIndex < 0) return; + if (mIndex < 0) + return; if ((S32)gGL.mCurrTextureUnitIndex != mIndex || gGL.mDirty) { @@ -163,7 +164,8 @@ void LLTexUnit::activate(void) void LLTexUnit::enable(eTextureType type) { - if (mIndex < 0) return; + if (mIndex < 0) + return; if ( (mCurrTexType != type || gGL.mDirty) && (type != TT_NONE) ) { @@ -180,7 +182,8 @@ void LLTexUnit::enable(eTextureType type) void LLTexUnit::disable(void) { - if (mIndex < 0) return; + if (mIndex < 0) + return; if (mCurrTexType != TT_NONE) { @@ -216,7 +219,7 @@ bool LLTexUnit::bind(LLTexture* texture, bool for_rendering, bool forceBind) { gGL.flush(); - LLImageGL* gl_tex = NULL ; + LLImageGL* gl_tex = NULL; if (texture != NULL && (gl_tex = texture->getGLTexture())) { @@ -231,8 +234,8 @@ bool LLTexUnit::bind(LLTexture* texture, bool for_rendering, bool forceBind) glBindTexture(sGLTextureType[gl_tex->getTarget()], mCurrTexture); if(gl_tex->updateBindStats()) { - texture->setActive() ; - texture->updateBindStatsForTester() ; + texture->setActive(); + texture->updateBindStatsForTester(); } mHasMipMaps = gl_tex->mHasMipMaps; if (gl_tex->mTexOptionsDirty) @@ -246,9 +249,9 @@ bool LLTexUnit::bind(LLTexture* texture, bool for_rendering, bool forceBind) else { //if deleted, will re-generate it immediately - texture->forceImmediateUpdate() ; + texture->forceImmediateUpdate(); - gl_tex->forceUpdateBindStats() ; + gl_tex->forceUpdateBindStats(); return texture->bindDefaultImage(mIndex); } } @@ -276,24 +279,27 @@ bool LLTexUnit::bind(LLTexture* texture, bool for_rendering, bool forceBind) bool LLTexUnit::bind(LLImageGL* texture, bool for_rendering, bool forceBind, S32 usename) { stop_glerror(); - if (mIndex < 0) return false; + if (mIndex < 0) + { + return false; + } U32 texname = usename ? usename : texture->getTexName(); - if(!texture) + if (!texture) { LL_DEBUGS() << "NULL LLTexUnit::bind texture" << LL_ENDL; return false; } - if(!texname) + if (!texname) { if(LLImageGL::sDefaultGLTexture && LLImageGL::sDefaultGLTexture->getTexName()) { - return bind(LLImageGL::sDefaultGLTexture) ; + return bind(LLImageGL::sDefaultGLTexture); } stop_glerror(); - return false ; + return false; } if ((mCurrTexture != texname) || forceBind) @@ -326,7 +332,10 @@ bool LLTexUnit::bind(LLImageGL* texture, bool for_rendering, bool forceBind, S32 bool LLTexUnit::bind(LLCubeMap* cubeMap) { - if (mIndex < 0) return false; + if (mIndex < 0) + { + return false; + } gGL.flush(); @@ -366,7 +375,10 @@ bool LLTexUnit::bind(LLCubeMap* cubeMap) // LLRenderTarget is unavailible on the mapserver since it uses FBOs. bool LLTexUnit::bind(LLRenderTarget* renderTarget, bool bindDepth) { - if (mIndex < 0) return false; + if (mIndex < 0) + { + return false; + } gGL.flush(); @@ -391,7 +403,7 @@ bool LLTexUnit::bindManual(eTextureType type, U32 texture, bool hasMips) return false; } - if(mCurrTexture != texture) + if (mCurrTexture != texture) { gGL.flush(); @@ -401,6 +413,7 @@ bool LLTexUnit::bindManual(eTextureType type, U32 texture, bool hasMips) glBindTexture(sGLTextureType[type], texture); mHasMipMaps = hasMips; } + return true; } @@ -408,7 +421,8 @@ void LLTexUnit::unbind(eTextureType type) { stop_glerror(); - if (mIndex < 0) return; + if (mIndex < 0) + return; //always flush and activate for consistency // some code paths assume unbind always flushes and sets the active texture @@ -454,7 +468,8 @@ void LLTexUnit::unbindFast(eTextureType type) void LLTexUnit::setTextureAddressMode(eTextureAddressMode mode) { - if (mIndex < 0 || mCurrTexture == 0) return; + if (mIndex < 0 || mCurrTexture == 0) + return; gGL.flush(); @@ -470,7 +485,8 @@ void LLTexUnit::setTextureAddressMode(eTextureAddressMode mode) void LLTexUnit::setTextureFilteringOption(LLTexUnit::eTextureFilterOptions option) { - if (mIndex < 0 || mCurrTexture == 0 || mCurrTexType == LLTexUnit::TT_MULTISAMPLE_TEXTURE) return; + if (mIndex < 0 || mCurrTexture == 0 || mCurrTexType == LLTexUnit::TT_MULTISAMPLE_TEXTURE) + return; gGL.flush(); @@ -525,7 +541,7 @@ void LLTexUnit::setTextureFilteringOption(LLTexUnit::eTextureFilterOptions optio GLint LLTexUnit::getTextureSource(eTextureBlendSrc src) { - switch(src) + switch (src) { // All four cases should return the same value. case TBS_PREV_COLOR: @@ -563,14 +579,14 @@ GLint LLTexUnit::getTextureSource(eTextureBlendSrc src) GLint LLTexUnit::getTextureSourceType(eTextureBlendSrc src, bool isAlpha) { - switch(src) + switch (src) { // All four cases should return the same value. case TBS_PREV_COLOR: case TBS_TEX_COLOR: case TBS_VERT_COLOR: case TBS_CONST_COLOR: - return (isAlpha) ? GL_SRC_ALPHA: GL_SRC_COLOR; + return isAlpha ? GL_SRC_ALPHA : GL_SRC_COLOR; // All four cases should return the same value. case TBS_PREV_ALPHA: @@ -584,7 +600,7 @@ GLint LLTexUnit::getTextureSourceType(eTextureBlendSrc src, bool isAlpha) case TBS_ONE_MINUS_TEX_COLOR: case TBS_ONE_MINUS_VERT_COLOR: case TBS_ONE_MINUS_CONST_COLOR: - return (isAlpha) ? GL_ONE_MINUS_SRC_ALPHA : GL_ONE_MINUS_SRC_COLOR; + return isAlpha ? GL_ONE_MINUS_SRC_ALPHA : GL_ONE_MINUS_SRC_COLOR; // All four cases should return the same value. case TBS_ONE_MINUS_PREV_ALPHA: @@ -595,7 +611,7 @@ GLint LLTexUnit::getTextureSourceType(eTextureBlendSrc src, bool isAlpha) default: LL_WARNS() << "Unknown eTextureBlendSrc: " << src << ". Using Source Color or Alpha instead." << LL_ENDL; - return (isAlpha) ? GL_SRC_ALPHA: GL_SRC_COLOR; + return isAlpha ? GL_SRC_ALPHA : GL_SRC_COLOR; } } @@ -605,7 +621,7 @@ void LLTexUnit::setColorScale(S32 scale) { mCurrColorScale = scale; gGL.flush(); - glTexEnvi( GL_TEXTURE_ENV, GL_RGB_SCALE, scale ); + glTexEnvi(GL_TEXTURE_ENV, GL_RGB_SCALE, scale); } } @@ -615,7 +631,7 @@ void LLTexUnit::setAlphaScale(S32 scale) { mCurrAlphaScale = scale; gGL.flush(); - glTexEnvi( GL_TEXTURE_ENV, GL_ALPHA_SCALE, scale ); + glTexEnvi(GL_TEXTURE_ENV, GL_ALPHA_SCALE, scale); } } @@ -623,7 +639,8 @@ void LLTexUnit::setAlphaScale(S32 scale) // texture unit based on the currently set active texture in opengl. void LLTexUnit::debugTextureUnit(void) { - if (mIndex < 0) return; + if (mIndex < 0) + return; GLint activeTexture; glGetIntegerv(GL_ACTIVE_TEXTURE, &activeTexture); @@ -645,16 +662,16 @@ LLLightState::LLLightState(S32 index) { if (mIndex == 0) { - mDiffuse.set(1,1,1,1); - mDiffuseB.set(0,0,0,0); - mSpecular.set(1,1,1,1); + mDiffuse.set(1, 1, 1, 1); + mDiffuseB.set(0, 0, 0, 0); + mSpecular.set(1, 1, 1, 1); } mSunIsPrimary = true; - mAmbient.set(0,0,0,1); - mPosition.set(0,0,1,0); - mSpotDirection.set(0,0,-1); + mAmbient.set(0, 0, 0, 1); + mPosition.set(0, 0, 1, 0); + mSpotDirection.set(0, 0, -1); } void LLLightState::enable() @@ -886,6 +903,7 @@ bool LLRender::init(bool needs_vertex_buffer) { initVertexBuffer(); } + return true; } @@ -1119,7 +1137,6 @@ void LLRender::syncMatrices() } } - if (shader->mFeatures.hasLighting || shader->mFeatures.calculatesLighting || shader->mFeatures.calculatesAtmospherics) { //also sync light state syncLightState(); @@ -1132,91 +1149,78 @@ void LLRender::translatef(const GLfloat& x, const GLfloat& y, const GLfloat& z) { flush(); - { - mMatrix[mMatrixMode][mMatIdx[mMatrixMode]] = glm::translate(mMatrix[mMatrixMode][mMatIdx[mMatrixMode]], glm::vec3(x, y, z)); - mMatHash[mMatrixMode]++; - } + mMatrix[mMatrixMode][mMatIdx[mMatrixMode]] = glm::translate(mMatrix[mMatrixMode][mMatIdx[mMatrixMode]], glm::vec3(x, y, z)); + mMatHash[mMatrixMode]++; } void LLRender::scalef(const GLfloat& x, const GLfloat& y, const GLfloat& z) { flush(); - { - mMatrix[mMatrixMode][mMatIdx[mMatrixMode]] = glm::scale(mMatrix[mMatrixMode][mMatIdx[mMatrixMode]], glm::vec3(x, y, z)); - mMatHash[mMatrixMode]++; - } + mMatrix[mMatrixMode][mMatIdx[mMatrixMode]] = glm::scale(mMatrix[mMatrixMode][mMatIdx[mMatrixMode]], glm::vec3(x, y, z)); + mMatHash[mMatrixMode]++; } void LLRender::ortho(F32 left, F32 right, F32 bottom, F32 top, F32 zNear, F32 zFar) { flush(); - { - mMatrix[mMatrixMode][mMatIdx[mMatrixMode]] *= glm::ortho(left, right, bottom, top, zNear, zFar); - mMatHash[mMatrixMode]++; - } + mMatrix[mMatrixMode][mMatIdx[mMatrixMode]] *= glm::ortho(left, right, bottom, top, zNear, zFar); + mMatHash[mMatrixMode]++; } void LLRender::rotatef(const GLfloat& a, const GLfloat& x, const GLfloat& y, const GLfloat& z) { flush(); - { - mMatrix[mMatrixMode][mMatIdx[mMatrixMode]] = glm::rotate(mMatrix[mMatrixMode][mMatIdx[mMatrixMode]], glm::radians(a), glm::vec3(x,y,z)); - mMatHash[mMatrixMode]++; - } + mMatrix[mMatrixMode][mMatIdx[mMatrixMode]] = glm::rotate(mMatrix[mMatrixMode][mMatIdx[mMatrixMode]], glm::radians(a), glm::vec3(x,y,z)); + mMatHash[mMatrixMode]++; } void LLRender::pushMatrix() { flush(); + if (mMatIdx[mMatrixMode] < LL_MATRIX_STACK_DEPTH-1) { - if (mMatIdx[mMatrixMode] < LL_MATRIX_STACK_DEPTH-1) - { - mMatrix[mMatrixMode][mMatIdx[mMatrixMode]+1] = mMatrix[mMatrixMode][mMatIdx[mMatrixMode]]; - ++mMatIdx[mMatrixMode]; - } - else - { - LL_WARNS() << "Matrix stack overflow." << LL_ENDL; - } + mMatrix[mMatrixMode][mMatIdx[mMatrixMode]+1] = mMatrix[mMatrixMode][mMatIdx[mMatrixMode]]; + ++mMatIdx[mMatrixMode]; + } + else + { + LL_WARNS() << "Matrix stack overflow." << LL_ENDL; } } void LLRender::popMatrix() { flush(); + + if (mMatIdx[mMatrixMode] > 0) { - if (mMatIdx[mMatrixMode] > 0) - { - --mMatIdx[mMatrixMode]; - mMatHash[mMatrixMode]++; - } - else - { - LL_WARNS() << "Matrix stack underflow." << LL_ENDL; - } + --mMatIdx[mMatrixMode]; + mMatHash[mMatrixMode]++; + } + else + { + LL_WARNS() << "Matrix stack underflow." << LL_ENDL; } } void LLRender::loadMatrix(const GLfloat* m) { flush(); - { - mMatrix[mMatrixMode][mMatIdx[mMatrixMode]] = glm::make_mat4((GLfloat*) m); - mMatHash[mMatrixMode]++; - } + + mMatrix[mMatrixMode][mMatIdx[mMatrixMode]] = glm::make_mat4((GLfloat*) m); + mMatHash[mMatrixMode]++; } void LLRender::multMatrix(const GLfloat* m) { flush(); - { - mMatrix[mMatrixMode][mMatIdx[mMatrixMode]] *= glm::make_mat4(m); - mMatHash[mMatrixMode]++; - } + + mMatrix[mMatrixMode][mMatIdx[mMatrixMode]] *= glm::make_mat4(m); + mMatHash[mMatrixMode]++; } void LLRender::matrixMode(eMatrixMode mode) @@ -1254,12 +1258,10 @@ void LLRender::loadIdentity() { flush(); - { - llassert_always(mMatrixMode < NUM_MATRIX_MODES) ; + llassert_always(mMatrixMode < NUM_MATRIX_MODES); - mMatrix[mMatrixMode][mMatIdx[mMatrixMode]] = glm::identity(); - mMatHash[mMatrixMode]++; - } + mMatrix[mMatrixMode][mMatIdx[mMatrixMode]] = glm::identity(); + mMatHash[mMatrixMode]++; } const glm::mat4& LLRender::getModelviewMatrix() @@ -1446,7 +1448,7 @@ void LLRender::blendFunc(eBlendFactor color_sfactor, eBlendFactor color_dfactor, flush(); glBlendFuncSeparate(sGLBlendFactor[color_sfactor], sGLBlendFactor[color_dfactor], - sGLBlendFactor[alpha_sfactor], sGLBlendFactor[alpha_dfactor]); + sGLBlendFactor[alpha_sfactor], sGLBlendFactor[alpha_dfactor]); } } @@ -1456,11 +1458,9 @@ LLTexUnit* LLRender::getTexUnit(U32 index) { return &mTexUnits[index]; } - else - { - LL_DEBUGS() << "Non-existing texture unit layer requested: " << index << LL_ENDL; - return &mDummyTexUnit; - } + + LL_DEBUGS() << "Non-existing texture unit layer requested: " << index << LL_ENDL; + return &mDummyTexUnit; } LLLightState* LLRender::getLight(U32 index) @@ -1489,11 +1489,9 @@ bool LLRender::verifyTexUnitActive(U32 unitToVerify) { return true; } - else - { - LL_WARNS() << "TexUnit currently active: " << mCurrTextureUnitIndex << " (expecting " << unitToVerify << ")" << LL_ENDL; - return false; - } + + LL_WARNS() << "TexUnit currently active: " << mCurrTextureUnitIndex << " (expecting " << unitToVerify << ")" << LL_ENDL; + return false; } void LLRender::clearErrors() @@ -1510,6 +1508,7 @@ void LLRender::beginList(std::list *list) { LL_ERRS() << "beginList called while another list is open." << LL_ENDL; } + llassert(LLGLSLShader::sCurBoundShaderPtr == &gUIProgram); flush(); sBufferDataList = list; @@ -1582,7 +1581,7 @@ void LLRender::flush() if (mMode == LLRender::TRIANGLES) { - if (mCount%3 != 0) + if (mCount % 3 != 0) { count -= (mCount % 3); LL_WARNS() << "Incomplete triangle requested." << LL_ENDL; @@ -1591,7 +1590,7 @@ void LLRender::flush() if (mMode == LLRender::LINES) { - if (mCount%2 != 0) + if (mCount % 2 != 0) { count -= (mCount % 2); LL_WARNS() << "Incomplete line requested." << LL_ENDL; @@ -1602,7 +1601,6 @@ void LLRender::flush() if (mBuffer) { - LLVertexBuffer *vb; U32 attribute_mask = LLGLSLShader::sCurBoundShaderPtr->mAttributeMask; @@ -1709,6 +1707,7 @@ LLVertexBuffer* LLRender::bufferfromCache(U32 attribute_mask, U32 count) } } } + return vb; } @@ -1756,14 +1755,26 @@ void LLRender::resetStriders(S32 count) void LLRender::vertex3f(const GLfloat& x, const GLfloat& y, const GLfloat& z) { - //the range of mVerticesp, mColorsp and mTexcoordsp is [0, 4095] + // the range of mVerticesp, mColorsp and mTexcoordsp is [0, 4095] if (mCount > 2048) - { //break when buffer gets reasonably full to keep GL command buffers happy and avoid overflow below + { // break when buffer gets reasonably full to keep GL command buffers happy and avoid overflow below switch (mMode) { - case LLRender::POINTS: flush(); break; - case LLRender::TRIANGLES: if (mCount%3==0) flush(); break; - case LLRender::LINES: if (mCount%2 == 0) flush(); break; + case LLRender::POINTS: + flush(); + break; + case LLRender::TRIANGLES: + if (mCount % 3 == 0) + { + flush(); + } + break; + case LLRender::LINES: + if (mCount % 2 == 0) + { + flush(); + } + break; } } @@ -1843,12 +1854,14 @@ void LLRender::vertexBatchPreTransformed(const LLVector4a* verts, std::size_t ve mVerticesp[mCount] = verts[i]; mCount++; - mTexcoordsp[mCount] = mTexcoordsp[mCount-1]; - mColorsp[mCount] = mColorsp[mCount-1]; + mTexcoordsp[mCount] = mTexcoordsp[mCount - 1]; + mColorsp[mCount] = mColorsp[mCount - 1]; } - if( mCount > 0 ) // ND: Guard against crashes if mCount is zero, yes it can happen - mVerticesp[mCount] = mVerticesp[mCount-1]; + if (mCount > 0) // ND: Guard against crashes if mCount is zero, yes it can happen + { + mVerticesp[mCount] = mVerticesp[mCount - 1]; + } } void LLRender::vertexBatchPreTransformed(const LLVector4a* verts, const LLVector2* uvs, std::size_t vert_count) @@ -1902,22 +1915,22 @@ void LLRender::vertexBatchPreTransformed(const LLVector4a* verts, const LLVector void LLRender::vertex2i(const GLint& x, const GLint& y) { - vertex3f((GLfloat) x, (GLfloat) y, 0); + vertex3f((GLfloat)x, (GLfloat)y, 0); } void LLRender::vertex2f(const GLfloat& x, const GLfloat& y) { - vertex3f(x,y,0); + vertex3f(x, y, 0); } void LLRender::vertex2fv(const GLfloat* v) { - vertex3f(v[0], v[1], 0); + vertex3f(v[VX], v[VY], 0); } void LLRender::vertex3fv(const GLfloat* v) { - vertex3f(v[0], v[1], v[2]); + vertex3f(v[VX], v[VY], v[VZ]); } void LLRender::texCoord2f(const GLfloat& x, const GLfloat& y) @@ -1932,46 +1945,47 @@ void LLRender::texCoord2i(const GLint& x, const GLint& y) void LLRender::texCoord2fv(const GLfloat* tc) { - texCoord2f(tc[0], tc[1]); + texCoord2f(tc[VX], tc[VY]); } void LLRender::color4ub(const GLubyte& r, const GLubyte& g, const GLubyte& b, const GLubyte& a) { - if (!LLGLSLShader::sCurBoundShaderPtr || LLGLSLShader::sCurBoundShaderPtr->mAttributeMask & LLVertexBuffer::MAP_COLOR) + if (!LLGLSLShader::sCurBoundShaderPtr || + LLGLSLShader::sCurBoundShaderPtr->mAttributeMask & LLVertexBuffer::MAP_COLOR) { - mColorsp[mCount].set(r,g,b,a); + mColorsp[mCount].set(r, g, b, a); } else { //not using shaders or shader reads color from a uniform - diffuseColor4ub(r,g,b,a); + diffuseColor4ub(r, g, b, a); } } void LLRender::color4ubv(const GLubyte* c) { - color4ub(c[0], c[1], c[2], c[3]); + color4ub(c[VX], c[VY], c[VZ], c[VW]); } void LLRender::color4f(const GLfloat& r, const GLfloat& g, const GLfloat& b, const GLfloat& a) { - color4ub((GLubyte) (llclamp(r, 0.f, 1.f)*255), - (GLubyte) (llclamp(g, 0.f, 1.f)*255), - (GLubyte) (llclamp(b, 0.f, 1.f)*255), - (GLubyte) (llclamp(a, 0.f, 1.f)*255)); + color4ub((GLubyte) (llclamp(r, 0.f, 1.f) * 255), + (GLubyte) (llclamp(g, 0.f, 1.f) * 255), + (GLubyte) (llclamp(b, 0.f, 1.f) * 255), + (GLubyte) (llclamp(a, 0.f, 1.f) * 255)); } void LLRender::color4fv(const GLfloat* c) { - color4f(c[0],c[1],c[2],c[3]); + color4f(c[VX], c[VY], c[VZ], c[VW]); } void LLRender::color3f(const GLfloat& r, const GLfloat& g, const GLfloat& b) { - color4f(r,g,b,1); + color4f(r, g, b, 1); } void LLRender::color3fv(const GLfloat* c) { - color4f(c[0],c[1],c[2],1); + color4f(c[VX], c[VY], c[VZ], 1); } void LLRender::diffuseColor3f(F32 r, F32 g, F32 b) @@ -1981,7 +1995,7 @@ void LLRender::diffuseColor3f(F32 r, F32 g, F32 b) if (shader) { - shader->uniform4f(LLShaderMgr::DIFFUSE_COLOR, r,g,b,1.f); + shader->uniform4f(LLShaderMgr::DIFFUSE_COLOR, r, g, b, 1.f); } } @@ -1992,7 +2006,7 @@ void LLRender::diffuseColor3fv(const F32* c) if (shader) { - shader->uniform4f(LLShaderMgr::DIFFUSE_COLOR, c[0], c[1], c[2], 1.f); + shader->uniform4f(LLShaderMgr::DIFFUSE_COLOR, c[VX], c[VY], c[VZ], 1.f); } } @@ -2003,7 +2017,7 @@ void LLRender::diffuseColor4f(F32 r, F32 g, F32 b, F32 a) if (shader) { - shader->uniform4f(LLShaderMgr::DIFFUSE_COLOR, r,g,b,a); + shader->uniform4f(LLShaderMgr::DIFFUSE_COLOR, r, g, b, a); } } @@ -2025,7 +2039,7 @@ void LLRender::diffuseColor4ubv(const U8* c) if (shader) { - shader->uniform4f(LLShaderMgr::DIFFUSE_COLOR, c[0]/255.f, c[1]/255.f, c[2]/255.f, c[3]/255.f); + shader->uniform4f(LLShaderMgr::DIFFUSE_COLOR, c[0] / 255.f, c[1] / 255.f, c[2] / 255.f, c[3] / 255.f); } } @@ -2036,11 +2050,10 @@ void LLRender::diffuseColor4ub(U8 r, U8 g, U8 b, U8 a) if (shader) { - shader->uniform4f(LLShaderMgr::DIFFUSE_COLOR, r/255.f, g/255.f, b/255.f, a/255.f); + shader->uniform4f(LLShaderMgr::DIFFUSE_COLOR, r / 255.f, g / 255.f, b / 255.f, a / 255.f); } } - void LLRender::debugTexUnits(void) { LL_INFOS("TextureUnit") << "Active TexUnit: " << mCurrTextureUnitIndex << LL_ENDL; @@ -2051,7 +2064,7 @@ void LLRender::debugTexUnits(void) { if (i == mCurrTextureUnitIndex) active_enabled = "true"; LL_INFOS("TextureUnit") << "TexUnit: " << i << " Enabled" << LL_ENDL; - LL_INFOS("TextureUnit") << "Enabled As: " ; + LL_INFOS("TextureUnit") << "Enabled As: "; switch (getTexUnit(i)->mCurrTexType) { case LLTexUnit::TT_TEXTURE: @@ -2136,10 +2149,10 @@ glm::vec3 mul_mat4_vec3(const glm::mat4& mat, const glm::vec3& vec) y.splat(vec.y); z.splat(vec.z); - s.splat<3>(mat[0].data); - t.splat<3>(mat[1].data); - p.splat<3>(mat[2].data); - q.splat<3>(mat[3].data); + s.splat<3>(mat[VX].data); + t.splat<3>(mat[VY].data); + p.splat<3>(mat[VZ].data); + q.splat<3>(mat[VW].data); s.mul(x); t.mul(y); @@ -2148,12 +2161,12 @@ glm::vec3 mul_mat4_vec3(const glm::mat4& mat, const glm::vec3& vec) t.add(p); q.add(t); - x.mul(mat[0].data); - y.mul(mat[1].data); - z.mul(mat[2].data); + x.mul(mat[VX].data); + y.mul(mat[VY].data); + z.mul(mat[VZ].data); x.add(y); - z.add(mat[3].data); + z.add(mat[VW].data); LLVector4a res; res.load3(glm::value_ptr(vec)); res.setAdd(x, z); -- cgit v1.2.3 From 294f6a73ea4fa1b1763250b5f74eb19deb7703e4 Mon Sep 17 00:00:00 2001 From: Maxim Nikolenko Date: Fri, 27 Sep 2024 14:38:46 +0300 Subject: #2711 Remove ALM text from About SL --- indra/newview/skins/default/xui/de/strings.xml | 1 - indra/newview/skins/default/xui/es/strings.xml | 1 - indra/newview/skins/default/xui/fr/strings.xml | 1 - indra/newview/skins/default/xui/it/strings.xml | 1 - indra/newview/skins/default/xui/pl/strings.xml | 1 - indra/newview/skins/default/xui/pt/strings.xml | 1 - indra/newview/skins/default/xui/ru/strings.xml | 1 - indra/newview/skins/default/xui/tr/strings.xml | 1 - 8 files changed, 8 deletions(-) diff --git a/indra/newview/skins/default/xui/de/strings.xml b/indra/newview/skins/default/xui/de/strings.xml index a9e7626dc5..486d604e9f 100644 --- a/indra/newview/skins/default/xui/de/strings.xml +++ b/indra/newview/skins/default/xui/de/strings.xml @@ -31,7 +31,6 @@ Sichtweite: [DRAW_DISTANCE] m Bandbreite: [NET_BANDWITH] kbit/s LOD-Faktor: [LOD_FACTOR] Darstellungsqualität: [RENDER_QUALITY] -Erweitertes Beleuchtungsmodell: [GPU_SHADERS] Texturspeicher: [TEXTURE_MEMORY] MB HiDPI-Anzeigemodus: [HIDPI] J2C-Decoderversion: [J2C_VERSION] diff --git a/indra/newview/skins/default/xui/es/strings.xml b/indra/newview/skins/default/xui/es/strings.xml index cd8e7687ae..9fcfc2daa5 100644 --- a/indra/newview/skins/default/xui/es/strings.xml +++ b/indra/newview/skins/default/xui/es/strings.xml @@ -29,7 +29,6 @@ Distancia de dibujo: [DRAW_DISTANCE]m Ancho de banda: [NET_BANDWITH]kbit/s Factor LOD: [LOD_FACTOR] Calidad de renderización: [RENDER_QUALITY] -Modelo de iluminación avanzado: [GPU_SHADERS] Memoria de textura: [TEXTURE_MEMORY]MB Modo de visualización HiDPi: [HIDPI] Versión de descodificador J2C: [J2C_VERSION] diff --git a/indra/newview/skins/default/xui/fr/strings.xml b/indra/newview/skins/default/xui/fr/strings.xml index 0a3fbeb603..55f6209fe1 100644 --- a/indra/newview/skins/default/xui/fr/strings.xml +++ b/indra/newview/skins/default/xui/fr/strings.xml @@ -32,7 +32,6 @@ Distance de dessin : [DRAW_DISTANCE]m Bande passante : [NET_BANDWITH] kbit/s Facteur LOD (niveau de détail) : [LOD_FACTOR] Qualité de rendu : [RENDER_QUALITY] -Modèle d’éclairage avancé : [GPU_SHADERS] Mémoire textures : [TEXTURE_MEMORY] Mo Mode d'affichage HiDPI : [HIDPI] J2C Decoder Version: [J2C_VERSION] diff --git a/indra/newview/skins/default/xui/it/strings.xml b/indra/newview/skins/default/xui/it/strings.xml index 178bb90ca6..f77ab1062a 100644 --- a/indra/newview/skins/default/xui/it/strings.xml +++ b/indra/newview/skins/default/xui/it/strings.xml @@ -31,7 +31,6 @@ Distanza visualizzazione: [DRAW_DISTANCE]m Larghezza banda: [NET_BANDWITH]kbit/s Fattore livello di dettaglio: [LOD_FACTOR] Qualità di rendering: [RENDER_QUALITY] -Modello illuminazione avanzato: [GPU_SHADERS] Memoria texture: [TEXTURE_MEMORY]MB Modalità display HiDPI: [HIDPI] J2C Versione decoder: [J2C_VERSION] diff --git a/indra/newview/skins/default/xui/pl/strings.xml b/indra/newview/skins/default/xui/pl/strings.xml index 26ec6cc9dc..8032443020 100644 --- a/indra/newview/skins/default/xui/pl/strings.xml +++ b/indra/newview/skins/default/xui/pl/strings.xml @@ -49,7 +49,6 @@ Pole widzenia (Draw Distance): [DRAW_DISTANCE]m Przepustowość (Bandwidth): [NET_BANDWITH]kbit/s Mnożnik poziomu detali (LOD Factor): [LOD_FACTOR] Jakość wyświetlania (Render quality): [RENDER_QUALITY] -Zaawansowane oświetlenie (Advanced Lighting Model): [GPU_SHADERS] Pamięć tekstur (Texture memory): [TEXTURE_MEMORY]MB Pamięć podręczna dysku (Disk cache): [DISK_CACHE_INFO] diff --git a/indra/newview/skins/default/xui/pt/strings.xml b/indra/newview/skins/default/xui/pt/strings.xml index 6db5da2e89..4ce1e6d2ec 100644 --- a/indra/newview/skins/default/xui/pt/strings.xml +++ b/indra/newview/skins/default/xui/pt/strings.xml @@ -29,7 +29,6 @@ Estabelecer a distância: [DRAW_DISTANCE]m Largura da banda: [NET_BANDWITH]kbit/s LOD fator: [LOD_FACTOR] Qualidade de renderização: [RENDER_QUALITY] -Modelo avançado de luzes: [GPU_SHADERS] Memória de textura: [TEXTURE_MEMORY]MB HiDPI modo de exibição: [HIDPI] Versão do J2C Decoder: [J2C_VERSION] diff --git a/indra/newview/skins/default/xui/ru/strings.xml b/indra/newview/skins/default/xui/ru/strings.xml index 61d836a2d1..0079309ba2 100644 --- a/indra/newview/skins/default/xui/ru/strings.xml +++ b/indra/newview/skins/default/xui/ru/strings.xml @@ -69,7 +69,6 @@ SLURL: <nolink>[SLURL]</nolink> Ширина канала: [NET_BANDWITH] кбит/с Коэффициент детализации: [LOD_FACTOR] Качество визуализации: [RENDER_QUALITY] -Расширенная модель освещения: [GPU_SHADERS] Память текстур: [TEXTURE_MEMORY] МБ diff --git a/indra/newview/skins/default/xui/tr/strings.xml b/indra/newview/skins/default/xui/tr/strings.xml index e709a4c5d6..fa2fd3a802 100644 --- a/indra/newview/skins/default/xui/tr/strings.xml +++ b/indra/newview/skins/default/xui/tr/strings.xml @@ -69,7 +69,6 @@ UI Ölçeklendirme: [UI_SCALE] Bant genişliği: [NET_BANDWITH]kbit/s LOD faktörü: [LOD_FACTOR] İşleme kalitesi: [RENDER_QUALITY] -Gelişmiş Aydınlatma Modeli: [GPU_SHADERS] Doku belleği: [TEXTURE_MEMORY]MB -- cgit v1.2.3 From 00331d3dca86fd54e6f31aea3c0f5018672e1bcb Mon Sep 17 00:00:00 2001 From: Mnikolenko Productengine Date: Fri, 27 Sep 2024 17:33:01 +0300 Subject: Add UI callback to invoke specified script via menu --- indra/newview/llviewermenu.cpp | 21 +++++++++++++++++++++ indra/newview/scripts/lua/test_top_menu.lua | 28 +++++++++++++++++++++++----- 2 files changed, 44 insertions(+), 5 deletions(-) diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index af719293e6..5a012f3015 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -78,6 +78,7 @@ #include "llfloatertools.h" #include "llfloaterworldmap.h" #include "llfloaterbuildoptions.h" +#include "fsyspath.h" #include "llavataractions.h" #include "lllandmarkactions.h" #include "llgroupmgr.h" @@ -90,6 +91,7 @@ #include "llinventorybridge.h" #include "llinventorydefines.h" #include "llinventoryfunctions.h" +#include "llluamanager.h" #include "llpanellogin.h" #include "llpanelblockedlist.h" #include "llpanelmaininventory.h" @@ -9472,6 +9474,23 @@ void LLUploadCostCalculator::calculateCost(const std::string& asset_type_str) mCostStr = std::to_string(upload_cost); } +void lua_run_script(const LLSD& userdata) +{ + std::string script_path = userdata.asString(); + if (script_path.empty()) + { + LL_WARNS() << "Script name is not specified" << LL_ENDL; + return; + } + fsyspath fs_script_path(script_path); + script_path = fs_script_path.lexically_normal().u8string(); + if (!fs_script_path.is_absolute()) + { + script_path = (fsyspath(gDirUtilp->getExpandedFilename(LL_PATH_SCRIPTS, "lua")) / script_path).u8string(); + } + LLLUAmanager::runScriptFile(script_path); +} + void show_navbar_context_menu(LLView* ctrl, S32 x, S32 y) { static LLMenuGL* show_navbar_context_menu = LLUICtrlFactory::getInstance()->createFromFile("menu_hide_navbar.xml", @@ -10074,4 +10093,6 @@ void initialize_menus() view_listener_t::addMenu(new LLEditableSelected(), "EditableSelected"); view_listener_t::addMenu(new LLEditableSelectedMono(), "EditableSelectedMono"); view_listener_t::addMenu(new LLToggleUIHints(), "ToggleUIHints"); + + registrar.add("Lua.RunScript", boost::bind(&lua_run_script, _2), cb_info::UNTRUSTED_BLOCK); } diff --git a/indra/newview/scripts/lua/test_top_menu.lua b/indra/newview/scripts/lua/test_top_menu.lua index 780a384c92..f877cda5eb 100644 --- a/indra/newview/scripts/lua/test_top_menu.lua +++ b/indra/newview/scripts/lua/test_top_menu.lua @@ -18,17 +18,35 @@ UI.addMenuItem{name="lua_scripts",label="Scripts", --Add menu separator to the 'LUA Menu' under added menu items UI.addMenuSeparator{parent_menu=MENU_NAME} ---Add two new menu branch 'About...' to the 'LUA Menu' -local BRANCH_NAME = "about_branch" -UI.addMenuBranch{name="about_branch",label="About...",parent_menu=MENU_NAME} +--Add 'Demo scripts...' branch to the 'LUA Menu' +local DEMO_BRANCH = "demo_scripts" +UI.addMenuBranch{name=DEMO_BRANCH,label="Demo scripts...",parent_menu=MENU_NAME} + +--Add menu items to the 'Demo scripts...' branch, which will invoke specified script on click +UI.addMenuItem{name="speedometer",label="Speedometer", + param="test_luafloater_speedometer.lua", + func="Lua.RunScript", + parent_menu=DEMO_BRANCH} + +UI.addMenuItem{name="gesture_list",label="Gesture list", + param="test_luafloater_gesture_list.lua", + func="Lua.RunScript", + parent_menu=DEMO_BRANCH} + +--Add one more menu separator +UI.addMenuSeparator{parent_menu=MENU_NAME} + +--Add 'About...' branch to the 'LUA Menu' +local ABOUT_BRANCH = "about_branch" +UI.addMenuBranch{name=ABOUT_BRANCH,label="About...",parent_menu=MENU_NAME} --Add two new menu items to the 'About...' branch UI.addMenuItem{name="lua_info",label="Lua...", param="https://www.lua.org/about.html", func="Advanced.ShowURL", - parent_menu=BRANCH_NAME} + parent_menu=ABOUT_BRANCH} UI.addMenuItem{name="lua_info",label="Luau...", param="https://luau-lang.org/", func="Advanced.ShowURL", - parent_menu=BRANCH_NAME} + parent_menu=ABOUT_BRANCH} -- cgit v1.2.3 From 64c055f9be03861661f8c211ae36ba0db489b12d Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Thu, 26 Sep 2024 20:59:01 +0300 Subject: viewer#2653 fix texture readback not being called and not setting values properly Ex: Saving textures to hard drive sometimes fails --- indra/newview/llviewertexture.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index 9e1cb84bd1..0f9c65893d 100644 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -2495,6 +2495,11 @@ bool LLViewerFetchedTexture::doLoadedCallbacks() } } + if (need_readback) + { + readbackRawImage(); + } + // // Run raw/auxiliary data callbacks // @@ -2744,10 +2749,22 @@ void LLViewerFetchedTexture::readbackRawImage() if (mGLTexturep.notNull() && mGLTexturep->getTexName() != 0 && (mRawImage.isNull() || mRawImage->getWidth() < mGLTexturep->getWidth() || mRawImage->getHeight() < mGLTexturep->getHeight() )) { + if (mRawImage.isNull()) + { + sRawCount++; + } mRawImage = new LLImageRaw(); if (!mGLTexturep->readBackRaw(-1, mRawImage, false)) { mRawImage = nullptr; + mIsRawImageValid = false; + mRawDiscardLevel = INVALID_DISCARD_LEVEL; + sRawCount--; + } + else + { + mIsRawImageValid = true; + mRawDiscardLevel = mGLTexturep->getDiscardLevel(); } } } -- cgit v1.2.3 From c47678801b061494a40beb3d14d44071954fc387 Mon Sep 17 00:00:00 2001 From: Rye Cogtail Date: Fri, 27 Sep 2024 13:09:33 -0400 Subject: Remove dead LLPostProcess class and related code --- indra/llrender/CMakeLists.txt | 2 - indra/llrender/llpostprocess.cpp | 454 --------------------- indra/llrender/llpostprocess.h | 267 ------------ indra/newview/CMakeLists.txt | 2 - indra/newview/llappviewer.cpp | 3 - indra/newview/llfloaterpostprocess.cpp | 229 ----------- indra/newview/llfloaterpostprocess.h | 72 ---- indra/newview/llstartup.cpp | 5 - indra/newview/llviewerdisplay.cpp | 1 - indra/newview/llviewerdisplay.h | 2 - indra/newview/llviewerfloaterreg.cpp | 2 - indra/newview/llviewermenu.cpp | 12 - indra/newview/llviewerwindow.cpp | 6 - .../skins/default/xui/en/floater_post_process.xml | 426 ------------------- 14 files changed, 1483 deletions(-) delete mode 100644 indra/llrender/llpostprocess.cpp delete mode 100644 indra/llrender/llpostprocess.h delete mode 100644 indra/newview/llfloaterpostprocess.cpp delete mode 100644 indra/newview/llfloaterpostprocess.h delete mode 100644 indra/newview/skins/default/xui/en/floater_post_process.xml diff --git a/indra/llrender/CMakeLists.txt b/indra/llrender/CMakeLists.txt index ccff7c7a8c..26a8ff070f 100644 --- a/indra/llrender/CMakeLists.txt +++ b/indra/llrender/CMakeLists.txt @@ -23,7 +23,6 @@ set(llrender_SOURCE_FILES llglslshader.cpp llgltexture.cpp llimagegl.cpp - llpostprocess.cpp llrender.cpp llrender2dutils.cpp llrendernavprim.cpp @@ -56,7 +55,6 @@ set(llrender_HEADER_FILES llgltexture.h llgltypes.h llimagegl.h - llpostprocess.h llrender.h llrender2dutils.h llrendernavprim.h diff --git a/indra/llrender/llpostprocess.cpp b/indra/llrender/llpostprocess.cpp deleted file mode 100644 index eef7193c92..0000000000 --- a/indra/llrender/llpostprocess.cpp +++ /dev/null @@ -1,454 +0,0 @@ -/** - * @file llpostprocess.cpp - * @brief LLPostProcess class implementation - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#include "linden_common.h" - -#include "llpostprocess.h" -#include "llglslshader.h" -#include "llsdserialize.h" -#include "llrender.h" - -static LLStaticHashedString sRenderTexture("RenderTexture"); -static LLStaticHashedString sBrightness("brightness"); -static LLStaticHashedString sContrast("contrast"); -static LLStaticHashedString sContrastBase("contrastBase"); -static LLStaticHashedString sSaturation("saturation"); -static LLStaticHashedString sLumWeights("lumWeights"); -static LLStaticHashedString sNoiseTexture("NoiseTexture"); -static LLStaticHashedString sBrightMult("brightMult"); -static LLStaticHashedString sNoiseStrength("noiseStrength"); -static LLStaticHashedString sExtractLow("extractLow"); -static LLStaticHashedString sExtractHigh("extractHigh"); -static LLStaticHashedString sBloomStrength("bloomStrength"); -static LLStaticHashedString sTexelSize("texelSize"); -static LLStaticHashedString sBlurDirection("blurDirection"); -static LLStaticHashedString sBlurWidth("blurWidth"); - -LLPostProcess * gPostProcess = NULL; - -static const unsigned int NOISE_SIZE = 512; - -LLPostProcess::LLPostProcess(void) : - initialized(false), - mAllEffects(LLSD::emptyMap()), - screenW(1), screenH(1) -{ - mSceneRenderTexture = NULL ; - mNoiseTexture = NULL ; - mTempBloomTexture = NULL ; - - noiseTextureScale = 1.0f; - - /* Do nothing. Needs to be updated to use our current shader system, and to work with the move into llrender. - std::string pathName(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight", XML_FILENAME)); - LL_DEBUGS("AppInit", "Shaders") << "Loading PostProcess Effects settings from " << pathName << LL_ENDL; - - llifstream effectsXML(pathName); - - if (effectsXML) - { - LLPointer parser = new LLSDXMLParser(); - - parser->parse(effectsXML, mAllEffects, LLSDSerialize::SIZE_UNLIMITED); - } - - if (!mAllEffects.has("default")) - { - LLSD & defaultEffect = (mAllEffects["default"] = LLSD::emptyMap()); - - defaultEffect["enable_night_vision"] = LLSD::Boolean(false); - defaultEffect["enable_bloom"] = LLSD::Boolean(false); - defaultEffect["enable_color_filter"] = LLSD::Boolean(false); - - /// NVG Defaults - defaultEffect["brightness_multiplier"] = 3.0; - defaultEffect["noise_size"] = 25.0; - defaultEffect["noise_strength"] = 0.4; - - // TODO BTest potentially add this to tweaks? - noiseTextureScale = 1.0f; - - /// Bloom Defaults - defaultEffect["extract_low"] = 0.95; - defaultEffect["extract_high"] = 1.0; - defaultEffect["bloom_width"] = 2.25; - defaultEffect["bloom_strength"] = 1.5; - - /// Color Filter Defaults - defaultEffect["brightness"] = 1.0; - defaultEffect["contrast"] = 1.0; - defaultEffect["saturation"] = 1.0; - - LLSD& contrastBase = (defaultEffect["contrast_base"] = LLSD::emptyArray()); - contrastBase.append(1.0); - contrastBase.append(1.0); - contrastBase.append(1.0); - contrastBase.append(0.5); - } - - setSelectedEffect("default"); - */ -} - -LLPostProcess::~LLPostProcess(void) -{ - invalidate() ; -} - -// static -void LLPostProcess::initClass(void) -{ - //this will cause system to crash at second time login - //if first time login fails due to network connection --- bao - //***llassert_always(gPostProcess == NULL); - //replaced by the following line: - if(gPostProcess) - return ; - - - gPostProcess = new LLPostProcess(); -} - -// static -void LLPostProcess::cleanupClass() -{ - delete gPostProcess; - gPostProcess = NULL; -} - -void LLPostProcess::setSelectedEffect(std::string const & effectName) -{ - mSelectedEffectName = effectName; - static_cast(tweaks) = mAllEffects[effectName]; -} - -void LLPostProcess::saveEffect(std::string const & effectName) -{ - /* Do nothing. Needs to be updated to use our current shader system, and to work with the move into llrender. - mAllEffects[effectName] = tweaks; - - std::string pathName(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight", XML_FILENAME)); - //LL_INFOS() << "Saving PostProcess Effects settings to " << pathName << LL_ENDL; - - llofstream effectsXML(pathName); - - LLPointer formatter = new LLSDXMLFormatter(); - - formatter->format(mAllEffects, effectsXML); - */ -} -void LLPostProcess::invalidate() -{ - mSceneRenderTexture = NULL ; - mNoiseTexture = NULL ; - mTempBloomTexture = NULL ; - initialized = false ; -} - -void LLPostProcess::apply(unsigned int width, unsigned int height) -{ - if (!initialized || width != screenW || height != screenH){ - initialize(width, height); - } - if (shadersEnabled()){ - doEffects(); - } -} - -void LLPostProcess::initialize(unsigned int width, unsigned int height) -{ - screenW = width; - screenH = height; - createTexture(mSceneRenderTexture, screenW, screenH); - initialized = true; - - checkError(); - createNightVisionShader(); - createBloomShader(); - createColorFilterShader(); - checkError(); -} - -inline bool LLPostProcess::shadersEnabled(void) -{ - return (tweaks.useColorFilter().asBoolean() || - tweaks.useNightVisionShader().asBoolean() || - tweaks.useBloomShader().asBoolean() ); - -} - -void LLPostProcess::applyShaders(void) -{ - if (tweaks.useColorFilter()){ - applyColorFilterShader(); - checkError(); - } - if (tweaks.useNightVisionShader()){ - /// If any of the above shaders have been called update the frame buffer; - if (tweaks.useColorFilter()) - { - U32 tex = mSceneRenderTexture->getTexName() ; - copyFrameBuffer(tex, screenW, screenH); - } - applyNightVisionShader(); - checkError(); - } - if (tweaks.useBloomShader()){ - /// If any of the above shaders have been called update the frame buffer; - if (tweaks.useColorFilter().asBoolean() || tweaks.useNightVisionShader().asBoolean()) - { - U32 tex = mSceneRenderTexture->getTexName() ; - copyFrameBuffer(tex, screenW, screenH); - } - applyBloomShader(); - checkError(); - } -} - -void LLPostProcess::applyColorFilterShader(void) -{ - -} - -void LLPostProcess::createColorFilterShader(void) -{ - /// Define uniform names - colorFilterUniforms[sRenderTexture] = 0; - colorFilterUniforms[sBrightness] = 0; - colorFilterUniforms[sContrast] = 0; - colorFilterUniforms[sContrastBase] = 0; - colorFilterUniforms[sSaturation] = 0; - colorFilterUniforms[sLumWeights] = 0; -} - -void LLPostProcess::applyNightVisionShader(void) -{ - -} - -void LLPostProcess::createNightVisionShader(void) -{ - /// Define uniform names - nightVisionUniforms[sRenderTexture] = 0; - nightVisionUniforms[sNoiseTexture] = 0; - nightVisionUniforms[sBrightMult] = 0; - nightVisionUniforms[sNoiseStrength] = 0; - nightVisionUniforms[sLumWeights] = 0; - - createNoiseTexture(mNoiseTexture); -} - -void LLPostProcess::applyBloomShader(void) -{ - -} - -void LLPostProcess::createBloomShader(void) -{ - createTexture(mTempBloomTexture, unsigned(screenW * 0.5), unsigned(screenH * 0.5)); - - /// Create Bloom Extract Shader - bloomExtractUniforms[sRenderTexture] = 0; - bloomExtractUniforms[sExtractLow] = 0; - bloomExtractUniforms[sExtractHigh] = 0; - bloomExtractUniforms[sLumWeights] = 0; - - /// Create Bloom Blur Shader - bloomBlurUniforms[sRenderTexture] = 0; - bloomBlurUniforms[sBloomStrength] = 0; - bloomBlurUniforms[sTexelSize] = 0; - bloomBlurUniforms[sBlurDirection] = 0; - bloomBlurUniforms[sBlurWidth] = 0; -} - -void LLPostProcess::getShaderUniforms(glslUniforms & uniforms, GLuint & prog) -{ - /// Find uniform locations and insert into map - glslUniforms::iterator i; - for (i = uniforms.begin(); i != uniforms.end(); ++i){ - i->second = glGetUniformLocation(prog, i->first.String().c_str()); - } -} - -void LLPostProcess::doEffects(void) -{ - /// Save GL State - glPushAttrib(GL_ALL_ATTRIB_BITS); - glPushClientAttrib(GL_ALL_ATTRIB_BITS); - - /// Copy the screen buffer to the render texture - { - U32 tex = mSceneRenderTexture->getTexName() ; - copyFrameBuffer(tex, screenW, screenH); - } - - /// Clear the frame buffer. - glClearColor(0.0f, 0.0f, 0.0f, 1.0f); - glClear(GL_COLOR_BUFFER_BIT); - - /// Change to an orthogonal view - viewOrthogonal(screenW, screenH); - - checkError(); - applyShaders(); - - LLGLSLShader::unbind(); - checkError(); - - /// Change to a perspective view - viewPerspective(); - - /// Reset GL State - glPopClientAttrib(); - glPopAttrib(); - checkError(); -} - -void LLPostProcess::copyFrameBuffer(U32 & texture, unsigned int width, unsigned int height) -{ - gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, texture); - glCopyTexImage2D(GL_TEXTURE_RECTANGLE, 0, GL_RGBA, 0, 0, width, height, 0); -} - -void LLPostProcess::drawOrthoQuad(unsigned int width, unsigned int height, QuadType type) -{ - -} - -void LLPostProcess::viewOrthogonal(unsigned int width, unsigned int height) -{ - gGL.matrixMode(LLRender::MM_PROJECTION); - gGL.pushMatrix(); - gGL.loadIdentity(); - gGL.ortho( 0.f, (GLfloat) width , (GLfloat) height , 0.f, -1.f, 1.f ); - gGL.matrixMode(LLRender::MM_MODELVIEW); - gGL.pushMatrix(); - gGL.loadIdentity(); -} - -void LLPostProcess::viewPerspective(void) -{ - gGL.matrixMode(LLRender::MM_PROJECTION); - gGL.popMatrix(); - gGL.matrixMode(LLRender::MM_MODELVIEW); - gGL.popMatrix(); -} - -void LLPostProcess::changeOrthogonal(unsigned int width, unsigned int height) -{ - viewPerspective(); - viewOrthogonal(width, height); -} - -void LLPostProcess::createTexture(LLPointer& texture, unsigned int width, unsigned int height) -{ - std::vector data(width * height * 4, 0) ; - - texture = new LLImageGL(false) ; - if(texture->createGLTexture()) - { - gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, texture->getTexName()); - glTexImage2D(GL_TEXTURE_RECTANGLE, 0, 4, width, height, 0, - GL_RGBA, GL_UNSIGNED_BYTE, &data[0]); - gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_BILINEAR); - gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_CLAMP); - } -} - -void LLPostProcess::createNoiseTexture(LLPointer& texture) -{ - std::vector buffer(NOISE_SIZE * NOISE_SIZE); - for (unsigned int i = 0; i < NOISE_SIZE; i++){ - for (unsigned int k = 0; k < NOISE_SIZE; k++){ - buffer[(i * NOISE_SIZE) + k] = (GLubyte)((double) rand() / ((double) RAND_MAX + 1.f) * 255.f); - } - } - - texture = new LLImageGL(false) ; - if(texture->createGLTexture()) - { - gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, texture->getTexName()); - LLImageGL::setManualImage(GL_TEXTURE_2D, 0, GL_LUMINANCE, NOISE_SIZE, NOISE_SIZE, GL_LUMINANCE, GL_UNSIGNED_BYTE, &buffer[0]); - gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_BILINEAR); - gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_WRAP); - } -} - -bool LLPostProcess::checkError(void) -{ - GLenum glErr; - bool retCode = false; - - glErr = glGetError(); - while (glErr != GL_NO_ERROR) - { - // shaderErrorLog << (const char *) gluErrorString(glErr) << std::endl; - char const * err_str_raw = (const char *) gluErrorString(glErr); - - if(err_str_raw == NULL) - { - std::ostringstream err_builder; - err_builder << "unknown error number " << glErr; - mShaderErrorString = err_builder.str(); - } - else - { - mShaderErrorString = err_str_raw; - } - - retCode = true; - glErr = glGetError(); - } - return retCode; -} - -void LLPostProcess::checkShaderError(GLuint shader) -{ - GLint infologLength = 0; - GLint charsWritten = 0; - GLchar *infoLog; - - checkError(); // Check for OpenGL errors - - glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &infologLength); - - checkError(); // Check for OpenGL errors - - if (infologLength > 0) - { - infoLog = (GLchar *)malloc(infologLength); - if (infoLog == NULL) - { - /// Could not allocate infolog buffer - return; - } - glGetProgramInfoLog(shader, infologLength, &charsWritten, infoLog); - // shaderErrorLog << (char *) infoLog << std::endl; - mShaderErrorString = (char *) infoLog; - free(infoLog); - } - checkError(); // Check for OpenGL errors -} diff --git a/indra/llrender/llpostprocess.h b/indra/llrender/llpostprocess.h deleted file mode 100644 index b5b7549efb..0000000000 --- a/indra/llrender/llpostprocess.h +++ /dev/null @@ -1,267 +0,0 @@ -/** - * @file llpostprocess.h - * @brief LLPostProcess class definition - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#ifndef LL_POSTPROCESS_H -#define LL_POSTPROCESS_H - -#include -#include -#include "llgl.h" -#include "llglheaders.h" -#include "llstaticstringtable.h" - -class LLPostProcess -{ -public: - - typedef enum _QuadType { - QUAD_NORMAL, - QUAD_NOISE, - QUAD_BLOOM_EXTRACT, - QUAD_BLOOM_COMBINE - } QuadType; - - /// GLSL Shader Encapsulation Struct - typedef LLStaticStringTable glslUniforms; - - struct PostProcessTweaks : public LLSD { - inline PostProcessTweaks() : LLSD(LLSD::emptyMap()) - { - } - - inline LLSD & brightMult() { - return (*this)["brightness_multiplier"]; - } - - inline LLSD & noiseStrength() { - return (*this)["noise_strength"]; - } - - inline LLSD & noiseSize() { - return (*this)["noise_size"]; - } - - inline LLSD & extractLow() { - return (*this)["extract_low"]; - } - - inline LLSD & extractHigh() { - return (*this)["extract_high"]; - } - - inline LLSD & bloomWidth() { - return (*this)["bloom_width"]; - } - - inline LLSD & bloomStrength() { - return (*this)["bloom_strength"]; - } - - inline LLSD & brightness() { - return (*this)["brightness"]; - } - - inline LLSD & contrast() { - return (*this)["contrast"]; - } - - inline LLSD & contrastBaseR() { - return (*this)["contrast_base"][0]; - } - - inline LLSD & contrastBaseG() { - return (*this)["contrast_base"][1]; - } - - inline LLSD & contrastBaseB() { - return (*this)["contrast_base"][2]; - } - - inline LLSD & contrastBaseIntensity() { - return (*this)["contrast_base"][3]; - } - - inline LLSD & saturation() { - return (*this)["saturation"]; - } - - inline LLSD & useNightVisionShader() { - return (*this)["enable_night_vision"]; - } - - inline LLSD & useBloomShader() { - return (*this)["enable_bloom"]; - } - - inline LLSD & useColorFilter() { - return (*this)["enable_color_filter"]; - } - - - inline F32 getBrightMult() const { - return F32((*this)["brightness_multiplier"].asReal()); - } - - inline F32 getNoiseStrength() const { - return F32((*this)["noise_strength"].asReal()); - } - - inline F32 getNoiseSize() const { - return F32((*this)["noise_size"].asReal()); - } - - inline F32 getExtractLow() const { - return F32((*this)["extract_low"].asReal()); - } - - inline F32 getExtractHigh() const { - return F32((*this)["extract_high"].asReal()); - } - - inline F32 getBloomWidth() const { - return F32((*this)["bloom_width"].asReal()); - } - - inline F32 getBloomStrength() const { - return F32((*this)["bloom_strength"].asReal()); - } - - inline F32 getBrightness() const { - return F32((*this)["brightness"].asReal()); - } - - inline F32 getContrast() const { - return F32((*this)["contrast"].asReal()); - } - - inline F32 getContrastBaseR() const { - return F32((*this)["contrast_base"][0].asReal()); - } - - inline F32 getContrastBaseG() const { - return F32((*this)["contrast_base"][1].asReal()); - } - - inline F32 getContrastBaseB() const { - return F32((*this)["contrast_base"][2].asReal()); - } - - inline F32 getContrastBaseIntensity() const { - return F32((*this)["contrast_base"][3].asReal()); - } - - inline F32 getSaturation() const { - return F32((*this)["saturation"].asReal()); - } - - }; - - bool initialized; - PostProcessTweaks tweaks; - - // the map of all availible effects - LLSD mAllEffects; - -private: - LLPointer mSceneRenderTexture ; - LLPointer mNoiseTexture ; - LLPointer mTempBloomTexture ; - -public: - LLPostProcess(void); - - ~LLPostProcess(void); - - void apply(unsigned int width, unsigned int height); - void invalidate() ; - - /// Perform global initialization for this class. - static void initClass(void); - - // Cleanup of global data that's only inited once per class. - static void cleanupClass(); - - void setSelectedEffect(std::string const & effectName); - - inline std::string const & getSelectedEffect(void) const { - return mSelectedEffectName; - } - - void saveEffect(std::string const & effectName); - -private: - /// read in from file - std::string mShaderErrorString; - unsigned int screenW; - unsigned int screenH; - - float noiseTextureScale; - - /// Shader Uniforms - glslUniforms nightVisionUniforms; - glslUniforms bloomExtractUniforms; - glslUniforms bloomBlurUniforms; - glslUniforms colorFilterUniforms; - - // the name of currently selected effect in mAllEffects - // invariant: tweaks == mAllEffects[mSelectedEffectName] - std::string mSelectedEffectName; - - /// General functions - void initialize(unsigned int width, unsigned int height); - void doEffects(void); - void applyShaders(void); - bool shadersEnabled(void); - - /// Night Vision Functions - void createNightVisionShader(void); - void applyNightVisionShader(void); - - /// Bloom Functions - void createBloomShader(void); - void applyBloomShader(void); - - /// Color Filter Functions - void createColorFilterShader(void); - void applyColorFilterShader(void); - - /// OpenGL Helper Functions - void getShaderUniforms(glslUniforms & uniforms, GLuint & prog); - void createTexture(LLPointer& texture, unsigned int width, unsigned int height); - void copyFrameBuffer(U32 & texture, unsigned int width, unsigned int height); - void createNoiseTexture(LLPointer& texture); - bool checkError(void); - void checkShaderError(GLuint shader); - void drawOrthoQuad(unsigned int width, unsigned int height, QuadType type); - void viewOrthogonal(unsigned int width, unsigned int height); - void changeOrthogonal(unsigned int width, unsigned int height); - void viewPerspective(void); -}; - -extern LLPostProcess * gPostProcess; - - -#endif // LL_POSTPROCESS_H diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 04ce88f0c6..29dbceedac 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -271,7 +271,6 @@ set(viewer_SOURCE_FILES llfloaterpay.cpp llfloaterperformance.cpp llfloaterperms.cpp - llfloaterpostprocess.cpp llfloaterprofile.cpp llfloaterpreference.cpp llfloaterpreferencesgraphicsadvanced.cpp @@ -946,7 +945,6 @@ set(viewer_HEADER_FILES llfloaterpay.h llfloaterperformance.h llfloaterperms.h - llfloaterpostprocess.h llfloaterprofile.h llfloaterpreference.h llfloaterpreferencesgraphicsadvanced.h diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 377fb4d486..521e6eee1a 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -184,7 +184,6 @@ #include "lltracker.h" #include "llviewerparcelmgr.h" #include "llworldmapview.h" -#include "llpostprocess.h" #include "lldebugview.h" #include "llconsole.h" @@ -1972,8 +1971,6 @@ bool LLAppViewer::cleanup() SUBSYSTEM_CLEANUP(LLAvatarAppearance); - SUBSYSTEM_CLEANUP(LLPostProcess); - LLTracker::cleanupInstance(); // *FIX: This is handled in LLAppViewerWin32::cleanup(). diff --git a/indra/newview/llfloaterpostprocess.cpp b/indra/newview/llfloaterpostprocess.cpp deleted file mode 100644 index 616c13cdc7..0000000000 --- a/indra/newview/llfloaterpostprocess.cpp +++ /dev/null @@ -1,229 +0,0 @@ -/** - * @file llfloaterpostprocess.cpp - * @brief LLFloaterPostProcess class definition - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#include "llviewerprecompiledheaders.h" - -#include "llfloaterpostprocess.h" - -#include "llsliderctrl.h" -#include "llcheckboxctrl.h" -#include "llnotificationsutil.h" -#include "lluictrlfactory.h" -#include "llviewerdisplay.h" -#include "llpostprocess.h" -#include "llcombobox.h" -#include "lllineeditor.h" -#include "llviewerwindow.h" - - -LLFloaterPostProcess::LLFloaterPostProcess(const LLSD& key) - : LLFloater(key) -{ -} - -LLFloaterPostProcess::~LLFloaterPostProcess() -{ - - -} -bool LLFloaterPostProcess::postBuild() -{ - /// Color Filter Callbacks - childSetCommitCallback("ColorFilterToggle", &LLFloaterPostProcess::onBoolToggle, (char*)"enable_color_filter"); - //childSetCommitCallback("ColorFilterGamma", &LLFloaterPostProcess::onFloatControlMoved, &(gPostProcess->tweaks.gamma())); - childSetCommitCallback("ColorFilterBrightness", &LLFloaterPostProcess::onFloatControlMoved, (char*)"brightness"); - childSetCommitCallback("ColorFilterSaturation", &LLFloaterPostProcess::onFloatControlMoved, (char*)"saturation"); - childSetCommitCallback("ColorFilterContrast", &LLFloaterPostProcess::onFloatControlMoved, (char*)"contrast"); - - childSetCommitCallback("ColorFilterBaseR", &LLFloaterPostProcess::onColorControlRMoved, (char*)"contrast_base"); - childSetCommitCallback("ColorFilterBaseG", &LLFloaterPostProcess::onColorControlGMoved, (char*)"contrast_base"); - childSetCommitCallback("ColorFilterBaseB", &LLFloaterPostProcess::onColorControlBMoved, (char*)"contrast_base"); - childSetCommitCallback("ColorFilterBaseI", &LLFloaterPostProcess::onColorControlIMoved, (char*)"contrast_base"); - - /// Night Vision Callbacks - childSetCommitCallback("NightVisionToggle", &LLFloaterPostProcess::onBoolToggle, (char*)"enable_night_vision"); - childSetCommitCallback("NightVisionBrightMult", &LLFloaterPostProcess::onFloatControlMoved, (char*)"brightness_multiplier"); - childSetCommitCallback("NightVisionNoiseSize", &LLFloaterPostProcess::onFloatControlMoved, (char*)"noise_size"); - childSetCommitCallback("NightVisionNoiseStrength", &LLFloaterPostProcess::onFloatControlMoved, (char*)"noise_strength"); - - /// Bloom Callbacks - childSetCommitCallback("BloomToggle", &LLFloaterPostProcess::onBoolToggle, (char*)"enable_bloom"); - childSetCommitCallback("BloomExtract", &LLFloaterPostProcess::onFloatControlMoved, (char*)"extract_low"); - childSetCommitCallback("BloomSize", &LLFloaterPostProcess::onFloatControlMoved, (char*)"bloom_width"); - childSetCommitCallback("BloomStrength", &LLFloaterPostProcess::onFloatControlMoved, (char*)"bloom_strength"); - - // Effect loading and saving. - LLComboBox* comboBox = getChild("PPEffectsCombo"); - getChild("PPLoadEffect")->setCommitCallback(boost::bind(&LLFloaterPostProcess::onLoadEffect, this, comboBox)); - comboBox->setCommitCallback(boost::bind(&LLFloaterPostProcess::onChangeEffectName, this, _1)); - - LLLineEditor* editBox = getChild("PPEffectNameEditor"); - getChild("PPSaveEffect")->setCommitCallback(boost::bind(&LLFloaterPostProcess::onSaveEffect, this, editBox)); - - syncMenu(); - return true; -} - -// Bool Toggle -void LLFloaterPostProcess::onBoolToggle(LLUICtrl* ctrl, void* userData) -{ - char const * boolVariableName = (char const *)userData; - - // check the bool - LLCheckBoxCtrl* cbCtrl = static_cast(ctrl); - gPostProcess->tweaks[boolVariableName] = cbCtrl->getValue(); -} - -// Float Moved -void LLFloaterPostProcess::onFloatControlMoved(LLUICtrl* ctrl, void* userData) -{ - char const * floatVariableName = (char const *)userData; - LLSliderCtrl* sldrCtrl = static_cast(ctrl); - gPostProcess->tweaks[floatVariableName] = sldrCtrl->getValue(); -} - -// Color Moved -void LLFloaterPostProcess::onColorControlRMoved(LLUICtrl* ctrl, void* userData) -{ - char const * floatVariableName = (char const *)userData; - LLSliderCtrl* sldrCtrl = static_cast(ctrl); - gPostProcess->tweaks[floatVariableName][0] = sldrCtrl->getValue(); -} - -// Color Moved -void LLFloaterPostProcess::onColorControlGMoved(LLUICtrl* ctrl, void* userData) -{ - char const * floatVariableName = (char const *)userData; - LLSliderCtrl* sldrCtrl = static_cast(ctrl); - gPostProcess->tweaks[floatVariableName][1] = sldrCtrl->getValue(); -} - -// Color Moved -void LLFloaterPostProcess::onColorControlBMoved(LLUICtrl* ctrl, void* userData) -{ - char const * floatVariableName = (char const *)userData; - LLSliderCtrl* sldrCtrl = static_cast(ctrl); - gPostProcess->tweaks[floatVariableName][2] = sldrCtrl->getValue(); -} - -// Color Moved -void LLFloaterPostProcess::onColorControlIMoved(LLUICtrl* ctrl, void* userData) -{ - char const * floatVariableName = (char const *)userData; - LLSliderCtrl* sldrCtrl = static_cast(ctrl); - gPostProcess->tweaks[floatVariableName][3] = sldrCtrl->getValue(); -} - -void LLFloaterPostProcess::onLoadEffect(LLComboBox* comboBox) -{ - LLSD::String effectName(comboBox->getSelectedValue().asString()); - - gPostProcess->setSelectedEffect(effectName); - - syncMenu(); -} - -void LLFloaterPostProcess::onSaveEffect(LLLineEditor* editBox) -{ - std::string effectName(editBox->getValue().asString()); - - if (gPostProcess->mAllEffects.has(effectName)) - { - LLSD payload; - payload["effect_name"] = effectName; - LLNotificationsUtil::add("PPSaveEffectAlert", LLSD(), payload, boost::bind(&LLFloaterPostProcess::saveAlertCallback, this, _1, _2)); - } - else - { - gPostProcess->saveEffect(effectName); - syncMenu(); - } -} - -void LLFloaterPostProcess::onChangeEffectName(LLUICtrl* ctrl) -{ - // get the combo box and name - LLLineEditor* editBox = getChild("PPEffectNameEditor"); - - // set the parameter's new name - editBox->setValue(ctrl->getValue()); -} - -bool LLFloaterPostProcess::saveAlertCallback(const LLSD& notification, const LLSD& response) -{ - S32 option = LLNotificationsUtil::getSelectedOption(notification, response); - - // if they choose save, do it. Otherwise, don't do anything - if (option == 0) - { - gPostProcess->saveEffect(notification["payload"]["effect_name"].asString()); - - syncMenu(); - } - return false; -} - -void LLFloaterPostProcess::syncMenu() -{ - // add the combo boxe contents - LLComboBox* comboBox = getChild("PPEffectsCombo"); - - comboBox->removeall(); - - LLSD::map_const_iterator currEffect; - for(currEffect = gPostProcess->mAllEffects.beginMap(); - currEffect != gPostProcess->mAllEffects.endMap(); - ++currEffect) - { - comboBox->add(currEffect->first); - } - - // set the current effect as selected. - comboBox->selectByValue(gPostProcess->getSelectedEffect()); - - /// Sync Color Filter Menu - getChild("ColorFilterToggle")->setValue(gPostProcess->tweaks.useColorFilter()); - //getChild("ColorFilterGamma")->setValue(gPostProcess->tweaks.gamma()); - getChild("ColorFilterBrightness")->setValue(gPostProcess->tweaks.brightness()); - getChild("ColorFilterSaturation")->setValue(gPostProcess->tweaks.saturation()); - getChild("ColorFilterContrast")->setValue(gPostProcess->tweaks.contrast()); - getChild("ColorFilterBaseR")->setValue(gPostProcess->tweaks.contrastBaseR()); - getChild("ColorFilterBaseG")->setValue(gPostProcess->tweaks.contrastBaseG()); - getChild("ColorFilterBaseB")->setValue(gPostProcess->tweaks.contrastBaseB()); - getChild("ColorFilterBaseI")->setValue(gPostProcess->tweaks.contrastBaseIntensity()); - - /// Sync Night Vision Menu - getChild("NightVisionToggle")->setValue(gPostProcess->tweaks.useNightVisionShader()); - getChild("NightVisionBrightMult")->setValue(gPostProcess->tweaks.brightMult()); - getChild("NightVisionNoiseSize")->setValue(gPostProcess->tweaks.noiseSize()); - getChild("NightVisionNoiseStrength")->setValue(gPostProcess->tweaks.noiseStrength()); - - /// Sync Bloom Menu - getChild("BloomToggle")->setValue(LLSD(gPostProcess->tweaks.useBloomShader())); - getChild("BloomExtract")->setValue(gPostProcess->tweaks.extractLow()); - getChild("BloomSize")->setValue(gPostProcess->tweaks.bloomWidth()); - getChild("BloomStrength")->setValue(gPostProcess->tweaks.bloomStrength()); -} diff --git a/indra/newview/llfloaterpostprocess.h b/indra/newview/llfloaterpostprocess.h deleted file mode 100644 index 50b48d8410..0000000000 --- a/indra/newview/llfloaterpostprocess.h +++ /dev/null @@ -1,72 +0,0 @@ -/** - * @file llfloaterpostprocess.h - * @brief LLFloaterPostProcess class definition - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#ifndef LL_LLFLOATERPOSTPROCESS_H -#define LL_LLFLOATERPOSTPROCESS_H - -#include "llfloater.h" - -class LLButton; -class LLComboBox; -class LLLineEditor; -class LLSliderCtrl; -class LLTabContainer; -class LLPanelPermissions; -class LLPanelObject; -class LLPanelVolume; -class LLPanelContents; -class LLPanelFace; - -/** - * Menu for adjusting the post process settings of the world - */ -class LLFloaterPostProcess : public LLFloater -{ -public: - - LLFloaterPostProcess(const LLSD& key); - virtual ~LLFloaterPostProcess(); - bool postBuild(); - - /// post process callbacks - static void onBoolToggle(LLUICtrl* ctrl, void* userData); - static void onFloatControlMoved(LLUICtrl* ctrl, void* userData); - static void onColorControlRMoved(LLUICtrl* ctrl, void* userData); - static void onColorControlGMoved(LLUICtrl* ctrl, void* userData); - static void onColorControlBMoved(LLUICtrl* ctrl, void* userData); - static void onColorControlIMoved(LLUICtrl* ctrl, void* userData); - void onLoadEffect(LLComboBox* comboBox); - void onSaveEffect(LLLineEditor* editBox); - void onChangeEffectName(LLUICtrl* ctrl); - - /// prompts a user when overwriting an effect - bool saveAlertCallback(const LLSD& notification, const LLSD& response); - - /// sync up sliders - void syncMenu(); -}; - -#endif diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 6e4a652989..83d6b57fa4 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -181,7 +181,6 @@ #include "llnamelistctrl.h" #include "llnamebox.h" #include "llnameeditor.h" -#include "llpostprocess.h" #include "llagentlanguage.h" #include "llwearable.h" #include "llinventorybridge.h" @@ -1292,10 +1291,6 @@ bool idle_startup() LLDrawable::initClass(); display_startup(); - // init the shader managers - LLPostProcess::initClass(); - display_startup(); - LLAvatarAppearance::initClass("avatar_lad.xml","avatar_skeleton.xml"); display_startup(); diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp index cd35de12c6..1f4502323c 100644 --- a/indra/newview/llviewerdisplay.cpp +++ b/indra/newview/llviewerdisplay.cpp @@ -55,7 +55,6 @@ #include "llmemory.h" #include "llparcel.h" #include "llperfstats.h" -#include "llpostprocess.h" #include "llrender.h" #include "llscenemonitor.h" #include "llsdjson.h" diff --git a/indra/newview/llviewerdisplay.h b/indra/newview/llviewerdisplay.h index 673f51600d..2ec02f09fd 100644 --- a/indra/newview/llviewerdisplay.h +++ b/indra/newview/llviewerdisplay.h @@ -27,8 +27,6 @@ #ifndef LL_LLVIEWERDISPLAY_H #define LL_LLVIEWERDISPLAY_H -class LLPostProcess; - void display_startup(); void display_cleanup(); diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp index 8919e1f375..9d9961d51c 100644 --- a/indra/newview/llviewerfloaterreg.cpp +++ b/indra/newview/llviewerfloaterreg.cpp @@ -118,7 +118,6 @@ #include "llfloaterpay.h" #include "llfloaterperformance.h" #include "llfloaterperms.h" -#include "llfloaterpostprocess.h" #include "llfloaterpreference.h" #include "llfloaterpreferencesgraphicsadvanced.h" #include "llfloaterpreferenceviewadvanced.h" @@ -363,7 +362,6 @@ void LLViewerFloaterReg::registerFloaters() LLFloaterReg::add("emoji_picker", "floater_emoji_picker.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("emoji_complete", "floater_emoji_complete.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("env_post_process", "floater_post_process.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("env_fixed_environmentent_water", "floater_fixedenvironment.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("env_fixed_environmentent_sky", "floater_fixedenvironment.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index af719293e6..2f5a302b3f 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -9354,17 +9354,6 @@ class LLWorldEnableEnvPreset : public view_listener_t } }; - -/// Post-Process callbacks -class LLWorldPostProcess : public view_listener_t -{ - bool handleEvent(const LLSD& userdata) - { - LLFloaterReg::showInstance("env_post_process"); - return true; - } -}; - class LLWorldCheckBanLines : public view_listener_t { bool handleEvent(const LLSD& userdata) @@ -9659,7 +9648,6 @@ void initialize_menus() view_listener_t::addMenu(new LLWorldEnableEnvSettings(), "World.EnableEnvSettings"); view_listener_t::addMenu(new LLWorldEnvPreset(), "World.EnvPreset"); view_listener_t::addMenu(new LLWorldEnableEnvPreset(), "World.EnableEnvPreset"); - view_listener_t::addMenu(new LLWorldPostProcess(), "World.PostProcess"); view_listener_t::addMenu(new LLWorldCheckBanLines() , "World.CheckBanLines"); view_listener_t::addMenu(new LLWorldShowBanLines() , "World.ShowBanLines"); diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index bef667e3bb..c747319940 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -195,7 +195,6 @@ #include "llviewerjoystick.h" #include "llviewermenufile.h" // LLFilePickerReplyThread #include "llviewernetwork.h" -#include "llpostprocess.h" #include "llfloaterimnearbychat.h" #include "llagentui.h" #include "llwearablelist.h" @@ -5762,11 +5761,6 @@ void LLViewerWindow::stopGL() gBox.cleanupGL(); - if(gPostProcess) - { - gPostProcess->invalidate(); - } - gTextureList.destroyGL(); stop_glerror(); diff --git a/indra/newview/skins/default/xui/en/floater_post_process.xml b/indra/newview/skins/default/xui/en/floater_post_process.xml deleted file mode 100644 index 37339f79c8..0000000000 --- a/indra/newview/skins/default/xui/en/floater_post_process.xml +++ /dev/null @@ -1,426 +0,0 @@ - - - - - - - Brightness - - - - Saturation - - - - Contrast - - - - Contrast Base Color - - - - - - - - - - Light Amplification Multiple - - - - Noise Size - - - - Noise Strength - - - - - - - Luminosity Extraction - - - - Bloom Size - - - - Bloom Strength - - - - -