Apply clangformat
parent
d8575b2b55
commit
463573c771
|
@ -43,13 +43,12 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
* @brief Implementation of the aiProcess_OptimizGraph step
|
* @brief Implementation of the aiProcess_OptimizGraph step
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifndef ASSIMP_BUILD_NO_OPTIMIZEGRAPH_PROCESS
|
#ifndef ASSIMP_BUILD_NO_OPTIMIZEGRAPH_PROCESS
|
||||||
|
|
||||||
#include "OptimizeGraph.h"
|
#include "OptimizeGraph.h"
|
||||||
#include "ProcessHelper.h"
|
#include "ProcessHelper.h"
|
||||||
#include <assimp/SceneCombiner.h>
|
|
||||||
#include <assimp/Exceptional.h>
|
#include <assimp/Exceptional.h>
|
||||||
|
#include <assimp/SceneCombiner.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
using namespace Assimp;
|
using namespace Assimp;
|
||||||
|
@ -60,292 +59,290 @@ using namespace Assimp;
|
||||||
* The unhashed variant should be faster, except for *very* large data sets
|
* The unhashed variant should be faster, except for *very* large data sets
|
||||||
*/
|
*/
|
||||||
#ifdef AI_OG_USE_HASHING
|
#ifdef AI_OG_USE_HASHING
|
||||||
// Use our standard hashing function to compute the hash
|
// Use our standard hashing function to compute the hash
|
||||||
# define AI_OG_GETKEY(str) SuperFastHash(str.data,str.length)
|
#define AI_OG_GETKEY(str) SuperFastHash(str.data, str.length)
|
||||||
#else
|
#else
|
||||||
// Otherwise hope that std::string will utilize a static buffer
|
// Otherwise hope that std::string will utilize a static buffer
|
||||||
// for shorter node names. This would avoid endless heap copying.
|
// for shorter node names. This would avoid endless heap copying.
|
||||||
# define AI_OG_GETKEY(str) std::string(str.data)
|
#define AI_OG_GETKEY(str) std::string(str.data)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Constructor to be privately used by Importer
|
// Constructor to be privately used by Importer
|
||||||
OptimizeGraphProcess::OptimizeGraphProcess()
|
OptimizeGraphProcess::OptimizeGraphProcess() :
|
||||||
: mScene()
|
mScene(),
|
||||||
, nodes_in()
|
nodes_in(),
|
||||||
, nodes_out()
|
nodes_out(),
|
||||||
, count_merged() {
|
count_merged() {
|
||||||
// empty
|
// empty
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Destructor, private as well
|
// Destructor, private as well
|
||||||
OptimizeGraphProcess::~OptimizeGraphProcess() {
|
OptimizeGraphProcess::~OptimizeGraphProcess() {
|
||||||
// empty
|
// empty
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Returns whether the processing step is present in the given flag field.
|
// Returns whether the processing step is present in the given flag field.
|
||||||
bool OptimizeGraphProcess::IsActive( unsigned int pFlags) const {
|
bool OptimizeGraphProcess::IsActive(unsigned int pFlags) const {
|
||||||
return (0 != (pFlags & aiProcess_OptimizeGraph));
|
return (0 != (pFlags & aiProcess_OptimizeGraph));
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Setup properties for the post-processing step
|
// Setup properties for the post-processing step
|
||||||
void OptimizeGraphProcess::SetupProperties(const Importer* pImp) {
|
void OptimizeGraphProcess::SetupProperties(const Importer *pImp) {
|
||||||
// Get value of AI_CONFIG_PP_OG_EXCLUDE_LIST
|
// Get value of AI_CONFIG_PP_OG_EXCLUDE_LIST
|
||||||
std::string tmp = pImp->GetPropertyString(AI_CONFIG_PP_OG_EXCLUDE_LIST,"");
|
std::string tmp = pImp->GetPropertyString(AI_CONFIG_PP_OG_EXCLUDE_LIST, "");
|
||||||
AddLockedNodeList(tmp);
|
AddLockedNodeList(tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Collect new children
|
// Collect new children
|
||||||
void OptimizeGraphProcess::CollectNewChildren(aiNode* nd, std::list<aiNode*>& nodes) {
|
void OptimizeGraphProcess::CollectNewChildren(aiNode *nd, std::list<aiNode *> &nodes) {
|
||||||
nodes_in += nd->mNumChildren;
|
nodes_in += nd->mNumChildren;
|
||||||
|
|
||||||
// Process children
|
// Process children
|
||||||
std::list<aiNode*> child_nodes;
|
std::list<aiNode *> child_nodes;
|
||||||
for (unsigned int i = 0; i < nd->mNumChildren; ++i) {
|
for (unsigned int i = 0; i < nd->mNumChildren; ++i) {
|
||||||
CollectNewChildren(nd->mChildren[i],child_nodes);
|
CollectNewChildren(nd->mChildren[i], child_nodes);
|
||||||
nd->mChildren[i] = nullptr;
|
nd->mChildren[i] = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check whether we need this node; if not we can replace it by our own children (warn, danger of incest).
|
// Check whether we need this node; if not we can replace it by our own children (warn, danger of incest).
|
||||||
if (locked.find(AI_OG_GETKEY(nd->mName)) == locked.end() ) {
|
if (locked.find(AI_OG_GETKEY(nd->mName)) == locked.end()) {
|
||||||
for (std::list<aiNode*>::iterator it = child_nodes.begin(); it != child_nodes.end();) {
|
for (std::list<aiNode *>::iterator it = child_nodes.begin(); it != child_nodes.end();) {
|
||||||
|
|
||||||
if (locked.find(AI_OG_GETKEY((*it)->mName)) == locked.end()) {
|
if (locked.find(AI_OG_GETKEY((*it)->mName)) == locked.end()) {
|
||||||
(*it)->mTransformation = nd->mTransformation * (*it)->mTransformation;
|
(*it)->mTransformation = nd->mTransformation * (*it)->mTransformation;
|
||||||
nodes.push_back(*it);
|
nodes.push_back(*it);
|
||||||
|
|
||||||
it = child_nodes.erase(it);
|
it = child_nodes.erase(it);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
++it;
|
++it;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nd->mNumMeshes || !child_nodes.empty()) {
|
if (nd->mNumMeshes || !child_nodes.empty()) {
|
||||||
nodes.push_back(nd);
|
nodes.push_back(nd);
|
||||||
} else {
|
} else {
|
||||||
delete nd; /* bye, node */
|
delete nd; /* bye, node */
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
// Retain our current position in the hierarchy
|
// Retain our current position in the hierarchy
|
||||||
nodes.push_back(nd);
|
nodes.push_back(nd);
|
||||||
|
|
||||||
// Now check for possible optimizations in our list of child nodes. join as many as possible
|
// Now check for possible optimizations in our list of child nodes. join as many as possible
|
||||||
aiNode* join_master = NULL;
|
aiNode *join_master = NULL;
|
||||||
aiMatrix4x4 inv;
|
aiMatrix4x4 inv;
|
||||||
|
|
||||||
const LockedSetType::const_iterator end = locked.end();
|
const LockedSetType::const_iterator end = locked.end();
|
||||||
|
|
||||||
std::list<aiNode*> join;
|
std::list<aiNode *> join;
|
||||||
for (std::list<aiNode*>::iterator it = child_nodes.begin(); it != child_nodes.end();) {
|
for (std::list<aiNode *>::iterator it = child_nodes.begin(); it != child_nodes.end();) {
|
||||||
aiNode* child = *it;
|
aiNode *child = *it;
|
||||||
if (child->mNumChildren == 0 && locked.find(AI_OG_GETKEY(child->mName)) == end) {
|
if (child->mNumChildren == 0 && locked.find(AI_OG_GETKEY(child->mName)) == end) {
|
||||||
|
|
||||||
// There may be no instanced meshes
|
// There may be no instanced meshes
|
||||||
unsigned int n = 0;
|
unsigned int n = 0;
|
||||||
for (; n < child->mNumMeshes;++n) {
|
for (; n < child->mNumMeshes; ++n) {
|
||||||
if (meshes[child->mMeshes[n]] > 1) {
|
if (meshes[child->mMeshes[n]] > 1) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (n == child->mNumMeshes) {
|
if (n == child->mNumMeshes) {
|
||||||
if (!join_master) {
|
if (!join_master) {
|
||||||
join_master = child;
|
join_master = child;
|
||||||
inv = join_master->mTransformation;
|
inv = join_master->mTransformation;
|
||||||
inv.Inverse();
|
inv.Inverse();
|
||||||
} else {
|
} else {
|
||||||
child->mTransformation = inv * child->mTransformation ;
|
child->mTransformation = inv * child->mTransformation;
|
||||||
|
|
||||||
join.push_back(child);
|
join.push_back(child);
|
||||||
it = child_nodes.erase(it);
|
it = child_nodes.erase(it);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
++it;
|
++it;
|
||||||
}
|
}
|
||||||
if (join_master && !join.empty()) {
|
if (join_master && !join.empty()) {
|
||||||
join_master->mName.length = ::ai_snprintf(join_master->mName.data, MAXLEN, "$MergedNode_%i",count_merged++);
|
join_master->mName.length = ::ai_snprintf(join_master->mName.data, MAXLEN, "$MergedNode_%i", count_merged++);
|
||||||
|
|
||||||
unsigned int out_meshes = 0;
|
unsigned int out_meshes = 0;
|
||||||
for (std::list<aiNode*>::iterator it = join.begin(); it != join.end(); ++it) {
|
for (std::list<aiNode *>::iterator it = join.begin(); it != join.end(); ++it) {
|
||||||
out_meshes += (*it)->mNumMeshes;
|
out_meshes += (*it)->mNumMeshes;
|
||||||
}
|
}
|
||||||
|
|
||||||
// copy all mesh references in one array
|
// copy all mesh references in one array
|
||||||
if (out_meshes) {
|
if (out_meshes) {
|
||||||
unsigned int* meshes = new unsigned int[out_meshes+join_master->mNumMeshes], *tmp = meshes;
|
unsigned int *meshes = new unsigned int[out_meshes + join_master->mNumMeshes], *tmp = meshes;
|
||||||
for (unsigned int n = 0; n < join_master->mNumMeshes;++n) {
|
for (unsigned int n = 0; n < join_master->mNumMeshes; ++n) {
|
||||||
*tmp++ = join_master->mMeshes[n];
|
*tmp++ = join_master->mMeshes[n];
|
||||||
}
|
}
|
||||||
|
|
||||||
for (std::list<aiNode*>::iterator it = join.begin(); it != join.end(); ++it) {
|
for (std::list<aiNode *>::iterator it = join.begin(); it != join.end(); ++it) {
|
||||||
for (unsigned int n = 0; n < (*it)->mNumMeshes; ++n) {
|
for (unsigned int n = 0; n < (*it)->mNumMeshes; ++n) {
|
||||||
|
|
||||||
*tmp = (*it)->mMeshes[n];
|
*tmp = (*it)->mMeshes[n];
|
||||||
aiMesh* mesh = mScene->mMeshes[*tmp++];
|
aiMesh *mesh = mScene->mMeshes[*tmp++];
|
||||||
|
|
||||||
// manually move the mesh into the right coordinate system
|
// manually move the mesh into the right coordinate system
|
||||||
const aiMatrix3x3 IT = aiMatrix3x3( (*it)->mTransformation ).Inverse().Transpose();
|
const aiMatrix3x3 IT = aiMatrix3x3((*it)->mTransformation).Inverse().Transpose();
|
||||||
for (unsigned int a = 0; a < mesh->mNumVertices; ++a) {
|
for (unsigned int a = 0; a < mesh->mNumVertices; ++a) {
|
||||||
|
|
||||||
mesh->mVertices[a] *= (*it)->mTransformation;
|
mesh->mVertices[a] *= (*it)->mTransformation;
|
||||||
|
|
||||||
if (mesh->HasNormals())
|
if (mesh->HasNormals())
|
||||||
mesh->mNormals[a] *= IT;
|
mesh->mNormals[a] *= IT;
|
||||||
|
|
||||||
if (mesh->HasTangentsAndBitangents()) {
|
if (mesh->HasTangentsAndBitangents()) {
|
||||||
mesh->mTangents[a] *= IT;
|
mesh->mTangents[a] *= IT;
|
||||||
mesh->mBitangents[a] *= IT;
|
mesh->mBitangents[a] *= IT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
delete *it; // bye, node
|
delete *it; // bye, node
|
||||||
}
|
}
|
||||||
delete[] join_master->mMeshes;
|
delete[] join_master->mMeshes;
|
||||||
join_master->mMeshes = meshes;
|
join_master->mMeshes = meshes;
|
||||||
join_master->mNumMeshes += out_meshes;
|
join_master->mNumMeshes += out_meshes;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// reassign children if something changed
|
// reassign children if something changed
|
||||||
if (child_nodes.empty() || child_nodes.size() > nd->mNumChildren) {
|
if (child_nodes.empty() || child_nodes.size() > nd->mNumChildren) {
|
||||||
|
|
||||||
delete[] nd->mChildren;
|
delete[] nd->mChildren;
|
||||||
|
|
||||||
if (!child_nodes.empty()) {
|
if (!child_nodes.empty()) {
|
||||||
nd->mChildren = new aiNode*[child_nodes.size()];
|
nd->mChildren = new aiNode *[child_nodes.size()];
|
||||||
}
|
} else
|
||||||
else nd->mChildren = nullptr;
|
nd->mChildren = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
nd->mNumChildren = static_cast<unsigned int>(child_nodes.size());
|
nd->mNumChildren = static_cast<unsigned int>(child_nodes.size());
|
||||||
|
|
||||||
if (nd->mChildren) {
|
if (nd->mChildren) {
|
||||||
aiNode** tmp = nd->mChildren;
|
aiNode **tmp = nd->mChildren;
|
||||||
for (std::list<aiNode*>::iterator it = child_nodes.begin(); it != child_nodes.end(); ++it) {
|
for (std::list<aiNode *>::iterator it = child_nodes.begin(); it != child_nodes.end(); ++it) {
|
||||||
aiNode* node = *tmp++ = *it;
|
aiNode *node = *tmp++ = *it;
|
||||||
node->mParent = nd;
|
node->mParent = nd;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
nodes_out += static_cast<unsigned int>(child_nodes.size());
|
nodes_out += static_cast<unsigned int>(child_nodes.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Execute the post-processing step on the given scene
|
// Execute the post-processing step on the given scene
|
||||||
void OptimizeGraphProcess::Execute( aiScene* pScene) {
|
void OptimizeGraphProcess::Execute(aiScene *pScene) {
|
||||||
ASSIMP_LOG_DEBUG("OptimizeGraphProcess begin");
|
ASSIMP_LOG_DEBUG("OptimizeGraphProcess begin");
|
||||||
nodes_in = nodes_out = count_merged = 0;
|
nodes_in = nodes_out = count_merged = 0;
|
||||||
mScene = pScene;
|
mScene = pScene;
|
||||||
|
|
||||||
meshes.resize(pScene->mNumMeshes,0);
|
meshes.resize(pScene->mNumMeshes, 0);
|
||||||
FindInstancedMeshes(pScene->mRootNode);
|
FindInstancedMeshes(pScene->mRootNode);
|
||||||
|
|
||||||
// build a blacklist of identifiers. If the name of a node matches one of these, we won't touch it
|
// build a blacklist of identifiers. If the name of a node matches one of these, we won't touch it
|
||||||
locked.clear();
|
locked.clear();
|
||||||
for (std::list<std::string>::const_iterator it = locked_nodes.begin(); it != locked_nodes.end(); ++it) {
|
for (std::list<std::string>::const_iterator it = locked_nodes.begin(); it != locked_nodes.end(); ++it) {
|
||||||
#ifdef AI_OG_USE_HASHING
|
#ifdef AI_OG_USE_HASHING
|
||||||
locked.insert(SuperFastHash((*it).c_str()));
|
locked.insert(SuperFastHash((*it).c_str()));
|
||||||
#else
|
#else
|
||||||
locked.insert(*it);
|
locked.insert(*it);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
for (unsigned int i = 0; i < pScene->mNumAnimations; ++i) {
|
for (unsigned int i = 0; i < pScene->mNumAnimations; ++i) {
|
||||||
for (unsigned int a = 0; a < pScene->mAnimations[i]->mNumChannels; ++a) {
|
for (unsigned int a = 0; a < pScene->mAnimations[i]->mNumChannels; ++a) {
|
||||||
aiNodeAnim* anim = pScene->mAnimations[i]->mChannels[a];
|
aiNodeAnim *anim = pScene->mAnimations[i]->mChannels[a];
|
||||||
locked.insert(AI_OG_GETKEY(anim->mNodeName));
|
locked.insert(AI_OG_GETKEY(anim->mNodeName));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (unsigned int i = 0; i < pScene->mNumMeshes; ++i) {
|
for (unsigned int i = 0; i < pScene->mNumMeshes; ++i) {
|
||||||
for (unsigned int a = 0; a < pScene->mMeshes[i]->mNumBones; ++a) {
|
for (unsigned int a = 0; a < pScene->mMeshes[i]->mNumBones; ++a) {
|
||||||
|
|
||||||
aiBone* bone = pScene->mMeshes[i]->mBones[a];
|
aiBone *bone = pScene->mMeshes[i]->mBones[a];
|
||||||
locked.insert(AI_OG_GETKEY(bone->mName));
|
locked.insert(AI_OG_GETKEY(bone->mName));
|
||||||
|
|
||||||
// HACK: Meshes referencing bones may not be transformed; we need to look them.
|
// HACK: Meshes referencing bones may not be transformed; we need to look them.
|
||||||
// The easiest way to do this is to increase their reference counters ...
|
// The easiest way to do this is to increase their reference counters ...
|
||||||
meshes[i] += 2;
|
meshes[i] += 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (unsigned int i = 0; i < pScene->mNumCameras; ++i) {
|
for (unsigned int i = 0; i < pScene->mNumCameras; ++i) {
|
||||||
aiCamera* cam = pScene->mCameras[i];
|
aiCamera *cam = pScene->mCameras[i];
|
||||||
locked.insert(AI_OG_GETKEY(cam->mName));
|
locked.insert(AI_OG_GETKEY(cam->mName));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (unsigned int i = 0; i < pScene->mNumLights; ++i) {
|
for (unsigned int i = 0; i < pScene->mNumLights; ++i) {
|
||||||
aiLight* lgh = pScene->mLights[i];
|
aiLight *lgh = pScene->mLights[i];
|
||||||
locked.insert(AI_OG_GETKEY(lgh->mName));
|
locked.insert(AI_OG_GETKEY(lgh->mName));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Insert a dummy master node and make it read-only
|
// Insert a dummy master node and make it read-only
|
||||||
aiNode* dummy_root = new aiNode(AI_RESERVED_NODE_NAME);
|
aiNode *dummy_root = new aiNode(AI_RESERVED_NODE_NAME);
|
||||||
locked.insert(AI_OG_GETKEY(dummy_root->mName));
|
locked.insert(AI_OG_GETKEY(dummy_root->mName));
|
||||||
|
|
||||||
const aiString prev = pScene->mRootNode->mName;
|
const aiString prev = pScene->mRootNode->mName;
|
||||||
pScene->mRootNode->mParent = dummy_root;
|
pScene->mRootNode->mParent = dummy_root;
|
||||||
|
|
||||||
dummy_root->mChildren = new aiNode*[dummy_root->mNumChildren = 1];
|
dummy_root->mChildren = new aiNode *[dummy_root->mNumChildren = 1];
|
||||||
dummy_root->mChildren[0] = pScene->mRootNode;
|
dummy_root->mChildren[0] = pScene->mRootNode;
|
||||||
|
|
||||||
// Do our recursive processing of scenegraph nodes. For each node collect
|
// Do our recursive processing of scenegraph nodes. For each node collect
|
||||||
// a fully new list of children and allow their children to place themselves
|
// a fully new list of children and allow their children to place themselves
|
||||||
// on the same hierarchy layer as their parents.
|
// on the same hierarchy layer as their parents.
|
||||||
std::list<aiNode*> nodes;
|
std::list<aiNode *> nodes;
|
||||||
CollectNewChildren (dummy_root,nodes);
|
CollectNewChildren(dummy_root, nodes);
|
||||||
|
|
||||||
ai_assert(nodes.size() == 1);
|
ai_assert(nodes.size() == 1);
|
||||||
|
|
||||||
if (dummy_root->mNumChildren == 0) {
|
if (dummy_root->mNumChildren == 0) {
|
||||||
pScene->mRootNode = NULL;
|
pScene->mRootNode = NULL;
|
||||||
throw DeadlyImportError("After optimizing the scene graph, no data remains");
|
throw DeadlyImportError("After optimizing the scene graph, no data remains");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dummy_root->mNumChildren > 1) {
|
if (dummy_root->mNumChildren > 1) {
|
||||||
pScene->mRootNode = dummy_root;
|
pScene->mRootNode = dummy_root;
|
||||||
|
|
||||||
// Keep the dummy node but assign the name of the old root node to it
|
// Keep the dummy node but assign the name of the old root node to it
|
||||||
pScene->mRootNode->mName = prev;
|
pScene->mRootNode->mName = prev;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
|
|
||||||
// Remove the dummy root node again.
|
// Remove the dummy root node again.
|
||||||
pScene->mRootNode = dummy_root->mChildren[0];
|
pScene->mRootNode = dummy_root->mChildren[0];
|
||||||
|
|
||||||
dummy_root->mChildren[0] = NULL;
|
dummy_root->mChildren[0] = NULL;
|
||||||
delete dummy_root;
|
delete dummy_root;
|
||||||
}
|
}
|
||||||
|
|
||||||
pScene->mRootNode->mParent = NULL;
|
pScene->mRootNode->mParent = NULL;
|
||||||
if (!DefaultLogger::isNullLogger()) {
|
if (!DefaultLogger::isNullLogger()) {
|
||||||
if ( nodes_in != nodes_out) {
|
if (nodes_in != nodes_out) {
|
||||||
ASSIMP_LOG_INFO_F("OptimizeGraphProcess finished; Input nodes: ", nodes_in, ", Output nodes: ", nodes_out);
|
ASSIMP_LOG_INFO_F("OptimizeGraphProcess finished; Input nodes: ", nodes_in, ", Output nodes: ", nodes_out);
|
||||||
} else {
|
} else {
|
||||||
ASSIMP_LOG_DEBUG("OptimizeGraphProcess finished");
|
ASSIMP_LOG_DEBUG("OptimizeGraphProcess finished");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
meshes.clear();
|
meshes.clear();
|
||||||
locked.clear();
|
locked.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Build a LUT of all instanced meshes
|
// Build a LUT of all instanced meshes
|
||||||
void OptimizeGraphProcess::FindInstancedMeshes (aiNode* pNode)
|
void OptimizeGraphProcess::FindInstancedMeshes(aiNode *pNode) {
|
||||||
{
|
for (unsigned int i = 0; i < pNode->mNumMeshes; ++i) {
|
||||||
for (unsigned int i = 0; i < pNode->mNumMeshes;++i) {
|
++meshes[pNode->mMeshes[i]];
|
||||||
++meshes[pNode->mMeshes[i]];
|
}
|
||||||
}
|
|
||||||
|
|
||||||
for (unsigned int i = 0; i < pNode->mNumChildren; ++i)
|
for (unsigned int i = 0; i < pNode->mNumChildren; ++i)
|
||||||
FindInstancedMeshes(pNode->mChildren[i]);
|
FindInstancedMeshes(pNode->mChildren[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // !! ASSIMP_BUILD_NO_OPTIMIZEGRAPH_PROCESS
|
#endif // !! ASSIMP_BUILD_NO_OPTIMIZEGRAPH_PROCESS
|
||||||
|
|
Loading…
Reference in New Issue