Terrible hacky SolveCubic.
[ipdf/code.git] / src / objectrenderer.h
index 6f29add..70339e7 100644 (file)
@@ -34,7 +34,7 @@ namespace IPDF
                         * Use the GPU to render the objects - GLSL shader approach
                         * This way is definitely faster, but subject to the GPU's limitations on precision
                         */
                         * Use the GPU to render the objects - GLSL shader approach
                         * This way is definitely faster, but subject to the GPU's limitations on precision
                         */
-                       virtual void RenderUsingGPU();
+                       virtual void RenderUsingGPU(unsigned first_obj_id, unsigned last_obj_id);
 
                        /** 
                         * Use the CPU to render the objects - "make a bitmap and convert it to a texture" approach
 
                        /** 
                         * Use the CPU to render the objects - "make a bitmap and convert it to a texture" approach
@@ -59,7 +59,7 @@ namespace IPDF
                        static void SaveBMP(const CPURenderTarget & target, const char * filename);
 
 
                        static void SaveBMP(const CPURenderTarget & target, const char * filename);
 
 
-                       virtual void RenderUsingCPU(const Objects & objects, const View & view, const CPURenderTarget & target) = 0;
+                       virtual void RenderUsingCPU(const Objects & objects, const View & view, const CPURenderTarget & target, unsigned first_obj_id, unsigned last_obj_id) = 0;
                        
                        
                        
                        
                        
                        
@@ -85,7 +85,7 @@ namespace IPDF
                public:
                        RectFilledRenderer() : ObjectRenderer(RECT_FILLED, "shaders/rect_vert.glsl", "shaders/rect_frag.glsl","shaders/rect_filled_geom.glsl") {}
                        virtual ~RectFilledRenderer() {}
                public:
                        RectFilledRenderer() : ObjectRenderer(RECT_FILLED, "shaders/rect_vert.glsl", "shaders/rect_frag.glsl","shaders/rect_filled_geom.glsl") {}
                        virtual ~RectFilledRenderer() {}
-                       virtual void RenderUsingCPU(const Objects & objects, const View & view, const CPURenderTarget & target);
+                       virtual void RenderUsingCPU(const Objects & objects, const View & view, const CPURenderTarget & target, unsigned first_obj_id, unsigned last_obj_id);
        };
        /** Renderer for outlined rectangles **/
        class RectOutlineRenderer : public ObjectRenderer
        };
        /** Renderer for outlined rectangles **/
        class RectOutlineRenderer : public ObjectRenderer
@@ -93,7 +93,7 @@ namespace IPDF
                public:
                        RectOutlineRenderer() : ObjectRenderer(RECT_OUTLINE, "shaders/rect_vert.glsl", "shaders/rect_frag.glsl", "shaders/rect_outline_geom.glsl") {}
                        virtual ~RectOutlineRenderer() {}
                public:
                        RectOutlineRenderer() : ObjectRenderer(RECT_OUTLINE, "shaders/rect_vert.glsl", "shaders/rect_frag.glsl", "shaders/rect_outline_geom.glsl") {}
                        virtual ~RectOutlineRenderer() {}
-                       virtual void RenderUsingCPU(const Objects & objects, const View & view, const CPURenderTarget & target);
+                       virtual void RenderUsingCPU(const Objects & objects, const View & view, const CPURenderTarget & target, unsigned first_obj_id, unsigned last_obj_id);
        };
        /** Renderer for filled circles **/
        class CircleFilledRenderer : public ObjectRenderer
        };
        /** Renderer for filled circles **/
        class CircleFilledRenderer : public ObjectRenderer
@@ -101,7 +101,7 @@ namespace IPDF
                public:
                        CircleFilledRenderer() : ObjectRenderer(CIRCLE_FILLED, "shaders/rect_vert.glsl", "shaders/circle_frag.glsl", "shaders/circle_filled_geom.glsl") {}
                        virtual ~CircleFilledRenderer() {}
                public:
                        CircleFilledRenderer() : ObjectRenderer(CIRCLE_FILLED, "shaders/rect_vert.glsl", "shaders/circle_frag.glsl", "shaders/circle_filled_geom.glsl") {}
                        virtual ~CircleFilledRenderer() {}
-                       virtual void RenderUsingCPU(const Objects & objects, const View & view, const CPURenderTarget & target);
+                       virtual void RenderUsingCPU(const Objects & objects, const View & view, const CPURenderTarget & target, unsigned first_obj_id, unsigned last_obj_id);
        };
 
        /** Renderer for bezier curves **/
        };
 
        /** Renderer for bezier curves **/
@@ -110,8 +110,8 @@ namespace IPDF
                public:
                        BezierRenderer() : ObjectRenderer(BEZIER, "shaders/rect_vert.glsl", "shaders/rect_frag.glsl", "shaders/bezier_texbuf_geom.glsl") {}
                        virtual ~BezierRenderer() {}
                public:
                        BezierRenderer() : ObjectRenderer(BEZIER, "shaders/rect_vert.glsl", "shaders/rect_frag.glsl", "shaders/bezier_texbuf_geom.glsl") {}
                        virtual ~BezierRenderer() {}
-                       virtual void RenderUsingGPU(); 
-                       virtual void RenderUsingCPU(const Objects & objects, const View & view, const CPURenderTarget & target);
+                       virtual void RenderUsingGPU(unsigned first_obj_id, unsigned last_obj_id); 
+                       virtual void RenderUsingCPU(const Objects & objects, const View & view, const CPURenderTarget & target, unsigned first_obj_id, unsigned last_obj_id);
                        void PrepareBezierGPUBuffer(const Objects & objects);
                private:
                        GraphicsBuffer m_bezier_coeffs;
                        void PrepareBezierGPUBuffer(const Objects & objects);
                private:
                        GraphicsBuffer m_bezier_coeffs;
@@ -121,12 +121,25 @@ namespace IPDF
                                float x0, y0;
                                float x1, y1;
                                float x2, y2;
                                float x0, y0;
                                float x1, y1;
                                float x2, y2;
+                               float x3, y3;
                        };
 
                        GLuint m_bezier_buffer_texture;
                        GLuint m_bezier_id_buffer_texture;
 
        };
                        };
 
                        GLuint m_bezier_buffer_texture;
                        GLuint m_bezier_id_buffer_texture;
 
        };
+       
+               /** Renderer for filled circles **/
+       class GroupRenderer : public ObjectRenderer
+       {
+               public:
+                       GroupRenderer() : ObjectRenderer(GROUP, "shaders/rect_vert.glsl", "shaders/rect_frag.glsl", "shaders/rect_outline_geom.glsl") {}
+                       virtual ~GroupRenderer() {}
+                       virtual void RenderUsingCPU(const Objects & objects, const View & view, const CPURenderTarget & target, unsigned first_obj_id, unsigned last_obj_id);
+                       // do nothing on GPU
+                       virtual void RenderUsingGPU(unsigned first_obj_id, unsigned last_obj_id) {}
+       };
+       
 }
 
 #endif //_OBJECT_RENDERER_H
 }
 
 #endif //_OBJECT_RENDERER_H

UCC git Repository :: git.ucc.asn.au