scene.C

Go to the documentation of this file.
00001 /*
00002  * This file is part of the "Archon" framework.
00003  * (http://files3d.sourceforge.net)
00004  *
00005  * Copyright © 2002 by Kristian Spangsege and Brian Kristiansen.
00006  *
00007  * Permission to use, copy, modify, and distribute this software and
00008  * its documentation under the terms of the GNU General Public License is
00009  * hereby granted. No representations are made about the suitability of
00010  * this software for any purpose. It is provided "as is" without express
00011  * or implied warranty. See the GNU General Public License
00012  * (http://www.gnu.org/copyleft/gpl.html) for more details.
00013  *
00014  * The characters in this file are ISO8859-1 encoded.
00015  *
00016  * The documentation in this file is in "Doxygen" style
00017  * (http://www.doxygen.org).
00018  */
00019 
00026 #include <archon/x3d/server/server.H>
00027 #include <archon/x3d/server/scene.H>
00028 
00029 namespace Archon
00030 {
00031   namespace X3D
00032   {
00033     void SceneBase::refForwardDestroy()
00034     {
00035       rootGroup.reset();
00036     }
00037 
00038     Ref<Group> SceneBase::getRootGroup() const
00039     {
00040       {
00041         Mutex::Lock l(contextMutex);
00042         if(!isRealizedNoLock()) return rootGroup;
00043       }
00044       try
00045       {
00046         Mutex::Lock l(server->scenegraphMutex);
00047         return rootGroup;
00048       }
00049       catch(ForwardDestroyedException &) { return 0; }
00050     }
00051 
00052     void SceneBase::setRootGroup(Ref<Group> g)
00053     {
00054       if(g)
00055       {
00056         if(g->context != this)
00057           ARCHON_THROW1(ArgumentException,
00058                         "setRootGroup: Group has wrong context");
00059         g->realize();
00060       }
00061 
00062       {
00063         Mutex::Lock l(contextMutex);
00064         if(!isRealizedNoLock())
00065         {
00066           rootGroup = g;
00067           return;
00068         }
00069       }
00070       try
00071       {
00072         Mutex::Lock l(server->scenegraphMutex);
00073         rootGroup = g;
00074       }
00075       catch(ForwardDestroyedException &) {}
00076     }
00077 
00078     SceneBase::SceneBase(Ref<Server> server, Uri baseUri,
00079                          Ref<AbstractFileServer> fileServer):
00080       ExecutionContext(server, baseUri, fileServer)
00081     {
00082     }
00083 
00084     Scene::Scene(Ref<Server> server, Uri baseUri,
00085                  Ref<AbstractFileServer> fileServer):
00086       SceneBase(server, baseUri, fileServer)
00087     {
00088     }
00089 
00090     /*
00091     string Scene::dump(int level) const
00092     {
00093       string s = "#X3D V3.0 utf8\nPROFILE Immersive\n";
00094       for(Group::const_iterator i = rootGroup->begin(); i != rootGroup->end(); ++i)
00095         if(*i) s += "\n" + (*i)->dump(level);
00096       return s;
00097     }
00098     */
00099   }
00100 }

Generated on Sun Jul 30 22:55:50 2006 for Archon by  doxygen 1.4.4