1 #ifndef Renderer_HPP 2 #define Renderer_HPP 3 4 #include "FBO.hpp" 5 #include "BeatDetect.hpp" 6 #include "Common.hpp" 7 #include <string> 8 #include <set> 9 10 #ifdef USE_GLES1 11 #include <GLES/gl.h> 12 #else 13 #ifdef __APPLE__ 14 #include <OpenGL/gl.h> 15 #include <OpenGL/glu.h> 16 #else 17 #include <GL/gl.h> 18 #include <GL/glu.h> 19 #endif 20 #endif 21 22 #ifdef USE_FTGL 23 #ifdef WIN32 24 #include <ftgl.h> 25 #include <FTGLPixmapFont.h> 26 #include <FTGLExtrdFont.h> 27 #else 28 #include <FTGL/FTFont.h> 29 #include <FTGL/FTGLPixmapFont.h> 30 #include <FTGL/FTGLExtrdFont.h> 31 #endif 32 #endif /** USE_FTGL */ 33 34 35 #include "Pipeline.hpp" 36 #include "PerPixelMesh.hpp" 37 #include "Transformation.hpp" 38 #include "ShaderEngine.hpp" 39 40 class UserTexture; 41 class BeatDetect; 42 class TextureManager; 43 44 class Renderer 45 { 46 47 public: 48 49 bool showfps; 50 bool showtitle; 51 bool showpreset; 52 bool showhelp; 53 bool showstats; 54 55 bool studio; 56 bool correction; 57 58 bool noSwitch; 59 60 int totalframes; 61 float realfps; 62 63 std::string title; 64 int drawtitle; 65 int texsize; 66 67 68 Renderer( int width, int height, int gx, int gy, int texsize, BeatDetect *beatDetect, std::string presetURL, std::string title_fontURL, std::string menu_fontURL); 69 ~Renderer(); 70 71 void RenderFrame(const Pipeline &pipeline, const PipelineContext &pipelineContext); 72 void ResetTextures(); 73 void reset(int w, int h); 74 GLuint initRenderToTexture(); 75 76 77 void SetPipeline(Pipeline &pipeline); 78 setPresetName(const std::string & theValue)79 void setPresetName(const std::string& theValue) 80 { 81 m_presetName = theValue; 82 } 83 presetName() const84 std::string presetName() const 85 { 86 return m_presetName; 87 } 88 89 private: 90 91 PerPixelMesh mesh; 92 RenderTarget *renderTarget; 93 BeatDetect *beatDetect; 94 TextureManager *textureManager; 95 static Pipeline* currentPipe; 96 RenderContext renderContext; 97 //per pixel equation variables 98 #ifdef USE_CG 99 ShaderEngine shaderEngine; 100 #endif 101 std::string m_presetName; 102 103 float* p; 104 105 106 int vw; 107 int vh; 108 109 float aspect; 110 111 std::string title_fontURL; 112 std::string menu_fontURL; 113 std::string presetURL; 114 115 #ifdef USE_FTGL 116 FTGLPixmapFont *title_font; 117 FTGLPixmapFont *other_font; 118 FTGLExtrdFont *poly_font; 119 #endif /** USE_FTGL */ 120 121 void SetupPass1(const Pipeline &pipeline, const PipelineContext &pipelineContext); 122 void Interpolation(const Pipeline &pipeline); 123 void RenderItems(const Pipeline &pipeline, const PipelineContext &pipelineContext); 124 void FinishPass1(); 125 void Pass2 (const Pipeline &pipeline, const PipelineContext &pipelineContext); 126 void CompositeOutput(const Pipeline &pipeline, const PipelineContext &pipelineContext); 127 PerPixel(PixelPoint p,PerPixelContext & context)128 inline static PixelPoint PerPixel(PixelPoint p, PerPixelContext &context) 129 { 130 return currentPipe->PerPixel(p,context); 131 } 132 133 void rescale_per_pixel_matrices(); 134 135 void draw_fps( float realfps ); 136 void draw_stats(); 137 void draw_help(); 138 void draw_preset(); 139 void draw_title(); 140 void draw_title_to_screen(bool flip); 141 void draw_title_to_texture(); 142 143 }; 144 145 #endif 146