36 lines
974 B
C++
36 lines
974 B
C++
#ifndef ITextureSampler11_h__
|
|
#define ITextureSampler11_h__
|
|
#include "render/ITextureSampler.h"
|
|
|
|
#include <d3d11.h>
|
|
#include <dxgi.h>
|
|
#include <d3dx11.h>
|
|
#include "Globals.h"
|
|
|
|
namespace LifeGraphics
|
|
{
|
|
class ITextureSampler11 : public ITextureSampler
|
|
{
|
|
public:
|
|
ID3D11SamplerState* state;
|
|
|
|
ITextureSampler11(ISamplerDescription* desc, ID3D11Device* dev)
|
|
{
|
|
D3D11_SAMPLER_DESC d;
|
|
ZeroMemory(&d, sizeof(D3D11_SAMPLER_DESC));
|
|
d.AddressU = static_cast<D3D11_TEXTURE_ADDRESS_MODE>(desc->AddressU);
|
|
d.AddressV = static_cast<D3D11_TEXTURE_ADDRESS_MODE>(desc->AddressV);
|
|
d.AddressW = static_cast<D3D11_TEXTURE_ADDRESS_MODE>(desc->AddressW);
|
|
d.MaxAnisotropy = 1;
|
|
d.Filter = static_cast<D3D11_FILTER>(desc->Filter);
|
|
d.ComparisonFunc = static_cast<D3D11_COMPARISON_FUNC>(desc->CmpFunc);
|
|
d.MaxLOD = 3.402823466e+38F;
|
|
dev->CreateSamplerState(&d, &state);
|
|
}
|
|
~ITextureSampler11()
|
|
{
|
|
SAFE_RELEASE(state);
|
|
}
|
|
};
|
|
}
|
|
#endif // ITextureSampler11_h__
|