public LLRegionContext(RegionContextBase rcontext, AssetContextBase acontext, LLTerrainInfo tinfo, OMV.Simulator sim) : base(rcontext, acontext) { m_terrainInfo = tinfo; // until we have a better protocol, we know the sims are a fixed size m_size = new OMV.Vector3(256f, 256f, 8000f); // believe it or not the world coordinates of a sim are hidden in the handle uint x, y; OMV.Utils.LongToUInts(sim.Handle, out x, out y); m_worldBase = new OMV.Vector3d((double)x, (double)y, 0d); m_simulator = sim; // this should be more general as "GRID/SIM" m_name = new EntityName(sim.Name); // a cache of requested localIDs so we don't ask too often m_recentLocalIDRequests = new Dictionary <uint, int>(); this.RegisterInterface <LLRegionContext>(this); }
public LLRegionContext(RegionContextBase rcontext, AssetContextBase acontext, LLTerrainInfo tinfo, OMV.Simulator sim) : base(rcontext, acontext) { m_terrainInfo = tinfo; // until we have a better protocol, we know the sims are a fixed size m_size = new OMV.Vector3(256f, 256f, 8000f); // believe it or not the world coordinates of a sim are hidden in the handle uint x, y; OMV.Utils.LongToUInts(sim.Handle, out x, out y); m_worldBase = new OMV.Vector3d((double)x, (double)y, 0d); m_simulator = sim; // this should be more general as "GRID/SIM" m_name = new EntityName(sim.Name); // a cache of requested localIDs so we don't ask too often m_recentLocalIDRequests = new Dictionary<uint, int>(); this.RegisterInterface<LLRegionContext>(this); }
// =============================================================== // given a simulator. Find the region info that we store the stuff in // Note that, if we are not connected, we just return null thus showing our unhappiness. public virtual LLRegionContext FindRegion(OMV.Simulator sim) { LLRegionContext ret = null; if (IsConnected) { lock (m_regionList) { if (!m_regionList.TryGetValue(sim.ID, out ret)) { // we are connected but doen't have a regionContext for this simulator. Build one. AssetContextBase assetContext = SelectAssetContextForGrid(sim); LLTerrainInfo llterr = new LLTerrainInfo(null, assetContext); llterr.WaterHeight = sim.WaterHeight; // TODO: copy terrain texture IDs ret = new LLRegionContext(null, assetContext, llterr, sim); // ret.Name = new EntityNameLL(LoggedInGridName + "/Region/" + sim.Name.Trim()); ret.Name = new EntityNameLL(LoggedInGridName + "/" + sim.Name.Trim()); ret.RegionContext = ret; // since we don't know ourself before ret.Comm = m_client; ret.TerrainInfo.RegionContext = ret; m_regionList.Add(sim.ID, ret); m_log.Log(LogLevel.DWORLD, "Creating region context for " + ret.Name); } } } return ret; }