Added support for pad regions

This commit is contained in:
Josh Yelon 2007-10-26 21:56:43 +00:00
parent 662491fb7f
commit e32bf5cbf3
2 changed files with 10 additions and 6 deletions

View File

@ -260,12 +260,16 @@ set_uv_range_cube(int face) {
// Function: CardMaker::set_uv_range // Function: CardMaker::set_uv_range
// Access: Public // Access: Public
// Description: Sets the range of UV's that will be applied to the // Description: Sets the range of UV's that will be applied to the
// vertices appropriately to play a specified Movie. // vertices appropriately to show the non-pad region
// of the texture.
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
void CardMaker:: void CardMaker::
set_uv_range(const MovieTexture *movie) { set_uv_range(const Texture *tex) {
double maxu = (movie->get_video_width()*1.0) / movie->get_x_size(); nassertv(tex->get_texture_type() == Texture::TT_2d_texture);
double maxv = (movie->get_video_height()*1.0) / movie->get_y_size(); int nonpadx = tex->get_x_size() - tex->get_pad_x_size();
int nonpady = tex->get_y_size() - tex->get_pad_y_size();
double maxu = (nonpadx*1.0) / tex->get_x_size();
double maxv = (nonpady*1.0) / tex->get_y_size();
set_uv_range(TexCoordf(0.0,0.0), TexCoordf(maxu,maxv)); set_uv_range(TexCoordf(0.0,0.0), TexCoordf(maxu,maxv));
} }

View File

@ -25,7 +25,7 @@
#include "pandaNode.h" #include "pandaNode.h"
#include "pointerTo.h" #include "pointerTo.h"
#include "namable.h" #include "namable.h"
#include "movieTexture.h" #include "texture.h"
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
// Class : CardMaker // Class : CardMaker
@ -44,7 +44,7 @@ PUBLISHED:
void set_uv_range(const TexCoord3f &ll, const TexCoord3f &lr, const TexCoord3f &ur, const TexCoord3f &ul); void set_uv_range(const TexCoord3f &ll, const TexCoord3f &lr, const TexCoord3f &ur, const TexCoord3f &ul);
void set_uv_range(const LVector4f &x, const LVector4f &y, const LVector4f &z); void set_uv_range(const LVector4f &x, const LVector4f &y, const LVector4f &z);
void set_uv_range_cube(int face); void set_uv_range_cube(int face);
void set_uv_range(const MovieTexture *frame); void set_uv_range(const Texture *tex);
INLINE void set_has_uvs(bool flag); INLINE void set_has_uvs(bool flag);
INLINE void set_has_3d_uvs(bool flag); INLINE void set_has_3d_uvs(bool flag);