00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 INLINE bool Lens::
00032 extrude(const LPoint2f &point2d, LPoint3f &near_point, LPoint3f &far_point) const {
00033 return extrude_impl(LPoint3f(point2d[0], point2d[1], 0.0f),
00034 near_point, far_point);
00035 }
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054 INLINE bool Lens::
00055 extrude(const LPoint3f &point2d, LPoint3f &near_point, LPoint3f &far_point) const {
00056 return extrude_impl(point2d, near_point, far_point);
00057 }
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077 INLINE bool Lens::
00078 extrude_vec(const LPoint2f &point2d, LVector3f &vec) const {
00079 return extrude_vec_impl(LPoint3f(point2d[0], point2d[1], 0.0f), vec);
00080 }
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102 INLINE bool Lens::
00103 extrude_vec(const LPoint3f &point2d, LVector3f &vec) const {
00104 return extrude_vec_impl(point2d, vec);
00105 }
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121 INLINE bool Lens::
00122 project(const LPoint3f &point3d, LPoint2f &point2d) const {
00123 LPoint3f result;
00124 bool okflag = project_impl(point3d, result);
00125 point2d.set(result[0], result[1]);
00126 return okflag;
00127 }
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147 INLINE bool Lens::
00148 project(const LPoint3f &point3d, LPoint3f &point2d) const {
00149 return project_impl(point3d, point2d);
00150 }
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164 INLINE void Lens::
00165 set_change_event(const string &event) {
00166 _change_event = event;
00167 }
00168
00169
00170
00171
00172
00173
00174
00175
00176 INLINE const string &Lens::
00177 get_change_event() const {
00178 return _change_event;
00179 }
00180
00181
00182
00183
00184
00185
00186
00187
00188 INLINE CoordinateSystem Lens::
00189 get_coordinate_system() const {
00190 return _cs;
00191 }
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210
00211
00212
00213
00214 INLINE void Lens::
00215 set_film_size(float width, float height) {
00216 set_film_size(LVecBase2f(width, height));
00217 }
00218
00219
00220
00221
00222
00223
00224
00225
00226
00227
00228 INLINE void Lens::
00229 set_film_offset(float x, float y) {
00230 set_film_offset(LVecBase2f(x, y));
00231 }
00232
00233
00234
00235
00236
00237
00238
00239
00240
00241
00242 INLINE void Lens::
00243 set_film_offset(const LVecBase2f &film_offset) {
00244 _film_offset = film_offset;
00245 adjust_comp_flags(CF_mat, 0);
00246 throw_change_event();
00247 }
00248
00249
00250
00251
00252
00253
00254
00255 INLINE const LVector2f &Lens::
00256 get_film_offset() const {
00257 return _film_offset;
00258 }
00259
00260
00261
00262
00263
00264
00265
00266
00267
00268
00269
00270
00271
00272 INLINE void Lens::
00273 set_fov(float hfov, float vfov) {
00274 set_fov(LVecBase2f(hfov, vfov));
00275 }
00276
00277
00278
00279
00280
00281
00282
00283 INLINE float Lens::
00284 get_hfov() const {
00285 return get_fov()[0];
00286 }
00287
00288
00289
00290
00291
00292
00293
00294 INLINE float Lens::
00295 get_vfov() const {
00296 return get_fov()[1];
00297 }
00298
00299
00300
00301
00302
00303
00304
00305
00306 INLINE void Lens::
00307 set_near(float near_distance) {
00308 _near_distance = near_distance;
00309 adjust_comp_flags(CF_projection_mat | CF_projection_mat_inv, 0);
00310 throw_change_event();
00311 }
00312
00313
00314
00315
00316
00317
00318
00319 INLINE float Lens::
00320 get_near() const {
00321 return _near_distance;
00322 }
00323
00324
00325
00326
00327
00328
00329
00330
00331 INLINE void Lens::
00332 set_far(float far_distance) {
00333 _far_distance = far_distance;
00334 adjust_comp_flags(CF_projection_mat | CF_projection_mat_inv, 0);
00335 throw_change_event();
00336 }
00337
00338
00339
00340
00341
00342
00343
00344 INLINE float Lens::
00345 get_far() const {
00346 return _far_distance;
00347 }
00348
00349
00350
00351
00352
00353
00354 INLINE void Lens::
00355 set_near_far(float near_distance, float far_distance) {
00356 _near_distance = near_distance;
00357 _far_distance = far_distance;
00358 adjust_comp_flags(CF_projection_mat | CF_projection_mat_inv, 0);
00359 throw_change_event();
00360 }
00361
00362
00363
00364
00365
00366
00367
00368
00369
00370
00371
00372 INLINE void Lens::
00373 set_view_hpr(float h, float p, float r) {
00374 set_view_hpr(LVecBase3f(h, p, r));
00375 }
00376
00377
00378
00379
00380
00381
00382
00383
00384
00385 INLINE void Lens::
00386 set_view_vector(float x, float y, float z, float i, float j, float k) {
00387 set_view_vector(LVector3f(x, y, z), LVector3f(i, j, k));
00388 }
00389
00390
00391
00392
00393
00394
00395
00396 INLINE const LVecBase2f &Lens::
00397 get_keystone() const {
00398 return _keystone;
00399 }
00400
00401
00402
00403
00404
00405
00406
00407
00408
00409 INLINE const UpdateSeq &Lens::
00410 get_last_change() const {
00411 return _last_change;
00412 }
00413
00414
00415
00416
00417
00418
00419
00420 INLINE void Lens::
00421 adjust_user_flags(int clear_flags, int set_flags) {
00422 _user_flags = (_user_flags & ~clear_flags) | set_flags;
00423 }
00424
00425
00426
00427
00428
00429
00430
00431 INLINE void Lens::
00432 adjust_comp_flags(int clear_flags, int set_flags) {
00433 _comp_flags = (_comp_flags & ~clear_flags) | set_flags;
00434 }
00435
00436 INLINE ostream &
00437 operator << (ostream &out, const Lens &lens) {
00438 lens.output(out);
00439 return out;
00440 }
00441