Skip to content

Commit 4aa9cd1

Browse files
author
Pavel Kovalenko
committed
Format xrEngine sources.
1 parent 2b2d0a3 commit 4aa9cd1

File tree

249 files changed

+32682
-30812
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

249 files changed

+32682
-30812
lines changed

src/xrEngine/CameraBase.cpp

Lines changed: 59 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,23 @@
99

1010
CCameraBase::CCameraBase(CObject* p, u32 flags)
1111
{
12-
m_Flags.assign (flags);
13-
vPosition.set (0,0,0);
14-
vDirection.set (0,0,1);
15-
vNormal.set (0,1,0);
16-
yaw = 0;
17-
pitch = 0;
18-
roll = 0;
19-
lim_yaw.set (0.f,0.f);
20-
lim_pitch.set (0.f,0.f);
21-
lim_roll.set (0.f,0.f);
22-
bClampYaw = false;
23-
bClampPitch = false;
24-
bClampRoll = false;
25-
SetParent (p);
26-
f_fov = 90;
27-
f_aspect = 1.f;
28-
tag = 0;
12+
m_Flags.assign(flags);
13+
vPosition.set(0, 0, 0);
14+
vDirection.set(0, 0, 1);
15+
vNormal.set(0, 1, 0);
16+
yaw = 0;
17+
pitch = 0;
18+
roll = 0;
19+
lim_yaw.set(0.f, 0.f);
20+
lim_pitch.set(0.f, 0.f);
21+
lim_roll.set(0.f, 0.f);
22+
bClampYaw = false;
23+
bClampPitch = false;
24+
bClampRoll = false;
25+
SetParent(p);
26+
f_fov = 90;
27+
f_aspect = 1.f;
28+
tag = 0;
2929
}
3030

3131
CCameraBase::~CCameraBase()
@@ -34,51 +34,61 @@ CCameraBase::~CCameraBase()
3434

3535
void CCameraBase::Load(LPCSTR section)
3636
{
37-
rot_speed = pSettings->r_fvector3 (section,"rot_speed");
37+
rot_speed = pSettings->r_fvector3(section, "rot_speed");
3838

39-
lim_yaw = pSettings->r_fvector2 (section,"lim_yaw");
40-
lim_pitch = pSettings->r_fvector2 (section,"lim_pitch");
39+
lim_yaw = pSettings->r_fvector2(section, "lim_yaw");
40+
lim_pitch = pSettings->r_fvector2(section, "lim_pitch");
4141

42-
bClampPitch = (0!=lim_pitch[0])||(0!=lim_pitch[1]);
43-
bClampYaw = (0!=lim_yaw[0])||(0!=lim_yaw[1]);
42+
bClampPitch = (0 != lim_pitch[0]) || (0 != lim_pitch[1]);
43+
bClampYaw = (0 != lim_yaw[0]) || (0 != lim_yaw[1]);
4444

45-
if (bClampPitch) pitch = (lim_pitch[0]+lim_pitch[1])*0.5f;
46-
if (bClampYaw) yaw = (lim_yaw[0]+lim_yaw[1])*0.5f;
45+
if (bClampPitch) pitch = (lim_pitch[0] + lim_pitch[1])*0.5f;
46+
if (bClampYaw) yaw = (lim_yaw[0] + lim_yaw[1])*0.5f;
4747
}
4848

49-
IC float AClamp(Fvector2& l, float v){
50-
return (2*v-l[0]-l[1])/(l[1]-l[0]);
49+
IC float AClamp(Fvector2& l, float v)
50+
{
51+
return (2 * v - l[0] - l[1]) / (l[1] - l[0]);
5152
}
5253

53-
float CCameraBase::CheckLimYaw( ){
54-
if (bClampYaw){
55-
return AClamp(lim_yaw,yaw);
56-
}else
57-
return 0;
54+
float CCameraBase::CheckLimYaw()
55+
{
56+
if (bClampYaw)
57+
{
58+
return AClamp(lim_yaw, yaw);
59+
}
60+
else
61+
return 0;
5862
}
5963

60-
float CCameraBase::CheckLimPitch( ){
61-
if (bClampYaw){
62-
return AClamp(lim_pitch,pitch);
63-
}else
64-
return 0;
64+
float CCameraBase::CheckLimPitch()
65+
{
66+
if (bClampYaw)
67+
{
68+
return AClamp(lim_pitch, pitch);
69+
}
70+
else
71+
return 0;
6572
}
6673

67-
float CCameraBase::CheckLimRoll( ){
68-
if (bClampYaw){
69-
return AClamp(lim_roll,roll);
70-
}else
71-
return 0;
74+
float CCameraBase::CheckLimRoll()
75+
{
76+
if (bClampYaw)
77+
{
78+
return AClamp(lim_roll, roll);
79+
}
80+
else
81+
return 0;
7282
}
7383
SCamEffectorInfo::SCamEffectorInfo()
7484
{
75-
p.set (0,0,0);
76-
d.set (0,0,1);
77-
n.set (0,1,0);
85+
p.set(0, 0, 0);
86+
d.set(0, 0, 1);
87+
n.set(0, 1, 0);
7888

79-
fFov = 90.0f;
80-
fFar = 100.0f;
81-
fAspect = 1.f;
82-
dont_apply = false;
83-
affected_on_hud = true;
89+
fFov = 90.0f;
90+
fFar = 100.0f;
91+
fAspect = 1.f;
92+
dont_apply = false;
93+
affected_on_hud = true;
8494
}

src/xrEngine/CameraBase.h

Lines changed: 51 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -11,76 +11,77 @@
1111
// refs
1212
class CObject;
1313

14-
class ENGINE_API CCameraBase
14+
class ENGINE_API CCameraBase
1515
{
1616
protected:
17-
CObject* parent;
17+
CObject* parent;
1818

1919
public:
20-
BOOL bClampYaw, bClampPitch, bClampRoll;
21-
float yaw,pitch,roll;
20+
BOOL bClampYaw, bClampPitch, bClampRoll;
21+
float yaw, pitch, roll;
2222

23-
enum{
24-
flRelativeLink = (1<<0),
25-
flPositionRigid = (1<<1),
26-
flDirectionRigid = (1<<2),
27-
};
28-
Flags32 m_Flags;
23+
enum
24+
{
25+
flRelativeLink = (1 << 0),
26+
flPositionRigid = (1 << 1),
27+
flDirectionRigid = (1 << 2),
28+
};
29+
Flags32 m_Flags;
2930

30-
ECameraStyle style;
31-
Fvector2 lim_yaw,lim_pitch,lim_roll;
32-
Fvector rot_speed;
31+
ECameraStyle style;
32+
Fvector2 lim_yaw, lim_pitch, lim_roll;
33+
Fvector rot_speed;
3334

34-
Fvector vPosition;
35-
Fvector vDirection;
36-
Fvector vNormal;
37-
float f_fov;
38-
float f_aspect;
35+
Fvector vPosition;
36+
Fvector vDirection;
37+
Fvector vNormal;
38+
float f_fov;
39+
float f_aspect;
3940

40-
IC Fvector Position () const { return vPosition; }
41-
IC Fvector Direction () const { return vDirection;}
42-
IC Fvector Up () const { return vNormal; }
43-
IC Fvector Right () const { return Fvector().crossproduct( vNormal, vDirection ); }
44-
IC float Fov () const { return f_fov; }
45-
IC float Aspect () const { return f_aspect; }
41+
IC Fvector Position() const { return vPosition; }
42+
IC Fvector Direction() const { return vDirection; }
43+
IC Fvector Up() const { return vNormal; }
44+
IC Fvector Right() const { return Fvector().crossproduct(vNormal, vDirection); }
45+
IC float Fov() const { return f_fov; }
46+
IC float Aspect() const { return f_aspect; }
4647

47-
int tag;
48+
int tag;
4849
public:
49-
CCameraBase ( CObject* p, u32 flags );
50-
virtual ~CCameraBase ( );
51-
virtual void Load (LPCSTR section);
52-
void SetParent ( CObject* p ) {parent=p; VERIFY(p);}
53-
virtual void OnActivate ( CCameraBase* old_cam ) {;}
54-
virtual void OnDeactivate ( ) {;}
55-
virtual void Move ( int cmd, float val=0, float factor=1.0f) {;}
56-
virtual void Update ( Fvector& point, Fvector& noise_angle ) {;}
57-
virtual void Get ( Fvector& P, Fvector& D, Fvector& N ) {P.set(vPosition);D.set(vDirection);N.set(vNormal);}
58-
virtual void Set ( const Fvector& P, const Fvector& D, const Fvector& N ){vPosition.set(P);vDirection.set(D);vNormal.set(N);}
59-
virtual void Set ( float Y, float P, float R ) {yaw=Y;pitch=P;roll=R;}
60-
61-
virtual float GetWorldYaw ( ) { return 0; };
62-
virtual float GetWorldPitch ( ) { return 0; };
50+
CCameraBase(CObject* p, u32 flags);
51+
virtual ~CCameraBase();
52+
virtual void Load(LPCSTR section);
53+
void SetParent(CObject* p) { parent = p; VERIFY(p); }
54+
virtual void OnActivate(CCameraBase* old_cam) { ; }
55+
virtual void OnDeactivate() { ; }
56+
virtual void Move(int cmd, float val = 0, float factor = 1.0f) { ; }
57+
virtual void Update(Fvector& point, Fvector& noise_angle) { ; }
58+
virtual void Get(Fvector& P, Fvector& D, Fvector& N) { P.set(vPosition); D.set(vDirection); N.set(vNormal); }
59+
virtual void Set(const Fvector& P, const Fvector& D, const Fvector& N) { vPosition.set(P); vDirection.set(D); vNormal.set(N); }
60+
virtual void Set(float Y, float P, float R) { yaw = Y; pitch = P; roll = R; }
6361

64-
virtual float CheckLimYaw ( );
65-
virtual float CheckLimPitch ( );
66-
virtual float CheckLimRoll ( );
62+
virtual float GetWorldYaw() { return 0; };
63+
virtual float GetWorldPitch() { return 0; };
64+
65+
virtual float CheckLimYaw();
66+
virtual float CheckLimPitch();
67+
virtual float CheckLimRoll();
6768
};
6869

6970

7071
template<typename T>
71-
IC void tviewport_size( CRenderDeviceBase& D, float _viewport_near, const T &cam_info, float& h_w, float& h_h)
72+
IC void tviewport_size(CRenderDeviceBase& D, float _viewport_near, const T& cam_info, float& h_w, float& h_h)
7273
{
73-
h_h = _viewport_near*tan(deg2rad(cam_info.Fov())/2.f);
74-
VERIFY2( _valid(h_h), make_string("invalide viewporrt params fov: %f ", cam_info.Fov()) );
75-
float aspect = D.fASPECT;//cam_info.Aspect();
76-
VERIFY( aspect>EPS );
77-
h_w = h_h/aspect;
74+
h_h = _viewport_near*tan(deg2rad(cam_info.Fov()) / 2.f);
75+
VERIFY2(_valid(h_h), make_string("invalide viewporrt params fov: %f ", cam_info.Fov()));
76+
float aspect = D.fASPECT;//cam_info.Aspect();
77+
VERIFY(aspect > EPS);
78+
h_w = h_h / aspect;
7879
}
7980

8081
template<typename T>
81-
IC void viewport_size( float _viewport_near, const T &cam_info, float& h_w, float& h_h)
82+
IC void viewport_size(float _viewport_near, const T& cam_info, float& h_w, float& h_h)
8283
{
83-
tviewport_size<T>( Device, _viewport_near, cam_info, h_w, h_h );
84+
tviewport_size<T>(Device, _viewport_near, cam_info, h_w, h_h);
8485
}
8586

8687
#endif // !defined(AFX_CAMERABASE_H__B11F8AE1_1213_11D4_B4E3_4854E82A090D__INCLUDED_)

src/xrEngine/CameraDebug.h

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,24 +10,24 @@
1010
#include "iinputreceiver.h"
1111
1212
class ENGINE_API CCameraDebug :
13-
public CCameraBase,
14-
public pureRender,
15-
public IInputReceiver
13+
public CCameraBase,
14+
public pureRender,
15+
public IInputReceiver
1616
{
17-
D3DXMATRIX g_matPosition;
18-
D3DXVECTOR3 g_vecVelocity;
19-
D3DXVECTOR3 g_vecAngularVelocity;
20-
Fvector savedP,savedD,savedN;
21-
ECameraStyle savedStyle;
22-
Flags32 savedDF;
17+
D3DXMATRIX g_matPosition;
18+
D3DXVECTOR3 g_vecVelocity;
19+
D3DXVECTOR3 g_vecAngularVelocity;
20+
Fvector savedP,savedD,savedN;
21+
ECameraStyle savedStyle;
22+
Flags32 savedDF;
2323
public:
24-
virtual void OnMove (void);
25-
virtual void OnCameraActivate ( CCameraBase* old_cam );
26-
virtual void OnCameraDeactivate ( );
27-
virtual void OnRender ( );
28-
virtual void IR_OnKeyboardPress (int dik);
24+
virtual void OnMove (void);
25+
virtual void OnCameraActivate ( CCameraBase* old_cam );
26+
virtual void OnCameraDeactivate ( );
27+
virtual void OnRender ( );
28+
virtual void IR_OnKeyboardPress (int dik);
2929
30-
CCameraDebug();
31-
virtual ~CCameraDebug();
30+
CCameraDebug();
31+
virtual ~CCameraDebug();
3232
};
3333
*/

src/xrEngine/CameraDefs.h

Lines changed: 40 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -5,54 +5,57 @@
55

66
struct ENGINE_API SBaseEffector
77
{
8-
typedef fastdelegate::FastDelegate0<> CB_ON_B_REMOVE;
9-
CB_ON_B_REMOVE m_on_b_remove_callback;
10-
virtual ~SBaseEffector(){}
8+
typedef fastdelegate::FastDelegate0<> CB_ON_B_REMOVE;
9+
CB_ON_B_REMOVE m_on_b_remove_callback;
10+
virtual ~SBaseEffector() {}
1111
};
1212

1313
struct ENGINE_API SCamEffectorInfo
1414
{
15-
Fvector p;
16-
Fvector d;
17-
Fvector n;
18-
Fvector r;
19-
float fFov;
20-
float fFar;
21-
float fAspect;
22-
bool dont_apply;
23-
bool affected_on_hud;
24-
SCamEffectorInfo();
25-
SCamEffectorInfo& operator = (const SCamEffectorInfo& other)
26-
{
27-
p = other.p;
28-
d = other.d;
29-
n = other.n;
30-
r = other.r;
31-
fFov = other.fFov;
32-
fFar = other.fFar;
33-
fAspect = other.fAspect;
34-
dont_apply = other.dont_apply;
35-
affected_on_hud = other.affected_on_hud;
36-
return *this;
37-
}
15+
Fvector p;
16+
Fvector d;
17+
Fvector n;
18+
Fvector r;
19+
float fFov;
20+
float fFar;
21+
float fAspect;
22+
bool dont_apply;
23+
bool affected_on_hud;
24+
SCamEffectorInfo();
25+
SCamEffectorInfo& operator = (const SCamEffectorInfo& other)
26+
{
27+
p = other.p;
28+
d = other.d;
29+
n = other.n;
30+
r = other.r;
31+
fFov = other.fFov;
32+
fFar = other.fFar;
33+
fAspect = other.fAspect;
34+
dont_apply = other.dont_apply;
35+
affected_on_hud = other.affected_on_hud;
36+
return *this;
37+
}
3838
};
3939

40-
enum ECameraStyle {
41-
csCamDebug,
42-
csFirstEye,
43-
csLookAt,
40+
enum ECameraStyle
41+
{
42+
csCamDebug,
43+
csFirstEye,
44+
csLookAt,
4445
csMax,
45-
csFixed,
46-
cs_forcedword = u32(-1)
46+
csFixed,
47+
cs_forcedword = u32(-1)
4748
};
4849

49-
enum ECamEffectorType {
50-
cefDemo =0,
51-
cefNext
50+
enum ECamEffectorType
51+
{
52+
cefDemo = 0,
53+
cefNext
5254
};
5355

54-
enum EEffectorPPType {
55-
ppeNext =0,
56+
enum EEffectorPPType
57+
{
58+
ppeNext = 0,
5659
};
5760

5861
// refs

0 commit comments

Comments
 (0)