Panda3D
|
The base class for a family of animated Textures that take their input from a video source, such as a movie file. More...
#include "videoTexture.h"
Public Member Functions | |
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 perform any additional operations that should be performed at cull time. | |
virtual TypeHandle | force_init_type () |
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 texture memory dumped when the texture is prepared for rendering. | |
LVecBase2f | get_tex_scale () const |
Returns a scale pair that is suitable for applying to geometry via NodePath::set_tex_scale(), which will convert texture coordinates on the geometry from the range 0..1 into the appropriate range to render the video part of the texture. | |
virtual TypeHandle | get_type () const |
int | get_video_height () const |
Returns the height in texels of the source video stream. | |
int | get_video_width () const |
Returns the width in texels of the source video stream. | |
virtual bool | has_cull_callback () const |
Should be overridden by derived classes to return true if cull_callback() has been defined. | |
Static Public Member Functions | |
static TypeHandle | get_class_type () |
static void | init_type () |
Protected Member Functions | |
VideoTexture (const string &name) | |
VideoTexture (const VideoTexture ©) | |
void | clear_current_frame () |
Resets the record of the current frame so that it will be forced to reload the next time it is requested. | |
virtual void | consider_update () |
Calls update_frame() if the current frame has changed. | |
virtual bool | do_has_ram_image () const |
Returns true if the Texture has its image contents available in main RAM, false if it exists only in texture memory or in the prepared GSG context. | |
virtual void | do_reload_ram_image () |
Called when the Texture image is required but the ram image is not available, this will reload it from disk or otherwise do whatever is required to make it available, if possible. | |
virtual void | reconsider_dirty () |
Called by TextureContext to give the Texture a chance to mark itself dirty before rendering, if necessary. | |
void | set_video_size (int video_width, int video_height) |
Should be called by a derived class to set the size of the video when it is loaded. | |
virtual void | update_frame (int frame)=0 |
Protected Attributes | |
int | _current_frame |
int | _last_frame_update |
int | _video_height |
int | _video_width |
The base class for a family of animated Textures that take their input from a video source, such as a movie file.
These Textures may be stopped, started, etc. using the AnimInterface controls, similar to an animated character.
Definition at line 31 of file videoTexture.h.
void VideoTexture::clear_current_frame | ( | ) | [inline, protected] |
Resets the record of the current frame so that it will be forced to reload the next time it is requested.
Definition at line 108 of file videoTexture.I.
void VideoTexture::consider_update | ( | ) | [inline, protected, virtual] |
Calls update_frame() if the current frame has changed.
Definition at line 88 of file videoTexture.I.
References AnimInterface::get_frame(), ClockObject::get_frame_count(), and ClockObject::get_global_clock().
Referenced by do_reload_ram_image(), and reconsider_dirty().
bool VideoTexture::cull_callback | ( | CullTraverser * | trav, |
const CullTraverserData & | data | ||
) | const [virtual] |
If has_cull_callback() returns true, this function will be called during the cull traversal to perform any additional operations that should be performed at cull time.
This is called each time the Texture is discovered applied to a Geom in the traversal. It should return true if the Geom is visible, false if it should be omitted.
Reimplemented from Texture.
Definition at line 100 of file videoTexture.cxx.
bool VideoTexture::do_has_ram_image | ( | ) | const [protected, virtual] |
Returns true if the Texture has its image contents available in main RAM, false if it exists only in texture memory or in the prepared GSG context.
Reimplemented from Texture.
Definition at line 118 of file videoTexture.cxx.
References ClockObject::get_frame_count(), and ClockObject::get_global_clock().
void VideoTexture::do_reload_ram_image | ( | ) | [protected, virtual] |
Called when the Texture image is required but the ram image is not available, this will reload it from disk or otherwise do whatever is required to make it available, if possible.
Definition at line 146 of file videoTexture.cxx.
References consider_update().
bool VideoTexture::get_keep_ram_image | ( | ) | const [virtual] |
Returns the flag that indicates whether this Texture is eligible to have its main RAM copy of the texture memory dumped when the texture is prepared for rendering.
See set_keep_ram_image().
Reimplemented from Texture.
Definition at line 67 of file videoTexture.cxx.
LVecBase2f VideoTexture::get_tex_scale | ( | ) | const [inline] |
Returns a scale pair that is suitable for applying to geometry via NodePath::set_tex_scale(), which will convert texture coordinates on the geometry from the range 0..1 into the appropriate range to render the video part of the texture.
This is necessary in the event the video source is not a power of two and set_power_2() is true. In this case, the video image will be mapped to the lower-left corner of the texture, and the rest of the texture space will be unused; so we will need to remap any texture coordinates to fill the space correctly.
Definition at line 60 of file videoTexture.I.
int VideoTexture::get_video_height | ( | ) | const [inline] |
Returns the height in texels of the source video stream.
This is not necessarily the height of the actual texture, since the texture may have been expanded to raise it to a power of 2.
Definition at line 38 of file videoTexture.I.
int VideoTexture::get_video_width | ( | ) | const [inline] |
Returns the width in texels of the source video stream.
This is not necessarily the width of the actual texture, since the texture may have been expanded to raise it to a power of 2.
Definition at line 25 of file videoTexture.I.
bool VideoTexture::has_cull_callback | ( | ) | const [virtual] |
Should be overridden by derived classes to return true if cull_callback() has been defined.
Otherwise, returns false to indicate cull_callback() does not need to be called for this node during the cull traversal.
Reimplemented from Texture.
Definition at line 82 of file videoTexture.cxx.
void VideoTexture::reconsider_dirty | ( | ) | [protected, virtual] |
Called by TextureContext to give the Texture a chance to mark itself dirty before rendering, if necessary.
Reimplemented from Texture.
Definition at line 133 of file videoTexture.cxx.
References consider_update().
void VideoTexture::set_video_size | ( | int | video_width, |
int | video_height | ||
) | [inline, protected] |
Should be called by a derived class to set the size of the video when it is loaded.
Definition at line 76 of file videoTexture.I.