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   INLINE LVecBase2f get_tex_scale() const;
00042 
00043 public:
00044   virtual bool has_cull_callback() const;
00045   virtual bool cull_callback(CullTraverser *trav, const CullTraverserData &data) const;
00046 
00047 protected:
00048   INLINE void set_video_size(int video_width, int video_height);
00049 
00050   virtual bool do_has_ram_image() const;
00051 
00052   virtual void reconsider_dirty();
00053   virtual void do_reload_ram_image();
00054 
00055   virtual INLINE void consider_update();
00056   INLINE void clear_current_frame();
00057   virtual void update_frame(int frame)=0;
00058 
00059 protected:
00060   int _video_width;
00061   int _video_height;
00062   int _last_frame_update;
00063   int _current_frame;
00064 
00065 public:
00066   static TypeHandle get_class_type() {
00067     return _type_handle;
00068   }
00069   static void init_type() {
00070     Texture::init_type();
00071     AnimInterface::init_type();
00072     register_type(_type_handle, "VideoTexture",
00073                   Texture::get_class_type(),
00074                   AnimInterface::get_class_type());
00075   }
00076   virtual TypeHandle get_type() const {
00077     return get_class_type();
00078   }
00079   virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00080 
00081 private:
00082   static TypeHandle _type_handle;
00083 };
00084 
00085 #include "videoTexture.I"
00086 
00087 #endif
 All Classes Functions Variables Enumerations