diff --git a/panda/src/grutil/cardMaker.cxx b/panda/src/grutil/cardMaker.cxx index d0aec3378e..58c2b9302e 100644 --- a/panda/src/grutil/cardMaker.cxx +++ b/panda/src/grutil/cardMaker.cxx @@ -260,12 +260,16 @@ set_uv_range_cube(int face) { // Function: CardMaker::set_uv_range // Access: Public // 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:: -set_uv_range(const MovieTexture *movie) { - double maxu = (movie->get_video_width()*1.0) / movie->get_x_size(); - double maxv = (movie->get_video_height()*1.0) / movie->get_y_size(); +set_uv_range(const Texture *tex) { + nassertv(tex->get_texture_type() == Texture::TT_2d_texture); + 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)); } diff --git a/panda/src/grutil/cardMaker.h b/panda/src/grutil/cardMaker.h index 2086c49b1d..b28e45d8b1 100644 --- a/panda/src/grutil/cardMaker.h +++ b/panda/src/grutil/cardMaker.h @@ -25,7 +25,7 @@ #include "pandaNode.h" #include "pointerTo.h" #include "namable.h" -#include "movieTexture.h" +#include "texture.h" //////////////////////////////////////////////////////////////////// // 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 LVector4f &x, const LVector4f &y, const LVector4f &z); 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_3d_uvs(bool flag);