diff options
author | Nyx (Neal Orman) <nyx@lindenlab.com> | 2011-07-26 15:51:44 -0400 |
---|---|---|
committer | Nyx (Neal Orman) <nyx@lindenlab.com> | 2011-07-26 15:51:44 -0400 |
commit | 60d15f78e17a2203d73d58c3f1c2af941d599277 (patch) | |
tree | 58da32e9df5e9727e437efa90e98a0d4d2a3b0e9 /indra/newview/llmeshrepository.h | |
parent | 85b316e5df41444eafe77964f1a4758ccfd40784 (diff) | |
parent | f79a058f3ce50361b732061ab30f4a1923fba445 (diff) |
merge with latest mesh-dev
Diffstat (limited to 'indra/newview/llmeshrepository.h')
-rw-r--r-- | indra/newview/llmeshrepository.h | 90 |
1 files changed, 47 insertions, 43 deletions
diff --git a/indra/newview/llmeshrepository.h b/indra/newview/llmeshrepository.h index 802e3e1aba..35a7314cd5 100644 --- a/indra/newview/llmeshrepository.h +++ b/indra/newview/llmeshrepository.h @@ -36,6 +36,7 @@ #define LLCONVEXDECOMPINTER_STATIC 1 #include "llconvexdecomposition.h" +#include "lluploadfloaterobservers.h" class LLVOVolume; class LLMeshResponder; @@ -91,6 +92,7 @@ public: LLPointer<LLViewerFetchedTexture> mDiffuseMap; std::string mDiffuseMapFilename; std::string mDiffuseMapLabel; + std::string mBinding; LLColor4 mDiffuseColor; bool mFullbright; @@ -119,9 +121,9 @@ public: S32 mLocalMeshID; LLMatrix4 mTransform; - std::vector<LLImportMaterial> mMaterial; + std::map<std::string, LLImportMaterial> mMaterial; - LLModelInstance(LLModel* model, const std::string& label, LLMatrix4& transform, std::vector<LLImportMaterial>& materials) + LLModelInstance(LLModel* model, const std::string& label, LLMatrix4& transform, std::map<std::string, LLImportMaterial>& materials) : mModel(model), mLabel(label), mTransform(transform), mMaterial(materials) { mLocalMeshID = -1; @@ -152,7 +154,7 @@ public: std::string mStatusMessage; std::vector<LLModel::PhysicsMesh> mHullMesh; LLModel::convex_hull_decomposition mHull; - + //status message callback, called from decomposition thread virtual S32 statusCallback(const char* status, S32 p1, S32 p2) = 0; @@ -160,6 +162,17 @@ public: virtual void completed() = 0; virtual void setStatusMessage(const std::string& msg); + + bool isValid() const {return mPositions.size() > 2 && mIndices.size() > 2 ;} + + protected: + //internal use + LLVector3 mBBox[2] ; + F32 mTriangleAreaThreshold ; + + void assignData(LLModel* mdl) ; + void updateTriangleAreaThreshold() ; + bool isValidTriangle(U16 idx1, U16 idx2, U16 idx3) ; }; LLCondition* mSignal; @@ -178,7 +191,7 @@ public: static S32 llcdCallback(const char*, S32, S32); void cancel(); - void setMeshData(LLCDMeshData& mesh); + void setMeshData(LLCDMeshData& mesh, bool vertex_based); void doDecomposition(); void doDecompositionSingleHull(); @@ -218,8 +231,7 @@ public: mesh_header_map mMeshHeader; std::map<LLUUID, U32> mMeshHeaderSize; - std::map<LLUUID, U32> mMeshResourceCost; - + class HeaderRequest { public: @@ -322,8 +334,7 @@ public: void notifyLoadedMeshes(); S32 getActualMeshLOD(const LLVolumeParams& mesh_params, S32 lod); - U32 getResourceCost(const LLUUID& mesh_params); - + void loadMeshSkinInfo(const LLUUID& mesh_id); void loadMeshDecomposition(const LLUUID& mesh_id); void loadMeshPhysicsShape(const LLUUID& mesh_id); @@ -345,6 +356,9 @@ public: class LLMeshUploadThread : public LLThread { +private: + S32 mMeshUploadTimeOut ; //maximum time in seconds to execute an uploading request. + public: class DecompRequest : public LLPhysicsDecomp::Request { @@ -374,9 +388,7 @@ public: LLMutex* mMutex; LLCurlRequest* mCurlRequest; - S32 mPendingConfirmations; S32 mPendingUploads; - S32 mPendingCost; LLVector3 mOrigin; bool mFinished; bool mUploadTextures; @@ -385,45 +397,24 @@ public: BOOL mDiscarded ; LLHost mHost; - std::string mUploadObjectAssetCapability; - std::string mNewInventoryCapability; - std::string mWholeModelUploadCapability; - - std::queue<LLMeshUploadData> mUploadQ; - std::queue<LLMeshUploadData> mConfirmedQ; - std::queue<LLModelInstance> mInstanceQ; - - std::queue<LLTextureUploadData> mTextureQ; - std::queue<LLTextureUploadData> mConfirmedTextureQ; - - std::map<LLViewerFetchedTexture*, LLTextureUploadData> mTextureMap; + std::string mWholeModelFeeCapability; + std::string mWholeModelUploadURL; LLMeshUploadThread(instance_list& data, LLVector3& scale, bool upload_textures, - bool upload_skin, bool upload_joints); + 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>())); ~LLMeshUploadThread(); - void uploadTexture(LLTextureUploadData& data); - void doUploadTexture(LLTextureUploadData& data); - void sendCostRequest(LLTextureUploadData& data); - void priceResult(LLTextureUploadData& data, const LLSD& content); - void onTextureUploaded(LLTextureUploadData& data); - - void uploadModel(LLMeshUploadData& data); - void sendCostRequest(LLMeshUploadData& data); - void doUploadModel(LLMeshUploadData& data); - void onModelUploaded(LLMeshUploadData& data); - void createObjects(LLMeshUploadData& data); - LLSD createObject(LLModelInstance& instance); - void priceResult(LLMeshUploadData& data, const LLSD& content); - bool finished() { return mFinished; } virtual void run(); void preStart(); void discard() ; BOOL isDiscarded(); + void generateHulls(); + void doWholeModelUpload(); - void doIterativeUpload(); + void requestWholeModelFee(); void wholeModelToLLSD(LLSD& dest, bool include_textures); @@ -431,6 +422,15 @@ public: LLVector3& result_pos, LLQuaternion& result_rot, LLVector3& result_scale); + + void setFeeObserverHandle(LLHandle<LLWholeModelFeeObserver> observer_handle) { mFeeObserverHandle = observer_handle; } + void setUploadObserverHandle(LLHandle<LLWholeModelUploadObserver> observer_handle) { mUploadObserverHandle = observer_handle; } + +private: + LLHandle<LLWholeModelFeeObserver> mFeeObserverHandle; + LLHandle<LLWholeModelUploadObserver> mUploadObserverHandle; + + bool mDoUpload; // if FALSE only model data will be requested, otherwise the model will be uploaded }; class LLMeshRepository @@ -464,20 +464,23 @@ public: S32 getActualMeshLOD(const LLVolumeParams& mesh_params, S32 lod); static S32 getActualMeshLOD(LLSD& header, S32 lod); - U32 calcResourceCost(LLSD& header); - U32 getResourceCost(const LLUUID& mesh_params); - const LLMeshSkinInfo* getSkinInfo(const LLUUID& mesh_id); + const LLMeshSkinInfo* getSkinInfo(const LLUUID& mesh_id, LLVOVolume* requesting_obj); LLModel::Decomposition* getDecomposition(const LLUUID& mesh_id); void fetchPhysicsShape(const LLUUID& mesh_id); bool hasPhysicsShape(const LLUUID& mesh_id); void buildHull(const LLVolumeParams& params, S32 detail); void buildPhysicsMesh(LLModel::Decomposition& decomp); + + bool meshUploadEnabled(); + bool meshRezEnabled(); + LLSD& getMeshHeader(const LLUUID& mesh_id); void uploadModel(std::vector<LLModelInstance>& data, LLVector3& scale, bool upload_textures, - bool upload_skin, bool upload_joints); + 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>())); S32 getMeshSize(const LLUUID& mesh_id, S32 lod); @@ -495,7 +498,8 @@ public: std::vector<LLMeshRepoThread::LODRequest> mPendingRequests; //list of mesh ids awaiting skin info - std::set<LLUUID> mLoadingSkins; + typedef std::map<LLUUID, std::set<LLUUID> > skin_load_map; + skin_load_map mLoadingSkins; //list of mesh ids that need to send skin info fetch requests std::queue<LLUUID> mPendingSkinRequests; |