diff --git a/indra/aistatemachine/CMakeLists.txt b/indra/aistatemachine/CMakeLists.txt
index 6db29a007..806261201 100644
--- a/indra/aistatemachine/CMakeLists.txt
+++ b/indra/aistatemachine/CMakeLists.txt
@@ -21,6 +21,7 @@ set(aistatemachine_SOURCE_FILES
aistatemachine.cpp
aistatemachinethread.cpp
aitimer.cpp
+ aicondition.cpp
)
set(aistatemachine_HEADER_FILES
@@ -29,6 +30,7 @@ set(aistatemachine_HEADER_FILES
aistatemachine.h
aistatemachinethread.h
aitimer.h
+ aicondition.h
)
set_source_files_properties(${aistatemachine_HEADER_FILES}
diff --git a/indra/aistatemachine/aicondition.cpp b/indra/aistatemachine/aicondition.cpp
new file mode 100644
index 000000000..2c9a4f8e8
--- /dev/null
+++ b/indra/aistatemachine/aicondition.cpp
@@ -0,0 +1,89 @@
+/**
+ * @file aicondition.cpp
+ * @brief Implementation of AICondition
+ *
+ * Copyright (c) 2013, Aleric Inglewood.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ *
+ * 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.
+ *
+ * CHANGELOG
+ * and additional copyright holders.
+ *
+ * 14/10/2013
+ * Initial version, written by Aleric Inglewood @ SL
+ */
+
+#include "sys.h"
+#include "aicondition.h"
+#include "aistatemachine.h"
+
+void AIConditionBase::wait(AIStateMachine* state_machine)
+{
+ // The condition must be locked before calling AIStateMachine::wait().
+ llassert(mutex().isSelfLocked());
+ // Add the new state machine at the end.
+ mWaitingStateMachines.push_back(state_machine);
+}
+
+void AIConditionBase::remove(AIStateMachine* state_machine)
+{
+ mutex().lock();
+ // Remove all occurances of state_machine from the queue.
+ queue_t::iterator const end = mWaitingStateMachines.end();
+ queue_t::iterator last = end;
+ for (queue_t::iterator iter = mWaitingStateMachines.begin(); iter != last; ++iter)
+ {
+ if (iter->get() == state_machine)
+ {
+ if (--last == iter)
+ {
+ break;
+ }
+ queue_t::value_type::swap(*iter, *last);
+ }
+ }
+ // This invalidates all iterators involved, including end, but not any iterators to the remaining elements.
+ mWaitingStateMachines.erase(last, end);
+ mutex().unlock();
+}
+
+void AIConditionBase::signal(int n)
+{
+ // The condition must be locked before calling AICondition::signal or AICondition::broadcast.
+ llassert(mutex().isSelfLocked());
+ // Signal n state machines.
+ while (n > 0 && !mWaitingStateMachines.empty())
+ {
+ LLPointer state_machine = mWaitingStateMachines.front();
+ bool success = state_machine->signalled();
+ // Only state machines that are actually still blocked should be in the queue:
+ // they are removed from the queue by calling AICondition::remove whenever
+ // they are unblocked for whatever reason...
+ llassert(success);
+ if (success)
+ {
+ ++n;
+ }
+ else
+ {
+ // We never get here...
+ remove(state_machine.get());
+ }
+ }
+}
+
diff --git a/indra/aistatemachine/aicondition.h b/indra/aistatemachine/aicondition.h
new file mode 100644
index 000000000..05dd9ea42
--- /dev/null
+++ b/indra/aistatemachine/aicondition.h
@@ -0,0 +1,110 @@
+/**
+ * @file aicondition.h
+ * @brief Condition variable for statemachines.
+ *
+ * Copyright (c) 2013, Aleric Inglewood.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ *
+ * 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.
+ *
+ * CHANGELOG
+ * and additional copyright holders.
+ *
+ * 14/10/2013
+ * Initial version, written by Aleric Inglewood @ SL
+ */
+
+#ifndef AICONDITION_H
+#define AICONDITION_H
+
+#include
+#include
+#include "aithreadsafe.h"
+
+class AIStateMachine;
+class LLMutex;
+
+// class AICondition
+//
+// Call AIStateMachine::wait(AICondition&) in the multiplex_impl of a state machine to
+// make the state machine go idle until some thread calls AICondition::signal().
+//
+// If the state machine is no longer running or wasn't waiting anymore because
+// something else woke it up, then AICondition::signal() will wake up another
+// state machine (if any).
+//
+// Usage:
+//
+// struct Foo { bool met(); }; // Returns true when the condition is met.
+// AICondition Condition_t;
+// AIAccess Condition_wat;
+//
+// // Some thread-safe condition variable.
+// Condition_t condition;
+//
+// // Inside the state machine:
+// {
+// ...
+// state WAIT_FOR_CONDITION:
+// {
+// // Lock condition and check it. Wait if condition is not met yet.
+// {
+// Condition_wat condition_w(condition);
+// if (!condition_w->met())
+// {
+// wait(condition);
+// break;
+// }
+// }
+// set_state(CONDITION_MET);
+// break;
+// }
+// CONDITION_MET:
+// {
+//
+
+class AIConditionBase
+{
+ public:
+ virtual ~AIConditionBase() { }
+
+ void signal(int n = 1); // Call this when the condition was met to release n state machines.
+ void broadcast(void) { signal(mWaitingStateMachines.size()); } // Release all blocked state machines.
+
+ private:
+ // These functions are called by AIStateMachine.
+ friend class AIStateMachine;
+ void wait(AIStateMachine* state_machine);
+ void remove(AIStateMachine* state_machine);
+
+ protected:
+ virtual LLMutex& mutex(void) = 0;
+
+ protected:
+ typedef std::deque > queue_t;
+ queue_t mWaitingStateMachines;
+};
+
+template
+class AICondition : public AIThreadSafeSimpleDC, public AIConditionBase
+{
+ protected:
+ /*virtual*/ LLMutex& mutex(void) { return this->mMutex; }
+};
+
+#endif
+
diff --git a/indra/aistatemachine/aistatemachine.cpp b/indra/aistatemachine/aistatemachine.cpp
index bf867fffd..fcdb2d9c8 100644
--- a/indra/aistatemachine/aistatemachine.cpp
+++ b/indra/aistatemachine/aistatemachine.cpp
@@ -33,6 +33,7 @@
#include "linden_common.h"
#include "aistatemachine.h"
+#include "aicondition.h"
#include "lltimer.h"
//==================================================================
@@ -283,7 +284,7 @@ char const* HelloWorld::state_str_impl(state_type run_state) const
void AIEngine::add(AIStateMachine* state_machine)
{
- Dout(dc::statemachine, "Adding state machine [" << (void*)state_machine << "] to " << mName);
+ Dout(dc::statemachine(state_machine->mSMDebug), "Adding state machine [" << (void*)state_machine << "] to " << mName);
engine_state_type_wat engine_state_w(mEngineState);
engine_state_w->list.push_back(QueueElement(state_machine));
if (engine_state_w->waiting)
@@ -330,7 +331,7 @@ void AIEngine::mainloop(void)
engine_state_type_wat engine_state_w(mEngineState);
if (!active)
{
- Dout(dc::statemachine, "Erasing state machine [" << (void*)&state_machine << "] from " << mName);
+ Dout(dc::statemachine(state_machine.mSMDebug), "Erasing state machine [" << (void*)&state_machine << "] from " << mName);
engine_state_w->list.erase(queued_element++);
}
else
@@ -392,7 +393,7 @@ void AIStateMachine::multiplex(event_type event)
// If this fails then you are using a pointer to a state machine instead of an LLPointer.
llassert(event == initial_run || getNumRefs() > 0);
- DoutEntering(dc::statemachine, "AIStateMachine::multiplex(" << event_str(event) << ") [" << (void*)this << "]");
+ DoutEntering(dc::statemachine(mSMDebug), "AIStateMachine::multiplex(" << event_str(event) << ") [" << (void*)this << "]");
base_state_type state;
state_type run_state;
@@ -407,7 +408,7 @@ void AIStateMachine::multiplex(event_type event)
llassert(!mMultiplexMutex.isSelfLocked()); // We may never enter recursively!
if (!mMultiplexMutex.tryLock())
{
- Dout(dc::statemachine, "Leaving because it is already being run [" << (void*)this << "]");
+ Dout(dc::statemachine(mSMDebug), "Leaving because it is already being run [" << (void*)this << "]");
return;
}
@@ -421,7 +422,7 @@ void AIStateMachine::multiplex(event_type event)
// we should indeed run, again.
if (event == schedule_run && !sub_state_type_rat(mSubState)->need_run)
{
- Dout(dc::statemachine, "Leaving because it was already being run [" << (void*)this << "]");
+ Dout(dc::statemachine(mSMDebug), "Leaving because it was already being run [" << (void*)this << "]");
return;
}
@@ -440,9 +441,9 @@ void AIStateMachine::multiplex(event_type event)
{
#ifdef CWDEBUG
if (state == bs_multiplex)
- Dout(dc::statemachine, "Running state bs_multiplex / " << state_str_impl(run_state) << " [" << (void*)this << "]");
+ Dout(dc::statemachine(mSMDebug), "Running state bs_multiplex / " << state_str_impl(run_state) << " [" << (void*)this << "]");
else
- Dout(dc::statemachine, "Running state " << state_str(state) << " [" << (void*)this << "]");
+ Dout(dc::statemachine(mSMDebug), "Running state " << state_str(state) << " [" << (void*)this << "]");
#endif
#ifdef SHOW_ASSERT
@@ -503,7 +504,7 @@ void AIStateMachine::multiplex(event_type event)
// run of bs_reset is not a problem because it happens to be a NoOp.
state = (state == bs_initialize) ? bs_reset : bs_abort;
#ifdef CWDEBUG
- Dout(dc::statemachine, "Late abort detected! Running state " << state_str(state) << " instead [" << (void*)this << "]");
+ Dout(dc::statemachine(mSMDebug), "Late abort detected! Running state " << state_str(state) << " instead [" << (void*)this << "]");
#endif
}
#ifdef SHOW_ASSERT
@@ -665,7 +666,7 @@ void AIStateMachine::multiplex(event_type event)
#ifdef CWDEBUG
if (state != state_w->base_state)
- Dout(dc::statemachine, "Base state changed from " << state_str(state) << " to " << state_str(state_w->base_state) <<
+ Dout(dc::statemachine(mSMDebug), "Base state changed from " << state_str(state) << " to " << state_str(state_w->base_state) <<
"; need_new_run = " << (need_new_run ? "true" : "false") << " [" << (void*)this << "]");
#endif
}
@@ -699,11 +700,15 @@ void AIStateMachine::multiplex(event_type event)
// Mark that we're added to this engine, and at the same time, that we're not added to the previous one.
state_w->current_engine = engine;
}
+#ifdef SHOW_ASSERT
+ // We are leaving the loop, but we're not idle. The statemachine should re-enter the loop again.
+ mDebugShouldRun = true;
+#endif
}
else
{
- // Remove this state machine from any engine.
- // Cause the engine to remove us.
+ // Remove this state machine from any engine,
+ // causing the engine to remove us.
state_w->current_engine = NULL;
}
@@ -749,7 +754,7 @@ void AIStateMachine::multiplex(event_type event)
AIStateMachine::state_type AIStateMachine::begin_loop(base_state_type base_state)
{
- DoutEntering(dc::statemachine, "AIStateMachine::begin_loop(" << state_str(base_state) << ") [" << (void*)this << "]");
+ DoutEntering(dc::statemachine(mSMDebug), "AIStateMachine::begin_loop(" << state_str(base_state) << ") [" << (void*)this << "]");
sub_state_type_wat sub_state_w(mSubState);
// Honor a subsequent call to idle() (only necessary in bs_multiplex, but it doesn't hurt to reset this flag in other states too).
@@ -759,7 +764,7 @@ AIStateMachine::state_type AIStateMachine::begin_loop(base_state_type base_state
// Honor previous calls to advance_state() (once run_state is initialized).
if (base_state == bs_multiplex && sub_state_w->advance_state > sub_state_w->run_state)
{
- Dout(dc::statemachine, "Copying advance_state to run_state, because it is larger [" << state_str_impl(sub_state_w->advance_state) << " > " << state_str_impl(sub_state_w->run_state) << "]");
+ Dout(dc::statemachine(mSMDebug), "Copying advance_state to run_state, because it is larger [" << state_str_impl(sub_state_w->advance_state) << " > " << state_str_impl(sub_state_w->run_state) << "]");
sub_state_w->run_state = sub_state_w->advance_state;
}
#ifdef SHOW_ASSERT
@@ -789,7 +794,7 @@ AIStateMachine::state_type AIStateMachine::begin_loop(base_state_type base_state
void AIStateMachine::run(AIStateMachine* parent, state_type new_parent_state, bool abort_parent, bool on_abort_signal_parent, AIEngine* default_engine)
{
- DoutEntering(dc::statemachine, "AIStateMachine::run(" <<
+ DoutEntering(dc::statemachine(mSMDebug), "AIStateMachine::run(" <<
(void*)parent << ", " <<
(parent ? parent->state_str_impl(new_parent_state) : "NA") <<
", abort_parent = " << (abort_parent ? "true" : "false") <<
@@ -839,7 +844,7 @@ void AIStateMachine::run(AIStateMachine* parent, state_type new_parent_state, bo
void AIStateMachine::run(callback_type::signal_type::slot_type const& slot, AIEngine* default_engine)
{
- DoutEntering(dc::statemachine, "AIStateMachine::run(, default_engine = " << default_engine->name() << ") [" << (void*)this << "]");
+ DoutEntering(dc::statemachine(mSMDebug), "AIStateMachine::run(, default_engine = " << default_engine->name() << ") [" << (void*)this << "]");
#ifdef SHOW_ASSERT
{
@@ -874,7 +879,7 @@ void AIStateMachine::run(callback_type::signal_type::slot_type const& slot, AIEn
void AIStateMachine::callback(void)
{
- DoutEntering(dc::statemachine, "AIStateMachine::callback() [" << (void*)this << "]");
+ DoutEntering(dc::statemachine(mSMDebug), "AIStateMachine::callback() [" << (void*)this << "]");
bool aborted = sub_state_type_rat(mSubState)->aborted;
if (mParent)
@@ -920,7 +925,7 @@ void AIStateMachine::force_killed(void)
void AIStateMachine::kill(void)
{
- DoutEntering(dc::statemachine, "AIStateMachine::kill() [" << (void*)this << "]");
+ DoutEntering(dc::statemachine(mSMDebug), "AIStateMachine::kill() [" << (void*)this << "]");
#ifdef SHOW_ASSERT
{
multiplex_state_type_rat state_r(mState);
@@ -937,7 +942,7 @@ void AIStateMachine::kill(void)
void AIStateMachine::reset()
{
- DoutEntering(dc::statemachine, "AIStateMachine::reset() [" << (void*)this << "]");
+ DoutEntering(dc::statemachine(mSMDebug), "AIStateMachine::reset() [" << (void*)this << "]");
#ifdef SHOW_ASSERT
mDebugAborted = false;
mDebugContPending = false;
@@ -960,6 +965,8 @@ void AIStateMachine::reset()
sub_state_w->reset = true;
// Start running.
sub_state_w->idle = false;
+ // We're not waiting for a condition.
+ sub_state_w->blocked = NULL;
// Keep running till we reach at least bs_multiplex.
sub_state_w->need_run = true;
}
@@ -972,7 +979,7 @@ void AIStateMachine::reset()
void AIStateMachine::set_state(state_type new_state)
{
- DoutEntering(dc::statemachine, "AIStateMachine::set_state(" << state_str_impl(new_state) << ") [" << (void*)this << "]");
+ DoutEntering(dc::statemachine(mSMDebug), "AIStateMachine::set_state(" << state_str_impl(new_state) << ") [" << (void*)this << "]");
#ifdef SHOW_ASSERT
{
multiplex_state_type_rat state_r(mState);
@@ -983,6 +990,8 @@ void AIStateMachine::set_state(state_type new_state)
}
#endif
sub_state_type_wat sub_state_w(mSubState);
+ // It should never happen that set_state() is called while we're blocked.
+ llassert(!sub_state_w->blocked);
// Force current state to the requested state.
sub_state_w->run_state = new_state;
// Void last call to advance_state.
@@ -999,13 +1008,13 @@ void AIStateMachine::set_state(state_type new_state)
void AIStateMachine::advance_state(state_type new_state)
{
- DoutEntering(dc::statemachine, "AIStateMachine::advance_state(" << state_str_impl(new_state) << ") [" << (void*)this << "]");
+ DoutEntering(dc::statemachine(mSMDebug), "AIStateMachine::advance_state(" << state_str_impl(new_state) << ") [" << (void*)this << "]");
{
sub_state_type_wat sub_state_w(mSubState);
// Ignore call to advance_state when the currently queued state is already greater or equal to the requested state.
if (sub_state_w->advance_state >= new_state)
{
- Dout(dc::statemachine, "Ignored, because " << state_str_impl(sub_state_w->advance_state) << " >= " << state_str_impl(new_state) << ".");
+ Dout(dc::statemachine(mSMDebug), "Ignored, because " << state_str_impl(sub_state_w->advance_state) << " >= " << state_str_impl(new_state) << ".");
return;
}
// Ignore call to advance_state when the current state is greater than the requested state: the new state would be
@@ -1014,7 +1023,7 @@ void AIStateMachine::advance_state(state_type new_state)
// the state change is and should be being ignored: the statemachine would start running it's current state (again).
if (sub_state_w->run_state > new_state)
{
- Dout(dc::statemachine, "Ignored, because " << state_str_impl(sub_state_w->run_state) << " > " << state_str_impl(new_state) << " (current state).");
+ Dout(dc::statemachine(mSMDebug), "Ignored, because " << state_str_impl(sub_state_w->run_state) << " > " << state_str_impl(new_state) << " (current state).");
return;
}
// Increment state.
@@ -1023,6 +1032,13 @@ void AIStateMachine::advance_state(state_type new_state)
sub_state_w->idle = false;
// Ignore a call to idle if it occurs before we leave multiplex_impl().
sub_state_w->skip_idle = true;
+ // No longer say we woke up when signalled() is called.
+ if (sub_state_w->blocked)
+ {
+ Dout(dc::statemachine(mSMDebug), "Removing statemachine from condition " << (void*)sub_state_w->blocked);
+ sub_state_w->blocked->remove(this);
+ sub_state_w->blocked = NULL;
+ }
// Mark that a re-entry of multiplex() is necessary.
sub_state_w->need_run = true;
#ifdef SHOW_ASSERT
@@ -1048,7 +1064,7 @@ void AIStateMachine::advance_state(state_type new_state)
void AIStateMachine::idle(void)
{
- DoutEntering(dc::statemachine, "AIStateMachine::idle() [" << (void*)this << "]");
+ DoutEntering(dc::statemachine(mSMDebug), "AIStateMachine::idle() [" << (void*)this << "]");
#ifdef SHOW_ASSERT
{
multiplex_state_type_rat state_r(mState);
@@ -1066,7 +1082,7 @@ void AIStateMachine::idle(void)
// Ignore call to idle() when advance_state() was called since last call to set_state().
if (sub_state_w->skip_idle)
{
- Dout(dc::statemachine, "Ignored, because skip_idle is true (advance_state() was called last).");
+ Dout(dc::statemachine(mSMDebug), "Ignored, because skip_idle is true (advance_state() was called last).");
return;
}
// Mark that we are idle.
@@ -1075,13 +1091,54 @@ void AIStateMachine::idle(void)
mSleep = 0;
}
+// This function is very much like idle().
+void AIStateMachine::wait(AIConditionBase& condition)
+{
+ DoutEntering(dc::statemachine(mSMDebug), "AIStateMachine::wait(" << (void*)&condition << ") [" << (void*)this << "]");
+#ifdef SHOW_ASSERT
+ {
+ multiplex_state_type_rat state_r(mState);
+ // wait() may only be called multiplex_impl().
+ llassert(state_r->base_state == bs_multiplex);
+ // May only be called by the thread that is holding mMultiplexMutex.
+ llassert(mThreadId.equals_current_thread());
+ }
+ // wait() following set_state() cancels the reason to run because of the call to set_state.
+ mDebugSetStatePending = false;
+#endif
+ sub_state_type_wat sub_state_w(mSubState);
+ // As wait() may only be called from within the state machine, it should never happen that the state machine is already idle.
+ llassert(!sub_state_w->idle);
+ // Ignore call to wait() when advance_state() was called since last call to set_state().
+ if (sub_state_w->skip_idle)
+ {
+ Dout(dc::statemachine(mSMDebug), "Ignored, because skip_idle is true (advance_state() was called last).");
+ return;
+ }
+ // Register ourselves with the condition object.
+ condition.wait(this);
+ // Mark that we are idle.
+ sub_state_w->idle = true;
+ // Mark that we are waiting for a condition.
+ sub_state_w->blocked = &condition;
+ // Not sleeping (anymore).
+ mSleep = 0;
+}
+
void AIStateMachine::cont(void)
{
- DoutEntering(dc::statemachine, "AIStateMachine::cont() [" << (void*)this << "]");
+ DoutEntering(dc::statemachine(mSMDebug), "AIStateMachine::cont() [" << (void*)this << "]");
{
sub_state_type_wat sub_state_w(mSubState);
// Void last call to idle(), if any.
sub_state_w->idle = false;
+ // No longer say we woke up when signalled() is called.
+ if (sub_state_w->blocked)
+ {
+ Dout(dc::statemachine(mSMDebug), "Removing statemachine from condition " << (void*)sub_state_w->blocked);
+ sub_state_w->blocked->remove(this);
+ sub_state_w->blocked = NULL;
+ }
// Mark that a re-entry of multiplex() is necessary.
sub_state_w->need_run = true;
#ifdef SHOW_ASSERT
@@ -1095,15 +1152,56 @@ void AIStateMachine::cont(void)
}
}
+// This function is very much like cont(), except that it has no effect when we are not in a blocked state.
+// Returns true if the state machine was unblocked, false if it was already unblocked.
+bool AIStateMachine::signalled(void)
+{
+ DoutEntering(dc::statemachine(mSMDebug), "AIStateMachine::signalled() [" << (void*)this << "]");
+ {
+ sub_state_type_wat sub_state_w(mSubState);
+ // Test if we are blocked or not.
+ if (sub_state_w->blocked)
+ {
+ Dout(dc::statemachine(mSMDebug), "Removing statemachine from condition " << (void*)sub_state_w->blocked);
+ sub_state_w->blocked->remove(this);
+ sub_state_w->blocked = NULL;
+ }
+ else
+ {
+ return false;
+ }
+ // Void last call to wait().
+ sub_state_w->idle = false;
+ // Mark that a re-entry of multiplex() is necessary.
+ sub_state_w->need_run = true;
+#ifdef SHOW_ASSERT
+ // From this moment.
+ mDebugContPending = true;
+#endif
+ }
+ if (!mMultiplexMutex.isSelfLocked())
+ {
+ multiplex(schedule_run);
+ }
+ return true;
+}
+
void AIStateMachine::abort(void)
{
- DoutEntering(dc::statemachine, "AIStateMachine::abort() [" << (void*)this << "]");
+ DoutEntering(dc::statemachine(mSMDebug), "AIStateMachine::abort() [" << (void*)this << "]");
bool is_waiting = false;
{
multiplex_state_type_rat state_r(mState);
sub_state_type_wat sub_state_w(mSubState);
// Mark that we are aborted, iff we didn't already finish.
sub_state_w->aborted = !sub_state_w->finished;
+ // No longer say we woke up when signalled() is called.
+ if (sub_state_w->blocked)
+ {
+ Dout(dc::statemachine(mSMDebug), "Removing statemachine from condition " << (void*)sub_state_w->blocked);
+ sub_state_w->blocked->remove(this);
+ sub_state_w->blocked = NULL;
+ }
// Mark that a re-entry of multiplex() is necessary.
sub_state_w->need_run = true;
// Schedule a new run when this state machine is waiting.
@@ -1128,7 +1226,7 @@ void AIStateMachine::abort(void)
void AIStateMachine::finish(void)
{
- DoutEntering(dc::statemachine, "AIStateMachine::finish() [" << (void*)this << "]");
+ DoutEntering(dc::statemachine(mSMDebug), "AIStateMachine::finish() [" << (void*)this << "]");
#ifdef SHOW_ASSERT
{
multiplex_state_type_rat state_r(mState);
@@ -1147,7 +1245,7 @@ void AIStateMachine::finish(void)
void AIStateMachine::yield(void)
{
- DoutEntering(dc::statemachine, "AIStateMachine::yield() [" << (void*)this << "]");
+ DoutEntering(dc::statemachine(mSMDebug), "AIStateMachine::yield() [" << (void*)this << "]");
multiplex_state_type_rat state_r(mState);
// yield() may only be called from multiplex_impl().
llassert(state_r->base_state == bs_multiplex);
@@ -1160,7 +1258,7 @@ void AIStateMachine::yield(void)
void AIStateMachine::yield(AIEngine* engine)
{
llassert(engine);
- DoutEntering(dc::statemachine, "AIStateMachine::yield(" << engine->name() << ") [" << (void*)this << "]");
+ DoutEntering(dc::statemachine(mSMDebug), "AIStateMachine::yield(" << engine->name() << ") [" << (void*)this << "]");
#ifdef SHOW_ASSERT
{
multiplex_state_type_rat state_r(mState);
@@ -1173,9 +1271,19 @@ void AIStateMachine::yield(AIEngine* engine)
mYieldEngine = engine;
}
+bool AIStateMachine::yield_if_not(AIEngine* engine)
+{
+ if (engine && multiplex_state_type_rat(mState)->current_engine != engine)
+ {
+ yield(engine);
+ return true;
+ }
+ return false;
+}
+
void AIStateMachine::yield_frame(unsigned int frames)
{
- DoutEntering(dc::statemachine, "AIStateMachine::yield_frame(" << frames << ") [" << (void*)this << "]");
+ DoutEntering(dc::statemachine(mSMDebug), "AIStateMachine::yield_frame(" << frames << ") [" << (void*)this << "]");
mSleep = -(S64)frames;
// Sleeping is always done from the main thread.
yield(&gMainThreadEngine);
@@ -1183,7 +1291,7 @@ void AIStateMachine::yield_frame(unsigned int frames)
void AIStateMachine::yield_ms(unsigned int ms)
{
- DoutEntering(dc::statemachine, "AIStateMachine::yield_ms(" << ms << ") [" << (void*)this << "]");
+ DoutEntering(dc::statemachine(mSMDebug), "AIStateMachine::yield_ms(" << ms << ") [" << (void*)this << "]");
mSleep = get_clock_count() + calc_clock_frequency() * ms / 1000;
// Sleeping is always done from the main thread.
yield(&gMainThreadEngine);
@@ -1233,7 +1341,7 @@ void AIEngine::threadloop(void)
engine_state_type_wat engine_state_w(mEngineState);
if (!active)
{
- Dout(dc::statemachine, "Erasing state machine [" << (void*)&state_machine << "] from " << mName);
+ Dout(dc::statemachine(state_machine.mSMDebug), "Erasing state machine [" << (void*)&state_machine << "] from " << mName);
engine_state_w->list.erase(queued_element++);
}
else
diff --git a/indra/aistatemachine/aistatemachine.h b/indra/aistatemachine/aistatemachine.h
index 2b019c91f..047fe0515 100644
--- a/indra/aistatemachine/aistatemachine.h
+++ b/indra/aistatemachine/aistatemachine.h
@@ -39,6 +39,7 @@
#include
#include
+class AIConditionBase;
class AIStateMachine;
class AIEngine
@@ -132,6 +133,7 @@ class AIStateMachine : public LLThreadSafeRefCount
struct sub_state_type {
state_type run_state;
state_type advance_state;
+ AIConditionBase* blocked;
bool reset;
bool need_run;
bool idle;
@@ -195,20 +197,36 @@ class AIStateMachine : public LLThreadSafeRefCount
bool mDebugAdvanceStatePending; // True while advance_state() was called by not handled yet.
bool mDebugRefCalled; // True when ref() is called (or will be called within the critial area of mMultiplexMutex).
#endif
+#ifdef CWDEBUG
+ protected:
+ bool mSMDebug; // Print debug output only when true.
+#endif
+ private:
U64 mRuntime; // Total time spent running in the main thread (in clocks).
public:
- AIStateMachine(void) : mCallback(NULL), mDefaultEngine(NULL), mYieldEngine(NULL),
+ AIStateMachine(CWD_ONLY(bool debug)) : mCallback(NULL), mDefaultEngine(NULL), mYieldEngine(NULL),
#ifdef SHOW_ASSERT
mThreadId(AIThreadID::none), mDebugLastState(bs_killed), mDebugShouldRun(false), mDebugAborted(false), mDebugContPending(false),
mDebugSetStatePending(false), mDebugAdvanceStatePending(false), mDebugRefCalled(false),
+#endif
+#ifdef CWDEBUG
+ mSMDebug(debug),
#endif
mRuntime(0)
{ }
protected:
- // The user should call finish() (or abort(), or kill() from the call back when finish_impl() calls run()), not delete a class derived from AIStateMachine directly.
- virtual ~AIStateMachine() { llassert(multiplex_state_type_rat(mState)->base_state == bs_killed); }
+ // The user should call finish() (or abort(), or kill() from the call back when finish_impl() calls run()),
+ // not delete a class derived from AIStateMachine directly. Deleting it directly before calling run() is
+ // ok however.
+ virtual ~AIStateMachine()
+ {
+#ifdef SHOW_ASSERT
+ base_state_type state = multiplex_state_type_rat(mState)->base_state;
+ llassert(state == bs_killed || state == bs_reset);
+#endif
+ }
public:
// These functions may be called directly after creation, or from within finish_impl(), or from the call back function.
@@ -224,11 +242,13 @@ class AIStateMachine : public LLThreadSafeRefCount
void set_state(state_type new_state); // Run this state the NEXT loop.
// These functions can only be called from within multiplex_impl().
void idle(void); // Go idle unless cont() or advance_state() were called since the start of the current loop, or until they are called.
+ void wait(AIConditionBase& condition); // The same as idle(), but wake up when AICondition::signal() is called.
void finish(void); // Mark that the state machine finished and schedule the call back.
void yield(void); // Yield to give CPU to other state machines, but do not go idle.
void yield(AIEngine* engine); // Yield to give CPU to other state machines, but do not go idle. Continue running from engine 'engine'.
void yield_frame(unsigned int frames); // Run from the main-thread engine after at least 'frames' frames have passed.
void yield_ms(unsigned int ms); // Run from the main-thread engine after roughly 'ms' miliseconds have passed.
+ bool yield_if_not(AIEngine* engine); // Do not really yield, unless the current engine is not 'engine'. Returns true if it switched engine.
public:
// This function can be called from multiplex_imp(), but also by a child state machine and
@@ -236,11 +256,12 @@ class AIStateMachine : public LLThreadSafeRefCount
// to access this state machine.
void abort(void); // Abort the state machine (unsuccessful finish).
- // These are the only two functions that can be called by any thread at any moment.
+ // These are the only three functions that can be called by any thread at any moment.
// Those threads should use an LLPointer to access this state machine.
void cont(void); // Guarantee at least one full run of multiplex() after this function is called. Cancels the last call to idle().
void advance_state(state_type new_state); // Guarantee at least one full run of multiplex() after this function is called
// iff new_state is larger than the last state that was processed.
+ bool signalled(void); // Call cont() iff this state machine is still blocked after a call to wait(). Returns false if it already unblocked.
public:
// Accessors.
diff --git a/indra/aistatemachine/aistatemachinethread.h b/indra/aistatemachine/aistatemachinethread.h
index 780060bb6..2891cbb77 100644
--- a/indra/aistatemachine/aistatemachinethread.h
+++ b/indra/aistatemachine/aistatemachinethread.h
@@ -181,7 +181,11 @@ class AIStateMachineThreadBase : public AIStateMachine {
static state_type const max_state = wait_stopped + 1;
protected:
- AIStateMachineThreadBase(void) { }
+ AIStateMachineThreadBase(CWD_ONLY(bool debug))
+#ifdef CWDEBUG
+ : AIStateMachine(debug)
+#endif
+ { }
private:
// Handle initializing the object.
@@ -217,7 +221,10 @@ class AIStateMachineThread : public AIStateMachineThreadBase {
public:
// Constructor.
- AIStateMachineThread(void)
+ AIStateMachineThread(CWD_ONLY(bool debug))
+#ifdef CWDEBUG
+ : AIStateMachineThreadBase(debug)
+#endif
{
*AIThreadImpl::StateMachineThread_wat(mThreadImpl.mStateMachineThread) = this;
}
diff --git a/indra/aistatemachine/aitimer.h b/indra/aistatemachine/aitimer.h
index 5b028c6e0..3ee510007 100644
--- a/indra/aistatemachine/aitimer.h
+++ b/indra/aistatemachine/aitimer.h
@@ -76,7 +76,11 @@ class AITimer : public AIStateMachine {
F64 mInterval; //!< Input variable: interval after which the event will be generated, in seconds.
public:
- AITimer(void) : mInterval(0) { DoutEntering(dc::statemachine, "AITimer(void) [" << (void*)this << "]"); }
+ AITimer(CWD_ONLY(bool debug = false)) :
+#ifdef CWDEBUG
+ AIStateMachine(debug),
+#endif
+ mInterval(0) { DoutEntering(dc::statemachine(mSMDebug), "AITimer(void) [" << (void*)this << "]"); }
/**
* @brief Set the interval after which the timer should expire.
@@ -96,7 +100,7 @@ class AITimer : public AIStateMachine {
protected:
// Call finish() (or abort()), not delete.
- /*virtual*/ ~AITimer() { DoutEntering(dc::statemachine, "~AITimer() [" << (void*)this << "]"); mFrameTimer.cancel(); }
+ /*virtual*/ ~AITimer() { DoutEntering(dc::statemachine(mSMDebug), "~AITimer() [" << (void*)this << "]"); mFrameTimer.cancel(); }
// Handle initializing the object.
/*virtual*/ void initialize_impl(void);
diff --git a/indra/cmake/00-Common.cmake b/indra/cmake/00-Common.cmake
index a45c07f69..c2458b098 100644
--- a/indra/cmake/00-Common.cmake
+++ b/indra/cmake/00-Common.cmake
@@ -46,6 +46,10 @@ if (WINDOWS)
set(MSVC_DIR 10.0)
set(MSVC_SUFFIX 100)
endif (MSVC10)
+ if (MSVC11)
+ set(MSVC_DIR 11.0)
+ set(MSVC_SUFFIX 110)
+ endif (MSVC11)
# Remove default /Zm1000 flag that cmake inserts
string (REPLACE "/Zm1000" " " CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
@@ -78,11 +82,17 @@ if (WINDOWS)
/W3
/c
/Zc:forScope
- /Zc:wchar_t-
+ /Zc:wchar_t-
/nologo
/Oy-
- /arch:SSE2
)
+
+ # SSE2 is implied on win64
+ if(WORD_SIZE EQUAL 32)
+ add_definitions(/arch:SSE2)
+ else(WORD_SIZE EQUAL 32)
+ set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /wd4267 /wd4250 /wd4244")
+ endif(WORD_SIZE EQUAL 32)
# configure win32 API for windows XP+ compatibility
set(WINVER "0x0501" CACHE STRING "Win32 API Target version (see http://msdn.microsoft.com/en-us/library/aa383745%28v=VS.85%29.aspx)")
diff --git a/indra/cmake/CMakeLists.txt b/indra/cmake/CMakeLists.txt
index 5ff1b0399..d2e9f2249 100644
--- a/indra/cmake/CMakeLists.txt
+++ b/indra/cmake/CMakeLists.txt
@@ -81,6 +81,7 @@ set(cmake_SOURCE_FILES
Linking.cmake
MediaPluginBase.cmake
NDOF.cmake
+ NVAPI.cmake
OPENAL.cmake
OpenGL.cmake
OpenJPEG.cmake
diff --git a/indra/cmake/CopyWinLibs.cmake b/indra/cmake/CopyWinLibs.cmake
index 9d52499a1..afd4d31f7 100644
--- a/indra/cmake/CopyWinLibs.cmake
+++ b/indra/cmake/CopyWinLibs.cmake
@@ -6,6 +6,14 @@
include(CMakeCopyIfDifferent)
+if(WORD_SIZE EQUAL 32)
+ set(debug_libs_dir "${CMAKE_SOURCE_DIR}/../libraries/i686-win32/lib/debug")
+ set(release_libs_dir "${CMAKE_SOURCE_DIR}/../libraries/i686-win32/lib/release")
+else(WORD_SIZE EQUAL 32)
+ set(debug_libs_dir "${CMAKE_SOURCE_DIR}/../libraries/x86_64-win/lib/debug")
+ set(release_libs_dir "${CMAKE_SOURCE_DIR}/../libraries/x86_64-win/lib/release")
+endif(WORD_SIZE EQUAL 32)
+
set(vivox_src_dir "${CMAKE_SOURCE_DIR}/newview/vivox-runtime/i686-win32")
set(vivox_files
SLVoice.exe
@@ -23,7 +31,7 @@ copy_if_different(
set(all_targets ${all_targets} ${out_targets})
-set(debug_src_dir "${CMAKE_SOURCE_DIR}/../libraries/i686-win32/lib/debug")
+set(debug_src_dir "${debug_libs_dir}")
set(debug_files
libhunspell.dll
libapr-1.dll
@@ -44,7 +52,7 @@ copy_if_different(
set(all_targets ${all_targets} ${out_targets})
# Debug config runtime files required for the plugin test mule
-set(plugintest_debug_src_dir "${CMAKE_SOURCE_DIR}/../libraries/i686-win32/lib/debug")
+set(plugintest_debug_src_dir "${debug_libs_dir}")
set(plugintest_debug_files
libeay32.dll
qtcored4.dll
@@ -63,7 +71,7 @@ copy_if_different(
set(all_targets ${all_targets} ${out_targets})
# Debug config runtime files required for the plugin test mule (Qt image format plugins)
-set(plugintest_debug_src_dir "${CMAKE_SOURCE_DIR}/../libraries/i686-win32/lib/debug/imageformats")
+set(plugintest_debug_src_dir "${debug_libs_dir}/imageformats")
set(plugintest_debug_files
qgifd4.dll
qicod4.dll
@@ -89,7 +97,7 @@ copy_if_different(
set(all_targets ${all_targets} ${out_targets})
# Release & ReleaseDebInfo config runtime files required for the plugin test mule
-set(plugintest_release_src_dir "${CMAKE_SOURCE_DIR}/../libraries/i686-win32/lib/release")
+set(plugintest_release_src_dir "${release_libs_dir}")
set(plugintest_release_files
libeay32.dll
qtcore4.dll
@@ -116,7 +124,7 @@ copy_if_different(
set(all_targets ${all_targets} ${out_targets})
# Release & ReleaseDebInfo config runtime files required for the plugin test mule (Qt image format plugins)
-set(plugintest_release_src_dir "${CMAKE_SOURCE_DIR}/../libraries/i686-win32/lib/release/imageformats")
+set(plugintest_release_src_dir "${release_libs_dir}/imageformats")
set(plugintest_release_files
qgif4.dll
qico4.dll
@@ -158,7 +166,7 @@ copy_if_different(
set(all_targets ${all_targets} ${out_targets})
# Debug config runtime files required for the plugins
-set(plugins_debug_src_dir "${CMAKE_SOURCE_DIR}/../libraries/i686-win32/lib/debug")
+set(plugins_debug_src_dir "${debug_libs_dir}")
set(plugins_debug_files
libeay32.dll
qtcored4.dll
@@ -177,7 +185,7 @@ copy_if_different(
set(all_targets ${all_targets} ${out_targets})
# Release & ReleaseDebInfo config runtime files required for the plugins
-set(plugins_release_src_dir "${CMAKE_SOURCE_DIR}/../libraries/i686-win32/lib/release")
+set(plugins_release_src_dir "${release_libs_dir}")
set(plugins_release_files
libeay32.dll
qtcore4.dll
@@ -203,9 +211,9 @@ copy_if_different(
)
set(all_targets ${all_targets} ${out_targets})
-set(release_src_dir "${CMAKE_SOURCE_DIR}/../libraries/i686-win32/lib/release")
+
+set(release_src_dir "${release_libs_dir}")
set(release_files
- libtcmalloc_minimal.dll
libhunspell.dll
libapr-1.dll
libaprutil-1.dll
@@ -216,8 +224,21 @@ set(release_files
glod.dll
)
+if(WORD_SIZE EQUAL 32)
+ set(release_files ${release_files}
+ libtcmalloc_minimal.dll
+ )
+endif(WORD_SIZE EQUAL 32)
+
+
if(FMODEX)
- find_path(FMODEX_BINARY_DIR fmodex.dll
+ if (WORD_SIZE EQUAL 32)
+ set(fmodex_dll_file "fmodex.dll")
+ else (WORD_SIZE EQUAL 32)
+ set(fmodex_dll_file "fmodex64.dll")
+ endif (WORD_SIZE EQUAL 32)
+
+ find_path(FMODEX_BINARY_DIR "${fmodex_dll_file}"
"${release_src_dir}"
"${FMODEX_SDK_DIR}/api"
"${FMODEX_SDK_DIR}"
@@ -225,11 +246,11 @@ if(FMODEX)
)
if(FMODEX_BINARY_DIR)
- copy_if_different("${FMODEX_BINARY_DIR}" "${CMAKE_CURRENT_BINARY_DIR}/Release" out_targets fmodex.dll)
+ copy_if_different("${FMODEX_BINARY_DIR}" "${CMAKE_CURRENT_BINARY_DIR}/Release" out_targets "${fmodex_dll_file}")
set(all_targets ${all_targets} ${out_targets})
- copy_if_different("${FMODEX_BINARY_DIR}" "${CMAKE_CURRENT_BINARY_DIR}/RelWithDebInfo" out_targets fmodex.dll)
+ copy_if_different("${FMODEX_BINARY_DIR}" "${CMAKE_CURRENT_BINARY_DIR}/RelWithDebInfo" out_targets "${fmodex_dll_file}")
set(all_targets ${all_targets} ${out_targets})
- copy_if_different("${FMODEX_BINARY_DIR}" "${CMAKE_CURRENT_BINARY_DIR}/Debug" out_targets fmodex.dll)
+ copy_if_different("${FMODEX_BINARY_DIR}" "${CMAKE_CURRENT_BINARY_DIR}/Debug" out_targets "${fmodex_dll_file}")
set(all_targets ${all_targets} ${out_targets})
endif(FMODEX_BINARY_DIR)
endif(FMODEX)
@@ -285,105 +306,6 @@ copy_if_different(
)
set(all_targets ${all_targets} ${out_targets})
-# Copy MS C runtime dlls, required for packaging.
-# *TODO - Adapt this to support VC9
-if (MSVC80)
- FIND_PATH(debug_msvc8_redist_path msvcr80d.dll
- PATHS
- [HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\8.0\\Setup\\VC;ProductDir]/redist/Debug_NonRedist/x86/Microsoft.VC80.DebugCRT
- NO_DEFAULT_PATH
- NO_DEFAULT_PATH
- )
-
- if(EXISTS ${debug_msvc8_redist_path})
- set(debug_msvc8_files
- msvcr80d.dll
- msvcp80d.dll
- Microsoft.VC80.DebugCRT.manifest
- )
-
- copy_if_different(
- ${debug_msvc8_redist_path}
- "${CMAKE_CURRENT_BINARY_DIR}/Debug"
- out_targets
- ${debug_msvc8_files}
- )
- set(all_targets ${all_targets} ${out_targets})
-
- set(debug_appconfig_file ${CMAKE_CURRENT_BINARY_DIR}/Debug/${VIEWER_BINARY_NAME}.exe.config)
- add_custom_command(
- OUTPUT ${debug_appconfig_file}
- COMMAND ${PYTHON_EXECUTABLE}
- ARGS
- ${CMAKE_CURRENT_SOURCE_DIR}/build_win32_appConfig.py
- ${CMAKE_CURRENT_BINARY_DIR}/Debug/Microsoft.VC80.DebugCRT.manifest
- ${CMAKE_CURRENT_SOURCE_DIR}/SecondLifeDebug.exe.config
- ${debug_appconfig_file}
- DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/Debug/Microsoft.VC80.DebugCRT.manifest
- COMMENT "Creating debug app config file"
- )
-
- endif (EXISTS ${debug_msvc8_redist_path})
-
- FIND_PATH(release_msvc8_redist_path msvcr80.dll
- PATHS
- [HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\8.0\\Setup\\VC;ProductDir]/redist/x86/Microsoft.VC80.CRT
- NO_DEFAULT_PATH
- NO_DEFAULT_PATH
- )
-
- if(EXISTS ${release_msvc8_redist_path})
- set(release_msvc8_files
- msvcr80.dll
- msvcp80.dll
- Microsoft.VC80.CRT.manifest
- )
-
- copy_if_different(
- ${release_msvc8_redist_path}
- "${CMAKE_CURRENT_BINARY_DIR}/Release"
- out_targets
- ${release_msvc8_files}
- )
- set(all_targets ${all_targets} ${out_targets})
-
- copy_if_different(
- ${release_msvc8_redist_path}
- "${CMAKE_CURRENT_BINARY_DIR}/RelWithDebInfo"
- out_targets
- ${release_msvc8_files}
- )
- set(all_targets ${all_targets} ${out_targets})
-
- set(release_appconfig_file ${CMAKE_CURRENT_BINARY_DIR}/Release/${VIEWER_BINARY_NAME}.exe.config)
- add_custom_command(
- OUTPUT ${release_appconfig_file}
- COMMAND ${PYTHON_EXECUTABLE}
- ARGS
- ${CMAKE_CURRENT_SOURCE_DIR}/build_win32_appConfig.py
- ${CMAKE_CURRENT_BINARY_DIR}/Release/Microsoft.VC80.CRT.manifest
- ${CMAKE_CURRENT_SOURCE_DIR}/SecondLife.exe.config
- ${release_appconfig_file}
- DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/Release/Microsoft.VC80.CRT.manifest
- COMMENT "Creating release app config file"
- )
-
- set(relwithdebinfo_appconfig_file ${CMAKE_CURRENT_BINARY_DIR}/RelWithDebInfo/${VIEWER_BINARY_NAME}.exe.config)
- add_custom_command(
- OUTPUT ${relwithdebinfo_appconfig_file}
- COMMAND ${PYTHON_EXECUTABLE}
- ARGS
- ${CMAKE_CURRENT_SOURCE_DIR}/build_win32_appConfig.py
- ${CMAKE_CURRENT_BINARY_DIR}/RelWithDebInfo/Microsoft.VC80.CRT.manifest
- ${CMAKE_CURRENT_SOURCE_DIR}/SecondLife.exe.config
- ${relwithdebinfo_appconfig_file}
- DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/RelWithDebInfo/Microsoft.VC80.CRT.manifest
- COMMENT "Creating relwithdebinfo app config file"
- )
-
- endif (EXISTS ${release_msvc8_redist_path})
-endif (MSVC80)
-
add_custom_target(copy_win_libs ALL
DEPENDS
${all_targets}
diff --git a/indra/cmake/DirectX.cmake b/indra/cmake/DirectX.cmake
index a0dc4b2b5..97a0bf910 100644
--- a/indra/cmake/DirectX.cmake
+++ b/indra/cmake/DirectX.cmake
@@ -44,10 +44,15 @@ if (WINDOWS)
"$ENV{ProgramFiles(x86)}/Windows Kits/8.0"
)
- if (WIN_KIT_ROOT_DIR)
+ find_path (WIN_KIT_LIB_DIR dxguid.lib
+ "${WIN_KIT_ROOT_DIR}/Lib/winv6.3/um/${DIRECTX_ARCHITECTURE}"
+ "${WIN_KIT_ROOT_DIR}/Lib/Win8/um/${DIRECTX_ARCHITECTURE}"
+ )
+
+ if (WIN_KIT_ROOT_DIR AND WIN_KIT_LIB_DIR)
set (DIRECTX_INCLUDE_DIR "${WIN_KIT_ROOT_DIR}/Include/um" "${WIN_KIT_ROOT_DIR}/Include/shared")
- set (DIRECTX_LIBRARY_DIR "${WIN_KIT_ROOT_DIR}/Lib/Win8/um/${DIRECTX_ARCHITECTURE}")
- endif (WIN_KIT_ROOT_DIR)
+ set (DIRECTX_LIBRARY_DIR "${WIN_KIT_LIB_DIR}")
+ endif (WIN_KIT_ROOT_DIR AND WIN_KIT_LIB_DIR)
endif (DIRECTX_ROOT_DIR)
if (DIRECTX_INCLUDE_DIR)
diff --git a/indra/cmake/FMODEX.cmake b/indra/cmake/FMODEX.cmake
index dbac0ebac..f3425f1b2 100644
--- a/indra/cmake/FMODEX.cmake
+++ b/indra/cmake/FMODEX.cmake
@@ -16,7 +16,7 @@ if (NOT FMODEX_LIBRARY)
)
elseif(WORD_SIZE EQUAL 64)
find_library(FMODEX_LIBRARY
- fmodex64 fmodexL64
+ fmodex64_vc fmodexL64_vc fmodex64 fmodexL64
PATHS
"${FMODEX_SDK_DIR}/api/lib"
"${FMODEX_SDK_DIR}/api"
@@ -25,21 +25,31 @@ if (NOT FMODEX_LIBRARY)
)
endif(WORD_SIZE EQUAL 32)
endif(FMODEX_SDK_DIR)
- if(WINDOWS AND NOT FMODEX_LIBRARY)
- set(FMODEX_PROG_DIR "$ENV{PROGRAMFILES}/FMOD SoundSystem/FMOD Programmers API Windows")
- find_library(FMODEX_LIBRARY
- fmodex_vc fmodexL_vc
- PATHS
- "${FMODEX_PROG_DIR}/api/lib"
- "${FMODEX_PROG_DIR}/api"
- "${FMODEX_PROG_DIR}"
- )
+ if(WINDOWS AND NOT FMODEX_SDK_DIR)
+ GET_FILENAME_COMPONENT(FMODEX_PROG_DIR [HKEY_CURRENT_USER\\Software\\FMOD\ Programmers\ API\ Windows] ABSOLUTE CACHE)
+ if(WORD_SIZE EQUAL 32)
+ find_library(FMODEX_LIBRARY
+ fmodex_vc fmodexL_vc
+ PATHS
+ "${FMODEX_PROG_DIR}/api/lib"
+ "${FMODEX_PROG_DIR}/api"
+ "${FMODEX_PROG_DIR}"
+ )
+ else(WORD_SIZE EQUAL 32)
+ find_library(FMODEX_LIBRARY
+ fmodex64_vc fmodexL64_vc
+ PATHS
+ "${FMODEX_PROG_DIR}/api/lib"
+ "${FMODEX_PROG_DIR}/api"
+ "${FMODEX_PROG_DIR}"
+ )
+ endif(WORD_SIZE EQUAL 32)
if(FMODEX_LIBRARY)
message(STATUS "Found fmodex in ${FMODEX_PROG_DIR}")
set(FMODEX_SDK_DIR "${FMODEX_PROG_DIR}")
set(FMODEX_SDK_DIR "${FMODEX_PROG_DIR}" CACHE PATH "Path to the FMOD Ex SDK." FORCE)
endif(FMODEX_LIBRARY)
- endif(WINDOWS AND NOT FMODEX_LIBRARY)
+ endif(WINDOWS AND NOT FMODEX_SDK_DIR)
endif (NOT FMODEX_LIBRARY)
find_path(FMODEX_INCLUDE_DIR fmod.hpp
diff --git a/indra/cmake/Linking.cmake b/indra/cmake/Linking.cmake
index 00754ec36..e7bc897c9 100644
--- a/indra/cmake/Linking.cmake
+++ b/indra/cmake/Linking.cmake
@@ -5,22 +5,29 @@ set(${CMAKE_CURRENT_LIST_FILE}_INCLUDED "YES")
include(Variables)
if (NOT STANDALONE)
- if (WINDOWS)
- set(ARCH_PREBUILT_DIRS ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/lib)
- set(ARCH_PREBUILT_DIRS_RELEASE ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/lib/release)
- set(ARCH_PREBUILT_DIRS_DEBUG ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/lib/debug)
- elseif (LINUX)
- set(ARCH_PREBUILT_DIRS ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/lib/release)
- set(ARCH_PREBUILT_DIRS_RELEASE ${ARCH_PREBUILT_DIRS})
- set(ARCH_PREBUILT_DIRS_DEBUG ${ARCH_PREBUILT_DIRS})
- elseif (DARWIN)
- set(ARCH_PREBUILT_DIRS ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/lib)
- set(ARCH_PREBUILT_DIRS_RELEASE ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/lib/release)
- set(ARCH_PREBUILT_DIRS_DEBUG ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/lib/debug)
- endif (WINDOWS)
+ set(ARCH_PREBUILT_DIRS ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/lib)
+ set(ARCH_PREBUILT_DIRS_RELEASE ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/lib/release)
+ set(ARCH_PREBUILT_DIRS_DEBUG ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/lib/debug)
+
+ if(WINDOWS OR ${CMAKE_GENERATOR} MATCHES "Xcode")
+ # the cmake xcode and VS generators implicitly append ${CMAKE_CFG_INTDIR} to the library paths for us
+ # fortunately both windows and darwin are case insensitive filesystems so this works.
+ set(ARCH_PREBUILT_LINK_DIRS "${ARCH_PREBUILT_DIRS}")
+ else(WINDOWS OR ${CMAKE_GENERATOR} MATCHES "Xcode")
+ # else block is for linux and any other makefile based generators
+ string(TOLOWER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_LOWER)
+ set(ARCH_PREBUILT_LINK_DIRS ${ARCH_PREBUILT_DIRS}/${CMAKE_BUILD_TYPE_LOWER})
+ endif(WINDOWS OR ${CMAKE_GENERATOR} MATCHES "Xcode")
+
+ if (NOT "${CMAKE_BUILD_TYPE}" STREQUAL "Release")
+ # When we're building something other than Release, append the
+ # packages/lib/release directory to deal with autobuild packages that don't
+ # provide (e.g.) lib/debug libraries.
+ list(APPEND ARCH_PREBUILT_LINK_DIRS ${ARCH_PREBUILT_DIRS_RELEASE})
+ endif (NOT "${CMAKE_BUILD_TYPE}" STREQUAL "Release")
endif (NOT STANDALONE)
-link_directories(${ARCH_PREBUILT_DIRS})
+link_directories(${ARCH_PREBUILT_LINK_DIRS})
if (LINUX)
set(DL_LIBRARY dl)
diff --git a/indra/cmake/NVAPI.cmake b/indra/cmake/NVAPI.cmake
new file mode 100644
index 000000000..d60e42c87
--- /dev/null
+++ b/indra/cmake/NVAPI.cmake
@@ -0,0 +1,21 @@
+# -*- cmake -*-
+include(Prebuilt)
+include(Variables)
+
+set(NVAPI ON CACHE BOOL "Use NVAPI.")
+
+if (NVAPI)
+ if (WINDOWS)
+ use_prebuilt_binary(nvapi)
+ if (WORD_SIZE EQUAL 32)
+ set(NVAPI_LIBRARY nvapi)
+ elseif (WORD_SIZE EQUAL 64)
+ set(NVAPI_LIBRARY nvapi64)
+ endif (WORD_SIZE EQUAL 32)
+ else (WINDOWS)
+ set(NVAPI_LIBRARY "")
+ endif (WINDOWS)
+else (NVAPI)
+ set(NVAPI_LIBRARY "")
+endif (NVAPI)
+
diff --git a/indra/cmake/QuickTimePlugin.cmake b/indra/cmake/QuickTimePlugin.cmake
index 8afd8f304..cb54e287a 100644
--- a/indra/cmake/QuickTimePlugin.cmake
+++ b/indra/cmake/QuickTimePlugin.cmake
@@ -8,7 +8,7 @@ endif(INSTALL_PROPRIETARY)
if (DARWIN)
include(CMakeFindFrameworks)
find_library(QUICKTIME_LIBRARY QuickTime)
-elseif (WINDOWS)
+elseif (WINDOWS AND WORD_SIZE EQUAL 32)
set(QUICKTIME_SDK_DIR "$ENV{PROGRAMFILES}/QuickTime SDK"
CACHE PATH "Location of the QuickTime SDK.")
diff --git a/indra/cmake/Variables.cmake b/indra/cmake/Variables.cmake
index 10dd25ac2..187412b4a 100644
--- a/indra/cmake/Variables.cmake
+++ b/indra/cmake/Variables.cmake
@@ -37,10 +37,15 @@ set(LIBS_PREBUILT_DIR ${CMAKE_SOURCE_DIR}/../libraries CACHE PATH
if (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
set(WINDOWS ON BOOL FORCE)
- set(ARCH i686)
- set(LL_ARCH ${ARCH}_win32)
- set(LL_ARCH_DIR ${ARCH}-win32)
- set(WORD_SIZE 32)
+ if (WORD_SIZE EQUAL 32)
+ set(ARCH i686)
+ set(LL_ARCH ${ARCH}_win32)
+ set(LL_ARCH_DIR ${ARCH}-win32)
+ elseif (WORD_SIZE EQUAL 64)
+ set(ARCH x86_64)
+ set(LL_ARCH ${ARCH}_win)
+ set(LL_ARCH_DIR ${ARCH}-win)
+ endif (WORD_SIZE EQUAL 32)
endif (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
@@ -92,7 +97,7 @@ endif (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(DARWIN 1)
- if(${CMAKE_GENERATOR} MATCHES Xcode)
+ if(${CMAKE_GENERATOR} MATCHES "Xcode")
#SDK Compiler and Deployment targets for XCode
if (${XCODE_VERSION} VERSION_LESS 4.0.0)
set(CMAKE_OSX_SYSROOT /Developer/SDKs/MacOSX10.5.sdk)
@@ -101,10 +106,10 @@ if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(CMAKE_OSX_SYSROOT /Developer/SDKs/MacOSX10.6.sdk)
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.6)
endif (${XCODE_VERSION} VERSION_LESS 4.0.0)
- else(${CMAKE_GENERATOR} MATCHES Xcode)
+ else(${CMAKE_GENERATOR} MATCHES "Xcode")
set(CMAKE_OSX_SYSROOT /Developer/SDKs/MacOSX10.6.sdk)
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.6)
- endif(${CMAKE_GENERATOR} MATCHES Xcode)
+ endif(${CMAKE_GENERATOR} MATCHES "Xcode")
set(CMAKE_XCODE_ATTRIBUTE_GCC_VERSION "com.apple.compilers.llvmgcc42")
@@ -119,15 +124,17 @@ if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(LL_ARCH_DIR universal-darwin)
endif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
-if (WINDOWS)
+if (WINDOWS AND WORD_SIZE EQUAL 32)
set(PREBUILT_TYPE windows)
+elseif (WINDOWS AND WORD_SIZE EQUAL 64)
+ set(PREBUILT_TYPE windows64)
elseif(DARWIN)
set(PREBUILT_TYPE darwin)
elseif(LINUX AND WORD_SIZE EQUAL 32)
set(PREBUILT_TYPE linux)
elseif(LINUX AND WORD_SIZE EQUAL 64)
set(PREBUILT_TYPE linux64)
-endif(WINDOWS)
+endif(WINDOWS AND WORD_SIZE EQUAL 32)
# Default deploy grid
set(GRID agni CACHE STRING "Target Grid")
diff --git a/indra/cwdebug/debug.h b/indra/cwdebug/debug.h
index 4167813ea..d3c4e686b 100644
--- a/indra/cwdebug/debug.h
+++ b/indra/cwdebug/debug.h
@@ -144,6 +144,7 @@ extern LL_COMMON_API fake_channel const snapshot;
#define CWDEBUG_MARKER 0
#define BACKTRACE do { } while(0)
+#define CWD_ONLY(...)
#endif // !DOXYGEN
@@ -180,6 +181,7 @@ extern LL_COMMON_API fake_channel const snapshot;
#include
#define CWD_API __attribute__ ((visibility("default")))
+#define CWD_ONLY(...) __VA_ARGS__
//! Debug specific code.
namespace debug {
diff --git a/indra/develop.py b/indra/develop.py
index 853c37e14..4e93c27e9 100755
--- a/indra/develop.py
+++ b/indra/develop.py
@@ -443,9 +443,15 @@ class WindowsSetup(PlatformSetup):
'vc100' : {
'gen' : r'Visual Studio 10',
'ver' : r'10.0'
+ },
+ 'vc110' : {
+ 'gen' : r'Visual Studio 11',
+ 'ver' : r'11.0'
}
}
+
gens['vs2010'] = gens['vc100']
+ gens['vs2012'] = gens['vc110']
search_path = r'C:\windows'
exe_suffixes = ('.exe', '.bat', '.com')
@@ -503,6 +509,9 @@ class WindowsSetup(PlatformSetup):
project_name=self.project_name,
word_size=self.word_size,
)
+ if self.word_size == 64:
+ args["generator"] += r' Win64'
+
#if simple:
# return 'cmake %(opts)s "%(dir)s"' % args
return ('cmake -G "%(generator)s" '
diff --git a/indra/lib/python/indra/util/llmanifest.py b/indra/lib/python/indra/util/llmanifest.py
index 11945a239..1522e3e9a 100644
--- a/indra/lib/python/indra/util/llmanifest.py
+++ b/indra/lib/python/indra/util/llmanifest.py
@@ -192,6 +192,8 @@ def usage(srctree=""):
arg['description'] % nd)
def main():
+ print "cwd:", os.getcwd()
+ print " ".join(sys.argv)
option_names = [arg['name'] + '=' for arg in ARGUMENTS]
option_names.append('help')
options, remainder = getopt.getopt(sys.argv[1:], "", option_names)
@@ -266,7 +268,7 @@ class LLManifest(object):
__metaclass__ = LLManifestRegistry
manifests = {}
def for_platform(self, platform, arch = None):
- if arch:
+ if arch and platform != "windows":
platform = platform + '_' + arch
return self.manifests[platform.lower()]
for_platform = classmethod(for_platform)
diff --git a/indra/libhacd/hacdHACD.cpp b/indra/libhacd/hacdHACD.cpp
index 35206f8ce..fb2a54e9e 100644
--- a/indra/libhacd/hacdHACD.cpp
+++ b/indra/libhacd/hacdHACD.cpp
@@ -138,7 +138,7 @@ namespace HACD
if (m_callBack)
{
char msg[1024];
- sprintf(msg, "nCC %lu\n", m_graph.m_nCCs);
+ sprintf(msg, "nCC %zu\n", m_graph.m_nCCs);
(*m_callBack)(msg, 0.0, 0.0, m_graph.GetNVertices());
}
@@ -879,7 +879,7 @@ namespace HACD
if (m_callBack)
{
char msg[1024];
- sprintf(msg, "\t CH(%zu) \t %zu \t %lf \t %zu \t %f \t %zu\n", v, static_cast(p), m_graph.m_vertices[v].m_concavity, m_graph.m_vertices[v].m_distPoints.Size(), m_graph.m_vertices[v].m_surf*100.0/m_area, m_graph.m_vertices[v].m_ancestors.size());
+ sprintf(msg, "\t CH(%zu) \t %zu \t %lf \t %zu \t %f \t %zu\n", v, p, m_graph.m_vertices[v].m_concavity, m_graph.m_vertices[v].m_distPoints.Size(), m_graph.m_vertices[v].m_surf*100.0/m_area, m_graph.m_vertices[v].m_ancestors.size());
(*m_callBack)(msg, 0.0, 0.0, m_nClusters);
p++;
}
diff --git a/indra/libhacd/hacdHACD.h b/indra/libhacd/hacdHACD.h
index 0c9f11653..2ca9a4ae7 100644
--- a/indra/libhacd/hacdHACD.h
+++ b/indra/libhacd/hacdHACD.h
@@ -22,7 +22,9 @@
#include
#include
#include
-
+#if defined(_MSC_VER) && _MSC_VER >= 1700
+#include
+#endif
namespace HACD
{
const double sc_pi = 3.14159265;
diff --git a/indra/libhacd/hacdRaycastMesh.cpp b/indra/libhacd/hacdRaycastMesh.cpp
index 5edd9adc3..2f84bbc11 100644
--- a/indra/libhacd/hacdRaycastMesh.cpp
+++ b/indra/libhacd/hacdRaycastMesh.cpp
@@ -106,7 +106,7 @@ namespace HACD
m_nMaxNodes = 0;
for(size_t k = 0; k < maxDepth; k++)
{
- m_nMaxNodes += (1 << maxDepth);
+ m_nMaxNodes += (static_cast(1) << maxDepth);
}
m_nodes = new RMNode[m_nMaxNodes];
RMNode & root = m_nodes[AddNode()];
diff --git a/indra/llappearance/lldriverparam.h b/indra/llappearance/lldriverparam.h
index 65dd3cdde..47d14d2a1 100644
--- a/indra/llappearance/lldriverparam.h
+++ b/indra/llappearance/lldriverparam.h
@@ -117,7 +117,8 @@ public:
/*virtual*/ void stopAnimating(BOOL upload_bake);
/*virtual*/ BOOL linkDrivenParams(visual_param_mapper mapper, BOOL only_cross_params);
/*virtual*/ void resetDrivenParams();
-
+ /*virtual*/ char const* getTypeString(void) const { return "param_driver"; }
+
// LLViewerVisualParam Virtual functions
/*virtual*/ F32 getTotalDistortion();
/*virtual*/ const LLVector4a& getAvgDistortion();
diff --git a/indra/llappearance/llpolymorph.h b/indra/llappearance/llpolymorph.h
index 03915d3da..f1ecef881 100644
--- a/indra/llappearance/llpolymorph.h
+++ b/indra/llappearance/llpolymorph.h
@@ -173,6 +173,7 @@ public:
// LLVisualParam Virtual functions
///*virtual*/ BOOL parseData(LLXmlTreeNode* node);
/*virtual*/ void apply( ESex sex );
+ /*virtual*/ char const* getTypeString(void) const { return "param_morph"; }
// LLViewerVisualParam Virtual functions
/*virtual*/ F32 getTotalDistortion();
diff --git a/indra/llappearance/llpolyskeletaldistortion.h b/indra/llappearance/llpolyskeletaldistortion.h
index 774bc7dfa..a9b843af6 100644
--- a/indra/llappearance/llpolyskeletaldistortion.h
+++ b/indra/llappearance/llpolyskeletaldistortion.h
@@ -109,7 +109,8 @@ public:
// LLVisualParam Virtual functions
///*virtual*/ BOOL parseData(LLXmlTreeNode* node);
/*virtual*/ void apply( ESex sex );
-
+ /*virtual*/ char const* getTypeString(void) const { return "param_skeleton"; }
+
// LLViewerVisualParam Virtual functions
/*virtual*/ F32 getTotalDistortion() { return 0.1f; }
/*virtual*/ const LLVector4a& getAvgDistortion() { return mDefaultVec; }
diff --git a/indra/llappearance/lltexlayerparams.h b/indra/llappearance/lltexlayerparams.h
index b38d28d3e..64a465a59 100644
--- a/indra/llappearance/lltexlayerparams.h
+++ b/indra/llappearance/lltexlayerparams.h
@@ -86,6 +86,7 @@ public:
/*virtual*/ void setWeight(F32 weight, BOOL upload_bake);
/*virtual*/ void setAnimationTarget(F32 target_value, BOOL upload_bake);
/*virtual*/ void animate(F32 delta, BOOL upload_bake);
+ /*virtual*/ char const* getTypeString(void) const { return "param_alpha"; }
// LLViewerVisualParam Virtual functions
/*virtual*/ F32 getTotalDistortion() { return 1.f; }
@@ -177,7 +178,7 @@ public:
/*virtual*/ void setWeight(F32 weight, BOOL upload_bake);
/*virtual*/ void setAnimationTarget(F32 target_value, BOOL upload_bake);
/*virtual*/ void animate(F32 delta, BOOL upload_bake);
-
+ /*virtual*/ char const* getTypeString(void) const { return "param_color"; }
// LLViewerVisualParam Virtual functions
/*virtual*/ F32 getTotalDistortion() { return 1.f; }
diff --git a/indra/llappearance/llviewervisualparam.cpp b/indra/llappearance/llviewervisualparam.cpp
index dd5331207..4a4f69c56 100644
--- a/indra/llappearance/llviewervisualparam.cpp
+++ b/indra/llappearance/llviewervisualparam.cpp
@@ -143,6 +143,12 @@ BOOL LLViewerVisualParam::setInfo(LLViewerVisualParamInfo *info)
return TRUE;
}
+//virtual
+std::string LLViewerVisualParam::getDumpWearableTypeName(void) const
+{
+ return LLWearableType::getTypeName(LLWearableType::EType(getInfo()->mWearableType));
+}
+
/*
//=============================================================================
// These virtual functions should always be overridden,
diff --git a/indra/llappearance/llviewervisualparam.h b/indra/llappearance/llviewervisualparam.h
index 64364c881..39d29fccb 100644
--- a/indra/llappearance/llviewervisualparam.h
+++ b/indra/llappearance/llviewervisualparam.h
@@ -82,6 +82,7 @@ public:
// LLVisualParam Virtual functions
///*virtual*/ BOOL parseData(LLXmlTreeNode* node);
+ /*virtual*/ std::string getDumpWearableTypeName(void) const;
// New Virtual functions
virtual F32 getTotalDistortion() = 0;
diff --git a/indra/llappearance/llwearable.h b/indra/llappearance/llwearable.h
index b6049eb21..a944a16fd 100644
--- a/indra/llappearance/llwearable.h
+++ b/indra/llappearance/llwearable.h
@@ -41,6 +41,7 @@ class LLVisualParam;
class LLTexGlobalColorInfo;
class LLTexGlobalColor;
class LLAvatarAppearance;
+class AIArchetype;
// Abstract class.
class LLWearable
diff --git a/indra/llaudio/llaudioengine_fmodex.cpp b/indra/llaudio/llaudioengine_fmodex.cpp
index 300264d91..972725171 100644
--- a/indra/llaudio/llaudioengine_fmodex.cpp
+++ b/indra/llaudio/llaudioengine_fmodex.cpp
@@ -59,8 +59,13 @@ bool attemptDelayLoad()
{
__try
{
+#if defined(_WIN64)
+ if( FAILED( __HrLoadAllImportsForDll( "fmodex64.dll" ) ) )
+ return false;
+#else
if( FAILED( __HrLoadAllImportsForDll( "fmodex.dll" ) ) )
return false;
+#endif
}
__except( EXCEPTION_EXECUTE_HANDLER )
{
diff --git a/indra/llcharacter/llvisualparam.h b/indra/llcharacter/llvisualparam.h
index a5864c15c..6cb1fcaa6 100644
--- a/indra/llcharacter/llvisualparam.h
+++ b/indra/llcharacter/llvisualparam.h
@@ -162,6 +162,10 @@ public:
void setParamLocation(EParamLocation loc);
EParamLocation getParamLocation() const { return mParamLocation; }
+ // Singu extensions. Used for dumping the archtype.
+ virtual char const* getTypeString(void) const = 0;
+ virtual std::string getDumpWearableTypeName(void) const = 0;
+
protected:
F32 mCurWeight; // current weight
F32 mLastWeight; // last weight
diff --git a/indra/llcommon/CMakeLists.txt b/indra/llcommon/CMakeLists.txt
index 2b4c37be0..be045f100 100644
--- a/indra/llcommon/CMakeLists.txt
+++ b/indra/llcommon/CMakeLists.txt
@@ -17,6 +17,8 @@ include_directories(
)
set(llcommon_SOURCE_FILES
+ aialert.cpp
+ aifile.cpp
aiframetimer.cpp
aithreadid.cpp
imageids.cpp
@@ -106,6 +108,8 @@ set(llcommon_SOURCE_FILES
set(llcommon_HEADER_FILES
CMakeLists.txt
+ aialert.h
+ aifile.h
aiframetimer.h
airecursive.h
aithreadid.h
diff --git a/indra/llcommon/aialert.cpp b/indra/llcommon/aialert.cpp
new file mode 100644
index 000000000..587a206bc
--- /dev/null
+++ b/indra/llcommon/aialert.cpp
@@ -0,0 +1,82 @@
+/**
+ * @file aialert.cpp
+ *
+ * Copyright (c) 2013, Aleric Inglewood.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ *
+ * 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.
+ *
+ * CHANGELOG
+ * and additional copyright holders.
+ *
+ * 02/11/2013
+ * - Initial version, written by Aleric Inglewood @ SL
+ *
+ * 05/11/2013
+ * Moved everything in namespace AIAlert, except AIArgs.
+ */
+
+#include "aialert.h"
+
+namespace AIAlert
+{
+
+Error::Error(Prefix const& prefix, modal_nt type,
+ Error const& alert) : mLines(alert.mLines), mModal(type)
+{
+ if (alert.mModal == modal) mModal = modal;
+ if (prefix) mLines.push_front(Line(prefix));
+}
+
+Error::Error(Prefix const& prefix, modal_nt type,
+ std::string const& xml_desc, AIArgs const& args) : mModal(type)
+{
+ if (prefix) mLines.push_back(Line(prefix));
+ mLines.push_back(Line(xml_desc, args));
+}
+
+Error::Error(Prefix const& prefix, modal_nt type,
+ Error const& alert,
+ std::string const& xml_desc, AIArgs const& args) : mLines(alert.mLines), mModal(type)
+{
+ if (alert.mModal == modal) mModal = modal;
+ if (prefix) mLines.push_back(Line(prefix, !mLines.empty()));
+ mLines.push_back(Line(xml_desc, args));
+}
+
+Error::Error(Prefix const& prefix, modal_nt type,
+ std::string const& xml_desc,
+ Error const& alert) : mLines(alert.mLines), mModal(type)
+{
+ if (alert.mModal == modal) mModal = modal;
+ if (!mLines.empty()) { mLines.front().set_newline(); }
+ mLines.push_front(Line(xml_desc));
+ if (prefix) mLines.push_front(Line(prefix));
+}
+
+Error::Error(Prefix const& prefix, modal_nt type,
+ std::string const& xml_desc, AIArgs const& args,
+ Error const& alert) : mLines(alert.mLines), mModal(type)
+{
+ if (alert.mModal == modal) mModal = modal;
+ if (!mLines.empty()) { mLines.front().set_newline(); }
+ mLines.push_front(Line(xml_desc, args));
+ if (prefix) mLines.push_front(Line(prefix));
+}
+
+} // namespace AIAlert
+
diff --git a/indra/llcommon/aialert.h b/indra/llcommon/aialert.h
new file mode 100644
index 000000000..4d3704cfb
--- /dev/null
+++ b/indra/llcommon/aialert.h
@@ -0,0 +1,306 @@
+/**
+ * @file aialert.h
+ * @brief Declaration of AIArgs and AIAlert classes.
+ *
+ * Copyright (c) 2013, Aleric Inglewood.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ *
+ * 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.
+ *
+ * CHANGELOG
+ * and additional copyright holders.
+ *
+ * 02/11/2013
+ * Initial version, written by Aleric Inglewood @ SL
+ *
+ * 05/11/2013
+ * Moved everything in namespace AIAlert, except AIArgs.
+ */
+
+#ifndef AI_ALERT
+#define AI_ALERT
+
+#include "llpreprocessor.h"
+#include "llstring.h"
+#include
+#include
+
+//===================================================================================================================================
+// Facility to throw errors that can easily be converted to an informative pop-up floater for the user.
+
+// Throw arbitrary class.
+#define THROW_ALERT_CLASS(Alert, ...) throw Alert(AIAlert::Prefix(), AIAlert::not_modal, __VA_ARGS__)
+#define THROW_MALERT_CLASS(Alert, ...) throw Alert(AIAlert::Prefix(), AIAlert::modal, __VA_ARGS__)
+#ifdef __GNUC__
+#define THROW_FALERT_CLASS(Alert, ...) throw Alert(AIAlert::Prefix(__PRETTY_FUNCTION__, AIAlert::pretty_function_prefix), AIAlert::not_modal, __VA_ARGS__)
+#define THROW_FMALERT_CLASS(Alert, ...) throw Alert(AIAlert::Prefix(__PRETTY_FUNCTION__, AIAlert::pretty_function_prefix), AIAlert::modal, __VA_ARGS__)
+#else
+#define THROW_FALERT_CLASS(Alert, ...) throw Alert(AIAlert::Prefix(__FUNCTION__, AIAlert::pretty_function_prefix), AIAlert::not_modal, __VA_ARGS__)
+#define THROW_FMALERT_CLASS(Alert, ...) throw Alert(AIAlert::Prefix(__FUNCTION__, AIAlert::pretty_function_prefix), AIAlert::modal, __VA_ARGS__)
+#endif
+
+// Shortcut to throw AIAlert::Error.
+#define THROW_ALERT(...) THROW_ALERT_CLASS(AIAlert::Error, __VA_ARGS__)
+#define THROW_MALERT(...) THROW_MALERT_CLASS(AIAlert::Error, __VA_ARGS__)
+#define THROW_FALERT(...) THROW_FALERT_CLASS(AIAlert::Error, __VA_ARGS__)
+#define THROW_FMALERT(...) THROW_FMALERT_CLASS(AIAlert::Error, __VA_ARGS__)
+
+// Shortcut to throw AIAlert::ErrorCode.
+#define THROW_ALERTC(...) THROW_ALERT_CLASS(AIAlert::ErrorCode, __VA_ARGS__)
+#define THROW_MALERTC(...) THROW_MALERT_CLASS(AIAlert::ErrorCode, __VA_ARGS__)
+#define THROW_FALERTC(...) THROW_FALERT_CLASS(AIAlert::ErrorCode, __VA_ARGS__)
+#define THROW_FMALERTC(...) THROW_FMALERT_CLASS(AIAlert::ErrorCode, __VA_ARGS__)
+
+// Shortcut to throw AIAlert::ErrorCode with errno as code.
+#define THROW_ALERTE(...) do { int errn = errno; THROW_ALERT_CLASS(AIAlert::ErrorCode, errn, __VA_ARGS__); } while(0)
+#define THROW_MALERTE(...) do { int errn = errno; THROW_MALERT_CLASS(AIAlert::ErrorCode, errn, __VA_ARGS__); } while(0)
+#define THROW_FALERTE(...) do { int errn = errno; THROW_FALERT_CLASS(AIAlert::ErrorCode, errn, __VA_ARGS__); } while(0)
+#define THROW_FMALERTE(...) do { int errn = errno; THROW_FMALERT_CLASS(AIAlert::ErrorCode, errn, __VA_ARGS__); } while(0)
+
+// Examples
+
+#ifdef EXAMPLE_CODE
+
+ //----------------------------------------------------------
+ // To show the alert box:
+
+ catch (AIAlert::Error const& error)
+ {
+ AIAlert::add(error); // Optionally pass pretty_function_prefix as second parameter to *suppress* that output.
+ }
+
+ // or, for example
+
+ catch (AIAlert::ErrorCode const& error)
+ {
+ if (error.getCode() != EEXIST)
+ {
+ AIAlert::add(alert, AIAlert::pretty_function_prefix);
+ }
+ }
+ //----------------------------------------------------------
+ // To throw alerts:
+
+ THROW_ALERT("ExampleKey"); // A) Lookup "ExampleKey" in strings.xml and show translation.
+ THROW_ALERT("ExampleKey", AIArgs("[FIRST]", first)("[SECOND]", second)(...etc...)); // B) Same as A, but replace [FIRST] with first, [SECOND] with second, etc.
+ THROW_ALERT("ExampleKey", error); // C) As A, but followed by a colon and a newline, and then the text of 'error'.
+ THROW_ALERT(error, "ExampleKey"); // D) The text of 'error', followed by a colon and a newline and then as A.
+ THROW_ALERT("ExampleKey", AIArgs("[FIRST]", first)("[SECOND]", second), error); // E) As B, but followed by a colon and a newline, and then the text of 'error'.
+ THROW_ALERT(error, "ExampleKey", AIArgs("[FIRST]", first)("[SECOND]", second)); // F) The text of 'error', followed by a colon and a newline and then as B.
+ // where 'error' is a caught Error object (as above) in a rethrow.
+ // Prepend ALERT with M and/or F to make the alert box Modal and/or prepend the text with the current function name.
+ // For example,
+ THROW_MFALERT("ExampleKey", AIArgs("[FIRST]", first)); // Throw a Modal alert box that is prefixed with the current Function name.
+ // Append E after ALERT to throw an ErrorCode class that contains the current errno.
+ // For example,
+ THROW_FALERTE("ExampleKey", AIArgs("[FIRST]", first)); // Throw an alert box that is prefixed with the current Function name and pass errno to the catcher.
+
+#endif // EXAMPLE_CODE
+
+//
+//===================================================================================================================================
+
+// A wrapper around LLStringUtil::format_map_t to allow constructing a dictionary
+// on one line by doing:
+//
+// AIArgs("[ARG1]", arg1)("[ARG2]", arg2)("[ARG3]", arg3)...
+
+class LL_COMMON_API AIArgs
+{
+ private:
+ LLStringUtil::format_map_t mArgs; // The underlying replacement map.
+
+ public:
+ // Construct an empty map.
+ AIArgs(void) { }
+ // Construct a map with a single replacement.
+ AIArgs(char const* key, std::string const& replacement) { mArgs[key] = replacement; }
+ // Add another replacement.
+ AIArgs& operator()(char const* key, std::string const& replacement) { mArgs[key] = replacement; return *this; }
+ // The destructor may not throw.
+ ~AIArgs() throw() { }
+
+ // Accessor.
+ LLStringUtil::format_map_t const& operator*() const { return mArgs; }
+};
+
+namespace AIAlert
+{
+
+enum modal_nt
+{
+ not_modal,
+ modal
+};
+
+enum alert_line_type_nt
+{
+ normal = 0,
+ empty_prefix = 1,
+ pretty_function_prefix = 2
+ // These must exist of single bits (a mask).
+};
+
+// An Prefix currently comes only in two flavors:
+//
+// empty_prefix : An empty prefix.
+// pretty_function_prefix : A function name prefix, this is the function from which the alert was thrown.
+
+class LL_COMMON_API Prefix
+{
+ public:
+ Prefix(void) : mType(empty_prefix) { }
+ Prefix(char const* str, alert_line_type_nt type) : mStr(str), mType(type) { }
+
+ operator bool(void) const { return mType != empty_prefix; }
+ alert_line_type_nt type(void) const { return mType; }
+ std::string const& str(void) const { return mStr; }
+
+ private:
+ std::string mStr; // Literal text. For example a C++ function name.
+ alert_line_type_nt mType; // The type of this prefix.
+};
+
+// A class that represents one line with its replacements.
+// The string mXmlDesc shall be looked up in strings.xml.
+// This is not done as part of this class because LLTrans::getString
+// is not part of llcommon.
+
+class LL_COMMON_API Line
+{
+ private:
+ bool mNewline; // Prepend this line with a newline if set.
+ std::string mXmlDesc; // The keyword to look up in string.xml.
+ AIArgs mArgs; // Replacement map.
+ alert_line_type_nt mType; // The type of this line: normal for normal lines, other for prefixes.
+
+ public:
+ Line(std::string const& xml_desc, bool newline = false) : mNewline(newline), mXmlDesc(xml_desc), mType(normal) { }
+ Line(std::string const& xml_desc, AIArgs const& args, bool newline = false) : mNewline(newline), mXmlDesc(xml_desc), mArgs(args), mType(normal) { }
+ Line(Prefix const& prefix, bool newline = false) : mNewline(newline), mXmlDesc("AIPrefix"), mArgs("[PREFIX]", prefix.str()), mType(prefix.type()) { }
+ // The destructor may not throw.
+ ~Line() throw() { }
+
+ // Prepend a newline before this line.
+ void set_newline(void) { mNewline = true; }
+
+ // These are to be used like: LLTrans::getString(line.getXmlDesc(), line.args()) and prepend with a \n if prepend_newline() returns true.
+ std::string getXmlDesc(void) const { return mXmlDesc; }
+ LLStringUtil::format_map_t const& args(void) const { return *mArgs; }
+ bool prepend_newline(void) const { return mNewline; }
+
+ // Accessors.
+ bool suppressed(unsigned int suppress_mask) const { return (suppress_mask & mType) != 0; }
+ bool is_prefix(void) const { return mType != normal; }
+};
+
+// This class is used to throw an error that will cause
+// an alert box to pop up for the user.
+//
+// An alert box only has text and an OK button.
+// The alert box does not give feed back to the program; it is purely informational.
+
+// The class represents multiple lines, each line is to be translated and catenated,
+// separated by newlines, and then written to an alert box. This is not done as part
+// of this class because LLTrans::getString and LLNotification is not part of llcommon.
+// Instead call LLNotificationUtil::add(Error const&).
+
+class LL_COMMON_API Error : public std::exception
+{
+ public:
+ typedef std::deque lines_type;
+
+ // The destructor may not throw.
+ ~Error() throw() { }
+
+ // Accessors.
+ lines_type const& lines(void) const { return mLines; }
+ bool is_modal(void) const { return mModal == modal; }
+
+ // Existing alert, just add a prefix and turn alert into modal if appropriate.
+ Error(Prefix const& prefix, modal_nt type, Error const& alert);
+
+ // A string with zero or more replacements.
+ Error(Prefix const& prefix, modal_nt type,
+ std::string const& xml_desc, AIArgs const& args = AIArgs());
+
+ // Same as above bit prepending the message with the text of another alert.
+ Error(Prefix const& prefix, modal_nt type,
+ Error const& alert,
+ std::string const& xml_desc, AIArgs const& args = AIArgs());
+
+ // Same as above but appending the message with the text of another alert.
+ // (no args)
+ Error(Prefix const& prefix, modal_nt type,
+ std::string const& xml_desc,
+ Error const& alert);
+ // (with args)
+ Error(Prefix const& prefix, modal_nt type,
+ std::string const& xml_desc, AIArgs const& args,
+ Error const& alert);
+
+ private:
+ lines_type mLines; // The lines (or prefixes) of text to be displayed, each consisting on a keyword (to be looked up in strings.xml) and a replacement map.
+ modal_nt mModal; // If true, make the alert box a modal floater.
+};
+
+// Same as Error but allows to pass an additional error code.
+
+class LL_COMMON_API ErrorCode : public Error
+{
+ private:
+ int mCode;
+
+ public:
+ // The destructor may not throw.
+ ~ErrorCode() throw() { }
+
+ // Accessor.
+ int getCode(void) const { return mCode; }
+
+ // Just an Error with a code.
+ ErrorCode(Prefix const& prefix, modal_nt type, int code,
+ Error const& alert) :
+ Error(prefix, type, alert), mCode(code) { }
+
+ // A string with zero or more replacements.
+ ErrorCode(Prefix const& prefix, modal_nt type, int code,
+ std::string const& xml_desc, AIArgs const& args = AIArgs()) :
+ Error(prefix, type, xml_desc, args), mCode(code) { }
+
+ // Same as above bit prepending the message with the text of another alert.
+ ErrorCode(Prefix const& prefix, modal_nt type, int code,
+ Error const& alert,
+ std::string const& xml_desc, AIArgs const& args = AIArgs()) :
+ Error(prefix, type, alert, xml_desc, args), mCode(code) { }
+
+ // Same as above but appending the message with the text of another alert.
+ // (no args)
+ ErrorCode(Prefix const& prefix, modal_nt type, int code,
+ std::string const& xml_desc,
+ Error const& alert) :
+ Error(prefix, type, xml_desc, alert), mCode(code) { }
+ // (with args)
+ ErrorCode(Prefix const& prefix, modal_nt type, int code,
+ std::string const& xml_desc, AIArgs const& args,
+ Error const& alert) :
+ Error(prefix, type, xml_desc, args, alert), mCode(code) { }
+};
+
+} // namespace AIAlert
+
+#endif // AI_ALERT
diff --git a/indra/llcommon/aifile.cpp b/indra/llcommon/aifile.cpp
new file mode 100644
index 000000000..cd2ade77a
--- /dev/null
+++ b/indra/llcommon/aifile.cpp
@@ -0,0 +1,119 @@
+/**
+ * @file aifile.cpp
+ * @brief POSIX file operations that throw on error.
+ *
+ * Copyright (c) 2013, Aleric Inglewood.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ *
+ * 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.
+ *
+ * CHANGELOG
+ * and additional copyright holders.
+ *
+ * 03/11/2013
+ * Initial version, written by Aleric Inglewood @ SL
+ */
+
+#include "linden_common.h"
+#include "aifile.h"
+#include "aialert.h"
+
+#if LL_WINDOWS
+#include
+#include // Windows errno
+#else
+#include
+#endif
+
+AIFile::AIFile(std::string const& filename, char const* accessmode)
+{
+ mFp = AIFile::fopen(filename, accessmode);
+}
+
+AIFile::~AIFile()
+{
+ AIFile::close(mFp);
+}
+
+// Like THROW_MALERTE but appends "LLFile::strerr(errn) << " (" << errn << ')'" as argument to replace [ERROR].
+#define THROW_ERROR(...) \
+ do { \
+ int errn = errno; \
+ std::ostringstream error; \
+ error << LLFile::strerr(errn) << " (" << errn << ')'; \
+ THROW_MALERT_CLASS(AIAlert::ErrorCode, errn, __VA_ARGS__ ("[ERROR]", error.str())); \
+ } while(0)
+
+//static
+void AIFile::mkdir(std::string const& dirname, int perms)
+{
+ int rc = LLFile::mkdir_nowarn(dirname, perms);
+ if (rc < 0 && errno != EEXIST)
+ {
+ THROW_ERROR("AIFile_mkdir_Failed_to_create_DIRNAME", AIArgs("[DIRNAME]", dirname));
+ }
+}
+
+//static
+void AIFile::rmdir(std::string const& dirname)
+{
+ int rc = LLFile::rmdir_nowarn(dirname);
+ if (rc < 0 && errno != ENOENT)
+ {
+ THROW_ERROR("AIFile_rmdir_Failed_to_remove_DIRNAME", AIArgs("[DIRNAME]", dirname));
+ }
+}
+
+//static
+LLFILE* AIFile::fopen(std::string const& filename, const char* mode)
+{
+ LLFILE* fp = LLFile::fopen(filename, mode);
+ if (!fp)
+ {
+ THROW_ERROR("AIFile_fopen_Failed_to_open_FILENAME", AIArgs("[FILENAME]", filename));
+ }
+ return fp;
+}
+
+//static
+void AIFile::close(LLFILE* file)
+{
+ if (LLFile::close(file) < 0)
+ {
+ THROW_ERROR("AIFile_close_Failed_to_close_file", AIArgs);
+ }
+}
+
+//static
+void AIFile::remove(std::string const& filename)
+{
+ int rc = LLFile::remove_nowarn(filename);
+ if (rc < 0 && errno != ENOENT)
+ {
+ THROW_ERROR("AIFile_remove_Failed_to_remove_FILENAME", AIArgs("[FILENAME]", filename));
+ }
+}
+
+//static
+void AIFile::rename(std::string const& filename, std::string const& newname)
+{
+ if (LLFile::rename_nowarn(filename, newname) < 0)
+ {
+ THROW_ERROR("AIFile_rename_Failed_to_rename_FILE_to_NEWFILE", AIArgs("[FILE]", filename)("[NEWFILE]", newname));
+ }
+}
+
diff --git a/indra/llcommon/aifile.h b/indra/llcommon/aifile.h
new file mode 100644
index 000000000..1b110496a
--- /dev/null
+++ b/indra/llcommon/aifile.h
@@ -0,0 +1,59 @@
+/**
+ * @file aifile.h
+ * @brief Declaration of AIFile.
+ *
+ * Copyright (c) 2013, Aleric Inglewood.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ *
+ * 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.
+ *
+ * CHANGELOG
+ * and additional copyright holders.
+ *
+ * 02/11/2013
+ * Initial version, written by Aleric Inglewood @ SL
+ */
+
+#ifndef AIFILE_H
+#define AIFILE_H
+
+#include "llfile.h"
+
+// As LLFile, but throws AIAlert instead of printing a warning.
+class LL_COMMON_API AIFile
+{
+ private:
+ LLFILE* mFp;
+
+ public:
+ // Scoped file (exception safe). Throws AIAlertCode with errno on failure.
+ AIFile(std::string const& filename, char const* accessmode);
+ ~AIFile();
+
+ operator LLFILE* () const { return mFp; }
+
+ // All these functions take UTF8 path/filenames.
+ static LLFILE* fopen(std::string const& filename, char const* accessmode);
+ static void close(LLFILE* file);
+
+ static void mkdir(std::string const& dirname, int perms = 0700); // Does NOT throw when dirname already exists.
+ static void rmdir(std::string const& dirname); // Does NOT throw when dirname does not exist.
+ static void remove(std::string const& filename); // Does NOT throw when filename does not exist.
+ static void rename(std::string const& filename, std::string const& newname);
+};
+
+#endif // AIFILE_H
diff --git a/indra/llcommon/llapp.cpp b/indra/llcommon/llapp.cpp
index 2026a9e4d..40ae4a0a8 100644
--- a/indra/llcommon/llapp.cpp
+++ b/indra/llcommon/llapp.cpp
@@ -123,6 +123,8 @@ LLApp::LLApp() : mThreadErrorp(NULL)
commonCtor();
}
+static void* sCrashLoggerReserve = NULL;
+
void LLApp::commonCtor()
{
// Set our status to running
@@ -148,6 +150,12 @@ void LLApp::commonCtor()
sApplication = this;
mExceptionHandler = 0;
+
+#if LL_WINDOWS
+ sCrashLoggerReserve = VirtualAlloc(NULL, 512*1024, MEM_COMMIT|MEM_RESERVE, PAGE_NOACCESS);
+#else
+ sCrashLoggerReserve = malloc(512*1024);
+#endif
// initialize the buffer to write the minidump filename to
// (this is used to avoid allocating memory in the crash handler)
@@ -155,6 +163,20 @@ void LLApp::commonCtor()
mCrashReportPipeStr = L"\\\\.\\pipe\\LLCrashReporterPipe";
}
+#if LL_WINDOWS
+static bool clear_CrashLoggerReserve_callback(void* context, EXCEPTION_POINTERS* exinfo, MDRawAssertionInfo* assertion)
+{
+ VirtualFree(sCrashLoggerReserve, 0, MEM_RELEASE);
+ return true;
+}
+#else
+static bool clear_CrashLoggerReserve_callback(void* context)
+{
+ free(sCrashLoggerReserve);
+ return true;
+}
+#endif
+
LLApp::LLApp(LLErrorThread *error_thread) :
mThreadErrorp(error_thread)
{
@@ -307,46 +329,12 @@ void LLApp::setupErrorHandling()
// Install the Google Breakpad crash handler for Windows
if(mExceptionHandler == 0)
{
- llwarns << "adding breakpad exception handler" << llendl;
-
- std::wostringstream ws;
- ws << mCrashReportPipeStr << getPid();
- std::wstring wpipe_name = ws.str();
- std::string ptmp = std::string(wpipe_name.begin(), wpipe_name.end());
-
- ::Sleep(2000); //HACK hopefully a static wait won't blow up in my face before google fixes their implementation.
-
- //HACK this for loop is ueless. Breakpad dumbly returns success when the OOP handler isn't initialized.
- for (int retries=0;retries<5;++retries)
- {
- mExceptionHandler = new google_breakpad::ExceptionHandler(
- L"",
- NULL, //No filter
- windows_post_minidump_callback,
- 0,
- google_breakpad::ExceptionHandler::HANDLER_ALL,
- MiniDumpNormal, //Generate a 'normal' minidump.
- (WCHAR *)wpipe_name.c_str(),
- NULL); //No custom client info.
- if (mExceptionHandler)
- {
- break;
- }
- else
- {
- ::Sleep(100); //Wait a tick and try again.
- }
- }
- if (!mExceptionHandler)
- {
- llwarns << "Failed to initialize OOP exception handler. Defaulting to In Process handling" << llendl;
- mExceptionHandler = new google_breakpad::ExceptionHandler(
- std::wstring(mDumpPath.begin(),mDumpPath.end()), //Dump path
- 0, //dump filename
- windows_post_minidump_callback,
- 0,
- google_breakpad::ExceptionHandler::HANDLER_ALL);
- }
+ mExceptionHandler = new google_breakpad::ExceptionHandler(
+ std::wstring(mDumpPath.begin(),mDumpPath.end()), //Dump path
+ clear_CrashLoggerReserve_callback,
+ windows_post_minidump_callback,
+ 0,
+ google_breakpad::ExceptionHandler::HANDLER_ALL);
if (mExceptionHandler)
{
mExceptionHandler->set_handle_debug_exceptions(true);
@@ -401,7 +389,7 @@ void LLApp::setupErrorHandling()
if(installHandler && (mExceptionHandler == 0))
{
- mExceptionHandler = new google_breakpad::ExceptionHandler(mDumpPath, 0, &unix_post_minidump_callback, 0, true, 0);
+ mExceptionHandler = new google_breakpad::ExceptionHandler(mDumpPath, clear_CrashLoggerReserve_callback, &unix_post_minidump_callback, 0, true, 0);
}
#elif LL_LINUX
if(installHandler && (mExceptionHandler == 0))
@@ -411,8 +399,7 @@ void LLApp::setupErrorHandling()
mDumpPath = "/tmp";
}
google_breakpad::MinidumpDescriptor desc(mDumpPath);
- //mExceptionHandler = new google_breakpad::ExceptionHandler(desc, 0, unix_minidump_callback, 0, true, 0);
- mExceptionHandler = new google_breakpad::ExceptionHandler(desc, NULL, unix_minidump_callback, NULL, true, -1);
+ mExceptionHandler = new google_breakpad::ExceptionHandler(desc, clear_CrashLoggerReserve_callback, unix_minidump_callback, NULL, true, -1);
}
#endif
diff --git a/indra/llcommon/llfasttimer_class.cpp b/indra/llcommon/llfasttimer_class.cpp
index 07ea31a5a..e753fe309 100644
--- a/indra/llcommon/llfasttimer_class.cpp
+++ b/indra/llcommon/llfasttimer_class.cpp
@@ -184,7 +184,7 @@ LLMutex* LLFastTimer::sLogLock = NULL;
std::queue LLFastTimer::sLogQueue;
const int LLFastTimer::NamedTimer::HISTORY_NUM = 300;
-#if LL_WINDOWS
+#if defined(LL_WINDOWS) && !defined(_WIN64)
#define USE_RDTSC 1
#endif
diff --git a/indra/llcommon/llfile.cpp b/indra/llcommon/llfile.cpp
index e0e9d3a27..686a516b9 100644
--- a/indra/llcommon/llfile.cpp
+++ b/indra/llcommon/llfile.cpp
@@ -49,7 +49,8 @@ static std::string empty;
#if LL_WINDOWS
// On Windows, use strerror_s().
-std::string strerr(int errn)
+//static
+std::string LLFile::strerr(int errn)
{
char buffer[256];
strerror_s(buffer, errn); // infers sizeof(buffer) -- love it!
@@ -98,7 +99,8 @@ std::string message_from(int orig_errno, const char* buffer, size_t bufflen,
<< " (error " << stre_errno << ')');
}
-std::string strerr(int errn)
+//static
+std::string LLFile::strerr(int errn)
{
char buffer[256];
// Select message_from() function matching the strerror_r() we have on hand.
@@ -108,7 +110,8 @@ std::string strerr(int errn)
#endif // ! LL_WINDOWS
// On either system, shorthand call just infers global 'errno'.
-std::string strerr()
+//static
+std::string LLFile::strerr()
{
return strerr(errno);
}
@@ -125,7 +128,7 @@ int warnif(const std::string& desc, const std::string& filename, int rc, int acc
if (errn != accept)
{
LL_WARNS("LLFile") << "Couldn't " << desc << " '" << filename
- << "' (errno " << errn << "): " << strerr(errn) << LL_ENDL;
+ << "' (errno " << errn << "): " << LLFile::strerr(errn) << LL_ENDL;
}
#if 0 && LL_WINDOWS // turn on to debug file-locking problems
// If the problem is "Permission denied," maybe it's because another
@@ -171,7 +174,7 @@ int warnif(const std::string& desc, const std::string& filename, int rc, int acc
}
// static
-int LLFile::mkdir(const std::string& dirname, int perms)
+int LLFile::mkdir_nowarn(const std::string& dirname, int perms)
{
#if LL_WINDOWS
// permissions are ignored on Windows
@@ -181,13 +184,19 @@ int LLFile::mkdir(const std::string& dirname, int perms)
#else
int rc = ::mkdir(dirname.c_str(), (mode_t)perms);
#endif
+ return rc;
+}
+
+int LLFile::mkdir(const std::string& dirname, int perms)
+{
+ int rc = LLFile::mkdir_nowarn(dirname, perms);
// We often use mkdir() to ensure the existence of a directory that might
// already exist. Don't spam the log if it does.
return warnif("mkdir", dirname, rc, EEXIST);
}
// static
-int LLFile::rmdir(const std::string& dirname)
+int LLFile::rmdir_nowarn(const std::string& dirname)
{
#if LL_WINDOWS
// permissions are ignored on Windows
@@ -197,6 +206,12 @@ int LLFile::rmdir(const std::string& dirname)
#else
int rc = ::rmdir(dirname.c_str());
#endif
+ return rc;
+}
+
+int LLFile::rmdir(const std::string& dirname)
+{
+ int rc = LLFile::rmdir_nowarn(dirname);
return warnif("rmdir", dirname, rc);
}
@@ -238,8 +253,7 @@ int LLFile::close(LLFILE * file)
return ret_value;
}
-
-int LLFile::remove(const std::string& filename)
+int LLFile::remove_nowarn(const std::string& filename)
{
#if LL_WINDOWS
std::string utf8filename = filename;
@@ -248,10 +262,16 @@ int LLFile::remove(const std::string& filename)
#else
int rc = ::remove(filename.c_str());
#endif
+ return rc;
+}
+
+int LLFile::remove(const std::string& filename)
+{
+ int rc = LLFile::remove_nowarn(filename);
return warnif("remove", filename, rc);
}
-int LLFile::rename(const std::string& filename, const std::string& newname)
+int LLFile::rename_nowarn(const std::string& filename, const std::string& newname)
{
#if LL_WINDOWS
std::string utf8filename = filename;
@@ -262,6 +282,12 @@ int LLFile::rename(const std::string& filename, const std::string& newname)
#else
int rc = ::rename(filename.c_str(),newname.c_str());
#endif
+ return rc;
+}
+
+int LLFile::rename(const std::string& filename, const std::string& newname)
+{
+ int rc = LLFile::rename_nowarn(filename, newname);
return warnif(STRINGIZE("rename to '" << newname << "' from"), filename, rc);
}
diff --git a/indra/llcommon/llfile.h b/indra/llcommon/llfile.h
index 12eb04932..cc990f6ab 100644
--- a/indra/llcommon/llfile.h
+++ b/indra/llcommon/llfile.h
@@ -30,6 +30,9 @@
#ifndef LL_LLFILE_H
#define LL_LLFILE_H
+#include
+#include
+
/**
* This class provides a cross platform interface to the filesystem.
* Attempts to mostly mirror the POSIX style IO functions.
@@ -37,9 +40,6 @@
typedef FILE LLFILE;
-#include
-#include
-
#if LL_WINDOWS
// windows version of stat function and stat data structure are called _stat
typedef struct _stat llstat;
@@ -68,6 +68,12 @@ public:
static int close(LLFILE * file);
+ // Singu extension: the same as below, but doesn't print a warning as to leave errno alone.
+ static int mkdir_nowarn(const std::string& filename, int perms);
+ static int rmdir_nowarn(const std::string& filename);
+ static int remove_nowarn(const std::string& filename);
+ static int rename_nowarn(const std::string& filename, const std::string& newname);
+
// perms is a permissions mask like 0777 or 0700. In most cases it will
// be overridden by the user's umask. It is ignored on Windows.
static int mkdir(const std::string& filename, int perms = 0700);
@@ -82,6 +88,9 @@ public:
std::ios::openmode mode);
static const char * tmpdir();
+
+ static std::string strerr(int errn);
+ static std::string strerr();
};
/**
diff --git a/indra/llcommon/llinstancetracker.h b/indra/llcommon/llinstancetracker.h
index 3c096abe1..729f066fb 100644
--- a/indra/llcommon/llinstancetracker.h
+++ b/indra/llcommon/llinstancetracker.h
@@ -32,6 +32,7 @@
#include
#include "string_table.h"
+#include "llerror.h" // llassert_always
#include
#include
#include
diff --git a/indra/llcommon/llmd5.cpp b/indra/llcommon/llmd5.cpp
index 1409c55d1..46775313d 100644
--- a/indra/llcommon/llmd5.cpp
+++ b/indra/llcommon/llmd5.cpp
@@ -281,7 +281,12 @@ void LLMD5::raw_digest(unsigned char *s) const
return;
}
-
+//Singu extension: the inverse of LLMD5::raw_digest.
+void LLMD5::clone(unsigned char const* s)
+{
+ memcpy(digest, s, 16);
+ finalized = 1;
+}
void LLMD5::hex_digest(char *s) const
{
@@ -305,12 +310,26 @@ void LLMD5::hex_digest(char *s) const
return;
}
+//Singu extension: the inverse of LLMD5::hex_digest.
+void LLMD5::clone(std::string const& hash_str)
+{
+ for (int i = 0; i < 16; ++i)
+ {
+ unsigned char byte = 0;
+ for (int j = 0; j < 2; ++j)
+ {
+ char c = hash_str[i * 2 + j];
+ unsigned char nibble = (c >= '0' && c <= '9') ? c - '0' : c - 'a' + 10;
+ byte += nibble << ((1 - j) << 2);
+ }
+ digest[i] = byte;
+ }
+ finalized = 1;
+}
-
-
-std::ostream& operator<<(std::ostream &stream, LLMD5 context)
+std::ostream& operator<<(std::ostream &stream, LLMD5 const& context)
{
char s[33]; /* Flawfinder: ignore */
context.hex_digest(s);
@@ -318,23 +337,6 @@ std::ostream& operator<<(std::ostream &stream, LLMD5 context)
return stream;
}
-bool operator==(const LLMD5& a, const LLMD5& b)
-{
- unsigned char a_guts[16];
- unsigned char b_guts[16];
- a.raw_digest(a_guts);
- b.raw_digest(b_guts);
- if (memcmp(a_guts,b_guts,16)==0)
- return true;
- else
- return false;
-}
-
-bool operator!=(const LLMD5& a, const LLMD5& b)
-{
- return !(a==b);
-}
-
// PRIVATE METHODS:
void LLMD5::init(){
diff --git a/indra/llcommon/llmd5.h b/indra/llcommon/llmd5.h
index 8bf715f14..8909f04d4 100644
--- a/indra/llcommon/llmd5.h
+++ b/indra/llcommon/llmd5.h
@@ -32,6 +32,10 @@
#ifndef LL_LLMD5_H
#define LL_LLMD5_H
+#include "llpreprocessor.h"
+#include
+#include // memcmp
+
// LLMD5.CC - source code for the C++/object oriented translation and
// modification of MD5.
@@ -98,18 +102,27 @@ public:
void update (const std::string& str);
void finalize ();
+ bool isFinalized() const { return finalized; }
+
// constructors for special circumstances. All these constructors finalize
// the MD5 context.
LLMD5 (const unsigned char *string); // digest string, finalize
LLMD5 (std::istream& stream); // digest stream, finalize
LLMD5 (FILE *file); // digest file, close, finalize
LLMD5 (const unsigned char *string, const unsigned int number);
+
+ // Singu extension: set digest directly, finalize.
+ void clone(unsigned char const* digest); // Inverse of raw_digest.
+ void clone(std::string const& hash_str); // Inverse of hex_digest.
// methods to acquire finalized result
void raw_digest(unsigned char *array) const; // provide 16-byte array for binary data
void hex_digest(char *string) const; // provide 33-byte array for ascii-hex string
- friend LL_COMMON_API std::ostream& operator<< (std::ostream&, LLMD5 context);
+ friend LL_COMMON_API std::ostream& operator<< (std::ostream&, LLMD5 const& context);
+ friend LL_COMMON_API bool operator==(const LLMD5& a, const LLMD5& b) { return std::memcmp(a.digest ,b.digest, 16) == 0; }
+ friend LL_COMMON_API bool operator!=(const LLMD5& a, const LLMD5& b) { return std::memcmp(a.digest ,b.digest, 16) != 0; }
+ friend LL_COMMON_API bool operator<(const LLMD5& a, const LLMD5& b) { return std::memcmp(a.digest ,b.digest, 16) < 0; }
private:
@@ -131,7 +144,4 @@ private:
};
-LL_COMMON_API bool operator==(const LLMD5& a, const LLMD5& b);
-LL_COMMON_API bool operator!=(const LLMD5& a, const LLMD5& b);
-
#endif // LL_LLMD5_H
diff --git a/indra/llcommon/llmemory.h b/indra/llcommon/llmemory.h
index 084f9780c..50739b677 100644
--- a/indra/llcommon/llmemory.h
+++ b/indra/llcommon/llmemory.h
@@ -200,7 +200,7 @@ inline void ll_memcpy_nonaliased_aligned_16(char* __restrict dst, const char* __
assert((bytes % sizeof(F32))== 0);
ll_assert_aligned(src,16);
ll_assert_aligned(dst,16);
- assert((src < dst) ? ((src + bytes) < dst) : ((dst + bytes) < src));
+ assert((src < dst) ? ((src + bytes) <= dst) : ((dst + bytes) <= src));
assert(bytes%16==0);
char* end = dst + bytes;
diff --git a/indra/llcommon/llprocessor.cpp b/indra/llcommon/llprocessor.cpp
index ce2c593c5..a7d2eac67 100644
--- a/indra/llcommon/llprocessor.cpp
+++ b/indra/llcommon/llprocessor.cpp
@@ -416,7 +416,7 @@ static F64 calculate_cpu_frequency(U32 measure_msecs)
unsigned long dwCurPriorityClass = GetPriorityClass(hProcess);
int iCurThreadPriority = GetThreadPriority(hThread);
unsigned long dwProcessMask, dwSystemMask, dwNewMask = 1;
- GetProcessAffinityMask(hProcess, &dwProcessMask, &dwSystemMask);
+ GetProcessAffinityMask(hProcess, (PDWORD_PTR)&dwProcessMask, (PDWORD_PTR)&dwSystemMask);
SetPriorityClass(hProcess, REALTIME_PRIORITY_CLASS);
SetThreadPriority(hThread, THREAD_PRIORITY_TIME_CRITICAL);
diff --git a/indra/llcommon/llrefcount.h b/indra/llcommon/llrefcount.h
index b7831e7fa..4df84028a 100644
--- a/indra/llcommon/llrefcount.h
+++ b/indra/llcommon/llrefcount.h
@@ -27,6 +27,9 @@
#define LLREFCOUNT_H
#include
+#include "llpreprocessor.h" // LL_COMMON_API
+#include "stdtypes.h" // S32
+#include "llerror.h" // llassert
#define LL_REF_COUNT_DEBUG 0
#if LL_REF_COUNT_DEBUG
diff --git a/indra/llcommon/llrun.h b/indra/llcommon/llrun.h
index 1fc9925df..1701800b1 100644
--- a/indra/llcommon/llrun.h
+++ b/indra/llcommon/llrun.h
@@ -37,6 +37,8 @@
#include
#include
+#include "llpreprocessor.h"
+#include "stdtypes.h"
class LLRunnable;
diff --git a/indra/llcommon/llsingleton.h b/indra/llcommon/llsingleton.h
index 78b8f95be..a780a6a24 100644
--- a/indra/llcommon/llsingleton.h
+++ b/indra/llcommon/llsingleton.h
@@ -27,6 +27,7 @@
#include "llerror.h" // *TODO: eliminate this
+#include
diff --git a/indra/newview/app_settings/settings_ascent.xml b/indra/newview/app_settings/settings_ascent.xml
index 4bd498e04..bc4537109 100644
--- a/indra/newview/app_settings/settings_ascent.xml
+++ b/indra/newview/app_settings/settings_ascent.xml
@@ -277,7 +277,7 @@
Type
Boolean
Value
- 1
+ 0
AscentShowOthersTagColor
diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl
index cfc9d7c0d..35362cabb 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl
@@ -23,7 +23,7 @@
* $/LicenseInfo$
*/
-#extension GL_ARB_texture_rectangle : enable
+//#extension GL_ARB_texture_rectangle : enable
#define INDEXED 1
#define NON_INDEXED 2
diff --git a/indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl
index c329bcde6..369a014fb 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl
@@ -23,7 +23,7 @@
* $/LicenseInfo$
*/
-#extension GL_ARB_texture_rectangle : enable
+//#extension GL_ARB_texture_rectangle : enable
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color;
diff --git a/indra/newview/app_settings/shaders/class1/deferred/cofF.glsl b/indra/newview/app_settings/shaders/class1/deferred/cofF.glsl
index ccbc3c557..bf04caba5 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/cofF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/cofF.glsl
@@ -23,7 +23,7 @@
* $/LicenseInfo$
*/
-#extension GL_ARB_texture_rectangle : enable
+//#extension GL_ARB_texture_rectangle : enable
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color;
diff --git a/indra/newview/app_settings/shaders/class1/deferred/dofCombineF.glsl b/indra/newview/app_settings/shaders/class1/deferred/dofCombineF.glsl
index a425e5062..9ddeae18d 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/dofCombineF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/dofCombineF.glsl
@@ -23,7 +23,7 @@
* $/LicenseInfo$
*/
-#extension GL_ARB_texture_rectangle : enable
+//#extension GL_ARB_texture_rectangle : enable
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color;
diff --git a/indra/newview/app_settings/shaders/class1/deferred/emissiveF.glsl b/indra/newview/app_settings/shaders/class1/deferred/emissiveF.glsl
index ed02c4a48..848f52b9a 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/emissiveF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/emissiveF.glsl
@@ -23,7 +23,7 @@
* $/LicenseInfo$
*/
-#extension GL_ARB_texture_rectangle : enable
+//#extension GL_ARB_texture_rectangle : enable
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color;
diff --git a/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl
index 58c18b4d9..167c2ae73 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl
@@ -23,7 +23,7 @@
* $/LicenseInfo$
*/
-#extension GL_ARB_texture_rectangle : enable
+//#extension GL_ARB_texture_rectangle : enable
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color;
diff --git a/indra/newview/app_settings/shaders/class1/deferred/fullbrightShinyF.glsl b/indra/newview/app_settings/shaders/class1/deferred/fullbrightShinyF.glsl
index edc6ff049..f351ec276 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/fullbrightShinyF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/fullbrightShinyF.glsl
@@ -22,8 +22,6 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
-
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color;
diff --git a/indra/newview/app_settings/shaders/class1/deferred/fxaaF.glsl b/indra/newview/app_settings/shaders/class1/deferred/fxaaF.glsl
index a2b4b3b8c..13409832a 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/fxaaF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/fxaaF.glsl
@@ -23,8 +23,8 @@
* $/LicenseInfo$
*/
-#extension GL_ARB_texture_rectangle : enable
-#extension GL_ARB_shader_texture_lod : enable
+//#extension GL_ARB_texture_rectangle : enable
+//#extension GL_ARB_shader_texture_lod : enable
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color;
@@ -34,7 +34,7 @@ out vec4 frag_color;
#define FXAA_PC 1
//#define FXAA_GLSL_130 1
-#define FXAA_QUALITY__PRESET 12
+#define FXAA_QUALITY_M_PRESET 12
/*============================================================================
@@ -67,7 +67,7 @@ Example,
#define FXAA_PC 1
#define FXAA_HLSL_5 1
- #define FXAA_QUALITY__PRESET 12
+ #define FXAA_QUALITY_M_PRESET 12
Or,
@@ -366,7 +366,7 @@ A. Or use FXAA_GREEN_AS_LUMA.
/*============================================================================
FXAA CONSOLE PS3 - TUNING KNOBS
============================================================================*/
-#ifndef FXAA_CONSOLE__PS3_EDGE_SHARPNESS
+#ifndef FXAA_CONSOLE_M_PS3_EDGE_SHARPNESS
//
// Consoles the sharpness of edges on PS3 only.
// Non-PS3 tuning is done with shader input.
@@ -380,17 +380,17 @@ A. Or use FXAA_GREEN_AS_LUMA.
// 2.0 is really soft (good for vector graphics inputs)
//
#if 1
- #define FXAA_CONSOLE__PS3_EDGE_SHARPNESS 8.0
+ #define FXAA_CONSOLE_M_PS3_EDGE_SHARPNESS 8.0
#endif
#if 0
- #define FXAA_CONSOLE__PS3_EDGE_SHARPNESS 4.0
+ #define FXAA_CONSOLE_M_PS3_EDGE_SHARPNESS 4.0
#endif
#if 0
- #define FXAA_CONSOLE__PS3_EDGE_SHARPNESS 2.0
+ #define FXAA_CONSOLE_M_PS3_EDGE_SHARPNESS 2.0
#endif
#endif
/*--------------------------------------------------------------------------*/
-#ifndef FXAA_CONSOLE__PS3_EDGE_THRESHOLD
+#ifndef FXAA_CONSOLE_M_PS3_EDGE_THRESHOLD
//
// Only effects PS3.
// Non-PS3 tuning is done with shader input.
@@ -408,9 +408,9 @@ A. Or use FXAA_GREEN_AS_LUMA.
// 0.25 leaves more aliasing, and is sharper
//
#if 1
- #define FXAA_CONSOLE__PS3_EDGE_THRESHOLD 0.125
+ #define FXAA_CONSOLE_M_PS3_EDGE_THRESHOLD 0.125
#else
- #define FXAA_CONSOLE__PS3_EDGE_THRESHOLD 0.25
+ #define FXAA_CONSOLE_M_PS3_EDGE_THRESHOLD 0.25
#endif
#endif
@@ -419,7 +419,7 @@ A. Or use FXAA_GREEN_AS_LUMA.
------------------------------------------------------------------------------
NOTE the other tuning knobs are now in the shader function inputs!
============================================================================*/
-#ifndef FXAA_QUALITY__PRESET
+#ifndef FXAA_QUALITY_M_PRESET
//
// Choose the quality preset.
// This needs to be compiled into the shader as it effects code.
@@ -440,7 +440,7 @@ NOTE the other tuning knobs are now in the shader function inputs!
// _ = the lowest digit is directly related to performance
// _ = the highest digit is directly related to style
//
- #define FXAA_QUALITY__PRESET 12
+ #define FXAA_QUALITY_M_PRESET 12
#endif
@@ -453,198 +453,198 @@ NOTE the other tuning knobs are now in the shader function inputs!
/*============================================================================
FXAA QUALITY - MEDIUM DITHER PRESETS
============================================================================*/
-#if (FXAA_QUALITY__PRESET == 10)
- #define FXAA_QUALITY__PS 3
- #define FXAA_QUALITY__P0 1.5
- #define FXAA_QUALITY__P1 3.0
- #define FXAA_QUALITY__P2 12.0
+#if (FXAA_QUALITY_M_PRESET == 10)
+ #define FXAA_QUALITY_M_PS 3
+ #define FXAA_QUALITY_M_P0 1.5
+ #define FXAA_QUALITY_M_P1 3.0
+ #define FXAA_QUALITY_M_P2 12.0
#endif
/*--------------------------------------------------------------------------*/
-#if (FXAA_QUALITY__PRESET == 11)
- #define FXAA_QUALITY__PS 4
- #define FXAA_QUALITY__P0 1.0
- #define FXAA_QUALITY__P1 1.5
- #define FXAA_QUALITY__P2 3.0
- #define FXAA_QUALITY__P3 12.0
+#if (FXAA_QUALITY_M_PRESET == 11)
+ #define FXAA_QUALITY_M_PS 4
+ #define FXAA_QUALITY_M_P0 1.0
+ #define FXAA_QUALITY_M_P1 1.5
+ #define FXAA_QUALITY_M_P2 3.0
+ #define FXAA_QUALITY_M_P3 12.0
#endif
/*--------------------------------------------------------------------------*/
-#if (FXAA_QUALITY__PRESET == 12)
- #define FXAA_QUALITY__PS 5
- #define FXAA_QUALITY__P0 1.0
- #define FXAA_QUALITY__P1 1.5
- #define FXAA_QUALITY__P2 2.0
- #define FXAA_QUALITY__P3 4.0
- #define FXAA_QUALITY__P4 12.0
+#if (FXAA_QUALITY_M_PRESET == 12)
+ #define FXAA_QUALITY_M_PS 5
+ #define FXAA_QUALITY_M_P0 1.0
+ #define FXAA_QUALITY_M_P1 1.5
+ #define FXAA_QUALITY_M_P2 2.0
+ #define FXAA_QUALITY_M_P3 4.0
+ #define FXAA_QUALITY_M_P4 12.0
#endif
/*--------------------------------------------------------------------------*/
-#if (FXAA_QUALITY__PRESET == 13)
- #define FXAA_QUALITY__PS 6
- #define FXAA_QUALITY__P0 1.0
- #define FXAA_QUALITY__P1 1.5
- #define FXAA_QUALITY__P2 2.0
- #define FXAA_QUALITY__P3 2.0
- #define FXAA_QUALITY__P4 4.0
- #define FXAA_QUALITY__P5 12.0
+#if (FXAA_QUALITY_M_PRESET == 13)
+ #define FXAA_QUALITY_M_PS 6
+ #define FXAA_QUALITY_M_P0 1.0
+ #define FXAA_QUALITY_M_P1 1.5
+ #define FXAA_QUALITY_M_P2 2.0
+ #define FXAA_QUALITY_M_P3 2.0
+ #define FXAA_QUALITY_M_P4 4.0
+ #define FXAA_QUALITY_M_P5 12.0
#endif
/*--------------------------------------------------------------------------*/
-#if (FXAA_QUALITY__PRESET == 14)
- #define FXAA_QUALITY__PS 7
- #define FXAA_QUALITY__P0 1.0
- #define FXAA_QUALITY__P1 1.5
- #define FXAA_QUALITY__P2 2.0
- #define FXAA_QUALITY__P3 2.0
- #define FXAA_QUALITY__P4 2.0
- #define FXAA_QUALITY__P5 4.0
- #define FXAA_QUALITY__P6 12.0
+#if (FXAA_QUALITY_M_PRESET == 14)
+ #define FXAA_QUALITY_M_PS 7
+ #define FXAA_QUALITY_M_P0 1.0
+ #define FXAA_QUALITY_M_P1 1.5
+ #define FXAA_QUALITY_M_P2 2.0
+ #define FXAA_QUALITY_M_P3 2.0
+ #define FXAA_QUALITY_M_P4 2.0
+ #define FXAA_QUALITY_M_P5 4.0
+ #define FXAA_QUALITY_M_P6 12.0
#endif
/*--------------------------------------------------------------------------*/
-#if (FXAA_QUALITY__PRESET == 15)
- #define FXAA_QUALITY__PS 8
- #define FXAA_QUALITY__P0 1.0
- #define FXAA_QUALITY__P1 1.5
- #define FXAA_QUALITY__P2 2.0
- #define FXAA_QUALITY__P3 2.0
- #define FXAA_QUALITY__P4 2.0
- #define FXAA_QUALITY__P5 2.0
- #define FXAA_QUALITY__P6 4.0
- #define FXAA_QUALITY__P7 12.0
+#if (FXAA_QUALITY_M_PRESET == 15)
+ #define FXAA_QUALITY_M_PS 8
+ #define FXAA_QUALITY_M_P0 1.0
+ #define FXAA_QUALITY_M_P1 1.5
+ #define FXAA_QUALITY_M_P2 2.0
+ #define FXAA_QUALITY_M_P3 2.0
+ #define FXAA_QUALITY_M_P4 2.0
+ #define FXAA_QUALITY_M_P5 2.0
+ #define FXAA_QUALITY_M_P6 4.0
+ #define FXAA_QUALITY_M_P7 12.0
#endif
/*============================================================================
FXAA QUALITY - LOW DITHER PRESETS
============================================================================*/
-#if (FXAA_QUALITY__PRESET == 20)
- #define FXAA_QUALITY__PS 3
- #define FXAA_QUALITY__P0 1.5
- #define FXAA_QUALITY__P1 2.0
- #define FXAA_QUALITY__P2 8.0
+#if (FXAA_QUALITY_M_PRESET == 20)
+ #define FXAA_QUALITY_M_PS 3
+ #define FXAA_QUALITY_M_P0 1.5
+ #define FXAA_QUALITY_M_P1 2.0
+ #define FXAA_QUALITY_M_P2 8.0
#endif
/*--------------------------------------------------------------------------*/
-#if (FXAA_QUALITY__PRESET == 21)
- #define FXAA_QUALITY__PS 4
- #define FXAA_QUALITY__P0 1.0
- #define FXAA_QUALITY__P1 1.5
- #define FXAA_QUALITY__P2 2.0
- #define FXAA_QUALITY__P3 8.0
+#if (FXAA_QUALITY_M_PRESET == 21)
+ #define FXAA_QUALITY_M_PS 4
+ #define FXAA_QUALITY_M_P0 1.0
+ #define FXAA_QUALITY_M_P1 1.5
+ #define FXAA_QUALITY_M_P2 2.0
+ #define FXAA_QUALITY_M_P3 8.0
#endif
/*--------------------------------------------------------------------------*/
-#if (FXAA_QUALITY__PRESET == 22)
- #define FXAA_QUALITY__PS 5
- #define FXAA_QUALITY__P0 1.0
- #define FXAA_QUALITY__P1 1.5
- #define FXAA_QUALITY__P2 2.0
- #define FXAA_QUALITY__P3 2.0
- #define FXAA_QUALITY__P4 8.0
+#if (FXAA_QUALITY_M_PRESET == 22)
+ #define FXAA_QUALITY_M_PS 5
+ #define FXAA_QUALITY_M_P0 1.0
+ #define FXAA_QUALITY_M_P1 1.5
+ #define FXAA_QUALITY_M_P2 2.0
+ #define FXAA_QUALITY_M_P3 2.0
+ #define FXAA_QUALITY_M_P4 8.0
#endif
/*--------------------------------------------------------------------------*/
-#if (FXAA_QUALITY__PRESET == 23)
- #define FXAA_QUALITY__PS 6
- #define FXAA_QUALITY__P0 1.0
- #define FXAA_QUALITY__P1 1.5
- #define FXAA_QUALITY__P2 2.0
- #define FXAA_QUALITY__P3 2.0
- #define FXAA_QUALITY__P4 2.0
- #define FXAA_QUALITY__P5 8.0
+#if (FXAA_QUALITY_M_PRESET == 23)
+ #define FXAA_QUALITY_M_PS 6
+ #define FXAA_QUALITY_M_P0 1.0
+ #define FXAA_QUALITY_M_P1 1.5
+ #define FXAA_QUALITY_M_P2 2.0
+ #define FXAA_QUALITY_M_P3 2.0
+ #define FXAA_QUALITY_M_P4 2.0
+ #define FXAA_QUALITY_M_P5 8.0
#endif
/*--------------------------------------------------------------------------*/
-#if (FXAA_QUALITY__PRESET == 24)
- #define FXAA_QUALITY__PS 7
- #define FXAA_QUALITY__P0 1.0
- #define FXAA_QUALITY__P1 1.5
- #define FXAA_QUALITY__P2 2.0
- #define FXAA_QUALITY__P3 2.0
- #define FXAA_QUALITY__P4 2.0
- #define FXAA_QUALITY__P5 3.0
- #define FXAA_QUALITY__P6 8.0
+#if (FXAA_QUALITY_M_PRESET == 24)
+ #define FXAA_QUALITY_M_PS 7
+ #define FXAA_QUALITY_M_P0 1.0
+ #define FXAA_QUALITY_M_P1 1.5
+ #define FXAA_QUALITY_M_P2 2.0
+ #define FXAA_QUALITY_M_P3 2.0
+ #define FXAA_QUALITY_M_P4 2.0
+ #define FXAA_QUALITY_M_P5 3.0
+ #define FXAA_QUALITY_M_P6 8.0
#endif
/*--------------------------------------------------------------------------*/
-#if (FXAA_QUALITY__PRESET == 25)
- #define FXAA_QUALITY__PS 8
- #define FXAA_QUALITY__P0 1.0
- #define FXAA_QUALITY__P1 1.5
- #define FXAA_QUALITY__P2 2.0
- #define FXAA_QUALITY__P3 2.0
- #define FXAA_QUALITY__P4 2.0
- #define FXAA_QUALITY__P5 2.0
- #define FXAA_QUALITY__P6 4.0
- #define FXAA_QUALITY__P7 8.0
+#if (FXAA_QUALITY_M_PRESET == 25)
+ #define FXAA_QUALITY_M_PS 8
+ #define FXAA_QUALITY_M_P0 1.0
+ #define FXAA_QUALITY_M_P1 1.5
+ #define FXAA_QUALITY_M_P2 2.0
+ #define FXAA_QUALITY_M_P3 2.0
+ #define FXAA_QUALITY_M_P4 2.0
+ #define FXAA_QUALITY_M_P5 2.0
+ #define FXAA_QUALITY_M_P6 4.0
+ #define FXAA_QUALITY_M_P7 8.0
#endif
/*--------------------------------------------------------------------------*/
-#if (FXAA_QUALITY__PRESET == 26)
- #define FXAA_QUALITY__PS 9
- #define FXAA_QUALITY__P0 1.0
- #define FXAA_QUALITY__P1 1.5
- #define FXAA_QUALITY__P2 2.0
- #define FXAA_QUALITY__P3 2.0
- #define FXAA_QUALITY__P4 2.0
- #define FXAA_QUALITY__P5 2.0
- #define FXAA_QUALITY__P6 2.0
- #define FXAA_QUALITY__P7 4.0
- #define FXAA_QUALITY__P8 8.0
+#if (FXAA_QUALITY_M_PRESET == 26)
+ #define FXAA_QUALITY_M_PS 9
+ #define FXAA_QUALITY_M_P0 1.0
+ #define FXAA_QUALITY_M_P1 1.5
+ #define FXAA_QUALITY_M_P2 2.0
+ #define FXAA_QUALITY_M_P3 2.0
+ #define FXAA_QUALITY_M_P4 2.0
+ #define FXAA_QUALITY_M_P5 2.0
+ #define FXAA_QUALITY_M_P6 2.0
+ #define FXAA_QUALITY_M_P7 4.0
+ #define FXAA_QUALITY_M_P8 8.0
#endif
/*--------------------------------------------------------------------------*/
-#if (FXAA_QUALITY__PRESET == 27)
- #define FXAA_QUALITY__PS 10
- #define FXAA_QUALITY__P0 1.0
- #define FXAA_QUALITY__P1 1.5
- #define FXAA_QUALITY__P2 2.0
- #define FXAA_QUALITY__P3 2.0
- #define FXAA_QUALITY__P4 2.0
- #define FXAA_QUALITY__P5 2.0
- #define FXAA_QUALITY__P6 2.0
- #define FXAA_QUALITY__P7 2.0
- #define FXAA_QUALITY__P8 4.0
- #define FXAA_QUALITY__P9 8.0
+#if (FXAA_QUALITY_M_PRESET == 27)
+ #define FXAA_QUALITY_M_PS 10
+ #define FXAA_QUALITY_M_P0 1.0
+ #define FXAA_QUALITY_M_P1 1.5
+ #define FXAA_QUALITY_M_P2 2.0
+ #define FXAA_QUALITY_M_P3 2.0
+ #define FXAA_QUALITY_M_P4 2.0
+ #define FXAA_QUALITY_M_P5 2.0
+ #define FXAA_QUALITY_M_P6 2.0
+ #define FXAA_QUALITY_M_P7 2.0
+ #define FXAA_QUALITY_M_P8 4.0
+ #define FXAA_QUALITY_M_P9 8.0
#endif
/*--------------------------------------------------------------------------*/
-#if (FXAA_QUALITY__PRESET == 28)
- #define FXAA_QUALITY__PS 11
- #define FXAA_QUALITY__P0 1.0
- #define FXAA_QUALITY__P1 1.5
- #define FXAA_QUALITY__P2 2.0
- #define FXAA_QUALITY__P3 2.0
- #define FXAA_QUALITY__P4 2.0
- #define FXAA_QUALITY__P5 2.0
- #define FXAA_QUALITY__P6 2.0
- #define FXAA_QUALITY__P7 2.0
- #define FXAA_QUALITY__P8 2.0
- #define FXAA_QUALITY__P9 4.0
- #define FXAA_QUALITY__P10 8.0
+#if (FXAA_QUALITY_M_PRESET == 28)
+ #define FXAA_QUALITY_M_PS 11
+ #define FXAA_QUALITY_M_P0 1.0
+ #define FXAA_QUALITY_M_P1 1.5
+ #define FXAA_QUALITY_M_P2 2.0
+ #define FXAA_QUALITY_M_P3 2.0
+ #define FXAA_QUALITY_M_P4 2.0
+ #define FXAA_QUALITY_M_P5 2.0
+ #define FXAA_QUALITY_M_P6 2.0
+ #define FXAA_QUALITY_M_P7 2.0
+ #define FXAA_QUALITY_M_P8 2.0
+ #define FXAA_QUALITY_M_P9 4.0
+ #define FXAA_QUALITY_M_P10 8.0
#endif
/*--------------------------------------------------------------------------*/
-#if (FXAA_QUALITY__PRESET == 29)
- #define FXAA_QUALITY__PS 12
- #define FXAA_QUALITY__P0 1.0
- #define FXAA_QUALITY__P1 1.5
- #define FXAA_QUALITY__P2 2.0
- #define FXAA_QUALITY__P3 2.0
- #define FXAA_QUALITY__P4 2.0
- #define FXAA_QUALITY__P5 2.0
- #define FXAA_QUALITY__P6 2.0
- #define FXAA_QUALITY__P7 2.0
- #define FXAA_QUALITY__P8 2.0
- #define FXAA_QUALITY__P9 2.0
- #define FXAA_QUALITY__P10 4.0
- #define FXAA_QUALITY__P11 8.0
+#if (FXAA_QUALITY_M_PRESET == 29)
+ #define FXAA_QUALITY_M_PS 12
+ #define FXAA_QUALITY_M_P0 1.0
+ #define FXAA_QUALITY_M_P1 1.5
+ #define FXAA_QUALITY_M_P2 2.0
+ #define FXAA_QUALITY_M_P3 2.0
+ #define FXAA_QUALITY_M_P4 2.0
+ #define FXAA_QUALITY_M_P5 2.0
+ #define FXAA_QUALITY_M_P6 2.0
+ #define FXAA_QUALITY_M_P7 2.0
+ #define FXAA_QUALITY_M_P8 2.0
+ #define FXAA_QUALITY_M_P9 2.0
+ #define FXAA_QUALITY_M_P10 4.0
+ #define FXAA_QUALITY_M_P11 8.0
#endif
/*============================================================================
FXAA QUALITY - EXTREME QUALITY
============================================================================*/
-#if (FXAA_QUALITY__PRESET == 39)
- #define FXAA_QUALITY__PS 12
- #define FXAA_QUALITY__P0 1.0
- #define FXAA_QUALITY__P1 1.0
- #define FXAA_QUALITY__P2 1.0
- #define FXAA_QUALITY__P3 1.0
- #define FXAA_QUALITY__P4 1.0
- #define FXAA_QUALITY__P5 1.5
- #define FXAA_QUALITY__P6 2.0
- #define FXAA_QUALITY__P7 2.0
- #define FXAA_QUALITY__P8 2.0
- #define FXAA_QUALITY__P9 2.0
- #define FXAA_QUALITY__P10 4.0
- #define FXAA_QUALITY__P11 8.0
+#if (FXAA_QUALITY_M_PRESET == 39)
+ #define FXAA_QUALITY_M_PS 12
+ #define FXAA_QUALITY_M_P0 1.0
+ #define FXAA_QUALITY_M_P1 1.0
+ #define FXAA_QUALITY_M_P2 1.0
+ #define FXAA_QUALITY_M_P3 1.0
+ #define FXAA_QUALITY_M_P4 1.0
+ #define FXAA_QUALITY_M_P5 1.5
+ #define FXAA_QUALITY_M_P6 2.0
+ #define FXAA_QUALITY_M_P7 2.0
+ #define FXAA_QUALITY_M_P8 2.0
+ #define FXAA_QUALITY_M_P9 2.0
+ #define FXAA_QUALITY_M_P10 4.0
+ #define FXAA_QUALITY_M_P11 8.0
#endif
@@ -869,7 +869,7 @@ FxaaFloat4 FxaaPixelShader(
// This used to be the FXAA_CONSOLE__EDGE_SHARPNESS define.
// It is here now to allow easier tuning.
// This does not effect PS3, as this needs to be compiled in.
- // Use FXAA_CONSOLE__PS3_EDGE_SHARPNESS for PS3.
+ // Use FXAA_CONSOLE_M_PS3_EDGE_SHARPNESS for PS3.
// Due to the PS3 being ALU bound,
// there are only three safe values here: 2 and 4 and 8.
// These options use the shaders ability to a free *|/ by 2|4|8.
@@ -883,7 +883,7 @@ FxaaFloat4 FxaaPixelShader(
// This used to be the FXAA_CONSOLE__EDGE_THRESHOLD define.
// It is here now to allow easier tuning.
// This does not effect PS3, as this needs to be compiled in.
- // Use FXAA_CONSOLE__PS3_EDGE_THRESHOLD for PS3.
+ // Use FXAA_CONSOLE_M_PS3_EDGE_THRESHOLD for PS3.
// Due to the PS3 being ALU bound,
// there are only two safe values here: 1/4 and 1/8.
// These options use the shaders ability to a free *|/ by 2|4|8.
@@ -1041,11 +1041,11 @@ FxaaFloat4 FxaaPixelShader(
if( horzSpan) posB.y += lengthSign * 0.5;
/*--------------------------------------------------------------------------*/
FxaaFloat2 posN;
- posN.x = posB.x - offNP.x * FXAA_QUALITY__P0;
- posN.y = posB.y - offNP.y * FXAA_QUALITY__P0;
+ posN.x = posB.x - offNP.x * FXAA_QUALITY_M_P0;
+ posN.y = posB.y - offNP.y * FXAA_QUALITY_M_P0;
FxaaFloat2 posP;
- posP.x = posB.x + offNP.x * FXAA_QUALITY__P0;
- posP.y = posB.y + offNP.y * FXAA_QUALITY__P0;
+ posP.x = posB.x + offNP.x * FXAA_QUALITY_M_P0;
+ posP.y = posB.y + offNP.y * FXAA_QUALITY_M_P0;
FxaaFloat subpixD = ((-2.0)*subpixC) + 3.0;
FxaaFloat lumaEndN = FxaaLuma(FxaaTexTop(tex, posN));
FxaaFloat subpixE = subpixC * subpixC;
@@ -1061,11 +1061,11 @@ FxaaFloat4 FxaaPixelShader(
lumaEndP -= lumaNN * 0.5;
FxaaBool doneN = abs(lumaEndN) >= gradientScaled;
FxaaBool doneP = abs(lumaEndP) >= gradientScaled;
- if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P1;
- if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P1;
+ if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_M_P1;
+ if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_M_P1;
FxaaBool doneNP = (!doneN) || (!doneP);
- if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P1;
- if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P1;
+ if(!doneP) posP.x += offNP.x * FXAA_QUALITY_M_P1;
+ if(!doneP) posP.y += offNP.y * FXAA_QUALITY_M_P1;
/*--------------------------------------------------------------------------*/
if(doneNP) {
if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
@@ -1074,13 +1074,13 @@ FxaaFloat4 FxaaPixelShader(
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
doneN = abs(lumaEndN) >= gradientScaled;
doneP = abs(lumaEndP) >= gradientScaled;
- if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P2;
- if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P2;
+ if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_M_P2;
+ if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_M_P2;
doneNP = (!doneN) || (!doneP);
- if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P2;
- if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P2;
+ if(!doneP) posP.x += offNP.x * FXAA_QUALITY_M_P2;
+ if(!doneP) posP.y += offNP.y * FXAA_QUALITY_M_P2;
/*--------------------------------------------------------------------------*/
- #if (FXAA_QUALITY__PS > 3)
+ #if (FXAA_QUALITY_M_PS > 3)
if(doneNP) {
if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
@@ -1088,13 +1088,13 @@ FxaaFloat4 FxaaPixelShader(
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
doneN = abs(lumaEndN) >= gradientScaled;
doneP = abs(lumaEndP) >= gradientScaled;
- if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P3;
- if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P3;
+ if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_M_P3;
+ if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_M_P3;
doneNP = (!doneN) || (!doneP);
- if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P3;
- if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P3;
+ if(!doneP) posP.x += offNP.x * FXAA_QUALITY_M_P3;
+ if(!doneP) posP.y += offNP.y * FXAA_QUALITY_M_P3;
/*--------------------------------------------------------------------------*/
- #if (FXAA_QUALITY__PS > 4)
+ #if (FXAA_QUALITY_M_PS > 4)
if(doneNP) {
if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
@@ -1102,13 +1102,13 @@ FxaaFloat4 FxaaPixelShader(
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
doneN = abs(lumaEndN) >= gradientScaled;
doneP = abs(lumaEndP) >= gradientScaled;
- if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P4;
- if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P4;
+ if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_M_P4;
+ if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_M_P4;
doneNP = (!doneN) || (!doneP);
- if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P4;
- if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P4;
+ if(!doneP) posP.x += offNP.x * FXAA_QUALITY_M_P4;
+ if(!doneP) posP.y += offNP.y * FXAA_QUALITY_M_P4;
/*--------------------------------------------------------------------------*/
- #if (FXAA_QUALITY__PS > 5)
+ #if (FXAA_QUALITY_M_PS > 5)
if(doneNP) {
if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
@@ -1116,13 +1116,13 @@ FxaaFloat4 FxaaPixelShader(
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
doneN = abs(lumaEndN) >= gradientScaled;
doneP = abs(lumaEndP) >= gradientScaled;
- if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P5;
- if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P5;
+ if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_M_P5;
+ if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_M_P5;
doneNP = (!doneN) || (!doneP);
- if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P5;
- if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P5;
+ if(!doneP) posP.x += offNP.x * FXAA_QUALITY_M_P5;
+ if(!doneP) posP.y += offNP.y * FXAA_QUALITY_M_P5;
/*--------------------------------------------------------------------------*/
- #if (FXAA_QUALITY__PS > 6)
+ #if (FXAA_QUALITY_M_PS > 6)
if(doneNP) {
if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
@@ -1130,13 +1130,13 @@ FxaaFloat4 FxaaPixelShader(
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
doneN = abs(lumaEndN) >= gradientScaled;
doneP = abs(lumaEndP) >= gradientScaled;
- if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P6;
- if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P6;
+ if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_M_P6;
+ if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_M_P6;
doneNP = (!doneN) || (!doneP);
- if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P6;
- if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P6;
+ if(!doneP) posP.x += offNP.x * FXAA_QUALITY_M_P6;
+ if(!doneP) posP.y += offNP.y * FXAA_QUALITY_M_P6;
/*--------------------------------------------------------------------------*/
- #if (FXAA_QUALITY__PS > 7)
+ #if (FXAA_QUALITY_M_PS > 7)
if(doneNP) {
if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
@@ -1144,13 +1144,13 @@ FxaaFloat4 FxaaPixelShader(
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
doneN = abs(lumaEndN) >= gradientScaled;
doneP = abs(lumaEndP) >= gradientScaled;
- if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P7;
- if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P7;
+ if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_M_P7;
+ if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_M_P7;
doneNP = (!doneN) || (!doneP);
- if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P7;
- if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P7;
+ if(!doneP) posP.x += offNP.x * FXAA_QUALITY_M_P7;
+ if(!doneP) posP.y += offNP.y * FXAA_QUALITY_M_P7;
/*--------------------------------------------------------------------------*/
- #if (FXAA_QUALITY__PS > 8)
+ #if (FXAA_QUALITY_M_PS > 8)
if(doneNP) {
if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
@@ -1158,13 +1158,13 @@ FxaaFloat4 FxaaPixelShader(
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
doneN = abs(lumaEndN) >= gradientScaled;
doneP = abs(lumaEndP) >= gradientScaled;
- if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P8;
- if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P8;
+ if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_M_P8;
+ if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_M_P8;
doneNP = (!doneN) || (!doneP);
- if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P8;
- if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P8;
+ if(!doneP) posP.x += offNP.x * FXAA_QUALITY_M_P8;
+ if(!doneP) posP.y += offNP.y * FXAA_QUALITY_M_P8;
/*--------------------------------------------------------------------------*/
- #if (FXAA_QUALITY__PS > 9)
+ #if (FXAA_QUALITY_M_PS > 9)
if(doneNP) {
if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
@@ -1172,13 +1172,13 @@ FxaaFloat4 FxaaPixelShader(
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
doneN = abs(lumaEndN) >= gradientScaled;
doneP = abs(lumaEndP) >= gradientScaled;
- if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P9;
- if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P9;
+ if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_M_P9;
+ if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_M_P9;
doneNP = (!doneN) || (!doneP);
- if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P9;
- if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P9;
+ if(!doneP) posP.x += offNP.x * FXAA_QUALITY_M_P9;
+ if(!doneP) posP.y += offNP.y * FXAA_QUALITY_M_P9;
/*--------------------------------------------------------------------------*/
- #if (FXAA_QUALITY__PS > 10)
+ #if (FXAA_QUALITY_M_PS > 10)
if(doneNP) {
if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
@@ -1186,13 +1186,13 @@ FxaaFloat4 FxaaPixelShader(
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
doneN = abs(lumaEndN) >= gradientScaled;
doneP = abs(lumaEndP) >= gradientScaled;
- if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P10;
- if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P10;
+ if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_M_P10;
+ if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_M_P10;
doneNP = (!doneN) || (!doneP);
- if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P10;
- if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P10;
+ if(!doneP) posP.x += offNP.x * FXAA_QUALITY_M_P10;
+ if(!doneP) posP.y += offNP.y * FXAA_QUALITY_M_P10;
/*--------------------------------------------------------------------------*/
- #if (FXAA_QUALITY__PS > 11)
+ #if (FXAA_QUALITY_M_PS > 11)
if(doneNP) {
if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
@@ -1200,13 +1200,13 @@ FxaaFloat4 FxaaPixelShader(
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
doneN = abs(lumaEndN) >= gradientScaled;
doneP = abs(lumaEndP) >= gradientScaled;
- if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P11;
- if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P11;
+ if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_M_P11;
+ if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_M_P11;
doneNP = (!doneN) || (!doneP);
- if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P11;
- if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P11;
+ if(!doneP) posP.x += offNP.x * FXAA_QUALITY_M_P11;
+ if(!doneP) posP.y += offNP.y * FXAA_QUALITY_M_P11;
/*--------------------------------------------------------------------------*/
- #if (FXAA_QUALITY__PS > 12)
+ #if (FXAA_QUALITY_M_PS > 12)
if(doneNP) {
if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
@@ -1214,11 +1214,11 @@ FxaaFloat4 FxaaPixelShader(
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
doneN = abs(lumaEndN) >= gradientScaled;
doneP = abs(lumaEndP) >= gradientScaled;
- if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P12;
- if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P12;
+ if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_M_P12;
+ if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_M_P12;
doneNP = (!doneN) || (!doneP);
- if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P12;
- if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P12;
+ if(!doneP) posP.x += offNP.x * FXAA_QUALITY_M_P12;
+ if(!doneP) posP.y += offNP.y * FXAA_QUALITY_M_P12;
/*--------------------------------------------------------------------------*/
}
#endif
@@ -1291,9 +1291,9 @@ FxaaFloat4 FxaaPixelShader(
------------------------------------------------------------------------------
Instead of using this on PC, I'd suggest just using FXAA Quality with
- #define FXAA_QUALITY__PRESET 10
+ #define FXAA_QUALITY_M_PRESET 10
Or
- #define FXAA_QUALITY__PRESET 20
+ #define FXAA_QUALITY_M_PRESET 20
Either are higher qualilty and almost as fast as this on modern PC GPUs.
============================================================================*/
#if (FXAA_PC_CONSOLE == 1)
@@ -1704,7 +1704,7 @@ half4 FxaaPixelShader(
// (5)
half4 dir1_pos;
dir1_pos.xy = normalize(dir.xyz).xz;
- half dirAbsMinTimesC = min(abs(dir1_pos.x), abs(dir1_pos.y)) * half(FXAA_CONSOLE__PS3_EDGE_SHARPNESS);
+ half dirAbsMinTimesC = min(abs(dir1_pos.x), abs(dir1_pos.y)) * half(FXAA_CONSOLE_M_PS3_EDGE_SHARPNESS);
/*--------------------------------------------------------------------------*/
// (6)
half4 dir2_pos;
@@ -2019,7 +2019,7 @@ half4 FxaaPixelShader(
// (6)
half4 dir1_pos;
dir1_pos.xy = normalize(dir).xz;
- half dirAbsMinTimes8 = min(abs(dir1_pos.x), abs(dir1_pos.y)) * half(FXAA_CONSOLE__PS3_EDGE_SHARPNESS);
+ half dirAbsMinTimes8 = min(abs(dir1_pos.x), abs(dir1_pos.y)) * half(FXAA_CONSOLE_M_PS3_EDGE_SHARPNESS);
/*--------------------------------------------------------------------------*/
// (7)
half4 dir2_pos;
@@ -2061,7 +2061,7 @@ half4 FxaaPixelShader(
temp2N = h4tex2Dlod(tex, half4(temp2N.xy, 0.0, 0.0));
half4 rgby2;
rgby2.xy = dir2_pos.zw + dir2_pos.xy * fxaaConsoleRcpFrameOpt2.zw;
- half lumaRangeM = (lumaMaxM - lumaMinM) / FXAA_CONSOLE__PS3_EDGE_THRESHOLD;
+ half lumaRangeM = (lumaMaxM - lumaMinM) / FXAA_CONSOLE_M_PS3_EDGE_THRESHOLD;
/*--------------------------------------------------------------------------*/
// (12)
rgby2 = h4tex2Dlod(tex, half4(rgby2.xy, 0.0, 0.0));
diff --git a/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl
index 236567219..d45d41f8e 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl
@@ -23,7 +23,7 @@
* $/LicenseInfo$
*/
-#extension GL_ARB_texture_rectangle : enable
+//#extension GL_ARB_texture_rectangle : enable
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color;
diff --git a/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl
index 0e6ab80d4..2e01174e3 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl
@@ -31,8 +31,8 @@ out vec4 frag_color;
//class 1 -- no shadows
-#extension GL_ARB_texture_rectangle : enable
-#extension GL_ARB_shader_texture_lod : enable
+//#extension GL_ARB_texture_rectangle : enable
+//#extension GL_ARB_shader_texture_lod : enable
uniform sampler2DRect diffuseRect;
uniform sampler2DRect specularRect;
diff --git a/indra/newview/app_settings/shaders/class1/deferred/normgenF.glsl b/indra/newview/app_settings/shaders/class1/deferred/normgenF.glsl
index 62cfa5c31..1291cfe97 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/normgenF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/normgenF.glsl
@@ -23,7 +23,7 @@
* $/LicenseInfo$
*/
-#extension GL_ARB_texture_rectangle : enable
+//#extension GL_ARB_texture_rectangle : enable
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color;
diff --git a/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl
index 106d48bd7..4d6cfa487 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl
@@ -23,7 +23,7 @@
* $/LicenseInfo$
*/
-#extension GL_ARB_texture_rectangle : enable
+//#extension GL_ARB_texture_rectangle : enable
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color;
diff --git a/indra/newview/app_settings/shaders/class1/deferred/postDeferredF.glsl b/indra/newview/app_settings/shaders/class1/deferred/postDeferredF.glsl
index bf362e21a..46ab281fd 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/postDeferredF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/postDeferredF.glsl
@@ -23,7 +23,7 @@
* $/LicenseInfo$
*/
-#extension GL_ARB_texture_rectangle : enable
+//#extension GL_ARB_texture_rectangle : enable
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color;
diff --git a/indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl b/indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl
index 126f17fab..690744352 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl
@@ -23,7 +23,7 @@
* $/LicenseInfo$
*/
-#extension GL_ARB_texture_rectangle : enable
+//#extension GL_ARB_texture_rectangle : enable
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color;
diff --git a/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFF.glsl b/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFF.glsl
index eb5beeef3..b4e2ecfcc 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFF.glsl
@@ -23,7 +23,7 @@
* $/LicenseInfo$
*/
-#extension GL_ARB_texture_rectangle : enable
+//#extension GL_ARB_texture_rectangle : enable
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color;
diff --git a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl
index 430bad84a..7e149fae8 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl
@@ -23,8 +23,8 @@
* $/LicenseInfo$
*/
-#extension GL_ARB_texture_rectangle : enable
-#extension GL_ARB_shader_texture_lod : enable
+//#extension GL_ARB_texture_rectangle : enable
+//#extension GL_ARB_shader_texture_lod : enable
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color;
diff --git a/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl
index 8d8a6c9dd..f9fbca47f 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl
@@ -23,8 +23,8 @@
* $/LicenseInfo$
*/
-#extension GL_ARB_texture_rectangle : enable
-#extension GL_ARB_shader_texture_lod : enable
+//#extension GL_ARB_texture_rectangle : enable
+//#extension GL_ARB_shader_texture_lod : enable
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color;
diff --git a/indra/newview/app_settings/shaders/class1/deferred/sunLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/sunLightF.glsl
index 5ca817aff..bc7837291 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/sunLightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/sunLightF.glsl
@@ -25,7 +25,7 @@
//class 1, no shadow, no SSAO, should never be called
-#extension GL_ARB_texture_rectangle : enable
+//#extension GL_ARB_texture_rectangle : enable
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color;
diff --git a/indra/newview/app_settings/shaders/class1/deferred/sunLightSSAOF.glsl b/indra/newview/app_settings/shaders/class1/deferred/sunLightSSAOF.glsl
index 730f01117..a1ae08bb6 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/sunLightSSAOF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/sunLightSSAOF.glsl
@@ -23,7 +23,7 @@
*/
-#extension GL_ARB_texture_rectangle : enable
+//#extension GL_ARB_texture_rectangle : enable
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color;
diff --git a/indra/newview/app_settings/shaders/class1/deferred/waterF.glsl b/indra/newview/app_settings/shaders/class1/deferred/waterF.glsl
index 4b758772a..4f4d2cd6b 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/waterF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/waterF.glsl
@@ -23,7 +23,7 @@
* $/LicenseInfo$
*/
-#extension GL_ARB_texture_rectangle : enable
+//#extension GL_ARB_texture_rectangle : enable
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_data[3];
diff --git a/indra/newview/app_settings/shaders/class1/effects/MotionBlurF.glsl b/indra/newview/app_settings/shaders/class1/effects/MotionBlurF.glsl
index efa1265a1..f2b4900b4 100644
--- a/indra/newview/app_settings/shaders/class1/effects/MotionBlurF.glsl
+++ b/indra/newview/app_settings/shaders/class1/effects/MotionBlurF.glsl
@@ -5,7 +5,7 @@
* $License$
*/
-#extension GL_ARB_texture_rectangle : enable
+//#extension GL_ARB_texture_rectangle : enable
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color;
diff --git a/indra/newview/app_settings/shaders/class1/effects/PosterizeF.glsl b/indra/newview/app_settings/shaders/class1/effects/PosterizeF.glsl
index 0f8b2f8f2..fe983c258 100644
--- a/indra/newview/app_settings/shaders/class1/effects/PosterizeF.glsl
+++ b/indra/newview/app_settings/shaders/class1/effects/PosterizeF.glsl
@@ -5,7 +5,7 @@
* $License$
*/
-#extension GL_ARB_texture_rectangle : enable
+//#extension GL_ARB_texture_rectangle : enable
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color;
diff --git a/indra/newview/app_settings/shaders/class1/effects/VignetteF.glsl b/indra/newview/app_settings/shaders/class1/effects/VignetteF.glsl
index ad989e1a0..f3a6f4324 100644
--- a/indra/newview/app_settings/shaders/class1/effects/VignetteF.glsl
+++ b/indra/newview/app_settings/shaders/class1/effects/VignetteF.glsl
@@ -5,7 +5,7 @@
* $License$
*/
-#extension GL_ARB_texture_rectangle : enable
+//#extension GL_ARB_texture_rectangle : enable
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color;
diff --git a/indra/newview/app_settings/shaders/class1/effects/colorFilterF.glsl b/indra/newview/app_settings/shaders/class1/effects/colorFilterF.glsl
index 6acd277bb..8a948b119 100644
--- a/indra/newview/app_settings/shaders/class1/effects/colorFilterF.glsl
+++ b/indra/newview/app_settings/shaders/class1/effects/colorFilterF.glsl
@@ -5,7 +5,7 @@
* $License$
*/
-#extension GL_ARB_texture_rectangle : enable
+//#extension GL_ARB_texture_rectangle : enable
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color;
diff --git a/indra/newview/app_settings/shaders/class1/effects/gaussBlurF.glsl b/indra/newview/app_settings/shaders/class1/effects/gaussBlurF.glsl
index 6c56e2108..db12800a3 100644
--- a/indra/newview/app_settings/shaders/class1/effects/gaussBlurF.glsl
+++ b/indra/newview/app_settings/shaders/class1/effects/gaussBlurF.glsl
@@ -1,4 +1,4 @@
-#extension GL_ARB_texture_rectangle : enable
+//#extension GL_ARB_texture_rectangle : enable
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color;
diff --git a/indra/newview/app_settings/shaders/class1/effects/glowExtractF.glsl b/indra/newview/app_settings/shaders/class1/effects/glowExtractF.glsl
index 0f5eb288f..4f3690383 100644
--- a/indra/newview/app_settings/shaders/class1/effects/glowExtractF.glsl
+++ b/indra/newview/app_settings/shaders/class1/effects/glowExtractF.glsl
@@ -23,7 +23,7 @@
* $/LicenseInfo$
*/
-#extension GL_ARB_texture_rectangle : enable
+//#extension GL_ARB_texture_rectangle : enable
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color;
diff --git a/indra/newview/app_settings/shaders/class1/effects/nightVisionF.glsl b/indra/newview/app_settings/shaders/class1/effects/nightVisionF.glsl
index 6257c4e9b..998d8eb18 100644
--- a/indra/newview/app_settings/shaders/class1/effects/nightVisionF.glsl
+++ b/indra/newview/app_settings/shaders/class1/effects/nightVisionF.glsl
@@ -5,7 +5,7 @@
* $License$
*/
-#extension GL_ARB_texture_rectangle : enable
+//#extension GL_ARB_texture_rectangle : enable
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color;
diff --git a/indra/newview/app_settings/shaders/class1/interface/downsampleDepthRectF.glsl b/indra/newview/app_settings/shaders/class1/interface/downsampleDepthRectF.glsl
index 942c5888e..e7a59af2f 100644
--- a/indra/newview/app_settings/shaders/class1/interface/downsampleDepthRectF.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/downsampleDepthRectF.glsl
@@ -23,7 +23,7 @@
* $/LicenseInfo$
*/
-#extension GL_ARB_texture_rectangle : enable
+//#extension GL_ARB_texture_rectangle : enable
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color;
diff --git a/indra/newview/app_settings/shaders/class1/interface/glowcombineF.glsl b/indra/newview/app_settings/shaders/class1/interface/glowcombineF.glsl
index ed803de27..891b971f1 100644
--- a/indra/newview/app_settings/shaders/class1/interface/glowcombineF.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/glowcombineF.glsl
@@ -29,7 +29,7 @@ out vec4 frag_color;
#define frag_color gl_FragColor
#endif
-#extension GL_ARB_texture_rectangle : enable
+//#extension GL_ARB_texture_rectangle : enable
uniform sampler2D glowMap;
uniform sampler2DRect screenMap;
diff --git a/indra/newview/app_settings/shaders/class1/interface/glowcombineFXAAF.glsl b/indra/newview/app_settings/shaders/class1/interface/glowcombineFXAAF.glsl
index 59520bb99..147de39c4 100644
--- a/indra/newview/app_settings/shaders/class1/interface/glowcombineFXAAF.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/glowcombineFXAAF.glsl
@@ -23,7 +23,7 @@
* $/LicenseInfo$
*/
-#extension GL_ARB_texture_rectangle : enable
+//#extension GL_ARB_texture_rectangle : enable
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color;
diff --git a/indra/newview/app_settings/shaders/class1/interface/splattexturerectF.glsl b/indra/newview/app_settings/shaders/class1/interface/splattexturerectF.glsl
index 772bb374e..2e47c0023 100644
--- a/indra/newview/app_settings/shaders/class1/interface/splattexturerectF.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/splattexturerectF.glsl
@@ -23,7 +23,7 @@
* $/LicenseInfo$
*/
-#extension GL_ARB_texture_rectangle : enable
+//#extension GL_ARB_texture_rectangle : enable
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color;
diff --git a/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl
index ac5b7d676..fdb10b151 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl
@@ -23,8 +23,8 @@
* $/LicenseInfo$
*/
-#extension GL_ARB_texture_rectangle : enable
-#extension GL_ARB_shader_texture_lod : enable
+//#extension GL_ARB_texture_rectangle : enable
+//#extension GL_ARB_shader_texture_lod : enable
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color;
diff --git a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl
index 08c235e2b..bcb66dc4c 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl
@@ -23,7 +23,7 @@
* $/LicenseInfo$
*/
-#extension GL_ARB_texture_rectangle : enable
+//#extension GL_ARB_texture_rectangle : enable
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color;
diff --git a/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl
index 7689b72d2..09881d9d7 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl
@@ -23,8 +23,8 @@
* $/LicenseInfo$
*/
-#extension GL_ARB_texture_rectangle : enable
-#extension GL_ARB_shader_texture_lod : enable
+//#extension GL_ARB_texture_rectangle : enable
+//#extension GL_ARB_shader_texture_lod : enable
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color;
diff --git a/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl
index 0bdb21c31..043859894 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl
@@ -23,7 +23,7 @@
* $/LicenseInfo$
*/
-#extension GL_ARB_texture_rectangle : enable
+//#extension GL_ARB_texture_rectangle : enable
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color;
diff --git a/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl b/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl
index 9616da637..2be812200 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl
@@ -22,7 +22,7 @@
* $/LicenseInfo$
*/
-#extension GL_ARB_texture_rectangle : enable
+//#extension GL_ARB_texture_rectangle : enable
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color;
diff --git a/indra/newview/ascentprefschat.cpp b/indra/newview/ascentprefschat.cpp
index 5def0f4bb..d504a38fa 100644
--- a/indra/newview/ascentprefschat.cpp
+++ b/indra/newview/ascentprefschat.cpp
@@ -297,6 +297,7 @@ void LLPrefsAscentChat::refreshValues()
mOneLineConfButt = gSavedSettings.getBOOL("UseConciseConferenceButtons");
mOnlyComm = gSavedSettings.getBOOL("CommunicateSpecificShortcut");
mItalicizeActions = gSavedSettings.getBOOL("LiruItalicizeActions");
+ mLegacyLogLaunch = gSavedSettings.getBOOL("LiruLegacyLogLaunch");
mLegacySpeakerNames = gSavedSettings.getBOOL("LiruLegacySpeakerNames");
//Autoresponse ------------------------------------------------------------------------
@@ -535,6 +536,7 @@ void LLPrefsAscentChat::cancel()
gSavedSettings.setBOOL("UseConciseConferenceButtons", mOneLineConfButt);
gSavedSettings.setBOOL("CommunicateSpecificShortcut", mOnlyComm);
gSavedSettings.setBOOL("LiruItalicizeActions", mItalicizeActions);
+ gSavedSettings.setBOOL("LiruLegacyLogLaunch", mLegacyLogLaunch);
gSavedSettings.setBOOL("LiruLegacySpeakerNames", mLegacySpeakerNames);
//Autoresponse ------------------------------------------------------------------------
diff --git a/indra/newview/ascentprefschat.h b/indra/newview/ascentprefschat.h
index 5e0ecd707..5b235dafa 100644
--- a/indra/newview/ascentprefschat.h
+++ b/indra/newview/ascentprefschat.h
@@ -38,13 +38,13 @@
class LLPrefsAscentChat : public LLPanel
{
public:
- LLPrefsAscentChat();
- ~LLPrefsAscentChat();
+ LLPrefsAscentChat();
+ ~LLPrefsAscentChat();
- void apply();
- void cancel();
- void refresh();
- void refreshValues();
+ void apply();
+ void cancel();
+ void refresh();
+ void refreshValues();
protected:
void onSpellAdd();
@@ -56,26 +56,27 @@ protected:
void onCommitDialogBlock(LLUICtrl* ctrl, const LLSD& value);
void onCommitKeywords(LLUICtrl* ctrl);
- //Chat/IM -----------------------------------------------------------------------------
- BOOL mIMAnnounceIncoming;
- BOOL mHideTypingNotification;
- bool mInstantMessagesFriendsOnly;
- BOOL mShowGroupNameInChatIM;
- bool mShowDisplayNameChanges;
- bool mUseTypingBubbles;
- BOOL mPlayTypingSound;
- BOOL mHideNotificationsInChat;
- BOOL mEnableMUPose;
- BOOL mEnableOOCAutoClose;
- U32 mLinksForChattingObjects;
- U32 mTimeFormat;
- U32 mDateFormat;
- U32 tempTimeFormat;
- U32 tempDateFormat;
- BOOL mSecondsInChatAndIMs;
- BOOL mSecondsInLog;
+private:
+ //Chat/IM -----------------------------------------------------------------------------
+ bool mIMAnnounceIncoming;
+ bool mHideTypingNotification;
+ bool mInstantMessagesFriendsOnly;
+ bool mShowGroupNameInChatIM;
+ bool mShowDisplayNameChanges;
+ bool mUseTypingBubbles;
+ bool mPlayTypingSound;
+ bool mHideNotificationsInChat;
+ bool mEnableMUPose;
+ bool mEnableOOCAutoClose;
+ U32 mLinksForChattingObjects;
+ U32 mTimeFormat;
+ U32 mDateFormat;
+ U32 tempTimeFormat;
+ U32 tempDateFormat;
+ bool mSecondsInChatAndIMs;
+ bool mSecondsInLog;
- //Chat UI -----------------------------------------------------------------------------
+ //Chat UI -----------------------------------------------------------------------------
bool mWoLfVerticalIMTabs;
bool mOtherChatsTornOff;
bool mIMAnnounceStealFocus;
@@ -87,6 +88,7 @@ protected:
bool mOnlyComm;
bool mItalicizeActions;
bool mLegacySpeakerNames;
+ bool mLegacyLogLaunch;
//Autoresponse ------------------------------------------------------------------------
std::string mIMResponseAnyoneItemID;
@@ -94,39 +96,39 @@ protected:
std::string mIMResponseMutedItemID;
std::string mIMResponseBusyItemID;
- //Spam --------------------------------------------------------------------------------
- BOOL mEnableAS;
- BOOL mGlobalQueue;
- U32 mChatSpamCount;
- U32 mChatSpamTime;
- BOOL mBlockDialogSpam;
- BOOL mBlockAlertSpam;
- BOOL mBlockFriendSpam;
- BOOL mBlockGroupNoticeSpam;
- BOOL mBlockGroupInviteSpam;
- BOOL mBlockGroupFeeInviteSpam;
- BOOL mBlockItemOfferSpam;
+ //Spam --------------------------------------------------------------------------------
+ bool mEnableAS;
+ bool mGlobalQueue;
+ U32 mChatSpamCount;
+ U32 mChatSpamTime;
+ bool mBlockDialogSpam;
+ bool mBlockAlertSpam;
+ bool mBlockFriendSpam;
+ bool mBlockGroupNoticeSpam;
+ bool mBlockGroupInviteSpam;
+ bool mBlockGroupFeeInviteSpam;
+ bool mBlockItemOfferSpam;
bool mBlockNotMineSpam;
bool mBlockNotFriendSpam;
- BOOL mBlockScriptSpam;
- BOOL mBlockTeleportSpam;
+ bool mBlockScriptSpam;
+ bool mBlockTeleportSpam;
bool mBlockTeleportRequestSpam;
- BOOL mNotifyOnSpam;
- BOOL mSoundMulti;
- U32 mNewLines;
- U32 mPreloadMulti;
+ bool mNotifyOnSpam;
+ bool mSoundMulti;
+ U32 mNewLines;
+ U32 mPreloadMulti;
bool mEnableGestureSounds;
- //Text Options ------------------------------------------------------------------------
- BOOL mSpellDisplay;
- BOOL mKeywordsOn;
- std::string mKeywordsList;
- BOOL mKeywordsInChat;
- BOOL mKeywordsInIM;
- BOOL mKeywordsChangeColor;
- LLColor4 mKeywordsColor;
- BOOL mKeywordsPlaySound;
- LLUUID mKeywordsSound;
+ //Text Options ------------------------------------------------------------------------
+ bool mSpellDisplay;
+ bool mKeywordsOn;
+ std::string mKeywordsList;
+ bool mKeywordsInChat;
+ bool mKeywordsInIM;
+ bool mKeywordsChangeColor;
+ LLColor4 mKeywordsColor;
+ bool mKeywordsPlaySound;
+ LLUUID mKeywordsSound;
};
#endif
diff --git a/indra/newview/ascentprefssys.cpp b/indra/newview/ascentprefssys.cpp
index 41e17241e..c287fea3e 100644
--- a/indra/newview/ascentprefssys.cpp
+++ b/indra/newview/ascentprefssys.cpp
@@ -222,6 +222,7 @@ void LLPrefsAscentSys::refreshValues()
mEnableClassicClouds = gSavedSettings.getBOOL("SkyUseClassicClouds");
mSpeedRez = gSavedSettings.getBOOL("SpeedRez");
mSpeedRezInterval = gSavedSettings.getU32("SpeedRezInterval");
+ mUseContextMenus = gSavedSettings.getBOOL("LiruUseContextMenus");
mUseWebProfiles = gSavedSettings.getBOOL("UseWebProfiles");
mUseWebSearch = gSavedSettings.getBOOL("UseWebSearch");
@@ -377,6 +378,7 @@ void LLPrefsAscentSys::cancel()
gSavedSettings.setBOOL("SkyUseClassicClouds", mEnableClassicClouds);
gSavedSettings.setBOOL("SpeedRez", mSpeedRez);
gSavedSettings.setU32("SpeedRezInterval", mSpeedRezInterval);
+ gSavedSettings.setBOOL("LiruUseContextMenus", mUseContextMenus);
gSavedSettings.setBOOL("UseWebProfiles", mUseWebProfiles);
gSavedSettings.setBOOL("UseWebSearch", mUseWebSearch);
diff --git a/indra/newview/ascentprefssys.h b/indra/newview/ascentprefssys.h
index 701a8e582..785d14940 100644
--- a/indra/newview/ascentprefssys.h
+++ b/indra/newview/ascentprefssys.h
@@ -38,13 +38,13 @@
class LLPrefsAscentSys : public LLPanel
{
public:
- LLPrefsAscentSys();
- ~LLPrefsAscentSys();
+ LLPrefsAscentSys();
+ ~LLPrefsAscentSys();
- void apply();
- void cancel();
- void refresh();
- void refreshValues();
+ void apply();
+ void cancel();
+ void refresh();
+ void refreshValues();
protected:
void onCommitCheckBox(LLUICtrl* ctrl, const LLSD& value);
@@ -52,61 +52,63 @@ protected:
void onCommitComboBox(LLUICtrl* ctrl, const LLSD& value);
void onCommitTexturePicker(LLUICtrl* ctrl);
- //General -----------------------------------------------------------------------------
- BOOL mDoubleClickTeleport;
- BOOL mResetCameraAfterTP;
- BOOL mOffsetTPByUserHeight;
- bool mClearBeaconAfterTeleport;
- bool mLiruFlyAfterTeleport;
- bool mLiruContinueFlying;
- BOOL mPreviewAnimInWorld;
- BOOL mSaveScriptsAsMono;
- BOOL mAlwaysRezInGroup;
- BOOL mBuildAlwaysEnabled;
- BOOL mAlwaysShowFly;
- BOOL mDisableMinZoom;
- BOOL mPowerUser;
- BOOL mFetchInventoryOnLogin;
- BOOL mEnableLLWind;
- BOOL mEnableClouds;
- BOOL mEnableClassicClouds;
- BOOL mSpeedRez;
- U32 mSpeedRezInterval;
+private:
+ //General -----------------------------------------------------------------------------
+ bool mDoubleClickTeleport;
+ bool mResetCameraAfterTP;
+ bool mOffsetTPByUserHeight;
+ bool mClearBeaconAfterTeleport;
+ bool mLiruFlyAfterTeleport;
+ bool mLiruContinueFlying;
+ bool mPreviewAnimInWorld;
+ bool mSaveScriptsAsMono;
+ bool mAlwaysRezInGroup;
+ bool mBuildAlwaysEnabled;
+ bool mAlwaysShowFly;
+ bool mDisableMinZoom;
+ bool mPowerUser;
+ bool mFetchInventoryOnLogin;
+ bool mEnableLLWind;
+ bool mEnableClouds;
+ bool mEnableClassicClouds;
+ bool mSpeedRez;
+ U32 mSpeedRezInterval;
+ bool mUseContextMenus;
bool mUseWebProfiles;
bool mUseWebSearch;
- //Command Line ------------------------------------------------------------------------
- BOOL mCmdLine;
- std::string mCmdLinePos;
- std::string mCmdLineGround;
- std::string mCmdLineHeight;
- std::string mCmdLineTeleportHome;
- std::string mCmdLineRezPlatform;
- F32 mCmdPlatformSize;
- std::string mCmdLineCalc;
- std::string mCmdLineClearChat;
- std::string mCmdLineDrawDistance;
- std::string mCmdTeleportToCam;
- std::string mCmdLineKeyToName;
- std::string mCmdLineOfferTp;
- std::string mCmdLineMapTo;
- BOOL mCmdMapToKeepPos;
- std::string mCmdLineTP2;
- std::string mCmdLineAway;
+ //Command Line ------------------------------------------------------------------------
+ bool mCmdLine;
+ std::string mCmdLinePos;
+ std::string mCmdLineGround;
+ std::string mCmdLineHeight;
+ std::string mCmdLineTeleportHome;
+ std::string mCmdLineRezPlatform;
+ F32 mCmdPlatformSize;
+ std::string mCmdLineCalc;
+ std::string mCmdLineClearChat;
+ std::string mCmdLineDrawDistance;
+ std::string mCmdTeleportToCam;
+ std::string mCmdLineKeyToName;
+ std::string mCmdLineOfferTp;
+ std::string mCmdLineMapTo;
+ bool mCmdMapToKeepPos;
+ std::string mCmdLineTP2;
+ std::string mCmdLineAway;
std::string mCmdLineURL;
- //Security ----------------------------------------------------------------------------
- BOOL mBroadcastViewerEffects;
- BOOL mDisablePointAtAndBeam;
- BOOL mPrivateLookAt;
- BOOL mShowLookAt;
- BOOL mQuietSnapshotsToDisk;
- BOOL mDetachBridge;
- BOOL mRevokePermsOnStandUp;
- BOOL mDisableClickSit;
+ //Security ----------------------------------------------------------------------------
+ bool mBroadcastViewerEffects;
+ bool mDisablePointAtAndBeam;
+ bool mPrivateLookAt;
+ bool mShowLookAt;
+ bool mQuietSnapshotsToDisk;
+ bool mDetachBridge;
+ bool mRevokePermsOnStandUp;
+ bool mDisableClickSit;
bool mDisableClickSitOtherOwner;
- BOOL mDisplayScriptJumps;
- F32 mNumScriptDiff;
+ bool mDisplayScriptJumps;
+ F32 mNumScriptDiff;
//Build -------------------------------------------------------------------------------
F32 mAlpha;
@@ -115,14 +117,14 @@ protected:
F32 mGlow;
std::string mItem;
std::string mMaterial;
- BOOL mNextCopy;
- BOOL mNextMod;
- BOOL mNextTrans;
+ bool mNextCopy;
+ bool mNextMod;
+ bool mNextTrans;
std::string mShiny;
- BOOL mTemporary;
+ bool mTemporary;
std::string mTexture;
- BOOL mPhantom;
- BOOL mPhysical;
+ bool mPhantom;
+ bool mPhysical;
F32 mXsize;
F32 mYsize;
F32 mZsize;
diff --git a/indra/newview/ascentprefsvan.h b/indra/newview/ascentprefsvan.h
index 77285b23d..edbe2cefb 100644
--- a/indra/newview/ascentprefsvan.h
+++ b/indra/newview/ascentprefsvan.h
@@ -38,24 +38,26 @@
class LLPrefsAscentVan : public LLPanel
{
public:
- LLPrefsAscentVan();
- ~LLPrefsAscentVan();
+ LLPrefsAscentVan();
+ ~LLPrefsAscentVan();
- void apply();
- void cancel();
- void refresh();
- void refreshValues();
+ void apply();
+ void cancel();
+ void refresh();
+ void refreshValues();
protected:
void onCommitClientTag(LLUICtrl* ctrl);
void onCommitCheckBox(LLUICtrl* ctrl, const LLSD& value);
void onCommitTextModified(LLUICtrl* ctrl, const LLSD& value);
static void onManualClientUpdate();
- //Main
- BOOL mUseAccountSettings;
- BOOL mShowTPScreen;
- BOOL mPlayTPSound;
- BOOL mShowLogScreens;
+
+private:
+ //Main
+ bool mUseAccountSettings;
+ bool mShowTPScreen;
+ bool mPlayTPSound;
+ bool mShowLogScreens;
bool mDisableChatAnimation;
bool mAddNotReplace;
bool mTurnAround;
@@ -64,41 +66,38 @@ protected:
bool mUnfocusedFloatersOpaque;
bool mCompleteNameProfiles;
bool mScriptErrorsStealFocus;
- //Tags\Colors
- BOOL mAscentBroadcastTag;
- std::string mReportClientUUID;
- U32 mSelectedClient;
- BOOL mShowSelfClientTag;
- BOOL mShowSelfClientTagColor;
- BOOL mShowFriendsTag;
- BOOL mDisplayClientTagOnNewLine;
- BOOL mCustomTagOn;
- std::string mCustomTagLabel;
- LLColor4 mCustomTagColor;
- BOOL mShowOthersTag;
- BOOL mShowOthersTagColor;
- BOOL mShowIdleTime;
- BOOL mUseStatusColors;
- BOOL mUpdateTagsOnLoad;
- LLColor4 mEffectColor;
- LLColor4 mFriendColor;
- LLColor4 mEstateOwnerColor;
- LLColor4 mLindenColor;
- LLColor4 mMutedColor;
+ //Tags\Colors
+ bool mAscentBroadcastTag;
+ std::string mReportClientUUID;
+ U32 mSelectedClient;
+ bool mShowSelfClientTag;
+ bool mShowSelfClientTagColor;
+ bool mShowFriendsTag;
+ bool mDisplayClientTagOnNewLine;
+ bool mCustomTagOn;
+ std::string mCustomTagLabel;
+ LLColor4 mCustomTagColor;
+ bool mShowOthersTag;
+ bool mShowOthersTagColor;
+ bool mShowIdleTime;
+ bool mUseStatusColors;
+ bool mUpdateTagsOnLoad;
+ LLColor4 mEffectColor;
+ LLColor4 mFriendColor;
+ LLColor4 mEstateOwnerColor;
+ LLColor4 mLindenColor;
+ LLColor4 mMutedColor;
LLColor4 mMapAvatarColor;
LLColor4 mCustomColor;
bool mColorFriendChat;
bool mColorEOChat;
bool mColorLindenChat;
bool mColorMutedChat;
-// bool mColorCustomChat;
-
- F32 mAvatarXModifier;
- F32 mAvatarYModifier;
- F32 mAvatarZModifier;
-
-private:
+ // bool mColorCustomChat;
+ F32 mAvatarXModifier;
+ F32 mAvatarYModifier;
+ F32 mAvatarZModifier;
};
#endif
diff --git a/indra/newview/awavefront.cpp b/indra/newview/awavefront.cpp
index 4af106c12..ee83dbb3d 100644
--- a/indra/newview/awavefront.cpp
+++ b/indra/newview/awavefront.cpp
@@ -275,6 +275,13 @@ namespace
{
if (LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection())
{
+ if (!selection->getFirstRootObject())
+ {
+ if (gSavedSettings.getBOOL("OBJExportNotifyFailed"))
+ LLNotificationsUtil::add("ExportFailed");
+ return true;
+ }
+
WavefrontSaver* wfsaver = new WavefrontSaver; // deleted in callback
wfsaver->offset = -selection->getFirstRootObject()->getRenderPosition();
S32 total = 0;
diff --git a/indra/newview/daeexport.cpp b/indra/newview/daeexport.cpp
index 8c8aa3641..7768aa541 100644
--- a/indra/newview/daeexport.cpp
+++ b/indra/newview/daeexport.cpp
@@ -272,7 +272,9 @@ public:
void addSelectedObjects()
{
- if (LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection())
+ LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection();
+
+ if (selection && selection->getFirstRootObject())
{
mSaver.mOffset = -selection->getFirstRootObject()->getRenderPosition();
mObjectName = selection->getFirstRootNode()->mName;
@@ -285,14 +287,15 @@ public:
if (!node->getObject()->getVolume() || !DAEExportUtil::canExportNode(node)) continue;
mSaver.add(node->getObject(), node->mName);
}
+ }
- if (mSaver.mObjects.empty())
- {
- LLNotificationsUtil::add("ExportFailed");
- close();
- return;
- }
-
+ if (mSaver.mObjects.empty())
+ {
+ LLNotificationsUtil::add("ExportFailed");
+ close();
+ }
+ else
+ {
mSaver.updateTextureInfo();
mNumTextures = mSaver.mTextures.size();
mNumExportableTextures = getNumExportableTextures();
diff --git a/indra/newview/featuretable_linux.txt b/indra/newview/featuretable_linux.txt
index bcc930a44..90b788f4f 100644
--- a/indra/newview/featuretable_linux.txt
+++ b/indra/newview/featuretable_linux.txt
@@ -1,4 +1,4 @@
-version 27
+version 28
// NOTE: This is mostly identical to featuretable_mac.txt with a few differences
// Should be combined into one table
@@ -301,7 +301,7 @@ RenderObjectBump 0 0
list OpenGLPre15
RenderVBOEnable 1 0
-list Intel
+list IntelPre30
RenderAnisotropic 1 0
// Avoid some Intel crashes on Linux
RenderCubeMap 0 0
diff --git a/indra/newview/gpu_table.txt b/indra/newview/gpu_table.txt
index 7fa0e9531..af1a861ca 100644
--- a/indra/newview/gpu_table.txt
+++ b/indra/newview/gpu_table.txt
@@ -301,7 +301,11 @@ Intel Eaglelake .*Intel.*Eaglelake.* 0 1
Intel Graphics Media HD .*Intel.*Graphics Media.*HD.* 0 1
Intel HD Graphics 2000 .*Intel.*HD Graphics 2000.* 1 1
Intel HD Graphics 3000 .*Intel.*HD Graphics 3000.* 2 1
+Intel HD Graphics 3000 .*Intel.*Sandybridge.* 2 1
Intel HD Graphics 4000 .*Intel.*HD Graphics 4000.* 2 1
+Intel HD Graphics 4000 .*Intel.*Ivybridge.* 2 1
+Intel HD Graphics 5000 .*Intel.*HD Graphics 5.* 2 1
+Intel HD Graphics 5000 .*Intel.*Haswell.* 2 1
Intel HD Graphics .*Intel.*HD Graphics.* 2 1
Intel Mobile 4 Series .*Intel.*Mobile.* 4 Series.* 0 1
Intel Media Graphics HD .*Intel.*Media Graphics HD.* 0 1
@@ -312,6 +316,7 @@ Intel HD Graphics 2000 .*Intel.*HD2000.* 1 1
Intel HD Graphics 3000 .*Intel.*HD3000.* 2 1
Matrox .*Matrox.* 0 0
Mesa .*Mesa.* 0 0
+Gallium .*Gallium.* 1 1
NVIDIA 205 .*NVIDIA .*GeForce 205.* 2 1
NVIDIA 210 .*NVIDIA .*GeForce 210.* 2 1
NVIDIA 310M .*NVIDIA .*GeForce 310M.* 1 1
@@ -407,6 +412,12 @@ NVIDIA GTX 670 .*NVIDIA .*GTX *67.* 3 1
NVIDIA GTX 680M .*NVIDIA .*GTX *680M.* 3 1
NVIDIA GTX 680 .*NVIDIA .*GTX *68.* 3 1
NVIDIA GTX 690 .*NVIDIA .*GTX *69.* 3 1
+NVIDIA GTX 750 .*NVIDIA .*GTX *75.* 3 1
+NVIDIA GTX 760 .*NVIDIA .*GTX *76.* 3 1
+NVIDIA GTX 770 .*NVIDIA .*GTX *77.* 3 1
+NVIDIA GTX 780 .*NVIDIA .*GTX *78.* 3 1
+NVIDIA GTX TITAN .*NVIDIA .*GTX *TITAN.* 3 1
+NVIDIA GT 7xxM .*NVIDIA .*GT *7.* 3 1
NVIDIA C51 .*NVIDIA .*C51.* 0 1
NVIDIA G72 .*NVIDIA .*G72.* 1 1
NVIDIA G73 .*NVIDIA .*G73.* 1 1
diff --git a/indra/newview/installers/windows/installer_template.nsi b/indra/newview/installers/windows/installer_template.nsi
index 8fa0a943c..e78317e3f 100644
--- a/indra/newview/installers/windows/installer_template.nsi
+++ b/indra/newview/installers/windows/installer_template.nsi
@@ -35,6 +35,14 @@ RequestExecutionLevel admin ; on Vista we must be admin because we write to Prog
%%GRID_VARS%%
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Alows us to determine if we're running on 64 bit OS; ${If} macros
+!include "x64.nsh"
+!include "LogicLib.nsh"
+
+;; are 64 bit binaries packaged in this installer
+%%WIN64_BIN_BUILD%%
+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; - language files - one for each language (or flavor thereof)
;; (these files are in the same place as the nsi template but the python script generates a new nsi file in the
@@ -63,7 +71,7 @@ LangString LanguageCode ${LANG_DUTCH} "nl"
LangString LanguageCode ${LANG_PORTUGUESEBR} "pt"
LangString LanguageCode ${LANG_SIMPCHINESE} "zh"
-Name ${VIEWERNAME}
+Name "${VIEWERNAME}"
SubCaption 0 $(LicenseSubTitleSetup) ; override "license agreement" text
@@ -71,7 +79,7 @@ BrandingText "Prepare to Implode!" ; bottom of window text
Icon %%SOURCE%%\installers\windows\install_icon_singularity.ico
UninstallIcon %%SOURCE%%\installers\windows\uninstall_icon_singularity.ico
WindowIcon off ; show our icon in left corner
-BGGradient 9090b0 000000 notext
+# BGGradient 9090b0 000000 notext
CRCCheck on ; make sure CRC is OK
#InstProgressFlags smooth colored ; new colored smooth look
InstProgressFlags
@@ -80,7 +88,7 @@ ShowInstDetails show ; no details, no "show" button
SetOverwrite on ; stomp files by default
AutoCloseWindow true ; after all files install, close window
-InstallDir "$PROGRAMFILES\${INSTNAME}"
+InstallDir "%%INSTALLDIR%%"
InstallDirRegKey HKEY_LOCAL_MACHINE "SOFTWARE\Linden Research, Inc.\${INSTNAME}" ""
DirText $(DirectoryChooseTitle) $(DirectoryChooseSetup)
@@ -664,6 +672,12 @@ FunctionEnd
;; entry to the language ID selector below
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Function .onInit
+!ifdef WIN64_BIN_BUILD
+ ${IfNot} ${RunningX64}
+ MessageBox MB_OK|MB_ICONSTOP "This version requires 64 bit operating sytem."
+ Quit
+ ${EndIf}
+!endif
Push $0
${GetParameters} $COMMANDLINE ; get our command line
${GetOptions} $COMMANDLINE "/LANGID=" $0 ; /LANGID=1033 implies US English
diff --git a/indra/newview/linux_tools/wrapper.sh b/indra/newview/linux_tools/wrapper.sh
index 6bd4acf33..9dd8caf36 100755
--- a/indra/newview/linux_tools/wrapper.sh
+++ b/indra/newview/linux_tools/wrapper.sh
@@ -77,7 +77,9 @@ fi
export SDL_VIDEO_X11_DGAMOUSE=0
## - Works around a problem with misconfigured 64-bit systems not finding GL
-export LIBGL_DRIVERS_PATH="${LIBGL_DRIVERS_PATH}":/usr/lib64/dri:/usr/lib32/dri:/usr/lib/dri
+# This is less needed nowadays; don't uncomment this unless LibGL can't find your
+# drivers automatically.
+#export LIBGL_DRIVERS_PATH="${LIBGL_DRIVERS_PATH}":/usr/lib64/dri:/usr/lib32/dri:/usr/lib/dri
## - The 'scim' GTK IM module widely crashes the viewer. Avoid it.
if [ "$GTK_IM_MODULE" = "scim" ]; then
diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp
index d6188bcc0..081e3b65f 100644
--- a/indra/newview/llagent.cpp
+++ b/indra/newview/llagent.cpp
@@ -84,6 +84,7 @@
#include "llworld.h"
#include "llworldmap.h"
#include "llworldmapmessage.h"
+#include "../lscript/lscript_byteformat.h"
//Misc non-standard includes
#include "llurldispatcher.h"
@@ -3061,7 +3062,7 @@ LLQuaternion LLAgent::getHeadRotation()
return rot;
}
-void LLAgent::sendAnimationRequests(LLDynamicArray &anim_ids, EAnimRequest request)
+void LLAgent::sendAnimationRequests(const std::vector &anim_ids, EAnimRequest request)
{
if (gAgentID.isNull())
{
@@ -3076,7 +3077,7 @@ void LLAgent::sendAnimationRequests(LLDynamicArray &anim_ids, EAnimReque
msg->addUUIDFast(_PREHASH_AgentID, getID());
msg->addUUIDFast(_PREHASH_SessionID, getSessionID());
- for (S32 i = 0; i < anim_ids.count(); i++)
+ for (U32 i = 0; i < anim_ids.size(); i++)
{
if (anim_ids[i].isNull())
{
@@ -3118,6 +3119,55 @@ void LLAgent::sendAnimationRequest(const LLUUID &anim_id, EAnimRequest request)
sendReliableMessage();
}
+// Send a message to the region to stop the NULL animation state
+// This will reset animation state overrides for the agent.
+void LLAgent::sendAnimationStateReset()
+{
+ if (gAgentID.isNull() || !mRegionp)
+ {
+ return;
+ }
+
+ LLMessageSystem* msg = gMessageSystem;
+ msg->newMessageFast(_PREHASH_AgentAnimation);
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, getID());
+ msg->addUUIDFast(_PREHASH_SessionID, getSessionID());
+
+ msg->nextBlockFast(_PREHASH_AnimationList);
+ msg->addUUIDFast(_PREHASH_AnimID, LLUUID::null );
+ msg->addBOOLFast(_PREHASH_StartAnim, FALSE);
+
+ msg->nextBlockFast(_PREHASH_PhysicalAvatarEventList);
+ msg->addBinaryDataFast(_PREHASH_TypeData, NULL, 0);
+ sendReliableMessage();
+}
+
+
+// Send a message to the region to revoke sepecified permissions on ALL scripts in the region
+// If the target is an object in the region, permissions in scripts on that object are cleared.
+// If it is the region ID, all scripts clear the permissions for this agent
+void LLAgent::sendRevokePermissions(const LLUUID & target, U32 permissions)
+{
+ // Currently only the bits for SCRIPT_PERMISSION_TRIGGER_ANIMATION and SCRIPT_PERMISSION_OVERRIDE_ANIMATIONS
+ // are supported by the server. Sending any other bits will cause the message to be dropped without changing permissions
+
+ if (gAgentID.notNull() && gMessageSystem)
+ {
+ LLMessageSystem* msg = gMessageSystem;
+ msg->newMessageFast(_PREHASH_RevokePermissions);
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, getID()); // Must be our ID
+ msg->addUUIDFast(_PREHASH_SessionID, getSessionID());
+
+ msg->nextBlockFast(_PREHASH_Data);
+ msg->addUUIDFast(_PREHASH_ObjectID, target); // Must be in the region
+ msg->addU32Fast(_PREHASH_ObjectPermissions, permissions);
+
+ sendReliableMessage();
+ }
+}
+
// [RLVa:KB] - Checked: 2011-05-11 (RLVa-1.3.0i) | Added: RLVa-1.3.0i
void LLAgent::setAlwaysRun()
{
@@ -4338,6 +4388,8 @@ void LLAgent::stopCurrentAnimations()
// avatar, propagating this change back to the server.
if (isAgentAvatarValid())
{
+ std::vector anim_ids;
+
for ( LLVOAvatar::AnimIterator anim_it =
gAgentAvatarp->mPlayingAnimations.begin();
anim_it != gAgentAvatarp->mPlayingAnimations.end();
@@ -4355,7 +4407,24 @@ void LLAgent::stopCurrentAnimations()
// stop this animation locally
gAgentAvatarp->stopMotion(anim_it->first, TRUE);
// ...and tell the server to tell everyone.
- sendAnimationRequest(anim_it->first, ANIM_REQUEST_STOP);
+ anim_ids.push_back(anim_it->first);
+ }
+ }
+
+ sendAnimationRequests(anim_ids, ANIM_REQUEST_STOP);
+
+ // Tell the region to clear any animation state overrides
+ sendAnimationStateReset();
+
+ // Revoke all animation permissions
+ if (mRegionp &&
+ gSavedSettings.getBOOL("RevokePermsOnStopAnimation"))
+ {
+ U32 permissions = LSCRIPTRunTimePermissionBits[SCRIPT_PERMISSION_TRIGGER_ANIMATION] | LSCRIPTRunTimePermissionBits[SCRIPT_PERMISSION_OVERRIDE_ANIMATIONS];
+ sendRevokePermissions(mRegionp->getRegionID(), permissions);
+ if (gAgentAvatarp->isSitting())
+ { // Also stand up, since auto-granted sit animation permission has been revoked
+ gAgent.standUp();
}
}
diff --git a/indra/newview/llagent.h b/indra/newview/llagent.h
index 8a01093bf..26501953a 100644
--- a/indra/newview/llagent.h
+++ b/indra/newview/llagent.h
@@ -464,8 +464,11 @@ public:
void stopCurrentAnimations();
void requestStopMotion(LLMotion* motion);
void onAnimStop(const LLUUID& id);
- void sendAnimationRequests(LLDynamicArray &anim_ids, EAnimRequest request);
+ void sendAnimationRequests(const std::vector &anim_ids, EAnimRequest request);
void sendAnimationRequest(const LLUUID &anim_id, EAnimRequest request);
+ void sendAnimationStateReset();
+ void sendRevokePermissions(const LLUUID & target, U32 permissions);
+
void endAnimationUpdateUI();
void unpauseAnimation() { mPauseRequest = NULL; }
BOOL getCustomAnim() const { return mCustomAnim; }
diff --git a/indra/newview/llagentcamera.cpp b/indra/newview/llagentcamera.cpp
index 05b3bd6df..5f979de31 100644
--- a/indra/newview/llagentcamera.cpp
+++ b/indra/newview/llagentcamera.cpp
@@ -2022,6 +2022,22 @@ LLVector3 LLAgentCamera::getCameraOffsetInitial()
return convert_from_llsd(mCameraOffsetInitial[mCameraPreset]->get(), TYPE_VEC3, "");
}
+// Adds change to vector CachedControl, vec, at idx
+template
+void change_vec(const T& change, LLCachedControl& vec, const U32& idx = VZ)
+{
+ Vec changed(vec);
+ changed[idx] += change;
+ vec = changed;
+}
+// Same as above, but for ControlVariables
+template
+void change_vec(const T& change, LLPointer& vec, const U32& idx = VZ)
+{
+ Vec changed(vec->get());
+ changed[idx] += change;
+ vec->set(changed.getValue());
+}
//-----------------------------------------------------------------------------
// handleScrollWheel()
@@ -2057,6 +2073,23 @@ void LLAgentCamera::handleScrollWheel(S32 clicks)
}
else if (mFocusOnAvatar && (mCameraMode == CAMERA_MODE_THIRD_PERSON))
{
+ if (MASK mask = gKeyboard->currentMask(true)) // Singu Note: Conveniently set view offsets while modifier keys are held during scroll
+ {
+ static const LLCachedControl enableCameraOffsetScroll("SinguOffsetScrollKeys");
+ if (mask & MASK_CONTROL|MASK_SHIFT && enableCameraOffsetScroll)
+ {
+ const F32 change(static_cast(clicks) * 0.1f);
+ if (mask & MASK_SHIFT)
+ {
+ change_vec(change, mFocusOffsetInitial[mCameraPreset]);
+ }
+ if (mask & MASK_CONTROL)
+ {
+ change_vec(change, mCameraOffsetInitial[mCameraPreset]);
+ }
+ return;
+ }
+ }
F32 camera_offset_initial_mag = getCameraOffsetInitial().magVec();
static const LLCachedControl camera_offset_scale("CameraOffsetScale");
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index 6be1d5c96..6449b376d 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -2625,7 +2625,11 @@ void LLAppViewer::writeSystemInfo()
gDebugInfo["ClientInfo"]["MinorVersion"] = gVersionMinor;
gDebugInfo["ClientInfo"]["PatchVersion"] = gVersionPatch;
gDebugInfo["ClientInfo"]["BuildVersion"] = gVersionBuild;
-
+#if defined(_WIN64) || defined(__x86_64__)
+ gDebugInfo["ClientInfo"]["Architecture"] = "x86_64";
+#else
+ gDebugInfo["ClientInfo"]["Architecture"] = "i386";
+#endif
gDebugInfo["CAFilename"] = gDirUtilp->getCAFile();
gDebugInfo["CPUInfo"]["CPUString"] = gSysCPU.getCPUString();
diff --git a/indra/newview/llappviewerwin32.cpp b/indra/newview/llappviewerwin32.cpp
index a61f617c0..7d16a5340 100644
--- a/indra/newview/llappviewerwin32.cpp
+++ b/indra/newview/llappviewerwin32.cpp
@@ -53,6 +53,11 @@
#include "llviewercontrol.h"
#include "lldxhardware.h"
+#include "nvapi/nvapi.h"
+#include "nvapi/NvApiDriverSettings.h"
+
+#include
+
#include "llweb.h"
#include "llsecondlifeurls.h"
@@ -80,6 +85,19 @@ extern "C" {
const std::string LLAppViewerWin32::sWindowClass = "Second Life";
+/*
+ This function is used to print to the command line a text message
+ describing the nvapi error and quits
+*/
+void nvapi_error(NvAPI_Status status)
+{
+ NvAPI_ShortString szDesc = {0};
+ NvAPI_GetErrorMessage(status, szDesc);
+ llwarns << szDesc << llendl;
+
+ //should always trigger when asserts are enabled
+ //llassert(status == NVAPI_OK);
+}
// Create app mutex creates a unique global windows object.
// If the object can be created it returns true, otherwise
@@ -102,6 +120,79 @@ bool create_app_mutex()
return result;
}
+void ll_nvapi_init(NvDRSSessionHandle hSession)
+{
+ // (2) load all the system settings into the session
+ NvAPI_Status status = NvAPI_DRS_LoadSettings(hSession);
+ if (status != NVAPI_OK)
+ {
+ nvapi_error(status);
+ return;
+ }
+
+ NvAPI_UnicodeString profile_name;
+ //std::string app_name = LLTrans::getString("APP_NAME");
+ std::string app_name("Second Life"); //
+ llutf16string w_app_name = utf8str_to_utf16str(app_name);
+ wsprintf(profile_name, L"%s", w_app_name.c_str());
+ status = NvAPI_DRS_SetCurrentGlobalProfile(hSession, profile_name);
+ if (status != NVAPI_OK)
+ {
+ nvapi_error(status);
+ return;
+ }
+
+ // (3) Obtain the current profile.
+ NvDRSProfileHandle hProfile = 0;
+ status = NvAPI_DRS_GetCurrentGlobalProfile(hSession, &hProfile);
+ if (status != NVAPI_OK)
+ {
+ nvapi_error(status);
+ return;
+ }
+
+ // load settings for querying
+ status = NvAPI_DRS_LoadSettings(hSession);
+ if (status != NVAPI_OK)
+ {
+ nvapi_error(status);
+ return;
+ }
+
+ //get the preferred power management mode for Second Life
+ NVDRS_SETTING drsSetting = {0};
+ drsSetting.version = NVDRS_SETTING_VER;
+ status = NvAPI_DRS_GetSetting(hSession, hProfile, PREFERRED_PSTATE_ID, &drsSetting);
+ if (status == NVAPI_SETTING_NOT_FOUND)
+ { //only override if the user hasn't specifically set this setting
+ // (4) Specify that we want the VSYNC disabled setting
+ // first we fill the NVDRS_SETTING struct, then we call the function
+ drsSetting.version = NVDRS_SETTING_VER;
+ drsSetting.settingId = PREFERRED_PSTATE_ID;
+ drsSetting.settingType = NVDRS_DWORD_TYPE;
+ drsSetting.u32CurrentValue = PREFERRED_PSTATE_PREFER_MAX;
+ status = NvAPI_DRS_SetSetting(hSession, hProfile, &drsSetting);
+ if (status != NVAPI_OK)
+ {
+ nvapi_error(status);
+ return;
+ }
+
+ // (5) Now we apply (or save) our changes to the system
+ status = NvAPI_DRS_SaveSettings(hSession);
+ if (status != NVAPI_OK)
+ {
+ nvapi_error(status);
+ return;
+ }
+ }
+ else if (status != NVAPI_OK)
+ {
+ nvapi_error(status);
+ return;
+ }
+}
+
//#define DEBUGGING_SEH_FILTER 1
#if DEBUGGING_SEH_FILTER
# define WINMAIN DebuggingWinMain
@@ -158,6 +249,27 @@ int APIENTRY WINMAIN(HINSTANCE hInstance,
return -1;
}
+ NvAPI_Status status;
+
+ // Initialize NVAPI
+ status = NvAPI_Initialize();
+ NvDRSSessionHandle hSession = 0;
+
+ if (status == NVAPI_OK)
+ {
+ // Create the session handle to access driver settings
+ status = NvAPI_DRS_CreateSession(&hSession);
+ if (status != NVAPI_OK)
+ {
+ nvapi_error(status);
+ }
+ else
+ {
+ //override driver setting as needed
+ ll_nvapi_init(hSession);
+ }
+ }
+
// Have to wait until after logging is initialized to display LFH info
if (num_heaps > 0)
{
@@ -225,6 +337,15 @@ int APIENTRY WINMAIN(HINSTANCE hInstance,
LLAppViewer::sUpdaterInfo = NULL ;
}
+
+
+ // (NVAPI) (6) We clean up. This is analogous to doing a free()
+ if (hSession)
+ {
+ NvAPI_DRS_DestroySession(hSession);
+ hSession = 0;
+ }
+
return 0;
}
@@ -523,61 +644,7 @@ bool LLAppViewerWin32::restoreErrorTrap()
void LLAppViewerWin32::initCrashReporting(bool reportFreeze)
{
- /* Singu Note: don't fork the crash logger on start
- const char* logger_name = "win_crash_logger.exe";
- std::string exe_path = gDirUtilp->getExecutableDir();
- exe_path += gDirUtilp->getDirDelimiter();
- exe_path += logger_name;
-
- std::stringstream pid_str;
- pid_str << LLApp::getPid();
- std::string logdir = gDirUtilp->getExpandedFilename(LL_PATH_DUMP, "");
- std::string appname = gDirUtilp->getExecutableFilename();
-
- S32 slen = logdir.length() -1;
- S32 end = slen;
- while (logdir.at(end) == '/' || logdir.at(end) == '\\') end--;
-
- if (slen !=end)
- {
- logdir = logdir.substr(0,end+1);
- }
- std::string arg_str = "\"" + exe_path + "\" -dumpdir \"" + logdir + "\" -procname \"" + appname + "\" -pid " + pid_str.str();
- llinfos << "spawning " << arg_str << llendl;
- _spawnl(_P_NOWAIT, exe_path.c_str(), arg_str.c_str(), NULL);
- */
-
-/* STARTUPINFO siStartupInfo;
-
- std::string arg_str = "-dumpdir \"" + logdir + "\" -procname \"" + appname + "\" -pid " + pid_str.str();
-
- memset(&siStartupInfo, 0, sizeof(siStartupInfo));
- memset(&mCrashReporterProcessInfo, 0, sizeof(mCrashReporterProcessInfo));
-
- siStartupInfo.cb = sizeof(siStartupInfo);
-
- std::wstring exe_wstr;
- exe_wstr.assign(exe_path.begin(), exe_path.end());
-
- std::wstring arg_wstr;
- arg_wstr.assign(arg_str.begin(), arg_str.end());
-
- if(CreateProcess(&exe_wstr[0],
- &arg_wstr[0], // Application arguments
- 0,
- 0,
- FALSE,
- CREATE_DEFAULT_ERROR_MODE,
- 0,
- 0, // Working directory
- &siStartupInfo,
- &mCrashReporterProcessInfo) == FALSE)
- // Could not start application -> call 'GetLastError()'
- {
- //llinfos << "CreateProcess failed " << GetLastError() << llendl;
- return;
- }
- */
+ // Singu Note: we don't fork the crash logger on start
}
//virtual
diff --git a/indra/newview/llcrashlogger.cpp b/indra/newview/llcrashlogger.cpp
index ad96ba19c..d79db0fae 100644
--- a/indra/newview/llcrashlogger.cpp
+++ b/indra/newview/llcrashlogger.cpp
@@ -40,7 +40,10 @@
#include "llhttpclient.h"
#include "llsdserialize.h"
#include "llproxy.h"
+#include "llwindow.h"
+#include "lltrans.h"
#include "aistatemachine.h"
+#include "boost/filesystem.hpp"
class AIHTTPTimeoutPolicy;
extern AIHTTPTimeoutPolicy crashLoggerResponder_timeout;
@@ -144,6 +147,36 @@ std::string getStartupStateFromLog(std::string& sllog)
return startup_state;
}
+bool miniDumpExists(const std::string& dumpDir)
+{
+ bool found = false;
+
+ try
+ {
+ if (!boost::filesystem::exists(dumpDir))
+ {
+ return false;
+ }
+
+ boost::filesystem::directory_iterator end_itr;
+ for (boost::filesystem::directory_iterator i(dumpDir); i != end_itr; ++i)
+ {
+ if (!boost::filesystem::is_regular_file(i->status())) continue;
+ if (".dmp" == i->path().extension())
+ {
+ found = true;
+ break;
+ }
+ }
+ }
+ catch (const boost::filesystem::filesystem_error& e)
+ {
+ llwarns << "Failed to determine existance of the minidump file: '" + e.code().message() +"'" << llendl;
+ }
+
+ return found;
+}
+
bool LLCrashLogger::readDebugFromXML(LLSD& dest, const std::string& filename )
{
std::string db_file_name = gDirUtilp->getExpandedFilename(LL_PATH_DUMP,filename);
@@ -350,20 +383,29 @@ bool LLCrashLogger::sendCrashLog(std::string dump_dir)
void LLCrashLogger::checkCrashDump()
{
- mCrashHost = gSavedSettings.getString("CrashHostUrl");
-
- std::string dumpDir = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, "") + "singularity-debug";
- if (gDirUtilp->fileExists(dumpDir))
- {
#if LL_SEND_CRASH_REPORTS
- if (!mCrashHost.empty() && gSavedSettings.getS32("CrashSubmitBehavior") != 2)
+ // 0 - ask, 1 - always send, 2 - never send
+ S32 pref = gSavedSettings.getS32("CrashSubmitBehavior");
+ if (pref == 2) return; //never send
+
+ mCrashHost = gSavedSettings.getString("CrashHostUrl");
+ std::string dumpDir = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, "") + "singularity-debug";
+
+ // Do we have something to send, and somewhere to send it
+ if (!mCrashHost.empty() && miniDumpExists(dumpDir))
+ {
+ if (pref == 1) // always send
{
sendCrashLog(dumpDir);
}
+ else // ask
+ {
+ U32 response = OSMessageBox(LLTrans::getString("MBFrozenCrashed"), LLTrans::getString("MBAlert"), OSMB_YESNO);
+ if (response == OSBTN_YES)
+ {
+ sendCrashLog(dumpDir);
+ }
+ }
+ }
#endif
- }
- else
- {
- llinfos << "No crash dump found frome previous run, not sending report" << LL_ENDL;
- }
}
diff --git a/indra/newview/lldrawpoolalpha.cpp b/indra/newview/lldrawpoolalpha.cpp
index bf4907b8b..3e2dc4308 100644
--- a/indra/newview/lldrawpoolalpha.cpp
+++ b/indra/newview/lldrawpoolalpha.cpp
@@ -320,7 +320,7 @@ void LLDrawPoolAlpha::render(S32 pass)
gPipeline.enableLightsFullbright(LLColor4(1,1,1,1));
}
- gGL.diffuseColor4f(1,0,0,1);
+ gGL.diffuseColor4f(0.9,0,0,0.4);
LLViewerFetchedTexture::sSmokeImagep->addTextureStats(1024.f*1024.f);
gGL.getTexUnit(0)->bind(LLViewerFetchedTexture::sSmokeImagep, TRUE) ;
diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp
index 04d5f5115..77dc1e6c4 100644
--- a/indra/newview/llface.cpp
+++ b/indra/newview/llface.cpp
@@ -1949,15 +1949,12 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume,
LLVector4a texIdx;
- U8 index = mTextureIndex < 255 ? mTextureIndex : 0;
+ S32 index = mTextureIndex < 255 ? mTextureIndex : 0;
F32 val = 0.f;
- U8* vp = (U8*) &val;
- vp[0] = index;
- vp[1] = 0;
- vp[2] = 0;
- vp[3] = 0;
-
+ S32* vp = (S32*) &val;
+ *vp = index;
+
llassert(index <= LLGLSLShader::sIndexedTextureChannels-1);
LLVector4Logical mask;
diff --git a/indra/newview/llfeaturemanager.cpp b/indra/newview/llfeaturemanager.cpp
index 1551744bd..c3d0bc8a6 100644
--- a/indra/newview/llfeaturemanager.cpp
+++ b/indra/newview/llfeaturemanager.cpp
@@ -626,6 +626,10 @@ void LLFeatureManager::applyBaseMasks()
{
maskFeatures("GeForceFX");
}
+ if (gGLManager.mIsIntel && gGLManager.mGLVersion<3.0f)
+ {
+ maskFeatures("IntelPre30");
+ }
if (gGLManager.mIsIntel)
{
maskFeatures("Intel");
diff --git a/indra/newview/llfloaterabout.cpp b/indra/newview/llfloaterabout.cpp
index 944335528..d47f5fb43 100644
--- a/indra/newview/llfloaterabout.cpp
+++ b/indra/newview/llfloaterabout.cpp
@@ -136,6 +136,9 @@ LLFloaterAbout::LLFloaterAbout()
// Version string
std::string version = std::string(LLAppViewer::instance()->getSecondLifeTitle()
+#if defined(_WIN64) || defined(__x86_64__)
+ + " (64 bit)"
+#endif
+ llformat(" %d.%d.%d (%d) %s %s (%s)\n",
gVersionMajor, gVersionMinor, gVersionPatch, LL_VIEWER_BUILD,
__DATE__, __TIME__,
diff --git a/indra/newview/llfloateravatarlist.cpp b/indra/newview/llfloateravatarlist.cpp
index 4ce5e7c18..e6b8167ff 100644
--- a/indra/newview/llfloateravatarlist.cpp
+++ b/indra/newview/llfloateravatarlist.cpp
@@ -189,7 +189,17 @@ void LLAvatarListEntry::processProperties(void* data, EAvatarProcessorType type)
using namespace boost::gregorian;
int year, month, day;
sscanf(pAvatarData->born_on.c_str(),"%d/%d/%d",&month,&day,&year);
- mAge = (day_clock::local_day() - date(year, month, day)).days();
+ try
+ {
+ mAge = (day_clock::local_day() - date(year, month, day)).days();
+ }
+ catch(const std::exception&)
+ {
+ llwarns << "Failed to extract age from APT_PROPERTIES for " << mID << ", received \"" << pAvatarData->born_on << "\". Requesting properties again." << llendl;
+ LLAvatarPropertiesProcessor::getInstance()->addObserver(mID, this);
+ LLAvatarPropertiesProcessor::getInstance()->sendAvatarPropertiesRequest(mID);
+ return;
+ }
if (!mStats[STAT_TYPE_AGE] && mAge >= 0) //Only announce age once per entry.
{
static const LLCachedControl sAvatarAgeAlertDays(gSavedSettings, "AvatarAgeAlertDays");
diff --git a/indra/newview/llfloatercustomize.cpp b/indra/newview/llfloatercustomize.cpp
index 3a9e9f397..0df0663b9 100644
--- a/indra/newview/llfloatercustomize.cpp
+++ b/indra/newview/llfloatercustomize.cpp
@@ -53,8 +53,9 @@
#include "llvoavatarself.h"
#include "statemachine/aifilepicker.h"
-#include "llxmltree.h"
#include "hippogridmanager.h"
+#include "aixmllindengenepool.h"
+#include "aifile.h"
using namespace LLAvatarAppearanceDefines;
@@ -330,215 +331,112 @@ void LLFloaterCustomize::onBtnImport_continued(AIFilePicker* filepicker)
LLPanelEditWearable* panel_edit_wearable = getCurrentWearablePanel();
LLViewerWearable* edit_wearable = panel_edit_wearable->getWearable();
+ LLWearableType::EType panel_wearable_type = panel_edit_wearable->getType();
+ std::string label = utf8str_tolower(panel_edit_wearable->getLabel());
+
std::string const filename = filepicker->getFilename();
- LLSD args(LLSD::emptyMap());
- args["FILE"] = gDirUtilp->getBaseFileName(filename);
- LLXmlTree xml;
- BOOL success = xml.parseFile(filename, FALSE);
- if (!success)
- {
- LLNotificationsUtil::add("AIXMLImportParseError", args);
- return;
- }
- LLXmlTreeNode* root = xml.getRoot();
- if (!root)
- {
- llwarns << "No root node found in wearable import file: " << filename << llendl;
- LLNotificationsUtil::add("AIXMLImportParseError", args);
- return;
- }
+ AIArgs args("[FILE]", gDirUtilp->getBaseFileName(filename));
- //-------------------------------------------------------------------------
- // (root)
- //-------------------------------------------------------------------------
- if (!root->hasName("linden_genepool"))
- {
- llwarns << "Invalid wearable import file (missing linden_genepool header): " << filename << llendl;
- LLNotificationsUtil::add("AIXMLImportRootTypeError", args);
- return;
- }
- static LLStdStringHandle const version_string = LLXmlTree::addAttributeString("version");
- std::string version;
- if (!root->getFastAttributeString(version_string, version) || (version != "1.0"))
- {
- llwarns << "Invalid or incompatible linden_genepool version: " << version << " in file: " << filename << llendl;
- args["TAG"] = "version";
- args["VERSIONMAJOR"] = "1";
- LLNotificationsUtil::add("AIXMLImportRootVersionError", args);
- return;
- }
- static LLStdStringHandle const metaversion_string = LLXmlTree::addAttributeString("metaversion");
- std::string metaversion;
- U32 metaversion_major;
- if (!root->getFastAttributeString(metaversion_string, metaversion))
- {
- llwarns << "Invalid linden_genepool metaversion: " << metaversion << " in file: " << filename << llendl;
- metaversion_major = 0;
- }
- else if (!LLStringUtil::convertToU32(metaversion, metaversion_major) || metaversion_major > 1)
- {
- llwarns << "Invalid or incompatible linden_genepool metaversion: " << metaversion << " in file: " << filename << llendl;
- args["TAG"] = "metaversion";
- args["VERSIONMAJOR"] = "1";
- LLNotificationsUtil::add("AIXMLImportRootVersionError", args);
- return;
- }
-
- //-------------------------------------------------------------------------
- //
- //-------------------------------------------------------------------------
- std::string gridnick;
- LLDate date;
- bool different_grid = false; // By default assume it was exported on the same grid as we're on now.
- bool mixed_grids = false; // Set to true if two different grids (might) share UUIDs. Currently only "secondlife" and "secondlife_beta".
- if (metaversion_major >= 1)
- {
- static LLStdStringHandle const gridnick_string = LLXmlTree::addAttributeString("gridnick");
- static LLStdStringHandle const date_string = LLXmlTree::addAttributeString("date");
- std::string date_s;
- bool invalid = true;
- LLXmlTreeNode* meta_node = root->getChildByName("meta");
- if (!meta_node)
- {
- llwarns << "No meta (1) in wearable import file: " << filename << llendl;
- }
- else if (!meta_node->getFastAttributeString(gridnick_string, gridnick))
- {
- llwarns << "meta tag in file: " << filename << " is missing the 'gridnick' parameter." << llendl;
- }
- else if (!meta_node->getFastAttributeString(date_string, date_s) || !date.fromString(date_s))
- {
- llwarns << "meta tag in file: " << filename << " is missing or invalid 'date' parameter." << llendl;
- }
- else
- {
- invalid = false;
- std::string current_gridnick = gHippoGridManager->getConnectedGrid()->getGridNick();
- different_grid = gridnick != current_gridnick;
- mixed_grids = (gridnick == "secondlife" && current_gridnick == "secondlife_beta") ||
- (gridnick == "secondlife_beta" && current_gridnick == "secondlife");
- }
- if (invalid)
- {
- LLNotificationsUtil::add("AIXMLImportInvalidError", args);
- return;
- }
- }
-
- static LLStdStringHandle const name_string = LLXmlTree::addAttributeString("name");
-
- //-------------------------------------------------------------------------
- //
- //-------------------------------------------------------------------------
- LLXmlTreeNode* archetype_node = root->getChildByName("archetype");
- if (!archetype_node)
- {
- llwarns << "No archetype in wearable import file: " << filename << llendl;
- LLNotificationsUtil::add("AIXMLImportInvalidError", args);
- return;
- }
- // Legacy that name="" exists. Using it as human (only) readable type label of contents. Don't use it for anything else because it might not be set.
- std::string label = "???";
- if (metaversion_major >= 1)
- {
- if (!archetype_node->getFastAttributeString(name_string, label))
- {
- llwarns << "archetype tag in file: " << filename << " is missing the 'name' parameter." << llendl;
- }
- }
-
- //-------------------------------------------------------------------------
- //
- //-------------------------------------------------------------------------
- std::string path;
- std::string wearable_name;
- std::string wearable_description;
- if (metaversion_major >= 1)
- {
- static LLStdStringHandle const path_string = LLXmlTree::addAttributeString("path");
- static LLStdStringHandle const description_string = LLXmlTree::addAttributeString("description");
- bool invalid = true;
- LLXmlTreeNode* meta_node = archetype_node->getChildByName("meta");
- if (!meta_node)
- {
- llwarns << "No meta (2) in wearable import file: " << filename << llendl;
- }
- else if (!meta_node->getFastAttributeString(path_string, path))
- {
- llwarns << "meta tag in file: " << filename << " is missing the 'path' parameter." << llendl;
- }
- else if (!meta_node->getFastAttributeString(name_string, wearable_name))
- {
- llwarns << "meta tag in file: " << filename << " is missing the 'name' parameter." << llendl;
- }
- else if (!meta_node->getFastAttributeString(description_string, wearable_description))
- {
- llwarns << "meta tag in file: " << filename << " is missing the 'description' parameter." << llendl;
- }
- else
- {
- invalid = false;
- }
- if (invalid)
- {
- LLNotificationsUtil::add("AIXMLImportInvalidError", args);
- return;
- }
- }
-
- // Parse the XML content.
- static LLStdStringHandle const id_string = LLXmlTree::addAttributeString("id");
- static LLStdStringHandle const value_string = LLXmlTree::addAttributeString("value");
- static LLStdStringHandle const te_string = LLXmlTree::addAttributeString("te");
- static LLStdStringHandle const uuid_string = LLXmlTree::addAttributeString("uuid");
bool found_param = false;
bool found_texture = false;
- for(LLXmlTreeNode* child = archetype_node->getFirstChild(); child; child = archetype_node->getNextChild())
+ bool found_type = false;
+
+ bool different_grid = false; // By default assume it was exported on the same grid as we're on now.
+ bool mixed_grids = false; // Set to true if two different grids (might) share UUIDs. Currently only "secondlife" and "secondlife_beta".
+ std::string gridnick;
+ std::string wearable_types;
+
+ try
{
- if (child->hasName("param"))
+ //-------------------------------------------------------------------------
+ // (root)
+ //-------------------------------------------------------------------------
+ std::string metaversion;
+ U32 metaversion_major;
+
+ AIXMLParser linden_genepool(filename, "wearable import file", "linden_genepool", 1);
+ linden_genepool.attribute("version", "1.0");
+ linden_genepool.attribute("metaversion", metaversion);
+
+ if (!LLStringUtil::convertToU32(metaversion, metaversion_major) || metaversion_major > 1)
{
- std::string id_s;
- U32 id;
- std::string value_s;
- F32 value;
- if (!child->getFastAttributeString(id_string, id_s) || !LLStringUtil::convertToU32(id_s, id) ||
- !child->getFastAttributeString(value_string, value_s) || !LLStringUtil::convertToF32(value_s, value))
- {
- llwarns << "Possible syntax error or corruption for node in " << filename << llendl;
- continue;
- }
- LLVisualParam* visual_param = edit_wearable->getVisualParam(id);
- if (visual_param)
- {
- found_param = true;
- visual_param->setWeight(value, FALSE);
- }
+ THROW_MALERT("AIXMLImportRootVersionError", args("[TAG]", "metaversion")("[VERSIONMAJOR]", "1"));
}
- else if (child->hasName("texture"))
+
+ //-------------------------------------------------------------------------
+ //
+ //-------------------------------------------------------------------------
+ AIXMLLindenGenepool::MetaData meta_data;
+
+ if (metaversion_major >= 1)
{
- std::string te_s;
- S32 te;
- std::string uuid_s;
- LLUUID uuid;
- if (!child->getFastAttributeString(te_string, te_s) || !LLStringUtil::convertToS32(te_s, te) || te < 0 || te >= TEX_NUM_INDICES ||
- !child->getFastAttributeString(uuid_string, uuid_s) || !uuid.set(uuid_s, TRUE))
+ linden_genepool.child("meta", meta_data);
+ std::string current_gridnick = gHippoGridManager->getConnectedGrid()->getGridNick();
+ gridnick = meta_data.mGridNick;
+ different_grid = gridnick != current_gridnick;
+ mixed_grids = (gridnick == "secondlife" && current_gridnick == "secondlife_beta") ||
+ (gridnick == "secondlife_beta" && current_gridnick == "secondlife");
+ }
+
+ std::vector archetypes;
+ linden_genepool.setVersion(metaversion_major);
+ linden_genepool.push_back_children("archetype", archetypes);
+
+ if (archetypes.empty())
+ {
+ THROW_ALERT("AIXMLImportNoArchetypeError", AIArgs("[FILE]", filename));
+ }
+
+ for (std::vector::iterator archetype = archetypes.begin(); archetype != archetypes.end(); ++archetype)
+ {
+ LLWearableType::EType type = archetype->getType();
+ if (type != LLWearableType::WT_NONE)
{
- llwarns << "Possible syntax error or corruption for node in " << filename << llendl;
- continue;
- }
- ETextureIndex te_index = (ETextureIndex)te;
- LLWearableType::EType te_wearable_type = LLAvatarAppearanceDictionary::getTEWearableType(te_index);
- if (te_wearable_type == edit_wearable->getType())
- {
- found_texture = true;
- if (!different_grid || mixed_grids)
+ if (!wearable_types.empty())
{
- panel_edit_wearable->setNewImageID(te_index, uuid);
+ wearable_types += "/";
+ }
+ wearable_types += LLWearableType::getTypeName(type);
+ if (panel_wearable_type == type)
+ {
+ found_type = true;
+ }
+ }
+ for (AIArchetype::params_type::const_iterator param = archetype->getParams().begin(); param != archetype->getParams().end(); ++param)
+ {
+ LLVisualParam* visual_param = edit_wearable->getVisualParam(param->getID());
+ if (visual_param)
+ {
+ found_param = true;
+ visual_param->setWeight(param->getValue(), FALSE);
+ }
+ }
+ for (AIArchetype::textures_type::const_iterator texture = archetype->getTextures().begin(); texture != archetype->getTextures().end(); ++texture)
+ {
+ U32 te = texture->getID();
+ if (te >= TEX_NUM_INDICES)
+ {
+ }
+ ETextureIndex te_index = (ETextureIndex)te;
+ LLWearableType::EType te_wearable_type = LLAvatarAppearanceDictionary::getTEWearableType(te_index);
+ if (te_wearable_type == edit_wearable->getType())
+ {
+ found_texture = true;
+ if (!different_grid || mixed_grids)
+ {
+ panel_edit_wearable->setNewImageID(te_index, texture->getUUID());
+ }
}
}
}
}
+ catch (AIAlert::Error const& error)
+ {
+ AIAlert::add_modal("AIXMLImportError", AIArgs("[TYPE]", label), error);
+ return;
+ }
+
if (found_param || found_texture)
{
edit_wearable->writeToAvatar(gAgentAvatarp);
@@ -546,23 +444,25 @@ void LLFloaterCustomize::onBtnImport_continued(AIFilePicker* filepicker)
panel_edit_wearable->updateScrollingPanelUI();
if (found_texture && different_grid)
{
- args["EXPORTGRID"] = gridnick;
- args["CURRENTGRID"] = gHippoGridManager->getConnectedGrid()->getGridNick();
+ args("[EXPORTGRID]", gridnick);
+ args("[CURRENTGRID]", gHippoGridManager->getConnectedGrid()->getGridNick());
if (mixed_grids)
{
- LLNotificationsUtil::add("AIXMLImportMixedGrid", args);
+ AIAlert::add_modal("AIXMLImportMixedGrid", args);
}
else
{
- LLNotificationsUtil::add("AIXMLImportDifferentGrid", args);
+ AIAlert::add_modal("AIXMLImportDifferentGrid", args);
}
}
}
- else
+ else if (found_type)
{
- args["TYPE"] = panel_edit_wearable->LLPanel::getLabel();
- args["ARCHETYPENAME"] = label;
- LLNotificationsUtil::add("AIXMLImportWearableTypeMismatch", args);
+ AIAlert::add("AIXMLImportEmptyArchetype", args("[TYPE]", label));
+ }
+ else if (!wearable_types.empty())
+ {
+ AIAlert::add("AIXMLImportWearableTypeMismatch", args("[TYPE]", label)("[ARCHETYPENAME]", wearable_types));
}
}
@@ -615,21 +515,26 @@ void LLFloaterCustomize::onBtnExport_continued(LLViewerWearable* edit_wearable,
}
std::string filename = filepicker->getFilename();
- LLSD args(LLSD::emptyMap());
- args["FILE"] = filename;
- LLAPRFile outfile;
- outfile.open(filename, LL_APR_WB);
- if (!outfile.getFileHandle())
+ bool success = false;
+ try
{
- llwarns << "Could not open \"" << filename << "\" for writing." << llendl;
- LLNotificationsUtil::add("AIXMLExportWriteError", args);
- return;
+ AIFile outfile(filename, "wb");
+
+ AIXMLLindenGenepool linden_genepool(outfile);
+ linden_genepool.child(edit_wearable->getArchetype());
+
+ success = true;
+ }
+ catch (AIAlert::Error const& error)
+ {
+ AIAlert::add_modal("AIXMLExportWriteError", AIArgs("[FILE]", filename), error);
}
- LLVOAvatar::dumpArchetypeXML_header(outfile, edit_wearable->getTypeName());
- edit_wearable->archetypeExport(outfile);
- LLVOAvatar::dumpArchetypeXML_footer(outfile);
+ if (success)
+ {
+ AIAlert::add_modal("AIXMLExportSuccess", AIArgs("[FILE]", filename));
+ }
}
void LLFloaterCustomize::onBtnOk()
diff --git a/indra/newview/llfloaterinspect.cpp b/indra/newview/llfloaterinspect.cpp
index 448e1bb37..ba9233d65 100644
--- a/indra/newview/llfloaterinspect.cpp
+++ b/indra/newview/llfloaterinspect.cpp
@@ -89,7 +89,6 @@ LLFloaterInspect::~LLFloaterInspect(void)
{
gFloaterTools->setFocus(TRUE);
}
- //sInstance = NULL;
}
// static
@@ -199,15 +198,6 @@ LLUUID LLFloaterInspect::getSelectedUUID()
return LLUUID::null;
}
-void LLFloaterInspect::onGetAvNameCallback(const LLUUID& idCreator, const LLAvatarName& av_name, void* FloaterPtr)
-{
- if (FloaterPtr)
- {
- LLFloaterInspect* floater = (LLFloaterInspect*)FloaterPtr;
- floater->dirty();
- }
-}
-
void LLFloaterInspect::refresh()
{
LLUUID creator_id;
@@ -234,15 +224,14 @@ void LLFloaterInspect::refresh()
{
LLSelectNode* obj = *iter;
LLSD row;
- std::string owner_name, creator_name, time, last_owner_name;
+ std::string owner_name, creator_name, last_owner_name;
if (obj->mCreationDate == 0)
{ // Don't have valid information from the server, so skip this one
continue;
}
- time_t timestamp = (time_t) (obj->mCreationDate/1000000);
- timeToFormattedString(timestamp, gSavedSettings.getString("TimestampFormat"), time);
+ // Singu Note: Diverge from LL and handle datetime column in a sortable manner later on
const LLUUID& idOwner = obj->mPermissions->getOwner();
const LLUUID& idCreator = obj->mPermissions->getCreator();
@@ -266,7 +255,7 @@ void LLFloaterInspect::refresh()
else
{
owner_name = LLTrans::getString("RetrievingData");
- LLAvatarNameCache::get(idOwner, boost::bind(&LLFloaterInspect::onGetAvNameCallback, _1, _2, this));
+ LLAvatarNameCache::get(idOwner, boost::bind(&LLFloaterInspect::dirty, this));
}
if (LLAvatarNameCache::get(idCreator, &av_name))
@@ -283,7 +272,7 @@ void LLFloaterInspect::refresh()
else
{
creator_name = LLTrans::getString("RetrievingData");
- LLAvatarNameCache::get(idCreator, boost::bind(&LLFloaterInspect::onGetAvNameCallback, _1, _2, this));
+ LLAvatarNameCache::get(idCreator, boost::bind(&LLFloaterInspect::dirty, this));
}
//
@@ -300,7 +289,7 @@ void LLFloaterInspect::refresh()
else
{
last_owner_name = LLTrans::getString("RetrievingData");
- LLAvatarNameCache::get(idLastOwner, boost::bind(&LLFloaterInspect::onGetAvNameCallback, _1, _2, this));
+ LLAvatarNameCache::get(idLastOwner, boost::bind(&LLFloaterInspect::dirty, this));
}
//
@@ -363,8 +352,10 @@ void LLFloaterInspect::refresh()
row["columns"][7]["value"] = llformat("%d",total_inv);
//
row["columns"][8]["column"] = "creation_date";
- row["columns"][8]["type"] = "text";
- row["columns"][8]["value"] = time;
+ row["columns"][8]["type"] = "date";
+ row["columns"][8]["value"] = LLDate(obj->mCreationDate/1000000);
+ static const LLCachedControl format("TimestampFormat");
+ row["columns"][8]["format"] = format;
mObjectList->addElement(row, ADD_TOP);
}
if(selected_index > -1 && mObjectList->getItemIndex(selected_uuid) == selected_index)
diff --git a/indra/newview/llfloaterinspect.h b/indra/newview/llfloaterinspect.h
index 52e6a7f9a..f977f5403 100644
--- a/indra/newview/llfloaterinspect.h
+++ b/indra/newview/llfloaterinspect.h
@@ -63,8 +63,6 @@ public:
void onClickOwnerProfile();
void onSelectObject();
- static void onGetAvNameCallback(const LLUUID& idCreator, const LLAvatarName& av_name, void* FloaterPtr);
-
LLScrollListCtrl* mObjectList;
protected:
// protected members
@@ -77,8 +75,6 @@ protected:
private:
LLFloaterInspect();
virtual ~LLFloaterInspect(void);
- // static data
-// static LLFloaterInspect* sInstance;
LLSafeHandle mObjectSelection;
//
diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp
index 3520b56e1..1902f115d 100644
--- a/indra/newview/llfloatermodelpreview.cpp
+++ b/indra/newview/llfloatermodelpreview.cpp
@@ -726,8 +726,10 @@ void LLFloaterModelPreview::draw()
}
}
+ /* Singu Note: Dummy views and what for?
childSetTextArg("prim_cost", "[PRIM_COST]", llformat("%d", mModelPreview->mResourceCost));
childSetTextArg("description_label", "[TEXTURES]", llformat("%d", mModelPreview->mTextureSet.size()));
+ */
if (mModelPreview)
{
@@ -1155,7 +1157,7 @@ void LLFloaterModelPreview::initDecompControls()
mDecompParams[param[i].mName] = LLSD(param[i].mDefault.mBool);
//llinfos << "Type: boolean, Default: " << (param[i].mDefault.mBool ? "True" : "False") << llendl;
- LLCheckBoxCtrl* check_box = getChild(name);
+ LLCheckBoxCtrl* check_box = findChild(name);
if (check_box)
{
check_box->setValue(param[i].mDefault.mBool);
@@ -3710,7 +3712,6 @@ void LLModelPreview::loadModelCallback(S32 lod)
mLoading = false;
if (mFMP)
{
- mFMP->getChild("confirm_checkbox")->set(FALSE);
if (!mBaseModel.empty())
{
if (mFMP->getChild("description_form")->getValue().asString().empty())
@@ -4193,7 +4194,9 @@ void LLModelPreview::updateStatusMessages()
}
}
+ /* Singu Note: Dummy views and what for?
mFMP->childSetTextArg("submeshes_info", "[SUBMESHES]", llformat("%d", total_submeshes[LLModel::LOD_HIGH]));
+ */
std::string mesh_status_na = mFMP->getString("mesh_status_na");
@@ -5524,12 +5527,6 @@ void LLModelPreview::setPreviewLOD(S32 lod)
combo_box->setCurrentByIndex((NUM_LOD-1)-mPreviewLOD); // combo box list of lods is in reverse order
mFMP->childSetText("lod_file_" + lod_name[mPreviewLOD], mLODFile[mPreviewLOD]);
- LLComboBox* combo_box2 = mFMP->getChild("preview_lod_combo2");
- combo_box2->setCurrentByIndex((NUM_LOD-1)-mPreviewLOD); // combo box list of lods is in reverse order
-
- LLComboBox* combo_box3 = mFMP->getChild("preview_lod_combo3");
- combo_box3->setCurrentByIndex((NUM_LOD-1)-mPreviewLOD); // combo box list of lods is in reverse order
-
LLColor4 highlight_color = LLUI::sColorsGroup->getColor("MeshImportTableHighlightColor");
LLColor4 normal_color = LLUI::sColorsGroup->getColor("MeshImportTableNormalColor");
diff --git a/indra/newview/llfloaterpathfindingobjects.cpp b/indra/newview/llfloaterpathfindingobjects.cpp
index 8a606a07b..7fe3311cb 100644
--- a/indra/newview/llfloaterpathfindingobjects.cpp
+++ b/indra/newview/llfloaterpathfindingobjects.cpp
@@ -397,10 +397,9 @@ void LLFloaterPathfindingObjects::addObjectToScrollList(const LLPathfindingObjec
}
LLScrollListItem *scrollListItem = mObjectsScrollList->addElement(rowParams);
-
if (pObjectPtr->hasOwner() && !pObjectPtr->hasOwnerName())
{
- mMissingNameObjectsScrollListItems.insert(std::make_pair(pObjectPtr->getUUID().asString(), scrollListItem));
+ mMissingNameObjectsScrollListItems.insert(std::make_pair(pObjectPtr->getUUID().asString(), scrollListItem));
pObjectPtr->registerOwnerNameListener(boost::bind(&LLFloaterPathfindingObjects::handleObjectNameResponse, this, _1));
}
}
diff --git a/indra/newview/llfloatertools.cpp b/indra/newview/llfloatertools.cpp
index 99863e103..0cf47303f 100644
--- a/indra/newview/llfloatertools.cpp
+++ b/indra/newview/llfloatertools.cpp
@@ -527,7 +527,7 @@ void LLFloaterTools::refresh()
{
F32 link_cost = LLSelectMgr::getInstance()->getSelection()->getSelectedObjectCost();
LLStringUtil::format_map_t prim_equiv_args;
- prim_equiv_args["SEL_WEIGHT"] = llformat("%.1d", (S32)link_cost);
+ prim_equiv_args["SEL_WEIGHT"] = llformat("%.0f", link_cost);
selection_args["PE_STRING"] = getString("status_selectprimequiv", prim_equiv_args);
}
else
diff --git a/indra/newview/llfloatertools.h b/indra/newview/llfloatertools.h
index fec736819..3a6d2cbfb 100644
--- a/indra/newview/llfloatertools.h
+++ b/indra/newview/llfloatertools.h
@@ -111,6 +111,8 @@ public:
void navigateToTitleMedia( const std::string url );
bool selectedMediaEditable();
+ LLPanelFace* getPanelFace() { return mPanelFace; }
+
private:
void refresh();
void refreshMedia();
diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp
index 3dd268d60..e41c1a3d1 100644
--- a/indra/newview/llinventorybridge.cpp
+++ b/indra/newview/llinventorybridge.cpp
@@ -5841,7 +5841,7 @@ void LLWearableBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
}
// [/RLVa:KB]*/
- bool not_modifiable = !gAgentWearables.isWearableModifiable(item->getUUID());
+ bool not_modifiable = !item || !gAgentWearables.isWearableModifiable(item->getUUID());
if (((flags & FIRST_SELECTED_ITEM) == 0) || not_modifiable)
{
disabled_items.push_back(std::string("Wearable Edit"));
diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp
index 55afaecee..80e68f608 100644
--- a/indra/newview/llmeshrepository.cpp
+++ b/indra/newview/llmeshrepository.cpp
@@ -1414,7 +1414,10 @@ void LLMeshUploadThread::preStart()
AIMeshUpload::AIMeshUpload(LLMeshUploadThread::instance_list& data, LLVector3& scale, bool upload_textures, bool upload_skin, bool upload_joints, std::string const& upload_url, bool do_upload,
LLHandle const& fee_observer, LLHandle const& upload_observer) :
- mMeshUpload(new AIStateMachineThread), mWholeModelUploadURL(upload_url)
+#ifdef CWDEBUG
+ AIStateMachine(false),
+#endif
+ mMeshUpload(new AIStateMachineThread(CWD_ONLY(false))), mWholeModelUploadURL(upload_url)
{
mMeshUpload->thread_impl().init(data, scale, upload_textures, upload_skin, upload_joints, do_upload, fee_observer, upload_observer);
}
diff --git a/indra/newview/llpanelavatar.cpp b/indra/newview/llpanelavatar.cpp
index 2c6e5a057..4dbb576c0 100644
--- a/indra/newview/llpanelavatar.cpp
+++ b/indra/newview/llpanelavatar.cpp
@@ -1839,12 +1839,9 @@ void LLPanelAvatar::sendAvatarPropertiesUpdate()
{
llinfos << "Sending avatarinfo update" << llendl;
BOOL allow_publish = FALSE;
- BOOL mature = FALSE;
if (LLPanelAvatar::sAllowFirstLife)
{
allow_publish = childGetValue("allow_publish");
- //A profile should never be mature.
- mature = FALSE;
}
LLUUID first_life_image_id;
@@ -1867,7 +1864,6 @@ void LLPanelAvatar::sendAvatarPropertiesUpdate()
avatar_data.about_text = about_text;
avatar_data.fl_about_text = first_life_about_text;
avatar_data.allow_publish = allow_publish;
- //avatar_data.mature = mature;
avatar_data.profile_url = mPanelWeb->childGetText("url_edit");
LLAvatarPropertiesProcessor::getInstance()->sendAvatarPropertiesUpdate(&avatar_data);
diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp
index 78ae39dda..b211047bc 100644
--- a/indra/newview/llpanelface.cpp
+++ b/indra/newview/llpanelface.cpp
@@ -53,6 +53,7 @@
#include "llface.h"
#include "llinventorymodel.h" //Perms check for texture params
#include "lllineeditor.h"
+#include "llmaterialmgr.h"
#include "llmediaentry.h"
#include "llnotificationsutil.h"
#include "llresmgr.h"
@@ -62,6 +63,7 @@
#include "lltexturectrl.h"
#include "lltextureentry.h"
#include "lltooldraganddrop.h"
+#include "lltrans.h"
#include "llui.h"
#include "llviewercontrol.h"
#include "llviewermedia.h"
@@ -71,7 +73,62 @@
#include "llvovolume.h"
#include "lluictrlfactory.h"
#include "llpluginclassmedia.h"
-#include "llviewertexturelist.h"
+#include "llviewertexturelist.h"// Update sel manager as to which channel we're editing so it can reflect the correct overlay UI
+
+//
+// Constant definitions for comboboxes
+// Must match the commbobox definitions in panel_tools_texture.xml
+//
+const S32 MATMEDIA_MATERIAL = 0; // Material
+const S32 MATMEDIA_MEDIA = 1; // Media
+const S32 MATTYPE_DIFFUSE = 0; // Diffuse material texture
+const S32 MATTYPE_NORMAL = 1; // Normal map
+const S32 MATTYPE_SPECULAR = 2; // Specular map
+const S32 ALPHAMODE_NONE = 0; // No alpha mask applied
+const S32 ALPHAMODE_BLEND = 1; // Alpha blending mode
+const S32 ALPHAMODE_MASK = 2; // Alpha masking mode
+const S32 BUMPY_TEXTURE = 18; // use supplied normal map
+const S32 SHINY_TEXTURE = 4; // use supplied specular map
+
+//
+// "Use texture" label for normal/specular type comboboxes
+// Filled in at initialization from translated strings
+//
+std::string USE_TEXTURE;
+
+LLRender::eTexIndex LLPanelFace::getTextureChannelToEdit()
+{
+ LLComboBox* combobox_matmedia = getChild("combobox matmedia");
+ LLComboBox* combobox_mattype = getChild("combobox mattype");
+
+ LLRender::eTexIndex channel_to_edit = (combobox_matmedia && combobox_matmedia->getCurrentIndex() == MATMEDIA_MATERIAL) ?
+ (combobox_mattype ? (LLRender::eTexIndex)combobox_mattype->getCurrentIndex() : LLRender::DIFFUSE_MAP) : LLRender::DIFFUSE_MAP;
+
+ channel_to_edit = (channel_to_edit == LLRender::NORMAL_MAP) ? (getCurrentNormalMap().isNull() ? LLRender::DIFFUSE_MAP : channel_to_edit) : channel_to_edit;
+ channel_to_edit = (channel_to_edit == LLRender::SPECULAR_MAP) ? (getCurrentSpecularMap().isNull() ? LLRender::DIFFUSE_MAP : channel_to_edit) : channel_to_edit;
+ return channel_to_edit;
+}
+
+// Things the UI provides...
+//
+LLUUID LLPanelFace::getCurrentNormalMap() { return getChild("bumpytexture control")->getImageAssetID(); }
+LLUUID LLPanelFace::getCurrentSpecularMap() { return getChild("shinytexture control")->getImageAssetID(); }
+U32 LLPanelFace::getCurrentShininess() { return getChild("combobox shininess")->getCurrentIndex(); }
+U32 LLPanelFace::getCurrentBumpiness() { return getChild("combobox bumpiness")->getCurrentIndex(); }
+U8 LLPanelFace::getCurrentDiffuseAlphaMode() { return (U8)getChild("combobox alphamode")->getCurrentIndex(); }
+U8 LLPanelFace::getCurrentAlphaMaskCutoff() { return (U8)getChild("maskcutoff")->getValue().asInteger(); }
+U8 LLPanelFace::getCurrentEnvIntensity() { return (U8)getChild("environment")->getValue().asInteger(); }
+U8 LLPanelFace::getCurrentGlossiness() { return (U8)getChild("glossiness")->getValue().asInteger(); }
+F32 LLPanelFace::getCurrentBumpyRot() { return getChild("bumpyRot")->getValue().asReal(); }
+F32 LLPanelFace::getCurrentBumpyScaleU() { return getChild("bumpyScaleU")->getValue().asReal(); }
+F32 LLPanelFace::getCurrentBumpyScaleV() { return getChild("bumpyScaleV")->getValue().asReal(); }
+F32 LLPanelFace::getCurrentBumpyOffsetU() { return getChild("bumpyOffsetU")->getValue().asReal(); }
+F32 LLPanelFace::getCurrentBumpyOffsetV() { return getChild("bumpyOffsetV")->getValue().asReal(); }
+F32 LLPanelFace::getCurrentShinyRot() { return getChild("shinyRot")->getValue().asReal(); }
+F32 LLPanelFace::getCurrentShinyScaleU() { return getChild("shinyScaleU")->getValue().asReal(); }
+F32 LLPanelFace::getCurrentShinyScaleV() { return getChild("shinyScaleV")->getValue().asReal(); }
+F32 LLPanelFace::getCurrentShinyOffsetU() { return getChild("shinyOffsetU")->getValue().asReal(); }
+F32 LLPanelFace::getCurrentShinyOffsetV() { return getChild("shinyOffsetV")->getValue().asReal(); }
//
// Methods
@@ -81,24 +138,46 @@ BOOL LLPanelFace::postBuild()
{
childSetCommitCallback("combobox shininess",&LLPanelFace::onCommitShiny,this);
childSetCommitCallback("combobox bumpiness",&LLPanelFace::onCommitBump,this);
-
+ childSetCommitCallback("combobox alphamode",&LLPanelFace::onCommitAlphaMode,this);
childSetCommitCallback("TexScaleU",&LLPanelFace::onCommitTextureInfo, this);
- childSetCommitCallback("checkbox flip s",&LLPanelFace::onCommitTextureInfo, this);
+ childSetCommitCallback("flipTextureScaleU", boost::bind(&LLPanelFace::onCommitFlip, this, true));
childSetCommitCallback("TexScaleV",&LLPanelFace::onCommitTextureInfo, this);
- childSetCommitCallback("checkbox flip t",&LLPanelFace::onCommitTextureInfo, this);
+ childSetCommitCallback("flipTextureScaleV", boost::bind(&LLPanelFace::onCommitFlip, this, false));
childSetCommitCallback("TexRot",&LLPanelFace::onCommitTextureInfo, this);
- childSetAction("button apply",&LLPanelFace::onClickApply,this);
+ childSetCommitCallback("rptctrl",&LLPanelFace::onCommitRepeatsPerMeter, this);
childSetCommitCallback("checkbox planar align",&LLPanelFace::onCommitPlanarAlign, this);
childSetCommitCallback("TexOffsetU",LLPanelFace::onCommitTextureInfo, this);
childSetCommitCallback("TexOffsetV",LLPanelFace::onCommitTextureInfo, this);
+
+ childSetCommitCallback("bumpyScaleU",&LLPanelFace::onCommitMaterialBumpyScaleX, this);
+ childSetCommitCallback("bumpyScaleV",&LLPanelFace::onCommitMaterialBumpyScaleY, this);
+ childSetCommitCallback("bumpyRot",&LLPanelFace::onCommitMaterialBumpyRot, this);
+ childSetCommitCallback("bumpyOffsetU",&LLPanelFace::onCommitMaterialBumpyOffsetX, this);
+ childSetCommitCallback("bumpyOffsetV",&LLPanelFace::onCommitMaterialBumpyOffsetY, this);
+ childSetCommitCallback("shinyScaleU",&LLPanelFace::onCommitMaterialShinyScaleX, this);
+ childSetCommitCallback("shinyScaleV",&LLPanelFace::onCommitMaterialShinyScaleY, this);
+ childSetCommitCallback("shinyRot",&LLPanelFace::onCommitMaterialShinyRot, this);
+ childSetCommitCallback("shinyOffsetU",&LLPanelFace::onCommitMaterialShinyOffsetX, this);
+ childSetCommitCallback("shinyOffsetV",&LLPanelFace::onCommitMaterialShinyOffsetY, this);
+ childSetCommitCallback("glossiness",&LLPanelFace::onCommitMaterialGloss, this);
+ childSetCommitCallback("environment",&LLPanelFace::onCommitMaterialEnv, this);
+ childSetCommitCallback("maskcutoff",&LLPanelFace::onCommitMaterialMaskCutoff, this);
+
childSetAction("button align",&LLPanelFace::onClickAutoFix,this);
+
+ childSetCommitCallback("checkbox maps sync", boost::bind(&LLPanelFace::onClickMapsSync, this));
childSetAction("copytextures",&LLPanelFace::onClickCopy,this);
childSetAction("pastetextures",&LLPanelFace::onClickPaste,this);
-
+
LLTextureCtrl* mTextureCtrl;
+ LLTextureCtrl* mShinyTextureCtrl;
+ LLTextureCtrl* mBumpyTextureCtrl;
LLColorSwatchCtrl* mColorSwatch;
+ LLColorSwatchCtrl* mShinyColorSwatch;
LLComboBox* mComboTexGen;
+ LLComboBox* mComboMatMedia;
+ LLComboBox* mComboMatType;
LLCheckBoxCtrl *mCheckFullbright;
@@ -108,6 +187,7 @@ BOOL LLPanelFace::postBuild()
LLSpinCtrl* mCtrlGlow;
setMouseOpaque(FALSE);
+
mTextureCtrl = getChild("texture control");
if(mTextureCtrl)
{
@@ -116,27 +196,48 @@ BOOL LLPanelFace::postBuild()
mTextureCtrl->setOnCancelCallback( boost::bind(&LLPanelFace::onCancelTexture, this, _2) );
mTextureCtrl->setOnSelectCallback( boost::bind(&LLPanelFace::onSelectTexture, this, _2) );
mTextureCtrl->setDragCallback(boost::bind(&LLPanelFace::onDragTexture, this, _2));
+ mTextureCtrl->setOnTextureSelectedCallback(boost::bind(&LLPanelFace::onTextureSelectionChanged, this, _1));
+ mTextureCtrl->setOnCloseCallback( boost::bind(&LLPanelFace::onCloseTexturePicker, this, _2) );
+
mTextureCtrl->setFollowsTop();
mTextureCtrl->setFollowsLeft();
- // Don't allow (no copy) or (no transfer) textures to be selected during immediate mode
- mTextureCtrl->setImmediateFilterPermMask(PERM_COPY | PERM_TRANSFER);
- // Allow any texture to be used during non-immediate mode.
- mTextureCtrl->setNonImmediateFilterPermMask(PERM_NONE);
- LLAggregatePermissions texture_perms;
- if (LLSelectMgr::getInstance()->selectGetAggregateTexturePermissions(texture_perms))
- {
- BOOL can_copy =
- texture_perms.getValue(PERM_COPY) == LLAggregatePermissions::AP_EMPTY ||
- texture_perms.getValue(PERM_COPY) == LLAggregatePermissions::AP_ALL;
- BOOL can_transfer =
- texture_perms.getValue(PERM_TRANSFER) == LLAggregatePermissions::AP_EMPTY ||
- texture_perms.getValue(PERM_TRANSFER) == LLAggregatePermissions::AP_ALL;
- mTextureCtrl->setCanApplyImmediately(can_copy && can_transfer);
- }
- else
- {
- mTextureCtrl->setCanApplyImmediately(FALSE);
- }
+ mTextureCtrl->setImmediateFilterPermMask(PERM_NONE);
+ mTextureCtrl->setDnDFilterPermMask(PERM_COPY | PERM_TRANSFER);
+ }
+
+ mShinyTextureCtrl = getChild("shinytexture control");
+ if(mShinyTextureCtrl)
+ {
+ mShinyTextureCtrl->setDefaultImageAssetID(LLUUID( gSavedSettings.getString( "DefaultObjectSpecularTexture" )));
+ mShinyTextureCtrl->setCommitCallback( boost::bind(&LLPanelFace::onCommitSpecularTexture, this, _2) );
+ mShinyTextureCtrl->setOnCancelCallback( boost::bind(&LLPanelFace::onCancelSpecularTexture, this, _2) );
+ mShinyTextureCtrl->setOnSelectCallback( boost::bind(&LLPanelFace::onSelectSpecularTexture, this, _2) );
+ mShinyTextureCtrl->setOnCloseCallback( boost::bind(&LLPanelFace::onCloseTexturePicker, this, _2) );
+
+ mShinyTextureCtrl->setDragCallback(boost::bind(&LLPanelFace::onDragTexture, this, _2));
+ mShinyTextureCtrl->setOnTextureSelectedCallback(boost::bind(&LLPanelFace::onTextureSelectionChanged, this, _1));
+ mShinyTextureCtrl->setFollowsTop();
+ mShinyTextureCtrl->setFollowsLeft();
+ mShinyTextureCtrl->setImmediateFilterPermMask(PERM_NONE);
+ mShinyTextureCtrl->setDnDFilterPermMask(PERM_COPY | PERM_TRANSFER);
+ }
+
+ mBumpyTextureCtrl = getChild("bumpytexture control");
+ if(mBumpyTextureCtrl)
+ {
+ mBumpyTextureCtrl->setDefaultImageAssetID(LLUUID( gSavedSettings.getString( "DefaultObjectNormalTexture" )));
+ mBumpyTextureCtrl->setBlankImageAssetID(LLUUID( gSavedSettings.getString( "DefaultBlankNormalTexture" )));
+ mBumpyTextureCtrl->setCommitCallback( boost::bind(&LLPanelFace::onCommitNormalTexture, this, _2) );
+ mBumpyTextureCtrl->setOnCancelCallback( boost::bind(&LLPanelFace::onCancelNormalTexture, this, _2) );
+ mBumpyTextureCtrl->setOnSelectCallback( boost::bind(&LLPanelFace::onSelectNormalTexture, this, _2) );
+ mBumpyTextureCtrl->setOnCloseCallback( boost::bind(&LLPanelFace::onCloseTexturePicker, this, _2) );
+
+ mBumpyTextureCtrl->setDragCallback(boost::bind(&LLPanelFace::onDragTexture, this, _2));
+ mBumpyTextureCtrl->setOnTextureSelectedCallback(boost::bind(&LLPanelFace::onTextureSelectionChanged, this, _1));
+ mBumpyTextureCtrl->setFollowsTop();
+ mBumpyTextureCtrl->setFollowsLeft();
+ mBumpyTextureCtrl->setImmediateFilterPermMask(PERM_NONE);
+ mBumpyTextureCtrl->setDnDFilterPermMask(PERM_COPY | PERM_TRANSFER);
}
mColorSwatch = getChild("colorswatch");
@@ -150,6 +251,15 @@ BOOL LLPanelFace::postBuild()
mColorSwatch->setCanApplyImmediately(TRUE);
}
+ mShinyColorSwatch = getChild("shinycolorswatch");
+ if(mShinyColorSwatch)
+ {
+ mShinyColorSwatch->setCommitCallback(boost::bind(&LLPanelFace::onCommitShinyColor, this, _2));
+ mShinyColorSwatch->setFollowsTop();
+ mShinyColorSwatch->setFollowsLeft();
+ mShinyColorSwatch->setCanApplyImmediately(TRUE);
+ }
+
mLabelColorTransp = getChild("color trans");
if(mLabelColorTransp)
{
@@ -179,12 +289,26 @@ BOOL LLPanelFace::postBuild()
mComboTexGen->setFollows(FOLLOWS_LEFT | FOLLOWS_TOP);
}
+ mComboMatMedia = getChild("combobox matmedia");
+ if(mComboMatMedia)
+ {
+ mComboMatMedia->setCommitCallback(LLPanelFace::onCommitMaterialsMedia,this);
+ mComboMatMedia->selectNthItem(MATMEDIA_MATERIAL);
+ }
+
+ mComboMatType = getChild("combobox mattype");
+ if(mComboMatType)
+ {
+ mComboMatType->setCommitCallback(boost::bind(&LLPanelFace::onCommitMaterialType, this));
+ mComboMatType->selectNthItem(MATTYPE_DIFFUSE);
+ }
+
mCtrlGlow = getChild("glow");
if(mCtrlGlow)
{
mCtrlGlow->setCommitCallback(LLPanelFace::onCommitGlow, this);
}
-
+
clearCtrls();
@@ -192,8 +316,10 @@ BOOL LLPanelFace::postBuild()
}
LLPanelFace::LLPanelFace(const std::string& name)
-: LLPanel(name)
+: LLPanel(name),
+ mIsAlpha(false)
{
+ USE_TEXTURE = LLTrans::getString("use_texture");
}
@@ -220,11 +346,31 @@ void LLPanelFace::sendTexture()
}
}
-void LLPanelFace::sendBump()
+void LLPanelFace::sendBump(U32 bumpiness)
{
- LLComboBox* mComboBumpiness = getChild("combobox bumpiness");
- if(!mComboBumpiness)return;
- U8 bump = (U8) mComboBumpiness->getCurrentIndex() & TEM_BUMP_MASK;
+ LLTextureCtrl* bumpytexture_ctrl = getChild("bumpytexture control");
+ if (bumpiness < BUMPY_TEXTURE)
+ {
+ LL_DEBUGS("Materials") << "clearing bumptexture control" << LL_ENDL;
+ bumpytexture_ctrl->clear();
+ bumpytexture_ctrl->setImageAssetID(LLUUID());
+ }
+
+ updateBumpyControls(bumpiness == BUMPY_TEXTURE, true);
+
+ LLUUID current_normal_map = bumpytexture_ctrl->getImageAssetID();
+
+ U8 bump = (U8) bumpiness & TEM_BUMP_MASK;
+
+ // Clear legacy bump to None when using an actual normal map
+ //
+ if (!current_normal_map.isNull())
+ bump = 0;
+
+ // Set the normal map or reset it to null as appropriate
+ //
+ LLSelectedTEMaterial::setNormalID(this, current_normal_map);
+
LLSelectMgr::getInstance()->selectionSetBumpmap( bump );
}
@@ -236,12 +382,28 @@ void LLPanelFace::sendTexGen()
LLSelectMgr::getInstance()->selectionSetTexGen( tex_gen );
}
-void LLPanelFace::sendShiny()
+void LLPanelFace::sendShiny(U32 shininess)
{
- LLComboBox* mComboShininess = getChild("combobox shininess");
- if(!mComboShininess)return;
- U8 shiny = (U8) mComboShininess->getCurrentIndex() & TEM_SHINY_MASK;
+ LLTextureCtrl* texture_ctrl = getChild("shinytexture control");
+
+ if (shininess < SHINY_TEXTURE)
+ {
+ texture_ctrl->clear();
+ texture_ctrl->setImageAssetID(LLUUID());
+ }
+
+ LLUUID specmap = getCurrentSpecularMap();
+
+ U8 shiny = (U8) shininess & TEM_SHINY_MASK;
+ if (!specmap.isNull())
+ shiny = 0;
+
+ LLSelectedTEMaterial::setSpecularID(this, specmap);
+
LLSelectMgr::getInstance()->selectionSetShiny( shiny );
+
+ updateShinyControls(!specmap.isNull(), true);
+
}
void LLPanelFace::sendFullbright()
@@ -254,7 +416,6 @@ void LLPanelFace::sendFullbright()
void LLPanelFace::sendColor()
{
-
LLColorSwatchCtrl* mColorSwatch = getChild("colorswatch");
if(!mColorSwatch)return;
LLColor4 color = mColorSwatch->get();
@@ -274,7 +435,7 @@ void LLPanelFace::sendAlpha()
void LLPanelFace::sendGlow()
{
- LLSpinCtrl* mCtrlGlow = getChild("glow");
+ LLSpinCtrl* mCtrlGlow = getChild("glow");
llassert(mCtrlGlow);
if (mCtrlGlow)
{
@@ -295,21 +456,16 @@ struct LLPanelFaceSetTEFunctor : public LLSelectedTEFunctor
LLSpinCtrl* ctrlTexOffsetS = mPanel->getChild("TexOffsetU");
LLSpinCtrl* ctrlTexOffsetT = mPanel->getChild("TexOffsetV");
LLSpinCtrl* ctrlTexRotation = mPanel->getChild("TexRot");
- LLCheckBoxCtrl* checkFlipScaleS = mPanel->getChild("checkbox flip s");
- LLCheckBoxCtrl* checkFlipScaleT = mPanel->getChild("checkbox flip t");
LLComboBox* comboTexGen = mPanel->getChild("combobox texgen");
llassert(comboTexGen);
llassert(object);
+
if (ctrlTexScaleS)
{
- valid = !ctrlTexScaleS->getTentative() || !checkFlipScaleS->getTentative();
+ valid = !ctrlTexScaleS->getTentative();
if (valid)
{
value = ctrlTexScaleS->get();
- if( checkFlipScaleS->get() )
- {
- value = -value;
- }
if (comboTexGen &&
comboTexGen->getCurrentIndex() == 1)
{
@@ -321,14 +477,10 @@ struct LLPanelFaceSetTEFunctor : public LLSelectedTEFunctor
if (ctrlTexScaleT)
{
- valid = !ctrlTexScaleT->getTentative() || !checkFlipScaleT->getTentative();
+ valid = !ctrlTexScaleT->getTentative();
if (valid)
{
value = ctrlTexScaleT->get();
- if( checkFlipScaleT->get() )
- {
- value = -value;
- }
if (comboTexGen &&
comboTexGen->getCurrentIndex() == 1)
{
@@ -456,10 +608,10 @@ struct LLPanelFaceGetIsAlignedTEFunctor : public LLSelectedTEFunctor
tep->getScale(&st_scale.mV[VX], &st_scale.mV[VY]);
F32 st_rot = tep->getRotation();
// needs a fuzzy comparison, because of fp errors
- if (is_approx_equal_fraction(st_offset.mV[VX], aligned_st_offset.mV[VX], 16) &&
- is_approx_equal_fraction(st_offset.mV[VY], aligned_st_offset.mV[VY], 16) &&
- is_approx_equal_fraction(st_scale.mV[VX], aligned_st_scale.mV[VX], 16) &&
- is_approx_equal_fraction(st_scale.mV[VY], aligned_st_scale.mV[VY], 16) &&
+ if (is_approx_equal_fraction(st_offset.mV[VX], aligned_st_offset.mV[VX], 12) &&
+ is_approx_equal_fraction(st_offset.mV[VY], aligned_st_offset.mV[VY], 12) &&
+ is_approx_equal_fraction(st_scale.mV[VX], aligned_st_scale.mV[VX], 12) &&
+ is_approx_equal_fraction(st_scale.mV[VY], aligned_st_scale.mV[VY], 12) &&
is_approx_equal_fraction(st_rot, aligned_st_rot, 14))
{
return true;
@@ -484,16 +636,9 @@ void LLPanelFace::sendTextureInfo()
{
if ((bool)childGetValue("checkbox planar align").asBoolean())
{
- struct f1 : public LLSelectedTEGetFunctor
- {
- LLFace* get(LLViewerObject* object, S32 te)
- {
- return (object->mDrawable) ? object->mDrawable->getFace(te): NULL;
- }
- } get_last_face_func;
- LLFace* last_face(NULL);
- LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue(&get_last_face_func, last_face);
-
+ LLFace* last_face = NULL;
+ bool identical_face = false;
+ LLSelectedTE::getFace(last_face, identical_face);
LLPanelFaceSetAlignedTEFunctor setfunc(this, last_face);
LLSelectMgr::getInstance()->getSelection()->applyToTEs(&setfunc);
}
@@ -509,8 +654,13 @@ void LLPanelFace::sendTextureInfo()
void LLPanelFace::getState()
{
+ updateUI();
+}
+
+void LLPanelFace::updateUI()
+{ //set state of UI to match state of texture entry(ies) (calls setEnabled, setValue, etc, but NOT setVisible)
LLViewerObject* objectp = LLSelectMgr::getInstance()->getSelection()->getFirstObject();
- LLCalc* calcp = LLCalc::getInstance();
+
if( objectp
&& objectp->getPCode() == LL_PCODE_VOLUME
&& objectp->permModify())
@@ -519,268 +669,74 @@ void LLPanelFace::getState()
// only turn on auto-adjust button if there is a media renderer and the media is loaded
getChildView("button align")->setEnabled(editable);
-
- //if ( LLMediaEngine::getInstance()->getMediaRenderer () )
- // if ( LLMediaEngine::getInstance()->getMediaRenderer ()->isLoaded () )
- // {
- //
- // //mLabelTexAutoFix->setEnabled ( editable );
- //
- // //mBtnAutoFix->setEnabled ( editable );
- // }
+
+ bool enable_material_controls = (!gSavedSettings.getBOOL("FSSynchronizeTextureMaps"));
S32 selected_count = LLSelectMgr::getInstance()->getSelection()->getObjectCount();
BOOL single_volume = (LLSelectMgr::getInstance()->selectionAllPCode( LL_PCODE_VOLUME ))
&& (selected_count == 1);
- childSetEnabled("copytextures", single_volume && editable);
- childSetEnabled("pastetextures", single_volume && editable);
- childSetEnabled("textbox params", single_volume && editable);
- getChildView("button apply")->setEnabled(editable);
+ getChildView("copytextures")->setEnabled(single_volume && editable);
+ getChildView("pastetextures")->setEnabled(editable);
+
+ LLComboBox* combobox_matmedia = getChild("combobox matmedia");
+ if (combobox_matmedia)
+ {
+ if (combobox_matmedia->getCurrentIndex() < MATMEDIA_MATERIAL)
+ {
+ combobox_matmedia->selectNthItem(MATMEDIA_MATERIAL);
+ }
+ }
+ else
+ {
+ LL_WARNS("Materials") << "failed getChild for 'combobox matmedia'" << LL_ENDL;
+ }
+ getChildView("combobox matmedia")->setEnabled(editable);
+
+ LLComboBox* combobox_mattype = getChild("combobox mattype");
+ if (combobox_mattype)
+ {
+ if (combobox_mattype->getCurrentIndex() < MATTYPE_DIFFUSE)
+ {
+ combobox_mattype->selectNthItem(MATTYPE_DIFFUSE);
+ }
+ }
+ else
+ {
+ LL_WARNS("Materials") << "failed getChild for 'combobox mattype'" << LL_ENDL;
+ }
+ getChildView("combobox mattype")->setEnabled(editable);
+
+ updateVisibility();
+
+ bool identical = true; // true because it is anded below
+ bool identical_diffuse = false;
+ bool identical_norm = false;
+ bool identical_spec = false;
- bool identical;
LLTextureCtrl* texture_ctrl = getChild("texture control");
texture_ctrl->setFallbackImageName( "" ); //Singu Note: Don't show the 'locked' image when the texid is null.
- // Texture
- {
- LLUUID id;
- struct f1 : public LLSelectedTEGetFunctor
- {
- LLUUID get(LLViewerObject* object, S32 te_index)
- {
- LLUUID id;
- //LLViewerTexture* image = object->getTEImage(te);
- LLTextureEntry* image = object->getTE(te_index); //Singu Note: Use this instead of the above.
- //The above actually returns LLViewerFetchedTexture::sDefaultImagep when
- //the texture id is null, which gives us IMG_DEFAULT, not LLUUID::null
- //Such behavior prevents the 'None' button from ever greying out in the face panel.
- if (image) id = image->getID();
-
- if (!id.isNull() && LLViewerMedia::textureHasMedia(id))
- {
- LLTextureEntry *te = object->getTE(te_index);
- if (te)
- {
- LLViewerTexture* tex = te->getID().notNull() ? gTextureList.findImage(te->getID()) : NULL ;
- if(!tex)
- {
- tex = LLViewerFetchedTexture::sDefaultImagep;
- }
- if (tex)
- {
- id = tex->getID();
- }
- }
- }
- return id;
- }
- } func;
- identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, id );
+ LLTextureCtrl* shinytexture_ctrl = getChild("shinytexture control");
+ shinytexture_ctrl->setFallbackImageName( "" ); //Singu Note: Don't show the 'locked' image when the texid is null.
+ LLTextureCtrl* bumpytexture_ctrl = getChild("bumpytexture control");
+ bumpytexture_ctrl->setFallbackImageName( "" ); //Singu Note: Don't show the 'locked' image when the texid is null.
- if(LLViewerMedia::textureHasMedia(id))
- {
- getChildView("button align")->setEnabled(editable);
- }
-
- if (identical)
- {
- // All selected have the same texture
- if(texture_ctrl)
- {
- texture_ctrl->setTentative( FALSE );
- texture_ctrl->setEnabled( editable );
- texture_ctrl->setImageAssetID( id );
- }
- }
- else
- {
- if(texture_ctrl)
- {
- if( id.isNull() )
- {
- // None selected
- texture_ctrl->setTentative( FALSE );
- texture_ctrl->setEnabled( FALSE );
- texture_ctrl->setImageAssetID( LLUUID::null );
- }
- else
- {
- // Tentative: multiple selected with different textures
- texture_ctrl->setTentative( TRUE );
- texture_ctrl->setEnabled( editable );
- texture_ctrl->setImageAssetID( id );
- }
- }
- }
- }
-
-
- LLAggregatePermissions texture_perms;
- if(texture_ctrl)
- {
-// texture_ctrl->setValid( editable );
-
- if (LLSelectMgr::getInstance()->selectGetAggregateTexturePermissions(texture_perms))
- {
- BOOL can_copy =
- texture_perms.getValue(PERM_COPY) == LLAggregatePermissions::AP_EMPTY ||
- texture_perms.getValue(PERM_COPY) == LLAggregatePermissions::AP_ALL;
- BOOL can_transfer =
- texture_perms.getValue(PERM_TRANSFER) == LLAggregatePermissions::AP_EMPTY ||
- texture_perms.getValue(PERM_TRANSFER) == LLAggregatePermissions::AP_ALL;
- texture_ctrl->setCanApplyImmediately(can_copy && can_transfer);
- }
- else
- {
- texture_ctrl->setCanApplyImmediately(FALSE);
- }
- }
-
-
- // planar align
- bool align_planar = false;
- bool identical_planar_aligned = false;
- bool is_planar = false;
- {
- LLCheckBoxCtrl* cb_planar_align = getChild("checkbox planar align");
- align_planar = (cb_planar_align && cb_planar_align->get());
- struct f1 : public LLSelectedTEGetFunctor
- {
- bool get(LLViewerObject* object, S32 face)
- {
- return (object->getTE(face)->getTexGen() == LLTextureEntry::TEX_GEN_PLANAR);
- }
- } func;
-
- bool texgens_identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, is_planar );
- bool enabled = (editable && texgens_identical && is_planar);
- childSetValue("checkbox planar align", align_planar && enabled);
- childSetEnabled("checkbox planar align", enabled);
-
- if (align_planar && enabled)
- {
- struct f2 : public LLSelectedTEGetFunctor
- {
- LLFace* get(LLViewerObject* object, S32 te)
- {
- return (object->mDrawable) ? object->mDrawable->getFace(te): NULL;
- }
- } get_te_face_func;
- LLFace* last_face(NULL);
- LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue(&get_te_face_func, last_face);
- LLPanelFaceGetIsAlignedTEFunctor get_is_aligend_func(last_face);
- // this will determine if the texture param controls are tentative:
- identical_planar_aligned = LLSelectMgr::getInstance()->getSelection()->applyToTEs(&get_is_aligend_func);
- }
- }
-
- // Texture scale
- {
- getChildView("tex scale")->setEnabled(editable);
- //mLabelTexScale->setEnabled( editable );
- F32 scale_s = 1.f;
- struct f2 : public LLSelectedTEGetFunctor
- {
- F32 get(LLViewerObject* object, S32 face)
- {
- return object->getTE(face)->mScaleS;
- }
- } func;
- identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, scale_s );
- identical = align_planar ? identical_planar_aligned : identical;
- getChild("TexScaleU")->setValue(editable ? llabs(scale_s) : 0);
- getChild("TexScaleU")->setTentative(LLSD((BOOL)(!identical)));
- getChildView("TexScaleU")->setEnabled(editable);
- getChild("checkbox flip s")->setValue(LLSD((BOOL)(scale_s < 0 ? TRUE : FALSE )));
- getChild("checkbox flip s")->setTentative(LLSD((BOOL)((!identical) ? TRUE : FALSE )));
- getChildView("checkbox flip s")->setEnabled(editable);
- }
-
- {
- F32 scale_t = 1.f;
- struct f3 : public LLSelectedTEGetFunctor
- {
- F32 get(LLViewerObject* object, S32 face)
- {
- return object->getTE(face)->mScaleT;
- }
- } func;
- identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, scale_t );
- identical = align_planar ? identical_planar_aligned : identical;
-
- getChild("TexScaleV")->setValue(llabs(editable ? llabs(scale_t) : 0));
- getChild("TexScaleV")->setTentative(LLSD((BOOL)(!identical)));
- getChildView("TexScaleV")->setEnabled(editable);
- getChild("checkbox flip t")->setValue(LLSD((BOOL)(scale_t< 0 ? TRUE : FALSE )));
- getChild("checkbox flip t")->setTentative(LLSD((BOOL)((!identical) ? TRUE : FALSE )));
- getChildView("checkbox flip t")->setEnabled(editable);
- }
-
- // Texture offset
- {
- getChildView("tex offset")->setEnabled(editable);
- F32 offset_s = 0.f;
- struct f4 : public LLSelectedTEGetFunctor
- {
- F32 get(LLViewerObject* object, S32 face)
- {
- return object->getTE(face)->mOffsetS;
- }
- } func;
- identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, offset_s );
- identical = align_planar ? identical_planar_aligned : identical;
- getChild("TexOffsetU")->setValue(editable ? offset_s : 0);
- getChild("TexOffsetU")->setTentative(!identical);
- getChildView("TexOffsetU")->setEnabled(editable);
- }
-
- {
- F32 offset_t = 0.f;
- struct f5 : public LLSelectedTEGetFunctor
- {
- F32 get(LLViewerObject* object, S32 face)
- {
- return object->getTE(face)->mOffsetT;
- }
- } func;
- identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, offset_t );
- identical = align_planar ? identical_planar_aligned : identical;
- getChild("TexOffsetV")->setValue(editable ? offset_t : 0);
- getChild("TexOffsetV")->setTentative(!identical);
- getChildView("TexOffsetV")->setEnabled(editable);
- }
-
- // Texture rotation
- {
- getChildView("tex rotate")->setEnabled(editable);
- F32 rotation = 0.f;
- struct f6 : public LLSelectedTEGetFunctor
- {
- F32 get(LLViewerObject* object, S32 face)
- {
- return object->getTE(face)->mRotation;
- }
- } func;
- identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, rotation );
- identical = align_planar ? identical_planar_aligned : identical;
- getChild("TexRot")->setValue(editable ? rotation * RAD_TO_DEG : 0);
- getChild("TexRot")->setTentative(!identical);
- getChildView("TexRot")->setEnabled(editable);
- }
+ LLUUID id;
+ LLUUID normmap_id;
+ LLUUID specmap_id;
// Color swatch
+ {
+ getChildView("color label")->setEnabled(editable);
+ }
LLColorSwatchCtrl* mColorSwatch = getChild("colorswatch");
- LLColor4 color = LLColor4::white;
+
+ LLColor4 color = LLColor4::white;
+ bool identical_color =false;
+
if(mColorSwatch)
{
- struct f7 : public LLSelectedTEGetFunctor
- {
- LLColor4 get(LLViewerObject* object, S32 face)
- {
- return object->getTE(face)->getColor();
- }
- } func;
- identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, color );
-
+ LLSelectedTE::getColor(color, identical_color);
+
mColorSwatch->setOriginal(color);
mColorSwatch->set(color, TRUE);
@@ -788,176 +744,676 @@ void LLPanelFace::getState()
mColorSwatch->setEnabled( editable );
mColorSwatch->setCanApplyImmediately( editable );
}
+
// Color transparency
- {
- getChildView("color trans")->setEnabled(editable);
- }
+ getChildView("color trans")->setEnabled(editable);
F32 transparency = (1.f - color.mV[VALPHA]) * 100.f;
+ getChild("ColorTrans")->setValue(editable ? transparency : 0);
+ getChildView("ColorTrans")->setEnabled(editable);
+
+ // Specular map
+ LLSelectedTEMaterial::getSpecularID(specmap_id, identical_spec);
+
+ U8 shiny = 0;
+ bool identical_shiny = false;
+
+ // Shiny
+ LLSelectedTE::getShiny(shiny, identical_shiny);
+ identical = identical && identical_shiny;
+
+ shiny = specmap_id.isNull() ? shiny : SHINY_TEXTURE;
+
+ LLCtrlSelectionInterface* combobox_shininess = childGetSelectionInterface("combobox shininess");
+ if (combobox_shininess)
{
- getChild("ColorTrans")->setValue(editable ? transparency : 0);
- getChildView("ColorTrans")->setEnabled(editable);
+ combobox_shininess->selectNthItem((S32)shiny);
}
+ getChildView("label shininess")->setEnabled(editable);
+ getChildView("combobox shininess")->setEnabled(editable);
+
+ getChildView("label glossiness")->setEnabled(editable);
+ getChildView("glossiness")->setEnabled(editable);
+
+ getChildView("label environment")->setEnabled(editable);
+ getChildView("environment")->setEnabled(editable);
+ getChildView("label shinycolor")->setEnabled(editable);
+
+ getChild("combobox shininess")->setTentative(!identical_spec);
+ getChild("glossiness")->setTentative(!identical_spec);
+ getChild("environment")->setTentative(!identical_spec);
+ getChild("shinycolorswatch")->setTentative(!identical_spec);
+
+ LLColorSwatchCtrl* mShinyColorSwatch = getChild("shinycolorswatch");
+ if(mShinyColorSwatch)
{
- F32 glow = 0.f;
- struct f8 : public LLSelectedTEGetFunctor
- {
- F32 get(LLViewerObject* object, S32 face)
- {
- return object->getTE(face)->getGlow();
- }
- } func;
- identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, glow );
-
- getChild("glow")->setValue(glow);
- getChildView("glow")->setEnabled(editable);
- getChild("glow")->setTentative(!identical);
- getChildView("glow label")->setEnabled(editable);
-
+ mShinyColorSwatch->setValid(editable);
+ mShinyColorSwatch->setEnabled( editable );
+ mShinyColorSwatch->setCanApplyImmediately( editable );
}
- // Bump
+ U8 bumpy = 0;
+ // Bumpy
{
- F32 shinyf = 0.f;
- struct f9 : public LLSelectedTEGetFunctor
- {
- F32 get(LLViewerObject* object, S32 face)
- {
- return (F32)(object->getTE(face)->getShiny());
- }
- } func;
- identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, shinyf );
- LLCtrlSelectionInterface* combobox_shininess =
- childGetSelectionInterface("combobox shininess");
- if (combobox_shininess)
- {
- combobox_shininess->selectNthItem((S32)shinyf);
- }
- else
- {
- llwarns << "failed childGetSelectionInterface for 'combobox shininess'" << llendl;
- }
- getChildView("combobox shininess")->setEnabled(editable);
- getChild("combobox shininess")->setTentative(!identical);
- getChildView("label shininess")->setEnabled(editable);
- }
+ bool identical_bumpy = false;
+ LLSelectedTE::getBumpmap(bumpy,identical_bumpy);
+
+ LLUUID norm_map_id = getCurrentNormalMap();
+ LLCtrlSelectionInterface* combobox_bumpiness = childGetSelectionInterface("combobox bumpiness");
+
+ bumpy = norm_map_id.isNull() ? bumpy : BUMPY_TEXTURE;
- {
- F32 bumpf = 0.f;
- struct f10 : public LLSelectedTEGetFunctor
- {
- F32 get(LLViewerObject* object, S32 face)
- {
- return (F32)(object->getTE(face)->getBumpmap());
- }
- } func;
- identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, bumpf );
- LLCtrlSelectionInterface* combobox_bumpiness =
- childGetSelectionInterface("combobox bumpiness");
if (combobox_bumpiness)
{
- combobox_bumpiness->selectNthItem((S32)bumpf);
+ combobox_bumpiness->selectNthItem((S32)bumpy);
}
else
{
llwarns << "failed childGetSelectionInterface for 'combobox bumpiness'" << llendl;
}
+
getChildView("combobox bumpiness")->setEnabled(editable);
- getChild("combobox bumpiness")->setTentative(!identical);
+ getChild("combobox bumpiness")->setTentative(!identical_bumpy);
getChildView("label bumpiness")->setEnabled(editable);
}
+ // Texture
{
- F32 genf = 0.f;
- struct f11 : public LLSelectedTEGetFunctor
+ LLSelectedTE::getTexId(id,identical_diffuse);
+
+ // Normal map
+ LLSelectedTEMaterial::getNormalID(normmap_id, identical_norm);
+
+ mIsAlpha = FALSE;
+ LLGLenum image_format = GL_RGB;
+ bool identical_image_format = false;
+ LLSelectedTE::getImageFormat(image_format, identical_image_format);
+
+ mIsAlpha = FALSE;
+ switch (image_format)
{
- F32 get(LLViewerObject* object, S32 face)
+ case GL_RGBA:
+ case GL_ALPHA:
{
- return (F32)(object->getTE(face)->getTexGen());
+ mIsAlpha = TRUE;
}
- } func;
- identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, genf );
- S32 selected_texgen = ((S32) genf) >> TEM_TEX_GEN_SHIFT;
- LLCtrlSelectionInterface* combobox_texgen =
- childGetSelectionInterface("combobox texgen");
+ break;
+
+ case GL_RGB: break;
+ default:
+ {
+ LL_WARNS("Materials") << "Unexpected tex format in LLPanelFace...resorting to no alpha" << LL_ENDL;
+ }
+ break;
+ }
+
+ if(LLViewerMedia::textureHasMedia(id))
+ {
+ getChildView("button align")->setEnabled(editable);
+ }
+
+ // Diffuse Alpha Mode
+
+ // Init to the default that is appropriate for the alpha content of the asset
+ //
+ U8 alpha_mode = mIsAlpha ? LLMaterial::DIFFUSE_ALPHA_MODE_BLEND : LLMaterial::DIFFUSE_ALPHA_MODE_NONE;
+
+ bool identical_alpha_mode = false;
+
+ // See if that's been overridden by a material setting for same...
+ //
+ LLSelectedTEMaterial::getCurrentDiffuseAlphaMode(alpha_mode, identical_alpha_mode, mIsAlpha);
+
+ LLCtrlSelectionInterface* combobox_alphamode = childGetSelectionInterface("combobox alphamode");
+ if (combobox_alphamode)
+ {
+ //it is invalid to have any alpha mode other than blend if transparency is greater than zero ...
+ // Want masking? Want emissive? Tough! You get BLEND!
+ alpha_mode = (transparency > 0.f) ? LLMaterial::DIFFUSE_ALPHA_MODE_BLEND : alpha_mode;
+
+ // ... unless there is no alpha channel in the texture, in which case alpha mode MUST be none
+ alpha_mode = mIsAlpha ? alpha_mode : LLMaterial::DIFFUSE_ALPHA_MODE_NONE;
+
+ combobox_alphamode->selectNthItem(alpha_mode);
+ }
+ else
+ {
+ LL_WARNS("Materials") << "failed childGetSelectionInterface for 'combobox alphamode'" << LL_ENDL;
+ }
+
+ updateAlphaControls();
+
+ if (texture_ctrl)
+ {
+ if (identical_diffuse)
+ {
+ texture_ctrl->setTentative( FALSE );
+ texture_ctrl->setEnabled( editable );
+ texture_ctrl->setImageAssetID( id );
+ getChildView("combobox alphamode")->setEnabled(editable && mIsAlpha && transparency <= 0.f);
+ getChildView("label alphamode")->setEnabled(editable && mIsAlpha);
+ getChildView("maskcutoff")->setEnabled(editable && mIsAlpha);
+ getChildView("label maskcutoff")->setEnabled(editable && mIsAlpha);
+ }
+ else if (id.isNull())
+ {
+ // None selected
+ texture_ctrl->setTentative( FALSE );
+ texture_ctrl->setEnabled( FALSE );
+ texture_ctrl->setImageAssetID( LLUUID::null );
+ getChildView("combobox alphamode")->setEnabled( FALSE );
+ getChildView("label alphamode")->setEnabled( FALSE );
+ getChildView("maskcutoff")->setEnabled( FALSE);
+ getChildView("label maskcutoff")->setEnabled( FALSE );
+ }
+ else
+ {
+ // Tentative: multiple selected with different textures
+ texture_ctrl->setTentative( TRUE );
+ texture_ctrl->setEnabled( editable );
+ texture_ctrl->setImageAssetID( id );
+ getChildView("combobox alphamode")->setEnabled(editable && mIsAlpha && transparency <= 0.f);
+ getChildView("label alphamode")->setEnabled(editable && mIsAlpha);
+ getChildView("maskcutoff")->setEnabled(editable && mIsAlpha);
+ getChildView("label maskcutoff")->setEnabled(editable && mIsAlpha);
+ }
+ }
+
+ if (shinytexture_ctrl)
+ {
+ if (identical_spec && (shiny == SHINY_TEXTURE))
+ {
+ shinytexture_ctrl->setTentative( FALSE );
+ shinytexture_ctrl->setEnabled( editable );
+ shinytexture_ctrl->setImageAssetID( specmap_id );
+ }
+ else if (specmap_id.isNull())
+ {
+ shinytexture_ctrl->setTentative( FALSE );
+ shinytexture_ctrl->setEnabled( editable );
+ shinytexture_ctrl->setImageAssetID( LLUUID::null );
+ }
+ else
+ {
+ shinytexture_ctrl->setTentative( TRUE );
+ shinytexture_ctrl->setEnabled( editable );
+ shinytexture_ctrl->setImageAssetID( specmap_id );
+ }
+ }
+
+ if (bumpytexture_ctrl)
+ {
+ if (identical_norm && (bumpy == BUMPY_TEXTURE))
+ {
+ bumpytexture_ctrl->setTentative( FALSE );
+ bumpytexture_ctrl->setEnabled( editable );
+ bumpytexture_ctrl->setImageAssetID( normmap_id );
+ }
+ else if (normmap_id.isNull())
+ {
+ bumpytexture_ctrl->setTentative( FALSE );
+ bumpytexture_ctrl->setEnabled( editable );
+ bumpytexture_ctrl->setImageAssetID( LLUUID::null );
+ }
+ else
+ {
+ bumpytexture_ctrl->setTentative( TRUE );
+ bumpytexture_ctrl->setEnabled( editable );
+ bumpytexture_ctrl->setImageAssetID( normmap_id );
+ }
+ }
+ }
+
+ // planar align
+ bool align_planar = false;
+ bool identical_planar_aligned = false;
+ {
+ LLCheckBoxCtrl* cb_planar_align = getChild("checkbox planar align");
+ align_planar = (cb_planar_align && cb_planar_align->get());
+
+ bool enabled = (editable && isIdenticalPlanarTexgen());
+ childSetValue("checkbox planar align", align_planar && enabled);
+ childSetEnabled("checkbox planar align", enabled);
+
+ if (align_planar && enabled)
+ {
+ LLFace* last_face = NULL;
+ bool identical_face = false;
+ LLSelectedTE::getFace(last_face, identical_face);
+
+ LLPanelFaceGetIsAlignedTEFunctor get_is_aligend_func(last_face);
+ // this will determine if the texture param controls are tentative:
+ identical_planar_aligned = LLSelectMgr::getInstance()->getSelection()->applyToTEs(&get_is_aligend_func);
+ }
+ }
+
+ // Needs to be public and before tex scale settings below to properly reflect
+ // behavior when in planar vs default texgen modes in the
+ // NORSPEC-84 et al
+ //
+ LLTextureEntry::e_texgen selected_texgen = LLTextureEntry::TEX_GEN_DEFAULT;
+ bool identical_texgen = true;
+ bool identical_planar_texgen = false;
+
+ {
+ LLSelectedTE::getTexGen(selected_texgen, identical_texgen);
+ identical_planar_texgen = (identical_texgen && (selected_texgen == LLTextureEntry::TEX_GEN_PLANAR));
+ }
+
+ // Texture scale
+ {
+ bool identical_diff_scale_s = false;
+ bool identical_spec_scale_s = false;
+ bool identical_norm_scale_s = false;
+
+ identical = align_planar ? identical_planar_aligned : identical;
+
+ F32 diff_scale_s = 1.f;
+ F32 spec_scale_s = 1.f;
+ F32 norm_scale_s = 1.f;
+
+ LLSelectedTE::getScaleS(diff_scale_s, identical_diff_scale_s);
+ LLSelectedTEMaterial::getSpecularRepeatX(spec_scale_s, identical_spec_scale_s);
+ LLSelectedTEMaterial::getNormalRepeatX(norm_scale_s, identical_norm_scale_s);
+
+ diff_scale_s = editable ? diff_scale_s : 1.0f;
+ diff_scale_s *= identical_planar_texgen ? 2.0f : 1.0f;
+
+ norm_scale_s = editable ? norm_scale_s : 1.0f;
+ norm_scale_s *= identical_planar_texgen ? 2.0f : 1.0f;
+
+ spec_scale_s = editable ? spec_scale_s : 1.0f;
+ spec_scale_s *= identical_planar_texgen ? 2.0f : 1.0f;
+
+ getChild("TexScaleU")->setValue(diff_scale_s);
+ getChild("shinyScaleU")->setValue(spec_scale_s);
+ getChild("bumpyScaleU")->setValue(norm_scale_s);
+
+ getChildView("TexScaleU")->setEnabled(editable);
+ getChildView("shinyScaleU")->setEnabled(editable && specmap_id.notNull()
+ && enable_material_controls); // Materials alignment
+ getChildView("bumpyScaleU")->setEnabled(editable && normmap_id.notNull()
+ && enable_material_controls); // Materials alignment
+
+ BOOL diff_scale_tentative = !(identical && identical_diff_scale_s);
+ BOOL norm_scale_tentative = !(identical && identical_norm_scale_s);
+ BOOL spec_scale_tentative = !(identical && identical_spec_scale_s);
+
+ getChild("TexScaleU")->setTentative( LLSD(diff_scale_tentative));
+ getChild("shinyScaleU")->setTentative(LLSD(spec_scale_tentative));
+ getChild("bumpyScaleU")->setTentative(LLSD(norm_scale_tentative));
+
+ // FIRE-11407 - Materials alignment
+ getChildView("checkbox maps sync")->setEnabled(editable && (specmap_id.notNull() || normmap_id.notNull()));
+ //
+ }
+
+ {
+ bool identical_diff_scale_t = false;
+ bool identical_spec_scale_t = false;
+ bool identical_norm_scale_t = false;
+
+ F32 diff_scale_t = 1.f;
+ F32 spec_scale_t = 1.f;
+ F32 norm_scale_t = 1.f;
+
+ LLSelectedTE::getScaleT(diff_scale_t, identical_diff_scale_t);
+ LLSelectedTEMaterial::getSpecularRepeatY(spec_scale_t, identical_spec_scale_t);
+ LLSelectedTEMaterial::getNormalRepeatY(norm_scale_t, identical_norm_scale_t);
+
+ diff_scale_t = editable ? diff_scale_t : 1.0f;
+ diff_scale_t *= identical_planar_texgen ? 2.0f : 1.0f;
+
+ norm_scale_t = editable ? norm_scale_t : 1.0f;
+ norm_scale_t *= identical_planar_texgen ? 2.0f : 1.0f;
+
+ spec_scale_t = editable ? spec_scale_t : 1.0f;
+ spec_scale_t *= identical_planar_texgen ? 2.0f : 1.0f;
+
+ BOOL diff_scale_tentative = !identical_diff_scale_t;
+ BOOL norm_scale_tentative = !identical_norm_scale_t;
+ BOOL spec_scale_tentative = !identical_spec_scale_t;
+
+ getChildView("TexScaleV")->setEnabled(editable);
+ getChildView("shinyScaleV")->setEnabled(editable && specmap_id.notNull()
+ && enable_material_controls); // Materials alignment
+ getChildView("bumpyScaleV")->setEnabled(editable && normmap_id.notNull()
+ && enable_material_controls); // Materials alignment
+
+ getChild("TexScaleV")->setValue(diff_scale_t);
+ getChild("shinyScaleV")->setValue(norm_scale_t);
+ getChild("bumpyScaleV")->setValue(spec_scale_t);
+
+ getChild("TexScaleV")->setTentative(LLSD(diff_scale_tentative));
+ getChild("shinyScaleV")->setTentative(LLSD(norm_scale_tentative));
+ getChild("bumpyScaleV")->setTentative(LLSD(spec_scale_tentative));
+ }
+
+ // Texture offset
+ {
+ bool identical_diff_offset_s = false;
+ bool identical_norm_offset_s = false;
+ bool identical_spec_offset_s = false;
+
+ F32 diff_offset_s = 0.0f;
+ F32 norm_offset_s = 0.0f;
+ F32 spec_offset_s = 0.0f;
+
+ LLSelectedTE::getOffsetS(diff_offset_s, identical_diff_offset_s);
+ LLSelectedTEMaterial::getNormalOffsetX(norm_offset_s, identical_norm_offset_s);
+ LLSelectedTEMaterial::getSpecularOffsetX(spec_offset_s, identical_spec_offset_s);
+
+ BOOL diff_offset_u_tentative = !(align_planar ? identical_planar_aligned : identical_diff_offset_s);
+ BOOL norm_offset_u_tentative = !(align_planar ? identical_planar_aligned : identical_norm_offset_s);
+ BOOL spec_offset_u_tentative = !(align_planar ? identical_planar_aligned : identical_spec_offset_s);
+
+ getChild("TexOffsetU")->setValue( editable ? diff_offset_s : 0.0f);
+ getChild("bumpyOffsetU")->setValue(editable ? norm_offset_s : 0.0f);
+ getChild("shinyOffsetU")->setValue(editable ? spec_offset_s : 0.0f);
+
+ getChild("TexOffsetU")->setTentative(LLSD(diff_offset_u_tentative));
+ getChild("shinyOffsetU")->setTentative(LLSD(norm_offset_u_tentative));
+ getChild("bumpyOffsetU")->setTentative(LLSD(spec_offset_u_tentative));
+
+ getChildView("TexOffsetU")->setEnabled(editable);
+ getChildView("shinyOffsetU")->setEnabled(editable && specmap_id.notNull()
+ && enable_material_controls); // Materials alignment
+ getChildView("bumpyOffsetU")->setEnabled(editable && normmap_id.notNull()
+ && enable_material_controls); // Materials alignment
+ }
+
+ {
+ bool identical_diff_offset_t = false;
+ bool identical_norm_offset_t = false;
+ bool identical_spec_offset_t = false;
+
+ F32 diff_offset_t = 0.0f;
+ F32 norm_offset_t = 0.0f;
+ F32 spec_offset_t = 0.0f;
+
+ LLSelectedTE::getOffsetT(diff_offset_t, identical_diff_offset_t);
+ LLSelectedTEMaterial::getNormalOffsetY(norm_offset_t, identical_norm_offset_t);
+ LLSelectedTEMaterial::getSpecularOffsetY(spec_offset_t, identical_spec_offset_t);
+
+ BOOL diff_offset_v_tentative = !(align_planar ? identical_planar_aligned : identical_diff_offset_t);
+ BOOL norm_offset_v_tentative = !(align_planar ? identical_planar_aligned : identical_norm_offset_t);
+ BOOL spec_offset_v_tentative = !(align_planar ? identical_planar_aligned : identical_spec_offset_t);
+
+ getChild("TexOffsetV")->setValue( editable ? diff_offset_t : 0.0f);
+ getChild("bumpyOffsetV")->setValue(editable ? norm_offset_t : 0.0f);
+ getChild("shinyOffsetV")->setValue(editable ? spec_offset_t : 0.0f);
+
+ getChild("TexOffsetV")->setTentative(LLSD(diff_offset_v_tentative));
+ getChild("shinyOffsetV")->setTentative(LLSD(norm_offset_v_tentative));
+ getChild("bumpyOffsetV")->setTentative(LLSD(spec_offset_v_tentative));
+
+ getChildView("TexOffsetV")->setEnabled(editable);
+ getChildView("shinyOffsetV")->setEnabled(editable && specmap_id.notNull()
+ && enable_material_controls); // Materials alignment
+ getChildView("bumpyOffsetV")->setEnabled(editable && normmap_id.notNull()
+ && enable_material_controls); // Materials alignment
+ }
+
+ // Texture rotation
+ {
+ bool identical_diff_rotation = false;
+ bool identical_norm_rotation = false;
+ bool identical_spec_rotation = false;
+
+ F32 diff_rotation = 0.f;
+ F32 norm_rotation = 0.f;
+ F32 spec_rotation = 0.f;
+
+ LLSelectedTE::getRotation(diff_rotation,identical_diff_rotation);
+ LLSelectedTEMaterial::getSpecularRotation(spec_rotation,identical_spec_rotation);
+ LLSelectedTEMaterial::getNormalRotation(norm_rotation,identical_norm_rotation);
+
+ BOOL diff_rot_tentative = !(align_planar ? identical_planar_aligned : identical_diff_rotation);
+ BOOL norm_rot_tentative = !(align_planar ? identical_planar_aligned : identical_norm_rotation);
+ BOOL spec_rot_tentative = !(align_planar ? identical_planar_aligned : identical_spec_rotation);
+
+ F32 diff_rot_deg = diff_rotation * RAD_TO_DEG;
+ F32 norm_rot_deg = norm_rotation * RAD_TO_DEG;
+ F32 spec_rot_deg = spec_rotation * RAD_TO_DEG;
+
+ getChildView("TexRot")->setEnabled(editable);
+ getChildView("shinyRot")->setEnabled(editable && specmap_id.notNull()
+ && enable_material_controls); // Materials alignment
+ getChildView("bumpyRot")->setEnabled(editable && normmap_id.notNull()
+ && enable_material_controls); // Materials alignment
+
+ getChild("TexRot")->setTentative(diff_rot_tentative);
+ getChild("shinyRot")->setTentative(LLSD(norm_rot_tentative));
+ getChild("bumpyRot")->setTentative(LLSD(spec_rot_tentative));
+
+ getChild("TexRot")->setValue( editable ? diff_rot_deg : 0.0f);
+ getChild("shinyRot")->setValue(editable ? spec_rot_deg : 0.0f);
+ getChild("bumpyRot")->setValue(editable ? norm_rot_deg : 0.0f);
+ }
+
+ {
+ F32 glow = 0.f;
+ bool identical_glow = false;
+ LLSelectedTE::getGlow(glow,identical_glow);
+ getChild("glow")->setValue(glow);
+ getChild("glow")->setTentative(!identical_glow);
+ getChildView("glow")->setEnabled(editable);
+ getChildView("glow label")->setEnabled(editable);
+ }
+
+ {
+ LLCtrlSelectionInterface* combobox_texgen = childGetSelectionInterface("combobox texgen");
if (combobox_texgen)
{
- combobox_texgen->selectNthItem(selected_texgen);
+ // Maps from enum to combobox entry index
+ combobox_texgen->selectNthItem(((S32)selected_texgen) >> 1);
}
else
{
llwarns << "failed childGetSelectionInterface for 'combobox texgen'" << llendl;
}
+
getChildView("combobox texgen")->setEnabled(editable);
getChild("combobox texgen")->setTentative(!identical);
getChildView("tex gen")->setEnabled(editable);
- if (selected_texgen == 1)
+ if (selected_texgen == LLTextureEntry::TEX_GEN_PLANAR)
{
- getChild("TexScaleU")->setValue(2.0f * getChild("TexScaleU")->getValue().asReal() );
- getChild("TexScaleV")->setValue(2.0f * getChild("TexScaleV")->getValue().asReal() );
-
// EXP-1507 (change label based on the mapping mode)
- getChild("tex scale")->setValue(getString("string repeats per meter"));
+ getChild("rpt")->setValue(getString("string repeats per meter"));
}
else
+ if (selected_texgen == LLTextureEntry::TEX_GEN_DEFAULT)
{
- getChild("tex scale")->setValue(getString("string repeats per face"));
+ getChild("rpt")->setValue(getString("string repeats per face"));
}
-
}
{
- F32 fullbrightf = 0.f;
- struct f12 : public LLSelectedTEGetFunctor
- {
- F32 get(LLViewerObject* object, S32 face)
- {
- return (F32)(object->getTE(face)->getFullbright());
- }
- } func;
- identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, fullbrightf );
+ U8 fullbright_flag = 0;
+ bool identical_fullbright = false;
- getChild("checkbox fullbright")->setValue((S32)fullbrightf);
+ LLSelectedTE::getFullbright(fullbright_flag,identical_fullbright);
+
+ getChild("checkbox fullbright")->setValue((S32)(fullbright_flag != 0));
getChildView("checkbox fullbright")->setEnabled(editable);
- getChild("checkbox fullbright")->setTentative(!identical);
- }
-
- // Repeats per meter label
- {
- getChildView("rpt")->setEnabled(editable);
+ getChild("checkbox fullbright")->setTentative(!identical_fullbright);
}
+
// Repeats per meter
{
- F32 repeats = 1.f;
- struct f13 : public LLSelectedTEGetFunctor
- {
- F32 get(LLViewerObject* object, S32 face)
- {
- U32 s_axis = VX;
- U32 t_axis = VY;
- // BUG: Only repeats along S axis
- // BUG: Only works for boxes.
- LLPrimitive::getTESTAxes(face, &s_axis, &t_axis);
- return object->getTE(face)->mScaleS / object->getScale().mV[s_axis];
- }
- } func;
- identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, repeats );
-
- getChild("rptctrl")->setValue(editable ? repeats : 0);
- getChild("rptctrl")->setTentative(!identical);
+ F32 repeats_diff = 1.f;
+ F32 repeats_norm = 1.f;
+ F32 repeats_spec = 1.f;
+
+ bool identical_diff_repeats = false;
+ bool identical_norm_repeats = false;
+ bool identical_spec_repeats = false;
+
+ LLSelectedTE::getMaxDiffuseRepeats(repeats_diff, identical_diff_repeats);
+ LLSelectedTEMaterial::getMaxNormalRepeats(repeats_norm, identical_norm_repeats);
+ LLSelectedTEMaterial::getMaxSpecularRepeats(repeats_spec, identical_spec_repeats);
+
LLComboBox* mComboTexGen = getChild("combobox texgen");
if (mComboTexGen)
{
- BOOL enabled = editable && (!mComboTexGen || mComboTexGen->getCurrentIndex() != 1);
- getChildView("rptctrl")->setEnabled(enabled);
- getChildView("button apply")->setEnabled(enabled);
+ S32 index = mComboTexGen ? mComboTexGen->getCurrentIndex() : 0;
+ BOOL enabled = editable && (index != 1);
+ BOOL identical_repeats = true;
+ F32 repeats = 1.0f;
+
+ U32 material_type = (combobox_matmedia->getCurrentIndex() == MATMEDIA_MATERIAL) ? combobox_mattype->getCurrentIndex() : MATTYPE_DIFFUSE;
+
+ LLSelectMgr::getInstance()->setTextureChannel(LLRender::eTexIndex(material_type));
+
+ switch (material_type)
+ {
+ default:
+ case MATTYPE_DIFFUSE:
+ {
+ enabled = editable && !id.isNull();
+ identical_repeats = identical_diff_repeats;
+ repeats = repeats_diff;
+ }
+ break;
+
+ case MATTYPE_SPECULAR:
+ {
+ enabled = (editable && ((shiny == SHINY_TEXTURE) && !specmap_id.isNull())
+ && enable_material_controls); // Materials Alignment
+ identical_repeats = identical_spec_repeats;
+ repeats = repeats_spec;
+ }
+ break;
+
+ case MATTYPE_NORMAL:
+ {
+ enabled = (editable && ((bumpy == BUMPY_TEXTURE) && !normmap_id.isNull())
+ && enable_material_controls); // Materials Alignment
+ identical_repeats = identical_norm_repeats;
+ repeats = repeats_norm;
+ }
+ break;
+ }
+
+ BOOL repeats_tentative = !identical_repeats;
+
+ getChildView("rptctrl")->setEnabled(identical_planar_texgen ? FALSE : enabled);
+ getChild("rptctrl")->setValue(editable ? repeats : 1.0f);
+ getChild("rptctrl")->setTentative(LLSD(repeats_tentative));
+
+ // FIRE-11407 - Flip buttons
+ getChildView("flipTextureScaleU")->setEnabled(enabled);
+ getChildView("flipTextureScaleV")->setEnabled(enabled);
+ //
+ }
+ }
+
+ // Materials
+ {
+ LLMaterialPtr material;
+ LLSelectedTEMaterial::getCurrent(material, identical);
+
+ if (material && editable)
+ {
+ LL_DEBUGS("Materials: OnMatererialsLoaded:") << material->asLLSD() << LL_ENDL;
+
+ // Alpha
+ LLCtrlSelectionInterface* combobox_alphamode =
+ childGetSelectionInterface("combobox alphamode");
+ if (combobox_alphamode)
+ {
+ U32 alpha_mode = material->getDiffuseAlphaMode();
+
+ if (transparency > 0.f)
+ { //it is invalid to have any alpha mode other than blend if transparency is greater than zero ...
+ alpha_mode = LLMaterial::DIFFUSE_ALPHA_MODE_BLEND;
+ }
+
+ if (!mIsAlpha)
+ { // ... unless there is no alpha channel in the texture, in which case alpha mode MUST ebe none
+ alpha_mode = LLMaterial::DIFFUSE_ALPHA_MODE_NONE;
+ }
+
+ combobox_alphamode->selectNthItem(alpha_mode);
+ }
+ else
+ {
+ llwarns << "failed childGetSelectionInterface for 'combobox alphamode'" << llendl;
+ }
+ getChild("maskcutoff")->setValue(material->getAlphaMaskCutoff());
+ updateAlphaControls();
+
+ identical_planar_texgen = isIdenticalPlanarTexgen();
+
+ // Shiny (specular)
+ F32 offset_x, offset_y, repeat_x, repeat_y, rot;
+ LLTextureCtrl* texture_ctrl = getChild("shinytexture control");
+ texture_ctrl->setImageAssetID(material->getSpecularID());
+
+ if (!material->getSpecularID().isNull() && (shiny == SHINY_TEXTURE))
+ {
+ material->getSpecularOffset(offset_x,offset_y);
+ material->getSpecularRepeat(repeat_x,repeat_y);
+
+ if (identical_planar_texgen)
+ {
+ repeat_x *= 2.0f;
+ repeat_y *= 2.0f;
+ }
+
+ rot = material->getSpecularRotation();
+ getChild("shinyScaleU")->setValue(repeat_x);
+ getChild("shinyScaleV")->setValue(repeat_y);
+ getChild("shinyRot")->setValue(rot*RAD_TO_DEG);
+ getChild("shinyOffsetU")->setValue(offset_x);
+ getChild("shinyOffsetV")->setValue(offset_y);
+ getChild("glossiness")->setValue(material->getSpecularLightExponent());
+ getChild("environment")->setValue(material->getEnvironmentIntensity());
+
+ updateShinyControls(!material->getSpecularID().isNull(), true);
+ }
+
+ // Assert desired colorswatch color to match material AFTER updateShinyControls
+ // to avoid getting overwritten with the default on some UI state changes.
+ //
+ if (!material->getSpecularID().isNull())
+ {
+ getChild("shinycolorswatch")->setOriginal(material->getSpecularLightColor());
+ getChild("shinycolorswatch")->set(material->getSpecularLightColor(),TRUE);
+ }
+
+ // Bumpy (normal)
+ texture_ctrl = getChild("bumpytexture control");
+ texture_ctrl->setImageAssetID(material->getNormalID());
+
+ if (!material->getNormalID().isNull())
+ {
+ material->getNormalOffset(offset_x,offset_y);
+ material->getNormalRepeat(repeat_x,repeat_y);
+
+ if (identical_planar_texgen)
+ {
+ repeat_x *= 2.0f;
+ repeat_y *= 2.0f;
+ }
+
+ rot = material->getNormalRotation();
+ getChild("bumpyScaleU")->setValue(repeat_x);
+ getChild("bumpyScaleV")->setValue(repeat_y);
+ getChild("bumpyRot")->setValue(rot*RAD_TO_DEG);
+ getChild("bumpyOffsetU")->setValue(offset_x);
+ getChild("bumpyOffsetV")->setValue(offset_y);
+
+ updateBumpyControls(!material->getNormalID().isNull(), true);
+ }
}
}
// Set variable values for numeric expressions
+ LLCalc* calcp = LLCalc::getInstance();
calcp->setVar(LLCalc::TEX_U_SCALE, childGetValue("TexScaleU").asReal());
calcp->setVar(LLCalc::TEX_V_SCALE, childGetValue("TexScaleV").asReal());
calcp->setVar(LLCalc::TEX_U_OFFSET, childGetValue("TexOffsetU").asReal());
@@ -976,7 +1432,6 @@ void LLPanelFace::getState()
if(texture_ctrl)
{
texture_ctrl->setImageAssetID( LLUUID::null );
- texture_ctrl->setFallbackImageName( "locked_image.j2c" );
texture_ctrl->setEnabled( FALSE ); // this is a LLUICtrl, but we don't want it to have keyboard focus so we add it as a child, not a ctrl.
// texture_ctrl->setValid(FALSE);
}
@@ -989,32 +1444,32 @@ void LLPanelFace::getState()
}
getChildView("color trans")->setEnabled(FALSE);
getChildView("rpt")->setEnabled(FALSE);
- getChildView("tex scale")->setEnabled(FALSE);
getChildView("tex offset")->setEnabled(FALSE);
- getChildView("tex rotate")->setEnabled(FALSE);
getChildView("tex gen")->setEnabled(FALSE);
getChildView("label shininess")->setEnabled(FALSE);
getChildView("label bumpiness")->setEnabled(FALSE);
getChildView("button align")->setEnabled(FALSE);
- getChildView("button apply")->setEnabled(FALSE);
//getChildView("has media")->setEnabled(FALSE);
//getChildView("media info set")->setEnabled(FALSE);
+ updateVisibility();
// Set variable values for numeric expressions
+ LLCalc* calcp = LLCalc::getInstance();
calcp->clearVar(LLCalc::TEX_U_SCALE);
calcp->clearVar(LLCalc::TEX_V_SCALE);
calcp->clearVar(LLCalc::TEX_U_OFFSET);
calcp->clearVar(LLCalc::TEX_V_OFFSET);
calcp->clearVar(LLCalc::TEX_ROTATION);
calcp->clearVar(LLCalc::TEX_TRANSPARENCY);
- calcp->clearVar(LLCalc::TEX_GLOW);
+ calcp->clearVar(LLCalc::TEX_GLOW);
}
}
void LLPanelFace::refresh()
{
+ LL_DEBUGS("Materials") << LL_ENDL;
getState();
}
@@ -1034,6 +1489,11 @@ void LLPanelFace::onCommitColor(const LLSD& data)
sendColor();
}
+void LLPanelFace::onCommitShinyColor(const LLSD& data)
+{
+ LLSelectedTEMaterial::setSpecularLightColor(this, getChild("shinycolorswatch")->get());
+}
+
void LLPanelFace::onCommitAlpha(const LLSD& data)
{
sendAlpha();
@@ -1050,11 +1510,124 @@ void LLPanelFace::onSelectColor(const LLSD& data)
sendColor();
}
+// static
+void LLPanelFace::onCommitMaterialsMedia(LLUICtrl* ctrl, void* userdata)
+{
+ LLPanelFace* self = (LLPanelFace*) userdata;
+ // Force to default states to side-step problems with menu contents
+ // and generally reflecting old state when switching tabs or objects
+ //
+ self->updateShinyControls(false,true);
+ self->updateBumpyControls(false,true);
+ self->updateUI();
+}
+
+// static
+void LLPanelFace::updateVisibility()
+{
+ LLComboBox* combo_matmedia = getChild("combobox matmedia");
+ LLComboBox* combo_mattype = getChild("combobox mattype");
+ LLComboBox* combo_shininess = getChild("combobox shininess");
+ LLComboBox* combo_bumpiness = getChild("combobox bumpiness");
+ if (!combo_mattype || !combo_matmedia || !combo_shininess || !combo_bumpiness)
+ {
+ LL_WARNS("Materials") << "Combo box not found...exiting." << LL_ENDL;
+ return;
+ }
+ U32 materials_media = combo_matmedia->getCurrentIndex();
+ U32 material_type = combo_mattype->getCurrentIndex();
+ bool show_media = (materials_media == MATMEDIA_MEDIA) && combo_matmedia->getEnabled();
+ bool show_texture = (show_media || ((material_type == MATTYPE_DIFFUSE) && combo_matmedia->getEnabled()));
+ bool show_bumpiness = (!show_media) && (material_type == MATTYPE_NORMAL) && combo_matmedia->getEnabled();
+ bool show_shininess = (!show_media) && (material_type == MATTYPE_SPECULAR) && combo_matmedia->getEnabled();
+ getChildView("combobox mattype")->setVisible(!show_media);
+ // FIRE-11407 - Be consistant and hide this with the other controls
+ //getChildView("rptctrl")->setVisible(true);
+ getChildView("rptctrl")->setVisible(combo_matmedia->getEnabled());
+ // and other additions...
+ getChildView("flipTextureScaleU")->setVisible(combo_matmedia->getEnabled());
+ getChildView("flipTextureScaleV")->setVisible(combo_matmedia->getEnabled());
+ //
+
+ // Media controls
+ getChildView("media_info")->setVisible(show_media);
+ getChildView("add_media")->setVisible(show_media);
+ getChildView("delete_media")->setVisible(show_media);
+ getChildView("button align")->setVisible(show_media);
+
+ // Diffuse texture controls
+ getChildView("texture control")->setVisible(show_texture && !show_media);
+ getChildView("label alphamode")->setVisible(show_texture && !show_media);
+ getChildView("combobox alphamode")->setVisible(show_texture && !show_media);
+ getChildView("label maskcutoff")->setVisible(false);
+ getChildView("maskcutoff")->setVisible(false);
+ if (show_texture && !show_media)
+ {
+ updateAlphaControls();
+ }
+ getChildView("TexScaleU")->setVisible(show_texture);
+ getChildView("TexScaleV")->setVisible(show_texture);
+ getChildView("TexRot")->setVisible(show_texture);
+ getChildView("TexOffsetU")->setVisible(show_texture);
+ getChildView("TexOffsetV")->setVisible(show_texture);
+
+ // Specular map controls
+ getChildView("shinytexture control")->setVisible(show_shininess);
+ getChildView("combobox shininess")->setVisible(show_shininess);
+ getChildView("label shininess")->setVisible(show_shininess);
+ getChildView("label glossiness")->setVisible(false);
+ getChildView("glossiness")->setVisible(false);
+ getChildView("label environment")->setVisible(false);
+ getChildView("environment")->setVisible(false);
+ getChildView("label shinycolor")->setVisible(false);
+ getChildView("shinycolorswatch")->setVisible(false);
+ if (show_shininess)
+ {
+ updateShinyControls();
+ }
+ getChildView("shinyScaleU")->setVisible(show_shininess);
+ getChildView("shinyScaleV")->setVisible(show_shininess);
+ getChildView("shinyRot")->setVisible(show_shininess);
+ getChildView("shinyOffsetU")->setVisible(show_shininess);
+ getChildView("shinyOffsetV")->setVisible(show_shininess);
+
+ // Normal map controls
+ if (show_bumpiness)
+ {
+ updateBumpyControls();
+ }
+ getChildView("bumpytexture control")->setVisible(show_bumpiness);
+ getChildView("combobox bumpiness")->setVisible(show_bumpiness);
+ getChildView("label bumpiness")->setVisible(show_bumpiness);
+ getChildView("bumpyScaleU")->setVisible(show_bumpiness);
+ getChildView("bumpyScaleV")->setVisible(show_bumpiness);
+ getChildView("bumpyRot")->setVisible(show_bumpiness);
+ getChildView("bumpyOffsetU")->setVisible(show_bumpiness);
+ getChildView("bumpyOffsetV")->setVisible(show_bumpiness);
+}
+
+void LLPanelFace::onCommitMaterialType()
+{
+ // Force to default states to side-step problems with menu contents
+ // and generally reflecting old state when switching tabs or objects
+ //
+ updateShinyControls(false,true);
+ updateBumpyControls(false,true);
+ updateUI();
+}
+
// static
void LLPanelFace::onCommitBump(LLUICtrl* ctrl, void* userdata)
{
LLPanelFace* self = (LLPanelFace*) userdata;
- self->sendBump();
+
+ LLComboBox* mComboBumpiness = self->getChild("combobox bumpiness");
+ if(!mComboBumpiness)
+ return;
+
+ U32 bumpiness = mComboBumpiness->getCurrentIndex();
+
+ self->sendBump(bumpiness);
}
// static
@@ -1064,11 +1637,142 @@ void LLPanelFace::onCommitTexGen(LLUICtrl* ctrl, void* userdata)
self->sendTexGen();
}
+void LLPanelFace::updateShinyControls(bool is_setting_texture, bool mess_with_shiny_combobox)
+{
+ LLTextureCtrl* texture_ctrl = getChild("shinytexture control");
+ LLUUID shiny_texture_ID = texture_ctrl->getImageAssetID();
+ LL_DEBUGS("Materials") << "Shiny texture selected: " << shiny_texture_ID << LL_ENDL;
+ LLComboBox* comboShiny = getChild("combobox shininess");
+
+ if(mess_with_shiny_combobox)
+ {
+ if (!comboShiny)
+ {
+ return;
+ }
+ if (!shiny_texture_ID.isNull() && is_setting_texture)
+ {
+ if (!comboShiny->itemExists(USE_TEXTURE))
+ {
+ comboShiny->add(USE_TEXTURE);
+ }
+ comboShiny->setSimple(USE_TEXTURE);
+ }
+ else
+ {
+ if (comboShiny->itemExists(USE_TEXTURE))
+ {
+ comboShiny->remove(SHINY_TEXTURE);
+ comboShiny->selectFirstItem();
+ }
+ }
+ }
+
+ LLComboBox* combo_matmedia = getChild("combobox matmedia");
+ LLComboBox* combo_mattype = getChild("combobox mattype");
+ U32 materials_media = combo_matmedia->getCurrentIndex();
+ U32 material_type = combo_mattype->getCurrentIndex();
+ bool show_media = (materials_media == MATMEDIA_MEDIA) && combo_matmedia->getEnabled();
+ bool show_shininess = (!show_media) && (material_type == MATTYPE_SPECULAR) && combo_matmedia->getEnabled();
+ U32 shiny_value = comboShiny->getCurrentIndex();
+ bool show_shinyctrls = (shiny_value == SHINY_TEXTURE) && show_shininess; // Use texture
+ getChildView("label glossiness")->setVisible(show_shinyctrls);
+ getChildView("glossiness")->setVisible(show_shinyctrls);
+ getChildView("label environment")->setVisible(show_shinyctrls);
+ getChildView("environment")->setVisible(show_shinyctrls);
+ getChildView("label shinycolor")->setVisible(show_shinyctrls);
+ getChildView("shinycolorswatch")->setVisible(show_shinyctrls);
+}
+
+void LLPanelFace::updateBumpyControls(bool is_setting_texture, bool mess_with_combobox)
+{
+ LLTextureCtrl* texture_ctrl = getChild("bumpytexture control");
+ LLUUID bumpy_texture_ID = texture_ctrl->getImageAssetID();
+ LL_DEBUGS("Materials") << "texture: " << bumpy_texture_ID << (mess_with_combobox ? "" : " do not") << " update combobox" << LL_ENDL;
+ LLComboBox* comboBumpy = getChild("combobox bumpiness");
+ if (!comboBumpy)
+ {
+ return;
+ }
+
+ if (mess_with_combobox)
+ {
+ LLTextureCtrl* texture_ctrl = getChild("bumpytexture control");
+ LLUUID bumpy_texture_ID = texture_ctrl->getImageAssetID();
+ LL_DEBUGS("Materials") << "texture: " << bumpy_texture_ID << (mess_with_combobox ? "" : " do not") << " update combobox" << LL_ENDL;
+
+ if (!bumpy_texture_ID.isNull() && is_setting_texture)
+ {
+ if (!comboBumpy->itemExists(USE_TEXTURE))
+ {
+ comboBumpy->add(USE_TEXTURE);
+ }
+ comboBumpy->setSimple(USE_TEXTURE);
+ }
+ else
+ {
+ if (comboBumpy->itemExists(USE_TEXTURE))
+ {
+ comboBumpy->remove(BUMPY_TEXTURE);
+ comboBumpy->selectFirstItem();
+ }
+ }
+ }
+}
+
// static
void LLPanelFace::onCommitShiny(LLUICtrl* ctrl, void* userdata)
{
LLPanelFace* self = (LLPanelFace*) userdata;
- self->sendShiny();
+
+
+ LLComboBox* mComboShininess = self->getChild("combobox shininess");
+ if(!mComboShininess)
+ return;
+
+ U32 shininess = mComboShininess->getCurrentIndex();
+
+ self->sendShiny(shininess);
+}
+
+// static
+void LLPanelFace::updateAlphaControls()
+{
+ LLComboBox* comboAlphaMode = getChild("combobox alphamode");
+ if (!comboAlphaMode)
+ {
+ return;
+ }
+ U32 alpha_value = comboAlphaMode->getCurrentIndex();
+ bool show_alphactrls = (alpha_value == ALPHAMODE_MASK); // Alpha masking
+
+ LLComboBox* combobox_matmedia = getChild("combobox matmedia");
+ U32 mat_media = MATMEDIA_MATERIAL;
+ if (combobox_matmedia)
+ {
+ mat_media = combobox_matmedia->getCurrentIndex();
+ }
+
+ LLComboBox* combobox_mattype = getChild("combobox mattype");
+ U32 mat_type = MATTYPE_DIFFUSE;
+ if (combobox_mattype)
+ {
+ mat_type = combobox_mattype->getCurrentIndex();
+ }
+
+ show_alphactrls = show_alphactrls && (mat_media == MATMEDIA_MATERIAL);
+ show_alphactrls = show_alphactrls && (mat_type == MATTYPE_DIFFUSE);
+
+ getChildView("label maskcutoff")->setVisible(show_alphactrls);
+ getChildView("maskcutoff")->setVisible(show_alphactrls);
+}
+
+// static
+void LLPanelFace::onCommitAlphaMode(LLUICtrl* ctrl, void* userdata)
+{
+ LLPanelFace* self = (LLPanelFace*) userdata;
+ self->updateAlphaControls();
+ LLSelectedTEMaterial::setDiffuseAlphaMode(self,self->getCurrentDiffuseAlphaMode());
}
// static
@@ -1118,27 +1822,288 @@ void LLPanelFace::onSelectTexture(const LLSD& data)
{
LLSelectMgr::getInstance()->saveSelectedObjectTextures();
sendTexture();
+
+ LLGLenum image_format;
+ bool identical_image_format = false;
+ LLSelectedTE::getImageFormat(image_format, identical_image_format);
+
+ LLCtrlSelectionInterface* combobox_alphamode =
+ childGetSelectionInterface("combobox alphamode");
+
+ U32 alpha_mode = LLMaterial::DIFFUSE_ALPHA_MODE_NONE;
+ if (combobox_alphamode)
+ {
+ switch (image_format)
+ {
+ case GL_RGBA:
+ case GL_ALPHA:
+ {
+ alpha_mode = LLMaterial::DIFFUSE_ALPHA_MODE_BLEND;
+ }
+ break;
+
+ case GL_RGB: break;
+ default:
+ {
+ llwarns << "Unexpected tex format in LLPanelFace...resorting to no alpha" << llendl;
+ }
+ break;
+ }
+
+ combobox_alphamode->selectNthItem(alpha_mode);
+ }
+ LLSelectedTEMaterial::setDiffuseAlphaMode(this, getCurrentDiffuseAlphaMode());
}
+void LLPanelFace::onCloseTexturePicker(const LLSD& data)
+{
+ LL_DEBUGS("Materials") << data << LL_ENDL;
+ updateUI();
+}
+
+void LLPanelFace::onCommitSpecularTexture( const LLSD& data )
+{
+ LL_DEBUGS("Materials") << data << LL_ENDL;
+ sendShiny(SHINY_TEXTURE);
+}
+
+void LLPanelFace::onCommitNormalTexture( const LLSD& data )
+{
+ LL_DEBUGS("Materials") << data << LL_ENDL;
+ LLUUID nmap_id = getCurrentNormalMap();
+ sendBump(nmap_id.isNull() ? 0 : BUMPY_TEXTURE);
+}
+
+void LLPanelFace::onCancelSpecularTexture(const LLSD& data)
+{
+ U8 shiny = 0;
+ bool identical_shiny = false;
+ LLSelectedTE::getShiny(shiny, identical_shiny);
+ LLUUID spec_map_id = getChild("shinytexture control")->getImageAssetID();
+ shiny = spec_map_id.isNull() ? shiny : SHINY_TEXTURE;
+ sendShiny(shiny);
+}
+
+void LLPanelFace::onCancelNormalTexture(const LLSD& data)
+{
+ U8 bumpy = 0;
+ bool identical_bumpy = false;
+ LLSelectedTE::getBumpmap(bumpy, identical_bumpy);
+ sendBump(bumpy);
+}
+
+void LLPanelFace::onSelectSpecularTexture(const LLSD& data)
+{
+ LL_DEBUGS("Materials") << data << LL_ENDL;
+ sendShiny(SHINY_TEXTURE);
+}
+
+void LLPanelFace::onSelectNormalTexture(const LLSD& data)
+{
+ LL_DEBUGS("Materials") << data << LL_ENDL;
+ LLUUID nmap_id = getCurrentNormalMap();
+ sendBump(nmap_id.isNull() ? 0 : BUMPY_TEXTURE);
+}
+
+//static
+void LLPanelFace::onCommitMaterialBumpyOffsetX(LLUICtrl* ctrl, void* userdata)
+{
+ LLPanelFace* self = (LLPanelFace*) userdata;
+ llassert_always(self);
+ LLSelectedTEMaterial::setNormalOffsetX(self,self->getCurrentBumpyOffsetU());
+}
+
+//static
+void LLPanelFace::onCommitMaterialBumpyOffsetY(LLUICtrl* ctrl, void* userdata)
+{
+ LLPanelFace* self = (LLPanelFace*) userdata;
+ llassert_always(self);
+ LLSelectedTEMaterial::setNormalOffsetY(self,self->getCurrentBumpyOffsetV());
+}
+
+//static
+void LLPanelFace::onCommitMaterialShinyOffsetX(LLUICtrl* ctrl, void* userdata)
+{
+ LLPanelFace* self = (LLPanelFace*) userdata;
+ llassert_always(self);
+ LLSelectedTEMaterial::setSpecularOffsetX(self,self->getCurrentShinyOffsetU());
+}
+
+//static
+void LLPanelFace::onCommitMaterialShinyOffsetY(LLUICtrl* ctrl, void* userdata)
+{
+ LLPanelFace* self = (LLPanelFace*) userdata;
+ llassert_always(self);
+ LLSelectedTEMaterial::setSpecularOffsetY(self,self->getCurrentShinyOffsetV());
+}
+
+//static
+void LLPanelFace::onCommitMaterialBumpyScaleX(LLUICtrl* ctrl, void* userdata)
+{
+ LLPanelFace* self = (LLPanelFace*) userdata;
+ llassert_always(self);
+ F32 bumpy_scale_u = self->getCurrentBumpyScaleU();
+ if (self->isIdenticalPlanarTexgen())
+ {
+ bumpy_scale_u *= 0.5f;
+ }
+ LLSelectedTEMaterial::setNormalRepeatX(self,bumpy_scale_u);
+}
+
+//static
+void LLPanelFace::onCommitMaterialBumpyScaleY(LLUICtrl* ctrl, void* userdata)
+{
+ LLPanelFace* self = (LLPanelFace*) userdata;
+ llassert_always(self);
+ F32 bumpy_scale_v = self->getCurrentBumpyScaleV();
+ if (self->isIdenticalPlanarTexgen())
+ {
+ bumpy_scale_v *= 0.5f;
+ }
+ LLSelectedTEMaterial::setNormalRepeatY(self,bumpy_scale_v);
+}
+
+//static
+void LLPanelFace::onCommitMaterialShinyScaleX(LLUICtrl* ctrl, void* userdata)
+{
+ LLPanelFace* self = (LLPanelFace*) userdata;
+ llassert_always(self);
+ F32 shiny_scale_u = self->getCurrentShinyScaleU();
+ if (self->isIdenticalPlanarTexgen())
+ {
+ shiny_scale_u *= 0.5f;
+ }
+ LLSelectedTEMaterial::setSpecularRepeatX(self,shiny_scale_u);
+}
+
+//static
+void LLPanelFace::onCommitMaterialShinyScaleY(LLUICtrl* ctrl, void* userdata)
+{
+ LLPanelFace* self = (LLPanelFace*) userdata;
+ llassert_always(self);
+ F32 shiny_scale_v = self->getCurrentShinyScaleV();
+ if (self->isIdenticalPlanarTexgen())
+ {
+ shiny_scale_v *= 0.5f;
+ }
+ LLSelectedTEMaterial::setSpecularRepeatY(self,shiny_scale_v);
+}
+
+//static
+void LLPanelFace::onCommitMaterialBumpyRot(LLUICtrl* ctrl, void* userdata)
+{
+ LLPanelFace* self = (LLPanelFace*) userdata;
+ llassert_always(self);
+ LLSelectedTEMaterial::setNormalRotation(self,self->getCurrentBumpyRot() * DEG_TO_RAD);
+}
+
+//static
+void LLPanelFace::onCommitMaterialShinyRot(LLUICtrl* ctrl, void* userdata)
+{
+ LLPanelFace* self = (LLPanelFace*) userdata;
+ llassert_always(self);
+ LLSelectedTEMaterial::setSpecularRotation(self,self->getCurrentShinyRot() * DEG_TO_RAD);
+}
+
+//static
+void LLPanelFace::onCommitMaterialGloss(LLUICtrl* ctrl, void* userdata)
+{
+ LLPanelFace* self = (LLPanelFace*) userdata;
+ llassert_always(self);
+ LLSelectedTEMaterial::setSpecularLightExponent(self,self->getCurrentGlossiness());
+}
+
+//static
+void LLPanelFace::onCommitMaterialEnv(LLUICtrl* ctrl, void* userdata)
+{
+ LLPanelFace* self = (LLPanelFace*) userdata;
+ llassert_always(self);
+ LLSelectedTEMaterial::setEnvironmentIntensity(self,self->getCurrentEnvIntensity());
+}
+
+//static
+void LLPanelFace::onCommitMaterialMaskCutoff(LLUICtrl* ctrl, void* userdata)
+{
+ LLPanelFace* self = (LLPanelFace*) userdata;
+ LLSelectedTEMaterial::setAlphaMaskCutoff(self,self->getCurrentAlphaMaskCutoff());
+}
// static
void LLPanelFace::onCommitTextureInfo( LLUICtrl* ctrl, void* userdata )
{
LLPanelFace* self = (LLPanelFace*) userdata;
self->sendTextureInfo();
+ //