LLViewerParcelOverlay::LLViewerParcelOverlay(LLViewerRegion* region, F32 region_width_meters) : mRegion( region ), mParcelGridsPerEdge( S32( region_width_meters / PARCEL_GRID_STEP_METERS ) ), mDirty( FALSE ), mTimeSinceLastUpdate(), mOverlayTextureIdx(-1), mVertexCount(0), mVertexArray(NULL), mColorArray(NULL) // mTexCoordArray(NULL), { // Create a texture to hold color information. // 4 components // Use mipmaps = FALSE, clamped, NEAREST filter, for sharp edges mTexture = new LLImageGL(FALSE); mImageRaw = new LLImageRaw(mParcelGridsPerEdge, mParcelGridsPerEdge, OVERLAY_IMG_COMPONENTS); mTexture->createGLTexture(0, mImageRaw); gGL.getTexUnit(0)->activate(); gGL.getTexUnit(0)->bind(mTexture); mTexture->setAddressMode(LLTexUnit::TAM_CLAMP); mTexture->setFilteringOption(LLTexUnit::TFO_POINT); // // Initialize the GL texture with empty data. // // Create the base texture. U8 *raw = mImageRaw->getData(); const S32 COUNT = mParcelGridsPerEdge * mParcelGridsPerEdge * OVERLAY_IMG_COMPONENTS; for (S32 i = 0; i < COUNT; i++) { raw[i] = 0; } mTexture->setSubImage(mImageRaw, 0, 0, mParcelGridsPerEdge, mParcelGridsPerEdge); // Create storage for ownership information from simulator // and initialize it. mOwnership = new U8[ mParcelGridsPerEdge * mParcelGridsPerEdge ]; for (S32 i = 0; i < mParcelGridsPerEdge * mParcelGridsPerEdge; i++) { mOwnership[i] = PARCEL_PUBLIC; } // Make sure the texture matches the ownership information. updateOverlayTexture(); sShowPropertyLines = gSavedSettings.getBOOL("ShowPropertyLines"); mPropertyColorAvail = gColors.getColor4U("PropertyColorAvail"); mPropertyColorOther = gColors.getColor4U("PropertyColorOther"); mPropertyColorGroup = gColors.getColor4U("PropertyColorGroup"); mPropertyColorSelf = gColors.getColor4U("PropertyColorSelf"); mPropertyColorForSale = gColors.getColor4U("PropertyColorForSale"); mPropertyColorAuction = gColors.getColor4U("PropertyColorAuction"); }
void LLViewerParcelOverlay::idleUpdate(bool force_update) { if (gGLManager.mIsDisabled) { return; } if (mOverlayTextureIdx >= 0 && (!(mDirty && force_update))) { // We are in the middle of updating the overlay texture updateOverlayTexture(); return; } // Only if we're dirty and it's been a while since the last update. if (mDirty) { if (force_update || mTimeSinceLastUpdate.getElapsedTimeF32() > 4.0f) { updateOverlayTexture(); updatePropertyLines(); mTimeSinceLastUpdate.reset(); } } }
void LLViewerParcelOverlay::idleUpdate(bool force_update) { LLMemType mt_iup(LLMemType::MTYPE_IDLE_UPDATE_PARCEL_OVERLAY); if (gGLManager.mIsDisabled) { return; } if (mOverlayTextureIdx >= 0 && (!(mDirty && force_update))) { // We are in the middle of updating the overlay texture gPipeline.markGLRebuild(this); return; } // Only if we're dirty and it's been a while since the last update. if (mDirty) { if (force_update || mTimeSinceLastUpdate.getElapsedTimeF32() > 4.0f) { updateOverlayTexture(); updatePropertyLines(); mTimeSinceLastUpdate.reset(); } } }
void LLViewerParcelOverlay::updateGL() { updateOverlayTexture(); }