| 156 | } |
| 157 | |
| 158 | void BlockShadingFixer(int blk, float theta, float rho, TRKBLOCK *trk, POLYGONBLOCK *poly, XOBJBLOCK *xobj) { |
| 159 | int i, j, j2, k, num, num2, blk2; |
| 160 | int result; |
| 161 | double uu, vv, tt; |
| 162 | double corner1[3], corner2[3], corner3[3]; |
| 163 | double Pos[3], RayDir[3], StartPos[3]; |
| 164 | |
| 165 | //long nGPolygons; |
| 166 | LPPOLYGONDATA p, p2; |
| 167 | struct TRKBLOCK *t; |
| 168 | struct FLOATPT *v, *v2; |
| 169 | unsigned long *sv; |
| 170 | |
| 171 | t = &trk[blk]; |
| 172 | v = trk[blk].vert; |
| 173 | sv = reinterpret_cast<unsigned long *>(trk[blk].unknVertices); |
| 174 | |
| 175 | double PI = 3.14159265359; |
| 176 | double PitchAngle = (double) theta; //0.00;//4.712; //0.44; //Theta |
| 177 | double RhoAngle = (double) rho; //0.165; //0.13; //RHO |
| 178 | //to get real Yaw from Rho, it has to be multiplied with 4.(*WRONG*) |
| 179 | //Rho is given as fixed point. (1.0 is 2*pi in radian scale.) |
| 180 | double YawAngle = (2 * PI) * RhoAngle; |
| 181 | |
| 182 | //to get real Pitch from Theta, it needs +pi |
| 183 | //PitchAngle=PitchAngle+pi; |
| 184 | |
| 185 | //double r; |
| 186 | struct FLOATPT VNormal; |
| 187 | VNormal.x = 0; |
| 188 | VNormal.y = 0; |
| 189 | VNormal.z = (float) 0.05; |
| 190 | /* |
| 191 | x=rsin(phi)cos(theta), y=rsin(phi)sin(theta), z=rcos(phi), r=sqrt(x*x+y*y+z*z)... |
| 192 | */ |
| 193 | |
| 194 | p2 = poly[blk].poly[4]; |
| 195 | num2 = poly[blk].sz[4]; |
| 196 | for (j2 = 0; j2 < num2; j2++, p2++) { |
| 197 | for (k = 0; k < 4; k++) { |
| 198 | |
| 199 | //bool tested = new bool[t->nVertices]; |
| 200 | /*for (uint32_t temp=0; temp>trk[blk].nVertices; temp++) |
| 201 | tested[temp]=false;*/ |
| 202 | |
| 203 | assert (p2->vertex[k] >= 0 && p2->vertex[k] < t->nVertices); |
| 204 | |
| 205 | if ((p2->vertex[k] < 0) || (p2->vertex[k] > t->nVertices)) { |
| 206 | std::cout << "FAILED! K: " << k << ", J2:" << j2 << ", BLK:" << blk << std::endl; |
| 207 | return; |
| 208 | } |
| 209 | |
| 210 | VNormal = VertexNormal(blk, p2->vertex[k], trk, poly); |
| 211 | StartPos[0] = (double) v[p2->vertex[k]].x + (VNormal.x / 5); |
| 212 | StartPos[1] = (double) v[p2->vertex[k]].y + (VNormal.y / 5); |
| 213 | StartPos[2] = (double) v[p2->vertex[k]].z + (VNormal.z / 5); |
| 214 | |
| 215 |
no test coverage detected