Browse Source

Particle exporter

Panagiotis Christopoulos Charitos 10 years ago
parent
commit
aa87ce44b2
2 changed files with 20 additions and 0 deletions
  1. 12 0
      tools/scene/Exporter.cpp
  2. 8 0
      tools/scene/Exporter.h

+ 12 - 0
tools/scene/Exporter.cpp

@@ -947,6 +947,18 @@ void Exporter::visitNode(const aiNode* ainode)
 		unsigned meshIndex = ainode->mMeshes[i];
 		unsigned mtlIndex =  m_scene->mMeshes[meshIndex]->mMaterialIndex;
 
+		// Check properties
+		for(const auto& prop : m_scene->mMeshes[meshIndex]->mProperties)
+		{
+			if(prop.first == "particles_file")
+			{
+				ParticleEmitter p;
+				p.m_filename = prop.second;
+				p.m_transform = ainode->mTransformation;
+				m_particleEmitters.push_back(p);
+			}
+		}
+
 		// Check if it's a collsion mesh
 		std::string name = m_scene->mMeshes[meshIndex]->mName.C_Str();
 		if(name.find("ak_collision") == 0)

+ 8 - 0
tools/scene/Exporter.h

@@ -56,6 +56,13 @@ public:
 
 using Sector = Portal;
 
+class ParticleEmitter
+{
+public:
+	std::string m_filename;
+	aiMatrix4x4 m_transform;
+};
+
 /// AnKi exporter.
 class Exporter
 {
@@ -78,6 +85,7 @@ public:
 	std::vector<uint32_t> m_collisionMeshIds;
 	std::vector<Portal> m_portals;
 	std::vector<Sector> m_sectors;
+	std::vector<ParticleEmitter> m_particleEmitters;
 
 	/// Load the scene.
 	void load();