Jopnal Engine  alpha 0.4
Simple Component Based 2D/3D Game Engine
Public Types | Public Member Functions | Static Public Member Functions | List of all members
jop::TextureSampler Class Referencefinal

#include <TextureSampler.hpp>

Inheritance diagram for jop::TextureSampler:
jop::Resource jop::SafeReferenceable< Resource > jop::SerializeInfo

Public Types

enum  Filter { Filter::None, Filter::Bilinear, Filter::Trilinear, Filter::Anisotropic }
 
enum  Repeat { Repeat::Basic, Repeat::Mirrored, Repeat::ClampEdge, Repeat::ClampBorder }
 

Public Member Functions

 TextureSampler (const std::string &name)
 Constructor. More...
 
 TextureSampler (const std::string &name, const Filter filter, const Repeat repeat, const float param=1.f)
 Constructor. More...
 
 ~TextureSampler ()
 Destructor. More...
 
void bind (const unsigned int textureUnit) const
 Bind this sampler. More...
 
TextureSamplerreset ()
 Delete and recreate this sampler, clearing all the settings. More...
 
TextureSamplersetFilterMode (const Filter mode, const float param=1.f)
 Set the filtering mode. More...
 
TextureSamplersetRepeatMode (const Repeat repeat)
 Set the repeating mode. More...
 
TextureSamplersetBorderColor (const Color &color)
 Set the border color. More...
 
unsigned int getHandle () const
 Get the OpenGL handle. More...
 
Filter getFilterMode () const
 Get the filtering mode. More...
 
Repeat getRepeatMode () const
 Get the repeating mode. More...
 
float getAnisotropyLevel () const
 Get the anisotropy level. More...
 
const ColorgetBorderColor () const
 Get the border color. More...
 
- Public Member Functions inherited from jop::Resource
 Resource (const std::string &name)
 Constructor. More...
 
virtual ~Resource ()=0
 Virtual destructor. More...
 
const std::string & getName () const
 Get the name of this resource. More...
 
void setPersistence (const unsigned short level)
 Set the persistence level. More...
 
unsigned short getPersistence () const
 Get the persistence level. More...
 
- Public Member Functions inherited from jop::SafeReferenceable< Resource >
WeakReference< ResourcegetReference () const
 Get a weak reference to the bound object. More...
 
- Public Member Functions inherited from jop::SerializeInfo
 SerializeInfo ()
 
void setSerializePackage (const uint16 package)
 
uint16 getSerializePackage () const
 
void setShouldSerialize (const bool set)
 
bool shouldSerialize () const
 
void setLightSerializeable (const bool set)
 
bool isLightSerializeable () const
 

Static Public Member Functions

static void unbind (const unsigned int textureUnit)
 Unbind a sampler. More...
 
static float getMaxAnisotropy ()
 Get the maximum anisotropy level supported by the system. More...
 

Additional Inherited Members

- Protected Member Functions inherited from jop::Resource
 Resource (const Resource &other, const std::string &newName)
 Copy constructor. More...
 
- Protected Member Functions inherited from jop::SafeReferenceable< Resource >
 SafeReferenceable (Resource *ref)
 Constructor. More...
 
 SafeReferenceable (SafeReferenceable< Resource > &&other)
 Move constructor. More...
 
SafeReferenceableoperator= (SafeReferenceable< Resource > &&other)
 Move assignment operator. More...
 
 ~SafeReferenceable ()
 Protected destructor. More...
 

Detailed Description

Definition at line 36 of file TextureSampler.hpp.

Member Enumeration Documentation

The filtering mode

Enumerator
None 

No filtering.

Bilinear 

Bilinear (linear) filtering.

Trilinear 

Trilinear filtering, requires mipmaps.

Anisotropic 

Anisotropic filtering, requires mipmaps

        \warning Only supported with the extension EXT_texture_filter_anisotropic

Definition at line 46 of file TextureSampler.hpp.

The repeat mode

Warning
Repeat modes (Basic, Mirrored) on GLES 2.0 are only supported with the extension OES_texture_npot, when using non-power-of-two textures
Enumerator
Basic 

Repeat.

Mirrored 

Mirrored repeat.

ClampEdge 

Clamp to edge.

ClampBorder 

Clamp to border

        \warning On GLES 3.1 and lesser, only supported with one of these extensions:
                 NV_texture_border_clamp, EXT_texture_border_clamp, OES_texture_border_clamp

Definition at line 64 of file TextureSampler.hpp.

Constructor & Destructor Documentation

jop::TextureSampler::TextureSampler ( const std::string &  name)

Constructor.

This will create a sampler object with default settings.

Parameters
nameName of the resource
jop::TextureSampler::TextureSampler ( const std::string &  name,
const Filter  filter,
const Repeat  repeat,
const float  param = 1.f 
)

Constructor.

Parameters
nameName of the resource
filterInitial filtering mode
repeatInitial repeating mode
paramAnisotropic filtering level
jop::TextureSampler::~TextureSampler ( )

Destructor.

Member Function Documentation

void jop::TextureSampler::bind ( const unsigned int  textureUnit) const

Bind this sampler.

Parameters
textureUnitThe texture unit to bind this sample into
float jop::TextureSampler::getAnisotropyLevel ( ) const

Get the anisotropy level.

Returns
The anisotropy level
const Color& jop::TextureSampler::getBorderColor ( ) const

Get the border color.

Returns
The border color
Filter jop::TextureSampler::getFilterMode ( ) const

Get the filtering mode.

Returns
The filtering mode
unsigned int jop::TextureSampler::getHandle ( ) const

Get the OpenGL handle.

Returns
The OpenGL handle
static float jop::TextureSampler::getMaxAnisotropy ( )
static

Get the maximum anisotropy level supported by the system.

Returns
The maximum anisotropy level. Zero if not supported
Repeat jop::TextureSampler::getRepeatMode ( ) const

Get the repeating mode.

Returns
The repeating mode
TextureSampler& jop::TextureSampler::reset ( )

Delete and recreate this sampler, clearing all the settings.

Returns
Reference to self
TextureSampler& jop::TextureSampler::setBorderColor ( const Color color)

Set the border color.

Warning
On GLES 3.1 and lesser, only supported with one of these extensions: EXT_texture_border_clamp, OES_texture_border_clamp
Parameters
colorThe border color
Returns
Reference to self
TextureSampler& jop::TextureSampler::setFilterMode ( const Filter  mode,
const float  param = 1.f 
)

Set the filtering mode.

Parameters
modeThe filtering mode
paramPossible anisotropic filtering level
Returns
Reference to self
TextureSampler& jop::TextureSampler::setRepeatMode ( const Repeat  repeat)

Set the repeating mode.

Parameters
repeatThe repeating mode
Returns
Reference to self
static void jop::TextureSampler::unbind ( const unsigned int  textureUnit)
static

Unbind a sampler.

Parameters
textureUnitThe texture unit to unbind a sampler from

The documentation for this class was generated from the following file: