interreality.org [VOS]
[Home] [About]
[Screenshots]
[Download]
[News]
[Community]
[Documentation] [Manual]
[Bugs & Requests] [Wiki]

/home/tetron/hack/vos/libs/vos/csplugin/ivosa3dl.hh

Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
00002     Copyright (C) 2004 by Peter Amstutz <http://www.interreality.org>
00003     Written by Peter Amstutz <http://www.interreality.org>
00004 
00005     This library is free software; you can redistribute it and/or
00006     modify it under the terms of the GNU Library General Public
00007     License as published by the Free Software Foundation; either
00008     version 2 of the License, or (at your option) any later version.
00009 
00010     This library is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013     Library General Public License for more details.
00014 
00015     You should have received a copy of the GNU Library General Public
00016     License along with this library; if not, write to the Free
00017     Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00018 */
00019 
00020 #ifndef __CS_INETWORK_VOSA3DL_H__
00021 #define __CS_INETWORK_VOSA3DL_H__
00022 
00023 #include <vos/vos/vos.hh>
00024 #include <crystalspace.h>
00025 
00026 struct iMeshWrapper;
00027 struct iProgressMeter;
00028 struct iRigidBody;
00029 struct iSector;
00030 
00031 /** @file
00032  * Plugin interface for the Crystal Space Virtual Object System (VOS)
00033  * Abstract 3D Layer plugin (A3DL).
00034  * VOS is an object-oriented distributed network architechture; A3DL is a
00035  * set of extensions to VOS to describe 3D scenes.  This plugin makes
00036  * it easy to access 3D virtual worlds described using A3DL with the
00037  * VOS protocol and loads those worlds into the Crystal Space engine.
00038  * For more information about VOS, see http://interreality.org.  You
00039  * will need the download the VOS software from in order to use this
00040  * plugin.
00041  *
00042  * @note This is very much a work in progress.  You can access the
00043  * underlying VOS API using scfQueryInterface to get iVosApi (defined
00044  * in ivosapi.h).  Something that we'd like to do (but this does not
00045  * currently support) is to be able to take the current CS engine
00046  * state and export to remote clients using VOS, and generally wrap
00047  * VOS enough that you could take a Crystal Space app that doesn't
00048  * know anything about networking and sprinkle it with the magic VOS
00049  * plugin powder and make it multiuser... :-)
00050 */
00051 
00052 
00053 SCF_VERSION (iVosObject3D, 0, 1, 1);
00054 
00055 /**
00056  * This interface bridges between a VOS 3D object and the Crystal
00057  * Space mesh wrapper created for that object.
00058  * @bug presently this isn't very useful since nothing yet returns this
00059  * interface.  Obviously that will change as the iVosSector interface
00060  * is fleshed out (or an alternate interface is introduced instead of this...).
00061  */
00062 struct iVosObject3D : public virtual iBase
00063 {
00064   /** Get the iMeshWrapper for this Object3D. */
00065   virtual csRef<iMeshWrapper> GetMeshWrapper() = 0;
00066 
00067   /**
00068    * Get the iRigidBody collider for this Object3D. This can be used to
00069    * control the forces o the object - useful for avatars
00070    *
00071    * This will return no object if there is no iDynamicsSystem registered in
00072    * the object registry
00073    */
00074   virtual csRef<iRigidBody> GetCollider() = 0;
00075 };
00076 
00077 SCF_VERSION (iVosSector, 0, 3, 1);
00078 
00079 /** This interface bridges between a VOS sector and a Crystal Space
00080     sector. */
00081 struct iVosSector : public virtual iBase
00082 {
00083   /**
00084    * Begin loading this sector in the background.  Network activity
00085    * occurs in another thread, so this method returns immediately.
00086    * An event is posted to the global event queue when the download is complete.
00087    * \param progress if supplied, this will be called back (in the CS thread)
00088    * periodically to indicate download progress
00089    */
00090   virtual void Load(iProgressMeter* progress = 0) = 0;
00091 
00092   /**
00093    * Get the Crystal Space iSector for this sector.  This will be
00094    * empty until Load() is called.
00095    */
00096   virtual csRef<iSector> GetSector() = 0;
00097 
00098   /**
00099    * Get the list of object3ds which have been loaded into this sector. This
00100    * list will change in size as objects are loaded and removed - does not
00101    * represent the list of objects in the A3DL sector
00102    */
00103   virtual const csSet< csPtrKey<iVosObject3D> > &GetObject3Ds() = 0;
00104 
00105   /** Write out lightmap caches for any lightmapped objects in the sector. */
00106   virtual void CacheLightmaps() = 0;
00107 };
00108 
00109 
00110 
00111 
00112 SCF_VERSION (iVosA3DL, 0, 1, 2);
00113 
00114 /**
00115  * This is the initial component you retrieve from the registry to
00116  * access the VOS A3DL plugin.  Here's how to get it:
00117  * @code
00118  * csInitializer::RequestPlugins (object_reg,
00119  *   ...
00120  *   CS_REQUEST_PLUGIN("crystalspace.network.vos.a3dl", iVosA3DL),
00121  *   ...
00122  *   CS_REQUEST_END)
00123  *
00124  *  ...
00125  *
00126  * csRef<iVosA3DL> vosa3dl = CS_QUERY_REGISTRY (object_reg, iVosA3DL);
00127  * @endcode
00128  */
00129 struct iVosA3DL : public virtual iBase
00130 {
00131   /**
00132    * Get a VOS sector given a VOS URL (such as
00133    * "vip://interreality.org/world") for a sector object.  Doesn't
00134    * load it (call iVosSector::Load() to do that).
00135    * \param url the VOS url to the sector object
00136    * \return the iVosSector wrapper
00137    * @bug no way (yet) to specify specific failure in accessing sector
00138    * (just returns an empty csRef)
00139    */
00140   virtual csRef<iVosSector> GetSector(const char* url) = 0;
00141 
00142   /**
00143    * Takes a URL path for an A3DL::Object3D Vobject and returns
00144    * the iVosObject3D interface (suitable for fetching the mesh wrapper).
00145    * As of this writing, it does not load the object into the engine,
00146    * it must be loaded by loading the sector it is in.
00147    * \param url the url path to the object to fetch
00148    * \return the iVosObject3D wrapper
00149    */
00150   virtual csRef<iVosObject3D> FindVosObject3D(const char* url) = 0;
00151 };
00152 
00153 
00154 SCF_VERSION (iVosApi, 0, 1, 1);
00155 
00156 /// \todo Document me!
00157 struct iVosApi : public virtual iBase
00158 {
00159   virtual VUtil::vRef<VOS::Vobject> GetVobject() = 0;
00160 };
00161 
00162 
00163 #endif