NORSPEC-102 & Co Reloaded
parent
be712ba6b5
commit
ad09e2111c
|
|
@ -539,21 +539,28 @@ S32 LLTextureEntry::setGlow(F32 glow)
|
||||||
|
|
||||||
S32 LLTextureEntry::setMaterialID(const LLMaterialID& pMaterialID)
|
S32 LLTextureEntry::setMaterialID(const LLMaterialID& pMaterialID)
|
||||||
{
|
{
|
||||||
if (mMaterialID != pMaterialID)
|
if ( (mMaterialID != pMaterialID) || (mMaterialUpdatePending && !mSelected) )
|
||||||
{
|
{
|
||||||
mMaterialID = pMaterialID;
|
if (mSelected)
|
||||||
|
|
||||||
}
|
|
||||||
if (mMaterialID.isNull())
|
|
||||||
{
|
{
|
||||||
setMaterialParams(NULL);
|
mMaterialUpdatePending = true;
|
||||||
|
mMaterialID = pMaterialID;
|
||||||
|
return TEM_CHANGE_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mMaterialUpdatePending = false;
|
||||||
|
mMaterialID = pMaterialID;
|
||||||
return TEM_CHANGE_TEXTURE;
|
return TEM_CHANGE_TEXTURE;
|
||||||
}
|
}
|
||||||
|
return TEM_CHANGE_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
S32 LLTextureEntry::setMaterialParams(const LLMaterialPtr pMaterialParams)
|
S32 LLTextureEntry::setMaterialParams(const LLMaterialPtr pMaterialParams)
|
||||||
{
|
{
|
||||||
|
if (mSelected)
|
||||||
|
{
|
||||||
|
mMaterialUpdatePending = true;
|
||||||
|
}
|
||||||
mMaterial = pMaterialParams;
|
mMaterial = pMaterialParams;
|
||||||
return TEM_CHANGE_TEXTURE;
|
return TEM_CHANGE_TEXTURE;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -217,51 +217,6 @@ boost::signals2::connection LLMaterialMgr::get(const LLUUID& region_id, const LL
|
||||||
return connection;
|
return connection;
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::signals2::connection LLMaterialMgr::getTE(const LLUUID& region_id, const LLMaterialID& material_id, U32 te, LLMaterialMgr::get_callback_te_t::slot_type cb)
|
|
||||||
{
|
|
||||||
boost::signals2::connection connection;
|
|
||||||
|
|
||||||
material_map_t::const_iterator itMaterial = mMaterials.find(material_id);
|
|
||||||
if (itMaterial != mMaterials.end())
|
|
||||||
{
|
|
||||||
LL_DEBUGS("Materials") << "region " << region_id << " found materialid " << material_id << LL_ENDL;
|
|
||||||
get_callback_te_t signal;
|
|
||||||
signal.connect(cb);
|
|
||||||
signal(material_id, itMaterial->second, te);
|
|
||||||
connection = boost::signals2::connection();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (!isGetPending(region_id, material_id))
|
|
||||||
{
|
|
||||||
get_queue_t::iterator itQueue = mGetQueue.find(region_id);
|
|
||||||
if (mGetQueue.end() == itQueue)
|
|
||||||
{
|
|
||||||
LL_DEBUGS("Materials") << "mGetQueue inserting region "<<region_id << LL_ENDL;
|
|
||||||
std::pair<get_queue_t::iterator, bool> ret = mGetQueue.insert(std::pair<LLUUID, material_queue_t>(region_id, material_queue_t()));
|
|
||||||
itQueue = ret.first;
|
|
||||||
}
|
|
||||||
LL_DEBUGS("Materials") << "adding material id " << material_id << LL_ENDL;
|
|
||||||
itQueue->second.insert(material_id);
|
|
||||||
markGetPending(region_id, material_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
TEMaterialPair te_mat_pair;
|
|
||||||
te_mat_pair.te = te;
|
|
||||||
te_mat_pair.materialID = material_id;
|
|
||||||
|
|
||||||
get_callback_te_map_t::iterator itCallback = mGetTECallbacks.find(te_mat_pair);
|
|
||||||
if (itCallback == mGetTECallbacks.end())
|
|
||||||
{
|
|
||||||
std::pair<get_callback_te_map_t::iterator, bool> ret = mGetTECallbacks.insert(std::pair<TEMaterialPair, get_callback_te_t*>(te_mat_pair, new get_callback_te_t()));
|
|
||||||
itCallback = ret.first;
|
|
||||||
}
|
|
||||||
connection = itCallback->second->connect(cb);
|
|
||||||
}
|
|
||||||
|
|
||||||
return connection;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool LLMaterialMgr::isGetAllPending(const LLUUID& region_id) const
|
bool LLMaterialMgr::isGetAllPending(const LLUUID& region_id) const
|
||||||
{
|
{
|
||||||
getall_pending_map_t::const_iterator itPending = mGetAllPending.find(region_id);
|
getall_pending_map_t::const_iterator itPending = mGetAllPending.find(region_id);
|
||||||
|
|
@ -346,22 +301,6 @@ const LLMaterialPtr LLMaterialMgr::setMaterial(const LLUUID& region_id, const LL
|
||||||
mGetCallbacks.erase(itCallback);
|
mGetCallbacks.erase(itCallback);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEMaterialPair te_mat_pair;
|
|
||||||
te_mat_pair.materialID = material_id;
|
|
||||||
|
|
||||||
U32 i = 0;
|
|
||||||
while (i < LLTEContents::MAX_TES)
|
|
||||||
{
|
|
||||||
te_mat_pair.te = i++;
|
|
||||||
get_callback_te_map_t::iterator itCallbackTE = mGetTECallbacks.find(te_mat_pair);
|
|
||||||
if (itCallbackTE != mGetTECallbacks.end())
|
|
||||||
{
|
|
||||||
(*itCallbackTE->second)(material_id, itMaterial->second, te_mat_pair.te);
|
|
||||||
delete itCallbackTE->second;
|
|
||||||
mGetTECallbacks.erase(itCallbackTE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return itMaterial->second;
|
return itMaterial->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -44,11 +44,9 @@ public:
|
||||||
typedef std::map<LLMaterialID, LLMaterialPtr> material_map_t;
|
typedef std::map<LLMaterialID, LLMaterialPtr> material_map_t;
|
||||||
|
|
||||||
typedef boost::signals2::signal<void (const LLMaterialID&, const LLMaterialPtr)> get_callback_t;
|
typedef boost::signals2::signal<void (const LLMaterialID&, const LLMaterialPtr)> get_callback_t;
|
||||||
typedef boost::signals2::signal<void (const LLMaterialID&, const LLMaterialPtr, U32 te)> get_callback_te_t;
|
|
||||||
|
|
||||||
const LLMaterialPtr get(const LLUUID& region_id, const LLMaterialID& material_id);
|
const LLMaterialPtr get(const LLUUID& region_id, const LLMaterialID& material_id);
|
||||||
boost::signals2::connection get(const LLUUID& region_id, const LLMaterialID& material_id, get_callback_t::slot_type cb);
|
boost::signals2::connection get(const LLUUID& region_id, const LLMaterialID& material_id, get_callback_t::slot_type cb);
|
||||||
boost::signals2::connection getTE(const LLUUID& region_id, const LLMaterialID& material_id, U32 te, get_callback_te_t::slot_type cb);
|
|
||||||
|
|
||||||
typedef boost::signals2::signal<void (const LLUUID&, const material_map_t&)> getall_callback_t;
|
typedef boost::signals2::signal<void (const LLUUID&, const material_map_t&)> getall_callback_t;
|
||||||
void getAll(const LLUUID& region_id);
|
void getAll(const LLUUID& region_id);
|
||||||
|
|
@ -82,26 +80,6 @@ protected:
|
||||||
typedef std::map<LLMaterialID, get_callback_t*> get_callback_map_t;
|
typedef std::map<LLMaterialID, get_callback_t*> get_callback_map_t;
|
||||||
get_callback_map_t mGetCallbacks;
|
get_callback_map_t mGetCallbacks;
|
||||||
|
|
||||||
// struct for TE-specific material ID query
|
|
||||||
struct TEMaterialPair
|
|
||||||
{
|
|
||||||
U32 te;
|
|
||||||
LLMaterialID materialID;
|
|
||||||
};
|
|
||||||
|
|
||||||
// needed for std::map compliance only
|
|
||||||
//
|
|
||||||
friend inline bool operator<(
|
|
||||||
const struct LLMaterialMgr::TEMaterialPair& lhs,
|
|
||||||
const struct LLMaterialMgr::TEMaterialPair& rhs)
|
|
||||||
{
|
|
||||||
return (lhs.materialID < rhs.materialID) ? TRUE :
|
|
||||||
(lhs.te < rhs.te) ? TRUE : FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
typedef std::map<TEMaterialPair, get_callback_te_t*> get_callback_te_map_t;
|
|
||||||
get_callback_te_map_t mGetTECallbacks;
|
|
||||||
|
|
||||||
typedef std::set<LLUUID> getall_queue_t;
|
typedef std::set<LLUUID> getall_queue_t;
|
||||||
getall_queue_t mGetAllQueue;
|
getall_queue_t mGetAllQueue;
|
||||||
getall_queue_t mGetAllRequested;
|
getall_queue_t mGetAllRequested;
|
||||||
|
|
|
||||||
|
|
@ -2052,7 +2052,7 @@ void LLSelectMgr::selectionRemoveMaterial()
|
||||||
{
|
{
|
||||||
LL_DEBUGS("Materials") << "Removing material from object " << object->getID() << " face " << face << LL_ENDL;
|
LL_DEBUGS("Materials") << "Removing material from object " << object->getID() << " face " << face << LL_ENDL;
|
||||||
LLMaterialMgr::getInstance()->remove(object->getID(),face);
|
LLMaterialMgr::getInstance()->remove(object->getID(),face);
|
||||||
object->setTEMaterialID(face,LLMaterialID::null);
|
object->setTEMaterialParams(face, NULL);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4393,15 +4393,18 @@ S32 LLViewerObject::setTEMaterialID(const U8 te, const LLMaterialID& pMaterialID
|
||||||
<< ", material " << pMaterialID
|
<< ", material " << pMaterialID
|
||||||
<< LL_ENDL;
|
<< LL_ENDL;
|
||||||
retval = LLPrimitive::setTEMaterialID(te, pMaterialID);
|
retval = LLPrimitive::setTEMaterialID(te, pMaterialID);
|
||||||
}
|
if (retval)
|
||||||
// Kitty would like to know if this is necessary?
|
|
||||||
// Since we should get a setTEMaterialParams that does it anyway?
|
|
||||||
//
|
|
||||||
setChanged(TEXTURE);
|
|
||||||
if (mDrawable.notNull())
|
|
||||||
{
|
{
|
||||||
gPipeline.markTextured(mDrawable);
|
// Kitty would like to know if this is necessary?
|
||||||
|
// Since we should get a setTEMaterialParams that does it anyway?
|
||||||
|
//
|
||||||
|
setChanged(TEXTURE);
|
||||||
|
if (mDrawable.notNull())
|
||||||
|
{
|
||||||
|
gPipeline.markTextured(mDrawable);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1991,15 +1991,17 @@ S32 LLVOVolume::setTEMaterialID(const U8 te, const LLMaterialID& pMaterialID)
|
||||||
<< LL_ENDL;
|
<< LL_ENDL;
|
||||||
|
|
||||||
LL_DEBUGS("MaterialTEs") << " " << pMaterialID.asString() << LL_ENDL;
|
LL_DEBUGS("MaterialTEs") << " " << pMaterialID.asString() << LL_ENDL;
|
||||||
// Use TE-specific version of boost CB hook-up to avoid cross-contaminatin'
|
if (res)
|
||||||
LLMaterialMgr::instance().getTE(getRegion()->getRegionID(), pMaterialID, te, boost::bind(&LLVOVolume::setTEMaterialParamsCallback, this, _1, _2, _3));
|
{
|
||||||
|
LLMaterialMgr::instance().get(getRegion()->getRegionID(), pMaterialID, boost::bind(&LLVOVolume::setTEMaterialParamsCallback, this, _1, _2, te));
|
||||||
setChanged(TEXTURE);
|
setChanged(TEXTURE);
|
||||||
if (!mDrawable.isNull())
|
if (!mDrawable.isNull())
|
||||||
{
|
{
|
||||||
gPipeline.markTextured(mDrawable);
|
gPipeline.markTextured(mDrawable);
|
||||||
}
|
}
|
||||||
mFaceMappingChanged = TRUE;
|
mFaceMappingChanged = TRUE;
|
||||||
return TEM_CHANGE_TEXTURE;
|
}
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
S32 LLVOVolume::setTEMaterialParams(const U8 te, const LLMaterialPtr pMaterialParams)
|
S32 LLVOVolume::setTEMaterialParams(const U8 te, const LLMaterialPtr pMaterialParams)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue