-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPhotonmap.h
58 lines (49 loc) · 1.33 KB
/
Photonmap.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#pragma once
#include "MCRenderer.h"
#include "Hashgrid.h"
#include "BSDF.h"
#include "SceneVPMObject.h"
#include "SceneHeterogeneousVolume.h"
#include <omp.h>
class PhotonMap : public MCRenderer
{
private:
HashGrid surfaceHashGrid;
omp_lock_t surfaceHashGridLock;
HashGrid volumeHashGrid;
omp_lock_t volumeHashGridLock;
float mBaseRadius;
float mRadius;
float mAlpha;
int mPhotonsNum;
unsigned spp;
unsigned timeInterval , recordTime;
bool rayMarching;
typedef struct HashGridVertex{
Path *pathThePointIn;
uint indexInThePath;
vec3f position;
Ray::PhotonType photonType;
HashGridVertex(){
pathThePointIn = NULL;
photonType = Ray::OUTVOL;
indexInThePath = -1;
}
vec3f GetPosition() const{ return position; }
} LightPoint;
public:
PhotonMap(Renderer *renderer) : MCRenderer(renderer)
{
mAlpha = 2.0/3;
mPhotonsNum = renderer->camera.width * renderer->camera.height;
spp = -1;
timeInterval = 3600;
recordTime = 3600;
}
void setRadius(float r) { mBaseRadius = r; }
void throughputByDensityEstimation(vec3f &color, Path &eyeMergePath,
std::vector<LightPoint> &surfaceVertices, std::vector<LightPoint> &volumeVertices);
void sampleMergePath(Path &path, Ray &prevRay, uint depth) const;
virtual vector<vec3f> renderPixels(const Camera& camera);
omp_lock_t debugPrintLock;
};