15 #ifndef SAMPLERSTATE_H
16 #define SAMPLERSTATE_H
18 #include "pandabase.h"
20 #include "typedObject.h"
23 #include "numeric_types.h"
24 #include "bamReader.h"
25 #include "config_gobj.h"
53 FT_nearest_mipmap_nearest,
56 FT_linear_mipmap_nearest,
59 FT_nearest_mipmap_linear,
63 FT_linear_mipmap_linear,
87 INLINE
static const SamplerState &get_default();
89 INLINE
void set_wrap_u(WrapMode wrap);
90 INLINE
void set_wrap_v(WrapMode wrap);
91 INLINE
void set_wrap_w(WrapMode wrap);
92 INLINE
void set_minfilter(FilterType filter);
93 INLINE
void set_magfilter(FilterType filter);
94 INLINE
void set_anisotropic_degree(
int anisotropic_degree);
96 INLINE
void set_min_lod(PN_stdfloat min_lod);
97 INLINE
void set_max_lod(PN_stdfloat max_lod);
98 INLINE
void set_lod_bias(PN_stdfloat lod_bias);
100 INLINE WrapMode get_wrap_u()
const;
101 INLINE WrapMode get_wrap_v()
const;
102 INLINE WrapMode get_wrap_w()
const;
103 INLINE FilterType get_minfilter()
const;
104 INLINE FilterType get_magfilter()
const;
105 FilterType get_effective_minfilter()
const;
106 FilterType get_effective_magfilter()
const;
107 INLINE
int get_anisotropic_degree()
const;
108 INLINE
int get_effective_anisotropic_degree()
const;
109 INLINE
const LColor &get_border_color()
const;
110 INLINE PN_stdfloat get_min_lod()
const;
111 INLINE PN_stdfloat get_max_lod()
const;
112 INLINE PN_stdfloat get_lod_bias()
const;
114 INLINE
bool uses_mipmaps()
const;
115 INLINE
static bool is_mipmap(FilterType type);
117 static string format_filter_type(FilterType ft);
118 static FilterType string_filter_type(
const string &str);
120 static string format_wrap_mode(WrapMode wm);
121 static WrapMode string_wrap_mode(
const string &str);
123 INLINE
bool operator == (
const SamplerState &other)
const;
124 INLINE
bool operator != (
const SamplerState &other)
const;
125 INLINE
bool operator < (
const SamplerState &other)
const;
135 int compare_to(
const SamplerState &other)
const;
137 void output(ostream &out)
const;
138 void write(ostream &out,
int indent)
const;
142 PN_stdfloat _min_lod;
143 PN_stdfloat _max_lod;
144 PN_stdfloat _lod_bias;
149 FilterType _minfilter : 4;
150 FilterType _magfilter : 4;
151 WrapMode _wrap_u : 4;
152 WrapMode _wrap_v : 4;
153 WrapMode _wrap_w : 4;
154 int _anisotropic_degree : 12;
156 static SamplerState _default;
159 void write_datagram(
Datagram &destination)
const;
166 static void init_type() {
168 register_type(_type_handle,
"SamplerState",
169 TypedObject::get_class_type());
185 INLINE ostream &operator << (ostream &out,
const SamplerState &m) {
190 INLINE ostream &operator << (ostream &out, SamplerState::FilterType ft) {
194 INLINE istream &operator >> (istream &in, SamplerState::FilterType &ft) {
201 INLINE ostream &operator << (ostream &out, SamplerState::WrapMode wm) {
205 INLINE istream &operator >> (istream &in, SamplerState::WrapMode &wm) {
212 #include "samplerState.I"
static void init_type()
This function is declared non-inline to work around a compiler bug in g++ 2.96.
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
static string format_wrap_mode(WrapMode wm)
Returns the indicated WrapMode converted to a string word.
static 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 string &str)
Returns the FilterType value associated with the given string representation, or FT_invalid if the st...
An instance of this class is passed to the Factory when requesting it to do its business and construc...
This class specializes ConfigVariable as an enumerated type.
Represents a set of settings that indicate how a texture is sampled.
This is the base class for all three-component vectors and points.
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 ...
static WrapMode string_wrap_mode(const string &str)
Returns the WrapMode value associated with the given string representation, or WM_invalid if the stri...