Subversion Repository Public Repository

Divide-Framework

This repository has no backups
This repository's network speed is throttled to 100KB/sec

Diff Revisions 272 vs 274 for /trunk/Source Code/Managers/LightManager.cpp

Diff revisions: vs.
  @@ -70,21 +70,17 @@
70 70 void LightManager::init(){
71 71 REGISTER_FRAME_LISTENER(&(this->getInstance()), 2);
72 72 GFX_DEVICE.add2DRenderFunction(DELEGATE_BIND(&LightManager::previewShadowMaps, this, nullptr), 1);
73 - _lightShaderBuffer[SHADER_BUFFER_VISUAL]->Create(true, false);
74 - _lightShaderBuffer[SHADER_BUFFER_VISUAL]->ReserveBuffer(Config::Lighting::MAX_LIGHTS_PER_SCENE, sizeof(LightVisualProperties));
75 - _lightShaderBuffer[SHADER_BUFFER_VISUAL]->bind(Divide::SHADER_BUFFER_LIGHT_COLOR);
76 -
77 - _lightShaderBuffer[SHADER_BUFFER_PHYSICAL]->Create(true, false);
78 - _lightShaderBuffer[SHADER_BUFFER_PHYSICAL]->ReserveBuffer(Config::Lighting::MAX_LIGHTS_PER_SCENE, sizeof(LightPhysicalProperties));
79 - _lightShaderBuffer[SHADER_BUFFER_PHYSICAL]->bind(Divide::SHADER_BUFFER_LIGHT_NORMAL);
80 -
81 - _lightShaderBuffer[SHADER_BUFFER_SHADOW]->Create(true, false);
82 - _lightShaderBuffer[SHADER_BUFFER_SHADOW]->ReserveBuffer(Config::Lighting::MAX_LIGHTS_PER_SCENE, sizeof(LightShadowProperties));
83 - _lightShaderBuffer[SHADER_BUFFER_SHADOW]->bind(Divide::SHADER_BUFFER_LIGHT_SHADOW);
84 -
85 - _lightShaderBuffer[SHADER_BUFFER_PER_NODE]->Create(true, true);
86 - _lightShaderBuffer[SHADER_BUFFER_PER_NODE]->ReserveBuffer(Config::Lighting::MAX_LIGHTS_PER_SCENE_NODE, sizeof(PerNodeLightData));
87 - _lightShaderBuffer[SHADER_BUFFER_PER_NODE]->bind(Divide::SHADER_BUFFER_LIGHT_PER_NODE);
73 + _lightShaderBuffer[SHADER_BUFFER_VISUAL]->Create(true, false, Config::Lighting::MAX_LIGHTS_PER_SCENE, sizeof(LightVisualProperties));
74 + _lightShaderBuffer[SHADER_BUFFER_VISUAL]->Bind(Divide::SHADER_BUFFER_LIGHT_COLOR);
75 +
76 + _lightShaderBuffer[SHADER_BUFFER_PHYSICAL]->Create(true, false, Config::Lighting::MAX_LIGHTS_PER_SCENE, sizeof(LightPhysicalProperties));
77 + _lightShaderBuffer[SHADER_BUFFER_PHYSICAL]->Bind(Divide::SHADER_BUFFER_LIGHT_NORMAL);
78 +
79 + _lightShaderBuffer[SHADER_BUFFER_SHADOW]->Create(true, false, Config::Lighting::MAX_LIGHTS_PER_SCENE, sizeof(LightShadowProperties));
80 + _lightShaderBuffer[SHADER_BUFFER_SHADOW]->Bind(Divide::SHADER_BUFFER_LIGHT_SHADOW);
81 +
82 + _lightShaderBuffer[SHADER_BUFFER_PER_NODE]->Create(true, true, Config::Lighting::MAX_LIGHTS_PER_SCENE_NODE, sizeof(PerNodeLightData));
83 + _lightShaderBuffer[SHADER_BUFFER_PER_NODE]->Bind(Divide::SHADER_BUFFER_LIGHT_PER_NODE);
88 84
89 85 perNodeLights.resize(Config::Lighting::MAX_LIGHTS_PER_SCENE_NODE);
90 86
  @@ -356,7 +352,7 @@
356 352 }
357 353 }
358 354
359 - _lightShaderBuffer[SHADER_BUFFER_PER_NODE]->ChangeSubData(0, perNodeLights.size() * sizeof(PerNodeLightData), &perNodeLights.front(), true);
355 + _lightShaderBuffer[SHADER_BUFFER_PER_NODE]->UpdateData(0, perNodeLights.size() * sizeof(PerNodeLightData), &perNodeLights.front(), true);
360 356
361 357 return (U8)maxLights;
362 358 }
  @@ -384,7 +380,7 @@
384 380 else if (light->getLightType() == LIGHT_TYPE_SPOT){
385 381 temp._direction.set(vec3<F32>(_viewMatrixCache * temp._direction), temp._direction.w);
386 382 }
387 - _lightShaderBuffer[SHADER_BUFFER_PHYSICAL]->ChangeSubData(light->getSlot() * sizeof(LightPhysicalProperties), sizeof(LightPhysicalProperties), (GLvoid*)&temp);
383 + _lightShaderBuffer[SHADER_BUFFER_PHYSICAL]->UpdateData(light->getSlot() * sizeof(LightPhysicalProperties), sizeof(LightPhysicalProperties), (GLvoid*)&temp);
388 384 light->_dirty[Light::PROPERTY_TYPE_PHYSICAL] = false;
389 385 }
390 386
  @@ -392,7 +388,7 @@
392 388 assert(light != nullptr);
393 389 if (!light->_dirty[Light::PROPERTY_TYPE_VISUAL])
394 390 return;
395 - _lightShaderBuffer[SHADER_BUFFER_VISUAL]->ChangeSubData(light->getSlot() * sizeof(LightVisualProperties), sizeof(LightVisualProperties), (void*)&light->getVisualProperties());
391 + _lightShaderBuffer[SHADER_BUFFER_VISUAL]->UpdateData(light->getSlot() * sizeof(LightVisualProperties), sizeof(LightVisualProperties), (void*)&light->getVisualProperties());
396 392 light->_dirty[Light::PROPERTY_TYPE_VISUAL] = false;
397 393
398 394 }
  @@ -401,6 +397,6 @@
401 397 assert(light != nullptr);
402 398 if (!light->_dirty[Light::PROPERTY_TYPE_SHADOW])
403 399 return;
404 - _lightShaderBuffer[SHADER_BUFFER_SHADOW]->ChangeSubData(light->getSlot() * sizeof(LightShadowProperties), sizeof(LightShadowProperties), (void*)&light->getShadowProperties());
400 + _lightShaderBuffer[SHADER_BUFFER_SHADOW]->UpdateData(light->getSlot() * sizeof(LightShadowProperties), sizeof(LightShadowProperties), (void*)&light->getShadowProperties());
405 401 light->_dirty[Light::PROPERTY_TYPE_SHADOW] = false;
406 402 }