X-Git-Url: https://git.ucc.asn.au/?p=ipdf%2Fcode.git;a=blobdiff_plain;f=src%2Fview.h;h=d99db6e7cfe1ca62f361a98230deb9099d1ef9cf;hp=ca4c80837147c58f559c3b75ae29ba7be79c22eb;hb=138ee74c900c6f485cdd959d55c01099d6043661;hpb=35e4687acd16a28fc923a75d254cdb4fd2fbc524 diff --git a/src/view.h b/src/view.h index ca4c808..d99db6e 100644 --- a/src/view.h +++ b/src/view.h @@ -6,8 +6,9 @@ #include "framebuffer.h" #include "objectrenderer.h" -#define USE_GPU_TRANSFORM true +#define USE_GPU_TRANSFORM true #define USE_GPU_RENDERING true +#define USE_SHADING !(USE_GPU_RENDERING) && true namespace IPDF { @@ -27,31 +28,47 @@ namespace IPDF void Translate(Real x, Real y); void ScaleAroundPoint(Real x, Real y, Real scale_amount); + void SetBounds(const Rect & new_bounds); Rect TransformToViewCoords(const Rect& inp) const; const Rect& GetBounds() const { return m_bounds; } + const bool UsingGPUTransform() const { return m_use_gpu_transform; } // whether view transform calculated on CPU or GPU const bool UsingGPURendering() const { return m_use_gpu_rendering; } // whether GPU shaders are used or CPU rendering void ToggleGPUTransform() { m_use_gpu_transform = (!m_use_gpu_transform); m_bounds_dirty = true; m_buffer_dirty = true; } void ToggleGPURendering() { m_use_gpu_rendering = (!m_use_gpu_rendering); m_bounds_dirty = true; m_buffer_dirty = true; } + + void SetGPURendering(bool state) {m_use_gpu_rendering = state; m_bounds_dirty = true; m_buffer_dirty = true;} + bool ShowingBezierBounds() const {return m_show_bezier_bounds;} // render bounds rectangles + void ShowBezierBounds(bool state) {m_show_bezier_bounds = state; m_bounds_dirty = true; m_buffer_dirty = true;} + bool ShowingBezierType() const {return m_show_bezier_type;} + void ShowBezierType(bool state) {m_show_bezier_type = state; m_bounds_dirty = true; m_buffer_dirty = true;} + bool ShowingFillPoints() const {return m_show_fill_points;} + void ShowFillPoints(bool state) {m_show_fill_points = state; m_bounds_dirty = true; m_buffer_dirty = true;} + bool ShowingFillBounds() const {return m_show_fill_bounds;} + void ShowFillBounds(bool state) {m_show_fill_bounds = true;} + + bool PerformingShading() const {return m_perform_shading;} + void PerformShading(bool state) {m_perform_shading = state; m_bounds_dirty = true; m_buffer_dirty = true;} void ForceBoundsDirty() {m_bounds_dirty = true;} void ForceBufferDirty() {m_buffer_dirty = true;} void ForceRenderDirty() {m_render_dirty = true;} - private: struct GPUObjBounds { float x0, y0; float x1, y1; - }; + } __attribute__((packed)); void PrepareRender(); // call when m_render_dirty is true - void UpdateObjBoundsVBO(); // call when m_buffer_dirty is true + void UpdateObjBoundsVBO(unsigned first_obj, unsigned last_obj); // call when m_buffer_dirty is true + + void RenderRange(int width, int height, unsigned first_obj, unsigned last_obj); bool m_use_gpu_transform; bool m_use_gpu_rendering; @@ -74,9 +91,21 @@ namespace IPDF std::vector m_object_renderers; uint8_t * m_cpu_rendering_pixels; // pixels to be used for CPU rendering + + // shading + bool m_perform_shading; + + // Debug rendering + bool m_show_bezier_bounds; + bool m_show_bezier_type; + bool m_show_fill_points; + bool m_show_fill_bounds; + + #ifndef QUADTREE_DISABLED QuadTreeIndex m_current_quadtree_node; // The highest node we will traverse. int m_quadtree_max_depth; // The maximum quadtree depth. + void RenderQuadtreeNode(int width, int height, QuadTreeIndex node, int remaining_depth); #endif };