|
![](/i/fill.gif) |
On Sun, 05 Dec 1999 17:29:50 -0500, Nathan Kopp <Nat### [at] Kopp com>
wrote:
Nathan Kopp <Nat### [at] Kopp com> wrote...
> if (Intersection->Object->UV_Trans)
> {
>
> MInvTransNormal(LayNormal,LayNormal,Intersection->Object->UV_Trans);
> VNormalizeEq(LayNormal);
> }
>
> Perturb_Normal(LayNormal, Layer->Tnormal, IPoint, Intersection);
>
> if (Intersection->Object->UV_Trans)
> {
> MTransNormal(LayNormal,LayNormal,Intersection->Object->UV_Trans);
> VNormalizeEq(LayNormal);
> }
This code is WRONG!
If you do this, than transformations prior to applying the surface
normal
will affect the surface normal. This is BAD.
The code should look more like this (provides backwards compatibility,
too):
if (opts.Language_Version>3.1 &&
Layer->Tnormal->Warps &&
Layer->Tnormal->Warps->Warp_Type==TRANSFORM_WARP)
{
TRANS *Tr;
Tr=(TRANS *)(Layer->Tnormal->Warps);
MInvTransNormal(LayNormal, LayNormal, &(Tr->Trans));
VNormalizeEq(LayNormal);
}
Perturb_Normal(LayNormal, Layer->Tnormal, IPoint, Intersection);
if (opts.Language_Version>3.1 &&
Layer->Tnormal->Warps &&
Layer->Tnormal->Warps->Warp_Type==TRANSFORM_WARP)
{
TRANS *Tr;
Tr=(TRANS *)(Layer->Tnormal->Warps);
MTransNormal(LayNormal, LayNormal, &(Tr->Trans));
VNormalizeEq(LayNormal);
}
Note that this no longer requires UVTrans (which means that it could
be
applied to the official 3.1... after much more testing, of course).
-Nathan
Post a reply to this message
|
![](/i/fill.gif) |