14 #ifndef SAMPLERSTATE_H 15 #define SAMPLERSTATE_H 50 FT_nearest_mipmap_nearest,
53 FT_linear_mipmap_nearest,
56 FT_nearest_mipmap_linear,
60 FT_linear_mipmap_linear,
87 INLINE
void set_wrap_u(WrapMode wrap);
88 INLINE
void set_wrap_v(WrapMode wrap);
89 INLINE
void set_wrap_w(WrapMode wrap);
90 INLINE
void set_minfilter(FilterType filter);
91 INLINE
void set_magfilter(FilterType filter);
92 INLINE
void set_anisotropic_degree(
int anisotropic_degree);
93 INLINE
void set_border_color(
const LColor &color);
94 INLINE
void set_min_lod(PN_stdfloat min_lod);
95 INLINE
void set_max_lod(PN_stdfloat max_lod);
96 INLINE
void set_lod_bias(PN_stdfloat lod_bias);
98 INLINE WrapMode get_wrap_u()
const;
99 INLINE WrapMode get_wrap_v()
const;
100 INLINE WrapMode get_wrap_w()
const;
101 INLINE FilterType get_minfilter()
const;
102 INLINE FilterType get_magfilter()
const;
103 FilterType get_effective_minfilter()
const;
104 FilterType get_effective_magfilter()
const;
105 INLINE
int get_anisotropic_degree()
const;
106 INLINE
int get_effective_anisotropic_degree()
const;
107 INLINE
const LColor &get_border_color()
const;
108 INLINE PN_stdfloat get_min_lod()
const;
109 INLINE PN_stdfloat get_max_lod()
const;
110 INLINE PN_stdfloat get_lod_bias()
const;
112 MAKE_PROPERTY(wrap_u, get_wrap_u, set_wrap_u);
113 MAKE_PROPERTY(wrap_v, get_wrap_v, set_wrap_v);
114 MAKE_PROPERTY(wrap_w, get_wrap_w, set_wrap_w);
115 MAKE_PROPERTY(minfilter, get_minfilter, set_minfilter);
116 MAKE_PROPERTY(magfilter, get_magfilter, set_magfilter);
117 MAKE_PROPERTY(effective_minfilter, get_effective_minfilter);
118 MAKE_PROPERTY(effective_magfilter, get_effective_magfilter);
119 MAKE_PROPERTY(anisotropic_degree, get_anisotropic_degree, set_anisotropic_degree);
120 MAKE_PROPERTY(effective_anisotropic_degree, get_effective_anisotropic_degree);
121 MAKE_PROPERTY(border_color, get_border_color, set_border_color);
122 MAKE_PROPERTY(min_lod, get_min_lod, set_min_lod);
123 MAKE_PROPERTY(max_lod, get_max_lod, set_max_lod);
124 MAKE_PROPERTY(lod_bias, get_lod_bias, set_lod_bias);
126 INLINE
bool uses_mipmaps()
const;
127 INLINE
static bool is_mipmap(FilterType type);
129 static std::string format_filter_type(FilterType ft);
130 static FilterType string_filter_type(
const std::string &str);
132 static std::string format_wrap_mode(WrapMode wm);
133 static WrapMode string_wrap_mode(
const std::string &str);
135 INLINE
bool operator == (
const SamplerState &other)
const;
136 INLINE
bool operator != (
const SamplerState &other)
const;
137 INLINE
bool operator < (
const SamplerState &other)
const;
149 void output(std::ostream &out)
const;
150 void write(std::ostream &out,
int indent)
const;
153 LColor _border_color;
154 PN_stdfloat _min_lod;
155 PN_stdfloat _max_lod;
156 PN_stdfloat _lod_bias;
161 FilterType _minfilter : 4;
162 FilterType _magfilter : 4;
163 WrapMode _wrap_u : 4;
164 WrapMode _wrap_v : 4;
165 WrapMode _wrap_w : 4;
166 int _anisotropic_degree : 12;
171 void write_datagram(
Datagram &destination)
const;
178 static void init_type() {
181 TypedObject::get_class_type());
197 INLINE std::ostream &operator << (std::ostream &out,
const SamplerState &m) {
202 INLINE std::ostream &operator << (std::ostream &out, SamplerState::FilterType ft) {
206 INLINE std::istream &operator >> (std::istream &in, SamplerState::FilterType &ft) {
213 INLINE std::ostream &operator << (std::ostream &out, SamplerState::WrapMode wm) {
217 INLINE std::istream &operator >> (std::istream &in, SamplerState::WrapMode &wm) {
static WrapMode string_wrap_mode(const std::string &str)
Returns the WrapMode value associated with the given string representation, or WM_invalid if the stri...
static void init_type()
This function is declared non-inline to work around a compiler bug in g++ 2.96.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
static std::string format_wrap_mode(WrapMode wm)
Returns the indicated WrapMode converted to a string word.
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
static std::string format_filter_type(FilterType ft)
Returns the indicated FilterType converted to a string word.
A table of objects that are saved within the graphics context for reference by handle later.
static FilterType string_filter_type(const std::string &str)
Returns the FilterType value associated with the given string representation, or FT_invalid if the st...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
std::ostream & indent(std::ostream &out, int indent_level)
A handy function for doing text formatting.
An instance of this class is passed to the Factory when requesting it to do its business and construc...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This class specializes ConfigVariable as an enumerated type.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
Represents a set of settings that indicate how a texture is sampled.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is a special class object that holds a handle to the sampler state object given by the graphics ...
An STL function object class, this is intended to be used on any ordered collection of class objects ...
This is a base class for the GraphicsStateGuardian class, which is itself a base class for the variou...
This is a convenience class to specialize ConfigVariable as an integer type.
A class to retrieve the individual data elements previously stored in a Datagram.
TypeHandle is the identifier used to differentiate C++ class types.
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...