Panda3D
|
00001 // Filename: perspectiveLens.h 00002 // Created by: drose (18Feb99) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 #ifndef PERSPECTIVELENS_H 00016 #define PERSPECTIVELENS_H 00017 00018 #include "pandabase.h" 00019 00020 #include "lens.h" 00021 00022 00023 //////////////////////////////////////////////////////////////////// 00024 // Class : PerspectiveLens 00025 // Description : A perspective-type lens: a normal camera. 00026 //////////////////////////////////////////////////////////////////// 00027 class EXPCL_PANDA_GOBJ PerspectiveLens : public Lens { 00028 PUBLISHED: 00029 INLINE PerspectiveLens(); 00030 INLINE PerspectiveLens(PN_stdfloat hfov, PN_stdfloat vfov); 00031 00032 public: 00033 INLINE PerspectiveLens(const PerspectiveLens ©); 00034 INLINE void operator = (const PerspectiveLens ©); 00035 00036 public: 00037 virtual PT(Lens) make_copy() const; 00038 virtual bool is_linear() const; 00039 virtual bool is_perspective() const; 00040 00041 protected: 00042 virtual void do_compute_projection_mat(Lens::CData *lens_cdata); 00043 00044 virtual PN_stdfloat fov_to_film(PN_stdfloat fov, PN_stdfloat focal_length, bool horiz) const; 00045 virtual PN_stdfloat fov_to_focal_length(PN_stdfloat fov, PN_stdfloat film_size, bool horiz) const; 00046 virtual PN_stdfloat film_to_fov(PN_stdfloat film_size, PN_stdfloat focal_length, bool horiz) const; 00047 00048 public: 00049 static void register_with_read_factory(); 00050 00051 protected: 00052 static TypedWritable *make_from_bam(const FactoryParams ¶ms); 00053 00054 public: 00055 virtual TypeHandle get_type() const { 00056 return get_class_type(); 00057 } 00058 virtual TypeHandle force_init_type() {init_type(); return get_class_type();} 00059 static TypeHandle get_class_type() { 00060 return _type_handle; 00061 } 00062 static void init_type() { 00063 Lens::init_type(); 00064 register_type(_type_handle, "PerspectiveLens", 00065 Lens::get_class_type()); 00066 } 00067 00068 private: 00069 static TypeHandle _type_handle; 00070 }; 00071 00072 #include "perspectiveLens.I" 00073 00074 #endif