(materials.size());
+ m_scene->mMaterials = new aiMaterial*[m_scene->mNumMaterials]();
+ std::copy(materials.begin(),materials.end(),m_scene->mMaterials);
if (scope.light) {
- scene->mNumLights = 1;
- scene->mLights = new aiLight*[1];
- scene->mLights[0] = scope.light;
+ m_scene->mNumLights = 1;
+ m_scene->mLights = new aiLight*[1];
+ m_scene->mLights[0] = scope.light;
- scope.light->mName = scene->mRootNode->mName;
+ scope.light->mName = m_scene->mRootNode->mName;
}
scope.dismiss();
@@ -254,8 +257,8 @@ void XGLImporter::InternReadFile( const std::string& pFile,
// ------------------------------------------------------------------------------------------------
bool XGLImporter::ReadElement()
{
- while(reader->read()) {
- if (reader->getNodeType() == EXN_ELEMENT) {
+ while(m_reader->read()) {
+ if (m_reader->getNodeType() == EXN_ELEMENT) {
return true;
}
}
@@ -265,11 +268,11 @@ bool XGLImporter::ReadElement()
// ------------------------------------------------------------------------------------------------
bool XGLImporter::ReadElementUpToClosing(const char* closetag)
{
- while(reader->read()) {
- if (reader->getNodeType() == EXN_ELEMENT) {
+ while(m_reader->read()) {
+ if (m_reader->getNodeType() == EXN_ELEMENT) {
return true;
}
- else if (reader->getNodeType() == EXN_ELEMENT_END && !ASSIMP_stricmp(reader->getNodeName(),closetag)) {
+ else if (m_reader->getNodeType() == EXN_ELEMENT_END && !ASSIMP_stricmp(m_reader->getNodeName(),closetag)) {
return false;
}
}
@@ -280,11 +283,11 @@ bool XGLImporter::ReadElementUpToClosing(const char* closetag)
// ------------------------------------------------------------------------------------------------
bool XGLImporter::SkipToText()
{
- while(reader->read()) {
- if (reader->getNodeType() == EXN_TEXT) {
+ while(m_reader->read()) {
+ if (m_reader->getNodeType() == EXN_TEXT) {
return true;
}
- else if (reader->getNodeType() == EXN_ELEMENT || reader->getNodeType() == EXN_ELEMENT_END) {
+ else if (m_reader->getNodeType() == EXN_ELEMENT || m_reader->getNodeType() == EXN_ELEMENT_END) {
ThrowException("expected text contents but found another element (or element end)");
}
}
@@ -294,7 +297,7 @@ bool XGLImporter::SkipToText()
// ------------------------------------------------------------------------------------------------
std::string XGLImporter::GetElementName()
{
- const char* s = reader->getNodeName();
+ const char* s = m_reader->getNodeName();
size_t len = strlen(s);
std::string ret;
@@ -328,7 +331,7 @@ void XGLImporter::ReadWorld(TempScope& scope)
nd->mName.Set("WORLD");
}
- scene->mRootNode = nd;
+ m_scene->mRootNode = nd;
}
// ------------------------------------------------------------------------------------------------
@@ -586,29 +589,29 @@ bool XGLImporter::ReadMesh(TempScope& scope)
ReadMaterial(scope);
}
else if (s == "p") {
- if (!reader->getAttributeValue("ID")) {
+ if (!m_reader->getAttributeValue("ID")) {
LogWarn("no ID attribute on , ignoring");
}
else {
- int id = reader->getAttributeValueAsInt("ID");
+ int id = m_reader->getAttributeValueAsInt("ID");
t.points[id] = ReadVec3();
}
}
else if (s == "n") {
- if (!reader->getAttributeValue("ID")) {
+ if (!m_reader->getAttributeValue("ID")) {
LogWarn("no ID attribute on , ignoring");
}
else {
- int id = reader->getAttributeValueAsInt("ID");
+ int id = m_reader->getAttributeValueAsInt("ID");
t.normals[id] = ReadVec3();
}
}
else if (s == "tc") {
- if (!reader->getAttributeValue("ID")) {
+ if (!m_reader->getAttributeValue("ID")) {
LogWarn("no ID attribute on , ignoring");
}
else {
- int id = reader->getAttributeValueAsInt("ID");
+ int id = m_reader->getAttributeValueAsInt("ID");
t.uvs[id] = ReadVec2();
}
}
@@ -828,10 +831,10 @@ void XGLImporter::ReadFaceVertex(const TempMesh& t, TempFace& out)
// ------------------------------------------------------------------------------------------------
unsigned int XGLImporter::ReadIDAttr()
{
- for(int i = 0, e = reader->getAttributeCount(); i < e; ++i) {
+ for(int i = 0, e = m_reader->getAttributeCount(); i < e; ++i) {
- if(!ASSIMP_stricmp(reader->getAttributeName(i),"id")) {
- return reader->getAttributeValueAsInt(i);
+ if(!ASSIMP_stricmp(m_reader->getAttributeName(i),"id")) {
+ return m_reader->getAttributeValueAsInt(i);
}
}
return ~0u;
@@ -844,7 +847,7 @@ float XGLImporter::ReadFloat()
LogError("unexpected EOF reading float element contents");
return 0.f;
}
- const char* s = reader->getNodeData(), *se;
+ const char* s = m_reader->getNodeData(), *se;
if(!SkipSpaces(&s)) {
LogError("unexpected EOL, failed to parse float");
@@ -869,7 +872,7 @@ unsigned int XGLImporter::ReadIndexFromText()
LogError("unexpected EOF reading index element contents");
return ~0u;
}
- const char* s = reader->getNodeData(), *se;
+ const char* s = m_reader->getNodeData(), *se;
if(!SkipSpaces(&s)) {
LogError("unexpected EOL, failed to parse index element");
return ~0u;
@@ -894,7 +897,7 @@ aiVector2D XGLImporter::ReadVec2()
LogError("unexpected EOF reading vec2 contents");
return vec;
}
- const char* s = reader->getNodeData();
+ const char* s = m_reader->getNodeData();
for(int i = 0; i < 2; ++i) {
if(!SkipSpaces(&s)) {
@@ -923,7 +926,7 @@ aiVector3D XGLImporter::ReadVec3()
LogError("unexpected EOF reading vec3 contents");
return vec;
}
- const char* s = reader->getNodeData();
+ const char* s = m_reader->getNodeData();
for(int i = 0; i < 3; ++i) {
if(!SkipSpaces(&s)) {
diff --git a/code/XGLLoader.h b/code/XGLLoader.h
index 757f9d564..c8a68ba31 100644
--- a/code/XGLLoader.h
+++ b/code/XGLLoader.h
@@ -51,6 +51,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include
#include
#include
+#include
struct aiNode;
@@ -203,12 +204,8 @@ private:
unsigned int ResolveMaterialRef(TempScope& scope);
private:
-
-
-private:
-
- irr::io::IrrXMLReader* reader;
- aiScene* scene;
+ std::shared_ptr m_reader;
+ aiScene* m_scene;
};
} // end of namespace Assimp
diff --git a/code/glTFAsset.inl b/code/glTFAsset.inl
index d52c825c4..470246c94 100644
--- a/code/glTFAsset.inl
+++ b/code/glTFAsset.inl
@@ -40,6 +40,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "StringUtils.h"
+using namespace Assimp;
+
namespace glTF {
namespace {
diff --git a/code/glTFAssetWriter.inl b/code/glTFAssetWriter.inl
index 0fa8556c0..415db6714 100644
--- a/code/glTFAssetWriter.inl
+++ b/code/glTFAssetWriter.inl
@@ -105,7 +105,7 @@ namespace glTF {
type = "arraybuffer";
}
- obj.AddMember("byteLength", b.byteLength, w.mAl);
+ obj.AddMember("byteLength", static_cast(b.byteLength), w.mAl);
obj.AddMember("type", StringRef(type), w.mAl);
obj.AddMember("uri", Value(dataURI, w.mAl).Move(), w.mAl);
}
@@ -113,8 +113,8 @@ namespace glTF {
inline void Write(Value& obj, BufferView& bv, AssetWriter& w)
{
obj.AddMember("buffer", Value(bv.buffer->id, w.mAl).Move(), w.mAl);
- obj.AddMember("byteOffset", bv.byteOffset, w.mAl);
- obj.AddMember("byteLength", bv.byteLength, w.mAl);
+ obj.AddMember("byteOffset", static_cast(bv.byteOffset), w.mAl);
+ obj.AddMember("byteLength", static_cast(bv.byteLength), w.mAl);
obj.AddMember("target", int(bv.target), w.mAl);
}
diff --git a/code/glTFExporter.cpp b/code/glTFExporter.cpp
index 7f0c086cf..3b9c1b67b 100644
--- a/code/glTFExporter.cpp
+++ b/code/glTFExporter.cpp
@@ -93,11 +93,11 @@ glTFExporter::glTFExporter(const char* filename, IOSystem* pIOSystem, const aiSc
, mScene(pScene)
, mProperties(pProperties)
{
- std::unique_ptr asset(new glTF::Asset(pIOSystem));
- mAsset = asset.get();
+ std::unique_ptr asset();
+ mAsset.reset( new glTF::Asset( pIOSystem ) );
if (isBinary) {
- asset->SetAsBinary();
+ mAsset->SetAsBinary();
}
ExportMetadata();
diff --git a/code/glTFExporter.h b/code/glTFExporter.h
index 884d1fe38..dfd0108b5 100644
--- a/code/glTFExporter.h
+++ b/code/glTFExporter.h
@@ -46,13 +46,12 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include
#include
+
#include
#include
#include