diff options
author | Travis CI <zmoelnig@travis-ci.umlaeute.mur.at> | 2017-12-07 00:27:44 +0000 |
---|---|---|
committer | Travis CI <zmoelnig@travis-ci.umlaeute.mur.at> | 2017-12-07 00:27:44 +0000 |
commit | 438e4a09d30cbeb2b11dbeba04a72142ad4f71c4 (patch) | |
tree | 8287c9605e2d645c1d659f553c2bcc40609135d1 /Gem/develop/include/Gem/Base | |
parent | 8288fd4a0fc18e468bed3dd1420454da275cc6c5 (diff) |
Gem 427a3d0e61d61e64e76facfa905c120356383bab osx/i386
built 'master:427a3d0e61d61e64e76facfa905c120356383bab' for osx/i386
Diffstat (limited to 'Gem/develop/include/Gem/Base')
-rw-r--r-- | Gem/develop/include/Gem/Base/CPPExtern.h | 191 | ||||
-rw-r--r-- | Gem/develop/include/Gem/Base/GemBase.h | 49 | ||||
-rw-r--r-- | Gem/develop/include/Gem/Base/GemContext.h | 12 | ||||
-rw-r--r-- | Gem/develop/include/Gem/Base/GemGluObj.h | 60 | ||||
-rw-r--r-- | Gem/develop/include/Gem/Base/GemPathBase.h | 56 | ||||
-rw-r--r-- | Gem/develop/include/Gem/Base/GemPixDualObj.h | 282 | ||||
-rw-r--r-- | Gem/develop/include/Gem/Base/GemPixObj.h | 59 | ||||
-rw-r--r-- | Gem/develop/include/Gem/Base/GemShape.h | 56 | ||||
-rw-r--r-- | Gem/develop/include/Gem/Base/GemWindow.h | 31 | ||||
-rw-r--r-- | Gem/develop/include/Gem/Base/TextBase.h | 44 |
10 files changed, 442 insertions, 398 deletions
diff --git a/Gem/develop/include/Gem/Base/CPPExtern.h b/Gem/develop/include/Gem/Base/CPPExtern.h index 1f296d9..9b1d25c 100644 --- a/Gem/develop/include/Gem/Base/CPPExtern.h +++ b/Gem/develop/include/Gem/Base/CPPExtern.h @@ -24,8 +24,9 @@ LOG class CPPExtern; /* forward declaration of a generic exception handler for GemExceptions */ -namespace gem { - GEM_EXTERN void catchGemException(const char*objname, const t_object*obj); +namespace gem +{ +GEM_EXTERN void catchGemException(const char*objname, const t_object*obj); }; /*----------------------------------------------------------------- @@ -43,15 +44,14 @@ DESCRIPTION the vtable. -----------------------------------------------------------------*/ -struct GEM_EXTERN Obj_header -{ - ////////// - // The obligatory object header - t_object pd_obj; +struct GEM_EXTERN Obj_header { + ////////// + // The obligatory object header + t_object pd_obj; - ////////// - // Our data structure - CPPExtern *data; + ////////// + // Our data structure + CPPExtern *data; // This has a dummy arg so that NT won't complain void *operator new(size_t, void *location, void *dummy); @@ -89,69 +89,72 @@ DESCRIPTION -----------------------------------------------------------------*/ class GEM_EXTERN CPPExtern { - public: - - ////////// - // Constructor - CPPExtern(void); - - ////////// - // The Pd header - t_object *x_obj; - - ////////// - // Destructor - virtual ~CPPExtern(void) = 0; - - ////////// - // Get the object's canvas - const t_canvas *getCanvas(void) const { 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 *) {} - - /////////// - // called directly before the destructor - // normally you should not override this (use the dtor!) - // if you do override this, make sure that you call the parent as well - virtual void beforeDeletion(); - - 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 startpost(const char*format, ...) const; - void post(const char*format, ...) const; - void endpost(void) const; - void verbose(const int level, const char*format, ...) const; - void error(const char*format, ...) const; /* internally uses pd_error() */ - - // searches for a file based on the parent abstraction's path - // wraps open_via_path() and canvas_makefilename() - // the full filename is returned - // if the file does not exist, it is constructed - std::string findFile(const std::string&filename, const std::string&ext) const; - std::string findFile(const std::string&filename) const; - - private: - mutable bool m_endpost; /* internal state for startpost/post/endpost */ - static bool checkGemVersion(const int major, const int minor); +public: + + ////////// + // Constructor + CPPExtern(void); + + ////////// + // The Pd header + t_object *x_obj; + + ////////// + // Destructor + virtual ~CPPExtern(void) = 0; + + ////////// + // Get the object's canvas + const t_canvas *getCanvas(void) const + { + 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 *) {} + + /////////// + // called directly before the destructor + // normally you should not override this (use the dtor!) + // if you do override this, make sure that you call the parent as well + virtual void beforeDeletion(); + +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 startpost(const char*format, ...) const; + void post(const char*format, ...) const; + void endpost(void) const; + void verbose(const int level, const char*format, ...) const; + void error(const char*format, ...) const; /* internally uses pd_error() */ + + // searches for a file based on the parent abstraction's path + // wraps open_via_path() and canvas_makefilename() + // the full filename is returned + // if the file does not exist, it is constructed + std::string findFile(const std::string&filename, const std::string&ext) const; + std::string findFile(const std::string&filename) const; + +private: + mutable bool m_endpost; /* internal state for startpost/post/endpost */ + static bool checkGemVersion(const int major, const int minor); CPPExtern(const CPPExtern&); virtual CPPExtern&operator=(const CPPExtern&); }; @@ -160,17 +163,17 @@ class GEM_EXTERN CPPExtern // 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; \ - GetMyClass(data)->beforeDeletion(); \ - 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: \ +#define CPPEXTERN_HEADER(NEW_CLASS, PARENT_CLASS) \ +public: \ +static void obj_freeCallback(void *data) \ +{ CPPExtern *mydata = ((Obj_header *)data)->data; \ + GetMyClass(data)->beforeDeletion(); \ + 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); @@ -182,7 +185,7 @@ static void obj_setupCallback(t_class *classPtr); // // NO ARGUMENTS ///////////////////////////////////////////////// -#define CPPEXTERN_NEW(NEW_CLASS) \ +#define CPPEXTERN_NEW(NEW_CLASS) \ REAL_NEW__CLASS(NEW_CLASS); \ static void* create_ ## NEW_CLASS (void) \ REAL_NEW__CREATE1(NEW_CLASS) \ @@ -207,7 +210,7 @@ static void obj_setupCallback(t_class *classPtr); // // GIMME ARGUMENT ///////////////////////////////////////////////// -#define CPPEXTERN_NEW_WITH_GIMME(NEW_CLASS) \ +#define CPPEXTERN_NEW_WITH_GIMME(NEW_CLASS) \ REAL_NEW__CLASS(NEW_CLASS); \ static void* create_ ## NEW_CLASS (t_symbol*s, int argc, t_atom*argv) \ REAL_NEW__CREATE1(NEW_CLASS) \ @@ -220,7 +223,7 @@ static void obj_setupCallback(t_class *classPtr); // // TWO ARGUMENTS ///////////////////////////////////////////////// -#define CPPEXTERN_NEW_WITH_TWO_ARGS(NEW_CLASS, TYPE, PD_TYPE, TTWO, PD_TWO) \ +#define CPPEXTERN_NEW_WITH_TWO_ARGS(NEW_CLASS, TYPE, PD_TYPE, TTWO, PD_TWO) \ REAL_NEW__CLASS(NEW_CLASS); \ static void* create_ ## NEW_CLASS (TYPE arg, TTWO arg2) \ REAL_NEW__CREATE1(NEW_CLASS) \ @@ -233,7 +236,7 @@ static void obj_setupCallback(t_class *classPtr); // // THREE ARGUMENTS ///////////////////////////////////////////////// -#define CPPEXTERN_NEW_WITH_THREE_ARGS(NEW_CLASS, TYPE, PD_TYPE, TTWO, PD_TWO, TTHREE, PD_THREE) \ +#define CPPEXTERN_NEW_WITH_THREE_ARGS(NEW_CLASS, TYPE, PD_TYPE, TTWO, PD_TWO, TTHREE, PD_THREE) \ REAL_NEW__CLASS(NEW_CLASS); \ static void* create_ ## NEW_CLASS (TYPE arg, TTWO arg2, TTHREE arg3) \ REAL_NEW__CREATE1(NEW_CLASS) \ @@ -338,11 +341,11 @@ static void obj_setupCallback(t_class *classPtr); # else # define POST_AUTOREGISTER(NEW_CLASS) # endif -# define AUTO_REGISTER_CLASS(NEW_CLASS) \ - class NEW_CLASS ## _cppclass { \ - public: \ +# define AUTO_REGISTER_CLASS(NEW_CLASS) \ + class NEW_CLASS ## _cppclass { \ + public: \ NEW_CLASS ## _cppclass(void) {POST_AUTOREGISTER(NEW_CLASS); NEW_CLASS ## _setup(); } \ -}; \ +}; \ static NEW_CLASS ## _cppclass NEW_CLASS ## _instance #endif @@ -358,7 +361,7 @@ static void obj_setupCallback(t_class *classPtr); # define SET_HELPSYMBOL(NEW_CLASS) \ class_sethelpsymbol(NEW_CLASS ## _class, gensym(HELPSYMBOL_BASE #NEW_CLASS)) # else -# define SET_HELPSYMBOL(NEW_CLASS) \ +# define SET_HELPSYMBOL(NEW_CLASS) \ class_sethelpsymbol(NEW_CLASS ## _class, gensym(HELPSYMBOL_BASE HELPSYMBOL)) # endif @@ -376,4 +379,4 @@ static void obj_setupCallback(t_class *classPtr); // macros for boilerplate code to object messages #include "RTE/MessageCallbacks.h" -#endif // for header file +#endif // for header file diff --git a/Gem/develop/include/Gem/Base/GemBase.h b/Gem/develop/include/Gem/Base/GemBase.h index 9b0d362..8ff4678 100644 --- a/Gem/develop/include/Gem/Base/GemBase.h +++ b/Gem/develop/include/Gem/Base/GemBase.h @@ -34,7 +34,7 @@ class GemState; -----------------------------------------------------------------*/ class GEM_EXTERN GemBase : public CPPExtern { - protected: +protected: ////////// // Constructor @@ -42,10 +42,10 @@ class GEM_EXTERN GemBase : public CPPExtern ////////// // Destructor - virtual ~GemBase(); + virtual ~GemBase(); ////////// - virtual void render(GemState *state) = 0; + virtual void render(GemState *state) = 0; ////////// void continueRender(GemState *state); @@ -53,22 +53,25 @@ class GEM_EXTERN GemBase : public CPPExtern ////////// // After objects below you in the chain have finished. // You should reset all GEM/OpenGL states here. - virtual void postrender(GemState *) { ; } + virtual void postrender(GemState *) { ; } ////////// // Called when rendering stops #if 1/*(jmz) this seems to be for gem2pdp*/ - virtual void stoprender() { realStopRendering(); } + virtual void stoprender() + { + realStopRendering(); + } #endif ////////// // If you care about the start of rendering - virtual void startRendering() { ; } + virtual void startRendering() { ; } ////////// // If you care about the stop of rendering - virtual void stopRendering() { ; } + virtual void stopRendering() { ; } ////////// @@ -78,18 +81,18 @@ class GEM_EXTERN GemBase : public CPPExtern ////////// // If anything in the object has changed - virtual void setModified(); + virtual void setModified(); ////////// // Don't mess with this unless you know what you are doing. - GemCache *m_cache; + GemCache *m_cache; ////////// // check whether this object has changed bool m_modified; ////////// // The outlet - t_outlet *m_out1; + t_outlet *m_out1; ////////// @@ -103,22 +106,28 @@ class GEM_EXTERN GemBase : public CPPExtern ////////// // creation callback - static void real_obj_setupCallback(t_class *classPtr) - { CPPExtern::real_obj_setupCallback(classPtr); GemBase::obj_setupCallback(classPtr); } + static void real_obj_setupCallback(t_class *classPtr) + { + CPPExtern::real_obj_setupCallback(classPtr); + GemBase::obj_setupCallback(classPtr); + } enum RenderState {INIT, ENABLED, DISABLED, RENDERING, MODIFIED}; - private: +private: - void realStopRendering(); + void realStopRendering(); void gem_startstopMess(int state); - void gem_renderMess(GemCache* state, GemState* state2); + void gem_renderMess(GemCache* cache, GemState* state); - static inline GemBase *GetMyClass(void *data) {return((GemBase *)((Obj_header *)data)->data);} + 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 obj_setupCallback(t_class *classPtr); + static void gem_MessCallback(void *, t_symbol *,int, t_atom*); /* 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 @@ -126,10 +135,10 @@ class GEM_EXTERN GemBase : public CPPExtern gem::ContextData<bool>m_enabled; gem::ContextData<enum RenderState>m_state; - protected: +protected: enum RenderState getState(void); virtual void beforeDeletion(void); }; -#endif // for header file +#endif // for header file diff --git a/Gem/develop/include/Gem/Base/GemContext.h b/Gem/develop/include/Gem/Base/GemContext.h index 7081051..a34d145 100644 --- a/Gem/develop/include/Gem/Base/GemContext.h +++ b/Gem/develop/include/Gem/Base/GemContext.h @@ -28,13 +28,15 @@ typedef struct GLXEWContextStruct GLXEWContext; typedef struct GLEWContextStruct GLEWContext; -namespace gem { -class GEM_EXTERN Context { - private: +namespace gem +{ +class GEM_EXTERN Context +{ +private: class PIMPL; PIMPL*m_pimpl; - public: +public: Context(void); Context(const Context&); virtual ~Context(void); @@ -47,7 +49,7 @@ class GEM_EXTERN Context { // make context uncurrent bool pop(void); - public: +public: static unsigned int getContextId(void); static GLEWContext*getGlewContext(void); #ifdef GemGlewXContext diff --git a/Gem/develop/include/Gem/Base/GemGluObj.h b/Gem/develop/include/Gem/Base/GemGluObj.h index a08e33a..2fc9303 100644 --- a/Gem/develop/include/Gem/Base/GemGluObj.h +++ b/Gem/develop/include/Gem/Base/GemGluObj.h @@ -50,43 +50,49 @@ DESCRIPTION -----------------------------------------------------------------*/ class GEM_EXTERN GemGluObj : public GemShape { - public: +public: - ////////// - // Constructor + ////////// + // Constructor GemGluObj(t_floatarg size, t_floatarg slices=10.f, t_floatarg stacks=0.f); - protected: +protected: - ////////// - // Destructor - virtual ~GemGluObj(); + ////////// + // Destructor + virtual ~GemGluObj(); - ////////// - // The number of slices in the quadric - void numSlicesMess(int numSlices); - void numSlicesMess(int numSlices, int numStacks); + ////////// + // 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; + ////////// + // The number of slices + int m_numSlices, m_numStacks; - ////////// - t_inlet *m_sliceInlet; + ////////// + t_inlet *m_sliceInlet; - ////////// - // creation callback - static void real_obj_setupCallback(t_class *classPtr) - { GemShape::real_obj_setupCallback(classPtr); GemGluObj::obj_setupCallback(classPtr); } + ////////// + // creation callback + static void real_obj_setupCallback(t_class *classPtr) + { + GemShape::real_obj_setupCallback(classPtr); + GemGluObj::obj_setupCallback(classPtr); + } - private: +private: - static inline GemGluObj *GetMyClass(void *data) {return((GemGluObj *)((Obj_header *)data)->data);} + 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*); + ////////// + // Static member functions + static void obj_setupCallback(t_class *classPtr); + static void numSlicesMessCallback(void *data, t_symbol*, int, t_atom*); }; -#endif // for header file +#endif // for header file diff --git a/Gem/develop/include/Gem/Base/GemPathBase.h b/Gem/develop/include/Gem/Base/GemPathBase.h index 2d24619..e1f7264 100644 --- a/Gem/develop/include/Gem/Base/GemPathBase.h +++ b/Gem/develop/include/Gem/Base/GemPathBase.h @@ -29,43 +29,43 @@ DESCRIPTION -----------------------------------------------------------------*/ class GEM_EXTERN GemPathBase : public CPPExtern { - CPPEXTERN_HEADER(GemPathBase, CPPExtern); + CPPEXTERN_HEADER(GemPathBase, CPPExtern); - public: +public: - ////////// - // Constructor - GemPathBase(int argc, t_atom *argv); + ////////// + // Constructor + GemPathBase(int argc, t_atom *argv); - protected: +protected: - ////////// - // Destructor - virtual ~GemPathBase(); + ////////// + // Destructor + virtual ~GemPathBase(); - ////////// - // When an open is received - virtual void openMess(t_symbol *arrayname); + ////////// + // When an open is received + virtual void openMess(t_symbol *arrayname); - ////////// - // When a float val is received - virtual void floatMess(t_float val); + ////////// + // When a float val is received + virtual void floatMess(t_float val); - /////////// - // do the actual interpolation - virtual void lookupFunc(t_float x, t_float *ret, int numDimen, int npnts, t_float *pnts) = 0; + /////////// + // do the actual interpolation + virtual void lookupFunc(t_float x, t_float *ret, int numDimen, int npnts, t_float *pnts) = 0; - ////////// - // The number of dimensions - int m_numDimens; + ////////// + // The number of dimensions + int m_numDimens; - ////////// - // The array - t_garray *m_array; + ////////// + // The array + t_garray *m_array; - ////////// - // The outlet - t_outlet *m_out1; + ////////// + // The outlet + t_outlet *m_out1; }; -#endif // for header file +#endif // for header file diff --git a/Gem/develop/include/Gem/Base/GemPixDualObj.h b/Gem/develop/include/Gem/Base/GemPixDualObj.h index 88ffabc..bb1f02d 100644 --- a/Gem/develop/include/Gem/Base/GemPixDualObj.h +++ b/Gem/develop/include/Gem/Base/GemPixDualObj.h @@ -36,155 +36,161 @@ DESCRIPTION -----------------------------------------------------------------*/ class GEM_EXTERN GemPixDualObj : public GemPixObj { - public: +public: - ////////// - // Constructor - GemPixDualObj(); + ////////// + // Constructor + GemPixDualObj(); - protected: +protected: - ////////// - // Destructor - virtual ~GemPixDualObj(); + ////////// + // Destructor + virtual ~GemPixDualObj(); - void render(GemState *state); + 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); + ////////// + // 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); + ////////// + // 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 ); + ////////// + // 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); + /* 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); + ////////// + 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 +#endif // for header file diff --git a/Gem/develop/include/Gem/Base/GemPixObj.h b/Gem/develop/include/Gem/Base/GemPixObj.h index b964ad3..b6a4076 100644 --- a/Gem/develop/include/Gem/Base/GemPixObj.h +++ b/Gem/develop/include/Gem/Base/GemPixObj.h @@ -34,65 +34,65 @@ DESCRIPTION -----------------------------------------------------------------*/ class GEM_EXTERN GemPixObj : public GemBase { - public: +public: ////////// // Constructor GemPixObj(); - protected: +protected: ////////// // Destructor - virtual ~GemPixObj() { } + 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); + 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); + 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); + 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); + 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); + 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); + 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); + 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); + 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(); + // This sets the dirty bit on the pixBlock. + void setPixModified(); ////////// // Turn on/off processing @@ -114,36 +114,41 @@ class GEM_EXTERN GemPixObj : public GemBase ////////// // creation callback - static void real_obj_setupCallback(t_class *classPtr) { + 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. + // very special behavior. // Do the rendering, which calls processImage or processGrayImage, etc... // save the image-information - virtual void render(GemState *state); + virtual void render(GemState *state); // turn the pointer back to the old data after rendering virtual void postrender(GemState *state); - void startRendering(void) { + void startRendering(void) + { //post("start rendering"); setPixModified(); } - private: +private: - static inline GemPixObj *GetMyClass(void *data) {return((GemPixObj *)((Obj_header *)data)->data);} + static inline GemPixObj *GetMyClass(void *data) + { + return((GemPixObj *)((Obj_header *)data)->data); + } ////////// // static member functions static void obj_setupCallback(t_class *classPtr); - protected: +protected: virtual void SIMD(int); }; -#endif // for header file +#endif // for header file diff --git a/Gem/develop/include/Gem/Base/GemShape.h b/Gem/develop/include/Gem/Base/GemShape.h index 2878156..47395c2 100644 --- a/Gem/develop/include/Gem/Base/GemShape.h +++ b/Gem/develop/include/Gem/Base/GemShape.h @@ -36,67 +36,67 @@ class TexCoord; class GEM_EXTERN GemShape : public GemBase { - public: +public: ////////// // Constructor // [in] size - A size of 0. means to just use the default (ie, 1.) - GemShape(t_floatarg size); + explicit GemShape(t_floatarg size); GemShape(); - protected: +protected: ////////// // Destructor virtual ~GemShape(); //----------------------------------- - // GROUP: Access functions + // GROUP: Access functions //----------------------------------- ////////// // The width of the lines in line draw mode - void linewidthMess(float linewidth); + void linewidthMess(float linewidth); ////////// // The size of the object - void sizeMess(float size); + void sizeMess(float size); ////////// // How the object should be drawn - virtual void typeMess(t_symbol *type); + virtual void typeMess(t_symbol *type); //----------------------------------- - // GROUP: Utility functions + // GROUP: Utility functions //----------------------------------- void SetVertex(GemState* state,float x, float y, float z, - float tx, float ty, - int curCoord); + float tx, float ty, + int curCoord); void SetVertex(GemState* state,float x, float y, float z, - float s, float t, float r, float q, - int curCoord); + float s, float t, float r, float q, + int curCoord); //----------------------------------- - // GROUP: Member variables + // GROUP: Member variables //----------------------------------- ////////// // The line width for GL_LINE mode - GLfloat m_linewidth; + GLfloat m_linewidth; ////////// // The size of the object - GLfloat m_size; + GLfloat m_size; ////////// // The drawing style (GL_LINE, GL_POLYGON, etc) - GLenum m_drawType; + GLenum m_drawType; ////////// // do we want blending? - GLboolean m_blend; + GLboolean m_blend; void blendMess(float blend); @@ -114,23 +114,29 @@ class GEM_EXTERN GemShape : public GemBase t_inlet *m_inlet; //----------------------------------- - // GROUP: Setup functions + // GROUP: Setup functions //----------------------------------- ////////// // creation callback - static void real_obj_setupCallback(t_class *classPtr) - { GemBase::real_obj_setupCallback(classPtr); GemShape::obj_setupCallback(classPtr); } + static void real_obj_setupCallback(t_class *classPtr) + { + GemBase::real_obj_setupCallback(classPtr); + GemShape::obj_setupCallback(classPtr); + } - private: +private: - static inline GemShape *GetMyClass(void *data) {return((GemShape *)((Obj_header *)data)->data);} + static inline GemShape *GetMyClass(void *data) + { + return((GemShape *)((Obj_header *)data)->data); + } ////////// // static member functions - static void obj_setupCallback(t_class *classPtr); + static void obj_setupCallback(t_class *classPtr); - protected: +protected: int m_texType, m_texNum; TexCoord*m_texCoords; bool m_lighting; @@ -138,4 +144,4 @@ class GEM_EXTERN GemShape : public GemBase std::map<std::string, GLenum>m_drawTypes; }; -#endif // for header file +#endif // for header file diff --git a/Gem/develop/include/Gem/Base/GemWindow.h b/Gem/develop/include/Gem/Base/GemWindow.h index c69f249..f2946f8 100644 --- a/Gem/develop/include/Gem/Base/GemWindow.h +++ b/Gem/develop/include/Gem/Base/GemWindow.h @@ -27,20 +27,21 @@ CLASS DESCRIPTION -----------------------------------------------------------------*/ -namespace gem { - class Context; +namespace gem +{ +class Context; }; class GemBase; class GEM_EXTERN GemWindow : public CPPExtern { - CPPEXTERN_HEADER(GemWindow, CPPExtern); + CPPEXTERN_HEADER(GemWindow, CPPExtern); - private: +private: class PIMPL; PIMPL*m_pimpl; - public: +public: ////////// // Constructor @@ -50,17 +51,17 @@ class GEM_EXTERN GemWindow : public CPPExtern // Destructor virtual ~GemWindow(void); - public: +public: /* OUTPUT */ /* an outlet to propagate information to the patch... mainly callbacks from the context */ /* LATER think about detaching the output from the stack, so we can e.g. destroy a window from a mouse-callback */ void info(std::vector<t_atom>); void info(t_symbol*s, int, t_atom*); - void info(std::string); - void info(std::string, t_float); - void info(std::string, int i); - void info(std::string, std::string); + void info(const std::string&); + void info(const std::string&, t_float); + void info(const std::string&, int i); + void info(const std::string&, const std::string&); /* tell downstream objects to render */ void bang(void); @@ -72,7 +73,7 @@ class GEM_EXTERN GemWindow : public CPPExtern /* mouse entering window */ void entry(int devId, int state); /* keyboard buttons */ - void key(int devId, std::string, int, int state); + void key(int devId, const std::string&, int, int state); /* window resize/move */ void dimension(unsigned int, unsigned int); @@ -177,14 +178,14 @@ class GEM_EXTERN GemWindow : public CPPExtern virtual void transparentMess(bool on); /* window decoration (pre creation) */ - virtual void titleMess(std::string); + virtual void titleMess(const std::string&); virtual void borderMess(bool on); virtual void fullscreenMess(int on); virtual void offsetMess(int x, int y); /* creation/destruction */ - virtual void createMess(std::string); + virtual void createMess(const std::string&); virtual void destroyMess(void); /* post creation */ @@ -196,7 +197,7 @@ class GEM_EXTERN GemWindow : public CPPExtern /* fallback callback */ virtual void anyMess(t_symbol*s, int argc, t_atom*argv); - protected: +protected: unsigned int m_width, m_height; // common properties of GemWindow's @@ -217,4 +218,4 @@ class GEM_EXTERN GemWindow : public CPPExtern -#endif // for header file +#endif // for header file diff --git a/Gem/develop/include/Gem/Base/TextBase.h b/Gem/develop/include/Gem/Base/TextBase.h index de1ebbe..2b553c4 100644 --- a/Gem/develop/include/Gem/Base/TextBase.h +++ b/Gem/develop/include/Gem/Base/TextBase.h @@ -62,14 +62,14 @@ class GEM_EXTERN TextBase : public GemBase { CPPEXTERN_HEADER(TextBase, GemBase); - public: +public: ////////// // Constructor with args TextBase(int argc, t_atom *argv); - protected: +protected: ////////// // Destructor @@ -77,7 +77,7 @@ class GEM_EXTERN TextBase : public GemBase ////////// // Do the rendering - virtual void render(GemState*); + virtual void render(GemState*); ////////// // break a string according to '\n' @@ -87,13 +87,19 @@ class GEM_EXTERN TextBase : public GemBase ////////// // Set the text string from an ASCII list virtual void stringMess(int argc, t_atom *argv); - void stringMess(t_symbol*, int argc, t_atom*argv) { stringMess(argc, argv); } + void stringMess(t_symbol*, int argc, t_atom*argv) + { + stringMess(argc, argv); + } //-- /moocow ////////// // Set the text string virtual void textMess(int argc, t_atom *argv); - void textMess(t_symbol*, int argc, t_atom*argv) { textMess(argc, argv); } + void textMess(t_symbol*, int argc, t_atom*argv) + { + textMess(argc, argv); + } ////////// // The font to use @@ -105,12 +111,12 @@ class GEM_EXTERN TextBase : public GemBase ////////// // Set the font size - virtual void setFontSize(float size); + virtual void setFontSize(float size); virtual void setFontSize(); ////////// // Set the precision for rendering - virtual void setPrecision(float prec); + virtual void setPrecision(float prec); ////////// // The different types of justification @@ -135,11 +141,11 @@ class GEM_EXTERN TextBase : public GemBase // x1,...,z2 just defines the bounding box of the rendered string. // y_offset is the offset of the current line virtual Justification justifyFont(float x1, float y1, float z1, - float x2, float y2, float z2, float y_offset=0); + float x2, float y2, float z2, float y_offset=0); //----------------------------------- - // GROUP: Member variables + // GROUP: Member variables //----------------------------------- ////////// @@ -163,27 +169,27 @@ class GEM_EXTERN TextBase : public GemBase ////////// // The font fize - float m_fontSize; + float m_fontSize; ////////// // The font depth (only for extruded fonts) - float m_fontDepth; + float m_fontDepth; ////////// // The rendering precision - float m_precision; + float m_precision; ////////// // The width justification - JustifyWidth m_widthJus; + JustifyWidth m_widthJus; ////////// // The height justification - JustifyHeight m_heightJus; + JustifyHeight m_heightJus; ////////// // The depth justification - JustifyDepth m_depthJus; + JustifyDepth m_depthJus; ////////// // The inlet @@ -208,7 +214,7 @@ class GEM_EXTERN TextBase : public GemBase ////////// // The font structure #ifdef FTGL - FTFont *m_font; + FTFont *m_font; /* this should delete (m_font) if it is notnull and recreate it. * a pointer to the new structure is returned (and is set to m_font). * if creation fails, the font is cleaned-up and NULL is returned @@ -227,7 +233,7 @@ class GEM_EXTERN TextBase : public GemBase virtual void renderLine(const wchar_t*line,float dist); #endif - private: +private: /////////// // helpers: @@ -239,7 +245,7 @@ class GEM_EXTERN TextBase : public GemBase ////////// // Static member functions - static void justifyMessCallback(void *data, t_symbol *, int, t_atom*); + static void justifyMessCallback(void *data, t_symbol *, int, t_atom*); }; -#endif // for header file +#endif // for header file |