//-----------------------------------------------------------------------------
// Initialize particle
//-----------------------------------------------------------------------------
void ParticleData::initializeParticle(Particle* init, const Point3F& inheritVelocity)
{
   init->dataBlock = this;

   // Calculate the constant accleration...
   init->vel += inheritVelocity * inheritedVelFactor;
   init->acc  = init->vel * constantAcceleration;

   // Calculate this instance's lifetime...
   init->totalLifetime = lifetimeMS;
   if (lifetimeVarianceMS != 0)
      init->totalLifetime += S32(gRandGen.randI() % (2 * lifetimeVarianceMS + 1)) - S32(lifetimeVarianceMS);

   // assign spin amount
   init->spinSpeed = spinSpeed * gRandGen.randF( spinRandomMin, spinRandomMax );
}
Beispiel #2
0
//-----------------------------------------------------------------------------
UINT64 Crc64( UINT64 start_crc , UINT8 *addr ,UINT32 size)
{
	UINT8 * limit;
	UINT32 u32tmp ;

	PAGED_CODE ();

	start_crc = ~start_crc;

	if (size > 4)
	{
		while ((uintptr_t)(addr) & 3)
		{
			start_crc = crc64_table[0][*addr++ ^ A1(start_crc)] ^ S8(start_crc);
			--size;
		}

		limit = addr + (size & ~(size_t)(3));
		size &= (size_t)(3);

		while (addr < limit)
		{
			u32tmp = (UINT32)start_crc ^ (*(UINT32*)(addr));
			addr += 4;
			start_crc = crc64_table[3][A(u32tmp)]	^ crc64_table[2][B(u32tmp)] ^ S32(start_crc)^ crc64_table[1][C(u32tmp)] ^ crc64_table[0][D(u32tmp)];
		}
	}

	while (size-- != 0)
		start_crc = crc64_table[0][*addr++ ^ A1(start_crc)] ^ S8(start_crc);

	return ~start_crc;
}
bool LLAlertDialog::setCheckBox( const std::string& check_title, const std::string& check_control )
{
    const LLFontGL* font = LLResMgr::getInstance()->getRes( FONT_NAME );
    const S32 LINE_HEIGHT = llfloor(font->getLineHeight() + 0.99f);

    // Extend dialog for "check next time"
    S32 max_msg_width = getRect().getWidth() - 2 * HPAD;
    S32 check_width = S32(font->getWidth(check_title) + 0.99f) + 16;
    max_msg_width = llmax(max_msg_width, check_width);
    S32 dialog_width = max_msg_width + 2 * HPAD;

    S32 dialog_height = getRect().getHeight();
    dialog_height += LINE_HEIGHT;
    dialog_height += LINE_HEIGHT / 2;

    reshape( dialog_width, dialog_height, FALSE );

    S32 msg_x = (getRect().getWidth() - max_msg_width) / 2;

    LLRect check_rect;
    check_rect.setOriginAndSize(msg_x, VPAD+BTN_HEIGHT+LINE_HEIGHT/2,
                                max_msg_width, LINE_HEIGHT);

    mCheck = new LLCheckboxCtrl(std::string("check"), check_rect, check_title, font, onClickIgnore, this);
    addChild(mCheck);

    return true;
}
Beispiel #4
0
void LLNetMap::createObjectImage()
{
	// Find the size of the side of a square that surrounds the circle that surrounds getRect().
	F32 half_width = (F32)(getRect().getWidth() / 2);
	F32 half_height = (F32)(getRect().getHeight() / 2);
	F32 radius = sqrt( half_width * half_width + half_height * half_height );
	S32 square_size = S32( 2 * radius );

	// Find the least power of two >= the minimum size.
	const S32 MIN_SIZE = 32;
	const S32 MAX_SIZE = 256;
	S32 img_size = MIN_SIZE;
	while( (img_size*2 < square_size ) && (img_size < MAX_SIZE) )
	{
		img_size <<= 1;
	}

	if( mObjectImagep.isNull() ||
		(mObjectImagep->getWidth() != img_size) ||
		(mObjectImagep->getHeight() != img_size) )
	{
		mObjectRawImagep = new LLImageRaw(img_size, img_size, 4);
		U8* data = mObjectRawImagep->getData();
		memset( data, 0, img_size * img_size * 4 );
		mObjectImagep = new LLImageGL( mObjectRawImagep, FALSE);
		setScale(gMiniMapScale);
	}
	mUpdateNow = TRUE;
}
Beispiel #5
0
bool LLAlertDialog::setCheckBox( const LLString& check_title, const LLString& check_control )
{
	const LLFontGL* font = gResMgr->getRes( font_name );
	const S32 LINE_HEIGHT = llfloor(font->getLineHeight() + 0.99f);
	
	// Extend dialog for "check next time"
	S32 max_msg_width = mRect.getWidth() - 2 * HPAD;		
	S32 check_width = S32(font->getWidth(check_title) + 0.99f) + 16;
	max_msg_width = llmax(max_msg_width, check_width);
	S32 dialog_width = max_msg_width + 2 * HPAD;

	S32 dialog_height = mRect.getHeight();
	dialog_height += LINE_HEIGHT;
	dialog_height += LINE_HEIGHT / 2;

	reshape( dialog_width, dialog_height, FALSE );

	S32 msg_x = (mRect.getWidth() - max_msg_width) / 2;
	
	LLRect check_rect;
	check_rect.setOriginAndSize(msg_x, VPAD+BTN_HEIGHT+LINE_HEIGHT/2, 
								max_msg_width, LINE_HEIGHT);

	mCheck = new LLCheckboxCtrl("check", check_rect, check_title, font);
	addChild(mCheck);

	// mCheck is sometimes "show again" and sometimes "hide" :-(
	// If it's "Show Again", and we showed it, it must be checked. JC
	if (mIgnorable == IGNORE_SHOW_AGAIN)
	{
		mCheck->setValue(TRUE);
	}

	return true;
}
Beispiel #6
0
static void set_promiscuous_mode(struct net_device *dev)
{
	struct fs_enet_private *fep = netdev_priv(dev);
	fcc_t *fccp = fep->fcc.fccp;

	S32(fccp, fcc_fpsmr, FCC_PSMR_PRO);
}
F32 GuiSliderCtrl::_getThumbValue( const GuiEvent& event )
{
   Point2I curMousePos = globalToLocalCoord( event.mousePoint );

   F32 value;
   if( getWidth() >= getHeight() )
      value = F32( curMousePos.x - mShiftPoint ) / F32( getWidth() - mShiftExtent ) * ( mRange.y - mRange.x ) + mRange.x;
   else
      value = F32( curMousePos.y ) / F32( getHeight() ) * ( mRange.y - mRange.x ) + mRange.x;

   if(value > mRange.y )
      value = mRange.y;
   else if( value < mRange.x )
      value = mRange.x;

   if( mSnap || ( event.modifier & SI_SHIFT && mTicks >= 1 ) )
   {
      // If the shift key is held, snap to the nearest tick, if any are being drawn

      F32 tickStep = ( mRange.y - mRange.x ) / F32( mTicks + 1 );

      F32 tickSteps = (value - mRange.x ) / tickStep;
      S32 actualTick = S32( tickSteps + 0.5 );

      value = actualTick * tickStep + mRange.x;
      AssertFatal( value <= mRange.y && value >= mRange.x, "Error, out of bounds value generated from shift-snap of slider" );
   }

   return value;
}
void GuiSliderCtrl::_updateThumb( F32 _value, bool snap, bool onWake, bool doCallback )
{      
   if( snap && mTicks > 0 )
   {
      // If the shift key is held, snap to the nearest tick, if any are being drawn

      F32 tickStep = (mRange.y - mRange.x) / F32(mTicks + 1);

      F32 tickSteps = (_value - mRange.x) / tickStep;
      S32 actualTick = S32(tickSteps + 0.5);

      _value = actualTick * tickStep + mRange.x;
   }
   
   // Clamp the thumb to legal values.

   if( _value < mRange.x )
      _value = mRange.x;
   if( _value > mRange.y )
      _value = mRange.y;
      
   // If value hasn't changed and this isn't the initial update on
   // waking, do nothing.

   if( mValue == _value && !onWake )
      return;

   mValue = _value;

   Point2I ext = getExtent();
	ext.x -= ( mShiftExtent + mThumbSize.x ) / 2;
   // update the bounding thumb rect
   if (getWidth() >= getHeight())
   {  // HORZ thumb
      S32 mx = (S32)((F32(ext.x) * (mValue-mRange.x) / (mRange.y-mRange.x)));
      S32 my = ext.y/2;
      if(mDisplayValue)
         my = mThumbSize.y/2;

      mThumb.point.x  = mx - (mThumbSize.x/2);
      mThumb.point.y  = my - (mThumbSize.y/2);
      mThumb.extent   = mThumbSize;
   }
   else
   {  // VERT thumb
      S32 mx = ext.x/2;
      S32 my = (S32)((F32(ext.y) * (mValue-mRange.x) / (mRange.y-mRange.x)));
      mThumb.point.x  = mx - (mThumbSize.y/2);
      mThumb.point.y  = my - (mThumbSize.x/2);
      mThumb.extent.x = mThumbSize.y;
      mThumb.extent.y = mThumbSize.x;
   }
   
   setFloatVariable(mValue);
   setUpdate();

   // Use the alt console command if you want to continually update:
   if ( !onWake && doCallback )
      execAltConsoleCallback();
}
  //
  // Moving State
  //
  void SquadMoveTogether::StateMoving()
  {
    SquadObj::UnitList::Iterator i(&subject->GetList());
    for (!i; *i; i++)
    {
      if ((*i)->Alive() && (*i)->data <= S32(points.GetCount()))
      {
        // Someone hasn't made it
        return;
      }
    }

//    LOG_DIAG(("Entire squad has made it to the destination!"))

    // Were we spawned by a task ?
    if (task)
    {
      task->ProcessEvent(Event(0xF14439C5)); // "SquadMove::Completed"
    }
    else
    {
      subject->NotifyPlayer(0x763C5781); // "Squad::TaskCompleted"
    }
    Quit();
  }
void SFXXAudioVoice::_flush()
{
   AssertFatal( mXAudioVoice != NULL,
      "SFXXAudioVoice::_flush() - invalid voice" );

   EnterCriticalSection( &mLock );

   mXAudioVoice->Stop( 0 );
   mXAudioVoice->FlushSourceBuffers();
   mNonStreamBufferLoaded = false;

   #ifdef DEBUG_SPEW
   Platform::outputDebugString( "[SFXXAudioVoice] Flushed state" );
   #endif

   mIsPlaying = false;
   mHasStarted = false;
   mHasStopped = true;

   //WORKAROUND: According to the docs, SamplesPlayed reported by the
   // voice should get reset as soon as we submit a new buffer to the voice.
   // Alas it won't.  So, save the current value here and offset our future
   // play cursors.

   XAUDIO2_VOICE_STATE state;
   mXAudioVoice->GetState( &state );
   mSamplesPlayedOffset = - S32( state.SamplesPlayed );

   LeaveCriticalSection( &mLock );
}
Beispiel #11
0
static void tx_kickstart(struct net_device *dev)
{
	struct fs_enet_private *fep = netdev_priv(dev);
	fcc_t *fccp = fep->fcc.fccp;

	S32(fccp, fcc_ftodr, 0x80);
}
Beispiel #12
0
void AtlasOldMesher::writeVertex(Stream *s, Vert *vert, const S8 level)
{
   S16 x, y, z;

   const Point2I &vertPos = vert->pos;
   Point3F center;
   mBounds.getCenter(&center);

   if (vert->special)
      z = vert->z;
   else
      z = mHeight->sampleRead(vertPos);

   S32 xTmp, yTmp;
   xTmp = (S32)mFloor(((vertPos.x * mHeight->mSampleSpacing - center.x) * mCompressionFactor.x) + 0.5);
   yTmp = (S32)mFloor(((vertPos.y * mHeight->mSampleSpacing - center.y) * mCompressionFactor.y) + 0.5);

   AssertFatal(S16(xTmp) == xTmp,
      "AtlasOldMesher::writeVertex - Overflow writing x-coordinate!");
   AssertFatal(S16(yTmp) == yTmp,
      "AtlasOldMesher::writeVertex - Overflow writing y-coordinate!");

   x = xTmp;
   y = yTmp;

   s->write(x);
   s->write(y);
   s->write(z);

   // Morph info.  Calculate the difference between the
   // vert height, and the height of the same spot in the
   // next lower-LOD mesh.
   S16 morphHeight;
   if (vert->special)
      morphHeight = z;	// special verts don't morph.
   else
   {
      morphHeight = mHeight->getHeightAtLOD(vertPos, level + 1);
   }

   S32 morphDelta = (S32(morphHeight) - S32(z));
   s->write(S16(morphDelta));

   if(morphDelta != S16(morphDelta))
      Con::warnf("AtlasOldMesher::writeVertex - overflow in lerpedHeight!");
}
void handleNameTagOptionChanged(const LLSD& newvalue)
{
	S32 name_tag_option = S32(newvalue);
	if(name_tag_option==2)
	{
		gSavedSettings.setBOOL("SmallAvatarNames", TRUE);
	}
}
Beispiel #14
0
void LLMultiSlider::setSliderValue(const std::string& name, F32 value, BOOL from_event)
{
	// exit if not there
	if(!mValue.has(name)) {
		return;
	}

	value = llclamp( value, mMinValue, mMaxValue );

	// Round to nearest increment (bias towards rounding down)
	value -= mMinValue;
	value += mIncrement/2.0001f;
	value -= fmod(value, mIncrement);
	F32 newValue = mMinValue + value;

	// now, make sure no overlap
	// if we want that
	if(!mAllowOverlap) {
		bool hit = false;

		// look at the current spot
		// and see if anything is there
		LLSD::map_iterator mIt = mValue.beginMap();
		for(;mIt != mValue.endMap(); mIt++) {
			
			F32 testVal = (F32)mIt->second.asReal() - newValue;
			if(testVal > -FLOAT_THRESHOLD && testVal < FLOAT_THRESHOLD &&
				mIt->first != name) {
				hit = true;
				break;
			}
		}

		// if none found, stop
		if(hit) {
			return;
		}
	}
	

	// now set it in the map
	mValue[name] = newValue;

	// set the control if it's the current slider and not from an event
	if (!from_event && name == mCurSlider)
	{
		setControlValue(mValue);
	}
	
	F32 t = (newValue - mMinValue) / (mMaxValue - mMinValue);

	S32 left_edge = mThumbWidth/2;
	S32 right_edge = getRect().getWidth() - (mThumbWidth/2);

	S32 x = left_edge + S32( t * (right_edge - left_edge) );
	mThumbRects[name].mLeft = x - (mThumbWidth/2);
	mThumbRects[name].mRight = x + (mThumbWidth/2);
}
void LLFloaterWorldMap::trackLocation(const LLVector3d& pos_global)
{
	LLSimInfo* sim_info = LLWorldMap::getInstance()->simInfoFromPosGlobal(pos_global);
	if (!sim_info)
	{
		LLWorldMap::getInstance()->mIsTrackingUnknownLocation = TRUE;
		LLWorldMap::getInstance()->mInvalidLocation = FALSE;
		LLWorldMap::getInstance()->mUnknownLocation = pos_global;
		LLTracker::stopTracking(NULL);
		S32 world_x = S32(pos_global.mdV[0] / 256);
		S32 world_y = S32(pos_global.mdV[1] / 256);
		LLWorldMap::getInstance()->sendMapBlockRequest(world_x, world_y, world_x, world_y, true);
		setDefaultBtn("");
		return;
	}
	if (sim_info->mAccess == SIM_ACCESS_DOWN)
	{
		// Down sim. Show the blue circle of death!
		LLWorldMap::getInstance()->mIsTrackingUnknownLocation = TRUE;
		LLWorldMap::getInstance()->mUnknownLocation = pos_global;
		LLWorldMap::getInstance()->mInvalidLocation = TRUE;
		LLTracker::stopTracking(NULL);
		setDefaultBtn("");
		return;
	}

	std::string sim_name;
	LLWorldMap::getInstance()->simNameFromPosGlobal( pos_global, sim_name );
	F32 region_x = (F32)fmod( pos_global.mdV[VX], (F64)REGION_WIDTH_METERS );
	F32 region_y = (F32)fmod( pos_global.mdV[VY], (F64)REGION_WIDTH_METERS );
	std::string full_name = llformat("%s (%d, %d, %d)", 
								  sim_name.c_str(), 
								  llround(region_x), 
								  llround(region_y),
								  llround((F32)pos_global.mdV[VZ]));

	std::string tooltip("");
	mTrackedStatus = LLTracker::TRACKING_LOCATION;
	LLTracker::trackLocation(pos_global, full_name, tooltip);
	LLWorldMap::getInstance()->mIsTrackingUnknownLocation = FALSE;
	LLWorldMap::getInstance()->mIsTrackingDoubleClick = FALSE;
	LLWorldMap::getInstance()->mIsTrackingCommit = FALSE;

	setDefaultBtn("Teleport");
}
void LLFloaterWorldMap::trackLocation(const LLVector3d& pos_global)
{
	LLSimInfo* sim_info = LLWorldMap::getInstance()->simInfoFromPosGlobal(pos_global);
	if (!sim_info)
	{
		// We haven't found a region for that point yet, leave the tracking to the world map
		LLWorldMap::getInstance()->setTracking(pos_global);
		LLTracker::stopTracking(NULL);
		S32 world_x = S32(pos_global.mdV[0] / 256);
		S32 world_y = S32(pos_global.mdV[1] / 256);
		LLWorldMapMessage::getInstance()->sendMapBlockRequest(world_x, world_y, world_x, world_y, true);
		setDefaultBtn("");
		return;
	}
	if (sim_info->isDown())
	{
		// Down region. Show the blue circle of death!
		// i.e. let the world map that this and tell it it's invalid
		LLWorldMap::getInstance()->setTracking(pos_global);
		LLWorldMap::getInstance()->setTrackingInvalid();
		LLTracker::stopTracking(NULL);
		setDefaultBtn("");
		return;
	}

	std::string sim_name = sim_info->getName();
	F32 region_x = (F32)fmod( pos_global.mdV[VX], (F64)REGION_WIDTH_METERS );
	F32 region_y = (F32)fmod( pos_global.mdV[VY], (F64)REGION_WIDTH_METERS );
	std::string full_name = llformat("%s (%d, %d, %d)", 
//								  sim_name.c_str(), 
// [RLVa:KB] - Alternate: Snowglobe-1.2.4 | Checked: 2009-07-04 (RLVa-1.0.0a)
		(!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) ? sim_name.c_str() : RlvStrings::getString(RLV_STRING_HIDDEN_REGION).c_str(),
// [/RLVa:KB]
								  llround(region_x), 
								  llround(region_y),
								  llround((F32)pos_global.mdV[VZ]));

	std::string tooltip("");
	mTrackedStatus = LLTracker::TRACKING_LOCATION;
	LLTracker::trackLocation(pos_global, full_name, tooltip);
	LLWorldMap::getInstance()->cancelTracking();		// The floater is taking over the tracking

	setDefaultBtn("Teleport");
}
 //
 // SetVolume
 //
 // Sets the current redbook audio volume
 //
 void SetVolume(F32 volume)
 {
   if (initialized && driver)
   {
     AIL_redbook_set_volume
     (
       driver, Clamp<S32>(MIN_VOLUME, S32((volume * F32(MAX_VOLUME)) + 0.5F), MAX_VOLUME)
     );
   }
 }
Beispiel #18
0
/**
 * @luafunc table Team::getColor()
 *
 * @brief Get the team color
 *
 * @desc
 * The team color is a table with 3 values: red, green, blue.  These are returned
 * as integers in the range of 0-255
 *
 * @code
 *   local color = team:getColor()
 *
 *   local red   = color[0]
 *   local green = color[1]
 *   local blue  = color[2]
 * @endcode
 *
 * @return A table of RGB values for this team's color.
 */
S32 Team::lua_getColor(lua_State *L)
{
   const Color &color = getColor();

   S32 r = S32(color.r * 255);
   S32 g = S32(color.g * 255);
   S32 b = S32(color.b * 255);

   lua_newtable(L);    // Create a table, with no slots pre-allocated for our data

   lua_pushinteger(L, r);
   lua_rawseti(L, 1, 0);
   lua_pushinteger(L, g);
   lua_rawseti(L, 1, 1);
   lua_pushinteger(L, b);
   lua_rawseti(L, 1, 2);

   return 1;
}
LLViewerParcelOverlay::LLViewerParcelOverlay(LLViewerRegion* region, F32 region_width_meters)
:	mRegion( region ),
	mParcelGridsPerEdge( S32( region_width_meters / PARCEL_GRID_STEP_METERS ) ),
	mRegionSize(S32(region_width_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	
	mImageRaw = new LLImageRaw(mParcelGridsPerEdge, mParcelGridsPerEdge, OVERLAY_IMG_COMPONENTS);
	mTexture = LLViewerTextureManager::getLocalTexture(mImageRaw.get(), FALSE);
	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;
	}

	gPipeline.markGLRebuild(this);
}
// return the default inventory for the given asset type.
// static
LLInventoryType::EType LLInventoryType::defaultForAssetType(LLAssetType::EType asset_type)
{
	if((asset_type >= 0) && (asset_type < LLAssetType::AT_COUNT))
	{
		return DEFAULT_ASSET_FOR_INV_TYPE[S32(asset_type)];
	}
	else
	{
		return IT_NONE;
	}
}
Beispiel #21
0
const char* LLSaleInfo::lookup(EForSale type)
{
	if((type >= 0) && (type < FS_COUNT))
	{
		return FOR_SALE_NAMES[S32(type)];
	}
	else
	{
		return NULL;
	}
}
Beispiel #22
0
// XUI:translate
// translation from a type to a human readable form.
// static
const char* LLInventoryType::lookupHumanReadable(EType type)
{
	if((type >= 0) && (type < IT_COUNT))
	{
		return INVENTORY_TYPE_HUMAN_NAMES[S32(type)];
	}
	else
	{
		return NULL;
	}
}
Beispiel #23
0
// static
const char* LLAssetType::lookup( LLAssetType::EType type )
{
	if( (type >= 0) && (type < AT_COUNT ))
	{
		return mAssetTypeNames[ S32( type ) ];
	}
	else
	{
		return "-1";
	}
}
Beispiel #24
0
// static
const char* LLAssetType::lookupHumanReadable(LLAssetType::EType type)
{
	if( (type >= 0) && (type < AT_COUNT ))
	{
		return mAssetTypeHumanNames[S32(type)];
	}
	else
	{
		return NULL;
	}
}
Beispiel #25
0
/* Some transmit errors cause the transmitter to shut
 * down.  We now issue a restart transmit.  Since the
 * errors close the BD and update the pointers, the restart
 * _should_ pick up without having to reset any of our
 * pointers either.  Also, To workaround 8260 device erratum
 * CPM37, we must disable and then re-enable the transmitter
 * following a Late Collision, Underrun, or Retry Limit error.
 */
static void tx_restart(struct net_device *dev)
{
	struct fs_enet_private *fep = netdev_priv(dev);
	fcc_t __iomem *fccp = fep->fcc.fccp;

	C32(fccp, fcc_gfmr, FCC_GFMR_ENT);
	udelay(10);
	S32(fccp, fcc_gfmr, FCC_GFMR_ENT);

	fcc_cr_cmd(fep, CPM_CR_RESTART_TX);
}
// Store previous scissors settings
void ScissorsManager::enable(bool enable, DisplayMode displayMode, F32 x, F32 y, F32 width, F32 height) 
{
   mManagerEnabled = enable;

   if(!enable)
      return;

   mGL->glGetValue(GLOPT::ScissorTest, &mScissorsWasEnabled);

   if(mScissorsWasEnabled)
      mGL->glGetValue(GLOPT::ScissorBox, &mScissorBox[0]);

   static Point p1, p2;
   p1 = DisplayManager::getScreenInfo()->convertCanvasToWindowCoord(x,     DisplayManager::getScreenInfo()->getGameCanvasHeight() - y - height, displayMode);
   p2 = DisplayManager::getScreenInfo()->convertCanvasToWindowCoord(width, height,                                         displayMode);

   mGL->glScissor(S32(p1.x), S32(p1.y), S32(p2.x), S32(p2.y));

   mGL->glEnable(GLOPT::ScissorTest);
}
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");

}
Beispiel #28
0
void LLMultiGesture::dump()
{
	llinfos << "key " << S32(mKey) << " mask " << U32(mMask) 
		<< " trigger " << mTrigger
		<< " replace " << mReplaceText
		<< llendl;
	U32 i;
	for (i = 0; i < mSteps.size(); ++i)
	{
		LLGestureStep* step = mSteps[i];
		step->dump();
	}
}
Beispiel #29
0
static struct elf_sh * read_elf_sh(const struct elf_sh *p)
{
	static struct elf_sh hdr;

	hdr = *p;

	if (need_byteswap)
	{
		hdr.name      = S32(hdr.name);
		hdr.type      = S32(hdr.type);
		hdr.flags     = S32(hdr.flags);
		hdr.addr      = S32(hdr.addr);
		hdr.offset    = S32(hdr.offset);
		hdr.size      = S32(hdr.size);
		hdr.linke     = S32(hdr.linke);
		hdr.info      = S32(hdr.info);
		hdr.addralign = S32(hdr.addralign);
		hdr.entsize   = S32(hdr.entsize);
	}

	return &hdr;
}
    ///////////////////////////////////////////////////////////////////////////
    //
    // Base primitive
    //
    Prim::Prim(Cineractive *cineractive, FScope *fScope, S32 defaultPriority) 
    : cineractive(cineractive),
      done(FALSE),
      priority(defaultPriority)
    {
      startTime = F32(cineractive->elapsedCycles) * GameTime::INTERVAL;

      // Load configuration
      if (fScope)
      {
        priority = S32(StdLoad::TypeU32(fScope, "Priority", priority));
      }
    }