|
|
@@ -25,144 +25,94 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
|
THE SOFTWARE.
|
|
|
-----------------------------------------------------------------------------
|
|
|
*/
|
|
|
-#include "CmTextureState.h"
|
|
|
+#include "CmSamplerState.h"
|
|
|
#include "CmException.h"
|
|
|
|
|
|
namespace CamelotEngine {
|
|
|
|
|
|
+ SamplerState SamplerState::EMPTY;
|
|
|
//-----------------------------------------------------------------------
|
|
|
- TextureState::TextureState(TextureType type)
|
|
|
- : mTextureType(type)
|
|
|
- , mDesiredFormat(PF_UNKNOWN)
|
|
|
- , mTextureSrcMipmaps(MIP_DEFAULT)
|
|
|
- , mIsAlpha(false)
|
|
|
- , mHwGamma(false)
|
|
|
+ SamplerState::SamplerState()
|
|
|
+ : mHwGamma(false)
|
|
|
, mMinFilter(FO_LINEAR)
|
|
|
, mMagFilter(FO_LINEAR)
|
|
|
, mMipFilter(FO_POINT)
|
|
|
, mMaxAniso(0)
|
|
|
, mMipmapBias(0)
|
|
|
- , mIsDefaultAniso(true)
|
|
|
- , mIsDefaultFiltering(true)
|
|
|
, mBindingType(BT_FRAGMENT)
|
|
|
{
|
|
|
setTextureAddressingMode(TAM_WRAP);
|
|
|
}
|
|
|
|
|
|
//-----------------------------------------------------------------------
|
|
|
- TextureState::TextureState(const TextureState& oth )
|
|
|
+ SamplerState::SamplerState(const SamplerState& oth )
|
|
|
{
|
|
|
*this = oth;
|
|
|
}
|
|
|
|
|
|
//-----------------------------------------------------------------------
|
|
|
- TextureState::~TextureState()
|
|
|
+ SamplerState::~SamplerState()
|
|
|
{
|
|
|
}
|
|
|
//-----------------------------------------------------------------------
|
|
|
- TextureState & TextureState::operator = (
|
|
|
- const TextureState &oth )
|
|
|
+ SamplerState & SamplerState::operator = (
|
|
|
+ const SamplerState &oth )
|
|
|
{
|
|
|
return *this;
|
|
|
}
|
|
|
//-----------------------------------------------------------------------
|
|
|
- void TextureState::setBindingType(TextureState::BindingType bt)
|
|
|
+ void SamplerState::setBindingType(SamplerState::BindingType bt)
|
|
|
{
|
|
|
mBindingType = bt;
|
|
|
|
|
|
}
|
|
|
//-----------------------------------------------------------------------
|
|
|
- TextureState::BindingType TextureState::getBindingType(void) const
|
|
|
+ SamplerState::BindingType SamplerState::getBindingType(void) const
|
|
|
{
|
|
|
return mBindingType;
|
|
|
}
|
|
|
- //-----------------------------------------------------------------------
|
|
|
- bool TextureState::isCubic(void) const
|
|
|
- {
|
|
|
- return mTextureType == TEX_TYPE_CUBE_MAP;
|
|
|
- }
|
|
|
- //-----------------------------------------------------------------------
|
|
|
- bool TextureState::is3D(void) const
|
|
|
- {
|
|
|
- return mTextureType == TEX_TYPE_3D;
|
|
|
- }
|
|
|
- //-----------------------------------------------------------------------
|
|
|
- TextureType TextureState::getTextureType(void) const
|
|
|
- {
|
|
|
- return mTextureType;
|
|
|
- }
|
|
|
- //-----------------------------------------------------------------------
|
|
|
- void TextureState::setDesiredFormat(PixelFormat desiredFormat)
|
|
|
- {
|
|
|
- mDesiredFormat = desiredFormat;
|
|
|
- }
|
|
|
- //-----------------------------------------------------------------------
|
|
|
- PixelFormat TextureState::getDesiredFormat(void) const
|
|
|
- {
|
|
|
- return mDesiredFormat;
|
|
|
- }
|
|
|
- //-----------------------------------------------------------------------
|
|
|
- void TextureState::setNumMipmaps(int numMipmaps)
|
|
|
- {
|
|
|
- mTextureSrcMipmaps = numMipmaps;
|
|
|
- }
|
|
|
- //-----------------------------------------------------------------------
|
|
|
- int TextureState::getNumMipmaps(void) const
|
|
|
- {
|
|
|
- return mTextureSrcMipmaps;
|
|
|
- }
|
|
|
- //-----------------------------------------------------------------------
|
|
|
- void TextureState::setIsAlpha(bool isAlpha)
|
|
|
- {
|
|
|
- mIsAlpha = isAlpha;
|
|
|
- }
|
|
|
- //-----------------------------------------------------------------------
|
|
|
- bool TextureState::getIsAlpha(void) const
|
|
|
- {
|
|
|
- return mIsAlpha;
|
|
|
- }
|
|
|
//-----------------------------------------------------------------------
|
|
|
- void TextureState::setHardwareGammaEnabled(bool g)
|
|
|
+ void SamplerState::setHardwareGammaEnabled(bool g)
|
|
|
{
|
|
|
mHwGamma = g;
|
|
|
}
|
|
|
//-----------------------------------------------------------------------
|
|
|
- bool TextureState::isHardwareGammaEnabled() const
|
|
|
+ bool SamplerState::isHardwareGammaEnabled() const
|
|
|
{
|
|
|
return mHwGamma;
|
|
|
}
|
|
|
//-----------------------------------------------------------------------
|
|
|
- const TextureState::UVWAddressingMode&
|
|
|
- TextureState::getTextureAddressingMode(void) const
|
|
|
+ const SamplerState::UVWAddressingMode&
|
|
|
+ SamplerState::getTextureAddressingMode(void) const
|
|
|
{
|
|
|
return mAddressMode;
|
|
|
}
|
|
|
//-----------------------------------------------------------------------
|
|
|
- void TextureState::setTextureAddressingMode(
|
|
|
- TextureState::TextureAddressingMode tam)
|
|
|
+ void SamplerState::setTextureAddressingMode(
|
|
|
+ SamplerState::TextureAddressingMode tam)
|
|
|
{
|
|
|
mAddressMode.u = tam;
|
|
|
mAddressMode.v = tam;
|
|
|
mAddressMode.w = tam;
|
|
|
}
|
|
|
//-----------------------------------------------------------------------
|
|
|
- void TextureState::setTextureAddressingMode(
|
|
|
- TextureState::TextureAddressingMode u,
|
|
|
- TextureState::TextureAddressingMode v,
|
|
|
- TextureState::TextureAddressingMode w)
|
|
|
+ void SamplerState::setTextureAddressingMode(
|
|
|
+ SamplerState::TextureAddressingMode u,
|
|
|
+ SamplerState::TextureAddressingMode v,
|
|
|
+ SamplerState::TextureAddressingMode w)
|
|
|
{
|
|
|
mAddressMode.u = u;
|
|
|
mAddressMode.v = v;
|
|
|
mAddressMode.w = w;
|
|
|
}
|
|
|
//-----------------------------------------------------------------------
|
|
|
- void TextureState::setTextureAddressingMode(
|
|
|
- const TextureState::UVWAddressingMode& uvw)
|
|
|
+ void SamplerState::setTextureAddressingMode(
|
|
|
+ const SamplerState::UVWAddressingMode& uvw)
|
|
|
{
|
|
|
mAddressMode = uvw;
|
|
|
}
|
|
|
//-----------------------------------------------------------------------
|
|
|
- void TextureState::setTextureFiltering(TextureFilterOptions filterType)
|
|
|
+ void SamplerState::setTextureFiltering(TextureFilterOptions filterType)
|
|
|
{
|
|
|
switch (filterType)
|
|
|
{
|
|
|
@@ -179,10 +129,9 @@ namespace CamelotEngine {
|
|
|
setTextureFiltering(FO_ANISOTROPIC, FO_ANISOTROPIC, FO_LINEAR);
|
|
|
break;
|
|
|
}
|
|
|
- mIsDefaultFiltering = false;
|
|
|
}
|
|
|
//-----------------------------------------------------------------------
|
|
|
- void TextureState::setTextureFiltering(FilterType ft, FilterOptions fo)
|
|
|
+ void SamplerState::setTextureFiltering(FilterType ft, FilterOptions fo)
|
|
|
{
|
|
|
switch (ft)
|
|
|
{
|
|
|
@@ -196,19 +145,17 @@ namespace CamelotEngine {
|
|
|
mMipFilter = fo;
|
|
|
break;
|
|
|
}
|
|
|
- mIsDefaultFiltering = false;
|
|
|
}
|
|
|
//-----------------------------------------------------------------------
|
|
|
- void TextureState::setTextureFiltering(FilterOptions minFilter,
|
|
|
+ void SamplerState::setTextureFiltering(FilterOptions minFilter,
|
|
|
FilterOptions magFilter, FilterOptions mipFilter)
|
|
|
{
|
|
|
mMinFilter = minFilter;
|
|
|
mMagFilter = magFilter;
|
|
|
mMipFilter = mipFilter;
|
|
|
- mIsDefaultFiltering = false;
|
|
|
}
|
|
|
//-----------------------------------------------------------------------
|
|
|
- FilterOptions TextureState::getTextureFiltering(FilterType ft) const
|
|
|
+ FilterOptions SamplerState::getTextureFiltering(FilterType ft) const
|
|
|
{
|
|
|
switch (ft)
|
|
|
{
|
|
|
@@ -224,13 +171,12 @@ namespace CamelotEngine {
|
|
|
}
|
|
|
|
|
|
//-----------------------------------------------------------------------
|
|
|
- void TextureState::setTextureAnisotropy(unsigned int maxAniso)
|
|
|
+ void SamplerState::setTextureAnisotropy(unsigned int maxAniso)
|
|
|
{
|
|
|
mMaxAniso = maxAniso;
|
|
|
- mIsDefaultAniso = false;
|
|
|
}
|
|
|
//-----------------------------------------------------------------------
|
|
|
- unsigned int TextureState::getTextureAnisotropy() const
|
|
|
+ unsigned int SamplerState::getTextureAnisotropy() const
|
|
|
{
|
|
|
return mMaxAniso;
|
|
|
}
|