/
area_light.h
44 lines (34 loc) · 972 Bytes
/
area_light.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
#pragma once
#include "redner.h"
#include "vector.h"
#include "buffer.h"
#include "ptr.h"
struct AreaLight {
AreaLight() {}
AreaLight(int shape_id,
const ptr<float> intensity_data,
bool two_sided) : shape_id(shape_id), two_sided(two_sided) {
intensity[0] = intensity_data[0];
intensity[1] = intensity_data[1];
intensity[2] = intensity_data[2];
}
AreaLight(int shape_id,
const Vector3f &intensity,
bool two_sided) :
shape_id(shape_id), intensity(intensity), two_sided(two_sided) {}
int shape_id;
Vector3f intensity;
bool two_sided;
};
struct DAreaLight {
DAreaLight(ptr<float> intensity_data) : intensity(intensity_data.get()) {
}
float *intensity;
};
template <typename T>
struct TLightSample {
T light_sel;
T tri_sel;
TVector2<T> uv;
};
using LightSample = TLightSample<Real>;