Subversion Repositories gelsvn

Rev

Rev 355 | Rev 367 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 355 Rev 357
Line -... Line 1...
-
 
1
#include <stdlib.h>
-
 
2
#include <GL/glut.h>
-
 
3
 
-
 
4
#include <CGLA/Vec2i.h>
-
 
5
#include <CGLA/Vec3uc.h>
-
 
6
 
-
 
7
#include "scene.h"
-
 
8
#include "camera.h"
-
 
9
#include "mesh.h"
-
 
10
#include "omni.h"
-
 
11
 
-
 
12
#include "matte.h"
-
 
13
#include "plastic.h"
-
 
14
#include "metal.h"
-
 
15
#include "glass.h"
-
 
16
 
1
#include "pathtracer.h"
17
#include "pathtracer.h"
2
 
18
 
3
using namespace CGLA;
19
using namespace CGLA;
4
 
20
 
-
 
21
//global pointer to the active scene
-
 
22
scene* current;
-
 
23
 
-
 
24
static pathtracer* renderer;
-
 
25
 
-
 
26
const int width = 64*8;
-
 
27
const int height = 64*8;
-
 
28
 
-
 
29
static Vec3f* film;
-
 
30
static Vec3uc* image;
-
 
31
static Vec2i pixel(0);
-
 
32
static bool done = false;
-
 
33
 
-
 
34
static float dgamma = 2.2f;
-
 
35
static float dexposure = 0.f;
-
 
36
 
-
 
37
 
5
pathtracer::pathtracer(int w, int h, bool explicit_direct, int subsamples)
38
pathtracer::pathtracer(int w, int h, bool explicit_direct, int subsamples)
6
: width_(w), height_(h), scene_(0)
39
: width_(w), height_(h), scene_(0)
7
{
40
{
8
    explicit_direct_ = explicit_direct;
41
    explicit_direct_ = explicit_direct;
9
    subsamples_ = subsamples;
42
    subsamples_ = subsamples;
Line 166... Line 199...
166
    }
199
    }
167
 
200
 
168
    return L / float(subsamples_ * subsamples_);
201
    return L / float(subsamples_ * subsamples_);
169
}
202
}
170
 
203
 
171
//02566 framework, Anders Wang Kristensen, awk@imm.dtu.dk, 2007
-
 
172
 
-
 
173
#if 0
-
 
174
//02566 framework, Anders Wang Kristensen, awk@imm.dtu.dk, 2007
-
 
175
 
-
 
176
#include <stdlib.h>
-
 
177
#include <GL/glut.h>
-
 
178
 
-
 
179
#include <CGLA/Vec2i.h>
-
 
180
#include <CGLA/Vec3uc.h>
-
 
181
 
-
 
182
#include "scene.h"
-
 
183
#include "camera.h"
-
 
184
#include "mesh.h"
-
 
185
#include "omni.h"
-
 
186
 
-
 
187
#include "matte.h"
-
 
188
#include "plastic.h"
-
 
189
#include "metal.h"
-
 
190
#include "glass.h"
-
 
191
 
-
 
192
#include "pathtracer.h"
-
 
193
 
-
 
194
using namespace CGLA;
-
 
195
 
-
 
196
//global pointer to the active scene
-
 
197
scene* current;
-
 
198
 
-
 
199
static pathtracer* renderer;
-
 
200
 
-
 
201
const int width = 64*8;
-
 
202
const int height = 64*8;
-
 
203
 
-
 
204
static Vec3f* film;
-
 
205
static Vec3uc* image;
-
 
206
static Vec2i pixel(0);
-
 
207
static bool done = false;
-
 
208
 
-
 
209
static float dgamma = 2.2f;
-
 
210
static float dexposure = 0.f;
-
 
211
 
204
 
212
Vec3uc tonemap(const Vec3f& v)
205
Vec3uc tonemap(const Vec3f& v)
213
{
206
{
214
    Vec3f u = v * std::pow(2.f, dexposure);
207
    Vec3f u = v * std::pow(2.f, dexposure);
215
    float r = mt_random() - 0.5f;
208
    float r = mt_random() - 0.5f;
Line 469... Line 462...
469
    delete current;
462
    delete current;
470
    delete renderer;
463
    delete renderer;
471
 
464
 
472
    return EXIT_SUCCESS;
465
    return EXIT_SUCCESS;
473
}
466
}
474
#endif
-