annotate OutdoorCamera.cpp @ 1616:de6e646822a6

mul <> sub0 difference
author zipi
date Sat, 14 Sep 2013 22:43:45 +0100
parents 75fafd8ced59
children
rev   line source
1295
86a83e12d795 moving files
Ritor1
parents:
diff changeset
1 #include "OutdoorCamera.h"
86a83e12d795 moving files
Ritor1
parents:
diff changeset
2 #include "IndoorCamera.h"
86a83e12d795 moving files
Ritor1
parents:
diff changeset
3 #include "Outdoor_stuff.h"
86a83e12d795 moving files
Ritor1
parents:
diff changeset
4 #include "Game.h"
86a83e12d795 moving files
Ritor1
parents:
diff changeset
5 #include "LightmapBuilder.h"
86a83e12d795 moving files
Ritor1
parents:
diff changeset
6 #include "Viewport.h"
86a83e12d795 moving files
Ritor1
parents:
diff changeset
7 #include "Math.h"
86a83e12d795 moving files
Ritor1
parents:
diff changeset
8 #include "mm7_data.h"
86a83e12d795 moving files
Ritor1
parents:
diff changeset
9
86a83e12d795 moving files
Ritor1
parents:
diff changeset
10 //----- (00481E55) --------------------------------------------------------
86a83e12d795 moving files
Ritor1
parents:
diff changeset
11 void OutdoorCamera::Project(unsigned int uNumVertices)
86a83e12d795 moving files
Ritor1
parents:
diff changeset
12 {
86a83e12d795 moving files
Ritor1
parents:
diff changeset
13 double v1; // st7@2
86a83e12d795 moving files
Ritor1
parents:
diff changeset
14 double v2; // st6@2
86a83e12d795 moving files
Ritor1
parents:
diff changeset
15 double v3; // st5@2
86a83e12d795 moving files
Ritor1
parents:
diff changeset
16 int v4; // eax@2
86a83e12d795 moving files
Ritor1
parents:
diff changeset
17 unsigned int v5; // edx@2
86a83e12d795 moving files
Ritor1
parents:
diff changeset
18 double v6; // st4@3
86a83e12d795 moving files
Ritor1
parents:
diff changeset
19 double v7; // st3@3
86a83e12d795 moving files
Ritor1
parents:
diff changeset
20
86a83e12d795 moving files
Ritor1
parents:
diff changeset
21 if ( (signed int)uNumVertices > 0 )
86a83e12d795 moving files
Ritor1
parents:
diff changeset
22 {
86a83e12d795 moving files
Ritor1
parents:
diff changeset
23 v1 = (double)pOutdoorCamera->int_fov_rad;
86a83e12d795 moving files
Ritor1
parents:
diff changeset
24 v2 = (double)pViewport->uScreenCenterX;
86a83e12d795 moving files
Ritor1
parents:
diff changeset
25 v3 = (double)pViewport->uScreenCenterY;
86a83e12d795 moving files
Ritor1
parents:
diff changeset
26 v4 = 0;
86a83e12d795 moving files
Ritor1
parents:
diff changeset
27 v5 = uNumVertices;
86a83e12d795 moving files
Ritor1
parents:
diff changeset
28 do
86a83e12d795 moving files
Ritor1
parents:
diff changeset
29 {
86a83e12d795 moving files
Ritor1
parents:
diff changeset
30 v6 = v1 * array_507D30[v4]._rhw;
86a83e12d795 moving files
Ritor1
parents:
diff changeset
31 v7 = v6 * array_507D30[v4].vWorldViewPosition.y;
86a83e12d795 moving files
Ritor1
parents:
diff changeset
32 memcpy(&array_50AC10[v4], &array_507D30[v4], sizeof(array_50AC10[v4]));
86a83e12d795 moving files
Ritor1
parents:
diff changeset
33 array_50AC10[v4].vWorldViewProjX = v2 - v7;
86a83e12d795 moving files
Ritor1
parents:
diff changeset
34 array_50AC10[v4].vWorldViewProjY = v3 - v6 * array_507D30[v4].vWorldViewPosition.z;
86a83e12d795 moving files
Ritor1
parents:
diff changeset
35 ++v4;
86a83e12d795 moving files
Ritor1
parents:
diff changeset
36 --v5;
86a83e12d795 moving files
Ritor1
parents:
diff changeset
37 }
86a83e12d795 moving files
Ritor1
parents:
diff changeset
38 while ( v5 );
86a83e12d795 moving files
Ritor1
parents:
diff changeset
39 }
86a83e12d795 moving files
Ritor1
parents:
diff changeset
40 }
86a83e12d795 moving files
Ritor1
parents:
diff changeset
41 //----- (00485F64) --------------------------------------------------------
86a83e12d795 moving files
Ritor1
parents:
diff changeset
42 void OutdoorCamera::_485F64()
86a83e12d795 moving files
Ritor1
parents:
diff changeset
43 {
86a83e12d795 moving files
Ritor1
parents:
diff changeset
44 int v1; // eax@1
86a83e12d795 moving files
Ritor1
parents:
diff changeset
45 int v2; // eax@2
86a83e12d795 moving files
Ritor1
parents:
diff changeset
46 signed __int64 v3; // qtt@4
86a83e12d795 moving files
Ritor1
parents:
diff changeset
47 int v4; // eax@4
86a83e12d795 moving files
Ritor1
parents:
diff changeset
48
86a83e12d795 moving files
Ritor1
parents:
diff changeset
49 this->uCameraFovInDegrees = 75;
86a83e12d795 moving files
Ritor1
parents:
diff changeset
50 v1 = stru_5C6E00->uPiMask & 0xD5;
86a83e12d795 moving files
Ritor1
parents:
diff changeset
51 if ( v1 >= (signed int)stru_5C6E00->uIntegerHalfPi )
86a83e12d795 moving files
Ritor1
parents:
diff changeset
52 v2 = -stru_5C6E00->pTanTable[stru_5C6E00->uIntegerPi - v1];
86a83e12d795 moving files
Ritor1
parents:
diff changeset
53 else
86a83e12d795 moving files
Ritor1
parents:
diff changeset
54 v2 = stru_5C6E00->pTanTable[v1];
86a83e12d795 moving files
Ritor1
parents:
diff changeset
55 LODWORD(v3) = (viewparams->uSomeZ - viewparams->uSomeX) << 31;
86a83e12d795 moving files
Ritor1
parents:
diff changeset
56 HIDWORD(v3) = (viewparams->uSomeZ - viewparams->uSomeX) << 15 >> 16;
86a83e12d795 moving files
Ritor1
parents:
diff changeset
57 v4 = (signed int)(v3 / v2) >> 16;
86a83e12d795 moving files
Ritor1
parents:
diff changeset
58 this->int_fov_rad = v4;
86a83e12d795 moving files
Ritor1
parents:
diff changeset
59 this->field_4C = 360000;
86a83e12d795 moving files
Ritor1
parents:
diff changeset
60 this->int_fov_rad_inv = 65536 / v4;
86a83e12d795 moving files
Ritor1
parents:
diff changeset
61 this->field_50 = 115;
1391
cc9a3a24d61d Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents: 1295
diff changeset
62 //sr_6BE060[1] = 1;
1295
86a83e12d795 moving files
Ritor1
parents:
diff changeset
63 RotationToInts();
86a83e12d795 moving files
Ritor1
parents:
diff changeset
64 }
86a83e12d795 moving files
Ritor1
parents:
diff changeset
65
86a83e12d795 moving files
Ritor1
parents:
diff changeset
66 //----- (0048600E) --------------------------------------------------------
86a83e12d795 moving files
Ritor1
parents:
diff changeset
67 void OutdoorCamera::RotationToInts()
86a83e12d795 moving files
Ritor1
parents:
diff changeset
68 {
86a83e12d795 moving files
Ritor1
parents:
diff changeset
69 camera_rotation_y_int_sine = stru_5C6E00->Sin(pIndoorCamera->sRotationY);
86a83e12d795 moving files
Ritor1
parents:
diff changeset
70 camera_rotation_y_int_cosine = stru_5C6E00->Cos(pIndoorCamera->sRotationY);
86a83e12d795 moving files
Ritor1
parents:
diff changeset
71 camera_rotation_x_int_sine = stru_5C6E00->Sin(pIndoorCamera->sRotationX);
86a83e12d795 moving files
Ritor1
parents:
diff changeset
72 camera_rotation_x_int_cosine = stru_5C6E00->Cos(pIndoorCamera->sRotationX);
86a83e12d795 moving files
Ritor1
parents:
diff changeset
73 }