Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F90983720
t_func.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
Wed, Nov 6, 15:54
Size
1 KB
Mime Type
text/x-c
Expires
Fri, Nov 8, 15:54 (2 d)
Engine
blob
Format
Raw Data
Handle
22172772
Attached To
R10977 RADIANCE Photon Map
t_func.c
View Options
#ifndef lint
static
const
char
RCSid
[]
=
"$Id: t_func.c,v 2.10 2014/07/08 18:25:00 greg Exp $"
;
#endif
/*
* t_func.c - routine for procedural textures.
*/
#include "copyright.h"
#include "ray.h"
#include "func.h"
#include "rtotypes.h"
/*
* A procedural texture perturbs the surface normal
* at the point of intersection with an object. It has
* the form:
*
* modifier texfunc name
* 4+ xvarname yvarname zvarname filename xf
* 0
* n A1 A2 ..
*
* Filename is the name of the file where the variable definitions
* can be found. The list of real arguments can be accessed by
* definitions in the file. The xf is a transformation to get
* from the original coordinates to the current coordinates.
*/
int
t_func
(
/* compute texture for ray */
OBJREC
*
m
,
RAY
*
r
)
{
FVECT
disp
;
double
d
;
MFUNC
*
mf
;
int
i
;
if
(
m
->
oargs
.
nsargs
<
4
)
objerror
(
m
,
USER
,
"bad # arguments"
);
mf
=
getfunc
(
m
,
3
,
0x7
,
1
);
setfunc
(
m
,
r
);
errno
=
0
;
for
(
i
=
0
;
i
<
3
;
i
++
)
{
disp
[
i
]
=
evalue
(
mf
->
ep
[
i
]);
if
(
errno
==
EDOM
||
errno
==
ERANGE
)
{
objerror
(
m
,
WARNING
,
"compute error"
);
return
(
0
);
}
}
if
(
mf
->
fxp
!=
&
unitxf
)
multv3
(
disp
,
disp
,
mf
->
fxp
->
xfm
);
if
(
r
->
rox
!=
NULL
)
{
multv3
(
disp
,
disp
,
r
->
rox
->
f
.
xfm
);
d
=
1.0
/
(
mf
->
fxp
->
sca
*
r
->
rox
->
f
.
sca
);
}
else
d
=
1.0
/
mf
->
fxp
->
sca
;
VSUM
(
r
->
pert
,
r
->
pert
,
disp
,
d
);
return
(
0
);
}
Event Timeline
Log In to Comment