Mercurial > mm7
diff Engine/Graphics/IndoorCameraD3D.cpp @ 2543:b6140dfeac27
GameOver h/cpp
author | a.parshin |
---|---|
date | Sun, 10 May 2015 03:21:14 +0200 |
parents | a902abdfc7f2 |
children | b8a56afc6ba1 |
line wrap: on
line diff
--- a/Engine/Graphics/IndoorCameraD3D.cpp Sun May 10 02:04:52 2015 +0200 +++ b/Engine/Graphics/IndoorCameraD3D.cpp Sun May 10 03:21:14 2015 +0200 @@ -19,6 +19,7 @@ return viewport_width * 0.5 / tan(angle_degree / 2 * 0.01745329) + 0.5; } +IndoorCameraD3D *pIndoorCameraD3D = new IndoorCameraD3D; //----- (004361EF) -------------------------------------------------------- @@ -109,33 +110,33 @@ // int a2b; // [sp+18h] [bp+Ch]@5 int a3a; // [sp+1Ch] [bp+10h]@5 - to_x = x - pEngine->pIndoorCameraD3D->vPartyPos.x; - to_y = y - pEngine->pIndoorCameraD3D->vPartyPos.y; - if (pEngine->pIndoorCameraD3D->sRotationX) + to_x = x - pIndoorCameraD3D->vPartyPos.x; + to_y = y - pIndoorCameraD3D->vPartyPos.y; + if (pIndoorCameraD3D->sRotationX) { - to_z = (z - pEngine->pIndoorCameraD3D->vPartyPos.z) << 16; + to_z = (z - pIndoorCameraD3D->vPartyPos.z) << 16; //if ( pRenderer->pRenderD3D ) //{ - v14 = (unsigned __int64)(to_x * (signed __int64)pEngine->pIndoorCameraD3D->int_cosine_y) - + (unsigned __int64)(to_y * (signed __int64)pEngine->pIndoorCameraD3D->int_sine_y); - v9 = (unsigned __int64)(to_x * (signed __int64)pEngine->pIndoorCameraD3D->int_sine_y) - - (unsigned __int64)(to_y * (signed __int64)pEngine->pIndoorCameraD3D->int_cosine_y); + v14 = (unsigned __int64)(to_x * (signed __int64)pIndoorCameraD3D->int_cosine_y) + + (unsigned __int64)(to_y * (signed __int64)pIndoorCameraD3D->int_sine_y); + v9 = (unsigned __int64)(to_x * (signed __int64)pIndoorCameraD3D->int_sine_y) + - (unsigned __int64)(to_y * (signed __int64)pIndoorCameraD3D->int_cosine_y); //} - a3a = (z - pEngine->pIndoorCameraD3D->vPartyPos.z) << 16; - *pOutX = fixpoint_mul(v14, pEngine->pIndoorCameraD3D->int_cosine_x) - fixpoint_mul(to_z, pEngine->pIndoorCameraD3D->int_sine_x); + a3a = (z - pIndoorCameraD3D->vPartyPos.z) << 16; + *pOutX = fixpoint_mul(v14, pIndoorCameraD3D->int_cosine_x) - fixpoint_mul(to_z, pIndoorCameraD3D->int_sine_x); *pOutZ = v9; - *pOutY = fixpoint_mul(v14, pEngine->pIndoorCameraD3D->int_sine_x) + fixpoint_mul(a3a, pEngine->pIndoorCameraD3D->int_cosine_x); + *pOutY = fixpoint_mul(v14, pIndoorCameraD3D->int_sine_x) + fixpoint_mul(a3a, pIndoorCameraD3D->int_cosine_x); } else { - *pOutY = (z - pEngine->pIndoorCameraD3D->vPartyPos.z) << 16; + *pOutY = (z - pIndoorCameraD3D->vPartyPos.z) << 16; //if ( pRenderer->pRenderD3D ) //{ //v10 = pOutX; - *pOutX = (unsigned __int64)(to_x * (signed __int64)pEngine->pIndoorCameraD3D->int_cosine_y) - + (unsigned __int64)(to_y * (signed __int64)pEngine->pIndoorCameraD3D->int_sine_y); - *pOutZ = (unsigned __int64)(to_x * (signed __int64)pEngine->pIndoorCameraD3D->int_sine_y) - - (unsigned __int64)(to_y * (signed __int64)pEngine->pIndoorCameraD3D->int_cosine_y); + *pOutX = (unsigned __int64)(to_x * (signed __int64)pIndoorCameraD3D->int_cosine_y) + + (unsigned __int64)(to_y * (signed __int64)pIndoorCameraD3D->int_sine_y); + *pOutZ = (unsigned __int64)(to_x * (signed __int64)pIndoorCameraD3D->int_sine_y) + - (unsigned __int64)(to_y * (signed __int64)pIndoorCameraD3D->int_cosine_y); //} } if (!bDoNotShow) @@ -179,7 +180,7 @@ //v4 = uNumVertices; //v7 = pIndoorCamera->fRotationXSine; - if (pEngine->pIndoorCameraD3D->sRotationX) + if (pIndoorCameraD3D->sRotationX) { //_EAX = a1a; @@ -226,9 +227,9 @@ // 4[pIndoorCamera->fRotationYSine] // 5[pIndoorCamera->fRotationYCosine] }*/ - st0 = sin_y * (a1a[i].vWorldPosition.x - pEngine->pIndoorCameraD3D->vPartyPos.x) - cos_y * (a1a[i].vWorldPosition.y - pEngine->pIndoorCameraD3D->vPartyPos.y); - st1 = cos_y * (a1a[i].vWorldPosition.x - pEngine->pIndoorCameraD3D->vPartyPos.x) + sin_y * (a1a[i].vWorldPosition.y - pEngine->pIndoorCameraD3D->vPartyPos.y); - st2 = (a1a[i].vWorldPosition.z - pEngine->pIndoorCameraD3D->vPartyPos.z); + st0 = sin_y * (a1a[i].vWorldPosition.x - pIndoorCameraD3D->vPartyPos.x) - cos_y * (a1a[i].vWorldPosition.y - pIndoorCameraD3D->vPartyPos.y); + st1 = cos_y * (a1a[i].vWorldPosition.x - pIndoorCameraD3D->vPartyPos.x) + sin_y * (a1a[i].vWorldPosition.y - pIndoorCameraD3D->vPartyPos.y); + st2 = (a1a[i].vWorldPosition.z - pIndoorCameraD3D->vPartyPos.z); } if (false)//else { @@ -294,9 +295,9 @@ // 4[pIndoorCamera->fRotationYSine] // 5[pIndoorCamera->fRotationYCosine] }*/ - st0 = cos_y * (a1a[i].vWorldPosition.y - pEngine->pIndoorCameraD3D->vPartyPos.y) + sin_y * (a1a[i].vWorldPosition.x - pEngine->pIndoorCameraD3D->vPartyPos.x); - st1 = cos_y * (a1a[i].vWorldPosition.x - pEngine->pIndoorCameraD3D->vPartyPos.x) - sin_y * (a1a[i].vWorldPosition.y - pEngine->pIndoorCameraD3D->vPartyPos.y); - st2 = (a1a[i].vWorldPosition.z - pEngine->pIndoorCameraD3D->vPartyPos.z); + st0 = cos_y * (a1a[i].vWorldPosition.y - pIndoorCameraD3D->vPartyPos.y) + sin_y * (a1a[i].vWorldPosition.x - pIndoorCameraD3D->vPartyPos.x); + st1 = cos_y * (a1a[i].vWorldPosition.x - pIndoorCameraD3D->vPartyPos.x) - sin_y * (a1a[i].vWorldPosition.y - pIndoorCameraD3D->vPartyPos.y); + st2 = (a1a[i].vWorldPosition.z - pIndoorCameraD3D->vPartyPos.z); } a1a[i].vWorldViewPosition.x = st1*cos_x - st2*sin_x; @@ -360,9 +361,9 @@ fstp dword ptr [eax+10h] fstp dword ptr [eax+14h] }*/ - a1a[i].vWorldViewPosition.x = cos_y * (a1a[i].vWorldPosition.x - pEngine->pIndoorCameraD3D->vPartyPos.x) + sin_y * (a1a[i].vWorldPosition.y - pEngine->pIndoorCameraD3D->vPartyPos.y); - a1a[i].vWorldViewPosition.y = sin_y * (a1a[i].vWorldPosition.x - pEngine->pIndoorCameraD3D->vPartyPos.x) - cos_y * (a1a[i].vWorldPosition.y - pEngine->pIndoorCameraD3D->vPartyPos.y); - a1a[i].vWorldViewPosition.z = (a1a[i].vWorldPosition.z - pEngine->pIndoorCameraD3D->vPartyPos.z); + a1a[i].vWorldViewPosition.x = cos_y * (a1a[i].vWorldPosition.x - pIndoorCameraD3D->vPartyPos.x) + sin_y * (a1a[i].vWorldPosition.y - pIndoorCameraD3D->vPartyPos.y); + a1a[i].vWorldViewPosition.y = sin_y * (a1a[i].vWorldPosition.x - pIndoorCameraD3D->vPartyPos.x) - cos_y * (a1a[i].vWorldPosition.y - pIndoorCameraD3D->vPartyPos.y); + a1a[i].vWorldViewPosition.z = (a1a[i].vWorldPosition.z - pIndoorCameraD3D->vPartyPos.z); } if (false)//else { @@ -411,13 +412,13 @@ v8 = fRotationXCosine; result = fRotationXSine; v7 = fRotationXSine; - vCamToVertexX = a1->vWorldPosition.x - (double)pEngine->pIndoorCameraD3D->vPartyPos.x; - vCamToVertexY = a1->vWorldPosition.y - (double)pEngine->pIndoorCameraD3D->vPartyPos.y; - vCamToVertexZ = a1->vWorldPosition.z - (double)pEngine->pIndoorCameraD3D->vPartyPos.z; + vCamToVertexX = a1->vWorldPosition.x - (double)pIndoorCameraD3D->vPartyPos.x; + vCamToVertexY = a1->vWorldPosition.y - (double)pIndoorCameraD3D->vPartyPos.y; + vCamToVertexZ = a1->vWorldPosition.z - (double)pIndoorCameraD3D->vPartyPos.z; v3 = fRotationYCosine; v4 = fRotationYSine; v5 = vCamToVertexY * fRotationYSine + fRotationYCosine * vCamToVertexX; - if (pEngine->pIndoorCameraD3D->sRotationX) + if (pIndoorCameraD3D->sRotationX) { v6 = vCamToVertexY * fRotationYSine + fRotationYCosine * vCamToVertexX; a1->vWorldViewPosition.x = v5 * fRotationXCosine + fRotationXSine * vCamToVertexZ; @@ -504,9 +505,9 @@ return false; //really strange cull; dot(to_cam, normal) < 0 means we see the BACK face, not font %_% - if ( (a2->vWorldPosition.z - (double)pEngine->pIndoorCameraD3D->vPartyPos.z) * (double)pFace->pFacePlane_old.vNormal.z - + (a2->vWorldPosition.y - (double)pEngine->pIndoorCameraD3D->vPartyPos.y) * (double)pFace->pFacePlane_old.vNormal.y - + (a2->vWorldPosition.x - (double)pEngine->pIndoorCameraD3D->vPartyPos.x) * (double)pFace->pFacePlane_old.vNormal.x < 0.0) + if ( (a2->vWorldPosition.z - (double)pIndoorCameraD3D->vPartyPos.z) * (double)pFace->pFacePlane_old.vNormal.z + + (a2->vWorldPosition.y - (double)pIndoorCameraD3D->vPartyPos.y) * (double)pFace->pFacePlane_old.vNormal.y + + (a2->vWorldPosition.x - (double)pIndoorCameraD3D->vPartyPos.x) * (double)pFace->pFacePlane_old.vNormal.x < 0.0) return false; return true; @@ -768,9 +769,9 @@ double v4; // st7@1 IndoorCameraD3D_Vec3 v8; // [sp+8h] [bp-1Ch]@1 - v8.x = (double)pEngine->pIndoorCameraD3D->vPartyPos.x; - v8.y = (double)pEngine->pIndoorCameraD3D->vPartyPos.y; - v8.z = (double)pEngine->pIndoorCameraD3D->vPartyPos.z; + v8.x = (double)pIndoorCameraD3D->vPartyPos.x; + v8.y = (double)pIndoorCameraD3D->vPartyPos.y; + v8.z = (double)pIndoorCameraD3D->vPartyPos.z; Vec3Transform(a1, a2); v4 = v8.x * a2->x + v8.y * a2->y + v8.z * a2->z; @@ -841,9 +842,9 @@ memcpy(&a2[*pOutNumVertices + 1], &a2[1], sizeof(a2[*pOutNumVertices + 1])); if ( (signed int)*pOutNumVertices <= 3 - || (((v18.vWorldPosition.z - (double)pEngine->pIndoorCameraD3D->vPartyPos.z) * thisa->face_plane.vNormal.z - + (v18.vWorldPosition.y - (double)pEngine->pIndoorCameraD3D->vPartyPos.y) * thisa->face_plane.vNormal.y - + (v18.vWorldPosition.x - (double)pEngine->pIndoorCameraD3D->vPartyPos.x) * thisa->face_plane.vNormal.x < 0.0) ? (v6 = 1.0) : (v6 = -1.0), + || (((v18.vWorldPosition.z - (double)pIndoorCameraD3D->vPartyPos.z) * thisa->face_plane.vNormal.z + + (v18.vWorldPosition.y - (double)pIndoorCameraD3D->vPartyPos.y) * thisa->face_plane.vNormal.y + + (v18.vWorldPosition.x - (double)pIndoorCameraD3D->vPartyPos.x) * thisa->face_plane.vNormal.x < 0.0) ? (v6 = 1.0) : (v6 = -1.0), (signed int)*pOutNumVertices <= 0) ) return 0; @@ -1360,19 +1361,19 @@ fRotationXSine = sin((pi_double + pi_double) * (double)-sRotationX / 2048.0); fRotationXCosine = cos((pi_double + pi_double) * (double)-sRotationX / 2048.0); - int_sine_y = stru_5C6E00->Sin( pEngine->pIndoorCameraD3D->sRotationY); - int_cosine_y = stru_5C6E00->Cos( pEngine->pIndoorCameraD3D->sRotationY); - int_sine_x = stru_5C6E00->Sin(-pEngine->pIndoorCameraD3D->sRotationX); - int_cosine_x = stru_5C6E00->Cos(-pEngine->pIndoorCameraD3D->sRotationX); + int_sine_y = stru_5C6E00->Sin( pIndoorCameraD3D->sRotationY); + int_cosine_y = stru_5C6E00->Cos( pIndoorCameraD3D->sRotationY); + int_sine_x = stru_5C6E00->Sin(-pIndoorCameraD3D->sRotationX); + int_cosine_x = stru_5C6E00->Cos(-pIndoorCameraD3D->sRotationX); } else { fRotationXSine = sin((pi_double + pi_double) * (double)sRotationX / 2048.0); fRotationXCosine = cos((pi_double + pi_double) * (double)sRotationX / 2048.0); - int_sine_y = stru_5C6E00->Sin(pEngine->pIndoorCameraD3D->sRotationY); - int_cosine_y = stru_5C6E00->Cos(pEngine->pIndoorCameraD3D->sRotationY); - int_sine_x = stru_5C6E00->Sin(pEngine->pIndoorCameraD3D->sRotationX); - int_cosine_x = stru_5C6E00->Cos(pEngine->pIndoorCameraD3D->sRotationX); + int_sine_y = stru_5C6E00->Sin(pIndoorCameraD3D->sRotationY); + int_cosine_y = stru_5C6E00->Cos(pIndoorCameraD3D->sRotationY); + int_sine_x = stru_5C6E00->Sin(pIndoorCameraD3D->sRotationX); + int_cosine_x = stru_5C6E00->Cos(pIndoorCameraD3D->sRotationX); } } \ No newline at end of file