comparison Engine/Graphics/IndoorCameraD3D.cpp @ 2531:f6de3e15d4a5

for light in indoor
author Ritor1
date Sun, 23 Nov 2014 15:30:17 +0600
parents 68cdef6879a0
children 9ec6b8be16fe
comparison
equal deleted inserted replaced
2530:dc6f29bb0ec4 2531:f6de3e15d4a5
1054 1054
1055 //----- (00436F09) -------------------------------------------------------- 1055 //----- (00436F09) --------------------------------------------------------
1056 void IndoorCameraD3D::_436F09_mess_with_lightmap__clipflag_4(RenderVertexSoft *pInVertices, int uNumInVertices, RenderVertexSoft *pOutVertices, unsigned int *pOutNumVertices) 1056 void IndoorCameraD3D::_436F09_mess_with_lightmap__clipflag_4(RenderVertexSoft *pInVertices, int uNumInVertices, RenderVertexSoft *pOutVertices, unsigned int *pOutNumVertices)
1057 { 1057 {
1058 unsigned int *pOutNumVertices_; // ebx@1 1058 unsigned int *pOutNumVertices_; // ebx@1
1059 double v6; // st7@2
1060 signed int v7; // esi@2 1059 signed int v7; // esi@2
1061 char *v8; // edx@5
1062 unsigned int v9; // eax@10
1063 RenderVertexSoft *v10; // ecx@11
1064 double v11; // st6@11 1060 double v11; // st6@11
1065 double v12; // st6@12
1066 unsigned int v13; // edi@14
1067 unsigned __int8 v14; // c2@16 1061 unsigned __int8 v14; // c2@16
1068 unsigned __int8 v15; // c3@16 1062 unsigned __int8 v15; // c3@16
1069 unsigned int v16; // edi@17
1070 bool a1a; // [sp+Ch] [bp+8h]@7 1063 bool a1a; // [sp+Ch] [bp+8h]@7
1071 int a4a; // [sp+18h] [bp+14h]@5
1072 1064
1073 pOutNumVertices_ = pOutNumVertices; 1065 pOutNumVertices_ = pOutNumVertices;
1074 *pOutNumVertices = 0; 1066 *pOutNumVertices = 0;
1075 if ( uNumInVertices ) 1067 if ( uNumInVertices )
1076 { 1068 {
1077 memcpy(&pInVertices[uNumInVertices], pInVertices, sizeof(pInVertices[uNumInVertices])); 1069 memcpy(&pInVertices[uNumInVertices], pInVertices, sizeof(pInVertices[uNumInVertices]));
1078 v6 = (double)pODMRenderParams->shading_dist_mist;
1079 v7 = 0; 1070 v7 = 0;
1080 if ( v6 >= pInVertices->vWorldViewPosition.x ) 1071 if ( (double)pODMRenderParams->shading_dist_mist >= pInVertices->vWorldViewPosition.x )
1081 v7 = 1; 1072 v7 = 1;
1082 if ( uNumInVertices + 1 > 1 ) 1073 for ( uint i = 0; i < uNumInVertices; i++ )
1083 { 1074 {
1084 a4a = uNumInVertices; 1075 a1a = (double)pODMRenderParams->shading_dist_mist >= pInVertices[i + 1].vWorldViewPosition.x;
1085 v8 = (char *)&pInVertices[1].u; 1076 if ( v7 != a1a )
1086 do
1087 { 1077 {
1088 a1a = v6 >= *((float *)v8 - 6); 1078 if (a1a)
1089 if ( v7 == a1a )
1090 { 1079 {
1091 v10 = pOutVertices; 1080 v11 = ((double)pODMRenderParams->shading_dist_mist - pInVertices[i].vWorldViewPosition.x) / (pInVertices[i + 1].vWorldViewPosition.x - pInVertices[i].vWorldViewPosition.x);
1092 //goto LABEL_23; 1081 pOutVertices[*pOutNumVertices_].vWorldViewPosition.y = (pInVertices[i + 1].vWorldViewPosition.y - pInVertices[i].vWorldViewPosition.y) * v11 + pInVertices[i].vWorldViewPosition.y;
1082 pOutVertices[*pOutNumVertices_].vWorldViewPosition.z = (pInVertices[i + 1].vWorldViewPosition.z - pInVertices[i].vWorldViewPosition.z) * v11 + pInVertices[i].vWorldViewPosition.z;
1083 pOutVertices[*pOutNumVertices_].u = (pInVertices[i + 1].u - pInVertices[i].u) * v11 + pInVertices[i].u;
1084 pOutVertices[*pOutNumVertices_].v = (pInVertices[i + 1].v - pInVertices[i].v) * v11 + pInVertices[i].v;
1093 } 1085 }
1094 else 1086 else
1095 {
1096
1097 v9 = *pOutNumVertices_;
1098 if (a1a)
1099 {
1100 v10 = pOutVertices;
1101 v11 = (v6 - *((float *)v8 - 18)) / (*((float *)v8 - 6) - *((float *)v8 - 18));
1102 pOutVertices[v9].vWorldViewPosition.y = (*((float *)v8 - 5) - *((float *)v8 - 17)) * v11 + *((float *)v8 - 17);
1103 pOutVertices[*pOutNumVertices_].vWorldViewPosition.z = (*((float *)v8 - 4) - *((float *)v8 - 16)) * v11
1104 + *((float *)v8 - 16);
1105 pOutVertices[*pOutNumVertices_].u = (*(float *)v8 - *((float *)v8 - 12)) * v11 + *((float *)v8 - 12);
1106 pOutVertices[*pOutNumVertices_].v = (*((float *)v8 + 1) - *((float *)v8 - 11)) * v11 + *((float *)v8 - 11);
1107 }
1108 else
1109 {
1110 v12 = (v6 - *((float *)v8 - 6)) / (*((float *)v8 - 18) - *((float *)v8 - 6));
1111 pOutVertices[v9].vWorldViewPosition.y = (*((float *)v8 - 17) - *((float *)v8 - 5)) * v12 + *((float *)v8 - 5);
1112 pOutVertices[*pOutNumVertices_].vWorldViewPosition.z = (*((float *)v8 - 16) - *((float *)v8 - 4)) * v12
1113 + *((float *)v8 - 4);
1114 pOutVertices[*pOutNumVertices_].u = (*((float *)v8 - 12) - *(float *)v8) * v12 + *(float *)v8;
1115 pOutVertices[*pOutNumVertices_].v = (*((float *)v8 - 11) - *((float *)v8 + 1)) * v12 + *((float *)v8 + 1);
1116 v10 = pOutVertices;
1117 }
1118 v10[*pOutNumVertices_].vWorldViewPosition.x = v6;
1119 v10[*pOutNumVertices_]._rhw = 1.0 / v6;
1120 if (v7)
1121 {
1122 v13 = (unsigned int)&v10[*pOutNumVertices_];
1123 if (*(float *)(v13 + 12) != *((float *)v8 - 18) || *(float *)(v13 + 16) != *((float *)v8 - 17))
1124 {
1125 ++*pOutNumVertices_;
1126 //goto LABEL_23;
1127 }
1128 else
1129 {
1130 v14 = 0;
1131 v15 = *(float *)(v13 + 20) == *((float *)v8 - 16);
1132 if (!(v15 | v14))
1133 {
1134 //goto LABEL_21;
1135 ++*pOutNumVertices_;
1136 //goto LABEL_23;
1137 }
1138 }
1139 }
1140 else
1141 {
1142 v16 = (unsigned int)&v10[*pOutNumVertices_];
1143 if (*(float *)(v16 + 12) != *((float *)v8 - 6) || *(float *)(v16 + 16) != *((float *)v8 - 5))
1144 {
1145 //LABEL_21:
1146 ++*pOutNumVertices_;
1147 //goto LABEL_23;
1148 }
1149 else
1150 {
1151 v14 = 0;
1152 v15 = *(float *)(v16 + 20) == *((float *)v8 - 4);
1153 if (!(v15 | v14))
1154 {
1155 //goto LABEL_21;
1156 ++*pOutNumVertices_;
1157 //goto LABEL_23;
1158 }
1159 }
1160 }
1161 }
1162 //LABEL_23:
1163 if ( a1a )
1164 { 1087 {
1165 memcpy(&v10[*pOutNumVertices_], v8 - 36, sizeof(v10[*pOutNumVertices_])); 1088 v11 = ((double)pODMRenderParams->shading_dist_mist - pInVertices[i + 1].vWorldViewPosition.x) / (pInVertices[i].vWorldViewPosition.x - pInVertices[i + 1].vWorldViewPosition.x);
1166 pOutVertices[*pOutNumVertices_]._rhw = 1.0 / (*((float *)v8 - 6) + 0.0000001); 1089 pOutVertices[*pOutNumVertices_].vWorldViewPosition.y = (pInVertices[i].vWorldViewPosition.y - pInVertices[i + 1].vWorldViewPosition.y) * v11 + pInVertices[i + 1].vWorldViewPosition.y;
1167 pOutVertices[(*pOutNumVertices_)++].flt_2C = *((float *)v8 + 2); 1090 pOutVertices[*pOutNumVertices_].vWorldViewPosition.z = (pInVertices[i].vWorldViewPosition.z - pInVertices[i + 1].vWorldViewPosition.z) * v11 + pInVertices[i + 1].vWorldViewPosition.z;
1091 pOutVertices[*pOutNumVertices_].u = (pInVertices[i].u - pInVertices[i + 1].u) * v11 + pInVertices[i + 1].u;
1092 pOutVertices[*pOutNumVertices_].v = (pInVertices[i].v - pInVertices[i + 1].v) * v11 + pInVertices[i + 1].v;
1168 } 1093 }
1169 v7 = a1a; 1094 pOutVertices[*pOutNumVertices_].vWorldViewPosition.x = (double)pODMRenderParams->shading_dist_mist;
1170 v8 += 48; 1095 pOutVertices[*pOutNumVertices_]._rhw = 1.0 / (double)pODMRenderParams->shading_dist_mist;
1171 --a4a; 1096 if (v7)
1097 {
1098 if (pOutVertices[*pOutNumVertices_].vWorldViewPosition.x != pInVertices[i].vWorldViewPosition.x
1099 || pOutVertices[*pOutNumVertices_].vWorldViewPosition.y != pInVertices[i].vWorldViewPosition.y)
1100 ++*pOutNumVertices_;
1101 else
1102 {
1103 v14 = 0;
1104 v15 = pOutVertices[*pOutNumVertices_].vWorldViewPosition.z == pInVertices[i].vWorldViewPosition.z;
1105 if (!(v15 | v14))
1106 ++*pOutNumVertices_;
1107 }
1108 }
1109 else
1110 {
1111 if (pOutVertices[*pOutNumVertices_].vWorldViewPosition.x != pInVertices[i + 1].vWorldViewPosition.x
1112 || pOutVertices[*pOutNumVertices_].vWorldViewPosition.y != pInVertices[i + 1].vWorldViewPosition.y)
1113 ++*pOutNumVertices_;
1114 else
1115 {
1116 v14 = 0;
1117 v15 = pOutVertices[*pOutNumVertices_].vWorldViewPosition.z == pInVertices[i + 1].vWorldViewPosition.z;
1118 if (!(v15 | v14))
1119 ++*pOutNumVertices_;
1120 }
1121 }
1172 } 1122 }
1173 while ( a4a ); 1123 if ( a1a )
1124 {
1125 memcpy(&pOutVertices[*pOutNumVertices_], &pInVertices[i + 1], sizeof(pOutVertices[*pOutNumVertices_]));
1126 pOutVertices[*pOutNumVertices_]._rhw = 1.0 / (pInVertices[i + 1].vWorldViewPosition.x + 0.0000001);
1127 pOutVertices[(*pOutNumVertices_)++].flt_2C = pInVertices[i + 1].flt_2C;
1128 }
1129 v7 = a1a;
1174 } 1130 }
1175 if ( (signed int)*pOutNumVertices_ < 3 ) 1131 if ( (signed int)*pOutNumVertices_ < 3 )
1176 *pOutNumVertices_ = 0; 1132 *pOutNumVertices_ = 0;
1177 } 1133 }
1178 } 1134 }
1179 1135
1180 //----- (00436CDC) -------------------------------------------------------- 1136 //----- (00436CDC) --------------------------------------------------------
1181 void IndoorCameraD3D::_436CDC_mess_with_lightmap__clipflag_2(RenderVertexSoft *pInVertices, int uNumInVertices, RenderVertexSoft *pOutVertices, unsigned int *pOutNumVertices) 1137 void IndoorCameraD3D::_436CDC_mess_with_lightmap__clipflag_2(RenderVertexSoft *pInVertices, int uNumInVertices, RenderVertexSoft *pOutVertices, unsigned int *pOutNumVertices)
1182 { 1138 {
1183 signed int v5; // esi@2 1139 signed int v5; // esi@2
1184 char *v6; // edx@5
1185 unsigned int v7; // eax@10
1186 RenderVertexSoft *v8; // ecx@11
1187 double v9; // st6@11 1140 double v9; // st6@11
1188 double v10; // st6@12 1141 double v10; // st6@12
1189 unsigned int v11; // edi@14
1190 unsigned __int8 v12; // c2@16 1142 unsigned __int8 v12; // c2@16
1191 unsigned __int8 v13; // c3@16 1143 unsigned __int8 v13; // c3@16
1192 unsigned int v14; // edi@17
1193 bool a1a; // [sp+Ch] [bp+8h]@7 1144 bool a1a; // [sp+Ch] [bp+8h]@7
1194 1145
1195 if ( uNumInVertices ) 1146 if ( uNumInVertices )
1196 { 1147 {
1197 *pOutNumVertices = 0; 1148 *pOutNumVertices = 0;
1199 v5 = 0; 1150 v5 = 0;
1200 if ( pInVertices->vWorldViewPosition.x >= 8.0 ) 1151 if ( pInVertices->vWorldViewPosition.x >= 8.0 )
1201 v5 = 1; 1152 v5 = 1;
1202 if ( uNumInVertices + 1 > 1 ) 1153 if ( uNumInVertices + 1 > 1 )
1203 { 1154 {
1204 v6 = (char *)&pInVertices[1].u; 1155 for ( uint i = 1; i <= uNumInVertices; i++ )
1205 do
1206 { 1156 {
1207 a1a = *((float *)v6 - 6) >= 8.0; 1157 a1a = pInVertices[i].vWorldViewPosition.x >= 8.0;
1208 if ( v5 == a1a ) 1158 if ( v5 == a1a )
1209 {
1210 v8 = pOutVertices;
1211 goto LABEL_23; 1159 goto LABEL_23;
1212 }
1213 v7 = *pOutNumVertices;
1214 if ( a1a ) 1160 if ( a1a )
1215 { 1161 {
1216 v8 = pOutVertices; 1162 v9 = (8.0 - pInVertices[i - 1].vWorldViewPosition.x) / (pInVertices[i].vWorldViewPosition.x - pInVertices[i - 1].vWorldViewPosition.x);
1217 v9 = (8.0 - *((float *)v6 - 18)) / (*((float *)v6 - 6) - *((float *)v6 - 18)); 1163 pOutVertices[*pOutNumVertices].vWorldViewPosition.y = (pInVertices[i].vWorldViewPosition.y - pInVertices[i - 1].vWorldViewPosition.y) * v9 + pInVertices[i - 1].vWorldViewPosition.y;
1218 pOutVertices[v7].vWorldViewPosition.y = (*((float *)v6 - 5) - *((float *)v6 - 17)) * v9 + *((float *)v6 - 17); 1164 pOutVertices[*pOutNumVertices].vWorldViewPosition.z = (pInVertices[i].vWorldViewPosition.z - pInVertices[i - 1].vWorldViewPosition.z) * v9 + pInVertices[i - 1].vWorldViewPosition.z;
1219 pOutVertices[*pOutNumVertices].vWorldViewPosition.z = (*((float *)v6 - 4) - *((float *)v6 - 16)) * v9 1165 pOutVertices[*pOutNumVertices].u = (pInVertices[i].u - pInVertices[i - 1].u) * v9 + pInVertices[i - 1].u;
1220 + *((float *)v6 - 16); 1166 pOutVertices[*pOutNumVertices].v = (pInVertices[i].v - pInVertices[i - 1].v) * v9 + pInVertices[i - 1].v;
1221 pOutVertices[*pOutNumVertices].u = (*(float *)v6 - *((float *)v6 - 12)) * v9 + *((float *)v6 - 12);
1222 pOutVertices[*pOutNumVertices].v = (*((float *)v6 + 1) - *((float *)v6 - 11)) * v9 + *((float *)v6 - 11);
1223 } 1167 }
1224 else 1168 else
1225 { 1169 {
1226 v10 = (8.0 - *((float *)v6 - 6)) / (*((float *)v6 - 18) - *((float *)v6 - 6)); 1170 v10 = (8.0 - pInVertices[i].vWorldViewPosition.x) / (pInVertices[i - 1].vWorldViewPosition.x - pInVertices[i].vWorldViewPosition.x);
1227 pOutVertices[v7].vWorldViewPosition.y = (*((float *)v6 - 17) - *((float *)v6 - 5)) * v10 + *((float *)v6 - 5); 1171 pOutVertices[*pOutNumVertices].vWorldViewPosition.y = (pInVertices[i - 1].vWorldViewPosition.y - pInVertices[i].vWorldViewPosition.y) * v10 + pInVertices[i].vWorldViewPosition.y;
1228 pOutVertices[*pOutNumVertices].vWorldViewPosition.z = (*((float *)v6 - 16) - *((float *)v6 - 4)) * v10 1172 pOutVertices[*pOutNumVertices].vWorldViewPosition.z = (pInVertices[i - 1].vWorldViewPosition.z - pInVertices[i].vWorldViewPosition.z) * v10 + pInVertices[i].vWorldViewPosition.z;
1229 + *((float *)v6 - 4); 1173 pOutVertices[*pOutNumVertices].u = (pInVertices[i - 1].u - pInVertices[i].u) * v10 + pInVertices[i].u;
1230 pOutVertices[*pOutNumVertices].u = (*((float *)v6 - 12) - *(float *)v6) * v10 + *(float *)v6; 1174 pOutVertices[*pOutNumVertices].v = (pInVertices[i - 1].v - pInVertices[i].v) * v10 + pInVertices[i].v;
1231 pOutVertices[*pOutNumVertices].v = (*((float *)v6 - 11) - *((float *)v6 + 1)) * v10 + *((float *)v6 + 1);
1232 v8 = pOutVertices;
1233 } 1175 }
1234 v8[*pOutNumVertices].vWorldViewPosition.x = 8.0; 1176 pOutVertices[*pOutNumVertices].vWorldViewPosition.x = 8.0;
1235 v8[*pOutNumVertices]._rhw = 0.125; 1177 pOutVertices[*pOutNumVertices]._rhw = 0.125;
1236 if ( v5 ) 1178 if ( v5 )
1237 { 1179 {
1238 v11 = (unsigned int)&v8[*pOutNumVertices]; 1180 if ( pOutVertices[*pOutNumVertices].vWorldViewPosition.x != pInVertices[i - 1].vWorldViewPosition.x
1239 if ( *(float *)(v11 + 12) != *((float *)v6 - 18) || *(float *)(v11 + 16) != *((float *)v6 - 17) ) 1181 || pOutVertices[*pOutNumVertices].vWorldViewPosition.y != pInVertices[i - 1].vWorldViewPosition.y )
1240 goto LABEL_21;
1241 v12 = 0;
1242 v13 = *(float *)(v11 + 20) == *((float *)v6 - 16);
1243 }
1244 else
1245 {
1246 v14 = (unsigned int)&v8[*pOutNumVertices];
1247 if ( *(float *)(v14 + 12) != *((float *)v6 - 6) || *(float *)(v14 + 16) != *((float *)v6 - 5) )
1248 { 1182 {
1249 LABEL_21:
1250 ++*pOutNumVertices; 1183 ++*pOutNumVertices;
1251 goto LABEL_23; 1184 goto LABEL_23;
1252 } 1185 }
1253 v12 = 0; 1186 v12 = 0;
1254 v13 = *(float *)(v14 + 20) == *((float *)v6 - 4); 1187 v13 = pOutVertices[*pOutNumVertices].vWorldViewPosition.z == pInVertices[i - 1].vWorldViewPosition.z;
1188 }
1189 else
1190 {
1191 if ( pOutVertices[*pOutNumVertices].vWorldViewPosition.x != pInVertices[i].vWorldViewPosition.x
1192 || pOutVertices[*pOutNumVertices].vWorldViewPosition.y != pInVertices[i].vWorldViewPosition.y )
1193 {
1194 ++*pOutNumVertices;
1195 goto LABEL_23;
1196 }
1197 v12 = 0;
1198 v13 = pOutVertices[*pOutNumVertices].vWorldViewPosition.z == pInVertices[i].vWorldViewPosition.z;
1255 } 1199 }
1256 if ( !(v13 | v12) ) 1200 if ( !(v13 | v12) )
1257 goto LABEL_21; 1201 ++*pOutNumVertices;
1258 LABEL_23: 1202 LABEL_23:
1259 if ( a1a ) 1203 if ( a1a )
1260 { 1204 {
1261 memcpy(&v8[*pOutNumVertices], v6 - 36, sizeof(v8[*pOutNumVertices])); 1205 memcpy(&pOutVertices[*pOutNumVertices], &pInVertices[i], sizeof(pOutVertices[*pOutNumVertices]));
1262 pOutVertices[(*pOutNumVertices)++]._rhw = 1.0 / (*((float *)v6 - 6) + 0.0000001); 1206 pOutVertices[(*pOutNumVertices)++]._rhw = 1.0 / (pInVertices[i].vWorldViewPosition.x + 0.0000001);
1263 } 1207 }
1264 v5 = a1a; 1208 v5 = a1a;
1265 v6 += 48;
1266 --uNumInVertices;
1267 } 1209 }
1268 while ( uNumInVertices );
1269 } 1210 }
1270 if ( (signed int)*pOutNumVertices < 3 ) 1211 if ( (signed int)*pOutNumVertices < 3 )
1271 *pOutNumVertices = 0; 1212 *pOutNumVertices = 0;
1272 } 1213 }
1273 } 1214 }
1389 } 1330 }
1390 1331
1391 //----- (00436A6D) -------------------------------------------------------- 1332 //----- (00436A6D) --------------------------------------------------------
1392 double IndoorCameraD3D::GetPolygonMinZ(RenderVertexSoft *pVertices, unsigned int uStripType) 1333 double IndoorCameraD3D::GetPolygonMinZ(RenderVertexSoft *pVertices, unsigned int uStripType)
1393 { 1334 {
1394 unsigned int v3; // edx@1
1395 double result; // st7@1 1335 double result; // st7@1
1396 float *v5; // ecx@2 1336
1397 1337 result = FLT_MAX;
1398 v3 = uStripType; 1338 for ( uint i = 0; i < uStripType; i++ )
1399 result = 3.402823466385289e38; 1339 {
1400 if ( (signed int)uStripType > 0 ) 1340 if ( pVertices[i].vWorldPosition.z < FLT_MAX )
1401 { 1341 result = pVertices[i].vWorldPosition.z;
1402 v5 = &pVertices->vWorldPosition.z;
1403 do
1404 {
1405 if ( *v5 < result )
1406 result = *v5;
1407 v5 += 12;
1408 --v3;
1409 }
1410 while ( v3 );
1411 } 1342 }
1412 return result; 1343 return result;
1413 } 1344 }
1414 1345
1415 //----- (00436A24) -------------------------------------------------------- 1346 //----- (00436A24) --------------------------------------------------------