summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
Diffstat (limited to 'indra')
-rw-r--r--indra/llinventory/llinventory.cpp6
-rw-r--r--indra/llui/llfolderview.cpp140
-rw-r--r--indra/llui/llfolderview.h10
-rw-r--r--indra/newview/llhudobject.h2
-rw-r--r--indra/newview/llinventorypanel.cpp27
-rw-r--r--indra/newview/llvoavatar.cpp2
-rw-r--r--indra/newview/llvoicevisualizer.cpp1285
-rw-r--r--indra/newview/llvoicevisualizer.h1
-rw-r--r--indra/newview/llvopartgroup.cpp4
-rw-r--r--indra/newview/skins/default/xui/en/panel_landmarks.xml4
10 files changed, 743 insertions, 738 deletions
diff --git a/indra/llinventory/llinventory.cpp b/indra/llinventory/llinventory.cpp
index 6e54f9d78a..a80ae73dca 100644
--- a/indra/llinventory/llinventory.cpp
+++ b/indra/llinventory/llinventory.cpp
@@ -75,13 +75,15 @@ LLInventoryObject::LLInventoryObject(const LLUUID& uuid,
mUUID(uuid),
mParentUUID(parent_uuid),
mType(type),
- mName(name)
+ mName(name),
+ mCreationDate(0)
{
correctInventoryName(mName);
}
LLInventoryObject::LLInventoryObject() :
- mType(LLAssetType::AT_NONE)
+ mType(LLAssetType::AT_NONE),
+ mCreationDate(0)
{
}
diff --git a/indra/llui/llfolderview.cpp b/indra/llui/llfolderview.cpp
index 5d98dc9663..fedb8bc014 100644
--- a/indra/llui/llfolderview.cpp
+++ b/indra/llui/llfolderview.cpp
@@ -749,28 +749,18 @@ void LLFolderView::removeSelectedItems()
// iterate through the new container.
count = items.size();
LLUUID new_selection_id;
+ LLFolderViewItem* item_to_select = getNextUnselectedItem();
+
if(count == 1)
{
LLFolderViewItem* item_to_delete = items[0];
LLFolderViewFolder* parent = item_to_delete->getParentFolder();
- LLFolderViewItem* new_selection = item_to_delete->getNextOpenNode(FALSE);
- if (!new_selection)
- {
- new_selection = item_to_delete->getPreviousOpenNode(FALSE);
- }
if(parent)
{
if (item_to_delete->remove())
{
// change selection on successful delete
- if (new_selection)
- {
- getRoot()->setSelection(new_selection, new_selection->isOpen(), mParentPanel->hasFocus());
- }
- else
- {
- getRoot()->setSelection(NULL, mParentPanel->hasFocus());
- }
+ setSelection(item_to_select, item_to_select ? item_to_select->isOpen() : false, mParentPanel->hasFocus());
}
}
arrangeAll();
@@ -779,28 +769,8 @@ void LLFolderView::removeSelectedItems()
{
LLDynamicArray<LLFolderViewModelItem*> listeners;
LLFolderViewModelItem* listener;
- LLFolderViewItem* last_item = items[count - 1];
- LLFolderViewItem* new_selection = last_item->getNextOpenNode(FALSE);
- while(new_selection && new_selection->isSelected())
- {
- new_selection = new_selection->getNextOpenNode(FALSE);
- }
- if (!new_selection)
- {
- new_selection = last_item->getPreviousOpenNode(FALSE);
- while (new_selection && (new_selection->isInSelection()))
- {
- new_selection = new_selection->getPreviousOpenNode(FALSE);
- }
- }
- if (new_selection)
- {
- getRoot()->setSelection(new_selection, new_selection->isOpen(), mParentPanel->hasFocus());
- }
- else
- {
- getRoot()->setSelection(NULL, mParentPanel->hasFocus());
- }
+
+ setSelection(item_to_select, item_to_select ? item_to_select->isOpen() : false, mParentPanel->hasFocus());
for(S32 i = 0; i < count; ++i)
{
@@ -1032,28 +1002,13 @@ void LLFolderView::cut()
S32 count = mSelectedItems.size();
if(getVisible() && getEnabled() && (count > 0))
{
- LLFolderViewModelItem* listener = NULL;
-
- LLFolderViewItem* last_item = *mSelectedItems.rbegin();;
- LLFolderViewItem* new_selection = last_item->getNextOpenNode(FALSE);
- while(new_selection && new_selection->isSelected())
- {
- new_selection = new_selection->getNextOpenNode(FALSE);
- }
- if (!new_selection)
- {
- new_selection = last_item->getPreviousOpenNode(FALSE);
- while (new_selection && (new_selection->isInSelection()))
- {
- new_selection = new_selection->getPreviousOpenNode(FALSE);
- }
- }
+ LLFolderViewItem* item_to_select = getNextUnselectedItem();
selected_items_t::iterator item_it;
for (item_it = mSelectedItems.begin(); item_it != mSelectedItems.end(); ++item_it)
{
LLFolderViewItem* item_to_cut = *item_it;
- listener = item_to_cut->getViewModelItem();
+ LLFolderViewModelItem* listener = item_to_cut->getViewModelItem();
if(listener)
{
listener->cutToClipboard();
@@ -1061,14 +1016,7 @@ void LLFolderView::cut()
}
}
- if (new_selection)
- {
- setSelection(new_selection, new_selection->isOpen(), mParentPanel->hasFocus());
- }
- else
- {
- setSelection(NULL, mParentPanel->hasFocus());
- }
+ setSelection(item_to_select, item_to_select ? item_to_select->isOpen() : false, mParentPanel->hasFocus());
}
mSearchString.clear();
}
@@ -1274,12 +1222,12 @@ BOOL LLFolderView::handleKeyHere( KEY key, MASK mask )
if (next->isSelected())
{
// shrink selection
- getRoot()->changeSelection(last_selected, FALSE);
+ changeSelection(last_selected, FALSE);
}
else if (last_selected->getParentFolder() == next->getParentFolder())
{
// grow selection
- getRoot()->changeSelection(next, TRUE);
+ changeSelection(next, TRUE);
}
}
}
@@ -1338,12 +1286,12 @@ BOOL LLFolderView::handleKeyHere( KEY key, MASK mask )
if (prev->isSelected())
{
// shrink selection
- getRoot()->changeSelection(last_selected, FALSE);
+ changeSelection(last_selected, FALSE);
}
else if (last_selected->getParentFolder() == prev->getParentFolder())
{
// grow selection
- getRoot()->changeSelection(prev, TRUE);
+ changeSelection(prev, TRUE);
}
}
}
@@ -1701,9 +1649,6 @@ void LLFolderView::scrollToShowItem(LLFolderViewItem* item, const LLRect& constr
if(item)
{
LLRect local_rect = item->getLocalRect();
- LLRect item_scrolled_rect; // item position relative to display area of scroller
- LLRect visible_doc_rect = mScrollContainer->getVisibleContentRect();
-
S32 icon_height = mIcon.isNull() ? 0 : mIcon->getHeight();
S32 label_height = getLabelFontForStyle(mLabelStyle)->getLineHeight();
// when navigating with keyboard, only move top of opened folder on screen, otherwise show whole folder
@@ -1812,6 +1757,20 @@ void LLFolderView::update()
mNeedsAutoSelect = FALSE;
}
+ BOOL is_visible = isInVisibleChain();
+
+ //Puts folders/items in proper positions
+ if ( is_visible )
+ {
+ sanitizeSelection();
+ if( needsArrange() )
+ {
+ S32 height = 0;
+ S32 width = 0;
+ S32 total_height = arrange( &width, &height );
+ notifyParent(LLSD().with("action", "size_changes").with("height", total_height));
+ }
+ }
// during filtering process, try to pin selected item's location on screen
// this will happen when searching your inventory and when new items arrive
@@ -1823,18 +1782,26 @@ void LLFolderView::update()
// lets pin it!
mPinningSelectedItem = TRUE;
- LLRect visible_content_rect = (mScrollContainer ? mScrollContainer->getVisibleContentRect() : LLRect());
+ //Computes visible area
+ const LLRect visible_content_rect = (mScrollContainer ? mScrollContainer->getVisibleContentRect() : LLRect());
LLFolderViewItem* selected_item = mSelectedItems.back();
+ //Computes location of selected content, content outside visible area will be scrolled to using below code
LLRect item_rect;
selected_item->localRectToOtherView(selected_item->getLocalRect(), &item_rect, this);
- // if item is visible in scrolled region
- if (visible_content_rect.overlaps(item_rect))
+
+ //Computes intersected region of the selected content and visible area
+ LLRect overlap_rect(item_rect);
+ overlap_rect.intersectWith(visible_content_rect);
+
+ //Don't scroll when the selected content exists within the visible area
+ if (overlap_rect.getHeight() >= selected_item->getItemHeight())
{
// then attempt to keep it in same place on screen
mScrollConstraintRect = item_rect;
mScrollConstraintRect.translate(-visible_content_rect.mLeft, -visible_content_rect.mBottom);
}
+ //Scroll because the selected content is outside the visible area
else
{
// otherwise we just want it onscreen somewhere
@@ -1865,20 +1832,6 @@ void LLFolderView::update()
constraint_rect.setOriginAndSize(0, 0, content_rect.getWidth(), content_rect.getHeight());
}
- BOOL is_visible = isInVisibleChain();
-
- if ( is_visible )
- {
- sanitizeSelection();
- if( needsArrange() )
- {
- S32 height = 0;
- S32 width = 0;
- S32 total_height = arrange( &width, &height );
- notifyParent(LLSD().with("action", "size_changes").with("height", total_height));
- }
- }
-
if (mSelectedItems.size() && mNeedsScroll)
{
scrollToShowItem(mSelectedItems.back(), constraint_rect);
@@ -2083,3 +2036,22 @@ S32 LLFolderView::getItemHeight()
}
return 0;
}
+
+LLFolderViewItem* LLFolderView::getNextUnselectedItem()
+{
+ LLFolderViewItem* last_item = *mSelectedItems.rbegin();
+ LLFolderViewItem* new_selection = last_item->getNextOpenNode(FALSE);
+ while(new_selection && new_selection->isSelected())
+ {
+ new_selection = new_selection->getNextOpenNode(FALSE);
+ }
+ if (!new_selection)
+ {
+ new_selection = last_item->getPreviousOpenNode(FALSE);
+ while (new_selection && (new_selection->isInSelection()))
+ {
+ new_selection = new_selection->getPreviousOpenNode(FALSE);
+ }
+ }
+ return new_selection;
+}
diff --git a/indra/llui/llfolderview.h b/indra/llui/llfolderview.h
index 05beff9bd8..81b0f087e8 100644
--- a/indra/llui/llfolderview.h
+++ b/indra/llui/llfolderview.h
@@ -172,17 +172,19 @@ public:
BOOL isOpen() const { return TRUE; } // root folder always open
// Copy & paste
- virtual void copy();
virtual BOOL canCopy() const;
+ virtual void copy();
- virtual void cut();
virtual BOOL canCut() const;
+ virtual void cut();
- virtual void paste();
virtual BOOL canPaste() const;
+ virtual void paste();
- virtual void doDelete();
virtual BOOL canDoDelete() const;
+ virtual void doDelete();
+
+ LLFolderViewItem* getNextUnselectedItem();
// Public rename functionality - can only start the process
void startRenamingSelectedItem( void );
diff --git a/indra/newview/llhudobject.h b/indra/newview/llhudobject.h
index 21cf5fe17c..32cffe6839 100644
--- a/indra/newview/llhudobject.h
+++ b/indra/newview/llhudobject.h
@@ -39,6 +39,8 @@
#include "lldrawpool.h" // TODO: eliminate, unused below
#include <list>
+#define XXX_STINSON_CHUI_REWORK // temporarily re-enabling the in-world voice-dot
+
class LLViewerCamera;
class LLFontGL;
class LLFace;
diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp
index 9403ccdabe..d6a685541f 100644
--- a/indra/newview/llinventorypanel.cpp
+++ b/indra/newview/llinventorypanel.cpp
@@ -514,10 +514,13 @@ void LLInventoryPanel::modelChanged(U32 mask)
}
else
{
+ // Remove the item ID before destroying the view because the view-model-item gets
+ // destroyed when the view is destroyed
+ removeItemID(viewmodel_item->getUUID());
+
// Item is to be moved outside the panel's directory (e.g. moved to trash for a panel that
// doesn't include trash). Just remove the item's UI.
view_item->destroyView();
- removeItemID(viewmodel_item->getUUID());
}
}
}
@@ -604,9 +607,25 @@ void LLInventoryPanel::idle(void* user_data)
if (panel->mClipboardState != LLClipboard::instance().getGeneration())
{
panel->mClipboardState = LLClipboard::instance().getGeneration();
- panel->getFilter().setModified(LLClipboard::instance().isCutMode()
- ? LLInventoryFilter::FILTER_MORE_RESTRICTIVE
- : LLInventoryFilter::FILTER_LESS_RESTRICTIVE);
+ if (LLClipboard::instance().isCutMode())
+ {
+ LLDynamicArray<LLUUID> objects;
+ LLClipboard::instance().pasteFromClipboard(objects);
+
+ for (LLDynamicArray<LLUUID>::iterator it = objects.begin(), end_it = objects.end();
+ it != end_it;
+ ++it)
+ {
+ LLFolderViewItem* item = panel->getItemByID(*it);
+ if (item)
+ {
+ item->getViewModelItem()->dirtyFilter();
+ }
+ }
+ /*panel->getFilter().setModified(LLClipboard::instance().isCutMode()
+ ? LLInventoryFilter::FILTER_MORE_RESTRICTIVE
+ : LLInventoryFilter::FILTER_LESS_RESTRICTIVE);*/
+ }
}
panel->mFolderRoot->update();
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp
index 2871b7b018..20b33b5bea 100644
--- a/indra/newview/llvoavatar.cpp
+++ b/indra/newview/llvoavatar.cpp
@@ -34,6 +34,8 @@
#include "llvoavatar.h"
+#define XXX_STINSON_CHUI_REWORK // temporarily re-enabling the in-world voice-dot
+
#include <stdio.h>
#include <ctype.h>
diff --git a/indra/newview/llvoicevisualizer.cpp b/indra/newview/llvoicevisualizer.cpp
index dcf33bce10..d380a8672f 100644
--- a/indra/newview/llvoicevisualizer.cpp
+++ b/indra/newview/llvoicevisualizer.cpp
@@ -1,642 +1,643 @@
-/**
- * @file llvoicevisualizer.cpp
- * @brief Draws in-world speaking indicators.
- *
- * $LicenseInfo:firstyear=2000&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
- * $/LicenseInfo$
- */
-
-//----------------------------------------------------------------------
-// Voice Visualizer
-// author: JJ Ventrella
-// (information about this stuff can be found in "llvoicevisualizer.h")
-//----------------------------------------------------------------------
-#include "llviewerprecompiledheaders.h"
-#include "llviewercontrol.h"
-#include "llglheaders.h"
-#include "llsphere.h"
-#include "llvoicevisualizer.h"
-#include "llviewercamera.h"
-#include "llviewerobject.h"
-#include "llviewertexture.h"
-#include "llviewertexturelist.h"
-#include "llvoiceclient.h"
-#include "llrender.h"
-
-//brent's wave image
-//29de489d-0491-fb00-7dab-f9e686d31e83
-
-
-#ifdef XXX_STINSON_CHUI_REWORK
-//--------------------------------------------------------------------------------------
-// sound symbol constants
-//--------------------------------------------------------------------------------------
-const F32 HEIGHT_ABOVE_HEAD = 0.3f; // how many meters vertically above the av's head the voice symbol will appear
-const F32 RED_THRESHOLD = LLVoiceClient::OVERDRIVEN_POWER_LEVEL; // value above which speaking amplitude causes the voice symbol to turn red
-const F32 GREEN_THRESHOLD = 0.2f; // value above which speaking amplitude causes the voice symbol to turn green
-const F32 FADE_OUT_DURATION = 0.4f; // how many seconds it takes for a pair of waves to fade away
-const F32 EXPANSION_RATE = 1.0f; // how many seconds it takes for the waves to expand to twice their original size
-const F32 EXPANSION_MAX = 1.5f; // maximum size scale to which the waves can expand before popping back to 1.0
-const F32 WAVE_WIDTH_SCALE = 0.03f; // base width of the waves
-const F32 WAVE_HEIGHT_SCALE = 0.02f; // base height of the waves
-const F32 BASE_BRIGHTNESS = 0.7f; // gray level of the voice indicator when quiet (below green threshold)
-const F32 DOT_SIZE = 0.05f; // size of the dot billboard texture
-const F32 DOT_OPACITY = 0.7f; // how opaque the dot is
-const F32 WAVE_MOTION_RATE = 1.5f; // scalar applied to consecutive waves as a function of speaking amplitude
-#endif // XXX_STINSON_CHUI_REWORK
-
-//--------------------------------------------------------------------------------------
-// gesticulation constants
-//--------------------------------------------------------------------------------------
-const F32 DEFAULT_MINIMUM_GESTICULATION_AMPLITUDE = 0.2f;
-const F32 DEFAULT_MAXIMUM_GESTICULATION_AMPLITUDE = 1.0f;
-
-#ifdef XXX_STINSON_CHUI_REWORK
-//--------------------------------------------------------------------------------------
-// other constants
-//--------------------------------------------------------------------------------------
-const F32 ONE_HALF = 1.0f; // to clarify intent and reduce magic numbers in the code.
-const LLVector3 WORLD_UPWARD_DIRECTION = LLVector3( 0.0f, 0.0f, 1.0f ); // Z is up in SL
-#endif // XXX_STINSON_CHUI_REWORK
-
-//------------------------------------------------------------------
-// Initialize the statics
-//------------------------------------------------------------------
-bool LLVoiceVisualizer::sPrefsInitialized = false;
-BOOL LLVoiceVisualizer::sLipSyncEnabled = FALSE;
-F32* LLVoiceVisualizer::sOoh = NULL;
-F32* LLVoiceVisualizer::sAah = NULL;
-U32 LLVoiceVisualizer::sOohs = 0;
-U32 LLVoiceVisualizer::sAahs = 0;
-F32 LLVoiceVisualizer::sOohAahRate = 0.0f;
-F32* LLVoiceVisualizer::sOohPowerTransfer = NULL;
-U32 LLVoiceVisualizer::sOohPowerTransfers = 0;
-F32 LLVoiceVisualizer::sOohPowerTransfersf = 0.0f;
-F32* LLVoiceVisualizer::sAahPowerTransfer = NULL;
-U32 LLVoiceVisualizer::sAahPowerTransfers = 0;
-F32 LLVoiceVisualizer::sAahPowerTransfersf = 0.0f;
-
-
-//-----------------------------------------------
-// constructor
-//-----------------------------------------------
-#ifdef XXX_STINSON_CHUI_REWORK
-LLVoiceVisualizer::LLVoiceVisualizer( const U8 type )
-#else // XXX_STINSON_CHUI_REWORK
-LLVoiceVisualizer::LLVoiceVisualizer()
- : LLRefCount(),
- mTimer(),
- mStartTime(0.0),
- mCurrentlySpeaking(false),
- mSpeakingAmplitude(0.0f),
- mMaxGesticulationAmplitude(DEFAULT_MAXIMUM_GESTICULATION_AMPLITUDE),
- mMinGesticulationAmplitude(DEFAULT_MINIMUM_GESTICULATION_AMPLITUDE)
-#endif // XXX_STINSON_CHUI_REWORK
-{
-#ifdef XXX_STINSON_CHUI_REWORK
- mCurrentTime = mTimer.getTotalSeconds();
- mPreviousTime = mCurrentTime;
- mStartTime = mCurrentTime;
-#else // XXX_STINSON_CHUI_REWORK
- mStartTime = mTimer.getTotalSeconds();
-#endif // XXX_STINSON_CHUI_REWORK
-#ifdef XXX_STINSON_CHUI_REWORK
- mVoiceSourceWorldPosition = LLVector3( 0.0f, 0.0f, 0.0f );
- mSpeakingAmplitude = 0.0f;
- mCurrentlySpeaking = false;
- mVoiceEnabled = false;
- mMinGesticulationAmplitude = DEFAULT_MINIMUM_GESTICULATION_AMPLITUDE;
- mMaxGesticulationAmplitude = DEFAULT_MAXIMUM_GESTICULATION_AMPLITUDE;
- mSoundSymbol.mActive = true;
- mSoundSymbol.mPosition = LLVector3( 0.0f, 0.0f, 0.0f );
-#endif // XXX_STINSON_CHUI_REWORK
-
- mTimer.reset();
-
-#ifdef XXX_STINSON_CHUI_REWORK
- const char* sound_level_img[] =
- {
- "voice_meter_dot.j2c",
- "voice_meter_rings.j2c",
- "voice_meter_rings.j2c",
- "voice_meter_rings.j2c",
- "voice_meter_rings.j2c",
- "voice_meter_rings.j2c",
- "voice_meter_rings.j2c"
- };
-
- for (int i=0; i<NUM_VOICE_SYMBOL_WAVES; i++)
- {
- mSoundSymbol.mWaveFadeOutStartTime [i] = mCurrentTime;
- mSoundSymbol.mTexture [i] = LLViewerTextureManager::getFetchedTextureFromFile(sound_level_img[i], FALSE, LLViewerTexture::BOOST_UI);
- mSoundSymbol.mWaveActive [i] = false;
- mSoundSymbol.mWaveOpacity [i] = 1.0f;
- mSoundSymbol.mWaveExpansion [i] = 1.0f;
- }
-
- mSoundSymbol.mTexture[0]->setFilteringOption(LLTexUnit::TFO_ANISOTROPIC);
-#endif // XXX_STINSON_CHUI_REWORK
-
- // The first instance loads the initial state from prefs.
- if (!sPrefsInitialized)
- {
- setPreferences();
-
- // Set up our listener to get updates on all prefs values we care about.
- gSavedSettings.getControl("LipSyncEnabled")->getSignal()->connect(boost::bind(&LLVoiceVisualizer::handleVoiceVisualizerPrefsChanged, _2));
- gSavedSettings.getControl("LipSyncOohAahRate")->getSignal()->connect(boost::bind(&LLVoiceVisualizer::handleVoiceVisualizerPrefsChanged, _2));
- gSavedSettings.getControl("LipSyncOoh")->getSignal()->connect(boost::bind(&LLVoiceVisualizer::handleVoiceVisualizerPrefsChanged, _2));
- gSavedSettings.getControl("LipSyncAah")->getSignal()->connect(boost::bind(&LLVoiceVisualizer::handleVoiceVisualizerPrefsChanged, _2));
- gSavedSettings.getControl("LipSyncOohPowerTransfer")->getSignal()->connect(boost::bind(&LLVoiceVisualizer::handleVoiceVisualizerPrefsChanged, _2));
- gSavedSettings.getControl("LipSyncAahPowerTransfer")->getSignal()->connect(boost::bind(&LLVoiceVisualizer::handleVoiceVisualizerPrefsChanged, _2));
-
- sPrefsInitialized = true;
- }
-
-}//---------------------------------------------------
-
-#ifdef XXX_STINSON_CHUI_REWORK
-//---------------------------------------------------
-void LLVoiceVisualizer::setMinGesticulationAmplitude( F32 m )
-{
- mMinGesticulationAmplitude = m;
-
-}//---------------------------------------------------
-
-//---------------------------------------------------
-void LLVoiceVisualizer::setMaxGesticulationAmplitude( F32 m )
-{
- mMaxGesticulationAmplitude = m;
-
-}//---------------------------------------------------
-
-//---------------------------------------------------
-void LLVoiceVisualizer::setVoiceEnabled( bool v )
-{
- mVoiceEnabled = v;
-
-}//---------------------------------------------------
-#endif // XXX_STINSON_CHUI_REWORK
-
-//---------------------------------------------------
-void LLVoiceVisualizer::setStartSpeaking()
-{
- mStartTime = mTimer.getTotalSeconds();
- mCurrentlySpeaking = true;
-#ifdef XXX_STINSON_CHUI_REWORK
- mSoundSymbol.mActive = true;
-#endif // XXX_STINSON_CHUI_REWORK
-
-}//---------------------------------------------------
-
-
-//---------------------------------------------------
-bool LLVoiceVisualizer::getCurrentlySpeaking()
-{
- return mCurrentlySpeaking;
-
-}//---------------------------------------------------
-
-
-//---------------------------------------------------
-void LLVoiceVisualizer::setStopSpeaking()
-{
- mCurrentlySpeaking = false;
- mSpeakingAmplitude = 0.0f;
-
-}//---------------------------------------------------
-
-
-//---------------------------------------------------
-void LLVoiceVisualizer::setSpeakingAmplitude( F32 a )
-{
- mSpeakingAmplitude = a;
-
-}//---------------------------------------------------
-
-//------------------------------------------------------------------
-// handles parameter updates
-//------------------------------------------------------------------
-bool LLVoiceVisualizer::handleVoiceVisualizerPrefsChanged(const LLSD& newvalue)
-{
- // Note: Ignore the specific event value, we look up the ones we want
- LLVoiceVisualizer::setPreferences();
- return true;
-}
-
-//---------------------------------------------------
-void LLVoiceVisualizer::setPreferences( )
-{
- sLipSyncEnabled = gSavedSettings.getBOOL("LipSyncEnabled");
- sOohAahRate = gSavedSettings.getF32("LipSyncOohAahRate");
-
- std::string oohString = gSavedSettings.getString("LipSyncOoh");
- lipStringToF32s (oohString, sOoh, sOohs);
-
- std::string aahString = gSavedSettings.getString("LipSyncAah");
- lipStringToF32s (aahString, sAah, sAahs);
-
- std::string oohPowerString = gSavedSettings.getString("LipSyncOohPowerTransfer");
- lipStringToF32s (oohPowerString, sOohPowerTransfer, sOohPowerTransfers);
- sOohPowerTransfersf = (F32) sOohPowerTransfers;
-
- std::string aahPowerString = gSavedSettings.getString("LipSyncAahPowerTransfer");
- lipStringToF32s (aahPowerString, sAahPowerTransfer, sAahPowerTransfers);
- sAahPowerTransfersf = (F32) sAahPowerTransfers;
-
-}//---------------------------------------------------
-
-
-//---------------------------------------------------
-// convert a string of digits to an array of floats.
-// the result for each digit is the value of the
-// digit multiplied by 0.11
-//---------------------------------------------------
-void LLVoiceVisualizer::lipStringToF32s ( std::string& in_string, F32*& out_F32s, U32& count_F32s )
-{
- delete[] out_F32s; // get rid of the current array
-
- count_F32s = in_string.length();
- if (count_F32s == 0)
- {
- // we don't like zero length arrays
-
- count_F32s = 1;
- out_F32s = new F32[1];
- out_F32s[0] = 0.0f;
- }
- else
- {
- out_F32s = new F32[count_F32s];
-
- for (U32 i=0; i<count_F32s; i++)
- {
- // we convert the characters 0 to 9 to their numeric value
- // anything else we take the low order four bits with a ceiling of 9
-
- U8 digit = in_string[i];
- U8 four_bits = digit % 16;
- if (four_bits > 9)
- {
- four_bits = 9;
- }
- out_F32s[i] = 0.11f * (F32) four_bits;
- }
- }
-
-}//---------------------------------------------------
-
-
-//--------------------------------------------------------------------------
-// find the amount to blend the ooh and aah mouth morphs
-//--------------------------------------------------------------------------
-void LLVoiceVisualizer::lipSyncOohAah( F32& ooh, F32& aah )
-{
- if( ( sLipSyncEnabled == TRUE ) && mCurrentlySpeaking )
- {
- U32 transfer_index = (U32) (sOohPowerTransfersf * mSpeakingAmplitude);
- if (transfer_index >= sOohPowerTransfers)
- {
- transfer_index = sOohPowerTransfers - 1;
- }
- F32 transfer_ooh = sOohPowerTransfer[transfer_index];
-
- transfer_index = (U32) (sAahPowerTransfersf * mSpeakingAmplitude);
- if (transfer_index >= sAahPowerTransfers)
- {
- transfer_index = sAahPowerTransfers - 1;
- }
- F32 transfer_aah = sAahPowerTransfer[transfer_index];
-
- F64 current_time = mTimer.getTotalSeconds();
- F64 elapsed_time = current_time - mStartTime;
- U32 elapsed_frames = (U32) (elapsed_time * sOohAahRate);
- U32 elapsed_oohs = elapsed_frames % sOohs;
- U32 elapsed_aahs = elapsed_frames % sAahs;
-
- ooh = transfer_ooh * sOoh[elapsed_oohs];
- aah = transfer_aah * sAah[elapsed_aahs];
-
- /*
- llinfos << " elapsed frames " << elapsed_frames
- << " ooh " << ooh
- << " aah " << aah
- << " transfer ooh" << transfer_ooh
- << " transfer aah" << transfer_aah
- << " start time " << mStartTime
- << " current time " << current_time
- << " elapsed time " << elapsed_time
- << " elapsed oohs " << elapsed_oohs
- << " elapsed aahs " << elapsed_aahs
- << llendl;
- */
- }
- else
- {
- ooh = 0.0f;
- aah = 0.0f;
- }
-
-}//---------------------------------------------------
-
-
-#ifdef XXX_STINSON_CHUI_REWORK
-//---------------------------------------------------
-// this method is inherited from HUD Effect
-//---------------------------------------------------
-void LLVoiceVisualizer::render()
-{
- if ( ! mVoiceEnabled )
- {
- return;
- }
-
- if ( mSoundSymbol.mActive )
- {
- mPreviousTime = mCurrentTime;
- mCurrentTime = mTimer.getTotalSeconds();
-
- //---------------------------------------------------------------
- // set the sound symbol position over the source (avatar's head)
- //---------------------------------------------------------------
- mSoundSymbol.mPosition = mVoiceSourceWorldPosition + WORLD_UPWARD_DIRECTION * HEIGHT_ABOVE_HEAD;
-
- //---------------------------------------------------------------
- // some gl state
- //---------------------------------------------------------------
- LLGLSPipelineAlpha alpha_blend;
- LLGLDepthTest depth(GL_TRUE, GL_FALSE);
-
- //-------------------------------------------------------------
- // create coordinates of the geometry for the dot
- //-------------------------------------------------------------
- LLViewerCamera* camera = LLViewerCamera::getInstance();
- LLVector3 l = camera->getLeftAxis() * DOT_SIZE;
- LLVector3 u = camera->getUpAxis() * DOT_SIZE;
-
- LLVector3 bottomLeft = mSoundSymbol.mPosition + l - u;
- LLVector3 bottomRight = mSoundSymbol.mPosition - l - u;
- LLVector3 topLeft = mSoundSymbol.mPosition + l + u;
- LLVector3 topRight = mSoundSymbol.mPosition - l + u;
-
- //-----------------------------
- // bind texture 0 (the dot)
- //-----------------------------
- 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( 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( 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 );
- gGL.end();
-
-
-
- //--------------------------------------------------------------------------------------
- // if currently speaking, trigger waves (1 through 6) based on speaking amplitude
- //--------------------------------------------------------------------------------------
- if ( mCurrentlySpeaking )
- {
- F32 min = 0.2f;
- F32 max = 0.7f;
- F32 fraction = ( mSpeakingAmplitude - min ) / ( max - min );
-
- // in case mSpeakingAmplitude > max....
- if ( fraction > 1.0f )
- {
- fraction = 1.0f;
- }
-
- S32 level = 1 + (int)( fraction * ( NUM_VOICE_SYMBOL_WAVES - 2 ) );
-
- for (int i=0; i<level+1; i++)
- {
- mSoundSymbol.mWaveActive [i] = true;
- mSoundSymbol.mWaveOpacity [i] = 1.0f;
- mSoundSymbol.mWaveFadeOutStartTime [i] = mCurrentTime;
- }
-
- } // if currently speaking
-
- //---------------------------------------------------
- // determine color
- //---------------------------------------------------
- F32 red = 0.0f;
- F32 green = 0.0f;
- F32 blue = 0.0f;
- if ( mSpeakingAmplitude < RED_THRESHOLD )
- {
- if ( mSpeakingAmplitude < GREEN_THRESHOLD )
- {
- red = BASE_BRIGHTNESS;
- green = BASE_BRIGHTNESS;
- blue = BASE_BRIGHTNESS;
- }
- else
- {
- //---------------------------------------------------
- // fade from gray to bright green
- //---------------------------------------------------
- F32 fraction = ( mSpeakingAmplitude - GREEN_THRESHOLD ) / ( 1.0f - GREEN_THRESHOLD );
- red = BASE_BRIGHTNESS - ( fraction * BASE_BRIGHTNESS );
- green = BASE_BRIGHTNESS + fraction * ( 1.0f - BASE_BRIGHTNESS );
- blue = BASE_BRIGHTNESS - ( fraction * BASE_BRIGHTNESS );
- }
- }
- else
- {
- //---------------------------------------------------
- // redish
- //---------------------------------------------------
- red = 1.0f;
- green = 0.2f;
- blue = 0.2f;
- }
-
- for (int i=0; i<NUM_VOICE_SYMBOL_WAVES; i++)
- {
- if ( mSoundSymbol.mWaveActive[i] )
- {
- F32 fadeOutFraction = (F32)( mCurrentTime - mSoundSymbol.mWaveFadeOutStartTime[i] ) / FADE_OUT_DURATION;
-
- mSoundSymbol.mWaveOpacity[i] = 1.0f - fadeOutFraction;
-
- if ( mSoundSymbol.mWaveOpacity[i] < 0.0f )
- {
- mSoundSymbol.mWaveFadeOutStartTime [i] = mCurrentTime;
- mSoundSymbol.mWaveOpacity [i] = 0.0f;
- mSoundSymbol.mWaveActive [i] = false;
- }
-
- //----------------------------------------------------------------------------------
- // This is where we calculate the expansion of the waves - that is, the
- // rate at which they are scaled greater than 1.0 so that they grow over time.
- //----------------------------------------------------------------------------------
- F32 timeSlice = (F32)( mCurrentTime - mPreviousTime );
- F32 waveSpeed = mSpeakingAmplitude * WAVE_MOTION_RATE;
- mSoundSymbol.mWaveExpansion[i] *= ( 1.0f + EXPANSION_RATE * timeSlice * waveSpeed );
-
- if ( mSoundSymbol.mWaveExpansion[i] > EXPANSION_MAX )
- {
- mSoundSymbol.mWaveExpansion[i] = 1.0f;
- }
-
- //----------------------------------------------------------------------------------
- // create geometry for the wave billboard textures
- //----------------------------------------------------------------------------------
- F32 width = i * WAVE_WIDTH_SCALE * mSoundSymbol.mWaveExpansion[i];
- F32 height = i * WAVE_HEIGHT_SCALE * mSoundSymbol.mWaveExpansion[i];
-
- LLVector3 l = camera->getLeftAxis() * width;
- LLVector3 u = camera->getUpAxis() * height;
-
- LLVector3 bottomLeft = mSoundSymbol.mPosition + l - u;
- LLVector3 bottomRight = mSoundSymbol.mPosition - l - u;
- LLVector3 topLeft = mSoundSymbol.mPosition + l + u;
- LLVector3 topRight = mSoundSymbol.mPosition - l + u;
-
- gGL.color4fv( LLColor4( red, green, blue, mSoundSymbol.mWaveOpacity[i] ).mV );
- gGL.getTexUnit(0)->bind(mSoundSymbol.mTexture[i]);
-
-
- //---------------------------------------------------
- // now, render the mofo
- //---------------------------------------------------
- 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( 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 );
- gGL.end();
-
- } //if ( mSoundSymbol.mWaveActive[i] )
-
- }// for loop
-
- }//if ( mSoundSymbol.mActive )
-
-}//---------------------------------------------------
-
-//---------------------------------------------------
-void LLVoiceVisualizer::setVoiceSourceWorldPosition( const LLVector3 &p )
-{
- mVoiceSourceWorldPosition = p;
-
-}//---------------------------------------------------
-#endif // XXX_STINSON_CHUI_REWORK
-
-//---------------------------------------------------
-VoiceGesticulationLevel LLVoiceVisualizer::getCurrentGesticulationLevel()
-{
- VoiceGesticulationLevel gesticulationLevel = VOICE_GESTICULATION_LEVEL_OFF; //default
-
- //-----------------------------------------------------------------------------------------
- // Within the range of gesticulation amplitudes, the sound signal is split into
- // three equal amplitude regimes, each specifying one of three gesticulation levels.
- //-----------------------------------------------------------------------------------------
- F32 range = mMaxGesticulationAmplitude - mMinGesticulationAmplitude;
-
- 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;
-
-}//---------------------------------------------------
-
-
-
-//------------------------------------
-// Destructor
-//------------------------------------
-LLVoiceVisualizer::~LLVoiceVisualizer()
-{
-}//----------------------------------------------
-
-
-#ifdef XXX_STINSON_CHUI_REWORK
-//---------------------------------------------------
-// "packData" is inherited from HUDEffect
-//---------------------------------------------------
-void LLVoiceVisualizer::packData(LLMessageSystem *mesgsys)
-{
- // Pack the default data
- LLHUDEffect::packData(mesgsys);
-
- // TODO -- pack the relevant data for voice effects
- // we'll come up with some cool configurations....TBD
- //U8 packed_data[41];
- //mesgsys->addBinaryDataFast(_PREHASH_TypeData, packed_data, 41);
- U8 packed_data = 0;
- mesgsys->addBinaryDataFast(_PREHASH_TypeData, &packed_data, 1);
-}
-
-
-//---------------------------------------------------
-// "unpackData" is inherited from HUDEffect
-//---------------------------------------------------
-void LLVoiceVisualizer::unpackData(LLMessageSystem *mesgsys, S32 blocknum)
-{
- // TODO -- find the speaker, unpack binary data, set the properties of this effect
- /*
- LLHUDEffect::unpackData(mesgsys, blocknum);
- LLUUID source_id;
- LLUUID target_id;
- S32 size = mesgsys->getSizeFast(_PREHASH_Effect, blocknum, _PREHASH_TypeData);
- if (size != 1)
- {
- llwarns << "Voice effect with bad size " << size << llendl;
- return;
- }
- mesgsys->getBinaryDataFast(_PREHASH_Effect, _PREHASH_TypeData, packed_data, 1, blocknum);
- */
-}
-
-
-//------------------------------------------------------------------
-// this method is inherited from HUD Effect
-//------------------------------------------------------------------
-void LLVoiceVisualizer::markDead()
-{
- mCurrentlySpeaking = false;
- mVoiceEnabled = false;
- mSoundSymbol.mActive = false;
-
- LLHUDEffect::markDead();
-}//------------------------------------------------------------------
-
-#endif // XXX_STINSON_CHUI_REWORK
+/**
+ * @file llvoicevisualizer.cpp
+ * @brief Draws in-world speaking indicators.
+ *
+ * $LicenseInfo:firstyear=2000&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2010, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
+ * $/LicenseInfo$
+ */
+
+//----------------------------------------------------------------------
+// Voice Visualizer
+// author: JJ Ventrella
+// (information about this stuff can be found in "llvoicevisualizer.h")
+//----------------------------------------------------------------------
+#include "llviewerprecompiledheaders.h"
+#include "llviewercontrol.h"
+#include "llglheaders.h"
+#include "llsphere.h"
+#include "llvoicevisualizer.h"
+#include "llviewercamera.h"
+#include "llviewerobject.h"
+#include "llviewertexture.h"
+#include "llviewertexturelist.h"
+#include "llvoiceclient.h"
+#include "llrender.h"
+
+//brent's wave image
+//29de489d-0491-fb00-7dab-f9e686d31e83
+
+
+#ifdef XXX_STINSON_CHUI_REWORK
+//--------------------------------------------------------------------------------------
+// sound symbol constants
+//--------------------------------------------------------------------------------------
+const F32 HEIGHT_ABOVE_HEAD = 0.3f; // how many meters vertically above the av's head the voice symbol will appear
+const F32 RED_THRESHOLD = LLVoiceClient::OVERDRIVEN_POWER_LEVEL; // value above which speaking amplitude causes the voice symbol to turn red
+const F32 GREEN_THRESHOLD = 0.2f; // value above which speaking amplitude causes the voice symbol to turn green
+const F32 FADE_OUT_DURATION = 0.4f; // how many seconds it takes for a pair of waves to fade away
+const F32 EXPANSION_RATE = 1.0f; // how many seconds it takes for the waves to expand to twice their original size
+const F32 EXPANSION_MAX = 1.5f; // maximum size scale to which the waves can expand before popping back to 1.0
+const F32 WAVE_WIDTH_SCALE = 0.03f; // base width of the waves
+const F32 WAVE_HEIGHT_SCALE = 0.02f; // base height of the waves
+const F32 BASE_BRIGHTNESS = 0.7f; // gray level of the voice indicator when quiet (below green threshold)
+const F32 DOT_SIZE = 0.05f; // size of the dot billboard texture
+const F32 DOT_OPACITY = 0.7f; // how opaque the dot is
+const F32 WAVE_MOTION_RATE = 1.5f; // scalar applied to consecutive waves as a function of speaking amplitude
+#endif // XXX_STINSON_CHUI_REWORK
+
+//--------------------------------------------------------------------------------------
+// gesticulation constants
+//--------------------------------------------------------------------------------------
+const F32 DEFAULT_MINIMUM_GESTICULATION_AMPLITUDE = 0.2f;
+const F32 DEFAULT_MAXIMUM_GESTICULATION_AMPLITUDE = 1.0f;
+
+#ifdef XXX_STINSON_CHUI_REWORK
+//--------------------------------------------------------------------------------------
+// other constants
+//--------------------------------------------------------------------------------------
+const F32 ONE_HALF = 1.0f; // to clarify intent and reduce magic numbers in the code.
+const LLVector3 WORLD_UPWARD_DIRECTION = LLVector3( 0.0f, 0.0f, 1.0f ); // Z is up in SL
+#endif // XXX_STINSON_CHUI_REWORK
+
+//------------------------------------------------------------------
+// Initialize the statics
+//------------------------------------------------------------------
+bool LLVoiceVisualizer::sPrefsInitialized = false;
+BOOL LLVoiceVisualizer::sLipSyncEnabled = FALSE;
+F32* LLVoiceVisualizer::sOoh = NULL;
+F32* LLVoiceVisualizer::sAah = NULL;
+U32 LLVoiceVisualizer::sOohs = 0;
+U32 LLVoiceVisualizer::sAahs = 0;
+F32 LLVoiceVisualizer::sOohAahRate = 0.0f;
+F32* LLVoiceVisualizer::sOohPowerTransfer = NULL;
+U32 LLVoiceVisualizer::sOohPowerTransfers = 0;
+F32 LLVoiceVisualizer::sOohPowerTransfersf = 0.0f;
+F32* LLVoiceVisualizer::sAahPowerTransfer = NULL;
+U32 LLVoiceVisualizer::sAahPowerTransfers = 0;
+F32 LLVoiceVisualizer::sAahPowerTransfersf = 0.0f;
+
+
+//-----------------------------------------------
+// constructor
+//-----------------------------------------------
+#ifdef XXX_STINSON_CHUI_REWORK
+LLVoiceVisualizer::LLVoiceVisualizer( const U8 type )
+ : LLHUDEffect(type)
+#else // XXX_STINSON_CHUI_REWORK
+LLVoiceVisualizer::LLVoiceVisualizer()
+ : LLRefCount(),
+ mTimer(),
+ mStartTime(0.0),
+ mCurrentlySpeaking(false),
+ mSpeakingAmplitude(0.0f),
+ mMaxGesticulationAmplitude(DEFAULT_MAXIMUM_GESTICULATION_AMPLITUDE),
+ mMinGesticulationAmplitude(DEFAULT_MINIMUM_GESTICULATION_AMPLITUDE)
+#endif // XXX_STINSON_CHUI_REWORK
+{
+#ifdef XXX_STINSON_CHUI_REWORK
+ mCurrentTime = mTimer.getTotalSeconds();
+ mPreviousTime = mCurrentTime;
+ mStartTime = mCurrentTime;
+#else // XXX_STINSON_CHUI_REWORK
+ mStartTime = mTimer.getTotalSeconds();
+#endif // XXX_STINSON_CHUI_REWORK
+#ifdef XXX_STINSON_CHUI_REWORK
+ mVoiceSourceWorldPosition = LLVector3( 0.0f, 0.0f, 0.0f );
+ mSpeakingAmplitude = 0.0f;
+ mCurrentlySpeaking = false;
+ mVoiceEnabled = false;
+ mMinGesticulationAmplitude = DEFAULT_MINIMUM_GESTICULATION_AMPLITUDE;
+ mMaxGesticulationAmplitude = DEFAULT_MAXIMUM_GESTICULATION_AMPLITUDE;
+ mSoundSymbol.mActive = true;
+ mSoundSymbol.mPosition = LLVector3( 0.0f, 0.0f, 0.0f );
+#endif // XXX_STINSON_CHUI_REWORK
+
+ mTimer.reset();
+
+#ifdef XXX_STINSON_CHUI_REWORK
+ const char* sound_level_img[] =
+ {
+ "voice_meter_dot.j2c",
+ "voice_meter_rings.j2c",
+ "voice_meter_rings.j2c",
+ "voice_meter_rings.j2c",
+ "voice_meter_rings.j2c",
+ "voice_meter_rings.j2c",
+ "voice_meter_rings.j2c"
+ };
+
+ for (int i=0; i<NUM_VOICE_SYMBOL_WAVES; i++)
+ {
+ mSoundSymbol.mWaveFadeOutStartTime [i] = mCurrentTime;
+ mSoundSymbol.mTexture [i] = LLViewerTextureManager::getFetchedTextureFromFile(sound_level_img[i], FALSE, LLViewerTexture::BOOST_UI);
+ mSoundSymbol.mWaveActive [i] = false;
+ mSoundSymbol.mWaveOpacity [i] = 1.0f;
+ mSoundSymbol.mWaveExpansion [i] = 1.0f;
+ }
+
+ mSoundSymbol.mTexture[0]->setFilteringOption(LLTexUnit::TFO_ANISOTROPIC);
+#endif // XXX_STINSON_CHUI_REWORK
+
+ // The first instance loads the initial state from prefs.
+ if (!sPrefsInitialized)
+ {
+ setPreferences();
+
+ // Set up our listener to get updates on all prefs values we care about.
+ gSavedSettings.getControl("LipSyncEnabled")->getSignal()->connect(boost::bind(&LLVoiceVisualizer::handleVoiceVisualizerPrefsChanged, _2));
+ gSavedSettings.getControl("LipSyncOohAahRate")->getSignal()->connect(boost::bind(&LLVoiceVisualizer::handleVoiceVisualizerPrefsChanged, _2));
+ gSavedSettings.getControl("LipSyncOoh")->getSignal()->connect(boost::bind(&LLVoiceVisualizer::handleVoiceVisualizerPrefsChanged, _2));
+ gSavedSettings.getControl("LipSyncAah")->getSignal()->connect(boost::bind(&LLVoiceVisualizer::handleVoiceVisualizerPrefsChanged, _2));
+ gSavedSettings.getControl("LipSyncOohPowerTransfer")->getSignal()->connect(boost::bind(&LLVoiceVisualizer::handleVoiceVisualizerPrefsChanged, _2));
+ gSavedSettings.getControl("LipSyncAahPowerTransfer")->getSignal()->connect(boost::bind(&LLVoiceVisualizer::handleVoiceVisualizerPrefsChanged, _2));
+
+ sPrefsInitialized = true;
+ }
+
+}//---------------------------------------------------
+
+#ifdef XXX_STINSON_CHUI_REWORK
+//---------------------------------------------------
+void LLVoiceVisualizer::setMinGesticulationAmplitude( F32 m )
+{
+ mMinGesticulationAmplitude = m;
+
+}//---------------------------------------------------
+
+//---------------------------------------------------
+void LLVoiceVisualizer::setMaxGesticulationAmplitude( F32 m )
+{
+ mMaxGesticulationAmplitude = m;
+
+}//---------------------------------------------------
+
+//---------------------------------------------------
+void LLVoiceVisualizer::setVoiceEnabled( bool v )
+{
+ mVoiceEnabled = v;
+
+}//---------------------------------------------------
+#endif // XXX_STINSON_CHUI_REWORK
+
+//---------------------------------------------------
+void LLVoiceVisualizer::setStartSpeaking()
+{
+ mStartTime = mTimer.getTotalSeconds();
+ mCurrentlySpeaking = true;
+#ifdef XXX_STINSON_CHUI_REWORK
+ mSoundSymbol.mActive = true;
+#endif // XXX_STINSON_CHUI_REWORK
+
+}//---------------------------------------------------
+
+
+//---------------------------------------------------
+bool LLVoiceVisualizer::getCurrentlySpeaking()
+{
+ return mCurrentlySpeaking;
+
+}//---------------------------------------------------
+
+
+//---------------------------------------------------
+void LLVoiceVisualizer::setStopSpeaking()
+{
+ mCurrentlySpeaking = false;
+ mSpeakingAmplitude = 0.0f;
+
+}//---------------------------------------------------
+
+
+//---------------------------------------------------
+void LLVoiceVisualizer::setSpeakingAmplitude( F32 a )
+{
+ mSpeakingAmplitude = a;
+
+}//---------------------------------------------------
+
+//------------------------------------------------------------------
+// handles parameter updates
+//------------------------------------------------------------------
+bool LLVoiceVisualizer::handleVoiceVisualizerPrefsChanged(const LLSD& newvalue)
+{
+ // Note: Ignore the specific event value, we look up the ones we want
+ LLVoiceVisualizer::setPreferences();
+ return true;
+}
+
+//---------------------------------------------------
+void LLVoiceVisualizer::setPreferences( )
+{
+ sLipSyncEnabled = gSavedSettings.getBOOL("LipSyncEnabled");
+ sOohAahRate = gSavedSettings.getF32("LipSyncOohAahRate");
+
+ std::string oohString = gSavedSettings.getString("LipSyncOoh");
+ lipStringToF32s (oohString, sOoh, sOohs);
+
+ std::string aahString = gSavedSettings.getString("LipSyncAah");
+ lipStringToF32s (aahString, sAah, sAahs);
+
+ std::string oohPowerString = gSavedSettings.getString("LipSyncOohPowerTransfer");
+ lipStringToF32s (oohPowerString, sOohPowerTransfer, sOohPowerTransfers);
+ sOohPowerTransfersf = (F32) sOohPowerTransfers;
+
+ std::string aahPowerString = gSavedSettings.getString("LipSyncAahPowerTransfer");
+ lipStringToF32s (aahPowerString, sAahPowerTransfer, sAahPowerTransfers);
+ sAahPowerTransfersf = (F32) sAahPowerTransfers;
+
+}//---------------------------------------------------
+
+
+//---------------------------------------------------
+// convert a string of digits to an array of floats.
+// the result for each digit is the value of the
+// digit multiplied by 0.11
+//---------------------------------------------------
+void LLVoiceVisualizer::lipStringToF32s ( std::string& in_string, F32*& out_F32s, U32& count_F32s )
+{
+ delete[] out_F32s; // get rid of the current array
+
+ count_F32s = in_string.length();
+ if (count_F32s == 0)
+ {
+ // we don't like zero length arrays
+
+ count_F32s = 1;
+ out_F32s = new F32[1];
+ out_F32s[0] = 0.0f;
+ }
+ else
+ {
+ out_F32s = new F32[count_F32s];
+
+ for (U32 i=0; i<count_F32s; i++)
+ {
+ // we convert the characters 0 to 9 to their numeric value
+ // anything else we take the low order four bits with a ceiling of 9
+
+ U8 digit = in_string[i];
+ U8 four_bits = digit % 16;
+ if (four_bits > 9)
+ {
+ four_bits = 9;
+ }
+ out_F32s[i] = 0.11f * (F32) four_bits;
+ }
+ }
+
+}//---------------------------------------------------
+
+
+//--------------------------------------------------------------------------
+// find the amount to blend the ooh and aah mouth morphs
+//--------------------------------------------------------------------------
+void LLVoiceVisualizer::lipSyncOohAah( F32& ooh, F32& aah )
+{
+ if( ( sLipSyncEnabled == TRUE ) && mCurrentlySpeaking )
+ {
+ U32 transfer_index = (U32) (sOohPowerTransfersf * mSpeakingAmplitude);
+ if (transfer_index >= sOohPowerTransfers)
+ {
+ transfer_index = sOohPowerTransfers - 1;
+ }
+ F32 transfer_ooh = sOohPowerTransfer[transfer_index];
+
+ transfer_index = (U32) (sAahPowerTransfersf * mSpeakingAmplitude);
+ if (transfer_index >= sAahPowerTransfers)
+ {
+ transfer_index = sAahPowerTransfers - 1;
+ }
+ F32 transfer_aah = sAahPowerTransfer[transfer_index];
+
+ F64 current_time = mTimer.getTotalSeconds();
+ F64 elapsed_time = current_time - mStartTime;
+ U32 elapsed_frames = (U32) (elapsed_time * sOohAahRate);
+ U32 elapsed_oohs = elapsed_frames % sOohs;
+ U32 elapsed_aahs = elapsed_frames % sAahs;
+
+ ooh = transfer_ooh * sOoh[elapsed_oohs];
+ aah = transfer_aah * sAah[elapsed_aahs];
+
+ /*
+ llinfos << " elapsed frames " << elapsed_frames
+ << " ooh " << ooh
+ << " aah " << aah
+ << " transfer ooh" << transfer_ooh
+ << " transfer aah" << transfer_aah
+ << " start time " << mStartTime
+ << " current time " << current_time
+ << " elapsed time " << elapsed_time
+ << " elapsed oohs " << elapsed_oohs
+ << " elapsed aahs " << elapsed_aahs
+ << llendl;
+ */
+ }
+ else
+ {
+ ooh = 0.0f;
+ aah = 0.0f;
+ }
+
+}//---------------------------------------------------
+
+
+#ifdef XXX_STINSON_CHUI_REWORK
+//---------------------------------------------------
+// this method is inherited from HUD Effect
+//---------------------------------------------------
+void LLVoiceVisualizer::render()
+{
+ if ( ! mVoiceEnabled )
+ {
+ return;
+ }
+
+ if ( mSoundSymbol.mActive )
+ {
+ mPreviousTime = mCurrentTime;
+ mCurrentTime = mTimer.getTotalSeconds();
+
+ //---------------------------------------------------------------
+ // set the sound symbol position over the source (avatar's head)
+ //---------------------------------------------------------------
+ mSoundSymbol.mPosition = mVoiceSourceWorldPosition + WORLD_UPWARD_DIRECTION * HEIGHT_ABOVE_HEAD;
+
+ //---------------------------------------------------------------
+ // some gl state
+ //---------------------------------------------------------------
+ LLGLSPipelineAlpha alpha_blend;
+ LLGLDepthTest depth(GL_TRUE, GL_FALSE);
+
+ //-------------------------------------------------------------
+ // create coordinates of the geometry for the dot
+ //-------------------------------------------------------------
+ LLViewerCamera* camera = LLViewerCamera::getInstance();
+ LLVector3 l = camera->getLeftAxis() * DOT_SIZE;
+ LLVector3 u = camera->getUpAxis() * DOT_SIZE;
+
+ LLVector3 bottomLeft = mSoundSymbol.mPosition + l - u;
+ LLVector3 bottomRight = mSoundSymbol.mPosition - l - u;
+ LLVector3 topLeft = mSoundSymbol.mPosition + l + u;
+ LLVector3 topRight = mSoundSymbol.mPosition - l + u;
+
+ //-----------------------------
+ // bind texture 0 (the dot)
+ //-----------------------------
+ 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( 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( 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 );
+ gGL.end();
+
+
+
+ //--------------------------------------------------------------------------------------
+ // if currently speaking, trigger waves (1 through 6) based on speaking amplitude
+ //--------------------------------------------------------------------------------------
+ if ( mCurrentlySpeaking )
+ {
+ F32 min = 0.2f;
+ F32 max = 0.7f;
+ F32 fraction = ( mSpeakingAmplitude - min ) / ( max - min );
+
+ // in case mSpeakingAmplitude > max....
+ if ( fraction > 1.0f )
+ {
+ fraction = 1.0f;
+ }
+
+ S32 level = 1 + (int)( fraction * ( NUM_VOICE_SYMBOL_WAVES - 2 ) );
+
+ for (int i=0; i<level+1; i++)
+ {
+ mSoundSymbol.mWaveActive [i] = true;
+ mSoundSymbol.mWaveOpacity [i] = 1.0f;
+ mSoundSymbol.mWaveFadeOutStartTime [i] = mCurrentTime;
+ }
+
+ } // if currently speaking
+
+ //---------------------------------------------------
+ // determine color
+ //---------------------------------------------------
+ F32 red = 0.0f;
+ F32 green = 0.0f;
+ F32 blue = 0.0f;
+ if ( mSpeakingAmplitude < RED_THRESHOLD )
+ {
+ if ( mSpeakingAmplitude < GREEN_THRESHOLD )
+ {
+ red = BASE_BRIGHTNESS;
+ green = BASE_BRIGHTNESS;
+ blue = BASE_BRIGHTNESS;
+ }
+ else
+ {
+ //---------------------------------------------------
+ // fade from gray to bright green
+ //---------------------------------------------------
+ F32 fraction = ( mSpeakingAmplitude - GREEN_THRESHOLD ) / ( 1.0f - GREEN_THRESHOLD );
+ red = BASE_BRIGHTNESS - ( fraction * BASE_BRIGHTNESS );
+ green = BASE_BRIGHTNESS + fraction * ( 1.0f - BASE_BRIGHTNESS );
+ blue = BASE_BRIGHTNESS - ( fraction * BASE_BRIGHTNESS );
+ }
+ }
+ else
+ {
+ //---------------------------------------------------
+ // redish
+ //---------------------------------------------------
+ red = 1.0f;
+ green = 0.2f;
+ blue = 0.2f;
+ }
+
+ for (int i=0; i<NUM_VOICE_SYMBOL_WAVES; i++)
+ {
+ if ( mSoundSymbol.mWaveActive[i] )
+ {
+ F32 fadeOutFraction = (F32)( mCurrentTime - mSoundSymbol.mWaveFadeOutStartTime[i] ) / FADE_OUT_DURATION;
+
+ mSoundSymbol.mWaveOpacity[i] = 1.0f - fadeOutFraction;
+
+ if ( mSoundSymbol.mWaveOpacity[i] < 0.0f )
+ {
+ mSoundSymbol.mWaveFadeOutStartTime [i] = mCurrentTime;
+ mSoundSymbol.mWaveOpacity [i] = 0.0f;
+ mSoundSymbol.mWaveActive [i] = false;
+ }
+
+ //----------------------------------------------------------------------------------
+ // This is where we calculate the expansion of the waves - that is, the
+ // rate at which they are scaled greater than 1.0 so that they grow over time.
+ //----------------------------------------------------------------------------------
+ F32 timeSlice = (F32)( mCurrentTime - mPreviousTime );
+ F32 waveSpeed = mSpeakingAmplitude * WAVE_MOTION_RATE;
+ mSoundSymbol.mWaveExpansion[i] *= ( 1.0f + EXPANSION_RATE * timeSlice * waveSpeed );
+
+ if ( mSoundSymbol.mWaveExpansion[i] > EXPANSION_MAX )
+ {
+ mSoundSymbol.mWaveExpansion[i] = 1.0f;
+ }
+
+ //----------------------------------------------------------------------------------
+ // create geometry for the wave billboard textures
+ //----------------------------------------------------------------------------------
+ F32 width = i * WAVE_WIDTH_SCALE * mSoundSymbol.mWaveExpansion[i];
+ F32 height = i * WAVE_HEIGHT_SCALE * mSoundSymbol.mWaveExpansion[i];
+
+ LLVector3 l = camera->getLeftAxis() * width;
+ LLVector3 u = camera->getUpAxis() * height;
+
+ LLVector3 bottomLeft = mSoundSymbol.mPosition + l - u;
+ LLVector3 bottomRight = mSoundSymbol.mPosition - l - u;
+ LLVector3 topLeft = mSoundSymbol.mPosition + l + u;
+ LLVector3 topRight = mSoundSymbol.mPosition - l + u;
+
+ gGL.color4fv( LLColor4( red, green, blue, mSoundSymbol.mWaveOpacity[i] ).mV );
+ gGL.getTexUnit(0)->bind(mSoundSymbol.mTexture[i]);
+
+
+ //---------------------------------------------------
+ // now, render the mofo
+ //---------------------------------------------------
+ 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( 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 );
+ gGL.end();
+
+ } //if ( mSoundSymbol.mWaveActive[i] )
+
+ }// for loop
+
+ }//if ( mSoundSymbol.mActive )
+
+}//---------------------------------------------------
+
+//---------------------------------------------------
+void LLVoiceVisualizer::setVoiceSourceWorldPosition( const LLVector3 &p )
+{
+ mVoiceSourceWorldPosition = p;
+
+}//---------------------------------------------------
+#endif // XXX_STINSON_CHUI_REWORK
+
+//---------------------------------------------------
+VoiceGesticulationLevel LLVoiceVisualizer::getCurrentGesticulationLevel()
+{
+ VoiceGesticulationLevel gesticulationLevel = VOICE_GESTICULATION_LEVEL_OFF; //default
+
+ //-----------------------------------------------------------------------------------------
+ // Within the range of gesticulation amplitudes, the sound signal is split into
+ // three equal amplitude regimes, each specifying one of three gesticulation levels.
+ //-----------------------------------------------------------------------------------------
+ F32 range = mMaxGesticulationAmplitude - mMinGesticulationAmplitude;
+
+ 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;
+
+}//---------------------------------------------------
+
+
+
+//------------------------------------
+// Destructor
+//------------------------------------
+LLVoiceVisualizer::~LLVoiceVisualizer()
+{
+}//----------------------------------------------
+
+
+#ifdef XXX_STINSON_CHUI_REWORK
+//---------------------------------------------------
+// "packData" is inherited from HUDEffect
+//---------------------------------------------------
+void LLVoiceVisualizer::packData(LLMessageSystem *mesgsys)
+{
+ // Pack the default data
+ LLHUDEffect::packData(mesgsys);
+
+ // TODO -- pack the relevant data for voice effects
+ // we'll come up with some cool configurations....TBD
+ //U8 packed_data[41];
+ //mesgsys->addBinaryDataFast(_PREHASH_TypeData, packed_data, 41);
+ U8 packed_data = 0;
+ mesgsys->addBinaryDataFast(_PREHASH_TypeData, &packed_data, 1);
+}
+
+
+//---------------------------------------------------
+// "unpackData" is inherited from HUDEffect
+//---------------------------------------------------
+void LLVoiceVisualizer::unpackData(LLMessageSystem *mesgsys, S32 blocknum)
+{
+ // TODO -- find the speaker, unpack binary data, set the properties of this effect
+ /*
+ LLHUDEffect::unpackData(mesgsys, blocknum);
+ LLUUID source_id;
+ LLUUID target_id;
+ S32 size = mesgsys->getSizeFast(_PREHASH_Effect, blocknum, _PREHASH_TypeData);
+ if (size != 1)
+ {
+ llwarns << "Voice effect with bad size " << size << llendl;
+ return;
+ }
+ mesgsys->getBinaryDataFast(_PREHASH_Effect, _PREHASH_TypeData, packed_data, 1, blocknum);
+ */
+}
+
+
+//------------------------------------------------------------------
+// this method is inherited from HUD Effect
+//------------------------------------------------------------------
+void LLVoiceVisualizer::markDead()
+{
+ mCurrentlySpeaking = false;
+ mVoiceEnabled = false;
+ mSoundSymbol.mActive = false;
+
+ LLHUDEffect::markDead();
+}//------------------------------------------------------------------
+
+#endif // XXX_STINSON_CHUI_REWORK
diff --git a/indra/newview/llvoicevisualizer.h b/indra/newview/llvoicevisualizer.h
index 6258de163d..5da592c48e 100644
--- a/indra/newview/llvoicevisualizer.h
+++ b/indra/newview/llvoicevisualizer.h
@@ -42,6 +42,7 @@
#ifndef LL_VOICE_VISUALIZER_H
#define LL_VOICE_VISUALIZER_H
+#define XXX_STINSON_CHUI_REWORK // temporarily re-enabling the in-world voice-dot
#ifdef XXX_STINSON_CHUI_REWORK
#include "llhudeffect.h"
#else // XXX_STINSON_CHUI_REWORK
diff --git a/indra/newview/llvopartgroup.cpp b/indra/newview/llvopartgroup.cpp
index e21358b65a..a2794bec56 100644
--- a/indra/newview/llvopartgroup.cpp
+++ b/indra/newview/llvopartgroup.cpp
@@ -149,8 +149,8 @@ bool ll_is_part_idx_allocated(S32 idx, S32* start, S32* end)
void LLVOPartGroup::freeVBSlot(S32 idx)
{
llassert(idx < LL_MAX_PARTICLE_COUNT && idx >= 0);
- llassert(sVBSlotCursor > sVBSlotFree);
- llassert(ll_is_part_idx_allocated(idx, sVBSlotCursor, sVBSlotFree+LL_MAX_PARTICLE_COUNT));
+ //llassert(sVBSlotCursor > sVBSlotFree);
+ //llassert(ll_is_part_idx_allocated(idx, sVBSlotCursor, sVBSlotFree+LL_MAX_PARTICLE_COUNT));
if (sVBSlotCursor > sVBSlotFree)
{
diff --git a/indra/newview/skins/default/xui/en/panel_landmarks.xml b/indra/newview/skins/default/xui/en/panel_landmarks.xml
index 39805637a0..ebd4c6a805 100644
--- a/indra/newview/skins/default/xui/en/panel_landmarks.xml
+++ b/indra/newview/skins/default/xui/en/panel_landmarks.xml
@@ -35,6 +35,7 @@
left="0"
mouse_opaque="true"
name="favorites_list"
+ scroll.hide_scrollbar="true"
start_folder.name="Favorites"
width="307"/>
</accordion_tab>
@@ -51,6 +52,7 @@
left="0"
mouse_opaque="true"
name="landmarks_list"
+ scroll.hide_scrollbar="true"
start_folder.name="Landmarks"
width="307"/>
</accordion_tab>
@@ -67,6 +69,7 @@
left="0"
mouse_opaque="true"
name="my_inventory_list"
+ scroll.hide_scrollbar="true"
start_folder.name="My Inventory"
width="307"/>
</accordion_tab>
@@ -83,6 +86,7 @@
left="0"
mouse_opaque="true"
name="library_list"
+ scroll.hide_scrollbar="true"
start_folder.name="LIBRARY"
width="313"/>
</accordion_tab>