commit
ab9587dd1e
|
@ -599,7 +599,7 @@ void ColladaParser::ReadControllerWeights( Collada::Controller& pController)
|
||||||
if( mReader->getNodeType() == irr::io::EXN_ELEMENT)
|
if( mReader->getNodeType() == irr::io::EXN_ELEMENT)
|
||||||
{
|
{
|
||||||
// Input channels for weight data. Two possible semantics: "JOINT" and "WEIGHT"
|
// Input channels for weight data. Two possible semantics: "JOINT" and "WEIGHT"
|
||||||
if( IsElement( "input"))
|
if( IsElement( "input") && vertexCount > 0 )
|
||||||
{
|
{
|
||||||
InputChannel channel;
|
InputChannel channel;
|
||||||
|
|
||||||
|
@ -628,7 +628,7 @@ void ColladaParser::ReadControllerWeights( Collada::Controller& pController)
|
||||||
if( !mReader->isEmptyElement())
|
if( !mReader->isEmptyElement())
|
||||||
SkipElement();
|
SkipElement();
|
||||||
}
|
}
|
||||||
else if( IsElement( "vcount"))
|
else if( IsElement( "vcount") && vertexCount > 0 )
|
||||||
{
|
{
|
||||||
// read weight count per vertex
|
// read weight count per vertex
|
||||||
const char* text = GetTextContent();
|
const char* text = GetTextContent();
|
||||||
|
@ -648,7 +648,7 @@ void ColladaParser::ReadControllerWeights( Collada::Controller& pController)
|
||||||
// reserve weight count
|
// reserve weight count
|
||||||
pController.mWeights.resize( numWeights);
|
pController.mWeights.resize( numWeights);
|
||||||
}
|
}
|
||||||
else if( IsElement( "v"))
|
else if( IsElement( "v") && vertexCount > 0 )
|
||||||
{
|
{
|
||||||
// read JointIndex - WeightIndex pairs
|
// read JointIndex - WeightIndex pairs
|
||||||
const char* text = GetTextContent();
|
const char* text = GetTextContent();
|
||||||
|
@ -1656,6 +1656,7 @@ void ColladaParser::ReadDataArray()
|
||||||
std::string id = mReader->getAttributeValue( indexID);
|
std::string id = mReader->getAttributeValue( indexID);
|
||||||
int indexCount = GetAttribute( "count");
|
int indexCount = GetAttribute( "count");
|
||||||
unsigned int count = (unsigned int) mReader->getAttributeValueAsInt( indexCount);
|
unsigned int count = (unsigned int) mReader->getAttributeValueAsInt( indexCount);
|
||||||
|
if (count == 0) { return; } // some exporters write empty data arrays with count="0"
|
||||||
const char* content = TestTextContent();
|
const char* content = TestTextContent();
|
||||||
|
|
||||||
// read values and store inside an array in the data library
|
// read values and store inside an array in the data library
|
||||||
|
|
|
@ -69,12 +69,12 @@ bool aiQuaterniont<TReal>::operator!= (const aiQuaterniont& o) const
|
||||||
template<typename TReal>
|
template<typename TReal>
|
||||||
inline aiQuaterniont<TReal>::aiQuaterniont( const aiMatrix3x3t<TReal> &pRotMatrix)
|
inline aiQuaterniont<TReal>::aiQuaterniont( const aiMatrix3x3t<TReal> &pRotMatrix)
|
||||||
{
|
{
|
||||||
TReal t = 1 + pRotMatrix.a1 + pRotMatrix.b2 + pRotMatrix.c3;
|
TReal t = pRotMatrix.a1 + pRotMatrix.b2 + pRotMatrix.c3;
|
||||||
|
|
||||||
// large enough
|
// large enough
|
||||||
if( t > static_cast<TReal>(0.001))
|
if( t > static_cast<TReal>(0))
|
||||||
{
|
{
|
||||||
TReal s = sqrt( t) * static_cast<TReal>(2.0);
|
TReal s = sqrt(1 + t) * static_cast<TReal>(2.0);
|
||||||
x = (pRotMatrix.c2 - pRotMatrix.b3) / s;
|
x = (pRotMatrix.c2 - pRotMatrix.b3) / s;
|
||||||
y = (pRotMatrix.a3 - pRotMatrix.c1) / s;
|
y = (pRotMatrix.a3 - pRotMatrix.c1) / s;
|
||||||
z = (pRotMatrix.b1 - pRotMatrix.a2) / s;
|
z = (pRotMatrix.b1 - pRotMatrix.a2) / s;
|
||||||
|
|
Loading…
Reference in New Issue