From 7abecb48babe6a6f09bf6692ba55076546cfced9 Mon Sep 17 00:00:00 2001 From: Jacek Antonelli Date: Mon, 1 Dec 2008 17:39:58 -0600 Subject: Second Life viewer sources 1.22.0-RC --- linden/indra/newview/CMakeLists.txt | 105 +- .../indra/newview/English.lproj/InfoPlist.strings | 4 +- linden/indra/newview/Info-SecondLife.plist | 2 +- linden/indra/newview/app_settings/keywords.ini | 10 +- linden/indra/newview/app_settings/settings.xml | 123 +- .../shaders/class1/objects/simpleV.glsl | 2 +- linden/indra/newview/featuretable.txt | 17 +- linden/indra/newview/featuretable_linux.txt | 17 +- linden/indra/newview/featuretable_mac.txt | 17 +- linden/indra/newview/gpu_table.txt | 51 +- .../darwin/releasecandidate-dmg/_DS_Store | Bin 12292 -> 12292 bytes .../windows/FILES_ARE_UNICODE_UTF-16LE.txt | 6 + .../installers/windows/installer_template.nsi | 473 +- .../indra/newview/installers/windows/lang_de.nsi | Bin 3762 -> 8262 bytes .../newview/installers/windows/lang_en-us.nsi | Bin 3211 -> 7162 bytes .../indra/newview/installers/windows/lang_es.nsi | Bin 0 -> 7612 bytes .../indra/newview/installers/windows/lang_fr.nsi | Bin 0 -> 7858 bytes .../indra/newview/installers/windows/lang_it.nsi | Bin 0 -> 7196 bytes .../indra/newview/installers/windows/lang_ja.nsi | Bin 3579 -> 6302 bytes .../indra/newview/installers/windows/lang_ko.nsi | Bin 3448 -> 6200 bytes .../indra/newview/installers/windows/lang_nl.nsi | Bin 0 -> 7160 bytes .../newview/installers/windows/lang_pt-br.nsi | Bin 0 -> 7590 bytes .../indra/newview/installers/windows/lang_zh.nsi | Bin 0 -> 5354 bytes .../newview/installers/windows/language_menu.nsi | Bin 0 -> 1292 bytes linden/indra/newview/llagent.cpp | 278 +- linden/indra/newview/llagent.h | 4 +- linden/indra/newview/llappviewer.cpp | 226 +- linden/indra/newview/llappviewer.h | 25 +- linden/indra/newview/llappviewerlinux.cpp | 307 +- linden/indra/newview/llappviewerlinux.h | 34 +- linden/indra/newview/llappviewerlinux_api.h | 148 + linden/indra/newview/llappviewerlinux_api.xml | 14 + linden/indra/newview/llappviewerlinux_api_dbus.cpp | 131 + linden/indra/newview/llappviewerlinux_api_dbus.h | 49 + .../newview/llappviewerlinux_api_dbus_syms_raw.inc | 9 + linden/indra/newview/llappviewermacosx.cpp | 101 +- linden/indra/newview/llappviewermacosx.h | 3 +- linden/indra/newview/llappviewerwin32.cpp | 104 +- linden/indra/newview/llappviewerwin32.h | 8 +- linden/indra/newview/llaudiosourcevo.cpp | 2 +- linden/indra/newview/llbox.cpp | 2 +- linden/indra/newview/llchatbar.cpp | 10 +- linden/indra/newview/llcommandlineparser.cpp | 12 +- linden/indra/newview/llcompilequeue.cpp | 17 +- linden/indra/newview/llcontainerview.cpp | 2 +- linden/indra/newview/lldrawable.cpp | 10 +- linden/indra/newview/lldrawpool.cpp | 9 +- linden/indra/newview/lldrawpoolalpha.cpp | 8 +- linden/indra/newview/lldrawpoolavatar.cpp | 14 +- linden/indra/newview/lldrawpoolbump.cpp | 55 +- linden/indra/newview/lldrawpoolground.cpp | 5 +- linden/indra/newview/lldrawpoolsky.cpp | 4 +- linden/indra/newview/lldrawpoolterrain.cpp | 124 +- linden/indra/newview/lldrawpooltree.cpp | 5 +- linden/indra/newview/lldrawpoolwater.cpp | 38 +- linden/indra/newview/lldrawpoolwlsky.cpp | 13 +- linden/indra/newview/lldynamictexture.cpp | 19 +- linden/indra/newview/lldynamictexture.h | 4 +- linden/indra/newview/llface.cpp | 16 +- linden/indra/newview/llface.h | 2 +- linden/indra/newview/llface.inl | 1 + linden/indra/newview/llfasttimerview.cpp | 13 +- linden/indra/newview/llfeaturemanager.cpp | 2 - linden/indra/newview/llfilepicker.cpp | 4 +- linden/indra/newview/llfloateractivespeakers.cpp | 6 + linden/indra/newview/llfloateranimpreview.cpp | 9 +- linden/indra/newview/llfloaterauction.cpp | 4 +- linden/indra/newview/llfloaterbeacons.cpp | 150 + linden/indra/newview/llfloaterbeacons.h | 56 + linden/indra/newview/llfloaterbuy.cpp | 12 +- linden/indra/newview/llfloaterbuy.h | 3 +- linden/indra/newview/llfloaterbuycurrency.cpp | 14 - linden/indra/newview/llfloatercolorpicker.cpp | 6 +- linden/indra/newview/llfloaterimagepreview.cpp | 117 +- linden/indra/newview/llfloaterimagepreview.h | 2 + linden/indra/newview/llfloaterjoystick.cpp | 2 +- linden/indra/newview/llfloaterland.cpp | 2 +- linden/indra/newview/llfloaterlandmark.cpp | 56 +- linden/indra/newview/llfloaterlandmark.h | 2 - linden/indra/newview/llfloaterpostcard.cpp | 12 +- linden/indra/newview/llfloaterpreference.cpp | 4 +- linden/indra/newview/llfloatersnapshot.cpp | 285 +- linden/indra/newview/llfloatertopobjects.cpp | 2 +- linden/indra/newview/llfolderview.cpp | 4 +- linden/indra/newview/llframestatview.cpp | 10 +- linden/indra/newview/llglsandbox.cpp | 59 +- linden/indra/newview/llgroupmgr.cpp | 17 + linden/indra/newview/llhomelocationresponder.cpp | 108 + linden/indra/newview/llhomelocationresponder.h | 47 + linden/indra/newview/llhudeffectbeam.cpp | 2 +- linden/indra/newview/llhudeffectlookat.cpp | 4 +- linden/indra/newview/llhudeffectpointat.cpp | 4 +- linden/indra/newview/llhudicon.cpp | 6 +- linden/indra/newview/llhudtext.cpp | 127 +- linden/indra/newview/llhudtext.h | 2 + linden/indra/newview/llinventorymodel.cpp | 536 +- linden/indra/newview/llinventorymodel.h | 38 +- linden/indra/newview/llinventoryview.cpp | 22 +- linden/indra/newview/llinventoryview.h | 4 +- linden/indra/newview/lljoystickbutton.cpp | 4 +- linden/indra/newview/llmanip.cpp | 8 +- linden/indra/newview/llmaniprotate.cpp | 12 +- linden/indra/newview/llmanipscale.cpp | 14 +- linden/indra/newview/llmaniptranslate.cpp | 44 +- linden/indra/newview/llmapresponders.cpp | 4 +- linden/indra/newview/llmemoryview.cpp | 2 +- linden/indra/newview/llmutelist.cpp | 45 +- linden/indra/newview/llmutelist.h | 3 +- linden/indra/newview/llnetmap.cpp | 26 +- linden/indra/newview/llnotify.cpp | 2 +- linden/indra/newview/llpaneldisplay.cpp | 66 +- linden/indra/newview/llpanelgeneral.cpp | 226 +- linden/indra/newview/llpanelgeneral.h | 35 +- linden/indra/newview/llpanelgrouplandmoney.cpp | 3 +- linden/indra/newview/llpanelinput.cpp | 87 +- linden/indra/newview/llpanelinput.h | 17 - linden/indra/newview/llpanellogin.cpp | 39 +- linden/indra/newview/llpanelmsgs.cpp | 22 +- linden/indra/newview/llpanelnetwork.cpp | 46 +- linden/indra/newview/llpanelnetwork.h | 24 +- linden/indra/newview/llpanelobject.cpp | 14 +- linden/indra/newview/llpanelweb.cpp | 174 +- linden/indra/newview/llpanelweb.h | 29 +- linden/indra/newview/llpolymesh.h | 2 +- linden/indra/newview/llprefschat.cpp | 60 +- linden/indra/newview/llprefsim.cpp | 99 +- linden/indra/newview/llprefsvoice.cpp | 285 +- linden/indra/newview/llprefsvoice.h | 47 +- linden/indra/newview/llpreviewscript.cpp | 15 +- linden/indra/newview/llpreviewscript.h | 4 +- linden/indra/newview/llpreviewsound.cpp | 3 +- linden/indra/newview/llpreviewtexture.cpp | 26 +- linden/indra/newview/llprogressview.cpp | 6 +- linden/indra/newview/llselectmgr.cpp | 17 +- linden/indra/newview/llselectmgr.h | 2 +- linden/indra/newview/llsky.cpp | 6 +- linden/indra/newview/llspatialpartition.cpp | 77 +- linden/indra/newview/llspatialpartition.h | 7 + linden/indra/newview/llsprite.cpp | 6 +- linden/indra/newview/llsprite.h | 2 +- linden/indra/newview/llstartup.cpp | 289 +- linden/indra/newview/llstatbar.cpp | 2 +- linden/indra/newview/llsurface.cpp | 6 +- linden/indra/newview/lltexlayer.cpp | 229 +- linden/indra/newview/lltexlayer.h | 39 +- linden/indra/newview/lltexturectrl.cpp | 4 +- linden/indra/newview/lltextureview.cpp | 16 +- linden/indra/newview/lltool.cpp | 6 + linden/indra/newview/lltoolbrush.cpp | 4 +- linden/indra/newview/lltoolmorph.cpp | 7 +- linden/indra/newview/lltoolplacer.cpp | 4 +- linden/indra/newview/lltoolselectrect.cpp | 2 +- linden/indra/newview/lltracker.cpp | 7 +- linden/indra/newview/lluserauth.cpp | 16 +- linden/indra/newview/llvelocitybar.cpp | 2 +- linden/indra/newview/llvieweraudio.cpp | 8 + linden/indra/newview/llviewerdisplay.cpp | 24 +- linden/indra/newview/llviewerimage.cpp | 99 +- linden/indra/newview/llviewerimage.h | 14 +- linden/indra/newview/llviewerimagelist.cpp | 27 +- linden/indra/newview/llviewerimagelist.h | 2 + linden/indra/newview/llviewerinventory.cpp | 41 +- linden/indra/newview/llviewerjoint.cpp | 71 +- linden/indra/newview/llviewerjointattachment.cpp | 2 +- linden/indra/newview/llviewerjointmesh.cpp | 18 +- linden/indra/newview/llviewermedia.cpp | 1 + linden/indra/newview/llviewermenu.cpp | 528 +- linden/indra/newview/llviewermenu.h | 1 - linden/indra/newview/llviewermenufile.cpp | 18 +- linden/indra/newview/llviewermessage.cpp | 16 +- linden/indra/newview/llviewernetwork.cpp | 20 + linden/indra/newview/llviewernetwork.h | 5 + linden/indra/newview/llviewerobject.cpp | 82 +- linden/indra/newview/llviewerobject.h | 10 +- linden/indra/newview/llviewerobjectlist.cpp | 34 +- linden/indra/newview/llviewerparcelmedia.cpp | 2 +- linden/indra/newview/llviewerparceloverlay.cpp | 8 +- linden/indra/newview/llviewerpartsim.cpp | 22 +- linden/indra/newview/llviewerpartsim.h | 6 +- linden/indra/newview/llviewerpartsource.cpp | 9 +- linden/indra/newview/llviewerregion.cpp | 17 +- linden/indra/newview/llviewerregion.h | 1 + linden/indra/newview/llviewershadermgr.cpp | 38 +- linden/indra/newview/llviewerstats.h | 3 + linden/indra/newview/llviewertexteditor.cpp | 3 +- linden/indra/newview/llviewerwindow.cpp | 254 +- linden/indra/newview/llviewerwindow.h | 9 + linden/indra/newview/llvoavatar.cpp | 189 +- linden/indra/newview/llvoavatar.h | 10 + linden/indra/newview/llvograss.cpp | 153 +- linden/indra/newview/llvograss.h | 10 + linden/indra/newview/llvoground.cpp | 2 +- linden/indra/newview/llvoicevisualizer.cpp | 17 +- linden/indra/newview/llvopartgroup.cpp | 61 +- linden/indra/newview/llvopartgroup.h | 17 + linden/indra/newview/llvosky.cpp | 80 +- linden/indra/newview/llvosurfacepatch.cpp | 81 + linden/indra/newview/llvosurfacepatch.h | 10 + linden/indra/newview/llvotextbubble.cpp | 2 +- linden/indra/newview/llvotree.cpp | 72 +- linden/indra/newview/llvotree.h | 11 + linden/indra/newview/llvovolume.cpp | 121 +- linden/indra/newview/llvovolume.h | 1 + linden/indra/newview/llvowlsky.cpp | 6 +- linden/indra/newview/llwaterparammanager.cpp | 85 +- linden/indra/newview/llwaterparammanager.h | 3 +- linden/indra/newview/llwebbrowserctrl.cpp | 4 +- linden/indra/newview/llwindebug.cpp | 63 + linden/indra/newview/llwindebug.h | 3 +- linden/indra/newview/llwlparammanager.cpp | 128 +- linden/indra/newview/llwlparammanager.h | 3 +- linden/indra/newview/llworld.cpp | 3 +- linden/indra/newview/llworldmap.cpp | 5 +- linden/indra/newview/llworldmapview.cpp | 40 +- linden/indra/newview/lsl_guide.html | 22078 ------------------- linden/indra/newview/pipeline.cpp | 187 +- linden/indra/newview/pipeline.h | 3 +- linden/indra/newview/res/viewerRes.rc | 8 +- .../newview/secondlife setup build dazzle.bat | 4 - .../indra/newview/skins/default/xui/de/alerts.xml | 12 +- .../skins/default/xui/de/floater_inventory.xml | 4 +- .../xui/de/floater_inventory_item_properties.xml | 6 +- .../skins/default/xui/de/floater_lsl_guide.xml | 2 +- .../default/xui/de/floater_preview_gesture.xml | 2 + .../skins/default/xui/de/floater_snapshot.xml | 4 +- .../newview/skins/default/xui/de/floater_tools.xml | 20 +- .../default/xui/de/panel_avatar_classified.xml | 2 +- .../skins/default/xui/de/panel_group_general.xml | 8 +- .../default/xui/de/panel_group_land_money.xml | 15 +- .../skins/default/xui/de/panel_group_notices.xml | 6 +- .../skins/default/xui/de/panel_group_roles.xml | 14 +- .../default/xui/de/panel_preferences_chat.xml | 2 +- .../default/xui/de/panel_preferences_input.xml | 12 +- .../indra/newview/skins/default/xui/de/strings.xml | 4 +- .../newview/skins/default/xui/en-us/alerts.xml | 43 +- .../skins/default/xui/en-us/floater_about.xml | 1 + .../skins/default/xui/en-us/floater_about_land.xml | 22 +- .../skins/default/xui/en-us/floater_beacons.xml | 24 + .../default/xui/en-us/floater_chat_history.xml | 9 +- .../default/xui/en-us/floater_instant_message.xml | 1 + .../xui/en-us/floater_instant_message_ad_hoc.xml | 1 + .../xui/en-us/floater_instant_message_group.xml | 1 + .../skins/default/xui/en-us/menu_pie_object.xml | 2 +- .../skins/default/xui/en-us/menu_viewer.xml | 104 +- .../newview/skins/default/xui/en-us/notify.xml | 2 +- .../skins/default/xui/en-us/panel_chat_bar.xml | 11 +- .../default/xui/en-us/panel_preferences_chat.xml | 24 +- .../xui/en-us/panel_preferences_general.xml | 59 +- .../default/xui/en-us/panel_preferences_im.xml | 20 +- .../default/xui/en-us/panel_preferences_input.xml | 38 +- .../xui/en-us/panel_preferences_network.xml | 8 +- .../default/xui/en-us/panel_preferences_popups.xml | 4 +- .../default/xui/en-us/panel_preferences_voice.xml | 10 +- .../default/xui/en-us/panel_preferences_web.xml | 8 +- .../skins/default/xui/en-us/panel_status_bar.xml | 2 +- .../indra/newview/skins/default/xui/es/alerts.xml | 29 +- .../skins/default/xui/es/floater_about_land.xml | 21 - .../indra/newview/skins/default/xui/fr/alerts.xml | 1865 +- .../newview/skins/default/xui/fr/floater_about.xml | 4 +- .../skins/default/xui/fr/floater_about_land.xml | 343 +- .../default/xui/fr/floater_active_speakers.xml | 6 +- .../default/xui/fr/floater_animation_preview.xml | 40 +- .../skins/default/xui/fr/floater_avatar_picker.xml | 10 +- .../skins/default/xui/fr/floater_buy_contents.xml | 10 +- .../skins/default/xui/fr/floater_buy_currency.xml | 26 +- .../skins/default/xui/fr/floater_buy_land.xml | 55 +- .../skins/default/xui/fr/floater_buy_object.xml | 8 +- .../skins/default/xui/fr/floater_chat_history.xml | 15 +- .../skins/default/xui/fr/floater_color_picker.xml | 16 +- .../skins/default/xui/fr/floater_customize.xml | 540 +- .../skins/default/xui/fr/floater_directory.xml | 196 +- .../skins/default/xui/fr/floater_env_settings.xml | 20 +- .../skins/default/xui/fr/floater_god_tools.xml | 116 +- .../skins/default/xui/fr/floater_group_info.xml | 126 +- .../default/xui/fr/floater_hardware_settings.xml | 19 +- .../skins/default/xui/fr/floater_image_preview.xml | 8 +- .../skins/default/xui/fr/floater_import.xml | 6 +- .../default/xui/fr/floater_instant_message.xml | 18 +- .../xui/fr/floater_instant_message_ad_hoc.xml | 11 +- .../xui/fr/floater_instant_message_group.xml | 14 +- .../skins/default/xui/fr/floater_inventory.xml | 74 +- .../xui/fr/floater_inventory_item_properties.xml | 29 +- .../xui/fr/floater_inventory_view_finder.xml | 40 +- .../skins/default/xui/fr/floater_lagmeter.xml | 18 +- .../skins/default/xui/fr/floater_media_browser.xml | 22 +- .../skins/default/xui/fr/floater_moveview.xml | 23 +- .../skins/default/xui/fr/floater_mute_object.xml | 10 +- .../default/xui/fr/floater_name_description.xml | 6 +- .../default/xui/fr/floater_new_outfit_dialog.xml | 129 +- .../newview/skins/default/xui/fr/floater_pay.xml | 24 +- .../skins/default/xui/fr/floater_pay_object.xml | 28 +- .../default/xui/fr/floater_preview_gesture.xml | 2 + .../default/xui/fr/floater_price_for_listing.xml | 8 +- .../skins/default/xui/fr/floater_region_info.xml | 4 +- .../skins/default/xui/fr/floater_report_abuse.xml | 37 +- .../skins/default/xui/fr/floater_report_bug.xml | 20 +- .../skins/default/xui/fr/floater_sell_land.xml | 14 +- .../xui/fr/floater_skin_preview_template.xml | 23 +- .../skins/default/xui/fr/floater_snapshot.xml | 41 +- .../skins/default/xui/fr/floater_sound_preview.xml | 6 +- .../skins/default/xui/fr/floater_texture_ctrl.xml | 26 +- .../newview/skins/default/xui/fr/floater_tools.xml | 354 +- .../skins/default/xui/fr/floater_top_objects.xml | 28 +- .../skins/default/xui/fr/floater_world_map.xml | 95 +- .../skins/default/xui/fr/menu_inventory.xml | 125 +- .../skins/default/xui/fr/menu_pie_avatar.xml | 26 +- .../newview/skins/default/xui/fr/menu_pie_land.xml | 16 +- .../newview/skins/default/xui/fr/menu_viewer.xml | 476 +- .../newview/skins/default/xui/fr/mime_types.xml | 8 +- .../indra/newview/skins/default/xui/fr/notify.xml | 60 +- .../newview/skins/default/xui/fr/panel_audio.xml | 16 +- .../skins/default/xui/fr/panel_audio_device.xml | 9 +- .../newview/skins/default/xui/fr/panel_avatar.xml | 124 +- .../default/xui/fr/panel_avatar_classified.xml | 32 +- .../skins/default/xui/fr/panel_classified.xml | 22 +- .../newview/skins/default/xui/fr/panel_friends.xml | 37 +- .../skins/default/xui/fr/panel_group_general.xml | 52 +- .../skins/default/xui/fr/panel_group_invite.xml | 19 +- .../default/xui/fr/panel_group_land_money.xml | 38 +- .../skins/default/xui/fr/panel_group_notices.xml | 70 +- .../skins/default/xui/fr/panel_group_roles.xml | 86 +- .../skins/default/xui/fr/panel_group_voting.xml | 44 +- .../newview/skins/default/xui/fr/panel_groups.xml | 26 +- .../newview/skins/default/xui/fr/panel_login.xml | 16 +- .../skins/default/xui/fr/panel_master_volume.xml | 7 +- .../skins/default/xui/fr/panel_media_controls.xml | 24 +- .../skins/default/xui/fr/panel_media_remote.xml | 12 +- .../default/xui/fr/panel_media_remote_expanded.xml | 6 +- .../skins/default/xui/fr/panel_overlaybar.xml | 15 +- .../newview/skins/default/xui/fr/panel_place.xml | 20 +- .../skins/default/xui/fr/panel_place_small.xml | 24 +- .../default/xui/fr/panel_preferences_audio.xml | 39 +- .../default/xui/fr/panel_preferences_chat.xml | 75 +- .../default/xui/fr/panel_preferences_general.xml | 89 +- .../default/xui/fr/panel_preferences_graphics1.xml | 94 +- .../skins/default/xui/fr/panel_preferences_im.xml | 44 +- .../default/xui/fr/panel_preferences_input.xml | 31 +- .../default/xui/fr/panel_preferences_network.xml | 21 +- .../default/xui/fr/panel_preferences_popups.xml | 26 +- .../default/xui/fr/panel_preferences_voice.xml | 20 +- .../skins/default/xui/fr/panel_preferences_web.xml | 21 +- .../skins/default/xui/fr/panel_region_debug.xml | 62 +- .../skins/default/xui/fr/panel_region_estate.xml | 74 +- .../skins/default/xui/fr/panel_region_general.xml | 57 +- .../skins/default/xui/fr/panel_region_terrain.xml | 41 +- .../default/xui/fr/panel_speaker_controls.xml | 12 +- .../skins/default/xui/fr/panel_status_bar.xml | 42 +- .../newview/skins/default/xui/fr/panel_toolbar.xml | 25 +- .../skins/default/xui/fr/panel_voice_enable.xml | 4 +- .../skins/default/xui/fr/panel_voice_options.xml | 14 +- .../indra/newview/skins/default/xui/fr/strings.xml | 12 +- .../skins/default/xui/ja/floater_about_land.xml | 3 - .../default/xui/ja/floater_preview_gesture.xml | 2 + .../newview/skins/default/xui/ja/floater_tools.xml | 2 +- .../newview/skins/default/xui/ja/panel_avatar.xml | 2 +- .../default/xui/ja/panel_preferences_chat.xml | 2 +- .../default/xui/ja/panel_preferences_input.xml | 12 +- .../default/xui/ja/panel_preferences_network.xml | 2 +- .../indra/newview/skins/default/xui/ja/strings.xml | 4 +- .../skins/default/xui/ko/floater_about_land.xml | 3 - .../default/xui/ko/floater_preview_gesture.xml | 2 + .../default/xui/ko/panel_preferences_chat.xml | 2 +- .../default/xui/ko/panel_preferences_input.xml | 12 +- .../indra/newview/skins/default/xui/pt/alerts.xml | 2 +- .../indra/newview/skins/default/xui/zh/alerts.xml | 14 - .../skins/default/xui/zh/floater_about_land.xml | 21 - .../skins/default/xui/zh/need_to_translate.xml | 908 - .../skins/silver/xui/en-us/floater_about_land.xml | 22 +- .../skins/silver/xui/en-us/panel_status_bar.xml | 2 +- linden/indra/newview/viewer_manifest.py | 114 +- 370 files changed, 8919 insertions(+), 31004 deletions(-) create mode 100644 linden/indra/newview/installers/windows/FILES_ARE_UNICODE_UTF-16LE.txt create mode 100644 linden/indra/newview/installers/windows/lang_es.nsi create mode 100644 linden/indra/newview/installers/windows/lang_fr.nsi create mode 100644 linden/indra/newview/installers/windows/lang_it.nsi create mode 100644 linden/indra/newview/installers/windows/lang_nl.nsi create mode 100644 linden/indra/newview/installers/windows/lang_pt-br.nsi create mode 100644 linden/indra/newview/installers/windows/lang_zh.nsi create mode 100644 linden/indra/newview/installers/windows/language_menu.nsi create mode 100644 linden/indra/newview/llappviewerlinux_api.h create mode 100644 linden/indra/newview/llappviewerlinux_api.xml create mode 100644 linden/indra/newview/llappviewerlinux_api_dbus.cpp create mode 100644 linden/indra/newview/llappviewerlinux_api_dbus.h create mode 100644 linden/indra/newview/llappviewerlinux_api_dbus_syms_raw.inc create mode 100644 linden/indra/newview/llfloaterbeacons.cpp create mode 100644 linden/indra/newview/llfloaterbeacons.h create mode 100644 linden/indra/newview/llhomelocationresponder.cpp create mode 100644 linden/indra/newview/llhomelocationresponder.h delete mode 100644 linden/indra/newview/lsl_guide.html delete mode 100644 linden/indra/newview/secondlife setup build dazzle.bat create mode 100644 linden/indra/newview/skins/default/xui/en-us/floater_beacons.xml delete mode 100644 linden/indra/newview/skins/default/xui/zh/need_to_translate.xml (limited to 'linden/indra/newview') diff --git a/linden/indra/newview/CMakeLists.txt b/linden/indra/newview/CMakeLists.txt index e93ea57..4dd4c74 100644 --- a/linden/indra/newview/CMakeLists.txt +++ b/linden/indra/newview/CMakeLists.txt @@ -5,6 +5,7 @@ project(viewer) include(00-Common) include(Boost) include(BuildVersion) +include(DBusGlib) include(DirectX) include(ELFIO) include(FMOD) @@ -123,6 +124,7 @@ set(viewer_SOURCE_FILES llfloateravatarinfo.cpp llfloateravatarpicker.cpp llfloateravatartextures.cpp + llfloaterbeacons.cpp llfloaterbuildoptions.cpp llfloaterbump.cpp llfloaterbuycontents.cpp @@ -198,6 +200,7 @@ set(viewer_SOURCE_FILES llglsandbox.cpp llgroupmgr.cpp llgroupnotify.cpp + llhomelocationresponder.cpp llhoverview.cpp llhudeffectbeam.cpp llhudeffect.cpp @@ -429,6 +432,9 @@ set(viewer_SOURCE_FILES pipeline.cpp ) +set(VIEWER_BINARY_NAME "secondlife-bin" CACHE STRING + "The name of the viewer executable to create.") + if (LINUX) # We can't set these flags for Darwin, because they get passed to # the PPC compiler. Ugh. @@ -513,6 +519,7 @@ set(viewer_HEADER_FILES llfloateravatarinfo.h llfloateravatarpicker.h llfloateravatartextures.h + llfloaterbeacons.h llfloaterbuildoptions.h llfloaterbump.h llfloaterbuy.h @@ -587,6 +594,7 @@ set(viewer_HEADER_FILES llgivemoney.h llgroupmgr.h llgroupnotify.h + llhomelocationresponder.h llhoverview.h llhudeffect.h llhudeffectbeam.h @@ -869,6 +877,7 @@ endif (DARWIN) if (LINUX) LIST(APPEND viewer_SOURCE_FILES llappviewerlinux.cpp) + LIST(APPEND viewer_SOURCE_FILES llappviewerlinux_api_dbus.cpp) LIST(APPEND CMAKE_EXE_LINKER_FLAGS -Wl,--as-needed) set(viewer_LIBRARIES @@ -1018,6 +1027,7 @@ set(viewer_XUI_FILES skins/default/xui/en-us/floater_audio_volume.xml skins/default/xui/en-us/floater_avatar_picker.xml skins/default/xui/en-us/floater_avatar_textures.xml + skins/default/xui/en-us/floater_beacons.xml skins/default/xui/en-us/floater_build_options.xml skins/default/xui/en-us/floater_bumps.xml skins/default/xui/en-us/floater_buy_contents.xml @@ -1236,6 +1246,17 @@ set_source_files_properties(${viewer_CHARACTER_FILES} list(APPEND viewer_SOURCE_FILES ${viewer_CHARACTER_FILES}) +if (WINDOWS) + file(GLOB viewer_INSTALLER_FILES installers/windows/*.nsi) + + source_group("Installer Files" FILES ${viewer_INSTALLER_FILES}) + + set_source_files_properties(${viewer_INSTALLER_FILES} + PROPERTIES HEADER_FILE_ONLY TRUE) + + list(APPEND viewer_SOURCE_FILES ${viewer_INSTALLER_FILES}) +endif (WINDOWS) + if (FMOD) set_source_files_properties(llstartup.cpp PROPERTIES COMPILE_FLAGS -DLL_FMOD) @@ -1262,15 +1283,15 @@ list(APPEND viewer_SOURCE_FILES ${viewer_HEADER_FILES}) set_source_files_properties(${viewer_HEADER_FILES} PROPERTIES HEADER_FILE_ONLY TRUE) -add_executable(secondlife-bin +add_executable(${VIEWER_BINARY_NAME} WIN32 MACOSX_BUNDLE ${viewer_SOURCE_FILES} ) -check_message_template(secondlife-bin) +check_message_template(${VIEWER_BINARY_NAME}) if (LLKDU_LIBRARY) - add_dependencies(secondlife-bin ${LLKDU_LIBRARY}) + add_dependencies(${VIEWER_BINARY_NAME} ${LLKDU_LIBRARY}) endif (LLKDU_LIBRARY) set(PACKAGE OFF CACHE BOOL @@ -1278,12 +1299,12 @@ set(PACKAGE OFF CACHE BOOL if (WINDOWS) if(MSVC71) - set(release_flags "/MAP:Release/secondlife-bin.map /MAPINFO:LINES") + set(release_flags "/MAP:Release/${VIEWER_BINARY_NAME}.map /MAPINFO:LINES") else(MSVC71) - set(release_flags "/MAP:Release/secondlife-bin.map") + set(release_flags "/MAP:Release/${VIEWER_BINARY_NAME}.map") endif(MSVC71) - set_target_properties(secondlife-bin + set_target_properties(${VIEWER_BINARY_NAME} PROPERTIES LINK_FLAGS "/debug /NODEFAULTLIB:MSVCRT /SUBSYSTEM:WINDOWS" LINK_FLAGS_DEBUG "/NODEFAULTLIB:LIBCMT /NODEFAULTLIB:MSVCRTD" @@ -1293,20 +1314,20 @@ if (WINDOWS) # sets the 'working directory' for debugging from visual studio. if (NOT UNATTENDED) add_custom_command( - TARGET secondlife-bin PRE_BUILD + TARGET ${VIEWER_BINARY_NAME} PRE_BUILD COMMAND ${CMAKE_SOURCE_DIR}/tools/vstool/vstool.exe ARGS --solution ${CMAKE_BINARY_DIR}/${CMAKE_PROJECT_NAME}.sln --workingdir - secondlife-bin + ${VIEWER_BINARY_NAME} ${CMAKE_CURRENT_SOURCE_DIR} - COMMENT "Setting the secondlife-bin working directory for debugging." + COMMENT "Setting the ${VIEWER_BINARY_NAME} working directory for debugging." ) endif (NOT UNATTENDED) add_custom_command( - TARGET secondlife-bin PRE_BUILD + TARGET ${VIEWER_BINARY_NAME} PRE_BUILD COMMAND ${CMAKE_COMMAND} ARGS -E @@ -1317,7 +1338,7 @@ if (WINDOWS) ) add_custom_command( - TARGET secondlife-bin PRE_BUILD + TARGET ${VIEWER_BINARY_NAME} PRE_BUILD COMMAND ${CMAKE_COMMAND} ARGS -E @@ -1327,10 +1348,10 @@ if (WINDOWS) COMMENT "Copying message.xml to the runtime folder." ) - add_dependencies(secondlife-bin copy_win_libs) + add_dependencies(${VIEWER_BINARY_NAME} copy_win_libs) if (EXISTS ${CMAKE_SOURCE_DIR}/copy_win_scripts) - add_dependencies(secondlife-bin copy_win_scripts) + add_dependencies(${VIEWER_BINARY_NAME} copy_win_scripts) endif (EXISTS ${CMAKE_SOURCE_DIR}/copy_win_scripts) add_custom_command( @@ -1340,14 +1361,14 @@ if (WINDOWS) ${CMAKE_CURRENT_SOURCE_DIR}/viewer_manifest.py --configuration=${CMAKE_CFG_INTDIR} --channel=${VIEWER_CHANNEL} - --login_channel=${VIEWER_CHANNEL} + --login_channel=${VIEWER_LOGIN_CHANNEL} --grid=${GRID} --source=${CMAKE_CURRENT_SOURCE_DIR} --artwork=${ARTWORK_DIR} --build=${CMAKE_CURRENT_BINARY_DIR} --dest=${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR} --touch=${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/touched.bat - DEPENDS secondlife-bin ${CMAKE_CURRENT_SOURCE_DIR}/viewer_manifest.py + DEPENDS ${VIEWER_BINARY_NAME} ${CMAKE_CURRENT_SOURCE_DIR}/viewer_manifest.py ) if (PACKAGE) add_custom_target(package ALL DEPENDS ${CMAKE_CFG_INTDIR}/touched.bat) @@ -1355,7 +1376,7 @@ if (WINDOWS) endif (PACKAGE) endif (WINDOWS) -target_link_libraries(secondlife-bin +target_link_libraries(${VIEWER_BINARY_NAME} ${LLAUDIO_LIBRARIES} ${LLCHARACTER_LIBRARIES} ${LLIMAGE_LIBRARIES} @@ -1376,7 +1397,7 @@ target_link_libraries(secondlife-bin ${viewer_LIBRARIES} ${BOOST_PROGRAM_OPTIONS_LIBRARY} ${BOOST_REGEX_LIBRARY} - ${BOOST_SIGNALS_LIBRARY} + ${DBUSGLIB_LIBRARIES} ${OPENGL_LIBRARIES} ${FMODWRAPPER_LIBRARY} ${OPENGL_LIBRARIES} @@ -1388,7 +1409,6 @@ target_link_libraries(secondlife-bin ${QUICKTIME_LIBRARY} ${WINDOWS_LIBRARIES} ${XMLRPCEPI_LIBRARIES} - ${ZLIB_LIBRARIES} ${ELFIO_LIBRARIES} ) @@ -1402,8 +1422,8 @@ if (LINUX) add_custom_command( OUTPUT secondlife-stripped COMMAND strip - ARGS --strip-debug -o secondlife-stripped secondlife-bin - DEPENDS secondlife-bin + ARGS --strip-debug -o secondlife-stripped ${VIEWER_BINARY_NAME} + DEPENDS ${VIEWER_BINARY_NAME} ) set(product SecondLife-${ARCH}-${viewer_VERSION}) @@ -1415,7 +1435,7 @@ if (LINUX) ${CMAKE_CURRENT_SOURCE_DIR}/viewer_manifest.py --grid=${GRID} --channel=${VIEWER_CHANNEL} - --login_channel=${VIEWER_CHANNEL} + --login_channel=${VIEWER_LOGIN_CHANNEL} --installer_name=${product} --arch=${ARCH} --source=${CMAKE_CURRENT_SOURCE_DIR} @@ -1435,7 +1455,7 @@ endif (LINUX) if (DARWIN) set(product "Second Life") set_target_properties( - secondlife-bin + ${VIEWER_BINARY_NAME} PROPERTIES OUTPUT_NAME "${product}" MACOSX_BUNDLE_INFO_STRING "info string - localize me" @@ -1449,7 +1469,7 @@ if (DARWIN) ) add_custom_command( - TARGET secondlife-bin POST_BUILD + TARGET ${VIEWER_BINARY_NAME} POST_BUILD COMMAND ${PYTHON_EXECUTABLE} ARGS ${CMAKE_CURRENT_SOURCE_DIR}/viewer_manifest.py @@ -1460,28 +1480,31 @@ if (DARWIN) --artwork=${ARTWORK_DIR} --build=${CMAKE_CURRENT_BINARY_DIR} --dest=${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${product}.app - DEPENDS secondlife-bin ${CMAKE_CURRENT_SOURCE_DIR}/viewer_manifest.py + DEPENDS ${VIEWER_BINARY_NAME} ${CMAKE_CURRENT_SOURCE_DIR}/viewer_manifest.py ) if (PACKAGE) - add_custom_target(package - COMMAND - ${PYTHON_EXECUTABLE} - ${CMAKE_CURRENT_SOURCE_DIR}/viewer_manifest.py - --grid=${GRID} - --configuration=${CMAKE_CFG_INTDIR} - --channel=${VIEWER_CHANNEL} - --login_channel=${VIEWER_CHANNEL} - --source=${CMAKE_CURRENT_SOURCE_DIR} - --artwork=${ARTWORK_DIR} - --build=${CMAKE_CURRENT_BINARY_DIR} - --dest=${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${product}.app - --touch=${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/.${product}.touched - DEPENDS - secondlife-bin - ${CMAKE_CURRENT_SOURCE_DIR}/viewer_manifest.py - ) + add_custom_target(package ALL DEPENDS ${VIEWER_BINARY_NAME}) add_dependencies(package mac-updater mac-crash-logger) + + add_custom_command( + TARGET package POST_BUILD + COMMAND ${PYTHON_EXECUTABLE} + ARGS + ${CMAKE_CURRENT_SOURCE_DIR}/viewer_manifest.py + --grid=${GRID} + --configuration=${CMAKE_CFG_INTDIR} + --channel=${VIEWER_CHANNEL} + --login_channel=${VIEWER_LOGIN_CHANNEL} + --source=${CMAKE_CURRENT_SOURCE_DIR} + --artwork=${ARTWORK_DIR} + --build=${CMAKE_CURRENT_BINARY_DIR} + --dest=${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${product}.app + --touch=${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/.${product}.touched + DEPENDS + ${CMAKE_CURRENT_SOURCE_DIR}/viewer_manifest.py + ) + endif (PACKAGE) endif (DARWIN) diff --git a/linden/indra/newview/English.lproj/InfoPlist.strings b/linden/indra/newview/English.lproj/InfoPlist.strings index 881483e..90646be 100644 --- a/linden/indra/newview/English.lproj/InfoPlist.strings +++ b/linden/indra/newview/English.lproj/InfoPlist.strings @@ -1,6 +1,6 @@ /* Localized versions of Info.plist keys */ CFBundleName = "Second Life"; -CFBundleShortVersionString = "Second Life version 1.20.9.87416"; -CFBundleGetInfoString = "Second Life version 1.20.9.87416, Copyright 2004-2008 Linden Research, Inc."; +CFBundleShortVersionString = "Second Life version 1.20.15.97417"; +CFBundleGetInfoString = "Second Life version 1.20.15.97417, Copyright 2004-2008 Linden Research, Inc."; diff --git a/linden/indra/newview/Info-SecondLife.plist b/linden/indra/newview/Info-SecondLife.plist index b889d45..3c55bad 100644 --- a/linden/indra/newview/Info-SecondLife.plist +++ b/linden/indra/newview/Info-SecondLife.plist @@ -32,7 +32,7 @@ CFBundleVersion - 1.20.9.87416 + 1.20.15.97417 CSResourcesFileMapped diff --git a/linden/indra/newview/app_settings/keywords.ini b/linden/indra/newview/app_settings/keywords.ini index 3679c38..0ab977d 100644 --- a/linden/indra/newview/app_settings/keywords.ini +++ b/linden/indra/newview/app_settings/keywords.ini @@ -332,11 +332,11 @@ REMOTE_DATA_REQUEST Value of event_type in remote_event if XML-RPC request is re REMOTE_DATA_REPLY Value of event_type in remote_event if XML-RPC reply is received -PRIM_TYPE Followed by PRIM_TYPE_BOX, PRIM_TYPE_CYLINDER, PRIM_TYPE_PRISM, PRIM_TYPE_SPHERE,:PRIM_TYPE_TORUS, or PRIM_TYPE_TUBE and their arguments -PRIM_MATERIAL Sets material to PRIM_MATERIAL_STONE, PRIM_MATERIAL_METAL, PRIM_MATERIAL_GLASS,:PRIM_MATERIAL_WOOD, PRIM_MATERIAL_FLESH, PRIM_MATERIAL_PLASTIC,:PRIM_MATERIAL_RUBBER, or PRIM_MATERIAL_LIGHT +PRIM_TYPE Followed by PRIM_TYPE_BOX, PRIM_TYPE_CYLINDER, PRIM_TYPE_PRISM, PRIM_TYPE_SPHERE, PRIM_TYPE_TORUS, PRIM_TYPE_TUBE, or PRIM_TYPE_SCULPT and their arguments +PRIM_MATERIAL Followed by PRIM_MATERIAL_STONE, PRIM_MATERIAL_METAL, PRIM_MATERIAL_GLASS, PRIM_MATERIAL_WOOD, PRIM_MATERIAL_FLESH, PRIM_MATERIAL_PLASTIC, or PRIM_MATERIAL_RUBBER PRIM_PHYSICS Sets physics to TRUE or FALSE -PRIM_FLEXIBLE Sets primitive flexibility to TRUE or FALSE -PRIM_POINT_LIGHT Sets light emission to TRUE or FALSE +PRIM_FLEXIBLE Followed by TRUE or FALSE, integer softness, float gravity, float friction, float wind, float tension, and vector force +PRIM_POINT_LIGHT Followed by TRUE or FALSE, vector color, float intensity, float radius, float falloff PRIM_TEMP_ON_REZ Sets temporay on rez to TRUE or FALSE PRIM_PHANTOM Sets phantom to TRUE or FALSE PRIM_CAST_SHADOWS DEPRECATED. Takes 1 parameter, an integer, but has no effect when set and always returns 0 if used in llGetPrimitiveParams. @@ -357,7 +357,7 @@ PRIM_TYPE_SPHERE Followed by integer hole shape, vector cut, float hollow, vecto PRIM_TYPE_TORUS Followed by integer hole shape, vector cut, float hollow, vector twist,:vector hole size, vector top shear, vector advanced cut, vector taper,:float revolutions, float radius offset, and float skew PRIM_TYPE_TUBE Followed by integer hole shape, vector cut, float hollow, vector twist,:vector hole size, vector top shear, vector advanced cut, vector taper,:float revolutions, float radius offset, and float skew PRIM_TYPE_RING Followed by integer hole shape, vector cut, float hollow, vector twist,:vector hole size, vector top shear, vector advanced cut, vector taper,:float revolutions, float radius offset, and float skew -PRIM_TYPE_SCULPT Followed by a key or string texture uuid. +PRIM_TYPE_SCULPT Followed by a key/string texture uuid, and one of PRIM_SCULPT_TYPE_SPHERE, PRIM_SCULPT_TYPE_TORUS, PRIM_SCULPT_TYPE_PLANE, or PRIM_SCULPT_TYPE_CYLINDER PRIM_HOLE_DEFAULT Sets hole type to match the prim type. PRIM_HOLE_SQUARE Sets hole type to square. diff --git a/linden/indra/newview/app_settings/settings.xml b/linden/indra/newview/app_settings/settings.xml index 07fa71c..9dac926 100644 --- a/linden/indra/newview/app_settings/settings.xml +++ b/linden/indra/newview/app_settings/settings.xml @@ -1838,17 +1838,6 @@ 0 - CompressSnapshotsToDisk - - Comment - Compress snapshots saved to disk (Using JPEG 2000) - Persist - 1 - Type - Boolean - Value - 0 - ConnectAsGod Comment @@ -2660,6 +2649,22 @@ 0 + FloaterBeaconsRect + + Comment + Rectangle for beacon and highlight controls + Persist + 1 + Type + Rect + Value + + 200 + 250 + 250 + 200 + + FloaterBuildOptionsRect Comment @@ -3595,6 +3600,17 @@ Value 0 + ForceMandatoryUpdate + + Comment + For QA: On next startup, forces the auto-updater to run + Persist + 1 + Type + Boolean + Value + 0 + ForwardBtnRect Comment @@ -4178,7 +4194,7 @@ Type String Value - https://wiki.secondlife.com/wiki/[LSL_STRING] + http://wiki.secondlife.com/wiki/[LSL_STRING] LagMeterShrunk @@ -4268,10 +4284,11 @@ Value 0.0.0 - LastSnapshotHeight + + LastSnapshotToEmailHeight Comment - The height of the last snapshot, in px + The height of the last email snapshot, in px Persist 1 Type @@ -4279,21 +4296,32 @@ Value 768 - LastSnapshotType + LastSnapshotToEmailWidth Comment - Select this as next type of snapshot to take (0 = postcard, 1 = texture, 2 = local image) + The width of the last email snapshot, in px Persist 1 Type S32 Value - 0 + 1024 - LastSnapshotWidth + LastSnapshotToDiskHeight Comment - The width of the last snapshot, in px + The height of the last disk snapshot, in px + Persist + 1 + Type + S32 + Value + 768 + + LastSnapshotToDiskWidth + + Comment + The width of the last disk snapshot, in px Persist 1 Type @@ -4301,6 +4329,39 @@ Value 1024 + LastSnapshotToInventoryHeight + + Comment + The height of the last texture snapshot, in px + Persist + 1 + Type + S32 + Value + 512 + + LastSnapshotToInventoryWidth + + Comment + The width of the last texture snapshot, in px + Persist + 1 + Type + S32 + Value + 512 + + LastSnapshotType + + Comment + Select this as next type of snapshot to take (0 = postcard, 1 = texture, 2 = local image) + Persist + 1 + Type + S32 + Value + 0 + LeftClickShowMenu Comment @@ -4477,17 +4538,6 @@ Value 20.0 - MainloopTimeoutDefault - - Comment - Timeout duration for mainloop lock detection, in seconds. - Persist - 1 - Type - F32 - Value - 10.0 - MapOverlayIndex Comment @@ -6055,6 +6105,17 @@ Value 1.3 + RenderGround + + Comment + Determines whether we can render the ground pool or not + Persist + 1 + Type + Boolean + Value + 1 + RenderHUDInSnapshot Comment @@ -10039,7 +10100,7 @@ Type Boolean Value - 0 + 1 WaterEditPresets diff --git a/linden/indra/newview/app_settings/shaders/class1/objects/simpleV.glsl b/linden/indra/newview/app_settings/shaders/class1/objects/simpleV.glsl index 0df89c8..78b96b3 100644 --- a/linden/indra/newview/app_settings/shaders/class1/objects/simpleV.glsl +++ b/linden/indra/newview/app_settings/shaders/class1/objects/simpleV.glsl @@ -11,7 +11,7 @@ void calcAtmospherics(vec3 inPositionEye); void main() { //transform vertex - gl_Position = ftransform(); //gl_ModelViewProjectionMatrix * gl_Vertex; + gl_Position = ftransform(); gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; vec4 pos = (gl_ModelViewMatrix * gl_Vertex); diff --git a/linden/indra/newview/featuretable.txt b/linden/indra/newview/featuretable.txt index b227043..7af05a5 100644 --- a/linden/indra/newview/featuretable.txt +++ b/linden/indra/newview/featuretable.txt @@ -1,4 +1,4 @@ -version 17 +version 18 // NOTE: This is mostly identical to featuretable_mac.txt with a few differences // Should be combined into one table @@ -33,6 +33,7 @@ RenderFlexTimeFactor 1 1.0 RenderFogRatio 1 4.0 RenderGamma 1 0 RenderGlowResolutionPow 1 9 +RenderGround 1 1 RenderLightingDetail 1 1 RenderMaxPartCount 1 8192 RenderNightBrightness 1 1.0 @@ -347,21 +348,7 @@ RenderVBOEnable 0 0 list ATI_All-in-Wonder_7500 RenderVBOEnable 0 0 - -list ATI_Mobility_Radeon_9800 -RenderAvatarCloth 0 0 -VertexShaderEnable 0 0 -WindLightUseAtmosShaders 0 0 - -list ATI_Mobility_Radeon_9700 -RenderAvatarCloth 0 0 -VertexShaderEnable 0 0 -WindLightUseAtmosShaders 0 0 - list ATI_Mobility_Radeon_9600 -RenderAvatarCloth 0 0 -VertexShaderEnable 0 0 -WindLightUseAtmosShaders 0 0 Disregard96DefaultDrawDistance 1 0 diff --git a/linden/indra/newview/featuretable_linux.txt b/linden/indra/newview/featuretable_linux.txt index 3eaa781..0036f11 100644 --- a/linden/indra/newview/featuretable_linux.txt +++ b/linden/indra/newview/featuretable_linux.txt @@ -1,4 +1,4 @@ -version 17 +version 18 // NOTE: This is mostly identical to featuretable_mac.txt with a few differences // Should be combined into one table @@ -33,6 +33,7 @@ RenderFlexTimeFactor 1 1.0 RenderFogRatio 1 4.0 RenderGamma 1 0 RenderGlowResolutionPow 1 9 +RenderGround 1 1 RenderLightingDetail 1 1 RenderMaxPartCount 1 8192 RenderNightBrightness 1 1.0 @@ -343,21 +344,7 @@ RenderVBOEnable 0 0 list ATI_All-in-Wonder_7500 RenderVBOEnable 0 0 - -list ATI_Mobility_Radeon_9800 -RenderAvatarCloth 0 0 -VertexShaderEnable 0 0 -WindLightUseAtmosShaders 0 0 - -list ATI_Mobility_Radeon_9700 -RenderAvatarCloth 0 0 -VertexShaderEnable 0 0 -WindLightUseAtmosShaders 0 0 - list ATI_Mobility_Radeon_9600 -RenderAvatarCloth 0 0 -VertexShaderEnable 0 0 -WindLightUseAtmosShaders 0 0 Disregard96DefaultDrawDistance 1 0 diff --git a/linden/indra/newview/featuretable_mac.txt b/linden/indra/newview/featuretable_mac.txt index fab8ea9..54a7c11 100644 --- a/linden/indra/newview/featuretable_mac.txt +++ b/linden/indra/newview/featuretable_mac.txt @@ -1,4 +1,4 @@ -version 16 +version 18 // NOTE: This is mostly identical to featuretable_mac.txt with a few differences // Should be combined into one table @@ -33,6 +33,7 @@ RenderFlexTimeFactor 1 1.0 RenderFogRatio 1 4.0 RenderGamma 1 0 RenderGlowResolutionPow 1 9 +RenderGround 1 1 RenderLightingDetail 1 1 RenderMaxPartCount 1 8192 RenderNightBrightness 1 1.0 @@ -291,6 +292,7 @@ RenderVBOEnable 1 0 list Intel_950 RenderTerrainDetail 1 0 RenderVBOEnable 1 0 +RenderGround 1 0 list Intel_965 RenderTerrainDetail 1 0 @@ -324,20 +326,7 @@ list Intel_Springdale RenderTerrainDetail 1 0 RenderVBOEnable 1 0 -list ATI_Mobility_Radeon_9800 -RenderAvatarCloth 0 0 -VertexShaderEnable 0 0 -WindLightUseAtmosShaders 0 0 - -list ATI_Mobility_Radeon_9700 -RenderAvatarCloth 0 0 -VertexShaderEnable 0 0 -WindLightUseAtmosShaders 0 0 - list ATI_Mobility_Radeon_9600 -RenderAvatarCloth 0 0 -VertexShaderEnable 0 0 -WindLightUseAtmosShaders 0 0 Disregard96DefaultDrawDistance 1 0 list NVIDIA_GeForce_8600 diff --git a/linden/indra/newview/gpu_table.txt b/linden/indra/newview/gpu_table.txt index 48af543..eee1831 100644 --- a/linden/indra/newview/gpu_table.txt +++ b/linden/indra/newview/gpu_table.txt @@ -26,6 +26,7 @@ ATI All-in-Wonder 7500 .*ATI.*All-in-Wonder 75.* 0 1 ATI All-in-Wonder 8500 .*ATI.*All-in-Wonder 85.* 0 1 ATI All-in-Wonder 9200 .*ATI.*All-in-Wonder 92.* 0 1 ATI All-in-Wonder 9xxx .*ATI.*All-in-Wonder 9.* 1 1 +ATI All-in-Wonder HD .*ATI.*All-in-Wonder HD.* 1 1 ATI All-in-Wonder X600 .*ATI.*All-in-Wonder X6.* 1 1 ATI All-in-Wonder X800 .*ATI.*All-in-Wonder X8.* 2 1 ATI All-in-Wonder X1800 .*ATI.*All-in-Wonder X18.* 3 1 @@ -35,7 +36,9 @@ ATI All-in-Wonder Radeon .*ATI.*All-in-Wonder Radeon.* 0 1 ATI ASUS A9xxx .*ATI.*ASUS.*A9.* 1 1 ATI ASUS AH24xx .*ATI.*ASUS.*AH24.* 1 1 ATI ASUS AH26xx .*ATI.*ASUS.*AH26.* 3 1 +ATI ASUS AH34xx .*ATI.*ASUS.*AH34.* 1 1 ATI ASUS AH36xx .*ATI.*ASUS.*AH36.* 3 1 +ATI ASUS AH46xx .*ATI.*ASUS.*AH46.* 3 1 ATI ASUS AX3xx .*ATI.*ASUS.*AX3.* 1 1 ATI ASUS AX5xx .*ATI.*ASUS.*AX5.* 1 1 ATI ASUS AX8xx .*ATI.*ASUS.*AX8.* 2 1 @@ -51,6 +54,7 @@ ATI Diamond X550 .*ATI.*Diamond X550.* 1 1 ATI Diamond X13xx .*ATI.*Diamond X13.* 1 1 ATI Diamond X16xx .*ATI.*Diamond X16.* 1 1 ATI Diamond X19xx .*ATI.*Diamond X19.* 1 1 +ATI Display Adapter .*ATI.*display adapter.* 0 1 ATI FireGL 5200 .*ATI.*FireGL V52.* 0 1 ATI FireGL 5xxx .*ATI.*FireGL V5.* 1 1 ATI FireGL .*ATI.*Fire.*GL.* 0 1 @@ -61,6 +65,8 @@ ATI IGP 340M .*ATI.*IGP.*340M.* 0 0 ATI M52 .*ATI.*M52.* 1 1 ATI M54 .*ATI.*M54.* 1 1 ATI M56 .*ATI.*M56.* 1 1 +ATI M71 .*ATI.*M71.* 1 1 +ATI M72 .*ATI.*M72.* 1 1 ATI M76 .*ATI.*M76.* 3 1 ATI Mobility Radeon 7xxx .*ATI.*Mobility.*Radeon 7.* 0 1 ATI Mobility Radeon 8xxx .*ATI.*Mobility.*Radeon 8.* 0 1 @@ -84,9 +90,13 @@ ATI Radeon HD 2300 .*ATI.*Radeon HD 23.* 0 1 ATI Radeon HD 2400 .*ATI.*Radeon HD.*24.* 1 1 ATI Radeon HD 2600 .*ATI.*Radeon HD 26.* 2 1 ATI Radeon HD 2900 .*ATI.*Radeon HD 29.* 3 1 +ATI Radeon HD 3200 .*ATI.*Radeon HD.*32.* 1 1 +ATI Radeon HD 3300 .*ATI.*Radeon HD.*33.* 1 1 ATI Radeon HD 3400 .*ATI.*Radeon HD.*34.* 1 1 ATI Radeon HD 3600 .*ATI.*Radeon HD.*36.* 3 1 ATI Radeon HD 3800 .*ATI.*Radeon HD.*38.* 3 1 +ATI Radeon HD 4300 .*ATI.*Radeon HD 43.* 1 1 +ATI Radeon HD 4600 .*ATI.*Radeon HD 46.* 3 1 ATI Radeon HD 4800 .*ATI.*Radeon HD.*48.* 3 1 ATI Radeon OpenGL .*ATI.*Radeon OpenGL.* 0 0 ATI Radeon 2100 .*ATI.*Radeon 21.* 0 1 @@ -104,13 +114,14 @@ ATI Radeon RV250 .*ATI.*RV250.* 0 1 ATI Radeon RV600 .*ATI.*RV6.* 1 1 ATI Radeon RX700 .*ATI.*RX70.* 1 1 ATI Radeon RX800 .*ATI.*Radeon *RX80.* 2 1 +ATI Radeon RX9550 .*ATI.*RX9550.* 1 1 ATI Radeon VE .*ATI.*Radeon.*VE.* 0 0 ATI Radeon X1000 .*ATI.*Radeon *X10.* 0 1 ATI Radeon X1200 .*ATI.*Radeon *X12.* 0 1 ATI Radeon X1300 .*ATI.*Radeon *X13.* 1 1 ATI Radeon X1400 .*ATI.*Radeon X14.* 1 1 ATI Radeon X1500 .*ATI.*Radeon X15.* 1 1 -ATI Radeon X1600 .*ATI.*Radeon X16.* 1 1 +ATI Radeon X1600 .*ATI.*Radeon *X16.* 1 1 ATI Radeon X1700 .*ATI.*Radeon X17.* 1 1 ATI Radeon X1800 .*ATI.*Radeon X18.* 3 1 ATI Radeon X1900 .*ATI.*Radeon X19.* 3 1 @@ -134,8 +145,8 @@ Intel 865G .*Intel.*865G 0 0 Intel 900 .*Intel.*900.*900 0 0 Intel 915GM .*Intel.*915GM 0 0 Intel 915G .*Intel.*915G 0 0 -Intel 945GM .*Intel.*945GM 0 1 -Intel 945G .*Intel.*945G 0 1 +Intel 945GM .*Intel.*945GM.* 0 1 +Intel 945G .*Intel.*945G.* 0 1 Intel 950 .*Intel.*950.* 0 1 Intel 965 .*Intel.*965.* 0 1 Intel G33 .*Intel.*G33.* 0 0 @@ -143,15 +154,20 @@ Intel G45 .*Intel.*G45.* 0 1 Intel Bear Lake .*Intel.*Bear Lake.* 0 0 Intel Broadwater .*Intel.*Broadwater.* 0 0 Intel Brookdale .*Intel.*Brookdale.* 0 0 -Intel Eaglelake .*Intel.*Eaglelake.* 0 1 +Intel Cantiga .*Intel.*Cantiga.* 0 0 +Intel Eaglelake .*Intel.*Eaglelake.* 0 0 Intel Montara .*Intel.*Montara.* 0 0 Intel Springdale .*Intel.*Springdale.* 0 0 Matrox .*Matrox.* 0 0 Mesa .*Mesa.* 0 0 NVIDIA GTX 260 .*NVIDIA.*GeForce.*GTX.*260.* 3 1 NVIDIA GTX 280 .*NVIDIA.*GeForce.*GTX.*280.* 3 1 +NVIDIA C51 .*NVIDIA.*C51.* 0 1 NVIDIA G72 .*NVIDIA.*G72.* 1 1 NVIDIA G73 .*NVIDIA.*G73.* 1 1 +NVIDIA G84 .*NVIDIA.*G84.* 3 1 +NVIDIA G86 .*NVIDIA.*G86.* 3 1 +NVIDIA G92 .*NVIDIA.*G92.* 3 1 NVIDIA GeForce .*GeForce 256.* 0 0 NVIDIA GeForce 2 .*GeForce2.* 0 1 NVIDIA GeForce 3 .*GeForce3.* 0 1 @@ -170,17 +186,24 @@ NVIDIA GeForce 7200 .*NVIDIA.*GeForce 72.* 1 1 NVIDIA GeForce 7300 .*NVIDIA.*GeForce 73.* 1 1 NVIDIA GeForce 7500 .*NVIDIA.*GeForce 75.* 1 1 NVIDIA GeForce 7600 .*NVIDIA.*GeForce 76.* 2 1 -NVIDIA GeForce 7800 .*NVIDIA.*GeForce 78.* 2 1 +NVIDIA GeForce 7800 .*NVIDIA.*GeForce.*78.* 2 1 NVIDIA GeForce 7900 .*NVIDIA.*GeForce 79.* 2 1 +NVIDIA GeForce 8100 .*NVIDIA.*GeForce 81.* 1 1 NVIDIA GeForce 8200 .*NVIDIA.*GeForce 82.* 1 1 NVIDIA GeForce 8300 .*NVIDIA.*GeForce 83.* 1 1 NVIDIA GeForce 8400 .*NVIDIA.*GeForce 84.* 1 1 -NVIDIA GeForce 8500 .*NVIDIA.*GeForce 85.* 3 1 +NVIDIA GeForce 8500 .*GeForce 85.* 3 1 NVIDIA GeForce 8600 .*NVIDIA.*GeForce 86.* 3 1 NVIDIA GeForce 8700 .*NVIDIA.*GeForce 87.* 3 1 NVIDIA GeForce 8800 .*NVIDIA.*GeForce 88.* 3 1 NVIDIA GeForce 9300M .*NVIDIA.*GeForce 9300M.* 1 1 +NVIDIA GeForce 9400M .*NVIDIA.*GeForce 9400M.* 1 1 NVIDIA GeForce 9500M .*NVIDIA.*GeForce 9500M.* 2 1 +NVIDIA GeForce 9600M .*NVIDIA.*GeForce 9600M.* 2 1 +NVIDIA GeForce 9700M .*NVIDIA.*GeForce 9700M.* 2 1 +NVIDIA GeForce 9300 .*NVIDIA.*GeForce 93.* 1 1 +NVIDIA GeForce 9400 .*GeForce 94.* 1 1 +NVIDIA GeForce 9500 .*NVIDIA.*GeForce 95.* 2 1 NVIDIA GeForce 9600 .*NVIDIA.*GeForce 96.* 3 1 NVIDIA GeForce 9800 .*NVIDIA.*GeForce 98.* 3 1 NVIDIA GeForce FX 5100 .*NVIDIA.*GeForce FX 51.* 0 1 @@ -212,11 +235,23 @@ NVIDIA GeForce Go 7600 .*NVIDIA.*GeForce Go 76.* 2 1 NVIDIA GeForce Go 7700 .*NVIDIA.*GeForce Go 77.* 2 1 NVIDIA GeForce Go 7800 .*NVIDIA.*GeForce Go 78.* 2 1 NVIDIA GeForce Go 7900 .*NVIDIA.*GeForce Go 79.* 2 1 +NVIDIA GeForce GTX 260 .*NVIDIA.*GeForce GTX 26.* 3 1 +NVIDIA GeForce GTX 280 .*NVIDIA.*GeForce GTX 28.* 3 1 +NVIDIA D9M .*D9M.* 1 1 +NVIDIA G84 .*G84.* 1 1 +NVIDIA G92 .*G92.* 3 1 +NVIDIA G94 .*G94.* 3 1 NVIDIA GeForce Go 6 .*GeForce Go 6.* 1 1 +NVIDIA NB9M .*GeForce NB9M.* 1 1 +NVIDIA NB9P .*GeForce NB9P.* 1 1 NVIDIA GeForce PCX .*GeForce PCX.* 0 1 NVIDIA Generic .*NVIDIA.*Unknown.* 0 0 +NVIDIA NV17 .*GeForce NV17.* 0 1 NVIDIA NV34 .*NVIDIA.*NV34.* 0 1 +NVIDIA NV36 .*GeForce NV36.* 1 1 NVIDIA NV43 .*NVIDIA.*NV43.* 1 1 +NVIDIA NV44 .*NVIDIA.*NV44.* 1 1 +NVIDIA nForce .*NVIDIA.*nForce.* 0 0 NVIDIA MCP78 .*NVIDIA.*MCP78.* 1 1 NVIDIA Quadro2 .*Quadro2.* 0 1 NVIDIA Quadro4 .*Quadro4.* 0 1 @@ -225,10 +260,12 @@ NVIDIA Quadro FX 4500 .*Quadro.*FX.*4500.* 3 1 NVIDIA Quadro FX .*Quadro FX.* 1 1 NVIDIA Quadro NVS .*Quadro NVS.* 0 1 NVIDIA RIVA TNT .*RIVA TNT.* 0 0 +NVIDIA PCI .*NVIDIA.*/PCI/SSE2 0 0 S3 .*S3 Graphics.* 0 0 SiS SiS.* 0 0 Trident Trident.* 0 0 Tungsten Graphics Tungsten.* 0 0 XGI XGI.* 0 0 VIA VIA.* 0 0 - +Apple Generic Apple.*Generic.* 0 0 +Apple Software Renderer Apple.*Software Renderer.* 0 0 diff --git a/linden/indra/newview/installers/darwin/releasecandidate-dmg/_DS_Store b/linden/indra/newview/installers/darwin/releasecandidate-dmg/_DS_Store index c73ba24..a8b7573 100644 Binary files a/linden/indra/newview/installers/darwin/releasecandidate-dmg/_DS_Store and b/linden/indra/newview/installers/darwin/releasecandidate-dmg/_DS_Store differ diff --git a/linden/indra/newview/installers/windows/FILES_ARE_UNICODE_UTF-16LE.txt b/linden/indra/newview/installers/windows/FILES_ARE_UNICODE_UTF-16LE.txt new file mode 100644 index 0000000..185c018 --- /dev/null +++ b/linden/indra/newview/installers/windows/FILES_ARE_UNICODE_UTF-16LE.txt @@ -0,0 +1,6 @@ +The language files in this directory are Unicode (Little-Endian) format, also known as UTF-16 LE. + +This is the format required for NSIS Unicode. See http://www.scratchpaper.com/ for details. + +James Cook +September 2008 diff --git a/linden/indra/newview/installers/windows/installer_template.nsi b/linden/indra/newview/installers/windows/installer_template.nsi index c795507..01bd98f 100644 --- a/linden/indra/newview/installers/windows/installer_template.nsi +++ b/linden/indra/newview/installers/windows/installer_template.nsi @@ -1,30 +1,22 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; secondlife setup.nsi -;; Copyright 2004-2007, Linden Research, Inc. -;; For info, see http://www.nullsoft.com/free/nsis/ +;; Copyright 2004-2008, Linden Research, Inc. +;; +;; NSIS Unicode 2.38.1 or higher required +;; http://www.scratchpaper.com/ ;; -;; NSIS 2.22 or higher required ;; Author: James Cook, Don Kjer, Callum Prentice ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;; Detect NSIS compiler version -!define "NSIS${NSIS_VERSION}" -!ifdef "NSISv2.02" | "NSISv2.03" | "NSISv2.04" | "NSISv2.05" | "NSISv2.06" - ;; before 2.07 defaulted lzma to solid (whole file) - SetCompressor lzma -!else - ;; after 2.07 required /solid for whole file compression - SetCompressor /solid lzma -!endif - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Compiler flags ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; SetOverwrite on ; overwrite files SetCompress auto ; compress iff saves space +SetCompressor /solid lzma ; compress whole installer as one block SetDatablockOptimize off ; only saves us 0.1%, not worth it XPStyle on ; add an XP manifest to the installer +RequestExecutionLevel admin ; on Vista we must be admin because we write to Program Files ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; Project flags @@ -41,9 +33,22 @@ XPStyle on ; add an XP manifest to the installer !include "%%SOURCE%%\installers\windows\lang_en-us.nsi" !include "%%SOURCE%%\installers\windows\lang_ja.nsi" !include "%%SOURCE%%\installers\windows\lang_ko.nsi" +!include "%%SOURCE%%\installers\windows\lang_pt-br.nsi" +!include "%%SOURCE%%\installers\windows\lang_fr.nsi" +!include "%%SOURCE%%\installers\windows\lang_es.nsi" +!include "%%SOURCE%%\installers\windows\lang_it.nsi" +!include "%%SOURCE%%\installers\windows\lang_nl.nsi" +!include "%%SOURCE%%\installers\windows\lang_zh.nsi" ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Tweak for different servers/builds (this placeholder is replaced by viewer_manifest.py) +;; For example: +;; !define INSTFLAGS "%(flags)s" +;; !define INSTNAME "SecondLife%(grid_caps)s" +;; !define SHORTCUT "Second Life (%(grid_caps)s)" +;; !define URLNAME "secondlife%(grid)s" +;; !define UNINSTALL_SETTINGS 1 + %%GRID_VARS%% Name ${INSTNAME} @@ -63,11 +68,7 @@ AutoCloseWindow true ; after all files install, close window InstallDir "$PROGRAMFILES\${INSTNAME}" InstallDirRegKey HKEY_LOCAL_MACHINE "SOFTWARE\Linden Research, Inc.\${INSTNAME}" "" -!ifdef UPDATE -DirText $(DirectoryChooseTitle) $(DirectoryChooseUpdate) -!else DirText $(DirectoryChooseTitle) $(DirectoryChooseSetup) -!endif ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -76,145 +77,41 @@ DirText $(DirectoryChooseTitle) $(DirectoryChooseSetup) Var INSTPROG Var INSTEXE Var INSTFLAGS -Var LANGFLAGS Var INSTSHORTCUT +Var COMMANDLINE ; command line passed to this installer, set in .onInit -;;; Function definitions should go before file includes, because the NSIS package -;;; is a single stream of bytecodes + file data. So if your function definitions are at -;;; the end of the file it has to decompress the whole thing before it can call a function. JC - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -; PostInstallExe -; This just runs any post installation scripts. -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -Function PostInstallExe -push $0 - ReadRegStr $0 HKEY_LOCAL_MACHINE "SOFTWARE\Linden Research, Inc.\$INSTPROG" "PostInstallExe" - ;MessageBox MB_OK '$0' - ExecWait '$0' -pop $0 -FunctionEnd +;;; Function definitions should go before file includes, because calls to +;;; DLLs like LangDLL trigger an implicit file include, so if that call is at +;;; the end of this script NSIS has to decompress the whole installer before +;;; it can call the DLL function. JC -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -; CheckStartupParameters -; Sets INSTFLAGS, INSTPROG, and INSTEXE. -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -Function CheckStartupParams -push $0 -push $R0 - - ; Look for a registry entry with info about where to update. - Call GetProgramName - pop $R0 - StrCpy $INSTPROG "$R0" - StrCpy $INSTEXE "$R0.exe" - - ReadRegStr $0 HKEY_LOCAL_MACHINE "SOFTWARE\Linden Research, Inc.\$INSTPROG" "" - ; If key doesn't exist, skip install - IfErrors ABORT - StrCpy $INSTDIR "$0" - - ; We now have a directory to install to. Get the startup parameters and shortcut as well. - ReadRegStr $0 HKEY_LOCAL_MACHINE "SOFTWARE\Linden Research, Inc.\$INSTPROG" "Flags" - IfErrors +2 - StrCpy $INSTFLAGS "$0" - ReadRegStr $0 HKEY_LOCAL_MACHINE "SOFTWARE\Linden Research, Inc.\$INSTPROG" "Shortcut" - IfErrors +2 - StrCpy $INSTSHORTCUT "$0" - ReadRegStr $0 HKEY_LOCAL_MACHINE "SOFTWARE\Linden Research, Inc.\$INSTPROG" "Exe" - IfErrors +2 - StrCpy $INSTEXE "$0" - Goto FINISHED - -ABORT: - MessageBox MB_OK $(CheckStartupParamsMB) - Quit - -FINISHED: - ;MessageBox MB_OK "INSTPROG: $INSTPROG, INSTEXE: $INSTEXE, INSTFLAGS: $INSTFLAGS" -pop $R0 -pop $0 -FunctionEnd - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -Function un.CheckStartupParams -push $0 -push $R0 - - ; Look for a registry entry with info about where to update. - Call un.GetProgramName - pop $R0 - StrCpy $INSTPROG "$R0" - StrCpy $INSTEXE "$R0.exe" - - ReadRegStr $0 HKEY_LOCAL_MACHINE "SOFTWARE\Linden Research, Inc.\$INSTPROG" "" - ; If key doesn't exist, skip install - IfErrors ABORT - StrCpy $INSTDIR "$0" - - ; We now have a directory to install to. Get the startup parameters and shortcut as well. - ReadRegStr $0 HKEY_LOCAL_MACHINE "SOFTWARE\Linden Research, Inc.\$INSTPROG" "Flags" - IfErrors +2 - StrCpy $INSTFLAGS "$0" - ReadRegStr $0 HKEY_LOCAL_MACHINE "SOFTWARE\Linden Research, Inc.\$INSTPROG" "Shortcut" - IfErrors +2 - StrCpy $INSTSHORTCUT "$0" - ReadRegStr $0 HKEY_LOCAL_MACHINE "SOFTWARE\Linden Research, Inc.\$INSTPROG" "Exe" - IfErrors +2 - StrCpy $INSTEXE "$0" - Goto FINISHED - -ABORT: - MessageBox MB_OK $(CheckStartupParamsMB) - Quit - -FINISHED: - ;MessageBox MB_OK "INSTPROG: $INSTPROG, INSTEXE: $INSTEXE, INSTFLAGS: $INSTFLAGS" -pop $R0 -pop $0 -FunctionEnd +!include "FileFunc.nsh" ; For GetParameters, GetOptions +!insertmacro GetParameters +!insertmacro GetOptions ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;; After install completes, offer readme file +;;; After install completes, launch app ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Function .onInstSuccess - MessageBox MB_YESNO \ - $(InstSuccesssQuestion) /SD IDYES IDNO NoReadme - ; Assumes SetOutPath $INSTDIR - Exec '"$INSTDIR\$INSTEXE" $INSTFLAGS' - NoReadme: + Push $R0 # Option value, unused + ${GetOptions} $COMMANDLINE "/AUTOSTART" $R0 + # If parameter was there (no error) just launch + # Otherwise ask + IfErrors label_ask_launch label_launch + +label_ask_launch: + # Don't launch by default when silent + IfSilent label_no_launch + MessageBox MB_YESNO $(InstSuccesssQuestion) \ + IDYES label_launch IDNO label_no_launch + +label_launch: + # Assumes SetOutPath $INSTDIR + Exec '"$INSTDIR\$INSTEXE" $INSTFLAGS' +label_no_launch: + Pop $R0 FunctionEnd -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -; Remove old NSIS version. Modifies no variables. -; Does NOT delete the LindenWorld directory, or any -; user files in that directory. -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -Function RemoveNSIS - Push $0 - ; Grab the installation directory of the old version - DetailPrint $(RemoveOldNSISVersion) - ReadRegStr $0 HKEY_LOCAL_MACHINE "SOFTWARE\Linden Research, Inc.\$INSTPROG" "" - - ; If key doesn't exist, skip uninstall - IfErrors NO_NSIS - - ; Clean up legacy beta shortcuts - Delete "$SMPROGRAMS\Second Life Beta.lnk" - Delete "$DESKTOP\Second Life Beta.lnk" - Delete "$SMPROGRAMS\Second Life.lnk" - - ; Clean up old newview.exe file - Delete "$INSTDIR\newview.exe" - - ; Intentionally don't delete the stuff in - ; Documents and Settings, so we keep the user's settings - - NO_NSIS: - Pop $0 -FunctionEnd ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Make sure we're not on Windows 98 / ME @@ -242,28 +139,28 @@ FunctionEnd ; Make sure the user can install/uninstall ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Function CheckIfAdministrator - DetailPrint $(CheckAdministratorInstDP) - UserInfo::GetAccountType - Pop $R0 - StrCmp $R0 "Admin" is_admin - MessageBox MB_OK $(CheckAdministratorInstMB) - Quit -is_admin: - Return + DetailPrint $(CheckAdministratorInstDP) + UserInfo::GetAccountType + Pop $R0 + StrCmp $R0 "Admin" lbl_is_admin + MessageBox MB_OK $(CheckAdministratorInstMB) + Quit +lbl_is_admin: + Return FunctionEnd ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Function un.CheckIfAdministrator - DetailPrint $(CheckAdministratorUnInstDP) - UserInfo::GetAccountType - Pop $R0 - StrCmp $R0 "Admin" is_admin - MessageBox MB_OK $(CheckAdministratorUnInstMB) - Quit -is_admin: - Return + DetailPrint $(CheckAdministratorUnInstDP) + UserInfo::GetAccountType + Pop $R0 + StrCmp $R0 "Admin" lbl_is_admin + MessageBox MB_OK $(CheckAdministratorUnInstMB) + Quit +lbl_is_admin: + Return FunctionEnd ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -310,6 +207,33 @@ Function CloseSecondLife Return FunctionEnd +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Test our connection to secondlife.com +; Also allows us to count attempted installs by examining web logs. +; *TODO: Return current SL version info and have installer check +; if it is up to date. +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +Function CheckNetworkConnection + Push $0 + Push $1 + DetailPrint $(CheckNetworkConnectionDP) + GetTempFileName $0 + !define HTTP_TIMEOUT 5000 ; milliseconds + ; Don't show secondary progress bar, this will be quick. + NSISdl::download_quiet \ + /TIMEOUT=${HTTP_TIMEOUT} \ + "http://join.secondlife.com/installer-check/?v=${VERSION_LONG}" \ + $0 + Pop $1 ; Return value, either "success", "cancel" or an error message + ; MessageBox MB_OK "Download result: $1" + ; Result ignored for now + ; StrCmp $1 "success" +2 + ; DetailPrint "Connection failed: $1" + Delete $0 ; temporary file + Pop $1 + Pop $0 + Return +FunctionEnd ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Delete files in Documents and Settings\\SecondLife\cache @@ -577,7 +501,6 @@ StrCpy $INSTFLAGS "" StrCpy $INSTPROG "${INSTNAME}" StrCpy $INSTEXE "${INSTEXE}" StrCpy $INSTSHORTCUT "${SHORTCUT}" -Call un.CheckStartupParams ; Figure out where, what and how to uninstall. Call un.CheckIfAdministrator ; Make sure the user can install/uninstall ; uninstall for all users (if you change this, change it in the install as well) @@ -586,10 +509,9 @@ SetShellVarContext all ; Make sure we're not running Call un.CloseSecondLife -; Clean up registry keys (these should all be !defines somewhere) +; Clean up registry keys and subkeys (these should all be !defines somewhere) DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\Linden Research, Inc.\$INSTPROG" DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$INSTPROG" -DeleteRegKey HKEY_LOCAL_MACHINE "Software\Linden Research, Inc.\Installer Language" ; Clean up shortcuts Delete "$SMPROGRAMS\$INSTSHORTCUT\*.*" @@ -613,123 +535,6 @@ Call un.ProgramFiles SectionEnd ; end of uninstall section -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -; (From the NSIS wiki, DK) -; GetParameterValue -; -; Usage: -; !insertmacro GetParameterValue "/L=" "1033" -; pop $R0 -; -; Returns on top of stack -; -; Example command lines: -; foo.exe /S /L=1033 /D=C:\Program Files\Foo -; or: -; foo.exe /S "/L=1033" /D="C:\Program Files\Foo" -; gpv "/L=" "1033" -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - - !macro GetParameterValue SWITCH DEFAULT - Push $0 - Push $1 - Push $2 - Push $3 - Push $4 - - ;$CMDLINE='"My Setup\Setup.exe" /L=1033 /S' - Push "$CMDLINE" - Push '${SWITCH}"' - !insertmacro StrStr - Pop $0 - StrCmp "$0" "" gpv_notquoted - ;$0='/L="1033" /S' - StrLen $2 "$0" - Strlen $1 "${SWITCH}" - IntOp $1 $1 + 1 - StrCpy $0 "$0" $2 $1 - ;$0='1033" /S' - Push "$0" - Push '"' - !insertmacro StrStr - Pop $1 - StrLen $2 "$0" - StrLen $3 "$1" - IntOp $4 $2 - $3 - StrCpy $0 $0 $4 0 - Goto gpv_done - - gpv_notquoted: - Push "$CMDLINE" - Push "${SWITCH}" - !insertmacro StrStr - Pop $0 - StrCmp "$0" "" gpv_done - ;$0='/L="1033" /S' - StrLen $2 "$0" - Strlen $1 "${SWITCH}" - StrCpy $0 "$0" $2 $1 - ;$0=1033 /S' - Push "$0" - Push ' ' - !insertmacro StrStr - Pop $1 - StrLen $2 "$0" - StrLen $3 "$1" - IntOp $4 $2 - $3 - StrCpy $0 $0 $4 0 - Goto gpv_done - - gpv_done: - StrCmp "$0" "" 0 +2 - StrCpy $0 "${DEFAULT}" - - Pop $4 - Pop $3 - Pop $2 - Pop $1 - Exch $0 - !macroend - -; And I had to modify StrStr a tiny bit. -; Possible upgrade switch the goto's to use ${__LINE__} - -!macro STRSTR - Exch $R1 ; st=haystack,old$R1, $R1=needle - Exch ; st=old$R1,haystack - Exch $R2 ; st=old$R1,old$R2, $R2=haystack - Push $R3 - Push $R4 - Push $R5 - StrLen $R3 $R1 - StrCpy $R4 0 - ; $R1=needle - ; $R2=haystack - ; $R3=len(needle) - ; $R4=cnt - ; $R5=tmp - ; loop; - StrCpy $R5 $R2 $R3 $R4 - StrCmp $R5 $R1 +4 - StrCmp $R5 "" +3 - IntOp $R4 $R4 + 1 - Goto -4 - ; done; - StrCpy $R1 $R2 "" $R4 - Pop $R5 - Pop $R4 - Pop $R3 - Pop $R2 - Exch $R1 -!macroend - -Function GetProgramName - !insertmacro GetParameterValue "/P=" "SecondLife" -FunctionEnd - -Function un.GetProgramName - !insertmacro GetParameterValue "/P=" "SecondLife" -FunctionEnd ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; (From the NSIS documentation, JC) @@ -827,42 +632,59 @@ FunctionEnd ;; entry to the language ID selector below ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Function .onInit - - ; read the language from registry (ok if not there) and set langauge menu + Push $0 + ${GetParameters} $COMMANDLINE ; get our command line + ${GetOptions} $COMMANDLINE "/LANGID=" $0 ; /LANGID=1033 implies US English + ; If no language (error), then proceed + IfErrors lbl_check_silent + ; No error means we got a language, so use it + StrCpy $LANGUAGE $0 + Goto lbl_return + +lbl_check_silent: + ; For silent installs, no language prompt, use default + IfSilent lbl_return + + ; If we currently have a version of SL installed, default to the language of that install + ; Otherwise don't change $LANGUAGE and it will default to the OS UI language. ReadRegStr $0 HKEY_LOCAL_MACHINE "SOFTWARE\Linden Research, Inc.\${INSTNAME}" "InstallerLanguage" + IfErrors lbl_build_menu StrCpy $LANGUAGE $0 +lbl_build_menu: Push "" - Push ${LANG_ENGLISH} - Push English - Push ${LANG_GERMAN} - Push German - Push ${LANG_JAPANESE} - Push Japanese - Push ${LANG_KOREAN} - Push Korean + # Use separate file so labels can be UTF-16 but we can still merge changes + # into this ASCII file. JC + !include "%%SOURCE%%\installers\windows\language_menu.nsi" + Push A ; A means auto count languages for the auto count to work the first empty push (Push "") must remain - LangDLL::LangDialog "Installer Language" "Please select the language of the installer" - Pop $LANGUAGE - StrCmp $LANGUAGE "cancel" 0 +2 + LangDLL::LangDialog $(InstallerLanguageTitle) $(SelectInstallerLanguage) + Pop $0 + StrCmp $0 "cancel" 0 +2 Abort + StrCpy $LANGUAGE $0 ; save language in registry WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\Linden Research, Inc.\${INSTNAME}" "InstallerLanguage" $LANGUAGE +lbl_return: + Pop $0 + Return FunctionEnd ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Function un.onInit - - ; read language from registry and set for ininstaller + ; read language from registry and set for uninstaller + ; Key will be removed on successful uninstall ReadRegStr $0 HKEY_LOCAL_MACHINE "SOFTWARE\Linden Research, Inc.\${INSTNAME}" "InstallerLanguage" + IfErrors lbl_end StrCpy $LANGUAGE $0 - +lbl_end: + Return FunctionEnd ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;; Sections +;;; MAIN SECTION ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Section "" ; (default section) @@ -874,15 +696,11 @@ StrCpy $INSTPROG "${INSTNAME}" StrCpy $INSTEXE "${INSTEXE}" StrCpy $INSTSHORTCUT "${SHORTCUT}" -IfSilent +2 -Goto NOT_SILENT - Call CheckStartupParams ; Figure out where, what and how to install. -NOT_SILENT: Call CheckWindowsVersion ; warn if on Windows 98/ME Call CheckIfAdministrator ; Make sure the user can install/uninstall Call CheckIfAlreadyCurrent ; Make sure that we haven't already installed this version Call CloseSecondLife ; Make sure we're not running -Call RemoveNSIS ; Check for old NSIS install to remove +Call CheckNetworkConnection ; ping secondlife.com ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; Don't remove cache files during a regular install, removing the inventory cache on upgrades results in lots of damage to the servers. @@ -907,9 +725,6 @@ Call RemoveOldReleaseNotes ;; This placeholder is replaced by the complete list of all the files in the installer, by viewer_manifest.py %%INSTALL_FILES%% -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -; If this is a silent update, we don't need to re-create these shortcuts or registry entries. -IfSilent POST_INSTALL ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Shortcuts in start menu @@ -918,25 +733,18 @@ SetOutPath "$INSTDIR" CreateShortCut "$SMPROGRAMS\$INSTSHORTCUT\$INSTSHORTCUT.lnk" \ "$INSTDIR\$INSTEXE" "$INSTFLAGS" -!ifdef MUSEUM -CreateShortCut "$SMPROGRAMS\$INSTSHORTCUT\$INSTSHORTCUT Museum.lnk" \ - "$INSTDIR\$INSTEXE" "$INSTFLAGS -simple" -CreateShortCut "$SMPROGRAMS\$INSTSHORTCUT\$INSTSHORTCUT Museum Spanish.lnk" \ - - "$INSTDIR\$INSTEXE" "$INSTFLAGS -simple -spanish" -!endif - -WriteINIStr "$SMPROGRAMS\$INSTSHORTCUT\SL Create Trial Account.url" \ +WriteINIStr "$SMPROGRAMS\$INSTSHORTCUT\SL Create Account.url" \ "InternetShortcut" "URL" \ "http://www.secondlife.com/registration/" WriteINIStr "$SMPROGRAMS\$INSTSHORTCUT\SL Your Account.url" \ "InternetShortcut" "URL" \ "http://www.secondlife.com/account/" -CreateShortCut "$SMPROGRAMS\$INSTSHORTCUT\SL Scripting Language Help.lnk" \ - "$INSTDIR\lsl_guide.html" +WriteINIStr "$SMPROGRAMS\$INSTSHORTCUT\SL Scripting Language Help.url" \ + "InternetShortcut" "URL" \ + "http://wiki.secondlife.com/wiki/LSL_Portal" CreateShortCut "$SMPROGRAMS\$INSTSHORTCUT\Uninstall $INSTSHORTCUT.lnk" \ - '"$INSTDIR\uninst.exe"' '/P="$INSTPROG"' + '"$INSTDIR\uninst.exe"' '' ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Other shortcuts @@ -944,18 +752,8 @@ SetOutPath "$INSTDIR" CreateShortCut "$DESKTOP\$INSTSHORTCUT.lnk" "$INSTDIR\$INSTEXE" "$INSTFLAGS" CreateShortCut "$INSTDIR\$INSTSHORTCUT.lnk" "$INSTDIR\$INSTEXE" "$INSTFLAGS" CreateShortCut "$INSTDIR\Uninstall $INSTSHORTCUT.lnk" \ - '"$INSTDIR\uninst.exe"' '/P="$INSTPROG"' - -!ifdef MUSEUM -CreateShortCut "$DESKTOP\$INSTSHORTCUT Museum.lnk" "$INSTDIR\$INSTEXE" "$INSTFLAGS -simple" + '"$INSTDIR\uninst.exe"' '' -CreateShortCut "$DESKTOP\$INSTSHORTCUT Museum Spanish.lnk" "$INSTDIR\$INSTEXE" "$INSTFLAGS -simple -spanish" - -CreateShortCut "$INSTDIR\$INSTSHORTCUT Museum.lnk" "$INSTDIR\$INSTEXE" "$INSTFLAGS -simple" - -CreateShortCut "$INSTDIR\$INSTSHORTCUT Museum Spanish.lnk" "$INSTDIR\$INSTEXE" "$INSTFLAGS -simple -spanish" - -!endif ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Write registry @@ -965,22 +763,17 @@ WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\Linden Research, Inc.\$INSTPROG" "Flags WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\Linden Research, Inc.\$INSTPROG" "Shortcut" "$INSTSHORTCUT" WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\Linden Research, Inc.\$INSTPROG" "Exe" "$INSTEXE" WriteRegStr HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\$INSTPROG" "DisplayName" "$INSTPROG (remove only)" -WriteRegStr HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\$INSTPROG" "UninstallString" '"$INSTDIR\uninst.exe" /P="$INSTPROG"' +WriteRegStr HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\$INSTPROG" "UninstallString" '"$INSTDIR\uninst.exe"' ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Write URL registry info WriteRegStr HKEY_CLASSES_ROOT "${URLNAME}" "(default)" "URL:Second Life" WriteRegStr HKEY_CLASSES_ROOT "${URLNAME}" "URL Protocol" "" WriteRegStr HKEY_CLASSES_ROOT "${URLNAME}\DefaultIcon" "" '"$INSTDIR\$INSTEXE"' +;; URL param must be last item passed to viewer, it ignores subsequent params +;; to avoid parameter injection attacks. WriteRegExpandStr HKEY_CLASSES_ROOT "${URLNAME}\shell\open\command" "" '"$INSTDIR\$INSTEXE" $INSTFLAGS -url "%1"' -Goto WRITE_UNINST - -POST_INSTALL: -; Run a post-executable script if necessary. -Call PostInstallExe - -WRITE_UNINST: ; write out uninstaller WriteUninstaller "$INSTDIR\uninst.exe" diff --git a/linden/indra/newview/installers/windows/lang_de.nsi b/linden/indra/newview/installers/windows/lang_de.nsi index c410128..911ed74 100644 Binary files a/linden/indra/newview/installers/windows/lang_de.nsi and b/linden/indra/newview/installers/windows/lang_de.nsi differ diff --git a/linden/indra/newview/installers/windows/lang_en-us.nsi b/linden/indra/newview/installers/windows/lang_en-us.nsi index 218f1c6..a015413 100644 Binary files a/linden/indra/newview/installers/windows/lang_en-us.nsi and b/linden/indra/newview/installers/windows/lang_en-us.nsi differ diff --git a/linden/indra/newview/installers/windows/lang_es.nsi b/linden/indra/newview/installers/windows/lang_es.nsi new file mode 100644 index 0000000..3340a12 Binary files /dev/null and b/linden/indra/newview/installers/windows/lang_es.nsi differ diff --git a/linden/indra/newview/installers/windows/lang_fr.nsi b/linden/indra/newview/installers/windows/lang_fr.nsi new file mode 100644 index 0000000..5c17ad0 Binary files /dev/null and b/linden/indra/newview/installers/windows/lang_fr.nsi differ diff --git a/linden/indra/newview/installers/windows/lang_it.nsi b/linden/indra/newview/installers/windows/lang_it.nsi new file mode 100644 index 0000000..9f18013 Binary files /dev/null and b/linden/indra/newview/installers/windows/lang_it.nsi differ diff --git a/linden/indra/newview/installers/windows/lang_ja.nsi b/linden/indra/newview/installers/windows/lang_ja.nsi index 5e0496e..f564291 100644 Binary files a/linden/indra/newview/installers/windows/lang_ja.nsi and b/linden/indra/newview/installers/windows/lang_ja.nsi differ diff --git a/linden/indra/newview/installers/windows/lang_ko.nsi b/linden/indra/newview/installers/windows/lang_ko.nsi index b570315..5162b7d 100644 Binary files a/linden/indra/newview/installers/windows/lang_ko.nsi and b/linden/indra/newview/installers/windows/lang_ko.nsi differ diff --git a/linden/indra/newview/installers/windows/lang_nl.nsi b/linden/indra/newview/installers/windows/lang_nl.nsi new file mode 100644 index 0000000..42453ba Binary files /dev/null and b/linden/indra/newview/installers/windows/lang_nl.nsi differ diff --git a/linden/indra/newview/installers/windows/lang_pt-br.nsi b/linden/indra/newview/installers/windows/lang_pt-br.nsi new file mode 100644 index 0000000..6524cc7 Binary files /dev/null and b/linden/indra/newview/installers/windows/lang_pt-br.nsi differ diff --git a/linden/indra/newview/installers/windows/lang_zh.nsi b/linden/indra/newview/installers/windows/lang_zh.nsi new file mode 100644 index 0000000..e644e63 Binary files /dev/null and b/linden/indra/newview/installers/windows/lang_zh.nsi differ diff --git a/linden/indra/newview/installers/windows/language_menu.nsi b/linden/indra/newview/installers/windows/language_menu.nsi new file mode 100644 index 0000000..473f9e0 Binary files /dev/null and b/linden/indra/newview/installers/windows/language_menu.nsi differ diff --git a/linden/indra/newview/llagent.cpp b/linden/indra/newview/llagent.cpp index d268397..2237d67 100644 --- a/linden/indra/newview/llagent.cpp +++ b/linden/indra/newview/llagent.cpp @@ -80,6 +80,7 @@ #include "llfloatertools.h" #include "llfloaterworldmap.h" #include "llgroupmgr.h" +#include "llhomelocationresponder.h" #include "llhudeffectlookat.h" #include "llhudmanager.h" #include "llinventorymodel.h" @@ -90,6 +91,7 @@ #include "llmoveview.h" #include "llnotify.h" #include "llquantize.h" +#include "llsdutil.h" #include "llselectmgr.h" #include "llsky.h" #include "llrendersphere.h" @@ -445,7 +447,7 @@ void LLAgent::init() mCameraFocusOffsetTarget = LLVector4(gSavedSettings.getVector3("CameraOffsetBuild")); mCameraOffsetDefault = gSavedSettings.getVector3("CameraOffsetDefault"); // mCameraOffsetNorm = mCameraOffsetDefault; -// mCameraOffsetNorm.normVec(); +// mCameraOffsetNorm.normalize(); mCameraCollidePlane.clearVec(); mCurrentCameraDistance = mCameraOffsetDefault.magVec(); mTargetCameraDistance = mCurrentCameraDistance; @@ -490,7 +492,7 @@ LLAgent::~LLAgent() //----------------------------------------------------------------------------- // resetView() //----------------------------------------------------------------------------- -void LLAgent::resetView(BOOL reset_camera) +void LLAgent::resetView(BOOL reset_camera, BOOL change_camera) { if (mAutoPilot) { @@ -515,6 +517,30 @@ void LLAgent::resetView(BOOL reset_camera) gMenuHolder->hideMenus(); } + if (change_camera && !gSavedSettings.getBOOL("FreezeTime")) + { + changeCameraToDefault(); + + if (LLViewerJoystick::getInstance()->getOverrideCamera()) + { + handle_toggle_flycam(); + } + + // reset avatar mode from eventual residual motion + if (LLToolMgr::getInstance()->inBuildMode()) + { + LLViewerJoystick::getInstance()->moveAvatar(true); + } + + gFloaterTools->close(); + + gViewerWindow->showCursor(); + + // Switch back to basic toolset + LLToolMgr::getInstance()->setCurrentToolset(gBasicToolset); + } + + if (reset_camera && !gSavedSettings.getBOOL("FreezeTime")) { if (!gViewerWindow->getLeftMouseDown() && cameraThirdPerson()) @@ -522,7 +548,7 @@ void LLAgent::resetView(BOOL reset_camera) // leaving mouse-steer mode LLVector3 agent_at_axis = getAtAxis(); agent_at_axis -= projected_vec(agent_at_axis, getReferenceUpVector()); - agent_at_axis.normVec(); + agent_at_axis.normalize(); gAgent.resetAxes(lerp(getAtAxis(), agent_at_axis, LLCriticalDamp::getInterpolant(0.3f))); } @@ -1033,7 +1059,7 @@ void LLAgent::slamLookAt(const LLVector3 &look_at) { LLVector3 look_at_norm = look_at; look_at_norm.mV[VZ] = 0.f; - look_at_norm.normVec(); + look_at_norm.normalize(); resetAxes(look_at_norm); } @@ -1294,7 +1320,7 @@ LLQuaternion LLAgent::getQuat() const //----------------------------------------------------------------------------- // calcFocusOffset() //----------------------------------------------------------------------------- -LLVector3 LLAgent::calcFocusOffset(LLViewerObject *object, S32 x, S32 y) +LLVector3 LLAgent::calcFocusOffset(LLViewerObject *object, LLVector3 pos_agent, S32 x, S32 y) { // calculate offset based on view direction BOOL is_avatar = object->isAvatar(); @@ -1305,7 +1331,7 @@ LLVector3 LLAgent::calcFocusOffset(LLViewerObject *object, S32 x, S32 y) LLVector3 obj_dir_abs = obj_pos - LLViewerCamera::getInstance()->getOrigin(); obj_dir_abs.rotVec(inv_obj_rot); - obj_dir_abs.normVec(); + obj_dir_abs.normalize(); obj_dir_abs.abs(); LLVector3 object_extents = object->getScale(); @@ -1330,7 +1356,7 @@ LLVector3 LLAgent::calcFocusOffset(LLViewerObject *object, S32 x, S32 y) { normal.setVec(obj_matrix.getUpRow4()); } - normal.normVec(); + normal.normalize(); LLVector3d focus_pt_global; // RN: should we check return value for valid pick? @@ -1397,7 +1423,7 @@ LLVector3 LLAgent::calcFocusOffset(LLViewerObject *object, S32 x, S32 y) if (!is_avatar) { //unproject relative clicked coordinate from window coordinate using GL - GLint viewport[4]; + /*GLint viewport[4]; GLdouble modelview[16]; GLdouble projection[16]; GLfloat winX, winY, winZ; @@ -1419,11 +1445,9 @@ LLVector3 LLAgent::calcFocusOffset(LLViewerObject *object, S32 x, S32 y) winY = ((F32)y) * gViewerWindow->getDisplayScale().mV[VY]; glReadPixels( llfloor(winX), llfloor(winY), 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, &winZ ); - gluUnProject( winX, winY, winZ, modelview, projection, viewport, &posX, &posY, &posZ); + gluUnProject( winX, winY, winZ, modelview, projection, viewport, &posX, &posY, &posZ);*/ - LLVector3 obj_rel((F32)posX, (F32)posY, (F32)posZ); - obj_rel = obj_rel * object->getRenderMatrix(); - obj_rel -= object->getRenderPosition(); + LLVector3 obj_rel = pos_agent - object->getRenderPosition(); LLVector3 obj_center = LLVector3(0, 0, 0) * object->getRenderMatrix(); @@ -1534,7 +1558,7 @@ BOOL LLAgent::calcCameraMinDistance(F32 &obj_min_distance) camera_offset_target_abs_norm.abs(); // make sure offset is non-zero camera_offset_target_abs_norm.clamp(0.001f, F32_MAX); - camera_offset_target_abs_norm.normVec(); + camera_offset_target_abs_norm.normalize(); // find camera position relative to normalized object extents LLVector3 camera_offset_target_scaled = camera_offset_target_abs_norm; @@ -1580,7 +1604,7 @@ BOOL LLAgent::calcCameraMinDistance(F32 &obj_min_distance) LLVector3 object_split_axis; LLVector3 target_offset_scaled = target_offset_origin; target_offset_scaled.abs(); - target_offset_scaled.normVec(); + target_offset_scaled.normalize(); target_offset_scaled.mV[VX] /= object_extents.mV[VX]; target_offset_scaled.mV[VY] /= object_extents.mV[VY]; target_offset_scaled.mV[VZ] /= object_extents.mV[VZ]; @@ -1703,7 +1727,7 @@ void LLAgent::setCameraZoomFraction(F32 fraction) else if (cameraCustomizeAvatar()) { LLVector3d camera_offset_dir = mCameraFocusOffsetTarget; - camera_offset_dir.normVec(); + camera_offset_dir.normalize(); mCameraFocusOffsetTarget = camera_offset_dir * rescale(fraction, 0.f, 1.f, APPEARANCE_MAX_ZOOM, APPEARANCE_MIN_ZOOM); } else @@ -1730,7 +1754,7 @@ void LLAgent::setCameraZoomFraction(F32 fraction) } LLVector3d camera_offset_dir = mCameraFocusOffsetTarget; - camera_offset_dir.normVec(); + camera_offset_dir.normalize(); mCameraFocusOffsetTarget = camera_offset_dir * rescale(fraction, 0.f, 1.f, max_zoom, min_zoom); } startCameraAnimation(); @@ -1777,7 +1801,7 @@ void LLAgent::cameraOrbitOver(const F32 angle) else { LLVector3 camera_offset_unit(mCameraFocusOffsetTarget); - camera_offset_unit.normVec(); + camera_offset_unit.normalize(); F32 angle_from_up = acos( camera_offset_unit * getReferenceUpVector() ); @@ -1812,7 +1836,7 @@ void LLAgent::cameraZoomIn(const F32 fraction) LLVector3d camera_offset(mCameraFocusOffsetTarget); LLVector3d camera_offset_unit(mCameraFocusOffsetTarget); F32 min_zoom = LAND_MIN_ZOOM; - F32 current_distance = (F32)camera_offset_unit.normVec(); + F32 current_distance = (F32)camera_offset_unit.normalize(); F32 new_distance = current_distance * fraction; // Don't move through focus point @@ -1881,7 +1905,7 @@ void LLAgent::cameraOrbitIn(const F32 meters) { LLVector3d camera_offset(mCameraFocusOffsetTarget); LLVector3d camera_offset_unit(mCameraFocusOffsetTarget); - F32 current_distance = (F32)camera_offset_unit.normVec(); + F32 current_distance = (F32)camera_offset_unit.normalize(); F32 new_distance = current_distance - meters; F32 min_zoom = LAND_MIN_ZOOM; @@ -1938,6 +1962,8 @@ void LLAgent::cameraPanIn(F32 meters) mFocusGlobal = mFocusTargetGlobal; // don't enforce zoom constraints as this is the only way for users to get past them easily updateFocusOffset(); + // NOTE: panning movements expect the camera to move exactly with the focus target, not animated behind -Nyx + mCameraSmoothingLastPositionGlobal = calcCameraPositionTargetGlobal(); } //----------------------------------------------------------------------------- @@ -1956,6 +1982,8 @@ void LLAgent::cameraPanLeft(F32 meters) cameraZoomIn(1.f); updateFocusOffset(); + // NOTE: panning movements expect the camera to move exactly with the focus target, not animated behind - Nyx + mCameraSmoothingLastPositionGlobal = calcCameraPositionTargetGlobal(); } //----------------------------------------------------------------------------- @@ -1974,6 +2002,8 @@ void LLAgent::cameraPanUp(F32 meters) cameraZoomIn(1.f); updateFocusOffset(); + // NOTE: panning movements expect the camera to move exactly with the focus target, not animated behind -Nyx + mCameraSmoothingLastPositionGlobal = calcCameraPositionTargetGlobal(); } //----------------------------------------------------------------------------- @@ -2246,7 +2276,7 @@ void LLAgent::startAutoPilotGlobal(const LLVector3d &target_global, const std::s mAutoPilotUseRotation = TRUE; mAutoPilotTargetFacing = LLVector3::x_axis * *target_rotation; mAutoPilotTargetFacing.mV[VZ] = 0.f; - mAutoPilotTargetFacing.normVec(); + mAutoPilotTargetFacing.normalize(); } else { @@ -2369,8 +2399,8 @@ void LLAgent::autoPilot(F32 *delta_yaw) at.mV[VZ] = 0.f; direction.mV[VZ] = 0.f; - at.normVec(); - F32 xy_distance = direction.normVec(); + at.normalize(); + F32 xy_distance = direction.normalize(); F32 yaw = 0.f; if (mAutoPilotTargetDist > mAutoPilotStopDistance) @@ -3529,7 +3559,7 @@ void LLAgent::setupSitCamera() // slam agent coordinate frame to proper parent local version LLVector3 at_axis = mFrameAgent.getAtAxis(); at_axis.mV[VZ] = 0.f; - at_axis.normVec(); + at_axis.normalize(); resetAxes(at_axis * ~parent_rot); } } @@ -3665,7 +3695,7 @@ LLVector3d LLAgent::calcCameraPositionTargetGlobal(BOOL *hit_limit) // slam agent coordinate frame to proper parent local version LLVector3 at_axis = mFrameAgent.getAtAxis() * parent_rot; at_axis.mV[VZ] = 0.f; - at_axis.normVec(); + at_axis.normalize(); resetAxes(at_axis * ~parent_rot); local_camera_offset = local_camera_offset * mFrameAgent.getQuaternion() * parent_rot; @@ -3686,7 +3716,7 @@ LLVector3d LLAgent::calcCameraPositionTargetGlobal(BOOL *hit_limit) offset_dot_norm = 0.001f; } - camera_distance = local_camera_offset.normVec(); + camera_distance = local_camera_offset.normalize(); F32 pos_dot_norm = getPosAgentFromGlobal(frame_center_global + head_offset) * plane_normal; @@ -3710,7 +3740,7 @@ LLVector3d LLAgent::calcCameraPositionTargetGlobal(BOOL *hit_limit) } else { - camera_distance = local_camera_offset.normVec(); + camera_distance = local_camera_offset.normalize(); } mTargetCameraDistance = llmax(camera_distance, MIN_CAMERA_DISTANCE); @@ -3745,7 +3775,7 @@ LLVector3d LLAgent::calcCameraPositionTargetGlobal(BOOL *hit_limit) { LLVector3 frame_at_axis = mFrameAgent.getAtAxis(); frame_at_axis -= projected_vec(frame_at_axis, getReferenceUpVector()); - frame_at_axis.normVec(); + frame_at_axis.normalize(); //transition smoothly in air mode, to avoid camera pop F32 u = (time_in_air - GROUND_TO_AIR_CAMERA_TRANSITION_START_TIME) / GROUND_TO_AIR_CAMERA_TRANSITION_TIME; @@ -3932,7 +3962,7 @@ void LLAgent::resetCamera() // Remove any pitch from the avatar LLVector3 at = mFrameAgent.getAtAxis(); at.mV[VZ] = 0.f; - at.normVec(); + at.normalize(); gAgent.resetAxes(at); // have to explicitly clear field of view zoom now mCameraFOVZoomFactor = 0.f; @@ -4101,7 +4131,10 @@ void LLAgent::changeCameraToThirdPerson(BOOL animate) if (mAvatarObject) { - mAvatarObject->mPelvisp->setPosition(LLVector3::zero); + if (!mAvatarObject->mIsSitting) + { + mAvatarObject->mPelvisp->setPosition(LLVector3::zero); + } mAvatarObject->startMotion( ANIM_AGENT_BODY_NOISE ); mAvatarObject->startMotion( ANIM_AGENT_BREATHE_ROT ); } @@ -4147,14 +4180,14 @@ void LLAgent::changeCameraToThirdPerson(BOOL animate) LLQuaternion obj_rot = ((LLViewerObject*)mAvatarObject->getParent())->getRenderRotation(); at_axis = LLViewerCamera::getInstance()->getAtAxis(); at_axis.mV[VZ] = 0.f; - at_axis.normVec(); + at_axis.normalize(); resetAxes(at_axis * ~obj_rot); } else { at_axis = mFrameAgent.getAtAxis(); at_axis.mV[VZ] = 0.f; - at_axis.normVec(); + at_axis.normalize(); resetAxes(at_axis); } @@ -4201,7 +4234,7 @@ void LLAgent::changeCameraToCustomizeAvatar(BOOL avatar_animate, BOOL camera_ani // Remove any pitch from the avatar //LLVector3 at = mFrameAgent.getAtAxis(); //at.mV[VZ] = 0.f; - //at.normVec(); + //at.normalize(); //gAgent.resetAxes(at); if( mCameraMode != CAMERA_MODE_CUSTOMIZE_AVATAR ) @@ -4228,7 +4261,7 @@ void LLAgent::changeCameraToCustomizeAvatar(BOOL avatar_animate, BOOL camera_ani // Remove any pitch from the avatar LLVector3 at = mFrameAgent.getAtAxis(); at.mV[VZ] = 0.f; - at.normVec(); + at.normalize(); gAgent.resetAxes(at); sendAnimationRequest(ANIM_AGENT_CUSTOMIZE, ANIM_REQUEST_START); @@ -4508,14 +4541,14 @@ void LLAgent::setFocusOnAvatar(BOOL focus_on_avatar, BOOL animate) LLQuaternion obj_rot = ((LLViewerObject*)mAvatarObject->getParent())->getRenderRotation(); at_axis = LLViewerCamera::getInstance()->getAtAxis(); at_axis.mV[VZ] = 0.f; - at_axis.normVec(); + at_axis.normalize(); resetAxes(at_axis * ~obj_rot); } else { at_axis = LLViewerCamera::getInstance()->getAtAxis(); at_axis.mV[VZ] = 0.f; - at_axis.normVec(); + at_axis.normalize(); resetAxes(at_axis); } } @@ -4578,7 +4611,7 @@ void LLAgent::lookAtLastChat() { delta_pos = chatter->getPositionAgent() - getPositionAgent(); } - delta_pos.normVec(); + delta_pos.normalize(); setControlFlags(AGENT_CONTROL_STOP); @@ -4586,9 +4619,9 @@ void LLAgent::lookAtLastChat() LLVector3 new_camera_pos = mAvatarObject->mHeadp->getWorldPosition(); LLVector3 left = delta_pos % LLVector3::z_axis; - left.normVec(); + left.normalize(); LLVector3 up = left % delta_pos; - up.normVec(); + up.normalize(); new_camera_pos -= delta_pos * 0.4f; new_camera_pos += left * 0.3f; new_camera_pos += up * 0.2f; @@ -4607,7 +4640,7 @@ void LLAgent::lookAtLastChat() else { delta_pos = chatter->getRenderPosition() - getPositionAgent(); - delta_pos.normVec(); + delta_pos.normalize(); setControlFlags(AGENT_CONTROL_STOP); @@ -4615,9 +4648,9 @@ void LLAgent::lookAtLastChat() LLVector3 new_camera_pos = mAvatarObject->mHeadp->getWorldPosition(); LLVector3 left = delta_pos % LLVector3::z_axis; - left.normVec(); + left.normalize(); LLVector3 up = left % delta_pos; - up.normVec(); + up.normalize(); new_camera_pos -= delta_pos * 0.4f; new_camera_pos += left * 0.3f; new_camera_pos += up * 0.2f; @@ -4631,68 +4664,107 @@ void LLAgent::lookAtLastChat() const F32 SIT_POINT_EXTENTS = 0.2f; -// Grabs current position -void LLAgent::setStartPosition(U32 location_id) -{ - LLViewerObject *object; - - if ( !(gAgentID == LLUUID::null) ) - { - // we've got an ID for an agent viewerobject - object = gObjectList.findObject(gAgentID); - if (object) - { - // we've got the viewer object - // Sometimes the agent can be velocity interpolated off of - // this simulator. Clamp it to the region the agent is - // in, a little bit in on each side. - const F32 INSET = 0.5f; //meters - const F32 REGION_WIDTH = LLWorld::getInstance()->getRegionWidthInMeters(); - - LLVector3 agent_pos = getPositionAgent(); - - if (mAvatarObject) - { - // the z height is at the agent's feet - agent_pos.mV[VZ] -= 0.5f * mAvatarObject->mBodySize.mV[VZ]; - } - - agent_pos.mV[VX] = llclamp( agent_pos.mV[VX], INSET, REGION_WIDTH - INSET ); - agent_pos.mV[VY] = llclamp( agent_pos.mV[VY], INSET, REGION_WIDTH - INSET ); - - // Don't let them go below ground, or too high. - agent_pos.mV[VZ] = llclamp( agent_pos.mV[VZ], - mRegionp->getLandHeightRegion( agent_pos ), - LLWorld::getInstance()->getRegionMaxHeight() ); - - LLMessageSystem* msg = gMessageSystem; - msg->newMessageFast(_PREHASH_SetStartLocationRequest); - msg->nextBlockFast( _PREHASH_AgentData); - msg->addUUIDFast(_PREHASH_AgentID, getID()); - msg->addUUIDFast(_PREHASH_SessionID, getSessionID()); - msg->nextBlockFast( _PREHASH_StartLocationData); - // corrected by sim - msg->addStringFast(_PREHASH_SimName, ""); - msg->addU32Fast(_PREHASH_LocationID, location_id); - msg->addVector3Fast(_PREHASH_LocationPos, agent_pos); - msg->addVector3Fast(_PREHASH_LocationLookAt,mFrameAgent.getAtAxis()); - - // Reliable only helps when setting home location. Last - // location is sent on quit, and we don't have time to ack - // the packets. - msg->sendReliable(mRegionp->getHost()); - - const U32 HOME_INDEX = 1; - if( HOME_INDEX == location_id ) - { - setHomePosRegion( mRegionp->getHandle(), getPositionAgent() ); - } - } - else - { - llinfos << "setStartPosition - Can't find agent viewerobject id " << gAgentID << llendl; - } - } +void LLAgent::setStartPosition( U32 location_id ) +{ + LLViewerObject *object; + + if ( !(gAgentID == LLUUID::null) ) + { + // we've got an ID for an agent viewerobject + object = gObjectList.findObject(gAgentID); + if (object) + { + // we've got the viewer object + // Sometimes the agent can be velocity interpolated off of + // this simulator. Clamp it to the region the agent is + // in, a little bit in on each side. + const F32 INSET = 0.5f; //meters + const F32 REGION_WIDTH = LLWorld::getInstance()->getRegionWidthInMeters(); + + LLVector3 agent_pos = getPositionAgent(); + LLVector3 agent_look_at = mFrameAgent.getAtAxis(); + + if (mAvatarObject) + { + // the z height is at the agent's feet + agent_pos.mV[VZ] -= 0.5f * mAvatarObject->mBodySize.mV[VZ]; + } + + agent_pos.mV[VX] = llclamp( agent_pos.mV[VX], INSET, REGION_WIDTH - INSET ); + agent_pos.mV[VY] = llclamp( agent_pos.mV[VY], INSET, REGION_WIDTH - INSET ); + + // Don't let them go below ground, or too high. + agent_pos.mV[VZ] = llclamp( agent_pos.mV[VZ], + mRegionp->getLandHeightRegion( agent_pos ), + LLWorld::getInstance()->getRegionMaxHeight() ); + // Send the CapReq + + LLSD body; + + std::string url = gAgent.getRegion()->getCapability("HomeLocation"); + std::ostringstream strBuffer; + if( url.empty() ) + { + LLMessageSystem* msg = gMessageSystem; + msg->newMessageFast(_PREHASH_SetStartLocationRequest); + msg->nextBlockFast( _PREHASH_AgentData); + msg->addUUIDFast(_PREHASH_AgentID, getID()); + msg->addUUIDFast(_PREHASH_SessionID, getSessionID()); + msg->nextBlockFast( _PREHASH_StartLocationData); + // corrected by sim + msg->addStringFast(_PREHASH_SimName, ""); + msg->addU32Fast(_PREHASH_LocationID, location_id); + msg->addVector3Fast(_PREHASH_LocationPos, agent_pos); + msg->addVector3Fast(_PREHASH_LocationLookAt,mFrameAgent.getAtAxis()); + + // Reliable only helps when setting home location. Last + // location is sent on quit, and we don't have time to ack + // the packets. + msg->sendReliable(mRegionp->getHost()); + + const U32 HOME_INDEX = 1; + if( HOME_INDEX == location_id ) + { + setHomePosRegion( mRegionp->getHandle(), getPositionAgent() ); + } + } + else + { + strBuffer << location_id; + body["HomeLocation"]["LocationId"] = strBuffer.str(); + + strBuffer.str(""); + strBuffer << agent_pos.mV[VX]; + body["HomeLocation"]["LocationPos"]["X"] = strBuffer.str(); + + strBuffer.str(""); + strBuffer << agent_pos.mV[VY]; + body["HomeLocation"]["LocationPos"]["Y"] = strBuffer.str(); + + strBuffer.str(""); + strBuffer << agent_pos.mV[VZ]; + body["HomeLocation"]["LocationPos"]["Z"] = strBuffer.str(); + + strBuffer.str(""); + strBuffer << agent_look_at.mV[VX]; + body["HomeLocation"]["LocationLookAt"]["X"] = strBuffer.str(); + + strBuffer.str(""); + strBuffer << agent_look_at.mV[VY]; + body["HomeLocation"]["LocationLookAt"]["Y"] = strBuffer.str(); + + strBuffer.str(""); + strBuffer << agent_look_at.mV[VZ]; + body["HomeLocation"]["LocationLookAt"]["Z"] = strBuffer.str(); + + LLHTTPClient::post( url, body, new LLHomeLocationResponder() ); + } + } + else + { + llinfos << "setStartPosition - Can't find agent viewerobject id " << gAgentID << llendl; + } + } } void LLAgent::requestStopMotion( LLMotion* motion ) diff --git a/linden/indra/newview/llagent.h b/linden/indra/newview/llagent.h index 97f9aed..2befeb0 100644 --- a/linden/indra/newview/llagent.h +++ b/linden/indra/newview/llagent.h @@ -139,7 +139,7 @@ public: // Called whenever the agent moves. Puts camera back in default position, // deselects items, etc. - void resetView(BOOL reset_camera = TRUE); + void resetView(BOOL reset_camera = TRUE, BOOL change_camera = FALSE); // Called on camera movement, to allow the camera to be unlocked from the // default position behind the avatar. @@ -378,7 +378,7 @@ public: void sendAnimationRequests(LLDynamicArray &anim_ids, EAnimRequest request); void sendAnimationRequest(const LLUUID &anim_id, EAnimRequest request); - LLVector3 calcFocusOffset(LLViewerObject *object, S32 x, S32 y); + LLVector3 calcFocusOffset(LLViewerObject *object, LLVector3 pos_agent, S32 x, S32 y); BOOL calcCameraMinDistance(F32 &obj_min_distance); void startCameraAnimation(); diff --git a/linden/indra/newview/llappviewer.cpp b/linden/indra/newview/llappviewer.cpp index f1b2e32..49991b4 100644 --- a/linden/indra/newview/llappviewer.cpp +++ b/linden/indra/newview/llappviewer.cpp @@ -191,18 +191,11 @@ //---------------------------------------------------------------------------- // viewer.cpp - these are only used in viewer, should be easily moved. -extern void disable_win_error_reporting(); #if LL_DARWIN -#include extern void init_apple_menu(const char* product); -extern OSErr AEGURLHandler(const AppleEvent *messagein, AppleEvent *reply, long refIn); -extern OSErr AEQuitHandler(const AppleEvent *messagein, AppleEvent *reply, long refIn); -extern OSStatus simpleDialogHandler(EventHandlerCallRef handler, EventRef event, void *userdata); -#include #endif // LL_DARWIN - extern BOOL gRandomizeFramerate; extern BOOL gPeriodicSlowFrame; extern BOOL gDebugGL; @@ -216,10 +209,6 @@ const F32 DEFAULT_AFK_TIMEOUT = 5.f * 60.f; // time with no input before user fl F32 gSimLastTime; // Used in LLAppViewer::init and send_stats() F32 gSimFrames; -std::string gDisabledMessage; // Set in LLAppViewer::initConfiguration used in idle_startup - -BOOL gHideLinks = FALSE; // Set in LLAppViewer::initConfiguration, used externally - BOOL gAllowIdleAFK = TRUE; BOOL gAllowTapTapHoldRun = TRUE; BOOL gShowObjectUpdates = FALSE; @@ -307,14 +296,13 @@ const char *VFS_INDEX_FILE_BASE = "index.db2.x."; static std::string gSecondLife; static std::string gWindowTitle; -#ifdef LL_WINDOWS - static char sWindowClass[] = "Second Life"; -#endif std::string gLoginPage; std::vector gLoginURIs; static std::string gHelperURI; +LLAppViewer::LLUpdaterInfo *LLAppViewer::sUpdaterInfo = NULL ; + void idle_afk_check() { // check idle timers @@ -329,8 +317,7 @@ static void ui_audio_callback(const LLUUID& uuid) { if (gAudiop) { - F32 volume = gSavedSettings.getBOOL("MuteUI") ? 0.f : gSavedSettings.getF32("AudioLevelUI"); - gAudiop->triggerSound(uuid, gAgent.getID(), volume); + gAudiop->triggerSound(uuid, gAgent.getID(), 1.0f, LLAudioEngine::AUDIO_TYPE_UI); } } @@ -496,30 +483,17 @@ void LLAppViewer::initGridChoice() } } -bool send_url_to_other_instance(const std::string& url) +//virtual +bool LLAppViewer::initSLURLHandler() { -#if LL_WINDOWS - wchar_t window_class[256]; /* Flawfinder: ignore */ // Assume max length < 255 chars. - mbstowcs(window_class, sWindowClass, 255); - window_class[255] = 0; - // Use the class instead of the window name. - HWND other_window = FindWindow(window_class, NULL); - - if (other_window != NULL) - { - lldebugs << "Found other window with the name '" << gWindowTitle << "'" << llendl; - COPYDATASTRUCT cds; - const S32 SLURL_MESSAGE_TYPE = 0; - cds.dwData = SLURL_MESSAGE_TYPE; - cds.cbData = url.length() + 1; - cds.lpData = (void*)url.c_str(); - - LRESULT msg_result = SendMessage(other_window, WM_COPYDATA, NULL, (LPARAM)&cds); - lldebugs << "SendMessage(WM_COPYDATA) to other window '" - << gWindowTitle << "' returned " << msg_result << llendl; - return true; - } -#endif + // does nothing unless subclassed + return false; +} + +//virtual +bool LLAppViewer::sendURLToOtherInstance(const std::string& url) +{ + // does nothing unless subclassed return false; } @@ -683,6 +657,7 @@ bool LLAppViewer::init() ui_audio_callback, &LLUI::sGLScaleFactor); LLWeb::initClass(); // do this after LLUI + LLTextEditor::setURLCallbacks(&LLWeb::loadURL, &LLURLDispatcher::dispatchFromTextEditor, &LLURLDispatcher::dispatchFromTextEditor); @@ -703,7 +678,6 @@ bool LLAppViewer::init() // load MIME type -> media impl mappings LLMIMETypes::parseMIMETypes( std::string("mime_types.xml") ); - // Copy settings to globals. *TODO: Remove or move to appropriage class initializers settings_to_globals(); // Setup settings listeners @@ -714,6 +688,9 @@ bool LLAppViewer::init() // Find partition serial number (Windows) or hardware serial (Mac) mSerialNumber = generateSerialNumber(); + // do any necessary set-up for accepting incoming SLURLs from apps + initSLURLHandler(); + if(false == initHardwareTest()) { // Early out from user choice. @@ -844,7 +821,10 @@ bool LLAppViewer::init() } } - + + // save the graphics card + gDebugInfo["GraphicsCard"] = LLFeatureManager::getInstance()->getGPUString(); + // Save the current version to the prefs file gSavedSettings.setString("LastRunVersion", gCurrentVersion); @@ -889,16 +869,21 @@ bool LLAppViewer::mainLoop() { LLFastTimer t(LLFastTimer::FTM_FRAME); + pingMainloopTimeout("Main:MiscNativeWindowEvents"); + + { + LLFastTimer t2(LLFastTimer::FTM_MESSAGES); + gViewerWindow->mWindow->processMiscNativeEvents(); + } + pingMainloopTimeout("Main:GatherInput"); { LLFastTimer t2(LLFastTimer::FTM_MESSAGES); - #if LL_WINDOWS - if (!LLWinDebug::checkExceptionHandler()) + if (!restoreErrorTrap()) { - llwarns << " Someone took over my exception handler (post messagehandling)!" << llendl; + llwarns << " Someone took over my signal/exception handler (post messagehandling)!" << llendl; } - #endif gViewerWindow->mWindow->gatherInput(); } @@ -954,7 +939,7 @@ bool LLAppViewer::mainLoop() resumeMainloopTimeout(); } - + if (gDoDisconnect && (LLStartUp::getStartupState() == STATE_STARTED)) { pauseMainloopTimeout(); @@ -1365,12 +1350,15 @@ bool LLAppViewer::cleanup() delete sImageDecodeThread; sImageDecodeThread = NULL; + //Note: + //LLViewerMedia::cleanupClass() has to be put before gImageList.shutdown() + //because some new image might be generated during cleaning up media. --bao + LLViewerMedia::cleanupClass(); gImageList.shutdown(); // shutdown again in case a callback added something LLUIImageList::getInstance()->cleanUp(); // This should eventually be done in LLAppViewer - LLImageJ2C::closeDSO(); - LLImageFormatted::cleanupClass(); + LLImage::cleanupClass(); LLVFSThread::cleanupClass(); LLLFSThread::cleanupClass(); @@ -1409,8 +1397,6 @@ bool LLAppViewer::cleanup() LLWeb::loadURLExternal( gLaunchFileOnQuit ); } - - LLViewerMedia::cleanupClass(); llinfos << "Goodbye" << llendflush; @@ -1440,8 +1426,7 @@ bool LLAppViewer::initThreads() LLAppViewer::sImageDecodeThread = new LLWorkerThread("ImageDecode", enable_threads && true); LLAppViewer::sTextureCache = new LLTextureCache(enable_threads && true); LLAppViewer::sTextureFetch = new LLTextureFetch(LLAppViewer::getTextureCache(), enable_threads && false); - LLImageWorker::initClass(LLAppViewer::getImageDecodeThread()); - LLImageJ2C::openDSO(); + LLImage::initClass(LLAppViewer::getImageDecodeThread()); // *FIX: no error handling here! return true; @@ -1878,22 +1863,6 @@ bool LLAppViewer::initConfiguration() // llerrs << "Failed to parse skin definition." << llendl; // } - // LLXmlTreeNode* rootp = skin_def_tree.getRoot(); - // LLXmlTreeNode* disabled_message_node = rootp->getChildByName("disabled_message"); - // if (disabled_message_node) - // { - // gDisabledMessage = disabled_message_node->getContents(); - // } - - // static LLStdStringHandle hide_links_string = LLXmlTree::addAttributeString("hide_links"); - // rootp->getFastAttributeBOOL(hide_links_string, gHideLinks); - - // // Legacy string. This flag really meant we didn't want to expose references to "Second Life". - // // Just set gHideLinks instead. - // static LLStdStringHandle silent_string = LLXmlTree::addAttributeString("silent_update"); - // BOOL silent_update; - // rootp->getFastAttributeBOOL(silent_string, silent_update); - // gHideLinks = (gHideLinks || silent_update); //} #if LL_DARWIN @@ -1946,7 +1915,7 @@ bool LLAppViewer::initConfiguration() #endif LLStringUtil::truncate(gWindowTitle, 255); - //RN: if we received a URL, hand it off to the existing instance + //RN: if we received a URL, hand it off to the existing instance. // don't call anotherInstanceRunning() when doing URL handoff, as // it relies on checking a marker file which will not work when running // out of different directories @@ -1961,7 +1930,7 @@ bool LLAppViewer::initConfiguration() } if (!slurl.empty()) { - if (send_url_to_other_instance(slurl)) + if (sendURLToOtherInstance(slurl)) { // successfully handed off URL to existing instance, exit return false; @@ -1992,7 +1961,7 @@ bool LLAppViewer::initConfiguration() } initMarkerFile(); - + #if LL_SEND_CRASH_REPORTS if (gLastExecEvent == LAST_EXEC_FROZE) { @@ -2014,52 +1983,8 @@ bool LLAppViewer::initConfiguration() { llinfos << "Sending crash report." << llendl; -#if LL_WINDOWS - std::string exe_path = gDirUtilp->getAppRODataDir(); - exe_path += gDirUtilp->getDirDelimiter(); - exe_path += "win_crash_logger.exe"; - - std::string arg_string = "-previous "; - // Spawn crash logger. - // NEEDS to wait until completion, otherwise log files will get smashed. - _spawnl(_P_WAIT, exe_path.c_str(), exe_path.c_str(), arg_string.c_str(), NULL); -#elif LL_DARWIN - std::string command_str; - command_str = "mac-crash-logger.app/Contents/MacOS/mac-crash-logger "; - command_str += "-previous"; - // XXX -- We need to exit fullscreen mode for this to work. - // XXX -- system() also doesn't wait for completion. Hmm... - system(command_str.c_str()); /* Flawfinder: Ignore */ -#elif LL_LINUX || LL_SOLARIS - std::string cmd =gDirUtilp->getAppRODataDir(); - cmd += gDirUtilp->getDirDelimiter(); -#if LL_LINUX - cmd += "linux-crash-logger.bin"; -#else // LL_SOLARIS - cmd += "bin/solaris-crash-logger"; -#endif // LL_LINUX - char* const cmdargv[] = - {(char*)cmd.c_str(), - (char*)"-previous", - NULL}; - fflush(NULL); // flush all buffers before the child inherits them - pid_t pid = fork(); - if (pid == 0) - { // child - execv(cmd.c_str(), cmdargv); /* Flawfinder: Ignore */ - llwarns << "execv failure when trying to start " << cmd << llendl; - _exit(1); // avoid atexit() - } else { - if (pid > 0) - { - // wait for child proc to die - int childExitStatus; - waitpid(pid, &childExitStatus, 0); - } else { - llwarns << "fork failure." << llendl; - } - } -#endif + bool report_freeze = true; + handleCrashReporting(report_freeze); } else { @@ -2262,7 +2187,7 @@ void LLAppViewer::writeSystemInfo() gDebugInfo["RAMInfo"]["Physical"] = (LLSD::Integer)(gSysMemory.getPhysicalMemoryKB()); gDebugInfo["RAMInfo"]["Allocated"] = (LLSD::Integer)(gMemoryAllocated>>10); // MB -> KB gDebugInfo["OSInfo"] = getOSInfo().getOSStringSimple(); - + // The user is not logged on yet, but record the current grid choice login url // which may have been the intended grid. This can b gDebugInfo["GridName"] = LLViewerLogin::getInstance()->getGridLabel(); @@ -2273,6 +2198,13 @@ void LLAppViewer::writeSystemInfo() gDebugInfo["MainloopThreadID"] = (S32)thread_id; #endif + // "CrashNotHandled" is set here, while things are running well, + // in case of a freeze. If there is a freeze, the crash logger will be launched + // and can read this value from the debug_info.log. + // If the crash is handled by LLAppViewer::handleViewerCrash, ie not a freeze, + // then the value of "CrashNotHandled" will be set to true. + gDebugInfo["CrashNotHandled"] = (LLSD::Boolean)true; + // Dump some debugging info LL_INFOS("SystemInfo") << gSecondLife << " version " << LL_VERSION_MAJOR << "." << LL_VERSION_MINOR << "." << LL_VERSION_PATCH @@ -2347,6 +2279,8 @@ void LLAppViewer::handleViewerCrash() gDebugInfo["CAFilename"] = gDirUtilp->getCAFile(); gDebugInfo["ViewerExePath"] = gDirUtilp->getExecutablePathAndName(); gDebugInfo["CurrentPath"] = gDirUtilp->getCurPath(); + gDebugInfo["SessionLength"] = F32(LLFrameTimer::getElapsedSeconds()); + if(gLogoutInProgress) { gDebugInfo["LastExecEvent"] = LAST_EXEC_LOGOUT_CRASH; @@ -2372,6 +2306,9 @@ void LLAppViewer::handleViewerCrash() gDebugInfo["MainloopTimeoutState"] = LLAppViewer::instance()->mMainloopTimeout->getState(); } + // The crash is being handled here so set this value to false. + // Otherwise the crash logger will think this crash was a freeze. + gDebugInfo["CrashNotHandled"] = (LLSD::Boolean)false; //Write out the crash status file //Use marker file style setup, as that's the simplest, especially since @@ -2455,24 +2392,23 @@ bool LLAppViewer::anotherInstanceRunning() { // Another instance is running. Skip the rest of these operations. LL_INFOS("MarkerFile") << "Marker file is locked." << LL_ENDL; - return TRUE; + return true; } if (apr_file_lock(fMarker, APR_FLOCK_NONBLOCK | APR_FLOCK_EXCLUSIVE) != APR_SUCCESS) //flock(fileno(fMarker), LOCK_EX | LOCK_NB) == -1) { apr_file_close(fMarker); LL_INFOS("MarkerFile") << "Marker file is locked." << LL_ENDL; - return TRUE; + return true; } // No other instances; we'll lock this file now & delete on quit. apr_file_close(fMarker); } LL_DEBUGS("MarkerFile") << "Marker file isn't locked." << LL_ENDL; - return FALSE; + return false; } void LLAppViewer::initMarkerFile() { - //First, check for the existence of other files. //There are marker files for two different types of crashes @@ -2727,7 +2663,7 @@ bool LLAppViewer::initCache() // Init the texture cache // Allocate 80% of the cache size for textures - BOOL read_only = mSecondInstance ? true : false; + BOOL read_only = mSecondInstance ? TRUE : FALSE; const S32 MB = 1024*1024; S64 cache_size = (S64)(gSavedSettings.getU32("CacheSize")) * MB; const S64 MAX_CACHE_SIZE = 1024*MB; @@ -3796,6 +3732,11 @@ void LLAppViewer::pauseMainloopTimeout() void LLAppViewer::pingMainloopTimeout(const std::string& state, F32 secs) { +// if(!restoreErrorTrap()) +// { +// llwarns << "!!!!!!!!!!!!! Its an error trap!!!!" << state << llendl; +// } + if(mMainloopTimeout) { if(secs < 0.0f) @@ -3808,3 +3749,42 @@ void LLAppViewer::pingMainloopTimeout(const std::string& state, F32 secs) } } +void LLAppViewer::handleLoginComplete() +{ + initMainloopTimeout("Mainloop Init"); + + // Store some data to DebugInfo in case of a freeze. + gDebugInfo["ClientInfo"]["Name"] = gSavedSettings.getString("VersionChannelName"); + + gDebugInfo["ClientInfo"]["MajorVersion"] = LL_VERSION_MAJOR; + gDebugInfo["ClientInfo"]["MinorVersion"] = LL_VERSION_MINOR; + gDebugInfo["ClientInfo"]["PatchVersion"] = LL_VERSION_PATCH; + gDebugInfo["ClientInfo"]["BuildVersion"] = LL_VERSION_BUILD; + + LLParcel* parcel = LLViewerParcelMgr::getInstance()->getAgentParcel(); + if ( parcel && parcel->getMusicURL()[0]) + { + gDebugInfo["ParcelMusicURL"] = parcel->getMusicURL(); + } + if ( parcel && parcel->getMediaURL()[0]) + { + gDebugInfo["ParcelMediaURL"] = parcel->getMediaURL(); + } + + gDebugInfo["SettingsFilename"] = gSavedSettings.getString("ClientSettingsFile"); + gDebugInfo["CAFilename"] = gDirUtilp->getCAFile(); + gDebugInfo["ViewerExePath"] = gDirUtilp->getExecutablePathAndName(); + gDebugInfo["CurrentPath"] = gDirUtilp->getCurPath(); + + if(gAgent.getRegion()) + { + gDebugInfo["CurrentSimHost"] = gAgent.getRegionHost().getHostName(); + gDebugInfo["CurrentRegion"] = gAgent.getRegion()->getName(); + } + + if(LLAppViewer::instance()->mMainloopTimeout) + { + gDebugInfo["MainloopTimeoutState"] = LLAppViewer::instance()->mMainloopTimeout->getState(); + } + writeDebugInfo(); +} diff --git a/linden/indra/newview/llappviewer.h b/linden/indra/newview/llappviewer.h index 801deb1..6545a61 100644 --- a/linden/indra/newview/llappviewer.h +++ b/linden/indra/newview/llappviewer.h @@ -77,7 +77,9 @@ public: // Report true if under the control of a debugger. A null-op default. virtual bool beingDebugged() { return false; } - virtual void handleCrashReporting() = 0; // What to do with crash report? + virtual bool restoreErrorTrap() = 0; // Require platform specific override to reset error handling mechanism. + // return false if the error trap needed restoration. + virtual void handleCrashReporting(bool reportFreeze = false) = 0; // What to do with crash report? virtual void handleSyncCrashTrace() = 0; // any low-level crash-prep that has to happen in the context of the crashing thread before the crash report is delivered. static void handleViewerCrash(); // Hey! The viewer crashed. Do this, soon. static void handleSyncViewerCrash(); // Hey! The viewer crashed. Do this right NOW in the context of the crashing thread. @@ -136,15 +138,21 @@ public: void resumeMainloopTimeout(const std::string& state = "", F32 secs = -1.0f); void pingMainloopTimeout(const std::string& state, F32 secs = -1.0f); + // Handle the 'login completed' event. + // *NOTE:Mani Fix this for login abstraction!! + void handleLoginComplete(); + protected: virtual bool initWindow(); // Initialize the viewer's window. virtual bool initLogging(); // Initialize log files, logging system, return false on failure. virtual void initConsole() {}; // Initialize OS level debugging console. virtual bool initHardwareTest() { return true; } // A false result indicates the app should quit. + virtual bool initSLURLHandler(); + virtual bool sendURLToOtherInstance(const std::string& url); - virtual bool initParseCommandLine(LLCommandLineParser& clp) + virtual bool initParseCommandLine(LLCommandLineParser& clp) { return true; } // Allow platforms to specify the command line args. - + virtual std::string generateSerialNumber() = 0; // Platforms specific classes generate this. @@ -211,6 +219,15 @@ private: // for tracking viewer<->region circuit death bool mAgentRegionLastAlive; LLUUID mAgentRegionLastID; + +public: + //some information for updater + typedef struct + { + std::string mUpdateExePath; + std::ostringstream mParams; + }LLUpdaterInfo ; + static LLUpdaterInfo *sUpdaterInfo ; }; // consts from viewer.h @@ -222,8 +239,6 @@ const S32 AGENT_UPDATES_PER_SECOND = 10; // "// llstartup" indicates that llstartup is the only client for this global. extern BOOL gHandleKeysAsync; // gSavedSettings used by llviewerdisplay.cpp & llviewermenu.cpp -extern std::string gDisabledMessage; // llstartup -extern BOOL gHideLinks; // used by llpanellogin, lllfloaterbuycurrency, llstartup extern LLSD gDebugInfo; extern BOOL gAllowIdleAFK; diff --git a/linden/indra/newview/llappviewerlinux.cpp b/linden/indra/newview/llappviewerlinux.cpp index 0a4a9cf..643013b 100644 --- a/linden/indra/newview/llappviewerlinux.cpp +++ b/linden/indra/newview/llappviewerlinux.cpp @@ -1,6 +1,6 @@ /** * @file llappviewerlinux.cpp - * @brief The LLAppViewerWin32 class definitions + * @brief The LLAppViewerLinux class definitions * * $LicenseInfo:firstyear=2007&license=viewergpl$ * @@ -36,8 +36,10 @@ #include "llcommandlineparser.h" #include "llmemtype.h" +#include "llurldispatcher.h" // SLURL from other app instance #include "llviewernetwork.h" #include "llviewercontrol.h" +#include "llwindowsdl.h" #include "llmd5.h" #include "llfindlocale.h" @@ -60,6 +62,17 @@ # include "ELFIO/ELFIO.h" // for better backtraces #endif +#if LL_DBUS_ENABLED +# include "llappviewerlinux_api_dbus.h" + +// regrettable hacks to give us better runtime compatibility with older systems inside llappviewerlinux_api.h: +#define llg_return_if_fail(COND) do{if (!(COND)) return;}while(0) +#undef g_return_if_fail +#define g_return_if_fail(COND) llg_return_if_fail(COND) +// The generated API +# include "llappviewerlinux_api.h" +#endif + namespace { int gArgC = 0; @@ -321,6 +334,193 @@ bool LLAppViewerLinux::init() return LLAppViewer::init(); } +bool LLAppViewerLinux::restoreErrorTrap() +{ + // *NOTE:Mani there is a case for implementing this or the mac. + // Linux doesn't need it to my knowledge. + return true; +} + +///////////////////////////////////////// +#if LL_DBUS_ENABLED + +typedef struct +{ + GObjectClass parent_class; +} ViewerAppAPIClass; + +static void viewerappapi_init(ViewerAppAPI *server); +static void viewerappapi_class_init(ViewerAppAPIClass *klass); + +/// + +// regrettable hacks to give us better runtime compatibility with older systems in general +static GType llg_type_register_static_simple_ONCE(GType parent_type, + const gchar *type_name, + guint class_size, + GClassInitFunc class_init, + guint instance_size, + GInstanceInitFunc instance_init, + GTypeFlags flags) +{ + static GTypeInfo type_info; + memset(&type_info, 0, sizeof(type_info)); + + type_info.class_size = class_size; + type_info.class_init = class_init; + type_info.instance_size = instance_size; + type_info.instance_init = instance_init; + + return g_type_register_static(parent_type, type_name, &type_info, flags); +} +#define llg_intern_static_string(S) (S) +#define g_intern_static_string(S) llg_intern_static_string(S) +#define g_type_register_static_simple(parent_type, type_name, class_size, class_init, instance_size, instance_init, flags) llg_type_register_static_simple_ONCE(parent_type, type_name, class_size, class_init, instance_size, instance_init, flags) + +G_DEFINE_TYPE(ViewerAppAPI, viewerappapi, G_TYPE_OBJECT); + +void viewerappapi_class_init(ViewerAppAPIClass *klass) +{ +} + +static bool dbus_server_init = false; + +void viewerappapi_init(ViewerAppAPI *server) +{ + // Connect to the default DBUS, register our service/API. + + if (!dbus_server_init) + { + GError *error = NULL; + + server->connection = lldbus_g_bus_get(DBUS_BUS_SESSION, &error); + if (server->connection) + { + lldbus_g_object_type_install_info(viewerappapi_get_type(), &dbus_glib_viewerapp_object_info); + + lldbus_g_connection_register_g_object(server->connection, VIEWERAPI_PATH, G_OBJECT(server)); + + DBusGProxy *serverproxy = lldbus_g_proxy_new_for_name(server->connection, DBUS_SERVICE_DBUS, DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS); + + guint request_name_ret_unused; + // akin to org_freedesktop_DBus_request_name + if (lldbus_g_proxy_call(serverproxy, "RequestName", &error, G_TYPE_STRING, VIEWERAPI_SERVICE, G_TYPE_UINT, 0, G_TYPE_INVALID, G_TYPE_UINT, &request_name_ret_unused, G_TYPE_INVALID)) + { + // total success. + dbus_server_init = true; + } + else + { + llwarns << "Unable to register service name: " << error->message << llendl; + } + + g_object_unref(serverproxy); + } + else + { + g_warning("Unable to connect to dbus: %s", error->message); + } + + if (error) + g_error_free(error); + } +} + +gboolean viewer_app_api_GoSLURL(ViewerAppAPI *obj, gchar *slurl, gboolean **success_rtn, GError **error) +{ + bool success = false; + + llinfos << "Was asked to go to slurl: " << slurl << llendl; + + const bool from_external_browser = true; + if (LLURLDispatcher::dispatch(slurl, from_external_browser)) + { + // bring window to foreground, as it has just been "launched" from a URL + // todo: hmm, how to get there from here? + //xxx->mWindow->bringToFront(); + success = true; + } + + *success_rtn = g_new (gboolean, 1); + (*success_rtn)[0] = (gboolean)success; + + return TRUE; // the invokation succeeded, even if the actual dispatch didn't. +} + +/// + +//virtual +bool LLAppViewerLinux::initSLURLHandler() +{ + if (!grab_dbus_syms(DBUSGLIB_DYLIB_DEFAULT_NAME)) + { + return false; // failed + } + + g_type_init(); + + //ViewerAppAPI *api_server = (ViewerAppAPI*) + g_object_new(viewerappapi_get_type(), NULL); + + return true; +} + +//virtual +bool LLAppViewerLinux::sendURLToOtherInstance(const std::string& url) +{ + if (!grab_dbus_syms(DBUSGLIB_DYLIB_DEFAULT_NAME)) + { + return false; // failed + } + + bool success = false; + DBusGConnection *bus; + GError *error = NULL; + + g_type_init(); + + bus = lldbus_g_bus_get (DBUS_BUS_SESSION, &error); + if (bus) + { + gboolean rtn = FALSE; + DBusGProxy *remote_object = + lldbus_g_proxy_new_for_name(bus, VIEWERAPI_SERVICE, VIEWERAPI_PATH, VIEWERAPI_INTERFACE); + + if (lldbus_g_proxy_call(remote_object, "GoSLURL", &error, + G_TYPE_STRING, url.c_str(), G_TYPE_INVALID, + G_TYPE_BOOLEAN, &rtn, G_TYPE_INVALID)) + { + success = rtn; + } + else + { + llinfos << "Call-out to other instance failed (perhaps not running): " << error->message << llendl; + } + + g_object_unref(G_OBJECT(remote_object)); + } + else + { + llwarns << "Couldn't connect to session bus: " << error->message << llendl; + } + + if (error) + g_error_free(error); + + return success; +} + +#else // LL_DBUS_ENABLED +bool LLAppViewerLinux::initSLURLHandler() +{ + return false; // not implemented without dbus +} +bool LLAppViewerLinux::sendURLToOtherInstance(const std::string& url) +{ + return false; // not implemented without dbus +} +#endif // LL_DBUS_ENABLED + void LLAppViewerLinux::handleSyncCrashTrace() { // This backtrace writes into stack_trace.log @@ -331,57 +531,90 @@ void LLAppViewerLinux::handleSyncCrashTrace() # endif // LL_ELFBIN } -void LLAppViewerLinux::handleCrashReporting() +void LLAppViewerLinux::handleCrashReporting(bool reportFreeze) { - const S32 cb = gCrashSettings.getS32(CRASH_BEHAVIOR_SETTING); - - // Always generate the report, have the logger do the asking, and - // don't wait for the logger before exiting (-> total cleanup). - if (CRASH_BEHAVIOR_NEVER_SEND != cb) - { - // launch the actual crash logger - const char* ask_dialog = "-dialog"; - if (CRASH_BEHAVIOR_ASK != cb) - ask_dialog = ""; // omit '-dialog' option - std::string cmd =gDirUtilp->getAppRODataDir(); - cmd += gDirUtilp->getDirDelimiter(); - cmd += "linux-crash-logger.bin"; - const char * cmdargv[] = - {cmd.c_str(), - ask_dialog, - "-user", - (char*)LLViewerLogin::getInstance()->getGridLabel().c_str(), - "-name", - LLAppViewer::instance()->getSecondLifeTitle().c_str(), + std::string cmd =gDirUtilp->getAppRODataDir(); + cmd += gDirUtilp->getDirDelimiter(); +#if LL_LINUX + cmd += "linux-crash-logger.bin"; +#else // LL_SOLARIS + cmd += "bin/solaris-crash-logger"; +#endif // LL_LINUX + + if(reportFreeze) + { + char* const cmdargv[] = + {(char*)cmd.c_str(), + (char*)"-previous", NULL}; - fflush(NULL); + + fflush(NULL); // flush all buffers before the child inherits them pid_t pid = fork(); if (pid == 0) { // child - execv(cmd.c_str(), (char* const*) cmdargv); /* Flawfinder: ignore */ + execv(cmd.c_str(), cmdargv); /* Flawfinder: Ignore */ llwarns << "execv failure when trying to start " << cmd << llendl; _exit(1); // avoid atexit() - } - else - { + } else { if (pid > 0) { - // DO NOT wait for child proc to die; we want - // the logger to outlive us while we quit to - // free up the screen/keyboard/etc. - ////int childExitStatus; - ////waitpid(pid, &childExitStatus, 0); + // wait for child proc to die + int childExitStatus; + waitpid(pid, &childExitStatus, 0); + } else { + llwarns << "fork failure." << llendl; + } + } + } + else + { + const S32 cb = gCrashSettings.getS32(CRASH_BEHAVIOR_SETTING); + + // Always generate the report, have the logger do the asking, and + // don't wait for the logger before exiting (-> total cleanup). + if (CRASH_BEHAVIOR_NEVER_SEND != cb) + { + // launch the actual crash logger + const char* ask_dialog = "-dialog"; + if (CRASH_BEHAVIOR_ASK != cb) + ask_dialog = ""; // omit '-dialog' option + const char * cmdargv[] = + {cmd.c_str(), + ask_dialog, + "-user", + (char*)LLViewerLogin::getInstance()->getGridLabel().c_str(), + "-name", + LLAppViewer::instance()->getSecondLifeTitle().c_str(), + NULL}; + fflush(NULL); + pid_t pid = fork(); + if (pid == 0) + { // child + execv(cmd.c_str(), (char* const*) cmdargv); /* Flawfinder: ignore */ + llwarns << "execv failure when trying to start " << cmd << llendl; + _exit(1); // avoid atexit() } else { - llwarns << "fork failure." << llendl; + if (pid > 0) + { + // DO NOT wait for child proc to die; we want + // the logger to outlive us while we quit to + // free up the screen/keyboard/etc. + ////int childExitStatus; + ////waitpid(pid, &childExitStatus, 0); + } + else + { + llwarns << "fork failure." << llendl; + } } } + // Sometimes signals don't seem to quit the viewer. Also, we may + // have been called explicitly instead of from a signal handler. + // Make sure we exit so as to not totally confuse the user. + _exit(1); // avoid atexit(), else we may re-crash in dtors. } - // Sometimes signals don't seem to quit the viewer. Also, we may - // have been called explicitly instead of from a signal handler. - // Make sure we exit so as to not totally confuse the user. - _exit(1); // avoid atexit(), else we may re-crash in dtors. } bool LLAppViewerLinux::beingDebugged() diff --git a/linden/indra/newview/llappviewerlinux.h b/linden/indra/newview/llappviewerlinux.h index a180b4d..7b6d75c 100644 --- a/linden/indra/newview/llappviewerlinux.h +++ b/linden/indra/newview/llappviewerlinux.h @@ -32,6 +32,14 @@ #ifndef LL_LLAPPVIEWERLINUX_H #define LL_LLAPPVIEWERLINUX_H +#if LL_DBUS_ENABLED +extern "C" { +# include +# include +# include +} +#endif + #ifndef LL_LLAPPVIEWER_H #include "llappviewer.h" #endif @@ -49,15 +57,37 @@ public: // virtual bool init(); // Override to do application initialization std::string generateSerialNumber(); + bool setupSLURLHandler(); protected: virtual bool beingDebugged(); - - virtual void handleCrashReporting(); + + virtual bool restoreErrorTrap(); + virtual void handleCrashReporting(bool reportFreeze); virtual void handleSyncCrashTrace(); virtual bool initLogging(); virtual bool initParseCommandLine(LLCommandLineParser& clp); + + virtual bool initSLURLHandler(); + virtual bool sendURLToOtherInstance(const std::string& url); }; +#if LL_DBUS_ENABLED +typedef struct +{ + GObject parent; + DBusGConnection *connection; +} ViewerAppAPI; + +extern "C" { + gboolean viewer_app_api_GoSLURL(ViewerAppAPI *obj, gchar *slurl, gboolean **success_rtn, GError **error); +} + +#define VIEWERAPI_SERVICE "com.secondlife.ViewerAppAPIService" +#define VIEWERAPI_PATH "/com/secondlife/ViewerAppAPI" +#define VIEWERAPI_INTERFACE "com.secondlife.ViewerAppAPI" + +#endif // LL_DBUS_ENABLED + #endif // LL_LLAPPVIEWERLINUX_H diff --git a/linden/indra/newview/llappviewerlinux_api.h b/linden/indra/newview/llappviewerlinux_api.h new file mode 100644 index 0000000..bd17599 --- /dev/null +++ b/linden/indra/newview/llappviewerlinux_api.h @@ -0,0 +1,148 @@ +/* Generated by dbus-binding-tool; do not edit! */ +/** + * $LicenseInfo:firstyear=2008&license=viewergpl$ + * + * Copyright (c) 2008, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#ifndef __dbus_glib_marshal_viewerapp_MARSHAL_H__ +#define __dbus_glib_marshal_viewerapp_MARSHAL_H__ + +#include + +G_BEGIN_DECLS + +#ifdef G_ENABLE_DEBUG +#define g_marshal_value_peek_boolean(v) g_value_get_boolean (v) +#define g_marshal_value_peek_char(v) g_value_get_char (v) +#define g_marshal_value_peek_uchar(v) g_value_get_uchar (v) +#define g_marshal_value_peek_int(v) g_value_get_int (v) +#define g_marshal_value_peek_uint(v) g_value_get_uint (v) +#define g_marshal_value_peek_long(v) g_value_get_long (v) +#define g_marshal_value_peek_ulong(v) g_value_get_ulong (v) +#define g_marshal_value_peek_int64(v) g_value_get_int64 (v) +#define g_marshal_value_peek_uint64(v) g_value_get_uint64 (v) +#define g_marshal_value_peek_enum(v) g_value_get_enum (v) +#define g_marshal_value_peek_flags(v) g_value_get_flags (v) +#define g_marshal_value_peek_float(v) g_value_get_float (v) +#define g_marshal_value_peek_double(v) g_value_get_double (v) +#define g_marshal_value_peek_string(v) (char*) g_value_get_string (v) +#define g_marshal_value_peek_param(v) g_value_get_param (v) +#define g_marshal_value_peek_boxed(v) g_value_get_boxed (v) +#define g_marshal_value_peek_pointer(v) g_value_get_pointer (v) +#define g_marshal_value_peek_object(v) g_value_get_object (v) +#else /* !G_ENABLE_DEBUG */ +/* WARNING: This code accesses GValues directly, which is UNSUPPORTED API. + * Do not access GValues directly in your code. Instead, use the + * g_value_get_*() functions + */ +#define g_marshal_value_peek_boolean(v) (v)->data[0].v_int +#define g_marshal_value_peek_char(v) (v)->data[0].v_int +#define g_marshal_value_peek_uchar(v) (v)->data[0].v_uint +#define g_marshal_value_peek_int(v) (v)->data[0].v_int +#define g_marshal_value_peek_uint(v) (v)->data[0].v_uint +#define g_marshal_value_peek_long(v) (v)->data[0].v_long +#define g_marshal_value_peek_ulong(v) (v)->data[0].v_ulong +#define g_marshal_value_peek_int64(v) (v)->data[0].v_int64 +#define g_marshal_value_peek_uint64(v) (v)->data[0].v_uint64 +#define g_marshal_value_peek_enum(v) (v)->data[0].v_long +#define g_marshal_value_peek_flags(v) (v)->data[0].v_ulong +#define g_marshal_value_peek_float(v) (v)->data[0].v_float +#define g_marshal_value_peek_double(v) (v)->data[0].v_double +#define g_marshal_value_peek_string(v) (v)->data[0].v_pointer +#define g_marshal_value_peek_param(v) (v)->data[0].v_pointer +#define g_marshal_value_peek_boxed(v) (v)->data[0].v_pointer +#define g_marshal_value_peek_pointer(v) (v)->data[0].v_pointer +#define g_marshal_value_peek_object(v) (v)->data[0].v_pointer +#endif /* !G_ENABLE_DEBUG */ + + +/* BOOLEAN:STRING,POINTER,POINTER (/tmp/dbus-binding-tool-c-marshallers.5XXD8T:1) */ +extern void dbus_glib_marshal_viewerapp_BOOLEAN__STRING_POINTER_POINTER (GClosure *closure, + GValue *return_value, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint, + gpointer marshal_data); +void +dbus_glib_marshal_viewerapp_BOOLEAN__STRING_POINTER_POINTER (GClosure *closure, + GValue *return_value, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint, + gpointer marshal_data) +{ + typedef gboolean (*GMarshalFunc_BOOLEAN__STRING_POINTER_POINTER) (gpointer data1, + gpointer arg_1, + gpointer arg_2, + gpointer arg_3, + gpointer data2); + register GMarshalFunc_BOOLEAN__STRING_POINTER_POINTER callback; + register GCClosure *cc = (GCClosure*) closure; + register gpointer data1, data2; + gboolean v_return; + + g_return_if_fail (return_value != NULL); + g_return_if_fail (n_param_values == 4); + + if (G_CCLOSURE_SWAP_DATA (closure)) + { + data1 = closure->data; + data2 = g_value_peek_pointer (param_values + 0); + } + else + { + data1 = g_value_peek_pointer (param_values + 0); + data2 = closure->data; + } + callback = (GMarshalFunc_BOOLEAN__STRING_POINTER_POINTER) (marshal_data ? marshal_data : cc->callback); + + v_return = callback (data1, + g_marshal_value_peek_string (param_values + 1), + g_marshal_value_peek_pointer (param_values + 2), + g_marshal_value_peek_pointer (param_values + 3), + data2); + + g_value_set_boolean (return_value, v_return); +} + +G_END_DECLS + +#endif /* __dbus_glib_marshal_viewerapp_MARSHAL_H__ */ + +#include +static const DBusGMethodInfo dbus_glib_viewerapp_methods[] = { + { (GCallback) viewer_app_api_GoSLURL, dbus_glib_marshal_viewerapp_BOOLEAN__STRING_POINTER_POINTER, 0 }, +}; + +const DBusGObjectInfo dbus_glib_viewerapp_object_info = { + 0, + dbus_glib_viewerapp_methods, + 1, +"com.secondlife.ViewerAppAPI\0GoSLURL\0S\0slurl\0I\0s\0success_ret\0O\0F\0N\0b\0\0\0", +"\0", +"\0" +}; + diff --git a/linden/indra/newview/llappviewerlinux_api.xml b/linden/indra/newview/llappviewerlinux_api.xml new file mode 100644 index 0000000..fac35b7 --- /dev/null +++ b/linden/indra/newview/llappviewerlinux_api.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/linden/indra/newview/llappviewerlinux_api_dbus.cpp b/linden/indra/newview/llappviewerlinux_api_dbus.cpp new file mode 100644 index 0000000..806714f --- /dev/null +++ b/linden/indra/newview/llappviewerlinux_api_dbus.cpp @@ -0,0 +1,131 @@ +/** + * @file llappviewerlinux_api_dbus.cpp + * @brief dynamic DBus symbol-grabbing code + * + * $LicenseInfo:firstyear=2008&license=viewergpl$ + * + * Copyright (c) 2008, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#if LL_DBUS_ENABLED + +#include "linden_common.h" + +extern "C" { +#include + +#include "apr_pools.h" +#include "apr_dso.h" +} + +#define DEBUGMSG(...) lldebugs << llformat(__VA_ARGS__) << llendl +#define INFOMSG(...) llinfos << llformat(__VA_ARGS__) << llendl +#define WARNMSG(...) llwarns << llformat(__VA_ARGS__) << llendl + +#define LL_DBUS_SYM(REQUIRED, DBUSSYM, RTN, ...) RTN (*ll##DBUSSYM)(__VA_ARGS__) = NULL +#include "llappviewerlinux_api_dbus_syms_raw.inc" +#undef LL_DBUS_SYM + +static bool sSymsGrabbed = false; +static apr_pool_t *sSymDBUSDSOMemoryPool = NULL; +static apr_dso_handle_t *sSymDBUSDSOHandleG = NULL; + +bool grab_dbus_syms(std::string dbus_dso_name) +{ + if (sSymsGrabbed) + { + // already have grabbed good syms + return TRUE; + } + + bool sym_error = false; + bool rtn = false; + apr_status_t rv; + apr_dso_handle_t *sSymDBUSDSOHandle = NULL; + +#define LL_DBUS_SYM(REQUIRED, DBUSSYM, RTN, ...) do{rv = apr_dso_sym((apr_dso_handle_sym_t*)&ll##DBUSSYM, sSymDBUSDSOHandle, #DBUSSYM); if (rv != APR_SUCCESS) {INFOMSG("Failed to grab symbol: %s", #DBUSSYM); if (REQUIRED) sym_error = true;} else DEBUGMSG("grabbed symbol: %s from %p", #DBUSSYM, (void*)ll##DBUSSYM);}while(0) + + //attempt to load the shared library + apr_pool_create(&sSymDBUSDSOMemoryPool, NULL); + + if ( APR_SUCCESS == (rv = apr_dso_load(&sSymDBUSDSOHandle, + dbus_dso_name.c_str(), + sSymDBUSDSOMemoryPool) )) + { + INFOMSG("Found DSO: %s", dbus_dso_name.c_str()); + +#include "llappviewerlinux_api_dbus_syms_raw.inc" + + if ( sSymDBUSDSOHandle ) + { + sSymDBUSDSOHandleG = sSymDBUSDSOHandle; + sSymDBUSDSOHandle = NULL; + } + + rtn = !sym_error; + } + else + { + INFOMSG("Couldn't load DSO: %s", dbus_dso_name.c_str()); + rtn = false; // failure + } + + if (sym_error) + { + WARNMSG("Failed to find necessary symbols in DBUS-GLIB libraries."); + } +#undef LL_DBUS_SYM + + sSymsGrabbed = rtn; + return rtn; +} + + +void ungrab_dbus_syms() +{ + // should be safe to call regardless of whether we've + // actually grabbed syms. + + if ( sSymDBUSDSOHandleG ) + { + apr_dso_unload(sSymDBUSDSOHandleG); + sSymDBUSDSOHandleG = NULL; + } + + if ( sSymDBUSDSOMemoryPool ) + { + apr_pool_destroy(sSymDBUSDSOMemoryPool); + sSymDBUSDSOMemoryPool = NULL; + } + + // NULL-out all of the symbols we'd grabbed +#define LL_DBUS_SYM(REQUIRED, DBUSSYM, RTN, ...) do{ll##DBUSSYM = NULL;}while(0) +#include "llappviewerlinux_api_dbus_syms_raw.inc" +#undef LL_DBUS_SYM + + sSymsGrabbed = false; +} + +#endif // LL_DBUS_ENABLED diff --git a/linden/indra/newview/llappviewerlinux_api_dbus.h b/linden/indra/newview/llappviewerlinux_api_dbus.h new file mode 100644 index 0000000..6d6c1b0 --- /dev/null +++ b/linden/indra/newview/llappviewerlinux_api_dbus.h @@ -0,0 +1,49 @@ +/** + * @file llappviewerlinux_api_dbus.h + * @brief DBus-glib symbol handling + * + * $LicenseInfo:firstyear=2008&license=viewergpl$ + * + * Copyright (c) 2008, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#include "linden_common.h" + +#if LL_DBUS_ENABLED + +extern "C" { +#include +} + +#define DBUSGLIB_DYLIB_DEFAULT_NAME "libdbus-glib-1.so.2" + +bool grab_dbus_syms(std::string dbus_dso_name); +void ungrab_dbus_syms(); + +#define LL_DBUS_SYM(REQUIRED, DBUSSYM, RTN, ...) extern RTN (*ll##DBUSSYM)(__VA_ARGS__) +#include "llappviewerlinux_api_dbus_syms_raw.inc" +#undef LL_DBUS_SYM + +#endif // LL_DBUS_ENABLED diff --git a/linden/indra/newview/llappviewerlinux_api_dbus_syms_raw.inc b/linden/indra/newview/llappviewerlinux_api_dbus_syms_raw.inc new file mode 100644 index 0000000..c0548e2 --- /dev/null +++ b/linden/indra/newview/llappviewerlinux_api_dbus_syms_raw.inc @@ -0,0 +1,9 @@ + +// required symbols to grab +LL_DBUS_SYM(true, dbus_g_bus_get, DBusGConnection*, DBusBusType, GError**); +LL_DBUS_SYM(true, dbus_g_proxy_new_for_name, DBusGProxy*, DBusGConnection*, const char *, const char*, const char*); +LL_DBUS_SYM(true, dbus_g_proxy_call, gboolean, DBusGProxy*, const char*, GError**, GType, ...); +LL_DBUS_SYM(true, dbus_g_object_type_install_info, void, GType, const DBusGObjectInfo*); +LL_DBUS_SYM(true, dbus_g_connection_register_g_object, void, DBusGConnection*, const char*, GObject*); + +// optional symbols to grab diff --git a/linden/indra/newview/llappviewermacosx.cpp b/linden/indra/newview/llappviewermacosx.cpp index 68c3a16..e3fd425 100644 --- a/linden/indra/newview/llappviewermacosx.cpp +++ b/linden/indra/newview/llappviewermacosx.cpp @@ -48,6 +48,7 @@ #include "llurldispatcher.h" #include #include "lldir.h" +#include namespace { // The command line args stored. @@ -193,22 +194,106 @@ bool LLAppViewerMacOSX::initParseCommandLine(LLCommandLineParser& clp) return true; } +// *FIX:Mani It would be nice to provide a clean interface to get the +// default_unix_signal_handler for the LLApp class. +extern void default_unix_signal_handler(int, siginfo_t *, void *); +bool LLAppViewerMacOSX::restoreErrorTrap() +{ + // This method intends to reinstate signal handlers. + // *NOTE:Mani It was found that the first execution of a shader was overriding + // our initial signal handlers somehow. + // This method will be called (at least) once per mainloop execution. + // *NOTE:Mani The signals used below are copied over from the + // setup_signals() func in LLApp.cpp + // LLApp could use some way of overriding that func, but for this viewer + // fix I opt to avoid affecting the server code. + + // Set up signal handlers that may result in program termination + // + struct sigaction act; + struct sigaction old_act; + act.sa_sigaction = default_unix_signal_handler; + sigemptyset( &act.sa_mask ); + act.sa_flags = SA_SIGINFO; + + unsigned int reset_count = 0; + +#define SET_SIG(S) sigaction(SIGABRT, &act, &old_act); \ + if((unsigned int)act.sa_sigaction != (unsigned int) old_act.sa_sigaction) \ + ++reset_count; + // Synchronous signals + SET_SIG(SIGABRT) + SET_SIG(SIGALRM) + SET_SIG(SIGBUS) + SET_SIG(SIGFPE) + SET_SIG(SIGHUP) + SET_SIG(SIGILL) + SET_SIG(SIGPIPE) + SET_SIG(SIGSEGV) + SET_SIG(SIGSYS) + + SET_SIG(LL_HEARTBEAT_SIGNAL) + SET_SIG(LL_SMACKDOWN_SIGNAL) + + // Asynchronous signals that are normally ignored + SET_SIG(SIGCHLD) + SET_SIG(SIGUSR2) + + // Asynchronous signals that result in attempted graceful exit + SET_SIG(SIGHUP) + SET_SIG(SIGTERM) + SET_SIG(SIGINT) + + // Asynchronous signals that result in core + SET_SIG(SIGQUIT) +#undef SET_SIG + + return reset_count == 0; +} + void LLAppViewerMacOSX::handleSyncCrashTrace() { // do nothing } -void LLAppViewerMacOSX::handleCrashReporting() +void LLAppViewerMacOSX::handleCrashReporting(bool reportFreeze) { - // Macintosh std::string command_str; - command_str += "open mac-crash-logger.app"; + //command_str = "open Second Life.app/Contents/Resources/mac-crash-logger.app"; + command_str = "mac-crash-logger.app/Contents/MacOS/mac-crash-logger"; - clear_signals(); - llinfos << "Launching crash reporter using: '" << command_str << "'" << llendl; - system(command_str.c_str()); /* Flawfinder: ignore */ - llinfos << "returned from crash reporter... dying" << llendl; - _exit(1); + FSRef appRef; + Boolean isDir = 0; + OSStatus os_result = FSPathMakeRef((UInt8*)command_str.c_str(), + &appRef, + &isDir); + if(os_result >= 0) + { + LSApplicationParameters appParams; + memset(&appParams, 0, sizeof(appParams)); + appParams.version = 0; + appParams.flags = kLSLaunchNoParams | kLSLaunchStartClassic; + appParams.application = &appRef; + + if(reportFreeze) + { + // Make sure freeze reporting launches the crash logger synchronously, lest + // Log files get changed by SL while the logger is running. + } + else + { + appParams.flags |= kLSLaunchAsync; + clear_signals(); + } + + ProcessSerialNumber o_psn; + os_result = LSOpenApplication(&appParams, &o_psn); + } + + if(!reportFreeze) + { + _exit(1); + } } std::string LLAppViewerMacOSX::generateSerialNumber() diff --git a/linden/indra/newview/llappviewermacosx.h b/linden/indra/newview/llappviewermacosx.h index 0d8c460..85193a8 100644 --- a/linden/indra/newview/llappviewermacosx.h +++ b/linden/indra/newview/llappviewermacosx.h @@ -49,7 +49,8 @@ public: protected: - virtual void handleCrashReporting(); + virtual bool restoreErrorTrap(); + virtual void handleCrashReporting(bool reportFreeze); virtual void handleSyncCrashTrace(); std::string generateSerialNumber(); diff --git a/linden/indra/newview/llappviewerwin32.cpp b/linden/indra/newview/llappviewerwin32.cpp index 9f37534..bf02087 100644 --- a/linden/indra/newview/llappviewerwin32.cpp +++ b/linden/indra/newview/llappviewerwin32.cpp @@ -64,7 +64,7 @@ #include "llcommandlineparser.h" -//*FIX:Mani - This hack is to fix a linker issue with libndofdev.lib +// *FIX:Mani - This hack is to fix a linker issue with libndofdev.lib // The lib was compiled under VS2005 - in VS2003 we need to remap assert #ifdef LL_DEBUG #ifdef LL_MSVC7 @@ -77,6 +77,8 @@ extern "C" { #endif #endif +const std::string LLAppViewerWin32::sWindowClass = "Second Life"; + LONG WINAPI viewer_windows_exception_handler(struct _EXCEPTION_POINTERS *exception_infop) { // *NOTE:Mani - this code is stolen from LLApp, where its never actually used. @@ -91,6 +93,7 @@ LONG WINAPI viewer_windows_exception_handler(struct _EXCEPTION_POINTERS *excepti if (LLApp::isError()) { llwarns << "Got another fatal signal while in the error handler, die now!" << llendl; + retval = EXCEPTION_EXECUTE_HANDLER; return retval; } @@ -119,7 +122,6 @@ LONG WINAPI viewer_windows_exception_handler(struct _EXCEPTION_POINTERS *excepti return retval; } - #if DEBUGGING_SEH_FILTER # define WINMAIN DebuggingWinMain #else @@ -195,6 +197,19 @@ int APIENTRY WINMAIN(HINSTANCE hInstance, } delete viewer_app_ptr; viewer_app_ptr = NULL; + + //start updater + if(LLAppViewer::sUpdaterInfo) + { +#if LL_WINDOWS + _spawnl(_P_NOWAIT, LLAppViewer::sUpdaterInfo->mUpdateExePath.c_str(), LLAppViewer::sUpdaterInfo->mUpdateExePath.c_str(), LLAppViewer::sUpdaterInfo->mParams.str().c_str(), NULL); +#elif LL_DARWIN + system(LLAppViewer::sUpdaterInfo->mUpdateExePath.c_str()); /* Flawfinder: ignore */ +#endif + delete LLAppViewer::sUpdaterInfo ; + LLAppViewer::sUpdaterInfo = NULL ; + } + return 0; } @@ -324,6 +339,17 @@ bool LLAppViewerWin32::cleanup() return result; } +bool LLAppViewerWin32::initLogging() +{ + // Remove the crash stack log from previous executions. + // Since we've started logging a new instance of the app, we can assume + // *NOTE: This should happen before the we send a 'previous instance froze' + // crash report, but it must happen after we initialize the DirUtil. + LLWinDebug::clearCrashStacks(); + + return LLAppViewer::initLogging(); +} + void LLAppViewerWin32::initConsole() { // pop up debug console @@ -405,7 +431,7 @@ bool LLAppViewerWin32::initHardwareTest() LLSplashScreen::update(splash_msg.str()); } - if (!LLWinDebug::checkExceptionHandler()) + if (!restoreErrorTrap()) { LL_WARNS("AppInit") << " Someone took over my exception handler (post hardware probe)!" << LL_ENDL; } @@ -445,39 +471,69 @@ bool LLAppViewerWin32::initParseCommandLine(LLCommandLineParser& clp) return true; } +bool LLAppViewerWin32::restoreErrorTrap() +{ + return LLWinDebug::checkExceptionHandler(); +} + void LLAppViewerWin32::handleSyncCrashTrace() { // do nothing } -void LLAppViewerWin32::handleCrashReporting() +void LLAppViewerWin32::handleCrashReporting(bool reportFreeze) { - // Windows only behaivor. Spawn win crash reporter. - std::string exe_path = gDirUtilp->getAppRODataDir(); + const char* logger_name = "win_crash_logger.exe"; + std::string exe_path = gDirUtilp->getExecutableDir(); exe_path += gDirUtilp->getDirDelimiter(); - exe_path += "win_crash_logger.exe"; + exe_path += logger_name; - std::string arg_string = "-user "; - arg_string += LLViewerLogin::getInstance()->getGridLabel(); - - S32 cb = gCrashSettings.getS32(CRASH_BEHAVIOR_SETTING); - switch(cb) + const char* arg_str = logger_name; + + // *NOTE:Mani - win_crash_logger.exe no longer parses command line options. + if(reportFreeze) + { + // Spawn crash logger. + // NEEDS to wait until completion, otherwise log files will get smashed. + _spawnl(_P_WAIT, exe_path.c_str(), arg_str, NULL); + } + else + { + S32 cb = gCrashSettings.getS32(CRASH_BEHAVIOR_SETTING); + if(cb != CRASH_BEHAVIOR_NEVER_SEND) + { + _spawnl(_P_NOWAIT, exe_path.c_str(), arg_str, NULL); + } + } +} + +//virtual +bool LLAppViewerWin32::sendURLToOtherInstance(const std::string& url) +{ + wchar_t window_class[256]; /* Flawfinder: ignore */ // Assume max length < 255 chars. + mbstowcs(window_class, sWindowClass.c_str(), 255); + window_class[255] = 0; + // Use the class instead of the window name. + HWND other_window = FindWindow(window_class, NULL); + + if (other_window != NULL) { - case CRASH_BEHAVIOR_ASK: - default: - arg_string += " -dialog "; - _spawnl(_P_NOWAIT, exe_path.c_str(), exe_path.c_str(), arg_string.c_str(), NULL); - break; - - case CRASH_BEHAVIOR_ALWAYS_SEND: - _spawnl(_P_NOWAIT, exe_path.c_str(), exe_path.c_str(), arg_string.c_str(), NULL); - break; - - case CRASH_BEHAVIOR_NEVER_SEND: - break; + lldebugs << "Found other window with the name '" << getWindowTitle() << "'" << llendl; + COPYDATASTRUCT cds; + const S32 SLURL_MESSAGE_TYPE = 0; + cds.dwData = SLURL_MESSAGE_TYPE; + cds.cbData = url.length() + 1; + cds.lpData = (void*)url.c_str(); + + LRESULT msg_result = SendMessage(other_window, WM_COPYDATA, NULL, (LPARAM)&cds); + lldebugs << "SendMessage(WM_COPYDATA) to other window '" + << getWindowTitle() << "' returned " << msg_result << llendl; + return true; } + return false; } + std::string LLAppViewerWin32::generateSerialNumber() { char serial_md5[MD5HEX_STR_SIZE]; // Flawfinder: ignore diff --git a/linden/indra/newview/llappviewerwin32.h b/linden/indra/newview/llappviewerwin32.h index fe16ec4..6a5b0b1 100644 --- a/linden/indra/newview/llappviewerwin32.h +++ b/linden/indra/newview/llappviewerwin32.h @@ -49,15 +49,21 @@ public: virtual bool cleanup(); protected: + virtual bool initLogging(); // Override to clean stack_trace info. virtual void initConsole(); // Initialize OS level debugging console. virtual bool initHardwareTest(); // Win32 uses DX9 to test hardware. virtual bool initParseCommandLine(LLCommandLineParser& clp); - virtual void handleCrashReporting(); + virtual bool restoreErrorTrap(); + virtual void handleCrashReporting(bool reportFreeze); virtual void handleSyncCrashTrace(); + virtual bool sendURLToOtherInstance(const std::string& url); + std::string generateSerialNumber(); + static const std::string sWindowClass; + private: void disableWinErrorReporting(); diff --git a/linden/indra/newview/llaudiosourcevo.cpp b/linden/indra/newview/llaudiosourcevo.cpp index e668078..50cd8cd 100644 --- a/linden/indra/newview/llaudiosourcevo.cpp +++ b/linden/indra/newview/llaudiosourcevo.cpp @@ -39,7 +39,7 @@ #include "llviewerparcelmgr.h" LLAudioSourceVO::LLAudioSourceVO(const LLUUID &sound_id, const LLUUID& owner_id, const F32 gain, LLViewerObject *objectp) -: LLAudioSource(sound_id, owner_id, gain), + : LLAudioSource(sound_id, owner_id, gain, LLAudioEngine::AUDIO_TYPE_SFX), mObjectp(objectp), mActualGain(gain) { diff --git a/linden/indra/newview/llbox.cpp b/linden/indra/newview/llbox.cpp index 1e6d282..1bcec7a 100644 --- a/linden/indra/newview/llbox.cpp +++ b/linden/indra/newview/llbox.cpp @@ -81,7 +81,7 @@ void LLBox::renderface(S32 which_face) {7, 4, 0, 3} }; - gGL.begin(LLVertexBuffer::QUADS); + gGL.begin(LLRender::QUADS); //gGL.normal3fv(&normals[which_face][0]); gGL.texCoord2f(1,0); gGL.vertex3fv(&mVertex[ faces[which_face][0] ][0]); diff --git a/linden/indra/newview/llchatbar.cpp b/linden/indra/newview/llchatbar.cpp index 31fa653..2d9d356 100644 --- a/linden/indra/newview/llchatbar.cpp +++ b/linden/indra/newview/llchatbar.cpp @@ -553,15 +553,17 @@ void LLChatBar::onInputEditorGainFocus( LLFocusableElement* caller, void* userda // static void LLChatBar::onClickSay( LLUICtrl* ctrl, void* userdata ) { - LLChatBar* self = (LLChatBar*) userdata; + e_chat_type chat_type = CHAT_TYPE_NORMAL; if (ctrl->getValue().asString() == "shout") { - self->sendChat( CHAT_TYPE_SHOUT ); + chat_type = CHAT_TYPE_SHOUT; } - else + else if (ctrl->getValue().asString() == "whisper") { - self->sendChat( CHAT_TYPE_NORMAL ); + chat_type = CHAT_TYPE_WHISPER; } + LLChatBar* self = (LLChatBar*) userdata; + self->sendChat(chat_type); } void LLChatBar::sendChatFromViewer(const std::string &utf8text, EChatType type, BOOL animate) diff --git a/linden/indra/newview/llcommandlineparser.cpp b/linden/indra/newview/llcommandlineparser.cpp index dc6a1e2..5dafe78 100644 --- a/linden/indra/newview/llcommandlineparser.cpp +++ b/linden/indra/newview/llcommandlineparser.cpp @@ -416,11 +416,6 @@ void setControlValueCB(const LLCommandLineParser::token_vector_t& value, const std::string& opt_name, LLControlGroup* ctrlGroup) { - if(value.size() > 1) - { - llwarns << "Ignoring extra tokens mapped to the setting: " << opt_name << "." << llendl; - } - // *FIX: Do sematic conversion here. // LLSD (ImplString) Is no good for doing string to type conversion for... // booleans @@ -457,7 +452,7 @@ void setControlValueCB(const LLCommandLineParser::token_vector_t& value, default: { // For the default types, let llsd do the conversion. - if(value.size() > 1) + if(value.size() > 1 && ctrl->isType(TYPE_LLSD)) { // Assume its an array... LLSD llsdArray; @@ -472,6 +467,11 @@ void setControlValueCB(const LLCommandLineParser::token_vector_t& value, } else if(value.size() > 0) { + if(value.size() > 1) + { + llwarns << "Ignoring extra tokens mapped to the setting: " << opt_name << "." << llendl; + } + LLSD llsdValue; llsdValue.assign(LLSD::String(value[0])); ctrl->setValue(llsdValue, false); diff --git a/linden/indra/newview/llcompilequeue.cpp b/linden/indra/newview/llcompilequeue.cpp index fc2742f..00ca833 100644 --- a/linden/indra/newview/llcompilequeue.cpp +++ b/linden/indra/newview/llcompilequeue.cpp @@ -60,6 +60,8 @@ #include "llviewerstats.h" #include "lluictrlfactory.h" +#include "llselectmgr.h" + ///---------------------------------------------------------------------------- /// Local function declarations, constants, enums, and typedefs ///---------------------------------------------------------------------------- @@ -194,7 +196,20 @@ BOOL LLFloaterScriptQueue::start() { //llinfos << "LLFloaterCompileQueue::start()" << llendl; std::string buffer; - buffer = llformat("Starting %s of %d items.", mStartString.c_str(), mObjectIDs.count()); // *TODO: Translate + + LLSelectMgr *mgr = LLSelectMgr::getInstance(); + LLObjectSelectionHandle selectHandle = mgr->getSelection(); + U32 n_objects = 0; + if (gSavedSettings.getBOOL("EditLinkedParts")) + { + n_objects = selectHandle->getObjectCount(); + } + else + { + n_objects = selectHandle->getRootObjectCount(); + } + + buffer = llformat("Starting %s of %d items.", mStartString.c_str(), n_objects); // *TODO: Translate LLScrollListCtrl* list = getChild("queue output"); list->addCommentText(buffer); diff --git a/linden/indra/newview/llcontainerview.cpp b/linden/indra/newview/llcontainerview.cpp index dbec409..4a09265 100644 --- a/linden/indra/newview/llcontainerview.cpp +++ b/linden/indra/newview/llcontainerview.cpp @@ -88,7 +88,7 @@ BOOL LLContainerView::handleMouseUp(S32 x, S32 y, MASK mask) void LLContainerView::draw() { { - LLGLSNoTexture gls_no_texture; + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); gl_rect_2d(0, getRect().getHeight(), getRect().getWidth(), 0, LLColor4(0.f, 0.f, 0.f, 0.25f)); } diff --git a/linden/indra/newview/lldrawable.cpp b/linden/indra/newview/lldrawable.cpp index 0f89585..ac90fdf 100644 --- a/linden/indra/newview/lldrawable.cpp +++ b/linden/indra/newview/lldrawable.cpp @@ -362,6 +362,7 @@ void LLDrawable::makeActive() if (pcode == LLViewerObject::LL_VO_WATER || pcode == LLViewerObject::LL_VO_SURFACE_PATCH || pcode == LLViewerObject::LL_VO_PART_GROUP || + pcode == LLViewerObject::LL_VO_HUD_PART_GROUP || pcode == LLViewerObject::LL_VO_CLOUDS || pcode == LLViewerObject::LL_VO_GROUND || pcode == LLViewerObject::LL_VO_SKY) @@ -951,6 +952,9 @@ BOOL LLDrawable::isVisible() const return TRUE; } +#if 0 + //disabling this code fixes DEV-20105. Leaving in place in case some other bug pops up as a a result. + //should be safe to just always ask the spatial group for visibility. if (isActive()) { if (isRoot()) @@ -973,6 +977,7 @@ BOOL LLDrawable::isVisible() const } } else +#endif { LLSpatialGroup* group = getSpatialGroup(); if (group && group->isVisible()) @@ -1380,7 +1385,10 @@ BOOL LLDrawable::isAnimating() const { return TRUE; } - + if (mVObjp->getPCode() == LLViewerObject::LL_VO_HUD_PART_GROUP) + { + return TRUE; + } if (mVObjp->getPCode() == LLViewerObject::LL_VO_CLOUDS) { return TRUE; diff --git a/linden/indra/newview/lldrawpool.cpp b/linden/indra/newview/lldrawpool.cpp index 9d8bd0a..196f8c1 100644 --- a/linden/indra/newview/lldrawpool.cpp +++ b/linden/indra/newview/lldrawpool.cpp @@ -194,7 +194,8 @@ S32 LLFacePool::drawLoopSetTex(face_array_t& face_list, S32 stage) iter != face_list.end(); iter++) { LLFace *facep = *iter; - facep->bindTexture(stage); + gGL.getTexUnit(stage)->bind(facep->getTexture()); + gGL.getTexUnit(0)->activate(); res += facep->renderIndexed(); } } @@ -395,7 +396,7 @@ void LLRenderPass::pushBatch(LLDrawInfo& params, U32 mask, BOOL texture) { if (params.mTexture.notNull()) { - params.mTexture->bind(); + gGL.getTexUnit(0)->bind(params.mTexture.get()); if (params.mTextureMatrix) { glMatrixMode(GL_TEXTURE); @@ -406,14 +407,14 @@ void LLRenderPass::pushBatch(LLDrawInfo& params, U32 mask, BOOL texture) } else { - LLImageGL::unbindTexture(0); + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); } } if (params.mVertexBuffer.notNull()) { params.mVertexBuffer->setBuffer(mask); - params.mVertexBuffer->drawRange(LLVertexBuffer::TRIANGLES, params.mStart, params.mEnd, params.mCount, params.mOffset); + params.mVertexBuffer->drawRange(LLRender::TRIANGLES, params.mStart, params.mEnd, params.mCount, params.mOffset); gPipeline.addTrianglesDrawn(params.mCount/3); } diff --git a/linden/indra/newview/lldrawpoolalpha.cpp b/linden/indra/newview/lldrawpoolalpha.cpp index 28263b2..d997c30 100644 --- a/linden/indra/newview/lldrawpoolalpha.cpp +++ b/linden/indra/newview/lldrawpoolalpha.cpp @@ -129,7 +129,7 @@ void LLDrawPoolAlpha::render(S32 pass) gPipeline.enableLightsFullbright(LLColor4(1,1,1,1)); glColor4f(1,0,0,1); LLViewerImage::sSmokeImagep->addTextureStats(1024.f*1024.f); - LLViewerImage::sSmokeImagep->bind(); + gGL.getTexUnit(0)->bind(LLViewerImage::sSmokeImagep.get()); renderAlphaHighlight(LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD); } @@ -170,7 +170,7 @@ void LLDrawPoolAlpha::renderAlphaHighlight(U32 mask) LLRenderPass::applyModelMatrix(params); params.mVertexBuffer->setBuffer(mask); - params.mVertexBuffer->drawRange(LLVertexBuffer::TRIANGLES, params.mStart, params.mEnd, params.mCount, params.mOffset); + params.mVertexBuffer->drawRange(LLRender::TRIANGLES, params.mStart, params.mEnd, params.mCount, params.mOffset); gPipeline.addTrianglesDrawn(params.mCount/3); } } @@ -231,7 +231,7 @@ void LLDrawPoolAlpha::renderGroupAlpha(LLSpatialGroup* group, U32 type, U32 mask if (texture && params.mTexture.notNull()) { gGL.getTexUnit(0)->activate(); - params.mTexture->bind(); + gGL.getTexUnit(0)->bind(params.mTexture.get()); params.mTexture->addTextureStats(params.mVSize); if (params.mTextureMatrix) { @@ -288,7 +288,7 @@ void LLDrawPoolAlpha::renderGroupAlpha(LLSpatialGroup* group, U32 type, U32 mask } params.mVertexBuffer->setBuffer(mask); - params.mVertexBuffer->drawRange(LLVertexBuffer::TRIANGLES, params.mStart, params.mEnd, params.mCount, params.mOffset); + params.mVertexBuffer->drawRange(LLRender::TRIANGLES, params.mStart, params.mEnd, params.mCount, params.mOffset); gPipeline.addTrianglesDrawn(params.mCount/3); if (params.mTextureMatrix && texture && params.mTexture.notNull()) diff --git a/linden/indra/newview/lldrawpoolavatar.cpp b/linden/indra/newview/lldrawpoolavatar.cpp index 97ff072..a5231dd 100644 --- a/linden/indra/newview/lldrawpoolavatar.cpp +++ b/linden/indra/newview/lldrawpoolavatar.cpp @@ -396,7 +396,7 @@ void LLDrawPoolAvatar::renderAvatars(LLVOAvatar* single_avatar, S32 pass) { /* // debug code to draw a cube in place of avatar - LLGLSNoTexture gls_no_texture; + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); LLVector3 pos = avatarp->getPositionAgent(); gGL.color4f(1.0f, 0.0f, 0.0f, 0.8f); @@ -495,17 +495,17 @@ void LLDrawPoolAvatar::renderAvatars(LLVOAvatar* single_avatar, S32 pass) { if (LLVOAvatar::sShowCollisionVolumes) { - LLGLSNoTexture no_texture; + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); avatarp->renderCollisionVolumes(); } if (avatarp->mIsSelf && LLAgent::sDebugDisplayTarget) { - LLGLSNoTexture gls_no_texture; + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); LLVector3 pos = avatarp->getPositionAgent(); gGL.color4f(1.0f, 0.0f, 0.0f, 0.8f); - gGL.begin(LLVertexBuffer::LINES); + gGL.begin(LLRender::LINES); { gGL.vertex3fv((pos - LLVector3(0.2f, 0.f, 0.f)).mV); gGL.vertex3fv((pos + LLVector3(0.2f, 0.f, 0.f)).mV); @@ -517,7 +517,7 @@ void LLDrawPoolAvatar::renderAvatars(LLVOAvatar* single_avatar, S32 pass) pos = avatarp->mDrawable->getPositionAgent(); gGL.color4f(1.0f, 0.0f, 0.0f, 0.8f); - gGL.begin(LLVertexBuffer::LINES); + gGL.begin(LLRender::LINES); { gGL.vertex3fv((pos - LLVector3(0.2f, 0.f, 0.f)).mV); gGL.vertex3fv((pos + LLVector3(0.2f, 0.f, 0.f)).mV); @@ -529,7 +529,7 @@ void LLDrawPoolAvatar::renderAvatars(LLVOAvatar* single_avatar, S32 pass) pos = avatarp->mRoot.getWorldPosition(); gGL.color4f(1.0f, 1.0f, 1.0f, 0.8f); - gGL.begin(LLVertexBuffer::LINES); + gGL.begin(LLRender::LINES); { gGL.vertex3fv((pos - LLVector3(0.2f, 0.f, 0.f)).mV); gGL.vertex3fv((pos + LLVector3(0.2f, 0.f, 0.f)).mV); @@ -541,7 +541,7 @@ void LLDrawPoolAvatar::renderAvatars(LLVOAvatar* single_avatar, S32 pass) pos = avatarp->mPelvisp->getWorldPosition(); gGL.color4f(0.0f, 0.0f, 1.0f, 0.8f); - gGL.begin(LLVertexBuffer::LINES); + gGL.begin(LLRender::LINES); { gGL.vertex3fv((pos - LLVector3(0.2f, 0.f, 0.f)).mV); gGL.vertex3fv((pos + LLVector3(0.2f, 0.f, 0.f)).mV); diff --git a/linden/indra/newview/lldrawpoolbump.cpp b/linden/indra/newview/lldrawpoolbump.cpp index 0dd11d6..6593547 100644 --- a/linden/indra/newview/lldrawpoolbump.cpp +++ b/linden/indra/newview/lldrawpoolbump.cpp @@ -349,27 +349,29 @@ void LLDrawPoolBump::beginShiny(bool invisible) cube_map->setMatrix(1); // Make sure that texture coord generation happens for tex unit 1, as that's the one we use for // the cube map in the one pass shiny shaders - cube_channel = shader->enableTexture(LLViewerShaderMgr::ENVIRONMENT_MAP, GL_TEXTURE_CUBE_MAP_ARB); + cube_channel = shader->enableTexture(LLViewerShaderMgr::ENVIRONMENT_MAP, LLTexUnit::TT_CUBE_MAP); cube_map->enableTexture(cube_channel); cube_map->enableTextureCoords(1); diffuse_channel = shader->enableTexture(LLViewerShaderMgr::DIFFUSE_MAP); } else { - cube_channel = 0; + cube_channel = shader->enableTexture(LLViewerShaderMgr::ENVIRONMENT_MAP, LLTexUnit::TT_CUBE_MAP); diffuse_channel = -1; cube_map->setMatrix(0); - cube_map->enable(shader->enableTexture(LLViewerShaderMgr::ENVIRONMENT_MAP, GL_TEXTURE_CUBE_MAP_ARB)); + cube_map->enable(cube_channel); } - cube_map->bind(); + gGL.getTexUnit(cube_channel)->bind(cube_map); + gGL.getTexUnit(0)->activate(); } else { cube_channel = 0; diffuse_channel = -1; + gGL.getTexUnit(0)->disable(); cube_map->enable(0); cube_map->setMatrix(0); - cube_map->bind(); + gGL.getTexUnit(0)->bind(cube_map); gGL.getTexUnit(0)->setTextureColorBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_TEX_COLOR); gGL.getTexUnit(0)->setTextureAlphaBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_VERT_ALPHA); @@ -423,7 +425,7 @@ void LLDrawPoolBump::endShiny(bool invisible) if (!invisible && mVertexShaderLevel > 1) { - shader->disableTexture(LLViewerShaderMgr::ENVIRONMENT_MAP, GL_TEXTURE_CUBE_MAP_ARB); + shader->disableTexture(LLViewerShaderMgr::ENVIRONMENT_MAP, LLTexUnit::TT_CUBE_MAP); if (LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_OBJECT) > 0) { @@ -435,18 +437,20 @@ void LLDrawPoolBump::endShiny(bool invisible) shader->unbind(); gGL.getTexUnit(0)->activate(); - glEnable(GL_TEXTURE_2D); + gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE); } if (cube_channel >= 0) { + gGL.getTexUnit(cube_channel)->enable(LLTexUnit::TT_TEXTURE); gGL.getTexUnit(cube_channel)->setTextureBlendType(LLTexUnit::TB_MULT); } } - - gGL.getTexUnit(0)->activate(); - LLImageGL::unbindTexture(0, GL_TEXTURE_2D); + gGL.getTexUnit(diffuse_channel)->disable(); + gGL.getTexUnit(cube_channel)->disable(); + + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT); - + diffuse_channel = -1; cube_channel = 0; mShiny = FALSE; @@ -489,12 +493,14 @@ void LLDrawPoolBump::beginFullbrightShiny() cube_map->setMatrix(1); // Make sure that texture coord generation happens for tex unit 1, as that's the one we use for // the cube map in the one pass shiny shaders - cube_channel = shader->enableTexture(LLViewerShaderMgr::ENVIRONMENT_MAP, GL_TEXTURE_CUBE_MAP_ARB); + gGL.getTexUnit(1)->disable(); + cube_channel = shader->enableTexture(LLViewerShaderMgr::ENVIRONMENT_MAP, LLTexUnit::TT_CUBE_MAP); cube_map->enableTexture(cube_channel); cube_map->enableTextureCoords(1); diffuse_channel = shader->enableTexture(LLViewerShaderMgr::DIFFUSE_MAP); - cube_map->bind(); + gGL.getTexUnit(cube_channel)->bind(cube_map); + gGL.getTexUnit(0)->activate(); } mShiny = TRUE; } @@ -535,14 +541,13 @@ void LLDrawPoolBump::endFullbrightShiny() shader->disableTexture(LLViewerShaderMgr::DIFFUSE_MAP); } gGL.getTexUnit(0)->activate(); - glEnable(GL_TEXTURE_2D); + gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE); shader->unbind(); - gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT); } - LLImageGL::unbindTexture(0, GL_TEXTURE_2D); + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT); diffuse_channel = -1; @@ -561,7 +566,7 @@ void LLDrawPoolBump::renderGroup(LLSpatialGroup* group, U32 type, U32 mask, BOOL applyModelMatrix(params); params.mVertexBuffer->setBuffer(mask); - params.mVertexBuffer->drawRange(LLVertexBuffer::TRIANGLES, params.mStart, params.mEnd, params.mCount, params.mOffset); + params.mVertexBuffer->drawRange(LLRender::TRIANGLES, params.mStart, params.mEnd, params.mCount, params.mOffset); gPipeline.addTrianglesDrawn(params.mCount/3); } } @@ -599,8 +604,8 @@ BOOL LLDrawPoolBump::bindBumpMap(LLDrawInfo& params) if (bump) { - bump->bind(1); - bump->bind(0); + gGL.getTexUnit(1)->bind(bump); + gGL.getTexUnit(0)->bind(bump); return TRUE; } return FALSE; @@ -629,7 +634,7 @@ void LLDrawPoolBump::beginBump() // TEXTURE UNIT 1 gGL.getTexUnit(1)->activate(); - glEnable(GL_TEXTURE_2D); // Texture unit 1 + gGL.getTexUnit(1)->enable(LLTexUnit::TT_TEXTURE); gGL.getTexUnit(1)->setTextureColorBlend(LLTexUnit::TBO_ADD_SIGNED, LLTexUnit::TBS_PREV_COLOR, LLTexUnit::TBS_ONE_MINUS_TEX_ALPHA); gGL.getTexUnit(1)->setTextureAlphaBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_TEX_ALPHA); @@ -648,7 +653,7 @@ void LLDrawPoolBump::beginBump() gGL.getTexUnit(0)->activate(); stop_glerror(); - LLViewerImage::unbindTexture(1, GL_TEXTURE_2D); + gGL.getTexUnit(1)->unbind(LLTexUnit::TT_TEXTURE); } //static @@ -680,7 +685,7 @@ void LLDrawPoolBump::endBump() // Disable texture unit 1 gGL.getTexUnit(1)->activate(); - glDisable(GL_TEXTURE_2D); // Texture unit 1 + gGL.getTexUnit(1)->disable(); gGL.getTexUnit(1)->setTextureBlendType(LLTexUnit::TB_MULT); // Disable texture unit 0 @@ -1083,17 +1088,17 @@ void LLDrawPoolBump::pushBatch(LLDrawInfo& params, U32 mask, BOOL texture) { if (params.mTexture.notNull()) { - params.mTexture->bind(diffuse_channel); + gGL.getTexUnit(diffuse_channel)->bind(params.mTexture.get()); params.mTexture->addTextureStats(params.mVSize); } else { - LLImageGL::unbindTexture(0); + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); } } params.mVertexBuffer->setBuffer(mask); - params.mVertexBuffer->drawRange(LLVertexBuffer::TRIANGLES, params.mStart, params.mEnd, params.mCount, params.mOffset); + params.mVertexBuffer->drawRange(LLRender::TRIANGLES, params.mStart, params.mEnd, params.mCount, params.mOffset); gPipeline.addTrianglesDrawn(params.mCount/3); if (params.mTextureMatrix) { diff --git a/linden/indra/newview/lldrawpoolground.cpp b/linden/indra/newview/lldrawpoolground.cpp index 5698027..c8d110b 100644 --- a/linden/indra/newview/lldrawpoolground.cpp +++ b/linden/indra/newview/lldrawpoolground.cpp @@ -63,13 +63,14 @@ void LLDrawPoolGround::prerender() void LLDrawPoolGround::render(S32 pass) { - if (mDrawFace.empty()) + if (mDrawFace.empty() || !gSavedSettings.getBOOL("RenderGround")) { return; } LLGLSPipelineSkyBox gls_skybox; - LLImageGL::unbindTexture(0, GL_TEXTURE_2D); + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); + LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE); LLGLClampToFarClip far_clip(glh_get_current_projection()); diff --git a/linden/indra/newview/lldrawpoolsky.cpp b/linden/indra/newview/lldrawpoolsky.cpp index e1dbf95..573061d 100644 --- a/linden/indra/newview/lldrawpoolsky.cpp +++ b/linden/indra/newview/lldrawpoolsky.cpp @@ -186,7 +186,7 @@ void LLDrawPoolSky::renderHeavenlyBody(U8 hb, LLFace* face) if (! face->getGeomCount()) return; LLImageGL* tex = face->getTexture(); - tex->bind(); + gGL.getTexUnit(0)->bind(tex); LLColor4 color(mHB[hb]->getInterpColor()); LLOverrideFaceColor override(this, color); face->renderIndexed(); @@ -200,7 +200,7 @@ void LLDrawPoolSky::renderSunHalo(LLFace* face) if (! face->getGeomCount()) return; LLImageGL* tex = face->getTexture(); - tex->bind(); + gGL.getTexUnit(0)->bind(tex); LLColor4 color(mHB[0]->getInterpColor()); color.mV[3] = llclamp(mHB[0]->getHaloBrighness(), 0.f, 1.f); diff --git a/linden/indra/newview/lldrawpoolterrain.cpp b/linden/indra/newview/lldrawpoolterrain.cpp index ccfbd2d..e99fc91 100644 --- a/linden/indra/newview/lldrawpoolterrain.cpp +++ b/linden/indra/newview/lldrawpoolterrain.cpp @@ -72,19 +72,19 @@ LLDrawPoolTerrain::LLDrawPoolTerrain(LLViewerImage *texturep) : TRUE, TRUE, GL_ALPHA8, GL_ALPHA, LLUUID("e97cf410-8e61-7005-ec06-629eba4cd1fb")); - mAlphaRampImagep->bind(0); + gGL.getTexUnit(0)->bind(mAlphaRampImagep.get()); mAlphaRampImagep->setClamp(TRUE, TRUE); m2DAlphaRampImagep = gImageList.getImageFromFile("alpha_gradient_2d.j2c", TRUE, TRUE, GL_ALPHA8, GL_ALPHA, LLUUID("38b86f85-2575-52a9-a531-23108d8da837")); - m2DAlphaRampImagep->bind(0); + gGL.getTexUnit(0)->bind(m2DAlphaRampImagep.get()); m2DAlphaRampImagep->setClamp(TRUE, TRUE); mTexturep->setBoostLevel(LLViewerImage::BOOST_TERRAIN); - LLImageGL::unbindTexture(0, GL_TEXTURE_2D); + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); } LLDrawPoolTerrain::~LLDrawPoolTerrain() @@ -240,7 +240,7 @@ void LLDrawPoolTerrain::renderFullShader() // detail texture 0 // S32 detail0 = sShader->enableTexture(LLViewerShaderMgr::TERRAIN_DETAIL0); - LLViewerImage::bindTexture(detail_texture0p,detail0); + gGL.getTexUnit(detail0)->bind(detail_texture0p); gGL.getTexUnit(0)->activate(); glEnable(GL_TEXTURE_GEN_S); @@ -258,7 +258,7 @@ void LLDrawPoolTerrain::renderFullShader() // detail texture 1 // S32 detail1 = sShader->enableTexture(LLViewerShaderMgr::TERRAIN_DETAIL1); - LLViewerImage::bindTexture(detail_texture1p,detail1); + gGL.getTexUnit(detail1)->bind(detail_texture1p); /// ALPHA TEXTURE COORDS 0: gGL.getTexUnit(1)->activate(); @@ -269,11 +269,11 @@ void LLDrawPoolTerrain::renderFullShader() // detail texture 2 // S32 detail2 = sShader->enableTexture(LLViewerShaderMgr::TERRAIN_DETAIL2); - LLViewerImage::bindTexture(detail_texture2p,detail2); - glEnable(GL_TEXTURE_2D); + gGL.getTexUnit(detail2)->bind(detail_texture2p); + + gGL.getTexUnit(2)->activate(); /// ALPHA TEXTURE COORDS 1: - gGL.getTexUnit(2)->activate(); glMatrixMode(GL_TEXTURE); glLoadIdentity(); glTranslatef(-2.f, 0.f, 0.f); @@ -283,7 +283,7 @@ void LLDrawPoolTerrain::renderFullShader() // detail texture 3 // S32 detail3 = sShader->enableTexture(LLViewerShaderMgr::TERRAIN_DETAIL3); - LLViewerImage::bindTexture(detail_texture3p,detail3); + gGL.getTexUnit(detail3)->bind(detail_texture3p); /// ALPHA TEXTURE COORDS 2: gGL.getTexUnit(3)->activate(); @@ -296,7 +296,7 @@ void LLDrawPoolTerrain::renderFullShader() // Alpha Ramp // S32 alpha_ramp = sShader->enableTexture(LLViewerShaderMgr::TERRAIN_ALPHARAMP); - LLViewerImage::bindTexture(m2DAlphaRampImagep,alpha_ramp); + gGL.getTexUnit(alpha_ramp)->bind(m2DAlphaRampImagep.get()); // GL_BLEND disabled by default drawLoop(); @@ -308,36 +308,36 @@ void LLDrawPoolTerrain::renderFullShader() sShader->disableTexture(LLViewerShaderMgr::TERRAIN_DETAIL2); sShader->disableTexture(LLViewerShaderMgr::TERRAIN_DETAIL3); - LLImageGL::unbindTexture(alpha_ramp, GL_TEXTURE_2D); + gGL.getTexUnit(alpha_ramp)->unbind(LLTexUnit::TT_TEXTURE); + gGL.getTexUnit(4)->disable(); gGL.getTexUnit(4)->activate(); - glDisable(GL_TEXTURE_2D); // Texture unit 4 glDisable(GL_TEXTURE_GEN_S); glDisable(GL_TEXTURE_GEN_T); glMatrixMode(GL_TEXTURE); glLoadIdentity(); glMatrixMode(GL_MODELVIEW); - LLImageGL::unbindTexture(detail3, GL_TEXTURE_2D); + gGL.getTexUnit(detail3)->unbind(LLTexUnit::TT_TEXTURE); + gGL.getTexUnit(3)->disable(); gGL.getTexUnit(3)->activate(); - glDisable(GL_TEXTURE_2D); glDisable(GL_TEXTURE_GEN_S); glDisable(GL_TEXTURE_GEN_T); glMatrixMode(GL_TEXTURE); glLoadIdentity(); glMatrixMode(GL_MODELVIEW); - LLImageGL::unbindTexture(detail2, GL_TEXTURE_2D); + gGL.getTexUnit(detail2)->unbind(LLTexUnit::TT_TEXTURE); + gGL.getTexUnit(2)->disable(); gGL.getTexUnit(2)->activate(); - glDisable(GL_TEXTURE_2D); glDisable(GL_TEXTURE_GEN_S); glDisable(GL_TEXTURE_GEN_T); glMatrixMode(GL_TEXTURE); glLoadIdentity(); glMatrixMode(GL_MODELVIEW); - LLImageGL::unbindTexture(detail1, GL_TEXTURE_2D); + gGL.getTexUnit(detail1)->unbind(LLTexUnit::TT_TEXTURE); + gGL.getTexUnit(1)->disable(); gGL.getTexUnit(1)->activate(); - glDisable(GL_TEXTURE_2D); glDisable(GL_TEXTURE_GEN_S); glDisable(GL_TEXTURE_GEN_T); glMatrixMode(GL_TEXTURE); @@ -347,9 +347,9 @@ void LLDrawPoolTerrain::renderFullShader() //---------------------------------------------------------------------------- // Restore Texture Unit 0 defaults - LLImageGL::unbindTexture(detail0, GL_TEXTURE_2D); + gGL.getTexUnit(detail0)->unbind(LLTexUnit::TT_TEXTURE); + gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE); gGL.getTexUnit(0)->activate(); - glEnable(GL_TEXTURE_2D); glDisable(GL_TEXTURE_GEN_S); glDisable(GL_TEXTURE_GEN_T); glMatrixMode(GL_TEXTURE); @@ -388,7 +388,7 @@ void LLDrawPoolTerrain::renderFull4TU() // Stage 0: detail texture 0 // gGL.getTexUnit(0)->activate(); - LLViewerImage::bindTexture(detail_texture0p,0); + gGL.getTexUnit(0)->bind(detail_texture0p); glClientActiveTextureARB(GL_TEXTURE0_ARB); glEnable(GL_TEXTURE_GEN_S); @@ -405,9 +405,9 @@ void LLDrawPoolTerrain::renderFull4TU() // Stage 1: Generate alpha ramp for detail0/detail1 transition // - LLViewerImage::bindTexture(m2DAlphaRampImagep,1); + gGL.getTexUnit(1)->bind(m2DAlphaRampImagep.get()); + gGL.getTexUnit(1)->enable(LLTexUnit::TT_TEXTURE); gGL.getTexUnit(1)->activate(); - glEnable(GL_TEXTURE_2D); // Texture unit 1 glClientActiveTextureARB(GL_TEXTURE1_ARB); glEnableClientState(GL_TEXTURE_COORD_ARRAY); @@ -418,12 +418,13 @@ void LLDrawPoolTerrain::renderFull4TU() // // Stage 2: Interpolate detail1 with existing based on ramp // - LLViewerImage::bindTexture(detail_texture1p,2); + gGL.getTexUnit(2)->bind(detail_texture1p); + gGL.getTexUnit(2)->enable(LLTexUnit::TT_TEXTURE); gGL.getTexUnit(2)->activate(); - glEnable(GL_TEXTURE_2D); // Texture unit 2 - glClientActiveTextureARB(GL_TEXTURE2_ARB); + glClientActiveTextureARB(GL_TEXTURE2_ARB); glDisableClientState(GL_TEXTURE_COORD_ARRAY); + glEnable(GL_TEXTURE_GEN_S); glEnable(GL_TEXTURE_GEN_T); glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR); @@ -436,9 +437,9 @@ void LLDrawPoolTerrain::renderFull4TU() // // Stage 3: Modulate with primary (vertex) color for lighting // - LLViewerImage::bindTexture(detail_texture1p,3); // bind any texture + gGL.getTexUnit(3)->bind(detail_texture1p); + gGL.getTexUnit(3)->enable(LLTexUnit::TT_TEXTURE); gGL.getTexUnit(3)->activate(); - glEnable(GL_TEXTURE_2D); // Texture unit 3 glClientActiveTextureARB(GL_TEXTURE3_ARB); // Set alpha texture and do lighting modulation @@ -456,7 +457,7 @@ void LLDrawPoolTerrain::renderFull4TU() // Stage 0: Write detail3 into base // gGL.getTexUnit(0)->activate(); - LLViewerImage::bindTexture(detail_texture3p,0); + gGL.getTexUnit(0)->bind(detail_texture3p); glClientActiveTextureARB(GL_TEXTURE0_ARB); glDisableClientState(GL_TEXTURE_COORD_ARRAY); @@ -472,9 +473,9 @@ void LLDrawPoolTerrain::renderFull4TU() // // Stage 1: Generate alpha ramp for detail2/detail3 transition // - LLViewerImage::bindTexture(m2DAlphaRampImagep,1); + gGL.getTexUnit(1)->bind(m2DAlphaRampImagep.get()); + gGL.getTexUnit(1)->enable(LLTexUnit::TT_TEXTURE); gGL.getTexUnit(1)->activate(); - glEnable(GL_TEXTURE_2D); // Texture unit 1 glClientActiveTextureARB(GL_TEXTURE1_ARB); glEnableClientState(GL_TEXTURE_COORD_ARRAY); @@ -492,9 +493,9 @@ void LLDrawPoolTerrain::renderFull4TU() // // Stage 2: Interpolate detail2 with existing based on ramp // - LLViewerImage::bindTexture(detail_texture2p,2); + gGL.getTexUnit(2)->bind(detail_texture2p); + gGL.getTexUnit(2)->enable(LLTexUnit::TT_TEXTURE); gGL.getTexUnit(2)->activate(); - glEnable(GL_TEXTURE_2D); // Texture unit 2 glClientActiveTextureARB(GL_TEXTURE2_ARB); glDisableClientState(GL_TEXTURE_COORD_ARRAY); @@ -511,9 +512,9 @@ void LLDrawPoolTerrain::renderFull4TU() // // Stage 3: Generate alpha ramp for detail1/detail2 transition // - LLViewerImage::bindTexture(m2DAlphaRampImagep,3); + gGL.getTexUnit(3)->bind(m2DAlphaRampImagep.get()); + gGL.getTexUnit(3)->enable(LLTexUnit::TT_TEXTURE); gGL.getTexUnit(3)->activate(); - glEnable(GL_TEXTURE_2D); // Texture unit 3 glClientActiveTextureARB(GL_TEXTURE3_ARB); glEnableClientState(GL_TEXTURE_COORD_ARRAY); @@ -536,21 +537,21 @@ void LLDrawPoolTerrain::renderFull4TU() LLVertexBuffer::unbind(); // Disable multitexture - LLImageGL::unbindTexture(3, GL_TEXTURE_2D); + gGL.getTexUnit(3)->unbind(LLTexUnit::TT_TEXTURE); + gGL.getTexUnit(3)->disable(); gGL.getTexUnit(3)->activate(); glClientActiveTextureARB(GL_TEXTURE3_ARB); glDisableClientState(GL_TEXTURE_COORD_ARRAY); - glDisable(GL_TEXTURE_2D); // Texture unit 3 glMatrixMode(GL_TEXTURE); glLoadIdentity(); glMatrixMode(GL_MODELVIEW); - LLImageGL::unbindTexture(2, GL_TEXTURE_2D); + gGL.getTexUnit(2)->unbind(LLTexUnit::TT_TEXTURE); + gGL.getTexUnit(2)->disable(); gGL.getTexUnit(2)->activate(); glClientActiveTextureARB(GL_TEXTURE2_ARB); glDisableClientState(GL_TEXTURE_COORD_ARRAY); - glDisable(GL_TEXTURE_2D); // Texture unit 2 glDisable(GL_TEXTURE_GEN_S); glDisable(GL_TEXTURE_GEN_T); @@ -558,11 +559,11 @@ void LLDrawPoolTerrain::renderFull4TU() glLoadIdentity(); glMatrixMode(GL_MODELVIEW); - LLImageGL::unbindTexture(1, GL_TEXTURE_2D); + gGL.getTexUnit(1)->unbind(LLTexUnit::TT_TEXTURE); + gGL.getTexUnit(1)->disable(); gGL.getTexUnit(1)->activate(); glClientActiveTextureARB(GL_TEXTURE1_ARB); glDisableClientState(GL_TEXTURE_COORD_ARRAY); - glDisable(GL_TEXTURE_2D); // Texture unit 1 glMatrixMode(GL_TEXTURE); glLoadIdentity(); @@ -575,9 +576,9 @@ void LLDrawPoolTerrain::renderFull4TU() // Restore Texture Unit 0 defaults gGL.getTexUnit(0)->activate(); - LLImageGL::unbindTexture(0, GL_TEXTURE_2D); + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); + glClientActiveTextureARB(GL_TEXTURE0_ARB); - gGL.getTexUnit(0)->activate(); glDisableClientState(GL_NORMAL_ARRAY); glDisable(GL_TEXTURE_GEN_S); @@ -616,7 +617,7 @@ void LLDrawPoolTerrain::renderFull2TU() // // Stage 0: Render detail 0 into base // - LLViewerImage::bindTexture(detail_texture0p,0); + gGL.getTexUnit(0)->bind(detail_texture0p); glEnable(GL_TEXTURE_GEN_S); glEnable(GL_TEXTURE_GEN_T); glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR); @@ -635,7 +636,7 @@ void LLDrawPoolTerrain::renderFull2TU() // // Stage 0: Generate alpha ramp for detail0/detail1 transition // - LLViewerImage::bindTexture(m2DAlphaRampImagep,0); + gGL.getTexUnit(0)->bind(m2DAlphaRampImagep.get()); glDisable(GL_TEXTURE_GEN_S); glDisable(GL_TEXTURE_GEN_T); @@ -648,9 +649,9 @@ void LLDrawPoolTerrain::renderFull2TU() // // Stage 1: Write detail1 // - LLViewerImage::bindTexture(detail_texture1p,1); // Texture unit 1 + gGL.getTexUnit(1)->bind(detail_texture1p); + gGL.getTexUnit(1)->enable(LLTexUnit::TT_TEXTURE); gGL.getTexUnit(1)->activate(); - glEnable(GL_TEXTURE_2D); // Texture unit 1 glEnable(GL_TEXTURE_GEN_S); glEnable(GL_TEXTURE_GEN_T); @@ -673,7 +674,7 @@ void LLDrawPoolTerrain::renderFull2TU() // // Stage 0: Generate alpha ramp for detail1/detail2 transition // - LLViewerImage::bindTexture(m2DAlphaRampImagep,0); + gGL.getTexUnit(0)->bind(m2DAlphaRampImagep.get()); // Set the texture matrix glMatrixMode(GL_TEXTURE); @@ -687,9 +688,9 @@ void LLDrawPoolTerrain::renderFull2TU() // // Stage 1: Write detail2 // - LLViewerImage::bindTexture(detail_texture2p,1); + gGL.getTexUnit(1)->bind(detail_texture2p); + gGL.getTexUnit(1)->enable(LLTexUnit::TT_TEXTURE); gGL.getTexUnit(1)->activate(); - glEnable(GL_TEXTURE_2D); // Texture unit 1 glEnable(GL_TEXTURE_GEN_S); glEnable(GL_TEXTURE_GEN_T); @@ -713,7 +714,7 @@ void LLDrawPoolTerrain::renderFull2TU() // Stage 0: Generate alpha ramp for detail2/detail3 transition // gGL.getTexUnit(0)->activate(); - LLViewerImage::bindTexture(m2DAlphaRampImagep,0); + gGL.getTexUnit(0)->bind(m2DAlphaRampImagep.get()); // Set the texture matrix glMatrixMode(GL_TEXTURE); glLoadIdentity(); @@ -724,9 +725,9 @@ void LLDrawPoolTerrain::renderFull2TU() gGL.getTexUnit(0)->setTextureAlphaBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_TEX_ALPHA); // Stage 1: Write detail3 - LLViewerImage::bindTexture(detail_texture3p,1); + gGL.getTexUnit(1)->bind(detail_texture3p); + gGL.getTexUnit(1)->enable(LLTexUnit::TT_TEXTURE); gGL.getTexUnit(1)->activate(); - glEnable(GL_TEXTURE_2D); // Texture unit 1 glEnable(GL_TEXTURE_GEN_S); glEnable(GL_TEXTURE_GEN_T); @@ -749,9 +750,9 @@ void LLDrawPoolTerrain::renderFull2TU() // Disable multitexture - LLImageGL::unbindTexture(1, GL_TEXTURE_2D); + gGL.getTexUnit(1)->unbind(LLTexUnit::TT_TEXTURE); + gGL.getTexUnit(1)->disable(); gGL.getTexUnit(1)->activate(); - glDisable(GL_TEXTURE_2D); // Texture unit 1 glDisable(GL_TEXTURE_GEN_S); glDisable(GL_TEXTURE_GEN_T); @@ -763,9 +764,8 @@ void LLDrawPoolTerrain::renderFull2TU() // Restore Texture Unit 0 defaults gGL.getTexUnit(0)->activate(); - LLImageGL::unbindTexture(0, GL_TEXTURE_2D); + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - gGL.getTexUnit(0)->activate(); glDisable(GL_TEXTURE_GEN_S); glDisable(GL_TEXTURE_GEN_T); glMatrixMode(GL_TEXTURE); @@ -784,10 +784,10 @@ void LLDrawPoolTerrain::renderSimple() // Stage 0: Base terrain texture pass mTexturep->addTextureStats(1024.f*1024.f); - mTexturep->bind(0); gGL.getTexUnit(0)->activate(); - glEnable(GL_TEXTURE_2D); // Texture unit 2 + gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE); + gGL.getTexUnit(0)->bind(mTexturep.get()); LLVector3 origin_agent = mDrawFace[0]->getDrawable()->getVObj()->getRegion()->getOriginAgent(); F32 tscale = 1.f/256.f; @@ -808,8 +808,8 @@ void LLDrawPoolTerrain::renderSimple() //---------------------------------------------------------------------------- // Restore Texture Unit 0 defaults - LLImageGL::unbindTexture(0, GL_TEXTURE_2D); gGL.getTexUnit(0)->activate(); + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); glDisable(GL_TEXTURE_GEN_S); glDisable(GL_TEXTURE_GEN_T); glMatrixMode(GL_TEXTURE); @@ -839,7 +839,7 @@ void LLDrawPoolTerrain::renderOwnership() LLViewerParcelOverlay *overlayp = regionp->getParcelOverlay(); LLImageGL *texturep = overlayp->getTexture(); - LLViewerImage::bindTexture(texturep); + gGL.getTexUnit(0)->bind(texturep); // *NOTE: Because the region is 256 meters wide, but has 257 pixels, the // texture coordinates for pixel 256x256 is not 1,1. This makes the @@ -872,7 +872,7 @@ void LLDrawPoolTerrain::renderForSelect() } - LLImageGL::unbindTexture(0); + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); for (std::vector::iterator iter = mDrawFace.begin(); iter != mDrawFace.end(); iter++) diff --git a/linden/indra/newview/lldrawpooltree.cpp b/linden/indra/newview/lldrawpooltree.cpp index fd178dc..40ba54a 100644 --- a/linden/indra/newview/lldrawpooltree.cpp +++ b/linden/indra/newview/lldrawpooltree.cpp @@ -50,7 +50,7 @@ LLDrawPoolTree::LLDrawPoolTree(LLViewerImage *texturep) : LLFacePool(POOL_TREE), mTexturep(texturep) { - mTexturep->bind(0); + gGL.getTexUnit(0)->bind(mTexturep.get()); mTexturep->setClamp(FALSE, FALSE); } @@ -124,6 +124,7 @@ void LLDrawPoolTree::renderForSelect() LLOverrideFaceColor color(this, 1.f, 1.f, 1.f, 1.f); LLGLSObjectSelectAlpha gls_alpha; + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); gGL.setSceneBlendType(LLRender::BT_REPLACE); gGL.setAlphaRejectSettings(LLRender::CF_GREATER, 0.5f); @@ -144,7 +145,7 @@ void LLDrawPoolTree::renderTree(BOOL selecting) LLGLState normalize(GL_NORMALIZE, TRUE); // Bind the texture for this tree. - LLViewerImage::bindTexture(mTexturep,sDiffTex); + gGL.getTexUnit(sDiffTex)->bind(mTexturep.get()); U32 indices_drawn = 0; diff --git a/linden/indra/newview/lldrawpoolwater.cpp b/linden/indra/newview/lldrawpoolwater.cpp index d8303bd..6e2c42a 100644 --- a/linden/indra/newview/lldrawpoolwater.cpp +++ b/linden/indra/newview/lldrawpoolwater.cpp @@ -68,11 +68,11 @@ LLDrawPoolWater::LLDrawPoolWater() : LLFacePool(POOL_WATER) { mHBTex[0] = gImageList.getImage(gSunTextureID, TRUE, TRUE); - mHBTex[0]->bind(); + gGL.getTexUnit(0)->bind(mHBTex[0].get()); mHBTex[0]->setClamp(TRUE, TRUE); mHBTex[1] = gImageList.getImage(gMoonTextureID, TRUE, TRUE); - mHBTex[1]->bind(); + gGL.getTexUnit(0)->bind(mHBTex[1].get()); mHBTex[1]->setClamp(TRUE, TRUE); mWaterImagep = gImageList.getImage(WATER_TEST); @@ -166,10 +166,9 @@ void LLDrawPoolWater::render(S32 pass) // Set up second pass first mWaterImagep->addTextureStats(1024.f*1024.f); - mWaterImagep->bind(1); gGL.getTexUnit(1)->activate(); - - glEnable(GL_TEXTURE_2D); // Texture unit 1 + gGL.getTexUnit(1)->enable(LLTexUnit::TT_TEXTURE); + gGL.getTexUnit(1)->bind(mWaterImagep.get()); LLVector3 camera_up = LLViewerCamera::getInstance()->getUpAxis(); F32 up_dot = camera_up * LLVector3::z_axis; @@ -218,20 +217,20 @@ void LLDrawPoolWater::render(S32 pass) { continue; } - face->bindTexture(); + gGL.getTexUnit(0)->bind(face->getTexture()); face->renderIndexed(); } // Now, disable texture coord generation on texture state 1 gGL.getTexUnit(1)->activate(); - glDisable(GL_TEXTURE_2D); // Texture unit 1 + gGL.getTexUnit(1)->unbind(LLTexUnit::TT_TEXTURE); + gGL.getTexUnit(1)->disable(); glDisable(GL_TEXTURE_GEN_S); //texture unit 1 glDisable(GL_TEXTURE_GEN_T); //texture unit 1 - LLImageGL::unbindTexture(1, GL_TEXTURE_2D); // Disable texture coordinate and color arrays gGL.getTexUnit(0)->activate(); - LLImageGL::unbindTexture(0, GL_TEXTURE_2D); + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); stop_glerror(); @@ -275,8 +274,9 @@ void LLDrawPoolWater::render(S32 pass) { gSky.mVOSkyp->getCubeMap()->disable(); } - LLImageGL::unbindTexture(0, GL_TEXTURE_2D); - glEnable(GL_TEXTURE_2D); + + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); + gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE); glMatrixMode(GL_TEXTURE); glLoadIdentity(); glMatrixMode(GL_MODELVIEW); @@ -316,7 +316,7 @@ void LLDrawPoolWater::renderReflection(LLFace* face) LLGLSNoFog noFog; - LLViewerImage::bindTexture(mHBTex[dr]); + gGL.getTexUnit(0)->bind(mHBTex[dr].get()); LLOverrideFaceColor override(this, face->getFaceColor().mV); face->renderIndexed(); @@ -390,7 +390,7 @@ void LLDrawPoolWater::shade() if (reftex > -1) { gGL.getTexUnit(reftex)->activate(); - gPipeline.mWaterRef.bindTexture(); + gGL.getTexUnit(reftex)->bind(&gPipeline.mWaterRef); gGL.getTexUnit(0)->activate(); } @@ -406,7 +406,7 @@ void LLDrawPoolWater::shade() } mWaterNormp->addTextureStats(1024.f*1024.f); - mWaterNormp->bind(bumpTex); + gGL.getTexUnit(bumpTex)->bind(mWaterNormp.get()); mWaterNormp->setMipFilterNearest (mWaterNormp->getMipFilterNearest(), !gSavedSettings.getBOOL("RenderWaterMipNormal")); @@ -421,8 +421,8 @@ void LLDrawPoolWater::shade() shader->uniform1f(LLViewerShaderMgr::WATER_FOGDENSITY, param_mgr->getFogDensity()); } - - gPipeline.mWaterDis.bindTexture(); + + gGL.getTexUnit(screentex)->bind(&gPipeline.mWaterDis); if (mVertexShaderLevel == 1) { @@ -502,7 +502,7 @@ void LLDrawPoolWater::shade() } LLVOWater* water = (LLVOWater*) face->getViewerObject(); - face->bindTexture(diffTex); + gGL.getTexUnit(diffTex)->bind(face->getTexture()); sNeedsReflectionUpdate = TRUE; @@ -527,7 +527,7 @@ void LLDrawPoolWater::shade() } } - shader->disableTexture(LLViewerShaderMgr::ENVIRONMENT_MAP, GL_TEXTURE_CUBE_MAP_ARB); + shader->disableTexture(LLViewerShaderMgr::ENVIRONMENT_MAP, LLTexUnit::TT_CUBE_MAP); shader->disableTexture(LLViewerShaderMgr::WATER_SCREENTEX); shader->disableTexture(LLViewerShaderMgr::BUMP_MAP); shader->disableTexture(LLViewerShaderMgr::DIFFUSE_MAP); @@ -536,7 +536,7 @@ void LLDrawPoolWater::shade() shader->unbind(); gGL.getTexUnit(0)->activate(); - glEnable(GL_TEXTURE_2D); + gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE); gGL.setColorMask(true, false); } diff --git a/linden/indra/newview/lldrawpoolwlsky.cpp b/linden/indra/newview/lldrawpoolwlsky.cpp index 8802c1f..a8495d5 100644 --- a/linden/indra/newview/lldrawpoolwlsky.cpp +++ b/linden/indra/newview/lldrawpoolwlsky.cpp @@ -159,7 +159,7 @@ void LLDrawPoolWLSky::renderStars(void) const // *NOTE: have to have bound the cloud noise texture already since register // combiners blending below requires something to be bound // and we might as well only bind once. - //LLGLEnable gl_texture_2d(GL_TEXTURE_2D); + //gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE); gPipeline.disableLights(); @@ -202,7 +202,8 @@ void LLDrawPoolWLSky::renderSkyClouds(F32 camHeightLocal) const LLGLSBlendFunc blendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT); - sCloudNoiseTexture->bind(); + gGL.getTexUnit(0)->bind(sCloudNoiseTexture); + shader->bind(); /// Render the skydome @@ -223,7 +224,7 @@ void LLDrawPoolWLSky::renderHeavenlyBodies() if (gSky.mVOSkyp->getSun().getDraw() && face->getGeomCount()) { LLImageGL * tex = face->getTexture(); - tex->bind(); + gGL.getTexUnit(0)->bind(tex); LLColor4 color(gSky.mVOSkyp->getSun().getInterpColor()); LLFacePool::LLOverrideFaceColor color_override(this, color); face->renderIndexed(); @@ -238,7 +239,7 @@ void LLDrawPoolWLSky::renderHeavenlyBodies() // stars register combiners, we bind again here for defensive reasons, // since LLImageGL::bind detects that it's a noop, and optimizes it out. LLImageGL * tex = face->getTexture(); - tex->bind(); + gGL.getTexUnit(0)->bind(tex); LLColor4 color(gSky.mVOSkyp->getMoon().getInterpColor()); F32 a = gSky.mVOSkyp->getMoon().getDirection().mV[2]; if (a > 0.f) @@ -280,7 +281,7 @@ void LLDrawPoolWLSky::render(S32 pass) // renderStars() requires something to be bound and we might as well only // bind the moon's texture once. LLImageGL * tex = gSky.mVOSkyp->mFace[LLVOSky::FACE_MOON]->getTexture(); - tex->bind(); + gGL.getTexUnit(0)->bind(tex); renderHeavenlyBodies(); @@ -291,7 +292,7 @@ void LLDrawPoolWLSky::render(S32 pass) renderSkyClouds(camHeightLocal); - LLImageGL::unbindTexture(0); + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); } void LLDrawPoolWLSky::prerender() diff --git a/linden/indra/newview/lldynamictexture.cpp b/linden/indra/newview/lldynamictexture.cpp index ad0cdec..9ce4515 100644 --- a/linden/indra/newview/lldynamictexture.cpp +++ b/linden/indra/newview/lldynamictexture.cpp @@ -32,7 +32,6 @@ #include "llviewerprecompiledheaders.h" #include "lldynamictexture.h" -#include "llimagegl.h" #include "llglheaders.h" #include "llviewerwindow.h" #include "llviewercamera.h" @@ -105,7 +104,7 @@ void LLDynamicTexture::generateGLTexture(LLGLint internal_format, LLGLenum prima } releaseGLTexture(); LLPointer raw_image = new LLImageRaw(mWidth, mHeight, mComponents); - mTexture = new LLImageGL(mWidth, mHeight, mComponents, FALSE); + mTexture = new LLViewerImage(mWidth, mHeight, mComponents, FALSE); if (internal_format >= 0) { mTexture->setExplicitFormat(internal_format, primary_format, type_format, swap_bytes); @@ -113,6 +112,7 @@ void LLDynamicTexture::generateGLTexture(LLGLint internal_format, LLGLenum prima // llinfos << "ALLOCATING " << (mWidth*mHeight*mComponents)/1024 << "K" << llendl; mTexture->createGLTexture(0, raw_image); mTexture->setClamp(mClamp, mClamp); + mTexture->setInitialized(false); } //----------------------------------------------------------------------------- @@ -144,7 +144,7 @@ void LLDynamicTexture::preRender(BOOL clear_depth) mOrigin.mY = llmax(mOrigin.mY, 0) ; } - LLImageGL::unbindTexture(0, GL_TEXTURE_2D); + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); } // Set up camera mCamera.setOrigin(*LLViewerCamera::getInstance()); @@ -184,19 +184,6 @@ void LLDynamicTexture::postRender(BOOL success) } //----------------------------------------------------------------------------- -// bindTexture() -//----------------------------------------------------------------------------- -void LLDynamicTexture::bindTexture() -{ - LLViewerImage::bindTexture(mTexture,0); -} - -void LLDynamicTexture::unbindTexture() -{ - LLImageGL::unbindTexture(0, GL_TEXTURE_2D); -} - -//----------------------------------------------------------------------------- // static // updateDynamicTextures() // Calls update on each dynamic texture. Calls each group in order: "first," then "middle," then "last." diff --git a/linden/indra/newview/lldynamictexture.h b/linden/indra/newview/lldynamictexture.h index 6069940..ff3e5c1 100644 --- a/linden/indra/newview/lldynamictexture.h +++ b/linden/indra/newview/lldynamictexture.h @@ -60,8 +60,8 @@ public: virtual void preRender(BOOL clear_depth = TRUE); virtual BOOL render(); virtual void postRender(BOOL success); - virtual void bindTexture(); - virtual void unbindTexture(); + + LLImageGL* getTexture(void) const { return mTexture; } static BOOL updateAllInstances(); diff --git a/linden/indra/newview/llface.cpp b/linden/indra/newview/llface.cpp index 5b43fcd..3b5f8ab 100644 --- a/linden/indra/newview/llface.cpp +++ b/linden/indra/newview/llface.cpp @@ -362,10 +362,10 @@ void LLFace::renderForSelect(U32 data_mask) switch (getPoolType()) { case LLDrawPool::POOL_ALPHA: - getTexture()->bind(); + gGL.getTexUnit(0)->bind(getTexture()); break; default: - LLImageGL::unbindTexture(0); + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); break; } } @@ -390,19 +390,19 @@ void LLFace::renderForSelect(U32 data_mask) { glPushMatrix(); glMultMatrixf((float*) mDrawablep->getRegion()->mRenderMatrix.mMatrix); - mVertexBuffer->draw(LLVertexBuffer::TRIANGLES, mIndicesCount, mIndicesIndex); + mVertexBuffer->draw(LLRender::TRIANGLES, mIndicesCount, mIndicesIndex); glPopMatrix(); } else { - mVertexBuffer->draw(LLVertexBuffer::TRIANGLES, mIndicesCount, mIndicesIndex); + mVertexBuffer->draw(LLRender::TRIANGLES, mIndicesCount, mIndicesIndex); } } else { glPushMatrix(); glMultMatrixf((float*)getRenderMatrix().mMatrix); - mVertexBuffer->draw(LLVertexBuffer::TRIANGLES, mIndicesCount, mIndicesIndex); + mVertexBuffer->draw(LLRender::TRIANGLES, mIndicesCount, mIndicesIndex); glPopMatrix(); } } @@ -419,7 +419,7 @@ void LLFace::renderSelected(LLImageGL *imagep, const LLColor4& color) if (mGeomCount > 0 && mIndicesCount > 0) { - LLViewerImage::bindTexture(imagep); + gGL.getTexUnit(0)->bind(imagep); gGL.pushMatrix(); if (mDrawablep->isActive()) @@ -438,7 +438,7 @@ void LLFace::renderSelected(LLImageGL *imagep, const LLColor4& color) #if !LL_RELEASE_FOR_DOWNLOAD LLGLState::checkClientArrays("", LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD); #endif - mVertexBuffer->draw(LLVertexBuffer::TRIANGLES, mIndicesCount, mIndicesIndex); + mVertexBuffer->draw(LLRender::TRIANGLES, mIndicesCount, mIndicesIndex); unsetFaceColor(); gGL.popMatrix(); @@ -1203,7 +1203,7 @@ S32 LLFace::pushVertices(const U16* index_array) const { if (mIndicesCount) { - mVertexBuffer->drawRange(LLVertexBuffer::TRIANGLES, mGeomIndex, mGeomIndex+mGeomCount-1, mIndicesCount, mIndicesIndex); + mVertexBuffer->drawRange(LLRender::TRIANGLES, mGeomIndex, mGeomIndex+mGeomCount-1, mIndicesCount, mIndicesIndex); gPipeline.addTrianglesDrawn(mIndicesCount/3); } diff --git a/linden/indra/newview/llface.h b/linden/indra/newview/llface.h index 0501dcc..497b93c 100644 --- a/linden/indra/newview/llface.h +++ b/linden/indra/newview/llface.h @@ -101,7 +101,6 @@ public: void setPixelArea(F32 area) { mPixelArea = area; } F32 getVirtualSize() const { return mVSize; } F32 getPixelArea() const { return mPixelArea; } - void bindTexture(S32 stage = 0) const { LLViewerImage::bindTexture(mTexture, stage); } void renderSetColor() const; S32 renderElements(const U16 *index_array) const; @@ -120,6 +119,7 @@ public: LLVertexBuffer* getVertexBuffer() const { return mVertexBuffer; } void setPoolType(U32 type) { mPoolType = type; } S32 getTEOffset() { return mTEOffset; } + LLViewerImage* getTexture() { return mTexture; } void setViewerObject(LLViewerObject* object); void setPool(LLFacePool *pool, LLViewerImage *texturep); diff --git a/linden/indra/newview/llface.inl b/linden/indra/newview/llface.inl index 8f8cfaf..7e9c9c1 100644 --- a/linden/indra/newview/llface.inl +++ b/linden/indra/newview/llface.inl @@ -33,6 +33,7 @@ #define LL_LLFACE_INL #include "llglheaders.h" +#include "llrender.h" inline BOOL LLFace::getDirty() const { diff --git a/linden/indra/newview/llfasttimerview.cpp b/linden/indra/newview/llfasttimerview.cpp index f1ca99f..4449adf 100644 --- a/linden/indra/newview/llfasttimerview.cpp +++ b/linden/indra/newview/llfasttimerview.cpp @@ -116,6 +116,7 @@ static struct ft_display_info ft_display_table[] = { LLFastTimer::FTM_VFILE_WAIT, " VFile Wait", &LLColor4::cyan6, 0 }, // { LLFastTimer::FTM_IDLE_CB, " Callbacks", &LLColor4::pink1, 0 }, { LLFastTimer::FTM_RENDER, " Render", &green0, 1 }, + { LLFastTimer::FTM_PICK, " Pick", &LLColor4::purple, 1 }, { LLFastTimer::FTM_HUD_EFFECTS, " HUD Effects", &LLColor4::orange1, 0 }, { LLFastTimer::FTM_HUD_UPDATE, " HUD Update", &LLColor4::orange2, 0 }, { LLFastTimer::FTM_UPDATE_SKY, " Sky Update", &LLColor4::cyan1, 0 }, @@ -463,7 +464,7 @@ void LLFastTimerView::draw() // Draw the window background { - LLGLSNoTexture gls_ui_no_texture; + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); gl_rect_2d(0, getRect().getHeight(), getRect().getWidth(), 0, LLColor4(0.f, 0.f, 0.f, 0.25f)); } @@ -755,7 +756,7 @@ void LLFastTimerView::draw() LLRect graph_rect; // Draw borders { - LLGLSNoTexture gls_ui_no_texture; + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); gGL.color4f(0.5f,0.5f,0.5f,0.5f); S32 by = y + 2; @@ -792,7 +793,7 @@ void LLFastTimerView::draw() // Draw bars for each history entry // Special: -1 = show running average - LLViewerImage::bindTexture(box_imagep->getImage()); + gGL.getTexUnit(0)->bind(box_imagep->getImage()); for (S32 j=-1; j LINE_GRAPH_HEIGHT; j++) { int sublevel_dx[FTV_DISPLAY_NUM+1]; @@ -936,7 +937,7 @@ void LLFastTimerView::draw() //draw line graph history { - LLGLSNoTexture no_texture; + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); LLLocalClipRect clip(graph_rect); //normalize based on last frame's maximum @@ -980,7 +981,7 @@ void LLFastTimerView::draw() gGL.color4f(0.5f,0.5f,0.5f,1); - gGL.begin(LLVertexBuffer::LINES); + gGL.begin(LLRender::LINES); gGL.vertex2i((S32)bar, graph_rect.mBottom); gGL.vertex2i((S32)bar, graph_rect.mTop); gGL.end(); @@ -1016,7 +1017,7 @@ void LLFastTimerView::draw() } gGL.color4f(col[0], col[1], col[2], alpha); - gGL.begin(LLVertexBuffer::LINE_STRIP); + gGL.begin(LLRender::LINE_STRIP); for (U32 j = 0; j < LLFastTimer::FTM_HISTORY_NUM; j++) { U64 ticks = ticks_sum[j+1][idx]; diff --git a/linden/indra/newview/llfeaturemanager.cpp b/linden/indra/newview/llfeaturemanager.cpp index a3da4f5..7883953 100644 --- a/linden/indra/newview/llfeaturemanager.cpp +++ b/linden/indra/newview/llfeaturemanager.cpp @@ -447,8 +447,6 @@ void LLFeatureManager::applyRecommendedSettings() { gSavedSettings.setF32("RenderFarClip", 128.0f); } - - } void LLFeatureManager::applyFeatures(bool skipFeatures) diff --git a/linden/indra/newview/llfilepicker.cpp b/linden/indra/newview/llfilepicker.cpp index bbcfba6..088da4b 100644 --- a/linden/indra/newview/llfilepicker.cpp +++ b/linden/indra/newview/llfilepicker.cpp @@ -933,7 +933,7 @@ void LLFilePicker::chooser_responder(GtkWidget *widget, gint response, gpointer GtkWindow* LLFilePicker::buildFilePicker(bool is_save, bool is_folder, std::string context) { - if (ll_try_gtk_init() && + if (LLWindowSDL::ll_try_gtk_init() && ! gViewerWindow->getWindow()->getFullscreen()) { GtkWidget *win = NULL; @@ -974,7 +974,7 @@ GtkWindow* LLFilePicker::buildFilePicker(bool is_save, bool is_folder, std::stri // Make GTK tell the window manager to associate this // dialog with our non-GTK raw X11 window, which should try // to keep it on top etc. - Window XWindowID = get_SDL_XWindowID(); + Window XWindowID = LLWindowSDL::get_SDL_XWindowID(); if (None != XWindowID) { gtk_widget_realize(GTK_WIDGET(win)); // so we can get its gdkwin diff --git a/linden/indra/newview/llfloateractivespeakers.cpp b/linden/indra/newview/llfloateractivespeakers.cpp index 2352be3..bee6155 100644 --- a/linden/indra/newview/llfloateractivespeakers.cpp +++ b/linden/indra/newview/llfloateractivespeakers.cpp @@ -47,6 +47,7 @@ #include "llsdutil.h" #include "llimview.h" #include "llviewerwindow.h" +#include "llappviewer.h" const F32 SPEAKER_TIMEOUT = 10.f; // seconds of not being on voice channel before removed from list of active speakers const F32 RESORT_TIMEOUT = 5.f; // seconds of mouse inactivity before it's ok to sort regardless of mouse-in-view. @@ -1358,6 +1359,11 @@ void LLLocalSpeakerMgr::updateSpeakerList() // pull speakers from voice channel LLSpeakerMgr::updateSpeakerList(); + if (gDisconnected)//the world is cleared. + { + return ; + } + // add non-voice speakers in chat range std::vector< LLCharacter* >::iterator avatar_it; for(avatar_it = LLCharacter::sInstances.begin(); avatar_it != LLCharacter::sInstances.end(); ++avatar_it) diff --git a/linden/indra/newview/llfloateranimpreview.cpp b/linden/indra/newview/llfloateranimpreview.cpp index 66b7a56..95c18df 100644 --- a/linden/indra/newview/llfloateranimpreview.cpp +++ b/linden/indra/newview/llfloateranimpreview.cpp @@ -384,9 +384,10 @@ void LLFloaterAnimPreview::draw() if (mMotionID.notNull() && mAnimPreview) { gGL.color3f(1.f, 1.f, 1.f); - mAnimPreview->bindTexture(); - gGL.begin( LLVertexBuffer::QUADS ); + gGL.getTexUnit(0)->bind(mAnimPreview->getTexture()); + + gGL.begin( LLRender::QUADS ); { gGL.texCoord2f(0.f, 1.f); gGL.vertex2i(PREVIEW_HPAD, PREVIEW_TEXTURE_HEIGHT); @@ -399,7 +400,7 @@ void LLFloaterAnimPreview::draw() } gGL.end(); - mAnimPreview->unbindTexture(); + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); LLVOAvatar* avatarp = mAnimPreview->getDummyAvatar(); if (!avatarp->areAnimationsPaused()) @@ -1068,7 +1069,7 @@ BOOL LLPreviewAnimation::render() glLoadIdentity(); LLGLSUIDefault def; - LLGLSNoTexture gls_no_texture; + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); gGL.color4f(0.15f, 0.2f, 0.3f, 1.f); gl_rect_2d_simple( mWidth, mHeight ); diff --git a/linden/indra/newview/llfloaterauction.cpp b/linden/indra/newview/llfloaterauction.cpp index 80c43ab..a5929fd 100644 --- a/linden/indra/newview/llfloaterauction.cpp +++ b/linden/indra/newview/llfloaterauction.cpp @@ -148,7 +148,7 @@ void LLFloaterAuction::draw() if (childGetRect("snapshot_icon", rect)) { { - LLGLSNoTexture gls_no_texture; + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); gl_rect_2d(rect, LLColor4(0.f, 0.f, 0.f, 1.f)); rect.stretch(-1); } @@ -205,7 +205,7 @@ void LLFloaterAuction::onClickSnapshot(void* data) LLVFile::writeFile(j2c->getData(), j2c->getDataSize(), gVFS, self->mImageID, LLAssetType::AT_TEXTURE); self->mImage = new LLImageGL((LLImageRaw*)raw, FALSE); - self->mImage->bind(); + gGL.getTexUnit(0)->bind(self->mImage); self->mImage->setClamp(TRUE, TRUE); } else diff --git a/linden/indra/newview/llfloaterbeacons.cpp b/linden/indra/newview/llfloaterbeacons.cpp new file mode 100644 index 0000000..0b73186 --- /dev/null +++ b/linden/indra/newview/llfloaterbeacons.cpp @@ -0,0 +1,150 @@ +/** + * @file llfloaterbeacons.cpp + * @brief Front-end to LLPipeline controls for highlighting various kinds of objects. + * @author Coco + * + * $LicenseInfo:firstyear=2001&license=viewergpl$ + * + * Copyright (c) 2001-2008, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" +#include "llfloaterbeacons.h" +#include "llviewercontrol.h" +#include "lluictrlfactory.h" +#include "llcheckboxctrl.h" +#include "pipeline.h" + + +LLFloaterBeacons::LLFloaterBeacons(const LLSD& seed) +{ + LLUICtrlFactory::getInstance()->buildFloater(this, "floater_beacons.xml"); + + // Initialize pipeline states from saved settings. + // OK to do at floater constructor time because beacons do not display unless the floater is open + // therefore it is OK to not initialize the pipeline state before needed. + // Note also that we should replace those pipeline statics with direct lookup of the saved settings + // eliminating the need to keep these states in sync. + LLPipeline::setRenderScriptedTouchBeacons(gSavedSettings.getBOOL("scripttouchbeacon")); + LLPipeline::setRenderScriptedBeacons( gSavedSettings.getBOOL("scriptsbeacon")); + LLPipeline::setRenderPhysicalBeacons( gSavedSettings.getBOOL("physicalbeacon")); + LLPipeline::setRenderSoundBeacons( gSavedSettings.getBOOL("soundsbeacon")); + LLPipeline::setRenderParticleBeacons( gSavedSettings.getBOOL("particlesbeacon")); + LLPipeline::setRenderHighlights( gSavedSettings.getBOOL("renderhighlights")); + LLPipeline::setRenderBeacons( gSavedSettings.getBOOL("renderbeacons")); +} + +BOOL LLFloaterBeacons::postBuild() +{ + childSetCommitCallback("touch_only", onClickUICheck, this); + childSetCommitCallback("scripted", onClickUICheck, this); + childSetCommitCallback("physical", onClickUICheck, this); + childSetCommitCallback("sounds", onClickUICheck, this); + childSetCommitCallback("particles", onClickUICheck, this); + childSetCommitCallback("highlights", onClickUICheck, this); + childSetCommitCallback("beacons", onClickUICheck, this); + return TRUE; +} + +// Needed to make the floater visibility toggle the beacons. +// Too bad we can't just add control_name="BeaconAlwaysOn" to the XML. +void LLFloaterBeacons::open() +{ + LLFloater::open(); + gSavedSettings.setBOOL( "BeaconAlwaysOn", TRUE); +} +void LLFloaterBeacons::close(bool app_quitting) +{ + LLFloater::close(app_quitting); + if(!app_quitting) + { + gSavedSettings.setBOOL( "BeaconAlwaysOn", FALSE); + } +} + +// Callback attached to each check box control to both affect their main purpose +// and to implement the couple screwy interdependency rules that some have. +//static +void LLFloaterBeacons::onClickUICheck(LLUICtrl *ctrl, void* data) +{ + LLCheckBoxCtrl *check = (LLCheckBoxCtrl *)ctrl; + std::string name = check->getName(); + LLFloaterBeacons* view = (LLFloaterBeacons*)data; + if( name == "touch_only") + { + LLPipeline::toggleRenderScriptedTouchBeacons(NULL); + // Don't allow both to be ON at the same time. Toggle the other one off if both now on. + if ( + LLPipeline::getRenderScriptedTouchBeacons(NULL) && + LLPipeline::getRenderScriptedBeacons(NULL) ) + { + LLPipeline::setRenderScriptedBeacons(FALSE); + view->getChild("scripted")->setControlValue(LLSD(FALSE)); + view->getChild("touch_only")->setControlValue(LLSD(TRUE)); // just to be sure it's in sync with llpipeline + } + } + else if(name == "scripted") + { + LLPipeline::toggleRenderScriptedBeacons(NULL); + // Don't allow both to be ON at the same time. Toggle the other one off if both now on. + if ( + LLPipeline::getRenderScriptedTouchBeacons(NULL) && + LLPipeline::getRenderScriptedBeacons(NULL) ) + { + LLPipeline::setRenderScriptedTouchBeacons(FALSE); + view->getChild("touch_only")->setControlValue(LLSD(FALSE)); + view->getChild("scripted")->setControlValue(LLSD(TRUE)); // just to be sure it's in sync with llpipeline + } + } + else if(name == "physical") LLPipeline::setRenderPhysicalBeacons(check->get()); + else if(name == "sounds") LLPipeline::setRenderSoundBeacons(check->get()); + else if(name == "particles") LLPipeline::setRenderParticleBeacons(check->get()); + else if(name == "highlights") + { + LLPipeline::toggleRenderHighlights(NULL); + // Don't allow both to be OFF at the same time. Toggle the other one on if both now off. + if ( + !LLPipeline::getRenderBeacons(NULL) && + !LLPipeline::getRenderHighlights(NULL) ) + { + LLPipeline::setRenderBeacons(TRUE); + view->getChild("beacons")->setControlValue(LLSD(TRUE)); + view->getChild("highlights")->setControlValue(LLSD(FALSE)); // just to be sure it's in sync with llpipeline + } + } + else if(name == "beacons") + { + LLPipeline::toggleRenderBeacons(NULL); + // Don't allow both to be OFF at the same time. Toggle the other one on if both now off. + if ( + !LLPipeline::getRenderBeacons(NULL) && + !LLPipeline::getRenderHighlights(NULL) ) + { + LLPipeline::setRenderHighlights(TRUE); + view->getChild("highlights")->setControlValue(LLSD(TRUE)); + view->getChild("beacons")->setControlValue(LLSD(FALSE)); // just to be sure it's in sync with llpipeline + } + } +} diff --git a/linden/indra/newview/llfloaterbeacons.h b/linden/indra/newview/llfloaterbeacons.h new file mode 100644 index 0000000..e608dab --- /dev/null +++ b/linden/indra/newview/llfloaterbeacons.h @@ -0,0 +1,56 @@ +/** + * @file llfloaterbeacons.h + * @brief Front-end to LLPipeline controls for highlighting various kinds of objects. + * @author Coco + * + * $LicenseInfo:firstyear=2002&license=viewergpl$ + * + * Copyright (c) 2002-2008, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#ifndef LL_LLFLOATERBEACONS_H +#define LL_LLFLOATERBEACONS_H + +#include "llfloater.h" + +class LLFloaterBeacons : public LLFloater, public LLFloaterSingleton +{ + friend class LLUISingleton >; + +public: + /*virtual*/ BOOL postBuild(); + + // Needed to make the floater visibility toggle the beacons. + // Too bad we can't just add control_name="BeaconAlwaysOn" to the XML. + /*virtual*/ void open(); + /*virtual*/ void close(bool app_quitting); + +private: + LLFloaterBeacons(const LLSD& seed); + + static void onClickUICheck(LLUICtrl *ctrl, void* data); +}; + +#endif diff --git a/linden/indra/newview/llfloaterbuy.cpp b/linden/indra/newview/llfloaterbuy.cpp index 5d815fa..9e8556f 100644 --- a/linden/indra/newview/llfloaterbuy.cpp +++ b/linden/indra/newview/llfloaterbuy.cpp @@ -289,11 +289,6 @@ void LLFloaterBuy::inventoryChanged(LLViewerObject* obj, removeVOInventoryListener(); } -void LLFloaterBuy::close(bool app_quitting) -{ - LLSelectMgr::getInstance()->deselectAll(); - LLFloater::close(app_quitting); -} // static void LLFloaterBuy::onClickBuy(void*) @@ -325,3 +320,10 @@ void LLFloaterBuy::onClickCancel(void*) sInstance->close(); } } + +void LLFloaterBuy::onClose(bool app_quitting) +{ + // drop reference to current selection so selection goes away + mObjectSelection = NULL; + LLFloater::onClose(app_quitting); +} diff --git a/linden/indra/newview/llfloaterbuy.h b/linden/indra/newview/llfloaterbuy.h index 0eef41b..8c0e144 100644 --- a/linden/indra/newview/llfloaterbuy.h +++ b/linden/indra/newview/llfloaterbuy.h @@ -57,6 +57,7 @@ protected: LLFloaterBuy(); ~LLFloaterBuy(); + /*virtual*/ void onClose(bool app_quitting); void reset(); void requestObjectInventories(); @@ -65,8 +66,6 @@ protected: S32 serial_num, void* data); - /*virtual*/ void close(bool app_quitting = false); - static void onClickBuy(void*); static void onClickCancel(void*); diff --git a/linden/indra/newview/llfloaterbuycurrency.cpp b/linden/indra/newview/llfloaterbuycurrency.cpp index cbd41f4..1cbf314 100644 --- a/linden/indra/newview/llfloaterbuycurrency.cpp +++ b/linden/indra/newview/llfloaterbuycurrency.cpp @@ -358,11 +358,6 @@ void LLFloaterBuyCurrencyUI::onClickErrorWeb(void* data) // static void LLFloaterBuyCurrency::buyCurrency() { - if (gHideLinks) - { - return; - } - LLFloaterBuyCurrencyUI* ui = LLFloaterBuyCurrencyUI::soleInstance(true); ui->noTarget(); ui->updateUI(); @@ -371,15 +366,6 @@ void LLFloaterBuyCurrency::buyCurrency() void LLFloaterBuyCurrency::buyCurrency(const std::string& name, S32 price) { - if (gHideLinks) - { - LLStringUtil::format_map_t args; - args["[NAME]"] = name; - args["[PRICE]"] = llformat("%d", price); - gViewerWindow->alertXml("NotEnoughCurrency", args); - return; - } - LLFloaterBuyCurrencyUI* ui = LLFloaterBuyCurrencyUI::soleInstance(true); ui->target(name, price); ui->updateUI(); diff --git a/linden/indra/newview/llfloatercolorpicker.cpp b/linden/indra/newview/llfloatercolorpicker.cpp index 1ffbeb3..9b2a5f6 100644 --- a/linden/indra/newview/llfloatercolorpicker.cpp +++ b/linden/indra/newview/llfloatercolorpicker.cpp @@ -165,7 +165,7 @@ createUI () } } mRGBImage = new LLImageGL ( (LLImageRaw*)raw, FALSE ); - mRGBImage->bind(); + gGL.getTexUnit(0)->bind(mRGBImage); mRGBImage->setClamp(TRUE, TRUE); // create palette @@ -543,9 +543,9 @@ void LLFloaterColorPicker::draw() LLRect local_rect = getLocalRect(); if (gFocusMgr.childHasKeyboardFocus(this) && mSwatch->isInVisibleChain() && mContextConeOpacity > 0.001f) { - LLGLSNoTexture no_texture; + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); LLGLEnable(GL_CULL_FACE); - gGL.begin(LLVertexBuffer::QUADS); + gGL.begin(LLRender::QUADS); { gGL.color4f(0.f, 0.f, 0.f, CONTEXT_CONE_IN_ALPHA * mContextConeOpacity); gGL.vertex2i(swatch_rect.mLeft, swatch_rect.mTop); diff --git a/linden/indra/newview/llfloaterimagepreview.cpp b/linden/indra/newview/llfloaterimagepreview.cpp index 912a4fc..8f592b2 100644 --- a/linden/indra/newview/llfloaterimagepreview.cpp +++ b/linden/indra/newview/llfloaterimagepreview.cpp @@ -232,14 +232,14 @@ void LLFloaterImagePreview::draw() if (mGLName) { - LLImageGL::bindExternalTexture( mGLName, 0, GL_TEXTURE_2D ); + gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, mGLName); } else { glGenTextures(1, &mGLName ); stop_glerror(); - LLImageGL::bindExternalTexture( mGLName, 0, GL_TEXTURE_2D ); + gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, mGLName); stop_glerror(); glTexImage2D( @@ -251,8 +251,7 @@ void LLFloaterImagePreview::draw() glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_CLAMP); if (mAvatarPreview) { mAvatarPreview->setTexture(mGLName); @@ -261,7 +260,7 @@ void LLFloaterImagePreview::draw() } gGL.color3f(1.f, 1.f, 1.f); - gGL.begin( LLVertexBuffer::QUADS ); + gGL.begin( LLRender::QUADS ); { gGL.texCoord2f(mPreviewImageRect.mLeft, mPreviewImageRect.mTop); gGL.vertex2i(PREVIEW_HPAD, PREVIEW_TEXTURE_HEIGHT); @@ -274,7 +273,7 @@ void LLFloaterImagePreview::draw() } gGL.end(); - LLImageGL::unbindTexture(0, GL_TEXTURE_2D); + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); stop_glerror(); } @@ -285,11 +284,15 @@ void LLFloaterImagePreview::draw() gGL.color3f(1.f, 1.f, 1.f); if (selected == 9) - mSculptedPreview->bindTexture(); + { + gGL.getTexUnit(0)->bind(mSculptedPreview->getTexture()); + } else - mAvatarPreview->bindTexture(); + { + gGL.getTexUnit(0)->bind(mAvatarPreview->getTexture()); + } - gGL.begin( LLVertexBuffer::QUADS ); + gGL.begin( LLRender::QUADS ); { gGL.texCoord2f(0.f, 1.f); gGL.vertex2i(PREVIEW_HPAD, PREVIEW_TEXTURE_HEIGHT); @@ -302,10 +305,7 @@ void LLFloaterImagePreview::draw() } gGL.end(); - if (selected == 9) - mSculptedPreview->unbindTexture(); - else - mAvatarPreview->unbindTexture(); + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); } } } @@ -774,7 +774,9 @@ LLImagePreviewSculpted::LLImagePreviewSculpted(S32 width, S32 height) : LLDynami LLVolumeParams volume_params; volume_params.setType(LL_PCODE_PROFILE_CIRCLE, LL_PCODE_PATH_CIRCLE); volume_params.setSculptID(LLUUID::null, LL_SCULPT_TYPE_SPHERE); - mVolume = new LLVolume(volume_params, (F32) MAX_LOD); + + F32 const HIGHEST_LOD = 4.0f; + mVolume = new LLVolume(volume_params, HIGHEST_LOD); /* mDummyAvatar = new LLVOAvatar(LLUUID::null, LL_PCODE_LEGACY_AVATAR, gAgent.getRegion()); @@ -811,7 +813,36 @@ void LLImagePreviewSculpted::setPreviewTarget(LLImageRaw* imagep, F32 distance) { mVolume->sculpt(imagep->getWidth(), imagep->getHeight(), imagep->getComponents(), imagep->getData(), 0); } - + + const LLVolumeFace &vf = mVolume->getVolumeFace(0); + U32 num_indices = vf.mIndices.size(); + U32 num_vertices = vf.mVertices.size(); + + mVertexBuffer = new LLVertexBuffer(LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_NORMAL, 0); + mVertexBuffer->allocateBuffer(num_vertices, num_indices, TRUE); + + LLStrider vertex_strider; + LLStrider normal_strider; + LLStrider index_strider; + + mVertexBuffer->getVertexStrider(vertex_strider); + mVertexBuffer->getNormalStrider(normal_strider); + mVertexBuffer->getIndexStrider(index_strider); + + // build vertices and normals + for (U32 i = 0; (S32)i < num_vertices; i++) + { + *(vertex_strider++) = vf.mVertices[i].mPosition; + LLVector3 normal = vf.mVertices[i].mNormal; + normal.normalize(); + *(normal_strider++) = normal; + } + + // build indices + for (U16 i = 0; i < num_indices; i++) + { + *(index_strider++) = vf.mIndices[i]; + } } @@ -846,7 +877,7 @@ BOOL LLImagePreviewSculpted::render() glMatrixMode(GL_MODELVIEW); gGL.popMatrix(); - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + glClear(GL_DEPTH_BUFFER_BIT); LLVector3 target_pos(0, 0, 0); @@ -865,55 +896,21 @@ BOOL LLImagePreviewSculpted::render() LLViewerCamera::getInstance()->setView(LLViewerCamera::getInstance()->getDefaultFOV() / mCameraZoom); LLViewerCamera::getInstance()->setPerspective(FALSE, mOrigin.mX, mOrigin.mY, mWidth, mHeight, FALSE); - gPipeline.enableLightsAvatar(); - - gGL.pushMatrix(); - glScalef(0.5, 0.5, 0.5); - const LLVolumeFace &vf = mVolume->getVolumeFace(0); U32 num_indices = vf.mIndices.size(); - U32 num_vertices = vf.mVertices.size(); - - if (num_vertices > 0 && num_indices > 0) - { - glEnableClientState(GL_NORMAL_ARRAY); - // build vertices and normals - F32* vertices = new F32[num_vertices * 3]; - F32* normals = new F32[num_vertices * 3]; - - for (U32 i = 0; (S32)i < num_vertices; i++) - { - LLVector3 position = vf.mVertices[i].mPosition; - vertices[i*3] = position.mV[VX]; - vertices[i*3+1] = position.mV[VY]; - vertices[i*3+2] = position.mV[VZ]; - - LLVector3 normal = vf.mVertices[i].mNormal; - normals[i*3] = normal.mV[VX]; - normals[i*3+1] = normal.mV[VY]; - normals[i*3+2] = normal.mV[VZ]; - } + + mVertexBuffer->setBuffer(LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_NORMAL); - // build indices - U16* indices = new U16[num_indices]; - for (U16 i = 0; i < num_indices; i++) - { - indices[i] = vf.mIndices[i]; - } + gPipeline.enableLightsAvatar(); + gGL.pushMatrix(); + const F32 SCALE = 1.25f; + gGL.scalef(SCALE, SCALE, SCALE); + const F32 BRIGHTNESS = 0.9f; + gGL.color3f(BRIGHTNESS, BRIGHTNESS, BRIGHTNESS); + mVertexBuffer->draw(LLRender::TRIANGLES, num_indices, 0); - gGL.color3f(0.4f, 0.4f, 0.4f); - glVertexPointer(3, GL_FLOAT, 0, (void *)vertices); - glNormalPointer(GL_FLOAT, 0, (void *)normals); - glDrawRangeElements(GL_TRIANGLES, 0, num_vertices-1, num_indices, GL_UNSIGNED_SHORT, (void *)indices); + gGL.popMatrix(); - gGL.popMatrix(); - glDisableClientState(GL_NORMAL_ARRAY); - - delete [] indices; - delete [] vertices; - delete [] normals; - } - return TRUE; } diff --git a/linden/indra/newview/llfloaterimagepreview.h b/linden/indra/newview/llfloaterimagepreview.h index 9d80f09..3e72736 100644 --- a/linden/indra/newview/llfloaterimagepreview.h +++ b/linden/indra/newview/llfloaterimagepreview.h @@ -41,6 +41,7 @@ class LLJoint; class LLViewerJointMesh; class LLVOAvatar; class LLTextBox; +class LLVertexBuffer; class LLImagePreviewSculpted : public LLDynamicTexture { @@ -67,6 +68,7 @@ class LLImagePreviewSculpted : public LLDynamicTexture F32 mCameraZoom; LLVector3 mCameraOffset; LLPointer mVolume; + LLPointer mVertexBuffer; }; diff --git a/linden/indra/newview/llfloaterjoystick.cpp b/linden/indra/newview/llfloaterjoystick.cpp index 172da1d..8f938ed 100644 --- a/linden/indra/newview/llfloaterjoystick.cpp +++ b/linden/indra/newview/llfloaterjoystick.cpp @@ -46,7 +46,7 @@ #include "llviewerjoystick.h" LLFloaterJoystick::LLFloaterJoystick(const LLSD& data) - : LLFloater(std::string("floater_joystick")) + : LLFloater("floater_joystick") { LLUICtrlFactory::getInstance()->buildFloater(this, "floater_joystick.xml"); center(); diff --git a/linden/indra/newview/llfloaterland.cpp b/linden/indra/newview/llfloaterland.cpp index 891cde7..a459d4d 100644 --- a/linden/indra/newview/llfloaterland.cpp +++ b/linden/indra/newview/llfloaterland.cpp @@ -1448,7 +1448,7 @@ void LLPanelLandObjects::processParcelObjectOwnersReply(LLMessageSystem *msg, vo msg->getBOOLFast(_PREHASH_Data, _PREHASH_IsGroupOwned, is_group_owned, i); msg->getS32Fast (_PREHASH_Data, _PREHASH_Count, object_count, i); msg->getBOOLFast(_PREHASH_Data, _PREHASH_OnlineStatus, is_online, i); - if(msg->getNumberOfBlocks("DataExtended")) + if(msg->has("DataExtended")) { msg->getU32("DataExtended", "TimeStamp", most_recent_time, i); } diff --git a/linden/indra/newview/llfloaterlandmark.cpp b/linden/indra/newview/llfloaterlandmark.cpp index 71e35e8..a8c08bb 100644 --- a/linden/indra/newview/llfloaterlandmark.cpp +++ b/linden/indra/newview/llfloaterlandmark.cpp @@ -34,73 +34,28 @@ #include "llfloaterlandmark.h" #include "llagent.h" -#include "llviewerimagelist.h" #include "llcheckboxctrl.h" -#include "llcombobox.h" -#include "llbutton.h" -#include "lldraghandle.h" -#include "llfocusmgr.h" -#include "llviewerimage.h" #include "llviewerparcelmgr.h" #include "llfolderview.h" #include "llinventory.h" #include "llinventorymodel.h" #include "llinventoryview.h" -#include "lllineeditor.h" -#include "llui.h" #include "llviewerinventory.h" #include "llpermissions.h" #include "llsaleinfo.h" -#include "llassetstorage.h" -#include "lltextbox.h" #include "llparcel.h" -#include "llresizehandle.h" -#include "llscrollcontainer.h" -#include "lltoolmgr.h" -#include "lltoolpipette.h" - -#include "lltool.h" -#include "llviewerwindow.h" -#include "llviewerobject.h" + +#include "llviewerwindow.h" // alertXml #include "llviewercontrol.h" -#include "llglheaders.h" #include "lluictrlfactory.h" -#include "roles_constants.h" - - - -static const S32 CLOSE_BTN_WIDTH = 100; -const S32 PIPETTE_BTN_WIDTH = 32; -static const S32 HPAD = 4; -static const S32 VPAD = 4; -static const S32 LINE = 16; -static const S32 SMALL_BTN_WIDTH = 64; -static const S32 TEX_PICKER_MIN_WIDTH = - (HPAD + - CLOSE_BTN_WIDTH + - HPAD + - CLOSE_BTN_WIDTH + - HPAD + - SMALL_BTN_WIDTH + - HPAD + - SMALL_BTN_WIDTH + - HPAD + - 30 + - RESIZE_HANDLE_WIDTH * 2); -static const S32 CLEAR_BTN_WIDTH = 50; -static const S32 TEX_PICKER_MIN_HEIGHT = 290; -static const S32 FOOTER_HEIGHT = 100; -static const S32 BORDER_PAD = HPAD; -static const S32 TEXTURE_INVENTORY_PADDING = 30; +#include "roles_constants.h" // GP_LAND_ALLOW_LANDMARK + + static const F32 CONTEXT_CONE_IN_ALPHA = 0.0f; static const F32 CONTEXT_CONE_OUT_ALPHA = 1.f; static const F32 CONTEXT_FADE_TIME = 0.08f; -//static const char CURRENT_IMAGE_NAME[] = "Current Landmark"; -//static const char WHITE_IMAGE_NAME[] = "Blank Landmark"; -//static const char NO_IMAGE_NAME[] = "None"; - LLFloaterLandmark::LLFloaterLandmark(const LLSD& data) : @@ -167,6 +122,7 @@ LLFloaterLandmark::LLFloaterLandmark(const LLSD& data) LLFloaterLandmark::~LLFloaterLandmark() { delete mSavedFolderState; + mSavedFolderState = NULL; } void LLFloaterLandmark::setActive( BOOL active ) diff --git a/linden/indra/newview/llfloaterlandmark.h b/linden/indra/newview/llfloaterlandmark.h index cf71138..27139a7 100644 --- a/linden/indra/newview/llfloaterlandmark.h +++ b/linden/indra/newview/llfloaterlandmark.h @@ -32,9 +32,7 @@ #ifndef LL_LLFLOATERLANDMARK_H #define LL_LLFLOATERLANDMARK_H -#include "llcoord.h" #include "llfloater.h" -#include "llstring.h" #include "lluictrl.h" #include "llpermissionsflags.h" diff --git a/linden/indra/newview/llfloaterpostcard.cpp b/linden/indra/newview/llfloaterpostcard.cpp index b4bcdb7..4be8145 100644 --- a/linden/indra/newview/llfloaterpostcard.cpp +++ b/linden/indra/newview/llfloaterpostcard.cpp @@ -63,6 +63,8 @@ #include "llassetuploadresponders.h" +#include //boost.regex lib + ///---------------------------------------------------------------------------- /// Local function declarations, constants, enums, and typedefs ///---------------------------------------------------------------------------- @@ -180,7 +182,7 @@ void LLFloaterPostcard::draw() rect.mBottom = (S32)((F32)rect.mTop - ((F32)rect.getWidth() / ratio)); } { - LLGLSNoTexture gls_no_texture; + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); gl_rect_2d(rect, LLColor4(0.f, 0.f, 0.f, 1.f)); rect.stretch(-1); } @@ -242,14 +244,16 @@ void LLFloaterPostcard::onClickSend(void* data) std::string from(self->childGetValue("from_form").asString()); std::string to(self->childGetValue("to_form").asString()); - - if (to.empty() || to.find('@') == std::string::npos) + + boost::regex emailFormat("[A-Za-z0-9.%+-_]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,}"); + + if (to.empty() || !boost::regex_match(to, emailFormat)) { gViewerWindow->alertXml("PromptRecipientEmail"); return; } - if (from.empty() || from.find('@') == std::string::npos) + if (from.empty() || !boost::regex_match(from, emailFormat)) { gViewerWindow->alertXml("PromptSelfEmail"); return; diff --git a/linden/indra/newview/llfloaterpreference.cpp b/linden/indra/newview/llfloaterpreference.cpp index 82d8cc9..b907aed 100644 --- a/linden/indra/newview/llfloaterpreference.cpp +++ b/linden/indra/newview/llfloaterpreference.cpp @@ -424,8 +424,6 @@ void LLFloaterPreference::onClickAbout(void*) // static void LLFloaterPreference::onBtnOK( void* userdata ) { - LLPanelLogin::refreshLocation( false ); - LLFloaterPreference *fp =(LLFloaterPreference *)userdata; // commit any outstanding text entry if (fp->hasFocus()) @@ -453,6 +451,8 @@ void LLFloaterPreference::onBtnOK( void* userdata ) // Show beep, pop up dialog, etc. llinfos << "Can't close preferences!" << llendl; } + + LLPanelLogin::refreshLocation( false ); } diff --git a/linden/indra/newview/llfloatersnapshot.cpp b/linden/indra/newview/llfloatersnapshot.cpp index 954bf9f..afa0785 100644 --- a/linden/indra/newview/llfloatersnapshot.cpp +++ b/linden/indra/newview/llfloatersnapshot.cpp @@ -151,7 +151,8 @@ public: void resetThumbnailImage() { mThumbnailImage = NULL ; } void drawPreviewRect(S32 offset_x, S32 offset_y) ; - static void onIdle( void* snapshot_preview ); + // Returns TRUE when snapshot generated, FALSE otherwise. + static BOOL onIdle( void* snapshot_preview ); private: LLColor4 mColor; @@ -203,6 +204,8 @@ LLSnapshotLivePreview::LLSnapshotLivePreview (const LLRect& rect) : mCurImageIndex(0), mPreviewImage(NULL), mThumbnailImage(NULL) , + mThumbnailWidth(0), + mThumbnailHeight(0), mPreviewImageEncoded(NULL), mFormattedImage(NULL), mShineCountdown(0), @@ -342,14 +345,11 @@ void LLSnapshotLivePreview::updateSnapshot(BOOL new_snapshot, BOOL new_thumbnail mSnapshotDelayTimer.start(); mSnapshotDelayTimer.setTimerExpirySec(delay); } - else if(new_thumbnail) + if(new_thumbnail) { mThumbnailUpToDate = FALSE ; } - else - { - setThumbnailImageSize() ; - } + setThumbnailImageSize(); } void LLSnapshotLivePreview::setSnapshotQuality(S32 quality) @@ -417,14 +417,14 @@ void LLSnapshotLivePreview::draw() LLColor4 image_color(1.f, 1.f, 1.f, 1.f); gGL.color4fv(image_color.mV); - LLViewerImage::bindTexture(mViewerImage[mCurImageIndex]); + gGL.getTexUnit(0)->bind(mViewerImage[mCurImageIndex]); // calculate UV scale F32 uv_width = mImageScaled[mCurImageIndex] ? 1.f : llmin((F32)mWidth[mCurImageIndex] / (F32)mViewerImage[mCurImageIndex]->getWidth(), 1.f); F32 uv_height = mImageScaled[mCurImageIndex] ? 1.f : llmin((F32)mHeight[mCurImageIndex] / (F32)mViewerImage[mCurImageIndex]->getHeight(), 1.f); glPushMatrix(); { glTranslatef((F32)rect.mLeft, (F32)rect.mBottom, 0.f); - gGL.begin(LLVertexBuffer::QUADS); + gGL.begin(LLRender::QUADS); { gGL.texCoord2f(uv_width, uv_height); gGL.vertex2i(rect.getWidth(), rect.getHeight() ); @@ -486,8 +486,8 @@ void LLSnapshotLivePreview::draw() S32 y1 = 0; S32 y2 = gViewerWindow->getWindowHeight(); - LLGLSNoTexture no_texture; - gGL.begin(LLVertexBuffer::QUADS); + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); + gGL.begin(LLRender::QUADS); { gGL.color4f(1.f, 1.f, 1.f, 0.f); gGL.vertex2i(x1, y1); @@ -515,10 +515,10 @@ void LLSnapshotLivePreview::draw() // draw framing rectangle { - LLGLSNoTexture no_texture; + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); gGL.color4f(1.f, 1.f, 1.f, 1.f); LLRect outline_rect = mImageRect[mCurImageIndex]; - gGL.begin(LLVertexBuffer::QUADS); + gGL.begin(LLRender::QUADS); { gGL.vertex2i(outline_rect.mLeft - BORDER_WIDTH, outline_rect.mTop + BORDER_WIDTH); gGL.vertex2i(outline_rect.mRight + BORDER_WIDTH, outline_rect.mTop + BORDER_WIDTH); @@ -553,7 +553,7 @@ void LLSnapshotLivePreview::draw() F32 alpha = clamp_rescale(fall_interp, 0.f, 1.f, 0.8f, 0.4f); LLColor4 image_color(1.f, 1.f, 1.f, alpha); gGL.color4fv(image_color.mV); - LLViewerImage::bindTexture(mViewerImage[old_image_index]); + gGL.getTexUnit(0)->bind(mViewerImage[old_image_index]); // calculate UV scale // *FIX get this to work with old image BOOL rescale = !mImageScaled[old_image_index] && mViewerImage[mCurImageIndex].notNull(); @@ -564,7 +564,7 @@ void LLSnapshotLivePreview::draw() LLRect& rect = mImageRect[old_image_index]; glTranslatef((F32)rect.mLeft, (F32)rect.mBottom - llround(getRect().getHeight() * 2.f * (fall_interp * fall_interp)), 0.f); glRotatef(-45.f * fall_interp, 0.f, 0.f, 1.f); - gGL.begin(LLVertexBuffer::QUADS); + gGL.begin(LLRender::QUADS); { gGL.texCoord2f(uv_width, uv_height); gGL.vertex2i(rect.getWidth(), rect.getHeight() ); @@ -719,8 +719,11 @@ void LLSnapshotLivePreview::generateThumbnailImage(BOOL force_update) mThumbnailUpdateLock = FALSE ; } + +// Called often. Checks whether it's time to grab a new snapshot and if so, does it. +// Returns TRUE if new snapshot generated, FALSE otherwise. //static -void LLSnapshotLivePreview::onIdle( void* snapshot_preview ) +BOOL LLSnapshotLivePreview::onIdle( void* snapshot_preview ) { LLSnapshotLivePreview* previewp = (LLSnapshotLivePreview*)snapshot_preview; @@ -733,7 +736,10 @@ void LLSnapshotLivePreview::onIdle( void* snapshot_preview ) previewp->mCameraRot = new_camera_rot; // request a new snapshot whenever the camera moves, with a time delay BOOL autosnap = gSavedSettings.getBOOL("AutoSnapshot"); - previewp->updateSnapshot(autosnap, FALSE, autosnap ? AUTO_SNAPSHOT_TIME_DELAY : 0.f); + previewp->updateSnapshot( + autosnap, // whether a new snapshot is needed or merely invalidate the existing one + FALSE, // or if 1st arg is false, whether to produce a new thumbnail image. + autosnap ? AUTO_SNAPSHOT_TIME_DELAY : 0.f); // shutter delay if 1st arg is true. } // see if it's time yet to snap the shot and bomb out otherwise. @@ -742,7 +748,7 @@ void LLSnapshotLivePreview::onIdle( void* snapshot_preview ) && !LLToolCamera::getInstance()->hasMouseCapture(); // don't take snapshots while ALT-zoom active if ( ! previewp->mSnapshotActive) { - return; + return FALSE; } // time to produce a snapshot @@ -819,6 +825,7 @@ void LLSnapshotLivePreview::onIdle( void* snapshot_preview ) } if (previewp->mFormattedImage->encode(previewp->mPreviewImage, 0)) { + previewp->mDataSize = previewp->mFormattedImage->getDataSize(); // special case BMP to copy instead of decode otherwise decode will crash. if(format == LLFloaterSnapshot::SNAPSHOT_FORMAT_BMP) { @@ -826,7 +833,6 @@ void LLSnapshotLivePreview::onIdle( void* snapshot_preview ) } else { - previewp->mDataSize = previewp->mFormattedImage->getDataSize(); previewp->mFormattedImage->decode(previewp->mPreviewImageEncoded, 0); } } @@ -855,7 +861,7 @@ void LLSnapshotLivePreview::onIdle( void* snapshot_preview ) previewp->mViewerImage[previewp->mCurImageIndex] = new LLImageGL(scaled, FALSE); previewp->mViewerImage[previewp->mCurImageIndex]->setMipFilterNearest(previewp->getSnapshotType() != SNAPSHOT_TEXTURE); - LLViewerImage::bindTexture(previewp->mViewerImage[previewp->mCurImageIndex]); + gGL.getTexUnit(0)->bind(previewp->mViewerImage[previewp->mCurImageIndex]); previewp->mViewerImage[previewp->mCurImageIndex]->setClamp(TRUE, TRUE); previewp->mSnapshotUpToDate = TRUE; @@ -875,6 +881,8 @@ void LLSnapshotLivePreview::onIdle( void* snapshot_preview ) { previewp->generateThumbnailImage() ; } + + return TRUE; } void LLSnapshotLivePreview::setSize(S32 w, S32 h) @@ -952,7 +960,7 @@ void LLSnapshotLivePreview::saveTexture() llwarns << "Error encoding snapshot" << llendl; } - LLViewerStats::getInstance()->incStat(LLViewerStats::ST_SNAPSHOT_COUNT ); + LLViewerStats::getInstance()->incStat(LLViewerStats::ST_SNAPSHOT_COUNT ); } BOOL LLSnapshotLivePreview::saveLocal() @@ -996,7 +1004,8 @@ public: static void onClickKeepOpenCheck(LLUICtrl *ctrl, void* data); static void onClickKeepAspectCheck(LLUICtrl *ctrl, void* data); static void onCommitQuality(LLUICtrl* ctrl, void* data); - static void onCommitResolution(LLUICtrl* ctrl, void* data); + static void onCommitResolution(LLUICtrl* ctrl, void* data) { updateResolution(ctrl, data); } + static void updateResolution(LLUICtrl* ctrl, void* data, BOOL do_update = TRUE); static void onCommitFreezeFrame(LLUICtrl* ctrl, void* data); static void onCommitLayerTypes(LLUICtrl* ctrl, void*data); static void onCommitSnapshotType(LLUICtrl* ctrl, void* data); @@ -1093,11 +1102,8 @@ LLViewerWindow::ESnapshotType LLFloaterSnapshot::Impl::getLayerType(LLFloaterSna void LLFloaterSnapshot::Impl::setResolution(LLFloaterSnapshot* floater, const std::string& comboname) { LLComboBox* combo = floater->getChild(comboname); - if (combo) - { combo->setVisible(TRUE); - onCommitResolution(combo, floater); - } + updateResolution(combo, floater, FALSE); // to sync spinners with combo } //static @@ -1107,22 +1113,18 @@ void LLFloaterSnapshot::Impl::updateLayout(LLFloaterSnapshot* floaterp) S32 delta_height = gSavedSettings.getBOOL("AdvanceSnapshot") ? 0 : floaterp->getUIWinHeightShort() - floaterp->getUIWinHeightLong() ; - LLComboBox* combo; if(!gSavedSettings.getBOOL("AdvanceSnapshot")) //set to original window resolution { - previewp->mKeepAspectRatio = TRUE ; + previewp->mKeepAspectRatio = TRUE; - combo = floaterp->getChild("postcard_size_combo"); - combo->setCurrentByIndex(0) ; - gSavedSettings.setS32("SnapshotPostcardLastResolution", 0) ; + floaterp->getChild("postcard_size_combo")->setCurrentByIndex(0); + gSavedSettings.setS32("SnapshotPostcardLastResolution", 0); - combo = floaterp->getChild("texture_size_combo"); - combo->setCurrentByIndex(0) ; - gSavedSettings.setS32("SnapshotTextureLastResolution", 0) ; + floaterp->getChild("texture_size_combo")->setCurrentByIndex(0); + gSavedSettings.setS32("SnapshotTextureLastResolution", 0); - combo = floaterp->getChild("local_size_combo"); - combo->setCurrentByIndex(0) ; - gSavedSettings.setS32("SnapshotLocalLastResolution", 0) ; + floaterp->getChild("local_size_combo")->setCurrentByIndex(0); + gSavedSettings.setS32("SnapshotLocalLastResolution", 0); LLSnapshotLivePreview* previewp = getPreviewView(floaterp); previewp->setSize(gViewerWindow->getWindowDisplayWidth(), gViewerWindow->getWindowDisplayHeight()); @@ -1187,7 +1189,11 @@ void LLFloaterSnapshot::Impl::updateLayout(LLFloaterSnapshot* floaterp) } } - +// This is the main function that keeps all the GUI controls in sync with the saved settings. +// It should be called anytime a setting is changed that could affect the controls. +// No other methods should be changing any of the controls directly except for helpers called by this method. +// The basic pattern for programmatically changing the GUI settings is to first set the +// appropriate saved settings and then call this method to sync the GUI with them. // static void LLFloaterSnapshot::Impl::updateControls(LLFloaterSnapshot* floater) { @@ -1201,15 +1207,10 @@ void LLFloaterSnapshot::Impl::updateControls(LLFloaterSnapshot* floater) floater->childSetVisible("texture_size_combo", FALSE); floater->childSetVisible("local_size_combo", FALSE); - LLComboBox* combo; - combo = floater->getChild("postcard_size_combo"); - if (combo) combo->selectNthItem(gSavedSettings.getS32("SnapshotPostcardLastResolution")); - combo = floater->getChild("texture_size_combo"); - if (combo) combo->selectNthItem(gSavedSettings.getS32("SnapshotTextureLastResolution")); - combo = floater->getChild("local_size_combo"); - if (combo) combo->selectNthItem(gSavedSettings.getS32("SnapshotLocalLastResolution")); - combo = floater->getChild("local_format_combo"); - if (combo) combo->selectNthItem(gSavedSettings.getS32("SnapshotFormat")); + floater->getChild("postcard_size_combo")->selectNthItem(gSavedSettings.getS32("SnapshotPostcardLastResolution")); + floater->getChild("texture_size_combo")->selectNthItem(gSavedSettings.getS32("SnapshotTextureLastResolution")); + floater->getChild("local_size_combo")->selectNthItem(gSavedSettings.getS32("SnapshotLocalLastResolution")); + floater->getChild("local_format_combo")->selectNthItem(gSavedSettings.getS32("SnapshotFormat")); floater->childSetVisible("upload_btn", shot_type == LLSnapshotLivePreview::SNAPSHOT_TEXTURE); floater->childSetVisible("send_btn", shot_type == LLSnapshotLivePreview::SNAPSHOT_POSTCARD); @@ -1240,6 +1241,23 @@ void LLFloaterSnapshot::Impl::updateControls(LLFloaterSnapshot* floater) floater->childSetVisible("auto_snapshot_check", is_advance); floater->childSetVisible("image_quality_slider", is_advance && show_slider); + LLSnapshotLivePreview* previewp = getPreviewView(floater); + BOOL got_bytes = previewp && previewp->getDataSize() > 0; + BOOL got_snap = previewp->getSnapshotUpToDate(); + + floater->childSetEnabled("send_btn", shot_type == LLSnapshotLivePreview::SNAPSHOT_POSTCARD && got_bytes && got_snap && previewp->getDataSize() <= MAX_POSTCARD_DATASIZE); + floater->childSetEnabled("upload_btn", shot_type == LLSnapshotLivePreview::SNAPSHOT_TEXTURE && got_bytes && got_snap); + floater->childSetEnabled("save_btn", shot_type == LLSnapshotLivePreview::SNAPSHOT_LOCAL && got_bytes && got_snap); + + LLLocale locale(LLLocale::USER_LOCALE); + std::string bytes_string; + LLResMgr::getInstance()->getIntegerString(bytes_string, (previewp->getDataSize()) >> 10 ); + floater->childSetTextArg("file_size_label", "[SIZE]", got_snap ? bytes_string : got_bytes ? floater->getString("unknown") : std::string("???")); + floater->childSetColor("file_size_label", + shot_type == LLSnapshotLivePreview::SNAPSHOT_POSTCARD + && got_bytes + && previewp->getDataSize() > MAX_POSTCARD_DATASIZE ? LLColor4::red : gColors.getColor( "LabelTextColor" )); + switch(shot_type) { case LLSnapshotLivePreview::SNAPSHOT_POSTCARD: @@ -1270,7 +1288,6 @@ void LLFloaterSnapshot::Impl::updateControls(LLFloaterSnapshot* floater) updateResolutionTextEntry(floater); - LLSnapshotLivePreview* previewp = getPreviewView(floater); if (previewp) { previewp->setSnapshotType(shot_type); @@ -1389,6 +1406,7 @@ void LLFloaterSnapshot::Impl::onClickAutoSnap(LLUICtrl *ctrl, void* data) if (view) { checkAutoSnapshot(getPreviewView(view)); + updateControls(view); } } @@ -1401,9 +1419,12 @@ void LLFloaterSnapshot::Impl::onClickMore(void* data) { view->translate( 0, view->getUIWinHeightShort() - view->getUIWinHeightLong() ); view->reshape(view->getRect().getWidth(), view->getUIWinHeightLong()); - updateControls(view) ; updateLayout(view) ; + if(getPreviewView(view)) + { + getPreviewView(view)->setThumbnailImageSize() ; + } } } void LLFloaterSnapshot::Impl::onClickLess(void* data) @@ -1415,10 +1436,8 @@ void LLFloaterSnapshot::Impl::onClickLess(void* data) { view->translate( 0, view->getUIWinHeightLong() - view->getUIWinHeightShort() ); view->reshape(view->getRect().getWidth(), view->getUIWinHeightShort()); - updateControls(view) ; updateLayout(view) ; - if(getPreviewView(view)) { getPreviewView(view)->setThumbnailImageSize() ; @@ -1436,6 +1455,7 @@ void LLFloaterSnapshot::Impl::onClickUICheck(LLUICtrl *ctrl, void* data) if (view) { checkAutoSnapshot(getPreviewView(view), TRUE); + updateControls(view); } } @@ -1449,6 +1469,7 @@ void LLFloaterSnapshot::Impl::onClickHUDCheck(LLUICtrl *ctrl, void* data) if (view) { checkAutoSnapshot(getPreviewView(view), TRUE); + updateControls(view); } } @@ -1482,6 +1503,7 @@ void LLFloaterSnapshot::Impl::onClickKeepAspectCheck(LLUICtrl* ctrl, void* data) } previewp->setSize(w, h) ; + previewp->updateSnapshot(FALSE, TRUE); checkAutoSnapshot(previewp, TRUE); } } @@ -1531,7 +1553,7 @@ void LLFloaterSnapshot::Impl::checkAspectRatio(LLFloaterSnapshot *view, S32 inde } #endif - if(!index) //current window size + if(0 == index) //current window size { sAspectRatioCheckOff = TRUE ; view->childSetEnabled("keep_aspect_check", FALSE) ; @@ -1568,8 +1590,27 @@ void LLFloaterSnapshot::Impl::checkAspectRatio(LLFloaterSnapshot *view, S32 inde return ; } +static std::string lastSnapshotWidthName() +{ + switch(gSavedSettings.getS32("LastSnapshotType")) + { + case LLSnapshotLivePreview::SNAPSHOT_POSTCARD: return "LastSnapshotToEmailWidth"; + case LLSnapshotLivePreview::SNAPSHOT_TEXTURE: return "LastSnapshotToInventoryWidth"; + default: return "LastSnapshotToDiskWidth"; + } +} +static std::string lastSnapshotHeightName() +{ + switch(gSavedSettings.getS32("LastSnapshotType")) + { + case LLSnapshotLivePreview::SNAPSHOT_POSTCARD: return "LastSnapshotToEmailHeight"; + case LLSnapshotLivePreview::SNAPSHOT_TEXTURE: return "LastSnapshotToInventoryHeight"; + default: return "LastSnapshotToDiskHeight"; + } +} + // static -void LLFloaterSnapshot::Impl::onCommitResolution(LLUICtrl* ctrl, void* data) +void LLFloaterSnapshot::Impl::updateResolution(LLUICtrl* ctrl, void* data, BOOL do_update) { LLComboBox* combobox = (LLComboBox*)ctrl; LLFloaterSnapshot *view = (LLFloaterSnapshot *)data; @@ -1580,13 +1621,9 @@ void LLFloaterSnapshot::Impl::onCommitResolution(LLUICtrl* ctrl, void* data) } // save off all selected resolution values - LLComboBox* combo; - combo = view->getChild("postcard_size_combo"); - gSavedSettings.setS32("SnapshotPostcardLastResolution", combo->getCurrentIndex()); - combo = view->getChild("texture_size_combo"); - gSavedSettings.setS32("SnapshotTextureLastResolution", combo->getCurrentIndex()); - combo = view->getChild("local_size_combo"); - gSavedSettings.setS32("SnapshotLocalLastResolution", combo->getCurrentIndex()); + gSavedSettings.setS32("SnapshotPostcardLastResolution", view->getChild("postcard_size_combo")->getCurrentIndex()); + gSavedSettings.setS32("SnapshotTextureLastResolution", view->getChild("texture_size_combo")->getCurrentIndex()); + gSavedSettings.setS32("SnapshotLocalLastResolution", view->getChild("local_size_combo")->getCurrentIndex()); std::string sdstring = combobox->getSelectedValue(); LLSD sdres; @@ -1601,15 +1638,17 @@ void LLFloaterSnapshot::Impl::onCommitResolution(LLUICtrl* ctrl, void* data) { if (width == 0 || height == 0) { + // take resolution from current window size previewp->setSize(gViewerWindow->getWindowDisplayWidth(), gViewerWindow->getWindowDisplayHeight()); } else if (width == -1 || height == -1) { // load last custom value - previewp->setSize(gSavedSettings.getS32("LastSnapshotWidth"), gSavedSettings.getS32("LastSnapshotHeight")); + previewp->setSize(gSavedSettings.getS32(lastSnapshotWidthName()), gSavedSettings.getS32(lastSnapshotHeightName())); } else { + // use the resolution from the selected pre-canned drop-down choice previewp->setSize(width, height); } @@ -1623,10 +1662,18 @@ void LLFloaterSnapshot::Impl::onCommitResolution(LLUICtrl* ctrl, void* data) } previewp->setSize(width, height); + if(view->childGetValue("snapshot_width").asInteger() != width || view->childGetValue("snapshot_height").asInteger() != height) + { view->childSetValue("snapshot_width", width); view->childSetValue("snapshot_height", height); // hide old preview as the aspect ratio could be wrong checkAutoSnapshot(previewp, FALSE); + getPreviewView(view)->updateSnapshot(FALSE, TRUE); + if(do_update) + { + updateControls(view); + } + } } } @@ -1675,17 +1722,28 @@ void LLFloaterSnapshot::Impl::onCommitSnapshotFormat(LLUICtrl* ctrl, void* data) - +// Sets the named size combo to "custom" mode. // static void LLFloaterSnapshot::Impl::comboSetCustom(LLFloaterSnapshot* floater, const std::string& comboname) { LLComboBox* combo = floater->getChild(comboname); - if (combo) - { - combo->setCurrentByIndex(combo->getItemCount() - 1); - checkAspectRatio(floater, -1);//combo->getCurrentIndex()) ; + combo->setCurrentByIndex(combo->getItemCount() - 1); // "custom" is always the last index + + if(comboname == "postcard_size_combo") + { + gSavedSettings.setS32("SnapshotPostcardLastResolution", combo->getCurrentIndex()); + } + else if(comboname == "texture_size_combo") + { + gSavedSettings.setS32("SnapshotTextureLastResolution", combo->getCurrentIndex()); } + else if(comboname == "local_size_combo") + { + gSavedSettings.setS32("SnapshotLocalLastResolution", combo->getCurrentIndex()); + } + + checkAspectRatio(floater, -1); // -1 means custom } @@ -1711,8 +1769,8 @@ BOOL LLFloaterSnapshot::Impl::checkImageSize(LLSnapshotLivePreview* previewp, S3 //round to nearest power of 2 based on the direction of movement // i.e. higher power of two if increasing texture resolution - if(gSavedSettings.getS32("LastSnapshotWidth") < width || - gSavedSettings.getS32("LastSnapshotHeight") < height) + if(gSavedSettings.getS32("LastSnapshotToInventoryWidth") < width || + gSavedSettings.getS32("LastSnapshotToInventoryHeight") < height) { // Up arrow pressed width = get_next_power_two(width, MAX_TEXTURE_SIZE) ; @@ -1772,20 +1830,10 @@ BOOL LLFloaterSnapshot::Impl::checkImageSize(LLSnapshotLivePreview* previewp, S3 //static void LLFloaterSnapshot::Impl::resetSnapshotSizeOnUI(LLFloaterSnapshot *view, S32 width, S32 height) { - LLSpinCtrl *sctrl = view->getChild("snapshot_width") ; - if(sctrl) - { - sctrl->forceSetValue(width) ; - } - - sctrl = view->getChild("snapshot_height") ; - if(sctrl) - { - sctrl->forceSetValue(height) ; - } - - gSavedSettings.setS32("LastSnapshotWidth", width); - gSavedSettings.setS32("LastSnapshotHeight", height); + view->getChild("snapshot_width")->forceSetValue(width); + view->getChild("snapshot_height")->forceSetValue(height); + gSavedSettings.setS32(lastSnapshotWidthName(), width); + gSavedSettings.setS32(lastSnapshotHeightName(), height); } //static @@ -1839,15 +1887,17 @@ void LLFloaterSnapshot::Impl::onCommitCustomResolution(LLUICtrl *ctrl, void* dat previewp->setSize(w,h); checkAutoSnapshot(previewp, FALSE); + previewp->updateSnapshot(FALSE, TRUE); comboSetCustom(view, "postcard_size_combo"); comboSetCustom(view, "texture_size_combo"); comboSetCustom(view, "local_size_combo"); } } - gSavedSettings.setS32("LastSnapshotWidth", w); - gSavedSettings.setS32("LastSnapshotHeight", h); + gSavedSettings.setS32(lastSnapshotWidthName(), w); + gSavedSettings.setS32(lastSnapshotHeightName(), h); + updateControls(view); } } @@ -1883,6 +1933,7 @@ LLFloaterSnapshot::~LLFloaterSnapshot() delete &impl; } + BOOL LLFloaterSnapshot::postBuild() { childSetCommitCallback("snapshot_type_radio", Impl::onCommitSnapshotType, this); @@ -1890,11 +1941,6 @@ BOOL LLFloaterSnapshot::postBuild() childSetAction("new_snapshot_btn", Impl::onClickNewSnapshot, this); - childSetValue("auto_snapshot_check", gSavedSettings.getBOOL("AutoSnapshot")); - childSetCommitCallback("auto_snapshot_check", Impl::onClickAutoSnap, this); - - //childSetValue("advance_snapshot_check", gSavedSettings.getBOOL("AdvanceSnapshot")); - //childSetCommitCallback("advance_snapshot_check", Impl::onClickAdvanceSnap, this); childSetAction("more_btn", Impl::onClickMore, this); childSetAction("less_btn", Impl::onClickLess, this); @@ -1907,10 +1953,10 @@ BOOL LLFloaterSnapshot::postBuild() childSetValue("image_quality_slider", gSavedSettings.getS32("SnapshotQuality")); childSetCommitCallback("snapshot_width", Impl::onCommitCustomResolution, this); - childSetCommitCallback("snapshot_height", Impl::onCommitCustomResolution, this); childSetCommitCallback("ui_check", Impl::onClickUICheck, this); + childSetValue("ui_check", gSavedSettings.getBOOL("RenderUIInSnapshot")); childSetCommitCallback("hud_check", Impl::onClickHUDCheck, this); childSetValue("hud_check", gSavedSettings.getBOOL("RenderHUDInSnapshot")); @@ -1925,12 +1971,15 @@ BOOL LLFloaterSnapshot::postBuild() childSetValue("layer_types", "colors"); childSetEnabled("layer_types", FALSE); - childSetValue("snapshot_width", gSavedSettings.getS32("LastSnapshotWidth")); - childSetValue("snapshot_height", gSavedSettings.getS32("LastSnapshotHeight")); + childSetValue("snapshot_width", gSavedSettings.getS32(lastSnapshotWidthName())); + childSetValue("snapshot_height", gSavedSettings.getS32(lastSnapshotHeightName())); childSetValue("freeze_frame_check", gSavedSettings.getBOOL("UseFreezeFrame")); childSetCommitCallback("freeze_frame_check", Impl::onCommitFreezeFrame, this); + childSetValue("auto_snapshot_check", gSavedSettings.getBOOL("AutoSnapshot")); + childSetCommitCallback("auto_snapshot_check", Impl::onClickAutoSnap, this); + childSetCommitCallback("postcard_size_combo", Impl::onCommitResolution, this); childSetCommitCallback("texture_size_combo", Impl::onCommitResolution, this); childSetCommitCallback("local_size_combo", Impl::onCommitResolution, this); @@ -1960,53 +2009,6 @@ void LLFloaterSnapshot::draw() return; } - if(!isMinimized()) - { - if (previewp && previewp->getDataSize() > 0) - { - LLLocale locale(LLLocale::USER_LOCALE); - - std::string bytes_string; - if (previewp->getSnapshotType() == LLSnapshotLivePreview::SNAPSHOT_POSTCARD && - previewp->getDataSize() > MAX_POSTCARD_DATASIZE) - { - childSetColor("file_size_label", LLColor4::red); - childSetEnabled("send_btn", FALSE); - } - else - { - childSetColor("file_size_label", gColors.getColor( "LabelTextColor" )); - childSetEnabled("send_btn", previewp->getSnapshotUpToDate()); - } - - if (previewp->getSnapshotUpToDate()) - { - std::string bytes_string; - LLResMgr::getInstance()->getIntegerString(bytes_string, (previewp->getDataSize()) >> 10 ); - childSetTextArg("file_size_label", "[SIZE]", bytes_string); - } - else - { - childSetTextArg("file_size_label", "[SIZE]", getString("unknown")); - childSetColor("file_size_label", gColors.getColor( "LabelTextColor" )); - } - childSetEnabled("upload_btn", previewp->getSnapshotUpToDate()); - childSetEnabled("save_btn", previewp->getSnapshotUpToDate()); - - } - else - { - childSetTextArg("file_size_label", "[SIZE]", std::string("???")); - childSetEnabled("upload_btn", FALSE); - childSetEnabled("send_btn", FALSE); - childSetEnabled("save_btn", FALSE); - } - - BOOL ui_in_snapshot = gSavedSettings.getBOOL("RenderUIInSnapshot"); - childSetValue("ui_check", ui_in_snapshot); - childSetToolTip("ui_check", std::string("If selected shows the UI in the snapshot")); - } - LLFloater::draw(); if (previewp) @@ -2071,10 +2073,15 @@ void LLFloaterSnapshot::hide(void*) //static void LLFloaterSnapshot::update() { + BOOL changed = FALSE; for (std::set::iterator iter = LLSnapshotLivePreview::sList.begin(); iter != LLSnapshotLivePreview::sList.end(); ++iter) { - LLSnapshotLivePreview::onIdle(*iter); + changed |= LLSnapshotLivePreview::onIdle(*iter); + } + if(changed) + { + sInstance->impl.updateControls(sInstance); } } diff --git a/linden/indra/newview/llfloatertopobjects.cpp b/linden/indra/newview/llfloatertopobjects.cpp index ada5c68..96492e8 100644 --- a/linden/indra/newview/llfloatertopobjects.cpp +++ b/linden/indra/newview/llfloatertopobjects.cpp @@ -180,7 +180,7 @@ void LLFloaterTopObjects::handleReply(LLMessageSystem *msg, void** data) msg->getF32Fast(_PREHASH_ReportData, _PREHASH_Score, score, block); msg->getStringFast(_PREHASH_ReportData, _PREHASH_TaskName, name_buf, block); msg->getStringFast(_PREHASH_ReportData, _PREHASH_OwnerName, owner_buf, block); - if(msg->getNumberOfBlocks("DataExtended")) + if(msg->has("DataExtended")) { have_extended_data = true; msg->getU32("DataExtended", "TimeStamp", time_stamp, block); diff --git a/linden/indra/newview/llfolderview.cpp b/linden/indra/newview/llfolderview.cpp index 8cefd5b..932addb 100644 --- a/linden/indra/newview/llfolderview.cpp +++ b/linden/indra/newview/llfolderview.cpp @@ -821,7 +821,7 @@ void LLFolderViewItem::draw() // mShowSingleSelection is FALSE if( mIsSelected ) { - LLGLSNoTexture gls_no_texture; + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); LLColor4 bg_color = sHighlightBgColor; //const S32 TRAILING_PAD = 5; // It just looks better with this. if (!mIsCurSelection) @@ -876,7 +876,7 @@ void LLFolderViewItem::draw() } if (mDragAndDropTarget) { - LLGLSNoTexture gls_no_texture; + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); gl_rect_2d( 0, getRect().getHeight(), diff --git a/linden/indra/newview/llframestatview.cpp b/linden/indra/newview/llframestatview.cpp index 752c6c4..a7d08cf 100644 --- a/linden/indra/newview/llframestatview.cpp +++ b/linden/indra/newview/llframestatview.cpp @@ -98,7 +98,7 @@ void LLFrameStatView::draw() S32 j; LLStat *statp; - LLGLSNoTexture gls_no_texture; + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); statp = mStats[0]; if (!statp) @@ -159,7 +159,7 @@ void LLFrameStatView::draw() for (i = 0; i < mNumStats; i++) { // Draw the color key. - LLGLSNoTexture gls_no_texture; + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); gl_rect_2d(left, top - 2, left + 10, top - 12, mColors[i]); left = left + 15; @@ -203,7 +203,7 @@ void LLFrameStatView::draw() bottom = bottom - 4; for (tick_value = 0; tick_value <= 100; tick_value += 20) { - LLGLSNoTexture gls_no_texture; + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); left = 10 + llfloor(tick_value*(total_width/100.f)); right = left + 1; gl_rect_2d(left, top, right, bottom, LLColor4(1.f, 1.f, 1.f, 0.2f)); @@ -253,7 +253,7 @@ void LLFrameStatView::draw() bottom = top - graph_height - 4; for (tick_value = 0; tick_value <= 100; tick_value += 20) { - LLGLSNoTexture gls_no_texture; + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); left = 10 + llfloor(tick_value*(total_width/100.f)); right = left + 1; gl_rect_2d(left, top, right, bottom, LLColor4(1.f, 1.f, 1.f, 0.25f)); @@ -278,7 +278,7 @@ void LLFrameStatView::draw() bottom = top - graph_height - 4; for (tick_value = 0; tick_value <= mTotalTime; tick_value += mLabelSpacing) { - LLGLSNoTexture gls_no_texture; + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); left = 10 + llfloor(tick_value*time_scale); right = left + 1; gl_rect_2d(left, top, right, bottom, LLColor4(1.f, 1.f, 1.f, 0.25f)); diff --git a/linden/indra/newview/llglsandbox.cpp b/linden/indra/newview/llglsandbox.cpp index 45f674d..c5a626f 100644 --- a/linden/indra/newview/llglsandbox.cpp +++ b/linden/indra/newview/llglsandbox.cpp @@ -142,7 +142,7 @@ void LLAgent::renderAutoPilotTarget() gGL.pushMatrix(); // not textured - LLGLSNoTexture no_texture; + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); // lovely green glColor4f(0.f, 1.f, 1.f, 1.f); @@ -355,10 +355,11 @@ void LLCompass::draw() if (mBkgndTexture) { - mBkgndTexture->bind(); + gGL.getTexUnit(0)->bind(mBkgndTexture.get()); + gGL.color4f(1.0f, 1.0f, 1.0f, 1.0f); - gGL.begin(LLVertexBuffer::QUADS); + gGL.begin(LLRender::QUADS); gGL.texCoord2f(1.f, 1.f); gGL.vertex2i(width, height); @@ -381,10 +382,10 @@ void LLCompass::draw() if (mTexture) { - mTexture->bind(); + gGL.getTexUnit(0)->bind(mTexture.get()); gGL.color4f(1.0f, 1.0f, 1.0f, 1.0f); - gGL.begin(LLVertexBuffer::QUADS); + gGL.begin(LLRender::QUADS); gGL.texCoord2f(1.f, 1.f); gGL.vertex2i(width, height); @@ -426,9 +427,9 @@ void LLHorizontalCompass::draw() F32 left = center - COMPASS_RANGE; F32 right = center + COMPASS_RANGE; - mTexture->bind(); + gGL.getTexUnit(0)->bind(mTexture.get()); gGL.color4f(1.0f, 1.0f, 1.0f, 1.0f ); - gGL.begin( LLVertexBuffer::QUADS ); + gGL.begin( LLRender::QUADS ); gGL.texCoord2f(right, 1.f); gGL.vertex2i(width, height); @@ -447,7 +448,7 @@ void LLHorizontalCompass::draw() // Draw the focus line { - LLGLSNoTexture gls_no_texture; + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); gGL.color4fv( mFocusColor.mV ); gl_line_2d( half_width, 0, half_width, height ); } @@ -465,7 +466,7 @@ void LLWind::renderVectors() F32 region_width_meters = LLWorld::getInstance()->getRegionWidthInMeters(); - LLGLSNoTexture gls_no_texture; + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); gGL.pushMatrix(); LLVector3 origin_agent; origin_agent = gAgent.getPosAgentFromGlobal(mOriginGlobal); @@ -479,11 +480,11 @@ void LLWind::renderVectors() gGL.pushMatrix(); gGL.translatef((F32)i * region_width_meters/mSize, (F32)j * region_width_meters/mSize, 0.0); gGL.color3f(0,1,0); - gGL.begin(LLVertexBuffer::POINTS); + gGL.begin(LLRender::POINTS); gGL.vertex3f(0,0,0); gGL.end(); gGL.color3f(1,0,0); - gGL.begin(LLVertexBuffer::LINES); + gGL.begin(LLRender::LINES); gGL.vertex3f(x * 0.1f, y * 0.1f ,0.f); gGL.vertex3f(x, y, 0.f); gGL.end(); @@ -501,7 +502,7 @@ void LLViewerParcelMgr::renderRect(const LLVector3d &west_south_bottom_global, const LLVector3d &east_north_top_global ) { LLGLSUIDefault gls_ui; - LLGLSNoTexture gls_no_texture; + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); LLGLDepthTest gls_depth(GL_TRUE); LLVector3 west_south_bottom_agent = gAgent.getPosAgentFromGlobal(west_south_bottom_global); @@ -532,7 +533,7 @@ void LLViewerParcelMgr::renderRect(const LLVector3d &west_south_bottom_global, gGL.color4f(1.f, 1.f, 0.f, 1.f); // Cheat and give this the same pick-name as land - gGL.begin(LLVertexBuffer::LINES); + gGL.begin(LLRender::LINES); gGL.vertex3f(west, north, nw_bottom); gGL.vertex3f(west, north, nw_top); @@ -549,7 +550,7 @@ void LLViewerParcelMgr::renderRect(const LLVector3d &west_south_bottom_global, gGL.end(); gGL.color4f(1.f, 1.f, 0.f, 0.2f); - gGL.begin(LLVertexBuffer::QUADS); + gGL.begin(LLRender::QUADS); gGL.vertex3f(west, north, nw_bottom); gGL.vertex3f(west, north, nw_top); @@ -609,14 +610,14 @@ void LLViewerParcelMgr::renderParcel(LLParcel* parcel ) F32 ne_top = ne_bottom + POST_HEIGHT; F32 nw_top = nw_bottom + POST_HEIGHT; - LLGLSNoTexture gls_no_texture; + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); LLGLDepthTest gls_depth(GL_TRUE); LLUI::setLineWidth(2.f); gGL.color4f(0.f, 1.f, 1.f, 1.f); // Cheat and give this the same pick-name as land - gGL.begin(LLVertexBuffer::LINES); + gGL.begin(LLRender::LINES); gGL.vertex3f(west, north, nw_bottom); gGL.vertex3f(west, north, nw_top); @@ -633,7 +634,7 @@ void LLViewerParcelMgr::renderParcel(LLParcel* parcel ) gGL.end(); gGL.color4f(0.f, 1.f, 1.f, 0.2f); - gGL.begin(LLVertexBuffer::QUADS); + gGL.begin(LLRender::QUADS); gGL.vertex3f(west, north, nw_bottom); gGL.vertex3f(west, north, nw_top); @@ -759,7 +760,7 @@ void LLViewerParcelMgr::renderHighlightSegments(const U8* segments, LLViewerRegi bool has_segments = false; LLGLSUIDefault gls_ui; - LLGLSNoTexture gls_no_texture; + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); LLGLDepthTest gls_depth(GL_TRUE); gGL.color4f(1.f, 1.f, 0.f, 0.2f); @@ -786,7 +787,7 @@ void LLViewerParcelMgr::renderHighlightSegments(const U8* segments, LLViewerRegi if (!has_segments) { has_segments = true; - gGL.begin(LLVertexBuffer::QUADS); + gGL.begin(LLRender::QUADS); } renderOneSegment(x1, y1, x2, y2, PARCEL_POST_HEIGHT, SOUTH_MASK, regionp); } @@ -802,7 +803,7 @@ void LLViewerParcelMgr::renderHighlightSegments(const U8* segments, LLViewerRegi if (!has_segments) { has_segments = true; - gGL.begin(LLVertexBuffer::QUADS); + gGL.begin(LLRender::QUADS); } renderOneSegment(x1, y1, x2, y2, PARCEL_POST_HEIGHT, WEST_MASK, regionp); } @@ -850,14 +851,14 @@ void LLViewerParcelMgr::renderCollisionSegments(U8* segments, BOOL use_pass, LLV if (use_pass && (mCollisionBanned == BA_NOT_ON_LIST)) { - LLViewerImage::bindTexture(mPassImage); + gGL.getTexUnit(0)->bind(mPassImage); } else { - LLViewerImage::bindTexture(mBlockedImage); + gGL.getTexUnit(0)->bind(mBlockedImage); } - gGL.begin(LLVertexBuffer::QUADS); + gGL.begin(LLRender::QUADS); for (y = 0; y < STRIDE; y++) { @@ -1011,10 +1012,10 @@ void LLViewerObjectList::renderObjectBeacons() LLGLSUIDefault gls_ui; { - LLGLSNoTexture gls_ui_no_texture; + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); S32 last_line_width = -1; - // gGL.begin(LLVertexBuffer::LINES); // Always happens in (line_width != last_line_width) + // gGL.begin(LLRender::LINES); // Always happens in (line_width != last_line_width) for (S32 i = 0; i < mDebugBeacons.count(); i++) { @@ -1031,7 +1032,7 @@ void LLViewerObjectList::renderObjectBeacons() } glLineWidth( (F32)line_width ); last_line_width = line_width; - gGL.begin(LLVertexBuffer::LINES); + gGL.begin(LLRender::LINES); } const LLVector3 &thisline = debug_beacon.mPositionAgent; @@ -1049,11 +1050,11 @@ void LLViewerObjectList::renderObjectBeacons() } { - LLGLSNoTexture gls_ui_no_texture; + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); LLGLDepthTest gls_depth(GL_TRUE); S32 last_line_width = -1; - // gGL.begin(LLVertexBuffer::LINES); // Always happens in (line_width != last_line_width) + // gGL.begin(LLRender::LINES); // Always happens in (line_width != last_line_width) for (S32 i = 0; i < mDebugBeacons.count(); i++) { @@ -1069,7 +1070,7 @@ void LLViewerObjectList::renderObjectBeacons() } glLineWidth( (F32)line_width ); last_line_width = line_width; - gGL.begin(LLVertexBuffer::LINES); + gGL.begin(LLRender::LINES); } const LLVector3 &thisline = debug_beacon.mPositionAgent; diff --git a/linden/indra/newview/llgroupmgr.cpp b/linden/indra/newview/llgroupmgr.cpp index 30b7cbd..35d408b 100644 --- a/linden/indra/newview/llgroupmgr.cpp +++ b/linden/indra/newview/llgroupmgr.cpp @@ -52,6 +52,7 @@ #include "llfloaterdirectory.h" #include "llfloatergroupinfo.h" #include "lluictrlfactory.h" +#include const U32 MAX_CACHED_GROUPS = 10; @@ -791,6 +792,20 @@ LLGroupMgrGroupData* LLGroupMgr::getGroupData(const LLUUID& id) return NULL; } +// Helper function for LLGroupMgr::processGroupMembersReply +// This reformats date strings from MM/DD/YYYY to YYYY/MM/DD ( e.g. 1/27/2008 -> 2008/1/27 ) +// so that the sorter can sort by year before month before day. +static void formatDateString(std::string &date_string) +{ + using namespace boost; + cmatch result; + const regex expression("([0-9]{1,2})/([0-9]{1,2})/([0-9]{4})"); + if (regex_match(date_string.c_str(), result, expression)) + { + date_string = result[3]+"/"+result[1]+"/"+result[2]; + } +} + // static void LLGroupMgr::processGroupMembersReply(LLMessageSystem* msg, void** data) { @@ -840,6 +855,8 @@ void LLGroupMgr::processGroupMembersReply(LLMessageSystem* msg, void** data) if (member_id.notNull()) { + formatDateString(online_status); // reformat for sorting, e.g. 12/25/2008 -> 2008/12/25 + //llinfos << "Member " << member_id << " has powers " << std::hex << agent_powers << std::dec << llendl; LLGroupMemberData* newdata = new LLGroupMemberData(member_id, contribution, diff --git a/linden/indra/newview/llhomelocationresponder.cpp b/linden/indra/newview/llhomelocationresponder.cpp new file mode 100644 index 0000000..9b69310 --- /dev/null +++ b/linden/indra/newview/llhomelocationresponder.cpp @@ -0,0 +1,108 @@ +/** + * @file llhomelocationresponder.cpp + * @author Meadhbh Hamrick + * @brief Processes responses to the HomeLocation CapReq + * + * $LicenseInfo:firstyear=2008&license=viewergpl$ + * + * Copyright (c) 2008, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +/* File Inclusions */ +#include "llviewerprecompiledheaders.h" + +#include "llhomelocationresponder.h" +#include "llsdutil.h" +#include "llagent.h" +#include "llviewerregion.h" + +void LLHomeLocationResponder::result( const LLSD& content ) +{ + LLVector3 agent_pos; + bool error = true; + + do { + + // was the call to /agent//home-location successful? + // If not, we keep error set to true + if( ! content.has("success") ) + { + break; + } + + if( 0 != strncmp("true", content["success"].asString().c_str(), 4 ) ) + { + break; + } + + // did the simulator return a "justified" home location? + // If no, we keep error set to true + if( ! content.has( "HomeLocation" ) ) + { + break; + } + + if( ! content["HomeLocation"].has("LocationPos") ) + { + break; + } + + if( ! content["HomeLocation"]["LocationPos"].has("X") ) + { + break; + } + + agent_pos.mV[VX] = content["HomeLocation"]["LocationPos"]["X"].asInteger(); + + if( ! content["HomeLocation"]["LocationPos"].has("Y") ) + { + break; + } + + agent_pos.mV[VY] = content["HomeLocation"]["LocationPos"]["Y"].asInteger(); + + if( ! content["HomeLocation"]["LocationPos"].has("Z") ) + { + break; + } + + agent_pos.mV[VZ] = content["HomeLocation"]["LocationPos"]["Z"].asInteger(); + + error = false; + } while( 0 ); + + if( ! error ) + { + llinfos << "setting home position" << llendl; + + LLViewerRegion *viewer_region = gAgent.getRegion(); + gAgent.setHomePosRegion( viewer_region->getHandle(), agent_pos ); + } +} + +void LLHomeLocationResponder::error( const LLSD& content ) +{ + llinfos << "received error(" << ll_pretty_print_sd( content ) << ")" << llendl; +} diff --git a/linden/indra/newview/llhomelocationresponder.h b/linden/indra/newview/llhomelocationresponder.h new file mode 100644 index 0000000..08291b8 --- /dev/null +++ b/linden/indra/newview/llhomelocationresponder.h @@ -0,0 +1,47 @@ +/** + * @file llhomelocationresponder.h + * @author Meadhbh Hamrick + * @brief Processes responses to the HomeLocation CapReq + * + * $LicenseInfo:firstyear=2008&license=viewergpl$ + * + * Copyright (c) 2008, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + + /* Macro Definitions */ +#ifndef LL_LLHOMELOCATIONRESPONDER_H +#define LL_LLHOMELOCATIONRESPONDER_H + +/* File Inclusions */ +#include "llhttpclient.h" + +/* Typedef, Enum, Class, Struct, etc. */ +class LLHomeLocationResponder : public LLHTTPClient::Responder +{ + virtual void result( const LLSD& content ); + virtual void error( const LLSD& content ); +}; + +#endif diff --git a/linden/indra/newview/llhudeffectbeam.cpp b/linden/indra/newview/llhudeffectbeam.cpp index d6c38d3..2b5fd79 100644 --- a/linden/indra/newview/llhudeffectbeam.cpp +++ b/linden/indra/newview/llhudeffectbeam.cpp @@ -251,7 +251,7 @@ void LLHUDEffectBeam::render() } LLGLSPipelineAlpha gls_pipeline_alpha; - LLImageGL::unbindTexture(0, GL_TEXTURE_2D); + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); // Interpolate the global fade alpha diff --git a/linden/indra/newview/llhudeffectlookat.cpp b/linden/indra/newview/llhudeffectlookat.cpp index b5f6ec7..5f0bb90 100644 --- a/linden/indra/newview/llhudeffectlookat.cpp +++ b/linden/indra/newview/llhudeffectlookat.cpp @@ -499,14 +499,14 @@ void LLHUDEffectLookAt::render() { if (sDebugLookAt && mSourceObject.notNull()) { - LLGLSNoTexture gls_no_texture; + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); LLVector3 target = mTargetPos + ((LLVOAvatar*)(LLViewerObject*)mSourceObject)->mHeadp->getWorldPosition(); glMatrixMode(GL_MODELVIEW); gGL.pushMatrix(); gGL.translatef(target.mV[VX], target.mV[VY], target.mV[VZ]); glScalef(0.3f, 0.3f, 0.3f); - gGL.begin(LLVertexBuffer::LINES); + gGL.begin(LLRender::LINES); { LLColor3 color = (*mAttentions)[mTargetType].mColor; gGL.color3f(color.mV[VRED], color.mV[VGREEN], color.mV[VBLUE]); diff --git a/linden/indra/newview/llhudeffectpointat.cpp b/linden/indra/newview/llhudeffectpointat.cpp index 7ab03f2..2396e1a 100644 --- a/linden/indra/newview/llhudeffectpointat.cpp +++ b/linden/indra/newview/llhudeffectpointat.cpp @@ -328,13 +328,13 @@ void LLHUDEffectPointAt::render() update(); if (sDebugPointAt && mTargetType != POINTAT_TARGET_NONE) { - LLGLSNoTexture gls_no_texture; + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); LLVector3 target = mTargetPos + mSourceObject->getRenderPosition(); gGL.pushMatrix(); gGL.translatef(target.mV[VX], target.mV[VY], target.mV[VZ]); glScalef(0.3f, 0.3f, 0.3f); - gGL.begin(LLVertexBuffer::LINES); + gGL.begin(LLRender::LINES); { gGL.color3f(1.f, 0.f, 0.f); gGL.vertex3f(-1.f, 0.f, 0.f); diff --git a/linden/indra/newview/llhudicon.cpp b/linden/indra/newview/llhudicon.cpp index 85cc996..5d5c6a1 100644 --- a/linden/indra/newview/llhudicon.cpp +++ b/linden/indra/newview/llhudicon.cpp @@ -86,7 +86,7 @@ void LLHUDIcon::renderIcon(BOOL for_select) LLGLDepthTest gls_depth(GL_TRUE); if (for_select) { - LLViewerImage::unbindTexture(0); + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); } if (mHidden) @@ -163,10 +163,10 @@ void LLHUDIcon::renderIcon(BOOL for_select) LLColor4 icon_color = LLColor4::white; icon_color.mV[VALPHA] = alpha_factor; gGL.color4fv(icon_color.mV); - LLViewerImage::bindTexture(mImagep); + gGL.getTexUnit(0)->bind(mImagep.get()); } - gGL.begin(LLVertexBuffer::QUADS); + gGL.begin(LLRender::QUADS); { gGL.texCoord2f(0.f, 1.f); gGL.vertex3fv(upper_left.mV); diff --git a/linden/indra/newview/llhudtext.cpp b/linden/indra/newview/llhudtext.cpp index c45c284..c5e5419 100644 --- a/linden/indra/newview/llhudtext.cpp +++ b/linden/indra/newview/llhudtext.cpp @@ -120,6 +120,111 @@ LLHUDText::~LLHUDText() } +BOOL LLHUDText::lineSegmentIntersect(const LLVector3& start, const LLVector3& end, LLVector3& intersection, BOOL debug_render) +{ + if (!mVisible || mHidden) + { + return FALSE; + } + + // don't pick text that isn't bound to a viewerobject or isn't in a bubble + if (!mSourceObject || mSourceObject->mDrawable.isNull() || !mUseBubble) + { + return FALSE; + } + + F32 alpha_factor = 1.f; + LLColor4 text_color = mColor; + if (mDoFade) + { + if (mLastDistance > mFadeDistance) + { + alpha_factor = llmax(0.f, 1.f - (mLastDistance - mFadeDistance)/mFadeRange); + text_color.mV[3] = text_color.mV[3]*alpha_factor; + } + } + if (text_color.mV[3] < 0.01f) + { + return FALSE; + } + + mOffsetY = lltrunc(mHeight * ((mVertAlignment == ALIGN_VERT_CENTER) ? 0.5f : 1.f)); + + // scale screen size of borders down + //RN: for now, text on hud objects is never occluded + + LLVector3 x_pixel_vec; + LLVector3 y_pixel_vec; + + if (mOnHUDAttachment) + { + x_pixel_vec = LLVector3::y_axis / (F32)gViewerWindow->getWindowWidth(); + y_pixel_vec = LLVector3::z_axis / (F32)gViewerWindow->getWindowHeight(); + } + else + { + LLViewerCamera::getInstance()->getPixelVectors(mPositionAgent, y_pixel_vec, x_pixel_vec); + } + + LLVector3 width_vec = mWidth * x_pixel_vec; + LLVector3 height_vec = mHeight * y_pixel_vec; + + LLCoordGL screen_pos; + LLViewerCamera::getInstance()->projectPosAgentToScreen(mPositionAgent, screen_pos, FALSE); + + LLVector2 screen_offset; + screen_offset = updateScreenPos(mPositionOffset); + + LLVector3 render_position = mPositionAgent + + (x_pixel_vec * screen_offset.mV[VX]) + + (y_pixel_vec * screen_offset.mV[VY]); + + + if (mUseBubble) + { + LLVector3 bg_pos = render_position + + (F32)mOffsetY * y_pixel_vec + - (width_vec / 2.f) + - (height_vec); + //LLUI::translate(bg_pos.mV[VX], bg_pos.mV[VY], bg_pos.mV[VZ]); + + LLVector3 v[] = + { + bg_pos, + bg_pos + width_vec, + bg_pos + width_vec + height_vec, + bg_pos + height_vec, + }; + + if (debug_render) + { + gGL.begin(LLRender::LINE_STRIP); + gGL.vertex3fv(v[0].mV); + gGL.vertex3fv(v[1].mV); + gGL.vertex3fv(v[2].mV); + gGL.vertex3fv(v[3].mV); + gGL.vertex3fv(v[0].mV); + gGL.vertex3fv(v[2].mV); + gGL.end(); + } + + LLVector3 dir = end-start; + F32 t = 0.f; + + if (LLTriangleRayIntersect(v[0], v[1], v[2], start, dir, NULL, NULL, &t, FALSE) || + LLTriangleRayIntersect(v[2], v[3], v[0], start, dir, NULL, NULL, &t, FALSE) ) + { + if (t <= 1.f) + { + intersection = start + dir*t; + return TRUE; + } + } + } + + return FALSE; +} + void LLHUDText::render() { if (!mOnHUDAttachment && sDisplayText) @@ -152,7 +257,15 @@ void LLHUDText::renderText(BOOL for_select) return; } - LLGLState gls_tex(GL_TEXTURE_2D, for_select ? FALSE : TRUE); + if (for_select) + { + gGL.getTexUnit(0)->disable(); + } + else + { + gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE); + } + LLGLState gls_blend(GL_BLEND, for_select ? FALSE : TRUE); LLGLState gls_alpha(GL_ALPHA_TEST, for_select ? FALSE : TRUE); @@ -261,7 +374,7 @@ void LLHUDText::renderText(BOOL for_select) if (for_select) { - LLGLSNoTexture no_texture_state; + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); S32 name = mSourceObject->mGLName; LLColor4U coloru((U8)(name >> 16), (U8)(name >> 8), (U8)name); gGL.color4ubv(coloru.mV); @@ -271,7 +384,7 @@ void LLHUDText::renderText(BOOL for_select) } else { - LLViewerImage::bindTexture(imagep->getImage()); + gGL.getTexUnit(0)->bind(imagep->getImage()); gGL.color4fv(bg_color.mV); gl_segmented_rect_3d_tex(border_scale_vec, scaled_border_width, scaled_border_height, width_vec, height_vec); @@ -309,7 +422,7 @@ void LLHUDText::renderText(BOOL for_select) } LLUI::popMatrix(); - LLImageGL::unbindTexture(0); + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); LLGLDepthTest gls_depth(mZCompare ? GL_TRUE : GL_FALSE, GL_FALSE); LLVector3 box_center_offset; @@ -317,7 +430,7 @@ void LLHUDText::renderText(BOOL for_select) LLUI::translate(box_center_offset.mV[VX], box_center_offset.mV[VY], box_center_offset.mV[VZ]); gGL.color4fv(bg_color.mV); LLUI::setLineWidth(2.0); - gGL.begin(LLVertexBuffer::LINES); + gGL.begin(LLRender::LINES); { if (outside_width) { @@ -444,6 +557,10 @@ void LLHUDText::renderText(BOOL for_select) } /// Reset the default color to white. The renderer expects this to be the default. glColor4f(1.0f, 1.0f, 1.0f, 1.0f); + if (for_select) + { + gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE); + } } void LLHUDText::setStringUTF8(const std::string &wtext) diff --git a/linden/indra/newview/llhudtext.h b/linden/indra/newview/llhudtext.h index 5719a19..6403622 100644 --- a/linden/indra/newview/llhudtext.h +++ b/linden/indra/newview/llhudtext.h @@ -123,6 +123,8 @@ public: void setOnHUDAttachment(BOOL on_hud) { mOnHUDAttachment = on_hud; } void shift(const LLVector3& offset); + BOOL lineSegmentIntersect(const LLVector3& start, const LLVector3& end, LLVector3& intersection, BOOL debug_render = FALSE); + static void shiftAll(const LLVector3& offset); static void renderAllHUD(); static void addPickable(std::set &pick_list); diff --git a/linden/indra/newview/llinventorymodel.cpp b/linden/indra/newview/llinventorymodel.cpp index b1e3017..c3392ce 100644 --- a/linden/indra/newview/llinventorymodel.cpp +++ b/linden/indra/newview/llinventorymodel.cpp @@ -73,7 +73,6 @@ F32 LLInventoryModel::sMinTimeBetweenFetches = 0.3f; F32 LLInventoryModel::sMaxTimeBetweenFetches = 10.f; BOOL LLInventoryModel::sTimelyFetchPending = FALSE; LLFrameTimer LLInventoryModel::sFetchTimer; -LLInventoryModel::cat_map_t LLInventoryModel::sBulkFetchMap; S16 LLInventoryModel::sBulkFetchCount = 0; // RN: for some reason, using std::queue in the header file confuses the compiler which things it's an xmlrpc_queue @@ -85,7 +84,7 @@ static std::deque sFetchQueue; //BOOL decompress_file(const char* src_filename, const char* dst_filename); const F32 MAX_TIME_FOR_SINGLE_FETCH = 10.f; -const S32 MAX_FETCH_RETRIES = 5; +const S32 MAX_FETCH_RETRIES = 10; const char CACHE_FORMAT_STRING[] = "%s.inv"; const char* NEW_CATEGORY_NAME = "New Folder"; const char* NEW_CATEGORY_NAMES[LLAssetType::AT_COUNT] = @@ -990,13 +989,24 @@ BOOL LLInventoryModel::containsObserver(LLInventoryObserver* observer) // Call this method when it's time to update everyone on a new state, // by default, the inventory model will not update observers // automatically. -void LLInventoryModel::notifyObservers() +// The optional argument 'service_name' is used by Agent Inventory Service [DEV-20328] +void LLInventoryModel::notifyObservers(const std::string service_name) { for (observer_list_t::iterator iter = mObservers.begin(); iter != mObservers.end(); ) { LLInventoryObserver* observer = *iter; - observer->changed(mModifyMask); + + if (service_name.empty()) + { + observer->changed(mModifyMask); + } + else + { + observer->mMessageName = service_name; + observer->changed(mModifyMask); + } + // safe way to incrament since changed may delete entries! (@!##%@!@&*!) iter = mObservers.upper_bound(observer); } @@ -1038,6 +1048,79 @@ void LLInventoryModel::mock(const LLUUID& root_id) } */ +//If we get back a normal response, handle it here +void LLInventoryModel::fetchInventoryResponder::result(const LLSD& content) +{ + start_new_inventory_observer(); + + /*LLUUID agent_id; + agent_id = content["agent_id"].asUUID(); + if(agent_id != gAgent.getID()) + { + llwarns << "Got a inventory update for the wrong agent: " << agent_id + << llendl; + return; + }*/ + item_array_t items; + update_map_t update; + S32 count = content["items"].size(); + bool all_one_folder = true; + LLUUID folder_id; + // Does this loop ever execute more than once? -Gigs + for(S32 i = 0; i < count; ++i) + { + LLPointer titem = new LLViewerInventoryItem; + titem->unpackMessage(content["items"][i]); + + lldebugs << "LLInventoryModel::messageUpdateCore() item id:" + << titem->getUUID() << llendl; + items.push_back(titem); + // examine update for changes. + LLViewerInventoryItem* itemp = gInventory.getItem(titem->getUUID()); + if(itemp) + { + if(titem->getParentUUID() == itemp->getParentUUID()) + { + update[titem->getParentUUID()]; + } + else + { + ++update[titem->getParentUUID()]; + --update[itemp->getParentUUID()]; + } + } + else + { + ++update[titem->getParentUUID()]; + } + if (folder_id.isNull()) + { + folder_id = titem->getParentUUID(); + } + else + { + all_one_folder = false; + } + } + + U32 changes = 0x0; + //as above, this loop never seems to loop more than once per call + for (item_array_t::iterator it = items.begin(); it != items.end(); ++it) + { + changes |= gInventory.updateItem(*it); + } + gInventory.notifyObservers("fetchinventory"); + gViewerWindow->getWindow()->decBusyCount(); +} + +//If we get back an error (not found, etc...), handle it here +void LLInventoryModel::fetchInventoryResponder::error(U32 status, const std::string& reason) +{ + llinfos << "fetchInventory::error " + << status << ": " << reason << llendl; + gInventory.notifyObservers("fetchinventory"); +} + void LLInventoryModel::fetchDescendentsOf(const LLUUID& folder_id) { LLViewerInventoryCategory* cat = getCategory(folder_id); @@ -1065,21 +1148,31 @@ void LLInventoryModel::fetchDescendentsOf(const LLUUID& folder_id) } //Initialize statics. -LLAlertDialog* LLInventoryModel::fetchDescendentsResponder::sRetryDialog=NULL; -LLSD LLInventoryModel::fetchDescendentsResponder::sRetrySD; - bool LLInventoryModel::isBulkFetchProcessingComplete() { return ( (sFetchQueue.empty() - && sBulkFetchMap.empty() - && sBulkFetchCount==0) ? TRUE : FALSE ) ; + && sBulkFetchCount<=0) ? TRUE : FALSE ) ; } +class fetchDescendentsResponder: public LLHTTPClient::Responder +{ + public: + fetchDescendentsResponder(const LLSD& request_sd) : mRequestSD(request_sd) {}; + //fetchDescendentsResponder() {}; + void result(const LLSD& content); + void error(U32 status, const std::string& reason); + public: + typedef std::vector folder_ref_t; + protected: + LLSD mRequestSD; +}; + //If we get back a normal response, handle it here -void LLInventoryModel::fetchDescendentsResponder::result(const LLSD& content) -{ +void fetchDescendentsResponder::result(const LLSD& content) +{ if (content.has("folders")) { + for(LLSD::array_const_iterator folder_it = content["folders"].beginArray(); folder_it != content["folders"].endArray(); ++folder_it) @@ -1087,19 +1180,54 @@ void LLInventoryModel::fetchDescendentsResponder::result(const LLSD& content) LLSD folder_sd = *folder_it; - LLUUID agent_id = folder_sd["agent-id"]; + //LLUUID agent_id = folder_sd["agent_id"]; - if(agent_id != gAgent.getID()) //This should never happen. - { - llwarns << "Got a UpdateInventoryItem for the wrong agent." - << llendl; - break; - } - LLUUID parent_id = folder_sd["folder-id"]; - LLUUID owner_id = folder_sd["owner-id"]; + //if(agent_id != gAgent.getID()) //This should never happen. + //{ + // llwarns << "Got a UpdateInventoryItem for the wrong agent." + // << llendl; + // break; + //} + + LLUUID parent_id = folder_sd["folder_id"]; + LLUUID owner_id = folder_sd["owner_id"]; S32 version = (S32)folder_sd["version"].asInteger(); S32 descendents = (S32)folder_sd["descendents"].asInteger(); LLPointer tcategory = new LLViewerInventoryCategory(owner_id); + + if (parent_id.isNull()) + { + LLPointer titem = new LLViewerInventoryItem; + for(LLSD::array_const_iterator item_it = folder_sd["items"].beginArray(); + item_it != folder_sd["items"].endArray(); + ++item_it) + { + LLUUID lost_uuid = gInventory.findCategoryUUIDForType(LLAssetType::AT_LOST_AND_FOUND); + if (lost_uuid.notNull()) + { + LLSD item = *item_it; + titem->unpackMessage(item); + + LLInventoryModel::update_list_t update; + LLInventoryModel::LLCategoryUpdate new_folder(lost_uuid, 1); + update.push_back(new_folder); + gInventory.accountForUpdate(update); + + titem->setParent(lost_uuid); + titem->updateParentOnServer(FALSE); + gInventory.updateItem(titem); + gInventory.notifyObservers("fetchDescendents"); + + } + } + } + + LLViewerInventoryCategory* pcat = gInventory.getCategory(parent_id); + if (!pcat) + { + continue; + } + for(LLSD::array_const_iterator category_it = folder_sd["categories"].beginArray(); category_it != folder_sd["categories"].endArray(); ++category_it) @@ -1107,7 +1235,7 @@ void LLInventoryModel::fetchDescendentsResponder::result(const LLSD& content) LLSD category = *category_it; tcategory->fromLLSD(category); - if (sFullFetchStarted) + if (LLInventoryModel::sFullFetchStarted) { sFetchQueue.push_back(tcategory->getUUID()); } @@ -1139,37 +1267,37 @@ void LLInventoryModel::fetchDescendentsResponder::result(const LLSD& content) } } - if (content.has("bad-folders")) + if (content.has("bad_folders")) { - for(LLSD::array_const_iterator folder_it = content["bad-folders"].beginArray(); - folder_it != content["bad-folders"].endArray(); + for(LLSD::array_const_iterator folder_it = content["bad_folders"].beginArray(); + folder_it != content["bad_folders"].endArray(); ++folder_it) { LLSD folder_sd = *folder_it; //These folders failed on the dataserver. We probably don't want to retry them. - llinfos << "Folder " << folder_sd["folder-id"].asString() + llinfos << "Folder " << folder_sd["folder_id"].asString() << "Error: " << folder_sd["error"].asString() << llendl; } } LLInventoryModel::incrBulkFetch(-1); - if (isBulkFetchProcessingComplete()) + if (LLInventoryModel::isBulkFetchProcessingComplete()) { llinfos << "Inventory fetch completed" << llendl; - if (sFullFetchStarted) + if (LLInventoryModel::sFullFetchStarted) { - sAllFoldersFetched = TRUE; + LLInventoryModel::sAllFoldersFetched = TRUE; } - stopBackgroundFetch(); + LLInventoryModel::stopBackgroundFetch(); } - gInventory.notifyObservers(); + gInventory.notifyObservers("fetchDescendents"); } //If we get back an error (not found, etc...), handle it here -void LLInventoryModel::fetchDescendentsResponder::error(U32 status, const std::string& reason) +void fetchDescendentsResponder::error(U32 status, const std::string& reason) { llinfos << "fetchDescendentsResponder::error " << status << ": " << reason << llendl; @@ -1183,61 +1311,22 @@ void LLInventoryModel::fetchDescendentsResponder::error(U32 status, const std::s ++folder_it) { LLSD folder_sd = *folder_it; - sRetrySD["folders"].append(folder_sd); - } - sMinTimeBetweenFetches = 10.0f; //Add 10 seconds for every time out in this sequence. - - if (!sRetryDialog) //The dialog isn't up. Prompt the resident. - { - sRetryDialog = gViewerWindow->alertXml("RetryFetchInventoryDescendents", onClickRetry, this); + LLUUID folder_id = folder_sd["folder_id"]; + sFetchQueue.push_front(folder_id); } } else { - if (isBulkFetchProcessingComplete()) + if (LLInventoryModel::isBulkFetchProcessingComplete()) { - if (sFullFetchStarted) + if (LLInventoryModel::sFullFetchStarted) { - sAllFoldersFetched = TRUE; + LLInventoryModel::sAllFoldersFetched = TRUE; } - stopBackgroundFetch(); + LLInventoryModel::stopBackgroundFetch(); } } - gInventory.notifyObservers(); -} - -void LLInventoryModel::fetchDescendentsResponder::onClickRetry(S32 option, void* userdata) -{ - if (option == 0) - { - std::string url; - - LLViewerRegion * agent_region = gAgent.getRegion(); - if (agent_region) - { - url = agent_region->getCapability("FetchInventoryDescendents"); - } - - if (!url.empty()) //Capability found. Build up LLSD and use it. - { - LLSD body = sRetrySD; - LLInventoryModel::incrBulkFetch(1); - LLHTTPClient::post(url, body, new LLInventoryModel::fetchDescendentsResponder(body),300); - } - } - else - { - if (isBulkFetchProcessingComplete()) - { - if (sFullFetchStarted) - { - sAllFoldersFetched = TRUE; - } - stopBackgroundFetch(); - } - } - sRetryDialog=NULL; - sRetrySD.clear(); + gInventory.notifyObservers("fetchDescendents"); } //static Bundle up a bunch of requests to send all at once. @@ -1250,7 +1339,7 @@ void LLInventoryModel::bulkFetch(std::string url) S16 max_concurrent_fetches=8; F32 new_min_time = 0.5f; //HACK! Clean this up when old code goes away entirely. - if (sMinTimeBetweenFetches <= new_min_time) sMinTimeBetweenFetches=new_min_time; //HACK! See above. + if (sMinTimeBetweenFetches < new_min_time) sMinTimeBetweenFetches=new_min_time; //HACK! See above. if(gDisconnected || sBulkFetchCount > max_concurrent_fetches @@ -1259,88 +1348,84 @@ void LLInventoryModel::bulkFetch(std::string url) return; // just bail if we are disconnected. } - //HACK. This is inelegant. We're shuffling a dequeue to a map to get rid of - //redundant requests. When we get rid of the old code entirely, we can change - //the dequeue to a map. In the new model, there is no benefit to queue order. U32 folder_count=0; - U32 max_batch_size=10; - while( !(sFetchQueue.empty() ) ) - { - LLViewerInventoryCategory* cat = gInventory.getCategory(sFetchQueue.front()); - - if (cat) - { - if ( !gInventory.isCategoryComplete(cat->getUUID()) ) //grab this folder. - { - sBulkFetchMap[(cat->getUUID())] = cat; - } - else if (sFullFetchStarted) - { //Already have this folder but append child folders to list. - // add all children to queue - parent_cat_map_t::iterator cat_it = gInventory.mParentChildCategoryTree.find(cat->getUUID()); - if (cat_it != gInventory.mParentChildCategoryTree.end()) - { - cat_array_t* child_categories = cat_it->second; - - for (S32 child_num = 0; child_num < child_categories->count(); child_num++) - { - sFetchQueue.push_back(child_categories->get(child_num)->getUUID()); - } - } + U32 max_batch_size=5; + + U32 sort_order = gSavedSettings.getU32("InventorySortOrder") & 0x1; + + LLSD body; + LLSD body_lib; + while( !(sFetchQueue.empty() ) && (folder_count < max_batch_size) ) + { + if (sFetchQueue.front().isNull()) //DEV-17797 + { + LLSD folder_sd; + folder_sd["folder_id"] = LLUUID::null.asString(); + folder_sd["owner_id"] = gAgent.getID(); + folder_sd["sort_order"] = (LLSD::Integer)sort_order; + folder_sd["fetch_folders"] = (LLSD::Boolean)FALSE; + folder_sd["fetch_items"] = (LLSD::Boolean)TRUE; + body["folders"].append(folder_sd); + folder_count++; + } + else + { + - } - } + LLViewerInventoryCategory* cat = gInventory.getCategory(sFetchQueue.front()); + + if (cat) + { + if ( LLViewerInventoryCategory::VERSION_UNKNOWN == cat->getVersion()) + { + LLSD folder_sd; + folder_sd["folder_id"] = cat->getUUID(); + folder_sd["owner_id"] = cat->getOwnerID(); + folder_sd["sort_order"] = (LLSD::Integer)sort_order; + folder_sd["fetch_folders"] = TRUE; //(LLSD::Boolean)sFullFetchStarted; + folder_sd["fetch_items"] = (LLSD::Boolean)TRUE; + + if (ALEXANDRIA_LINDEN_ID == cat->getOwnerID()) + body_lib["folders"].append(folder_sd); + else + body["folders"].append(folder_sd); + folder_count++; + } + if (sFullFetchStarted) + { //Already have this folder but append child folders to list. + // add all children to queue + parent_cat_map_t::iterator cat_it = gInventory.mParentChildCategoryTree.find(cat->getUUID()); + if (cat_it != gInventory.mParentChildCategoryTree.end()) + { + cat_array_t* child_categories = cat_it->second; + + for (S32 child_num = 0; child_num < child_categories->count(); child_num++) + { + sFetchQueue.push_back(child_categories->get(child_num)->getUUID()); + } + } + + } + } + } sFetchQueue.pop_front(); } - - if (!sBulkFetchMap.empty()) //There's stuff to fetch. - { - U32 sort_order = gSavedSettings.getU32("InventorySortOrder") & 0x1; - - LLSD body; - - cat_map_t::iterator iter=sBulkFetchMap.begin(); - while( iter!=sBulkFetchMap.end() && (folder_count < max_batch_size) ) - { - LLViewerInventoryCategory* cat = iter->second; - - if (cat && !gInventory.isCategoryComplete(cat->getUUID()) ) //Category exists - { - BOOL fetchItems=TRUE; - if ( sFullFetchStarted - && gInventory.isCategoryComplete(cat->getUUID()) ) - { - fetchItems=FALSE; - } - - LLSD folder_sd; - folder_sd["folder-id"] = cat->getUUID(); - folder_sd["owner-id"] = cat->getOwnerID(); - folder_sd["sort-order"] = (LLSD::Integer)sort_order; - folder_sd["fetch-folders"] = (LLSD::Boolean)sFullFetchStarted; - folder_sd["fetch-items"] = (LLSD::Boolean)fetchItems; - body["folders"].append(folder_sd); - - folder_count++; - } - sBulkFetchMap.erase(iter); - iter=sBulkFetchMap.begin(); - } - - if (iter == sBulkFetchMap.end()) sBulkFetchMap.clear(); - if (folder_count > 0) { sBulkFetchCount++; - - LLHTTPClient::post(url, body, new LLInventoryModel::fetchDescendentsResponder(body)); + if (body["folders"].size()) + { + LLHTTPClient::post(url, body, new fetchDescendentsResponder(body),300.0); + } + if (body_lib["folders"].size()) + { + std::string url_lib = gAgent.getRegion()->getCapability("FetchLibDescendents"); + LLHTTPClient::post(url_lib, body_lib, new fetchDescendentsResponder(body_lib),300.0); + } sFetchTimer.reset(); } - - } - - if (isBulkFetchProcessingComplete()) + else if (isBulkFetchProcessingComplete()) { if (sFullFetchStarted) { @@ -1391,6 +1476,14 @@ void LLInventoryModel::startBackgroundFetch(const LLUUID& cat_id) } //static +void LLInventoryModel::findLostItems() +{ + sBackgroundFetchActive = TRUE; + sFetchQueue.push_back(LLUUID::null); + gIdleCallbacks.addFunction(&LLInventoryModel::backgroundFetch, NULL); +} + +//static void LLInventoryModel::stopBackgroundFetch() { if (sBackgroundFetchActive) @@ -1409,14 +1502,7 @@ void LLInventoryModel::backgroundFetch(void*) if (sBackgroundFetchActive) { //If we'll be using the capability, we'll be sending batches and the background thing isn't as important. - std::string url; - - LLViewerRegion * agent_region = gAgent.getRegion(); - if (agent_region) - { - url = agent_region->getCapability("FetchInventoryDescendents"); - } - + std::string url = gAgent.getRegion()->getCapability("WebFetchInventoryDescendents"); if (!url.empty()) { bulkFetch(url); @@ -3373,12 +3459,72 @@ bool LLInventoryFetchObserver::isEverythingComplete() const return mIncomplete.empty(); } +void fetch_items_from_llsd(const LLSD& items_llsd) +{ + if (!items_llsd.size()) return; + LLSD body; + body[0]["cap_name"] = "FetchInventory"; + body[1]["cap_name"] = "FetchLib"; + for (S32 i=0; i= body[i].size()) continue; + std::string url = gAgent.getRegion()->getCapability(body[i]["cap_name"].asString()); + + if (!url.empty()) + { + body[i]["agent_id"] = gAgent.getID(); + LLHTTPClient::post(url, body[i], new LLInventoryModel::fetchInventoryResponder(body[i])); + break; + } + + LLMessageSystem* msg = gMessageSystem; + BOOL start_new_message = TRUE; + for (S32 j=0; jnewMessageFast(_PREHASH_FetchInventory); + msg->nextBlockFast(_PREHASH_AgentData); + msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); + msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); + } + msg->nextBlockFast(_PREHASH_InventoryData); + msg->addUUIDFast(_PREHASH_OwnerID, item_entry["owner_id"].asUUID()); + msg->addUUIDFast(_PREHASH_ItemID, item_entry["item_id"].asUUID()); + if(msg->isSendFull(NULL)) + { + start_new_message = TRUE; + gAgent.sendReliableMessage(); + } + } + if(!start_new_message) + { + gAgent.sendReliableMessage(); + } + } +} + void LLInventoryFetchObserver::fetchItems( const LLInventoryFetchObserver::item_ref_t& ids) { - LLMessageSystem* msg = gMessageSystem; - BOOL start_new_message = TRUE; LLUUID owner_id; + LLSD items_llsd; for(item_ref_t::const_iterator it = ids.begin(); it < ids.end(); ++it) { LLViewerInventoryItem* item = gInventory.getItem(*it); @@ -3400,31 +3546,18 @@ void LLInventoryFetchObserver::fetchItems( // assume it's agent inventory. owner_id = gAgent.getID(); } - + // It's incomplete, so put it on the incomplete container, and // pack this on the message. mIncomplete.push_back(*it); - if(start_new_message) - { - start_new_message = FALSE; - msg->newMessageFast(_PREHASH_FetchInventory); - msg->nextBlockFast(_PREHASH_AgentData); - msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); - msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); - } - msg->nextBlockFast(_PREHASH_InventoryData); - msg->addUUIDFast(_PREHASH_OwnerID, owner_id); - msg->addUUIDFast(_PREHASH_ItemID, (*it)); - if(msg->isSendFull(NULL)) - { - start_new_message = TRUE; - gAgent.sendReliableMessage(); - } - } - if(!start_new_message) - { - gAgent.sendReliableMessage(); + + // Prepare the data to fetch + LLSD item_entry; + item_entry["owner_id"] = owner_id; + item_entry["item_id"] = (*it); + items_llsd.append(item_entry); } + fetch_items_from_llsd(items_llsd); } // virtual @@ -3579,9 +3712,8 @@ void LLInventoryFetchComboObserver::fetch( // descendent of an incomplete folder because the item will show // up in an inventory descendents message soon enough so we do not // have to fetch it individually. + LLSD items_llsd; LLUUID owner_id; - LLMessageSystem* msg = gMessageSystem; - bool start_new_message = true; for(item_ref_t::const_iterator iit = item_ids.begin(); iit != item_ids.end(); ++iit) { LLViewerInventoryItem* item = gInventory.getItem(*iit); @@ -3604,33 +3736,17 @@ void LLInventoryFetchComboObserver::fetch( } if(std::find(mIncompleteFolders.begin(), mIncompleteFolders.end(), item->getParentUUID()) == mIncompleteFolders.end()) { - lldebugs << "fetching item " << *iit << llendl; - if(start_new_message) - { - start_new_message = false; - msg->newMessageFast(_PREHASH_FetchInventory); - msg->nextBlockFast(_PREHASH_AgentData); - msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); - msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); - } - msg->nextBlockFast(_PREHASH_InventoryData); - msg->addUUIDFast(_PREHASH_OwnerID, owner_id); - msg->addUUIDFast(_PREHASH_ItemID, (*iit)); - if(msg->isSendFullFast(_PREHASH_InventoryData)) - { - start_new_message = true; - gAgent.sendReliableMessage(); - } + LLSD item_entry; + item_entry["owner_id"] = owner_id; + item_entry["item_id"] = (*iit); + items_llsd.append(item_entry); } else { lldebugs << "not worrying about " << *iit << llendl; } } - if(!start_new_message) - { - gAgent.sendReliableMessage(); - } + fetch_items_from_llsd(items_llsd); } void LLInventoryExistenceObserver::watchItem(const LLUUID& id) @@ -3676,7 +3792,17 @@ void LLInventoryAddedObserver::changed(U32 mask) // the network, figure out which item was updated. // Code from Gigs Taggert, sin allowed by JC. LLMessageSystem* msg = gMessageSystem; - std::string msg_name = msg->getMessageName(); + + std::string msg_name; + if (mMessageName.empty()) + { + msg_name = msg->getMessageName(); + } + else + { + msg_name = mMessageName; + } + if (msg_name.empty()) { return; diff --git a/linden/indra/newview/llinventorymodel.h b/linden/indra/newview/llinventorymodel.h index 8017410..d2be761 100644 --- a/linden/indra/newview/llinventorymodel.h +++ b/linden/indra/newview/llinventorymodel.h @@ -69,6 +69,7 @@ public: }; virtual ~LLInventoryObserver() {}; virtual void changed(U32 mask) = 0; + std::string mMessageName; // used by Agent Inventory Service only. [DEV-20328] }; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -110,20 +111,17 @@ public: LLInventoryModel(); ~LLInventoryModel(); - class fetchDescendentsResponder: public LLHTTPClient::Responder + class fetchInventoryResponder: public LLHTTPClient::Responder { - public: - fetchDescendentsResponder(const LLSD& request_sd) : mRequestSD(request_sd) {}; - void result(const LLSD& content); - void error(U32 status, const std::string& reason); - static void onClickRetry(S32 option, void* userdata); - static void appendRetryList(LLSD retry_sd); - public: - typedef std::vector folder_ref_t; - protected: - LLSD mRequestSD; - static LLSD sRetrySD; - static LLAlertDialog *sRetryDialog; + public: + fetchInventoryResponder(const LLSD& request_sd) : mRequestSD(request_sd) {}; + void result(const LLSD& content); + void error(U32 status, const std::string& reason); + + public: + typedef std::vector folder_ref_t; + protected: + LLSD mRequestSD; }; // @@ -268,7 +266,8 @@ public: // Call this method when it's time to update everyone on a new // state, by default, the inventory model will not update // observers automatically. - void notifyObservers(); + // The optional argument 'service_name' is used by Agent Inventory Service [DEV-20328] + void notifyObservers(const std::string service_name=""); // This allows outsiders to tell the inventory if something has // been changed 'under the hood', but outside the control of the @@ -370,7 +369,7 @@ public: // start and stop background breadth-first fetching of inventory contents // this gets triggered when performing a filter-search static void startBackgroundFetch(const LLUUID& cat_id = LLUUID::null); // start fetch process - static void stopBackgroundFetch(); // stop fetch process + static void findLostItems(); static BOOL backgroundFetchActive(); static bool isEverythingFetched(); static void backgroundFetch(void*); // background fetch idle function @@ -419,7 +418,6 @@ protected: static void processInventoryDescendents(LLMessageSystem* msg, void**); static void processMoveInventoryItem(LLMessageSystem* msg, void**); static void processFetchInventoryReply(LLMessageSystem* msg, void**); - static bool isBulkFetchProcessingComplete(); bool messageUpdateCore(LLMessageSystem* msg, bool do_accounting); @@ -460,11 +458,8 @@ protected: observer_list_t mObservers; // completing the fetch once per session should be sufficient - static cat_map_t sBulkFetchMap; static BOOL sBackgroundFetchActive; static BOOL sTimelyFetchPending; - static BOOL sAllFoldersFetched; - static BOOL sFullFetchStarted; static S32 sNumFetchRetries; static LLFrameTimer sFetchTimer; static F32 sMinTimeBetweenFetches; @@ -477,6 +472,11 @@ protected: public: // *NOTE: DEBUG functionality void dumpInventory(); + static bool isBulkFetchProcessingComplete(); + static void stopBackgroundFetch(); // stop fetch process + + static BOOL sFullFetchStarted; + static BOOL sAllFoldersFetched; }; // a special inventory model for the agent diff --git a/linden/indra/newview/llinventoryview.cpp b/linden/indra/newview/llinventoryview.cpp index f9dd70d..418578e 100644 --- a/linden/indra/newview/llinventoryview.cpp +++ b/linden/indra/newview/llinventoryview.cpp @@ -1329,6 +1329,16 @@ LLView* LLInventoryPanel::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFac return panel; } +void LLInventoryPanel::draw() +{ + // select the desired item (in case it wasn't loaded when the selection was requested) + if (mSelectThisID.notNull()) + { + setSelection(mSelectThisID, false); + } + LLPanel::draw(); +} + void LLInventoryPanel::setFilterTypes(U32 filter_types) { mFolders->getFilter()->setFilterTypes(filter_types); @@ -1701,15 +1711,21 @@ void LLInventoryPanel::setSelection(const LLUUID& obj_id, BOOL take_keyboard_foc LLFolderViewItem* itemp = mFolders->getItemByID(obj_id); if(itemp && itemp->getListener()) { - itemp->getListener()->arrangeAndSet(itemp, - TRUE, - take_keyboard_focus); + itemp->getListener()->arrangeAndSet(itemp, TRUE, take_keyboard_focus); + mSelectThisID.setNull(); + return; + } + else + { + // save the desired item to be selected later (if/when ready) + mSelectThisID = obj_id; } } void LLInventoryPanel::clearSelection() { mFolders->clearSelection(); + mSelectThisID.setNull(); } void LLInventoryPanel::createNewItem(const std::string& name, diff --git a/linden/indra/newview/llinventoryview.h b/linden/indra/newview/llinventoryview.h index a37d370..1cf8b8f 100644 --- a/linden/indra/newview/llinventoryview.h +++ b/linden/indra/newview/llinventoryview.h @@ -86,6 +86,7 @@ public: static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory); // LLView methods + void draw(); BOOL handleHover(S32 x, S32 y, MASK mask); BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType cargo_type, @@ -150,7 +151,8 @@ protected: LLFolderView* mFolders; LLScrollableContainerView* mScroller; BOOL mAllowMultiSelect; - const std::string mSortOrderSetting; + const std::string mSortOrderSetting; + LLUUID mSelectThisID; // if non null, select this item }; class LLInventoryView; diff --git a/linden/indra/newview/lljoystickbutton.cpp b/linden/indra/newview/lljoystickbutton.cpp index 773c57e..ff54569 100644 --- a/linden/indra/newview/lljoystickbutton.cpp +++ b/linden/indra/newview/lljoystickbutton.cpp @@ -651,11 +651,11 @@ void LLJoystickCameraRotate::drawRotatedImage( const LLImageGL* image, S32 rotat { 1.f, 0.f } }; - image->bind(); + gGL.getTexUnit(0)->bind(image); gGL.color4fv(UI_VERTEX_COLOR.mV); - gGL.begin(LLVertexBuffer::QUADS); + gGL.begin(LLRender::QUADS); { gGL.texCoord2fv( uv[ (rotations + 0) % 4]); gGL.vertex2i(width, height ); diff --git a/linden/indra/newview/llmanip.cpp b/linden/indra/newview/llmanip.cpp index 89f13fe..87e7a13 100644 --- a/linden/indra/newview/llmanip.cpp +++ b/linden/indra/newview/llmanip.cpp @@ -388,13 +388,13 @@ void LLManip::renderGuidelines(BOOL draw_x, BOOL draw_y, BOOL draw_z) const F32 LINE_ALPHA = 0.33f; - LLGLSNoTexture gls_no_texture; + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); LLUI::setLineWidth(1.5f); if (draw_x) { gGL.color4f(1.f, 0.f, 0.f, LINE_ALPHA); - gGL.begin(LLVertexBuffer::LINES); + gGL.begin(LLRender::LINES); gGL.vertex3f( -region_size, 0.f, 0.f ); gGL.vertex3f( region_size, 0.f, 0.f ); gGL.end(); @@ -403,7 +403,7 @@ void LLManip::renderGuidelines(BOOL draw_x, BOOL draw_y, BOOL draw_z) if (draw_y) { gGL.color4f(0.f, 1.f, 0.f, LINE_ALPHA); - gGL.begin(LLVertexBuffer::LINES); + gGL.begin(LLRender::LINES); gGL.vertex3f( 0.f, -region_size, 0.f ); gGL.vertex3f( 0.f, region_size, 0.f ); gGL.end(); @@ -412,7 +412,7 @@ void LLManip::renderGuidelines(BOOL draw_x, BOOL draw_y, BOOL draw_z) if (draw_z) { gGL.color4f(0.f, 0.f, 1.f, LINE_ALPHA); - gGL.begin(LLVertexBuffer::LINES); + gGL.begin(LLRender::LINES); gGL.vertex3f( 0.f, 0.f, -region_size ); gGL.vertex3f( 0.f, 0.f, region_size ); gGL.end(); diff --git a/linden/indra/newview/llmaniprotate.cpp b/linden/indra/newview/llmaniprotate.cpp index 11b5e8c..ade07b4 100644 --- a/linden/indra/newview/llmaniprotate.cpp +++ b/linden/indra/newview/llmaniprotate.cpp @@ -115,7 +115,7 @@ void LLManipRotate::handleSelect() void LLManipRotate::render() { LLGLSUIDefault gls_ui; - LLGLSNoTexture gls_no_texture; + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); LLGLDepthTest gls_depth(GL_TRUE); LLGLEnable gl_blend(GL_BLEND); LLGLEnable gls_alpha_test(GL_ALPHA_TEST); @@ -838,7 +838,7 @@ void LLManipRotate::renderSnapGuides() LLVector3 outer_point; LLVector3 text_point; LLQuaternion rot(deg * DEG_TO_RAD, constraint_axis); - gGL.begin(LLVertexBuffer::LINES); + gGL.begin(LLRender::LINES); { inner_point = (projected_snap_axis * mRadiusMeters * SNAP_GUIDE_INNER_RADIUS * rot) + center; F32 tick_length = 0.f; @@ -1017,7 +1017,7 @@ void LLManipRotate::renderSnapGuides() object_axis = object_axis * SNAP_GUIDE_INNER_RADIUS * mRadiusMeters + center; LLVector3 line_start = center; - gGL.begin(LLVertexBuffer::LINES); + gGL.begin(LLRender::LINES); { gGL.vertex3fv(line_start.mV); gGL.vertex3fv(object_axis.mV); @@ -1025,7 +1025,7 @@ void LLManipRotate::renderSnapGuides() gGL.end(); // draw snap guide arrow - gGL.begin(LLVertexBuffer::TRIANGLES); + gGL.begin(LLRender::TRIANGLES); { LLVector3 arrow_dir; LLVector3 arrow_span = (object_axis - line_start) % getConstraintAxis(); @@ -1045,7 +1045,7 @@ void LLManipRotate::renderSnapGuides() { LLGLDepthTest gls_depth(GL_TRUE); - gGL.begin(LLVertexBuffer::LINES); + gGL.begin(LLRender::LINES); { gGL.vertex3fv(line_start.mV); gGL.vertex3fv(object_axis.mV); @@ -1053,7 +1053,7 @@ void LLManipRotate::renderSnapGuides() gGL.end(); // draw snap guide arrow - gGL.begin(LLVertexBuffer::TRIANGLES); + gGL.begin(LLRender::TRIANGLES); { LLVector3 arrow_dir; LLVector3 arrow_span = (object_axis - line_start) % getConstraintAxis(); diff --git a/linden/indra/newview/llmanipscale.cpp b/linden/indra/newview/llmanipscale.cpp index 0fa5fa5..5c9c889 100644 --- a/linden/indra/newview/llmanipscale.cpp +++ b/linden/indra/newview/llmanipscale.cpp @@ -197,7 +197,7 @@ LLManipScale::~LLManipScale() void LLManipScale::render() { LLGLSUIDefault gls_ui; - LLGLSNoTexture gls_no_texture; + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); LLGLDepthTest gls_depth(GL_TRUE); LLGLEnable gl_blend(GL_BLEND); LLGLEnable gls_alpha_test(GL_ALPHA_TEST); @@ -590,7 +590,7 @@ void LLManipScale::renderFaces( const LLBBox& bbox ) { gGL.color4fv( default_normal_color.mV ); LLGLDepthTest gls_depth(GL_FALSE); - gGL.begin(LLVertexBuffer::QUADS); + gGL.begin(LLRender::QUADS); { // Face 0 gGL.vertex3f(min.mV[VX], max.mV[VY], max.mV[VZ]); @@ -751,7 +751,7 @@ void LLManipScale::renderCorners( const LLBBox& bbox ) void LLManipScale::renderBoxHandle( F32 x, F32 y, F32 z ) { - LLImageGL::unbindTexture(0); + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); LLGLDepthTest gls_depth(GL_FALSE); glPushMatrix(); @@ -1528,7 +1528,7 @@ void LLManipScale::renderSnapGuides(const LLBBox& bbox) { LLColor4 tick_color = setupSnapGuideRenderPass(pass); - gGL.begin(LLVertexBuffer::LINES); + gGL.begin(LLRender::LINES); LLVector3 line_mid = mScaleCenter + (mScaleSnapValue * mScaleDir) + (mSnapGuideDir1 * mSnapRegimeOffset); LLVector3 line_start = line_mid - (mScaleDir * (llmin(mScaleSnapValue, mSnapGuideLength * 0.5f))); LLVector3 line_end = line_mid + (mScaleDir * llmin(max_point_on_scale_line - mScaleSnapValue, mSnapGuideLength * 0.5f)); @@ -1579,7 +1579,7 @@ void LLManipScale::renderSnapGuides(const LLBBox& bbox) if (mInSnapRegime) { // draw snap guide line - gGL.begin(LLVertexBuffer::LINES); + gGL.begin(LLRender::LINES); LLVector3 snap_line_center = mScaleCenter + (mScaleSnapValue * mScaleDir); LLVector3 snap_line_start = snap_line_center + (mSnapGuideDir1 * mSnapRegimeOffset); @@ -1593,7 +1593,7 @@ void LLManipScale::renderSnapGuides(const LLBBox& bbox) gGL.end(); // draw snap guide arrow - gGL.begin(LLVertexBuffer::TRIANGLES); + gGL.begin(LLRender::TRIANGLES); { //gGLSNoCullFaces.set(); gGL.color4f(1.f, 1.f, 1.f, grid_alpha); @@ -1628,7 +1628,7 @@ void LLManipScale::renderSnapGuides(const LLBBox& bbox) start_tick = -(llmin(ticks_from_scale_center_1, num_ticks_per_side1)); stop_tick = llmin(max_ticks1, num_ticks_per_side1); - gGL.begin(LLVertexBuffer::LINES); + gGL.begin(LLRender::LINES); // draw first row of ticks for (S32 i = start_tick; i <= stop_tick; i++) { diff --git a/linden/indra/newview/llmaniptranslate.cpp b/linden/indra/newview/llmaniptranslate.cpp index 2278453..30fa745 100644 --- a/linden/indra/newview/llmaniptranslate.cpp +++ b/linden/indra/newview/llmaniptranslate.cpp @@ -134,7 +134,7 @@ void LLManipTranslate::restoreGL() GLuint* d = new GLuint[rez*rez]; glGenTextures(1, &sGridTex); - glBindTexture(GL_TEXTURE_2D, sGridTex); + gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, sGridTex); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); @@ -1052,7 +1052,7 @@ void LLManipTranslate::renderSnapGuides() F32 max_subdivisions = sGridMaxSubdivisionLevel;//(F32)gSavedSettings.getS32("GridSubdivision"); F32 line_alpha = gSavedSettings.getF32("GridOpacity"); - LLGLSNoTexture gls_no_texture; + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); LLGLDepthTest gls_depth(GL_TRUE); LLGLDisable gls_cull(GL_CULL_FACE); LLVector3 translate_axis; @@ -1223,7 +1223,7 @@ void LLManipTranslate::renderSnapGuides() { LLColor4 line_color = setupSnapGuideRenderPass(pass); - gGL.begin(LLVertexBuffer::LINES); + gGL.begin(LLRender::LINES); { LLVector3 line_start = selection_center + (mSnapOffsetMeters * mSnapOffsetAxis) + (translate_axis * (guide_size_meters * 0.5f + offset_nearest_grid_unit)); LLVector3 line_end = selection_center + (mSnapOffsetMeters * mSnapOffsetAxis) - (translate_axis * (guide_size_meters * 0.5f + offset_nearest_grid_unit)); @@ -1299,7 +1299,7 @@ void LLManipTranslate::renderSnapGuides() LLVector3 line_start = selection_center - mSnapOffsetAxis * mSnapOffsetMeters; LLVector3 line_end = selection_center + mSnapOffsetAxis * mSnapOffsetMeters; - gGL.begin(LLVertexBuffer::LINES); + gGL.begin(LLRender::LINES); { gGL.color4f(line_color.mV[VX], line_color.mV[VY], line_color.mV[VZ], line_color.mV[VW]); @@ -1309,7 +1309,7 @@ void LLManipTranslate::renderSnapGuides() gGL.end(); // draw snap guide arrow - gGL.begin(LLVertexBuffer::TRIANGLES); + gGL.begin(LLRender::TRIANGLES); { gGL.color4f(line_color.mV[VX], line_color.mV[VY], line_color.mV[VZ], line_color.mV[VW]); @@ -1463,7 +1463,7 @@ void LLManipTranslate::renderSnapGuides() break; } - LLImageGL::unbindTexture(0); + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); highlightIntersection(normal, selection_center, grid_rotation, inner_color); gGL.pushMatrix(); @@ -1503,7 +1503,7 @@ void LLManipTranslate::renderSnapGuides() LLGLDisable stencil(GL_STENCIL_TEST); { LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE, GL_GREATER); - glBindTexture(GL_TEXTURE_2D, sGridTex); + gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, sGridTex); gGL.flush(); gGL.blendFunc(LLRender::BF_ZERO, LLRender::BF_ONE_MINUS_SOURCE_ALPHA); renderGrid(u,v,tiles,0.9f, 0.9f, 0.9f,a*0.15f); @@ -1514,11 +1514,11 @@ void LLManipTranslate::renderSnapGuides() { LLGLDisable alpha_test(GL_ALPHA_TEST); //draw black overlay - LLImageGL::unbindTexture(0); + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); renderGrid(u,v,tiles,0.0f, 0.0f, 0.0f,a*0.16f); //draw grid top - glBindTexture(GL_TEXTURE_2D, sGridTex); + gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, sGridTex); renderGrid(u,v,tiles,1,1,1,a); gGL.popMatrix(); @@ -1564,7 +1564,7 @@ void LLManipTranslate::renderGrid(F32 x, F32 y, F32 size, F32 r, F32 g, F32 b, F for (F32 xx = -size-d; xx < size+d; xx += d) { - gGL.begin(LLVertexBuffer::TRIANGLE_STRIP); + gGL.begin(LLRender::TRIANGLE_STRIP); for (F32 yy = -size-d; yy < size+d; yy += d) { float dx, dy, da; @@ -1620,7 +1620,7 @@ void LLManipTranslate::highlightIntersection(LLVector3 normal, LLGLDepthTest depth (GL_TRUE, GL_FALSE, GL_ALWAYS); glStencilFunc(GL_ALWAYS, 0, stencil_mask); gGL.setColorMask(false, false); - LLImageGL::unbindTexture(0); + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); glColor4f(1,1,1,1); //setup clip plane @@ -1686,7 +1686,7 @@ void LLManipTranslate::highlightIntersection(LLVector3 normal, //draw volume/plane intersections { - LLImageGL::unbindTexture(0); + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); LLGLDepthTest depth(GL_FALSE); LLGLEnable stencil(GL_STENCIL_TEST); glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP); @@ -1834,7 +1834,7 @@ void LLManipTranslate::renderTranslationHandles() relative_camera_dir.normVec(); { - LLGLSNoTexture gls_ui_no_texture; + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); LLGLDisable cull_face(GL_CULL_FACE); LLColor4 color1; @@ -1877,7 +1877,7 @@ void LLManipTranslate::renderTranslationHandles() color1.setVec(0.f, 1.f, 0.f, 0.6f); color2.setVec(0.f, 0.f, 1.f, 0.6f); } - gGL.begin(LLVertexBuffer::TRIANGLES); + gGL.begin(LLRender::TRIANGLES); { gGL.color4fv(color1.mV); gGL.vertex3f(0.f, mPlaneManipOffsetMeters * (-PLANE_TICK_SIZE * 0.25f), mPlaneManipOffsetMeters * (-PLANE_TICK_SIZE * 0.25f)); @@ -1892,7 +1892,7 @@ void LLManipTranslate::renderTranslationHandles() gGL.end(); LLUI::setLineWidth(3.0f); - gGL.begin(LLVertexBuffer::LINES); + gGL.begin(LLRender::LINES); { gGL.color4f(0.f, 0.f, 0.f, 0.3f); gGL.vertex3f(0.f, mPlaneManipOffsetMeters * -PLANE_TICK_SIZE * 0.25f, mPlaneManipOffsetMeters * -PLANE_TICK_SIZE * 0.25f); @@ -1932,7 +1932,7 @@ void LLManipTranslate::renderTranslationHandles() color2.setVec(1.f, 0.f, 0.f, 0.6f); } - gGL.begin(LLVertexBuffer::TRIANGLES); + gGL.begin(LLRender::TRIANGLES); { gGL.color4fv(color1.mV); gGL.vertex3f(mPlaneManipOffsetMeters * (PLANE_TICK_SIZE * 0.25f), 0.f, mPlaneManipOffsetMeters * (PLANE_TICK_SIZE * 0.25f)); @@ -1947,7 +1947,7 @@ void LLManipTranslate::renderTranslationHandles() gGL.end(); LLUI::setLineWidth(3.0f); - gGL.begin(LLVertexBuffer::LINES); + gGL.begin(LLRender::LINES); { gGL.color4f(0.f, 0.f, 0.f, 0.3f); gGL.vertex3f(mPlaneManipOffsetMeters * -PLANE_TICK_SIZE * 0.25f, 0.f, mPlaneManipOffsetMeters * -PLANE_TICK_SIZE * 0.25f); @@ -2011,7 +2011,7 @@ void LLManipTranslate::renderTranslationHandles() color2.setVec(0.f, 0.8f, 0.f, 0.6f); } - gGL.begin(LLVertexBuffer::TRIANGLES); + gGL.begin(LLRender::TRIANGLES); { gGL.color4fv(color1.mV); gGL.vertex3fv(v0.mV); @@ -2026,7 +2026,7 @@ void LLManipTranslate::renderTranslationHandles() gGL.end(); LLUI::setLineWidth(3.0f); - gGL.begin(LLVertexBuffer::LINES); + gGL.begin(LLRender::LINES); { gGL.color4f(0.f, 0.f, 0.f, 0.3f); LLVector3 v12 = (v1 + v2) * .5f; @@ -2052,7 +2052,7 @@ void LLManipTranslate::renderTranslationHandles() } } { - LLGLSNoTexture gls_ui_no_texture; + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); // Since we draw handles with depth testing off, we need to draw them in the // proper depth order. @@ -2126,7 +2126,7 @@ void LLManipTranslate::renderTranslationHandles() void LLManipTranslate::renderArrow(S32 which_arrow, S32 selected_arrow, F32 box_size, F32 arrow_size, F32 handle_size, BOOL reverse_direction) { - LLGLSNoTexture gls_ui_no_texture; + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); LLGLEnable gls_blend(GL_BLEND); LLGLEnable gls_color_material(GL_COLOR_MATERIAL); @@ -2160,7 +2160,7 @@ void LLManipTranslate::renderArrow(S32 which_arrow, S32 selected_arrow, F32 box_ { LLUI::setLineWidth(2.0f); - gGL.begin(LLVertexBuffer::LINES); + gGL.begin(LLRender::LINES); vec.mV[index] = box_size; gGL.vertex3f(vec.mV[0], vec.mV[1], vec.mV[2]); diff --git a/linden/indra/newview/llmapresponders.cpp b/linden/indra/newview/llmapresponders.cpp index d16bc78..898ac58 100644 --- a/linden/indra/newview/llmapresponders.cpp +++ b/linden/indra/newview/llmapresponders.cpp @@ -66,7 +66,7 @@ void LLMapLayerResponder::result(const LLSD& result) new_layer.LayerDefined = TRUE; new_layer.LayerImageID = layer_data["ImageID"]; new_layer.LayerImage = gImageList.getImage(new_layer.LayerImageID, MIPMAP_TRUE, FALSE); - new_layer.LayerImage->bindTexture(0); + gGL.getTexUnit(0)->bind(new_layer.LayerImage.get()); new_layer.LayerImage->setClamp(TRUE, TRUE); new_layer.LayerExtents.mLeft = layer_data["Left"]; @@ -163,7 +163,7 @@ void LLMapLayerResponder::result(const LLSD& result) siminfo->mWaterHeight = (F32) water_height; siminfo->mMapImageID[agent_flags] = image_id; siminfo->mCurrentImage = gImageList.getImage(siminfo->mMapImageID[LLWorldMap::getInstance()->mCurrentMap], MIPMAP_TRUE, FALSE); - siminfo->mCurrentImage->bindTexture(0); + gGL.getTexUnit(0)->bind(siminfo->mCurrentImage.get()); siminfo->mCurrentImage->setClamp(TRUE, TRUE); if (siminfo->mMapImageID[2].notNull()) diff --git a/linden/indra/newview/llmemoryview.cpp b/linden/indra/newview/llmemoryview.cpp index c814e2b..89001d4 100644 --- a/linden/indra/newview/llmemoryview.cpp +++ b/linden/indra/newview/llmemoryview.cpp @@ -146,7 +146,7 @@ void LLMemoryView::draw() S32 height = getRect().getHeight(); LLGLSUIDefault gls_ui; - LLGLSNoTexture gls_no_tex; + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); gl_rect_2d(0, height, width, 0, LLColor4(0.f, 0.f, 0.f, 0.25f)); #if MEM_TRACK_TYPE diff --git a/linden/indra/newview/llmutelist.cpp b/linden/indra/newview/llmutelist.cpp index 0cdfe83..fe42608 100644 --- a/linden/indra/newview/llmutelist.cpp +++ b/linden/indra/newview/llmutelist.cpp @@ -97,6 +97,26 @@ const char AGENT_SUFFIX[] = " (resident)"; const char OBJECT_SUFFIX[] = " (object)"; const char GROUP_SUFFIX[] = " (group)"; + +LLMute::LLMute(const LLUUID& id, const std::string& name, EType type, U32 flags) + : mID(id), + mName(name), + mType(type), + mFlags(flags) +{ + // muting is done by root objects only - try to find this objects root + LLViewerObject *objectp = gObjectList.findObject(mID); + if ((objectp) && (!objectp->isAvatar())) + { + LLViewerObject *parentp = (LLViewerObject *)objectp->getParent(); + if (parentp) + { + mID = parentp->getID(); + } + } +} + + std::string LLMute::getDisplayName() const { std::string name_with_suffix = mName; @@ -216,17 +236,24 @@ void LLMuteList::loadUserVolumes() //----------------------------------------------------------------------------- LLMuteList::~LLMuteList() { - std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, "volume_settings.xml"); - LLSD settings_llsd; - - for(user_volume_map_t::iterator iter = mUserVolumeSettings.begin(); iter != mUserVolumeSettings.end(); ++iter) + // If we quit from the login screen we will not have an SL account + // name. Don't try to save, otherwise we'll dump a file in + // C:\Program Files\SecondLife\ JC + std::string user_dir = gDirUtilp->getLindenUserDir(); + if (!user_dir.empty()) { - settings_llsd[iter->first.asString()] = iter->second; - } + std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, "volume_settings.xml"); + LLSD settings_llsd; - llofstream file; - file.open(filename); - LLSDSerialize::toPrettyXML(settings_llsd, file); + for(user_volume_map_t::iterator iter = mUserVolumeSettings.begin(); iter != mUserVolumeSettings.end(); ++iter) + { + settings_llsd[iter->first.asString()] = iter->second; + } + + llofstream file; + file.open(filename); + LLSDSerialize::toPrettyXML(settings_llsd, file); + } } BOOL LLMuteList::isLinden(const std::string& name) const diff --git a/linden/indra/newview/llmutelist.h b/linden/indra/newview/llmutelist.h index 400f13e..af9c498 100644 --- a/linden/indra/newview/llmutelist.h +++ b/linden/indra/newview/llmutelist.h @@ -60,8 +60,7 @@ public: flagAll = 0x0000000F // Mask of all currently defined flags }; - LLMute(const LLUUID& id, const std::string& name = std::string(), EType type = BY_NAME, U32 flags = 0) - : mID(id), mName(name), mType(type),mFlags(flags) { } + LLMute(const LLUUID& id, const std::string& name = std::string(), EType type = BY_NAME, U32 flags = 0); // Returns name + suffix based on type // For example: "James Tester (resident)" diff --git a/linden/indra/newview/llnetmap.cpp b/linden/indra/newview/llnetmap.cpp index b277998..36b6863 100644 --- a/linden/indra/newview/llnetmap.cpp +++ b/linden/indra/newview/llnetmap.cpp @@ -226,7 +226,7 @@ void LLNetMap::draw() LLGLEnable scissor(GL_SCISSOR_TEST); { - LLGLSNoTexture no_texture; + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); LLLocalClipRect clip(getLocalRect()); glMatrixMode(GL_MODELVIEW); @@ -286,8 +286,8 @@ void LLNetMap::draw() // Draw using texture. - LLViewerImage::bindTexture(regionp->getLand().getSTexture()); - gGL.begin(LLVertexBuffer::QUADS); + gGL.getTexUnit(0)->bind(regionp->getLand().getSTexture()); + gGL.begin(LLRender::QUADS); gGL.texCoord2f(0.f, 1.f); gGL.vertex2f(left, top); gGL.texCoord2f(0.f, 0.f); @@ -303,8 +303,8 @@ void LLNetMap::draw() { if (regionp->getLand().getWaterTexture()) { - LLViewerImage::bindTexture(regionp->getLand().getWaterTexture()); - gGL.begin(LLVertexBuffer::QUADS); + gGL.getTexUnit(0)->bind(regionp->getLand().getWaterTexture()); + gGL.begin(LLRender::QUADS); gGL.texCoord2f(0.f, 1.f); gGL.vertex2f(left, top); gGL.texCoord2f(0.f, 0.f); @@ -350,11 +350,11 @@ void LLNetMap::draw() map_center_agent.mV[VX] *= gMiniMapScale/region_width; map_center_agent.mV[VY] *= gMiniMapScale/region_width; - LLViewerImage::bindTexture(mObjectImagep); + gGL.getTexUnit(0)->bind(mObjectImagep); F32 image_half_width = 0.5f*mObjectMapPixels; F32 image_half_height = 0.5f*mObjectMapPixels; - gGL.begin(LLVertexBuffer::QUADS); + gGL.begin(LLRender::QUADS); gGL.texCoord2f(0.f, 1.f); gGL.vertex2f(map_center_agent.mV[VX] - image_half_width, image_half_height + map_center_agent.mV[VY]); gGL.texCoord2f(0.f, 0.f); @@ -457,13 +457,13 @@ void LLNetMap::draw() F32 ctr_y = (F32)center_sw_bottom; - LLGLSNoTexture no_texture; + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); if( LLNetMap::sRotateMap ) { gGL.color4fv(gFrustumMapColor.mV); - gGL.begin( LLVertexBuffer::TRIANGLES ); + gGL.begin( LLRender::TRIANGLES ); gGL.vertex2f( ctr_x, ctr_y ); gGL.vertex2f( ctr_x - half_width_pixels, ctr_y + far_clip_pixels ); gGL.vertex2f( ctr_x + half_width_pixels, ctr_y + far_clip_pixels ); @@ -477,7 +477,7 @@ void LLNetMap::draw() gGL.pushMatrix(); gGL.translatef( ctr_x, ctr_y, 0 ); glRotatef( atan2( LLViewerCamera::getInstance()->getAtAxis().mV[VX], LLViewerCamera::getInstance()->getAtAxis().mV[VY] ) * RAD_TO_DEG, 0.f, 0.f, -1.f); - gGL.begin( LLVertexBuffer::TRIANGLES ); + gGL.begin( LLRender::TRIANGLES ); gGL.vertex2f( 0, 0 ); gGL.vertex2f( -half_width_pixels, far_clip_pixels ); gGL.vertex2f( half_width_pixels, far_clip_pixels ); @@ -642,7 +642,11 @@ void LLNetMap::renderScaledPointGlobal( const LLVector3d& pos, const LLColor4U & LLVector3 local_pos; local_pos.setVec( pos - mObjectImageCenterGlobal ); - S32 diameter_pixels = llround(2 * radius_meters * mObjectMapTPM); + // DEV-17370 - megaprims of size > 4096 cause lag. (go figger.) + const F32 MAX_RADIUS = 256.0f; + F32 radius_clamped = llmin(radius_meters, MAX_RADIUS); + + S32 diameter_pixels = llround(2 * radius_clamped * mObjectMapTPM); renderPoint( local_pos, color, diameter_pixels ); } diff --git a/linden/indra/newview/llnotify.cpp b/linden/indra/newview/llnotify.cpp index f703736..9c1f7a0 100644 --- a/linden/indra/newview/llnotify.cpp +++ b/linden/indra/newview/llnotify.cpp @@ -509,7 +509,7 @@ void LLNotifyBox::drawBackground() const LLUIImagePtr imagep = LLUI::getUIImage("rounded_square.tga"); if (imagep) { - LLViewerImage::bindTexture(imagep->getImage()); + gGL.getTexUnit(0)->bind(imagep->getImage()); // set proper background color depending on whether notify box is a caution or not LLColor4 color = mIsCaution? gColors.getColor("NotifyCautionBoxColor") : gColors.getColor("NotifyBoxColor"); if(gFocusMgr.childHasKeyboardFocus( this )) diff --git a/linden/indra/newview/llpaneldisplay.cpp b/linden/indra/newview/llpaneldisplay.cpp index 3e60745..26e6fda 100644 --- a/linden/indra/newview/llpaneldisplay.cpp +++ b/linden/indra/newview/llpaneldisplay.cpp @@ -753,6 +753,8 @@ void LLPanelDisplay::onApplyResolution(LLUICtrl* src, void* user_data) void LLPanelDisplay::applyResolution() { + + gGL.flush(); char aspect_ratio_text[ASPECT_RATIO_STR_LEN]; /*Flawfinder: ignore*/ if (mCtrlAspectRatio->getCurrentIndex() == -1) { @@ -787,75 +789,15 @@ void LLPanelDisplay::applyResolution() { mAspectRatio = (F32)mCtrlAspectRatio->getValue().asReal(); } - + // presumably, user entered a non-numeric value if aspect_ratio == 0.f if (mAspectRatio != 0.f) { mAspectRatio = llclamp(mAspectRatio, 0.2f, 5.f); gSavedSettings.setF32("FullScreenAspectRatio", mAspectRatio); - if (gSavedSettings.getBOOL("FullScreenAutoDetectAspectRatio")) - { - gViewerWindow->getWindow()->setNativeAspectRatio(0.f); - } - else - { - gViewerWindow->getWindow()->setNativeAspectRatio(mAspectRatio); - } } - gViewerWindow->reshape(gViewerWindow->getWindowDisplayWidth(), gViewerWindow->getWindowDisplayHeight()); - - // Screen resolution - S32 num_resolutions; - LLWindow::LLWindowResolution* supported_resolutions = gViewerWindow->getWindow()->getSupportedResolutions(num_resolutions); - - // switching to windowed - BOOL fullscreen = !mCtrlWindowed->get(); - - // check if resolution has changed - BOOL targetFullscreen; - S32 targetWidth; - S32 targetHeight; - gViewerWindow->getTargetWindow(targetFullscreen, targetWidth, targetHeight); - - if ((fullscreen != targetFullscreen) || - (fullscreen && - (supported_resolutions[mCtrlFullScreen->getCurrentIndex()].mWidth != targetWidth || - supported_resolutions[mCtrlFullScreen->getCurrentIndex()].mHeight != targetHeight) - )) - { - // change fullscreen resolution or switch in/out of windowed mode - BOOL result; - - BOOL logged_in = (LLStartUp::getStartupState() >= STATE_STARTED); - if (fullscreen) - { - result = gViewerWindow->changeDisplaySettings(TRUE, - LLCoordScreen( supported_resolutions[mCtrlFullScreen->getCurrentIndex()].mWidth, - supported_resolutions[mCtrlFullScreen->getCurrentIndex()].mHeight), - gSavedSettings.getBOOL("DisableVerticalSync"), - logged_in); - } - else - { - result = gViewerWindow->changeDisplaySettings(FALSE, - LLCoordScreen(gSavedSettings.getS32("WindowWidth"), gSavedSettings.getS32("WindowHeight")), - TRUE, - logged_in); - } - if (!result) - { - - // GL is non-existent at this point, so we can't continue. - llerrs << "LLPanelDisplay::apply() failed" << llendl; - } - } - - // force aspect ratio - if (fullscreen) - { - LLViewerCamera::getInstance()->setAspect( gViewerWindow->getDisplayAspectRatio() ); - } + gViewerWindow->requestResolutionUpdate(!mCtrlWindowed->get(), mCtrlFullScreen->getCurrentIndex()); send_agent_update(TRUE); diff --git a/linden/indra/newview/llpanelgeneral.cpp b/linden/indra/newview/llpanelgeneral.cpp index 256f02a..43b0f4c 100644 --- a/linden/indra/newview/llpanelgeneral.cpp +++ b/linden/indra/newview/llpanelgeneral.cpp @@ -31,75 +31,15 @@ #include "llviewerprecompiledheaders.h" +//file include #include "llpanelgeneral.h" -// linden library includes -#include "llerror.h" -#include "llrect.h" -#include "llfontgl.h" -#include "message.h" -#include "lluictrlfactory.h" - // project includes -#include "llagent.h" -#include "llviewerwindow.h" #include "llcolorswatch.h" #include "llcombobox.h" -#include "llconsole.h" -#include "lllineeditor.h" -#include "llpanellogin.h" -#include "llnetmap.h" -#include "llresmgr.h" -#include "llspinctrl.h" -#include "lltextbox.h" -#include "llui.h" +#include "lluictrlfactory.h" #include "llurlsimstring.h" #include "llviewercontrol.h" -#include "llurlsimstring.h" - -#include "llcheckboxctrl.h" -#include "llradiogroup.h" -// -// Imported globals -// - -void set_crash_behavior(LLUICtrl* ctrl, void* data); -void set_start_location(LLUICtrl* ctrl, void* data); - - -// -// Globals -// - -// -// Static functions -// -static void set_render_name_fade_out(LLUICtrl* ctrl, void* data) -{ - LLComboBox* combo = (LLComboBox*)ctrl; - if (!combo) return; - gSavedSettings.setS32("RenderName", combo->getCurrentIndex() ); -} - -void set_crash_behavior(LLUICtrl* ctrl, void* data) -{ - gCrashSettings.setS32(CRASH_BEHAVIOR_SETTING, ((LLComboBox*) ctrl)->getCurrentIndex()); -} - -void set_language(LLUICtrl* ctrl, void* data) -{ - gSavedSettings.setString("Language", ctrl->getValue().asString()); -} - -void LLPanelGeneral::set_start_location(LLUICtrl* ctrl, void* data) -{ - LLURLSimString::setString(ctrl->getValue().asString()); -} - -void LLPanelGeneral::set_specific_start_location(LLLineEditor* line_editor, void* data) -{ - LLURLSimString::setString(line_editor->getValue().asString()); -} LLPanelGeneral::LLPanelGeneral() { @@ -108,50 +48,33 @@ LLPanelGeneral::LLPanelGeneral() BOOL LLPanelGeneral::postBuild() { - childSetCommitCallback("fade_out_combobox", set_render_name_fade_out); - - std::string region_name_prompt = getString("region_name_prompt"); - - - // location combobox - LLComboBox* combo = getChild( "location_combobox"); - if (combo) - { - if (!LLURLSimString::sInstance.mSimString.empty()) - { - combo->setTextEntry(LLURLSimString::sInstance.mSimString); - } - - BOOL login_last = gSavedSettings.getBOOL("LoginLastLocation"); - if (!LLURLSimString::sInstance.mSimString.empty()) - { - combo->add( LLURLSimString::sInstance.mSimString ); - combo->setCurrentByIndex( 2 ); - } - else - { - combo->add( region_name_prompt ); - combo->setCurrentByIndex( login_last ? 1 : 0 ); - } - combo->setCommitCallback( &set_start_location ); - combo->setTextEntryCallback( &set_specific_start_location ); - } - - // Show location on login screen - childSetCommitCallback("show_location_checkbox", &LLPanelGeneral::clickShowStartLocation); - - combo = getChild( "crash_behavior_combobox"); - if (combo) - { - combo->setCurrentByIndex( gCrashSettings.getS32(CRASH_BEHAVIOR_SETTING) ); - combo->setCommitCallback( &set_crash_behavior ); - } + LLComboBox* fade_out_combobox = getChild("fade_out_combobox"); + fade_out_combobox->setCurrentByIndex(gSavedSettings.getS32("RenderName")); + + childSetValue("default_start_location", gSavedSettings.getBOOL("LoginLastLocation") ? "MyLastLocation" : "MyHome"); + childSetValue("show_location_checkbox", gSavedSettings.getBOOL("ShowStartLocation")); + childSetValue("show_all_title_checkbox", gSavedSettings.getBOOL("RenderHideGroupTitleAll")); + childSetValue("language_is_public", gSavedSettings.getBOOL("LanguageIsPublic")); + + childSetValue("show_my_name_checkbox", gSavedSettings.getBOOL("RenderNameHideSelf")); + childSetValue("small_avatar_names_checkbox", gSavedSettings.getBOOL("SmallAvatarNames")); + childSetValue("show_my_title_checkbox", gSavedSettings.getBOOL("RenderHideGroupTitle")); + childSetValue("afk_timeout_spinner", gSavedSettings.getF32("AFKTimeout")); + childSetValue("rotate_mini_map_checkbox", gSavedSettings.getBOOL("MiniMapRotate")); + childSetValue("notify_money_change_checkbox", gSavedSettings.getBOOL("NotifyMoneyChange")); + childSetValue("use_system_color_picker_checkbox", gSavedSettings.getBOOL("UseDefaultColorPicker")); + childSetValue("show_search_panel", gSavedSettings.getBOOL("ShowSearchBar")); + + getChild("effect_color_swatch")->set(gSavedSettings.getColor4("EffectColor")); + + childSetValue("ui_scale_slider", gSavedSettings.getF32("UIScaleFactor")); + childSetValue("ui_auto_scale", gSavedSettings.getBOOL("UIAutoScale")); + + LLComboBox* crash_behavior_combobox = getChild("crash_behavior_combobox"); + crash_behavior_combobox->setCurrentByIndex(gCrashSettings.getS32(CRASH_BEHAVIOR_SETTING)); - childSetCommitCallback("language_combobox", set_language ); childSetValue("language_combobox", gSavedSettings.getString("Language")); - refresh(); - return TRUE; } @@ -160,83 +83,34 @@ LLPanelGeneral::~LLPanelGeneral() // Children all cleaned up by default view destructor. } -void LLPanelGeneral::refresh() -{ - LLPanel::refresh(); - BOOL login_last = gSavedSettings.getBOOL("LoginLastLocation"); - LLComboBox* combo = getChild( "location_combobox"); - if (combo) - { - if (!LLURLSimString::sInstance.mSimString.empty()) - { - combo->setCurrentByIndex( 2 ); - } - else - { - combo->setCurrentByIndex( login_last ? 1 : 0 ); - } - //save current settings in case cancel is clicked - mLoginLocation = combo->getValue().asString(); - } - - mOldCrashBehavior = gCrashSettings.getS32(CRASH_BEHAVIOR_SETTING); - combo = getChild( "crash_behavior_combobox"); - if (combo) - { - combo->setCurrentByIndex( mOldCrashBehavior ); - } - - mRenderName = gSavedSettings.getS32("RenderName"); - combo = getChild("fade_out_combobox"); - if (combo) - { - combo->setCurrentByIndex( mRenderName ); - } - - mRenderNameHideSelf = gSavedSettings.getBOOL("RenderNameHideSelf"); - mSmallAvatarNames = gSavedSettings.getBOOL("SmallAvatarNames"); - mRenderHideGroupTitle = gSavedSettings.getBOOL("RenderHideGroupTitle"); - mChatOnlineNotification = gSavedSettings.getBOOL("ChatOnlineNotification"); - mAFKTimeout = gSavedSettings.getF32("AFKTimeout"); - mMiniMapRotate = gSavedSettings.getBOOL("MiniMapRotate"); - mNotifyMoney = gSavedSettings.getBOOL("NotifyMoneyChange"); - mUseDefaultColor = gSavedSettings.getBOOL("UseDefaultColorPicker"); - mEffectColor = gSavedSettings.getColor4("EffectColor"); - mShowSearch = gSavedSettings.getBOOL("ShowSearchBar"); - - mUIScaleFactor = gSavedSettings.getF32("UIScaleFactor"); - mUIAutoScale = gSavedSettings.getBOOL("UIAutoScale"); - - mLanguage = gSavedSettings.getString("Language"); -} - void LLPanelGeneral::apply() { -} - -void LLPanelGeneral::cancel() -{ - gSavedSettings.setS32("RenderName", mRenderName); - gSavedSettings.setBOOL("RenderNameHideSelf", mRenderNameHideSelf ); - gSavedSettings.setBOOL("SmallAvatarNames", mSmallAvatarNames ); - gSavedSettings.setBOOL("RenderHideGroupTitle", mRenderHideGroupTitle ); - gSavedSettings.setBOOL("ChatOnlineNotification", mChatOnlineNotification ); - gSavedSettings.setF32("AFKTimeout", mAFKTimeout ); - gSavedSettings.setBOOL("MiniMapRotate", mMiniMapRotate ); - gSavedSettings.setBOOL("NotifyMoneyChange", mNotifyMoney ); - gSavedSettings.setBOOL("UseDefaultColorPicker", mUseDefaultColor ); - gSavedSettings.setBOOL("ShowSearchBar", mShowSearch); - gSavedSettings.setColor4("EffectColor", mEffectColor ); - gSavedSettings.setF32("UIScaleFactor", mUIScaleFactor); - gSavedSettings.setBOOL("UIAutoScale", mUIAutoScale); - gSavedSettings.setString("Language", mLanguage); + LLComboBox* fade_out_combobox = getChild("fade_out_combobox"); + gSavedSettings.setS32("RenderName", fade_out_combobox->getCurrentIndex()); - LLURLSimString::setString(mLoginLocation); - - gCrashSettings.setS32(CRASH_BEHAVIOR_SETTING, mOldCrashBehavior); + gSavedSettings.setBOOL("LoginLastLocation", childGetValue("default_start_location").asString() == "MyLastLocation"); + gSavedSettings.setBOOL("ShowStartLocation", childGetValue("show_location_checkbox")); + gSavedSettings.setBOOL("RenderHideGroupTitleAll", childGetValue("show_all_title_checkbox")); + gSavedSettings.setBOOL("LanguageIsPublic", childGetValue("language_is_public")); + gSavedSettings.setBOOL("RenderNameHideSelf", childGetValue("show_my_name_checkbox")); + gSavedSettings.setBOOL("SmallAvatarNames", childGetValue("small_avatar_names_checkbox")); + gSavedSettings.setBOOL("RenderHideGroupTitle", childGetValue("show_my_title_checkbox")); + gSavedSettings.setF32("AFKTimeout", childGetValue("afk_timeout_spinner").asReal()); + gSavedSettings.setBOOL("MiniMapRotate", childGetValue("rotate_mini_map_checkbox")); + gSavedSettings.setBOOL("NotifyMoneyChange", childGetValue("notify_money_change_checkbox")); + gSavedSettings.setBOOL("UseDefaultColorPicker", childGetValue("use_system_color_picker_checkbox")); + gSavedSettings.setBOOL("ShowSearchBar", childGetValue("show_search_panel")); + gSavedSettings.setColor4("EffectColor", childGetValue("effect_color_swatch")); + gSavedSettings.setF32("UIScaleFactor", childGetValue("ui_scale_slider").asReal()); + gSavedSettings.setBOOL("UIAutoScale", childGetValue("ui_auto_scale")); + gSavedSettings.setString("Language", childGetValue("language_combobox")); + + LLURLSimString::setString(childGetValue("location_combobox")); + + LLComboBox* crash_behavior_combobox = getChild("crash_behavior_combobox"); + gCrashSettings.setS32(CRASH_BEHAVIOR_SETTING, crash_behavior_combobox->getCurrentIndex()); } -void LLPanelGeneral::clickShowStartLocation(LLUICtrl*, void* user_data) +void LLPanelGeneral::cancel() { - LLPanelLogin::refreshLocation( false ); // in case LLPanelLogin is visible } diff --git a/linden/indra/newview/llpanelgeneral.h b/linden/indra/newview/llpanelgeneral.h index a7b526d..5492a52 100644 --- a/linden/indra/newview/llpanelgeneral.h +++ b/linden/indra/newview/llpanelgeneral.h @@ -35,45 +35,16 @@ #include "llpanel.h" -class LLCheckBoxCtrl; -class LLRadioGroup; -class LLColorSwatchCtrl; -class LLSpinCtrl; -class LLTextBox; -class LLComboBox; - class LLPanelGeneral : public LLPanel { public: LLPanelGeneral(); - virtual ~LLPanelGeneral(); + /*virtual*/ ~LLPanelGeneral(); + + BOOL postBuild(); - virtual BOOL postBuild(); - void refresh(); void apply(); void cancel(); - - static void clickShowStartLocation(LLUICtrl*, void* user_data); - static void set_start_location(LLUICtrl* ctrl, void* data); - static void set_specific_start_location(LLLineEditor* line_editor, void* data); - -protected: - S32 mRenderName; - BOOL mRenderNameHideSelf; - BOOL mSmallAvatarNames; - BOOL mRenderHideGroupTitle; - BOOL mChatOnlineNotification; - BOOL mShowSearch; - F32 mAFKTimeout; - BOOL mNotifyMoney; - BOOL mUseDefaultColor; - LLColor4 mEffectColor; - F32 mUIScaleFactor; - BOOL mUIAutoScale; - BOOL mMiniMapRotate; - S32 mOldCrashBehavior; - std::string mLoginLocation; - std::string mLanguage; }; #endif diff --git a/linden/indra/newview/llpanelgrouplandmoney.cpp b/linden/indra/newview/llpanelgrouplandmoney.cpp index b8c9e69..6eb44e1 100644 --- a/linden/indra/newview/llpanelgrouplandmoney.cpp +++ b/linden/indra/newview/llpanelgrouplandmoney.cpp @@ -705,12 +705,13 @@ BOOL LLPanelGroupLandMoney::postBuild() textp = getChild("group_money_planning_text", true); panelp = getChild("group_money_planning_tab", true); - if ( !can_view ) + if ( 1 ) //!can_view { textp->setText(mImplementationp->mCantViewAccountsText); } else { + //Temporally disabled for DEV-11287. mImplementationp->mMoneyPlanningTabEHp = new LLGroupMoneyPlanningTabEventHandler(textp, tabcp, diff --git a/linden/indra/newview/llpanelinput.cpp b/linden/indra/newview/llpanelinput.cpp index 7034b1c..026dd71 100644 --- a/linden/indra/newview/llpanelinput.cpp +++ b/linden/indra/newview/llpanelinput.cpp @@ -30,46 +30,10 @@ */ #include "llviewerprecompiledheaders.h" - #include "llpanelinput.h" - -// linden library includes -#include "llerror.h" -#include "llrect.h" -#include "llfontgl.h" -#include "message.h" #include "lluictrlfactory.h" - -// project includes -#include "llviewerwindow.h" -#include "llcheckboxctrl.h" -#include "llfloaterjoystick.h" -#include "llradiogroup.h" -#include "llresmgr.h" -#include "llspinctrl.h" -#include "llslider.h" -#include "llsliderctrl.h" -#include "lltextbox.h" -#include "llui.h" -#include "llappviewer.h" #include "llviewercontrol.h" - -//Ventrella -#include "llagent.h" -//end Ventrella - - -// -// Imported globals -// - -// -// Globals -// - -// -// Static functions -// +#include "llfloaterjoystick.h" LLPanelInput::LLPanelInput() @@ -79,50 +43,41 @@ LLPanelInput::LLPanelInput() BOOL LLPanelInput::postBuild() { - childSetAction("joystic_setup_button", onClickJoystickSetup, (void*)this); - - refresh(); + childSetAction("joystick_setup_button", onClickJoystickSetup, (void*)this); + + childSetValue("mouse_sensitivity", gSavedSettings.getF32("MouseSensitivity")); + childSetValue("automatic_fly", gSavedSettings.getBOOL("AutomaticFly")); + childSetValue("invert_mouse", gSavedSettings.getBOOL("InvertMouse")); + childSetValue("edit_camera_movement", gSavedSettings.getBOOL("EditCameraMovement")); + childSetValue("appearance_camera_movement", gSavedSettings.getBOOL("AppearanceCameraMovement")); + childSetValue("dynamic_camera_strength", gSavedSettings.getF32("DynamicCameraStrength")); + childSetValue("zoom_time", gSavedSettings.getF32("ZoomTime")); + childSetValue("camera_position_smoothing", gSavedSettings.getF32("CameraPositionSmoothing")); + childSetValue("first_person_avatar_visible", gSavedSettings.getBOOL("FirstPersonAvatarVisible")); return TRUE; } - LLPanelInput::~LLPanelInput() { // Children all cleaned up by default view destructor. } -void LLPanelInput::refresh() -{ - LLPanel::refresh(); - - mMouseSensitivityVal = gSavedSettings.getF32("MouseSensitivity"); - mAutomaticFly =gSavedSettings.getBOOL("AutomaticFly"); - mInvertMouse = gSavedSettings.getBOOL("InvertMouse"); - mEditCameraMovement = gSavedSettings.getBOOL("EditCameraMovement"); - mAppearanceCameraMovement = gSavedSettings.getBOOL("AppearanceCameraMovement"); - mDynamicCameraStrengthVal = gSavedSettings.getF32("DynamicCameraStrength"); - mNumpadControlVal = gSavedSettings.getS32("NumpadControl"); - - // First Person Visibility - mFirstPersonAvatarVisible = gSavedSettings.getBOOL("FirstPersonAvatarVisible"); -} - void LLPanelInput::apply() { - + gSavedSettings.setF32("MouseSensitivity", childGetValue("mouse_sensitivity").asReal()); + gSavedSettings.setBOOL("AutomaticFly", childGetValue("automatic_fly")); + gSavedSettings.setBOOL("InvertMouse", childGetValue("invert_mouse")); + gSavedSettings.setBOOL("EditCameraMovement", childGetValue("edit_camera_movement")); + gSavedSettings.setBOOL("AppearanceCameraMovement", childGetValue("appearance_camera_movement")); + gSavedSettings.setF32("DynamicCameraStrength", childGetValue("dynamic_camera_strength").asReal()); + gSavedSettings.setF32("ZoomTime", childGetValue("zoom_time").asReal()); + gSavedSettings.setF32("CameraPositionSmoothing", childGetValue("camera_position_smoothing").asReal()); + gSavedSettings.setBOOL("FirstPersonAvatarVisible", childGetValue("first_person_avatar_visible")); } void LLPanelInput::cancel() { - gSavedSettings.setF32("MouseSensitivity", mMouseSensitivityVal); - gSavedSettings.setBOOL("AutomaticFly", mAutomaticFly); - gSavedSettings.setBOOL("InvertMouse", mInvertMouse); - gSavedSettings.setBOOL("EditCameraMovement", mEditCameraMovement); - gSavedSettings.setBOOL("AppearanceCameraMovement", mAppearanceCameraMovement); - gSavedSettings.setF32("DynamicCameraStrength", mDynamicCameraStrengthVal); - gSavedSettings.setS32("NumpadControl", mNumpadControlVal); - gSavedSettings.setBOOL("FirstPersonAvatarVisible", mFirstPersonAvatarVisible); } //static diff --git a/linden/indra/newview/llpanelinput.h b/linden/indra/newview/llpanelinput.h index e73e0ed..2f99f99 100644 --- a/linden/indra/newview/llpanelinput.h +++ b/linden/indra/newview/llpanelinput.h @@ -34,11 +34,6 @@ #include "llpanel.h" -class LLCheckBoxCtrl; -class LLSlider; -class LLSliderCtrl; -class LLSpinCtrl; - class LLPanelInput : public LLPanel { public: @@ -46,23 +41,11 @@ public: virtual ~LLPanelInput(); virtual BOOL postBuild(); - virtual void refresh(); void apply(); void cancel(); private: static void onClickJoystickSetup(void* user_data); - -protected: - F32 mMouseSensitivityVal; - BOOL mAutomaticFly; - BOOL mInvertMouse; - BOOL mEditCameraMovement; - BOOL mAppearanceCameraMovement; - BOOL mFirstPersonAvatarVisible; - F32 mDynamicCameraStrengthVal; - S32 mNumpadControlVal; - }; #endif diff --git a/linden/indra/newview/llpanellogin.cpp b/linden/indra/newview/llpanellogin.cpp index ffee058..c1c8949 100644 --- a/linden/indra/newview/llpanellogin.cpp +++ b/linden/indra/newview/llpanellogin.cpp @@ -63,7 +63,6 @@ #include "llviewernetwork.h" #include "llviewerwindow.h" // to link into child list #include "llnotify.h" -#include "llappviewer.h" // for gHideLinks #include "llurlsimstring.h" #include "lluictrlfactory.h" #include "llhttpclient.h" @@ -202,6 +201,26 @@ void LLLoginHandler::parse(const LLSD& queryMap) { grid_choice = GRID_INFO_ARUNA; } + else if (queryMap["grid"].asString() == "bharati") + { + grid_choice = GRID_INFO_BHARATI; + } + else if (queryMap["grid"].asString() == "chandra") + { + grid_choice = GRID_INFO_CHANDRA; + } + else if (queryMap["grid"].asString() == "danu") + { + grid_choice = GRID_INFO_DANU; + } + else if (queryMap["grid"].asString() == "parvati") + { + grid_choice = GRID_INFO_PARVATI; + } + else if (queryMap["grid"].asString() == "skanda") + { + grid_choice = GRID_INFO_SKANDA; + } if(grid_choice != GRID_INFO_NONE) { @@ -321,6 +340,11 @@ namespace { boost::intrusive_ptr< LLIamHereLogin > gResponsePtr = 0; }; +void set_start_location(LLUICtrl* ctrl, void* data) +{ + LLURLSimString::setString(ctrl->getValue().asString()); +} + //--------------------------------------------------------------------------- // Public methods //--------------------------------------------------------------------------- @@ -407,7 +431,7 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect, combo->setCurrentByIndex( 0 ); } - combo->setCommitCallback( &LLPanelGeneral::set_start_location ); + combo->setCommitCallback( &set_start_location ); LLComboBox* server_choice_combo = sInstance->getChild("server_combo"); server_choice_combo->setCommitCallback(onSelectServer); @@ -1066,15 +1090,8 @@ void LLPanelLogin::onClickConnect(void *) } else { - if (gHideLinks) - { - gViewerWindow->alertXml("MustHaveAccountToLogInNoLinks"); - } - else - { - gViewerWindow->alertXml("MustHaveAccountToLogIn", - LLPanelLogin::newAccountAlertCallback); - } + gViewerWindow->alertXml("MustHaveAccountToLogIn", + LLPanelLogin::newAccountAlertCallback); } } } diff --git a/linden/indra/newview/llpanelmsgs.cpp b/linden/indra/newview/llpanelmsgs.cpp index cc3579e..4d2ff54 100644 --- a/linden/indra/newview/llpanelmsgs.cpp +++ b/linden/indra/newview/llpanelmsgs.cpp @@ -39,17 +39,6 @@ #include "lluictrlfactory.h" #include "llfirstuse.h" -class LLPopupData -{ -public: - LLPopupData() : mShowNewInventory(FALSE), mAutoAcceptNewInventory(FALSE) { } - - BOOL mShowNewInventory; - BOOL mAutoAcceptNewInventory; -}; - -LLPopupData sPopupData; - //----------------------------------------------------------------------------- LLPanelMsgs::LLPanelMsgs() : LLPanel(std::string("Messages Panel")), @@ -75,8 +64,9 @@ BOOL LLPanelMsgs::postBuild() childSetAction("skip_dialogs_btn", onClickSkipDialogs, this); buildLists(); - sPopupData.mAutoAcceptNewInventory = gSavedSettings.getBOOL("AutoAcceptNewInventory"); - sPopupData.mShowNewInventory = gSavedSettings.getBOOL("ShowNewInventory"); + childSetValue("accept_new_inventory", gSavedSettings.getBOOL("AutoAcceptNewInventory")); + childSetValue("show_new_inventory", gSavedSettings.getBOOL("ShowNewInventory")); + childSetValue("show_in_inventory", gSavedSettings.getBOOL("ShowInInventory")); return TRUE; } @@ -159,13 +149,13 @@ void LLPanelMsgs::draw() void LLPanelMsgs::apply() { + gSavedSettings.setBOOL("AutoAcceptNewInventory", childGetValue("accept_new_inventory")); + gSavedSettings.setBOOL("ShowNewInventory", childGetValue("show_new_inventory")); + gSavedSettings.setBOOL("ShowInInventory", childGetValue("show_in_inventory")); } - void LLPanelMsgs::cancel() { - gSavedSettings.setBOOL("ShowNewInventory", sPopupData.mShowNewInventory); - gSavedSettings.setBOOL("AutoAcceptNewInventory", sPopupData.mAutoAcceptNewInventory); } void LLPanelMsgs::resetAllIgnored() diff --git a/linden/indra/newview/llpanelnetwork.cpp b/linden/indra/newview/llpanelnetwork.cpp index e324c3b..f13f63a 100644 --- a/linden/indra/newview/llpanelnetwork.cpp +++ b/linden/indra/newview/llpanelnetwork.cpp @@ -31,29 +31,14 @@ #include "llviewerprecompiledheaders.h" -// file include +//file include #include "llpanelnetwork.h" -// linden library includes -#include "llerror.h" -#include "llrect.h" -#include "llstring.h" - // project includes -#include "llbutton.h" +#include "llcheckboxctrl.h" #include "lldirpicker.h" -#include "llui.h" #include "lluictrlfactory.h" -#include "llresmgr.h" -#include "llsliderctrl.h" -#include "llspinctrl.h" -#include "llcheckboxctrl.h" -#include "lltextbox.h" -#include "llviewerregion.h" -#include "llviewerthrottle.h" -#include "llworld.h" #include "llviewercontrol.h" -#include "lluictrlfactory.h" #include "llviewerwindow.h" LLPanelNetwork::LLPanelNetwork() @@ -70,12 +55,13 @@ BOOL LLPanelNetwork::postBuild() childSetAction("set_cache", onClickSetCache, this); childSetAction("reset_cache", onClickResetCache, this); - childSetEnabled("connection_port", - gSavedSettings.getBOOL("ConnectionPortEnabled")); + childSetEnabled("connection_port", gSavedSettings.getBOOL("ConnectionPortEnabled")); childSetCommitCallback("connection_port_enabled", onCommitPort, this); - - refresh(); + childSetValue("cache_size", (F32)gSavedSettings.getU32("CacheSize")); + childSetValue("max_bandwidth", gSavedSettings.getF32("ThrottleBandwidthKBPS")); + childSetValue("connection_port_enabled", gSavedSettings.getBOOL("ConnectionPortEnabled")); + childSetValue("connection_port", (F32)gSavedSettings.getU32("ConnectionPort")); return TRUE; } @@ -88,24 +74,14 @@ LLPanelNetwork::~LLPanelNetwork() void LLPanelNetwork::apply() { -} - -void LLPanelNetwork::refresh() -{ - LLPanel::refresh(); - - mCacheSetting = gSavedSettings.getU32("CacheSize"); - mBandwidthBPS = gSavedSettings.getF32("ThrottleBandwidthKBPS")*1024; - mConnectionPortEnabled = gSavedSettings.getBOOL("ConnectionPortEnabled"); - mConnectionPort = gSavedSettings.getU32("ConnectionPort"); + gSavedSettings.setU32("CacheSize", childGetValue("cache_size").asInteger()); + gSavedSettings.setF32("ThrottleBandwidthKBPS", childGetValue("max_bandwidth").asReal()); + gSavedSettings.setBOOL("ConnectionPortEnabled", childGetValue("connection_port_enabled")); + gSavedSettings.setU32("ConnectionPort", childGetValue("connection_port").asInteger()); } void LLPanelNetwork::cancel() { - gSavedSettings.setU32("CacheSize", mCacheSetting); - gSavedSettings.setF32("ThrottleBandwidthKBPS", mBandwidthBPS/1024); - gSavedSettings.setBOOL("ConnectionPortEnabled", mConnectionPortEnabled); - gSavedSettings.setU32("ConnectionPort", mConnectionPort); } // static diff --git a/linden/indra/newview/llpanelnetwork.h b/linden/indra/newview/llpanelnetwork.h index 9848461..e4b11d9 100644 --- a/linden/indra/newview/llpanelnetwork.h +++ b/linden/indra/newview/llpanelnetwork.h @@ -33,37 +33,23 @@ #define LL_LLPANELNETWORK_H #include "llpanel.h" -#include "llviewerthrottle.h" - -class LLSliderCtrl; -class LLCheckBoxCtrl; -class LLLineEditor; -class LLTextBox; -class LLRadioGroup; -class LLButton; class LLPanelNetwork : public LLPanel { public: LLPanelNetwork(); - virtual ~LLPanelNetwork(); + ~LLPanelNetwork(); + + BOOL postBuild(); - virtual BOOL postBuild(); - virtual void refresh(); - virtual void apply(); // Apply the changed values. - virtual void cancel(); // Cancel the changed values. + void apply(); + void cancel(); private: static void onClickClearCache(void*); static void onClickSetCache(void*); static void onClickResetCache(void*); static void onCommitPort(LLUICtrl* ctrl, void*); - -private: - U32 mCacheSetting; - F32 mBandwidthBPS; - BOOL mConnectionPortEnabled; - U32 mConnectionPort; }; #endif diff --git a/linden/indra/newview/llpanelobject.cpp b/linden/indra/newview/llpanelobject.cpp index 9022c14..1f386bf 100644 --- a/linden/indra/newview/llpanelobject.cpp +++ b/linden/indra/newview/llpanelobject.cpp @@ -365,6 +365,17 @@ void LLPanelObject::getState( ) BOOL enable_scale = objectp->permMove() && objectp->permModify(); BOOL enable_rotate = objectp->permMove() && ( (objectp->permModify() && !objectp->isAttachment()) || !gSavedSettings.getBOOL("EditLinkedParts")); + S32 selected_count = LLSelectMgr::getInstance()->getSelection()->getObjectCount(); + BOOL single_volume = (LLSelectMgr::getInstance()->selectionAllPCode( LL_PCODE_VOLUME )) + && (selected_count == 1); + + if (LLSelectMgr::getInstance()->getSelection()->getRootObjectCount() > 1) + { + enable_move = FALSE; + enable_scale = FALSE; + enable_rotate = FALSE; + } + LLVector3 vec; if (enable_move) { @@ -438,9 +449,6 @@ void LLPanelObject::getState( ) // BUG? Check for all objects being editable? S32 roots_selected = LLSelectMgr::getInstance()->getSelection()->getRootObjectCount(); BOOL editable = root_objectp->permModify(); - S32 selected_count = LLSelectMgr::getInstance()->getSelection()->getObjectCount(); - BOOL single_volume = (LLSelectMgr::getInstance()->selectionAllPCode( LL_PCODE_VOLUME )) - && (selected_count == 1); // Select Single Message childSetVisible("select_single", FALSE); diff --git a/linden/indra/newview/llpanelweb.cpp b/linden/indra/newview/llpanelweb.cpp index 13ed9bf..101decd 100644 --- a/linden/indra/newview/llpanelweb.cpp +++ b/linden/indra/newview/llpanelweb.cpp @@ -34,22 +34,12 @@ // file include #include "llpanelweb.h" -// linden library includes -#include "llerror.h" -#include "llrect.h" -#include "llstring.h" - // project includes -#include "llbutton.h" #include "llcheckboxctrl.h" -#include "lllineeditor.h" -#include "llui.h" +#include "llmediamanager.h" #include "lluictrlfactory.h" #include "llviewercontrol.h" -#include "lluictrlfactory.h" #include "llviewerwindow.h" -#include "llmediamanager.h" - // helper functions for getting/freeing the web browser media // if creating/destroying these is too slow, we'll need to create @@ -97,23 +87,21 @@ LLPanelWeb::LLPanelWeb() BOOL LLPanelWeb::postBuild() { - childSetAction( "clear_cache", onClickClearCache, this ); - childSetAction( "clear_cookies", onClickClearCookies, this ); - childSetCommitCallback("use_external_browser", onSelectBrowser, this ); -// childSetEnabled( "connection_port", gSavedSettings.getBOOL( "CookiesEnabled" ) ); - childSetCommitCallback( "cookies_enabled", onCommitCookies, this ); - childSetCommitCallback( "web_proxy_editor", onCommitWebProxyAddress, this); - childSetCommitCallback( "web_proxy_port", onCommitWebProxyPort, this); - - childSetEnabled("web_proxy_editor", - gSavedSettings.getBOOL("BrowserProxyEnabled")); - childSetEnabled("web_proxy_port", - gSavedSettings.getBOOL("BrowserProxyEnabled")); - childSetEnabled("proxy_text_label", - gSavedSettings.getBOOL("BrowserProxyEnabled")); + childSetAction("clear_cache", onClickClearCache, this); childSetCommitCallback("web_proxy_enabled", onCommitWebProxyEnabled, this); - refresh(); + std::string value = gSavedSettings.getBOOL("UseExternalBrowser") ? "external" : "internal"; + childSetValue("use_external_browser", value); + + childSetValue("cookies_enabled", gSavedSettings.getBOOL("CookiesEnabled")); + + childSetValue("web_proxy_enabled", gSavedSettings.getBOOL("BrowserProxyEnabled")); + childSetValue("web_proxy_editor", gSavedSettings.getString("BrowserProxyAddress")); + childSetValue("web_proxy_port", gSavedSettings.getS32("BrowserProxyPort")); + + childSetEnabled("proxy_text_label", gSavedSettings.getBOOL("BrowserProxyEnabled")); + childSetEnabled("web_proxy_editor", gSavedSettings.getBOOL("BrowserProxyEnabled")); + childSetEnabled("web_proxy_port", gSavedSettings.getBOOL("BrowserProxyEnabled")); return TRUE; } @@ -127,50 +115,29 @@ LLPanelWeb::~LLPanelWeb() void LLPanelWeb::apply() { -} - -void LLPanelWeb::refresh() -{ - LLPanel::refresh(); + gSavedSettings.setBOOL("CookiesEnabled", childGetValue("cookies_enabled")); + gSavedSettings.setBOOL("BrowserProxyEnabled", childGetValue("web_proxy_enabled")); + gSavedSettings.setString("BrowserProxyAddress", childGetValue("web_proxy_editor")); + gSavedSettings.setS32("BrowserProxyPort", childGetValue("web_proxy_port")); - mCookiesEnabled = gSavedSettings.getBOOL("CookiesEnabled"); - mWebProxyEnabled = gSavedSettings.getBOOL("BrowserProxyEnabled"); - mWebProxyAddress = gSavedSettings.getString("BrowserProxyAddress"); - mWebProxyPort = gSavedSettings.getS32("BrowserProxyPort"); + bool value = childGetValue("use_external_browser").asString() == "external" ? true : false; + gSavedSettings.setBOOL("UseExternalBrowser", value); - LLLineEditor* web_proxy_editor = getChild("web_proxy_editor"); - if (web_proxy_editor) - { - web_proxy_editor->setText( gSavedSettings.getString("BrowserProxyAddress") ); - } - mExternalBrowser = gSavedSettings.getBOOL("UseExternalBrowser"); - - childSetValue("use_external_browser", mExternalBrowser ? "external" : "internal"); - LLMediaBase *media_source = get_web_media(); if (media_source) - media_source->enableCookies(mCookiesEnabled); - free_web_media(media_source); + { + media_source->enableCookies(childGetValue("cookies_enabled")); + bool proxy_enable = childGetValue("web_proxy_enabled"); + std::string proxy_address = childGetValue("web_proxy_editor"); + int proxy_port = childGetValue("web_proxy_port"); + media_source->enableProxy(proxy_enable, proxy_address, proxy_port); + } + free_web_media(media_source); } void LLPanelWeb::cancel() { - - gSavedSettings.setBOOL( "CookiesEnabled", mCookiesEnabled ); - gSavedSettings.setBOOL( "BrowserProxyEnabled", mWebProxyEnabled ); - gSavedSettings.setString( "BrowserProxyAddress", mWebProxyAddress ); - gSavedSettings.setS32( "BrowserProxyPort", mWebProxyPort ); - - gSavedSettings.setBOOL("UseExternalBrowser", mExternalBrowser); - LLMediaBase *media_source = get_web_media(); - if (media_source) - { - media_source->enableCookies(mCookiesEnabled); - media_source->enableProxy( mWebProxyEnabled, mWebProxyAddress, mWebProxyPort ); - } - free_web_media(media_source); - } // static @@ -192,94 +159,15 @@ void LLPanelWeb::callback_clear_browser_cache(S32 option, void* userdata) } // static -void LLPanelWeb::onClickClearCookies(void*) -{ - gViewerWindow->alertXml("ConfirmClearCookies", callback_clear_cookies, 0); -} - -//static -void LLPanelWeb::callback_clear_cookies(S32 option, void* userdata) -{ - if ( option == 0 ) // YES - { - LLMediaBase *media_source = get_web_media(); - if (media_source) - media_source->clearCookies(); - free_web_media(media_source); - } -} - -// static -void LLPanelWeb::onCommitCookies(LLUICtrl* ctrl, void* data) -{ - LLPanelWeb* self = (LLPanelWeb*)data; - LLCheckBoxCtrl* check = (LLCheckBoxCtrl*)ctrl; - - if (!self || !check) return; - - LLMediaBase *media_source = get_web_media(); - if (media_source) - media_source->enableCookies(check->get()); - free_web_media(media_source); -} -// static void LLPanelWeb::onCommitWebProxyEnabled(LLUICtrl* ctrl, void* data) { LLPanelWeb* self = (LLPanelWeb*)data; LLCheckBoxCtrl* check = (LLCheckBoxCtrl*)ctrl; if (!self || !check) return; - self->childSetEnabled("web_proxy_editor", - check->get()); - self->childSetEnabled("web_proxy_port", - check->get()); - self->childSetEnabled("proxy_text_label", - check->get()); - - LLMediaBase *media_source = get_web_media(); - if (media_source) - { - media_source->enableProxy( gSavedSettings.getBOOL("BrowserProxyEnabled"), - gSavedSettings.getString("BrowserProxyAddress"), - gSavedSettings.getS32("BrowserProxyPort") ); - } - free_web_media(media_source); - -} - -void LLPanelWeb::onCommitWebProxyAddress(LLUICtrl *ctrl, void *userdata) -{ - LLLineEditor* web_proxy = (LLLineEditor*)ctrl; - - if (web_proxy) - { - gSavedSettings.setString("BrowserProxyAddress", web_proxy->getText()); - } - LLMediaBase *media_source = get_web_media(); - if (media_source) - { - media_source->enableProxy( gSavedSettings.getBOOL("BrowserProxyEnabled"), - gSavedSettings.getString("BrowserProxyAddress"), - gSavedSettings.getS32("BrowserProxyPort") ); - } - free_web_media(media_source); -} + self->childSetEnabled("web_proxy_editor", check->get()); + self->childSetEnabled("web_proxy_port", check->get()); + self->childSetEnabled("proxy_text_label", check->get()); -void LLPanelWeb::onCommitWebProxyPort(LLUICtrl *ctrl, void *userdata) -{ - LLMediaBase *media_source = get_web_media(); - if (media_source) - { - media_source->enableProxy( gSavedSettings.getBOOL("BrowserProxyEnabled"), - gSavedSettings.getString("BrowserProxyAddress"), - gSavedSettings.getS32("BrowserProxyPort") ); - } - free_web_media(media_source); -} -// static -void LLPanelWeb::onSelectBrowser(LLUICtrl* ctrl, void* data) -{ - // "external" or "internal" - gSavedSettings.setBOOL("UseExternalBrowser", ctrl->getValue().asString() == "external"); } diff --git a/linden/indra/newview/llpanelweb.h b/linden/indra/newview/llpanelweb.h index 34d7b3d..fc8cf28 100644 --- a/linden/indra/newview/llpanelweb.h +++ b/linden/indra/newview/llpanelweb.h @@ -33,39 +33,22 @@ #define LL_LLPANELWEB_H #include "llpanel.h" -#include "llviewerthrottle.h" - -class LLCheckBoxCtrl; -class LLButton; class LLPanelWeb : public LLPanel { public: LLPanelWeb(); - virtual ~LLPanelWeb(); + ~LLPanelWeb(); + + BOOL postBuild(); - virtual BOOL postBuild(); - virtual void refresh(); - virtual void apply(); // Apply the changed values. - virtual void cancel(); // Cancel the changed values. + void apply(); + void cancel(); private: - static void onClickClearCache(void*); - static void onClickClearCookies(void*); + static void onClickClearCache(void* data); static void callback_clear_browser_cache(S32 option, void* userdata); - static void callback_clear_cookies(S32 option, void* userdata); - static void onCommitCookies(LLUICtrl* ctrl, void* data); static void onCommitWebProxyEnabled(LLUICtrl* ctrl, void* data); - static void onCommitWebProxyAddress(LLUICtrl *ctrl, void *userdata); - static void onCommitWebProxyPort(LLUICtrl *ctrl, void *userdata); - static void onSelectBrowser(LLUICtrl* ctrl, void* data); - -private: - BOOL mCookiesEnabled; - BOOL mWebProxyEnabled; - std::string mWebProxyAddress; - S32 mWebProxyPort; - BOOL mExternalBrowser; }; #endif diff --git a/linden/indra/newview/llpolymesh.h b/linden/indra/newview/llpolymesh.h index 7f4f087..671bf03 100644 --- a/linden/indra/newview/llpolymesh.h +++ b/linden/indra/newview/llpolymesh.h @@ -150,7 +150,7 @@ public: class LLJointRenderData { public: - LLJointRenderData(const LLMatrix4* world_matrix, LLSkinJoint* skin_joint) : mWorldMatrix(world_matrix), mSkinJoint(skin_joint){} + LLJointRenderData(const LLMatrix4* world_matrix, LLSkinJoint* skin_joint) : mWorldMatrix(world_matrix), mSkinJoint(skin_joint) {} ~LLJointRenderData(){} const LLMatrix4* mWorldMatrix; diff --git a/linden/indra/newview/llprefschat.cpp b/linden/indra/newview/llprefschat.cpp index e045e61..139a365 100644 --- a/linden/indra/newview/llprefschat.cpp +++ b/linden/indra/newview/llprefschat.cpp @@ -36,6 +36,8 @@ #include "lltexteditor.h" #include "llviewercontrol.h" #include "lluictrlfactory.h" +#include "llcolorswatch.h" +#include "llradiogroup.h" #include "llstylemap.h" class LLPrefsChatImpl : public LLPanel @@ -43,8 +45,6 @@ class LLPrefsChatImpl : public LLPanel public: LLPrefsChatImpl(); /*virtual*/ ~LLPrefsChatImpl(){}; - - virtual void refresh(); void apply(); void cancel(); @@ -79,12 +79,30 @@ LLPrefsChatImpl::LLPrefsChatImpl() { LLUICtrlFactory::getInstance()->buildPanel(this, "panel_preferences_chat.xml"); - refresh(); -} + getChild("chat_font_size")->setSelectedIndex(gSavedSettings.getS32("ChatFontSize")); + childSetValue("fade_chat_time", gSavedSettings.getF32("ChatPersistTime")); + childSetValue("max_chat_count", gSavedSettings.getS32("ConsoleMaxLines")); + + getChild("system")->set(gSavedSettings.getColor4("SystemChatColor")); + getChild("user")->set(gSavedSettings.getColor4("UserChatColor")); + getChild("agent")->set(gSavedSettings.getColor4("AgentChatColor")); + getChild("im")->set(gSavedSettings.getColor4("IMChatColor")); + getChild("script_error")->set(gSavedSettings.getColor4("ScriptErrorColor")); + getChild("objects")->set(gSavedSettings.getColor4("ObjectChatColor")); + getChild("owner")->set(gSavedSettings.getColor4("llOwnerSayChatColor")); + getChild("background")->set(gSavedSettings.getColor4("BackgroundChatColor")); + getChild("links")->set(gSavedSettings.getColor4("HTMLLinkColor")); + + childSetValue("arrow_keys_move_avatar_check", gSavedSettings.getBOOL("ArrowKeysMoveAvatar")); + childSetValue("show_timestamps_check", gSavedSettings.getBOOL("ChatShowTimestamps")); + childSetValue("script_errors_as_chat", gSavedSettings.getBOOL("ScriptErrorsAsChat")); -void LLPrefsChatImpl::refresh() -{ - LLPanel::refresh(); + childSetValue("bubble_text_chat", gSavedSettings.getBOOL("UseChatBubbles")); + childSetValue("chat_full_width_check", gSavedSettings.getBOOL("ChatFullWidth")); + childSetValue("close_chat_on_return_check", gSavedSettings.getBOOL("CloseChatOnReturn")); + childSetValue("play_typing_animation", gSavedSettings.getBOOL("PlayTypingAnim")); + childSetValue("console_opacity", gSavedSettings.getF32("ConsoleBackgroundOpacity")); + childSetValue("bubble_chat_opacity", gSavedSettings.getF32("ChatBubbleOpacity")); //set values mChatSize = gSavedSettings.getS32("ChatFontSize"); @@ -137,7 +155,32 @@ void LLPrefsChatImpl::cancel() void LLPrefsChatImpl::apply() { - + gSavedSettings.setS32("ChatFontSize", getChild("chat_font_size")->getSelectedIndex()); + gSavedSettings.setF32("ChatPersistTime", childGetValue("fade_chat_time").asReal()); + gSavedSettings.setS32("ConsoleMaxLines", childGetValue("max_chat_count")); + + gSavedSettings.setColor4("SystemChatColor", childGetValue("system")); + gSavedSettings.setColor4("UserChatColor", childGetValue("user")); + gSavedSettings.setColor4("AgentChatColor", childGetValue("agent")); + gSavedSettings.setColor4("IMChatColor", childGetValue("im")); + gSavedSettings.setColor4("ScriptErrorColor", childGetValue("script_error")); + gSavedSettings.setColor4("ObjectChatColor", childGetValue("objects")); + gSavedSettings.setColor4("llOwnerSayChatColor", childGetValue("owner")); + gSavedSettings.setColor4("BackgroundChatColor", childGetValue("background")); + + gSavedSettings.setColor4("HTMLLinkColor", childGetValue("links")); + LLTextEditor::setLinkColor(childGetValue("links")); + + gSavedSettings.setBOOL("ArrowKeysMoveAvatar", childGetValue("arrow_keys_move_avatar_check")); + gSavedSettings.setBOOL("ChatShowTimestamps", childGetValue("show_timestamps_check")); + gSavedSettings.setBOOL("ScriptErrorsAsChat", childGetValue("script_errors_as_chat")); + gSavedSettings.setBOOL("UseChatBubbles", childGetValue("bubble_text_chat")); + gSavedSettings.setBOOL("ChatFullWidth", childGetValue("chat_full_width_check")); + gSavedSettings.setBOOL("CloseChatOnReturn", childGetValue("close_chat_on_return_check")); + gSavedSettings.setBOOL("PlayTypingAnim", childGetValue("play_typing_animation")); + + gSavedSettings.setF32("ConsoleBackgroundOpacity", childGetValue("console_opacity").asReal()); + gSavedSettings.setF32("ChatBubbleOpacity", childGetValue("bubble_chat_opacity").asReal()); } //--------------------------------------------------------------------------- @@ -154,7 +197,6 @@ LLPrefsChat::~LLPrefsChat() void LLPrefsChat::apply() { impl.apply(); - LLTextEditor::setLinkColor( gSavedSettings.getColor4("HTMLLinkColor") ); LLStyleMap::instance().update(); } diff --git a/linden/indra/newview/llprefsim.cpp b/linden/indra/newview/llprefsim.cpp index 5333df8..6673a4e 100644 --- a/linden/indra/newview/llprefsim.cpp +++ b/linden/indra/newview/llprefsim.cpp @@ -55,34 +55,18 @@ public: /*virtual*/ BOOL postBuild(); void apply(); - void refresh(); void cancel(); - void setPersonalInfo( - const std::string& visibility, - bool im_via_email, - const std::string& email); + void setPersonalInfo(const std::string& visibility, bool im_via_email, const std::string& email); void enableHistory(); + static void onClickLogPath(void* user_data); - static void onCommitLogging( LLUICtrl* ctrl, void* user_data); + static void onCommitLogging(LLUICtrl* ctrl, void* user_data); protected: - BOOL mIMInChatHistory; - BOOL mLogInstantMessages; - BOOL mLogChat; - BOOL mLogShowHistory; - BOOL mShowTimestamps; - BOOL mIMLogTimestamp; - BOOL mLogChatTimestamp; - BOOL mLogIMChat; - BOOL mLogTimestampDate; - - std::string mIMBusyResponse; - std::string mLogPath; - + bool mGotPersonalInfo; bool mOriginalIMViaEmail; - // online status info bool mOriginalHideOnlineStatus; std::string mDirectoryVisibility; }; @@ -94,34 +78,8 @@ LLPrefsIMImpl::LLPrefsIMImpl() LLUICtrlFactory::getInstance()->buildPanel(this, "panel_preferences_im.xml"); } -void LLPrefsIMImpl::refresh() -{ - mIMInChatHistory = gSavedSettings.getBOOL("IMInChatHistory"); - mShowTimestamps = gSavedSettings.getBOOL("IMShowTimestamps"); - mIMBusyResponse = gSavedPerAccountSettings.getString("BusyModeResponse"); - mLogPath = gSavedPerAccountSettings.getString("InstantMessageLogPath"); - mLogInstantMessages= gSavedPerAccountSettings.getBOOL("LogInstantMessages"); - mLogChat = gSavedPerAccountSettings.getBOOL("LogChat"); - mLogShowHistory = gSavedPerAccountSettings.getBOOL("LogShowHistory"); - mIMLogTimestamp = gSavedPerAccountSettings.getBOOL("IMLogTimestamp"); - mLogChatTimestamp = gSavedPerAccountSettings.getBOOL("LogChatTimestamp"); - mLogIMChat = gSavedPerAccountSettings.getBOOL("LogChatIM"); - mLogTimestampDate = gSavedPerAccountSettings.getBOOL("LogTimestampDate"); -} - void LLPrefsIMImpl::cancel() { - gSavedSettings.setBOOL("IMInChatHistory", mIMInChatHistory); - gSavedSettings.setBOOL("IMShowTimestamps", mShowTimestamps); - gSavedPerAccountSettings.setString("BusyModeResponse", mIMBusyResponse); - gSavedPerAccountSettings.setString("InstantMessageLogPath",mLogPath); - gSavedPerAccountSettings.setBOOL("LogInstantMessages",mLogInstantMessages); - gSavedPerAccountSettings.setBOOL("LogChat",mLogChat); - gSavedPerAccountSettings.setBOOL("LogShowHistory",mLogShowHistory); - gSavedPerAccountSettings.setBOOL("IMLogTimestamp",mIMLogTimestamp); - gSavedPerAccountSettings.setBOOL("LogChatTimestamp",mLogChatTimestamp); - gSavedPerAccountSettings.setBOOL("LogChatIM",mLogIMChat); - gSavedPerAccountSettings.setBOOL("LogTimestampDate",mLogTimestampDate); } BOOL LLPrefsIMImpl::postBuild() @@ -133,12 +91,13 @@ BOOL LLPrefsIMImpl::postBuild() return FALSE; } - mGotPersonalInfo = false; - mOriginalIMViaEmail = false; - mOriginalHideOnlineStatus = true; childSetLabelArg("send_im_to_email", "[EMAIL]", getString("log_in_to_change")); // Don't enable this until we get personal data + childDisable("include_im_in_chat_history"); + childDisable("show_timestamps_check"); + childDisable("friends_online_notify_checkbox"); + childDisable("online_visibility"); childDisable("send_im_to_email"); childDisable("log_instant_messages"); @@ -152,17 +111,20 @@ BOOL LLPrefsIMImpl::postBuild() childDisable("log_date_timestamp"); childSetText("busy_response", getString("log_in_to_change")); - - refresh(); - - childSetText("log_path_string", mLogPath); - childSetValue("log_instant_messages", mLogInstantMessages); - childSetValue("log_chat", mLogChat); - childSetValue("log_show_history", mLogShowHistory); - childSetValue("log_instant_messages_timestamp", mIMLogTimestamp); - childSetValue("log_chat_timestamp", mLogChatTimestamp); - childSetValue("log_chat_IM", mLogIMChat); - childSetValue("log_date_timestamp",mLogTimestampDate); + + childSetValue("include_im_in_chat_history", gSavedSettings.getBOOL("IMInChatHistory")); + childSetValue("show_timestamps_check", gSavedSettings.getBOOL("IMShowTimestamps")); + childSetValue("friends_online_notify_checkbox", gSavedSettings.getBOOL("ChatOnlineNotification")); + + childSetText("log_path_string", gSavedPerAccountSettings.getString("InstantMessageLogPath")); + childSetValue("log_instant_messages", gSavedPerAccountSettings.getBOOL("LogInstantMessages")); + childSetValue("log_chat", gSavedPerAccountSettings.getBOOL("LogChat")); + childSetValue("log_show_history", gSavedPerAccountSettings.getBOOL("LogShowHistory")); + childSetValue("log_instant_messages_timestamp", gSavedPerAccountSettings.getBOOL("IMLogTimestamp")); + childSetValue("log_chat_timestamp", gSavedPerAccountSettings.getBOOL("LogChatTimestamp")); + childSetValue("log_chat_IM", gSavedPerAccountSettings.getBOOL("LogChatIM")); + childSetValue("log_date_timestamp", gSavedPerAccountSettings.getBOOL("LogTimestampDate")); + childSetAction("log_path_button", onClickLogPath, this); childSetCommitCallback("log_chat",onCommitLogging,this); childSetCommitCallback("log_instant_messages",onCommitLogging,this); @@ -199,6 +161,10 @@ void LLPrefsIMImpl::apply() gSavedPerAccountSettings.setString("BusyModeResponse", std::string(wstring_to_utf8str(busy_response))); + gSavedSettings.setBOOL("IMInChatHistory", childGetValue("include_im_in_chat_history").asBoolean()); + gSavedSettings.setBOOL("IMShowTimestamps", childGetValue("show_timestamps_check").asBoolean()); + gSavedSettings.setBOOL("ChatOnlineNotification", childGetValue("friends_online_notify_checkbox").asBoolean()); + gSavedPerAccountSettings.setString("InstantMessageLogPath", childGetText("log_path_string")); gSavedPerAccountSettings.setBOOL("LogInstantMessages",childGetValue("log_instant_messages").asBoolean()); gSavedPerAccountSettings.setBOOL("LogChat",childGetValue("log_chat").asBoolean()); @@ -245,14 +211,12 @@ void LLPrefsIMImpl::apply() } } -void LLPrefsIMImpl::setPersonalInfo( - const std::string& visibility, - bool im_via_email, - const std::string& email) +void LLPrefsIMImpl::setPersonalInfo(const std::string& visibility, bool im_via_email, const std::string& email) { mGotPersonalInfo = true; mOriginalIMViaEmail = im_via_email; mDirectoryVisibility = visibility; + if(visibility == VISIBILITY_DEFAULT) { mOriginalHideOnlineStatus = false; @@ -267,6 +231,11 @@ void LLPrefsIMImpl::setPersonalInfo( { mOriginalHideOnlineStatus = true; } + + childEnable("include_im_in_chat_history"); + childEnable("show_timestamps_check"); + childEnable("friends_online_notify_checkbox"); + childSetValue("online_visibility", mOriginalHideOnlineStatus); childSetLabelArg("online_visibility", "[DIR_VIS]", mDirectoryVisibility); childEnable("send_im_to_email"); @@ -308,7 +277,7 @@ void LLPrefsIMImpl::onClickLogPath(void* user_data) std::string proposed_name(self->childGetText("log_path_string")); LLDirPicker& picker = LLDirPicker::instance(); - if (! picker.getDir(&proposed_name ) ) + if (!picker.getDir(&proposed_name ) ) { return; //Canceled! } diff --git a/linden/indra/newview/llprefsvoice.cpp b/linden/indra/newview/llprefsvoice.cpp index 6661f08..1421c3e 100644 --- a/linden/indra/newview/llprefsvoice.cpp +++ b/linden/indra/newview/llprefsvoice.cpp @@ -35,245 +35,164 @@ #include "llprefsvoice.h" #include "llcheckboxctrl.h" -#include "llcombobox.h" - +#include "llfloatervoicedevicesettings.h" +#include "llfocusmgr.h" +#include "llkeyboard.h" +#include "llmodaldialog.h" #include "llviewercontrol.h" #include "lluictrlfactory.h" -#include "llmodaldialog.h" -#include "llkeyboard.h" -#include "llfocusmgr.h" -#include "llfloatervoicedevicesettings.h" - -#include "llappviewer.h" - -#include "llvoiceclient.h" -class LLVoiceHotkeySelectDialog : public LLModalDialog +class LLVoiceSetKeyDialog : public LLModalDialog { -private: - LLPrefsVoiceLogic *mParent; - LLFloater *mOldFrontmost; - public: - LLVoiceHotkeySelectDialog( LLPrefsVoiceLogic *parent ) - : LLModalDialog( LLStringUtil::null, 240, 100 ), - mParent( parent ) - { - mOldFrontmost = gFloaterView->getFrontmost(); - - LLUICtrlFactory::getInstance()->buildFloater(this, "floater_select_key.xml"); - - childSetAction("Cancel", LLVoiceHotkeySelectDialog::onCancel, this ); - childSetFocus("Cancel"); - } - - /*virtual*/ void setFocus( BOOL b ) - { - LLFloater::setFocus(b); - - // This forces keyboard processing to happen at the raw key level instead of going through handleUnicodeChar. - if (b) - { - gFocusMgr.setKeystrokesOnly(TRUE); - } - } - - static void onCancel( void* userdata ); + LLVoiceSetKeyDialog(LLPrefsVoice* parent); + ~LLVoiceSetKeyDialog(); BOOL handleKeyHere(KEY key, MASK mask); -}; - -LLPrefsVoiceLogic::LLPrefsVoiceLogic(LLPanel* panelp) : - mPanel(panelp) -{ - init(); -} - -void LLPrefsVoiceLogic::init() -{ - mEnableVoice = gSavedSettings.getBOOL("EnableVoiceChat"); - - mVoiceCallsFriendsOnly = gSavedSettings.getBOOL("VoiceCallsFriendsOnly"); - mModifier = gSavedSettings.getString("PushToTalkButton"); - mPushToTalkToggle = gSavedSettings.getBOOL("PushToTalkToggle"); - mEarLocation = gSavedSettings.getS32("VoiceEarLocation"); - - LLUICtrl* ear_location = mPanel->getChild("ear_location"); - mCtrlEarLocation = ear_location->getSelectionInterface(); - if (mCtrlEarLocation) - { - mCtrlEarLocation->selectByValue(LLSD(gSavedSettings.getS32("VoiceEarLocation"))); - } - mPanel->childSetCommitCallback("ear_location", onEarLocationCommit, this ); - - mPanel->childSetAction("set_voice_hotkey_button", onClickSetKey, this); - mPanel->childSetAction("set_voice_middlemouse_button", onClickSetMiddleMouse, this); - - refresh(); - mEatNextSetKeyClick = FALSE; -} + static void onCancel(void* user_data); -void LLPrefsVoiceLogic::refresh() -{ - BOOL voiceDisabled = gSavedSettings.getBOOL("CmdLineDisableVoice"); - mPanel->childSetVisible("voice_unavailable", voiceDisabled); - mPanel->childSetVisible("enable_voice_check", !voiceDisabled); - mPanel->childSetEnabled("enable_voice_check", !voiceDisabled); - - bool enable = !voiceDisabled && gSavedSettings.getBOOL("EnableVoiceChat"); - - mPanel->childSetEnabled("friends_only_check", enable); - mPanel->childSetEnabled("push_to_talk_check", enable); - mPanel->childSetEnabled("push_to_talk_label", enable); - mPanel->childSetEnabled("voice_call_friends_only_check", enable); - mPanel->childSetEnabled("push_to_talk_toggle_check", enable); - mPanel->childSetEnabled("ear_location", enable); - mPanel->childSetEnabled("set_voice_hotkey_button", enable); - mPanel->childSetEnabled("set_voice_middlemouse_button", enable); -} +private: + LLPrefsVoice* mParent; +}; -void LLPrefsVoiceLogic::cancel() +LLVoiceSetKeyDialog::LLVoiceSetKeyDialog(LLPrefsVoice* parent) + : LLModalDialog(LLStringUtil::null, 240, 100), mParent(parent) { - gSavedSettings.setBOOL("EnableVoiceChat", mEnableVoice); - gSavedSettings.setBOOL("VoiceCallsFriendsOnly", mVoiceCallsFriendsOnly); - gSavedSettings.setString("PushToTalkButton", mModifier); - gSavedSettings.setBOOL("PushToTalkToggle", mPushToTalkToggle ); - gSavedSettings.setS32("VoiceEarLocation", mEarLocation); -} + LLUICtrlFactory::getInstance()->buildFloater(this, "floater_select_key.xml"); + childSetAction("Cancel", onCancel, this); + childSetFocus("Cancel"); -void LLPrefsVoiceLogic::apply() -{ + gFocusMgr.setKeystrokesOnly(TRUE); } -//static -void LLPrefsVoiceLogic::onEarLocationCommit(LLUICtrl* ctrl, void* user_data) +LLVoiceSetKeyDialog::~LLVoiceSetKeyDialog() { - LLCtrlSelectionInterface* interfacep = ctrl->getSelectionInterface(); - if (interfacep) - { - gSavedSettings.setS32("VoiceEarLocation", interfacep->getSelectedValue().asInteger()); - } } -// static -void LLPrefsVoiceLogic::onClickSetKey(void* user_data) +BOOL LLVoiceSetKeyDialog::handleKeyHere(KEY key, MASK mask) { - LLPrefsVoiceLogic* self=(LLPrefsVoiceLogic*)user_data; - if(self->mEatNextSetKeyClick) + BOOL result = TRUE; + + if(key == 'Q' && mask == MASK_CONTROL) { - self->mEatNextSetKeyClick = false; + result = FALSE; } else { - LLVoiceHotkeySelectDialog* dialog = new LLVoiceHotkeySelectDialog( self ); - dialog->startModal(); - // dialog will delete itself + mParent->setKey(key); } -} + close(); + return result; +} -// static -void LLPrefsVoiceLogic::onClickSetMiddleMouse(void* user_data) +//static +void LLVoiceSetKeyDialog::onCancel(void* user_data) { -// LLPrefsVoiceLogic* self=(LLPrefsVoiceLogic*)user_data; - - gSavedSettings.setString("PushToTalkButton", "MiddleMouse"); + LLVoiceSetKeyDialog* self = (LLVoiceSetKeyDialog*)user_data; + self->close(); } -void LLPrefsVoiceLogic::setKey(KEY key, MASK mask) -{ - std::string keystring = LLKeyboard::stringFromKey(key); - gSavedSettings.setString("PushToTalkButton", keystring); - - if(key == ' ') - { - // This will cause the select dialog to immediately reopen. - // Eat the next click event. - mEatNextSetKeyClick = TRUE; - } +//-------------------------------------------------------------------- +//LLPrefsVoice +LLPrefsVoice::LLPrefsVoice() + : LLPanel(std::string("Voice Chat Panel")) +{ + LLUICtrlFactory::getInstance()->buildPanel(this, "panel_preferences_voice.xml"); } -void LLVoiceHotkeySelectDialog::onCancel( void* userdata ) +LLPrefsVoice::~LLPrefsVoice() { - LLVoiceHotkeySelectDialog* self = (LLVoiceHotkeySelectDialog*) userdata; - self->close(); // destroys this object - self->mOldFrontmost->setFrontmost(TRUE); } -BOOL LLVoiceHotkeySelectDialog::handleKeyHere(KEY key, MASK mask) +BOOL LLPrefsVoice::postBuild() { - BOOL result = TRUE; - - // Suck up all keystokes except CTRL-Q. - BOOL is_quit = ('Q' == key) && (MASK_CONTROL == mask); - if(is_quit) - { - result = FALSE; - } - else - { - mParent->setKey(key, mask); - } + childSetCommitCallback("enable_voice_check", onCommitEnableVoiceChat, this); + childSetAction("set_voice_hotkey_button", onClickSetKey, this); + childSetAction("set_voice_middlemouse_button", onClickSetMiddleMouse, this); + childSetAction("device_settings_btn", onClickVoiceDeviceSettings, NULL); - close(); // destroys this object - mOldFrontmost->setFrontmost(TRUE); - - return result; -} + BOOL voice_disabled = gSavedSettings.getBOOL("CmdLineDisableVoice"); + childSetVisible("voice_unavailable", voice_disabled); + childSetVisible("enable_voice_check", !voice_disabled); + childSetEnabled("enable_voice_check", !voice_disabled); -//--------------------------------------------------------------------------- + bool enable = !voice_disabled && gSavedSettings.getBOOL("EnableVoiceChat"); + childSetValue("enable_voice_check", enable); + onCommitEnableVoiceChat(getChild("enable_voice_check"), this); + childSetValue("modifier_combo", gSavedSettings.getString("PushToTalkButton")); + childSetValue("voice_call_friends_only_check", gSavedSettings.getBOOL("VoiceCallsFriendsOnly")); + childSetValue("push_to_talk_toggle_check", gSavedSettings.getBOOL("PushToTalkToggle")); + childSetValue("ear_location", gSavedSettings.getS32("VoiceEarLocation")); -LLPrefsVoice::LLPrefsVoice() - : LLPanel(std::string("Voice Chat Panel")) -{ - LLUICtrlFactory::getInstance()->buildPanel(this, "panel_preferences_voice.xml"); - mLogic = new LLPrefsVoiceLogic(this); - childSetAction("device_settings_btn", onClickVoiceDeviceSettingsBtn, this); + return TRUE; +} - // create floater immediately and keep it hidden - // since it stores preference state for audio devices - mVoiceDeviceSettings = LLFloaterVoiceDeviceSettings::getInstance(); +void LLPrefsVoice::apply() +{ + gSavedSettings.setBOOL("EnableVoiceChat", childGetValue("enable_voice_check")); + + gSavedSettings.setString("PushToTalkButton", childGetValue("modifier_combo")); + gSavedSettings.setBOOL("VoiceCallsFriendsOnly", childGetValue("voice_call_friends_only_check")); + gSavedSettings.setBOOL("PushToTalkToggle", childGetValue("push_to_talk_toggle_check")); + gSavedSettings.setS32("VoiceEarLocation", childGetValue("ear_location")); } -LLPrefsVoice::~LLPrefsVoice() +void LLPrefsVoice::cancel() +{ +} + +void LLPrefsVoice::setKey(KEY key) { - delete mLogic; + childSetValue("modifier_combo", LLKeyboard::stringFromKey(key)); } -void LLPrefsVoice::draw() +//static +void LLPrefsVoice::onCommitEnableVoiceChat(LLUICtrl* ctrl, void* user_data) { - bool enable = !gSavedSettings.getBOOL("CmdLineDisableVoice") - && gSavedSettings.getBOOL("EnableVoiceChat"); - childSetEnabled("device_settings_btn", enable); + LLPrefsVoice* self = (LLPrefsVoice*)user_data; + LLCheckBoxCtrl* enable_voice_chat = (LLCheckBoxCtrl*)ctrl; + + bool enable = enable_voice_chat->getValue(); - mLogic->refresh(); - mVoiceDeviceSettings->refresh(); - LLPanel::draw(); + self->childSetEnabled("modifier_combo", enable); + self->childSetEnabled("friends_only_check", enable); + self->childSetEnabled("push_to_talk_label", enable); + self->childSetEnabled("voice_call_friends_only_check", enable); + self->childSetEnabled("push_to_talk_toggle_check", enable); + self->childSetEnabled("ear_location", enable); + self->childSetEnabled("set_voice_hotkey_button", enable); + self->childSetEnabled("set_voice_middlemouse_button", enable); + self->childSetEnabled("device_settings_btn", enable); } -void LLPrefsVoice::apply() +//static +void LLPrefsVoice::onClickSetKey(void* user_data) { - mLogic->apply(); - mVoiceDeviceSettings->apply(); + LLPrefsVoice* self = (LLPrefsVoice*)user_data; + LLVoiceSetKeyDialog* dialog = new LLVoiceSetKeyDialog(self); + dialog->startModal(); } -void LLPrefsVoice::cancel() +//static +void LLPrefsVoice::onClickSetMiddleMouse(void* user_data) { - mLogic->cancel(); - mVoiceDeviceSettings->cancel(); + LLPrefsVoice* self = (LLPrefsVoice*)user_data; + self->childSetValue("modifier_combo", "MiddleMouse"); } -//static -void LLPrefsVoice::onClickVoiceDeviceSettingsBtn(void* user_data) +//static +void LLPrefsVoice::onClickVoiceDeviceSettings(void* user_data) { - LLPrefsVoice* prefs = (LLPrefsVoice*)user_data; - prefs->mVoiceDeviceSettings->open(); - LLFloater* parent_floater = gFloaterView->getParentFloater(prefs); - if (parent_floater) + LLPrefsVoice* voice_prefs = (LLPrefsVoice*)user_data; + LLFloaterVoiceDeviceSettings* device_settings_floater = LLFloaterVoiceDeviceSettings::showInstance(); + LLFloater* parent_floater = gFloaterView->getParentFloater(voice_prefs); + if(parent_floater) { - parent_floater->addDependentFloater(prefs->mVoiceDeviceSettings, FALSE); + parent_floater->addDependentFloater(device_settings_floater, FALSE); } } + diff --git a/linden/indra/newview/llprefsvoice.h b/linden/indra/newview/llprefsvoice.h index 836108d..a7cba73 100644 --- a/linden/indra/newview/llprefsvoice.h +++ b/linden/indra/newview/llprefsvoice.h @@ -34,55 +34,24 @@ #include "llpanel.h" -class LLFloaterVoiceDeviceSettings; - -class LLPrefsVoiceLogic -{ -public: - LLPrefsVoiceLogic(LLPanel* panelp); - virtual ~LLPrefsVoiceLogic(){}; - - virtual void init(); - - void apply(); - void cancel(); - void refresh(); - - void setKey(KEY key, MASK mask); - -protected: - - static void onClickSetKey(void* user_data); - static void onClickSetMiddleMouse(void* user_data); - static void onEarLocationCommit(LLUICtrl* ctrl, void* user_data); - - BOOL mEnableVoice; - BOOL mVoiceCallsFriendsOnly; - std::string mModifier; - BOOL mPushToTalkToggle; - S32 mEarLocation; - LLCtrlSelectionInterface *mCtrlEarLocation; - - BOOL mEatNextSetKeyClick; - - LLPanel* mPanel; -}; - class LLPrefsVoice : public LLPanel { public: LLPrefsVoice(); ~LLPrefsVoice(); - /*virtual*/ void draw(); + BOOL postBuild(); + void apply(); void cancel(); -protected: - static void onClickVoiceDeviceSettingsBtn(void* user_data); + void setKey(KEY key); - LLPrefsVoiceLogic* mLogic; - LLFloaterVoiceDeviceSettings* mVoiceDeviceSettings; +private: + static void onCommitEnableVoiceChat(LLUICtrl* ctrl, void* user_data); + static void onClickSetKey(void* user_data); + static void onClickSetMiddleMouse(void* user_data); + static void onClickVoiceDeviceSettings(void* user_data); }; #endif // LLPREFSVOICE_H diff --git a/linden/indra/newview/llpreviewscript.cpp b/linden/indra/newview/llpreviewscript.cpp index 52fca27..2b87128 100644 --- a/linden/indra/newview/llpreviewscript.cpp +++ b/linden/indra/newview/llpreviewscript.cpp @@ -101,7 +101,7 @@ const std::string HELLO_LSL = " llSay(0, \"Touched.\");\n" " }\n" "}\n"; -const std::string HELP_LSL = "lsl_guide.html"; +const std::string HELP_LSL_URL = "http://wiki.secondlife.com/wiki/LSL_Portal"; const std::string DEFAULT_SCRIPT_NAME = "New Script"; // *TODO:Translate? const std::string DEFAULT_SCRIPT_DESC = "(No Description)"; // *TODO:Translate? @@ -294,7 +294,7 @@ LLScriptEdCore::LLScriptEdCore( const std::string& name, const LLRect& rect, const std::string& sample, - const std::string& help, + const std::string& help_url, const LLHandle& floater_handle, void (*load_callback)(void*), void (*save_callback)(void*, BOOL), @@ -304,7 +304,7 @@ LLScriptEdCore::LLScriptEdCore( : LLPanel( std::string("name"), rect ), mSampleText(sample), - mHelpFile ( help ), + mHelpURL(help_url), mEditor( NULL ), mLoadCallback( load_callback ), mSaveCallback( save_callback ), @@ -547,7 +547,6 @@ void LLScriptEdCore::setHelpPage(const std::string& help_string) if (!history_combo) return; LLUIString url_string = gSavedSettings.getString("LSLHelpURL"); - url_string.setArg("[APP_DIRECTORY]", gDirUtilp->getWorkingDir()); url_string.setArg("[LSL_STRING]", help_string); addHelpItemToHistory(help_string); @@ -556,6 +555,7 @@ void LLScriptEdCore::setHelpPage(const std::string& help_string) } + void LLScriptEdCore::addHelpItemToHistory(const std::string& help_string) { if (help_string.empty()) return; @@ -647,7 +647,7 @@ void LLScriptEdCore::onHelpWebDialog(S32 option, void* userdata) switch(option) { case 0: - load_url_local_file(corep->mHelpFile); + LLWeb::loadURL(corep->mHelpURL); break; default: break; @@ -773,7 +773,6 @@ void LLScriptEdCore::onHelpComboCommit(LLUICtrl* ctrl, void* userdata) LLWebBrowserCtrl* web_browser = live_help_floater->getChild("lsl_guide_html"); LLUIString url_string = gSavedSettings.getString("LSLHelpURL"); - url_string.setArg("[APP_DIRECTORY]", gDirUtilp->getWorkingDir()); url_string.setArg("[LSL_STRING]", help_string); web_browser->navigateTo(url_string); } @@ -1072,7 +1071,7 @@ void* LLPreviewLSL::createScriptEdPanel(void* userdata) self->mScriptEd = new LLScriptEdCore("script panel", LLRect(), HELLO_LSL, - HELP_LSL, + HELP_LSL_URL, self->getHandle(), LLPreviewLSL::onLoad, LLPreviewLSL::onSave, @@ -1590,7 +1589,7 @@ void* LLLiveLSLEditor::createScriptEdPanel(void* userdata) self->mScriptEd = new LLScriptEdCore("script ed panel", LLRect(), HELLO_LSL, - HELP_LSL, + HELP_LSL_URL, self->getHandle(), &LLLiveLSLEditor::onLoad, &LLLiveLSLEditor::onSave, diff --git a/linden/indra/newview/llpreviewscript.h b/linden/indra/newview/llpreviewscript.h index 977b9ce..58de041 100644 --- a/linden/indra/newview/llpreviewscript.h +++ b/linden/indra/newview/llpreviewscript.h @@ -65,7 +65,7 @@ public: const std::string& name, const LLRect& rect, const std::string& sample, - const std::string& help, + const std::string& help_url, const LLHandle& floater_handle, void (*load_callback)(void* userdata), void (*save_callback)(void* userdata, BOOL close_after_save), @@ -132,7 +132,7 @@ protected: private: std::string mSampleText; - std::string mHelpFile; + std::string mHelpURL; LLTextEditor* mEditor; void (*mLoadCallback)(void* userdata); void (*mSaveCallback)(void* userdata, BOOL close_after_save); diff --git a/linden/indra/newview/llpreviewsound.cpp b/linden/indra/newview/llpreviewsound.cpp index 9ba6fd5..6b79bfb 100644 --- a/linden/indra/newview/llpreviewsound.cpp +++ b/linden/indra/newview/llpreviewsound.cpp @@ -106,7 +106,6 @@ void LLPreviewSound::auditionSound( void *userdata ) if(item && gAudiop) { LLVector3d lpos_global = gAgent.getPositionGlobal(); - F32 volume = gSavedSettings.getBOOL("MuteSounds") ? 0.f : SOUND_GAIN * gSavedSettings.getF32("AudioLevelSFX"); - gAudiop->triggerSound(item->getAssetUUID(), gAgent.getID(), volume, lpos_global); + gAudiop->triggerSound(item->getAssetUUID(), gAgent.getID(), SOUND_GAIN, LLAudioEngine::AUDIO_TYPE_UI, lpos_global); } } diff --git a/linden/indra/newview/llpreviewtexture.cpp b/linden/indra/newview/llpreviewtexture.cpp index 0a204dc..47a2cbc 100644 --- a/linden/indra/newview/llpreviewtexture.cpp +++ b/linden/indra/newview/llpreviewtexture.cpp @@ -200,7 +200,7 @@ void LLPreviewTexture::draw() if (!isMinimized()) { LLGLSUIDefault gls_ui; - LLGLSNoTexture gls_notex; + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); const LLRect& border = mClientRect; LLRect interior = mClientRect; @@ -299,20 +299,20 @@ BOOL LLPreviewTexture::canSaveAs() const // virtual void LLPreviewTexture::saveAs() { - if( !mLoadingFullImage ) + if( mLoadingFullImage ) return; + + LLFilePicker& file_picker = LLFilePicker::instance(); + if( !file_picker.getSaveFile( LLFilePicker::FFSAVE_TGA, LLDir::getScrubbedFileName(getItem()->getName())) ) { - LLFilePicker& file_picker = LLFilePicker::instance(); - if( !file_picker.getSaveFile( LLFilePicker::FFSAVE_TGA ) ) - { - // User canceled save. - return; - } - mSaveFileName = file_picker.getFirstFile(); - mLoadingFullImage = TRUE; - getWindow()->incBusyCount(); - mImage->setLoadedCallback( LLPreviewTexture::onFileLoadedForSave, - 0, TRUE, FALSE, new LLUUID( mItemUUID ) ); + // User canceled or we failed to acquire save file. + return; } + // remember the user-approved/edited file name. + mSaveFileName = file_picker.getFirstFile(); + mLoadingFullImage = TRUE; + getWindow()->incBusyCount(); + mImage->setLoadedCallback( LLPreviewTexture::onFileLoadedForSave, + 0, TRUE, FALSE, new LLUUID( mItemUUID ) ); } diff --git a/linden/indra/newview/llprogressview.cpp b/linden/indra/newview/llprogressview.cpp index 123c583..4354254 100644 --- a/linden/indra/newview/llprogressview.cpp +++ b/linden/indra/newview/llprogressview.cpp @@ -208,7 +208,7 @@ void LLProgressView::draw() if (gStartImageGL) { LLGLSUIDefault gls_ui; - LLViewerImage::bindTexture(gStartImageGL); + gGL.getTexUnit(0)->bind(gStartImageGL); gGL.color4f(1.f, 1.f, 1.f, mFadeTimer.getStarted() ? clamp_rescale(mFadeTimer.getElapsedTimeF32(), 0.f, FADE_IN_TIME, 1.f, 0.f) : 1.f); F32 image_aspect = (F32)gStartImageWidth / (F32)gStartImageHeight; F32 view_aspect = (F32)width / (F32)height; @@ -224,11 +224,11 @@ void LLProgressView::draw() glScalef(1.f, view_aspect / image_aspect, 1.f); } gl_rect_2d_simple_tex( getRect().getWidth(), getRect().getHeight() ); - gStartImageGL->unbindTexture(0, GL_TEXTURE_2D); + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); } else { - LLGLSNoTexture gls_no_texture; + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); gGL.color4f(0.f, 0.f, 0.f, 1.f); gl_rect_2d(getRect()); } diff --git a/linden/indra/newview/llselectmgr.cpp b/linden/indra/newview/llselectmgr.cpp index 2e4983c..e3b57b8 100644 --- a/linden/indra/newview/llselectmgr.cpp +++ b/linden/indra/newview/llselectmgr.cpp @@ -4828,7 +4828,7 @@ void LLSelectMgr::renderSilhouettes(BOOL for_hud) return; } - LLViewerImage::bindTexture(mSilhouetteImagep); + gGL.getTexUnit(0)->bind(mSilhouetteImagep.get()); LLGLSPipelineSelection gls_select; gGL.setAlphaRejectSettings(LLRender::CF_GREATER, 0.f); LLGLEnable blend(GL_BLEND); @@ -4936,7 +4936,7 @@ void LLSelectMgr::renderSilhouettes(BOOL for_hud) stop_glerror(); } - mSilhouetteImagep->unbindTexture(0, GL_TEXTURE_2D); + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT); } @@ -5313,7 +5313,7 @@ void LLSelectNode::renderOneSilhouette(const LLColor4 &color) LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE, GL_GEQUAL); gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT); - gGL.begin(LLVertexBuffer::LINES); + gGL.begin(LLRender::LINES); { S32 i = 0; for (S32 seg_num = 0; seg_num < (S32)mSilhouetteSegments.size(); seg_num++) @@ -5334,7 +5334,7 @@ void LLSelectNode::renderOneSilhouette(const LLColor4 &color) gGL.flush(); gGL.setSceneBlendType(LLRender::BT_ALPHA); - gGL.begin(LLVertexBuffer::TRIANGLES); + gGL.begin(LLRender::TRIANGLES); { S32 i = 0; for (S32 seg_num = 0; seg_num < (S32)mSilhouetteSegments.size(); seg_num++) @@ -5940,9 +5940,9 @@ S32 LLObjectSelection::getRootObjectCount() return count; } -bool LLObjectSelection::applyToObjects(LLSelectedObjectFunctor* func, bool firstonly) +bool LLObjectSelection::applyToObjects(LLSelectedObjectFunctor* func) { - bool result = firstonly ? false : true; + bool result = true; for (iterator iter = begin(); iter != end(); ) { iterator nextiter = iter++; @@ -5950,10 +5950,7 @@ bool LLObjectSelection::applyToObjects(LLSelectedObjectFunctor* func, bool first if (!object) continue; bool r = func->apply(object); - if (firstonly && r) - return true; - else - result = result && r; + result = result && r; } return result; } diff --git a/linden/indra/newview/llselectmgr.h b/linden/indra/newview/llselectmgr.h index d85ba04..a59b1c8 100644 --- a/linden/indra/newview/llselectmgr.h +++ b/linden/indra/newview/llselectmgr.h @@ -316,7 +316,7 @@ public: // If firstonly is FALSE, returns the AND of all apply() calls. // Else returns TRUE immediately if any apply() call succeeds (i.e. OR with early exit) bool applyToRootObjects(LLSelectedObjectFunctor* func, bool firstonly = false); - bool applyToObjects(LLSelectedObjectFunctor* func, bool firstonly = false); + bool applyToObjects(LLSelectedObjectFunctor* func); bool applyToTEs(LLSelectedTEFunctor* func, bool firstonly = false); bool applyToRootNodes(LLSelectedNodeFunctor* func, bool firstonly = false); bool applyToNodes(LLSelectedNodeFunctor* func, bool firstonly = false); diff --git a/linden/indra/newview/llsky.cpp b/linden/indra/newview/llsky.cpp index 8265d9d..18029a7 100644 --- a/linden/indra/newview/llsky.cpp +++ b/linden/indra/newview/llsky.cpp @@ -284,16 +284,16 @@ LLColor4U LLSky::getFadeColor() const void LLSky::init(const LLVector3 &sun_direction) { - mVOWLSkyp = static_cast(gObjectList.createObjectViewer(LLViewerObject::LL_VO_WL_SKY, gAgent.getRegion())); + mVOWLSkyp = static_cast(gObjectList.createObjectViewer(LLViewerObject::LL_VO_WL_SKY, NULL)); mVOWLSkyp->initSunDirection(sun_direction, LLVector3::zero); gPipeline.addObject(mVOWLSkyp.get()); - mVOSkyp = (LLVOSky *)gObjectList.createObjectViewer(LLViewerObject::LL_VO_SKY, gAgent.getRegion()); + mVOSkyp = (LLVOSky *)gObjectList.createObjectViewer(LLViewerObject::LL_VO_SKY, NULL); mVOSkyp->initSunDirection(sun_direction, LLVector3()); gPipeline.addObject((LLViewerObject *)mVOSkyp); - mVOGroundp = (LLVOGround*)gObjectList.createObjectViewer(LLViewerObject::LL_VO_GROUND, gAgent.getRegion()); + mVOGroundp = (LLVOGround*)gObjectList.createObjectViewer(LLViewerObject::LL_VO_GROUND, NULL); LLVOGround *groundp = mVOGroundp; gPipeline.addObject((LLViewerObject *)groundp); diff --git a/linden/indra/newview/llspatialpartition.cpp b/linden/indra/newview/llspatialpartition.cpp index 9f5d115..6247686 100644 --- a/linden/indra/newview/llspatialpartition.cpp +++ b/linden/indra/newview/llspatialpartition.cpp @@ -46,6 +46,7 @@ #include "pipeline.h" #include "llrender.h" #include "lloctree.h" +#include "llvoavatar.h" const F32 SG_OCCLUSION_FUDGE = 1.01f; #define SG_DISCARD_TOLERANCE 0.01f @@ -1624,7 +1625,7 @@ public: void drawBox(const LLVector3& c, const LLVector3& r) { - gGL.begin(LLVertexBuffer::TRIANGLE_STRIP); + gGL.begin(LLRender::TRIANGLE_STRIP); //left front gGL.vertex3fv((c+r.scaledVec(LLVector3(-1,1,-1))).mV); gGL.vertex3fv((c+r.scaledVec(LLVector3(-1,1,1))).mV); @@ -1643,7 +1644,7 @@ void drawBox(const LLVector3& c, const LLVector3& r) gGL.end(); //bottom - gGL.begin(LLVertexBuffer::TRIANGLE_STRIP); + gGL.begin(LLRender::TRIANGLE_STRIP); gGL.vertex3fv((c+r.scaledVec(LLVector3(1,1,-1))).mV); gGL.vertex3fv((c+r.scaledVec(LLVector3(1,-1,-1))).mV); gGL.vertex3fv((c+r.scaledVec(LLVector3(-1,1,-1))).mV); @@ -1651,7 +1652,7 @@ void drawBox(const LLVector3& c, const LLVector3& r) gGL.end(); //top - gGL.begin(LLVertexBuffer::TRIANGLE_STRIP); + gGL.begin(LLRender::TRIANGLE_STRIP); gGL.vertex3fv((c+r.scaledVec(LLVector3(1,1,1))).mV); gGL.vertex3fv((c+r.scaledVec(LLVector3(-1,1,1))).mV); gGL.vertex3fv((c+r.scaledVec(LLVector3(1,-1,1))).mV); @@ -1666,7 +1667,7 @@ void drawBoxOutline(const LLVector3& pos, const LLVector3& size) LLVector3 v3 = size.scaledVec(LLVector3(-1,-1,1)); LLVector3 v4 = size.scaledVec(LLVector3( 1,-1,1)); - gGL.begin(LLVertexBuffer::LINES); + gGL.begin(LLRender::LINES); //top gGL.vertex3fv((pos+v1).mV); @@ -1814,7 +1815,7 @@ void pushVerts(LLDrawInfo* params, U32 mask) { LLRenderPass::applyModelMatrix(*params); params->mVertexBuffer->setBuffer(mask); - params->mVertexBuffer->drawRange(params->mParticle ? LLVertexBuffer::POINTS : LLVertexBuffer::TRIANGLES, + params->mVertexBuffer->drawRange(params->mParticle ? LLRender::POINTS : LLRender::TRIANGLES, params->mStart, params->mEnd, params->mCount, params->mOffset); } @@ -1843,7 +1844,7 @@ void pushVerts(LLFace* face, U32 mask) U16 end = start + face->getGeomCount()-1; U32 count = face->getIndicesCount(); U16 offset = face->getIndicesStart(); - buffer->drawRange(LLVertexBuffer::TRIANGLES, start, end, count, offset); + buffer->drawRange(LLRender::TRIANGLES, start, end, count, offset); } } @@ -1853,7 +1854,7 @@ void pushBufferVerts(LLVertexBuffer* buffer, U32 mask) if (buffer) { buffer->setBuffer(mask); - buffer->drawRange(LLVertexBuffer::TRIANGLES, 0, buffer->getRequestedVerts()-1, buffer->getRequestedIndices(), 0); + buffer->drawRange(LLRender::TRIANGLES, 0, buffer->getRequestedVerts()-1, buffer->getRequestedIndices(), 0); } } @@ -1902,7 +1903,7 @@ void pushVertsColorCoded(LLSpatialGroup* group, U32 mask) LLRenderPass::applyModelMatrix(*params); glColor4f(colors[col].mV[0], colors[col].mV[1], colors[col].mV[2], 0.5f); params->mVertexBuffer->setBuffer(mask); - params->mVertexBuffer->drawRange(params->mParticle ? LLVertexBuffer::POINTS : LLVertexBuffer::TRIANGLES, + params->mVertexBuffer->drawRange(params->mParticle ? LLRender::POINTS : LLRender::TRIANGLES, params->mStart, params->mEnd, params->mCount, params->mOffset); col = (col+1)%col_count; } @@ -1972,7 +1973,7 @@ void renderOctree(LLSpatialGroup* group) face->mVertexBuffer->setBuffer(LLVertexBuffer::MAP_VERTEX); //drawBox((face->mExtents[0] + face->mExtents[1])*0.5f, // (face->mExtents[1]-face->mExtents[0])*0.5f); - face->mVertexBuffer->draw(LLVertexBuffer::TRIANGLES, face->getIndicesCount(), face->getIndicesStart()); + face->mVertexBuffer->draw(LLRender::TRIANGLES, face->getIndicesCount(), face->getIndicesStart()); } } @@ -2103,6 +2104,7 @@ void renderBoundingBox(LLDrawable* drawable) gGL.color4f(0.5f,0.5f,0.5f,1.0f); break; case LLViewerObject::LL_VO_PART_GROUP: + case LLViewerObject::LL_VO_HUD_PART_GROUP: gGL.color4f(0,0,1,1); break; case LLViewerObject::LL_VO_WATER: @@ -2222,7 +2224,7 @@ void renderPoints(LLDrawable* drawablep) LLGLDepthTest depth(GL_FALSE, GL_FALSE); if (drawablep->getNumFaces()) { - gGL.begin(LLVertexBuffer::POINTS); + gGL.begin(LLRender::POINTS); gGL.color3f(1,1,1); LLVector3 center(drawablep->getPositionGroup()); for (S32 i = 0; i < drawablep->getNumFaces(); i++) @@ -2298,9 +2300,17 @@ void renderRaycast(LLDrawable* drawablep) LLGLEnable blend(GL_BLEND); gGL.color4f(0,1,1,0.5f); - for (S32 i = 0; i < drawablep->getNumFaces(); i++) + if (drawablep->getVOVolume() && gDebugRaycastFaceHit != -1) { - pushVerts(drawablep->getFace(i), LLVertexBuffer::MAP_VERTEX); + glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); + pushVerts(drawablep->getFace(gDebugRaycastFaceHit), LLVertexBuffer::MAP_VERTEX); + glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); + } + else if (drawablep->isAvatar()) + { + LLGLDepthTest depth(GL_FALSE); + LLVOAvatar* av = (LLVOAvatar*) drawablep->getVObj().get(); + av->renderCollisionVolumes(); } // draw intersection point @@ -2468,7 +2478,7 @@ void LLSpatialPartition::renderDebug() LLGLDisable cullface(GL_CULL_FACE); LLGLEnable blend(GL_BLEND); gGL.setSceneBlendType(LLRender::BT_ALPHA); - LLImageGL::unbindTexture(0); + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); gPipeline.disableLights(); LLSpatialBridge* bridge = asBridge(); @@ -2508,8 +2518,9 @@ public: LLVector3 *mNormal; LLVector3 *mBinormal; LLDrawable* mHit; - - LLOctreeIntersect(LLVector3 start, LLVector3 end, + BOOL mPickTransparent; + + LLOctreeIntersect(LLVector3 start, LLVector3 end, BOOL pick_transparent, S32* face_hit, LLVector3* intersection, LLVector2* tex_coord, LLVector3* normal, LLVector3* binormal) : mStart(start), mEnd(end), @@ -2518,14 +2529,15 @@ public: mTexCoord(tex_coord), mNormal(normal), mBinormal(binormal), - mHit(NULL) + mHit(NULL), + mPickTransparent(pick_transparent) { } virtual void visit(const LLSpatialGroup::OctreeNode* branch) { for (LLSpatialGroup::OctreeNode::const_element_iter i = branch->getData().begin(); i != branch->getData().end(); ++i) - { + { check(*i); } } @@ -2570,25 +2582,35 @@ public: virtual bool check(LLDrawable* drawable) { + LLVector3 local_start = mStart; + LLVector3 local_end = mEnd; + + if (!gPipeline.hasRenderType(drawable->getRenderType()) || !drawable->isVisible()) + { + return false; + } + if (drawable->isSpatialBridge()) { LLSpatialPartition *part = drawable->asPartition(); - - check(part->mOctree); - } - + LLSpatialBridge* bridge = part->asBridge(); + if (bridge && gPipeline.hasRenderType(bridge->mDrawableType)) + { + check(part->mOctree); + } + } else - { - LLViewerObject* vobj = drawable->getVObj(); + { + LLViewerObject* vobj = drawable->getVObj(); if (vobj) { LLVector3 intersection; - if (vobj->lineSegmentIntersect(mStart, mEnd, -1, mFaceHit, &intersection, mTexCoord, mNormal, mBinormal)) + if (vobj->lineSegmentIntersect(mStart, mEnd, -1, mPickTransparent, mFaceHit, &intersection, mTexCoord, mNormal, mBinormal)) { mEnd = intersection; // shorten ray so we only find CLOSER hits if (mIntersection) - { + { *mIntersection = intersection; } @@ -2596,12 +2618,13 @@ public: } } } - + return false; } }; LLDrawable* LLSpatialPartition::lineSegmentIntersect(const LLVector3& start, const LLVector3& end, + BOOL pick_transparent, S32* face_hit, // return the face hit LLVector3* intersection, // return the intersection point LLVector2* tex_coord, // return the texture coordinates of the intersection point @@ -2610,7 +2633,7 @@ LLDrawable* LLSpatialPartition::lineSegmentIntersect(const LLVector3& start, con ) { - LLOctreeIntersect intersect(start, end, face_hit, intersection, tex_coord, normal, bi_normal); + LLOctreeIntersect intersect(start, end, pick_transparent, face_hit, intersection, tex_coord, normal, bi_normal); LLDrawable* drawable = intersect.check(mOctree); return drawable; diff --git a/linden/indra/newview/llspatialpartition.h b/linden/indra/newview/llspatialpartition.h index bd09da2..f42d55b 100644 --- a/linden/indra/newview/llspatialpartition.h +++ b/linden/indra/newview/llspatialpartition.h @@ -301,6 +301,7 @@ public: BOOL remove(LLDrawable *drawablep, LLSpatialGroup *curp); LLDrawable* lineSegmentIntersect(const LLVector3& start, const LLVector3& end, + BOOL pick_transparent, S32* face_hit, // return the face hit LLVector3* intersection = NULL, // return the intersection point LLVector2* tex_coord = NULL, // return the texture coordinates of the intersection point @@ -482,6 +483,12 @@ protected: U32 mRenderPass; }; +class LLHUDParticlePartition : public LLParticlePartition +{ +public: + LLHUDParticlePartition(); +}; + //spatial partition for grass (implemented in LLVOGrass.cpp) class LLGrassPartition : public LLParticlePartition { diff --git a/linden/indra/newview/llsprite.cpp b/linden/indra/newview/llsprite.cpp index 7da1d48..0032ee8 100644 --- a/linden/indra/newview/llsprite.cpp +++ b/linden/indra/newview/llsprite.cpp @@ -126,8 +126,8 @@ void LLSprite::updateFace(LLFace &face) LLVector3 camera_vec = mPosition - sCameraPosition; mScaledRight = camera_vec % LLVector3(0.f, 0.f, 1.f); mScaledUp = -(camera_vec % mScaledRight); - mScaledUp.normVec(); - mScaledRight.normVec(); + mScaledUp.normalize(); + mScaledRight.normalize(); mScaledUp *= mHeightDiv2; mScaledRight *= mWidthDiv2; @@ -156,7 +156,7 @@ void LLSprite::updateFace(LLFace &face) else { x_axis = sNormal % LLVector3(0.f, -1.f, 0.f); - x_axis.normVec(); + x_axis.normalize(); y_axis = sNormal % x_axis; } diff --git a/linden/indra/newview/llsprite.h b/linden/indra/newview/llsprite.h index 7170cb2..e721bef 100644 --- a/linden/indra/newview/llsprite.h +++ b/linden/indra/newview/llsprite.h @@ -73,7 +73,7 @@ public: void setColor(const LLColor4 &color); void setColor(const F32 r, const F32 g, const F32 b, const F32 a); void setAlpha(const F32 alpha) { mColor.mV[VALPHA] = alpha; } - void setNormal(const LLVector3 &normal) { sNormal = normal; sNormal.normVec();} + void setNormal(const LLVector3 &normal) { sNormal = normal; sNormal.normalize();} F32 getAlpha(); diff --git a/linden/indra/newview/llstartup.cpp b/linden/indra/newview/llstartup.cpp index 0978fbb..2ce111f 100644 --- a/linden/indra/newview/llstartup.cpp +++ b/linden/indra/newview/llstartup.cpp @@ -89,6 +89,7 @@ #include "llfeaturemanager.h" #include "llfirstuse.h" #include "llfloateractivespeakers.h" +#include "llfloaterbeacons.h" #include "llfloatercamera.h" #include "llfloaterchat.h" #include "llfloatergesture.h" @@ -244,6 +245,7 @@ void callback_choose_gender(S32 option, void* userdata); void init_start_screen(S32 location_id); void release_start_screen(); void reset_login(); +void apply_udp_blacklist(const std::string& csv); void callback_cache_name(const LLUUID& id, const std::string& firstname, const std::string& lastname, BOOL is_group, void* data) { @@ -750,6 +752,12 @@ bool idle_startup() gLoginMenuBarView->setVisible( TRUE ); gLoginMenuBarView->setEnabled( TRUE ); + // DEV-16927. The following code removes errant keystrokes that happen while the window is being + // first made visible. +#ifdef _WIN32 + MSG msg; + while( PeekMessage( &msg, /*All hWnds owned by this thread */ NULL, WM_KEYFIRST, WM_KEYLAST, PM_REMOVE ) ); +#endif timeout.reset(); return FALSE; } @@ -842,6 +850,20 @@ bool idle_startup() LLFile::mkdir(gDirUtilp->getChatLogsDir()); LLFile::mkdir(gDirUtilp->getPerAccountChatLogsDir()); + //good as place as any to create user windlight directories + std::string user_windlight_path_name(gDirUtilp->getExpandedFilename( LL_PATH_USER_SETTINGS , "windlight", "")); + LLFile::mkdir(user_windlight_path_name.c_str()); + + std::string user_windlight_skies_path_name(gDirUtilp->getExpandedFilename( LL_PATH_USER_SETTINGS , "windlight/skies", "")); + LLFile::mkdir(user_windlight_skies_path_name.c_str()); + + std::string user_windlight_water_path_name(gDirUtilp->getExpandedFilename( LL_PATH_USER_SETTINGS , "windlight/water", "")); + LLFile::mkdir(user_windlight_water_path_name.c_str()); + + std::string user_windlight_days_path_name(gDirUtilp->getExpandedFilename( LL_PATH_USER_SETTINGS , "windlight/days", "")); + LLFile::mkdir(user_windlight_days_path_name.c_str()); + + if (show_connect_box) { if ( LLPanelLogin::isGridComboDirty() ) @@ -1094,6 +1116,7 @@ bool idle_startup() LL_DEBUGS("AppInit") << "STATE_LOGIN_PROCESS_RESPONSE" << LL_ENDL; std::ostringstream emsg; bool quit = false; + bool update = false; std::string login_response; std::string reason_response; std::string message_response; @@ -1137,11 +1160,7 @@ bool idle_startup() reason_response = LLUserAuth::getInstance()->getResponse("reason"); message_response = LLUserAuth::getInstance()->getResponse("message"); - if (gHideLinks && reason_response == "disabled") - { - emsg << gDisabledMessage; - } - else if (!message_response.empty()) + if (!message_response.empty()) { // XUI: fix translation for strings returned during login // We need a generic table for translations @@ -1199,16 +1218,7 @@ bool idle_startup() if(reason_response == "update") { auth_message = LLUserAuth::getInstance()->getResponse("message"); - if (show_connect_box) - { - update_app(TRUE, auth_message); - LLStartUp::setStartupState( STATE_UPDATE_CHECK ); - return false; - } - else - { - quit = true; - } + update = true; } if(reason_response == "optional") { @@ -1246,6 +1256,21 @@ bool idle_startup() break; } + if (update || gSavedSettings.getBOOL("ForceMandatoryUpdate")) + { + gSavedSettings.setBOOL("ForceMandatoryUpdate", FALSE); + if (show_connect_box) + { + update_app(TRUE, auth_message); + LLStartUp::setStartupState( STATE_UPDATE_CHECK ); + return false; + } + else + { + quit = true; + } + } + // Version update and we're not showing the dialog if(quit) { @@ -1256,8 +1281,14 @@ bool idle_startup() if(successful_login) { - // unpack login data needed by the application std::string text; + text = LLUserAuth::getInstance()->getResponse("udp_blacklist"); + if(!text.empty()) + { + apply_udp_blacklist(text); + } + + // unpack login data needed by the application text = LLUserAuth::getInstance()->getResponse("agent_id"); if(!text.empty()) gAgentID.set(text); gDebugInfo["AgentID"] = text; @@ -1630,6 +1661,11 @@ bool idle_startup() LLFloaterActiveSpeakers::showInstance(); } + if (gSavedSettings.getBOOL("BeaconAlwaysOn")) + { + LLFloaterBeacons::showInstance(); + } + if (!gNoRender) { // Move the progress view in front of the UI @@ -2251,6 +2287,9 @@ bool idle_startup() } } + //DEV-17797. get null folder. Any items found here moved to Lost and Found + LLInventoryModel::findLostItems(); + LLStartUp::setStartupState( STATE_PRECACHE ); timeout.reset(); return FALSE; @@ -2428,7 +2467,7 @@ bool idle_startup() gDebugView->mFastTimerView->setVisible(TRUE); #endif - LLAppViewer::instance()->initMainloopTimeout("Mainloop Init"); + LLAppViewer::instance()->handleLoginComplete(); return TRUE; } @@ -2744,7 +2783,6 @@ void update_app(BOOL mandatory, const std::string& auth_msg) void update_dialog_callback(S32 option, void *userdata) { - std::string update_exe_path; bool mandatory = userdata != NULL; #if !LL_RELEASE_FOR_DOWNLOAD @@ -2787,29 +2825,41 @@ void update_dialog_callback(S32 option, void *userdata) // *TODO constantize this guy LLURI update_url = LLURI::buildHTTP("secondlife.com", 80, "update.php", query_map); + if(LLAppViewer::sUpdaterInfo) + { + delete LLAppViewer::sUpdaterInfo ; + } + LLAppViewer::sUpdaterInfo = new LLAppViewer::LLUpdaterInfo() ; + #if LL_WINDOWS - update_exe_path = gDirUtilp->getTempFilename(); - if (update_exe_path.empty()) + LLAppViewer::sUpdaterInfo->mUpdateExePath = gDirUtilp->getTempFilename(); + if (LLAppViewer::sUpdaterInfo->mUpdateExePath.empty()) { + delete LLAppViewer::sUpdaterInfo ; + LLAppViewer::sUpdaterInfo = NULL ; + // We're hosed, bail LL_WARNS("AppInit") << "LLDir::getTempFilename() failed" << LL_ENDL; LLAppViewer::instance()->forceQuit(); return; } - update_exe_path += ".exe"; + LLAppViewer::sUpdaterInfo->mUpdateExePath += ".exe"; std::string updater_source = gDirUtilp->getAppRODataDir(); updater_source += gDirUtilp->getDirDelimiter(); updater_source += "updater.exe"; LL_DEBUGS("AppInit") << "Calling CopyFile source: " << updater_source - << " dest: " << update_exe_path + << " dest: " << LLAppViewer::sUpdaterInfo->mUpdateExePath << LL_ENDL; - if (!CopyFileA(updater_source.c_str(), update_exe_path.c_str(), FALSE)) + if (!CopyFileA(updater_source.c_str(), LLAppViewer::sUpdaterInfo->mUpdateExePath.c_str(), FALSE)) { + delete LLAppViewer::sUpdaterInfo ; + LLAppViewer::sUpdaterInfo = NULL ; + LL_WARNS("AppInit") << "Unable to copy the updater!" << LL_ENDL; LLAppViewer::instance()->forceQuit(); return; @@ -2822,41 +2872,13 @@ void update_dialog_callback(S32 option, void *userdata) gSavedSettings.setString( "NextLoginLocation", LLURLSimString::sInstance.mSimString ); }; - std::ostringstream params; - params << "-url \"" << update_url.asString() << "\""; - if (gHideLinks) - { - // Figure out the program name. - const std::string& data_dir = gDirUtilp->getAppRODataDir(); - // Roll back from the end, stopping at the first '\' - const char* program_name = data_dir.c_str() + data_dir.size(); /* Flawfinder: ignore */ - while ( (data_dir != --program_name) && - *(program_name) != '\\'); - - if ( *(program_name) == '\\') - { - // We found a '\'. - program_name++; - } - else - { - // Oops. - program_name = "SecondLife"; - } + LLAppViewer::sUpdaterInfo->mParams << "-url \"" << update_url.asString() << "\""; - params << " -silent -name \"" << LLAppViewer::instance()->getSecondLifeTitle() << "\""; - params << " -program \"" << program_name << "\""; - } - - LL_DEBUGS("AppInit") << "Calling updater: " << update_exe_path << " " << params.str() << LL_ENDL; + LL_DEBUGS("AppInit") << "Calling updater: " << LLAppViewer::sUpdaterInfo->mUpdateExePath << " " << LLAppViewer::sUpdaterInfo->mParams.str() << LL_ENDL; //Explicitly remove the marker file, otherwise we pass the lock onto the child process and things get weird. LLAppViewer::instance()->removeMarkerFile(); // In case updater fails - // Use spawn() to run asynchronously - int retval = _spawnl(_P_NOWAIT, update_exe_path.c_str(), update_exe_path.c_str(), params.str().c_str(), NULL); - LL_DEBUGS("AppInit") << "Spawn returned " << retval << LL_ENDL; - #elif LL_DARWIN // if a sim name was passed in via command line parameter (typically through a SLURL) if ( LLURLSimString::sInstance.mSimString.length() ) @@ -2865,18 +2887,15 @@ void update_dialog_callback(S32 option, void *userdata) gSavedSettings.setString( "NextLoginLocation", LLURLSimString::sInstance.mSimString ); }; - update_exe_path = "'"; - update_exe_path += gDirUtilp->getAppRODataDir(); - update_exe_path += "/mac-updater.app/Contents/MacOS/mac-updater' -url \""; - update_exe_path += update_url.asString(); - update_exe_path += "\" -name \""; - update_exe_path += LLAppViewer::instance()->getSecondLifeTitle(); - update_exe_path += "\" &"; - - LL_DEBUGS("AppInit") << "Calling updater: " << update_exe_path << LL_ENDL; - - // Run the auto-updater. - system(update_exe_path.c_str()); /* Flawfinder: ignore */ + LLAppViewer::sUpdaterInfo->mUpdateExePath = "'"; + LLAppViewer::sUpdaterInfo->mUpdateExePath += gDirUtilp->getAppRODataDir(); + LLAppViewer::sUpdaterInfo->mUpdateExePath += "/mac-updater.app/Contents/MacOS/mac-updater' -url \""; + LLAppViewer::sUpdaterInfo->mUpdateExePath += update_url.asString(); + LLAppViewer::sUpdaterInfo->mUpdateExePath += "\" -name \""; + LLAppViewer::sUpdaterInfo->mUpdateExePath += LLAppViewer::instance()->getSecondLifeTitle(); + LLAppViewer::sUpdaterInfo->mUpdateExePath += "\" &"; + + LL_DEBUGS("AppInit") << "Calling updater: " << LLAppViewer::sUpdaterInfo->mUpdateExePath << LL_ENDL; #elif LL_LINUX OSMessageBox("Automatic updating is not yet implemented for Linux.\n" @@ -3533,7 +3552,7 @@ void init_stat_view() stat_barp->mDisplayBar = FALSE; stat_barp->mDisplayMean = FALSE; - stat_barp = sim_time_viewp->addStat("Sim Time (Physics)", &(LLViewerStats::getInstance()->mSimSimPhysicsMsec)); + stat_barp = sim_time_viewp->addStat("Physics Time", &(LLViewerStats::getInstance()->mSimSimPhysicsMsec)); stat_barp->setUnitLabel("ms"); stat_barp->mPrecision = 1; stat_barp->mMinBar = 0.f; @@ -3544,45 +3563,7 @@ void init_stat_view() stat_barp->mDisplayBar = FALSE; stat_barp->mDisplayMean = FALSE; - LLStatView *physics_time_viewp; - physics_time_viewp = new LLStatView("physics perf view", "Physics Details (ms)", "", rect); - sim_time_viewp->addChildAtEnd(physics_time_viewp); - { - stat_barp = physics_time_viewp->addStat("Physics Step", &(LLViewerStats::getInstance()->mSimSimPhysicsStepMsec)); - stat_barp->setUnitLabel("ms"); - stat_barp->mPrecision = 1; - stat_barp->mMinBar = 0.f; - stat_barp->mMaxBar = 40.f; - stat_barp->mTickSpacing = 10.f; - stat_barp->mLabelSpacing = 20.f; - stat_barp->mPerSec = FALSE; - stat_barp->mDisplayBar = FALSE; - stat_barp->mDisplayMean = FALSE; - - stat_barp = physics_time_viewp->addStat("Update Shapes", &(LLViewerStats::getInstance()->mSimSimPhysicsShapeUpdateMsec)); - stat_barp->setUnitLabel("ms"); - stat_barp->mPrecision = 1; - stat_barp->mMinBar = 0.f; - stat_barp->mMaxBar = 40.f; - stat_barp->mTickSpacing = 10.f; - stat_barp->mLabelSpacing = 20.f; - stat_barp->mPerSec = FALSE; - stat_barp->mDisplayBar = FALSE; - stat_barp->mDisplayMean = FALSE; - - stat_barp = physics_time_viewp->addStat("Other", &(LLViewerStats::getInstance()->mSimSimPhysicsOtherMsec)); - stat_barp->setUnitLabel("ms"); - stat_barp->mPrecision = 1; - stat_barp->mMinBar = 0.f; - stat_barp->mMaxBar = 40.f; - stat_barp->mTickSpacing = 10.f; - stat_barp->mLabelSpacing = 20.f; - stat_barp->mPerSec = FALSE; - stat_barp->mDisplayBar = FALSE; - stat_barp->mDisplayMean = FALSE; - } - - stat_barp = sim_time_viewp->addStat("Sim Time (Other)", &(LLViewerStats::getInstance()->mSimSimOtherMsec)); + stat_barp = sim_time_viewp->addStat("Simulation Time", &(LLViewerStats::getInstance()->mSimSimOtherMsec)); stat_barp->setUnitLabel("ms"); stat_barp->mPrecision = 1; stat_barp->mMinBar = 0.f; @@ -3626,6 +3607,79 @@ void init_stat_view() stat_barp->mDisplayBar = FALSE; stat_barp->mDisplayMean = FALSE; + stat_barp = sim_time_viewp->addStat("Spare Time", &(LLViewerStats::getInstance()->mSimSpareMsec)); + stat_barp->setUnitLabel("ms"); + stat_barp->mPrecision = 1; + stat_barp->mMinBar = 0.f; + stat_barp->mMaxBar = 40.f; + stat_barp->mTickSpacing = 10.f; + stat_barp->mLabelSpacing = 20.f; + stat_barp->mPerSec = FALSE; + stat_barp->mDisplayBar = FALSE; + stat_barp->mDisplayMean = FALSE; + + + // 2nd level time blocks under 'Details' second + LLStatView *detailed_time_viewp; + detailed_time_viewp = new LLStatView("sim perf view", "Time Details (ms)", "", rect); + sim_time_viewp->addChildAtEnd(detailed_time_viewp); + { + stat_barp = detailed_time_viewp->addStat(" Physics Step", &(LLViewerStats::getInstance()->mSimSimPhysicsStepMsec)); + stat_barp->setUnitLabel("ms"); + stat_barp->mPrecision = 1; + stat_barp->mMinBar = 0.f; + stat_barp->mMaxBar = 40.f; + stat_barp->mTickSpacing = 10.f; + stat_barp->mLabelSpacing = 20.f; + stat_barp->mPerSec = FALSE; + stat_barp->mDisplayBar = FALSE; + stat_barp->mDisplayMean = FALSE; + + stat_barp = detailed_time_viewp->addStat(" Update Physics Shapes", &(LLViewerStats::getInstance()->mSimSimPhysicsShapeUpdateMsec)); + stat_barp->setUnitLabel("ms"); + stat_barp->mPrecision = 1; + stat_barp->mMinBar = 0.f; + stat_barp->mMaxBar = 40.f; + stat_barp->mTickSpacing = 10.f; + stat_barp->mLabelSpacing = 20.f; + stat_barp->mPerSec = FALSE; + stat_barp->mDisplayBar = FALSE; + stat_barp->mDisplayMean = FALSE; + + stat_barp = detailed_time_viewp->addStat(" Physics Other", &(LLViewerStats::getInstance()->mSimSimPhysicsOtherMsec)); + stat_barp->setUnitLabel("ms"); + stat_barp->mPrecision = 1; + stat_barp->mMinBar = 0.f; + stat_barp->mMaxBar = 40.f; + stat_barp->mTickSpacing = 10.f; + stat_barp->mLabelSpacing = 20.f; + stat_barp->mPerSec = FALSE; + stat_barp->mDisplayBar = FALSE; + stat_barp->mDisplayMean = FALSE; + + stat_barp = detailed_time_viewp->addStat(" Sleep Time", &(LLViewerStats::getInstance()->mSimSleepMsec)); + stat_barp->setUnitLabel("ms"); + stat_barp->mPrecision = 1; + stat_barp->mMinBar = 0.f; + stat_barp->mMaxBar = 40.f; + stat_barp->mTickSpacing = 10.f; + stat_barp->mLabelSpacing = 20.f; + stat_barp->mPerSec = FALSE; + stat_barp->mDisplayBar = FALSE; + stat_barp->mDisplayMean = FALSE; + + stat_barp = detailed_time_viewp->addStat(" Pump IO", &(LLViewerStats::getInstance()->mSimPumpIOMsec)); + stat_barp->setUnitLabel("ms"); + stat_barp->mPrecision = 1; + stat_barp->mMinBar = 0.f; + stat_barp->mMaxBar = 40.f; + stat_barp->mTickSpacing = 10.f; + stat_barp->mLabelSpacing = 20.f; + stat_barp->mPerSec = FALSE; + stat_barp->mDisplayBar = FALSE; + stat_barp->mDisplayMean = FALSE; + } + LLRect r = gDebugView->mFloaterStatsp->getRect(); // Reshape based on the parameters we set. @@ -3887,3 +3941,28 @@ void login_alert_done(S32 option, void* user_data) LLPanelLogin::giveFocus(); } + +void apply_udp_blacklist(const std::string& csv) +{ + + std::string::size_type start = 0; + std::string::size_type comma = 0; + do + { + comma = csv.find(",", start); + if (comma == std::string::npos) + { + comma = csv.length(); + } + std::string item(csv, start, comma-start); + + lldebugs << "udp_blacklist " << item << llendl; + gMessageSystem->banUdpMessage(item); + + start = comma + 1; + + } + while(comma < csv.length()); + +} + diff --git a/linden/indra/newview/llstatbar.cpp b/linden/indra/newview/llstatbar.cpp index 19a9442..d88e89f 100644 --- a/linden/indra/newview/llstatbar.cpp +++ b/linden/indra/newview/llstatbar.cpp @@ -166,7 +166,7 @@ void LLStatBar::draw() bottom = bar_top - bar_height - tick_height/2; LLGLSUIDefault gls_ui; - LLGLSNoTexture gls_no_texture; + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); for (tick_value = mMinBar; tick_value <= mMaxBar; tick_value += mTickSpacing) { left = llfloor((tick_value - mMinBar)*value_scale); diff --git a/linden/indra/newview/llsurface.cpp b/linden/indra/newview/llsurface.cpp index 017517c..b046f97 100644 --- a/linden/indra/newview/llsurface.cpp +++ b/linden/indra/newview/llsurface.cpp @@ -33,6 +33,8 @@ #include "llsurface.h" +#include "llrender.h" + #include "llviewerimagelist.h" #include "llpatchvertexarray.h" #include "patch_dct.h" @@ -249,7 +251,7 @@ void LLSurface::createSTexture() mSTexturep = new LLViewerImage(raw, FALSE); mSTexturep->dontDiscard(); - mSTexturep->bind(); + gGL.getTexUnit(0)->bind(mSTexturep.get()); mSTexturep->setClamp(TRUE, TRUE); gImageList.addImage(mSTexturep); } @@ -274,7 +276,7 @@ void LLSurface::createWaterTexture() } mWaterTexturep = new LLViewerImage(raw, FALSE); mWaterTexturep->dontDiscard(); - mWaterTexturep->bind(); + gGL.getTexUnit(0)->bind(mWaterTexturep.get()); mWaterTexturep->setClamp(TRUE, TRUE); gImageList.addImage(mWaterTexturep); } diff --git a/linden/indra/newview/lltexlayer.cpp b/linden/indra/newview/lltexlayer.cpp index e331146..a687344 100644 --- a/linden/indra/newview/lltexlayer.cpp +++ b/linden/indra/newview/lltexlayer.cpp @@ -60,8 +60,6 @@ // SJB: We really always want to use the GL cache; // let GL page textures in and out of video RAM instead of trying to do so by hand. -LLGradientPaletteList gGradientPaletteList; - // static S32 LLTexLayerSetBuffer::sGLByteCount = 0; S32 LLTexLayerSetBuffer::sGLBumpByteCount = 0; @@ -96,7 +94,6 @@ LLTexLayerSetBuffer::LLTexLayerSetBuffer( LLTexLayerSet* owner, S32 width, S32 h mNeedsUpload( FALSE ), mUploadPending( FALSE ), // Not used for any logic here, just to sync sending of updates mTexLayerSet( owner ), - mInitialized( FALSE ), mBumpTexName(0) { LLTexLayerSetBuffer::sGLByteCount += getSize(); @@ -106,11 +103,10 @@ LLTexLayerSetBuffer::LLTexLayerSetBuffer( LLTexLayerSet* owner, S32 width, S32 h LLGLSUIDefault gls_ui; glGenTextures(1, (GLuint*) &mBumpTexName); - LLImageGL::bindExternalTexture(mBumpTexName, 0, GL_TEXTURE_2D); + gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, mBumpTexName); stop_glerror(); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_CLAMP); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); @@ -118,7 +114,7 @@ LLTexLayerSetBuffer::LLTexLayerSetBuffer( LLTexLayerSet* owner, S32 width, S32 h glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); stop_glerror(); - LLImageGL::unbindTexture(0, GL_TEXTURE_2D); + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); LLImageGL::sGlobalTextureMemory += mWidth * mHeight * 4; LLTexLayerSetBuffer::sGLBumpByteCount += mWidth * mHeight * 4; @@ -259,7 +255,7 @@ BOOL LLTexLayerSetBuffer::render() LLGLSUIDefault gls_ui; // read back into texture (this is done externally for the color data) - LLImageGL::bindExternalTexture( mBumpTexName, 0, GL_TEXTURE_2D ); + gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, mBumpTexName); stop_glerror(); glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, mOrigin.mX, mOrigin.mY, mWidth, mHeight); @@ -299,12 +295,17 @@ BOOL LLTexLayerSetBuffer::render() gGL.setSceneBlendType(LLRender::BT_ALPHA); // we have valid texture data now - mInitialized = TRUE; + mTexture->setInitialized(true); mNeedsUpdate = FALSE; return success; } +bool LLTexLayerSetBuffer::isInitialized(void) const +{ + return mTexture->isInitialized(); +} + BOOL LLTexLayerSetBuffer::updateImmediate() { mNeedsUpdate = TRUE; @@ -551,24 +552,12 @@ void LLTexLayerSetBuffer::onTextureUploadComplete(const LLUUID& uuid, void* user delete baked_upload_data; } - -void LLTexLayerSetBuffer::bindTexture() -{ - if( mInitialized ) - { - LLDynamicTexture::bindTexture(); - } - else - { - gImageList.getImage(IMG_DEFAULT)->bind(); - } -} - void LLTexLayerSetBuffer::bindBumpTexture( U32 stage ) { if( mBumpTexName ) { - LLImageGL::bindExternalTexture(mBumpTexName, stage, GL_TEXTURE_2D); + gGL.getTexUnit(stage)->bindManual(LLTexUnit::TT_TEXTURE, mBumpTexName); + gGL.getTexUnit(0)->activate(); if( mLastBindTime != LLImageGL::sLastFrameTime ) { @@ -578,7 +567,8 @@ void LLTexLayerSetBuffer::bindBumpTexture( U32 stage ) } else { - LLImageGL::unbindTexture(stage, GL_TEXTURE_2D); + gGL.getTexUnit(stage)->unbind(LLTexUnit::TT_TEXTURE); + gGL.getTexUnit(0)->activate(); } } @@ -786,7 +776,7 @@ BOOL LLTexLayerSet::render( S32 x, S32 y, S32 width, S32 height ) if( image_gl ) { LLGLSUIDefault gls_ui; - image_gl->bind(); + gGL.getTexUnit(0)->bind(image_gl); gl_rect_2d_simple_tex( width, height ); } else @@ -794,7 +784,7 @@ BOOL LLTexLayerSet::render( S32 x, S32 y, S32 width, S32 height ) success = FALSE; } } - LLImageGL::unbindTexture(0, GL_TEXTURE_2D); + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); gGL.flush(); gGL.setColorMask(true, true); @@ -804,7 +794,8 @@ BOOL LLTexLayerSet::render( S32 x, S32 y, S32 width, S32 height ) if( getInfo()->mClearAlpha ) { // Set the alpha channel to one (clean up after previous blending) - LLGLSNoTextureNoAlphaTest gls_no_alpha; + LLGLDisable no_alpha(GL_ALPHA_TEST); + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); gGL.color4f( 0.f, 0.f, 0.f, 1.f ); gGL.flush(); gGL.setColorMask(false, true); @@ -838,7 +829,8 @@ BOOL LLTexLayerSet::renderBump( S32 x, S32 y, S32 width, S32 height ) } // Set the alpha channel to one (clean up after previous blending) - LLGLSNoTextureNoAlphaTest gls_no_texture_no_alpha; + LLGLDisable no_alpha(GL_ALPHA_TEST); + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); gGL.color4f( 0.f, 0.f, 0.f, 1.f ); gGL.setColorMask(false, true); @@ -1358,13 +1350,13 @@ BOOL LLTexLayer::render( S32 x, S32 y, S32 width, S32 height ) BOOL old_clamps = image_gl->getClampS(); BOOL old_clampt = image_gl->getClampT(); - image_gl->bind(); + gGL.getTexUnit(0)->bind(image_gl); image_gl->setClamp(TRUE, TRUE); gl_rect_2d_simple_tex( width, height ); image_gl->setClamp(old_clamps, old_clampt); - image_gl->unbindTexture(0, GL_TEXTURE_2D); + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); } } else @@ -1380,9 +1372,9 @@ BOOL LLTexLayer::render( S32 x, S32 y, S32 width, S32 height ) LLImageGL* image_gl = gTexStaticImageList.getImageGL( getInfo()->mStaticImageFileName, getInfo()->mStaticImageIsMask ); if( image_gl ) { - image_gl->bind(); + gGL.getTexUnit(0)->bind(image_gl); gl_rect_2d_simple_tex( width, height ); - image_gl->unbindTexture(0, GL_TEXTURE_2D); + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); } else { @@ -1396,7 +1388,8 @@ BOOL LLTexLayer::render( S32 x, S32 y, S32 width, S32 height ) getInfo()->mStaticImageFileName.empty() && color_specified ) { - LLGLSNoTextureNoAlphaTest gls; + LLGLDisable no_alpha(GL_ALPHA_TEST); + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); gGL.color4fv( net_color.mV); gl_rect_2d_simple( width, height ); } @@ -1518,7 +1511,8 @@ BOOL LLTexLayer::renderAlphaMasks( S32 x, S32 y, S32 width, S32 height, LLColor4 // Note: if the first param is a mulitply, multiply against the current buffer's alpha if( !first_param || !first_param->getMultiplyBlend() ) { - LLGLSNoTextureNoAlphaTest gls_no_texture_no_alpha_test; + LLGLDisable no_alpha(GL_ALPHA_TEST); + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); // Clear the alpha gGL.flush(); @@ -1555,13 +1549,13 @@ BOOL LLTexLayer::renderAlphaMasks( S32 x, S32 y, S32 width, S32 height, LLColor4 BOOL old_clamps = image_gl->getClampS(); BOOL old_clampt = image_gl->getClampT(); - image_gl->bind(); + gGL.getTexUnit(0)->bind(image_gl); image_gl->setClamp(TRUE, TRUE); gl_rect_2d_simple_tex( width, height ); image_gl->setClamp(old_clamps, old_clampt); - image_gl->unbindTexture(0, GL_TEXTURE_2D); + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); } } else @@ -1581,9 +1575,9 @@ BOOL LLTexLayer::renderAlphaMasks( S32 x, S32 y, S32 width, S32 height, LLColor4 ( (image_gl->getComponents() == 1) && getInfo()->mStaticImageIsMask ) ) { LLGLSNoAlphaTest gls_no_alpha_test; - image_gl->bind(); + gGL.getTexUnit(0)->bind(image_gl); gl_rect_2d_simple_tex( width, height ); - image_gl->unbindTexture(0, GL_TEXTURE_2D); + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); } } else @@ -1597,7 +1591,8 @@ BOOL LLTexLayer::renderAlphaMasks( S32 x, S32 y, S32 width, S32 height, LLColor4 // Note: we're still using gGL.blendFunc( GL_DST_ALPHA, GL_ZERO ); if( colorp->mV[VW] != 1.f ) { - LLGLSNoTextureNoAlphaTest gls_no_texture_no_alpha_test; + LLGLDisable no_alpha(GL_ALPHA_TEST); + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); gGL.color4fv( colorp->mV ); gl_rect_2d_simple( width, height ); } @@ -1700,7 +1695,7 @@ BOOL LLTexLayer::renderImageRaw( U8* in_data, S32 in_width, S32 in_height, S32 i glGenTextures(1, &name ); stop_glerror(); - LLImageGL::bindExternalTexture( name, 0, GL_TEXTURE_2D ); + gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, name); stop_glerror(); glTexImage2D( @@ -1712,12 +1707,11 @@ BOOL LLTexLayer::renderImageRaw( U8* in_data, S32 in_width, S32 in_height, S32 i glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_CLAMP); gl_rect_2d_simple_tex( width, height ); - LLImageGL::unbindTexture(0, GL_TEXTURE_2D); + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); glDeleteTextures(1, &name ); stop_glerror(); @@ -1736,7 +1730,7 @@ BOOL LLTexLayer::renderImageRaw( U8* in_data, S32 in_width, S32 in_height, S32 i gl_rect_2d_simple_tex( width, height ); - LLImageGL::unbindTexture(0, GL_TEXTURE_2D); + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); } return TRUE; @@ -1800,8 +1794,6 @@ BOOL LLTexLayerParamAlphaInfo::parseXml(LLXmlTreeNode* node) static LLStdStringHandle domain_string = LLXmlTree::addAttributeString("domain"); param_alpha_node->getFastAttributeF32( domain_string, mDomain ); - gGradientPaletteList.initPalette(mDomain); - return TRUE; } @@ -1996,7 +1988,7 @@ BOOL LLTexLayerParamAlpha::render( S32 x, S32 y, S32 width, S32 height ) if( !mCachedProcessedImageGL || (mCachedProcessedImageGL->getWidth() != image_tga_width) || (mCachedProcessedImageGL->getHeight() != image_tga_height) || - (weight_changed && !(gGLManager.mHasPalettedTextures && gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_PALETTE))) ) + (weight_changed )) { // llinfos << "Building Cached Alpha: " << mName << ": (" << mStaticImageRaw->getWidth() << ", " << mStaticImageRaw->getHeight() << ") " << effective_weight << llendl; mCachedEffectiveWeight = effective_weight; @@ -2008,71 +2000,34 @@ BOOL LLTexLayerParamAlpha::render( S32 x, S32 y, S32 width, S32 height ) // We now have something in one of our caches LLTexLayerSet::sHasCaches |= mCachedProcessedImageGL ? TRUE : FALSE; - if (gGLManager.mHasPalettedTextures && gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_PALETTE)) - { - // interpret luminance values as color index table - mCachedProcessedImageGL->setExplicitFormat( GL_COLOR_INDEX8_EXT, GL_COLOR_INDEX ); - } - else - { - mCachedProcessedImageGL->setExplicitFormat( GL_ALPHA8, GL_ALPHA ); - } + + mCachedProcessedImageGL->setExplicitFormat( GL_ALPHA8, GL_ALPHA ); } // Applies domain and effective weight to data as it is decoded. Also resizes the raw image if needed. - if (gGLManager.mHasPalettedTextures && gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_PALETTE)) - { - mStaticImageRaw = NULL; - mStaticImageRaw = new LLImageRaw; - mStaticImageTGA->decode(mStaticImageRaw); - mNeedsCreateTexture = TRUE; - } - else - { - mStaticImageRaw = NULL; - mStaticImageRaw = new LLImageRaw; - mStaticImageTGA->decodeAndProcess( mStaticImageRaw, getInfo()->mDomain, effective_weight ); - mNeedsCreateTexture = TRUE; - } + mStaticImageRaw = NULL; + mStaticImageRaw = new LLImageRaw; + mStaticImageTGA->decodeAndProcess( mStaticImageRaw, getInfo()->mDomain, effective_weight ); + mNeedsCreateTexture = TRUE; } if( mCachedProcessedImageGL ) { { - if (gGLManager.mHasPalettedTextures && gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_PALETTE)) - { - if( mNeedsCreateTexture ) - { - mCachedProcessedImageGL->createGLTexture(0, mStaticImageRaw); - mNeedsCreateTexture = FALSE; - - mCachedProcessedImageGL->bind(); - mCachedProcessedImageGL->setClamp(TRUE, TRUE); - } - - LLGLSNoAlphaTest gls_no_alpha_test; - mCachedProcessedImageGL->bind(); - gGradientPaletteList.setHardwarePalette( getInfo()->mDomain, effective_weight ); - gl_rect_2d_simple_tex( width, height ); - mCachedProcessedImageGL->unbindTexture(0, GL_TEXTURE_2D); - } - else + // Create the GL texture, and then hang onto it for future use. + if( mNeedsCreateTexture ) { - // Create the GL texture, and then hang onto it for future use. - if( mNeedsCreateTexture ) - { - mCachedProcessedImageGL->createGLTexture(0, mStaticImageRaw); - mNeedsCreateTexture = FALSE; - - mCachedProcessedImageGL->bind(); - mCachedProcessedImageGL->setClamp(TRUE, TRUE); - } - - LLGLSNoAlphaTest gls_no_alpha_test; - mCachedProcessedImageGL->bind(); - gl_rect_2d_simple_tex( width, height ); - mCachedProcessedImageGL->unbindTexture(0, GL_TEXTURE_2D); + mCachedProcessedImageGL->createGLTexture(0, mStaticImageRaw); + mNeedsCreateTexture = FALSE; + + gGL.getTexUnit(0)->bind(mCachedProcessedImageGL); + mCachedProcessedImageGL->setClamp(TRUE, TRUE); } + + LLGLSNoAlphaTest gls_no_alpha_test; + gGL.getTexUnit(0)->bind(mCachedProcessedImageGL); + gl_rect_2d_simple_tex( width, height ); + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); stop_glerror(); } } @@ -2086,7 +2041,8 @@ BOOL LLTexLayerParamAlpha::render( S32 x, S32 y, S32 width, S32 height ) } else { - LLGLSNoTextureNoAlphaTest gls_no_texture_no_alpha_test; + LLGLDisable no_alpha(GL_ALPHA_TEST); + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); gGL.color4f( 0.f, 0.f, 0.f, effective_weight ); gl_rect_2d_simple( width, height ); } @@ -2519,7 +2475,7 @@ LLImageGL* LLTexStaticImageList::getImageGL(const std::string& file_name, BOOL i } image_gl->createGLTexture(0, image_raw); - image_gl->bind(); + gGL.getTexUnit(0)->bind(image_gl); image_gl->setClamp(TRUE, TRUE); mStaticImageListGL [ namekey ] = image_gl; @@ -2559,68 +2515,3 @@ LLMaskedMorph::LLMaskedMorph( LLPolyMorphTarget *morph_target, BOOL invert ) : m morph_target->addPendingMorphMask(); } - -//----------------------------------------------------------------------------- -// LLGradientPaletteList -//----------------------------------------------------------------------------- - -LLGradientPaletteList::~LLGradientPaletteList() -{ - // Note: can't just call deleteAllData() because the data values are arrays. - for( palette_map_t::iterator iter = mPaletteMap.begin(); - iter != mPaletteMap.end(); iter++ ) - { - U8* data = iter->second; - delete []data; - } -} - -void LLGradientPaletteList::initPalette(F32 domain) -{ - palette_map_t::iterator iter = mPaletteMap.find( domain ); - if( iter == mPaletteMap.end() ) - { - U8 *palette = new U8[512 * 4]; - mPaletteMap[domain] = palette; - S32 ramp_start = 255 - llfloor(domain * 255.f); - S32 ramp_end = 255; - F32 ramp_factor = (ramp_end == ramp_start) ? 0.f : (255.f / ((F32)ramp_end - (F32)ramp_start)); - - // *TODO: move conditionals outside of loop, since this really - // is just a sequential process. - for (S32 i = 0; i < 512; i++) - { - palette[(i * 4) + 1] = 0; - palette[(i * 4) + 2] = 0; - if (i <= ramp_start) - { - palette[(i * 4)] = 0; - palette[(i * 4) + 3] = 0; - } - else if (i < ramp_end) - { - palette[(i * 4)] = llfloor(((F32)i - (F32)ramp_start) * ramp_factor); - palette[(i * 4) + 3] = llfloor(((F32)i - (F32)ramp_start) * ramp_factor); - } - else - { - palette[(i * 4)] = 255; - palette[(i * 4) + 3] = 255; - } - } - } -} - -void LLGradientPaletteList::setHardwarePalette( F32 domain, F32 effective_weight ) -{ - palette_map_t::iterator iter = mPaletteMap.find( domain ); - if( iter != mPaletteMap.end() ) - { - U8* palette = iter->second; - set_palette( palette + llfloor(effective_weight * (255.f * (1.f - domain))) * 4); - } - else - { - llwarns << "LLGradientPaletteList::setHardwarePalette() missing domain " << domain << llendl; - } -} diff --git a/linden/indra/newview/lltexlayer.h b/linden/indra/newview/lltexlayer.h index 742b484..bd59c66 100644 --- a/linden/indra/newview/lltexlayer.h +++ b/linden/indra/newview/lltexlayer.h @@ -211,9 +211,8 @@ public: virtual void postRender(BOOL success); virtual BOOL render(); BOOL updateImmediate(); - virtual void bindTexture(); void bindBumpTexture( U32 stage ); - BOOL isInitialized() { return mInitialized; } // Initialized here means that we've done at least one render + bool isInitialized(void) const; BOOL needsRender(); void requestUpdate(); void requestUpload(); @@ -236,7 +235,6 @@ private: BOOL mUploadPending; LLUUID mUploadID; // Identifys the current upload process (null if none). Used to avoid overlaps (eg, when the user rapidly makes two changes outside of Face Edit) LLTexLayerSet* mTexLayerSet; - BOOL mInitialized; LLGLuint mBumpTexName; // zero if none static S32 sGLByteCount; @@ -529,41 +527,6 @@ public: }; -//----------------------------------------------------------------------------- -// LLGradientPaletteList -// A static set of ramp grayscale palettes. The "effective_weight" is used -// to determine the x position of the ramp (offset) -// -// "Domain" isn't really the right word. It refers to the width of the -// ramp portion of the function that relates input and output pixel values. -// A domain of 0 gives a step function. -// -// | /---------------- -// O| / | -// u| / | -// t| / | -// p|------------------/ | -// u| | | -// t|<---------------->|<-->| -// | "offset" "domain" -// | -// --+---Input-------------------------------- -// | -//----------------------------------------------------------------------------- -class LLGradientPaletteList -{ -public: - LLGradientPaletteList() {} - ~LLGradientPaletteList(); - - void initPalette(F32 domain); - void setHardwarePalette(F32 domain, F32 effective_weight); - -private: - typedef std::map palette_map_t; - palette_map_t mPaletteMap; -}; - // Used by LLTexLayerSetBuffer for a callback. class LLBakedUploadData { diff --git a/linden/indra/newview/lltexturectrl.cpp b/linden/indra/newview/lltexturectrl.cpp index 382a4f3..38ca3b7 100644 --- a/linden/indra/newview/lltexturectrl.cpp +++ b/linden/indra/newview/lltexturectrl.cpp @@ -483,9 +483,9 @@ void LLFloaterTexturePicker::draw() LLRect local_rect = getLocalRect(); if (gFocusMgr.childHasKeyboardFocus(this) && mOwner->isInVisibleChain() && mContextConeOpacity > 0.001f) { - LLGLSNoTexture no_texture; + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); LLGLEnable(GL_CULL_FACE); - gGL.begin(LLVertexBuffer::QUADS); + gGL.begin(LLRender::QUADS); { gGL.color4f(0.f, 0.f, 0.f, CONTEXT_CONE_IN_ALPHA * mContextConeOpacity); gGL.vertex2i(owner_rect.mLeft, owner_rect.mTop); diff --git a/linden/indra/newview/lltextureview.cpp b/linden/indra/newview/lltextureview.cpp index 49bc968..c5da2cf 100644 --- a/linden/indra/newview/lltextureview.cpp +++ b/linden/indra/newview/lltextureview.cpp @@ -247,7 +247,7 @@ void LLTextureBar::draw() LLFontGL::sMonospace->renderUTF8(fetch_state_desc[state].desc, 0, title_x2, getRect().getHeight(), fetch_state_desc[state].color, LLFontGL::LEFT, LLFontGL::TOP); - LLGLSNoTexture gls_no_texture; + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); // Draw the progress bar. S32 bar_width = 100; @@ -383,9 +383,9 @@ private: void LLGLTexMemBar::draw() { - S32 bound_mem = LLViewerImage::sBoundTextureMemory; + S32 bound_mem = (LLViewerImage::sBoundTextureMemory >> 20); S32 max_bound_mem = LLViewerImage::sMaxBoundTextureMem; - S32 total_mem = LLViewerImage::sTotalTextureMemory; + S32 total_mem = (LLViewerImage::sTotalTextureMemory >> 20); S32 max_total_mem = LLViewerImage::sMaxTotalTextureMem; F32 discard_bias = LLViewerImage::sDesiredDiscardBias; S32 line_height = (S32)(LLFontGL::sMonospace->getLineHeight() + .5f); @@ -396,10 +396,10 @@ void LLGLTexMemBar::draw() std::string text; text = llformat("GL Tot: %d/%d MB Bound: %d/%d MB Discard Bias: %.2f", - total_mem/(1024*1024), - max_total_mem/(1024*1024), - bound_mem/(1024*1024), - max_bound_mem/(1024*1024), + total_mem, + max_total_mem, + bound_mem, + max_bound_mem, discard_bias); LLFontGL::sMonospace->renderUTF8(text, 0, 0, line_height*3, @@ -415,7 +415,7 @@ void LLGLTexMemBar::draw() F32 bar_scale = (F32)bar_width / (max_bound_mem * 1.5f); - LLGLSNoTexture gls_no_texture; + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); gGL.color4f(0.5f, 0.5f, 0.5f, 0.75f); gl_rect_2d(left, top, right, bottom); diff --git a/linden/indra/newview/lltool.cpp b/linden/indra/newview/lltool.cpp index cb0d3b1..b807276 100644 --- a/linden/indra/newview/lltool.cpp +++ b/linden/indra/newview/lltool.cpp @@ -42,6 +42,7 @@ #include "lltoolfocus.h" #include "llfocusmgr.h" #include "llagent.h" +#include "llviewerjoystick.h" extern BOOL gDebugClicks; @@ -160,6 +161,11 @@ BOOL LLTool::handleKey(KEY key, MASK mask) LLTool* LLTool::getOverrideTool(MASK mask) { + // NOTE: if in flycam mode, ALT-ZOOM camera should be disabled + if (LLViewerJoystick::getInstance()->getOverrideCamera()) + { + return NULL; + } if (mask & MASK_ALT) { return LLToolCamera::getInstance(); diff --git a/linden/indra/newview/lltoolbrush.cpp b/linden/indra/newview/lltoolbrush.cpp index 0869cf3..6391789 100644 --- a/linden/indra/newview/lltoolbrush.cpp +++ b/linden/indra/newview/lltoolbrush.cpp @@ -491,7 +491,7 @@ void LLToolBrushLand::renderOverlay(LLSurface& land, const LLVector3& pos_region const LLVector3& pos_world) { glMatrixMode(GL_MODELVIEW); - LLGLSNoTexture gls_no_texture; + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); LLGLDepthTest mDepthTest(GL_TRUE); glPushMatrix(); gGL.color4fv(OVERLAY_COLOR.mV); @@ -503,7 +503,7 @@ void LLToolBrushLand::renderOverlay(LLSurface& land, const LLVector3& pos_region S32 radioAction = gSavedSettings.getS32("RadioLandBrushAction"); F32 force = gSavedSettings.getF32("LandBrushForce"); // .1 to 100? - gGL.begin(LLVertexBuffer::LINES); + gGL.begin(LLRender::LINES); for(S32 di = -half_edge; di <= half_edge; di++) { if((i+di) < 0 || (i+di) >= (S32)land.mGridsPerEdge) continue; diff --git a/linden/indra/newview/lltoolmorph.cpp b/linden/indra/newview/lltoolmorph.cpp index 2fbf4ae..9666e66 100644 --- a/linden/indra/newview/lltoolmorph.cpp +++ b/linden/indra/newview/lltoolmorph.cpp @@ -240,6 +240,7 @@ BOOL LLVisualParamHint::render() } avatarp->setVisualParamWeight(mVisualParam, mLastParamWeight); gGL.color4f(1,1,1,1); + mTexture->setInitialized(true); return TRUE; } @@ -251,12 +252,12 @@ void LLVisualParamHint::draw() { if (!mIsVisible) return; - bindTexture(); + gGL.getTexUnit(0)->bind(getTexture()); gGL.color4f(1.f, 1.f, 1.f, 1.f); LLGLSUIDefault gls_ui; - gGL.begin(LLVertexBuffer::QUADS); + gGL.begin(LLRender::QUADS); { gGL.texCoord2i(0, 1); gGL.vertex2i(0, mHeight); @@ -269,7 +270,7 @@ void LLVisualParamHint::draw() } gGL.end(); - LLImageGL::unbindTexture(0, GL_TEXTURE_2D); + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); } //----------------------------------------------------------------------------- diff --git a/linden/indra/newview/lltoolplacer.cpp b/linden/indra/newview/lltoolplacer.cpp index 30347be..721e59e 100644 --- a/linden/indra/newview/lltoolplacer.cpp +++ b/linden/indra/newview/lltoolplacer.cpp @@ -224,8 +224,8 @@ BOOL LLToolPlacer::addObject( LLPCode pcode, S32 x, S32 y, U8 use_physics ) // Play creation sound if (gAudiop) { - F32 volume = gSavedSettings.getBOOL("MuteUI") ? 0.f : gSavedSettings.getF32("AudioLevelUI"); - gAudiop->triggerSound( LLUUID(gSavedSettings.getString("UISndObjectCreate")), gAgent.getID(), volume); + gAudiop->triggerSound( LLUUID(gSavedSettings.getString("UISndObjectCreate")), + gAgent.getID(), 1.0f, LLAudioEngine::AUDIO_TYPE_UI); } gMessageSystem->newMessageFast(_PREHASH_ObjectAdd); diff --git a/linden/indra/newview/lltoolselectrect.cpp b/linden/indra/newview/lltoolselectrect.cpp index 26d9756..b7067dc 100644 --- a/linden/indra/newview/lltoolselectrect.cpp +++ b/linden/indra/newview/lltoolselectrect.cpp @@ -175,7 +175,7 @@ void LLToolSelectRect::draw() { gGL.color4f(1.f, 1.f, 0.f, 1.f); } - LLGLSNoTexture gls_no_texture; + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); gl_rect_2d( llmin(mDragStartX, mDragEndX), llmax(mDragStartY, mDragEndY), diff --git a/linden/indra/newview/lltracker.cpp b/linden/indra/newview/lltracker.cpp index 8572283..82e6bf2 100644 --- a/linden/indra/newview/lltracker.cpp +++ b/linden/indra/newview/lltracker.cpp @@ -445,7 +445,7 @@ void draw_shockwave(F32 center_z, F32 t, S32 steps, LLColor4 color) F32 y = 0.f; LLColor4 ccol = LLColor4(1,1,1,(1.f-t)*0.25f); - gGL.begin(LLVertexBuffer::TRIANGLE_FAN); + gGL.begin(LLRender::TRIANGLE_FAN); gGL.color4fv(ccol.mV); gGL.vertex3f(0.f, 0.f, center_z); // make sure circle is complete @@ -494,7 +494,8 @@ void LLTracker::renderBeacon(LLVector3d pos_global, LLVector3 pos_agent = gAgent.getPosAgentFromGlobal(pos_global); - LLGLSTracker gls_tracker; // default - TEXTURE + CULL_FACE + LIGHTING + GL_BLEND + GL_ALPHA_TEST + LLGLSTracker gls_tracker; // default+ CULL_FACE + LIGHTING + GL_BLEND + GL_ALPHA_TEST + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); LLGLDisable cull_face(GL_CULL_FACE); LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE); @@ -535,7 +536,7 @@ void LLTracker::renderBeacon(LLVector3d pos_global, an *= 2.f; an += 1.0f+dr; - gGL.begin(LLVertexBuffer::TRIANGLE_STRIP); + gGL.begin(LLRender::TRIANGLE_STRIP); gGL.color4fv(col_edge.mV); gGL.vertex3f(-x*a, -y*a, z); gGL.color4fv(col_edge_next.mV); diff --git a/linden/indra/newview/lluserauth.cpp b/linden/indra/newview/lluserauth.cpp index a9b00e1..bb6ee16 100644 --- a/linden/indra/newview/lluserauth.cpp +++ b/linden/indra/newview/lluserauth.cpp @@ -324,17 +324,29 @@ static void parseOptionInto( while(opt) { key.assign(XMLRPC_GetValueID(opt)); - //llinfos "option key: " << key << llendl; + //llinfos << "option key: " << key << llendl; type = XMLRPC_GetValueTypeEasy(opt); if(xmlrpc_type_string == type) { val.assign(XMLRPC_GetValueString(opt)); + //llinfos << "string val: " << val << llendl; } else if(xmlrpc_type_int == type) { val = llformat("%d", XMLRPC_GetValueInt(opt)); + //llinfos << "int val: " << val << llendl; } - //llinfos "option val: " << val << llendl; + else if(xmlrpc_type_double == type) + { + val = llformat("%g", XMLRPC_GetValueDouble(opt)); + //llinfos << "double val: " << val << llendl; + } + else + { // Can't understand the type + val = "???"; + //llinfos << "unknown value type: " << type << llendl; + } + responses.insert(LLUserAuth::response_t::value_type(key, val)); opt = XMLRPC_VectorNext(row); } diff --git a/linden/indra/newview/llvelocitybar.cpp b/linden/indra/newview/llvelocitybar.cpp index e8b9a74..3d5784f 100644 --- a/linden/indra/newview/llvelocitybar.cpp +++ b/linden/indra/newview/llvelocitybar.cpp @@ -63,7 +63,7 @@ void LLVelocityBar::draw() // Set bar color // - LLGLSNoTexture gls_no_texture; + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); // draw background box // gGL.color4f(0.f, 0.f, 0.f, 0.3f); diff --git a/linden/indra/newview/llvieweraudio.cpp b/linden/indra/newview/llvieweraudio.cpp index 122a0bc..23a685a 100644 --- a/linden/indra/newview/llvieweraudio.cpp +++ b/linden/indra/newview/llvieweraudio.cpp @@ -139,6 +139,14 @@ void audio_update_volume(bool force_update) { audio_update_wind(true); } + + // handle secondary gains + gAudiop->setSecondaryGain(LLAudioEngine::AUDIO_TYPE_SFX, + gSavedSettings.getBOOL("MuteSounds") ? 0.f : gSavedSettings.getF32("AudioLevelSFX")); + gAudiop->setSecondaryGain(LLAudioEngine::AUDIO_TYPE_UI, + gSavedSettings.getBOOL("MuteUI") ? 0.f : gSavedSettings.getF32("AudioLevelUI")); + gAudiop->setSecondaryGain(LLAudioEngine::AUDIO_TYPE_AMBIENT, + gSavedSettings.getBOOL("MuteAmbient") ? 0.f : gSavedSettings.getF32("AudioLevelAmbient")); } // Streaming Music diff --git a/linden/indra/newview/llviewerdisplay.cpp b/linden/indra/newview/llviewerdisplay.cpp index 627609b..4db26a0 100644 --- a/linden/indra/newview/llviewerdisplay.cpp +++ b/linden/indra/newview/llviewerdisplay.cpp @@ -248,8 +248,11 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) gViewerWindow->checkSettings(); - LLAppViewer::instance()->pingMainloopTimeout("Display:Pick"); - gViewerWindow->performPick(); + { + LLFastTimer ftm(LLFastTimer::FTM_PICK); + LLAppViewer::instance()->pingMainloopTimeout("Display:Pick"); + gViewerWindow->performPick(); + } LLAppViewer::instance()->pingMainloopTimeout("Display:CheckStates"); @@ -373,6 +376,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) gAgent.setTeleportMessage( LLAgent::sTeleportProgressMessages["arriving"]); gImageList.mForceResetTextureStats = TRUE; + gAgent.resetView(TRUE, TRUE); break; case LLAgent::TELEPORT_ARRIVING: @@ -690,7 +694,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) // glMatrixMode(GL_MODELVIEW); // glPushMatrix(); // { - // LLGLSNoTexture gls_no_texture; + // gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); // glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_TRUE); // glLoadIdentity(); @@ -997,8 +1001,8 @@ void render_ui() void renderCoordinateAxes() { - LLGLSNoTexture gls_no_texture; - gGL.begin(LLVertexBuffer::LINES); + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); + gGL.begin(LLRender::LINES); gGL.color3f(1.0f, 0.0f, 0.0f); // i direction = X-Axis = red gGL.vertex3f(0.0f, 0.0f, 0.0f); gGL.vertex3f(2.0f, 0.0f, 0.0f); @@ -1048,10 +1052,10 @@ void renderCoordinateAxes() void draw_axes() { LLGLSUIDefault gls_ui; - LLGLSNoTexture gls_no_texture; + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); // A vertical white line at origin LLVector3 v = gAgent.getPositionAgent(); - gGL.begin(LLVertexBuffer::LINES); + gGL.begin(LLRender::LINES); gGL.color3f(1.0f, 1.0f, 1.0f); gGL.vertex3f(0.0f, 0.0f, 0.0f); gGL.vertex3f(0.0f, 0.0f, 40.0f); @@ -1194,7 +1198,7 @@ void render_disconnected_background() raw->expandToPowerOfTwo(); gDisconnectedImagep->createGLTexture(0, raw); gStartImageGL = gDisconnectedImagep; - LLImageGL::unbindTexture(0, GL_TEXTURE_2D); + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); } // Make sure the progress view always fills the entire window. @@ -1213,10 +1217,10 @@ void render_disconnected_background() const LLVector2& display_scale = gViewerWindow->getDisplayScale(); glScalef(display_scale.mV[VX], display_scale.mV[VY], 1.f); - LLViewerImage::bindTexture(gDisconnectedImagep); + gGL.getTexUnit(0)->bind(gDisconnectedImagep); gGL.color4f(1.f, 1.f, 1.f, 1.f); gl_rect_2d_simple_tex(width, height); - LLImageGL::unbindTexture(0, GL_TEXTURE_2D); + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); } glPopMatrix(); } diff --git a/linden/indra/newview/llviewerimage.cpp b/linden/indra/newview/llviewerimage.cpp index 0b70f51..6ad6ca2 100644 --- a/linden/indra/newview/llviewerimage.cpp +++ b/linden/indra/newview/llviewerimage.cpp @@ -149,23 +149,13 @@ F32 texmem_middle_bound_scale = 0.925f; //static void LLViewerImage::updateClass(const F32 velocity, const F32 angular_velocity) { - sBoundTextureMemory = LLImageGL::sBoundTextureMemory; - sTotalTextureMemory = LLImageGL::sGlobalTextureMemory; - sMaxBoundTextureMem = gImageList.getMaxResidentTexMem(); - - sMaxTotalTextureMem = sMaxBoundTextureMem * 2; - if (sMaxBoundTextureMem > 64000000) - { - sMaxTotalTextureMem -= sMaxBoundTextureMem/4; - } - - if ((U32)sMaxTotalTextureMem > gSysMemory.getPhysicalMemoryClamped() - (U32)min_non_tex_system_mem) - { - sMaxTotalTextureMem = (S32)gSysMemory.getPhysicalMemoryClamped() - min_non_tex_system_mem; - } - - if (sBoundTextureMemory >= sMaxBoundTextureMem || - sTotalTextureMemory >= sMaxTotalTextureMem) + sBoundTextureMemory = LLImageGL::sBoundTextureMemory;//in bytes + sTotalTextureMemory = LLImageGL::sGlobalTextureMemory;//in bytes + sMaxBoundTextureMem = gImageList.getMaxResidentTexMem();//in MB + sMaxTotalTextureMem = gImageList.getMaxTotalTextureMem() ;//in MB + + if ((sBoundTextureMemory >> 20) >= sMaxBoundTextureMem || + (sTotalTextureMemory >> 20) >= sMaxTotalTextureMem) { // If we are using more texture memory than we should, // scale up the desired discard level @@ -176,8 +166,8 @@ void LLViewerImage::updateClass(const F32 velocity, const F32 angular_velocity) } } else if (sDesiredDiscardBias > 0.0f && - sBoundTextureMemory < sMaxBoundTextureMem*texmem_lower_bound_scale && - sTotalTextureMemory < sMaxTotalTextureMem*texmem_lower_bound_scale) + (sBoundTextureMemory >> 20) < sMaxBoundTextureMem*texmem_lower_bound_scale && + (sTotalTextureMemory >> 20) < sMaxTotalTextureMem*texmem_lower_bound_scale) { // If we are using less texture memory than we should, // scale down the desired discard level @@ -1210,45 +1200,58 @@ void LLViewerImage::setKnownDrawSize(S32 width, S32 height) } // virtual -BOOL LLViewerImage::bind(S32 stage) const +bool LLViewerImage::bindError(S32 stage) const { - if (stage == -1) + if (stage < 0) return false; + + if (gNoRender) { - return TRUE; + return false; } + + bool res = true; - if (gNoRender) + // On failure to bind, what should we set the currently bound texture to? + if (mIsMissingAsset && !sMissingAssetImagep.isNull() && (this != (LLImageGL *)sMissingAssetImagep)) { - return true; + res = gGL.getTexUnit(stage)->bind(sMissingAssetImagep.get()); } - BOOL res = bindTextureInternal(stage); - if (res) + if (!res && !sDefaultImagep.isNull() && (this != (LLImageGL *)sDefaultImagep)) { - //llassert_always(mIsMissingAsset == FALSE); - + // use default if we've got it + res = gGL.getTexUnit(stage)->bind(sDefaultImagep.get()); } - else + if (!res && !sNullImagep.isNull() && (this != (LLImageGL *)sNullImagep)) { - // On failure to bind, what should we set the currently bound texture to? - if (mIsMissingAsset && !sMissingAssetImagep.isNull() && (this != (LLImageGL *)sMissingAssetImagep)) - { - res = sMissingAssetImagep->bind( stage ); - } - if (!res && !sDefaultImagep.isNull() && (this != (LLImageGL *)sDefaultImagep)) - { - // use default if we've got it - res = sDefaultImagep->bind(stage); - } - if (!res && !sNullImagep.isNull() && (this != (LLImageGL *)sNullImagep)) - { - res = sNullImagep->bind(stage); - } - if (!res) - { - llwarns << "LLViewerImage::bindTexture failed." << llendl; - } - stop_glerror(); + res = gGL.getTexUnit(stage)->bind(sNullImagep.get()); + } + if (!res) + { + llwarns << "LLViewerImage::bindError failed." << llendl; } + stop_glerror(); + return res; +} + +bool LLViewerImage::bindDefaultImage(S32 stage) const +{ + if (stage < 0) return false; + + bool res = true; + if (!sDefaultImagep.isNull() && (this != (LLImageGL *)sDefaultImagep)) + { + // use default if we've got it + res = gGL.getTexUnit(stage)->bind(sDefaultImagep.get()); + } + if (!res && !sNullImagep.isNull() && (this != (LLImageGL *)sNullImagep)) + { + res = gGL.getTexUnit(stage)->bind(sNullImagep.get()); + } + if (!res) + { + llwarns << "LLViewerImage::bindError failed." << llendl; + } + stop_glerror(); return res; } diff --git a/linden/indra/newview/llviewerimage.h b/linden/indra/newview/llviewerimage.h index 60d9fb8..523f66a 100644 --- a/linden/indra/newview/llviewerimage.h +++ b/linden/indra/newview/llviewerimage.h @@ -86,17 +86,6 @@ public: static LLViewerImage * getImage(const LLUUID &image_id); // lightweight wrapper for gImageList.getImage() - static BOOL bindTexture(LLImageGL* image, const U32 stage = 0) - { - if (image) - { - return image->bind(stage); - } - else - { - return sDefaultImagep->bind(stage); - } - } struct Compare { @@ -189,7 +178,8 @@ public: /*virtual*/ void dump(); // debug info to llinfos - /*virtual*/ BOOL bind(const S32 stage = 0) const; + /*virtual*/ bool bindError(const S32 stage = 0) const; + /*virtual*/ bool bindDefaultImage(const S32 stage = 0) const; void reinit(BOOL usemipmaps = TRUE); diff --git a/linden/indra/newview/llviewerimagelist.cpp b/linden/indra/newview/llviewerimagelist.cpp index a79a76a..1e58fce 100644 --- a/linden/indra/newview/llviewerimagelist.cpp +++ b/linden/indra/newview/llviewerimagelist.cpp @@ -89,7 +89,8 @@ LLStat LLViewerImageList::sFormattedMemStat(32, TRUE); LLViewerImageList::LLViewerImageList() : mForceResetTextureStats(FALSE), mUpdateStats(FALSE), - mMaxResidentTexMem(0) + mMaxResidentTexMem(0), + mMaxTotalTextureMem(0) { } @@ -97,6 +98,7 @@ void LLViewerImageList::init() { sNumImages = 0; mMaxResidentTexMem = 0; + mMaxTotalTextureMem = 0 ; if (gNoRender) { @@ -918,12 +920,14 @@ LLPointer LLViewerImageList::convertToUploadFile(LLPointer> 20); + //min texture mem sets to 128M if total physical mem is more than 1.5GB + return (system_ram > 1500) ? 128 : MIN_VIDEO_RAM; } //static @@ -956,8 +960,8 @@ S32 LLViewerImageList::getMaxVideoRamSetting(bool get_recommended) max_texmem = llmin(max_texmem, (S32)(system_ram/2)); else max_texmem = llmin(max_texmem, (S32)(system_ram)); - - max_texmem = llclamp(max_texmem, MIN_VIDEO_RAM, MAX_VIDEO_RAM); + + max_texmem = llclamp(max_texmem, getMinVideoRamSetting(), MAX_VIDEO_RAM); return max_texmem; } @@ -994,7 +998,18 @@ void LLViewerImageList::updateMaxResidentTexMem(S32 mem) S32 vb_mem = mem; S32 fb_mem = llmax(VIDEO_CARD_FRAMEBUFFER_MEM, vb_mem/4); - mMaxResidentTexMem = (vb_mem - fb_mem)<<20; + mMaxResidentTexMem = (vb_mem - fb_mem) ; //in MB + + mMaxTotalTextureMem = mMaxResidentTexMem * 2; + if (mMaxResidentTexMem > 640) + { + mMaxTotalTextureMem -= (mMaxResidentTexMem >> 2); + } + + if (mMaxTotalTextureMem > (S32)(gSysMemory.getPhysicalMemoryClamped() >> 20) - 128) + { + mMaxTotalTextureMem = (gSysMemory.getPhysicalMemoryClamped() >> 20) - 128 ; + } llinfos << "Total Video Memory set to: " << vb_mem << " MB" << llendl; llinfos << "Available Texture Memory set to: " << (vb_mem - fb_mem) << " MB" << llendl; diff --git a/linden/indra/newview/llviewerimagelist.h b/linden/indra/newview/llviewerimagelist.h index 8aa9913..1f1a122 100644 --- a/linden/indra/newview/llviewerimagelist.h +++ b/linden/indra/newview/llviewerimagelist.h @@ -129,6 +129,7 @@ public: void setUpdateStats(BOOL b) { mUpdateStats = b; } S32 getMaxResidentTexMem() const { return mMaxResidentTexMem; } + S32 getMaxTotalTextureMem() const { return mMaxTotalTextureMem;} S32 getNumImages() { return mImageList.size(); } void updateMaxResidentTexMem(S32 mem); @@ -170,6 +171,7 @@ private: BOOL mUpdateStats; S32 mMaxResidentTexMem; + S32 mMaxTotalTextureMem; LLFrameTimer mForceDecodeTimer; public: diff --git a/linden/indra/newview/llviewerinventory.cpp b/linden/indra/newview/llviewerinventory.cpp index 6d9d685..0323bb7 100644 --- a/linden/indra/newview/llviewerinventory.cpp +++ b/linden/indra/newview/llviewerinventory.cpp @@ -196,15 +196,34 @@ void LLViewerInventoryItem::fetchFromServer(void) const { if(!mIsComplete) { - LLMessageSystem* msg = gMessageSystem; - msg->newMessage("FetchInventory"); - msg->nextBlock("AgentData"); - msg->addUUID("AgentID", gAgent.getID()); - msg->addUUID("SessionID", gAgent.getSessionID()); - msg->nextBlock("InventoryData"); - msg->addUUID("OwnerID", mPermissions.getOwner()); - msg->addUUID("ItemID", mUUID); - gAgent.sendReliableMessage(); + std::string url; + + if( ALEXANDRIA_LINDEN_ID.getString() == mPermissions.getOwner().getString()) + url = gAgent.getRegion()->getCapability("FetchLib"); + else + url = gAgent.getRegion()->getCapability("FetchInventory"); + + if (!url.empty()) + { + LLSD body; + body["agent_id"] = gAgent.getID(); + body["items"][0]["owner_id"] = mPermissions.getOwner(); + body["items"][0]["item_id"] = mUUID; + + LLHTTPClient::post(url, body, new LLInventoryModel::fetchInventoryResponder(body)); + } + else + { + LLMessageSystem* msg = gMessageSystem; + msg->newMessage("FetchInventory"); + msg->nextBlock("AgentData"); + msg->addUUID("AgentID", gAgent.getID()); + msg->addUUID("SessionID", gAgent.getSessionID()); + msg->nextBlock("InventoryData"); + msg->addUUID("OwnerID", mPermissions.getOwner()); + msg->addUUID("ItemID", mUUID); + gAgent.sendReliableMessage(); + } } else { @@ -441,7 +460,7 @@ bool LLViewerInventoryCategory::fetchDescendents() // This comes from LLInventoryFilter from llfolderview.h U32 sort_order = gSavedSettings.getU32("InventorySortOrder") & 0x1; - std::string url = gAgent.getRegion()->getCapability("FetchInventoryDescendents"); + std::string url = gAgent.getRegion()->getCapability("WebFetchInventoryDescendents"); if (!url.empty()) //Capability found. Build up LLSD and use it. { @@ -449,7 +468,7 @@ bool LLViewerInventoryCategory::fetchDescendents() } else { //Deprecated, but if we don't have a capability, use the old system. - llinfos << "FetchInventoryDescendents capability not found. Using deprecated UDP message." << llendl; + llinfos << "WebFetchInventoryDescendents capability not found. Using deprecated UDP message." << llendl; LLMessageSystem* msg = gMessageSystem; msg->newMessage("FetchInventoryDescendents"); msg->nextBlock("AgentData"); diff --git a/linden/indra/newview/llviewerjoint.cpp b/linden/indra/newview/llviewerjoint.cpp index 914448e..d0359d6 100644 --- a/linden/indra/newview/llviewerjoint.cpp +++ b/linden/indra/newview/llviewerjoint.cpp @@ -149,7 +149,7 @@ void LLViewerJoint::setValid( BOOL valid, BOOL recursive ) // //---------------------------------------------------------------- // if (mComponents & SC_AXES) // { -// gGL.begin(LLVertexBuffer::LINES); +// gGL.begin(LLRender::LINES); // gGL.color3f( 1.0f, 0.0f, 0.0f ); // gGL.vertex3f( 0.0f, 0.0f, 0.0f ); // gGL.vertex3f( 0.1f, 0.0f, 0.0f ); @@ -171,7 +171,7 @@ void LLViewerJoint::setValid( BOOL valid, BOOL recursive ) // { // gGL.color3f( 1.0f, 1.0f, 0.0f ); -// gGL.begin(LLVertexBuffer::TRIANGLES); +// gGL.begin(LLRender::TRIANGLES); // // joint top half // glNormal3f(nc, nc, nc); @@ -362,7 +362,7 @@ U32 LLViewerJoint::render( F32 pixelArea, BOOL first_pass ) // // render the bone // gGL.color3f( 0.5f, 0.5f, 0.0f ); -// gGL.begin(LLVertexBuffer::TRIANGLES); +// gGL.begin(LLRender::TRIANGLES); // gGL.vertex3f( length, 0.0f, 0.0f); // gGL.vertex3f( 0.0f, boneSize, 0.0f); @@ -524,14 +524,69 @@ LLViewerJointCollisionVolume::LLViewerJointCollisionVolume(const std::string &na void LLViewerJointCollisionVolume::renderCollision() { updateWorldMatrix(); - glMatrixMode(GL_MODELVIEW); - glPushMatrix(); + + gGL.pushMatrix(); glMultMatrixf( &mXform.getWorldMatrix().mMatrix[0][0] ); - glColor3f( 0.f, 0.f, 1.f ); - gSphere.render(); + gGL.color3f( 0.f, 0.f, 1.f ); + + gGL.begin(LLRender::LINES); + + LLVector3 v[] = + { + LLVector3(1,0,0), + LLVector3(-1,0,0), + LLVector3(0,1,0), + LLVector3(0,-1,0), + + LLVector3(0,0,-1), + LLVector3(0,0,1), + }; + + //sides + gGL.vertex3fv(v[0].mV); + gGL.vertex3fv(v[2].mV); + + gGL.vertex3fv(v[0].mV); + gGL.vertex3fv(v[3].mV); + + gGL.vertex3fv(v[1].mV); + gGL.vertex3fv(v[2].mV); + + gGL.vertex3fv(v[1].mV); + gGL.vertex3fv(v[3].mV); + + + //top + gGL.vertex3fv(v[0].mV); + gGL.vertex3fv(v[4].mV); + + gGL.vertex3fv(v[1].mV); + gGL.vertex3fv(v[4].mV); + + gGL.vertex3fv(v[2].mV); + gGL.vertex3fv(v[4].mV); + + gGL.vertex3fv(v[3].mV); + gGL.vertex3fv(v[4].mV); + + + //bottom + gGL.vertex3fv(v[0].mV); + gGL.vertex3fv(v[5].mV); + + gGL.vertex3fv(v[1].mV); + gGL.vertex3fv(v[5].mV); + + gGL.vertex3fv(v[2].mV); + gGL.vertex3fv(v[5].mV); + + gGL.vertex3fv(v[3].mV); + gGL.vertex3fv(v[5].mV); + + gGL.end(); - glPopMatrix(); + gGL.popMatrix(); } LLVector3 LLViewerJointCollisionVolume::getVolumePos(LLVector3 &offset) diff --git a/linden/indra/newview/llviewerjointattachment.cpp b/linden/indra/newview/llviewerjointattachment.cpp index 4b58361..42b8d9a 100644 --- a/linden/indra/newview/llviewerjointattachment.cpp +++ b/linden/indra/newview/llviewerjointattachment.cpp @@ -91,7 +91,7 @@ U32 LLViewerJointAttachment::drawShape( F32 pixelArea, BOOL first_pass ) LLGLDisable cull_face(GL_CULL_FACE); gGL.color4f(1.f, 1.f, 1.f, 1.f); - gGL.begin(LLVertexBuffer::QUADS); + gGL.begin(LLRender::QUADS); { gGL.vertex3f(-0.1f, 0.1f, 0.f); gGL.vertex3f(-0.1f, -0.1f, 0.f); diff --git a/linden/indra/newview/llviewerjointmesh.cpp b/linden/indra/newview/llviewerjointmesh.cpp index b590907..5c2002b 100644 --- a/linden/indra/newview/llviewerjointmesh.cpp +++ b/linden/indra/newview/llviewerjointmesh.cpp @@ -537,7 +537,7 @@ U32 LLViewerJointMesh::drawShape( F32 pixelArea, BOOL first_pass) if (mTestImageName) { - LLImageGL::bindExternalTexture( mTestImageName, 0, GL_TEXTURE_2D ); + gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, mTestImageName); if (mIsTransparent) { @@ -553,12 +553,12 @@ U32 LLViewerJointMesh::drawShape( F32 pixelArea, BOOL first_pass) { if( mLayerSet->hasComposite() ) { - mLayerSet->getComposite()->bindTexture(); + gGL.getTexUnit(0)->bind(mLayerSet->getComposite()->getTexture()); } else { llwarns << "Layerset without composite" << llendl; - gImageList.getImage(IMG_DEFAULT)->bind(); + gGL.getTexUnit(0)->bind(gImageList.getImage(IMG_DEFAULT)); } } else @@ -566,13 +566,13 @@ U32 LLViewerJointMesh::drawShape( F32 pixelArea, BOOL first_pass) { if (!mTexture->getClampS() || !mTexture->getClampT()) { - mTexture->bind(); + gGL.getTexUnit(0)->bind(mTexture.get()); mTexture->overrideClamp (TRUE, TRUE); } } else { - gImageList.getImage(IMG_DEFAULT_AVATAR)->bind(); + gGL.getTexUnit(0)->bind(gImageList.getImage(IMG_DEFAULT_AVATAR)); } if (gRenderForSelect) @@ -584,7 +584,7 @@ U32 LLViewerJointMesh::drawShape( F32 pixelArea, BOOL first_pass) } else { - LLImageGL::unbindTexture(0); + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); } } @@ -605,14 +605,14 @@ U32 LLViewerJointMesh::drawShape( F32 pixelArea, BOOL first_pass) } } - mFace->mVertexBuffer->drawRange(LLVertexBuffer::TRIANGLES, start, end, count, offset); + mFace->mVertexBuffer->drawRange(LLRender::TRIANGLES, start, end, count, offset); } else { glPushMatrix(); LLMatrix4 jointToWorld = getWorldMatrix(); glMultMatrixf((GLfloat*)jointToWorld.mMatrix); - mFace->mVertexBuffer->drawRange(LLVertexBuffer::TRIANGLES, start, end, count, offset); + mFace->mVertexBuffer->drawRange(LLRender::TRIANGLES, start, end, count, offset); glPopMatrix(); } gPipeline.addTrianglesDrawn(count/3); @@ -626,7 +626,7 @@ U32 LLViewerJointMesh::drawShape( F32 pixelArea, BOOL first_pass) if (mTexture.notNull()) { - mTexture->bind(); + gGL.getTexUnit(0)->bind(mTexture.get()); mTexture->restoreClamp(); } diff --git a/linden/indra/newview/llviewermedia.cpp b/linden/indra/newview/llviewermedia.cpp index e99c838..00639cc 100644 --- a/linden/indra/newview/llviewermedia.cpp +++ b/linden/indra/newview/llviewermedia.cpp @@ -552,6 +552,7 @@ void LLViewerMedia::buildMediaManagerData( LLMediaManagerData* init_data ) // static void LLViewerMedia::cleanupClass() { + stop() ; LLMediaManager::cleanupClass(); } diff --git a/linden/indra/newview/llviewermenu.cpp b/linden/indra/newview/llviewermenu.cpp index c2a8055..9782d4b 100644 --- a/linden/indra/newview/llviewermenu.cpp +++ b/linden/indra/newview/llviewermenu.cpp @@ -85,6 +85,7 @@ #include "llfloateranimpreview.h" #include "llfloateravatarinfo.h" #include "llfloateravatartextures.h" +#include "llfloaterbeacons.h" #include "llfloaterbuildoptions.h" #include "llfloaterbump.h" #include "llfloaterbuy.h" @@ -323,13 +324,6 @@ void handle_talk_to(void *userdata); // Debug menu void show_permissions_control(void*); void toggle_build_options(void* user_data); -#if 0 // Unused -void handle_audio_status_1(void*); -void handle_audio_status_2(void*); -void handle_audio_status_3(void*); -void handle_audio_status_4(void*); -#endif -void manage_landmarks(void*); void reload_ui(void*); void handle_agent_stop_moving(void*); void print_packets_lost(void*); @@ -795,12 +789,6 @@ void init_client_menu(LLMenuGL* menu) &menu_check_control, (void*)"QuietSnapshotsToDisk")); - menu->append(new LLMenuItemCheckGL( "Compress Snapshots to Disk", - &menu_toggle_control, - NULL, - &menu_check_control, - (void*)"CompressSnapshotsToDisk")); - menu->append(new LLMenuItemCheckGL("Show Mouselook Crosshairs", &menu_toggle_control, NULL, @@ -948,6 +936,7 @@ void init_client_menu(LLMenuGL* menu) sub->append(new LLMenuItemCallGL("Force LLError And Crash", &force_error_llerror)); sub->append(new LLMenuItemCallGL("Force Bad Memory Access", &force_error_bad_memory_access)); sub->append(new LLMenuItemCallGL("Force Infinite Loop", &force_error_infinite_loop)); + sub->append(new LLMenuItemCallGL("Force Disconnect Viewer", &handle_disconnect_viewer)); // *NOTE:Mani this isn't handled yet... sub->append(new LLMenuItemCallGL("Force Software Exception", &force_error_unhandled_exception)); sub->createJumpKeys(); menu->appendMenu(sub); @@ -1162,10 +1151,6 @@ void init_debug_rendering_menu(LLMenuGL* menu) &LLPipeline::toggleRenderDebugFeature, NULL, &LLPipeline::toggleRenderDebugFeatureControl, (void*)LLPipeline::RENDER_DEBUG_FEATURE_FOG, KEY_F6, MASK_ALT|MASK_CONTROL)); - sub_menu->append(new LLMenuItemCheckGL("Palletized Textures", - &LLPipeline::toggleRenderDebugFeature, NULL, - &LLPipeline::toggleRenderDebugFeatureControl, - (void*)LLPipeline::RENDER_DEBUG_FEATURE_PALETTE, KEY_F7, MASK_ALT|MASK_CONTROL)); sub_menu->append(new LLMenuItemCheckGL("Test FRInfo", &LLPipeline::toggleRenderDebugFeature, NULL, &LLPipeline::toggleRenderDebugFeatureControl, @@ -1216,9 +1201,6 @@ void init_debug_rendering_menu(LLMenuGL* menu) sub_menu->append(new LLMenuItemCheckGL("Face Area (sqrt(A))",&LLPipeline::toggleRenderDebug, NULL, &LLPipeline::toggleRenderDebugControl, (void*)LLPipeline::RENDER_DEBUG_FACE_AREA)); - sub_menu->append(new LLMenuItemCheckGL("Pick Render", &LLPipeline::toggleRenderDebug, NULL, - &LLPipeline::toggleRenderDebugControl, - (void*)LLPipeline::RENDER_DEBUG_PICKING)); sub_menu->append(new LLMenuItemCheckGL("Lights", &LLPipeline::toggleRenderDebug, NULL, &LLPipeline::toggleRenderDebugControl, (void*)LLPipeline::RENDER_DEBUG_LIGHTS)); @@ -1237,9 +1219,7 @@ void init_debug_rendering_menu(LLMenuGL* menu) sub_menu->append(new LLMenuItemCheckGL("Sculpt", &LLPipeline::toggleRenderDebug, NULL, &LLPipeline::toggleRenderDebugControl, (void*)LLPipeline::RENDER_DEBUG_SCULPTED)); - - sub_menu->append(new LLMenuItemToggleGL("Show Select Buffer", &gDebugSelect)); - + sub_menu->append(new LLMenuItemCallGL("Vectorize Perf Test", &run_vectorize_perf_test)); sub_menu = new LLMenuGL("Render Tests"); @@ -1757,6 +1737,24 @@ class LLViewCheckJoystickFlycam : public view_listener_t } }; +class LLViewCommunicate : public view_listener_t +{ + bool handleEvent(LLPointer event, const LLSD& userdata) + { + if (LLFloaterChatterBox::getInstance()->getFloaterCount() == 0) + { + LLFloaterMyFriends::toggleInstance(); + } + else + { + LLFloaterChatterBox::toggleInstance(); + } + + return true; + } +}; + + void handle_toggle_flycam() { LLViewerJoystick::getInstance()->toggleFlycam(); @@ -2225,37 +2223,71 @@ class LLAvatarDebug : public view_listener_t } }; +struct MenuCallbackData +{ + bool ban_enabled; + LLUUID avatar_id; +}; + void callback_eject(S32 option, void* data) { - LLUUID* avatar_id = (LLUUID*) data; + MenuCallbackData *callback_data = (MenuCallbackData*)data; + if (!callback_data) + { + return; + } + if (2 == option) + { + // Cancle button. + return; + } + LLUUID avatar_id = callback_data->avatar_id; + bool ban_enabled = callback_data->ban_enabled; - if (0 == option || 1 == option) + if (0 == option) { + // Eject button LLMessageSystem* msg = gMessageSystem; - LLViewerObject* avatar = gObjectList.findObject(*avatar_id); + LLViewerObject* avatar = gObjectList.findObject(avatar_id); if (avatar) { U32 flags = 0x0; - if (1 == option) - { - // eject and add to ban list - flags |= 0x1; - } + msg->newMessage("EjectUser"); + msg->nextBlock("AgentData"); + msg->addUUID("AgentID", gAgent.getID() ); + msg->addUUID("SessionID", gAgent.getSessionID() ); + msg->nextBlock("Data"); + msg->addUUID("TargetID", avatar_id ); + msg->addU32("Flags", flags ); + msg->sendReliable( avatar->getRegion()->getHost() ); + } + } + else if (ban_enabled) + { + // This is tricky. It is similar to say if it is not an 'Eject' button, + // and it is also not an 'Cancle' button, and ban_enabled==ture, + // it should be the 'Eject and Ban' button. + LLMessageSystem* msg = gMessageSystem; + LLViewerObject* avatar = gObjectList.findObject(avatar_id); + if (avatar) + { + U32 flags = 0x1; msg->newMessage("EjectUser"); msg->nextBlock("AgentData"); msg->addUUID("AgentID", gAgent.getID() ); msg->addUUID("SessionID", gAgent.getSessionID() ); msg->nextBlock("Data"); - msg->addUUID("TargetID", *avatar_id ); + msg->addUUID("TargetID", avatar_id ); msg->addU32("Flags", flags ); msg->sendReliable( avatar->getRegion()->getHost() ); } } - delete avatar_id; - avatar_id = NULL; + + delete callback_data; + callback_data = NULL; } class LLAvatarEject : public view_listener_t @@ -2265,23 +2297,50 @@ class LLAvatarEject : public view_listener_t LLVOAvatar* avatar = find_avatar_from_object( LLSelectMgr::getInstance()->getSelection()->getPrimaryObject() ); if( avatar ) { - LLUUID* avatar_id = new LLUUID( avatar->getID() ); + MenuCallbackData *data = new MenuCallbackData; + (*data).avatar_id = avatar->getID(); std::string fullname = avatar->getFullname(); - if (!fullname.empty()) + const LLVector3d& pos = avatar->getPositionGlobal(); + LLParcel* parcel = LLViewerParcelMgr::getInstance()->selectParcelAt(pos)->getParcel(); + + if (LLViewerParcelMgr::getInstance()->isParcelOwnedByAgent(parcel,GP_LAND_MANAGE_BANNED)) { - LLStringUtil::format_map_t args; - args["[AVATAR_NAME]"] = fullname; - gViewerWindow->alertXml("EjectAvatarFullname", - args, - callback_eject, - (void*)avatar_id); + (*data).ban_enabled = true; + if (!fullname.empty()) + { + LLStringUtil::format_map_t args; + args["[AVATAR_NAME]"] = fullname; + gViewerWindow->alertXml("EjectAvatarFullname", + args, + callback_eject, + (void*)data); + } + else + { + gViewerWindow->alertXml("EjectAvatar", + callback_eject, + (void*)data); + } } else { - gViewerWindow->alertXml("EjectAvatar", - callback_eject, - (void*)avatar_id); + (*data).ban_enabled = false; + if (!fullname.empty()) + { + LLStringUtil::format_map_t args; + args["[AVATAR_NAME]"] = fullname; + gViewerWindow->alertXml("EjectAvatarFullnameNoBan", + args, + callback_eject, + (void*)data); + } + else + { + gViewerWindow->alertXml("EjectAvatarNoBan", + callback_eject, + (void*)data); + } } } return true; @@ -2298,12 +2357,18 @@ class LLAvatarEnableFreezeEject : public view_listener_t if (new_value) { const LLVector3& pos = avatar->getPositionRegion(); + const LLVector3d& pos_global = avatar->getPositionGlobal(); + LLParcel* parcel = LLViewerParcelMgr::getInstance()->selectParcelAt(pos_global)->getParcel(); LLViewerRegion* region = avatar->getRegion(); new_value = (region != NULL); - + if (new_value) { - new_value = (region->isOwnedSelf(pos) || region->isOwnedGroup(pos)); + new_value = region->isOwnedSelf(pos); + if (!new_value || region->isOwnedGroup(pos)) + { + new_value = LLViewerParcelMgr::getInstance()->isParcelOwnedByAgent(parcel,GP_LAND_ADMIN); + } } } @@ -2674,33 +2739,6 @@ void process_grant_godlike_powers(LLMessageSystem* msg, void**) } } -void load_url_local_file(const std::string& file_name) -{ - if( gAgent.cameraMouselook() ) - { - gAgent.changeCameraToDefault(); - } - -#if LL_DARWIN || LL_LINUX || LL_SOLARIS - // MBW -- If the Mac client is in fullscreen mode, it needs to go windowed so the browser will be visible. - if(gViewerWindow->mWindow->getFullscreen()) - { - gViewerWindow->toggleFullscreen(TRUE); - } -#endif - - // JC - system() blocks until IE has launched. - // spawn() runs asynchronously, but opens a command prompt. - // ShellExecute() just opens the damn file with the default - // web browser. - std::string full_path = "file:///"; - full_path.append(gDirUtilp->getAppRODataDir()); - full_path.append(gDirUtilp->getDirDelimiter()); - full_path.append(file_name); - - LLWeb::loadURL(full_path); -} - /* class LLHaveCallingcard : public LLInventoryCollectFunctor { @@ -2908,63 +2946,16 @@ void show_permissions_control(void*) floaterp->mPermissions->addPermissionsData("foo3", LLUUID::null, 0); } -#if 0 // Unused (these just modify AudioInfoPage which is not used anywhere in the code -void handle_audio_status_1(void*) -{ - S32 page = gSavedSettings.getS32("AudioInfoPage"); - if (1 == page) - { - page = 0; - } - else - { - page = 1; - } - gSavedSettings.setS32("AudioInfoPage", page); -} - -void handle_audio_status_2(void*) -{ - S32 page = gSavedSettings.getS32("AudioInfoPage"); - if (2 == page) - { - page = 0; - } - else - { - page = 2; - } - gSavedSettings.setS32("AudioInfoPage", page); -} - -void handle_audio_status_3(void*) -{ - S32 page = gSavedSettings.getS32("AudioInfoPage"); - if (3 == page) - { - page = 0; - } - else - { - page = 3; - } - gSavedSettings.setS32("AudioInfoPage", page); -} -void handle_audio_status_4(void*) +class LLCreateLandmarkCallback : public LLInventoryCallback { - S32 page = gSavedSettings.getS32("AudioInfoPage"); - if (4 == page) - { - page = 0; - } - else +public: + /*virtual*/ void fire(const LLUUID& inv_item) { - page = 4; + llinfos << "Created landmark with inventory id " << inv_item + << llendl; } - gSavedSettings.setS32("AudioInfoPage", page); -} -#endif +}; void reload_ui(void *) { @@ -3197,26 +3188,7 @@ void reset_view_final( BOOL proceed, void* ) return; } - gAgent.changeCameraToDefault(); - - if (LLViewerJoystick::getInstance()->getOverrideCamera()) - { - handle_toggle_flycam(); - } - - // reset avatar mode from eventual residual motion - if (LLToolMgr::getInstance()->inBuildMode()) - { - LLViewerJoystick::getInstance()->moveAvatar(true); - } - - gAgent.resetView(!gFloaterTools->getVisible()); - gFloaterTools->close(); - - gViewerWindow->showCursor(); - - // Switch back to basic toolset - LLToolMgr::getInstance()->setCurrentToolset(gBasicToolset); + gAgent.resetView(TRUE, TRUE); } class LLViewLookAtLastChatter : public view_listener_t @@ -4881,7 +4853,7 @@ class LLWorldCreateLandmark : public view_listener_t LLAssetType::AT_LANDMARK, LLInventoryType::IT_LANDMARK, NOT_WEARABLE, PERM_ALL, - NULL); + new LLCreateLandmarkCallback); return true; } }; @@ -5301,6 +5273,10 @@ class LLShowFloater : public view_listener_t { LLFloaterActiveSpeakers::toggleInstance(LLSD()); } + else if (floater_name == "beacons") + { + LLFloaterBeacons::toggleInstance(LLSD()); + } return true; } }; @@ -5348,6 +5324,10 @@ class LLFloaterVisible : public view_listener_t { new_value = LLFloaterActiveSpeakers::instanceVisible(LLSD()); } + else if (floater_name == "beacons") + { + new_value = LLFloaterBeacons::instanceVisible(LLSD()); + } gMenuHolder->findControl(control_name)->setValue(new_value); return true; } @@ -5384,37 +5364,6 @@ class LLPromptShowURL : public view_listener_t } }; -void callback_show_file(S32 option, void* data) -{ - std::string* filenamep = (std::string*)data; - if (0 == option) - { - load_url_local_file(*filenamep); - } - delete filenamep; -} - -class LLPromptShowFile : public view_listener_t -{ - bool handleEvent(LLPointer event, const LLSD& userdata) - { - std::string param = userdata.asString(); - std::string::size_type offset = param.find(","); - if (offset != param.npos) - { - std::string alert = param.substr(0, offset); - std::string file = param.substr(offset+1); - std::string* file_copy = new std::string(file); - gViewerWindow->alertXml(alert, callback_show_file, file_copy); - } - else - { - llinfos << "PromptShowFile invalid parameters! Expecting \"ALERT,FILE\"." << llendl; - } - return true; - } -}; - class LLShowAgentProfile : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) @@ -6038,10 +5987,10 @@ namespace void queue_actions(LLFloaterScriptQueue* q, const std::string& noscriptmsg, const std::string& nomodmsg) { - // Apply until an object fails QueueObjects func(q); - const bool firstonly = true; - bool fail = LLSelectMgr::getInstance()->getSelection()->applyToObjects(&func, firstonly); + LLSelectMgr *mgr = LLSelectMgr::getInstance(); + LLObjectSelectionHandle selectHandle = mgr->getSelection(); + bool fail = selectHandle->applyToObjects(&func); if(fail) { if ( !func.scripted ) @@ -6066,61 +6015,67 @@ void queue_actions(LLFloaterScriptQueue* q, const std::string& noscriptmsg, cons } } +void handle_compile_queue(std::string to_lang) +{ + LLFloaterCompileQueue* queue; + if (to_lang == "mono") + { + queue = LLFloaterCompileQueue::create(TRUE); + } + else + { + queue = LLFloaterCompileQueue::create(FALSE); + } + queue_actions(queue, "CannotRecompileSelectObjectsNoScripts", "CannotRecompileSelectObjectsNoPermission"); +} + +void handle_reset_selection(void) +{ + LLFloaterResetQueue* queue = LLFloaterResetQueue::create(); + queue_actions(queue, "CannotResetSelectObjectsNoScripts", "CannotResetSelectObjectsNoPermission"); +} + +void handle_set_run_selection(void) +{ + LLFloaterRunQueue* queue = LLFloaterRunQueue::create(); + queue_actions(queue, "CannotSetRunningSelectObjectsNoScripts", "CannotSerRunningSelectObjectsNoPermission"); +} + +void handle_set_not_run_selection(void) +{ + LLFloaterNotRunQueue* queue = LLFloaterNotRunQueue::create(); + queue_actions(queue, "CannotSetRunningNotSelectObjectsNoScripts", "CannotSerRunningNotSelectObjectsNoPermission"); +} + class LLToolsSelectedScriptAction : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { std::string action = userdata.asString(); - LLFloaterScriptQueue* queue = NULL; if (action == "compile mono") { - queue = LLFloaterCompileQueue::create(TRUE); + handle_compile_queue("mono"); } if (action == "compile lsl") { - queue = LLFloaterCompileQueue::create(FALSE); + handle_compile_queue("lsl"); } else if (action == "reset") { - queue = LLFloaterResetQueue::create(); + handle_reset_selection(); } else if (action == "start") { - queue = LLFloaterRunQueue::create(); + handle_set_run_selection(); } else if (action == "stop") { - queue = LLFloaterNotRunQueue::create(); - } - if (!queue) - { - return true; + handle_set_not_run_selection(); } - - queue_actions(queue, "CannotRecompileSelectObjectsNoScripts", "CannotRecompileSelectObjectsNoPermission"); - return true; } }; -void handle_reset_selection(void*) -{ - LLFloaterResetQueue* queue = LLFloaterResetQueue::create(); - queue_actions(queue, "CannotResetSelectObjectsNoScripts", "CannotResetSelectObjectsNoPermission"); -} - -void handle_set_run_selection(void*) -{ - LLFloaterRunQueue* queue = LLFloaterRunQueue::create(); - queue_actions(queue, "CannotSetRunningSelectObjectsNoScripts", "CannotSerRunningSelectObjectsNoPermission"); -} - -void handle_set_not_run_selection(void*) -{ - LLFloaterNotRunQueue* queue = LLFloaterNotRunQueue::create(); - queue_actions(queue, "CannotSetRunningNotSelectObjectsNoScripts", "CannotSerRunningNotSelectObjectsNoPermission"); -} - void handle_selected_texture_info(void*) { for (LLObjectSelection::valid_iterator iter = LLSelectMgr::getInstance()->getSelection()->valid_begin(); @@ -7139,148 +7094,6 @@ class LLViewCheckHighlightTransparent : public view_listener_t } }; -class LLViewBeaconWidth : public view_listener_t -{ - bool handleEvent(LLPointer event, const LLSD& userdata) - { - std::string width = userdata.asString(); - if(width == "1") - { - gSavedSettings.setS32("DebugBeaconLineWidth", 1); - } - else if(width == "4") - { - gSavedSettings.setS32("DebugBeaconLineWidth", 4); - } - else if(width == "16") - { - gSavedSettings.setS32("DebugBeaconLineWidth", 16); - } - else if(width == "32") - { - gSavedSettings.setS32("DebugBeaconLineWidth", 32); - } - - return true; - } -}; - - -class LLViewToggleBeacon : public view_listener_t -{ - bool handleEvent(LLPointer event, const LLSD& userdata) - { - std::string beacon = userdata.asString(); - if (beacon == "scriptsbeacon") - { - LLPipeline::toggleRenderScriptedBeacons(NULL); - gSavedSettings.setBOOL( "scriptsbeacon", LLPipeline::getRenderScriptedBeacons(NULL) ); - // toggle the other one off if it's on - if (LLPipeline::getRenderScriptedBeacons(NULL) && LLPipeline::getRenderScriptedTouchBeacons(NULL)) - { - LLPipeline::toggleRenderScriptedTouchBeacons(NULL); - gSavedSettings.setBOOL( "scripttouchbeacon", LLPipeline::getRenderScriptedTouchBeacons(NULL) ); - } - } - else if (beacon == "physicalbeacon") - { - LLPipeline::toggleRenderPhysicalBeacons(NULL); - gSavedSettings.setBOOL( "physicalbeacon", LLPipeline::getRenderPhysicalBeacons(NULL) ); - } - else if (beacon == "soundsbeacon") - { - LLPipeline::toggleRenderSoundBeacons(NULL); - gSavedSettings.setBOOL( "soundsbeacon", LLPipeline::getRenderSoundBeacons(NULL) ); - } - else if (beacon == "particlesbeacon") - { - LLPipeline::toggleRenderParticleBeacons(NULL); - gSavedSettings.setBOOL( "particlesbeacon", LLPipeline::getRenderParticleBeacons(NULL) ); - } - else if (beacon == "scripttouchbeacon") - { - LLPipeline::toggleRenderScriptedTouchBeacons(NULL); - gSavedSettings.setBOOL( "scripttouchbeacon", LLPipeline::getRenderScriptedTouchBeacons(NULL) ); - // toggle the other one off if it's on - if (LLPipeline::getRenderScriptedBeacons(NULL) && LLPipeline::getRenderScriptedTouchBeacons(NULL)) - { - LLPipeline::toggleRenderScriptedBeacons(NULL); - gSavedSettings.setBOOL( "scriptsbeacon", LLPipeline::getRenderScriptedBeacons(NULL) ); - } - } - else if (beacon == "renderbeacons") - { - LLPipeline::toggleRenderBeacons(NULL); - gSavedSettings.setBOOL( "renderbeacons", LLPipeline::getRenderBeacons(NULL) ); - // toggle the other one on if it's not - if (!LLPipeline::getRenderBeacons(NULL) && !LLPipeline::getRenderHighlights(NULL)) - { - LLPipeline::toggleRenderHighlights(NULL); - gSavedSettings.setBOOL( "renderhighlights", LLPipeline::getRenderHighlights(NULL) ); - } - } - else if (beacon == "renderhighlights") - { - LLPipeline::toggleRenderHighlights(NULL); - gSavedSettings.setBOOL( "renderhighlights", LLPipeline::getRenderHighlights(NULL) ); - // toggle the other one on if it's not - if (!LLPipeline::getRenderBeacons(NULL) && !LLPipeline::getRenderHighlights(NULL)) - { - LLPipeline::toggleRenderBeacons(NULL); - gSavedSettings.setBOOL( "renderbeacons", LLPipeline::getRenderBeacons(NULL) ); - } - } - - return true; - } -}; - -class LLViewCheckBeaconEnabled : public view_listener_t -{ - bool handleEvent(LLPointer event, const LLSD& userdata) - { - std::string beacon = userdata["data"].asString(); - bool new_value = false; - if (beacon == "scriptsbeacon") - { - new_value = gSavedSettings.getBOOL( "scriptsbeacon"); - LLPipeline::setRenderScriptedBeacons(new_value); - } - else if (beacon == "physicalbeacon") - { - new_value = gSavedSettings.getBOOL( "physicalbeacon"); - LLPipeline::setRenderPhysicalBeacons(new_value); - } - else if (beacon == "soundsbeacon") - { - new_value = gSavedSettings.getBOOL( "soundsbeacon"); - LLPipeline::setRenderSoundBeacons(new_value); - } - else if (beacon == "particlesbeacon") - { - new_value = gSavedSettings.getBOOL( "particlesbeacon"); - LLPipeline::setRenderParticleBeacons(new_value); - } - else if (beacon == "scripttouchbeacon") - { - new_value = gSavedSettings.getBOOL( "scripttouchbeacon"); - LLPipeline::setRenderScriptedTouchBeacons(new_value); - } - else if (beacon == "renderbeacons") - { - new_value = gSavedSettings.getBOOL( "renderbeacons"); - LLPipeline::setRenderBeacons(new_value); - } - else if (beacon == "renderhighlights") - { - new_value = gSavedSettings.getBOOL( "renderhighlights"); - LLPipeline::setRenderHighlights(new_value); - } - gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); - return true; - } -}; - class LLViewToggleRenderType : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) @@ -7622,12 +7435,11 @@ void initialize_menus() addMenu(new LLViewMouselook(), "View.Mouselook"); addMenu(new LLViewBuildMode(), "View.BuildMode"); addMenu(new LLViewJoystickFlycam(), "View.JoystickFlycam"); + addMenu(new LLViewCommunicate(), "View.Communicate"); addMenu(new LLViewResetView(), "View.ResetView"); addMenu(new LLViewLookAtLastChatter(), "View.LookAtLastChatter"); addMenu(new LLViewShowHoverTips(), "View.ShowHoverTips"); addMenu(new LLViewHighlightTransparent(), "View.HighlightTransparent"); - addMenu(new LLViewToggleBeacon(), "View.ToggleBeacon"); - addMenu(new LLViewBeaconWidth(), "View.BeaconWidth"); addMenu(new LLViewToggleRenderType(), "View.ToggleRenderType"); addMenu(new LLViewShowHUDAttachments(), "View.ShowHUDAttachments"); addMenu(new LLViewZoomOut(), "View.ZoomOut"); @@ -7643,7 +7455,6 @@ void initialize_menus() addMenu(new LLViewCheckJoystickFlycam(), "View.CheckJoystickFlycam"); addMenu(new LLViewCheckShowHoverTips(), "View.CheckShowHoverTips"); addMenu(new LLViewCheckHighlightTransparent(), "View.CheckHighlightTransparent"); - addMenu(new LLViewCheckBeaconEnabled(), "View.CheckBeaconEnabled"); addMenu(new LLViewCheckRenderType(), "View.CheckRenderType"); addMenu(new LLViewCheckHUDAttachments(), "View.CheckHUDAttachments"); @@ -7777,7 +7588,6 @@ void initialize_menus() // Generic actions addMenu(new LLShowFloater(), "ShowFloater"); addMenu(new LLPromptShowURL(), "PromptShowURL"); - addMenu(new LLPromptShowFile(), "PromptShowFile"); addMenu(new LLShowAgentProfile(), "ShowAgentProfile"); addMenu(new LLShowAgentGroups(), "ShowAgentGroups"); addMenu(new LLToggleControl(), "ToggleControl"); diff --git a/linden/indra/newview/llviewermenu.h b/linden/indra/newview/llviewermenu.h index e003e90..495e826 100644 --- a/linden/indra/newview/llviewermenu.h +++ b/linden/indra/newview/llviewermenu.h @@ -50,7 +50,6 @@ void cleanup_menus(); void show_debug_menus(); // checks for if menus should be shown first. void show_context_menu( S32 x, S32 y, MASK mask ); void show_build_mode_context_menu(S32 x, S32 y, MASK mask); -void load_url_local_file(const std::string& file_name); BOOL enable_save_into_inventory(void*); void handle_reset_view(); void handle_cut(void*); diff --git a/linden/indra/newview/llviewermenufile.cpp b/linden/indra/newview/llviewermenufile.cpp index 5dd760e..d9d8636 100644 --- a/linden/indra/newview/llviewermenufile.cpp +++ b/linden/indra/newview/llviewermenufile.cpp @@ -503,7 +503,7 @@ void handle_compress_image(void*) } else { - llinfos << "Compression failed: " << LLImageBase::getLastError() << llendl; + llinfos << "Compression failed: " << LLImage::getLastError() << llendl; } infile = picker.getNextFile(); @@ -554,9 +554,9 @@ void upload_new_resource(const std::string& src_filename, std::string name, IMG_CODEC_BMP )) { error_message = llformat( "Problem with file %s:\n\n%s\n", - src_filename.c_str(), LLImageBase::getLastError().c_str()); + src_filename.c_str(), LLImage::getLastError().c_str()); args["[FILE]"] = src_filename; - args["[ERROR]"] = LLImageBase::getLastError(); + args["[ERROR]"] = LLImage::getLastError(); upload_error(error_message, "ProblemWithFile", filename, args); return; } @@ -569,9 +569,9 @@ void upload_new_resource(const std::string& src_filename, std::string name, IMG_CODEC_TGA )) { error_message = llformat("Problem with file %s:\n\n%s\n", - src_filename.c_str(), LLImageBase::getLastError().c_str()); + src_filename.c_str(), LLImage::getLastError().c_str()); args["[FILE]"] = src_filename; - args["[ERROR]"] = LLImageBase::getLastError(); + args["[ERROR]"] = LLImage::getLastError(); upload_error(error_message, "ProblemWithFile", filename, args); return; } @@ -584,9 +584,9 @@ void upload_new_resource(const std::string& src_filename, std::string name, IMG_CODEC_JPEG )) { error_message = llformat("Problem with file %s:\n\n%s\n", - src_filename.c_str(), LLImageBase::getLastError().c_str()); + src_filename.c_str(), LLImage::getLastError().c_str()); args["[FILE]"] = src_filename; - args["[ERROR]"] = LLImageBase::getLastError(); + args["[ERROR]"] = LLImage::getLastError(); upload_error(error_message, "ProblemWithFile", filename, args); return; } @@ -599,9 +599,9 @@ void upload_new_resource(const std::string& src_filename, std::string name, IMG_CODEC_PNG )) { error_message = llformat("Problem with file %s:\n\n%s\n", - src_filename.c_str(), LLImageBase::getLastError().c_str()); + src_filename.c_str(), LLImage::getLastError().c_str()); args["[FILE]"] = src_filename; - args["[ERROR]"] = LLImageBase::getLastError(); + args["[ERROR]"] = LLImage::getLastError(); upload_error(error_message, "ProblemWithFile", filename, args); return; } diff --git a/linden/indra/newview/llviewermessage.cpp b/linden/indra/newview/llviewermessage.cpp index 0e39026..30e5e26 100644 --- a/linden/indra/newview/llviewermessage.cpp +++ b/linden/indra/newview/llviewermessage.cpp @@ -356,7 +356,7 @@ void process_layer_data(LLMessageSystem *mesgsys, void **user_data) // size_t nread = fread(buffer, 1, length, fXML); // if (nread < (size_t) length) // { -// llwarns << "Short read" << llendl; +// LL_WARNS("Messaging") << "Short read" << LL_ENDL; // } // buffer[nread] = '\0'; // fclose(fXML); @@ -3308,8 +3308,7 @@ void process_sound_trigger(LLMessageSystem *msg, void **) return; } - F32 volume = gSavedSettings.getBOOL("MuteSounds") ? 0.f : (gain * gSavedSettings.getF32("AudioLevelSFX")); - gAudiop->triggerSound(sound_id, owner_id, volume, pos_global); + gAudiop->triggerSound(sound_id, owner_id, gain, LLAudioEngine::AUDIO_TYPE_SFX, pos_global); } void process_preload_sound(LLMessageSystem *msg, void **user_data) @@ -3506,6 +3505,15 @@ void process_sim_stats(LLMessageSystem *msg, void **user_data) case LL_SIM_STAT_SIMPHYSICSMEMORY: LLViewerStats::getInstance()->mPhysicsMemoryAllocated.addValue(stat_value); break; + case LL_SIM_STAT_SIMSPARETIME: + LLViewerStats::getInstance()->mSimSpareMsec.addValue(stat_value); + break; + case LL_SIM_STAT_SIMSLEEPTIME: + LLViewerStats::getInstance()->mSimSleepMsec.addValue(stat_value); + break; + case LL_SIM_STAT_IOPUMPTIME: + LLViewerStats::getInstance()->mSimPumpIOMsec.addValue(stat_value); + break; default: // Used to be a commented out warning. LL_DEBUGS("Messaging") << "Unknown stat id" << stat_id << LL_ENDL; @@ -4718,7 +4726,7 @@ void process_teleport_local(LLMessageSystem *msg,void**) gAgent.slamLookAt(look_at); // likewise make sure the camera is behind the avatar - gAgent.resetView(TRUE); + gAgent.resetView(TRUE, TRUE); // send camera update to new region gAgent.updateCamera(); diff --git a/linden/indra/newview/llviewernetwork.cpp b/linden/indra/newview/llviewernetwork.cpp index 13d432a..25bdcb7 100644 --- a/linden/indra/newview/llviewernetwork.cpp +++ b/linden/indra/newview/llviewernetwork.cpp @@ -58,10 +58,22 @@ static LLGridData gGridInfo[GRID_INFO_COUNT] = "util.aruna.lindenlab.com", "https://login.aruna.lindenlab.com/cgi-bin/login.cgi", "http://aruna-secondlife.webdev.lindenlab.com/helpers/" }, + { "Bharati", + "util.bharati.lindenlab.com", + "https://login.bharati.lindenlab.com/cgi-bin/login.cgi", + "http://bharati-secondlife.webdev.lindenlab.com/helpers/" }, + { "Chandra", + "util.chandra.lindenlab.com", + "https://login.chandra.lindenlab.com/cgi-bin/login.cgi", + "http://chandra-secondlife.webdev.lindenlab.com/helpers/" }, { "Damballah", "util.damballah.lindenlab.com", "https://login.damballah.lindenlab.com/cgi-bin/login.cgi", "http://damballah-secondlife.webdev.lindenlab.com/helpers/" }, + { "Danu", + "util.danu.lindenlab.com", + "https://login.danu.lindenlab.com/cgi-bin/login.cgi", + "http://danu-secondlife.webdev.lindenlab.com/helpers/" }, { "Durga", "util.durga.lindenlab.com", "https://login.durga.lindenlab.com/cgi-bin/login.cgi", @@ -82,6 +94,10 @@ static LLGridData gGridInfo[GRID_INFO_COUNT] = "util.nandi.lindenlab.com", "https://login.nandi.lindenlab.com/cgi-bin/login.cgi", "http://nandi-secondlife.webdev.lindenlab.com/helpers/" }, + { "Parvati", + "util.parvati.lindenlab.com", + "https://login.parvati.lindenlab.com/cgi-bin/login.cgi", + "http://parvati-secondlife.webdev.lindenlab.com/helpers/" }, { "Radha", "util.radha.lindenlab.com", "https://login.radha.lindenlab.com/cgi-bin/login.cgi", @@ -98,6 +114,10 @@ static LLGridData gGridInfo[GRID_INFO_COUNT] = "util.shakti.lindenlab.com", "https://login.shakti.lindenlab.com/cgi-bin/login.cgi", "http://shakti-secondlife.webdev.lindenlab.com/helpers/" }, + { "Skanda", + "util.skanda.lindenlab.com", + "https://login.skanda.lindenlab.com/cgi-bin/login.cgi", + "http://skanda-secondlife.webdev.lindenlab.com/helpers/" }, { "Soma", "util.soma.lindenlab.com", "https://login.soma.lindenlab.com/cgi-bin/login.cgi", diff --git a/linden/indra/newview/llviewernetwork.h b/linden/indra/newview/llviewernetwork.h index 53bb0ab..73c3a5d 100644 --- a/linden/indra/newview/llviewernetwork.h +++ b/linden/indra/newview/llviewernetwork.h @@ -41,16 +41,21 @@ enum EGridInfo GRID_INFO_ADITI, GRID_INFO_AGNI, GRID_INFO_ARUNA, + GRID_INFO_BHARATI, + GRID_INFO_CHANDRA, GRID_INFO_DAMBALLAH, + GRID_INFO_DANU, GRID_INFO_DURGA, GRID_INFO_GANGA, GRID_INFO_MITRA, GRID_INFO_MOHINI, GRID_INFO_NANDI, + GRID_INFO_PARVATI, GRID_INFO_RADHA, GRID_INFO_RAVI, GRID_INFO_SIVA, GRID_INFO_SHAKTI, + GRID_INFO_SKANDA, GRID_INFO_SOMA, GRID_INFO_UMA, GRID_INFO_VAAK, diff --git a/linden/indra/newview/llviewerobject.cpp b/linden/indra/newview/llviewerobject.cpp index c560ced..6dc9af1 100644 --- a/linden/indra/newview/llviewerobject.cpp +++ b/linden/indra/newview/llviewerobject.cpp @@ -150,6 +150,8 @@ LLViewerObject *LLViewerObject::createObject(const LLUUID &id, const LLPCode pco res = new LLVOGround(id, pcode, regionp); break; case LL_VO_PART_GROUP: res = new LLVOPartGroup(id, pcode, regionp); break; + case LL_VO_HUD_PART_GROUP: + res = new LLVOHUDPartGroup(id, pcode, regionp); break; case LL_VO_WL_SKY: res = new LLVOWLSky(id, pcode, regionp); break; default: @@ -159,7 +161,7 @@ LLViewerObject *LLViewerObject::createObject(const LLUUID &id, const LLPCode pco return res; } -LLViewerObject::LLViewerObject(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp) +LLViewerObject::LLViewerObject(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp, BOOL is_global) : LLPrimitive(), mChildList(), mID(id), @@ -201,7 +203,10 @@ LLViewerObject::LLViewerObject(const LLUUID &id, const LLPCode pcode, LLViewerRe mMedia(NULL), mClickAction(0) { - llassert(mRegionp); + if(!is_global) + { + llassert(mRegionp); + } LLPrimitive::init_primitive(pcode); @@ -209,7 +214,11 @@ LLViewerObject::LLViewerObject(const LLUUID &id, const LLPCode pcode, LLViewerRe mLastInterpUpdateSecs = LLFrameTimer::getElapsedSeconds(); mPositionRegion = LLVector3(0.f, 0.f, 0.f); - mPositionAgent = mRegionp->getOriginAgent(); + + if(!is_global) + { + mPositionAgent = mRegionp->getOriginAgent(); + } LLViewerObject::sNumObjects++; } @@ -2763,12 +2772,6 @@ void LLViewerObject::setPixelAreaAndAngle(LLAgent &agent) BOOL LLViewerObject::updateLOD() { - // Update volume of looping sounds - if (mAudioSourcep && mAudioSourcep->isLoop()) - { - F32 volume = gSavedSettings.getBOOL("MuteSounds") ? 0.f : (mAudioGain * gSavedSettings.getF32("AudioLevelSFX")); - mAudioSourcep->setGain(volume); - } return FALSE; } @@ -3055,28 +3058,38 @@ LLNameValue *LLViewerObject::getNVPair(const std::string& name) const void LLViewerObject::updatePositionCaches() const { - if (!isRoot()) - { - mPositionRegion = ((LLViewerObject *)getParent())->getPositionRegion() + getPosition() * getParent()->getRotation(); - mPositionAgent = mRegionp->getPosAgentFromRegion(mPositionRegion); - } - else + if(mRegionp) { - mPositionRegion = getPosition(); - mPositionAgent = mRegionp->getPosAgentFromRegion(mPositionRegion); + if (!isRoot()) + { + mPositionRegion = ((LLViewerObject *)getParent())->getPositionRegion() + getPosition() * getParent()->getRotation(); + mPositionAgent = mRegionp->getPosAgentFromRegion(mPositionRegion); + } + else + { + mPositionRegion = getPosition(); + mPositionAgent = mRegionp->getPosAgentFromRegion(mPositionRegion); + } } } const LLVector3d LLViewerObject::getPositionGlobal() const -{ - LLVector3d position_global = mRegionp->getPosGlobalFromRegion(getPositionRegion()); - - if (isAttachment()) +{ + if(mRegionp) { - position_global = gAgent.getPosGlobalFromAgent(getRenderPosition()); - } + LLVector3d position_global = mRegionp->getPosGlobalFromRegion(getPositionRegion()); - return position_global; + if (isAttachment()) + { + position_global = gAgent.getPosGlobalFromAgent(getRenderPosition()); + } + return position_global; + } + else + { + LLVector3d position_global(getPosition()); + return position_global; + } } const LLVector3 &LLViewerObject::getPositionAgent() const @@ -3398,6 +3411,7 @@ LLViewerObject* LLViewerObject::getRootEdit() const BOOL LLViewerObject::lineSegmentIntersect(const LLVector3& start, const LLVector3& end, S32 face, + BOOL pick_transparent, S32* face_hit, LLVector3* intersection, LLVector2* tex_coord, @@ -3407,6 +3421,20 @@ BOOL LLViewerObject::lineSegmentIntersect(const LLVector3& start, const LLVector return false; } +BOOL LLViewerObject::lineSegmentBoundingBox(const LLVector3& start, const LLVector3& end) +{ + if (mDrawable.isNull() || mDrawable->isDead()) + { + return FALSE; + } + + const LLVector3* ext = mDrawable->getSpatialExtents(); + + LLVector3 center = (ext[1]+ext[0])*0.5f; + LLVector3 size = (ext[1]-ext[0])*0.5f; + + return LLLineSegmentBoxIntersect(start, end, center, size); +} U8 LLViewerObject::getMediaType() const { @@ -4331,8 +4359,7 @@ void LLViewerObject::setAttachedSound(const LLUUID &audio_uuid, const LLUUID& ow { BOOL queue = flags & LL_SOUND_FLAG_QUEUE; mAudioGain = gain; - F32 volume = gSavedSettings.getBOOL("MuteSounds") ? 0.f : gain * gSavedSettings.getF32("AudioLevelSFX"); - mAudioSourcep->setGain(volume); + mAudioSourcep->setGain(gain); mAudioSourcep->setLoop(flags & LL_SOUND_FLAG_LOOP); mAudioSourcep->setSyncMaster(flags & LL_SOUND_FLAG_SYNC_MASTER); mAudioSourcep->setSyncSlave(flags & LL_SOUND_FLAG_SYNC_SLAVE); @@ -4370,8 +4397,7 @@ void LLViewerObject::adjustAudioGain(const F32 gain) if (mAudioSourcep) { mAudioGain = gain; - F32 volume = gSavedSettings.getBOOL("MuteSounds") ? 0.f : mAudioGain * gSavedSettings.getF32("AudioLevelSFX"); - mAudioSourcep->setGain(volume); + mAudioSourcep->setGain(mAudioGain); } } diff --git a/linden/indra/newview/llviewerobject.h b/linden/indra/newview/llviewerobject.h index 06d385c..5827dc2 100644 --- a/linden/indra/newview/llviewerobject.h +++ b/linden/indra/newview/llviewerobject.h @@ -132,7 +132,7 @@ public: typedef std::list > child_list_t; typedef const child_list_t const_child_list_t; - LLViewerObject(const LLUUID &id, const LLPCode type, LLViewerRegion *regionp); + LLViewerObject(const LLUUID &id, const LLPCode type, LLViewerRegion *regionp, BOOL is_global = FALSE); MEM_TYPE_NEW(LLMemType::MTYPE_OBJECT); virtual void markDead(); // Mark this object as dead, and clean up its references @@ -248,6 +248,7 @@ public: //returns TRUE if intersection detected and returns information about intersection virtual BOOL lineSegmentIntersect(const LLVector3& start, const LLVector3& end, S32 face = -1, // which face to check, -1 = ALL_SIDES + BOOL pick_transparent = FALSE, S32* face_hit = NULL, // which face was hit LLVector3* intersection = NULL, // return the intersection point LLVector2* tex_coord = NULL, // return the texture coordinates of the intersection point @@ -255,6 +256,8 @@ public: LLVector3* bi_normal = NULL // return the surface bi-normal at the intersection point ); + virtual BOOL lineSegmentBoundingBox(const LLVector3& start, const LLVector3& end); + virtual const LLVector3d getPositionGlobal() const; virtual const LLVector3 &getPositionRegion() const; virtual const LLVector3 getPositionEdit() const; @@ -507,6 +510,7 @@ public: LL_VO_PART_GROUP = LL_PCODE_APP | 0x90, LL_VO_TRIANGLE_TORUS = LL_PCODE_APP | 0xa0, LL_VO_WL_SKY = LL_PCODE_APP | 0xb0, // should this be moved to 0x40? + LL_VO_HUD_PART_GROUP = LL_PCODE_APP | 0xc0, } EVOType; LLUUID mID; @@ -705,8 +709,8 @@ public: class LLStaticViewerObject : public LLViewerObject { public: - LLStaticViewerObject(const LLUUID& id, const LLPCode type, LLViewerRegion* regionp) - : LLViewerObject(id,type,regionp) + LLStaticViewerObject(const LLUUID& id, const LLPCode type, LLViewerRegion* regionp, BOOL is_global = FALSE) + : LLViewerObject(id,type,regionp, is_global) { } virtual void updateDrawable(BOOL force_damped); diff --git a/linden/indra/newview/llviewerobjectlist.cpp b/linden/indra/newview/llviewerobjectlist.cpp index 163b039..f3d7bd9 100644 --- a/linden/indra/newview/llviewerobjectlist.cpp +++ b/linden/indra/newview/llviewerobjectlist.cpp @@ -163,15 +163,20 @@ U64 LLViewerObjectList::getIndex(const U32 local_id, BOOL LLViewerObjectList::removeFromLocalIDTable(const LLViewerObject &object) { - U32 local_id = object.mLocalID; - LLHost region_host = object.getRegion()->getHost(); - U32 ip = region_host.getAddress(); - U32 port = region_host.getPort(); - U64 ipport = (((U64)ip) << 32) | (U64)port; - U32 index = sIPAndPortToIndex[ipport]; + if(object.getRegion()) + { + U32 local_id = object.mLocalID; + LLHost region_host = object.getRegion()->getHost(); + U32 ip = region_host.getAddress(); + U32 port = region_host.getPort(); + U64 ipport = (((U64)ip) << 32) | (U64)port; + U32 index = sIPAndPortToIndex[ipport]; + + U64 indexid = (((U64)index) << 32) | (U64)local_id; + return sIndexAndLocalIDToUUID.erase(indexid) > 0 ? TRUE : FALSE; + } - U64 indexid = (((U64)index) << 32) | (U64)local_id; - return sIndexAndLocalIDToUUID.erase(indexid) > 0 ? TRUE : FALSE; + return FALSE ; } void LLViewerObjectList::setUUIDAndLocal(const LLUUID &id, @@ -822,8 +827,15 @@ void LLViewerObjectList::removeDrawable(LLDrawable* drawablep) for (S32 i = 0; i < drawablep->getNumFaces(); i++) { - LLViewerObject* objectp = drawablep->getFace(i)->getViewerObject(); - mSelectPickList.erase(objectp); + LLFace* facep = drawablep->getFace(i) ; + if(facep) + { + LLViewerObject* objectp = facep->getViewerObject(); + if(objectp) + { + mSelectPickList.erase(objectp); + } + } } } @@ -898,7 +910,7 @@ void LLViewerObjectList::killAllObjects() if (!mMapObjects.empty()) { llwarns << "Some objects still on map object list!" << llendl; - mActiveObjects.clear(); + mMapObjects.clear(); } } diff --git a/linden/indra/newview/llviewerparcelmedia.cpp b/linden/indra/newview/llviewerparcelmedia.cpp index 956ed03..5f29ea6 100644 --- a/linden/indra/newview/llviewerparcelmedia.cpp +++ b/linden/indra/newview/llviewerparcelmedia.cpp @@ -344,7 +344,7 @@ void LLViewerParcelMedia::processParcelMediaUpdate( LLMessageSystem *msg, void * media_url = media_url_buffer; msg->getU8("DataBlock", "MediaAutoScale", media_auto_scale); - if (msg->getNumberOfBlocks("DataBlockExtended")) // do we have the extended data? + if (msg->has("DataBlockExtended")) // do we have the extended data? { char media_type_buffer[257]; msg->getString("DataBlockExtended", "MediaType", 255, media_type_buffer); diff --git a/linden/indra/newview/llviewerparceloverlay.cpp b/linden/indra/newview/llviewerparceloverlay.cpp index b50ddb6..392f8cd 100644 --- a/linden/indra/newview/llviewerparceloverlay.cpp +++ b/linden/indra/newview/llviewerparceloverlay.cpp @@ -72,7 +72,7 @@ LLViewerParcelOverlay::LLViewerParcelOverlay(LLViewerRegion* region, F32 region_ mImageRaw = new LLImageRaw(mParcelGridsPerEdge, mParcelGridsPerEdge, OVERLAY_IMG_COMPONENTS); mTexture->createGLTexture(0, mImageRaw); gGL.getTexUnit(0)->activate(); - mTexture->bind(0); + gGL.getTexUnit(0)->bind(mTexture); mTexture->setClamp(TRUE, TRUE); mTexture->setMipFilterNearest(TRUE); @@ -748,7 +748,7 @@ S32 LLViewerParcelOverlay::renderPropertyLines () LLSurface& land = mRegion->getLand(); LLGLSUIDefault gls_ui; // called from pipeline - LLGLSNoTexture gls_no_texture; + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); LLGLDepthTest mDepthTest(GL_TRUE); // Find camera height off the ground (not from zero) @@ -826,7 +826,7 @@ S32 LLViewerParcelOverlay::renderPropertyLines () continue; } - gGL.begin(LLVertexBuffer::TRIANGLE_STRIP); + gGL.begin(LLRender::TRIANGLE_STRIP); for (j = 0; j < vertex_per_edge; j++) { @@ -848,7 +848,7 @@ S32 LLViewerParcelOverlay::renderPropertyLines () colorp = mColorArray + BYTES_PER_COLOR * i; vertexp = mVertexArray + FLOATS_PER_VERTEX * i; - gGL.begin(LLVertexBuffer::TRIANGLE_STRIP); + gGL.begin(LLRender::TRIANGLE_STRIP); for (j = 0; j < vertex_per_edge; j++) { diff --git a/linden/indra/newview/llviewerpartsim.cpp b/linden/indra/newview/llviewerpartsim.cpp index d27e0df..95fb307 100644 --- a/linden/indra/newview/llviewerpartsim.cpp +++ b/linden/indra/newview/llviewerpartsim.cpp @@ -116,7 +116,8 @@ void LLViewerPart::init(LLPointer sourcep, LLViewerImage *im // -LLViewerPartGroup::LLViewerPartGroup(const LLVector3 ¢er_agent, const F32 box_side) +LLViewerPartGroup::LLViewerPartGroup(const LLVector3 ¢er_agent, const F32 box_side, bool hud) + : mHud(hud) { LLMemType mt(LLMemType::MTYPE_PARTICLES); mVOPartGroupp = NULL; @@ -133,7 +134,14 @@ LLViewerPartGroup::LLViewerPartGroup(const LLVector3 ¢er_agent, const F32 bo mCenterAgent = center_agent; mBoxRadius = F_SQRT3*box_side*0.5f; + if (mHud) + { + mVOPartGroupp = (LLVOPartGroup *)gObjectList.createObjectViewer(LLViewerObject::LL_VO_HUD_PART_GROUP, getRegion()); + } + else + { mVOPartGroupp = (LLVOPartGroup *)gObjectList.createObjectViewer(LLViewerObject::LL_VO_PART_GROUP, getRegion()); + } mVOPartGroupp->setViewerPartGroup(this); mVOPartGroupp->setPositionAgent(getCenterAgent()); F32 scale = box_side * 0.5f; @@ -223,6 +231,12 @@ BOOL LLViewerPartGroup::posInGroup(const LLVector3 &pos, const F32 desired_size) BOOL LLViewerPartGroup::addPart(LLViewerPart* part, F32 desired_size) { LLMemType mt(LLMemType::MTYPE_PARTICLES); + + if (part->mFlags & LLPartData::LL_PART_HUD && !mHud) + { + return FALSE; + } + BOOL uniform_part = part->mScale.mV[0] == part->mScale.mV[1] && !(part->mFlags & LLPartData::LL_PART_FOLLOW_VELOCITY_MASK); @@ -530,7 +544,7 @@ LLViewerPartGroup *LLViewerPartSim::put(LLViewerPart* part) if(!return_group) { llassert_always(part->mPosAgent.isFinite()); - LLViewerPartGroup *groupp = createViewerPartGroup(part->mPosAgent, desired_size); + LLViewerPartGroup *groupp = createViewerPartGroup(part->mPosAgent, desired_size, part->mFlags & LLPartData::LL_PART_HUD); groupp->mUniformParticles = (part->mScale.mV[0] == part->mScale.mV[1] && !(part->mFlags & LLPartData::LL_PART_FOLLOW_VELOCITY_MASK)); if (!groupp->addPart(part)) @@ -555,12 +569,12 @@ LLViewerPartGroup *LLViewerPartSim::put(LLViewerPart* part) return return_group ; } -LLViewerPartGroup *LLViewerPartSim::createViewerPartGroup(const LLVector3 &pos_agent, const F32 desired_size) +LLViewerPartGroup *LLViewerPartSim::createViewerPartGroup(const LLVector3 &pos_agent, const F32 desired_size, bool hud) { LLMemType mt(LLMemType::MTYPE_PARTICLES); //find a box that has a center position divisible by PART_SIM_BOX_SIDE that encompasses //pos_agent - LLViewerPartGroup *groupp = new LLViewerPartGroup(pos_agent, desired_size); + LLViewerPartGroup *groupp = new LLViewerPartGroup(pos_agent, desired_size, hud); mViewerPartGroups.push_back(groupp); return groupp; } diff --git a/linden/indra/newview/llviewerpartsim.h b/linden/indra/newview/llviewerpartsim.h index 0f51240..b6001ee 100644 --- a/linden/indra/newview/llviewerpartsim.h +++ b/linden/indra/newview/llviewerpartsim.h @@ -87,7 +87,8 @@ class LLViewerPartGroup { public: LLViewerPartGroup(const LLVector3 ¢er, - const F32 box_radius); + const F32 box_radius, + bool hud); virtual ~LLViewerPartGroup(); void cleanup(); @@ -115,6 +116,7 @@ public: U32 mID; F32 mSkippedTime; + bool mHud; protected: LLVector3 mCenterAgent; @@ -178,7 +180,7 @@ public: U32 mID; protected: - LLViewerPartGroup *createViewerPartGroup(const LLVector3 &pos_agent, const F32 desired_size); + LLViewerPartGroup *createViewerPartGroup(const LLVector3 &pos_agent, const F32 desired_size, bool hud); LLViewerPartGroup *put(LLViewerPart* part); group_list_t mViewerPartGroups; diff --git a/linden/indra/newview/llviewerpartsource.cpp b/linden/indra/newview/llviewerpartsource.cpp index dcef8c2..13da131 100644 --- a/linden/indra/newview/llviewerpartsource.cpp +++ b/linden/indra/newview/llviewerpartsource.cpp @@ -33,6 +33,7 @@ #include "llviewerpartsource.h" #include "llviewercontrol.h" +#include "llrender.h" #include "llagent.h" #include "lldrawable.h" @@ -69,7 +70,7 @@ void LLViewerPartSource::updatePart(LLViewerPart &part, const F32 dt) { } -void LLViewerPartSource::update(const F32 dt) +void LLViewerPartSource::update(const F32 dt) { llerrs << "Creating default part source!" << llendl; } @@ -99,7 +100,7 @@ LLViewerPartSourceScript::LLViewerPartSourceScript(LLViewerObject *source_objp) mSourceObjectp = source_objp; mPosAgent = mSourceObjectp->getPositionAgent(); mImagep = gImageList.getImageFromFile("pixiesmall.j2c"); - mImagep->bind(); + gGL.getTexUnit(0)->bind(mImagep.get()); mImagep->setClamp(TRUE, TRUE); } @@ -282,6 +283,10 @@ void LLViewerPartSourceScript::update(const F32 dt) part->init(this, mImagep, NULL); part->mFlags = mPartSysData.mPartData.mFlags; + if (!mSourceObjectp.isNull() && mSourceObjectp->isHUDAttachment()) + { + part->mFlags |= LLPartData::LL_PART_HUD; + } part->mMaxAge = mPartSysData.mPartData.mMaxAge; part->mStartColor = mPartSysData.mPartData.mStartColor; part->mEndColor = mPartSysData.mPartData.mEndColor; diff --git a/linden/indra/newview/llviewerregion.cpp b/linden/indra/newview/llviewerregion.cpp index 08dc979..507481a 100644 --- a/linden/indra/newview/llviewerregion.cpp +++ b/linden/indra/newview/llviewerregion.cpp @@ -215,6 +215,7 @@ LLViewerRegion::LLViewerRegion(const U64 &handle, mObjectPartition.push_back(new LLGrassPartition()); //PARTITION_GRASS mObjectPartition.push_back(new LLVolumePartition()); //PARTITION_VOLUME mObjectPartition.push_back(new LLBridgePartition()); //PARTITION_BRIDGE + mObjectPartition.push_back(new LLHUDParticlePartition());//PARTITION_HUD_PARTICLE mObjectPartition.push_back(NULL); //PARTITION_NONE } @@ -1028,12 +1029,18 @@ void LLViewerRegion::updateCoarseLocations(LLMessageSystem* msg) msg->getS16Fast(_PREHASH_Index, _PREHASH_You, agent_index); msg->getS16Fast(_PREHASH_Index, _PREHASH_Prey, target_index); + BOOL has_agent_data = msg->has(_PREHASH_AgentData); S32 count = msg->getNumberOfBlocksFast(_PREHASH_Location); for(S32 i = 0; i < count; i++) { msg->getU8Fast(_PREHASH_Location, _PREHASH_X, x_pos, i); msg->getU8Fast(_PREHASH_Location, _PREHASH_Y, y_pos, i); msg->getU8Fast(_PREHASH_Location, _PREHASH_Z, z_pos, i); + LLUUID agent_id = LLUUID::null; + if(has_agent_data) + { + msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id, i); + } //llinfos << " object X: " << (S32)x_pos << " Y: " << (S32)y_pos // << " Z: " << (S32)(z_pos * 4) @@ -1059,6 +1066,10 @@ void LLViewerRegion::updateCoarseLocations(LLMessageSystem* msg) pos <<= 8; pos |= z_pos; mMapAvatars.put(pos); + if(has_agent_data) + { + mMapAvatarIDs.put(agent_id); + } } } } @@ -1387,8 +1398,12 @@ void LLViewerRegion::setSeedCapability(const std::string& url) capabilityNames.append("DispatchRegionInfo"); capabilityNames.append("EstateChangeInfo"); capabilityNames.append("EventQueueGet"); - capabilityNames.append("FetchInventoryDescendents"); + capabilityNames.append("FetchInventory"); + capabilityNames.append("WebFetchInventoryDescendents"); + capabilityNames.append("FetchLib"); + capabilityNames.append("FetchLibDescendents"); capabilityNames.append("GroupProposalBallot"); + capabilityNames.append("HomeLocation"); capabilityNames.append("MapLayer"); capabilityNames.append("MapLayerGod"); capabilityNames.append("NewFileAgentInventory"); diff --git a/linden/indra/newview/llviewerregion.h b/linden/indra/newview/llviewerregion.h index d65ad23..097bfcc 100644 --- a/linden/indra/newview/llviewerregion.h +++ b/linden/indra/newview/llviewerregion.h @@ -81,6 +81,7 @@ public: PARTITION_GRASS, PARTITION_VOLUME, PARTITION_BRIDGE, + PARTITION_HUD_PARTICLE, PARTITION_NONE, NUM_PARTITIONS } eObjectPartitions; diff --git a/linden/indra/newview/llviewershadermgr.cpp b/linden/indra/newview/llviewershadermgr.cpp index a654120..44f6abe 100644 --- a/linden/indra/newview/llviewershadermgr.cpp +++ b/linden/indra/newview/llviewershadermgr.cpp @@ -108,7 +108,7 @@ GLint gAvatarMatrixParam; LLViewerShaderMgr::LLViewerShaderMgr() : mVertexShaderLevel(SHADER_COUNT, 0) { -/// Make sure WL Sky is the first program + /// Make sure WL Sky is the first program mShaderList.push_back(&gWLSkyProgram); mShaderList.push_back(&gWLCloudProgram); mShaderList.push_back(&gAvatarProgram); @@ -139,28 +139,28 @@ LLViewerShaderMgr * LLViewerShaderMgr::instance() if(NULL == sInstance) { sInstance = new LLViewerShaderMgr(); - } - - return static_cast(sInstance); } + return static_cast(sInstance); +} + void LLViewerShaderMgr::initAttribsAndUniforms(void) - { +{ if (mReservedAttribs.empty()) - { + { mReservedAttribs.push_back("materialColor"); mReservedAttribs.push_back("specularColor"); mReservedAttribs.push_back("binormal"); - + mAvatarAttribs.reserve(5); mAvatarAttribs.push_back("weight"); mAvatarAttribs.push_back("clothing"); mAvatarAttribs.push_back("gWindDir"); mAvatarAttribs.push_back("gSinWaveParams"); mAvatarAttribs.push_back("gGravity"); - + mAvatarUniforms.push_back("matrixPalette"); - + mReservedUniforms.reserve(24); mReservedUniforms.push_back("diffuseMap"); mReservedUniforms.push_back("specularMap"); @@ -186,16 +186,16 @@ void LLViewerShaderMgr::initAttribsAndUniforms(void) mReservedUniforms.push_back("cloud_scale"); mReservedUniforms.push_back("gamma"); mReservedUniforms.push_back("scene_light_strength"); - + mWLUniforms.push_back("camPosLocal"); - + mTerrainUniforms.reserve(5); mTerrainUniforms.push_back("detail_0"); mTerrainUniforms.push_back("detail_1"); mTerrainUniforms.push_back("detail_2"); mTerrainUniforms.push_back("detail_3"); mTerrainUniforms.push_back("alpha_ramp"); - + mGlowUniforms.push_back("glowDelta"); mGlowUniforms.push_back("glowStrength"); @@ -204,7 +204,7 @@ void LLViewerShaderMgr::initAttribsAndUniforms(void) mGlowExtractUniforms.push_back("lumWeights"); mGlowExtractUniforms.push_back("warmthWeights"); mGlowExtractUniforms.push_back("warmthAmount"); - + mShinyUniforms.push_back("origin"); mWaterUniforms.reserve(12); @@ -222,9 +222,9 @@ void LLViewerShaderMgr::initAttribsAndUniforms(void) mWaterUniforms.push_back("kd"); mWaterUniforms.push_back("refScale"); mWaterUniforms.push_back("waterHeight"); - } - } - + } +} + //============================================================================ // Set Levels @@ -1087,12 +1087,12 @@ BOOL LLViewerShaderMgr::loadShadersWindLight() } std::string LLViewerShaderMgr::getShaderDirPrefix(void) - { +{ return gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "shaders/class"); - } +} void LLViewerShaderMgr::updateShaderUniforms(LLGLSLShader * shader) - { +{ LLWLParamManager::instance()->updateShaderUniforms(shader); LLWaterParamManager::instance()->updateShaderUniforms(shader); } diff --git a/linden/indra/newview/llviewerstats.h b/linden/indra/newview/llviewerstats.h index f33ad02..5ae8cdc 100644 --- a/linden/indra/newview/llviewerstats.h +++ b/linden/indra/newview/llviewerstats.h @@ -77,6 +77,9 @@ public: LLStat mSimAgentMsec; LLStat mSimImagesMsec; LLStat mSimScriptMsec; + LLStat mSimSpareMsec; + LLStat mSimSleepMsec; + LLStat mSimPumpIOMsec; LLStat mSimMainAgents; LLStat mSimChildAgents; diff --git a/linden/indra/newview/llviewertexteditor.cpp b/linden/indra/newview/llviewertexteditor.cpp index 8a55b3f..1dda1ca 100644 --- a/linden/indra/newview/llviewertexteditor.cpp +++ b/linden/indra/newview/llviewertexteditor.cpp @@ -1402,8 +1402,7 @@ void LLViewerTextEditor::openEmbeddedSound( LLInventoryItem* item ) const F32 SOUND_GAIN = 1.0f; if(gAudiop) { - F32 volume = gSavedSettings.getBOOL("MuteSounds") ? 0.f : (SOUND_GAIN * gSavedSettings.getF32("AudioLevelSFX")); - gAudiop->triggerSound(item->getAssetUUID(), gAgentID, volume, lpos_global); + gAudiop->triggerSound(item->getAssetUUID(), gAgentID, SOUND_GAIN, LLAudioEngine::AUDIO_TYPE_UI, lpos_global); } showCopyToInvDialog( item ); } diff --git a/linden/indra/newview/llviewerwindow.cpp b/linden/indra/newview/llviewerwindow.cpp index 64c042a..106ad08 100644 --- a/linden/indra/newview/llviewerwindow.cpp +++ b/linden/indra/newview/llviewerwindow.cpp @@ -168,6 +168,7 @@ #include "llviewerobjectlist.h" #include "llviewerparcelmgr.h" #include "llviewerregion.h" +#include "llviewershadermgr.h" #include "llviewerstats.h" #include "llvoavatar.h" #include "llvovolume.h" @@ -182,7 +183,6 @@ #include "llviewernetwork.h" #if LL_WINDOWS -#include "llwindebug.h" #include // For Unicode conversion methods #endif @@ -218,6 +218,7 @@ LLVector3 gDebugRaycastIntersection; LLVector2 gDebugRaycastTexCoord; LLVector3 gDebugRaycastNormal; LLVector3 gDebugRaycastBinormal; +S32 gDebugRaycastFaceHit; // HUD display lines in lower right BOOL gDisplayWindInfo = FALSE; @@ -1102,6 +1103,7 @@ void LLViewerWindow::handleQuit(LLWindow *window) void LLViewerWindow::handleResize(LLWindow *window, S32 width, S32 height) { reshape(width, height); + mResDirty = true; } // The top-level window has gained focus (e.g. via ALT-TAB) @@ -1258,6 +1260,8 @@ BOOL LLViewerWindow::handleActivate(LLWindow *window, BOOL activated) BOOL LLViewerWindow::handleActivateApp(LLWindow *window, BOOL activating) { + //if (!activating) gAgent.changeCameraToDefault(); + LLViewerJoystick::getInstance()->setNeedsReset(true); return FALSE; } @@ -1410,7 +1414,11 @@ LLViewerWindow::LLViewerWindow( mHideCursorPermanent( FALSE ), mCursorHidden(FALSE), mIgnoreActivate( FALSE ), - mHoverPick() + mHoverPick(), + mResDirty(false), + mStatesDirty(false), + mIsFullscreenChecked(false), + mCurrResolutionIndex(0) { // Default to application directory. LLViewerWindow::sSnapshotBaseName = "Snapshot"; @@ -1426,12 +1434,12 @@ LLViewerWindow::LLViewerWindow( !gNoRender, ignore_pixel_depth, gSavedSettings.getU32("RenderFSAASamples")); -#if LL_WINDOWS - if (!LLWinDebug::checkExceptionHandler()) + + if (!LLAppViewer::instance()->restoreErrorTrap()) { - LL_WARNS("Window") << " Someone took over my exception handler (post createWindow)!" << LL_ENDL; + LL_WARNS("Window") << " Someone took over my signal/exception handler (post createWindow)!" << LL_ENDL; } -#endif + if (NULL == mWindow) { @@ -1545,7 +1553,7 @@ void LLViewerWindow::initGLDefaults() glPixelStorei(GL_PACK_ALIGNMENT,1); glPixelStorei(GL_UNPACK_ALIGNMENT,1); - glEnable(GL_TEXTURE_2D); + gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE); // lights for objects glShadeModel( GL_SMOOTH ); @@ -3042,8 +3050,9 @@ BOOL LLViewerWindow::handlePerFrameHover() if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_RAYCAST)) { - gDebugRaycastObject = cursorIntersect(-1, -1, 512.f, NULL, -1, - NULL, + gDebugRaycastFaceHit = -1; + gDebugRaycastObject = cursorIntersect(-1, -1, 512.f, NULL, -1, FALSE, + &gDebugRaycastFaceHit, &gDebugRaycastIntersection, &gDebugRaycastTexCoord, &gDebugRaycastNormal, @@ -3184,7 +3193,7 @@ void LLViewerWindow::renderSelections( BOOL for_gl_pick, BOOL pick_parcel_walls, // Render light for editing if (LLSelectMgr::sRenderLightRadius && LLToolMgr::getInstance()->inEdit()) { - LLImageGL::unbindTexture(0); + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); LLGLEnable gls_blend(GL_BLEND); LLGLEnable gls_cull(GL_CULL_FACE); LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE); @@ -3398,7 +3407,7 @@ void LLViewerWindow::schedulePick(LLPickInfo& pick_info) llassert_always(pick_info.mScreenRegion.notNull()); mPicks.push_back(pick_info); - S32 scaled_x = llround((F32)pick_info.mMousePt.mX * mDisplayScale.mV[VX]); + /*S32 scaled_x = llround((F32)pick_info.mMousePt.mX * mDisplayScale.mV[VX]); S32 scaled_y = llround((F32)pick_info.mMousePt.mY * mDisplayScale.mV[VY]); // Default to not hitting anything @@ -3467,7 +3476,7 @@ void LLViewerWindow::schedulePick(LLPickInfo& pick_info) setup3DRender(); setup2DRender(); - setupViewport(); + setupViewport();*/ // delay further event processing until we receive results of pick mWindow->delayInputProcessing(); @@ -3529,6 +3538,7 @@ LLPickInfo LLViewerWindow::pickImmediate(S32 x, S32 y_from_bot, BOOL pick_trans LLViewerObject* LLViewerWindow::cursorIntersect(S32 mouse_x, S32 mouse_y, F32 depth, LLViewerObject *this_object, S32 this_face, + BOOL pick_transparent, S32* face_hit, LLVector3 *intersection, LLVector2 *uv, @@ -3562,7 +3572,7 @@ LLViewerObject* LLViewerWindow::cursorIntersect(S32 mouse_x, S32 mouse_y, F32 de { if (this_object->isHUDAttachment()) // is a HUD object? { - if (this_object->lineSegmentIntersect(mouse_hud_start, mouse_hud_end, this_face, + if (this_object->lineSegmentIntersect(mouse_hud_start, mouse_hud_end, this_face, pick_transparent, face_hit, intersection, uv, normal, binormal)) { found = this_object; @@ -3571,7 +3581,7 @@ LLViewerObject* LLViewerWindow::cursorIntersect(S32 mouse_x, S32 mouse_y, F32 de else // is a world object { - if (this_object->lineSegmentIntersect(mouse_world_start, mouse_world_end, this_face, + if (this_object->lineSegmentIntersect(mouse_world_start, mouse_world_end, this_face, pick_transparent, face_hit, intersection, uv, normal, binormal)) { found = this_object; @@ -3581,13 +3591,13 @@ LLViewerObject* LLViewerWindow::cursorIntersect(S32 mouse_x, S32 mouse_y, F32 de else // check ALL objects { - found = gPipeline.lineSegmentIntersectInHUD(mouse_hud_start, mouse_hud_end, + found = gPipeline.lineSegmentIntersectInHUD(mouse_hud_start, mouse_hud_end, pick_transparent, face_hit, intersection, uv, normal, binormal); if (!found) // if not found in HUD, look in world: { - found = gPipeline.lineSegmentIntersectInWorld(mouse_world_start, mouse_world_end, + found = gPipeline.lineSegmentIntersectInWorld(mouse_world_start, mouse_world_end, pick_transparent, face_hit, intersection, uv, normal, binormal); } @@ -3811,13 +3821,8 @@ BOOL LLViewerWindow::saveImageNumbered(LLImageFormatted *image) return FALSE; } - std::string extension("." + image->getExtension()); - if (extension.empty()) - { - extension = (gSavedSettings.getBOOL("CompressSnapshotsToDisk")) ? ".j2c" : ".bmp"; - } - LLFilePicker::ESaveFilter pick_type; + std::string extension("." + image->getExtension()); if (extension == ".j2c") pick_type = LLFilePicker::FFSAVE_J2C; else if (extension == ".bmp") @@ -3835,7 +3840,8 @@ BOOL LLViewerWindow::saveImageNumbered(LLImageFormatted *image) if ( ! isSnapshotLocSet()) { std::string proposed_name( sSnapshotBaseName ); - proposed_name.append( extension ); + + // getSaveFile will append an appropriate extension to the proposed name, based on the ESaveFilter constant passed in. // pick a directory in which to save LLFilePicker& picker = LLFilePicker::instance(); @@ -4152,7 +4158,7 @@ BOOL LLViewerWindow::rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_hei snapshot_width = image_width; snapshot_height = image_height; - target.allocate(snapshot_width, snapshot_height, GL_RGBA, TRUE, GL_TEXTURE_RECTANGLE_ARB, TRUE); + target.allocate(snapshot_width, snapshot_height, GL_RGBA, TRUE, LLTexUnit::TT_RECT_TEXTURE, TRUE); window_width = snapshot_width; window_height = snapshot_height; scale_factor = 1.f; @@ -4380,7 +4386,7 @@ void LLViewerWindow::drawMouselookInstructions() llround(font->getLineHeight() + 2 * INSTRUCTIONS_PAD)); { - LLGLSNoTexture gls_no_texture; + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); gGL.color4f( 0.9f, 0.9f, 0.9f, 1.0f ); gl_rect_2d( instructions_rect ); } @@ -4586,12 +4592,10 @@ void LLViewerWindow::restoreGL(const std::string& progress_message) setProgressString(progress_message); } llinfos << "...Restoring GL done" << llendl; -#if LL_WINDOWS - if(!LLWinDebug::checkExceptionHandler()) + if(!LLAppViewer::instance()->restoreErrorTrap()) { - llwarns << " Someone took over my exception handler (post restoreGL)!" << llendl; + llwarns << " Someone took over my signal/exception handler (post restoreGL)!" << llendl; } -#endif } } @@ -4647,9 +4651,97 @@ void LLViewerWindow::getTargetWindow(BOOL& fullscreen, S32& width, S32& height) } } +bool LLViewerWindow::updateResolution() +{ + if (gSavedSettings.getBOOL("FullScreenAutoDetectAspectRatio")) + { + getWindow()->setNativeAspectRatio(0.f); + } + else + { + getWindow()->setNativeAspectRatio(gSavedSettings.getF32("FullScreenAspectRatio")); + } + + reshape(getWindowDisplayWidth(), getWindowDisplayHeight()); + + // Screen resolution + S32 num_resolutions; + LLWindow::LLWindowResolution* supported_resolutions = getWindow()->getSupportedResolutions(num_resolutions); + + // check if resolution has changed + BOOL targetFullscreen; + S32 targetWidth; + S32 targetHeight; + + getTargetWindow(targetFullscreen, targetWidth, targetHeight); + + if ((mIsFullscreenChecked != (bool) targetFullscreen) || + (mIsFullscreenChecked && + (supported_resolutions[mCurrResolutionIndex].mWidth != targetWidth || + supported_resolutions[mCurrResolutionIndex].mHeight != targetHeight) + )) + { + // change fullscreen resolution or switch in/out of windowed mode + BOOL result; + + BOOL logged_in = (LLStartUp::getStartupState() >= STATE_STARTED); + if (mIsFullscreenChecked) + { + result = changeDisplaySettings(TRUE, + LLCoordScreen( supported_resolutions[mCurrResolutionIndex].mWidth, + supported_resolutions[mCurrResolutionIndex].mHeight), + gSavedSettings.getBOOL("DisableVerticalSync"), + logged_in); + } + else + { + result = changeDisplaySettings(FALSE, + LLCoordScreen(gSavedSettings.getS32("WindowWidth"), gSavedSettings.getS32("WindowHeight")), + TRUE, + logged_in); + } + if (!result) + { + + // GL is non-existent at this point, so we can't continue. + llerrs << "LLPanelDisplay::apply() failed" << llendl; + } + } + + // force aspect ratio + if (mIsFullscreenChecked) + { + LLViewerCamera::getInstance()->setAspect( getDisplayAspectRatio() ); + } + return true; +} + +void LLViewerWindow::requestResolutionUpdate(bool fullscreen_checked, U32 resolution_index) +{ + mResDirty = true; + mIsFullscreenChecked = fullscreen_checked; + mCurrResolutionIndex = resolution_index; +} + BOOL LLViewerWindow::checkSettings() { + if (mStatesDirty) + { + gGL.refreshState(); + LLViewerShaderMgr::instance()->setShaders(); + mStatesDirty = false; + } + + // We want to update the resolution AFTER the states getting refreshed not before. + if (mResDirty) + { + updateResolution(); + mResDirty = false; + // This will force a state update the next frame. + mStatesDirty = true; + } + BOOL is_fullscreen = mWindow->getFullscreen(); if (is_fullscreen && !mWantFullscreen) { @@ -4658,6 +4750,7 @@ BOOL LLViewerWindow::checkSettings() gSavedSettings.getS32("WindowHeight")), TRUE, mShowFullscreenProgress); + mStatesDirty = true; return TRUE; } else if (!is_fullscreen && mWantFullscreen) @@ -4677,6 +4770,7 @@ BOOL LLViewerWindow::checkSettings() LLGLState::checkStates(); LLGLState::checkTextureChannels(); + mStatesDirty = true; return TRUE; } return FALSE; @@ -5103,25 +5197,34 @@ LLPickInfo::~LLPickInfo() void LLPickInfo::fetchResults() { + + S32 face_hit = -1; + LLVector3 intersection, normal, binormal; + LLVector2 uv; + + LLViewerObject* hit_object = gViewerWindow->cursorIntersect(-1, -1, 512.f, + NULL, -1, mPickTransparent, &face_hit, + &intersection, &uv, &normal, &binormal); + // read back colors and depth values from buffer - glReadPixels(mScreenRegion.mLeft, mScreenRegion.mBottom, mScreenRegion.getWidth(), mScreenRegion.getHeight(), GL_RGBA, GL_UNSIGNED_BYTE, mPickBuffer); - glReadPixels(mScreenRegion.mLeft, mScreenRegion.mBottom, mScreenRegion.getWidth(), mScreenRegion.getHeight(), GL_DEPTH_COMPONENT, GL_FLOAT, mPickDepthBuffer ); + //glReadPixels(mScreenRegion.mLeft, mScreenRegion.mBottom, mScreenRegion.getWidth(), mScreenRegion.getHeight(), GL_RGBA, GL_UNSIGNED_BYTE, mPickBuffer); + //glReadPixels(mScreenRegion.mLeft, mScreenRegion.mBottom, mScreenRegion.getWidth(), mScreenRegion.getHeight(), GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, mPickDepthBuffer ); // find pick region that is fully onscreen LLCoordGL scaled_pick_point;; scaled_pick_point.mX = llclamp(llround((F32)mMousePt.mX * gViewerWindow->getDisplayScale().mV[VX]), PICK_HALF_WIDTH, gViewerWindow->getWindowDisplayWidth() - PICK_HALF_WIDTH); scaled_pick_point.mY = llclamp(llround((F32)mMousePt.mY * gViewerWindow->getDisplayScale().mV[VY]), PICK_HALF_WIDTH, gViewerWindow->getWindowDisplayHeight() - PICK_HALF_WIDTH); - S32 pixel_index = PICK_HALF_WIDTH * PICK_DIAMETER + PICK_HALF_WIDTH; - S32 pick_id = (U32)mPickBuffer[(pixel_index * 4) + 0] << 16 | (U32)mPickBuffer[(pixel_index * 4) + 1] << 8 | (U32)mPickBuffer[(pixel_index * 4) + 2]; - F32 depth = mPickDepthBuffer[pixel_index]; + //S32 pixel_index = PICK_HALF_WIDTH * PICK_DIAMETER + PICK_HALF_WIDTH; + //S32 pick_id = (U32)mPickBuffer[(pixel_index * 4) + 0] << 16 | (U32)mPickBuffer[(pixel_index * 4) + 1] << 8 | (U32)mPickBuffer[(pixel_index * 4) + 2]; + //F32 depth = mPickDepthBuffer[pixel_index]; - S32 x_offset = mMousePt.mX - llround((F32)scaled_pick_point.mX / gViewerWindow->getDisplayScale().mV[VX]); - S32 y_offset = mMousePt.mY - llround((F32)scaled_pick_point.mY / gViewerWindow->getDisplayScale().mV[VY]); + //S32 x_offset = mMousePt.mX - llround((F32)scaled_pick_point.mX / gViewerWindow->getDisplayScale().mV[VX]); + //S32 y_offset = mMousePt.mY - llround((F32)scaled_pick_point.mY / gViewerWindow->getDisplayScale().mV[VY]); mPickPt = mMousePt; // we hit nothing, scan surrounding pixels for something useful - if (!pick_id) + /*if (!pick_id) { S32 closest_distance = 10000; //S32 closest_pick_name = 0; @@ -5142,25 +5245,21 @@ void LLPickInfo::fetchResults() } } } - } + }*/ - U32 te_offset = ((U32)pick_id >> 20); - pick_id &= 0x000fffff; - //unproject relative clicked coordinate from window coordinate using GL - GLint viewport[4]; - GLdouble modelview[16]; - GLdouble projection[16]; - GLfloat winX, winY; - GLdouble posX, posY, posZ; + U32 te_offset = face_hit > -1 ? face_hit : 0; + //pick_id &= 0x000fffff; - LLViewerObject* objectp = gObjectList.getSelectedObject(pick_id); + //unproject relative clicked coordinate from window coordinate using GL + + LLViewerObject* objectp = hit_object; - if (pick_id == (S32)GL_NAME_PARCEL_WALL) - { - mPickType = PICK_PARCEL_WALL; - } - else if (objectp) + //if (pick_id == (S32)GL_NAME_PARCEL_WALL) + //{ + // mPickType = PICK_PARCEL_WALL; + //} + if (objectp) { if( objectp->getPCode() == LLViewerObject::LL_VO_SURFACE_PATCH ) { @@ -5186,11 +5285,11 @@ void LLPickInfo::fetchResults() { mPickType = PICK_OBJECT; } - mObjectOffset = gAgent.calcFocusOffset(objectp, mPickPt.mX, mPickPt.mY); + mObjectOffset = gAgent.calcFocusOffset(objectp, intersection, mPickPt.mX, mPickPt.mY); mObjectID = objectp->mID; mObjectFace = (te_offset == NO_FACE) ? -1 : (S32)te_offset; - glh::matrix4f newModel((F32*)LLViewerCamera::getInstance()->getModelview().mMatrix); + /*glh::matrix4f newModel((F32*)LLViewerCamera::getInstance()->getModelview().mMatrix); for(U32 i = 0; i < 16; ++i) { @@ -5202,9 +5301,9 @@ void LLPickInfo::fetchResults() winX = ((F32)mPickPt.mX) * gViewerWindow->getDisplayScale().mV[VX]; winY = ((F32)mPickPt.mY) * gViewerWindow->getDisplayScale().mV[VY]; - gluUnProject( winX, winY, depth, modelview, projection, viewport, &posX, &posY, &posZ); + gluUnProject( winX, winY, depth, modelview, projection, viewport, &posX, &posY, &posZ);*/ - mPosGlobal = gAgent.getPosGlobalFromAgent(LLVector3(posX, posY, posZ)); + mPosGlobal = gAgent.getPosGlobalFromAgent(intersection); if (mWantSurfaceInfo) { @@ -5212,16 +5311,16 @@ void LLPickInfo::fetchResults() } } } - else - { + //else + //{ // was this name referring to a hud icon? - mHUDIcon = LLHUDIcon::handlePick(pick_id); - if (mHUDIcon) - { - mPickType = PICK_ICON; - mPosGlobal = mHUDIcon->getPositionGlobal(); - } - } + // mHUDIcon = LLHUDIcon::handlePick(pick_id); + // if (mHUDIcon) + // { + // mPickType = PICK_ICON; + // mPosGlobal = mHUDIcon->getPositionGlobal(); + // } + //} if (mPickCallback) { @@ -5236,16 +5335,19 @@ LLPointer LLPickInfo::getObject() const void LLPickInfo::updateXYCoords() { - const LLTextureEntry* tep = getObject()->getTE(mObjectFace); - LLPointer imagep = gImageList.getImage(tep->getID()); - if(mUVCoords.mV[VX] >= 0.f && mUVCoords.mV[VY] >= 0.f && imagep.notNull()) + if (mObjectFace > -1) { - LLCoordGL coords; - - coords.mX = llround(mUVCoords.mV[VX] * (F32)imagep->getWidth()); - coords.mY = llround(mUVCoords.mV[VY] * (F32)imagep->getHeight()); + const LLTextureEntry* tep = getObject()->getTE(mObjectFace); + LLPointer imagep = gImageList.getImage(tep->getID()); + if(mUVCoords.mV[VX] >= 0.f && mUVCoords.mV[VY] >= 0.f && imagep.notNull()) + { + LLCoordGL coords; + + coords.mX = llround(mUVCoords.mV[VX] * (F32)imagep->getWidth()); + coords.mY = llround(mUVCoords.mV[VY] * (F32)imagep->getHeight()); - gViewerWindow->getWindow()->convertCoords(coords, &mXYCoords); + gViewerWindow->getWindow()->convertCoords(coords, &mXYCoords); + } } } @@ -5256,7 +5358,7 @@ void LLPickInfo::drawPickBuffer() const gGL.pushMatrix(); LLGLDisable no_blend(GL_BLEND); LLGLDisable no_alpha_test(GL_ALPHA_TEST); - LLGLSNoTexture no_texture; + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); glPixelZoom(10.f, 10.f); LLVector2 display_scale = gViewerWindow->getDisplayScale(); glRasterPos2f(((F32)mMousePt.mX * display_scale.mV[VX] + 10.f), @@ -5308,7 +5410,7 @@ void LLPickInfo::getSurfaceInfo() if (objectp) { if (gViewerWindow->cursorIntersect(llround((F32)mMousePt.mX), llround((F32)mMousePt.mY), 1024.f, - objectp, -1, + objectp, -1, mPickTransparent, &mObjectFace, &mIntersection, &mSTCoords, @@ -5317,7 +5419,7 @@ void LLPickInfo::getSurfaceInfo() { // if we succeeded with the intersect above, compute the texture coordinates: - if (objectp->mDrawable.notNull()) + if (objectp->mDrawable.notNull() && mObjectFace > -1) { LLFace* facep = objectp->mDrawable->getFace(mObjectFace); diff --git a/linden/indra/newview/llviewerwindow.h b/linden/indra/newview/llviewerwindow.h index 21df0d5..28fcb3e 100644 --- a/linden/indra/newview/llviewerwindow.h +++ b/linden/indra/newview/llviewerwindow.h @@ -313,6 +313,7 @@ public: LLViewerObject* cursorIntersect(S32 mouse_x = -1, S32 mouse_y = -1, F32 depth = 512.f, LLViewerObject *this_object = NULL, S32 this_face = -1, + BOOL pick_transparent = FALSE, S32* face_hit = NULL, LLVector3 *intersection = NULL, LLVector2 *uv = NULL, @@ -340,6 +341,8 @@ public: void toggleFullscreen(BOOL show_progress); // handle shutting down GL and bringing it back up + bool updateResolution(void); + void requestResolutionUpdate(bool fullscreen_checked, U32 resolution_index); BOOL checkSettings(); void restartDisplay(BOOL show_progress_bar); BOOL changeDisplaySettings(BOOL fullscreen, LLCoordScreen size, BOOL disable_vsync, BOOL show_progress_bar); @@ -421,6 +424,11 @@ protected: std::string mInitAlert; // Window / GL initialization requires an alert class LLDebugText* mDebugText; // Internal class for debug text + + bool mResDirty; + bool mStatesDirty; + bool mIsFullscreenChecked; // Did the user check the fullscreen checkbox in the display settings + U32 mCurrResolutionIndex; protected: static std::string sSnapshotBaseName; @@ -473,6 +481,7 @@ extern LLVector3 gDebugRaycastIntersection; extern LLVector2 gDebugRaycastTexCoord; extern LLVector3 gDebugRaycastNormal; extern LLVector3 gDebugRaycastBinormal; +extern S32 gDebugRaycastFaceHit; extern S32 CHAT_BAR_HEIGHT; diff --git a/linden/indra/newview/llvoavatar.cpp b/linden/indra/newview/llvoavatar.cpp index e480eb3..c3ad4f9 100644 --- a/linden/indra/newview/llvoavatar.cpp +++ b/linden/indra/newview/llvoavatar.cpp @@ -244,6 +244,11 @@ static F32 calc_bouncy_animation(F32 x) return -(cosf(x * F_PI * 2.5f - F_PI_BY_TWO))*(0.4f + x * -0.1f) + x * 1.3f; } +BOOL LLLineSegmentCapsuleIntersect(const LLVector3& start, const LLVector3& end, const LLVector3& p1, const LLVector3& p2, const F32& radius, LLVector3& result) +{ + return FALSE; +} + //----------------------------------------------------------------------------- // Static Data //----------------------------------------------------------------------------- @@ -753,7 +758,7 @@ LLVOAvatar::LLVOAvatar( mRippleTimeLast = 0.f; mShadowImagep = gImageList.getImageFromFile("foot_shadow.j2c"); - mShadowImagep->bind(); + gGL.getTexUnit(0)->bind(mShadowImagep.get()); mShadowImagep->setClamp(TRUE, TRUE); mInAir = FALSE; @@ -1131,7 +1136,7 @@ void LLVOAvatar::dumpBakedStatus() } - F64 dist_to_camera = (inst->getPositionGlobal() - camera_pos_global).magVec(); + F64 dist_to_camera = (inst->getPositionGlobal() - camera_pos_global).length(); llcont << " " << dist_to_camera << "m "; llcont << " " << inst->mPixelArea << " pixels"; @@ -1569,6 +1574,96 @@ void LLVOAvatar::getSpatialExtents(LLVector3& newMin, LLVector3& newMax) newMax += buffer; } +//----------------------------------------------------------------------------- +// renderCollisionVolumes() +//----------------------------------------------------------------------------- +void LLVOAvatar::renderCollisionVolumes() +{ + for (S32 i = 0; i < mNumCollisionVolumes; i++) + { + mCollisionVolumes[i].renderCollision(); + } + + if (mNameText.notNull()) + { + LLVector3 unused; + mNameText->lineSegmentIntersect(LLVector3(0,0,0), LLVector3(0,0,1), unused, TRUE); + } +} + +BOOL LLVOAvatar::lineSegmentIntersect(const LLVector3& start, const LLVector3& end, + S32 face, + BOOL pick_transparent, + S32* face_hit, + LLVector3* intersection, + LLVector2* tex_coord, + LLVector3* normal, + LLVector3* bi_normal + ) +{ + + if (mIsSelf && !gAgent.needsRenderAvatar()) + { + return FALSE; + } + + if (lineSegmentBoundingBox(start, end)) + { + for (S32 i = 0; i < mNumCollisionVolumes; ++i) + { + mCollisionVolumes[i].updateWorldMatrix(); + + glh::matrix4f mat((F32*) mCollisionVolumes[i].getXform()->getWorldMatrix().mMatrix); + glh::matrix4f inverse = mat.inverse(); + glh::matrix4f norm_mat = inverse.transpose(); + + glh::vec3f p1(start.mV); + glh::vec3f p2(end.mV); + + inverse.mult_matrix_vec(p1); + inverse.mult_matrix_vec(p2); + + LLVector3 position; + LLVector3 norm; + + if (linesegment_sphere(LLVector3(p1.v), LLVector3(p2.v), LLVector3(0,0,0), 1.f, position, norm)) + { + glh::vec3f res_pos(position.mV); + mat.mult_matrix_vec(res_pos); + + norm.normalize(); + glh::vec3f res_norm(norm.mV); + norm_mat.mult_matrix_dir(res_norm); + + if (intersection) + { + *intersection = LLVector3(res_pos.v); + } + + if (normal) + { + *normal = LLVector3(res_norm.v); + } + + return TRUE; + } + } + } + + LLVector3 position; + if (mNameText.notNull() && mNameText->lineSegmentIntersect(start, end, position)) + { + if (intersection) + { + *intersection = position; + } + + return TRUE; + } + + return FALSE; +} + //----------------------------------------------------------------------------- // parseSkeletonFile() @@ -2737,8 +2832,8 @@ void LLVOAvatar::idleUpdateMisc(bool detailed_update) else { getSpatialExtents(ext[0], ext[1]); - if ((ext[1]-mImpostorExtents[1]).magVec() > 0.05f || - (ext[0]-mImpostorExtents[0]).magVec() > 0.05f) + if ((ext[1]-mImpostorExtents[1]).length() > 0.05f || + (ext[0]-mImpostorExtents[0]).length() > 0.05f) { mNeedsImpostorUpdate = TRUE; } @@ -2905,7 +3000,7 @@ void LLVOAvatar::idleUpdateWindEffect() F32 time_delta = mRippleTimer.getElapsedTimeF32() - mRippleTimeLast; mRippleTimeLast = mRippleTimer.getElapsedTimeF32(); LLVector3 velocity = getVelocity(); - F32 speed = velocity.magVec(); + F32 speed = velocity.length(); //RN: velocity varies too much frame to frame for this to work mRippleAccel.clearVec();//lerp(mRippleAccel, (velocity - mLastVel) * time_delta, LLCriticalDamp::getInterpolant(0.02f)); mLastVel = velocity; @@ -2924,7 +3019,7 @@ void LLVOAvatar::idleUpdateWindEffect() } wind.mV[VZ] += hover_strength; - wind.normVec(); + wind.normalize(); wind.mV[VW] = llmin(0.025f + (speed * 0.015f) + hover_strength, 0.5f); F32 interp; @@ -3047,10 +3142,10 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last) LLVector3 pixel_up_vec; LLViewerCamera::getInstance()->getPixelVectors(root_pos_last, pixel_up_vec, pixel_right_vec); LLVector3 camera_to_av = root_pos_last - LLViewerCamera::getInstance()->getOrigin(); - camera_to_av.normVec(); + camera_to_av.normalize(); LLVector3 local_camera_at = camera_to_av * ~root_rot; LLVector3 local_camera_up = camera_to_av % LLViewerCamera::getInstance()->getLeftAxis(); - local_camera_up.normVec(); + local_camera_up.normalize(); local_camera_up = local_camera_up * ~root_rot; local_camera_up.scaleVec(mBodySize * 0.5f); @@ -3509,7 +3604,7 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) LLVector3 xyVel = getVelocity(); xyVel.mV[VZ] = 0.0f; - speed = xyVel.magVec(); + speed = xyVel.length(); BOOL throttle = TRUE; @@ -3594,14 +3689,14 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) if (mIsSelf) { primDir = agent.getAtAxis() - projected_vec(agent.getAtAxis(), agent.getReferenceUpVector()); - primDir.normVec(); + primDir.normalize(); } else { primDir = getRotation().getMatrix3().getFwdRow(); } LLVector3 velDir = getVelocity(); - velDir.normVec(); + velDir.normalize(); if ( mSignaledAnimations.find(ANIM_AGENT_WALK) != mSignaledAnimations.end()) { F32 vpD = velDir * primDir; @@ -3623,13 +3718,13 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) LLVector3 at_axis = LLViewerCamera::getInstance()->getAtAxis(); LLVector3 up_vector = gAgent.getReferenceUpVector(); at_axis -= up_vector * (at_axis * up_vector); - at_axis.normVec(); + at_axis.normalize(); F32 dot = fwdDir * at_axis; if (dot < 0.f) { fwdDir -= 2.f * at_axis * dot; - fwdDir.normVec(); + fwdDir.normalize(); } } @@ -3697,7 +3792,7 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) // Now compute the full world space rotation for the whole body (wQv) LLVector3 leftDir = upDir % fwdDir; - leftDir.normVec(); + leftDir.normalize(); fwdDir = leftDir % upDir; LLQuaternion wQv( fwdDir, leftDir, upDir ); @@ -3828,10 +3923,7 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) // AUDIO_STEP_LO_SPEED, AUDIO_STEP_HI_SPEED, // AUDIO_STEP_LO_GAIN, AUDIO_STEP_HI_GAIN ); - F32 ambient_volume = gSavedSettings.getF32("AudioLevelAmbient"); - F32 gain = gSavedSettings.getBOOL("MuteAmbient") - ? 0.f - : (.50f * ambient_volume * ambient_volume); + const F32 STEP_VOLUME = 0.5f; LLUUID& step_sound_id = getStepSound(); LLVector3d foot_pos_global = gAgent.getPosGlobalFromAgent(foot_pos_agent); @@ -3839,7 +3931,7 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) if (LLViewerParcelMgr::getInstance()->canHearSound(foot_pos_global) && !LLMuteList::getInstance()->isMuted(getID(), LLMute::flagObjectSounds)) { - gAudiop->triggerSound(step_sound_id, getID(), gain, foot_pos_global); + gAudiop->triggerSound(step_sound_id, getID(), STEP_VOLUME, LLAudioEngine::AUDIO_TYPE_AMBIENT, foot_pos_global); } } } @@ -4141,7 +4233,7 @@ U32 LLVOAvatar::renderSkinned(EAvatarRenderPass pass) LLVector3 collide_point = slaved_pos; collide_point.mV[VZ] -= foot_plane_normal.mV[VZ] * (dist_from_plane + COLLISION_TOLERANCE - FOOT_COLLIDE_FUDGE); - gGL.begin(LLVertexBuffer::LINES); + gGL.begin(LLRender::LINES); { F32 SQUARE_SIZE = 0.2f; gGL.color4f(1.f, 0.f, 0.f, 1.f); @@ -4288,7 +4380,7 @@ U32 LLVOAvatar::renderFootShadows() LLGLDepthTest test(GL_TRUE, GL_FALSE); //render foot shadows LLGLEnable blend(GL_BLEND); - mShadowImagep->bind(); + gGL.getTexUnit(0)->bind(mShadowImagep.get()); glColor4fv(mShadow0Facep->getRenderColor().mV); mShadow0Facep->renderIndexed(foot_mask); glColor4fv(mShadow1Facep->getRenderColor().mV); @@ -4306,7 +4398,7 @@ U32 LLVOAvatar::renderImpostor(LLColor4U color) LLVector3 pos(getRenderPosition()+mImpostorOffset); LLVector3 at = (pos - LLViewerCamera::getInstance()->getOrigin()); - at.normVec(); + at.normalize(); LLVector3 left = LLViewerCamera::getInstance()->getUpAxis() % at; LLVector3 up = at%left; @@ -4334,8 +4426,8 @@ U32 LLVOAvatar::renderImpostor(LLColor4U color) color.mV[3] = (U8) (alpha*255); gGL.color4ubv(color.mV); - mImpostor.bindTexture(); - gGL.begin(LLVertexBuffer::QUADS); + gGL.getTexUnit(0)->bind(&mImpostor); + gGL.begin(LLRender::QUADS); gGL.texCoord2f(0,0); gGL.vertex3fv((pos+left-up).mV); gGL.texCoord2f(1,0); @@ -4350,17 +4442,6 @@ U32 LLVOAvatar::renderImpostor(LLColor4U color) return 6; } -//----------------------------------------------------------------------------- -// renderCollisionVolumes() -//----------------------------------------------------------------------------- -void LLVOAvatar::renderCollisionVolumes() -{ - for (S32 i = 0; i < mNumCollisionVolumes; i++) - { - mCollisionVolumes[i].renderCollision(); - } -} - //------------------------------------------------------------------------ // LLVOAvatar::updateTextures() //------------------------------------------------------------------------ @@ -4395,23 +4476,23 @@ void LLVOAvatar::updateTextures(LLAgent &agent) { if( head_baked && ! mHeadBakedLoaded ) { - getTEImage( TEX_HEAD_BAKED )->bind(); + gGL.getTexUnit(0)->bind(getTEImage( TEX_HEAD_BAKED )); } if( upper_baked && ! mUpperBakedLoaded ) { - getTEImage( TEX_UPPER_BAKED )->bind(); + gGL.getTexUnit(0)->bind(getTEImage( TEX_UPPER_BAKED )); } if( lower_baked && ! mLowerBakedLoaded ) { - getTEImage( TEX_LOWER_BAKED )->bind(); + gGL.getTexUnit(0)->bind(getTEImage( TEX_LOWER_BAKED )); } if( eyes_baked && ! mEyesBakedLoaded ) { - getTEImage( TEX_EYES_BAKED )->bind(); + gGL.getTexUnit(0)->bind(getTEImage( TEX_EYES_BAKED )); } if( skirt_baked && ! mSkirtBakedLoaded ) { - getTEImage( TEX_SKIRT_BAKED )->bind(); + gGL.getTexUnit(0)->bind(getTEImage( TEX_SKIRT_BAKED )); } } @@ -4813,14 +4894,12 @@ BOOL LLVOAvatar::processSingleAnimationStateChange( const LLUUID& anim_id, BOOL // to support both spatialized and non-spatialized instances of the same sound //if (mIsSelf) //{ - // F32 volume = gain * gSavedSettings.getF32("AudioLevelUI") - // gAudiop->triggerSound(LLUUID(gSavedSettings.getString("UISndTyping")), volume); + // gAudiop->triggerSound(LLUUID(gSavedSettings.getString("UISndTyping")), 1.0f, LLAudioEngine::AUDIO_TYPE_UI); //} //else { LLUUID sound_id = LLUUID(gSavedSettings.getString("UISndTyping")); - F32 volume = gSavedSettings.getBOOL("MuteSounds") ? 0.f : gSavedSettings.getF32("AudioLevelSFX"); - gAudiop->triggerSound(sound_id, getID(), volume, char_pos_global); + gAudiop->triggerSound(sound_id, getID(), 1.0f, LLAudioEngine::AUDIO_TYPE_SFX, char_pos_global); } } } @@ -5719,7 +5798,9 @@ BOOL LLVOAvatar::loadMeshNodes() // llinfos << "Parsing mesh data for " << type << "..." << llendl; - mesh->setColor( 0.8f, 0.8f, 0.8f, 1.0f ); + // If this isn't set to white (1.0), avatars will *ALWAYS* be darker than their surroundings. + // Do not touch!!! + mesh->setColor( 1.0f, 1.0f, 1.0f, 1.0f ); LLPolyMesh *poly_mesh = NULL; @@ -5837,7 +5918,7 @@ void LLVOAvatar::setPixelAreaAndAngle(LLAgent &agent) } else { - F32 radius = size.magVec(); + F32 radius = size.length(); mAppAngle = (F32) atan2( radius, range) * RAD_TO_DEG; } @@ -6009,7 +6090,7 @@ void LLVOAvatar::updateShadowFaces() sprite.setPosition(shadow_pos_agent); LLVector3 foot_to_knee = mKneeLeftp->getWorldPosition() - joint_world_pos; - //foot_to_knee.normVec(); + //foot_to_knee.normalize(); foot_to_knee -= projected_vec(foot_to_knee, sun_vec); sprite.setYaw(azimuth(sun_vec - foot_to_knee)); @@ -6042,7 +6123,7 @@ void LLVOAvatar::updateShadowFaces() sprite.setPosition(shadow_pos_agent); LLVector3 foot_to_knee = mKneeRightp->getWorldPosition() - joint_world_pos; - //foot_to_knee.normVec(); + //foot_to_knee.normalize(); foot_to_knee -= projected_vec(foot_to_knee, sun_vec); sprite.setYaw(azimuth(sun_vec - foot_to_knee)); @@ -6403,7 +6484,7 @@ void LLVOAvatar::getOffObject() LLVector3 at_axis = LLVector3::x_axis; at_axis = at_axis * av_rot; at_axis.mV[VZ] = 0.f; - at_axis.normVec(); + at_axis.normalize(); gAgent.resetAxes(at_axis); //reset orientation @@ -6957,7 +7038,7 @@ BOOL LLVOAvatar::bindScratchTexture( LLGLenum format ) GLuint gl_name = getScratchTexName( format, &texture_bytes ); if( gl_name ) { - LLImageGL::bindExternalTexture( gl_name, 0, GL_TEXTURE_2D ); + gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, gl_name); stop_glerror(); F32* last_bind_time = LLVOAvatar::sScratchTexLastBindTime.getIfThere( format ); @@ -7015,7 +7096,7 @@ LLGLuint LLVOAvatar::getScratchTexName( LLGLenum format, U32* texture_bytes ) glGenTextures(1, &name ); stop_glerror(); - LLImageGL::bindExternalTexture( name, 0, GL_TEXTURE_2D ); + gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, name); stop_glerror(); glTexImage2D( @@ -7030,7 +7111,7 @@ LLGLuint LLVOAvatar::getScratchTexName( LLGLenum format, U32* texture_bytes ) glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE ); stop_glerror(); - LLImageGL::unbindTexture(0, GL_TEXTURE_2D); + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); stop_glerror(); LLVOAvatar::sScratchTexNames.addData( format, new LLGLuint( name ) ); @@ -8639,7 +8720,7 @@ void LLVOAvatar::onBakedTextureMasksLoaded( BOOL success, LLViewerImage *src_vi, glGenTextures(1, (GLuint*) &gl_name ); stop_glerror(); - LLImageGL::bindExternalTexture( gl_name, 0, GL_TEXTURE_2D ); + gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, gl_name); stop_glerror(); glTexImage2D( @@ -9914,7 +9995,7 @@ void LLVOAvatar::getImpostorValues(LLVector3* extents, LLVector3& angle, F32& di extents[1] = ext[1]; LLVector3 at = LLViewerCamera::getInstance()->getOrigin()-(getRenderPosition()+mImpostorOffset); - distance = at.normVec(); + distance = at.normalize(); F32 da = 1.f - (at*LLViewerCamera::getInstance()->getAtAxis()); angle.mV[0] = LLViewerCamera::getInstance()->getYaw()*da; angle.mV[1] = LLViewerCamera::getInstance()->getPitch()*da; diff --git a/linden/indra/newview/llvoavatar.h b/linden/indra/newview/llvoavatar.h index d66ddfc..8265e8a 100644 --- a/linden/indra/newview/llvoavatar.h +++ b/linden/indra/newview/llvoavatar.h @@ -308,6 +308,16 @@ public: U32 renderTransparent(); void renderCollisionVolumes(); + /*virtual*/ BOOL lineSegmentIntersect(const LLVector3& start, const LLVector3& end, + S32 face = -1, // which face to check, -1 = ALL_SIDES + BOOL pick_transparent = FALSE, + S32* face_hit = NULL, // which face was hit + LLVector3* intersection = NULL, // return the intersection point + LLVector2* tex_coord = NULL, // return the texture coordinates of the intersection point + LLVector3* normal = NULL, // return the surface normal at the intersection point + LLVector3* bi_normal = NULL // return the surface bi-normal at the intersection point + ); + /*virtual*/ void updateTextures(LLAgent &agent); // If setting a baked texture, need to request it from a non-local sim. /*virtual*/ S32 setTETexture(const U8 te, const LLUUID& uuid); diff --git a/linden/indra/newview/llvograss.cpp b/linden/indra/newview/llvograss.cpp index a028a63..821cf3e 100644 --- a/linden/indra/newview/llvograss.cpp +++ b/linden/indra/newview/llvograss.cpp @@ -273,9 +273,9 @@ U32 LLVOGrass::processUpdateMessage(LLMessageSystem *mesgsys, updateSpecies(); - if ( (getVelocity().magVecSquared() > 0.f) - ||(getAcceleration().magVecSquared() > 0.f) - ||(getAngularVelocity().magVecSquared() > 0.f)) + if ( (getVelocity().lengthSquared() > 0.f) + ||(getAcceleration().lengthSquared() > 0.f) + ||(getAngularVelocity().lengthSquared() > 0.f)) { llinfos << "ACK! Moving grass!" << llendl; setVelocity(LLVector3::zero); @@ -322,7 +322,7 @@ void LLVOGrass::setPixelAreaAndAngle(LLAgent &agent) { // This should be the camera's center, as soon as we move to all region-local. LLVector3 relative_position = getPositionAgent() - agent.getCameraPositionAgent(); - F32 range = relative_position.magVec(); + F32 range = relative_position.length(); F32 max_scale = getMaxScale(); @@ -501,7 +501,7 @@ void LLVOGrass::getGeometry(S32 idx, LLVector3 normal1 = (v1-v2) % (v2-v3); normal1.mV[VZ] = 0.75f; - normal1.normVec(); + normal1.normalize(); LLVector3 normal2 = -normal1; normal2.mV[VZ] = -normal2.mV[VZ]; @@ -578,3 +578,146 @@ void LLVOGrass::updateDrawable(BOOL force_damped) } clearChanged(SHIFTED); } + +// virtual +BOOL LLVOGrass::lineSegmentIntersect(const LLVector3& start, const LLVector3& end, S32 face, BOOL pick_transparent, S32 *face_hitp, + LLVector3* intersection,LLVector2* tex_coord, LLVector3* normal, LLVector3* bi_normal) + +{ + BOOL ret = FALSE; + if (!mbCanSelect || + mDrawable->isDead() || + !gPipeline.hasRenderType(mDrawable->getRenderType())) + { + return FALSE; + } + + LLVector3 dir = end-start; + + mPatch = mRegionp->getLand().resolvePatchRegion(getPositionRegion()); + + LLVector3 position; + // Create random blades of grass with gaussian distribution + F32 x,y,xf,yf,dzx,dzy; + + LLColor4U color(255,255,255,255); + + F32 width = sSpeciesTable[mSpecies]->mBladeSizeX; + F32 height = sSpeciesTable[mSpecies]->mBladeSizeY; + + LLVector2 tc[4]; + LLVector3 v[4]; + // LLVector3 n[4]; // unused! + + F32 closest_t = 1.f; + + for (S32 i = 0; i < mNumBlades; i++) + { + x = exp_x[i] * mScale.mV[VX]; + y = exp_y[i] * mScale.mV[VY]; + xf = rot_x[i] * GRASS_BLADE_BASE * width * w_mod[i]; + yf = rot_y[i] * GRASS_BLADE_BASE * width * w_mod[i]; + dzx = dz_x [i]; + dzy = dz_y [i]; + + LLVector3 v1,v2,v3; + F32 blade_height= GRASS_BLADE_HEIGHT * height * w_mod[i]; + + tc[0] = LLVector2(0, 0); + tc[1] = LLVector2(0, 0.98f); + tc[2] = LLVector2(1, 0); + tc[3] = LLVector2(1, 0.98f); + + position.mV[0] = mPosition.mV[VX] + x + xf; + position.mV[1] = mPosition.mV[VY] + y + yf; + position.mV[2] = mRegionp->getLand().resolveHeightRegion(position); + v[0] = v1 = position + mRegionp->getOriginAgent(); + + + + position.mV[0] += dzx; + position.mV[1] += dzy; + position.mV[2] += blade_height; + v[1] = v2 = position + mRegionp->getOriginAgent(); + + position.mV[0] = mPosition.mV[VX] + x - xf; + position.mV[1] = mPosition.mV[VY] + y - xf; + position.mV[2] = mRegionp->getLand().resolveHeightRegion(position); + v[2] = v3 = position + mRegionp->getOriginAgent(); + + LLVector3 normal1 = (v1-v2) % (v2-v3); + normal1.normalize(); + + position.mV[0] += dzx; + position.mV[1] += dzy; + position.mV[2] += blade_height; + v[3] = v1 = position + mRegionp->getOriginAgent(); + + + F32 a,b,t; + + BOOL hit = FALSE; + + + U32 idx0 = 0,idx1 = 0,idx2 = 0; + + if (LLTriangleRayIntersect(v[0], v[1], v[2], start, dir, &a, &b, &t, FALSE)) + { + hit = TRUE; + idx0 = 0; idx1 = 1; idx2 = 2; + } + else if (LLTriangleRayIntersect(v[1], v[3], v[2], start, dir, &a, &b, &t, FALSE)) + { + hit = TRUE; + idx0 = 1; idx1 = 3; idx2 = 2; + } + else if (LLTriangleRayIntersect(v[2], v[1], v[0], start, dir, &a, &b, &t, FALSE)) + { + normal1 = -normal1; + hit = TRUE; + idx0 = 2; idx1 = 1; idx2 = 0; + } + else if (LLTriangleRayIntersect(v[2], v[3], v[1], start, dir, &a, &b, &t, FALSE)) + { + normal1 = -normal1; + hit = TRUE; + idx0 = 2; idx1 = 3; idx2 = 1; + } + + if (hit) + { + if (t >= 0.f && + t <= 1.f && + t < closest_t) + { + + LLVector2 hit_tc = ((1.f - a - b) * tc[idx0] + + a * tc[idx1] + + b * tc[idx2]); + if (pick_transparent || + getTEImage(0)->getMask(hit_tc)) + { + closest_t = t; + if (intersection != NULL) + { + *intersection = start+dir*closest_t; + } + + if (tex_coord != NULL) + { + *tex_coord = hit_tc; + } + + if (normal != NULL) + { + *normal = normal1; + } + ret = TRUE; + } + } + } + } + + return ret; +} + diff --git a/linden/indra/newview/llvograss.h b/linden/indra/newview/llvograss.h index 679f5dc..fa22ebb 100644 --- a/linden/indra/newview/llvograss.h +++ b/linden/indra/newview/llvograss.h @@ -80,6 +80,16 @@ public: /*virtual*/ BOOL isActive() const; // Whether this object needs to do an idleUpdate. BOOL idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time); + /*virtual*/ BOOL lineSegmentIntersect(const LLVector3& start, const LLVector3& end, + S32 face = -1, // which face to check, -1 = ALL_SIDES + BOOL pick_transparent = FALSE, + S32* face_hit = NULL, // which face was hit + LLVector3* intersection = NULL, // return the intersection point + LLVector2* tex_coord = NULL, // return the texture coordinates of the intersection point + LLVector3* normal = NULL, // return the surface normal at the intersection point + LLVector3* bi_normal = NULL // return the surface bi-normal at the intersection point + ); + static S32 sMaxGrassSpecies; struct GrassSpeciesData diff --git a/linden/indra/newview/llvoground.cpp b/linden/indra/newview/llvoground.cpp index 32622ec..166c879 100644 --- a/linden/indra/newview/llvoground.cpp +++ b/linden/indra/newview/llvoground.cpp @@ -45,7 +45,7 @@ #include "pipeline.h" LLVOGround::LLVOGround(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp) -: LLStaticViewerObject(id, pcode, regionp) +: LLStaticViewerObject(id, pcode, regionp, TRUE) { mbCanSelect = FALSE; } diff --git a/linden/indra/newview/llvoicevisualizer.cpp b/linden/indra/newview/llvoicevisualizer.cpp index f00247b..ad00804 100644 --- a/linden/indra/newview/llvoicevisualizer.cpp +++ b/linden/indra/newview/llvoicevisualizer.cpp @@ -378,20 +378,20 @@ void LLVoiceVisualizer::render() //----------------------------- // bind texture 0 (the dot) //----------------------------- - mSoundSymbol.mTexture[0]->bind(); + gGL.getTexUnit(0)->bind(mSoundSymbol.mTexture[0]); //------------------------------------------------------------- // now render the dot //------------------------------------------------------------- gGL.color4fv( LLColor4( 1.0f, 1.0f, 1.0f, DOT_OPACITY ).mV ); - gGL.begin( LLVertexBuffer::TRIANGLE_STRIP ); + gGL.begin( LLRender::TRIANGLE_STRIP ); gGL.texCoord2i( 0, 0 ); gGL.vertex3fv( bottomLeft.mV ); gGL.texCoord2i( 1, 0 ); gGL.vertex3fv( bottomRight.mV ); gGL.texCoord2i( 0, 1 ); gGL.vertex3fv( topLeft.mV ); gGL.end(); - gGL.begin( LLVertexBuffer::TRIANGLE_STRIP ); + gGL.begin( LLRender::TRIANGLE_STRIP ); gGL.texCoord2i( 1, 0 ); gGL.vertex3fv( bottomRight.mV ); gGL.texCoord2i( 1, 1 ); gGL.vertex3fv( topRight.mV ); gGL.texCoord2i( 0, 1 ); gGL.vertex3fv( topLeft.mV ); @@ -503,18 +503,19 @@ void LLVoiceVisualizer::render() LLVector3 topRight = mSoundSymbol.mPosition - l + u; gGL.color4fv( LLColor4( red, green, blue, mSoundSymbol.mWaveOpacity[i] ).mV ); - mSoundSymbol.mTexture[i]->bind(); + gGL.getTexUnit(0)->bind(mSoundSymbol.mTexture[i]); + //--------------------------------------------------- // now, render the mofo //--------------------------------------------------- - gGL.begin( LLVertexBuffer::TRIANGLE_STRIP ); + gGL.begin( LLRender::TRIANGLE_STRIP ); gGL.texCoord2i( 0, 0 ); gGL.vertex3fv( bottomLeft.mV ); gGL.texCoord2i( 1, 0 ); gGL.vertex3fv( bottomRight.mV ); gGL.texCoord2i( 0, 1 ); gGL.vertex3fv( topLeft.mV ); gGL.end(); - gGL.begin( LLVertexBuffer::TRIANGLE_STRIP ); + gGL.begin( LLRender::TRIANGLE_STRIP ); gGL.texCoord2i( 1, 0 ); gGL.vertex3fv( bottomRight.mV ); gGL.texCoord2i( 1, 1 ); gGL.vertex3fv( topRight.mV ); gGL.texCoord2i( 0, 1 ); gGL.vertex3fv( topLeft.mV ); @@ -550,8 +551,8 @@ VoiceGesticulationLevel LLVoiceVisualizer::getCurrentGesticulationLevel() //----------------------------------------------------------------------------------------- F32 range = mMaxGesticulationAmplitude - mMinGesticulationAmplitude; - if ( mSpeakingAmplitude > mMinGesticulationAmplitude + range * 0.66666f ) { gesticulationLevel = VOICE_GESTICULATION_LEVEL_HIGH; } - else if ( mSpeakingAmplitude > mMinGesticulationAmplitude + range * 0.33333f ) { gesticulationLevel = VOICE_GESTICULATION_LEVEL_MEDIUM; } + if ( mSpeakingAmplitude > mMinGesticulationAmplitude + range * 0.5f ) { gesticulationLevel = VOICE_GESTICULATION_LEVEL_HIGH; } + else if ( mSpeakingAmplitude > mMinGesticulationAmplitude + range * 0.25f ) { gesticulationLevel = VOICE_GESTICULATION_LEVEL_MEDIUM; } else if ( mSpeakingAmplitude > mMinGesticulationAmplitude + range * 0.00000f ) { gesticulationLevel = VOICE_GESTICULATION_LEVEL_LOW; } return gesticulationLevel; diff --git a/linden/indra/newview/llvopartgroup.cpp b/linden/indra/newview/llvopartgroup.cpp index 11d7341..fb91cfa 100644 --- a/linden/indra/newview/llvopartgroup.cpp +++ b/linden/indra/newview/llvopartgroup.cpp @@ -95,7 +95,7 @@ void LLVOPartGroup::setPixelAreaAndAngle(LLAgent &agent) { // mPixelArea is calculated during render F32 mid_scale = getMidScale(); - F32 range = (getRenderPosition()-LLViewerCamera::getInstance()->getOrigin()).magVec(); + F32 range = (getRenderPosition()-LLViewerCamera::getInstance()->getOrigin()).length(); if (range < 0.001f || isHUDAttachment()) // range == zero { @@ -133,15 +133,16 @@ F32 LLVOPartGroup::getPartSize(S32 idx) return 0.f; } +LLVector3 LLVOPartGroup::getCameraPosition() const +{ + return gAgent.getCameraPositionAgent(); +} + BOOL LLVOPartGroup::updateGeometry(LLDrawable *drawable) { LLFastTimer ftm(LLFastTimer::FTM_UPDATE_PARTICLES); dirtySpatialGroup(); - - LLVector3 at; - LLVector3 position_agent; - LLVector3 camera_agent = LLViewerCamera::getInstance()->getOrigin(); S32 num_parts = mViewerPartGroupp->getCount(); LLFace *facep; @@ -187,9 +188,9 @@ BOOL LLVOPartGroup::updateGeometry(LLDrawable *drawable) const LLViewerPart *part = mViewerPartGroupp->mParticles[i]; LLVector3 part_pos_agent(part->mPosAgent); - at = part_pos_agent - camera_agent; + LLVector3 at(part_pos_agent - LLViewerCamera::getInstance()->getOrigin()); - F32 camera_dist_squared = at.magVecSquared(); + F32 camera_dist_squared = at.lengthSquared(); F32 inv_camera_dist_squared; if (camera_dist_squared > 1.f) inv_camera_dist_squared = 1.f / camera_dist_squared; @@ -278,36 +279,38 @@ void LLVOPartGroup::getGeometry(S32 idx, LLVector3 part_pos_agent(part.mPosAgent); - LLVector3 camera_agent = gAgent.getCameraPositionAgent(); + LLVector3 camera_agent = getCameraPosition(); LLVector3 at = part_pos_agent - camera_agent; - LLVector3 up, right; + LLVector3 up; + LLVector3 right; right = at % LLVector3(0.f, 0.f, 1.f); - right.normVec(); + right.normalize(); up = right % at; - up.normVec(); + up.normalize(); if (part.mFlags & LLPartData::LL_PART_FOLLOW_VELOCITY_MASK) { LLVector3 normvel = part.mVelocity; - normvel.normVec(); + normvel.normalize(); LLVector2 up_fracs; up_fracs.mV[0] = normvel*right; up_fracs.mV[1] = normvel*up; - up_fracs.normVec(); + up_fracs.normalize(); LLVector3 new_up; LLVector3 new_right; new_up = up_fracs.mV[0] * right + up_fracs.mV[1]*up; new_right = up_fracs.mV[1] * right - up_fracs.mV[0]*up; up = new_up; right = new_right; - up.normVec(); - right.normVec(); + up.normalize(); + right.normalize(); } right *= 0.5f*part.mScale.mV[0]; up *= 0.5f*part.mScale.mV[1]; + const LLVector3& normal = -LLViewerCamera::getInstance()->getXAxis(); *verticesp++ = part_pos_agent + up - right; @@ -355,6 +358,13 @@ LLParticlePartition::LLParticlePartition() mLODPeriod = 1; } +LLHUDParticlePartition::LLHUDParticlePartition() : + LLParticlePartition() +{ + mDrawableType = LLPipeline::RENDER_TYPE_HUD; + mPartitionType = LLViewerRegion::PARTITION_HUD_PARTICLE; +} + void LLParticlePartition::addGeometryCount(LLSpatialGroup* group, U32& vertex_count, U32& index_count) { group->mBufferUsage = mBufferUsage; @@ -480,3 +490,24 @@ F32 LLParticlePartition::calcPixelArea(LLSpatialGroup* group, LLCamera& camera) return 1024.f; } +U32 LLVOHUDPartGroup::getPartitionType() const +{ + // Commenting out and returning PARTITION_NONE because DEV-16909 + // (SVC-2396: Particles not handled properly as hud) didn't work completely + // so this disables HUD particles until they can be fixed properly. -MG + //return LLViewerRegion::PARTITION_HUD_PARTICLE; + return LLViewerRegion::PARTITION_NONE; +} + +LLDrawable* LLVOHUDPartGroup::createDrawable(LLPipeline *pipeline) +{ + pipeline->allocDrawable(this); + mDrawable->setLit(FALSE); + mDrawable->setRenderType(LLPipeline::RENDER_TYPE_HUD); + return mDrawable; +} + +LLVector3 LLVOHUDPartGroup::getCameraPosition() const +{ + return LLVector3(-1,0,0); +} diff --git a/linden/indra/newview/llvopartgroup.h b/linden/indra/newview/llvopartgroup.h index 5fe6750..037aa63 100644 --- a/linden/indra/newview/llvopartgroup.h +++ b/linden/indra/newview/llvopartgroup.h @@ -80,6 +80,23 @@ protected: ~LLVOPartGroup(); LLViewerPartGroup *mViewerPartGroupp; + + virtual LLVector3 getCameraPosition() const; + +}; + + +class LLVOHUDPartGroup : public LLVOPartGroup +{ +public: + LLVOHUDPartGroup(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp) : + LLVOPartGroup(id, pcode, regionp) + { + } +protected: + LLDrawable* createDrawable(LLPipeline *pipeline); + U32 getPartitionType() const; + virtual LLVector3 getCameraPosition() const; }; #endif // LL_LLVOPARTGROUP_H diff --git a/linden/indra/newview/llvosky.cpp b/linden/indra/newview/llvosky.cpp index 60f674e..8c3b718 100644 --- a/linden/indra/newview/llvosky.cpp +++ b/linden/indra/newview/llvosky.cpp @@ -294,7 +294,7 @@ void LLSkyTex::createGLImage(S32 which) void LLSkyTex::bindTexture(BOOL curr) { - mImageGL[getWhich(curr)]->bind(); + gGL.getTexUnit(0)->bind(mImageGL[getWhich(curr)]); } /*************************************** @@ -308,7 +308,7 @@ S32 LLVOSky::sTileResX = sResolution/NUM_TILES_X; S32 LLVOSky::sTileResY = sResolution/NUM_TILES_Y; LLVOSky::LLVOSky(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp) -: LLStaticViewerObject(id, pcode, regionp), +: LLStaticViewerObject(id, pcode, regionp, TRUE), mSun(SUN_DISK_RADIUS), mMoon(MOON_DISK_RADIUS), mBrightnessScale(1.f), mBrightnessScaleNew(0.f), @@ -528,7 +528,7 @@ void LLVOSky::initSkyTextureDirs(const S32 side, const S32 tile) coeff[x_coef] = F32((x<<1) + 1) * inv_res - 1.f; coeff[y_coef] = F32((y<<1) + 1) * inv_res - 1.f; LLVector3 dir(coeff[0], coeff[1], coeff[2]); - dir.normVec(); + dir.normalize(); mSkyTex[side].setDir(dir, x, y); mShinyTex[side].setDir(dir, x, y); } @@ -762,7 +762,7 @@ void LLVOSky::calcSkyColorWLVert(LLVector3 & Pn, LLColor3 & vary_HazeColor, LLCo Pn *= (-32000.f / Pn[1]); } - Plen = Pn.magVec(); + Plen = Pn.length(); Pn /= Plen; // Initialize temp variables @@ -1082,7 +1082,7 @@ BOOL LLVOSky::updateSky() const static F32 COLOR_CHANGE_THRESHOLD = 0.01f; LLVector3 direction = mSun.getDirection(); - direction.normVec(); + direction.normalize(); const F32 dot_lighting = direction * mLastLightingDirection; LLColor3 delta_color; @@ -1092,7 +1092,7 @@ BOOL LLVOSky::updateSky() if ( mForceUpdate || ((dot_lighting < LIGHT_DIRECTION_THRESHOLD) - || (delta_color.magVec() > COLOR_CHANGE_THRESHOLD) + || (delta_color.length() > COLOR_CHANGE_THRESHOLD) || !mInitialized) && !direction.isExactlyZero()) { @@ -1336,8 +1336,8 @@ BOOL LLVOSky::updateGeometry(LLDrawable *drawable) const LLVector3 &look_at = LLViewerCamera::getInstance()->getAtAxis(); LLVector3 right = look_at % LLVector3::z_axis; LLVector3 up = right % look_at; - right.normVec(); - up.normVec(); + right.normalize(); + up.normalize(); const static F32 elevation_factor = 0.0f/sResolution; const F32 cos_max_angle = cosHorizon(elevation_factor); @@ -1417,8 +1417,8 @@ BOOL LLVOSky::updateHeavenlyBodyGeometry(LLDrawable *drawable, const S32 f, cons LLVector3 hb_right = to_dir % LLVector3::z_axis; LLVector3 hb_up = hb_right % to_dir; - hb_right.normVec(); - hb_up.normVec(); + hb_right.normalize(); + hb_up.normalize(); //const static F32 cos_max_turn = sqrt(3.f) / 2; // 30 degrees //const F32 cos_turn_right = 1. / (llmax(cos_max_turn, hb_right * right)); @@ -1601,8 +1601,8 @@ void LLVOSky::updateSunHaloGeometry(LLDrawable *drawable ) const LLVector3 right = 2 * (v_corner[2] - v_corner[0]); LLVector3 up = 2 * (v_corner[2] - v_corner[3]); - up.normVec(); - F32 size = right.magVec(); + up.normalize(); + F32 size = right.length(); up = size * up; const LLVector3 draw_pos = 0.25 * (v_corner[0] + v_corner[1] + v_corner[2] + v_corner[3]); @@ -1654,7 +1654,7 @@ void LLVOSky::updateSunHaloGeometry(LLDrawable *drawable ) F32 dtReflection(const LLVector3& p, F32 cos_dir_from_top, F32 sin_dir_from_top, F32 diff_angl_dir) { LLVector3 P = p; - P.normVec(); + P.normalize(); const F32 cos_dir_angle = -P.mV[VZ]; const F32 sin_dir_angle = sqrt(1 - cos_dir_angle * cos_dir_angle); @@ -1679,9 +1679,9 @@ F32 dtClip(const LLVector3& v0, const LLVector3& v1, F32 far_clip2) { F32 dt_clip; const LLVector3 otrezok = v1 - v0; - const F32 A = otrezok.magVecSquared(); + const F32 A = otrezok.lengthSquared(); const F32 B = v0 * otrezok; - const F32 C = v0.magVecSquared() - far_clip2; + const F32 C = v0.lengthSquared() - far_clip2; const F32 det = sqrt(B*B - A*C); dt_clip = (-B - det) / A; if ((dt_clip < 0) || (dt_clip > 1)) @@ -1701,16 +1701,16 @@ void LLVOSky::updateReflectionGeometry(LLDrawable *drawable, F32 H, LLVector3 hb_pos = to_dir * (HORIZON_DIST - 10); LLVector3 to_dir_proj = to_dir; to_dir_proj.mV[VZ] = 0; - to_dir_proj.normVec(); + to_dir_proj.normalize(); LLVector3 Right = to_dir % LLVector3::z_axis; LLVector3 Up = Right % to_dir; - Right.normVec(); - Up.normVec(); + Right.normalize(); + Up.normalize(); // finding angle between look direction and sprite. LLVector3 look_at_right = look_at % LLVector3::z_axis; - look_at_right.normVec(); + look_at_right.normalize(); const static F32 cos_horizon_angle = cosHorizon(0.0f/sResolution); //const static F32 horizon_angle = acos(cos_horizon_angle); @@ -1745,7 +1745,7 @@ void LLVOSky::updateReflectionGeometry(LLDrawable *drawable, F32 H, else dt_hor = llmax(0.0f, llmin(1.0f, dt_hor)); - top_hb.normVec(); + top_hb.normalize(); const F32 cos_angle_of_view = fabs(top_hb.mV[VZ]); const F32 extension = llmin (5.0f, 1.0f / cos_angle_of_view); @@ -1762,11 +1762,11 @@ void LLVOSky::updateReflectionGeometry(LLDrawable *drawable, F32 H, F32 cos_dir_from_top[2]; LLVector3 dir = stretch_corner[0]; - dir.normVec(); + dir.normalize(); cos_dir_from_top[0] = dir.mV[VZ]; dir = stretch_corner[1]; - dir.normVec(); + dir.normalize(); cos_dir_from_top[1] = dir.mV[VZ]; const F32 sin_dir_from_top = sqrt(1 - cos_dir_from_top[0] * cos_dir_from_top[0]); @@ -1789,7 +1789,7 @@ void LLVOSky::updateReflectionGeometry(LLDrawable *drawable, F32 H, for (vtx = 0; vtx < 2; ++vtx) { LLVector3 light_proj = v_corner[vtx]; - light_proj.normVec(); + light_proj.normalize(); const F32 z = light_proj.mV[VZ]; const F32 sin_angle = sqrt(1 - z * z); @@ -1813,9 +1813,9 @@ void LLVOSky::updateReflectionGeometry(LLDrawable *drawable, F32 H, S32 side = 0; LLVector3 refl_corn_norm[2]; refl_corn_norm[0] = v_refl_corner[1]; - refl_corn_norm[0].normVec(); + refl_corn_norm[0].normalize(); refl_corn_norm[1] = v_refl_corner[3]; - refl_corn_norm[1].normVec(); + refl_corn_norm[1].normalize(); F32 cos_refl_look_at[2]; cos_refl_look_at[0] = refl_corn_norm[0] * look_at; @@ -1833,13 +1833,13 @@ void LLVOSky::updateReflectionGeometry(LLDrawable *drawable, F32 H, F32 dt_clip; F32 vtx_near2, vtx_far2; - if ((vtx_far2 = v_refl_corner[side].magVecSquared()) > far_clip2) + if ((vtx_far2 = v_refl_corner[side].lengthSquared()) > far_clip2) { // whole thing is sprite: reflection is beyond far clip plane. dt_clip = 1.1f; quads = 1; } - else if ((vtx_near2 = v_refl_corner[side+1].magVecSquared()) > far_clip2) + else if ((vtx_near2 = v_refl_corner[side+1].lengthSquared()) > far_clip2) { // part is reflection, the rest is sprite. dt_clip = dtClip(v_refl_corner[side + 1], v_refl_corner[side], far_clip2); @@ -1903,7 +1903,7 @@ void LLVOSky::updateReflectionGeometry(LLDrawable *drawable, F32 H, { for (S32 vtx = 0; vtx < 4; ++vtx) { - F32 ratio = far_clip / v_refl_corner[vtx].magVec(); + F32 ratio = far_clip / v_refl_corner[vtx].length(); *(verticesp++) = v_refl_corner[vtx] = ratio * v_refl_corner[vtx] + mCameraPosAgent; } const LLVector3 draw_pos = 0.25 * @@ -1912,10 +1912,10 @@ void LLVOSky::updateReflectionGeometry(LLDrawable *drawable, F32 H, } else { - F32 ratio = far_clip / v_refl_corner[1].magVec(); + F32 ratio = far_clip / v_refl_corner[1].length(); v_sprite_corner[1] = v_refl_corner[1] * ratio; - ratio = far_clip / v_refl_corner[3].magVec(); + ratio = far_clip / v_refl_corner[3].length(); v_sprite_corner[3] = v_refl_corner[3] * ratio; v_refl_corner[1] = (1 - dt_clip) * v_refl_corner[1] + dt_clip * v_refl_corner[0]; @@ -2039,20 +2039,20 @@ void LLVOSky::updateFog(const F32 distance) LLVector3 tosun = getToSunLast(); const F32 tosun_z = tosun.mV[VZ]; tosun.mV[VZ] = 0.f; - tosun.normVec(); + tosun.normalize(); LLVector3 perp_tosun; perp_tosun.mV[VX] = -tosun.mV[VY]; perp_tosun.mV[VY] = tosun.mV[VX]; LLVector3 tosun_45 = tosun + perp_tosun; - tosun_45.normVec(); + tosun_45.normalize(); F32 delta = 0.06f; tosun.mV[VZ] = delta; perp_tosun.mV[VZ] = delta; tosun_45.mV[VZ] = delta; - tosun.normVec(); - perp_tosun.normVec(); - tosun_45.normVec(); + tosun.normalize(); + perp_tosun.normalize(); + tosun_45.normalize(); // Sky colors, just slightly above the horizon in the direction of the sun, perpendicular to the sun, and at a 45 degree angle to the sun. initAtmospherics(); @@ -2202,8 +2202,8 @@ F32 azimuth(const LLVector3 &v) void LLVOSky::initSunDirection(const LLVector3 &sun_dir, const LLVector3 &sun_ang_velocity) { - LLVector3 sun_direction = (sun_dir.magVec() == 0) ? LLVector3::x_axis : sun_dir; - sun_direction.normVec(); + LLVector3 sun_direction = (sun_dir.length() == 0) ? LLVector3::x_axis : sun_dir; + sun_direction.normalize(); mSun.setDirection(sun_direction); mSun.renewDirection(); mSun.setAngularVelocity(sun_ang_velocity); @@ -2222,8 +2222,8 @@ void LLVOSky::initSunDirection(const LLVector3 &sun_dir, const LLVector3 &sun_an void LLVOSky::setSunDirection(const LLVector3 &sun_dir, const LLVector3 &sun_ang_velocity) { - LLVector3 sun_direction = (sun_dir.magVec() == 0) ? LLVector3::x_axis : sun_dir; - sun_direction.normVec(); + LLVector3 sun_direction = (sun_dir.length() == 0) ? LLVector3::x_axis : sun_dir; + sun_direction.normalize(); // Push the sun "South" as it approaches directly overhead so that we can always see bump mapping // on the upward facing faces of cubes. @@ -2239,7 +2239,7 @@ void LLVOSky::setSunDirection(const LLVector3 &sun_dir, const LLVector3 &sun_ang // Blend between normal sun dir and adjusted sun dir based on how close we are // to having the sun overhead. mBumpSunDir = adjustedDir * sunDot + newDir * (1.0f - sunDot); - mBumpSunDir.normVec(); + mBumpSunDir.normalize(); F32 dp = mLastLightingDirection * sun_direction; mSun.setDirection(sun_direction); diff --git a/linden/indra/newview/llvosurfacepatch.cpp b/linden/indra/newview/llvosurfacepatch.cpp index 310a745..7055b30 100644 --- a/linden/indra/newview/llvosurfacepatch.cpp +++ b/linden/indra/newview/llvosurfacepatch.cpp @@ -916,6 +916,87 @@ void LLVOSurfacePatch::getGeomSizesEast(const S32 stride, const S32 east_stride, } } +BOOL LLVOSurfacePatch::lineSegmentIntersect(const LLVector3& start, const LLVector3& end, S32 face, BOOL pick_transparent, S32 *face_hitp, + LLVector3* intersection,LLVector2* tex_coord, LLVector3* normal, LLVector3* bi_normal) + +{ + + if (!lineSegmentBoundingBox(start, end)) + { + return FALSE; + } + + LLVector3 delta = end-start; + + LLVector3 pdelta = delta; + pdelta.mV[2] = 0; + + F32 plength = pdelta.length(); + + F32 tdelta = 1.f/plength; + + LLVector3 origin = start - mRegionp->getOriginAgent(); + + if (mRegionp->getLandHeightRegion(origin) > origin.mV[2]) + { + //origin is under ground, treat as no intersection + return FALSE; + } + + //step one meter at a time until intersection point found + + F32 t = 0.f; + while ( t <= 1.f) + { + LLVector3 sample = origin + delta*t; + + F32 height = mRegionp->getLandHeightRegion(sample); + if (height > sample.mV[2]) + { //ray went below ground, positive intersection + //quick and dirty binary search to get impact point + tdelta = -tdelta*0.5f; + F32 err_dist = 0.001f; + F32 dist = fabsf(sample.mV[2] - height); + + while (dist > err_dist && tdelta*tdelta > 0.0f) + { + t += tdelta; + sample = origin+delta*t; + height = mRegionp->getLandHeightRegion(sample); + if ((tdelta < 0 && height < sample.mV[2]) || + (height > sample.mV[2] && tdelta > 0)) + { //jumped over intersection point, go back + tdelta = -tdelta; + } + tdelta *= 0.5f; + dist = fabsf(sample.mV[2] - height); + } + + if (intersection) + { + sample.mV[2] = mRegionp->getLandHeightRegion(sample); + *intersection = sample + mRegionp->getOriginAgent(); + } + + if (normal) + { + *normal = mRegionp->getLand().resolveNormalGlobal(mRegionp->getPosGlobalFromRegion(sample)); + } + + return TRUE; + } + + t += tdelta; + if (t > 1 && t < 1.f+tdelta*0.99f) + { //make sure end point is checked (saves vertical lines coming up negative) + t = 1.f; + } + } + + + return FALSE; +} + void LLVOSurfacePatch::updateSpatialExtents(LLVector3& newMin, LLVector3 &newMax) { LLVector3 posAgent = getPositionAgent(); diff --git a/linden/indra/newview/llvosurfacepatch.h b/linden/indra/newview/llvosurfacepatch.h index 52c11c9..f014ca6 100644 --- a/linden/indra/newview/llvosurfacepatch.h +++ b/linden/indra/newview/llvosurfacepatch.h @@ -85,6 +85,16 @@ public: void dirtyPatch(); void dirtyGeom(); + /*virtual*/ BOOL lineSegmentIntersect(const LLVector3& start, const LLVector3& end, + S32 face = -1, // which face to check, -1 = ALL_SIDES + BOOL pick_transparent = FALSE, + S32* face_hit = NULL, // which face was hit + LLVector3* intersection = NULL, // return the intersection point + LLVector2* tex_coord = NULL, // return the texture coordinates of the intersection point + LLVector3* normal = NULL, // return the surface normal at the intersection point + LLVector3* bi_normal = NULL // return the surface bi-normal at the intersection point + ); + BOOL mDirtiedPatch; protected: ~LLVOSurfacePatch(); diff --git a/linden/indra/newview/llvotextbubble.cpp b/linden/indra/newview/llvotextbubble.cpp index 5424cc8..69b57d9 100644 --- a/linden/indra/newview/llvotextbubble.cpp +++ b/linden/indra/newview/llvotextbubble.cpp @@ -126,7 +126,7 @@ void LLVOTextBubble::updateTextures(LLAgent &agent) LLVector3 position_local = getPositionAgent() - agent.getCameraPositionAgent(); F32 dot_product = position_local * agent.getFrameAgent().getAtAxis(); - F32 cos_angle = dot_product / position_local.magVec(); + F32 cos_angle = dot_product / position_local.length(); if (cos_angle > 1.f) { diff --git a/linden/indra/newview/llvotree.cpp b/linden/indra/newview/llvotree.cpp index c86803d..06ab222 100644 --- a/linden/indra/newview/llvotree.cpp +++ b/linden/indra/newview/llvotree.cpp @@ -273,9 +273,9 @@ U32 LLVOTree::processUpdateMessage(LLMessageSystem *mesgsys, // Do base class updates... U32 retval = LLViewerObject::processUpdateMessage(mesgsys, user_data, block_num, update_type, dp); - if ( (getVelocity().magVecSquared() > 0.f) - ||(getAcceleration().magVecSquared() > 0.f) - ||(getAngularVelocity().magVecSquared() > 0.f)) + if ( (getVelocity().lengthSquared() > 0.f) + ||(getAcceleration().lengthSquared() > 0.f) + ||(getAngularVelocity().lengthSquared() > 0.f)) { llinfos << "ACK! Moving tree!" << llendl; setVelocity(LLVector3::zero); @@ -312,7 +312,7 @@ U32 LLVOTree::processUpdateMessage(LLMessageSystem *mesgsys, mTreeImagep = gImageList.getImage(sSpeciesTable[mSpecies]->mTextureID); if (mTreeImagep) { - mTreeImagep->bindTexture(0); + gGL.getTexUnit(0)->bind(mTreeImagep.get()); } mBranchLength = sSpeciesTable[mSpecies]->mBranchLength; mTrunkLength = sSpeciesTable[mSpecies]->mTrunkLength; @@ -359,14 +359,14 @@ BOOL LLVOTree::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time) mTrunkBend += mTrunkVel; mTrunkVel *= 0.99f; // Add damping - if (mTrunkBend.magVec() > 1.f) + if (mTrunkBend.length() > 1.f) { - mTrunkBend.normVec(); + mTrunkBend.normalize(); } - if (mTrunkVel.magVec() > 1.f) + if (mTrunkVel.length() > 1.f) { - mTrunkVel.normVec(); + mTrunkVel.normalize(); } return TRUE; @@ -391,7 +391,7 @@ void LLVOTree::setPixelAreaAndAngle(LLAgent &agent) // This should be the camera's center, as soon as we move to all region-local. LLVector3 relative_position = getPositionAgent() - agent.getCameraPositionAgent(); - F32 range = relative_position.magVec(); // ugh, square root + F32 range = relative_position.length(); // ugh, square root F32 max_scale = mBillboardScale * getMaxScale(); F32 area = max_scale * (max_scale*mBillboardRatio); @@ -713,9 +713,9 @@ BOOL LLVOTree::updateGeometry(LLDrawable *drawable) LLVector2 tc; // This isn't totally accurate. Should compute based on slope as well. start_radius = r0 * (1.f + 1.2f*fabs(z - 0.66f*height)/height); - nvec.setVec( cos(nangle * DEG_TO_RAD)*start_radius*nvec_scale, - sin(nangle * DEG_TO_RAD)*start_radius*nvec_scale, - z*nvec_scalez); + nvec.set( cos(nangle * DEG_TO_RAD)*start_radius*nvec_scale, + sin(nangle * DEG_TO_RAD)*start_radius*nvec_scale, + z*nvec_scalez); // First and last slice at 0 radius (to bring in top/bottom of structure) radius = start_radius + turbulence3((F32*)&nvec.mV, (F32)fractal_depth)*noise_scale; @@ -918,7 +918,7 @@ void LLVOTree::updateRadius() void LLVOTree::updateSpatialExtents(LLVector3& newMin, LLVector3& newMax) { - F32 radius = getScale().magVec()*0.05f; + F32 radius = getScale().length()*0.05f; LLVector3 center = getRenderPosition(); F32 sz = mBillboardScale*mBillboardRatio*radius*0.5f; @@ -926,11 +926,53 @@ void LLVOTree::updateSpatialExtents(LLVector3& newMin, LLVector3& newMax) center += LLVector3(0, 0, size.mV[2]) * getRotation(); - newMin.setVec(center-size); - newMax.setVec(center+size); + newMin.set(center-size); + newMax.set(center+size); mDrawable->setPositionGroup(center); } +BOOL LLVOTree::lineSegmentIntersect(const LLVector3& start, const LLVector3& end, S32 face, BOOL pick_transparent, S32 *face_hitp, + LLVector3* intersection,LLVector2* tex_coord, LLVector3* normal, LLVector3* bi_normal) + +{ + + if (!lineSegmentBoundingBox(start, end)) + { + return FALSE; + } + + const LLVector3* ext = mDrawable->getSpatialExtents(); + + LLVector3 center = (ext[1]+ext[0])*0.5f; + LLVector3 size = (ext[1]-ext[0]); + + LLQuaternion quat = getRotation(); + + center -= LLVector3(0,0,size.magVec() * 0.25f)*quat; + + size.scaleVec(LLVector3(0.25f, 0.25f, 1.f)); + size.mV[0] = llmin(size.mV[0], 1.f); + size.mV[1] = llmin(size.mV[1], 1.f); + + LLVector3 pos, norm; + + if (linesegment_tetrahedron(start, end, center, size, quat, pos, norm)) + { + if (intersection) + { + *intersection = pos; + } + + if (normal) + { + *normal = norm; + } + return TRUE; + } + + return FALSE; +} + U32 LLVOTree::getPartitionType() const { return LLViewerRegion::PARTITION_TREE; diff --git a/linden/indra/newview/llvotree.h b/linden/indra/newview/llvotree.h index 180e5b0..d6152a5 100644 --- a/linden/indra/newview/llvotree.h +++ b/linden/indra/newview/llvotree.h @@ -80,6 +80,17 @@ public: U32 drawBranchPipeline(LLMatrix4& matrix, U16* indicesp, S32 trunk_LOD, S32 stop_level, U16 depth, U16 trunk_depth, F32 scale, F32 twist, F32 droop, F32 branches, F32 alpha); + + /*virtual*/ BOOL lineSegmentIntersect(const LLVector3& start, const LLVector3& end, + S32 face = -1, // which face to check, -1 = ALL_SIDES + BOOL pick_transparent = FALSE, + S32* face_hit = NULL, // which face was hit + LLVector3* intersection = NULL, // return the intersection point + LLVector2* tex_coord = NULL, // return the texture coordinates of the intersection point + LLVector3* normal = NULL, // return the surface normal at the intersection point + LLVector3* bi_normal = NULL // return the surface bi-normal at the intersection point + ); + static S32 sMaxTreeSpecies; struct TreeSpeciesData diff --git a/linden/indra/newview/llvovolume.cpp b/linden/indra/newview/llvovolume.cpp index 9d8369f..47289ff 100644 --- a/linden/indra/newview/llvovolume.cpp +++ b/linden/indra/newview/llvovolume.cpp @@ -90,7 +90,7 @@ LLVOVolume::LLVOVolume(const LLUUID &id, const LLPCode pcode, LLViewerRegion *re mLOD = MIN_LOD; mSculptLevel = -2; mTextureAnimp = NULL; - mVObjRadius = LLVector3(1,1,0.5f).magVec(); + mVObjRadius = LLVector3(1,1,0.5f).length(); mNumFaces = 0; mLODChanged = FALSE; mSculptChanged = FALSE; @@ -577,7 +577,7 @@ F32 LLVOVolume::getTextureVirtualSize(LLFace* face) //get area of circle in texture space LLVector2 tdim = face->mTexExtents[1] - face->mTexExtents[0]; - F32 texel_area = (tdim * 0.5f).magVecSquared()*3.14159f; + F32 texel_area = (tdim * 0.5f).lengthSquared()*3.14159f; if (texel_area <= 0) { // Probably animated, use default @@ -605,7 +605,7 @@ BOOL LLVOVolume::setMaterial(const U8 material) void LLVOVolume::setTexture(const S32 face) { llassert(face < getNumTEs()); - LLViewerImage::bindTexture(getTEImage(face)); + gGL.getTexUnit(0)->bind(getTEImage(face)); } void LLVOVolume::setScale(const LLVector3 &scale, BOOL damped) @@ -828,7 +828,7 @@ BOOL LLVOVolume::calcLOD() S32 cur_detail = 0; - F32 radius = getVolume()->mLODScaleBias.scaledVec(getScale()).magVec(); + F32 radius = getVolume()->mLODScaleBias.scaledVec(getScale()).length(); F32 distance = mDrawable->mDistanceWRTCamera; distance *= sDistanceFactor; @@ -1687,7 +1687,7 @@ void LLVOVolume::generateSilhouette(LLSelectNode* nodep, const LLVector3& view_p //transform view vector into volume space view_vector -= getRenderPosition(); - mDrawable->mDistanceWRTCamera = view_vector.magVec(); + mDrawable->mDistanceWRTCamera = view_vector.length(); LLQuaternion worldRot = getRenderRotation(); view_vector = view_vector * ~worldRot; if (!isVolumeGlobal()) @@ -1728,7 +1728,7 @@ void LLVOVolume::updateRadius() return; } - mVObjRadius = getScale().magVec(); + mVObjRadius = getScale().length(); mDrawable->setRadius(mVObjRadius); } @@ -1841,7 +1841,7 @@ F32 LLVOVolume::getBinRadius() } else if (shrink_wrap) { - radius = (ext[1]-ext[0]).magVec()*0.5f; + radius = (ext[1]-ext[0]).length()*0.5f; } else if (mDrawable->isStatic()) { @@ -1934,10 +1934,18 @@ LLVector3 LLVOVolume::volumeDirectionToAgent(const LLVector3& dir) const } -BOOL LLVOVolume::lineSegmentIntersect(const LLVector3& start, const LLVector3& end, S32 face, S32 *face_hitp, +BOOL LLVOVolume::lineSegmentIntersect(const LLVector3& start, const LLVector3& end, S32 face, BOOL pick_transparent, S32 *face_hitp, LLVector3* intersection,LLVector2* tex_coord, LLVector3* normal, LLVector3* bi_normal) { + if (!mbCanSelect || + (gHideSelectedObjects && isSelected()) || + mDrawable->isDead() || + !gPipeline.hasRenderType(mDrawable->getRenderType())) + { + return FALSE; + } + LLVolume* volume = getVolume(); if (volume) { @@ -1946,37 +1954,88 @@ BOOL LLVOVolume::lineSegmentIntersect(const LLVector3& start, const LLVector3& e v_start = agentPositionToVolume(start); v_end = agentPositionToVolume(end); - S32 face_hit = volume->lineSegmentIntersect(v_start, v_end, face, - intersection, tex_coord, normal, bi_normal); - if (face_hit >= 0) + LLVector3 p; + LLVector3 n; + LLVector2 tc; + LLVector3 bn; + + if (intersection != NULL) { - if (face_hitp != NULL) - { - *face_hitp = face_hit; - } + p = *intersection; + } + + if (tex_coord != NULL) + { + tc = *tex_coord; + } + + if (normal != NULL) + { + n = *normal; + } + + if (bi_normal != NULL) + { + bn = *bi_normal; + } + + S32 face_hit = -1; + + S32 start_face, end_face; + if (face == -1) + { + start_face = 0; + end_face = volume->getNumFaces(); + } + else + { + start_face = face; + end_face = face+1; + } + + for (S32 i = start_face; i < end_face; ++i) + { + face_hit = volume->lineSegmentIntersect(v_start, v_end, i, + &p, &tc, &n, &bn); - if (intersection != NULL) + if (face_hit >= 0) { - *intersection = volumePositionToAgent(*intersection); // must map back to agent space - } + LLFace* face = mDrawable->getFace(face_hit); + if (pick_transparent || !face->getTexture() || face->getTexture()->getMask(face->surfaceToTexture(tc, p, n))) + { + if (face_hitp != NULL) + { + *face_hitp = face_hit; + } + + if (intersection != NULL) + { + *intersection = volumePositionToAgent(p); // must map back to agent space + } - if (normal != NULL) - { - *normal = volumeDirectionToAgent(*normal); - (*normal).normVec(); - } + if (normal != NULL) + { + *normal = volumeDirectionToAgent(n); + (*normal).normVec(); + } - if (bi_normal != NULL) - { - *bi_normal = volumeDirectionToAgent(*bi_normal); - (*bi_normal).normVec(); - } + if (bi_normal != NULL) + { + *bi_normal = volumeDirectionToAgent(bn); + (*bi_normal).normVec(); + } - - return TRUE; + if (tex_coord != NULL) + { + *tex_coord = tc; + } + + return TRUE; + } + } } } - + return FALSE; } diff --git a/linden/indra/newview/llvovolume.h b/linden/indra/newview/llvovolume.h index d8828f0..9502bc3 100644 --- a/linden/indra/newview/llvovolume.h +++ b/linden/indra/newview/llvovolume.h @@ -114,6 +114,7 @@ public: /*virtual*/ BOOL lineSegmentIntersect(const LLVector3& start, const LLVector3& end, S32 face = -1, // which face to check, -1 = ALL_SIDES + BOOL pick_transparent = FALSE, S32* face_hit = NULL, // which face was hit LLVector3* intersection = NULL, // return the intersection point LLVector2* tex_coord = NULL, // return the texture coordinates of the intersection point diff --git a/linden/indra/newview/llvowlsky.cpp b/linden/indra/newview/llvowlsky.cpp index 159603e..7c8e874 100644 --- a/linden/indra/newview/llvowlsky.cpp +++ b/linden/indra/newview/llvowlsky.cpp @@ -87,7 +87,7 @@ inline U32 LLVOWLSky::getStarsNumIndices(void) } LLVOWLSky::LLVOWLSky(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp) - : LLStaticViewerObject(id, pcode, regionp) + : LLStaticViewerObject(id, pcode, regionp, TRUE) { initStars(); } @@ -488,7 +488,7 @@ void LLVOWLSky::drawStars(void) if (mStarsVerts.notNull()) { mStarsVerts->setBuffer(LLDrawPoolWLSky::STAR_VERTEX_DATA_MASK); - mStarsVerts->draw(LLVertexBuffer::POINTS, getStarsNumIndices(), 0); + mStarsVerts->draw(LLRender::POINTS, getStarsNumIndices(), 0); } } @@ -513,7 +513,7 @@ void LLVOWLSky::drawDome(void) strips_segment->setBuffer(data_mask); strips_segment->drawRange( - LLVertexBuffer::TRIANGLE_STRIP, + LLRender::TRIANGLE_STRIP, 0, strips_segment->getRequestedVerts()-1, strips_segment->getRequestedIndices(), 0); gPipeline.addTrianglesDrawn(strips_segment->getRequestedIndices() - 2); diff --git a/linden/indra/newview/llwaterparammanager.cpp b/linden/indra/newview/llwaterparammanager.cpp index f4f1163..e61c5b6 100644 --- a/linden/indra/newview/llwaterparammanager.cpp +++ b/linden/indra/newview/llwaterparammanager.cpp @@ -89,48 +89,57 @@ LLWaterParamManager::~LLWaterParamManager() void LLWaterParamManager::loadAllPresets(const std::string& file_name) { std::string path_name(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight/water", "")); - LL_INFOS2("AppInit", "Shaders") << "Loading water settings from " << path_name << LL_ENDL; - - //mParamList.clear(); - + LL_INFOS2("AppInit", "Shaders") << "Loading Default water settings from " << path_name << LL_ENDL; + bool found = true; while(found) { std::string name; found = gDirUtilp->getNextFileInDir(path_name, "*.xml", name, false); - - LL_DEBUGS2("AppInit", "Shaders") << "name: " << name << LL_ENDL; - - // if we have one - if(found) + if(found) { + + name=name.erase(name.length()-4); + // bugfix for SL-46920: preventing filenames that break stuff. char * curl_str = curl_unescape(name.c_str(), name.size()); std::string unescaped_name(curl_str); curl_free(curl_str); curl_str = NULL; - // not much error checking here since we're getting rid of this - std::string water_name = unescaped_name.substr(0, unescaped_name.size() - 4); - - std::string cur_path(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight/water", name)); - LL_DEBUGS2("AppInit", "Shaders") << "Loading water from " << cur_path << LL_ENDL; + LL_DEBUGS2("AppInit", "Shaders") << "name: " << name << LL_ENDL; + loadPreset(unescaped_name,FALSE); + } + } + + // And repeat for user presets, note the user presets will modify any system presets already loaded + + std::string path_name2(gDirUtilp->getExpandedFilename( LL_PATH_USER_SETTINGS , "windlight/water", "")); + LL_INFOS2("AppInit", "Shaders") << "Loading User water settings from " << path_name2 << LL_ENDL; - llifstream water_xml(cur_path); - if (water_xml) - { - LLSD water_data(LLSD::emptyMap()); - LLPointer parser = new LLSDXMLParser(); - parser->parse(water_xml, water_data, LLSDSerialize::SIZE_UNLIMITED); + found = true; + while(found) + { + std::string name; + found = gDirUtilp->getNextFileInDir(path_name2, "*.xml", name, false); + if(found) + { + name=name.erase(name.length()-4); - addParamSet(water_name, water_data); - water_xml.close(); - } + // bugfix for SL-46920: preventing filenames that break stuff. + char * curl_str = curl_unescape(name.c_str(), name.size()); + std::string unescaped_name(curl_str); + curl_free(curl_str); + curl_str = NULL; + + LL_DEBUGS2("AppInit", "Shaders") << "name: " << name << LL_ENDL; + loadPreset(unescaped_name,FALSE); } } + } -void LLWaterParamManager::loadPreset(const std::string & name) +void LLWaterParamManager::loadPreset(const std::string & name,bool propagate) { // bugfix for SL-46920: preventing filenames that break stuff. char * curl_str = curl_escape(name.c_str(), name.size()); @@ -142,8 +151,17 @@ void LLWaterParamManager::loadPreset(const std::string & name) std::string pathName(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight/water", escaped_filename)); llinfos << "Loading water settings from " << pathName << llendl; - - llifstream presetsXML(pathName); + + std::ifstream presetsXML; + presetsXML.open(pathName.c_str()); + + // That failed, try loading from the users area instead. + if(!presetsXML) + { + pathName=gDirUtilp->getExpandedFilename( LL_PATH_USER_SETTINGS , "windlight/water", escaped_filename); + llinfos << "Loading User water setting from " << pathName << llendl; + presetsXML.open(pathName.c_str()); + } if (presetsXML) { @@ -170,10 +188,12 @@ void LLWaterParamManager::loadPreset(const std::string & name) return; } - getParamSet(name, mCurParams); - - propagateParameters(); -} + if(propagate) + { + getParamSet(name, mCurParams); + propagateParameters(); + } +} void LLWaterParamManager::savePreset(const std::string & name) { @@ -187,7 +207,7 @@ void LLWaterParamManager::savePreset(const std::string & name) // make an empty llsd LLSD paramsData(LLSD::emptyMap()); - std::string pathName(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight/water", escaped_filename)); + std::string pathName(gDirUtilp->getExpandedFilename( LL_PATH_USER_SETTINGS , "windlight/water", escaped_filename)); // fill it with LLSD windlight params paramsData = mParamList[name].getAll(); @@ -390,7 +410,8 @@ bool LLWaterParamManager::removeParamSet(const std::string& name, bool delete_fr if(delete_from_disk) { - std::string path_name(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight/water", "")); + + std::string path_name(gDirUtilp->getExpandedFilename( LL_PATH_USER_SETTINGS , "windlight/water", "")); // use full curl escaped name char * curl_str = curl_escape(name.c_str(), name.size()); diff --git a/linden/indra/newview/llwaterparammanager.h b/linden/indra/newview/llwaterparammanager.h index 872725e..a351697 100644 --- a/linden/indra/newview/llwaterparammanager.h +++ b/linden/indra/newview/llwaterparammanager.h @@ -228,7 +228,8 @@ public: void loadAllPresets(const std::string & fileName); /// load an individual preset into the sky - void loadPreset(const std::string & name); + + void loadPreset(const std::string & name,bool propagate=true); /// save the parameter presets to file void savePreset(const std::string & name); diff --git a/linden/indra/newview/llwebbrowserctrl.cpp b/linden/indra/newview/llwebbrowserctrl.cpp index e9a7132..8c56e5c 100644 --- a/linden/indra/newview/llwebbrowserctrl.cpp +++ b/linden/indra/newview/llwebbrowserctrl.cpp @@ -596,14 +596,14 @@ void LLWebBrowserCtrl::draw() } // scale texture to fit the space using texture coords - mWebBrowserImage->bindTexture(); + gGL.getTexUnit(0)->bind(mWebBrowserImage->getTexture()); gGL.color4fv( LLColor4::white.mV ); F32 max_u = ( F32 )mWebBrowserImage->getBrowserWidth() / ( F32 )mWebBrowserImage->getWidth(); F32 max_v = ( F32 )mWebBrowserImage->getBrowserHeight() / ( F32 )mWebBrowserImage->getHeight(); // draw the browser gGL.setSceneBlendType(LLRender::BT_REPLACE); - gGL.begin( LLVertexBuffer::QUADS ); + gGL.begin( LLRender::QUADS ); { // render using web browser reported width and height, instead of trying to invert GL scale gGL.texCoord2f( max_u, max_v ); diff --git a/linden/indra/newview/llwindebug.cpp b/linden/indra/newview/llwindebug.cpp index d2f6748..04457eb 100644 --- a/linden/indra/newview/llwindebug.cpp +++ b/linden/indra/newview/llwindebug.cpp @@ -42,6 +42,7 @@ #pragma warning(disable: 4200) //nonstandard extension used : zero-sized array in struct/union #pragma warning(disable: 4100) //unreferenced formal parameter + /* LLSD Block for Windows Dump Information @@ -552,6 +553,58 @@ void LLMemoryReserve::release() static LLMemoryReserve gEmergencyMemoryReserve; +#ifndef _M_IX86 + #error "The following code only works for x86!" +#endif +LPTOP_LEVEL_EXCEPTION_FILTER WINAPI MyDummySetUnhandledExceptionFilter( + LPTOP_LEVEL_EXCEPTION_FILTER lpTopLevelExceptionFilter) +{ + if(lpTopLevelExceptionFilter == gFilterFunc) + return gFilterFunc; + + llinfos << "Someone tried to set the exception filter. Listing call stack modules" << llendl; + LLSD cs_info; + GetCallStackData(NULL, cs_info); + + if(cs_info.has("CallStack") && cs_info["CallStack"].isArray()) + { + LLSD cs = cs_info["CallStack"]; + for(LLSD::array_iterator i = cs.beginArray(); + i != cs.endArray(); + ++i) + { + llinfos << "Module: " << (*i)["ModuleName"] << llendl; + } + } + + return gFilterFunc; +} + +BOOL PreventSetUnhandledExceptionFilter() +{ + HMODULE hKernel32 = LoadLibrary(_T("kernel32.dll")); + if (hKernel32 == NULL) + return FALSE; + + void *pOrgEntry = GetProcAddress(hKernel32, "SetUnhandledExceptionFilter"); + if(pOrgEntry == NULL) + return FALSE; + + unsigned char newJump[ 100 ]; + DWORD dwOrgEntryAddr = (DWORD)pOrgEntry; + dwOrgEntryAddr += 5; // add 5 for 5 op-codes for jmp far + void *pNewFunc = &MyDummySetUnhandledExceptionFilter; + DWORD dwNewEntryAddr = (DWORD) pNewFunc; + DWORD dwRelativeAddr = dwNewEntryAddr - dwOrgEntryAddr; + + newJump[ 0 ] = 0xE9; // JMP absolute + memcpy(&newJump[ 1 ], &dwRelativeAddr, sizeof(pNewFunc)); + SIZE_T bytesWritten; + BOOL bRet = WriteProcessMemory(GetCurrentProcess(), + pOrgEntry, newJump, sizeof(pNewFunc) + 1, &bytesWritten); + return bRet; +} + // static void LLWinDebug::initExceptionHandler(LPTOP_LEVEL_EXCEPTION_FILTER filter_func) { @@ -602,6 +655,9 @@ void LLWinDebug::initExceptionHandler(LPTOP_LEVEL_EXCEPTION_FILTER filter_func) LPTOP_LEVEL_EXCEPTION_FILTER prev_filter; prev_filter = SetUnhandledExceptionFilter(filter_func); + // *REMOVE:Mani + //PreventSetUnhandledExceptionFilter(); + if(prev_filter != gFilterFunc) { LL_WARNS("AppInit") @@ -737,3 +793,10 @@ void LLWinDebug::generateCrashStacks(struct _EXCEPTION_POINTERS *exception_infop LLSDSerialize::toPrettyXML(info, out_file); out_file.close(); } + +void LLWinDebug::clearCrashStacks() +{ + LLSD info; + std::string dump_path = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, "SecondLifeException.log"); + LLFile::remove(dump_path); +} diff --git a/linden/indra/newview/llwindebug.h b/linden/indra/newview/llwindebug.h index eef2340..e6e32b4 100644 --- a/linden/indra/newview/llwindebug.h +++ b/linden/indra/newview/llwindebug.h @@ -39,7 +39,6 @@ class LLWinDebug { public: - /** * @brief initialize the llwindebug exception filter callback * @@ -66,6 +65,8 @@ public: static bool checkExceptionHandler(); static void generateCrashStacks(struct _EXCEPTION_POINTERS *pExceptionInfo = NULL); + static void clearCrashStacks(); // Delete the crash stack file(s). + static void writeDumpToFile(MINIDUMP_TYPE type, MINIDUMP_EXCEPTION_INFORMATION *ExInfop, const std::string& filename); private: }; diff --git a/linden/indra/newview/llwlparammanager.cpp b/linden/indra/newview/llwlparammanager.cpp index 1707fe9..b522284 100644 --- a/linden/indra/newview/llwlparammanager.cpp +++ b/linden/indra/newview/llwlparammanager.cpp @@ -106,84 +106,65 @@ LLWLParamManager::~LLWLParamManager() void LLWLParamManager::loadPresets(const std::string& file_name) { - // if fileName exists, use legacy loading form the big file, otherwise, search the sky - // directory, and add the list - if(file_name != "") + std::string path_name(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight/skies", "")); + LL_INFOS2("AppInit", "Shaders") << "Loading Default WindLight settings from " << path_name << LL_ENDL; + + bool found = true; + while(found) { - std::string path_name(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight", file_name)); - LL_INFOS2("AppInit", "Shaders") << "Loading WindLight settings from " << path_name << LL_ENDL; - - llifstream presetsXML(path_name); - - if (presetsXML) + std::string name; + found = gDirUtilp->getNextFileInDir(path_name, "*.xml", name, false); + if(found) { - LLSD paramsData(LLSD::emptyMap()); - LLPointer parser = new LLSDXMLParser(); + name=name.erase(name.length()-4); - parser->parse(presetsXML, paramsData, LLSDSerialize::SIZE_UNLIMITED); + // bugfix for SL-46920: preventing filenames that break stuff. + char * curl_str = curl_unescape(name.c_str(), name.size()); + std::string unescaped_name(curl_str); + curl_free(curl_str); + curl_str = NULL; - LLSD::map_const_iterator endParams = paramsData.endMap(); - for(LLSD::map_const_iterator curParams = paramsData.beginMap(); - curParams != endParams; - ++curParams) - { - addParamSet(curParams->first, curParams->second); - } + LL_DEBUGS2("AppInit", "Shaders") << "name: " << name << LL_ENDL; + loadPreset(unescaped_name,FALSE); } } - - // otherwise, search the sky directory and find things there - else + + // And repeat for user presets, note the user presets will modify any system presets already loaded + + std::string path_name2(gDirUtilp->getExpandedFilename( LL_PATH_USER_SETTINGS , "windlight/skies", "")); + LL_INFOS2("AppInit", "Shaders") << "Loading User WindLight settings from " << path_name2 << LL_ENDL; + + found = true; + while(found) { - std::string path_name(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight/skies", "")); - LL_INFOS2("AppInit", "Shaders") << "Loading WindLight settings from " << path_name << LL_ENDL; - - //mParamList.clear(); - - bool found = true; - while(found) + std::string name; + found = gDirUtilp->getNextFileInDir(path_name2, "*.xml", name, false); + if(found) { - std::string name; - found = gDirUtilp->getNextFileInDir(path_name, "*.xml", name, false); + name=name.erase(name.length()-4); + + // bugfix for SL-46920: preventing filenames that break stuff. + char * curl_str = curl_unescape(name.c_str(), name.size()); + std::string unescaped_name(curl_str); + curl_free(curl_str); + curl_str = NULL; LL_DEBUGS2("AppInit", "Shaders") << "name: " << name << LL_ENDL; - - // if we have one - if(found) - { - // bugfix for SL-46920: preventing filenames that break stuff. - char * curl_str = curl_unescape(name.c_str(), name.size()); - std::string unescaped_name(curl_str); - curl_free(curl_str); - curl_str = NULL; - - // not much error checking here since we're getting rid of this - std::string sky_name = unescaped_name.substr(0, unescaped_name.size() - 4); - - std::string cur_path(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight/skies", name)); - LL_DEBUGS2("AppInit", "Shaders") << "Loading sky from " << cur_path << LL_ENDL; - - llifstream sky_xml(cur_path); - if (sky_xml) - { - LLSD sky_data(LLSD::emptyMap()); - LLPointer parser = new LLSDXMLParser(); - parser->parse(sky_xml, sky_data, LLSDSerialize::SIZE_UNLIMITED); - - addParamSet(sky_name, sky_data); - sky_xml.close(); - } - } + loadPreset(unescaped_name,FALSE); } } + } void LLWLParamManager::savePresets(const std::string & fileName) { + //Nobody currently calls me, but if they did, then its reasonable to write the data out to the user's folder + //and not over the RO system wide version. + LLSD paramsData(LLSD::emptyMap()); - std::string pathName(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight", fileName)); + std::string pathName(gDirUtilp->getExpandedFilename( LL_PATH_USER_SETTINGS , "windlight", fileName)); for(std::map::iterator mIt = mParamList.begin(); mIt != mParamList.end(); @@ -201,8 +182,9 @@ void LLWLParamManager::savePresets(const std::string & fileName) presetsXML.close(); } -void LLWLParamManager::loadPreset(const std::string & name) +void LLWLParamManager::loadPreset(const std::string & name,bool propagate) { + // bugfix for SL-46920: preventing filenames that break stuff. char * curl_str = curl_escape(name.c_str(), name.size()); std::string escaped_filename(curl_str); @@ -214,7 +196,16 @@ void LLWLParamManager::loadPreset(const std::string & name) std::string pathName(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight/skies", escaped_filename)); llinfos << "Loading WindLight sky setting from " << pathName << llendl; - llifstream presetsXML(pathName); + llifstream presetsXML; + presetsXML.open(pathName.c_str()); + + // That failed, try loading from the users area instead. + if(!presetsXML) + { + pathName=gDirUtilp->getExpandedFilename( LL_PATH_USER_SETTINGS , "windlight/skies", escaped_filename); + llinfos << "Loading User WindLight sky setting from " << pathName << llendl; + presetsXML.open(pathName.c_str()); + } if (presetsXML) { @@ -241,10 +232,13 @@ void LLWLParamManager::loadPreset(const std::string & name) return; } - getParamSet(name, mCurParams); - - propagateParameters(); -} + + if(propagate) + { + getParamSet(name, mCurParams); + propagateParameters(); + } +} void LLWLParamManager::savePreset(const std::string & name) { @@ -258,7 +252,7 @@ void LLWLParamManager::savePreset(const std::string & name) // make an empty llsd LLSD paramsData(LLSD::emptyMap()); - std::string pathName(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight/skies", escaped_filename)); + std::string pathName(gDirUtilp->getExpandedFilename( LL_PATH_USER_SETTINGS , "windlight/skies", escaped_filename)); // fill it with LLSD windlight params paramsData = mParamList[name].getAll(); @@ -533,7 +527,7 @@ bool LLWLParamManager::removeParamSet(const std::string& name, bool delete_from_ if(delete_from_disk) { - std::string path_name(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight/skies", "")); + std::string path_name(gDirUtilp->getExpandedFilename( LL_PATH_USER_SETTINGS , "windlight/skies", "")); // use full curl escaped name char * curl_str = curl_escape(name.c_str(), name.size()); diff --git a/linden/indra/newview/llwlparammanager.h b/linden/indra/newview/llwlparammanager.h index 7094051..2e1edad 100644 --- a/linden/indra/newview/llwlparammanager.h +++ b/linden/indra/newview/llwlparammanager.h @@ -135,7 +135,7 @@ public: void savePresets(const std::string & fileName); /// load an individual preset into the sky - void loadPreset(const std::string & name); + void loadPreset(const std::string & name,bool propogate=true); /// save the parameter presets to file void savePreset(const std::string & name); @@ -195,7 +195,6 @@ public: // singleton pattern implementation static LLWLParamManager * instance(); - public: // helper variables diff --git a/linden/indra/newview/llworld.cpp b/linden/indra/newview/llworld.cpp index 66c4068..28df561 100644 --- a/linden/indra/newview/llworld.cpp +++ b/linden/indra/newview/llworld.cpp @@ -32,6 +32,7 @@ #include "llviewerprecompiledheaders.h" #include "llworld.h" +#include "llrender.h" #include "indra_constants.h" #include "llstl.h" @@ -108,7 +109,7 @@ LLWorld::LLWorld() : *(default_texture++) = MAX_WATER_COLOR.mV[3]; mDefaultWaterTexturep = new LLViewerImage(raw, FALSE); - mDefaultWaterTexturep->bind(); + gGL.getTexUnit(0)->bind(mDefaultWaterTexturep.get()); mDefaultWaterTexturep->setClamp(TRUE, TRUE); } diff --git a/linden/indra/newview/llworldmap.cpp b/linden/indra/newview/llworldmap.cpp index 1048fe9..e83f6a9 100644 --- a/linden/indra/newview/llworldmap.cpp +++ b/linden/indra/newview/llworldmap.cpp @@ -498,7 +498,8 @@ void LLWorldMap::processMapLayerReply(LLMessageSystem* msg, void**) new_layer.LayerDefined = TRUE; msg->getUUIDFast(_PREHASH_LayerData, _PREHASH_ImageID, new_layer.LayerImageID, block); new_layer.LayerImage = gImageList.getImage(new_layer.LayerImageID, MIPMAP_TRUE, FALSE); - new_layer.LayerImage->bindTexture(0); + + gGL.getTexUnit(0)->bind(new_layer.LayerImage.get()); new_layer.LayerImage->setClamp(TRUE, TRUE); U32 left, right, top, bottom; @@ -610,7 +611,7 @@ void LLWorldMap::processMapBlockReply(LLMessageSystem* msg, void**) siminfo->mWaterHeight = (F32) water_height; siminfo->mMapImageID[agent_flags] = image_id; siminfo->mCurrentImage = gImageList.getImage(siminfo->mMapImageID[LLWorldMap::getInstance()->mCurrentMap], MIPMAP_TRUE, FALSE); - siminfo->mCurrentImage->bindTexture(0); + gGL.getTexUnit(0)->bind(siminfo->mCurrentImage.get()); siminfo->mCurrentImage->setClamp(TRUE, TRUE); if (siminfo->mMapImageID[2].notNull()) diff --git a/linden/indra/newview/llworldmapview.cpp b/linden/indra/newview/llworldmapview.cpp index 92d9588..3fd1d11 100644 --- a/linden/indra/newview/llworldmapview.cpp +++ b/linden/indra/newview/llworldmapview.cpp @@ -301,7 +301,7 @@ void LLWorldMapView::draw() LLLocalClipRect clip(getLocalRect()); { - LLGLSNoTexture no_texture; + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); glMatrixMode(GL_MODELVIEW); @@ -377,7 +377,7 @@ void LLWorldMapView::draw() // Draw using the texture. If we don't clamp we get artifact at // the edge. - LLViewerImage::bindTexture(current_image); + gGL.getTexUnit(0)->bind(current_image); // Draw map image into RGB //gGL.blendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); @@ -385,7 +385,7 @@ void LLWorldMapView::draw() gGL.setColorMask(true, false); gGL.color4f(1.f, 1.f, 1.f, layer_alpha); - gGL.begin(LLVertexBuffer::QUADS); + gGL.begin(LLRender::QUADS); gGL.texCoord2f(0.0f, 1.0f); gGL.vertex3f(left, top, -1.0f); gGL.texCoord2f(0.0f, 0.0f); @@ -401,7 +401,7 @@ void LLWorldMapView::draw() gGL.setColorMask(false, true); gGL.color4f(1.f, 1.f, 1.f, 1.f); - gGL.begin(LLVertexBuffer::QUADS); + gGL.begin(LLRender::QUADS); gGL.texCoord2f(0.0f, 1.0f); gGL.vertex2f(left, top); gGL.texCoord2f(0.0f, 0.0f); @@ -434,7 +434,7 @@ void LLWorldMapView::draw() if (info->mOverlayImage.isNull() && info->mMapImageID[2].notNull()) { info->mOverlayImage = gImageList.getImage(info->mMapImageID[2], MIPMAP_TRUE, FALSE); - info->mOverlayImage->bind(0); + gGL.getTexUnit(0)->bind(info->mOverlayImage.get()); info->mOverlayImage->setClamp(TRUE, TRUE); } @@ -536,13 +536,13 @@ void LLWorldMapView::draw() // Draw using the texture. If we don't clamp we get artifact at // the edge. LLGLSUIDefault gls_ui; - LLViewerImage::bindTexture(simimage); + gGL.getTexUnit(0)->bind(simimage); gGL.setSceneBlendType(LLRender::BT_ALPHA); F32 alpha = sim_alpha * info->mAlpha; gGL.color4f(1.f, 1.0f, 1.0f, alpha); - gGL.begin(LLVertexBuffer::QUADS); + gGL.begin(LLRender::QUADS); gGL.texCoord2f(0.f, 1.f); gGL.vertex3f(left, top, 0.f); gGL.texCoord2f(0.f, 0.f); @@ -555,9 +555,9 @@ void LLWorldMapView::draw() if (gSavedSettings.getBOOL("MapShowLandForSale") && overlayimage && overlayimage->getHasGLTexture()) { - LLViewerImage::bindTexture(overlayimage); + gGL.getTexUnit(0)->bind(overlayimage); gGL.color4f(1.f, 1.f, 1.f, alpha); - gGL.begin(LLVertexBuffer::QUADS); + gGL.begin(LLRender::QUADS); gGL.texCoord2f(0.f, 1.f); gGL.vertex3f(left, top, -0.5f); gGL.texCoord2f(0.f, 0.f); @@ -577,8 +577,8 @@ void LLWorldMapView::draw() gGL.setColorMask(false, true); gGL.color4f(1.f, 1.f, 1.f, 1.f); - LLGLSNoTexture gls_no_texture; - gGL.begin(LLVertexBuffer::QUADS); + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); + gGL.begin(LLRender::QUADS); gGL.vertex2f(left, top); gGL.vertex2f(left, bottom); gGL.vertex2f(right, bottom); @@ -596,8 +596,8 @@ void LLWorldMapView::draw() gGL.blendFunc(LLRender::BF_DEST_ALPHA, LLRender::BF_SOURCE_ALPHA); gGL.color4f(0.2f, 0.0f, 0.0f, 0.4f); - LLGLSNoTexture gls_no_texture; - gGL.begin(LLVertexBuffer::QUADS); + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); + gGL.begin(LLRender::QUADS); gGL.vertex2f(left, top); gGL.vertex2f(left, bottom); gGL.vertex2f(right, bottom); @@ -612,9 +612,9 @@ void LLWorldMapView::draw() { gGL.blendFunc(LLRender::BF_DEST_ALPHA, LLRender::BF_ZERO); - LLGLSNoTexture gls_no_texture; + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); gGL.color3f(1.f, 0.f, 0.f); - gGL.begin(LLVertexBuffer::LINES); + gGL.begin(LLRender::LINES); gGL.vertex2f(left, top); gGL.vertex2f(right, bottom); gGL.vertex2f(left, bottom); @@ -683,7 +683,7 @@ void LLWorldMapView::draw() // Draw background rectangle LLGLSUIDefault gls_ui; { - LLGLSNoTexture gls_no_texture; + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); gGL.setAlphaRejectSettings(LLRender::CF_GREATER_EQUAL, 0.f); gGL.blendFunc(LLRender::BF_ONE_MINUS_DEST_ALPHA, LLRender::BF_DEST_ALPHA); gGL.color4fv( mBackgroundColor.mV ); @@ -969,7 +969,7 @@ void LLWorldMapView::drawFrustum() F32 ctr_x = getRect().getWidth() * 0.5f + sPanX; F32 ctr_y = getRect().getHeight() * 0.5f + sPanY; - LLGLSNoTexture gls_no_texture; + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); // Since we don't rotate the map, we have to rotate the frustum. gGL.pushMatrix(); @@ -978,7 +978,7 @@ void LLWorldMapView::drawFrustum() // Draw triangle with more alpha in far pixels to make it // fade out in distance. - gGL.begin( LLVertexBuffer::TRIANGLES ); + gGL.begin( LLRender::TRIANGLES ); gGL.color4f(1.f, 1.f, 1.f, 0.25f); gGL.vertex2f( 0, 0 ); @@ -1184,11 +1184,11 @@ static void drawDot(F32 x_pixels, F32 y_pixels, F32 top = y_pixels + dot_radius; F32 bottom = y_pixels - dot_radius; - LLGLSNoTexture gls_no_texture; + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); gGL.color4fv( color.mV ); LLUI::setLineWidth(1.5f); F32 h_bar = relative_z > HEIGHT_THRESHOLD ? top : bottom; // horizontal bar Y - gGL.begin( LLVertexBuffer::LINES ); + gGL.begin( LLRender::LINES ); gGL.vertex2f(center, top); gGL.vertex2f(left, h_bar); gGL.vertex2f(right, h_bar); diff --git a/linden/indra/newview/lsl_guide.html b/linden/indra/newview/lsl_guide.html deleted file mode 100644 index aa660b8..0000000 --- a/linden/indra/newview/lsl_guide.html +++ /dev/null @@ -1,22078 +0,0 @@ - -Linden Scripting Language Guide

Linden Scripting Language Guide

Aaron Brashears

Andrew Meadows

Cory Ondrejka

Doug Soo

Donald Kjer

Copyright © 2007 Linden Lab

Linden Lab® and - Second Life® are registered - trademarks of Linden Research, Inc.


Table of Contents
1. Introduction
2. Getting Started
2.1. Hello Avatar
2.1.1. Creating the Script
2.1.2. Default State
2.1.3. Functions
2.1.4. Touch Event
2.1.5. Try it Out
2.2. Using The Built-In Editor
2.3. Using Alternative Editors
3. Basics
3.1. Comments
3.2. Arithmetic Operations
3.2.1. Assignment
3.2.2. Hexadecimal Entry
3.2.3. Binary Arithmetic Operators
3.2.4. Boolean Operators
3.2.5. Bitwise Operators
3.3. Types
3.3.1. Type Conversion
3.4. Global Functions
3.5. Global Variables
3.6. Local Variables
4. Flow Control
4.1. Conditional Statements
4.2. Loop Constructs
4.2.1. for loop
4.2.2. do-while loop
4.2.3. while loop
4.3. Jumps
4.4. State Change
5. States
5.1. state_entry()
5.2. state_exit()
5.3. States vs. Global variables
6. Math
6.1. Tables of Functions
7. Strings
7.1. Tables of Functions
8. Lists
8.1. Tables of Functions
9. Communication
9.1. Tables of Functions
10. Inventory
10.1. Tables of Functions
11. Vehicles
11.1. Overview
11.2. Warnings
11.3. Definitions
11.4. Setting the Vehicle Type
11.5. Linear and Angular Deflection
11.6. Moving and Steering the Vehicle
11.7. The Linear Motor
11.8. The Angular Motor
11.9. Using the Camera to Steer
11.10. The Vertical Attractor
11.11. Banking
11.12. Friction Timescales
11.13. Buoyancy
11.14. Hover
11.15. Reference Frame
A. Linden Library Functions
A.1. llAbs
A.2. llAcos
A.3. llAddToLandPassList
A.4. llAdjustSoundVolume
A.5. llAllowInventoryDrop
A.6. llAngleBetween
A.7. llApplyImpulse
A.8. llApplyRotationalImpulse
A.9. llAsin
A.10. llAtan2
A.11. llAttachToAvatar
A.12. llAvatarOnSitTarget
A.13. llAxes2Rot
A.14. llAxisAngle2Rot
A.15. llBase64ToString
A.16. llBreakAllLinks
A.17. llBreakLink
A.18. llCSV2List
A.19. llCeil
A.20. llCloseRemoteDataChannel
A.21. llCloud
A.22. llCollisionFilter
A.23. llCollisionSound
A.24. llCollisionSprite
A.25. llCos
A.26. llCreateLink
A.27. llDeleteSubList
A.28. llDeleteSubString
A.29. llDetachFromAvatar
A.30. llDetectedGrab
A.31. llDetectedGroup
A.32. llDetectedKey
A.33. llDetectedLinkNumber
A.34. llDetectedName
A.35. llDetectedOwner
A.36. llDetectedPos
A.37. llDetectedRot
A.38. llDetectedType
A.39. llDetectedVel
A.40. llDialog
A.41. llDie
A.42. llDumpList2String
A.43. llEscapeURL
A.44. llEdgeOfWorld
A.45. llEjectFromLand
A.46. llEmail
A.47. llEuler2Rot
A.48. llFabs
A.49. llFloor
A.50. llFrand
A.51. llGetAccel
A.52. llGetAttached
A.53. llGetAgentInfo
A.54. llGetAgentSize
A.55. llGetAlpha
A.56. llGetAndResetTime
A.57. llGetAnimation
A.58. llGetAnimationList
A.59. llGetBoundingBox
A.60. llGetCenterOfMass
A.61. llGetColor
A.62. llGetCreator
A.63. llGetDate
A.64. llGetEnergy
A.65. llGetForce
A.66. llGetFreeMemory
A.67. llGetGeometricCenter
A.68. llGetGMTclock
A.69. llGetInventoryCreator
A.70. llGetInventoryKey
A.71. llGetInventoryName
A.72. llGetInventoryNumber
A.73. llGetInventoryPermMask
A.74. llGetInventoryType
A.75. llGetKey
A.76. llGetLandOwnerAt
A.77. llGetLinkKey
A.78. llGetLinkName
A.79. llGetLinkNumber
A.80. llGetListEntryType
A.81. llGetListLength
A.82. llGetLocalPos
A.83. llGetLocalRot
A.84. llGetMass
A.85. llGetObjectMass
A.86. llGetNextEmail
A.87. llGetNotecardLine
A.88. llGetNumberOfNotecardLines
A.89. llGetNumberOfPrims
A.90. llGetNumberOfSides
A.91. llGetObjectDesc
A.92. llGetObjectName
A.93. llGetObjectPermMask
A.94. llGetOmega
A.95. llGetOwner
A.96. llGetOwnerKey
A.97. llGetPermissions
A.98. llGetPermissionsKey
A.99. llGetPos
A.100. llGetPrimitiveParams
A.101. llGetRegionCorner
A.102. llGetRegionFPS
A.103. llGetRegionName
A.104. llGetRegionTimeDilation
A.105. llGetRootPosition
A.106. llGetRootRotation
A.107. llGetRot
A.108. llGetScale
A.109. llGetScriptName
A.110. llGetStartParameter
A.111. llGetScriptState
A.112. llGetStatus
A.113. llGetSubString
A.114. llGetSunDirection
A.115. llGetTexture
A.116. llGetTextureOffset
A.117. llGetTextureRot
A.118. llGetTextureScale
A.119. llGetTime
A.120. llGetTimeOfDay
A.121. llGetTimestamp
A.122. llGetTorque
A.123. llGetVel
A.124. llGetWallclock
A.125. llGiveInventory
A.126. llGiveInventoryList
A.127. llGiveMoney
A.128. llGround
A.129. llGroundContour
A.130. llGroundNormal
A.131. llGroundRepel
A.132. llGroundSlope
A.133. llInsertString
A.134. llInstantMessage
A.135. llKey2Name
A.136. llList2CSV
A.137. llList2Float
A.138. llList2Integer
A.139. llList2Key
A.140. llList2List
A.141. llList2ListStrided
A.142. llList2Rot
A.143. llList2String
A.144. llList2Vector
A.145. llListFindList
A.146. llListInsertList
A.147. llListRandomize
A.148. llListReplaceList
A.149. llListSort
A.150. llListen
A.151. llListenControl
A.152. llListenRemove
A.153. llLoadURL
A.154. llLog
A.155. llLog10
A.156. llLookAt
A.157. llLoopSound
A.158. llLoopSoundMaster
A.159. llLoopSoundSlave
A.160. llMakeExplosion
A.161. llMakeFire
A.162. llMakeFountain
A.163. llMakeSmoke
A.164. llMD5String
A.165. llMessageLinked
A.166. llMinEventDelay
A.167. llModifyLand
A.168. llModPow
A.169. llMoveToTarget
A.170. llOffsetTexture
A.171. llOpenRemoteDataChannel
A.172. llOverMyLand
A.173. llParcelMediaCommandList
A.174. llParcelMediaQuery
A.175. llParseString2List
A.176. llParseStringKeepNulls
A.177. llParticleSystem
A.178. llPassCollisions
A.179. llPassTouches
A.180. llPlaySound
A.181. llPlaySoundSlave
A.182. llPointAt
A.183. llPow
A.184. llPreloadSound
A.185. llPushObject
A.186. llReleaseControls
A.187. llRemoteDataReply
A.188. llRemoteDataSetRegion
A.189. llRemoteLoadScript
A.190. llRemoteLoadScriptPin
A.191. llRemoveInventory
A.192. llRemoveVehicleFlags
A.193. llRequestAgentData
A.194. llRequestInventoryData
A.195. llRequestPermissions
A.196. llRequestSimulatorData
A.197. llResetScript
A.198. llResetOtherScript
A.199. llResetTime
A.200. llRezAtRoot
A.201. llRezObject
A.202. llRot2Angle
A.203. llRot2Axis
A.204. llRot2Euler
A.205. llRot2Fwd
A.206. llRot2Left
A.207. llRot2Up
A.208. llRotBetween
A.209. llRotLookAt
A.210. llRotTarget
A.211. llRotTargetRemove
A.212. llRotateTexture
A.213. llRound
A.214. llSameGroup
A.215. llSay
A.216. llScaleTexture
A.217. llScriptDanger
A.218. llSendRemoteData
A.219. llSensor
A.220. llSensorRemove
A.221. llSensorRepeat
A.222. llSetAlpha
A.223. llSetBuoyancy
A.224. llSetCameraAtOffset
A.225. llSetClickAction
A.226. llForceMouselook
A.227. llSetCameraEyeOffset
A.228. llSetColor
A.229. llSetDamage
A.230. llSetForce
A.231. llSetForceAndTorque
A.232. llSetHoverHeight
A.233. llSetLinkAlpha
A.234. llSetLinkColor
A.235. llSetLinkPrimitiveParams
A.236. llSetLinkTexture
A.237. llSetLocalRot
A.238. llSetObjectDesc
A.239. llSetObjectName
A.240. llSetParcelMusicURL
A.241. llSetPayPrice
A.242. llSetPos
A.243. llSetPrimitiveParams
A.244. llSetRemoteScriptAccessPin
A.245. llSetRot
A.246. llSetScale
A.247. llSetScriptState
A.248. llSetSitText
A.249. llSetSoundQueueing
A.250. llSetStatus
A.251. llSetText
A.252. llSetTexture
A.253. llSetTextureAnim
A.254. llSetTimerEvent
A.255. llSetTorque
A.256. llSetTouchText
A.257. llSetVehicleFlags
A.258. llSetVehicleFloatParam
A.259. llSetVehicleType
A.260. llSetVehicleRotationParam
A.261. llSetVehicleVectorParam
A.262. llShout
A.263. llSin
A.264. llSitTarget
A.265. llSleep
A.266. llSqrt
A.267. llStartAnimation
A.268. llStopAnimation
A.269. llStopHover
A.270. llStopLookAt
A.271. llStopMoveToTarget
A.272. llStopPointAt
A.273. llStopSound
A.274. llStringLength
A.275. llSubStringIndex
A.276. llStringToBase64
A.277. llTakeControls
A.278. llTan
A.279. llTarget
A.280. llTargetOmega
A.281. llTargetRemove
A.282. llTeleportAgentHome
A.283. llToLower
A.284. llToUpper
A.285. llTriggerSound
A.286. llTriggerSoundLimited
A.287. llUnescapeURL
A.288. llUnSit
A.289. llVecDist
A.290. llVecMag
A.291. llVecNorm
A.292. llVolumeDetect
A.293. llWater
A.294. llWhisper
A.295. llWind
A.296. llXorBase64Strings
B. Events
B.1. at_rot_target
B.2. at_target
B.3. attach
B.4. changed
B.5. collision
B.6. collision_end
B.7. collision_start
B.8. control
B.9. dataserver
B.10. email
B.11. land_collision
B.12. land_collision_end
B.13. land_collision_start
B.14. link_message
B.15. listen
B.16. money
B.17. moving_end
B.18. moving_start
B.19. no_sensor
B.20. not_at_rot_target
B.21. not_at_target
B.22. object_rez
B.23. on_rez
B.24. run_time_permissions
B.25. sensor
B.26. state_entry
B.27. state_exit
B.28. timer
B.29. touch
B.30. touch_end
B.31. touch_start
B.32. remote_data
C. Constants
C.1. Boolean Constants
C.2. Status Constants
C.3. Object Type Constants
C.4. Permission Constants
C.5. Inventory Constants
C.6. Pay Price Constants
C.7. Attachment Constants
C.8. Land Constants
C.9. Link Constants
C.10. Control Constants
C.11. Change Constants
C.12. Type Constants
C.13. Agent Info Constants
C.14. Texture Animation - Constants
C.15. Particle System Constants
C.16. Agent Data Constants
C.17. Float Constants
C.18. Key Constant
C.19. Miscellaneous Integer Constants
C.20. Miscellaneous String - Constants
C.21. Vector Constant
C.22. Rotation Constant
C.23. Simulator Data Constants
C.24. Vehicle Parameters
C.25. Vehicle Flags
C.26. Vehicle Types
C.27. Primitive Constants
C.28. XML-RPC Constants
C.29. Permission Mask Constants
C.30. Parcel Media Constants
C.31. Click Action Constants

Chapter 1. Introduction

The Linden Scripting Language (LSL) is a simple, powerful - language used to attach behaviors to the objects found in Second - Life. It follows the familiar syntax of a c/Java style language, - with an implicit state machine for every script.

Multiple scripts may also be attached to the same object, - allowing a style of small, single-function scripts to evolve. This - leads to scripts that perform specific functions ("hover", "follow", - etc.) and allows them to be combined to form new behaviors.

The text of the script is compiled into an executable byte - code, much like Java. This byte code is then run within a virtual - machine on the simulator. Each script receives a time slice of the - total simulator time allocated to scripts, so a simulator with many - scripts would allow each individual script less time rather than - degrading its own performance. In addition, each script executes - within its own chunk of memory, preventing scripts from writing into - protected simulator memory or into other scripts, making it much - harder for scripts to crash the simulator.

This tutorial introduces the reader to the basic features of - LSL, how to edit and apply your scripts, and a complete reference - for standard linden constants, events, and library functions.


Chapter 2. Getting Started

You're probably wondering what you can do with LSL, and how - quickly you can do it. We'll start with some simple examples, dissect - them, and introduce you the script development process while - we're at it.


2.1. Hello Avatar

Continuing a long tradition of getting started by looking at - a script that says "Hello", we'll do just that. Though obviously - not a particularly useful example on it's own, this example will - introduce us to:

  • Creating a basic script

  • Script states

  • Calling functions

  • Script events

  • Applying a script to an object


2.1.1. Creating the Script

Start by opening your inventory and selecting 'Create|New - Script' from the inventory pull down menu. This will create an - empty script called 'New Script' in your 'Scripts' - folder. Double click on the text or icon of the script to open - the script in the built in editor. When you open the script, the - viewer will automatically insert a basic skeleton for lsl. It - should look like:


default
-{
-    state_entry()
-    {
-        llSay(0, "Hello, Avatar!");
-    }
-
-    touch_start(integer total_number)
-    {
-        llSay(0, "Touched.");
-    }
-}
-      

A casual inspection of this script reveals that this script - probably says 'Hello, Avatar!' when it enters some state, and it - says 'Touched.' when it is touched. But since this is also - probably the first time you have seen a script we'll dissect this - short listing, explaining each segment individually.


2.1.2. Default State


default
-{
-...
-}
-      

All LSL scripts have a simple implicit state machine with - one or more states. All scripts must have a default state, so - if there is only one state, it will be the 'default' - state. When a script is first started or reset, it will start - out in the default state.

The default state is declared by placing the default at - the root level of the document, and marking the beginning with - an open brace '{' and ending with a close brace '}'. Because of - it's privileged status, you do not declare that it is fact a - state like you normally would with other states.

Every time you enter a state, the script engine will - automatically call the state_entry() event and execute the code - found there. On state exit, the script engine will automatically - call the state_exit() event before calling the next state's - state_entry handler. In our example, we call the - llSay() - function in state_entry() and do not bother to define a - state_exit() handler. the state entry and exit handlers are a - convenient place to initialize state data and clean up state - specific data such as listen event callback.

You can read more about the default state, and how to - create and utilize other states in the states chapter.


2.1.3. Functions

The language comes with well over 200 built in functions which allow scripts and - objects to interact with their environment. All of the built in - functions start with 'll'.

The example calls the llSay() - function twice, which is used to emit text on the specified channel. -

llSay( - integer channel - string text - );

Say text on channel. Channel 0 is the public chat channel - that all avatars see as chat text. Channels 1 to 2,147,483,648 - are private channels that aren't sent to avatars but other - scripts can listen for.

You can define your own functions as long as the name does - not conflict with a reserved word, built in constant, or built - in function.


2.1.4. Touch Event


touch_start(integer total_number)
-{
-    llSay(0, "Touched.");
-}
-      

There are many events that can - be detected in your scripts by declaring a handler. The - touch_start() - event is raised when a - user touches the object through the user interface.


2.1.5. Try it Out

Now that we have seen the default script, and examined it - in some detail, it is time to see the script in action. Save - the script by clicking on Save. During - the save process, the editor will save the text of the script - and compile the script into bytecode and then save that. When - you see message 'Compile successful!' in the preview window, you - know the compile and save is done.

To test the script you will have to apply it to an object - in the world. Create a new object in the world by - context clicking in the main world - view and selecting Create. When the wand - appears, you can create a simple primitive by - clicking in the world. Once the - object appears, you can drag your newly created script onto the - object to start the script.

Soon after dragging the script onto the object, you will - see the message Object: Hello - Avatar!

Make sure the touch event is working by - clicking on the object. You should - see the message Touched printed into the chat - history.


2.2. Using The Built-In Editor

The built in editor comes with most of the typical features - you would expect from a basic text editor. Highlight text with the - mouse, or by holding down the shift key while using the arrow - keys. You can cut, copy, paste, and delete your selection using - the 'Edit' pull down menu or by pressing the usual shortcut - key.


2.3. Using Alternative Editors

Since the built-in editor supports pasting text from the - clipboard, you can employ a different editor to edit your scripts, - copying them into Second Life when you're ready to save them.


Chapter 3. Basics

Now that we have seen a very simple script in action, we need - to look at the our toolchest for writing scripts. The next set of - tools we will consider are the basic building blocks for programming - a script, and will be used in every non-trivial script you write.


3.1. Comments

Commenting your scripts is a good idea, and will help when - you update and modify the script, or when you adapt parts of it - into other scripts. Unless the meaning is obvious, you should add - comments:

  • at the start of the script to explain the - purpose of the script

  • before every global variable to describe what - it holds

  • before every global function to describe what - it does

  • sprinkled through your script wherever the code - solves a problem that took you more than a few minutes to - figure out.

LSL uses Java/C++ style single line comments.


// This script toggles a the rotation of an object
-
-// g_is_rotating stores the current state of the rotation. TRUE is
-// rotating, FALSE otherwise.
-integer g_is_rotating = FALSE;
-default
-{
-    // toggle state during the touch handler
-    touch(integer num)
-    {
-        if(g_is_rotating)
-        {
-            // turn off rotation
-            llTargetOmega(<0,0,1>, 0, 0);
-            g_is_rotating = FALSE;
-        }
-        else
-        {
-            // rotate around the positive z axis - up.
-            llTargetOmega(<0,0,1>, 4, 1);
-            g_is_rotating = TRUE;
-        }
-    }
-}
-    


3.2. Arithmetic Operations

Most of the common arithmetic operations are supported in - lsl, and follow the C/Java syntax.


3.2.1. Assignment

The most common arithmetic operation is assignment, - denoted with the '=' sign. Loosely translated, it means, take - what you find on the right hand side of the equal sign and - assign it to the left hand side. Any expression that evaluates - to a basic type can be used as the right hand side of an - assignment, but the left hand side must be a normal - variable.

All basic types support assignment '=', equality '==' and - inequality '!=' operators.


// variables to hold a information about the target
-key g_target;
-vector g_target_postion;
-float g_target_distance;
-
-// function that demonstrates assignment
-set_globals(key target, vector pos)
-{
-    g_target = target;
-    g_target_position = pos;
-
-    // assignment from the return value of a function
-    vector my_pos = llGetPos(); 
-    g_target_distance = llVecDist(g_target_position, my_pos);
-}
-      


3.2.2. Hexadecimal Entry

Integers may be entered in hex form (e.g. 0xffff). For example:


integer Mask = 0xff;  // Equivalent to integer Mask = 255;
-integer Bit  = 0x0100 // Equivalent to integer Mask = 256;
-	


3.2.3. Binary Arithmetic Operators

Binary arithmetic operators behave like a function call - that accepts two parameters of the same type, and then return - that type; however, the syntax is slightly different.

Table 3-1. Binary Arithmetic Operators

OperatorMeaning
+Addition
-Subtraction
*Multiplication
/Division
%Modulo (remainder)
^Exclusive OR
<<Shift Left
>>Shift Right

Where noted, each type may have a special interpretation - of a binary arithmetic operator. See the lsl types section for more - details.


      


3.2.4. Boolean Operators

Table 3-2. Boolean Operators

OperatorMeaning
<Operator returns TRUE if the left hand side is less - than the right hand side.
>Operator returns TRUE if the left hand side is greater - than the right hand side.
<=Operator returns TRUE if the left hand side is less - than or equal to the right hand side.
>=Operator returns TRUE if the left hand side is greater - than or equal to the right hand side.
&&Operator returns TRUE if the left hand side and right - hand side are both true.
||Operator returns TRUE if either the left hand or right - hand side are true.
!Unary operator returns the logical negation of the - expression to the right.

3.2.5. Bitwise Operators

Table 3-3. Bitwise Operators

OperatorMeaning
&Returns the bitwise and of the left and right hand - side.
|Returns the bitwise or of the left and right hand - side.
~Unary operator returns the bitwise complement of the - expression to the right.

3.3. Types

Variables, return values, and parameters have type - information. LSL provides a small set of basic types that are used - throughout the language.

LSL Types

integer

A signed, 32-bit integer value with valid range from - -2147483648 to 2147483647.

float

An IEEE 32-bit floating point value with - values ranging from 1.175494351E-38 to - 3.402823466E+38.

key

A unique identifier that can be used to - reference objects and agents in Second Life.

vector

3 floats that are used together as a single - item. A vector can be used to represent a 3 dimensional - position, direction, velocity, force, impulse, or a - color. Each component can be accessed via '.x', '.y', and - '.z'.

Table 3-4. Vector Arithmetic Operators

OperatorMeaning
+Add two vectors together
-Subtract one vector from another
*Vector dot product
%Vector cross product
rotation

4 floats that are used together as a single - item to represent a rotation. This data is interpreted as a - quaternion. Each component can be accessed via '.x', '.y', - '.z', and '.s'.

Table 3-5. Rotation Arithmetic Operators

OperatorMeaning
+Add two rotations together
-Subtract one rotation from another
*Rotate the first rotation by the second
/Rotate the first rotation by the inverse of the second
list

A heterogeneous list of the other data types. Lists are - created via comma separated values of the other data types - enclosed by '[' and ']'.


string StringVar = "Hello, Carbon Unit";
-list MyList = [ 1234, ZERO_ROTATION, StringVar ];
-        

- Yields the list: [ 1234, <0,0,0,1>, "Hello, - Carbon Unit" ] -

Lists can be combined with other lists. For example: -


MyList = 3.14159 + MyList;
-        

- Yields the list: [ 3.14159, 1234, <0,0,0,1>, - "Hello, Carbon Unit" ] - And similarly, -


MyList = MyList + MyList;
-        

- Yields: [ 3.14159, 1234, <0,0,0,1>, "Hello, - Carbon Unit", 3.14159, 1234, <0,0,0,1>, "Hello, Carbon Unit" - ] -

Library functions exist used to copy data from lists, - sort lists, copy/remove sublists.


3.3.1. Type Conversion

Type conversion can either occur implicitly or explicitly. - Explicit type casts are accomplished using C syntax: -


float foo_float = 1.0;
-integer  foo_int = (integer)foo_float;
-      

-


3.3.1.1. Implicit Casting

LSL only supports two implicit type casts: integer to - float and string to key. Thus, any place you see a float - specified you can supply an integer, and any place you see a - key specified, you can supply a string.


3.3.1.2. Explicit Casting

LSL supports the following explicit casts: -

  • Integer to String

  • Float to Integer

  • Float to String

  • Vector to String

  • Rotation to String

  • Integer to List

  • Float to List

  • Key to List

  • String to List

  • Vector to List

  • Rotation to List

  • String to Integer

  • String to Float

  • String to Vector

  • String to Rotation

-


3.4. Global Functions

Global functions are also declared much like Java/C, with - the exception that no 'void' return value exists. Instead, if no - return value is needed, just don't specify one: - -


make_physical_and_spin(vector torque)
-{
-    // double the torque
-    vector double_torque = 2.0*torque;
-    llSetStatus(STATUS_PHYSICS, TRUE);
-    llApplyTorque(double_torque);
-}    
-    


3.5. Global Variables

Global variables and functions are accessible from anywhere - in the file. Global variables are declared much like Java or C, - although only one declaration may be made per line: -


vector gStartPosition;
-    

Global variables may also be initialized if desired, - although uninitialized global and local variables are initialized - to legal zero values: -


vector gStartPosition = <10.0,10.0,10.0>
-    


3.6. Local Variables

Local variables are scoped below their declaration within - the block of code they are declared in and may be declared within - any block of code. Thus the following code is legal and will work - like C: -


integer test_function()
-{
-    // Test vector that we can use anywhere in the function
-    vector test = <1,2,3>;
-    integer j;
-    for (j = 0; j < 10; j++)
-    {
-        // This vector is a different variable than the one declared above
-        // This IS NOT good coding practice
-        vector test = <j, j, j>;
-    }
-    // this test fails
-    if (test == <9,9,9>)
-    {
-        // never reached
-    }
-}
-    


Chapter 4. Flow Control

LSL comes with a complete complement of constructs meant to - deal with conditional processing, looping, as well as simply jumping - to a different point in the script.


4.1. Conditional Statements

The 'if' statement operates and has the - same syntax as the Java/C version.


check_message(string message)
-{
-    if(message == "open")
-    {
-        open();
-    }
-    else if(message == "close")
-    {
-        close();
-    }
-    else
-    {
-        llSay(0, "Unknown command: " + message);
-    }
-}
-    

The statements between the open and close curly brace are - performed if the conditional inside the parentheses evaluates to a - non-zero integer. Once a conditional is determined to be true - (non-zero), no further processing of 'else' conditionals will be - considered. The NULL_KEY constant - is counted as FALSE by conditional expressions.

There can be zero or more 'else if' statements, and an - optional final 'else' to handle the case when none of the if - statements evaluate to a non-zero integer.

The usual set of integer arithmetic and comparison operators - are available.


// a function that accepts some information about its environment and
-// determines the 'best' next step. This kind of code might be
-// part of a simple box meant to move close to an agent and attach to
-// them once near. This code sample relies on the standard linden
-// library functions as well as two other methods not defined here.
-assess_next_step(integer perm, integer attached, integer balance, float dist)
-{
-    string msg;
-    if(!attached)
-    {
-        if((perm & PERMISSION_ATTACH) && (dist < 10.0))
-        {
-             attach();
-        }
-        else if((dist > 10.0) || ((dist > 20.0) && (balance > 1000)))
-        {
-            move_closer();
-        }
-        else
-        {
-            llRequestPermissions(llGetOwner(), PERMISSION_ATTACH);
-        }
-    }
-}
-    


4.2. Loop Constructs

Loops are a basic building block of most useful programming - languages, and LSL offers the same loop constructs as found in - Java or C.


4.2.1. for loop

A for loop is most useful for when you know how many times - you need to iterate over an operation. Just like a Java or C for - loop, the parentheses have three parts, the initializer, the - continuation condition, and the increment. The loop continues - while the middle term evaluates to true, and the increment step - is performed at the end of every loop.


// move a non-physical block smoothly upward (positive z) the total
-// distance specified divided into steps discrete moves.
-move_up(float distance, integer steps)
-{
-    float step_distance = distance / (float)steps;
-    vector offset = <0.0, 0.0, step_distance>;
-    vector base_pos = llGetPos();
-    integer i;
-    for(i = 0; i <= steps; ++i)
-    {
-        llSetPos(base_pos + i * offset);
-        llSleep(0.1);
-    }
-}
-      


4.2.2. do-while loop

The do-while loop construct is most useful when you are - sure that you want to perform an operation at least once, but - you are not sure how many times you want to loop. The syntax is - the same as you would find in a Java or C program. A simple - English translation would be 'do the code inside the curly braces - and continue doing it if the statement after the while is - true.


// output the name of all inventory items attached to this object
-talk_about_inventory(integer type)
-{
-    string name;
-    integer i = 0;
-    integer continue = TRUE;
-    do
-    {
-        name = llGetInventoryName(type, i);
-        if(llStringLength(name) > 0)
-        {
-            llSay(0, "Inventory " + (string)i + ": " + name);
-        }
-        else
-        {
-            llSay(0, "No more inventory items");
-            continue = FALSE;
-        }
-        i++;
-    } while(continue);
-}
-      


4.2.3. while loop

The while loop behaves similarly to the do-while loop, - except it allows you to exit the loop without doing a single - iteration inside.


mention_inventory_type(integer type)
-{
-    integer i = llGetInventoryNumber(type);
-    while(i--)
-    {
-        llSay(0, "item: " + llGetInventory(i));
-    }
-}
-      


4.3. Jumps

A jump is used to move the running script to a new point - inside of a function or event handler. You cannot jump into other - functions or event handlers. Usually, you will want to use a jump - for in situations where the if..else statements would become too - cumbersome. For example, you may want to check several - preconditions, and exit if any of them are not met.


attach_if_ready(vector target_pos)
-{
-    // make sure we have permission
-    integer perm = llGetPerm();
-    if(!(perm & PERMISSION_ATTACH))
-    {
-        jump early_exit;
-    }
-
-    // make sure we're 10 or less meters away
-    vector pos = llGetPos()
-    float dist = llVecDist(pos, target_pos);
-    if(dist > 10.0)
-    {
-        jump early_exit;
-    }
-
-    // make sure we're roughly pointed toward the target.
-    // the calculation of max_cos_theta could be precomputed 
-    // as a constant, but is manually computed here to 
-    // illustrate the math.
-    float max_cos_theta = llCos(PI / 4.0);
-    vector toward_target = llVecNorm(target_pos - pos);
-    rotation rot = llGetRot();
-    vector fwd = llRot2Fwd(rot);
-    float cos_theta = toward_target * fwd;
-    if(cos_theta > max_cos_theta)
-    {
-        jump early_exit;
-    }
-
-    // at this point, we've done all the checks.
-    attach();
-
-    @early_exit;
-}
-    


4.4. State Change

State change allow you to move through the lsl virtual - machine's flexible state machine by transitioning your script to - and from user defined states and the default state. You can define - your own script state by placing the keyword 'state' before its - name and enclosing the event handlers with open and close curly - braces ('{' and '}'.) You can invoke the transition to a new state - by calling it with the syntax: 'state <statename>'.


default
-{
-    state_entry()
-    {
-        llSay(0, "I am in the default state");
-        llSetTimer(1.0);
-    }
-
-    timer()
-    {
-        state SpinState;
-    }
-}
-
-state SpinState
-{
-    state_entry()
-    {
-        llSay(0, "I am in SpinState!");
-        llTargetOmega(<0,0,1>, 4, 1.0);
-        llSetTimer(2.0);
-    }
-
-    timer()
-    {
-        state default;
-    }
-
-    state_exit()
-    {
-        llTargetOmega(<0,0,1>, 0, 0.0);
-    }
-}
-    


Chapter 5. States

All scripts must have a 'default' state, which is the first - state entered when the script starts. States contain event handlers - that are triggered by the LSL virtual machine. All states must - supply at least one event handler - it's not really a state without - one.

When state changes, all callback settings are retained and all - pending events are cleared.


5.1. state_entry()

The state_entry - event occurs whenever a new state is - entered, including program start, and is always the first event - handled. No data is passed to this event handler.

You will usually want to set callbacks for things such as - timers and sensor in the state_entry() callback of the state to - put your object into a useful condition for that state.

Warning: It is a common mistake to assume that the state_entry() - callback is called when you rez an object out of your - inventory. When you derez an object into your inventory the - current state of the script is saved, so there will not be a - call to state_entry() during the rez. If you need to provide - startup code every time an object is created, you should create - a global function and call it from both state_entry() and the - on_rez() callbacks.


// global initialization function.
-init()
-{
-    // Set up a listen callback for whoever owns this object.
-    key owner = llGetOwner();
-    llListen(0, "", owner, "");
-}
-
-default
-{
-    state_entry()
-    {
-        init();
-    }
-
-    on_rez(integer start_param)
-    {
-        init();
-    }
-
-    listen(integer channel, string name, key id, string message)
-    {
-        llSay(0, "Hi " + name + "! You own me.");
-    }
-}
-      


5.2. state_exit()

You will want to provide a state_exit() if you need to clean - up any events that you have requested in the current state, but do - not expect in the next state.


default
-{
-    state_entry()
-    {
-        state TimerState;
-    }
-}
-
-state TimerState
-{
-    state_entry()
-    {
-        // set a timer event for 5 seconds in the future.
-        llSetTimerEvent(5.0);
-    }
-
-    timer()
-    {
-        llSay(0, "timer");
-        state ListenState;
-    }
-
-    state_exit()
-    {
-        // turn off future timer events.
-        llSetTimerEvent(0.0);
-    }
-}
-
-integer g_listen_control;
-
-state ListenState
-{
-    state_entry()
-    {
-        // listen for anything on the public channel
-        g_listen_control = llListen(0, "", NULL_KEY, "");
-    }
-
-    listen(integer channel, string name, key id, string message)
-    {
-        llSay(0, "listen");
-        state TimerState;
-    }
-
-    state_exit()
-    {
-        // turn off the listener
-        llListenRemove(g_listen_control);
-    }
-}
-    

The state_exit() - handler is not called when an object is - being deleted - all callbacks, handlers, sounds, etc, will be - cleaned up automatically for you.


5.3. States vs. Global variables

A state and a set of global variables can serve the same - purpose, and each can be expressed in terms of the other. In - general, you should prefer the use of states over global variables - since states allow you to immediately assume script state without - making comparisons. The less comparisons a script makes, the more - regular code statements it can run.


Chapter 9. Communication


Chapter 11. Vehicles

Custom Vehicles can be constructed and controlled using the LSL. - This chapter will cover the basics of how vehicles work, the - terms used when describing vehicles, and a more thorough examination - of the api available.

There are several ways to make scripted objects move - themselves around. One way is to turn the object into a - "vehicle". This feature is versatile enough to make things - that slide, hover, fly, and float. Some of the behaviors that can be - enabled are:


11.1. Overview

Each scripted object can have one vehicle behavior that is - configurable through the llSetVehicleType, llSetVehicleFloatParam, - llSetVehicleVectorParam, - llSetVehicleRotationParam, - llSetVehicleFlags, - and llRemoveVehicleFlags - library calls.

These script calls are described in more detail below, but - the important thing to notice here is that the vehicle behavior - has several parameters that can be adjusted to change how the - vehicle handles. Depending on the values chosen the vehicle can - veer like a boat in water, or ride like a sled on rails.

Setting the vehicle flags allow you to make exceptions to - some default behaviors. Some of these flags only have an effect - when certain behaviors are enabled. For example, the - VEHICLE_FLAG_HOVER_WATER_ONLY will make the vehicle ignore the - height of the terrain, however it only makes a difference if the - vehicle is hovering.


11.2. Warnings

Vehicles are a work in progress and will - likely experience changes in future versions of Second Life. - Some of the details of vehicle behavior may be changed - as necessary to ensure stability - and user safety. In particular, many of the limits and defaults - described in the appendices will probably change and should not be - relied upon in the long term.

It is not recommended that you mix vehicle behavior with - some of the other script calls that provide impulse and forces to - the object, especially llSetBuoyancy, llSetForce, llSetTorque, and llSetHoverHeight.

While the following methods probably don't cause any - instabilities, their behavior may conflict with vehicles and cause - undesired and/or inconsistent results, so use llLookAt, llRotLookAt, llMoveToTarget, and llTargetOmega at your own - risk.

If you think you have found a bug relating to how vehicle's - work, one way to submit the problem is to give a copy of the - vehicle and script to Andrew Linden with comments or a notecard - describing the problem. Please name all submissions "Bugged - Vehicle XX" where XX are your Second Life initials. The - vehicle and script will be examined at the earliest - convenience.


11.3. Definitions

The terms "roll", "pitch", and - "yaw" are often used to describe the modes of rotations - that can happen to a airplane or boat. They correspond to - rotations about the local x-, y-, and z-axis respectively.


        z-axis  .
-      yaw-axis /|\
-                |     __. y-axis
-   ._        ___|      /| pitch-axis
-  _||\       \\ |\.   /
-  \|| \_______\_|__\_/_______
-   | _ _   o o o o o o o    |\_  ______\ x-axis
-   // ./_______,----,__________)       / roll-axis
-  /_,/        //  ./
-             /__,/ 
-	

The right-hand-rule, often introduced in beginning physics - courses, is used to define the direction of positive rotation - about any axis. As an example of how to use the right hand rule, - consider a positive rotation about the roll axis. To help - visualize how such a rotation would move the airplane, place your - right thumb parallel to the plane's roll-axis such that the thumb - points in the positive x-direction, then curl the four fingers - into a fist. Your fingers will be pointing in the direction that - the plane will spin.


    .-.--.--.--.              __
-   / /  /  /  _ \            /  \
-  (-(- (- (- (   | _________|______\ axis of
-   \.\._\._\._)  |          |      / rotation
-    |           \:__,---.  \|/
-    |                    |  + positive
-     \           .,_.___.'    rotation
-      \_ ^ `.__,/ 
-      |      / 
-      |      | 
-	

Many of the parameters that control a vehicle's behavior are - of the form: VEHICLE_BEHAVIOR_TIMESCALE. A behavior's - "timescale" can usually be understood as the time for - the behavior to push, twist, or otherwise affect the vehicle such - that the difference between what it is doing, and what it is - supposed to be doing, has been reduced to 1/e of what it was, - where "e" is the natural exponent (approximately - 2.718281828). In other words, it is the timescale for exponential - decay toward full compliance to the desired behavior. When you - want the vehicle to be very responsive use a short timescale of - one second or less, and if you want to disable a behavior then set - the timescale to a very large number like 300 (5 minutes) or - more. Note, for stability reasons, there is usually a limit to how - small a timescale is allowed to be, and is usually on the order of - a tenth of a second. Setting a timescale to zero is safe and is - always equivalent to setting it to its minimum. Any feature with a - timescale can be effectively disabled by setting the timescale so - large that it would take them all day to have any - effect.


11.4. Setting the Vehicle Type

Before any vehicle parameters can be set the vehicle - behavior must first be enabled. It is enabled by calling llSetVehicleType with any - VEHICLE_TYPE_*, except VEHICLE_TYPE_NONE which will disable the - vehicle. See the vehicle type - constants section for currently available types. More types - will be available soon.

Setting the vehicle type is necessary for enabling the - vehicle behavior and sets all of the parameters to its default - values. For each vehicle type listed we provide the corresponding - equivalent code in long format. Is is - important to realize that the defaults are - not the optimal settings for any of these - vehicle types and that they will definitely be changed in the - future. Do not rely on these values to be constant until - specified.

Should you want to make a unique or experimental vehicle you - will still have to enable the vehicle behavior with one of the - default types first, after which you will be able to change any of - the parameters or flags within the allowed ranges.

Setting the vehicle type does not automatically take - controls or otherwise move the object. However should you enable - the vehicle behavior while the object is free to move and parked - on a hill then it may start to slide away.

We're looking for new and better default vehicle types. If - you think you've found a set of parameters that make a better car, - boat, or any other default type of vehicle then you may submit - your proposed list of settings to Andrew Linden via a script or - notecard.


11.5. Linear and Angular Deflection

A common feature of real vehicles is their tendency to move - along "preferred axes of motion". That is, due to - their wheels, wings, shape, or method of propulsion they tend to - push or redirect themselves along axes that are static in the - vehicle's local frame. This general feature defines a - class of vehicles and included in this category a common - dart is a "vehicle": it - has fins in the back such that if it were to tumble in the air it - would eventually align itself to move point-forward -- we'll call - this alignment effect angular - deflection.

A wheeled craft exhibits a - different effect: when a - skateboard is pushed in some direction it will tend to redirect - the resultant motion along that which it is free to roll -- we'll - call this effect linear deflection.

So a typical Second Life vehicle is an object that - exhibits linear and/or angular deflection along the - "preferential axes of motion". The default - preferential axes of motion are the local x- (at), y- (left), and - z- (up) axes of the local frame of the - vehicle's root primitive. The deflection behaviors relate to the - x-axis (at): linear deflection will tend to rotate its velocity - until it points along it's positive local x-axis while the - angular deflection will tend to reorient the vehicle such that - it's x-axis points in the direction that it is moving. The other - axes are relevant to vehicle behaviors that are described later, - such as the - vertical attractor - which tries to keep a vehicle's - local z-axis pointed toward the world z-axis (up). The vehicle - axes can be rotated relative to the object's actual local axes by - using the - VEHICLE_REFERENCE_FRAME - parameter, however that is an - advanced feature and is covered in detail in a later section of - these documents.

Depending on the vehicle it might be desirable to have lots - of linear and/or angular deflection or not. The speed of the - deflections are controlled by setting the relevant parameters - using the llSetVehicleFloatParam - script call. Each variety of deflection has a - "timescale" parameter that determines how quickly a - full deflection happens. Basically the timescale it the time - coefficient for exponential decay toward full deflection. So, a - vehicle that deflects quickly should have a small timescale. For - instance, a typical dart might have a angular deflection - timescale of a couple of seconds but a linear deflection of - several seconds; it will tend to reorient itself before it - changes direction. To set the deflection timescales of a dart - you might use the lines below:


llSetVehicleFloatParam(VEHICLE_ANGULAR_DEFLECTION_TIMESCALE, 2.0);
-llSetVehicleFloatParam(VEHICLE_LINEAR_DEFLECTION_TIMESCALE, 6.0);
-	

Each variety of deflection has an "efficiency" - parameter that is a slider between 0.0 and 1.0. Unlike the other - efficiency parameters of other vehicle behaviors, the deflection - efficiencies do not slide between "bouncy" and - "damped", but instead slide from "no deflection - whatsoever" (0.0) to "maximum deflection" (1.0). - That is, they behave much like the deflection timescales, however - they are normalized to the range between 0.0 and 1.0.


11.6. Moving and Steering the Vehicle

Once enabled, a vehicle can be pushed and rotated by - external forces and/or from script calls such as - llApplyImpulse, - however linear and angular motors have been built in - to make motion smoother and easier to control. - Their directions can be set using the - llSetVehicleVectorParam - call. For example, to make the vehicle try to move at 5 - meters/second along its local x-axis (the default look-at - direction) you would put the following line in your script:


llSetVehicleVectorParam(VEHICLE_LINEAR_MOTOR_DIRECTION, <5, 0, 0>);
-	

The motor strength is not the full story, since you can also - control how fast the motor engages (VEHICLE_LINEAR_MOTOR_TIMESCALE) - and there is a parameter that causes the motor's effectiveness to - decay over time (VEHICLE_LINEAR_MOTOR_DECAY_TIMESCALE).

Steering the vehicle involves setting the - VEHICLE_ANGULAR_MOTOR_DIRECTION and related parameters. - It is also possible to set some flags that allow the angular - motor slave to your camera view when in mouselook.

For more details about the vehicle motors - read the sections on the linear - and angular - motors below.


11.7. The Linear Motor

The parameters that control the linear motor are:

  • VEHICLE_LINEAR_MOTOR_DIRECTION

    A vector. - It is the velocity (meters/sec) that the vehicle will - try to attain. It points in the vehicle's local frame, and has a - maximum length of 40.

  • VEHICLE_LINEAR_MOTOR_OFFSET

    A vector. - It is the offset point from the vehicle's center of mass at which - the linear motor's impulse is applied. This allows the linear motor - to also cause rotational torque. It is in the vehicle's local - frame and its maximum length is 100 meters! No need to worry - about stability -- if the vehicle starts to spin too fast - (greater than about 4*PI radians per second) then angular - velocity damping will kick in. The reason the offset is allowed - to be so large is so that it can compete with the other vehicle - behaviors such as angular deflection - and the vertical - attractor. Some of the other vehicle behaviors may - drastically reduce the effective torque from the linear motor - offset, in which case a longer leverage arm may help.

  • VEHICLE_LINEAR_MOTOR_TIMESCALE

    A float. Determines how long it takes for the motor to - push the vehicle to full speed. Its minimum value is approximately - 0.06 seconds.

  • VEHICLE_LINEAR_MOTOR_DECAY_TIMESCALE

    A float. The effectiveness of the motor will exponentially - decay over this timescale, but the effectiveness will be reset - whenever the motor's value is explicitly set. The maximum value - of this decay timescale is 120 seconds, - and this timescale is always in effect.

The flags that affect the linear motor are:

  • VEHICLE_FLAG_LIMIT_MOTOR_UP

    Useful for "ground vehicles". - Setting this flag will clamp the z-component of the linear - motor (in world frame) to prevent it from defeating gravity.

Setting the motor speed is not enough to enable all - interesting vehicles. For example, some will want a car that - immediately gets up to the speed they want, while others will want - a boat that slowly climbs up to its maximum velocity. To control - this effect the VEHICLE_LINEAR_MOTOR_TIMESCALE parameter can be - used. Basically the "timescale" of a motor is the - time constant for the vehicle to exponentially accelerate toward - its full speed.

What would happen if you were to accidentally set the - vehicle's linear velocity to maximum possible speed and then let - go? It would run away and never stop, right? Not necessarily: an - automatic "motor decay" has been built in such that all - motors will gradually decrease their effectiveness after being - set.

Each time the linear motor's vector is set its - "grip" - immediately starts to decay exponentially with a timescale - determined by the VEHICLE_LINEAR_MOTOR_DECAY_TIMESCALE, such - that after enough time the motor ceases to have any effect. - This decay timescale serves two purposes. First, since it - cannot be set longer than 120 seconds, - and is always enabled it - guarantees that a vehicle will not push itself about forever - in the absence - of active control (from keyboard commands or some logic loop in - the script). Second, it can be used to push some vehicles around - using a simple impulse model. That is, rather than setting the - motor "on" or "off" depending on whether - a particular key is pressed "down" or "up" - the decay timescale can be set short and the motor can be set - "on" whenever the key transitions from "up" - to "down" and allowed to automatically decay.

Since the motor's effectiveness is reset whenever the - motor's vector is set, then setting it to a vector of length zero - is different from allowing it to decay completely. The first case - will cause the vehicle to try to reach zero velocity, while the - second will leave the motor impotent.

The two motor timescales have very similar names, but have - different effects, so try not to get them confused. - VEHICLE_LINEAR_MOTOR_TIMESCALE is the time for motor to - "win", and VEHICLE_LINEAR_MOTOR_DECAY_TIMESCALE is the - time for the motor's "effectiveness" to decay toward - zero. If you set one when you think you are changing the other - you will have frustrating results. Also, if the motor's decay - timescale is shorter than the regular timescale, then the - effective magnitude of the motor vector will be - diminished.


11.8. The Angular Motor

The parameters that control the angular motor are:

  • VEHICLE_ANGULAR_MOTOR_DIRECTION

    A vector. It is the angular velocity (radians/sec) - that the vehicle will try to rotate. It points in the vehicle's - local frame, and has a maximum value of 4*PI (two revolutions - per second).

  • VEHICLE_ANGULAR_MOTOR_TIMESCALE

    A float. Determines how long it takes for the motor to - spin the vehicle to full speed. Its minimum value is approximately - 0.06 seconds.

  • VEHICLE_ANGULAR_MOTOR_DECAY_TIMESCALE

    A float. The effectiveness of the motor will exponentially - decay over this timescale, but the effectiveness will be reset - whenever the motor's value is explicitly set. The maximum value - of this decay timescale is 120 seconds, - and this timescale is always in effect.

Like the linear motor the angular motor can be set explicitly, - and has magnitude/direction, a timescale, and a decay timescale.

When it comes to actually steering a vehicle there are - several ways to do it. One way would be for the script to grab - keyboard input and to explicitly turn the motor on/off based on - which keys are pressed. When steering this way you probably - don't want it to turn very far or for very long. One way to do - it using the angular motor would be to leave the decay timescale - long, enable a significant amount of angular friction (to - quickly slow the vehicle down when the motor is turned off) then - set the angular motor to a large vector on a key press, and set - it to zero when the key is released. That has the effect of - making the vehicle unresponsive to external collisions, due to - the angular friction.

Another way to do it is to set the - VEHICLE_ANGULAR_MOTOR_DECAY_TIMESCALE to a short value and push - the vehicle about with a more impulsive method that sets the - motor fast on a key press down (and optionally setting the motor - to zero on a key up) relying on the automatic exponential decay - of the motor's effectiveness rather than a constant angular - friction.

Finally, it may be possible to discard the angular motor - entirely and use the VEHICLE_LINEAR_MOTOR_OFFSET. Whenever the - offset has a component that is perpendicular to the direction - of the linear motor the vehicle will rotate as it travels. - Note, with the incorrect values for offset and strength the - linear motor effect can easily cause the vehicle to tumble - and spin uncontrollably, so experiement with small offsets - first!.

Setting the angular motor to zero magnitude is different - from allowing it to decay. When the motor completely decays - it no longer affects the motion of the vehicle, however setting - it to zero will reset the "grip" of the vehicle and - will make the vehicle try to achieve zero angular velocity. -

Many real vehicles bank (roll about their - forward axis) to effect a turn, such as motorcycles and airplanes. - To make it easier to build banking vehicles there is - banking behavior - available which can be controlled by setting other parameters and is - described in more detail here.

It is also possible to make a - vehicle turn in response - to changing the camera view - (right now this only works in mouselook).


11.9. Using the Camera to Steer

The vehicle can be instructed to rotate its forward axis - to point in the same direction as the camera view. This - is achieved by setting some flags that change how the - VEHICLE_ANGULAR_MOTOR_DIRECTION is interpreted. When used properly - this feature has the advantage of being able to provide simple - and stable steering that is resilient to bad render frame rates - on the client.

The flags that affect the angular motor are:

  • VEHICLE_FLAG_MOUSELOOK_STEER

    Steer the vehicle using the mouse. Use this flag to make - the angular motor try to make the vehicle - turn such that its local x-axis points in the same direction as - the client-side camera.

  • VEHICLE_FLAG_MOUSELOOK_BANK

    Same as above, but relies on banking. It remaps left-right - motions of the client camera (also known as "yaw") to rotations about - the vehicle's local x-axis (also known as "roll").

  • VEHICLE_FLAG_CAMERA_DECOUPLED

    Makes mouselook camera rotate independently of the vehicle. - By default the client mouselook camera will rotate about - with the vehicle, however when this flag is set the camera - direction is independent of the vehicle's rotation.

When using the VEHICLE_FLAG_MOUSELOOK_STEER (or - VEHICLE_FLAG_MOUSELOOK_BANK) the meaning of the - VEHICLE_ANGULAR_MOTOR_DIRECTION parameter subtly changes. Instead - of representing the "angular velocity" of the motor - the components of the parameter scale the "measured angular - velocity" (as determined by the rotation between - the client's camera view direction and the forward-axis of the vehicle) - to compute the "final angular velocity". That is, - suppose you set the angular motor to <0, 0, 5>, then moved the - camera view to be PI/4 radians to the left of the vehicle's forward axis, - and down PI/8 toward the ground. - The measured angular velocity would be <0, -PI/8, PI/4> - radians/second, but the final velocity would be <0, 0, 5*PI/4>... - the vehicle will turn left, but will not dip its nose down. - Thus, by setting a component of the VEHICLE_ANGULAR_MOTOR_DIRECTION - to zero, one can negate the pitch or yaw response of the motor, - or even scale one to be much more responsive than the other. -

The VEHICLE_ANGULAR_MOTOR_TIMESCALE still has an effect when - using mouselook control, and scales the global responsiveness of the - angular motor. The VEHICLE_ANGULAR_MOTOR_DECAY_TIMESCALE, on the other - hand, is ignored when using mouselook controls.


11.10. The Vertical Attractor

Some vehicles, like boats, should always keep their up-side - up. This can be done by enabling the "vertical - attractor" behavior that springs the vehicle's local z-axis - to the world z-axis (a.k.a. "up"). To take advantage of - this feature you would set the VEHICLE_VERTICAL_ATTRACTION_TIMESCALE - to control the period of the spring frequency, and then set the - VEHICLE_VERTICAL_ATTRACTION_EFFICIENCY to control the damping. An - efficiency of 0.0 will cause the spring to wobble around its - equilibrium, while an efficiency of 1.0 will cause the spring to - reach it's equilibrium with exponential decay.


llSetVehicleVectorParam(VEHICLE_VERTICAL_ATTRACTION_TIMESCALE, 4.0);
-llSetVehicleVectorParam(VEHICLE_VERTICAL_ATTRACTION_EFFICIENCY, 0.5);
-	

The vertical attractor is disabled by setting its timescale - to anything larger than 300 seconds.

Note that by default the vertical attractor will prevent the - vehicle from diving and climbing. So, if you wanted to make a - airplane you would probably want to unlock the attractor around the - pitch axis by setting the VEHICLE_FLAG_LIMIT_ROLL_ONLY bit:


llSetVehicleFlags(VEHICLE_FLAG_LIMIT_ROLL_ONLY);
-	


11.11. Banking

The vertical attractor feature must be enabled in order for - the banking behavior to function. The way banking works is this: a - rotation around the vehicle's roll-axis will produce a angular - velocity around the yaw-axis, causing the vehicle to turn. The - magnitude of the yaw effect will be proportional to the - VEHICLE_BANKING_EFFICIENCY, the angle of the roll rotation, and - sometimes the vehicle's velocity along it's preferred axis of - motion.

The VEHICLE_BANKING_EFFICIENCY can vary between -1 and +1. When - it's positive then any positive rotation (by the right-hand rule) - about the roll-axis will effect a (negative) torque around the - yaw-axis, making it turn to the right -- that is the vehicle will - lean into the turn, which is how real airplanes and motorcycle's - work. Negating the banking coefficient will make it so that the - vehicle leans to the outside of the turn (not very - "physical" but might allow interesting vehicles so why - not?).

The VEHICLE_BANKING_MIX is a fake (i.e. non-physical) - parameter that is useful for making banking vehicles do what you - want rather than what the laws of physics allow. For example, - consider a real motorcycle... it must be moving forward in order - for it to turn while banking, however video-game motorcycles are - often configured to turn in place when at a dead stop -- because - they're often easier to control that way using the limited - interface of the keyboard or game controller. The - VEHICLE_BANKING_MIX enables combinations of both realistic and - non-realistic banking by functioning as a slider between a banking - that is correspondingly totally static (0.0) and totally dynamic - (1.0). By "static" we mean that the banking effect - depends only on the vehicle's rotation about it's roll-axis - compared to "dynamic" where the banking is also - proportional to it's velocity along it's roll-axis. Finding the - best value of the "mixture" will probably require trial - and error.

The time it takes for the - banking behavior to defeat a - pre-existing angular velocity about the world z-axis is determined - by the VEHICLE_BANKING_TIMESCALE. So if you want the vehicle to - bank quickly then give it a banking timescale of about a second or - less, otherwise you can make a sluggish vehicle by giving it a - timescale of several seconds.


11.12. Friction Timescales

VEHICLE_LINEAR_FRICTION_TIMESCALE is a vector parameter that - defines the timescales for the vehicle to come to a complete stop - along the three local axes of the - vehicle's reference frame. - The timescale along each axis is independent of the others. - For example, a sliding ground car would probably have very little - friction along its x- and z-axes (so it can easily slide forward - and fall down) while there would usually significant friction - along its y-axis:


llSetVehicleVectorParam(VEHICLE_LINEAR_FRICTION_TIMESCALE, <1000, 1000, 3>);
-	

Remember that a longer timescale corresponds to a weaker - friction, hence to effectively disable all linear friction you - would set all of the timescales to large values.

Setting the linear friction as a scalar is allowed, and has - the effect of setting all of the timescales to the same - value. Both code snippets below are equivalent, and both make friction - negligible:


// set all linear friction timescales to 1000
-llSetVehicleVectorParam(VEHICLE_LINEAR_FRICTION_TIMESCALE, <1000, 1000, 1000>);
-	


// same as above, but fewer characters
-llSetVehicleFloatParam(VEHICLE_LINEAR_FRICTION_TIMESCALE, 1000);
-	

VEHICLE_ANGULAR_FRICTION_TIMESCALE is also a vector - parameter that defines the timescales for the vehicle to stop - rotating about the x-, y-, and z-axes, and are set and disabled in - the same way as the linear friction.


11.13. Buoyancy

The vehicle has a built-in buoyancy feature that is - independent of the llSetBuoyancy call. It - is recommended that the two buoyancies do not mix! To make - a vehicle buoyant, set the VEHICLE_BUOYANCY parameter to something - between -1.0 (extra gravity) to 1.0 (full anti-gravity). -

The buoyancy behavior is independent of hover, however - in order for hover to work without a large offset of the - VEHICLE_HOVER_HEIGHT, the VEHICLE_BUOYANCY should be set to 1.0. -

It is not recommended that you mix vehicle buoyancy with - the llSetBuoyancy script call. - It would probably cause the object to fly up into space.


11.14. Hover

The hover behavior is enabled by setting the - VEHICLE_HOVER_TIMESCALE to a value less than 300 seconds; larger - timescales totally disable it. Most vehicles will work - best with short hover timescales of a few seconds or less. - The shorter the timescale, the faster the vehicle will - slave to is target height. Note, that if the values of - VEHICLE_LINEAR_FRICTION_TIMESCALE may affect the speed of - the hover.

Hover is independent of buoyancy, however the - VEHICLE_BUOYANCY should be set to 1.0, otherwise the vehicle - will not lift itself off of the ground until the - VEHICLE_HOVER_HEIGHT is made large enough to counter the - acceleration of gravity, and the vehicle will never float - all the way to its target height.

The VEHICLE_HOVER_EFFICIENCY can be thought of as a slider - between bouncy (0.0) and smoothed (1.0). When in the - bouncy range the vehicle will tend to hover a little lower than - its target height and the VEHICLE_HOVER_TIMESCALE will be - approximately the oscillation period of the bounce (the real - period will tend to be a little longer than the timescale).

For performance reasons, until improvements are made to the - Second Life physics engine the vehicles can only hover over the - terrain and water, so they will not be able to hover above - objects made out of primitives, such as bridges and houses. By - default the hover behavior will float over terrain and water, - however this can be changed by setting some flags:

If you wanted to make a boat you should set the - VEHICLE_HOVER_WATER_ONLY flag, or if you wanted to drive a hover - tank under water you would use the - VEHICLE_HOVER_TERRAIN_ONLY flag instead. - Finally, if you wanted to make a submarine or a balloon you would use the - VEHICLE_FLAG_HOVER_GLOBAL_HEIGHT. Note that - the flags are independent of each other and that setting two - contradictory flags will have undefined behavior. The flags are - set using the script call llSetVehicleFlags().

The VEHICLE_HOVER_HEIGHT determines - how high the vehicle - will hover over the terrain and/or water, or the global height, - and has a maximum value of 100 meters. Note that for hovering - purposes the "center" of the vehicle is its "center of mass" - which is not always obvious to the untrained eye, and it - changes when avatar's sit on the vehicle.


11.15. Reference Frame

The vehicle relies on the x- (at), y- (left), and z- (up) - axes in order to figure out which way it prefers to move and - which end is up. By default these axes are identical to the - local axes of the root primitive of the object, however this - means that the vehicle's root primitive must, by default, be - oriented to agree with the designed at, left, and up axes of the - vehicle. But, what if the vehicle object was already pre-built - with the root primitive in some non-trivial orientation - relative to where the vehicle as a whole should move? This is - where the VEHICLE_REFERENCE_FRAME parameter becomes useful; the - vehicle's axes can be arbitrarily reoriented by setting this - parameter.

As an example, suppose you had built a rocket out of a big - cylinder, a cone for the nose, and some stretched cut boxes for - the fins, then linked them all together with the cylinder as the - root primitive. Ideally the rocket would move nose-first, - however the cylinder's axis of symmetry is its local z-axis while - the default "at-axis" of the vehicle, the axis it will - want to deflect to forward under angular deflection, is the local - x-axis and points out from the curved surface of the cylinder. - The script code below will rotate the vehicle's axes such that - the local z-axis becomes the "at-axis" and the local - negative x-axis becomes the "up-axis":


// rotate the vehicle frame -PI/2 about the local y-axis (left-axis)
-rotation rot = llEuler2Rot(0, PI/2, 0);
-llSetVehicleRotationParam(VEHICLE_REFERENCE_FRAME, rot);
-

Another example of how the reference frame parameter could - be used is to consider flying craft that uses the vertical - attractor for stability during flying but wants to use VTOL - (vertical takeoff and landing). During flight the craft's dorsal - axis should point up, but during landing its nose-axis should be - up. To land the vehicle: while the - vertical attractor - is in effect, rotate the existing VEHICLE_REFERENCE_FRAME by +PI/2 - about the left-axis, then the vehicle will pitch up such that - it's nose points toward the sky. The vehicle could be allowed to - fall to the landing pad under friction, or a decreasing hover - effect.


Appendix A. Linden Library Functions

Complete listing of the Linden Library function calls - available in lsl.


A.1. llAbs

integer llAbs(integer val);

Returns the absolute value of - val.


A.2. llAcos

float llAcos(float val);

Returns the arccosine in radians of - val.


A.3. llAddToLandPassList

llAddToLandPassList(key avatar, float hours);

Add avatar to the land pass list for - hours.


A.4. llAdjustSoundVolume

llAdjustSoundVolume(float volume);

Adjusts the volume of the currently playing attached sound - started with llPlaySound or - llLoopSound. This function - Has no effect on sounds started with llTriggerSound.


A.5. llAllowInventoryDrop

llAllowInventoryDrop(integer add);

If add == TRUE, users that do no have - object modify permissions can still drop inventory items onto - object.


A.6. llAngleBetween

float llAngleBetween(rotation a, rotation b);

Returns the angle in radians between rotations - a and b.


A.7. llApplyImpulse

llApplyImpulse(vector force, integer local);

Applies the impulse in local - coordinates if local == TRUE. Otherwise the - impulse is applied in global coordinates. This function only works - on physical objects.


A.8. llApplyRotationalImpulse

llApplyRotationalImpulse(vector force, integer local);

Applies a rotational impulse force in - local coordinates if local == - TRUE. Otherwise the impulse is applied in global coordinates. This - function only works on physical objects.


A.9. llAsin

float llAsin(float val);

Returns the arcsine in radians of - val.


A.10. llAtan2

float llAtan2(float y, float x);

returns the arctangent2 of y, - x


A.11. llAttachToAvatar

llAttachToAvatar(key avatar, integer attachment);

Attach to avatar at point attachment. - Requires the PERMISSION_ATTACH runtime - permission.


A.12. llAvatarOnSitTarget

key llAvatarOnSitTarget(void);

If an avatar is sitting on the sit target, return - the avatar's key, NULL_KEY otherwise. - This only will detect avatars sitting on sit targets defined with llSitTarget.


A.13. llAxes2Rot

rotation llAxes2Rot(vector fwd, vector left, vector up);

Returns the rotation represented by coordinate axes - fwd, left, and - up.


A.14. llAxisAngle2Rot

rotation llAxisAngle2Rot(vector axis, float angle);

Returns the rotation generated angle - about axis.


A.15. llBase64ToString

string llBase64ToString(string str);

Converts a Base 64 string to a conventional string. If the - conversion creates any unprintable characters, they are converted to - spaces.


A.16. llBreakAllLinks

llBreakAllLinks(void);

Delinks all objects in the link set. Requires the permission - PERMISSION_CHANGE_LINKS - be set.


A.17. llBreakLink

llBreakLink(integer linknum);

Delinks the object with the given - link number. Requires permission PERMISSION_CHANGE_LINKS - be set.


A.18. llCSV2List

list llCSV2List(string src);

Create a list from a string of comma separated values - specified in src.


A.19. llCeil

integer llCeil(float val);

Returns largest integer value >= - val.


A.20. llCloseRemoteDataChannel

llCloseRemoteDataChannel(key channel);

Closes XML-RPC channel.


A.21. llCloud

float llCloud(vector offset);

Returns the cloud density at the object position + - offset.


A.22. llCollisionFilter

llCollisionFilter(string name, key id, integer accept);

If accept == TRUE, only accept - collisions with objects name and - id, otherwise with objects not - name or id. Specify - an empty string or NULL_KEY to - not filter on the corresponding parameter.


A.23. llCollisionSound

llCollisionSound(string impact_sound, float impact_volume);

Suppress default collision sounds, replace default impact - sounds with impact_sound found in the - object inventory. Supply an empty string to suppress collision - sounds.


A.24. llCollisionSprite

llCollisionSprite(string impact_sprite);

Suppress default collision sprites, replace default impact - sprite with impact_sprite found in the - object inventory. Supply an empty string to just suppress.


A.25. llCos

float llCos(float theta);

Returns the cosine of theta - radians.


A.26. llCreateLink

llCreateLink(key target, integer parent);

Attempt to link object script is attached to and - target. Requires permission PERMISSION_CHANGE_LINKS - be set. If parent == TRUE, object script is - attached to is the root.


A.27. llDeleteSubList

list llDeleteSubList(list src, integer start, integer end);

Remove the slice from the list and return the remainder. - The start and end - are inclusive, so 0, length - 1 would delete the entire list and - 0,0 would delete the first list entry. Using negative numbers for - start and/or end - causes the index to count backwards from the length of the list, - so 0,-1 would delete the entire list. If - start is larger than - end the list deleted is the exclusion of the - entries, so 6,4 would delete the entire list except for the - 5th list entry.


A.28. llDeleteSubString

string llDeleteSubString(string src, integer start, integer end);

Removes the indicated substring and returns the result. The - start and end are - inclusive, so 0,length-1 would delete the entire string and 0,0 - would delete the first character. Using negative numbers for - start and/or end - causes the index to count backwards from the length of the string, - so 0,-1 would delete the entire string. If - start is larger than end the sub string is - the exclusion of the entries, so 6,4 would delete the entire - string except for the 5th - character.


A.29. llDetachFromAvatar

llDetachFromAvatar(key avatar);

Drop off of avatar.


A.30. llDetectedGrab

vector llDetectedGrab(integer number);

Returns the grab offset of detected object - number. Returns <0,0,0> if number is - not valid sensed object.


A.31. llDetectedGroup

integer llDetectedGroup(integer number);

Returns TRUE if detected object - number is part of same group as - owner.


A.32. llDetectedKey

key llDetectedKey(integer number);

Returns the key of detected object - number. Returns NULL_KEY if number is not valid sensed - object.


A.33. llDetectedLinkNumber

integer llDetectedLinkNumber(integer number);

Returns the link position of the triggered event for - touches. 0 for a non-linked object, 1 for the root of a linked - object, 2 for the first child, etc.


A.34. llDetectedName

string llDetectedName(integer number);

Returns the name of detected object - number. Returns empty string if - number is not valid sensed object.


A.35. llDetectedOwner

key llDetectedOwner(integer number);

Returns the key of detected number - object's owner. Returns invalid key if - number is not valid sensed object.


A.36. llDetectedPos

vector llDetectedPos(integer number);

Returns the position of detected object - number. Returns <0,0,0> if - number is not valid sensed object.


A.37. llDetectedRot

rotation llDetectedRot(integer number);

Returns the rotation of detected object - number. Returns <0,0,0,1> if - number is not valid sensed object).


A.38. llDetectedType

integer llDetectedType(integer number);

Returns the type (AGENT, ACTIVE, PASSIVE, SCRIPTED) of - detected object number. Returns 0 if - number is not valid sensed object. Note - that number is a bitfield, so comparisons - need to be a bitwise and check. eg: -


integer type = llDetectedType(0);
-if (type & AGENT)
-{
-  // ...do stuff with the agent
-}
-

-


A.39. llDetectedVel

vector llDetectedVel(integer number);

Returns the velocity of detected object - number. Returns <0,0,0> if - number is not valid sensed object.


A.40. llDialog

llDialog(key avatar, string message, list buttons, integer channel);

Opens a "notify box" in the top-right corner of the given avatar's screen displaying the message. Up to twelve buttons can be specified in a list of strings. When the player clicks a button, the name of the button is chatted on the specified channel. Channels work just like llSay(), so channel 0 can be heard by everyone. The chat originates at the object's position, not the avatar's position. e.g. -


LLDialog(who, "Are you a boy or a girl?", [ "Boy", "Girl" ], 4913);
-LLDialog(who, "This shows only an OK button.", [], 192);
-llDialog(who, "This chats so you can hear it.", ["Hooray"], 0);
-

-


A.41. llDie

llDie(void);

Delete the object which holds the script.


A.42. llDumpList2String

string llDumpList2String(list src, string separator);

Write the list out in a single string using separator between values.


A.43. llEscapeURL

string llEscapeURL(string url);

Returns the string that is the URL escaped version of url, - replacing spaces with %20 etc.


A.44. llEdgeOfWorld

integer llEdgeOfWorld(vector pos, vector dir);

Returns TRUE if the line along dir - from pos hits the edge of the world in the - current simulator and returns FALSE if that edge crosses into - another simulator.


A.45. llEjectFromLand

llEjectFromLand(key pest);

Ejects pest from land that you - own.


A.46. llEmail

llEmail(string address, string subject, string message);

Sends email to address with - subject and - message.


A.47. llEuler2Rot

rotation llEuler2Rot(vector vec);

Returns the rotation represented by Euler Angle - vec.


A.48. llFabs

float llFabs(float val);

Returns the absolute value of - val.


A.49. llFloor

integer llFloor(float val);

Returns largest integer value <= - val.


A.50. llFrand

float llFrand(float mag);

Returns a pseudo-random number between [0, - mag).


A.51. llGetAccel

vector llGetAccel(void);

Gets the acceleration.


A.52. llGetAttached

integer llGetAttached(void);

Returns the object attachment point or 0 if not attached.


A.53. llGetAgentInfo

integer llGetAgentInfo(key id);

Returns information about the given agent - id. Returns a bitfield of agent info constants.


A.54. llGetAgentSize

vector llGetAgentSize(key id);

If the agent id is in the same sim as - the object, returns the size of the avatar.


A.55. llGetAlpha

float llGetAlpha(integer face);

Returns the alpha of the given - face. If face is - ALL_SIDES the value returned is - the mean average of all faces.


A.56. llGetAndResetTime

float llGetAndResetTime(void);

Returns the seconds of elapsed time from an internal timer - associated with the script. The timer is reset to zero during the - call. The timer is also reset on rez, simulator restart, script - reset, and in calls to llResetTime. Use llSetTimerEvent if you want a - reliable timing mechanism.


A.57. llGetAnimation

string llGetAnimation(key id);

Returns the currently playing animation for avatar - id.


A.58. llGetAnimationList

list llGetAnimationList(key id);

Returns a list of currently playing animations for avatar - id.


A.59. llGetBoundingBox

list llGetBoundingBox(key object);

Returns the bounding box around object (including any linked prims) - relative to the root prim. Returned value is a list of the form: - [ (vector) min_corner, (vector) max_corner ]


A.60. llGetCenterOfMass

vector llGetCenterOfMass(void);

Returns the center of mass of the root object.


A.61. llGetColor

vector llGetColor(integer face);

Returns the color of face as a vector - of red, green, and blue values between 0 and 1. If - face is ALL_SIDES the color returned is the - mean average of each channel.


A.62. llGetCreator

key llGetCreator(void);

Returns the creator of the object which has the script.


A.63. llGetDate

string llGetDate(void);

Returns the current UTC date as YYYY-MM-DD.


A.64. llGetEnergy

float llGetEnergy(void);

Returns how much energy is in the object as a percentage of - maximum.


A.65. llGetForce

vector llGetForce(void);

Returns the current force if the script is physical.


A.66. llGetFreeMemory

integer llGetFreeMemory(void);

Returns the available heap space for the current script.


A.67. llGetGeometricCenter

vector llGetGeometricCenter(void);

Returns the geometric center of the linked set the script is attached to.


A.68. llGetGMTclock

float llGetGMTclock(void);

Returns the time in seconds since GMT midnight.


A.69. llGetInventoryCreator

key llGetInventoryCreator(string name);

Returns the key for the creator of the inventory - name.


A.70. llGetInventoryKey

key llGetInventoryKey(string name);

Returns the key of the inventory - name.


A.71. llGetInventoryName

string llGetInventoryName(integer type, integer number);

Get the name of the inventory item - number of type. Use - the inventory constants to - specify the type.


A.72. llGetInventoryNumber

integer llGetInventoryNumber(integer type);

Get the number of items of type in - the object inventory. Use the inventory constants to specify - the type.


A.73. llGetInventoryPermMask

integer llGetInventoryPermMask(string item, integer mask);

Returns the requested permission mask for the - specified inventory item. See Permission Mask Constants - for more information. Example usage: -


integer JeansPerms = llGetInventoryPermMask("Black Jeans", MASK_NEXT);
-if (JeansPerms & PERM_COPY)
-{
-	llSay(0, "The next owner may copy the 'Black Jeans'");
-}
-


A.74. llGetInventoryType

integer llGetInventoryType(string name);

Returns the type of the inventory - name. INVENTORY_NONE is returned if no - inventory matching name is found. Use the inventory constants to compare - against the return value.


A.75. llGetKey

key llGetKey(void);

Get the key for the object which has this script.


A.76. llGetLandOwnerAt

key llGetLandOwnerAt(vector pos);

Returns the key of the land owner at - pos or NULL_KEY if public.


A.77. llGetLinkKey

key llGetLinkKey(integer linknum);

Returns the key of linknum in the link - set.


A.78. llGetLinkName

string llGetLinkName(integer linknum);

Returns the name of linknum in the - link set.


A.79. llGetLinkNumber

integer llGetLinkNumber(void);

Returns what link number in a link set the for the object - which has this script. 0 means no link, 1 the root, 2 for first - child, etc.


A.80. llGetListEntryType

integer llGetListEntryType(list src, integer index);

Returns the type of the - variable at index in - src.


A.81. llGetListLength

integer llGetListLength(list src);

Returns the number of elements in - src.


A.82. llGetLocalPos

vector llGetLocalPos(void);

Returns the local position of a child object relative to the - root.


A.83. llGetLocalRot

rotation llGetLocalRot(void);

Returns the local rotation of a child object relative to the - root.


A.84. llGetMass

float llGetMass(void);

Returns the mass of the object in Kilograms. Most materials - in Second Life are less dense than their first life counterparts, - so the returned mass may be less than you might expect.


A.85. llGetObjectMass

float llGetObjectMass(key id);

Returns the mass of the object specified by id in Kilograms. Most materials - in Second Life are less dense than their first life counterparts, - so the returned mass may be less than you might expect.


A.86. llGetNextEmail

llGetNextEmail(string address, string subject);

Get the next waiting email with appropriate - address and/or - subject. If the parameters are blank, they - are not used for filtering.


A.87. llGetNotecardLine

key llGetNotecardLine(string name, integer line);

This function fetches line number - line of notecard - name and returns the data through the dataserver event. The line count - starts at zero. If the requested line is past the end of the - notecard the dataserver - event will return the constant EOF string. The key returned by - this function is a unique identifier which will be supplied to the - dataserver event in the - requested parameter.


A.88. llGetNumberOfNotecardLines

key llGetNumberOfNotecardLines(string name);

This function reads the number of lines in notecard name - and returns this information through the dataserver event. - The key returned by this function is a unique identifier which will be supplied to the - dataserver event in the requested - parameter. You will need to cast the returned string to an integer.


A.89. llGetNumberOfPrims

integer llGetNumberOfPrims(void);

Returns the number of prims in the linked set the script is attached to.


A.90. llGetNumberOfSides

key llGetNumberOfSides(void);

Returns the number of sides of the current which has the - script.


A.91. llGetObjectDesc

string llGetObjectDesc(void);

Returns the description of the object which has the script.


A.92. llGetObjectName

string llGetObjectName(void);

Returns the name of the object which has the script.


A.93. llGetObjectPermMask

integer llGetObjectPermMask(integer mask);

Returns the requested permission mask for the root object the - task is attached to. See Permission Mask Constants - for more information. Example usage: -


integer ObjectPerms = llGetObjectPermMask(MASK_NEXT);
-if (ObjectPerms & PERM_COPY)
-{
-	llSay(0, "The next owner may copy this item");
-}
-


A.94. llGetOmega

vector llGetOmega(void);

Returns the omega.


A.95. llGetOwner

key llGetOwner(void);

Returns the owner of the object.


A.96. llGetOwnerKey

key llGetOwnerKey(key id);

Returns the owner of object - id.


A.97. llGetPermissions

integer llGetPermissions(void);

Returns what permissions have been enabled. eg: -


integer perm = llGetPermissions();
-if((perm & PERMISSION_DEBIT) == PERMISSION_DEBIT)
-{
-    // code goes here
-}
-


A.98. llGetPermissionsKey

key llGetPermissionsKey(void);

Returns avatar that has enabled permissions. Returns NULL_KEY if not enabled.


A.99. llGetPos

vector llGetPos(void);

Returns the position.


A.100. llGetPrimitiveParams

list llGetPrimitiveParams(list parameters);

Get primitive parameters specified in parameters. The - parameters are identical to the rules of llSetPrimitiveParams, and the returned list is ordered as such. Most requested parameters do not require a value to be associated, except for texture-related requests (PRIM_TEXTURE, PRIM_COLOR, and PRIM_BUMP_SHINY) which require a side number to be specified as well. - - Valid parameters can be found in the Primitive Constants. - Here is a simple example: -


llGetPrimitiveParams([PRIM_TYPE, PRIM_MATERIAL, PRIM_COLOR, ALL_SIDES, PRIM_POSITION]);
-

- This would return a list similar to this: -


    [PRIM_TYPE_BOX, PRIM_HOLE_DEFAULT, <0, 1, 0>, 0.0, <0, 0, 0>, <1, 1, 0>, <0, 0, 0>, // PRIM_TYPE
-     PRIM_MATERIAL_WOOD, 	// PRIM_MATERIAL
-     0, <1, 1, 1>, 1.0, 	// PRIM_COLOR (ALL_SIDES specified, so all 6 sides returned)
-     1, <1, 0, 0>, 0.5,
-     2, <0, 0, 1>, 1.0,
-     3, <0, 1, 0>, 1.0,
-     4, <0, 0, 0>, 0.5,
-     5, <1, 1, 1>, 1.0,
-     <37.341, 195.283, 31.239>]	// PRIM_POSITION
-


A.101. llGetRegionCorner

llGetRegionCorner(void);

Returns a vector with the south west corner position of the - current region.


A.102. llGetRegionFPS

llGetRegionFPS(void);

Returns the mean region frames per second.


A.103. llGetRegionName

string llGetRegionName(void);

Returns the current region name.


A.104. llGetRegionTimeDilation

float llGetRegionTimeDilation(void);

Returns the current time dilation as a float between 0 and 1.


A.105. llGetRootPosition

vector llGetRootPosition(void);

Returns the global position of the root object of the object the script is attached to.


A.106. llGetRootRotation

rotation llGetRootRotation(void);

Returns the global rotation of the root object of the object the script is attached to.


A.107. llGetRot

rotation llGetRot(void);

Returns the rotation.


A.108. llGetScale

vector llGetScale(void);

Returns the scale.


A.109. llGetScriptName

string llGetScriptName(void);

Returns the name of this script.


A.110. llGetStartParameter

integer llGetStartParameter(void);

Returns the start parameter passed to llRezObject or llRezAtRoot. If the object was - created from agent inventory, this function returns 0.


A.111. llGetScriptState

integer llGetScriptState(string name);

Resets TRUE if script name is running


A.112. llGetStatus

integer llGetStatus(integer status);

Returns the value of status. The - value will be one of the status - constants.


A.113. llGetSubString

string llGetSubString(string src, integer start, integer end);

Returns the indicated substring from - src. The start and - end are inclusive, so 0,length-1 would - capture the entire string and 0,0 would capture the first - character. Using negative numbers for start - and/or end causes the index to count - backwards from the length of the string, so 0,-1 would capture the - entire string. If start is larger than end the sub string is the - exclusion of the entries, so 6,4 would give the entire string - except for the 5th character.


A.114. llGetSunDirection

vector llGetSunDirection(void);

Returns the sun direction on the simulator.


A.115. llGetTexture

string llGetTexture(integer face);

Returns the texture of face if it is - found in object inventory.


A.116. llGetTextureOffset

vector llGetTextureOffset(integer side);

Returns the texture offset of side in - the x and y components of a vector.


A.117. llGetTextureRot

float llGetTextureRot(integer side);

Returns the texture rotation of - side.


A.118. llGetTextureScale

vector llGetTextureScale(integer side);

Returns the texture scale of side in - the x and y components of a vector.


A.119. llGetTime

float llGetTime(void);

Returns the seconds of elapsed time from an internal timer - associated with the script. The timer is reset on rez, simulator - restart, script reset, and in calls to llGetAndResetTime or llResetTime. Use llSetTimerEvent if you want a - reliable timing mechanism.


A.120. llGetTimeOfDay

float llGetTimeOfDay(void);

Gets the time in seconds since midnight in Second Life.


A.121. llGetTimestamp

string llGetTimestamp(void);

Returns a timestamp in the format: YYYY-MM-DDThh:mm:ss.ff..fZ.


A.122. llGetTorque

vector llGetTorque(void);

Returns the torque if the script is physical.


A.123. llGetVel

vector llGetVel();

Returns the velocity.


A.124. llGetWallclock

float llGetWallclock(void);

Returns the time in seconds since simulator timezone - midnight. Currently this is PST.


A.125. llGiveInventory

llGiveInventory(key destination, string inventory);

Give the named inventory item to the keyed avatar or object - in the same simulator as the giver. If the recipient is an avatar, - the avatar then follows the normal procedure of accepting or - denying the offer. If the recipient is an object, the same - permissions apply as if you were dragging inventory onto the - object by hand, ie if llAllowInventoryDrop has - been called with TRUE, any other object can pass objects to its - inventory.


A.126. llGiveInventoryList

llGiveInventoryList(key destination, string category, list inventory);

Give the list of named inventory items to the keyed avatar - or object in the same simulator as the giver. If the recipient is - an avatar, the avatar then follows the normal procedure of - accepting or denying the offer. The offered inventory is then - placed in a folder named category in the - recipients inventory. If the recipient is an object, the same - permissions apply as if you were dragging inventory onto the - object by hand, ie if llAllowInventoryDrop has - been called with TRUE, any other object can pass objects to its - inventory.If the recipient is an object, the - category parameter is ignored.


A.127. llGiveMoney

llGiveMoney(key destination, integer amount);

Transfer amount from the script owner - to destination. This call will fail if - PERMISSION_DEBIT has not - been set.


A.128. llGround

float llGround(vector offset);

Returns the ground height at the object position + - offset.


A.129. llGroundContour

vector llGroundContour(vector offset);

Returns the ground contour at the object position + - offset.


A.130. llGroundNormal

vector llGroundNormal(vector offset);

Returns the ground contour at the object position + - offset.


A.131. llGroundRepel

llGroundRepel(float height, integer water, float tau);

Critically damps to height if within - height * 0.5 of - level. The height - is above ground level if water is FALSE or - above the higher of land and water if water - is TRUE.


A.132. llGroundSlope

vector llGroundSlope(vector offset);

Returns the ground slope at the object position + - offset.


A.133. llInsertString

string llInsertString(string dst, integer position, string src);

Inserts src into - dst at position and - returns the result.


A.134. llInstantMessage

llInstantMessage(key user, string message);

Send message to the - user as an instant message.


A.135. llKey2Name

string llKey2Name(key id);

If object id is in the same - simulator, return the name of the object.


A.136. llList2CSV

string llList2CSV(list src);

Create a string of comma separated values from - list.


A.137. llList2Float

float llList2Float(list src, integer index);

Returns the float at index in the - list src.


A.138. llList2Integer

integer llList2Integer(list src, integer index);

Returns the integer at index in the list - src.


A.139. llList2Key

key llList2Key(list src, integer index);

Returns the key at index in the list - src.


A.140. llList2List

list llList2List(list src, integer start, integer end);

Returns the slice of the list from - start to end from - the list src as a new list. The - start and end - parameters are inclusive, so 0,length-1 would copy the entire list - and 0,0 would capture the first list entry. Using negative numbers - for start and/or end - causes the index to count backwards from the length of the list, - so 0,-1 would capture the entire list. If - start is larger than - end the list returned is the exclusion of - the entries, so 6,4 would give the entire list except for the - 5th entry.


A.141. llList2ListStrided

list llList2ListStrided(list src, integer start, integer end, integer stride);

Copy the strided slice of src from - start to end.


A.142. llList2Rot

rotation llList2Rot(list src, integer index);

Returns the rotation at index in - src.


A.143. llList2String

string llList2String(list src, integer index);

Returns the string at index in - src.


A.144. llList2Vector

llList2Vector(list src, integer index);

Returns the string at index in - src.


A.145. llListFindList

integer llListFindList(list src, list test);

Returns the position of the first instance of - test in src. Returns - -1 if test is not in - src.


A.146. llListInsertList

list llListInsertList(list dest, list src, integer pos);

Returns the list created by inserting - src into dest at - pos.


A.147. llListRandomize

list llListRandomize(list src, integer stride);

Returns src randomized into blocks of - size stride. If the length of - src divided by - stride is non-zero, this function does - not randomize the list.


A.148. llListReplaceList

list llListReplaceList(list dest, list src, integer start, integer end);

Returns the list created by replacing the segment of dest from - start to end with src.


A.149. llListSort

list llListSort(list src, integer stride, integer ascending);

Returns src sorted into blocks of - stride in ascending order if - ascending is TRUE. Note that sort only works in - the head of each sort block is the same type.


A.150. llListen

integer llListen(integer channel, string name, key id, string msg);

Sets a listen event callback for msg - on channel from name - and returns an identifier that can be used to deactivate or remove - the listen. The name, - id and/or msg - parameters can be blank to indicate not to filter on that - argument. Channel 0 is the public chat channel that all avatars - see as chat text. Channels 1 to 2,147,483,648 are hidden channels - that are not sent to avatars.


A.151. llListenControl

llListenControl(integer number, integer active);

Make a listen event callback active or inactive. Pass in the - value returned from llListen - to the number parameter to specify which - event you are controlling. Use boolean values to specify - active.


A.152. llListenRemove

llListenRemove(integer number);

Removes a listen event callback. Pass in the value returned - from llListen to the - number parameter to specify which event you - are removing.


A.153. llLoadURL

llLoadURL(key avatar_id, string message, string url);

Displays a dialog to user avatar_id - with message offering to - go to the web page at url. If the user clicks the - "Go to page" button, their default web browser is launched and - directed to url.

The url must begin with "http:" or - "https:", other protocols are not currently supported. - The dialog box shows the name of the object's - owner so that abuse (e.g. spamming) can be easily reported. - This function has a 10 second implicit sleep.


A.154. llLog

float llLog(float val);

Returns the natural logarithm (base e) of - val if val > 0, - otherwise returns 0.


A.155. llLog10

float llLog10(float val);

Returns the base 10 log of val if - val > 0, otherwise returns 0.


A.156. llLookAt

llLookAt(vector target, float strength, float damping);

Cause object to point the forward axis toward - target. Good - strength values are around half the mass of - the object and good damping values are less - than 1/10th of the - strength. Asymmetrical shapes require - smaller damping. A - strength of 0.0 cancels the look at.


A.157. llLoopSound

llLoopSound(string sound, float volume);

Similar to llPlaySound, this function plays - a sound attached to an object, but will continuously loop that - sound until llStopSound or - llPlaySound is called. Only - one sound may be attached to an object at a time. A second call to - llLoopSound with the same key will not restart the sound, but the - new volume will be used. This allows control over the volume of - already playing sounds. Setting the volume - to 0 is not the same as calling llStopSound; a sound with 0 - volume will continue to loop. To restart the sound from the - beginning, call llStopSound - before calling llLoopSound again.


A.158. llLoopSoundMaster

llLoopSoundMaster(string sound, float volume);

Behaviour is identical to llLoopSound, with the addition of - marking the source as a "Sync Master", causing "Slave" sounds to - sync to it. If there are multiple masters within a viewer's - interest area, the most audible one (a function of both distance - and volume) will win out as the master. The use of multiple - masters within a small area is unlikely to produce the desired - effect.


A.159. llLoopSoundSlave

llLoopSoundSlave(string sound, float volume);

Behaviour is identical to llLoopSound, unless there is a - "Sync Master" present. If a Sync Master is already playing the - Slave sound will begin playing from the same point the master is - in its loop synchronizing the loop points of both sounds. If a - Sync Master is started when the Slave is already playing, the - Slave will skip to the correct position to sync with the - Master.


A.160. llMakeExplosion

llMakeExplosion(integer particles, float scale, float velocity, float lifetime, float arc, string texture, vector offset);

Make a round explosion of particles using - texture from the object's inventory.


A.161. llMakeFire

llMakeFire(integer particles, float scale, float velocity, float lifetime, float arc, string texture, vector offset);

Make fire particles using texture - from the object's inventory.


A.162. llMakeFountain

llMakeFountain(integer particles, float scale, float velocity, float lifetime, float arc, string texture, vector offset);

Make a fountain of particles using - texture from the object's inventory.


A.163. llMakeSmoke

llMakeSmoke(integer particles, float scale, float velocity, float lifetime, float arc, string texture, vector offset);

Make smoky particles using texture - from the object's inventory.


A.164. llMD5String

string llMD5String(string str, integer nonce);

Performs a RSA Data Security, Inc. MD5 Message-Digest - Algorithm on str with - nonce. The function returns the digest as a - 32 character hex string. The digest is computed on the string in - the following format: -


str + ":" + (string)nonce
-

-


A.165. llMessageLinked

llMessageLinked(integer linknum, integer num, string str, key id);

Sends num, - str, and id to - members of the link set. The linknum - parameter is either the linked number available through llGetLinkNumber or a link constant.


A.166. llMinEventDelay

llMinEventDelay(float delay);

Set the minimum time between events being handled.


A.167. llModifyLand

llModifyLand(integer action, integer size);

Modify land with action on - size area. The parameters can be chosen - from the land constants.


A.168. llModPow

integer llModPow(integer a, integer b, integer c);

Raise a to the b power, modulo c. - b is capped at 0xFFFF (16 bits).


A.169. llMoveToTarget

llMoveToTarget(vector target, float tau);

Critically damp to position target in - tau seconds if the script is physical. Good - tau values are greater than 0.2. A - tau of 0.0 stops the critical - damping.


A.170. llOffsetTexture

llOffsetTexture(float offset_s, float offset_t, integer face);

Sets the texture s and t offsets of - face. If face is - ALL_SIDES this - function sets the texture offsets for all faces.


A.171. llOpenRemoteDataChannel

llOpenRemoteDataChannel(void);

Creates a channel to listen for XML-RPC calls. - Will trigger a remote_data event with type = REMOTE_DATA_CHANNEL and a channel id once it is available.


A.172. llOverMyLand

integer llOverMyLand(key id);

Returns TRUE if - id is over land owned by the object owner, - FALSE otherwise.


A.173. llParcelMediaCommandList

llParcelMediaCommandList(list command_list);

Controls the playback of movies and other multimedia resources on a land parcel. - command can be one of - PARCEL_MEDIA_COMMAND_STOP, - PARCEL_MEDIA_COMMAND_PAUSE, - PARCEL_MEDIA_COMMAND_PLAY, - PARCEL_MEDIA_COMMAND_LOOP, - PARCEL_MEDIA_COMMAND_TEXTURE, - PARCEL_MEDIA_COMMAND_URL, - PARCEL_MEDIA_COMMAND_TYPE, - PARCEL_MEDIA_COMMAND_DESC, - PARCEL_MEDIA_COMMAND_SIZE, - PARCEL_MEDIA_COMMAND_TIME, - PARCEL_MEDIA_COMMAND_AGENT, - PARCEL_MEDIA_COMMAND_UNLOAD, or - PARCEL_MEDIA_COMMAND_AUTO_ALIGN. -

You are allowed one movie (or "media" resource) per land parcel. - The movie will be played by replacing a texture on an object with the - movie. Users will only see the movie when they are standing on your - land parcel. Otherwise they will see the static texture.

Most of the QuickTime media formats are supported including: -

  • QuickTime movies (.mov)

  • Streamable stored QuickTime movies (.mov)

  • Real time QuickTime streams (rtsp://)

  • MPEG4 movies (.mp4, .mpeg4) (simple profile only)

  • QuickTime VR scenes and objects (.mov)

  • Flash movies (.swf) (only non-interative, version 5 and earlier

  • and many others from http://www.apple.com/quicktime/products/qt/specifications.html

- A good rule of thumb is if it plays in the QuickTime Media Player, it will play in Second Life. -

You can set up a movie for playback as follows: -

  • First, select a texture from your inventory to be the static texture. It should not be a common texture -- a test pattern would be better than the default plywood.

  • Apply that texture to an object.

  • Right click on your land and select "About Land..."

  • Under "Options" use the GUI to select the static texture.

  • Enter the URL of your movie or media stream.

  • Create objects you want to click on for PLAY, STOP, PAUSE and LOOP (play forever)

  • Attach the following script (or similar) to each.

-


default
-{
-    touch_start ( integer total_number )
-    {
-		// This will play the current movie for all agents in the parcel.
-        llParcelMediaCommandList( [PARCEL_MEDIA_COMMAND_LOOP] );
-    }
-}
-

-Or a more advanced example: -


float START_TIME = 30.0;
-float RUN_LENGTH = 10.0;
-
-default
-{
-	state_entry()
-	{
-		llParcelMediaCommandList( [
-			PARCEL_MEDIA_COMMAND_URL, "http://enter_your.url/here",
-			PARCEL_MEDIA_COMMAND_TEXTURE, (key) llGetTexture(0) ] );
-	}
-
-	touch_start(integer num_detected)
-	{
-		llParcelMediaCommandList( [
-			PARCEL_MEDIA_COMMAND_AGENT, llDetectedKey(0),
-			PARCEL_MEDIA_COMMAND_TIME, START_TIME,
-			PARCEL_MEDIA_COMMAND_PLAY ] );
-		list Info = llParcelMediaQuery([PARCEL_MEDIA_COMMAND_URL, PARCEL_MEDIA_COMMAND_TEXTURE]);
-		llSay(0, "Playing '" + llList2String(Info, 0) + "' on texture '" + (string)llList2Key(Info, 1) + "' for agent " + llDetectedName(0));
-		llSetTimerEvent(RUN_LENGTH);
-	}
-
-	timer()
-	{
-		llParcelMediaCommandList( [ PARCEL_MEDIA_COMMAND_STOP ] );
-		llSetTimerEvent(0.0);
-	}
-}
-

- - -


A.174. llParcelMediaQuery

list llParcelMediaQuery(list query_list);

Controls the playback of movies and other multimedia resources on a land parcel. - command can be one of - PARCEL_MEDIA_COMMAND_TEXTURE or - PARCEL_MEDIA_COMMAND_URL. -

This allows you to query the texture or url for media on the parcel. - See llParcelMediaCommandList for an example - of usage.


A.175. llParseString2List

list llParseString2List(string src, list separators, list spacers);

Breaks src into a list, discarding - anything in separators, keeping any entry - in spacers. The - separators and - spacers must be lists of strings with a - maximum of 8 entries each. So, if you had made the call: -


llParseString2List("Parsethisnow!  I dare:you to.", ["this", "!", " "], [":"]);
-

- You would get the list: -


["Parse", "now", "I", "dare", ":", "you", "to"]
-


A.176. llParseStringKeepNulls

list llParseStringKeepNulls(string src, list separators, list spacers);

Breaks src into a list, discarding - anything in separators, keeping any entry - in spacers. Any resulting null values - are kept. The separators and - spacers must be lists of strings with a - maximum of 8 entries each. So, if you had made the call: -


llParseString2List("!Parsethisthisnow I dare::you to.", ["this", "!", " "], [":"]);
-

- You would get the list: -


[NULL, "Parse", NULL, "now", "I", "dare", ":", NULL, ":", "you", "to"]
-


A.177. llParticleSystem

llParticleSystem(list parameters);

Makes a particle system based on the parameter list. The - parameters are specified as an ordered list - of parameter and value. Valid parameters and their expected values - can be found in the particle system - constants. Here is a simple example: -


llParticleSystem([PSYS_PART_FLAGS, PSYS_PART_WIND_MASK,
-                  PSYS_PART_START_COLOR, <1,0,0>,
-                  PSYS_SRC_PATTERN, PSYS_SRC_PATTERN_EXPLODE]);
-


A.178. llPassCollisions

llPassCollisions(integer pass);

If pass is TRUE, land and object collisions - are passed from children on to parents.


A.179. llPassTouches

llPassTouches(integer pass);

If pass is TRUE, touches are passed from - children on to parents.


A.180. llPlaySound

llPlaySound(string sound, float volume);

Plays a sound once. The sound will be attached to an object - and follow object movement. Only one sound may be attached to an - object at a time, and attaching a new sound or calling llStopSound will stop the - previously attached sound. A second call to llPlaySound with the - same sound will not restart the sound, but - the new volume will be used, which allows control over the volume - of already playing sounds. To restart the sound from the - beginning, call llStopSound - before calling llPlaySound again.


A.181. llPlaySoundSlave

llPlaySoundSlave(string sound, float volume);

Behaviour is identical to llPlaySound, unless there is a - "Sync Master" present. If a Sync Master is already - playing the Slave sound will not be played until the Master hits - its loop point and returns to the beginning. llPlaySoundSlave will - play the sound exactly once; if it is desired to have the sound - play every time the Master loops, either use llLoopSoundSlave with extra - silence padded on the end of the sound or ensure that - llPlaySoundSlave is called at least once per loop of the - Master.


A.182. llPointAt

llPointAt(vector pos);

Make avatar that owns object point at - pos.


A.183. llPow

llPow(float base, float exp);

Returns base raised to the - exp.


A.184. llPreloadSound

llPreloadSound(string sound);

Preloads sound from object inventory - on nearby viewers.


A.185. llPushObject

llPushObject(key id, vector impulse, vector angular_impulse, integer local);

Applies impulse and - angular_impulse to object - id.


A.186. llReleaseControls

llReleaseControls(key avatar);

Stop taking inputs from avatar.


A.187. llRemoteDataReply

llRemoteDataReply(key channel, key message_id, string sdata);

Send an XML-RPC reply to message_id on channel with payload of string sdata.


A.188. llRemoteDataSetRegion

llRemoteDataSetRegion(void);

If an object using remote data channels changes regions, you - must call this function to reregister the remote data - channels. You do not need to make this call if your object does - not change regions or use remote data channels.


A.189. llRemoteLoadScript

llRemoteLoadScript(void);

Deprecated. Please use llRemoteLoadScriptPin instead.


A.190. llRemoteLoadScriptPin

llRemoteLoadScriptPin(key target, string name, integer pin, integer running, integer param);

If the owner of the object this script is attached can modify target, it has the correct pin and the objects are in the same region, copy script name onto target, if running == TRUE, start the script with param. If name already exists on target, it is replaced.


A.191. llRemoveInventory

llRemoveInventory(string inventory);

Remove the name inventory item from - the object inventory.


A.192. llRemoveVehicleFlags

llRemoveVehicleFlags(integer flags);

Sets the vehicle flags to - FALSE. Valid parameters can be found in the vehicle flags constants - section.


A.193. llRequestAgentData

key llRequestAgentData(key id, integer data);

This function requests data about agent - id. If and when the information is - collected, the dataserver - event is called with the returned key returned from this function - passed in the requested parameter. See the - agent data constants for - details about valid values of data and what - each will return in the dataserver event.


A.194. llRequestInventoryData

key llRequestInventoryData(string name);

Requests data from object inventory item - name. When data is available the dataserver event will be raised - with the key returned from this function in the - requested parameter. The only request - currently implemented is to request data from landmarks, where the - data returned is in the form "<float, float, - float>" which can be cast to a vector. This position is in - region local coordinates of the region the script call is made - (possible even resulting in negative values). So, to - convert this value into a global position, just add the result of - llGetRegionCorner.


A.195. llRequestPermissions

integer llRequestPermissions(key avatar, integer perm);

Ask avatar to allow the script to do - perm. The perm - parameter should be a permission - constant. Multiple permissions can be requested - simultaneously by or'ing the constants together. Many of the - permissions requests can only go to object owner. This call will - not stop script execution - if the specified avatar grants the - requested permissions, the run_time_permissions - event will be called.


A.196. llRequestSimulatorData

key llRequestSimulatorData(string sim_name, integer data);

This function requests data about simulator - sim_name. When the information is - collected, the dataserver - event is called with the returned key returned from this function - passed in the requested parameter. See the - simulator data constants for - details about valid values of data and what - each will return in the dataserver event.


A.197. llResetScript

llResetScript(void);

Resets this script.


A.198. llResetOtherScript

llResetOtherScript(string name);

Resets the script name.


A.199. llResetTime

llResetTime(void);

Sets the internal script timer to zero.


A.200. llRezAtRoot

llRezAtRoot(string inventory, vector pos, vector vel, rotation rot, integer param);

Creates object's inventory object at - position pos with velocity - vel and rotation - rot. The last selected root object's location - in a multi-object selection will be placed at pos. - All other objects in a selection will be created relative to the last - selected root's position, taking rot into account. - The param value - will be available to the newly created object in the on_rez event or through the llGetStartParameter - library function. The vel parameter is - ignored if the rezzed object is not physical.


A.201. llRezObject

llRezObject(string inventory, vector pos, vector vel, rotation rot, integer param);

Creates object's inventory object at - position pos with velocity - vel and rotation - rot. The param value - will be available to the newly created object in the on_rez event or through the llGetStartParameter - library function. The vel parameter is - ignored if the rezzed object is not physical.


A.202. llRot2Angle

float llRot2Angle(rotation rot);

Returns the rotation angle represented by - rot.


A.203. llRot2Axis

vector llRot2Axis(rotation rot);

Returns the rotation axis represented by - rot.


A.204. llRot2Euler

vector llRot2Euler(rotation rot);

Returns the Euler Angle representation of - rot.


A.205. llRot2Fwd

vector llRot2Fwd(rotation rot);

Returns the forward axis represented by - rot.


A.206. llRot2Left

llRot2Left(rotation rot);

Returns the left axis represented by - rot.


A.207. llRot2Up

llRot2Up(rotation rot);

Returns the up axis represented by - rot.


A.208. llRotBetween

rotation llRotBetween(vector a, vector b);

Returns the rotation needed to rotate - a to b.


A.209. llRotLookAt

llRotLookAt(rotation rot, float strength, float damping);

Cause object to rotate to rot. Good - strength values are around half the mass of - the object and good damping values are less - than 1/10th of the - strength. Asymmetrical shapes require - smaller damping. A - strength of 0.0 cancels the look at.


A.210. llRotTarget

integer llRotTarget(rotation rot, float error);

Set object rotation within error of - rotation as a rotational target and return - an integer number for the target. The number can be used in llRotTargetRemove.


A.211. llRotTargetRemove

llRotTargetRemove(integer number);

Remove rotational target - number.


A.212. llRotateTexture

llRotateTexture(float radians, integer face);

Sets the texture rotation of face to - radians. If face - ALL_SIDES, rotate the - texture of all faces.


A.213. llRound

integer llRound(float val);

returns val rounded to the nearest - integer.


A.214. llSameGroup

integer llSameGroup(key id);

Returns TRUE if the - object or agent id is in the same simulator - and has the same active group as this object. Otherwise, returns - FALSE.


A.215. llSay

llSay(integer channel, string text);

Say text on - channel. Channel 0 is the public chat - channel that all avatars see as chat text. Channels 1 to - 2,147,483,648 are private channels that are not sent to avatars - but other scripts can listen for through the llListen api.


A.216. llScaleTexture

llScaleTexture(integer scale_s, integer scale_t, integer face);

Sets the texture s and t scales of - face to scale_s and - scale_t respectively. If face is ALL_SIDES, scale the texture - to all faces.


A.217. llScriptDanger

integer llScriptDanger(vector pos);

Returns true if pos is over public land, land that doesn't allow everyone to edit and build, or land that doesn't allow outside scripts.


A.218. llSendRemoteData

key llSendRemoteData(string dest, integer idata, string sdata);

Send an XML-RPC request to dest through channel with payload - of channel (in a string), integer idata and string sdata. An - XML-RPC reply will trigger a remote_data event with type = - REMOTE_DATA_REPLY. The call returns a message_id that can be used - to identify XML-RPC replies.


A.219. llSensor

llSensor(string name, key id, integer type, float range, float arc);

Performs a single scan for name and - id with type within - range meters and arc - radians of forward vector. Specifying a blank name or NULL_KEY id will not filter results for - any particular name or id. A range of 0.0 does not perform a - scan. Range is limited to 96.0. The type parameter should be an object type constant value. If anything is found - during the scan, a sensor event is triggered. A maximum - of 16 items are passed to this event. If nothing is found during the scan, a - no sensor event is triggered instead.


A.220. llSensorRemove

llSensorRemove(void);

Removes the sensor.


A.221. llSensorRepeat

llSensorRepeat(string name, key id, integer type, float range, float arc, float rate);

Performs a single scan for name and - id with type within - range meters and arc - radians of forward vector and repeats every - rate seconds. Specifying a blank name or - NULL_KEY id will not filter - results for any particular name or id. A range of 0.0 cancels the - scan. Range is limited to 96.0. The type parameter should be an object type constant - value. If anything is found during the scan, a sensor - event is triggered. A maximum of 16 items are passed to this event. If nothing is found - during the scan, a no sensor event is triggered instead.


A.222. llSetAlpha

llSetAlpha(float alpha, integer face);

Sets the alpha value for face. If - face is ALL_SIDES, set - the alpha to all faces. The alpha value is - interpreted as an opacity percentage - 1.0 is fully opaque, and - 0.2 is mostly transparent. This api will clamp - alpha values less 0.1 to .1 and greater - than 1.0 to 1.


A.223. llSetBuoyancy

llSetBuoyancy(float buoyancy);

Set the object buoyancy. A value of 0 is none, less than 1.0 sinks, - 1.0 floats, and greater than 1.0 rises.


A.224. llSetCameraAtOffset

llSetCameraAtOffset(vector offset);

Sets the camera at offset used in this object if an avatar - sits on it.


A.225. llSetClickAction

llSetClickAction(integer action);

Sets which action is invoked when a resident clicks a prim.


A.226. llForceMouselook

llForceMouselook(integer mouselook);

Puts the camera into mouselook mode if an avatar - sits on this object.


A.227. llSetCameraEyeOffset

llSetCameraEyeOffset(vector offset);

Sets the camera eye offset used in this object if an avatar - sits on it.


A.228. llSetColor

llSetColor(vector color, integer face);

Sets the color of - face. If face is ALL_SIDES, set the alpha to - all faces.


A.229. llSetDamage

llSetDamage(float damage);

Sets the amount of damage that will be done to an object - that this object hits. This object will be destroyed on damaging - another object.


A.230. llSetForce

llSetForce(vector force, integer local);

If the object is physical, this function sets the - force. The vector is in local coordinates if - local is TRUE, global if - FALSE.


A.231. llSetForceAndTorque

llSetForceAndTorque(vector force, vector torque, integer local);

If the object is physical, this function sets the - force and - torque. The vectors are in local coordinates - if local is TRUE, global if - FALSE.


A.232. llSetHoverHeight

llSetHoverHeight(float height, float water, float tau);

Critically damps to a height. The height is above ground and - water if water is TRUE.


A.233. llSetLinkAlpha

llSetLinkAlpha(integer linknumber, float alpha, integer face);

Sets the alpha of a prim in the link set. - The linknum - parameter is either the linked number available through llGetLinkNumber or a link constant. - If face is - ALL_SIDES, set the alpha - of all faces.


A.234. llSetLinkColor

llSetLinkColor(integer linknumber, vector color, integer face);

Sets the color of a prim in the link set. - The linknum - parameter is either the linked number available through llGetLinkNumber or a link constant. - If face is - ALL_SIDES, set the color - of all faces.


A.235. llSetLinkPrimitiveParams

llSetLinkPrimitiveParams(integer linknumber, list rules);

Sets the primitive parameters of a prim in the link set. - The linknum - parameter is either the linked number available through llGetLinkNumber or a link constant. - The rules - list is identical to that of - llSetPrimitiveParams.


A.236. llSetLinkTexture

llSetLinkTexture(integer linknumber, string texture, integer face);

Sets the texture of a prim in the link set. - The linknum - parameter is either the linked number available through llGetLinkNumber or a link constant. - If face is - ALL_SIDES, set the texture - of all faces.


A.237. llSetLocalRot

llSetLocalRot(rotation rot);

If the object is not physical, this function sets the - rotation of a child prim relative to the root prim, and the - linked set is adjusted.


A.238. llSetObjectDesc

llSetObjectDesc(string description);

Sets the object description to description.


A.239. llSetObjectName

llSetObjectName(string name);

Sets the object name to name.


A.240. llSetParcelMusicURL

llSetParcelMusicURL(string url);

Sets the streaming audio URL for the parcel where the object - is currently located. The url must be an - http streaming source of mp3 or ogg data.


A.241. llSetPayPrice

llSetPayPrice(integer default_price, list quick_pay_buttons);

Sets the default pay price and optionally the quick pay buttons - for the 'Pay' window when someone pays this object. - See also Pay Button Constants.


A.242. llSetPos

llSetPos(vector pos);

If the object is not physical, this function sets the - position in region coordinates. If the object is a child, the - position is treated as root relative and the linked set is - adjusted.


A.243. llSetPrimitiveParams

llSetPrimitiveParams(list rules);

Set primitive parameters based on rules. The - rules are specified as an ordered list - of parameter and value(s). Valid parameters and their expected values - can be found in the Primitive Constants. - Here is a simple example: -


llSetPrimitiveParams([PRIM_TYPE, PRIM_TYPE_BOX, PRIM_HOLE_DEFAULT, <0,1,0>,
-                  0.5, <-0.2, 0.2, 0>, <0.5,0.5,0>,<-0.5,0.5,0>]);
-


A.244. llSetRemoteScriptAccessPin

llSetRemoteScriptAccessPin(integer pin);

If pin is set to a non-zero number, the task will accept remote script - loads via llRemoteLoadScriptPin if it passes in the correct pin. - Otherwise, llRemoteLoadScriptPin is ignored.


A.245. llSetRot

llSetRot(rotation rot);

If the object is not physical, this function sets the - rotation. If the object is a child, the position is treated as - root relative and the linked set is adjusted.


A.246. llSetScale

llSetScale(vector scale);

Sets the object scale.


A.247. llSetScriptState

llSetScriptState(string name, integer run);

Control the state of a script on the object.


A.248. llSetSitText

llSetSitText(string text);

Displays text rather than 'sit' in - viewer pie menu.


A.249. llSetSoundQueueing

llSetSoundQueueing(integer queue);

Sets whether successive calls to llPlaySound, llLoopSound, etc., (attached - sounds) interrupt the playing sound. The default for objects is - FALSE. Setting this value to - TRUE will make the sound wait - until the current playing sound reaches its end. The queue is one - level deep.


A.250. llSetStatus

llSetStatus(integer status, integer value);

Sets the status to - value. Use status constants for the values of - status.


A.251. llSetText

llSetText(string text, vector color, float alpha);

Sets text that floats above object to - text, using the specified - color and - alpha.


A.252. llSetTexture

llSetTexture(string texture, integer face);

Sets the texture from object - inventory of face. If face is ALL_SIDES, set the texture to - all faces.


A.253. llSetTextureAnim

llSetTextureAnim(integer mode, integer face, integer sizex, integer sizey, float start, float length, float rate);

Animates a texture by setting the texture scale and - offset. The mode is a mask of texture animation - constants. You can only have one texture animation on an - object, calling llSetTextureAnim more than once on an object will - reset it.

You can only do one traditional animation, ROTATE or SCALE at a time, you - cannot combine masks. In the case of ROTATE or SCALE, - sizex and sizey are - ignored, and start and - length are used as the start and length - values of the animation. For rotation, - start and length are - in radians.

The face specified which face to - animate. If face is ALL_SIDES, all textures on the - object are animated.

The sizex and - sizey describe the layout of the frames - within the texture. sizex specifies how - many horizontal frames and sizey is how - many vertical frames.

start is the frame number to begin - the animation on. Frames are numbered from left to right, top to - bottom, starting at 0.

length is the number of frames to - animate. 0 means to animate all frames after the start - frame.

rate is the frame rate to animate - at. 1.0 means 1 frame per second, 10.0 means 10 - frames per second, etc.


A.254. llSetTimerEvent

llSetTimerEvent(float sec);

Sets the timer event to - be triggered every sec seconds. Passing in - 0.0 stops further timer - events.


A.255. llSetTorque

llSetTorque(vector torque, integer local);

If the object is physical, this function sets the - torque. The vector is in local coordinates - if local is TRUE, global if - FALSE.


A.256. llSetTouchText

llSetTouchText(string text);

Displays text in viewer pie menu that - acts as a touch.


A.257. llSetVehicleFlags

llSetVehicleFlags(integer flags);

Sets the vehicle flags to TRUE. Valid - parameters can be found in the vehicle flags constants - section.


A.258. llSetVehicleFloatParam

llSetVehicleFloatParam(integer param_name, float param_value);

Sets the vehicle floating point parameter - param_name to - param_value. Valid parameters and their - expected values can be found in the vehicle parameter - constants section.


A.259. llSetVehicleType

llSetVehicleType(integer type);

Activates the vehicle action and choose vehicle - type. Valid types and an explanation of - their characteristics can be found in the vehicle type constants - section.


A.260. llSetVehicleRotationParam

llSetVehicleRotationParam(integer param_name, rotation param_value);

Sets the vehicle rotation parameter - param_name to - param_value. Valid parameters can be found - in the vehicle parameter - constants section.


A.261. llSetVehicleVectorParam

llSetVehicleVectorParam(integer param_name, vector param_value);

Sets the vehicle vector parameter - param_name to - param_value. Valid parameters can be found - in the vehicle parameter - constants section.


A.262. llShout

llShout(integer channel, string text);

Shout text on - channel. Channel 0 is the public chat - channel that all avatars see as chat text. Channels 1 to - 2,147,483,648 are private channels that are not sent to avatars - but other scripts can listen for through the llListen api.


A.263. llSin

float llSin(float theta);

Returns the sine of theta in - radians.


A.264. llSitTarget

llSitTarget(vector offset, rotation rot);

Set the sit location for this object. If - offset == ZERO_VECTOR - clear the sit target.


A.265. llSleep

llSleep(float sec);

Puts the script to sleep for sec - seconds.


A.266. llSqrt

float llSqrt(float val);

Returns the square root of val. If - val is less than 0.0, this function returns - 0.0 and raises a math runtime error.


A.267. llStartAnimation

llStartAnimation(string anim);

This function starts animation anim - for the avatar that owns the object.

Valid strings for anim

hold_R_bazooka, hold_R_handgun, hold_R_rifle

Holds the appropriately shaped weapon in the - right hand. Automatically switches to the aims (below) when - user enters mouse look

aim_R_bazooka, aim_R_handgun, aim_R_rifle

Aims the appropriately shaped weapon along the - direction the avatar is looking.

away

Flops over in "away from keyboard" - state.

backflip

Performs a backflip.

bow

Bows at waist.

brush

Brushes dirt from shirt.

clap

Applauds.

courtbow

Bows with a courtly flourish.

crouch

Crouches in place.

crouchwalk

Walks in place while crouching.

dance1, dance2, dance3, dance4, dance5, dance6, dance7, dance8

Various dance maneuvers.

falldown

Freefall falling animation.

female_walk

Walks with hip sway.

fly

Flies forward.

flyslow

Flies forward at a less aggressive - angle.

hello

Waves.

hold_throw_R

Hold object in right hand, prepared to throw - it.

hover

Hovers in place.

hover_down

Pretends to hover straight - down.

hover_up

Pretends to hover straight - up.

jump

Midair jump position.

kick_roundhouse_R

Roundhouse kick with right - leg.

land

Lands after flying.

prejump

Prepares to jump.

punch_L

Punch with left hand.

punch_R

Punch with right hand.

punch_onetwo

Punch with one hand then the - other.

run

Runs in place.

salute

Salutes with right hand.

sit

Sits on object at knee - height.

sit_ground

Sits down on ground.

slowwalk

Walks in place slowly.

smoke_idle

Leans on imaginary prop while holding - cigarette.

smoke_inhale

Leans on imaginary prop and smokes a - cigarette.

smoke_throw_down

Leans on imaginary prop, throws down a - cigarette, and stamps it out.

snapshot

Pantomimes taking a picture.

soft_land

Stumbles a bit as if - landing.

stand

Stands in place.

standup

Falls on face and stands up.

stride

Legs extended as if stepping off of a - ledge.

sword_strike_R

Strike with sword in right - hand.

talk

Head moves as if talking.

throw_R

Throws object in right hand.

tryon_shirt

Turns around and models a new - shirt.

turnleft

Pretends to turn left.

turnright

Pretends to turn right.

type

Makes typing motion.

uphillwalk

Walks uphill in place.

walk

Walks in place.

whisper

Whispers behind hand.

whistle

Whistles with hands in - mouth.

yell

Shouts between cupped hands.


A.268. llStopAnimation

llStopAnimation(string anim);

Stop animation anim for avatar that - owns object.


A.269. llStopHover

llStopHover(void);

Stop hover to a height.


A.270. llStopLookAt

llStopLookAt(void);

Stop causing object to look at target.


A.271. llStopMoveToTarget

llStopMoveToTarget(void);

Stops critically damped motion.


A.272. llStopPointAt

llStopPointAt(void);

Stop avatar that owns object pointing.


A.273. llStopSound

llStopSound(void);

Stops a currently playing attached sound started with llPlaySound or llLoopSound. Has no effect on - sounds started with llTriggerSound.


A.274. llStringLength

integer llStringLength(string src);

Returns the number of characters in - src.


A.275. llSubStringIndex

integer llSubStringIndex(string source, string pattern);

Finds index in source where pattern first appears. Returns - -1 if no match is found.


A.276. llStringToBase64

string llStringToBase64(string str);

Converts a string to the Base 64 representation of the string.


A.277. llTakeControls

llTakeControls(integer controls, integer accept, integer pass_on);

If (accept == - (controls & input)), send input to - object. If the boolean pass_on is TRUE, also send input to - avatar.


A.278. llTan

float llTan(float theta);

Returns the tangent of theta - radians.


A.279. llTarget

integer llTarget(vector position, float range);

Set object position within range of - position as a target and returns an integer - ID for the target.


A.280. llTargetOmega

llTargetOmega(vector axis, float spinrate, float gain);

Attempt to spin at spinrate with - strength gain on - axis. A spinrate of - 0.0 cancels the spin. This function works in object local - coordinates for child objects and works in world coordinates for - root objects.


A.281. llTargetRemove

llTargetRemove(integer tnumber);

Remove target number tnumber.


A.282. llTeleportAgentHome

llTeleportAgentHome(key id);

Teleport agent on the owner's land to agent's home - location.


A.283. llToLower

llToLower();


A.284. llToUpper

string llToUpper(string src);

Returns src in all lower case.


A.285. llTriggerSound

llTriggerSound(string sound, float volume);

Plays a transient sound NOT attached to an object. The sound - plays from a stationary position located at the center of the - object at the time of the trigger. There is no limit to the number - of triggered sounds which can be generated by an object, and - calling llTriggerSound - does not affect the attached sounds created by llPlaySound and llLoopSound. This is very useful - for things like collision noises, explosions, etc. There is no - way to stop or alter the volume of a sound triggered by - this function.


A.286. llTriggerSoundLimited

llTriggerSoundLimited(string sound, float volume, vector tne, vector bsw);

Plays a transient sound NOT attached to an object with its - audible range limited by the axis aligned bounding box define by - tne (top-north-eash) and - bsw (bottom-south-west). The sound plays - from a stationary position located at the center of the object at - the time of the trigger. There is no limit to the number of - triggered sounds which can be generated by an object, and calling - llTriggerSound does not - affect the attached sounds created by llPlaySound and llLoopSound. This is very useful - for things like collision noises, explosions, etc. There is no way - to stop or alter the volume of a sound triggered by this - function.


A.287. llUnescapeURL

string llUnescapeURL(string url);

Returns the string that is the URL unescaped version of url, - replacing %20 with spaces etc.


A.288. llUnSit

llUnSit(key id);

If agent identified by id is sitting - on the object the script is attached to or is over land owned by - the objects owner, the agent is forced to stand up.


A.289. llVecDist

float llVecDist(vector a, vector b);

Returns the distance from a to - b


A.290. llVecMag

float llVecMag(vector vec);

Returns the magnitude of vec.


A.291. llVecNorm

vector llVecNorm(vector vec);

Returns normalized vec.


A.292. llVolumeDetect

llVolumeDetect(integer detect);

When detect = TRUE, this makes the entire link set the script is attached to phantom but if another object interpenetrates it, it will get a collision_start event. When an object stops interpenetrating, a collision_end event is generated. While the other is interpenetrating, collision events are NOT generated. The script must be applied to the root object of the link set to get the collision events. Collision filters work normally.


A.293. llWater

float llWater(vector offset);

Returns the water height at the object position + - offset.


A.294. llWhisper

llWhisper(integer channel, string text);

Whisper text on - channel. Channel 0 is the public chat - channel that all avatars see as chat text. Channels 1 to - 2,147,483,648 are private channels that are not sent to avatars - but other scripts can listen for through the llListen api.


A.295. llWind

vector llWind(vector offset);

Returns the wind velocity below the object position + - offset.


A.296. llXorBase64Strings

string llXorBase64Strings(string s1, string s2);

Performs an exclusive or on two Base 64 strings and returns - a Base 64 string. The s2 parameter repeats if - it is shorter than s1.


Appendix B. Events

Every state must have at least one handler. You can choose to - handle an event by defining one of the reserved event - handlers named here.


B.1. at_rot_target

at_rot_target(integer number, rotation target_rotation, rotation our_rotation);

This event is triggered when a script comes within a defined - angle of a target rotation. The range is set by a call to llRotTarget.


B.2. at_target

not_at_target(integer number, vector target_position, vector our_position);

This event is triggered when a script comes within a defined - range from a target position. The range and position are set by a - call to llTarget.


B.3. attach

attach(key attached);

This event is triggered whenever a object with this script - is attached or detached from an avatar. If it is attached, - attached is the key of the avatar it is attached to, otherwise - attached is NULL_KEY.


B.4. changed

changed(integer changed);

Triggered when various events change the object. The - changed will be a bitfield of change constants.


B.5. collision

collision(integer total_number);

This event is raised while another object is colliding with - the object the script is attached to. The number of detected - objects is passed to the script. Information on those objects may - be gathered via the llDetected* library - functions. (Collisions are also generated if a user walks into an - object.)


B.6. collision_end

collision_end(integer total_number);

This event is raised when another object stops colliding - with the object the script is attached to. The number of detected - objects is passed to the script. Information on those objects may - be gathered via the llDetected* library - functions. (Collisions are also generated if a user walks into an - object.)


B.7. collision_start

collision_start(integer total_number);

This event is raised when another object begins to collide - with the object the script is attached to. The number of detected - objects is passed to the script. Information on those objects may - be gathered via the llDetected* library - functions. (Collisions are also generated if a user walks into an - object.)


B.8. control

control(key name, integer levels, integer edges);

Once a script has the ability to grab control inputs from - the avatar, this event will be used to pass the commands into the - script. The levels and - edges are bitfields of control constants.


B.9. dataserver

dataserver(key requested, string data);

This event is triggered when the requested data is returned - to the script. Data may be requested by the llRequestAgentData, the llRequestSimulatorData, the - llRequestInventoryData, - and the llGetNotecardLine function - calls.


B.10. email

email(string time, string address, string subject, string body, integer remaining);

This event is triggered when an email sent to this script - arrives. The remaining tells how many more - emails are known as still pending.


B.11. land_collision

land_collision(vector position);

This event is raised when the object the script is attached - to is colliding with the ground.


B.12. land_collision_end

land_collision_end(vector position);

This event is raised when the object the script is attached - to stops colliding with the ground.


B.13. land_collision_start

land_collision_start(vector position);

This event is raised when the object the script is attached - to begins to collide with the ground.


B.14. link_message

link_message(integer sender_number, integer number, string message, key id);

Triggered when object receives a link message via llMessageLinked library - function call.


B.15. listen

listen(integer channel, string name, key id, string message);

This event is raised whenever a chat message matching the - constraints passed in the llListen - command is heard. The name and - id of the speaker as well as the - message are passed in as parameters. - Channel 0 is the public chat channel that all avatars see as chat - text. Channels 1 through 2,147,483,648 are private channels that - are not sent to avatars but other scripts can listen on those - channels.


B.16. money

money(key giver, integer amount);

This event is triggered when user - giver has given an - amount of Linden dollars to the - object.


B.17. moving_end

moving_end(void);

Triggered whenever a object with this script stops - moving.


B.18. moving_start

moving_start(void);

Triggered whenever a object with this script starts - moving.


B.19. no_sensor

no_sensor(void);

This event is raised when sensors are active (via the llSensor library call) but are not - sensing anything.


B.20. not_at_rot_target

not_at_rot_target(void);

When a target is set via the llRotTarget library call, but the - script is outside the specified angle this event is raised.


B.21. not_at_target

not_at_target(void);

When a target is set via the llTarget library call, but the - script is outside the specified range this event is raised.


B.22. object_rez

object_rez(key id);

Triggered when object rezzes another object from its - inventory via the llRezObject api. The - id is the globally unique key for the - object.


B.23. on_rez

on_rez(integer start_param);

Triggered whenever a object is rezzed from inventory or by - another object. The start_param is the - parameter passed in from the call to llRezObject or llRezAtRoot.


B.24. run_time_permissions

run_time_permissions(integer permissions);

Scripts need permission from either the owner or the avatar - they wish to act on before they perform certain functions, such as - debiting money from their owner's account, triggering an animation - on an avatar, or capturing control inputs. The llRequestPermissions - library function is used to request these permissions and the - various permissions integer - constants can be supplied. The integer returned to this - event handler contains the current set of permissions flags, so if - permissions equal 0 then no permissions are - set.


B.25. sensor

sensor(integer total_number);

This event is raised whenever objects matching the - constraints of the llSensor - command are detected. The number of detected objects is passed to - the script in the total_number - parameter. A maximum of 16 objects are passed to this event. - Information on those objects may be gathered via the - llDetected* library - functions.


B.26. state_entry

state_entry(void);

The state_entry event occurs whenever a new state is - entered, including program start, and is always the first event - handled.


B.27. state_exit

state_exit(void);

The state_exit event occurs whenever the state command is - used to transition to another state. It is handled before the new - state's state_entry event.


B.28. timer

timer(void);

This event is raised at regular intervals set by the llSetTimerEvent library - function.


B.29. touch

touch(integer total_number);

This event is raised while a user is touching the object the - script is attached to. The number of touching objects is passed to - the script in the total_number - parameter. Information on those objects may be gathered via the - llDetected* library - functions.


B.30. touch_end

touch_end(integer total_number);

This event is raised when a user stops touching the object - the script is attached to. The number of touching objects is - passed to the script in the total_number - parameter. Information on those objects may be gathered via the - llDetected* library - functions.


B.31. touch_start

touch_start(integer total_number);

This event is raised when a user first touches the object - the script is attached to. The number of touching objects is - passed to the script in the total_number - parameter. Information on those objects may be gathered via the - llDetected* library - functions.


B.32. remote_data

remote_data(integer type, key channel, key message_id, string sender, integer ival, string sval);

This event is raised when a user creates an XML-RPC - channel via llOpenRemoteDataChannel, - a remote XML-RPC server replies to a llSendRemoteData, - or a remote XML-RPC client sends in an XML-RPC request. In the open case, - type = REMOTE_DATA_CHANNEL, channel = NULL_KEY, - message_id = NULL_KEY, sender is an empty string, - ival = 0, and sval is an empty string. In the reply case, - type = REMOTE_DATA_REPLY, channel is set to the channel that the request was sent on, - message_id is set to the id of the message, sender is an empty string, - ival = 0, and sval is a string. In the remote request case, - type = REMOTE_DATA_REQUEST, channel is set to the channel that sent the message, - message_id is set to the id of the message, sender is set by the sender, - ival is an integer, and sval is a string. - parameter.


Appendix C. Constants

To ease scripting, many useful constants are defined by - LSL.


C.1. Boolean Constants

The boolean constants represent the values for TRUE and - FALSE. LSL represents booleans as integer values 1 and 0 - respectively. Since there is no boolean type these constants act - as a scripting aid usually employed for testing variables which - conceptually represent boolean values.

  • TRUE

  • FALSE


C.2. Status Constants

The status constants are used in the llSetStatus and llGetStatus library calls. These - constants can be bitwise or'ed together when calling the library - functions to set the same value to more than one status - flag

Status Constants

STATUS_PHYSICS

Controls whether the object moves - physically. This controls the same flag that the ui checkbox - for 'Physical' controls. The default is FALSE.

STATUS_PHANTOM

Controls whether the object collides or - not. Setting the value to TRUE makes the object non-colliding - with all objects. It is a good idea to use this for most - objects that move or rotate, but are non-physical. It is also - useful for simulating volumetric lighting. The default is - FALSE.

STATUS_ROTATE_X, STATUS_ROTATE_Y, STATUS_ROTATE_Z

Controls whether the object can physically rotate - around the specific axis or not. This flag has no meaning - for non-physical objects. Set the value to FALSE - to disable rotation around that axis. The default is TRUE - for a physical object.

A useful example to think about when visualizing the - effect is a 'sit-and-spin' device. They spin around the Z - axis (up) but not around the X or Y axis.

STATUS_BLOCK_GRAB

Controls whether the object can be grabbed. A - grab is the default action when in third person, and is - available as the 'hand' tool in build mode. This is useful for - physical objects that you don't want other people to be able - to trivially disturb. The default if FALSE

STATUS_SANDBOX

Controls whether the object can cross region - boundaries and move more than 20 meters from its creation - point. The default if FALSE.

STATUS_DIE_AT_EDGE

Controls whether the object is returned to the - owner's inventory if it wanders off the edge of the world. It - is useful to set this status TRUE for things like bullets or - rockets. The default is TRUE


C.3. Object Type Constants

These constants can be combined using the binary '|' - operator and are used in the llSensor and related calls.

Object Type Constants

AGENT

Objects in world that are agents.

ACTIVE

Objects in world that are running a script or - currently physically moving.

PASSIVE

Static in-world objects.

SCRIPTED

Scripted in-world objects.


C.4. Permission Constants

The permission constants are used for passing values to - llRequestPermissions, - determining the value of llGetPermissions, and - explicitly passed to the run_time_permissions - event. For many of the basic library functions to work, a - specific permission must be enabled. The permission constants can - be or'ed together to be used in conjunction.

Permission Constants

PERMISSION_DEBIT

If this permission is enabled, the object can - successfully call llGiveMoney to debit the - owner's account.

PERMISSION_TAKE_CONTROLS

If this permission enabled, the object can - successfully call the llTakeControls library - call.

PERMISSION_REMAP_CONTROLS

(not yet implemented)

PERMISSION_TRIGGER_ANIMATION

If this permission is enabled, the object can - successfully call llStartAnimation for the - avatar that owns this object.

PERMISSION_ATTACH

If this permission is enabled, the object can - successfully call llAttachToAvatar to attach - to the given avatar.

PERMISSION_RELEASE_OWNERSHIP

(not yet implemented)

PERMISSION_CHANGE_LINKS

If this permission is enabled, the object can - successfully call llCreateLink, llBreakLink, and llBreakAllLinks to change - links to other objects.

PERMISSION_CHANGE_JOINTS

(not yet implemented)

PERMISSION_CHANGE_PERMISSIONS

(not yet implemented)


C.5. Inventory Constants

These constants can be used to refer to a specific inventory - type in calls to llGetInventoryNumber and - llGetInventoryName. They - are also returned by llGetInventoryType. -

Inventory Constants

INVENTORY_TEXTURE, INVENTORY_SOUND, INVENTORY_OBJECT, INVENTORY_SCRIPT, INVENTORY_LANDMARK, INVENTORY_CLOTHING, INVENTORY_NOTECARD, INVENTORY_BODYPART, INVENTORY_ANIMATION, INVENTORY_GESTURE, INVENTORY_ALL, INVENTORY_NONE

Each constant refers to the named type of - inventory.


C.6. Pay Price Constants

These constants can be used in llSetPayPrice

Pay Price Constants

PAY_HIDE

Do not show this quick pay button.

PAY_DEFAULT

Use the default value for this quick pay button.


C.7. Attachment Constants

These constants are used to refer to attachment points in - calls to llAttachToAvatar.

Attachment Constants

ATTACH_CHEST

Attach to the avatar chest.

ATTACH_HEAD

Attach to the avatar head.

ATTACH_LSHOULDER

Attach to the avatar left shoulder.

ATTACH_RSHOULDER

Attach to the avatar right shoulder.

ATTACH_LHAND

Attach to the avatar left hand.

ATTACH_RHAND

Attach to the avatar right hand.

ATTACH_LFOOT

Attach to the avatar left foot.

ATTACH_RFOOT

Attach to the avatar right foot.

ATTACH_BACK

Attach to the avatar back.

ATTACH_PELVIS

Attach to the avatar pelvis.

ATTACH_MOUTH

Attach to the avatar mouth.

ATTACH_CHIN

Attach to the avatar chin.

ATTACH_LEAR

Attach to the avatar left ear.

ATTACH_REAR

Attach to the avatar right ear.

ATTACH_LEYE

Attach to the avatar left eye.

ATTACH_REYE

Attach to the avatar right eye.

ATTACH_NOSE

Attach to the avatar nose.

ATTACH_RUARM

Attach to the avatar right upper arm.

ATTACH_RLARM

Attach to the avatar right lower arm.

ATTACH_LUARM

Attach to the avatar left upper arm.

ATTACH_LLARM

Attach to the avatar left lower arm.

ATTACH_RHIP

Attach to the avatar right hip.

ATTACH_RULEG

Attach to the avatar right upper leg.

ATTACH_RLLEG

Attach to the avatar right lower leg.

ATTACH_LHIP

Attach to the avatar left hip.

ATTACH_LULEG

Attach to the avatar lower upper leg.

ATTACH_LLLEG

Attach to the avatar lower left leg.

ATTACH_BELLY

Attach to the avatar belly.

ATTACH_RPEC

Attach to the avatar right pectoral.

ATTACH_LPEC

Attach to the avatar left pectoral.


C.8. Land Constants

These constants are only used in calls to llModifyLand. The constants - are equivalent to the similarly labelled user interface elements - for editing land in the viewer.

Land Constants

LAND_LEVEL

Action to make the land flat and level.

LAND_RAISE

Action to raise the land.

LAND_LOWER

Action to lower the land.

LAND_SMOOTH

Action to smooth the land.

LAND_NOISE

Action to push the land toward a pseudo-random - heightfield.

LAND_REVERT

Action to push the land toward the original - shape from when it was first terraformed.

LAND_SMALL_BRUSH

Use a small brush size.

LAND_MEDIUM_BRUSH

Use a medium brush size.

LAND_LARGE_BRUSH

Use a large brush size.


C.9. Link Constants

These constants are used in calls to llSetLinkColor and llMessageLinked.

Link Constants

LINK_SET

This targets every object in the linked - set.

LINK_ROOT

This targets the root of the linked - set.

LINK_ALL_OTHERS

This targets every object in the linked set - except the object with the script.

LINK_ALL_CHILDREN

This targets every object except the root in - the linked set.

LINK_THIS

This targets the object making the call only. -


C.10. Control Constants

These constants are used in llTakeControls as well as the - control event handler.

Control Constants

CONTROL_FWD

Test for the avatar move forward - control.

CONTROL_BACK

Test for the avatar move back - control.

CONTROL_LEFT

Test for the avatar move left - control.

CONTROL_RIGHT

Test for the avatar move right - control.

CONTROL_ROT_LEFT

Test for the avatar rotate left - control.

CONTROL_ROT_RIGHT

Test for the avatar rotate right - control.

CONTROL_UP

Test for the avatar move up - control.

CONTROL_DOWN

Test for the avatar move down - control.

CONTROL_LBUTTON

Test for the avatar left button - control.

CONTROL_ML_BUTTON

Test for the avatar left button control while - in mouse look.


C.11. Change Constants

These constants are used in the changed event handler.

Change Constants

CHANGED_INVENTORY

The object inventory has changed.

CHANGED_ALLOWED_DROP

The object inventory has changed because an item - was added through the llAllowInventoryDrop - interface.

CHANGED_COLOR

The object color has changed.

CHANGED_SHAPE

The object shape has changed, eg, a box to a - cylinder

CHANGED_SCALE

The object scale has changed.

CHANGED_TEXTURE

The texture offset, scale rotation, or simply - the object texture has changed.

CHANGED_LINK

The object has linked or its links were - broken.

CHANGED_REGION

The object has changed regions.

CHANGED_TELEPORT

The object has been teleported.


C.12. Type Constants

These constants are used to determine the variable type - stored in a heterogeneous list. The value returned from llGetListEntryType can be - used for comparison against these constants.

Type Constants

TYPE_INTEGER

The list entry is an integer.

TYPE_FLOAT

The list entry is a float.

TYPE_STRING

The list entry is a string.

TYPE_KEY

The list entry is a key.

TYPE_VECTOR

The list entry is a vector.

TYPE_ROTATION

The list entry is a rotation.

TYPE_INVALID

The list entry is invalid.


C.13. Agent Info Constants

Each of these constants represents a bit in the integer - returned from the llGetAgentInfo function and can - be used in an expression to determine the specified information - about an agent.

Agent Info Constants

AGENT_FLYING

The agent is flying.

AGENT_ATTACHMENTS

The agent has attachments.

AGENT_SCRIPTED

The agent has scripted attachments.

AGENT_SITTING

The agent is sitting.

AGENT_ON_OBJECT

The agent is sitting on an object.

AGENT_WALKING

The agent is walking.

AGENT_IN_AIR

The agent is in the air.

AGENT_MOUSELOOK

The agent is in mouselook.

AGENT_AWAY

The agent is away (AFK).

AGENT_TYPING

The agent is typing.

AGENT_CROUCHING

The agent is crouching.


C.14. Texture Animation - Constants

These constants are used in the llSetTextureAnim api to - control the animation mode.

Texture Animation Constants

ANIM_ON

Texture animation is on.

LOOP

Loop the texture animation.

REVERSE

Play animation in reverse direction.

PING_PONG

play animation going forwards, then - backwards.

SMOOTH

slide in the X direction, instead of playing - separate frames.

ROTATE

Animate texture rotation.

SCALE

Animate the texture scale.


C.15. Particle System Constants

These constants are used in calls to the llParticleSystem api to - specify parameters.

Particle System Parameters

PSYS_PART_FLAGS

Each particle that is emitted by the particle system - is simulated based on the following flags. To use multiple - flags, bitwise or (|) them together.

PSYS_PART_FLAGS Values

PSYS_PART_INTERP_COLOR_MASK

Interpolate both the color and alpha - from the start value to the end - value.

PSYS_PART_INTERP_SCALE_MASK

Interpolate the particle scale from - the start value to the end value.

PSYS_PART_WIND_MASK

Particles have their velocity damped - towards the wind velocity.

PSYS_PART_BOUNCE_MASK

Particles bounce off of a plane at the - object's Z height.

PSYS_PART_FOLLOW_SRC_MASK

The particle position is relative to - the source object's position.

PSYS_PART_FOLLOW_VELOCITY_MASK

The particle orientation is rotated so - the vertical axis faces towards the particle - velocity.

PSYS_PART_TARGET_POS_MASK

The particle heads towards the - location of the target object as defined by - PSYS_SRC_TARGET_KEY.

PSYS_PART_EMISSIVE_MASK

The particle glows.

PSYS_PART_RANDOM_ACCEL_MASK

(not implemented)

PSYS_PART_RANDOM_VEL_MASK

(not implemented)

PSYS_PART_TRAIL_MASK

(not implemented)

PSYS_SRC_PATTERN

The pattern which is used to generate particles. Use - one of the following values:

PSYS_SRC_PATTERN Values

PSYS_SRC_PATTERN_DROP

Drop particles at the source - position.

PSYS_SRC_PATTERN_EXPLODE

Shoot particles out in all directions, - using the burst parameters.

PSYS_SRC_PATTERN_ANGLE

Shoot particles across a 2 dimensional - area defined by the arc created from - PSYS_SRC_OUTERANGLE. There will be an open area - defined by PSYS_SRC_INNERANGLE within the larger - arc.

PSYS_SRC_PATTERN_ANGLE_CONE

Shoot particles out in a 3 dimensional - cone with an outer arc of PSYS_SRC_OUTERANGLE and an - inner open area defined by - PSYS_SRC_INNERANGLE.

PSYS_PART_START_COLOR

a vector <r,g,b> which determines the starting - color of the object.

PSYS_PART_START_ALPHA

a float which determines the starting alpha of - the object.

PSYS_PART_END_COLOR

a vector <r, g, b> which determines the ending - color of the object.

PSYS_PART_END_ALPHA

a float which determines the ending alpha of - the object.

PSYS_PART_START_SCALE

a vector <sx, sy, z>, which is the starting - size of the particle billboard in meters (z is - ignored).

PSYS_PART_END_SCALE

a vector <sx, sy, z>, which is the ending size - of the particle billboard in meters (z is - ignored).

PSYS_PART_MAX_AGE

age in seconds of a particle at which it - dies.

PSYS_SRC_ACCEL

a vector <x, y, z> which is the acceleration - to apply on particles.

PSYS_SRC_TEXTURE

an asset name for the texture to use for the - particles.

PSYS_SRC_BURST_RATE

how often to release a particle burst (float - seconds).

PSYS_SRC_INNERANGLE

specifies the inner angle of the arc created - by the PSYS_SRC_PATTERN_ANGLE or - PSYS_SRC_PATTERN_ANGLE_CONE source pattern. The area - specified will not have particles in it..

PSYS_SRC_OUTERANGLE

specifies the outer angle of the arc created - by the PSYS_SRC_PATTERN_ANGLE or - PSYS_SRC_PATTERN_ANGLE_CONE source pattern. The area - between the outer and inner angle will be filled with - particles..

PSYS_SRC_BURST_PART_COUNT

how many particles to release in a - burst.

PSYS_SRC_BURST_RADIUS

what distance from the center of the object to - create the particles.

PSYS_SRC_BURST_SPEED_MIN

minimum speed that a particle should be - moving.

PSYS_SRC_BURST_SPEED_MAX

maximum speed that a particle should be - moving.

PSYS_SRC_MAX_AGE

how long this particle system should last, 0.0 - means forever.

PSYS_SRC_TARGET_KEY

the key of a target object to move towards if - PSYS_PART_TARGET_POS_MASK is enabled.

PSYS_SRC_OMEGA

Sets the angular velocity to rotate the axis - that SRC_PATTERN_ANGLE and SRC_PATTERN_ANGLE_CONE - use..


C.16. Agent Data Constants

These constants are used in calls to the llRequestAgentData api to - collect information about an agent which will be provided in the - dataserver event.

Agent Data Constants

DATA_ONLINE

"1" for online "0" for - offline.

DATA_NAME

The name of the agent.

DATA_BORN

The date the agent was born returned in ISO - 8601 format of YYYY-MM-DD.

DATA_RATING

Returns the agent ratings as a comma separated - string of six integers. They are: -

  1. Positive rated behavior

  2. Negative rated behavior

  3. Positive rated appearance

  4. Negative rated appearance

  5. Positive rated building

  6. Negative rated building

-


C.17. Float Constants

LSL provides a small collection of floating point constants - for use in float arithmetic. These constants are usually employed - while performing trigonometric calculations, but are sometimes - useful for other applications such as specifying arc radians to - sensor or particle system functions.

Float Constants

PI

3.14159265 - The radians of a - hemicircle.

TWO_PI

6.28318530 - The radians of a - circle.

PI_BY_TWO

1.57079633 - The radians of a quarter - circle.

DEG_TO_RAD

0.01745329 - Number of radians per degree. - You can use this to convert degrees to radians by multiplying - the degrees by this number.

RAD_TO_DEG

57.2957795 - Number of degrees per radian. You - can use this number to convert radians to degrees by - multiplying the radians by this number.

SQRT2

1.41421356 - The square root of 2.


C.18. Key Constant

There is only one key constant which acts as an invalid - key: NULL_KEY.


C.19. Miscellaneous Integer Constants

There is one uncategorized integer constant which is used in - some of the texturing and coloring api: ALL_SIDES


C.20. Miscellaneous String - Constants

There is one uncategorized string constant - which is used in the dataserver event: - EOF


C.21. Vector Constant

There is only one vector constant which acts as a zero - vector: ZERO_VECTOR = <0,0,0>.


C.22. Rotation Constant

There is only one rotation constant which acts as a zero - rotation: ZERO_ROTATION = <0,0,0,1>.


C.23. Simulator Data Constants

These constants are used in calls to the llRequestSimulatorData api to - collect information about a simulator which will be provided in the - dataserver event.

Simulator Data Constants

DATA_SIM_POS

The global position of the simulator. Cast the - value to a vector.

DATA_SIM_STATUS

The status of the simulator. Currently, this may be one of the following: -

  • up

  • down

  • stopping

  • starting

  • crashed

-


C.24. Vehicle Parameters

Parameters

VEHICLE_LINEAR_FRICTION_TIMESCALE

A vector of timescales for exponential decay of the - vehicle's linear velocity along its preferred axes of motion (at, left, - up). Range = [0.07, inf) seconds for each element of the vector. -

VEHICLE_ANGULAR_FRICTION_TIMESCALE

A vector of timescales for exponential decay of the - vehicle's angular velocity about its preferred axes of motion (at, - left, up). Range = [0.07, inf) seconds for each element of the vector. -

VEHICLE_LINEAR_MOTOR_DIRECTION

The direction and magnitude (in preferred frame) of the - vehicle's linear motor. The vehicle will accelerate (or decelerate if - necessary) to match its velocity to its motor. Range of magnitude = - [0, 30] meters/second. -

VEHICLE_LINEAR_MOTOR_OFFSET

The offset point from the vehicle's center of mass at which - the linear motor's impulse is applied. This allows the linear motor - to also cause rotational torque. Range of magnitude = [0, 100] - meters.

VEHICLE_LINEAR_MOTOR_TIMESCALE

The timescale for exponential approach to full - linear motor velocity.

VEHICLE_LINEAR_MOTOR_DECAY_TIMESCALE

The timescale for exponential decay of the linear - motor's magnitude.

VEHICLE_ANGULAR_MOTOR_DIRECTION

The direction and magnitude (in preferred frame) - of the vehicle's angular motor.The vehicle will accelerate (or - decelerate if necessary) to match its velocity to its - motor.

VEHICLE_ANGULAR_MOTOR_TIMESCALE

The timescale for exponential approach to full - angular motor velocity.

VEHICLE_ANGULAR_MOTOR_DECAY_TIMESCALE

The timescale for exponential decay of the angular - motor's magnitude.

VEHICLE_HOVER_HEIGHT

The height (above the terrain or water, or global) - at which the vehicle will try to hover.

VEHICLE_HOVER_EFFICIENCY

A slider between minimum (0.0 = bouncy) and - maximum (1.0 = fast as possible) damped motion of the hover - behavior.

VEHICLE_HOVER_TIMESCALE

The period of bounce (or timescale of exponential - approach, depending on the hover efficiency) for the vehicle to - hover to the proper height.

VEHICLE_BUOYANCY

A slider between minimum (0.0) and maximum - anti-gravity (1.0).

VEHICLE_LINEAR_DEFLECTION_EFFICIENCY

A slider between minimum (0.0) and maximum (1.0) - deflection of linear velocity. That is, it's a simple scalar for - modulating the strength of linear deflection.

VEHICLE_LINEAR_DEFLECTION_TIMESCALE

The timescale for exponential success of linear - deflection. It is another way to specify how much time - it takes for the vehicle's linear velocity to be redirected to - it's preferred axis of motion.

VEHICLE_ANGULAR_DEFLECTION_EFFICIENCY

A slider between minimum (0.0) and maximum (1.0) - deflection of angular orientation. That is, it's a simple scalar - for modulating the strength of angular deflection such that the - vehicle's preferred axis of motion points toward it's real - velocity.

VEHICLE_ANGULAR_DEFLECTION_TIMESCALE

The timescale for exponential success of angular - deflection. It's another way to specify the strength - of the vehicle's tendency to reorient itself so that it's - preferred axis of motion agrees with it's true - velocity.

VEHICLE_VERTICAL_ATTRACTION_EFFICIENCY

A slider between minimum (0.0 = wobbly) and - maximum (1.0 = firm as possible) stability of the vehicle to keep - itself upright.

VEHICLE_VERTICAL_ATTRACTION_TIMESCALE

The period of wobble, or timescale for exponential - approach, of the vehicle to rotate such that it's preferred - "up" axis is oriented along the world's "up" - axis.

VEHICLE_BANKING_EFFICIENCY

A slider between anti (-1.0), none (0.0), and - maximum (1.0) banking strength.

VEHICLE_BANKING_MIX

A slider between static (0.0) and dynamic (1.0) - banking. "Static" means the banking scales only with the - angle of roll, whereas "dynamic" is a term that also - scales with the vehicle's linear speed.

VEHICLE_BANKING_TIMESCALE

The timescale for banking to exponentially - approach it's maximum effect. This is another way to scale the - strength of the banking effect, however it affects the term that - is proportional to the difference between what the banking - behavior is trying to do, and what the vehicle is actually - doing.

VEHICLE_REFERENCE_FRAME

A rotation of the vehicle's preferred axes of - motion and orientation (at, left, up) with respect to the - vehicle's local frame (x, y, z).


C.25. Vehicle Flags

Flags

VEHICLE_FLAG_NO_DEFLECTION_UP

This flag prevents - linear deflection - parallel to world z-axis. This is useful for preventing ground - vehicles with large linear deflection, like bumper cars, from climbing - their linear deflection into the sky.

VEHICLE_FLAG_LIMIT_ROLL_ONLY

For vehicles with - vertical attractor - that want to be able to climb/dive, for instance, airplanes that want - to use the banking - feature.

VEHICLE_FLAG_HOVER_WATER_ONLY

Ignore terrain height when - hovering.

VEHICLE_FLAG_HOVER_TERRAIN_ONLY

Ignore water height when - hovering.

VEHICLE_FLAG_HOVER_GLOBAL_HEIGHT

Hover at - global height instead of height above ground or water.

VEHICLE_FLAG_HOVER_UP_ONLY

Hover doesn't - push down. Use this flag for hovering - vehicles that should be able to jump above their - hover height. -

VEHICLE_FLAG_LIMIT_MOTOR_UP

Prevents ground vehicles from motoring into the - sky. This flag has a subtle effect when used with conjunction - with banking: the strength - of the banking will decay when the vehicle no longer experiences - collisions. The decay timescale is the same as - VEHICLE_BANKING_TIMESCALE - . This is to help prevent ground vehicles from steering - when they are in mid jump. -

VEHICLE_FLAG_MOUSELOOK_STEER

Steer the vehicle using the mouse. Use this - flag to make the angular motor try to make the vehicle - turn such that its local - x-axis points in the same direction as - the client-side camera.

VEHICLE_FLAG_MOUSELOOK_BANK

Same as above, but relies on - banking. It remaps - left-right motions of the client camera (also known as "yaw") to - rotations about the vehicle's local x-axis. -

VEHICLE_FLAG_CAMERA_DECOUPLED

Makes mouselook camera rotate independently of - the vehicle. By default the client mouselook camera will rotate - about with the vehicle, however when this flag is set the camera - direction is independent of the vehicle's rotation. -


C.26. Vehicle Types

Types

VEHICLE_TYPE_SLED

Simple vehicle that bumps along the ground, and likes to move along - it's local x-axis.


// most friction for left-right, least for up-down
-llSetVehicleVectorParam( VEHICLE_LINEAR_FRICTION_TIMESCALE, <30, 1, 1000> );
-
-// no angular friction
-llSetVehicleVectorParam( VEHICLE_ANGULAR_FRICTION_TIMESCALE, <1000, 1000, 1000> );
-
-// no linear motor
-llSetVehicleVectorParam( VEHICLE_LINEAR_MOTOR_DIRECTION, <0, 0, 0> );
-llSetVehicleFloatParam( VEHICLE_LINEAR_MOTOR_TIMESCALE, 1000 );
-llSetVehicleFloatParam( VEHICLE_LINEAR_MOTOR_DECAY_TIMESCALE, 120 );
-
-// no angular motor
-llSetVehicleVectorParam( VEHICLE_ANGULAR_MOTOR_DIRECTION, <0, 0, 0> );
-llSetVehicleFloatParam( VEHICLE_ANGULAR_MOTOR_TIMESCALE, 1000 );
-llSetVehicleFloatParam( VEHICLE_ANGULAR_MOTOR_DECAY_TIMESCALE, 120 );
-
-// no hover (but with timescale of 10 sec if enabled)
-llSetVehicleFloatParam( VEHICLE_HOVER_HEIGHT, 0 );
-llSetVehicleFloatParam( VEHICLE_HOVER_EFFICIENCY, 10 );
-llSetVehicleFloatParam( VEHICLE_HOVER_TIMESCALE, 10 );
-llSetVehicleFloatParam( VEHICLE_BUOYANCY, 0 );
-
-// maximum linear deflection with timescale of 1 second
-llSetVehicleFloatParam( VEHICLE_LINEAR_DEFLECTION_EFFICIENCY, 1 );
-llSetVehicleFloatParam( VEHICLE_LINEAR_DEFLECTION_TIMESCALE, 1 );
-
-// no angular deflection 
-llSetVehicleFloatParam( VEHICLE_ANGULAR_DEFLECTION_EFFICIENCY, 0 );
-llSetVehicleFloatParam( VEHICLE_ANGULAR_DEFLECTION_TIMESCALE, 10 );
-
-// no vertical attractor (doesn't mind flipping over)
-llSetVehicleFloatParam( VEHICLE_VERTICAL_ATTRACTION_EFFICIENCY, 1 );
-llSetVehicleFloatParam( VEHICLE_VERTICAL_ATTRACTION_TIMESCALE, 1000 );
-
-// no banking
-llSetVehicleFloatParam( VEHICLE_BANKING_EFFICIENCY, 0 );
-llSetVehicleFloatParam( VEHICLE_BANKING_MIX, 1 );
-llSetVehicleFloatParam( VEHICLE_BANKING_TIMESCALE, 10 );
-
-// default rotation of local frame
-llSetVehicleRotationParam( VEHICLE_REFERENCE_FRAME, <0, 0, 0, 1> );
-
-// remove these flags 
-llRemoveVehicleFlags( VEHICLE_FLAG_HOVER_WATER_ONLY 
-                      | VEHICLE_FLAG_HOVER_TERRAIN_ONLY 
-                      | VEHICLE_FLAG_HOVER_GLOBAL_HEIGHT 
-                      | VEHICLE_FLAG_HOVER_UP_ONLY );
-
-// set these flags (the limit_roll flag will have no effect
-// until banking is enabled, if ever)
-llSetVehicleFlags( VEHICLE_FLAG_NO_DEFLECTION_UP 
-                   | VEHICLE_FLAG_LIMIT_ROLL_ONLY
-                   | VEHICLE_FLAG_LIMIT_MOTOR_UP );
-        

VEHICLE_TYPE_CAR

Another vehicle that bounces along the ground but - needs the motors to be driven from external controls or timer events.


// most friction for left-right, least for up-down
-llSetVehicleVectorParam( VEHICLE_LINEAR_FRICTION_TIMESCALE, <100, 2, 1000> );
-        
-// no angular friction
-llSetVehicleVectorParam( VEHICLE_ANGULAR_FRICTION_TIMESCALE, <1000, 1000, 1000> );
-
-// linear motor wins after about a second, decays after about a minute
-llSetVehicleVectorParam( VEHICLE_LINEAR_MOTOR_DIRECTION, <0, 0, 0> );
-llSetVehicleFloatParam( VEHICLE_LINEAR_MOTOR_TIMESCALE, 1 );
-llSetVehicleFloatParam( VEHICLE_LINEAR_MOTOR_DECAY_TIMESCALE, 60 );
-
-// angular motor wins after a second, decays in less time than that
-llSetVehicleVectorParam( VEHICLE_ANGULAR_MOTOR_DIRECTION, <0, 0, 0> );
-llSetVehicleFloatParam( VEHICLE_ANGULAR_MOTOR_TIMESCALE, 1 );
-llSetVehicleFloatParam( VEHICLE_ANGULAR_MOTOR_DECAY_TIMESCALE, 0.8 );
-
-// no hover 
-llSetVehicleFloatParam( VEHICLE_HOVER_HEIGHT, 0 );
-llSetVehicleFloatParam( VEHICLE_HOVER_EFFICIENCY, 0 );
-llSetVehicleFloatParam( VEHICLE_HOVER_TIMESCALE, 1000 );
-llSetVehicleFloatParam( VEHICLE_BUOYANCY, 0 );
-
-// maximum linear deflection with timescale of 2 seconds
-llSetVehicleFloatParam( VEHICLE_LINEAR_DEFLECTION_EFFICIENCY, 1 );
-llSetVehicleFloatParam( VEHICLE_LINEAR_DEFLECTION_TIMESCALE, 2 );
-
-// no angular deflection 
-llSetVehicleFloatParam( VEHICLE_ANGULAR_DEFLECTION_EFFICIENCY, 0 );
-llSetVehicleFloatParam( VEHICLE_ANGULAR_DEFLECTION_TIMESCALE, 10 );
-        
-// critically damped vertical attractor
-llSetVehicleFloatParam( VEHICLE_VERTICAL_ATTRACTION_EFFICIENCY, 1 );
-llSetVehicleFloatParam( VEHICLE_VERTICAL_ATTRACTION_TIMESCALE, 10 );
-
-// weak negative critically damped banking
-llSetVehicleFloatParam( VEHICLE_BANKING_EFFICIENCY, -0.2 );
-llSetVehicleFloatParam( VEHICLE_BANKING_MIX, 1 );
-llSetVehicleFloatParam( VEHICLE_BANKING_TIMESCALE, 1 );
-
-// default rotation of local frame
-llSetVehicleRotationParam( VEHICLE_REFERENCE_FRAME, <0, 0, 0, 1> );
-
-// remove these flags 
-llRemoveVehicleFlags( VEHICLE_FLAG_HOVER_WATER_ONLY 
-                      | VEHICLE_FLAG_HOVER_TERRAIN_ONLY 
-                      | VEHICLE_FLAG_HOVER_GLOBAL_HEIGHT);
-
-// set these flags 
-llSetVehicleFlags( VEHICLE_FLAG_NO_DEFLECTION_UP 
-                   | VEHICLE_FLAG_LIMIT_ROLL_ONLY 
-                   | VEHICLE_FLAG_HOVER_UP_ONLY
-                   | VEHICLE_FLAG_LIMIT_MOTOR_UP );
-        

VEHICLE_TYPE_BOAT

Hovers over water with lots of friction and some angular deflection.


// least for forward-back, most friction for up-down
-llSetVehicleVectorParam( VEHICLE_LINEAR_FRICTION_TIMESCALE, <10, 3, 2> );
-        
-// uniform angular friction (setting it as a scalar rather than a vector)
-llSetVehicleFloatParam( VEHICLE_ANGULAR_FRICTION_TIMESCALE, 10 );
-
-// linear motor wins after about five seconds, decays after about a minute
-llSetVehicleVectorParam( VEHICLE_LINEAR_MOTOR_DIRECTION, <0, 0, 0> );
-llSetVehicleFloatParam( VEHICLE_LINEAR_MOTOR_TIMESCALE, 5 );
-llSetVehicleFloatParam( VEHICLE_LINEAR_MOTOR_DECAY_TIMESCALE, 60 );
-
-// angular motor wins after four seconds, decays in same amount of time
-llSetVehicleVectorParam( VEHICLE_ANGULAR_MOTOR_DIRECTION, <0, 0, 0> );
-llSetVehicleFloatParam( VEHICLE_ANGULAR_MOTOR_TIMESCALE, 4 );
-llSetVehicleFloatParam( VEHICLE_ANGULAR_MOTOR_DECAY_TIMESCALE, 4 );
-
-// hover 
-llSetVehicleFloatParam( VEHICLE_HOVER_HEIGHT, 0 );
-llSetVehicleFloatParam( VEHICLE_HOVER_EFFICIENCY, 0.5 );
-llSetVehicleFloatParam( VEHICLE_HOVER_TIMESCALE, 2.0 );
-llSetVehicleFloatParam( VEHICLE_BUOYANCY, 1 );
-
-// halfway linear deflection with timescale of 3 seconds
-llSetVehicleFloatParam( VEHICLE_LINEAR_DEFLECTION_EFFICIENCY, 0.5 );
-llSetVehicleFloatParam( VEHICLE_LINEAR_DEFLECTION_TIMESCALE, 3 );
-
-// angular deflection 
-llSetVehicleFloatParam( VEHICLE_ANGULAR_DEFLECTION_EFFICIENCY, 0.5 );
-llSetVehicleFloatParam( VEHICLE_ANGULAR_DEFLECTION_TIMESCALE, 5 );
-        
-// somewhat bouncy vertical attractor 
-llSetVehicleFloatParam( VEHICLE_VERTICAL_ATTRACTION_EFFICIENCY, 0.5 );
-llSetVehicleFloatParam( VEHICLE_VERTICAL_ATTRACTION_TIMESCALE, 5 );
-
-// weak negative damped banking
-llSetVehicleFloatParam( VEHICLE_BANKING_EFFICIENCY, -0.3 );
-llSetVehicleFloatParam( VEHICLE_BANKING_MIX, 0.8 );
-llSetVehicleFloatParam( VEHICLE_BANKING_TIMESCALE, 1 );
-
-// default rotation of local frame
-llSetVehicleRotationParam( VEHICLE_REFERENCE_FRAME, <0, 0, 0, 1> );
-
-// remove these flags 
-llRemoveVehicleFlags( VEHICLE_FLAG_HOVER_TERRAIN_ONLY 
-                      | VEHICLE_FLAG_LIMIT_ROLL_ONLY 
-                      | VEHICLE_FLAG_HOVER_GLOBAL_HEIGHT);
-
-// set these flags 
-llSetVehicleFlags( VEHICLE_FLAG_NO_DEFLECTION_UP 
-                   | VEHICLE_FLAG_HOVER_WATER_ONLY 
-                   | VEHICLE_FLAG_HOVER_UP_ONLY 
-                   | VEHICLE_FLAG_LIMIT_MOTOR_UP );
-        

VEHICLE_TYPE_AIRPLANE

Uses linear deflection for lift, no hover, and banking to turn.


// very little friction along forward-back axis
-llSetVehicleVectorParam( VEHICLE_LINEAR_FRICTION_TIMESCALE, <200, 10, 5> );
-        
-// uniform angular friction
-llSetVehicleFloatParam( VEHICLE_ANGULAR_FRICTION_TIMESCALE, 20 );
-
-// linear motor
-llSetVehicleVectorParam( VEHICLE_LINEAR_MOTOR_DIRECTION, <0, 0, 0> );
-llSetVehicleFloatParam( VEHICLE_LINEAR_MOTOR_TIMESCALE, 2 );
-llSetVehicleFloatParam( VEHICLE_LINEAR_MOTOR_DECAY_TIMESCALE, 60 );
-
-// angular motor
-llSetVehicleVectorParam( VEHICLE_ANGULAR_MOTOR_DIRECTION, <0, 0, 0> );
-llSetVehicleFloatParam( VEHICLE_ANGULAR_MOTOR_TIMESCALE, 4 );
-llSetVehicleFloatParam( VEHICLE_ANGULAR_MOTOR_DECAY_TIMESCALE, 8 );
-
-// no hover 
-llSetVehicleFloatParam( VEHICLE_HOVER_HEIGHT, 0 );
-llSetVehicleFloatParam( VEHICLE_HOVER_EFFICIENCY, 0.5 );
-llSetVehicleFloatParam( VEHICLE_HOVER_TIMESCALE, 1000 );
-llSetVehicleFloatParam( VEHICLE_BUOYANCY, 0 );
-
-// linear deflection 
-llSetVehicleFloatParam( VEHICLE_LINEAR_DEFLECTION_EFFICIENCY, 0.5 );
-llSetVehicleFloatParam( VEHICLE_LINEAR_DEFLECTION_TIMESCALE, 0.5 );
-
-// angular deflection 
-llSetVehicleFloatParam( VEHICLE_ANGULAR_DEFLECTION_EFFICIENCY, 1.0 );
-llSetVehicleFloatParam( VEHICLE_ANGULAR_DEFLECTION_TIMESCALE, 2.0 );
-        
-// vertical attractor
-llSetVehicleFloatParam( VEHICLE_VERTICAL_ATTRACTION_EFFICIENCY, 0.9 );
-llSetVehicleFloatParam( VEHICLE_VERTICAL_ATTRACTION_TIMESCALE, 2 );
-
-// banking
-llSetVehicleFloatParam( VEHICLE_BANKING_EFFICIENCY, 1 );
-llSetVehicleFloatParam( VEHICLE_BANKING_MIX, 0.7 );
-llSetVehicleFloatParam( VEHICLE_BANKING_TIMESCALE, 2 );
-
-// default rotation of local frame
-llSetVehicleRotationParam( VEHICLE_REFERENCE_FRAME, <0, 0, 0, 1> );
-
-// remove these flags 
-llRemoveVehicleFlags( VEHICLE_FLAG_NO_DEFLECTION_UP 
-                      | VEHICLE_FLAG_HOVER_WATER_ONLY 
-                      | VEHICLE_FLAG_HOVER_TERRAIN_ONLY 
-                      | VEHICLE_FLAG_HOVER_GLOBAL_HEIGHT 
-                      | VEHICLE_FLAG_HOVER_UP_ONLY
-                      | VEHICLE_FLAG_LIMIT_MOTOR_UP );
-
-// set these flags 
-llSetVehicleFlags( VEHICLE_FLAG_LIMIT_ROLL_ONLY );
-        

VEHICLE_TYPE_BALLOON

Hover, and friction, but no deflection.


// uniform linear friction
-llSetVehicleFloatParam( VEHICLE_LINEAR_FRICTION_TIMESCALE, 5 );
-        
-// uniform angular friction
-llSetVehicleFloatParam( VEHICLE_ANGULAR_FRICTION_TIMESCALE, 10 );
-
-// linear motor
-llSetVehicleVectorParam( VEHICLE_LINEAR_MOTOR_DIRECTION, <0, 0, 0> );
-llSetVehicleFloatParam( VEHICLE_LINEAR_MOTOR_TIMESCALE, 5 );
-llSetVehicleFloatParam( VEHICLE_LINEAR_MOTOR_DECAY_TIMESCALE, 60 );
-
-// angular motor
-llSetVehicleVectorParam( VEHICLE_ANGULAR_MOTOR_DIRECTION, <0, 0, 0> );
-llSetVehicleFloatParam( VEHICLE_ANGULAR_MOTOR_TIMESCALE, 6 );
-llSetVehicleFloatParam( VEHICLE_ANGULAR_MOTOR_DECAY_TIMESCALE, 10 );
-
-// hover 
-llSetVehicleFloatParam( VEHICLE_HOVER_HEIGHT, 5 );
-llSetVehicleFloatParam( VEHICLE_HOVER_EFFICIENCY, 0.8 );
-llSetVehicleFloatParam( VEHICLE_HOVER_TIMESCALE, 10 );
-llSetVehicleFloatParam( VEHICLE_BUOYANCY, 1 );
-
-// no linear deflection 
-llSetVehicleFloatParam( VEHICLE_LINEAR_DEFLECTION_EFFICIENCY, 0 );
-llSetVehicleFloatParam( VEHICLE_LINEAR_DEFLECTION_TIMESCALE, 5 );
-
-// no angular deflection 
-llSetVehicleFloatParam( VEHICLE_ANGULAR_DEFLECTION_EFFICIENCY, 0 );
-llSetVehicleFloatParam( VEHICLE_ANGULAR_DEFLECTION_TIMESCALE, 5 );
-        
-// no vertical attractor 
-llSetVehicleFloatParam( VEHICLE_VERTICAL_ATTRACTION_EFFICIENCY, 1 );
-llSetVehicleFloatParam( VEHICLE_VERTICAL_ATTRACTION_TIMESCALE, 1000 );
-
-// no banking
-llSetVehicleFloatParam( VEHICLE_BANKING_EFFICIENCY, 0 );
-llSetVehicleFloatParam( VEHICLE_BANKING_MIX, 0.7 );
-llSetVehicleFloatParam( VEHICLE_BANKING_TIMESCALE, 5 );
-
-// default rotation of local frame
-llSetVehicleRotationParam( VEHICLE_REFERENCE_FRAME, <0, 0, 0, 1> );
-
-// remove all flags 
-llRemoveVehicleFlags( VEHICLE_FLAG_NO_DEFLECTION_UP 
-                      | VEHICLE_FLAG_HOVER_WATER_ONLY 
-                      | VEHICLE_FLAG_LIMIT_ROLL_ONLY 
-                      | VEHICLE_FLAG_HOVER_TERRAIN_ONLY 
-                      | VEHICLE_FLAG_HOVER_GLOBAL_HEIGHT 
-                      | VEHICLE_FLAG_HOVER_UP_ONLY 
-                      | VEHICLE_FLAG_LIMIT_MOTOR_UP );
-        


C.27. Primitive Constants

These constants are used in calls to the llSetPrimitiveParams and llGetPrimitiveParams api to - specify parameters.

Primitive Parameters

PRIM_TYPE

This allows the various primitive shape parameters to be controlled. PRIM_TYPE must be followed by - appropriate arguments based on which type is selected.

PRIM_TYPE Values

PRIM_TYPE_BOX

Sets the primitive to a box, followed by integer hole shape, vector cut, float hollow, vector twist, vector top size, and vector top shear.

PRIM_TYPE_CYLINDER

Sets the primitive to a cylinder, followed by integer hole shape, vector cut, float hollow, vector twist, vector top size, and vector top shear.

PRIM_TYPE_PRISM

Sets the primitive to a prism, followed by integer hole shape, vector cut, float hollow, vector twist, vector top size, and vector top shear.

PRIM_TYPE_SPHERE

Sets the primitive to a sphere, followed by integer hole shape, vector cut, float hollow, vector twist, and vector dimple.

PRIM_TYPE_TORUS

Sets the primitive to a torus, followed by integer hole shape, vector cut, float hollow, vector twist, vector hole size, vector top shear, vector advanced cut, vector taper, float revolutions, float radius offset, and float skew.

PRIM_TYPE_TUBE

Sets the primitive to a tube, followed by integer hole shape, vector cut, float hollow, vector twist, vector hole size, vector top shear, vector advanced cut, vector taper, float revolutions, float radius offset, and float skew.

PRIM_TYPE_RING

Sets the primitive to a ring, followed by integer hole shape, vector cut, float hollow, vector twist, vector hole size, vector top shear, vector advanced cut, vector taper, float revolutions, float radius offset, and float skew.

Choose hole shape from one of PRIM_HOLE_DEFAULT, PRIM_HOLE_CIRCLE, PRIM_HOLE_SQUARE, or PRIM_HOLE_TRIANGLE.

PRIM_MATERIAL

Choose material from one of PRIM_MATERIAL_STONE, PRIM_MATERIAL_METAL, PRIM_MATERIAL_GLASS, - PRIM_MATERIAL_WOOD, PRIM_MATERIAL_FLESH, PRIM_MATERIAL_PLASTIC, PRIM_MATERIAL_RUBBER, or PRIM_MATERIAL_LIGHT.

PRIM_PHYSICS

Set physics to TRUE or FALSE.

PRIM_TEMP_ON_REZ

Set temporary on rez to TRUE or FALSE.

PRIM_PHANTOM

Set phantom to TRUE or FALSE.

PRIM_POSITION

Sets the position with a vector.

PRIM_SIZE

Sets the size with a vector.

PRIM_ROTATION

Sets the rotation with a rotation.

PRIM_TEXTURE

Followed by an integer face, key id, vector repeats, vector offsets, and float rotation in radians.

PRIM_COLOR

Followed by an integer face, vector color, and float alpha.

PRIM_BUMP_SHINY

Followed by an integer face, one of PRIM_SHINY_NONE, PRIM_SHINY_LOW, PRIM_SHINY_MEDIUM, or PRIM_SHINY_HIGH, - and one of PRIM_BUMP_NONE, PRIM_BUMP_BRIGHT, PRIM_BUMP_DARK, PRIM_BUMP_WOOD, PRIM_BUMP_BARK, - PRIM_BUMP_BRICKS, PRIM_BUMP_CHECKER, PRIM_BUMP_CONCRETE, PRIM_BUMP_TILE, PRIM_BUMP_STONE, PRIM_BUMP_DISKS, - PRIM_BUMP_GRAVEL, PRIM_BUMP_BLOBS, PRIM_BUMP_SIDING, PRIM_BUMP_LARGETILE, PRIM_BUMP_STUCCO, PRIM_BUMP_SUCTION, - or PRIM_BUMP_WEAVE.

PRIM_GLOW

Followed by an integer face and a float glow value (in range 0.0 to 1.0).


C.28. XML-RPC Constants

These constants are passed to the remote_data event: REMOTE_DATA_CHANNEL, REMOTE_DATA_REQUEST, and REMOTE_DATA_REPLY.


C.29. Permission Mask Constants

These MASK_* constants are used as arguments to llGetObjectPermMask and llGetInventoryPermMask. These functions return combinations of PERM_* constants.

Mask and Permission Constants

MASK_BASE

Specifies base permissions. These permissions are identical to owner permissions except in the case that the object is locked. When an object is locked, owner permissions are stripped of move/modify rights (thus, the 'locking'). On unlock, owner permissions revert back to base permissions.

MASK_OWNER

Specifies owner permissions. These are never more permissive than base permissions.

MASK_GROUP

Specifies group permissions. These are never more permissive than owner permissions.

MASK_EVERYONE

Specifies everyone permissions. These are never more permissive than owner permissions.

MASK_NEXT

Specifies next owner permissions. These are never more permissive than base permissions.

PERM_MOVE

Set if movement is allowed.

PERM_MODIFY

Set if modification is allowed.

PERM_COPY

Set if copying is allowed.

PERM_TRANSFER

Set if transfers are allowed.

PERM_ALL

This is returned if all other PERM_* are set.


C.30. Parcel Media Constants

These constants are passed to the llParcelMediaCommand to control playback of movies and other multimedia within a land parcel.

Parcel Media Constants

PARCEL_MEDIA_COMMAND_STOP

Stop the media stream and go back to the first frame.

PARCEL_MEDIA_COMMAND_PAUSE

Pause the media stream (stop playing but stay on current frame).

PARCEL_MEDIA_COMMAND_PLAY

Start the media stream playing from the current frame and stop when the end is reached.

PARCEL_MEDIA_COMMAND_LOOP_SET

Used to get or set the parcel's media looping variable. -

PARCEL_MEDIA_COMMAND_TEXTURE

Use this to get or set the parcel's media texture. -

PARCEL_MEDIA_COMMAND_URL

Used to get or set the parcel's media url. -

PARCEL_MEDIA_COMMAND_TYPE

Used to get or set the parcel's media mimetype. -

PARCEL_MEDIA_COMMAND_DESC

Used to get or set the parcel's media description. -

PARCEL_MEDIA_COMMAND_SIZE

Used to get or set the parcel's media pixel size. -

PARCEL_MEDIA_COMMAND_TIME

Move a media stream to a specific time. -

PARCEL_MEDIA_COMMAND_AGENT

Applies the media command to the specified agent only. -

PARCEL_MEDIA_COMMAND_UNLOAD

Completely unloads the movie and restores the original texture. -

PARCEL_MEDIA_COMMAND_AUTO_ALIGN

Sets the parcel option 'Auto scale content'. -

PARCEL_MEDIA_COMMAND_LOOP

This command has been depricated in favor of the PARCEL_MEDIA_COMMAND_LOOP_SET above. -


C.31. Click Action Constants

These constants are passed to llSetClickAction to define default behavior when a resident clicks upon a prim.

Click Action Constants

CLICK_ACTION_NONE

Disables the click action for this prim.

CLICK_ACTION_TOUCH

Sets the click-action behavior of this prim to touch.

CLICK_ACTION_SIT

Sets the click-action behavior of this prim to sit.

CLICK_ACTION_BUY

Sets the click-action behavior of this prim to buy.

CLICK_ACTION_PAY

Sets the click-action behavior of this prim to pay.

CLICK_ACTION_OPEN

Sets the click-action behavior of this prim to open.

CLICK_ACTION_PLAY

Sets the click-action behavior of this prim to play.

CLICK_ACTION_OPEN_MEDIA

Sets the click-action behavior of this prim to open-media.

CLICK_ACTION_SIT

Sets the click-action behavior of this prim to sit.

CLICK_ACTION_SIT

Sets the click-action behavior of this prim to sit.

\ No newline at end of file diff --git a/linden/indra/newview/pipeline.cpp b/linden/indra/newview/pipeline.cpp index f232fdf..81f1a90 100644 --- a/linden/indra/newview/pipeline.cpp +++ b/linden/indra/newview/pipeline.cpp @@ -330,8 +330,15 @@ void LLPipeline::init() mRenderDebugFeatureMask = 0xffffffff; // All debugging features on mRenderDebugMask = 0; // All debug starts off + // Don't turn on ground when this is set + // Mac Books with intel 950s need this + if(!gSavedSettings.getBOOL("RenderGround")) + { + toggleRenderType(RENDER_TYPE_GROUND); + } + mOldRenderDebugMask = mRenderDebugMask; - + mBackfaceCull = TRUE; stop_glerror(); @@ -454,7 +461,7 @@ void LLPipeline::resizeScreenTexture() } mScreen.release(); - mScreen.allocate(resX, resY, GL_RGBA, TRUE, GL_TEXTURE_RECTANGLE_ARB); + mScreen.allocate(resX, resY, GL_RGBA, TRUE, LLTexUnit::TT_RECT_TEXTURE); llinfos << "RESIZED SCREEN TEXTURE: " << resX << "x" << resY << llendl; } @@ -556,7 +563,7 @@ void LLPipeline::createGLBuffers() for (U32 j = 0; j < 3; j++) { - glBindTexture(GL_TEXTURE_CUBE_MAP_ARB, mBlurCubeTexture[j]); + gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_CUBE_MAP, mBlurCubeTexture[j]); glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); @@ -583,10 +590,11 @@ void LLPipeline::createGLBuffers() mGlow[i].allocate(512,glow_res,GL_RGBA,FALSE); } + GLuint resX = gViewerWindow->getWindowDisplayWidth(); GLuint resY = gViewerWindow->getWindowDisplayHeight(); - - mScreen.allocate(resX, resY, GL_RGBA, TRUE, GL_TEXTURE_RECTANGLE_ARB); + + mScreen.allocate(resX, resY, GL_RGBA, TRUE, LLTexUnit::TT_RECT_TEXTURE); } } @@ -1212,7 +1220,7 @@ void LLPipeline::updateCull(LLCamera& camera, LLCullResult& result, S32 water_cl LLVertexBuffer::unbind(); LLGLDisable blend(GL_BLEND); LLGLDisable test(GL_ALPHA_TEST); - LLViewerImage::unbindTexture(0, GL_TEXTURE_2D); + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); gGL.setColorMask(false, false); LLGLDepthTest depth(GL_TRUE, GL_FALSE); @@ -1357,7 +1365,7 @@ void LLPipeline::doOcclusion(LLCamera& camera) } LLGLDisable blend(GL_BLEND); LLGLDisable test(GL_ALPHA_TEST); - LLViewerImage::unbindTexture(0, GL_TEXTURE_2D); + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); LLGLDepthTest depth(GL_TRUE, GL_FALSE); if (LLPipeline::sUseOcclusion > 1) @@ -2368,7 +2376,7 @@ void LLPipeline::renderGeom(LLCamera& camera, BOOL forceVBOUpdate) sUnderWaterRender = FALSE; } - LLViewerImage::sDefaultImagep->bind(0); + gGL.getTexUnit(0)->bind(LLViewerImage::sDefaultImagep); LLViewerImage::sDefaultImagep->setClamp(FALSE, FALSE); ////////////////////////////////////////////// @@ -2604,11 +2612,11 @@ void LLPipeline::renderDebug() // Debug composition layers F32 x, y; - LLGLSNoTexture gls_no_texture; + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); if (gAgent.getRegion()) { - gGL.begin(LLVertexBuffer::POINTS); + gGL.begin(LLRender::POINTS); // Draw the composition layer for the region that I'm in. for (x = 0; x <= 260; x++) { @@ -2654,6 +2662,7 @@ void LLPipeline::renderForSelect(std::set& objects, BOOL render LLGLSDefault gls_default; LLGLSObjectSelect gls_object_select; + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); LLGLDepthTest gls_depth(GL_TRUE,GL_TRUE); disableLights(); @@ -2665,6 +2674,18 @@ void LLPipeline::renderForSelect(std::set& objects, BOOL render LLGLState::checkClientArrays(); U32 last_type = 0; + // If we don't do this, we crash something on changing graphics settings + // from Medium -> Low, because we unload all the shaders and the + // draw pools aren't aware. I don't know if this has to be a separate + // loop before actual rendering. JC + for (pool_set_t::iterator iter = mPools.begin(); iter != mPools.end(); ++iter) + { + LLDrawPool *poolp = *iter; + if (poolp->isFacePool() && hasRenderType(poolp->getType())) + { + poolp->prerender(); + } + } for (pool_set_t::iterator iter = mPools.begin(); iter != mPools.end(); ++iter) { LLDrawPool *poolp = *iter; @@ -3089,7 +3110,7 @@ void LLPipeline::setupAvatarLights(BOOL for_edit) camera_rot.invert(); LLVector4 light_pos = light_pos_cam * camera_rot; - light_pos.normVec(); + light_pos.normalize(); mHWLightColors[1] = diffuse; glLightfv(GL_LIGHT1, GL_DIFFUSE, diffuse.mV); @@ -3107,7 +3128,7 @@ void LLPipeline::setupAvatarLights(BOOL for_edit) LLVector3 opposite_pos = -1.f * mSunDir; LLVector3 orthog_light_pos = mSunDir % LLVector3::z_axis; LLVector4 backlight_pos = LLVector4(lerp(opposite_pos, orthog_light_pos, 0.3f), 0.0f); - backlight_pos.normVec(); + backlight_pos.normalize(); LLColor4 light_diffuse = mSunDiffuse; LLColor4 backlight_diffuse(1.f - light_diffuse.mV[VRED], 1.f - light_diffuse.mV[VGREEN], 1.f - light_diffuse.mV[VBLUE], 1.f); @@ -3446,7 +3467,7 @@ void LLPipeline::setupHWLights(LLDrawPool* pool) atten = x / (light_radius); // % of brightness at radius quad = 0.0f; } - //mHWLightColors[cur_light] = light_color; + mHWLightColors[2] = light_color; S32 gllight = GL_LIGHT2; glLightfv(gllight, GL_POSITION, light_pos_gl.mV); glLightfv(gllight, GL_DIFFUSE, light_color.mV); @@ -3987,6 +4008,7 @@ BOOL LLPipeline::getRenderHighlights(void*) } LLViewerObject* LLPipeline::lineSegmentIntersectInWorld(const LLVector3& start, const LLVector3& end, + BOOL pick_transparent, S32* face_hit, LLVector3* intersection, // return the intersection point LLVector2* tex_coord, // return the texture coordinates of the intersection point @@ -3996,6 +4018,10 @@ LLViewerObject* LLPipeline::lineSegmentIntersectInWorld(const LLVector3& start, { LLDrawable* drawable = NULL; + LLVector3 local_end = end; + + LLVector3 position; + for (LLWorld::region_list_t::iterator iter = LLWorld::getInstance()->getRegionList().begin(); iter != LLWorld::getInstance()->getRegionList().end(); ++iter) { @@ -4003,24 +4029,49 @@ LLViewerObject* LLPipeline::lineSegmentIntersectInWorld(const LLVector3& start, for (U32 j = 0; j < LLViewerRegion::NUM_PARTITIONS; j++) { - if ((j == LLViewerRegion::PARTITION_VOLUME) || (j == LLViewerRegion::PARTITION_BRIDGE)) // only check these partitions for now + if ((j == LLViewerRegion::PARTITION_VOLUME) || + (j == LLViewerRegion::PARTITION_BRIDGE) || + (j == LLViewerRegion::PARTITION_TERRAIN) || + (j == LLViewerRegion::PARTITION_TREE) || + (j == LLViewerRegion::PARTITION_GRASS)) // only check these partitions for now { LLSpatialPartition* part = region->getSpatialPartition(j); - if (part) + if (part && hasRenderType(part->mDrawableType)) { - LLDrawable* hit = part->lineSegmentIntersect(start, end, face_hit, intersection, tex_coord, normal, bi_normal); + LLDrawable* hit = part->lineSegmentIntersect(start, local_end, pick_transparent, face_hit, &position, tex_coord, normal, bi_normal); if (hit) { drawable = hit; + local_end = position; } } } } } + + //check all avatar nametags (silly, isn't it?) + for (std::vector< LLCharacter* >::iterator iter = LLCharacter::sInstances.begin(); + iter != LLCharacter::sInstances.end(); + ++iter) + { + LLVOAvatar* av = (LLVOAvatar*) *iter; + if (av->mNameText.notNull() && av->mNameText->lineSegmentIntersect(start, local_end, position)) + { + drawable = av->mDrawable; + local_end = position; + } + } + + if (intersection) + { + *intersection = position; + } + return drawable ? drawable->getVObj().get() : NULL; } LLViewerObject* LLPipeline::lineSegmentIntersectInHUD(const LLVector3& start, const LLVector3& end, + BOOL pick_transparent, S32* face_hit, LLVector3* intersection, // return the intersection point LLVector2* tex_coord, // return the texture coordinates of the intersection point @@ -4035,15 +4086,27 @@ LLViewerObject* LLPipeline::lineSegmentIntersectInHUD(const LLVector3& start, co { LLViewerRegion* region = *iter; + BOOL toggle = FALSE; + if (!hasRenderType(LLPipeline::RENDER_TYPE_HUD)) + { + toggleRenderType(LLPipeline::RENDER_TYPE_HUD); + toggle = TRUE; + } + LLSpatialPartition* part = region->getSpatialPartition(LLViewerRegion::PARTITION_HUD); if (part) { - LLDrawable* hit = part->lineSegmentIntersect(start, end, face_hit, intersection, tex_coord, normal, bi_normal); + LLDrawable* hit = part->lineSegmentIntersect(start, end, pick_transparent, face_hit, intersection, tex_coord, normal, bi_normal); if (hit) { drawable = hit; } } + + if (toggle) + { + toggleRenderType(LLPipeline::RENDER_TYPE_HUD); + } } return drawable ? drawable->getVObj().get() : NULL; } @@ -4197,7 +4260,8 @@ void LLPipeline::generateReflectionMap(LLCubeMap* cube_map, LLCamera& cube_cam) LLPipeline::sReflectionRender = TRUE; - cube_map->bind(); + gGL.getTexUnit(cube_map->getStage())->bind(cube_map); + gGL.getTexUnit(0)->activate(); GLint width; glGetTexLevelParameteriv(GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB, 0, GL_TEXTURE_WIDTH, &width); if (width != res) @@ -4209,8 +4273,10 @@ void LLPipeline::generateReflectionMap(LLCubeMap* cube_map, LLCamera& cube_cam) glTexImage2D(gl_cube_face[i], 0, GL_RGBA, res, res, 0, GL_RGBA, GL_FLOAT, NULL); } } - glBindTexture(GL_TEXTURE_CUBE_MAP_ARB, 0); - cube_map->disable(); + gGL.getTexUnit(cube_map->getStage())->unbind(LLTexUnit::TT_CUBE_MAP); + gGL.getTexUnit(cube_map->getStage())->disable(); + gGL.getTexUnit(0)->activate(); + gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE); BOOL toggle_ui = gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_UI); if (toggle_ui) @@ -4254,7 +4320,7 @@ void LLPipeline::generateReflectionMap(LLCubeMap* cube_map, LLCamera& cube_cam) gPipeline.calcNearbyLights(cube_cam); stop_glerror(); - LLViewerImage::unbindTexture(0, GL_TEXTURE_2D); + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, mCubeFrameBuffer); glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, mCubeDepth); @@ -4410,7 +4476,8 @@ void LLPipeline::blurReflectionMap(LLCubeMap* cube_in, LLCubeMap* cube_out) glPushMatrix(); cube_out->enableTexture(0); - cube_out->bind(); + gGL.getTexUnit(cube_out->getStage())->bind(cube_out); + gGL.getTexUnit(0)->activate(); GLint width; glGetTexLevelParameteriv(GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB, 0, GL_TEXTURE_WIDTH, &width); if (width != res) @@ -4422,8 +4489,8 @@ void LLPipeline::blurReflectionMap(LLCubeMap* cube_in, LLCubeMap* cube_out) glTexImage2D(gl_cube_face[i], 0, GL_RGBA, res, res, 0, GL_RGBA, GL_FLOAT, NULL); } } - glBindTexture(GL_TEXTURE_CUBE_MAP_ARB, 0); - + gGL.getTexUnit(cube_out->getStage())->unbind(LLTexUnit::TT_CUBE_MAP); + gGL.getTexUnit(0)->activate(); glViewport(0, 0, res, res); LLGLEnable blend(GL_BLEND); @@ -4451,16 +4518,17 @@ void LLPipeline::blurReflectionMap(LLCubeMap* cube_in, LLCubeMap* cube_out) if (j == 0) { - cube_in->bind(); + gGL.getTexUnit(cube_in->getStage())->bind(cube_in); } else { - glBindTexture(GL_TEXTURE_CUBE_MAP_ARB, mBlurCubeTexture[j-1]); + gGL.getTexUnit(cube_in->getStage())->bindManual(LLTexUnit::TT_CUBE_MAP, mBlurCubeTexture[j-1]); } + gGL.getTexUnit(0)->activate(); stop_glerror(); - LLViewerImage::unbindTexture(0, GL_TEXTURE_2D); + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, mBlurCubeBuffer[j]); stop_glerror(); @@ -4489,7 +4557,7 @@ void LLPipeline::blurReflectionMap(LLCubeMap* cube_in, LLCubeMap* cube_out) stop_glerror(); - glBindTexture(GL_TEXTURE_CUBE_MAP_ARB, 0); + gGL.getTexUnit(cube_in->getStage())->unbind(LLTexUnit::TT_CUBE_MAP); glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); gGL.setColorMask(true, false); @@ -4498,7 +4566,8 @@ void LLPipeline::blurReflectionMap(LLCubeMap* cube_in, LLCubeMap* cube_out) glMatrixMode(GL_MODELVIEW); glPopMatrix(); - cube_in->disableTexture(); + gGL.getTexUnit(cube_in->getStage())->disable(); + gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE); gViewerWindow->setupViewport(); gGL.setSceneBlendType(LLRender::BT_ALPHA); @@ -4566,7 +4635,7 @@ void LLPipeline::renderBloom(BOOL for_snapshot) if (for_snapshot) { - mGlow[1].bindTexture(); + gGL.getTexUnit(0)->bind(&mGlow[1]); { //LLGLEnable stencil(GL_STENCIL_TEST); //glStencilFunc(GL_NOTEQUAL, 255, 0xFFFFFFFF); @@ -4575,7 +4644,7 @@ void LLPipeline::renderBloom(BOOL for_snapshot) LLGLEnable blend(GL_BLEND); gGL.setSceneBlendType(LLRender::BT_ADD); tc2.setVec(1,1); - gGL.begin(LLVertexBuffer::TRIANGLE_STRIP); + gGL.begin(LLRender::TRIANGLE_STRIP); gGL.color4f(1,1,1,1); gGL.texCoord2f(tc1.mV[0], tc1.mV[1]); gGL.vertex2f(-1,-1); @@ -4625,15 +4694,15 @@ void LLPipeline::renderBloom(BOOL for_snapshot) LLGLEnable test(GL_ALPHA_TEST); gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT); gGL.setSceneBlendType(LLRender::BT_ADD_WITH_ALPHA); - LLViewerImage::unbindTexture(0, GL_TEXTURE_2D); - glDisable(GL_TEXTURE_2D); - glEnable(GL_TEXTURE_RECTANGLE_ARB); - mScreen.bindTexture(); + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); + gGL.getTexUnit(0)->disable(); + gGL.getTexUnit(0)->enable(LLTexUnit::TT_RECT_TEXTURE); + gGL.getTexUnit(0)->bind(&mScreen); gGL.color4f(1,1,1,1); gPipeline.enableLightsFullbright(LLColor4(1,1,1,1)); - gGL.begin(LLVertexBuffer::TRIANGLE_STRIP); + gGL.begin(LLRender::TRIANGLE_STRIP); gGL.texCoord2f(tc1.mV[0], tc1.mV[1]); gGL.vertex2f(-1,-1); @@ -4647,8 +4716,7 @@ void LLPipeline::renderBloom(BOOL for_snapshot) gGL.vertex2f(1,1); gGL.end(); - glEnable(GL_TEXTURE_2D); - glDisable(GL_TEXTURE_RECTANGLE_ARB); + gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE); mGlow[2].flush(); } @@ -4678,7 +4746,7 @@ void LLPipeline::renderBloom(BOOL for_snapshot) for (S32 i = 0; i < kernel; i++) { - LLViewerImage::unbindTexture(0, GL_TEXTURE_2D); + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); { LLFastTimer ftm(LLFastTimer::FTM_RENDER_BLOOM_FBO); mGlow[i%2].bindTarget(); @@ -4687,11 +4755,11 @@ void LLPipeline::renderBloom(BOOL for_snapshot) if (i == 0) { - mGlow[2].bindTexture(); + gGL.getTexUnit(0)->bind(&mGlow[2]); } else { - mGlow[(i-1)%2].bindTexture(); + gGL.getTexUnit(0)->bind(&mGlow[(i-1)%2]); } if (i%2 == 0) @@ -4703,7 +4771,7 @@ void LLPipeline::renderBloom(BOOL for_snapshot) gGlowProgram.uniform2f("glowDelta", 0, delta); } - gGL.begin(LLVertexBuffer::TRIANGLE_STRIP); + gGL.begin(LLRender::TRIANGLE_STRIP); gGL.texCoord2f(tc1.mV[0], tc1.mV[1]); gGL.vertex2f(-1,-1); @@ -4768,8 +4836,8 @@ void LLPipeline::renderBloom(BOOL for_snapshot) LLGLEnable blend(GL_BLEND); gGL.blendFunc(GL_ONE, GL_ONE); - glDisable(GL_TEXTURE_2D); - glEnable(GL_TEXTURE_RECTANGLE_ARB); + gGL.getTexUnit(0)->disable(); + gGL.getTexUnit(0)->enable(LLTexUnit::TT_RECT_TEXTURE); mScreen.bindTexture(); gGL.begin(LLVertexBuffer::TRIANGLE_STRIP); @@ -4789,8 +4857,7 @@ void LLPipeline::renderBloom(BOOL for_snapshot) gGL.flush(); - glEnable(GL_TEXTURE_2D); - glDisable(GL_TEXTURE_RECTANGLE_ARB); + gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE); gGL.blendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); }*/ @@ -4835,12 +4902,12 @@ void LLPipeline::renderBloom(BOOL for_snapshot) //tex unit 0 gGL.getTexUnit(0)->setTextureColorBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_TEX_COLOR); - - mGlow[1].bindTexture(); + + gGL.getTexUnit(0)->bind(&mGlow[1]); glEnableClientState(GL_TEXTURE_COORD_ARRAY); glTexCoordPointer(2, GL_FLOAT, 0, uv0); gGL.getTexUnit(1)->activate(); - glEnable(GL_TEXTURE_RECTANGLE_ARB); + gGL.getTexUnit(1)->enable(LLTexUnit::TT_RECT_TEXTURE); //tex unit 1 gGL.getTexUnit(1)->setTextureColorBlend(LLTexUnit::TBO_ADD, LLTexUnit::TBS_TEX_COLOR, LLTexUnit::TBS_PREV_COLOR); @@ -4851,14 +4918,16 @@ void LLPipeline::renderBloom(BOOL for_snapshot) glVertexPointer(2, GL_FLOAT, 0, v); - mScreen.bindTexture(); + gGL.getTexUnit(1)->bind(&mScreen); + gGL.getTexUnit(1)->activate(); LLGLEnable multisample(GL_MULTISAMPLE_ARB); glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); - glDisable(GL_TEXTURE_RECTANGLE_ARB); + gGL.getTexUnit(1)->disable(); glDisableClientState(GL_TEXTURE_COORD_ARRAY); gGL.getTexUnit(1)->setTextureBlendType(LLTexUnit::TB_MULT); + glClientActiveTextureARB(GL_TEXTURE0_ARB); gGL.getTexUnit(0)->activate(); glDisableClientState(GL_TEXTURE_COORD_ARRAY); @@ -4936,7 +5005,7 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in) if (!LLViewerCamera::getInstance()->cameraUnderWater()) { //generate planar reflection map - LLViewerImage::unbindTexture(0, GL_TEXTURE_2D); + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); glClearColor(0,0,0,0); gGL.setColorMask(true, true); mWaterRef.bindTarget(); @@ -5041,7 +5110,7 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in) } LLViewerCamera::updateFrustumPlanes(camera); - LLViewerImage::unbindTexture(0, GL_TEXTURE_2D); + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); LLColor4& col = LLDrawPoolWater::sWaterFogColor; glClearColor(col.mV[0], col.mV[1], col.mV[2], 0.f); gGL.setColorMask(true, true); @@ -5173,11 +5242,11 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar) LLVector3 left = camera.getLeftAxis(); left *= left; - left.normVec(); + left.normalize(); LLVector3 up = camera.getUpAxis(); up *= up; - up.normVec(); + up.normalize(); tdim.mV[0] = fabsf(half_height * left); tdim.mV[1] = fabsf(half_height * up); @@ -5218,10 +5287,10 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar) resY != avatar->mImpostor.getHeight()) { avatar->mImpostor.allocate(resX,resY,GL_RGBA,TRUE); - avatar->mImpostor.bindTexture(); + gGL.getTexUnit(0)->bind(&avatar->mImpostor); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - LLImageGL::unbindTexture(0, GL_TEXTURE_2D); + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); } { @@ -5258,13 +5327,13 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar) } gGL.setSceneBlendType(LLRender::BT_ADD); - LLImageGL::unbindTexture(0, GL_TEXTURE_2D); + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); LLGLDepthTest depth(GL_FALSE, GL_FALSE); gGL.color4f(1,1,1,1); gGL.color4ub(64,64,64,255); - gGL.begin(LLVertexBuffer::QUADS); + gGL.begin(LLRender::QUADS); gGL.vertex3fv((pos+left-up).mV); gGL.vertex3fv((pos-left-up).mV); gGL.vertex3fv((pos-left+up).mV); diff --git a/linden/indra/newview/pipeline.h b/linden/indra/newview/pipeline.h index 5f94e37..c795283 100644 --- a/linden/indra/newview/pipeline.h +++ b/linden/indra/newview/pipeline.h @@ -131,6 +131,7 @@ public: //get the object between start and end that's closest to start. LLViewerObject* lineSegmentIntersectInWorld(const LLVector3& start, const LLVector3& end, + BOOL pick_transparent, S32* face_hit, // return the face hit LLVector3* intersection = NULL, // return the intersection point LLVector2* tex_coord = NULL, // return the texture coordinates of the intersection point @@ -138,6 +139,7 @@ public: LLVector3* bi_normal = NULL // return the surface bi-normal at the intersection point ); LLViewerObject* lineSegmentIntersectInHUD(const LLVector3& start, const LLVector3& end, + BOOL pick_transparent, S32* face_hit, // return the face hit LLVector3* intersection = NULL, // return the intersection point LLVector2* tex_coord = NULL, // return the texture coordinates of the intersection point @@ -317,7 +319,6 @@ public: // RENDER_DEBUG_FEATURE_HW_LIGHTING = 0x0010, RENDER_DEBUG_FEATURE_FLEXIBLE = 0x0010, RENDER_DEBUG_FEATURE_FOG = 0x0020, - RENDER_DEBUG_FEATURE_PALETTE = 0x0040, RENDER_DEBUG_FEATURE_FR_INFO = 0x0080, RENDER_DEBUG_FEATURE_FOOT_SHADOWS = 0x0100, }; diff --git a/linden/indra/newview/res/viewerRes.rc b/linden/indra/newview/res/viewerRes.rc index a39bb9f..8df0c57 100644 --- a/linden/indra/newview/res/viewerRes.rc +++ b/linden/indra/newview/res/viewerRes.rc @@ -231,8 +231,8 @@ TOOLMEDIAOPEN CURSOR "toolmediaopen.cur" // VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,20,9,87416 - PRODUCTVERSION 1,20,9,87416 + FILEVERSION 1,20,15,97417 + PRODUCTVERSION 1,20,15,97417 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -249,12 +249,12 @@ BEGIN BEGIN VALUE "CompanyName", "Linden Lab" VALUE "FileDescription", "Second Life" - VALUE "FileVersion", "1.20.9.87416" + VALUE "FileVersion", "1.20.15.97417" VALUE "InternalName", "Second Life" VALUE "LegalCopyright", "Copyright 2001-2008, Linden Research, Inc." VALUE "OriginalFilename", "SecondLife.exe" VALUE "ProductName", "Second Life" - VALUE "ProductVersion", "1.20.9.87416" + VALUE "ProductVersion", "1.20.15.97417" END END BLOCK "VarFileInfo" diff --git a/linden/indra/newview/secondlife setup build dazzle.bat b/linden/indra/newview/secondlife setup build dazzle.bat deleted file mode 100644 index f09f657..0000000 --- a/linden/indra/newview/secondlife setup build dazzle.bat +++ /dev/null @@ -1,4 +0,0 @@ -@rem Invoke the script which preps then runs the installer. -@rem This batch file is customized per grid. - -@"secondlife setup build.bat" --channel="Second Life First Look Dazzle" diff --git a/linden/indra/newview/skins/default/xui/de/alerts.xml b/linden/indra/newview/skins/default/xui/de/alerts.xml index ab72b30..57a5a4b 100644 --- a/linden/indra/newview/skins/default/xui/de/alerts.xml +++ b/linden/indra/newview/skins/default/xui/de/alerts.xml @@ -735,13 +735,8 @@ Sie benötigen ein Benutzerkonto, um [SECOND_LIFE] betreten zu können. Möchten - Anzeigen erscheinen für eine Woche unter 'Anzeigen' -im Suchverzeichnis. -Füllen Sie Ihre Anzeige aus und klicken Sie auf 'Veröffentlichen...', um sie zum -Verzeichnis hinzuzufügen. -Sie werden gebeten, einen Preis zu bezahlen, wenn Sie auf 'Veröffentlichen' klicken. -Wenn Sie mehr bezahlen oder ein Benutzer nach Ihren Suchbegriffen sucht, -erscheint Ihre Anzeige weiter oben in der Liste. + Anzeigen erscheinen für eine Woche unter 'Anzeigen' im Suchverzeichnis. Füllen Sie Ihre Anzeige aus und klicken Sie auf 'Veröffentlichen...', um sie zum Verzeichnis hinzuzufügen. +Sie werden gebeten, einen Preis zu bezahlen, wenn Sie auf 'Veröffentlichen' klicken. Wenn Sie mehr bezahlen oder ein Benutzer nach Ihren Suchbegriffen sucht, erscheint Ihre Anzeige weiter oben in der Liste. - Zur [SECOND_LIFE]-Webseite, um Auktionen anzuzeigen oder -ein Gebot abzugeben? + Zur [SECOND_LIFE]-Webseite, um Auktionen anzuzeigen oder ein Gebot abzugeben?