Commit c4d83bee authored by Tim Übelhör's avatar Tim Übelhör

added default constructor for rasterizer

parent 7d50c0e6
......@@ -26,6 +26,8 @@ public:
size_t step;
};
Rasterizer();
/**
* Initialize the rasterizer with 2D dimensions. Use calc_min_raster to
* determine the minimal dimensions for a given number of views.
......@@ -80,6 +82,12 @@ public:
size_t get_views_per_row() const;
size_t get_views_per_column() const;
size_t get_view_width() const;
size_t get_view_height() const;
void set_views_per_row(size_t n_views);
void set_views_per_column(size_t n_views);
void set_view_width(size_t width);
void set_view_height(size_t height);
private:
// dimensions of the observation
......
......@@ -4,6 +4,10 @@
namespace scigl_render
{
Rasterizer::Rasterizer()
{
}
Rasterizer::Rasterizer(size_t width, size_t height, size_t views_per_row,
size_t views_per_column)
: width(width), height(height),
......@@ -60,6 +64,30 @@ size_t Rasterizer::get_views_per_column() const
{
return views_per_column;
}
size_t Rasterizer::get_view_width() const
{
return width;
}
size_t Rasterizer::get_view_height() const
{
return height;
}
void Rasterizer::set_views_per_row(size_t n_views)
{
views_per_row = n_views;
}
void Rasterizer::set_views_per_column(size_t n_views)
{
views_per_column = n_views;
}
void Rasterizer::set_view_width(size_t width)
{
this->width = width;
}
void Rasterizer::set_view_height(size_t height)
{
this->height = height;
}
Rasterizer::ImageHeader Rasterizer::get_view_image(
size_t row, size_t column, void *data, size_t pixel_size) const
......@@ -68,7 +96,7 @@ Rasterizer::ImageHeader Rasterizer::get_view_image(
// all the rows above and the columns in front
ImageHeader header;
// pixel size is in bytes so do arithmetics in bytes
header.data = static_cast<uint8_t*>(data) +
header.data = static_cast<uint8_t *>(data) +
(xy.second * texture_width + xy.first) * pixel_size;
header.columns = width;
header.rows = height;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment