-
Notifications
You must be signed in to change notification settings - Fork 0
/
CAMERA.H
145 lines (128 loc) · 4.96 KB
/
CAMERA.H
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
/* ========================================================================
Copyright (c) 1990,1997 Synergistic Software
All Rights Reserved
Author: G. Powell
======================================================================== */
#ifndef _CAMERA_H
#define _CAMERA_H
/* ------------------------------------------------------------------------
Sub Includes
------------------------------------------------------------------------ */
#if !defined(_TYPEDEFS_H)
#include "typedefs.h"
#endif
/* ------------------------------------------------------------------------
Defines and Compile Flags
------------------------------------------------------------------------ */
#define CAMERA_FIXEDPT 8
#define CAMERA_INT_VAL(x) ((x) >> CAMERA_FIXEDPT)
#define CAMERA_FLOAT_VAL(x) (x)
/* ------------------------------------------------------------------------
Enums
------------------------------------------------------------------------ */
/* ------------------------------------------------------------------------
Typedefs
------------------------------------------------------------------------ */
typedef struct {
LONG x; // Target coordinates
LONG y;
LONG z;
LONG a;
LONG p;
} CAMERA_LINEAR_TARGET;
typedef struct {
LONG x; // face to pt.
LONG y; // face to pt.
LONG z; // New Z
LONG p; // New Pitch
LONG a; // destination angle in Polar coords. (a, distance)
LONG h; // New Height
LONG radius; // New radius
LONG distance; // New min distance to pt.
LONG max_distance; // New max distance to pt.
} CAMERA_ROTATIONAL_TARGET;
typedef struct{
LONG x,y; // xy
LONG z; // height above floor
LONG a,p; // angle, pitch
LONG TargetRequested; // A flag
LONG TargetFactor;
LONG Rate[4]; //Rate[0]: distance rate Rate[1]: height rate
//Rate[2]: angle rate Rate[3]: pitch rate
union {
CAMERA_LINEAR_TARGET LTarget;
CAMERA_ROTATIONAL_TARGET RTarget;
};
CAMERA_ROTATIONAL_TARGET Current;
LONG vx; // Velocity values.
LONG vy;
LONG vz;
LONG va;
} CAMERA;
typedef struct{
LONG x,y; // xy
LONG z; // height above floor
LONG a,p; // angle, pitch
LONG attributes; // unused so far
LONG width; // width of buffer
LONG height; // height of buffer
SHORT buffer; // handle to buffer
} CAMERA_DESCRIPTOR;
#define MAX_LEVEL_CAMERAS 12
/* ------------------------------------------------------------------------
Macros
------------------------------------------------------------------------ */
/* ------------------------------------------------------------------------
Global Variables
------------------------------------------------------------------------ */
#if defined (__cplusplus)
extern "C" {
#endif
extern CAMERA camera;
#if defined (__cplusplus)
}
#endif
/* ------------------------------------------------------------------------
Prototypes
------------------------------------------------------------------------ */
#if defined (__cplusplus)
extern "C" {
#endif
void InitializeCamera(CAMERA *, LONG /* X */,
LONG /* Y */,
LONG /* Z */,
LONG /* A */,
LONG /* P */);
void SetCameraPosition(CAMERA *,const LONG x,const LONG y,const LONG z, const LONG a, const LONG p);
#define SetCameraXYZA(c,x,y,a) SetCameraPosition((c),(x),(y),(z),(a),NO_CHANGE)
#define SetCameraXYA(c,x,y,a) SetCameraPosition((c),(x),(y),NO_CHANGE,(a),NO_CHANGE)
#define SetCameraAngel(c,a) SetCameraPosition((c),NO_CHANGE,NO_CHANGE,NO_CHANGE,(a),NO_CHANGE)
#define SetCameraPitch(c,p) SetCameraPosition((c),NO_CHANGE,NO_CHANGE,NO_CHANGE,NO_CHANGE,(p))
void SetCameraCurrentPosition(CAMERA *,const LONG x,const LONG y,const LONG z, const LONG angle, const LONG p, const LONG radius);
void SetCameraMotionVars( CAMERA *pCamera, const LONG TargetFactor, const LONG LinearRate);
#define SetCameraTargetFactor(c,tf) SetCameraMotionVars((c),(tf),NO_CHANGE)
#define SetCameraLinearRate(c,lr) SetCameraMotionVars((c),NO_CHANGE,(lr))
void SetCameraTarget( CAMERA *, const LONG Targetx, const LONG Targety, const LONG Targetz, const LONG Targeta, const LONG Targetp, const BOOL swoop);
void SetCameraRotateTarget(CAMERA *,
const LONG Targetx,
const LONG Targety,
const LONG NewZ,
const LONG NewPitch,
const LONG DeltaAngle,
const LONG MinRadius,
const LONG NewDistance,
const BOOL swoop);
void MoveCamera(CAMERA *, const LONG KeyState);
void SwoopCamera(CAMERA *pCamera);
void MoveCameraEvenly(CAMERA *pCamera);
void RotateSwoopCamera(CAMERA *pCamera);
void RotateCameraEvenly(CAMERA *pCamera);
void push_camera(void);
void pull_camera(void);
void RotateCameraAroundPoint(CAMERA * pCamera, LONG KeyState);
void SetCameraRotatePointTarget( CAMERA *pCamera, const LONG , const LONG , const LONG, const LONG , const LONG , const BOOL );
void SetCameraRotatePointRates( CAMERA *pCamera, const LONG , const LONG , const LONG , const LONG, const LONG, const LONG );
#if defined (__cplusplus)
}
#endif
#endif // _CAMERA_H