Merge branch 'master' into windows-crt
commit
6484dd6825
|
@ -238,6 +238,7 @@ void ObjFileMtlImporter::load() {
|
||||||
|
|
||||||
case 'a': // Anisotropy
|
case 'a': // Anisotropy
|
||||||
{
|
{
|
||||||
|
++m_DataIt;
|
||||||
getFloatValue(m_pModel->m_pCurrentMaterial->anisotropy);
|
getFloatValue(m_pModel->m_pCurrentMaterial->anisotropy);
|
||||||
m_DataIt = skipLine<DataArrayIt>(m_DataIt, m_DataItEnd, m_uiLine);
|
m_DataIt = skipLine<DataArrayIt>(m_DataIt, m_DataItEnd, m_uiLine);
|
||||||
} break;
|
} break;
|
||||||
|
|
|
@ -42,23 +42,23 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#if !defined(ASSIMP_BUILD_NO_GLTF_IMPORTER) && !defined(ASSIMP_BUILD_NO_GLTF2_IMPORTER)
|
#if !defined(ASSIMP_BUILD_NO_GLTF_IMPORTER) && !defined(ASSIMP_BUILD_NO_GLTF2_IMPORTER)
|
||||||
|
|
||||||
#include "AssetLib/glTF2/glTF2Importer.h"
|
#include "AssetLib/glTF2/glTF2Importer.h"
|
||||||
#include "PostProcessing/MakeVerboseFormat.h"
|
|
||||||
#include "AssetLib/glTF2/glTF2Asset.h"
|
#include "AssetLib/glTF2/glTF2Asset.h"
|
||||||
|
#include "PostProcessing/MakeVerboseFormat.h"
|
||||||
|
|
||||||
#if !defined(ASSIMP_BUILD_NO_EXPORT)
|
#if !defined(ASSIMP_BUILD_NO_EXPORT)
|
||||||
#include "AssetLib/glTF2/glTF2AssetWriter.h"
|
#include "AssetLib/glTF2/glTF2AssetWriter.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <assimp/CreateAnimMesh.h>
|
#include <assimp/CreateAnimMesh.h>
|
||||||
|
#include <assimp/DefaultIOSystem.h>
|
||||||
#include <assimp/StringComparison.h>
|
#include <assimp/StringComparison.h>
|
||||||
#include <assimp/StringUtils.h>
|
#include <assimp/StringUtils.h>
|
||||||
#include <assimp/ai_assert.h>
|
#include <assimp/ai_assert.h>
|
||||||
|
#include <assimp/commonMetaData.h>
|
||||||
#include <assimp/importerdesc.h>
|
#include <assimp/importerdesc.h>
|
||||||
#include <assimp/scene.h>
|
#include <assimp/scene.h>
|
||||||
#include <assimp/DefaultLogger.hpp>
|
#include <assimp/DefaultLogger.hpp>
|
||||||
#include <assimp/Importer.hpp>
|
#include <assimp/Importer.hpp>
|
||||||
#include <assimp/commonMetaData.h>
|
|
||||||
#include <assimp/DefaultIOSystem.h>
|
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
@ -186,7 +186,8 @@ static void SetMaterialTextureProperty(std::vector<int> &embeddedTexIdxs, Asset
|
||||||
const ai_real rcos(cos(-transform.mRotation));
|
const ai_real rcos(cos(-transform.mRotation));
|
||||||
const ai_real rsin(sin(-transform.mRotation));
|
const ai_real rsin(sin(-transform.mRotation));
|
||||||
transform.mTranslation.x = (static_cast<ai_real>(0.5) * transform.mScaling.x) * (-rcos + rsin + 1) + prop.TextureTransformExt_t.offset[0];
|
transform.mTranslation.x = (static_cast<ai_real>(0.5) * transform.mScaling.x) * (-rcos + rsin + 1) + prop.TextureTransformExt_t.offset[0];
|
||||||
transform.mTranslation.y = ((static_cast<ai_real>( 0.5 ) * transform.mScaling.y) * (rsin + rcos - 1)) + 1 - transform.mScaling.y - prop.TextureTransformExt_t.offset[1];;
|
transform.mTranslation.y = ((static_cast<ai_real>(0.5) * transform.mScaling.y) * (rsin + rcos - 1)) + 1 - transform.mScaling.y - prop.TextureTransformExt_t.offset[1];
|
||||||
|
;
|
||||||
|
|
||||||
mat->AddProperty(&transform, 1, _AI_MATKEY_UVTRANSFORM_BASE, texType, texSlot);
|
mat->AddProperty(&transform, 1, _AI_MATKEY_UVTRANSFORM_BASE, texType, texSlot);
|
||||||
}
|
}
|
||||||
|
@ -259,7 +260,10 @@ static aiMaterial *ImportMaterial(std::vector<int> &embeddedTexIdxs, Asset &r, M
|
||||||
SetMaterialTextureProperty(embeddedTexIdxs, r, mat.pbrMetallicRoughness.baseColorTexture, aimat, aiTextureType_DIFFUSE);
|
SetMaterialTextureProperty(embeddedTexIdxs, r, mat.pbrMetallicRoughness.baseColorTexture, aimat, aiTextureType_DIFFUSE);
|
||||||
SetMaterialTextureProperty(embeddedTexIdxs, r, mat.pbrMetallicRoughness.baseColorTexture, aimat, aiTextureType_BASE_COLOR);
|
SetMaterialTextureProperty(embeddedTexIdxs, r, mat.pbrMetallicRoughness.baseColorTexture, aimat, aiTextureType_BASE_COLOR);
|
||||||
|
|
||||||
|
// Keep AI_MATKEY_GLTF_PBRMETALLICROUGHNESS_METALLICROUGHNESS_TEXTURE for backwards compatibility
|
||||||
SetMaterialTextureProperty(embeddedTexIdxs, r, mat.pbrMetallicRoughness.metallicRoughnessTexture, aimat, AI_MATKEY_GLTF_PBRMETALLICROUGHNESS_METALLICROUGHNESS_TEXTURE);
|
SetMaterialTextureProperty(embeddedTexIdxs, r, mat.pbrMetallicRoughness.metallicRoughnessTexture, aimat, AI_MATKEY_GLTF_PBRMETALLICROUGHNESS_METALLICROUGHNESS_TEXTURE);
|
||||||
|
SetMaterialTextureProperty(embeddedTexIdxs, r, mat.pbrMetallicRoughness.metallicRoughnessTexture, aimat, aiTextureType_METALNESS);
|
||||||
|
SetMaterialTextureProperty(embeddedTexIdxs, r, mat.pbrMetallicRoughness.metallicRoughnessTexture, aimat, aiTextureType_DIFFUSE_ROUGHNESS);
|
||||||
|
|
||||||
aimat->AddProperty(&mat.pbrMetallicRoughness.metallicFactor, 1, AI_MATKEY_METALLIC_FACTOR);
|
aimat->AddProperty(&mat.pbrMetallicRoughness.metallicFactor, 1, AI_MATKEY_METALLIC_FACTOR);
|
||||||
aimat->AddProperty(&mat.pbrMetallicRoughness.roughnessFactor, 1, AI_MATKEY_ROUGHNESS_FACTOR);
|
aimat->AddProperty(&mat.pbrMetallicRoughness.roughnessFactor, 1, AI_MATKEY_ROUGHNESS_FACTOR);
|
||||||
|
@ -305,7 +309,6 @@ static aiMaterial *ImportMaterial(std::vector<int> &embeddedTexIdxs, Asset &r, M
|
||||||
|
|
||||||
aimat->AddProperty(&shadingMode, 1, AI_MATKEY_SHADING_MODEL);
|
aimat->AddProperty(&shadingMode, 1, AI_MATKEY_SHADING_MODEL);
|
||||||
|
|
||||||
|
|
||||||
// KHR_materials_sheen
|
// KHR_materials_sheen
|
||||||
if (mat.materialSheen.isPresent) {
|
if (mat.materialSheen.isPresent) {
|
||||||
MaterialSheen &sheen = mat.materialSheen.value;
|
MaterialSheen &sheen = mat.materialSheen.value;
|
||||||
|
@ -436,8 +439,7 @@ aiColor4D* GetVertexColorsForType(Ref<Accessor> input) {
|
||||||
for (size_t i = 0; i < input->count; i++) {
|
for (size_t i = 0; i < input->count; i++) {
|
||||||
output[i] = aiColor4D(
|
output[i] = aiColor4D(
|
||||||
colors[i].r / max, colors[i].g / max,
|
colors[i].r / max, colors[i].g / max,
|
||||||
colors[i].b / max, colors[i].a / max
|
colors[i].b / max, colors[i].a / max);
|
||||||
);
|
|
||||||
}
|
}
|
||||||
delete[] colors;
|
delete[] colors;
|
||||||
return output;
|
return output;
|
||||||
|
@ -1068,8 +1070,7 @@ aiNode *ImportNode(aiScene *pScene, glTF2::Asset &r, std::vector<unsigned int> &
|
||||||
|
|
||||||
if (!node.meshes.empty()) {
|
if (!node.meshes.empty()) {
|
||||||
// GLTF files contain at most 1 mesh per node.
|
// GLTF files contain at most 1 mesh per node.
|
||||||
if (node.meshes.size() > 1)
|
if (node.meshes.size() > 1) {
|
||||||
{
|
|
||||||
throw DeadlyImportError("GLTF: Invalid input, found ", node.meshes.size(),
|
throw DeadlyImportError("GLTF: Invalid input, found ", node.meshes.size(),
|
||||||
" meshes in ", getContextForErrorMessages(node.id, node.name),
|
" meshes in ", getContextForErrorMessages(node.id, node.name),
|
||||||
", but only 1 mesh per node allowed.");
|
", but only 1 mesh per node allowed.");
|
||||||
|
|
|
@ -78,6 +78,7 @@ SET( PUBLIC_HEADERS
|
||||||
${HEADER_PATH}/matrix4x4.h
|
${HEADER_PATH}/matrix4x4.h
|
||||||
${HEADER_PATH}/matrix4x4.inl
|
${HEADER_PATH}/matrix4x4.inl
|
||||||
${HEADER_PATH}/mesh.h
|
${HEADER_PATH}/mesh.h
|
||||||
|
${HEADER_PATH}/ObjMaterial.h
|
||||||
${HEADER_PATH}/pbrmaterial.h
|
${HEADER_PATH}/pbrmaterial.h
|
||||||
${HEADER_PATH}/GltfMaterial.h
|
${HEADER_PATH}/GltfMaterial.h
|
||||||
${HEADER_PATH}/postprocess.h
|
${HEADER_PATH}/postprocess.h
|
||||||
|
|
|
@ -90,12 +90,14 @@ void ArmaturePopulate::Execute(aiScene *out) {
|
||||||
|
|
||||||
ai_assert(armature);
|
ai_assert(armature);
|
||||||
|
|
||||||
|
#ifndef ASSIMP_BUILD_NO_ARMATUREPOPULATE_PROCESS
|
||||||
// set up bone armature id
|
// set up bone armature id
|
||||||
bone->mArmature = armature;
|
bone->mArmature = armature;
|
||||||
|
|
||||||
// set this bone node to be referenced properly
|
// set this bone node to be referenced properly
|
||||||
ai_assert(bone_node);
|
ai_assert(bone_node);
|
||||||
bone->mNode = bone_node;
|
bone->mNode = bone_node;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,13 +32,13 @@ PROJECT_NAME = Assimp
|
||||||
# This could be handy for archiving the generated documentation or
|
# This could be handy for archiving the generated documentation or
|
||||||
# if some version control system is used.
|
# if some version control system is used.
|
||||||
|
|
||||||
PROJECT_NUMBER = "v5.0.1. (December 2020)"
|
PROJECT_NUMBER = "v5.2.2 (January 2022)"
|
||||||
|
|
||||||
# Using the PROJECT_BRIEF tag one can provide an optional one line description
|
# Using the PROJECT_BRIEF tag one can provide an optional one line description
|
||||||
# for a project that appears at the top of each page and should give viewer
|
# for a project that appears at the top of each page and should give viewer
|
||||||
# a quick idea about the purpose of the project. Keep the description short.
|
# a quick idea about the purpose of the project. Keep the description short.
|
||||||
|
|
||||||
PROJECT_BRIEF =
|
PROJECT_BRIEF = The Asset-Importer-Lib API documentation.
|
||||||
|
|
||||||
# With the PROJECT_LOGO tag one can specify an logo or icon that is
|
# With the PROJECT_LOGO tag one can specify an logo or icon that is
|
||||||
# included in the documentation. The maximum height of the logo should not
|
# included in the documentation. The maximum height of the logo should not
|
||||||
|
|
|
@ -73,8 +73,7 @@ const char *TREE_STOP = TREE_STOP_UTF8;
|
||||||
const char *TREE_CONTINUE = TREE_CONTINUE_UTF8;
|
const char *TREE_CONTINUE = TREE_CONTINUE_UTF8;
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------
|
||||||
unsigned int CountNodes(const aiNode* root)
|
unsigned int CountNodes(const aiNode *root) {
|
||||||
{
|
|
||||||
unsigned int i = 0;
|
unsigned int i = 0;
|
||||||
for (unsigned int a = 0; a < root->mNumChildren; ++a) {
|
for (unsigned int a = 0; a < root->mNumChildren; ++a) {
|
||||||
i += CountNodes(root->mChildren[a]);
|
i += CountNodes(root->mChildren[a]);
|
||||||
|
@ -83,8 +82,7 @@ unsigned int CountNodes(const aiNode* root)
|
||||||
}
|
}
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------
|
||||||
unsigned int GetMaxDepth(const aiNode* root)
|
unsigned int GetMaxDepth(const aiNode *root) {
|
||||||
{
|
|
||||||
unsigned int cnt = 0;
|
unsigned int cnt = 0;
|
||||||
for (unsigned int i = 0; i < root->mNumChildren; ++i) {
|
for (unsigned int i = 0; i < root->mNumChildren; ++i) {
|
||||||
cnt = std::max(cnt, GetMaxDepth(root->mChildren[i]));
|
cnt = std::max(cnt, GetMaxDepth(root->mChildren[i]));
|
||||||
|
@ -93,8 +91,7 @@ unsigned int GetMaxDepth(const aiNode* root)
|
||||||
}
|
}
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------
|
||||||
unsigned int CountVertices(const aiScene* scene)
|
unsigned int CountVertices(const aiScene *scene) {
|
||||||
{
|
|
||||||
unsigned int cnt = 0;
|
unsigned int cnt = 0;
|
||||||
for (unsigned int i = 0; i < scene->mNumMeshes; ++i) {
|
for (unsigned int i = 0; i < scene->mNumMeshes; ++i) {
|
||||||
cnt += scene->mMeshes[i]->mNumVertices;
|
cnt += scene->mMeshes[i]->mNumVertices;
|
||||||
|
@ -103,8 +100,7 @@ unsigned int CountVertices(const aiScene* scene)
|
||||||
}
|
}
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------
|
||||||
unsigned int CountFaces(const aiScene* scene)
|
unsigned int CountFaces(const aiScene *scene) {
|
||||||
{
|
|
||||||
unsigned int cnt = 0;
|
unsigned int cnt = 0;
|
||||||
for (unsigned int i = 0; i < scene->mNumMeshes; ++i) {
|
for (unsigned int i = 0; i < scene->mNumMeshes; ++i) {
|
||||||
cnt += scene->mMeshes[i]->mNumFaces;
|
cnt += scene->mMeshes[i]->mNumFaces;
|
||||||
|
@ -113,8 +109,7 @@ unsigned int CountFaces(const aiScene* scene)
|
||||||
}
|
}
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------
|
||||||
unsigned int CountBones(const aiScene* scene)
|
unsigned int CountBones(const aiScene *scene) {
|
||||||
{
|
|
||||||
unsigned int cnt = 0;
|
unsigned int cnt = 0;
|
||||||
for (unsigned int i = 0; i < scene->mNumMeshes; ++i) {
|
for (unsigned int i = 0; i < scene->mNumMeshes; ++i) {
|
||||||
cnt += scene->mMeshes[i]->mNumBones;
|
cnt += scene->mMeshes[i]->mNumBones;
|
||||||
|
@ -123,8 +118,7 @@ unsigned int CountBones(const aiScene* scene)
|
||||||
}
|
}
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------
|
||||||
unsigned int CountAnimChannels(const aiScene* scene)
|
unsigned int CountAnimChannels(const aiScene *scene) {
|
||||||
{
|
|
||||||
unsigned int cnt = 0;
|
unsigned int cnt = 0;
|
||||||
for (unsigned int i = 0; i < scene->mNumAnimations; ++i) {
|
for (unsigned int i = 0; i < scene->mNumAnimations; ++i) {
|
||||||
cnt += scene->mAnimations[i]->mNumChannels;
|
cnt += scene->mAnimations[i]->mNumChannels;
|
||||||
|
@ -143,8 +137,7 @@ unsigned int GetAvgVertsPerMesh(const aiScene* scene) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------
|
||||||
void FindSpecialPoints(const aiScene* scene,const aiNode* root,aiVector3D special_points[3],const aiMatrix4x4& mat=aiMatrix4x4())
|
void FindSpecialPoints(const aiScene *scene, const aiNode *root, aiVector3D special_points[3], const aiMatrix4x4 &mat = aiMatrix4x4()) {
|
||||||
{
|
|
||||||
// XXX that could be greatly simplified by using code from code/ProcessHelper.h
|
// XXX that could be greatly simplified by using code from code/ProcessHelper.h
|
||||||
// XXX I just don't want to include it here.
|
// XXX I just don't want to include it here.
|
||||||
const aiMatrix4x4 trafo = root->mTransformation * mat;
|
const aiMatrix4x4 trafo = root->mTransformation * mat;
|
||||||
|
@ -170,8 +163,7 @@ void FindSpecialPoints(const aiScene* scene,const aiNode* root,aiVector3D specia
|
||||||
}
|
}
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------
|
||||||
void FindSpecialPoints(const aiScene* scene,aiVector3D special_points[3])
|
void FindSpecialPoints(const aiScene *scene, aiVector3D special_points[3]) {
|
||||||
{
|
|
||||||
special_points[0] = aiVector3D(1e10, 1e10, 1e10);
|
special_points[0] = aiVector3D(1e10, 1e10, 1e10);
|
||||||
special_points[1] = aiVector3D(-1e10, -1e10, -1e10);
|
special_points[1] = aiVector3D(-1e10, -1e10, -1e10);
|
||||||
|
|
||||||
|
@ -180,8 +172,7 @@ void FindSpecialPoints(const aiScene* scene,aiVector3D special_points[3])
|
||||||
}
|
}
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------
|
||||||
std::string FindPTypes(const aiScene* scene)
|
std::string FindPTypes(const aiScene *scene) {
|
||||||
{
|
|
||||||
bool haveit[4] = { 0 };
|
bool haveit[4] = { 0 };
|
||||||
for (unsigned int i = 0; i < scene->mNumMeshes; ++i) {
|
for (unsigned int i = 0; i < scene->mNumMeshes; ++i) {
|
||||||
const unsigned int pt = scene->mMeshes[i]->mPrimitiveTypes;
|
const unsigned int pt = scene->mMeshes[i]->mPrimitiveTypes;
|
||||||
|
@ -209,13 +200,17 @@ void PrintHierarchy(
|
||||||
const std::string &indent,
|
const std::string &indent,
|
||||||
bool verbose,
|
bool verbose,
|
||||||
bool last = false,
|
bool last = false,
|
||||||
bool first = true
|
bool first = true) {
|
||||||
){
|
|
||||||
// tree visualization
|
// tree visualization
|
||||||
std::string branchchar;
|
std::string branchchar;
|
||||||
if (first) { branchchar = ""; }
|
if (first) {
|
||||||
else if (last) { branchchar = TREE_STOP; } // "'-"
|
branchchar = "";
|
||||||
else { branchchar = TREE_BRANCH; } // "|-"
|
} else if (last) {
|
||||||
|
branchchar = TREE_STOP;
|
||||||
|
} // "'-"
|
||||||
|
else {
|
||||||
|
branchchar = TREE_BRANCH;
|
||||||
|
} // "|-"
|
||||||
|
|
||||||
// print the indent and the branch character and the name
|
// print the indent and the branch character and the name
|
||||||
std::cout << indent << branchchar << node->mName.C_Str();
|
std::cout << indent << branchchar << node->mName.C_Str();
|
||||||
|
@ -226,7 +221,9 @@ void PrintHierarchy(
|
||||||
bool sep = false;
|
bool sep = false;
|
||||||
for (size_t i = 0; i < node->mNumMeshes; ++i) {
|
for (size_t i = 0; i < node->mNumMeshes; ++i) {
|
||||||
unsigned int mesh_index = node->mMeshes[i];
|
unsigned int mesh_index = node->mMeshes[i];
|
||||||
if (sep) { std::cout << ", "; }
|
if (sep) {
|
||||||
|
std::cout << ", ";
|
||||||
|
}
|
||||||
std::cout << mesh_index;
|
std::cout << mesh_index;
|
||||||
sep = true;
|
sep = true;
|
||||||
}
|
}
|
||||||
|
@ -240,10 +237,16 @@ void PrintHierarchy(
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
// indent to use
|
// indent to use
|
||||||
std::string indentadd;
|
std::string indentadd;
|
||||||
if (last) { indentadd += " "; }
|
if (last) {
|
||||||
else { indentadd += TREE_CONTINUE; } // "| "..
|
indentadd += " ";
|
||||||
if (node->mNumChildren == 0) { indentadd += " "; }
|
} else {
|
||||||
else { indentadd += TREE_CONTINUE; } // .."| "
|
indentadd += TREE_CONTINUE;
|
||||||
|
} // "| "..
|
||||||
|
if (node->mNumChildren == 0) {
|
||||||
|
indentadd += " ";
|
||||||
|
} else {
|
||||||
|
indentadd += TREE_CONTINUE;
|
||||||
|
} // .."| "
|
||||||
aiVector3D s, r, t;
|
aiVector3D s, r, t;
|
||||||
node->mTransformation.Decompose(s, r, t);
|
node->mTransformation.Decompose(s, r, t);
|
||||||
if (s.x != 1.0 || s.y != 1.0 || s.z != 1.0) {
|
if (s.x != 1.0 || s.y != 1.0 || s.z != 1.0) {
|
||||||
|
@ -262,9 +265,13 @@ void PrintHierarchy(
|
||||||
|
|
||||||
// and recurse
|
// and recurse
|
||||||
std::string nextIndent;
|
std::string nextIndent;
|
||||||
if (first) { nextIndent = indent; }
|
if (first) {
|
||||||
else if (last) { nextIndent = indent + " "; }
|
nextIndent = indent;
|
||||||
else { nextIndent = indent + TREE_CONTINUE; } // "| "
|
} else if (last) {
|
||||||
|
nextIndent = indent + " ";
|
||||||
|
} else {
|
||||||
|
nextIndent = indent + TREE_CONTINUE;
|
||||||
|
} // "| "
|
||||||
for (size_t i = 0; i < node->mNumChildren; ++i) {
|
for (size_t i = 0; i < node->mNumChildren; ++i) {
|
||||||
bool lastone = (i == node->mNumChildren - 1);
|
bool lastone = (i == node->mNumChildren - 1);
|
||||||
PrintHierarchy(
|
PrintHierarchy(
|
||||||
|
@ -272,8 +279,7 @@ void PrintHierarchy(
|
||||||
nextIndent,
|
nextIndent,
|
||||||
verbose,
|
verbose,
|
||||||
lastone,
|
lastone,
|
||||||
false
|
false);
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -339,7 +345,6 @@ int Assimp_Info (const char* const* params, unsigned int num) {
|
||||||
aiMemoryInfo mem;
|
aiMemoryInfo mem;
|
||||||
globalImporter->GetMemoryRequirements(mem);
|
globalImporter->GetMemoryRequirements(mem);
|
||||||
|
|
||||||
|
|
||||||
static const char *format_string =
|
static const char *format_string =
|
||||||
"Memory consumption: %i B\n"
|
"Memory consumption: %i B\n"
|
||||||
"Nodes: %i\n"
|
"Nodes: %i\n"
|
||||||
|
@ -384,12 +389,9 @@ int Assimp_Info (const char* const* params, unsigned int num) {
|
||||||
GetAvgVertsPerMesh(scene),
|
GetAvgVertsPerMesh(scene),
|
||||||
special_points[0][0], special_points[0][1], special_points[0][2],
|
special_points[0][0], special_points[0][1], special_points[0][2],
|
||||||
special_points[1][0], special_points[1][1], special_points[1][2],
|
special_points[1][0], special_points[1][1], special_points[1][2],
|
||||||
special_points[2][0],special_points[2][1],special_points[2][2]
|
special_points[2][0], special_points[2][1], special_points[2][2]);
|
||||||
)
|
|
||||||
;
|
|
||||||
|
|
||||||
if (silent)
|
if (silent) {
|
||||||
{
|
|
||||||
printf("\n");
|
printf("\n");
|
||||||
return AssimpCmdError::Success;
|
return AssimpCmdError::Success;
|
||||||
}
|
}
|
||||||
|
@ -405,30 +407,49 @@ int Assimp_Info (const char* const* params, unsigned int num) {
|
||||||
": [%d / %d / %d |",
|
": [%d / %d / %d |",
|
||||||
mesh->mNumVertices,
|
mesh->mNumVertices,
|
||||||
mesh->mNumBones,
|
mesh->mNumBones,
|
||||||
mesh->mNumFaces
|
mesh->mNumFaces);
|
||||||
);
|
|
||||||
const unsigned int ptypes = mesh->mPrimitiveTypes;
|
const unsigned int ptypes = mesh->mPrimitiveTypes;
|
||||||
if (ptypes & aiPrimitiveType_POINT) { printf(" point"); }
|
if (ptypes & aiPrimitiveType_POINT) {
|
||||||
if (ptypes & aiPrimitiveType_LINE) { printf(" line"); }
|
printf(" point");
|
||||||
if (ptypes & aiPrimitiveType_TRIANGLE) { printf(" triangle"); }
|
}
|
||||||
if (ptypes & aiPrimitiveType_POLYGON) { printf(" polygon"); }
|
if (ptypes & aiPrimitiveType_LINE) {
|
||||||
|
printf(" line");
|
||||||
|
}
|
||||||
|
if (ptypes & aiPrimitiveType_TRIANGLE) {
|
||||||
|
printf(" triangle");
|
||||||
|
}
|
||||||
|
if (ptypes & aiPrimitiveType_POLYGON) {
|
||||||
|
printf(" polygon");
|
||||||
|
}
|
||||||
printf("]\n");
|
printf("]\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
// materials
|
// materials
|
||||||
unsigned int total=0;
|
if (scene->mNumMaterials)
|
||||||
|
printf("\nNamed Materials:");
|
||||||
for (unsigned int i = 0; i < scene->mNumMaterials; ++i) {
|
for (unsigned int i = 0; i < scene->mNumMaterials; ++i) {
|
||||||
aiString name;
|
const aiMaterial *mat = scene->mMaterials[i];
|
||||||
if (AI_SUCCESS==aiGetMaterialString(scene->mMaterials[i],AI_MATKEY_NAME,&name)) {
|
aiString name = mat->GetName();
|
||||||
printf("%s\n \'%s\'",(total++?"":"\nNamed Materials:" ),name.data);
|
printf("\n \'%s\'", name.data);
|
||||||
|
if (mat->mNumProperties)
|
||||||
|
printf(" (prop) [index / bytes | texture semantic]");
|
||||||
|
for (unsigned p = 0; p < mat->mNumProperties; p++) {
|
||||||
|
const aiMaterialProperty *prop = mat->mProperties[p];
|
||||||
|
const aiTextureType textype = static_cast<aiTextureType>(prop->mSemantic);
|
||||||
|
printf("\n %d (%s): [%d / %d | %s]",
|
||||||
|
p,
|
||||||
|
prop->mKey.data,
|
||||||
|
prop->mIndex,
|
||||||
|
prop->mDataLength,
|
||||||
|
TextureTypeToString(textype));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(total) {
|
if (scene->mNumMaterials) {
|
||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
// textures
|
// textures
|
||||||
total=0;
|
unsigned int total = 0;
|
||||||
for (unsigned int i = 0; i < scene->mNumMaterials; ++i) {
|
for (unsigned int i = 0; i < scene->mNumMaterials; ++i) {
|
||||||
aiString name;
|
aiString name;
|
||||||
static const aiTextureType types[] = {
|
static const aiTextureType types[] = {
|
||||||
|
@ -454,7 +475,8 @@ int Assimp_Info (const char* const* params, unsigned int num) {
|
||||||
};
|
};
|
||||||
for (unsigned int type = 0; type < sizeof(types) / sizeof(types[0]); ++type) {
|
for (unsigned int type = 0; type < sizeof(types) / sizeof(types[0]); ++type) {
|
||||||
for (unsigned int idx = 0; AI_SUCCESS == aiGetMaterialString(scene->mMaterials[i],
|
for (unsigned int idx = 0; AI_SUCCESS == aiGetMaterialString(scene->mMaterials[i],
|
||||||
AI_MATKEY_TEXTURE(types[type],idx),&name); ++idx) {
|
AI_MATKEY_TEXTURE(types[type], idx), &name);
|
||||||
|
++idx) {
|
||||||
printf("%s\n \'%s\'", (total++ ? "" : "\nTexture Refs:"), name.data);
|
printf("%s\n \'%s\'", (total++ ? "" : "\nTexture Refs:"), name.data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue