Example #1
0
void ColorBox::MouseUpdate(){
	Float saturation = ClampValue(m_mouseX/Float(m_w),0.0,1.0);
	m_color[1] = saturation;
	Float lightness = ClampValue(m_mouseY/Float(m_h),0.0,1.0);
	m_color[2] = lightness;
	m_parent->UpdateColor(m_color);
}
Example #2
0
 void Format7DrawingArea::ClampAllValues()
 {
     m_left = ClampValue( m_left, m_offsetHStepSize );
     m_top = ClampValue( m_top, m_offsetVStepSize );
     m_width = ClampValue( m_width, m_imageHStepSize );
     m_height = ClampValue( m_height, m_imageVStepSize );
 }    
Example #3
0
void dgBallConstraint::SetLimits(const dgVector& coneDir,
    dgFloat32 minConeAngle, dgFloat32 maxConeAngle, dgFloat32 maxTwistAngle,
    const dgVector& bilateralDir, dgFloat32 negativeBilateralConeAngle__,
    dgFloat32 positiveBilateralConeAngle__)
{
  dgMatrix matrix0;
  dgMatrix matrix1;
  CalculateGlobalMatrixAndAngle(matrix0, matrix1);

  _ASSERTE(m_body0);
  _ASSERTE(m_body1);
  const dgMatrix& body0_Matrix = m_body0->GetMatrix();

  dgVector lateralDir(bilateralDir * coneDir);
  if ((lateralDir % lateralDir) < dgFloat32(1.0e-3f))
  {
    dgMatrix tmp(coneDir);
    lateralDir = tmp.m_up;
  }

  m_localMatrix0.m_front = body0_Matrix.UnrotateVector(coneDir);
  m_localMatrix0.m_up = body0_Matrix.UnrotateVector(lateralDir);
  m_localMatrix0.m_posit = body0_Matrix.UntransformVector(matrix1.m_posit);

  m_localMatrix0.m_front =
      m_localMatrix0.m_front.Scale(
          dgFloat32(
              1.0f) / dgSqrt (m_localMatrix0.m_front % m_localMatrix0.m_front));
  m_localMatrix0.m_up = m_localMatrix0.m_up.Scale(
      dgFloat32(1.0f) / dgSqrt (m_localMatrix0.m_up % m_localMatrix0.m_up));
  m_localMatrix0.m_right = m_localMatrix0.m_front * m_localMatrix0.m_up;

  m_localMatrix0.m_front.m_w = dgFloat32(0.0f);
  m_localMatrix0.m_up.m_w = dgFloat32(0.0f);
  m_localMatrix0.m_right.m_w = dgFloat32(0.0f);
  m_localMatrix0.m_posit.m_w = dgFloat32(1.0f);

//	dgMatrix body1_Matrix (dgGetIdentityMatrix());
//	if (m_body1) {
//		body1_Matrix = m_body1->GetMatrix();
//	}
  const dgMatrix& body1_Matrix = m_body1->GetMatrix();

  m_twistAngle = ClampValue(maxTwistAngle, dgFloat32(5.0f) * dgDEG2RAD,
      dgFloat32(90.0f) * dgDEG2RAD);
  m_coneAngle = ClampValue((maxConeAngle - minConeAngle) * dgFloat32(0.5f),
      dgFloat32(5.0f) * dgDEG2RAD, 175.0f * dgDEG2RAD);
  m_coneAngleCos = dgCos (m_coneAngle);

  dgMatrix coneMatrix(
      dgPitchMatrix((maxConeAngle + minConeAngle) * dgFloat32(0.5f)));

  m_localMatrix0 = coneMatrix * m_localMatrix0;

  m_localMatrix1 = m_localMatrix0 * body0_Matrix * body1_Matrix.Inverse();

}
Example #4
0
void ConVar::InternalSetValue(const char *value)
{
    float fNewValue;
    char  tempVal[32];
    char  *val;

    auto temp = *(uint32_t*)&m_Value.m_fValue ^ (uint32_t)this;
    float flOldValue = *(float*)(&temp);

    val = (char *)value;
    fNewValue = (float)atof(value);

    if(ClampValue(fNewValue)) {
        snprintf(tempVal, sizeof(tempVal), "%f", fNewValue);
        val = tempVal;
    }

    // Redetermine value
    *(uint32_t*)&m_Value.m_fValue = *(uint32_t*)&fNewValue ^ (uint32_t)this;
    *(uint32_t*)&m_Value.m_nValue = (uint32_t)fNewValue ^ (uint32_t)this;

    if(!(m_nFlags & FCVAR_NEVER_AS_STRING)) {
        ChangeStringValue(val, flOldValue);
    }
}
Example #5
0
void Envelope::SetRange(double minValue, double maxValue) {
   mMinValue = minValue;
   mMaxValue = maxValue;
   mDefaultValue = ClampValue(mDefaultValue);
   for( unsigned int i = 0; i < mEnv.Count(); i++ )
      mEnv[i]->SetVal(mEnv[i]->GetVal()); // this clamps the value to the new range
}
dgVector  dgPointToRayDistance (const dgVector& point, const dgVector& ray_p0, const dgVector& ray_p1)
{
	hacd::HaF32 t;
	dgVector dp (ray_p1 - ray_p0);
	t = ClampValue (((point - ray_p0) % dp) / (dp % dp), hacd::HaF32(hacd::HaF32 (0.0f)), hacd::HaF32(hacd::HaF32 (1.0f)));
	return ray_p0 + dp.Scale (t);
}
Example #7
0
//-----------------------------------------------------------------------------
// Purpose: 
// Input  : *value - 
//-----------------------------------------------------------------------------
void ConVar::InternalSetFloatValue( float fNewValue )
{
	if ( fNewValue == m_fValue )
		return;

	if ( IsFlagSet( FCVAR_MATERIAL_THREAD_MASK ) )
	{
		if ( g_pCVar && !g_pCVar->IsMaterialThreadSetAllowed() )
		{
			g_pCVar->QueueMaterialThreadSetValue( this, fNewValue );
			return;
		}
	}

	Assert( m_pParent == this ); // Only valid for root convars.

	// Check bounds
	ClampValue( fNewValue );

	// Redetermine value
	float flOldValue = m_fValue;
	m_fValue		= fNewValue;
	m_nValue		= ( int )m_fValue;

	if ( !( m_nFlags & FCVAR_NEVER_AS_STRING ) )
	{
		char tempVal[ 32 ];
		Q_snprintf( tempVal, sizeof( tempVal), "%f", m_fValue );
		ChangeStringValue( tempVal, flOldValue );
	}
	else
	{
		Assert( !m_fnChangeCallback );
	}
}
Example #8
0
//-----------------------------------------------------------------------------
// Purpose: 
// Input  : *value - 
//-----------------------------------------------------------------------------
void ConVar::InternalSetFloatValue( float fNewValue )
{
	if ( fNewValue == m_Value.m_fValue )
		return;

	Assert( m_pParent == this ); // Only valid for root convars.

	// Check bounds
	ClampValue( fNewValue );

	// Redetermine value
	float flOldValue = m_Value.m_fValue;
	m_Value.m_fValue		= fNewValue;
	m_Value.m_nValue		= ( int )fNewValue;

	if ( !( m_nFlags & FCVAR_NEVER_AS_STRING ) )
	{
		char tempVal[ 32 ];
		Q_snprintf( tempVal, sizeof( tempVal), "%f", m_Value.m_fValue );
		ChangeStringValue( tempVal, flOldValue );
	}
	else
	{
		Assert( m_fnChangeCallbacks.Count() == 0 );
	}
}
Example #9
0
//-----------------------------------------------------------------------------
// Purpose: 
// Input  : *value - 
//-----------------------------------------------------------------------------
void ConVar::InternalSetValue( const char *value )
{
	float fNewValue;
	char  tempVal[ 32 ];
	char  *val;

	Assert(m_pParent == this); // Only valid for root convars.

	float flOldValue = m_fValue;

	val = (char *)value;
	fNewValue = ( float )atof( value );

	if ( ClampValue( fNewValue ) )
	{
		Q_snprintf( tempVal,sizeof(tempVal), "%f", fNewValue );
		val = tempVal;
	}
	
	// Redetermine value
	m_fValue		= fNewValue;
	m_nValue		= ( int )( m_fValue );

	if ( !( m_nFlags & FCVAR_NEVER_AS_STRING ) )
	{
		ChangeStringValue( val, flOldValue );
	}
}
Example #10
0
//-----------------------------------------------------------------------------
// Purpose: 
// Input  : *value - 
//-----------------------------------------------------------------------------
void ConVar::InternalSetIntValue( int nValue )
{
	if ( nValue == m_nValue )
		return;

	Assert( m_pParent == this ); // Only valid for root convars.

	float fValue = (float)nValue;
	if ( ClampValue( fValue ) )
	{
		nValue = ( int )( fValue );
	}

	// Redetermine value
	float flOldValue = m_fValue;
	m_fValue		= fValue;
	m_nValue		= nValue;

	if ( !( m_nFlags & FCVAR_NEVER_AS_STRING ) )
	{
		char tempVal[ 32 ];
		Q_snprintf( tempVal, sizeof( tempVal ), "%d", m_nValue );
		ChangeStringValue( tempVal, flOldValue );
	}
	else
	{
		Assert( !m_fnChangeCallback );
	}
}
dgVector dgApi dgPointToRayDistance (const dgVector& point, const dgVector& ray_p0, const dgVector& ray_p1)
{
	dgFloat32 t;
	dgVector dp (ray_p1 - ray_p0);
	t = ClampValue (((point - ray_p0) % dp) / (dp % dp), dgFloat32(dgFloat32 (0.0f)), dgFloat32(dgFloat32 (1.0f)));
	return ray_p0 + dp.Scale (t);
}
Example #12
0
dgVector dgMatrix::CalcPitchYawRoll () const
{
	const hacd::HaF32 minSin = hacd::HaF32(0.99995f);

	const dgMatrix& matrix = *this;

	hacd::HaF32 roll = hacd::HaF32(0.0f);
	hacd::HaF32 pitch  = hacd::HaF32(0.0f);
	hacd::HaF32 yaw = dgAsin (-ClampValue (matrix[0][2], hacd::HaF32(-0.999999f), hacd::HaF32(0.999999f)));

	HACD_ASSERT (dgCheckFloat (yaw));
	if (matrix[0][2] < minSin) {
		if (matrix[0][2] > (-minSin)) {
			roll = dgAtan2 (matrix[0][1], matrix[0][0]);
			pitch = dgAtan2 (matrix[1][2], matrix[2][2]);
		} else {
			pitch = dgAtan2 (matrix[1][0], matrix[1][1]);
		}
	} else {
		pitch = -dgAtan2 (matrix[1][0], matrix[1][1]);
	}

#ifdef _DEBUG
	dgMatrix m (dgPitchMatrix (pitch) * dgYawMatrix(yaw) * dgRollMatrix(roll));
	for (hacd::HaI32 i = 0; i < 3; i ++) {
		for (hacd::HaI32 j = 0; j < 3; j ++) {
			hacd::HaF32 error = dgAbsf (m[i][j] - matrix[i][j]);
			HACD_ASSERT (error < 5.0e-2f);
		}
	}
#endif

	return dgVector (pitch, yaw, roll, hacd::HaF32(0.0f));
}
dgVector  dgPointToRayDistance (const dgVector& point, const dgVector& ray_p0, const dgVector& ray_p1)
{
	float t;
	dgVector dp (ray_p1 - ray_p0);
	t = ClampValue (((point - ray_p0) % dp) / (dp % dp), float(float (0.0f)), float(float (1.0f)));
	return ray_p0 + dp.Scale (t);
}
void NewtonUserJoint::SetLowerFriction (dgFloat32 friction)
{
	dgInt32 index; 
	index = m_rows - 1;
	if ((index >= 0) &&  (index < dgInt32 (m_maxDOF))) {
		m_param->m_forceBounds[index].m_low = ClampValue (friction, dgFloat32(DG_MIN_BOUND), dgFloat32(-0.001f));
		m_param->m_forceBounds[index].m_normalIndex = DG_BILATERAL_FRICTION_CONSTRAINT;
	}
}
void NewtonUserJoint::SetRowStiffness (dgFloat32 stiffness)
{
	dgInt32 index; 
	index = m_rows - 1;
	if ((index >= 0) &&  (index < dgInt32 (m_maxDOF))) {
		stiffness = ClampValue (stiffness, dgFloat32(0.0f), dgFloat32(1.0f));
		stiffness = 100.0f - stiffness * 99.0f; 
		m_param->m_jointStiffness[index] = stiffness;
	}
}
/* ------------------------------------------------------------------------------------ */
int CPersistentAttributes::Set(const char *szTag, int nValue)
{
	PersistAttribute *pAttr = Locate(szTag);

	if(pAttr == NULL)
		return RGF_NOT_FOUND;				// Not found

	pAttr->Value = nValue;					// Set it, and forget it

	ClampValue(pAttr);						// Clamp the values to limits

	return RGF_SUCCESS;
}
/* ------------------------------------------------------------------------------------ */
int CPersistentAttributes::ModifyIf(const char *szTag, int nHow, int nCompareValue, int nValue)
{
	PersistAttribute *pAttr = Locate(szTag);

	if(pAttr == NULL)
		return RGF_NOT_FOUND;			// No such attribute

	if(LocalCompare(pAttr, nHow, nCompareValue))
		pAttr->Value += nValue;

	ClampValue(pAttr);					// Clamp the values to limits

	return RGF_SUCCESS;
}
Example #18
0
/// ValueOfPixel() converts a y position on screen to an envelope value.
/// @param y - y position, usually of the mouse.relative to the clip.
/// @param height - height of the rectangle we are in.
/// @upper - true if we are on the upper line, false if on lower.
/// @dB - display mode either linear or log.
/// @zoomMin - vertical scale, typically -1.0
/// @zoomMax - vertical scale, typically +1.0
float Envelope::ValueOfPixel( int y, int height, bool upper, bool dB,
                              float zoomMin, float zoomMax)
{
   float v;

   wxASSERT( height > 0 );
   v = zoomMax - (y/(float)height) * (zoomMax - zoomMin);

   if (mContourOffset) {
     if( v > 0.0 )
       v += .5;
     else
       v -= .5;
   }
   if (dB)
      v = fromDB(v);

   // MB: this is mostly equivalent to what the old code did, I'm not sure
   // if anything special is needed for asymmetric ranges
   if(upper)
      return ClampValue(v);
   else
      return ClampValue(-v);
}
/* ------------------------------------------------------------------------------------ */
int CPersistentAttributes::Modify(const char *szTag, int nValue)
{
	PersistAttribute *pAttr = Locate(szTag);

	if(pAttr == NULL)
		return RGF_NOT_FOUND;			// No such attribute

	pAttr->Value += nValue;				// MAke the mod

// changed RF064
	pAttr->ModifyAmt = nValue;
// end change RF064

    ClampValue(pAttr);					// Clamp the values to limits

	return RGF_SUCCESS;
}
Example #20
0
/// Rescale function for time tracks (could also be used for other tracks though).
/// This is used to load old time track project files where the envelope used a 0 to 1
/// range instead of storing the actual time track values. This function will change the range of the envelope
/// and rescale all envelope points accordingly (unlike SetRange, which clamps the envelope points to the new range).
/// @minValue - the new minimum value
/// @maxValue - the new maximum value
void Envelope::Rescale(double minValue, double maxValue)
{
   double oldMinValue = mMinValue;
   double oldMaxValue = mMaxValue;
   mMinValue = minValue;
   mMaxValue = maxValue;

   // rescale the default value
   double factor = (mDefaultValue - oldMinValue) / (oldMaxValue - oldMinValue);
   mDefaultValue = ClampValue(mMinValue + (mMaxValue - mMinValue) * factor);

   // rescale all points
   for( unsigned int i = 0; i < mEnv.Count(); i++ ) {
      factor = (mEnv[i]->GetVal() - oldMinValue) / (oldMaxValue - oldMinValue);
      mEnv[i]->SetVal(mMinValue + (mMaxValue - mMinValue) * factor);
   }

}
Example #21
0
void ConVar::InternalSetFloatValue(float fNewValue)
{
    if(fNewValue == m_Value.m_fValue)
        return;

    ClampValue(fNewValue);

    // Redetermine value
    float flOldValue = m_Value.m_fValue;
    *(uint32_t*)&m_Value.m_fValue = *(uint32_t*)&fNewValue ^ (uint32_t)this;
    *(uint32_t*)&m_Value.m_nValue = (uint32_t)fNewValue ^ (uint32_t)this;

    if(!(m_nFlags & FCVAR_NEVER_AS_STRING)) {
        char tempVal[32];
        snprintf(tempVal, sizeof(tempVal), "%f", m_Value.m_fValue);
        ChangeStringValue(tempVal, flOldValue);
    } else {
        //assert(m_fnChangeCallbacks.Count() == 0);
    }
}
Example #22
0
//-----------------------------------------------------------------------------
// Purpose: 
// Input  : *value - 
//-----------------------------------------------------------------------------
void ConVar::InternalSetValue( const char *value )
{
	if ( IsFlagSet( FCVAR_MATERIAL_THREAD_MASK ) )
	{
		if ( g_pCVar && !g_pCVar->IsMaterialThreadSetAllowed() )
		{
			g_pCVar->QueueMaterialThreadSetValue( this, value );
			return;
		}
	}

	float fNewValue;
	char  tempVal[ 32 ];
	char  *val;

	Assert(m_pParent == this); // Only valid for root convars.

	float flOldValue = m_fValue;

	val = (char *)value;
	if ( !value )
		fNewValue = 0.0f;
	else
		fNewValue = ( float )atof( value );

	if ( ClampValue( fNewValue ) )
	{
		Q_snprintf( tempVal,sizeof(tempVal), "%f", fNewValue );
		val = tempVal;
	}

	// Redetermine value
	m_fValue		= fNewValue;
	m_nValue		= ( int )( fNewValue );

	if ( !( m_nFlags & FCVAR_NEVER_AS_STRING ) )
	{
		ChangeStringValue( val, flOldValue );
	}
}
Example #23
0
void ConVar::InternalSetIntValue(int nValue)
{
    if(nValue == ((int)m_Value.m_nValue ^ (int)this))
        return;

    float fValue = (float)nValue;
    if(ClampValue(fValue)) {
        nValue = (int)(fValue);
    }

    // Redetermine value
    float flOldValue = m_Value.m_fValue;
    *(uint32_t*)&m_Value.m_fValue = *(uint32_t*)&fValue ^ (uint32_t)this;
    *(uint32_t*)&m_Value.m_nValue = *(uint32_t*)&nValue ^ (uint32_t)this;

    if(!(m_nFlags & FCVAR_NEVER_AS_STRING)) {
        char tempVal[32];
        snprintf(tempVal, sizeof(tempVal), "%d", m_Value.m_nValue);
        ChangeStringValue(tempVal, flOldValue);
    } else {
        //assert(m_fnChangeCallbacks.Count() == 0);
    }
}
Example #24
0
FlexFloat::FlexFloat(float _base_value, float _max_base_value)
: base_value_(_base_value), max_base_value_(_max_base_value), use_max_base_value_(true)
{
	ClampValue();
}
Example #25
0
Bool LiquidToolData::MouseInput(BaseDocument* doc, BaseContainer& data, BaseDraw* bd, EditorWindow* win, const BaseContainer& msg)
{
	Float mx = msg.GetFloat(BFM_INPUT_X);
	Float my = msg.GetFloat(BFM_INPUT_Y);
	Int32 button;

	switch (msg.GetInt32(BFM_INPUT_CHANNEL))
	{
		case BFM_INPUT_MOUSELEFT: button	= KEY_MLEFT; break;
		case BFM_INPUT_MOUSERIGHT: button = KEY_MRIGHT; break;
		default: return true;
	}

	BaseObject* cl = nullptr, *null = nullptr, *op = nullptr;
	Float				dx, dy, rad = 5.0;
	Bool				newmeta = false;

	op = BaseObject::Alloc(Osphere);
	if (!op)
		return false;

	null = BaseObject::Alloc(Ometaball);
	{
		null->GetDataInstance()->SetFloat(METABALLOBJECT_SUBEDITOR, 10.0);
		null->MakeTag(Tphong);
	}
	newmeta = true;

	if (newmeta)
	{
		doc->InsertObject(null, nullptr, nullptr);
		doc->SetActiveObject(null);

		doc->AddUndo(UNDOTYPE_NEW, null);

		DrawViews(DRAWFLAGS_ONLY_ACTIVE_VIEW | DRAWFLAGS_NO_THREAD | DRAWFLAGS_NO_ANIMATION);
	}

	BaseContainer bc;
	BaseContainer device;
	win->MouseDragStart(button, mx, my, MOUSEDRAGFLAGS_DONTHIDEMOUSE | MOUSEDRAGFLAGS_NOMOVE);
	while (win->MouseDrag(&dx, &dy, &device) == MOUSEDRAGRESULT_CONTINUE)
	{
		bc = BaseContainer();
		win->BfGetInputEvent(BFM_INPUT_MOUSE, &bc);
		if (bc.GetInt32(BFM_INPUT_CHANNEL) == BFM_INPUT_MOUSEWHEEL)
		{
			rad += bc.GetFloat(BFM_INPUT_VALUE) / 120.0;
			rad	 = ClampValue(rad, (Float) 0.1, (Float) MAXRANGE);
			GePrint(String::FloatToString(rad));
		}

		if (dx == 0.0 && dy == 0.0)
			continue;

		mx += dx;
		my += dy;
		cl	= (BaseObject*)op->GetClone(COPYFLAGS_0, nullptr);
		if (!cl)
			break;

		cl->GetDataInstance()->SetFloat(PRIM_SPHERE_RAD, rad);

		cl->SetAbsPos(bd->SW(Vector(mx, my, 500.0)));
		cl->InsertUnder(null);
		DrawViews(DRAWFLAGS_ONLY_ACTIVE_VIEW | DRAWFLAGS_NO_THREAD | DRAWFLAGS_NO_ANIMATION);
	}

	if (win->MouseDragEnd() == MOUSEDRAGRESULT_ESCAPE)
	{
		doc->DoUndo(true);
	}

	BaseObject::Free(op);

	EventAdd();
	return true;
}
Example #26
0
//dgUnsigned32 dgWorld::GetPerfomanceTicks (dgInt32 thread, dgUnsigned32 entry) const
dgUnsigned32 dgWorld::GetPerfomanceTicks (dgUnsigned32 entry) const
{
	entry = ClampValue(dgUnsigned32 (entry), dgUnsigned32 (0), dgUnsigned32 (m_counterSize - 1));
	return m_perfomanceCounters[entry];

}
Example #27
0
/// Flatten removes all points from the envelope to
/// make it horizontal at a chosen y-value.
/// @value - the y-value for the flat envelope.
void Envelope::Flatten(double value)
{
   WX_CLEAR_ARRAY(mEnv);
   mDefaultValue = ClampValue(value);
}
void dgBilateralConstraint::SetStiffness(dgFloat32 stiffness)
{
	stiffness = ClampValue (stiffness, dgFloat32(0.0f), dgFloat32(1.0f));
	m_stiffness = DG_JOINT_STIFFNESS_RANGE - stiffness * (DG_JOINT_STIFFNESS_RANGE - dgFloat32 (1.0f)); 
}
Example #29
0
// Ensure CVars are within reasonable limits
void CClientVariables::ValidateValues ( void )
{
    uint uiViewportWidth = CCore::GetSingleton().GetGraphics ()->GetViewportWidth ();
    uint uiViewportHeight = CCore::GetSingleton().GetGraphics ()->GetViewportHeight ();

    ClampValue ( "console_pos",             CVector2D ( 0, 0 ),         CVector2D ( uiViewportWidth - 32, uiViewportHeight - 32 ) );
    ClampValue ( "console_size",            CVector2D ( 50, 50 ),       CVector2D ( uiViewportWidth - 32, uiViewportHeight - 32 ) );
    ClampValue ( "fps_limit",               0,                          100 );
    ClampValue ( "chat_font",               0,                          3 );
    ClampValue ( "chat_lines",              3,                          62 );
    ClampValue ( "chat_color",              CColor (0,0,0,0),           CColor (255,255,255,255) );
    ClampValue ( "chat_text_color",         CColor (0,0,0,128),         CColor (255,255,255,255) );
    ClampValue ( "chat_input_color",        CColor (0,0,0,0),           CColor (255,255,255,255) );
    ClampValue ( "chat_input_prefix_color", CColor (0,0,0,128),         CColor (255,255,255,255) );
    ClampValue ( "chat_input_text_color",   CColor (0,0,0,128),         CColor (255,255,255,255) );
    ClampValue ( "chat_scale",              CVector2D ( 0.5f, 0.5f ),   CVector2D ( 3, 3 ) );
    ClampValue ( "chat_width",              0.5f,                       4.f );
    ClampValue ( "chat_line_life",          1000,                       120000000 );
    ClampValue ( "chat_line_fade_out",      1000,                       30000000 );
    ClampValue ( "text_scale",              0.8f,                       3.0f );
    ClampValue ( "mtavolume",               0.0f,                       1.0f );
    ClampValue ( "voicevolume",             0.0f,                       1.0f );
    ClampValue ( "mapalpha",                0,                          255 );
}
void dgBilateralConstraint::CalculatePointDerivative (
	dgInt32 index,
	dgContraintDescritor& desc, 
	const dgVector& dir,	
	const dgPointParam& param,
	dgFloat32* jointForce)
{
	dgFloat32 relPosit;
	dgFloat32 relVeloc;
	dgFloat32 relCentr;
	dgFloat32 accelError;

	_ASSERTE (jointForce);
	_ASSERTE (m_body0);
	_ASSERTE (m_body1);

	dgJacobian &jacobian0 = desc.m_jacobian[index].m_jacobian_IM0; 
	dgVector r0CrossDir (param.m_r0 * dir);
	jacobian0.m_linear[0] = dir.m_x;
	jacobian0.m_linear[1] = dir.m_y;
	jacobian0.m_linear[2] = dir.m_z;
	jacobian0.m_linear[3] = dgFloat32 (0.0f);
	jacobian0.m_angular[0] = r0CrossDir.m_x;
	jacobian0.m_angular[1] = r0CrossDir.m_y;
	jacobian0.m_angular[2] = r0CrossDir.m_z;
	jacobian0.m_angular[3] = dgFloat32 (0.0f);

	dgJacobian &jacobian1 = desc.m_jacobian[index].m_jacobian_IM1; 
	dgVector r1CrossDir (dir * param.m_r1);
	jacobian1.m_linear[0] = -dir.m_x;
	jacobian1.m_linear[1] = -dir.m_y;
	jacobian1.m_linear[2] = -dir.m_z;
	jacobian1.m_linear[3] = dgFloat32 (0.0f);
	jacobian1.m_angular[0] = r1CrossDir.m_x;
	jacobian1.m_angular[1] = r1CrossDir.m_y;
	jacobian1.m_angular[2] = r1CrossDir.m_z;
	jacobian1.m_angular[3] = dgFloat32 (0.0f);

	dgVector velocError (param.m_veloc1 - param.m_veloc0);
	dgVector positError (param.m_posit1 - param.m_posit0);
	dgVector centrError (param.m_centripetal1 - param.m_centripetal0);

	relPosit = positError % dir;
	relVeloc = velocError % dir;
	relCentr = centrError % dir; 
	relCentr = ClampValue (relCentr, dgFloat32(-10000.0f), dgFloat32(10000.0f));
//relCentr = 0.0f;

	//at =  [- ks (x2 - x1) - kd * (v2 - v1) - dt * ks * (v2 - v1)] / [1 + dt * kd + dt * dt * ks] 
	dgFloat32 dt = desc.m_timestep;
	dgFloat32 ks = DG_POS_DAMP;
	dgFloat32 kd = DG_VEL_DAMP;
	dgFloat32 ksd = dt * ks;
	dgFloat32 num = ks * relPosit + kd * relVeloc + ksd * relVeloc;
	dgFloat32 den = dgFloat32 (1.0f) + dt * kd + dt * ksd;
	accelError = num / den;

	//_ASSERTE (dgAbsf (accelError - CalculateSpringDamperAcceleration (index, desc, 0.0f, param.m_posit0, param.m_posit1,	LINEAR_POS_DAMP, LINEAR_VEL_DAMP)) < 1.0e-2f);

	m_rowIsMotor[index] = 0;
	desc.m_isMotor[index] = 0;
	m_motorAcceleration[index] = dgFloat32 (0.0f);


//	dgJacobianPair m_jacobian[DG_CONSTRAINT_MAX_ROWS];
//	dgBilateralBounds m_forceBounds[DG_CONSTRAINT_MAX_ROWS];
//	dgFloat32 m_jointAccel[DG_CONSTRAINT_MAX_ROWS];
//	dgFloat32 m_jointStiffness[DG_CONSTRAINT_MAX_ROWS];
//	dgFloat32 m_restitution[DG_CONSTRAINT_MAX_ROWS];
//	dgFloat32 m_penetration[DG_CONSTRAINT_MAX_ROWS];
//	dgFloat32 m_penetrationStiffness[DG_CONSTRAINT_MAX_ROWS];

	desc.m_penetration[index] = relPosit;
	desc.m_penetrationStiffness[index] = dgFloat32 (0.01f/4.0f);
	desc.m_jointStiffness[index] = param.m_stiffness;
	desc.m_jointAccel[index] = accelError + relCentr;
	// save centripetal acceleration in the restitution member
	desc.m_restitution[index] = relCentr;
	desc.m_forceBounds[index].m_jointForce = jointForce;
}