annotate IndoorCamera.cpp @ 212:9f349addbe00

Слияние
author Ritor1
date Sat, 16 Feb 2013 22:14:04 +0600
parents 9c0607679772
children d720a13e2273
rev   line source
0
Ritor1
parents:
diff changeset
1 #include "IndoorCamera.h"
Ritor1
parents:
diff changeset
2 #include "Render.h"
Ritor1
parents:
diff changeset
3 #include "Game.h"
Ritor1
parents:
diff changeset
4 #include "Indoor.h"
Ritor1
parents:
diff changeset
5 #include "Math.h"
Ritor1
parents:
diff changeset
6
Ritor1
parents:
diff changeset
7 #include "mm7_data.h"
Ritor1
parents:
diff changeset
8
Ritor1
parents:
diff changeset
9
Ritor1
parents:
diff changeset
10
Ritor1
parents:
diff changeset
11
Ritor1
parents:
diff changeset
12
Ritor1
parents:
diff changeset
13 IndoorCamera *pIndoorCamera; // idb
Ritor1
parents:
diff changeset
14
Ritor1
parents:
diff changeset
15
Ritor1
parents:
diff changeset
16
Ritor1
parents:
diff changeset
17
Ritor1
parents:
diff changeset
18
Ritor1
parents:
diff changeset
19 //----- (00481CCE) --------------------------------------------------------
Ritor1
parents:
diff changeset
20 float IndoorCamera::ViewTransform(RenderVertexSoft *a1)
Ritor1
parents:
diff changeset
21 {
Ritor1
parents:
diff changeset
22 float result; // eax@1
Ritor1
parents:
diff changeset
23 double vCamToVertexZ; // st7@1
Ritor1
parents:
diff changeset
24 double v3; // st6@1
Ritor1
parents:
diff changeset
25 double v4; // st5@1
Ritor1
parents:
diff changeset
26 double v5; // st4@1
Ritor1
parents:
diff changeset
27 float v6; // ST04_4@3
Ritor1
parents:
diff changeset
28 float v7; // [sp+0h] [bp-14h]@1
Ritor1
parents:
diff changeset
29 float v8; // [sp+8h] [bp-Ch]@1
Ritor1
parents:
diff changeset
30 float vCamToVertexX; // [sp+Ch] [bp-8h]@1
Ritor1
parents:
diff changeset
31 float vCamToVertexY; // [sp+10h] [bp-4h]@1
Ritor1
parents:
diff changeset
32
Ritor1
parents:
diff changeset
33 v8 = fRotationXCosine;
Ritor1
parents:
diff changeset
34 result = fRotationXSine;
Ritor1
parents:
diff changeset
35 v7 = fRotationXSine;
Ritor1
parents:
diff changeset
36 vCamToVertexX = a1->vWorldPosition.x - (double)pos.x;
Ritor1
parents:
diff changeset
37 vCamToVertexY = a1->vWorldPosition.y - (double)pos.y;
Ritor1
parents:
diff changeset
38 vCamToVertexZ = a1->vWorldPosition.z - (double)pos.z;
Ritor1
parents:
diff changeset
39 v3 = fRotationYCosine;
Ritor1
parents:
diff changeset
40 v4 = fRotationYSine;
Ritor1
parents:
diff changeset
41 v5 = vCamToVertexY * fRotationYSine + fRotationYCosine * vCamToVertexX;
Ritor1
parents:
diff changeset
42 if ( sRotationX )
Ritor1
parents:
diff changeset
43 {
Ritor1
parents:
diff changeset
44 v6 = vCamToVertexY * fRotationYSine + fRotationYCosine * vCamToVertexX;
Ritor1
parents:
diff changeset
45 a1->vWorldViewPosition.x = v5 * fRotationXCosine + fRotationXSine * vCamToVertexZ;
Ritor1
parents:
diff changeset
46 a1->vWorldViewPosition.y = v3 * vCamToVertexY - v4 * vCamToVertexX;
Ritor1
parents:
diff changeset
47 a1->vWorldViewPosition.z = v8 * vCamToVertexZ - v6 * v7;
Ritor1
parents:
diff changeset
48 }
Ritor1
parents:
diff changeset
49 else
Ritor1
parents:
diff changeset
50 {
Ritor1
parents:
diff changeset
51 a1->vWorldViewPosition.x = vCamToVertexY * fRotationYSine + fRotationYCosine * vCamToVertexX;
Ritor1
parents:
diff changeset
52 a1->vWorldViewPosition.y = v3 * vCamToVertexY - v4 * vCamToVertexX;
Ritor1
parents:
diff changeset
53 a1->vWorldViewPosition.z = vCamToVertexZ;
Ritor1
parents:
diff changeset
54 }
Ritor1
parents:
diff changeset
55 return result;
Ritor1
parents:
diff changeset
56 }
Ritor1
parents:
diff changeset
57
Ritor1
parents:
diff changeset
58
Ritor1
parents:
diff changeset
59
Ritor1
parents:
diff changeset
60 //----- (0042394D) --------------------------------------------------------
Ritor1
parents:
diff changeset
61 void IndoorCamera::Initialize(int degFov, unsigned int uViewportWidth, unsigned int uViewportHeight)
Ritor1
parents:
diff changeset
62 {
Ritor1
parents:
diff changeset
63 IndoorCamera *v4; // esi@1
Ritor1
parents:
diff changeset
64 double v5; // st7@1
Ritor1
parents:
diff changeset
65
Ritor1
parents:
diff changeset
66 v4 = this;
Ritor1
parents:
diff changeset
67 v5 = (double)(signed int)(signed __int64)((double)(signed int)uViewportWidth
Ritor1
parents:
diff changeset
68 * 0.5
Ritor1
parents:
diff changeset
69 / tan((double)(degFov >> 1) * 0.01745329)
Ritor1
parents:
diff changeset
70 + 0.5);
Ritor1
parents:
diff changeset
71 v4->flt_1C_fov = v5;
Ritor1
parents:
diff changeset
72 v4->flt_20_inv_1C = 65536.0 / v5;
Ritor1
parents:
diff changeset
73 }
Ritor1
parents:
diff changeset
74
Ritor1
parents:
diff changeset
75 //----- (004239A7) --------------------------------------------------------
Ritor1
parents:
diff changeset
76 void IndoorCamera::Initialize2()
Ritor1
parents:
diff changeset
77 {
Ritor1
parents:
diff changeset
78 //IndoorCamera *v1; // esi@1
Ritor1
parents:
diff changeset
79 double v2; // st7@4
Ritor1
parents:
diff changeset
80 //double v3; // st7@6
Ritor1
parents:
diff changeset
81 //int v4; // eax@6
Ritor1
parents:
diff changeset
82 //int v5; // eax@6
Ritor1
parents:
diff changeset
83 //int v6; // ST04_4@6
Ritor1
parents:
diff changeset
84 //int v7; // eax@6
Ritor1
parents:
diff changeset
85 //int v8; // ST04_4@6
Ritor1
parents:
diff changeset
86
Ritor1
parents:
diff changeset
87 //v1 = this;
Ritor1
parents:
diff changeset
88 fRotationYSine = sin((3.141592653589793 + 3.141592653589793) * (double)sRotationY * 0.00048828125);
Ritor1
parents:
diff changeset
89 fRotationYCosine = cos((3.141592653589793 + 3.141592653589793) * (double)sRotationY * 0.00048828125);
Ritor1
parents:
diff changeset
90 if ( byte_4D864C && pGame->uFlags & 0x80 || uCurrentlyLoadedLevelType == LEVEL_Indoor)
Ritor1
parents:
diff changeset
91 {
Ritor1
parents:
diff changeset
92 fRotationXSine = sin((3.141592653589793 + 3.141592653589793) * (double)-sRotationX * 0.00048828125);
Ritor1
parents:
diff changeset
93 v2 = (3.141592653589793 + 3.141592653589793) * (double)-sRotationX;
Ritor1
parents:
diff changeset
94 }
Ritor1
parents:
diff changeset
95 else
Ritor1
parents:
diff changeset
96 {
Ritor1
parents:
diff changeset
97 fRotationXSine = sin((3.141592653589793 + 3.141592653589793) * (double)sRotationX * 0.00048828125);
Ritor1
parents:
diff changeset
98 v2 = (3.141592653589793 + 3.141592653589793) * (double)sRotationX;
Ritor1
parents:
diff changeset
99 }
Ritor1
parents:
diff changeset
100 //v3 = cos(v2 * 0.00048828125);
Ritor1
parents:
diff changeset
101 //v4 = sRotationY;
Ritor1
parents:
diff changeset
102 fRotationXCosine = cos(v2 * 0.00048828125);
Ritor1
parents:
diff changeset
103 //v5 = stru_5C6E00->SinCos(sRotationY - stru_5C6E00->uIntegerHalfPi);
Ritor1
parents:
diff changeset
104 //v6 = sRotationY;
Ritor1
parents:
diff changeset
105 _int_sine = stru_5C6E00->SinCos(sRotationY - stru_5C6E00->uIntegerHalfPi);
Ritor1
parents:
diff changeset
106 _int_cosine = stru_5C6E00->SinCos(sRotationY);
Ritor1
parents:
diff changeset
107 //v7 = stru_5C6E00->SinCos(sRotationX - stru_5C6E00->uIntegerHalfPi);
Ritor1
parents:
diff changeset
108 //v8 = sRotationX;
Ritor1
parents:
diff changeset
109 _int_sine_2 = stru_5C6E00->SinCos(sRotationX - stru_5C6E00->uIntegerHalfPi);
Ritor1
parents:
diff changeset
110 _int_cosine_2 = stru_5C6E00->SinCos(sRotationX);
Ritor1
parents:
diff changeset
111 }
Ritor1
parents:
diff changeset
112 // 4D864C: using guessed type char byte_4D864C;