// ----------------------------------------------------------------------- // // // ROUTINE: LightFX::Update // // PURPOSE: // // ----------------------------------------------------------------------- // DBOOL LightFX::Update() { CServerDE* pServerDE = GetServerDE(); if (!pServerDE) return DFALSE; pServerDE->SetNextUpdate(m_hObject, UPDATE_DELTA); //if (m_bOn) //{ if (m_nNumColorCycles != 0) { UpdateLightColor(); } if (m_nNumIntensityCycles != 0) { UpdateLightIntensity(); } if (m_nNumRadiusCycles != 0) { UpdateLightRadius(); } //} //else //{ // Its NOT turned on, so reset the start time // So if there is a duration, then it will start timing when the switch is turned on // m_fStartTime = pServerDE->GetTime(); // m_fRadius = 0.0f; // Effectively turn light off // return DTRUE; //} // See if we should remove the light... DBOOL bRemove = DFALSE; if (m_fLifeTime > 0 && (pServerDE->GetTime() - m_fStartTime) >= m_fLifeTime) { bRemove = DTRUE; } return (!bRemove); }
void WorldObjectWidget::UpdateLightType(void) { if (selection_type == 3) { WorldLight::Type type = (WorldLight::Type)ui->lightTypesList->currentIndex(); WorldLight* light = selection.light; if (type != light->type) { cout << "Updating light type" << endl; std::string name = light->name; light->Destroy(); light->type = type; light->Initialize(); UpdateLightColor(); UpdateLightAttenuation(); InitializeLightAttenuation(light); InitializeShadowCaster(light); } else cout << "Light type is already " << (int)type << endl; } }
void Shader::UpdateLight(Light* light){ UpdateLightPosition(light->GetPosition()); UpdateLightColor(light->GetColor()); }