osg/Sampler
Go to the documentation of this file.
/* -*-c++-*-
* Copyright (C) 2017 Julien Valentin <mp3butcher@hotmail.com>
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
#ifndef OSG_SAMPLER_H
#define OSG_SAMPLER_H 1
#include <osg/Texture>
namespace osg{
class OSG_EXPORT Sampler : public osg::StateAttribute
{
public:
Sampler();
Sampler(const Sampler& text,const CopyOp& copyop=CopyOp::SHALLOW_COPY);
META_StateAttribute(osg,Sampler,SAMPLER)
virtual bool isTextureAttribute() const { return true; }
void setWrap(Texture::WrapParameter which, Texture::WrapMode wrap);
Texture::WrapMode getWrap(Texture::WrapParameter which) const;
void setFilter(Texture::FilterParameter which, Texture::FilterMode filter);
Texture::FilterMode getFilter(Texture::FilterParameter which) const;
void setShadowCompareFunc(Texture::ShadowCompareFunc func);
Texture::ShadowCompareFunc getShadowCompareFunc() const { return _shadow_compare_func; }
void setShadowTextureMode(Texture::ShadowTextureMode mode);
Texture::ShadowTextureMode getShadowTextureMode() const { return _shadow_texture_mode; }
void setBorderColor(const Vec4d& color);
const Vec4d& getBorderColor() const { return _borderColor; }
void setMaxAnisotropy(float anis);
inline float getMaxAnisotropy() const { return _maxAnisotropy; }
void setMinLOD(float anis);
inline float getMinLOD() const { return _minlod; }
void setMaxLOD(float anis);
inline float getMaxLOD() const { return _maxlod; }
void setLODBias(float anis);
inline float getLODBias() const { return _lodbias; }
static void generateSamplerObjects(StateSet&);
virtual void apply(State& state) const;
virtual void compileGLObjects(State&) const;
virtual void releaseGLObjects(State* state=0) const;
virtual int compare(const StateAttribute& sa) const;
protected:
Texture::WrapMode _wrap_s;
Texture::WrapMode _wrap_t;
Texture::WrapMode _wrap_r;
Texture::ShadowCompareFunc _shadow_compare_func;
Texture::ShadowTextureMode _shadow_texture_mode;
Vec4d _borderColor;
Texture::FilterMode _min_filter;
Texture::FilterMode _mag_filter;
float _maxAnisotropy, _minlod, _maxlod, _lodbias;
mutable buffered_value<GLuint> _PCsampler;
mutable buffered_value<uint8_t> _PCdirtyflags;
};
}
#endif
Texture
osg::CopyOp
Definition CopyOp:41
osg::CopyOp::SHALLOW_COPY
@ SHALLOW_COPY
Definition CopyOp:47
osg::Sampler::apply
virtual void apply(State &state) const
osg::Sampler::getFilter
Texture::FilterMode getFilter(Texture::FilterParameter which) const
osg::Sampler::_PCsampler
buffered_value< GLuint > _PCsampler
Definition osg/Sampler:117
osg::Sampler::_shadow_texture_mode
Texture::ShadowTextureMode _shadow_texture_mode
Definition osg/Sampler:110
osg::Sampler::_wrap_r
Texture::WrapMode _wrap_r
Definition osg/Sampler:108
osg::Sampler::setLODBias
void setLODBias(float anis)
osg::Sampler::_borderColor
Vec4d _borderColor
Definition osg/Sampler:111
osg::Sampler::setShadowTextureMode
void setShadowTextureMode(Texture::ShadowTextureMode mode)
osg::Sampler::getMaxLOD
float getMaxLOD() const
Definition osg/Sampler:86
osg::Sampler::META_StateAttribute
META_StateAttribute(osg, Sampler, SAMPLER) virtual bool isTextureAttribute() const
Definition osg/Sampler:36
osg::Sampler::_PCdirtyflags
buffered_value< uint8_t > _PCdirtyflags
Definition osg/Sampler:118
osg::Sampler::generateSamplerObjects
static void generateSamplerObjects(StateSet &)
osg::Sampler::setShadowCompareFunc
void setShadowCompareFunc(Texture::ShadowCompareFunc func)
osg::Sampler::getShadowTextureMode
Texture::ShadowTextureMode getShadowTextureMode() const
Definition osg/Sampler:58
osg::Sampler::getMinLOD
float getMinLOD() const
Definition osg/Sampler:81
osg::Sampler::setMaxAnisotropy
void setMaxAnisotropy(float anis)
osg::Sampler::setBorderColor
void setBorderColor(const Vec4d &color)
osg::Sampler::setMaxLOD
void setMaxLOD(float anis)
osg::Sampler::Sampler
Sampler()
osg::Sampler::_mag_filter
Texture::FilterMode _mag_filter
Definition osg/Sampler:114
osg::Sampler::_wrap_s
Texture::WrapMode _wrap_s
Definition osg/Sampler:106
osg::Sampler::_maxlod
float _maxlod
Definition osg/Sampler:115
osg::Sampler::_minlod
float _minlod
Definition osg/Sampler:115
osg::Sampler::releaseGLObjects
virtual void releaseGLObjects(State *state=0) const
osg::Sampler::_maxAnisotropy
float _maxAnisotropy
Definition osg/Sampler:115
osg::Sampler::getShadowCompareFunc
Texture::ShadowCompareFunc getShadowCompareFunc() const
Definition osg/Sampler:54
osg::Sampler::compare
virtual int compare(const StateAttribute &sa) const
osg::Sampler::setWrap
void setWrap(Texture::WrapParameter which, Texture::WrapMode wrap)
osg::Sampler::getWrap
Texture::WrapMode getWrap(Texture::WrapParameter which) const
osg::Sampler::getLODBias
float getLODBias() const
Definition osg/Sampler:91
osg::Sampler::_min_filter
Texture::FilterMode _min_filter
Definition osg/Sampler:113
osg::Sampler::_shadow_compare_func
Texture::ShadowCompareFunc _shadow_compare_func
Definition osg/Sampler:109
osg::Sampler::Sampler
Sampler(const Sampler &text, const CopyOp &copyop=CopyOp::SHALLOW_COPY)
osg::Sampler::_wrap_t
Texture::WrapMode _wrap_t
Definition osg/Sampler:107
osg::Sampler::getBorderColor
const Vec4d & getBorderColor() const
Definition osg/Sampler:66
osg::Sampler::getMaxAnisotropy
float getMaxAnisotropy() const
Definition osg/Sampler:76
osg::Sampler::setFilter
void setFilter(Texture::FilterParameter which, Texture::FilterMode filter)
osg::Sampler::setMinLOD
void setMinLOD(float anis)
osg::Sampler::_lodbias
float _lodbias
Definition osg/Sampler:115
osg::Sampler::compileGLObjects
virtual void compileGLObjects(State &) const
osg::StateAttribute
Definition StateAttribute:77
osg::StateAttribute::StateAttribute
StateAttribute()
osg::StateAttribute::isTextureAttribute
virtual bool isTextureAttribute() const
Definition StateAttribute:273
osg::StateAttribute::SAMPLER
@ SAMPLER
Definition StateAttribute:212
osg::StateAttribute::StateSet
friend class osg::StateSet
Definition StateAttribute:380
osg::State
Definition State:80
osg::Texture::ShadowCompareFunc
ShadowCompareFunc
Definition Texture:709
osg::Texture::ShadowTextureMode
ShadowTextureMode
Definition Texture:724
osg::Texture::FilterMode
FilterMode
Definition Texture:499
osg::Texture::WrapMode
WrapMode
Definition Texture:467
osg::Texture::WrapParameter
WrapParameter
Definition Texture:461
osg::Texture::FilterParameter
FilterParameter
Definition Texture:494
osg::Vec4d
Definition Vec4d:29
osg::buffered_value
Definition buffered_value:27
osg
Definition AlphaFunc:19
OSG_EXPORT
#define OSG_EXPORT
Definition osg/Export:39