forked from BachiLi/redner
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patharea_light.h
52 lines (43 loc) · 1.13 KB
/
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
45
46
47
48
49
50
51
52
#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,
bool directly_visible) :
shape_id(shape_id),
two_sided(two_sided),
directly_visible(directly_visible) {
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,
bool directly_visible) :
shape_id(shape_id),
intensity(intensity),
two_sided(two_sided),
directly_visible(directly_visible) {}
int shape_id;
Vector3f intensity;
bool two_sided;
bool directly_visible;
};
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>;