137
//!Orthognal transformation camera
138
class CameraOrthogonal : public Camera
141
CameraOrthogonal() {typeNum=CAM_FREE;};
142
~CameraOrthogonal() {};
144
Camera *clone() const;
145
//!Applies the camera settings to openGL, ensuring cube is not clipped by far plane
146
virtual void apply(float outputRatio,const BoundCube &b,bool loadIdentity=true) const {};
147
//!Applies the camera settings to openGL, restricting the viewport (range (-1, 1))
148
virtual void apply(float outputRatio,const BoundCube &b,bool loadIdentity,
149
float leftRestrict,float rightRestrict,
150
float bottomRestrict, float topRestrict) const {ASSERT(false);};
152
//!Return the user-settable properties of the camera
153
void getProperties(CameraProperties &p) const;
155
//!Write the state of the camera
156
virtual bool writeState(std::ostream &f, unsigned int format, unsigned int tabs=0) const;
157
//!Read the state of the camera
158
virtual bool readState(xmlNodePtr nodePtr);
161
//!A class for a perspective "point and view" camera
162
/*!Class employes a standard viewing frustrum method
165
class CameraPerspective : public Camera
151
//!A perspective camera that looks at a specific location
152
class CameraLookAt : public Camera
155
//!Location for camera to look at
158
void recomputeViewDirection();
168
160
//!Perspective FOV
173
165
//!Far plane is computed on-the-fly. cannot be set directly. Oh no! mutable. gross!
174
166
mutable float farPlane;
168
//!Distort to the viewing frustum. (eg for stero) ( a frustum is a rectangular pyramid with the top cut off)
169
float frustumDistortion;
176
171
//!Do the perspective calculations
177
172
void doPerspCalcs(float aspect,const BoundCube &bc,bool loadIdentity) const;
179
//Version with top left control. left and top are in world coordinates.
180
void doPerspCalcs(float aspect,const BoundCube &bc,
181
bool loadIdentity,float left, float top) const;
187
virtual ~CameraPerspective();
189
Camera *clone() const;
191
//!Streaming output operator, presents human readable text
192
friend std::ostream &operator<<(std::ostream &stream, const CameraPerspective &);
193
//!Applies the camera transforms to world
194
void apply(float outAspect, const BoundCube &boundCube,bool loadIdentity=true) const;
196
//!Set the camera's near clipping plane
197
void setNearPlane(float f) {nearPlane = f;}
199
//!Set the camera's FOV angle.
200
inline void setFOV(float newFov) { ASSERT(newFov >0.0 && newFov<180.0); fovAngle =newFov;}
202
//!get the camera's near clipping plane
203
inline float getNearPlane() const {return nearPlane;}
205
//!get the camera's near clipping plane
206
inline float getFarPlane() const {return farPlane;}
208
//!Get the camera's FOV angle (full angle across)
209
inline float getFOV() const {return fovAngle;}
211
//!Ensure that the box is visible
212
/*! Face is set by cube net
217
3 is the face directed to the +ve x axis,
218
with the "up"" vector on the 3 aligned to z,
219
so "1" is perpendicular to the Z axis and is "visible"
221
virtual void ensureVisible(const BoundCube &b, unsigned int face=3);
223
//!Return the user-settable properties of the camera
224
void getProperties(CameraProperties &p) const;
226
//!Set the camera property from a key & string pair
227
bool setProperty(unsigned int key, const std::string &value);
229
//!Ensure that up direction is perpendicular to view direction
230
void recomputeUpDirection();
232
//!Write the state of the camera
233
bool writeState(std::ostream &f, unsigned int format, unsigned int tabs=0) const;
234
//!Read the state of the camera
235
bool readState(xmlNodePtr nodePtr) ;
237
//!Apply, restricting viewport to subresgion
238
virtual void apply(float outputRatio,const BoundCube &b,bool loadIdentity,
239
float leftRestrict,float rightRestrict,
240
float bottomRestrict, float topRestrict) const {ASSERT(false);};
243
//!A perspective camera that looks at a specific location
244
class CameraPerspLookAt : public CameraPerspective
247
//!Location for camera to look at
250
void recomputeViewDirection();
255
//!Streaming output operator, presents human readable text
256
friend std::ostream &operator<<(std::ostream &stream, const CameraPerspLookAt &);
258
Camera *clone() const;
260
virtual ~CameraPerspLookAt();
178
//!Streaming output operator, presents human readable text
179
friend std::ostream &operator<<(std::ostream &stream, const CameraLookAt &);
181
Camera *clone() const;
183
virtual ~CameraLookAt();
261
184
//!Set the look at target
262
185
void setOrigin(const Point3D &);
263
186
//!Set the look at target
264
187
void setTarget(const Point3D &);
265
188
//!Get the look at target
266
189
Point3D getTarget() const;
191
//!Get the camera's FOV angle (full angle across)
192
float getFOV() const {return fovAngle;}
267
194
//!Applies the view transform
268
195
void apply(float outAspect, const BoundCube &boundCube,bool loadIdentity=true) const;
310
241
virtual void apply(float outputRatio,const BoundCube &b,bool loadIdentity,
311
242
float leftRestrict,float rightRestrict,
312
243
float topRestrict, float bottomRestrict) const;
315
/*Follows a list of points
317
* Class contains some elementary constructions
322
vector<Point3D> cameraTrackPts;
323
//Optional track of target points
324
vector<Point3D> targetTrackPts;
245
float getViewWidth(float depth) const;
247
void setFrustumDistort(float offset){frustumDistortion=offset;};