Commit 901dac35 authored by bitplane's avatar bitplane

Added scene loader interface and moved the .irr loading code out to...

Added scene loader interface and moved the .irr loading code out to CSceneLoaderIrr. In future can support scene formats properly rather than loading them as meshes.



git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@3566 dfc29bdd-3216-0410-991c-e03cc46cb475
parent 6eaddbf1
Changes in 1.8 (??.??.2011) Changes in 1.8 (??.??.2011)
- Added ISceneLoader interface and .irr loader. Users can now add their own scene loaders to the scene manager and use them by calling loadScene.
- Renamed IGUIElement::bringToBack to sendToBack, like in Windows - Renamed IGUIElement::bringToBack to sendToBack, like in Windows
- Send EGET_ELEMENT_CLOSED event when context menues should be closed (thx @ Mloren for reporting). - Send EGET_ELEMENT_CLOSED event when context menues should be closed (thx @ Mloren for reporting).
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
<Project filename="12.TerrainRendering/TerrainRendering.cbp" /> <Project filename="12.TerrainRendering/TerrainRendering.cbp" />
<Project filename="13.RenderToTexture/RenderToTexture.cbp" /> <Project filename="13.RenderToTexture/RenderToTexture.cbp" />
<Project filename="14.Win32Window/Win32Window.cbp" /> <Project filename="14.Win32Window/Win32Window.cbp" />
<Project filename="15.LoadIrrFile/LoadIrrFile.cbp" /> <Project filename="15.LoadIrrFile/LoadIrrFile.cbp" active="1" />
<Project filename="16.Quake3MapShader/Quake3MapShader.cbp" /> <Project filename="16.Quake3MapShader/Quake3MapShader.cbp" />
<Project filename="18.SplitScreen/SplitScreen.cbp" /> <Project filename="18.SplitScreen/SplitScreen.cbp" />
<Project filename="19.MouseAndJoystick/MouseAndJoystick.cbp" /> <Project filename="19.MouseAndJoystick/MouseAndJoystick.cbp" />
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
<Project filename="21.Quake3Explorer/Quake3Explorer.cbp" /> <Project filename="21.Quake3Explorer/Quake3Explorer.cbp" />
<Project filename="22.MaterialViewer/MaterialViewer.cbp" /> <Project filename="22.MaterialViewer/MaterialViewer.cbp" />
<Project filename="Demo/demo.cbp" /> <Project filename="Demo/demo.cbp" />
<Project filename="../tools/GUIEditor/GUIEditor_gcc.cbp" active="1" /> <Project filename="../tools/GUIEditor/GUIEditor_gcc.cbp" />
<Project filename="../tools/MeshConverter/MeshConverter.cbp" /> <Project filename="../tools/MeshConverter/MeshConverter.cbp" />
<Project filename="../source/Irrlicht/Irrlicht-gcc.cbp" /> <Project filename="../source/Irrlicht/Irrlicht-gcc.cbp" />
</Workspace> </Workspace>
......
#ifndef __I_SCENE_LOADER_H_INCLUDED__
#define __I_SCENE_LOADER_H_INCLUDED__
#include "IReferenceCounted.h"
#include "path.h"
namespace irr
{
namespace io
{
class IReadFile;
} // end namespace io
namespace scene
{
class ISceneNode;
class ISceneUserDataSerializer;
//! Class which can load a scene into the scene manager.
/** If you want Irrlicht to be able to load currently unsupported
scene file formats (e.g. .vrml), then implement this and add your
new Sceneloader to the engine with ISceneManager::addExternalSceneLoader(). */
class ISceneLoader : public virtual IReferenceCounted
{
public:
//! Returns true if the class might be able to load this file.
/** This decision should be based on the file extension (e.g. ".vrml")
only.
\param fileName Name of the file to test.
\return True if the extension is a recognised type. */
virtual bool isALoadableFileExtension(const io::path& filename) const = 0;
//! Returns true if the class might be able to load this file.
/** This decision will be based on a quick look at the contents of the file.
\param file The file to test.
\return True if the extension is a recognised type. */
virtual bool isALoadableFileType(io::IReadFile* file) const = 0;
//! Loads the scene into the scene manager.
/** \param file File which contains the scene.
\param userDataSerializer: If you want to load user data which may be attached
to some some scene nodes in the file, implement the ISceneUserDataSerializer
interface and provide it as parameter here. Otherwise, simply specify 0 as this
parameter.
\param rootNode The node to load the scene into, if none is provided then the
scene will be loaded into the root node.
\return Returns true on success, false on failure. Returns 0 if loading failed. */
virtual bool loadScene(io::IReadFile* file, ISceneUserDataSerializer* userDataSerializer=0,
ISceneNode* rootNode=0) = 0;
};
} // end namespace scene
} // end namespace irr
#endif
...@@ -49,8 +49,6 @@ namespace video ...@@ -49,8 +49,6 @@ namespace video
namespace scene namespace scene
{ {
class IMeshWriter;
//! Enumeration for render passes. //! Enumeration for render passes.
/** A parameter passed to the registerNodeForRendering() method of the ISceneManager, /** A parameter passed to the registerNodeForRendering() method of the ISceneManager,
specifying when the node wants to be drawn in relation to the other nodes. */ specifying when the node wants to be drawn in relation to the other nodes. */
...@@ -96,33 +94,35 @@ namespace scene ...@@ -96,33 +94,35 @@ namespace scene
ESNRP_SHADOW =64 ESNRP_SHADOW =64
}; };
class IAnimatedMesh;
class IAnimatedMeshSceneNode;
class IBillboardSceneNode;
class IBillboardTextSceneNode;
class ICameraSceneNode;
class IDummyTransformationSceneNode;
class ILightManager;
class ILightSceneNode;
class IMesh; class IMesh;
class IMeshBuffer; class IMeshBuffer;
class IAnimatedMesh;
class IMeshCache; class IMeshCache;
class IMeshLoader;
class IMeshManipulator;
class IMeshSceneNode;
class IMeshWriter;
class IMetaTriangleSelector;
class IParticleSystemSceneNode;
class ISceneCollisionManager;
class ISceneLoader;
class ISceneNode; class ISceneNode;
class ICameraSceneNode;
class IAnimatedMeshSceneNode;
class ISceneNodeAnimator; class ISceneNodeAnimator;
class ISceneNodeAnimatorCollisionResponse; class ISceneNodeAnimatorCollisionResponse;
class ILightSceneNode; class ISceneNodeAnimatorFactory;
class IBillboardSceneNode; class ISceneNodeFactory;
class ISceneUserDataSerializer;
class ITerrainSceneNode; class ITerrainSceneNode;
class IMeshSceneNode;
class IMeshLoader;
class ISceneCollisionManager;
class IParticleSystemSceneNode;
class IDummyTransformationSceneNode;
class ITriangleSelector;
class IMetaTriangleSelector;
class IMeshManipulator;
class ITextSceneNode; class ITextSceneNode;
class IBillboardTextSceneNode; class ITriangleSelector;
class IVolumeLightSceneNode; class IVolumeLightSceneNode;
class ISceneNodeFactory;
class ISceneNodeAnimatorFactory;
class ISceneUserDataSerializer;
class ILightManager;
namespace quake3 namespace quake3
{ {
...@@ -1356,10 +1356,19 @@ namespace scene ...@@ -1356,10 +1356,19 @@ namespace scene
file formats it currently is not able to load (e.g. .cob), just implement file formats it currently is not able to load (e.g. .cob), just implement
the IMeshLoader interface in your loading class and add it with this method. the IMeshLoader interface in your loading class and add it with this method.
Using this method it is also possible to override built-in mesh loaders with Using this method it is also possible to override built-in mesh loaders with
newer or updated versions without the need of recompiling the engine. newer or updated versions without the need to recompile the engine.
\param externalLoader: Implementation of a new mesh loader. */ \param externalLoader: Implementation of a new mesh loader. */
virtual void addExternalMeshLoader(IMeshLoader* externalLoader) = 0; virtual void addExternalMeshLoader(IMeshLoader* externalLoader) = 0;
//! Adds an external scene loader for extending the engine with new file formats.
/** If you want the engine to be extended with
file formats it currently is not able to load (e.g. .vrml), just implement
the ISceneLoader interface in your loading class and add it with this method.
Using this method it is also possible to override the built-in scene loaders
with newer or updated versions without the need to recompile the engine.
\param externalLoader: Implementation of a new mesh loader. */
virtual void addExternalSceneLoader(ISceneLoader* externalLoader) = 0;
//! Get pointer to the scene collision manager. //! Get pointer to the scene collision manager.
/** \return Pointer to the collision manager /** \return Pointer to the collision manager
This pointer should not be dropped. See IReferenceCounted::drop() for more information. */ This pointer should not be dropped. See IReferenceCounted::drop() for more information. */
...@@ -1506,7 +1515,8 @@ namespace scene ...@@ -1506,7 +1515,8 @@ namespace scene
virtual bool saveScene(io::IWriteFile* file, ISceneUserDataSerializer* userDataSerializer=0, ISceneNode* node=0) = 0; virtual bool saveScene(io::IWriteFile* file, ISceneUserDataSerializer* userDataSerializer=0, ISceneNode* node=0) = 0;
//! Loads a scene. Note that the current scene is not cleared before. //! Loads a scene. Note that the current scene is not cleared before.
/** The scene is usually load from an .irr file, an xml based format. .irr files can /** The scene is usually loaded from an .irr file, an xml based format, but other scene formats
can be added to the engine via ISceneManager::addExternalSceneLoader. .irr files can
Be edited with the Irrlicht Engine Editor, irrEdit (http://irredit.irrlicht3d.org) or Be edited with the Irrlicht Engine Editor, irrEdit (http://irredit.irrlicht3d.org) or
saved directly by the engine using ISceneManager::saveScene(). saved directly by the engine using ISceneManager::saveScene().
\param filename: Name of the file. \param filename: Name of the file.
...@@ -1515,13 +1525,14 @@ namespace scene ...@@ -1515,13 +1525,14 @@ namespace scene
implement the ISceneUserDataSerializer interface and provide it implement the ISceneUserDataSerializer interface and provide it
as parameter here. Otherwise, simply specify 0 as this as parameter here. Otherwise, simply specify 0 as this
parameter. parameter.
\param node Node which is taken as the root node of the scene. Pass 0 to add the scene \param rootNode Node which is taken as the root node of the scene. Pass 0 to add the scene
directly to the scene manager (which is also the default). directly to the scene manager (which is also the default).
\return True if successful. */ \return True if successful. */
virtual bool loadScene(const io::path& filename, ISceneUserDataSerializer* userDataSerializer=0, ISceneNode* node=0) = 0; virtual bool loadScene(const io::path& filename, ISceneUserDataSerializer* userDataSerializer=0, ISceneNode* rootNode=0) = 0;
//! Loads a scene. Note that the current scene is not cleared before. //! Loads a scene. Note that the current scene is not cleared before.
/** The scene is usually load from an .irr file, an xml based format. .irr files can /** The scene is usually loaded from an .irr file, an xml based format, but other scene formats
can be added to the engine via ISceneManager::addExternalSceneLoader. .irr files can
Be edited with the Irrlicht Engine Editor, irrEdit (http://irredit.irrlicht3d.org) or Be edited with the Irrlicht Engine Editor, irrEdit (http://irredit.irrlicht3d.org) or
saved directly by the engine using ISceneManager::saveScene(). saved directly by the engine using ISceneManager::saveScene().
\param file: File where the scene is going to be saved into. \param file: File where the scene is going to be saved into.
...@@ -1530,10 +1541,10 @@ namespace scene ...@@ -1530,10 +1541,10 @@ namespace scene
implement the ISceneUserDataSerializer interface and provide it implement the ISceneUserDataSerializer interface and provide it
as parameter here. Otherwise, simply specify 0 as this as parameter here. Otherwise, simply specify 0 as this
parameter. parameter.
\param node Node which is taken as the root node of the scene. Pass 0 to add the scene \param rootNode Node which is taken as the root node of the scene. Pass 0 to add the scene
directly to the scene manager (which is also the default). directly to the scene manager (which is also the default).
\return True if successful. */ \return True if successful. */
virtual bool loadScene(io::IReadFile* file, ISceneUserDataSerializer* userDataSerializer=0, ISceneNode* node=0) = 0; virtual bool loadScene(io::IReadFile* file, ISceneUserDataSerializer* userDataSerializer=0, ISceneNode* rootNode=0) = 0;
//! Get a mesh writer implementation if available //! Get a mesh writer implementation if available
/** Note: You need to drop() the pointer after use again, see IReferenceCounted::drop() /** Note: You need to drop() the pointer after use again, see IReferenceCounted::drop()
......
...@@ -313,6 +313,13 @@ tool <http://developer.nvidia.com/object/nvperfhud_home.html>. */ ...@@ -313,6 +313,13 @@ tool <http://developer.nvidia.com/object/nvperfhud_home.html>. */
//! Uncomment the following line if you want to ignore the deprecated warnings //! Uncomment the following line if you want to ignore the deprecated warnings
//#define IGNORE_DEPRECATED_WARNING //#define IGNORE_DEPRECATED_WARNING
//! Define _IRR_COMPILE_WITH_IRR_SCENE_LOADER_ if you want to be able to load
/** .irr scenes using ISceneManager::loadScene */
#define _IRR_COMPILE_WITH_IRR_SCENE_LOADER_
#ifdef NO_IRR_COMPILE_WITH_IRR_SCENE_LOADER_
#undef _IRR_COMPILE_WITH_IRR_SCENE_LOADER_
#endif
//! Define _IRR_COMPILE_WITH_SKINNED_MESH_SUPPORT_ if you want to use bone based //! Define _IRR_COMPILE_WITH_SKINNED_MESH_SUPPORT_ if you want to use bone based
/** animated meshes. If you compile without this, you will be unable to load /** animated meshes. If you compile without this, you will be unable to load
B3D, MS3D or X meshes */ B3D, MS3D or X meshes */
......
#include "CSceneLoaderIrr.h"
#include "ISceneNodeAnimatorFactory.h"
#include "ISceneUserDataSerializer.h"
#include "ISceneManager.h"
#include "IVideoDriver.h"
#include "IFileSystem.h"
#include "os.h"
namespace irr
{
namespace scene
{
//! Constructor
CSceneLoaderIrr::CSceneLoaderIrr(ISceneManager *smgr, io::IFileSystem* fs)
: SceneManager(smgr), FileSystem(fs),
IRR_XML_FORMAT_SCENE(L"irr_scene"), IRR_XML_FORMAT_NODE(L"node"), IRR_XML_FORMAT_NODE_ATTR_TYPE(L"type"),
IRR_XML_FORMAT_ATTRIBUTES(L"attributes"), IRR_XML_FORMAT_MATERIALS(L"materials"),
IRR_XML_FORMAT_ANIMATORS(L"animators"), IRR_XML_FORMAT_USERDATA(L"userData")
{
}
//! Destructor
CSceneLoaderIrr::~CSceneLoaderIrr()
{
}
//! Returns true if the class might be able to load this file.
bool CSceneLoaderIrr::isALoadableFileExtension(const io::path& filename) const
{
return core::hasFileExtension(filename, "irr");
}
//! Returns true if the class might be able to load this file.
bool CSceneLoaderIrr::isALoadableFileType(io::IReadFile *file) const
{
// todo: check inside the file
return true;
}
//! Loads the scene into the scene manager.
bool CSceneLoaderIrr::loadScene(io::IReadFile* file, ISceneUserDataSerializer* userDataSerializer,
ISceneNode* rootNode)
{
if (!file)
{
os::Printer::log("Unable to open scene file", ELL_ERROR);
return false;
}
io::IXMLReader* reader = FileSystem->createXMLReader(file);
if (!reader)
{
os::Printer::log("Scene is not a valid XML file", file->getFileName().c_str(), ELL_ERROR);
return false;
}
// TODO: COLLADA_CREATE_SCENE_INSTANCES can be removed when the COLLADA loader is a scene loader
bool oldColladaSingleMesh = SceneManager->getParameters()->getAttributeAsBool(COLLADA_CREATE_SCENE_INSTANCES);
SceneManager->getParameters()->setAttribute(COLLADA_CREATE_SCENE_INSTANCES, false);
// read file
while (reader->read())
{
readSceneNode(reader, rootNode, userDataSerializer);
}
// restore old collada parameters
SceneManager->getParameters()->setAttribute(COLLADA_CREATE_SCENE_INSTANCES, oldColladaSingleMesh);
// clean up
reader->drop();
return true;
}
//! Reads the next node
void CSceneLoaderIrr::readSceneNode(io::IXMLReader* reader, ISceneNode* parent,
ISceneUserDataSerializer* userDataSerializer)
{
if (!reader)
return;
scene::ISceneNode* node = 0;
if (!parent && IRR_XML_FORMAT_SCENE==reader->getNodeName())
node = SceneManager->getRootSceneNode();
else if (parent && IRR_XML_FORMAT_NODE==reader->getNodeName())
{
// find node type and create it
core::stringc attrName = reader->getAttributeValue(IRR_XML_FORMAT_NODE_ATTR_TYPE.c_str());
node = SceneManager->addSceneNode(attrName.c_str(), parent);
if (!node)
os::Printer::log("Could not create scene node of unknown type", attrName.c_str());
}
// read attributes
while(reader->read())
{
bool endreached = false;
const wchar_t* name = reader->getNodeName();
switch (reader->getNodeType())
{
case io::EXN_ELEMENT_END:
if ((IRR_XML_FORMAT_NODE == name) ||
(IRR_XML_FORMAT_SCENE == name))
{
endreached = true;
}
break;
case io::EXN_ELEMENT:
if (IRR_XML_FORMAT_ATTRIBUTES == name)
{
// read attributes
io::IAttributes* attr = FileSystem->createEmptyAttributes(SceneManager->getVideoDriver());
attr->read(reader, true);
if (node)
node->deserializeAttributes(attr);
attr->drop();
}
else
if (IRR_XML_FORMAT_MATERIALS == name)
readMaterials(reader, node);
else
if (IRR_XML_FORMAT_ANIMATORS == name)
readAnimators(reader, node);
else
if (IRR_XML_FORMAT_USERDATA == name)
readUserData(reader, node, userDataSerializer);
else
if ((IRR_XML_FORMAT_NODE == name) ||
(IRR_XML_FORMAT_SCENE == name))
{
readSceneNode(reader, node, userDataSerializer);
}
else
{
os::Printer::log("Found unknown element in irrlicht scene file",
core::stringc(name).c_str());
}
break;
default:
break;
}
if (endreached)
break;
}
if (node && userDataSerializer)
userDataSerializer->OnCreateNode(node);
}
//! reads materials of a node
void CSceneLoaderIrr::readMaterials(io::IXMLReader* reader, ISceneNode* node)
{
u32 nr = 0;
while(reader->read())
{
const wchar_t* name = reader->getNodeName();
switch(reader->getNodeType())
{
case io::EXN_ELEMENT_END:
if (IRR_XML_FORMAT_MATERIALS == name)
return;
break;
case io::EXN_ELEMENT:
if (IRR_XML_FORMAT_ATTRIBUTES == name)
{
// read materials from attribute list
io::IAttributes* attr = FileSystem->createEmptyAttributes(SceneManager->getVideoDriver());
attr->read(reader);
if (node && node->getMaterialCount() > nr)
{
SceneManager->getVideoDriver()->fillMaterialStructureFromAttributes(
node->getMaterial(nr), attr);
}
attr->drop();
++nr;
}
break;
default:
break;
}
}
}
//! reads animators of a node
void CSceneLoaderIrr::readAnimators(io::IXMLReader* reader, ISceneNode* node)
{
while(reader->read())
{
const wchar_t* name = reader->getNodeName();
switch(reader->getNodeType())
{
case io::EXN_ELEMENT_END:
if (IRR_XML_FORMAT_ANIMATORS == name)
return;
break;
case io::EXN_ELEMENT:
if (IRR_XML_FORMAT_ATTRIBUTES == name)
{
// read animator data from attribute list
io::IAttributes* attr = FileSystem->createEmptyAttributes(SceneManager->getVideoDriver());
attr->read(reader);
if (node)
{
core::stringc typeName = attr->getAttributeAsString("Type");
ISceneNodeAnimator* anim = 0;
for (u32 i=0; i < SceneManager->getRegisteredSceneNodeAnimatorFactoryCount() && !anim; ++i)
anim = SceneManager->getSceneNodeAnimatorFactory(i)->createSceneNodeAnimator(typeName.c_str(), node);
if (anim)
{
anim->deserializeAttributes(attr);
anim->drop();
}
}
attr->drop();
}
break;
default:
break;
}
}
}
//! reads user data of a node
void CSceneLoaderIrr::readUserData(io::IXMLReader* reader, ISceneNode* node, ISceneUserDataSerializer* userDataSerializer)
{
while(reader->read())
{
const wchar_t* name = reader->getNodeName();
switch(reader->getNodeType())
{
case io::EXN_ELEMENT_END:
if (IRR_XML_FORMAT_USERDATA == name)
return;
break;
case io::EXN_ELEMENT:
if (IRR_XML_FORMAT_ATTRIBUTES == name)
{
// read user data from attribute list
io::IAttributes* attr = FileSystem->createEmptyAttributes(SceneManager->getVideoDriver());
attr->read(reader);
if (node && userDataSerializer)
{
userDataSerializer->OnReadUserData(node, attr);
}
attr->drop();
}
break;
default:
break;
}
}
}
} // scene
} // irr
#ifndef __C_SCENE_LOADER_IRR_H_INCLUDED__
#define __C_SCENE_LOADER_IRR_H_INCLUDED__
#include "ISceneLoader.h"
#include "IXMLReader.h"
namespace irr
{
namespace io
{
class IFileSystem;
}
namespace scene
{
class ISceneManager;
//! Class which can load a scene into the scene manager.
class CSceneLoaderIrr : public virtual ISceneLoader
{
public:
//! Constructor
CSceneLoaderIrr(ISceneManager *smgr, io::IFileSystem* fs);
//! Destructor
virtual ~CSceneLoaderIrr();
//! Returns true if the class might be able to load this file.
virtual bool isALoadableFileExtension(const io::path& filename) const;
//! Returns true if the class might be able to load this file.
virtual bool isALoadableFileType(io::IReadFile *file) const;
//! Loads the scene into the scene manager.
virtual bool loadScene(io::IReadFile* file, ISceneUserDataSerializer* userDataSerializer=0,
ISceneNode* rootNode=0);
private:
//! Recursively reads nodes from the xml file
void readSceneNode(io::IXMLReader* reader, ISceneNode* parent,
ISceneUserDataSerializer* userDataSerializer);
//! read a node's materials
void readMaterials(io::IXMLReader* reader, ISceneNode* node);
//! read a node's animators
void readAnimators(io::IXMLReader* reader, ISceneNode* node);
//! read any other data into the user serializer
void readUserData(io::IXMLReader* reader, ISceneNode* node,
ISceneUserDataSerializer* userDataSerializer);
ISceneManager *SceneManager;
io::IFileSystem *FileSystem;
//! constants for reading and writing XML.
//! Not made static due to portability problems.
// TODO: move to own header
const core::stringw IRR_XML_FORMAT_SCENE;
const core::stringw IRR_XML_FORMAT_NODE;
const core::stringw IRR_XML_FORMAT_NODE_ATTR_TYPE;
const core::stringw IRR_XML_FORMAT_ATTRIBUTES;
const core::stringw IRR_XML_FORMAT_MATERIALS;
const core::stringw IRR_XML_FORMAT_ANIMATORS;
const core::stringw IRR_XML_FORMAT_USERDATA;
};
} // end namespace scene
} // end namespace irr
#endif
This diff is collapsed.
...@@ -371,6 +371,9 @@ namespace scene ...@@ -371,6 +371,9 @@ namespace scene
//! Adds an external mesh loader. //! Adds an external mesh loader.
virtual void addExternalMeshLoader(IMeshLoader* externalLoader); virtual void addExternalMeshLoader(IMeshLoader* externalLoader);
//! Adds an external scene loader.
virtual void addExternalSceneLoader(ISceneLoader* externalLoader);
//! Returns a pointer to the scene collision manager. //! Returns a pointer to the scene collision manager.
virtual ISceneCollisionManager* getSceneCollisionManager(); virtual ISceneCollisionManager* getSceneCollisionManager();
...@@ -456,18 +459,16 @@ namespace scene ...@@ -456,18 +459,16 @@ namespace scene
virtual ISceneNodeAnimatorFactory* getSceneNodeAnimatorFactory(u32 index); virtual ISceneNodeAnimatorFactory* getSceneNodeAnimatorFactory(u32 index);
//! Saves the current scene into a file. //! Saves the current scene into a file.
//! \param filename: Name of the file .
virtual bool saveScene(const io::path& filename, ISceneUserDataSerializer* userDataSerializer=0, ISceneNode* node=0); virtual bool saveScene(const io::path& filename, ISceneUserDataSerializer* userDataSerializer=0, ISceneNode* node=0);
//! Saves the current scene into a file. //! Saves the current scene into a file.
virtual bool saveScene(io::IWriteFile* file, ISceneUserDataSerializer* userDataSerializer=0, ISceneNode* node=0); virtual bool saveScene(io::IWriteFile* file, ISceneUserDataSerializer* userDataSerializer=0, ISceneNode* node=0);
//! Loads a scene. Note that the current scene is not cleared before. //! Loads a scene. Note that the current scene is not cleared before.
//! \param filename: Name of the file . virtual bool loadScene(const io::path& filename, ISceneUserDataSerializer* userDataSerializer=0, ISceneNode* rootNode=0);
virtual bool loadScene(const io::path& filename, ISceneUserDataSerializer* userDataSerializer=0, ISceneNode* node=0);
//! Loads a scene. Note that the current scene is not cleared before. //! Loads a scene. Note that the current scene is not cleared before.
virtual bool loadScene(io::IReadFile* file, ISceneUserDataSerializer* userDataSerializer=0, ISceneNode* node=0); virtual bool loadScene(io::IReadFile* file, ISceneUserDataSerializer* userDataSerializer=0, ISceneNode* rootNode=0);
//! Writes attributes of the scene node. //! Writes attributes of the scene node.
virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const; virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const;
...@@ -504,18 +505,6 @@ namespace scene ...@@ -504,18 +505,6 @@ namespace scene
//! writes a scene node //! writes a scene node
void writeSceneNode(io::IXMLWriter* writer, ISceneNode* node, ISceneUserDataSerializer* userDataSerializer, const c8* currentPath=0, bool init=false); void writeSceneNode(io::IXMLWriter* writer, ISceneNode* node, ISceneUserDataSerializer* userDataSerializer, const c8* currentPath=0, bool init=false);
//! reads a scene node
void readSceneNode(io::IXMLReader* reader, ISceneNode* parent, ISceneUserDataSerializer* userDataSerializer);
//! read materials
void readMaterials(io::IXMLReader* reader, ISceneNode* node);
//! reads animators of a node
void readAnimators(io::IXMLReader* reader, ISceneNode* node);
//! reads user data of a node
void readUserData(io::IXMLReader* reader, ISceneNode* node, ISceneUserDataSerializer* userDataSerializer);
struct DefaultNodeEntry struct DefaultNodeEntry
{ {
DefaultNodeEntry(ISceneNode* n) : DefaultNodeEntry(ISceneNode* n) :
...@@ -605,6 +594,7 @@ namespace scene ...@@ -605,6 +594,7 @@ namespace scene
core::array<TransparentNodeEntry> TransparentEffectNodeList; core::array<TransparentNodeEntry> TransparentEffectNodeList;
core::array<IMeshLoader*> MeshLoaderList; core::array<IMeshLoader*> MeshLoaderList;
core::array<ISceneLoader*> SceneLoaderList;
core::array<ISceneNode*> DeletionList; core::array<ISceneNode*> DeletionList;
core::array<ISceneNodeFactory*> SceneNodeFactoryList; core::array<ISceneNodeFactory*> SceneNodeFactoryList;
core::array<ISceneNodeAnimatorFactory*> SceneNodeAnimatorFactoryList; core::array<ISceneNodeAnimatorFactory*> SceneNodeAnimatorFactoryList;
......
...@@ -527,6 +527,7 @@ ...@@ -527,6 +527,7 @@
<Unit filename="../../include/IReadFile.h" /> <Unit filename="../../include/IReadFile.h" />
<Unit filename="../../include/IReferenceCounted.h" /> <Unit filename="../../include/IReferenceCounted.h" />
<Unit filename="../../include/ISceneCollisionManager.h" /> <Unit filename="../../include/ISceneCollisionManager.h" />
<Unit filename="../../include/ISceneLoader.h" />
<Unit filename="../../include/ISceneManager.h" /> <Unit filename="../../include/ISceneManager.h" />
<Unit filename="../../include/ISceneNode.h" /> <Unit filename="../../include/ISceneNode.h" />
<Unit filename="../../include/ISceneNodeAnimator.h" /> <Unit filename="../../include/ISceneNodeAnimator.h" />
...@@ -895,6 +896,8 @@ ...@@ -895,6 +896,8 @@
<Unit filename="CSTLMeshWriter.h" /> <Unit filename="CSTLMeshWriter.h" />
<Unit filename="CSceneCollisionManager.cpp" /> <Unit filename="CSceneCollisionManager.cpp" />
<Unit filename="CSceneCollisionManager.h" /> <Unit filename="CSceneCollisionManager.h" />
<Unit filename="CSceneLoaderIrr.cpp" />
<Unit filename="CSceneLoaderIrr.h" />
<Unit filename="CSceneManager.cpp" /> <Unit filename="CSceneManager.cpp" />
<Unit filename="CSceneManager.h" /> <Unit filename="CSceneManager.h" />
<Unit filename="CSceneNodeAnimatorCameraFPS.cpp" /> <Unit filename="CSceneNodeAnimatorCameraFPS.cpp" />
......
...@@ -915,6 +915,7 @@ ...@@ -915,6 +915,7 @@
<ClInclude Include="..\..\include\IQ3Shader.h" /> <ClInclude Include="..\..\include\IQ3Shader.h" />
<ClInclude Include="..\..\include\ISceneCollisionManager.h" /> <ClInclude Include="..\..\include\ISceneCollisionManager.h" />
<ClInclude Include="..\..\include\ISceneManager.h" /> <ClInclude Include="..\..\include\ISceneManager.h" />
<ClInclude Include="..\..\include\ISceneLoader.h" />
<ClInclude Include="..\..\include\ISceneNode.h" /> <ClInclude Include="..\..\include\ISceneNode.h" />
<ClInclude Include="..\..\include\ISceneNodeAnimator.h" /> <ClInclude Include="..\..\include\ISceneNodeAnimator.h" />
<ClInclude Include="..\..\include\ISceneNodeAnimatorCameraFPS.h" /> <ClInclude Include="..\..\include\ISceneNodeAnimatorCameraFPS.h" />
...@@ -1036,6 +1037,7 @@ ...@@ -1036,6 +1037,7 @@
<ClInclude Include="CTerrainTriangleSelector.h" /> <ClInclude Include="CTerrainTriangleSelector.h" />
<ClInclude Include="CTriangleBBSelector.h" /> <ClInclude Include="CTriangleBBSelector.h" />
<ClInclude Include="CTriangleSelector.h" /> <ClInclude Include="CTriangleSelector.h" />
<ClInclude Include="CSceneLoaderIrr.h" />
<ClInclude Include="CSceneNodeAnimatorCameraFPS.h" /> <ClInclude Include="CSceneNodeAnimatorCameraFPS.h" />
<ClInclude Include="CSceneNodeAnimatorCameraMaya.h" /> <ClInclude Include="CSceneNodeAnimatorCameraMaya.h" />
<ClInclude Include="CSceneNodeAnimatorCollisionResponse.h" /> <ClInclude Include="CSceneNodeAnimatorCollisionResponse.h" />
...@@ -1278,6 +1280,7 @@ ...@@ -1278,6 +1280,7 @@
<ClCompile Include="CTerrainTriangleSelector.cpp" /> <ClCompile Include="CTerrainTriangleSelector.cpp" />
<ClCompile Include="CTriangleBBSelector.cpp" /> <ClCompile Include="CTriangleBBSelector.cpp" />
<ClCompile Include="CTriangleSelector.cpp" /> <ClCompile Include="CTriangleSelector.cpp" />
<ClInclude Include="CSceneLoaderIrr.cpp" />
<ClCompile Include="CSceneNodeAnimatorCameraFPS.cpp" /> <ClCompile Include="CSceneNodeAnimatorCameraFPS.cpp" />
<ClCompile Include="CSceneNodeAnimatorCameraMaya.cpp" /> <ClCompile Include="CSceneNodeAnimatorCameraMaya.cpp" />
<ClCompile Include="CSceneNodeAnimatorCollisionResponse.cpp" /> <ClCompile Include="CSceneNodeAnimatorCollisionResponse.cpp" />
...@@ -1520,4 +1523,4 @@ ...@@ -1520,4 +1523,4 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets"> <ImportGroup Label="ExtensionTargets">
</ImportGroup> </ImportGroup>
</Project> </Project>
\ No newline at end of file
...@@ -674,6 +674,9 @@ ...@@ -674,6 +674,9 @@
<File <File
RelativePath=".\..\..\include\ISceneCollisionManager.h"> RelativePath=".\..\..\include\ISceneCollisionManager.h">
</File> </File>
<File
RelativePath=".\..\..\include\ISceneLoader.h">
</File>
<File <File
RelativePath=".\..\..\include\ISceneManager.h"> RelativePath=".\..\..\include\ISceneManager.h">
</File> </File>
...@@ -1470,6 +1473,12 @@ ...@@ -1470,6 +1473,12 @@
<File <File
RelativePath="CMeshManipulator.h"> RelativePath="CMeshManipulator.h">
</File> </File>
<File
RelativePath="CSceneLoaderIrr.cpp">
</File>
<File
RelativePath="CSceneLoaderIrr.h">
</File>
<File <File
RelativePath="CSceneManager.cpp"> RelativePath="CSceneManager.cpp">
</File> </File>
......
...@@ -945,6 +945,11 @@ ...@@ -945,6 +945,11 @@
RelativePath=".\..\..\include\ISceneManager.h" RelativePath=".\..\..\include\ISceneManager.h"
> >
</File> </File>
<File
RelativePath=".\..\..\include\ISceneLoader.h"
>
</File>
<File <File
RelativePath=".\..\..\include\ISceneNode.h" RelativePath=".\..\..\include\ISceneNode.h"
> >
...@@ -2091,11 +2096,19 @@ ...@@ -2091,11 +2096,19 @@
> >
</File> </File>
<File <File
RelativePath=".\CSceneManager.cpp" RelativePath="CSceneLoaderIrr.cpp"
>
</File>
<File
RelativePath="CSceneLoaderIrr.h"
>
</File>
<File
RelativePath="CSceneManager.cpp"
> >
</File> </File>
<File <File
RelativePath=".\CSceneManager.h" RelativePath="CSceneManager.h"
> >
</File> </File>
<Filter <Filter
......
...@@ -1108,6 +1108,10 @@ ...@@ -1108,6 +1108,10 @@
RelativePath="..\..\include\ISceneCollisionManager.h" RelativePath="..\..\include\ISceneCollisionManager.h"
> >
</File> </File>
<File
RelativePath="..\..\include\ISceneLoader.h"
>
</File>
<File <File
RelativePath="..\..\include\ISceneManager.h" RelativePath="..\..\include\ISceneManager.h"
> >
...@@ -1376,6 +1380,14 @@ ...@@ -1376,6 +1380,14 @@
RelativePath="CMeshManipulator.h" RelativePath="CMeshManipulator.h"
> >
</File> </File>
<File
RelativePath="CSceneLoaderIrr.cpp"
>
</File>
<File
RelativePath="CSceneLoaderIrr.h"
>
</File>
<File <File
RelativePath="CSceneManager.cpp" RelativePath="CSceneManager.cpp"
> >
......
...@@ -28,7 +28,7 @@ IRRMESHOBJ = $(IRRMESHLOADER) $(IRRMESHWRITER) \ ...@@ -28,7 +28,7 @@ IRRMESHOBJ = $(IRRMESHLOADER) $(IRRMESHWRITER) \
CSkinnedMesh.o CBoneSceneNode.o CMeshSceneNode.o \ CSkinnedMesh.o CBoneSceneNode.o CMeshSceneNode.o \
CAnimatedMeshSceneNode.o CAnimatedMeshMD2.o CAnimatedMeshMD3.o \ CAnimatedMeshSceneNode.o CAnimatedMeshMD2.o CAnimatedMeshMD3.o \
CQ3LevelMesh.o CQuake3ShaderSceneNode.o CAnimatedMeshHalfLife.o CQ3LevelMesh.o CQuake3ShaderSceneNode.o CAnimatedMeshHalfLife.o
IRROBJ = CBillboardSceneNode.o CCameraSceneNode.o CDummyTransformationSceneNode.o CEmptySceneNode.o CGeometryCreator.o CLightSceneNode.o CMeshManipulator.o CMetaTriangleSelector.o COctreeSceneNode.o COctreeTriangleSelector.o CSceneCollisionManager.o CSceneManager.o CShadowVolumeSceneNode.o CSkyBoxSceneNode.o CSkyDomeSceneNode.o CTerrainSceneNode.o CTerrainTriangleSelector.o CVolumeLightSceneNode.o CCubeSceneNode.o CSphereSceneNode.o CTextSceneNode.o CTriangleBBSelector.o CTriangleSelector.o CWaterSurfaceSceneNode.o CMeshCache.o CDefaultSceneNodeAnimatorFactory.o CDefaultSceneNodeFactory.o IRROBJ = CBillboardSceneNode.o CCameraSceneNode.o CDummyTransformationSceneNode.o CEmptySceneNode.o CGeometryCreator.o CLightSceneNode.o CMeshManipulator.o CMetaTriangleSelector.o COctreeSceneNode.o COctreeTriangleSelector.o CSceneCollisionManager.o CSceneManager.o CShadowVolumeSceneNode.o CSkyBoxSceneNode.o CSkyDomeSceneNode.o CTerrainSceneNode.o CTerrainTriangleSelector.o CVolumeLightSceneNode.o CCubeSceneNode.o CSphereSceneNode.o CTextSceneNode.o CTriangleBBSelector.o CTriangleSelector.o CWaterSurfaceSceneNode.o CMeshCache.o CDefaultSceneNodeAnimatorFactory.o CDefaultSceneNodeFactory.o CSceneLoaderIrr.o
IRRPARTICLEOBJ = CParticleAnimatedMeshSceneNodeEmitter.o CParticleBoxEmitter.o CParticleCylinderEmitter.o CParticleMeshEmitter.o CParticlePointEmitter.o CParticleRingEmitter.o CParticleSphereEmitter.o CParticleAttractionAffector.o CParticleFadeOutAffector.o CParticleGravityAffector.o CParticleRotationAffector.o CParticleSystemSceneNode.o CParticleScaleAffector.o IRRPARTICLEOBJ = CParticleAnimatedMeshSceneNodeEmitter.o CParticleBoxEmitter.o CParticleCylinderEmitter.o CParticleMeshEmitter.o CParticlePointEmitter.o CParticleRingEmitter.o CParticleSphereEmitter.o CParticleAttractionAffector.o CParticleFadeOutAffector.o CParticleGravityAffector.o CParticleRotationAffector.o CParticleSystemSceneNode.o CParticleScaleAffector.o
IRRANIMOBJ = CSceneNodeAnimatorCameraFPS.o CSceneNodeAnimatorCameraMaya.o CSceneNodeAnimatorCollisionResponse.o CSceneNodeAnimatorDelete.o CSceneNodeAnimatorFlyCircle.o CSceneNodeAnimatorFlyStraight.o CSceneNodeAnimatorFollowSpline.o CSceneNodeAnimatorRotation.o CSceneNodeAnimatorTexture.o IRRANIMOBJ = CSceneNodeAnimatorCameraFPS.o CSceneNodeAnimatorCameraMaya.o CSceneNodeAnimatorCollisionResponse.o CSceneNodeAnimatorDelete.o CSceneNodeAnimatorFlyCircle.o CSceneNodeAnimatorFlyStraight.o CSceneNodeAnimatorFollowSpline.o CSceneNodeAnimatorRotation.o CSceneNodeAnimatorTexture.o
IRRDRVROBJ = CNullDriver.o COpenGLDriver.o COpenGLNormalMapRenderer.o COpenGLParallaxMapRenderer.o COpenGLShaderMaterialRenderer.o COpenGLTexture.o COpenGLSLMaterialRenderer.o COpenGLExtensionHandler.o CD3D8Driver.o CD3D8NormalMapRenderer.o CD3D8ParallaxMapRenderer.o CD3D8ShaderMaterialRenderer.o CD3D8Texture.o CD3D9Driver.o CD3D9HLSLMaterialRenderer.o CD3D9NormalMapRenderer.o CD3D9ParallaxMapRenderer.o CD3D9ShaderMaterialRenderer.o CD3D9Texture.o IRRDRVROBJ = CNullDriver.o COpenGLDriver.o COpenGLNormalMapRenderer.o COpenGLParallaxMapRenderer.o COpenGLShaderMaterialRenderer.o COpenGLTexture.o COpenGLSLMaterialRenderer.o COpenGLExtensionHandler.o CD3D8Driver.o CD3D8NormalMapRenderer.o CD3D8ParallaxMapRenderer.o CD3D8ShaderMaterialRenderer.o CD3D8Texture.o CD3D9Driver.o CD3D9HLSLMaterialRenderer.o CD3D9NormalMapRenderer.o CD3D9ParallaxMapRenderer.o CD3D9ShaderMaterialRenderer.o CD3D9Texture.o
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment