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