Subversion Repository Public Repository

Divide-Framework

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

Diff Revisions 239 vs 246 for /trunk/Source Code/Managers/RenderPassManager.cpp

Diff revisions: vs.
  @@ -3,64 +3,74 @@
3 3 #include "Rendering/RenderPass/Headers/RenderQueue.h"
4 4
5 5 struct RenderPassCallOrder{
6 - bool operator()(const RenderPassItem& a, const RenderPassItem& b) const {
7 - return a._sortKey < b._sortKey;
8 - }
6 + bool operator()(const RenderPassItem& a, const RenderPassItem& b) const {
7 + return a._sortKey < b._sortKey;
8 + }
9 9 };
10 10
11 - RenderPassManager::RenderPassManager()
11 + RenderPassManager::RenderPassManager() : _renderPassesLocked(true)
12 12 {
13 - RenderQueue::createInstance();
13 + RenderQueue::createInstance();
14 14 }
15 15
16 16 RenderPassManager::~RenderPassManager()
17 17 {
18 - for_each(RenderPassItem& rpi, _renderPasses){
19 - SAFE_DELETE(rpi._rp);
20 - }
21 - _renderPasses.clear();
22 - RenderQueue::destroyInstance();
18 + for_each(RenderPassItem& rpi, _renderPasses){
19 + SAFE_DELETE(rpi._rp);
20 + }
21 + _renderPasses.clear();
22 + RenderQueue::destroyInstance();
23 + }
24 +
25 + void RenderPassManager::lock() {
26 + _renderPassesLocked = true;
27 + RenderQueue::getInstance().lock();
28 + }
29 +
30 + void RenderPassManager::unlock() {
31 + _renderPassesLocked = false;
32 + RenderQueue::getInstance().unlock();
23 33 }
24 34
25 35 void RenderPassManager::render(const SceneRenderState& sceneRenderState, SceneGraph* activeSceneGraph) {
26 - for_each(RenderPassItem& rpi, _renderPasses){
27 - rpi._rp->render(sceneRenderState, activeSceneGraph);
28 - }
36 + for_each(RenderPassItem& rpi, _renderPasses){
37 + rpi._rp->render(sceneRenderState, activeSceneGraph);
38 + }
29 39 }
30 40
31 41 void RenderPassManager::addRenderPass(RenderPass* const renderPass, U8 orderKey) {
32 - assert(renderPass != NULL);
33 - _renderPasses.push_back(RenderPassItem(orderKey,renderPass));
34 - std::sort(_renderPasses.begin(), _renderPasses.end(), RenderPassCallOrder());
42 + assert(renderPass != NULL);
43 + _renderPasses.push_back(RenderPassItem(orderKey,renderPass));
44 + std::sort(_renderPasses.begin(), _renderPasses.end(), RenderPassCallOrder());
35 45 }
36 46
37 47 void RenderPassManager::removeRenderPass(RenderPass* const renderPass,bool deleteRP) {
38 - for(vectorImpl<RenderPassItem >::iterator it = _renderPasses.begin(); it != _renderPasses.end(); it++){
39 - if(it->_rp->getName().compare(renderPass->getName()) == 0){
40 - if(deleteRP){
41 - SAFE_DELETE(it->_rp);
42 - }
43 - _renderPasses.erase(it);
44 - break;
45 - }
46 - }
48 + for(vectorImpl<RenderPassItem >::iterator it = _renderPasses.begin(); it != _renderPasses.end(); it++){
49 + if(it->_rp->getName().compare(renderPass->getName()) == 0){
50 + if(deleteRP){
51 + SAFE_DELETE(it->_rp);
52 + }
53 + _renderPasses.erase(it);
54 + break;
55 + }
56 + }
47 57 }
48 58
49 59 void RenderPassManager::removeRenderPass(const std::string& name,bool deleteRP) {
50 - for(vectorImpl<RenderPassItem >::iterator it = _renderPasses.begin(); it != _renderPasses.end(); it++){
51 - if(it->_rp->getName().compare(name) == 0){
52 - if(deleteRP){
53 - SAFE_DELETE(it->_rp);
54 - }
55 - _renderPasses.erase(it);
56 - break;
57 - }
58 - }
60 + for(vectorImpl<RenderPassItem >::iterator it = _renderPasses.begin(); it != _renderPasses.end(); it++){
61 + if(it->_rp->getName().compare(name) == 0){
62 + if(deleteRP){
63 + SAFE_DELETE(it->_rp);
64 + }
65 + _renderPasses.erase(it);
66 + break;
67 + }
68 + }
59 69 }
60 70
61 71 U16 RenderPassManager::getLastTotalBinSize(U8 renderPassId) const {
62 - if(renderPassId < _renderPasses.size()){
63 - return _renderPasses[renderPassId]._rp->getLasTotalBinSize();
64 - }
65 - return 0;
72 + if(renderPassId < _renderPasses.size()){
73 + return _renderPasses[renderPassId]._rp->getLasTotalBinSize();
74 + }
75 + return 0;
66 76 }