Panda3D

videoTexture.h

00001 // Filename: videoTexture.h
00002 // Created by:  drose (21Sep05)
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 VIDEOTEXTURE_H
00016 #define VIDEOTEXTURE_H
00017 
00018 #include "pandabase.h"
00019 #include "texture.h"
00020 #include "animInterface.h"
00021 #include "clockObject.h"
00022 
00023 ////////////////////////////////////////////////////////////////////
00024 //       Class : VideoTexture
00025 // Description : The base class for a family of animated Textures that
00026 //               take their input from a video source, such as a movie
00027 //               file.  These Textures may be stopped, started,
00028 //               etc. using the AnimInterface controls, similar to an
00029 //               animated character.
00030 ////////////////////////////////////////////////////////////////////
00031 class EXPCL_PANDA_GOBJ VideoTexture : public Texture, public AnimInterface {
00032 protected:
00033   VideoTexture(const string &name);
00034   VideoTexture(const VideoTexture &copy);
00035 
00036 PUBLISHED:
00037   virtual bool get_keep_ram_image() const;
00038 
00039   INLINE int get_video_width() const;
00040   INLINE int get_video_height() const;
00041 
00042 public:
00043   virtual bool has_cull_callback() const;
00044   virtual bool cull_callback(CullTraverser *trav, const CullTraverserData &data) const;
00045 
00046 protected:
00047   void set_video_size(int video_width, int video_height);
00048 
00049   virtual bool do_has_ram_image(const Texture::CData *cdata) const;
00050 
00051   virtual void reconsider_dirty();
00052   virtual Texture::CData *unlocked_ensure_ram_image(bool allow_compression);
00053   virtual void do_reload_ram_image(Texture::CData *cdata, bool allow_compression);
00054   virtual bool do_can_reload(const Texture::CData *cdata) const;
00055 
00056   virtual bool do_adjust_this_size(const Texture::CData *cdata, 
00057                                    int &x_size, int &y_size, const string &name, 
00058                                    bool for_padding) const;
00059 
00060   virtual void consider_update();
00061   INLINE void clear_current_frame();
00062   virtual void do_update_frame(Texture::CData *cdata_tex, int frame)=0;
00063 
00064 protected:
00065   int _video_width;
00066   int _video_height;
00067   int _last_frame_update;
00068   int _current_frame;
00069 
00070 public:
00071   static TypeHandle get_class_type() {
00072     return _type_handle;
00073   }
00074   static void init_type() {
00075     Texture::init_type();
00076     AnimInterface::init_type();
00077     register_type(_type_handle, "VideoTexture",
00078                   Texture::get_class_type(),
00079                   AnimInterface::get_class_type());
00080   }
00081   virtual TypeHandle get_type() const {
00082     return get_class_type();
00083   }
00084   virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00085 
00086 private:
00087   static TypeHandle _type_handle;
00088 };
00089 
00090 #include "videoTexture.I"
00091 
00092 #endif
 All Classes Functions Variables Enumerations