aboutsummaryrefslogtreecommitdiff
path: root/externals/gridflow/bundled/Base
diff options
context:
space:
mode:
Diffstat (limited to 'externals/gridflow/bundled/Base')
-rw-r--r--externals/gridflow/bundled/Base/CPPExtern.h521
-rw-r--r--externals/gridflow/bundled/Base/GemBase.h133
-rw-r--r--externals/gridflow/bundled/Base/GemCache.h69
-rw-r--r--externals/gridflow/bundled/Base/GemEvent.h156
-rw-r--r--externals/gridflow/bundled/Base/GemExportDef.h40
-rw-r--r--externals/gridflow/bundled/Base/GemFuncUtil.h362
-rw-r--r--externals/gridflow/bundled/Base/GemGL.h72
-rw-r--r--externals/gridflow/bundled/Base/GemGLUtil.h29
-rw-r--r--externals/gridflow/bundled/Base/GemGluObj.h96
-rw-r--r--externals/gridflow/bundled/Base/GemLoadObj.h28
-rw-r--r--externals/gridflow/bundled/Base/GemMan.h257
-rw-r--r--externals/gridflow/bundled/Base/GemMath.h89
-rw-r--r--externals/gridflow/bundled/Base/GemModelData.h42
-rw-r--r--externals/gridflow/bundled/Base/GemPBuffer.h51
-rw-r--r--externals/gridflow/bundled/Base/GemPathBase.h74
-rw-r--r--externals/gridflow/bundled/Base/GemPixConvert.h160
-rw-r--r--externals/gridflow/bundled/Base/GemPixDualObj.h190
-rw-r--r--externals/gridflow/bundled/Base/GemPixImageLoad.h37
-rw-r--r--externals/gridflow/bundled/Base/GemPixImageSave.h38
-rw-r--r--externals/gridflow/bundled/Base/GemPixObj.h142
-rw-r--r--externals/gridflow/bundled/Base/GemPixPete.h219
-rw-r--r--externals/gridflow/bundled/Base/GemPixUtil.h284
-rw-r--r--externals/gridflow/bundled/Base/GemSIMD.h111
-rw-r--r--externals/gridflow/bundled/Base/GemShape.h115
-rw-r--r--externals/gridflow/bundled/Base/GemState.h150
-rw-r--r--externals/gridflow/bundled/Base/GemVector.h77
-rw-r--r--externals/gridflow/bundled/Base/GemVersion.h30
-rw-r--r--externals/gridflow/bundled/Base/GemVertex.h37
-rw-r--r--externals/gridflow/bundled/Base/GemWinCreate.h224
-rw-r--r--externals/gridflow/bundled/Base/config.h65
-rw-r--r--externals/gridflow/bundled/Base/configLinux.h40
31 files changed, 3938 insertions, 0 deletions
diff --git a/externals/gridflow/bundled/Base/CPPExtern.h b/externals/gridflow/bundled/Base/CPPExtern.h
new file mode 100644
index 00000000..7f0630dd
--- /dev/null
+++ b/externals/gridflow/bundled/Base/CPPExtern.h
@@ -0,0 +1,521 @@
+/*-----------------------------------------------------------------
+LOG
+ GEM - Graphics Environment for Multimedia
+
+ The base class for all externs written in C++
+
+ Copyright (c) 1997-1999 Mark Danks. mark@danks.org
+ For information on usage and redistribution, and for a DISCLAIMER OF ALL
+ WARRANTIES, see the file, "GEM.LICENSE.TERMS" in this distribution.
+
+-----------------------------------------------------------------*/
+
+#ifndef INCLUDE_CPPEXTERN_H_
+#define INCLUDE_CPPEXTERN_H_
+
+//#include "Base/config.h"
+#include "Base/GemExportDef.h"
+
+#include "m_pd.h"
+//#include "Base/GemVersion.h"
+
+#include <new>
+
+
+/*-----------------------------------------------------------------
+-------------------------------------------------------------------
+CLASS
+ GemException
+
+ an exception class...
+
+DESCRIPTION
+
+ this is a class, we can throw on creation,
+ to make sure that the pd-object can not be created
+
+
+
+-----------------------------------------------------------------*/
+class GEM_EXTERN GemException
+{
+ public:
+ GemException() throw();
+ GemException(const char*error) throw();
+ virtual ~GemException() throw();
+
+ virtual const char *what() const throw();
+ virtual void report() const throw();
+ private:
+ const char*ErrorString;
+};
+
+class CPPExtern;
+
+/*-----------------------------------------------------------------
+-------------------------------------------------------------------
+CLASS
+ Obj_header
+
+ The obligatory object header
+
+DESCRIPTION
+
+ This is in a separate struct to assure that when PD uses the
+ class, the t_object is the very first thing. If it were the
+ first thing in CPPExtern, then there could be problems with
+ the vtable.
+
+-----------------------------------------------------------------*/
+struct GEM_EXTERN Obj_header
+{
+ //////////
+ // The obligatory object header
+ t_object pd_obj;
+
+ //////////
+ // Our data structure
+ CPPExtern *data;
+};
+
+/*-----------------------------------------------------------------
+-------------------------------------------------------------------
+CLASS
+ CPPExtern
+
+ The base class for all externs written in C++
+
+DESCRIPTION
+
+ Each extern which is written in C++ needs to use the #defines at the
+ end of this header file. Currently, the operator new(size_t) and
+ operator delete(void *) are not overridden. This will be a problem
+ when PD expects everything to fit in its memory space and control
+ all memory allocation.
+
+ The define
+
+ CPPEXTERN_HEADER(NEW_CLASS, PARENT_CLASS)
+
+ should be somewhere in your header file.
+ One of the defines like
+
+ CPPEXTERN_NEW(NEW_CLASS)
+ CPPEXTERN_NEW_WITH_TWO_ARGS(NEW_CLASS, t_floatarg, A_FLOAT, t_floatarg, A_FLOAT)
+
+ should be the first thing in your implementation file.
+ NEW_CLASS is the name of your class and PARENT_CLASS is the
+ parent of your class.
+
+-----------------------------------------------------------------*/
+class GEM_EXTERN CPPExtern
+{
+ public:
+
+ //////////
+ // Constructor
+ CPPExtern();
+
+ //////////
+ // The Pd header
+ t_object *x_obj;
+
+ //////////
+ // Destructor
+ virtual ~CPPExtern() = 0;
+
+ //////////
+ // Get the object's canvas
+ t_canvas *getCanvas() { return(m_canvas); }
+
+ //////////
+ // This is a holder - don't touch it
+ static t_object *m_holder;
+
+ //////////
+ // my name
+ static char *m_holdname;
+ t_symbol *m_objectname;
+
+ protected:
+
+ //////////
+ // Creation callback
+ static void real_obj_setupCallback(t_class *) {}
+
+ private:
+
+ //////////
+ // The canvas that the object is in
+ t_canvas *m_canvas;
+
+ public:
+ // these call pd's print-functions, and eventually prepend the object's name
+ void post(const char*format, ...);
+ void verbose(const int level, const char*format, ...);
+ void error(const char*format, ...); /* internally uses pd_error() */
+
+ private:
+ static bool checkGemVersion(int major, int minor);
+};
+
+// This has a dummy arg so that NT won't complain
+GEM_EXTERN void *operator new(size_t, void *location, void *dummy);
+
+////////////////////////////////////////
+// This should be used in the header
+////////////////////////////////////////
+
+#define CPPEXTERN_HEADER(NEW_CLASS, PARENT_CLASS) \
+public: \
+static void obj_freeCallback(void *data) \
+{ CPPExtern *mydata = ((Obj_header *)data)->data; delete mydata; \
+ ((Obj_header *)data)->Obj_header::~Obj_header(); } \
+static void real_obj_setupCallback(t_class *classPtr) \
+{ PARENT_CLASS::real_obj_setupCallback(classPtr); \
+ NEW_CLASS::obj_setupCallback(classPtr); } \
+private: \
+static inline NEW_CLASS *GetMyClass(void *data) {return((NEW_CLASS *)((Obj_header *)data)->data);} \
+static void obj_setupCallback(t_class *classPtr);
+
+
+////////////////////////////////////////
+// This should be the first thing in the implementation file
+////////////////////////////////////////
+
+//
+// NO ARGUMENTS
+/////////////////////////////////////////////////
+#define CPPEXTERN_NEW(NEW_CLASS) \
+ REAL_NEW(NEW_CLASS)
+//
+// ONE ARGUMENT
+/////////////////////////////////////////////////
+#define CPPEXTERN_NEW_WITH_ONE_ARG(NEW_CLASS, TYPE, PD_TYPE) \
+ REAL_NEW_WITH_ARG(NEW_CLASS, TYPE, PD_TYPE)
+//
+// GIMME ARGUMENT
+/////////////////////////////////////////////////
+#define CPPEXTERN_NEW_WITH_GIMME(NEW_CLASS) \
+ REAL_NEW_WITH_GIMME(NEW_CLASS)
+//
+// TWO ARGUMENTS
+/////////////////////////////////////////////////
+#define CPPEXTERN_NEW_WITH_TWO_ARGS(NEW_CLASS, TYPE, PD_TYPE, TTWO, PD_TWO) \
+ REAL_NEW_WITH_ARG_ARG(NEW_CLASS, TYPE, PD_TYPE, TTWO, PD_TWO)
+//
+// THREE ARGUMENTS
+/////////////////////////////////////////////////
+#define CPPEXTERN_NEW_WITH_THREE_ARGS(NEW_CLASS, TYPE, PD_TYPE, TTWO, PD_TWO, TTHREE, PD_THREE) \
+ REAL_NEW_WITH_ARG_ARG_ARG(NEW_CLASS, TYPE, PD_TYPE, TTWO, PD_TWO, TTHREE, PD_THREE)
+//
+// FOUR ARGUMENTS
+/////////////////////////////////////////////////
+#define CPPEXTERN_NEW_WITH_FOUR_ARGS(NEW_CLASS, TYPE, PD_TYPE, TTWO, PD_TWO, TTHREE, PD_THREE, TFOUR, PD_FOUR) \
+ REAL_NEW_WITH_ARG_ARG_ARG_ARG(NEW_CLASS, TYPE, PD_TYPE, TTWO, PD_TWO, TTHREE, PD_THREE, TFOUR, PD_FOUR)
+//
+// FIVE ARGUMENTS
+/////////////////////////////////////////////////
+#define CPPEXTERN_NEW_WITH_FIVE_ARGS(NEW_CLASS, TYPE, PD_TYPE, TTWO, PD_TWO, TTHREE, PD_THREE, TFOUR, PD_FOUR, TFIVE, PD_FIVE) \
+ REAL_NEW_WITH_ARG_ARG_ARG_ARG_ARG(NEW_CLASS, TYPE, PD_TYPE, TTWO, PD_TWO, TTHREE, PD_THREE, TFOUR, PD_FOUR, TFIVE, PD_FIVE)
+
+
+
+//////////////////////////////////////////////////////////////////////////////
+// These should never be called or used directly!!!
+//
+//
+///////////////////////////////////////////////////////////////////////////////
+
+///////////////////////////////////////////////////////////////////////////////
+// static class:
+// by default classes are declared static
+// however, sometimes we need classes not-static, so we can refer to them
+// from other classes
+///////////////////////////////////////////////////////////////////////////////
+#ifdef NO_STATIC_CLASS
+# define STATIC_CLASS
+#else
+# define STATIC_CLASS static
+#endif
+
+///////////////////////////////////////////////////////////////////////////////
+// auto registering a class
+// this creates a dummy class, whose constructor calls the setup-function
+// (registering the class with pd)
+// a static copy of this class is created at runtime, to actually do the setup-call
+///////////////////////////////////////////////////////////////////////////////
+#ifdef NO_AUTO_REGISTER_CLASS
+// if NO_AUTO_REGISTER_CLASS is defined, we will not register the class
+# define AUTO_REGISTER_CLASS(NEW_CLASS)
+#else
+// for debugging we can show the which classes are auto-registering
+# if 0
+# define POST_AUTOREGISTER(NEW_CLASS) post("auto-registering: "#NEW_CLASS)
+# else
+# define POST_AUTOREGISTER(NEW_CLASS)
+# endif
+# define AUTO_REGISTER_CLASS(NEW_CLASS) \
+ class NEW_CLASS ## _cppclass { \
+ public: \
+ NEW_CLASS ## _cppclass() {POST_AUTOREGISTER(NEW_CLASS); NEW_CLASS ## _setup(); } \
+}; \
+ static NEW_CLASS ## _cppclass NEW_CLASS ## _instance;
+#endif
+
+///////////////////////////////////////////////////////////////////////////////
+// setting the help-symbol
+///////////////////////////////////////////////////////////////////////////////
+#ifndef HELPSYMBOL_BASE
+# define HELPSYMBOL_BASE ""
+#endif
+
+#ifdef HELPSYMBOL
+# define SET_HELPSYMBOL(NEW_CLASS) \
+ class_sethelpsymbol(NEW_CLASS ## _class, gensym(HELPSYMBOL_BASE HELPSYMBOL))
+#else
+# define SET_HELPSYMBOL(NEW_CLASS)
+#endif /* HELPSYMBOL */
+
+
+///////////////////////////////////////////////////////////////////////////////
+// setting the class-flags
+///////////////////////////////////////////////////////////////////////////////
+#ifndef GEM_CLASSFLAGS
+# define GEM_CLASSFLAGS 0
+#endif
+///////////////////////////////////////////////////////////////////////////////
+// no args
+///////////////////////////////////////////////////////////////////////////////
+#define REAL_NEW(NEW_CLASS) \
+STATIC_CLASS t_class * NEW_CLASS ## _class; \
+static void* create_ ## NEW_CLASS () \
+{ \
+ try{ \
+ Obj_header *obj = new (pd_new(NEW_CLASS ## _class),(void *)NULL) Obj_header; \
+ CPPExtern::m_holder = &obj->pd_obj; \
+ CPPExtern::m_holdname=(char*)#NEW_CLASS; \
+ obj->data = new NEW_CLASS; \
+ CPPExtern::m_holder = NULL; \
+ CPPExtern::m_holdname=NULL; \
+ return(obj); \
+ } catch (GemException e) {e.report(); return NULL;} \
+} \
+ extern "C" { \
+ void NEW_CLASS ## _setup() \
+ { \
+ NEW_CLASS ## _class = class_new( \
+ gensym(#NEW_CLASS), \
+ (t_newmethod)create_ ## NEW_CLASS, \
+ (t_method)&NEW_CLASS::obj_freeCallback, \
+ sizeof(Obj_header), GEM_CLASSFLAGS, \
+ A_NULL); \
+ SET_HELPSYMBOL(NEW_CLASS); \
+ NEW_CLASS::real_obj_setupCallback(NEW_CLASS ## _class); \
+ } \
+ } \
+ AUTO_REGISTER_CLASS(NEW_CLASS);
+
+
+///////////////////////////////////////////////////////////////////////////////
+// one arg
+///////////////////////////////////////////////////////////////////////////////
+#define REAL_NEW_WITH_ARG(NEW_CLASS, VAR_TYPE, PD_TYPE) \
+STATIC_CLASS t_class * NEW_CLASS ## _class; \
+static void* create_ ## NEW_CLASS (VAR_TYPE arg) \
+{ \
+ try{ \
+ Obj_header *obj = new (pd_new(NEW_CLASS ## _class),(void *)NULL) Obj_header; \
+ CPPExtern::m_holder = &obj->pd_obj; \
+ CPPExtern::m_holdname=(char*)#NEW_CLASS; \
+ obj->data = new NEW_CLASS(arg); \
+ CPPExtern::m_holder = NULL; \
+ CPPExtern::m_holdname=NULL; \
+ return(obj); \
+ } catch (GemException e) {e.report(); return NULL;} \
+} \
+extern "C" { \
+void NEW_CLASS ## _setup() \
+{ \
+ NEW_CLASS ## _class = class_new( \
+ gensym(#NEW_CLASS), \
+ (t_newmethod)create_ ## NEW_CLASS, \
+ (t_method)&NEW_CLASS::obj_freeCallback, \
+ sizeof(Obj_header), GEM_CLASSFLAGS, \
+ PD_TYPE, \
+ A_NULL); \
+ SET_HELPSYMBOL(NEW_CLASS); \
+ NEW_CLASS::real_obj_setupCallback(NEW_CLASS ## _class); \
+ } \
+} \
+ AUTO_REGISTER_CLASS(NEW_CLASS);
+
+///////////////////////////////////////////////////////////////////////////////
+// gimme arg
+///////////////////////////////////////////////////////////////////////////////
+#define REAL_NEW_WITH_GIMME(NEW_CLASS) \
+STATIC_CLASS t_class * NEW_CLASS ## _class; \
+static void* create_ ## NEW_CLASS (t_symbol *s, int argc, t_atom *argv) \
+{ \
+ try{ \
+ Obj_header *obj = new (pd_new(NEW_CLASS ## _class),(void *)NULL) Obj_header; \
+ CPPExtern::m_holder = &obj->pd_obj; \
+ CPPExtern::m_holdname=(char*)s->s_name; \
+ obj->data = new NEW_CLASS(argc, argv); \
+ CPPExtern::m_holder=NULL; \
+ CPPExtern::m_holdname=NULL; \
+ return(obj); \
+ } catch (GemException e) {e.report(); return NULL;} \
+} \
+extern "C" { \
+void NEW_CLASS ## _setup() \
+{ \
+ NEW_CLASS ## _class = class_new( \
+ gensym(#NEW_CLASS), \
+ (t_newmethod)create_ ## NEW_CLASS, \
+ (t_method)&NEW_CLASS::obj_freeCallback, \
+ sizeof(Obj_header), GEM_CLASSFLAGS, \
+ A_GIMME, \
+ A_NULL); \
+ SET_HELPSYMBOL(NEW_CLASS); \
+ NEW_CLASS::real_obj_setupCallback(NEW_CLASS ## _class); \
+ } \
+} \
+ AUTO_REGISTER_CLASS(NEW_CLASS);
+
+///////////////////////////////////////////////////////////////////////////////
+// two args
+///////////////////////////////////////////////////////////////////////////////
+#define REAL_NEW_WITH_ARG_ARG(NEW_CLASS, ONE_VAR_TYPE, ONE_PD_TYPE, TWO_VAR_TYPE, TWO_PD_TYPE) \
+STATIC_CLASS t_class * NEW_CLASS ## _class; \
+static void* create_ ## NEW_CLASS (ONE_VAR_TYPE arg, TWO_VAR_TYPE argtwo) \
+{ \
+ try{ \
+ Obj_header *obj = new (pd_new(NEW_CLASS ## _class),(void *)NULL) Obj_header; \
+ CPPExtern::m_holder = &obj->pd_obj; \
+ CPPExtern::m_holdname=(char*)#NEW_CLASS; \
+ obj->data = new NEW_CLASS(arg, argtwo); \
+ CPPExtern::m_holder = NULL; \
+ CPPExtern::m_holdname=NULL; \
+ return(obj); \
+ } catch (GemException e) {e.report(); return NULL;} \
+} \
+extern "C" { \
+void NEW_CLASS ## _setup() \
+{ \
+ NEW_CLASS ## _class = class_new( \
+ gensym(#NEW_CLASS), \
+ (t_newmethod)create_ ## NEW_CLASS, \
+ (t_method)&NEW_CLASS::obj_freeCallback, \
+ sizeof(Obj_header), GEM_CLASSFLAGS, \
+ ONE_PD_TYPE, TWO_PD_TYPE, \
+ A_NULL); \
+ SET_HELPSYMBOL(NEW_CLASS); \
+ NEW_CLASS::real_obj_setupCallback(NEW_CLASS ## _class); \
+ } \
+} \
+ AUTO_REGISTER_CLASS(NEW_CLASS);
+
+///////////////////////////////////////////////////////////////////////////////
+// three args
+///////////////////////////////////////////////////////////////////////////////
+#define REAL_NEW_WITH_ARG_ARG_ARG(NEW_CLASS, ONE_VAR_TYPE, ONE_PD_TYPE, TWO_VAR_TYPE, TWO_PD_TYPE, THREE_VAR_TYPE, THREE_PD_TYPE) \
+STATIC_CLASS t_class * NEW_CLASS ## _class; \
+static void* create_ ## NEW_CLASS (ONE_VAR_TYPE arg, TWO_VAR_TYPE argtwo, THREE_VAR_TYPE argthree) \
+{ \
+ try{ \
+ Obj_header *obj = new (pd_new(NEW_CLASS ## _class),(void *)NULL) Obj_header; \
+ CPPExtern::m_holder = &obj->pd_obj; \
+ CPPExtern::m_holdname=(char*)#NEW_CLASS; \
+ obj->data = new NEW_CLASS(arg, argtwo, argthree); \
+ CPPExtern::m_holder = NULL; \
+ CPPExtern::m_holdname=NULL; \
+ return(obj); \
+ } catch (GemException e) {e.report(); return NULL;} \
+} \
+extern "C" { \
+void NEW_CLASS ## _setup() \
+{ \
+ NEW_CLASS ## _class = class_new( \
+ gensym(#NEW_CLASS), \
+ (t_newmethod)create_ ## NEW_CLASS, \
+ (t_method)&NEW_CLASS::obj_freeCallback, \
+ sizeof(Obj_header), GEM_CLASSFLAGS, \
+ ONE_PD_TYPE, TWO_PD_TYPE, THREE_PD_TYPE, \
+ A_NULL); \
+ SET_HELPSYMBOL(NEW_CLASS); \
+ NEW_CLASS::real_obj_setupCallback(NEW_CLASS ## _class); \
+ } \
+} \
+ AUTO_REGISTER_CLASS(NEW_CLASS);
+
+///////////////////////////////////////////////////////////////////////////////
+// four args
+///////////////////////////////////////////////////////////////////////////////
+#define REAL_NEW_WITH_ARG_ARG_ARG_ARG(NEW_CLASS, ONE_VAR_TYPE, ONE_PD_TYPE, TWO_VAR_TYPE, TWO_PD_TYPE, THREE_VAR_TYPE, THREE_PD_TYPE, FOUR_VAR_TYPE, FOUR_PD_TYPE) \
+STATIC_CLASS t_class * NEW_CLASS ## _class; \
+static void* create_ ## NEW_CLASS (ONE_VAR_TYPE arg, TWO_VAR_TYPE argtwo, THREE_VAR_TYPE argthree, FOUR_VAR_TYPE argfour) \
+{ \
+ try{ \
+ Obj_header *obj = new (pd_new(NEW_CLASS ## _class),(void *)NULL) Obj_header; \
+ CPPExtern::m_holder = &obj->pd_obj; \
+ CPPExtern::m_holdname=(char*)#NEW_CLASS; \
+ obj->data = new NEW_CLASS(arg, argtwo, argthree, argfour); \
+ CPPExtern::m_holder = NULL; \
+ CPPExtern::m_holdname=NULL; \
+ return(obj); \
+ } catch (GemException e) {e.report(); return NULL;} \
+} \
+extern "C" { \
+void NEW_CLASS ## _setup() \
+{ \
+ NEW_CLASS ## _class = class_new( \
+ gensym(#NEW_CLASS), \
+ (t_newmethod)create_ ## NEW_CLASS, \
+ (t_method)&NEW_CLASS::obj_freeCallback, \
+ sizeof(Obj_header), GEM_CLASSFLAGS, \
+ ONE_PD_TYPE, TWO_PD_TYPE, THREE_PD_TYPE, FOUR_PD_TYPE, \
+ A_NULL); \
+ SET_HELPSYMBOL(NEW_CLASS); \
+ NEW_CLASS::real_obj_setupCallback(NEW_CLASS ## _class); \
+ } \
+} \
+ AUTO_REGISTER_CLASS(NEW_CLASS);
+
+///////////////////////////////////////////////////////////////////////////////
+// five args
+///////////////////////////////////////////////////////////////////////////////
+#define REAL_NEW_WITH_ARG_ARG_ARG_ARG_ARG(NEW_CLASS, ONE_VAR_TYPE, ONE_PD_TYPE, TWO_VAR_TYPE, TWO_PD_TYPE, THREE_VAR_TYPE, THREE_PD_TYPE, FOUR_VAR_TYPE, FOUR_PD_TYPE, FIVE_VAR_TYPE, FIVE_PD_TYPE) \
+STATIC_CLASS t_class * NEW_CLASS ## _class; \
+static void* create_ ## NEW_CLASS (ONE_VAR_TYPE arg, TWO_VAR_TYPE argtwo, THREE_VAR_TYPE argthree, FOUR_VAR_TYPE argfour, FIVE_VAR_TYPE argfive) \
+{ \
+ try{ \
+ Obj_header *obj = new (pd_new(NEW_CLASS ## _class),(void *)NULL) Obj_header; \
+ CPPExtern::m_holder = &obj->pd_obj; \
+ CPPExtern::m_holdname=(char*)#NEW_CLASS; \
+ obj->data = new NEW_CLASS(arg, argtwo, argthree, argfour, argfive); \
+ CPPExtern::m_holder = NULL; \
+ CPPExtern::m_holdname=NULL; \
+ return(obj); \
+ } catch (GemException e) {e.report(); return NULL;} \
+} \
+extern "C" { \
+void NEW_CLASS ## _setup() \
+{ \
+ if(!checkGemVersion(GEM_VERSION_MAJOR, GEM_VERSION_MINOR)) { \
+ ::error("[%s] will not be available", #NEW_CLASS); \
+ return;} \
+ NEW_CLASS ## _class = class_new( \
+ gensym(#NEW_CLASS), \
+ (t_newmethod)create_ ## NEW_CLASS, \
+ (t_method)&NEW_CLASS::obj_freeCallback, \
+ sizeof(Obj_header), GEM_CLASSFLAGS, \
+ ONE_PD_TYPE, TWO_PD_TYPE, THREE_PD_TYPE, FOUR_PD_TYPE, FIVE_PD_TYPE, \
+ A_NULL); \
+ SET_HELPSYMBOL(NEW_CLASS); \
+ NEW_CLASS::real_obj_setupCallback(NEW_CLASS ## _class); \
+ } \
+} \
+ AUTO_REGISTER_CLASS(NEW_CLASS);
+
+#endif // for header file
diff --git a/externals/gridflow/bundled/Base/GemBase.h b/externals/gridflow/bundled/Base/GemBase.h
new file mode 100644
index 00000000..a5ae3d1e
--- /dev/null
+++ b/externals/gridflow/bundled/Base/GemBase.h
@@ -0,0 +1,133 @@
+/*-----------------------------------------------------------------
+ LOG
+ GEM - Graphics Environment for Multimedia
+
+ The base class for all of the gem objects
+
+ Copyright (c) 1997-1999 Mark Danks. mark@danks.org
+ Copyright (c) Günther Geiger.
+ Copyright (c) 2001-2002 IOhannes m zmoelnig. forum::für::umläute. IEM
+ For information on usage and redistribution, and for a DISCLAIMER OF ALL
+ WARRANTIES, see the file, "GEM.LICENSE.TERMS" in this distribution.
+
+ -----------------------------------------------------------------*/
+
+#ifndef INCLUDE_GEMBASE_H_
+#define INCLUDE_GEMBASE_H_
+
+#include "Base/GemGL.h"
+
+#include "Base/CPPExtern.h"
+#include "Base/GemState.h"
+
+class GemCache;
+
+/*-----------------------------------------------------------------
+ -------------------------------------------------------------------
+ CLASS
+ GemBase
+
+ Base class for gem objects
+
+ DESCRIPTION
+
+ -----------------------------------------------------------------*/
+class GEM_EXTERN GemBase : public CPPExtern
+{
+ protected:
+
+ //////////
+ // Constructor
+ GemBase();
+
+ //////////
+ // Destructor
+ virtual ~GemBase();
+
+ //////////
+ virtual void render(GemState *state) = 0;
+
+ //////////
+ void continueRender(GemState *state);
+
+ //////////
+ // After objects below you in the chain have finished.
+ // You should reset all GEM/OpenGL states here.
+ virtual void postrender(GemState *) { ; }
+
+ //////////
+ // Called when rendering stops
+
+#if 1/*(jmz) this seems to be for gem2pdp*/
+ virtual void stoprender() { realStopRendering(); }
+#endif
+
+ //////////
+ // If you care about the start of rendering
+ virtual void startRendering() { ; }
+
+ //////////
+ // If you care about the stop of rendering
+ virtual void stopRendering() { ; }
+
+
+ //////////
+ // has rendering started ?
+ bool gem_amRendering;
+
+ //////////
+ // If anything in the object has changed
+ virtual void setModified();
+
+ //////////
+ // Don't mess with this unless you know what you are doing.
+ GemCache *m_cache;
+ //////////
+ // check whether this object has changed
+ bool m_modified;
+
+ //////////
+ // The outlet
+ t_outlet *m_out1;
+
+
+ //////////
+ // this gets called in the before the startRendering() routine
+ // if it returns TRUE, the object's startRendering(), render() and stopRendering() functions will be called
+ // it it returns FALSE, the object will be disabled
+ // when rendering is restarted, this function get's called again
+ // the default is to enable rendering
+ // this function is important if you want to disable an object because it cannot be used (e.g. missing driver support)
+ virtual bool isRunnable(void);
+
+ //////////
+ // creation callback
+ static void real_obj_setupCallback(t_class *classPtr)
+ { CPPExtern::real_obj_setupCallback(classPtr); GemBase::obj_setupCallback(classPtr); }
+
+
+ private:
+
+ void realStopRendering();
+ void gem_startstopMess(int state);
+ void gem_renderMess(GemCache* state, GemState* state2);
+
+ static inline GemBase *GetMyClass(void *data) {return((GemBase *)((Obj_header *)data)->data);}
+
+ friend class gemhead;
+ static void obj_setupCallback(t_class *classPtr);
+ static void gem_MessCallback(void *, t_symbol *,int, t_atom*);
+ static void renderCallback(GemBase *data, GemState *state);
+ static void postrenderCallback(GemBase *data, GemState *state);
+#if 1 /*jmz this seems to be for gem2pdp*/
+ static void stoprenderCallback(GemBase *data); //DH
+#endif
+
+ /* whether the object is internally disabled or not
+ * objects are to be disabled, if the system cannot make use of them, e.g. because of unsupported openGL features
+ */
+ bool m_enabled;
+
+};
+
+#endif // for header file
diff --git a/externals/gridflow/bundled/Base/GemCache.h b/externals/gridflow/bundled/Base/GemCache.h
new file mode 100644
index 00000000..bf6c1e0f
--- /dev/null
+++ b/externals/gridflow/bundled/Base/GemCache.h
@@ -0,0 +1,69 @@
+/*-----------------------------------------------------------------
+LOG
+ GEM - Graphics Environment for Multimedia
+
+ The state to pass among GEM objects
+
+ Copyright (c) 1997-1999 Mark Danks. mark@danks.org
+ Copyright (c) Günther Geiger. geiger@epy.co.at
+ Copyright (c) 2001-2002 IOhannes m zmoelnig. forum::für::umläute. IEM. zmoelnig@iem.kug.ac.at
+ For information on usage and redistribution, and for a DISCLAIMER OF ALL
+ WARRANTIES, see the file, "GEM.LICENSE.TERMS" in this distribution.
+
+-----------------------------------------------------------------*/
+
+#ifndef INCLUDE_GEMCACHE_H_
+#define INCLUDE_GEMCACHE_H_
+
+#include "Base/GemExportDef.h"
+
+class gemhead;
+
+/*-----------------------------------------------------------------
+-------------------------------------------------------------------
+CLASS
+ GemCache
+
+ The cache to pass among GEM objects
+
+DESCRIPTION
+
+-----------------------------------------------------------------*/
+#define GEMCACHE_MAGIC 0x1234567
+class GEM_EXTERN GemCache
+{
+ public:
+
+ //////////
+ // Constructor
+ GemCache(gemhead *parent);
+
+ //////////
+ // Destructor
+ ~GemCache();
+
+ //////////
+ // Was a modification made which will void a display list?
+ int dirty;
+
+ //////////
+ // Should the image be resent?
+ int resendImage;
+
+ //////////
+ // has the Vertex-Array changed?
+ int vertexDirty;
+
+ //////////
+ // re-set (like creation, but without instantiating
+ void reset(gemhead*parent);
+
+ //////////
+ gemhead *m_parent;
+
+ //////////
+ // indicates a valid cache
+ int m_magic;
+};
+
+#endif // for header file
diff --git a/externals/gridflow/bundled/Base/GemEvent.h b/externals/gridflow/bundled/Base/GemEvent.h
new file mode 100644
index 00000000..a7ce1f48
--- /dev/null
+++ b/externals/gridflow/bundled/Base/GemEvent.h
@@ -0,0 +1,156 @@
+/*-----------------------------------------------------------------
+LOG
+ GEM - Graphics Environment for Multimedia
+
+ get keyboard/mouse/tablet callbacks
+
+ Copyright (c) 1997-1999 Mark Danks. mark@danks.org
+ Copyright (c) Günther Geiger. geiger@epy.co.at
+ Copyright (c) 2001-2002 IOhannes m zmoelnig. forum::für::umläute. IEM. zmoelnig@iem.kug.ac.at
+ For information on usage and redistribution, and for a DISCLAIMER OF ALL
+ WARRANTIES, see the file, "GEM.LICENSE.TERMS" in this distribution.
+
+-----------------------------------------------------------------*/
+
+#ifndef INCLUDE_GEMEVENT_H_
+#define INCLUDE_GEMEVENT_H_
+
+#include "Base/GemExportDef.h"
+//#include "Base/CPPExtern.h"
+
+//////////////////////////////////////////////////////////////////
+//
+// Mouse motion callback
+//
+//////////////////////////////////////////////////////////////////
+typedef void (*MOTION_CB)(int, int, void *);
+//////////
+// Set a mouse motion callback
+GEM_EXTERN extern void setMotionCallback(MOTION_CB callback, void *data);
+
+//////////
+// Remove a mouse motion callback
+GEM_EXTERN extern void removeMotionCallback(MOTION_CB callback, void *data);
+
+
+//////////////////////////////////////////////////////////////////
+//
+// Mouse button callback
+//
+//////////////////////////////////////////////////////////////////
+typedef void (*BUTTON_CB)(int, int, int, int, void *);
+//////////
+// Set a button callback
+// which == 0 == left
+// which == 1 == middle
+// which == 2 == right
+GEM_EXTERN extern void setButtonCallback(BUTTON_CB callback, void *data);
+
+//////////
+// Remove a button callback
+GEM_EXTERN extern void removeButtonCallback(BUTTON_CB callback, void *data);
+
+
+//////////////////////////////////////////////////////////////////
+//
+// Mouse wheel callback
+//
+//////////////////////////////////////////////////////////////////
+typedef void (*WHEEL_CB)(int, int, void *);
+//////////
+// Set a wheel callback
+GEM_EXTERN extern void setWheelCallback(WHEEL_CB callback, void *data);
+
+//////////
+// Remove a wheel callback
+GEM_EXTERN extern void removeWheelCallback(WHEEL_CB callback, void *data);
+
+
+//////////////////////////////////////////////////////////////////
+//
+// Tablet motion callback
+//
+//////////////////////////////////////////////////////////////////
+typedef void (*TABMOTION_CB)(int, int, float, void *);
+//////////
+// Set a tablet motion callback
+GEM_EXTERN extern void setTabletMotionCallback(TABMOTION_CB callback, void *data);
+
+//////////
+// Remove a tablet motion callback
+GEM_EXTERN extern void removeTabletMotionCallback(TABMOTION_CB callback, void *data);
+
+
+//////////////////////////////////////////////////////////////////
+//
+// Tablet rotation callback
+//
+//////////////////////////////////////////////////////////////////
+typedef void (*TABROTATION_CB)(int, int, int, void *);
+//////////
+// Set a tablet rotation callback
+GEM_EXTERN extern void setTabletRotationCallback(TABROTATION_CB callback, void *data);
+
+//////////
+// Remove a tablet rotation callback
+GEM_EXTERN extern void removeTabletRotationCallback(TABROTATION_CB callback, void *data);
+
+
+//////////////////////////////////////////////////////////////////
+//
+// Tablet button callback
+//
+//////////////////////////////////////////////////////////////////
+typedef void (*TABBUTTON_CB)(int, int, int, int, void *);
+//////////
+// Set a tablet button callback
+// which == 0 == left
+// which == 1 == middle
+// which == 2 == right
+GEM_EXTERN extern void setTabletButtonCallback(TABBUTTON_CB callback, void *data);
+
+//////////
+// Remove a tablet button callback
+GEM_EXTERN extern void removeTabletButtonCallback(TABBUTTON_CB callback, void *data);
+
+//////////////////////////////////////////////////////////////////
+//
+// Keyboard callback
+//
+//////////////////////////////////////////////////////////////////
+typedef void (*KEYBOARD_CB)(char *,int, int, void *);
+//////////
+// Set a keyboard callback
+GEM_EXTERN extern void setKeyboardCallback(KEYBOARD_CB callback, void *data);
+
+//////////
+// Remove a keyboard callback
+GEM_EXTERN extern void removeKeyboardCallback(KEYBOARD_CB callback, void *data);
+
+//////////////////////////////////////////////////////////////////
+//
+// Resize callback
+//
+//////////////////////////////////////////////////////////////////
+typedef void (*RESIZE_CB)(int, int, void *);
+//////////
+// Set a resize callback
+GEM_EXTERN extern void setResizeCallback(RESIZE_CB callback, void *data);
+
+//////////
+// Remove a resize callback
+GEM_EXTERN extern void removeResizeCallback(RESIZE_CB callback, void *data);
+
+//////////
+// Trigger an event
+GEM_EXTERN extern void triggerMotionEvent(int x, int y);
+GEM_EXTERN extern void triggerButtonEvent(int which, int state, int x, int y);
+GEM_EXTERN extern void triggerWheelEvent(int axis, int value);
+GEM_EXTERN extern void triggerTabletMotionEvent(int x, int y, float pressure);
+GEM_EXTERN extern void triggerTabletRotationEvent(int az, int alt, int twist);
+GEM_EXTERN extern void triggerTabletButtonEvent(int which, int state, int x, int y);
+GEM_EXTERN extern void triggerKeyboardEvent(char *string, int value, int state);
+GEM_EXTERN extern void triggerResizeEvent(int xSize, int ySize);
+
+#endif // for header file
+
diff --git a/externals/gridflow/bundled/Base/GemExportDef.h b/externals/gridflow/bundled/Base/GemExportDef.h
new file mode 100644
index 00000000..26b07655
--- /dev/null
+++ b/externals/gridflow/bundled/Base/GemExportDef.h
@@ -0,0 +1,40 @@
+/*-----------------------------------------------------------------
+LOG
+ GEM - Graphics Environment for Multimedia
+
+ Export crap
+
+ Copyright (c) 1997-1999 Mark Danks. mark@danks.org
+ Copyright (c) Günther Geiger. geiger@epy.co.at
+ Copyright (c) 2001-2002 IOhannes m zmoelnig. forum::für::umläute. IEM. zmoelnig@iem.kug.ac.at
+ For information on usage and redistribution, and for a DISCLAIMER OF ALL
+ WARRANTIES, see the file, "GEM.LICENSE.TERMS" in this distribution.
+
+-----------------------------------------------------------------*/
+
+#ifndef INCLUDE_GEMEXPORTDEF_H_
+#define INCLUDE_GEMEXPORTDEF_H_
+
+#ifdef _MSC_VER
+
+/* turn of some warnings on vc-compilers */
+# pragma warning( disable : 4244 )
+# pragma warning( disable : 4305 )
+# pragma warning( disable : 4091 )
+// "switch" without "case" (just "default")
+# pragma warning( disable : 4065 )
+
+// Windows requires explicit import and exporting of functions and classes.
+// While this is a pain to do sometimes, in large software development
+// projects, it is very usefull.
+#ifdef GEM_INTERNAL // GEM exporting things
+#define GEM_EXTERN __declspec(dllexport)
+#else // other's importing
+#define GEM_EXTERN __declspec(dllimport)
+#endif // for GEM_INTERNAL
+
+#else // other OS's
+#define GEM_EXTERN
+#endif
+
+#endif // for header file
diff --git a/externals/gridflow/bundled/Base/GemFuncUtil.h b/externals/gridflow/bundled/Base/GemFuncUtil.h
new file mode 100644
index 00000000..70a28f51
--- /dev/null
+++ b/externals/gridflow/bundled/Base/GemFuncUtil.h
@@ -0,0 +1,362 @@
+/*-----------------------------------------------------------------
+LOG
+ GEM - Graphics Environment for Multimedia
+
+ GemFuncUtil.h
+ - contains functions for graphics
+ - part of GEM
+
+ Copyright (c) 1997-2000 Mark Danks. mark@danks.org
+ Copyright (c) Günther Geiger. geiger@epy.co.at
+ Copyright (c) 2001-2002 IOhannes m zmoelnig. forum::für::umläute. IEM. zmoelnig@iem.kug.ac.at
+ For information on usage and redistribution, and for a DISCLAIMER OF ALL
+ WARRANTIES, see the file, "GEM.LICENSE.TERMS" in this distribution.
+
+-----------------------------------------------------------------*/
+
+#ifndef INCLUDE_GEMFUNCUTIL_H_
+#define INCLUDE_GEMFUNCUTIL_H_
+
+#ifdef __APPLE__
+#include <Carbon/Carbon.h>
+#endif
+
+#include "Base/GemExportDef.h"
+
+/* this should be included for ALL platforms:
+ * should we define __MMX__ for windows in there ?
+ */
+#include "config.h"
+#include "GemSIMD.h"
+#include "GemMath.h"
+
+
+// for rand()
+#include <stdlib.h>
+
+///////////////////////////////////////////////////////////////////////////////
+// powerOfTwo
+// get the next higher 2^n-number (if value is'nt 2^n by itself)
+///////////////////////////////////////////////////////////////////////////////
+inline int powerOfTwo(int value)
+{
+/*
+ int x = 1;
+ // while(x <= value) x <<= 1;
+ while(x < value) x <<= 1;
+ return(x);
+*/
+// optimization from "Hacker's Delight"
+// - above loop executes in 4n+3 instructions, where n is the power of 2 of returned int
+// - below code is branch-free and only 12 instructions!
+ value = value - 1;
+ value = value | (value >> 1);
+ value = value | (value >> 2);
+ value = value | (value >> 4);
+ value = value | (value >> 8);
+ value = value | (value >> 16);
+ return (value + 1);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// min/max functions
+//
+///////////////////////////////////////////////////////////////////////////////
+#ifndef MIN
+inline int MIN(int x, int y) { return (x<y)?x:y; }
+inline float MIN(float x, float y) { return (x<y)?x:y; }
+#endif
+#ifndef MAX
+inline int MAX(int x, int y) { return (x>y)?x:y; }
+inline float MAX(float x, float y) { return (x>y)?x:y; }
+#endif
+
+inline unsigned char TRI_MAX(unsigned char v1, unsigned char v2, unsigned char v3){
+ if (v1 > v2 && v1 > v3) return(v1);
+ if (v2 > v3) return(v2);
+ return(v3);
+}
+inline unsigned char TRI_MIN(unsigned char v1, unsigned char v2, unsigned char v3){
+ if (v1 < v2 && v1 < v3) return(v1);
+ if (v2 < v3) return(v2);
+ return(v3);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// Clamp functions
+//
+///////////////////////////////////////////////////////////////////////////////
+//////////
+// Clamp a value high
+inline unsigned char CLAMP_HIGH(int x)
+ { return((unsigned char )((x > 255) ? 255 : x)); }
+
+//////////
+// Clamp a value low
+inline unsigned char CLAMP_LOW(int x)
+ { return((unsigned char )((x < 0) ? 0 : x)); }
+
+//////////
+// Clamp an int to the range of an unsigned char
+inline unsigned char CLAMP(int x)
+ { return((unsigned char)((x > 255) ? 255 : ( (x < 0) ? 0 : x))); }
+
+//////////
+// Clamp a float to the range of an unsigned char
+inline unsigned char CLAMP(float x)
+ { return((unsigned char)((x > 255.f) ? 255.f : ( (x < 0.f) ? 0.f : x))); }
+
+//////////
+// Clamp a float to 0. <= x <= 1.0
+inline float FLOAT_CLAMP(float x)
+ { return((x > 1.f) ? 1.f : ( (x < 0.f) ? 0.f : x)); }
+
+/////////
+// Clamp the Y channel of YUV (16%235)
+inline unsigned char CLAMP_Y(int x)
+ { return((unsigned char)((x > 235) ? 235 : ( (x < 16) ? 16 : x))); }
+
+///////////////////////////////////////////////////////////////////////////////
+// Multiply and interpolation
+//
+///////////////////////////////////////////////////////////////////////////////
+//////////
+// Exactly multiply two unsigned chars
+// This avoids a float value (important on Intel...)
+// From Alvy Ray Smith paper
+inline unsigned char INT_MULT(unsigned int a, unsigned int b)
+ { int t = (unsigned int)a * (unsigned int)b + 0x80;
+ return((unsigned char)(((t >> 8) + t) >> 8)); }
+
+//////////
+// Exactly LERPs two values
+// This avoids a float value (important on Intel...)
+// From Alvy Ray Smith paper
+inline unsigned char INT_LERP(unsigned int p, unsigned int q, unsigned int a)
+ { return((unsigned char)(p + INT_MULT(a, q - p))); }
+
+//////////
+// Floating point LERP
+inline float FLOAT_LERP(float p, float q, float a)
+ { return( a * (q - p) + p); }
+
+
+///////////////////////////////////////////////////////////////////////////////
+// Step function
+//
+///////////////////////////////////////////////////////////////////////////////
+inline int stepFunc(float x, float a)
+ { return(x >= a); }
+inline int stepFunc(int x, int a)
+ { return(x >= a); }
+inline int stepFunc(unsigned char x, unsigned char a)
+ { return(x >= a); }
+
+///////////////////////////////////////////////////////////////////////////////
+// Pulse function
+//
+///////////////////////////////////////////////////////////////////////////////
+inline int pulseFunc(float x, float a, float b)
+ { return(stepFunc(a, x) - stepFunc(b, x)); }
+inline int pulseFunc(int x, int a, int b)
+ { return(stepFunc(a, x) - stepFunc(b, x)); }
+inline int pulseFunc(unsigned char x, unsigned char a, unsigned char b)
+ { return(stepFunc(a, x) - stepFunc(b, x)); }
+
+
+///////////////////////////////////////////////////////////////////////////////
+// Clamp function
+//
+///////////////////////////////////////////////////////////////////////////////
+inline float clampFunc(float x, float a, float b)
+ { return(x < a ? a : (x > b ? b : x)); }
+inline int clampFunc(int x, int a, int b)
+ { return(x < a ? a : (x > b ? b : x)); }
+inline unsigned char clampFunc(unsigned char x, unsigned char a, unsigned char b)
+ { return(x < a ? a : (x > b ? b : x)); }
+inline void* clampFunc(void* x, void* a, void* b)
+ { return(x < a ? a : (x > b ? b : x)); }
+/*
+ inline int GateInt(int nValue,int nMin,int nMax)
+ inline float GateFlt(float nValue,float nMin,float nMax)
+ inline void* GatePtr(void* pValue,void* pMin,void* pMax)
+*/
+
+
+///////////////////////////////////////////////////////////////////////////////
+// absolute integer
+//
+///////////////////////////////////////////////////////////////////////////////
+inline int AbsInt(int inValue) { return (inValue>0)?inValue:-inValue; }
+static inline int GetSign(int inValue) { return (inValue<0)?-1:1; }
+
+///////////////////////////////////////////////////////////////////////////////
+// wrapping functions for integers
+//
+///////////////////////////////////////////////////////////////////////////////
+
+inline int GetTiled(int inValue,const int nMax) {
+ int nOutValue=(inValue%nMax);
+ if (nOutValue<0)nOutValue=((nMax-1)+nOutValue);
+ return nOutValue;
+}
+
+inline int GetMirrored(int inValue,const int nMax) {
+ const int nTwoMax=(nMax*2);
+ int nOutValue=GetTiled(inValue,nTwoMax);
+ if (nOutValue>=nMax)nOutValue=((nTwoMax-1)-nOutValue);
+ return nOutValue;
+}
+
+
+///////////////////////////////////////////////////////////////////////////////
+// 2D-algebra
+//
+///////////////////////////////////////////////////////////////////////////////
+static inline void Get2dTangent(float inX,float inY,float* poutX,float* poutY) {
+ *poutX=inY;
+ *poutY=-inX;
+}
+///////////////////////////////////////////////////////////////////////////////
+// 2D-dot product
+///////////////////////////////////////////////////////////////////////////////
+static inline float Dot2d(float Ax,float Ay,float Bx,float By) {
+ return ((Ax*Bx)+(Ay*By));
+}
+///////////////////////////////////////////////////////////////////////////////
+// 2D-vector normalization
+///////////////////////////////////////////////////////////////////////////////
+static inline void Normalise2d(float* pX,float* pY) {
+ const float MagSqr=Dot2d(*pX,*pY,*pX,*pY);
+ float Magnitude=(float)sqrt(MagSqr);
+ if (Magnitude<=0.0f) {
+ Magnitude=0.001f;
+ }
+ const float RecipMag=1.0f/Magnitude;
+
+ *pX*=RecipMag;
+ *pY*=RecipMag;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// higher algebra
+//
+///////////////////////////////////////////////////////////////////////////////
+inline float GetRandomFloat(void) {
+ return rand()/static_cast<float>(RAND_MAX);
+}
+
+
+///////////////////////////////////////////////////////////////////////////////
+// Smooth step function (3x^2 - 2x^3)
+//
+///////////////////////////////////////////////////////////////////////////////
+GEM_EXTERN extern float smoothStep(float x, float a, float b);
+GEM_EXTERN extern int smoothStep(int x, int a, int b);
+GEM_EXTERN extern unsigned char smoothStep(unsigned char x, unsigned char a, unsigned char b);
+
+///////////////////////////////////////////////////////////////////////////////
+// Bias function
+//
+// Remap unit interval (curve)
+// If a == 0.5, then is linear mapping.
+///////////////////////////////////////////////////////////////////////////////
+GEM_EXTERN extern float biasFunc(float x, float a);
+
+///////////////////////////////////////////////////////////////////////////////
+// Gain function
+//
+// Remap unit interval (S-curve)
+// Will always return 0.5 when x is 0.5
+// If a == 0.5, then is linear mapping.
+///////////////////////////////////////////////////////////////////////////////
+GEM_EXTERN extern float gainFunc(float x, float a);
+
+///////////////////////////////////////////////////////////////////////////////
+// Linear function
+//
+// val should be 0 <= val <= 1.
+// ret should point at a float of enough dimensions to hold the returned value
+// For instance, numDimen == 2, should have a ret[2]
+// numDimen is the number of dimensions to compute
+// npnts is the number of points per dimension.
+//
+///////////////////////////////////////////////////////////////////////////////
+GEM_EXTERN extern void linearFunc(float val, float *ret, int numDimen, int npnts, float *pnts);
+
+///////////////////////////////////////////////////////////////////////////////
+// Spline function
+//
+// val should be 0 <= val <= 1.
+// ret should point at a float of enough dimensions to hold the returned value
+// For instance, numDimen == 2, should have a ret[2]
+// numDimen is the number of dimensions to compute
+// nknots is the number of knots per dimension.
+// There must be at least four knots!
+//
+// Thanks to
+// _Texturing and Modeling: A Procedural Approach_
+// David S. Ebert, Ed.
+///////////////////////////////////////////////////////////////////////////////
+GEM_EXTERN extern void splineFunc(float val, float *ret, int numDimen, int nknots, float *knot);
+
+
+///////////////////////////////////////////////////////////////////////////////
+// Pixel access functions
+//
+///////////////////////////////////////////////////////////////////////////////
+//
+// Accelerated Pixel Manipulations
+// This is sort on a vector operation on 8 chars at the same time .... could be
+// implemented in MMX
+// Alpha channel is not added !! (would be nr 3 and 7)
+
+#define ADD8_NOALPHA(a,b) \
+ ((unsigned char*)(a))[0] = CLAMP_HIGH((int)((unsigned char*)(a))[0] + ((unsigned char*)(b))[0]);\
+ ((unsigned char*)(a))[1] = CLAMP_HIGH((int)((unsigned char*)(a))[1] + ((unsigned char*)(b))[1]);\
+ ((unsigned char*)(a))[2] = CLAMP_HIGH((int)((unsigned char*)(a))[2] + ((unsigned char*)(b))[2]);\
+ ((unsigned char*)(a))[4] = CLAMP_HIGH((int)((unsigned char*)(a))[4] + ((unsigned char*)(b))[4]);\
+ ((unsigned char*)(a))[5] = CLAMP_HIGH((int)((unsigned char*)(a))[5] + ((unsigned char*)(b))[5]);\
+ ((unsigned char*)(a))[6] = CLAMP_HIGH((int)((unsigned char*)(a))[6] + ((unsigned char*)(b))[6]);\
+
+#define SUB8_NOALPHA(a,b) \
+ ((unsigned char*)(a))[0] = CLAMP_LOW((int)((unsigned char*)(a))[0] - ((unsigned char*)(b))[0]);\
+ ((unsigned char*)(a))[1] = CLAMP_LOW((int)((unsigned char*)(a))[1] - ((unsigned char*)(b))[1]);\
+ ((unsigned char*)(a))[2] = CLAMP_LOW((int)((unsigned char*)(a))[2] - ((unsigned char*)(b))[2]);\
+ ((unsigned char*)(a))[4] = CLAMP_LOW((int)((unsigned char*)(a))[4] - ((unsigned char*)(b))[4]);\
+ ((unsigned char*)(a))[5] = CLAMP_LOW((int)((unsigned char*)(a))[5] - ((unsigned char*)(b))[5]);\
+ ((unsigned char*)(a))[6] = CLAMP_LOW((int)((unsigned char*)(a))[6] - ((unsigned char*)(b))[6]);\
+
+#define ADD8(a,b) \
+ ((unsigned char*)(a))[0] = CLAMP_HIGH((int)((unsigned char*)(a))[0] + ((unsigned char*)(b))[0]);\
+ ((unsigned char*)(a))[1] = CLAMP_HIGH((int)((unsigned char*)(a))[1] + ((unsigned char*)(b))[1]);\
+ ((unsigned char*)(a))[2] = CLAMP_HIGH((int)((unsigned char*)(a))[2] + ((unsigned char*)(b))[2]);\
+ ((unsigned char*)(a))[3] = CLAMP_HIGH((int)((unsigned char*)(a))[3] + ((unsigned char*)(b))[3]);\
+ ((unsigned char*)(a))[4] = CLAMP_HIGH((int)((unsigned char*)(a))[4] + ((unsigned char*)(b))[4]);\
+ ((unsigned char*)(a))[5] = CLAMP_HIGH((int)((unsigned char*)(a))[5] + ((unsigned char*)(b))[5]);\
+ ((unsigned char*)(a))[6] = CLAMP_HIGH((int)((unsigned char*)(a))[6] + ((unsigned char*)(b))[6]);\
+ ((unsigned char*)(a))[7] = CLAMP_HIGH((int)((unsigned char*)(a))[7] + ((unsigned char*)(b))[7]);\
+
+#define SUB8(a,b) \
+ ((unsigned char*)(a))[0] = CLAMP_LOW((int)((unsigned char*)(a))[0] - ((unsigned char*)(b))[0]);\
+ ((unsigned char*)(a))[1] = CLAMP_LOW((int)((unsigned char*)(a))[1] - ((unsigned char*)(b))[1]);\
+ ((unsigned char*)(a))[2] = CLAMP_LOW((int)((unsigned char*)(a))[2] - ((unsigned char*)(b))[2]);\
+ ((unsigned char*)(a))[3] = CLAMP_LOW((int)((unsigned char*)(a))[3] - ((unsigned char*)(b))[3]);\
+ ((unsigned char*)(a))[4] = CLAMP_LOW((int)((unsigned char*)(a))[4] - ((unsigned char*)(b))[4]);\
+ ((unsigned char*)(a))[5] = CLAMP_LOW((int)((unsigned char*)(a))[5] - ((unsigned char*)(b))[5]);\
+ ((unsigned char*)(a))[6] = CLAMP_LOW((int)((unsigned char*)(a))[6] - ((unsigned char*)(b))[6]);\
+ ((unsigned char*)(a))[7] = CLAMP_LOW((int)((unsigned char*)(a))[7] - ((unsigned char*)(b))[7]);\
+
+
+
+#ifdef __APPLE__
+//Ian Ollman's function to determine the cache prefetch for altivec vec_dst()
+inline UInt32 GetPrefetchConstant( int blockSizeInVectors, int blockCount, int blockStride )
+{
+ return ((blockSizeInVectors << 24) & 0x1F000000) | ((blockCount << 16) & 0x00FF0000) | (blockStride & 0xFFFF);
+}
+#endif
+
+
+#endif // for header file
+
diff --git a/externals/gridflow/bundled/Base/GemGL.h b/externals/gridflow/bundled/Base/GemGL.h
new file mode 100644
index 00000000..24d6fe99
--- /dev/null
+++ b/externals/gridflow/bundled/Base/GemGL.h
@@ -0,0 +1,72 @@
+/*
+ * GemGL: openGL includes for GEM
+ *
+ * include this file if you want to include the
+ * openGL-headers installed on your system
+ *
+ * tasks:
+ *
+ * + this file hides the peculiarities of the various platforms
+ * (like "OpenGL/gl.h" vs "GL/gl.h")
+ *
+ * + define some pre-processor defines that are missing in the GL-headers
+ *
+ * + try to exclude parts of the GL-headers based on config.h
+ *
+ */
+
+
+#ifndef INCLUDE_GEMGL_H_
+#define INCLUDE_GEMGL_H_
+
+#include "config.h"
+
+// I hate Microsoft...I shouldn't have to do this!
+#ifdef __WIN32__
+# include <windows.h>
+#endif
+
+#define GLEW_STATIC
+//#include "Base/glew.h"
+#ifdef __APPLE__
+typedef signed long GLint;
+typedef unsigned long GLenum;
+#else
+typedef signed int GLint;
+typedef unsigned int GLenum;
+#endif
+typedef float GLfloat;
+typedef unsigned char GLboolean;
+#define GL_RGBA_MODE 0x0C31
+#define GL_UNSIGNED_BYTE 0x1401
+#define GL_RGBA 0x1908
+
+
+#ifdef __APPLE__
+# include <OpenGL/OpenGL.h>
+#elif defined __WIN32__
+# include "Base/wglew.h"
+#elif defined __linux__
+
+#endif /* OS */
+
+#ifndef GL_YUV422_GEM
+# define GL_YCBCR_422_GEM GL_YCBCR_422_APPLE
+# define GL_YUV422_GEM GL_YCBCR_422_GEM
+#endif /* GL_YUV422_GEM */
+
+
+#ifndef GL_RGBA_GEM
+# ifdef __APPLE__
+# define GL_RGBA_GEM GL_BGRA_EXT
+# else
+# define GL_RGBA_GEM GL_RGBA
+# endif
+#endif /* GL_RGBA_GEM */
+
+/* default draw-style */
+#ifndef GL_DEFAULT_GEM
+# define GL_DEFAULT_GEM 0xFFFF
+#endif
+
+#endif /* INCLUDE_GEMGL_H_ */
diff --git a/externals/gridflow/bundled/Base/GemGLUtil.h b/externals/gridflow/bundled/Base/GemGLUtil.h
new file mode 100644
index 00000000..9c5402f9
--- /dev/null
+++ b/externals/gridflow/bundled/Base/GemGLUtil.h
@@ -0,0 +1,29 @@
+/*-----------------------------------------------------------------
+LOG
+ GEM - Graphics Environment for Multimedia
+
+ GemGLUtil.h
+ - contains functions for graphics
+ - part of GEM
+
+ Copyright (c) 1997-2000 Mark Danks. mark@danks.org
+ Copyright (c) Günther Geiger. geiger@epy.co.at
+ Copyright (c) 2001-2002 IOhannes m zmoelnig. forum::für::umläute. IEM. zmoelnig@iem.kug.ac.at
+ For information on usage and redistribution, and for a DISCLAIMER OF ALL
+ WARRANTIES, see the file, "GEM.LICENSE.TERMS" in this distribution.
+
+-----------------------------------------------------------------*/
+
+#ifndef INCLUDE_GEMGLUTIL_H_
+#define INCLUDE_GEMGLUTIL_H_
+
+#include "Base/GemBase.h"
+#include "Base/GemExportDef.h"
+
+GEM_EXTERN extern GLenum glReportError (void);
+GEM_EXTERN extern int getGLdefine(char *name);
+GEM_EXTERN extern int getGLdefine(t_symbol *name);
+GEM_EXTERN extern int getGLdefine(t_atom *name);
+GEM_EXTERN extern int getGLbitfield(int argc, t_atom *argv);
+#endif // for header file
+
diff --git a/externals/gridflow/bundled/Base/GemGluObj.h b/externals/gridflow/bundled/Base/GemGluObj.h
new file mode 100644
index 00000000..524ba4b4
--- /dev/null
+++ b/externals/gridflow/bundled/Base/GemGluObj.h
@@ -0,0 +1,96 @@
+/*-----------------------------------------------------------------
+LOG
+ GEM - Graphics Environment for Multimedia
+
+ A Glu object
+
+ Copyright (c) 1997-2000 Mark Danks. mark@danks.org
+ Copyright (c) Günther Geiger. geiger@epy.co.at
+ Copyright (c) 2001-2002 IOhannes m zmoelnig. forum::für::umläute. IEM. zmoelnig@iem.kug.ac.at
+ For information on usage and redistribution, and for a DISCLAIMER OF ALL
+ WARRANTIES, see the file, "GEM.LICENSE.TERMS" in this distribution.
+
+-----------------------------------------------------------------*/
+
+#ifndef INCLUDE_GEMGLUOBJ_H_
+#define INCLUDE_GEMGLUOBJ_H_
+
+// I hate Microsoft...I shouldn't have to do this!
+#ifdef __WIN32__
+#include <windows.h>
+#endif
+
+#include <string.h>
+
+
+#include <math.h>
+#ifndef M_PI
+# define M_PI (3.1415926)
+#endif
+
+#include "Base/GemShape.h"
+
+#ifndef GLU_SILHOUETTE
+# define GLU_SILHOUETTE 0
+#endif
+
+/*-----------------------------------------------------------------
+-------------------------------------------------------------------
+CLASS
+ GemGluObj
+
+ A Glu object
+
+DESCRIPTION
+
+ Inlet for an int - "in2"
+
+ "in2" - the number of slices in the object
+
+-----------------------------------------------------------------*/
+class GEM_EXTERN GemGluObj : public GemShape
+{
+ public:
+
+ //////////
+ // Constructor
+ GemGluObj(t_floatarg size, t_floatarg slices=10.f, t_floatarg stacks=0.f);
+
+ protected:
+
+ //////////
+ // Destructor
+ virtual ~GemGluObj();
+
+ //////////
+ // How the object should be drawn
+ virtual void typeMess(t_symbol *type);
+
+ //////////
+ // The number of slices in the quadric
+ void numSlicesMess(int numSlices);
+ void numSlicesMess(int numSlices, int numStacks);
+
+ //////////
+ // The number of slices
+ int m_numSlices, m_numStacks;
+
+ //////////
+ t_inlet *m_sliceInlet;
+
+ //////////
+ // creation callback
+ static void real_obj_setupCallback(t_class *classPtr)
+ { GemShape::real_obj_setupCallback(classPtr); GemGluObj::obj_setupCallback(classPtr); }
+
+ private:
+
+ static inline GemGluObj *GetMyClass(void *data) {return((GemGluObj *)((Obj_header *)data)->data);}
+
+ //////////
+ // Static member functions
+ static void obj_setupCallback(t_class *classPtr);
+ static void numSlicesMessCallback(void *data, t_symbol*, int, t_atom*);
+};
+
+#endif // for header file
diff --git a/externals/gridflow/bundled/Base/GemLoadObj.h b/externals/gridflow/bundled/Base/GemLoadObj.h
new file mode 100644
index 00000000..9e4c9625
--- /dev/null
+++ b/externals/gridflow/bundled/Base/GemLoadObj.h
@@ -0,0 +1,28 @@
+/*-----------------------------------------------------------------
+LOG
+ GEM - Graphics Environment for Multimedia
+
+ - loads in an alias|wavefront model file
+
+ Copyright (c) 1997-1999 Mark Danks. mark@danks.org
+ Copyright (c) Günther Geiger. geiger@epy.co.at
+ Copyright (c) 2001-2002 IOhannes m zmoelnig. forum::für::umläute. IEM. zmoelnig@iem.kug.ac.at
+ For information on usage and redistribution, and for a DISCLAIMER OF ALL
+ WARRANTIES, see the file, "GEM.LICENSE.TERMS" in this distribution.
+
+-----------------------------------------------------------------*/
+
+#ifndef INCLUDE_GEMLOADOBJ_H_
+#define INCLUDE_GEMLOADOBJ_H_
+
+#include "Base/GemExportDef.h"
+
+class GemModelData;
+
+//////////
+// Load in an alias|wavefront model
+// [out] GemModel * - equals NULL if failure
+GEM_EXTERN extern GemModelData *loadWaveFrontModel(const char *filename);
+
+
+#endif
diff --git a/externals/gridflow/bundled/Base/GemMan.h b/externals/gridflow/bundled/Base/GemMan.h
new file mode 100644
index 00000000..351429be
--- /dev/null
+++ b/externals/gridflow/bundled/Base/GemMan.h
@@ -0,0 +1,257 @@
+/*-----------------------------------------------------------------
+ LOG
+ GEM - Graphics Environment for Multimedia
+
+ The base functions and structures
+ Also includes gemwin header file
+
+ Copyright (c) 1997-2000 Mark Danks.mark@danks.org
+ Copyright (c) Günther Geiger. geiger@epy.co.at
+ Copyright (c) 2001-2002 IOhannes m zmoelnig. forum::für::umläute. IEM. zmoelnig@iem.kug.ac.at
+ For information on usage and redistribution, and for a DISCLAIMER OF ALL
+ WARRANTIES, see the file, "GEM.LICENSE.TERMS" in this distribution.
+
+ -----------------------------------------------------------------*/
+
+#ifndef INCLUDE_GEMMAN_H_
+#define INCLUDE_GEMMAN_H_
+
+#include "Base/GemGL.h"
+#include "Base/GemGLUtil.h"
+
+#ifdef __APPLE__
+# include <Carbon/Carbon.h>
+# include <AGL/agl.h>
+#endif // __APPLE__
+
+#ifdef __WIN32__
+# include <QTML.h>
+# include <Movies.h>
+#endif
+
+#include "Base/GemExportDef.h"
+
+class gemhead;
+class gemheadLink;
+class GemState;
+class WindowInfo;
+
+/*-----------------------------------------------------------------
+ -------------------------------------------------------------------
+ CLASS
+ GemMan
+
+ A static class to create windows, etc.
+
+ DESCRIPTION
+
+ -----------------------------------------------------------------*/
+class GEM_EXTERN GemMan
+{
+ public:
+
+ //////////
+ // Should only be called once (usually by GemSetup)
+ static void initGem(void);
+
+ //////////
+ static void addObj(gemhead *obj, int priority);
+
+ //////////
+ static void removeObj(gemhead *obj, int priority);
+
+ //////////
+ // Is there a window.
+ static int windowExists(void);
+
+ //////////
+ // Are we rendering.
+ static int getRenderState(void);
+
+ //////////
+ // is there a context (has its meaning under X)
+ static void createContext(char* disp);
+ static int contextExists(void);
+
+ //////////
+ // If an object needs to know if the window changed.
+ // This is important for display lists.
+ static int windowNumber(void);
+
+ //////////
+ // reset to the initial state
+ static void resetState(void);
+
+ //////////
+ // Just send out one frame (if double buffered, will swap buffers)
+ static void render(void *);
+ static void renderChain(gemheadLink *head, GemState *state);
+
+
+ //////////
+ // Start a clock to do rendering.
+ static void startRendering(void);
+
+ //////////
+ // Stop the clock to do rendering.
+ static void stopRendering(void);
+
+ //////////
+ // Create the window with the current parameters
+ static int createWindow(char* disp = 0);
+
+ //////////
+ // Destroy the window
+ static void destroyWindow(void);
+ // Destroy the window after a minimal delay
+ static void destroyWindowSoon(void);
+
+ //////////
+ // Swap the buffers.
+ // If single buffered, just clears the window
+ static void swapBuffers(void);
+
+ //////////
+ // Set the frame rate
+ static void frameRate(float framespersecond);
+ //////////
+ // Get the frame rate
+ static float getFramerate(void);
+
+ static int getProfileLevel(void);
+
+ static void getDimen(int*width, int*height);
+ static void getRealDimen(int*width, int*height);
+ static void getOffset(int*x, int*y);
+
+ //////////
+ // Turn on/off lighting
+ static void lightingOnOff(int state);
+
+ //////////
+ // Turn on/off cursor
+ static void cursorOnOff(int state);
+
+ //////////
+ // Turn on/off topmost position
+ static void topmostOnOff(int state);
+
+
+ //////////
+ // Request a lighting value - it is yours until you free it.
+ // The return can be 0, in which there are too many lights
+ // [in] specific - If you want a specific light. == 0 means that you don't care.
+ static GLenum requestLight(int specific = 0);
+
+ //////////
+ // Free a lighting value
+ static void freeLight(GLenum lightNum);
+
+ //////////
+ // Print out information
+ static void printInfo(void);
+
+ //////////
+ static void fillGemState(GemState &);
+
+ static int texture_rectangle_supported;
+ static int client_storage_supported;
+ static int texture_range_supported;
+ static int texture_yuv_supported;
+ static int multisample_filter_hint;
+ static GLint maxStackDepth[4]; // for push/pop of matrix-stacks
+
+
+ static float m_perspect[6]; // values for the perspective matrix
+ static float m_lookat[9]; // values for the lookat matrix
+
+ // LATER make this private (right now it is needed in gem2pdp)
+ static int m_buffer; // single(1) or double(2)
+
+ private:
+
+ //////////
+ // computer and window information
+ static char *m_title; // title to be displayed
+ static int m_fullscreen; // fullscreen (1) or not (0!)
+ static int m_menuBar; // hide (0), show(1), hide but autoshow(-1)
+ static int m_secondscreen; // set the second screen
+ static int m_height; // window height
+ static int m_width; // window width
+ static int m_w; // the real window width (reported by gemCreateWindow())
+ static int m_h; // the real window height
+ static int m_xoffset; // window offset (x)
+ static int m_yoffset; // window offset (y)
+
+ static int m_border; // window border
+ static int m_stereo; // stereoscopic
+
+ static int m_profile; // off(0), on(1), w/o image caching(2)
+ static int m_rendering;
+
+ static float m_fog; // fog density
+ enum FOG_TYPE
+ { FOG_OFF = 0, FOG_LINEAR, FOG_EXP, FOG_EXP2 };
+ static FOG_TYPE m_fogMode; // what kind of fog we have
+ static GLfloat m_fogColor[4]; // colour of the fog
+ static float m_fogStart; // start of the linear fog
+ static float m_fogEnd; // start of the linear fog
+
+ static float m_motionBlur; // motion-blur factor in double-buffer mode
+
+ static float fps;
+ static int fsaa;
+ static bool pleaseDestroy;
+#ifdef __APPLE__
+ static AGLContext masterContext;
+#endif
+
+ //////////
+ // Changing these variables is likely to crash GEM
+ // This is current rendering window information
+ // The window is created and destroyed by the user, so
+ // if there is no window, this will contain NULL pointers.
+ static WindowInfo &getWindowInfo(void);
+
+ //////////
+ // Changing these variables is likely to crash GEM
+ // This is constant rendering window information
+ // This window is always avaliable (although not visible)
+ static WindowInfo &getConstWindowInfo(void);
+ static int createConstWindow(char* disp = 0);
+
+ // gemwin is allowed to modifying "global" window attributes
+ friend class gemwin;
+
+ static GLfloat m_clear_color[4]; // the frame buffer clear
+ static GLbitfield m_clear_mask; // the clear bitmask
+ static GLfloat m_mat_ambient[4]; // default ambient material
+ static GLfloat m_mat_specular[4]; // default specular material
+ static GLfloat m_mat_shininess; // default shininess material
+
+ static GLfloat m_stereoSep; // stereo seperation
+ static GLfloat m_stereoFocal; // distance to focal point
+ static bool m_stereoLine; // draw a line between 2 stereo-screens
+
+ static double m_lastRenderTime; // the time of the last rendered frame
+
+ // gemwin should not touch the following member variables and member functions
+ static int m_windowState;
+ static int m_windowNumber;
+ static int m_windowContext;
+ static int m_cursor;
+ static int m_topmost;
+
+ static void windowInit(void);
+ static void windowCleanup(void);
+ static void resetValues(void);
+
+ static void resizeCallback(int xsize, int ysize, void*);
+ static void dispatchWinmessCallback(void);
+
+ //////////
+ // check for supported openGL extensions we might need
+ static void checkOpenGLExtensions(void);
+};
+
+#endif
diff --git a/externals/gridflow/bundled/Base/GemMath.h b/externals/gridflow/bundled/Base/GemMath.h
new file mode 100644
index 00000000..96177a05
--- /dev/null
+++ b/externals/gridflow/bundled/Base/GemMath.h
@@ -0,0 +1,89 @@
+/*-----------------------------------------------------------------
+LOG
+ GEM - Graphics Environment for Multimedia
+
+ Matrix class
+
+ Copyright (c) 1997-1999 Mark Danks. mark@danks.org
+ Copyright (c) Günther Geiger. geiger@epy.co.at
+ Copyright (c) 2001-2002 IOhannes m zmoelnig. forum::für::umläute. IEM. zmoelnig@iem.kug.ac.at
+ For information on usage and redistribution, and for a DISCLAIMER OF ALL
+ WARRANTIES, see the file, "GEM.LICENSE.TERMS" in this distribution.
+
+-----------------------------------------------------------------*/
+
+#ifndef INCLUDE_GEMMATH_H_
+#define INCLUDE_GEMMATH_H_
+
+#include "Base/config.h"
+
+#include <math.h>
+
+
+#ifndef M_PI
+#define M_PI 3.14159265358979323846
+#endif
+
+#ifdef __APPLE__
+# include <AvailabilityMacros.h>
+# if defined (MAC_OS_X_VERSION_10_3) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3
+# else
+
+#define sqrtf(v) (float)sqrt((double)(v))
+#define cosf(v) (float)cos((double)(v))
+#define sinf(v) (float)sin((double)(v))
+#define tanf(v) (float)tan((double)(v))
+#define logf(v) (float)log((double)(v))
+#define expf(v) (float)exp((double)(v))
+
+#define atan2f(v,p) (float)atan2((double)(v), (double)(p))
+#define powf(v,p) (float)pow((double)(v), (double)(p))
+
+# endif /* OSX_10_3 */
+#endif /* __APPLE__ */
+
+
+///////////////////////////////////////////////////////////////////////////////
+// Speedup found via Shark: ppc only
+//
+// If you do not require full precision, you can use the PowerPC floating-point
+// reciprocal square-root estimate instruction (frsqrte) instead of calling sqrt().
+//
+// If needed, you can increase the precision of the estimate returned by
+// frsqrte (5-bits of precision) by using the Newton-Raphson method for improving
+// the estimate (x0) for 1/sqrt(a) (x1 = 0.5 * x0 * [3.0 - a * x0 * x0]).
+///////////////////////////////////////////////////////////////////////////////
+#ifdef __ppc__
+# include <ppc_intrinsics.h>
+# ifdef sqrt
+# undef sqrt
+# endif
+# ifdef sqrtf
+# undef sqrtf
+# endif
+
+# define sqrt fast_sqrtf
+# define sqrtf fast_sqrtf
+
+inline double fast_sqrt(double x)
+{
+ register double est = __frsqrte(x);
+ return x * 0.5 * est * __fnmsub(est * est, x, 3.0);
+}
+
+inline float fast_sqrtf(float x)
+{
+ register float est = (float)__frsqrte(x);
+ return x * 0.5f * est * __fnmsubs(est * est, x, 3.0f);
+}
+#endif /* __ppc__ */
+
+#ifdef __WIN32__
+/* seems like there is no drand48() on w32 */
+/* JMZ: this should really return "double" instead of "float",
+ * but we need only float... */
+# define drand48() ((float)rand())/((float)RAND_MAX)
+#endif /* _WIN32 */
+
+
+#endif // for header file
diff --git a/externals/gridflow/bundled/Base/GemModelData.h b/externals/gridflow/bundled/Base/GemModelData.h
new file mode 100644
index 00000000..4545bf98
--- /dev/null
+++ b/externals/gridflow/bundled/Base/GemModelData.h
@@ -0,0 +1,42 @@
+/*-----------------------------------------------------------------
+LOG
+ GEM - Graphics Environment for Multimedia
+
+ Structure for specifying a model for rendering
+
+ Copyright (c) 1997-1999 Mark Danks. mark@danks.org
+ Copyright (c) Günther Geiger. geiger@epy.co.at
+ Copyright (c) 2001-2002 IOhannes m zmoelnig. forum::für::umläute. IEM. zmoelnig@iem.kug.ac.at
+ For information on usage and redistribution, and for a DISCLAIMER OF ALL
+ WARRANTIES, see the file, "GEM.LICENSE.TERMS" in this distribution.
+
+-----------------------------------------------------------------*/
+
+#ifndef INCLUDE_GEMMODELDATA_H_
+#define INCLUDE_GEMMODELDATA_H_
+
+#include "Base/GemExportDef.h"
+
+/*-----------------------------------------------------------------
+-------------------------------------------------------------------
+CLASS
+ imageStruct
+
+ The basic image structure
+
+-----------------------------------------------------------------*/
+class GEM_EXTERN GemModelData
+{
+ public:
+
+ //////////
+ // Constructor
+ GemModelData() { }
+
+ //////////
+ // Destructor
+ ~GemModelData() { }
+};
+
+
+#endif
diff --git a/externals/gridflow/bundled/Base/GemPBuffer.h b/externals/gridflow/bundled/Base/GemPBuffer.h
new file mode 100644
index 00000000..f11f5ee4
--- /dev/null
+++ b/externals/gridflow/bundled/Base/GemPBuffer.h
@@ -0,0 +1,51 @@
+/* OpenGL pixel buffer
+ *
+ * Copyright (C) 2003-2004, Alexander Zaprjagaev <frustum@frustum.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef __PBUFFER_H__
+#define __PBUFFER_H__
+
+struct PBuffer_data;
+
+class PBuffer {
+public:
+
+ enum {
+ GEM_PBUFLAG_RGB = 1 << 0,
+ GEM_PBUFLAG_RGBA = 1 << 1,
+ GEM_PBUFLAG_DEPTH = 1 << 2,
+ GEM_PBUFLAG_STENCIL = 1 << 3,
+ GEM_PBUFLAG_FLOAT = 1 << 4,
+ GEM_PBUFLAG_MULTISAMPLE_2 = 1 << 5,
+ GEM_PBUFLAG_MULTISAMPLE_4 = 1 << 6
+ };
+
+ PBuffer(int width,int height,int flags = GEM_PBUFLAG_RGBA | GEM_PBUFLAG_DEPTH | GEM_PBUFLAG_STENCIL);
+ ~PBuffer();
+
+ void enable();
+ void disable();
+
+ int width;
+ int height;
+
+protected:
+ struct PBuffer_data *data;
+};
+
+#endif /* __PBUFFER_H__ */
diff --git a/externals/gridflow/bundled/Base/GemPathBase.h b/externals/gridflow/bundled/Base/GemPathBase.h
new file mode 100644
index 00000000..7bd23aa4
--- /dev/null
+++ b/externals/gridflow/bundled/Base/GemPathBase.h
@@ -0,0 +1,74 @@
+/*-----------------------------------------------------------------
+LOG
+ GEM - Graphics Environment for Multimedia
+
+ Base class for paths
+
+ Copyright (c) 1997-1999 Mark Danks. mark@danks.org
+ Copyright (c) Günther Geiger. geiger@epy.co.at
+ Copyright (c) 2001-2002 IOhannes m zmoelnig. forum::für::umläute. IEM. zmoelnig@iem.kug.ac.at
+ For information on usage and redistribution, and for a DISCLAIMER OF ALL
+ WARRANTIES, see the file, "GEM.LICENSE.TERMS" in this distribution.
+
+-----------------------------------------------------------------*/
+
+#ifndef INCLUDE_GEMPATHBASE_H_
+#define INCLUDE_GEMPATHBASE_H_
+
+#include "Base/CPPExtern.h"
+
+/*-----------------------------------------------------------------
+-------------------------------------------------------------------
+CLASS
+ GemPathBase
+
+
+DESCRIPTION
+
+
+-----------------------------------------------------------------*/
+class GEM_EXTERN GemPathBase : public CPPExtern
+{
+ CPPEXTERN_HEADER(GemPathBase, CPPExtern)
+
+ public:
+
+ //////////
+ // Constructor
+ GemPathBase(int argc, t_atom *argv);
+
+ protected:
+
+ //////////
+ // Destructor
+ virtual ~GemPathBase();
+
+ //////////
+ // When an open is received
+ virtual void openMess(t_symbol *arrayname);
+
+ //////////
+ // When a float val is received
+ virtual void floatMess(float val) = 0;
+
+ //////////
+ // The number of dimensions
+ int m_numDimens;
+
+ //////////
+ // The array
+ t_garray *m_array;
+
+ //////////
+ // The outlet
+ t_outlet *m_out1;
+
+ private:
+
+ //////////
+ // static member functions
+ static void openMessCallback(void *data, t_symbol *arrayname);
+ static void floatMessCallback(void *data, float n);
+};
+
+#endif // for header file
diff --git a/externals/gridflow/bundled/Base/GemPixConvert.h b/externals/gridflow/bundled/Base/GemPixConvert.h
new file mode 100644
index 00000000..e1cd5a3d
--- /dev/null
+++ b/externals/gridflow/bundled/Base/GemPixConvert.h
@@ -0,0 +1,160 @@
+/*-----------------------------------------------------------------
+LOG
+ GEM - Graphics Environment for Multimedia
+
+ GemPixConvertSIMD.h
+ - header-file for color conversion
+ - this is mainly for (SIMD-)optimized routines
+ - part of GEM
+
+ Copyright (c) 2006 IOhannes m zmoelnig. forum::für::umläute. IEM. zmoelnig@iem.kug.ac.at
+ For information on usage and redistribution, and for a DISCLAIMER OF ALL
+ WARRANTIES, see the file, "GEM.LICENSE.TERMS" in this distribution.
+
+-----------------------------------------------------------------*/
+
+
+#ifndef INCLUDE_GEMPIXCONVERT_SIMD_H_
+#define INCLUDE_GEMPIXCONVERT_SIMD_H_
+
+#include "GemPixUtil.h"
+#include "GemSIMD.h"
+
+// use formulae from http://www.poynton.com/notes/colour_and_gamma/ColorFAQ.html#RTFToC30
+/*
+ * [Y] 1 [ 65.738 129.075 25.064 ] [R] [ 16]
+ * [U] = --- * [ -37.945 -74.494 112.439 ] * [G]+[128]
+ * [V] = 256 [ 112.439 -94.154 -18.285 ] [B] [128]
+ *
+ * [R] 1 [ 298.082 0.0 408.583 ] [Y] [ 16]
+ * [G] = --- * [ 298.082 -100.291 -208.120 ] * ([U]-[128])
+ * [B] = 256 [ 298.082 516.411 0.0 ] [V] [128]
+ */
+
+#define YUV_POYNTON
+// here comes something to be afraid of:
+// (probably it would be better to define the matrices as real constant-value matrices)
+// (instead of element-wise)
+
+#ifdef YUV_POYNTON
+# define Y_OFFSET 16
+# define UV_OFFSET 128
+
+// RGB2YUV
+// poynton-values rounded
+# define RGB2YUV_11 66
+# define RGB2YUV_12 129
+# define RGB2YUV_13 25
+# define RGB2YUV_21 -38
+# define RGB2YUV_22 -74
+# define RGB2YUV_23 112
+# define RGB2YUV_31 112
+# define RGB2YUV_32 -94
+# define RGB2YUV_33 -18
+
+// YUV2RGB
+// (we skip _21 and _31 as they are equal to _11)
+#if 0
+// poynton-values rounded
+# define YUV2RGB_11 298
+# define YUV2RGB_12 0
+# define YUV2RGB_13 409
+# define YUV2RGB_22 -100
+# define YUV2RGB_23 -208
+# define YUV2RGB_32 516
+# define YUV2RGB_33 0
+#else
+
+// this is round(256*inv(rgb2yuv/256))
+// so the general error should be smaller
+# define YUV2RGB_11 298
+# define YUV2RGB_12 -1
+# define YUV2RGB_13 409
+# define YUV2RGB_22 -100
+# define YUV2RGB_23 -210
+# define YUV2RGB_32 519
+# define YUV2RGB_33 0
+#endif
+
+#else
+/* the old ones: */
+# define Y_OFFSET 0
+# define UV_OFFSET 128
+// RGB2YUV
+# define RGB2YUV_11 77
+# define RGB2YUV_12 150
+# define RGB2YUV_13 29
+# define RGB2YUV_21 -43
+# define RGB2YUV_22 -85
+# define RGB2YUV_23 128
+# define RGB2YUV_31 128
+# define RGB2YUV_32 -107
+# define RGB2YUV_33 -21
+// YUV2RGB
+# define YUV2RGB_11 256
+# define YUV2RGB_12 0
+# define YUV2RGB_13 359
+# define YUV2RGB_22 -88
+# define YUV2RGB_23 -183
+# define YUV2RGB_32 454
+# define YUV2RGB_33 0
+
+#endif /* POYNTON */
+
+/* AltiVec */
+#ifdef __VEC__
+
+/* there are problems on OSX10.3 with older versions of gcc, since the intrinsic code
+ * below freely changes between signed and unsigned short vectors
+ * newer versions of gcc accept this...
+ * LATER: fix the code (GemPixConvertAltivec:750..800)
+ */
+# ifdef __GNUC__
+/* according to hcs it does NOT work with gcc-3.3
+ * for simplicity, i disable everything below gcc4
+ * JMZ: 20061114
+ */
+# if __GNUC__ < 4
+# warning disabling AltiVec for older gcc: please fix me
+# define NO_VECTORINT_TO_VECTORUNSIGNEDINT
+# endif
+# endif /* GNUC */
+
+
+ void RGB_to_YCbCr_altivec(unsigned char *rgbdata, size_t RGB_size,
+ unsigned char *pixels);
+ void RGBA_to_YCbCr_altivec(unsigned char *rgbadata, size_t RGBA_size,
+ unsigned char *pixels);
+ void BGR_to_YCbCr_altivec(unsigned char *bgrdata, size_t BGR_size,
+ unsigned char *pixels);
+ void BGRA_to_YCbCr_altivec(unsigned char *bgradata, size_t BGRA_size,
+ unsigned char *pixels);
+ void YUV422_to_BGRA_altivec(unsigned char *yuvdata, size_t pixelnum,
+ unsigned char *pixels);
+ void YV12_to_YUV422_altivec(short*Y, short*U, short*V,
+ unsigned char *data, int xsize, int ysize);
+# ifndef NO_VECTORINT_TO_VECTORUNSIGNEDINT
+ void YUV422_to_YV12_altivec(short*pY, short*pY2, short*pU, short*pV,
+ unsigned char *gem_image, int xsize, int ysize);
+# endif
+#endif /* AltiVec */
+
+/* SSE2 */
+#ifdef __SSE2__
+void RGBA_to_UYVY_SSE2(unsigned char *rgbadata,
+ size_t size,
+ unsigned char *yuvdata);
+void UYVY_to_RGBA_SSE2(unsigned char *yuvdata,
+ size_t size,
+ unsigned char *rgbadata);
+void UYVY_to_RGB_SSE2(unsigned char *yuvdata,
+ size_t size,
+ unsigned char *rgbadata);
+#endif /* SSE2 */
+
+/* in case somebody has an old machine... */
+#ifdef __MMX__
+
+#endif /* MMX */
+
+#endif /* INCLUDE_GEMPIXCONVERT_SIMD_H_ */
diff --git a/externals/gridflow/bundled/Base/GemPixDualObj.h b/externals/gridflow/bundled/Base/GemPixDualObj.h
new file mode 100644
index 00000000..ba039e2c
--- /dev/null
+++ b/externals/gridflow/bundled/Base/GemPixDualObj.h
@@ -0,0 +1,190 @@
+/*-----------------------------------------------------------------
+LOG
+ GEM - Graphics Environment for Multimedia
+
+ An object which accepts two pixes.
+
+ Copyright (c) 1997-1999 Mark Danks. mark@danks.org
+ Copyright (c) Günther Geiger. geiger@epy.co.at
+ Copyright (c) 2001-2002 IOhannes m zmoelnig. forum::für::umläute. IEM. zmoelnig@iem.kug.ac.at
+ Copyright (c) 2002 James Tittle & Chris Clepper
+ For information on usage and redistribution, and for a DISCLAIMER OF ALL
+ WARRANTIES, see the file, "GEM.LICENSE.TERMS" in this distribution.
+
+-----------------------------------------------------------------*/
+
+#ifndef INCLUDE_GEMPIXDUALOBJ_H_
+#define INCLUDE_GEMPIXDUALOBJ_H_
+
+#define NEW_DUAL_PIX
+
+#include "Base/GemPixObj.h"
+
+/*-----------------------------------------------------------------
+-------------------------------------------------------------------
+CLASS
+ GemPixDualObj
+
+ An object which accepts two pixes.
+
+DESCRIPTION
+
+ Inlet for a gem - "gem_right"
+
+ "gem_right" - The second gem list
+
+-----------------------------------------------------------------*/
+class GEM_EXTERN GemPixDualObj : public GemPixObj
+{
+ public:
+
+ //////////
+ // Constructor
+ GemPixDualObj();
+
+ protected:
+
+ //////////
+ // Destructor
+ virtual ~GemPixDualObj();
+
+ void render(GemState *state);
+
+ //////////
+ // Derived classes should NOT override this!
+ // This makes sure that the images are the same size.
+ // This calls the other process functions based on the input images.
+ virtual void processImage(imageStruct &image);
+
+#ifndef NEW_DUAL_PIX
+ //////////
+ // The derived class HAS override this.
+ // This is called whenever a new image comes through and
+ // both of the image structs are RGBA
+ virtual void processDualImage(imageStruct &image, imageStruct &right) = 0;
+
+ //////////
+ // The derived class CAN override this.
+ // This is called whenever a new image comes through and both
+ // of the image structs are gray8.
+ // The default behavior is to output an error.
+ virtual void processDualGray(imageStruct &image, imageStruct &right);
+
+ //////////
+ // The derived class CAN override this.
+ // This is called whenever a new image comes through and
+ // the left image is an RGBA while the right is a gray8.
+ // The default behavior is to output an error.
+ virtual void processRightGray(imageStruct &image, imageStruct &right);
+
+ //////////
+ // The derived class CAN override this.
+ // This is called whenever a new image comes through and
+ // the left image is a gray8, the right is an RGBA
+ // The default behavior is to output an error.
+ virtual void processLeftGray(imageStruct &image, imageStruct &right);
+
+ //////////
+ // The derived class CAN override this.
+ // This is called whenever a new image comes through and both
+ // of the image structs are YUV.
+ // The default behavior is to output an error.
+ virtual void processDualYUV(imageStruct &image, imageStruct &right);
+
+ //////////
+ // The derived class CAN override this.
+ // This is called whenever a new image comes through and
+ // the left image is an RGBA while the right is a YUV.
+ // The default behavior is to output an error.
+ virtual void processRightYUV(imageStruct &image, imageStruct &right);
+
+ //////////
+ // The derived class CAN override this.
+ // This is called whenever a new image comes through and
+ // the left image is a YUV, the right is an RGBA
+ // The default behavior is to output an error.
+ virtual void processLeftYUV(imageStruct &image, imageStruct &right);
+#else
+ //////////
+ // The derived class SHOULD override this, if it provides a method for "all" formats
+ virtual void processDualImage(imageStruct &left, imageStruct &right);
+ // Here come the more specific dual-processors
+ // The derived class SHOULD override these as needed
+
+ /* for simplicity this is done via preprocessor defines:
+ * the functions defined are like :
+ ** processRGBA_RGBA(left, right);
+ */
+
+#define PROCESS_DUALIMAGE(CS1, CS2) \
+ virtual void process##CS1 ##_##CS2 (imageStruct &left, imageStruct &right){processDualImage(left, right);}
+ PROCESS_DUALIMAGE(RGBA, RGBA);
+ PROCESS_DUALIMAGE(RGBA, Gray);
+ PROCESS_DUALIMAGE(RGBA, YUV );
+
+ PROCESS_DUALIMAGE(Gray, RGBA);
+ PROCESS_DUALIMAGE(Gray, Gray);
+ PROCESS_DUALIMAGE(Gray, YUV );
+
+ PROCESS_DUALIMAGE(YUV, RGBA);
+ PROCESS_DUALIMAGE(YUV, Gray);
+ PROCESS_DUALIMAGE(YUV, YUV );
+#undef PROCESS_DUALIMAGE
+
+ /* for simplicity this is done via preprocessor defines:
+ * the functions defined are like :
+ ** processRGBA_Altivec(left, right);
+ */
+#define PROCESS_DUALIMAGE_SIMD(CS1, CS2,_SIMD_EXT) \
+ virtual void process##CS1 ##_##_SIMD_EXT (imageStruct &left, imageStruct &right){ \
+ process##CS1 ##_##CS2 (left, right);}
+
+ PROCESS_DUALIMAGE_SIMD(RGBA, RGBA, MMX);
+ PROCESS_DUALIMAGE_SIMD(RGBA, MMX , SSE2);
+ PROCESS_DUALIMAGE_SIMD(RGBA, RGBA, Altivec);
+
+ PROCESS_DUALIMAGE_SIMD(YUV , YUV , MMX);
+ PROCESS_DUALIMAGE_SIMD(YUV , MMX , SSE2);
+ PROCESS_DUALIMAGE_SIMD(YUV , YUV , Altivec);
+
+ PROCESS_DUALIMAGE_SIMD(Gray, Gray, MMX);
+ PROCESS_DUALIMAGE_SIMD(Gray, MMX , SSE2);
+ PROCESS_DUALIMAGE_SIMD(Gray, Gray, Altivec);
+#undef PROCESS_DUALIMAGE_SIMD
+
+#endif
+ //////////
+ virtual void postrender(GemState *);
+ virtual void stopRendering();
+ virtual void rightstopRendering() { ; }
+ virtual void rightRender(GemState *state);
+ virtual void rightPostrender(GemState *) { ; }
+ virtual void rightStoprender() { ; }
+
+ //////////
+ GemCache *m_cacheRight;
+
+ //////////
+ pixBlock *m_pixRight;
+
+ int m_pixRightValid;
+ int org_pixRightValid;
+
+ //////////
+ t_inlet *m_inlet;
+
+ //////////
+ // creation callback
+ static void real_obj_setupCallback(t_class *classPtr)
+ { GemPixObj::real_obj_setupCallback(classPtr); GemPixDualObj::obj_setupCallback(classPtr); }
+
+ private:
+
+ static inline GemPixDualObj *GetMyClass(void *data) {return((GemPixDualObj *)((Obj_header *)data)->data);}
+
+ //////////
+ // Static member functions
+ static void obj_setupCallback(t_class *classPtr);
+ static void gem_rightMessCallback(void *x, t_symbol *s, int argc, t_atom *argv);
+};
+#endif // for header file
diff --git a/externals/gridflow/bundled/Base/GemPixImageLoad.h b/externals/gridflow/bundled/Base/GemPixImageLoad.h
new file mode 100644
index 00000000..5274e692
--- /dev/null
+++ b/externals/gridflow/bundled/Base/GemPixImageLoad.h
@@ -0,0 +1,37 @@
+/*-----------------------------------------------------------------
+LOG
+ GEM - Graphics Environment for Multimedia
+
+ GemPixImageLoad.h
+ - code to load in and resize an image
+ - part of GEM
+
+ Copyright (c) 1997-1999 Mark Danks. mark@danks.org
+ Copyright (c) Günther Geiger. geiger@epy.co.at
+ Copyright (c) 2001-2002 IOhannes m zmoelnig. forum::für::umläute. IEM. zmoelnig@iem.kug.ac.at
+ For information on usage and redistribution, and for a DISCLAIMER OF ALL
+ WARRANTIES, see the file, "GEM.LICENSE.TERMS" in this distribution.
+
+-----------------------------------------------------------------*/
+
+#ifndef INCLUDE_GEMPIXIMAGELOAD_H_
+#define INCLUDE_GEMPIXIMAGELOAD_H_
+
+#include "Base/GemExportDef.h"
+
+struct imageStruct;
+
+// image2mem() reads an image file into memory
+// and a pointer to an imageStruct
+// NULL = failure
+//
+// format:
+// returns either GL_LUMINANCE or GL_RGBA
+//
+// automatically allocates the memory for the user
+//
+// This can read TIFF, SGI, and JPG images
+//
+GEM_EXTERN extern imageStruct *image2mem(const char *filename);
+
+#endif
diff --git a/externals/gridflow/bundled/Base/GemPixImageSave.h b/externals/gridflow/bundled/Base/GemPixImageSave.h
new file mode 100644
index 00000000..ccbe91ae
--- /dev/null
+++ b/externals/gridflow/bundled/Base/GemPixImageSave.h
@@ -0,0 +1,38 @@
+/*-----------------------------------------------------------------
+LOG
+ GEM - Graphics Environment for Multimedia
+
+ Gempiximagesave.h
+ - code to save an image
+ - part of GEM
+
+ Copyright (c) 1997-1999 Mark Danks. mark@danks.org
+ Copyright (c) Günther Geiger. geiger@epy.co.at
+ Copyright (c) 2001-2002 IOhannes m zmoelnig. forum::für::umläute. IEM. zmoelnig@iem.kug.ac.at
+ For information on usage and redistribution, and for a DISCLAIMER OF ALL
+ WARRANTIES, see the file, "GEM.LICENSE.TERMS" in this distribution.
+
+-----------------------------------------------------------------*/
+
+#ifndef INCLUDE_GEMPIXIMAGESAVE_H_
+#define INCLUDE_GEMPIXIMAGESAVE_H_
+
+#include "Base/GemExportDef.h"
+
+struct imageStruct;
+
+// image2mem() reads an image file into memory
+// and a pointer to an imageStruct
+// NULL = failure
+//
+// format:
+// returns either GL_LUMINANCE or GL_RGBA
+//
+// automatically allocates the memory for the user
+//
+// This can read TIFF, SGI, and JPG images
+//
+GEM_EXTERN extern int mem2image(imageStruct *image, const char *filename, const int type);
+
+
+#endif
diff --git a/externals/gridflow/bundled/Base/GemPixObj.h b/externals/gridflow/bundled/Base/GemPixObj.h
new file mode 100644
index 00000000..5d9073c7
--- /dev/null
+++ b/externals/gridflow/bundled/Base/GemPixObj.h
@@ -0,0 +1,142 @@
+/*-----------------------------------------------------------------
+LOG
+ GEM - Graphics Environment for Multimedia
+
+ Base class for pix class gem objects
+
+ Copyright (c) 1997-1999 Mark Danks. mark@danks.org
+ Copyright (c) Günther Geiger. geiger@epy.co.at
+ Copyright (c) 2001-2002 IOhannes m zmoelnig. forum::für::umläute. IEM. zmoelnig@iem.kug.ac.at
+ For information on usage and redistribution, and for a DISCLAIMER OF ALL
+ WARRANTIES, see the file, "GEM.LICENSE.TERMS" in this distribution.
+
+-----------------------------------------------------------------*/
+
+#ifndef INCLUDE_GEMPIXOBJ_H_
+#define INCLUDE_GEMPIXOBJ_H_
+
+#include "Base/GemBase.h"
+#include "Base/GemPixUtil.h"
+#include "stdlib.h"
+#include "string.h"
+#include "math.h"
+
+/*-----------------------------------------------------------------
+-------------------------------------------------------------------
+CLASS
+ GemPixObj
+
+ Base class for pix class gem objects
+
+DESCRIPTION
+
+-----------------------------------------------------------------*/
+class GEM_EXTERN GemPixObj : public GemBase
+{
+ public:
+
+ //////////
+ // Constructor
+ GemPixObj();
+
+ protected:
+
+ //////////
+ // Destructor
+ virtual ~GemPixObj() { }
+
+ //////////
+ // The derived class should override this if it provides
+ // processing independent of the image.format
+ // This is called whenever a new image comes through.
+ // The default is to output an error
+ virtual void processImage(imageStruct &image);
+
+ //////////
+ // The derived class should override this.
+ // This is called whenever a new RGB image comes through.
+ // The default is to call processImage().
+ virtual void processRGBImage(imageStruct &image);
+
+ //////////
+ // The derived class should override this.
+ // This is called whenever a new RGBA image comes through.
+ // The default is to call processImage().
+ virtual void processRGBAImage(imageStruct &image);
+ // SIMD-optimized functions: by default the non-optimized function is called
+ virtual void processRGBAMMX(imageStruct &image);
+ virtual void processRGBASSE2(imageStruct &image);
+ virtual void processRGBAAltivec(imageStruct &image);
+
+ //////////
+ // The derived class should override this.
+ // This is called whenever a new gray8 image comes through.
+ // The default is to call processImage().
+ virtual void processGrayImage(imageStruct &image);
+ // SIMD-optimized functions: by default the non-optimized function is called
+ virtual void processGrayMMX(imageStruct &image);
+ virtual void processGraySSE2(imageStruct &image);
+ virtual void processGrayAltivec(imageStruct &image);
+
+ //////////
+ // The derived class should override this.
+ // This is called whenever a new YUV422 image comes through.
+ // The default is to call processImage().
+ virtual void processYUVImage(imageStruct &image);
+ // SIMD-optimized functions: by default the non-optimized function is called
+ virtual void processYUVMMX(imageStruct &image);
+ virtual void processYUVSSE2(imageStruct &image);
+ virtual void processYUVAltivec(imageStruct &image);
+
+ //////////
+ // If the derived class needs the image resent.
+ // This sets the dirty bit on the pixBlock.
+ void setPixModified();
+
+ //////////
+ // Turn on/off processing
+ void processOnOff(int on);
+
+ //////////
+ // the pixBlock-cache
+ pixBlock cachedPixBlock;
+ pixBlock *orgPixBlock;
+
+ //////////
+ int m_processOnOff;
+ int m_simd;
+
+ //////////
+ // creation callback
+ static void real_obj_setupCallback(t_class *classPtr) {
+ GemBase::real_obj_setupCallback(classPtr);
+ GemPixObj::obj_setupCallback(classPtr);
+ }
+
+ //////////
+ // The derived class should NOT override this unless they have some
+ // very special behavior.
+ // Do the rendering, which calls processImage or processGrayImage, etc...
+ // save the image-information
+ virtual void render(GemState *state);
+ // turn the pointer back to the old data after rendering
+ virtual void postrender(GemState *state);
+
+ void startRendering(void) {
+ //post("start rendering");
+ setPixModified();
+ }
+
+ private:
+
+ static inline GemPixObj *GetMyClass(void *data) {return((GemPixObj *)((Obj_header *)data)->data);}
+
+ //////////
+ // static member functions
+ static void obj_setupCallback(t_class *classPtr);
+ static void floatMessCallback(void *data, float n);
+ static void simdMessCallback(void *data, float n);
+};
+
+
+#endif // for header file
diff --git a/externals/gridflow/bundled/Base/GemPixPete.h b/externals/gridflow/bundled/Base/GemPixPete.h
new file mode 100644
index 00000000..be3c2e19
--- /dev/null
+++ b/externals/gridflow/bundled/Base/GemPixPete.h
@@ -0,0 +1,219 @@
+/*-----------------------------------------------------------------
+LOG
+ GEM - Graphics Environment for Multimedia
+
+ helper stuff for ports of Pete's Plugins
+
+ http://www.petewarden.com
+
+ Copyright (c) 2004 IOhannes m zmoelnig. forum::für::umläute. IEM. zmoelnig@iem.kug.ac.at
+ For information on usage and redistribution, and for a DISCLAIMER OF ALL
+ WARRANTIES, see the file, "GEM.LICENSE.TERMS" in this distribution.
+
+-----------------------------------------------------------------*/
+#ifndef INCLUDE_GEMPIXPETE_H_
+#define INCLUDE_GEMPIXPETE_H_
+
+
+// utility functions from PeteHelpers.h
+typedef unsigned long U32;
+typedef unsigned short U16;
+typedef unsigned char U8;
+
+
+/* is this only on my system ?
+ i thought Gem's YUV is UYVY and not YVYU
+ seems weird... (jmz)
+*/
+#ifdef __APPLE__
+
+# define SHIFT_ALPHA (24)
+# define SHIFT_RED (16)
+# define SHIFT_GREEN (8)
+# define SHIFT_BLUE (0)
+
+# define SHIFT_U (24)
+# define SHIFT_Y1 (16)
+# define SHIFT_V (8)
+# define SHIFT_Y2 (0)
+
+#else
+
+# define SHIFT_ALPHA (24)
+# define SHIFT_RED (16)
+# define SHIFT_GREEN (8)
+# define SHIFT_BLUE (0)
+
+# define SHIFT_U (0)
+# define SHIFT_Y1 (8)
+# define SHIFT_V (16)
+# define SHIFT_Y2 (24)
+#endif
+
+const float Pete_Pi=3.141582f;
+const float Pete_TwoPi=(2.0f*Pete_Pi);
+const float Pete_HalfPi=(0.5f*Pete_Pi);
+
+static inline void Pete_ZeroMemory(void* pMemory,int nCount) {
+ char* pCurrent=(char*)pMemory;
+ char* pEnd=(pCurrent+nCount);
+ // while (pCurrent<pEnd) *pCurrent=0;
+ // pCurrent+=1;
+ // }
+ while(pCurrent<pEnd)*pCurrent++=0;
+// memset(pMemory,0,nCount);
+}
+
+typedef U32 PETE_PIXELDATA32;
+#define SIZEOF_PETE_PIXELDATA32 (4)
+
+typedef U32 PETE_PIXELDATA24;
+#define SIZEOF_PETE_PIXELDATA24 (3)
+
+typedef U16 PETE_PIXELDATA16;
+#define SIZEOF_PETE_PIXELDATA16 (2)
+
+static inline void Pete_CopyAndConvert24BitTo32Bit(PETE_PIXELDATA24* pSource,PETE_PIXELDATA32* pOutput,int nPixelCount) {
+
+ char* pSourceEnd=((char*)pSource)+(nPixelCount*SIZEOF_PETE_PIXELDATA24);
+ char* pCurrentSource=((char*)pSource);
+ char* pCurrentOutput=((char*)pOutput);
+
+ while (pCurrentSource<pSourceEnd) {
+ *((PETE_PIXELDATA32*)pCurrentOutput)=
+ *((PETE_PIXELDATA24*)pCurrentSource);
+
+ pCurrentSource+=SIZEOF_PETE_PIXELDATA24;
+ pCurrentOutput+=SIZEOF_PETE_PIXELDATA32;
+ }
+}
+
+static inline void Pete_CopyAndConvert32BitTo24Bit(PETE_PIXELDATA32* pSource,PETE_PIXELDATA24* pOutput,int nPixelCount) {
+
+ char* pSourceEnd=((char*)pSource)+(nPixelCount*SIZEOF_PETE_PIXELDATA32);
+ char* pCurrentSource=((char*)pSource);
+ char* pCurrentOutput=((char*)pOutput);
+
+ while (pCurrentSource<pSourceEnd) {
+ *((PETE_PIXELDATA24*)pCurrentOutput)=
+ *((PETE_PIXELDATA32*)pCurrentSource);
+
+ pCurrentSource+=SIZEOF_PETE_PIXELDATA32;
+ pCurrentOutput+=SIZEOF_PETE_PIXELDATA24;
+ }
+}
+
+static inline void Pete_InPlaceConvert24BitTo32Bit(PETE_PIXELDATA24* pBuffer,int nPixelCount) {
+ char* pBufferStart=(char*)pBuffer;
+
+ char* pBuffer32Current=(pBufferStart+((nPixelCount-1)*SIZEOF_PETE_PIXELDATA32));
+ char* pBuffer24Current=(pBufferStart+((nPixelCount-1)*SIZEOF_PETE_PIXELDATA24));
+
+ while (pBuffer32Current>=pBufferStart) {
+
+ *((PETE_PIXELDATA32*)pBuffer32Current)=
+ *((PETE_PIXELDATA24*)pBuffer24Current);
+
+ pBuffer32Current-=SIZEOF_PETE_PIXELDATA32;
+ pBuffer24Current-=SIZEOF_PETE_PIXELDATA24;
+ }
+}
+
+static inline void Pete_CopyAndConvert16Bit565To32Bit(PETE_PIXELDATA16* pSource,PETE_PIXELDATA32* pOutput,int nPixelCount) {
+
+ char* pSourceEnd=((char*)pSource)+(nPixelCount*SIZEOF_PETE_PIXELDATA16);
+ char* pCurrentSource=((char*)pSource);
+ char* pCurrentOutput=((char*)pOutput);
+
+ while (pCurrentSource<pSourceEnd) {
+
+ PETE_PIXELDATA16 SourceColour=
+ *((PETE_PIXELDATA16*)pCurrentSource);
+
+ const int nMaskedRed=(SourceColour>>11)&31;
+ const int nMaskedGreen=(SourceColour>>5)&63;
+ const int nMaskedBlue=(SourceColour>>0)&31;
+
+ const int nNormalizedRed=(nMaskedRed<<3)|(nMaskedRed>>2);
+ const int nNormalizedGreen=(nMaskedGreen<<2)|(nMaskedGreen>>4);
+ const int nNormalizedBlue=(nMaskedBlue<<3)|(nMaskedBlue>>2);
+
+ const PETE_PIXELDATA32 OutputColour=
+ (nNormalizedRed<<16)|
+ (nNormalizedGreen<<8)|
+ (nNormalizedBlue<<0);
+
+ *((PETE_PIXELDATA32*)pCurrentOutput)=OutputColour;
+
+ pCurrentSource+=SIZEOF_PETE_PIXELDATA16;
+ pCurrentOutput+=SIZEOF_PETE_PIXELDATA32;
+
+ }
+
+}
+
+static inline void Pete_CopyAndConvert32BitTo16Bit565(PETE_PIXELDATA32* pSource,PETE_PIXELDATA16* pOutput,int nPixelCount) {
+
+ char* pSourceEnd=((char*)pSource)+(nPixelCount*SIZEOF_PETE_PIXELDATA32);
+ char* pCurrentSource=((char*)pSource);
+ char* pCurrentOutput=((char*)pOutput);
+
+ while (pCurrentSource<pSourceEnd) {
+
+ PETE_PIXELDATA32 SourceColour=
+ *((PETE_PIXELDATA32*)pCurrentSource);
+
+ const int nSourceRed=(SourceColour>>16)&0xff;
+ const int nSourceGreen=(SourceColour>>8)&0xff;
+ const int nSourceBlue=(SourceColour>>0)&0xff;
+
+ const int nMaskedRed=(nSourceRed>>3);
+ const int nMaskedGreen=(nSourceGreen>>2);
+ const int nMaskedBlue=(nSourceBlue>>3);
+
+ PETE_PIXELDATA16 OutputColour=
+ (nMaskedRed<<11)|
+ (nMaskedGreen<<5)|
+ (nMaskedBlue<<0);
+
+ *((PETE_PIXELDATA16*)pCurrentOutput)=OutputColour;
+
+ pCurrentSource+=SIZEOF_PETE_PIXELDATA32;
+ pCurrentOutput+=SIZEOF_PETE_PIXELDATA16;
+ }
+}
+typedef void* SPete_MemHandle;
+
+inline SPete_MemHandle Pete_NewHandle(int nBytesToAlloc) {
+ return malloc(nBytesToAlloc);
+}
+
+inline void Pete_FreeHandle(SPete_MemHandle InHandle) {
+ free(InHandle);
+}
+
+inline void* Pete_LockHandle(SPete_MemHandle InHandle) {
+ return InHandle;
+}
+
+inline void Pete_UnLockHandle(SPete_MemHandle InHandle) {
+ // do nothing
+}
+
+const int cnBiggestSignedInt=0x7fffffff;
+
+inline int GetLuminance(const U32 inColour) {
+ const int nRed=(inColour&(0xff<<SHIFT_RED))>>16;
+ const int nGreen=(inColour&(0xff<<SHIFT_GREEN))>>8;
+ const int nBlue=(inColour&(0xff<<SHIFT_BLUE))>>0;
+
+ const int nLuminance =
+ ((77 * nRed)+
+ (150* nGreen)+ // used to be 50 which is plain wron
+ (29 * nBlue));
+
+ return nLuminance;
+}
+
+#endif /* INCLUDE_GEMPIXPETE_H_ */
+// end of PeteHelpers.h stuff
diff --git a/externals/gridflow/bundled/Base/GemPixUtil.h b/externals/gridflow/bundled/Base/GemPixUtil.h
new file mode 100644
index 00000000..88ef0afc
--- /dev/null
+++ b/externals/gridflow/bundled/Base/GemPixUtil.h
@@ -0,0 +1,284 @@
+/*-----------------------------------------------------------------
+LOG
+ GEM - Graphics Environment for Multimedia
+
+ GemPixUtil.h
+ - contains image functions for pix objects
+ - part of GEM
+
+ Copyright (c) 1997-1999 Mark Danks. mark@danks.org
+ Copyright (c) Günther Geiger. geiger@epy.co.at
+ Copyright (c) 2001-2002 IOhannes m zmoelnig. forum::für::umläute. IEM. zmoelnig@iem.kug.ac.at
+ For information on usage and redistribution, and for a DISCLAIMER OF ALL
+ WARRANTIES, see the file, "GEM.LICENSE.TERMS" in this distribution.
+
+-----------------------------------------------------------------*/
+
+#ifndef INCLUDE_GEMPIXUTIL_H_
+#define INCLUDE_GEMPIXUTIL_H_
+
+#include "Base/GemGL.h"
+
+#ifdef __APPLE__
+# include <QuickTime/QuickTime.h>
+#endif // __APPLE__
+
+#include <string.h>
+#include <stdlib.h>
+
+
+
+///////////////////////////////////////////////////////////////////////////////
+// Color component defines
+//
+// These should be used to reference the various color channels
+///////////////////////////////////////////////////////////////////////////////
+
+/* RGBA */
+
+#if GL_RGBA_GEM == GL_RGBA
+const int chRed = 0;
+const int chGreen = 1;
+const int chBlue = 2;
+const int chAlpha = 3;
+#else
+const int chAlpha = 0;
+const int chRed = 1;
+const int chGreen = 2;
+const int chBlue = 3;
+#endif
+
+
+/* Gray */
+const int chGray = 0;
+
+/* YUV422 */
+const int chU = 0;
+const int chY0 = 1;
+const int chV = 2;
+const int chY1 = 3;
+
+// basic helper functions, like CLAMP and powerOfTwo
+#include "Base/GemFuncUtil.h"
+
+// utility functions from PeteHelpers.h
+#include "Base/GemPixPete.h"
+
+/*-----------------------------------------------------------------
+-------------------------------------------------------------------
+CLASS
+ imageStruct
+
+ The basic image structure
+
+-----------------------------------------------------------------*/
+// we now have a class "imageStruct";
+// since i need to compile some of the sources with an older version of Gem
+// there is a new define here:
+#define IMAGE_CLASS
+
+struct GEM_EXTERN imageStruct
+{
+ imageStruct();
+ ~imageStruct();
+
+ void info();
+ //////////
+ // columns
+ unsigned char* allocate(size_t size);
+ unsigned char* allocate();
+
+ // if we have allocated some space already, only re-allocate when needed.
+ unsigned char* reallocate(size_t size);
+ unsigned char* reallocate();
+
+ // delete the buffer (if it is ours)
+ void clear();
+
+
+ //////////
+ // dimensions of the image
+ GLint xsize;
+ GLint ysize;
+
+ //////////
+ // (average) width of 1 pixel (LUMINANCE = 1, RGBA = 4, YUV = 2)
+ GLint csize;
+
+ //////////
+ // data type - always GL_UNSIGNED_BYTE (except for OS X)
+ GLenum type;
+
+ //////////
+ // the format - either GL_RGBA, GL_LUMINANCE
+ // or GL_YCBCR_422_GEM (which is on mac-computers GL_YCBCR_422_APPLE)
+ GLenum format;
+
+ //////////
+ // is this owned by us (? what about underscores ?)
+ int notowned;
+
+ //////////
+ // gets a pixel
+ /* X,Y are the coordinates
+ * C is the offset in the interleaved data (like chRed==0 for red)
+ * you should use chRed instead of 0 (because it might not be 0)
+ */
+ // heck, why are X&Y swapped ?? (JMZ)
+ inline unsigned char GetPixel(int Y, int X, int C)
+ { return(data[Y * xsize * csize + X * csize + C]); }
+
+ //////////
+ // sets a pixel
+ /* while X and Y should be clear (coordinates),
+ * C is the offset (like chRed==0 for red).
+ * VAL is the value to set.
+ */
+ inline void SetPixel(int Y, int X, int C, unsigned char VAL)
+ { data[Y * xsize * csize + X * csize + C] = VAL; }
+
+
+ /////////
+ // gets the color of a pixel
+ void getRGB(int X, int Y, unsigned char*r, unsigned char*g, unsigned char*b);
+ void getGrey(int X, int Y, unsigned char*g);
+ void getYUV(int X, int Y, unsigned char*y, unsigned char*u, unsigned char*v);
+
+ /* following will set the whole image-data to either black or white
+ * the size of the image-data is NOT xsize*ysize*csize but datasize
+ * this is mostly slower
+ * i have put the datasize into private (like pdata) (bad idea?)
+ */
+ void setBlack();
+ void setWhite();
+
+ /* certain formats are bound to certain csizes,
+ * it's quite annoying to have to think again and again (ok, not much thinking)
+ * so we just give the format (like GL_LUMINANCE)
+ * and it will set the image format to this format
+ * and set and return the correct csize (like 1)
+ * if no format is given the current format is used
+ */
+ int setCsizeByFormat(int format);
+ int setCsizeByFormat();
+
+
+ /* various copy functions
+ * sometimes we want to copy the whole image (including pixel-data),
+ * but often it is enough to just copy the meta-data (without pixel-data)
+ * into a new imageStruct
+ */
+ void copy2Image(imageStruct *to);
+ void copy2ImageStruct(imageStruct *to); // copy the imageStruct (but not the actual data)
+ /* this is a sort of better copy2Image,
+ * which only copies the imageStruct-data if it is needed
+ */
+ void refreshImage(imageStruct *to);
+
+ /* inplace swapping Red and Blue channel */
+ void swapRedBlue ();
+
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // acquiring data including colour-transformations
+ // should be accelerated if possible
+ /* i wonder whether this is the right place to put these routines
+ * they should be stored somewhere centrally
+ * (because maybe a lot of objects would like them) (like [pix_rgba]...)
+ * but it might be better to put them (the actual conversion routines) into
+ * separate files (a separate library?)
+ * orgdata points to the actual data in the given format
+ * the datasize will be read from image.xsize, image.ysize
+ * the dest-format will be given by image.format
+ * this is maybe not really clean (the meta-data is stored in the destination,
+ * while the source has no meta-data of its own)
+ */
+ void convertTo (imageStruct*to, GLenum dest_format=0);
+ void convertFrom(imageStruct*from, GLenum dest_format=0);
+
+ void fromRGB (unsigned char* orgdata);
+ void fromRGBA (unsigned char* orgdata);
+ void fromBGR (unsigned char* orgdata);
+ void fromBGRA (unsigned char* orgdata);
+ void fromRGB16 (unsigned char* orgdata);
+ void fromGray (unsigned char* orgdata);
+ void fromGray (short* orgdata);
+ void fromUYVY (unsigned char* orgdata);
+ void fromYUY2 (unsigned char* orgdata); // YUYV
+ void fromYVYU (unsigned char* orgdata);
+ /* planar YUV420: this is rather generic and not really YV12 only */
+ void fromYV12 (unsigned char* Y, unsigned char*U, unsigned char*V);
+ /* assume that the planes are near each other: YVU */
+ void fromYV12 (unsigned char* orgdata);
+ /* assume that the planes are near each other: YVU */
+ void fromYU12 (unsigned char* orgdata);
+ /* overloading the above two in order to accept pdp YV12 packets */
+ void fromYV12 (short* Y, short*U, short*V);
+ void fromYV12 (short* orgdata);
+
+ /* aliases */
+ void fromYUV422 (unsigned char* orgdata){fromUYVY(orgdata);}
+ void fromYUV420P(unsigned char* orgdata){fromYV12(orgdata);}
+ void fromYUV420P(unsigned char*Y,unsigned char*U,unsigned char*V){fromYV12(Y,U,V);}
+
+ // "data" points to the image.
+ // the memory could(!) be reserved by this class or someone else
+ // "notowned" should be set to "1", if "data" points to foreign memory
+ // "data" is not freed directly, when the destructor is called
+ unsigned char *data; // the pointer to the data
+ private:
+ // "pdata" is the private data, and is the memory reserved by this class
+ // this data is freed when the destructor is called
+ unsigned char *pdata;
+ // "datasize" is the size of data reserved at "pdata"
+ size_t datasize;
+
+ public:
+ //////////
+ // true if the image is flipped horizontally (origin is upper-left)
+ // false if the image is openGL-conformant (origin is lower-left)
+ GLboolean upsidedown;
+
+};
+
+/*-----------------------------------------------------------------
+-------------------------------------------------------------------
+CLASS
+ pixBlock
+
+ The pix block structure
+
+-----------------------------------------------------------------*/
+struct GEM_EXTERN pixBlock
+{
+ pixBlock();
+
+ //////////
+ // the block's image
+ imageStruct image;
+
+ //////////
+ // is this a newimage since last time?
+ // ie, has it been refreshed
+ int newimage;
+
+ //////////
+ // keeps track of when new films are loaded
+ // useful for rectangle_textures on OSX
+ int newfilm;
+};
+
+///////////////////////////////////////////////////////////////////////////////
+// imageStruct utility functions
+//
+///////////////////////////////////////////////////////////////////////////////
+//////////
+// copies all of the data over and mallocs memory
+GEM_EXTERN extern void copy2Image(imageStruct *to, imageStruct *from);
+
+//////////
+// assumes that it only has to refresh the data
+GEM_EXTERN extern void refreshImage(imageStruct *to, imageStruct *from);
+
+GEM_EXTERN extern int getPixFormat(char*);
+#endif // GEMPIXUTIL_H_
diff --git a/externals/gridflow/bundled/Base/GemSIMD.h b/externals/gridflow/bundled/Base/GemSIMD.h
new file mode 100644
index 00000000..32cdb32a
--- /dev/null
+++ b/externals/gridflow/bundled/Base/GemSIMD.h
@@ -0,0 +1,111 @@
+
+/*-----------------------------------------------------------------
+LOG
+ GEM - Graphics Environment for Multimedia
+
+ include file for SIMD
+
+ Copyright (c) 1997-1999 Mark Danks. mark@danks.org
+ Copyright (c) Günther Geiger. geiger@epy.co.at
+ Copyright (c) 2001-2002 IOhannes m zmoelnig. forum::für::umläute. IEM. zmoelnig@iem.kug.ac.at
+ For information on usage and redistribution, and for a DISCLAIMER OF ALL
+ WARRANTIES, see the file, "GEM.LICENSE.TERMS" in this distribution.
+
+-----------------------------------------------------------------*/
+
+/*
+ * compiler-issues:
+ *
+ * gcc: when gcc is invoked with "-mmmx" (or "-msse2" or "-maltivec")
+ * the defines __MMX__ (or corresponding) will be defined automatically
+ *
+ * vc6: you will have to install the microsoft processor-pack to use MMX/SSE2
+ * you have to have the sp5 for vc6 installed (note: do not install sp6!!)
+ * vc6/vc7: (i think) you need to define __MMX__ (and friends) by hand
+ */
+
+#ifndef INCLUDE_GEMSIMD_H_
+#define INCLUDE_GEMSIMD_H_
+
+#define GEM_VECTORALIGNMENT 128
+
+const int GEM_SIMD_NONE=0;
+const int GEM_SIMD_MMX=1;
+const int GEM_SIMD_SSE2=2;
+const int GEM_SIMD_ALTIVEC=3;
+
+
+/* include for SIMD on PC's */
+#ifdef __SSE2__
+#include <emmintrin.h>
+// for icc this should be <dvec.h>
+typedef union{
+ unsigned char c[16];
+ __m128i v;
+} vector_128;
+#elif defined __VEC__
+/* for AltiVec (PowerPC) */
+typedef union{
+ unsigned char c[16];
+ vector unsigned char v;
+} vector_128;
+#endif
+
+#if defined __MMX__
+# include <mmintrin.h>
+// for icc this should be <ivec.h>
+typedef union{
+ __m64 v; unsigned char c[8];
+} vector64i;
+
+#endif
+
+
+#ifdef __SSE__
+#include <xmmintrin.h>
+
+typedef union{
+ __m128 m; float f[4];
+} vector128f;
+#endif
+
+#include "GemExportDef.h"
+
+
+/* this is a help-class to query the capabilities of the cpu
+ * whenever you want to use SIMD-optimized code, you should
+ * make sure you chose the code-block based on the "cpuid" value
+ * of this class and NOT simply on preprocessor defines.
+ *
+ * this class needs only be instantiated once (and it is done in GemMan)
+ * this sets the cpuid
+ */
+class GEM_EXTERN GemSIMD
+{
+ public:
+ GemSIMD();
+ ~GemSIMD();
+
+ /* this gets the "cpuid" (something like GEM_SIMD_NONE) */
+ static int getCPU();
+
+ /* change the cpuid returned by getCPU()
+ * you can only set the cpuid to something that is actually supported
+ * by your processor
+ */
+ static int requestCPU(int cpuid);
+
+ /* performs a runtime-check (if possible) to determine the capabilities
+ * of the CPU
+ * sets realcpuid appropriately and returns this value
+ */
+ static int simd_runtime_check(void);
+
+ private:
+ /* this is the maximum capability of the CPU */
+ static int realcpuid;
+ /* this is the current choosen capability (normally this equals realcpuid) */
+ static int cpuid;
+};
+
+#endif /* INCLUDE_GEMSIMD_H_ */
diff --git a/externals/gridflow/bundled/Base/GemShape.h b/externals/gridflow/bundled/Base/GemShape.h
new file mode 100644
index 00000000..101c975d
--- /dev/null
+++ b/externals/gridflow/bundled/Base/GemShape.h
@@ -0,0 +1,115 @@
+/*-----------------------------------------------------------------
+LOG
+ GEM - Graphics Environment for Multimedia
+
+ Base class for shapes
+
+ Copyright (c) 1997-1999 Mark Danks. mark@danks.org
+ Copyright (c) Günther Geiger. geiger@epy.co.at
+ Copyright (c) 2001-2002 IOhannes m zmoelnig. forum::für::umläute. IEM. zmoelnig@iem.kug.ac.at
+ For information on usage and redistribution, and for a DISCLAIMER OF ALL
+ WARRANTIES, see the file, "GEM.LICENSE.TERMS" in this distribution.
+
+-----------------------------------------------------------------*/
+
+#ifndef INCLUDE_GEMSHAPE_H_
+#define INCLUDE_GEMSHAPE_H_
+
+#include "Base/GemBase.h"
+
+/*-----------------------------------------------------------------
+-------------------------------------------------------------------
+CLASS
+ GemShape
+
+ Base class for shapes
+
+DESCRIPTION
+
+ Inlet for a float - "ft1"
+
+ "ft1" - the size of the shape
+ "draw" - the drawing style
+ "width" - the line width when drawing with lines
+
+-----------------------------------------------------------------*/
+class GEM_EXTERN GemShape : public GemBase
+{
+ public:
+
+ //////////
+ // Constructor
+ // [in] size - A size of 0. means to just use the default (ie, 1.)
+ GemShape(t_floatarg size);
+ GemShape();
+
+ protected:
+
+ //////////
+ // Destructor
+ virtual ~GemShape();
+
+ //-----------------------------------
+ // GROUP: Access functions
+ //-----------------------------------
+
+ //////////
+ // The width of the lines in line draw mode
+ void linewidthMess(float linewidth);
+
+ //////////
+ // The size of the object
+ void sizeMess(float size);
+
+ //////////
+ // How the object should be drawn
+ virtual void typeMess(t_symbol *type);
+
+ //-----------------------------------
+ // GROUP: Utility functions
+ //-----------------------------------
+
+ void SetVertex(GemState* state,float x, float y, float z, float tx, float ty,int curCoord);
+
+ //-----------------------------------
+ // GROUP: Member variables
+ //-----------------------------------
+
+ //////////
+ // The line width for GL_LINE mode
+ GLfloat m_linewidth;
+
+ //////////
+ // The size of the object
+ GLfloat m_size;
+
+ //////////
+ // The drawing style (GL_LINE, GL_POLYGON, etc)
+ GLenum m_drawType;
+
+ //////////
+ // The size inlet
+ t_inlet *m_inlet;
+
+ //-----------------------------------
+ // GROUP: Setup functions
+ //-----------------------------------
+
+ //////////
+ // creation callback
+ static void real_obj_setupCallback(t_class *classPtr)
+ { GemBase::real_obj_setupCallback(classPtr); GemShape::obj_setupCallback(classPtr); }
+
+ private:
+
+ static inline GemShape *GetMyClass(void *data) {return((GemShape *)((Obj_header *)data)->data);}
+
+ //////////
+ // static member functions
+ static void obj_setupCallback(t_class *classPtr);
+ static void linewidthMessCallback(void *data, t_floatarg linewidth);
+ static void typeMessCallback(void *data, t_symbol *type);
+ static void sizeMessCallback(void *data, t_floatarg size);
+};
+
+#endif // for header file
diff --git a/externals/gridflow/bundled/Base/GemState.h b/externals/gridflow/bundled/Base/GemState.h
new file mode 100644
index 00000000..b41d2ee3
--- /dev/null
+++ b/externals/gridflow/bundled/Base/GemState.h
@@ -0,0 +1,150 @@
+/*-----------------------------------------------------------------
+ LOG
+ GEM - Graphics Environment for Multimedia
+
+ The state to pass among GEM objects
+
+ Copyright (c) 1997-2000 Mark Danks. mark@danks.org
+ Copyright (c) Günther Geiger. geiger@epy.co.at
+ Copyright (c) 2001-2002 IOhannes m zmoelnig. forum::für::umläute. IEM. zmoelnig@iem.kug.ac.at
+ For information on usage and redistribution, and for a DISCLAIMER OF ALL
+ WARRANTIES, see the file, "GEM.LICENSE.TERMS" in this distribution.
+
+ -----------------------------------------------------------------*/
+
+#ifndef INCLUDE_GEMSTATE_H_
+#define INCLUDE_GEMSTATE_H_
+
+#include "Base/GemExportDef.h"
+#include "Base/GemGL.h"
+
+struct pixBlock;
+class TexCoord;
+
+/*-----------------------------------------------------------------
+ -------------------------------------------------------------------
+ CLASS
+ TexCoord
+
+
+ DESCRIPTION
+
+ -----------------------------------------------------------------*/
+class GEM_EXTERN TexCoord
+{
+ public:
+ TexCoord() : s(0.f), t(0.f) { }
+ TexCoord(float s_, float t_) : s(s_), t(t_) { }
+ float s;
+ float t;
+};
+
+
+/*-----------------------------------------------------------------
+ -------------------------------------------------------------------
+ CLASS
+ GemState
+
+ The state to pass among GEM objects
+
+ DESCRIPTION
+
+ -----------------------------------------------------------------*/
+class GEM_EXTERN GemState
+{
+ public:
+
+ //////////
+ // Has something changed since the last time?
+ int dirty;
+
+ //////////
+ // Are we in a display list creation?
+ int inDisplayList;
+
+ //////////
+ // Lighting on?
+ int lighting;
+
+ //////////
+ // Smooth shading (flat is other type)
+ int smooth;
+
+ //////////
+ // Texture mapping on?
+ // 0..off
+ // 1..normalized texture
+ // 2..rectangle texture
+ int texture;
+
+ //////////
+ // The image to texture map
+ pixBlock *image;
+
+ //////////
+ // Texture coordinates.
+ // This can be NULL if there aren't any coordinates
+ TexCoord *texCoords;
+
+ //////////
+ // The number of TexCoords
+ int numTexCoords;
+
+ //////////
+ // The number of multiTexUnits
+ // default = 0, max = 7
+ int multiTexUnits;
+
+ //////////
+ // Milliseconds since last frame
+ // If in Stereoscopic mode, then it is the same number for both left
+ // and right renderings
+ float tickTime;
+
+ //////////////////
+ // the default draw-type (might be overriden within a Geo)
+ GLenum drawType;
+
+ //////////
+ // how deep is the current stack /* 4 fields for the 4 stacks */
+ int stackDepth[4];
+
+ ////////////
+ //vertex-array data
+ int VertexDirty; // the vertex-arrays has changed
+
+ GLfloat *VertexArray;
+ int VertexArraySize;
+ int VertexArrayStride;
+
+ GLfloat *ColorArray;
+ int HaveColorArray;
+
+ GLfloat *NormalArray;
+ int HaveNormalArray;
+
+ GLfloat *TexCoordArray;
+ int HaveTexCoordArray;
+
+ //////////
+ // Constructor
+ GemState();
+
+ float texCoordX(int num) {
+ if (texture && numTexCoords > num)
+ return texCoords[num].s;
+ else return 0.;
+ }
+
+ float texCoordY(int num) {
+ if (texture && numTexCoords > num)
+ return texCoords[num].t;
+ else return 0.;
+ }
+
+ /* reset (parts of?) the GemState: to be called from [gemhead] */
+ void reset();
+
+};
+
+#endif // for header file
diff --git a/externals/gridflow/bundled/Base/GemVector.h b/externals/gridflow/bundled/Base/GemVector.h
new file mode 100644
index 00000000..ce000833
--- /dev/null
+++ b/externals/gridflow/bundled/Base/GemVector.h
@@ -0,0 +1,77 @@
+/*-----------------------------------------------------------------
+LOG
+ GEM - Graphics Environment for Multimedia
+
+ vector-classes
+
+ zmoelnig@iem.at, tigital@mac.com
+
+ For information on usage and redistribution, and for a DISCLAIMER OF ALL
+ WARRANTIES, see the file, "GEM.LICENSE.TERMS" in this distribution.
+
+-----------------------------------------------------------------*/
+
+#ifndef INCLUDE_GEMVECTOR_H_
+#define INCLUDE_GEMVECTOR_H_
+
+#include "Base/GemExportDef.h"
+
+
+
+// This is our 2D point class. This will be used to store the UV coordinates.
+class GEM_EXTERN CVector2 {
+public:
+ float x, y;
+};
+
+
+// This is our basic 3D point/vector class
+class GEM_EXTERN CVector3 {
+public:
+ // the elements of a vector:
+ float x, y, z;
+
+ // A default constructor
+ CVector3();
+
+ // This is our constructor that allows us to initialize our data upon creating an instance
+ CVector3(float X, float Y, float Z);
+
+ // Here we overload the + operator so we can add vectors together
+ CVector3 operator+(CVector3 vVector);
+
+ // Here we overload the - operator so we can subtract vectors
+ CVector3 operator-(CVector3 vVector);
+
+ // Here we overload the - operator so we can negate the vector
+ CVector3 operator-();
+
+ // Here we overload the * operator so we can multiply by scalars
+ CVector3 operator*(float num);
+
+ // Here we overload the * operator so we can dot-multiply
+ float operator*(CVector3 vVector);
+
+ // cross-multiplication
+ CVector3 cross(CVector3 vVector);
+
+ // Here we overload the / operator so we can divide by a scalar
+ CVector3 operator/(float num);
+
+
+ // here we calculate the absolute-value of the vector
+ float abs();
+
+ // here we calculate the square of the absolute-value of the vector
+ float abs2();
+
+ // here we normalize the vector
+ CVector3 normalize();
+
+ // here we compare 2 vectors on approx. equality
+ bool equals(CVector3 vVector, float epsilon);
+
+
+};
+
+#endif /* INCLUDE_GEMVECTOR_H_ */
diff --git a/externals/gridflow/bundled/Base/GemVersion.h b/externals/gridflow/bundled/Base/GemVersion.h
new file mode 100644
index 00000000..926407f0
--- /dev/null
+++ b/externals/gridflow/bundled/Base/GemVersion.h
@@ -0,0 +1,30 @@
+#ifndef GEM_VERSION_H
+#define GEM_VERSION_H
+
+#define GEM_VERSION_MAJOR 0
+#define GEM_VERSION_MINOR 91
+#define GEM_VERSION_BUGFIX 0
+#define GEM_VERSION_CODENAME "'tigital'"
+
+
+#define STRINGIFY2(x) #x
+#define STRINGIFY(x) STRINGIFY2(x)
+
+static const char *GEM_VERSION = \
+ "" STRINGIFY(GEM_VERSION_MAJOR) \
+ "." STRINGIFY(GEM_VERSION_MINOR) \
+ "." STRINGIFY(GEM_VERSION_BUGFIX) \
+ " " GEM_VERSION_CODENAME;
+
+
+static const char *GEM_MAINTAINER = "IOhannes m zmoelnig";
+
+static const char *GEM_AUTHORS[] = {
+ "Chris Clepper",
+ "James Tittle",
+ "IOhannes m zmoelnig"};
+
+static const char* GEM_OTHERAUTHORS =
+ "Guenter Geiger, Daniel Heckenberg, Cyrille Henry, et al.";
+#endif
+
diff --git a/externals/gridflow/bundled/Base/GemVertex.h b/externals/gridflow/bundled/Base/GemVertex.h
new file mode 100644
index 00000000..c390de98
--- /dev/null
+++ b/externals/gridflow/bundled/Base/GemVertex.h
@@ -0,0 +1,37 @@
+
+/*-----------------------------------------------------------------
+LOG
+ GEM - Graphics Environment for Multimedia
+
+ include file for VertexArrays
+
+ Copyright (c) 2004 IOhannes m zmoelnig. forum::für::umläute. IEM. zmoelnig@iem.kug.ac.at
+ For information on usage and redistribution, and for a DISCLAIMER OF ALL
+ WARRANTIES, see the file, "GEM.LICENSE.TERMS" in this distribution.
+
+-----------------------------------------------------------------*/
+
+
+#ifndef INCLUDE_GEMVERTEX_H_
+#define INCLUDE_GEMVERTEX_H_
+
+#include "Base/GemBase.h"
+
+class GEM_EXTERN GemVertex : public GemBase {
+ protected:
+
+
+ //////////
+ // Constructor
+ GemVertex();
+
+ ~GemVertex();
+
+ //////////
+ // If anything in the object has changed
+ // especially, if the vertex-array has changed
+ virtual void setModified();
+};
+
+
+#endif /* INCLUDE_GEMVERTEX_H_ */
diff --git a/externals/gridflow/bundled/Base/GemWinCreate.h b/externals/gridflow/bundled/Base/GemWinCreate.h
new file mode 100644
index 00000000..79104cde
--- /dev/null
+++ b/externals/gridflow/bundled/Base/GemWinCreate.h
@@ -0,0 +1,224 @@
+/*-----------------------------------------------------------------
+
+GEM - Graphics Environment for Multimedia
+
+create a window
+
+Copyright (c) 1997-1999 Mark Danks. mark@danks.org
+Copyright (c) Günther Geiger. geiger@epy.co.at
+Copyright (c) 2001-2002 IOhannes m zmoelnig. forum::für::umläute. IEM. zmoelnig@iem.kug.ac.at
+For information on usage and redistribution, and for a DISCLAIMER OF ALL
+WARRANTIES, see the file, "GEM.LICENSE.TERMS" in this distribution.
+
+-----------------------------------------------------------------*/
+
+#ifndef INCLUDE_GEMWINCREATE_H_
+#define INCLUDE_GEMWINCREATE_H_
+#include "Base/config.h"
+
+#ifdef __unix__
+# include <GL/glx.h>
+# ifdef HAVE_LIBXXF86VM
+# include <X11/extensions/xf86vmode.h>
+# endif
+#elif defined __WIN32__
+# include <windows.h>
+#elif defined __APPLE__
+# import <AGL/agl.h>
+#else
+# error Define OS specific window creation
+#endif
+
+#include "Base/GemExportDef.h"
+
+// I hate Microsoft...I shouldn't have to do this!
+#ifdef __WIN32__
+# pragma warning( disable : 4244 )
+# pragma warning( disable : 4305 )
+# pragma warning( disable : 4091 )
+#endif
+
+#include "m_pd.h"
+
+#include <string.h>
+
+/*-----------------------------------------------------------------
+ -------------------------------------------------------------------
+ CLASS
+ WindowInfo
+
+ All of the relavent information about an OpenGL window
+
+ DESCRIPTION
+
+ -----------------------------------------------------------------*/
+class GEM_EXTERN WindowInfo
+{
+ public:
+
+ // Constructor
+ WindowInfo() :
+ fs(0),
+#ifdef __unix__
+ dpy(NULL), win(0), cmap(0), context(NULL), delete_atom(0)
+#elif defined __WIN32__
+ win(NULL), dc(NULL), context(NULL)
+#elif defined __APPLE__
+ pWind(NULL), context(NULL), offscreen(NULL), pixelSize(32),
+ pixMap(NULL), rowBytes(0), baseAddr(NULL)
+#endif
+ {}
+ int fs; // FullScreen
+ int have_constContext; // 1 if we have a constant context
+
+#ifdef __unix__
+ Display *dpy; // X Display
+ Window win; // X Window
+ int screen; // X Screen
+ Colormap cmap; // X color map
+ GLXContext context; // OpenGL context
+ Atom delete_atom;
+
+#ifdef HAVE_LIBXXF86VM
+ XF86VidModeModeInfo deskMode; // originale ModeLine of the Desktop
+#endif
+
+#elif defined __WIN32__
+
+ HWND win; // Window handle
+ HDC dc; // Device context handle
+ HGLRC context; // OpenGL context
+
+#elif defined __APPLE__
+
+ WindowPtr pWind; // GEM window reference for gemwin
+ AGLContext context; // OpenGL context
+ GWorldPtr offscreen; // Macintosh offscreen buffer
+ long pixelSize; //
+ Rect r; //
+ PixMapHandle pixMap; // PixMap Handle
+ long rowBytes; //
+ void *baseAddr; //
+ short fontList; // Font
+
+#else
+#error Define OS specific window data
+#endif
+};
+
+/*-----------------------------------------------------------------
+ -------------------------------------------------------------------
+ CLASS
+ WindowHints
+
+ Hints for window creation
+
+ DESCRIPTION
+
+ -----------------------------------------------------------------*/
+class GEM_EXTERN WindowHints
+{
+ public:
+
+ //////////
+ // Should the window be realized
+ int actuallyDisplay;
+
+ //////////
+ // Single or double buffered
+ int buffer;
+
+ //////////
+ // The width/x of the window
+ int width;
+ //////////
+ // The height/y of the window
+ int height;
+
+ //////////
+ // the real width/height of the window (set by createGemWindow())
+ int real_w, real_h;
+
+ //////////
+ // The offset/x of the window (likely tobe overridden by the window-manager)
+ int x_offset;
+ //////////
+ // The offset/y of the window (likely tobe overridden by the window-manager)
+ int y_offset;
+
+ //////////
+ // Should we do fullscreen ?
+ int fullscreen;
+
+ //////////
+ // Is there a second screen ?
+ int secondscreen;
+
+ //////////
+ // Should there be a window border?
+ int border;
+
+ //////////
+ // mode for full-screen antialiasing
+ int fsaa;
+
+ ///// if we can use a different display , this has its meaning under X
+ char* display;
+
+ //////////////
+ // display some title....
+ char* title;
+
+ //////////
+ // The GLXcontext to share rendering with
+#ifdef __unix__
+ GLXContext shared;
+#elif defined __WIN32__
+ HGLRC shared;
+#elif defined __APPLE__
+ AGLContext shared;
+#else
+#error Define OS specific OpenGL context
+#endif
+};
+
+//////////
+// Create a new window
+GEM_EXTERN extern int createGemWindow(WindowInfo &info, WindowHints &hints);
+
+//////////
+// Destroy a window
+GEM_EXTERN extern void destroyGemWindow(WindowInfo &info);
+
+//////////
+// Set the cursor
+GEM_EXTERN extern int cursorGemWindow(WindowInfo &info, int state);
+
+//////////
+// Set the topmost position
+GEM_EXTERN extern int topmostGemWindow(WindowInfo &info, int state);
+
+//////////
+// swap the buffers (get's called in double-buffered mode)
+GEM_EXTERN extern void gemWinSwapBuffers(WindowInfo &nfo);
+/////////
+// reestablish a context
+GEM_EXTERN extern void gemWinMakeCurrent(WindowInfo &nfo);
+
+/////////
+// init OS-specific stuff
+GEM_EXTERN extern bool initGemWin(void);
+
+/////////
+// prepare a WindowInfo for context-sharing
+GEM_EXTERN void initWin_sharedContext(WindowInfo &info, WindowHints &hints);
+
+
+
+/////////
+//
+GEM_EXTERN extern void dispatchGemWindowMessages(WindowInfo &nfo);
+
+
+
+#endif // for header file
diff --git a/externals/gridflow/bundled/Base/config.h b/externals/gridflow/bundled/Base/config.h
new file mode 100644
index 00000000..bd2a823c
--- /dev/null
+++ b/externals/gridflow/bundled/Base/config.h
@@ -0,0 +1,65 @@
+/* configuration-file */
+#ifndef HAVE_BASE_CONFIG_H_
+#define HAVE_BASE_CONFIG_H_
+
+#ifdef _MSC_VER
+# ifndef __WIN32__
+# define __WIN32__
+# endif
+#endif
+
+#ifdef __WIN32__
+# ifndef NT
+# define NT
+# endif
+# ifndef MSW
+# define MSW
+# endif
+# ifndef WIN32_LEAN_AND_MEAN
+# define WIN32_LEAN_AND_MEAN
+# endif
+#endif
+
+
+
+#ifdef HAVE_CONFIG_GENERIC_H
+
+# include "Base/configGeneric.h"
+
+#else /* includes system-specific files */
+
+# ifdef __linux__
+# include "Base/configLinux.h"
+# endif
+
+# ifdef __APPLE__
+//# include "Base/configDarwin.h"
+# define HAVE_QUICKTIME
+# endif
+
+# ifdef __WIN32__
+# include "Base/configNT.h"
+# endif
+#endif
+
+#ifdef NEW_VIDEOFILM
+# ifndef FILM_NEW
+# define FILM_NEW
+# endif
+# ifndef VIDEO_NEW
+# define VIDEO_NEW
+# endif
+#endif
+
+#ifdef HAVE_LIBFTGL
+# define FTGL
+#endif
+
+#ifdef HAVE_FFMPEG
+# define HAVE_LIBAVCODEC
+# define HAVE_LIBAVFORMAT
+#elif defined (HAVE_LIBAVCODEC) && defined (HAVE_LIBAVFORMAT)
+# define HAVE_FFMPEG
+#endif
+
+#endif /* HAVE_BASE_CONFIG_H_ */
diff --git a/externals/gridflow/bundled/Base/configLinux.h b/externals/gridflow/bundled/Base/configLinux.h
new file mode 100644
index 00000000..ca0a20b8
--- /dev/null
+++ b/externals/gridflow/bundled/Base/configLinux.h
@@ -0,0 +1,40 @@
+/* Base/configLinux.h. Generated from configLinux.h.in by configure. */
+
+/* fullscreen: querying via libXxf86vm */
+/* #undef HAVE_LIBXXF86VM */
+
+/* font rendering */
+/* #undef HAVE_LIBFTGL */
+
+/* image loading / saving */
+#define HAVE_LIBTIFF 1
+#define HAVE_LIBJPEG 1
+/* #undef HAVE_LIBMAGICKPLUSPLUS */
+
+/* movie decoding */
+#define HAVE_LIBMPEG 1
+#define HAVE_LIBMPEG3 1
+#define HAVE_LIBQUICKTIME 1
+#define HAVE_LQT_OPEN_WRITE 1
+/* #undef HAVE_LIBAVIPLAY */
+#define HAVE_FFMPEG 1
+#define GEM_AVSTREAM_CODECPOINTER 1
+
+/* video grabbing */
+#define HAVE_VIDEO4LINUX 1
+/* #undef HAVE_VIDEO4LINUX2 */
+#define HAVE_LIBDV 1
+
+/* image analysis */
+/* #undef HAVE_ARTOOLKIT */
+
+/* posix threads */
+#define HAVE_PTHREADS 1
+
+/* enable the use of the all-in-one video/movie objects */
+#define NEW_VIDEOFILM 1
+
+/* types, structures, compiler characteristics, ... */
+#define SIZEOF_VOID_P 4
+#define SIZEOF_UNSIGNED_INT 4
+