include/scene.h
branchpyrit
changeset 47 320d5d466864
parent 46 6493fb65f0b1
child 49 558fde7da82a
--- a/include/scene.h	Wed Mar 26 00:52:27 2008 +0100
+++ b/include/scene.h	Wed Mar 26 14:29:21 2008 +0100
@@ -3,7 +3,7 @@
  *
  * This file is part of Pyrit Ray Tracer.
  *
- * Copyright 2006, 2007  Radek Brich
+ * Copyright 2006, 2007, 2008  Radek Brich
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
@@ -30,6 +30,7 @@
 #include <vector>
 #include <typeinfo>
 
+#include "sampler.h"
 #include "noise.h"
 #include "vector.h"
 #include "quaternion.h"
@@ -56,62 +57,6 @@
 };
 
 /**
- * sample
- */
-class Sample
-{
-public:
-	Float x,y;
-};
-
-/**
- * A abstract sampler.
- * It generates screen samples in coordinates between [-1..1] for height
- * and [-w/h..w/h] for width. It works in phases: initSampleSet returns
- * number of samples for each phase, then samples can be generated using
- * nextSample method. The resulting colour of each sample should be returned
- * via saveSample method. The sampler should save the results to given buffer
- * and decide if other phase is needed. When the picture is complete,
- * initSampleSet returns zero and picture can be read from buffer.
- */
-class Sampler
-{
-public:
-	Float *buffer;
-	int w,h;
-
-	Sampler(Float *abuffer, int &aw, int &ah): buffer(abuffer), w(aw), h(ah) {};
-	void resetBuffer(Float *abuffer, int &aw, int &ah) { buffer = abuffer; w = aw; h = ah; };
-	virtual void init() = 0;
-	virtual int initSampleSet() = 0;
-	virtual Sample *nextSample(Sample *prev) = 0;
-	virtual void saveSample(Sample *samp, Colour &col) = 0;
-};
-
-/**
- * default sample
- */
-class DefaultSample: public Sample
-{
-	friend class DefaultSampler;
-	int sx,sy;
-};
-
-/**
- * Default sampler.
- */
-class DefaultSampler: public Sampler
-{
-	int phase;
-public:
-	DefaultSampler(Float *abuffer, int &aw, int &ah): Sampler(abuffer, aw, ah), phase(-1) {};
-	void init() { phase = 0; };
-	int initSampleSet();
-	Sample *nextSample(Sample *prev);
-	void saveSample(Sample *samp, Colour &col);
-};
-
-/**
  * a camera
  */
 class Camera
@@ -170,6 +115,7 @@
 class Texture
 {
 public:
+	virtual ~Texture() {};
 	virtual Colour evaluate(Vector3 point) = 0;
 };