From 71ac45a28b238bac4ac0cf43ee85f04589ffa116 Mon Sep 17 00:00:00 2001 From: prep linden Date: Tue, 30 Aug 2011 09:32:16 -0400 Subject: Handling of material mismatches - lod materials are required to be a subset of the high lod, introduced addEmptyFace() for when parity does not exist between model material counts --- indra/newview/llfloatermodelpreview.cpp | 57 +++++++++++++++++++++++++++++---- indra/newview/llfloatermodelpreview.h | 3 +- 2 files changed, 53 insertions(+), 7 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index b1b5e69968..80db002f0e 100755 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -3186,8 +3186,14 @@ void LLModelPreview::rebuildUploadData() { for (U32 j = 0; j < mBaseModel.size(); ++j) { - mModel[i][j]->matchMaterialOrder(mBaseModel[j]); - llassert(mModel[i][j]->mMaterialList == mBaseModel[j]->mMaterialList); + + int refFaceCnt = 0; + int modelFaceCnt = 0; + + if ( !mModel[i][j]->matchMaterialOrder(mBaseModel[j], refFaceCnt, modelFaceCnt ) ) + { + mFMP->childDisable( "calculate_btn" ); + } } } } @@ -4765,6 +4771,42 @@ void LLModelPreview::createPreviewAvatar( void ) } } +void LLModelPreview::addEmptyFace( LLModel* pTarget ) +{ + U32 type_mask = LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_NORMAL | LLVertexBuffer::MAP_TEXCOORD0; + + LLPointer buff = new LLVertexBuffer(type_mask, 0); + + buff->allocateBuffer(1, 3, true); + memset( buff->getMappedData(), 0, buff->getSize() ); + memset( buff->getIndicesPointer(), 0, buff->getIndicesSize() ); + + buff->validateRange( 0, buff->getNumVerts()-1, buff->getNumIndices(), 0 ); + + LLStrider pos; + LLStrider norm; + LLStrider tc; + LLStrider index; + + buff->getVertexStrider(pos); + + if ( type_mask & LLVertexBuffer::MAP_NORMAL ) + { + buff->getNormalStrider(norm); + } + if ( type_mask & LLVertexBuffer::MAP_TEXCOORD0 ) + { + buff->getTexCoord0Strider(tc); + } + + buff->getIndexStrider(index); + + //resize face array + int faceCnt = pTarget->getNumVolumeFaces(); + pTarget->setNumVolumeFaces( faceCnt+1 ); + pTarget->setVolumeFaceData( faceCnt+1, pos, norm, tc, index, buff->getNumVerts(), buff->getNumIndices() ); + +} //----------------------------------------------------------------------------- // render() //----------------------------------------------------------------------------- @@ -4976,8 +5018,13 @@ BOOL LLModelPreview::render() { for (U32 j = 0; j < mBaseModel.size(); ++j) { - mModel[i][j]->matchMaterialOrder(mBaseModel[j]); - llassert(mModel[i][j]->mMaterialList == mBaseModel[j]->mMaterialList); + int refFaceCnt = 0; + int modelFaceCnt = 0; + + if ( !mModel[i][j]->matchMaterialOrder(mBaseModel[j], refFaceCnt, modelFaceCnt ) ) + { + mFMP->childDisable( "calculate_btn" ); + } } } } @@ -5019,8 +5066,6 @@ BOOL LLModelPreview::render() 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()) { diff --git a/indra/newview/llfloatermodelpreview.h b/indra/newview/llfloatermodelpreview.h index f383b3fe98..723e8c48b8 100644 --- a/indra/newview/llfloatermodelpreview.h +++ b/indra/newview/llfloatermodelpreview.h @@ -336,7 +336,8 @@ public: void updateStatusMessages(); void clearGLODGroup(); void onLODParamCommit(bool enforce_tri_limit); - + void addEmptyFace( LLModel* pTarget ); + const bool getModelPivot( void ) const { return mHasPivot; } void setHasPivot( bool val ) { mHasPivot = val; } void setModelPivot( const LLVector3& pivot ) { mModelPivot = pivot; } -- cgit v1.2.3