Expose CSkinnedMesh for external mesh loaders

You discovered a bug in the engine, and you are sure that it is not a problem of your code? Just post it in here. Please read the bug posting guidelines first.
Post Reply
Ion Dune
Posts: 453
Joined: Mon Nov 12, 2007 8:29 pm
Location: California, USA
Contact:

Expose CSkinnedMesh for external mesh loaders

Post by Ion Dune »

I'm trying to write an external mesh loader for loading skinned meshes, which is inhibited by there not being a way to create a "CSkinnedMesh" outside of the engine. I wrote a simple function in the scene manager to accomplish this, doesn't it seem like a good idea to allow it?

Code: Select all

Index: include/ISceneManager.h
===================================================================
--- include/ISceneManager.h	(revision 2561)
+++ include/ISceneManager.h	(working copy)
@@ -121,6 +121,7 @@
 	class ISceneNodeAnimatorFactory;
 	class ISceneUserDataSerializer;
 	class ILightManager;
+	class ISkinnedMesh; 
 
 	namespace quake3
 	{
@@ -1465,6 +1466,9 @@
 		\return True if node is not visible in the current scene, else
 		false. */
 		virtual bool isCulled(const ISceneNode* node) const =0;
+
+		//! creates a new, empty CSkinnedMesh for external loaders
+		virtual ISkinnedMesh * createEmptySkinnedMesh() const =0;
 	};
 
 
Index: source/Irrlicht/CSceneManager.cpp
===================================================================
--- source/Irrlicht/CSceneManager.cpp	(revision 2561)
+++ source/Irrlicht/CSceneManager.cpp	(working copy)
@@ -154,6 +154,8 @@
 #include "CVolumeLightSceneNode.h"
 #include "CGeometryCreator.h"
 
+#include "CSkinnedMesh.h" 
+
 //! Enable debug features
 #define SCENEMANAGER_DEBUG
 
@@ -1186,7 +1188,13 @@
 	return false;
 }
 
+//! creates a new, empty CSkinnedMesh for external loaders
+ISkinnedMesh * CSceneManager::createEmptySkinnedMesh() const
+{ 
+	return new CSkinnedMesh() ; 
+} 
 
+
 //! registers a node for rendering it at a specific time.
 u32 CSceneManager::registerNodeForRendering(ISceneNode* node, E_SCENE_NODE_RENDER_PASS time)
 {
Index: source/Irrlicht/CSceneManager.h
===================================================================
--- source/Irrlicht/CSceneManager.h	(revision 2561)
+++ source/Irrlicht/CSceneManager.h	(working copy)
@@ -488,6 +488,9 @@
 		//! returns if node is culled
 		virtual bool isCulled(const ISceneNode* node) const;
 
+		//! creates a new, empty CSkinnedMesh for external loaders
+		virtual ISkinnedMesh * createEmptySkinnedMesh() const;
+
 	private:
 
 		//! clears the deletion list
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Yes, I also had this problem recently. I was looking into the code whether we could put the whole CSkinnedMesh into a header, or if we need a method as suggested.
Maybe a factory for all types of meshes would be an idea, in order to have a common way for all of them. Or we put them into the geometry creator interface, which is now publicly available.
Post Reply