示例#1
0
void LLTexLayerParamColor::setWeight(F32 weight, BOOL upload_bake)
{
	if (mIsAnimating)
	{
		return;
	}

	const LLTexLayerParamColorInfo *info = (LLTexLayerParamColorInfo *)getInfo();
	F32 min_weight = getMinWeight();
	F32 max_weight = getMaxWeight();
	F32 new_weight = llclamp(weight, min_weight, max_weight);
	U8 cur_u8 = F32_to_U8(mCurWeight, min_weight, max_weight);
	U8 new_u8 = F32_to_U8(new_weight, min_weight, max_weight);
	if (cur_u8 != new_u8)
	{
		mCurWeight = new_weight;

		if (info->mNumColors <= 0)
		{
			// This will happen when we set the default weight the first time.
			return;
		}

		if ((mAvatar->getSex() & getSex()) && (mAvatar->isSelf() && !mIsDummy)) // only trigger a baked texture update if we're changing a wearable's visual param.
		{
			onGlobalColorChanged(upload_bake);
			if (mTexLayer)
			{
				mAvatar->invalidateComposite(mTexLayer->getTexLayerSet(), upload_bake);
			}
		}

//		llinfos << "param " << mName << " = " << new_weight << llendl;
	}
}
示例#2
0
void LLTexLayerParamAlpha::setWeight(F32 weight, BOOL upload_bake)
{
	if (mIsAnimating || mTexLayer == NULL)
	{
		return;
	}
	F32 min_weight = getMinWeight();
	F32 max_weight = getMaxWeight();
	F32 new_weight = llclamp(weight, min_weight, max_weight);
	U8 cur_u8 = F32_to_U8(mCurWeight, min_weight, max_weight);
	U8 new_u8 = F32_to_U8(new_weight, min_weight, max_weight);
	if (cur_u8 != new_u8)
	{
		mCurWeight = new_weight;

		if ((mAvatar->getSex() & getSex()) && (mAvatar->isSelf() && !mIsDummy)) // only trigger a baked texture update if we're changing a wearable's visual param.
		{
			if (isAgentAvatarValid() && !gAgentAvatarp->isUsingBakedTextures())
			{
				upload_bake = FALSE;
			}
			mAvatar->invalidateComposite(mTexLayer->getTexLayerSet(), upload_bake);
			mTexLayer->invalidateMorphMasks();
		}
	}
}
示例#3
0
// Avatar parameter and texture definitions can change over time.
// * If parameters or textures have been REMOVED since the wearable was created,
// they're just ignored, so we consider the wearable clean even though isOldVersion()
// will return true. 
// * If parameters or textures have been ADDED since the wearable was created,
// they are taken to have default values, so we consider the wearable clean
// only if those values are the same as the defaults.
BOOL LLWearable::isDirty()
{
	LLVOAvatar* avatar = gAgent.getAvatarObject();
	llassert( avatar );
	if( !avatar )
	{
		return FALSE;
	}


	for( LLViewerVisualParam* param = (LLViewerVisualParam*) avatar->getFirstVisualParam(); 
		param;
		param = (LLViewerVisualParam*) avatar->getNextVisualParam() )
	{
		if( (param->getWearableType() == mType) && (param->getGroup() == VISUAL_PARAM_GROUP_TWEAKABLE ) )
		{
			F32 weight = get_if_there(mVisualParamMap, param->getID(), param->getDefaultWeight());
			weight = llclamp( weight, param->getMinWeight(), param->getMaxWeight() );
			
			U8 a = F32_to_U8( param->getWeight(), param->getMinWeight(), param->getMaxWeight() );
			U8 b = F32_to_U8( weight,             param->getMinWeight(), param->getMaxWeight() );
			if( a != b  )
			{
				return TRUE;
			}
		}
	}

	for( S32 te = 0; te < LLVOAvatar::TEX_NUM_ENTRIES; te++ )
	{
		if( LLVOAvatar::getTEWearableType( te ) == mType )
		{
			LLViewerImage* avatar_image = avatar->getTEImage( te );
			if( !avatar_image )
			{
				llassert( 0 );
				continue;
			}
			const LLUUID& image_id = get_if_there(mTEMap,  te, LLVOAvatar::getDefaultTEImageID( te ) );
			if( avatar_image->getID() != image_id )
			{
				return TRUE;
			}
		}
	}

	//if( gFloaterCustomize )
	//{
	//	if( mDescription != gFloaterCustomize->getWearableDescription( mType ) )
	//	{
	//		return TRUE;
	//	}
	//}

	return FALSE;
}
示例#4
0
	void v3math_object::test<34>()
	{
		F32 x = 10.f, y = 20.f, z = -15.f;
		F32 x1, y1, z1;
		F32 lowerxy = 0.f, upperxy = 1.0f, lowerz = -1.0f, upperz = 1.f;
		LLVector3 vec3(x,y,z);
		vec3.quantize16(lowerxy,upperxy,lowerz,upperz);
		x1 = U16_to_F32(F32_to_U16(x, lowerxy, upperxy), lowerxy, upperxy);
		y1 = U16_to_F32(F32_to_U16(y, lowerxy, upperxy), lowerxy, upperxy);
		z1 = U16_to_F32(F32_to_U16(z, lowerz,  upperz),  lowerz,  upperz);
		ensure("1:quantize16: Fail ", is_approx_equal(x1, vec3.mV[VX]) && is_approx_equal(y1, vec3.mV[VY]) && is_approx_equal(z1, vec3.mV[VZ]));
		LLVector3 vec3a(x,y,z);
		vec3a.quantize8(lowerxy,upperxy,lowerz,upperz);
		x1 = U8_to_F32(F32_to_U8(x, lowerxy, upperxy), lowerxy, upperxy);
		y1 = U8_to_F32(F32_to_U8(y, lowerxy, upperxy), lowerxy, upperxy);
		z1 = U8_to_F32(F32_to_U8(z, lowerz, upperz), lowerz, upperz);
		ensure("2:quantize8: Fail ", is_approx_equal(x1, vec3a.mV[VX]) && is_approx_equal(y1, vec3a.mV[VY]) && is_approx_equal(z1, vec3a.mV[VZ]));
	}
void AIVisualParamIDValuePair::toXML(std::ostream& os, int indentation) const
{
    LLVisualParam const* visual_param = mVisualParam;
    if (!visual_param && mWearable)
    {
        visual_param = mWearable->getVisualParam(mID);
    }
    if (visual_param)
    {
        AIXMLElement tag(os, "param", indentation);
        tag.attribute("id", mID);
        tag.attribute("name", visual_param->getName());
        tag.attribute("value", mValue);
        tag.attribute("u8", (U32)F32_to_U8(mValue, visual_param->getMinWeight(), visual_param->getMaxWeight()));
        tag.attribute("type", visual_param->getTypeString());
        tag.attribute("wearable", visual_param->getDumpWearableTypeName());
    }
}
示例#6
0
void	LLVector3::quantize8(F32 lowerxy, F32 upperxy, F32 lowerz, F32 upperz)
{
	mV[VX] = U8_to_F32(F32_to_U8(mV[VX], lowerxy, upperxy), lowerxy, upperxy);;
	mV[VY] = U8_to_F32(F32_to_U8(mV[VY], lowerxy, upperxy), lowerxy, upperxy);
	mV[VZ] = U8_to_F32(F32_to_U8(mV[VZ], lowerz, upperz), lowerz, upperz);
}