OpenSceneGraph 3.6.5
Sampler
Go to the documentation of this file.
1/* -*-c++-*-
2 * Copyright (C) 2017 Julien Valentin <mp3butcher@hotmail.com>
3 *
4 * This library is open source and may be redistributed and/or modified under
5 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
6 * (at your option) any later version. The full license is in LICENSE file
7 * included with this distribution, and on the openscenegraph.org website.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * OpenSceneGraph Public License for more details.
13*/
14#ifndef OSG_SAMPLER_H
15#define OSG_SAMPLER_H 1
16
17#include <osg/Texture>
18
19namespace osg{
26
27
29{
30 public:
32
34 Sampler(const Sampler& text,const CopyOp& copyop=CopyOp::SHALLOW_COPY);
35
37
38 virtual bool isTextureAttribute() const { return true; }
39
42
45
48
51
55
59
63 void setBorderColor(const Vec4d& color);
64
66 const Vec4d& getBorderColor() const { return _borderColor; }
67
73 void setMaxAnisotropy(float anis);
74
76 inline float getMaxAnisotropy() const { return _maxAnisotropy; }
77
78 void setMinLOD(float anis);
79
81 inline float getMinLOD() const { return _minlod; }
82
83 void setMaxLOD(float anis);
84
86 inline float getMaxLOD() const { return _maxlod; }
87
88 void setLODBias(float anis);
89
91 inline float getLODBias() const { return _lodbias; }
92
95
96 virtual void apply(State& state) const;
97
98 virtual void compileGLObjects(State&) const;
99
101 virtual void releaseGLObjects(State* state=0) const;
102
103 virtual int compare(const StateAttribute& sa) const;
104
105 protected:
112
116
119};
120}
121#endif
The core osg library provides the basic scene graph classes such as Nodes, State and Drawables,...
Definition AlphaFunc:19
Implements a simple buffered value for values that need to be buffered on a per graphics context basi...
Definition buffered_value:27
Copy Op(erator) used to control whether shallow or deep copy is used during copy construction and clo...
Definition CopyOp:41
@ SHALLOW_COPY
Definition CopyOp:47
virtual void apply(State &state) const
apply the OpenGL state attributes.
Texture::FilterMode getFilter(Texture::FilterParameter which) const
Gets the texture filter mode.
buffered_value< GLuint > _PCsampler
Definition Sampler:117
Texture::ShadowTextureMode _shadow_texture_mode
Definition Sampler:110
Texture::WrapMode _wrap_r
Definition Sampler:108
void setLODBias(float anis)
Vec4d _borderColor
Definition Sampler:111
void setShadowTextureMode(Texture::ShadowTextureMode mode)
Sets shadow texture mode after comparison.
float getMaxLOD() const
Gets the maximum anisotropy value.
Definition Sampler:86
META_StateAttribute(osg, Sampler, SAMPLER) virtual bool isTextureAttribute() const
Definition Sampler:36
buffered_value< uint8_t > _PCdirtyflags
Definition Sampler:118
static void generateSamplerObjects(StateSet &)
helper method to generate Sampler from Texture's sampling parameters (except shadow_texture_mode left...
void setShadowCompareFunc(Texture::ShadowCompareFunc func)
Sets shadow texture comparison function.
Texture::ShadowTextureMode getShadowTextureMode() const
Definition Sampler:58
float getMinLOD() const
Gets the maximum anisotropy value.
Definition Sampler:81
void setMaxAnisotropy(float anis)
Sets the maximum anisotropy value, default value is 1.0 for no anisotropic filtering.
void setBorderColor(const Vec4d &color)
Sets the border color.
void setMaxLOD(float anis)
Texture::FilterMode _mag_filter
Definition Sampler:114
Texture::WrapMode _wrap_s
Definition Sampler:106
float _maxlod
Definition Sampler:115
float _minlod
Definition Sampler:115
virtual void releaseGLObjects(State *state=0) const
release state's SamplerObject
float _maxAnisotropy
Definition Sampler:115
Texture::ShadowCompareFunc getShadowCompareFunc() const
Definition Sampler:54
virtual int compare(const StateAttribute &sa) const
Return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs.
void setWrap(Texture::WrapParameter which, Texture::WrapMode wrap)
Sets the texture wrap mode.
Texture::WrapMode getWrap(Texture::WrapParameter which) const
Gets the texture wrap mode.
float getLODBias() const
Gets the maximum anisotropy value.
Definition Sampler:91
Texture::FilterMode _min_filter
Definition Sampler:113
Texture::ShadowCompareFunc _shadow_compare_func
Definition Sampler:109
Sampler(const Sampler &text, const CopyOp &copyop=CopyOp::SHALLOW_COPY)
Copy constructor using CopyOp to manage deep vs shallow copy.
Texture::WrapMode _wrap_t
Definition Sampler:107
const Vec4d & getBorderColor() const
Gets the border color.
Definition Sampler:66
float getMaxAnisotropy() const
Gets the maximum anisotropy value.
Definition Sampler:76
void setFilter(Texture::FilterParameter which, Texture::FilterMode filter)
Sets the texture filter mode.
void setMinLOD(float anis)
float _lodbias
Definition Sampler:115
virtual void compileGLObjects(State &) const
Default to nothing to compile - all state is applied immediately.
Encapsulates the current applied OpenGL modes, attributes and vertex arrays settings,...
Definition State:80
Base class for state attributes.
Definition StateAttribute:77
virtual bool isTextureAttribute() const
Return true if StateAttribute is a type which controls texturing and needs to be issued w....
Definition StateAttribute:273
@ SAMPLER
Definition StateAttribute:212
friend class osg::StateSet
Definition StateAttribute:380
ShadowCompareFunc
Definition Texture:709
ShadowTextureMode
Definition Texture:724
FilterMode
Definition Texture:499
WrapMode
Definition Texture:467
WrapParameter
Definition Texture:461
FilterParameter
Definition Texture:494
General purpose double quad.
Definition Vec4d:29
#define OSG_EXPORT
Definition Export:39

osg logo
Generated at Wed Jul 23 2025 00:00:00 for the OpenSceneGraph by doxygen 1.14.0.