Merge with 8582496d7733948e19396167df9b4d2d4cd35f0c

master
seth_productengine 2011-08-08 15:43:00 +03:00
commit df353a6746
21 changed files with 478 additions and 544 deletions

View File

@ -115,7 +115,7 @@ set(llcommon_HEADER_FILES
indra_constants.h
linden_common.h
linked_lists.h
llaccountingquota.h
llaccountingcost.h
llallocator.h
llallocator_heap_profile.h
llagentconstants.h

View File

@ -1,5 +1,5 @@
/**
* @file llaccountingquota.h
* @file llaccountingcost.h
* @
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
@ -58,22 +58,28 @@ struct ParcelQuota
F32 mParcelCapacity;
};
struct SelectionQuota
//SelectionQuota atm does not require a id
struct SelectionCost
{
SelectionQuota( LLUUID localId, F32 renderCost, F32 physicsCost, F32 networkCost, F32 simulationCost )
: mLocalId( localId)
, mRenderCost( renderCost )
, mPhysicsCost( physicsCost )
SelectionCost( /*LLTransactionID transactionId, */ F32 physicsCost, F32 networkCost, F32 simulationCost )
//: mTransactionId( transactionId)
: mPhysicsCost( physicsCost )
, mNetworkCost( networkCost )
, mSimulationCost( simulationCost )
{
}
SelectionQuota() {}
SelectionCost()
: mPhysicsCost( 0.0f )
, mNetworkCost( 0.0f )
, mSimulationCost( 0.0f )
{}
F32 mRenderCost, mPhysicsCost, mNetworkCost, mSimulationCost;
LLUUID mLocalId;
F32 mPhysicsCost, mNetworkCost, mSimulationCost;
//LLTransactionID mTransactionId;
};
typedef enum { Roots = 0 , Prims } eSelectionType;
#endif

View File

@ -1373,12 +1373,3 @@ LLParcel::ECategory category_ui_string_to_category(const std::string& s)
// is a distinct option from "None" and "Other"
return LLParcel::C_ANY;
}
void LLParcel::updateQuota( const LLUUID& objectId, const ParcelQuota& quota )
{
if ( mID == objectId )
{
mQuota = quota;
}
}

View File

@ -34,7 +34,6 @@
#include "llpermissions.h"
#include "lltimer.h"
#include "v3math.h"
#include "llaccountingquota.h"
// Grid out of which parcels taken is stepped every 4 meters.
const F32 PARCEL_GRID_STEP_METERS = 4.f;
@ -603,9 +602,6 @@ public:
BOOL getSellWithObjects() const { return (mParcelFlags & PF_SELL_PARCEL_OBJECTS) ? TRUE : FALSE; }
void updateQuota( const LLUUID& objectId, const ParcelQuota& quota );
const ParcelQuota& getQuota( void ) { return mQuota; }
protected:
LLUUID mID;
LLUUID mOwnerID;
@ -681,7 +677,6 @@ protected:
BOOL mAllowGroupAVSounds;
BOOL mAllowAnyAVSounds;
ParcelQuota mQuota;
public:
// HACK, make private

View File

@ -1679,6 +1679,19 @@ LLSD LLModel::writeModelToStream(std::ostream& ostr, LLSD& mdl, BOOL nowrite, BO
LLModel::weight_list& LLModel::getJointInfluences(const LLVector3& pos)
{
//1. If a vertex has been weighted then we'll find it via pos and return it's weight list
weight_map::iterator iterPos = mSkinWeights.begin();
weight_map::iterator iterEnd = mSkinWeights.end();
for ( ; iterPos!=iterEnd; ++iterPos )
{
if ( jointPositionalLookup( iterPos->first, pos ) )
{
return iterPos->second;
}
}
//2. Otherwise we'll use the older implementation
weight_map::iterator iter = mSkinWeights.find(pos);
if (iter != mSkinWeights.end())
@ -1692,13 +1705,13 @@ LLModel::weight_list& LLModel::getJointInfluences(const LLVector3& pos)
}
else
{ //no exact match found, get closest point
const F32 epsilon = 2.f/65536;
const F32 epsilon = 1e-5f;
weight_map::iterator iter_up = mSkinWeights.lower_bound(pos);
weight_map::iterator iter_down = ++iter_up;
weight_map::iterator best = iter_up;
F32 min_dist = (iter->first - pos).magVecSquared();
F32 min_dist = (iter->first - pos).magVec();
bool done = false;
while (!done)
@ -1709,7 +1722,7 @@ LLModel::weight_list& LLModel::getJointInfluences(const LLVector3& pos)
if (iter_up != mSkinWeights.end() && ++iter_up != mSkinWeights.end())
{
done = false;
F32 dist = (iter_up->first - pos).magVecSquared();
F32 dist = (iter_up->first - pos).magVec();
if (dist < epsilon)
{
@ -1727,7 +1740,7 @@ LLModel::weight_list& LLModel::getJointInfluences(const LLVector3& pos)
{
done = false;
F32 dist = (iter_down->first - pos).magVecSquared();
F32 dist = (iter_down->first - pos).magVec();
if (dist < epsilon)
{

View File

@ -218,6 +218,19 @@ public:
}
};
//Are the doubles the same w/in epsilon specified tolerance
bool areEqual( double a, double b )
{
const float epsilon = 1e-5f;
return (fabs((a - b)) < epsilon) ? true : false ;
}
//Make sure that we return false for any values that are within the tolerance for equivalence
bool jointPositionalLookup( const LLVector3& a, const LLVector3& b )
{
return ( areEqual( a[0],b[0]) && areEqual( a[1],b[1] ) && areEqual( a[2],b[2]) ) ? true : false;
}
//copy of position array for this model -- mPosition[idx].mV[X,Y,Z]
std::vector<LLVector3> mPosition;

View File

@ -77,7 +77,7 @@ include_directories(
set(viewer_SOURCE_FILES
groupchatlistener.cpp
llaccountingquotamanager.cpp
llaccountingcostmanager.cpp
llagent.cpp
llagentaccess.cpp
llagentcamera.cpp
@ -639,7 +639,7 @@ set(viewer_HEADER_FILES
CMakeLists.txt
ViewerInstall.cmake
groupchatlistener.h
llaccountingquotamanager.h
llaccountingcostmanager.h
llagent.h
llagentaccess.h
llagentcamera.h

View File

@ -0,0 +1,170 @@
/**
* @file LLAccountingQuotaManager.cpp
* @ Handles the setting and accessing for costs associated with mesh
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2011, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#include "llviewerprecompiledheaders.h"
#include "llaccountingcostmanager.h"
#include "llagent.h"
#include "llcurl.h"
#include "llhttpclient.h"
//===============================================================================
LLAccountingCostManager::LLAccountingCostManager()
{
}
//===============================================================================
class LLAccountingCostResponder : public LLCurl::Responder
{
public:
LLAccountingCostResponder( const LLSD& objectIDs )
: mObjectIDs( objectIDs )
{
}
void clearPendingRequests ( void )
{
for ( LLSD::array_iterator iter = mObjectIDs.beginArray(); iter != mObjectIDs.endArray(); ++iter )
{
LLAccountingCostManager::getInstance()->removePendingObject( iter->asUUID() );
}
}
void error( U32 statusNum, const std::string& reason )
{
llwarns << "Transport error "<<reason<<llendl;
clearPendingRequests();
}
void result( const LLSD& content )
{
//Check for error
if ( !content.isMap() || content.has("error") )
{
llwarns << "Error on fetched data"<< llendl;
clearPendingRequests();
return;
}
bool containsSelection = content.has("selected");
if ( containsSelection )
{
S32 dataCount = content["selected"].size();
for(S32 i = 0; i < dataCount; i++)
{
F32 physicsCost = 0.0f;
F32 networkCost = 0.0f;
F32 simulationCost = 0.0f;
//LLTransactionID transactionID;
//transactionID = content["selected"][i]["local_id"].asUUID();
physicsCost = content["selected"][i]["physics"].asReal();
networkCost = content["selected"][i]["streaming"].asReal();
simulationCost = content["selected"][i]["simulation"].asReal();
SelectionCost selectionCost( /*transactionID,*/ physicsCost, networkCost, simulationCost );
//How do you want to handle the updating of the invoking object/ui element?
}
}
}
private:
//List of posted objects
LLSD mObjectIDs;
};
//===============================================================================
void LLAccountingCostManager::fetchCosts( eSelectionType selectionType, const std::string& url )
{
// Invoking system must have already determined capability availability
if ( !url.empty() )
{
LLSD objectList;
U32 objectIndex = 0;
IDIt IDIter = mObjectList.begin();
IDIt IDIterEnd = mObjectList.end();
for ( ; IDIter != IDIterEnd; ++IDIter )
{
// Check to see if a request for this object has already been made.
if ( mPendingObjectQuota.find( *IDIter ) == mPendingObjectQuota.end() )
{
mObjectList.insert( *IDIter );
objectList[objectIndex++] = *IDIter;
}
}
mObjectList.clear();
//Post results
if ( objectList.size() > 0 )
{
std::string keystr;
if ( selectionType == Roots )
{
keystr="selected_roots";
}
else
if ( selectionType == Prims )
{
keystr="prim_roots";
}
else
{
llinfos<<"Invalid selection type "<<llendl;
mObjectList.clear();
mPendingObjectQuota.clear();
return;
}
LLSD dataToPost = LLSD::emptyMap();
dataToPost[keystr.c_str()] = objectList;
LLHTTPClient::post( url, dataToPost, new LLAccountingCostResponder( objectList ));
}
}
else
{
//url was empty - warn & continue
llwarns<<"Supplied url is empty "<<llendl;
mObjectList.clear();
mPendingObjectQuota.clear();
}
}
//===============================================================================
void LLAccountingCostManager::addObject( const LLUUID& objectID )
{
mObjectList.insert( objectID );
}
//===============================================================================
void LLAccountingCostManager::removePendingObject( const LLUUID& objectID )
{
mPendingObjectQuota.erase( objectID );
}
//===============================================================================

View File

@ -27,29 +27,29 @@
#ifndef LL_ACCOUNTINGQUOTAMANAGER_H
#define LL_ACCOUNTINGQUOTAMANAGER_H
//===============================================================================
#include "llaccountingquota.h"
#include "llaccountingcost.h"
//===============================================================================
class LLAccountingQuotaManager : public LLSingleton<LLAccountingQuotaManager>
class LLAccountingCostManager : public LLSingleton<LLAccountingCostManager>
{
public:
//Ctor
LLAccountingQuotaManager();
LLAccountingCostManager();
//Store an object that will be eventually fetched
void updateObjectCost( const LLUUID& objectID );
void addObject( const LLUUID& objectID );
//Request quotas for object list
void fetchQuotas( const std::string& url );
void fetchCosts( eSelectionType selectionType, const std::string& url );
//Delete a specific object from the pending list
void removePendingObjectQuota( const LLUUID& objectID );
void removePendingObject( const LLUUID& objectID );
private:
//Set of objects that need to update their cost
std::set<LLUUID> mUpdateObjectQuota;
//During fetchQuota we move object into a the pending set to signify that
//Set of objects that will be used to generate a cost
std::set<LLUUID> mObjectList;
//During fetchCosts we move object into a the pending set to signify that
//a fetch has been instigated.
std::set<LLUUID> mPendingObjectQuota;
typedef std::set<LLUUID>::iterator IDIt;
};
//===============================================================================
#endif // LLACCOUNTINGQUOTAMANAGER
#endif // LLACCOUNTINGCOSTMANAGER

View File

@ -1,278 +0,0 @@
/**
* @file LLAccountingQuotaManager.cpp
* @ Handles the setting and accessing for costs associated with mesh
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2011, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#include "llviewerprecompiledheaders.h"
#include "llaccountingquotamanager.h"
#include "llagent.h"
#include "llviewerregion.h"
#include "llviewerobject.h"
#include "llviewerobjectlist.h"
#include "llviewerparcelmgr.h"
#include "llparcel.h"
//===============================================================================
LLAccountingQuotaManager::LLAccountingQuotaManager()
{
}
//===============================================================================
class LLAccountingQuotaResponder : public LLCurl::Responder
{
public:
LLAccountingQuotaResponder( const LLSD& objectIDs )
: mObjectIDs( objectIDs )
{
}
void clearPendingRequests ( void )
{
for ( LLSD::array_iterator iter = mObjectIDs.beginArray(); iter != mObjectIDs.endArray(); ++iter )
{
LLAccountingQuotaManager::getInstance()->removePendingObjectQuota( iter->asUUID() );
}
}
void error( U32 statusNum, const std::string& reason )
{
llwarns << "Transport error "<<reason<<llendl;
//prep#do we really want to remove all because of one failure - verify
clearPendingRequests();
}
void result( const LLSD& content )
{
if ( !content.isMap() || content.has("error") )
{
llwarns << "Error on fetched data"<< llendl;
//prep#do we really want to remove all because of one failure - verify
clearPendingRequests();
return;
}
//Differentiate what the incoming caps could be from the data
bool containsParcel = content.has("parcel");
bool containsSelection = content.has("selected");
//Loop over the stored object ids checking against the incoming data
for ( LLSD::array_iterator iter = mObjectIDs.beginArray(); iter != mObjectIDs.endArray(); ++iter )
{
LLUUID objectID = iter->asUUID();
LLAccountingQuotaManager::getInstance()->removePendingObjectQuota( objectID );
if ( containsParcel )
{
//Typically should be one
S32 dataCount = content["parcel"].size();
for(S32 i = 0; i < dataCount; i++)
{
//prep#todo verify that this is safe, otherwise just add a bool
LLUUID parcelId;
//S32 parcelOwner = 0;
if ( content["parcel"][i].has("parcel_id") )
{
parcelId = content["parcel"][i]["parcel_id"].asUUID();
}
//if ( content["parcel"][i].has("parcel_owner") )
//{
// parcelOwner = content["parcel"][i]["parcel_owner"].asInteger();
//}
F32 ownerRenderCost = 0;
F32 ownerPhysicsCost = 0;
F32 ownerNetworkCost = 0;
F32 ownerSimulationCost = 0;
F32 groupRenderCost = 0;
F32 groupPhysicsCost = 0;
F32 groupNetworkCost = 0;
F32 groupSimulationCost = 0;
F32 otherRenderCost = 0;
F32 otherPhysicsCost = 0;
F32 otherNetworkCost = 0;
F32 otherSimulationCost = 0;
F32 tempRenderCost = 0;
F32 tempPhysicsCost = 0;
F32 tempNetworkCost = 0;
F32 tempSimulationCost = 0;
F32 selectedRenderCost = 0;
F32 selectedPhysicsCost = 0;
F32 selectedNetworkCost = 0;
F32 selectedSimulationCost = 0;
F32 parcelCapacity = 0;
if ( content["parcel"][i].has("capacity") )
{
parcelCapacity = content["parcel"][i].has("capacity");
}
if ( content["parcel"][i].has("owner") )
{
ownerRenderCost = content["parcel"][i]["owner"]["rendering"].asReal();
ownerPhysicsCost = content["parcel"][i]["owner"]["physics"].asReal();
ownerNetworkCost = content["parcel"][i]["owner"]["streaming"].asReal();
ownerSimulationCost = content["parcel"][i]["owner"]["simulation"].asReal();
}
if ( content["parcel"][i].has("group") )
{
groupRenderCost = content["parcel"][i]["group"]["rendering"].asReal();
groupPhysicsCost = content["parcel"][i]["group"]["physics"].asReal();
groupNetworkCost = content["parcel"][i]["group"]["streaming"].asReal();
groupSimulationCost = content["parcel"][i]["group"]["simulation"].asReal();
}
if ( content["parcel"][i].has("other") )
{
otherRenderCost = content["parcel"][i]["other"]["rendering"].asReal();
otherPhysicsCost = content["parcel"][i]["other"]["physics"].asReal();
otherNetworkCost = content["parcel"][i]["other"]["streaming"].asReal();
otherSimulationCost = content["parcel"][i]["other"]["simulation"].asReal();
}
if ( content["parcel"][i].has("temp") )
{
tempRenderCost = content["parcel"][i]["total"]["rendering"].asReal();
tempPhysicsCost = content["parcel"][i]["total"]["physics"].asReal();
tempNetworkCost = content["parcel"][i]["total"]["streaming"].asReal();
tempSimulationCost = content["parcel"][i]["total"]["simulation"].asReal();
}
if ( content["parcel"][i].has("selected") )
{
selectedRenderCost = content["parcel"][i]["total"]["rendering"].asReal();
selectedPhysicsCost = content["parcel"][i]["total"]["physics"].asReal();
selectedNetworkCost = content["parcel"][i]["total"]["streaming"].asReal();
selectedSimulationCost = content["parcel"][i]["total"]["simulation"].asReal();
}
ParcelQuota parcelQuota( ownerRenderCost, ownerPhysicsCost, ownerNetworkCost, ownerSimulationCost,
groupRenderCost, groupPhysicsCost, groupNetworkCost, groupSimulationCost,
otherRenderCost, otherPhysicsCost, otherNetworkCost, otherSimulationCost,
tempRenderCost, tempPhysicsCost, tempNetworkCost, tempSimulationCost,
selectedRenderCost, selectedPhysicsCost, selectedNetworkCost, selectedSimulationCost,
parcelCapacity );
//Update the Parcel
LLParcel* pParcel = LLViewerParcelMgr::getInstance()->getParcelSelection()->getParcel();
if ( pParcel )
{
pParcel->updateQuota( objectID, parcelQuota );
}
}
}
else
if ( containsSelection )
{
S32 dataCount = content["selected"].size();
for(S32 i = 0; i < dataCount; i++)
{
F32 renderCost = 0;
F32 physicsCost = 0;
F32 networkCost = 0;
F32 simulationCost = 0;
LLUUID objectId;
objectId = content["selected"][i]["local_id"].asUUID();
renderCost = content["selected"][i]["rendering"].asReal();
physicsCost = content["selected"][i]["physics"].asReal();
networkCost = content["selected"][i]["streaming"].asReal();
simulationCost = content["selected"][i]["simulation"].asReal();
SelectionQuota selectionQuota( objectId, renderCost, physicsCost, networkCost, simulationCost );
//Update the objects
gObjectList.updateQuota( objectId, selectionQuota );
}
}
else
{
//Nothing in string
LLAccountingQuotaManager::getInstance()->removePendingObjectQuota( objectID );
}
}
}
private:
//List of posted objects
LLSD mObjectIDs;
};
//===============================================================================
void LLAccountingQuotaManager::fetchQuotas( const std::string& url )
{
// Invoking system must have already determined capability availability
if ( !url.empty() )
{
LLSD objectList;
U32 objectIndex = 0;
IDIt IDIter = mUpdateObjectQuota.begin();
IDIt IDIterEnd = mUpdateObjectQuota.end();
for ( ; IDIter != IDIterEnd; ++IDIter )
{
// Check to see if a request for this object has already been made.
if ( mPendingObjectQuota.find( *IDIter ) == mPendingObjectQuota.end() )
{
mPendingObjectQuota.insert( *IDIter );
objectList[objectIndex++] = *IDIter;
}
}
mUpdateObjectQuota.clear();
//Post results
if ( objectList.size() > 0 )
{
LLSD dataToPost = LLSD::emptyMap();
dataToPost["object_ids"] = objectList;
LLHTTPClient::post( url, dataToPost, new LLAccountingQuotaResponder( objectList ));
}
}
else
{
//url was empty - warn & continue
llwarns<<"Supplied url is empty "<<llendl;
mUpdateObjectQuota.clear();
mPendingObjectQuota.clear();
}
}
//===============================================================================
void LLAccountingQuotaManager::updateObjectCost( const LLUUID& objectID )
{
mUpdateObjectQuota.insert( objectID );
}
//===============================================================================
void LLAccountingQuotaManager::removePendingObjectQuota( const LLUUID& objectID )
{
mPendingObjectQuota.erase( objectID );
}
//===============================================================================

View File

@ -1543,8 +1543,7 @@ bool LLModelLoader::doLoadModel()
LLMatrix4 trans = normalized_transformation;
trans *= skin_info.mBindShapeMatrix;
skin_info.mBindShapeMatrix = trans;
skin_info.mBindShapeMatrix = trans;
}
@ -1747,15 +1746,15 @@ bool LLModelLoader::doLoadModel()
}
}
model->mSkinInfo.mInvBindMatrix.push_back(mat);
model->mSkinInfo.mInvBindMatrix.push_back(mat);
}
}
}
}
}
//Now that we've parsed the joint array, let's determine if we have a full rig
//(which means we have all the joints that are required for an avatar versus
//Now that we've parsed the jointa werray, let's determine if we have a full rig
//(which means we have all the joint sthat are required for an avatar versus
//a skinned asset attached to a node in a file that contains an entire skeleton,
//but does not use the skeleton).
buildJointToNodeMappingFromScene( root );
@ -2159,15 +2158,29 @@ void LLModelLoader::processJointToNodeMapping( domNode* pNode )
mJointsFromNode.push_front( pNode->getName() );
}
//2. Handle the kiddo's
daeTArray< daeSmartRef<daeElement> > childOfChild = pNode->getChildren();
S32 childOfChildCount = childOfChild.getCount();
for (S32 i = 0; i < childOfChildCount; ++i)
processChildJoints( pNode );
}
else
{
//Determine if the're any children wrt to this failed node.
//This occurs when an armature is exported and ends up being what essentially amounts to
//as the root for the visual_scene
processChildJoints( pNode );
}
}
//-----------------------------------------------------------------------------
// processChildJoint()
//-----------------------------------------------------------------------------
void LLModelLoader::processChildJoints( domNode* pParentNode )
{
daeTArray< daeSmartRef<daeElement> > childOfChild = pParentNode->getChildren();
S32 childOfChildCount = childOfChild.getCount();
for (S32 i = 0; i < childOfChildCount; ++i)
{
domNode* pChildNode = daeSafeCast<domNode>( childOfChild[i] );
if ( pChildNode )
{
domNode* pChildNode = daeSafeCast<domNode>( childOfChild[i] );
if ( pChildNode )
{
processJointToNodeMapping( pChildNode );
}
processJointToNodeMapping( pChildNode );
}
}
}
@ -2353,8 +2366,20 @@ void LLModelLoader::loadTextures()
//-----------------------------------------------------------------------------
bool LLModelLoader::isNodeAJoint( domNode* pNode )
{
if ( !pNode || pNode->getName() == NULL)
if ( !pNode )
{
llinfos<<"Created node is NULL"<<llendl;
return false;
}
if ( pNode->getName() == NULL )
{
llinfos<<"Parsed node has no name "<<llendl;
//Attempt to write the node id, if possible (aids in debugging the visual scene)
if ( pNode->getId() )
{
llinfos<<"Parsed node ID: "<<pNode->getId()<<llendl;
}
return false;
}
@ -3081,6 +3106,7 @@ U32 LLModelPreview::calcResourceCost()
void LLFloaterModelPreview::setDetails(F32 x, F32 y, F32 z, F32 streaming_cost, F32 physics_cost)
{
assert_main_thread();
childSetTextArg("import_dimensions", "[X]", llformat("%.3f", x));
childSetTextArg("import_dimensions", "[Y]", llformat("%.3f", y));
childSetTextArg("import_dimensions", "[Z]", llformat("%.3f", z));
@ -4868,6 +4894,8 @@ BOOL LLModelPreview::render()
target_pos); // point of interest
z_near = llclamp(z_far * 0.001f, 0.001f, 0.1f);
LLViewerCamera::getInstance()->setPerspective(FALSE, mOrigin.mX, mOrigin.mY, width, height, FALSE, z_near, z_far);
stop_glerror();
@ -4944,18 +4972,22 @@ BOOL LLModelPreview::render()
if (textures)
{
const std::string& binding = instance.mModel->mMaterialList[i];
const LLImportMaterial& material = instance.mMaterial[binding];
llassert(binding == model->mMaterialList[i]);
glColor4fv(material.mDiffuseColor.mV);
if (material.mDiffuseMap.notNull())
int materialCnt = instance.mModel->mMaterialList.size();
if ( i < materialCnt )
{
if (material.mDiffuseMap->getDiscardLevel() > -1)
const std::string& binding = instance.mModel->mMaterialList[i];
const LLImportMaterial& material = instance.mMaterial[binding];
llassert(binding == model->mMaterialList[i]);
glColor4fv(material.mDiffuseColor.mV);
if (material.mDiffuseMap.notNull())
{
gGL.getTexUnit(0)->bind(material.mDiffuseMap, true);
mTextureSet.insert(material.mDiffuseMap.get());
if (material.mDiffuseMap->getDiscardLevel() > -1)
{
gGL.getTexUnit(0)->bind(material.mDiffuseMap, true);
mTextureSet.insert(material.mDiffuseMap.get());
}
}
}
}
@ -4983,184 +5015,197 @@ BOOL LLModelPreview::render()
if (physics)
{
glClear(GL_DEPTH_BUFFER_BIT);
LLGLEnable blend(GL_BLEND);
gGL.blendFunc(LLRender::BF_ONE, LLRender::BF_ZERO);
for (LLMeshUploadThread::instance_list::iterator iter = mUploadData.begin(); iter != mUploadData.end(); ++iter)
for (U32 i = 0; i < 2; i++)
{
LLModelInstance& instance = *iter;
LLModel* model = instance.mLOD[LLModel::LOD_PHYSICS];
if (!model)
if (i == 0)
{ //depth only pass
gGL.setColorMask(false, false);
}
else
{
continue;
gGL.setColorMask(true, true);
}
gGL.pushMatrix();
LLMatrix4 mat = instance.mTransform;
//enable alpha blending on second pass but not first pass
LLGLState blend(GL_BLEND, i);
gGL.blendFunc(LLRender::BF_SOURCE_ALPHA, LLRender::BF_ONE_MINUS_SOURCE_ALPHA);
glMultMatrixf((GLfloat*) mat.mMatrix);
bool render_mesh = true;
LLPhysicsDecomp* decomp = gMeshRepo.mDecompThread;
if (decomp)
for (LLMeshUploadThread::instance_list::iterator iter = mUploadData.begin(); iter != mUploadData.end(); ++iter)
{
LLMutexLock(decomp->mMutex);
LLModelInstance& instance = *iter;
LLModel::Decomposition& physics = model->mPhysics;
LLModel* model = instance.mLOD[LLModel::LOD_PHYSICS];
if (!physics.mHull.empty())
if (!model)
{
render_mesh = false;
continue;
}
if (physics.mMesh.empty())
{ //build vertex buffer for physics mesh
gMeshRepo.buildPhysicsMesh(physics);
}
gGL.pushMatrix();
LLMatrix4 mat = instance.mTransform;
glMultMatrixf((GLfloat*) mat.mMatrix);
bool render_mesh = true;
LLPhysicsDecomp* decomp = gMeshRepo.mDecompThread;
if (decomp)
{
LLMutexLock(decomp->mMutex);
LLModel::Decomposition& physics = model->mPhysics;
if (!physics.mHull.empty())
{
render_mesh = false;
if (physics.mMesh.empty())
{ //build vertex buffer for physics mesh
gMeshRepo.buildPhysicsMesh(physics);
}
if (!physics.mMesh.empty())
{ //render hull instead of mesh
for (U32 i = 0; i < physics.mMesh.size(); ++i)
{
if (explode > 0.f)
if (!physics.mMesh.empty())
{ //render hull instead of mesh
for (U32 i = 0; i < physics.mMesh.size(); ++i)
{
gGL.pushMatrix();
if (explode > 0.f)
{
gGL.pushMatrix();
LLVector3 offset = model->mHullCenter[i]-model->mCenterOfHullCenters;
offset *= explode;
LLVector3 offset = model->mHullCenter[i]-model->mCenterOfHullCenters;
offset *= explode;
gGL.translatef(offset.mV[0], offset.mV[1], offset.mV[2]);
}
gGL.translatef(offset.mV[0], offset.mV[1], offset.mV[2]);
}
static std::vector<LLColor4U> hull_colors;
static std::vector<LLColor4U> hull_colors;
if (i+1 >= hull_colors.size())
{
hull_colors.push_back(LLColor4U(rand()%128+127, rand()%128+127, rand()%128+127, 255));
}
if (i+1 >= hull_colors.size())
{
hull_colors.push_back(LLColor4U(rand()%128+127, rand()%128+127, rand()%128+127, 128));
}
glColor4ubv(hull_colors[i].mV);
LLVertexBuffer::drawArrays(LLRender::TRIANGLES, physics.mMesh[i].mPositions, physics.mMesh[i].mNormals);
LLVertexBuffer::drawArrays(LLRender::TRIANGLES, physics.mMesh[i].mPositions, physics.mMesh[i].mNormals);
if (explode > 0.f)
{
gGL.popMatrix();
if (explode > 0.f)
{
gGL.popMatrix();
}
}
}
}
}
}
if (render_mesh)
{
if (mVertexBuffer[LLModel::LOD_PHYSICS].empty())
{
genBuffers(LLModel::LOD_PHYSICS, false);
}
for (U32 i = 0; i < mVertexBuffer[LLModel::LOD_PHYSICS][model].size(); ++i)
{
LLVertexBuffer* buffer = mVertexBuffer[LLModel::LOD_PHYSICS][model][i];
buffer->setBuffer(type_mask & buffer->getTypeMask());
buffer->drawRange(LLRender::TRIANGLES, 0, buffer->getNumVerts()-1, buffer->getNumIndices(), 0);
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
glColor4f(0.4f, 0.4f, 0.0f, 0.4f);
buffer->drawRange(LLRender::TRIANGLES, 0, buffer->getNumVerts()-1, buffer->getNumIndices(), 0);
glColor3f(1.f, 1.f, 0.f);
glLineWidth(2.f);
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
buffer->drawRange(LLRender::TRIANGLES, 0, buffer->getNumVerts()-1, buffer->getNumIndices(), 0);
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
glLineWidth(1.f);
}
}
gGL.popMatrix();
}
glLineWidth(3.f);
glPointSize(8.f);
gPipeline.enableLightsFullbright(LLColor4::white);
//show degenerate triangles
LLGLDepthTest depth(GL_TRUE, GL_TRUE, GL_ALWAYS);
LLGLDisable cull(GL_CULL_FACE);
glColor4f(1.f,0.f,0.f,1.f);
const LLVector4a scale(0.5f);
for (LLMeshUploadThread::instance_list::iterator iter = mUploadData.begin(); iter != mUploadData.end(); ++iter)
{
LLModelInstance& instance = *iter;
LLModel* model = instance.mLOD[LLModel::LOD_PHYSICS];
if (!model)
{
continue;
}
gGL.pushMatrix();
LLMatrix4 mat = instance.mTransform;
glMultMatrixf((GLfloat*) mat.mMatrix);
LLPhysicsDecomp* decomp = gMeshRepo.mDecompThread;
if (decomp)
{
LLMutexLock(decomp->mMutex);
LLModel::Decomposition& physics = model->mPhysics;
if (physics.mHull.empty())
if (render_mesh)
{
if (mVertexBuffer[LLModel::LOD_PHYSICS].empty())
{
genBuffers(LLModel::LOD_PHYSICS, false);
}
for (U32 i = 0; i < mVertexBuffer[LLModel::LOD_PHYSICS][model].size(); ++i)
{
LLVertexBuffer* buffer = mVertexBuffer[LLModel::LOD_PHYSICS][model][i];
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
glColor4f(0.4f, 0.4f, 0.0f, 0.4f);
buffer->setBuffer(type_mask & buffer->getTypeMask());
buffer->drawRange(LLRender::TRIANGLES, 0, buffer->getNumVerts()-1, buffer->getNumIndices(), 0);
LLStrider<LLVector3> pos_strider;
buffer->getVertexStrider(pos_strider, 0);
LLVector4a* pos = (LLVector4a*) pos_strider.get();
LLStrider<U16> idx;
buffer->getIndexStrider(idx, 0);
glColor3f(1.f, 1.f, 0.f);
for (U32 i = 0; i < buffer->getNumIndices(); i += 3)
glLineWidth(2.f);
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
buffer->drawRange(LLRender::TRIANGLES, 0, buffer->getNumVerts()-1, buffer->getNumIndices(), 0);
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
glLineWidth(1.f);
}
}
gGL.popMatrix();
}
glLineWidth(3.f);
glPointSize(8.f);
gPipeline.enableLightsFullbright(LLColor4::white);
//show degenerate triangles
LLGLDepthTest depth(GL_TRUE, GL_TRUE, GL_ALWAYS);
LLGLDisable cull(GL_CULL_FACE);
glColor4f(1.f,0.f,0.f,1.f);
const LLVector4a scale(0.5f);
for (LLMeshUploadThread::instance_list::iterator iter = mUploadData.begin(); iter != mUploadData.end(); ++iter)
{
LLModelInstance& instance = *iter;
LLModel* model = instance.mLOD[LLModel::LOD_PHYSICS];
if (!model)
{
continue;
}
gGL.pushMatrix();
LLMatrix4 mat = instance.mTransform;
glMultMatrixf((GLfloat*) mat.mMatrix);
LLPhysicsDecomp* decomp = gMeshRepo.mDecompThread;
if (decomp)
{
LLMutexLock(decomp->mMutex);
LLModel::Decomposition& physics = model->mPhysics;
if (physics.mHull.empty())
{
if (mVertexBuffer[LLModel::LOD_PHYSICS].empty())
{
LLVector4a v1; v1.setMul(pos[*idx++], scale);
LLVector4a v2; v2.setMul(pos[*idx++], scale);
LLVector4a v3; v3.setMul(pos[*idx++], scale);
genBuffers(LLModel::LOD_PHYSICS, false);
}
for (U32 i = 0; i < mVertexBuffer[LLModel::LOD_PHYSICS][model].size(); ++i)
{
LLVertexBuffer* buffer = mVertexBuffer[LLModel::LOD_PHYSICS][model][i];
if (ll_is_degenerate(v1,v2,v3))
buffer->setBuffer(type_mask & buffer->getTypeMask());
LLStrider<LLVector3> pos_strider;
buffer->getVertexStrider(pos_strider, 0);
LLVector4a* pos = (LLVector4a*) pos_strider.get();
LLStrider<U16> idx;
buffer->getIndexStrider(idx, 0);
for (U32 i = 0; i < buffer->getNumIndices(); i += 3)
{
buffer->draw(LLRender::LINE_LOOP, 3, i);
buffer->draw(LLRender::POINTS, 3, i);
LLVector4a v1; v1.setMul(pos[*idx++], scale);
LLVector4a v2; v2.setMul(pos[*idx++], scale);
LLVector4a v3; v3.setMul(pos[*idx++], scale);
if (ll_is_degenerate(v1,v2,v3))
{
buffer->draw(LLRender::LINE_LOOP, 3, i);
buffer->draw(LLRender::POINTS, 3, i);
}
}
}
}
}
}
gGL.popMatrix();
gGL.popMatrix();
}
glLineWidth(1.f);
glPointSize(1.f);
gPipeline.enableLightsPreview();
gGL.setSceneBlendType(LLRender::BT_ALPHA);
}
glLineWidth(1.f);
glPointSize(1.f);
gPipeline.enableLightsPreview();
gGL.setSceneBlendType(LLRender::BT_ALPHA);
}
}
else
@ -5525,19 +5570,21 @@ void LLFloaterModelPreview::handleModelPhysicsFeeReceived()
void LLFloaterModelPreview::setModelPhysicsFeeErrorStatus(U32 status, const std::string& reason)
{
toggleCalculateButton(true);
llwarns << "LLFloaterModelPreview::setModelPhysicsFeeErrorStatus(" << status << " : " << reason << ")" << llendl;
doOnIdleOneTime(boost::bind(&LLFloaterModelPreview::toggleCalculateButton, this, true));
}
/*virtual*/
void LLFloaterModelPreview::onModelUploadSuccess()
{
assert_main_thread();
closeFloater(false);
}
/*virtual*/
void LLFloaterModelPreview::onModelUploadFailure()
{
assert_main_thread();
toggleCalculateButton(true);
}

View File

@ -125,7 +125,7 @@ public:
void buildJointToNodeMappingFromScene( daeElement* pRoot );
void processJointToNodeMapping( domNode* pNode );
void processChildJoints( domNode* pParentNode );
//map of avatar joints as named in COLLADA assets to internal joint names
std::map<std::string, std::string> mJointMap;

View File

@ -84,7 +84,6 @@
#include "llviewerwindow.h"
#include "llvovolume.h"
#include "lluictrlfactory.h"
#include "llaccountingquotamanager.h"
#include "llmeshrepository.h"
// Globals

View File

@ -411,7 +411,6 @@ public:
cc = llsd_from_file("fake_upload_error.xml");
}
//assert_main_thread();
mThread->mPendingUploads--;
dump_llsd_to_file(cc,make_dump_name("whole_model_upload_response_",dump_num));
@ -1471,47 +1470,53 @@ void LLMeshUploadThread::wholeModelToLLSD(LLSD& dest, bool include_textures)
void LLMeshUploadThread::generateHulls()
{
bool has_valid_requests = false ;
for (instance_map::iterator iter = mInstance.begin(); iter != mInstance.end(); ++iter)
{
LLMeshUploadData data;
data.mBaseModel = iter->first;
LLModelInstance& instance = *(iter->second.begin());
for (S32 i = 0; i < 5; i++)
{
LLMeshUploadData data;
data.mBaseModel = iter->first;
LLModelInstance& instance = *(iter->second.begin());
for (S32 i = 0; i < 5; i++)
{
data.mModel[i] = instance.mLOD[i];
}
//queue up models for hull generation
LLModel* physics = NULL;
if (data.mModel[LLModel::LOD_PHYSICS].notNull())
{
physics = data.mModel[LLModel::LOD_PHYSICS];
}
else if (data.mModel[LLModel::LOD_MEDIUM].notNull())
{
physics = data.mModel[LLModel::LOD_MEDIUM];
}
else
{
physics = data.mModel[LLModel::LOD_HIGH];
}
llassert(physics != NULL);
DecompRequest* request = new DecompRequest(physics, data.mBaseModel, this);
if(request->isValid())
{
gMeshRepo.mDecompThread->submitRequest(request);
}
data.mModel[i] = instance.mLOD[i];
}
//queue up models for hull generation
LLModel* physics = NULL;
if (data.mModel[LLModel::LOD_PHYSICS].notNull())
{
physics = data.mModel[LLModel::LOD_PHYSICS];
}
else if (data.mModel[LLModel::LOD_MEDIUM].notNull())
{
physics = data.mModel[LLModel::LOD_MEDIUM];
}
else
{
physics = data.mModel[LLModel::LOD_HIGH];
}
llassert(physics != NULL);
DecompRequest* request = new DecompRequest(physics, data.mBaseModel, this);
if(request->isValid())
{
gMeshRepo.mDecompThread->submitRequest(request);
has_valid_requests = true ;
}
}
if(has_valid_requests)
{
while (!mPhysicsComplete)
{
apr_sleep(100);
}
}
}
void LLMeshUploadThread::doWholeModelUpload()

View File

@ -351,7 +351,7 @@ void LLPanelVolume::getState( )
getChild<LLUICtrl>("Flexible1D Checkbox Ctrl")->setValue(is_flexible);
if (is_flexible || (volobjp && volobjp->canBeFlexible()))
{
getChildView("Flexible1D Checkbox Ctrl")->setEnabled(editable && single_volume && volobjp);
getChildView("Flexible1D Checkbox Ctrl")->setEnabled(editable && single_volume && volobjp && !volobjp->isMesh());
}
else
{

View File

@ -100,7 +100,6 @@
#include "lltrans.h"
#include "llsdutil.h"
#include "llmediaentry.h"
#include "llaccountingquota.h"
//#define DEBUG_UPDATE_TYPE
@ -5799,9 +5798,3 @@ public:
LLHTTPRegistration<ObjectPhysicsProperties>
gHTTPRegistrationObjectPhysicsProperties("/message/ObjectPhysicsProperties");
void LLViewerObject::updateQuota( const SelectionQuota& quota )
{
//update quotas
mSelectionQuota = quota;
}

View File

@ -43,7 +43,6 @@
#include "v3dmath.h"
#include "v3math.h"
#include "llvertexbuffer.h"
#include "llaccountingquota.h"
#include "llbbox.h"
class LLAgent; // TODO: Get rid of this.
@ -659,9 +658,7 @@ protected:
void setParticleSource(const LLPartSysData& particle_parameters, const LLUUID& owner_id);
public:
void updateQuota( const SelectionQuota& quota );
const SelectionQuota& getQuota( void ) { return mSelectionQuota; }
private:
void setNameValueList(const std::string& list); // clears nv pairs and then individually adds \n separated NV pairs from \0 terminated string
void deleteTEImages(); // correctly deletes list of images
@ -723,8 +720,6 @@ protected:
F32 mPhysicsCost;
F32 mLinksetPhysicsCost;
SelectionQuota mSelectionQuota;
bool mCostStale;
mutable bool mPhysicsShapeUnknown;

View File

@ -1425,15 +1425,6 @@ void LLViewerObjectList::onObjectCostFetchFailure(const LLUUID& object_id)
mPendingObjectCost.erase(object_id);
}
void LLViewerObjectList::updateQuota( const LLUUID& objectId, const SelectionQuota& quota )
{
LLViewerObject* pVO = findObject( objectId );
if ( pVO )
{
pVO->updateQuota( quota );
}
}
void LLViewerObjectList::updatePhysicsFlags(const LLViewerObject* object)
{
mStalePhysicsFlags.insert(object->getID());

View File

@ -36,7 +36,6 @@
// project includes
#include "llviewerobject.h"
#include "llaccountingquota.h"
class LLCamera;
class LLNetMap;
@ -102,8 +101,6 @@ public:
F32 restitution,
F32 gravity_multiplier);
void updateQuota( const LLUUID& objectId, const SelectionQuota& costs );
void shiftObjects(const LLVector3 &offset);
void repartitionObjects();

View File

@ -1484,8 +1484,6 @@ void LLViewerRegion::unpackRegionHandshake()
void LLViewerRegionImpl::buildCapabilityNames(LLSD& capabilityNames)
{
capabilityNames.append("AccountingParcel");
capabilityNames.append("AccountingSelection");
capabilityNames.append("AttachmentResources");
capabilityNames.append("AvatarPickerSearch");
capabilityNames.append("ChatSessionRequest");
@ -1525,6 +1523,7 @@ void LLViewerRegionImpl::buildCapabilityNames(LLSD& capabilityNames)
capabilityNames.append("ProvisionVoiceAccountRequest");
capabilityNames.append("RemoteParcelRequest");
capabilityNames.append("RequestTextureDownload");
capabilityNames.append("ResourceCostSelected");
capabilityNames.append("SearchStatRequest");
capabilityNames.append("SearchStatTracking");
capabilityNames.append("SendPostcard");
@ -1550,10 +1549,6 @@ void LLViewerRegionImpl::buildCapabilityNames(LLSD& capabilityNames)
capabilityNames.append("ViewerMetrics");
capabilityNames.append("ViewerStartAuction");
capabilityNames.append("ViewerStats");
//prep# Finalize these!!!!!!!!!
//capabilityNames.append("AccountingVO");
capabilityNames.append("AccountingParcel");
capabilityNames.append("AccountingRegion");
// Please add new capabilities alphabetically to reduce
// merge conflicts.

View File

@ -166,6 +166,7 @@ LLViewerShaderMgr::LLViewerShaderMgr() :
mShaderList.push_back(&gWLCloudProgram);
mShaderList.push_back(&gAvatarProgram);
mShaderList.push_back(&gObjectShinyProgram);
mShaderList.push_back(&gObjectShinyNonIndexedProgram);
mShaderList.push_back(&gWaterProgram);
mShaderList.push_back(&gAvatarEyeballProgram);
mShaderList.push_back(&gObjectSimpleProgram);
@ -190,6 +191,7 @@ LLViewerShaderMgr::LLViewerShaderMgr() :
mShaderList.push_back(&gObjectFullbrightWaterProgram);
mShaderList.push_back(&gAvatarWaterProgram);
mShaderList.push_back(&gObjectShinyWaterProgram);
mShaderList.push_back(&gObjectShinyNonIndexedWaterProgram);
mShaderList.push_back(&gUnderWaterProgram);
mShaderList.push_back(&gDeferredSunProgram);
mShaderList.push_back(&gDeferredBlurLightProgram);