CXXFLAGS=-Wall -g
LDFLAGS=-lSDL -lSDL_image -lGL
OBJS=main.o util.o widgets.o effect.o effect_chain.o
-OBJS += lift_gamma_gain_effect.o gamma_expansion_effect.o gamma_compression_effect.o colorspace_conversion_effect.o saturation_effect.o vignette_effect.o mirror_effect.o blur_effect.o
+OBJS += lift_gamma_gain_effect.o gamma_expansion_effect.o gamma_compression_effect.o colorspace_conversion_effect.o saturation_effect.o vignette_effect.o mirror_effect.o blur_effect.o sandbox_effect.o
test: $(OBJS)
$(CXX) -o test $(OBJS) $(LDFLAGS)
#include "gamma_compression_effect.h"
#include "lift_gamma_gain_effect.h"
#include "colorspace_conversion_effect.h"
+#include "sandbox_effect.h"
#include "saturation_effect.h"
#include "mirror_effect.h"
#include "vignette_effect.h"
return new GammaCompressionEffect();
case EFFECT_COLOR_SPACE_CONVERSION:
return new ColorSpaceConversionEffect();
+ case EFFECT_SANDBOX:
+ return new SandboxEffect();
case EFFECT_LIFT_GAMMA_GAIN:
return new LiftGammaGainEffect();
case EFFECT_SATURATION:
EFFECT_GAMMA_EXPANSION = 0,
EFFECT_GAMMA_COMPRESSION,
EFFECT_COLOR_SPACE_CONVERSION,
+ EFFECT_SANDBOX,
// Color.
EFFECT_LIFT_GAMMA_GAIN,
Effect *saturation_effect = chain.add_effect(EFFECT_SATURATION);
Effect *blur_effect = chain.add_effect(EFFECT_BLUR);
Effect *vignette_effect = chain.add_effect(EFFECT_VIGNETTE);
+ //Effect *sandbox_effect = chain.add_effect(EFFECT_SANDBOX);
+ //sandbox_effect->set_float("parm", 42.0f);
//chain.add_effect(EFFECT_MIRROR);
chain.add_output(inout_format);
chain.finalize();
--- /dev/null
+#define GL_GLEXT_PROTOTYPES 1
+
+#include <math.h>
+#include <GL/gl.h>
+#include <GL/glext.h>
+#include <assert.h>
+
+#include "sandbox_effect.h"
+#include "util.h"
+
+SandboxEffect::SandboxEffect()
+ : parm(0.0f)
+{
+ register_float("parm", &parm);
+}
+
+std::string SandboxEffect::output_fragment_shader()
+{
+ return read_file("sandbox_effect.frag");
+}
+
+void SandboxEffect::set_uniforms(GLuint glsl_program_num, const std::string &prefix, unsigned *sampler_num)
+{
+ Effect::set_uniforms(glsl_program_num, prefix, sampler_num);
+
+ // Any OpenGL state you might want to set, goes here.
+}
--- /dev/null
+vec4 FUNCNAME(vec2 tc) {
+ // Your code goes here, obviously.
+ // You can use PREFIX(parm) to access the parameter you gave in.
+ return LAST_INPUT(tc);
+}
--- /dev/null
+#ifndef _SANDBOX_EFFECT_H
+#define _SANDBOX_EFFECT_H 1
+
+// This effect, by default, does nothing.
+//
+// But imagine all the cool things you can make it do! Thus, the SandboxEffect
+// is intended to be a sandbox for you to have a place to write your test or
+// throwaway code. When you're happy, you can do a bit of search and replace
+// to give it a proper name and its own place in the build system.
+
+#include "effect.h"
+
+class SandboxEffect : public Effect {
+public:
+ SandboxEffect();
+ std::string output_fragment_shader();
+
+ void set_uniforms(GLuint glsl_program_num, const std::string &prefix, unsigned *sampler_num);
+
+private:
+ float parm;
+};
+
+#endif // !defined(_SANDBOX_EFFECT_H)