Skip to content

Commit

Permalink
added new plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
lostjared committed Aug 19, 2016
1 parent 7f5b1f5 commit 920e55c
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Plugins/Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
CXXFLAGS=-O3

all: plug-debug plugin-blend.dylib plugin-selfalpha.dylib plugin-randcolor.dylib plugin-selfalpha-reblend.dylib
all: plug-debug plugin-blend.dylib plugin-selfalpha.dylib plugin-randcolor.dylib plugin-selfalpha-reblend.dylib temp-plugin.dylib

plug-debug: loadplugin.cpp
$(CXX) $(CXXFLAGS) loadplugin.cpp -o plug-debug

temp-plugin.dylib: temp-plugin.cpp
$(CXX) $(CXXFLAGS) -shared temp-plugin.cpp -o temp-plugin.dylib
plugin.dylib: plugin.cpp
$(CXX) $(CXXFLAGS) -shared plugin.cpp -o plugin.dylib
plugin-blend.dylib: plugin-blend.cpp
Expand Down
26 changes: 26 additions & 0 deletions Plugins/temp-plugin.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#include<cmath>

extern "C" void pixel(int x, int y, unsigned char *pix);
extern "C" void drawn();

static double scale_r = 1.0, scale_g = 10.0, scale_b = 1.0;

// pixel operation here, called once for every pixel each frame
void pixel(int x, int y, unsigned char *pix) {
pix[0] *= scale_r;
pix[1] *= scale_g;
pix[2] *= scale_b;
}
// called when frame is done drawing
void drawn() {

scale_r += 0.01f;
scale_g -= 0.01f;
scale_b += 0.05f;

if(scale_r >= 10) scale_r = 1.0;
if(scale_g <= 1) scale_g = 10.0;
if(scale_b >= 5) scale_b = 1.0;

}

Binary file added Plugins/temp-plugin.dylib
Binary file not shown.

0 comments on commit 920e55c

Please sign in to comment.