1 | #include "OgreCubeMapRenderTechnique.h"
|
---|
2 | #include "OgreTechniqueGroup.h"
|
---|
3 | #include "OgreColorCubeMapRenderingRun.h"
|
---|
4 |
|
---|
5 | OgreCubeMapRenderTechnique::OgreCubeMapRenderTechnique(unsigned long startFrame,
|
---|
6 | unsigned long cubeMapUpdateInterval,
|
---|
7 | unsigned int cubeMapResolution,
|
---|
8 | unsigned char texID,
|
---|
9 | bool useDistCalc,
|
---|
10 | bool useFaceAngleCalc,
|
---|
11 | float distTolerance,
|
---|
12 | float angleTolerance,
|
---|
13 | bool updateAllFace,
|
---|
14 | Pass* pass,
|
---|
15 | OgreRenderable* parentRenderable,
|
---|
16 | OgreTechniqueGroup* parentTechniqueGroup)
|
---|
17 | :OgreRenderTechnique( pass, parentRenderable, parentTechniqueGroup),
|
---|
18 | CubeMapRenderTechnique(startFrame, cubeMapUpdateInterval, cubeMapResolution, useDistCalc, useFaceAngleCalc, distTolerance, angleTolerance, updateAllFace, parentRenderable, parentTechniqueGroup),
|
---|
19 | RenderTechnique(parentRenderable, parentTechniqueGroup)
|
---|
20 | {
|
---|
21 | this->texID = texID;
|
---|
22 |
|
---|
23 | if(sharedRuns->getRun(ILLUMRUN_COLOR_CUBEMAP) == 0)
|
---|
24 | sharedRuns->addRun(ILLUMRUN_COLOR_CUBEMAP, createColorCubeMapRun());
|
---|
25 |
|
---|
26 | colorCubeMapRunChanged(sharedRuns->getRun(ILLUMRUN_COLOR_CUBEMAP));
|
---|
27 | }
|
---|
28 |
|
---|
29 |
|
---|
30 | OgreCubeMapRenderTechnique::~OgreCubeMapRenderTechnique()
|
---|
31 | {
|
---|
32 |
|
---|
33 | }
|
---|
34 |
|
---|
35 | void OgreCubeMapRenderTechnique::update(unsigned long frameNum)
|
---|
36 | {
|
---|
37 | CubeMapRenderTechnique::update(frameNum);
|
---|
38 | /*
|
---|
39 | GpuProgramParametersSharedPtr fpParams = pass->getFragmentProgramParameters();
|
---|
40 | Vector3 center = ((OgreSharedRuns*) sharedRuns)->getRootPosition();
|
---|
41 | fpParams->setNamedConstant("lastCenter",center);
|
---|
42 | pass->setFragmentProgramParameters(fpParams); */
|
---|
43 |
|
---|
44 | }
|
---|
45 |
|
---|
46 | void OgreCubeMapRenderTechnique::colorCubeMapRunChanged(RenderingRun* run)
|
---|
47 | {
|
---|
48 | OgreColorCubeMapRenderingRun* cuberun =(OgreColorCubeMapRenderingRun*) (run->asOgreRenderingRun());
|
---|
49 | String cubemapname = cuberun->getColorCubeMapTextureName();
|
---|
50 |
|
---|
51 | pass->getTextureUnitState(texID)->setTextureName(cubemapname);
|
---|
52 | }
|
---|
53 |
|
---|
54 | RenderingRun* OgreCubeMapRenderTechnique::createColorCubeMapRun()
|
---|
55 | {
|
---|
56 | return new OgreColorCubeMapRenderingRun( (OgreSharedRuns*) parentTechniqueGroup->getSharedRuns(),
|
---|
57 | parentOgreRenderable->getName() + "_COLORCUBEMAP",
|
---|
58 | startFrame,
|
---|
59 | cubeMapUpdateInterval,
|
---|
60 | cubeMapResolution,
|
---|
61 | useDistCalc,
|
---|
62 | useFaceAngleCalc,
|
---|
63 | distTolerance,
|
---|
64 | angleTolerance,
|
---|
65 | updateAllFace);
|
---|
66 | }
|
---|
67 |
|
---|
68 |
|
---|