Example #1
0
 /*!
  * @param world Vixen 3D world
  * Initializes the Vixen 3D environment for the given world.
  * If you do not provide an initial world, one is created for you.
  * This function does not start 3D display - RunVixen does that.
  * The world can only be initialized once - subsequent calls do nothing.
  *
  * @return -> Vixen SharedWorld or null if initialization failed
  */
 static public SharedWorld StartVixen(SharedWorld world)
 {
     _world = world;
     if (_world == null)
     {
         _world = new Viewer3D();
     }
     else if (_world.FileName != null)
     {
         string dir = Path.GetDirectoryName(_world.FileName);
         if ((dir != null) && (dir.Length > 0))
         {
             Directory.SetCurrentDirectory(dir);
             _world.SetMediaDir(dir);
         }
     }
     if ((_world == null) || !_world.OnInit())
     {
         SharedWorld.LogError("cannot initialize Vixen");
         return(null);
     }
     GC.KeepAlive(_world);
     _world.MakeLock();
     if (UsePhysics)
     {
         Physics.Startup();
     }
     return(_world);
 }