Optimized ForwardRenderTechnique

Former-commit-id: a4e035c860ed2fcaeedadd5a41fb9f6251649000
This commit is contained in:
Lynix
2013-08-10 22:59:02 +02:00
parent 970cf1afc8
commit 241e8fe9d9
3 changed files with 42 additions and 41 deletions

View File

@@ -199,8 +199,9 @@ void NzForwardRenderTechnique::Draw(const NzScene* scene)
// Meshs statiques
for (auto& subMeshIt : staticContainer)
{
const NzSpheref& boundingSphere = subMeshIt.second.first;
const NzStaticMesh* mesh = subMeshIt.first;
std::vector<NzForwardRenderQueue::StaticData>& staticData = subMeshIt.second;
std::vector<NzForwardRenderQueue::StaticData>& staticData = subMeshIt.second.second;
if (!staticData.empty())
{
@@ -269,7 +270,7 @@ void NzForwardRenderTechnique::Draw(const NzScene* scene)
// Calcul des lumières les plus proches
if (lightCount < m_maxLightsPerObject && !m_renderQueue.lights.empty())
{
unsigned int count = lightManager.FindClosestLights(&m_renderQueue.lights[0], m_renderQueue.lights.size(), data.aabb.GetCenter(), data.aabb.GetSquaredRadius());
unsigned int count = lightManager.FindClosestLights(&m_renderQueue.lights[0], m_renderQueue.lights.size(), data.transformMatrix.GetTranslation() + boundingSphere.GetPosition(), boundingSphere.radius);
count -= lightCount;
for (unsigned int i = 0; i < count; ++i)
@@ -356,7 +357,7 @@ void NzForwardRenderTechnique::Draw(const NzScene* scene)
// Calcul des lumières les plus proches
if (lightCount < m_maxLightsPerObject && !m_renderQueue.lights.empty())
{
unsigned int count = lightManager.FindClosestLights(&m_renderQueue.lights[0], m_renderQueue.lights.size(), staticModel.aabb.GetCenter(), staticModel.aabb.GetSquaredRadius());
unsigned int count = lightManager.FindClosestLights(&m_renderQueue.lights[0], m_renderQueue.lights.size(), matrix.GetTranslation() + staticModel.boundingSphere.GetPosition(), staticModel.boundingSphere.radius);
count -= lightCount;
for (unsigned int i = 0; i < count; ++i)