Exemplo n.º 1
0
BOOL LLVOTextBubble::idleUpdate(LLAgent &agent, LLWorld	&world, const F64 &time)
{
	static LLFastTimer::DeclareTimer ftm("Text Bubble");
	LLFastTimer t(ftm);

	F32 dt = mUpdateTimer.getElapsedTimeF32();
	// Die after a few seconds.
	if (dt > 1.5f)
	{
		return FALSE;
	}

	LLViewerObject::idleUpdate(agent, world, time);

	setScale(0.5f * (1.f+dt) * LLVector3(1.5f, 1.5f, 0.5f));

	F32 alpha = 0.35f*dt;

	LLColor4 color = mColor;
	color.mV[VALPHA] -= alpha;
	if (color.mV[VALPHA] <= 0.05f)
	{
		return FALSE;
	}
	S32 i;
	for (i = 0; i < getNumTEs(); i++)
	{
		setTEColor(i, color);
		setTEFullbright(i, TRUE);
	}

	gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_VOLUME, TRUE);
	return TRUE;
}
Exemplo n.º 2
0
void LLPrimitive::setAllTESelected(bool sel)
{
	for (int i = 0, cnt = getNumTEs(); i < cnt; i++)
	{
		setTESelected(i, sel);
	}
}
Exemplo n.º 3
0
void LLVOTextBubble::updateTextures(LLAgent &agent)
{
	// Update the image levels of all textures...
	// First we do some quick checks.
	U32 i;

	// This doesn't take into account whether the object is in front
	// or behind...

	LLVector3 position_local = getPositionAgent() - agent.getCameraPositionAgent();
	F32 dot_product = position_local * agent.getFrameAgent().getAtAxis();
	F32 cos_angle = dot_product / position_local.magVec();

	if (cos_angle > 1.f)
	{
		cos_angle = 1.f;
	}

	for (i = 0; i < getNumTEs(); i++)
	{
		const LLTextureEntry *te = getTE(i);
		F32 texel_area_ratio = fabs(te->mScaleS * te->mScaleT);

		LLViewerImage *imagep = getTEImage(i);
		if (imagep)
		{
			imagep->addTextureStats(mPixelArea, texel_area_ratio, cos_angle);
		}
	}
}
Exemplo n.º 4
0
void LLPrimitive::setTEArrays(const U8 size,
							  const LLUUID* image_ids,
							  const F32* scale_s,
							  const F32* scale_t)
{
	S32 cur_size = size;
	if (cur_size > getNumTEs())
	{
		llwarns << "Trying to set more TEs than exist!" << llendl;
		cur_size = getNumTEs();
	}

	S32 i;
	// Copy over image information
	for (i = 0; i < cur_size; i++)
	{
		// This is very BAD!!!!!!
		if (image_ids != NULL)
		{
			setTETexture(i,image_ids[i]);
		}
		if (scale_s && scale_t)
		{
			setTEScale(i, scale_s[i], scale_t[i]);
		}
 	}

	if (i < getNumTEs())
	{
		cur_size--;
		for (i=i; i < getNumTEs(); i++)		// the i=i removes a gcc warning
		{
			if (image_ids != NULL)
			{
				setTETexture(i, image_ids[cur_size]);
			}
			if (scale_s && scale_t)
			{
				setTEScale(i, scale_s[cur_size], scale_t[cur_size]);
			}
		}
	}
}
Exemplo n.º 5
0
void LLPrimitive::copyTEs(const LLPrimitive *primitivep)
{
	U32 i;
	if (primitivep->getNumTEs() != getNumTEs())
	{
		llwarns << "Primitives don't have same number of TE's" << llendl;
	}
	U32 num_tes = llmin(primitivep->getNumTEs(), getNumTEs());
	for (i = 0; i < num_tes; i++)
	{
		const LLTextureEntry *tep = primitivep->getTE(i);
		F32 s, t;
		setTETexture(i, tep->getID());
		setTEColor(i, tep->getColor());
		tep->getScale(&s, &t);
		setTEScale(i, s, t);
		tep->getOffset(&s, &t);
		setTEOffset(i, s, t);
		setTERotation(i, tep->getRotation());
		setTEBumpShinyFullbright(i, tep->getBumpShinyFullbright());
		setTEMediaTexGen(i, tep->getMediaTexGen());
		setTEGlow(i, tep->getGlow());
	}
}
Exemplo n.º 6
0
void LLVOTextBubble::updateTextures()
{
	// Update the image levels of all textures...

	for (U32 i = 0; i < getNumTEs(); i++)
	{
		const LLTextureEntry *te = getTE(i);
		F32 texel_area_ratio = fabs(te->mScaleS * te->mScaleT);
		texel_area_ratio = llclamp(texel_area_ratio, .125f, 16.f);
		LLViewerTexture *imagep = getTEImage(i);
		if (imagep)
		{
			imagep->addTextureStats(mPixelArea / texel_area_ratio);
		}
	}
}
Exemplo n.º 7
0
LLDrawable *LLVOTextBubble::createDrawable(LLPipeline *pipeline)
{
	pipeline->allocDrawable(this);
	mDrawable->setLit(FALSE);
	mDrawable->setRenderType(LLPipeline::RENDER_TYPE_VOLUME);
	
	for (U32 i = 0; i < getNumTEs(); i++)
	{
		LLViewerTexture *imagep;
		const LLTextureEntry *texture_entry = getTE(i);
		imagep = LLViewerTextureManager::getFetchedTexture(texture_entry->getID());

		mDrawable->addFace((LLFacePool*) NULL, imagep);
	}

	return mDrawable;
}
Exemplo n.º 8
0
LLVOTextBubble::LLVOTextBubble(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp)
:	LLAlphaObject(id, pcode, regionp)
{
	setScale(LLVector3(1.5f, 1.5f, 0.25f));
	mbCanSelect = FALSE;
	mLOD = MIN_LOD;
	mVolumeChanged = TRUE;
	setVelocity(LLVector3(0.f, 0.f, 0.75f));
	LLVolumeParams volume_params;
	volume_params.setType(LL_PCODE_PROFILE_CIRCLE, LL_PCODE_PATH_LINE);
	volume_params.setBeginAndEndS(0.f, 1.f);
	volume_params.setBeginAndEndT(0.f, 1.f);
	volume_params.setRatio(0.25f, 0.25f);
	volume_params.setShear(0.f, 0.f);
	setVolume(volume_params, 0);
	mColor = LLColor4(1.0f, 0.0f, 0.0f, 1.f);
	S32 i;
	for (i = 0; i < getNumTEs(); i++)
	{
		setTEColor(i, mColor);
		setTETexture(i, LLUUID(IMG_DEFAULT));
	}
}