Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F63238688
pmapopt.c
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sat, May 18, 17:38
Size
5 KB
Mime Type
text/x-c
Expires
Mon, May 20, 17:38 (2 d)
Engine
blob
Format
Raw Data
Handle
17747817
Attached To
R10977 RADIANCE Photon Map
pmapopt.c
View Options
#ifndef lint
static
const
char
RCSid
[]
=
"$Id: pmapopt.c,v 2.10 2020/06/15 22:18:57 rschregle Exp $"
;
#endif
/*
==================================================================
Photon map interface to RADIANCE render options
Roland Schregle (roland.schregle@{hslu.ch, gmail.com})
(c) Fraunhofer Institute for Solar Energy Systems,
supported by the German Research Foundation
(DFG LU-204/10-2, "Fassadenintegrierte Regelsysteme" (FARESYS))
(c) Lucerne University of Applied Sciences and Arts,
supported by the Swiss National Science Foundation
(SNSF #147053, "Daylight Redirecting Components")
(c) Tokyo University of Science,
supported by the JSPS Grants-in-Aid for Scientific Research
(KAKENHI JP19KK0115, "Three-Dimensional Light Flow")
==================================================================
$Id: pmapopt.c,v 2.10 2020/06/15 22:18:57 rschregle Exp $
*/
#include "ray.h"
#include "pmapparm.h"
int
getPmapRenderOpt
(
int
ac
,
char
*
av
[])
/* Parse next render option for photon map; interface to getrenderopt();
* return -1 if parsing failed, else number of parameters consumed */
{
#define check(ol,al) (av[0][ol] || badarg(ac-1,av+1,al))
/* Evaluate boolean option, setting var accordingly */
#define check_bool(olen, var) switch (av [0][olen]) { \
case '\0': \
var = !var; break; \
case 'y': case 'Y': case 't': case 'T': case '+': case '1': \
var = 1; break; \
case 'n': case 'N': case 'f': case 'F': case '-': case '0': \
var = 0; break; \
default: \
return -1; \
}
static
int
t
=
-
1
;
/* pmap parameter index */
if
(
ac
<
1
||
!
av
[
0
]
||
av
[
0
][
0
]
!=
'-'
)
return
-
1
;
switch
(
av
[
0
][
1
])
{
case
'a'
:
switch
(
av
[
0
][
2
])
{
case
'p'
:
/* photon map */
/* Photon map bumps up ambounce from its default 0; SHOULD
THIS REMAIN THE DEFAULT BEHAVIOUR? In some cases it's
desirable to render photons directly via ab -1 */
ambounce
+=
(
ambounce
==
0
);
#ifdef PMAP_PHOTONFLOW
if
(
av
[
0
][
3
]
==
'F'
)
{
/* Evaluate immediate irrad. from volume photon map (if
* specified) as a lightfield, ignoring part. medium */
/* FOR ZE EKSPERTZ ONLY! */
check_bool
(
4
,
photonFlow
);
return
0
;
}
#endif
if
(
!
check
(
3
,
"s"
))
{
/* File -> assume bwidth = 1 or precomputed pmap */
if
(
++
t
>=
NUM_PMAP_TYPES
)
error
(
USER
,
"too many photon maps"
);
pmapParams
[
t
].
fileName
=
savqstr
(
av
[
1
]);
pmapParams
[
t
].
minGather
=
pmapParams
[
t
].
maxGather
=
defaultGather
;
}
else
return
-
1
;
if
(
!
check
(
3
,
"si"
))
{
/* File + bandwidth */
pmapParams
[
t
].
minGather
=
pmapParams
[
t
].
maxGather
=
atoi
(
av
[
2
]);
if
(
!
pmapParams
[
t
].
minGather
)
return
-
1
;
}
else
{
sprintf
(
errmsg
,
"missing photon lookup bandwidth, "
"defaulting to %d"
,
defaultGather
);
error
(
WARNING
,
errmsg
);
return
1
;
}
if
(
!
check
(
3
,
"sii"
))
{
/* File + min bwidth + max bwidth -> bias compensation */
pmapParams
[
t
].
maxGather
=
atoi
(
av
[
3
]);
if
(
pmapParams
[
t
].
minGather
>=
pmapParams
[
t
].
maxGather
)
return
-
1
;
return
3
;
}
else
return
2
;
case
'm'
:
/* Fixed max photon search radius */
if
(
check
(
3
,
"f"
)
||
(
maxDistFix
=
atof
(
av
[
1
]))
<=
0
)
error
(
USER
,
"invalid max photon search radius"
);
return
1
;
#ifdef PMAP_OOC
case
'c'
:
/* OOC pmap cache page size ratio */
if
(
check
(
3
,
"f"
)
||
(
pmapCachePageSize
=
atof
(
av
[
1
]))
<=
0
)
error
(
USER
,
"invalid photon cache page size ratio"
);
return
1
;
case
'C'
:
/* OOC pmap cache size (in photons); 0 = no caching */
if
(
check
(
3
,
"s"
))
error
(
USER
,
"invalid number of cached photons"
);
/* Parsing failure sets to zero and disables caching */
pmapCacheSize
=
parseMultiplier
(
av
[
1
]);
return
1
;
#endif
}
}
#undef check
/* Unknown option */
return
-
1
;
}
void
printPmapDefaults
()
/* Print defaults for photon map render options */
{
printf
(
"-am %.1f
\t\t\t\t
# max photon search radius
\n
"
,
maxDistFix
);
#ifdef PMAP_OOC
printf
(
"-ac %.1f
\t\t\t\t
# photon cache page size ratio
\n
"
,
pmapCachePageSize
);
printf
(
"-aC %ld
\t\t\t
# num cached photons
\n
"
,
pmapCacheSize
);
#endif
#ifdef PMAP_PHOTONFLOW
printf
(
photonFlow
?
"-apF+
\t\t\t\t
# photon flow from volume pmap on
\n
"
:
"-apF-
\t\t\t\t
# photon flow from volume pmap off
\n
"
);
#endif
}
Event Timeline
Log In to Comment