Browse Source

Adding support for per group instancing

Panagiotis Christopoulos Charitos 10 years ago
parent
commit
1fcf9dfae2
3 changed files with 6 additions and 2 deletions
  1. 1 1
      thirdparty
  2. 4 1
      tools/scene/Exporter.cpp
  3. 1 0
      tools/scene/Exporter.h

+ 1 - 1
thirdparty

@@ -1 +1 @@
-Subproject commit 50a09de0023c97c2d1875ac6aa857fdecb83af64
+Subproject commit 716cd0f2a1d5f8fe50abd2ffbd1b1d9bb63ecae3

+ 4 - 1
tools/scene/Exporter.cpp

@@ -4,6 +4,7 @@
 // http://www.anki3d.org/LICENSE
 
 #include "Exporter.h"
+#include <iostream>
 
 //==============================================================================
 // Statics                                                                     =
@@ -913,7 +914,8 @@ void Exporter::visitNode(const aiNode* ainode)
 			const Model& model = m_models[node.m_modelIndex];
 
 			if(model.m_meshIndex == meshIndex 
-				&& model.m_materialIndex == mtlIndex)
+				&& model.m_materialIndex == mtlIndex
+				&& node.m_group == ainode->mGroup.C_Str())
 			{
 				break;
 			}
@@ -943,6 +945,7 @@ void Exporter::visitNode(const aiNode* ainode)
 		Node node;
 		node.m_modelIndex = m_models.size() - 1;
 		node.m_transforms.push_back(ainode->mTransformation);
+		node.m_group = ainode->mGroup.C_Str();
 		m_nodes.push_back(node);
 	}
 

+ 1 - 0
tools/scene/Exporter.h

@@ -34,6 +34,7 @@ struct Node
 {
 	uint32_t m_modelIndex; ///< Index inside Exporter::m_models
 	std::vector<aiMatrix4x4> m_transforms;
+	std::string m_group;
 };
 
 const uint32_t MAX_BONES_PER_VERTEX = 4;