LightBlock LightEnv::GetLightBlock( const glm::mat4 &worldToCamera ) const { LightBlock lightData; lightData.ambientIntensity = m_ambientInterpolator.Interpolate(m_sunTimer.GetAlpha()); lightData.lightAttenuation = m_fLightAttenuation; lightData.maxIntensity = m_maxIntensityInterpolator.Interpolate(m_sunTimer.GetAlpha()); lightData.lights[0].cameraSpaceLightPos = worldToCamera * GetSunlightDirection(); lightData.lights[0].lightIntensity = m_sunlightInterpolator.Interpolate(m_sunTimer.GetAlpha()); for(size_t light = 0; light < m_lightPos.size(); light++) { glm::vec4 worldLightPos = glm::vec4(GetPointLightWorldPos(light), 1.0f); glm::vec4 lightPosCameraSpace = worldToCamera * worldLightPos; lightData.lights[light + 1].cameraSpaceLightPos = lightPosCameraSpace; lightData.lights[light + 1].lightIntensity = m_lightIntensity[light]; } return lightData; }
LightBlock LightManager::GetLightInformation( const glm::mat4 &worldToCameraMat ) const { LightBlock lightData; lightData.ambientIntensity = m_ambientInterpolator.Interpolate(m_sunTimer.GetAlpha()); lightData.lightAttenuation = g_fLightAttenuation; lightData.lights[0].cameraSpaceLightPos = worldToCameraMat * GetSunlightDirection(); lightData.lights[0].lightIntensity = m_sunlightInterpolator.Interpolate(m_sunTimer.GetAlpha()); for(int light = 0; light < NUMBER_OF_POINT_LIGHTS; light++) { glm::vec4 worldLightPos = glm::vec4(m_lightPos[light].Interpolate(m_lightTimers[light].GetAlpha()), 1.0f); glm::vec4 lightPosCameraSpace = worldToCameraMat * worldLightPos; lightData.lights[light + 1].cameraSpaceLightPos = lightPosCameraSpace; lightData.lights[light + 1].lightIntensity = m_lightIntensity[light]; } return lightData; }