source: GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/src/RenderingRuns/OgrePMEntryPointMapRenderingRun.cpp @ 2189

Revision 2189, 1.5 KB checked in by szirmay, 17 years ago (diff)
Line 
1#include "OgrePMEntryPointMapRenderingRun.h"
2#include "OgreIlluminationManager.h"
3
4OgrePMEntryPointMapRenderingRun::OgrePMEntryPointMapRenderingRun(String name)
5                                                                                                                   : OgreRenderingRun(1, 1)
6                                                                                                                   , RenderingRun(1, 1)
7{
8        this->name = name;
9       
10        createEntryPointMap(); 
11}
12
13void OgrePMEntryPointMapRenderingRun::createEntryPointMap()
14{
15        unsigned int entryPointCnt = OgreIlluminationManager::getSingleton().getPathMapEntryPoints().size();
16        int width = entryPointCnt / 4096 * 2;
17        int height = 4096;
18        TexturePtr texPtr = Ogre::TextureManager::getSingleton().createManual(name,
19                                                                                                                                                "default",
20                                                                                                                                                TEX_TYPE_2D,
21                                                                                                                                                width,
22                                                                                                                                                height,
23                                                                                                                                                0,
24                                                                                                                                                0,
25                                                                                                                                                PF_FLOAT32_RGBA,
26                                                                                                                                                TU_DEFAULT);
27        entryPointTexture = texPtr.getPointer();
28       
29        struct TMR
30        {
31                float pos[4];
32                float dir[4];
33        };
34        TMR* tm = new TMR[entryPointCnt];
35        for(int i=0; i<entryPointCnt; i++)
36        {
37                PathMapEntryPoint* EP = &OgreIlluminationManager::getSingleton().getPathMapEntryPoints().at(i);
38                tm[i].pos[0] = EP->position.x;
39                tm[i].pos[1] = EP->position.y;
40                tm[i].pos[2] = EP->position.z;
41                tm[i].pos[3] = 1.0;
42                tm[i].dir[0] = EP->normal.x;
43                tm[i].dir[1] = EP->normal.y;
44                tm[i].dir[2] = EP->normal.z;
45                tm[i].dir[3] = 1.0;
46        }       
47
48        PixelBox lockBox(width, height, 1, PF_FLOAT32_RGBA, tm);
49        entryPointTexture->getBuffer()->blitFromMemory(lockBox);
50}
51
52void OgrePMEntryPointMapRenderingRun::updateFrame(unsigned long frameNum)
53{       
54       
55}
56
57
Note: See TracBrowser for help on using the repository browser.