Mercurial > mm7
annotate Engine/Graphics/IndoorCameraD3D.cpp @ 2568:f2f2595fe308
rename Decals[], DecalCount
author | Ritor1 |
---|---|
date | Thu, 21 May 2015 18:32:45 +0600 |
parents | b8a56afc6ba1 |
children | 4d199006c716 |
rev | line source |
---|---|
2496 | 1 #define _CRTDBG_MAP_ALLOC |
2 #include <stdlib.h> | |
3 #include <crtdbg.h> | |
4 | |
5 #define _CRT_SECURE_NO_WARNINGS | |
2541 | 6 #include "Engine/Engine.h" |
2496 | 7 #include "IndoorCameraD3D.h" |
8 #include "Indoor.h" | |
9 #include "Viewport.h" | |
2541 | 10 #include "Engine/LOD.h" |
11 #include "Engine/OurMath.h" | |
2496 | 12 |
13 #include "stru9.h" | |
14 | |
15 | |
16 // calculates FOV (Field of View) angle in radians for IndoorCamera::Initialize and BLVRenderParams::Reset | |
17 float _calc_fov(int viewport_width, int angle_degree) | |
18 { | |
19 return viewport_width * 0.5 / tan(angle_degree / 2 * 0.01745329) + 0.5; | |
20 } | |
21 | |
2543 | 22 IndoorCameraD3D *pIndoorCameraD3D = new IndoorCameraD3D; |
2496 | 23 |
24 | |
25 //----- (004361EF) -------------------------------------------------------- | |
26 IndoorCameraD3D::IndoorCameraD3D() | |
27 { | |
28 this->field_108 = 0.0; | |
29 this->field_138 = 0.0; | |
30 this->field_168 = 0.0; | |
31 this->field_198 = 0.0; | |
32 this->field_1C8 = 0.0; | |
33 this->field_1F8 = 0.0; | |
34 this->field_228 = 0.0; | |
35 this->field_258 = 0.0; | |
36 this->field_288 = 0.0; | |
37 this->field_2B8 = 0.0; | |
38 this->field_2E8 = 0.0; | |
39 this->field_2BC = 0.0; | |
40 this->field_2C0 = 0.0; | |
41 this->field_2C4 = 0.0; | |
42 this->field_318 = 0.0; | |
43 this->field_2EC = 0.0; | |
44 this->field_2F0 = 0.0; | |
45 this->field_2F4 = 0.0; | |
46 this->field_348 = 0.0; | |
47 this->field_31C = 0.0; | |
48 this->field_320 = 0.0; | |
49 this->field_324 = 0.0; | |
50 this->field_378 = 0.0; | |
51 this->field_34C = 0.0; | |
52 this->field_350 = 0.0; | |
53 this->field_354 = 0.0; | |
54 for (uint i = 0; i < 16384; ++i) | |
55 { | |
56 list_0037C[i].field_0 = 0; | |
57 list_0037C[i].flt_30 = 0.0f; | |
58 } | |
59 list_0037C_size = 0; | |
60 for (uint i = 0; i < 256; ++i) | |
61 list_E0380[i].mm7__vector_000004_size = 0; | |
62 list_E0380_size = 0; | |
63 } | |
64 | |
65 | |
66 //----- (0043643E) -------------------------------------------------------- | |
67 float IndoorCameraD3D::GetPickDepth() | |
68 { | |
69 if (uCurrentlyLoadedLevelType == LEVEL_Outdoor) | |
70 return pODMRenderParams->uPickDepth; | |
71 else | |
72 return 16192.0; | |
73 } | |
74 | |
75 //----- (00436427) -------------------------------------------------------- | |
76 float IndoorCameraD3D::GetShadingDistMist() | |
77 { | |
78 if (uCurrentlyLoadedLevelType == LEVEL_Outdoor) | |
79 return (double)pODMRenderParams->shading_dist_mist; | |
80 else | |
81 return 16192.0; | |
82 } | |
83 | |
84 //----- (004364C5) -------------------------------------------------------- | |
2562
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
85 void IndoorCameraD3D::ViewTransfrom_OffsetUV(RenderVertexSoft *pVertices, unsigned int uNumVertices, RenderVertexSoft *pOutVertices, LightsData *a5) |
2496 | 86 { |
87 for (uint i = 0; i < uNumVertices; ++i) | |
88 { | |
89 pOutVertices[i].vWorldPosition.x = pVertices[i].vWorldPosition.x; | |
90 pOutVertices[i].vWorldPosition.y = pVertices[i].vWorldPosition.y; | |
91 pOutVertices[i].vWorldPosition.z = pVertices[i].vWorldPosition.z; | |
92 | |
93 pOutVertices[i].u = pVertices[i].u + a5->pDeltaUV[0]; | |
94 pOutVertices[i].v = pVertices[i].v + a5->pDeltaUV[1]; | |
95 } | |
96 ViewTransform(pOutVertices, uNumVertices); | |
97 } | |
98 | |
99 //----- (0043669D) -------------------------------------------------------- | |
100 bool IndoorCameraD3D::ApplyViewTransform_TrueIfStillVisible_BLV(int x, int y, int z, signed int *pOutX, int *pOutZ, int *pOutY, char bDoNotShow) | |
101 { | |
102 int to_z; // esi@2 | |
103 int v9; // ecx@3 | |
104 //signed int *v10; // esi@5 | |
105 //int pOutY_; // ecx@5 | |
106 //signed int v12; // esi@7 | |
107 int v14; // [sp+8h] [bp-4h]@3 | |
108 int to_x; // [sp+14h] [bp+8h]@1 | |
109 int to_y; // [sp+18h] [bp+Ch]@1 | |
110 // int a2b; // [sp+18h] [bp+Ch]@5 | |
111 int a3a; // [sp+1Ch] [bp+10h]@5 | |
112 | |
2543 | 113 to_x = x - pIndoorCameraD3D->vPartyPos.x; |
114 to_y = y - pIndoorCameraD3D->vPartyPos.y; | |
115 if (pIndoorCameraD3D->sRotationX) | |
2496 | 116 { |
2543 | 117 to_z = (z - pIndoorCameraD3D->vPartyPos.z) << 16; |
2496 | 118 //if ( pRenderer->pRenderD3D ) |
119 //{ | |
2543 | 120 v14 = (unsigned __int64)(to_x * (signed __int64)pIndoorCameraD3D->int_cosine_y) |
121 + (unsigned __int64)(to_y * (signed __int64)pIndoorCameraD3D->int_sine_y); | |
122 v9 = (unsigned __int64)(to_x * (signed __int64)pIndoorCameraD3D->int_sine_y) | |
123 - (unsigned __int64)(to_y * (signed __int64)pIndoorCameraD3D->int_cosine_y); | |
2496 | 124 //} |
2543 | 125 a3a = (z - pIndoorCameraD3D->vPartyPos.z) << 16; |
126 *pOutX = fixpoint_mul(v14, pIndoorCameraD3D->int_cosine_x) - fixpoint_mul(to_z, pIndoorCameraD3D->int_sine_x); | |
2496 | 127 *pOutZ = v9; |
2543 | 128 *pOutY = fixpoint_mul(v14, pIndoorCameraD3D->int_sine_x) + fixpoint_mul(a3a, pIndoorCameraD3D->int_cosine_x); |
2496 | 129 } |
130 else | |
131 { | |
2543 | 132 *pOutY = (z - pIndoorCameraD3D->vPartyPos.z) << 16; |
2496 | 133 //if ( pRenderer->pRenderD3D ) |
134 //{ | |
135 //v10 = pOutX; | |
2543 | 136 *pOutX = (unsigned __int64)(to_x * (signed __int64)pIndoorCameraD3D->int_cosine_y) |
137 + (unsigned __int64)(to_y * (signed __int64)pIndoorCameraD3D->int_sine_y); | |
138 *pOutZ = (unsigned __int64)(to_x * (signed __int64)pIndoorCameraD3D->int_sine_y) | |
139 - (unsigned __int64)(to_y * (signed __int64)pIndoorCameraD3D->int_cosine_y); | |
2496 | 140 //} |
141 } | |
142 if (!bDoNotShow) | |
143 return false; | |
144 | |
145 return *pOutX >= fixpoint_from_int(4, 0) && | |
146 *pOutX <= fixpoint_from_int(8000, 0); | |
147 } | |
148 | |
149 //----- (00436455) -------------------------------------------------------- | |
150 bool IndoorCameraD3D::IsCulled(BLVFace *pFace) | |
151 { | |
152 RenderVertexSoft v; // [sp+8h] [bp-30h]@1 | |
153 | |
154 //----- (0043648F) -------------------------------------------------------- | |
155 auto Vec3_short__to_RenderVertexSoft = [](RenderVertexSoft *_this, Vec3_short_ *a2) -> void | |
156 { | |
157 _this->flt_2C = 0.0; | |
158 | |
159 _this->vWorldPosition.x = a2->x; | |
160 _this->vWorldPosition.y = a2->y; | |
161 _this->vWorldPosition.z = a2->z; | |
162 }; | |
163 | |
164 | |
165 Vec3_short__to_RenderVertexSoft(&v, &pIndoor->pVertices[*pFace->pVertexIDs]); | |
166 return is_face_faced_to_camera(pFace, &v); | |
167 } | |
168 | |
169 | |
170 //----- (00436523) -------------------------------------------------------- | |
171 void IndoorCameraD3D::ViewTransform(RenderVertexSoft *a1a, unsigned int uNumVertices) | |
172 { | |
2541 | 173 if (byte_4D864C && pEngine->uFlags & 0x80 || |
2496 | 174 uCurrentlyLoadedLevelType == LEVEL_Indoor) |
175 { | |
176 float sin_x = fRotationXSine, | |
177 cos_x = fRotationXCosine; | |
178 float sin_y = fRotationYSine, | |
179 cos_y = fRotationYCosine; | |
180 | |
181 //v4 = uNumVertices; | |
182 //v7 = pIndoorCamera->fRotationXSine; | |
2543 | 183 if (pIndoorCameraD3D->sRotationX) |
2496 | 184 { |
185 | |
186 //_EAX = a1a; | |
187 for (uint i = 0; i < uNumVertices; ++i) | |
188 { | |
189 float st0, st1, st2; | |
190 //if ( pRenderer->pRenderD3D ) | |
191 { | |
192 /*__asm | |
193 { | |
194 fld [ebp+uNumVertices] // [(a1a[i].y - pIndoorCamera->pos.y)] [(a1a[i].z - pIndoorCamera->pos.z)] [pIndoorCamera->fRotationXCosine] [pIndoorCamera->fRotationYSine] [pIndoorCamera->fRotationYCosine] | |
195 fmul st, st(3) // [pIndoorCamera->fRotationYSine * (a1a[i].y - pIndoorCamera->pos.y)] [(a1a[i].z - pIndoorCamera->pos.z)] [pIndoorCamera->fRotationXCosine] [pIndoorCamera->fRotationYSine] [pIndoorCamera->fRotationYCosine] | |
196 fld [ebp+a1] // [(a1a[i].x - pIndoorCamera->pos.x)] [pIndoorCamera->fRotationYSine * (a1a[i].y - pIndoorCamera->pos.y)] [(a1a[i].z - pIndoorCamera->pos.z)] [pIndoorCamera->fRotationXCosine] [pIndoorCamera->fRotationYSine] [pIndoorCamera->fRotationYCosine] | |
197 fmul st, st(5) // 0[pIndoorCamera->fRotationYCosine * (a1a[i].x - pIndoorCamera->pos.x)] | |
198 // 1[pIndoorCamera->fRotationYSine * (a1a[i].y - pIndoorCamera->pos.y)] | |
199 // 2[(a1a[i].z - pIndoorCamera->pos.z)] | |
200 // 3[pIndoorCamera->fRotationXCosine] | |
201 // 4[pIndoorCamera->fRotationYSine] | |
202 // 5[pIndoorCamera->fRotationYCosine] | |
203 faddp st(1), st // [pIndoorCamera->fRotationYCosine * (a1a[i].x - pIndoorCamera->pos.x) + pIndoorCamera->fRotationYSine * (a1a[i].y - pIndoorCamera->pos.y)] [(a1a[i].z - pIndoorCamera->pos.z)] [pIndoorCamera->fRotationXCosine] [pIndoorCamera->fRotationYSine] [pIndoorCamera->fRotationYCosine] | |
204 fld [ebp+a1] // [(a1a[i].x - pIndoorCamera->pos.x)] [pIndoorCamera->fRotationYCosine * (a1a[i].x - pIndoorCamera->pos.x) + pIndoorCamera->fRotationYSine * (a1a[i].y - pIndoorCamera->pos.y)] [(a1a[i].z - pIndoorCamera->pos.z)] [pIndoorCamera->fRotationXCosine] [pIndoorCamera->fRotationYSine] [pIndoorCamera->fRotationYCosine] | |
205 fmul st, st(4) // [pIndoorCamera->fRotationYSine * (a1a[i].x - pIndoorCamera->pos.x)] [pIndoorCamera->fRotationYCosine * (a1a[i].x - pIndoorCamera->pos.x) + pIndoorCamera->fRotationYSine * (a1a[i].y - pIndoorCamera->pos.y)] [(a1a[i].z - pIndoorCamera->pos.z)] [pIndoorCamera->fRotationXCosine] [pIndoorCamera->fRotationYSine] [pIndoorCamera->fRotationYCosine] | |
206 | |
207 fld [ebp+uNumVertices] // 0[a1a[i].y - pIndoorCamera->pos.y] | |
208 // 1[pIndoorCamera->fRotationYSine * (a1a[i].x - pIndoorCamera->pos.x)] | |
209 // 2[pIndoorCamera->fRotationYCosine * (a1a[i].x - pIndoorCamera->pos.x) + pIndoorCamera->fRotationYSine * (a1a[i].y - pIndoorCamera->pos.y)] | |
210 // 3[(a1a[i].z - pIndoorCamera->pos.z)] | |
211 // 4[pIndoorCamera->fRotationXCosine] | |
212 // 5[pIndoorCamera->fRotationYSine] | |
213 // 6[pIndoorCamera->fRotationYCosine] | |
214 | |
215 fmul st, st(6) // 0[pIndoorCamera->fRotationYCosine * (a1a[i].y - pIndoorCamera->pos.y)] | |
216 // 1[pIndoorCamera->fRotationYSine * (a1a[i].x - pIndoorCamera->pos.x)] | |
217 // 2[pIndoorCamera->fRotationYCosine * (a1a[i].x - pIndoorCamera->pos.x) + pIndoorCamera->fRotationYSine * (a1a[i].y - pIndoorCamera->pos.y)] | |
218 // 3[(a1a[i].z - pIndoorCamera->pos.z)] | |
219 // 4[pIndoorCamera->fRotationXCosine] | |
220 // 5[pIndoorCamera->fRotationYSine] | |
221 // 6[pIndoorCamera->fRotationYCosine] | |
222 | |
223 fsubp st(1), st // 0[pIndoorCamera->fRotationYSine * (a1a[i].x - pIndoorCamera->pos.x) - pIndoorCamera->fRotationYCosine * (a1a[i].y - pIndoorCamera->pos.y)] | |
224 // 1[pIndoorCamera->fRotationYCosine * (a1a[i].x - pIndoorCamera->pos.x) + pIndoorCamera->fRotationYSine * (a1a[i].y - pIndoorCamera->pos.y)] | |
225 // 2[(a1a[i].z - pIndoorCamera->pos.z)] | |
226 // 3[pIndoorCamera->fRotationXCosine] | |
227 // 4[pIndoorCamera->fRotationYSine] | |
228 // 5[pIndoorCamera->fRotationYCosine] | |
229 }*/ | |
2543 | 230 st0 = sin_y * (a1a[i].vWorldPosition.x - pIndoorCameraD3D->vPartyPos.x) - cos_y * (a1a[i].vWorldPosition.y - pIndoorCameraD3D->vPartyPos.y); |
231 st1 = cos_y * (a1a[i].vWorldPosition.x - pIndoorCameraD3D->vPartyPos.x) + sin_y * (a1a[i].vWorldPosition.y - pIndoorCameraD3D->vPartyPos.y); | |
232 st2 = (a1a[i].vWorldPosition.z - pIndoorCameraD3D->vPartyPos.z); | |
2496 | 233 } |
234 if (false)//else | |
235 { | |
236 /*__asm | |
237 { | |
238 fld [ebp+a1] // 0[(a1a[i].x - pIndoorCamera->pos.x)] | |
239 // 1[(a1a[i].z - pIndoorCamera->pos.z)] | |
240 // 2[pIndoorCamera->fRotationXCosine] | |
241 // 3[pIndoorCamera->fRotationYSine] | |
242 // 4[pIndoorCamera->fRotationYCosine] | |
243 fmul st, st(4) // 0[pIndoorCamera->fRotationYCosine * (a1a[i].x - pIndoorCamera->pos.x)] | |
244 // 1[(a1a[i].z - pIndoorCamera->pos.z)] | |
245 // 2[pIndoorCamera->fRotationXCosine] | |
246 // 3[pIndoorCamera->fRotationYSine] | |
247 // 4[pIndoorCamera->fRotationYCosine] | |
248 fld [ebp+uNumVertices] // 0[(a1a[i].y - pIndoorCamera->pos.y)] | |
249 // 1[pIndoorCamera->fRotationYCosine * (a1a[i].x - pIndoorCamera->pos.x)] | |
250 // 2[(a1a[i].z - pIndoorCamera->pos.z)] | |
251 // 3[pIndoorCamera->fRotationXCosine] | |
252 // 4[pIndoorCamera->fRotationYSine] | |
253 // 5[pIndoorCamera->fRotationYCosine] | |
254 fmul st, st(4) // 0[pIndoorCamera->fRotationYSine * (a1a[i].y - pIndoorCamera->pos.y)] | |
255 // 1[pIndoorCamera->fRotationYCosine * (a1a[i].x - pIndoorCamera->pos.x)] | |
256 // 2[(a1a[i].z - pIndoorCamera->pos.z)] | |
257 // 3[pIndoorCamera->fRotationXCosine] | |
258 // 4[pIndoorCamera->fRotationYSine] | |
259 // 5[pIndoorCamera->fRotationYCosine] | |
260 fsubp st(1), st // 0[pIndoorCamera->fRotationYCosine * (a1a[i].x - pIndoorCamera->pos.x) - pIndoorCamera->fRotationYSine * (a1a[i].y - pIndoorCamera->pos.y)] | |
261 // 1[(a1a[i].z - pIndoorCamera->pos.z)] | |
262 // 2[pIndoorCamera->fRotationXCosine] | |
263 // 3[pIndoorCamera->fRotationYSine] | |
264 // 4[pIndoorCamera->fRotationYCosine] | |
265 fld [ebp+a1] // 0[(a1a[i].x - pIndoorCamera->pos.x)] | |
266 // 1[pIndoorCamera->fRotationYCosine * (a1a[i].x - pIndoorCamera->pos.x) - pIndoorCamera->fRotationYSine * (a1a[i].y - pIndoorCamera->pos.y)] | |
267 // 2[(a1a[i].z - pIndoorCamera->pos.z)] | |
268 // 3[pIndoorCamera->fRotationXCosine] | |
269 // 4[pIndoorCamera->fRotationYSine] | |
270 // 5[pIndoorCamera->fRotationYCosine] | |
271 fmul st, st(4) // 0[pIndoorCamera->fRotationYSine * (a1a[i].x - pIndoorCamera->pos.x)] | |
272 // 1[pIndoorCamera->fRotationYCosine * (a1a[i].x - pIndoorCamera->pos.x) - pIndoorCamera->fRotationYSine * (a1a[i].y - pIndoorCamera->pos.y)] | |
273 // 2[(a1a[i].z - pIndoorCamera->pos.z)] | |
274 // 3[pIndoorCamera->fRotationXCosine] | |
275 // 4[pIndoorCamera->fRotationYSine] | |
276 // 5[pIndoorCamera->fRotationYCosine] | |
277 fld [ebp+uNumVertices] // 0[(a1a[i].y - pIndoorCamera->pos.y)] | |
278 // 1[pIndoorCamera->fRotationYSine * (a1a[i].x - pIndoorCamera->pos.x)] | |
279 // 2[pIndoorCamera->fRotationYCosine * (a1a[i].x - pIndoorCamera->pos.x) - pIndoorCamera->fRotationYSine * (a1a[i].y - pIndoorCamera->pos.y)] | |
280 // 3[(a1a[i].z - pIndoorCamera->pos.z)] | |
281 // 4[pIndoorCamera->fRotationXCosine] | |
282 // 5[pIndoorCamera->fRotationYSine] | |
283 // 6[pIndoorCamera->fRotationYCosine] | |
284 fmul st, st(6) // 0[pIndoorCamera->fRotationYCosine * (a1a[i].y - pIndoorCamera->pos.y)] | |
285 // 1[pIndoorCamera->fRotationYSine * (a1a[i].x - pIndoorCamera->pos.x)] | |
286 // 2[pIndoorCamera->fRotationYCosine * (a1a[i].x - pIndoorCamera->pos.x) - pIndoorCamera->fRotationYSine * (a1a[i].y - pIndoorCamera->pos.y)] | |
287 // 3[(a1a[i].z - pIndoorCamera->pos.z)] | |
288 // 4[pIndoorCamera->fRotationXCosine] | |
289 // 5[pIndoorCamera->fRotationYSine] | |
290 // 6[pIndoorCamera->fRotationYCosine] | |
291 faddp st(1), st // 0[pIndoorCamera->fRotationYCosine * (a1a[i].y - pIndoorCamera->pos.y) + pIndoorCamera->fRotationYSine * (a1a[i].x - pIndoorCamera->pos.x)] | |
292 // 1[pIndoorCamera->fRotationYCosine * (a1a[i].x - pIndoorCamera->pos.x) - pIndoorCamera->fRotationYSine * (a1a[i].y - pIndoorCamera->pos.y)] | |
293 // 2[(a1a[i].z - pIndoorCamera->pos.z)] | |
294 // 3[pIndoorCamera->fRotationXCosine] | |
295 // 4[pIndoorCamera->fRotationYSine] | |
296 // 5[pIndoorCamera->fRotationYCosine] | |
297 }*/ | |
2543 | 298 st0 = cos_y * (a1a[i].vWorldPosition.y - pIndoorCameraD3D->vPartyPos.y) + sin_y * (a1a[i].vWorldPosition.x - pIndoorCameraD3D->vPartyPos.x); |
299 st1 = cos_y * (a1a[i].vWorldPosition.x - pIndoorCameraD3D->vPartyPos.x) - sin_y * (a1a[i].vWorldPosition.y - pIndoorCameraD3D->vPartyPos.y); | |
300 st2 = (a1a[i].vWorldPosition.z - pIndoorCameraD3D->vPartyPos.z); | |
2496 | 301 } |
302 | |
303 a1a[i].vWorldViewPosition.x = st1*cos_x - st2*sin_x; | |
304 a1a[i].vWorldViewPosition.y = st0; | |
305 a1a[i].vWorldViewPosition.z = st2*cos_x + st1*sin_x; | |
306 } | |
307 } | |
308 else | |
309 { | |
310 for (uint i = 0; i < uNumVertices; ++i) | |
311 { | |
312 //if ( pRenderer->pRenderD3D ) | |
313 { | |
314 /*__asm | |
315 { | |
316 fld [ebp+uNumVertices] // 0[(a1a[i].y - pIndoorCamera->pos.y)] | |
317 // 1[(a1a[i].z - pIndoorCamera->pos.z)] | |
318 // 2[sin_y] | |
319 // 3[cos_y] | |
320 fmul st, st(2) // 0[sin_y * (a1a[i].y - pIndoorCamera->pos.y)] | |
321 // 1[(a1a[i].z - pIndoorCamera->pos.z)] | |
322 // 2[sin_y] | |
323 // 3[cos_y] | |
324 fld [ebp+a1] // 0[(a1a[i].x - pIndoorCamera->pos.x)] | |
325 // 1[sin_y * (a1a[i].y - pIndoorCamera->pos.y)] | |
326 // 2[(a1a[i].z - pIndoorCamera->pos.z)] | |
327 // 3[sin_y] | |
328 // 4[cos_y] | |
329 fmul st, st(4) // 0[cos_y * (a1a[i].x - pIndoorCamera->pos.x)] | |
330 // 1[sin_y * (a1a[i].y - pIndoorCamera->pos.y)] | |
331 // 2[(a1a[i].z - pIndoorCamera->pos.z)] | |
332 // 3[sin_y] | |
333 // 4[cos_y] | |
334 faddp st(1), st // 0[cos_y * (a1a[i].x - pIndoorCamera->pos.x) + sin_y * (a1a[i].y - pIndoorCamera->pos.y)] | |
335 // 1[(a1a[i].z - pIndoorCamera->pos.z)] | |
336 // 2[sin_y] | |
337 // 3[cos_y] | |
338 fstp dword ptr [eax+0Ch] | |
339 fld [ebp+a1] // 0[(a1a[i].x - pIndoorCamera->pos.x)] | |
340 // 1[(a1a[i].z - pIndoorCamera->pos.z)] | |
341 // 2[sin_y] | |
342 // 3[cos_y] | |
343 fmul st, st(2) // 0[sin_y * (a1a[i].x - pIndoorCamera->pos.x)] | |
344 // 1[(a1a[i].z - pIndoorCamera->pos.z)] | |
345 // 2[sin_y] | |
346 // 3[cos_y] | |
347 fld [ebp+uNumVertices] // 0[(a1a[i].y - pIndoorCamera->pos.y)] | |
348 // 1[sin_y * (a1a[i].x - pIndoorCamera->pos.x)] | |
349 // 2[(a1a[i].z - pIndoorCamera->pos.z)] | |
350 // 3[sin_y] | |
351 // 4[cos_y] | |
352 fmul st, st(4) // 0[cos_y * (a1a[i].y - pIndoorCamera->pos.y)] | |
353 // 1[sin_y * (a1a[i].x - pIndoorCamera->pos.x)] | |
354 // 2[(a1a[i].z - pIndoorCamera->pos.z)] | |
355 // 3[sin_y] | |
356 // 4[cos_y] | |
357 fsubp st(1), st // 0[sin_y * (a1a[i].x - pIndoorCamera->pos.x) - cos_y * (a1a[i].y - pIndoorCamera->pos.y)] | |
358 // 1[(a1a[i].z - pIndoorCamera->pos.z)] | |
359 // 2[sin_y] | |
360 // 3[cos_y] | |
361 fstp dword ptr [eax+10h] | |
362 fstp dword ptr [eax+14h] | |
363 }*/ | |
2543 | 364 a1a[i].vWorldViewPosition.x = cos_y * (a1a[i].vWorldPosition.x - pIndoorCameraD3D->vPartyPos.x) + sin_y * (a1a[i].vWorldPosition.y - pIndoorCameraD3D->vPartyPos.y); |
365 a1a[i].vWorldViewPosition.y = sin_y * (a1a[i].vWorldPosition.x - pIndoorCameraD3D->vPartyPos.x) - cos_y * (a1a[i].vWorldPosition.y - pIndoorCameraD3D->vPartyPos.y); | |
366 a1a[i].vWorldViewPosition.z = (a1a[i].vWorldPosition.z - pIndoorCameraD3D->vPartyPos.z); | |
2496 | 367 } |
368 if (false)//else | |
369 { | |
370 __debugbreak(); | |
371 /*__asm | |
372 { | |
373 fld [ebp+a1] | |
374 fmul st, st(3) | |
375 fld [ebp+uNumVertices] | |
376 fmul st, st(3) | |
377 fsubp st(1), st | |
378 fstp dword ptr [eax+0Ch] | |
379 fld [ebp+a1] | |
380 fmul st, st(2) | |
381 fld [ebp+uNumVertices] | |
382 fmul st, st(4) | |
383 faddp st(1), st | |
384 | |
385 fstp dword ptr [eax+10h] | |
386 fstp dword ptr [eax+14h] | |
387 }*/ | |
388 } | |
389 } | |
390 } | |
391 } | |
392 else for (uint i = 0; i < uNumVertices; ++i) | |
393 //pIndoorCamera->ViewTransform_ODM(a1a + i); | |
394 { | |
395 //ViewTransform_ODM(a1a + i); | |
396 | |
397 RenderVertexSoft* a1 = &a1a[i]; | |
398 //----- (00481CCE) -------------------------------------------------------- | |
399 //void ViewTransform_ODM(RenderVertexSoft *a1) | |
400 { | |
401 float result; // eax@1 | |
402 double vCamToVertexZ; // st7@1 | |
403 double v3; // st6@1 | |
404 double v4; // st5@1 | |
405 double v5; // st4@1 | |
406 float v6; // ST04_4@3 | |
407 float v7; // [sp+0h] [bp-14h]@1 | |
408 float v8; // [sp+8h] [bp-Ch]@1 | |
409 float vCamToVertexX; // [sp+Ch] [bp-8h]@1 | |
410 float vCamToVertexY; // [sp+10h] [bp-4h]@1 | |
411 | |
412 v8 = fRotationXCosine; | |
413 result = fRotationXSine; | |
414 v7 = fRotationXSine; | |
2543 | 415 vCamToVertexX = a1->vWorldPosition.x - (double)pIndoorCameraD3D->vPartyPos.x; |
416 vCamToVertexY = a1->vWorldPosition.y - (double)pIndoorCameraD3D->vPartyPos.y; | |
417 vCamToVertexZ = a1->vWorldPosition.z - (double)pIndoorCameraD3D->vPartyPos.z; | |
2496 | 418 v3 = fRotationYCosine; |
419 v4 = fRotationYSine; | |
420 v5 = vCamToVertexY * fRotationYSine + fRotationYCosine * vCamToVertexX; | |
2543 | 421 if (pIndoorCameraD3D->sRotationX) |
2496 | 422 { |
423 v6 = vCamToVertexY * fRotationYSine + fRotationYCosine * vCamToVertexX; | |
424 a1->vWorldViewPosition.x = v5 * fRotationXCosine + fRotationXSine * vCamToVertexZ; | |
425 a1->vWorldViewPosition.y = v3 * vCamToVertexY - v4 * vCamToVertexX; | |
426 a1->vWorldViewPosition.z = v8 * vCamToVertexZ - v6 * v7; | |
427 } | |
428 else | |
429 { | |
430 a1->vWorldViewPosition.x = vCamToVertexY * fRotationYSine + fRotationYCosine * vCamToVertexX; | |
431 a1->vWorldViewPosition.y = v3 * vCamToVertexY - v4 * vCamToVertexX; | |
432 a1->vWorldViewPosition.z = vCamToVertexZ; | |
433 } | |
434 } | |
435 } | |
436 } | |
437 | |
438 | |
439 //----- (00436932) -------------------------------------------------------- | |
440 bool IndoorCameraD3D::GetFacetOrientation(char polyType, Vec3_float_ *a2, Vec3_float_ *a3, Vec3_float_ *a4) | |
441 { | |
442 switch ((PolygonType)polyType) | |
443 { | |
444 case POLYGON_VerticalWall: | |
445 { | |
446 a4->x = -a2->y; | |
447 a4->y = a2->x; | |
448 a4->z = 0.0; | |
449 | |
450 a3->x = 0.0; | |
451 a3->y = 0.0; | |
452 a3->z = 1.0f; | |
453 } | |
454 return true; | |
455 | |
456 case POLYGON_Floor: | |
457 case POLYGON_Ceiling: | |
458 { | |
459 a4->x = 1.0; | |
460 a4->y = 0.0; | |
461 a4->z = 0.0; | |
462 | |
463 a3->x = 0.0; | |
464 a3->y = 1.0; | |
465 a3->z = 0.0; | |
466 } | |
467 return true; | |
468 | |
469 case POLYGON_InBetweenFloorAndWall: | |
470 case POLYGON_InBetweenCeilingAndWall: | |
471 { | |
472 if (fabs(a2->z) < 0.70811361) | |
473 { | |
474 a4->x = -a2->y; | |
475 a4->y = a2->x; | |
476 a4->z = 0.0; | |
477 a4->Normalize(); | |
478 | |
479 a3->x = 0.0; | |
480 a3->y = 0.0; | |
481 a3->z = 1.0; | |
482 } | |
483 else | |
484 { | |
485 a4->x = 1.0; | |
486 a4->y = 0.0; | |
487 a4->z = 0.0; | |
488 | |
489 a3->x = 0.0; | |
490 a3->y = 1.0; | |
491 a3->z = 0.0; | |
492 } | |
493 } | |
494 return true; | |
495 | |
496 default: | |
497 return false; | |
498 } | |
499 } | |
500 | |
501 //----- (00438258) -------------------------------------------------------- | |
502 bool IndoorCameraD3D::is_face_faced_to_camera(BLVFace *pFace, RenderVertexSoft *a2) | |
503 { | |
504 if (pFace->Portal()) | |
505 return false; | |
506 | |
507 //really strange cull; dot(to_cam, normal) < 0 means we see the BACK face, not font %_% | |
2543 | 508 if ( (a2->vWorldPosition.z - (double)pIndoorCameraD3D->vPartyPos.z) * (double)pFace->pFacePlane_old.vNormal.z |
509 + (a2->vWorldPosition.y - (double)pIndoorCameraD3D->vPartyPos.y) * (double)pFace->pFacePlane_old.vNormal.y | |
510 + (a2->vWorldPosition.x - (double)pIndoorCameraD3D->vPartyPos.x) * (double)pFace->pFacePlane_old.vNormal.x < 0.0) | |
2496 | 511 return false; |
512 | |
513 return true; | |
514 } | |
515 | |
516 | |
517 //----- (00437AB5) -------------------------------------------------------- | |
518 void IndoorCameraD3D::do_draw_debug_line_sw(RenderVertexSoft *pLineBegin, signed int sStartDiffuse, RenderVertexSoft *pLineEnd, signed int sEndDiffuse, unsigned int uOutNumVertices, float z_stuff) | |
519 { | |
520 RenderVertexSoft a1[20]; // [sp+8h] [bp-7C4h]@6 | |
521 RenderVertexSoft pVertices[20]; // [sp+3C8h] [bp-404h]@2 | |
522 RenderVertexD3D3 v24[2]; // [sp+788h] [bp-44h]@11 | |
523 | |
524 //if ( pRenderer->pRenderD3D ) | |
525 //{ | |
526 for ( uint i = 0; i < 20; i++ ) | |
527 pVertices[i].flt_2C = 0.0; | |
528 if ( (char)uOutNumVertices ) | |
529 { | |
530 pVertices[0].vWorldViewProjX = pLineBegin->vWorldViewProjX; | |
531 pVertices[0].vWorldViewProjY = pLineBegin->vWorldViewProjY; | |
532 | |
533 pVertices[1].vWorldViewProjX = pLineEnd->vWorldViewProjX; | |
534 pVertices[1].vWorldViewProjY = pLineEnd->vWorldViewProjY; | |
535 v24[0].specular = 0; | |
536 v24[0].pos.x = pVertices[0].vWorldViewProjX; | |
537 v24[0].pos.y = pVertices[0].vWorldViewProjY; | |
538 v24[0].pos.z = 0.001 - z_stuff; | |
539 v24[0].diffuse = sStartDiffuse; | |
540 v24[0].rhw = 0.001; | |
541 v24[0].texcoord.x = 0.0; | |
542 v24[0].texcoord.y = 0.0; | |
543 | |
544 v24[1].pos.x = pVertices[1].vWorldViewProjX; | |
545 v24[1].pos.y = pVertices[1].vWorldViewProjY; | |
546 v24[1].diffuse = sEndDiffuse; | |
547 v24[1].pos.z = 0.001 - z_stuff; | |
548 v24[1].specular = 0; | |
549 v24[1].rhw = 0.001; | |
550 v24[1].texcoord.x = 0.0; | |
551 v24[1].texcoord.y = 0.0; | |
552 //v19 = pRenderer->pRenderD3D->pDevice; | |
553 pRenderer->DrawLines(v24, 2); | |
554 return; | |
555 } | |
556 for ( uint i = 0; i < 20; i++ ) | |
557 a1[i].flt_2C = 0.0; | |
558 uOutNumVertices = 2; | |
559 a1[0].vWorldPosition.x = pLineBegin->vWorldPosition.x; | |
560 a1[0].vWorldPosition.y = pLineBegin->vWorldPosition.y; | |
561 a1[0].vWorldPosition.z = pLineBegin->vWorldPosition.z; | |
562 a1[1].vWorldPosition.x = pLineEnd->vWorldPosition.x; | |
563 a1[1].vWorldPosition.y = pLineEnd->vWorldPosition.y; | |
564 a1[1].vWorldPosition.z = pLineEnd->vWorldPosition.z; | |
565 if ( CalcPortalShape(a1, &uOutNumVertices, pVertices, this->std__vector_000034_prolly_frustrum, 4, 1, 0) != 1 || (signed int)uOutNumVertices >= 2 ) | |
566 { | |
567 ViewTransform(pVertices, 2); | |
568 Project(pVertices, 2, 0); | |
569 v24[0].specular = 0; | |
570 v24[0].pos.x = pVertices[0].vWorldViewProjX; | |
571 v24[0].pos.y = pVertices[0].vWorldViewProjY; | |
572 v24[0].pos.z = 0.001 - z_stuff; | |
573 v24[0].diffuse = sStartDiffuse; | |
574 v24[0].rhw = 0.001; | |
575 v24[0].texcoord.x = 0.0; | |
576 v24[0].texcoord.y = 0.0; | |
577 | |
578 v24[1].pos.x = pVertices[1].vWorldViewProjX; | |
579 v24[1].pos.y = pVertices[1].vWorldViewProjY; | |
580 v24[1].diffuse = sEndDiffuse; | |
581 v24[1].pos.z = 0.001 - z_stuff; | |
582 v24[1].specular = 0; | |
583 v24[1].rhw = 0.001; | |
584 v24[1].texcoord.x = 0.0; | |
585 v24[1].texcoord.y = 0.0; | |
586 //v19 = pRenderer->pRenderD3D->pDevice; | |
587 pRenderer->DrawLines(v24, 2); | |
588 return; | |
589 } | |
590 //} | |
591 } | |
592 | |
593 //----- (00437A55) -------------------------------------------------------- | |
594 void IndoorCameraD3D::debug_outline_d3d(const RenderVertexD3D3 *pLineVertices, unsigned int uNumLines, int uDiffuse, float z_stuff) | |
595 { | |
596 unsigned int v5; // esi@1 | |
597 const RenderVertexD3D3 *v6; // ecx@2 | |
598 unsigned int v7; // ebx@2 | |
599 const RenderVertexD3D3 *v8; // edi@3 | |
600 | |
601 v5 = 0; | |
602 if ( (signed int)(uNumLines - 1) > 0 ) | |
603 { | |
604 v6 = pLineVertices; | |
605 v5 = uNumLines - 1; | |
606 for ( v7 = uNumLines - 1; v7; --v7 ) | |
607 { | |
608 v8 = v6 + 1; | |
609 pRenderer->do_draw_debug_line_d3d(v6, uDiffuse, v6 + 1, uDiffuse, z_stuff); | |
610 v6 = v8; | |
611 } | |
612 } | |
613 pRenderer->do_draw_debug_line_d3d(&pLineVertices[v5], uDiffuse, pLineVertices, uDiffuse, z_stuff); | |
614 } | |
615 | |
616 //----- (004379EE) -------------------------------------------------------- | |
617 void IndoorCameraD3D::debug_outline_sw(RenderVertexSoft *a2, unsigned int uNumVertices, unsigned int uDiffuse, float a5) | |
618 { | |
619 if ( !uNumVertices ) | |
620 return; | |
621 if ( (signed int)(uNumVertices - 1) > 0 ) | |
622 { | |
623 for ( uint i = 0; i < uNumVertices - 1; i++ ) | |
624 do_draw_debug_line_sw(&a2[i], uDiffuse, &a2[i + 1], uDiffuse, 0, a5); | |
625 } | |
626 do_draw_debug_line_sw(&a2[uNumVertices - 1], uDiffuse, a2, uDiffuse, 0, a5); | |
627 } | |
628 | |
629 | |
630 void IndoorCameraD3D::DebugDrawPortal(BLVFace *pFace) | |
631 { | |
632 Assert(pFace->uNumVertices <= 32); | |
633 | |
634 RenderVertexSoft sw[32]; | |
635 for (uint i = 0; i < pFace->uNumVertices; ++i) | |
636 { | |
637 sw[i].vWorldPosition.x = pIndoor->pVertices[pFace->pVertexIDs[i]].x; | |
638 sw[i].vWorldPosition.y = pIndoor->pVertices[pFace->pVertexIDs[i]].y; | |
639 sw[i].vWorldPosition.z = pIndoor->pVertices[pFace->pVertexIDs[i]].z; | |
640 } | |
641 ViewTransform(sw, pFace->uNumVertices); | |
642 Project(sw, pFace->uNumVertices, 0); | |
643 | |
644 | |
645 | |
646 RenderVertexD3D3 v[32]; | |
647 for (uint i = 0; i < pFace->uNumVertices; ++i) | |
648 { | |
649 v[i].pos.x = sw[i].vWorldViewProjX; | |
650 v[i].pos.y = sw[i].vWorldViewProjY; | |
651 v[i].pos.z = 1.0 - 1.0 / (sw[i].vWorldViewPosition.x * 0.061758894); | |
652 v[i].rhw = 1.0 / sw[i].vWorldViewPosition.x; | |
653 v[i].diffuse = 0x80F020F0; | |
654 v[i].specular = 0; | |
655 //v[i].texcoord.x = pFace->pVertexUIDs[i] / (double)pTex->uTextureWidth; | |
656 //v[i].texcoord.y = pFace->pVertexUIDs[i] / (double)pTex->uTextureHeight; | |
657 v[i].texcoord.x = 0; | |
658 v[i].texcoord.y = 0; | |
659 } | |
660 | |
661 pRenderer->DrawFansTransparent(v, pFace->uNumVertices); | |
662 } | |
663 | |
664 //----- (00437906) -------------------------------------------------------- | |
665 void IndoorCameraD3D::PrepareAndDrawDebugOutline(BLVFace *pFace, unsigned int uDiffuse) | |
666 { | |
667 static RenderVertexSoft static_sub_437906_array_50CDD0[64]; | |
668 static bool __init_flag1 = false; | |
669 if (!__init_flag1) | |
670 { | |
671 __init_flag1 = true; | |
672 | |
673 for (uint i = 0; i < 64; ++i) | |
674 static_sub_437906_array_50CDD0[i].flt_2C = 0.0f; | |
675 } | |
676 if ( pFace->uNumVertices ) | |
677 { | |
678 for ( uint i = 0; i < pFace->uNumVertices; i++ ) | |
679 { | |
680 static_sub_437906_array_50CDD0[i].vWorldPosition.x = (double)pIndoor->pVertices[pFace->pVertexIDs[i]].x; | |
681 static_sub_437906_array_50CDD0[i].vWorldPosition.y = (double)pIndoor->pVertices[pFace->pVertexIDs[i]].y; | |
682 static_sub_437906_array_50CDD0[i].vWorldPosition.z = (double)pIndoor->pVertices[pFace->pVertexIDs[i]].z; | |
683 static_sub_437906_array_50CDD0[i].u = (double)pFace->pVertexUIDs[i]; | |
684 static_sub_437906_array_50CDD0[i].v = (double)pFace->pVertexVIDs[i]; | |
685 } | |
686 } | |
687 if ( draw_portals_loops ) | |
688 debug_outline_sw(static_sub_437906_array_50CDD0, pFace->uNumVertices, uDiffuse, 0.0); | |
689 } | |
690 // 50D9D0: using guessed type char static_sub_437906_byte_50D9D0_init_flag; | |
691 | |
692 //----- (004378BA) -------------------------------------------------------- | |
693 void IndoorCameraD3D::MatrixMultiply(Matrix3x3_float_ *ma, Matrix3x3_float_ *mb, Matrix3x3_float_ *m_out) | |
694 { | |
695 float sum; | |
696 | |
697 for ( uint row = 0; row < 3; row++ ) | |
698 { | |
699 for ( uint col = 0; col < 3; col++ ) | |
700 { | |
701 sum = 0; | |
702 for ( int index = 0; index < 3; index++ ) | |
703 sum += ma->v[row][index]*mb->v[index][col]; | |
704 m_out->v[row][col] = sum; | |
705 } | |
706 } | |
707 } | |
708 | |
709 //----- (004376E7) -------------------------------------------------------- | |
710 void IndoorCameraD3D::CreateWorldMatrixAndSomeStuff() | |
711 { | |
712 Matrix3x3_float_ m1; // [sp+10h] [bp-B8h]@1 | |
713 Matrix3x3_float_ m2; // [sp+34h] [bp-94h]@1 | |
714 Matrix3x3_float_ m3; // [sp+58h] [bp-70h]@1 | |
715 Matrix3x3_float_ m4; // [sp+7Ch] [bp-4Ch]@1 | |
716 Matrix3x3_float_ m5; // [sp+A0h] [bp-28h]@1 | |
717 | |
718 //RotationZ(0) | |
719 m5._11 = cosf(0); m5._12 = sinf(0); m5._13 = 0; | |
720 m5._21 = -sinf(0); m5._22 = cosf(0); m5._23 = 0; | |
721 m5._31 = 0; m5._32 = 0; m5._33 = 1; | |
722 | |
723 float cos_x1 = fRotationXCosine, | |
724 sin_x1 = fRotationXSine; | |
725 //RotationX(x) | |
726 m4._11 = 1; m4._12 = 0; m4._13 = 0; | |
727 m4._21 = 0; m4._22 = cos_x1; m4._23 = sin_x1; | |
728 m4._31 = 0; m4._32 = -sin_x1; m4._33 = cos_x1; | |
729 | |
730 float cos_y1 = fRotationYCosine, | |
731 sin_y1 = fRotationYSine; | |
732 //RotationY(some_angle) | |
733 m3._11 = cos_y1; m3._12 = 0; m3._13 = -sin_y1; | |
734 m3._21 = 0; m3._22 = 1; m3._23 = 0; | |
735 m3._31 = sin_y1; m3._32 = 0; m3._33 = cos_y1; | |
736 | |
737 MatrixMultiply(&m5, &m3, &m1); | |
738 MatrixMultiply(&m4, &m1, &m2); | |
739 | |
740 for (uint i = 0; i < 3; ++i) | |
741 { | |
742 field_4[0].v[i] = m2.v[1][i]; | |
743 field_4[1].v[i] = m2.v[0][i]; | |
744 field_4[2].v[i] = m2.v[2][i]; | |
745 } | |
746 | |
747 inv_fov = 1.1344639; | |
748 fov_x = (double)pViewport->uScreenWidth * 0.8814736; | |
749 | |
750 fov_y = 0.8814736 * (double)pViewport->uScreenHeight; | |
751 fov = fov_y; | |
752 if ( fov_x > fov ) | |
753 fov = fov_x; | |
754 screenCenterX = (double)pViewport->uScreenCenterX; | |
755 screenCenterY = (double)(pViewport->uScreenCenterY - pViewport->uScreen_TL_Y); | |
756 } | |
757 | |
758 //----- (00437691) -------------------------------------------------------- | |
759 void IndoorCameraD3D::Vec3Transform(const IndoorCameraD3D_Vec3 *pVector, IndoorCameraD3D_Vec3 *pOut) | |
760 { | |
761 pOut->y = field_4[1].x * pVector->x + field_4[0].x * pVector->y + field_4[2].x * pVector->z; | |
762 pOut->z = field_4[1].y * pVector->x + field_4[0].y * pVector->y + field_4[2].y * pVector->z; | |
763 pOut->x = field_4[1].z * pVector->x + field_4[0].z * pVector->y + field_4[2].z * pVector->z; | |
764 } | |
765 | |
766 //----- (00437607) -------------------------------------------------------- | |
767 void IndoorCameraD3D::_437607(IndoorCameraD3D_Vec3 *a1, IndoorCameraD3D_Vec4 *a2) | |
768 { | |
769 double v4; // st7@1 | |
770 IndoorCameraD3D_Vec3 v8; // [sp+8h] [bp-1Ch]@1 | |
771 | |
2543 | 772 v8.x = (double)pIndoorCameraD3D->vPartyPos.x; |
773 v8.y = (double)pIndoorCameraD3D->vPartyPos.y; | |
774 v8.z = (double)pIndoorCameraD3D->vPartyPos.z; | |
2496 | 775 Vec3Transform(a1, a2); |
776 | |
777 v4 = v8.x * a2->x + v8.y * a2->y + v8.z * a2->z; | |
778 a2->dot = v4 + 0.000099999997; | |
779 } | |
780 | |
781 //----- (004374E8) -------------------------------------------------------- | |
782 void IndoorCameraD3D::_4374E8_ProllyBuildFrustrum() | |
783 { | |
784 //IndoorCameraD3D *v1; // esi@1 | |
785 //double v2; // st7@1 | |
786 double v3; // st7@1 | |
787 //double v4; // st7@1 | |
788 double v5; // st7@1 | |
789 //double v6; // st7@1 | |
790 IndoorCameraD3D_Vec3 v7; // [sp+Ch] [bp-24h]@1 | |
791 //float v8; // [sp+10h] [bp-20h]@1 | |
792 //float v9; // [sp+14h] [bp-1Ch]@1 | |
793 //float v10; // [sp+18h] [bp-18h]@1 | |
794 //float v11; // [sp+1Ch] [bp-14h]@1 | |
795 //float v12; // [sp+20h] [bp-10h]@1 | |
796 //int v13; // [sp+2Ch] [bp-4h]@1 | |
797 | |
798 //v1 = this; | |
799 //IndoorCameraD3D_Vec3::IndoorCameraD3D_Vec3(&v7); | |
800 //v2 = 2.0 / inv_fov; | |
801 //v13 = 0; | |
802 v3 = atan(2.0 / inv_fov * fov / fov_x); | |
803 //v12 = v3; | |
804 //v11 = sin(v3); | |
805 //v4 = cos(v3); | |
806 v7.x = -sin(v3); | |
807 v7.y = 0.0; | |
808 v7.z = cos(v3); | |
809 _437607(&v7, std__vector_000034_prolly_frustrum + 0); | |
810 v7.x = sin(v3); | |
811 _437607(&v7, std__vector_000034_prolly_frustrum + 1); | |
812 v5 = atan(2.0 / inv_fov * fov / (fov_y + 0.5)); | |
813 //v12 = v5; | |
814 //v11 = sin(v5); | |
815 //v6 = cos(v5); | |
816 v7.y = sin(v5); | |
817 v7.x = 0.0; | |
818 v7.z = cos(v5); | |
819 _437607(&v7, &std__vector_000034_prolly_frustrum[2]); | |
820 v7.y = -sin(v5); | |
821 _437607(&v7, &std__vector_000034_prolly_frustrum[3]); | |
822 //v13 = -1; | |
823 //IndoorCameraD3D_Vec3::dtor(&v7); | |
824 } | |
825 | |
826 //----- (00437376) -------------------------------------------------------- | |
827 char IndoorCameraD3D::_437376(stru154 *thisa, RenderVertexSoft *a2, unsigned int *pOutNumVertices) | |
828 { | |
829 double v6; // st7@3 | |
2532 | 830 int previous; // esi@6 |
831 int current; // ebx@8 | |
832 int next; // eax@8 | |
2496 | 833 int v13; // eax@15 |
834 signed int v14; // ebx@17 | |
835 RenderVertexSoft v18; // [sp+Ch] [bp-34h]@2 | |
836 signed int thisb; // [sp+48h] [bp+8h]@6 | |
2532 | 837 bool result; // [sp+4Fh] [bp+Fh]@5 |
2496 | 838 |
839 memcpy(&v18, a2, sizeof(v18)); | |
2532 | 840 result = false; |
2496 | 841 memcpy(&a2[*pOutNumVertices], a2, sizeof(a2[*pOutNumVertices])); |
842 memcpy(&a2[*pOutNumVertices + 1], &a2[1], sizeof(a2[*pOutNumVertices + 1])); | |
843 | |
844 if ( (signed int)*pOutNumVertices <= 3 | |
2543 | 845 || (((v18.vWorldPosition.z - (double)pIndoorCameraD3D->vPartyPos.z) * thisa->face_plane.vNormal.z |
846 + (v18.vWorldPosition.y - (double)pIndoorCameraD3D->vPartyPos.y) * thisa->face_plane.vNormal.y | |
847 + (v18.vWorldPosition.x - (double)pIndoorCameraD3D->vPartyPos.x) * thisa->face_plane.vNormal.x < 0.0) ? (v6 = 1.0) : (v6 = -1.0), | |
2496 | 848 (signed int)*pOutNumVertices <= 0) ) |
849 return 0; | |
2532 | 850 |
851 for ( int i = 1; i - 1 < (signed int)*pOutNumVertices; i++ ) | |
2496 | 852 { |
2532 | 853 current = i; |
854 next = i + 1; | |
855 | |
856 previous = i - 1; | |
857 if ( previous >= (signed int)*pOutNumVertices ) | |
858 previous -= *pOutNumVertices; | |
859 | |
860 if ( current >= (signed int)*pOutNumVertices ) | |
861 current -= *pOutNumVertices; | |
862 | |
863 if ( next >= (signed int)*pOutNumVertices ) | |
864 next -= *pOutNumVertices; | |
865 | |
866 if ( -0.009999999776482582 < ((a2[current].vWorldViewProjX - a2[previous].vWorldViewProjX) | |
867 * (a2[next].vWorldViewProjY - a2[previous].vWorldViewProjY) | |
868 - (a2[current].vWorldViewProjY - a2[previous].vWorldViewProjY) | |
869 * (a2[next].vWorldViewProjX - a2[previous].vWorldViewProjX)) | |
2496 | 870 * v6 ) |
871 { | |
2532 | 872 v13 = next; |
873 if ( next >= (signed int)*pOutNumVertices ) | |
874 v13 = next - *pOutNumVertices; | |
875 | |
2496 | 876 if ( v13 < (signed int)*pOutNumVertices ) |
877 { | |
878 for ( v14 = v13; v14 < (signed int)*pOutNumVertices; ++v14 ) | |
879 memcpy(&a2[v14], &a2[v14 + 1], sizeof(a2[v14])); | |
880 } | |
2532 | 881 result = true; |
882 --*pOutNumVertices; | |
2496 | 883 } |
884 } | |
2532 | 885 if ( result ) |
2496 | 886 return true; |
887 else | |
888 return false; | |
889 } | |
890 | |
891 //----- (00437285) -------------------------------------------------------- | |
892 bool IndoorCameraD3D::CalcPortalShape(RenderVertexSoft *a1, unsigned int *pOutNumVertices, RenderVertexSoft *pVertices, IndoorCameraD3D_Vec4 *a4, signed int uNumVertices, char a6, int _unused) | |
893 { | |
894 // char *v8; // eax@2 | |
895 // signed int v9; // ecx@2 | |
896 //bool result; // eax@5 | |
897 int v11; // ecx@5 | |
898 //signed int v12; // ecx@6 | |
899 //char *v13; // esi@6 | |
900 RenderVertexSoft *v14; // eax@8 | |
901 RenderVertexSoft *v15; // edx@8 | |
902 Vec3_float_ a5; // [sp+18h] [bp-3Ch]@12 | |
903 //float v17; // [sp+44h] [bp-10h]@1 | |
904 //int v18; // [sp+48h] [bp-Ch]@5 | |
905 //stru9 *thisa; // [sp+4Ch] [bp-8h]@1 | |
906 int a7a; // [sp+53h] [bp-1h]@5 | |
907 //bool a6a; // [sp+70h] [bp+1Ch]@5 | |
908 | |
909 //v17 = 0.0; | |
2541 | 910 //thisa = pEngine->pStru9Instance; |
2496 | 911 |
912 static RenderVertexSoft sr_vertices_50D9D8[64]; | |
913 | |
914 //result = 0; | |
915 a7a = 0; | |
916 v11 = 2 * (a6 == 0) + 1; | |
917 //a6a = 0; | |
918 //v18 = v11; | |
919 if (uNumVertices <= 0) | |
920 return false; | |
921 | |
922 //v12 = *pOutNumVertices; | |
923 //v13 = (char *)&a4->y; | |
924 | |
925 //while ( 1 ) | |
926 for ( uint i = 0; i < uNumVertices; ++i ) | |
927 { | |
928 if (i % 2) | |
929 { | |
930 v14 = a1; | |
931 v15 = sr_vertices_50D9D8; | |
932 } | |
933 else | |
934 { | |
935 v15 = a1; | |
936 v14 = sr_vertices_50D9D8; | |
937 } | |
938 if (i == uNumVertices - 1) | |
939 v14 = pVertices; | |
940 a5.x = a4[i].x; | |
941 a5.y = a4[i].y; | |
942 a5.z = a4[i].z; | |
2541 | 943 pEngine->pStru9Instance->CalcPortalShape(v15, *pOutNumVertices, v14, pOutNumVertices, &a5, a4[i].dot, (char *)&a7a, _unused); |
2496 | 944 //v12 = *pOutNumVertices; |
945 if (*pOutNumVertices < v11) | |
946 { | |
947 *pOutNumVertices = 0; | |
948 return true; | |
949 } | |
950 //result = a6a; | |
951 //v13 += 24; | |
952 //if (++i >= uNumVertices) | |
953 // | |
954 } | |
955 return a7a; | |
956 } | |
957 | |
958 //----- (004371C3) -------------------------------------------------------- | |
959 bool IndoorCameraD3D::_4371C3(RenderVertexSoft *pVertices, unsigned int *pOutNumVertices, int _unused) | |
960 { | |
961 // char *v4; // eax@2 | |
962 // signed int v5; // ecx@2 | |
963 RenderVertexSoft *v6; // esi@5 | |
964 unsigned int *v7; // edi@5 | |
965 char *v8; // ecx@6 | |
966 int v9; // eax@6 | |
967 IndoorCameraD3D *thisa; // [sp+0h] [bp-Ch]@1 | |
968 signed int v12; // [sp+4h] [bp-8h]@5 | |
969 unsigned int pVerticesa; // [sp+14h] [bp+8h]@6 | |
970 unsigned int pOutNumVerticesa; // [sp+18h] [bp+Ch]@6 | |
971 | |
972 thisa = this; | |
973 | |
974 | |
975 static RenderVertexSoft static_4371C3_array_50E5E0[64]; | |
976 static bool __init_flag1 = false; | |
977 if (!__init_flag1) | |
978 { | |
979 __init_flag1 = true; | |
980 | |
981 for (uint i = 0; i < 64; ++i) | |
982 static_4371C3_array_50E5E0[i].flt_2C = 0.0f; | |
983 } | |
984 | |
985 v12 = 0; | |
986 v6 = pVertices; | |
987 v7 = pOutNumVertices; | |
988 if ( (signed int)*pOutNumVertices > 0 ) | |
989 { | |
990 pOutNumVerticesa = (char *)static_4371C3_array_50E5E0 - (char *)pVertices; | |
991 pVerticesa = (char *)&static_4371C3_array_50E5E0[0].vWorldViewProjY - (char *)pVertices; | |
992 v8 = (char *)&static_4371C3_array_50E5E0[0].vWorldPosition.y; | |
993 v9 = (int)&v6->vWorldPosition.z; | |
994 do | |
995 { | |
996 ++v12; | |
997 *((int *)v8 - 1) = *(int *)(v9 - 8); | |
998 *(int *)v8 = *(int *)(v9 - 4); | |
999 v8 += 48; | |
1000 *(float *)(pOutNumVerticesa + v9) = *(float *)v9; | |
1001 *(float *)(pVerticesa + v9) = *(float *)(v9 + 28); | |
1002 *(float *)((char *)&static_4371C3_array_50E5E0[0]._rhw - (char *)v6 + v9) = *(float *)(v9 + 32); | |
1003 v9 += 48; | |
1004 } | |
1005 while ( v12 < (signed int)*v7 ); | |
1006 } | |
1007 return CalcPortalShape( | |
1008 static_4371C3_array_50E5E0, | |
1009 v7, | |
1010 v6, | |
1011 thisa->std__vector_000034_prolly_frustrum, | |
1012 4, | |
1013 0, | |
1014 _unused); | |
1015 } | |
1016 // 50F1E0: using guessed type char static_sub_4371C3_byte_50F1E0_init_flags; | |
1017 | |
1018 //----- (00437143) -------------------------------------------------------- | |
2532 | 1019 void IndoorCameraD3D::_437143(unsigned int uNumInVertices, RenderVertexSoft *pOutVertices, RenderVertexSoft *pInVertices, signed int *pOutNumVertices) |
2496 | 1020 { |
1021 double v9; // st7@3 | |
1022 | |
1023 uint i = 0; | |
1024 | |
1025 for ( i; i < uNumInVertices; ++i ) | |
1026 { | |
1027 pInVertices[i]._rhw = 1.0 / (pInVertices[i].vWorldViewPosition.x + 0.0000001); | |
1028 memcpy(&pOutVertices[i], &pInVertices[i], sizeof(pOutVertices[i])); | |
1029 v9 = (double)pODMRenderParams->int_fov_rad * pInVertices[i]._rhw; | |
1030 pOutVertices[i].vWorldViewProjX = (double)pViewport->uScreenCenterX - v9 * pInVertices[i].vWorldViewPosition.y; | |
1031 pOutVertices[i].vWorldViewProjY = (double)pViewport->uScreenCenterY - v9 * pInVertices[i].vWorldViewPosition.z; | |
1032 } | |
1033 *pOutNumVertices = i; | |
1034 return; | |
1035 } | |
1036 | |
1037 //----- (00436F09) -------------------------------------------------------- | |
2562
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1038 void IndoorCameraD3D::LightmapFarClip(RenderVertexSoft *pInVertices, int uNumInVertices, RenderVertexSoft *pOutVertices, unsigned int *pOutNumVertices) |
2496 | 1039 { |
2562
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1040 bool current_vertices_flag; |
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1041 bool next_vertices_flag; |
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1042 double t; |
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1043 signed int depth_num_vertices; |
2496 | 1044 |
2562
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1045 memcpy(&pInVertices[uNumInVertices], &pInVertices[0], sizeof(pInVertices[uNumInVertices])); |
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1046 depth_num_vertices = 0; |
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1047 current_vertices_flag = false; |
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1048 if ( pInVertices[0].vWorldViewPosition.x >= pODMRenderParams->shading_dist_mist ) |
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1049 current_vertices_flag = true;//íàñòîÿùàÿ âåðøèíà áîëüøå ãðàíèöû âèäèìîñòè |
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1050 if ( (signed int)uNumInVertices <= 0 ) |
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1051 return; |
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1052 //check for far clip plane(ïðîâåðêà ïî äàëüíåé ãðàíèöå) |
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1053 // |
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1054 // v3.__________________. v0 |
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1055 // | | |
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1056 // | | |
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1057 // | | |
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1058 // ----------------------- 8192.0(far_clip - 0x2000) |
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1059 // | | |
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1060 // .__________________. |
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1061 // v2 v1 |
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1062 |
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1063 for ( uint i = 0; i < uNumInVertices; ++i ) |
2496 | 1064 { |
2562
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1065 next_vertices_flag = pInVertices[i + 1].vWorldViewPosition.x >= pODMRenderParams->shading_dist_mist; |
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1066 if ( current_vertices_flag ^ next_vertices_flag )//îäíà èç ãðàíåé çà ãðàíèöåé âèäèìîñòè |
2496 | 1067 { |
2562
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1068 if ( next_vertices_flag )//ñëåäóþùàÿ âåðøèíà áîëüøå ãðàíèöû âèäèìîñòè(íàñòîÿùàÿ âåðøèíà ìåíüøå ãðàíèöû âèäèìîñòè) - v3 |
2496 | 1069 { |
2562
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1070 //t = far_clip - v2.x / v3.x - v2.x (ôîðìóëà ïîëó÷åíèÿ òî÷êè ïåðåñå÷åíèÿ îòðåçêà ñ ïëîñêîñòüþ) |
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1071 t = (pODMRenderParams->shading_dist_mist - pInVertices[i].vWorldViewPosition.x) / (pInVertices[i].vWorldViewPosition.x - pInVertices[i + 1].vWorldViewPosition.x); |
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1072 pOutVertices[depth_num_vertices].vWorldViewPosition.x = pODMRenderParams->shading_dist_mist; |
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1073 //New_y = v2.y + (v3.y - v2.y)*t |
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1074 pOutVertices[depth_num_vertices].vWorldViewPosition.y = pInVertices[i].vWorldViewPosition.y + (pInVertices[i].vWorldViewPosition.y - pInVertices[i + 1].vWorldViewPosition.y) * t; |
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1075 //New_z = v2.z + (v3.z - v2.z)*t |
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1076 pOutVertices[depth_num_vertices].vWorldViewPosition.z = pInVertices[i].vWorldViewPosition.z + (pInVertices[i].vWorldViewPosition.z - pInVertices[i + 1].vWorldViewPosition.z) * t; |
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1077 pOutVertices[depth_num_vertices].u = pInVertices[i].u + (pInVertices[i].u - pInVertices[i + 1].u) * t; |
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1078 pOutVertices[depth_num_vertices].v = pInVertices[i].v + (pInVertices[i].v - pInVertices[i + 1].v) * t; |
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1079 pOutVertices[depth_num_vertices]._rhw = 1.0 / pODMRenderParams->shading_dist_mist; |
2496 | 1080 } |
2562
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1081 else//íàñòîÿùàÿ âåðøèíà áîëüøå ãðàíèöû âèäèìîñòè(ñëåäóþùàÿ âåðøèíà ìåíüøå ãðàíèöû âèäèìîñòè) - v0 |
2531 | 1082 { |
2562
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1083 //t = far_clip - v1.x / v0.x - v1.x |
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1084 t = (pODMRenderParams->shading_dist_mist - pInVertices[i].vWorldViewPosition.x) / (pInVertices[i + 1].vWorldViewPosition.x - pInVertices[i].vWorldViewPosition.x); |
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1085 pOutVertices[depth_num_vertices].vWorldViewPosition.x = pODMRenderParams->shading_dist_mist; |
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1086 //New_y = (v0.y - v1.y)*t + v1.y |
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1087 pOutVertices[depth_num_vertices].vWorldViewPosition.y = pInVertices[i].vWorldViewPosition.y + (pInVertices[i + 1].vWorldViewPosition.y - pInVertices[i].vWorldViewPosition.y) * t; |
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1088 //New_z = (v0.z - v1.z)*t + v1.z |
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1089 pOutVertices[depth_num_vertices].vWorldViewPosition.z = pInVertices[i].vWorldViewPosition.z + (pInVertices[i + 1].vWorldViewPosition.z - pInVertices[i].vWorldViewPosition.z) * t; |
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1090 pOutVertices[depth_num_vertices].u = pInVertices[i].u + (pInVertices[i + 1].u - pInVertices[i].u) * t; |
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1091 pOutVertices[depth_num_vertices].v = pInVertices[i].v + (pInVertices[i + 1].v - pInVertices[i].v) * t; |
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1092 pOutVertices[depth_num_vertices]._rhw = 1.0 / pODMRenderParams->shading_dist_mist; |
2531 | 1093 } |
2562
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1094 ++depth_num_vertices; |
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1095 } |
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1096 if ( !next_vertices_flag )//îáà â ãðàíèöå âèäèìîñòè |
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1097 { |
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1098 memcpy(&pOutVertices[depth_num_vertices], &pInVertices[i + 1], sizeof(pOutVertices[depth_num_vertices])); |
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1099 depth_num_vertices++; |
2496 | 1100 } |
2562
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1101 current_vertices_flag = next_vertices_flag; |
2496 | 1102 } |
2562
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1103 if(depth_num_vertices >= 3) |
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1104 *pOutNumVertices = depth_num_vertices; |
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1105 else |
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1106 *pOutNumVertices = 0; |
2496 | 1107 } |
1108 | |
1109 //----- (00436CDC) -------------------------------------------------------- | |
2562
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1110 void IndoorCameraD3D::LightmapNeerClip(RenderVertexSoft *pInVertices, int uNumInVertices, RenderVertexSoft *pOutVertices, unsigned int *pOutNumVertices) |
2496 | 1111 { |
2562
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1112 double t; // st6@11 |
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1113 bool current_vertices_flag; // esi@2 |
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1114 bool next_vertices_flag; // [sp+Ch] [bp+8h]@7 |
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1115 |
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1116 //check for near clip plane(ïðîâåðêà ïî áëèæíåé ãðàíèöå) |
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1117 // |
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1118 // v3.__________________. v0 |
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1119 // | | |
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1120 // | | |
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1121 // | | |
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1122 // ----------------------- 8.0(near_clip - 8.0) |
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1123 // | | |
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1124 // .__________________. |
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1125 // v2 v1 |
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1126 |
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1127 int out_num_vertices = 0; |
2496 | 1128 |
1129 if ( uNumInVertices ) | |
1130 { | |
2562
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1131 memcpy(&pInVertices[uNumInVertices], &pInVertices[0], sizeof(pInVertices[0])); |
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1132 next_vertices_flag = false; |
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1133 current_vertices_flag = false; |
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1134 if ( pInVertices[0].vWorldViewPosition.x <= 8.0 ) |
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1135 current_vertices_flag = true; |
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1136 for (uint i = 0; i < uNumInVertices; ++i) |
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1137 { |
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1138 next_vertices_flag = pInVertices[i + 1].vWorldViewPosition.x <= 8.0;// |
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1139 if ( current_vertices_flag ^ next_vertices_flag ) |
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1140 { |
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1141 if ( next_vertices_flag )//ñëåäóþùàÿ âåðøèíà çà áëèæíåé ãðàíèöåé |
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1142 { |
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1143 //t = near_clip - v0.x / v1.x - v0.x (ôîðìóëà ïîëó÷åíèÿ òî÷êè ïåðåñå÷åíèÿ îòðåçêà ñ ïëîñêîñòüþ) |
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1144 t = (8.0 - pInVertices[i].vWorldViewPosition.x) / (pInVertices[i + 1].vWorldViewPosition.x - pInVertices[i].vWorldViewPosition.x); |
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1145 pOutVertices[out_num_vertices].vWorldViewPosition.x = 8.0; |
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1146 pOutVertices[out_num_vertices].vWorldViewPosition.y = pInVertices[i].vWorldViewPosition.y + (pInVertices[i + 1].vWorldViewPosition.y - pInVertices[i].vWorldViewPosition.y) * t; |
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1147 pOutVertices[out_num_vertices].vWorldViewPosition.z = pInVertices[i].vWorldViewPosition.z + (pInVertices[i + 1].vWorldViewPosition.z - pInVertices[i].vWorldViewPosition.z) * t; |
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1148 pOutVertices[out_num_vertices].u = pInVertices[i].u + (pInVertices[i + 1].u - pInVertices[i].u) * t; |
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1149 pOutVertices[out_num_vertices].v = pInVertices[i].v + (pInVertices[i + 1].v - pInVertices[i].v) * t; |
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1150 pOutVertices[out_num_vertices]._rhw = 1.0 / 8.0; |
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1151 //pOutVertices[*pOutNumVertices]._rhw = 0.125; |
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1152 } |
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1153 else// òåêóùàÿ âåðøèíà çà áëèæíåé ãðàíèöåé |
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1154 { |
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1155 t = (8.0 - pInVertices[i].vWorldViewPosition.x) / (pInVertices[i].vWorldViewPosition.x - pInVertices[i + 1].vWorldViewPosition.x); |
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1156 pOutVertices[out_num_vertices].vWorldViewPosition.x = 8.0; |
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1157 pOutVertices[out_num_vertices].vWorldViewPosition.y = pInVertices[i].vWorldViewPosition.y + (pInVertices[i].vWorldViewPosition.y - pInVertices[i + 1].vWorldViewPosition.y) * t; |
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1158 pOutVertices[out_num_vertices].vWorldViewPosition.z = pInVertices[i].vWorldViewPosition.z + (pInVertices[i].vWorldViewPosition.z - pInVertices[i + 1].vWorldViewPosition.z) * t; |
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1159 pOutVertices[out_num_vertices].u = pInVertices[i].u + (pInVertices[i].u - pInVertices[i + 1].u) * t; |
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1160 pOutVertices[out_num_vertices].v = pInVertices[i].v + (pInVertices[i].v - pInVertices[i + 1].v) * t; |
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1161 pOutVertices[out_num_vertices]._rhw = 1.0 / 8.0; |
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1162 } |
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1163 ++out_num_vertices; |
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1164 } |
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1165 if ( !next_vertices_flag ) |
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1166 { |
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1167 memcpy(&pOutVertices[out_num_vertices], &pInVertices[i + 1], sizeof(pInVertices[i + 1])); |
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1168 //pOutVertices[out_num_vertices]._rhw = 1.0 / (pInVertices[i].vWorldViewPosition.x + 0.0000001); |
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1169 out_num_vertices++; |
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1170 } |
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1171 current_vertices_flag = next_vertices_flag; |
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1172 } |
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1173 if(out_num_vertices >=3 ) |
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1174 *pOutNumVertices = out_num_vertices; |
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1175 else |
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1176 *pOutNumVertices = 0; |
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2543
diff
changeset
|
1177 } |
2496 | 1178 } |
1179 | |
1180 //----- (00481D77) -------------------------------------------------------- | |
1181 void _outdoor_project(RenderVertexSoft *v) | |
1182 { | |
1183 double v1; // st7@1 | |
1184 double v2; // st7@1 | |
1185 | |
1186 v1 = 1.0 / (v->vWorldViewPosition.x + 0.0000001); | |
1187 v->_rhw = v1; | |
1188 v2 = v1 * (double)pODMRenderParams->int_fov_rad; | |
1189 v->vWorldViewProjX = (double)pViewport->uScreenCenterX - v2 * v->vWorldViewPosition.y; | |
1190 v->vWorldViewProjY = (double)pViewport->uScreenCenterY - v2 * v->vWorldViewPosition.z; | |
1191 } | |
1192 | |
1193 //----- (00436BB7) -------------------------------------------------------- | |
1194 void IndoorCameraD3D::Project(RenderVertexSoft *pVertices, unsigned int uNumVertices, char a4) | |
1195 { | |
1196 double v7; // st7@7 | |
1197 double v8; // st7@9 | |
1198 double v9; // st6@10 | |
1199 double v10; // st5@12 | |
1200 double v11; // st7@16 | |
1201 double v12; // st6@17 | |
1202 double v13; // st5@19 | |
1203 float uNumVerticesa; // [sp+14h] [bp+Ch]@13 | |
1204 float uNumVerticesb; // [sp+14h] [bp+Ch]@20 | |
1205 | |
1206 for (uint i = 0; i < uNumVertices; ++i) | |
1207 { | |
2541 | 1208 if (byte_4D864C && pEngine->uFlags & 0x80 || uCurrentlyLoadedLevelType == LEVEL_Indoor) |
2496 | 1209 { |
1210 v7 = 1.0 / pVertices[i].vWorldViewPosition.x; | |
1211 | |
1212 pVertices[i].vWorldViewProjX = pVertices[i].vWorldViewPosition.y * fov * v7 + screenCenterX; | |
1213 pVertices[i].vWorldViewProjY = (signed int)pViewport->uViewportBR_Y - (pVertices[i].vWorldViewPosition.z * fov * v7 + screenCenterY); | |
1214 } | |
1215 else | |
1216 { | |
1217 extern void _outdoor_project(RenderVertexSoft *v); | |
1218 _outdoor_project(pVertices + i); | |
1219 } | |
1220 | |
1221 if ( a4 ) | |
1222 { | |
1223 // __debugbreak(); | |
1224 v8 = (double)(signed int)pViewport->uViewportBR_X; | |
1225 if ( v8 >= pVertices[i].vWorldViewProjX ) | |
1226 v9 = pVertices[i].vWorldViewProjX; | |
1227 else | |
1228 v9 = v8; | |
1229 v10 = (double)(signed int)pViewport->uViewportTL_X; | |
1230 if ( v10 <= v9 ) | |
1231 { | |
1232 if ( v8 >= pVertices[i].vWorldViewProjX) | |
1233 v8 = pVertices[i].vWorldViewProjX; | |
1234 } | |
1235 else | |
1236 { | |
1237 uNumVerticesa = v10; | |
1238 v8 = uNumVerticesa; | |
1239 } | |
1240 pVertices[i].vWorldViewProjX = v8; | |
1241 v11 = (double)(signed int)pViewport->uViewportBR_Y; | |
1242 if ( v11 >= pVertices[i].vWorldViewProjY) | |
1243 v12 = pVertices[i].vWorldViewProjY; | |
1244 else | |
1245 v12 = v11; | |
1246 v13 = (double)(signed int)pViewport->uViewportTL_Y; | |
1247 if ( v13 <= v12 ) | |
1248 { | |
1249 if ( v11 >= pVertices[i].vWorldViewProjY) | |
1250 v11 = pVertices[i].vWorldViewProjY; | |
1251 } | |
1252 else | |
1253 { | |
1254 uNumVerticesb = v13; | |
1255 v11 = uNumVerticesb; | |
1256 } | |
1257 pVertices[i].vWorldViewProjY = v11; | |
1258 } | |
1259 } | |
1260 } | |
1261 | |
1262 //----- (00436A9A) -------------------------------------------------------- | |
1263 void IndoorCameraD3D::Project(signed int x, signed int y, signed int z, int *a5, int *a6) | |
1264 { | |
1265 double v6; // ST00_8@2 | |
1266 //double v7; // ST08_8@2 | |
1267 //double v8; // ST00_8@2 | |
1268 // signed __int64 v9; // qtt@3 | |
1269 // int v10; // ST04_4@3 | |
1270 float a2a; // [sp+18h] [bp+8h]@2 | |
1271 float a2b; // [sp+18h] [bp+8h]@2 | |
1272 | |
1273 //if ( pRenderer->pRenderD3D ) | |
1274 { | |
1275 v6 = 1.0 / (double)x; | |
1276 a2a = (double)y * fov * v6 + screenCenterX; | |
1277 //v7 = a2a + 6.7553994e15; | |
1278 *a5 = floorf(a2a + 0.5f); | |
1279 a2b = (double)z * fov * v6 + screenCenterY; | |
1280 //v8 = a2b + 6.7553994e15; | |
1281 *a6 = pViewport->uViewportBR_Y - floorf(a2b + 0.5f); | |
1282 } | |
1283 /*else | |
1284 { | |
1285 LODWORD(v9) = pBLVRenderParams->fov_rad_fixpoint << 16; | |
1286 HIDWORD(v9) = pBLVRenderParams->fov_rad_fixpoint >> 16; | |
1287 v10 = v9 / x; | |
1288 LODWORD(v9) = pBLVRenderParams->fov_rad_fixpoint << 16; | |
1289 HIDWORD(v9) = pBLVRenderParams->fov_rad_fixpoint >> 16; | |
1290 *a5 = pBLVRenderParams->uViewportCenterX | |
1291 - ((signed int)(((unsigned __int64)(v10 * (signed __int64)y) >> 16) + 32768) >> 16); | |
1292 *a6 = pBLVRenderParams->uViewportCenterY - ((signed int)(((unsigned __int64)(v9 / x * z) >> 16) + 32768) >> 16); | |
1293 }*/ | |
1294 } | |
1295 | |
1296 //----- (00436A6D) -------------------------------------------------------- | |
1297 double IndoorCameraD3D::GetPolygonMinZ(RenderVertexSoft *pVertices, unsigned int uStripType) | |
1298 { | |
1299 double result; // st7@1 | |
1300 | |
2531 | 1301 result = FLT_MAX; |
1302 for ( uint i = 0; i < uStripType; i++ ) | |
2496 | 1303 { |
2531 | 1304 if ( pVertices[i].vWorldPosition.z < FLT_MAX ) |
1305 result = pVertices[i].vWorldPosition.z; | |
2496 | 1306 } |
1307 return result; | |
1308 } | |
1309 | |
1310 //----- (00436A24) -------------------------------------------------------- | |
1311 struct IDirect3DTexture2 *IndoorCameraD3D::LoadTextureAndGetHardwarePtr(char *Str1) | |
1312 { | |
1313 return pBitmaps_LOD->pHardwareTextures[pBitmaps_LOD->LoadTexture(Str1)]; | |
1314 } | |
1315 | |
1316 //----- (00436A40) -------------------------------------------------------- | |
1317 double IndoorCameraD3D::GetPolygonMaxZ(RenderVertexSoft *pVertex, unsigned int uStripType) | |
1318 { | |
1319 double result; // st7@1 | |
1320 | |
1321 result = 1.1754944e-38; | |
1322 for ( uint i = 0; i < uStripType; i++ ) | |
1323 { | |
1324 if ( pVertex[i].vWorldPosition.z > result ) | |
1325 result = pVertex[i].vWorldPosition.z; | |
1326 } | |
1327 return result; | |
1328 } | |
1329 | |
1330 // -- new | |
1331 // merged from IndoorCamera::Initialize2 | |
1332 // and ODMRenderParams::RotationToInts | |
1333 // and BLVRenderParams::Reset | |
1334 void IndoorCameraD3D::CalculateRotations(int camera_rot_x, int camera_rot_y) | |
1335 { | |
1336 sRotationX = camera_rot_x; | |
1337 sRotationY = camera_rot_y; | |
1338 | |
2534 | 1339 fRotationYSine = sin((pi_double + pi_double) * (double)sRotationY / 2048.0); |
1340 fRotationYCosine = cos((pi_double + pi_double) * (double)sRotationY / 2048.0); | |
2541 | 1341 if (byte_4D864C && pEngine->uFlags & 0x80 || uCurrentlyLoadedLevelType == LEVEL_Indoor) |
2496 | 1342 { |
2534 | 1343 fRotationXSine = sin((pi_double + pi_double) * (double)-sRotationX / 2048.0); |
1344 fRotationXCosine = cos((pi_double + pi_double) * (double)-sRotationX / 2048.0); | |
2496 | 1345 |
2543 | 1346 int_sine_y = stru_5C6E00->Sin( pIndoorCameraD3D->sRotationY); |
1347 int_cosine_y = stru_5C6E00->Cos( pIndoorCameraD3D->sRotationY); | |
1348 int_sine_x = stru_5C6E00->Sin(-pIndoorCameraD3D->sRotationX); | |
1349 int_cosine_x = stru_5C6E00->Cos(-pIndoorCameraD3D->sRotationX); | |
2496 | 1350 } |
1351 else | |
1352 { | |
2534 | 1353 fRotationXSine = sin((pi_double + pi_double) * (double)sRotationX / 2048.0); |
1354 fRotationXCosine = cos((pi_double + pi_double) * (double)sRotationX / 2048.0); | |
2496 | 1355 |
2543 | 1356 int_sine_y = stru_5C6E00->Sin(pIndoorCameraD3D->sRotationY); |
1357 int_cosine_y = stru_5C6E00->Cos(pIndoorCameraD3D->sRotationY); | |
1358 int_sine_x = stru_5C6E00->Sin(pIndoorCameraD3D->sRotationX); | |
1359 int_cosine_x = stru_5C6E00->Cos(pIndoorCameraD3D->sRotationX); | |
2496 | 1360 } |
1361 } |