diff options
Diffstat (limited to 'indra/newview')
100 files changed, 1686 insertions, 2434 deletions
diff --git a/indra/newview/English.lproj/language.txt b/indra/newview/English.lproj/language.txt new file mode 100644 index 0000000000..bc0aa577f9 --- /dev/null +++ b/indra/newview/English.lproj/language.txt @@ -0,0 +1 @@ +en-us
\ No newline at end of file diff --git a/indra/newview/German.lproj/language.txt b/indra/newview/German.lproj/language.txt new file mode 100644 index 0000000000..c42e816f93 --- /dev/null +++ b/indra/newview/German.lproj/language.txt @@ -0,0 +1 @@ +de
\ No newline at end of file diff --git a/indra/newview/Japanese.lproj/language.txt b/indra/newview/Japanese.lproj/language.txt new file mode 100644 index 0000000000..c6e3ab6f3c --- /dev/null +++ b/indra/newview/Japanese.lproj/language.txt @@ -0,0 +1 @@ +ja
\ No newline at end of file diff --git a/indra/newview/Korean.lproj/language.txt b/indra/newview/Korean.lproj/language.txt new file mode 100644 index 0000000000..b03ec72ee0 --- /dev/null +++ b/indra/newview/Korean.lproj/language.txt @@ -0,0 +1 @@ +ko
\ No newline at end of file diff --git a/indra/newview/installers/windows/lang_de.nsi b/indra/newview/installers/windows/lang_de.nsi new file mode 100644 index 0000000000..71d2138313 --- /dev/null +++ b/indra/newview/installers/windows/lang_de.nsi @@ -0,0 +1,57 @@ +; First is default
+LoadLanguageFile "${NSISDIR}\Contrib\Language files\German.nlf"
+
+; subtitle on license text caption (setup new version or update current one
+LangString LicenseSubTitleUpdate ${LANG_GERMAN} " Update"
+LangString LicenseSubTitleSetup ${LANG_GERMAN} " Setup"
+
+; description on license page
+LangString LicenseDescUpdate ${LANG_GERMAN} "Dieses Paket wird Second Life auf Version ${VERSION_LONG}.updaten"
+LangString LicenseDescSetup ${LANG_GERMAN} "Dieses Paket installiert Second Life auf Ihrem Computer."
+LangString LicenseDescNext ${LANG_GERMAN} "Nächster Schritt"
+
+; installation directory text
+LangString DirectoryChooseTitle ${LANG_GERMAN} "Installations Ordner"
+LangString DirectoryChooseUpdate ${LANG_GERMAN} "Wählen Sie den Second Life Ordner für dieses Update:"
+LangString DirectoryChooseSetup ${LANG_GERMAN} "Wählen Sie den Pfad, in den Sie Second Life installieren möchten:"
+
+; CheckStartupParams message box
+LangString CheckStartupParamsMB ${LANG_GERMAN} "Konnte Programm '$INSTPROG' nicht finden. Stilles Update fehlgeschlagen."
+
+; installation success dialog
+LangString InstSuccesssQuestion ${LANG_GERMAN} "Second Life jetzt starten?"
+
+; remove old NSIS version
+LangString RemoveOldNSISVersion ${LANG_GERMAN} "Überprüfe alte Version..."
+
+; check windows version
+LangString CheckWindowsVersionDP ${LANG_GERMAN} "Überprüfe Windows Version..."
+LangString CheckWindowsVersionMB ${LANG_GERMAN} 'Second Life unterstützt nur Windows XP, Windows 2000 und Mac OS X.$\n$\nDer Versuch es auf Windows $R0 zu installieren, könnte in unvorhersehbaren Abstürtzen und zu Datenverlust führen.$\n$\nTrotzdem installieren?'
+
+; checkifadministrator function (install)
+LangString CheckAdministratorInstDP ${LANG_GERMAN} "Überprüfe nach Genehmigung zur Installation..."
+LangString CheckAdministratorInstMB ${LANG_GERMAN} 'Es scheint so, als würden Sie einen "limited" Account verwenden.$\nSie müssen ein"administrator" sein, um Second Life installieren zu können..'
+
+; checkifadministrator function (uninstall)
+LangString CheckAdministratorUnInstDP ${LANG_GERMAN} "Überprüfe Genehmigung zum Deinstallieren..."
+LangString CheckAdministratorUnInstMB ${LANG_GERMAN} 'Es scheint so, als würden Sie einen "limited" Account verwenden.$\nSie müssen ein"administrator" sein, um Second Life installieren zu können..'
+
+; checkifalreadycurrent
+LangString CheckIfCurrentMB ${LANG_GERMAN} "Es scheint so, als hätten Sie Second Life ${VERSION_LONG} bereits installiert.$\n$\nWürden Sie es gerne erneut installieren?"
+
+; closesecondlife function (install)
+LangString CloseSecondLifeInstDP ${LANG_GERMAN} "Warte darauf, dass Second Life beendet wird..."
+LangString CloseSecondLifeInstMB ${LANG_GERMAN} "Second Life kann nicht installiert werden, wenn es bereits läuft.$\n$\nBeenden Sie, was Sie gerade tun und wählen Sie OK, um Second Life zu beenden oder Continue .$\nSelect CANCEL, um abzubrechen."
+
+; closesecondlife function (uninstall)
+LangString CloseSecondLifeUnInstDP ${LANG_GERMAN} "Warte darauf, dass Second Life beendet wird..."
+LangString CloseSecondLifeUnInstMB ${LANG_GERMAN} "Second Life kann nicht installiert werden, wenn es bereits läuft.$\n$\nBeenden Sie, was Sie gerade tun und wählen Sie OK, um Second Life zu beenden oder Continue .$\nSelect CANCEL, um abzubrechen."
+
+; removecachefiles
+LangString RemoveCacheFilesDP ${LANG_GERMAN} "Lösche alle Cache Files in Dokumente und Einstellungen"
+
+; delete program files
+LangString DeleteProgramFilesMB ${LANG_GERMAN} "Es bestehen weiterhin Dateien in Ihrem SecondLife Programm Ordner.$\n$\nDies sind möglicherweise Dateien, die sie modifiziert oder bewegt haben:$\n$INSTDIR$\n$\nMöchten Sie diese ebenfalls löschen?"
+
+; uninstall text
+LangString UninstallTextMsg ${LANG_GERMAN} "Dies wird Second Life ${VERSION_LONG} von Ihrem System entfernen."
\ No newline at end of file diff --git a/indra/newview/installers/windows/lang_en-us.nsi b/indra/newview/installers/windows/lang_en-us.nsi new file mode 100644 index 0000000000..c26af12a9c --- /dev/null +++ b/indra/newview/installers/windows/lang_en-us.nsi @@ -0,0 +1,57 @@ +; First is default
+LoadLanguageFile "${NSISDIR}\Contrib\Language files\English.nlf"
+
+; subtitle on license text caption
+LangString LicenseSubTitleUpdate ${LANG_ENGLISH} " Update"
+LangString LicenseSubTitleSetup ${LANG_ENGLISH} " Setup"
+
+; description on license page
+LangString LicenseDescUpdate ${LANG_ENGLISH} "This package will update Second Life to version ${VERSION_LONG}.(XXX)"
+LangString LicenseDescSetup ${LANG_ENGLISH} "This package will install Second Life on your computer."
+LangString LicenseDescNext ${LANG_ENGLISH} "Next"
+
+; installation directory text
+LangString DirectoryChooseTitle ${LANG_ENGLISH} "Installation Directory"
+LangString DirectoryChooseUpdate ${LANG_ENGLISH} "Select the Second Life directory to update:"
+LangString DirectoryChooseSetup ${LANG_ENGLISH} "Select the directory to install Second Life in:"
+
+; CheckStartupParams message box
+LangString CheckStartupParamsMB ${LANG_ENGLISH} "Could not find the program '$INSTPROG'. Silent update failed."
+
+; installation success dialog
+LangString InstSuccesssQuestion ${LANG_ENGLISH} "Start Second Life now?"
+
+; remove old NSIS version
+LangString RemoveOldNSISVersion ${LANG_ENGLISH} "Checking for old version..."
+
+; check windows version
+LangString CheckWindowsVersionDP ${LANG_ENGLISH} "Checking Windows version..."
+LangString CheckWindowsVersionMB ${LANG_ENGLISH} 'Second Life only supports Windows XP, Windows 2000, and Mac OS X.$\n$\nAttempting to install on Windows $R0 can result in crashes and data loss.$\n$\nInstall anyway?'
+
+; checkifadministrator function (install)
+LangString CheckAdministratorInstDP ${LANG_ENGLISH} "Checking for permission to install..."
+LangString CheckAdministratorInstMB ${LANG_ENGLISH} 'You appear to be using a "limited" account.$\nYou must be an "administrator" to install Second Life.'
+
+; checkifadministrator function (uninstall)
+LangString CheckAdministratorUnInstDP ${LANG_ENGLISH} "Checking for permission to uninstall..."
+LangString CheckAdministratorUnInstMB ${LANG_ENGLISH} 'You appear to be using a "limited" account.$\nYou must be an "administrator" to uninstall Second Life.'
+
+; checkifalreadycurrent
+LangString CheckIfCurrentMB ${LANG_ENGLISH} "It appears that Second Life ${VERSION_LONG} is already installed.$\n$\nWould you like to install it again?"
+
+; closesecondlife function (install)
+LangString CloseSecondLifeInstDP ${LANG_ENGLISH} "Waiting for Second Life to shut down..."
+LangString CloseSecondLifeInstMB ${LANG_ENGLISH} "Second Life can't be installed while it is already running.$\n$\nFinish what you're doing then select OK to close Second Life and continue.$\nSelect CANCEL to cancel installation."
+
+; closesecondlife function (uninstall)
+LangString CloseSecondLifeUnInstDP ${LANG_ENGLISH} "Waiting for Second Life to shut down..."
+LangString CloseSecondLifeUnInstMB ${LANG_ENGLISH} "Second Life can't be uninstalled while it is already running.$\n$\nFinish what you're doing then select OK to close Second Life and continue.$\nSelect CANCEL to cancel."
+
+; removecachefiles
+LangString RemoveCacheFilesDP ${LANG_ENGLISH} "Deleting cache files in Documents and Settings folder"
+
+; delete program files
+LangString DeleteProgramFilesMB ${LANG_ENGLISH} "There are still files in your SecondLife program directory.$\n$\nThese are possibly files you created or moved to:$\n$INSTDIR$\n$\nDo you want to remove them?"
+
+; uninstall text
+LangString UninstallTextMsg ${LANG_ENGLISH} "This will uninstall Second Life ${VERSION_LONG} from your system."
diff --git a/indra/newview/installers/windows/lang_ja.nsi b/indra/newview/installers/windows/lang_ja.nsi new file mode 100644 index 0000000000..43cb492780 --- /dev/null +++ b/indra/newview/installers/windows/lang_ja.nsi @@ -0,0 +1,57 @@ +; First is default
+LoadLanguageFile "${NSISDIR}\Contrib\Language files\Japanese.nlf"
+
+; subtitle on license text caption
+LangString LicenseSubTitleUpdate ${LANG_JAPANESE} " ƒAƒbƒvƒf[ƒg"
+LangString LicenseSubTitleSetup ${LANG_JAPANESE} " ƒZƒbƒgƒAƒbƒv"
+
+; description on license page
+LangString LicenseDescUpdate ${LANG_JAPANESE} "‚±‚̃pƒbƒP[ƒW‚̓ZƒJƒ“ƒhƒ‰ƒCƒt‚ðƒo[ƒWƒ‡ƒ“${VERSION_LONG}.‚ɃAƒbƒvƒf[ƒg‚µ‚Ü‚·B"
+LangString LicenseDescSetup ${LANG_JAPANESE} "‚±‚̃pƒbƒP[ƒW‚Í‚ ‚È‚½‚̃Rƒ“ƒsƒ…[ƒ^‚ɃZƒJƒ“ƒhƒ‰ƒCƒt‚ðƒCƒ“ƒXƒg[ƒ‹‚µ‚Ü‚·B"
+LangString LicenseDescNext ${LANG_JAPANESE} "ŽŸ"
+
+; installation directory text
+LangString DirectoryChooseTitle ${LANG_JAPANESE} "ƒCƒ“ƒXƒg[ƒ‹EƒfƒBƒŒƒNƒgƒŠ"
+LangString DirectoryChooseUpdate ${LANG_JAPANESE} "ƒAƒbƒvƒf[ƒg‚·‚éƒZƒJƒ“ƒhƒ‰ƒCƒt‚̃fƒBƒŒƒNƒgƒŠ‚ð‘I‘ð‚µ‚Ä‚‚¾‚³‚¢B:"
+LangString DirectoryChooseSetup ${LANG_JAPANESE} "ƒZƒJƒ“ƒhƒ‰ƒCƒt‚ðƒCƒ“ƒXƒg[ƒ‹‚·‚éƒfƒBƒŒƒNƒgƒŠ‚ð‘I‘ð‚µ‚Ä‚‚¾‚³‚¢B: "
+
+; CheckStartupParams message box
+LangString CheckStartupParamsMB ${LANG_JAPANESE} "ƒvƒƒOƒ‰ƒ€–¼'$INSTPROG'‚ªŒ©‚‚©‚è‚Ü‚¹‚ñBƒTƒCƒŒƒ“ƒgEƒAƒbƒvƒf[ƒg‚ÉŽ¸”s‚µ‚Ü‚µ‚½B"
+
+; installation success dialog
+LangString InstSuccesssQuestion ${LANG_JAPANESE} "’¼‚¿‚ɃZƒJƒ“ƒhƒ‰ƒCƒt‚ðŠJŽn‚µ‚Ü‚·‚©H "
+
+; remove old NSIS version
+LangString RemoveOldNSISVersion ${LANG_JAPANESE} "ŒÃ‚¢ƒo[ƒWƒ‡ƒ“î•ñ‚ðƒ`ƒFƒbƒN’†‚Å‚·c"
+
+; check windows version
+LangString CheckWindowsVersionDP ${LANG_JAPANESE} "ƒEƒBƒ“ƒhƒEƒY‚̃o[ƒWƒ‡ƒ“î•ñ‚ðƒ`ƒFƒbƒN’†‚Å‚·..."
+LangString CheckWindowsVersionMB ${LANG_JAPANESE} "ƒZƒJƒ“ƒhƒ‰ƒCƒt‚ÍWindows XPAWindows 2000AMac OS X‚Ì‚Ý‚ðƒTƒ|[ƒg‚µ‚Ä‚¢‚Ü‚·BWindows $R0‚ðƒCƒ“ƒXƒg[ƒ‹‚·‚鎖‚ÍAƒf[ƒ^‚ÌÁŽ¸‚âƒNƒ‰ƒbƒVƒ…‚ÌŒ´ˆö‚É‚È‚é‰Â”\«‚ª‚ ‚è‚Ü‚·BƒCƒ“ƒXƒg[ƒ‹‚𑱂¯‚Ü‚·‚©H"
+
+; checkifadministrator function (install)
+LangString CheckAdministratorInstDP ${LANG_JAPANESE} "ƒCƒ“ƒXƒg[ƒ‹‚Ì‚½‚ß‚ÌŒ ŒÀ‚ðƒ`ƒFƒbƒN’†‚Å‚·..."
+LangString CheckAdministratorInstMB ${LANG_JAPANESE} "ƒZƒJƒ“ƒhƒ‰ƒCƒt‚ðƒCƒ“ƒXƒg[ƒ‹‚·‚é‚É‚ÍŠÇ—ŽÒŒ ŒÀ‚ª•K—v‚Å‚·B"
+
+; checkifadministrator function (uninstall)
+LangString CheckAdministratorUnInstDP ${LANG_JAPANESE} "ƒAƒ“ƒCƒ“ƒXƒg[ƒ‹‚Ì‚½‚ß‚ÌŒ ŒÀ‚ðƒ`ƒFƒbƒN’†‚Å‚·..."
+LangString CheckAdministratorUnInstMB ${LANG_JAPANESE} "ƒZƒJƒ“ƒhƒ‰ƒCƒt‚ðƒAƒ“ƒCƒ“ƒXƒg[ƒ‹‚·‚é‚É‚ÍŠÇ—ŽÒŒ ŒÀ‚ª•K—v‚Å‚·B"
+
+; checkifalreadycurrent
+LangString CheckIfCurrentMB ${LANG_JAPANESE} "ƒZƒJƒ“ƒhƒ‰ƒCƒt${VERSION_LONG} ‚̓Cƒ“ƒXƒg[ƒ‹Ï‚Ý‚Å‚·BÄ“xƒCƒ“ƒXƒg[ƒ‹‚µ‚Ü‚·‚©H "
+
+; closesecondlife function (install)
+LangString CloseSecondLifeInstDP ${LANG_JAPANESE} "ƒZƒJƒ“ƒhƒ‰ƒCƒt‚ðI—¹’†‚Å‚·..."
+LangString CloseSecondLifeInstMB ${LANG_JAPANESE} "ƒZƒJƒ“ƒhƒ‰ƒCƒt‚Ì‹N“®’†‚ɃCƒ“ƒXƒg[ƒ‹‚Ío—ˆ‚Ü‚¹‚ñB’¼‚¿‚ɃZƒJƒ“ƒhƒ‰ƒCƒt‚ðI—¹‚µ‚ăCƒ“ƒXƒg[ƒ‹‚ðŠJŽn‚·‚éꇂÍOKƒ{ƒ^ƒ“‚ð‰Ÿ‚µ‚Ä‚‚¾‚³‚¢BCANCEL‚ð‰Ÿ‚·‚Æ’†Ž~‚µ‚Ü‚·B"
+
+; closesecondlife function (uninstall)
+LangString CloseSecondLifeUnInstDP ${LANG_JAPANESE} "ƒZƒJƒ“ƒhƒ‰ƒCƒt‚ðI—¹’†‚Å‚·..."
+LangString CloseSecondLifeUnInstMB ${LANG_JAPANESE} "ƒZƒJƒ“ƒhƒ‰ƒCƒt‚Ì‹N“®’†‚ɃAƒ“ƒCƒ“ƒXƒg[ƒ‹‚Ío—ˆ‚Ü‚¹‚ñB’¼‚¿‚ɃZƒJƒ“ƒhƒ‰ƒCƒt‚ðI—¹‚µ‚ăAƒ“ƒCƒ“ƒXƒg[ƒ‹‚ðŠJŽn‚·‚éꇂÍOKƒ{ƒ^ƒ“‚ð‰Ÿ‚µ‚Ä‚‚¾‚³‚¢BCANCEL‚ð‰Ÿ‚·‚Æ’†Ž~‚µ‚Ü‚·B"
+
+; removecachefiles
+LangString RemoveCacheFilesDP ${LANG_JAPANESE} " Documents and Settings ƒtƒHƒ‹ƒ_‚̃LƒƒƒbƒVƒ…ƒtƒ@ƒCƒ‹‚ðƒfƒŠ[ƒg’†‚Å‚·B"
+
+; delete program files
+LangString DeleteProgramFilesMB ${LANG_JAPANESE} "ƒZƒJƒ“ƒhƒ‰ƒCƒt‚̃fƒBƒŒƒNƒgƒŠ‚É‚ÍA‚Ü‚¾ƒtƒ@ƒCƒ‹‚ªŽc‚³‚ê‚Ä‚¢‚Ü‚·B$\n$INSTDIR$\n‚É‚ ‚È‚½‚ªì¬A‚Ü‚½‚͈ړ®‚³‚¹‚½ƒtƒ@ƒCƒ‹‚ª‚ ‚é‰Â”\«‚ª‚ ‚è‚Ü‚·B‘S‚Ä휂µ‚Ü‚·‚©H "
+
+; uninstall text
+LangString UninstallTextMsg ${LANG_JAPANESE} "ƒZƒJƒ“ƒhƒ‰ƒCƒt${VERSION_LONG}‚ðƒAƒ“ƒCƒ“ƒXƒg[ƒ‹‚µ‚Ü‚·B"
diff --git a/indra/newview/installers/windows/lang_ko.nsi b/indra/newview/installers/windows/lang_ko.nsi new file mode 100644 index 0000000000..4e6b5ec0cd --- /dev/null +++ b/indra/newview/installers/windows/lang_ko.nsi @@ -0,0 +1,57 @@ +; First is default
+LoadLanguageFile "${NSISDIR}\Contrib\Language files\Korean.nlf"
+
+; subtitle on license text caption
+LangString LicenseSubTitleUpdate ${LANG_KOREAN} "¾÷µ¥ÀÌÆ®"
+LangString LicenseSubTitleSetup ${LANG_KOREAN} " ¼³Ä¡Çϱâ"
+
+; description on license page
+LangString LicenseDescUpdate ${LANG_KOREAN} "ÀÌ ÆÑÅ°Áö´Â ¼¼ÄÁµå¶óÀÌÇÁ¸¦ ¹öÀü${VERSION_LONG}.À¸·Î ¾÷µ¥ÀÌÆ® ÇÕ´Ï´Ù. "
+LangString LicenseDescSetup ${LANG_KOREAN} "ÀÌ ÆÑÅ°Áö´Â ¼¼ÄÁµå¶óÀÌÇÁ¸¦ ÄÄÇ»ÅÍ¿¡ ¼³Ä¡ÇÕ´Ï´Ù."
+LangString LicenseDescNext ${LANG_KOREAN} "´ÙÀ½"
+
+; installation directory text
+LangString DirectoryChooseTitle ${LANG_KOREAN} "¼³Ä¡ µð·ºÅ丮"
+LangString DirectoryChooseUpdate ${LANG_KOREAN} "¼¼ÄÁµå¶óÀÌÇÁ¸¦ ¾÷µ¥ÀÌÆ®ÇÒ µð·ºÅ丮¸¦ ¼±ÅÃÇϼ¼¿ä. "
+LangString DirectoryChooseSetup ${LANG_KOREAN} "¼¼ÄÁµå¶óÀÌÇÁ¸¦ ¼³Ä¡ÇÒ µð·ºÅ丮¸¦ ¼±ÅÃÇϼ¼¿ä:"
+
+; CheckStartupParams message box
+LangString CheckStartupParamsMB ${LANG_KOREAN} " ¡®$INSTPROG¡¯ ÇÁ·Î±×·¥À» ãÁö ¸øÇß½À´Ï´Ù. ÀÚµ¿ ¾÷µ¥ÀÌÆ®¿¡ ½ÇÆÐÇß½À´Ï´Ù."
+
+; installation success dialog
+LangString InstSuccesssQuestion ${LANG_KOREAN} "¼¼ÄÁµå¶óÀÌÇÁ¸¦ ½ÃÀÛÇÏ°Ú½À´Ï±î?"
+
+; remove old NSIS version
+LangString RemoveOldNSISVersion ${LANG_KOREAN} "ÀÌÀü ¹öÀüÀ» ã°í ÀÖ½À´Ï´Ù¡¦ "
+
+; check windows version
+LangString CheckWindowsVersionDP ${LANG_KOREAN} "À©µµ¿ì ¹öÀüÀ» È®ÀÎÇÏ°í ÀÖ½À´Ï´Ù."
+LangString CheckWindowsVersionMB ${LANG_KOREAN} "¼¼ÄÁµå¶óÀÌÇÁ´Â À©µµ¿ì XP, À©µµ¿ì 2000, ±×¸®°í ¸Æ OS X¸¦ Áö¿øÇÕ´Ï´Ù. À©µµ¿ì $R0¿¡ ¼³Ä¡¸¦ ½ÃµµÇÏ¸é ¿ÀÀÛµ¿°ú µ¥ÀÌÅÍ ºÐ½ÇÀÌ ÀϾ ¼ö ÀÖ½À´Ï´Ù. °è¼Ó ¼³Ä¡ÇÏ°Ú½À´Ï±î? "
+
+; checkifadministrator function (install)
+LangString CheckAdministratorInstDP ${LANG_KOREAN} "¼³Ä¡ ±ÇÇÑÀ» È®ÀÎ ÁßÀÔ´Ï´Ù... "
+LangString CheckAdministratorInstMB ${LANG_KOREAN} "ÇöÀç ¡®¼Õ´Ô¡¯°èÁ¤À» »ç¿ë ÁßÀÔ´Ï´Ù. ¼¼ÄÁµå¶óÀÌÇÁ¸¦ ¼³Ä¡Çϱâ À§Çؼ± ¡®¿î¿µÀÚ¡± °èÁ¤À» »ç¿ëÇØ¾ß ÇÕ´Ï´Ù."
+
+; checkifadministrator function (uninstall)
+LangString CheckAdministratorUnInstDP ${LANG_KOREAN} "Á¦°Å ±ÇÇÑÀ» È®ÀÎ ÁßÀÔ´Ï´Ù. "
+LangString CheckAdministratorUnInstMB ${LANG_KOREAN} " ÇöÀç ¡®¼Õ´Ô¡¯°èÁ¤À» »ç¿ë ÁßÀÔ´Ï´Ù. ¼¼ÄÁµå¶óÀÌÇÁ¸¦ Á¦°ÅÇϱâ À§Çؼ± ¡®¿î¿µÀÚ¡± °èÁ¤À» »ç¿ëÇØ¾ß ÇÕ´Ï´Ù. "
+
+; checkifalreadycurrent
+LangString CheckIfCurrentMB ${LANG_KOREAN} "¼¼ÄÁµå¶óÀÌÇÁ ¹öÀü ${VERSION_LONG}ÀÌ ÀÌ¹Ì ¼³Ä¡µÇ¾î ÀÖ½À´Ï´Ù. ´Ù½Ã ¼³Ä¡ÇϽðڽÀ´Ï±î? "
+
+; closesecondlife function (install)
+LangString CloseSecondLifeInstDP ${LANG_KOREAN} "¼¼ÄÁµå¶óÀÌÇÁ¸¦ Á¾·áÇÒ ¶§ ±îÁö ´ë±â Áß¡¦ "
+LangString CloseSecondLifeInstMB ${LANG_KOREAN} "¼¼ÄÁµå¶óÀÌÇÁ°¡ ÀÌ¹Ì ÀÛµ¿ ÁßÀÏ °æ¿ì ¼³Ä¡¸¦ °è¼Ó ÇÒ ¼ö ¾ø½À´Ï´Ù. ÇöÀç ÀÛ¾÷À» ¸ØÃß°í ¡®È®ÀΡ¯À» ´·¯ ¼¼ÄÁµå¶óÀÌÇÁ¸¦ Á¾·áÇÑ ´ÙÀ½ ÁøÇàÇϱ⠹ٶø´Ï´Ù. ¼³Ä¡¸¦ Ãë¼ÒÇÏ·Á¸é ¡®Ãë¼Ò¡¯¸¦ ´©¸£¼¼¿ä."
+
+; closesecondlife function (uninstall)
+LangString CloseSecondLifeUnInstDP ${LANG_KOREAN} "¼¼ÄÁµå¶óÀÌÇÁ¸¦ Á¾·áÇÒ ¶§ ±îÁö ´ë±â Áß¡¦¡±"
+LangString CloseSecondLifeUnInstMB ${LANG_KOREAN} " ¼¼ÄÁµå¶óÀÌÇÁ°¡ ÀÌ¹Ì ÀÛµ¿ ÁßÀÏ °æ¿ì Á¦°Å¸¦ °è¼Ó ÇÒ ¼ö ¾ø½À´Ï´Ù. ÇöÀç ÀÛ¾÷À» ¸ØÃß°í ¡®È®ÀΡ¯À» ´·¯ ¼¼ÄÁµå¶óÀÌÇÁ¸¦ Á¾·áÇÑ ´ÙÀ½ ÁøÇàÇϱ⠹ٶø´Ï´Ù. ¼³Ä¡¸¦ ÃëÇÏ·Á¸é ¡®Ãë¼Ò¡¯¸¦ ´©¸£¼¼¿ä. "
+
+; removecachefiles
+LangString RemoveCacheFilesDP ${LANG_KOREAN} " Documents and Settings Æú´õ ³»ÀÇ Ä³½Ã ÆÄÀϵéÀ» Áö¿ó´Ï´Ù."
+
+; delete program files
+LangString DeleteProgramFilesMB ${LANG_KOREAN} "¼¼ÄÁµå¶óÀÌÇÁ ÇÁ·Î±×·¥ µð·ºÅ丮¿¡ ¾ÆÁ÷ ÆÄÀϵéÀÌ ³²¾Æ ÀÖ½À´Ï´Ù. ÀÌ ÆÄÀϵéÀº »ç¿ëÀÚ°¡ ¸¸µç °ÍµéÀ̰ųª$\n$INSTDIR$\n$\n·Î À̵¿ÇÑ ÆÄÀϵéÀÏ ¼ö ÀÖ½À´Ï´Ù. ÀÌ ÆÄÀϵéÀ» Á¦°ÅÇÏ°Ú½À´Ï±î?"
+
+; uninstall text
+LangString UninstallTextMsg ${LANG_KOREAN} "¼¼ÄÁµå¶óÀÌÇÁ${VERSION_LONG}À» ½Ã½ºÅÛ¿¡¼ Á¦°ÅÇÕ´Ï´Ù."
diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index c0ad9ffb03..15ab9bac1d 100644 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -309,9 +309,6 @@ LLAgent::LLAgent() mbJump(FALSE), - mWanderTimer(), - mWanderTargetGlobal( LLVector3d::zero ), - mAutoPilot(FALSE), mAutoPilotFlyOnStop(FALSE), mAutoPilotTargetGlobal(), @@ -2097,36 +2094,6 @@ BOOL LLAgent::getBusy() const //----------------------------------------------------------------------------- -// updateWanderTarget() -//----------------------------------------------------------------------------- -void LLAgent::updateWanderTarget() -{ - S32 num_regions; - LLViewerRegion* rand_region; - F32 rand_x; - F32 rand_y; - - if (mWanderTimer.checkExpirationAndReset(ll_frand(MAX_WANDER_TIME))) - { - // Pick a random spot to wander towards - num_regions = gWorldPointer->mActiveRegionList.getLength(); - S32 region_num = llround(ll_frand() * num_regions); - rand_region = gWorldPointer->mActiveRegionList.getFirstData(); - S32 i = 0; - while (i < region_num) - { - rand_region = gWorldPointer->mActiveRegionList.getNextData(); - i++; - } - rand_x = ll_frand(rand_region->getWidth()); - rand_y = ll_frand(rand_region->getWidth()); - - stopAutoPilot(); - startAutoPilotGlobal(rand_region->getPosGlobalFromRegion(LLVector3(rand_x, rand_y, 0.f))); - } -} - -//----------------------------------------------------------------------------- // startAutoPilotGlobal() //----------------------------------------------------------------------------- void LLAgent::startAutoPilotGlobal(const LLVector3d &target_global, const std::string& behavior_name, const LLQuaternion *target_rotation, void (*finish_callback)(BOOL, void *), void *callback_data, F32 stop_distance, F32 rot_threshold) @@ -4043,10 +4010,6 @@ void LLAgent::changeCameraToFollow(BOOL animate) mbFlagsDirty = TRUE; } - //RN: this doesn't seem to be necessary and destroys the UE for script-driven cameras - //gViewerWindow->setKeyboardFocus( NULL, NULL ); - //gViewerWindow->setMouseCapture( NULL, NULL ); - if (animate) { startCameraAnimation(); @@ -4110,9 +4073,6 @@ void LLAgent::changeCameraToThirdPerson(BOOL animate) mbFlagsDirty = TRUE; } - //RN: this doesn't seem to be necessary and destroys the UE for script-driven cameras - //gViewerWindow->setKeyboardFocus( NULL, NULL ); - //gViewerWindow->setMouseCapture( NULL, NULL ); } // Remove any pitch from the avatar @@ -4185,7 +4145,7 @@ void LLAgent::changeCameraToCustomizeAvatar(BOOL animate) } gViewerWindow->setKeyboardFocus( NULL, NULL ); - gViewerWindow->setMouseCapture( NULL, NULL ); + gViewerWindow->setMouseCapture( NULL ); LLVOAvatar::onCustomizeStart(); } diff --git a/indra/newview/llagent.h b/indra/newview/llagent.h index b86dc03807..d0bda5d46a 100644 --- a/indra/newview/llagent.h +++ b/indra/newview/llagent.h @@ -398,8 +398,6 @@ public: void propagate(const F32 dt); // BUG: should roll into updateAgentPosition - void updateWanderTarget(); // drones will pick points in the world to autopilot towards - void startAutoPilotGlobal(const LLVector3d &pos_global, const std::string& behavior_name = "", const LLQuaternion *target_rotation = NULL, void (*finish_callback)(BOOL, void *) = NULL, void *callback_data = NULL, F32 stop_distance = 0.f, F32 rotation_threshold = 0.03f); @@ -771,9 +769,6 @@ private: BOOL mbJump; - LLFrameTimer mWanderTimer; - LLVector3d mWanderTargetGlobal; - BOOL mAutoPilot; BOOL mAutoPilotFlyOnStop; LLVector3d mAutoPilotTargetGlobal; diff --git a/indra/newview/llassetuploadresponders.cpp b/indra/newview/llassetuploadresponders.cpp index 7c615dd159..821bb2a69f 100644 --- a/indra/newview/llassetuploadresponders.cpp +++ b/indra/newview/llassetuploadresponders.cpp @@ -79,7 +79,7 @@ void LLAssetUploadResponder::error(U32 statusNum, const std::string& reason) default: args["[FILE]"] = (mFileName.empty() ? mVFileID.asString() : mFileName); args["[REASON]"] = "The server is experiencing unexpected " - "difficulties. Please try again later."; + "difficulties."; gViewerWindow->alertXml("CannotUploadReason", args); break; } diff --git a/indra/newview/llchatbar.cpp b/indra/newview/llchatbar.cpp index 19b6d80082..ddf0b83e73 100644 --- a/indra/newview/llchatbar.cpp +++ b/indra/newview/llchatbar.cpp @@ -583,7 +583,7 @@ void LLChatBar::onInputEditorKeystroke( LLLineEditor* caller, void* userdata ) } // static -void LLChatBar::onInputEditorFocusLost( LLLineEditor* caller, void* userdata) +void LLChatBar::onInputEditorFocusLost( LLUICtrl* caller, void* userdata) { // stop typing animation gAgent.stopTyping(); diff --git a/indra/newview/llchatbar.h b/indra/newview/llchatbar.h index e0f31ae124..65724a1f45 100644 --- a/indra/newview/llchatbar.h +++ b/indra/newview/llchatbar.h @@ -67,7 +67,7 @@ public: static void onTabClick( void* userdata ); static void onInputEditorKeystroke(LLLineEditor* caller, void* userdata); - static void onInputEditorFocusLost(LLLineEditor* caller,void* userdata); + static void onInputEditorFocusLost(LLUICtrl* caller,void* userdata); static void onInputEditorGainFocus(LLUICtrl* caller,void* userdata); static void onCommitGesture(LLUICtrl* ctrl, void* data); diff --git a/indra/newview/llcolorswatch.cpp b/indra/newview/llcolorswatch.cpp index 4dade7f683..13e7fef4ec 100644 --- a/indra/newview/llcolorswatch.cpp +++ b/indra/newview/llcolorswatch.cpp @@ -148,7 +148,7 @@ BOOL LLColorSwatchCtrl::handleMouseDown(S32 x, S32 y, MASK mask) { // Route future Mouse messages here preemptively. (Release on mouse up.) // No handler is needed for capture lost since this object has no state that depends on it. - gViewerWindow->setMouseCapture( this, NULL ); + gViewerWindow->setMouseCapture( this ); return TRUE; } @@ -157,10 +157,10 @@ BOOL LLColorSwatchCtrl::handleMouseDown(S32 x, S32 y, MASK mask) BOOL LLColorSwatchCtrl::handleMouseUp(S32 x, S32 y, MASK mask) { // We only handle the click if the click both started and ended within us - if( gViewerWindow->hasMouseCapture( this ) ) + if( hasMouseCapture() ) { // Release the mouse - gViewerWindow->setMouseCapture( NULL, NULL ); + gViewerWindow->setMouseCapture( NULL ); // If mouseup in the widget, it's been clicked if ( pointInView(x, y) ) diff --git a/indra/newview/lldrawable.cpp b/indra/newview/lldrawable.cpp index 3418007d41..77bbc1ca81 100644 --- a/indra/newview/lldrawable.cpp +++ b/indra/newview/lldrawable.cpp @@ -254,7 +254,8 @@ LLFace* LLDrawable::addFace(LLFacePool *poolp, LLViewerImage *texturep) LLMemType mt(LLMemType::MTYPE_DRAWABLE); LLFace *face = new LLFace(this, mVObjp); - + if (!face) llerrs << "Allocating new Face: " << mFaces.size() << llendl; + if (face) { mFaces.push_back(face); diff --git a/indra/newview/lldrawpoolalpha.cpp b/indra/newview/lldrawpoolalpha.cpp index 93af956466..de82dff95d 100644 --- a/indra/newview/lldrawpoolalpha.cpp +++ b/indra/newview/lldrawpoolalpha.cpp @@ -26,6 +26,7 @@ #include "llviewerwindow.h" #include "pipeline.h" #include "llviewerregion.h" +#include "llglslshader.h" BOOL LLDrawPoolAlpha::sShowDebugAlpha = FALSE; @@ -47,7 +48,7 @@ LLDrawPoolAlpha::~LLDrawPoolAlpha() void LLDrawPoolAlpha::prerender() { - mVertexShaderLevel = gPipeline.getVertexShaderLevel(LLPipeline::SHADER_OBJECT); + mVertexShaderLevel = LLShaderMgr::getVertexShaderLevel(LLShaderMgr::SHADER_OBJECT); } void LLDrawPoolAlpha::beginRenderPass(S32 pass) diff --git a/indra/newview/lldrawpoolavatar.cpp b/indra/newview/lldrawpoolavatar.cpp index 9b9825deff..a0cc189c46 100644 --- a/indra/newview/lldrawpoolavatar.cpp +++ b/indra/newview/lldrawpoolavatar.cpp @@ -21,6 +21,7 @@ #include "llviewerregion.h" #include "noise.h" #include "pipeline.h" +#include "llglslshader.h" static U32 sDataMask = LLDrawPoolAvatar::VERTEX_DATA_MASK; static U32 sBufferUsage = GL_STREAM_DRAW_ARB; @@ -82,12 +83,12 @@ static LLMatrix4 sModelViewMatrix = LLMatrix4(); S32 LLDrawPoolAvatar::getVertexShaderLevel() const { - return (S32) gPipeline.getVertexShaderLevel(LLPipeline::SHADER_AVATAR); + return (S32) LLShaderMgr::getVertexShaderLevel(LLShaderMgr::SHADER_AVATAR); } void LLDrawPoolAvatar::prerender() { - mVertexShaderLevel = gPipeline.getVertexShaderLevel(LLPipeline::SHADER_AVATAR); + mVertexShaderLevel = LLShaderMgr::getVertexShaderLevel(LLShaderMgr::SHADER_AVATAR); sShaderLevel = mVertexShaderLevel; if (sShaderLevel > 0) @@ -171,15 +172,15 @@ void LLDrawPoolAvatar::endFootShadow() void LLDrawPoolAvatar::beginRigid() { - sVertexProgram = &gPipeline.mAvatarEyeballProgram; + sVertexProgram = &gAvatarEyeballProgram; glEnableClientState(GL_NORMAL_ARRAY); glEnableClientState(GL_TEXTURE_COORD_ARRAY); if (sShaderLevel > 0) { //eyeballs render with the specular shader - gPipeline.mAvatarEyeballProgram.bind(); - gPipeline.mMaterialIndex = gPipeline.mAvatarEyeballProgram.mAttribute[LLPipeline::GLSL_MATERIAL_COLOR]; - gPipeline.mSpecularIndex = gPipeline.mAvatarEyeballProgram.mAttribute[LLPipeline::GLSL_SPECULAR_COLOR]; + gAvatarEyeballProgram.bind(); + gMaterialIndex = gAvatarEyeballProgram.mAttribute[LLShaderMgr::MATERIAL_COLOR]; + gSpecularIndex = gAvatarEyeballProgram.mAttribute[LLShaderMgr::SPECULAR_COLOR]; } } @@ -194,7 +195,7 @@ void LLDrawPoolAvatar::beginSkinned() glEnableClientState(GL_NORMAL_ARRAY); glEnableClientState(GL_TEXTURE_COORD_ARRAY); - sVertexProgram = &gPipeline.mAvatarProgram; + sVertexProgram = &gAvatarProgram; if (sShaderLevel > 0) // for hardware blending { @@ -202,22 +203,22 @@ void LLDrawPoolAvatar::beginSkinned() glClientActiveTextureARB(GL_TEXTURE1_ARB); if (sShaderLevel >= SHADER_LEVEL_BUMP) { - gPipeline.mMaterialIndex = sVertexProgram->mAttribute[LLPipeline::GLSL_MATERIAL_COLOR]; - gPipeline.mSpecularIndex = sVertexProgram->mAttribute[LLPipeline::GLSL_SPECULAR_COLOR]; + gMaterialIndex = sVertexProgram->mAttribute[LLShaderMgr::MATERIAL_COLOR]; + gSpecularIndex = sVertexProgram->mAttribute[LLShaderMgr::SPECULAR_COLOR]; } sVertexProgram->bind(); if (sShaderLevel >= SHADER_LEVEL_CLOTH) { - enable_cloth_weights(sVertexProgram->mAttribute[LLPipeline::GLSL_AVATAR_CLOTHING]); + enable_cloth_weights(sVertexProgram->mAttribute[LLShaderMgr::AVATAR_CLOTHING]); } - enable_vertex_weighting(sVertexProgram->mAttribute[LLPipeline::GLSL_AVATAR_WEIGHT]); + enable_vertex_weighting(sVertexProgram->mAttribute[LLShaderMgr::AVATAR_WEIGHT]); if (sShaderLevel >= SHADER_LEVEL_BUMP) { - enable_binormals(sVertexProgram->mAttribute[LLPipeline::GLSL_BINORMAL]); + enable_binormals(sVertexProgram->mAttribute[LLShaderMgr::BINORMAL]); } - sVertexProgram->enableTexture(LLPipeline::GLSL_BUMP_MAP); + sVertexProgram->enableTexture(LLShaderMgr::BUMP_MAP); glActiveTextureARB(GL_TEXTURE0_ARB); } } @@ -228,17 +229,17 @@ void LLDrawPoolAvatar::endSkinned() if (sShaderLevel > 0) { sRenderingSkinned = FALSE; - sVertexProgram->disableTexture(LLPipeline::GLSL_BUMP_MAP); + sVertexProgram->disableTexture(LLShaderMgr::BUMP_MAP); glActiveTextureARB(GL_TEXTURE0_ARB); glClientActiveTextureARB(GL_TEXTURE0_ARB); - disable_vertex_weighting(sVertexProgram->mAttribute[LLPipeline::GLSL_AVATAR_WEIGHT]); + disable_vertex_weighting(sVertexProgram->mAttribute[LLShaderMgr::AVATAR_WEIGHT]); if (sShaderLevel >= SHADER_LEVEL_BUMP) { - disable_binormals(sVertexProgram->mAttribute[LLPipeline::GLSL_BINORMAL]); + disable_binormals(sVertexProgram->mAttribute[LLShaderMgr::BINORMAL]); } if ((sShaderLevel >= SHADER_LEVEL_CLOTH)) { - disable_cloth_weights(sVertexProgram->mAttribute[LLPipeline::GLSL_AVATAR_CLOTHING]); + disable_cloth_weights(sVertexProgram->mAttribute[LLShaderMgr::AVATAR_CLOTHING]); } sVertexProgram->unbind(); @@ -354,7 +355,7 @@ void LLDrawPoolAvatar::renderAvatars(LLVOAvatar* single_avatar, S32 pass) if (sShaderLevel > 0) { - gPipeline.mAvatarMatrixParam = sVertexProgram->mUniform[LLPipeline::GLSL_AVATAR_MATRIX]; + gAvatarMatrixParam = sVertexProgram->mUniform[LLShaderMgr::AVATAR_MATRIX]; } if ((sShaderLevel >= SHADER_LEVEL_CLOTH)) @@ -370,16 +371,16 @@ void LLDrawPoolAvatar::renderAvatars(LLVOAvatar* single_avatar, S32 pass) wind = wind * rot_mat; wind.mV[VW] = avatarp->mWindVec.mV[VW]; - sVertexProgram->vertexAttrib4fv(LLPipeline::GLSL_AVATAR_WIND, wind.mV); + sVertexProgram->vertexAttrib4fv(LLShaderMgr::AVATAR_WIND, wind.mV); F32 phase = -1.f * (avatarp->mRipplePhase); F32 freq = 7.f + (noise1(avatarp->mRipplePhase) * 2.f); LLVector4 sin_params(freq, freq, freq, phase); - sVertexProgram->vertexAttrib4fv(LLPipeline::GLSL_AVATAR_SINWAVE, sin_params.mV); + sVertexProgram->vertexAttrib4fv(LLShaderMgr::AVATAR_SINWAVE, sin_params.mV); LLVector4 gravity(0.f, 0.f, -CLOTHING_GRAVITY_EFFECT, 0.f); gravity = gravity * rot_mat; - sVertexProgram->vertexAttrib4fv(LLPipeline::GLSL_AVATAR_GRAVITY, gravity.mV); + sVertexProgram->vertexAttrib4fv(LLShaderMgr::AVATAR_GRAVITY, gravity.mV); } if( !single_avatar || (avatarp == single_avatar) ) @@ -507,10 +508,10 @@ void LLDrawPoolAvatar::renderForSelect() glEnableClientState(GL_NORMAL_ARRAY); glEnableClientState(GL_TEXTURE_COORD_ARRAY); glGetFloatv(GL_MODELVIEW_MATRIX, (F32*) sModelViewMatrix.mMatrix); - sVertexProgram = &gPipeline.mAvatarPickProgram; + sVertexProgram = &gAvatarPickProgram; if (sShaderLevel > 0) { - gPipeline.mAvatarMatrixParam = sVertexProgram->mUniform[LLPipeline::GLSL_AVATAR_MATRIX]; + gAvatarMatrixParam = sVertexProgram->mUniform[LLShaderMgr::AVATAR_MATRIX]; } glAlphaFunc(GL_GEQUAL, 0.2f); glBlendFunc(GL_ONE, GL_ZERO); @@ -527,7 +528,7 @@ void LLDrawPoolAvatar::renderForSelect() glClientActiveTextureARB(GL_TEXTURE0_ARB); sRenderingSkinned = TRUE; sVertexProgram->bind(); - enable_vertex_weighting(sVertexProgram->mAttribute[LLPipeline::GLSL_AVATAR_WEIGHT]); + enable_vertex_weighting(sVertexProgram->mAttribute[LLShaderMgr::AVATAR_WEIGHT]); } mIndicesDrawn += avatarp->renderSkinned(AVATAR_RENDER_PASS_SINGLE); @@ -537,7 +538,7 @@ void LLDrawPoolAvatar::renderForSelect() { sRenderingSkinned = FALSE; sVertexProgram->unbind(); - disable_vertex_weighting(sVertexProgram->mAttribute[LLPipeline::GLSL_AVATAR_WEIGHT]); + disable_vertex_weighting(sVertexProgram->mAttribute[LLShaderMgr::AVATAR_WEIGHT]); } glAlphaFunc(GL_GREATER, 0.01f); @@ -577,7 +578,7 @@ LLColor3 LLDrawPoolAvatar::getDebugColor() const LLVertexBufferAvatar::LLVertexBufferAvatar() : LLVertexBuffer(sDataMask, - gPipeline.getVertexShaderLevel(LLPipeline::SHADER_AVATAR) > 0 ? + LLShaderMgr::getVertexShaderLevel(LLShaderMgr::SHADER_AVATAR) > 0 ? GL_STATIC_DRAW_ARB : GL_STREAM_DRAW_ARB) { @@ -599,16 +600,16 @@ void LLVertexBufferAvatar::setupVertexBuffer(U32 data_mask) const glClientActiveTextureARB(GL_TEXTURE0_ARB); glTexCoordPointer(2,GL_FLOAT, mStride, (void*)(base + mOffsets[TYPE_TEXCOORD])); - set_vertex_weights(sVertexProgram->mAttribute[LLPipeline::GLSL_AVATAR_WEIGHT], mStride, (F32*)(base + mOffsets[TYPE_WEIGHT])); + set_vertex_weights(sVertexProgram->mAttribute[LLShaderMgr::AVATAR_WEIGHT], mStride, (F32*)(base + mOffsets[TYPE_WEIGHT])); if (sShaderLevel >= LLDrawPoolAvatar::SHADER_LEVEL_BUMP) { - set_binormals(sVertexProgram->mAttribute[LLPipeline::GLSL_BINORMAL], mStride, (LLVector3*)(base + mOffsets[TYPE_BINORMAL])); + set_binormals(sVertexProgram->mAttribute[LLShaderMgr::BINORMAL], mStride, (LLVector3*)(base + mOffsets[TYPE_BINORMAL])); } if (sShaderLevel >= LLDrawPoolAvatar::SHADER_LEVEL_CLOTH) { - set_vertex_clothing_weights(sVertexProgram->mAttribute[LLPipeline::GLSL_AVATAR_CLOTHING], mStride, (LLVector4*)(base + mOffsets[TYPE_CLOTHWEIGHT])); + set_vertex_clothing_weights(sVertexProgram->mAttribute[LLShaderMgr::AVATAR_CLOTHING], mStride, (LLVector4*)(base + mOffsets[TYPE_CLOTHWEIGHT])); } } else diff --git a/indra/newview/lldrawpoolbump.cpp b/indra/newview/lldrawpoolbump.cpp index 377dbea2d0..f0f7130e0b 100644 --- a/indra/newview/lldrawpoolbump.cpp +++ b/indra/newview/lldrawpoolbump.cpp @@ -27,7 +27,7 @@ #include "llviewercamera.h" #include "llviewerimagelist.h" #include "pipeline.h" - +#include "llglslshader.h" //#include "llimagebmp.h" //#include "../tools/imdebug/imdebug.h" @@ -141,7 +141,7 @@ LLDrawPoolBump::LLDrawPoolBump() void LLDrawPoolBump::prerender() { - mVertexShaderLevel = gPipeline.getVertexShaderLevel(LLPipeline::SHADER_OBJECT); + mVertexShaderLevel = LLShaderMgr::getVertexShaderLevel(LLShaderMgr::SHADER_OBJECT); } // static @@ -234,14 +234,14 @@ void LLDrawPoolBump::beginShiny() cube_map->setMatrix(0); cube_map->bind(); - if (gPipeline.getVertexShaderLevel(LLPipeline::SHADER_OBJECT) > 0) + if (LLShaderMgr::getVertexShaderLevel(LLShaderMgr::SHADER_OBJECT) > 0) { LLMatrix4 mat; glGetFloatv(GL_MODELVIEW_MATRIX, (F32*) mat.mMatrix); - gPipeline.mObjectShinyProgram.bind(); - LLVector3 vec = LLVector3(gPipeline.mShinyOrigin) * mat; - LLVector4 vec4(vec, gPipeline.mShinyOrigin.mV[3]); - glUniform4fvARB(gPipeline.mObjectShinyProgram.mUniform[LLPipeline::GLSL_SHINY_ORIGIN], 1, + gObjectShinyProgram.bind(); + LLVector3 vec = LLVector3(gShinyOrigin) * mat; + LLVector4 vec4(vec, gShinyOrigin.mV[3]); + glUniform4fvARB(gObjectShinyProgram.mUniform[LLShaderMgr::SHINY_ORIGIN], 1, vec4.mV); } else @@ -361,9 +361,9 @@ void LLDrawPoolBump::endShiny() cube_map->disable(); cube_map->restoreMatrix(); - if (gPipeline.getVertexShaderLevel(LLPipeline::SHADER_OBJECT) > 0) + if (LLShaderMgr::getVertexShaderLevel(LLShaderMgr::SHADER_OBJECT) > 0) { - gPipeline.mObjectShinyProgram.unbind(); + gObjectShinyProgram.unbind(); } glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); diff --git a/indra/newview/lldrawpoolground.cpp b/indra/newview/lldrawpoolground.cpp index edbb11ad79..b6c3d638ea 100644 --- a/indra/newview/lldrawpoolground.cpp +++ b/indra/newview/lldrawpoolground.cpp @@ -21,6 +21,7 @@ #include "pipeline.h" #include "llagent.h" #include "llviewerregion.h" +#include "llglslshader.h" LLDrawPoolGround::LLDrawPoolGround() : LLFacePool(POOL_GROUND) @@ -34,7 +35,7 @@ LLDrawPool *LLDrawPoolGround::instancePool() void LLDrawPoolGround::prerender() { - mVertexShaderLevel = gPipeline.getVertexShaderLevel(LLPipeline::SHADER_ENVIRONMENT); + mVertexShaderLevel = LLShaderMgr::getVertexShaderLevel(LLShaderMgr::SHADER_ENVIRONMENT); } void LLDrawPoolGround::render(S32 pass) diff --git a/indra/newview/lldrawpoolsimple.cpp b/indra/newview/lldrawpoolsimple.cpp index 4c09cd4095..26022e362a 100644 --- a/indra/newview/lldrawpoolsimple.cpp +++ b/indra/newview/lldrawpoolsimple.cpp @@ -17,6 +17,7 @@ #include "llface.h" #include "llsky.h" #include "pipeline.h" +#include "llglslshader.h" class LLRenderShinyGlow : public LLDrawPoolBump { @@ -102,7 +103,7 @@ LLDrawPoolSimple::LLDrawPoolSimple() : void LLDrawPoolSimple::prerender() { - mVertexShaderLevel = gPipeline.getVertexShaderLevel(LLPipeline::SHADER_OBJECT); + mVertexShaderLevel = LLShaderMgr::getVertexShaderLevel(LLShaderMgr::SHADER_OBJECT); } void LLDrawPoolSimple::beginRenderPass(S32 pass) diff --git a/indra/newview/lldrawpoolsky.cpp b/indra/newview/lldrawpoolsky.cpp index 80340f63b9..6448576117 100644 --- a/indra/newview/lldrawpoolsky.cpp +++ b/indra/newview/lldrawpoolsky.cpp @@ -23,6 +23,7 @@ #include "llvosky.h" #include "llworld.h" // To get water height #include "pipeline.h" +#include "llglslshader.h" LLDrawPoolSky::LLDrawPoolSky() : LLFacePool(POOL_SKY) @@ -36,7 +37,7 @@ LLDrawPool *LLDrawPoolSky::instancePool() void LLDrawPoolSky::prerender() { - mVertexShaderLevel = gPipeline.getVertexShaderLevel(LLPipeline::SHADER_ENVIRONMENT); + mVertexShaderLevel = LLShaderMgr::getVertexShaderLevel(LLShaderMgr::SHADER_ENVIRONMENT); } void LLDrawPoolSky::render(S32 pass) diff --git a/indra/newview/lldrawpoolterrain.cpp b/indra/newview/lldrawpoolterrain.cpp index 8c5c2e177a..787cd3167b 100644 --- a/indra/newview/lldrawpoolterrain.cpp +++ b/indra/newview/lldrawpoolterrain.cpp @@ -28,6 +28,7 @@ #include "llviewerimagelist.h" // To get alpha gradients #include "llworld.h" #include "pipeline.h" +#include "llglslshader.h" const F32 DETAIL_SCALE = 1.f/16.f; int DebugDetailMap = 0; @@ -149,10 +150,10 @@ void LLDrawPoolTerrain::render(S32 pass) gPipeline.disableLights(); if ((mVertexShaderLevel > 0)) { - gPipeline.mHighlightProgram.bind(); - gPipeline.mHighlightProgram.vertexAttrib4f(LLPipeline::GLSL_MATERIAL_COLOR,1,1,1,1); + gHighlightProgram.bind(); + gHighlightProgram.vertexAttrib4f(LLShaderMgr::MATERIAL_COLOR,1,1,1,1); renderOwnership(); - gPipeline.mTerrainProgram.bind(); + gTerrainProgram.bind(); } else { @@ -203,9 +204,9 @@ void LLDrawPoolTerrain::renderFull4TUShader() // Stage 0: detail texture 0 // - S32 detailTex0 = gPipeline.mTerrainProgram.enableTexture(LLPipeline::GLSL_TERRAIN_DETAIL0); - S32 detailTex1 = gPipeline.mTerrainProgram.enableTexture(LLPipeline::GLSL_TERRAIN_DETAIL1); - S32 rampTex = gPipeline.mTerrainProgram.enableTexture(LLPipeline::GLSL_TERRAIN_ALPHARAMP); + S32 detailTex0 = gTerrainProgram.enableTexture(LLShaderMgr::TERRAIN_DETAIL0); + S32 detailTex1 = gTerrainProgram.enableTexture(LLShaderMgr::TERRAIN_DETAIL1); + S32 rampTex = gTerrainProgram.enableTexture(LLShaderMgr::TERRAIN_ALPHARAMP); LLViewerImage::bindTexture(detail_texture0p,detailTex0); @@ -322,9 +323,9 @@ void LLDrawPoolTerrain::renderFull4TUShader() } // Disable multitexture - gPipeline.mTerrainProgram.disableTexture(LLPipeline::GLSL_TERRAIN_ALPHARAMP); - gPipeline.mTerrainProgram.disableTexture(LLPipeline::GLSL_TERRAIN_DETAIL0); - gPipeline.mTerrainProgram.disableTexture(LLPipeline::GLSL_TERRAIN_DETAIL1); + gTerrainProgram.disableTexture(LLShaderMgr::TERRAIN_ALPHARAMP); + gTerrainProgram.disableTexture(LLShaderMgr::TERRAIN_DETAIL0); + gTerrainProgram.disableTexture(LLShaderMgr::TERRAIN_DETAIL1); glClientActiveTextureARB(GL_TEXTURE3_ARB); glActiveTextureARB(GL_TEXTURE3_ARB); @@ -1061,5 +1062,5 @@ LLColor3 LLDrawPoolTerrain::getDebugColor() const S32 LLDrawPoolTerrain::getMaterialAttribIndex() { - return gPipeline.mTerrainProgram.mAttribute[LLPipeline::GLSL_MATERIAL_COLOR]; + return gTerrainProgram.mAttribute[LLShaderMgr::MATERIAL_COLOR]; } diff --git a/indra/newview/lldrawpooltree.cpp b/indra/newview/lldrawpooltree.cpp index 170669955c..350ad6a652 100644 --- a/indra/newview/lldrawpooltree.cpp +++ b/indra/newview/lldrawpooltree.cpp @@ -17,6 +17,7 @@ #include "llvotree.h" #include "pipeline.h" #include "llviewercamera.h" +#include "llglslshader.h" S32 LLDrawPoolTree::sDiffTex = 0; @@ -267,5 +268,5 @@ LLColor3 LLDrawPoolTree::getDebugColor() const S32 LLDrawPoolTree::getMaterialAttribIndex() { - return gPipeline.mObjectSimpleProgram.mAttribute[LLPipeline::GLSL_MATERIAL_COLOR]; + return gObjectSimpleProgram.mAttribute[LLShaderMgr::MATERIAL_COLOR]; } diff --git a/indra/newview/lldrawpoolwater.cpp b/indra/newview/lldrawpoolwater.cpp index 6e372b6f76..fd66d58851 100644 --- a/indra/newview/lldrawpoolwater.cpp +++ b/indra/newview/lldrawpoolwater.cpp @@ -28,6 +28,7 @@ #include "llworld.h" #include "pipeline.h" #include "viewer.h" // gSunTextureID, gMoonTextureID +#include "llglslshader.h" const LLUUID WATER_TEST("2bfd3884-7e27-69b9-ba3a-3e673f680004"); @@ -71,12 +72,9 @@ LLDrawPool *LLDrawPoolWater::instancePool() void LLDrawPoolWater::prerender() { -#if 1 // 1.9.1 mVertexShaderLevel = gSavedSettings.getBOOL("RenderRippleWater") ? - gPipeline.getVertexShaderLevel(LLPipeline::SHADER_ENVIRONMENT) : 0; -#else - mVertexShaderLevel = gPipeline.getVertexShaderLevel(LLPipeline::SHADER_ENVIRONMENT); -#endif + LLShaderMgr::getVertexShaderLevel(LLShaderMgr::SHADER_ENVIRONMENT) : 0; + } extern LLColor4U MAX_WATER_COLOR; @@ -319,7 +317,7 @@ void LLDrawPoolWater::renderShaderSimple() glEnableClientState(GL_NORMAL_ARRAY); // Set up second pass first - S32 bumpTex = gPipeline.mWaterProgram.enableTexture(LLPipeline::GLSL_BUMP_MAP); + S32 bumpTex = gWaterProgram.enableTexture(LLShaderMgr::BUMP_MAP); mWaterImagep->addTextureStats(1024.f*1024.f); mWaterImagep->bind(bumpTex); @@ -368,7 +366,7 @@ void LLDrawPoolWater::renderShaderSimple() if (gSky.mVOSkyp->getCubeMap()) { - envTex = gPipeline.mWaterProgram.enableTexture(LLPipeline::GLSL_ENVIRONMENT_MAP, GL_TEXTURE_CUBE_MAP_ARB); + envTex = gWaterProgram.enableTexture(LLShaderMgr::ENVIRONMENT_MAP, GL_TEXTURE_CUBE_MAP_ARB); gSky.mVOSkyp->getCubeMap()->bind(); glMatrixMode(GL_TEXTURE); @@ -382,9 +380,9 @@ void LLDrawPoolWater::renderShaderSimple() glMatrixMode(GL_MODELVIEW); } - S32 diffTex = gPipeline.mWaterProgram.enableTexture(LLPipeline::GLSL_DIFFUSE_MAP); + S32 diffTex = gWaterProgram.enableTexture(LLShaderMgr::DIFFUSE_MAP); - gPipeline.mWaterProgram.bind(); + gWaterProgram.bind(); for (std::vector<LLFace*>::iterator iter = mDrawFace.begin(); iter != mDrawFace.end(); iter++) @@ -401,21 +399,21 @@ void LLDrawPoolWater::renderShaderSimple() if (gSky.mVOSkyp->getCubeMap()) { - gPipeline.mWaterProgram.disableTexture(LLPipeline::GLSL_ENVIRONMENT_MAP, GL_TEXTURE_CUBE_MAP_ARB); + gWaterProgram.disableTexture(LLShaderMgr::ENVIRONMENT_MAP, GL_TEXTURE_CUBE_MAP_ARB); glMatrixMode(GL_TEXTURE); glLoadIdentity(); glMatrixMode(GL_MODELVIEW); } // Now, disable texture coord generation on texture state 1 - gPipeline.mWaterProgram.disableTexture(LLPipeline::GLSL_BUMP_MAP); + gWaterProgram.disableTexture(LLShaderMgr::BUMP_MAP); LLImageGL::unbindTexture(bumpTex, GL_TEXTURE_2D); glActiveTextureARB(GL_TEXTURE1_ARB); glDisable(GL_TEXTURE_GEN_S); //texture unit 1 glDisable(GL_TEXTURE_GEN_T); //texture unit 1 - gPipeline.mWaterProgram.disableTexture(LLPipeline::GLSL_DIFFUSE_MAP); + gWaterProgram.disableTexture(LLShaderMgr::DIFFUSE_MAP); // Disable texture coordinate and color arrays LLImageGL::unbindTexture(diffTex, GL_TEXTURE_2D); @@ -546,17 +544,17 @@ void LLDrawPoolWater::shade() LLCubeMap* skyMap = gSky.mVOSkyp->getCubeMap(); - gPipeline.mWaterProgram.enableTexture(LLPipeline::GLSL_ENVIRONMENT_MAP, GL_TEXTURE_CUBE_MAP_ARB); + gWaterProgram.enableTexture(LLShaderMgr::ENVIRONMENT_MAP, GL_TEXTURE_CUBE_MAP_ARB); skyMap->bind(); //bind normal map - S32 bumpTex = gPipeline.mWaterProgram.enableTexture(LLPipeline::GLSL_BUMP_MAP); + S32 bumpTex = gWaterProgram.enableTexture(LLShaderMgr::BUMP_MAP); mWaterNormp->addTextureStats(1024.f*1024.f); mWaterNormp->bind(bumpTex); - gPipeline.mWaterProgram.enableTexture(LLPipeline::GLSL_WATER_SCREENTEX); + gWaterProgram.enableTexture(LLShaderMgr::WATER_SCREENTEX); - gPipeline.mWaterProgram.bind(); + gWaterProgram.bind(); if (!sSkipScreenCopy) { @@ -567,20 +565,20 @@ void LLDrawPoolWater::shade() glBindTexture(GL_TEXTURE_2D, 0); } - glUniform2fvARB(gPipeline.mWaterProgram.mUniform[LLPipeline::GLSL_WATER_FBSCALE], 1, + glUniform2fvARB(gWaterProgram.mUniform[LLShaderMgr::WATER_FBSCALE], 1, gPipeline.mScreenScale.mV); - S32 diffTex = gPipeline.mWaterProgram.enableTexture(LLPipeline::GLSL_DIFFUSE_MAP); + S32 diffTex = gWaterProgram.enableTexture(LLShaderMgr::DIFFUSE_MAP); LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE); - glUniform1fARB(gPipeline.mWaterProgram.mUniform[LLPipeline::GLSL_WATER_TIME], sTime); - glUniform3fvARB(gPipeline.mWaterProgram.mUniform[LLPipeline::GLSL_WATER_SPECULAR], 1, light_diffuse.mV); - glUniform1fARB(gPipeline.mWaterProgram.mUniform[LLPipeline::GLSL_WATER_SPECULAR_EXP], light_exp); - glUniform3fvARB(gPipeline.mWaterProgram.mUniform[LLPipeline::GLSL_WATER_EYEVEC], 1, gCamera->getOrigin().mV); - glUniform2fvARB(gPipeline.mWaterProgram.mUniform[LLPipeline::GLSL_WATER_WAVE_DIR1], 1, d1.mV); - glUniform2fvARB(gPipeline.mWaterProgram.mUniform[LLPipeline::GLSL_WATER_WAVE_DIR2], 1, d2.mV); - glUniform3fvARB(gPipeline.mWaterProgram.mUniform[LLPipeline::GLSL_WATER_LIGHT_DIR], 1, light_dir.mV); + glUniform1fARB(gWaterProgram.mUniform[LLShaderMgr::WATER_TIME], sTime); + glUniform3fvARB(gWaterProgram.mUniform[LLShaderMgr::WATER_SPECULAR], 1, light_diffuse.mV); + glUniform1fARB(gWaterProgram.mUniform[LLShaderMgr::WATER_SPECULAR_EXP], light_exp); + glUniform3fvARB(gWaterProgram.mUniform[LLShaderMgr::WATER_EYEVEC], 1, gCamera->getOrigin().mV); + glUniform2fvARB(gWaterProgram.mUniform[LLShaderMgr::WATER_WAVE_DIR1], 1, d1.mV); + glUniform2fvARB(gWaterProgram.mUniform[LLShaderMgr::WATER_WAVE_DIR2], 1, d2.mV); + glUniform3fvARB(gWaterProgram.mUniform[LLShaderMgr::WATER_LIGHT_DIR], 1, light_dir.mV); LLColor4 water_color; LLVector3 camera_up = gCamera->getUpAxis(); @@ -588,12 +586,12 @@ void LLDrawPoolWater::shade() if (gCamera->cameraUnderWater()) { water_color.setVec(1.f, 1.f, 1.f, 0.4f); - glUniform1fARB(gPipeline.mWaterProgram.mUniform[LLPipeline::GLSL_WATER_REFSCALE], 0.25f); + glUniform1fARB(gWaterProgram.mUniform[LLShaderMgr::WATER_REFSCALE], 0.25f); } else { water_color.setVec(1.f, 1.f, 1.f, 0.5f*(1.f + up_dot)); - glUniform1fARB(gPipeline.mWaterProgram.mUniform[LLPipeline::GLSL_WATER_REFSCALE], 0.01f); + glUniform1fARB(gWaterProgram.mUniform[LLShaderMgr::WATER_REFSCALE], 0.01f); } if (water_color.mV[3] > 0.9f) { @@ -620,10 +618,10 @@ void LLDrawPoolWater::shade() } } - gPipeline.mWaterProgram.disableTexture(LLPipeline::GLSL_ENVIRONMENT_MAP, GL_TEXTURE_CUBE_MAP_ARB); - gPipeline.mWaterProgram.disableTexture(LLPipeline::GLSL_WATER_SCREENTEX); - gPipeline.mWaterProgram.disableTexture(LLPipeline::GLSL_BUMP_MAP); - gPipeline.mWaterProgram.disableTexture(LLPipeline::GLSL_DIFFUSE_MAP); + gWaterProgram.disableTexture(LLShaderMgr::ENVIRONMENT_MAP, GL_TEXTURE_CUBE_MAP_ARB); + gWaterProgram.disableTexture(LLShaderMgr::WATER_SCREENTEX); + gWaterProgram.disableTexture(LLShaderMgr::BUMP_MAP); + gWaterProgram.disableTexture(LLShaderMgr::DIFFUSE_MAP); glActiveTextureARB(GL_TEXTURE0_ARB); glEnable(GL_TEXTURE_2D); diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index 280abcd541..b3e68e24df 100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -231,8 +231,6 @@ void LLFace::setDrawable(LLDrawable *drawable) void LLFace::setSize(const S32 num_vertices, const S32 num_indices) { - LLMemType mt1(LLMemType::MTYPE_DRAWABLE); - mGeomCount = num_vertices; mIndicesCount = num_indices; } @@ -950,17 +948,17 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, } else { - if (mode & LLViewerTextureAnim::TRANSLATE) + //if (mode & LLViewerTextureAnim::TRANSLATE) { os = ot = 0.f; } - if (mode & LLViewerTextureAnim::ROTATE) + //if (mode & LLViewerTextureAnim::ROTATE) { r = 0.f; cos_ang = 1.f; sin_ang = 0.f; } - if (mode & LLViewerTextureAnim::SCALE) + //if (mode & LLViewerTextureAnim::SCALE) { ms = mt = 1.f; } diff --git a/indra/newview/llfloateranimpreview.cpp b/indra/newview/llfloateranimpreview.cpp index 3c296615f6..22617a7fcc 100644 --- a/indra/newview/llfloateranimpreview.cpp +++ b/indra/newview/llfloateranimpreview.cpp @@ -390,7 +390,7 @@ BOOL LLFloaterAnimPreview::handleMouseDown(S32 x, S32 y, MASK mask) if (mPreviewRect.pointInRect(x, y)) { bringToFront( x, y ); - gViewerWindow->setMouseCapture(this, onMouseCaptureLost); + gViewerWindow->setMouseCapture(this); gViewerWindow->hideCursor(); mLastMouseX = x; mLastMouseY = y; @@ -405,7 +405,7 @@ BOOL LLFloaterAnimPreview::handleMouseDown(S32 x, S32 y, MASK mask) //----------------------------------------------------------------------------- BOOL LLFloaterAnimPreview::handleMouseUp(S32 x, S32 y, MASK mask) { - gViewerWindow->setMouseCapture(FALSE, NULL); + gViewerWindow->setMouseCapture(FALSE); gViewerWindow->showCursor(); return LLFloater::handleMouseUp(x, y, mask); } @@ -417,7 +417,7 @@ BOOL LLFloaterAnimPreview::handleHover(S32 x, S32 y, MASK mask) { MASK local_mask = mask & ~MASK_ALT; - if (mAnimPreview && gViewerWindow->hasMouseCapture(this)) + if (mAnimPreview && hasMouseCapture()) { if (local_mask == MASK_PAN) { @@ -479,7 +479,7 @@ BOOL LLFloaterAnimPreview::handleScrollWheel(S32 x, S32 y, S32 clicks) //----------------------------------------------------------------------------- // onMouseCaptureLost() //----------------------------------------------------------------------------- -void LLFloaterAnimPreview::onMouseCaptureLost(LLMouseHandler* handler) +void LLFloaterAnimPreview::onMouseCaptureLost() { gViewerWindow->showCursor(); } diff --git a/indra/newview/llfloateranimpreview.h b/indra/newview/llfloateranimpreview.h index 40ec96f73d..858d586274 100644 --- a/indra/newview/llfloateranimpreview.h +++ b/indra/newview/llfloateranimpreview.h @@ -56,10 +56,10 @@ public: BOOL handleMouseUp(S32 x, S32 y, MASK mask); BOOL handleHover(S32 x, S32 y, MASK mask); BOOL handleScrollWheel(S32 x, S32 y, S32 clicks); + void onMouseCaptureLost(); void refresh(); - static void onMouseCaptureLost(LLMouseHandler*); static void onBtnPlay(void*); static void onBtnStop(void*); static void setUploadAmount(S32 amount) { sUploadAmount = amount; } diff --git a/indra/newview/llfloateravatarpicker.cpp b/indra/newview/llfloateravatarpicker.cpp index de9432ee73..559b29379c 100644 --- a/indra/newview/llfloateravatarpicker.cpp +++ b/indra/newview/llfloateravatarpicker.cpp @@ -24,7 +24,7 @@ const S32 MIN_WIDTH = 200; const S32 MIN_HEIGHT = 340; const LLRect FLOATER_RECT(0, 380, 240, 0); -const char FLOATER_TITLE[] = "Choose Person"; +const char FLOATER_TITLE[] = "Choose Resident"; // static LLFloaterAvatarPicker* LLFloaterAvatarPicker::sInstance = NULL; @@ -89,9 +89,7 @@ BOOL LLFloaterAvatarPicker::postBuild() if (mListNames) { - LLScrollListItem* row = new LLScrollListItem( TRUE, NULL, LLUUID::null ); - row->addColumn("No results", LLFontGL::sSansSerif); - mListNames->addItem(row); + mListNames->addSimpleElement("No results"); } mInventoryPanel = (LLInventoryPanel*)this->getCtrlByNameAndType("Inventory Panel", WIDGET_TYPE_INVENTORY_PANEL); @@ -237,10 +235,7 @@ void LLFloaterAvatarPicker::find() if (mListNames) { mListNames->deleteAllItems(); - - LLScrollListItem* row = new LLScrollListItem( TRUE, NULL, LLUUID::null ); - row->addColumn("Searching...", LLFontGL::sSansSerif); - mListNames->addItem(row); + mListNames->addSimpleElement("Searching..."); } childSetEnabled("Select", FALSE); @@ -305,23 +300,20 @@ void LLFloaterAvatarPicker::processAvatarPickerReply(LLMessageSystem* msg, void* msg->getStringFast(_PREHASH_Data,_PREHASH_FirstName, DB_FIRST_NAME_BUF_SIZE, first_name, i); msg->getStringFast(_PREHASH_Data,_PREHASH_LastName, DB_LAST_NAME_BUF_SIZE, last_name, i); - LLScrollListItem* row = new LLScrollListItem( TRUE, NULL, avatar_id ); - + LLString avatar_name; if (avatar_id.isNull()) { self->childSetTextArg("NotFound", "[TEXT]", self->childGetText("Edit")); - LLString msg = self->childGetValue("NotFound").asString(); - row->addColumn(msg, LLFontGL::sSansSerif); + avatar_name = self->childGetValue("NotFound").asString(); self->mListNames->setEnabled(FALSE); } else { - LLString buffer = LLString(first_name) + " " + last_name; - row->addColumn(buffer, LLFontGL::sSansSerif); + avatar_name = LLString(first_name) + " " + last_name; self->mListNames->setEnabled(TRUE); found_one = TRUE; } - self->mListNames->addItem(row); + self->mListNames->addSimpleElement(avatar_name); } if (found_one) diff --git a/indra/newview/llfloaterbump.cpp b/indra/newview/llfloaterbump.cpp index 969124a81c..68f002f9d9 100644 --- a/indra/newview/llfloaterbump.cpp +++ b/indra/newview/llfloaterbump.cpp @@ -63,9 +63,10 @@ void LLFloaterBump::show(void *contents) if (gMeanCollisionList.isEmpty()) { LLString none_detected = sInstance->childGetText("none_detected"); - LLScrollListItem *item = new LLScrollListItem(); - item->addColumn(none_detected, LLFontGL::sSansSerifBold); - list->addItem(item); + LLSD row; + row["columns"][0]["value"] = none_detected; + row["columns"][0]["font-style"] = "BOLD"; + list->addElement(row); } else { @@ -132,7 +133,9 @@ void LLFloaterBump::add(LLScrollListCtrl* list, LLMeanCollisionData* mcd) text.setArg("[FIRST]", mcd->mFirstName); text.setArg("[LAST]", mcd->mLastName); - LLScrollListItem *item = new LLScrollListItem(TRUE, NULL, mcd->mPerp); - item->addColumn(text, LLFontGL::sSansSerifBold); - list->addItem(item); + LLSD row; + row["id"] = mcd->mPerp; + row["columns"][0]["value"] = text; + row["columns"][0]["font-style"] = "BOLD"; + list->addElement(row); } diff --git a/indra/newview/llfloaterbuyland.cpp b/indra/newview/llfloaterbuyland.cpp index 03a94aed63..1ee8cd62ab 100644 --- a/indra/newview/llfloaterbuyland.cpp +++ b/indra/newview/llfloaterbuyland.cpp @@ -1261,14 +1261,12 @@ void LLFloaterBuyLandUI::refreshUI() } - //remove_contribution not in XML - ?! childSetValue("remove_contribution", LLSD(groupContributionEnough)); childSetEnabled("remove_contribution", groupContributionEnough); bool showRemoveContribution = mParcelIsGroupLand && (mParcelGroupContribution > 0); - childSetText("remove_contribution", - llformat("Remove %d square meters of contribution from group", - minContribution)); + childSetLabelArg("remove_contribution", "[AMOUNT]", + llformat("%d", minContribution)); childSetVisible("remove_contribution", showRemoveContribution); childShow("step_3"); diff --git a/indra/newview/llfloatercolorpicker.cpp b/indra/newview/llfloatercolorpicker.cpp index 144833a3f5..8af0dd410f 100644 --- a/indra/newview/llfloatercolorpicker.cpp +++ b/indra/newview/llfloatercolorpicker.cpp @@ -554,11 +554,10 @@ void LLFloaterColorPicker::onColorSelect( const LLTextureEntry& te, void *data ) } } -void LLFloaterColorPicker::onMouseCaptureLost(LLMouseHandler *old_captor) +void LLFloaterColorPicker::onMouseCaptureLost() { - LLFloaterColorPicker* self = (LLFloaterColorPicker*)old_captor; - self->setMouseDownInHueRegion(FALSE); - self->setMouseDownInLumRegion(FALSE); + setMouseDownInHueRegion(FALSE); + setMouseDownInLumRegion(FALSE); } ////////////////////////////////////////////////////////////////////////////// @@ -942,7 +941,7 @@ handleMouseDown ( S32 x, S32 y, MASK mask ) if ( rgbAreaRect.pointInRect ( x, y ) ) { - gViewerWindow->setMouseCapture(this, onMouseCaptureLost); + gViewerWindow->setMouseCapture(this); // mouse button down setMouseDownInHueRegion ( TRUE ); @@ -961,7 +960,7 @@ handleMouseDown ( S32 x, S32 y, MASK mask ) if ( lumAreaRect.pointInRect ( x, y ) ) { - gViewerWindow->setMouseCapture(this, onMouseCaptureLost); + gViewerWindow->setMouseCapture(this); // mouse button down setMouseDownInLumRegion ( TRUE ); @@ -1174,9 +1173,9 @@ handleMouseUp ( S32 x, S32 y, MASK mask ) // mouse button not down in color swatch anymore mMouseDownInSwatch = false; - if (gViewerWindow->hasMouseCapture(this)) + if (hasMouseCapture()) { - gViewerWindow->setMouseCapture(NULL, NULL); + gViewerWindow->setMouseCapture(NULL); } // dispatch to base class for the rest of things diff --git a/indra/newview/llfloatercolorpicker.h b/indra/newview/llfloatercolorpicker.h index aa406c0dec..7660aa8c2d 100644 --- a/indra/newview/llfloatercolorpicker.h +++ b/indra/newview/llfloatercolorpicker.h @@ -36,6 +36,7 @@ class LLFloaterColorPicker virtual BOOL handleMouseDown ( S32 x, S32 y, MASK mask ); virtual BOOL handleMouseUp ( S32 x, S32 y, MASK mask ); virtual BOOL handleHover ( S32 x, S32 y, MASK mask ); + virtual void onMouseCaptureLost(); virtual void onClose(bool app_quitting); // implicit methods @@ -94,7 +95,6 @@ class LLFloaterColorPicker F32 hueToRgb ( F32 val1In, F32 val2In, F32 valHUeIn ); void setActive(BOOL active); - static void onMouseCaptureLost(LLMouseHandler* old_captor); protected: // callbacks diff --git a/indra/newview/llfloatergodtools.cpp b/indra/newview/llfloatergodtools.cpp index 3b7a868472..6065fc92c9 100644 --- a/indra/newview/llfloatergodtools.cpp +++ b/indra/newview/llfloatergodtools.cpp @@ -1325,11 +1325,10 @@ void LLPanelRequestTools::refresh() list->operateOnAll(LLCtrlListInterface::OP_DELETE); list->addSimpleElement(SELECTION); list->addSimpleElement(AGENT_REGION); - LLViewerRegion* regionp; - for(regionp = gWorldp->mActiveRegionList.getFirstData(); - regionp != NULL; - regionp = gWorldp->mActiveRegionList.getNextData()) + for (LLWorld::region_list_t::iterator iter = gWorldp->mActiveRegionList.begin(); + iter != gWorldp->mActiveRegionList.end(); ++iter) { + LLViewerRegion* regionp = *iter; LLString name = regionp->getName(); if (!name.empty()) { @@ -1387,11 +1386,10 @@ void LLPanelRequestTools::onClickRequest(void* data) else { // find region by name - LLViewerRegion* regionp; - for(regionp = gWorldp->mActiveRegionList.getFirstData(); - regionp != NULL; - regionp = gWorldp->mActiveRegionList.getNextData()) + for (LLWorld::region_list_t::iterator iter = gWorldp->mActiveRegionList.begin(); + iter != gWorldp->mActiveRegionList.end(); ++iter) { + LLViewerRegion* regionp = *iter; if(dest == regionp->getName()) { // found it diff --git a/indra/newview/llfloaterimagepreview.cpp b/indra/newview/llfloaterimagepreview.cpp index 2e77bbcfbd..f10abc4466 100644 --- a/indra/newview/llfloaterimagepreview.cpp +++ b/indra/newview/llfloaterimagepreview.cpp @@ -356,7 +356,7 @@ BOOL LLFloaterImagePreview::handleMouseDown(S32 x, S32 y, MASK mask) if (mPreviewRect.pointInRect(x, y)) { bringToFront( x, y ); - gViewerWindow->setMouseCapture(this, onMouseCaptureLost); + gViewerWindow->setMouseCapture(this); gViewerWindow->hideCursor(); mLastMouseX = x; mLastMouseY = y; @@ -371,7 +371,7 @@ BOOL LLFloaterImagePreview::handleMouseDown(S32 x, S32 y, MASK mask) //----------------------------------------------------------------------------- BOOL LLFloaterImagePreview::handleMouseUp(S32 x, S32 y, MASK mask) { - gViewerWindow->setMouseCapture(FALSE, NULL); + gViewerWindow->setMouseCapture(FALSE); gViewerWindow->showCursor(); return LLFloater::handleMouseUp(x, y, mask); } @@ -383,7 +383,7 @@ BOOL LLFloaterImagePreview::handleHover(S32 x, S32 y, MASK mask) { MASK local_mask = mask & ~MASK_ALT; - if (mAvatarPreview && gViewerWindow->hasMouseCapture(this)) + if (mAvatarPreview && hasMouseCapture()) { if (local_mask == MASK_PAN) { diff --git a/indra/newview/llfloaterland.cpp b/indra/newview/llfloaterland.cpp index 77ebe88a09..45570f6aa2 100644 --- a/indra/newview/llfloaterland.cpp +++ b/indra/newview/llfloaterland.cpp @@ -392,8 +392,8 @@ BOOL LLPanelLandGeneral::postBuild() mBtnDeedToGroup->setClickedCallback(onClickDeed, this); - mCheckContributeWithDeed = LLUICtrlFactory::getCheckBoxByName(this, "check contib"); - childSetCommitCallback("check contib", onCommitAny, this); + mCheckContributeWithDeed = LLUICtrlFactory::getCheckBoxByName(this, "check contrib"); + childSetCommitCallback("check contrib", onCommitAny, this); @@ -1865,7 +1865,7 @@ void LLPanelLandObjects::onClickReturnOtherObjects(void* userdata) } // static -void LLPanelLandObjects::onLostFocus(LLLineEditor *caller, void* user_data) +void LLPanelLandObjects::onLostFocus(LLUICtrl *caller, void* user_data) { LLPanelLandObjects *lop = (LLPanelLandObjects *)user_data; LLParcel* parcel = lop->mParcel->getParcel(); diff --git a/indra/newview/llfloaterland.h b/indra/newview/llfloaterland.h index b1aad89d7d..cfd009c335 100644 --- a/indra/newview/llfloaterland.h +++ b/indra/newview/llfloaterland.h @@ -234,7 +234,7 @@ public: static void onDoubleClickOwner(void*); static void onCommitList(LLUICtrl* ctrl, void* data); - static void onLostFocus(LLLineEditor* caller, void* user_data); + static void onLostFocus(LLUICtrl* caller, void* user_data); static void processParcelObjectOwnersReply(LLMessageSystem *msg, void **); diff --git a/indra/newview/llfloatersnapshot.cpp b/indra/newview/llfloatersnapshot.cpp index ac77b3c3f0..92e005c0bb 100644 --- a/indra/newview/llfloatersnapshot.cpp +++ b/indra/newview/llfloatersnapshot.cpp @@ -504,7 +504,7 @@ void LLSnapshotLivePreview::onIdle( void* snapshot_preview ) previewp->mSnapshotDelayTimer.hasExpired()); // don't take snapshots while ALT-zoom active - if (gFocusMgr.getMouseCapture() == gToolCamera) + if (gToolCamera->hasMouseCapture()) { previewp->mSnapshotActive = FALSE; } diff --git a/indra/newview/llfloatertools.cpp b/indra/newview/llfloatertools.cpp index 63b1734642..0529507c35 100644 --- a/indra/newview/llfloatertools.cpp +++ b/indra/newview/llfloatertools.cpp @@ -928,7 +928,7 @@ void LLFloaterTools::setObjectType( void* data ) LLPCode pcode = *(LLPCode*) data; LLToolPlacer::setObjectType( pcode ); gSavedSettings.setBOOL("CreateToolCopySelection", FALSE); - gViewerWindow->setMouseCapture(NULL, NULL); + gViewerWindow->setMouseCapture(NULL); } // static diff --git a/indra/newview/llfolderview.cpp b/indra/newview/llfolderview.cpp index e9fa4cc1dd..31668b6d80 100644 --- a/indra/newview/llfolderview.cpp +++ b/indra/newview/llfolderview.cpp @@ -71,7 +71,7 @@ void copy_selected_item(void* user_data); void open_selected_items(void* user_data); void properties_selected_items(void* user_data); void paste_items(void* user_data); -void top_view_lost( LLView* handler ); +void renamer_focus_lost( LLUICtrl* handler, void* user_data ); ///---------------------------------------------------------------------------- /// Class LLFolderViewItem @@ -588,7 +588,7 @@ BOOL LLFolderViewItem::handleMouseDown( S32 x, S32 y, MASK mask ) { // No handler needed for focus lost since this class has no // state that depends on it. - gViewerWindow->setMouseCapture( this, NULL ); + gViewerWindow->setMouseCapture( this ); if (!mIsSelected) { @@ -623,7 +623,7 @@ BOOL LLFolderViewItem::handleMouseDown( S32 x, S32 y, MASK mask ) BOOL LLFolderViewItem::handleHover( S32 x, S32 y, MASK mask ) { - if( gViewerWindow->hasMouseCapture( this ) && isMovable() ) + if( hasMouseCapture() && isMovable() ) { S32 screen_x; S32 screen_y; @@ -723,10 +723,10 @@ BOOL LLFolderViewItem::handleMouseUp( S32 x, S32 y, MASK mask ) mSelectPending = FALSE; - if( gViewerWindow->hasMouseCapture( this ) ) + if( hasMouseCapture() ) { getRoot()->setShowSelectionContext(FALSE); - gViewerWindow->setMouseCapture( NULL, NULL ); + gViewerWindow->setMouseCapture( NULL ); } return TRUE; } @@ -1226,7 +1226,7 @@ void LLFolderViewFolder::filter( LLInventoryFilter& filter) } // when applying a filter, matching folders get their contents downloaded first - if (getRoot()->isFilterActive() && getFiltered(filter.getMinRequiredGeneration()) && !gInventory.isCategoryComplete(mListener->getUUID())) + if (filter.isNotDefault() && getFiltered(filter.getMinRequiredGeneration()) && !gInventory.isCategoryComplete(mListener->getUUID())) { gInventory.startBackgroundFetch(mListener->getUUID()); } @@ -2596,9 +2596,9 @@ LLFolderView::~LLFolderView( void ) LLView::deleteViewByHandle(mPopupMenuHandle); - if(gViewerWindow->hasTopView(mRenamer)) + if(gViewerWindow->hasTopCtrl(mRenamer)) { - gViewerWindow->setTopView(NULL, NULL); + gViewerWindow->setTopCtrl(NULL); } mAutoOpenItems.removeAllNodes(); @@ -3175,7 +3175,7 @@ void LLFolderView::finishRenamingItem( void ) mRenamer->setFocus( FALSE ); mRenamer->setVisible( FALSE ); mRenamer->setCommitOnFocusLost( TRUE ); - gViewerWindow->setTopView( NULL, NULL ); + gViewerWindow->setTopCtrl( NULL ); if( mRenameItem ) { @@ -3193,7 +3193,7 @@ void LLFolderView::revertRenamingItem( void ) mRenamer->setFocus( FALSE ); mRenamer->setVisible( FALSE ); mRenamer->setCommitOnFocusLost( TRUE ); - gViewerWindow->setTopView( NULL, NULL ); + gViewerWindow->setTopCtrl( NULL ); if( mRenameItem ) { @@ -3591,7 +3591,8 @@ void LLFolderView::startRenamingSelectedItem( void ) mRenamer->setVisible( TRUE ); // set focus will fail unless item is visible mRenamer->setFocus( TRUE ); - gViewerWindow->setTopView( mRenamer, top_view_lost ); + mRenamer->setFocusLostCallback(renamer_focus_lost); + gViewerWindow->setTopCtrl( mRenamer ); } } @@ -3920,6 +3921,7 @@ void LLFolderView::onFocusLost( ) { gEditMenuHandler = NULL; } + LLUICtrl::onFocusLost(); } BOOL LLFolderView::search(LLFolderViewItem* first_item, const LLString &search_string, BOOL backward) @@ -4077,9 +4079,9 @@ BOOL LLFolderView::handleScrollWheel(S32 x, S32 y, S32 clicks) void LLFolderView::deleteAllChildren() { - if(gViewerWindow->hasTopView(mRenamer)) + if(gViewerWindow->hasTopCtrl(mRenamer)) { - gViewerWindow->setTopView(NULL, NULL); + gViewerWindow->setTopCtrl(NULL); } LLView::deleteViewByHandle(mPopupMenuHandle); mPopupMenuHandle = LLViewHandle::sDeadHandle; @@ -4219,7 +4221,7 @@ void LLFolderView::idle(void* user_data) self->mFilter.clearModified(); BOOL filter_modified_and_active = self->mCompletedFilterGeneration < self->mFilter.getCurrentGeneration() && - self->mFilter.isActive(); + self->mFilter.isNotDefault(); self->mNeedsAutoSelect = filter_modified_and_active && !(gFocusMgr.childHasKeyboardFocus(self) || gFocusMgr.getMouseCapture()); @@ -4288,6 +4290,12 @@ void LLFolderView::dumpSelectionInformation() bool sort_item_name(LLFolderViewItem* a, LLFolderViewItem* b) { + // Sort 'system' / unmovable folders to the top. + if (a->isMovable() != b->isMovable()) + { + return b->isMovable(); + } + S32 compare = LLString::compareDict(a->getLabel(), b->getLabel()); if (0 == compare) { @@ -4303,6 +4311,12 @@ bool sort_item_name(LLFolderViewItem* a, LLFolderViewItem* b) // of inventory items. bool sort_item_date(LLFolderViewItem* a, LLFolderViewItem* b) { + // Sort 'system' / unmovable folders to the top. + if (a->isMovable() != b->isMovable()) + { + return b->isMovable(); + } + U32 first_create = a->getCreationDate(); U32 second_create = b->getCreationDate(); if (first_create == second_create) @@ -4315,9 +4329,12 @@ bool sort_item_date(LLFolderViewItem* a, LLFolderViewItem* b) } } -void top_view_lost( LLView* view ) +void renamer_focus_lost( LLUICtrl* ctrl, void* userdata) { - if( view ) view->setVisible( FALSE ); + if( ctrl ) + { + ctrl->setVisible( FALSE ); + } } void delete_selected_item(void* user_data) @@ -4453,7 +4470,7 @@ std::string::size_type LLInventoryFilter::getStringMatchOffset() const } // has user modified default filter params? -BOOL LLInventoryFilter::isActive() +BOOL LLInventoryFilter::isNotDefault() { return mFilterOps.mFilterTypes != mDefaultFilterOps.mFilterTypes || mFilterSubString.size() @@ -4463,6 +4480,16 @@ BOOL LLInventoryFilter::isActive() || mFilterOps.mHoursAgo != mDefaultFilterOps.mHoursAgo; } +BOOL LLInventoryFilter::isActive() +{ + return mFilterOps.mFilterTypes != 0xffffffff + || mFilterSubString.size() + || mFilterOps.mPermissions != PERM_NONE + || mFilterOps.mMinDate != 0 + || mFilterOps.mMaxDate != U32_MAX + || mFilterOps.mHoursAgo != 0; +} + BOOL LLInventoryFilter::isModified() { return mModified; @@ -4672,7 +4699,7 @@ void LLInventoryFilter::setModified(EFilterBehavior behavior) mFilterBehavior = FILTER_RESTART; } - if (isActive()) + if (isNotDefault()) { // if not keeping current filter results, update last valid as well switch(mFilterBehavior) diff --git a/indra/newview/llfolderview.h b/indra/newview/llfolderview.h index 84dcddedbb..76784f1ac9 100644 --- a/indra/newview/llfolderview.h +++ b/indra/newview/llfolderview.h @@ -191,6 +191,7 @@ public: BOOL check(LLFolderViewItem* item); std::string::size_type getStringMatchOffset() const; BOOL isActive(); + BOOL isNotDefault(); BOOL isModified(); BOOL isModifiedAndClear(); BOOL isSinceLogoff(); @@ -678,7 +679,7 @@ public: PermissionMask getFilterPermissions() const { return mFilter.getFilterPermissions(); } LLInventoryFilter::EFolderShow getShowFolderState() { return mFilter.getShowFolderState(); } U32 getSortOrder() const; - BOOL isFilterActive() { return mFilter.isActive(); } + BOOL isFilterModified() { return mFilter.isNotDefault(); } BOOL getAllowMultiSelect() { return mAllowMultiSelect; } // Close all folders in the view diff --git a/indra/newview/llimpanel.cpp b/indra/newview/llimpanel.cpp index 83c08ec602..9ab9a3f6bb 100644 --- a/indra/newview/llimpanel.cpp +++ b/indra/newview/llimpanel.cpp @@ -570,7 +570,7 @@ void LLFloaterIMPanel::onInputEditorFocusReceived( LLUICtrl* caller, void* userd } // static -void LLFloaterIMPanel::onInputEditorFocusLost(LLLineEditor* caller, void* userdata) +void LLFloaterIMPanel::onInputEditorFocusLost(LLUICtrl* caller, void* userdata) { LLFloaterIMPanel* self = (LLFloaterIMPanel*) userdata; self->setTyping(FALSE); diff --git a/indra/newview/llimpanel.h b/indra/newview/llimpanel.h index d54ac794b7..21a0cbcd41 100644 --- a/indra/newview/llimpanel.h +++ b/indra/newview/llimpanel.h @@ -59,7 +59,7 @@ public: LLString& tooltip_msg); static void onInputEditorFocusReceived( LLUICtrl* caller, void* userdata ); - static void onInputEditorFocusLost(LLLineEditor* caller, void* userdata); + static void onInputEditorFocusLost(LLUICtrl* caller, void* userdata); static void onInputEditorKeystroke(LLLineEditor* caller, void* userdata); static void onTabClick( void* userdata ); diff --git a/indra/newview/lljoystickbutton.cpp b/indra/newview/lljoystickbutton.cpp index a9b5e6e124..ce6c85d3fd 100644 --- a/indra/newview/lljoystickbutton.cpp +++ b/indra/newview/lljoystickbutton.cpp @@ -115,7 +115,7 @@ BOOL LLJoystick::handleMouseUp(S32 x, S32 y, MASK mask) { // llinfos << "joystick mouse up " << x << ", " << y << llendl; - if( gViewerWindow->hasMouseCapture( this ) ) + if( hasMouseCapture() ) { mLastMouse.set(x, y); mHeldDown = FALSE; @@ -128,7 +128,7 @@ BOOL LLJoystick::handleMouseUp(S32 x, S32 y, MASK mask) BOOL LLJoystick::handleHover(S32 x, S32 y, MASK mask) { - if( gViewerWindow->hasMouseCapture( this ) ) + if( hasMouseCapture() ) { mLastMouse.set(x, y); } @@ -153,7 +153,9 @@ void LLJoystick::onHeldDown(void *userdata) { LLJoystick *self = (LLJoystick *)userdata; - llassert( gViewerWindow->hasMouseCapture( self ) ); + // somebody removed this function without checking the + // build. Removed 2007-03-26. + //llassert( gViewerWindow->hasMouseCapture( self ) ); self->mHeldDown = TRUE; self->onHeldDown(); diff --git a/indra/newview/llnameeditor.cpp b/indra/newview/llnameeditor.cpp index ade4cf3473..923cd99d21 100644 --- a/indra/newview/llnameeditor.cpp +++ b/indra/newview/llnameeditor.cpp @@ -30,7 +30,7 @@ LLNameEditor::LLNameEditor(const std::string& name, const LLRect& rect, S32 max_text_length, void (*commit_callback)(LLUICtrl* caller, void* user_data), void (*keystroke_callback)(LLLineEditor* caller, void* user_data), - void (*focus_lost_callback)(LLLineEditor* caller, void* user_data), + void (*focus_lost_callback)(LLUICtrl* caller, void* user_data), void* userdata, LLLinePrevalidateFunc prevalidate_func, LLViewBorder::EBevel border_bevel, diff --git a/indra/newview/llnameeditor.h b/indra/newview/llnameeditor.h index b5e811fba4..b6ea2e7728 100644 --- a/indra/newview/llnameeditor.h +++ b/indra/newview/llnameeditor.h @@ -30,7 +30,7 @@ public: S32 max_text_length = 254, void (*commit_callback)(LLUICtrl* caller, void* user_data) = NULL, void (*keystroke_callback)(LLLineEditor* caller, void* user_data) = NULL, - void (*focus_lost_callback)(LLLineEditor* caller, void* user_data) = NULL, + void (*focus_lost_callback)(LLUICtrl* caller, void* user_data) = NULL, void* userdata = NULL, LLLinePrevalidateFunc prevalidate_func = NULL, LLViewBorder::EBevel border_bevel = LLViewBorder::BEVEL_IN, diff --git a/indra/newview/llnamelistctrl.cpp b/indra/newview/llnamelistctrl.cpp index ddf88c94df..eabb9e0b23 100644 --- a/indra/newview/llnamelistctrl.cpp +++ b/indra/newview/llnamelistctrl.cpp @@ -158,6 +158,13 @@ BOOL LLNameListCtrl::addNameItem(LLScrollListItem* item, EAddPosition pos) addItem(item, pos); + // this column is resizable + LLScrollListColumn* columnp = getColumn(mNameColumnIndex); + if (columnp && columnp->mHeader) + { + columnp->mHeader->setHasResizableElement(TRUE); + } + return result; } @@ -178,6 +185,15 @@ LLScrollListItem* LLNameListCtrl::addElement(const LLSD& value, EAddPosition pos LLScrollListCell* cell = (LLScrollListCell*)item->getColumn(mNameColumnIndex); ((LLScrollListText*)cell)->setText( fullname ); + updateMaxContentWidth(item); + + // this column is resizable + LLScrollListColumn* columnp = getColumn(mNameColumnIndex); + if (columnp && columnp->mHeader) + { + columnp->mHeader->setHasResizableElement(TRUE); + } + return item; } @@ -222,6 +238,7 @@ void LLNameListCtrl::refresh(const LLUUID& id, const char* first, cell = (LLScrollListCell*)item->getColumn(mNameColumnIndex); ((LLScrollListText*)cell)->setText( fullname ); + updateMaxContentWidth(item); } } } @@ -299,13 +316,6 @@ LLView* LLNameListCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFacto node->getAttributeS32("heading_height", heading_height); name_list->setHeadingHeight(heading_height); } - if (node->hasAttribute("heading_font")) - { - LLString heading_font(""); - node->getAttributeString("heading_font", heading_font); - LLFontGL* gl_font = LLFontGL::fontFromName(heading_font.c_str()); - name_list->setHeadingFont(gl_font); - } name_list->setCollapseEmptyColumns(collapse_empty_columns); BOOL allow_calling_card_drop = FALSE; @@ -344,8 +354,12 @@ LLView* LLNameListCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFacto columns[index]["width"] = columnwidth; } + LLFontGL::HAlign h_align = LLFontGL::LEFT; + h_align = LLView::selectFontHAlign(child); + columns[index]["name"] = columnname; columns[index]["label"] = labelname; + columns[index]["halign"] = (S32)h_align; index++; } } diff --git a/indra/newview/llnetmap.cpp b/indra/newview/llnetmap.cpp index b03996d460..1050070f81 100644 --- a/indra/newview/llnetmap.cpp +++ b/indra/newview/llnetmap.cpp @@ -255,12 +255,10 @@ void LLNetMap::draw() // figure out where agent is S32 region_width = llround(gWorldPointer->getRegionWidthInMeters()); - LLViewerRegion *regionp; - - for (regionp = gWorldPointer->mActiveRegionList.getFirstData(); - regionp; - regionp = gWorldPointer->mActiveRegionList.getNextData()) + for (LLWorld::region_list_t::iterator iter = gWorldp->mActiveRegionList.begin(); + iter != gWorldp->mActiveRegionList.end(); ++iter) { + LLViewerRegion* regionp = *iter; // Find x and y position relative to camera's center. LLVector3 origin_agent = regionp->getOriginAgent(); LLVector3 rel_region_pos = origin_agent - gAgent.getCameraPositionAgent(); @@ -374,10 +372,10 @@ void LLNetMap::draw() LLVector3 pos_map; // Draw avatars - for (regionp = gWorldPointer->mActiveRegionList.getFirstData(); - regionp; - regionp = gWorldPointer->mActiveRegionList.getNextData()) + for (LLWorld::region_list_t::iterator iter = gWorldp->mActiveRegionList.begin(); + iter != gWorldp->mActiveRegionList.end(); ++iter) { + LLViewerRegion* regionp = *iter; const LLVector3d& origin_global = regionp->getOriginGlobal(); S32 count = regionp->mMapAvatars.count(); diff --git a/indra/newview/llpanelavatar.cpp b/indra/newview/llpanelavatar.cpp index ce9f6b18b2..05bd59593d 100644 --- a/indra/newview/llpanelavatar.cpp +++ b/indra/newview/llpanelavatar.cpp @@ -59,7 +59,7 @@ #include "llvieweruictrlfactory.h" // Statics -LLLinkedList<LLPanelAvatar> LLPanelAvatar::sAllPanels; +std::list<LLPanelAvatar*> LLPanelAvatar::sAllPanels; BOOL LLPanelAvatar::sAllowFirstLife = FALSE; //----------------------------------------------------------------------------- @@ -1220,7 +1220,7 @@ LLPanelAvatar::LLPanelAvatar( mDisableRate(FALSE) { - sAllPanels.addData(this); + sAllPanels.push_back(this); LLCallbackMap::map_t factory_map; @@ -1272,7 +1272,7 @@ BOOL LLPanelAvatar::postBuild(void) LLPanelAvatar::~LLPanelAvatar() { - sAllPanels.removeData(this); + sAllPanels.remove(this); } @@ -1503,7 +1503,6 @@ void LLPanelAvatar::resetGroupList() if (mPanelSecondLife && group_list) { group_list->deleteAllItems(); - LLScrollListItem* item; S32 count = gAgent.mGroups.count(); LLUUID id; @@ -1525,9 +1524,12 @@ void LLPanelAvatar::resetGroupList() */ group_string += group_data.mName; - item = new LLScrollListItem(TRUE, NULL, id); - item->addColumn(group_string, LLFontGL::sSansSerifSmall, 0, LLFontGL::NORMAL); - group_list->addItem(item); + + LLSD row; + row["columns"][0]["value"] = group_string; + row["columns"][0]["font"] = "SANSSERIF_SMALL"; + row["columns"][0]["width"] = 0; + group_list->addElement(row); } group_list->sortByColumn(0, TRUE); } @@ -1728,8 +1730,6 @@ void LLPanelAvatar::sendAvatarNotesUpdate() // static void LLPanelAvatar::processAvatarPropertiesReply(LLMessageSystem *msg, void**) { - LLPanelAvatar* self = NULL; - LLUUID agent_id; // your id LLUUID avatar_id; // target of this panel LLUUID image_id; @@ -1753,8 +1753,9 @@ void LLPanelAvatar::processAvatarPropertiesReply(LLMessageSystem *msg, void**) msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id); msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AvatarID, avatar_id ); - for (self = sAllPanels.getFirstData(); self; self = sAllPanels.getNextData()) + for (panel_list_t::iterator iter = sAllPanels.begin(); iter != sAllPanels.end(); ++iter) { + LLPanelAvatar* self = *iter; if (self->mAvatarID != avatar_id) { continue; @@ -1876,8 +1877,6 @@ void LLPanelAvatar::processAvatarPropertiesReply(LLMessageSystem *msg, void**) // static void LLPanelAvatar::processAvatarInterestsReply(LLMessageSystem *msg, void**) { - LLPanelAvatar* self = NULL; - LLUUID agent_id; // your id LLUUID avatar_id; // target of this panel @@ -1892,8 +1891,9 @@ void LLPanelAvatar::processAvatarInterestsReply(LLMessageSystem *msg, void**) msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id); msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AvatarID, avatar_id ); - for (self = sAllPanels.getFirstData(); self; self = sAllPanels.getNextData()) + for (panel_list_t::iterator iter = sAllPanels.begin(); iter != sAllPanels.end(); ++iter) { + LLPanelAvatar* self = *iter; if (self->mAvatarID != avatar_id) { continue; @@ -1921,15 +1921,15 @@ void LLPanelAvatar::processAvatarGroupsReply(LLMessageSystem *msg, void**) LLUUID group_id; char group_name[DB_GROUP_NAME_BUF_SIZE]; /*Flawfinder: ignore*/ LLUUID group_insignia_id; - const LLFontGL* FONT = LLFontGL::sSansSerifSmall; llinfos << "groups packet size " << msg->getReceiveSize() << llendl; msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id); msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AvatarID, avatar_id ); - for (LLPanelAvatar* self = sAllPanels.getFirstData(); self; self = sAllPanels.getNextData()) + for (panel_list_t::iterator iter = sAllPanels.begin(); iter != sAllPanels.end(); ++iter) { + LLPanelAvatar* self = *iter; if (self->mAvatarID != avatar_id) { continue; @@ -1977,9 +1977,15 @@ void LLPanelAvatar::processAvatarGroupsReply(LLMessageSystem *msg, void**) group_list->deleteSingleItem(index); } } - LLScrollListItem *group_item = new LLScrollListItem(TRUE, NULL, group_id); - group_item->addColumn(group_string, FONT); - if(group_list) group_list->addItem(group_item); + + LLSD row; + row["id"] = group_id; + row["columns"][0]["value"] = group_string; + row["columns"][0]["font"] = "SANSSERIF_SMALL"; + if (group_list) + { + group_list->addElement(row); + } } } if(group_list) group_list->sortByColumn(0, TRUE); @@ -2107,10 +2113,9 @@ void LLPanelAvatar::processAvatarStatisticsReply(LLMessageSystem *msg, void**) msg->getUUIDFast(_PREHASH_AvatarData, _PREHASH_AvatarID, avatar_id); // look up all panels which have this avatar - LLPanelAvatar *self = NULL; - - for (self = sAllPanels.getFirstData(); self; self = sAllPanels.getNextData()) + for (panel_list_t::iterator iter = sAllPanels.begin(); iter != sAllPanels.end(); ++iter) { + LLPanelAvatar* self = *iter; if (self->mAvatarID != avatar_id) { continue; @@ -2126,8 +2131,6 @@ void LLPanelAvatar::processAvatarStatisticsReply(LLMessageSystem *msg, void**) ratings_list->deleteAllItems(); } // build the item list - LLFontGL *font = LLFontGL::sSansSerifSmall; - S32 items = msg->getNumberOfBlocksFast(_PREHASH_StatisticsData); for (S32 i = 0; i < items; i++) { @@ -2141,18 +2144,22 @@ void LLPanelAvatar::processAvatarStatisticsReply(LLMessageSystem *msg, void**) msg->getS32( "StatisticsData", "Positive", positive, i); msg->getS32( "StatisticsData", "Negative", negative, i); - LLScrollListItem *item = NULL; - const S32 TEXT_WIDTH = 75; - item = new LLScrollListItem(); - item->addColumn( name, font, TEXT_WIDTH ); - - snprintf( value_string, sizeof(value_string), "+%d", positive); /* Flawfinder: ignore */ - item->addColumn( value_string, font, 50 ); - - item->addColumn("", font); // extra column to force striped appearance - if(ratings_list) ratings_list->addItem( item ); + LLSD row; + row["columns"][0]["value"] = name; + row["columns"][0]["font"] = "SANSSERIF_SMALL"; + row["columns"][0]["width"] = TEXT_WIDTH; + row["columns"][1]["value"] = value_string; + row["columns"][1]["font"] = "SANSSERIF_SMALL"; + row["columns"][1]["width"] = 50; + row["columns"][2]["value"] = ""; + row["columns"][2]["font"] = "SANSSERIF_SMALL"; + + if(ratings_list) + { + ratings_list->addElement( row ); + } } } } @@ -2168,10 +2175,9 @@ void LLPanelAvatar::processAvatarNotesReply(LLMessageSystem *msg, void**) msg->getUUID("Data", "TargetID", target_id); // look up all panels which have this avatar - LLPanelAvatar *self = NULL; - - for (self = sAllPanels.getFirstData(); self; self = sAllPanels.getNextData()) + for (panel_list_t::iterator iter = sAllPanels.begin(); iter != sAllPanels.end(); ++iter) { + LLPanelAvatar* self = *iter; if (self->mAvatarID != target_id) { continue; @@ -2187,7 +2193,6 @@ void LLPanelAvatar::processAvatarNotesReply(LLMessageSystem *msg, void**) void LLPanelAvatar::processAvatarClassifiedReply(LLMessageSystem *msg, void** userdata) { - LLPanelAvatar *self = NULL; LLUUID agent_id; LLUUID target_id; @@ -2195,8 +2200,9 @@ void LLPanelAvatar::processAvatarClassifiedReply(LLMessageSystem *msg, void** us msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_TargetID, target_id); // look up all panels which have this avatar target - for (self = sAllPanels.getFirstData(); self; self = sAllPanels.getNextData()) + for (panel_list_t::iterator iter = sAllPanels.begin(); iter != sAllPanels.end(); ++iter) { + LLPanelAvatar* self = *iter; if (self->mAvatarID != target_id) { continue; @@ -2208,7 +2214,6 @@ void LLPanelAvatar::processAvatarClassifiedReply(LLMessageSystem *msg, void** us void LLPanelAvatar::processAvatarPicksReply(LLMessageSystem *msg, void** userdata) { - LLPanelAvatar *self = NULL; LLUUID agent_id; LLUUID target_id; @@ -2216,8 +2221,9 @@ void LLPanelAvatar::processAvatarPicksReply(LLMessageSystem *msg, void** userdat msg->getUUID("AgentData", "TargetID", target_id); // look up all panels which have this avatar target - for (self = sAllPanels.getFirstData(); self; self = sAllPanels.getNextData()) + for (panel_list_t::iterator iter = sAllPanels.begin(); iter != sAllPanels.end(); ++iter) { + LLPanelAvatar* self = *iter; if (self->mAvatarID != target_id) { continue; diff --git a/indra/newview/llpanelavatar.h b/indra/newview/llpanelavatar.h index 9b1f6e23e1..be6feebc30 100644 --- a/indra/newview/llpanelavatar.h +++ b/indra/newview/llpanelavatar.h @@ -339,7 +339,8 @@ protected: BOOL mAllowEdit; BOOL mDisableRate; - static LLLinkedList<LLPanelAvatar> sAllPanels; + typedef std::list<LLPanelAvatar*> panel_list_t; + static panel_list_t sAllPanels; }; // helper funcs diff --git a/indra/newview/llpanelclassified.cpp b/indra/newview/llpanelclassified.cpp index f1aed81df1..5c5e0479d4 100644 --- a/indra/newview/llpanelclassified.cpp +++ b/indra/newview/llpanelclassified.cpp @@ -72,7 +72,7 @@ public: static LLDispatchClassifiedClickThrough sClassifiedClickThrough; //static -LLLinkedList<LLPanelClassified> LLPanelClassified::sAllPanels; +std::list<LLPanelClassified*> LLPanelClassified::sAllPanels; LLPanelClassified::LLPanelClassified(BOOL in_finder) : LLPanel("Classified Panel"), @@ -99,7 +99,7 @@ LLPanelClassified::LLPanelClassified(BOOL in_finder) mSetBtn(NULL), mClickThroughText(NULL) { - sAllPanels.addData(this); + sAllPanels.push_back(this); std::string classified_def_file; if (mInFinder) @@ -119,7 +119,7 @@ LLPanelClassified::LLPanelClassified(BOOL in_finder) LLPanelClassified::~LLPanelClassified() { - sAllPanels.removeData(this); + sAllPanels.remove(this); } @@ -300,9 +300,9 @@ void LLPanelClassified::setClickThrough(const LLUUID& classified_id, S32 map, S32 profile) { - LLPanelClassified *self = NULL; - for (self = sAllPanels.getFirstData(); self; self = sAllPanels.getNextData()) - { + for (panel_list_t::iterator iter = sAllPanels.begin(); iter != sAllPanels.end(); ++iter) + { + LLPanelClassified* self = *iter; // For top picks, must match pick id if (self->mClassifiedID != classified_id) { @@ -483,9 +483,9 @@ void LLPanelClassified::processClassifiedInfoReply(LLMessageSystem *msg, void ** msg->getS32("Data", "PriceForListing", price_for_listing); // Look up the panel to fill in - LLPanelClassified *self = NULL; - for (self = sAllPanels.getFirstData(); self; self = sAllPanels.getNextData()) - { + for (panel_list_t::iterator iter = sAllPanels.begin(); iter != sAllPanels.end(); ++iter) + { + LLPanelClassified* self = *iter; // For top picks, must match pick id if (self->mClassifiedID != classified_id) { diff --git a/indra/newview/llpanelclassified.h b/indra/newview/llpanelclassified.h index 6d5be1df09..c959c0f82f 100644 --- a/indra/newview/llpanelclassified.h +++ b/indra/newview/llpanelclassified.h @@ -123,7 +123,8 @@ protected: LLTextBox* mClickThroughText; LLRect mSnapshotSize; - static LLLinkedList<LLPanelClassified> sAllPanels; + typedef std::list<LLPanelClassified*> panel_list_t; + static panel_list_t sAllPanels; }; diff --git a/indra/newview/llpanelgroupgeneral.cpp b/indra/newview/llpanelgroupgeneral.cpp index 56c97d0689..9d40357544 100644 --- a/indra/newview/llpanelgroupgeneral.cpp +++ b/indra/newview/llpanelgroupgeneral.cpp @@ -683,12 +683,14 @@ void LLPanelGroupGeneral::update(LLGroupChange gc) } else { - LLScrollListItem* row = new LLScrollListItem( TRUE, NULL, LLUUID::null ); std::stringstream pending; pending << "Retrieving member list (" << gdatap->mMembers.size() << "\\" << gdatap->mMemberCount << ")"; - row->addColumn(pending.str(), LLFontGL::sSansSerif); + + LLSD row; + row["columns"][0]["value"] = pending.str(); + mListVisibleMembers->setEnabled(FALSE); - mListVisibleMembers->addItem(row); + mListVisibleMembers->addElement(row); } } } diff --git a/indra/newview/llpanelgroupinvite.cpp b/indra/newview/llpanelgroupinvite.cpp index 231551a756..12ac66e9fb 100644 --- a/indra/newview/llpanelgroupinvite.cpp +++ b/indra/newview/llpanelgroupinvite.cpp @@ -99,11 +99,11 @@ void LLPanelGroupInvite::impl::addUsers(const std::vector<std::string>& names, } //add the name to the names list - const BOOL enabled = TRUE; - LLScrollListItem* row = new LLScrollListItem( - enabled, NULL, id); - row->addColumn(name.c_str(), LLFontGL::sSansSerif); - mInvitees->addItem(row); + LLSD row; + row["id"] = id; + row["columns"][0]["value"] = name; + + mInvitees->addElement(row); } } diff --git a/indra/newview/llpanelpick.cpp b/indra/newview/llpanelpick.cpp index c60a69eb21..a05f7c54c6 100644 --- a/indra/newview/llpanelpick.cpp +++ b/indra/newview/llpanelpick.cpp @@ -36,7 +36,7 @@ #include "llviewerwindow.h" //static -LLLinkedList<LLPanelPick> LLPanelPick::sAllPanels; +std::list<LLPanelPick*> LLPanelPick::sAllPanels; LLPanelPick::LLPanelPick(BOOL top_pick) : LLPanel("Top Picks Panel"), @@ -59,7 +59,7 @@ LLPanelPick::LLPanelPick(BOOL top_pick) mEnabledCheck(NULL), mSetBtn(NULL) { - sAllPanels.addData(this); + sAllPanels.push_back(this); std::string pick_def_file; if (top_pick) @@ -75,7 +75,7 @@ LLPanelPick::LLPanelPick(BOOL top_pick) LLPanelPick::~LLPanelPick() { - sAllPanels.removeData(this); + sAllPanels.remove(this); } @@ -315,9 +315,9 @@ void LLPanelPick::processPickInfoReply(LLMessageSystem *msg, void **) msg->getBOOL("Data", "Enabled", enabled); // Look up the panel to fill in - LLPanelPick *self = NULL; - for (self = sAllPanels.getFirstData(); self; self = sAllPanels.getNextData()) - { + for (panel_list_t::iterator iter = sAllPanels.begin(); iter != sAllPanels.end(); ++iter) + { + LLPanelPick* self = *iter; // For top picks, must match pick id if (self->mPickID != pick_id) { diff --git a/indra/newview/llpanelpick.h b/indra/newview/llpanelpick.h index bdc7ef1f3e..a347133be6 100644 --- a/indra/newview/llpanelpick.h +++ b/indra/newview/llpanelpick.h @@ -93,7 +93,8 @@ protected: LLCheckBoxCtrl* mEnabledCheck; LLButton* mSetBtn; - static LLLinkedList<LLPanelPick> sAllPanels; + typedef std::list<LLPanelPick*> panel_list_t; + static panel_list_t sAllPanels; }; #endif // LL_LLPANELPICK_H diff --git a/indra/newview/llpanelplace.cpp b/indra/newview/llpanelplace.cpp index 905cc61560..d9c29fccdf 100644 --- a/indra/newview/llpanelplace.cpp +++ b/indra/newview/llpanelplace.cpp @@ -32,7 +32,7 @@ #include "llweb.h" //static -LLLinkedList<LLPanelPlace> LLPanelPlace::sAllPanels; +std::list<LLPanelPlace*> LLPanelPlace::sAllPanels; LLPanelPlace::LLPanelPlace() : LLPanel("Places Panel"), @@ -40,13 +40,13 @@ LLPanelPlace::LLPanelPlace() mPosGlobal(), mAuctionID(0) { - sAllPanels.addData(this); + sAllPanels.push_back(this); } LLPanelPlace::~LLPanelPlace() { - sAllPanels.removeData(this); + sAllPanels.remove(this); } @@ -139,10 +139,9 @@ void LLPanelPlace::processParcelInfoReply(LLMessageSystem *msg, void **) msg->getUUID("Data", "ParcelID", parcel_id); // look up all panels which have this avatar - LLPanelPlace *self = NULL; - - for (self = sAllPanels.getFirstData(); self; self = sAllPanels.getNextData()) + for (panel_list_t::iterator iter = sAllPanels.begin(); iter != sAllPanels.end(); ++iter) { + LLPanelPlace* self = *iter; if (self->mParcelID != parcel_id) { continue; diff --git a/indra/newview/llpanelplace.h b/indra/newview/llpanelplace.h index b45aef3e87..49dc518cc7 100644 --- a/indra/newview/llpanelplace.h +++ b/indra/newview/llpanelplace.h @@ -64,7 +64,8 @@ protected: //LLButton* mLandmarkBtn; LLButton* mAuctionBtn; - static LLLinkedList<LLPanelPlace> sAllPanels; + typedef std::list<LLPanelPlace*> panel_list_t; + static panel_list_t sAllPanels; }; #endif // LL_LLPANELPLACE_H diff --git a/indra/newview/llpreview.cpp b/indra/newview/llpreview.cpp index 91df61ca91..52ce263e59 100644 --- a/indra/newview/llpreview.cpp +++ b/indra/newview/llpreview.cpp @@ -309,7 +309,7 @@ BOOL LLPreview::handleMouseDown(S32 x, S32 y, MASK mask) // No handler needed for focus lost since this class has no // state that depends on it. bringToFront(x, y); - gFocusMgr.setMouseCapture(this, NULL); + gFocusMgr.setMouseCapture(this); S32 screen_x; S32 screen_y; localPointToScreen(x, y, &screen_x, &screen_y ); @@ -321,9 +321,9 @@ BOOL LLPreview::handleMouseDown(S32 x, S32 y, MASK mask) BOOL LLPreview::handleMouseUp(S32 x, S32 y, MASK mask) { - if(gFocusMgr.getMouseCapture() == this) + if(hasMouseCapture()) { - gFocusMgr.setMouseCapture(NULL, NULL); + gFocusMgr.setMouseCapture(NULL); return TRUE; } return LLFloater::handleMouseUp(x, y, mask); @@ -331,7 +331,7 @@ BOOL LLPreview::handleMouseUp(S32 x, S32 y, MASK mask) BOOL LLPreview::handleHover(S32 x, S32 y, MASK mask) { - if(gFocusMgr.getMouseCapture() == this) + if(hasMouseCapture()) { S32 screen_x; S32 screen_y; diff --git a/indra/newview/llpreviewgesture.cpp b/indra/newview/llpreviewgesture.cpp index 6a6b07425f..39e32c31f5 100644 --- a/indra/newview/llpreviewgesture.cpp +++ b/indra/newview/llpreviewgesture.cpp @@ -1023,11 +1023,11 @@ void LLPreviewGesture::loadUIFromGesture(LLMultiGesture* gesture) if (!new_step) continue; // Create an enabled item with this step - LLScrollListItem* item = new LLScrollListItem(TRUE, new_step); - item->addColumn(new_step->getLabel(), LLFontGL::sSansSerifSmall); - - // Add item to bottom of list - mStepList->addItem(item, ADD_BOTTOM); + LLSD row; + row["columns"][0]["value"] = new_step->getLabel(); + row["columns"][0]["font"] = "SANSSERIF_SMALL"; + LLScrollListItem* item = mStepList->addElement(row); + item->setUserdata(new_step); } } @@ -1572,12 +1572,11 @@ LLScrollListItem* LLPreviewGesture::addStep(const std::string& library_text) } // Create an enabled item with this step - LLScrollListItem* step_item = new LLScrollListItem(TRUE, step); - std::string label = step->getLabel(); - step_item->addColumn(label, LLFontGL::sSansSerifSmall); - - // Add item to bottom of list - mStepList->addItem(step_item, ADD_BOTTOM); + LLSD row; + row["columns"][0]["value"] = step->getLabel(); + row["columns"][0]["font"] = "SANSSERIF_SMALL"; + LLScrollListItem* step_item = mStepList->addElement(row); + step_item->setUserdata(step); // And move selection to the list on the right mLibraryList->deselectAllItems(); diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp index 51ca007d75..97b4a982d2 100644 --- a/indra/newview/llpreviewscript.cpp +++ b/indra/newview/llpreviewscript.cpp @@ -859,15 +859,14 @@ void LLPreviewLSL::callbackLSLCompileFailed(const LLSD& compile_errors) { llinfos << "Compile failed!" << llendl; - const LLFontGL* err_font = gResMgr->getRes(LLFONT_OCRA); - LLScrollListItem* item = NULL; for(LLSD::array_const_iterator line = compile_errors.beginArray(); line < compile_errors.endArray(); line++) { - item = new LLScrollListItem(); - item->addColumn(line->asString(), err_font); - mScriptEd->mErrorList->addItem(item); + LLSD row; + row["columns"][0]["value"] = line->asString(); + row["columns"][0]["font"] = "OCRA"; + mScriptEd->mErrorList->addElement(row); } mScriptEd->selectFirstError(); closeIfNeeded(); @@ -992,9 +991,11 @@ void LLPreviewLSL::saveIfNeeded() if(!fp) { llwarns << "Unable to write to " << filename << llendl; - LLScrollListItem* item = new LLScrollListItem(); - item->addColumn("Error writing to local file. Is your hard drive full?", LLFontGL::sSansSerifSmall); - mScriptEd->mErrorList->addItem(item); + + LLSD row; + row["columns"][0]["value"] = "Error writing to local file. Is your hard drive full?"; + row["columns"][0]["font"] = "SANSSERIF_SMALL"; + mScriptEd->mErrorList->addElement(row); return; } @@ -1049,8 +1050,6 @@ void LLPreviewLSL::uploadAssetLegacy(const std::string& filename, std::string dst_filename = llformat("%s.lso", filepath.c_str()); std::string err_filename = llformat("%s.out", filepath.c_str()); - LLScrollListItem* item = NULL; - const LLFontGL* err_font = gResMgr->getRes(LLFONT_OCRA); if(!lscript_compile(filename.c_str(), dst_filename.c_str(), err_filename.c_str(), @@ -1082,9 +1081,11 @@ void LLPreviewLSL::uploadAssetLegacy(const std::string& filename, { line.assign(buffer); LLString::stripNonprintable(line); - item = new LLScrollListItem(); - item->addColumn(line, err_font); - mScriptEd->mErrorList->addItem(item); + + LLSD row; + row["columns"][0]["value"] = line; + row["columns"][0]["font"] = "OCRA"; + mScriptEd->mErrorList->addElement(row); } } fclose(fp); @@ -1176,9 +1177,10 @@ void LLPreviewLSL::onSaveBytecodeComplete(const LLUUID& asset_uuid, void* user_d { if (self) { - LLScrollListItem* item = new LLScrollListItem(); - item->addColumn("Compile successful!", LLFontGL::sSansSerifSmall); - self->mScriptEd->mErrorList->addItem(item); + LLSD row; + row["columns"][0]["value"] = "Compile successful!"; + row["columns"][0]["font"] = "SANSSERIF_SMALL"; + self->mScriptEd->mErrorList->addElement(row); // Find our window and close it if requested. self->getWindow()->decBusyCount(); @@ -1399,15 +1401,14 @@ void LLLiveLSLEditor::callbackLSLCompileSucceeded(const LLUUID& task_id, void LLLiveLSLEditor::callbackLSLCompileFailed(const LLSD& compile_errors) { lldebugs << "Compile failed!" << llendl; - const LLFontGL* err_font = gResMgr->getRes(LLFONT_OCRA); - LLScrollListItem* item = NULL; for(LLSD::array_const_iterator line = compile_errors.beginArray(); line < compile_errors.endArray(); line++) { - item = new LLScrollListItem(); - item->addColumn(line->asString(), err_font); - mScriptEd->mErrorList->addItem(item); + LLSD row; + row["columns"][0]["value"] = line->asString(); + row["columns"][0]["font"] = "OCRA"; + mScriptEd->mErrorList->addElement(row); } mScriptEd->selectFirstError(); closeIfNeeded(); @@ -1769,9 +1770,11 @@ void LLLiveLSLEditor::saveIfNeeded() if(!fp) { llwarns << "Unable to write to " << filename << llendl; - LLScrollListItem* item = new LLScrollListItem(); - item->addColumn("Error writing to local file. Is your hard drive full?", LLFontGL::sSansSerifSmall); - mScriptEd->mErrorList->addItem(item); + + LLSD row; + row["columns"][0]["value"] = "Error writing to local file. Is your hard drive full?"; + row["columns"][0]["font"] = "SANSSERIF_SMALL"; + mScriptEd->mErrorList->addElement(row); return; } LLString utf8text = mScriptEd->mEditor->getText(); @@ -1829,8 +1832,6 @@ void LLLiveLSLEditor::uploadAssetLegacy(const std::string& filename, std::string dst_filename = llformat("%s.lso", filepath.c_str()); std::string err_filename = llformat("%s.out", filepath.c_str()); - LLScrollListItem* item = NULL; - const LLFontGL* err_font = gResMgr->getRes(LLFONT_OCRA); FILE *fp; if(!lscript_compile(filename.c_str(), dst_filename.c_str(), @@ -1859,9 +1860,11 @@ void LLLiveLSLEditor::uploadAssetLegacy(const std::string& filename, { line.assign(buffer); LLString::stripNonprintable(line); - item = new LLScrollListItem(); - item->addColumn(line, err_font); - mScriptEd->mErrorList->addItem(item); + + LLSD row; + row["columns"][0]["value"] = line; + row["columns"][0]["font"] = "OCRA"; + mScriptEd->mErrorList->addElement(row); } } fclose(fp); diff --git a/indra/newview/llprogressview.cpp b/indra/newview/llprogressview.cpp index 1172bd8cf0..3bfe913ab4 100644 --- a/indra/newview/llprogressview.cpp +++ b/indra/newview/llprogressview.cpp @@ -42,7 +42,7 @@ const S32 ANIMATION_FRAMES = 1; //13; // XUI:translate LLProgressView::LLProgressView(const std::string& name, const LLRect &rect) -: LLView(name, rect, TRUE) +: LLPanel(name, rect, FALSE) { mPercentDone = 0.f; mDrawBackground = TRUE; @@ -119,7 +119,7 @@ void LLProgressView::setVisible(BOOL visible) } else if (!getVisible() && visible) { - gFocusMgr.setTopView(this, NULL); + gFocusMgr.setTopCtrl(this); mFadeTimer.stop(); mProgressTimer.start(); LLView::setVisible(visible); @@ -183,7 +183,7 @@ void LLProgressView::draw() LLView::draw(); if (mFadeTimer.getElapsedTimeF32() > FADE_IN_TIME) { - gFocusMgr.removeTopViewWithoutCallback(this); + gFocusMgr.removeTopCtrlWithoutCallback(this); LLView::setVisible(FALSE); gStartImageGL = NULL; } diff --git a/indra/newview/llprogressview.h b/indra/newview/llprogressview.h index 474a431b09..455256a665 100644 --- a/indra/newview/llprogressview.h +++ b/indra/newview/llprogressview.h @@ -9,13 +9,13 @@ #ifndef LL_LLPROGRESSVIEW_H #define LL_LLPROGRESSVIEW_H -#include "llview.h" +#include "llpanel.h" #include "llframetimer.h" class LLImageRaw; class LLButton; -class LLProgressView : public LLView +class LLProgressView : public LLPanel { public: LLProgressView(const std::string& name, const LLRect& rect); diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp index c14b4461d6..a38bfc3600 100644 --- a/indra/newview/llselectmgr.cpp +++ b/indra/newview/llselectmgr.cpp @@ -133,8 +133,8 @@ struct LLDeRezInfo LLObjectSelection* get_null_object_selection() { - static LLObjectSelectionHandle null_ptr(new LLObjectSelection()); - return (LLObjectSelection*)null_ptr; + static LLObjectSelection null_selection; + return &null_selection;; } diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp index 98b4c4ef42..d8d9f1c5d6 100644 --- a/indra/newview/llspatialpartition.cpp +++ b/indra/newview/llspatialpartition.cpp @@ -140,11 +140,6 @@ void LLSpatialGroup::clearDrawMap() mDrawMap.clear(); } -BOOL LLSpatialGroup::safeToDelete() -{ - return gQuit || !isState(IN_QUEUE | ACTIVE_OCCLUSION | RESHADOW_QUEUE); -} - class LLRelightPainter : public LLSpatialGroup::OctreeTraveler { public: @@ -330,7 +325,6 @@ BOOL LLSpatialGroup::updateInGroup(LLDrawable *drawablep, BOOL immediate) unbound(); setState(OBJECT_DIRTY); setState(GEOM_DIRTY); - gPipeline.markRebuild(this); validate_drawable(drawablep); return TRUE; } @@ -351,13 +345,15 @@ BOOL LLSpatialGroup::addObject(LLDrawable *drawablep, BOOL add_all, BOOL from_oc drawablep->setSpatialGroup(this, 0); validate_drawable(drawablep); setState(OBJECT_DIRTY | GEOM_DIRTY); - gPipeline.markRebuild(this); mLastAddTime = gFrameTimeSeconds; if (drawablep->isSpatialBridge()) { mBridgeList.push_back((LLSpatialBridge*) drawablep); } - setState(IMAGE_DIRTY); + if (drawablep->getRadius() > 1.f) + { + setState(IMAGE_DIRTY); + } } return TRUE; @@ -560,7 +556,6 @@ BOOL LLSpatialGroup::removeObject(LLDrawable *drawablep, BOOL from_octree) { drawablep->setSpatialGroup(NULL, -1); setState(GEOM_DIRTY); - gPipeline.markRebuild(this); if (drawablep->isSpatialBridge()) { for (bridge_list_t::iterator i = mBridgeList.begin(); i != mBridgeList.end(); ++i) @@ -589,7 +584,6 @@ void LLSpatialGroup::shift(const LLVector3 &offset) mObjectExtents[0] += offset; mObjectExtents[1] += offset; - gPipeline.markRebuild(this); setState(GEOM_DIRTY | MATRIX_DIRTY | OCCLUSION_DIRTY); } @@ -1610,66 +1604,6 @@ BOOL earlyFail(LLCamera* camera, LLSpatialGroup* group) return TRUE; } -void LLSpatialPartition::processGeometry(LLCamera* camera) -{ - if (!mRenderByGroup || mBufferUsage == GL_STREAM_DRAW_ARB) - { - return; - } - - U32 process_count = 8; - - LLSpatialGroup* root = (LLSpatialGroup*) mOctree->getListener(0); - if (mUpdateQueue.empty()) - { - root->setState(LLSpatialGroup::IN_GEOMETRY_QUEUE); - mUpdateQueue.push(root); - } - - while (process_count > 0 && !mUpdateQueue.empty()) - { - process_count--; - LLPointer<LLSpatialGroup> group = mUpdateQueue.front(); - mUpdateQueue.pop(); - - group->clearState(LLSpatialGroup::IN_GEOMETRY_QUEUE); - - if (group->isDead()) - { - continue; - } - - //push children onto queue - for (U32 i = 0; i < group->mOctreeNode->getChildCount(); i++) - { - LLSpatialGroup* child = (LLSpatialGroup*) group->mOctreeNode->getChild(i)->getListener(0); - - if (!child->isState(LLSpatialGroup::IN_GEOMETRY_QUEUE)) - { - child->setState(LLSpatialGroup::IN_GEOMETRY_QUEUE); - mUpdateQueue.push(child); - } - } - - if (!group->isDead() && !group->isVisible()) - { - if (!group->isState(LLSpatialGroup::OBJECT_DIRTY) && - group->mBufferUsage != GL_STREAM_DRAW_ARB) - { - group->updateDistance(*camera); - for (LLSpatialGroup::element_iter i = group->getData().begin(); i != group->getData().end(); ++i) - { - LLDrawable* drawablep = *i; - if (!drawablep->isDead()) - { - drawablep->updateDistance(*camera); - } - } - } - } - } -} - void LLSpatialPartition::markReimage(LLSpatialGroup* group) { if (mImageEnabled && group->isState(LLSpatialGroup::IMAGE_DIRTY)) @@ -1731,7 +1665,6 @@ void LLSpatialPartition::processImagery(LLCamera* camera) gPipeline.blurReflectionMap(gPipeline.mCubeBuffer, cube_map, res); group->mReflectionMap = cube_map; group->setState(LLSpatialGroup::GEOM_DIRTY); - gPipeline.markRebuild(group); } group->clearState(LLSpatialGroup::IMAGE_DIRTY); diff --git a/indra/newview/llspatialpartition.h b/indra/newview/llspatialpartition.h index 6a795d4c6c..c65f4063bf 100644 --- a/indra/newview/llspatialpartition.h +++ b/indra/newview/llspatialpartition.h @@ -134,9 +134,8 @@ public: SKIP_FRUSTUM_CHECK = 0x00040000, OCCLUSION_DIRTY = 0x00080000, BELOW_WATER = 0x00100000, - IN_GEOMETRY_QUEUE = 0x00200000, - IN_IMAGE_QUEUE = 0x00400000, - IMAGE_DIRTY = 0x00800000, + IN_IMAGE_QUEUE = 0x00200000, + IMAGE_DIRTY = 0x00400000, } eSpatialState; typedef enum @@ -147,7 +146,6 @@ public: } eSetStateMode; LLSpatialGroup(OctreeNode* node, LLSpatialPartition* part); - BOOL safeToDelete(); virtual ~LLSpatialGroup(); BOOL isDead() { return isState(DEAD); } @@ -265,7 +263,6 @@ public: S32 cull(LLCamera &camera, std::vector<LLDrawable *>* results = NULL, BOOL for_select = FALSE); // Cull on arbitrary frustum BOOL checkOcclusion(LLSpatialGroup* group, LLCamera* camera); void markReimage(LLSpatialGroup* group); - void processGeometry(LLCamera* camera); void processImagery(LLCamera* camera); void processOcclusion(LLCamera* camera); void buildOcclusion(); @@ -293,9 +290,6 @@ protected: typedef std::queue<LLPointer<LLSpatialGroup> > spatial_group_queue_t; spatial_group_queue_t mOcclusionQueue; - //things that need a terse update - spatial_group_queue_t mUpdateQueue; - //things that need an image update spatial_group_queue_t mImageQueue; diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 92f39f265e..f315869437 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -214,7 +214,7 @@ void callback_choose_gender(S32 option, void* userdata); void init_start_screen(S32 location_id); void release_start_screen(); void process_connect_to_userserver(LLMessageSystem* msg, void**); - +void reset_login(); // // exported functionality @@ -854,7 +854,7 @@ BOOL idle_startup() args["[HOST_NAME]"] = host_name; gViewerWindow->alertXml("UnableToConnect", args, login_alert_done ); - gStartupState = STATE_LOGIN_SHOW; + reset_login(); return FALSE; } break; @@ -891,7 +891,7 @@ BOOL idle_startup() login_alert_status, NULL); // Back up to login screen - gStartupState = STATE_LOGIN_SHOW; + reset_login(); gViewerStats->incStat(LLViewerStats::ST_LOGIN_TIMEOUT_COUNT); } ms_sleep(1); @@ -907,7 +907,7 @@ BOOL idle_startup() gViewerWindow->alertXml("PleaseSelectServer", args, login_alert_done ); - gStartupState = STATE_LOGIN_SHOW; + reset_login(); return FALSE; } @@ -1055,7 +1055,7 @@ BOOL idle_startup() NULL); // Back up to login screen - gStartupState = STATE_LOGIN_SHOW; + reset_login(); gViewerStats->incStat(LLViewerStats::ST_LOGIN_TIMEOUT_COUNT); } else @@ -1601,7 +1601,7 @@ BOOL idle_startup() LLStringBase<char>::format_map_t args; args["[ERROR_MESSAGE]"] = emsg.str(); gViewerWindow->alertXml("ErrorMessage", args, login_alert_done); - gStartupState = STATE_LOGIN_SHOW; + reset_login(); gAutoLogin = FALSE; show_connect_box = TRUE; } @@ -1618,7 +1618,7 @@ BOOL idle_startup() LLStringBase<char>::format_map_t args; args["[ERROR_MESSAGE]"] = emsg.str(); gViewerWindow->alertXml("ErrorMessage", args, login_alert_done); - gStartupState = STATE_LOGIN_SHOW; + reset_login(); gAutoLogin = FALSE; show_connect_box = TRUE; } @@ -2767,7 +2767,7 @@ void on_userserver_name_resolved( BOOL success, const LLString& host_name, U32 i LLStringBase<char>::format_map_t args; args["[HOST_NAME]"] = host_name; gViewerWindow->alertXml("SetByHostFail", args, login_alert_done ); - gStartupState = STATE_LOGIN_SHOW; + reset_login(); } } @@ -2869,7 +2869,7 @@ void update_dialog_callback(S32 option, void *userdata) { app_force_quit(); // Bump them back to the login screen. - //gStartupState = STATE_LOGIN_SHOW; + //reset_login(); } else { @@ -2997,7 +2997,7 @@ void use_circuit_callback(void**, S32 result) llinfos << "Backing up to login screen!" << llendl; gViewerWindow->alertXml("LoginPacketNeverReceived", login_alert_status, NULL); - gStartupState = STATE_LOGIN_SHOW; + reset_login(); } else { @@ -3918,4 +3918,9 @@ bool LLStartUp::canGoFullscreen() return gStartupState >= STATE_WORLD_INIT; } +void reset_login() +{ + gStartupState = STATE_LOGIN_SHOW; + // do cleanup here of in-world UI? +} diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp index 39feb40109..c732394b4e 100644 --- a/indra/newview/lltexturectrl.cpp +++ b/indra/newview/lltexturectrl.cpp @@ -802,7 +802,7 @@ void LLFloaterTexturePicker::onSearchEdit(const LLString& search_string, void* u else if (picker->mInventoryPanel->getFilterSubString().empty()) { // first letter in search term, save existing folder open state - if (!picker->mInventoryPanel->getRootFolder()->isFilterActive()) + if (!picker->mInventoryPanel->getRootFolder()->isFilterModified()) { picker->mSavedFolderState.setApply(FALSE); picker->mInventoryPanel->getRootFolder()->applyFunctorRecursively(picker->mSavedFolderState); diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp index a9f660a0f5..e8dc281c6f 100644 --- a/indra/newview/lltexturefetch.cpp +++ b/indra/newview/lltexturefetch.cpp @@ -379,10 +379,7 @@ LLTextureFetchWorker::LLTextureFetchWorker(LLTextureFetch* fetcher, { calcWorkPriority(); mType = host.isOk() ? LLImageBase::TYPE_AVATAR_BAKE : LLImageBase::TYPE_NORMAL; - if (host == LLHost::invalid) - { - mHost = gAgent.getRegionHost(); - } +// llinfos << "Create: " << mID << " mHost:" << host << " Discard=" << discard << llendl; if (!mFetcher->mDebugPause) { U32 work_priority = mWorkPriority | LLWorkerThread::PRIORITY_HIGH; @@ -393,6 +390,10 @@ LLTextureFetchWorker::LLTextureFetchWorker(LLTextureFetch* fetcher, LLTextureFetchWorker::~LLTextureFetchWorker() { +// llinfos << "Destroy: " << mID +// << " Decoded=" << mDecodedDiscard +// << " Requested=" << mRequestedDiscard +// << " Desired=" << mDesiredDiscard << llendl; llassert_always(!haveWork()); lockWorkData(); if (mCacheReadHandle != LLTextureCache::nullHandle()) @@ -423,6 +424,7 @@ void LLTextureFetchWorker::clearPackets() U32 LLTextureFetchWorker::calcWorkPriority() { +// llassert_always(mImagePriority >= 0 && mImagePriority <= LLViewerImage::maxDecodePriority()); F32 priority_scale = (F32)LLWorkerThread::PRIORITY_LOWBITS / LLViewerImage::maxDecodePriority(); mWorkPriority = (U32)(mImagePriority * priority_scale); return mWorkPriority; @@ -455,8 +457,9 @@ void LLTextureFetchWorker::setDesiredDiscard(S32 discard, S32 size) mDesiredSize = size; prioritize = true; } - if (prioritize && mState == INIT) + if ((prioritize && mState == INIT) || mState == DONE) { + mState = INIT; U32 work_priority = mWorkPriority | LLWorkerThread::PRIORITY_HIGH; setPriority(work_priority); } @@ -464,8 +467,9 @@ void LLTextureFetchWorker::setDesiredDiscard(S32 discard, S32 size) void LLTextureFetchWorker::setImagePriority(F32 priority) { +// llassert_always(priority >= 0 && priority <= LLViewerImage::maxDecodePriority()); F32 delta = fabs(priority - mImagePriority); - if (delta > (mImagePriority * .05f)) // 5% + if (delta > (mImagePriority * .05f) || mState == DONE) { mImagePriority = priority; calcWorkPriority(); @@ -530,7 +534,7 @@ bool LLTextureFetchWorker::doWork(S32 param) mBuffer = NULL; mBufferSize = 0; mHaveAllData = FALSE; - clearPackets(); + clearPackets(); // TODO: Shouldn't be necessary mCacheReadHandle = LLTextureCache::nullHandle(); mCacheWriteHandle = LLTextureCache::nullHandle(); mURL.clear(); @@ -893,7 +897,11 @@ bool LLTextureFetchWorker::doWork(S32 param) setPriority(LLWorkerThread::PRIORITY_HIGH | mWorkPriority); return false; } - return true; + else + { + setPriority(LLWorkerThread::PRIORITY_LOW | mWorkPriority); + return true; + } } return false; @@ -956,18 +964,14 @@ bool LLTextureFetchWorker::deleteOK() } } - const F32 MAX_IDLE_TIME = 5.f; - if ((mFetchTimer.getElapsedTimeF32() < MAX_IDLE_TIME)) - { - delete_ok = false; - } - else if ((haveWork() && - // not ok to delete from these states - ((mState >= LOAD_FROM_HTTP_GET_URL && mState <= LOAD_FROM_HTTP_GET_DATA) || - (mState >= WRITE_TO_CACHE && mState <= WAIT_ON_WRITE)))) + if ((haveWork() && + // not ok to delete from these states + ((mState >= LOAD_FROM_HTTP_GET_URL && mState <= LOAD_FROM_HTTP_GET_DATA) || + (mState >= WRITE_TO_CACHE && mState <= WAIT_ON_WRITE)))) { delete_ok = false; } + return delete_ok; } @@ -1246,20 +1250,24 @@ LLTextureFetch::~LLTextureFetch() bool LLTextureFetch::createRequest(const LLUUID& id, const LLHost& host, F32 priority, S32 w, S32 h, S32 c, S32 discard, bool needs_aux) { + if (mDebugPause) + { + return false; + } + LLTextureFetchWorker* worker = NULL; LLMutexLock lock(&mQueueMutex); map_t::iterator iter = mRequestMap.find(id); if (iter != mRequestMap.end()) { worker = iter->second; - LLHost host2 = host; - if (host2 == LLHost::invalid) host2 = gAgent.getRegionHost(); - if (worker->mHost != host2) + if (worker->mHost != host) { -// llwarns << "LLTextureFetch::createRequest " << id << " called with multiple hosts: " -// << host << " != " << host2 << llendl; + llwarns << "LLTextureFetch::createRequest " << id << " called with multiple hosts: " + << host << " != " << worker->mHost << llendl; removeRequest(worker, true); worker = NULL; + return false; } } // If the requester knows the dimentions of the image, @@ -1284,6 +1292,11 @@ bool LLTextureFetch::createRequest(const LLUUID& id, const LLHost& host, F32 pri worker->setImagePriority(priority); worker->setDesiredDiscard(discard, desired_size); worker->unlockWorkData(); + if (!worker->haveWork()) + { + worker->mState = LLTextureFetchWorker::INIT; + worker->addWork(0, LLWorkerThread::PRIORITY_HIGH | worker->mWorkPriority); + } } else { @@ -1317,7 +1330,11 @@ void LLTextureFetch::addToNetworkQueue(LLTextureFetchWorker* worker) // i.e. a delete has not been requested mNetworkQueue.insert(worker->mID); } - mCancelQueue[worker->mHost].erase(worker->mID); + for (cancel_queue_t::iterator iter1 = mCancelQueue.begin(); + iter1 != mCancelQueue.end(); ++iter1) + { + iter1->second.erase(worker->mID); + } } // call lockQueue() first! @@ -1368,6 +1385,7 @@ bool LLTextureFetch::getRequestFinished(const LLUUID& id, S32& discard_level, // Should only happen if we set mDebugPause... if (!mDebugPause) { +// llwarns << "Adding work for inactive worker: " << id << llendl; worker->addWork(0, LLWorkerThread::PRIORITY_HIGH | worker->mWorkPriority); } } @@ -1451,9 +1469,15 @@ void LLTextureFetch::sendRequestListToSimulators() typedef std::set<LLTextureFetchWorker*,LLTextureFetchWorker::Compare> request_list_t; typedef std::map< LLHost, request_list_t > work_request_map_t; work_request_map_t requests; - for (queue_t::iterator iter = mNetworkQueue.begin(); iter != mNetworkQueue.end(); ++iter) + for (queue_t::iterator iter = mNetworkQueue.begin(); iter != mNetworkQueue.end(); ) { - LLTextureFetchWorker* req = getWorker(*iter); + queue_t::iterator curiter = iter++; + LLTextureFetchWorker* req = getWorker(*curiter); + if (!req) + { + mNetworkQueue.erase(curiter); + continue; // paranoia + } if (req->mID == mDebugID) { mDebugCount++; // for setting breakpoints @@ -1492,7 +1516,11 @@ void LLTextureFetch::sendRequestListToSimulators() bool use_http = http_url.empty() ? false : true; LLHost host = iter1->first; // invalid host = use agent host - if (host != gAgent.getRegionHost()) + if (host == LLHost::invalid) + { + host = gAgent.getRegionHost(); + } + else { use_http = false; } @@ -1521,8 +1549,7 @@ void LLTextureFetch::sendRequestListToSimulators() gMessageSystem->addS8Fast(_PREHASH_DiscardLevel, (S8)req->mSimRequestedDiscard); gMessageSystem->addF32Fast(_PREHASH_DownloadPriority, req->mImagePriority); gMessageSystem->addU32Fast(_PREHASH_Packet, packet); - U8 type = host.isOk() ? LLImageBase::TYPE_AVATAR_BAKE : LLImageBase::TYPE_NORMAL; - gMessageSystem->addU8Fast(_PREHASH_Type, type); + gMessageSystem->addU8Fast(_PREHASH_Type, req->mType); // llinfos << "IMAGE REQUEST: " << req->mID << " Discard: " << req->mDesiredDiscard // << " Packet: " << packet << " Priority: " << req->mImagePriority << llendl; @@ -1555,6 +1582,10 @@ void LLTextureFetch::sendRequestListToSimulators() iter1 != mCancelQueue.end(); ++iter1) { LLHost host = iter1->first; + if (host == LLHost::invalid) + { + host = gAgent.getRegionHost(); + } S32 request_count = 0; for (queue_t::iterator iter2 = iter1->second.begin(); iter2 != iter1->second.end(); ++iter2) @@ -1624,12 +1655,11 @@ bool LLTextureFetchWorker::insertPacket(S32 index, U8* data, S32 size) return true; } -bool LLTextureFetch::receiveImageHeader(const LLHost& host_in, const LLUUID& id, U8 codec, U16 packets, U32 totalbytes, +bool LLTextureFetch::receiveImageHeader(const LLHost& host, const LLUUID& id, U8 codec, U16 packets, U32 totalbytes, U16 data_size, U8* data) { LLMutexLock lock(&mQueueMutex); LLTextureFetchWorker* worker = getWorker(id); - LLHost host = (host_in == LLHost::invalid) ? gAgent.getRegionHost() : host_in; bool res = true; ++mPacketCount; @@ -1639,17 +1669,12 @@ bool LLTextureFetch::receiveImageHeader(const LLHost& host_in, const LLUUID& id, // llwarns << "Received header for non active worker: " << id << llendl; res = false; } - else if (host != worker->mHost) - { -// llwarns << "Received header from wrong host for: " << id << llendl; - res = false; - } else if (worker->mState != LLTextureFetchWorker::LOAD_FROM_NETWORK || worker->mSentRequest != LLTextureFetchWorker::SENT_SIM) { - llwarns << "receiveImageHeader for worker: " << id - << " in state: " << LLTextureFetchWorker::sStateDescs[worker->mState] - << " sent: " << worker->mSentRequest << llendl; +// llwarns << "receiveImageHeader for worker: " << id +// << " in state: " << LLTextureFetchWorker::sStateDescs[worker->mState] +// << " sent: " << worker->mSentRequest << llendl; res = false; } else if (worker->mLastPacket != -1) @@ -1685,11 +1710,10 @@ bool LLTextureFetch::receiveImageHeader(const LLHost& host_in, const LLUUID& id, return res; } -bool LLTextureFetch::receiveImagePacket(const LLHost& host_in, const LLUUID& id, U16 packet_num, U16 data_size, U8* data) +bool LLTextureFetch::receiveImagePacket(const LLHost& host, const LLUUID& id, U16 packet_num, U16 data_size, U8* data) { LLMutexLock lock(&mQueueMutex); LLTextureFetchWorker* worker = getWorker(id); - LLHost host = (host_in == LLHost::invalid) ? gAgent.getRegionHost() : host_in; bool res = true; ++mPacketCount; @@ -1699,11 +1723,6 @@ bool LLTextureFetch::receiveImagePacket(const LLHost& host_in, const LLUUID& id, // llwarns << "Received packet " << packet_num << " for non active worker: " << id << llendl; res = false; } - else if (host != worker->mHost) - { -// llwarns << "Received packet from wrong host for: " << id << llendl; - res = false; - } else if (worker->mLastPacket == -1) { // llwarns << "Received packet " << packet_num << " before header for: " << id << llendl; @@ -1735,6 +1754,8 @@ bool LLTextureFetch::receiveImagePacket(const LLHost& host_in, const LLUUID& id, { // llwarns << "receiveImagePacket " << packet_num << "/" << worker->mLastPacket << " for worker: " << id // << " in state: " << LLTextureFetchWorker::sStateDescs[worker->mState] << llendl; + removeFromNetworkQueue(worker); // failsafe + mCancelQueue[host].insert(id); } worker->unlockWorkData(); diff --git a/indra/newview/lltextureview.cpp b/indra/newview/lltextureview.cpp index b75e379755..683f8b56cf 100644 --- a/indra/newview/lltextureview.cpp +++ b/indra/newview/lltextureview.cpp @@ -129,21 +129,18 @@ void LLTextureBar::draw() } else if (mHilite) { - S32 idx = llclamp(mHilite,1,4); - if (idx==1) color = LLColor4::yellow; - else color = LLColor4::orange; - } - else if (mImagep->getBoostLevel()) - { - color = LLColor4::magenta; + S32 idx = llclamp(mHilite,1,3); + if (idx==1) color = LLColor4::orange; + else if (idx==2) color = LLColor4::yellow; + else color = LLColor4::pink2; } else if (mImagep->mDontDiscard) { - color = LLColor4::pink2; + color = LLColor4::green4; } - else if (!mImagep->getUseMipMaps()) + else if (mImagep->getBoostLevel()) { - color = LLColor4::green4; + color = LLColor4::magenta; } else if (mImagep->getDecodePriority() == 0.0f) { @@ -577,6 +574,9 @@ void LLTextureView::draw() { LLPointer<LLViewerImage> imagep = *iter++; + S32 cur_discard = imagep->getDiscardLevel(); + S32 desired_discard = imagep->mDesiredDiscardLevel; + if (mPrintList) { llinfos << imagep->getID() @@ -585,7 +585,7 @@ void LLTextureView::draw() << "\t" << imagep->getDecodePriority() << "\t" << imagep->getWidth() << "\t" << imagep->getHeight() - << "\t" << imagep->getDiscardLevel() + << "\t" << cur_discard << llendl; } @@ -614,7 +614,7 @@ void LLTextureView::draw() if (sDebugImages.find(imagep) != sDebugImages.end()) { - pri += 3*HIGH_PRIORITY; + pri += 4*HIGH_PRIORITY; } if (!mOrderFetch) @@ -629,14 +629,14 @@ void LLTextureView::draw() { if (imagep == objectp->getTEImage(te)) { - pri += 2*HIGH_PRIORITY; + pri += 3*HIGH_PRIORITY; break; } } } #endif #if 1 - if (pri < HIGH_PRIORITY) + if (pri < HIGH_PRIORITY && (cur_discard< 0 || desired_discard < cur_discard)) { LLViewerObject *objectp = gHoverView->getLastHoverObject(); if (objectp) @@ -653,15 +653,6 @@ void LLTextureView::draw() } } #endif -#if 0 - if (pri < HIGH_PRIORITY) - { - if (imagep->mBoostPriority) - { - pri += 4*HIGH_PRIORITY; - } - } -#endif #if 1 if (pri > 0.f && pri < HIGH_PRIORITY) { diff --git a/indra/newview/lltool.cpp b/indra/newview/lltool.cpp index 1053e4a569..b31a70e917 100644 --- a/indra/newview/lltool.cpp +++ b/indra/newview/lltool.cpp @@ -34,7 +34,7 @@ LLTool::LLTool( const LLString& name, LLToolComposite* composite ) : LLTool::~LLTool() { - if( gFocusMgr.getMouseCapture() == this ) + if( hasMouseCapture() ) { llwarns << "Tool deleted holding mouse capture. Mouse capture removed." << llendl; gFocusMgr.removeMouseCaptureWithoutCallback( this ); @@ -113,12 +113,12 @@ void LLTool::setMouseCapture( BOOL b ) { if( b ) { - gViewerWindow->setMouseCapture(mComposite ? mComposite : this, &LLTool::onMouseCaptureLost ); + gViewerWindow->setMouseCapture(mComposite ? mComposite : this ); } else if( hasMouseCapture() ) { - gViewerWindow->setMouseCapture( NULL, NULL ); + gViewerWindow->setMouseCapture( NULL ); } } @@ -128,7 +128,7 @@ void LLTool::draw() BOOL LLTool::hasMouseCapture() { - return gViewerWindow->hasMouseCapture(mComposite ? mComposite : this); + return gFocusMgr.getMouseCapture() == (mComposite ? mComposite : this); } BOOL LLTool::handleKey(KEY key, MASK mask) @@ -144,17 +144,3 @@ LLTool* LLTool::getOverrideTool(MASK mask) } return NULL; } - -// static -void LLTool::onMouseCaptureLost( LLMouseHandler* old_captor ) -{ - LLTool* self = (LLTool*) old_captor; - if( self->mComposite ) - { - self->mComposite->onMouseCaptureLost(); - } - else - { - self->onMouseCaptureLost(); - } -} diff --git a/indra/newview/lltool.h b/indra/newview/lltool.h index d67a0d7d24..0cdeae6bd9 100644 --- a/indra/newview/lltool.h +++ b/indra/newview/lltool.h @@ -72,7 +72,6 @@ public: // Note: NOT virtual. Subclasses should call this version. void setMouseCapture(BOOL b); BOOL hasMouseCapture(); - static void onMouseCaptureLost(LLMouseHandler* old_captor); virtual void onMouseCaptureLost() {} // override this one as needed. protected: diff --git a/indra/newview/lltoolcomp.cpp b/indra/newview/lltoolcomp.cpp index 5d803b4c52..a1c51cfe44 100644 --- a/indra/newview/lltoolcomp.cpp +++ b/indra/newview/lltoolcomp.cpp @@ -736,6 +736,11 @@ BOOL LLToolCompGun::handleMouseUp(S32 x, S32 y, MASK mask) void LLToolCompGun::onMouseCaptureLost() { + if (mComposite) + { + mComposite->onMouseCaptureLost(); + return; + } mCur->onMouseCaptureLost(); // JC - I don't know if this is necessary. Maybe we could lose capture diff --git a/indra/newview/lltooldraganddrop.cpp b/indra/newview/lltooldraganddrop.cpp index 1eb27f9165..b4aee4e2e1 100644 --- a/indra/newview/lltooldraganddrop.cpp +++ b/indra/newview/lltooldraganddrop.cpp @@ -859,7 +859,7 @@ void LLToolDragAndDrop::dragOrDrop( S32 x, S32 y, MASK mask, BOOL drop, BOOL handled = FALSE; - LLView* top_view = gViewerWindow->getTopView(); + LLView* top_view = gViewerWindow->getTopCtrl(); LLViewerInventoryItem* item; LLViewerInventoryCategory* cat; @@ -2308,7 +2308,7 @@ EAcceptance LLToolDragAndDrop::dad3dTextureObject( } if(!obj->permModify()) { - return ACCEPT_NO_LOCKED; + return ACCEPT_NO_LOCKED; } //If texture !copyable don't texture or you'll never get it back. if(!item->getPermissions().allowCopyBy(gAgent.getID())) diff --git a/indra/newview/lltoolpie.cpp b/indra/newview/lltoolpie.cpp index 68d9ddbd54..f9511f72a5 100644 --- a/indra/newview/lltoolpie.cpp +++ b/indra/newview/lltoolpie.cpp @@ -44,6 +44,7 @@ LLToolPie *gToolPie = NULL; LLViewerObject* LLToolPie::sClickActionObject = NULL; LLHandle<LLObjectSelection> LLToolPie::sLeftClickSelection = NULL; +U8 LLToolPie::sClickAction = 0; extern void handle_buy(void*); @@ -145,17 +146,17 @@ BOOL LLToolPie::pickAndShowMenu(S32 x, S32 y, MASK mask, BOOL always_show) // If it's a left-click, and we have a special action, do it. if (useClickAction(always_show, mask, object, parent)) { - U8 click_action = 0; + sClickAction = 0; if (object && object->getClickAction()) { - click_action = object->getClickAction(); + sClickAction = object->getClickAction(); } else if (parent && parent->getClickAction()) { - click_action = parent->getClickAction(); + sClickAction = parent->getClickAction(); } - switch(click_action) + switch(sClickAction) { case CLICK_ACTION_TOUCH: default: @@ -168,8 +169,9 @@ BOOL LLToolPie::pickAndShowMenu(S32 x, S32 y, MASK mask, BOOL always_show) if (object && object->flagTakesMoney() || parent && parent->flagTakesMoney()) { - sClickActionObject = parent; - sLeftClickSelection = LLToolSelect::handleObjectSelection(parent, MASK_NONE, FALSE, TRUE); + // pay event goes to object actually clicked on + sClickActionObject = object; + sLeftClickSelection = LLToolSelect::handleObjectSelection(object, MASK_NONE, FALSE, TRUE); return TRUE; } break; @@ -398,13 +400,12 @@ void LLToolPie::selectionPropertiesReceived() if (!sLeftClickSelection->isEmpty()) { - LLViewerObject* root = sLeftClickSelection->getFirstRootObject(); + LLViewerObject* selected_object = sLeftClickSelection->getPrimaryObject(); // since we don't currently have a way to lock a selection, it could have changed // after we initially clicked on the object - if (root == sClickActionObject) + if (selected_object == sClickActionObject) { - U8 action = root->getClickAction(); - switch (action) + switch (sClickAction) { case CLICK_ACTION_BUY: handle_buy(NULL); @@ -422,6 +423,7 @@ void LLToolPie::selectionPropertiesReceived() } sLeftClickSelection = NULL; sClickActionObject = NULL; + sClickAction = 0; } BOOL LLToolPie::handleHover(S32 x, S32 y, MASK mask) diff --git a/indra/newview/lltoolpie.h b/indra/newview/lltoolpie.h index 2ae125c76e..6c3a200dbc 100644 --- a/indra/newview/lltoolpie.h +++ b/indra/newview/lltoolpie.h @@ -54,6 +54,7 @@ protected: LLUUID mHitObjectID; BOOL mMouseOutsideSlop; // for this drag, has mouse moved outside slop region static LLViewerObject* sClickActionObject; + static U8 sClickAction; static LLHandle<LLObjectSelection> sLeftClickSelection; }; diff --git a/indra/newview/lluploaddialog.cpp b/indra/newview/lluploaddialog.cpp index 9bcc123eb5..f8c54fd6c7 100644 --- a/indra/newview/lluploaddialog.cpp +++ b/indra/newview/lluploaddialog.cpp @@ -62,7 +62,7 @@ LLUploadDialog::LLUploadDialog( const std::string& msg) setMessage(msg); // The dialog view is a root view - gViewerWindow->setTopView( this, NULL ); + gViewerWindow->setTopCtrl( this ); } void LLUploadDialog::setMessage( const std::string& msg) diff --git a/indra/newview/llviewerjointmesh.cpp b/indra/newview/llviewerjointmesh.cpp index 512ddc8565..123dcc8eb4 100644 --- a/indra/newview/llviewerjointmesh.cpp +++ b/indra/newview/llviewerjointmesh.cpp @@ -34,6 +34,7 @@ #include "llvoavatar.h" #include "llsky.h" #include "pipeline.h" +#include "llglslshader.h" #if !LL_DARWIN && !LL_LINUX extern PFNGLWEIGHTPOINTERARBPROC glWeightPointerARB; @@ -479,7 +480,7 @@ void LLViewerJointMesh::uploadJointMatrices() //cgGLSetParameterArray4f(gPipeline.mAvatarMatrix, offset, 1, vector); } } - glUniform4fvARB(gPipeline.mAvatarMatrixParam, 45, mat); + glUniform4fvARB(gAvatarMatrixParam, 45, mat); } } @@ -554,14 +555,14 @@ U32 LLViewerJointMesh::drawShape( F32 pixelArea, BOOL first_pass) { glColor4f(0,0,0,1); - if (gPipeline.mMaterialIndex > 0) + if (gMaterialIndex > 0) { - glVertexAttrib4fvARB(gPipeline.mMaterialIndex, mColor.mV); + glVertexAttrib4fvARB(gMaterialIndex, mColor.mV); } - if (mShiny && gPipeline.mSpecularIndex > 0) + if (mShiny && gSpecularIndex > 0) { - glVertexAttrib4fARB(gPipeline.mSpecularIndex, 1,1,1,1); + glVertexAttrib4fARB(gSpecularIndex, 1,1,1,1); } } else @@ -888,7 +889,7 @@ void LLViewerJointMesh::updateGeometry() if (mValid && mMesh && mFace && mMesh->hasWeights() && mFace->mVertexBuffer.notNull() && - gPipeline.getVertexShaderLevel(LLPipeline::SHADER_AVATAR) == 0) + LLShaderMgr::getVertexShaderLevel(LLShaderMgr::SHADER_AVATAR) == 0) { uploadJointMatrices(); LLStrider<LLVector3> o_vertices; diff --git a/indra/newview/llviewerjoystick.cpp b/indra/newview/llviewerjoystick.cpp new file mode 100644 index 0000000000..ae51726b5e --- /dev/null +++ b/indra/newview/llviewerjoystick.cpp @@ -0,0 +1,252 @@ +/** + * @file llviewerjoystick.cpp + * @brief Joystick functionality. + * + * Copyright (c) 2002-$CurrentYear$, Linden Research, Inc. + * $License$ + */ + +#include "llviewerprecompiledheaders.h" +#include "llviewercontrol.h" +#include "llviewerwindow.h" +#include "llviewercamera.h" +#include "llviewerjoystick.h" +#include "viewer.h" +#include "llkeyboard.h" + +static LLQuaternion sFlycamRotation; +static LLVector3 sFlycamPosition; +static F32 sFlycamZoom; + +BOOL LLViewerJoystick::sOverrideCamera = FALSE; + +void LLViewerJoystick::updateCamera(BOOL reset) +{ + static F32 last_delta[] = {0,0,0,0,0,0,0}; + static F32 delta[] = { 0,0,0,0,0,0,0 }; + + LLWindow* window = gViewerWindow->getWindow(); + + F32 time = gFrameIntervalSeconds; + + S32 axis[] = + { + gSavedSettings.getS32("FlycamAxis0"), + gSavedSettings.getS32("FlycamAxis1"), + gSavedSettings.getS32("FlycamAxis2"), + gSavedSettings.getS32("FlycamAxis3"), + gSavedSettings.getS32("FlycamAxis4"), + gSavedSettings.getS32("FlycamAxis5"), + gSavedSettings.getS32("FlycamAxis6") + }; + + F32 axis_scale[] = + { + gSavedSettings.getF32("FlycamAxisScale0"), + gSavedSettings.getF32("FlycamAxisScale1"), + gSavedSettings.getF32("FlycamAxisScale2"), + gSavedSettings.getF32("FlycamAxisScale3"), + gSavedSettings.getF32("FlycamAxisScale4"), + gSavedSettings.getF32("FlycamAxisScale5"), + gSavedSettings.getF32("FlycamAxisScale6") + }; + + F32 dead_zone[] = + { + gSavedSettings.getF32("FlycamAxisDeadZone0"), + gSavedSettings.getF32("FlycamAxisDeadZone1"), + gSavedSettings.getF32("FlycamAxisDeadZone2"), + gSavedSettings.getF32("FlycamAxisDeadZone3"), + gSavedSettings.getF32("FlycamAxisDeadZone4"), + gSavedSettings.getF32("FlycamAxisDeadZone5"), + gSavedSettings.getF32("FlycamAxisDeadZone6") + }; + + if (reset) + { + sFlycamPosition = gCamera->getOrigin(); + sFlycamRotation = gCamera->getQuaternion(); + sFlycamZoom = gCamera->getView(); + + for (U32 i = 0; i < 7; i++) + { + last_delta[i] = -window->getJoystickAxis(axis[i]); + delta[i] = 0.f; + } + return; + } + + F32 cur_delta[7]; + F32 feather = gSavedSettings.getF32("FlycamFeathering"); + BOOL absolute = gSavedSettings.getBOOL("FlycamAbsolute"); + + for (U32 i = 0; i < 7; i++) + { + cur_delta[i] = -window->getJoystickAxis(axis[i]); + F32 tmp = cur_delta[i]; + if (absolute) + { + cur_delta[i] = cur_delta[i] - last_delta[i]; + } + last_delta[i] = tmp; + + if (cur_delta[i] > 0) + { + cur_delta[i] = llmax(cur_delta[i]-dead_zone[i], 0.f); + } + else + { + cur_delta[i] = llmin(cur_delta[i]+dead_zone[i], 0.f); + } + cur_delta[i] *= axis_scale[i]; + + if (!absolute) + { + cur_delta[i] *= time; + } + + delta[i] = delta[i] + (cur_delta[i]-delta[i])*time*feather; + } + + sFlycamPosition += LLVector3(delta) * sFlycamRotation; + + LLMatrix3 rot_mat(delta[3], + delta[4], + delta[5]); + + sFlycamRotation = LLQuaternion(rot_mat)*sFlycamRotation; + + if (gSavedSettings.getBOOL("FlycamAutoLeveling")) + { + LLMatrix3 level(sFlycamRotation); + + LLVector3 x = LLVector3(level.mMatrix[0]); + LLVector3 y = LLVector3(level.mMatrix[1]); + LLVector3 z = LLVector3(level.mMatrix[2]); + + y.mV[2] = 0.f; + y.normVec(); + + level.setRows(x,y,z); + level.orthogonalize(); + + LLQuaternion quat = LLQuaternion(level); + sFlycamRotation = nlerp(llmin(feather*time,1.f), sFlycamRotation, quat); + } + + if (gSavedSettings.getBOOL("FlycamZoomDirect")) + { + sFlycamZoom = last_delta[6]*axis_scale[6]+dead_zone[6]; + } + else + { + sFlycamZoom += delta[6]; + } + + LLMatrix3 mat(sFlycamRotation); + + gCamera->setView(sFlycamZoom); + gCamera->setOrigin(sFlycamPosition); + gCamera->mXAxis = LLVector3(mat.mMatrix[0]); + gCamera->mYAxis = LLVector3(mat.mMatrix[1]); + gCamera->mZAxis = LLVector3(mat.mMatrix[2]); +} + + +void LLViewerJoystick::scanJoystick() +{ + if (!sOverrideCamera) + { + static U32 joystick_state = 0; + static U32 button_state = 0; + + F32 xval = gViewerWindow->getWindow()->getJoystickAxis(0); + F32 yval = gViewerWindow->getWindow()->getJoystickAxis(1); + + if (xval <= -0.5f) + { + if (!(joystick_state & 0x1)) + { + gKeyboard->handleTranslatedKeyDown(KEY_PAD_LEFT, 0); + joystick_state |= 0x1; + } + } + else + { + if (joystick_state & 0x1) + { + gKeyboard->handleTranslatedKeyUp(KEY_PAD_LEFT, 0); + joystick_state &= ~0x1; + } + } + if (xval >= 0.5f) + { + if (!(joystick_state & 0x2)) + { + gKeyboard->handleTranslatedKeyDown(KEY_PAD_RIGHT, 0); + joystick_state |= 0x2; + } + } + else + { + if (joystick_state & 0x2) + { + gKeyboard->handleTranslatedKeyUp(KEY_PAD_RIGHT, 0); + joystick_state &= ~0x2; + } + } + if (yval <= -0.5f) + { + if (!(joystick_state & 0x4)) + { + gKeyboard->handleTranslatedKeyDown(KEY_PAD_UP, 0); + joystick_state |= 0x4; + } + } + else + { + if (joystick_state & 0x4) + { + gKeyboard->handleTranslatedKeyUp(KEY_PAD_UP, 0); + joystick_state &= ~0x4; + } + } + if (yval >= 0.5f) + { + if (!(joystick_state & 0x8)) + { + gKeyboard->handleTranslatedKeyDown(KEY_PAD_DOWN, 0); + joystick_state |= 0x8; + } + } + else + { + if (joystick_state & 0x8) + { + gKeyboard->handleTranslatedKeyUp(KEY_PAD_DOWN, 0); + joystick_state &= ~0x8; + } + } + + for( int i = 0; i < 15; i++ ) + { + if ( gViewerWindow->getWindow()->getJoystickButton(i) & 0x80 ) + { + if (!(button_state & (1<<i))) + { + gKeyboard->handleTranslatedKeyDown(KEY_BUTTON1+i, 0); + button_state |= (1<<i); + } + } + else + { + if (button_state & (1<<i)) + { + gKeyboard->handleTranslatedKeyUp(KEY_BUTTON1+i, 0); + button_state &= ~(1<<i); + } + } + } + } +} + diff --git a/indra/newview/llviewerjoystick.h b/indra/newview/llviewerjoystick.h new file mode 100644 index 0000000000..bc2186c992 --- /dev/null +++ b/indra/newview/llviewerjoystick.h @@ -0,0 +1,20 @@ +/** + * @file llviewerjoystick.h + * @brief Viewer joystick functionality. + * + * Copyright (c) 2001-$CurrentYear$, Linden Research, Inc. + * $License$ + */ + +#ifndef LL_LLVIEWERJOYSTICK_H +#define LL_LLVIEWERJOYSTICK_H + +class LLViewerJoystick +{ +public: + static BOOL sOverrideCamera; + static void scanJoystick(); + static void updateCamera(BOOL reset = FALSE); +}; + +#endif diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 9a43729195..89665171c9 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -174,6 +174,7 @@ #include "pipeline.h" #include "viewer.h" #include "roles_constants.h" +#include "llviewerjoystick.h" #include "lltexlayer.h" @@ -994,6 +995,10 @@ void init_debug_ui_menu(LLMenuGL* menu) menu->append(new LLMenuItemToggleGL("Debug Keys", &LLView::sDebugKeys)); menu->append(new LLMenuItemToggleGL("Debug WindowProc", &gDebugWindowProc)); menu->append(new LLMenuItemToggleGL("Debug Text Editor Tips", &gDebugTextEditorTips)); + menu->appendSeparator(); + menu->append(new LLMenuItemCheckGL("Show Time", menu_toggle_control, NULL, menu_check_control, (void*)"DebugShowTime")); + menu->append(new LLMenuItemCheckGL("Show Render Info", menu_toggle_control, NULL, menu_check_control, (void*)"DebugShowRenderInfo")); + menu->createJumpKeys(); } @@ -3145,6 +3150,11 @@ void reset_view_final( BOOL proceed, void* ) gAgent.changeCameraToDefault(); + if (LLViewerJoystick::sOverrideCamera) + { + handle_toggle_flycam(NULL); + } + gAgent.resetView(!gFloaterTools->getVisible()); gFloaterTools->close(); @@ -6331,14 +6341,15 @@ void handle_dump_followcam(void*) BOOL check_flycam(void*) { - return LLPipeline::sOverrideAgentCamera; + return LLViewerJoystick::sOverrideCamera; } void handle_toggle_flycam(void*) { - LLPipeline::sOverrideAgentCamera = !LLPipeline::sOverrideAgentCamera; - if (LLPipeline::sOverrideAgentCamera) + LLViewerJoystick::sOverrideCamera = !LLViewerJoystick::sOverrideCamera; + if (LLViewerJoystick::sOverrideCamera) { + LLViewerJoystick::updateCamera(TRUE); LLFloaterJoystick::show(NULL); } } diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index ed13f6dbe9..55256a6f23 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -3884,7 +3884,16 @@ void process_alert_core(const char* buffer, BOOL modal) } // Translate system messages here. - if (buffer[0] == '/') + const char ALERT_PREFIX[] = "ALERT: "; + const size_t ALERT_PREFIX_LEN = sizeof(ALERT_PREFIX) - 1; + if (!strncmp(buffer, ALERT_PREFIX, ALERT_PREFIX_LEN)) + { + // Allow the server to spawn a named alert so that server alerts can be + // translated out of English. JC + std::string alert_name(buffer + ALERT_PREFIX_LEN); + LLAlertDialog::showXml(alert_name); + } + else if (buffer[0] == '/') { // System message is important, show in upper-right box not tip LLString text(buffer+1); diff --git a/indra/newview/llviewerparcelmgr.cpp b/indra/newview/llviewerparcelmgr.cpp index ee29876274..c3f2b2d2f6 100644 --- a/indra/newview/llviewerparcelmgr.cpp +++ b/indra/newview/llviewerparcelmgr.cpp @@ -2568,6 +2568,6 @@ bool LLParcelSelection::hasOthersSelected() const LLParcelSelection* get_null_parcel_selection() { - static LLParcelSelectionHandle null_ptr = new LLParcelSelection(); - return null_ptr; + static LLParcelSelection null_selection; + return &null_selection; } diff --git a/indra/newview/llviewerpartsim.cpp b/indra/newview/llviewerpartsim.cpp index a6895aff2f..bf09c54100 100644 --- a/indra/newview/llviewerpartsim.cpp +++ b/indra/newview/llviewerpartsim.cpp @@ -461,7 +461,7 @@ LLViewerPartGroup *LLViewerPartSim::put(LLViewerPart* part) const F32 MAX_MAG = 1000000.f*1000000.f; // 1 million if (part->mPosAgent.magVecSquared() > MAX_MAG || !part->mPosAgent.isFinite()) { -#if !LL_RELEASE_FOR_DOWNLOAD +#if 0 && !LL_RELEASE_FOR_DOWNLOAD llwarns << "LLViewerPartSim::put Part out of range!" << llendl; llwarns << part->mPosAgent << llendl; #endif diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 262c7d8ed7..3bc529a9e3 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -422,7 +422,6 @@ LLVector3 LLViewerRegion::getCenterAgent() const return gAgent.getPosAgentFromGlobal(mCenterGlobal); } - void LLViewerRegion::setRegionNameAndZone(const char* name_and_zone) { LLString name_zone(name_and_zone); @@ -705,21 +704,6 @@ F32 LLViewerRegion::getCompositionXY(const S32 x, const S32 y) const return getComposition()->getValueScaled((F32)x, (F32)y); } - -// ---------------- Friends ---------------- - -std::ostream& operator<<(std::ostream &s, const LLViewerRegion ®ion) -{ - s << "{ "; - s << region.mHost; - s << " mOriginGlobal = " << region.getOriginGlobal()<< "\n"; - s << "}"; - return s; -} - - -// ---------------- Protected Member Functions ---------------- - void LLViewerRegion::calculateCenterGlobal() { mCenterGlobal = mOriginGlobal; @@ -735,7 +719,24 @@ void LLViewerRegion::calculateCenterGlobal() } } +void LLViewerRegion::calculateCameraDistance() +{ + mCameraDistanceSquared = (F32)(gAgent.getCameraPositionGlobal() - getCenterGlobal()).magVecSquared(); +} + +// ---------------- Friends ---------------- +std::ostream& operator<<(std::ostream &s, const LLViewerRegion ®ion) +{ + s << "{ "; + s << region.mHost; + s << " mOriginGlobal = " << region.getOriginGlobal()<< "\n"; + s << "}"; + return s; +} + + +// ---------------- Protected Member Functions ---------------- void LLViewerRegion::updateNetStats() { diff --git a/indra/newview/llviewerregion.h b/indra/newview/llviewerregion.h index 1dc1b3af20..05c37fe08f 100644 --- a/indra/newview/llviewerregion.h +++ b/indra/newview/llviewerregion.h @@ -208,9 +208,19 @@ public: void unpackRegionHandshake(); void calculateCenterGlobal(); + void calculateCameraDistance(); friend std::ostream& operator<<(std::ostream &s, const LLViewerRegion ®ion); +public: + struct CompareDistance + { + bool operator()(const LLViewerRegion* const& lhs, const LLViewerRegion* const& rhs) + { + return lhs->mCameraDistanceSquared < rhs->mCameraDistanceSquared; + } + }; + protected: void disconnectAllNeighbors(); void initStats(); @@ -265,13 +275,15 @@ protected: U32 mPingDelay; F32 mDeltaTime; // Time since last measurement of lastPackets, Bits, etc + // Misc LLVLComposition *mCompositionp; // Composition layer for the surface U32 mRegionFlags; // includes damage flags U8 mSimAccess; F32 mBillableFactor; U32 mMaxTasks; // max prim count - + F32 mCameraDistanceSquared; // updated once per frame + // Maps local ids to cache entries. // Regions can have order 10,000 objects, so assume // a structure of size 2^14 = 16,000 diff --git a/indra/newview/llviewertexteditor.cpp b/indra/newview/llviewertexteditor.cpp index f9e74f31e6..4ebfef3a9b 100644 --- a/indra/newview/llviewertexteditor.cpp +++ b/indra/newview/llviewertexteditor.cpp @@ -584,7 +584,7 @@ BOOL LLViewerTextEditor::handleMouseDown(S32 x, S32 y, MASK mask) { mDragItem = item_at_pos; mDragItemSaved = LLEmbeddedItems::getEmbeddedItemSaved(wc); - gFocusMgr.setMouseCapture( this, NULL ); + gFocusMgr.setMouseCapture( this ); mMouseDownX = x; mMouseDownY = y; S32 screen_x; @@ -646,7 +646,7 @@ BOOL LLViewerTextEditor::handleMouseDown(S32 x, S32 y, MASK mask) setCursorAtLocalPos( x, y, TRUE ); startSelection(); } - gFocusMgr.setMouseCapture( this, &LLTextEditor::onMouseCaptureLost ); + gFocusMgr.setMouseCapture( this ); } handled = TRUE; @@ -676,7 +676,7 @@ BOOL LLViewerTextEditor::handleHover(S32 x, S32 y, MASK mask) } if( getVisible() ) { - if(gFocusMgr.getMouseCapture() == this ) + if(hasMouseCapture() ) { if( mIsSelecting ) { @@ -829,7 +829,7 @@ BOOL LLViewerTextEditor::handleMouseUp(S32 x, S32 y, MASK mask) // Delay cursor flashing mKeystrokeTimer.reset(); - if( gFocusMgr.getMouseCapture() == this ) + if( hasMouseCapture() ) { if (mDragItem) { @@ -842,7 +842,7 @@ BOOL LLViewerTextEditor::handleMouseUp(S32 x, S32 y, MASK mask) } } mDragItem = NULL; - gFocusMgr.setMouseCapture( NULL, NULL ); + gFocusMgr.setMouseCapture( NULL ); handled = TRUE; } diff --git a/indra/newview/llviewertextureanim.cpp b/indra/newview/llviewertextureanim.cpp index b40320ad2d..67b0901162 100644 --- a/indra/newview/llviewertextureanim.cpp +++ b/indra/newview/llviewertextureanim.cpp @@ -17,6 +17,9 @@ LLViewerTextureAnim::LLViewerTextureAnim() : LLTextureAnim() { mLastFrame = -1.f; // Force an update initially mLastTime = 0.f; + mOffS = mOffT = 0; + mScaleS = mScaleT = 1; + mRot = 0; } LLViewerTextureAnim::~LLViewerTextureAnim() @@ -148,13 +151,13 @@ S32 LLViewerTextureAnim::animateTextures(F32 &off_s, F32 &off_t, if (mMode & ROTATE) { result |= ROTATE; - rot = frame_counter; + mRot = rot = frame_counter; } else if (mMode & SCALE) { result |= SCALE; - scale_s = frame_counter; - scale_t = frame_counter; + mScaleS = scale_s = frame_counter; + mScaleT = scale_t = frame_counter; } else { @@ -168,22 +171,22 @@ S32 LLViewerTextureAnim::animateTextures(F32 &off_s, F32 &off_t, &&(mSizeY)) { result |= SCALE; - scale_s = 1.f/mSizeX; - scale_t = 1.f/mSizeY; + mScaleS = scale_s = 1.f/mSizeX; + mScaleT = scale_t = 1.f/mSizeY; x_frame = fmod(frame_counter, mSizeX); y_frame = (S32)(frame_counter / mSizeX); x_pos = x_frame * scale_s; y_pos = y_frame * scale_t; - off_s = (-0.5f + 0.5f*scale_s)+ x_pos; - off_t = (0.5f - 0.5f*scale_t) - y_pos; + mOffS = off_s = (-0.5f + 0.5f*scale_s)+ x_pos; + mOffT = off_t = (0.5f - 0.5f*scale_t) - y_pos; } else { - scale_s = 1.f; - scale_t = 1.f; + mScaleS = scale_s = 1.f; + mScaleT = scale_t = 1.f; x_pos = frame_counter * scale_s; - off_s = (-0.5f + 0.5f*scale_s)+ x_pos; - off_t = 0.f; + mOffS = off_s = (-0.5f + 0.5f*scale_s)+ x_pos; + mOffT = off_t = 0.f; } } } diff --git a/indra/newview/llviewertextureanim.h b/indra/newview/llviewertextureanim.h index c7e75c565c..a5488be4eb 100644 --- a/indra/newview/llviewertextureanim.h +++ b/indra/newview/llviewertextureanim.h @@ -25,6 +25,13 @@ public: { TRANSLATE = 0x01 // Result code JUST for animateTextures }; + + F32 mOffS; + F32 mOffT; + F32 mScaleS; + F32 mScaleT; + F32 mRot; + protected: LLFrameTimer mTimer; F64 mLastTime; diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 41f937efd5..732568f652 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -43,7 +43,6 @@ #include "llxfermanager.h" #include "message.h" #include "object_flags.h" -#include "text_out.h" #include "lltimer.h" #include "timing.h" #include "llviewermenu.h" @@ -334,7 +333,216 @@ void LLViewerWindow::printFeedback() } #endif //SABINRIG +//////////////////////////////////////////////////////////////////////////// +// +// LLDebugText +// + +class LLDebugText +{ +private: + struct Line + { + Line(const std::string& in_text, S32 in_x, S32 in_y) : text(in_text), x(in_x), y(in_y) {} + std::string text; + S32 x,y; + }; + + LLViewerWindow *mWindow; + + typedef std::vector<Line> line_list_t; + line_list_t mLineList; + LLColor4 mTextColor; + +public: + LLDebugText(LLViewerWindow* window) : mWindow(window) {} + + void addText(S32 x, S32 y, const std::string &text) + { + mLineList.push_back(Line(text, x, y)); + } + + void update() + { + std::string wind_vel_text; + std::string wind_vector_text; + std::string rwind_vel_text; + std::string rwind_vector_text; + std::string audio_text; + + // Draw the statistics in a light gray + // and in a thin font + mTextColor = LLColor4( 0.86f, 0.86f, 0.86f, 1.f ); + + // Draw stuff growing up from right lower corner of screen + U32 xpos = mWindow->getWindowWidth() - 350; + U32 ypos = 64; + const U32 y_inc = 20; + + if (gSavedSettings.getBOOL("DebugShowTime")) + { + const U32 y_inc2 = 15; + for (std::map<S32,LLFrameTimer>::reverse_iterator iter = gDebugTimers.rbegin(); + iter != gDebugTimers.rend(); ++iter) + { + S32 idx = iter->first; + LLFrameTimer& timer = iter->second; + F32 time = timer.getElapsedTimeF32(); + S32 hours = (S32)(time / (60*60)); + S32 mins = (S32)((time - hours*(60*60)) / 60); + S32 secs = (S32)((time - hours*(60*60) - mins*60)); + addText(xpos, ypos, llformat(" Debug %d: %d:%02d:%02d", idx, hours,mins,secs)); ypos += y_inc2; + } + + F32 time = gFrameTimeSeconds; + S32 hours = (S32)(time / (60*60)); + S32 mins = (S32)((time - hours*(60*60)) / 60); + S32 secs = (S32)((time - hours*(60*60) - mins*60)); + addText(xpos, ypos, llformat("Time: %d:%02d:%02d", hours,mins,secs)); ypos += y_inc; + } + + if (gDisplayCameraPos) + { + std::string camera_view_text; + std::string camera_center_text; + std::string agent_view_text; + std::string agent_left_text; + std::string agent_center_text; + std::string agent_root_center_text; + + LLVector3d tvector; // Temporary vector to hold data for printing. + + // Update camera center, camera view, wind info every other frame + tvector = gAgent.getPositionGlobal(); + agent_center_text = llformat("AgentCenter %f %f %f", + (F32)(tvector.mdV[VX]), (F32)(tvector.mdV[VY]), (F32)(tvector.mdV[VZ])); + + if (gAgent.getAvatarObject()) + { + tvector = gAgent.getPosGlobalFromAgent(gAgent.getAvatarObject()->mRoot.getWorldPosition()); + agent_root_center_text = llformat("AgentRootCenter %f %f %f", + (F32)(tvector.mdV[VX]), (F32)(tvector.mdV[VY]), (F32)(tvector.mdV[VZ])); + } + else + { + agent_root_center_text = "---"; + } + + + tvector = LLVector4(gAgent.getFrameAgent().getAtAxis()); + agent_view_text = llformat("AgentAtAxis %f %f %f", + (F32)(tvector.mdV[VX]), (F32)(tvector.mdV[VY]), (F32)(tvector.mdV[VZ])); + + tvector = LLVector4(gAgent.getFrameAgent().getLeftAxis()); + agent_left_text = llformat("AgentLeftAxis %f %f %f", + (F32)(tvector.mdV[VX]), (F32)(tvector.mdV[VY]), (F32)(tvector.mdV[VZ])); + + tvector = gAgent.getCameraPositionGlobal(); + camera_center_text = llformat("CameraCenter %f %f %f", + (F32)(tvector.mdV[VX]), (F32)(tvector.mdV[VY]), (F32)(tvector.mdV[VZ])); + + tvector = LLVector4(gCamera->getAtAxis()); + camera_view_text = llformat("CameraAtAxis %f %f %f", + (F32)(tvector.mdV[VX]), (F32)(tvector.mdV[VY]), (F32)(tvector.mdV[VZ])); + + addText(xpos, ypos, agent_center_text); ypos += y_inc; + addText(xpos, ypos, agent_root_center_text); ypos += y_inc; + addText(xpos, ypos, agent_view_text); ypos += y_inc; + addText(xpos, ypos, agent_left_text); ypos += y_inc; + addText(xpos, ypos, camera_center_text); ypos += y_inc; + addText(xpos, ypos, camera_view_text); ypos += y_inc; + } + + if (gDisplayWindInfo) + { + wind_vel_text = llformat("Wind velocity %.2f m/s", gWindVec.magVec()); + wind_vector_text = llformat("Wind vector %.2f %.2f %.2f", gWindVec.mV[0], gWindVec.mV[1], gWindVec.mV[2]); + rwind_vel_text = llformat("RWind vel %.2f m/s", gRelativeWindVec.magVec()); + rwind_vector_text = llformat("RWind vec %.2f %.2f %.2f", gRelativeWindVec.mV[0], gRelativeWindVec.mV[1], gRelativeWindVec.mV[2]); + + addText(xpos, ypos, wind_vel_text); ypos += y_inc; + addText(xpos, ypos, wind_vector_text); ypos += y_inc; + addText(xpos, ypos, rwind_vel_text); ypos += y_inc; + addText(xpos, ypos, rwind_vector_text); ypos += y_inc; + } + if (gDisplayWindInfo) + { + if (gAudiop) + { + audio_text= llformat("Audio for wind: %d", gAudiop->isWindEnabled()); + } + addText(xpos, ypos, audio_text); ypos += y_inc; + } + if (gDisplayFOV) + { + addText(xpos, ypos, llformat("FOV: %2.1f deg", RAD_TO_DEG * gCamera->getView())); + ypos += y_inc; + } + if (gSavedSettings.getBOOL("DebugShowRenderInfo")) + { + if (gPipeline.getUseVertexShaders() == 0) + { + addText(xpos, ypos, "Shaders Disabled"); + ypos += y_inc; + } + addText(xpos, ypos, llformat("%d MB Vertex Data", LLVertexBuffer::sAllocatedBytes/(1024*1024))); + ypos += y_inc; + + addText(xpos, ypos, llformat("%d Pending Lock", LLVertexBuffer::sLockedList.size())); + ypos += y_inc; + + addText(xpos, ypos, llformat("%d Vertex Buffers", LLVertexBuffer::sGLCount)); + ypos += y_inc; + } + if (LLPipeline::getRenderParticleBeacons(NULL)) + { + addText(xpos, ypos, "Viewing particle beacons (blue)"); + ypos += y_inc; + } + if (LLPipeline::toggleRenderTypeControlNegated((void*)LLPipeline::RENDER_TYPE_PARTICLES)) + { + addText(xpos, ypos, "Hiding particles"); + ypos += y_inc; + } + if (LLPipeline::getRenderPhysicalBeacons(NULL)) + { + addText(xpos, ypos, "Viewing physical object beacons (green)"); + ypos += y_inc; + } + if (LLPipeline::getRenderScriptedBeacons(NULL)) + { + addText(xpos, ypos, "Viewing scripted object beacons (red)"); + ypos += y_inc; + } + if (LLPipeline::getRenderSoundBeacons(NULL)) + { + addText(xpos, ypos, "Viewing sound beacons (yellow)"); + ypos += y_inc; + } + } + + void draw() + { + for (line_list_t::iterator iter = mLineList.begin(); + iter != mLineList.end(); ++iter) + { + const Line& line = *iter; + LLFontGL::sMonospace->renderUTF8(line.text, 0, (F32)line.x, (F32)line.y, mTextColor, + LLFontGL::LEFT, LLFontGL::TOP, + LLFontGL::NORMAL, S32_MAX, S32_MAX, NULL, FALSE); + } + mLineList.clear(); + } + +}; + +void LLViewerWindow::updateDebugText() +{ + mDebugText->update(); +} + +//////////////////////////////////////////////////////////////////////////// // // LLViewerWindow // @@ -401,12 +609,23 @@ BOOL LLViewerWindow::handleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask } // Topmost view gets a chance before the hierarchy - LLView* top_view = gFocusMgr.getTopView(); - if (top_view) + LLUICtrl* top_ctrl = gFocusMgr.getTopCtrl(); + if (top_ctrl) { S32 local_x, local_y; - top_view->screenPointToLocal( x, y, &local_x, &local_y ); - if (top_view->pointInView(local_x, local_y) && top_view->handleMouseDown(local_x, local_y, mask)) return TRUE; + top_ctrl->screenPointToLocal( x, y, &local_x, &local_y ); + if (top_ctrl->pointInView(local_x, local_y)) + { + if(top_ctrl->handleMouseDown(local_x, local_y, mask)) + { + return TRUE; + } + } + else if (top_ctrl->hasFocus()) + { + // always defocus top view if we click off of it + top_ctrl->setFocus(FALSE); + } } // Give the UI views a chance to process the click @@ -479,12 +698,25 @@ BOOL LLViewerWindow::handleDoubleClick(LLWindow *window, LLCoordGL pos, MASK ma } // Check for hit on UI. - LLView* top_view = gFocusMgr.getTopView(); - if (top_view) + LLUICtrl* top_ctrl = gFocusMgr.getTopCtrl(); + if (top_ctrl) { S32 local_x, local_y; - top_view->screenPointToLocal( x, y, &local_x, &local_y ); - if (top_view->pointInView(local_x, local_y) && top_view->handleDoubleClick(local_x, local_y, mask)) return TRUE; + top_ctrl->screenPointToLocal( x, y, &local_x, &local_y ); + if (top_ctrl->pointInView(local_x, local_y)) + { + if(top_ctrl->handleDoubleClick(local_x, local_y, mask)) + { + return TRUE; + } + } + else + { + if (top_ctrl->hasFocus()) + { + top_ctrl->setFocus(FALSE); + } + } } if (mRootView->handleDoubleClick(x, y, mask)) @@ -574,12 +806,12 @@ BOOL LLViewerWindow::handleMouseUp(LLWindow *window, LLCoordGL pos, MASK mask) return mouse_captor->handleMouseUp(local_x, local_y, mask); } - LLView* top_view = gFocusMgr.getTopView(); - if (top_view) + LLUICtrl* top_ctrl = gFocusMgr.getTopCtrl(); + if (top_ctrl) { S32 local_x, local_y; - top_view->screenPointToLocal( x, y, &local_x, &local_y ); - handled = top_view->pointInView(local_x, local_y) && top_view->handleMouseUp(local_x, local_y, mask); + top_ctrl->screenPointToLocal( x, y, &local_x, &local_y ); + handled = top_ctrl->pointInView(local_x, local_y) && top_ctrl->handleMouseUp(local_x, local_y, mask); } if( !handled ) @@ -670,12 +902,25 @@ BOOL LLViewerWindow::handleRightMouseDown(LLWindow *window, LLCoordGL pos, MASK return mouse_captor->handleRightMouseDown(local_x, local_y, mask); } - LLView* top_view = gFocusMgr.getTopView(); - if (top_view) + LLUICtrl* top_ctrl = gFocusMgr.getTopCtrl(); + if (top_ctrl) { S32 local_x, local_y; - top_view->screenPointToLocal( x, y, &local_x, &local_y ); - if (top_view->pointInView(local_x, local_y) && top_view->handleRightMouseDown(local_x, local_y, mask)) return TRUE; + top_ctrl->screenPointToLocal( x, y, &local_x, &local_y ); + if (top_ctrl->pointInView(local_x, local_y)) + { + if(top_ctrl->handleRightMouseDown(local_x, local_y, mask)) + { + return TRUE; + } + } + else + { + if (top_ctrl->hasFocus()) + { + top_ctrl->setFocus(FALSE); + } + } } if( mRootView->handleRightMouseDown(x, y, mask) ) @@ -773,12 +1018,12 @@ BOOL LLViewerWindow::handleRightMouseUp(LLWindow *window, LLCoordGL pos, MASK m return mouse_captor->handleRightMouseUp(local_x, local_y, mask); } - LLView* top_view = gFocusMgr.getTopView(); - if (top_view) + LLUICtrl* top_ctrl = gFocusMgr.getTopCtrl(); + if (top_ctrl) { S32 local_x, local_y; - top_view->screenPointToLocal( x, y, &local_x, &local_y ); - handled = top_view->pointInView(local_x, local_y) && top_view->handleRightMouseUp(local_x, local_y, mask); + top_ctrl->screenPointToLocal( x, y, &local_x, &local_y ); + handled = top_ctrl->pointInView(local_x, local_y) && top_ctrl->handleRightMouseUp(local_x, local_y, mask); } if( !handled ) @@ -912,7 +1157,7 @@ void LLViewerWindow::handleFocusLost(LLWindow *window) { gToolMgr->onAppFocusLost(); } - gFocusMgr.setMouseCapture( NULL, NULL ); + gFocusMgr.setMouseCapture( NULL ); if (gMenuBarView) { @@ -1284,6 +1529,8 @@ LLViewerWindow::LLViewerWindow( // sync the keyboard's setting with the saved setting gSavedSettings.getControl("NumpadControl")->firePropertyChanged(); + + mDebugText = new LLDebugText(this); } void LLViewerWindow::initGLDefaults() @@ -1632,6 +1879,8 @@ void LLViewerWindow::initWorldUI() LLViewerWindow::~LLViewerWindow() { + delete mDebugText; + gSavedSettings.setS32("FloaterViewBottom", gFloaterView->getRect().mBottom); // Cleanup global views @@ -1845,6 +2094,10 @@ void LLViewerWindow::reshape(S32 width, S32 height) } } +void LLViewerWindow::drawDebugText() +{ + mDebugText->draw(); +} void LLViewerWindow::draw() { @@ -1916,7 +2169,7 @@ void LLViewerWindow::draw() { LLGLSTexture gls_texture; - show_text_gl(); + drawDebugText(); } if (gToolMgr) @@ -1928,7 +2181,7 @@ void LLViewerWindow::draw() if( gAgent.cameraMouselook() ) { drawMouselookInstructions(); - stop_glerror(); + stop_glerror(); } // Draw all nested UI views. @@ -1936,16 +2189,16 @@ void LLViewerWindow::draw() mRootView->draw(); // Draw optional on-top-of-everyone view - LLView* top_view = gFocusMgr.getTopView(); - if (top_view && top_view->getVisible()) + LLUICtrl* top_ctrl = gFocusMgr.getTopCtrl(); + if (top_ctrl && top_ctrl->getVisible()) { S32 screen_x, screen_y; - top_view->localPointToScreen(0, 0, &screen_x, &screen_y); + top_ctrl->localPointToScreen(0, 0, &screen_x, &screen_y); glMatrixMode(GL_MODELVIEW); LLUI::pushMatrix(); LLUI::translate( (F32) screen_x, (F32) screen_y, 0.f); - top_view->draw(); + top_ctrl->draw(); LLUI::popMatrix(); } @@ -2065,7 +2318,7 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask) // cursor modes, etc, and re-enable. //if (gFocusMgr.getMouseCapture()) //{ - // gFocusMgr.setMouseCapture(NULL, NULL); + // gFocusMgr.setMouseCapture(NULL); // return TRUE; //} } @@ -2131,10 +2384,10 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask) // Topmost view gets a chance before the hierarchy // *FIX: get rid of this? - LLView* top_view = gFocusMgr.getTopView(); - if (top_view) + LLUICtrl* top_ctrl = gFocusMgr.getTopCtrl(); + if (top_ctrl) { - if( top_view->handleKey( key, mask, TRUE ) ) + if( top_ctrl->handleKey( key, mask, TRUE ) ) { return TRUE; } @@ -2207,8 +2460,8 @@ BOOL LLViewerWindow::handleUnicodeChar(llwchar uni_char, MASK mask) } // Topmost view gets a chance before the hierarchy - LLView* top_view = gFocusMgr.getTopView(); - if (top_view && top_view->handleUnicodeChar( uni_char, FALSE ) ) + LLUICtrl* top_ctrl = gFocusMgr.getTopCtrl(); + if (top_ctrl && top_ctrl->handleUnicodeChar( uni_char, FALSE ) ) { return TRUE; } @@ -2244,13 +2497,13 @@ void LLViewerWindow::handleScrollWheel(S32 clicks) return; } - LLView* top_view = gFocusMgr.getTopView(); - if (top_view) + LLUICtrl* top_ctrl = gFocusMgr.getTopCtrl(); + if (top_ctrl) { S32 local_x; S32 local_y; - top_view->screenPointToLocal( mCurrentMousePoint.mX, mCurrentMousePoint.mY, &local_x, &local_y ); - if (top_view->handleScrollWheel(local_x, local_y, clicks)) return; + top_ctrl->screenPointToLocal( mCurrentMousePoint.mX, mCurrentMousePoint.mY, &local_x, &local_y ); + if (top_ctrl->handleScrollWheel(local_x, local_y, clicks)) return; } if (mRootView->handleScrollWheel(mCurrentMousePoint.mX, mCurrentMousePoint.mY, clicks) ) @@ -2396,8 +2649,8 @@ BOOL LLViewerWindow::handlePerFrameHover() BOOL handled = FALSE; - BOOL handled_by_top_view = FALSE; - LLView* top_view = gFocusMgr.getTopView(); + BOOL handled_by_top_ctrl = FALSE; + LLUICtrl* top_ctrl = gFocusMgr.getTopCtrl(); LLMouseHandler* mouse_captor = gFocusMgr.getMouseCapture(); if( mouse_captor ) @@ -2419,12 +2672,12 @@ BOOL LLViewerWindow::handlePerFrameHover() } else { - if (top_view) + if (top_ctrl) { S32 local_x, local_y; - top_view->screenPointToLocal( x, y, &local_x, &local_y ); - handled = top_view->pointInView(local_x, local_y) && top_view->handleHover(local_x, local_y, mask); - handled_by_top_view = TRUE; + top_ctrl->screenPointToLocal( x, y, &local_x, &local_y ); + handled = top_ctrl->pointInView(local_x, local_y) && top_ctrl->handleHover(local_x, local_y, mask); + handled_by_top_ctrl = TRUE; } if ( !handled ) @@ -2511,11 +2764,11 @@ BOOL LLViewerWindow::handlePerFrameHover() mouse_captor->screenPointToLocal( x, y, &local_x, &local_y ); tool_tip_handled = mouse_captor->handleToolTip( local_x, local_y, tool_tip_msg, &screen_sticky_rect ); } - else if (handled_by_top_view) + else if (handled_by_top_ctrl) { S32 local_x, local_y; - top_view->screenPointToLocal( x, y, &local_x, &local_y ); - tool_tip_handled = top_view->handleToolTip( local_x, local_y, tool_tip_msg, &screen_sticky_rect ); + top_ctrl->screenPointToLocal( x, y, &local_x, &local_y ); + tool_tip_handled = top_ctrl->handleToolTip( local_x, local_y, tool_tip_msg, &screen_sticky_rect ); } else { @@ -4155,9 +4408,9 @@ BOOL LLViewerWindow::childHasKeyboardFocus(const LLView* parent) const return gFocusMgr.childHasKeyboardFocus( parent ); } -void LLViewerWindow::setMouseCapture(LLMouseHandler* new_captor,void (*on_capture_lost)(LLMouseHandler* old_captor)) +void LLViewerWindow::setMouseCapture(LLMouseHandler* new_captor) { - gFocusMgr.setMouseCapture( new_captor, on_capture_lost ); + gFocusMgr.setMouseCapture( new_captor ); } LLMouseHandler* LLViewerWindow::getMouseCaptor() const @@ -4165,11 +4418,6 @@ LLMouseHandler* LLViewerWindow::getMouseCaptor() const return gFocusMgr.getMouseCapture(); } -BOOL LLViewerWindow::hasMouseCapture(const LLMouseHandler* possible_captor) const -{ - return possible_captor == gFocusMgr.getMouseCapture(); -} - S32 LLViewerWindow::getWindowHeight() const { return mVirtualWindowRect.getHeight(); @@ -4190,19 +4438,19 @@ S32 LLViewerWindow::getWindowDisplayWidth() const return mWindowRect.getWidth(); } -LLView* LLViewerWindow::getTopView() const +LLUICtrl* LLViewerWindow::getTopCtrl() const { - return gFocusMgr.getTopView(); + return gFocusMgr.getTopCtrl(); } -BOOL LLViewerWindow::hasTopView(LLView* view) const +BOOL LLViewerWindow::hasTopCtrl(LLView* view) const { - return view == gFocusMgr.getTopView(); + return view == gFocusMgr.getTopCtrl(); } -void LLViewerWindow::setTopView(LLView* new_top,void (*on_top_lost)(LLView* old_top)) +void LLViewerWindow::setTopCtrl(LLUICtrl* new_top) { - gFocusMgr.setTopView( new_top, on_top_lost ); + gFocusMgr.setTopCtrl( new_top ); } void LLViewerWindow::setupViewport(S32 x_offset, S32 y_offset) @@ -4810,6 +5058,8 @@ LLAlertDialog* LLViewerWindow::alertXmlEditText(const std::string& xml_filename, return alert; } +//////////////////////////////////////////////////////////////////////////// + LLBottomPanel::LLBottomPanel(const LLString &name, const LLRect &rect) : LLPanel(name, rect, FALSE), mIndicator(NULL) diff --git a/indra/newview/llviewerwindow.h b/indra/newview/llviewerwindow.h index 5b56bbae06..8f3642ffd3 100644 --- a/indra/newview/llviewerwindow.h +++ b/indra/newview/llviewerwindow.h @@ -107,8 +107,8 @@ public: BOOL getLeftMouseDown() const { return mLeftMouseDown; } BOOL getRightMouseDown() const { return mRightMouseDown; } - LLView* getTopView() const; - BOOL hasTopView(LLView* view) const; + LLUICtrl* getTopCtrl() const; + BOOL hasTopCtrl(LLView* view) const; void setupViewport(S32 x_offset = 0, S32 y_offset = 0); void setup3DRender(); @@ -160,17 +160,18 @@ public: BOOL hasKeyboardFocus( const LLUICtrl* possible_focus ) const; BOOL childHasKeyboardFocus( const LLView* parent ) const; - void setMouseCapture(LLMouseHandler* new_captor,void (*on_capture_lost)(LLMouseHandler* old_captor)); // new_captor = NULL to release the mouse. - BOOL hasMouseCapture(const LLMouseHandler* possible_captor ) const; + void setMouseCapture(LLMouseHandler* new_captor); // new_captor = NULL to release the mouse. LLMouseHandler* getMouseCaptor() const; - void setTopView(LLView* new_top, void (*on_top_lost)(LLView* old_top)); // set new_top = NULL to release top_view. + void setTopCtrl(LLUICtrl* new_top); // set new_top = NULL to release top_view. void reshape(S32 width, S32 height); void sendShapeToSim(); void draw(); // void drawSelectedObjects(); + void updateDebugText(); + void drawDebugText(); static void loadUserImage(void **cb_data, const LLUUID &uuid); @@ -188,7 +189,7 @@ public: BOOL saveSnapshot(const LLString& filename, S32 image_width, S32 image_height, BOOL show_ui = TRUE, BOOL do_rebuild = FALSE, ESnapshotType type = SNAPSHOT_TYPE_COLOR); BOOL rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_height, BOOL keep_window_aspect = TRUE, - BOOL show_ui = TRUE, BOOL do_rebuild = FALSE, ESnapshotType type = SNAPSHOT_TYPE_COLOR ); + BOOL show_ui = TRUE, BOOL do_rebuild = FALSE, ESnapshotType type = SNAPSHOT_TYPE_COLOR ); BOOL saveImageNumbered(LLImageRaw *raw, const LLString& extension = ""); void playSnapshotAnimAndSound(); @@ -259,7 +260,7 @@ private: void stopGL(BOOL save_state = TRUE); void restoreGL(const LLString& progress_message = LLString::null); void initFonts(F32 zoom_factor = 1.f); - + void analyzeHit( S32 x, // input S32 y_from_bot, // input @@ -272,6 +273,7 @@ private: F32* hit_u_coord, // output F32* hit_v_coord); // output + public: LLWindow* mWindow; // graphical window object @@ -314,13 +316,16 @@ protected: LLString mOverlayTitle; // Used for special titles such as "Second Life - Special E3 2003 Beta" + BOOL mIgnoreActivate; + U8* mPickBuffer; + + class LLDebugText* mDebugText; // Internal class for debug text + +protected: static char sSnapshotBaseName[LL_MAX_PATH]; /* Flawfinder: ignore */ static char sSnapshotDir[LL_MAX_PATH]; /* Flawfinder: ignore */ static char sMovieBaseName[LL_MAX_PATH]; /* Flawfinder: ignore */ - - BOOL mIgnoreActivate; - U8* mPickBuffer; }; class LLBottomPanel : public LLPanel diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 5db295874c..f0e797b6e9 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -90,6 +90,7 @@ #include "llwearablelist.h" #include "llworld.h" #include "pipeline.h" +#include "llglslshader.h" #include "viewer.h" #include "lscript_byteformat.h" @@ -2556,7 +2557,7 @@ BOOL LLVOAvatar::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time) } // update wind effect - if ((gPipeline.getVertexShaderLevel(LLPipeline::SHADER_AVATAR) >= LLDrawPoolAvatar::SHADER_LEVEL_CLOTH)) + if ((LLShaderMgr::getVertexShaderLevel(LLShaderMgr::SHADER_AVATAR) >= LLDrawPoolAvatar::SHADER_LEVEL_CLOTH)) { F32 hover_strength = 0.f; F32 time_delta = mRippleTimer.getElapsedTimeF32() - mRippleTimeLast; @@ -3015,38 +3016,30 @@ void LLVOAvatar::updateCharacter(LLAgent &agent) // clear debug text mDebugText.clear(); - if (LLVOAvatar::sShowAnimationDebug) { - LLString playing_anims; - for (LLMotion* motionp = mMotionController.getFirstActiveMotion(); - motionp; - motionp = mMotionController.getNextActiveMotion()) + for (LLMotionController::motion_list_t::iterator iter = mMotionController.getActiveMotions().begin(); + iter != mMotionController.getActiveMotions().end(); ++iter) + { + LLMotion* motionp = *iter; + if (motionp->getMinPixelArea() < getPixelArea()) { - if (motionp->getMinPixelArea() < getPixelArea()) + std::string output; + if (motionp->getName().empty()) { - char output[MAX_STRING]; /* Flawfinder: ignore */ - if (motionp->getName().empty()) - { - snprintf( /* Flawfinder: ignore */ - output, - MAX_STRING, - "%s - %d", - motionp->getID().asString().c_str(), - (U32)motionp->getPriority()); - } - else - { - snprintf( /* Flawfinder: ignore */ - output, - MAX_STRING, - "%s - %d", - motionp->getName().c_str(), - (U32)motionp->getPriority()); - } - addDebugText(output); + output = llformat("%s - %d", + motionp->getID().asString().c_str(), + (U32)motionp->getPriority()); } + else + { + output = llformat("%s - %d", + motionp->getName().c_str(), + (U32)motionp->getPriority()); + } + addDebugText(output); } + } } if (gNoRender) @@ -4592,7 +4585,7 @@ S32 LLVOAvatar::getCollisionVolumeID(std::string &name) //----------------------------------------------------------------------------- // addDebugText() //----------------------------------------------------------------------------- -void LLVOAvatar::addDebugText(const char* text) + void LLVOAvatar::addDebugText(const std::string& text) { mDebugText.append(1, '\n'); mDebugText.append(text); diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index 2660e7c90d..3257e921bc 100644 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -368,7 +368,7 @@ public: virtual LLVector3 getVolumePos(S32 joint_index, LLVector3& volume_offset); virtual LLJoint* findCollisionVolume(U32 volume_id); virtual S32 getCollisionVolumeID(std::string &name); - virtual void addDebugText(const char* text); + virtual void addDebugText(const std::string& text); virtual const LLUUID& getID(); virtual LLJoint *getJoint( const std::string &name ); diff --git a/indra/newview/llvosky.cpp b/indra/newview/llvosky.cpp index 987d2ac7cb..94f9f0b21f 100644 --- a/indra/newview/llvosky.cpp +++ b/indra/newview/llvosky.cpp @@ -617,7 +617,6 @@ void LLVOSky::restoreGL() calcBrightnessScaleAndColors(); - // Water is currently broken on Mac. if (gSavedSettings.getBOOL("RenderWater") && gGLManager.mHasCubeMap) { LLCubeMap* cube_map = getCubeMap(); @@ -1232,18 +1231,14 @@ BOOL LLVOSky::updateSky() mSkyTex[side].createGLImage(mSkyTex[side].getWhich(FALSE)); } next_frame = 0; - //llSkyTex::stepCurrent(); } - if (!gSavedSettings.getBOOL("RenderDynamicReflections")) + std::vector<LLPointer<LLImageRaw> > images; + for (S32 side = 0; side < 6; side++) { - std::vector<LLPointer<LLImageRaw> > images; - for (S32 side = 0; side < 6; side++) - { - images.push_back(mSkyTex[side].getImageRaw(FALSE)); - } - mCubeMap->init(images); + images.push_back(mSkyTex[side].getImageRaw(FALSE)); } + mCubeMap->init(images); } } diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index b5b9e06831..a42d447d5f 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -268,7 +268,11 @@ void LLVOVolume::animateTextures() { continue; } - if (result & LLViewerTextureAnim::ROTATE) + if (!(result & LLViewerTextureAnim::ROTATE)) + { + te->getRotation(&rot); + } + { F32 axis = -1; F32 s,t; @@ -293,16 +297,20 @@ void LLVOVolume::animateTextures() tex_mat.identity(); tex_mat.translate(LLVector3(-0.5f, -0.5f, 0.f)); - tex_mat.rotate(quat); - - if (result & LLViewerTextureAnim::SCALE) + tex_mat.rotate(quat); + + if (!(result & LLViewerTextureAnim::SCALE)) + { + te->getScale(&scale_s, &scale_t); + } + { scale.setVec(scale_s, scale_t, 1.f); LLMatrix4 mat; mat.initAll(scale, LLQuaternion(), LLVector3()); tex_mat *= mat; } - + tex_mat.translate(trans); } } @@ -310,6 +318,35 @@ void LLVOVolume::animateTextures() { if (mTexAnimMode && mTextureAnimp->mRate == 0) { + U8 start, count; + + if (mTextureAnimp->mFace == -1) + { + start = 0; + count = getNumTEs(); + } + else + { + start = (U8) mTextureAnimp->mFace; + count = 1; + } + + for (S32 i = start; i < start + count; i++) + { + if (mTexAnimMode & LLViewerTextureAnim::TRANSLATE) + { + setTEOffset(i, mTextureAnimp->mOffS, mTextureAnimp->mOffT); + } + if (mTexAnimMode & LLViewerTextureAnim::SCALE) + { + setTEScale(i, mTextureAnimp->mScaleS, mTextureAnimp->mScaleT); + } + if (mTexAnimMode & LLViewerTextureAnim::ROTATE) + { + setTERotation(i, mTextureAnimp->mRot); + } + } + gPipeline.markTextured(mDrawable); mFaceMappingChanged = TRUE; mTexAnimMode = 0; diff --git a/indra/newview/llworld.cpp b/indra/newview/llworld.cpp index 752d5a38c6..83420f8761 100644 --- a/indra/newview/llworld.cpp +++ b/indra/newview/llworld.cpp @@ -11,6 +11,7 @@ #include "llworld.h" #include "indra_constants.h" +#include "llstl.h" #include "llagent.h" #include "llviewercontrol.h" @@ -90,8 +91,7 @@ LLWorld::LLWorld(const U32 grids_per_region, const F32 meters_per_grid) LLWorld::~LLWorld() { gObjectList.killAllObjects(); - - mRegionList.deleteAllData(); + for_each(mRegionList.begin(), mRegionList.end(), DeletePointer()); } @@ -151,9 +151,9 @@ LLViewerRegion* LLWorld::addRegion(const U64 ®ion_handle, const LLHost &host) regionp->mCloudLayer.setWidth((F32)mWidth); regionp->mCloudLayer.setWindPointer(®ionp->mWind); - mRegionList.addData(regionp); - mActiveRegionList.addData(regionp); - mCulledRegionList.addData(regionp); + mRegionList.push_back(regionp); + mActiveRegionList.push_back(regionp); + mCulledRegionList.push_back(regionp); // Find all the adjacent regions, and attach them. @@ -205,9 +205,10 @@ void LLWorld::removeRegion(const LLHost &host) if (regionp == gAgent.getRegion()) { - LLViewerRegion *reg; - for (reg = mRegionList.getFirstData(); reg; reg = mRegionList.getNextData()) + for (region_list_t::iterator iter = mRegionList.begin(); + iter != mRegionList.end(); ++iter) { + LLViewerRegion* reg = *iter; llwarns << "RegionDump: " << reg->getName() << " " << reg->getHost() << " " << reg->getOriginGlobal() @@ -230,42 +231,23 @@ void LLWorld::removeRegion(const LLHost &host) from_region_handle(regionp->getHandle(), &x, &y); llinfos << "Removing region " << x << ":" << y << llendl; - // This code can probably be blitzed now... - if (!mRegionList.removeData(regionp)) - { - for (regionp = mRegionList.getFirstData(); regionp; regionp = mRegionList.getNextData()) - { - llwarns << "RegionDump: " << regionp->getName() - << " " << regionp->getHost() - << " " << regionp->getOriginGlobal() - << llendl; - } - - llerrs << "Region list is broken" << llendl; - } - - if (!mActiveRegionList.removeData(regionp)) - { - llwarns << "LLWorld.mActiveRegionList is broken." << llendl; - } - if (!mCulledRegionList.removeData(regionp)) - { - if (!mVisibleRegionList.removeData(regionp)) - { - llwarns << "LLWorld.mCulled/mVisibleRegionList are broken" << llendl;; - } - } + mRegionList.remove(regionp); + mActiveRegionList.remove(regionp); + mCulledRegionList.remove(regionp); + mVisibleRegionList.remove(regionp); + delete regionp; updateWaterObjects(); } -LLViewerRegion *LLWorld::getRegion(const LLHost &host) +LLViewerRegion* LLWorld::getRegion(const LLHost &host) { - LLViewerRegion *regionp; - for (regionp = mRegionList.getFirstData(); regionp; regionp = mRegionList.getNextData()) + for (region_list_t::iterator iter = mRegionList.begin(); + iter != mRegionList.end(); ++iter) { + LLViewerRegion* regionp = *iter; if (regionp->getHost() == host) { return regionp; @@ -274,16 +256,17 @@ LLViewerRegion *LLWorld::getRegion(const LLHost &host) return NULL; } -LLViewerRegion *LLWorld::getRegionFromPosAgent(const LLVector3 &pos) +LLViewerRegion* LLWorld::getRegionFromPosAgent(const LLVector3 &pos) { return getRegionFromPosGlobal(gAgent.getPosGlobalFromAgent(pos)); } -LLViewerRegion *LLWorld::getRegionFromPosGlobal(const LLVector3d &pos) +LLViewerRegion* LLWorld::getRegionFromPosGlobal(const LLVector3d &pos) { - LLViewerRegion *regionp; - for (regionp = mRegionList.getFirstData(); regionp; regionp = mRegionList.getNextData()) + for (region_list_t::iterator iter = mRegionList.begin(); + iter != mRegionList.end(); ++iter) { + LLViewerRegion* regionp = *iter; if (regionp->pointInRegionGlobal(pos)) { return regionp; @@ -357,11 +340,12 @@ LLVector3d LLWorld::clipToVisibleRegions(const LLVector3d &start_pos, const LLVe return regionp->getPosGlobalFromRegion(LLVector3(final_region_pos)); } -LLViewerRegion *LLWorld::getRegionFromHandle(const U64 &handle) +LLViewerRegion* LLWorld::getRegionFromHandle(const U64 &handle) { - LLViewerRegion *regionp; - for (regionp = mRegionList.getFirstData(); regionp; regionp = mRegionList.getNextData()) + for (region_list_t::iterator iter = mRegionList.begin(); + iter != mRegionList.end(); ++iter) { + LLViewerRegion* regionp = *iter; if (regionp->getHandle() == handle) { return regionp; @@ -374,9 +358,10 @@ LLViewerRegion *LLWorld::getRegionFromHandle(const U64 &handle) void LLWorld::updateAgentOffset(const LLVector3d &offset_global) { #if 0 - LLViewerRegion *regionp; - for (regionp = mRegionList.getFirstData(); regionp; regionp = mRegionList.getNextData()) + for (region_list_t::iterator iter = mRegionList.begin(); + iter != mRegionList.end(); ++iter) { + LLViewerRegion* regionp = *iter; regionp->setAgentOffset(offset_global); } #endif @@ -385,9 +370,10 @@ void LLWorld::updateAgentOffset(const LLVector3d &offset_global) BOOL LLWorld::positionRegionValidGlobal(const LLVector3d &pos_global) { - LLViewerRegion *regionp; - for (regionp = mRegionList.getFirstData(); regionp; regionp = mRegionList.getNextData()) + for (region_list_t::iterator iter = mRegionList.begin(); + iter != mRegionList.end(); ++iter) { + LLViewerRegion* regionp = *iter; if (regionp->pointInRegionGlobal(pos_global)) { return TRUE; @@ -552,32 +538,29 @@ void LLWorld::updateVisibilities() gCamera->setFar(mLandFarClip); - LLViewerRegion *regionp; - F32 diagonal_squared = F_SQRT2 * F_SQRT2 * mWidth * mWidth; // Go through the culled list and check for visible regions - for (regionp = mCulledRegionList.getFirstData(); - regionp; - regionp = mCulledRegionList.getNextData()) + for (region_list_t::iterator iter = mCulledRegionList.begin(); + iter != mCulledRegionList.end(); ) { + region_list_t::iterator curiter = iter++; + LLViewerRegion* regionp = *curiter; F32 height = regionp->getLand().getMaxZ() - regionp->getLand().getMinZ(); F32 radius = 0.5f*fsqrtf(height * height + diagonal_squared); if (!regionp->getLand().hasZData() || gCamera->sphereInFrustum(regionp->getCenterAgent(), radius)) { - mCulledRegionList.removeCurrentData(); - mVisibleRegionList.addDataAtEnd(regionp); + mCulledRegionList.erase(curiter); + mVisibleRegionList.push_back(regionp); } } - F32 last_dist_squared = 0.0f; - F32 dist_squared; - - // Update all of the visible regions and make single bubble-sort pass - for (regionp = mVisibleRegionList.getFirstData(); - regionp; - regionp = mVisibleRegionList.getNextData()) + // Update all of the visible regions + for (region_list_t::iterator iter = mVisibleRegionList.begin(); + iter != mVisibleRegionList.end(); ) { + region_list_t::iterator curiter = iter++; + LLViewerRegion* regionp = *curiter; if (!regionp->getLand().hasZData()) { continue; @@ -587,44 +570,35 @@ void LLWorld::updateVisibilities() F32 radius = 0.5f*fsqrtf(height * height + diagonal_squared); if (gCamera->sphereInFrustum(regionp->getCenterAgent(), radius)) { + regionp->calculateCameraDistance(); if (!gNoRender) { regionp->getLand().updatePatchVisibilities(gAgent); } - - // sort by distance... closer regions to the front - // Note: regions use absolute frame so we use the agent's center - dist_squared = (F32)(gAgent.getCameraPositionGlobal() - regionp->getCenterGlobal()).magVecSquared(); - if (dist_squared < last_dist_squared) - { - mVisibleRegionList.swapCurrentWithPrevious(); - } - else - { - last_dist_squared = dist_squared; - } } else { - mVisibleRegionList.removeCurrentData(); - mCulledRegionList.addData(regionp); + mVisibleRegionList.erase(curiter); + mCulledRegionList.push_back(regionp); } } + // Sort visible regions + mVisibleRegionList.sort(LLViewerRegion::CompareDistance()); + gCamera->setFar(cur_far_clip); } void LLWorld::updateRegions(F32 max_update_time) { - LLViewerRegion *regionp; LLTimer update_timer; BOOL did_one = FALSE; // Perform idle time updates for the regions (and associated surfaces) - for (regionp = mRegionList.getFirstData(); - regionp; - regionp = mRegionList.getNextData()) + for (region_list_t::iterator iter = mRegionList.begin(); + iter != mRegionList.end(); ++iter) { + LLViewerRegion* regionp = *iter; F32 max_time = max_update_time - update_timer.getElapsedTimeF32(); if (did_one && max_time <= 0.f) break; @@ -645,47 +619,45 @@ void LLWorld::updateClouds(const F32 dt) // don't move clouds in snapshot mode return; } - LLViewerRegion *regionp; - if (mActiveRegionList.getLength()) + if (mActiveRegionList.size()) { // Update all the cloud puff positions, and timer based stuff // such as death decay - for (regionp = mActiveRegionList.getFirstData(); - regionp; - regionp = mActiveRegionList.getNextData()) + for (region_list_t::iterator iter = mActiveRegionList.begin(); + iter != mActiveRegionList.end(); ++iter) { + LLViewerRegion* regionp = *iter; regionp->mCloudLayer.updatePuffs(dt); } // Reshuffle who owns which puffs - for (regionp = mActiveRegionList.getFirstData(); - regionp; - regionp = mActiveRegionList.getNextData()) + for (region_list_t::iterator iter = mActiveRegionList.begin(); + iter != mActiveRegionList.end(); ++iter) { + LLViewerRegion* regionp = *iter; regionp->mCloudLayer.updatePuffOwnership(); } // Add new puffs - for (regionp = mActiveRegionList.getFirstData(); - regionp; - regionp = mActiveRegionList.getNextData()) + for (region_list_t::iterator iter = mActiveRegionList.begin(); + iter != mActiveRegionList.end(); ++iter) { + LLViewerRegion* regionp = *iter; regionp->mCloudLayer.updatePuffCount(); } } } -LLCloudGroup *LLWorld::findCloudGroup(const LLCloudPuff &puff) +LLCloudGroup* LLWorld::findCloudGroup(const LLCloudPuff &puff) { - LLViewerRegion *regionp; - if (mActiveRegionList.getLength()) + if (mActiveRegionList.size()) { // Update all the cloud puff positions, and timer based stuff // such as death decay - for (regionp = mActiveRegionList.getFirstData(); - regionp; - regionp = mActiveRegionList.getNextData()) + for (region_list_t::iterator iter = mActiveRegionList.begin(); + iter != mActiveRegionList.end(); ++iter) { + LLViewerRegion* regionp = *iter; LLCloudGroup *groupp = regionp->mCloudLayer.findCloudGroup(puff); if (groupp) { @@ -702,11 +674,12 @@ void LLWorld::renderPropertyLines() S32 region_count = 0; S32 vertex_count = 0; - LLViewerRegion* region; - for (region = mVisibleRegionList.getFirstData(); region; region = mVisibleRegionList.getNextData() ) + for (region_list_t::iterator iter = mVisibleRegionList.begin(); + iter != mVisibleRegionList.end(); ++iter) { + LLViewerRegion* regionp = *iter; region_count++; - vertex_count += region->renderPropertyLines(); + vertex_count += regionp->renderPropertyLines(); } } @@ -715,10 +688,11 @@ void LLWorld::updateNetStats() { F32 bits = 0.f; U32 packets = 0; - LLViewerRegion *regionp; - for (regionp = mActiveRegionList.getFirstData(); regionp; regionp = mActiveRegionList.getNextData()) + for (region_list_t::iterator iter = mActiveRegionList.begin(); + iter != mActiveRegionList.end(); ++iter) { + LLViewerRegion* regionp = *iter; regionp->updateNetStats(); bits += regionp->mBitStat.getCurrent(); packets += llfloor( regionp->mPacketsStat.getCurrent() ); @@ -753,27 +727,24 @@ void LLWorld::updateNetStats() void LLWorld::printPacketsLost() { - LLViewerRegion *regionp; - llinfos << "Simulators:" << llendl; llinfos << "----------" << llendl; LLCircuitData *cdp = NULL; - for (regionp = mActiveRegionList.getFirstData(); - regionp; - regionp = mActiveRegionList.getNextData()) + for (region_list_t::iterator iter = mActiveRegionList.begin(); + iter != mActiveRegionList.end(); ++iter) + { + LLViewerRegion* regionp = *iter; + cdp = gMessageSystem->mCircuitInfo.findCircuit(regionp->getHost()); + if (cdp) { - cdp = gMessageSystem->mCircuitInfo.findCircuit(regionp->getHost()); - if (cdp) - { - LLVector3d range = regionp->getCenterGlobal() - gAgent.getPositionGlobal(); + LLVector3d range = regionp->getCenterGlobal() - gAgent.getPositionGlobal(); - llinfos << regionp->getHost() << ", range: " << range.magVec() << - " packets lost: " << - cdp->getPacketsLost() << llendl; - } + llinfos << regionp->getHost() << ", range: " << range.magVec() + << " packets lost: " << cdp->getPacketsLost() << llendl; } - + } + llinfos << "UserServer:" << llendl; llinfos << "-----------" << llendl; @@ -786,9 +757,11 @@ void LLWorld::printPacketsLost() void LLWorld::processCoarseUpdate(LLMessageSystem* msg, void** user_data) { - LLViewerRegion* region = NULL; - region = gWorldp->getRegion(msg->getSender()); - if( region ) region->updateCoarseLocations(msg); + LLViewerRegion* region = gWorldp->getRegion(msg->getSender()); + if( region ) + { + region->updateCoarseLocations(msg); + } } F32 LLWorld::getLandFarClip() const @@ -809,49 +782,55 @@ void LLWorld::updateWaterObjects() { return; } - S32 min_x, min_y, max_x, max_y; - U32 region_x, region_y; - - S32 rwidth = llfloor(getRegionWidthInMeters()); - - // First, determine the min and max "box" of water objects - LLViewerRegion *regionp; - regionp = mRegionList.getFirstData(); - - if (!regionp) + if (mRegionList.empty()) { llwarns << "No regions!" << llendl; return; } - from_region_handle(regionp->getHandle(), ®ion_x, ®ion_y); - min_x = max_x = region_x; - min_y = max_y = region_y; + // First, determine the min and max "box" of water objects + bool first = true; + S32 min_x, min_y, max_x, max_y; + U32 region_x, region_y; - LLVOWater *waterp; + S32 rwidth = llfloor(getRegionWidthInMeters()); - for (; regionp; regionp = mRegionList.getNextData()) + + for (region_list_t::iterator iter = mRegionList.begin(); + iter != mRegionList.end(); ++iter) { + LLViewerRegion* regionp = *iter; from_region_handle(regionp->getHandle(), ®ion_x, ®ion_y); - min_x = llmin(min_x, (S32)region_x); - min_y = llmin(min_y, (S32)region_y); - max_x = llmax(max_x, (S32)region_x); - max_y = llmax(max_y, (S32)region_y); - waterp = regionp->getLand().getWaterObj(); + if (first) + { + first = false; + min_x = max_x = region_x; + min_y = max_y = region_y; + } + else + { + min_x = llmin(min_x, (S32)region_x); + min_y = llmin(min_y, (S32)region_y); + max_x = llmax(max_x, (S32)region_x); + max_y = llmax(max_y, (S32)region_y); + } + LLVOWater* waterp = regionp->getLand().getWaterObj(); if (waterp) { gObjectList.updateActive(waterp); } } - for (waterp = mHoleWaterObjects.getFirstData(); waterp; waterp = mHoleWaterObjects.getNextData()) + for (std::list<LLVOWater*>::iterator iter = mHoleWaterObjects.begin(); + iter != mHoleWaterObjects.end(); ++ iter) { + LLVOWater* waterp = *iter; gObjectList.killObject(waterp); } - mHoleWaterObjects.removeAllNodes(); + mHoleWaterObjects.clear(); // We only want to fill in holes for stuff that's near us, say, within 512m - regionp = gAgent.getRegion(); + LLViewerRegion* regionp = gAgent.getRegion(); from_region_handle(regionp->getHandle(), ®ion_x, ®ion_y); min_x = llmax((S32)region_x - 512, min_x); @@ -868,14 +847,14 @@ void LLWorld::updateWaterObjects() U64 region_handle = to_region_handle(x, y); if (!getRegionFromHandle(region_handle)) { - waterp = (LLVOWater *)gObjectList.createObjectViewer(LLViewerObject::LL_VO_WATER, gAgent.getRegion()); + LLVOWater* waterp = (LLVOWater *)gObjectList.createObjectViewer(LLViewerObject::LL_VO_WATER, gAgent.getRegion()); waterp->setUseTexture(FALSE); gPipeline.addObject(waterp); waterp->setPositionGlobal(LLVector3d(x + rwidth/2, y + rwidth/2, DEFAULT_WATER_HEIGHT)); waterp->setScale(LLVector3((F32)rwidth, (F32)rwidth, 0.f)); - mHoleWaterObjects.addData(waterp); + mHoleWaterObjects.push_back(waterp); } } } @@ -924,7 +903,7 @@ void LLWorld::updateWaterObjects() const S32 water_center_y = center_y + llround((wy + dim[1]) * 0.5f * gDirAxes[dir][1]); - waterp = mEdgeWaterObjects[dir]; + LLVOWater* waterp = mEdgeWaterObjects[dir]; if (!waterp || waterp->isDead()) { // The edge water objects can be dead because they're attached to the region that the @@ -952,7 +931,7 @@ void LLWorld::updateWaterObjects() //llinfos << "End water update" << llendl; } -LLViewerImage *LLWorld::getDefaultWaterTexture() +LLViewerImage* LLWorld::getDefaultWaterTexture() { return mDefaultWaterTexturep; } @@ -969,10 +948,10 @@ U64 LLWorld::getSpaceTimeUSec() const void LLWorld::requestCacheMisses() { - for(LLViewerRegion* regionp = mRegionList.getFirstData(); - regionp; - regionp = mRegionList.getNextData()) + for (region_list_t::iterator iter = mRegionList.begin(); + iter != mRegionList.end(); ++iter) { + LLViewerRegion* regionp = *iter; regionp->requestCacheMisses(); } } @@ -980,10 +959,10 @@ void LLWorld::requestCacheMisses() LLString LLWorld::getInfoString() { LLString info_string("World Info:\n"); - for (LLViewerRegion* regionp = mRegionList.getFirstData(); - regionp; - regionp = mRegionList.getNextData()) + for (region_list_t::iterator iter = mRegionList.begin(); + iter != mRegionList.end(); ++iter) { + LLViewerRegion* regionp = *iter; info_string += regionp->getInfoString(); } return info_string; @@ -992,10 +971,10 @@ LLString LLWorld::getInfoString() void LLWorld::disconnectRegions() { LLMessageSystem* msg = gMessageSystem; - for(LLViewerRegion* regionp = mRegionList.getFirstData(); - regionp; - regionp = mRegionList.getNextData()) + for (region_list_t::iterator iter = mRegionList.begin(); + iter != mRegionList.end(); ++iter) { + LLViewerRegion* regionp = *iter; if (regionp == gAgent.getRegion()) { // Skip the main agent @@ -1075,8 +1054,11 @@ void process_region_handshake(LLMessageSystem* msg, void** user_data) void send_agent_pause() { // world not initialized yet - if (!gWorldp) return; - + if (!gWorldp) + { + return; + } + gMessageSystem->newMessageFast(_PREHASH_AgentPause); gMessageSystem->nextBlockFast(_PREHASH_AgentData); gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgentID); @@ -1085,11 +1067,10 @@ void send_agent_pause() gAgentPauseSerialNum++; gMessageSystem->addU32Fast(_PREHASH_SerialNum, gAgentPauseSerialNum); - LLViewerRegion *regionp; - for (regionp = gWorldp->mActiveRegionList.getFirstData(); - regionp; - regionp = gWorldp->mActiveRegionList.getNextData()) + for (LLWorld::region_list_t::iterator iter = gWorldp->mActiveRegionList.begin(); + iter != gWorldp->mActiveRegionList.end(); ++iter) { + LLViewerRegion* regionp = *iter; gMessageSystem->sendReliable(regionp->getHost()); } @@ -1113,11 +1094,10 @@ void send_agent_resume() gMessageSystem->addU32Fast(_PREHASH_SerialNum, gAgentPauseSerialNum); - LLViewerRegion *regionp; - for (regionp = gWorldp->mActiveRegionList.getFirstData(); - regionp; - regionp = gWorldp->mActiveRegionList.getNextData()) + for (LLWorld::region_list_t::iterator iter = gWorldp->mActiveRegionList.begin(); + iter != gWorldp->mActiveRegionList.end(); ++iter) { + LLViewerRegion* regionp = *iter; gMessageSystem->sendReliable(regionp->getHost()); } diff --git a/indra/newview/llworld.h b/indra/newview/llworld.h index 0d0d1b3211..4c1dc0343e 100644 --- a/indra/newview/llworld.h +++ b/indra/newview/llworld.h @@ -10,8 +10,6 @@ #define LL_LLWORLD_H #include "llpatchvertexarray.h" -#include "doublelinkedlist.h" -#include "linked_lists.h" #include "llmath.h" //#include "vmath.h" @@ -122,14 +120,17 @@ public: U64 getSpaceTimeUSec() const; LLString getInfoString(); + public: - LLDoubleLinkedList<LLViewerRegion> mActiveRegionList; + typedef std::list<LLViewerRegion*> region_list_t; + + region_list_t mActiveRegionList; LLViewerPartSim mPartSim; private: - LLLinkedList<LLViewerRegion> mRegionList; - LLDoubleLinkedList<LLViewerRegion> mVisibleRegionList; - LLDoubleLinkedList<LLViewerRegion> mCulledRegionList; + region_list_t mRegionList; + region_list_t mVisibleRegionList; + region_list_t mCulledRegionList; // Number of points on edge const U32 mWidth; @@ -156,7 +157,7 @@ private: U32 mMinRegionY; U32 mMaxRegionY; - LLLinkedList<LLVOWater> mHoleWaterObjects; + std::list<LLVOWater*> mHoleWaterObjects; LLPointer<LLVOWater> mEdgeWaterObjects[8]; LLPointer<LLViewerImage> mDefaultWaterTexturep; diff --git a/indra/newview/llworldmapview.cpp b/indra/newview/llworldmapview.cpp index fde1411563..9d2fb122e5 100644 --- a/indra/newview/llworldmapview.cpp +++ b/indra/newview/llworldmapview.cpp @@ -1770,7 +1770,7 @@ BOOL outside_slop(S32 x, S32 y, S32 start_x, S32 start_y) BOOL LLWorldMapView::handleMouseDown( S32 x, S32 y, MASK mask ) { - gFocusMgr.setMouseCapture( this, NULL ); + gFocusMgr.setMouseCapture( this ); mMouseDownPanX = llround(sPanX); mMouseDownPanY = llround(sPanY); @@ -1782,7 +1782,7 @@ BOOL LLWorldMapView::handleMouseDown( S32 x, S32 y, MASK mask ) BOOL LLWorldMapView::handleMouseUp( S32 x, S32 y, MASK mask ) { - if (this == gFocusMgr.getMouseCapture()) + if (hasMouseCapture()) { if (mPanning) { @@ -1809,7 +1809,7 @@ BOOL LLWorldMapView::handleMouseUp( S32 x, S32 y, MASK mask ) handleClick(x, y, mask, &hit_type, &id); } gViewerWindow->showCursor(); - gFocusMgr.setMouseCapture( NULL, NULL ); + gFocusMgr.setMouseCapture( NULL ); return TRUE; } return FALSE; @@ -1855,7 +1855,7 @@ void LLWorldMapView::updateVisibleBlocks() BOOL LLWorldMapView::handleHover( S32 x, S32 y, MASK mask ) { - if (this == gFocusMgr.getMouseCapture()) + if (hasMouseCapture()) { if (mPanning || outside_slop(x, y, mMouseDownX, mMouseDownY)) { diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 6b7f60457d..52ceb481d9 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -71,6 +71,8 @@ #include "viewer.h" #include "llcubemap.h" #include "lldebugmessagebox.h" +#include "llglslshader.h" +#include "llviewerjoystick.h" #ifdef _DEBUG // Debug indices is disabled for now for debug performance - djs 4/24/02 @@ -110,84 +112,6 @@ S32 gTrivialAccepts = 0; BOOL gRenderForSelect = FALSE; -//glsl parameter tables -const char* LLPipeline::sReservedAttribs[] = -{ - "materialColor", - "specularColor", - "binormal" -}; - -U32 LLPipeline::sReservedAttribCount = LLPipeline::GLSL_END_RESERVED_ATTRIBS; - -const char* LLPipeline::sAvatarAttribs[] = -{ - "weight", - "clothing", - "gWindDir", - "gSinWaveParams", - "gGravity" -}; - -U32 LLPipeline::sAvatarAttribCount = sizeof(LLPipeline::sAvatarAttribs)/sizeof(char*); - -const char* LLPipeline::sAvatarUniforms[] = -{ - "matrixPalette" -}; - -U32 LLPipeline::sAvatarUniformCount = 1; - -const char* LLPipeline::sReservedUniforms[] = -{ - "diffuseMap", - "specularMap", - "bumpMap", - "environmentMap", - "scatterMap" -}; - -U32 LLPipeline::sReservedUniformCount = LLPipeline::GLSL_END_RESERVED_UNIFORMS; - -const char* LLPipeline::sTerrainUniforms[] = -{ - "detail0", - "detail1", - "alphaRamp" -}; - -U32 LLPipeline::sTerrainUniformCount = sizeof(LLPipeline::sTerrainUniforms)/sizeof(char*); - -const char* LLPipeline::sGlowUniforms[] = -{ - "delta" -}; - -U32 LLPipeline::sGlowUniformCount = sizeof(LLPipeline::sGlowUniforms)/sizeof(char*); - -const char* LLPipeline::sShinyUniforms[] = -{ - "origin" -}; - -U32 LLPipeline::sShinyUniformCount = sizeof(LLPipeline::sShinyUniforms)/sizeof(char*); - -const char* LLPipeline::sWaterUniforms[] = -{ - "screenTex", - "eyeVec", - "time", - "d1", - "d2", - "lightDir", - "specular", - "lightExp", - "fbScale", - "refScale" -}; - -U32 LLPipeline::sWaterUniformCount = sizeof(LLPipeline::sWaterUniforms)/sizeof(char*); - //---------------------------------------- void stamp(F32 x, F32 y, F32 xs, F32 ys) @@ -227,7 +151,6 @@ BOOL LLPipeline::sUseOcclusion = FALSE; BOOL LLPipeline::sSkipUpdate = FALSE; BOOL LLPipeline::sDynamicReflections = FALSE; BOOL LLPipeline::sRenderGlow = FALSE; -BOOL LLPipeline::sOverrideAgentCamera = FALSE; LLPipeline::LLPipeline() : mScreenTex(0), @@ -298,14 +221,7 @@ void LLPipeline::init() // Enable features stop_glerror(); - setShaders(); -} - -void LLPipeline::LLScatterShader::init(GLhandleARB shader, int map_stage) -{ - glUseProgramObjectARB(shader); - glUniform1iARB(glGetUniformLocationARB(shader, "scatterMap"), map_stage); - glUseProgramObjectARB(0); + LLShaderMgr::setShaders(); } LLPipeline::~LLPipeline() @@ -381,7 +297,6 @@ void LLPipeline::cleanup() } mObjectPartition.clear(); - mGroupQ.clear(); mVisibleList.clear(); mVisibleGroups.clear(); mDrawableGroups.clear(); @@ -400,7 +315,6 @@ void LLPipeline::destroyGL() stop_glerror(); unloadShaders(); mHighlightFaces.clear(); - mGroupQ.clear(); mVisibleList.clear(); mVisibleGroups.clear(); mDrawableGroups.clear(); @@ -460,7 +374,7 @@ void LLPipeline::restoreGL() if (mVertexShadersEnabled) { - setShaders(); + LLShaderMgr::setShaders(); } for (U32 i = 0; i < mObjectPartition.size()-1; i++) @@ -472,352 +386,6 @@ void LLPipeline::restoreGL() } } -//============================================================================ -// Load Shader - -static LLString get_object_log(GLhandleARB ret) -{ - LLString res; - - //get log length - GLint length; - glGetObjectParameterivARB(ret, GL_OBJECT_INFO_LOG_LENGTH_ARB, &length); - if (length > 0) - { - //the log could be any size, so allocate appropriately - GLcharARB* log = new GLcharARB[length]; - glGetInfoLogARB(ret, length, &length, log); - res = LLString(log); - delete[] log; - } - return res; -} - -void LLPipeline::dumpObjectLog(GLhandleARB ret, BOOL warns) -{ - LLString log = get_object_log(ret); - if (warns) - { - llwarns << log << llendl; - } - else - { - llinfos << log << llendl; - } -} - -GLhandleARB LLPipeline::loadShader(const LLString& filename, S32 cls, GLenum type) -{ - GLenum error; - error = glGetError(); - if (error != GL_NO_ERROR) - { - llwarns << "GL ERROR entering loadShader(): " << error << llendl; - } - - llinfos << "Loading shader file: " << filename << llendl; - - if (filename.empty()) - { - return 0; - } - - - //read in from file - FILE* file = NULL; - - S32 try_gpu_class = mVertexShaderLevel[cls]; - S32 gpu_class; - - //find the most relevant file - for (gpu_class = try_gpu_class; gpu_class > 0; gpu_class--) - { //search from the current gpu class down to class 1 to find the most relevant shader - std::stringstream fname; - fname << gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "shaders/class"); - fname << gpu_class << "/" << filename; - -// llinfos << "Looking in " << fname.str().c_str() << llendl; - file = fopen(fname.str().c_str(), "r"); /* Flawfinder: ignore */ - if (file) - { - break; // done - } - } - - if (file == NULL) - { - llinfos << "GLSL Shader file not found: " << filename << llendl; - return 0; - } - - //we can't have any lines longer than 1024 characters - //or any shaders longer than 1024 lines... deal - DaveP - GLcharARB buff[1024]; - GLcharARB* text[1024]; - GLuint count = 0; - - //copy file into memory - while(fgets(buff, 1024, file) != NULL) - { - text[count++] = strdup(buff); - } - fclose(file); - - //create shader object - GLhandleARB ret = glCreateShaderObjectARB(type); - error = glGetError(); - if (error != GL_NO_ERROR) - { - llwarns << "GL ERROR in glCreateShaderObjectARB: " << error << llendl; - } - else - { - //load source - glShaderSourceARB(ret, count, (const GLcharARB**) text, NULL); - error = glGetError(); - if (error != GL_NO_ERROR) - { - llwarns << "GL ERROR in glShaderSourceARB: " << error << llendl; - } - else - { - //compile source - glCompileShaderARB(ret); - error = glGetError(); - if (error != GL_NO_ERROR) - { - llwarns << "GL ERROR in glCompileShaderARB: " << error << llendl; - } - } - } - //free memory - for (GLuint i = 0; i < count; i++) - { - free(text[i]); - } - if (error == GL_NO_ERROR) - { - //check for errors - GLint success = GL_TRUE; - glGetObjectParameterivARB(ret, GL_OBJECT_COMPILE_STATUS_ARB, &success); - error = glGetError(); - if (error != GL_NO_ERROR || success == GL_FALSE) - { - //an error occured, print log - llwarns << "GLSL Compilation Error: (" << error << ") in " << filename << llendl; - dumpObjectLog(ret); - ret = 0; - } - } - else - { - ret = 0; - } - stop_glerror(); - - //successfully loaded, save results -#if 1 // 1.9.1 - if (ret) - { - mVertexShaderLevel[cls] = try_gpu_class; - } - else - { - if (mVertexShaderLevel[cls] > 1) - { - mVertexShaderLevel[cls] = mVertexShaderLevel[cls] - 1; - ret = loadShader(filename,cls,type); - if (ret && mMaxVertexShaderLevel[cls] > mVertexShaderLevel[cls]) - { - mMaxVertexShaderLevel[cls] = mVertexShaderLevel[cls]; - } - } - } -#else - if (ret) - { - S32 max = -1; - /*if (try_gpu_class == mMaxVertexShaderLevel[cls]) - { - max = gpu_class; - }*/ - saveVertexShaderLevel(cls,try_gpu_class,max); - } - else - { - if (mVertexShaderLevel[cls] > 1) - { - mVertexShaderLevel[cls] = mVertexShaderLevel[cls] - 1; - ret = loadShader(f,cls,type); - if (ret && mMaxVertexShaderLevel[cls] > mVertexShaderLevel[cls]) - { - saveVertexShaderLevel(cls, mVertexShaderLevel[cls], mVertexShaderLevel[cls]); - } - } - } -#endif - return ret; -} - -BOOL LLPipeline::linkProgramObject(GLhandleARB obj, BOOL suppress_errors) -{ - //check for errors - glLinkProgramARB(obj); - GLint success = GL_TRUE; - glGetObjectParameterivARB(obj, GL_OBJECT_LINK_STATUS_ARB, &success); - if (!suppress_errors && success == GL_FALSE) - { - //an error occured, print log - llwarns << "GLSL Linker Error:" << llendl; - } - - LLString log = get_object_log(obj); - LLString::toLower(log); - if (log.find("software") != LLString::npos) - { - llwarns << "GLSL Linker: Running in Software:" << llendl; - success = GL_FALSE; - suppress_errors = FALSE; - } - if (!suppress_errors) - { - dumpObjectLog(obj, !success); - } - - return success; -} - -BOOL LLPipeline::validateProgramObject(GLhandleARB obj) -{ - //check program validity against current GL - glValidateProgramARB(obj); - GLint success = GL_TRUE; - glGetObjectParameterivARB(obj, GL_OBJECT_VALIDATE_STATUS_ARB, &success); - if (success == GL_FALSE) - { - llwarns << "GLSL program not valid: " << llendl; - dumpObjectLog(obj); - } - else - { - dumpObjectLog(obj, FALSE); - } - - return success; -} - -//============================================================================ -// Shader Management - -void LLPipeline::setShaders() -{ - if (gGLManager.mHasFramebufferObject) - { - sDynamicReflections = gSavedSettings.getBOOL("RenderDynamicReflections"); - sRenderGlow = gSavedSettings.getBOOL("RenderGlow"); - } - else - { - sDynamicReflections = sRenderGlow = FALSE; - } - - //hack to reset buffers that change behavior with shaders - resetVertexBuffers(); - - if (gViewerWindow) - { - gViewerWindow->setCursor(UI_CURSOR_WAIT); - } - - // Lighting - setLightingDetail(-1); - - // Shaders - for (S32 i=0; i<SHADER_COUNT; i++) - { - mVertexShaderLevel[i] = 0; - mMaxVertexShaderLevel[i] = 0; - } - if (canUseVertexShaders()) - { - S32 light_class = 2; - S32 env_class = 2; - S32 obj_class = 0; - - if (getLightingDetail() == 0) - { - light_class = 1; - } - // Load lighting shaders - mVertexShaderLevel[SHADER_LIGHTING] = light_class; - mMaxVertexShaderLevel[SHADER_LIGHTING] = light_class; - mVertexShaderLevel[SHADER_ENVIRONMENT] = env_class; - mMaxVertexShaderLevel[SHADER_ENVIRONMENT] = env_class; - mVertexShaderLevel[SHADER_OBJECT] = obj_class; - mMaxVertexShaderLevel[SHADER_OBJECT] = obj_class; - - BOOL loaded = loadShadersLighting(); - - if (loaded) - { - mVertexShadersEnabled = TRUE; - mVertexShadersLoaded = 1; - - // Load all shaders to set max levels - loadShadersEnvironment(); - loadShadersObject(); - // Load max avatar shaders to set the max level - mVertexShaderLevel[SHADER_AVATAR] = 3; - mMaxVertexShaderLevel[SHADER_AVATAR] = 3; - loadShadersAvatar(); - - // Load shaders to correct levels - if (!gSavedSettings.getBOOL("RenderRippleWater")) - { - mVertexShaderLevel[SHADER_ENVIRONMENT] = 0; - loadShadersEnvironment(); // unloads - } - -#if LL_DARWIN // force avatar shaders off for mac - mVertexShaderLevel[SHADER_AVATAR] = 0; - mMaxVertexShaderLevel[SHADER_AVATAR] = 0; -#else - if (gSavedSettings.getBOOL("RenderAvatarVP")) - { - S32 avatar = gSavedSettings.getS32("RenderAvatarMode"); - S32 avatar_class = 1 + avatar; - // Set the actual level - mVertexShaderLevel[SHADER_AVATAR] = avatar_class; - loadShadersAvatar(); - if (mVertexShaderLevel[SHADER_AVATAR] != avatar_class) - { - if (mVertexShaderLevel[SHADER_AVATAR] == 0) - { - gSavedSettings.setBOOL("RenderAvatarVP", FALSE); - } - avatar = llmax(mVertexShaderLevel[SHADER_AVATAR]-1,0); - gSavedSettings.setS32("RenderAvatarMode", avatar); - } - } - else - { - mVertexShaderLevel[SHADER_AVATAR] = 0; - gSavedSettings.setS32("RenderAvatarMode", 0); - loadShadersAvatar(); // unloads - } -#endif - } - else - { - mVertexShadersEnabled = FALSE; - mVertexShadersLoaded = 0; - } - } - if (gViewerWindow) - { - gViewerWindow->setCursor(UI_CURSOR_ARROW); - } -} BOOL LLPipeline::canUseVertexShaders() { @@ -836,490 +404,10 @@ BOOL LLPipeline::canUseVertexShaders() void LLPipeline::unloadShaders() { - mObjectSimpleProgram.unload(); - mObjectShinyProgram.unload(); - mObjectBumpProgram.unload(); - mObjectAlphaProgram.unload(); - mWaterProgram.unload(); - mTerrainProgram.unload(); - mGlowProgram.unload(); - mGroundProgram.unload(); - mAvatarProgram.unload(); - mAvatarEyeballProgram.unload(); - mAvatarPickProgram.unload(); - mHighlightProgram.unload(); - - mVertexShaderLevel[SHADER_LIGHTING] = 0; - mVertexShaderLevel[SHADER_OBJECT] = 0; - mVertexShaderLevel[SHADER_AVATAR] = 0; - mVertexShaderLevel[SHADER_ENVIRONMENT] = 0; - mVertexShaderLevel[SHADER_INTERFACE] = 0; - - mLightVertex = mLightFragment = mScatterVertex = mScatterFragment = 0; + LLShaderMgr::unloadShaders(); mVertexShadersLoaded = 0; } -#if 0 // 1.9.2 -// Any time shader options change -BOOL LLPipeline::loadShaders() -{ - unloadShaders(); - - if (!canUseVertexShaders()) - { - return FALSE; - } - - S32 light_class = mMaxVertexShaderLevel[SHADER_LIGHTING]; - if (getLightingDetail() == 0) - { - light_class = 1; // Use minimum lighting shader - } - else if (getLightingDetail() == 1) - { - light_class = 2; // Use medium lighting shader - } - mVertexShaderLevel[SHADER_LIGHTING] = light_class; - //mVertexShaderLevel[SHADER_OBJECT] = llmin(mMaxVertexShaderLevel[SHADER_OBJECT], gSavedSettings.getS32("VertexShaderLevelObject")); - mVertexShaderLevel[SHADER_OBJECT] = 0; - mVertexShaderLevel[SHADER_AVATAR] = llmin(mMaxVertexShaderLevel[SHADER_AVATAR], gSavedSettings.getS32("VertexShaderLevelAvatar")); - mVertexShaderLevel[SHADER_ENVIRONMENT] = llmin(mMaxVertexShaderLevel[SHADER_ENVIRONMENT], gSavedSettings.getS32("VertexShaderLevelEnvironment")); - mVertexShaderLevel[SHADER_INTERFACE] = mMaxVertexShaderLevel[SHADER_INTERFACE]; - - BOOL loaded = loadShadersLighting(); - if (loaded) - { - loadShadersEnvironment(); // Must load this before object/avatar for scatter - loadShadersObject(); - loadShadersAvatar(); - loadShadersInterface(); - mVertexShadersLoaded = 1; - } - else - { - unloadShaders(); - mVertexShadersEnabled = FALSE; - mVertexShadersLoaded = 0; //-1; // -1 = failed - setLightingDetail(-1); - } - - return loaded; -} -#endif - -BOOL LLPipeline::loadShadersLighting() -{ - // Load light dependency shaders first - // All of these have to load for any shaders to function - - std::string lightvertex = "lighting/lightV.glsl"; - //get default light function implementation - mLightVertex = loadShader(lightvertex, SHADER_LIGHTING, GL_VERTEX_SHADER_ARB); - if( !mLightVertex ) - { - llwarns << "Failed to load " << lightvertex << llendl; - return FALSE; - } - - std::string lightfragment = "lighting/lightF.glsl"; - mLightFragment = loadShader(lightfragment, SHADER_LIGHTING, GL_FRAGMENT_SHADER_ARB); - if ( !mLightFragment ) - { - llwarns << "Failed to load " << lightfragment << llendl; - return FALSE; - } - - // NOTE: Scatter shaders use the ENVIRONMENT detail level - - std::string scattervertex = "environment/scatterV.glsl"; - mScatterVertex = loadShader(scattervertex, SHADER_ENVIRONMENT, GL_VERTEX_SHADER_ARB); - if ( !mScatterVertex ) - { - llwarns << "Failed to load " << scattervertex << llendl; - return FALSE; - } - - std::string scatterfragment = "environment/scatterF.glsl"; - mScatterFragment = loadShader(scatterfragment, SHADER_ENVIRONMENT, GL_FRAGMENT_SHADER_ARB); - if ( !mScatterFragment ) - { - llwarns << "Failed to load " << scatterfragment << llendl; - return FALSE; - } - - return TRUE; -} - -BOOL LLPipeline::loadShadersEnvironment() -{ - GLhandleARB baseObjects[] = - { - mLightFragment, - mLightVertex, - mScatterFragment, - mScatterVertex - }; - S32 baseCount = 4; - - BOOL success = TRUE; - - if (mVertexShaderLevel[SHADER_ENVIRONMENT] == 0) - { - mWaterProgram.unload(); - mGroundProgram.unload(); - mTerrainProgram.unload(); - mGlowProgram.unload(); - return FALSE; - } - - if (success) - { - //load water vertex shader - std::string waterfragment = "environment/waterF.glsl"; - std::string watervertex = "environment/waterV.glsl"; - mWaterProgram.mProgramObject = glCreateProgramObjectARB(); - mWaterProgram.attachObjects(baseObjects, baseCount); - mWaterProgram.attachObject(loadShader(watervertex, SHADER_ENVIRONMENT, GL_VERTEX_SHADER_ARB)); - mWaterProgram.attachObject(loadShader(waterfragment, SHADER_ENVIRONMENT, GL_FRAGMENT_SHADER_ARB)); - - success = mWaterProgram.mapAttributes(); - if (success) - { - success = mWaterProgram.mapUniforms(sWaterUniforms, sWaterUniformCount); - } - if (!success) - { - llwarns << "Failed to load " << watervertex << llendl; - } - } - if (success) - { - //load ground vertex shader - std::string groundvertex = "environment/groundV.glsl"; - std::string groundfragment = "environment/groundF.glsl"; - mGroundProgram.mProgramObject = glCreateProgramObjectARB(); - mGroundProgram.attachObjects(baseObjects, baseCount); - mGroundProgram.attachObject(loadShader(groundvertex, SHADER_ENVIRONMENT, GL_VERTEX_SHADER_ARB)); - mGroundProgram.attachObject(loadShader(groundfragment, SHADER_ENVIRONMENT, GL_FRAGMENT_SHADER_ARB)); - - success = mGroundProgram.mapAttributes(); - if (success) - { - success = mGroundProgram.mapUniforms(); - } - if (!success) - { - llwarns << "Failed to load " << groundvertex << llendl; - } - } - - if (success) - { - //load terrain vertex shader - std::string terrainvertex = "environment/terrainV.glsl"; - std::string terrainfragment = "environment/terrainF.glsl"; - mTerrainProgram.mProgramObject = glCreateProgramObjectARB(); - mTerrainProgram.attachObjects(baseObjects, baseCount); - mTerrainProgram.attachObject(loadShader(terrainvertex, SHADER_ENVIRONMENT, GL_VERTEX_SHADER_ARB)); - mTerrainProgram.attachObject(loadShader(terrainfragment, SHADER_ENVIRONMENT, GL_FRAGMENT_SHADER_ARB)); - success = mTerrainProgram.mapAttributes(); - if (success) - { - success = mTerrainProgram.mapUniforms(sTerrainUniforms, sTerrainUniformCount); - } - if (!success) - { - llwarns << "Failed to load " << terrainvertex << llendl; - } - } - - if (success) - { - //load glow shader - std::string glowvertex = "environment/glowV.glsl"; - std::string glowfragment = "environment/glowF.glsl"; - mGlowProgram.mProgramObject = glCreateProgramObjectARB(); - mGlowProgram.attachObjects(baseObjects, baseCount); - mGlowProgram.attachObject(loadShader(glowvertex, SHADER_ENVIRONMENT, GL_VERTEX_SHADER_ARB)); - mGlowProgram.attachObject(loadShader(glowfragment, SHADER_ENVIRONMENT, GL_FRAGMENT_SHADER_ARB)); - success = mGlowProgram.mapAttributes(); - if (success) - { - success = mGlowProgram.mapUniforms(sGlowUniforms, sGlowUniformCount); - } - if (!success) - { - llwarns << "Failed to load " << glowvertex << llendl; - } - } - - if( !success ) - { - mVertexShaderLevel[SHADER_ENVIRONMENT] = 0; - mMaxVertexShaderLevel[SHADER_ENVIRONMENT] = 0; - return FALSE; - } - - if (gWorldPointer) - { - gWorldPointer->updateWaterObjects(); - } - - return TRUE; -} - -BOOL LLPipeline::loadShadersObject() -{ - GLhandleARB baseObjects[] = - { - mLightFragment, - mLightVertex, - mScatterFragment, - mScatterVertex - }; - S32 baseCount = 4; - - BOOL success = TRUE; - - if (mVertexShaderLevel[SHADER_OBJECT] == 0) - { - mObjectShinyProgram.unload(); - mObjectSimpleProgram.unload(); - mObjectBumpProgram.unload(); - mObjectAlphaProgram.unload(); - return FALSE; - } - -#if 0 - if (success) - { - //load object (volume/tree) vertex shader - std::string simplevertex = "objects/simpleV.glsl"; - std::string simplefragment = "objects/simpleF.glsl"; - mObjectSimpleProgram.mProgramObject = glCreateProgramObjectARB(); - mObjectSimpleProgram.attachObjects(baseObjects, baseCount); - mObjectSimpleProgram.attachObject(loadShader(simplevertex, SHADER_OBJECT, GL_VERTEX_SHADER_ARB)); - mObjectSimpleProgram.attachObject(loadShader(simplefragment, SHADER_OBJECT, GL_FRAGMENT_SHADER_ARB)); - success = mObjectSimpleProgram.mapAttributes(); - if (success) - { - success = mObjectSimpleProgram.mapUniforms(); - } - if( !success ) - { - llwarns << "Failed to load " << simplevertex << llendl; - } - } - - if (success) - { - //load object bumpy vertex shader - std::string bumpshinyvertex = "objects/bumpshinyV.glsl"; - std::string bumpshinyfragment = "objects/bumpshinyF.glsl"; - mObjectBumpProgram.mProgramObject = glCreateProgramObjectARB(); - mObjectBumpProgram.attachObjects(baseObjects, baseCount); - mObjectBumpProgram.attachObject(loadShader(bumpshinyvertex, SHADER_OBJECT, GL_VERTEX_SHADER_ARB)); - mObjectBumpProgram.attachObject(loadShader(bumpshinyfragment, SHADER_OBJECT, GL_FRAGMENT_SHADER_ARB)); - success = mObjectBumpProgram.mapAttributes(); - if (success) - { - success = mObjectBumpProgram.mapUniforms(); - } - if( !success ) - { - llwarns << "Failed to load " << bumpshinyvertex << llendl; - } - } - - if (success) - { - //load object alpha vertex shader - std::string alphavertex = "objects/alphaV.glsl"; - std::string alphafragment = "objects/alphaF.glsl"; - mObjectAlphaProgram.mProgramObject = glCreateProgramObjectARB(); - mObjectAlphaProgram.attachObjects(baseObjects, baseCount); - mObjectAlphaProgram.attachObject(loadShader(alphavertex, SHADER_OBJECT, GL_VERTEX_SHADER_ARB)); - mObjectAlphaProgram.attachObject(loadShader(alphafragment, SHADER_OBJECT, GL_FRAGMENT_SHADER_ARB)); - - success = mObjectAlphaProgram.mapAttributes(); - if (success) - { - success = mObjectAlphaProgram.mapUniforms(); - } - if( !success ) - { - llwarns << "Failed to load " << alphavertex << llendl; - } - } -#endif - - if (success) - { - //load shiny vertex shader - std::string shinyvertex = "objects/shinyV.glsl"; - std::string shinyfragment = "objects/shinyF.glsl"; - mObjectShinyProgram.mProgramObject = glCreateProgramObjectARB(); - mObjectShinyProgram.attachObjects(baseObjects, baseCount); - mObjectShinyProgram.attachObject(loadShader(shinyvertex, SHADER_OBJECT, GL_VERTEX_SHADER_ARB)); - mObjectShinyProgram.attachObject(loadShader(shinyfragment, SHADER_OBJECT, GL_FRAGMENT_SHADER_ARB)); - - success = mObjectShinyProgram.mapAttributes(); - if (success) - { - success = mObjectShinyProgram.mapUniforms(LLPipeline::sShinyUniforms, LLPipeline::sShinyUniformCount); - } - if( !success ) - { - llwarns << "Failed to load " << shinyvertex << llendl; - } - } - - if( !success ) - { - mVertexShaderLevel[SHADER_OBJECT] = 0; - mMaxVertexShaderLevel[SHADER_OBJECT] = 0; - return FALSE; - } - - return TRUE; -} - -BOOL LLPipeline::loadShadersAvatar() -{ - GLhandleARB baseObjects[] = - { - mLightFragment, - mLightVertex, - mScatterFragment, - mScatterVertex - }; - S32 baseCount = 4; - - BOOL success = TRUE; - - if (mVertexShaderLevel[SHADER_AVATAR] == 0) - { - mAvatarProgram.unload(); - mAvatarEyeballProgram.unload(); - mAvatarPickProgram.unload(); - return FALSE; - } - - if (success) - { - //load specular (eyeball) vertex program - std::string eyeballvertex = "avatar/eyeballV.glsl"; - std::string eyeballfragment = "avatar/eyeballF.glsl"; - mAvatarEyeballProgram.mProgramObject = glCreateProgramObjectARB(); - mAvatarEyeballProgram.attachObjects(baseObjects, baseCount); - mAvatarEyeballProgram.attachObject(loadShader(eyeballvertex, SHADER_AVATAR, GL_VERTEX_SHADER_ARB)); - mAvatarEyeballProgram.attachObject(loadShader(eyeballfragment, SHADER_AVATAR, GL_FRAGMENT_SHADER_ARB)); - success = mAvatarEyeballProgram.mapAttributes(); - if (success) - { - success = mAvatarEyeballProgram.mapUniforms(); - } - if( !success ) - { - llwarns << "Failed to load " << eyeballvertex << llendl; - } - } - - if (success) - { - mAvatarSkinVertex = loadShader("avatar/avatarSkinV.glsl", SHADER_AVATAR, GL_VERTEX_SHADER_ARB); - //load avatar vertex shader - std::string avatarvertex = "avatar/avatarV.glsl"; - std::string avatarfragment = "avatar/avatarF.glsl"; - - mAvatarProgram.mProgramObject = glCreateProgramObjectARB(); - mAvatarProgram.attachObjects(baseObjects, baseCount); - mAvatarProgram.attachObject(mAvatarSkinVertex); - mAvatarProgram.attachObject(loadShader(avatarvertex, SHADER_AVATAR, GL_VERTEX_SHADER_ARB)); - mAvatarProgram.attachObject(loadShader(avatarfragment, SHADER_AVATAR, GL_FRAGMENT_SHADER_ARB)); - - success = mAvatarProgram.mapAttributes(sAvatarAttribs, sAvatarAttribCount); - if (success) - { - success = mAvatarProgram.mapUniforms(sAvatarUniforms, sAvatarUniformCount); - } - if( !success ) - { - llwarns << "Failed to load " << avatarvertex << llendl; - } - } - - if (success) - { - //load avatar picking shader - std::string pickvertex = "avatar/pickAvatarV.glsl"; - std::string pickfragment = "avatar/pickAvatarF.glsl"; - mAvatarPickProgram.mProgramObject = glCreateProgramObjectARB(); - mAvatarPickProgram.attachObject(loadShader(pickvertex, SHADER_AVATAR, GL_VERTEX_SHADER_ARB)); - mAvatarPickProgram.attachObject(loadShader(pickfragment, SHADER_AVATAR, GL_FRAGMENT_SHADER_ARB)); - mAvatarPickProgram.attachObject(mAvatarSkinVertex); - - success = mAvatarPickProgram.mapAttributes(sAvatarAttribs, sAvatarAttribCount); - if (success) - { - success = mAvatarPickProgram.mapUniforms(sAvatarUniforms, sAvatarUniformCount); - } - if( !success ) - { - llwarns << "Failed to load " << pickvertex << llendl; - } - } - - if( !success ) - { - mVertexShaderLevel[SHADER_AVATAR] = 0; - mMaxVertexShaderLevel[SHADER_AVATAR] = 0; - return FALSE; - } - - return TRUE; -} - -BOOL LLPipeline::loadShadersInterface() -{ - BOOL success = TRUE; - - if (mVertexShaderLevel[SHADER_INTERFACE] == 0) - { - mHighlightProgram.unload(); - return FALSE; - } - - if (success) - { - //load highlighting shader - std::string highlightvertex = "interface/highlightV.glsl"; - std::string highlightfragment = "interface/highlightF.glsl"; - mHighlightProgram.mProgramObject = glCreateProgramObjectARB(); - mHighlightProgram.attachObject(loadShader(highlightvertex, SHADER_INTERFACE, GL_VERTEX_SHADER_ARB)); - mHighlightProgram.attachObject(loadShader(highlightfragment, SHADER_INTERFACE, GL_FRAGMENT_SHADER_ARB)); - - success = mHighlightProgram.mapAttributes(); - if (success) - { - success = mHighlightProgram.mapUniforms(); - } - if( !success ) - { - llwarns << "Failed to load " << highlightvertex << llendl; - } - } - - if( !success ) - { - mVertexShaderLevel[SHADER_INTERFACE] = 0; - mMaxVertexShaderLevel[SHADER_INTERFACE] = 0; - return FALSE; - } - - return TRUE; -} - //============================================================================ void LLPipeline::enableShadows(const BOOL enable_shadows) @@ -1357,7 +445,7 @@ S32 LLPipeline::setLightingDetail(S32 level) if (mVertexShadersLoaded == 1) { - gPipeline.setShaders(); + LLShaderMgr::setShaders(); } } return mLightingDetail; @@ -1384,7 +472,6 @@ public: if (mTextures.find(params->mTexture) != mTextures.end()) { group->setState(LLSpatialGroup::GEOM_DIRTY); - gPipeline.markRebuild(group); } } } @@ -1828,9 +915,6 @@ void LLPipeline::updateCull(LLCamera& camera) } } - //do a terse update on some off-screen geometry - processGeometry(camera); - if (gSky.mVOSkyp.notNull() && gSky.mVOSkyp->mDrawable.notNull()) { // Hack for sky - always visible. @@ -2171,11 +1255,6 @@ void LLPipeline::markTextured(LLDrawable *drawablep) } } -void LLPipeline::markRebuild(LLSpatialGroup* group) -{ - mGroupQ.insert(group); -} - void LLPipeline::markRebuild(LLDrawable *drawablep, LLDrawable::EDrawableFlags flag, BOOL priority) { LLMemType mt(LLMemType::MTYPE_PIPELINE); @@ -2475,16 +1554,8 @@ void LLPipeline::postSort(LLCamera& camera) } - //rebuild offscreen geometry if (!sSkipUpdate) { - for (LLSpatialGroup::sg_set_t::iterator iter = mGroupQ.begin(); iter != mGroupQ.end(); ++iter) - { - LLSpatialGroup* group = *iter; - group->rebuildGeom(); - } - mGroupQ.clear(); - //rebuild drawable geometry for (LLSpatialGroup::sg_vector_t::iterator i = mDrawableGroups.begin(); i != mDrawableGroups.end(); ++i) { @@ -2721,10 +1792,10 @@ void LLPipeline::renderHighlights() LLGLEnable color_mat(GL_COLOR_MATERIAL); disableLights(); - if ((mVertexShaderLevel[SHADER_INTERFACE] > 0)) + if ((LLShaderMgr::sVertexShaderLevel[LLShaderMgr::SHADER_INTERFACE] > 0)) { - mHighlightProgram.bind(); - gPipeline.mHighlightProgram.vertexAttrib4f(LLPipeline::GLSL_MATERIAL_COLOR,1,0,0,0.5f); + gHighlightProgram.bind(); + gHighlightProgram.vertexAttrib4f(LLShaderMgr::MATERIAL_COLOR,1,0,0,0.5f); } if (hasRenderDebugFeatureMask(RENDER_DEBUG_FEATURE_SELECTED)) @@ -2763,9 +1834,9 @@ void LLPipeline::renderHighlights() // have touch-handlers. mHighlightFaces.clear(); - if (mVertexShaderLevel[SHADER_INTERFACE] > 0) + if (LLShaderMgr::sVertexShaderLevel[LLShaderMgr::SHADER_INTERFACE] > 0) { - mHighlightProgram.unbind(); + gHighlightProgram.unbind(); } } @@ -2858,7 +1929,7 @@ void LLPipeline::renderGeom(LLCamera& camera) { LLFastTimer t(LLFastTimer::FTM_POOLS); glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_FALSE); - calcNearbyLights(); + calcNearbyLights(camera); pool_set_t::iterator iter1 = mPools.begin(); while ( iter1 != mPools.end() ) { @@ -3001,22 +2072,6 @@ void LLPipeline::renderGeom(LLCamera& camera) } } -void LLPipeline::processGeometry(LLCamera& camera) -{ - if (sSkipUpdate) - { - return; - } - - for (U32 i = 0; i < mObjectPartition.size(); i++) - { - if (mObjectPartition[i] && hasRenderType(mObjectPartition[i]->mDrawableType)) - { - mObjectPartition[i]->processGeometry(&camera); - } - } -} - void LLPipeline::processOcclusion(LLCamera& camera) { //process occlusion (readback) @@ -3691,7 +2746,7 @@ static F32 calc_light_dist(LLVOVolume* light, const LLVector3& cam_pos, F32 max_ return dist; } -void LLPipeline::calcNearbyLights() +void LLPipeline::calcNearbyLights(LLCamera& camera) { if (mLightingDetail >= 1) { @@ -3699,34 +2754,39 @@ void LLPipeline::calcNearbyLights() // begin() == the closest light and rbegin() == the farthest light const S32 MAX_LOCAL_LIGHTS = 6; // LLVector3 cam_pos = gAgent.getCameraPositionAgent(); - LLVector3 cam_pos = gAgent.getPositionAgent(); + LLVector3 cam_pos = LLPipeline::sSkipUpdate || LLViewerJoystick::sOverrideCamera ? + camera.getOrigin() : + gAgent.getPositionAgent(); F32 max_dist = LIGHT_MAX_RADIUS * 4.f; // ignore enitrely lights > 4 * max light rad // UPDATE THE EXISTING NEARBY LIGHTS - light_set_t cur_nearby_lights; - for (light_set_t::iterator iter = mNearbyLights.begin(); - iter != mNearbyLights.end(); iter++) + if (!LLPipeline::sSkipUpdate) { - const Light* light = &(*iter); - LLDrawable* drawable = light->drawable; - LLVOVolume* volight = drawable->getVOVolume(); - if (!volight || !drawable->isState(LLDrawable::LIGHT)) - { - drawable->clearState(LLDrawable::NEARBY_LIGHT); - continue; - } - if (light->fade <= -LIGHT_FADE_TIME) - { - drawable->clearState(LLDrawable::NEARBY_LIGHT); - } - else + light_set_t cur_nearby_lights; + for (light_set_t::iterator iter = mNearbyLights.begin(); + iter != mNearbyLights.end(); iter++) { - F32 dist = calc_light_dist(volight, cam_pos, max_dist); - cur_nearby_lights.insert(Light(drawable, dist, light->fade)); + const Light* light = &(*iter); + LLDrawable* drawable = light->drawable; + LLVOVolume* volight = drawable->getVOVolume(); + if (!volight || !drawable->isState(LLDrawable::LIGHT)) + { + drawable->clearState(LLDrawable::NEARBY_LIGHT); + continue; + } + if (light->fade <= -LIGHT_FADE_TIME) + { + drawable->clearState(LLDrawable::NEARBY_LIGHT); + } + else + { + F32 dist = calc_light_dist(volight, cam_pos, max_dist); + cur_nearby_lights.insert(Light(drawable, dist, light->fade)); + } } + mNearbyLights = cur_nearby_lights; } - mNearbyLights = cur_nearby_lights; // FIND NEW LIGHTS THAT ARE IN RANGE light_set_t new_nearby_lights; @@ -3861,7 +2921,7 @@ void LLPipeline::setupHWLights(LLDrawPool* pool) LLColor4 light_color = light->getLightColor(); light_color.mV[3] = 0.0f; - F32 fade = iter->fade; + F32 fade = LLPipeline::sSkipUpdate ? 1.f : iter->fade; if (fade < LIGHT_FADE_TIME) { // fade in/out light @@ -4407,255 +3467,6 @@ BOOL LLPipeline::getRenderSoundBeacons(void*) return sRenderSoundBeacons; } -//=============================== -// LLGLSL Shader implementation -//=============================== -LLGLSLShader::LLGLSLShader() -: mProgramObject(0) -{ } - -void LLGLSLShader::unload() -{ - stop_glerror(); - mAttribute.clear(); - mTexture.clear(); - mUniform.clear(); - - if (mProgramObject) - { - GLhandleARB obj[1024]; - GLsizei count; - - glGetAttachedObjectsARB(mProgramObject, 1024, &count, obj); - for (GLsizei i = 0; i < count; i++) - { - glDeleteObjectARB(obj[i]); - } - - glDeleteObjectARB(mProgramObject); - - mProgramObject = 0; - } - - //hack to make apple not complain - glGetError(); - - stop_glerror(); -} - -void LLGLSLShader::attachObject(GLhandleARB object) -{ - if (object != 0) - { - stop_glerror(); - glAttachObjectARB(mProgramObject, object); - stop_glerror(); - } - else - { - llwarns << "Attempting to attach non existing shader object. " << llendl; - } -} - -void LLGLSLShader::attachObjects(GLhandleARB* objects, S32 count) -{ - for (S32 i = 0; i < count; i++) - { - attachObject(objects[i]); - } -} - -BOOL LLGLSLShader::mapAttributes(const char** attrib_names, S32 count) -{ - //link the program - BOOL res = link(); - - mAttribute.clear(); - mAttribute.resize(LLPipeline::sReservedAttribCount + count, -1); - - if (res) - { //read back channel locations - - //read back reserved channels first - for (S32 i = 0; i < (S32) LLPipeline::sReservedAttribCount; i++) - { - const char* name = LLPipeline::sReservedAttribs[i]; - S32 index = glGetAttribLocationARB(mProgramObject, name); - if (index != -1) - { - mAttribute[i] = index; - llinfos << "Attribute " << name << " assigned to channel " << index << llendl; - } - } - - for (S32 i = 0; i < count; i++) - { - const char* name = attrib_names[i]; - S32 index = glGetAttribLocationARB(mProgramObject, name); - if (index != -1) - { - mAttribute[LLPipeline::sReservedAttribCount + i] = index; - llinfos << "Attribute " << name << " assigned to channel " << index << llendl; - } - } - - return TRUE; - } - - return FALSE; -} - -void LLGLSLShader::mapUniform(GLint index, const char** uniform_names, S32 count) -{ - if (index == -1) - { - return; - } - - GLenum type; - GLsizei length; - GLint size; - char name[1024]; /* Flawfinder: ignore */ - name[0] = 0; - - glGetActiveUniformARB(mProgramObject, index, 1024, &length, &size, &type, name); - - //find the index of this uniform - for (S32 i = 0; i < (S32) LLPipeline::sReservedUniformCount; i++) - { - if (mUniform[i] == -1 && !strncmp(LLPipeline::sReservedUniforms[i],name, strlen(LLPipeline::sReservedUniforms[i]))) /* Flawfinder: ignore */ - { - //found it - S32 location = glGetUniformLocationARB(mProgramObject, name); - mUniform[i] = location; - llinfos << "Uniform " << name << " is at location " << location << llendl; - mTexture[i] = mapUniformTextureChannel(location, type); - return; - } - } - - for (S32 i = 0; i < count; i++) - { - if (mUniform[i+LLPipeline::sReservedUniformCount] == -1 && - !strncmp(uniform_names[i],name, strlen(uniform_names[i]))) /* Flawfinder: ignore */ - { - //found it - S32 location = glGetUniformLocationARB(mProgramObject, name); - mUniform[i+LLPipeline::sReservedUniformCount] = location; - llinfos << "Uniform " << name << " is at location " << location << " stored in index " << - (i+LLPipeline::sReservedUniformCount) << llendl; - mTexture[i+LLPipeline::sReservedUniformCount] = mapUniformTextureChannel(location, type); - return; - } - } - - //llinfos << "Unknown uniform: " << name << llendl; - } - -GLint LLGLSLShader::mapUniformTextureChannel(GLint location, GLenum type) -{ - if (type >= GL_SAMPLER_1D_ARB && type <= GL_SAMPLER_2D_RECT_SHADOW_ARB) - { //this here is a texture - glUniform1iARB(location, mActiveTextureChannels); - llinfos << "Assigned to texture channel " << mActiveTextureChannels << llendl; - return mActiveTextureChannels++; - } - return -1; -} - -BOOL LLGLSLShader::mapUniforms(const char** uniform_names, S32 count) -{ - BOOL res = TRUE; - - mActiveTextureChannels = 0; - mUniform.clear(); - mTexture.clear(); - - //initialize arrays - mUniform.resize(count + LLPipeline::sReservedUniformCount, -1); - mTexture.resize(count + LLPipeline::sReservedUniformCount, -1); - - bind(); - - //get the number of active uniforms - GLint activeCount; - glGetObjectParameterivARB(mProgramObject, GL_OBJECT_ACTIVE_UNIFORMS_ARB, &activeCount); - - for (S32 i = 0; i < activeCount; i++) - { - mapUniform(i, uniform_names, count); - } - - unbind(); - - return res; -} - -BOOL LLGLSLShader::link(BOOL suppress_errors) -{ - return gPipeline.linkProgramObject(mProgramObject, suppress_errors); -} - -void LLGLSLShader::bind() -{ - glUseProgramObjectARB(mProgramObject); - if (mAttribute.size() > 0) - { - gPipeline.mMaterialIndex = mAttribute[0]; - } -} - -void LLGLSLShader::unbind() -{ - for (U32 i = 0; i < mAttribute.size(); ++i) - { - vertexAttrib4f(i, 0,0,0,1); - } - glUseProgramObjectARB(0); -} - -S32 LLGLSLShader::enableTexture(S32 uniform, S32 mode) -{ - if (uniform < 0 || uniform >= (S32)mTexture.size()) - { - llerrs << "LLGLSLShader::enableTexture: uniform out of range: " << uniform << llendl; - } - S32 index = mTexture[uniform]; - if (index != -1) - { - glActiveTextureARB(GL_TEXTURE0_ARB+index); - glEnable(mode); - } - return index; -} - -S32 LLGLSLShader::disableTexture(S32 uniform, S32 mode) -{ - S32 index = mTexture[uniform]; - if (index != -1) - { - glActiveTextureARB(GL_TEXTURE0_ARB+index); - glDisable(mode); - } - return index; -} - -void LLGLSLShader::vertexAttrib4f(U32 index, GLfloat x, GLfloat y, GLfloat z, GLfloat w) -{ - if (mAttribute[index] > 0) - { - glVertexAttrib4fARB(mAttribute[index], x, y, z, w); - } -} - -void LLGLSLShader::vertexAttrib4fv(U32 index, GLfloat* v) -{ - if (mAttribute[index] > 0) - { - glVertexAttrib4fvARB(mAttribute[index], v); - } -} - LLViewerObject* LLPipeline::pickObject(const LLVector3 &start, const LLVector3 &end, LLVector3 &collision) { LLDrawable* drawable = mObjectPartition[PARTITION_VOLUME]->pickDrawable(start, end, collision); @@ -4847,7 +3658,7 @@ void LLPipeline::generateReflectionMap(LLCubeMap* cube_map, LLCamera& cube_cam, LLVector3 origin = cube_cam.getOrigin(); - gPipeline.calcNearbyLights(); + gPipeline.calcNearbyLights(cube_cam); cube_map->bind(); for (S32 i = 0; i < 6; i++) @@ -4909,7 +3720,7 @@ void LLPipeline::generateReflectionMap(LLCubeMap* cube_map, LLCamera& cube_cam, cube_cam.setOrigin(origin); gPipeline.resetDrawOrders(); - gPipeline.mShinyOrigin.setVec(cube_cam.getOrigin(), cube_cam.getFar()*2.f); + gShinyOrigin.setVec(cube_cam.getOrigin(), cube_cam.getFar()*2.f); glMatrixMode(GL_PROJECTION); glPopMatrix(); glMatrixMode(GL_MODELVIEW); @@ -5112,12 +3923,7 @@ void LLPipeline::bindScreenToTexture() void LLPipeline::renderBloom(GLuint source, GLuint dest, GLuint buffer, U32 res, LLVector2 tc1, LLVector2 tc2) { - mGlowProgram.bind(); - - if (!gGLManager.mHasFramebufferObject) - { - llerrs << "WTF?" << llendl; - } + gGlowProgram.bind(); LLGLEnable tex(GL_TEXTURE_2D); LLGLDepthTest depth(GL_FALSE); @@ -5160,7 +3966,7 @@ void LLPipeline::renderBloom(GLuint source, GLuint dest, GLuint buffer, U32 res, i%2==0 ? dest : buffer); - glUniform1fARB(mGlowProgram.mUniform[LLPipeline::GLSL_GLOW_DELTA],delta); + glUniform1fARB(gGlowProgram.mUniform[LLShaderMgr::GLOW_DELTA],delta); glBegin(GL_TRIANGLE_STRIP); glTexCoord2f(tc1.mV[0], tc1.mV[1]); @@ -5182,7 +3988,7 @@ void LLPipeline::renderBloom(GLuint source, GLuint dest, GLuint buffer, U32 res, } glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); - mGlowProgram.unbind(); + gGlowProgram.unbind(); glViewport(viewport[0], viewport[1], viewport[2], viewport[3]); @@ -5220,107 +4026,3 @@ void LLPipeline::renderBloom(GLuint source, GLuint dest, GLuint buffer, U32 res, glPopMatrix(); } -void LLPipeline::updateCamera() -{ - LLWindow* window = gViewerWindow->getWindow(); - - F32 time = gFrameIntervalSeconds; - - S32 axis[] = - { - gSavedSettings.getS32("JoystickAxis0"), - gSavedSettings.getS32("JoystickAxis1"), - gSavedSettings.getS32("JoystickAxis2"), - gSavedSettings.getS32("JoystickAxis3"), - gSavedSettings.getS32("JoystickAxis4"), - gSavedSettings.getS32("JoystickAxis5") - }; - - F32 axis_scale[] = - { - gSavedSettings.getF32("JoystickAxisScale0"), - gSavedSettings.getF32("JoystickAxisScale1"), - gSavedSettings.getF32("JoystickAxisScale2"), - gSavedSettings.getF32("JoystickAxisScale3"), - gSavedSettings.getF32("JoystickAxisScale4"), - gSavedSettings.getF32("JoystickAxisScale5") - }; - - F32 dead_zone[] = - { - gSavedSettings.getF32("JoystickAxisDeadZone0"), - gSavedSettings.getF32("JoystickAxisDeadZone1"), - gSavedSettings.getF32("JoystickAxisDeadZone2"), - gSavedSettings.getF32("JoystickAxisDeadZone3"), - gSavedSettings.getF32("JoystickAxisDeadZone4"), - gSavedSettings.getF32("JoystickAxisDeadZone5") - }; - - F32 cur_delta[6]; - static F32 last_delta[] = {0,0,0,0,0,0}; - static F32 delta[] = { 0,0,0,0,0,0 }; - - F32 feather = gSavedSettings.getF32("FlycamFeathering"); - BOOL absolute = gSavedSettings.getBOOL("FlycamAbsolute"); - - for (U32 i = 0; i < 6; i++) - { - cur_delta[i] = window->getJoystickAxis(axis[i]); - F32 tmp = cur_delta[i]; - if (absolute) - { - cur_delta[i] = cur_delta[i] - last_delta[i]; - } - last_delta[i] = tmp; - - if (cur_delta[i] > 0) - { - cur_delta[i] = llmax(cur_delta[i]-dead_zone[i], 0.f); - } - else - { - cur_delta[i] = llmin(cur_delta[i]+dead_zone[i], 0.f); - } - cur_delta[i] *= axis_scale[i]; - - if (!absolute) - { - cur_delta[i] *= time; - } - - delta[i] = delta[i] + (cur_delta[i]-delta[i])*time*feather; - } - - mFlyCamPosition += LLVector3(delta) * mFlyCamRotation; - - LLMatrix3 rot_mat(delta[3], - delta[4], - delta[5]); - - mFlyCamRotation = LLQuaternion(rot_mat)*mFlyCamRotation; - - if (gSavedSettings.getBOOL("FlycamAutoLeveling")) - { - LLMatrix3 level(mFlyCamRotation); - - LLVector3 x = LLVector3(level.mMatrix[0]); - LLVector3 y = LLVector3(level.mMatrix[1]); - LLVector3 z = LLVector3(level.mMatrix[2]); - - y.mV[2] = 0.f; - y.normVec(); - - level.setRows(x,y,z); - level.orthogonalize(); - - LLQuaternion quat = LLQuaternion(level); - mFlyCamRotation = nlerp(llmin(feather*time,1.f), mFlyCamRotation, quat); - } - - LLMatrix3 mat(mFlyCamRotation); - - gCamera->setOrigin(mFlyCamPosition); - gCamera->mXAxis = LLVector3(mat.mMatrix[0]); - gCamera->mYAxis = LLVector3(mat.mMatrix[1]); - gCamera->mZAxis = LLVector3(mat.mMatrix[2]); -} diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h index 4d89b65c90..5baf01de51 100644 --- a/indra/newview/pipeline.h +++ b/indra/newview/pipeline.h @@ -43,41 +43,6 @@ bool LLRayAABB(const LLVector3 ¢er, const LLVector3 &size, const LLVector3& BOOL LLLineSegmentAABB(const LLVector3& start, const LLVector3& end, const LLVector3& center, const LLVector3& size); BOOL setup_hud_matrices(BOOL for_select); -class LLGLSLShader -{ -public: - LLGLSLShader(); - - void unload(); - void attachObject(GLhandleARB object); - void attachObjects(GLhandleARB* objects = NULL, S32 count = 0); - BOOL mapAttributes(const char** attrib_names = NULL, S32 count = 0); - BOOL mapUniforms(const char** uniform_names = NULL, S32 count = 0); - void mapUniform(GLint index, const char** uniform_names = NULL, S32 count = 0); - void vertexAttrib4f(U32 index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); - void vertexAttrib4fv(U32 index, GLfloat* v); - - GLint mapUniformTextureChannel(GLint location, GLenum type); - - - //enable/disable texture channel for specified uniform - //if given texture uniform is active in the shader, - //the corresponding channel will be active upon return - //returns channel texture is enabled in from [0-MAX) - S32 enableTexture(S32 uniform, S32 mode = GL_TEXTURE_2D); - S32 disableTexture(S32 uniform, S32 mode = GL_TEXTURE_2D); - - BOOL link(BOOL suppress_errors = FALSE); - void bind(); - void unbind(); - - GLhandleARB mProgramObject; - std::vector<GLint> mAttribute; - std::vector<GLint> mUniform; - std::vector<GLint> mTexture; - S32 mActiveTextureChannels; -}; - class LLPipeline { public: @@ -125,7 +90,6 @@ public: void markShift(LLDrawable *drawablep); void markTextured(LLDrawable *drawablep); void markRebuild(LLDrawable *drawablep, LLDrawable::EDrawableFlags flag = LLDrawable::REBUILD_ALL, BOOL priority = FALSE); - void markRebuild(LLSpatialGroup* groupp); void markRelight(LLDrawable *drawablep, const BOOL now = FALSE); //get the object between start and end that's closest to start. Return the point of collision in collision. @@ -149,17 +113,7 @@ public: void setUseVertexShaders(BOOL use_shaders); BOOL getUseVertexShaders() const { return mVertexShadersEnabled; } BOOL canUseVertexShaders(); - BOOL setVertexShaderLevel(S32 type, S32 level); - S32 getVertexShaderLevel(S32 type) const { return mVertexShaderLevel[type]; } - S32 getMaxVertexShaderLevel(S32 type) const { return mMaxVertexShaderLevel[type]; } - - void setShaders(); - void dumpObjectLog(GLhandleARB ret, BOOL warns = TRUE); - BOOL linkProgramObject(GLhandleARB obj, BOOL suppress_errors = FALSE); - BOOL validateProgramObject(GLhandleARB obj); - GLhandleARB loadShader(const LLString& filename, S32 cls, GLenum type); - // phases void resetFrameStats(); @@ -187,7 +141,6 @@ public: void renderGeom(LLCamera& camera); void renderHighlights(); void renderDebug(); - void processGeometry(LLCamera& camera); void processOcclusion(LLCamera& camera); void renderForSelect(std::set<LLViewerObject*>& objects); @@ -200,7 +153,7 @@ public: S32 getVisibleCount() const { return mVisibleList.size(); } S32 getLightCount() const { return mLights.size(); } - void calcNearbyLights(); + void calcNearbyLights(LLCamera& camera); void setupHWLights(LLDrawPool* pool); void setupAvatarLights(BOOL for_edit = FALSE); void enableLights(U32 mask, F32 shadow_factor); @@ -250,11 +203,6 @@ private: void initShaders(BOOL force); void unloadShaders(); BOOL loadShaders(); - BOOL loadShadersLighting(); - BOOL loadShadersObject(); - BOOL loadShadersAvatar(); - BOOL loadShadersEnvironment(); - BOOL loadShadersInterface(); void saveVertexShaderLevel(S32 type, S32 level, S32 max); void addToQuickLookup( LLDrawPool* new_poolp ); void removeFromQuickLookup( LLDrawPool* poolp ); @@ -262,15 +210,7 @@ private: public: enum {GPU_CLASS_MAX = 3 }; - enum EShaderClass - { - SHADER_LIGHTING, - SHADER_OBJECT, - SHADER_AVATAR, - SHADER_ENVIRONMENT, - SHADER_INTERFACE, - SHADER_COUNT - }; + enum LLRenderTypeMask { // Following are pool types (some are also object types) @@ -361,7 +301,7 @@ public: LLSpatialPartition* getSpatialPartition(LLViewerObject* vobj); LLSpatialPartition* getSpatialPartition(U32 index); - void updateCamera(); + void updateCamera(BOOL reset = FALSE); LLVector3 mFlyCamPosition; LLQuaternion mFlyCamRotation; @@ -390,7 +330,6 @@ public: static BOOL sSkipUpdate; //skip lod updates static BOOL sDynamicReflections; static BOOL sRenderGlow; - static BOOL sOverrideAgentCamera; //screen texture GLuint mScreenTex; @@ -412,140 +351,7 @@ public: //depth buffer object for rendering dynamic cube maps GLuint mCubeDepth; - class LLScatterShader - { - public: - static void init(GLhandleARB shader, int map_stage); - }; - - //utility shader objects (not shader programs) - GLhandleARB mLightVertex; - GLhandleARB mLightFragment; - GLhandleARB mScatterVertex; - GLhandleARB mScatterFragment; - - //global (reserved slot) shader parameters - static const char* sReservedAttribs[]; - static U32 sReservedAttribCount; - - typedef enum - { - GLSL_MATERIAL_COLOR = 0, - GLSL_SPECULAR_COLOR, - GLSL_BINORMAL, - GLSL_END_RESERVED_ATTRIBS - } eGLSLReservedAttribs; - - static const char* sReservedUniforms[]; - static U32 sReservedUniformCount; - - typedef enum - { - GLSL_DIFFUSE_MAP = 0, - GLSL_SPECULAR_MAP, - GLSL_BUMP_MAP, - GLSL_ENVIRONMENT_MAP, - GLSL_END_RESERVED_UNIFORMS - } eGLSLReservedUniforms; - - static const char* sShinyUniforms[]; - static U32 sShinyUniformCount; - - typedef enum - { - GLSL_SHINY_ORIGIN = GLSL_END_RESERVED_UNIFORMS - } eShinyUniforms; - - LLVector4 mShinyOrigin; - - //object shaders - LLGLSLShader mObjectSimpleProgram; - LLGLSLShader mObjectAlphaProgram; - LLGLSLShader mObjectBumpProgram; - LLGLSLShader mObjectShinyProgram; - - //water parameters - static const char* sWaterUniforms[]; - static U32 sWaterUniformCount; - - typedef enum - { - GLSL_WATER_SCREENTEX = GLSL_END_RESERVED_UNIFORMS, - GLSL_WATER_EYEVEC, - GLSL_WATER_TIME, - GLSL_WATER_WAVE_DIR1, - GLSL_WATER_WAVE_DIR2, - GLSL_WATER_LIGHT_DIR, - GLSL_WATER_SPECULAR, - GLSL_WATER_SPECULAR_EXP, - GLSL_WATER_FBSCALE, - GLSL_WATER_REFSCALE - } eWaterUniforms; - - - //terrain parameters - static const char* sTerrainUniforms[]; - static U32 sTerrainUniformCount; - - typedef enum - { - GLSL_TERRAIN_DETAIL0 = GLSL_END_RESERVED_UNIFORMS, - GLSL_TERRAIN_DETAIL1, - GLSL_TERRAIN_ALPHARAMP - } eTerrainUniforms; - - //glow parameters - static const char* sGlowUniforms[]; - static U32 sGlowUniformCount; - - typedef enum - { - GLSL_GLOW_DELTA = GLSL_END_RESERVED_UNIFORMS - } eGlowUniforms; - - //environment shaders - LLGLSLShader mTerrainProgram; - LLGLSLShader mGlowProgram; - LLGLSLShader mGroundProgram; - LLGLSLShader mWaterProgram; - - //interface shaders - LLGLSLShader mHighlightProgram; - //avatar shader parameter tables - static const char* sAvatarAttribs[]; - static U32 sAvatarAttribCount; - - typedef enum - { - GLSL_AVATAR_WEIGHT = GLSL_END_RESERVED_ATTRIBS, - GLSL_AVATAR_CLOTHING, - GLSL_AVATAR_WIND, - GLSL_AVATAR_SINWAVE, - GLSL_AVATAR_GRAVITY - } eAvatarAttribs; - - static const char* sAvatarUniforms[]; - static U32 sAvatarUniformCount; - - typedef enum - { - GLSL_AVATAR_MATRIX = GLSL_END_RESERVED_UNIFORMS - } eAvatarUniforms; - - //avatar skinning utility shader object - GLhandleARB mAvatarSkinVertex; - - //avatar shader handles - LLGLSLShader mAvatarProgram; - LLGLSLShader mAvatarEyeballProgram; - LLGLSLShader mAvatarPickProgram; - - //current avatar shader parameter pointer - GLint mAvatarMatrixParam; - GLint mMaterialIndex; - GLint mSpecularIndex; - LLColor4 mSunDiffuse; LLVector3 mSunDir; @@ -557,13 +363,11 @@ public: LLSpatialGroup::sg_vector_t mDrawableGroups; void clearRenderMap(); - -protected: + BOOL mVertexShadersEnabled; S32 mVertexShadersLoaded; // 0 = no, 1 = yes, -1 = failed - S32 mVertexShaderLevel[SHADER_COUNT]; - S32 mMaxVertexShaderLevel[SHADER_COUNT]; - + +protected: U32 mRenderTypeMask; U32 mRenderFeatureMask; U32 mRenderDebugFeatureMask; @@ -619,7 +423,6 @@ protected: // LLDrawable::drawable_list_t mBuildQ1; // priority LLDrawable::drawable_list_t mBuildQ2; // non-priority - LLSpatialGroup::sg_set_t mGroupQ; //spatial groups LLDrawable::drawable_set_t mActiveQ; diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py index 2c04a34da8..e9dfa0a382 100755 --- a/indra/newview/viewer_manifest.py +++ b/indra/newview/viewer_manifest.py @@ -272,9 +272,6 @@ class DarwinManifest(ViewerManifest): if self.prefix(src="", dst="Resources"): super(DarwinManifest, self).construct() - # the trial directory seems to be not used [rdw] - self.path('trial') - if self.prefix("cursors_mac"): self.path("*.tif") self.end_prefix("cursors_mac") |