コード例 #1
0
        // ==========================================================================
        public override bool AfterAllModulesLoaded()
        {
            // allow others to get our statistics
            m_restHandler = new RestHandler("/stats/" + m_moduleName + "/detailStats", m_stats);

            #region OGRE STATS
            // Setup the shared piece of memory that Ogre can place statistics in
            m_ogreStatsPinned = new int[Ogr.StatSize];
            for (int ii = 0; ii < Ogr.StatSize; ii++) m_ogreStatsPinned[ii] = 0;
            if (ModuleParams.ParamBool("Renderer.Ogre.CollectOgreStats")) {
            m_ogreStatsHandle = GCHandle.Alloc(m_ogreStatsPinned, GCHandleType.Pinned);
            Ogr.SetStatsBlock(m_ogreStatsHandle.AddrOfPinnedObject());
            // m_ogreStatsPinned = (int[])Marshal.AllocHGlobal(Ogr.StatSize * 4);
            // Ogr.SetStatsBlock(m_ogreStatsPinned);
            }

            // Create a ParameterSet that can be read externally via REST/JSON
            m_ogreStats = new ParameterSet();
            // add an initial parameter that calculates frames per sec
            m_ogreStats.Add("FramesPerSecond",
            delegate(string xx) {
                // Ogre passed the number *1000 so  there can be some decimal points
                float fps = (float)m_ogreStatsPinned[Ogr.StatFramesPerSec] / 1000f;
                return new OMVSD.OSDString(fps.ToString());
            }, "Frames per second"
            );
            m_ogreStats.Add("LastFrameMS", delegate(string xx) {
                return new OMVSD.OSDString(m_ogreStatsPinned[Ogr.StatLastFrameMs].ToString()); },
                "Milliseconds used rendering last frame");
            m_ogreStats.Add("TotalFrames", delegate(string xx) {
                return new OMVSD.OSDString(m_ogreStatsPinned[Ogr.StatTotalFrames].ToString()); },
                "Number of frames rendered");
            m_ogreStats.Add("VisibleToVisible", delegate(string xx) {
                return new OMVSD.OSDString(m_ogreStatsPinned[Ogr.StatVisibleToVisible].ToString()); },
                "Meshes at were visible that are still visible in last frame");
            m_ogreStats.Add("InvisibleToVisible", delegate(string xx) {
                return new OMVSD.OSDString(m_ogreStatsPinned[Ogr.StatInvisibleToVisible].ToString()); },
                "Meshes that were invisible that are now visible in last frame");
            m_ogreStats.Add("VisibleToInvisible", delegate(string xx) {
                return new OMVSD.OSDString(m_ogreStatsPinned[Ogr.StatVisibleToInvisible].ToString()); },
                "Meshes that were visible that are now invisible in last frame");
            m_ogreStats.Add("InvisibleToInvisible", delegate(string xx) {
                return new OMVSD.OSDString(m_ogreStatsPinned[Ogr.StatInvisibleToInvisible].ToString()); },
                "Meshes that were invisible that are still invisible in last frame");
            m_ogreStats.Add("CullMeshesLoaded", delegate(string xx) {
                return new OMVSD.OSDString(m_ogreStatsPinned[Ogr.StatCullMeshesLoaded].ToString()); },
                "Total meshes loaded due to unculling");
            m_ogreStats.Add("CullTexturesLoaded", delegate(string xx) {
                return new OMVSD.OSDString(m_ogreStatsPinned[Ogr.StatCullTexturesLoaded].ToString()); },
                "Total textures loaded due to unculling");
            m_ogreStats.Add("CullMeshesUnloaded", delegate(string xx) {
                return new OMVSD.OSDString(m_ogreStatsPinned[Ogr.StatCullMeshesUnloaded].ToString()); },
                "Total meshes unloaded due to culling");
            m_ogreStats.Add("CullTexturesUnloaded", delegate(string xx) {
                return new OMVSD.OSDString(m_ogreStatsPinned[Ogr.StatCullTexturesUnloaded].ToString()); },
                "Total textures unloaded due to culling");
            m_ogreStats.Add("CullMeshesQueuedToLoad", delegate(string xx) {
                return new OMVSD.OSDString(m_ogreStatsPinned[Ogr.StatCullMeshesQueuedToLoad].ToString()); },
                "Meshes currently queued to load due to unculling");
            // between frame work
            m_ogreStats.Add("BetweenFrameworkItems", delegate(string xx) {
                return new OMVSD.OSDString(m_ogreStatsPinned[Ogr.StatBetweenFrameWorkItems].ToString()); },
                "Number of between frame work items waiting");
            m_ogreStats.Add("BetweenFrameworkDiscardedDups", delegate(string xx) {
                return new OMVSD.OSDString(m_ogreStatsPinned[Ogr.StatBetweenFrameDiscardedDups].ToString()); },
                "Between frame work requests which duplicated existing requests");
            m_ogreStats.Add("TotalBetweenFrameRefreshResource", delegate(string xx) {
                return new OMVSD.OSDString(m_ogreStatsPinned[Ogr.StatBetweenFrameRefreshResource].ToString()); },
                "Number of 'refresh resource' work items queued");
            m_ogreStats.Add("TotalBetweenFrameRemoveSceneNode", delegate(string xx) {
                return new OMVSD.OSDString(m_ogreStatsPinned[Ogr.StatBetweenFrameRemoveSceneNode].ToString()); },
                "Number of 'remove scene node' work items queued");
            m_ogreStats.Add("TotalBetweenFrameCreateMaterialResource", delegate(string xx) {
                return new OMVSD.OSDString(m_ogreStatsPinned[Ogr.StatBetweenFrameCreateMaterialResource].ToString()); },
                "Number of 'create material resource' work items queued");
            m_ogreStats.Add("TotalBetweenFrameCreateMeshResource", delegate(string xx) {
                return new OMVSD.OSDString(m_ogreStatsPinned[Ogr.StatBetweenFrameCreateMeshResource].ToString()); },
                "Number of 'create mesh resource' work items queued");
            m_ogreStats.Add("TotalBetweenFrameCreateMeshScenenode", delegate(string xx) {
                return new OMVSD.OSDString(m_ogreStatsPinned[Ogr.StatBetweenFrameCreateMeshSceneNode].ToString()); },
                "Number of 'create mesh scene node' work items queued");
            m_ogreStats.Add("TotalBetweenFrameAddLoadedMesh", delegate(string xx) {
                return new OMVSD.OSDString(m_ogreStatsPinned[Ogr.StatBetweenFrameAddLoadedMesh].ToString()); },
                "Number of 'add loaded mesh' work items queued");
            m_ogreStats.Add("TotalBetweenframeupdatescenenode", delegate(string xx) {
                return new OMVSD.OSDString(m_ogreStatsPinned[Ogr.StatBetweenFrameUpdateSceneNode].ToString()); },
                "Number of 'update scene node' work items queued");
            m_ogreStats.Add("TotalBetweenFrameUnknownProcess", delegate(string xx) {
                return new OMVSD.OSDString(m_ogreStatsPinned[Ogr.StatBetweenFrameUnknownProcess].ToString()); },
                "Number of work items with unknow process codes");
            m_ogreStats.Add("TotalBetweenFrameTotalProcessed", delegate(string xx) {
                return new OMVSD.OSDString(m_ogreStatsPinned[Ogr.StatBetweenFrameTotalProcessed].ToString()); },
                "Total number of work items actually processed");
            // material processing queues
            m_ogreStats.Add("MaterialUpdatesRemaining", delegate(string xx) {
                return new OMVSD.OSDString(m_ogreStatsPinned[Ogr.StatMaterialUpdatesRemaining].ToString()); },
                "Number of material updates waiting");
            // mesh processing queues
            m_ogreStats.Add("MeshTrackerLoadQueued", delegate(string xx) {
                return new OMVSD.OSDString(m_ogreStatsPinned[Ogr.StatMeshTrackerLoadQueued].ToString()); },
                "Number of mesh loads queued");
            m_ogreStats.Add("MeshTrackerUnloadQueued", delegate(string xx) {
                return new OMVSD.OSDString(m_ogreStatsPinned[Ogr.StatMeshTrackerUnloadQueued].ToString()); },
                "Number of mesh unloads queued");
            m_ogreStats.Add("MeshTrackerSerializedQueued", delegate(string xx) {
                return new OMVSD.OSDString(m_ogreStatsPinned[Ogr.StatMeshTrackerSerializedQueued].ToString()); },
                "Number of mesh serializations queued");
            m_ogreStats.Add("MeshTrackerTotalQueued", delegate(string xx) {
                return new OMVSD.OSDString(m_ogreStatsPinned[Ogr.StatMeshTrackerTotalQueued].ToString()); },
                "Total mesh tracker requests queued");
            m_ogreStats.Add("LockParity", delegate(string xx) {
                return new OMVSD.OSDString(m_ogreStatsPinned[Ogr.StatLockParity].ToString()); },
                "Parity of LG locks");
            m_ogreStats.Add("RoutineInOut", delegate(string xx) {
                return new OMVSD.OSDString(m_ogreStatsPinned[Ogr.StatInOut].ToString()); },
                "Entry and exit of routines");

            // make the values accessable from outside
            m_ogreStatsHandler = new RestHandler("/stats/" + m_moduleName + "/ogreStats", m_ogreStats);
            #endregion OGRE STATS

            // Load the input system we're supposed to be using
            // The input system is a module tha we get given the name of. Go find it and link it in.
            String uiModule = ModuleParams.ParamString(m_moduleName + ".Ogre.InputSystem.Name");
            if (uiModule != null && uiModule.Length > 0) {
            try {
                m_log.Log(LogLevel.DRENDER, "Loading UI processor '{0}'", uiModule);
                m_userInterface = (IUserInterfaceProvider)ModuleManager.Instance.Module(uiModule);
                if (m_userInterface == null) {
                    m_log.Log(LogLevel.DBADERROR, "FATAL: Could not find user interface class {0}", uiModule);
                    return false;
                }
            }
            catch (Exception e) {
                m_log.Log(LogLevel.DBADERROR, "FATAL: Could not load user interface class {0}: {1}", uiModule, e.ToString());
                return false;
            }
            }
            else {
            m_log.Log(LogLevel.DBADERROR, "Using null user interfare");
            m_userInterface = new UserInterfaceNull();
            }

            // if we are doing detail logging, enable logging by  the LookingGlassOgre code
            if (m_log.WouldLog(LogLevel.DOGREDETAIL)) {
            m_log.Log(LogLevel.DRENDER, "Logging detail high enough to enable unmanaged code log messages");
            debugLogCallbackHandle = new Ogr.DebugLogCallback(OgrLogger);
            Ogr.SetDebugLogCallback(debugLogCallbackHandle);
            }
            // push the callback pointers into the LookingGlassOgre code
            fetchParameterCallbackHandle = new Ogr.FetchParameterCallback(GetAParameter);
            Ogr.SetFetchParameterCallback(fetchParameterCallbackHandle);
            checkKeepRunningCallbackHandle = new Ogr.CheckKeepRunningCallback(CheckKeepRunning);
            Ogr.SetCheckKeepRunningCallback(checkKeepRunningCallbackHandle);

            // link the input devices to and turn on low level IO reception
            if (m_userInterface.NeedsRendererLinkage()) {
            userIOCallbackHandle = new Ogr.UserIOCallback(ReceiveUserIOConv);
            Ogr.SetUserIOCallback(userIOCallbackHandle);
            }

            // handles so unmanaged code can call back to managed code
            requestResourceCallbackHandle = new Ogr.RequestResourceCallback(RequestResource);
            Ogr.SetRequestResourceCallback(requestResourceCallbackHandle);
            betweenFramesCallbackHandle = new Ogr.BetweenFramesCallback(ProcessBetweenFrames);
            Ogr.SetBetweenFramesCallback(betweenFramesCallbackHandle);

            m_sceneMagnification = float.Parse(ModuleParams.ParamString(m_moduleName + ".Ogre.LL.SceneMagnification"));

            m_shouldForceMeshRebuild = ModuleParams.ParamBool(m_moduleName + ".Ogre.ForceMeshRebuild");
            m_shouldRenderOnMainThread = ModuleParams.ParamBool(m_moduleName + ".ShouldRenderOnMainThread");
            m_shouldPrebuildMesh = ModuleParams.ParamBool(ModuleName + ".Ogre.PrebuildMesh");

            // pick up a bunch of parameterized values
            m_betweenFrameTotalCost = ModuleParams.ParamInt(m_moduleName + ".Ogre.BetweenFrame.Costs.Total");

            // start up the Ogre renderer
            try {
            Ogr.InitializeOgre();
            }
            catch (Exception e) {
            m_log.Log(LogLevel.DBADERROR, "EXCEPTION INITIALIZING OGRE: {0}", e.ToString());
            return false;
            }
            m_sceneMgr = new OgreSceneMgr(Ogr.GetSceneMgr());

            // if we get here, rendering is set up and running
            return true;
        }
コード例 #2
0
        /*
        public virtual void Network_EventQueueRunning(Object sender, OMV.EventQueueRunningEventArgs args) {
        this.m_statNetQueueRunning++;
        m_log.Log(LogLevel.DCOMM, "Event queue running on {0}", args.Simulator.Name);
        if (args.Simulator == m_client.Network.CurrentSim) {
            m_SwitchingSims = false;
        }
        // Now seems like a good time to start requesting parcel information
        m_client.Parcels.RequestAllSimParcels(m_client.Network.CurrentSim, false, 100);
        }
        */
        public bool AfterAllModulesLoaded()
        {
            m_shouldHoldChildren = ModuleParams.ParamBool(ModuleName + ".Settings.ShouldHoldChildren");

            // make my connections for the communication events
            OMV.GridClient gc = m_client;

            gc.Objects.ObjectPropertiesUpdated += Objects_ObjectPropertiesUpdated;
            gc.Objects.ObjectUpdate += Objects_ObjectUpdate;
            gc.Objects.ObjectDataBlockUpdate += Objects_ObjectDataBlockUpdate;
            gc.Objects.ObjectProperties += Objects_ObjectProperties;
            gc.Objects.TerseObjectUpdate += Objects_TerseObjectUpdate;
            gc.Objects.AvatarUpdate += Objects_AvatarUpdate;
            gc.Objects.KillObject += Objects_KillObject;
            gc.Avatars.AvatarAppearance += Avatars_AvatarAppearance;
            gc.Settings.STORE_LAND_PATCHES = true;
            gc.Terrain.LandPatchReceived += Terrain_LandPatchReceived;

            #region COMM REST STATS
            m_commStatistics.Add("WaitingTilOnline",
            delegate(string xx) { return new OMVSD.OSDString(m_waitTilOnline.Count.ToString()); },
            "Number of event waiting until sim is online");
            m_commStatistics.Add("Network_Disconnected",
            delegate(string xx) { return new OMVSD.OSDString(m_statNetDisconnected.ToString()); },
            "Number of 'network disconnected' messages");
            // m_commStatistics.Add("Network_EventQueueRunning",
            //     delegate(string xx) { return new OMVSD.OSDString(m_statNetQueueRunning.ToString()); },
            //     "Number of 'event queue running' messages");
            m_commStatistics.Add("Network_LoginProgress",
            delegate(string xx) { return new OMVSD.OSDString(m_statNetLoginProgress.ToString()); },
            "Number of 'login progress' messages");
            m_commStatistics.Add("Network_SimChanged",
            delegate(string xx) { return new OMVSD.OSDString(m_statNetSimChanged.ToString()); },
            "Number of 'sim changed' messages");
            m_commStatistics.Add("Network_SimConnected",
            delegate(string xx) { return new OMVSD.OSDString(m_statNetSimConnected.ToString()); },
            "Number of 'sim connected' messages");
            m_commStatistics.Add("Network_EventQueueRunning",
            delegate(string xx) { return new OMVSD.OSDString(m_statNetEventQueueRunning.ToString()); },
            "Number of 'event queue running' messages");
            m_commStatistics.Add("Objects_AttachmentUpdate",
            delegate(string xx) { return new OMVSD.OSDString(m_statObjAttachmentUpdate.ToString()); },
            "Number of 'attachment update' messages");
            m_commStatistics.Add("Objects_AvatarUpdate",
            delegate(string xx) { return new OMVSD.OSDString(m_statObjAvatarUpdate.ToString()); },
            "Number of 'avatar update' messages");
            m_commStatistics.Add("Objects_KillObject",
            delegate(string xx) { return new OMVSD.OSDString(m_statObjKillObject.ToString()); },
            "Number of 'kill object' messages");
            m_commStatistics.Add("Objects_ObjectProperties",
            delegate(string xx) { return new OMVSD.OSDString(m_statObjObjectProperties.ToString()); },
            "Number of 'object properties' messages");
            m_commStatistics.Add("Objects_ObjectPropertiesUpdate",
            delegate(string xx) { return new OMVSD.OSDString(m_statObjObjectPropertiesUpdate.ToString()); },
            "Number of 'object properties update' messages");
            m_commStatistics.Add("Objects_ObjectUpdate",
            delegate(string xx) { return new OMVSD.OSDString(m_statObjObjectUpdate.ToString()); },
            "Number of 'object update' messages");
            m_commStatistics.Add("Objects_TerseObjectUpdate",
            delegate(string xx) { return new OMVSD.OSDString(m_statObjTerseUpdate.ToString()); },
            "Number of 'terse object update' messages");
            m_commStatistics.Add("RequestLocalID",
            delegate(string xx) { return new OMVSD.OSDString(m_statRequestLocalID.ToString()); },
            "Number of RequestLocalIDs made");

            m_commStatsHandler = new RestHandler("/stats/" + m_moduleName + "/stats", m_commStatistics);
            #endregion COMM REST STATS

            return true;
        }
コード例 #3
0
 // IModule.PrepareForUnload()
 public virtual bool PrepareForUnload()
 {
     m_log.Log(LogLevel.DCOMM, "communication unload. We'll never login again");
     if (m_commStatsHandler != null) {
     m_commStatsHandler.Dispose();   // get rid of the handlers we created
     m_commStatsHandler = null;
     }
     m_loaded = false; ;
     return true;
 }
コード例 #4
0
 /// <summary>
 /// Posting to this communication instance. The URI comes in as "/api/MYNAME/ACTION" where
 /// ACTION is "login", "logout".
 /// </summary>
 /// <param name="uri"></param>
 /// <param name="body"></param>
 /// <returns></returns>
 public OMVSD.OSD ProcessPost(RestHandler handler, Uri uri, string after, OMVSD.OSD body)
 {
     OMVSD.OSDMap ret = new OMVSD.OSDMap();
     if (m_comm == null) {
     m_log.Log(LogLevel.DBADERROR, "POST WITHOUT COMM CONNECTION!! URL=" + uri.ToString());
     return new OMVSD.OSD();
     }
     m_log.Log(LogLevel.DCOMMDETAIL, "Post action: {0}", uri.ToString());
     switch (after) {
     case "/login":
         ret = PostActionLogin(body);
         break;
     case "/teleport":
         ret = PostActionTeleport(body);
         break;
     case "/logout":
         ret = PostActionLogout(body);
         break;
     case "/exit":
         ret = PostActionExit(body);
         break;
     default:
         m_log.Log(LogLevel.DBADERROR, "UNKNOWN ACTION: " + uri.ToString());
         ret.Add(RestHandler.RESTREQUESTERRORCODE, new OMVSD.OSDInteger(1));
         ret.Add(RestHandler.RESTREQUESTERRORMSG, new OMVSD.OSDString("Unknown action"));
         break;
     }
     return ret;
 }
コード例 #5
0
        public override void Start()
        {
            string commName = ModuleParams.ParamString(ModuleName + ".Comm.Name");
            try {
            m_comm = (CommLLLP)ModuleManager.Instance.Module(commName);
            }
            catch (Exception e) {
            m_log.Log(LogLevel.DBADERROR, "CommLLLPRest COULD NOT CONNECT TO COMM MODULE NAMED " + commName);
            m_log.Log(LogLevel.DBADERROR, "CommLLLPRest error = " + e.ToString());
            }
            try {
            m_apiName = ModuleParams.ParamString(ModuleName + ".APIName");

            ParameterSet connParams = m_comm.ConnectionParams;
            m_paramGetHandler = new RestHandler("/" + m_apiName + "/status", ref connParams, false);
            m_actionHandler = new RestHandler("/" + m_apiName + "/connect", null, ProcessPost);
            }
            catch (Exception e) {
            m_log.Log(LogLevel.DBADERROR, "CommLLLPRest COULD NOT REGISTER REST OPERATION: " + e.ToString());
            }
        }
コード例 #6
0
 public OMVSD.OSD ProcessGetParam(RestHandler handler, Uri uri, string afterString)
 {
     OMVSD.OSD ret = new OMVSD.OSDMap();
     OMVSD.OSDMap paramValues;
     if (handler.m_displayable == null) {
     paramValues = handler.m_parameterSet.GetDisplayable();
     }
     else {
     paramValues = handler.m_displayable.GetDisplayable();
     }
     try {
     if (afterString.Length > 0) {
         // look to see if asking for one particular value
         OMVSD.OSD oneValue;
         if (paramValues.TryGetValue(afterString, out oneValue)) {
             ret = oneValue;
         }
         else {
             // asked for a specific value but we don't have one of those. return empty
         }
     }
     else {
         // didn't specify a name. Return the whole parameter set
         ret = paramValues;
     }
     }
     catch (Exception e) {
     m_log.Log(LogLevel.DREST, "Failed fetching GetParam value: {0}", e);
     }
     return ret;
 }
コード例 #7
0
 public OMVSD.OSD ProcessPostParam(RestHandler handler, Uri uri, string afterString, OMVSD.OSD rawbody)
 {
     OMVSD.OSD ret = new OMVSD.OSDMap();
     try {
     OMVSD.OSDMap body = (OMVSD.OSDMap)rawbody;
     foreach (string akey in body.Keys) {
         if (handler.m_parameterSet.HasParameter(akey)) {
             handler.m_parameterSet.Update(akey, body[akey]);
         }
     }
     ret = handler.m_parameterSet.GetDisplayable();
     }
     catch (Exception e) {
     m_log.Log(LogLevel.DREST, "Failed setting param in POST: {0}", e);
     }
     return ret;
 }
コード例 #8
0
 private OMVSD.OSD GetHandler(RestHandler handler, Uri uri, String after)
 {
     OMVSD.OSDMap ret = new OMVSD.OSDMap();
     string lastDate = "xx";
     lock (m_chats) {
     while (m_chats.Count > 0) {
         ChatEntry ce = m_chats.Dequeue();
         string dateString = ce.time.ToString("yyyyMMddhhmmssfff");
         OMVSD.OSDMap chat = new OMVSD.OSDMap();
         chat.Add("Time", new OMVSD.OSDString(dateString));
         chat.Add("From", new OMVSD.OSDString(ce.fromName));
         chat.Add("Message", new OMVSD.OSDString(ce.message));
         chat.Add("Type", new OMVSD.OSDString(ce.chatTypeString));
         chat.Add("EntryType", new OMVSD.OSDString(ChatEntryTypeString[(int)ce.chatEntryType]));
         chat.Add("Position", new OMVSD.OSDString(ce.position.ToString()));
         if (ce.ownerID != null) {
             chat.Add("OwnerID", new OMVSD.OSDString(ce.ownerID.ToString()));
         }
         while (ret.ContainsKey(dateString)) {
             dateString += "1";
         }
         ret.Add(dateString, chat);
         lastDate = dateString;
     }
     }
     return ret;
 }
コード例 #9
0
        private OMVSD.OSD PostHandler(RestHandler handler, Uri uri, String after, OMVSD.OSD body)
        {
            try {
            OMVSD.OSDMap mapBody = (OMVSD.OSDMap)body;
            m_log.Log(LogLevel.DCOMMDETAIL, "PostHandler: received chat '{0}'", mapBody["Message"]);
            // collect parameters and send it to the simulator
            string msg = Uri.UnescapeDataString(mapBody["Message"].AsString().Replace("+", " "));
            OMVSD.OSD channelString = new OMVSD.OSDString("0");
            mapBody.TryGetValue("Channel", out channelString);
            int channel = Int32.Parse(channelString.AsString());
            OMVSD.OSD typeString = new OMVSD.OSDString("Normal");
            mapBody.TryGetValue("Type", out typeString);
            OMV.ChatType chatType = OpenMetaverse.ChatType.Normal;
            if (typeString.AsString().Equals("Whisper")) chatType = OMV.ChatType.Whisper;
            if (typeString.AsString().Equals("Shout")) chatType = OMV.ChatType.Shout;
            m_comm.GridClient.Self.Chat(msg, channel, chatType);

            // echo my own message back for the log and chat window
            /* NOTE: Don't have to do this. The simulator echos it back
            OMV.ChatEventArgs cea = new OpenMetaverse.ChatEventArgs(m_comm.GridClient.Network.CurrentSim,
                            msg,
                            OpenMetaverse.ChatAudibleLevel.Fully,
                            chatType,
                            OpenMetaverse.ChatSourceType.Agent,
                            m_comm.GridClient.Self.Name,
                            OMV.UUID.Zero,
                            OMV.UUID.Zero,
                            m_comm.GridClient.Self.RelativePosition);
            this.Self_ChatFromSimulator(this, cea);
             */
            }
            catch (Exception e) {
            m_log.Log(LogLevel.DCOMM, "ERROR PARSING CHAT MESSAGE: {0}", e);
            }
            // the return value does not matter
            return new OMVSD.OSDMap();
        }
コード例 #10
0
        // IModule.AfterAllModulesLoaded
        public virtual bool AfterAllModulesLoaded()
        {
            LogManager.Log.Log(LogLevel.DINIT, ModuleName + ".AfterAllModulesLoaded()");

            try {
            // Find the rest manager and setup to get web requests
            m_restHandler = new RestHandler("/chat", GetHandler, PostHandler);

            // Find the world and connect to same to hear about all the avatars
            String commName = ModuleParams.ParamString(m_moduleName + ".Comm.Name");
            m_comm = (CommLLLP)ModuleManager.Instance.Module(commName);
            }
            catch (Exception e) {
            m_log.Log(LogLevel.DBADERROR, "EXCEPTION CONNECTING TO SERVICES: {0}", e);
            return false;
            }

            m_comm.GridClient.Self.ChatFromSimulator += new EventHandler<OpenMetaverse.ChatEventArgs>(Self_ChatFromSimulator);

            return true;
        }
コード例 #11
0
        // IModule.AfterAllModulesLoaded
        public virtual bool AfterAllModulesLoaded()
        {
            LogManager.Log.Log(LogLevel.DINIT, "AvatarTracker.AfterAllModulesLoaded()");
            m_restHandler = new RestHandler("/avatars", GetHandler, PostHandler);

            m_world = World.Instance;   // there is only one world
            m_world.OnAgentNew += new WorldAgentNewCallback(World_OnAgentNew);
            m_world.OnAgentRemoved += new WorldAgentRemovedCallback(World_OnAgentRemoved);
            m_world.OnWorldEntityNew += new WorldEntityNewCallback(World_OnWorldEntityNew);
            m_world.OnWorldEntityUpdate += new WorldEntityUpdateCallback(World_OnWorldEntityUpdate);
            m_world.OnWorldEntityRemoved += new WorldEntityRemovedCallback(World_OnWorldEntityRemoved);
            return true;
        }
コード例 #12
0
 private OMVSD.OSD PostHandler(RestHandler handler, Uri uri, String after, OMVSD.OSD body)
 {
     return new OMVSD.OSDMap();
 }
コード例 #13
0
 private OMVSD.OSD GetHandler(RestHandler handler, Uri uri, String after)
 {
     OMVSD.OSDMap ret = new OMVSD.OSDMap();
     lock (m_avatars) {
     foreach (KeyValuePair<string, IEntityAvatar> kvp in m_avatars) {
         OMVSD.OSDMap oneAV = new OMVSD.OSDMap();
         IEntityAvatar iav = kvp.Value;
         try {
             oneAV.Add("Name", new OMVSD.OSDString(iav.DisplayName));
             oneAV.Add("Region", new OMVSD.OSDString(iav.RegionContext.Name.Name));
             oneAV.Add("X", new OMVSD.OSDString(iav.RegionPosition.X.ToString("###0.###")));
             oneAV.Add("Y", new OMVSD.OSDString(iav.RegionPosition.Y.ToString("###0.###")));
             oneAV.Add("Z", new OMVSD.OSDString(iav.RegionPosition.Z.ToString("###0.###")));
             float dist = 0f;
             if (m_agentAV != null) {
                 dist = OMV.Vector3.Distance(m_agentAV.RegionPosition, iav.RegionPosition);
             }
             oneAV.Add("Distance", new OMVSD.OSDString(dist.ToString("###0.###")));
             oneAV.Add("Flags", new OMVSD.OSDString(iav.ActivityFlags));
             if (iav is LLEntityAvatar) {
                 OMV.Avatar av = ((LLEntityAvatar)iav).Avatar;
                 if (av != null) {
                     OMVSD.OSDMap avTextures = new OMVSD.OSDMap();
                     OMV.Primitive.TextureEntry texEnt = av.Textures;
                     if (texEnt != null) {
                         OMV.Primitive.TextureEntryFace[] texFaces = texEnt.FaceTextures;
                         if (texFaces != null) {
                             if (texFaces[(int)OMV.AvatarTextureIndex.HeadBaked] != null)
                                 avTextures.Add("head", new OMVSD.OSDString(texFaces[(int)OMV.AvatarTextureIndex.HeadBaked].TextureID.ToString()));
                             if (texFaces[(int)OMV.AvatarTextureIndex.UpperBaked] != null)
                                 avTextures.Add("upper", new OMVSD.OSDString(texFaces[(int)OMV.AvatarTextureIndex.UpperBaked].TextureID.ToString()));
                             if (texFaces[(int)OMV.AvatarTextureIndex.LowerBaked] != null)
                                 avTextures.Add("lower", new OMVSD.OSDString(texFaces[(int)OMV.AvatarTextureIndex.LowerBaked].TextureID.ToString()));
                             if (texFaces[(int)OMV.AvatarTextureIndex.EyesBaked] != null)
                                 avTextures.Add("eyes", new OMVSD.OSDString(texFaces[(int)OMV.AvatarTextureIndex.EyesBaked].TextureID.ToString()));
                             if (texFaces[(int)OMV.AvatarTextureIndex.HairBaked] != null)
                                 avTextures.Add("hair", new OMVSD.OSDString(texFaces[(int)OMV.AvatarTextureIndex.HairBaked].TextureID.ToString()));
                             if (texFaces[(int)OMV.AvatarTextureIndex.SkirtBaked] != null)
                                 avTextures.Add("skirt", new OMVSD.OSDString(texFaces[(int)OMV.AvatarTextureIndex.SkirtBaked].TextureID.ToString()));
                             oneAV.Add("LLtextures", avTextures);
                         }
                     }
                 }
             }
         }
         catch (Exception e) {
             LogManager.Log.Log(LogLevel.DBADERROR, "AvatarTracker.GetHandler: exception building response: {0}", e);
         }
         ret.Add(kvp.Value.Name.Name.Replace('/', '-'), oneAV);
     }
     }
     return ret;
 }
コード例 #14
0
        // IModule.AfterAllModulesLoaded
        public virtual bool AfterAllModulesLoaded()
        {
            LogManager.Log.Log(LogLevel.DINIT, "EntityTracker.AfterAllModulesLoaded()");
            // connect to the world and listen for entity events (there is only one world)
            m_world = World.World.Instance;
            string rendererName = ModuleParams.ParamString(ModuleName + ".Renderer.Name");
            m_renderer = (IRenderProvider)ModuleManager.Instance.Module(rendererName);
            if (ModuleParams.ParamBool(ModuleName + ".Regions.Enable")) {
            m_world.OnWorldRegionNew += new WorldRegionNewCallback(World_OnWorldRegionNew);
            m_world.OnWorldRegionRemoved += new WorldRegionRemovedCallback(World_OnWorldRegionRemoved);
            m_world.OnWorldRegionUpdated += new WorldRegionUpdatedCallback(World_OnWorldRegionUpdated);
            }

            if (ModuleParams.ParamBool(ModuleName + ".Regions.Enable")) {
            m_regionRestHandler = new RestHandler("/Tracker/Regions/", new RegionInformation(this));
            }
            return true;
        }