33class EXPCL_PANDA_GRUTIL MovieTexture :
public Texture {
35 explicit MovieTexture(
const std::string &name);
36 explicit MovieTexture(MovieVideo *video);
37 MovieTexture(
const MovieTexture ©) =
delete;
38 virtual ~MovieTexture();
40 INLINE
double get_video_length()
const;
41 INLINE
int get_video_width()
const;
42 INLINE
int get_video_height()
const;
44 INLINE MovieVideoCursor *get_color_cursor(
int page);
45 INLINE MovieVideoCursor *get_alpha_cursor(
int page);
50 void set_time(
double t);
51 double get_time()
const;
52 void set_loop(
bool enable);
53 bool get_loop()
const;
54 void set_loop_count(
int count);
55 int get_loop_count()
const;
56 void set_play_rate(
double play_rate);
57 double get_play_rate()
const;
58 bool is_playing()
const;
59 void synchronize_to(AudioSound *sound);
63 MAKE_PROPERTY(video_length, get_video_length);
64 MAKE_PROPERTY(video_width, get_video_width);
65 MAKE_PROPERTY(video_height, get_video_height);
67 MAKE_PROPERTY(time, get_time, set_time);
68 MAKE_PROPERTY(loop, get_loop, set_loop);
69 MAKE_PROPERTY(loop_count, get_loop_count, set_loop_count);
70 MAKE_PROPERTY(play_rate, get_play_rate, set_play_rate);
71 MAKE_PROPERTY(playing, is_playing);
76 static PT(Texture) make_texture();
78 virtual bool cull_callback(CullTraverser *trav,
const CullTraverserData &data)
const;
83 virtual PT(Texture) make_copy_impl()
const;
84 void do_assign(CData *cdata, Texture::CData *cdata_tex,
const MovieTexture *copy,
85 const CData *cdata_copy,
const Texture::CData *cdata_copy_tex);
87 virtual void do_reload_ram_image(Texture::CData *cdata,
bool allow_compression);
89 virtual bool do_has_bam_rawdata(
const Texture::CData *cdata)
const;
90 virtual void do_get_bam_rawdata(Texture::CData *cdata);
91 virtual bool do_can_reload(
const Texture::CData *cdata)
const;
93 virtual bool do_adjust_this_size(
const Texture::CData *cdata,
94 int &x_size,
int &y_size,
const std::string &name,
95 bool for_padding)
const;
97 virtual bool do_read_one(Texture::CData *cdata,
98 const Filename &fullpath,
const Filename &alpha_fullpath,
99 int z,
int n,
int primary_file_num_channels,
int alpha_file_channel,
100 const LoaderOptions &options,
101 bool header_only, BamCacheRecord *record);
102 virtual bool do_load_one(Texture::CData *cdata,
103 const PNMImage &pnmimage,
const std::string &name,
104 int z,
int n,
const LoaderOptions &options);
105 virtual bool do_load_one(Texture::CData *cdata,
106 const PfmFile &pfm,
const std::string &name,
107 int z,
int n,
const LoaderOptions &options);
108 bool do_load_one(Texture::CData *cdata,
109 PT(MovieVideoCursor) color, PT(MovieVideoCursor) alpha,
110 int z,
const LoaderOptions &options);
111 virtual void do_allocate_pages(Texture::CData *cdata);
115 PT(MovieVideoCursor) _color;
116 PT(MovieVideoCursor) _alpha;
119 PT(MovieVideoCursor::Buffer) _cbuffer;
120 PT(MovieVideoCursor::Buffer) _abuffer;
123 typedef pvector<VideoPage> Pages;
125 class EXPCL_PANDA_GRUTIL CData :
public CycleData {
128 CData(
const CData ©);
129 virtual CycleData *make_copy()
const;
130 virtual TypeHandle get_parent_type()
const {
131 return MovieTexture::get_class_type();
137 double _video_length;
143 PT(AudioSound) _synchronize;
149 int _true_loop_count;
152 PipelineCycler<CData> _cycler;
153 typedef CycleDataReader<CData> CDReader;
154 typedef CycleDataWriter<CData> CDWriter;
156 void do_recalculate_image_properties(CData *cdata, Texture::CData *cdata_tex,
157 const LoaderOptions &options);
160 bool do_update_frames(
const CData *cdata)
const;
165 static TypedWritable *make_from_bam(
const FactoryParams ¶ms);
167 virtual void do_write_datagram_rawdata(Texture::CData *cdata, BamWriter *manager, Datagram &me);
168 virtual void do_fillin_rawdata(Texture::CData *cdata, DatagramIterator &scan, BamReader *manager);
170 virtual void finalize(BamReader *manager);
173 static TypeHandle get_class_type() {
176 static void init_type() {
177 Texture::init_type();
179 Texture::get_class_type());
181 virtual TypeHandle get_type()
const {
182 return get_class_type();
184 virtual TypeHandle force_init_type() {init_type();
return get_class_type();}
187 static TypeHandle _type_handle;
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
Represents a texture object, which is typically a single 2-d image but may also represent a 1-d or 3-...
virtual void ensure_loader_type(const Filename &filename)
May be called prior to calling read_txo() or any bam-related Texture- creating callback,...
get_keep_ram_image
Returns the flag that indicates whether this Texture is eligible to have its main RAM copy of the tex...
static void register_with_read_factory()
Factory method to generate a Texture object.
virtual void finalize(BamReader *manager)
Called by the BamReader to perform any final actions needed for setting up the object after all objec...
virtual bool has_cull_callback() const
Should be overridden by derived classes to return true if cull_callback() has been defined.
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...
virtual int complete_pointers(TypedWritable **p_list, BamReader *manager)
Receives an array of pointers, one for each time manager->read_pointer() was called in fillin().
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...