public void Dispose() { if (com != null) { com.Dispose(); com = null; } }
public SamplerStateDesc(SamplerStateTypes type) { try { REIGN_D3D11_FILTER filter = REIGN_D3D11_FILTER.MIN_MAG_MIP_LINEAR; REIGN_D3D11_TEXTURE_ADDRESS_MODE address = REIGN_D3D11_TEXTURE_ADDRESS_MODE.WRAP; switch (type) { case SamplerStateTypes.Point_Wrap: filter = REIGN_D3D11_FILTER.MIN_MAG_MIP_POINT; address = REIGN_D3D11_TEXTURE_ADDRESS_MODE.WRAP; break; case SamplerStateTypes.Point_Clamp: filter = REIGN_D3D11_FILTER.MIN_MAG_MIP_POINT; address = REIGN_D3D11_TEXTURE_ADDRESS_MODE.CLAMP; break; case SamplerStateTypes.Point_Border: filter = REIGN_D3D11_FILTER.MIN_MAG_MIP_POINT; address = REIGN_D3D11_TEXTURE_ADDRESS_MODE.BORDER; break; case SamplerStateTypes.Linear_Wrap: filter = REIGN_D3D11_FILTER.MIN_MAG_MIP_LINEAR; address = REIGN_D3D11_TEXTURE_ADDRESS_MODE.WRAP; break; case SamplerStateTypes.Linear_Clamp: filter = REIGN_D3D11_FILTER.MIN_MAG_MIP_LINEAR; address = REIGN_D3D11_TEXTURE_ADDRESS_MODE.CLAMP; break; case SamplerStateTypes.Linear_Border: filter = REIGN_D3D11_FILTER.MIN_MAG_MIP_LINEAR; address = REIGN_D3D11_TEXTURE_ADDRESS_MODE.BORDER; break; default: Debug.ThrowError("SamplerStateDesc", "Unsuported SamplerStateType"); break; } com = new SamplerStateDescCom(filter, address); } catch (Exception e) { Dispose(); throw e; } }
public SamplerStateDesc(SamplerStateTypes type) { REIGN_D3DTEXTUREFILTERTYPE filter = REIGN_D3DTEXTUREFILTERTYPE.ANISOTROPIC; REIGN_D3DTEXTUREADDRESS addressU = REIGN_D3DTEXTUREADDRESS.BORDER, addressV = REIGN_D3DTEXTUREADDRESS.BORDER, addressW = REIGN_D3DTEXTUREADDRESS.BORDER; byte r = 0, g = 0, b = 0, a = 0; switch (type) { case SamplerStateTypes.Point_Wrap: filter = REIGN_D3DTEXTUREFILTERTYPE.POINT; addressU = REIGN_D3DTEXTUREADDRESS.WRAP; addressV = REIGN_D3DTEXTUREADDRESS.WRAP; addressW = REIGN_D3DTEXTUREADDRESS.WRAP; break; case SamplerStateTypes.Point_Clamp: filter = REIGN_D3DTEXTUREFILTERTYPE.POINT; addressU = REIGN_D3DTEXTUREADDRESS.CLAMP; addressV = REIGN_D3DTEXTUREADDRESS.CLAMP; addressW = REIGN_D3DTEXTUREADDRESS.CLAMP; break; case SamplerStateTypes.Linear_Wrap: filter = REIGN_D3DTEXTUREFILTERTYPE.LINEAR; addressU = REIGN_D3DTEXTUREADDRESS.WRAP; addressV = REIGN_D3DTEXTUREADDRESS.WRAP; addressW = REIGN_D3DTEXTUREADDRESS.WRAP; break; case SamplerStateTypes.Linear_Clamp: filter = REIGN_D3DTEXTUREFILTERTYPE.LINEAR; addressU = REIGN_D3DTEXTUREADDRESS.CLAMP; addressV = REIGN_D3DTEXTUREADDRESS.CLAMP; addressW = REIGN_D3DTEXTUREADDRESS.CLAMP; break; default: Debug.ThrowError("SamplerStateDesc", "Unsuported SamplerStateType"); break; } com = new SamplerStateDescCom(filter, addressU, addressV, addressW, r, g, b, a); }