Subversion Repository Public Repository

Divide-Framework

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

Diff Revisions 263 vs 264 for /trunk/Source Code/Managers/ShaderManager.cpp

Diff revisions: vs.
  @@ -1,9 +1,12 @@
1 1 #include "Headers/ShaderManager.h"
2 +
3 + #include "Core/Headers/Kernel.h"
4 + #include "Core/Headers/ParamHandler.h"
2 5 #include "Core/Resources/Headers/ResourceCache.h"
3 6 #include "Hardware/Video/Shaders/Headers/Shader.h"
4 7 #include "Hardware/Video/Headers/GFXDevice.h"
5 8
6 - ShaderManager::ShaderManager() : _nullShader(nullptr), _init(false)
9 + ShaderManager::ShaderManager() : _nullShader(nullptr), _activeKernel(nullptr), _init(false)
7 10 {
8 11 }
9 12
  @@ -17,10 +20,11 @@
17 20 RemoveResource(_nullShader);
18 21 }
19 22
20 - bool ShaderManager::init(){
23 + bool ShaderManager::init(Kernel* const activeKernel){
21 24 if(_init){
22 25 ERROR_FN(Locale::get("WARNING_SHADER_MANAGER_DOUBLE_INIT"));
23 26 }
27 + _activeKernel = activeKernel;
24 28 _init = GFX_DEVICE.initShaders();
25 29 ResourceDescriptor immediateModeShader("ImmediateModeEmulation");
26 30 immediateModeShader.setThreadedLoading(false);
  @@ -55,12 +59,18 @@
55 59 }
56 60
57 61 U8 ShaderManager::idle(){
62 + ParamHandler& par = ParamHandler::getInstance();
63 + ShaderProgram::_cachedSceneZPlanes.set(par.getParam<F32>("rendering.zNear"), par.getParam<F32>("rendering.zFar"));
58 64 if(_recompileQueue.empty()) return 0;
59 65 _recompileQueue.top()->recompile(true,true,true,true,true);
60 66 _recompileQueue.pop();
61 67 return 1;
62 68 }
63 69
70 + void ShaderManager::updateCamera() {
71 + ShaderProgram::updateCamera(*(_activeKernel->getCameraMgr().getActiveCamera()));
72 + }
73 +
64 74 void ShaderManager::refresh(){
65 75 FOR_EACH(ShaderProgramMap::value_type& it, _shaderPrograms){
66 76 it.second->refresh();