fix: colladaloader is now a bit more tolerant to empty top-level (library) elements. See https://sourceforge.net/tracker/index.php?func=detail&aid=3008871&group_id=226462&atid=1067632

git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@744 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
pull/1/head
aramis_acg 2010-05-29 20:53:42 +00:00
parent dc3218b08a
commit 31ff5d27eb
2 changed files with 114 additions and 1 deletions

View File

@ -246,6 +246,9 @@ void ColladaParser::ReadAssetInfo()
// Reads the animation library
void ColladaParser::ReadAnimationLibrary()
{
if (mReader->isEmptyElement()) {
return;
}
while( mReader->read())
{
if( mReader->getNodeType() == irr::io::EXN_ELEMENT)
@ -425,6 +428,9 @@ void ColladaParser::ReadAnimationSampler( Collada::AnimationChannel& pChannel)
// Reads the skeleton controller library
void ColladaParser::ReadControllerLibrary()
{
if (mReader->isEmptyElement()) {
return;
}
while( mReader->read())
{
if( mReader->getNodeType() == irr::io::EXN_ELEMENT)
@ -673,6 +679,9 @@ void ColladaParser::ReadControllerWeights( Collada::Controller& pController)
// Reads the image library contents
void ColladaParser::ReadImageLibrary()
{
if (mReader->isEmptyElement()) {
return;
}
while( mReader->read())
{
if( mReader->getNodeType() == irr::io::EXN_ELEMENT) {
@ -794,6 +803,9 @@ void ColladaParser::ReadImage( Collada::Image& pImage)
// Reads the material library
void ColladaParser::ReadMaterialLibrary()
{
if (mReader->isEmptyElement()) {
return;
}
while( mReader->read())
{
if( mReader->getNodeType() == irr::io::EXN_ELEMENT)
@ -826,6 +838,9 @@ void ColladaParser::ReadMaterialLibrary()
// Reads the light library
void ColladaParser::ReadLightLibrary()
{
if (mReader->isEmptyElement()) {
return;
}
while( mReader->read())
{
if( mReader->getNodeType() == irr::io::EXN_ELEMENT) {
@ -857,6 +872,9 @@ void ColladaParser::ReadLightLibrary()
// Reads the camera library
void ColladaParser::ReadCameraLibrary()
{
if (mReader->isEmptyElement()) {
return;
}
while( mReader->read())
{
if( mReader->getNodeType() == irr::io::EXN_ELEMENT) {
@ -1043,6 +1061,10 @@ void ColladaParser::ReadCamera( Collada::Camera& pCamera)
// Reads the effect library
void ColladaParser::ReadEffectLibrary()
{
if (mReader->isEmptyElement()) {
return;
}
while( mReader->read())
{
if( mReader->getNodeType() == irr::io::EXN_ELEMENT) {
@ -1195,8 +1217,9 @@ void ColladaParser::ReadEffectProfileCommon( Collada::Effect& pEffect)
// Read texture wrapping + UV transform settings from a profile==Maya chunk
void ColladaParser::ReadSamplerProperties( Sampler& out )
{
if (mReader->isEmptyElement())
if (mReader->isEmptyElement()) {
return;
}
while( mReader->read())
{

View File

@ -0,0 +1,90 @@
<?xml version="1.0"?>
<COLLADA xmlns="http://www.collada.org/2005/11/COLLADASchema" version="1.4.1">
<library_cameras>
</library_cameras>
<library_lights/>
<library_materials/>
<library_effects/>
<library_geometries>
<geometry id="box-lib" name="box">
<mesh>
<source id="box-lib-positions" name="position">
<float_array id="box-lib-positions-array" count="24">-50 50 50 50 50 50 -50 -50 50 50 -50 50 -50 50 -50 50 50 -50 -50 -50 -50 50 -50 -50</float_array>
<technique_common>
<accessor count="8" offset="0" source="#box-lib-positions-array" stride="3">
<param name="X" type="float"></param>
<param name="Y" type="float"></param>
<param name="Z" type="float"></param>
</accessor>
</technique_common>
</source>
<source id="box-lib-normals" name="normal">
<float_array id="box-lib-normals-array" count="72">0 0 1 0 0 1 0 0 1 0 0 1 0 1 0 0 1 0 0 1 0 0 1 0 0 -1 0 0 -1 0 0 -1 0 0 -1 0 -1 0 0 -1 0 0 -1 0 0 -1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 0 0 -1 0 0 -1 0 0 -1 0 0 -1</float_array>
<technique_common>
<accessor count="24" offset="0" source="#box-lib-normals-array" stride="3">
<param name="X" type="float"></param>
<param name="Y" type="float"></param>
<param name="Z" type="float"></param>
</accessor>
</technique_common>
</source>
<vertices id="box-lib-vertices">
<input semantic="POSITION" source="#box-lib-positions"/>
</vertices>
<polylist count="6" material="BlueSG">
<input offset="0" semantic="VERTEX" source="#box-lib-vertices"/>
<input offset="1" semantic="NORMAL" source="#box-lib-normals"/>
<vcount>4 4 4 4 4 4</vcount>
<p>0 0 2 1 3 2 1 3 0 4 1 5 5 6 4 7 6 8 7 9 3 10 2 11 0 12 4 13 6 14 2 15 3 16 7 17 5 18 1 19 5 20 7 21 6 22 4 23</p>
</polylist>
</mesh>
</geometry>
</library_geometries>
<library_visual_scenes>
<visual_scene id="VisualSceneNode" name="untitled">
<node id="Camera" name="Camera">
<translate sid="translate">-427.749 333.855 655.017</translate>
<rotate sid="rotateY">0 1 0 -33</rotate>
<rotate sid="rotateX">1 0 0 -22.1954</rotate>
<rotate sid="rotateZ">0 0 1 0</rotate>
<instance_camera url="#PerspCamera"/>
</node>
<node id="Light" name="Light">
<translate sid="translate">-500 1000 400</translate>
<rotate sid="rotateZ">0 0 1 0</rotate>
<rotate sid="rotateY">0 1 0 0</rotate>
<rotate sid="rotateX">1 0 0 0</rotate>
<instance_light url="#light-lib"/>
</node>
<node id="Box" name="Box">
<rotate sid="rotateZ">0 0 1 0</rotate>
<rotate sid="rotateY">0 1 0 0</rotate>
<rotate sid="rotateX">1 0 0 0</rotate>
<instance_geometry url="#box-lib">
<bind_material>
<technique_common>
<instance_material symbol="BlueSG" target="#Blue"/>
</technique_common>
</bind_material>
</instance_geometry>
</node>
<node id="testCamera" name="testCamera">
<translate sid="translate">-427.749 333.855 655.017</translate>
<rotate sid="rotateY">0 1 0 -33</rotate>
<rotate sid="rotateX">1 0 0 -22.1954</rotate>
<rotate sid="rotateZ">0 0 1 0</rotate>
<instance_camera url="#testCameraShape"/>
</node>
<node id="pointLight1" name="pointLight1">
<translate sid="translate">3 4 10</translate>
<rotate sid="rotateZ">0 0 1 0</rotate>
<rotate sid="rotateY">0 1 0 0</rotate>
<rotate sid="rotateX">1 0 0 0</rotate>
<instance_light url="#pointLightShape1-lib"/>
</node>
</visual_scene>
</library_visual_scenes>
<scene>
<instance_visual_scene url="#VisualSceneNode"/>
</scene>
</COLLADA>