Blender  V2.59
MyGlutKeyHandler.h
Go to the documentation of this file.
00001 
00029 #ifndef NAN_INCLUDED_MyGlutKeyHandler_h
00030 #define NAN_INCLUDED_MyGlutKeyHandler_h
00031 
00032 #include "common/GlutKeyboardManager.h"
00033 #include "LOD_decimation.h"
00034 
00035 class MyGlutKeyHandler : public GlutKeyboardHandler
00036 {
00037 public :
00038         static
00039                 MyGlutKeyHandler *
00040         New(
00041                 LOD_Decimation_InfoPtr info
00042         ) {
00043                 return new MyGlutKeyHandler(info);
00044         }       
00045 
00046                 void
00047         HandleKeyboard(
00048                 GHOST_TKey key,
00049                 int x,
00050                 int y
00051         ){
00052                 int steps = 0;
00053 
00054                 switch (key) {
00055                         case GHOST_kKeyD :
00056 
00057                                 while (steps < 100 && LOD_CollapseEdge(m_info)) {
00058                                         steps ++;
00059                                 }
00060 
00061                                 break;
00062 
00063                         case GHOST_kKeyEsc :
00064 
00065                                 // release all the handlers!                            
00066                                 exit(0);
00067                 }
00068                 
00069         }
00070                 
00071         ~MyGlutKeyHandler(
00072         ) {
00073         };
00074 
00075 private :
00076 
00077         MyGlutKeyHandler(
00078                 LOD_Decimation_InfoPtr info
00079         ):
00080                 m_info (info)
00081         {
00082         }
00083 
00084 
00085         LOD_Decimation_InfoPtr m_info;
00086 };
00087 
00088 #endif
00089