3MF: reformattings.
parent
63485bdd26
commit
8accf5b386
|
@ -87,14 +87,11 @@ namespace XmlTag {
|
|||
static const std::string transform = "transform";
|
||||
}
|
||||
|
||||
|
||||
class XmlSerializer
|
||||
{
|
||||
class XmlSerializer {
|
||||
public:
|
||||
XmlSerializer(XmlReader* xmlReader)
|
||||
: xmlReader(xmlReader)
|
||||
{
|
||||
|
||||
: xmlReader(xmlReader) {
|
||||
// empty
|
||||
}
|
||||
|
||||
void ImportXml(aiScene* scene) {
|
||||
|
@ -109,8 +106,9 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
if(scene->mRootNode->mName.length == 0)
|
||||
scene->mRootNode->mName.Set("3MF");
|
||||
if ( scene->mRootNode->mName.length == 0 ) {
|
||||
scene->mRootNode->mName.Set( "3MF" );
|
||||
}
|
||||
|
||||
scene->mNumMeshes = static_cast<unsigned int>(meshes.size());
|
||||
scene->mMeshes = new aiMesh*[scene->mNumMeshes]();
|
||||
|
@ -121,12 +119,10 @@ public:
|
|||
scene->mRootNode->mChildren = new aiNode*[scene->mRootNode->mNumChildren]();
|
||||
|
||||
std::copy(children.begin(), children.end(), scene->mRootNode->mChildren);
|
||||
|
||||
}
|
||||
|
||||
private:
|
||||
aiNode* ReadObject(aiScene* scene)
|
||||
{
|
||||
aiNode* ReadObject(aiScene* scene) {
|
||||
ScopeGuard<aiNode> node(new aiNode());
|
||||
|
||||
std::vector<unsigned long> meshIds;
|
||||
|
@ -147,17 +143,14 @@ private:
|
|||
|
||||
size_t meshIdx = meshes.size();
|
||||
|
||||
while(ReadToEndElement(D3MF::XmlTag::object))
|
||||
{
|
||||
if(xmlReader->getNodeName() == D3MF::XmlTag::mesh)
|
||||
{
|
||||
while(ReadToEndElement(D3MF::XmlTag::object)) {
|
||||
if(xmlReader->getNodeName() == D3MF::XmlTag::mesh) {
|
||||
auto mesh = ReadMesh();
|
||||
|
||||
mesh->mName.Set(name);
|
||||
meshes.push_back(mesh);
|
||||
meshIds.push_back(static_cast<unsigned long>(meshIdx));
|
||||
meshIdx++;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -168,49 +161,35 @@ private:
|
|||
std::copy(meshIds.begin(), meshIds.end(), node->mMeshes);
|
||||
|
||||
return node.dismiss();
|
||||
|
||||
}
|
||||
|
||||
aiMesh* ReadMesh()
|
||||
{
|
||||
aiMesh* ReadMesh() {
|
||||
aiMesh* mesh = new aiMesh();
|
||||
|
||||
while(ReadToEndElement(D3MF::XmlTag::mesh))
|
||||
{
|
||||
if(xmlReader->getNodeName() == D3MF::XmlTag::vertices)
|
||||
{
|
||||
while(ReadToEndElement(D3MF::XmlTag::mesh)) {
|
||||
if(xmlReader->getNodeName() == D3MF::XmlTag::vertices) {
|
||||
ImportVertices(mesh);
|
||||
}
|
||||
else if(xmlReader->getNodeName() == D3MF::XmlTag::triangles)
|
||||
{
|
||||
} else if(xmlReader->getNodeName() == D3MF::XmlTag::triangles) {
|
||||
ImportTriangles(mesh);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
return mesh;
|
||||
}
|
||||
|
||||
void ImportVertices(aiMesh* mesh)
|
||||
{
|
||||
void ImportVertices(aiMesh* mesh) {
|
||||
std::vector<aiVector3D> vertices;
|
||||
|
||||
while(ReadToEndElement(D3MF::XmlTag::vertices))
|
||||
{
|
||||
if(xmlReader->getNodeName() == D3MF::XmlTag::vertex)
|
||||
{
|
||||
while ( ReadToEndElement(D3MF::XmlTag::vertices) ) {
|
||||
if(xmlReader->getNodeName() == D3MF::XmlTag::vertex) {
|
||||
vertices.push_back(ReadVertex());
|
||||
}
|
||||
}
|
||||
mesh->mNumVertices = static_cast<unsigned int>(vertices.size());
|
||||
mesh->mVertices = new aiVector3D[mesh->mNumVertices];
|
||||
|
||||
std::copy(vertices.begin(), vertices.end(), mesh->mVertices);
|
||||
|
||||
}
|
||||
aiVector3D ReadVertex()
|
||||
{
|
||||
|
||||
aiVector3D ReadVertex() {
|
||||
aiVector3D vertex;
|
||||
|
||||
vertex.x = ai_strtof(xmlReader->getAttributeValue(D3MF::XmlTag::x.c_str()), nullptr);
|
||||
|
@ -220,15 +199,11 @@ private:
|
|||
return vertex;
|
||||
}
|
||||
|
||||
void ImportTriangles(aiMesh* mesh)
|
||||
{
|
||||
void ImportTriangles(aiMesh* mesh) {
|
||||
std::vector<aiFace> faces;
|
||||
|
||||
|
||||
while(ReadToEndElement(D3MF::XmlTag::triangles))
|
||||
{
|
||||
if(xmlReader->getNodeName() == D3MF::XmlTag::triangle)
|
||||
{
|
||||
while(ReadToEndElement(D3MF::XmlTag::triangles)) {
|
||||
if(xmlReader->getNodeName() == D3MF::XmlTag::triangle) {
|
||||
faces.push_back(ReadTriangle());
|
||||
}
|
||||
}
|
||||
|
@ -239,13 +214,10 @@ private:
|
|||
|
||||
|
||||
std::copy(faces.begin(), faces.end(), mesh->mFaces);
|
||||
|
||||
}
|
||||
|
||||
aiFace ReadTriangle()
|
||||
{
|
||||
aiFace ReadTriangle() {
|
||||
aiFace face;
|
||||
|
||||
face.mNumIndices = 3;
|
||||
face.mIndices = new unsigned int[face.mNumIndices];
|
||||
face.mIndices[0] = static_cast<unsigned int>(std::atoi(xmlReader->getAttributeValue(D3MF::XmlTag::v1.c_str())));
|
||||
|
@ -256,35 +228,25 @@ private:
|
|||
}
|
||||
|
||||
private:
|
||||
|
||||
bool ReadToStartElement(const std::string& startTag)
|
||||
{
|
||||
while(xmlReader->read())
|
||||
{
|
||||
if (xmlReader->getNodeType() == irr::io::EXN_ELEMENT && xmlReader->getNodeName() == startTag)
|
||||
{
|
||||
bool ReadToStartElement(const std::string& startTag) {
|
||||
while(xmlReader->read()) {
|
||||
if (xmlReader->getNodeType() == irr::io::EXN_ELEMENT && xmlReader->getNodeName() == startTag) {
|
||||
return true;
|
||||
}
|
||||
else if (xmlReader->getNodeType() == irr::io::EXN_ELEMENT_END &&
|
||||
xmlReader->getNodeName() == startTag)
|
||||
{
|
||||
} else if (xmlReader->getNodeType() == irr::io::EXN_ELEMENT_END &&
|
||||
xmlReader->getNodeName() == startTag) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
//DefaultLogger::get()->error("unexpected EOF, expected closing <" + closeTag + "> tag");
|
||||
// DefaultLogger::get()->error("unexpected EOF, expected closing <" + closeTag + "> tag");
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ReadToEndElement(const std::string& closeTag)
|
||||
{
|
||||
while(xmlReader->read())
|
||||
{
|
||||
bool ReadToEndElement(const std::string& closeTag) {
|
||||
while(xmlReader->read()) {
|
||||
if (xmlReader->getNodeType() == irr::io::EXN_ELEMENT) {
|
||||
return true;
|
||||
}
|
||||
else if (xmlReader->getNodeType() == irr::io::EXN_ELEMENT_END
|
||||
&& xmlReader->getNodeName() == closeTag)
|
||||
{
|
||||
} else if (xmlReader->getNodeType() == irr::io::EXN_ELEMENT_END
|
||||
&& xmlReader->getNodeName() == closeTag) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -292,7 +254,6 @@ private:
|
|||
return false;
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
std::vector<aiMesh*> meshes;
|
||||
XmlReader* xmlReader;
|
||||
|
@ -300,7 +261,6 @@ private:
|
|||
|
||||
} //namespace D3MF
|
||||
|
||||
|
||||
static const aiImporterDesc desc = {
|
||||
"3mf Importer",
|
||||
"",
|
||||
|
@ -314,19 +274,15 @@ static const aiImporterDesc desc = {
|
|||
"3mf"
|
||||
};
|
||||
|
||||
|
||||
D3MFImporter::D3MFImporter()
|
||||
{
|
||||
|
||||
D3MFImporter::D3MFImporter() {
|
||||
// empty
|
||||
}
|
||||
|
||||
D3MFImporter::~D3MFImporter()
|
||||
{
|
||||
|
||||
D3MFImporter::~D3MFImporter() {
|
||||
// empty
|
||||
}
|
||||
|
||||
bool D3MFImporter::CanRead(const std::string &pFile, IOSystem *pIOHandler, bool checkSig) const
|
||||
{
|
||||
bool D3MFImporter::CanRead(const std::string &pFile, IOSystem *pIOHandler, bool checkSig) const {
|
||||
const std::string extension = GetExtension(pFile);
|
||||
if(extension == "3mf") {
|
||||
return true;
|
||||
|
@ -339,18 +295,15 @@ bool D3MFImporter::CanRead(const std::string &pFile, IOSystem *pIOHandler, bool
|
|||
return false;
|
||||
}
|
||||
|
||||
void D3MFImporter::SetupProperties(const Importer *pImp)
|
||||
{
|
||||
|
||||
void D3MFImporter::SetupProperties(const Importer *pImp) {
|
||||
// empty
|
||||
}
|
||||
|
||||
const aiImporterDesc *D3MFImporter::GetInfo() const
|
||||
{
|
||||
const aiImporterDesc *D3MFImporter::GetInfo() const {
|
||||
return &desc;
|
||||
}
|
||||
|
||||
void D3MFImporter::InternReadFile(const std::string &pFile, aiScene *pScene, IOSystem *pIOHandler)
|
||||
{
|
||||
void D3MFImporter::InternReadFile(const std::string &pFile, aiScene *pScene, IOSystem *pIOHandler) {
|
||||
D3MF::D3MFOpcPackage opcPackage(pIOHandler, pFile);
|
||||
|
||||
std::unique_ptr<CIrrXML_IOStreamReader> xmlStream(new CIrrXML_IOStreamReader(opcPackage.RootStream()));
|
||||
|
|
|
@ -19,35 +19,32 @@ VersionInfoCompany=Assimp Development Team
|
|||
ArchitecturesInstallIn64BitMode=x64
|
||||
|
||||
[Types]
|
||||
Name: "full"; Description: "Full installation"
|
||||
Name: "full"; Description: "Full installation"
|
||||
Name: "compact"; Description: "Compact installation, no test models or language bindings"
|
||||
Name: "custom"; Description: "Custom installation"; Flags: iscustom
|
||||
Name: "custom"; Description: "Custom installation"; Flags: iscustom
|
||||
|
||||
[Components]
|
||||
Name: "main"; Description: "Main Files (32 and 64 Bit)"; Types: full compact custom; Flags: fixed
|
||||
Name: "tools"; Description: "Asset Viewer & Command Line Tools (32 and 64 Bit)"; Types: full compact
|
||||
Name: "help"; Description: "Help Files"; Types: full compact
|
||||
Name: "samples"; Description: "Samples"; Types: full
|
||||
;Name: "wsource"; Description: "Source Code"; Types: full
|
||||
Name: "test"; Description: "Test Models (BSD-licensed)"; Types: full
|
||||
Name: "main"; Description: "Main Files (32 and 64 Bit)"; Types: full compact custom; Flags: fixed
|
||||
Name: "tools"; Description: "Asset Viewer & Command Line Tools (32 and 64 Bit)"; Types: full compact
|
||||
Name: "help"; Description: "Help Files"; Types: full compact
|
||||
Name: "samples"; Description: "Samples"; Types: full
|
||||
Name: "test"; Description: "Test Models (BSD-licensed)"; Types: full
|
||||
Name: "test_nonbsd"; Description: "Test Models (other (free) licenses)"; Types: full
|
||||
Name: "pyassimp"; Description: "Python Bindings"; Types: full
|
||||
Name: "dassimp"; Description: "D Bindings"; Types: full
|
||||
Name: "assimp_net"; Description: "C#/.NET Bindings"; Types: full
|
||||
;Name: "vc8"; Description: "VC8 project files"; Types: full
|
||||
;Name: "vc9"; Description: "VC9 project files"; Types: full
|
||||
Name: "pyassimp"; Description: "Python Bindings"; Types: full
|
||||
Name: "dassimp"; Description: "D Bindings"; Types: full
|
||||
Name: "assimp_net"; Description: "C#/.NET Bindings"; Types: full
|
||||
|
||||
[Run]
|
||||
Filename: "{app}\stub\vcredist_x86.exe"; Parameters: "/qb"; StatusMsg: "Installing VS2012 SP1 redistributable package (32 Bit)"; Check: not IsWin64
|
||||
Filename: "{app}\stub\vcredist_x64.exe"; Parameters: "/qb"; StatusMsg: "Installing VS2012 SP1 redistributable package (64 Bit)"; Check: IsWin64
|
||||
Filename: "{app}\stub\vc_redist.x86.exe"; Parameters: "/qb"; StatusMsg: "Installing VS2015 redistributable package (32 Bit)"; Check: not IsWin64
|
||||
Filename: "{app}\stub\vc_redist.x64.exe"; Parameters: "/qb"; StatusMsg: "Installing VS2015 redistributable package (64 Bit)"; Check: IsWin64
|
||||
|
||||
[Files]
|
||||
|
||||
Source: "readme_installer.txt"; DestDir: "{app}"; Flags: isreadme
|
||||
|
||||
; Installer stub
|
||||
Source: "vcredist_x86.exe"; DestDir: "{app}\stub\"; Check: not IsWin64
|
||||
Source: "vcredist_x64.exe"; DestDir: "{app}\stub\"; Check: IsWin64
|
||||
Source: "vc_redist.x86.exe"; DestDir: "{app}\stub\"; Check: not IsWin64
|
||||
Source: "vc_redist.x64.exe"; DestDir: "{app}\stub\"; Check: IsWin64
|
||||
|
||||
; Common stuff
|
||||
Source: "..\..\CREDITS"; DestDir: "{app}"
|
||||
|
@ -58,18 +55,18 @@ Source: "WEB"; DestDir: "{app}"
|
|||
Source: "..\..\scripts\*"; DestDir: "{app}\scripts"; Flags: recursesubdirs
|
||||
|
||||
; x86 binaries
|
||||
Source: "..\..\bin\assimp_release-dll_Win32\Assimp32.dll"; DestDir: "{app}\bin\x86"
|
||||
Source: "..\..\bin\assimpview_release-dll_Win32\assimp_view.exe"; DestDir: "{app}\bin\x86"; Components: tools
|
||||
Source: "D3DCompiler_42.dll"; DestDir: "{app}\bin\x86"; Components: tools
|
||||
Source: "D3DX9_42.dll"; DestDir: "{app}\bin\x86"; Components: tools
|
||||
Source: "..\..\bin\assimpcmd_release-dll_Win32\assimp.exe"; DestDir: "{app}\bin\x86"; Components: tools
|
||||
Source: "..\..\bin\release\x86\assimp-vc140-mt.dll"; DestDir: "{app}\bin\x86"
|
||||
Source: "..\..\bin\release\x86\assimp_view.exe"; DestDir: "{app}\bin\x86"; Components: tools
|
||||
Source: "D3DCompiler_42.dll"; DestDir: "{app}\bin\x86"; Components: tools
|
||||
Source: "D3DX9_42.dll"; DestDir: "{app}\bin\x86"; Components: tools
|
||||
Source: "..\..\bin\release\x86\assimp.exe"; DestDir: "{app}\bin\x86"; Components: tools
|
||||
|
||||
; x64 binaries
|
||||
Source: "..\..\bin\assimp_release-dll_x64\Assimp64.dll"; DestDir: "{app}\bin\x64"
|
||||
Source: "..\..\bin\assimpview_release-dll_x64\assimp_view.exe"; DestDir: "{app}\bin\x64"; Components: tools
|
||||
Source: "D3DCompiler_42_x64.dll"; DestDir: "{app}\bin\x64"; DestName: "D3DCompiler_42.dll"; Components: tools
|
||||
Source: "D3DX9_42_x64.dll"; DestDir: "{app}\bin\x64"; DestName: "D3DX9_42.dll"; Components: tools
|
||||
Source: "..\..\bin\assimpcmd_release-dll_x64\assimp.exe"; DestDir: "{app}\bin\x64"; Components: tools
|
||||
Source: "..\..\bin\release\x64\assimp-vc140-mt.dll"; DestDir: "{app}\bin\x64"
|
||||
Source: "..\..\bin\release\x64\assimp_view.exe"; DestDir: "{app}\bin\x64"; Components: tools
|
||||
Source: "D3DCompiler_42_x64.dll"; DestDir: "{app}\bin\x64"; DestName: "D3DCompiler_42.dll"; Components: tools
|
||||
Source: "D3DX9_42_x64.dll"; DestDir: "{app}\bin\x64"; DestName: "D3DX9_42.dll"; Components: tools
|
||||
Source: "..\..\bin\release\x64\assimp.exe"; DestDir: "{app}\bin\x64"; Components: tools
|
||||
|
||||
; Documentation
|
||||
Source: "..\..\doc\AssimpDoc_Html\AssimpDoc.chm"; DestDir: "{app}\doc"; Components: help
|
||||
|
|
Loading…
Reference in New Issue