add more wrapmodes

This commit is contained in:
cxgeorge 2002-02-28 01:12:48 +00:00
parent 99e52ff3c9
commit 05363c5b35
2 changed files with 23 additions and 2 deletions

View File

@ -126,6 +126,7 @@ Texture() : ImageBuffer() {
_pbuffer = new PixelBuffer;
_has_requested_size = false;
_all_dirty_flags = 0;
memset(&_border_color,0,sizeof(Colorf));
}
////////////////////////////////////////////////////////////////////
@ -298,6 +299,16 @@ set_anisotropic_degree(int anisotropic_degree) {
}
}
////////////////////////////////////////////////////////////////////
// Function: set_border_color
// Access: Published
// Description:
////////////////////////////////////////////////////////////////////
void Texture::
set_border_color(const Colorf &color) {
memcpy(&_border_color,&color,sizeof(Colorf));
}
////////////////////////////////////////////////////////////////////
// Function: load
// Access: Public
@ -552,6 +563,12 @@ string_wrap_mode(const string &string) {
return WM_repeat;
} else if (cmp_nocase_uh(string, "clamp") == 0) {
return WM_clamp;
} else if (cmp_nocase_uh(string, "mirror") == 0) {
return WM_clamp;
} else if (cmp_nocase_uh(string, "mirror_once") == 0) {
return WM_clamp;
} else if (cmp_nocase_uh(string, "border_color") == 0) {
return WM_border_color;
} else {
return WM_invalid;
}

View File

@ -70,9 +70,11 @@ PUBLISHED:
};
enum WrapMode {
WM_clamp,
WM_clamp, // coords that would be outside [0-1] are clamped to 0 or 1
WM_repeat,
WM_mirror,
WM_mirror_once, // mirror once, then clamp
WM_border_color, // coords outside [0-1] use explict border color
// Returned by string_wrap_mode() for an invalid match.
WM_invalid
};
@ -90,6 +92,7 @@ PUBLISHED:
void set_minfilter(FilterType filter);
void set_magfilter(FilterType filter);
void set_anisotropic_degree(int anisotropic_degree);
void set_border_color(const Colorf &color);
INLINE WrapMode get_wrapu() const;
INLINE WrapMode get_wrapv() const;
@ -146,6 +149,7 @@ private:
FilterType _magfilter;
int _anisotropic_degree;
bool _keep_ram_image;
Colorf _border_color;
// A Texture keeps a list (actually, a map) of all the GSG's that it
// has been prepared into. Each GSG conversely keeps a list (a set)