mirror of
https://github.com/projectM-visualizer/projectm.git
synced 2026-02-12 21:35:36 +00:00
git-svn-id: https://projectm.svn.sourceforge.net/svnroot/projectm/trunk@1233 6778bc44-b910-0410-a7a0-be141de4315d
60 lines
1.5 KiB
C++
60 lines
1.5 KiB
C++
#include "PresetMerge.hpp"
|
|
#include "RenderItemMatcher.hpp"
|
|
#include "RenderItemMergeFunction.hpp"
|
|
|
|
void PipelineMerger::MergePipelines(const Pipeline & a, const Pipeline & b, Pipeline & out, const RenderItemMatchList & matching, RenderItemMergeFunction & mergeFunction, float ratio)
|
|
{
|
|
|
|
double invratio = 1.0 - ratio;
|
|
|
|
out.textureWrap = (ratio < 0.5) ? a.textureWrap : b.textureWrap;
|
|
|
|
out.screenDecay = lerp( b.screenDecay, a.screenDecay, ratio);
|
|
out.drawables.clear();
|
|
|
|
for (RenderItemMatchList::const_iterator pos = matching.begin(); pos != matching.end(); ++pos) {
|
|
|
|
|
|
const RenderItem * itemA = pos->first;
|
|
const RenderItem * itemB = pos->second;
|
|
|
|
//mergeFunction(itemA, itemB, out, ratio);
|
|
}
|
|
|
|
for (std::vector<RenderItem*>::const_iterator pos = a.drawables.begin();
|
|
pos != a.drawables.end(); ++pos)
|
|
{
|
|
(*pos)->masterAlpha = invratio;
|
|
out.drawables.push_back(*pos);
|
|
}
|
|
|
|
for (std::vector<RenderItem*>::const_iterator pos = b.drawables.begin();
|
|
pos != b.drawables.end(); ++pos)
|
|
{
|
|
(*pos)->masterAlpha = ratio;
|
|
out.drawables.push_back(*pos);
|
|
}
|
|
|
|
if (a.staticPerPixel && b.staticPerPixel)
|
|
{
|
|
out.staticPerPixel = true;
|
|
for (int x=0;x<a.gx;x++)
|
|
{
|
|
for(int y=0;y<a.gy;y++)
|
|
{
|
|
out.x_mesh[x][y] = a.x_mesh[x][y]* invratio + b.x_mesh[x][y]*ratio;
|
|
}
|
|
}
|
|
for (int x=0;x<a.gx;x++)
|
|
{
|
|
for(int y=0;y<a.gy;y++)
|
|
{
|
|
out.y_mesh[x][y] = a.y_mesh[x][y]* invratio + b.y_mesh[x][y]*ratio;
|
|
}
|
|
}
|
|
}
|
|
|
|
out.compositeShader = a.compositeShader;
|
|
out.warpShader = a.warpShader;
|
|
}
|