- Main Page
- Namespaces
- Classes
- Files

# VCRA-SZCZERBACKI-PointBasedRendering/ABuffer.h

    00001 #ifndef __ABUFFER_HPP
    00002 #define __ABUFFER_HPP
    00003
    00004 #include "ssVector.hpp"
    00005 #include "color.h"
    00006 #include <vector>
    00007
    00008 class ABuffer
    00009 {
    00010 public:
    00011         struct Fragment
    00012         {
    00013                 Color           color;
    00014                 float           z;
    00015                 float           zmin;
    00016                 float           zmax;
    00017                 int                     dotSign;
    00018                 float           weight;
    00019                 int                     nextFragment;
    00020         };
    00021
    00022                                                 ABuffer                                 (int width, int height, int subpixels);
    00023                                                 ~ABuffer                                (void);
    00024         void                            clear                                   (void);
    00025         int                                     getWidth() const                                                                        { return m_width; }
    00026         int                                     getHeight() const                                                                       { return m_height; }
    00027         int                                     getSubpixels() const                                                            { return m_subpixels; }
    00028
    00029         void                            appendFragment                  (int x, int y, int subpixel, const Fragment &f);
    00030
    00031         void                            collapseToFrameBuffer   (Color* frameBuffer, const Vector4 &background, bool zrange, float zthreshold);
    00032
    00033         float                           getAverageFragmentsPerPixel() const                                     { return m_averageFragmentsPerPixel; }
    00034
    00035 private:
    00036         int                                     m_width;
    00037         int                                     m_height;
    00038         int                                     m_subpixels;
    00039         float                           m_oofsubpixels;
    00040         int*                            m_firstFragments;
    00041         std::vector<Fragment>   m_fragments;
    00042         std::vector<Fragment *> m_sortBuffer;
    00043         int                                     m_firstFreeFragment;
    00044         int                                     m_fragmentsAllocated;
    00045         float                           m_averageFragmentsPerPixel;
    00046 };
    00047
    00048 #endif //__ABUFFER_HPP
    00049