15 #include "pandabase.h"
17 #include "videoTexture.h"
18 #include "clockObject.h"
19 #include "config_gobj.h"
29 VideoTexture(
const string &name) :
34 cdata->_compression = CM_off;
39 _last_frame_update = 0;
52 _video_width(copy._video_width),
53 _video_height(copy._video_height),
54 _last_frame_update(copy._last_frame_update),
55 _current_frame(copy._current_frame)
119 set_video_size(
int video_width,
int video_height) {
120 _video_width = video_width;
121 _video_height = video_height;
125 do_set_pad_size(cdata,
126 max(cdata->_x_size - _video_width, 0),
127 max(cdata->_y_size - _video_height, 0),
139 do_has_ram_image(
const Texture::CData *cdata)
const {
141 if (this_frame != _last_frame_update) {
144 return !cdata->_ram_images.empty() && !cdata->_ram_images[0]._image.empty();
179 Texture::CData *VideoTexture::
180 unlocked_ensure_ram_image(
bool allow_compression) {
184 Texture::CData *cdata = Texture::_cycler.
write_upstream(
false, current_thread);
197 do_reload_ram_image(Texture::CData *cdata,
bool) {
211 do_can_reload(
const Texture::CData *cdata)
const {
223 do_adjust_this_size(
const Texture::CData *cdata_tex,
224 int &x_size,
int &y_size,
const string &name,
225 bool for_padding)
const {
226 AutoTextureScale ats = do_get_auto_texture_scale(cdata_tex);
227 if (ats != ATS_none) {
231 return adjust_size(x_size, y_size, name, for_padding, ats);
243 if (this_frame != _last_frame_update) {
245 if (_current_frame != frame) {
247 do_update_frame(cdata, frame);
248 _current_frame = frame;
250 _last_frame_update = this_frame;
static ClockObject * get_global_clock()
Returns a pointer to the global ClockObject.
static bool adjust_size(int &x_size, int &y_size, const string &name, bool for_padding, AutoTextureScale auto_texture_scale=ATS_unspecified)
Computes the proper size of the texture, based on the original size, the filename, and the resizing whims of the config file.
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...
Represents a texture object, which is typically a single 2-d image but may also represent a 1-d or 3-...
void set_orig_file_size(int x, int y, int z=1)
Specifies the size of the texture as it exists in its original disk file, before any Panda scaling...
This collects together the pieces of data that are accumulated for each node while walking the scene ...
The base class for a family of animated Textures that take their input from a video source...
This is the fundamental interface for things that have a play/loop/stop type interface for frame-base...
static Thread * get_current_thread()
Returns a pointer to the currently-executing Thread object.
int get_frame() const
Returns the current integer frame number.
int get_frame_count(Thread *current_thread=Thread::get_current_thread()) const
Returns the number of times tick() has been called since the ClockObject was created, or since it was last reset.
This template class calls PipelineCycler::write() in the constructor and PipelineCycler::release_writ...
A thread; that is, a lightweight process.
CycleDataType * write_upstream(bool force_to_0, Thread *current_thread)
See PipelineCyclerBase::write_upstream().
TypeHandle is the identifier used to differentiate C++ class types.
This object performs a depth-first traversal of the scene graph, with optional view-frustum culling...
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...