| 699 | } |
| 700 | |
| 701 | void ObjectShadingFixer(int blk, float theta, float rho, TRKBLOCK *trk, POLYGONBLOCK *poly, XOBJBLOCK *xobj) { |
| 702 | int i, j, j2, k, num, num2, blk2; |
| 703 | int result; |
| 704 | double uu, vv, tt; |
| 705 | double corner1[3], corner2[3], corner3[3]; |
| 706 | double Pos[3], RayDir[3], StartPos[3]; |
| 707 | |
| 708 | LPPOLYGONDATA p, p2; |
| 709 | |
| 710 | struct TRKBLOCK *t; |
| 711 | struct FLOATPT *v, *v2; |
| 712 | unsigned long *sv; |
| 713 | |
| 714 | t = &trk[blk]; |
| 715 | v = trk[blk].vert; |
| 716 | sv = reinterpret_cast<unsigned long *>(trk[blk].unknVertices); |
| 717 | |
| 718 | //malloc example: |
| 719 | // a1 = (double *)malloc(m*m*sizeof(double)); |
| 720 | |
| 721 | double PI = 3.14159265359; |
| 722 | double PitchAngle = (double) theta; //0.00;//4.712; //0.44; //Theta |
| 723 | double RhoAngle = (double) rho; //0.165; //0.13; //RHO |
| 724 | //to get real Yaw from Rho, it has to be multiplied with 4.(*WRONG*) |
| 725 | //Rho is given as fixed point. (1.0 is 2*pi in radian scale.) |
| 726 | double YawAngle = (2 * PI) * RhoAngle; |
| 727 | |
| 728 | //to get real Pitch from Theta, it needs +pi |
| 729 | //PitchAngle=PitchAngle+pi; |
| 730 | |
| 731 | //double r; |
| 732 | struct FLOATPT VNormal; |
| 733 | VNormal.x = 0; |
| 734 | VNormal.y = 0; |
| 735 | VNormal.z = (float) 0.05; |
| 736 | |
| 737 | /* |
| 738 | x=rsin(phi)cos(theta), y=rsin(phi)sin(theta), z=rcos(phi), r=sqrt(x*x+y*y+z*z)... |
| 739 | */ |
| 740 | |
| 741 | for (long chkchunkcounter = 0; chkchunkcounter < 4; chkchunkcounter++) { |
| 742 | long chknumobj = poly[blk].obj[chkchunkcounter].nobj; |
| 743 | for (long chkobjcounter = 0; chkobjcounter < chknumobj; chkobjcounter++) { |
| 744 | num2 = poly[blk].obj[chkchunkcounter].numpoly[chkobjcounter]; |
| 745 | p2 = poly[blk].obj[chkchunkcounter].poly[chkobjcounter]; |
| 746 | |
| 747 | for (j2 = 0; j2 < num2; j2++, p2++) { |
| 748 | for (k = 0; k < 4; k++) { |
| 749 | |
| 750 | //bool tested = new bool[t->nVertices]; |
| 751 | /*for (uint32_t temp=0; temp>trk[blk].nVertices; temp++) |
| 752 | tested[temp]=false;*/ |
| 753 | |
| 754 | assert (p2->vertex[k] >= 0 && p2->vertex[k] < t->nVertices); |
| 755 | |
| 756 | if ((p2->vertex[k] < 0) || (p2->vertex[k] > t->nVertices)) { |
| 757 | std::cout << "FAILED! K: " << k << ", J2:" << j2 << ", BLK:" << blk << std::endl; |
| 758 | return; |
no test coverage detected