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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
|
//-*-C++-*-
/*
**************************************************************************
description
--------------------
copyright : (C) 2000-2001 by Andreas Zehender
email : [email protected]
**************************************************************************
**************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
**************************************************************************/
#ifndef PMCAMERA_H
#define PMCAMERA_H
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "pmnamedobject.h"
#include "pmvector.h"
class PMViewStructure;
/**
* Class for povray cameras
*/
class PMCamera : public PMNamedObject
{
typedef PMNamedObject Base;
public:
/**
* Type of the camera
*/
enum CameraType { Perspective, Orthographic, FishEye, UltraWideAngle,
Omnimax, Panoramic, Cylinder };
/**
* Creates a default povray camera
*/
PMCamera( PMPart* part );
/**
* Copy constructor
*/
PMCamera( const PMCamera& c );
/**
* deletes the camera
*/
virtual ~PMCamera( );
/** */
virtual PMObject* copy( ) const { return new PMCamera( *this ); }
/** */
virtual TQString description( ) const;
/** */
virtual PMMetaObject* tqmetaObject( ) const;
/** */
virtual void serialize( TQDomElement& e, TQDomDocument& doc ) const;
/** */
virtual void readAttributes( const PMXMLHelper& h );
/**
* Returns a new @ref PMCameraEdit
*/
virtual PMDialogEditBase* editWidget( TQWidget* parent ) const;
/** */
virtual TQString pixmap( ) const { return TQString( "pmcamera" ); }
/**
* Returns the location
*/
PMVector location( ) const { return m_location; }
/**
* Sets the location
*/
void setLocation( const PMVector& p );
/**
* Returns the look_at point
*/
PMVector lookAt( ) const { return m_lookAt; }
/**
* Sets the look_at point
*/
void setLookAt( const PMVector& p );
/**
* Returns the up vector
*/
PMVector up( ) const { return m_up; }
/**
* Sets the up vector
*/
void setUp( const PMVector& v );
/**
* Returns the right vector
*/
PMVector right( ) const { return m_right; }
/**
* Sets the right vector
*/
void setRight( const PMVector& v );
/**
* Returns the direction vector
*/
PMVector direction( ) const { return m_direction; }
/**
* Sets the direction vector
*/
void setDirection( const PMVector& v );
/**
* Returns the sky vector
*/
PMVector sky( ) const { return m_sky; }
/**
* Sets the sky vector
*/
void setSky( const PMVector& v );
/**
* Returns the aspect ratio
*/
double aspect( ) const;
/**
* Returns true if angle is enabled
*/
bool isAngleEnabled( ) const { return m_angleEnabled; }
/**
* Enables/Disables the use of angle
*/
void enableAngle( bool yes );
/**
* Returns the angle
*/
double angle( ) const { return m_angle; }
/**
* Sets the angle
*/
void setAngle( double a );
/**
* Returns the camera type
*/
CameraType cameraType( ) const { return m_cameraType; }
/**
* Sets the camera type
*/
void setCameraType( CameraType t );
/**
* Returns the cylinder type
*/
int cylinderType( ) const { return m_cylinderType; }
/**
* Sets the cylinder type. Valid values are 1-4
*/
void setCylinderType( int t );
/**
* Returns true if focal blur is enabled
*/
bool isFocalBlurEnabled( ) const { return m_focalBlurEnabled; }
/**
* Enables/Disables the focal blur
*/
void enableFocalBlur( bool yes );
/**
* Returns the aperture
*/
double aperture( ) const { return m_aperture; }
/**
* Sets the aperture. Has to be greater or equal 0
*/
void setAperture( double d );
/**
* Returns the number of blur samples
*/
int blurSamples( ) const { return m_blurSamples; }
/**
* Sets the number of blur samples
*/
void setBlurSamples( int s );
/**
* Returns the focal point
*/
PMVector focalPoint( ) const { return m_focalPoint; }
/**
* Sets the focal point
*/
void setFocalPoint( const PMVector& v );
/**
* Returns the confidence
*/
double confidence( ) const { return m_confidence;}
/**
* Sets the confidence
*/
void setConfidence( double c );
/**
* Returns the variance
*/
double variance( ) const { return m_variance; }
/**
* Sets the variance
*/
void setVariance( double v );
/**
* Returns the export flag
*/
virtual bool exportPovray( ) const { return m_export; }
/**
* Sets the export flag
*/
void setExportPovray( bool ex );
/** */
virtual void restoreMemento( PMMemento* s );
/** */
virtual void controlPoints( PMControlPointList& list );
/** */
virtual void controlPointsChanged( PMControlPointList& list );
/**
* Calculates the new right, up and direction vector with the
* look_at vector.
*/
void calculateLookAtAngle( PMVector& right, PMVector& up, PMVector& direction );
/**
* Converts the camera type to a string
*/
static TQString cameraTypeToString( CameraType t );
/**
* Converts a string to the camera type
*/
static CameraType stringToCameraType( const TQString& s );
/** */
virtual void cleanUp( ) const;
protected:
/** */
virtual bool isDefault( ) { return false; }
/** */
virtual void createViewStructure( );
/** */
virtual PMViewStructure* defaultViewStructure( ) const;
private:
/**
* IDs for @ref PMMementoData
*/
enum PMCameraMementoID { PMLocationID, PMLookAtID, PMDirectionID,
PMUpID, PMRightID, PMAngleID, PMSkyID,
PMCameraTypeID, PMCylinderTypeID,
PMFocalBlurID, PMBlurSamplesID, PMFocalPointID,
PMConfidenceID, PMVarianceID, PMApertureID,
PMAngleEnabledID, PMExportID };
PMVector m_location, m_lookAt, m_up, m_right, m_direction, m_sky;
bool m_angleEnabled;
double m_angle;
CameraType m_cameraType;
int m_cylinderType;
bool m_focalBlurEnabled;
double m_aperture;
int m_blurSamples;
PMVector m_focalPoint;
double m_confidence, m_variance;
bool m_export;
/**
* The default view structure. It can be shared between cameras
*/
static PMViewStructure* s_pDefaultViewStructure;
static PMMetaObject* s_pMetaObject;
};
#endif
|