4 |
|
|
5 |
|
Roland Schregle (roland.schregle@{hslu.ch, gmail.com}) |
6 |
|
(c) Fraunhofer Institute for Solar Energy Systems, |
7 |
< |
Lucerne University of Applied Sciences & Arts |
7 |
> |
(c) Lucerne University of Applied Sciences and Arts, |
8 |
> |
supported by the Swiss National Science Foundation (SNSF, #147053) |
9 |
|
================================================================== |
10 |
|
|
11 |
|
$Id$ |
47 |
|
if (!emap -> partitions) |
48 |
|
error(USER, "can't allocate source partitions"); |
49 |
|
|
50 |
< |
bzero(emap -> partitions + (emap -> maxPartitions >> 2), |
51 |
< |
emap -> maxPartitions >> 2); |
50 |
> |
memset(emap -> partitions + (emap -> maxPartitions >> 2), 0, |
51 |
> |
emap -> maxPartitions >> 2); |
52 |
|
} |
53 |
|
|
54 |
|
if (du2 * dv2 <= 1) { /* hit limit? */ |
101 |
|
RREAL *vp; |
102 |
|
double du2, dv2; |
103 |
|
|
104 |
< |
bzero(emap -> partitions, emap -> maxPartitions >> 1); |
104 |
> |
memset(emap -> partitions, 0, emap -> maxPartitions >> 1); |
105 |
|
emap -> partArea = srcsizerat * thescene.cusize; |
106 |
|
emap -> partArea *= emap -> partArea; |
107 |
|
vp = emap -> src -> ss [SU]; |
133 |
|
|
134 |
|
else { |
135 |
|
/* No photon ports defined, so partition scene cube faces */ |
136 |
< |
bzero(emap -> partitions, emap -> maxPartitions >> 1); |
136 |
> |
memset(emap -> partitions, 0, emap -> maxPartitions >> 1); |
137 |
|
setpart(emap -> partitions, 0, S0); |
138 |
|
emap -> partitionCnt = 0; |
139 |
|
emap -> numPartitions = 1 / srcsizerat; |
151 |
|
{ |
152 |
|
unsigned numTheta, numPhi; |
153 |
|
|
154 |
< |
bzero(emap -> partitions, emap -> maxPartitions >> 1); |
154 |
> |
memset(emap -> partitions, 0, emap -> maxPartitions >> 1); |
155 |
|
setpart(emap -> partitions, 0, S0); |
156 |
|
emap -> partArea = 4 * PI * sqr(emap -> src -> srad); |
157 |
|
emap -> numPartitions = emap -> partArea / |
181 |
|
emap -> maxPartitions >> 1); |
182 |
|
if (!emap -> partitions) |
183 |
|
error(USER, "can't allocate source partitions"); |
184 |
< |
bzero(emap -> partitions + (emap -> maxPartitions >> 2), |
184 |
> |
|
185 |
> |
memset(emap -> partitions + (emap -> maxPartitions >> 2), 0, |
186 |
|
emap -> maxPartitions >> 2); |
187 |
|
} |
188 |
|
|
224 |
|
{ |
225 |
|
double d2; |
226 |
|
|
227 |
< |
bzero(emap -> partitions, emap -> maxPartitions >> 1); |
227 |
> |
memset(emap -> partitions, 0, emap -> maxPartitions >> 1); |
228 |
|
d2 = srcsizerat * thescene.cusize; |
229 |
|
d2 = PI * emap -> src -> ss2 / (2 * emap -> src -> srad * sqr(d2)); |
230 |
|
d2 *= d2 * DOT(emap -> src -> ss [SU], emap -> src -> ss [SU]); |
592 |
|
unsigned i, t, p; |
593 |
|
double phi, cosTheta, sinTheta, du, dv, dOmega, thetaScale; |
594 |
|
EmissionSample* sample; |
595 |
< |
const OBJREC* mod = objptr(emap -> src -> so -> omod); |
595 |
> |
const OBJREC* mod = findmaterial(emap -> src -> so); |
596 |
|
static RAY r; |
597 |
|
#if 0 |
598 |
|
static double lastCosNorm = FHUGE; |
599 |
|
static SRCREC *lastSrc = NULL, *lastPort = NULL; |
600 |
|
#endif |
601 |
|
|
602 |
+ |
setcolor(emap -> partFlux, 0, 0, 0); |
603 |
+ |
|
604 |
|
photonOrigin [emap -> src -> so -> otype] (emap); |
605 |
|
cosTheta = DOT(emap -> ws, emap -> wh); |
606 |
|
|
623 |
|
#endif |
624 |
|
|
625 |
|
/* Need to recompute flux & PDF */ |
622 |
– |
setcolor(emap -> partFlux, 0, 0, 0); |
626 |
|
emap -> cdf = 0; |
627 |
|
emap -> numSamples = 0; |
628 |
|
|
671 |
|
|
672 |
|
VCOPY(r.rorg, emap -> photonOrg); |
673 |
|
VCOPY(r.rop, emap -> photonOrg); |
674 |
< |
r.rmax = FHUGE; |
674 |
> |
r.rmax = 0; |
675 |
|
|
676 |
|
for (t = 0; t < emap -> numTheta; t++) { |
677 |
|
for (p = 0; p < emap -> numPhi; p++) { |
741 |
|
unsigned long i, lo, hi; |
742 |
|
const EmissionSample* sample = emap -> samples; |
743 |
|
RREAL du, dv, cosTheta, cosThetaSqr, sinTheta, phi; |
744 |
< |
const OBJREC* mod = objptr(emap -> src -> so -> omod); |
744 |
> |
const OBJREC* mod = findmaterial(emap -> src -> so); |
745 |
|
|
746 |
|
/* Choose a new origin within current partition for every |
747 |
|
emitted photon to break up clustering artifacts */ |
748 |
|
photonOrigin [emap -> src -> so -> otype] ((EmissionMap*)emap); |
749 |
+ |
/* If we have a local glow source with a maximum radius, then |
750 |
+ |
restrict our photon to the specified distance (otherwise no limit) */ |
751 |
+ |
if (mod -> otype == MAT_GLOW && !(emap -> src -> sflags & SDISTANT) |
752 |
+ |
&& mod -> oargs.farg[3] > FTINY) |
753 |
+ |
ray -> rmax = mod -> oargs.farg[3]; |
754 |
+ |
else |
755 |
+ |
ray -> rmax = 0; |
756 |
|
rayorigin(ray, PRIMARY, NULL, NULL); |
747 |
– |
ray -> rmax = FHUGE; |
757 |
|
|
758 |
|
if (!emap -> numSamples) { |
759 |
|
/* Source is unmodified and has no port, and either local with |