Panda3D
 All Classes Functions Variables Enumerations
videoTexture.h
1 // Filename: videoTexture.h
2 // Created by: drose (21Sep05)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #ifndef VIDEOTEXTURE_H
16 #define VIDEOTEXTURE_H
17 
18 #include "pandabase.h"
19 #include "texture.h"
20 #include "animInterface.h"
21 #include "clockObject.h"
22 
23 ////////////////////////////////////////////////////////////////////
24 // Class : VideoTexture
25 // Description : The base class for a family of animated Textures that
26 // take their input from a video source, such as a movie
27 // file. These Textures may be stopped, started,
28 // etc. using the AnimInterface controls, similar to an
29 // animated character.
30 ////////////////////////////////////////////////////////////////////
31 class EXPCL_PANDA_GOBJ VideoTexture : public Texture, public AnimInterface {
32 protected:
33  VideoTexture(const string &name);
34  VideoTexture(const VideoTexture &copy);
35 
36 PUBLISHED:
37  virtual bool get_keep_ram_image() const;
38 
39  INLINE int get_video_width() const;
40  INLINE int get_video_height() const;
41 
42 public:
43  virtual bool has_cull_callback() const;
44  virtual bool cull_callback(CullTraverser *trav, const CullTraverserData &data) const;
45 
46 protected:
47  void set_video_size(int video_width, int video_height);
48 
49  virtual bool do_has_ram_image(const Texture::CData *cdata) const;
50 
51  virtual void reconsider_dirty();
52  virtual Texture::CData *unlocked_ensure_ram_image(bool allow_compression);
53  virtual void do_reload_ram_image(Texture::CData *cdata, bool allow_compression);
54  virtual bool do_can_reload(const Texture::CData *cdata) const;
55 
56  virtual bool do_adjust_this_size(const Texture::CData *cdata,
57  int &x_size, int &y_size, const string &name,
58  bool for_padding) const;
59 
60  virtual void consider_update();
61  INLINE void clear_current_frame();
62  virtual void do_update_frame(Texture::CData *cdata_tex, int frame)=0;
63 
64 protected:
65  int _video_width;
66  int _video_height;
67  int _last_frame_update;
68  int _current_frame;
69 
70 public:
71  static TypeHandle get_class_type() {
72  return _type_handle;
73  }
74  static void init_type() {
75  Texture::init_type();
76  AnimInterface::init_type();
77  register_type(_type_handle, "VideoTexture",
78  Texture::get_class_type(),
79  AnimInterface::get_class_type());
80  }
81  virtual TypeHandle get_type() const {
82  return get_class_type();
83  }
84  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
85 
86 private:
87  static TypeHandle _type_handle;
88 };
89 
90 #include "videoTexture.I"
91 
92 #endif
virtual bool has_cull_callback() const
Should be overridden by derived classes to return true if cull_callback() has been defined...
Definition: texture.cxx:2354
Represents a texture object, which is typically a single 2-d image but may also represent a 1-d or 3-...
Definition: texture.h:75
This collects together the pieces of data that are accumulated for each node while walking the scene ...
virtual bool cull_callback(CullTraverser *trav, const CullTraverserData &data) const
If has_cull_callback() returns true, this function will be called during the cull traversal to perfor...
Definition: texture.cxx:2372
The base class for a family of animated Textures that take their input from a video source...
Definition: videoTexture.h:31
This is the fundamental interface for things that have a play/loop/stop type interface for frame-base...
Definition: animInterface.h:39
virtual bool get_keep_ram_image() const
Returns the flag that indicates whether this Texture is eligible to have its main RAM copy of the tex...
Definition: texture.cxx:957
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85
This object performs a depth-first traversal of the scene graph, with optional view-frustum culling...
Definition: cullTraverser.h:48