00001 // Filename: matrixLens.h 00002 // Created by: drose (12Dec01) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved 00008 // 00009 // All use of this software is subject to the terms of the Panda 3d 00010 // Software license. You should have received a copy of this license 00011 // along with this source code; you will also find a current copy of 00012 // the license at http://www.panda3d.org/license.txt . 00013 // 00014 // To contact the maintainers of this program write to 00015 // panda3d@yahoogroups.com . 00016 // 00017 //////////////////////////////////////////////////////////////////// 00018 00019 #ifndef MATRIXLENS_H 00020 #define MATRIXLENS_H 00021 00022 #include "pandabase.h" 00023 00024 #include "lens.h" 00025 00026 00027 //////////////////////////////////////////////////////////////////// 00028 // Class : MatrixLens 00029 // Description : A completely generic linear lens. This is provided 00030 // for the benefit low-level code that wants to specify 00031 // a perspective or orthographic frustum via an explicit 00032 // projection matrix, but not mess around with fov's or 00033 // focal lengths or any of that nonsense. 00034 //////////////////////////////////////////////////////////////////// 00035 class EXPCL_PANDA MatrixLens : public Lens { 00036 PUBLISHED: 00037 INLINE MatrixLens(); 00038 00039 public: 00040 INLINE MatrixLens(const MatrixLens ©); 00041 INLINE void operator = (const MatrixLens ©); 00042 00043 PUBLISHED: 00044 INLINE void set_user_mat(const LMatrix4f &user_mat); 00045 INLINE const LMatrix4f &get_user_mat() const; 00046 00047 public: 00048 virtual PT(Lens) make_copy() const; 00049 virtual bool is_linear() const; 00050 00051 virtual void write(ostream &out, int indent_level = 0) const; 00052 00053 protected: 00054 virtual void compute_projection_mat(); 00055 00056 private: 00057 LMatrix4f _user_mat; 00058 00059 public: 00060 virtual TypeHandle get_type() const { 00061 return get_class_type(); 00062 } 00063 virtual TypeHandle force_init_type() {init_type(); return get_class_type();} 00064 static TypeHandle get_class_type() { 00065 return _type_handle; 00066 } 00067 static void init_type() { 00068 Lens::init_type(); 00069 register_type(_type_handle, "MatrixLens", 00070 Lens::get_class_type()); 00071 } 00072 00073 private: 00074 static TypeHandle _type_handle; 00075 }; 00076 00077 #include "matrixLens.I" 00078 00079 #endif