1 | #include "OgreConvolvedCubeMapRenderTechnique.h"
|
---|
2 | #include "OgreTechniqueGroup.h"
|
---|
3 | #include "OgreReducedCubeMapRenderingRun.h"
|
---|
4 | #include "OgreColorCubeMapRenderingRun.h"
|
---|
5 |
|
---|
6 | OgreConvolvedCubeMapRenderTechnique::OgreConvolvedCubeMapRenderTechnique(unsigned long startFrame,
|
---|
7 | unsigned long cubeMapUpdateInterval,
|
---|
8 | unsigned int cubeMapResolution,
|
---|
9 | unsigned int reducedCubeMapResolution,
|
---|
10 | unsigned char reducedTexID,
|
---|
11 | bool useDistCalc,
|
---|
12 | bool useFaceAngleCalc,
|
---|
13 | float distTolerance,
|
---|
14 | float angleTolerance,
|
---|
15 | bool updateAllFace,
|
---|
16 | Pass* pass,
|
---|
17 | OgreRenderable* parentRenderable,
|
---|
18 | OgreTechniqueGroup* parentTechniqueGroup)
|
---|
19 | :OgreRenderTechnique( pass, parentRenderable, parentTechniqueGroup),
|
---|
20 | ConvolvedCubeMapRenderTechnique(startFrame, cubeMapUpdateInterval, cubeMapResolution, reducedCubeMapResolution, useDistCalc, useFaceAngleCalc, distTolerance, angleTolerance, updateAllFace, parentRenderable, parentTechniqueGroup),
|
---|
21 | RenderTechnique(parentRenderable, parentTechniqueGroup)
|
---|
22 | {
|
---|
23 | this->reducedTexID = reducedTexID;
|
---|
24 |
|
---|
25 | if(sharedRuns->getRun(ILLUMRUN_COLOR_CUBEMAP) == 0)
|
---|
26 | sharedRuns->addRun(ILLUMRUN_COLOR_CUBEMAP, createColorCubeMapRun());
|
---|
27 |
|
---|
28 | if(sharedRuns->getRun(ILLUMRUN_REDUCED_CUBEMAP) == 0)
|
---|
29 | sharedRuns->addRun(ILLUMRUN_REDUCED_CUBEMAP, createReducedCubeMapRun());
|
---|
30 |
|
---|
31 | colorCubeMapRunChanged(sharedRuns->getRun(ILLUMRUN_COLOR_CUBEMAP));
|
---|
32 | reducedCubeMapRunChanged(sharedRuns->getRun(ILLUMRUN_REDUCED_CUBEMAP));
|
---|
33 | }
|
---|
34 |
|
---|
35 |
|
---|
36 | OgreConvolvedCubeMapRenderTechnique::~OgreConvolvedCubeMapRenderTechnique()
|
---|
37 | {
|
---|
38 |
|
---|
39 | }
|
---|
40 |
|
---|
41 | void OgreConvolvedCubeMapRenderTechnique::update(unsigned long frameNum)
|
---|
42 | {
|
---|
43 | ConvolvedCubeMapRenderTechnique::update(frameNum);
|
---|
44 | }
|
---|
45 |
|
---|
46 | void OgreConvolvedCubeMapRenderTechnique::reducedCubeMapRunChanged(RenderingRun* run)
|
---|
47 | {
|
---|
48 | OgreReducedCubeMapRenderingRun* cuberun =(OgreReducedCubeMapRenderingRun*) (run->asOgreRenderingRun());
|
---|
49 | String cubemapname = cuberun->getReducedCubeMapTextureName();
|
---|
50 |
|
---|
51 | pass->getTextureUnitState(reducedTexID)->setTextureName(cubemapname);
|
---|
52 | }
|
---|
53 |
|
---|
54 | void OgreConvolvedCubeMapRenderTechnique::colorCubeMapRunChanged(RenderingRun* run)
|
---|
55 | {
|
---|
56 |
|
---|
57 | OgreColorCubeMapRenderingRun* cuberun =(OgreColorCubeMapRenderingRun*) (run->asOgreRenderingRun());
|
---|
58 | String cubemapname = cuberun->getColorCubeMapTextureName();
|
---|
59 |
|
---|
60 | OgreReducedCubeMapRenderingRun* rr = (OgreReducedCubeMapRenderingRun*) sharedRuns->getRun(ILLUMRUN_REDUCED_CUBEMAP)->asOgreRenderingRun();
|
---|
61 | rr->colorCubeMapChanged(cubemapname);
|
---|
62 |
|
---|
63 | }
|
---|
64 |
|
---|
65 | RenderingRun* OgreConvolvedCubeMapRenderTechnique::createColorCubeMapRun()
|
---|
66 | {
|
---|
67 | return new OgreColorCubeMapRenderingRun( (OgreSharedRuns*) parentTechniqueGroup->getSharedRuns(),
|
---|
68 | parentOgreRenderable->getName() + "_COLORCUBEMAP",
|
---|
69 | startFrame,
|
---|
70 | cubeMapUpdateInterval,
|
---|
71 | cubeMapResolution,
|
---|
72 | useDistCalc,
|
---|
73 | useFaceAngleCalc,
|
---|
74 | distTolerance,
|
---|
75 | angleTolerance,
|
---|
76 | updateAllFace);
|
---|
77 | }
|
---|
78 |
|
---|
79 | RenderingRun* OgreConvolvedCubeMapRenderTechnique::createReducedCubeMapRun()
|
---|
80 | {
|
---|
81 | return new OgreReducedCubeMapRenderingRun( (OgreSharedRuns*) parentTechniqueGroup->getSharedRuns(),
|
---|
82 | parentOgreRenderable->getName() + "_COLORCUBEMAP_REDUCED",
|
---|
83 | startFrame,
|
---|
84 | cubeMapUpdateInterval,
|
---|
85 | reducedCubeMapResolution,
|
---|
86 | useDistCalc,
|
---|
87 | useFaceAngleCalc,
|
---|
88 | distTolerance,
|
---|
89 | angleTolerance,
|
---|
90 | updateAllFace);
|
---|
91 | }
|
---|
92 |
|
---|
93 |
|
---|