这篇教程C++ to_region_handle函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中to_region_handle函数的典型用法代码示例。如果您正苦于以下问题:C++ to_region_handle函数的具体用法?C++ to_region_handle怎么用?C++ to_region_handle使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了to_region_handle函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: ll_sd_from_vector3void LLPanelPlaceInfo::displayParcelInfo(const LLUUID& region_id, const LLVector3d& pos_global){ LLViewerRegion* region = gAgent.getRegion(); if (!region) return; mPosRegion.setVec((F32)fmod(pos_global.mdV[VX], (F64)REGION_WIDTH_METERS), (F32)fmod(pos_global.mdV[VY], (F64)REGION_WIDTH_METERS), (F32)pos_global.mdV[VZ]); LLSD body; std::string url = region->getCapability("RemoteParcelRequest"); if (!url.empty()) { body["location"] = ll_sd_from_vector3(mPosRegion); if (!region_id.isNull()) { body["region_id"] = region_id; } if (!pos_global.isExactlyZero()) { U64 region_handle = to_region_handle(pos_global); body["region_handle"] = ll_sd_from_U64(region_handle); } LLHTTPClient::post(url, body, new LLRemoteParcelRequestResponder(getObserverHandle())); } else { mDescEditor->setText(getString("server_update_text")); }}
开发者ID:Katharine,项目名称:kittyviewer,代码行数:32,
示例2: ll_sd_from_vector3void LLPanelPlace::displayParcelInfo(const LLVector3& pos_region, const LLUUID& landmark_asset_id, const LLUUID& region_id, const LLVector3d& pos_global){ LLSD body; mPosRegion = pos_region; mPosGlobal = pos_global; mLandmarkAssetID = landmark_asset_id; std::string url = gAgent.getRegion()->getCapability("RemoteParcelRequest"); if (!url.empty()) { body["location"] = ll_sd_from_vector3(pos_region); if (!region_id.isNull()) { body["region_id"] = region_id; } if (!pos_global.isExactlyZero()) { U64 region_handle = to_region_handle(pos_global); body["region_handle"] = ll_sd_from_U64(region_handle); } LLHTTPClient::post(url, body, new LLRemoteParcelRequestResponder(getObserverHandle())); } else { mDescEditor->setText(getString("server_update_text")); } mSnapshotCtrl->setImageAssetID(LLUUID::null);}
开发者ID:HyangZhao,项目名称:NaCl-main,代码行数:30,
示例3: to_region_handle// static public// Insert a region in the region map// returns true if region inserted, false otherwisebool LLWorldMap::insertRegion(U32 x_world, U32 y_world, U32 x_size, U32 y_size, U32 agent_flags, std::string& name, LLUUID& image_id, U32 accesscode, U32 region_flags){ // This region doesn't exist if (accesscode == 255) { // Checks if the track point is in it and invalidates it if it is if (LLWorldMap::getInstance()->isTrackingInRectangle( x_world, y_world, x_world + REGION_WIDTH_UNITS, y_world + REGION_WIDTH_UNITS)) { LLWorldMap::getInstance()->setTrackingInvalid(); } // return failure to insert return false; } else { U64 handle = to_region_handle(x_world, y_world); //LL_INFOS("World Map") << "Map sim : " << name << ", ID : " << image_id.getString() << LL_ENDL; // Insert the region in the region map of the world map // Loading the LLSimInfo object with what we got and insert it in the map LLSimInfo* siminfo = LLWorldMap::getInstance()->simInfoFromHandle(handle); if (siminfo == NULL) { siminfo = LLWorldMap::getInstance()->createSimInfoFromHandle(handle); } siminfo->setName( name ); siminfo->setAccess( accesscode ); siminfo->setRegionFlags( region_flags ); //siminfo->setWaterHeight((F32) water_height); U32 layer = flagsToLayer(agent_flags); if (layer == SIM_LAYER_OVERLAY) siminfo->setLandForSaleImage(image_id); else if(layer < SIM_LAYER_COUNT) siminfo->setMapImageID( image_id, layer ); siminfo->setSize( x_size, y_size ); // Handle the location tracking (for teleport, UI feedback and info display) if (LLWorldMap::getInstance()->isTrackingInRectangle( x_world, y_world, x_world + REGION_WIDTH_UNITS, y_world + REGION_WIDTH_UNITS)) { if (siminfo->isDown()) { // We were tracking this location, but it's no available LLWorldMap::getInstance()->setTrackingInvalid(); } else { // We were tracking this location, and it does exist and is available LLWorldMap::getInstance()->setTrackingValid(); } } // return insert region success return true; }}
开发者ID:aragornarda,项目名称:SingularityViewer,代码行数:57,
示例4: mName// For DEV-17507, do lazy image loading in llworldmapview.cpp instead,// limiting requests to currently visible regions and minimizing the// number of textures being requested simultaneously.//// Uncomment IMMEDIATE_IMAGE_LOAD to restore the old behavior////#define IMMEDIATE_IMAGE_LOADLLItemInfo::LLItemInfo(F32 global_x, F32 global_y, const std::string& name, LLUUID id, S32 extra, S32 extra2): mName(name), mToolTip(""), mPosGlobal(global_x, global_y, 40.0), mID(id), mSelected(FALSE), mExtra(extra), mExtra2(extra2){ mRegionHandle = to_region_handle(mPosGlobal);}
开发者ID:NanaYngvarrdottir,项目名称:Virtual-Reality-Viewer,代码行数:21,
示例5: to_region_handlevoid LLWorldMapMessage::handleSLURL(std::string& name, U32 x_world, U32 y_world, LLUUID image_id){ // Handle the SLURL callback if any url_callback_t callback = LLWorldMapMessage::getInstance()->mSLURLCallback; if(callback != NULL) { U64 handle = to_region_handle(x_world, y_world); // Check if we reached the requested region if ((LLStringUtil::compareInsensitive(LLWorldMapMessage::getInstance()->mSLURLRegionName, name)==0) || (LLWorldMapMessage::getInstance()->mSLURLRegionHandle == handle)) { LLWorldMapMessage::getInstance()->mSLURLCallback = NULL; LLWorldMapMessage::getInstance()->mSLURLRegionName.clear(); LLWorldMapMessage::getInstance()->mSLURLRegionHandle = 0; callback(handle, LLWorldMapMessage::getInstance()->mSLURL, image_id, LLWorldMapMessage::getInstance()->mSLURLTeleport); } }}
开发者ID:OS-Development,项目名称:VW.Singularity,代码行数:19,
示例6: to_region_handlebool LLWorldMap::simNameFromPosGlobal(const LLVector3d& pos_global, std::string & outSimName ){ bool gotSimName = true; U64 handle = to_region_handle(pos_global); sim_info_map_t::iterator it = mSimInfoMap.find(handle); if (it != mSimInfoMap.end()) { LLSimInfo* info = (*it).second; outSimName = info->mName; } else { gotSimName = false; outSimName = "(unknown region)"; } return gotSimName;}
开发者ID:NanaYngvarrdottir,项目名称:Virtual-Reality-Viewer,代码行数:20,
示例7: region_posvoid LLLandmarksPanel::doCreatePick(LLLandmark* landmark){ LLViewerRegion* region = gAgent.getRegion(); if (!region) return; LLGlobalVec pos_global; LLUUID region_id; landmark->getGlobalPos(pos_global); landmark->getRegionID(region_id); LLVector3 region_pos((F32)fmod(pos_global.mdV[VX], (F64)REGION_WIDTH_METERS), (F32)fmod(pos_global.mdV[VY], (F64)REGION_WIDTH_METERS), (F32)pos_global.mdV[VZ]); LLSD body; std::string url = region->getCapability("RemoteParcelRequest"); if (!url.empty()) { body["location"] = ll_sd_from_vector3(region_pos); if (!region_id.isNull()) { body["region_id"] = region_id; } if (!pos_global.isExactlyZero()) { U64 region_handle = to_region_handle(pos_global); body["region_handle"] = ll_sd_from_U64(region_handle); } LLHTTPClient::post(url, body, new LLRemoteParcelRequestResponder(getObserverHandle())); } else { LL_WARNS() << "Can't create pick for landmark for region" << region_id << ". Region: " << region->getName() << " does not support RemoteParcelRequest" << LL_ENDL; }}
开发者ID:Belxjander,项目名称:Kirito,代码行数:36,
示例8: stripProtocol/*static*/void LLURLDispatcherImpl::regionNameCallback(U64 region_handle, const std::string& url, const LLUUID& snapshot_id, bool teleport){ std::string sim_string = stripProtocol(url); std::string region_name; S32 x = 128; S32 y = 128; S32 z = 0; LLURLSimString::parse(sim_string, ®ion_name, &x, &y, &z); LLVector3 local_pos; local_pos.mV[VX] = (F32)x; local_pos.mV[VY] = (F32)y; local_pos.mV[VZ] = (F32)z; // determine whether the point is in this region if ((x >= 0) && (x < REGION_WIDTH_UNITS) && (y >= 0) && (y < REGION_WIDTH_UNITS)) { // if so, we're done regionHandleCallback(region_handle, url, snapshot_id, teleport); } else { // otherwise find the new region from the location // add the position to get the new region LLVector3d global_pos = from_region_handle(region_handle) + LLVector3d(local_pos); U64 new_region_handle = to_region_handle(global_pos); LLWorldMap::getInstance()->sendHandleRegionRequest(new_region_handle, LLURLDispatcherImpl::regionHandleCallback, url, teleport); }}
开发者ID:PhoenixDesmoulins,项目名称:imprudence,代码行数:37,
示例9: flagsToLayer// public staticvoid LLWorldMapMessage::processMapBlockReply(LLMessageSystem* msg, void**){ U32 agent_flags; msg->getU32Fast(_PREHASH_AgentData, _PREHASH_Flags, agent_flags); U32 layer = flagsToLayer(agent_flags); if (layer >= SIM_LAYER_COUNT) { llwarns << "Invalid map image type returned! layer = " << agent_flags << llendl; return; } S32 num_blocks = msg->getNumberOfBlocksFast(_PREHASH_Data); //LL_INFOS("World Map") << "LLWorldMap::processMapBlockReply(), num_blocks = " << num_blocks << LL_ENDL; bool found_null_sim = false; for (S32 block=0; block<num_blocks; ++block) { U16 x_regions; U16 y_regions; U16 x_size = 256; U16 y_size = 256; std::string name; U8 accesscode; U32 region_flags;// U8 water_height;// U8 agents; LLUUID image_id; msg->getU16Fast(_PREHASH_Data, _PREHASH_X, x_regions, block); msg->getU16Fast(_PREHASH_Data, _PREHASH_Y, y_regions, block); msg->getStringFast(_PREHASH_Data, _PREHASH_Name, name, block); msg->getU8Fast(_PREHASH_Data, _PREHASH_Access, accesscode, block); msg->getU32Fast(_PREHASH_Data, _PREHASH_RegionFlags, region_flags, block);// msg->getU8Fast(_PREHASH_Data, _PREHASH_WaterHeight, water_height, block);// msg->getU8Fast(_PREHASH_Data, _PREHASH_Agents, agents, block); msg->getUUIDFast(_PREHASH_Data, _PREHASH_MapImageID, image_id, block); if(msg->getNumberOfBlocksFast(_PREHASH_Size) > 0) { msg->getU16Fast(_PREHASH_Size, _PREHASH_SizeX, x_size, block); msg->getU16Fast(_PREHASH_Size, _PREHASH_SizeY, y_size, block); } if(x_size == 0 || (x_size % 16) != 0|| (y_size % 16) != 0) { x_size = 256; y_size = 256; } U32 x_world = (U32)(x_regions) * REGION_WIDTH_UNITS; U32 y_world = (U32)(y_regions) * REGION_WIDTH_UNITS; // name shouldn't be empty, see EXT-4568 //llassert(!name.empty()); //Opensim bug. BlockRequest can return sims without names, with an accesscode that isn't 255. // skip if this has happened. if(name.empty() && accesscode != 255) continue; // Insert that region in the world map, if failure, flag it as a "null_sim" if (!(LLWorldMap::getInstance()->insertRegion(x_world, y_world, x_size, y_size, agent_flags, name, image_id, (U32)accesscode, region_flags))) { found_null_sim = true; } // If we hit a valid tracking location, do what needs to be done app level wise if (LLWorldMap::getInstance()->isTrackingValidLocation()) { LLVector3d pos_global = LLWorldMap::getInstance()->getTrackedPositionGlobal(); if (LLWorldMap::getInstance()->isTrackingDoubleClick()) { // Teleport if the user double clicked gAgent.teleportViaLocation(pos_global); } // Update the "real" tracker information gFloaterWorldMap->trackLocation(pos_global); } U64 handle = to_region_handle(x_world, y_world); // Handle the SLURL callback if any url_callback_t callback = LLWorldMapMessage::getInstance()->mSLURLCallback; if(callback != NULL) { // Check if we reached the requested region if ((LLStringUtil::compareInsensitive(LLWorldMapMessage::getInstance()->mSLURLRegionName, name)==0) || (LLWorldMapMessage::getInstance()->mSLURLRegionHandle == handle)) { LLWorldMapMessage::getInstance()->mSLURLCallback = NULL; LLWorldMapMessage::getInstance()->mSLURLRegionName.clear(); LLWorldMapMessage::getInstance()->mSLURLRegionHandle = 0; callback(handle, LLWorldMapMessage::getInstance()->mSLURL, image_id, LLWorldMapMessage::getInstance()->mSLURLTeleport); } } if( gAgent.mPendingLure && gAgent.mPendingLure->mRegionHandle == handle) { gAgent.onFoundLureDestination();//.........这里部分代码省略.........
开发者ID:OS-Development,项目名称:VW.Singularity,代码行数:101,
示例10: new_item// static public// Insert an item in the relevant region map// returns true if item inserted, false otherwisebool LLWorldMap::insertItem(U32 x_world, U32 y_world, std::string& name, LLUUID& uuid, U32 type, S32 extra, S32 extra2){ // Create an item record for the received object LLItemInfo new_item((F32)x_world, (F32)y_world, name, uuid); // Compute a region handle based on the objects coordinates LLVector3d pos((F32)x_world, (F32)y_world, 40.0); U64 handle = to_region_handle(pos); // Get the region record for that handle or NULL if we haven't browsed it yet LLSimInfo* siminfo = LLWorldMap::getInstance()->simInfoFromHandle(handle); if (siminfo == NULL) { siminfo = LLWorldMap::getInstance()->createSimInfoFromHandle(handle); } //LL_INFOS("World Map") << "Process item : type = " << type << LL_ENDL; switch (type) { case MAP_ITEM_TELEHUB: // telehubs { /* Merov: we are not using the hub color anymore for display so commenting that out // Telehub color U32 X = x_world / REGION_WIDTH_UNITS; U32 Y = y_world / REGION_WIDTH_UNITS; F32 red = fmod((F32)X * 0.11f, 1.f) * 0.8f; F32 green = fmod((F32)Y * 0.11f, 1.f) * 0.8f; F32 blue = fmod(1.5f * (F32)(X + Y) * 0.11f, 1.f) * 0.8f; F32 add_amt = (X % 2) ? 0.15f : -0.15f; add_amt += (Y % 2) ? -0.15f : 0.15f; LLColor4 color(red + add_amt, green + add_amt, blue + add_amt); new_item.setColor(color); */ // extra2 specifies whether this is an infohub or a telehub. if (extra2) { siminfo->insertInfoHub(new_item); } else { siminfo->insertTeleHub(new_item); } break; } case MAP_ITEM_PG_EVENT: // events case MAP_ITEM_MATURE_EVENT: case MAP_ITEM_ADULT_EVENT: { struct tm* timep; // Convert to Pacific, based on server's opinion of whether // it's daylight savings time there. timep = utc_to_pacific_time(extra, gPacificDaylightTime); S32 display_hour = timep->tm_hour % 12; if (display_hour == 0) display_hour = 12; std::string tooltip = llformat( "%d:%02d %s", display_hour, timep->tm_min, (timep->tm_hour < 12 ? "AM" : "PM") ); new_item.setTooltip(tooltip); // HACK: store Z in extra2 new_item.setElevation((F64)extra2); if (type == MAP_ITEM_PG_EVENT) { siminfo->insertPGEvent(new_item); } else if (type == MAP_ITEM_MATURE_EVENT) { siminfo->insertMatureEvent(new_item); } else if (type == MAP_ITEM_ADULT_EVENT) { siminfo->insertAdultEvent(new_item); } break; } case MAP_ITEM_LAND_FOR_SALE: // land for sale case MAP_ITEM_LAND_FOR_SALE_ADULT: // adult land for sale { F32 cost_per_sqm = 0.0f; if (extra > 0) { cost_per_sqm = (F32)extra2 / (F32)extra; } std::string tooltip = llformat("%d sq.m. L$%d (L$ %.1f/sq.m.)", extra, extra2, cost_per_sqm); new_item.setTooltip(tooltip); if (type == MAP_ITEM_LAND_FOR_SALE) { siminfo->insertLandForSale(new_item); } else if (type == MAP_ITEM_LAND_FOR_SALE_ADULT) { siminfo->insertLandForSaleAdult(new_item); }//.........这里部分代码省略.........
开发者ID:VirtualReality,项目名称:Viewer,代码行数:101,
示例11: to_region_handleLLSimInfo* LLWorldMap::simInfoFromPosGlobal(const LLVector3d& pos_global){ U64 handle = to_region_handle(pos_global); return simInfoFromHandle(handle);}
开发者ID:VirtualReality,项目名称:Viewer,代码行数:5,
示例12: mtLLViewerRegion* LLWorld::addRegion(const U64 ®ion_handle, const LLHost &host){ LLMemType mt(LLMemType::MTYPE_REGIONS); llinfos << "Add region with handle: " << region_handle << " on host " << host << llendl; LLViewerRegion *regionp = getRegionFromHandle(region_handle); if (regionp) { llinfos << "Region exists, removing it " << llendl; LLHost old_host = regionp->getHost(); // region already exists! if (host == old_host && regionp->isAlive()) { // This is a duplicate for the same host and it's alive, don't bother. return regionp; } if (host != old_host) { llwarns << "LLWorld::addRegion exists, but old host " << old_host << " does not match new host " << host << llendl; } if (!regionp->isAlive()) { llwarns << "LLWorld::addRegion exists, but isn't alive" << llendl; } // Kill the old host, and then we can continue on and add the new host. We have to kill even if the host // matches, because all the agent state for the new camera is completely different. removeRegion(old_host); } U32 iindex = 0; U32 jindex = 0; from_region_handle(region_handle, &iindex, &jindex); S32 x = (S32)(iindex/mWidth); S32 y = (S32)(jindex/mWidth); llinfos << "Adding new region (" << x << ":" << y << ")" << llendl; llinfos << "Host: " << host << llendl; LLVector3d origin_global; origin_global = from_region_handle(region_handle); regionp = new LLViewerRegion(region_handle, host, mWidth, WORLD_PATCH_SIZE, getRegionWidthInMeters() ); if (!regionp) { llerrs << "Unable to create new region!" << llendl; } regionp->mCloudLayer.create(regionp); regionp->mCloudLayer.setWidth((F32)mWidth); regionp->mCloudLayer.setWindPointer(®ionp->mWind); mRegionList.push_back(regionp); mActiveRegionList.push_back(regionp); mCulledRegionList.push_back(regionp); // Find all the adjacent regions, and attach them. // Generate handles for all of the adjacent regions, and attach them in the correct way. // connect the edges F32 adj_x = 0.f; F32 adj_y = 0.f; F32 region_x = 0.f; F32 region_y = 0.f; U64 adj_handle = 0; F32 width = getRegionWidthInMeters(); LLViewerRegion *neighborp; from_region_handle(region_handle, ®ion_x, ®ion_y); // Iterate through all directions, and connect neighbors if there. S32 dir; for (dir = 0; dir < 8; dir++) { adj_x = region_x + width * gDirAxes[dir][0]; adj_y = region_y + width * gDirAxes[dir][1]; to_region_handle(adj_x, adj_y, &adj_handle); neighborp = getRegionFromHandle(adj_handle); if (neighborp) { //llinfos << "Connecting " << region_x << ":" << region_y << " -> " << adj_x << ":" << adj_y << llendl; regionp->connectNeighbor(neighborp, dir); } } updateWaterObjects(); return regionp;}
开发者ID:NickyPerian,项目名称:SingularityViewer,代码行数:96,
示例13: getRegionFromHandleLLViewerRegion* LLWorld::addRegion(const U64 ®ion_handle, const LLHost &host){ llinfos << "Add region with handle: " << region_handle << " on host " << host << llendl; LLViewerRegion *regionp = getRegionFromHandle(region_handle); if (regionp) { llinfos << "Region exists, removing it " << llendl; LLHost old_host = regionp->getHost(); // region already exists! if (host == old_host && regionp->isAlive()) { // This is a duplicate for the same host and it's alive, don't bother. return regionp; } if (host != old_host) { llwarns << "LLWorld::addRegion exists, but old host " << old_host << " does not match new host " << host << llendl; } if (!regionp->isAlive()) { llwarns << "LLWorld::addRegion exists, but isn't alive" << llendl; } // Kill the old host, and then we can continue on and add the new host. We have to kill even if the host // matches, because all the agent state for the new camera is completely different. removeRegion(old_host); } U32 iindex = 0; U32 jindex = 0; from_region_handle(region_handle, &iindex, &jindex);// <FS:CR> Aurora Sim //S32 x = (S32)(iindex/mWidth); //S32 y = (S32)(jindex/mWidth); S32 x = (S32)(iindex/256); //MegaRegion S32 y = (S32)(jindex/256); //MegaRegion// </FS:CR> Aurora Sim llinfos << "Adding new region (" << x << ":" << y << ")" << llendl; llinfos << "Host: " << host << llendl; LLVector3d origin_global; origin_global = from_region_handle(region_handle); regionp = new LLViewerRegion(region_handle, host, mWidth, WORLD_PATCH_SIZE, getRegionWidthInMeters() ); if (!regionp) { llerrs << "Unable to create new region!" << llendl; } //Classic clouds#if ENABLE_CLASSIC_CLOUDS regionp->mCloudLayer.create(regionp); regionp->mCloudLayer.setWidth((F32)mWidth); regionp->mCloudLayer.setWindPointer(®ionp->mWind);#endif mRegionList.push_back(regionp); mActiveRegionList.push_back(regionp); mCulledRegionList.push_back(regionp); // Find all the adjacent regions, and attach them. // Generate handles for all of the adjacent regions, and attach them in the correct way. // connect the edges F32 adj_x = 0.f; F32 adj_y = 0.f; F32 region_x = 0.f; F32 region_y = 0.f; U64 adj_handle = 0; F32 width = getRegionWidthInMeters(); LLViewerRegion *neighborp; from_region_handle(region_handle, ®ion_x, ®ion_y); // Iterate through all directions, and connect neighbors if there. S32 dir; for (dir = 0; dir < 8; dir++) { adj_x = region_x + width * gDirAxes[dir][0]; adj_y = region_y + width * gDirAxes[dir][1]; if (mWidth == 256 && mLength == 256) { to_region_handle(adj_x, adj_y, &adj_handle); neighborp = getRegionFromHandle(adj_handle); if (neighborp) { //llinfos << "Connecting " << region_x << ":" << region_y << " -> " << adj_x << ":" << adj_y << llendl; regionp->connectNeighbor(neighborp, dir); } } else // Unconventional region size//.........这里部分代码省略.........
开发者ID:ArxNet,项目名称:SingularityViewer,代码行数:101,
示例14: useWebMapTiles// public staticvoid LLWorldMap::processMapBlockReply(LLMessageSystem* msg, void**){ U32 agent_flags; msg->getU32Fast(_PREHASH_AgentData, _PREHASH_Flags, agent_flags); if ((S32)agent_flags < 0 || agent_flags >= MAP_SIM_IMAGE_TYPES) { llwarns << "Invalid map image type returned! " << agent_flags << llendl; return; } S32 num_blocks = msg->getNumberOfBlocksFast(_PREHASH_Data); bool found_null_sim = false;#ifdef IMMEDIATE_IMAGE_LOAD bool use_web_map_tiles = useWebMapTiles();#endif BOOL adjust = FALSE; for (S32 block=0; block<num_blocks; ++block) { U16 x_regions; U16 y_regions; std::string name; U8 accesscode; U32 region_flags; U8 water_height; U8 agents; LLUUID image_id; msg->getU16Fast(_PREHASH_Data, _PREHASH_X, x_regions, block); msg->getU16Fast(_PREHASH_Data, _PREHASH_Y, y_regions, block); msg->getStringFast(_PREHASH_Data, _PREHASH_Name, name, block); msg->getU8Fast(_PREHASH_Data, _PREHASH_Access, accesscode, block); msg->getU32Fast(_PREHASH_Data, _PREHASH_RegionFlags, region_flags, block); msg->getU8Fast(_PREHASH_Data, _PREHASH_WaterHeight, water_height, block); msg->getU8Fast(_PREHASH_Data, _PREHASH_Agents, agents, block); msg->getUUIDFast(_PREHASH_Data, _PREHASH_MapImageID, image_id, block); U32 x_meters = x_regions * REGION_WIDTH_UNITS; U32 y_meters = y_regions * REGION_WIDTH_UNITS; U64 handle = to_region_handle(x_meters, y_meters); if (accesscode == 255) { // This region doesn't exist if (LLWorldMap::getInstance()->mIsTrackingUnknownLocation && LLWorldMap::getInstance()->mUnknownLocation.mdV[0] >= x_meters && LLWorldMap::getInstance()->mUnknownLocation.mdV[0] < x_meters + 256 && LLWorldMap::getInstance()->mUnknownLocation.mdV[1] >= y_meters && LLWorldMap::getInstance()->mUnknownLocation.mdV[1] < y_meters + 256) { // We were tracking this location, but it doesn't exist LLWorldMap::getInstance()->mInvalidLocation = TRUE; } found_null_sim = true; } else { adjust = LLWorldMap::getInstance()->extendAABB(x_meters, y_meters, x_meters+REGION_WIDTH_UNITS, y_meters+REGION_WIDTH_UNITS) || adjust;// llinfos << "Map sim " << name << " image layer " << agent_flags << " ID " << image_id.getString() << llendl; LLSimInfo* siminfo = new LLSimInfo(); sim_info_map_t::iterator iter = LLWorldMap::getInstance()->mSimInfoMap.find(handle); if (iter != LLWorldMap::getInstance()->mSimInfoMap.end()) { LLSimInfo* oldinfo = iter->second; for (S32 image=0; image<MAP_SIM_IMAGE_TYPES; ++image) { siminfo->mMapImageID[image] = oldinfo->mMapImageID[image]; } delete oldinfo; } LLWorldMap::getInstance()->mSimInfoMap[handle] = siminfo; siminfo->mHandle = handle; siminfo->msizeX = 256; siminfo->msizeY = 256; siminfo->mName.assign( name ); siminfo->mAccess = accesscode; siminfo->mRegionFlags = region_flags; siminfo->mWaterHeight = (F32) water_height; siminfo->mMapImageID[agent_flags] = image_id;#ifdef IMMEDIATE_IMAGE_LOAD if (use_web_map_tiles) { siminfo->mCurrentImage = loadObjectsTile((U32)x_regions, (U32)y_regions); } else { siminfo->mCurrentImage = gImageList.getImage(siminfo->mMapImageID[LLWorldMap::getInstance()->mCurrentMap], MIPMAP_TRUE, FALSE); } gGL.getTexUnit(0)->bind(siminfo->mCurrentImage.get());//.........这里部分代码省略.........
开发者ID:NanaYngvarrdottir,项目名称:Virtual-Reality-Viewer,代码行数:101,
示例15: llceil//.........这里部分代码省略......... while(!nxny_pairs.empty()) { S32 const nx = nxny_pairs.front().first; S32 const ny = nxny_pairs.front().second; LL_DEBUGS("WaterHeight") << "nx,ny = " << nx << "," << ny << LL_ENDL; S32 const index = nx + ny * n + origin; nxny_pairs.pop(); for (S32 dir = 0; dir < 4; ++dir) { S32 const cnx = nx + gDirAxes[dir][0]; S32 const cny = ny + gDirAxes[dir][1]; LL_DEBUGS("WaterHeight") << "dir = " << dir << "; cnx,cny = " << cnx << "," << cny << LL_ENDL; S32 const cindex = cnx + cny * n + origin; bool is_hole = false; bool is_edge = false; LLViewerRegion* new_region_found = NULL; if (cnx < -nsims || cnx > nsims || cny < -nsims || cny > nsims) { LL_DEBUGS("WaterHeight") << " Edge Water!" << LL_ENDL; // Bumped into Edge water object. is_edge = true; } else if (checked[cindex]) { LL_DEBUGS("WaterHeight") << " Already checked before!" << LL_ENDL; // Already checked. is_hole = (checked[cindex] & hole_bit); } else { S32 x = (S32)region_x + cnx * rwidth; S32 y = (S32)region_y + cny * rwidth; U64 region_handle = to_region_handle(x, y); new_region_found = getRegionFromHandle(region_handle); is_hole = !new_region_found; checked[cindex] = is_hole ? hole_bit : region_bit; } if (is_hole) { // This was a region that borders at least one 'hole'. // Count the found coastline. F32 new_water_height = water_heights[index]; LL_DEBUGS("WaterHeight") << " This is void; counting coastline with water height of " << new_water_height << LL_ENDL; S32 new_water_height_cm = llround(new_water_height * 100); int count = (water_height_counts[new_water_height_cm] += 1); // Just use the lowest water height: this is mainly about the horizon water, // and whatever we do, we don't want it to be possible to look under the water // when looking in the distance: it is better to make a step downwards in water // height when going away from the avie than a step upwards. However, since // everyone is used to DEFAULT_WATER_HEIGHT, don't allow a single region // to drag the water level below DEFAULT_WATER_HEIGHT on it's own. if (bordering_hole == 0 || // First time we get here. (new_water_height >= DEFAULT_WATER_HEIGHT && new_water_height < water_height) || (new_water_height < DEFAULT_WATER_HEIGHT && count > max_count) ) { water_height = new_water_height; } if (count > max_count) { max_count = count; } if (!(checked[index] & bordering_hole_bit))
开发者ID:ArxNet,项目名称:SingularityViewer,代码行数:67,
示例16: to_region_handle// public staticvoid LLWorldMapMessage::processMapBlockReply(LLMessageSystem* msg, void**){ U32 agent_flags; msg->getU32Fast(_PREHASH_AgentData, _PREHASH_Flags, agent_flags); // There's only one flag that we ever use here if (agent_flags != LAYER_FLAG) { llwarns << "Invalid map image type returned! layer = " << agent_flags << llendl; return; } S32 num_blocks = msg->getNumberOfBlocksFast(_PREHASH_Data); //LL_INFOS("World Map") << "LLWorldMap::processMapBlockReply(), num_blocks = " << num_blocks << LL_ENDL; bool found_null_sim = false; for (S32 block=0; block<num_blocks; ++block) { U16 x_regions; U16 y_regions; std::string name; U8 accesscode; U32 region_flags;// U8 water_height;// U8 agents; LLUUID image_id; msg->getU16Fast(_PREHASH_Data, _PREHASH_X, x_regions, block); msg->getU16Fast(_PREHASH_Data, _PREHASH_Y, y_regions, block); msg->getStringFast(_PREHASH_Data, _PREHASH_Name, name, block); msg->getU8Fast(_PREHASH_Data, _PREHASH_Access, accesscode, block); msg->getU32Fast(_PREHASH_Data, _PREHASH_RegionFlags, region_flags, block);// msg->getU8Fast(_PREHASH_Data, _PREHASH_WaterHeight, water_height, block);// msg->getU8Fast(_PREHASH_Data, _PREHASH_Agents, agents, block); msg->getUUIDFast(_PREHASH_Data, _PREHASH_MapImageID, image_id, block); U32 x_world = (U32)(x_regions) * REGION_WIDTH_UNITS; U32 y_world = (U32)(y_regions) * REGION_WIDTH_UNITS; // Insert that region in the world map, if failure, flag it as a "null_sim" if (!(LLWorldMap::getInstance()->insertRegion(x_world, y_world, name, image_id, (U32)accesscode, region_flags))) { found_null_sim = true; } // If we hit a valid tracking location, do what needs to be done app level wise if (LLWorldMap::getInstance()->isTrackingValidLocation()) { LLVector3d pos_global = LLWorldMap::getInstance()->getTrackedPositionGlobal(); if (LLWorldMap::getInstance()->isTrackingDoubleClick()) { // Teleport if the user double clicked gAgent.teleportViaLocation(pos_global); } // Update the "real" tracker information gFloaterWorldMap->trackLocation(pos_global); } // Handle the SLURL callback if any if(LLWorldMapMessage::getInstance()->mSLURLCallback != NULL) { U64 handle = to_region_handle(x_world, y_world); // Check if we reached the requested region if ((LLStringUtil::compareInsensitive(LLWorldMapMessage::getInstance()->mSLURLRegionName, name)==0) || (LLWorldMapMessage::getInstance()->mSLURLRegionHandle == handle)) { url_callback_t callback = LLWorldMapMessage::getInstance()->mSLURLCallback; LLWorldMapMessage::getInstance()->mSLURLCallback = NULL; LLWorldMapMessage::getInstance()->mSLURLRegionName.clear(); LLWorldMapMessage::getInstance()->mSLURLRegionHandle = 0; callback(handle, LLWorldMapMessage::getInstance()->mSLURL, image_id, LLWorldMapMessage::getInstance()->mSLURLTeleport); } } } // Tell the UI to update itself gFloaterWorldMap->updateSims(found_null_sim);}
开发者ID:AlexRa,项目名称:Kirstens-clone,代码行数:80,
示例17: childSetValueBOOL LLPanelScriptLimitsRegionMemory::StartRequestChain(){ LLUUID region_id; LLFloaterLand* instance = LLFloaterReg::getTypedInstance<LLFloaterLand>("about_land"); if(!instance) { childSetValue("loading_text", LLSD(std::string(""))); //might have to do parent post build here //if not logic below could use early outs return FALSE; } LLParcel* parcel = instance->getCurrentSelectedParcel(); LLViewerRegion* region = LLViewerParcelMgr::getInstance()->getSelectionRegion(); LLUUID current_region_id = gAgent.getRegion()->getRegionID(); if ((region) && (parcel)) { LLVector3 parcel_center = parcel->getCenterpoint(); region_id = region->getRegionID(); if(region_id != current_region_id) { std::string msg_wrong_region = LLTrans::getString("ScriptLimitsRequestWrongRegion"); childSetValue("loading_text", LLSD(msg_wrong_region)); return FALSE; } LLVector3d pos_global = region->getCenterGlobal(); LLSD body; std::string url = region->getCapability("RemoteParcelRequest"); if (!url.empty()) { body["location"] = ll_sd_from_vector3(parcel_center); if (!region_id.isNull()) { body["region_id"] = region_id; } if (!pos_global.isExactlyZero()) { U64 region_handle = to_region_handle(pos_global); body["region_handle"] = ll_sd_from_U64(region_handle); } LLHTTPClient::post(url, body, new LLRemoteParcelRequestResponder(getObserverHandle())); } else { llwarns << "Can't get parcel info for script information request" << region_id << ". Region: " << region->getName() << " does not support RemoteParcelRequest" << llendl; std::string msg_waiting = LLTrans::getString("ScriptLimitsRequestError"); childSetValue("loading_text", LLSD(msg_waiting)); } } else { std::string msg_waiting = LLTrans::getString("ScriptLimitsRequestNoParcelSelected"); childSetValue("loading_text", LLSD(msg_waiting)); } return LLPanelScriptLimitsInfo::postBuild();}
开发者ID:AlexRa,项目名称:Kirstens-clone,代码行数:66,
示例18: F32//.........这里部分代码省略......... { const LLSD& map_block = *iter; S32 x_regions = map_block["X"]; S32 y_regions = map_block["Y"]; std::string name = map_block["Name"]; S32 access = map_block["Access"]; S32 region_flags = map_block["RegionFlags"]; S32 water_height = map_block["WaterHeight"]; LLUUID image_id = map_block["MapImageID"]; U32 x_meters = x_regions * REGION_WIDTH_UNITS; U32 y_meters = y_regions * REGION_WIDTH_UNITS; if (access == 255) { // This region doesn't exist if (gWorldMap->mIsTrackingUnknownLocation && gWorldMap->mUnknownLocation.mdV[0] >= x_meters && gWorldMap->mUnknownLocation.mdV[0] < x_meters + 256 && gWorldMap->mUnknownLocation.mdV[1] >= y_meters && gWorldMap->mUnknownLocation.mdV[1] < y_meters + 256) { // We were tracking this location, but it doesn't exist gWorldMap->mInvalidLocation = TRUE; } found_null_sim = true; } else { adjust = gWorldMap->extendAABB(x_meters, y_meters, x_meters+REGION_WIDTH_UNITS, y_meters+REGION_WIDTH_UNITS) || adjust; U64 handle = to_region_handle(x_meters, y_meters); // llinfos << "Map sim " << name << " image layer " << agent_flags << " ID " << image_id.getString() << llendl; LLSimInfo* siminfo = new LLSimInfo(); LLWorldMap::sim_info_map_t::iterator iter = gWorldMap->mSimInfoMap.find(handle); if (iter != gWorldMap->mSimInfoMap.end()) { LLSimInfo* oldinfo = iter->second; for (S32 image=0; image<MAP_SIM_IMAGE_TYPES; ++image) { siminfo->mMapImageID[image] = oldinfo->mMapImageID[image]; } delete oldinfo; } gWorldMap->mSimInfoMap[handle] = siminfo; siminfo->mHandle = handle; siminfo->mName.assign( name ); siminfo->mAccess = access; /*Flawfinder: ignore*/ siminfo->mRegionFlags = region_flags; siminfo->mWaterHeight = (F32) water_height; siminfo->mMapImageID[agent_flags] = image_id; siminfo->mCurrentImage = gImageList.getImage(siminfo->mMapImageID[gWorldMap->mCurrentMap], MIPMAP_TRUE, FALSE); siminfo->mCurrentImage->bindTexture(0); siminfo->mCurrentImage->setClamp(TRUE, TRUE); if (siminfo->mMapImageID[2].notNull()) { siminfo->mOverlayImage = gImageList.getImage(siminfo->mMapImageID[2], MIPMAP_TRUE, FALSE); } else { siminfo->mOverlayImage = NULL; } if (gWorldMap->mIsTrackingUnknownLocation && gWorldMap->mUnknownLocation.mdV[0] >= x_meters && gWorldMap->mUnknownLocation.mdV[0] < x_meters + 256 && gWorldMap->mUnknownLocation.mdV[1] >= y_meters && gWorldMap->mUnknownLocation.mdV[1] < y_meters + 256) { if (siminfo->mAccess == SIM_ACCESS_DOWN) { // We were tracking this location, but it doesn't exist gWorldMap->mInvalidLocation = true; } else { // We were tracking this location, and it does exist bool is_tracking_dbl = gWorldMap->mIsTrackingDoubleClick == TRUE; gFloaterWorldMap->trackLocation(gWorldMap->mUnknownLocation); if (is_tracking_dbl) { LLVector3d pos_global = LLTracker::getTrackedPositionGlobal(); gAgent.teleportViaLocation( pos_global ); } } } } } } if(adjust) gFloaterWorldMap->adjustZoomSliderBounds(); gFloaterWorldMap->updateSims(found_null_sim);}
开发者ID:Boy,项目名称:netbook,代码行数:101,
示例19: useWebMapTiles// public staticvoid LLWorldMap::processMapBlockReply(LLMessageSystem* msg, void**){ U32 agent_flags; msg->getU32Fast(_PREHASH_AgentData, _PREHASH_Flags, agent_flags); if ((S32)agent_flags < 0 || agent_flags >= MAP_SIM_IMAGE_TYPES) { llwarns << "Invalid map image type returned! " << agent_flags << llendl; return; } S32 num_blocks = msg->getNumberOfBlocksFast(_PREHASH_Data); bool found_null_sim = false;#ifdef IMMEDIATE_IMAGE_LOAD bool use_web_map_tiles = useWebMapTiles();#endif BOOL adjust = FALSE; for (S32 block=0; block<num_blocks; ++block) { U16 x_regions; U16 y_regions; U16 x_size = 256; U16 y_size = 256; std::string name; U8 accesscode; U32 region_flags; U8 water_height; U8 agents; LLUUID image_id; msg->getU16Fast(_PREHASH_Data, _PREHASH_X, x_regions, block); msg->getU16Fast(_PREHASH_Data, _PREHASH_Y, y_regions, block); msg->getStringFast(_PREHASH_Data, _PREHASH_Name, name, block); msg->getU8Fast(_PREHASH_Data, _PREHASH_Access, accesscode, block); msg->getU32Fast(_PREHASH_Data, _PREHASH_RegionFlags, region_flags, block); msg->getU8Fast(_PREHASH_Data, _PREHASH_WaterHeight, water_height, block); msg->getU8Fast(_PREHASH_Data, _PREHASH_Agents, agents, block); msg->getUUIDFast(_PREHASH_Data, _PREHASH_MapImageID, image_id, block); if(msg->getNumberOfBlocksFast(_PREHASH_Size) > 0) { msg->getU16Fast(_PREHASH_Size, _PREHASH_SizeX, x_size, block); msg->getU16Fast(_PREHASH_Size, _PREHASH_SizeY, y_size, block); } if(x_size == 0 || (x_size % 16) != 0|| (y_size % 16) != 0) { x_size = 256; y_size = 256; } U32 x_meters = x_regions * REGION_WIDTH_UNITS; U32 y_meters = y_regions * REGION_WIDTH_UNITS; U64 handle = to_region_handle(x_meters, y_meters); if (accesscode == 255) { // This region doesn't exist if (LLWorldMap::getInstance()->mIsTrackingUnknownLocation && LLWorldMap::getInstance()->mUnknownLocation.mdV[0] >= x_meters && LLWorldMap::getInstance()->mUnknownLocation.mdV[0] < x_meters + 256 && LLWorldMap::getInstance()->mUnknownLocation.mdV[1] >= y_meters && LLWorldMap::getInstance()->mUnknownLocation.mdV[1] < y_meters + 256) { // We were tracking this location, but it doesn't exist LLWorldMap::getInstance()->mInvalidLocation = TRUE; } found_null_sim = true; } else { adjust = LLWorldMap::getInstance()->extendAABB(x_meters, y_meters, x_meters+REGION_WIDTH_UNITS, y_meters+REGION_WIDTH_UNITS) || adjust; //LL_INFOS("World Map") << "Map sim : " << name << ", ID : " << image_id.getString() << LL_ENDL; // Insert the region in the region map of the world map // Loading the LLSimInfo object with what we got and insert it in the map LLSimInfo* siminfo = LLWorldMap::getInstance()->simInfoFromHandle(handle); if (siminfo == NULL) { siminfo = LLWorldMap::getInstance()->createSimInfoFromHandle(handle); } siminfo->setName( name ); siminfo->setAccess( accesscode ); siminfo->setRegionFlags( region_flags ); siminfo->setWaterHeight((F32) water_height); siminfo->setMapImageID( image_id, agent_flags ); siminfo->setSize( x_size, y_size );#ifdef IMMEDIATE_IMAGE_LOAD if (use_web_map_tiles) { siminfo->mCurrentImage = loadObjectsTile((U32)x_regions, (U32)y_regions); } else {//.........这里部分代码省略.........
开发者ID:Barosonix,项目名称:AstraViewer,代码行数:101,
示例20: ll_sd_from_vector3BOOL LLPanelScriptLimitsRegionMemory::StartRequestChain(){ LLUUID region_id; LLFloaterLand* instance = LLFloaterLand::getInstance(); if(!instance) { getChild<LLUICtrl>("loading_text")->setValue(LLSD(std::string(""))); //might have to do parent post build here //if not logic below could use early outs return FALSE; } LLParcel* parcel = instance->getCurrentSelectedParcel(); LLViewerRegion* region = LLViewerParcelMgr::getInstance()->getSelectionRegion(); LLUUID current_region_id = gAgent.getRegion()->getRegionID(); // <alchemy> Fall back to the parcel we're on if none is selected. // Fixes parcel script info intermittently working and broken in toolbar button. if (!parcel) { parcel = LLViewerParcelMgr::getInstance()->getAgentParcel(); region = gAgent.getRegion(); } // </alchemy> if ((region) && (parcel)) { LLVector3 parcel_center = parcel->getCenterpoint(); region_id = region->getRegionID(); if(region_id != current_region_id) { std::string msg_wrong_region = LLTrans::getString("ScriptLimitsRequestWrongRegion"); getChild<LLUICtrl>("loading_text")->setValue(LLSD(msg_wrong_region)); return FALSE; } LLVector3d pos_global = region->getCenterGlobal(); LLSD body; std::string url = region->getCapability("RemoteParcelRequest"); if (!url.empty()) { body["location"] = ll_sd_from_vector3(parcel_center); if (!region_id.isNull()) { body["region_id"] = region_id; } if (!pos_global.isExactlyZero()) { U64 region_handle = to_region_handle(pos_global); body["region_handle"] = ll_sd_from_U64(region_handle); } LLHTTPClient::post(url, body, new LLRemoteParcelRequestResponder(getObserverHandle())); } else { LL_WARNS() << "Can't get parcel info for script information request" << region_id << ". Region: " << region->getName() << " does not support RemoteParcelRequest" << LL_ENDL; std::string msg_waiting = LLTrans::getString("ScriptLimitsRequestError"); getChild<LLUICtrl>("loading_text")->setValue(LLSD(msg_waiting)); } } else { std::string msg_waiting = LLTrans::getString("ScriptLimitsRequestNoParcelSelected"); getChild<LLUICtrl>("loading_text")->setValue(LLSD(msg_waiting)); } return LLPanelScriptLimitsInfo::postBuild();}
开发者ID:CmdrCupcake,项目名称:SingularityViewer,代码行数:75,
注:本文中的to_region_handle函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ to_rtc_device函数代码示例 C++ to_rdev函数代码示例 |