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