source: GTP/branches/IllumWPdeliver2008dec/IlluminationWP/source/IllumModule/src/SharedRuns.cpp @ 3255

Revision 3255, 1.8 KB checked in by szirmay, 16 years ago (diff)
Line 
1#include "SharedRuns.h"
2#include "TechniqueGroup.h"
3
4SharedRuns::SharedRuns(void)
5{       
6        child1 = 0;
7        child2 = 0;
8        parent = 0;
9
10//      childTechniques = 0;
11}
12
13
14SharedRuns* SharedRuns::getRoot()
15{
16        if(parent != 0)return parent->getRoot();
17        return this;
18}
19
20SharedRuns* SharedRuns::getRoot(RenderingRunType runType)
21{
22        if(parent != 0)
23                if(parent->hasOwnRun(runType))
24                        return parent->getRoot(runType);
25       
26        if(hasOwnRun(runType))
27                return this;
28
29        return 0;
30}
31
32SharedRuns* SharedRuns::joinRuns(SharedRuns* otherRuns)
33{
34        SharedRuns* result = createInstance();
35        parent = result;
36        otherRuns->parent = result;
37        result->child1 = this;
38        result->child2 = otherRuns;
39
40        result->gatherRuns();
41        result->fireRunChanges();
42        result->updateBounds();
43
44        return result;
45}
46
47void SharedRuns::runChanged(RenderingRunType runType, RenderingRun* run)
48{
49        if(child1 != 0) child1->runChanged(runType, run);
50        if(child2 != 0) child2->runChanged(runType, run);
51        //if(childTechniques != 0) childTechniques->runChanged(runType, run);
52}
53
54void SharedRuns::runUpdated(RenderingRunType runType, RenderingRun* run)
55{
56        if(child1 != 0) child1->runUpdated(runType, run);
57        if(child2 != 0) child2->runUpdated(runType, run);
58        //if(childTechniques != 0) childTechniques->runUpdated(runType, run);
59}
60
61void SharedRuns::setVisible(bool visible)
62{
63        if(child1 != 0)
64        {
65                child1->setVisible(visible);
66                child2->setVisible(visible);
67                return;
68        }
69
70        setRenderablesVisible(visible);
71}
72
73void SharedRuns::hide()
74{
75        if(child1 != 0)
76        {
77                child1->hide();
78                child2->hide();
79                return;
80        }
81
82        hideRenderables();
83}
84
85void SharedRuns::restoreVisibility()
86{
87        if(child1 != 0)
88        {
89                child1->restoreVisibility();
90                child2->restoreVisibility();
91                return;
92        }
93
94        restoreRenderableVisibility();
95}
96
97
Note: See TracBrowser for help on using the repository browser.