Texture information.
{
Float lenxinv=0.0,lenyinv=0.0;
if (tdp->lenx!=0.0) lenxinv = 1.0/tdp->lenx;
if (tdp->leny!=0.0) lenyinv = 1.0/tdp->leny;
switch (tdp->proj)
{
{
return true;
}
{
if (sq==0.0)
{
uv->x = 0.0;
if (d.y>0.0)
uv->y = +0.5;
else
uv->y = -0.5;
}
else
{
if (d.z<0.0) uv->x = 1.0-uv->x;
uv->x -= tdp->ox;
if (tdp->lenx>0.0 && uv->x<0.0)
uv->x += 1.0;
else if (tdp->lenx<0.0 && uv->x>0.0)
uv->x -= 1.0;
uv->x *= lenxinv;
}
uv->y = -(uv->y+tdp->oy)*lenyinv;
break;
}
{
if (sq==0.0)
{
uv->x = 0.0;
if (d.y>0.0)
uv->y = 0.0;
else
uv->y = 1.0;
}
else
{
if (d.z<0.0) uv->x = 1.0-uv->x;
}
uv->x = (0.5 + 0.5*cs*uv->y - tdp->ox)*lenxinv;
uv->y = (0.5 + 0.5*sn*uv->y - tdp->oy)*lenyinv;
break;
}
{
if (sq==0.0)
uv->x = 0.0;
else
{
if (d.z<0.0) uv->x = 1.0-uv->x;
uv->x -= tdp->ox;
if (tdp->lenx>0.0 && uv->x<0.0)
uv->x += 1.0;
else if (tdp->lenx<0.0 && uv->x>0.0)
uv->x -= 1.0;
uv->x *= lenxinv;
}
uv->y = -(d.y*0.5+tdp->oy)*lenyinv;
break;
}
{
uv->x = (d.x*0.5-tdp->ox)*lenxinv;
uv->y = -(d.y*0.5+tdp->oy)*lenyinv;
break;
}
{
{
dir = 0;
else
dir = 2;
}
else
{
dir = 1;
else
dir = 2;
}
switch (dir)
{
case 0:
{
uv->x = (-d.z*0.5-tdp->ox)*lenxinv;
else
uv->x = ( d.z*0.5-tdp->ox)*lenxinv;
uv->y = -(d.y*0.5+tdp->oy)*lenyinv;
break;
}
case 1:
{
uv->y = ( d.z*0.5-tdp->oy)*lenyinv;
else
uv->y = (-d.z*0.5-tdp->oy)*lenyinv;
uv->x = (d.x*0.5-tdp->ox)*lenxinv;
break;
}
case 2:
{
uv->x = ( d.x*0.5-tdp->ox)*lenxinv;
else
uv->x = (-d.x*0.5-tdp->ox)*lenxinv;
uv->y = -(d.y*0.5+tdp->oy)*lenyinv;
break;
}
}
break;
}
{
RayParameter *param=sd->GetRayParameter();
Float ox=0.0,
oy=0.0,ax=param->xres,ay=param->yres;
sd->GetXY(&curr_x,&curr_y,&scl);
uv->x = ((
Float(curr_x)/
Float(scl)-
ox)/ax - tdp->ox)*lenxinv;
uv->y = ((
Float(curr_y)/
Float(scl)-
ox)/ay - tdp->oy)*lenyinv;
break;
}
{
RayObject *
op=sd->ID_to_Obj(lhit,
nullptr);
if (
op && tdp->uvwind<
op->uvwcnt &&
op->uvwadr[tdp->uvwind])
*uv=sd->GetPointUVW(tdp,lhit,
p);
else
uv->x = uv->y = 0.0;
break;
}
}
return true;
else
return uv->x>=0.0 && uv->x<=1.0 && uv->y>=0.0 && uv->y<=1.0;
}
PyObject PyObject * v
Definition: abstract.h:297
const Py_UNICODE size_t n
Definition: unicodeobject.h:1184
unsigned char * p
Definition: floatobject.h:87
#define TEX_TILE
Texture tile enabled.
Definition: c4d_shader.h:22
#define P_UVW
UVW.
Definition: c4d_raytrace.h:28
#define P_FRONTAL
Frontal.
Definition: c4d_raytrace.h:26
#define P_VOLUMESHADER
Volume.
Definition: c4d_raytrace.h:31
#define P_SPATIAL
Spatial.
Definition: c4d_raytrace.h:27
#define P_CUBIC
Cubic.
Definition: c4d_raytrace.h:25
#define P_SPHERICAL
Spherical.
Definition: c4d_raytrace.h:22
#define P_CYLINDRICAL
Cylindrical.
Definition: c4d_raytrace.h:23
#define P_SHRINKWRAP
Shrinkwrap.
Definition: c4d_raytrace.h:29
#define P_FLAT
Flat.
Definition: c4d_raytrace.h:24
static constexpr Float64 PI2
floating point constant: 2.0 * PI
Definition: apibasemath.h:118
Float32 ATan(Float32 val)
Definition: apibasemath.h:150
Float32 Sqrt(Float32 val)
Definition: apibasemath.h:168
Float32 Abs(Float32 val)
Definition: apibasemath.h:195
void SinCos(Float32 r, Float32 &sn, Float32 &cs)
Definition: apibasemath.h:270
Float32 ACos(Float32 val)
Calculates arccosine. The input value is clipped for safety to avoid exceptions.
Definition: apibasemath.h:249
maxon::Bool Bool
Definition: ge_sys_math.h:46
maxon::Int32 Int32
Definition: ge_sys_math.h:51
maxon::Float Float
Definition: ge_sys_math.h:57
maxon::Vec3< maxon::Float64, 1 > Vector
Definition: ge_math.h:140
PyObject * op
Definition: object.h:520
Float oy
Definition: c4d_shader.h:773
Float ox
Definition: c4d_shader.h:771
PI
Definition: unicodeutils.h:16