00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef MATRIXLENS_H
00016 #define MATRIXLENS_H
00017
00018 #include "pandabase.h"
00019
00020 #include "lens.h"
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 class EXPCL_PANDA_GOBJ MatrixLens : public Lens {
00032 PUBLISHED:
00033 INLINE MatrixLens();
00034
00035 public:
00036 INLINE MatrixLens(const MatrixLens ©);
00037 INLINE void operator = (const MatrixLens ©);
00038
00039 PUBLISHED:
00040 INLINE void set_user_mat(const LMatrix4 &user_mat);
00041 INLINE const LMatrix4 &get_user_mat() const;
00042
00043 INLINE void set_left_eye_mat(const LMatrix4 &user_mat);
00044 INLINE void clear_left_eye_mat();
00045 INLINE bool has_left_eye_mat() const;
00046 INLINE const LMatrix4 &get_left_eye_mat() const;
00047
00048 INLINE void set_right_eye_mat(const LMatrix4 &user_mat);
00049 INLINE void clear_right_eye_mat();
00050 INLINE bool has_right_eye_mat() const;
00051 INLINE const LMatrix4 &get_right_eye_mat() const;
00052
00053 public:
00054 virtual PT(Lens) make_copy() const;
00055 virtual bool is_linear() const;
00056
00057 virtual void write(ostream &out, int indent_level = 0) const;
00058
00059 protected:
00060 virtual void do_compute_projection_mat(Lens::CData *lens_cdata);
00061
00062 private:
00063 LMatrix4 _user_mat;
00064 LMatrix4 _left_eye_mat;
00065 LMatrix4 _right_eye_mat;
00066
00067 enum MLFlags {
00068 MF_has_left_eye = 0x001,
00069 MF_has_right_eye = 0x002,
00070 };
00071 int _ml_flags;
00072
00073 public:
00074 static void register_with_read_factory();
00075
00076 protected:
00077 static TypedWritable *make_from_bam(const FactoryParams ¶ms);
00078
00079 public:
00080 virtual TypeHandle get_type() const {
00081 return get_class_type();
00082 }
00083 virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00084 static TypeHandle get_class_type() {
00085 return _type_handle;
00086 }
00087 static void init_type() {
00088 Lens::init_type();
00089 register_type(_type_handle, "MatrixLens",
00090 Lens::get_class_type());
00091 }
00092
00093 private:
00094 static TypeHandle _type_handle;
00095 };
00096
00097 #include "matrixLens.I"
00098
00099 #endif