- Bugfix: ColladaParser now properly tunnels XML reading through the Assimp IO System
- Bugfix: IrrXML-IOWrapper now properly inherits the irr interface - moved some "using namespace" directives out of the header git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@351 67173fc5-114c-0410-ac8e-9d2fd5bffc1fpull/1/head
parent
fd2faf92d3
commit
732884e2f4
|
@ -110,7 +110,7 @@ void ColladaLoader::InternReadFile( const std::string& pFile, aiScene* pScene, I
|
|||
mTextures.clear();
|
||||
|
||||
// parse the input file
|
||||
ColladaParser parser( pFile);
|
||||
ColladaParser parser( pIOHandler, pFile);
|
||||
|
||||
if( !parser.mRootNode)
|
||||
throw new ImportErrorException( "Collada: File came out empty. Something is wrong here.");
|
||||
|
@ -154,16 +154,6 @@ void ColladaLoader::InternReadFile( const std::string& pFile, aiScene* pScene, I
|
|||
// store all lights
|
||||
StoreSceneLights( pScene);
|
||||
|
||||
// if we know which camera is the primary camera, copy it to index 0
|
||||
if (0 == parser.mRootNode->mPrimaryCamera.length()) {
|
||||
for (unsigned int i = 1; i < mCameras.size(); ++i) {
|
||||
if (mCameras[i]->mName == parser.mRootNode->mPrimaryCamera) {
|
||||
std::swap(mCameras[i],mCameras[0]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// store all cameras
|
||||
StoreSceneCameras( pScene);
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@ using namespace Assimp::Collada;
|
|||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Constructor to be privately used by Importer
|
||||
ColladaParser::ColladaParser( const std::string& pFile)
|
||||
ColladaParser::ColladaParser( IOSystem* pIOHandler, const std::string& pFile)
|
||||
: mFileName( pFile)
|
||||
{
|
||||
mRootNode = NULL;
|
||||
|
@ -65,8 +65,14 @@ ColladaParser::ColladaParser( const std::string& pFile)
|
|||
// We assume the newest file format by default
|
||||
mFormat = FV_1_5_n;
|
||||
|
||||
// open the file
|
||||
boost::scoped_ptr<IOStream> file( pIOHandler->Open( pFile));
|
||||
if( file.get() == NULL)
|
||||
throw new ImportErrorException( "Failed to open file " + pFile + ".");
|
||||
|
||||
// generate a XML reader for it
|
||||
mReader = irr::io::createIrrXMLReader( pFile.c_str());
|
||||
boost::scoped_ptr<CIrrXML_IOStreamReader> mIOWrapper( new CIrrXML_IOStreamReader( file.get()));
|
||||
mReader = irr::io::createIrrXMLReader( mIOWrapper.get());
|
||||
if( !mReader)
|
||||
ThrowException( "Collada: Unable to open file.");
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ class ColladaParser
|
|||
|
||||
protected:
|
||||
/** Constructor from XML file */
|
||||
ColladaParser( const std::string& pFile);
|
||||
ColladaParser( IOSystem* pIOHandler, const std::string& pFile);
|
||||
|
||||
/** Destructor */
|
||||
~ColladaParser();
|
||||
|
@ -224,7 +224,7 @@ protected:
|
|||
/** Filename, for a verbose error message */
|
||||
std::string mFileName;
|
||||
|
||||
/** XML reader */
|
||||
/** XML reader, member for everyday use */
|
||||
irr::io::IrrXMLReader* mReader;
|
||||
|
||||
/** All data arrays found in the file by ID. Might be referred to by actually
|
||||
|
|
|
@ -60,6 +60,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#endif
|
||||
|
||||
using namespace Assimp;
|
||||
using namespace irr;
|
||||
using namespace irr::io;
|
||||
using namespace boost::math;
|
||||
|
||||
|
||||
|
|
|
@ -48,6 +48,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "fast_atof.h"
|
||||
|
||||
using namespace Assimp;
|
||||
using namespace irr;
|
||||
using namespace irr::io;
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Constructor to be privately used by Importer
|
||||
|
|
|
@ -50,6 +50,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "fast_atof.h"
|
||||
|
||||
using namespace Assimp;
|
||||
using namespace irr;
|
||||
using namespace irr::io;
|
||||
|
||||
// Transformation matrix to convert from Assimp to IRR space
|
||||
const aiMatrix4x4 Assimp::AI_TO_IRR_MATRIX = aiMatrix4x4 (
|
||||
|
|
|
@ -77,7 +77,7 @@ protected:
|
|||
|
||||
/** XML reader instance
|
||||
*/
|
||||
IrrXMLReader* reader;
|
||||
irr::io::IrrXMLReader* reader;
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
/** Parse a material description from the XML
|
||||
|
|
|
@ -6,16 +6,15 @@
|
|||
#include "./../contrib/irrXML/irrXML.h"
|
||||
#include "./../include/IOStream.h"
|
||||
|
||||
namespace Assimp {
|
||||
using namespace irr;
|
||||
using namespace irr::io;
|
||||
namespace Assimp
|
||||
{
|
||||
|
||||
// ---------------------------------------------------------------------------------
|
||||
/** @brief Utility class to make IrrXML work together with our custom IO system
|
||||
*
|
||||
* See the IrrXML docs for more details.
|
||||
*/
|
||||
class CIrrXML_IOStreamReader
|
||||
class CIrrXML_IOStreamReader : public irr::io::IFileReadCallBack
|
||||
{
|
||||
public:
|
||||
|
||||
|
|
Loading…
Reference in New Issue