Manta Interactive Ray Tracer Development Mailing List

Text archives Help


[MANTA] r418 - in branches/newpipeline: Engine/Control Interface


Chronological Thread 
  • From: sparker@sci.utah.edu
  • To: manta@sci.utah.edu
  • Subject: [MANTA] r418 - in branches/newpipeline: Engine/Control Interface
  • Date: Thu, 30 Jun 2005 15:21:24 -0600 (MDT)

Author: sparker
Date: Thu Jun 30 15:21:23 2005
New Revision: 418

Modified:
   branches/newpipeline/Engine/Control/CMakeLists.txt
   branches/newpipeline/Engine/Control/Manta.cc
   branches/newpipeline/Engine/Control/Manta.h
   branches/newpipeline/Interface/MantaInterface.h
Log:
More thrashing


Modified: branches/newpipeline/Engine/Control/CMakeLists.txt
==============================================================================
--- branches/newpipeline/Engine/Control/CMakeLists.txt  (original)
+++ branches/newpipeline/Engine/Control/CMakeLists.txt  Thu Jun 30 15:21:23 
2005
@@ -1,6 +1,5 @@
 
 SET (Manta_Control_SRCS
      Control/Manta.cc
-     Control/Manta_register.cc
      Control/Worker.cc
      )

Modified: branches/newpipeline/Engine/Control/Manta.cc
==============================================================================
--- branches/newpipeline/Engine/Control/Manta.cc        (original)
+++ branches/newpipeline/Engine/Control/Manta.cc        Thu Jun 30 15:21:23 
2005
@@ -1,5 +1,6 @@
 
-#include <Engine/Control/RTRT.h>
+#include <Engine/Control/Manta.h>
+#if 0
 #include <Core/Util/Args.h>
 #include <Engine/Control/Worker.h>
 #include <Interface/AmbientLight.h>
@@ -37,9 +38,11 @@
 #include <sys/stat.h>
 #include <dlfcn.h>
 #include <stdio.h>
-
+#endif
 
 using namespace Manta;
+
+#if 0
 using namespace std;
 using SCIRun::IllegalValue;
 using SCIRun::InvalidState;
@@ -47,76 +50,60 @@
 using SCIRun::Thread;
 using SCIRun::Time;
 using SCIRun::split_string;
+#endif
 
 #define RENDER_THREAD_STACKSIZE 1024*1024
 
 namespace Manta {
-  RTRTInterface* createRTRT()
+  MantaInterface* createManta()
   {
-    return new RTRT();
+    return new Manta();
   }
 
   bool bool_or(const bool& b1, const bool& b2) {
     return b1 || b2;
   }
-  void registerKnownComponents(RTRTInterface* rtrt);
+  void registerKnownComponents(MantaInterface* engine);
 }
 
-RTRT::RTRT()
-  : runningLock("RTRT running mutex"),
-    callbackLock("RTRT callback r/w lock"),
-    barrier1("RTRT frame barrier #1"),
-    barrier2("RTRT frame barrier #2"),
-    barrier3("RTRT frame barrier #3"),
-    transaction_lock("RTRT transaction lock"),
-    ids("RTRT id counter", 1)
+Manta::Manta()
+  : runningLock("Manta running mutex"),
+    callbackLock("Manta callback r/w lock"),
+    barrier1("Manta frame barrier #1"),
+    barrier2("Manta frame barrier #2"),
+    barrier3("Manta frame barrier #3"),
+    transaction_lock("Manta transaction lock"),
+    ids("Manta id counter", 1)
 {
   workersWanted=0;
-  workersRendering=0;
-  workersAnimAndImage=0;
   running=false;
   animFrameState.frameNumber = 0;
   animFrameState.frameTime = 0;
-  timeMode = RTRTInterface::RealTime;
+  timeMode = MantaInterface::RealTime;
   timeScale = 1;
   frameRate = 15;
   pipelineNeedsSetup = true;
-  currentImageCreator = 0;
-  registerKnownComponents(this);
-  scene = 0;
   verbose_transactions = false;
 }
 
-RTRT::~RTRT()
+Manta::~Manta()
 {
-  for(ChannelListType::iterator iter = channels.begin();
-      iter != channels.end(); iter++){
-    Channel* channel = *iter;
-    delete channel->display;
-    for(vector<Image*>::iterator iter = channel->images.begin();
-       iter != channel->images.end(); iter++)
-      delete *iter;
-  }
-  delete currentImageTraverser;
-  delete currentLoadBalancer;
-  delete currentPixelSampler;
-  delete currentRenderer;
 }
 
-void RTRT::changeNumWorkers(int newNumWorkers)
+void Manta::changeNumWorkers(int newNumWorkers)
 {
   if(newNumWorkers <= 0)
-    throw IllegalValue<int>("RTRT::changeNumWorkers, number of workers 
should be > 0", newNumWorkers);
+    throw IllegalValue<int>("Manta::changeNumWorkers, number of workers 
should be > 0", newNumWorkers);
 
   workersWanted=newNumWorkers;
 }
 
-TValue<int>& RTRT::numWorkers()
+TValue<int>& Manta::numWorkers()
 {
   return workersWanted;
 }
 
-void RTRT::addOneShotCallback(Whence /*whence*/, long frame,
+void Manta::addOneShotCallback(Whence /*whence*/, long frame,
                              CallbackBase_2Data<int, int>* callback)
 {
 #if NOTFINISHED
@@ -124,38 +111,38 @@
 #endif
   callbackLock.writeLock();
 #if NOTFINISHED
-  if(whence == RTRTInterface::Relative)
+  if(whence == MantaInterface::Relative)
     frame += current Fame;
 #endif
   oneShots.insert(OneShotMapType::value_type(frame, callback));
   callbackLock.writeUnlock();
 }
 
-void RTRT::registerSetupCallback(SetupCallback* callback)
+void Manta::registerSetupCallback(SetupCallback* callback)
 {
   setupCallbacks.push_back(callback);
 }
 
-void RTRT::registerParallelAnimationCallback(CallbackBase_3Data<int, int, 
bool&>* cb)
+void Manta::registerParallelAnimationCallback(CallbackBase_3Data<int, int, 
bool&>* cb)
 {
   callbackLock.writeLock();
   parallelAnimationCallbacks.push_back(cb);
   callbackLock.writeUnlock();
 }
 
-void RTRT::registerSerialAnimationCallback(CallbackBase_3Data<int, int, 
bool&>* cb)
+void Manta::registerSerialAnimationCallback(CallbackBase_3Data<int, int, 
bool&>* cb)
 {
   callbackLock.writeLock();
   serialAnimationCallbacks.push_back(cb);
   callbackLock.writeUnlock();
 }
 
-void RTRT::setTimeMode(TimeMode /*tm*/, double /*rate*/)
+void Manta::setTimeMode(TimeMode /*tm*/, double /*rate*/)
 {
-  NOT_FINISHED("RTRT::setTimeMode");
+  NOT_FINISHED("Manta::setTimeMode");
 }
 
-void RTRT::beginRendering(bool blockUntilFinished)
+void Manta::beginRendering(bool blockUntilFinished)
 {
   runningLock.lock();
   if(running)
@@ -195,7 +182,7 @@
   for(int i=0;i<workersWanted;i++){
     if(i>0 || !blockUntilFinished){
       ostringstream name;
-      name << "RTRT Worker " << i;
+      name << "Manta Worker " << i;
       Thread* t = new Thread(new Worker(this, i, false), name.str().c_str(),
                             0, Thread::NotActivated);
       t->setStackSize(RENDER_THREAD_STACKSIZE);
@@ -207,14 +194,14 @@
     internalRenderLoop(0, false);
 }
 
-void RTRT::blockUntilFinished()
+void Manta::blockUntilFinished()
 {
   ASSERT(running);
   ASSERT(workers.size()>0);
   workers[0]->join();
 }
 
-void RTRT::internalRenderLoop(int proc, bool lateComerFlag)
+void Manta::internalRenderLoop(int proc, bool lateComerFlag)
 {
   bool changed = true;
   bool firstFrame = true;
@@ -291,7 +278,7 @@
        workersRendering = workersWanted;
        for(int i=oldworkers;i<newWorkers;i++){
          ostringstream name;
-         name << "RTRT Worker " << i;
+         name << "Manta Worker " << i;
          workers[i] = new Thread(new Worker(this, i, true), 
name.str().c_str(),
                                  0, Thread::NotActivated);
          workers[i]->setStackSize(RENDER_THREAD_STACKSIZE);
@@ -423,7 +410,7 @@
   }
 }
 
-void RTRT::doParallelAnimationCallbacks(bool& changed, int proc, int 
numProcs)
+void Manta::doParallelAnimationCallbacks(bool& changed, int proc, int 
numProcs)
 {
   // All threads do the parallel animation callbacks
   for(ACallbackMapType::iterator iter = parallelAnimationCallbacks.begin();
@@ -432,7 +419,7 @@
   }
 }
 
-void RTRT::doSerialAnimationCallbacks(bool& changed, int proc, int numProcs)
+void Manta::doSerialAnimationCallbacks(bool& changed, int proc, int numProcs)
 {
   if(proc == 0){
     // One-shots are always done by p0, since we do not always know
@@ -454,7 +441,7 @@
     (*iter)->call(proc, numProcs, changed);
 }
 
-void RTRT::postTransactions(bool& changed)
+void Manta::postTransactions(bool& changed)
 {
   if(transactions.size() > 0){
     transaction_lock.lock();
@@ -481,7 +468,7 @@
   }
 }
 
-void RTRT::doParallelPreRenderCallbacks(int proc, int numProcs)
+void Manta::doParallelPreRenderCallbacks(int proc, int numProcs)
 {
   // All threads do the parallel pre-render callbacks
   for(PRCallbackMapType::iterator iter = parallelPreRenderCallbacks.begin();
@@ -490,7 +477,7 @@
   }
 }
 
-void RTRT::doSerialPreRenderCallbacks(int proc, int numProcs)
+void Manta::doSerialPreRenderCallbacks(int proc, int numProcs)
 {
   unsigned long totalCallbacks = serialPreRenderCallbacks.size();
   unsigned long start = proc*totalCallbacks/numProcs;
@@ -501,13 +488,13 @@
     (*iter)->call(proc, numProcs);
 }
 
-void RTRT::processDeletions()
+void Manta::processDeletions()
 {
 #if NOTFINISHED
 #endif
 }
 
-void RTRT::doIdleModeCallbacks(bool changed, bool firstFrame,
+void Manta::doIdleModeCallbacks(bool changed, bool firstFrame,
                                bool& pipelineNeedsSetup,
                                int proc, int numProcs)
 {
@@ -522,7 +509,7 @@
   }
 }
 
-void RTRT::finish()
+void Manta::finish()
 {
 #if NOTFINISHED
   decide what to do based on whether we are in animation section or not or 
an external thread...  How to do this efficiently? Thread-local data?;
@@ -531,7 +518,7 @@
   workersWanted = 0;
 }
 
-int RTRT::createChannel(const string& spec, Camera* camera, bool stereo, int 
xres, int yres)
+int Manta::createChannel(const string& spec, Camera* camera, bool stereo, 
int xres, int yres)
 {
   string name;
   vector<string> args;
@@ -557,7 +544,7 @@
   return channel->id;
 }
 
-void RTRT::registerComponent(const string& name, ImageDisplayCreator fun)
+void Manta::registerComponent(const string& name, ImageDisplayCreator fun)
 {
   ImageDisplayMapType::iterator iter = imageDisplays.find(name);
   if(iter != imageDisplays.end())
@@ -565,28 +552,28 @@
   imageDisplays[name] = fun;
 }
 
-RTRTInterface::listType RTRT::listImageDisplays() const
+MantaInterface::listType Manta::listImageDisplays() const
 {
-  RTRTInterface::listType list;
+  MantaInterface::listType list;
   for(ImageDisplayMapType::const_iterator iter = imageDisplays.begin();
       iter != imageDisplays.end(); iter++)
     list.push_back(iter->first);
   return list;
 }
 
-Camera* RTRT::getCamera(int channel) const
+Camera* Manta::getCamera(int channel) const
 {
   return channels[channel]->camera;
 }
 
-void RTRT::getResolution(int channel, bool& stereo, int& xres, int& yres)
+void Manta::getResolution(int channel, bool& stereo, int& xres, int& yres)
 {
   stereo = channels[channel]->stereo;
   xres = channels[channel]->xres;
   yres = channels[channel]->yres;
 }
 
-void RTRT::changeResolution(int channel, int xres, int yres,
+void Manta::changeResolution(int channel, int xres, int yres,
                             bool changePipeline)
 {
   channels[channel]->xres = xres;
@@ -595,7 +582,7 @@
     pipelineNeedsSetup = true;
 }
 
-void RTRT::setupPipelines(int numProcs)
+void Manta::setupPipelines(int numProcs)
 {
   int numChannels = static_cast<int>(channels.size());
   SetupContext globalcontext(this, numChannels, 0, numProcs,
@@ -634,7 +621,7 @@
     int depth = context.getMinDepth();
     if(depth == 1 && context.getMaxDepth() > 1)
       depth = 2; // Prefer double-buffering
-    cerr << "RTRT::setupPipelines:: depth = "<< depth << "\n";
+    cerr << "Manta::setupPipelines:: depth = "<< depth << "\n";
     channel->pipelineDepth = depth;
     unsigned long osize = channel->images.size();
     for(unsigned long i=depth;i<osize;i++)
@@ -645,7 +632,7 @@
   }
 }
   
-void RTRT::resizeImages(long frame)
+void Manta::resizeImages(long frame)
 {
   for(ChannelListType::iterator iter = channels.begin();
       iter != channels.end(); iter++){
@@ -673,435 +660,11 @@
   }
 }
 
-bool RTRT::selectImageType(const string& spec)
-{
-  string name;
-  currentImageCreatorArgs.resize(0);
-  parseSpec(spec, name, currentImageCreatorArgs);
-  ImageCreatorMapType::iterator iter = imageCreators.find(name);
-  if(iter == imageCreators.end())
-    return false;
-  currentImageCreator = iter->second;
-  return true;
-}
-
-void RTRT::registerComponent(const string& name, ImageCreator fun)
-{
-  ImageCreatorMapType::iterator iter = imageCreators.find(name);
-  if(iter != imageCreators.end())
-    throw IllegalValue<string>("Duplicate ImageCreator component", name);
-  imageCreators[name] = fun;
-}
-
-RTRTInterface::listType RTRT::listImageTypes() const
-{
-  RTRTInterface::listType list;
-  for(ImageCreatorMapType::const_iterator iter = imageCreators.begin();
-      iter != imageCreators.end(); iter++)
-    list.push_back(iter->first);
-  return list;
-}
-
-bool RTRT::selectImageTraverser(const string& spec)
-{
-  string name;
-  vector<string> args;
-  parseSpec(spec, name, args);
-  ImageTraverserMapType::iterator iter = imageTraversers.find(name);
-  if(iter == imageTraversers.end())
-    return false;
-  currentImageTraverser = (*iter->second)(args);
-  return true;
-}
-
-void RTRT::registerComponent(const string& name, ImageTraverserCreator fun)
-{
-  ImageTraverserMapType::iterator iter = imageTraversers.find(name);
-  if(iter != imageTraversers.end())
-    throw IllegalValue<string>("Duplicate ImageTraverser component", name);
-  imageTraversers[name] = fun;
-}
-
-RTRTInterface::listType RTRT::listImageTraversers() const
-{
-  RTRTInterface::listType list;
-  for(ImageTraverserMapType::const_iterator iter = imageTraversers.begin();
-      iter != imageTraversers.end(); iter++)
-    list.push_back(iter->first);
-  return list;
-}
-
-bool RTRT::selectLoadBalancer(const string& spec)
-{
-  string name;
-  vector<string> args;
-  parseSpec(spec, name, args);
-  LoadBalancerMapType::iterator iter = loadBalancers.find(name);
-  if(iter == loadBalancers.end())
-    return false;
-  currentLoadBalancer = (*iter->second)(args);
-  return true;
-}
-
-void RTRT::registerComponent(const string& name, LoadBalancerCreator fun)
-{
-  LoadBalancerMapType::iterator iter = loadBalancers.find(name);
-  if(iter != loadBalancers.end())
-    throw IllegalValue<string>("Duplicate LoadBalancer component", name);
-  loadBalancers[name] = fun;
-}
-
-RTRTInterface::listType RTRT::listLoadBalancers() const
-{
-  RTRTInterface::listType list;
-  for(LoadBalancerMapType::const_iterator iter = loadBalancers.begin();
-      iter != loadBalancers.end(); iter++)
-    list.push_back(iter->first);
-  return list;
-}
-
-bool RTRT::selectPixelSampler(const string& spec)
-{
-  string name;
-  vector<string> args;
-  parseSpec(spec, name, args);
-  PixelSamplerMapType::iterator iter = pixelSamplers.find(name);
-  if(iter == pixelSamplers.end())
-    return false;
-  currentPixelSampler = (*iter->second)(args);
-  return true;
-}
-
-void RTRT::registerComponent(const string& name, PixelSamplerCreator fun)
-{
-  PixelSamplerMapType::iterator iter = pixelSamplers.find(name);
-  if(iter != pixelSamplers.end())
-    throw IllegalValue<string>("Duplicate PixelSampler component", name);
-  pixelSamplers[name] = fun;
-}
-
-RTRTInterface::listType RTRT::listPixelSamplers() const
-{
-  RTRTInterface::listType list;
-  for(PixelSamplerMapType::const_iterator iter = pixelSamplers.begin();
-      iter != pixelSamplers.end(); iter++)
-    list.push_back(iter->first);
-  return list;
-}
-
-bool RTRT::selectRenderer(const string& spec)
-{
-  string name;
-  vector<string> args;
-  parseSpec(spec, name, args);
-  RendererMapType::iterator iter = renderers.find(name);
-  if(iter == renderers.end())
-    return false;
-  currentRenderer = (*iter->second)(args);
-  return true;
-}
-
-void RTRT::registerComponent(const string& name, RendererCreator fun)
-{
-  RendererMapType::iterator iter = renderers.find(name);
-  if(iter != renderers.end())
-    throw IllegalValue<string>("Duplicate Renderer component", name);
-  renderers[name] = fun;
-}
-
-RTRTInterface::listType RTRT::listRenderers() const
-{
-  RTRTInterface::listType list;
-  for(RendererMapType::const_iterator iter = renderers.begin();
-      iter != renderers.end(); iter++)
-    list.push_back(iter->first);
-  return list;
-}
-
-bool RTRT::addIdleMode(const string& spec)
-{
-  string name;
-  vector<string> args;
-  parseSpec(spec, name, args);
-  IdleModeMapType::iterator iter = idleModes.find(name);
-  if(iter == idleModes.end())
-    return false;
-  currentIdleModes.push_back((*iter->second)(args));
-  return true;
-}
-
-void RTRT::registerComponent(const string& name, IdleModeCreator fun)
-{
-  IdleModeMapType::iterator iter = idleModes.find(name);
-  if(iter != idleModes.end())
-    throw IllegalValue<string>("Duplicate IdleMode component", name);
-  idleModes[name] = fun;
-}
-
-RTRTInterface::listType RTRT::listIdleModes() const
-{
-  RTRTInterface::listType list;
-  for(IdleModeMapType::const_iterator iter = idleModes.begin();
-      iter != idleModes.end(); iter++)
-    list.push_back(iter->first);
-  return list;
-}
-
-bool RTRT::selectShadowAlgorithm(const string& spec)
-{
-  string name;
-  vector<string> args;
-  parseSpec(spec, name, args);
-  ShadowAlgorithmMapType::iterator iter = shadowAlgorithms.find(name);
-  if(iter == shadowAlgorithms.end())
-    return false;
-  currentShadowAlgorithm = (*iter->second)(args);
-  return true;
-}
-
-void RTRT::registerComponent(const string& name, ShadowAlgorithmCreator fun)
-{
-  ShadowAlgorithmMapType::iterator iter = shadowAlgorithms.find(name);
-  if(iter != shadowAlgorithms.end())
-    throw IllegalValue<string>("Duplicate ShadowAlgorithm component", name);
-  shadowAlgorithms[name] = fun;
-}
-
-RTRTInterface::listType RTRT::listShadowAlgorithms() const
-{
-  RTRTInterface::listType list;
-  for(ShadowAlgorithmMapType::const_iterator iter = shadowAlgorithms.begin();
-      iter != shadowAlgorithms.end(); iter++)
-    list.push_back(iter->first);
-  return list;
-}
-
-Camera* RTRT::createCamera(const string& spec)
-{
-  string name;
-  vector<string> args;
-  parseSpec(spec, name, args);
-  CameraMapType::iterator iter = cameras.find(name);
-  if(iter == cameras.end()){
-    return 0;
-  }
-  return (*iter->second)(args);
-}
-
-void RTRT::registerComponent(const string& name, CameraCreator fun)
-{
-  CameraMapType::iterator iter = cameras.find(name);
-  if(iter != cameras.end())
-    throw IllegalValue<string>("Duplicate Camera component", name);
-  cameras[name] = fun;
-}
-
-RTRTInterface::listType RTRT::listCameras() const
-{
-  RTRTInterface::listType list;
-  for(CameraMapType::const_iterator iter = cameras.begin();
-      iter != cameras.end(); iter++)
-    list.push_back(iter->first);
-  return list;
-}
-
-bool RTRT::haveScene()
-{
-  return scene != 0;
-}
-
-void RTRT::setScene(Scene* newScene)
-{
-  scene = newScene;
-}
-
-bool RTRT::readScene(const string& spec)
-{
-  string name;
-  vector<string> args;
-  parseSpec(spec, name, args);
-
-  // Pull off the suffix...
-  string::size_type dot = name.rfind('.');
-  string suffix;
-  if(dot == string::npos){
-    suffix="";
-  } else {
-    suffix = name.substr(dot+1);
-  }
-  Scene* newScene = 0;
-
-  // These are to try and guess what the shared library extension is
-  // on various systems.
-  string system_suffix;
-#if defined (__APPLE__)
-  system_suffix = "dylib";
-#elif defined (_WIN32) || defined (__CYGWIN__)
-  system_suffix = "dll";
-#else
-  system_suffix = "so";
-#endif
-
-  std::cout << "Scene suffix: " << suffix << std::endl;
-  
-  if((suffix == "mo") || (suffix == "so") || (suffix == "dylib") ||
-     (suffix == "dll")) {
-    // Do this twice - once silently and once printing errors
-    std::cout << "Reading "<<suffix<<" scene\n";
-    
-    newScene = readMOScene(name, args, false);
-    if(!newScene)
-      readMOScene(name, args, true);
-  } else {
-    // Try reading it as an MO
-    std::cout << "Appending "<<system_suffix<<" to scene" << std::endl;
-    
-    newScene = readMOScene(name+"."+system_suffix, args, false);
-
-#if 0
-    // This looks redundant, going to nix it.
-    if(!newScene){
-      readMOScene(name+".so", args, true);
-    }
-#endif
-  }
-  if(!newScene){
-    return false;
-  } else {
-    scene = newScene;
-    return true;
-  }
-}
-
-void RTRT::setScenePath(const string& path)
-{
-  scenePath = path;
-}
-
-Group* RTRT::makeGroup(const string& groupSpec)
-{
-  string name;
-  vector<string> args;
-  parseSpec(groupSpec, name, args);
-  GroupMapType::iterator iter = groups.find(name);
-  if(iter == groups.end())
-    return 0;
-  Group* group = (*iter->second)(args);
-  return group;
-}
-
-void RTRT::registerObject(const string& name, GroupCreator creator)
-{
-  GroupMapType::iterator iter = groups.find(name);
-  if(iter != groups.end())
-    throw IllegalValue<string>("Duplicate group", name);
-  groups[name] = creator;
-}
-
-RTRTInterface::listType RTRT::listGroups() const
-{
-  RTRTInterface::listType list;
-  for(GroupMapType::const_iterator iter = groups.begin();
-      iter != groups.end(); iter++)
-    list.push_back(iter->first);
-  return list;
-}
-
-Scene* RTRT::readMOScene(const string& name, const vector<string>& args,
-                        bool printErrors)
-{
-  vector<string> dirs = split_string(scenePath, ':');
-  for(vector<string>::iterator dir = dirs.begin(); dir != dirs.end(); dir++){
-    string fullname = *dir + "/"+name;
-    struct stat statbuf;
-    if(stat(fullname.c_str(), &statbuf) != 0){
-      if(printErrors){
-       cerr << "Error reading " << fullname << ": " << strerror(errno) << 
'\n';
-      }
-      continue;
-    }
-    void* handle=dlopen(fullname.c_str(), RTLD_NOW);
-    if(!handle){
-      if(printErrors){
-       cerr << "Error opening scene: " << fullname << '\n';
-       cerr << dlerror() << '\n';
-      }
-      continue;
-    }
-    void* scene_fn=dlsym(handle, "make_scene");
-    if(!scene_fn){
-      if(printErrors){
-       cerr << "Scene file found, but make_scene() function not found\n";
-      }
-      // If we get here, we fail so that we don't keep searching the path
-      // for another scene
-      return 0;
-    }
-    typedef Scene* (*MakerType)(const ReadContext&, const vector<string>&);
-    //    MakerType make_scene = reinterpret_cast<MakerType>(scene_fn);
-    MakerType make_scene = (MakerType)(scene_fn);
-    ReadContext context(this);
-    Scene* scene=(*make_scene)(context, args);
-    if(!scene){
-      if(printErrors)
-       cerr << "scene " << name << " did not produce a scene\n";
-      return 0;
-    }
-    return scene;
-  }
-  return 0;
-}
-
-UserInterface* RTRT::createUserInterface(const string& spec)
-{
-  string name;
-  vector<string> args;
-  parseSpec(spec, name, args);
-  UserInterfaceMapType::iterator iter = userInterfaces.find(name);
-  if(iter == userInterfaces.end())
-    return 0;
-  // This will create a new UserInterface
-  UserInterface *ui = (*iter->second)(args, this);
-  return ui;
-}
-
-void RTRT::registerComponent(const string& name, UserInterfaceCreator 
creator)
-{
-  UserInterfaceMapType::iterator iter = userInterfaces.find(name);
-  if(iter != userInterfaces.end())
-    throw IllegalValue<string>("Duplicate User Interface component", name);
-  userInterfaces[name] = creator;
-}
-
-RTRTInterface::listType RTRT::listUserInterfaces() const
-{
-  RTRTInterface::listType list;
-  for(UserInterfaceMapType::const_iterator iter = userInterfaces.begin();
-      iter != userInterfaces.end(); iter++)
-    list.push_back(iter->first);
-  return list;
-}
-
-bool RTRT::queryState(const string& which, vector<string>& results) {
-  if (which == "shadows") {
-    results.push_back(currentShadowAlgorithm->getName());
-    results.push_back(currentShadowAlgorithm->getSpecs());
-  } else if (which == "numworkers") {
-    int numworkers = static_cast<int>(workers.size());
-    char buf[100];
-    sprintf(buf, "%d", numworkers);
-    results.push_back(buf);
-  }  else {
-    return false;
-  }
-  return true;
-}
-
 /*
  * Transactions
  */
 
-void RTRT::addTransaction(TransactionBase* transaction)
+void Manta::addTransaction(TransactionBase* transaction)
 {
   transaction_lock.lock();
   transactions.push_back(transaction);

Modified: branches/newpipeline/Engine/Control/Manta.h
==============================================================================
--- branches/newpipeline/Engine/Control/Manta.h (original)
+++ branches/newpipeline/Engine/Control/Manta.h Thu Jun 30 15:21:23 2005
@@ -1,8 +1,8 @@
 
-#ifndef Manta_Engine_RTRT_h
-#define Manta_Engine_RTRT_h
+#ifndef Manta_Engine_Manta_h
+#define Manta_Engine_Manta_h
 
-#include <Interface/RTRTInterface.h>
+#include <Interface/MantaInterface.h>
 #include <Interface/FrameState.h>
 #include <Interface/Parameters.h>
 #include <Core/Thread/AtomicCounter.h>
@@ -21,122 +21,49 @@
 namespace Manta {
   using namespace std;
 
-  RTRTInterface* createRTRT();
+  MantaInterface* createManta();
 
   class Camera;
   class Image;
   class Scene;
 
-  class RTRT : public RTRTInterface {
+  class Manta : public MantaInterface {
   public:
-    RTRT();
-    ~RTRT();
+    Manta();
+    ~Manta();
 
-    // Image Modes (opengl, file, mpeg, etc.)
-    virtual int createChannel(const string& modespec, Camera* camera,
-                             bool stereo, int xres, int yres);
-    virtual void registerComponent(const string& name, ImageDisplayCreator 
display);
-    virtual listType listImageDisplays() const;
-    virtual Camera* getCamera(int channel) const;
-    virtual void getResolution(int channel, bool& stereo, int& xres, int& 
yres);
-    virtual void changeResolution(int channel, int xres, int yres,
-                                  bool changePipeline);
-
-    // Image Traversers
-    virtual bool selectImageTraverser(const string& spec);
-    virtual void registerComponent(const string& name, ImageTraverserCreator 
creator);
-    virtual listType listImageTraversers() const;
-
-    // Image Types (rgb, rgba, float, etc.)
-    virtual bool selectImageType(const string& spec);
-    virtual void registerComponent(const string& name, ImageCreator display);
-    virtual listType listImageTypes() const;
-
-    // Load Balancers
-    virtual bool selectLoadBalancer(const string& spec);
-    virtual void registerComponent(const string& name, LoadBalancerCreator 
creator);
-    virtual listType listLoadBalancers() const;
-
-    // PixelSamplers
-    virtual bool selectPixelSampler(const string& spec);
-    virtual void registerComponent(const string& name, PixelSamplerCreator 
creator);
-    virtual listType listPixelSamplers() const;
-
-    // Renderers
-    virtual bool selectRenderer(const string& spec);
-    virtual void registerComponent(const string& name, RendererCreator 
creator);
-    virtual listType listRenderers() const;
-
-    // Shadow Algorithms
-    virtual bool selectShadowAlgorithm(const string& spec);
-    virtual void registerComponent(const string& name, 
ShadowAlgorithmCreator creator);
-    virtual listType listShadowAlgorithms() const;
-
-    // Idle modes
-    virtual bool addIdleMode(const string& spec);
-    virtual void registerComponent(const string& name, IdleModeCreator 
creator);
-    virtual listType listIdleModes() const;
-
-    // Camera
-    virtual Camera* createCamera(const string& spec);
-    virtual void registerComponent(const string& name, CameraCreator 
creator);
-    virtual listType listCameras() const;
-
-    // Scenes
-    virtual bool haveScene();
-    virtual void setScene(Scene* scene);
-    virtual bool readScene(const string& sceneSpec/*, const vector<string> 
&args*/);
-    virtual void setScenePath(const string& path);
-
-    // Groups
-    virtual Group* makeGroup(const string& groupSpec);
-    virtual void registerObject(const string& name, GroupCreator creator);
-    virtual listType listGroups() const;
-
-    // Callbacks
-    virtual void addOneShotCallback(Whence whence, long frame,
-                                   CallbackBase_2Data<int, int>* callback);
-    virtual void registerSetupCallback(SetupCallback*);
-    virtual void registerSerialAnimationCallback(CallbackBase_3Data<int, 
int, bool&>*);
-    virtual void registerParallelAnimationCallback(CallbackBase_3Data<int, 
int, bool&>*);
-
-    // Control of time/animation
+    // Settings
     virtual void setTimeMode(TimeMode tm, double rate);
 
     // Parallel processing
-    virtual void changeNumWorkers(int workers);
+    virtual void changeNumWorkers(int);
     virtual TValue<int>& numWorkers();
 
-    // Control
-    virtual void beginRendering(bool blockUntilFinished);
-    virtual void blockUntilFinished();
-
-    // Control
-    virtual void finish();
-
-    // User Interfaces
-    virtual UserInterface* createUserInterface(const string& spec);
-    virtual void registerComponent(const string& name, UserInterfaceCreator 
creator);
-    virtual listType listUserInterfaces() const;
+    // Main control loop
+    virtual void beginRendering(RenderingMode mode, bool blockUntilFinished);
+    virtual void triggerSingleFrame();
+    virtual void finishRendering(bool blockUntilFinished);
 
+    // Pipelines
+    virtual Pipeline* addPipeline();
 
-    // Query functions
-
-    // what specifies what you want which is then placed in result.
-    // If the function cannot determine what you want, false is return.
-    virtual bool queryState(const string& what, vector<string>& results);
+    // Callbacks
+    virtual void addOneShotCallback(Whence whence, long frame,
+                                   CallbackBase_2Data<int, int>* callback);
+    virtual void registerSetupCallback(SetupCallback*);
+    virtual void registerSerialAnimationCallback(CallbackBase_3Data<int, 
int, bool&>*);
+    virtual void registerParallelAnimationCallback(CallbackBase_3Data<int, 
int, bool&>*);
     
-    inline void barrierWait();
-
     // Transactions
     virtual void addTransaction(TransactionBase*);
+
   protected:
     friend class Worker;
     void internalRenderLoop(int workerIndex, bool lateComerFlag);
 
   private:
-    RTRT(const RTRT&);
-    RTRT& operator=(const RTRT&);
+    Manta(const Manta&);
+    Manta& operator=(const Manta&);
 
     void doParallelAnimationCallbacks(bool& changed, int proc, int numProcs);
     void doSerialAnimationCallbacks(bool& changed, int proc, int numProcs);
@@ -187,38 +114,6 @@
     void postTransactions(bool& changed);
     bool verbose_transactions;
 
-    // Component databases and current instances
-    typedef map<string, ImageDisplayCreator> ImageDisplayMapType;
-    ImageDisplayMapType imageDisplays;
-    typedef map<string, ImageCreator> ImageCreatorMapType;
-    ImageCreatorMapType imageCreators;
-    vector<string> currentImageCreatorArgs;
-    ImageCreator currentImageCreator;
-    typedef map<string, ImageTraverserCreator> ImageTraverserMapType;
-    ImageTraverserMapType imageTraversers;
-    ImageTraverser* currentImageTraverser;
-    typedef map<string, LoadBalancerCreator> LoadBalancerMapType;
-    LoadBalancerMapType loadBalancers;
-    LoadBalancer* currentLoadBalancer;
-    typedef map<string, PixelSamplerCreator> PixelSamplerMapType;
-    PixelSamplerMapType pixelSamplers;
-    PixelSampler* currentPixelSampler;
-    typedef map<string, RendererCreator> RendererMapType;
-    RendererMapType renderers;
-    Renderer* currentRenderer;
-    typedef map<string, ShadowAlgorithmCreator> ShadowAlgorithmMapType;
-    ShadowAlgorithmMapType shadowAlgorithms;
-    ShadowAlgorithm* currentShadowAlgorithm;
-    typedef map<string, IdleModeCreator> IdleModeMapType;
-    IdleModeMapType idleModes;
-    vector<IdleMode*> currentIdleModes;
-    typedef map<string, CameraCreator> CameraMapType;
-    CameraMapType cameras;
-    typedef map<string, UserInterfaceCreator> UserInterfaceMapType;
-    UserInterfaceMapType userInterfaces;
-    typedef map<string, GroupCreator> GroupMapType;
-    GroupMapType groups;
-
     // The pipeline
     bool pipelineNeedsSetup;
 
@@ -226,34 +121,6 @@
     TimeMode timeMode;
     double timeScale;
     double frameRate;
-
-    char pad0[MAXCACHELINESIZE];
-    FrameState animFrameState;
-    char pad1[MAXCACHELINESIZE];
-    FrameState renderFrameState;
-    char pad2[MAXCACHELINESIZE];
-
-    struct Channel {
-      int id;
-      ImageDisplay* display;
-      int xres, yres;
-      bool stereo;
-      int pipelineDepth;
-      bool active;
-      ImageCreator imageCreator;
-      vector<Image*> images;
-      Camera* camera;
-    };
-    typedef vector<Channel*> ChannelListType;
-    ChannelListType channels;
-
-    Scene* scene;
-    string scenePath;
-
-    SCIRun::AtomicCounter ids;
-
-    Scene* readMOScene(const string& name, const vector<string>& args,
-                      bool printErrors);
   };
 }
 

Modified: branches/newpipeline/Interface/MantaInterface.h
==============================================================================
--- branches/newpipeline/Interface/MantaInterface.h     (original)
+++ branches/newpipeline/Interface/MantaInterface.h     Thu Jun 30 15:21:23 
2005
@@ -38,7 +38,7 @@
     virtual void finishRendering(bool blockUntilFinished) = 0;
 
     // Pipelines
-    virtual Pipeline* createPipeline() = 0;
+    virtual Pipeline* addPipeline() = 0;
 
     // Query functions
 #if 0




  • [MANTA] r418 - in branches/newpipeline: Engine/Control Interface, sparker, 06/30/2005

Archive powered by MHonArc 2.6.16.

Top of page