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