Mercurial > mm7
comparison mm7_6.cpp @ 1787:0c4d3c6a9d5a
DrawBuildingsD3D cleared
author | Ritor1 |
---|---|
date | Fri, 04 Oct 2013 17:30:47 +0600 |
parents | 11f36943e818 |
children | bdac32c645c5 |
comparison
equal
deleted
inserted
replaced
1786:11f36943e818 | 1787:0c4d3c6a9d5a |
---|---|
39 #include "texts.h" | 39 #include "texts.h" |
40 | 40 |
41 #include "mm7_data.h" | 41 #include "mm7_data.h" |
42 | 42 |
43 | 43 |
44 | |
45 //----- (00424EE0) -------------------------------------------------------- | |
46 int BuildingVerticesClipping(unsigned int uNumVertices) | |
47 { | |
48 signed int previous_vertices_flag; // edi@1 | |
49 double t; // st6@10 | |
50 bool current_vertices_flag; // [sp+Ch] [bp-28h]@6 | |
51 signed int depth_num_vertices; // [sp+18h] [bp-1Ch]@1 | |
52 int pNextVertices; | |
53 //Доп инфо "Программирование трёхмерных игр для windows" Ламот стр 910 | |
54 | |
55 memcpy(&array_50AC10[uNumVertices], array_50AC10, sizeof(array_50AC10[uNumVertices])); | |
56 depth_num_vertices = 0; | |
57 previous_vertices_flag = 0; | |
58 if ( array_50AC10[0].vWorldViewPosition.x <= pODMRenderParams->shading_dist_mist ) | |
59 previous_vertices_flag = 1;//предыдущая грань меньше границы видимости | |
60 if ( (signed int)uNumVertices <= 0 ) | |
61 return 0; | |
62 for ( uint i = 1; i <= uNumVertices; ++i ) | |
63 { | |
64 current_vertices_flag = pODMRenderParams->shading_dist_mist >= array_50AC10[i].vWorldViewPosition.x; | |
65 if ( previous_vertices_flag != current_vertices_flag )//одна из граней за границей видимости | |
66 { | |
67 if ( current_vertices_flag )//текущая грань меньше границы видимости(предыдущая грань за пределами видимости) | |
68 { | |
69 //t = far_clip - v0.x / v1.x - v0.x (формула получения точки пересечения отрезка с плоскостью) | |
70 t = (pODMRenderParams->shading_dist_mist - array_50AC10[i - 1].vWorldViewPosition.x) / (array_50AC10[i].vWorldViewPosition.x - array_50AC10[i - 1].vWorldViewPosition.x); | |
71 array_507D30[depth_num_vertices].vWorldViewPosition.y = (array_50AC10[i].vWorldViewPosition.y - array_50AC10[i - 1].vWorldViewPosition.y) * t + array_50AC10[i - 1].vWorldViewPosition.y; | |
72 array_507D30[depth_num_vertices].vWorldViewPosition.z = (array_50AC10[i].vWorldViewPosition.z - array_50AC10[i - 1].vWorldViewPosition.z) * t + array_50AC10[i - 1].vWorldViewPosition.z; | |
73 array_507D30[depth_num_vertices].u = (array_50AC10[i].u - array_50AC10[i - 1].u) * t + array_50AC10[i - 1].u; | |
74 array_507D30[depth_num_vertices].v = (array_50AC10[i].v - array_50AC10[i - 1].v) * t + array_50AC10[i - 1].v; | |
75 } | |
76 else//предыдущая грань меньше границы видимости(текущая грань вышла за пределы видимости) | |
77 { | |
78 //t = far_clip - v1.x / v0.x - v1.x | |
79 t = (pODMRenderParams->shading_dist_mist - array_50AC10[i].vWorldViewPosition.x) / (array_50AC10[i - 1].vWorldViewPosition.x - array_50AC10[i].vWorldViewPosition.x); | |
80 array_507D30[depth_num_vertices].vWorldViewPosition.y = (array_50AC10[i - 1].vWorldViewPosition.y - array_50AC10[i].vWorldViewPosition.y) * t + array_50AC10[i].vWorldViewPosition.y; | |
81 array_507D30[depth_num_vertices].vWorldViewPosition.z = (array_50AC10[i - 1].vWorldViewPosition.z - array_50AC10[i].vWorldViewPosition.z) * t + array_50AC10[i].vWorldViewPosition.z; | |
82 array_507D30[depth_num_vertices].u = (array_50AC10[i - 1].u - array_50AC10[i].u) * t + array_50AC10[i].u; | |
83 array_507D30[depth_num_vertices].v = (array_50AC10[i - 1].v - array_50AC10[i].v) * t + array_50AC10[i].v; | |
84 } | |
85 array_507D30[depth_num_vertices].vWorldViewPosition.x = pODMRenderParams->shading_dist_mist; | |
86 array_507D30[depth_num_vertices]._rhw = 1.0 / pODMRenderParams->shading_dist_mist; | |
87 ++depth_num_vertices; | |
88 } | |
89 if ( current_vertices_flag )//оба в границе видимости | |
90 { | |
91 pNextVertices = depth_num_vertices++; | |
92 memcpy(&array_507D30[pNextVertices], &array_50AC10[i], 0x30); | |
93 } | |
94 previous_vertices_flag = current_vertices_flag; | |
95 } | |
96 if ( depth_num_vertices < 3 ) | |
97 return 0; | |
98 return depth_num_vertices; | |
99 } | |
100 | 44 |
101 //----- (00426A5A) -------------------------------------------------------- | 45 //----- (00426A5A) -------------------------------------------------------- |
102 void stru319::LootActor(Actor *pActor) | 46 void stru319::LootActor(Actor *pActor) |
103 { | 47 { |
104 signed int v2; // edi@1 | 48 signed int v2; // edi@1 |