Beispiel #1
0
/*
================
idLight::SetColor
================
*/
void idLight::SetColor( const idVec3 &color ) {
	baseColor = color;
	SetLightLevel();
}
Beispiel #2
0
/*
================
idLight::SetColor
================
*/
void idLight::SetColor( const idVec4 &color ) {
	baseColor = color.ToVec3();
	renderLight.shaderParms[ SHADERPARM_ALPHA ]		= color[ 3 ];
	renderEntity.shaderParms[ SHADERPARM_ALPHA ]	= color[ 3 ];
	SetLightLevel();
}
Beispiel #3
0
/*
================
idLight::SetColor
================
*/
void idLight::SetColor( float red, float green, float blue ) {
	baseColor.Set( red, green, blue );
	SetLightLevel();
}
Beispiel #4
0
/*
================
idLight::ReadFromSnapshot
================
*/
void idLight::ReadFromSnapshot( const idBitMsgDelta &msg )
{
    idVec4	shaderColor;
    int		oldCurrentLevel = currentLevel;
    idVec3	oldBaseColor = baseColor;

    GetPhysics()->ReadFromSnapshot( msg );
    ReadBindFromSnapshot( msg );

    currentLevel = msg.ReadByte();
    if ( currentLevel != oldCurrentLevel )
    {
        // need to call On/Off for flickering lights to start/stop the sound
        // while doing it this way rather than through events, the flickering is out of sync between clients
        // but at least there is no question about saving the event and having them happening globally in the world
        if ( currentLevel )
        {
            On();
        }
        else
        {
            Off();
        }
    }
    UnpackColor( msg.ReadInt(), baseColor );
    // lightParentEntityNum = msg.ReadBits( GENTITYNUM_BITS );

    /*	// only helps prediction
    	UnpackColor( msg.ReadInt(), fadeFrom );
    	UnpackColor( msg.ReadInt(), fadeTo );
    	fadeStart = msg.ReadInt();
    	fadeEnd = msg.ReadInt();
    */

    // FIXME: read renderLight.shader
    renderLight.lightRadius[0] = msg.ReadFloat( 5, 10 );
    renderLight.lightRadius[1] = msg.ReadFloat( 5, 10 );
    renderLight.lightRadius[2] = msg.ReadFloat( 5, 10 );

    UnpackColor( msg.ReadInt(), shaderColor );
    renderLight.shaderParms[SHADERPARM_RED] = shaderColor[0];
    renderLight.shaderParms[SHADERPARM_GREEN] = shaderColor[1];
    renderLight.shaderParms[SHADERPARM_BLUE] = shaderColor[2];
    renderLight.shaderParms[SHADERPARM_ALPHA] = shaderColor[3];

    renderLight.shaderParms[SHADERPARM_TIMESCALE] = msg.ReadFloat( 5, 10 );
    renderLight.shaderParms[SHADERPARM_TIMEOFFSET] = msg.ReadInt();
    //renderLight.shaderParms[SHADERPARM_DIVERSITY] = msg.ReadFloat();
    renderLight.shaderParms[SHADERPARM_MODE] = msg.ReadShort();

    ReadColorFromSnapshot( msg );

    if ( msg.HasChanged() )
    {
        if ( ( currentLevel != oldCurrentLevel ) || ( baseColor != oldBaseColor ) )
        {
            SetLightLevel();
        }
        else
        {
            PresentLightDefChange();
            PresentModelDefChange();
        }
    }
}