Initial work.

This commit is contained in:
Drake Arconis
2013-01-06 03:59:38 -05:00
parent cadf654fae
commit 9c1237ca05
14 changed files with 285 additions and 149 deletions

View File

@@ -36,6 +36,7 @@ set(cmake_SOURCE_FILES
FMOD.cmake FMOD.cmake
FMODEX.cmake FMODEX.cmake
FreeType.cmake FreeType.cmake
GLOD.cmake
GStreamer010Plugin.cmake GStreamer010Plugin.cmake
GooglePerfTools.cmake GooglePerfTools.cmake
Hunspell.cmake Hunspell.cmake
@@ -54,6 +55,7 @@ set(cmake_SOURCE_FILES
LLMessage.cmake LLMessage.cmake
LLPlugin.cmake LLPlugin.cmake
LLPrimitive.cmake LLPrimitive.cmake
LLPhysicsExtensions.cmake
LLQtWebkit.cmake LLQtWebkit.cmake
LLRender.cmake LLRender.cmake
LLScene.cmake LLScene.cmake

9
indra/cmake/GLOD.cmake Normal file
View File

@@ -0,0 +1,9 @@
# -*- cmake -*-
include(Prebuilt)
if (NOT STANDALONE)
use_prebuilt_binary(GLOD)
endif (NOT STANDALONE)
set(GLOD_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/include)
set(GLOD_LIBRARIES glod)

View File

@@ -0,0 +1,10 @@
# -*- cmake -*-
include(Prebuilt)
use_prebuilt_binary(ndPhysicsStub)
set(LLPHYSICSEXTENSIONS_LIBRARIES nd_hacdConvexDecomposition hacd nd_Pathing )
set(LLPHYSICSEXTENSIONS_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/include/ )

View File

@@ -1,7 +1,33 @@
# -*- cmake -*- # -*- cmake -*-
# these should be moved to their own cmake file
include(Prebuilt)
use_prebuilt_binary(colladadom)
use_prebuilt_binary(pcre)
use_prebuilt_binary(libxml)
set(LLPRIMITIVE_INCLUDE_DIRS set(LLPRIMITIVE_INCLUDE_DIRS
${LIBS_OPEN_DIR}/llprimitive ${LIBS_OPEN_DIR}/llprimitive
) )
if (WINDOWS)
set(LLPRIMITIVE_LIBRARIES
debug llprimitive
optimized llprimitive
debug libcollada14dom22-d
optimized libcollada14dom22
debug libboost_filesystem-mt-gd
optimized libboost_filesystem-mt
debug libboost_system-mt-gd
optimized libboost_system-mt
)
else (WINDOWS)
set(LLPRIMITIVE_LIBRARIES
llprimitive
collada14dom
minizip
xml2
pcrecpp
pcre
)
endif (WINDOWS)
set(LLPRIMITIVE_LIBRARIES llprimitive)

View File

@@ -7,12 +7,16 @@ include(LLCommon)
include(LLMath) include(LLMath)
include(LLMessage) include(LLMessage)
include(LLXML) include(LLXML)
include(LLPhysicsExtensions)
include_directories( include_directories(
${LLCOMMON_INCLUDE_DIRS} ${LLCOMMON_INCLUDE_DIRS}
${LLMATH_INCLUDE_DIRS} ${LLMATH_INCLUDE_DIRS}
${LLMESSAGE_INCLUDE_DIRS} ${LLMESSAGE_INCLUDE_DIRS}
${LLXML_INCLUDE_DIRS} ${LLXML_INCLUDE_DIRS}
${LLPHYSICSEXTENSIONS_INCLUDE_DIRS}
${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/include/collada
${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/include/collada/1.4
) )
set(llprimitive_SOURCE_FILES set(llprimitive_SOURCE_FILES

View File

@@ -28,18 +28,21 @@
#include "llmodel.h" #include "llmodel.h"
#include "llmemory.h" #include "llmemory.h"
#if MESH_IMPORT
#include "llconvexdecomposition.h" #include "llconvexdecomposition.h"
#endif //MESH_IMPORT
#include "llsdserialize.h" #include "llsdserialize.h"
#include "llvector4a.h" #include "llvector4a.h"
#if LL_MSVC
#if MESH_IMPORT #pragma warning (disable : 4263)
#pragma warning (disable : 4264)
#endif
#include "dae.h" #include "dae.h"
#include "dae/daeErrorHandler.h" #include "dae/daeErrorHandler.h"
#include "dom/domConstants.h" #include "dom/domConstants.h"
#include "dom/domMesh.h" #include "dom/domMesh.h"
#endif //MESH_IMPORT #if LL_MSVC
#pragma warning (default : 4263)
#pragma warning (default : 4264)
#endif
#ifdef LL_STANDALONE #ifdef LL_STANDALONE
# include <zlib.h> # include <zlib.h>
@@ -72,13 +75,10 @@ LLModel::~LLModel()
{ {
if (mDecompID >= 0) if (mDecompID >= 0)
{ {
#if MESH_IMPORT
LLConvexDecomposition::getInstance()->deleteDecomposition(mDecompID); LLConvexDecomposition::getInstance()->deleteDecomposition(mDecompID);
#endif //MESH_IMPORT
} }
} }
#if MESH_IMPORT
bool get_dom_sources(const domInputLocalOffset_Array& inputs, S32& pos_offset, S32& tc_offset, S32& norm_offset, S32 &idx_stride, bool get_dom_sources(const domInputLocalOffset_Array& inputs, S32& pos_offset, S32& tc_offset, S32& norm_offset, S32 &idx_stride,
domSource* &pos_source, domSource* &tc_source, domSource* &norm_source) domSource* &pos_source, domSource* &tc_source, domSource* &norm_source)
@@ -823,7 +823,6 @@ BOOL LLModel::createVolumeFacesFromDomMesh(domMesh* mesh)
return FALSE; return FALSE;
} }
#endif //MESH_IMPORT
void LLModel::offsetMesh( const LLVector3& pivotPoint ) void LLModel::offsetMesh( const LLVector3& pivotPoint )
{ {
@@ -1294,8 +1293,6 @@ void LLModel::generateNormals(F32 angle_cutoff)
} }
} }
#if MESH_IMPORT
//static //static
std::string LLModel::getElementLabel(daeElement *element) std::string LLModel::getElementLabel(daeElement *element)
{ // try to get a decent label for this element { // try to get a decent label for this element
@@ -1351,7 +1348,6 @@ LLModel* LLModel::loadModelFromDomMesh(domMesh *mesh)
ret->mLabel = getElementLabel(mesh); ret->mLabel = getElementLabel(mesh);
return ret; return ret;
} }
#endif //MESH_IMPORT
std::string LLModel::getName() const std::string LLModel::getName() const
{ {
@@ -1540,6 +1536,7 @@ LLSD LLModel::writeModel(
mdl[model_names[idx]][i]["TexCoord0Domain"]["Max"] = max_tc.getValue(); mdl[model_names[idx]][i]["TexCoord0Domain"]["Max"] = max_tc.getValue();
mdl[model_names[idx]][i]["TexCoord0"] = tc; mdl[model_names[idx]][i]["TexCoord0"] = tc;
} }
mdl[model_names[idx]][i]["TriangleList"] = indices; mdl[model_names[idx]][i]["TriangleList"] = indices;
if (skinning) if (skinning)

View File

@@ -32,10 +32,8 @@
#include "v4math.h" #include "v4math.h"
#include "m4math.h" #include "m4math.h"
#if MESH_IMPORT
class daeElement; class daeElement;
class domMesh; class domMesh;
#endif //MESH_IMPORT
#define MAX_MODEL_FACES 8 #define MAX_MODEL_FACES 8
@@ -147,10 +145,8 @@ public:
LLSD& mdl, LLSD& mdl,
BOOL nowrite = FALSE, BOOL as_slm = FALSE); BOOL nowrite = FALSE, BOOL as_slm = FALSE);
#if MESH_IMPORT
static LLModel* loadModelFromDomMesh(domMesh* mesh); static LLModel* loadModelFromDomMesh(domMesh* mesh);
static std::string getElementLabel(daeElement* element); static std::string getElementLabel(daeElement* element);
#endif //MESH_IMPORT
std::string getName() const; std::string getName() const;
std::string getMetric() const {return mMetric;} std::string getMetric() const {return mMetric;}
EModelStatus getStatus() const {return mStatus;} EModelStatus getStatus() const {return mStatus;}
@@ -278,10 +274,8 @@ public:
EModelStatus mStatus ; EModelStatus mStatus ;
protected: protected:
#if MESH_IMPORT
void addVolumeFacesFromDomMesh(domMesh* mesh); void addVolumeFacesFromDomMesh(domMesh* mesh);
virtual BOOL createVolumeFacesFromDomMesh(domMesh *mesh); virtual BOOL createVolumeFacesFromDomMesh(domMesh *mesh);
#endif //MESH_IMPORT
}; };
#endif //LL_LLMODEL_H #endif //LL_LLMODEL_H

View File

@@ -155,7 +155,8 @@ bool LLPrimitive::cleanupVolumeManager()
LLPrimitive::LLPrimitive() LLPrimitive::LLPrimitive()
: mTextureList(), : mTextureList(),
mNumTEs(0), mNumTEs(0),
mMiscFlags(0) mMiscFlags(0),
mNumBumpmapTEs(0)
{ {
mPrimitiveCode = 0; mPrimitiveCode = 0;
@@ -243,7 +244,10 @@ void LLPrimitive::setAllTETextures(const LLUUID &tex_id)
//=============================================================== //===============================================================
void LLPrimitive::setTE(const U8 index, const LLTextureEntry& te) void LLPrimitive::setTE(const U8 index, const LLTextureEntry& te)
{ {
mTextureList.copyTexture(index, te); if(mTextureList.copyTexture(index, te) != TEM_CHANGE_NONE && te.getBumpmap() > 0)
{
mNumBumpmapTEs++;
}
} }
S32 LLPrimitive::setTETexture(const U8 index, const LLUUID &id) S32 LLPrimitive::setTETexture(const U8 index, const LLUUID &id)
@@ -322,6 +326,7 @@ S32 LLPrimitive::setTERotation(const U8 index, const F32 r)
//=============================================================== //===============================================================
S32 LLPrimitive::setTEBumpShinyFullbright(const U8 index, const U8 bump) S32 LLPrimitive::setTEBumpShinyFullbright(const U8 index, const U8 bump)
{ {
updateNumBumpmap(index, bump);
return mTextureList.setBumpShinyFullbright(index, bump); return mTextureList.setBumpShinyFullbright(index, bump);
} }
@@ -332,11 +337,13 @@ S32 LLPrimitive::setTEMediaTexGen(const U8 index, const U8 media)
S32 LLPrimitive::setTEBumpmap(const U8 index, const U8 bump) S32 LLPrimitive::setTEBumpmap(const U8 index, const U8 bump)
{ {
updateNumBumpmap(index, bump);
return mTextureList.setBumpMap(index, bump); return mTextureList.setBumpMap(index, bump);
} }
S32 LLPrimitive::setTEBumpShiny(const U8 index, const U8 bump_shiny) S32 LLPrimitive::setTEBumpShiny(const U8 index, const U8 bump_shiny)
{ {
updateNumBumpmap(index, bump_shiny);
return mTextureList.setBumpShiny(index, bump_shiny); return mTextureList.setBumpShiny(index, bump_shiny);
} }
@@ -1451,6 +1458,26 @@ void LLPrimitive::takeTextureList(LLPrimTextureList& other_list)
mTextureList.take(other_list); mTextureList.take(other_list);
} }
void LLPrimitive::updateNumBumpmap(const U8 index, const U8 bump)
{
LLTextureEntry* te = getTE(index);
if(!te)
{
return;
}
U8 old_bump = te->getBumpmap();
if(old_bump > 0)
{
mNumBumpmapTEs--;
}
if((bump & TEM_BUMP_MASK) > 0)
{
mNumBumpmapTEs++;
}
return;
}
//============================================================================ //============================================================================
// Moved from llselectmgr.cpp // Moved from llselectmgr.cpp

View File

@@ -427,6 +427,7 @@ public:
inline BOOL isAvatar() const; inline BOOL isAvatar() const;
inline BOOL isSittingAvatar() const; inline BOOL isSittingAvatar() const;
inline BOOL isSittingAvatarOnGround() const; inline BOOL isSittingAvatarOnGround() const;
inline bool hasBumpmap() const { return mNumBumpmapTEs > 0;}
void setFlags(U32 flags) { mMiscFlags = flags; } void setFlags(U32 flags) { mMiscFlags = flags; }
void addFlags(U32 flags) { mMiscFlags |= flags; } void addFlags(U32 flags) { mMiscFlags |= flags; }
@@ -441,6 +442,9 @@ public:
inline static BOOL isPrimitive(const LLPCode pcode); inline static BOOL isPrimitive(const LLPCode pcode);
inline static BOOL isApp(const LLPCode pcode); inline static BOOL isApp(const LLPCode pcode);
private:
void updateNumBumpmap(const U8 index, const U8 bump);
protected: protected:
LLPCode mPrimitiveCode; // Primitive code LLPCode mPrimitiveCode; // Primitive code
LLVector3 mVelocity; // how fast are we moving? LLVector3 mVelocity; // how fast are we moving?
@@ -450,8 +454,10 @@ protected:
LLPrimTextureList mTextureList; // list of texture GUIDs, scales, offsets LLPrimTextureList mTextureList; // list of texture GUIDs, scales, offsets
U8 mMaterial; // Material code U8 mMaterial; // Material code
U8 mNumTEs; // # of faces on the primitve U8 mNumTEs; // # of faces on the primitve
U8 mNumBumpmapTEs; // number of bumpmap TEs.
U32 mMiscFlags; // home for misc bools U32 mMiscFlags; // home for misc bools
public:
static LLVolumeMgr* sVolumeManager; static LLVolumeMgr* sVolumeManager;
}; };

View File

@@ -27,8 +27,8 @@ include(LLImageJ2COJ)
include(LLInventory) include(LLInventory)
include(LLMath) include(LLMath)
include(LLMessage) include(LLMessage)
include(LLPhysicsExtensions)
include(LLPlugin) include(LLPlugin)
include(StateMachine)
include(LLPrimitive) include(LLPrimitive)
include(LLRender) include(LLRender)
include(LLUI) include(LLUI)
@@ -39,6 +39,7 @@ include(LLXML)
include(Linking) include(Linking)
include(NDOF) include(NDOF)
include(GooglePerfTools) include(GooglePerfTools)
include(StateMachine)
include(TemplateCheck) include(TemplateCheck)
include(UI) include(UI)
include(LLKDU) include(LLKDU)
@@ -63,6 +64,7 @@ include_directories(
${LLINVENTORY_INCLUDE_DIRS} ${LLINVENTORY_INCLUDE_DIRS}
${LLMATH_INCLUDE_DIRS} ${LLMATH_INCLUDE_DIRS}
${LLMESSAGE_INCLUDE_DIRS} ${LLMESSAGE_INCLUDE_DIRS}
${LLPHYSICSEXTENSIONS_INCLUDE_DIRS}
${LLPLUGIN_INCLUDE_DIRS} ${LLPLUGIN_INCLUDE_DIRS}
${LLPRIMITIVE_INCLUDE_DIRS} ${LLPRIMITIVE_INCLUDE_DIRS}
${LLRENDER_INCLUDE_DIRS} ${LLRENDER_INCLUDE_DIRS}
@@ -1586,6 +1588,7 @@ target_link_libraries(${VIEWER_BINARY_NAME}
${XMLRPCEPI_LIBRARIES} ${XMLRPCEPI_LIBRARIES}
${ELFIO_LIBRARIES} ${ELFIO_LIBRARIES}
${HUNSPELL_LIBRARY} ${HUNSPELL_LIBRARY}
${LLPHYSICSEXTENSIONS_LIBRARIES}
) )
if (LINUX) if (LINUX)

View File

@@ -65,6 +65,8 @@
#include "llinventorymodel.h" #include "llinventorymodel.h"
#include "llfoldertype.h" #include "llfoldertype.h"
#include "llviewerparcelmgr.h" #include "llviewerparcelmgr.h"
#include "llassetuploadresponders.h"
#include "lluploadfloaterobservers.h"
#include "aicurl.h" #include "aicurl.h"
#include "boost/lexical_cast.hpp" #include "boost/lexical_cast.hpp"
@@ -316,7 +318,6 @@ public:
virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return meshPhysicsShapeResponder_timeout; } virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return meshPhysicsShapeResponder_timeout; }
}; };
#if MESH_IMPORT
void log_upload_error(S32 status, const LLSD& content, std::string stage, std::string model_name) void log_upload_error(S32 status, const LLSD& content, std::string stage, std::string model_name)
{ {
// Add notification popup. // Add notification popup.
@@ -377,7 +378,20 @@ public:
mModelData(model_data), mModelData(model_data),
mObserverHandle(observer_handle) mObserverHandle(observer_handle)
{ {
if (mThread)
{
mThread->startRequest();
} }
}
~LLWholeModelFeeResponder()
{
if (mThread)
{
mThread->stopRequest();
}
}
virtual void completed(U32 status, virtual void completed(U32 status,
const std::string& reason, const std::string& reason,
const LLSD& content) const LLSD& content)
@@ -388,12 +402,11 @@ public:
cc = llsd_from_file("fake_upload_error.xml"); cc = llsd_from_file("fake_upload_error.xml");
} }
mThread->mPendingUploads--;
dump_llsd_to_file(cc,make_dump_name("whole_model_fee_response_",dump_num)); dump_llsd_to_file(cc,make_dump_name("whole_model_fee_response_",dump_num));
LLWholeModelFeeObserver* observer = mObserverHandle.get(); LLWholeModelFeeObserver* observer = mObserverHandle.get();
if (isGoodStatus(status) && if (((200 <= status) && (status < 300)) &&
cc["state"].asString() == "upload") cc["state"].asString() == "upload")
{ {
mThread->mWholeModelUploadURL = cc["uploader"].asString(); mThread->mWholeModelUploadURL = cc["uploader"].asString();
@@ -432,7 +445,20 @@ public:
mModelData(model_data), mModelData(model_data),
mObserverHandle(observer_handle) mObserverHandle(observer_handle)
{ {
if (mThread)
{
mThread->startRequest();
} }
}
~LLWholeModelUploadResponder()
{
if (mThread)
{
mThread->stopRequest();
}
}
virtual void completed(U32 status, virtual void completed(U32 status,
const std::string& reason, const std::string& reason,
const LLSD& content) const LLSD& content)
@@ -443,15 +469,13 @@ public:
cc = llsd_from_file("fake_upload_error.xml"); 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)); dump_llsd_to_file(cc,make_dump_name("whole_model_upload_response_",dump_num));
LLWholeModelUploadObserver* observer = mObserverHandle.get(); LLWholeModelUploadObserver* observer = mObserverHandle.get();
// requested "mesh" asset type isn't actually the type // requested "mesh" asset type isn't actually the type
// of the resultant object, fix it up here. // of the resultant object, fix it up here.
if (isGoodStatus(status) && if (((200 <= status) && (status < 300)) &&
cc["state"].asString() == "complete") cc["state"].asString() == "complete")
{ {
mModelData["asset_type"] = "object"; mModelData["asset_type"] = "object";
@@ -477,7 +501,6 @@ public:
virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return wholeModelUploadResponder_timeout; } virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return wholeModelUploadResponder_timeout; }
}; };
#endif //MESH_IMPORT
LLMeshRepoThread::LLMeshRepoThread() LLMeshRepoThread::LLMeshRepoThread()
: LLThread("mesh repo") : LLThread("mesh repo")
@@ -499,18 +522,15 @@ LLMeshRepoThread::~LLMeshRepoThread()
void LLMeshRepoThread::run() void LLMeshRepoThread::run()
{ {
#if MESH_IMPORT
LLCDResult res = LLConvexDecomposition::initThread(); LLCDResult res = LLConvexDecomposition::initThread();
if (res != LLCD_OK) if (res != LLCD_OK)
{ {
llwarns << "convex decomposition unable to be loaded" << llendl; llwarns << "convex decomposition unable to be loaded" << llendl;
} }
#endif //MESH_IMPORT
mSignal->lock(); mSignal->lock();
while (!LLApp::isQuitting()) while (!LLApp::isQuitting())
{ {
// Left braces in order not to change the indentation.
{ {
static U32 count = 0; static U32 count = 0;
@@ -646,13 +666,12 @@ void LLMeshRepoThread::run()
} }
mSignal->unlock(); mSignal->unlock();
#if MESH_IMPORT
res = LLConvexDecomposition::quitThread(); res = LLConvexDecomposition::quitThread();
if (res != LLCD_OK) if (res != LLCD_OK)
{ {
llwarns << "convex decomposition unable to be quit" << llendl; llwarns << "convex decomposition unable to be quit" << llendl;
} }
#endif //MESH_IMPORT
} }
void LLMeshRepoThread::loadMeshSkinInfo(const LLUUID& mesh_id) void LLMeshRepoThread::loadMeshSkinInfo(const LLUUID& mesh_id)
@@ -1111,13 +1130,12 @@ bool LLMeshRepoThread::headerReceived(const LLVolumeParams& mesh_params, U8* dat
} }
LLMutexLock lock(mMutex); // <FS:ND/> FIRE-7182, make sure only one thread access mPendingLOD at the same time. LLMutexLock lock(mMutex); // make sure only one thread access mPendingLOD at the same time.
//check for pending requests //check for pending requests
pending_lod_map::iterator iter = mPendingLOD.find(mesh_params); pending_lod_map::iterator iter = mPendingLOD.find(mesh_params);
if (iter != mPendingLOD.end()) if (iter != mPendingLOD.end())
{ {
// LLMutexLock lock(mMutex); <FS:ND/> FIRE-7182, lock was moved up, before calling mPendingLOD.find
for (U32 i = 0; i < iter->second.size(); ++i) for (U32 i = 0; i < iter->second.size(); ++i)
{ {
LODRequest req(mesh_params, iter->second[i]); LODRequest req(mesh_params, iter->second[i]);
@@ -1266,7 +1284,6 @@ bool LLMeshRepoThread::physicsShapeReceived(const LLUUID& mesh_id, U8* data, S32
return true; return true;
} }
#if MESH_IMPORT
LLMeshUploadThread::LLMeshUploadThread(LLMeshUploadThread::instance_list& data, LLVector3& scale, bool upload_textures, LLMeshUploadThread::LLMeshUploadThread(LLMeshUploadThread::instance_list& data, LLVector3& scale, bool upload_textures,
bool upload_skin, bool upload_joints, std::string upload_url, bool do_upload, bool upload_skin, bool upload_joints, std::string upload_url, bool do_upload,
LLHandle<LLWholeModelFeeObserver> fee_observer, LLHandle<LLWholeModelUploadObserver> upload_observer) LLHandle<LLWholeModelFeeObserver> fee_observer, LLHandle<LLWholeModelUploadObserver> upload_observer)
@@ -1358,7 +1375,6 @@ void LLMeshUploadThread::run()
requestWholeModelFee(); requestWholeModelFee();
} }
} }
#endif //MESH_IMPORT
void dump_llsd_to_file(const LLSD& content, std::string filename) void dump_llsd_to_file(const LLSD& content, std::string filename)
{ {
@@ -1377,7 +1393,6 @@ LLSD llsd_from_file(std::string filename)
return result; return result;
} }
#if MESH_IMPORT
void LLMeshUploadThread::wholeModelToLLSD(LLSD& dest, bool include_textures) void LLMeshUploadThread::wholeModelToLLSD(LLSD& dest, bool include_textures)
{ {
LLSD result; LLSD result;
@@ -1635,12 +1650,10 @@ void LLMeshUploadThread::requestWholeModelFee()
wholeModelToLLSD(model_data,false); wholeModelToLLSD(model_data,false);
dump_llsd_to_file(model_data,make_dump_name("whole_model_fee_request_",dump_num)); dump_llsd_to_file(model_data,make_dump_name("whole_model_fee_request_",dump_num));
mPendingUploads++;
// This might throw AICurlNoEasyHandle. // This might throw AICurlNoEasyHandle.
LLHTTPClient::post(mWholeModelFeeCapability, model_data, LLHTTPClient::post(mWholeModelFeeCapability, model_data,
new LLWholeModelFeeResponder(this, model_data, mFeeObserverHandle)); new LLWholeModelFeeResponder(this, model_data, mFeeObserverHandle));
} }
#endif //MESH_IMPORT
void LLMeshRepoThread::notifyLoadedMeshes() void LLMeshRepoThread::notifyLoadedMeshes()
{//called via gMeshRepo.notifyLoadedMeshes(). mMutex already locked {//called via gMeshRepo.notifyLoadedMeshes(). mMutex already locked
@@ -1740,7 +1753,6 @@ S32 LLMeshRepository::getActualMeshLOD(LLSD& header, S32 lod)
return -1; return -1;
} }
#if MESH_IMPORT
void LLMeshRepository::cacheOutgoingMesh(LLMeshUploadData& data, LLSD& header) void LLMeshRepository::cacheOutgoingMesh(LLMeshUploadData& data, LLSD& header)
{ {
mThread->mMeshHeader[data.mUUID] = header; mThread->mMeshHeader[data.mUUID] = header;
@@ -1761,7 +1773,6 @@ void LLMeshRepository::cacheOutgoingMesh(LLMeshUploadData& data, LLSD& header)
} }
} }
#endif //MESH_IMPORT
void LLMeshLODResponder::completedRaw(U32 status, const std::string& reason, void LLMeshLODResponder::completedRaw(U32 status, const std::string& reason,
const LLChannelDescriptors& channels, const LLChannelDescriptors& channels,
@@ -2099,9 +2110,7 @@ void LLMeshRepository::init()
{ {
mMeshMutex = new LLMutex(); mMeshMutex = new LLMutex();
#if MESH_IMPORT
LLConvexDecomposition::getInstance()->initSystem(); LLConvexDecomposition::getInstance()->initSystem();
#endif //MESH_IMPORT
mDecompThread = new LLPhysicsDecomp(); mDecompThread = new LLPhysicsDecomp();
mDecompThread->start(); mDecompThread->start();
@@ -2121,13 +2130,11 @@ void LLMeshRepository::shutdown()
{ {
llinfos << "Shutting down mesh repository." << llendl; llinfos << "Shutting down mesh repository." << llendl;
#if MESH_IMPORT
for (U32 i = 0; i < mUploads.size(); ++i) for (U32 i = 0; i < mUploads.size(); ++i)
{ {
llinfos << "Discard the pending mesh uploads " << llendl; llinfos << "Discard the pending mesh uploads " << llendl;
mUploads[i]->discard() ; //discard the uploading requests. mUploads[i]->discard() ; //discard the uploading requests.
} }
#endif //MESH_IMPORT
mThread->mSignal->signal(); mThread->mSignal->signal();
@@ -2138,7 +2145,6 @@ void LLMeshRepository::shutdown()
delete mThread; delete mThread;
mThread = NULL; mThread = NULL;
#if MESH_IMPORT
for (U32 i = 0; i < mUploads.size(); ++i) for (U32 i = 0; i < mUploads.size(); ++i)
{ {
llinfos << "Waiting for pending mesh upload " << i << "/" << mUploads.size() << llendl; llinfos << "Waiting for pending mesh upload " << i << "/" << mUploads.size() << llendl;
@@ -2150,7 +2156,6 @@ void LLMeshRepository::shutdown()
} }
mUploads.clear(); mUploads.clear();
#endif //MESH_IMPORT
delete mMeshMutex; delete mMeshMutex;
mMeshMutex = NULL; mMeshMutex = NULL;
@@ -2164,16 +2169,13 @@ void LLMeshRepository::shutdown()
mDecompThread = NULL; mDecompThread = NULL;
} }
#if MESH_IMPORT
LLConvexDecomposition::quitSystem(); LLConvexDecomposition::quitSystem();
#endif //MESH_IMPORT
} }
//called in the main thread. //called in the main thread.
S32 LLMeshRepository::update() S32 LLMeshRepository::update()
{ {
S32 size = 0; S32 size = 0;
#if MESH_IMPORT
if(mUploadWaitList.empty()) if(mUploadWaitList.empty())
{ {
return 0 ; return 0 ;
@@ -2187,7 +2189,7 @@ S32 LLMeshRepository::update()
mUploadWaitList[i]->start() ; mUploadWaitList[i]->start() ;
} }
mUploadWaitList.clear() ; mUploadWaitList.clear() ;
#endif //MESH_IMPORT
return size ; return size ;
} }
@@ -2274,13 +2276,12 @@ void LLMeshRepository::notifyLoadedMeshes()
static const LLCachedControl<U32> max_concurrent_requests("MeshMaxConcurrentRequests"); static const LLCachedControl<U32> max_concurrent_requests("MeshMaxConcurrentRequests");
LLMeshRepoThread::sMaxConcurrentRequests = max_concurrent_requests; LLMeshRepoThread::sMaxConcurrentRequests = max_concurrent_requests;
#if MESH_IMPORT
//clean up completed upload threads //clean up completed upload threads
for (std::vector<LLMeshUploadThread*>::iterator iter = mUploads.begin(); iter != mUploads.end(); ) for (std::vector<LLMeshUploadThread*>::iterator iter = mUploads.begin(); iter != mUploads.end(); )
{ {
LLMeshUploadThread* thread = *iter; LLMeshUploadThread* thread = *iter;
if (thread->isStopped() && thread->finished()) if (thread->isStopped())
{ {
iter = mUploads.erase(iter); iter = mUploads.erase(iter);
delete thread; delete thread;
@@ -2347,7 +2348,7 @@ void LLMeshRepository::notifyLoadedMeshes()
mInventoryQ.pop(); mInventoryQ.pop();
} }
#endif //MESH_IMPORT }
//call completed callbacks on finished decompositions //call completed callbacks on finished decompositions
mDecompThread->notifyCompleted(); mDecompThread->notifyCompleted();
@@ -2710,7 +2711,7 @@ LLSD& LLMeshRepoThread::getMeshHeader(const LLUUID& mesh_id)
return dummy_ret; return dummy_ret;
} }
#if MESH_IMPORT
void LLMeshRepository::uploadModel(std::vector<LLModelInstance>& data, LLVector3& scale, bool upload_textures, void LLMeshRepository::uploadModel(std::vector<LLModelInstance>& data, LLVector3& scale, bool upload_textures,
bool upload_skin, bool upload_joints, std::string upload_url, bool do_upload, bool upload_skin, bool upload_joints, std::string upload_url, bool do_upload,
LLHandle<LLWholeModelFeeObserver> fee_observer, LLHandle<LLWholeModelUploadObserver> upload_observer) LLHandle<LLWholeModelFeeObserver> fee_observer, LLHandle<LLWholeModelUploadObserver> upload_observer)
@@ -2719,7 +2720,6 @@ void LLMeshRepository::uploadModel(std::vector<LLModelInstance>& data, LLVector3
do_upload, fee_observer, upload_observer); do_upload, fee_observer, upload_observer);
mUploadWaitList.push_back(thread); mUploadWaitList.push_back(thread);
} }
#endif //MESH_IMPORT
S32 LLMeshRepository::getMeshSize(const LLUUID& mesh_id, S32 lod) S32 LLMeshRepository::getMeshSize(const LLUUID& mesh_id, S32 lod)
{ {
@@ -2745,8 +2745,6 @@ S32 LLMeshRepository::getMeshSize(const LLUUID& mesh_id, S32 lod)
} }
#if MESH_IMPORT
void LLMeshUploadThread::decomposeMeshMatrix(LLMatrix4& transformation, void LLMeshUploadThread::decomposeMeshMatrix(LLMatrix4& transformation,
LLVector3& result_pos, LLVector3& result_pos,
LLQuaternion& result_rot, LLQuaternion& result_rot,
@@ -2787,8 +2785,6 @@ void LLMeshUploadThread::decomposeMeshMatrix(LLMatrix4& transformation,
result_rot = quat_rotation; result_rot = quat_rotation;
} }
#endif //MESH_IMPORT
bool LLImportMaterial::operator<(const LLImportMaterial &rhs) const bool LLImportMaterial::operator<(const LLImportMaterial &rhs) const
{ {
if (mDiffuseMap != rhs.mDiffuseMap) if (mDiffuseMap != rhs.mDiffuseMap)
@@ -2991,8 +2987,41 @@ S32 LLPhysicsDecomp::llcdCallback(const char* status, S32 p1, S32 p2)
return 1; return 1;
} }
bool needTriangles( LLConvexDecomposition *aDC )
{
if( !aDC )
return false;
LLCDParam const *pParams(0);
int nParams = aDC->getParameters( &pParams );
if( nParams <= 0 )
return false;
for( int i = 0; i < nParams; ++i )
{
if( pParams[i].mName && strcmp( "nd_AlwaysNeedTriangles", pParams[i].mName ) == 0 )
{
if( LLCDParam::LLCD_BOOLEAN == pParams[i].mType && pParams[i].mDefault.mBool )
return true;
else
return false;
}
}
return false;
}
void LLPhysicsDecomp::setMeshData(LLCDMeshData& mesh, bool vertex_based) void LLPhysicsDecomp::setMeshData(LLCDMeshData& mesh, bool vertex_based)
{ {
LLConvexDecomposition *pDeComp = LLConvexDecomposition::getInstance();
if( !pDeComp )
return;
if( vertex_based )
vertex_based = !needTriangles( pDeComp );
mesh.mVertexBase = mCurRequest->mPositions[0].mV; mesh.mVertexBase = mCurRequest->mPositions[0].mV;
mesh.mVertexStrideBytes = 12; mesh.mVertexStrideBytes = 12;
mesh.mNumVertices = mCurRequest->mPositions.size(); mesh.mNumVertices = mCurRequest->mPositions.size();
@@ -3006,26 +3035,20 @@ void LLPhysicsDecomp::setMeshData(LLCDMeshData& mesh, bool vertex_based)
mesh.mNumTriangles = mCurRequest->mIndices.size()/3; mesh.mNumTriangles = mCurRequest->mIndices.size()/3;
} }
#if MESH_IMPORT
if ((vertex_based || mesh.mNumTriangles > 0) && mesh.mNumVertices > 2) if ((vertex_based || mesh.mNumTriangles > 0) && mesh.mNumVertices > 2)
{ {
LLCDResult ret = LLCD_OK; LLCDResult ret = LLCD_OK;
if (LLConvexDecomposition::getInstance() != NULL)
{
ret = LLConvexDecomposition::getInstance()->setMeshData(&mesh, vertex_based); ret = LLConvexDecomposition::getInstance()->setMeshData(&mesh, vertex_based);
}
if (ret) if (ret)
{ {
llerrs << "Convex Decomposition thread valid but could not set mesh data" << llendl; llerrs << "Convex Decomposition thread valid but could not set mesh data" << llendl;
} }
} }
#endif //MESH_IMPORT
} }
void LLPhysicsDecomp::doDecomposition() void LLPhysicsDecomp::doDecomposition()
{ {
#if MESH_IMPORT
LLCDMeshData mesh; LLCDMeshData mesh;
S32 stage = mStageID[mCurRequest->mStage]; S32 stage = mStageID[mCurRequest->mStage];
@@ -3160,7 +3183,6 @@ void LLPhysicsDecomp::doDecomposition()
completeCurrent(); completeCurrent();
} }
} }
#endif //MESH_IMPORT
} }
void LLPhysicsDecomp::completeCurrent() void LLPhysicsDecomp::completeCurrent()
@@ -3214,10 +3236,6 @@ void make_box(LLPhysicsDecomp::Request * request)
void LLPhysicsDecomp::doDecompositionSingleHull() void LLPhysicsDecomp::doDecompositionSingleHull()
{ {
#if !MESH_IMPORT
return;
#endif //!MESH_IMPORT
#if MESH_IMPORT
LLConvexDecomposition* decomp = LLConvexDecomposition::getInstance(); LLConvexDecomposition* decomp = LLConvexDecomposition::getInstance();
if (decomp == NULL) if (decomp == NULL)
@@ -3238,11 +3256,12 @@ void LLPhysicsDecomp::doDecompositionSingleHull()
} }
else else
{ {
mMutex->lock(); {
LLMutexLock lock(mMutex);
mCurRequest->mHull.clear(); mCurRequest->mHull.clear();
mCurRequest->mHull.resize(1); mCurRequest->mHull.resize(1);
mCurRequest->mHullMesh.clear(); mCurRequest->mHullMesh.clear();
mMutex->unlock(); }
std::vector<LLVector3> p; std::vector<LLVector3> p;
LLCDHull hull; LLCDHull hull;
@@ -3259,25 +3278,72 @@ void LLPhysicsDecomp::doDecompositionSingleHull()
v = (F32*) (((U8*) v) + hull.mVertexStrideBytes); v = (F32*) (((U8*) v) + hull.mVertexStrideBytes);
} }
mMutex->lock(); {
LLMutexLock lock(mMutex);
mCurRequest->mHull[0] = p; mCurRequest->mHull[0] = p;
mMutex->unlock(); }
} }
{ {
completeCurrent(); completeCurrent();
} }
#endif //MESH_IMPORT
} }
#ifdef ND_HASCONVEXDECOMP_TRACER
class ndDecompTracer: public ndConvexDecompositionTracer
{
int mRefCount;
public:
ndDecompTracer()
: mRefCount(0)
{
}
virtual void trace( char const *a_strMsg )
{
llinfos << a_strMsg << llendl;
}
virtual void startTraceData( char const *a_strWhat)
{
llinfos << a_strWhat << llendl;
}
virtual void traceData( char const *a_strData )
{
llinfos << a_strData << llendl;
}
virtual void endTraceData()
{
}
virtual int getLevel()
{
return eTraceFunctions;// | eTraceData;
}
virtual void addref()
{
++mRefCount;
}
virtual void release()
{
--mRefCount;
if( mRefCount == 0 )
delete this;
}
};
#endif
void LLPhysicsDecomp::run() void LLPhysicsDecomp::run()
{ {
#if !MESH_IMPORT
mInited = true;
#endif //!MESH_IMPORT
#if MESH_IMPORT
LLConvexDecomposition* decomp = LLConvexDecomposition::getInstance(); LLConvexDecomposition* decomp = LLConvexDecomposition::getInstance();
if (decomp == NULL) if (decomp == NULL)
{ {
@@ -3287,6 +3353,13 @@ void LLPhysicsDecomp::run()
return; return;
} }
#ifdef ND_HASCONVEXDECOMP_TRACER
ndConvexDecompositionTracable *pTraceable = dynamic_cast< ndConvexDecompositionTracable* >( decomp );
if( pTraceable )
pTraceable->setTracer( new ndDecompTracer() );
#endif
decomp->initThread(); decomp->initThread();
mInited = true; mInited = true;
@@ -3304,6 +3377,7 @@ void LLPhysicsDecomp::run()
} }
mSignal->lock(); mSignal->lock();
while (!mQuitting) while (!mQuitting)
{ {
mSignal->wait(); mSignal->wait();
@@ -3332,14 +3406,14 @@ void LLPhysicsDecomp::run()
} }
} }
} }
mSignal->unlock(); mSignal->unlock();
decomp->quitThread(); decomp->quitThread();
mDone = true;
#endif //MESH_IMPORT
}
mDone = true;
}
void LLPhysicsDecomp::Request::assignData(LLModel* mdl) void LLPhysicsDecomp::Request::assignData(LLModel* mdl)
{ {
@@ -3486,7 +3560,6 @@ void LLMeshRepository::buildPhysicsMesh(LLModel::Decomposition& decomp)
hull.mVertexBase = decomp.mHull[i][0].mV; hull.mVertexBase = decomp.mHull[i][0].mV;
hull.mVertexStrideBytes = 12; hull.mVertexStrideBytes = 12;
#if MESH_IMPORT
LLCDMeshData mesh; LLCDMeshData mesh;
LLCDResult res = LLCD_OK; LLCDResult res = LLCD_OK;
if (LLConvexDecomposition::getInstance() != NULL) if (LLConvexDecomposition::getInstance() != NULL)
@@ -3497,7 +3570,6 @@ void LLMeshRepository::buildPhysicsMesh(LLModel::Decomposition& decomp)
{ {
get_vertex_buffer_from_mesh(mesh, decomp.mMesh[i]); get_vertex_buffer_from_mesh(mesh, decomp.mMesh[i]);
} }
#endif //MESH_IMPORT
} }
if (!decomp.mBaseHull.empty() && decomp.mBaseHullMesh.empty()) if (!decomp.mBaseHull.empty() && decomp.mBaseHullMesh.empty())
@@ -3507,7 +3579,6 @@ void LLMeshRepository::buildPhysicsMesh(LLModel::Decomposition& decomp)
hull.mVertexBase = decomp.mBaseHull[0].mV; hull.mVertexBase = decomp.mBaseHull[0].mV;
hull.mVertexStrideBytes = 12; hull.mVertexStrideBytes = 12;
#if MESH_IMPORT
LLCDMeshData mesh; LLCDMeshData mesh;
LLCDResult res = LLCD_OK; LLCDResult res = LLCD_OK;
if (LLConvexDecomposition::getInstance() != NULL) if (LLConvexDecomposition::getInstance() != NULL)
@@ -3518,7 +3589,6 @@ void LLMeshRepository::buildPhysicsMesh(LLModel::Decomposition& decomp)
{ {
get_vertex_buffer_from_mesh(mesh, decomp.mBaseHullMesh); get_vertex_buffer_from_mesh(mesh, decomp.mBaseHullMesh);
} }
#endif //MESH_IMPORT
} }
} }

View File

@@ -33,37 +33,10 @@
#include "llviewertexture.h" #include "llviewertexture.h"
#include "llvolume.h" #include "llvolume.h"
#if MESH_IMPORT
#define LLCONVEXDECOMPINTER_STATIC 1 #define LLCONVEXDECOMPINTER_STATIC 1
#include "llconvexdecomposition.h" #include "llconvexdecomposition.h"
#endif //MESH_IMPORT #include "lluploadfloaterobservers.h"
#if !MESH_IMPORT
//Placeholder structs from LLConvexDecomposition.h:
struct LLCDMeshData
{
enum IndexType
{
INT_16,
INT_32
};
const float* mVertexBase;
int mVertexStrideBytes;
int mNumVertices;
const void* mIndexBase;
IndexType mIndexType;
int mIndexStrideBytes;
int mNumTriangles;
};
struct LLCDHull
{
const float* mVertexBase;
int mVertexStrideBytes;
int mNumVertices;
};
#endif //!MESH_IMPORT
class LLVOVolume; class LLVOVolume;
class LLMeshResponder; class LLMeshResponder;
@@ -377,7 +350,6 @@ public:
}; };
#if MESH_IMPORT
class LLMeshUploadThread : public LLThread class LLMeshUploadThread : public LLThread
{ {
private: private:
@@ -427,6 +399,9 @@ public:
LLHandle<LLWholeModelFeeObserver> fee_observer= (LLHandle<LLWholeModelFeeObserver>()), LLHandle<LLWholeModelUploadObserver> upload_observer = (LLHandle<LLWholeModelUploadObserver>())); LLHandle<LLWholeModelFeeObserver> fee_observer= (LLHandle<LLWholeModelFeeObserver>()), LLHandle<LLWholeModelUploadObserver> upload_observer = (LLHandle<LLWholeModelUploadObserver>()));
~LLMeshUploadThread(); ~LLMeshUploadThread();
void startRequest() { ++mPendingUploads; }
void stopRequest() { --mPendingUploads; }
virtual void run(); virtual void run();
void preStart(); void preStart();
void discard() ; void discard() ;
@@ -453,7 +428,6 @@ private:
bool mDoUpload; // if FALSE only model data will be requested, otherwise the model will be uploaded bool mDoUpload; // if FALSE only model data will be requested, otherwise the model will be uploaded
}; };
#endif //MESH_IMPORT
class LLMeshRepository class LLMeshRepository
{ {
@@ -502,11 +476,9 @@ public:
LLSD& getMeshHeader(const LLUUID& mesh_id); LLSD& getMeshHeader(const LLUUID& mesh_id);
#if MESH_IMPORT
void uploadModel(std::vector<LLModelInstance>& data, LLVector3& scale, bool upload_textures, void uploadModel(std::vector<LLModelInstance>& data, LLVector3& scale, bool upload_textures,
bool upload_skin, bool upload_joints, std::string upload_url, bool do_upload = true, bool upload_skin, bool upload_joints, std::string upload_url, bool do_upload = true,
LLHandle<LLWholeModelFeeObserver> fee_observer= (LLHandle<LLWholeModelFeeObserver>()), LLHandle<LLWholeModelUploadObserver> upload_observer = (LLHandle<LLWholeModelUploadObserver>())); LLHandle<LLWholeModelFeeObserver> fee_observer= (LLHandle<LLWholeModelFeeObserver>()), LLHandle<LLWholeModelUploadObserver> upload_observer = (LLHandle<LLWholeModelUploadObserver>()));
#endif //MESH_IMPORT
S32 getMeshSize(const LLUUID& mesh_id, S32 lod); S32 getMeshSize(const LLUUID& mesh_id, S32 lod);
@@ -544,15 +516,11 @@ public:
U32 mMeshThreadCount; U32 mMeshThreadCount;
#if MESH_IMPORT
void cacheOutgoingMesh(LLMeshUploadData& data, LLSD& header); void cacheOutgoingMesh(LLMeshUploadData& data, LLSD& header);
#endif //MESH_IMPORT
LLMeshRepoThread* mThread; LLMeshRepoThread* mThread;
#if MESH_IMPORT
std::vector<LLMeshUploadThread*> mUploads; std::vector<LLMeshUploadThread*> mUploads;
std::vector<LLMeshUploadThread*> mUploadWaitList; std::vector<LLMeshUploadThread*> mUploadWaitList;
#endif //MESH_IMPORT
LLPhysicsDecomp* mDecompThread; LLPhysicsDecomp* mDecompThread;

View File

@@ -802,11 +802,14 @@ class Linux_i686Manifest(LinuxManifest):
self.path("libSDL-1.2.so*") self.path("libSDL-1.2.so*")
self.path("libapr-1.so*") self.path("libapr-1.so*")
self.path("libaprutil-1.so*") self.path("libaprutil-1.so*")
self.path("libcollada14dom.so")
self.path("libcrypto.so*") self.path("libcrypto.so*")
self.path("libdb*.so") self.path("libdb*.so")
self.path("libdirect-1.*.so*") self.path("libdirect-1.*.so*")
self.path("libdirectfb-1.*.so*") self.path("libdirectfb-1.*.so*")
self.path("libfusion-1.*.so*") self.path("libfusion-1.*.so*")
self.path("libglod.so")
self.path("libminizip.so")
self.path("libexpat.so*") self.path("libexpat.so*")
self.path("libhunspell-*.so.*") self.path("libhunspell-*.so.*")
self.path("libssl.so*") self.path("libssl.so*")

View File

@@ -932,6 +932,23 @@
</map> </map>
</map> </map>
</map> </map>
<key>ndPhysicsStub</key>
<map>
<key>description</key>
<string>llphysicsextension_stub modified with hacd by NickyD</string>
<key>license</key>
<string>lgpl</string>
<key>packages</key>
<map>
<key>linux</key>
<map>
<key>md5sum</key>
<string>017e37250d49686a11db0b88d6633404</string>
<key>url</key>
<uri>https://bitbucket.org/LightDrake/singularitylibraries/downloads/ndPhysicsStub-r65-linux32-singu.tar.bz2</uri>
</map>
</map>
</map>
<key>ogg-vorbis</key> <key>ogg-vorbis</key>
<map> <map>
<key>copyright</key> <key>copyright</key>