Liegt NICHT an der ITheme olol. Sondern CWorld. (CWorld::SetLight)
PHP Code:
void CWorld::SetLight( BOOL bLight )
{
#ifndef __WORLDSERVER
DWORD dwAmbient = D3DCOLOR_ARGB( 0,0,0,0);
CLight* pLight = NULL;
D3DXVECTOR3 vPos = ( CObj::GetActiveObj() != NULL ? CObj::GetActiveObj()->GetPos() : D3DXVECTOR3( 0, 0, 0 ) );
pLight = GetLight( "direction" );
#if __VER >= 15 // __BS_CHANGING_ENVIR
ENVIR_INFO* pInfo = GetInContinent( g_pPlayer->GetPos( ) );
if( pInfo && m_kCurContinent._bUseEnvir ) // ´ë·ú ¾ÈÀÌ°í ´ë·úÁ¤º¸¸¦ ÀÌ¿ëÇÒ °æ¿ì¸¸ !!
{
if( pLight )
{
pLight->Ambient.r = pInfo->_fAmbient[ 0 ];
pLight->Ambient.g = pInfo->_fAmbient[ 1 ];
pLight->Ambient.b = pInfo->_fAmbient[ 2 ];
pLight->Specular.r = 2.0f;
pLight->Specular.g = 2.0f;
pLight->Specular.b = 2.0f;
pLight->Diffuse.r = pInfo->_fDiffuse[ 0 ];
pLight->Diffuse.g = pInfo->_fDiffuse[ 1 ];
pLight->Diffuse.b = pInfo->_fDiffuse[ 2 ];
HookUpdateLight( pLight );
memcpy( &m_lightFogSky, pLight, sizeof( m_lightFogSky ) );
pLight->Diffuse.r *= 1.2f;
pLight->Diffuse.g *= 1.2f;
pLight->Diffuse.b *= 1.2f;
pLight->Ambient.r *= 0.8f;
pLight->Ambient.g *= 0.8f;
pLight->Ambient.b *= 0.8f;
memcpy( &m_light, pLight, sizeof( m_light ) );
D3DXVECTOR3 vecSun = D3DXVECTOR3( 0.0f, 0.5f,0.5f);
D3DXVec3Normalize(&(vecSun),&(vecSun));
pLight->SetDir( -vecSun.x, -vecSun.y, -vecSun.z );
pLight->Appear( m_pd3dDevice, TRUE );
DWORD dwR, dwG, dwB;
dwR = (DWORD)( pLight->Ambient.r * 255 );
dwG = (DWORD)( pLight->Ambient.g * 255 );
dwB = (DWORD)( pLight->Ambient.b * 255 );
dwAmbient = D3DCOLOR_ARGB( 255, dwR, dwG, dwB );
}
}
else
#endif
if( m_bIsIndoor )
{
if( pLight )
{
// À½¿µ º¯È*
pLight->Diffuse.r = ((m_dwDiffuse>>16) & 0xff) / 255.f;
pLight->Diffuse.g = ((m_dwDiffuse>>8) & 0xff) / 255.f;
pLight->Diffuse.b = ((m_dwDiffuse) & 0xff) / 255.f;
// º¯È* ¾øÀ½
pLight->Specular.r = 1.0f;
pLight->Specular.g = 1.0f;
pLight->Specular.b = 1.0f;
// Àüü º¯È*
pLight->Ambient.r = ((m_dwAmbient>>16) & 0xff) / 255.f;
pLight->Ambient.g = ((m_dwAmbient>>8) & 0xff) / 255.f;
pLight->Ambient.b = ((m_dwAmbient) & 0xff) / 255.f;
if( g_Option.m_nBloom ) // »Ç»þ½Ã ¿É¼ÇÀÌ ÄÑÁ®ÀÖÀ»¶© Á¶¸íÀ» Á» ³·ÃçÁà¾ß ÇÑ´Ù. ¾È±×·¯¸é ³Ê¹« ¹à¾Æ.
{
pLight->Diffuse.r *= 0.6f;
pLight->Diffuse.g *= 0.6f;
pLight->Diffuse.b *= 0.6f;
pLight->Ambient.r *= 0.7f;
pLight->Ambient.g *= 0.7f;
pLight->Ambient.b *= 0.7f;
}
#if __VER >= 15 // __BS_CHANGING_ENVIR
HookUpdateLight( pLight );
#endif
memcpy( &m_lightFogSky, pLight, sizeof( m_lightFogSky ) );
pLight->Diffuse.r += 0.1f;
pLight->Diffuse.g += 0.1f;
pLight->Diffuse.b += 0.1f;
// º¯È* ¾øÀ½
pLight->Specular.r = 2.0f;
pLight->Specular.g = 2.0f;
pLight->Specular.b = 2.0f;
// ÁÖº¯
pLight->Ambient.r *= 0.9f;
pLight->Ambient.g *= 0.9f;
pLight->Ambient.b *= 0.9f;
memcpy( &m_light, pLight, sizeof( m_light ) );
pLight->SetDir( m_v3LightDir.x, m_v3LightDir.y, m_v3LightDir.z );
pLight->Appear( m_pd3dDevice, TRUE );
DWORD dwR, dwG, dwB;
dwR = (DWORD)( pLight->Ambient.r * 255 );
dwG = (DWORD)( pLight->Ambient.g * 255 );
dwB = (DWORD)( pLight->Ambient.b * 255 );
dwAmbient = D3DCOLOR_ARGB( 255, dwR, dwG, dwB );
}
}
else
{
if( pLight )
{
int nHour = 8, nMin = 0;
#ifdef __CLIENT
// Ŭ¶óÀÌ¾ðÆ®´Â ½Ã°£À» g_GameTimer¿¡¼* °¡Á®¿Â´Ù.
nHour = g_GameTimer.m_nHour;
nMin = g_GameTimer.m_nMin ;
#else
// ºñ½ºÆ®´Â ½Ã°£À» m_nLightHour¿¡¼* °¡Á®¿Â´Ù.
if( m_nLightType == 1 )
nHour = m_nLightHour;
#endif
nHour--;
if( nHour < 0 ) nHour = 0;
if( nHour > 23 ) nHour = 23;
//if( m_bFixedHour )
// nHour = m_nFixedHour, nMin = 0;
LIGHTCOLOR lightColorPrv = m_k24Light[ ( nHour - 1 == -1 ) ? 23 : nHour - 1 ];
LIGHTCOLOR lightColor = m_k24Light[ nHour ];
//m_lightColor = lightColorPrv;
lightColorPrv.r1 += ( lightColor.r1 - lightColorPrv.r1) * nMin / 60;
lightColorPrv.g1 += ( lightColor.g1 - lightColorPrv.g1) * nMin / 60;
lightColorPrv.b1 += ( lightColor.b1 - lightColorPrv.b1) * nMin / 60;
lightColorPrv.r2 += ( lightColor.r2 - lightColorPrv.r2) * nMin / 60;
lightColorPrv.g2 += ( lightColor.g2 - lightColorPrv.g2) * nMin / 60;
lightColorPrv.b2 += ( lightColor.b2 - lightColorPrv.b2) * nMin / 60;
// 60(minMax) : 15(curMin) = 0.5(colorDistant) : x(curCol)
// À½¿µ º¯È*
pLight->Diffuse.r = lightColorPrv.r1;
pLight->Diffuse.g = lightColorPrv.g1;
pLight->Diffuse.b = lightColorPrv.b1;
// º¯È* ¾øÀ½
pLight->Specular.r = 1.0f;
pLight->Specular.g = 1.0f;
pLight->Specular.b = 1.0f;
// Àüü º¯È*
pLight->Ambient.r = lightColorPrv.r2;
pLight->Ambient.g = lightColorPrv.g2;
pLight->Ambient.b = lightColorPrv.b2;
if( g_Option.m_nBloom ) // »Ç»þ½Ã ¿É¼ÇÀÌ ÄÑÁ®ÀÖÀ»¶© Á¶¸íÀ» Á» ³·ÃçÁà¾ß ÇÑ´Ù. ¾È±×·¯¸é ³Ê¹« ¹à¾Æ.
{
pLight->Diffuse.r *= 0.6f;
pLight->Diffuse.g *= 0.6f;
pLight->Diffuse.b *= 0.6f;
pLight->Ambient.r *= 0.7f;
pLight->Ambient.g *= 0.7f;
pLight->Ambient.b *= 0.7f;
}
#if __VER >= 15 // __BS_CHANGING_ENVIR
HookUpdateLight( pLight );
#endif
memcpy( &m_lightFogSky, pLight, sizeof( m_lightFogSky ) );
#ifdef __YENV
pLight->Diffuse.r *= 1.1f;
pLight->Diffuse.g *= 1.1f;
pLight->Diffuse.b *= 1.1f;
// º¯È* ¾øÀ½
pLight->Specular.r = 2.0f;
pLight->Specular.g = 2.0f;
pLight->Specular.b = 2.0f;
// ÁÖº¯
pLight->Ambient.r *= 1.0f;
pLight->Ambient.g *= 1.0f;
pLight->Ambient.b *= 1.0f;
#else //__YENV
pLight->Diffuse.r *= 1.1f;
pLight->Diffuse.g *= 1.1f;
pLight->Diffuse.b *= 1.1f;
// º¯È* ¾øÀ½
pLight->Specular.r = 2.0f;
pLight->Specular.g = 2.0f;
pLight->Specular.b = 2.0f;
// ÁÖº¯
pLight->Ambient.r *= 0.9f;
pLight->Ambient.g *= 0.9f;
pLight->Ambient.b *= 0.9f;
#endif //__YENV
memcpy( &m_light, pLight, sizeof( m_light ) );
D3DXVECTOR3 vecSun=D3DXVECTOR3( 0.0f, 0.0f,1.0f);
D3DXMATRIX matTemp;
static const float CONS_VAL = 3.1415926f / 180.f;
D3DXMatrixRotationX( &matTemp,(m_skyBox.m_fSunAngle +180)*CONS_VAL);
D3DXVec3TransformCoord(&vecSun,&vecSun,&matTemp);
pLight->SetDir( vecSun.x, vecSun.y, vecSun.z );
pLight->Appear( m_pd3dDevice, TRUE );
// D3DXVECTOR3 vecSun = D3DXVECTOR3( 0.0f, 0.5f,0.5f);
// D3DXVec3Normalize(&(vecSun),&(vecSun));
// pLight->SetDir( -vecSun.x, -vecSun.y, -vecSun.z );
DWORD dwR, dwG, dwB;
dwR = (DWORD)( pLight->Ambient.r * 255 );
dwG = (DWORD)( pLight->Ambient.g * 255 );
dwB = (DWORD)( pLight->Ambient.b * 255 );
dwAmbient = D3DCOLOR_ARGB( 255, dwR, dwG, dwB );
}
}
m_pd3dDevice->SetRenderState( D3DRS_LIGHTING, bLight );//m_bViewLight );
m_pd3dDevice->SetRenderState( D3DRS_AMBIENT, dwAmbient );//D3DCOLOR_ARGB( 0,0,0,0) ); //m_dwAmbient );//D3DCOLOR_ARGB( 255,128,128,128) );//D3DCOLOR_ARGB( 255,50,50,70) );
::SetLight( bLight );
// ±âº» ÆÐÅ͸®¾ó Á¤ÀÇ
m_pd3dDevice->SetMaterial( &m_baseMaterial );
#endif // not WORLDSERVER
}