merge
commit
fc2e76fafc
|
|
@ -1286,11 +1286,7 @@ void stretch_extents(LLModel* model, LLMatrix4& mat, LLVector3& min, LLVector3&
|
|||
|
||||
void LLModelLoader::run()
|
||||
{
|
||||
if (!doLoadModel())
|
||||
{
|
||||
mPreview = NULL;
|
||||
}
|
||||
|
||||
doLoadModel();
|
||||
doOnIdleOneTime(boost::bind(&LLModelLoader::loadModelCallback,this));
|
||||
}
|
||||
|
||||
|
|
@ -2302,87 +2298,87 @@ bool LLModelLoader::isNodeAJoint( domNode* pNode )
|
|||
//-----------------------------------------------------------------------------
|
||||
// verifyCount
|
||||
//-----------------------------------------------------------------------------
|
||||
bool LLModelPreview::verifyCount( int expected, int result )
|
||||
{
|
||||
if ( expected != result )
|
||||
{
|
||||
llinfos<< "Error: (expected/got)"<<expected<<"/"<<result<<"verts"<<llendl;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
bool LLModelPreview::verifyCount( int expected, int result )
|
||||
{
|
||||
if ( expected != result )
|
||||
{
|
||||
llinfos<< "Error: (expected/got)"<<expected<<"/"<<result<<"verts"<<llendl;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
// verifyController
|
||||
//-----------------------------------------------------------------------------
|
||||
bool LLModelPreview::verifyController( domController* pController )
|
||||
{
|
||||
|
||||
bool result = true;
|
||||
|
||||
domSkin* pSkin = pController->getSkin();
|
||||
|
||||
if ( pSkin )
|
||||
{
|
||||
xsAnyURI & uri = pSkin->getSource();
|
||||
domElement* pElement = uri.getElement();
|
||||
|
||||
if ( !pElement )
|
||||
{
|
||||
llinfos<<"Can't resolve skin source"<<llendl;
|
||||
return false;
|
||||
}
|
||||
|
||||
daeString type_str = pElement->getTypeName();
|
||||
if ( stricmp(type_str, "geometry") == 0 )
|
||||
{
|
||||
//Skin is reference directly by geometry and get the vertex count from skin
|
||||
domSkin::domVertex_weights* pVertexWeights = pSkin->getVertex_weights();
|
||||
U32 vertexWeightsCount = pVertexWeights->getCount();
|
||||
domGeometry* pGeometry = (domGeometry*) (domElement*) uri.getElement();
|
||||
domMesh* pMesh = pGeometry->getMesh();
|
||||
|
||||
if ( pMesh )
|
||||
{
|
||||
//Get vertex count from geometry
|
||||
domVertices* pVertices = pMesh->getVertices();
|
||||
if ( !pVertices )
|
||||
{
|
||||
llinfos<<"No vertices!"<<llendl;
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( pVertices )
|
||||
{
|
||||
xsAnyURI src = pVertices->getInput_array()[0]->getSource();
|
||||
domSource* pSource = (domSource*) (domElement*) src.getElement();
|
||||
U32 verticesCount = pSource->getTechnique_common()->getAccessor()->getCount();
|
||||
result = verifyCount( verticesCount, vertexWeightsCount );
|
||||
if ( !result )
|
||||
{
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
U32 vcountCount = (U32) pVertexWeights->getVcount()->getValue().getCount();
|
||||
result = verifyCount( vcountCount, vertexWeightsCount );
|
||||
if ( !result )
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
domInputLocalOffset_Array& inputs = pVertexWeights->getInput_array();
|
||||
U32 sum = 0;
|
||||
for (size_t i=0; i<vcountCount; i++)
|
||||
{
|
||||
sum += pVertexWeights->getVcount()->getValue()[i];
|
||||
}
|
||||
result = verifyCount( sum * inputs.getCount(), (domInt) pVertexWeights->getV()->getValue().getCount() );
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
bool LLModelPreview::verifyController( domController* pController )
|
||||
{
|
||||
|
||||
bool result = true;
|
||||
|
||||
domSkin* pSkin = pController->getSkin();
|
||||
|
||||
if ( pSkin )
|
||||
{
|
||||
xsAnyURI & uri = pSkin->getSource();
|
||||
domElement* pElement = uri.getElement();
|
||||
|
||||
if ( !pElement )
|
||||
{
|
||||
llinfos<<"Can't resolve skin source"<<llendl;
|
||||
return false;
|
||||
}
|
||||
|
||||
daeString type_str = pElement->getTypeName();
|
||||
if ( stricmp(type_str, "geometry") == 0 )
|
||||
{
|
||||
//Skin is reference directly by geometry and get the vertex count from skin
|
||||
domSkin::domVertex_weights* pVertexWeights = pSkin->getVertex_weights();
|
||||
U32 vertexWeightsCount = pVertexWeights->getCount();
|
||||
domGeometry* pGeometry = (domGeometry*) (domElement*) uri.getElement();
|
||||
domMesh* pMesh = pGeometry->getMesh();
|
||||
|
||||
if ( pMesh )
|
||||
{
|
||||
//Get vertex count from geometry
|
||||
domVertices* pVertices = pMesh->getVertices();
|
||||
if ( !pVertices )
|
||||
{
|
||||
llinfos<<"No vertices!"<<llendl;
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( pVertices )
|
||||
{
|
||||
xsAnyURI src = pVertices->getInput_array()[0]->getSource();
|
||||
domSource* pSource = (domSource*) (domElement*) src.getElement();
|
||||
U32 verticesCount = pSource->getTechnique_common()->getAccessor()->getCount();
|
||||
result = verifyCount( verticesCount, vertexWeightsCount );
|
||||
if ( !result )
|
||||
{
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
U32 vcountCount = (U32) pVertexWeights->getVcount()->getValue().getCount();
|
||||
result = verifyCount( vcountCount, vertexWeightsCount );
|
||||
if ( !result )
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
domInputLocalOffset_Array& inputs = pVertexWeights->getInput_array();
|
||||
U32 sum = 0;
|
||||
for (size_t i=0; i<vcountCount; i++)
|
||||
{
|
||||
sum += pVertexWeights->getVcount()->getValue()[i];
|
||||
}
|
||||
result = verifyCount( sum * inputs.getCount(), (domInt) pVertexWeights->getV()->getValue().getCount() );
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// extractTranslation()
|
||||
|
|
|
|||
Loading…
Reference in New Issue