Update of /cvsroot/simspark/simspark/spark/oxygen/geometryserver
In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv19254
Modified Files:
Tag: projectx
geometryserver.cpp
Log Message:
added support for meshexporter
Index: geometryserver.cpp
===================================================================
RCS file: /cvsroot/simspark/simspark/spark/oxygen/geometryserver/geometryserver.cpp,v
retrieving revision 1.2.4.1
retrieving revision 1.2.4.2
diff -C2 -d -r1.2.4.1 -r1.2.4.2
*** geometryserver.cpp 30 Mar 2007 03:19:05 -0000 1.2.4.1
--- geometryserver.cpp 5 Apr 2007 04:13:06 -0000 1.2.4.2
***************
*** 22,25 ****
--- 22,26 ----
#include "geometryserver.h"
#include "meshimporter.h"
+ #include "meshexporter.h"
#include <zeitgeist/logserver/logserver.h>
***************
*** 38,50 ****
}
! void GeometryServer::OnLink()
{
if (mChildren.size() == 0)
! {
! InitMeshImporter("oxygen/StdMeshImporter");
! }
}
! bool GeometryServer::InitMeshImporter(const string& importerName)
{
shared_ptr<MeshImporter> importer
--- 39,53 ----
}
! void
! GeometryServer::OnLink()
{
if (mChildren.size() == 0)
! {
! InitMeshImporter("oxygen/StdMeshImporter");
! }
}
! bool
! GeometryServer::InitMeshImporter(const string& importerName)
{
shared_ptr<MeshImporter> importer
***************
*** 52,60 ****
if (importer.get() == 0)
! {
! GetLog()->Error() << "(GeometryServer) ERROR: "
! << "unable to create '" << importerName << "'\n";
! return false;
! }
importer->SetName(importerName);
--- 55,63 ----
if (importer.get() == 0)
! {
! GetLog()->Error() << "(GeometryServer) ERROR: "
! << "unable to create '" << importerName << "'\n";
! return false;
! }
importer->SetName(importerName);
***************
*** 68,76 ****
shared_ptr<TriMesh>
! GeometryServer::GetMesh(const string& name, const::ParameterList& parameter)
{
// try a direct match
string meshName = name;
! TMeshMap::iterator meshIter = mMeshMap.find(meshName);
if (meshIter != mMeshMap.end())
--- 71,79 ----
shared_ptr<TriMesh>
! GeometryServer::GetMesh(const string& name, const::ParameterList& parameter)
{
// try a direct match
string meshName = name;
! TMeshMap::const_iterator meshIter = mMeshMap.find(meshName);
if (meshIter != mMeshMap.end())
***************
*** 169,173 ****
}
! TMeshMap::iterator iter = mMeshMap.find(name);
if (iter != mMeshMap.end())
{
--- 172,176 ----
}
! TMeshMap::const_iterator iter = mMeshMap.find(name);
if (iter != mMeshMap.end())
{
***************
*** 177,182 ****
--- 180,214 ----
mMeshMap[name] = mesh;
GetLog()->Normal() << "(GeometryServer) mesh " << name << " registered\n";
+
+ TLeafList exporters;
+ ListChildrenSupportingClass<MeshExporter>(exporters);
+
+ for (TLeafList::const_iterator bi = exporters.begin(); bi != exporters.end(); ++bi)
+ {
+ GetLog()->Normal() << "(GeometryServer) additionally registered mesh "
+ << name << " via MeshExporter '" << (*bi)->GetName() << "'\n";
+ shared_ptr<MeshExporter> mb = shared_static_cast<MeshExporter>(*bi);
+ mb->RegisterMesh(mesh);
+ }
}
+ bool
+ GeometryServer::InitMeshExporter(const string& name)
+ {
+ shared_ptr<MeshExporter> exporter
+ = shared_dynamic_cast<MeshExporter>(GetCore()->New(name));
+
+ if (exporter.get() == 0)
+ {
+ GetLog()->Error() << "(GeometryServer) ERROR: "
+ << "unable to create MeshExporter '" << name << "'\n";
+ return false;
+ }
+ exporter->SetName(name);
+ AddChildReference(exporter);
+ GetLog()->Normal() << "(GeometryServer) MeshExporter '" << name << "' registered\n";
+
+ return true;
+ }
|