|
![](/i/fill.gif) |
Old code:
static void Box_Normal(VECTOR Result, OBJECT *Object, INTERSECTION *Inter)
{
switch (Inter->i1)
{
case SIDE_X_0: Make_Vector(Result, -1.0, 0.0, 0.0); break;
case SIDE_X_1: Make_Vector(Result, 1.0, 0.0, 0.0); break;
case SIDE_Y_0: Make_Vector(Result, 0.0, -1.0, 0.0); break;
case SIDE_Y_1: Make_Vector(Result, 0.0, 1.0, 0.0); break;
case SIDE_Z_0: Make_Vector(Result, 0.0, 0.0, -1.0); break;
case SIDE_Z_1: Make_Vector(Result, 0.0, 0.0, 1.0); break;
default: Error("Unknown box side in Box_Normal().\n");
}
/* Transform the point into the boxes space. */
if (((BOX *)Object)->Trans != NULL)
{
MTransNormal(Result, Result, ((BOX *)Object)->Trans);
VNormalize(Result, Result);
}
}
New code:
static void Box_Normal(VECTOR Result, OBJECT *Object, INTERSECTION *Inter)
{
if (((BOX *)Object)->Trans == NULL )
switch (Inter->i1)
{
case SIDE_X_0: Make_Vector(Result, -1.0, 0.0, 0.0); break;
case SIDE_X_1: Make_Vector(Result, 1.0, 0.0, 0.0); break;
case SIDE_Y_0: Make_Vector(Result, 0.0, -1.0, 0.0); break;
case SIDE_Y_1: Make_Vector(Result, 0.0, 1.0, 0.0); break;
case SIDE_Z_0: Make_Vector(Result, 0.0, 0.0, -1.0); break;
case SIDE_Z_1: Make_Vector(Result, 0.0, 0.0, 1.0); break;
default: Error("Unknown box side in Box_Normal().\n");
}
else
switch (Inter->i1)
{
case SIDE_X_0: Assign_Vector(Result, ((BOX *)Object)->N_X_0); break;
case SIDE_X_1: Assign_Vector(Result, ((BOX *)Object)->N_X_1); break;
case SIDE_Y_0: Assign_Vector(Result, ((BOX *)Object)->N_Y_0); break;
case SIDE_Y_1: Assign_Vector(Result, ((BOX *)Object)->N_Y_1); break;
case SIDE_Z_0: Assign_Vector(Result, ((BOX *)Object)->N_Z_0); break;
case SIDE_Z_1: Assign_Vector(Result, ((BOX *)Object)->N_Z_1); break;
default: Error("Unknown box side in Box_Normal().\n");
}
}
Complete source at page -- Box' patch -- via
http://members.xoom.com/dmilos/pov/mypovpage.htm
Post a reply to this message
|
![](/i/fill.gif) |