#include "OgrePMEntryPointMapRenderingRun.h" #include "OgreIlluminationManager.h" OgrePMEntryPointMapRenderingRun::OgrePMEntryPointMapRenderingRun(String name) : OgreRenderingRun(1, 1) , RenderingRun(1, 1) { this->name = name; createEntryPointMap(); } void OgrePMEntryPointMapRenderingRun::createEntryPointMap() { unsigned int entryPointCnt = OgreIlluminationManager::getSingleton().getPathMapEntryPoints().size(); int width = entryPointCnt / 4096 * 2; int height = 4096; TexturePtr texPtr = Ogre::TextureManager::getSingleton().createManual(name, "default", TEX_TYPE_2D, width, height, 0, 0, PF_FLOAT32_RGBA, TU_DEFAULT); entryPointTexture = texPtr.getPointer(); struct TMR { float pos[4]; float dir[4]; }; TMR* tm = new TMR[entryPointCnt]; for(int i=0; iposition.x; tm[i].pos[1] = EP->position.y; tm[i].pos[2] = EP->position.z; tm[i].pos[3] = 1.0; tm[i].dir[0] = EP->normal.x; tm[i].dir[1] = EP->normal.y; tm[i].dir[2] = EP->normal.z; tm[i].dir[3] = EP->prob; } PixelBox lockBox(width, height, 1, PF_FLOAT32_RGBA, tm); entryPointTexture->getBuffer()->blitFromMemory(lockBox); delete[] tm; int clusterCount = OgreIlluminationManager::getSingleton().getPathMapClusterLengthsSize(); width = clusterCount; height = 2; texPtr = Ogre::TextureManager::getSingleton().createManual(name + "_CL", "default", TEX_TYPE_2D, width, height, 0, 0, PF_FLOAT32_R, TU_RENDERTARGET); clusterLengthTexture = texPtr.getPointer(); float* data = new float[clusterCount * 2]; unsigned int entryPointCount = 0; for(int i = 0; i < clusterCount; i++) { unsigned int clusterSize = OgreIlluminationManager::getSingleton().getPathMapClusterLength(i); data[i] = clusterSize;//clustercount data[clusterCount + i] = entryPointCount; entryPointCount += clusterSize; } PixelBox lockBox2(width, height, 1, PF_FLOAT32_R, data); clusterLengthTexture->getBuffer()->blitFromMemory(lockBox2); delete[] data; } void OgrePMEntryPointMapRenderingRun::updateFrame(unsigned long frameNum) { }