Mercurial > mm7
comparison stru10.cpp @ 1319:2ddb0af0f437
m
author | Ritor1 |
---|---|
date | Fri, 28 Jun 2013 11:34:09 +0600 |
parents | 66c625fd1113 |
children | a109bb203e28 |
comparison
equal
deleted
inserted
replaced
1318:0ec2f944fccc | 1319:2ddb0af0f437 |
---|---|
182 y_max = v46[i].y; | 182 y_max = v46[i].y; |
183 y_max_idx = v46[i].c; | 183 y_max_idx = v46[i].c; |
184 } | 184 } |
185 } | 185 } |
186 | 186 |
187 | |
188 | |
189 auto p1 = &pIndoor->pVertices[pFace->pVertexIDs[x_min_idx]]; | |
190 RenderVertexSoft v1; // [sp+30Ch] [bp-54h]@24 | 187 RenderVertexSoft v1; // [sp+30Ch] [bp-54h]@24 |
191 v1.vWorldPosition.x = (float)p1->x; | 188 v1.vWorldPosition.x = (float)pIndoor->pVertices[pFace->pVertexIDs[x_min_idx]].x; |
192 v1.vWorldPosition.y = (float)p1->y; | 189 v1.vWorldPosition.y = (float)pIndoor->pVertices[pFace->pVertexIDs[x_min_idx]].y; |
193 v1.vWorldPosition.z = (float)p1->z; | 190 v1.vWorldPosition.z = (float)pIndoor->pVertices[pFace->pVertexIDs[x_min_idx]].z; |
194 memcpy(pOutVertices + 0, &v1, sizeof(RenderVertexSoft)); | 191 memcpy(&pOutVertices[0], &v1, sizeof(RenderVertexSoft)); |
195 | 192 |
196 auto p2 = &pIndoor->pVertices[pFace->pVertexIDs[y_min_idx]]; | |
197 RenderVertexSoft v2; // [sp+30Ch] [bp-54h]@24 | 193 RenderVertexSoft v2; // [sp+30Ch] [bp-54h]@24 |
198 v2.vWorldPosition.x = (float)p2->x; | 194 v2.vWorldPosition.x = (float)pIndoor->pVertices[pFace->pVertexIDs[y_min_idx]].x; |
199 v2.vWorldPosition.y = (float)p2->y; | 195 v2.vWorldPosition.y = (float)pIndoor->pVertices[pFace->pVertexIDs[y_min_idx]].y; |
200 v2.vWorldPosition.z = (float)p2->z; | 196 v2.vWorldPosition.z = (float)pIndoor->pVertices[pFace->pVertexIDs[y_min_idx]].z; |
201 memcpy(pOutVertices + 1, &v2, sizeof(RenderVertexSoft)); | 197 memcpy(&pOutVertices[1], &v2, sizeof(RenderVertexSoft)); |
202 | 198 |
203 auto p3 = &pIndoor->pVertices[pFace->pVertexIDs[x_max_idx]]; | |
204 RenderVertexSoft v3; // [sp+30Ch] [bp-54h]@24 | 199 RenderVertexSoft v3; // [sp+30Ch] [bp-54h]@24 |
205 v3.vWorldPosition.x = (float)p3->x; | 200 v3.vWorldPosition.x = (float)pIndoor->pVertices[pFace->pVertexIDs[x_max_idx]].x; |
206 v3.vWorldPosition.y = (float)p3->y; | 201 v3.vWorldPosition.y = (float)pIndoor->pVertices[pFace->pVertexIDs[x_max_idx]].y; |
207 v3.vWorldPosition.z = (float)p3->z; | 202 v3.vWorldPosition.z = (float)pIndoor->pVertices[pFace->pVertexIDs[x_max_idx]].z; |
208 memcpy(pOutVertices + 2, &v3, sizeof(RenderVertexSoft)); | 203 memcpy(&pOutVertices[2], &v3, sizeof(RenderVertexSoft)); |
209 | 204 |
210 auto p4 = &pIndoor->pVertices[pFace->pVertexIDs[y_max_idx]]; | |
211 RenderVertexSoft v4; // [sp+30Ch] [bp-54h]@24 | 205 RenderVertexSoft v4; // [sp+30Ch] [bp-54h]@24 |
212 v4.vWorldPosition.x = (double)p4->x; | 206 v4.vWorldPosition.x = (double)pIndoor->pVertices[pFace->pVertexIDs[y_max_idx]].x; |
213 v4.vWorldPosition.y = (double)p4->y; | 207 v4.vWorldPosition.y = (double)pIndoor->pVertices[pFace->pVertexIDs[y_max_idx]].y; |
214 v4.vWorldPosition.z = (double)p4->z; | 208 v4.vWorldPosition.z = (double)pIndoor->pVertices[pFace->pVertexIDs[y_max_idx]].z; |
215 memcpy(pOutVertices + 3, &v4, sizeof(RenderVertexSoft)); | 209 memcpy(&pOutVertices[3], &v4, sizeof(RenderVertexSoft)); |
216 } | 210 } |
217 | 211 |
218 | 212 |
219 //----- (0049C9E3) -------------------------------------------------------- | 213 //----- (0049C9E3) -------------------------------------------------------- |
220 bool stru10::CalcFaceBounding(BLVFace *pFace, RenderVertexSoft *pFaceLimits, unsigned int uNumVertices, RenderVertexSoft *pOutBounding) | 214 bool stru10::CalcFaceBounding(BLVFace *pFace, RenderVertexSoft *pFaceLimits, unsigned int uNumVertices, RenderVertexSoft *pOutBounding) |
257 float var_28; | 251 float var_28; |
258 float var_24; | 252 float var_24; |
259 switch (pFace->uPolygonType) | 253 switch (pFace->uPolygonType) |
260 { | 254 { |
261 case POLYGON_VerticalWall: | 255 case POLYGON_VerticalWall: |
262 a1.x = -pFace->pFacePlane.vNormal.y; | 256 a1.x = -pFace->pFacePlane.vNormal.y;// направление полигона |
263 a1.y = pFace->pFacePlane.vNormal.x; | 257 a1.y = pFace->pFacePlane.vNormal.x; |
264 a1.z = 0.0f; | 258 a1.z = 0.0f; |
265 a1.Normalize(); | 259 a1.Normalize(); |
266 | 260 |
267 var_28 = 0; | 261 var_28 = 0; |
298 a3 = face_center_x - pFaceLimits[0].vWorldPosition.x; | 292 a3 = face_center_x - pFaceLimits[0].vWorldPosition.x; |
299 var_8 = face_center_y - pFaceLimits[1].vWorldPosition.y; | 293 var_8 = face_center_y - pFaceLimits[1].vWorldPosition.y; |
300 } | 294 } |
301 if (pFace->uAttributes & 0x0200) | 295 if (pFace->uAttributes & 0x0200) |
302 { | 296 { |
303 face_center_x = (pFaceLimits[0].vWorldPosition.x + pFaceLimits[2].vWorldPosition.x) / 2; | 297 face_center_x = (pFaceLimits[0].vWorldPosition.x + pFaceLimits[2].vWorldPosition.x) / 2;// центр полигона |
304 face_center_y = (pFaceLimits[0].vWorldPosition.y + pFaceLimits[2].vWorldPosition.y) / 2; | 298 face_center_y = (pFaceLimits[0].vWorldPosition.y + pFaceLimits[2].vWorldPosition.y) / 2; |
305 face_center_z = (pFaceLimits[1].vWorldPosition.z + pFaceLimits[3].vWorldPosition.z) / 2; | 299 face_center_z = (pFaceLimits[1].vWorldPosition.z + pFaceLimits[3].vWorldPosition.z) / 2; |
306 | 300 |
307 a3 = face_center_x - pFaceLimits[0].vWorldPosition.x; | 301 a3 = face_center_x - pFaceLimits[0].vWorldPosition.x;//от центра до верхнего края |
308 var_8 = face_center_z - pFaceLimits[1].vWorldPosition.z; | 302 var_8 = face_center_z - pFaceLimits[1].vWorldPosition.z;// высота от центра |
309 | 303 |
310 if (pFace->uPolygonType == POLYGON_VerticalWall) | 304 if (pFace->uPolygonType == POLYGON_VerticalWall) |
311 a3 /= a1.x; | 305 a3 /= a1.x; |
312 } | 306 } |
313 if (pFace->uAttributes & 0x0400) | 307 if (pFace->uAttributes & 0x0400) |
769 //----- (0049C681) -------------------------------------------------------- | 763 //----- (0049C681) -------------------------------------------------------- |
770 bool stru10::CalcPortalShape(BLVFace *pFace, IndoorCameraD3D_Vec4 *pPortalDataFrustum, RenderVertexSoft *pOutBounding) | 764 bool stru10::CalcPortalShape(BLVFace *pFace, IndoorCameraD3D_Vec4 *pPortalDataFrustum, RenderVertexSoft *pOutBounding) |
771 { | 765 { |
772 RenderVertexSoft pLimits[4]; // [sp+Ch] [bp-C0h]@1 | 766 RenderVertexSoft pLimits[4]; // [sp+Ch] [bp-C0h]@1 |
773 | 767 |
774 CalcPolygonLimits(pFace, pLimits); | 768 CalcPolygonLimits(pFace, pLimits);//определение границ портала |
775 //if ( byte_4D864C && pGame->uFlags & GAME_FLAGS_1_DRAW_BLV_DEBUGS) | 769 //if ( byte_4D864C && pGame->uFlags & GAME_FLAGS_1_DRAW_BLV_DEBUGS) |
776 // pGame->pIndoorCameraD3D->debug_outline_sw(pLimits, 4, 0xFF1E1E, 0.000099999997); | 770 // pGame->pIndoorCameraD3D->debug_outline_sw(pLimits, 4, 0xFF1E1E, 0.000099999997); |
777 if (CalcFaceBounding(pFace, pLimits, 4, pOutBounding)) | 771 if (CalcFaceBounding(pFace, pLimits, 4, pOutBounding)) |
778 return _49C720(pOutBounding, pPortalDataFrustum) != 0; | 772 return _49C720(pOutBounding, pPortalDataFrustum) != 0; |
779 return false; | 773 return false; |