fart/main/Scene.cc
Josh Holtrop b6008116cf Scene now writing blank BMP file, accepting settings parameters
git-svn-id: svn://anubis/fart/trunk@24 7f9b0f55-74a9-4bce-be96-3c2cd072584d
2009-01-22 02:51:43 +00:00

52 lines
1017 B
C++

#include "Scene.h"
#include <string>
#include <map>
#include "BMP.h"
using namespace std;
Scene::Scene(map<string, const char *> options,
const char * filename)
{
m_width = 800;
m_height = 600;
m_multisample_level = 1;
m_output_file_name = "fart.bmp";
m_verbose = false;
m_data = NULL;
load(filename);
}
Scene::~Scene()
{
if (m_data != NULL)
delete m_data;
}
void Scene::load(const char * filename)
{
}
void Scene::render()
{
m_data = new unsigned char[m_width * m_height * 3];
for (int i = 0; i < m_height; i++)
{
for (int j = 0; j < m_width; j++)
{
renderPixel(i, j, &m_data[3 * (m_width * i + j)]);
}
}
BMP outputImage(m_output_file_name.c_str(), m_width, m_height, m_data);
}
void Scene::renderPixel(int x, int y, unsigned char * pixel)
{
// TODO: um... real work
pixel[BMP_RED] = 0;
pixel[BMP_GREEN] = 0;
pixel[BMP_BLUE] = 0;
}